@phsa.tec/design-system-react 0.1.6 → 0.1.8

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 (213) 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/package.json +46 -6
  9. package/.eslintrc.json +0 -7
  10. package/.github/workflows/deploy-storybook.yml +0 -75
  11. package/.storybook/main.ts +0 -16
  12. package/.storybook/preview.ts +0 -15
  13. package/components.json +0 -21
  14. package/jest.config.ts +0 -25
  15. package/next.config.ts +0 -7
  16. package/postcss.config.mjs +0 -8
  17. package/public/file.svg +0 -1
  18. package/public/globe.svg +0 -1
  19. package/public/next.svg +0 -1
  20. package/public/vercel.svg +0 -1
  21. package/public/window.svg +0 -1
  22. package/src/app/columns.tsx +0 -178
  23. package/src/app/favicon.ico +0 -0
  24. package/src/app/fonts/GeistMonoVF.woff +0 -0
  25. package/src/app/fonts/GeistVF.woff +0 -0
  26. package/src/app/globals.css +0 -94
  27. package/src/app/layout.tsx +0 -35
  28. package/src/app/page.tsx +0 -7
  29. package/src/components/actions/AlertDialog/AlertDialog.tsx +0 -45
  30. package/src/components/actions/AlertDialog/alert-dialog.stories.tsx +0 -21
  31. package/src/components/actions/AlertDialog/index.ts +0 -1
  32. package/src/components/actions/Button/Button.stories.ts +0 -38
  33. package/src/components/actions/Button/Button.tsx +0 -23
  34. package/src/components/actions/Button/index.ts +0 -1
  35. package/src/components/actions/Collapsible/index.ts +0 -1
  36. package/src/components/actions/Dialog/Dialog.stories.tsx +0 -70
  37. package/src/components/actions/Dialog/Dialog.tsx +0 -87
  38. package/src/components/actions/Dialog/components/DialogWithActions/index.tsx +0 -40
  39. package/src/components/actions/Dialog/index.ts +0 -1
  40. package/src/components/actions/Steps/Steps.stories.tsx +0 -25
  41. package/src/components/actions/Steps/Steps.tsx +0 -51
  42. package/src/components/actions/Steps/index.ts +0 -1
  43. package/src/components/actions/index.ts +0 -5
  44. package/src/components/dataDisplay/Avatar/Avatar.stories.tsx +0 -22
  45. package/src/components/dataDisplay/Avatar/Avatar.tsx +0 -21
  46. package/src/components/dataDisplay/Avatar/index.ts +0 -2
  47. package/src/components/dataDisplay/Badge/Badge.stories.tsx +0 -36
  48. package/src/components/dataDisplay/Badge/index.ts +0 -1
  49. package/src/components/dataDisplay/Card/Card.stories.tsx +0 -24
  50. package/src/components/dataDisplay/Card/Card.tsx +0 -34
  51. package/src/components/dataDisplay/Card/index.ts +0 -1
  52. package/src/components/dataDisplay/DataPairList/DataPairList.tsx +0 -56
  53. package/src/components/dataDisplay/DataPairList/data-pair-list.stories.tsx +0 -87
  54. package/src/components/dataDisplay/DataPairList/index.ts +0 -2
  55. package/src/components/dataDisplay/DataPairList/types.ts +0 -10
  56. package/src/components/dataDisplay/DropDownMenu/index.ts +0 -1
  57. package/src/components/dataDisplay/ErrorMessage/ErrorMessage.tsx +0 -6
  58. package/src/components/dataDisplay/ErrorMessage/index.ts +0 -1
  59. package/src/components/dataDisplay/Icon/Icon.stories.tsx +0 -21
  60. package/src/components/dataDisplay/Icon/Icon.tsx +0 -47
  61. package/src/components/dataDisplay/Icon/index.ts +0 -1
  62. package/src/components/dataDisplay/Icon/types.ts +0 -6
  63. package/src/components/dataDisplay/Label/Label.stories.tsx +0 -21
  64. package/src/components/dataDisplay/Label/Label.tsx +0 -10
  65. package/src/components/dataDisplay/Label/index.ts +0 -1
  66. package/src/components/dataDisplay/Table/Table.tsx +0 -173
  67. package/src/components/dataDisplay/Table/columns.tsx +0 -223
  68. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-column-header.tsx +0 -72
  69. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-pagination.tsx +0 -91
  70. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-toolbar.tsx +0 -17
  71. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-view-options.tsx +0 -58
  72. package/src/components/dataDisplay/Table/components/DynamicTable/data-table.stories.tsx +0 -118
  73. package/src/components/dataDisplay/Table/components/DynamicTable/index.tsx +0 -136
  74. package/src/components/dataDisplay/Table/components/DynamicTable/types.ts +0 -43
  75. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-column-header.tsx +0 -71
  76. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-faceted-filter.tsx +0 -147
  77. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-pagination.tsx +0 -97
  78. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-row-actions.tsx +0 -78
  79. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-toolbar.tsx +0 -60
  80. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-view-options.tsx +0 -59
  81. package/src/components/dataDisplay/Table/custom/CustomTable/data-table.tsx +0 -145
  82. package/src/components/dataDisplay/Table/custom/CustomTable/data.ts +0 -71
  83. package/src/components/dataDisplay/Table/custom/CustomTable/index.tsx +0 -34
  84. package/src/components/dataDisplay/Table/custom/CustomTable/schema.ts +0 -11
  85. package/src/components/dataDisplay/Table/index.ts +0 -2
  86. package/src/components/dataDisplay/Table/table.stories.tsx +0 -147
  87. package/src/components/dataDisplay/Table/types.ts +0 -15
  88. package/src/components/dataDisplay/Tabs/Tabs.stories.tsx +0 -34
  89. package/src/components/dataDisplay/Tabs/Tabs.tsx +0 -53
  90. package/src/components/dataDisplay/Tabs/index.ts +0 -1
  91. package/src/components/dataDisplay/Text/Text.stories.tsx +0 -66
  92. package/src/components/dataDisplay/Text/Text.tsx +0 -56
  93. package/src/components/dataDisplay/Text/index.ts +0 -1
  94. package/src/components/dataDisplay/index.ts +0 -8
  95. package/src/components/dataInput/Input/components/Input/Input.stories.tsx +0 -99
  96. package/src/components/dataInput/Input/components/Input/InputBase.tsx +0 -50
  97. package/src/components/dataInput/Input/components/Input/__tests__/input.test.tsx +0 -38
  98. package/src/components/dataInput/Input/components/Input/index.tsx +0 -48
  99. package/src/components/dataInput/Input/components/Input/types.ts +0 -15
  100. package/src/components/dataInput/Input/components/InputBase/index.tsx +0 -31
  101. package/src/components/dataInput/Input/components/MaskInput/__tests__/mask-input.test.tsx +0 -77
  102. package/src/components/dataInput/Input/components/MaskInput/index.ts +0 -1
  103. package/src/components/dataInput/Input/components/MaskInput/mask-input.stories.tsx +0 -85
  104. package/src/components/dataInput/Input/components/MaskInput/mask-input.tsx +0 -73
  105. package/src/components/dataInput/Input/components/MultipleInput/MultipleInput.tsx +0 -105
  106. package/src/components/dataInput/Input/components/MultipleInput/MultipleInputBase.tsx +0 -100
  107. package/src/components/dataInput/Input/components/MultipleInput/MultipleMaskInput.tsx +0 -35
  108. package/src/components/dataInput/Input/components/MultipleInput/MultipleNumberInput.tsx +0 -35
  109. package/src/components/dataInput/Input/components/MultipleInput/__tests__/multiple-input.test.tsx +0 -152
  110. package/src/components/dataInput/Input/components/MultipleInput/index.ts +0 -2
  111. package/src/components/dataInput/Input/components/MultipleInput/multiple-input.stories.tsx +0 -96
  112. package/src/components/dataInput/Input/components/NumberInput/__tests__/number-input.test.tsx +0 -175
  113. package/src/components/dataInput/Input/components/NumberInput/index.ts +0 -1
  114. package/src/components/dataInput/Input/components/NumberInput/number-input.stories.tsx +0 -76
  115. package/src/components/dataInput/Input/components/NumberInput/number-input.tsx +0 -70
  116. package/src/components/dataInput/Input/index.ts +0 -4
  117. package/src/components/dataInput/Select/MultiSelect/MultiSelect.stories.tsx +0 -119
  118. package/src/components/dataInput/Select/MultiSelect/MultiSelectBase.tsx +0 -135
  119. package/src/components/dataInput/Select/MultiSelect/index.tsx +0 -75
  120. package/src/components/dataInput/Select/Select.stories.tsx +0 -61
  121. package/src/components/dataInput/Select/Select.tsx +0 -73
  122. package/src/components/dataInput/Select/SelectBase.tsx +0 -58
  123. package/src/components/dataInput/Select/index.ts +0 -2
  124. package/src/components/dataInput/Switch/Switch.stories.tsx +0 -75
  125. package/src/components/dataInput/Switch/Switch.tsx +0 -52
  126. package/src/components/dataInput/Switch/index.ts +0 -1
  127. package/src/components/dataInput/checkbox/Checkbox.tsx +0 -57
  128. package/src/components/dataInput/checkbox/Checkbox_old.tsx +0 -58
  129. package/src/components/dataInput/checkbox/Checkout.stories.tsx +0 -62
  130. package/src/components/dataInput/checkbox/index.ts +0 -1
  131. package/src/components/dataInput/form/Form.tsx +0 -47
  132. package/src/components/dataInput/form/index.ts +0 -3
  133. package/src/components/dataInput/index.ts +0 -5
  134. package/src/components/feedback/ErrorLabel/index.tsx +0 -24
  135. package/src/components/feedback/Spinner/index.ts +0 -1
  136. package/src/components/feedback/Toast/Toast.stories.tsx +0 -45
  137. package/src/components/feedback/Toast/index.ts +0 -2
  138. package/src/components/feedback/index.ts +0 -2
  139. package/src/components/index.ts +0 -6
  140. package/src/components/layout/Crud/components/Table/index.tsx +0 -183
  141. package/src/components/layout/Crud/components/Table/types.ts +0 -15
  142. package/src/components/layout/Crud/crud.stories.tsx +0 -317
  143. package/src/components/layout/Crud/hook/useCrudLayout/index.tsx +0 -94
  144. package/src/components/layout/Crud/hook/useRequest/index.tsx +0 -156
  145. package/src/components/layout/Crud/index.tsx +0 -295
  146. package/src/components/layout/Crud/store/CrudLayoutStore.ts +0 -75
  147. package/src/components/layout/Crud/types.ts +0 -14
  148. package/src/components/layout/Drawer/CustomDrawer/index.tsx +0 -33
  149. package/src/components/layout/Drawer/Drawer.stories.tsx +0 -80
  150. package/src/components/layout/Drawer/index.ts +0 -2
  151. package/src/components/layout/PageLayout/PageLayout.stories.tsx +0 -42
  152. package/src/components/layout/PageLayout/index.tsx +0 -28
  153. package/src/components/layout/Separator/index.ts +0 -1
  154. package/src/components/layout/Sheet/Sheet.stories.tsx +0 -28
  155. package/src/components/layout/Sheet/Sheet.tsx +0 -22
  156. package/src/components/layout/Sheet/index.ts +0 -1
  157. package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -116
  158. package/src/components/layout/Sidebar/Sidebar.tsx +0 -50
  159. package/src/components/layout/Sidebar/components/app-sidebar.tsx +0 -203
  160. package/src/components/layout/Sidebar/components/footer-sidebar.tsx +0 -17
  161. package/src/components/layout/Sidebar/components/header-sidebar.tsx +0 -90
  162. package/src/components/layout/Sidebar/components/menus.tsx +0 -55
  163. package/src/components/layout/Sidebar/components/nav-projects.tsx +0 -88
  164. package/src/components/layout/Sidebar/components/nav-user.tsx +0 -114
  165. package/src/components/layout/Sidebar/components/team-switcher.tsx +0 -85
  166. package/src/components/layout/Sidebar/index.ts +0 -2
  167. package/src/components/layout/Sidebar/provider/index.tsx +0 -51
  168. package/src/components/layout/Tabs/Tabs.tsx +0 -51
  169. package/src/components/layout/Tabs/index.ts +0 -1
  170. package/src/components/layout/Tabs/tabs.stories.tsx +0 -57
  171. package/src/components/layout/index.ts +0 -6
  172. package/src/components/navigation/Breadcrumbs/Breadcrumbs.tsx +0 -66
  173. package/src/components/navigation/Breadcrumbs/index.ts +0 -2
  174. package/src/components/navigation/index.ts +0 -1
  175. package/src/components/ui/alert-dialog.tsx +0 -141
  176. package/src/components/ui/alert.tsx +0 -59
  177. package/src/components/ui/avatar.tsx +0 -50
  178. package/src/components/ui/badge.tsx +0 -40
  179. package/src/components/ui/breadcrumb.tsx +0 -115
  180. package/src/components/ui/button.tsx +0 -57
  181. package/src/components/ui/card.tsx +0 -83
  182. package/src/components/ui/checkbox.tsx +0 -34
  183. package/src/components/ui/collapsible.tsx +0 -11
  184. package/src/components/ui/command.tsx +0 -153
  185. package/src/components/ui/dialog.tsx +0 -124
  186. package/src/components/ui/drawer.tsx +0 -117
  187. package/src/components/ui/dropdown-menu.tsx +0 -201
  188. package/src/components/ui/form.tsx +0 -179
  189. package/src/components/ui/input.tsx +0 -24
  190. package/src/components/ui/label.tsx +0 -30
  191. package/src/components/ui/popover.tsx +0 -33
  192. package/src/components/ui/select.tsx +0 -161
  193. package/src/components/ui/separator.tsx +0 -31
  194. package/src/components/ui/sheet.tsx +0 -140
  195. package/src/components/ui/sidebar.tsx +0 -763
  196. package/src/components/ui/skeleton.tsx +0 -15
  197. package/src/components/ui/sonner.tsx +0 -31
  198. package/src/components/ui/spinner.tsx +0 -54
  199. package/src/components/ui/switch.tsx +0 -33
  200. package/src/components/ui/table.tsx +0 -120
  201. package/src/components/ui/tabs.tsx +0 -55
  202. package/src/components/ui/toast.tsx +0 -130
  203. package/src/components/ui/toaster.tsx +0 -35
  204. package/src/components/ui/tooltip.tsx +0 -32
  205. package/src/hooks/use-conditional-controller.tsx +0 -35
  206. package/src/hooks/use-mask.tsx +0 -116
  207. package/src/hooks/use-mobile.tsx +0 -19
  208. package/src/hooks/use-toast.ts +0 -191
  209. package/src/index.ts +0 -1
  210. package/src/introduction.mdx +0 -132
  211. package/src/lib/utils.ts +0 -6
  212. package/tailwind.config.ts +0 -83
  213. package/tsconfig.json +0 -27
