Skip to content

Commit

Permalink
Merge branch 'main' into joao/add-storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
ribeirojose authored Nov 9, 2024
2 parents 2dfd858 + 407d0e6 commit 0fbe953
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 74 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Publish

on:
Expand All @@ -27,8 +24,7 @@ jobs:
with:
node-version: lts/*
cache: "yarn"
registry-url: "https://npm.pkg.github.com"
scope: "@bleu"
scope: "@bleu/builders"

- name: Install dependencies
run: yarn install --immutable
Expand All @@ -37,7 +33,7 @@ jobs:
if: github.ref == 'refs/tags/v*' # Only run on version tags
run: |
yarn build
npm login --registry=https://npm.pkg.github.com/ --scope=bleu
npm publish
npm login --scope=bleu.builders
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@bleu/ui",
"name": "@bleu.builders/ui",
"description": "",
"version": "0.1.129",
"version": "0.1.133",
"author": "",
"license": "",
"keywords": [],
Expand Down Expand Up @@ -75,13 +75,9 @@
"release": true
},
"npm": {
"publish": true,
"publishArgs": "--registry=https://npm.pkg.github.com"
"publish": true
}
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"engines": {
"node": ">=18.0.0"
},
Expand Down
90 changes: 46 additions & 44 deletions src/components/DataTable/DataTablePagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function DataTablePagination({
const pageCount = table.getPageCount() || 1;
return (
<div className="flex items-center justify-end px-2">
<div className="flex items-center space-x-6 lg:space-x-8">
<div className="flex flex-col items-end md:flex-row md:items-center gap-y-2 space-x-6 lg:space-x-8">
<div className="flex items-center space-x-2">
<p className="text-sm font-medium">{t("Items per page")}</p>
<Select.SelectRoot
Expand All @@ -43,49 +43,51 @@ export function DataTablePagination({
</Select.SelectContent>
</Select.SelectRoot>
</div>
<div className="flex w-[100px] items-center justify-center text-sm font-medium">
<Trans>Page {{ currentPage }} of</Trans> {pageCount}
</div>
<div className="flex items-center space-x-2">
<Button
// @ts-ignore
variant="outline"
className="hidden h-8 w-8 p-0 lg:flex"
onClick={() => table.setPageIndex(0)}
disabled={!table.getCanPreviousPage()}
>
<span className="sr-only">Go to first page</span>
<DoubleArrowLeftIcon className="h-4 w-4" />
</Button>
<Button
// @ts-ignore
variant="outline"
className="h-8 w-8 p-0"
onClick={() => table.previousPage()}
disabled={!table.getCanPreviousPage()}
>
<span className="sr-only">Go to previous page</span>
<ChevronLeftIcon className="h-4 w-4" />
</Button>
<Button
// @ts-ignore
variant="outline"
className="h-8 w-8 p-0"
onClick={() => table.nextPage()}
disabled={!table.getCanNextPage()}
>
<span className="sr-only">Go to next page</span>
<ChevronRightIcon className="h-4 w-4" />
</Button>
<Button
variant="outline"
className="hidden h-8 w-8 p-0 lg:flex"
onClick={() => table.setPageIndex(table.getPageCount() - 1)}
disabled={!table.getCanNextPage()}
>
<span className="sr-only">Go to last page</span>
<DoubleArrowRightIcon className="h-4 w-4" />
</Button>
<div className="flex items-center space-x-6 lg:space-x-8">
<div className="flex w-[100px] items-center justify-center text-sm font-medium">
<Trans>Page {{ currentPage }} of</Trans> {pageCount}
</div>
<div className="flex items-center space-x-2">
<Button
// @ts-ignore
variant="outline"
className="hidden h-8 w-8 p-0 lg:flex"
onClick={() => table.setPageIndex(0)}
disabled={!table.getCanPreviousPage()}
>
<span className="sr-only">Go to first page</span>
<DoubleArrowLeftIcon className="h-4 w-4" />
</Button>
<Button
// @ts-ignore
variant="outline"
className="h-8 w-8 p-0"
onClick={() => table.previousPage()}
disabled={!table.getCanPreviousPage()}
>
<span className="sr-only">Go to previous page</span>
<ChevronLeftIcon className="h-4 w-4" />
</Button>
<Button
// @ts-ignore
variant="outline"
className="h-8 w-8 p-0"
onClick={() => table.nextPage()}
disabled={!table.getCanNextPage()}
>
<span className="sr-only">Go to next page</span>
<ChevronRightIcon className="h-4 w-4" />
</Button>
<Button
variant="outline"
className="hidden h-8 w-8 p-0 lg:flex"
onClick={() => table.setPageIndex(table.getPageCount() - 1)}
disabled={!table.getCanNextPage()}
>
<span className="sr-only">Go to last page</span>
<DoubleArrowRightIcon className="h-4 w-4" />
</Button>
</div>
</div>
</div>
</div>
Expand Down
21 changes: 13 additions & 8 deletions src/components/DataTable/SWRDataTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,19 @@ export const renderDataTableCell = ({ filters, column, row, selectedRows }) => {
case "actions":
return <DataTableRowActions row={row} column={column} />;
case "image":
if (!row.getValue("image")?.url) return null;
return (
<img
className="aspect-ratio-1 size-16 rounded-sm object-contain"
src={row.getValue("image").url}
alt={row.getValue("name")}
/>
);
// eslint-disable-next-line no-case-declarations
const image = row.getValue("image") || value;
if (image?.url) {
return (
<img
className="aspect-ratio-1 size-16 rounded-sm object-contain"
src={image.url}
alt={image.alt_text}
/>
);
}
return <div className="max-w-[400px] truncate">{value}</div>;

case "link":
// eslint-disable-next-line no-case-declarations
const url = row.getValue("details_url");
Expand Down
4 changes: 2 additions & 2 deletions src/components/FormBuilder/fields/DatePickerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const DatePickerInput = withConditional<DatePickerInputProps>(
rules={field.required ? { required: true } : undefined}
defaultValue={field.defaultValue}
render={({ field: formField }) => (
<FormItem className="flex flex-col">
<FormItem className="flex flex-col w-full">
<FormLabel tooltip={field.tooltip}>{field.label}</FormLabel>
<Popover>
<PopoverTrigger asChild>
Expand All @@ -64,7 +64,7 @@ export const DatePickerInput = withConditional<DatePickerInputProps>(
</Button>
</FormControl>
</PopoverTrigger>
<PopoverContent className="w-auto p-0" align="start">
<PopoverContent className="w-auto p-0 z-[1500]" align="start">
{/* @ts-expect-error TS(2739) FIXME: Type '{ mode: string; selected: any; onSelect: any... Remove this comment to see the full error message */}
<Calendar
mode="single"
Expand Down
7 changes: 5 additions & 2 deletions src/components/FormBuilder/fields/InputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import { Input } from "#/components/ui/Input";

