@k3-universe/react-kit 0.0.41 → 0.0.42
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/.babelrc +12 -12
- package/.storybook/main.ts +22 -22
- package/.storybook/preview.ts +198 -198
- package/Dockerfile.storybook +43 -43
- package/README.md +9 -9
- package/biome.json +10 -10
- package/components.json +20 -20
- package/dist/index.js +32 -14
- package/dist/kit/builder/auth/hooks/core-hooks.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/AutocompleteField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/DatePickerField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/DateRangePickerField.d.ts.map +1 -1
- package/dist/kit/builder/form/types.d.ts +2 -0
- package/dist/kit/builder/form/types.d.ts.map +1 -1
- package/dist/kit/components/autocomplete/Autocomplete.d.ts +2 -1
- package/dist/kit/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/kit/layouts/admin/hooks/menu.d.ts.map +1 -1
- package/dist/kit/themes/clean-slate.css +4 -8
- package/dist/kit/themes/default.css +5 -9
- package/dist/kit/themes/minimal-modern.css +4 -8
- package/dist/kit/themes/spotify.css +4 -8
- package/package.json +1 -1
- package/src/index.ts +99 -99
- package/src/kit/builder/auth/components/Can.tsx +27 -27
- package/src/kit/builder/auth/components/RequireAuth.tsx +78 -78
- package/src/kit/builder/auth/components/ShowWhenAuthenticated.tsx +10 -10
- package/src/kit/builder/auth/components/ShowWhenError.tsx +10 -10
- package/src/kit/builder/auth/components/ShowWhenLoading.tsx +10 -10
- package/src/kit/builder/auth/components/ShowWhenUnauthenticated.tsx +10 -10
- package/src/kit/builder/auth/components/withPermission.tsx +23 -23
- package/src/kit/builder/auth/hooks/action-hooks.ts +34 -34
- package/src/kit/builder/auth/hooks/core-hooks.ts +65 -65
- package/src/kit/builder/auth/hooks/index.ts +4 -4
- package/src/kit/builder/auth/hooks/permission-hooks.ts +43 -43
- package/src/kit/builder/auth/hooks/token-hooks.ts +25 -25
- package/src/kit/builder/auth/index.ts +132 -132
- package/src/kit/builder/auth/providers/AuthProvider.tsx +131 -131
- package/src/kit/builder/auth/types/adapter-config.ts +44 -44
- package/src/kit/builder/auth/types/adapter.ts +132 -132
- package/src/kit/builder/auth/types/core.ts +27 -27
- package/src/kit/builder/auth/types/index.ts +9 -9
- package/src/kit/builder/auth/types/middleware.ts +20 -20
- package/src/kit/builder/auth/types/permissions.ts +23 -23
- package/src/kit/builder/auth/types/state.ts +16 -16
- package/src/kit/builder/auth/types/storage.ts +21 -21
- package/src/kit/builder/auth/types/token-manager.ts +9 -9
- package/src/kit/builder/auth/types/utils.ts +55 -55
- package/src/kit/builder/auth/utils/auth-adapter.ts +437 -437
- package/src/kit/builder/auth/utils/client-adapters/apollo-link.ts +30 -30
- package/src/kit/builder/auth/utils/client-adapters/axios.ts +61 -61
- package/src/kit/builder/auth/utils/client-adapters/fetch.ts +48 -48
- package/src/kit/builder/auth/utils/client-adapters/graphql.ts +60 -60
- package/src/kit/builder/auth/utils/client-adapters/index.ts +6 -6
- package/src/kit/builder/auth/utils/client-adapters/rest.ts +60 -60
- package/src/kit/builder/auth/utils/client-adapters/urql-exchange.ts +76 -76
- package/src/kit/builder/auth/utils/permission-checker.ts +150 -150
- package/src/kit/builder/auth/utils/storage/browser.ts +99 -99
- package/src/kit/builder/auth/utils/storage/cookie.ts +116 -116
- package/src/kit/builder/auth/utils/storage/encryption.ts +80 -80
- package/src/kit/builder/auth/utils/storage/env.ts +2 -2
- package/src/kit/builder/auth/utils/storage/factory.ts +37 -37
- package/src/kit/builder/auth/utils/storage/index.ts +6 -6
- package/src/kit/builder/auth/utils/storage/memory.ts +15 -15
- package/src/kit/builder/auth/utils/token-manager.ts +55 -55
- package/src/kit/builder/data-table/components/DataTable.tsx +547 -547
- package/src/kit/builder/data-table/components/DataTableColumnHeader.tsx +67 -67
- package/src/kit/builder/data-table/components/DataTablePagination.tsx +112 -112
- package/src/kit/builder/data-table/components/DataTableViewOptions.tsx +51 -51
- package/src/kit/builder/data-table/index.ts +6 -6
- package/src/kit/builder/data-table/types.ts +44 -44
- package/src/kit/builder/data-table/utils/dotAccessor.ts +6 -6
- package/src/kit/builder/dialog/index.ts +6 -6
- package/src/kit/builder/dialog/provider.tsx +170 -170
- package/src/kit/builder/form/components/FormBuilder.tsx +295 -295
- package/src/kit/builder/form/components/FormBuilderActions.tsx +78 -78
- package/src/kit/builder/form/components/FormBuilderContext.tsx +52 -52
- package/src/kit/builder/form/components/FormBuilderField.tsx +456 -456
- package/src/kit/builder/form/components/fields/ArrayField.tsx +311 -311
- package/src/kit/builder/form/components/fields/AutocompleteField.tsx +89 -88
- package/src/kit/builder/form/components/fields/CheckboxField.tsx +65 -65
- package/src/kit/builder/form/components/fields/DateField.tsx +26 -26
- package/src/kit/builder/form/components/fields/DatePickerField.tsx +31 -29
- package/src/kit/builder/form/components/fields/DateRangePickerField.tsx +55 -46
- package/src/kit/builder/form/components/fields/DateTimePickerField.tsx +38 -38
- package/src/kit/builder/form/components/fields/DateTimeRangePickerField.tsx +48 -48
- package/src/kit/builder/form/components/fields/FileField.tsx +31 -31
- package/src/kit/builder/form/components/fields/MonthPickerField.tsx +33 -33
- package/src/kit/builder/form/components/fields/MonthRangePickerField.tsx +41 -41
- package/src/kit/builder/form/components/fields/NumberField.tsx +20 -20
- package/src/kit/builder/form/components/fields/ObjectField.tsx +35 -35
- package/src/kit/builder/form/components/fields/RadioField.tsx +47 -47
- package/src/kit/builder/form/components/fields/SelectField.tsx +46 -46
- package/src/kit/builder/form/components/fields/SwitchField.tsx +65 -65
- package/src/kit/builder/form/components/fields/TextField.tsx +25 -25
- package/src/kit/builder/form/components/fields/TextareaField.tsx +20 -20
- package/src/kit/builder/form/components/fields/TimePickerField.tsx +35 -35
- package/src/kit/builder/form/components/fields/TimeRangePickerField.tsx +43 -43
- package/src/kit/builder/form/components/fields/index.ts +21 -21
- package/src/kit/builder/form/components/fields/types.ts +18 -18
- package/src/kit/builder/form/components/index.ts +3 -3
- package/src/kit/builder/form/components/sectionNodes.tsx +147 -147
- package/src/kit/builder/form/hooks/useFormBuilder.ts +451 -451
- package/src/kit/builder/form/index.ts +4 -4
- package/src/kit/builder/form/types.ts +245 -243
- package/src/kit/builder/form/utils/common-forms.ts +68 -68
- package/src/kit/builder/form/utils/dependencies.ts +56 -56
- package/src/kit/builder/form/utils/field-factories.ts +177 -177
- package/src/kit/builder/form/utils/index.ts +17 -17
- package/src/kit/builder/form/utils/section-factories.ts +38 -38
- package/src/kit/builder/form/utils/transformers.ts +100 -100
- package/src/kit/builder/form/utils/validations.ts +22 -22
- package/src/kit/builder/form/utils/validators.ts +20 -20
- package/src/kit/builder/page/Page.tsx +202 -202
- package/src/kit/builder/page/index.ts +1 -1
- package/src/kit/builder/section/SectionBuilder.tsx +435 -435
- package/src/kit/builder/section/SectionContainer.tsx +85 -85
- package/src/kit/builder/section/index.ts +2 -2
- package/src/kit/builder/section/types.ts +80 -80
- package/src/kit/builder/stack-dialog/context.ts +15 -15
- package/src/kit/builder/stack-dialog/hooks.ts +13 -13
- package/src/kit/builder/stack-dialog/index.ts +12 -12
- package/src/kit/builder/stack-dialog/provider.tsx +51 -51
- package/src/kit/builder/stack-dialog/renderer.tsx +36 -36
- package/src/kit/builder/stack-dialog/types.ts +34 -34
- package/src/kit/components/autocomplete/Autocomplete.tsx +671 -664
- package/src/kit/components/autocomplete/index.ts +3 -3
- package/src/kit/components/autocomplete/types.ts +27 -27
- package/src/kit/components/datepicker/DatePicker.tsx +173 -173
- package/src/kit/components/datepicker/DateRangePicker.tsx +526 -526
- package/src/kit/components/datepicker/index.ts +2 -2
- package/src/kit/components/datetimepicker/DateTimePicker.tsx +420 -420
- package/src/kit/components/datetimepicker/DateTimeRangePicker.tsx +676 -676
- package/src/kit/components/datetimepicker/index.ts +2 -2
- package/src/kit/components/fileuploader/FileUploader.tsx +626 -626
- package/src/kit/components/fileuploader/index.ts +3 -3
- package/src/kit/components/fileuploader/types.ts +76 -76
- package/src/kit/components/forminfo/FormInfoError.tsx +135 -135
- package/src/kit/components/forminfo/index.ts +1 -1
- package/src/kit/components/keyboard/Keyboard.tsx +916 -916
- package/src/kit/components/keyboard/index.ts +4 -4
- package/src/kit/components/login/Login.tsx +141 -141
- package/src/kit/components/login/index.ts +1 -1
- package/src/kit/components/monthpicker/MonthInput.tsx +131 -131
- package/src/kit/components/monthpicker/MonthPicker.tsx +224 -224
- package/src/kit/components/monthpicker/MonthRangeInput.tsx +153 -153
- package/src/kit/components/monthpicker/MonthRangePicker.tsx +409 -409
- package/src/kit/components/numpad/Numpad.tsx +377 -377
- package/src/kit/components/numpad/index.ts +4 -4
- package/src/kit/components/timepicker/TimePicker.tsx +319 -319
- package/src/kit/components/timepicker/TimeRangePicker.tsx +368 -368
- package/src/kit/components/timepicker/index.ts +2 -2
- package/src/kit/layouts/admin/components/AdminLayout.tsx +286 -286
- package/src/kit/layouts/admin/components/ThemeToggle.tsx +54 -54
- package/src/kit/layouts/admin/hooks/menu.ts +32 -32
- package/src/kit/layouts/admin/providers/AdminMenuProvider.tsx +78 -78
- package/src/kit/layouts/admin/types/index.ts +26 -26
- package/src/kit/providers/ThemeProvider.tsx +90 -90
- package/src/kit/themes/base.css +11 -11
- package/src/kit/themes/clean-slate.css +155 -155
- package/src/kit/themes/default.css +192 -192
- package/src/kit/themes/minimal-modern.css +155 -155
- package/src/kit/themes/spotify.css +164 -164
- package/src/shadcn/hooks/use-mobile.ts +21 -21
- package/src/shadcn/lib/utils.ts +6 -6
- package/src/shadcn/ui/accordion.tsx +66 -66
- package/src/shadcn/ui/alert-dialog.tsx +157 -157
- package/src/shadcn/ui/alert.tsx +66 -66
- package/src/shadcn/ui/aspect-ratio.tsx +11 -11
- package/src/shadcn/ui/avatar.tsx +53 -53
- package/src/shadcn/ui/badge.tsx +46 -46
- package/src/shadcn/ui/breadcrumb.tsx +108 -108
- package/src/shadcn/ui/button.tsx +59 -59
- package/src/shadcn/ui/calendar.tsx +217 -217
- package/src/shadcn/ui/card.tsx +92 -92
- package/src/shadcn/ui/carousel.tsx +240 -240
- package/src/shadcn/ui/chart.tsx +353 -353
- package/src/shadcn/ui/checkbox.tsx +32 -32
- package/src/shadcn/ui/collapsible.tsx +33 -33
- package/src/shadcn/ui/command.tsx +184 -184
- package/src/shadcn/ui/context-menu.tsx +252 -252
- package/src/shadcn/ui/dialog.tsx +143 -143
- package/src/shadcn/ui/drawer.tsx +135 -135
- package/src/shadcn/ui/dropdown-menu.tsx +257 -257
- package/src/shadcn/ui/form.tsx +168 -168
- package/src/shadcn/ui/hover-card.tsx +44 -44
- package/src/shadcn/ui/input-otp.tsx +77 -77
- package/src/shadcn/ui/input.tsx +21 -21
- package/src/shadcn/ui/label.tsx +24 -24
- package/src/shadcn/ui/menubar.tsx +276 -276
- package/src/shadcn/ui/navigation-menu.tsx +168 -168
- package/src/shadcn/ui/pagination.tsx +127 -127
- package/src/shadcn/ui/popover.tsx +48 -48
- package/src/shadcn/ui/progress.tsx +31 -31
- package/src/shadcn/ui/radio-group.tsx +45 -45
- package/src/shadcn/ui/resizable.tsx +56 -56
- package/src/shadcn/ui/scroll-area.tsx +58 -58
- package/src/shadcn/ui/select.tsx +185 -185
- package/src/shadcn/ui/separator.tsx +28 -28
- package/src/shadcn/ui/sheet.tsx +139 -139
- package/src/shadcn/ui/sidebar.tsx +726 -726
- package/src/shadcn/ui/skeleton.tsx +13 -13
- package/src/shadcn/ui/slider.tsx +63 -63
- package/src/shadcn/ui/sonner.tsx +25 -25
- package/src/shadcn/ui/switch.tsx +31 -31
- package/src/shadcn/ui/table.tsx +116 -116
- package/src/shadcn/ui/tabs.tsx +66 -66
- package/src/shadcn/ui/textarea.tsx +18 -18
- package/src/shadcn/ui/toggle-group.tsx +73 -73
- package/src/shadcn/ui/toggle.tsx +47 -47
- package/src/shadcn/ui/tooltip.tsx +61 -61
- package/src/stories/FileUploader.stories.tsx +185 -185
- package/src/stories/kit/builder/DataTable.Basic.stories.tsx +71 -71
- package/src/stories/kit/builder/DataTable.Filters.stories.tsx +98 -98
- package/src/stories/kit/builder/DataTable.Pagination.stories.tsx +73 -73
- package/src/stories/kit/builder/DataTable.SelectionAndActions.stories.tsx +77 -77
- package/src/stories/kit/builder/DataTable.Sorting.stories.tsx +67 -67
- package/src/stories/kit/builder/Dialog.stories.tsx +90 -90
- package/src/stories/kit/builder/Form.ArrayLayouts.stories.tsx +177 -177
- package/src/stories/kit/builder/Form.Autocomplete.stories.tsx +220 -220
- package/src/stories/kit/builder/Form.Basic.stories.tsx +79 -79
- package/src/stories/kit/builder/Form.Complex.stories.tsx +569 -569
- package/src/stories/kit/builder/Form.DateTime.stories.tsx +70 -70
- package/src/stories/kit/builder/Form.Dynamic.stories.tsx +926 -926
- package/src/stories/kit/builder/Form.Files.stories.tsx +136 -136
- package/src/stories/kit/builder/Form.MultipleFormBuilder.stories.tsx +377 -377
- package/src/stories/kit/builder/Form.Pickers.stories.tsx +75 -75
- package/src/stories/kit/builder/Form.Simple.stories.tsx +91 -91
- package/src/stories/kit/builder/Form.Time.stories.tsx +68 -68
- package/src/stories/kit/builder/Page.stories.tsx +115 -115
- package/src/stories/kit/builder/Section.stories.tsx +282 -282
- package/src/stories/kit/components/Autocomplete.stories.tsx +313 -313
- package/src/stories/kit/components/DatePicker.stories.tsx +195 -195
- package/src/stories/kit/components/DateRangePicker.stories.tsx +195 -195
- package/src/stories/kit/components/Keyboard.stories.tsx +263 -263
- package/src/stories/kit/components/Login.stories.tsx +167 -167
- package/src/stories/kit/components/MonthPicker.stories.tsx +100 -100
- package/src/stories/kit/components/MonthRangePicker.stories.tsx +117 -117
- package/src/stories/kit/components/Numpad.stories.tsx +195 -195
- package/src/stories/kit/components/TimePicker.stories.tsx +71 -71
- package/src/stories/kit/components/TimeRangePicker.stories.tsx +43 -43
- package/src/stories/kit/layouts/admin/AdminLayout.Basic.stories.tsx +118 -118
- package/src/stories/kit/layouts/admin/AdminLayout.Collapsible.stories.tsx +81 -81
- package/src/stories/kit/layouts/admin/AdminLayout.Complex.stories.tsx +251 -251
- package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarHeaderComponent.stories.tsx +80 -80
- package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarTitleAndIcon.stories.tsx +70 -70
- package/src/stories/kit/layouts/admin/AdminLayout.HeaderSlots.stories.tsx +87 -87
- package/src/stories/shadcn/ui/Accordion.stories.tsx +117 -117
- package/src/stories/shadcn/ui/Alert.stories.tsx +36 -36
- package/src/stories/shadcn/ui/AlertDialog.stories.tsx +73 -73
- package/src/stories/shadcn/ui/AspectRatio.stories.tsx +58 -58
- package/src/stories/shadcn/ui/Avatar.stories.tsx +26 -26
- package/src/stories/shadcn/ui/Badge.stories.tsx +28 -28
- package/src/stories/shadcn/ui/Breadcrumb.stories.tsx +47 -47
- package/src/stories/shadcn/ui/Button.stories.tsx +51 -51
- package/src/stories/shadcn/ui/Calendar.stories.tsx +33 -33
- package/src/stories/shadcn/ui/Card.stories.tsx +39 -39
- package/src/stories/shadcn/ui/Carousel.stories.tsx +37 -37
- package/src/stories/shadcn/ui/Chart.stories.tsx +72 -72
- package/src/stories/shadcn/ui/Checkbox.stories.tsx +64 -64
- package/src/stories/shadcn/ui/Collapsible.stories.tsx +40 -40
- package/src/stories/shadcn/ui/Command.stories.tsx +53 -53
- package/src/stories/shadcn/ui/ContextMenu.stories.tsx +67 -67
- package/src/stories/shadcn/ui/Dialog.stories.tsx +45 -45
- package/src/stories/shadcn/ui/Drawer.stories.tsx +49 -49
- package/src/stories/shadcn/ui/DropdownMenu.stories.tsx +75 -75
- package/src/stories/shadcn/ui/Form.stories.tsx +93 -93
- package/src/stories/shadcn/ui/HoverCard.stories.tsx +43 -43
- package/src/stories/shadcn/ui/Input.stories.tsx +41 -41
- package/src/stories/shadcn/ui/InputOtp.stories.tsx +39 -39
- package/src/stories/shadcn/ui/Label.stories.tsx +29 -29
- package/src/stories/shadcn/ui/Menubar.stories.tsx +87 -87
- package/src/stories/shadcn/ui/NavigationMenu.stories.tsx +78 -78
- package/src/stories/shadcn/ui/Pagination.stories.tsx +51 -51
- package/src/stories/shadcn/ui/Popover.stories.tsx +53 -53
- package/src/stories/shadcn/ui/Progress.stories.tsx +30 -30
- package/src/stories/shadcn/ui/RadioGroup.stories.tsx +31 -31
- package/src/stories/shadcn/ui/Resizable.stories.tsx +55 -55
- package/src/stories/shadcn/ui/ScrollArea.stories.tsx +84 -84
- package/src/stories/shadcn/ui/Select.stories.tsx +61 -61
- package/src/stories/shadcn/ui/Separator.stories.tsx +35 -35
- package/src/stories/shadcn/ui/Sheet.stories.tsx +48 -48
- package/src/stories/shadcn/ui/Sidebar.stories.tsx +131 -131
- package/src/stories/shadcn/ui/Skeleton.stories.tsx +23 -23
- package/src/stories/shadcn/ui/Slider.stories.tsx +21 -21
- package/src/stories/shadcn/ui/Sonner.stories.tsx +49 -49
- package/src/stories/shadcn/ui/Switch.stories.tsx +28 -28
- package/src/stories/shadcn/ui/Table.stories.tsx +374 -374
- package/src/stories/shadcn/ui/Tabs.stories.tsx +31 -31
- package/src/stories/shadcn/ui/Textarea.stories.tsx +42 -42
- package/src/stories/shadcn/ui/Toggle.stories.tsx +44 -44
- package/src/stories/shadcn/ui/ToggleGroup.stories.tsx +28 -28
- package/src/stories/shadcn/ui/Tooltip.stories.tsx +30 -30
- package/tsconfig.json +20 -20
- package/tsconfig.lib.json +52 -52
- package/tsconfig.spec.json +38 -38
- package/vite.config.ts +93 -93
- package/storybook-static/assets/Accordion.stories-KU4JBR8U.js +0 -52
- package/storybook-static/assets/AdminLayout-CPvVCwfY.js +0 -53
- package/storybook-static/assets/AdminLayout.Basic.stories-DkP2UVXe.js +0 -4
- package/storybook-static/assets/AdminLayout.Collapsible.stories-BuuVjtpW.js +0 -4
- package/storybook-static/assets/AdminLayout.Complex.stories-D-k4H0hJ.js +0 -29
- package/storybook-static/assets/AdminLayout.CustomSidebarHeaderComponent.stories-B_0IEDd4.js +0 -9
- package/storybook-static/assets/AdminLayout.CustomSidebarTitleAndIcon.stories-CvAeXUyA.js +0 -4
- package/storybook-static/assets/AdminLayout.HeaderSlots.stories-RBFHoSZK.js +0 -7
- package/storybook-static/assets/Alert.stories-DKxKtIc0.js +0 -27
- package/storybook-static/assets/AlertDialog.stories-BqTpZ_nG.js +0 -43
- package/storybook-static/assets/AspectRatio.stories-DPO9QQ5F.js +0 -22
- package/storybook-static/assets/Autocomplete-Cpg4CaJe.js +0 -56
- package/storybook-static/assets/Autocomplete.stories-CWj4G5fh.js +0 -56
- package/storybook-static/assets/Avatar.stories-DPhov_2g.js +0 -12
- package/storybook-static/assets/Badge.stories-DFKrRdXq.js +0 -12
- package/storybook-static/assets/Breadcrumb.stories-CTE6CZUC.js +0 -25
- package/storybook-static/assets/Button.stories-cbt2InL-.js +0 -26
- package/storybook-static/assets/Calendar.stories-DRhTw_43.js +0 -3
- package/storybook-static/assets/Card.stories-Isf6n_K3.js +0 -15
- package/storybook-static/assets/Carousel.stories-Cmg0I3fR.js +0 -15
- package/storybook-static/assets/Chart.stories-aQ-fNijT.js +0 -126
- package/storybook-static/assets/Checkbox.stories-B7YMXPDc.js +0 -12
- package/storybook-static/assets/Collapsible.stories-BUzl17ZZ.js +0 -18
- package/storybook-static/assets/Combination-BdQWAuko.js +0 -41
- package/storybook-static/assets/Command.stories-DzBlWQs0.js +0 -30
- package/storybook-static/assets/ContextMenu.stories-CJlBQyXc.js +0 -31
- package/storybook-static/assets/DataTable.Basic.stories-BWYKFDmK.js +0 -6
- package/storybook-static/assets/DataTable.Filters.stories-uZdtJk8t.js +0 -21
- package/storybook-static/assets/DataTable.Pagination.stories-C5N1khkp.js +0 -24
- package/storybook-static/assets/DataTable.SelectionAndActions.stories-FhCqZKvO.js +0 -26
- package/storybook-static/assets/DataTable.Sorting.stories-D-k7EtRj.js +0 -6
- package/storybook-static/assets/Dialog.stories-C62AF-Gx.js +0 -54
- package/storybook-static/assets/Dialog.stories-lrjRwOus.js +0 -18
- package/storybook-static/assets/Drawer.stories-CGjkdJeV.js +0 -24
- package/storybook-static/assets/DropdownMenu.stories-DkGClRAA.js +0 -35
- package/storybook-static/assets/Form.ArrayLayouts.stories-C5d_062d.js +0 -130
- package/storybook-static/assets/Form.Autocomplete.stories-CPZPkk4o.js +0 -142
- package/storybook-static/assets/Form.Basic.stories-Bhcu3-3n.js +0 -58
- package/storybook-static/assets/Form.Complex.stories-QnXh5a7Q.js +0 -361
- package/storybook-static/assets/Form.Dynamic.stories-DFW6wIuT.js +0 -502
- package/storybook-static/assets/Form.Simple.stories-BhJcyhbE.js +0 -53
- package/storybook-static/assets/Form.stories-PFNsMYxO.js +0 -3
- package/storybook-static/assets/FormBuilder-BQBBxo_k.js +0 -5
- package/storybook-static/assets/HoverCard.stories-CAlQEVn8.js +0 -21
- package/storybook-static/assets/Input.stories-CEhODt0V.js +0 -16
- package/storybook-static/assets/InputOtp.stories-DSvNP4dS.js +0 -42
- package/storybook-static/assets/Label.stories-B3pa8ZLY.js +0 -14
- package/storybook-static/assets/Login.stories-C7KQkmR_.js +0 -37
- package/storybook-static/assets/Menubar.stories-CHXhSHxc.js +0 -44
- package/storybook-static/assets/MonthPicker.stories-BnrOc4fm.js +0 -99
- package/storybook-static/assets/MonthRangePicker.stories-55Gk1t-7.js +0 -134
- package/storybook-static/assets/NavigationMenu.stories-CXoS080P.js +0 -30
- package/storybook-static/assets/Page.stories-GdSJgZ6-.js +0 -91
- package/storybook-static/assets/Pagination.stories-BEBwqH4N.js +0 -29
- package/storybook-static/assets/Popover.stories-BICy98Cw.js +0 -15
- package/storybook-static/assets/Progress.stories-DECHNOME.js +0 -8
- package/storybook-static/assets/RadioGroup.stories-DA7-uKfV.js +0 -16
- package/storybook-static/assets/Resizable.stories-B99kWkH7.js +0 -25
- package/storybook-static/assets/ScrollArea.stories-BqvUAXqU.js +0 -12
- package/storybook-static/assets/Section.stories-lFMlFBQn.js +0 -277
- package/storybook-static/assets/SectionBuilder-BQW705x0.js +0 -1
- package/storybook-static/assets/Select.stories-BsKyZ6Io.js +0 -17
- package/storybook-static/assets/Separator.stories-BTDOaOM2.js +0 -17
- package/storybook-static/assets/Sheet.stories-Cam1gR6G.js +0 -24
- package/storybook-static/assets/Sidebar.stories-DnOa6G7y.js +0 -106
- package/storybook-static/assets/Skeleton.stories-BQNIuIe5.js +0 -9
- package/storybook-static/assets/Slider.stories-Bslq7hjq.js +0 -6
- package/storybook-static/assets/Sonner.stories-D34pBBtI.js +0 -18
- package/storybook-static/assets/Switch.stories-Puyb1-Bx.js +0 -3
- package/storybook-static/assets/Table.stories-ClZxAhut.js +0 -35
- package/storybook-static/assets/Tabs.stories-CURNTETB.js +0 -10
- package/storybook-static/assets/Textarea.stories-Cf1ZBrWw.js +0 -17
- package/storybook-static/assets/Toggle.stories-CdMHY_bi.js +0 -3
- package/storybook-static/assets/ToggleGroup.stories-BM68m1dX.js +0 -13
- package/storybook-static/assets/Tooltip.stories-DiQv64dM.js +0 -10
- package/storybook-static/assets/accordion-DVgwQcnw.js +0 -1
- package/storybook-static/assets/alert-dialog-DCUEwpqm.js +0 -7
- package/storybook-static/assets/avatar-BzwOE-mi.js +0 -1
- package/storybook-static/assets/axe-HmUsR1st.js +0 -30
- package/storybook-static/assets/badge-BnQWua6u.js +0 -1
- package/storybook-static/assets/button-0oMkiryo.js +0 -1
- package/storybook-static/assets/card-BJpPOzP8.js +0 -1
- package/storybook-static/assets/chart-column-DZGb4ZZS.js +0 -6
- package/storybook-static/assets/check-B9hBGj6o.js +0 -6
- package/storybook-static/assets/checkbox-CyIeaWHX.js +0 -1
- package/storybook-static/assets/chevron-down-D_37S6il.js +0 -6
- package/storybook-static/assets/chevron-left-BBoN0vbI.js +0 -6
- package/storybook-static/assets/chevron-right-B5vIMLxK.js +0 -6
- package/storybook-static/assets/circle-C5Lzx6Nx.js +0 -6
- package/storybook-static/assets/clean-slate-D1HmMFJM.css +0 -1
- package/storybook-static/assets/command-Csa9p8_a.js +0 -6
- package/storybook-static/assets/createLucideIcon-BrHXro7t.js +0 -21
- package/storybook-static/assets/default-CN_Fo1GY.css +0 -1
- package/storybook-static/assets/dependencies-ctrV69dx.js +0 -1
- package/storybook-static/assets/dialog-CsnqITTn.js +0 -1
- package/storybook-static/assets/dropdown-menu-BWxxwPHL.js +0 -1
- package/storybook-static/assets/ellipsis-BRS038RR.js +0 -6
- package/storybook-static/assets/grip-vertical-BxXG8KNA.js +0 -6
- package/storybook-static/assets/iframe-C9bogcIc.css +0 -1
- package/storybook-static/assets/iframe-v7iAhKit.js +0 -1555
- package/storybook-static/assets/index-0-qMRXou.js +0 -1
- package/storybook-static/assets/index-AvwFFKJc.js +0 -1
- package/storybook-static/assets/index-BVDb4dFc.js +0 -1
- package/storybook-static/assets/index-B_qx7A5T.js +0 -1
- package/storybook-static/assets/index-BdQq_4o_.js +0 -1
- package/storybook-static/assets/index-BfiCOk42.js +0 -1
- package/storybook-static/assets/index-Bv9yk470.js +0 -1
- package/storybook-static/assets/index-Bw1A27Kp.js +0 -1
- package/storybook-static/assets/index-ByqivBWx.js +0 -1
- package/storybook-static/assets/index-C9Ta0ZTH.js +0 -1
- package/storybook-static/assets/index-CDY5kTx5.js +0 -1
- package/storybook-static/assets/index-CGnyVRgB.js +0 -1
- package/storybook-static/assets/index-CGrAONsN.js +0 -1
- package/storybook-static/assets/index-CWjrGFAQ.js +0 -1
- package/storybook-static/assets/index-CwBdPBFz.js +0 -9
- package/storybook-static/assets/index-D8RXF03I.js +0 -1
- package/storybook-static/assets/index-DLIxT4Z7.js +0 -1
- package/storybook-static/assets/index-DW48STyt.js +0 -1
- package/storybook-static/assets/index-DbaA6-o1.js +0 -1
- package/storybook-static/assets/index-Dph_5COR.js +0 -1
- package/storybook-static/assets/index-DrN5n71E.js +0 -1
- package/storybook-static/assets/index-Tp9IdbR8.js +0 -1
- package/storybook-static/assets/index-WyF3-wTE.js +0 -9
- package/storybook-static/assets/index-XSmPROEP.js +0 -1
- package/storybook-static/assets/index-Z6wF44KX.js +0 -5
- package/storybook-static/assets/index-_RPqOjlQ.js +0 -1
- package/storybook-static/assets/index-jrimW4QO.js +0 -1
- package/storybook-static/assets/index-nqc17SX4.js +0 -1
- package/storybook-static/assets/input-11YRd9gD.js +0 -1
- package/storybook-static/assets/jsx-runtime-D_zvdyIk.js +0 -9
- package/storybook-static/assets/label-Do8ODIVk.js +0 -1
- package/storybook-static/assets/lodash-DDwpuhPG.js +0 -73
- package/storybook-static/assets/matchers-7Z3WT2CE-T3xScrR7.js +0 -14
- package/storybook-static/assets/minimal-modern-BlYVzfQU.css +0 -1
- package/storybook-static/assets/popover-CcciSWAw.js +0 -1
- package/storybook-static/assets/preload-helper-Dp1pzeXC.js +0 -1
- package/storybook-static/assets/radio-group-DiJ0Y_KQ.js +0 -1
- package/storybook-static/assets/react-18-Cr9fq_Ip.js +0 -25
- package/storybook-static/assets/react-icons.esm-B_ULMmNU.js +0 -1
- package/storybook-static/assets/refresh-cw-BmRDhIV_.js +0 -6
- package/storybook-static/assets/schemas-CGNYCiJ6.js +0 -18
- package/storybook-static/assets/section-factories-DCCY9R35.js +0 -1
- package/storybook-static/assets/select-DDrkxaOg.js +0 -6
- package/storybook-static/assets/separator-o5SAUnaJ.js +0 -1
- package/storybook-static/assets/settings-2-xWGvvbG6.js +0 -6
- package/storybook-static/assets/sheet-C7jhU3XE.js +0 -1
- package/storybook-static/assets/shopping-cart-BFlrufvo.js +0 -11
- package/storybook-static/assets/sidebar-C8hU1Mxy.js +0 -6
- package/storybook-static/assets/skeleton-CjDnQs43.js +0 -1
- package/storybook-static/assets/spotify-CUDj7g8m.css +0 -1
- package/storybook-static/assets/switch-CKGRuk3u.js +0 -1
- package/storybook-static/assets/table-CP3vMqFn.js +0 -1
- package/storybook-static/assets/tabs-CopK2m3j.js +0 -1
- package/storybook-static/assets/textarea-Dw2vruMl.js +0 -1
- package/storybook-static/assets/toggle-DmHbWetf.js +0 -16
- package/storybook-static/assets/tooltip-_LqYEYFw.js +0 -1
- package/storybook-static/assets/trash-2-xdbApPby.js +0 -11
- package/storybook-static/assets/utils-D-KgF5mV.js +0 -1
- package/storybook-static/assets/x-B1a4fyWM.js +0 -6
- package/storybook-static/favicon-wrapper.svg +0 -46
- package/storybook-static/favicon.svg +0 -1
- package/storybook-static/iframe.html +0 -687
- package/storybook-static/index.d.ts +0 -64
- package/storybook-static/index.d.ts.map +0 -1
- package/storybook-static/index.html +0 -166
- package/storybook-static/index.json +0 -1
- package/storybook-static/kit/builder/data-table/components/DataTable.d.ts +0 -37
- package/storybook-static/kit/builder/data-table/components/DataTable.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/components/DataTableColumnHeader.d.ts +0 -8
- package/storybook-static/kit/builder/data-table/components/DataTableColumnHeader.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/components/DataTablePagination.d.ts +0 -6
- package/storybook-static/kit/builder/data-table/components/DataTablePagination.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/components/DataTableViewOptions.d.ts +0 -5
- package/storybook-static/kit/builder/data-table/components/DataTableViewOptions.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/index.d.ts +0 -7
- package/storybook-static/kit/builder/data-table/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/types.d.ts +0 -27
- package/storybook-static/kit/builder/data-table/types.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/utils/dotAccessor.d.ts +0 -2
- package/storybook-static/kit/builder/data-table/utils/dotAccessor.d.ts.map +0 -1
- package/storybook-static/kit/builder/dialog/index.d.ts +0 -3
- package/storybook-static/kit/builder/dialog/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/dialog/provider.d.ts +0 -26
- package/storybook-static/kit/builder/dialog/provider.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/FormBuilder.d.ts +0 -137
- package/storybook-static/kit/builder/form/components/FormBuilder.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/FormBuilderActions.d.ts +0 -20
- package/storybook-static/kit/builder/form/components/FormBuilderActions.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/FormBuilderField.d.ts +0 -12
- package/storybook-static/kit/builder/form/components/FormBuilderField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/ArrayField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/ArrayField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/AutocompleteField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/AutocompleteField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/CheckboxField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/CheckboxField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/DateField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/DateField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/FileField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/FileField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/NumberField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/NumberField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/ObjectField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/ObjectField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/RadioField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/RadioField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/SelectField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/SelectField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/SwitchField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/SwitchField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/TextField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/TextField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/TextareaField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/TextareaField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/index.d.ts +0 -14
- package/storybook-static/kit/builder/form/components/fields/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/types.d.ts +0 -14
- package/storybook-static/kit/builder/form/components/fields/types.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/index.d.ts +0 -4
- package/storybook-static/kit/builder/form/components/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/index.d.ts +0 -3
- package/storybook-static/kit/builder/form/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/common-forms.d.ts +0 -7
- package/storybook-static/kit/builder/form/utils/common-forms.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/dependencies.d.ts +0 -41
- package/storybook-static/kit/builder/form/utils/dependencies.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/field-factories.d.ts +0 -23
- package/storybook-static/kit/builder/form/utils/field-factories.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/index.d.ts +0 -15
- package/storybook-static/kit/builder/form/utils/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/section-factories.d.ts +0 -7
- package/storybook-static/kit/builder/form/utils/section-factories.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/transformers.d.ts +0 -6
- package/storybook-static/kit/builder/form/utils/transformers.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/validations.d.ts +0 -13
- package/storybook-static/kit/builder/form/utils/validations.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/validators.d.ts +0 -8
- package/storybook-static/kit/builder/form/utils/validators.d.ts.map +0 -1
- package/storybook-static/kit/builder/page/Page.d.ts +0 -48
- package/storybook-static/kit/builder/page/Page.d.ts.map +0 -1
- package/storybook-static/kit/builder/page/index.d.ts +0 -2
- package/storybook-static/kit/builder/page/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/section/SectionBuilder.d.ts +0 -3
- package/storybook-static/kit/builder/section/SectionBuilder.d.ts.map +0 -1
- package/storybook-static/kit/builder/section/index.d.ts +0 -3
- package/storybook-static/kit/builder/section/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/section/types.d.ts +0 -70
- package/storybook-static/kit/builder/section/types.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/context.d.ts +0 -3
- package/storybook-static/kit/builder/stack-dialog/context.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/hooks.d.ts +0 -6
- package/storybook-static/kit/builder/stack-dialog/hooks.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/index.d.ts +0 -5
- package/storybook-static/kit/builder/stack-dialog/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/provider.d.ts +0 -3
- package/storybook-static/kit/builder/stack-dialog/provider.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/renderer.d.ts +0 -6
- package/storybook-static/kit/builder/stack-dialog/renderer.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/types.d.ts +0 -20
- package/storybook-static/kit/builder/stack-dialog/types.d.ts.map +0 -1
- package/storybook-static/kit/components/autocomplete/Autocomplete.d.ts +0 -53
- package/storybook-static/kit/components/autocomplete/Autocomplete.d.ts.map +0 -1
- package/storybook-static/kit/components/autocomplete/index.d.ts +0 -4
- package/storybook-static/kit/components/autocomplete/index.d.ts.map +0 -1
- package/storybook-static/kit/components/autocomplete/types.d.ts +0 -19
- package/storybook-static/kit/components/autocomplete/types.d.ts.map +0 -1
- package/storybook-static/kit/components/login/Login.d.ts +0 -29
- package/storybook-static/kit/components/login/Login.d.ts.map +0 -1
- package/storybook-static/kit/components/login/index.d.ts +0 -2
- package/storybook-static/kit/components/login/index.d.ts.map +0 -1
- package/storybook-static/kit/components/monthpicker/MonthPicker.d.ts +0 -32
- package/storybook-static/kit/components/monthpicker/MonthPicker.d.ts.map +0 -1
- package/storybook-static/kit/components/monthpicker/MonthRangePicker.d.ts +0 -48
- package/storybook-static/kit/components/monthpicker/MonthRangePicker.d.ts.map +0 -1
- package/storybook-static/kit/layouts/admin/components/AdminLayout.d.ts +0 -17
- package/storybook-static/kit/layouts/admin/components/AdminLayout.d.ts.map +0 -1
- package/storybook-static/kit/layouts/admin/components/ThemeToggle.d.ts +0 -5
- package/storybook-static/kit/layouts/admin/components/ThemeToggle.d.ts.map +0 -1
- package/storybook-static/kit/layouts/admin/hooks/menu.d.ts +0 -13
- package/storybook-static/kit/layouts/admin/hooks/menu.d.ts.map +0 -1
- package/storybook-static/kit/layouts/admin/providers/AdminMenuProvider.d.ts +0 -7
- package/storybook-static/kit/layouts/admin/providers/AdminMenuProvider.d.ts.map +0 -1
- package/storybook-static/kit/layouts/admin/types/index.d.ts +0 -27
- package/storybook-static/kit/layouts/admin/types/index.d.ts.map +0 -1
- package/storybook-static/kit/providers/ThemeProvider.d.ts +0 -14
- package/storybook-static/kit/providers/ThemeProvider.d.ts.map +0 -1
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +0 -1
- package/storybook-static/sb-addons/a11y-5/manager-bundle.js +0 -5
- package/storybook-static/sb-addons/essentials-backgrounds-1/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-measure-2/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-outline-3/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/interactions-4/manager-bundle.js +0 -57
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -971
- package/storybook-static/sb-addons/storysource-6/manager-bundle.js +0 -3
- package/storybook-static/sb-common-assets/favicon-wrapper.svg +0 -46
- package/storybook-static/sb-common-assets/favicon.svg +0 -1
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +0 -797
- package/storybook-static/sb-manager/globals-runtime.js +0 -69653
- package/storybook-static/sb-manager/globals.js +0 -34
- package/storybook-static/sb-manager/runtime.js +0 -13181
- package/storybook-static/shadcn/hooks/use-mobile.d.ts +0 -2
- package/storybook-static/shadcn/hooks/use-mobile.d.ts.map +0 -1
- package/storybook-static/shadcn/lib/utils.d.ts +0 -3
- package/storybook-static/shadcn/lib/utils.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/accordion.d.ts +0 -8
- package/storybook-static/shadcn/ui/accordion.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/alert-dialog.d.ts +0 -15
- package/storybook-static/shadcn/ui/alert-dialog.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/alert.d.ts +0 -10
- package/storybook-static/shadcn/ui/alert.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/aspect-ratio.d.ts +0 -4
- package/storybook-static/shadcn/ui/aspect-ratio.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/avatar.d.ts +0 -7
- package/storybook-static/shadcn/ui/avatar.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/badge.d.ts +0 -10
- package/storybook-static/shadcn/ui/badge.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/breadcrumb.d.ts +0 -12
- package/storybook-static/shadcn/ui/breadcrumb.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/button.d.ts +0 -11
- package/storybook-static/shadcn/ui/button.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/calendar.d.ts +0 -9
- package/storybook-static/shadcn/ui/calendar.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/card.d.ts +0 -10
- package/storybook-static/shadcn/ui/card.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/carousel.d.ts +0 -20
- package/storybook-static/shadcn/ui/carousel.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/chart.d.ts +0 -41
- package/storybook-static/shadcn/ui/chart.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/checkbox.d.ts +0 -5
- package/storybook-static/shadcn/ui/checkbox.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/collapsible.d.ts +0 -6
- package/storybook-static/shadcn/ui/collapsible.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/command.d.ts +0 -19
- package/storybook-static/shadcn/ui/command.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/context-menu.d.ts +0 -26
- package/storybook-static/shadcn/ui/context-menu.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/dialog.d.ts +0 -16
- package/storybook-static/shadcn/ui/dialog.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/drawer.d.ts +0 -14
- package/storybook-static/shadcn/ui/drawer.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/dropdown-menu.d.ts +0 -26
- package/storybook-static/shadcn/ui/dropdown-menu.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/form.d.ts +0 -25
- package/storybook-static/shadcn/ui/form.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/hover-card.d.ts +0 -7
- package/storybook-static/shadcn/ui/hover-card.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/input-otp.d.ts +0 -12
- package/storybook-static/shadcn/ui/input-otp.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/input.d.ts +0 -4
- package/storybook-static/shadcn/ui/input.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/label.d.ts +0 -5
- package/storybook-static/shadcn/ui/label.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/menubar.d.ts +0 -27
- package/storybook-static/shadcn/ui/menubar.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/navigation-menu.d.ts +0 -15
- package/storybook-static/shadcn/ui/navigation-menu.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/pagination.d.ts +0 -14
- package/storybook-static/shadcn/ui/pagination.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/popover.d.ts +0 -8
- package/storybook-static/shadcn/ui/popover.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/progress.d.ts +0 -5
- package/storybook-static/shadcn/ui/progress.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/radio-group.d.ts +0 -6
- package/storybook-static/shadcn/ui/radio-group.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/resizable.d.ts +0 -9
- package/storybook-static/shadcn/ui/resizable.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/scroll-area.d.ts +0 -6
- package/storybook-static/shadcn/ui/scroll-area.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/select.d.ts +0 -16
- package/storybook-static/shadcn/ui/select.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/separator.d.ts +0 -5
- package/storybook-static/shadcn/ui/separator.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/sheet.d.ts +0 -14
- package/storybook-static/shadcn/ui/sheet.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/sidebar.d.ts +0 -70
- package/storybook-static/shadcn/ui/sidebar.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/skeleton.d.ts +0 -3
- package/storybook-static/shadcn/ui/skeleton.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/slider.d.ts +0 -5
- package/storybook-static/shadcn/ui/slider.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/sonner.d.ts +0 -4
- package/storybook-static/shadcn/ui/sonner.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/switch.d.ts +0 -5
- package/storybook-static/shadcn/ui/switch.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/table.d.ts +0 -11
- package/storybook-static/shadcn/ui/table.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/tabs.d.ts +0 -8
- package/storybook-static/shadcn/ui/tabs.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/textarea.d.ts +0 -4
- package/storybook-static/shadcn/ui/textarea.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/toggle-group.d.ts +0 -8
- package/storybook-static/shadcn/ui/toggle-group.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/toggle.d.ts +0 -10
- package/storybook-static/shadcn/ui/toggle.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/tooltip.d.ts +0 -8
- package/storybook-static/shadcn/ui/tooltip.d.ts.map +0 -1
- package/storybook-static/vite-inject-mocker-entry.js +0 -18
|
@@ -1,547 +1,547 @@
|
|
|
1
|
-
import {
|
|
2
|
-
flexRender,
|
|
3
|
-
getCoreRowModel,
|
|
4
|
-
getFilteredRowModel,
|
|
5
|
-
getPaginationRowModel,
|
|
6
|
-
getSortedRowModel,
|
|
7
|
-
useReactTable,
|
|
8
|
-
type ColumnDef,
|
|
9
|
-
type ColumnFiltersState,
|
|
10
|
-
type PaginationState,
|
|
11
|
-
type Table as ReactTable,
|
|
12
|
-
type SortingState,
|
|
13
|
-
type VisibilityState,
|
|
14
|
-
} from '@tanstack/react-table';
|
|
15
|
-
import { Loader2, RefreshCw } from 'lucide-react';
|
|
16
|
-
import * as React from 'react';
|
|
17
|
-
import { cn } from '../../../../shadcn/lib/utils';
|
|
18
|
-
import {
|
|
19
|
-
Accordion,
|
|
20
|
-
AccordionContent,
|
|
21
|
-
AccordionItem,
|
|
22
|
-
AccordionTrigger,
|
|
23
|
-
} from '../../../../shadcn/ui/accordion';
|
|
24
|
-
import { Button } from '../../../../shadcn/ui/button';
|
|
25
|
-
import { Checkbox } from '../../../../shadcn/ui/checkbox';
|
|
26
|
-
import { Skeleton } from '../../../../shadcn/ui/skeleton';
|
|
27
|
-
import {
|
|
28
|
-
Table,
|
|
29
|
-
TableBody,
|
|
30
|
-
TableCell,
|
|
31
|
-
TableHead,
|
|
32
|
-
TableHeader,
|
|
33
|
-
TableRow,
|
|
34
|
-
} from '../../../../shadcn/ui/table';
|
|
35
|
-
import { FormBuilder, type FormBuilderSectionConfig } from '../../form';
|
|
36
|
-
import type {
|
|
37
|
-
DataTableAction,
|
|
38
|
-
DataTableBatchAction,
|
|
39
|
-
DataTableFiltersProp,
|
|
40
|
-
} from '../types';
|
|
41
|
-
import { DataTablePagination } from './DataTablePagination';
|
|
42
|
-
import { DataTableViewOptions } from './DataTableViewOptions';
|
|
43
|
-
|
|
44
|
-
export interface DataTableProps<TData, TValue> {
|
|
45
|
-
columns: ColumnDef<TData, TValue>[];
|
|
46
|
-
data: TData[];
|
|
47
|
-
// Optional controlled states
|
|
48
|
-
loading: boolean;
|
|
49
|
-
sorting?: boolean;
|
|
50
|
-
sortingState?: SortingState;
|
|
51
|
-
onSortingChange?: (newState: SortingState) => void;
|
|
52
|
-
columnFilters?: boolean;
|
|
53
|
-
columnFiltersState?: ColumnFiltersState;
|
|
54
|
-
onColumnFiltersChange?: (newState: ColumnFiltersState) => void;
|
|
55
|
-
rowCount?: number;
|
|
56
|
-
pagination?: boolean;
|
|
57
|
-
paginationState?: PaginationState;
|
|
58
|
-
paginationVariant?: 'full' | 'compact';
|
|
59
|
-
onPaginationChange?: (newState: PaginationState) => void;
|
|
60
|
-
columnVisibility?: boolean;
|
|
61
|
-
columnVisibilityState?: VisibilityState;
|
|
62
|
-
onColumnVisibilityChange?: (newState: VisibilityState) => void;
|
|
63
|
-
// Expose table instance
|
|
64
|
-
onTable?: (table: ReactTable<TData>) => void;
|
|
65
|
-
// UI
|
|
66
|
-
className?: string;
|
|
67
|
-
emptyText?: string;
|
|
68
|
-
// Filters UI (section-based or simple)
|
|
69
|
-
formFilters?: DataTableFiltersProp;
|
|
70
|
-
formFilterValues?: Record<string, unknown> | null;
|
|
71
|
-
onFormFilterChange?: (values: Record<string, unknown>) => void;
|
|
72
|
-
// Selection & Actions
|
|
73
|
-
selectable?: boolean;
|
|
74
|
-
actions?: DataTableAction[];
|
|
75
|
-
batchActions?: DataTableBatchAction<TData>[];
|
|
76
|
-
// Standard actions
|
|
77
|
-
showStandardActions?: boolean;
|
|
78
|
-
onRefresh?: () => void | Promise<void>;
|
|
79
|
-
// Row interactions
|
|
80
|
-
onRowClick?: (row: TData) => void;
|
|
81
|
-
// Filters wrapper options
|
|
82
|
-
filterWrapper?: 'accordion' | 'card' | 'none';
|
|
83
|
-
filterTitle?: string;
|
|
84
|
-
filterShowActionsSeparator?: boolean;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function DataTable<TData, TValue>({
|
|
88
|
-
columns,
|
|
89
|
-
data,
|
|
90
|
-
loading,
|
|
91
|
-
sorting,
|
|
92
|
-
sortingState,
|
|
93
|
-
onSortingChange,
|
|
94
|
-
columnFilters,
|
|
95
|
-
columnFiltersState,
|
|
96
|
-
onColumnFiltersChange,
|
|
97
|
-
rowCount,
|
|
98
|
-
pagination,
|
|
99
|
-
paginationVariant = 'full',
|
|
100
|
-
onPaginationChange,
|
|
101
|
-
paginationState,
|
|
102
|
-
columnVisibility,
|
|
103
|
-
columnVisibilityState,
|
|
104
|
-
onColumnVisibilityChange,
|
|
105
|
-
onTable,
|
|
106
|
-
className,
|
|
107
|
-
emptyText = 'No results.',
|
|
108
|
-
formFilters,
|
|
109
|
-
formFilterValues,
|
|
110
|
-
onFormFilterChange,
|
|
111
|
-
selectable,
|
|
112
|
-
actions,
|
|
113
|
-
batchActions,
|
|
114
|
-
showStandardActions,
|
|
115
|
-
onRefresh,
|
|
116
|
-
onRowClick,
|
|
117
|
-
filterWrapper,
|
|
118
|
-
filterTitle,
|
|
119
|
-
filterShowActionsSeparator,
|
|
120
|
-
}: DataTableProps<TData, TValue>) {
|
|
121
|
-
const [rowSelection, setRowSelection] = React.useState<
|
|
122
|
-
Record<string, boolean>
|
|
123
|
-
>({});
|
|
124
|
-
const [internalSortingState, setInternalSortingState] =
|
|
125
|
-
React.useState<SortingState>([]);
|
|
126
|
-
const [internalFiltersState, setInternalFiltersState] =
|
|
127
|
-
React.useState<ColumnFiltersState>([]);
|
|
128
|
-
const [internalPaginationState, setInternalPaginationState] =
|
|
129
|
-
React.useState<PaginationState>({ pageIndex: 0, pageSize: 10 });
|
|
130
|
-
const [internalVisibilityState, setInternalVisibilityState] =
|
|
131
|
-
React.useState<VisibilityState>({});
|
|
132
|
-
|
|
133
|
-
const effectiveSortingState = sortingState ?? internalSortingState;
|
|
134
|
-
const effectiveFiltersState = columnFiltersState ?? internalFiltersState;
|
|
135
|
-
const effectiveVisibilityState =
|
|
136
|
-
columnVisibilityState ?? internalVisibilityState;
|
|
137
|
-
const effectivePaginationState = paginationState ?? internalPaginationState;
|
|
138
|
-
|
|
139
|
-
const isPaginationEnabled = pagination;
|
|
140
|
-
const isManualPaginationEnabled =
|
|
141
|
-
paginationState !== undefined && onPaginationChange !== undefined;
|
|
142
|
-
const isSortingEnabled = sorting;
|
|
143
|
-
const isColumnFiltersEnabled = columnFilters;
|
|
144
|
-
const isColumnVisibilityEnabled = columnVisibility;
|
|
145
|
-
|
|
146
|
-
// Build selection-aware columns by injecting a selection column at the start
|
|
147
|
-
const selectionColumn = React.useMemo<ColumnDef<TData, unknown>>(
|
|
148
|
-
() => ({
|
|
149
|
-
id: '__select',
|
|
150
|
-
header: ({ table }) => (
|
|
151
|
-
<Checkbox
|
|
152
|
-
checked={
|
|
153
|
-
table.getIsAllPageRowsSelected() ||
|
|
154
|
-
(table.getIsSomePageRowsSelected() && 'indeterminate')
|
|
155
|
-
}
|
|
156
|
-
onCheckedChange={(val) => table.toggleAllPageRowsSelected(!!val)}
|
|
157
|
-
aria-label="Select all"
|
|
158
|
-
/>
|
|
159
|
-
),
|
|
160
|
-
cell: ({ row }) => (
|
|
161
|
-
<Checkbox
|
|
162
|
-
checked={row.getIsSelected()}
|
|
163
|
-
onCheckedChange={(val) => row.toggleSelected(!!val)}
|
|
164
|
-
aria-label="Select row"
|
|
165
|
-
onClick={(e) => e.stopPropagation()}
|
|
166
|
-
/>
|
|
167
|
-
),
|
|
168
|
-
enableSorting: false,
|
|
169
|
-
enableHiding: false,
|
|
170
|
-
size: 32,
|
|
171
|
-
minSize: 32,
|
|
172
|
-
maxSize: 32,
|
|
173
|
-
}),
|
|
174
|
-
[],
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
const renderedColumns = React.useMemo(
|
|
178
|
-
() =>
|
|
179
|
-
selectable
|
|
180
|
-
? [selectionColumn as unknown as ColumnDef<TData, TValue>, ...columns]
|
|
181
|
-
: columns,
|
|
182
|
-
[selectable, selectionColumn, columns],
|
|
183
|
-
);
|
|
184
|
-
|
|
185
|
-
const table = useReactTable({
|
|
186
|
-
data,
|
|
187
|
-
columns: renderedColumns,
|
|
188
|
-
initialState: {
|
|
189
|
-
pagination: effectivePaginationState,
|
|
190
|
-
},
|
|
191
|
-
rowCount,
|
|
192
|
-
state: {
|
|
193
|
-
sorting: effectiveSortingState,
|
|
194
|
-
columnFilters: effectiveFiltersState,
|
|
195
|
-
pagination: effectivePaginationState,
|
|
196
|
-
columnVisibility: effectiveVisibilityState,
|
|
197
|
-
...(selectable ? { rowSelection } : {}),
|
|
198
|
-
},
|
|
199
|
-
enableRowSelection: !!selectable,
|
|
200
|
-
onRowSelectionChange: selectable ? setRowSelection : undefined,
|
|
201
|
-
manualPagination: isManualPaginationEnabled,
|
|
202
|
-
enableSorting: isSortingEnabled,
|
|
203
|
-
enableColumnFilters: isColumnFiltersEnabled,
|
|
204
|
-
onSortingChange: isSortingEnabled
|
|
205
|
-
? (updater) => {
|
|
206
|
-
const next =
|
|
207
|
-
typeof updater === 'function'
|
|
208
|
-
? (updater as (old: SortingState) => SortingState)(
|
|
209
|
-
effectiveSortingState,
|
|
210
|
-
)
|
|
211
|
-
: updater;
|
|
212
|
-
setInternalSortingState(next);
|
|
213
|
-
onSortingChange?.(next);
|
|
214
|
-
}
|
|
215
|
-
: undefined,
|
|
216
|
-
onColumnFiltersChange: isColumnFiltersEnabled
|
|
217
|
-
? (updater) => {
|
|
218
|
-
const next =
|
|
219
|
-
typeof updater === 'function'
|
|
220
|
-
? (updater as (old: ColumnFiltersState) => ColumnFiltersState)(
|
|
221
|
-
effectiveFiltersState,
|
|
222
|
-
)
|
|
223
|
-
: updater;
|
|
224
|
-
setInternalFiltersState(next);
|
|
225
|
-
onColumnFiltersChange?.(next);
|
|
226
|
-
}
|
|
227
|
-
: undefined,
|
|
228
|
-
onPaginationChange: isPaginationEnabled
|
|
229
|
-
? (updater) => {
|
|
230
|
-
const next =
|
|
231
|
-
typeof updater === 'function'
|
|
232
|
-
? (updater as (old: PaginationState) => PaginationState)(
|
|
233
|
-
effectivePaginationState,
|
|
234
|
-
)
|
|
235
|
-
: updater;
|
|
236
|
-
setInternalPaginationState(next);
|
|
237
|
-
onPaginationChange?.(next);
|
|
238
|
-
}
|
|
239
|
-
: undefined,
|
|
240
|
-
onColumnVisibilityChange: (updater) => {
|
|
241
|
-
const next =
|
|
242
|
-
typeof updater === 'function'
|
|
243
|
-
? (updater as (old: VisibilityState) => VisibilityState)(
|
|
244
|
-
effectiveVisibilityState,
|
|
245
|
-
)
|
|
246
|
-
: updater;
|
|
247
|
-
setInternalVisibilityState(next);
|
|
248
|
-
onColumnVisibilityChange?.(next);
|
|
249
|
-
},
|
|
250
|
-
getCoreRowModel: getCoreRowModel(),
|
|
251
|
-
getSortedRowModel: getSortedRowModel(),
|
|
252
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
253
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
// Notify parent of table instance
|
|
257
|
-
React.useEffect(() => {
|
|
258
|
-
if (onTable) onTable(table);
|
|
259
|
-
}, [onTable, table]);
|
|
260
|
-
|
|
261
|
-
// Selected rows convenience
|
|
262
|
-
const selectedRows = table
|
|
263
|
-
.getSelectedRowModel()
|
|
264
|
-
.rows.map((r) => r.original as TData);
|
|
265
|
-
|
|
266
|
-
// Safe action arrays to avoid array literal defaults in props
|
|
267
|
-
const safeActions = React.useMemo(() => actions ?? [], [actions]);
|
|
268
|
-
const safeBatchActions = React.useMemo(
|
|
269
|
-
() => batchActions ?? [],
|
|
270
|
-
[batchActions],
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
// Skeleton row keys (avoid using array index as key)
|
|
274
|
-
const skeletonRowKeys = React.useMemo(
|
|
275
|
-
() =>
|
|
276
|
-
Array.from(
|
|
277
|
-
{ length: Math.max(3, effectivePaginationState.pageSize ?? 10) },
|
|
278
|
-
() => Math.random().toString(36).slice(2),
|
|
279
|
-
),
|
|
280
|
-
[effectivePaginationState.pageSize],
|
|
281
|
-
);
|
|
282
|
-
|
|
283
|
-
// Standard actions state
|
|
284
|
-
const handleRefresh = React.useCallback(async () => {
|
|
285
|
-
if (!onRefresh) return;
|
|
286
|
-
await onRefresh();
|
|
287
|
-
}, [onRefresh]);
|
|
288
|
-
|
|
289
|
-
// Render a button from action definition
|
|
290
|
-
const renderActionButton = (action: DataTableAction, key: React.Key) => {
|
|
291
|
-
if (action.element)
|
|
292
|
-
return <React.Fragment key={key}>{action.element}</React.Fragment>;
|
|
293
|
-
const content = (
|
|
294
|
-
<div className="flex items-center gap-x-2">
|
|
295
|
-
{action.icon && (
|
|
296
|
-
<span
|
|
297
|
-
className={cn(action.iconPosition === 'right' ? 'order-last' : '')}
|
|
298
|
-
>
|
|
299
|
-
{action.icon}
|
|
300
|
-
</span>
|
|
301
|
-
)}
|
|
302
|
-
{action.label}
|
|
303
|
-
</div>
|
|
304
|
-
);
|
|
305
|
-
return (
|
|
306
|
-
<Button
|
|
307
|
-
key={key}
|
|
308
|
-
size="sm"
|
|
309
|
-
variant={action.variant ?? 'default'}
|
|
310
|
-
disabled={action.disabled}
|
|
311
|
-
onClick={action.onClick}
|
|
312
|
-
className="h-8"
|
|
313
|
-
>
|
|
314
|
-
{content}
|
|
315
|
-
</Button>
|
|
316
|
-
);
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
const renderBatchButton = (
|
|
320
|
-
action: DataTableBatchAction<TData>,
|
|
321
|
-
key: React.Key,
|
|
322
|
-
) => {
|
|
323
|
-
if (action.element)
|
|
324
|
-
return <React.Fragment key={key}>{action.element}</React.Fragment>;
|
|
325
|
-
const onClick = () =>
|
|
326
|
-
action.onClick?.({
|
|
327
|
-
selectedRows,
|
|
328
|
-
clearSelection: () => table.resetRowSelection(),
|
|
329
|
-
});
|
|
330
|
-
const content = (
|
|
331
|
-
<div className="flex items-center gap-x-2">
|
|
332
|
-
{action.icon && (
|
|
333
|
-
<span
|
|
334
|
-
className={cn(action.iconPosition === 'right' ? 'order-last' : '')}
|
|
335
|
-
>
|
|
336
|
-
{action.icon}
|
|
337
|
-
</span>
|
|
338
|
-
)}
|
|
339
|
-
{action.label}
|
|
340
|
-
</div>
|
|
341
|
-
);
|
|
342
|
-
return (
|
|
343
|
-
<Button
|
|
344
|
-
key={key}
|
|
345
|
-
size="sm"
|
|
346
|
-
variant={action.variant ?? 'default'}
|
|
347
|
-
disabled={action.disabled}
|
|
348
|
-
onClick={onClick}
|
|
349
|
-
className="h-8"
|
|
350
|
-
>
|
|
351
|
-
{content}
|
|
352
|
-
</Button>
|
|
353
|
-
);
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
// Defaults
|
|
357
|
-
const effectiveFilterWrapper = filterWrapper ?? 'accordion';
|
|
358
|
-
const effectiveFilterTitle = filterTitle ?? 'Filters';
|
|
359
|
-
|
|
360
|
-
return (
|
|
361
|
-
<div className={cn('space-y-3', className)}>
|
|
362
|
-
{formFilters?.length ? (
|
|
363
|
-
effectiveFilterWrapper === 'accordion' ? (
|
|
364
|
-
<div className="rounded-md border border-border">
|
|
365
|
-
<Accordion
|
|
366
|
-
type="single"
|
|
367
|
-
collapsible
|
|
368
|
-
className="w-full"
|
|
369
|
-
defaultValue="filters"
|
|
370
|
-
>
|
|
371
|
-
<AccordionItem value="filters">
|
|
372
|
-
<AccordionTrigger className="px-4 py-3 border-b border-border text-md">
|
|
373
|
-
{effectiveFilterTitle}
|
|
374
|
-
</AccordionTrigger>
|
|
375
|
-
<AccordionContent className="px-4 pb-4 pt-5">
|
|
376
|
-
<FormBuilder
|
|
377
|
-
key={JSON.stringify(formFilterValues ?? {})}
|
|
378
|
-
sections={formFilters as FormBuilderSectionConfig[]}
|
|
379
|
-
defaultValues={formFilterValues}
|
|
380
|
-
onSubmit={(data) =>
|
|
381
|
-
onFormFilterChange?.(data as Record<string, unknown>)
|
|
382
|
-
}
|
|
383
|
-
onReset={() => onFormFilterChange?.({})}
|
|
384
|
-
showActions
|
|
385
|
-
submitLabel="Apply"
|
|
386
|
-
resetLabel="Clear"
|
|
387
|
-
showActionsSeparator={filterShowActionsSeparator}
|
|
388
|
-
/>
|
|
389
|
-
</AccordionContent>
|
|
390
|
-
</AccordionItem>
|
|
391
|
-
</Accordion>
|
|
392
|
-
</div>
|
|
393
|
-
) : effectiveFilterWrapper === 'card' ? (
|
|
394
|
-
<div className="rounded-md border border-border p-4">
|
|
395
|
-
<FormBuilder
|
|
396
|
-
key={JSON.stringify(formFilterValues ?? {})}
|
|
397
|
-
sections={formFilters as FormBuilderSectionConfig[]}
|
|
398
|
-
defaultValues={formFilterValues}
|
|
399
|
-
onSubmit={(data) =>
|
|
400
|
-
onFormFilterChange?.(data as Record<string, unknown>)
|
|
401
|
-
}
|
|
402
|
-
onReset={() => onFormFilterChange?.({})}
|
|
403
|
-
showActions
|
|
404
|
-
submitLabel="Apply"
|
|
405
|
-
resetLabel="Clear"
|
|
406
|
-
showActionsSeparator={filterShowActionsSeparator}
|
|
407
|
-
/>
|
|
408
|
-
</div>
|
|
409
|
-
) : (
|
|
410
|
-
<FormBuilder
|
|
411
|
-
key={JSON.stringify(formFilterValues ?? {})}
|
|
412
|
-
sections={formFilters as FormBuilderSectionConfig[]}
|
|
413
|
-
defaultValues={formFilterValues}
|
|
414
|
-
onSubmit={(data) =>
|
|
415
|
-
onFormFilterChange?.(data as Record<string, unknown>)
|
|
416
|
-
}
|
|
417
|
-
onReset={() => onFormFilterChange?.({})}
|
|
418
|
-
showActions
|
|
419
|
-
submitLabel="Apply"
|
|
420
|
-
resetLabel="Clear"
|
|
421
|
-
showActionsSeparator={filterShowActionsSeparator}
|
|
422
|
-
/>
|
|
423
|
-
)
|
|
424
|
-
) : null}
|
|
425
|
-
{/* Actions Bar */}
|
|
426
|
-
{(safeActions.length ||
|
|
427
|
-
showStandardActions ||
|
|
428
|
-
(selectable &&
|
|
429
|
-
table.getSelectedRowModel().rows.length > 0 &&
|
|
430
|
-
safeBatchActions.length)) && (
|
|
431
|
-
<div className="rounded-md p-2 mt-6">
|
|
432
|
-
<div className="flex items-center justify-between">
|
|
433
|
-
<div className="flex items-center gap-2">
|
|
434
|
-
{selectable &&
|
|
435
|
-
table.getSelectedRowModel().rows.length > 0 &&
|
|
436
|
-
safeBatchActions.map((a) => renderBatchButton(a, a.key))}
|
|
437
|
-
</div>
|
|
438
|
-
<div className="flex items-center gap-2">
|
|
439
|
-
{showStandardActions && onRefresh && (
|
|
440
|
-
<Button
|
|
441
|
-
variant="outline"
|
|
442
|
-
size="sm"
|
|
443
|
-
onClick={handleRefresh}
|
|
444
|
-
disabled={loading}
|
|
445
|
-
className="h-8"
|
|
446
|
-
title="Refresh"
|
|
447
|
-
>
|
|
448
|
-
<RefreshCw
|
|
449
|
-
className={cn('h-4 w-4', loading && 'animate-spin')}
|
|
450
|
-
/>{' '}
|
|
451
|
-
Refresh
|
|
452
|
-
</Button>
|
|
453
|
-
)}
|
|
454
|
-
{isColumnVisibilityEnabled ? (
|
|
455
|
-
<DataTableViewOptions table={table} />
|
|
456
|
-
) : null}
|
|
457
|
-
{safeActions.map((a) => renderActionButton(a, a.key))}
|
|
458
|
-
</div>
|
|
459
|
-
</div>
|
|
460
|
-
</div>
|
|
461
|
-
)}
|
|
462
|
-
<div
|
|
463
|
-
className="relative overflow-hidden rounded-md border border-border"
|
|
464
|
-
aria-busy={loading || undefined}
|
|
465
|
-
>
|
|
466
|
-
{loading && (
|
|
467
|
-
<div className="pointer-events-none absolute inset-0 z-10 flex items-start justify-end p-2">
|
|
468
|
-
<span className="inline-flex items-center gap-2 rounded bg-background/80 px-2 py-1 text-xs shadow-sm ring-1 ring-border">
|
|
469
|
-
<Loader2 className="h-3.5 w-3.5 animate-spin" /> Loading...
|
|
470
|
-
</span>
|
|
471
|
-
</div>
|
|
472
|
-
)}
|
|
473
|
-
<Table>
|
|
474
|
-
<TableHeader>
|
|
475
|
-
{table.getHeaderGroups().map((headerGroup) => (
|
|
476
|
-
<TableRow key={headerGroup.id}>
|
|
477
|
-
{headerGroup.headers.map((header) => (
|
|
478
|
-
<TableHead key={header.id}>
|
|
479
|
-
{header.isPlaceholder
|
|
480
|
-
? null
|
|
481
|
-
: flexRender(
|
|
482
|
-
header.column.columnDef.header,
|
|
483
|
-
header.getContext(),
|
|
484
|
-
)}
|
|
485
|
-
</TableHead>
|
|
486
|
-
))}
|
|
487
|
-
</TableRow>
|
|
488
|
-
))}
|
|
489
|
-
</TableHeader>
|
|
490
|
-
<TableBody>
|
|
491
|
-
{loading ? (
|
|
492
|
-
skeletonRowKeys.map((rowKey) => (
|
|
493
|
-
<TableRow key={`skeleton-${rowKey}`}>
|
|
494
|
-
{table.getVisibleLeafColumns().map((col) => (
|
|
495
|
-
<TableCell key={`skeleton-cell-${rowKey}-${col.id}`}>
|
|
496
|
-
<Skeleton className="h-4 w-full" />
|
|
497
|
-
</TableCell>
|
|
498
|
-
))}
|
|
499
|
-
</TableRow>
|
|
500
|
-
))
|
|
501
|
-
) : table.getRowModel().rows?.length ? (
|
|
502
|
-
table.getRowModel().rows.map((row) => (
|
|
503
|
-
<TableRow
|
|
504
|
-
key={row.id}
|
|
505
|
-
data-state={row.getIsSelected() && 'selected'}
|
|
506
|
-
className={cn(
|
|
507
|
-
onRowClick && 'cursor-pointer hover:bg-muted/50',
|
|
508
|
-
)}
|
|
509
|
-
onClick={
|
|
510
|
-
onRowClick
|
|
511
|
-
? () => onRowClick(row.original as TData)
|
|
512
|
-
: undefined
|
|
513
|
-
}
|
|
514
|
-
>
|
|
515
|
-
{row.getVisibleCells().map((cell) => (
|
|
516
|
-
<TableCell key={cell.id}>
|
|
517
|
-
{flexRender(
|
|
518
|
-
cell.column.columnDef.cell,
|
|
519
|
-
cell.getContext(),
|
|
520
|
-
)}
|
|
521
|
-
</TableCell>
|
|
522
|
-
))}
|
|
523
|
-
</TableRow>
|
|
524
|
-
))
|
|
525
|
-
) : (
|
|
526
|
-
<TableRow>
|
|
527
|
-
<TableCell
|
|
528
|
-
colSpan={table.getVisibleLeafColumns().length}
|
|
529
|
-
className="h-24 text-center"
|
|
530
|
-
>
|
|
531
|
-
{emptyText}
|
|
532
|
-
</TableCell>
|
|
533
|
-
</TableRow>
|
|
534
|
-
)}
|
|
535
|
-
</TableBody>
|
|
536
|
-
</Table>
|
|
537
|
-
</div>
|
|
538
|
-
|
|
539
|
-
{isPaginationEnabled && (
|
|
540
|
-
<DataTablePagination
|
|
541
|
-
table={table}
|
|
542
|
-
paginationVariant={paginationVariant}
|
|
543
|
-
/>
|
|
544
|
-
)}
|
|
545
|
-
</div>
|
|
546
|
-
);
|
|
547
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
flexRender,
|
|
3
|
+
getCoreRowModel,
|
|
4
|
+
getFilteredRowModel,
|
|
5
|
+
getPaginationRowModel,
|
|
6
|
+
getSortedRowModel,
|
|
7
|
+
useReactTable,
|
|
8
|
+
type ColumnDef,
|
|
9
|
+
type ColumnFiltersState,
|
|
10
|
+
type PaginationState,
|
|
11
|
+
type Table as ReactTable,
|
|
12
|
+
type SortingState,
|
|
13
|
+
type VisibilityState,
|
|
14
|
+
} from '@tanstack/react-table';
|
|
15
|
+
import { Loader2, RefreshCw } from 'lucide-react';
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
import { cn } from '../../../../shadcn/lib/utils';
|
|
18
|
+
import {
|
|
19
|
+
Accordion,
|
|
20
|
+
AccordionContent,
|
|
21
|
+
AccordionItem,
|
|
22
|
+
AccordionTrigger,
|
|
23
|
+
} from '../../../../shadcn/ui/accordion';
|
|
24
|
+
import { Button } from '../../../../shadcn/ui/button';
|
|
25
|
+
import { Checkbox } from '../../../../shadcn/ui/checkbox';
|
|
26
|
+
import { Skeleton } from '../../../../shadcn/ui/skeleton';
|
|
27
|
+
import {
|
|
28
|
+
Table,
|
|
29
|
+
TableBody,
|
|
30
|
+
TableCell,
|
|
31
|
+
TableHead,
|
|
32
|
+
TableHeader,
|
|
33
|
+
TableRow,
|
|
34
|
+
} from '../../../../shadcn/ui/table';
|
|
35
|
+
import { FormBuilder, type FormBuilderSectionConfig } from '../../form';
|
|
36
|
+
import type {
|
|
37
|
+
DataTableAction,
|
|
38
|
+
DataTableBatchAction,
|
|
39
|
+
DataTableFiltersProp,
|
|
40
|
+
} from '../types';
|
|
41
|
+
import { DataTablePagination } from './DataTablePagination';
|
|
42
|
+
import { DataTableViewOptions } from './DataTableViewOptions';
|
|
43
|
+
|
|
44
|
+
export interface DataTableProps<TData, TValue> {
|
|
45
|
+
columns: ColumnDef<TData, TValue>[];
|
|
46
|
+
data: TData[];
|
|
47
|
+
// Optional controlled states
|
|
48
|
+
loading: boolean;
|
|
49
|
+
sorting?: boolean;
|
|
50
|
+
sortingState?: SortingState;
|
|
51
|
+
onSortingChange?: (newState: SortingState) => void;
|
|
52
|
+
columnFilters?: boolean;
|
|
53
|
+
columnFiltersState?: ColumnFiltersState;
|
|
54
|
+
onColumnFiltersChange?: (newState: ColumnFiltersState) => void;
|
|
55
|
+
rowCount?: number;
|
|
56
|
+
pagination?: boolean;
|
|
57
|
+
paginationState?: PaginationState;
|
|
58
|
+
paginationVariant?: 'full' | 'compact';
|
|
59
|
+
onPaginationChange?: (newState: PaginationState) => void;
|
|
60
|
+
columnVisibility?: boolean;
|
|
61
|
+
columnVisibilityState?: VisibilityState;
|
|
62
|
+
onColumnVisibilityChange?: (newState: VisibilityState) => void;
|
|
63
|
+
// Expose table instance
|
|
64
|
+
onTable?: (table: ReactTable<TData>) => void;
|
|
65
|
+
// UI
|
|
66
|
+
className?: string;
|
|
67
|
+
emptyText?: string;
|
|
68
|
+
// Filters UI (section-based or simple)
|
|
69
|
+
formFilters?: DataTableFiltersProp;
|
|
70
|
+
formFilterValues?: Record<string, unknown> | null;
|
|
71
|
+
onFormFilterChange?: (values: Record<string, unknown>) => void;
|
|
72
|
+
// Selection & Actions
|
|
73
|
+
selectable?: boolean;
|
|
74
|
+
actions?: DataTableAction[];
|
|
75
|
+
batchActions?: DataTableBatchAction<TData>[];
|
|
76
|
+
// Standard actions
|
|
77
|
+
showStandardActions?: boolean;
|
|
78
|
+
onRefresh?: () => void | Promise<void>;
|
|
79
|
+
// Row interactions
|
|
80
|
+
onRowClick?: (row: TData) => void;
|
|
81
|
+
// Filters wrapper options
|
|
82
|
+
filterWrapper?: 'accordion' | 'card' | 'none';
|
|
83
|
+
filterTitle?: string;
|
|
84
|
+
filterShowActionsSeparator?: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function DataTable<TData, TValue>({
|
|
88
|
+
columns,
|
|
89
|
+
data,
|
|
90
|
+
loading,
|
|
91
|
+
sorting,
|
|
92
|
+
sortingState,
|
|
93
|
+
onSortingChange,
|
|
94
|
+
columnFilters,
|
|
95
|
+
columnFiltersState,
|
|
96
|
+
onColumnFiltersChange,
|
|
97
|
+
rowCount,
|
|
98
|
+
pagination,
|
|
99
|
+
paginationVariant = 'full',
|
|
100
|
+
onPaginationChange,
|
|
101
|
+
paginationState,
|
|
102
|
+
columnVisibility,
|
|
103
|
+
columnVisibilityState,
|
|
104
|
+
onColumnVisibilityChange,
|
|
105
|
+
onTable,
|
|
106
|
+
className,
|
|
107
|
+
emptyText = 'No results.',
|
|
108
|
+
formFilters,
|
|
109
|
+
formFilterValues,
|
|
110
|
+
onFormFilterChange,
|
|
111
|
+
selectable,
|
|
112
|
+
actions,
|
|
113
|
+
batchActions,
|
|
114
|
+
showStandardActions,
|
|
115
|
+
onRefresh,
|
|
116
|
+
onRowClick,
|
|
117
|
+
filterWrapper,
|
|
118
|
+
filterTitle,
|
|
119
|
+
filterShowActionsSeparator,
|
|
120
|
+
}: DataTableProps<TData, TValue>) {
|
|
121
|
+
const [rowSelection, setRowSelection] = React.useState<
|
|
122
|
+
Record<string, boolean>
|
|
123
|
+
>({});
|
|
124
|
+
const [internalSortingState, setInternalSortingState] =
|
|
125
|
+
React.useState<SortingState>([]);
|
|
126
|
+
const [internalFiltersState, setInternalFiltersState] =
|
|
127
|
+
React.useState<ColumnFiltersState>([]);
|
|
128
|
+
const [internalPaginationState, setInternalPaginationState] =
|
|
129
|
+
React.useState<PaginationState>({ pageIndex: 0, pageSize: 10 });
|
|
130
|
+
const [internalVisibilityState, setInternalVisibilityState] =
|
|
131
|
+
React.useState<VisibilityState>({});
|
|
132
|
+
|
|
133
|
+
const effectiveSortingState = sortingState ?? internalSortingState;
|
|
134
|
+
const effectiveFiltersState = columnFiltersState ?? internalFiltersState;
|
|
135
|
+
const effectiveVisibilityState =
|
|
136
|
+
columnVisibilityState ?? internalVisibilityState;
|
|
137
|
+
const effectivePaginationState = paginationState ?? internalPaginationState;
|
|
138
|
+
|
|
139
|
+
const isPaginationEnabled = pagination;
|
|
140
|
+
const isManualPaginationEnabled =
|
|
141
|
+
paginationState !== undefined && onPaginationChange !== undefined;
|
|
142
|
+
const isSortingEnabled = sorting;
|
|
143
|
+
const isColumnFiltersEnabled = columnFilters;
|
|
144
|
+
const isColumnVisibilityEnabled = columnVisibility;
|
|
145
|
+
|
|
146
|
+
// Build selection-aware columns by injecting a selection column at the start
|
|
147
|
+
const selectionColumn = React.useMemo<ColumnDef<TData, unknown>>(
|
|
148
|
+
() => ({
|
|
149
|
+
id: '__select',
|
|
150
|
+
header: ({ table }) => (
|
|
151
|
+
<Checkbox
|
|
152
|
+
checked={
|
|
153
|
+
table.getIsAllPageRowsSelected() ||
|
|
154
|
+
(table.getIsSomePageRowsSelected() && 'indeterminate')
|
|
155
|
+
}
|
|
156
|
+
onCheckedChange={(val) => table.toggleAllPageRowsSelected(!!val)}
|
|
157
|
+
aria-label="Select all"
|
|
158
|
+
/>
|
|
159
|
+
),
|
|
160
|
+
cell: ({ row }) => (
|
|
161
|
+
<Checkbox
|
|
162
|
+
checked={row.getIsSelected()}
|
|
163
|
+
onCheckedChange={(val) => row.toggleSelected(!!val)}
|
|
164
|
+
aria-label="Select row"
|
|
165
|
+
onClick={(e) => e.stopPropagation()}
|
|
166
|
+
/>
|
|
167
|
+
),
|
|
168
|
+
enableSorting: false,
|
|
169
|
+
enableHiding: false,
|
|
170
|
+
size: 32,
|
|
171
|
+
minSize: 32,
|
|
172
|
+
maxSize: 32,
|
|
173
|
+
}),
|
|
174
|
+
[],
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const renderedColumns = React.useMemo(
|
|
178
|
+
() =>
|
|
179
|
+
selectable
|
|
180
|
+
? [selectionColumn as unknown as ColumnDef<TData, TValue>, ...columns]
|
|
181
|
+
: columns,
|
|
182
|
+
[selectable, selectionColumn, columns],
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
const table = useReactTable({
|
|
186
|
+
data,
|
|
187
|
+
columns: renderedColumns,
|
|
188
|
+
initialState: {
|
|
189
|
+
pagination: effectivePaginationState,
|
|
190
|
+
},
|
|
191
|
+
rowCount,
|
|
192
|
+
state: {
|
|
193
|
+
sorting: effectiveSortingState,
|
|
194
|
+
columnFilters: effectiveFiltersState,
|
|
195
|
+
pagination: effectivePaginationState,
|
|
196
|
+
columnVisibility: effectiveVisibilityState,
|
|
197
|
+
...(selectable ? { rowSelection } : {}),
|
|
198
|
+
},
|
|
199
|
+
enableRowSelection: !!selectable,
|
|
200
|
+
onRowSelectionChange: selectable ? setRowSelection : undefined,
|
|
201
|
+
manualPagination: isManualPaginationEnabled,
|
|
202
|
+
enableSorting: isSortingEnabled,
|
|
203
|
+
enableColumnFilters: isColumnFiltersEnabled,
|
|
204
|
+
onSortingChange: isSortingEnabled
|
|
205
|
+
? (updater) => {
|
|
206
|
+
const next =
|
|
207
|
+
typeof updater === 'function'
|
|
208
|
+
? (updater as (old: SortingState) => SortingState)(
|
|
209
|
+
effectiveSortingState,
|
|
210
|
+
)
|
|
211
|
+
: updater;
|
|
212
|
+
setInternalSortingState(next);
|
|
213
|
+
onSortingChange?.(next);
|
|
214
|
+
}
|
|
215
|
+
: undefined,
|
|
216
|
+
onColumnFiltersChange: isColumnFiltersEnabled
|
|
217
|
+
? (updater) => {
|
|
218
|
+
const next =
|
|
219
|
+
typeof updater === 'function'
|
|
220
|
+
? (updater as (old: ColumnFiltersState) => ColumnFiltersState)(
|
|
221
|
+
effectiveFiltersState,
|
|
222
|
+
)
|
|
223
|
+
: updater;
|
|
224
|
+
setInternalFiltersState(next);
|
|
225
|
+
onColumnFiltersChange?.(next);
|
|
226
|
+
}
|
|
227
|
+
: undefined,
|
|
228
|
+
onPaginationChange: isPaginationEnabled
|
|
229
|
+
? (updater) => {
|
|
230
|
+
const next =
|
|
231
|
+
typeof updater === 'function'
|
|
232
|
+
? (updater as (old: PaginationState) => PaginationState)(
|
|
233
|
+
effectivePaginationState,
|
|
234
|
+
)
|
|
235
|
+
: updater;
|
|
236
|
+
setInternalPaginationState(next);
|
|
237
|
+
onPaginationChange?.(next);
|
|
238
|
+
}
|
|
239
|
+
: undefined,
|
|
240
|
+
onColumnVisibilityChange: (updater) => {
|
|
241
|
+
const next =
|
|
242
|
+
typeof updater === 'function'
|
|
243
|
+
? (updater as (old: VisibilityState) => VisibilityState)(
|
|
244
|
+
effectiveVisibilityState,
|
|
245
|
+
)
|
|
246
|
+
: updater;
|
|
247
|
+
setInternalVisibilityState(next);
|
|
248
|
+
onColumnVisibilityChange?.(next);
|
|
249
|
+
},
|
|
250
|
+
getCoreRowModel: getCoreRowModel(),
|
|
251
|
+
getSortedRowModel: getSortedRowModel(),
|
|
252
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
253
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// Notify parent of table instance
|
|
257
|
+
React.useEffect(() => {
|
|
258
|
+
if (onTable) onTable(table);
|
|
259
|
+
}, [onTable, table]);
|
|
260
|
+
|
|
261
|
+
// Selected rows convenience
|
|
262
|
+
const selectedRows = table
|
|
263
|
+
.getSelectedRowModel()
|
|
264
|
+
.rows.map((r) => r.original as TData);
|
|
265
|
+
|
|
266
|
+
// Safe action arrays to avoid array literal defaults in props
|
|
267
|
+
const safeActions = React.useMemo(() => actions ?? [], [actions]);
|
|
268
|
+
const safeBatchActions = React.useMemo(
|
|
269
|
+
() => batchActions ?? [],
|
|
270
|
+
[batchActions],
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
// Skeleton row keys (avoid using array index as key)
|
|
274
|
+
const skeletonRowKeys = React.useMemo(
|
|
275
|
+
() =>
|
|
276
|
+
Array.from(
|
|
277
|
+
{ length: Math.max(3, effectivePaginationState.pageSize ?? 10) },
|
|
278
|
+
() => Math.random().toString(36).slice(2),
|
|
279
|
+
),
|
|
280
|
+
[effectivePaginationState.pageSize],
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
// Standard actions state
|
|
284
|
+
const handleRefresh = React.useCallback(async () => {
|
|
285
|
+
if (!onRefresh) return;
|
|
286
|
+
await onRefresh();
|
|
287
|
+
}, [onRefresh]);
|
|
288
|
+
|
|
289
|
+
// Render a button from action definition
|
|
290
|
+
const renderActionButton = (action: DataTableAction, key: React.Key) => {
|
|
291
|
+
if (action.element)
|
|
292
|
+
return <React.Fragment key={key}>{action.element}</React.Fragment>;
|
|
293
|
+
const content = (
|
|
294
|
+
<div className="flex items-center gap-x-2">
|
|
295
|
+
{action.icon && (
|
|
296
|
+
<span
|
|
297
|
+
className={cn(action.iconPosition === 'right' ? 'order-last' : '')}
|
|
298
|
+
>
|
|
299
|
+
{action.icon}
|
|
300
|
+
</span>
|
|
301
|
+
)}
|
|
302
|
+
{action.label}
|
|
303
|
+
</div>
|
|
304
|
+
);
|
|
305
|
+
return (
|
|
306
|
+
<Button
|
|
307
|
+
key={key}
|
|
308
|
+
size="sm"
|
|
309
|
+
variant={action.variant ?? 'default'}
|
|
310
|
+
disabled={action.disabled}
|
|
311
|
+
onClick={action.onClick}
|
|
312
|
+
className="h-8"
|
|
313
|
+
>
|
|
314
|
+
{content}
|
|
315
|
+
</Button>
|
|
316
|
+
);
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
const renderBatchButton = (
|
|
320
|
+
action: DataTableBatchAction<TData>,
|
|
321
|
+
key: React.Key,
|
|
322
|
+
) => {
|
|
323
|
+
if (action.element)
|
|
324
|
+
return <React.Fragment key={key}>{action.element}</React.Fragment>;
|
|
325
|
+
const onClick = () =>
|
|
326
|
+
action.onClick?.({
|
|
327
|
+
selectedRows,
|
|
328
|
+
clearSelection: () => table.resetRowSelection(),
|
|
329
|
+
});
|
|
330
|
+
const content = (
|
|
331
|
+
<div className="flex items-center gap-x-2">
|
|
332
|
+
{action.icon && (
|
|
333
|
+
<span
|
|
334
|
+
className={cn(action.iconPosition === 'right' ? 'order-last' : '')}
|
|
335
|
+
>
|
|
336
|
+
{action.icon}
|
|
337
|
+
</span>
|
|
338
|
+
)}
|
|
339
|
+
{action.label}
|
|
340
|
+
</div>
|
|
341
|
+
);
|
|
342
|
+
return (
|
|
343
|
+
<Button
|
|
344
|
+
key={key}
|
|
345
|
+
size="sm"
|
|
346
|
+
variant={action.variant ?? 'default'}
|
|
347
|
+
disabled={action.disabled}
|
|
348
|
+
onClick={onClick}
|
|
349
|
+
className="h-8"
|
|
350
|
+
>
|
|
351
|
+
{content}
|
|
352
|
+
</Button>
|
|
353
|
+
);
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
// Defaults
|
|
357
|
+
const effectiveFilterWrapper = filterWrapper ?? 'accordion';
|
|
358
|
+
const effectiveFilterTitle = filterTitle ?? 'Filters';
|
|
359
|
+
|
|
360
|
+
return (
|
|
361
|
+
<div className={cn('space-y-3', className)}>
|
|
362
|
+
{formFilters?.length ? (
|
|
363
|
+
effectiveFilterWrapper === 'accordion' ? (
|
|
364
|
+
<div className="rounded-md border border-border">
|
|
365
|
+
<Accordion
|
|
366
|
+
type="single"
|
|
367
|
+
collapsible
|
|
368
|
+
className="w-full"
|
|
369
|
+
defaultValue="filters"
|
|
370
|
+
>
|
|
371
|
+
<AccordionItem value="filters">
|
|
372
|
+
<AccordionTrigger className="px-4 py-3 border-b border-border text-md">
|
|
373
|
+
{effectiveFilterTitle}
|
|
374
|
+
</AccordionTrigger>
|
|
375
|
+
<AccordionContent className="px-4 pb-4 pt-5">
|
|
376
|
+
<FormBuilder
|
|
377
|
+
key={JSON.stringify(formFilterValues ?? {})}
|
|
378
|
+
sections={formFilters as FormBuilderSectionConfig[]}
|
|
379
|
+
defaultValues={formFilterValues}
|
|
380
|
+
onSubmit={(data) =>
|
|
381
|
+
onFormFilterChange?.(data as Record<string, unknown>)
|
|
382
|
+
}
|
|
383
|
+
onReset={() => onFormFilterChange?.({})}
|
|
384
|
+
showActions
|
|
385
|
+
submitLabel="Apply"
|
|
386
|
+
resetLabel="Clear"
|
|
387
|
+
showActionsSeparator={filterShowActionsSeparator}
|
|
388
|
+
/>
|
|
389
|
+
</AccordionContent>
|
|
390
|
+
</AccordionItem>
|
|
391
|
+
</Accordion>
|
|
392
|
+
</div>
|
|
393
|
+
) : effectiveFilterWrapper === 'card' ? (
|
|
394
|
+
<div className="rounded-md border border-border p-4">
|
|
395
|
+
<FormBuilder
|
|
396
|
+
key={JSON.stringify(formFilterValues ?? {})}
|
|
397
|
+
sections={formFilters as FormBuilderSectionConfig[]}
|
|
398
|
+
defaultValues={formFilterValues}
|
|
399
|
+
onSubmit={(data) =>
|
|
400
|
+
onFormFilterChange?.(data as Record<string, unknown>)
|
|
401
|
+
}
|
|
402
|
+
onReset={() => onFormFilterChange?.({})}
|
|
403
|
+
showActions
|
|
404
|
+
submitLabel="Apply"
|
|
405
|
+
resetLabel="Clear"
|
|
406
|
+
showActionsSeparator={filterShowActionsSeparator}
|
|
407
|
+
/>
|
|
408
|
+
</div>
|
|
409
|
+
) : (
|
|
410
|
+
<FormBuilder
|
|
411
|
+
key={JSON.stringify(formFilterValues ?? {})}
|
|
412
|
+
sections={formFilters as FormBuilderSectionConfig[]}
|
|
413
|
+
defaultValues={formFilterValues}
|
|
414
|
+
onSubmit={(data) =>
|
|
415
|
+
onFormFilterChange?.(data as Record<string, unknown>)
|
|
416
|
+
}
|
|
417
|
+
onReset={() => onFormFilterChange?.({})}
|
|
418
|
+
showActions
|
|
419
|
+
submitLabel="Apply"
|
|
420
|
+
resetLabel="Clear"
|
|
421
|
+
showActionsSeparator={filterShowActionsSeparator}
|
|
422
|
+
/>
|
|
423
|
+
)
|
|
424
|
+
) : null}
|
|
425
|
+
{/* Actions Bar */}
|
|
426
|
+
{(safeActions.length ||
|
|
427
|
+
showStandardActions ||
|
|
428
|
+
(selectable &&
|
|
429
|
+
table.getSelectedRowModel().rows.length > 0 &&
|
|
430
|
+
safeBatchActions.length)) && (
|
|
431
|
+
<div className="rounded-md p-2 mt-6">
|
|
432
|
+
<div className="flex items-center justify-between">
|
|
433
|
+
<div className="flex items-center gap-2">
|
|
434
|
+
{selectable &&
|
|
435
|
+
table.getSelectedRowModel().rows.length > 0 &&
|
|
436
|
+
safeBatchActions.map((a) => renderBatchButton(a, a.key))}
|
|
437
|
+
</div>
|
|
438
|
+
<div className="flex items-center gap-2">
|
|
439
|
+
{showStandardActions && onRefresh && (
|
|
440
|
+
<Button
|
|
441
|
+
variant="outline"
|
|
442
|
+
size="sm"
|
|
443
|
+
onClick={handleRefresh}
|
|
444
|
+
disabled={loading}
|
|
445
|
+
className="h-8"
|
|
446
|
+
title="Refresh"
|
|
447
|
+
>
|
|
448
|
+
<RefreshCw
|
|
449
|
+
className={cn('h-4 w-4', loading && 'animate-spin')}
|
|
450
|
+
/>{' '}
|
|
451
|
+
Refresh
|
|
452
|
+
</Button>
|
|
453
|
+
)}
|
|
454
|
+
{isColumnVisibilityEnabled ? (
|
|
455
|
+
<DataTableViewOptions table={table} />
|
|
456
|
+
) : null}
|
|
457
|
+
{safeActions.map((a) => renderActionButton(a, a.key))}
|
|
458
|
+
</div>
|
|
459
|
+
</div>
|
|
460
|
+
</div>
|
|
461
|
+
)}
|
|
462
|
+
<div
|
|
463
|
+
className="relative overflow-hidden rounded-md border border-border"
|
|
464
|
+
aria-busy={loading || undefined}
|
|
465
|
+
>
|
|
466
|
+
{loading && (
|
|
467
|
+
<div className="pointer-events-none absolute inset-0 z-10 flex items-start justify-end p-2">
|
|
468
|
+
<span className="inline-flex items-center gap-2 rounded bg-background/80 px-2 py-1 text-xs shadow-sm ring-1 ring-border">
|
|
469
|
+
<Loader2 className="h-3.5 w-3.5 animate-spin" /> Loading...
|
|
470
|
+
</span>
|
|
471
|
+
</div>
|
|
472
|
+
)}
|
|
473
|
+
<Table>
|
|
474
|
+
<TableHeader>
|
|
475
|
+
{table.getHeaderGroups().map((headerGroup) => (
|
|
476
|
+
<TableRow key={headerGroup.id}>
|
|
477
|
+
{headerGroup.headers.map((header) => (
|
|
478
|
+
<TableHead key={header.id}>
|
|
479
|
+
{header.isPlaceholder
|
|
480
|
+
? null
|
|
481
|
+
: flexRender(
|
|
482
|
+
header.column.columnDef.header,
|
|
483
|
+
header.getContext(),
|
|
484
|
+
)}
|
|
485
|
+
</TableHead>
|
|
486
|
+
))}
|
|
487
|
+
</TableRow>
|
|
488
|
+
))}
|
|
489
|
+
</TableHeader>
|
|
490
|
+
<TableBody>
|
|
491
|
+
{loading ? (
|
|
492
|
+
skeletonRowKeys.map((rowKey) => (
|
|
493
|
+
<TableRow key={`skeleton-${rowKey}`}>
|
|
494
|
+
{table.getVisibleLeafColumns().map((col) => (
|
|
495
|
+
<TableCell key={`skeleton-cell-${rowKey}-${col.id}`}>
|
|
496
|
+
<Skeleton className="h-4 w-full" />
|
|
497
|
+
</TableCell>
|
|
498
|
+
))}
|
|
499
|
+
</TableRow>
|
|
500
|
+
))
|
|
501
|
+
) : table.getRowModel().rows?.length ? (
|
|
502
|
+
table.getRowModel().rows.map((row) => (
|
|
503
|
+
<TableRow
|
|
504
|
+
key={row.id}
|
|
505
|
+
data-state={row.getIsSelected() && 'selected'}
|
|
506
|
+
className={cn(
|
|
507
|
+
onRowClick && 'cursor-pointer hover:bg-muted/50',
|
|
508
|
+
)}
|
|
509
|
+
onClick={
|
|
510
|
+
onRowClick
|
|
511
|
+
? () => onRowClick(row.original as TData)
|
|
512
|
+
: undefined
|
|
513
|
+
}
|
|
514
|
+
>
|
|
515
|
+
{row.getVisibleCells().map((cell) => (
|
|
516
|
+
<TableCell key={cell.id}>
|
|
517
|
+
{flexRender(
|
|
518
|
+
cell.column.columnDef.cell,
|
|
519
|
+
cell.getContext(),
|
|
520
|
+
)}
|
|
521
|
+
</TableCell>
|
|
522
|
+
))}
|
|
523
|
+
</TableRow>
|
|
524
|
+
))
|
|
525
|
+
) : (
|
|
526
|
+
<TableRow>
|
|
527
|
+
<TableCell
|
|
528
|
+
colSpan={table.getVisibleLeafColumns().length}
|
|
529
|
+
className="h-24 text-center"
|
|
530
|
+
>
|
|
531
|
+
{emptyText}
|
|
532
|
+
</TableCell>
|
|
533
|
+
</TableRow>
|
|
534
|
+
)}
|
|
535
|
+
</TableBody>
|
|
536
|
+
</Table>
|
|
537
|
+
</div>
|
|
538
|
+
|
|
539
|
+
{isPaginationEnabled && (
|
|
540
|
+
<DataTablePagination
|
|
541
|
+
table={table}
|
|
542
|
+
paginationVariant={paginationVariant}
|
|
543
|
+
/>
|
|
544
|
+
)}
|
|
545
|
+
</div>
|
|
546
|
+
);
|
|
547
|
+
}
|