@@ -1,97 +0,0 @@
1
- import { Table } from "@tanstack/react-table";
2
- import {
3
- ChevronLeft,
4
- ChevronRight,
5
- ChevronsLeft,
6
- ChevronsRight,
7
- } from "lucide-react";
8
-
9
- import { Button } from "../../../../ui/button";
10
- import {
11
- Select,
12
- SelectContent,
13
- SelectItem,
14
- SelectTrigger,
15
- SelectValue,
16
- } from "../../../../ui/select";
17
-
18
- interface DataTablePaginationProps<TData> {
19
- table: Table<TData>;
20
- }
21
-
22
- export function DataTablePagination<TData>({
23
- table,
24
- }: DataTablePaginationProps<TData>) {
25
- return (
26
- <div className="flex items-center justify-between px-2">
27
- <div className="flex-1 text-sm text-muted-foreground">
28
- {/* {table.getFilteredSelectedRowModel().rows.length} of{" "}
29
- {table.getFilteredRowModel().rows.length} row(s) selected. */}
30
- </div>
31
- <div className="flex items-center space-x-6 lg:space-x-8">
32
- <div className="flex items-center space-x-2">
33
- <p className="text-sm font-medium">Linhas por página</p>
34
- <Select
35
- value={`${table.getState().pagination.pageSize}`}
36
- onValueChange={(value) => {
37
- table.setPageSize(Number(value));
38
- }}
39
- >
40
- <SelectTrigger className="h-8 w-[70px]">
41
- <SelectValue placeholder={table.getState().pagination.pageSize} />
42
- </SelectTrigger>
43
- <SelectContent side="top">
44
- {[10, 20, 30, 40, 50].map((pageSize) => (
45
- <SelectItem key={pageSize} value={`${pageSize}`}>
46
- {pageSize}
47
- </SelectItem>
48
- ))}
49
- </SelectContent>
50
- </Select>
51
- </div>
52
- <div className="flex w-[100px] items-center justify-center text-sm font-medium">
53
- Página {table.getState().pagination.pageIndex + 1} de{" "}
54
- {table.getPageCount()}
55
- </div>
56
- <div className="flex items-center space-x-2">
57
- <Button
58
- variant="outline"
59
- className="hidden h-8 w-8 p-0 lg:flex"
60
- onClick={() => table.setPageIndex(0)}
61
- disabled={!table.getCanPreviousPage()}
62
- >
63
- <span className="sr-only">Go to first page</span>
64
- <ChevronsLeft />
65
- </Button>
66
- <Button
67
- variant="outline"
68
- className="h-8 w-8 p-0"
69
- onClick={() => table.previousPage()}
70
- disabled={!table.getCanPreviousPage()}
71
- >
72
- <span className="sr-only">Go to previous page</span>
73
- <ChevronLeft />
74
- </Button>
75
- <Button
76
- variant="outline"
77
- className="h-8 w-8 p-0"
78
- onClick={() => table.nextPage()}
79
- disabled={!table.getCanNextPage()}
80
- >
81
- <span className="sr-only">Go to next page</span>
82
- <ChevronRight />
83
- </Button>
84
- <Button
85
- variant="outline"
86
- className="hidden h-8 w-8 p-0 lg:flex"
87
- onClick={() => table.setPageIndex(table.getPageCount() - 1)}
88
- disabled={!table.getCanNextPage()}
89
- >
90
- <span className="sr-only">Go to last page</span>
91
- <ChevronsRight />
92
- </Button>
93
- </div>
94
- </div>
95
- </div>
96
- );
97
- }
@@ -1,78 +0,0 @@
1
- "use client";
2
-
3
- import { DotsHorizontalIcon } from "@radix-ui/react-icons";
4
- import { Row } from "@tanstack/react-table";
5
-
6
- import {
7
- DropdownMenu,
8
- DropdownMenuContent,
9
- DropdownMenuItem,
10
- DropdownMenuRadioGroup,
11
- DropdownMenuRadioItem,
12
- DropdownMenuSeparator,
13
- DropdownMenuShortcut,
14
- DropdownMenuSub,
15
- DropdownMenuSubContent,
16
- DropdownMenuSubTrigger,
17
- DropdownMenuTrigger,
18
- } from "../../../../../components/ui/dropdown-menu";
19
- import { Button } from "../../../../../components/ui/button";
20
- import { taskSchema } from "./schema";
21
- import { labels } from "./data";
22
-
23
- interface DataTableRowActionsProps<TData> {
24
- row: Row<TData>;
25
- options: {
26
- action: (row: Row<TData>) => void;
27
- label: string;
28
- }[];
29
- }
30
-
31
- export function DataTableRowActions<TData>({
32
- row,
33
- options,
34
- }: DataTableRowActionsProps<TData>) {
35
- // const task = taskSchema.parse(row.original);
36
-
37
- return (
38
- <DropdownMenu>
39
- <DropdownMenuTrigger asChild>
40
- <Button
41
- variant="ghost"
42
- className="flex h-8 w-8 p-0 data-[state=open]:bg-muted"
43
- >
44
- <DotsHorizontalIcon className="h-4 w-4" />
45
- <span className="sr-only">Open menu</span>
46
- </Button>
47
- </DropdownMenuTrigger>
48
- <DropdownMenuContent align="end" className="w-[160px]">
49
- {options.map(({ action, label }, index) => (
50
- <DropdownMenuItem key={index} onClick={() => action(row)}>
51
- {label}
52
- </DropdownMenuItem>
53
- ))}
54
- {/* <DropdownMenuItem>Edit</DropdownMenuItem>
55
- <DropdownMenuItem>Make a copy</DropdownMenuItem>
56
- <DropdownMenuItem>Favorite</DropdownMenuItem>
57
- <DropdownMenuSeparator />
58
- <DropdownMenuSub>
59
- <DropdownMenuSubTrigger>Labels</DropdownMenuSubTrigger>
60
- <DropdownMenuSubContent>
61
- <DropdownMenuRadioGroup value={task.label}>
62
- {labels.map((label) => (
63
- <DropdownMenuRadioItem key={label.value} value={label.value}>
64
- {label.label}
65
- </DropdownMenuRadioItem>
66
- ))}
67
- </DropdownMenuRadioGroup>
68
- </DropdownMenuSubContent>
69
- </DropdownMenuSub>
70
- <DropdownMenuSeparator />
71
- <DropdownMenuItem>
72
- Delete
73
- <DropdownMenuShortcut>⌘⌫</DropdownMenuShortcut>
74
- </DropdownMenuItem> */}
75
- </DropdownMenuContent>
76
- </DropdownMenu>
77
- );
78
- }
@@ -1,60 +0,0 @@
1
- "use client";
2
-
3
- import { Cross2Icon } from "@radix-ui/react-icons";
4
- import { Table } from "@tanstack/react-table";
5
-
6
- import { priorities, statuses } from "./data";
7
- import { DataTableFacetedFilter } from "./data-table-faceted-filter";
8
- import { Input } from "../../../../../components/ui/input";
9
- import { Button } from "../../../../../components/ui/button";
10
- import { DataTableViewOptions } from "./data-table-view-options";
11
-
12
- interface DataTableToolbarProps<TData> {
13
- table: Table<TData>;
14
- }
15
-
16
- export function DataTableToolbar<TData>({
17
- table,
18
- }: DataTableToolbarProps<TData>) {
19
- const isFiltered = table.getState().columnFilters.length > 0;
20
-
21
- return (
22
- <div className="flex items-center justify-between">
23
- <div className="flex flex-1 items-center space-x-2">
24
- <Input
25
- placeholder="Filter tasks..."
26
- value={(table.getColumn("title")?.getFilterValue() as string) ?? ""}
27
- onChange={(event) =>
28
- table.getColumn("title")?.setFilterValue(event.target.value)
29
- }
30
- className="h-8 w-[150px] lg:w-[250px]"
31
- />
32
- {table.getColumn("status") && (
33
- <DataTableFacetedFilter
34
- column={table.getColumn("status")}
35
- title="Status"
36
- options={statuses}
37
- />
38
- )}
39
- {table.getColumn("priority") && (
40
- <DataTableFacetedFilter
41
- column={table.getColumn("priority")}
42
- title="Priority"
43
- options={priorities}
44
- />
45
- )}
46
- {isFiltered && (
47
- <Button
48
- variant="ghost"
49
- onClick={() => table.resetColumnFilters()}
50
- className="h-8 px-2 lg:px-3"
51
- >
52
- Reset
53
- <Cross2Icon className="ml-2 h-4 w-4" />
54
- </Button>
55
- )}
56
- </div>
57
- <DataTableViewOptions table={table} />
58
- </div>
59
- );
60
- }
@@ -1,59 +0,0 @@
1
- "use client";
2
-
3
- import { DropdownMenuTrigger } from "@radix-ui/react-dropdown-menu";
4
- import { MixerHorizontalIcon } from "@radix-ui/react-icons";
5
- import { Table } from "@tanstack/react-table";
6
-
7
- import {
8
- DropdownMenu,
9
- DropdownMenuCheckboxItem,
10
- DropdownMenuContent,
11
- DropdownMenuLabel,
12
- DropdownMenuSeparator,
13
- } from "../../../../../components/ui/dropdown-menu";
14
- import { Button } from "../../../../../components/ui/button";
15
-
16
- interface DataTableViewOptionsProps<TData> {
17
- table: Table<TData>;
18
- }
19
-
20
- export function DataTableViewOptions<TData>({
21
- table,
22
- }: DataTableViewOptionsProps<TData>) {
23
- return (
24
- <DropdownMenu>
25
- <DropdownMenuTrigger asChild>
26
- <Button
27
- variant="outline"
28
- size="sm"
29
- className="ml-auto hidden h-8 lg:flex"
30
- >
31
- <MixerHorizontalIcon className="mr-2 h-4 w-4" />
32
- View
33
- </Button>
34
- </DropdownMenuTrigger>
35
- <DropdownMenuContent align="end" className="w-[150px]">
36
- <DropdownMenuLabel>Toggle columns</DropdownMenuLabel>
37
- <DropdownMenuSeparator />
38
- {table
39
- .getAllColumns()
40
- .filter(
41
- (column) =>
42
- typeof column.accessorFn !== "undefined" && column.getCanHide()
43
- )
44
- .map((column) => {
45
- return (
46
- <DropdownMenuCheckboxItem
47
- key={column.id}
48
- className="capitalize"
49
- checked={column.getIsVisible()}
50
- onCheckedChange={(value) => column.toggleVisibility(!!value)}
51
- >
52
- {column.id}
53
- </DropdownMenuCheckboxItem>
54
- );
55
- })}
56
- </DropdownMenuContent>
57
- </DropdownMenu>
58
- );
59
- }
@@ -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";