@phsa.tec/design-system-react 0.1.6 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +390 -209
- package/dist/index.d.mts +485 -0
- package/dist/index.d.ts +485 -0
- package/dist/index.js +4259 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4186 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +2534 -0
- package/dist/styles.css.map +1 -0
- package/dist/styles.d.mts +2 -0
- package/dist/styles.d.ts +2 -0
- package/package.json +46 -6
- package/.eslintrc.json +0 -7
- package/.github/workflows/deploy-storybook.yml +0 -75
- package/.storybook/main.ts +0 -16
- package/.storybook/preview.ts +0 -15
- package/components.json +0 -21
- package/jest.config.ts +0 -25
- package/next.config.ts +0 -7
- package/postcss.config.mjs +0 -8
- package/public/file.svg +0 -1
- package/public/globe.svg +0 -1
- package/public/next.svg +0 -1
- package/public/vercel.svg +0 -1
- package/public/window.svg +0 -1
- package/src/app/columns.tsx +0 -178
- package/src/app/favicon.ico +0 -0
- package/src/app/fonts/GeistMonoVF.woff +0 -0
- package/src/app/fonts/GeistVF.woff +0 -0
- package/src/app/globals.css +0 -94
- package/src/app/layout.tsx +0 -35
- package/src/app/page.tsx +0 -7
- package/src/components/actions/AlertDialog/AlertDialog.tsx +0 -45
- package/src/components/actions/AlertDialog/alert-dialog.stories.tsx +0 -21
- package/src/components/actions/AlertDialog/index.ts +0 -1
- package/src/components/actions/Button/Button.stories.ts +0 -38
- package/src/components/actions/Button/Button.tsx +0 -23
- package/src/components/actions/Button/index.ts +0 -1
- package/src/components/actions/Collapsible/index.ts +0 -1
- package/src/components/actions/Dialog/Dialog.stories.tsx +0 -70
- package/src/components/actions/Dialog/Dialog.tsx +0 -87
- package/src/components/actions/Dialog/components/DialogWithActions/index.tsx +0 -40
- package/src/components/actions/Dialog/index.ts +0 -1
- package/src/components/actions/Steps/Steps.stories.tsx +0 -25
- package/src/components/actions/Steps/Steps.tsx +0 -51
- package/src/components/actions/Steps/index.ts +0 -1
- package/src/components/actions/index.ts +0 -5
- package/src/components/dataDisplay/Avatar/Avatar.stories.tsx +0 -22
- package/src/components/dataDisplay/Avatar/Avatar.tsx +0 -21
- package/src/components/dataDisplay/Avatar/index.ts +0 -2
- package/src/components/dataDisplay/Badge/Badge.stories.tsx +0 -36
- package/src/components/dataDisplay/Badge/index.ts +0 -1
- package/src/components/dataDisplay/Card/Card.stories.tsx +0 -24
- package/src/components/dataDisplay/Card/Card.tsx +0 -34
- package/src/components/dataDisplay/Card/index.ts +0 -1
- package/src/components/dataDisplay/DataPairList/DataPairList.tsx +0 -56
- package/src/components/dataDisplay/DataPairList/data-pair-list.stories.tsx +0 -87
- package/src/components/dataDisplay/DataPairList/index.ts +0 -2
- package/src/components/dataDisplay/DataPairList/types.ts +0 -10
- package/src/components/dataDisplay/DropDownMenu/index.ts +0 -1
- package/src/components/dataDisplay/ErrorMessage/ErrorMessage.tsx +0 -6
- package/src/components/dataDisplay/ErrorMessage/index.ts +0 -1
- package/src/components/dataDisplay/Icon/Icon.stories.tsx +0 -21
- package/src/components/dataDisplay/Icon/Icon.tsx +0 -47
- package/src/components/dataDisplay/Icon/index.ts +0 -1
- package/src/components/dataDisplay/Icon/types.ts +0 -6
- package/src/components/dataDisplay/Label/Label.stories.tsx +0 -21
- package/src/components/dataDisplay/Label/Label.tsx +0 -10
- package/src/components/dataDisplay/Label/index.ts +0 -1
- package/src/components/dataDisplay/Table/Table.tsx +0 -173
- package/src/components/dataDisplay/Table/columns.tsx +0 -223
- package/src/components/dataDisplay/Table/components/DynamicTable/data-table-column-header.tsx +0 -72
- package/src/components/dataDisplay/Table/components/DynamicTable/data-table-pagination.tsx +0 -91
- package/src/components/dataDisplay/Table/components/DynamicTable/data-table-toolbar.tsx +0 -17
- package/src/components/dataDisplay/Table/components/DynamicTable/data-table-view-options.tsx +0 -58
- package/src/components/dataDisplay/Table/components/DynamicTable/data-table.stories.tsx +0 -118
- package/src/components/dataDisplay/Table/components/DynamicTable/index.tsx +0 -136
- package/src/components/dataDisplay/Table/components/DynamicTable/types.ts +0 -43
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-column-header.tsx +0 -71
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-faceted-filter.tsx +0 -147
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-pagination.tsx +0 -97
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-row-actions.tsx +0 -78
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-toolbar.tsx +0 -60
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-view-options.tsx +0 -59
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table.tsx +0 -145
- package/src/components/dataDisplay/Table/custom/CustomTable/data.ts +0 -71
- package/src/components/dataDisplay/Table/custom/CustomTable/index.tsx +0 -34
- package/src/components/dataDisplay/Table/custom/CustomTable/schema.ts +0 -11
- package/src/components/dataDisplay/Table/index.ts +0 -2
- package/src/components/dataDisplay/Table/table.stories.tsx +0 -147
- package/src/components/dataDisplay/Table/types.ts +0 -15
- package/src/components/dataDisplay/Tabs/Tabs.stories.tsx +0 -34
- package/src/components/dataDisplay/Tabs/Tabs.tsx +0 -53
- package/src/components/dataDisplay/Tabs/index.ts +0 -1
- package/src/components/dataDisplay/Text/Text.stories.tsx +0 -66
- package/src/components/dataDisplay/Text/Text.tsx +0 -56
- package/src/components/dataDisplay/Text/index.ts +0 -1
- package/src/components/dataDisplay/index.ts +0 -8
- package/src/components/dataInput/Input/components/Input/Input.stories.tsx +0 -99
- package/src/components/dataInput/Input/components/Input/InputBase.tsx +0 -50
- package/src/components/dataInput/Input/components/Input/__tests__/input.test.tsx +0 -38
- package/src/components/dataInput/Input/components/Input/index.tsx +0 -48
- package/src/components/dataInput/Input/components/Input/types.ts +0 -15
- package/src/components/dataInput/Input/components/InputBase/index.tsx +0 -31
- package/src/components/dataInput/Input/components/MaskInput/__tests__/mask-input.test.tsx +0 -77
- package/src/components/dataInput/Input/components/MaskInput/index.ts +0 -1
- package/src/components/dataInput/Input/components/MaskInput/mask-input.stories.tsx +0 -85
- package/src/components/dataInput/Input/components/MaskInput/mask-input.tsx +0 -73
- package/src/components/dataInput/Input/components/MultipleInput/MultipleInput.tsx +0 -105
- package/src/components/dataInput/Input/components/MultipleInput/MultipleInputBase.tsx +0 -100
- package/src/components/dataInput/Input/components/MultipleInput/MultipleMaskInput.tsx +0 -35
- package/src/components/dataInput/Input/components/MultipleInput/MultipleNumberInput.tsx +0 -35
- package/src/components/dataInput/Input/components/MultipleInput/__tests__/multiple-input.test.tsx +0 -152
- package/src/components/dataInput/Input/components/MultipleInput/index.ts +0 -2
- package/src/components/dataInput/Input/components/MultipleInput/multiple-input.stories.tsx +0 -96
- package/src/components/dataInput/Input/components/NumberInput/__tests__/number-input.test.tsx +0 -175
- package/src/components/dataInput/Input/components/NumberInput/index.ts +0 -1
- package/src/components/dataInput/Input/components/NumberInput/number-input.stories.tsx +0 -76
- package/src/components/dataInput/Input/components/NumberInput/number-input.tsx +0 -70
- package/src/components/dataInput/Input/index.ts +0 -4
- package/src/components/dataInput/Select/MultiSelect/MultiSelect.stories.tsx +0 -119
- package/src/components/dataInput/Select/MultiSelect/MultiSelectBase.tsx +0 -135
- package/src/components/dataInput/Select/MultiSelect/index.tsx +0 -75
- package/src/components/dataInput/Select/Select.stories.tsx +0 -61
- package/src/components/dataInput/Select/Select.tsx +0 -73
- package/src/components/dataInput/Select/SelectBase.tsx +0 -58
- package/src/components/dataInput/Select/index.ts +0 -2
- package/src/components/dataInput/Switch/Switch.stories.tsx +0 -75
- package/src/components/dataInput/Switch/Switch.tsx +0 -52
- package/src/components/dataInput/Switch/index.ts +0 -1
- package/src/components/dataInput/checkbox/Checkbox.tsx +0 -57
- package/src/components/dataInput/checkbox/Checkbox_old.tsx +0 -58
- package/src/components/dataInput/checkbox/Checkout.stories.tsx +0 -62
- package/src/components/dataInput/checkbox/index.ts +0 -1
- package/src/components/dataInput/form/Form.tsx +0 -47
- package/src/components/dataInput/form/index.ts +0 -3
- package/src/components/dataInput/index.ts +0 -5
- package/src/components/feedback/ErrorLabel/index.tsx +0 -24
- package/src/components/feedback/Spinner/index.ts +0 -1
- package/src/components/feedback/Toast/Toast.stories.tsx +0 -45
- package/src/components/feedback/Toast/index.ts +0 -2
- package/src/components/feedback/index.ts +0 -2
- package/src/components/index.ts +0 -6
- package/src/components/layout/Crud/components/Table/index.tsx +0 -183
- package/src/components/layout/Crud/components/Table/types.ts +0 -15
- package/src/components/layout/Crud/crud.stories.tsx +0 -317
- package/src/components/layout/Crud/hook/useCrudLayout/index.tsx +0 -94
- package/src/components/layout/Crud/hook/useRequest/index.tsx +0 -156
- package/src/components/layout/Crud/index.tsx +0 -295
- package/src/components/layout/Crud/store/CrudLayoutStore.ts +0 -75
- package/src/components/layout/Crud/types.ts +0 -14
- package/src/components/layout/Drawer/CustomDrawer/index.tsx +0 -33
- package/src/components/layout/Drawer/Drawer.stories.tsx +0 -80
- package/src/components/layout/Drawer/index.ts +0 -2
- package/src/components/layout/PageLayout/PageLayout.stories.tsx +0 -42
- package/src/components/layout/PageLayout/index.tsx +0 -28
- package/src/components/layout/Separator/index.ts +0 -1
- package/src/components/layout/Sheet/Sheet.stories.tsx +0 -28
- package/src/components/layout/Sheet/Sheet.tsx +0 -22
- package/src/components/layout/Sheet/index.ts +0 -1
- package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -116
- package/src/components/layout/Sidebar/Sidebar.tsx +0 -50
- package/src/components/layout/Sidebar/components/app-sidebar.tsx +0 -203
- package/src/components/layout/Sidebar/components/footer-sidebar.tsx +0 -17
- package/src/components/layout/Sidebar/components/header-sidebar.tsx +0 -90
- package/src/components/layout/Sidebar/components/menus.tsx +0 -55
- package/src/components/layout/Sidebar/components/nav-projects.tsx +0 -88
- package/src/components/layout/Sidebar/components/nav-user.tsx +0 -114
- package/src/components/layout/Sidebar/components/team-switcher.tsx +0 -85
- package/src/components/layout/Sidebar/index.ts +0 -2
- package/src/components/layout/Sidebar/provider/index.tsx +0 -51
- package/src/components/layout/Tabs/Tabs.tsx +0 -51
- package/src/components/layout/Tabs/index.ts +0 -1
- package/src/components/layout/Tabs/tabs.stories.tsx +0 -57
- package/src/components/layout/index.ts +0 -6
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.tsx +0 -66
- package/src/components/navigation/Breadcrumbs/index.ts +0 -2
- package/src/components/navigation/index.ts +0 -1
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/alert.tsx +0 -59
- package/src/components/ui/avatar.tsx +0 -50
- package/src/components/ui/badge.tsx +0 -40
- package/src/components/ui/breadcrumb.tsx +0 -115
- package/src/components/ui/button.tsx +0 -57
- package/src/components/ui/card.tsx +0 -83
- package/src/components/ui/checkbox.tsx +0 -34
- package/src/components/ui/collapsible.tsx +0 -11
- package/src/components/ui/command.tsx +0 -153
- package/src/components/ui/dialog.tsx +0 -124
- package/src/components/ui/drawer.tsx +0 -117
- package/src/components/ui/dropdown-menu.tsx +0 -201
- package/src/components/ui/form.tsx +0 -179
- package/src/components/ui/input.tsx +0 -24
- package/src/components/ui/label.tsx +0 -30
- package/src/components/ui/popover.tsx +0 -33
- package/src/components/ui/select.tsx +0 -161
- package/src/components/ui/separator.tsx +0 -31
- package/src/components/ui/sheet.tsx +0 -140
- package/src/components/ui/sidebar.tsx +0 -763
- package/src/components/ui/skeleton.tsx +0 -15
- package/src/components/ui/sonner.tsx +0 -31
- package/src/components/ui/spinner.tsx +0 -54
- package/src/components/ui/switch.tsx +0 -33
- package/src/components/ui/table.tsx +0 -120
- package/src/components/ui/tabs.tsx +0 -55
- package/src/components/ui/toast.tsx +0 -130
- package/src/components/ui/toaster.tsx +0 -35
- package/src/components/ui/tooltip.tsx +0 -32
- package/src/hooks/use-conditional-controller.tsx +0 -35
- package/src/hooks/use-mask.tsx +0 -116
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/hooks/use-toast.ts +0 -191
- package/src/index.ts +0 -1
- package/src/introduction.mdx +0 -132
- package/src/lib/utils.ts +0 -6
- package/tailwind.config.ts +0 -83
- package/tsconfig.json +0 -27
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React, { useEffect, useState } from "react";
|
|
4
|
-
import {
|
|
5
|
-
ColumnDef,
|
|
6
|
-
ColumnFiltersState,
|
|
7
|
-
SortingState,
|
|
8
|
-
TableState,
|
|
9
|
-
VisibilityState,
|
|
10
|
-
flexRender,
|
|
11
|
-
getCoreRowModel,
|
|
12
|
-
getFacetedRowModel,
|
|
13
|
-
getFacetedUniqueValues,
|
|
14
|
-
getFilteredRowModel,
|
|
15
|
-
getPaginationRowModel,
|
|
16
|
-
getSortedRowModel,
|
|
17
|
-
useReactTable,
|
|
18
|
-
} from "@tanstack/react-table";
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
Table,
|
|
22
|
-
TableBody,
|
|
23
|
-
TableCell,
|
|
24
|
-
TableHead,
|
|
25
|
-
TableHeader,
|
|
26
|
-
TableRow,
|
|
27
|
-
} from "../../../../../components/ui/table";
|
|
28
|
-
|
|
29
|
-
import { DataTablePagination } from "./data-table-pagination";
|
|
30
|
-
import { DataTableToolbar } from "./data-table-toolbar";
|
|
31
|
-
|
|
32
|
-
interface DataTableProps<TData, TValue> {
|
|
33
|
-
columns: ColumnDef<TData, TValue>[];
|
|
34
|
-
data: TData[];
|
|
35
|
-
callback?: (data: TableState) => void;
|
|
36
|
-
renderToolbar?: (table: any) => React.ReactNode;
|
|
37
|
-
renderPagination?: (table: any) => React.ReactNode;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function DataTable<TData, TValue>({
|
|
41
|
-
columns,
|
|
42
|
-
data,
|
|
43
|
-
callback = () => {},
|
|
44
|
-
renderToolbar = () => null,
|
|
45
|
-
renderPagination = () => null,
|
|
46
|
-
}: DataTableProps<TData, TValue>) {
|
|
47
|
-
const [rowSelection, setRowSelection] = useState({});
|
|
48
|
-
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});
|
|
49
|
-
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
|
|
50
|
-
const [sorting, setSorting] = useState<SortingState>([]);
|
|
51
|
-
|
|
52
|
-
const table = useReactTable({
|
|
53
|
-
data,
|
|
54
|
-
columns,
|
|
55
|
-
state: {
|
|
56
|
-
sorting,
|
|
57
|
-
columnVisibility,
|
|
58
|
-
rowSelection,
|
|
59
|
-
columnFilters,
|
|
60
|
-
},
|
|
61
|
-
enableRowSelection: true,
|
|
62
|
-
onRowSelectionChange: setRowSelection,
|
|
63
|
-
onSortingChange: setSorting,
|
|
64
|
-
onColumnFiltersChange: setColumnFilters,
|
|
65
|
-
onColumnVisibilityChange: setColumnVisibility,
|
|
66
|
-
getCoreRowModel: getCoreRowModel(),
|
|
67
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
68
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
69
|
-
getSortedRowModel: getSortedRowModel(),
|
|
70
|
-
getFacetedRowModel: getFacetedRowModel(),
|
|
71
|
-
getFacetedUniqueValues: getFacetedUniqueValues(),
|
|
72
|
-
manualPagination: true,
|
|
73
|
-
manualSorting: true,
|
|
74
|
-
manualFiltering: true,
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const {
|
|
78
|
-
pagination,
|
|
79
|
-
sorting: tableSorting,
|
|
80
|
-
columnFilters: tableFilters,
|
|
81
|
-
} = table.getState();
|
|
82
|
-
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
callback(table.getState());
|
|
85
|
-
}, [pagination, tableSorting, tableFilters]);
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<div className="space-y-4">
|
|
89
|
-
{/* <DataTableToolbar table={table} /> */}
|
|
90
|
-
{renderToolbar(table)}
|
|
91
|
-
<div className="rounded-md border">
|
|
92
|
-
<Table>
|
|
93
|
-
<TableHeader>
|
|
94
|
-
{table.getHeaderGroups().map((headerGroup) => (
|
|
95
|
-
<TableRow key={headerGroup.id}>
|
|
96
|
-
{headerGroup.headers.map((header) => {
|
|
97
|
-
return (
|
|
98
|
-
<TableHead key={header.id} colSpan={header.colSpan}>
|
|
99
|
-
{header.isPlaceholder
|
|
100
|
-
? null
|
|
101
|
-
: flexRender(
|
|
102
|
-
header.column.columnDef.header,
|
|
103
|
-
header.getContext()
|
|
104
|
-
)}
|
|
105
|
-
</TableHead>
|
|
106
|
-
);
|
|
107
|
-
})}
|
|
108
|
-
</TableRow>
|
|
109
|
-
))}
|
|
110
|
-
</TableHeader>
|
|
111
|
-
<TableBody>
|
|
112
|
-
{table.getRowModel().rows?.length ? (
|
|
113
|
-
table.getRowModel().rows.map((row) => (
|
|
114
|
-
<TableRow
|
|
115
|
-
key={row.id}
|
|
116
|
-
data-state={row.getIsSelected() && "selected"}
|
|
117
|
-
>
|
|
118
|
-
{row.getVisibleCells().map((cell) => (
|
|
119
|
-
<TableCell key={cell.id}>
|
|
120
|
-
{flexRender(
|
|
121
|
-
cell.column.columnDef.cell,
|
|
122
|
-
cell.getContext()
|
|
123
|
-
)}
|
|
124
|
-
</TableCell>
|
|
125
|
-
))}
|
|
126
|
-
</TableRow>
|
|
127
|
-
))
|
|
128
|
-
) : (
|
|
129
|
-
<TableRow>
|
|
130
|
-
<TableCell
|
|
131
|
-
colSpan={columns.length}
|
|
132
|
-
className="h-24 text-center"
|
|
133
|
-
>
|
|
134
|
-
Sem resultados.
|
|
135
|
-
</TableCell>
|
|
136
|
-
</TableRow>
|
|
137
|
-
)}
|
|
138
|
-
</TableBody>
|
|
139
|
-
</Table>
|
|
140
|
-
</div>
|
|
141
|
-
{renderPagination(table)}
|
|
142
|
-
{/* <DataTablePagination table={table} /> */}
|
|
143
|
-
</div>
|
|
144
|
-
);
|
|
145
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ArrowDownIcon,
|
|
3
|
-
ArrowRightIcon,
|
|
4
|
-
ArrowUpIcon,
|
|
5
|
-
CheckCircledIcon,
|
|
6
|
-
CircleIcon,
|
|
7
|
-
CrossCircledIcon,
|
|
8
|
-
QuestionMarkCircledIcon,
|
|
9
|
-
StopwatchIcon,
|
|
10
|
-
} from "@radix-ui/react-icons";
|
|
11
|
-
|
|
12
|
-
export const labels = [
|
|
13
|
-
{
|
|
14
|
-
value: "bug",
|
|
15
|
-
label: "Bug",
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
value: "feature",
|
|
19
|
-
label: "Feature",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
value: "documentation",
|
|
23
|
-
label: "Documentation",
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
export const statuses = [
|
|
28
|
-
{
|
|
29
|
-
value: "backlog",
|
|
30
|
-
label: "Backlog",
|
|
31
|
-
icon: QuestionMarkCircledIcon,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
value: "todo",
|
|
35
|
-
label: "Todo",
|
|
36
|
-
icon: CircleIcon,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
value: "in progress",
|
|
40
|
-
label: "In Progress",
|
|
41
|
-
icon: StopwatchIcon,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
value: "done",
|
|
45
|
-
label: "Done",
|
|
46
|
-
icon: CheckCircledIcon,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
value: "canceled",
|
|
50
|
-
label: "Canceled",
|
|
51
|
-
icon: CrossCircledIcon,
|
|
52
|
-
},
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
export const priorities = [
|
|
56
|
-
{
|
|
57
|
-
label: "Low",
|
|
58
|
-
value: "low",
|
|
59
|
-
icon: ArrowDownIcon,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
label: "Medium",
|
|
63
|
-
value: "medium",
|
|
64
|
-
icon: ArrowRightIcon,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
label: "High",
|
|
68
|
-
value: "high",
|
|
69
|
-
icon: ArrowUpIcon,
|
|
70
|
-
},
|
|
71
|
-
];
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { DataTable } from "./data-table";
|
|
3
|
-
export { DataTableColumnHeader } from "./data-table-column-header";
|
|
4
|
-
export { DataTableRowActions } from "./data-table-row-actions";
|
|
5
|
-
export { DataTablePagination } from "./data-table-pagination";
|
|
6
|
-
export { DataTableToolbar } from "./data-table-toolbar";
|
|
7
|
-
|
|
8
|
-
import { ColumnDef, TableState } from "@tanstack/react-table";
|
|
9
|
-
|
|
10
|
-
export type CustomTableProps<TData, TValue> = {
|
|
11
|
-
data: TData[];
|
|
12
|
-
columns: ColumnDef<TData, TValue>[];
|
|
13
|
-
callback?: (data: TableState) => void;
|
|
14
|
-
renderToolbar?: (table: any) => React.ReactNode;
|
|
15
|
-
renderPagination?: (table: any) => React.ReactNode;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export function CustomTable<TData, TValue>({
|
|
19
|
-
data,
|
|
20
|
-
columns,
|
|
21
|
-
callback = () => {},
|
|
22
|
-
renderPagination = () => null,
|
|
23
|
-
renderToolbar = () => null,
|
|
24
|
-
}: CustomTableProps<TData, TValue>) {
|
|
25
|
-
return (
|
|
26
|
-
<DataTable
|
|
27
|
-
columns={columns}
|
|
28
|
-
data={data}
|
|
29
|
-
callback={callback}
|
|
30
|
-
renderPagination={renderPagination}
|
|
31
|
-
renderToolbar={renderToolbar}
|
|
32
|
-
/>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/nextjs";
|
|
2
|
-
import { Table } from "./Table";
|
|
3
|
-
import { ColumnDef } from "@tanstack/react-table";
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Table> = {
|
|
6
|
-
title: "DataDisplay/Table",
|
|
7
|
-
component: Table,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: "centered",
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default meta;
|
|
14
|
-
type Story = StoryObj<typeof Table<User>>;
|
|
15
|
-
|
|
16
|
-
type User = {
|
|
17
|
-
id: number;
|
|
18
|
-
name: string;
|
|
19
|
-
email: string;
|
|
20
|
-
role: string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const mockData: User[] = [
|
|
24
|
-
{
|
|
25
|
-
id: 1,
|
|
26
|
-
name: "John Doe",
|
|
27
|
-
email: "john@example.com",
|
|
28
|
-
role: "Admin",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: 2,
|
|
32
|
-
name: "Jane Smith",
|
|
33
|
-
email: "jane@example.com",
|
|
34
|
-
role: "User",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
id: 3,
|
|
38
|
-
name: "Bob Johnson",
|
|
39
|
-
email: "bob@example.com",
|
|
40
|
-
role: "Editor",
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: 4,
|
|
44
|
-
name: "Alice Brown",
|
|
45
|
-
email: "alice@example.com",
|
|
46
|
-
role: "User",
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: 5,
|
|
50
|
-
name: "Charlie Wilson",
|
|
51
|
-
email: "charlie@example.com",
|
|
52
|
-
role: "Editor",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: 6,
|
|
56
|
-
name: "Diana Miller",
|
|
57
|
-
email: "diana@example.com",
|
|
58
|
-
role: "User",
|
|
59
|
-
},
|
|
60
|
-
];
|
|
61
|
-
|
|
62
|
-
const columns: ColumnDef<User>[] = [
|
|
63
|
-
{
|
|
64
|
-
accessorKey: "id",
|
|
65
|
-
header: "ID",
|
|
66
|
-
enableSorting: true,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
accessorKey: "name",
|
|
70
|
-
header: "Name",
|
|
71
|
-
enableSorting: true,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
accessorKey: "email",
|
|
75
|
-
header: "Email",
|
|
76
|
-
enableSorting: true,
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
accessorKey: "role",
|
|
80
|
-
header: "Role",
|
|
81
|
-
},
|
|
82
|
-
];
|
|
83
|
-
|
|
84
|
-
export const Default: Story = {
|
|
85
|
-
args: {
|
|
86
|
-
data: mockData,
|
|
87
|
-
columns: columns,
|
|
88
|
-
pagination: {
|
|
89
|
-
pageIndex: 0,
|
|
90
|
-
pageSize: 5,
|
|
91
|
-
},
|
|
92
|
-
onPaginationChange: (pagination) => {
|
|
93
|
-
console.log("Page changed:", {
|
|
94
|
-
pageIndex: pagination.pageIndex,
|
|
95
|
-
pageSize: pagination.pageSize,
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export const SmallPageSize: Story = {
|
|
102
|
-
args: {
|
|
103
|
-
data: mockData,
|
|
104
|
-
columns: columns,
|
|
105
|
-
pagination: {
|
|
106
|
-
pageIndex: 0,
|
|
107
|
-
pageSize: 3,
|
|
108
|
-
},
|
|
109
|
-
onPaginationChange: (pagination) => {
|
|
110
|
-
console.log("Page changed:", {
|
|
111
|
-
pageIndex: pagination.pageIndex,
|
|
112
|
-
pageSize: pagination.pageSize,
|
|
113
|
-
});
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export const StartingFromPage2: Story = {
|
|
119
|
-
args: {
|
|
120
|
-
data: mockData,
|
|
121
|
-
columns: columns,
|
|
122
|
-
pagination: {
|
|
123
|
-
pageIndex: 1, // Starts from second page
|
|
124
|
-
pageSize: 3,
|
|
125
|
-
},
|
|
126
|
-
onPaginationChange: (pagination) => {
|
|
127
|
-
console.log("Page changed:", {
|
|
128
|
-
pageIndex: pagination.pageIndex,
|
|
129
|
-
pageSize: pagination.pageSize,
|
|
130
|
-
});
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
export const EmptyTable: Story = {
|
|
136
|
-
args: {
|
|
137
|
-
data: [],
|
|
138
|
-
columns: columns,
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export const SingleRow: Story = {
|
|
143
|
-
args: {
|
|
144
|
-
data: [mockData[0]],
|
|
145
|
-
columns: columns,
|
|
146
|
-
},
|
|
147
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface Column<T> {
|
|
2
|
-
header: string;
|
|
3
|
-
accessorKey: keyof T;
|
|
4
|
-
cell?: (row: T) => React.ReactNode;
|
|
5
|
-
sortable?: boolean;
|
|
6
|
-
filterable?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface TableProps<T> {
|
|
10
|
-
data: T[];
|
|
11
|
-
columns: Column<T>[];
|
|
12
|
-
className?: string;
|
|
13
|
-
filters?: React.ReactNode;
|
|
14
|
-
onSort?: (field: keyof T, direction: "asc" | "desc") => void;
|
|
15
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/nextjs";
|
|
2
|
-
|
|
3
|
-
import { Tabs } from "./Tabs";
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: "DataDisplay/Tabs",
|
|
7
|
-
component: Tabs,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: "centered",
|
|
10
|
-
},
|
|
11
|
-
tags: ["autodocs"],
|
|
12
|
-
} satisfies Meta<typeof Tabs>;
|
|
13
|
-
|
|
14
|
-
export default meta;
|
|
15
|
-
type Story = StoryObj<typeof meta>;
|
|
16
|
-
|
|
17
|
-
export const Default: Story = {
|
|
18
|
-
args: {
|
|
19
|
-
data: [
|
|
20
|
-
{
|
|
21
|
-
label: "Tab 1",
|
|
22
|
-
value: "tab1",
|
|
23
|
-
content: <div>Tab 1 content</div>,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
label: "Tab 2",
|
|
27
|
-
value: "tab2",
|
|
28
|
-
content: <div>Tab 2 content</div>,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
defaultValue: "tab1",
|
|
32
|
-
onSelectTab: (value) => console.log(value),
|
|
33
|
-
},
|
|
34
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Tabs as TabsShadcn,
|
|
3
|
-
TabsContent,
|
|
4
|
-
TabsList,
|
|
5
|
-
TabsTrigger,
|
|
6
|
-
} from "../../../components/ui/tabs";
|
|
7
|
-
import { useCallback } from "react";
|
|
8
|
-
|
|
9
|
-
export type TabsProps = {
|
|
10
|
-
data: {
|
|
11
|
-
label: string;
|
|
12
|
-
value: string;
|
|
13
|
-
content: JSX.Element;
|
|
14
|
-
}[];
|
|
15
|
-
defaultValue: string;
|
|
16
|
-
className?: string;
|
|
17
|
-
onSelectTab?: (value: string) => void;
|
|
18
|
-
value?: string;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export function Tabs({
|
|
22
|
-
data,
|
|
23
|
-
className,
|
|
24
|
-
value,
|
|
25
|
-
onSelectTab = () => {},
|
|
26
|
-
}: TabsProps) {
|
|
27
|
-
const renderTabsTrigger = useCallback(() => {
|
|
28
|
-
return data.map(({ label, value }, index) => (
|
|
29
|
-
<TabsTrigger key={index} value={value} onClick={() => onSelectTab(value)}>
|
|
30
|
-
{label}
|
|
31
|
-
</TabsTrigger>
|
|
32
|
-
));
|
|
33
|
-
}, [data, onSelectTab]);
|
|
34
|
-
|
|
35
|
-
const renderTabsContent = useCallback(() => {
|
|
36
|
-
return data.map(({ value, content }, index) => (
|
|
37
|
-
<TabsContent key={index} value={value}>
|
|
38
|
-
{content}
|
|
39
|
-
</TabsContent>
|
|
40
|
-
));
|
|
41
|
-
}, [data]);
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<TabsShadcn defaultValue={value} className={className}>
|
|
45
|
-
{data?.length && (
|
|
46
|
-
<TabsList className="grid w-full grid-cols-2">
|
|
47
|
-
{renderTabsTrigger()}
|
|
48
|
-
</TabsList>
|
|
49
|
-
)}
|
|
50
|
-
{data?.length && renderTabsContent()}
|
|
51
|
-
</TabsShadcn>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Tabs";
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/nextjs";
|
|
2
|
-
import { Text } from "./Text";
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Text> = {
|
|
5
|
-
title: "DataDisplay/Text",
|
|
6
|
-
component: Text,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: "centered",
|
|
9
|
-
},
|
|
10
|
-
tags: ["autodocs"],
|
|
11
|
-
argTypes: {
|
|
12
|
-
variant: {
|
|
13
|
-
control: "select",
|
|
14
|
-
options: ["display", "title", "subtitle", "body", "caption", "muted"],
|
|
15
|
-
},
|
|
16
|
-
align: {
|
|
17
|
-
control: "select",
|
|
18
|
-
options: ["left", "center", "right", "justify"],
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default meta;
|
|
24
|
-
type Story = StoryObj<typeof Text>;
|
|
25
|
-
|
|
26
|
-
export const Display: Story = {
|
|
27
|
-
args: {
|
|
28
|
-
variant: "display",
|
|
29
|
-
children: "Cabeçalho Principal (Display)",
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Title: Story = {
|
|
34
|
-
args: {
|
|
35
|
-
variant: "title",
|
|
36
|
-
children: "Título da Seção",
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const Subtitle: Story = {
|
|
41
|
-
args: {
|
|
42
|
-
variant: "subtitle",
|
|
43
|
-
children: "Subtítulo explicativo",
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const Normal: Story = {
|
|
48
|
-
args: {
|
|
49
|
-
variant: "normal",
|
|
50
|
-
children: "Texto de corpo padrão",
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const Caption: Story = {
|
|
55
|
-
args: {
|
|
56
|
-
variant: "caption",
|
|
57
|
-
children: "Texto de legenda",
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const Muted: Story = {
|
|
62
|
-
args: {
|
|
63
|
-
variant: "muted",
|
|
64
|
-
children: "Texto desativado ou informativo",
|
|
65
|
-
},
|
|
66
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
-
import { cn } from "../../..//lib/utils";
|
|
3
|
-
|
|
4
|
-
// Definição das variantes com pesos adequados
|
|
5
|
-
const textVariants = cva("", {
|
|
6
|
-
variants: {
|
|
7
|
-
variant: {
|
|
8
|
-
display: "text-5xl font-extrabold tracking-tight",
|
|
9
|
-
title: "text-3xl font-bold tracking-tight",
|
|
10
|
-
subtitle: "text-2xl font-semibold",
|
|
11
|
-
normal: "text-base font-normal",
|
|
12
|
-
caption: "text-sm font-medium",
|
|
13
|
-
muted: "text-sm font-normal text-muted-foreground",
|
|
14
|
-
},
|
|
15
|
-
align: {
|
|
16
|
-
left: "text-left",
|
|
17
|
-
center: "text-center",
|
|
18
|
-
right: "text-right",
|
|
19
|
-
justify: "text-justify",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
defaultVariants: {
|
|
23
|
-
variant: "normal",
|
|
24
|
-
align: "left",
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// Mapeia variantes para as tags HTML corretas
|
|
29
|
-
const tagMap = {
|
|
30
|
-
display: "h1",
|
|
31
|
-
title: "h2",
|
|
32
|
-
subtitle: "h3",
|
|
33
|
-
normal: "p",
|
|
34
|
-
caption: "small",
|
|
35
|
-
muted: "p",
|
|
36
|
-
} as const;
|
|
37
|
-
|
|
38
|
-
type TextProps = VariantProps<typeof textVariants> & {
|
|
39
|
-
className?: string;
|
|
40
|
-
children: React.ReactNode;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export function Text({
|
|
44
|
-
variant = "normal",
|
|
45
|
-
align,
|
|
46
|
-
className,
|
|
47
|
-
children,
|
|
48
|
-
}: TextProps) {
|
|
49
|
-
const Tag = tagMap[variant || "normal"] || "p";
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<Tag className={cn(textVariants({ variant, align }), className)}>
|
|
53
|
-
{children}
|
|
54
|
-
</Tag>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Text";
|