@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.
Files changed (217) hide show
  1. package/README.md +390 -209
  2. package/dist/index.d.mts +485 -0
  3. package/dist/index.d.ts +485 -0
  4. package/dist/index.js +4259 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +4186 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/styles.css +2534 -0
  9. package/dist/styles.css.map +1 -0
  10. package/dist/styles.d.mts +2 -0
  11. package/dist/styles.d.ts +2 -0
  12. package/package.json +46 -6
  13. package/.eslintrc.json +0 -7
  14. package/.github/workflows/deploy-storybook.yml +0 -75
  15. package/.storybook/main.ts +0 -16
  16. package/.storybook/preview.ts +0 -15
  17. package/components.json +0 -21
  18. package/jest.config.ts +0 -25
  19. package/next.config.ts +0 -7
  20. package/postcss.config.mjs +0 -8
  21. package/public/file.svg +0 -1
  22. package/public/globe.svg +0 -1
  23. package/public/next.svg +0 -1
  24. package/public/vercel.svg +0 -1
  25. package/public/window.svg +0 -1
  26. package/src/app/columns.tsx +0 -178
  27. package/src/app/favicon.ico +0 -0
  28. package/src/app/fonts/GeistMonoVF.woff +0 -0
  29. package/src/app/fonts/GeistVF.woff +0 -0
  30. package/src/app/globals.css +0 -94
  31. package/src/app/layout.tsx +0 -35
  32. package/src/app/page.tsx +0 -7
  33. package/src/components/actions/AlertDialog/AlertDialog.tsx +0 -45
  34. package/src/components/actions/AlertDialog/alert-dialog.stories.tsx +0 -21
  35. package/src/components/actions/AlertDialog/index.ts +0 -1
  36. package/src/components/actions/Button/Button.stories.ts +0 -38
  37. package/src/components/actions/Button/Button.tsx +0 -23
  38. package/src/components/actions/Button/index.ts +0 -1
  39. package/src/components/actions/Collapsible/index.ts +0 -1
  40. package/src/components/actions/Dialog/Dialog.stories.tsx +0 -70
  41. package/src/components/actions/Dialog/Dialog.tsx +0 -87
  42. package/src/components/actions/Dialog/components/DialogWithActions/index.tsx +0 -40
  43. package/src/components/actions/Dialog/index.ts +0 -1
  44. package/src/components/actions/Steps/Steps.stories.tsx +0 -25
  45. package/src/components/actions/Steps/Steps.tsx +0 -51
  46. package/src/components/actions/Steps/index.ts +0 -1
  47. package/src/components/actions/index.ts +0 -5
  48. package/src/components/dataDisplay/Avatar/Avatar.stories.tsx +0 -22
  49. package/src/components/dataDisplay/Avatar/Avatar.tsx +0 -21
  50. package/src/components/dataDisplay/Avatar/index.ts +0 -2
  51. package/src/components/dataDisplay/Badge/Badge.stories.tsx +0 -36
  52. package/src/components/dataDisplay/Badge/index.ts +0 -1
  53. package/src/components/dataDisplay/Card/Card.stories.tsx +0 -24
  54. package/src/components/dataDisplay/Card/Card.tsx +0 -34
  55. package/src/components/dataDisplay/Card/index.ts +0 -1
  56. package/src/components/dataDisplay/DataPairList/DataPairList.tsx +0 -56
  57. package/src/components/dataDisplay/DataPairList/data-pair-list.stories.tsx +0 -87
  58. package/src/components/dataDisplay/DataPairList/index.ts +0 -2
  59. package/src/components/dataDisplay/DataPairList/types.ts +0 -10
  60. package/src/components/dataDisplay/DropDownMenu/index.ts +0 -1
  61. package/src/components/dataDisplay/ErrorMessage/ErrorMessage.tsx +0 -6
  62. package/src/components/dataDisplay/ErrorMessage/index.ts +0 -1
  63. package/src/components/dataDisplay/Icon/Icon.stories.tsx +0 -21
  64. package/src/components/dataDisplay/Icon/Icon.tsx +0 -47
  65. package/src/components/dataDisplay/Icon/index.ts +0 -1
  66. package/src/components/dataDisplay/Icon/types.ts +0 -6
  67. package/src/components/dataDisplay/Label/Label.stories.tsx +0 -21
  68. package/src/components/dataDisplay/Label/Label.tsx +0 -10
  69. package/src/components/dataDisplay/Label/index.ts +0 -1
  70. package/src/components/dataDisplay/Table/Table.tsx +0 -173
  71. package/src/components/dataDisplay/Table/columns.tsx +0 -223
  72. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-column-header.tsx +0 -72
  73. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-pagination.tsx +0 -91
  74. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-toolbar.tsx +0 -17
  75. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-view-options.tsx +0 -58
  76. package/src/components/dataDisplay/Table/components/DynamicTable/data-table.stories.tsx +0 -118
  77. package/src/components/dataDisplay/Table/components/DynamicTable/index.tsx +0 -136
  78. package/src/components/dataDisplay/Table/components/DynamicTable/types.ts +0 -43
  79. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-column-header.tsx +0 -71
  80. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-faceted-filter.tsx +0 -147
  81. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-pagination.tsx +0 -97
  82. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-row-actions.tsx +0 -78
  83. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-toolbar.tsx +0 -60
  84. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-view-options.tsx +0 -59
  85. package/src/components/dataDisplay/Table/custom/CustomTable/data-table.tsx +0 -145
  86. package/src/components/dataDisplay/Table/custom/CustomTable/data.ts +0 -71
  87. package/src/components/dataDisplay/Table/custom/CustomTable/index.tsx +0 -34
  88. package/src/components/dataDisplay/Table/custom/CustomTable/schema.ts +0 -11
  89. package/src/components/dataDisplay/Table/index.ts +0 -2
  90. package/src/components/dataDisplay/Table/table.stories.tsx +0 -147
  91. package/src/components/dataDisplay/Table/types.ts +0 -15
  92. package/src/components/dataDisplay/Tabs/Tabs.stories.tsx +0 -34
  93. package/src/components/dataDisplay/Tabs/Tabs.tsx +0 -53
  94. package/src/components/dataDisplay/Tabs/index.ts +0 -1
  95. package/src/components/dataDisplay/Text/Text.stories.tsx +0 -66
  96. package/src/components/dataDisplay/Text/Text.tsx +0 -56
  97. package/src/components/dataDisplay/Text/index.ts +0 -1
  98. package/src/components/dataDisplay/index.ts +0 -8
  99. package/src/components/dataInput/Input/components/Input/Input.stories.tsx +0 -99
  100. package/src/components/dataInput/Input/components/Input/InputBase.tsx +0 -50
  101. package/src/components/dataInput/Input/components/Input/__tests__/input.test.tsx +0 -38
  102. package/src/components/dataInput/Input/components/Input/index.tsx +0 -48
  103. package/src/components/dataInput/Input/components/Input/types.ts +0 -15
  104. package/src/components/dataInput/Input/components/InputBase/index.tsx +0 -31
  105. package/src/components/dataInput/Input/components/MaskInput/__tests__/mask-input.test.tsx +0 -77
  106. package/src/components/dataInput/Input/components/MaskInput/index.ts +0 -1
  107. package/src/components/dataInput/Input/components/MaskInput/mask-input.stories.tsx +0 -85
  108. package/src/components/dataInput/Input/components/MaskInput/mask-input.tsx +0 -73
  109. package/src/components/dataInput/Input/components/MultipleInput/MultipleInput.tsx +0 -105
  110. package/src/components/dataInput/Input/components/MultipleInput/MultipleInputBase.tsx +0 -100
  111. package/src/components/dataInput/Input/components/MultipleInput/MultipleMaskInput.tsx +0 -35
  112. package/src/components/dataInput/Input/components/MultipleInput/MultipleNumberInput.tsx +0 -35
  113. package/src/components/dataInput/Input/components/MultipleInput/__tests__/multiple-input.test.tsx +0 -152
  114. package/src/components/dataInput/Input/components/MultipleInput/index.ts +0 -2
  115. package/src/components/dataInput/Input/components/MultipleInput/multiple-input.stories.tsx +0 -96
  116. package/src/components/dataInput/Input/components/NumberInput/__tests__/number-input.test.tsx +0 -175
  117. package/src/components/dataInput/Input/components/NumberInput/index.ts +0 -1
  118. package/src/components/dataInput/Input/components/NumberInput/number-input.stories.tsx +0 -76
  119. package/src/components/dataInput/Input/components/NumberInput/number-input.tsx +0 -70
  120. package/src/components/dataInput/Input/index.ts +0 -4
  121. package/src/components/dataInput/Select/MultiSelect/MultiSelect.stories.tsx +0 -119
  122. package/src/components/dataInput/Select/MultiSelect/MultiSelectBase.tsx +0 -135
  123. package/src/components/dataInput/Select/MultiSelect/index.tsx +0 -75
  124. package/src/components/dataInput/Select/Select.stories.tsx +0 -61
  125. package/src/components/dataInput/Select/Select.tsx +0 -73
  126. package/src/components/dataInput/Select/SelectBase.tsx +0 -58
  127. package/src/components/dataInput/Select/index.ts +0 -2
  128. package/src/components/dataInput/Switch/Switch.stories.tsx +0 -75
  129. package/src/components/dataInput/Switch/Switch.tsx +0 -52
  130. package/src/components/dataInput/Switch/index.ts +0 -1
  131. package/src/components/dataInput/checkbox/Checkbox.tsx +0 -57
  132. package/src/components/dataInput/checkbox/Checkbox_old.tsx +0 -58
  133. package/src/components/dataInput/checkbox/Checkout.stories.tsx +0 -62
  134. package/src/components/dataInput/checkbox/index.ts +0 -1
  135. package/src/components/dataInput/form/Form.tsx +0 -47
  136. package/src/components/dataInput/form/index.ts +0 -3
  137. package/src/components/dataInput/index.ts +0 -5
  138. package/src/components/feedback/ErrorLabel/index.tsx +0 -24
  139. package/src/components/feedback/Spinner/index.ts +0 -1
  140. package/src/components/feedback/Toast/Toast.stories.tsx +0 -45
  141. package/src/components/feedback/Toast/index.ts +0 -2
  142. package/src/components/feedback/index.ts +0 -2
  143. package/src/components/index.ts +0 -6
  144. package/src/components/layout/Crud/components/Table/index.tsx +0 -183
  145. package/src/components/layout/Crud/components/Table/types.ts +0 -15
  146. package/src/components/layout/Crud/crud.stories.tsx +0 -317
  147. package/src/components/layout/Crud/hook/useCrudLayout/index.tsx +0 -94
  148. package/src/components/layout/Crud/hook/useRequest/index.tsx +0 -156
  149. package/src/components/layout/Crud/index.tsx +0 -295
  150. package/src/components/layout/Crud/store/CrudLayoutStore.ts +0 -75
  151. package/src/components/layout/Crud/types.ts +0 -14
  152. package/src/components/layout/Drawer/CustomDrawer/index.tsx +0 -33
  153. package/src/components/layout/Drawer/Drawer.stories.tsx +0 -80
  154. package/src/components/layout/Drawer/index.ts +0 -2
  155. package/src/components/layout/PageLayout/PageLayout.stories.tsx +0 -42
  156. package/src/components/layout/PageLayout/index.tsx +0 -28
  157. package/src/components/layout/Separator/index.ts +0 -1
  158. package/src/components/layout/Sheet/Sheet.stories.tsx +0 -28
  159. package/src/components/layout/Sheet/Sheet.tsx +0 -22
  160. package/src/components/layout/Sheet/index.ts +0 -1
  161. package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -116
  162. package/src/components/layout/Sidebar/Sidebar.tsx +0 -50
  163. package/src/components/layout/Sidebar/components/app-sidebar.tsx +0 -203
  164. package/src/components/layout/Sidebar/components/footer-sidebar.tsx +0 -17
  165. package/src/components/layout/Sidebar/components/header-sidebar.tsx +0 -90
  166. package/src/components/layout/Sidebar/components/menus.tsx +0 -55
  167. package/src/components/layout/Sidebar/components/nav-projects.tsx +0 -88
  168. package/src/components/layout/Sidebar/components/nav-user.tsx +0 -114
  169. package/src/components/layout/Sidebar/components/team-switcher.tsx +0 -85
  170. package/src/components/layout/Sidebar/index.ts +0 -2
  171. package/src/components/layout/Sidebar/provider/index.tsx +0 -51
  172. package/src/components/layout/Tabs/Tabs.tsx +0 -51
  173. package/src/components/layout/Tabs/index.ts +0 -1
  174. package/src/components/layout/Tabs/tabs.stories.tsx +0 -57
  175. package/src/components/layout/index.ts +0 -6
  176. package/src/components/navigation/Breadcrumbs/Breadcrumbs.tsx +0 -66
  177. package/src/components/navigation/Breadcrumbs/index.ts +0 -2
  178. package/src/components/navigation/index.ts +0 -1
  179. package/src/components/ui/alert-dialog.tsx +0 -141
  180. package/src/components/ui/alert.tsx +0 -59
  181. package/src/components/ui/avatar.tsx +0 -50
  182. package/src/components/ui/badge.tsx +0 -40
  183. package/src/components/ui/breadcrumb.tsx +0 -115
  184. package/src/components/ui/button.tsx +0 -57
  185. package/src/components/ui/card.tsx +0 -83
  186. package/src/components/ui/checkbox.tsx +0 -34
  187. package/src/components/ui/collapsible.tsx +0 -11
  188. package/src/components/ui/command.tsx +0 -153
  189. package/src/components/ui/dialog.tsx +0 -124
  190. package/src/components/ui/drawer.tsx +0 -117
  191. package/src/components/ui/dropdown-menu.tsx +0 -201
  192. package/src/components/ui/form.tsx +0 -179
  193. package/src/components/ui/input.tsx +0 -24
  194. package/src/components/ui/label.tsx +0 -30
  195. package/src/components/ui/popover.tsx +0 -33
  196. package/src/components/ui/select.tsx +0 -161
  197. package/src/components/ui/separator.tsx +0 -31
  198. package/src/components/ui/sheet.tsx +0 -140
  199. package/src/components/ui/sidebar.tsx +0 -763
  200. package/src/components/ui/skeleton.tsx +0 -15
  201. package/src/components/ui/sonner.tsx +0 -31
  202. package/src/components/ui/spinner.tsx +0 -54
  203. package/src/components/ui/switch.tsx +0 -33
  204. package/src/components/ui/table.tsx +0 -120
  205. package/src/components/ui/tabs.tsx +0 -55
  206. package/src/components/ui/toast.tsx +0 -130
  207. package/src/components/ui/toaster.tsx +0 -35
  208. package/src/components/ui/tooltip.tsx +0 -32
  209. package/src/hooks/use-conditional-controller.tsx +0 -35
  210. package/src/hooks/use-mask.tsx +0 -116
  211. package/src/hooks/use-mobile.tsx +0 -19
  212. package/src/hooks/use-toast.ts +0 -191
  213. package/src/index.ts +0 -1
  214. package/src/introduction.mdx +0 -132
  215. package/src/lib/utils.ts +0 -6
  216. package/tailwind.config.ts +0 -83
  217. 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,11 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const taskSchema = z.object({
4
- id: z.string(),
5
- title: z.string(),
6
- status: z.string(),
7
- label: z.string(),
8
- priority: z.string(),
9
- });
10
-
11
- export type Task = z.infer<typeof taskSchema>;
@@ -1,2 +0,0 @@
1
- export * from "./components/DynamicTable";
2
- export * from "./types";
@@ -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";
@@ -1,8 +0,0 @@
1
- export * from "./Table";
2
- export * from "./Badge";
3
- export * from "./Icon";
4
- export * from "./Card";
5
- export * from "./Avatar";
6
- export * from "./DropDownMenu";
7
- export * from "./DataPairList";
8
- export * from "./Text";