@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,676 +1,676 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Calendar as CalendarIcon } from 'lucide-react';
|
|
5
|
-
import { cn } from '../../../shadcn/lib/utils';
|
|
6
|
-
import { Button } from '../../../shadcn/ui/button';
|
|
7
|
-
import {
|
|
8
|
-
Popover,
|
|
9
|
-
PopoverContent,
|
|
10
|
-
PopoverTrigger,
|
|
11
|
-
} from '../../../shadcn/ui/popover';
|
|
12
|
-
import { Calendar } from '../../../shadcn/ui/calendar';
|
|
13
|
-
import {
|
|
14
|
-
Select,
|
|
15
|
-
SelectContent,
|
|
16
|
-
SelectItem,
|
|
17
|
-
SelectTrigger,
|
|
18
|
-
SelectValue,
|
|
19
|
-
} from '../../../shadcn/ui/select';
|
|
20
|
-
|
|
21
|
-
export type TimePrecision = 'hour' | 'minute' | 'second';
|
|
22
|
-
|
|
23
|
-
export interface DateTimeRangeValue {
|
|
24
|
-
from?: Date | null;
|
|
25
|
-
to?: Date | null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface DateTimeRangePickerProps
|
|
29
|
-
extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
30
|
-
value?: DateTimeRangeValue | null;
|
|
31
|
-
onChange?: (range: DateTimeRangeValue | null) => void;
|
|
32
|
-
placeholder?: string;
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
minDate?: Date;
|
|
35
|
-
maxDate?: Date;
|
|
36
|
-
disabledDates?: Array<Date | { from: Date; to: Date }>;
|
|
37
|
-
numberOfMonths?: number;
|
|
38
|
-
popoverSide?: 'top' | 'right' | 'bottom' | 'left';
|
|
39
|
-
// time config
|
|
40
|
-
timePrecision?: TimePrecision; // default 'minute'
|
|
41
|
-
hourCycle?: 12 | 24; // default 24
|
|
42
|
-
minuteStep?: number; // default 5
|
|
43
|
-
secondStep?: number; // default 5
|
|
44
|
-
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
|
|
45
|
-
open?: boolean;
|
|
46
|
-
onOpenChange?: (open: boolean) => void;
|
|
47
|
-
showFooter?: boolean; // default true
|
|
48
|
-
cancelLabel?: string; // default 'Cancel'
|
|
49
|
-
applyLabel?: string; // default 'Apply'
|
|
50
|
-
clearLabel?: string; // default 'Clear'
|
|
51
|
-
contentClassName?: string; // custom classes for the inner content container
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const pad2 = (n: number) => String(n).padStart(2, '0');
|
|
55
|
-
function startOfDay(d: Date) {
|
|
56
|
-
return new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
57
|
-
}
|
|
58
|
-
function sameDay(a: Date, b: Date) {
|
|
59
|
-
return (
|
|
60
|
-
a.getFullYear() === b.getFullYear() &&
|
|
61
|
-
a.getMonth() === b.getMonth() &&
|
|
62
|
-
a.getDate() === b.getDate()
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
function isBefore(date: Date, min?: Date) {
|
|
66
|
-
return !!(min && date < startOfDay(min));
|
|
67
|
-
}
|
|
68
|
-
function isAfter(date: Date, max?: Date) {
|
|
69
|
-
return !!(max && date > startOfDay(max));
|
|
70
|
-
}
|
|
71
|
-
function inDisabled(
|
|
72
|
-
date: Date,
|
|
73
|
-
items?: Array<Date | { from: Date; to: Date }>,
|
|
74
|
-
) {
|
|
75
|
-
if (!items || items.length === 0) return false;
|
|
76
|
-
const d = startOfDay(date);
|
|
77
|
-
for (const it of items) {
|
|
78
|
-
if (it instanceof Date) {
|
|
79
|
-
if (sameDay(d, it)) return true;
|
|
80
|
-
} else if (it && 'from' in it && 'to' in it) {
|
|
81
|
-
const from = startOfDay(it.from);
|
|
82
|
-
const to = startOfDay(it.to);
|
|
83
|
-
if (d >= from && d <= to) return true;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
function rangeContainsDisabled(
|
|
89
|
-
from?: Date,
|
|
90
|
-
to?: Date,
|
|
91
|
-
items?: Array<Date | { from: Date; to: Date }>,
|
|
92
|
-
) {
|
|
93
|
-
if (!from || !to) return false;
|
|
94
|
-
if (!items || items.length === 0) return false;
|
|
95
|
-
const a = startOfDay(from);
|
|
96
|
-
const b = startOfDay(to);
|
|
97
|
-
const start = a <= b ? a : b;
|
|
98
|
-
const end = a <= b ? b : a;
|
|
99
|
-
let cur = start;
|
|
100
|
-
while (cur <= end) {
|
|
101
|
-
if (inDisabled(cur, items)) return true;
|
|
102
|
-
cur = new Date(cur.getFullYear(), cur.getMonth(), cur.getDate() + 1);
|
|
103
|
-
}
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function TimeSelectors({
|
|
108
|
-
label,
|
|
109
|
-
value,
|
|
110
|
-
onChange,
|
|
111
|
-
precision,
|
|
112
|
-
hourCycle,
|
|
113
|
-
minuteStep,
|
|
114
|
-
secondStep,
|
|
115
|
-
disabled,
|
|
116
|
-
compact,
|
|
117
|
-
}: {
|
|
118
|
-
label: string;
|
|
119
|
-
value: Date | null | undefined;
|
|
120
|
-
onChange: (val: Date | null) => void;
|
|
121
|
-
precision: TimePrecision;
|
|
122
|
-
hourCycle: 12 | 24;
|
|
123
|
-
minuteStep: number;
|
|
124
|
-
secondStep: number;
|
|
125
|
-
disabled?: boolean;
|
|
126
|
-
compact?: boolean;
|
|
127
|
-
}) {
|
|
128
|
-
const hours = React.useMemo(
|
|
129
|
-
() =>
|
|
130
|
-
hourCycle === 12
|
|
131
|
-
? Array.from({ length: 12 }, (_, i) => i + 1)
|
|
132
|
-
: Array.from({ length: 24 }, (_, i) => i),
|
|
133
|
-
[hourCycle],
|
|
134
|
-
);
|
|
135
|
-
const minutes = React.useMemo(
|
|
136
|
-
() =>
|
|
137
|
-
Array.from(
|
|
138
|
-
{ length: Math.ceil(60 / minuteStep) },
|
|
139
|
-
(_, i) => i * minuteStep,
|
|
140
|
-
),
|
|
141
|
-
[minuteStep],
|
|
142
|
-
);
|
|
143
|
-
const seconds = React.useMemo(
|
|
144
|
-
() =>
|
|
145
|
-
Array.from(
|
|
146
|
-
{ length: Math.ceil(60 / secondStep) },
|
|
147
|
-
(_, i) => i * secondStep,
|
|
148
|
-
),
|
|
149
|
-
[secondStep],
|
|
150
|
-
);
|
|
151
|
-
const selectedHour = React.useMemo(() => {
|
|
152
|
-
if (!value) return hourCycle === 12 ? 12 : 0;
|
|
153
|
-
const h = value.getHours();
|
|
154
|
-
return hourCycle === 12 ? (h % 12 === 0 ? 12 : h % 12) : h;
|
|
155
|
-
}, [value, hourCycle]);
|
|
156
|
-
const selectedMinute = value?.getMinutes() ?? 0;
|
|
157
|
-
const selectedSecond = value?.getSeconds() ?? 0;
|
|
158
|
-
const selectedPeriod: 'AM' | 'PM' =
|
|
159
|
-
value && value.getHours() >= 12 ? 'PM' : 'AM';
|
|
160
|
-
|
|
161
|
-
const setPart = (
|
|
162
|
-
part: 'hour' | 'minute' | 'second' | 'period',
|
|
163
|
-
v: number | 'AM' | 'PM',
|
|
164
|
-
) => {
|
|
165
|
-
const base = value
|
|
166
|
-
? new Date(value)
|
|
167
|
-
: (() => {
|
|
168
|
-
const n = new Date();
|
|
169
|
-
return new Date(
|
|
170
|
-
n.getFullYear(),
|
|
171
|
-
n.getMonth(),
|
|
172
|
-
n.getDate(),
|
|
173
|
-
0,
|
|
174
|
-
0,
|
|
175
|
-
0,
|
|
176
|
-
0,
|
|
177
|
-
);
|
|
178
|
-
})();
|
|
179
|
-
if (part === 'hour') {
|
|
180
|
-
let h = Number(v);
|
|
181
|
-
if (hourCycle === 12) {
|
|
182
|
-
const isPM = base.getHours() >= 12;
|
|
183
|
-
h = h % 12;
|
|
184
|
-
base.setHours(isPM ? (h === 12 ? 12 : h + 12) : h === 12 ? 0 : h);
|
|
185
|
-
} else {
|
|
186
|
-
base.setHours(h);
|
|
187
|
-
}
|
|
188
|
-
} else if (part === 'minute') {
|
|
189
|
-
base.setMinutes(Number(v));
|
|
190
|
-
} else if (part === 'second') {
|
|
191
|
-
base.setSeconds(Number(v));
|
|
192
|
-
} else if (part === 'period' && (v === 'AM' || v === 'PM')) {
|
|
193
|
-
const curH = base.getHours();
|
|
194
|
-
const isAMNow = curH < 12;
|
|
195
|
-
if (v === 'AM' && !isAMNow) base.setHours(curH - 12);
|
|
196
|
-
if (v === 'PM' && isAMNow) base.setHours(curH + 12);
|
|
197
|
-
}
|
|
198
|
-
base.setMilliseconds(0);
|
|
199
|
-
onChange(base);
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const widthClass = compact ? 'w-16' : 'w-24';
|
|
203
|
-
return (
|
|
204
|
-
<div className={compact ? '' : 'space-y-1'}>
|
|
205
|
-
{!compact && <div className="text-xs text-muted-foreground">{label}</div>}
|
|
206
|
-
<div className="flex items-end gap-2">
|
|
207
|
-
<div className={widthClass}>
|
|
208
|
-
{!compact && (
|
|
209
|
-
<div className="mb-1 block text-xs text-muted-foreground">Hour</div>
|
|
210
|
-
)}
|
|
211
|
-
<Select
|
|
212
|
-
disabled={disabled}
|
|
213
|
-
value={String(selectedHour)}
|
|
214
|
-
onValueChange={(v) => setPart('hour', Number(v))}
|
|
215
|
-
>
|
|
216
|
-
<SelectTrigger aria-label={`${label} hour`}>
|
|
217
|
-
<SelectValue />
|
|
218
|
-
</SelectTrigger>
|
|
219
|
-
<SelectContent>
|
|
220
|
-
{hours.map((h) => (
|
|
221
|
-
<SelectItem key={h} value={String(h)}>
|
|
222
|
-
{hourCycle === 12 ? h : pad2(h)}
|
|
223
|
-
</SelectItem>
|
|
224
|
-
))}
|
|
225
|
-
</SelectContent>
|
|
226
|
-
</Select>
|
|
227
|
-
</div>
|
|
228
|
-
{(precision === 'minute' || precision === 'second') && (
|
|
229
|
-
<div className={widthClass}>
|
|
230
|
-
{!compact && (
|
|
231
|
-
<div className="mb-1 block text-xs text-muted-foreground">
|
|
232
|
-
Minute
|
|
233
|
-
</div>
|
|
234
|
-
)}
|
|
235
|
-
<Select
|
|
236
|
-
disabled={disabled}
|
|
237
|
-
value={String(selectedMinute - (selectedMinute % minuteStep))}
|
|
238
|
-
onValueChange={(v) => setPart('minute', Number(v))}
|
|
239
|
-
>
|
|
240
|
-
<SelectTrigger aria-label={`${label} minute`}>
|
|
241
|
-
<SelectValue />
|
|
242
|
-
</SelectTrigger>
|
|
243
|
-
<SelectContent>
|
|
244
|
-
{minutes.map((m) => (
|
|
245
|
-
<SelectItem key={m} value={String(m)}>
|
|
246
|
-
{pad2(m)}
|
|
247
|
-
</SelectItem>
|
|
248
|
-
))}
|
|
249
|
-
</SelectContent>
|
|
250
|
-
</Select>
|
|
251
|
-
</div>
|
|
252
|
-
)}
|
|
253
|
-
{precision === 'second' && (
|
|
254
|
-
<div className={widthClass}>
|
|
255
|
-
{!compact && (
|
|
256
|
-
<div className="mb-1 block text-xs text-muted-foreground">
|
|
257
|
-
Second
|
|
258
|
-
</div>
|
|
259
|
-
)}
|
|
260
|
-
<Select
|
|
261
|
-
disabled={disabled}
|
|
262
|
-
value={String(selectedSecond - (selectedSecond % secondStep))}
|
|
263
|
-
onValueChange={(v) => setPart('second', Number(v))}
|
|
264
|
-
>
|
|
265
|
-
<SelectTrigger aria-label={`${label} second`}>
|
|
266
|
-
<SelectValue />
|
|
267
|
-
</SelectTrigger>
|
|
268
|
-
<SelectContent>
|
|
269
|
-
{seconds.map((s) => (
|
|
270
|
-
<SelectItem key={s} value={String(s)}>
|
|
271
|
-
{pad2(s)}
|
|
272
|
-
</SelectItem>
|
|
273
|
-
))}
|
|
274
|
-
</SelectContent>
|
|
275
|
-
</Select>
|
|
276
|
-
</div>
|
|
277
|
-
)}
|
|
278
|
-
{hourCycle === 12 && (
|
|
279
|
-
<div className={widthClass}>
|
|
280
|
-
{!compact && (
|
|
281
|
-
<div className="mb-1 block text-xs text-muted-foreground">
|
|
282
|
-
Period
|
|
283
|
-
</div>
|
|
284
|
-
)}
|
|
285
|
-
<Select
|
|
286
|
-
disabled={disabled}
|
|
287
|
-
value={selectedPeriod}
|
|
288
|
-
onValueChange={(v) => setPart('period', v as 'AM' | 'PM')}
|
|
289
|
-
>
|
|
290
|
-
<SelectTrigger aria-label={`${label} period`}>
|
|
291
|
-
<SelectValue />
|
|
292
|
-
</SelectTrigger>
|
|
293
|
-
<SelectContent>
|
|
294
|
-
<SelectItem value="AM">AM</SelectItem>
|
|
295
|
-
<SelectItem value="PM">PM</SelectItem>
|
|
296
|
-
</SelectContent>
|
|
297
|
-
</Select>
|
|
298
|
-
</div>
|
|
299
|
-
)}
|
|
300
|
-
</div>
|
|
301
|
-
</div>
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
export function DateTimeRangePicker({
|
|
306
|
-
value,
|
|
307
|
-
onChange,
|
|
308
|
-
placeholder = 'Pick a date & time range',
|
|
309
|
-
disabled,
|
|
310
|
-
minDate,
|
|
311
|
-
maxDate,
|
|
312
|
-
disabledDates,
|
|
313
|
-
numberOfMonths = 2,
|
|
314
|
-
popoverSide,
|
|
315
|
-
timePrecision = 'minute',
|
|
316
|
-
hourCycle = 24,
|
|
317
|
-
minuteStep = 5,
|
|
318
|
-
secondStep = 5,
|
|
319
|
-
className,
|
|
320
|
-
buttonVariant = 'outline',
|
|
321
|
-
contentClassName,
|
|
322
|
-
...props
|
|
323
|
-
}: DateTimeRangePickerProps) {
|
|
324
|
-
const [internalOpen, setInternalOpen] = React.useState(false);
|
|
325
|
-
const isOpen = typeof props.open === 'boolean' ? props.open : internalOpen;
|
|
326
|
-
const setOpen = (o: boolean) =>
|
|
327
|
-
props.onOpenChange ? props.onOpenChange(o) : setInternalOpen(o);
|
|
328
|
-
const [draft, setDraft] = React.useState<DateTimeRangeValue | null>(
|
|
329
|
-
value ?? null,
|
|
330
|
-
);
|
|
331
|
-
|
|
332
|
-
React.useEffect(() => {
|
|
333
|
-
if (isOpen) setDraft(value ?? null);
|
|
334
|
-
}, [isOpen, value]);
|
|
335
|
-
|
|
336
|
-
const fmtTime = React.useCallback(
|
|
337
|
-
(d?: Date | null) => {
|
|
338
|
-
if (!d) return '';
|
|
339
|
-
const h = d.getHours();
|
|
340
|
-
const m = d.getMinutes();
|
|
341
|
-
const s = d.getSeconds();
|
|
342
|
-
return hourCycle === 12
|
|
343
|
-
? `${h % 12 || 12}:${pad2(m)}${timePrecision === 'second' ? `:${pad2(s)}` : ''} ${h >= 12 ? 'PM' : 'AM'}`
|
|
344
|
-
: `${pad2(h)}:${pad2(m)}${timePrecision === 'second' ? `:${pad2(s)}` : ''}`;
|
|
345
|
-
},
|
|
346
|
-
[hourCycle, timePrecision],
|
|
347
|
-
);
|
|
348
|
-
|
|
349
|
-
const label = React.useMemo(() => {
|
|
350
|
-
const f = draft?.from ?? value?.from ?? null;
|
|
351
|
-
const t = draft?.to ?? value?.to ?? null;
|
|
352
|
-
if (f && t) {
|
|
353
|
-
const fd = f.toLocaleDateString(undefined, {
|
|
354
|
-
year: 'numeric',
|
|
355
|
-
month: 'short',
|
|
356
|
-
day: '2-digit',
|
|
357
|
-
});
|
|
358
|
-
const td = t.toLocaleDateString(undefined, {
|
|
359
|
-
year: 'numeric',
|
|
360
|
-
month: 'short',
|
|
361
|
-
day: '2-digit',
|
|
362
|
-
});
|
|
363
|
-
return `${fd} ${fmtTime(f)} – ${td} ${fmtTime(t)}`;
|
|
364
|
-
}
|
|
365
|
-
return placeholder;
|
|
366
|
-
}, [draft, value, placeholder, fmtTime]);
|
|
367
|
-
|
|
368
|
-
// Date inputs and parsing (DD / MM / YYYY)
|
|
369
|
-
const fmtDate = React.useCallback((d?: Date | null) => {
|
|
370
|
-
if (!d) return '';
|
|
371
|
-
const dd = String(d.getDate()).padStart(2, '0');
|
|
372
|
-
const mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
373
|
-
const yyyy = d.getFullYear();
|
|
374
|
-
return `${dd} / ${mm} / ${yyyy}`;
|
|
375
|
-
}, []);
|
|
376
|
-
const [fromInput, setFromInput] = React.useState<string>(
|
|
377
|
-
fmtDate(draft?.from ?? value?.from ?? null),
|
|
378
|
-
);
|
|
379
|
-
const [toInput, setToInput] = React.useState<string>(
|
|
380
|
-
fmtDate(draft?.to ?? value?.to ?? null),
|
|
381
|
-
);
|
|
382
|
-
React.useEffect(() => {
|
|
383
|
-
if (isOpen) {
|
|
384
|
-
setFromInput(fmtDate(value?.from ?? null));
|
|
385
|
-
setToInput(fmtDate(value?.to ?? null));
|
|
386
|
-
}
|
|
387
|
-
}, [isOpen, value, fmtDate]);
|
|
388
|
-
const maskDate = (raw: string) => {
|
|
389
|
-
const digits = raw.replace(/\D/g, '').slice(0, 8);
|
|
390
|
-
const parts: string[] = [];
|
|
391
|
-
const dd = digits.slice(0, Math.min(2, digits.length));
|
|
392
|
-
if (dd) parts.push(dd);
|
|
393
|
-
const mm =
|
|
394
|
-
digits.length > 2 ? digits.slice(2, Math.min(4, digits.length)) : '';
|
|
395
|
-
if (mm) parts.push(mm);
|
|
396
|
-
const yyyy = digits.length > 4 ? digits.slice(4) : '';
|
|
397
|
-
if (yyyy) parts.push(yyyy);
|
|
398
|
-
return parts.join(' / ');
|
|
399
|
-
};
|
|
400
|
-
const parseMasked = (masked: string): Date | undefined => {
|
|
401
|
-
const m = masked.match(/^(\d{1,2})\s*\/\s*(\d{1,2})\s*\/\s*(\d{4})$/);
|
|
402
|
-
if (!m) return undefined;
|
|
403
|
-
const dd = Number(m[1]);
|
|
404
|
-
const mm = Number(m[2]);
|
|
405
|
-
const yyyy = Number(m[3]);
|
|
406
|
-
if (mm < 1 || mm > 12) return undefined;
|
|
407
|
-
const lastDay = new Date(yyyy, mm, 0).getDate();
|
|
408
|
-
if (dd < 1 || dd > lastDay) return undefined;
|
|
409
|
-
const out = new Date(yyyy, mm - 1, dd);
|
|
410
|
-
if (
|
|
411
|
-
isBefore(out, minDate) ||
|
|
412
|
-
isAfter(out, maxDate) ||
|
|
413
|
-
inDisabled(out, disabledDates)
|
|
414
|
-
)
|
|
415
|
-
return undefined;
|
|
416
|
-
return out;
|
|
417
|
-
};
|
|
418
|
-
const fromParsed = parseMasked(fromInput);
|
|
419
|
-
const toParsed = parseMasked(toInput);
|
|
420
|
-
const mergedFrom = React.useMemo(() => {
|
|
421
|
-
if (fromParsed) {
|
|
422
|
-
const base = draft?.from ?? value?.from ?? null;
|
|
423
|
-
if (base) {
|
|
424
|
-
return new Date(
|
|
425
|
-
fromParsed.getFullYear(),
|
|
426
|
-
fromParsed.getMonth(),
|
|
427
|
-
fromParsed.getDate(),
|
|
428
|
-
base.getHours(),
|
|
429
|
-
base.getMinutes(),
|
|
430
|
-
base.getSeconds(),
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
return fromParsed;
|
|
434
|
-
}
|
|
435
|
-
return draft?.from ?? undefined;
|
|
436
|
-
}, [fromParsed, draft, value]);
|
|
437
|
-
const mergedTo = React.useMemo(() => {
|
|
438
|
-
if (toParsed) {
|
|
439
|
-
const base = draft?.to ?? value?.to ?? null;
|
|
440
|
-
if (base) {
|
|
441
|
-
return new Date(
|
|
442
|
-
toParsed.getFullYear(),
|
|
443
|
-
toParsed.getMonth(),
|
|
444
|
-
toParsed.getDate(),
|
|
445
|
-
base.getHours(),
|
|
446
|
-
base.getMinutes(),
|
|
447
|
-
base.getSeconds(),
|
|
448
|
-
);
|
|
449
|
-
}
|
|
450
|
-
return toParsed;
|
|
451
|
-
}
|
|
452
|
-
return draft?.to ?? undefined;
|
|
453
|
-
}, [toParsed, draft, value]);
|
|
454
|
-
const invalidRange =
|
|
455
|
-
!mergedFrom ||
|
|
456
|
-
!mergedTo ||
|
|
457
|
-
isBefore(mergedFrom, minDate) ||
|
|
458
|
-
isAfter(mergedTo, maxDate) ||
|
|
459
|
-
mergedFrom > mergedTo ||
|
|
460
|
-
rangeContainsDisabled(mergedFrom, mergedTo, disabledDates);
|
|
461
|
-
|
|
462
|
-
return (
|
|
463
|
-
<div className={cn('w-fit', className)} {...props}>
|
|
464
|
-
<Popover open={isOpen} onOpenChange={setOpen}>
|
|
465
|
-
<PopoverTrigger asChild>
|
|
466
|
-
<Button
|
|
467
|
-
type="button"
|
|
468
|
-
disabled={disabled}
|
|
469
|
-
variant={buttonVariant}
|
|
470
|
-
className={cn(
|
|
471
|
-
'w-[360px] justify-start text-left font-normal',
|
|
472
|
-
!value && 'text-muted-foreground',
|
|
473
|
-
)}
|
|
474
|
-
>
|
|
475
|
-
<CalendarIcon className="mr-2 h-4 w-4" />
|
|
476
|
-
{label}
|
|
477
|
-
</Button>
|
|
478
|
-
</PopoverTrigger>
|
|
479
|
-
<PopoverContent
|
|
480
|
-
className="w-auto max-w-none p-4"
|
|
481
|
-
align="start"
|
|
482
|
-
side={popoverSide ?? 'bottom'}
|
|
483
|
-
sideOffset={8}
|
|
484
|
-
>
|
|
485
|
-
<div className={cn('w-fit min-w-0', contentClassName)}>
|
|
486
|
-
{/* Header row: date inputs with inline time selectors beside each */}
|
|
487
|
-
<div className="mb-3 rounded-md border border-
|
|
488
|
-
<div className="flex flex-wrap items-end gap-3">
|
|
489
|
-
<div className="flex items-end gap-2">
|
|
490
|
-
<input
|
|
491
|
-
type="text"
|
|
492
|
-
inputMode="numeric"
|
|
493
|
-
value={fromInput}
|
|
494
|
-
onChange={(e) => setFromInput(maskDate(e.target.value))}
|
|
495
|
-
onBlur={() => {
|
|
496
|
-
const p = parseMasked(fromInput);
|
|
497
|
-
if (p) {
|
|
498
|
-
const prev = draft?.from ?? null;
|
|
499
|
-
const withTime = new Date(
|
|
500
|
-
p.getFullYear(),
|
|
501
|
-
p.getMonth(),
|
|
502
|
-
p.getDate(),
|
|
503
|
-
prev ? prev.getHours() : 0,
|
|
504
|
-
prev ? prev.getMinutes() : 0,
|
|
505
|
-
prev ? prev.getSeconds() : 0,
|
|
506
|
-
);
|
|
507
|
-
setDraft((d) => ({ ...(d ?? {}), from: withTime }));
|
|
508
|
-
}
|
|
509
|
-
}}
|
|
510
|
-
placeholder="dd/mm/yyyy"
|
|
511
|
-
className="h-9 w-40 rounded-md border bg-background px-3 text-sm shadow-xs outline-hidden"
|
|
512
|
-
/>
|
|
513
|
-
<TimeSelectors
|
|
514
|
-
label="From"
|
|
515
|
-
compact
|
|
516
|
-
value={draft?.from ?? null}
|
|
517
|
-
onChange={(d) =>
|
|
518
|
-
setDraft((prev) => ({ ...(prev ?? {}), from: d }))
|
|
519
|
-
}
|
|
520
|
-
precision={timePrecision}
|
|
521
|
-
hourCycle={hourCycle}
|
|
522
|
-
minuteStep={minuteStep}
|
|
523
|
-
secondStep={secondStep}
|
|
524
|
-
disabled={disabled}
|
|
525
|
-
/>
|
|
526
|
-
</div>
|
|
527
|
-
<span className="text-muted-foreground">–</span>
|
|
528
|
-
<div className="flex items-end gap-2">
|
|
529
|
-
<input
|
|
530
|
-
type="text"
|
|
531
|
-
inputMode="numeric"
|
|
532
|
-
value={toInput}
|
|
533
|
-
onChange={(e) => setToInput(maskDate(e.target.value))}
|
|
534
|
-
onBlur={() => {
|
|
535
|
-
const p = parseMasked(toInput);
|
|
536
|
-
if (p) {
|
|
537
|
-
const prev = draft?.to ?? null;
|
|
538
|
-
const withTime = new Date(
|
|
539
|
-
p.getFullYear(),
|
|
540
|
-
p.getMonth(),
|
|
541
|
-
p.getDate(),
|
|
542
|
-
prev ? prev.getHours() : 0,
|
|
543
|
-
prev ? prev.getMinutes() : 0,
|
|
544
|
-
prev ? prev.getSeconds() : 0,
|
|
545
|
-
);
|
|
546
|
-
setDraft((d) => ({ ...(d ?? {}), to: withTime }));
|
|
547
|
-
}
|
|
548
|
-
}}
|
|
549
|
-
placeholder="dd/mm/yyyy"
|
|
550
|
-
className="h-9 w-40 rounded-md border bg-background px-3 text-sm shadow-xs outline-hidden"
|
|
551
|
-
/>
|
|
552
|
-
<TimeSelectors
|
|
553
|
-
label="To"
|
|
554
|
-
compact
|
|
555
|
-
value={draft?.to ?? null}
|
|
556
|
-
onChange={(d) =>
|
|
557
|
-
setDraft((prev) => ({ ...(prev ?? {}), to: d }))
|
|
558
|
-
}
|
|
559
|
-
precision={timePrecision}
|
|
560
|
-
hourCycle={hourCycle}
|
|
561
|
-
minuteStep={minuteStep}
|
|
562
|
-
secondStep={secondStep}
|
|
563
|
-
disabled={disabled}
|
|
564
|
-
/>
|
|
565
|
-
</div>
|
|
566
|
-
</div>
|
|
567
|
-
</div>
|
|
568
|
-
|
|
569
|
-
{/* Calendar */}
|
|
570
|
-
<Calendar
|
|
571
|
-
mode="range"
|
|
572
|
-
numberOfMonths={numberOfMonths}
|
|
573
|
-
selected={
|
|
574
|
-
draft?.from && draft?.to
|
|
575
|
-
? { from: draft.from, to: draft.to }
|
|
576
|
-
: undefined
|
|
577
|
-
}
|
|
578
|
-
onSelect={(range) => {
|
|
579
|
-
if (disabled) return;
|
|
580
|
-
if (!range) {
|
|
581
|
-
setDraft(null);
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
const { from, to } = range as { from?: Date; to?: Date };
|
|
585
|
-
if (from && (isBefore(from, minDate) || isAfter(from, maxDate)))
|
|
586
|
-
return;
|
|
587
|
-
if (to && (isBefore(to, minDate) || isAfter(to, maxDate)))
|
|
588
|
-
return;
|
|
589
|
-
if (
|
|
590
|
-
from &&
|
|
591
|
-
to &&
|
|
592
|
-
rangeContainsDisabled(from, to, disabledDates)
|
|
593
|
-
)
|
|
594
|
-
return;
|
|
595
|
-
const prevFrom = draft?.from ?? from;
|
|
596
|
-
const prevTo = draft?.to ?? to;
|
|
597
|
-
const nextFrom = from
|
|
598
|
-
? new Date(
|
|
599
|
-
from.getFullYear(),
|
|
600
|
-
from.getMonth(),
|
|
601
|
-
from.getDate(),
|
|
602
|
-
prevFrom?.getHours?.() ?? 0,
|
|
603
|
-
prevFrom?.getMinutes?.() ?? 0,
|
|
604
|
-
prevFrom?.getSeconds?.() ?? 0,
|
|
605
|
-
)
|
|
606
|
-
: undefined;
|
|
607
|
-
const nextTo = to
|
|
608
|
-
? new Date(
|
|
609
|
-
to.getFullYear(),
|
|
610
|
-
to.getMonth(),
|
|
611
|
-
to.getDate(),
|
|
612
|
-
prevTo?.getHours?.() ?? 0,
|
|
613
|
-
prevTo?.getMinutes?.() ?? 0,
|
|
614
|
-
prevTo?.getSeconds?.() ?? 0,
|
|
615
|
-
)
|
|
616
|
-
: undefined;
|
|
617
|
-
setDraft({ from: nextFrom ?? null, to: nextTo ?? null });
|
|
618
|
-
setFromInput(fmtDate(nextFrom ?? null));
|
|
619
|
-
setToInput(fmtDate(nextTo ?? null));
|
|
620
|
-
}}
|
|
621
|
-
defaultMonth={draft?.from ?? value?.from ?? new Date()}
|
|
622
|
-
disabled={(d) =>
|
|
623
|
-
isBefore(d, minDate) ||
|
|
624
|
-
isAfter(d, maxDate) ||
|
|
625
|
-
inDisabled(d, disabledDates)
|
|
626
|
-
}
|
|
627
|
-
buttonVariant="ghost"
|
|
628
|
-
showOutsideDays
|
|
629
|
-
/>
|
|
630
|
-
</div>
|
|
631
|
-
{(props.showFooter ?? true) && (
|
|
632
|
-
<div className="flex items-center justify-between gap-2 pt-3 mt-3 border-t">
|
|
633
|
-
<Button
|
|
634
|
-
type="button"
|
|
635
|
-
variant="outline"
|
|
636
|
-
size="sm"
|
|
637
|
-
onClick={() => setOpen(false)}
|
|
638
|
-
disabled={disabled}
|
|
639
|
-
>
|
|
640
|
-
{props.cancelLabel ?? 'Cancel'}
|
|
641
|
-
</Button>
|
|
642
|
-
<div className="flex gap-2">
|
|
643
|
-
<Button
|
|
644
|
-
type="button"
|
|
645
|
-
variant="ghost"
|
|
646
|
-
size="sm"
|
|
647
|
-
onClick={() => onChange?.(null)}
|
|
648
|
-
disabled={disabled}
|
|
649
|
-
>
|
|
650
|
-
{props.clearLabel ?? 'Clear'}
|
|
651
|
-
</Button>
|
|
652
|
-
<Button
|
|
653
|
-
type="button"
|
|
654
|
-
variant="default"
|
|
655
|
-
size="sm"
|
|
656
|
-
onClick={() => {
|
|
657
|
-
if (invalidRange || !mergedFrom || !mergedTo) return;
|
|
658
|
-
onChange?.({ from: mergedFrom, to: mergedTo });
|
|
659
|
-
setOpen(false);
|
|
660
|
-
}}
|
|
661
|
-
disabled={disabled || invalidRange}
|
|
662
|
-
>
|
|
663
|
-
{props.applyLabel ?? 'Apply'}
|
|
664
|
-
</Button>
|
|
665
|
-
</div>
|
|
666
|
-
</div>
|
|
667
|
-
)}
|
|
668
|
-
</PopoverContent>
|
|
669
|
-
</Popover>
|
|
670
|
-
</div>
|
|
671
|
-
);
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
DateTimeRangePicker.displayName = 'DateTimeRangePicker';
|
|
675
|
-
|
|
676
|
-
export default DateTimeRangePicker;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Calendar as CalendarIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from '../../../shadcn/lib/utils';
|
|
6
|
+
import { Button } from '../../../shadcn/ui/button';
|
|
7
|
+
import {
|
|
8
|
+
Popover,
|
|
9
|
+
PopoverContent,
|
|
10
|
+
PopoverTrigger,
|
|
11
|
+
} from '../../../shadcn/ui/popover';
|
|
12
|
+
import { Calendar } from '../../../shadcn/ui/calendar';
|
|
13
|
+
import {
|
|
14
|
+
Select,
|
|
15
|
+
SelectContent,
|
|
16
|
+
SelectItem,
|
|
17
|
+
SelectTrigger,
|
|
18
|
+
SelectValue,
|
|
19
|
+
} from '../../../shadcn/ui/select';
|
|
20
|
+
|
|
21
|
+
export type TimePrecision = 'hour' | 'minute' | 'second';
|
|
22
|
+
|
|
23
|
+
export interface DateTimeRangeValue {
|
|
24
|
+
from?: Date | null;
|
|
25
|
+
to?: Date | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface DateTimeRangePickerProps
|
|
29
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
30
|
+
value?: DateTimeRangeValue | null;
|
|
31
|
+
onChange?: (range: DateTimeRangeValue | null) => void;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
minDate?: Date;
|
|
35
|
+
maxDate?: Date;
|
|
36
|
+
disabledDates?: Array<Date | { from: Date; to: Date }>;
|
|
37
|
+
numberOfMonths?: number;
|
|
38
|
+
popoverSide?: 'top' | 'right' | 'bottom' | 'left';
|
|
39
|
+
// time config
|
|
40
|
+
timePrecision?: TimePrecision; // default 'minute'
|
|
41
|
+
hourCycle?: 12 | 24; // default 24
|
|
42
|
+
minuteStep?: number; // default 5
|
|
43
|
+
secondStep?: number; // default 5
|
|
44
|
+
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
|
|
45
|
+
open?: boolean;
|
|
46
|
+
onOpenChange?: (open: boolean) => void;
|
|
47
|
+
showFooter?: boolean; // default true
|
|
48
|
+
cancelLabel?: string; // default 'Cancel'
|
|
49
|
+
applyLabel?: string; // default 'Apply'
|
|
50
|
+
clearLabel?: string; // default 'Clear'
|
|
51
|
+
contentClassName?: string; // custom classes for the inner content container
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const pad2 = (n: number) => String(n).padStart(2, '0');
|
|
55
|
+
function startOfDay(d: Date) {
|
|
56
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
57
|
+
}
|
|
58
|
+
function sameDay(a: Date, b: Date) {
|
|
59
|
+
return (
|
|
60
|
+
a.getFullYear() === b.getFullYear() &&
|
|
61
|
+
a.getMonth() === b.getMonth() &&
|
|
62
|
+
a.getDate() === b.getDate()
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
function isBefore(date: Date, min?: Date) {
|
|
66
|
+
return !!(min && date < startOfDay(min));
|
|
67
|
+
}
|
|
68
|
+
function isAfter(date: Date, max?: Date) {
|
|
69
|
+
return !!(max && date > startOfDay(max));
|
|
70
|
+
}
|
|
71
|
+
function inDisabled(
|
|
72
|
+
date: Date,
|
|
73
|
+
items?: Array<Date | { from: Date; to: Date }>,
|
|
74
|
+
) {
|
|
75
|
+
if (!items || items.length === 0) return false;
|
|
76
|
+
const d = startOfDay(date);
|
|
77
|
+
for (const it of items) {
|
|
78
|
+
if (it instanceof Date) {
|
|
79
|
+
if (sameDay(d, it)) return true;
|
|
80
|
+
} else if (it && 'from' in it && 'to' in it) {
|
|
81
|
+
const from = startOfDay(it.from);
|
|
82
|
+
const to = startOfDay(it.to);
|
|
83
|
+
if (d >= from && d <= to) return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
function rangeContainsDisabled(
|
|
89
|
+
from?: Date,
|
|
90
|
+
to?: Date,
|
|
91
|
+
items?: Array<Date | { from: Date; to: Date }>,
|
|
92
|
+
) {
|
|
93
|
+
if (!from || !to) return false;
|
|
94
|
+
if (!items || items.length === 0) return false;
|
|
95
|
+
const a = startOfDay(from);
|
|
96
|
+
const b = startOfDay(to);
|
|
97
|
+
const start = a <= b ? a : b;
|
|
98
|
+
const end = a <= b ? b : a;
|
|
99
|
+
let cur = start;
|
|
100
|
+
while (cur <= end) {
|
|
101
|
+
if (inDisabled(cur, items)) return true;
|
|
102
|
+
cur = new Date(cur.getFullYear(), cur.getMonth(), cur.getDate() + 1);
|
|
103
|
+
}
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function TimeSelectors({
|
|
108
|
+
label,
|
|
109
|
+
value,
|
|
110
|
+
onChange,
|
|
111
|
+
precision,
|
|
112
|
+
hourCycle,
|
|
113
|
+
minuteStep,
|
|
114
|
+
secondStep,
|
|
115
|
+
disabled,
|
|
116
|
+
compact,
|
|
117
|
+
}: {
|
|
118
|
+
label: string;
|
|
119
|
+
value: Date | null | undefined;
|
|
120
|
+
onChange: (val: Date | null) => void;
|
|
121
|
+
precision: TimePrecision;
|
|
122
|
+
hourCycle: 12 | 24;
|
|
123
|
+
minuteStep: number;
|
|
124
|
+
secondStep: number;
|
|
125
|
+
disabled?: boolean;
|
|
126
|
+
compact?: boolean;
|
|
127
|
+
}) {
|
|
128
|
+
const hours = React.useMemo(
|
|
129
|
+
() =>
|
|
130
|
+
hourCycle === 12
|
|
131
|
+
? Array.from({ length: 12 }, (_, i) => i + 1)
|
|
132
|
+
: Array.from({ length: 24 }, (_, i) => i),
|
|
133
|
+
[hourCycle],
|
|
134
|
+
);
|
|
135
|
+
const minutes = React.useMemo(
|
|
136
|
+
() =>
|
|
137
|
+
Array.from(
|
|
138
|
+
{ length: Math.ceil(60 / minuteStep) },
|
|
139
|
+
(_, i) => i * minuteStep,
|
|
140
|
+
),
|
|
141
|
+
[minuteStep],
|
|
142
|
+
);
|
|
143
|
+
const seconds = React.useMemo(
|
|
144
|
+
() =>
|
|
145
|
+
Array.from(
|
|
146
|
+
{ length: Math.ceil(60 / secondStep) },
|
|
147
|
+
(_, i) => i * secondStep,
|
|
148
|
+
),
|
|
149
|
+
[secondStep],
|
|
150
|
+
);
|
|
151
|
+
const selectedHour = React.useMemo(() => {
|
|
152
|
+
if (!value) return hourCycle === 12 ? 12 : 0;
|
|
153
|
+
const h = value.getHours();
|
|
154
|
+
return hourCycle === 12 ? (h % 12 === 0 ? 12 : h % 12) : h;
|
|
155
|
+
}, [value, hourCycle]);
|
|
156
|
+
const selectedMinute = value?.getMinutes() ?? 0;
|
|
157
|
+
const selectedSecond = value?.getSeconds() ?? 0;
|
|
158
|
+
const selectedPeriod: 'AM' | 'PM' =
|
|
159
|
+
value && value.getHours() >= 12 ? 'PM' : 'AM';
|
|
160
|
+
|
|
161
|
+
const setPart = (
|
|
162
|
+
part: 'hour' | 'minute' | 'second' | 'period',
|
|
163
|
+
v: number | 'AM' | 'PM',
|
|
164
|
+
) => {
|
|
165
|
+
const base = value
|
|
166
|
+
? new Date(value)
|
|
167
|
+
: (() => {
|
|
168
|
+
const n = new Date();
|
|
169
|
+
return new Date(
|
|
170
|
+
n.getFullYear(),
|
|
171
|
+
n.getMonth(),
|
|
172
|
+
n.getDate(),
|
|
173
|
+
0,
|
|
174
|
+
0,
|
|
175
|
+
0,
|
|
176
|
+
0,
|
|
177
|
+
);
|
|
178
|
+
})();
|
|
179
|
+
if (part === 'hour') {
|
|
180
|
+
let h = Number(v);
|
|
181
|
+
if (hourCycle === 12) {
|
|
182
|
+
const isPM = base.getHours() >= 12;
|
|
183
|
+
h = h % 12;
|
|
184
|
+
base.setHours(isPM ? (h === 12 ? 12 : h + 12) : h === 12 ? 0 : h);
|
|
185
|
+
} else {
|
|
186
|
+
base.setHours(h);
|
|
187
|
+
}
|
|
188
|
+
} else if (part === 'minute') {
|
|
189
|
+
base.setMinutes(Number(v));
|
|
190
|
+
} else if (part === 'second') {
|
|
191
|
+
base.setSeconds(Number(v));
|
|
192
|
+
} else if (part === 'period' && (v === 'AM' || v === 'PM')) {
|
|
193
|
+
const curH = base.getHours();
|
|
194
|
+
const isAMNow = curH < 12;
|
|
195
|
+
if (v === 'AM' && !isAMNow) base.setHours(curH - 12);
|
|
196
|
+
if (v === 'PM' && isAMNow) base.setHours(curH + 12);
|
|
197
|
+
}
|
|
198
|
+
base.setMilliseconds(0);
|
|
199
|
+
onChange(base);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const widthClass = compact ? 'w-16' : 'w-24';
|
|
203
|
+
return (
|
|
204
|
+
<div className={compact ? '' : 'space-y-1'}>
|
|
205
|
+
{!compact && <div className="text-xs text-muted-foreground">{label}</div>}
|
|
206
|
+
<div className="flex items-end gap-2">
|
|
207
|
+
<div className={widthClass}>
|
|
208
|
+
{!compact && (
|
|
209
|
+
<div className="mb-1 block text-xs text-muted-foreground">Hour</div>
|
|
210
|
+
)}
|
|
211
|
+
<Select
|
|
212
|
+
disabled={disabled}
|
|
213
|
+
value={String(selectedHour)}
|
|
214
|
+
onValueChange={(v) => setPart('hour', Number(v))}
|
|
215
|
+
>
|
|
216
|
+
<SelectTrigger aria-label={`${label} hour`}>
|
|
217
|
+
<SelectValue />
|
|
218
|
+
</SelectTrigger>
|
|
219
|
+
<SelectContent>
|
|
220
|
+
{hours.map((h) => (
|
|
221
|
+
<SelectItem key={h} value={String(h)}>
|
|
222
|
+
{hourCycle === 12 ? h : pad2(h)}
|
|
223
|
+
</SelectItem>
|
|
224
|
+
))}
|
|
225
|
+
</SelectContent>
|
|
226
|
+
</Select>
|
|
227
|
+
</div>
|
|
228
|
+
{(precision === 'minute' || precision === 'second') && (
|
|
229
|
+
<div className={widthClass}>
|
|
230
|
+
{!compact && (
|
|
231
|
+
<div className="mb-1 block text-xs text-muted-foreground">
|
|
232
|
+
Minute
|
|
233
|
+
</div>
|
|
234
|
+
)}
|
|
235
|
+
<Select
|
|
236
|
+
disabled={disabled}
|
|
237
|
+
value={String(selectedMinute - (selectedMinute % minuteStep))}
|
|
238
|
+
onValueChange={(v) => setPart('minute', Number(v))}
|
|
239
|
+
>
|
|
240
|
+
<SelectTrigger aria-label={`${label} minute`}>
|
|
241
|
+
<SelectValue />
|
|
242
|
+
</SelectTrigger>
|
|
243
|
+
<SelectContent>
|
|
244
|
+
{minutes.map((m) => (
|
|
245
|
+
<SelectItem key={m} value={String(m)}>
|
|
246
|
+
{pad2(m)}
|
|
247
|
+
</SelectItem>
|
|
248
|
+
))}
|
|
249
|
+
</SelectContent>
|
|
250
|
+
</Select>
|
|
251
|
+
</div>
|
|
252
|
+
)}
|
|
253
|
+
{precision === 'second' && (
|
|
254
|
+
<div className={widthClass}>
|
|
255
|
+
{!compact && (
|
|
256
|
+
<div className="mb-1 block text-xs text-muted-foreground">
|
|
257
|
+
Second
|
|
258
|
+
</div>
|
|
259
|
+
)}
|
|
260
|
+
<Select
|
|
261
|
+
disabled={disabled}
|
|
262
|
+
value={String(selectedSecond - (selectedSecond % secondStep))}
|
|
263
|
+
onValueChange={(v) => setPart('second', Number(v))}
|
|
264
|
+
>
|
|
265
|
+
<SelectTrigger aria-label={`${label} second`}>
|
|
266
|
+
<SelectValue />
|
|
267
|
+
</SelectTrigger>
|
|
268
|
+
<SelectContent>
|
|
269
|
+
{seconds.map((s) => (
|
|
270
|
+
<SelectItem key={s} value={String(s)}>
|
|
271
|
+
{pad2(s)}
|
|
272
|
+
</SelectItem>
|
|
273
|
+
))}
|
|
274
|
+
</SelectContent>
|
|
275
|
+
</Select>
|
|
276
|
+
</div>
|
|
277
|
+
)}
|
|
278
|
+
{hourCycle === 12 && (
|
|
279
|
+
<div className={widthClass}>
|
|
280
|
+
{!compact && (
|
|
281
|
+
<div className="mb-1 block text-xs text-muted-foreground">
|
|
282
|
+
Period
|
|
283
|
+
</div>
|
|
284
|
+
)}
|
|
285
|
+
<Select
|
|
286
|
+
disabled={disabled}
|
|
287
|
+
value={selectedPeriod}
|
|
288
|
+
onValueChange={(v) => setPart('period', v as 'AM' | 'PM')}
|
|
289
|
+
>
|
|
290
|
+
<SelectTrigger aria-label={`${label} period`}>
|
|
291
|
+
<SelectValue />
|
|
292
|
+
</SelectTrigger>
|
|
293
|
+
<SelectContent>
|
|
294
|
+
<SelectItem value="AM">AM</SelectItem>
|
|
295
|
+
<SelectItem value="PM">PM</SelectItem>
|
|
296
|
+
</SelectContent>
|
|
297
|
+
</Select>
|
|
298
|
+
</div>
|
|
299
|
+
)}
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export function DateTimeRangePicker({
|
|
306
|
+
value,
|
|
307
|
+
onChange,
|
|
308
|
+
placeholder = 'Pick a date & time range',
|
|
309
|
+
disabled,
|
|
310
|
+
minDate,
|
|
311
|
+
maxDate,
|
|
312
|
+
disabledDates,
|
|
313
|
+
numberOfMonths = 2,
|
|
314
|
+
popoverSide,
|
|
315
|
+
timePrecision = 'minute',
|
|
316
|
+
hourCycle = 24,
|
|
317
|
+
minuteStep = 5,
|
|
318
|
+
secondStep = 5,
|
|
319
|
+
className,
|
|
320
|
+
buttonVariant = 'outline',
|
|
321
|
+
contentClassName,
|
|
322
|
+
...props
|
|
323
|
+
}: DateTimeRangePickerProps) {
|
|
324
|
+
const [internalOpen, setInternalOpen] = React.useState(false);
|
|
325
|
+
const isOpen = typeof props.open === 'boolean' ? props.open : internalOpen;
|
|
326
|
+
const setOpen = (o: boolean) =>
|
|
327
|
+
props.onOpenChange ? props.onOpenChange(o) : setInternalOpen(o);
|
|
328
|
+
const [draft, setDraft] = React.useState<DateTimeRangeValue | null>(
|
|
329
|
+
value ?? null,
|
|
330
|
+
);
|
|
331
|
+
|
|
332
|
+
React.useEffect(() => {
|
|
333
|
+
if (isOpen) setDraft(value ?? null);
|
|
334
|
+
}, [isOpen, value]);
|
|
335
|
+
|
|
336
|
+
const fmtTime = React.useCallback(
|
|
337
|
+
(d?: Date | null) => {
|
|
338
|
+
if (!d) return '';
|
|
339
|
+
const h = d.getHours();
|
|
340
|
+
const m = d.getMinutes();
|
|
341
|
+
const s = d.getSeconds();
|
|
342
|
+
return hourCycle === 12
|
|
343
|
+
? `${h % 12 || 12}:${pad2(m)}${timePrecision === 'second' ? `:${pad2(s)}` : ''} ${h >= 12 ? 'PM' : 'AM'}`
|
|
344
|
+
: `${pad2(h)}:${pad2(m)}${timePrecision === 'second' ? `:${pad2(s)}` : ''}`;
|
|
345
|
+
},
|
|
346
|
+
[hourCycle, timePrecision],
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
const label = React.useMemo(() => {
|
|
350
|
+
const f = draft?.from ?? value?.from ?? null;
|
|
351
|
+
const t = draft?.to ?? value?.to ?? null;
|
|
352
|
+
if (f && t) {
|
|
353
|
+
const fd = f.toLocaleDateString(undefined, {
|
|
354
|
+
year: 'numeric',
|
|
355
|
+
month: 'short',
|
|
356
|
+
day: '2-digit',
|
|
357
|
+
});
|
|
358
|
+
const td = t.toLocaleDateString(undefined, {
|
|
359
|
+
year: 'numeric',
|
|
360
|
+
month: 'short',
|
|
361
|
+
day: '2-digit',
|
|
362
|
+
});
|
|
363
|
+
return `${fd} ${fmtTime(f)} – ${td} ${fmtTime(t)}`;
|
|
364
|
+
}
|
|
365
|
+
return placeholder;
|
|
366
|
+
}, [draft, value, placeholder, fmtTime]);
|
|
367
|
+
|
|
368
|
+
// Date inputs and parsing (DD / MM / YYYY)
|
|
369
|
+
const fmtDate = React.useCallback((d?: Date | null) => {
|
|
370
|
+
if (!d) return '';
|
|
371
|
+
const dd = String(d.getDate()).padStart(2, '0');
|
|
372
|
+
const mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
373
|
+
const yyyy = d.getFullYear();
|
|
374
|
+
return `${dd} / ${mm} / ${yyyy}`;
|
|
375
|
+
}, []);
|
|
376
|
+
const [fromInput, setFromInput] = React.useState<string>(
|
|
377
|
+
fmtDate(draft?.from ?? value?.from ?? null),
|
|
378
|
+
);
|
|
379
|
+
const [toInput, setToInput] = React.useState<string>(
|
|
380
|
+
fmtDate(draft?.to ?? value?.to ?? null),
|
|
381
|
+
);
|
|
382
|
+
React.useEffect(() => {
|
|
383
|
+
if (isOpen) {
|
|
384
|
+
setFromInput(fmtDate(value?.from ?? null));
|
|
385
|
+
setToInput(fmtDate(value?.to ?? null));
|
|
386
|
+
}
|
|
387
|
+
}, [isOpen, value, fmtDate]);
|
|
388
|
+
const maskDate = (raw: string) => {
|
|
389
|
+
const digits = raw.replace(/\D/g, '').slice(0, 8);
|
|
390
|
+
const parts: string[] = [];
|
|
391
|
+
const dd = digits.slice(0, Math.min(2, digits.length));
|
|
392
|
+
if (dd) parts.push(dd);
|
|
393
|
+
const mm =
|
|
394
|
+
digits.length > 2 ? digits.slice(2, Math.min(4, digits.length)) : '';
|
|
395
|
+
if (mm) parts.push(mm);
|
|
396
|
+
const yyyy = digits.length > 4 ? digits.slice(4) : '';
|
|
397
|
+
if (yyyy) parts.push(yyyy);
|
|
398
|
+
return parts.join(' / ');
|
|
399
|
+
};
|
|
400
|
+
const parseMasked = (masked: string): Date | undefined => {
|
|
401
|
+
const m = masked.match(/^(\d{1,2})\s*\/\s*(\d{1,2})\s*\/\s*(\d{4})$/);
|
|
402
|
+
if (!m) return undefined;
|
|
403
|
+
const dd = Number(m[1]);
|
|
404
|
+
const mm = Number(m[2]);
|
|
405
|
+
const yyyy = Number(m[3]);
|
|
406
|
+
if (mm < 1 || mm > 12) return undefined;
|
|
407
|
+
const lastDay = new Date(yyyy, mm, 0).getDate();
|
|
408
|
+
if (dd < 1 || dd > lastDay) return undefined;
|
|
409
|
+
const out = new Date(yyyy, mm - 1, dd);
|
|
410
|
+
if (
|
|
411
|
+
isBefore(out, minDate) ||
|
|
412
|
+
isAfter(out, maxDate) ||
|
|
413
|
+
inDisabled(out, disabledDates)
|
|
414
|
+
)
|
|
415
|
+
return undefined;
|
|
416
|
+
return out;
|
|
417
|
+
};
|
|
418
|
+
const fromParsed = parseMasked(fromInput);
|
|
419
|
+
const toParsed = parseMasked(toInput);
|
|
420
|
+
const mergedFrom = React.useMemo(() => {
|
|
421
|
+
if (fromParsed) {
|
|
422
|
+
const base = draft?.from ?? value?.from ?? null;
|
|
423
|
+
if (base) {
|
|
424
|
+
return new Date(
|
|
425
|
+
fromParsed.getFullYear(),
|
|
426
|
+
fromParsed.getMonth(),
|
|
427
|
+
fromParsed.getDate(),
|
|
428
|
+
base.getHours(),
|
|
429
|
+
base.getMinutes(),
|
|
430
|
+
base.getSeconds(),
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
return fromParsed;
|
|
434
|
+
}
|
|
435
|
+
return draft?.from ?? undefined;
|
|
436
|
+
}, [fromParsed, draft, value]);
|
|
437
|
+
const mergedTo = React.useMemo(() => {
|
|
438
|
+
if (toParsed) {
|
|
439
|
+
const base = draft?.to ?? value?.to ?? null;
|
|
440
|
+
if (base) {
|
|
441
|
+
return new Date(
|
|
442
|
+
toParsed.getFullYear(),
|
|
443
|
+
toParsed.getMonth(),
|
|
444
|
+
toParsed.getDate(),
|
|
445
|
+
base.getHours(),
|
|
446
|
+
base.getMinutes(),
|
|
447
|
+
base.getSeconds(),
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
return toParsed;
|
|
451
|
+
}
|
|
452
|
+
return draft?.to ?? undefined;
|
|
453
|
+
}, [toParsed, draft, value]);
|
|
454
|
+
const invalidRange =
|
|
455
|
+
!mergedFrom ||
|
|
456
|
+
!mergedTo ||
|
|
457
|
+
isBefore(mergedFrom, minDate) ||
|
|
458
|
+
isAfter(mergedTo, maxDate) ||
|
|
459
|
+
mergedFrom > mergedTo ||
|
|
460
|
+
rangeContainsDisabled(mergedFrom, mergedTo, disabledDates);
|
|
461
|
+
|
|
462
|
+
return (
|
|
463
|
+
<div className={cn('w-fit', className)} {...props}>
|
|
464
|
+
<Popover open={isOpen} onOpenChange={setOpen}>
|
|
465
|
+
<PopoverTrigger asChild>
|
|
466
|
+
<Button
|
|
467
|
+
type="button"
|
|
468
|
+
disabled={disabled}
|
|
469
|
+
variant={buttonVariant}
|
|
470
|
+
className={cn(
|
|
471
|
+
'w-[360px] justify-start text-left font-normal',
|
|
472
|
+
!value && 'text-muted-foreground',
|
|
473
|
+
)}
|
|
474
|
+
>
|
|
475
|
+
<CalendarIcon className="mr-2 h-4 w-4" />
|
|
476
|
+
{label}
|
|
477
|
+
</Button>
|
|
478
|
+
</PopoverTrigger>
|
|
479
|
+
<PopoverContent
|
|
480
|
+
className="w-auto max-w-none p-4"
|
|
481
|
+
align="start"
|
|
482
|
+
side={popoverSide ?? 'bottom'}
|
|
483
|
+
sideOffset={8}
|
|
484
|
+
>
|
|
485
|
+
<div className={cn('w-fit min-w-0', contentClassName)}>
|
|
486
|
+
{/* Header row: date inputs with inline time selectors beside each */}
|
|
487
|
+
<div className="mb-3 rounded-md border border-border bg-background/50 px-3 py-2">
|
|
488
|
+
<div className="flex flex-wrap items-end gap-3">
|
|
489
|
+
<div className="flex items-end gap-2">
|
|
490
|
+
<input
|
|
491
|
+
type="text"
|
|
492
|
+
inputMode="numeric"
|
|
493
|
+
value={fromInput}
|
|
494
|
+
onChange={(e) => setFromInput(maskDate(e.target.value))}
|
|
495
|
+
onBlur={() => {
|
|
496
|
+
const p = parseMasked(fromInput);
|
|
497
|
+
if (p) {
|
|
498
|
+
const prev = draft?.from ?? null;
|
|
499
|
+
const withTime = new Date(
|
|
500
|
+
p.getFullYear(),
|
|
501
|
+
p.getMonth(),
|
|
502
|
+
p.getDate(),
|
|
503
|
+
prev ? prev.getHours() : 0,
|
|
504
|
+
prev ? prev.getMinutes() : 0,
|
|
505
|
+
prev ? prev.getSeconds() : 0,
|
|
506
|
+
);
|
|
507
|
+
setDraft((d) => ({ ...(d ?? {}), from: withTime }));
|
|
508
|
+
}
|
|
509
|
+
}}
|
|
510
|
+
placeholder="dd/mm/yyyy"
|
|
511
|
+
className="h-9 w-40 rounded-md border bg-background px-3 text-sm shadow-xs outline-hidden"
|
|
512
|
+
/>
|
|
513
|
+
<TimeSelectors
|
|
514
|
+
label="From"
|
|
515
|
+
compact
|
|
516
|
+
value={draft?.from ?? null}
|
|
517
|
+
onChange={(d) =>
|
|
518
|
+
setDraft((prev) => ({ ...(prev ?? {}), from: d }))
|
|
519
|
+
}
|
|
520
|
+
precision={timePrecision}
|
|
521
|
+
hourCycle={hourCycle}
|
|
522
|
+
minuteStep={minuteStep}
|
|
523
|
+
secondStep={secondStep}
|
|
524
|
+
disabled={disabled}
|
|
525
|
+
/>
|
|
526
|
+
</div>
|
|
527
|
+
<span className="text-muted-foreground">–</span>
|
|
528
|
+
<div className="flex items-end gap-2">
|
|
529
|
+
<input
|
|
530
|
+
type="text"
|
|
531
|
+
inputMode="numeric"
|
|
532
|
+
value={toInput}
|
|
533
|
+
onChange={(e) => setToInput(maskDate(e.target.value))}
|
|
534
|
+
onBlur={() => {
|
|
535
|
+
const p = parseMasked(toInput);
|
|
536
|
+
if (p) {
|
|
537
|
+
const prev = draft?.to ?? null;
|
|
538
|
+
const withTime = new Date(
|
|
539
|
+
p.getFullYear(),
|
|
540
|
+
p.getMonth(),
|
|
541
|
+
p.getDate(),
|
|
542
|
+
prev ? prev.getHours() : 0,
|
|
543
|
+
prev ? prev.getMinutes() : 0,
|
|
544
|
+
prev ? prev.getSeconds() : 0,
|
|
545
|
+
);
|
|
546
|
+
setDraft((d) => ({ ...(d ?? {}), to: withTime }));
|
|
547
|
+
}
|
|
548
|
+
}}
|
|
549
|
+
placeholder="dd/mm/yyyy"
|
|
550
|
+
className="h-9 w-40 rounded-md border bg-background px-3 text-sm shadow-xs outline-hidden"
|
|
551
|
+
/>
|
|
552
|
+
<TimeSelectors
|
|
553
|
+
label="To"
|
|
554
|
+
compact
|
|
555
|
+
value={draft?.to ?? null}
|
|
556
|
+
onChange={(d) =>
|
|
557
|
+
setDraft((prev) => ({ ...(prev ?? {}), to: d }))
|
|
558
|
+
}
|
|
559
|
+
precision={timePrecision}
|
|
560
|
+
hourCycle={hourCycle}
|
|
561
|
+
minuteStep={minuteStep}
|
|
562
|
+
secondStep={secondStep}
|
|
563
|
+
disabled={disabled}
|
|
564
|
+
/>
|
|
565
|
+
</div>
|
|
566
|
+
</div>
|
|
567
|
+
</div>
|
|
568
|
+
|
|
569
|
+
{/* Calendar */}
|
|
570
|
+
<Calendar
|
|
571
|
+
mode="range"
|
|
572
|
+
numberOfMonths={numberOfMonths}
|
|
573
|
+
selected={
|
|
574
|
+
draft?.from && draft?.to
|
|
575
|
+
? { from: draft.from, to: draft.to }
|
|
576
|
+
: undefined
|
|
577
|
+
}
|
|
578
|
+
onSelect={(range) => {
|
|
579
|
+
if (disabled) return;
|
|
580
|
+
if (!range) {
|
|
581
|
+
setDraft(null);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const { from, to } = range as { from?: Date; to?: Date };
|
|
585
|
+
if (from && (isBefore(from, minDate) || isAfter(from, maxDate)))
|
|
586
|
+
return;
|
|
587
|
+
if (to && (isBefore(to, minDate) || isAfter(to, maxDate)))
|
|
588
|
+
return;
|
|
589
|
+
if (
|
|
590
|
+
from &&
|
|
591
|
+
to &&
|
|
592
|
+
rangeContainsDisabled(from, to, disabledDates)
|
|
593
|
+
)
|
|
594
|
+
return;
|
|
595
|
+
const prevFrom = draft?.from ?? from;
|
|
596
|
+
const prevTo = draft?.to ?? to;
|
|
597
|
+
const nextFrom = from
|
|
598
|
+
? new Date(
|
|
599
|
+
from.getFullYear(),
|
|
600
|
+
from.getMonth(),
|
|
601
|
+
from.getDate(),
|
|
602
|
+
prevFrom?.getHours?.() ?? 0,
|
|
603
|
+
prevFrom?.getMinutes?.() ?? 0,
|
|
604
|
+
prevFrom?.getSeconds?.() ?? 0,
|
|
605
|
+
)
|
|
606
|
+
: undefined;
|
|
607
|
+
const nextTo = to
|
|
608
|
+
? new Date(
|
|
609
|
+
to.getFullYear(),
|
|
610
|
+
to.getMonth(),
|
|
611
|
+
to.getDate(),
|
|
612
|
+
prevTo?.getHours?.() ?? 0,
|
|
613
|
+
prevTo?.getMinutes?.() ?? 0,
|
|
614
|
+
prevTo?.getSeconds?.() ?? 0,
|
|
615
|
+
)
|
|
616
|
+
: undefined;
|
|
617
|
+
setDraft({ from: nextFrom ?? null, to: nextTo ?? null });
|
|
618
|
+
setFromInput(fmtDate(nextFrom ?? null));
|
|
619
|
+
setToInput(fmtDate(nextTo ?? null));
|
|
620
|
+
}}
|
|
621
|
+
defaultMonth={draft?.from ?? value?.from ?? new Date()}
|
|
622
|
+
disabled={(d) =>
|
|
623
|
+
isBefore(d, minDate) ||
|
|
624
|
+
isAfter(d, maxDate) ||
|
|
625
|
+
inDisabled(d, disabledDates)
|
|
626
|
+
}
|
|
627
|
+
buttonVariant="ghost"
|
|
628
|
+
showOutsideDays
|
|
629
|
+
/>
|
|
630
|
+
</div>
|
|
631
|
+
{(props.showFooter ?? true) && (
|
|
632
|
+
<div className="flex items-center justify-between gap-2 pt-3 mt-3 border-t">
|
|
633
|
+
<Button
|
|
634
|
+
type="button"
|
|
635
|
+
variant="outline"
|
|
636
|
+
size="sm"
|
|
637
|
+
onClick={() => setOpen(false)}
|
|
638
|
+
disabled={disabled}
|
|
639
|
+
>
|
|
640
|
+
{props.cancelLabel ?? 'Cancel'}
|
|
641
|
+
</Button>
|
|
642
|
+
<div className="flex gap-2">
|
|
643
|
+
<Button
|
|
644
|
+
type="button"
|
|
645
|
+
variant="ghost"
|
|
646
|
+
size="sm"
|
|
647
|
+
onClick={() => onChange?.(null)}
|
|
648
|
+
disabled={disabled}
|
|
649
|
+
>
|
|
650
|
+
{props.clearLabel ?? 'Clear'}
|
|
651
|
+
</Button>
|
|
652
|
+
<Button
|
|
653
|
+
type="button"
|
|
654
|
+
variant="default"
|
|
655
|
+
size="sm"
|
|
656
|
+
onClick={() => {
|
|
657
|
+
if (invalidRange || !mergedFrom || !mergedTo) return;
|
|
658
|
+
onChange?.({ from: mergedFrom, to: mergedTo });
|
|
659
|
+
setOpen(false);
|
|
660
|
+
}}
|
|
661
|
+
disabled={disabled || invalidRange}
|
|
662
|
+
>
|
|
663
|
+
{props.applyLabel ?? 'Apply'}
|
|
664
|
+
</Button>
|
|
665
|
+
</div>
|
|
666
|
+
</div>
|
|
667
|
+
)}
|
|
668
|
+
</PopoverContent>
|
|
669
|
+
</Popover>
|
|
670
|
+
</div>
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
DateTimeRangePicker.displayName = 'DateTimeRangePicker';
|
|
675
|
+
|
|
676
|
+
export default DateTimeRangePicker;
|