import { withConditional } from "../withConditional";
import { BaseField } from "../types";
import { cn } from "#/lib";

export interface InputFieldProps extends BaseField {
length?: {
maximum?: number;
minimum: number; // undefined or number
};
mode: "text" | "number";
mode: "text" | "number" | "time";
type: "input";
}

Expand Down Expand Up @@ -56,7 +57,9 @@ export const InputField = withConditional<InputFieldProps>(
}
defaultValue={field.defaultValue}
render={({ field: formField }) => (
<FormItem className="w-full">
<FormItem
className={cn(field.mode === "time" ? "w-[240px]" : "w-full")}
>
<FormLabel tooltip={field.tooltip}>{field.label}</FormLabel>
<FormDescription>{field.description}</FormDescription>
<FormControl>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/RadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const RadioGroupItem = React.forwardRef<
<RadioGroupPrimitive.Item
ref={ref}
className={cn(
"border-primary text-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground aspect-square h-4 w-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
"border-primary text-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground aspect-square h-4 w-4 min-h-4 min-w-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
Expand Down
5 changes: 4 additions & 1 deletion src/components/ui/Toaster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import {
ToastViewport,
} from "#/components/ui/Toast";
import { useToast } from "#/hooks/useToast";
import { cn } from "#/lib";

function Toaster({
className,
position = "top-right",
}: {
className?: string;
position?: "top-right" | "top-left" | "bottom-right" | "bottom-left";
}) {
const { toasts } = useToast();
Expand All @@ -28,7 +31,7 @@ function Toaster({
<ToastClose />
</Toast>
))}
<ToastViewport position={position} />
<ToastViewport className={cn(className)} position={position} />
</ToastProvider>
);
}
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3363,9 +3363,9 @@ __metadata:
languageName: node
linkType: hard

"@bleu/ui@workspace:.":
"@bleu.builders/ui@workspace:.":
version: 0.0.0-use.local
resolution: "@bleu/ui@workspace:."
resolution: "@bleu.builders/ui@workspace:."
dependencies:
"@chromatic-com/storybook": "npm:^1.6.1"
"@commitlint/cli": "npm:19.3.0"
Expand Down

0 comments on commit 0fbe953

Please sign in to comment.