@k3-universe/react-kit 0.0.27 → 0.0.29
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/.storybook/main.ts +1 -1
- package/.storybook/preview.ts +18 -10
- package/biome.json +10 -0
- package/dist/index.js +2319 -1227
- package/dist/kit/builder/auth/AuthProvider.d.ts +36 -0
- package/dist/kit/builder/auth/AuthProvider.d.ts.map +1 -0
- package/dist/kit/builder/auth/adapter.d.ts +14 -0
- package/dist/kit/builder/auth/adapter.d.ts.map +1 -0
- package/dist/kit/builder/auth/client-adapters.d.ts +149 -0
- package/dist/kit/builder/auth/client-adapters.d.ts.map +1 -0
- package/dist/kit/builder/auth/components.d.ts +119 -0
- package/dist/kit/builder/auth/components.d.ts.map +1 -0
- package/dist/kit/builder/auth/hooks.d.ts +158 -0
- package/dist/kit/builder/auth/hooks.d.ts.map +1 -0
- package/dist/kit/builder/auth/index.d.ts +11 -0
- package/dist/kit/builder/auth/index.d.ts.map +1 -0
- package/dist/kit/builder/auth/permission-checker.d.ts +31 -0
- package/dist/kit/builder/auth/permission-checker.d.ts.map +1 -0
- package/dist/kit/builder/auth/storage.d.ts +17 -0
- package/dist/kit/builder/auth/storage.d.ts.map +1 -0
- package/dist/kit/builder/auth/token-manager.d.ts +9 -0
- package/dist/kit/builder/auth/token-manager.d.ts.map +1 -0
- package/dist/kit/builder/auth/types.d.ts +183 -0
- package/dist/kit/builder/auth/types.d.ts.map +1 -0
- package/dist/kit/builder/data-table/components/DataTable.d.ts +2 -1
- package/dist/kit/builder/data-table/components/DataTable.d.ts.map +1 -1
- package/dist/kit/builder/data-table/components/DataTableColumnHeader.d.ts +2 -2
- package/dist/kit/builder/data-table/components/DataTableColumnHeader.d.ts.map +1 -1
- package/dist/kit/builder/data-table/components/DataTablePagination.d.ts +2 -1
- package/dist/kit/builder/data-table/components/DataTablePagination.d.ts.map +1 -1
- package/dist/kit/builder/data-table/components/DataTableViewOptions.d.ts +1 -1
- package/dist/kit/builder/data-table/components/DataTableViewOptions.d.ts.map +1 -1
- package/dist/kit/builder/data-table/types.d.ts.map +1 -1
- package/dist/kit/builder/dialog/index.d.ts +1 -1
- package/dist/kit/builder/dialog/index.d.ts.map +1 -1
- package/dist/kit/builder/dialog/provider.d.ts +0 -1
- package/dist/kit/builder/dialog/provider.d.ts.map +1 -1
- package/dist/kit/builder/form/components/FormBuilder.d.ts.map +1 -1
- package/dist/kit/builder/form/components/FormBuilderActions.d.ts.map +1 -1
- package/dist/kit/builder/form/components/FormBuilderContext.d.ts.map +1 -1
- package/dist/kit/builder/form/components/FormBuilderField.d.ts +1 -1
- package/dist/kit/builder/form/components/FormBuilderField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/ArrayField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/ArrayField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/AutocompleteField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/AutocompleteField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/CheckboxField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/CheckboxField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/DateField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/DateField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/DatePickerField.d.ts +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 +1 -1
- package/dist/kit/builder/form/components/fields/DateRangePickerField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/DateTimePickerField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/DateTimePickerField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/DateTimeRangePickerField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/DateTimeRangePickerField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/FileField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/FileField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/MonthPickerField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/MonthPickerField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/MonthRangePickerField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/MonthRangePickerField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/NumberField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/NumberField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/ObjectField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/RadioField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/RadioField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/SelectField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/SelectField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/SwitchField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/SwitchField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/TextField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/TextField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/TextareaField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/TextareaField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/TimePickerField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/TimePickerField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/TimeRangePickerField.d.ts +1 -1
- package/dist/kit/builder/form/components/fields/TimeRangePickerField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/index.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/types.d.ts.map +1 -1
- package/dist/kit/builder/form/components/sectionNodes.d.ts.map +1 -1
- package/dist/kit/builder/form/hooks/useFormBuilder.d.ts.map +1 -1
- package/dist/kit/builder/form/types.d.ts.map +1 -1
- package/dist/kit/builder/form/utils/section-factories.d.ts.map +1 -1
- package/dist/kit/builder/page/Page.d.ts.map +1 -1
- package/dist/kit/builder/page/index.d.ts.map +1 -1
- package/dist/kit/builder/section/SectionBuilder.d.ts +1 -1
- package/dist/kit/builder/section/SectionBuilder.d.ts.map +1 -1
- package/dist/kit/builder/section/SectionContainer.d.ts +14 -0
- package/dist/kit/builder/section/SectionContainer.d.ts.map +1 -0
- package/dist/kit/builder/stack-dialog/context.d.ts.map +1 -1
- package/dist/kit/builder/stack-dialog/hooks.d.ts.map +1 -1
- package/dist/kit/builder/stack-dialog/index.d.ts +3 -3
- package/dist/kit/builder/stack-dialog/index.d.ts.map +1 -1
- package/dist/kit/builder/stack-dialog/provider.d.ts.map +1 -1
- package/dist/kit/builder/stack-dialog/renderer.d.ts.map +1 -1
- package/dist/kit/builder/stack-dialog/types.d.ts +1 -1
- package/dist/kit/builder/stack-dialog/types.d.ts.map +1 -1
- package/dist/kit/components/autocomplete/Autocomplete.d.ts +1 -1
- package/dist/kit/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/kit/components/autocomplete/types.d.ts.map +1 -1
- package/dist/kit/components/datepicker/DatePicker.d.ts.map +1 -1
- package/dist/kit/components/datepicker/DateRangePicker.d.ts.map +1 -1
- package/dist/kit/components/datetimepicker/DateTimePicker.d.ts.map +1 -1
- package/dist/kit/components/datetimepicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/kit/components/datetimepicker/index.d.ts.map +1 -1
- package/dist/kit/components/fileuploader/FileUploader.d.ts.map +1 -1
- package/dist/kit/components/fileuploader/types.d.ts +2 -2
- package/dist/kit/components/forminfo/FormInfoError.d.ts.map +1 -1
- package/dist/kit/components/login/Login.d.ts +1 -1
- package/dist/kit/components/login/Login.d.ts.map +1 -1
- package/dist/kit/components/monthpicker/MonthInput.d.ts.map +1 -1
- package/dist/kit/components/monthpicker/MonthPicker.d.ts.map +1 -1
- package/dist/kit/components/monthpicker/MonthRangeInput.d.ts.map +1 -1
- package/dist/kit/components/monthpicker/MonthRangePicker.d.ts.map +1 -1
- package/dist/kit/components/timepicker/TimePicker.d.ts.map +1 -1
- package/dist/kit/components/timepicker/TimeRangePicker.d.ts.map +1 -1
- package/dist/kit/components/timepicker/index.d.ts.map +1 -1
- package/dist/kit/layouts/admin/components/AdminLayout.d.ts.map +1 -1
- package/dist/kit/layouts/admin/components/ThemeToggle.d.ts.map +1 -1
- package/dist/kit/layouts/admin/hooks/menu.d.ts.map +1 -1
- package/dist/kit/layouts/admin/providers/AdminMenuProvider.d.ts +1 -1
- package/dist/kit/layouts/admin/providers/AdminMenuProvider.d.ts.map +1 -1
- package/dist/shadcn/hooks/use-mobile.d.ts.map +1 -1
- package/dist/shadcn/ui/accordion.d.ts +2 -2
- package/dist/shadcn/ui/accordion.d.ts.map +1 -1
- package/dist/shadcn/ui/alert-dialog.d.ts +4 -4
- package/dist/shadcn/ui/alert-dialog.d.ts.map +1 -1
- package/dist/shadcn/ui/alert.d.ts +4 -4
- package/dist/shadcn/ui/alert.d.ts.map +1 -1
- package/dist/shadcn/ui/aspect-ratio.d.ts +1 -1
- package/dist/shadcn/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/shadcn/ui/avatar.d.ts +2 -2
- package/dist/shadcn/ui/avatar.d.ts.map +1 -1
- package/dist/shadcn/ui/badge.d.ts +2 -2
- package/dist/shadcn/ui/badge.d.ts.map +1 -1
- package/dist/shadcn/ui/breadcrumb.d.ts +8 -8
- package/dist/shadcn/ui/breadcrumb.d.ts.map +1 -1
- package/dist/shadcn/ui/button.d.ts +2 -2
- package/dist/shadcn/ui/button.d.ts.map +1 -1
- package/dist/shadcn/ui/calendar.d.ts +2 -2
- package/dist/shadcn/ui/calendar.d.ts.map +1 -1
- package/dist/shadcn/ui/card.d.ts +8 -8
- package/dist/shadcn/ui/card.d.ts.map +1 -1
- package/dist/shadcn/ui/carousel.d.ts +5 -5
- package/dist/shadcn/ui/carousel.d.ts.map +1 -1
- package/dist/shadcn/ui/chart.d.ts +7 -7
- package/dist/shadcn/ui/chart.d.ts.map +1 -1
- package/dist/shadcn/ui/checkbox.d.ts +2 -2
- package/dist/shadcn/ui/checkbox.d.ts.map +1 -1
- package/dist/shadcn/ui/collapsible.d.ts +1 -1
- package/dist/shadcn/ui/collapsible.d.ts.map +1 -1
- package/dist/shadcn/ui/command.d.ts +2 -2
- package/dist/shadcn/ui/command.d.ts.map +1 -1
- package/dist/shadcn/ui/context-menu.d.ts +4 -4
- package/dist/shadcn/ui/context-menu.d.ts.map +1 -1
- package/dist/shadcn/ui/dialog.d.ts +4 -4
- package/dist/shadcn/ui/dialog.d.ts.map +1 -1
- package/dist/shadcn/ui/drawer.d.ts +3 -3
- package/dist/shadcn/ui/drawer.d.ts.map +1 -1
- package/dist/shadcn/ui/dropdown-menu.d.ts +4 -4
- package/dist/shadcn/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/shadcn/ui/form.d.ts +5 -5
- package/dist/shadcn/ui/form.d.ts.map +1 -1
- package/dist/shadcn/ui/hover-card.d.ts +2 -2
- package/dist/shadcn/ui/hover-card.d.ts.map +1 -1
- package/dist/shadcn/ui/input-otp.d.ts +4 -4
- package/dist/shadcn/ui/input-otp.d.ts.map +1 -1
- package/dist/shadcn/ui/input.d.ts +2 -2
- package/dist/shadcn/ui/input.d.ts.map +1 -1
- package/dist/shadcn/ui/label.d.ts +2 -2
- package/dist/shadcn/ui/label.d.ts.map +1 -1
- package/dist/shadcn/ui/menubar.d.ts +4 -4
- package/dist/shadcn/ui/menubar.d.ts.map +1 -1
- package/dist/shadcn/ui/navigation-menu.d.ts +2 -2
- package/dist/shadcn/ui/navigation-menu.d.ts.map +1 -1
- package/dist/shadcn/ui/pagination.d.ts +6 -6
- package/dist/shadcn/ui/pagination.d.ts.map +1 -1
- package/dist/shadcn/ui/popover.d.ts +2 -2
- package/dist/shadcn/ui/popover.d.ts.map +1 -1
- package/dist/shadcn/ui/progress.d.ts +2 -2
- package/dist/shadcn/ui/progress.d.ts.map +1 -1
- package/dist/shadcn/ui/radio-group.d.ts +2 -2
- package/dist/shadcn/ui/radio-group.d.ts.map +1 -1
- package/dist/shadcn/ui/resizable.d.ts +2 -2
- package/dist/shadcn/ui/resizable.d.ts.map +1 -1
- package/dist/shadcn/ui/scroll-area.d.ts +2 -2
- package/dist/shadcn/ui/scroll-area.d.ts.map +1 -1
- package/dist/shadcn/ui/select.d.ts +3 -3
- package/dist/shadcn/ui/select.d.ts.map +1 -1
- package/dist/shadcn/ui/separator.d.ts +2 -2
- package/dist/shadcn/ui/separator.d.ts.map +1 -1
- package/dist/shadcn/ui/sheet.d.ts +5 -5
- package/dist/shadcn/ui/sheet.d.ts.map +1 -1
- package/dist/shadcn/ui/sidebar.d.ts +26 -26
- package/dist/shadcn/ui/sidebar.d.ts.map +1 -1
- package/dist/shadcn/ui/skeleton.d.ts +1 -1
- package/dist/shadcn/ui/skeleton.d.ts.map +1 -1
- package/dist/shadcn/ui/slider.d.ts +2 -2
- package/dist/shadcn/ui/slider.d.ts.map +1 -1
- package/dist/shadcn/ui/sonner.d.ts.map +1 -1
- package/dist/shadcn/ui/switch.d.ts +2 -2
- package/dist/shadcn/ui/switch.d.ts.map +1 -1
- package/dist/shadcn/ui/table.d.ts +9 -9
- package/dist/shadcn/ui/table.d.ts.map +1 -1
- package/dist/shadcn/ui/tabs.d.ts +2 -2
- package/dist/shadcn/ui/tabs.d.ts.map +1 -1
- package/dist/shadcn/ui/textarea.d.ts +2 -2
- package/dist/shadcn/ui/textarea.d.ts.map +1 -1
- package/dist/shadcn/ui/toggle-group.d.ts +2 -2
- package/dist/shadcn/ui/toggle-group.d.ts.map +1 -1
- package/dist/shadcn/ui/toggle.d.ts +2 -2
- package/dist/shadcn/ui/toggle.d.ts.map +1 -1
- package/dist/shadcn/ui/tooltip.d.ts +2 -2
- package/dist/shadcn/ui/tooltip.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/src/kit/builder/auth/AuthProvider.tsx +131 -0
- package/src/kit/builder/auth/adapter.ts +436 -0
- package/src/kit/builder/auth/client-adapters.ts +398 -0
- package/src/kit/builder/auth/components.tsx +221 -0
- package/src/kit/builder/auth/hooks.ts +237 -0
- package/src/kit/builder/auth/index.ts +134 -0
- package/src/kit/builder/auth/permission-checker.ts +150 -0
- package/src/kit/builder/auth/storage.ts +366 -0
- package/src/kit/builder/auth/token-manager.ts +55 -0
- package/src/kit/builder/auth/types.ts +393 -0
- package/src/kit/builder/data-table/components/DataTable.tsx +216 -82
- package/src/kit/builder/data-table/components/DataTableColumnHeader.tsx +9 -5
- package/src/kit/builder/data-table/components/DataTablePagination.tsx +49 -27
- package/src/kit/builder/data-table/components/DataTableViewOptions.tsx +13 -4
- package/src/kit/builder/data-table/types.ts +18 -3
- package/src/kit/builder/dialog/index.ts +5 -1
- package/src/kit/builder/dialog/provider.tsx +56 -27
- package/src/kit/builder/form/components/FormBuilder.tsx +10 -14
- package/src/kit/builder/form/components/FormBuilderActions.tsx +1 -1
- package/src/kit/builder/form/components/FormBuilderContext.tsx +13 -6
- package/src/kit/builder/form/components/FormBuilderField.tsx +70 -20
- package/src/kit/builder/form/components/fields/ArrayField.tsx +148 -62
- package/src/kit/builder/form/components/fields/AutocompleteField.tsx +53 -18
- package/src/kit/builder/form/components/fields/CheckboxField.tsx +20 -11
- package/src/kit/builder/form/components/fields/DateField.tsx +17 -6
- package/src/kit/builder/form/components/fields/DatePickerField.tsx +15 -10
- package/src/kit/builder/form/components/fields/DateRangePickerField.tsx +20 -15
- package/src/kit/builder/form/components/fields/DateTimePickerField.tsx +16 -11
- package/src/kit/builder/form/components/fields/DateTimeRangePickerField.tsx +23 -17
- package/src/kit/builder/form/components/fields/FileField.tsx +10 -5
- package/src/kit/builder/form/components/fields/MonthPickerField.tsx +18 -11
- package/src/kit/builder/form/components/fields/MonthRangePickerField.tsx +23 -17
- package/src/kit/builder/form/components/fields/NumberField.tsx +9 -4
- package/src/kit/builder/form/components/fields/ObjectField.tsx +12 -7
- package/src/kit/builder/form/components/fields/RadioField.tsx +32 -14
- package/src/kit/builder/form/components/fields/SelectField.tsx +26 -11
- package/src/kit/builder/form/components/fields/SwitchField.tsx +20 -11
- package/src/kit/builder/form/components/fields/TextField.tsx +11 -5
- package/src/kit/builder/form/components/fields/TextareaField.tsx +9 -4
- package/src/kit/builder/form/components/fields/TimePickerField.tsx +16 -11
- package/src/kit/builder/form/components/fields/TimeRangePickerField.tsx +23 -17
- package/src/kit/builder/form/components/fields/index.ts +21 -21
- package/src/kit/builder/form/components/fields/types.ts +15 -11
- package/src/kit/builder/form/components/sectionNodes.tsx +63 -40
- package/src/kit/builder/form/hooks/useFormBuilder.ts +83 -34
- package/src/kit/builder/form/types.ts +173 -148
- package/src/kit/builder/form/utils/section-factories.ts +4 -1
- package/src/kit/builder/form/utils/transformers.ts +4 -4
- package/src/kit/builder/form/utils/validations.ts +1 -1
- package/src/kit/builder/page/Page.tsx +26 -6
- package/src/kit/builder/page/index.ts +1 -1
- package/src/kit/builder/section/SectionBuilder.tsx +252 -127
- package/src/kit/builder/section/SectionContainer.tsx +85 -0
- package/src/kit/builder/stack-dialog/context.ts +10 -4
- package/src/kit/builder/stack-dialog/hooks.ts +4 -3
- package/src/kit/builder/stack-dialog/index.ts +5 -11
- package/src/kit/builder/stack-dialog/provider.tsx +11 -11
- package/src/kit/builder/stack-dialog/renderer.tsx +23 -26
- package/src/kit/builder/stack-dialog/types.ts +18 -18
- package/src/kit/components/autocomplete/Autocomplete.tsx +631 -549
- package/src/kit/components/autocomplete/types.ts +17 -17
- package/src/kit/components/datepicker/DatePicker.tsx +33 -9
- package/src/kit/components/datepicker/DateRangePicker.tsx +159 -87
- package/src/kit/components/datetimepicker/DateTimePicker.tsx +136 -30
- package/src/kit/components/datetimepicker/DateTimeRangePicker.tsx +257 -67
- package/src/kit/components/datetimepicker/index.ts +3 -3
- package/src/kit/components/fileuploader/FileUploader.tsx +315 -180
- package/src/kit/components/fileuploader/index.ts +3 -3
- package/src/kit/components/fileuploader/types.ts +3 -3
- package/src/kit/components/forminfo/FormInfoError.tsx +26 -11
- package/src/kit/components/login/Login.tsx +13 -4
- package/src/kit/components/monthpicker/MonthInput.tsx +13 -4
- package/src/kit/components/monthpicker/MonthPicker.tsx +12 -11
- package/src/kit/components/monthpicker/MonthRangeInput.tsx +29 -8
- package/src/kit/components/monthpicker/MonthRangePicker.tsx +23 -21
- package/src/kit/components/timepicker/TimePicker.tsx +19 -11
- package/src/kit/components/timepicker/TimeRangePicker.tsx +106 -29
- package/src/kit/components/timepicker/index.ts +3 -3
- package/src/kit/layouts/admin/components/AdminLayout.tsx +53 -24
- package/src/kit/layouts/admin/components/ThemeToggle.tsx +3 -9
- package/src/kit/layouts/admin/hooks/menu.ts +11 -5
- package/src/kit/layouts/admin/providers/AdminMenuProvider.tsx +59 -39
- package/src/kit/layouts/admin/types/index.ts +1 -1
- package/src/kit/themes/base.css +1 -1
- package/src/kit/themes/clean-slate.css +40 -32
- package/src/kit/themes/default.css +34 -24
- package/src/kit/themes/minimal-modern.css +37 -29
- package/src/kit/themes/spotify.css +56 -39
- package/src/shadcn/hooks/use-mobile.ts +13 -11
- package/src/shadcn/lib/utils.ts +2 -2
- package/src/shadcn/ui/accordion.tsx +14 -14
- package/src/shadcn/ui/alert-dialog.tsx +29 -29
- package/src/shadcn/ui/alert.tsx +20 -20
- package/src/shadcn/ui/aspect-ratio.tsx +4 -4
- package/src/shadcn/ui/avatar.tsx +13 -13
- package/src/shadcn/ui/badge.tsx +16 -16
- package/src/shadcn/ui/breadcrumb.tsx +28 -28
- package/src/shadcn/ui/button.tsx +23 -23
- package/src/shadcn/ui/calendar.tsx +82 -78
- package/src/shadcn/ui/card.tsx +27 -27
- package/src/shadcn/ui/carousel.tsx +93 -93
- package/src/shadcn/ui/chart.tsx +103 -103
- package/src/shadcn/ui/checkbox.tsx +9 -9
- package/src/shadcn/ui/collapsible.tsx +6 -6
- package/src/shadcn/ui/command.tsx +36 -36
- package/src/shadcn/ui/context-menu.tsx +40 -40
- package/src/shadcn/ui/dialog.tsx +28 -28
- package/src/shadcn/ui/drawer.tsx +30 -30
- package/src/shadcn/ui/dropdown-menu.tsx +41 -41
- package/src/shadcn/ui/form.tsx +48 -47
- package/src/shadcn/ui/hover-card.tsx +11 -11
- package/src/shadcn/ui/input-otp.tsx +23 -23
- package/src/shadcn/ui/input.tsx +9 -9
- package/src/shadcn/ui/label.tsx +8 -8
- package/src/shadcn/ui/menubar.tsx +47 -47
- package/src/shadcn/ui/navigation-menu.tsx +33 -33
- package/src/shadcn/ui/pagination.tsx +28 -28
- package/src/shadcn/ui/popover.tsx +12 -12
- package/src/shadcn/ui/progress.tsx +8 -8
- package/src/shadcn/ui/radio-group.tsx +11 -11
- package/src/shadcn/ui/resizable.tsx +14 -14
- package/src/shadcn/ui/scroll-area.tsx +15 -15
- package/src/shadcn/ui/select.tsx +34 -34
- package/src/shadcn/ui/separator.tsx +9 -9
- package/src/shadcn/ui/sheet.tsx +36 -36
- package/src/shadcn/ui/sidebar.tsx +227 -227
- package/src/shadcn/ui/skeleton.tsx +5 -5
- package/src/shadcn/ui/slider.tsx +12 -12
- package/src/shadcn/ui/sonner.tsx +11 -11
- package/src/shadcn/ui/switch.tsx +9 -9
- package/src/shadcn/ui/table.tsx +32 -32
- package/src/shadcn/ui/tabs.tsx +14 -14
- package/src/shadcn/ui/textarea.tsx +7 -7
- package/src/shadcn/ui/toggle-group.tsx +17 -17
- package/src/shadcn/ui/toggle.tsx +16 -16
- package/src/shadcn/ui/tooltip.tsx +11 -11
- package/src/stories/FileUploader.stories.tsx +23 -4
- package/src/stories/kit/builder/DataTable.Basic.stories.tsx +14 -4
- package/src/stories/kit/builder/DataTable.Filters.stories.tsx +36 -14
- package/src/stories/kit/builder/DataTable.Pagination.stories.tsx +3 -2
- package/src/stories/kit/builder/DataTable.SelectionAndActions.stories.tsx +18 -4
- package/src/stories/kit/builder/DataTable.Sorting.stories.tsx +18 -7
- package/src/stories/kit/builder/Dialog.stories.tsx +19 -13
- package/src/stories/kit/builder/Form.ArrayLayouts.stories.tsx +40 -16
- package/src/stories/kit/builder/Form.Autocomplete.stories.tsx +34 -22
- package/src/stories/kit/builder/Form.Basic.stories.tsx +38 -6
- package/src/stories/kit/builder/Form.Complex.stories.tsx +356 -111
- package/src/stories/kit/builder/Form.DateTime.stories.tsx +12 -8
- package/src/stories/kit/builder/Form.Dynamic.stories.tsx +695 -132
- package/src/stories/kit/builder/Form.Files.stories.tsx +37 -26
- package/src/stories/kit/builder/Form.MultipleFormBuilder.stories.tsx +46 -42
- package/src/stories/kit/builder/Form.Pickers.stories.tsx +12 -8
- package/src/stories/kit/builder/Form.Simple.stories.tsx +15 -6
- package/src/stories/kit/builder/Form.Time.stories.tsx +12 -8
- package/src/stories/kit/builder/Page.stories.tsx +32 -6
- package/src/stories/kit/builder/Section.stories.tsx +58 -11
- package/src/stories/kit/components/Autocomplete.stories.tsx +55 -22
- package/src/stories/kit/components/DatePicker.stories.tsx +80 -13
- package/src/stories/kit/components/DateRangePicker.stories.tsx +52 -11
- package/src/stories/kit/components/Login.stories.tsx +8 -2
- package/src/stories/kit/components/MonthPicker.stories.tsx +26 -6
- package/src/stories/kit/components/MonthRangePicker.stories.tsx +24 -5
- package/src/stories/kit/components/TimePicker.stories.tsx +18 -16
- package/src/stories/kit/components/TimeRangePicker.stories.tsx +18 -12
- package/src/stories/kit/layouts/admin/AdminLayout.Basic.stories.tsx +29 -6
- package/src/stories/kit/layouts/admin/AdminLayout.Collapsible.stories.tsx +26 -5
- package/src/stories/kit/layouts/admin/AdminLayout.Complex.stories.tsx +101 -18
- package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarHeaderComponent.stories.tsx +18 -4
- package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarTitleAndIcon.stories.tsx +17 -4
- package/src/stories/kit/layouts/admin/AdminLayout.HeaderSlots.stories.tsx +28 -6
- package/src/stories/shadcn/ui/Accordion.stories.tsx +33 -10
- package/src/stories/shadcn/ui/AlertDialog.stories.tsx +3 -1
- package/src/stories/shadcn/ui/Button.stories.tsx +3 -1
- package/src/stories/shadcn/ui/Calendar.stories.tsx +6 -1
- package/src/stories/shadcn/ui/Card.stories.tsx +11 -2
- package/src/stories/shadcn/ui/Checkbox.stories.tsx +11 -3
- package/src/stories/shadcn/ui/Collapsible.stories.tsx +12 -5
- package/src/stories/shadcn/ui/ContextMenu.stories.tsx +12 -4
- package/src/stories/shadcn/ui/Dialog.stories.tsx +15 -3
- package/src/stories/shadcn/ui/Drawer.stories.tsx +5 -2
- package/src/stories/shadcn/ui/DropdownMenu.stories.tsx +15 -5
- package/src/stories/shadcn/ui/Form.stories.tsx +5 -2
- package/src/stories/shadcn/ui/HoverCard.stories.tsx +8 -2
- package/src/stories/shadcn/ui/Input.stories.tsx +3 -1
- package/src/stories/shadcn/ui/InputOtp.stories.tsx +9 -2
- package/src/stories/shadcn/ui/Menubar.stories.tsx +21 -7
- package/src/stories/shadcn/ui/NavigationMenu.stories.tsx +30 -5
- package/src/stories/shadcn/ui/Popover.stories.tsx +8 -2
- package/src/stories/shadcn/ui/Resizable.stories.tsx +17 -5
- package/src/stories/shadcn/ui/ScrollArea.stories.tsx +54 -2
- package/src/stories/shadcn/ui/Select.stories.tsx +7 -1
- package/src/stories/shadcn/ui/Sheet.stories.tsx +2 -1
- package/src/stories/shadcn/ui/Sidebar.stories.tsx +13 -2
- package/src/stories/shadcn/ui/Sonner.stories.tsx +12 -2
- package/src/stories/shadcn/ui/Table.stories.tsx +86 -27
- package/src/stories/shadcn/ui/Tabs.stories.tsx +9 -2
- package/src/stories/shadcn/ui/Textarea.stories.tsx +3 -1
- package/src/stories/shadcn/ui/Toggle.stories.tsx +10 -2
- package/src/stories/shadcn/ui/Tooltip.stories.tsx +6 -1
- package/tsconfig.json +1 -5
- package/tsconfig.tsbuildinfo +1 -0
- package/eslint.config.mjs +0 -19
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import React__default, { forwardRef, createElement, memo as memo$1, useRef, useCallback, useEffect, useMemo, useLayoutEffect, useReducer, cloneElement, Component, useState, createContext, useContext, useImperativeHandle,
|
|
3
|
+
import React__default, { forwardRef, createElement, Fragment as Fragment$1, memo as memo$1, useRef, useCallback, useEffect, useMemo, useLayoutEffect, useReducer, cloneElement, Component, useState, createContext, useContext, useImperativeHandle, use, isValidElement, PureComponent } from "react";
|
|
4
4
|
import * as ReactDOM from "react-dom";
|
|
5
5
|
import ReactDOM__default from "react-dom";
|
|
6
6
|
import { useLocation, Link as Link$1 } from "@tanstack/react-router";
|
|
@@ -10135,128 +10135,6 @@ function useForm(props2 = {}) {
|
|
|
10135
10135
|
_formControl.current.formState = getProxyFormState(formState, control);
|
|
10136
10136
|
return _formControl.current;
|
|
10137
10137
|
}
|
|
10138
|
-
function Card({ className, ...props2 }) {
|
|
10139
|
-
return /* @__PURE__ */ jsx(
|
|
10140
|
-
"div",
|
|
10141
|
-
{
|
|
10142
|
-
"data-slot": "card",
|
|
10143
|
-
className: cn$1(
|
|
10144
|
-
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border border-border py-6 shadow-sm",
|
|
10145
|
-
className
|
|
10146
|
-
),
|
|
10147
|
-
...props2
|
|
10148
|
-
}
|
|
10149
|
-
);
|
|
10150
|
-
}
|
|
10151
|
-
function CardHeader({ className, ...props2 }) {
|
|
10152
|
-
return /* @__PURE__ */ jsx(
|
|
10153
|
-
"div",
|
|
10154
|
-
{
|
|
10155
|
-
"data-slot": "card-header",
|
|
10156
|
-
className: cn$1(
|
|
10157
|
-
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
10158
|
-
className
|
|
10159
|
-
),
|
|
10160
|
-
...props2
|
|
10161
|
-
}
|
|
10162
|
-
);
|
|
10163
|
-
}
|
|
10164
|
-
function CardTitle({ className, ...props2 }) {
|
|
10165
|
-
return /* @__PURE__ */ jsx(
|
|
10166
|
-
"div",
|
|
10167
|
-
{
|
|
10168
|
-
"data-slot": "card-title",
|
|
10169
|
-
className: cn$1("leading-none font-semibold", className),
|
|
10170
|
-
...props2
|
|
10171
|
-
}
|
|
10172
|
-
);
|
|
10173
|
-
}
|
|
10174
|
-
function CardDescription({ className, ...props2 }) {
|
|
10175
|
-
return /* @__PURE__ */ jsx(
|
|
10176
|
-
"div",
|
|
10177
|
-
{
|
|
10178
|
-
"data-slot": "card-description",
|
|
10179
|
-
className: cn$1("text-muted-foreground text-sm", className),
|
|
10180
|
-
...props2
|
|
10181
|
-
}
|
|
10182
|
-
);
|
|
10183
|
-
}
|
|
10184
|
-
function CardAction({ className, ...props2 }) {
|
|
10185
|
-
return /* @__PURE__ */ jsx(
|
|
10186
|
-
"div",
|
|
10187
|
-
{
|
|
10188
|
-
"data-slot": "card-action",
|
|
10189
|
-
className: cn$1(
|
|
10190
|
-
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
10191
|
-
className
|
|
10192
|
-
),
|
|
10193
|
-
...props2
|
|
10194
|
-
}
|
|
10195
|
-
);
|
|
10196
|
-
}
|
|
10197
|
-
function CardContent({ className, ...props2 }) {
|
|
10198
|
-
return /* @__PURE__ */ jsx(
|
|
10199
|
-
"div",
|
|
10200
|
-
{
|
|
10201
|
-
"data-slot": "card-content",
|
|
10202
|
-
className: cn$1("px-6", className),
|
|
10203
|
-
...props2
|
|
10204
|
-
}
|
|
10205
|
-
);
|
|
10206
|
-
}
|
|
10207
|
-
function CardFooter({ className, ...props2 }) {
|
|
10208
|
-
return /* @__PURE__ */ jsx(
|
|
10209
|
-
"div",
|
|
10210
|
-
{
|
|
10211
|
-
"data-slot": "card-footer",
|
|
10212
|
-
className: cn$1("flex items-center px-6 [.border-t]:pt-6", className),
|
|
10213
|
-
...props2
|
|
10214
|
-
}
|
|
10215
|
-
);
|
|
10216
|
-
}
|
|
10217
|
-
var NAME$5 = "Separator";
|
|
10218
|
-
var DEFAULT_ORIENTATION = "horizontal";
|
|
10219
|
-
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
10220
|
-
var Separator$3 = React.forwardRef((props2, forwardedRef) => {
|
|
10221
|
-
const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props2;
|
|
10222
|
-
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
|
|
10223
|
-
const ariaOrientation = orientation === "vertical" ? orientation : void 0;
|
|
10224
|
-
const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
|
|
10225
|
-
return /* @__PURE__ */ jsx(
|
|
10226
|
-
Primitive.div,
|
|
10227
|
-
{
|
|
10228
|
-
"data-orientation": orientation,
|
|
10229
|
-
...semanticProps,
|
|
10230
|
-
...domProps,
|
|
10231
|
-
ref: forwardedRef
|
|
10232
|
-
}
|
|
10233
|
-
);
|
|
10234
|
-
});
|
|
10235
|
-
Separator$3.displayName = NAME$5;
|
|
10236
|
-
function isValidOrientation(orientation) {
|
|
10237
|
-
return ORIENTATIONS.includes(orientation);
|
|
10238
|
-
}
|
|
10239
|
-
var Root$e = Separator$3;
|
|
10240
|
-
function Separator$2({
|
|
10241
|
-
className,
|
|
10242
|
-
orientation = "horizontal",
|
|
10243
|
-
decorative = true,
|
|
10244
|
-
...props2
|
|
10245
|
-
}) {
|
|
10246
|
-
return /* @__PURE__ */ jsx(
|
|
10247
|
-
Root$e,
|
|
10248
|
-
{
|
|
10249
|
-
"data-slot": "separator",
|
|
10250
|
-
decorative,
|
|
10251
|
-
orientation,
|
|
10252
|
-
className: cn$1(
|
|
10253
|
-
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
10254
|
-
className
|
|
10255
|
-
),
|
|
10256
|
-
...props2
|
|
10257
|
-
}
|
|
10258
|
-
);
|
|
10259
|
-
}
|
|
10260
10138
|
function useCallbackRef$2(callback) {
|
|
10261
10139
|
const callbackRef = React.useRef(callback);
|
|
10262
10140
|
React.useEffect(() => {
|
|
@@ -10474,7 +10352,7 @@ function focusFirst$3(candidates, preventScroll = false) {
|
|
|
10474
10352
|
function wrapArray$3(array2, startIndex) {
|
|
10475
10353
|
return array2.map((_2, index2) => array2[(startIndex + index2) % array2.length]);
|
|
10476
10354
|
}
|
|
10477
|
-
var Root$
|
|
10355
|
+
var Root$e = RovingFocusGroup;
|
|
10478
10356
|
var Item$2 = RovingFocusGroupItem;
|
|
10479
10357
|
var TABS_NAME = "Tabs";
|
|
10480
10358
|
var [createTabsContext] = createContextScope(TABS_NAME, [
|
|
@@ -10532,7 +10410,7 @@ var TabsList$1 = React.forwardRef(
|
|
|
10532
10410
|
const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);
|
|
10533
10411
|
const rovingFocusGroupScope = useRovingFocusGroupScope$4(__scopeTabs);
|
|
10534
10412
|
return /* @__PURE__ */ jsx(
|
|
10535
|
-
Root$
|
|
10413
|
+
Root$e,
|
|
10536
10414
|
{
|
|
10537
10415
|
asChild: true,
|
|
10538
10416
|
...rovingFocusGroupScope,
|
|
@@ -10708,6 +10586,169 @@ function TabsContent({
|
|
|
10708
10586
|
}
|
|
10709
10587
|
);
|
|
10710
10588
|
}
|
|
10589
|
+
function Card({ className, ...props2 }) {
|
|
10590
|
+
return /* @__PURE__ */ jsx(
|
|
10591
|
+
"div",
|
|
10592
|
+
{
|
|
10593
|
+
"data-slot": "card",
|
|
10594
|
+
className: cn$1(
|
|
10595
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border border-border py-6 shadow-sm",
|
|
10596
|
+
className
|
|
10597
|
+
),
|
|
10598
|
+
...props2
|
|
10599
|
+
}
|
|
10600
|
+
);
|
|
10601
|
+
}
|
|
10602
|
+
function CardHeader({ className, ...props2 }) {
|
|
10603
|
+
return /* @__PURE__ */ jsx(
|
|
10604
|
+
"div",
|
|
10605
|
+
{
|
|
10606
|
+
"data-slot": "card-header",
|
|
10607
|
+
className: cn$1(
|
|
10608
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
10609
|
+
className
|
|
10610
|
+
),
|
|
10611
|
+
...props2
|
|
10612
|
+
}
|
|
10613
|
+
);
|
|
10614
|
+
}
|
|
10615
|
+
function CardTitle({ className, ...props2 }) {
|
|
10616
|
+
return /* @__PURE__ */ jsx(
|
|
10617
|
+
"div",
|
|
10618
|
+
{
|
|
10619
|
+
"data-slot": "card-title",
|
|
10620
|
+
className: cn$1("leading-none font-semibold", className),
|
|
10621
|
+
...props2
|
|
10622
|
+
}
|
|
10623
|
+
);
|
|
10624
|
+
}
|
|
10625
|
+
function CardDescription({ className, ...props2 }) {
|
|
10626
|
+
return /* @__PURE__ */ jsx(
|
|
10627
|
+
"div",
|
|
10628
|
+
{
|
|
10629
|
+
"data-slot": "card-description",
|
|
10630
|
+
className: cn$1("text-muted-foreground text-sm", className),
|
|
10631
|
+
...props2
|
|
10632
|
+
}
|
|
10633
|
+
);
|
|
10634
|
+
}
|
|
10635
|
+
function CardAction({ className, ...props2 }) {
|
|
10636
|
+
return /* @__PURE__ */ jsx(
|
|
10637
|
+
"div",
|
|
10638
|
+
{
|
|
10639
|
+
"data-slot": "card-action",
|
|
10640
|
+
className: cn$1(
|
|
10641
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
10642
|
+
className
|
|
10643
|
+
),
|
|
10644
|
+
...props2
|
|
10645
|
+
}
|
|
10646
|
+
);
|
|
10647
|
+
}
|
|
10648
|
+
function CardContent({ className, ...props2 }) {
|
|
10649
|
+
return /* @__PURE__ */ jsx(
|
|
10650
|
+
"div",
|
|
10651
|
+
{
|
|
10652
|
+
"data-slot": "card-content",
|
|
10653
|
+
className: cn$1("px-6", className),
|
|
10654
|
+
...props2
|
|
10655
|
+
}
|
|
10656
|
+
);
|
|
10657
|
+
}
|
|
10658
|
+
function CardFooter({ className, ...props2 }) {
|
|
10659
|
+
return /* @__PURE__ */ jsx(
|
|
10660
|
+
"div",
|
|
10661
|
+
{
|
|
10662
|
+
"data-slot": "card-footer",
|
|
10663
|
+
className: cn$1("flex items-center px-6 [.border-t]:pt-6", className),
|
|
10664
|
+
...props2
|
|
10665
|
+
}
|
|
10666
|
+
);
|
|
10667
|
+
}
|
|
10668
|
+
var NAME$5 = "Separator";
|
|
10669
|
+
var DEFAULT_ORIENTATION = "horizontal";
|
|
10670
|
+
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
10671
|
+
var Separator$3 = React.forwardRef((props2, forwardedRef) => {
|
|
10672
|
+
const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props2;
|
|
10673
|
+
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
|
|
10674
|
+
const ariaOrientation = orientation === "vertical" ? orientation : void 0;
|
|
10675
|
+
const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
|
|
10676
|
+
return /* @__PURE__ */ jsx(
|
|
10677
|
+
Primitive.div,
|
|
10678
|
+
{
|
|
10679
|
+
"data-orientation": orientation,
|
|
10680
|
+
...semanticProps,
|
|
10681
|
+
...domProps,
|
|
10682
|
+
ref: forwardedRef
|
|
10683
|
+
}
|
|
10684
|
+
);
|
|
10685
|
+
});
|
|
10686
|
+
Separator$3.displayName = NAME$5;
|
|
10687
|
+
function isValidOrientation(orientation) {
|
|
10688
|
+
return ORIENTATIONS.includes(orientation);
|
|
10689
|
+
}
|
|
10690
|
+
var Root$d = Separator$3;
|
|
10691
|
+
function Separator$2({
|
|
10692
|
+
className,
|
|
10693
|
+
orientation = "horizontal",
|
|
10694
|
+
decorative = true,
|
|
10695
|
+
...props2
|
|
10696
|
+
}) {
|
|
10697
|
+
return /* @__PURE__ */ jsx(
|
|
10698
|
+
Root$d,
|
|
10699
|
+
{
|
|
10700
|
+
"data-slot": "separator",
|
|
10701
|
+
decorative,
|
|
10702
|
+
orientation,
|
|
10703
|
+
className: cn$1(
|
|
10704
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
10705
|
+
className
|
|
10706
|
+
),
|
|
10707
|
+
...props2
|
|
10708
|
+
}
|
|
10709
|
+
);
|
|
10710
|
+
}
|
|
10711
|
+
const SectionContainer = ({
|
|
10712
|
+
title,
|
|
10713
|
+
description,
|
|
10714
|
+
variant = "card",
|
|
10715
|
+
className,
|
|
10716
|
+
headerClassName,
|
|
10717
|
+
contentClassName,
|
|
10718
|
+
children
|
|
10719
|
+
}) => {
|
|
10720
|
+
const renderHeader = () => {
|
|
10721
|
+
if (!title && !description) return null;
|
|
10722
|
+
return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-1", headerClassName), children: [
|
|
10723
|
+
title && /* @__PURE__ */ jsx("h3", { className: "text-lg font-medium leading-none", children: title }),
|
|
10724
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description })
|
|
10725
|
+
] });
|
|
10726
|
+
};
|
|
10727
|
+
const renderContent2 = () => /* @__PURE__ */ jsx("div", { className: cn$1("space-y-4", contentClassName), children });
|
|
10728
|
+
switch (variant) {
|
|
10729
|
+
case "card":
|
|
10730
|
+
return /* @__PURE__ */ jsxs(Card, { className, children: [
|
|
10731
|
+
(title || description) && /* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
10732
|
+
title && /* @__PURE__ */ jsx(CardTitle, { children: title }),
|
|
10733
|
+
description && /* @__PURE__ */ jsx(CardDescription, { children: description })
|
|
10734
|
+
] }),
|
|
10735
|
+
/* @__PURE__ */ jsx(CardContent, { children: renderContent2() })
|
|
10736
|
+
] });
|
|
10737
|
+
case "separator":
|
|
10738
|
+
return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-6", className), children: [
|
|
10739
|
+
(title || description) && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
10740
|
+
renderHeader(),
|
|
10741
|
+
/* @__PURE__ */ jsx(Separator$2, {})
|
|
10742
|
+
] }),
|
|
10743
|
+
renderContent2()
|
|
10744
|
+
] });
|
|
10745
|
+
default:
|
|
10746
|
+
return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-6", className), children: [
|
|
10747
|
+
renderHeader(),
|
|
10748
|
+
renderContent2()
|
|
10749
|
+
] });
|
|
10750
|
+
}
|
|
10751
|
+
};
|
|
10711
10752
|
const GRID_COLS = {
|
|
10712
10753
|
base: {
|
|
10713
10754
|
1: "grid-cols-1",
|
|
@@ -10902,7 +10943,10 @@ function shallowEqualLeaf(a2, b2) {
|
|
|
10902
10943
|
return a2.key === b2.key && a2.hidden === b2.hidden && a2.className === b2.className && a2.labelLayout === b2.labelLayout && a2.labelClassName === b2.labelClassName && a2.valueClassName === b2.valueClassName && a2.inlineLabelWidthClass === b2.inlineLabelWidthClass && shallowEqualSpan(a2.span, b2.span) && renderKeyEqual;
|
|
10903
10944
|
}
|
|
10904
10945
|
const SectionLeafRenderer = memo$1(
|
|
10905
|
-
function SectionLeafRenderer2({
|
|
10946
|
+
function SectionLeafRenderer2({
|
|
10947
|
+
leaf,
|
|
10948
|
+
renderLeaf
|
|
10949
|
+
}) {
|
|
10906
10950
|
if (leaf.hidden) return null;
|
|
10907
10951
|
const span = leafSpanClasses(leaf);
|
|
10908
10952
|
if (renderLeaf) {
|
|
@@ -10933,67 +10977,93 @@ const SectionLeafRenderer = memo$1(
|
|
|
10933
10977
|
},
|
|
10934
10978
|
(prev, next) => shallowEqualLeaf(prev.leaf, next.leaf) && prev.renderLeaf === next.renderLeaf
|
|
10935
10979
|
);
|
|
10936
|
-
function SectionNodeRenderer({
|
|
10980
|
+
function SectionNodeRenderer({
|
|
10981
|
+
node,
|
|
10982
|
+
renderLeaf
|
|
10983
|
+
}) {
|
|
10937
10984
|
var _a;
|
|
10938
10985
|
if (node.hidden) return null;
|
|
10939
10986
|
const layout = node.layout ?? "grid";
|
|
10940
10987
|
const containerClass = layout === "grid" ? gridClasses(node.grid) : layout === "flex" ? flexClasses(node.flex) : "";
|
|
10941
|
-
const SectionContainer = ({ children }) => {
|
|
10942
|
-
const title = node.title;
|
|
10943
|
-
const description = node.subtitle;
|
|
10944
|
-
const variant = node.variant ?? "card";
|
|
10945
|
-
const className = node.className;
|
|
10946
|
-
const headerClassName = node.headerClassName;
|
|
10947
|
-
const contentClassName = node.contentClassName;
|
|
10948
|
-
const renderHeader = () => {
|
|
10949
|
-
if (!title && !description) return null;
|
|
10950
|
-
return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-1", headerClassName), children: [
|
|
10951
|
-
title && /* @__PURE__ */ jsx("h3", { className: "text-lg font-medium leading-none", children: title }),
|
|
10952
|
-
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description })
|
|
10953
|
-
] });
|
|
10954
|
-
};
|
|
10955
|
-
const renderContent2 = () => /* @__PURE__ */ jsx("div", { className: cn$1("space-y-4", contentClassName), children });
|
|
10956
|
-
switch (variant) {
|
|
10957
|
-
case "card":
|
|
10958
|
-
return /* @__PURE__ */ jsxs(Card, { className, children: [
|
|
10959
|
-
(title || description) && /* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
10960
|
-
title && /* @__PURE__ */ jsx(CardTitle, { children: title }),
|
|
10961
|
-
description && /* @__PURE__ */ jsx(CardDescription, { children: description })
|
|
10962
|
-
] }),
|
|
10963
|
-
/* @__PURE__ */ jsx(CardContent, { children: renderContent2() })
|
|
10964
|
-
] });
|
|
10965
|
-
case "separator":
|
|
10966
|
-
return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-6", className), children: [
|
|
10967
|
-
(title || description) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10968
|
-
renderHeader(),
|
|
10969
|
-
/* @__PURE__ */ jsx(Separator$2, {})
|
|
10970
|
-
] }),
|
|
10971
|
-
renderContent2()
|
|
10972
|
-
] });
|
|
10973
|
-
default:
|
|
10974
|
-
return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-6", className), children: [
|
|
10975
|
-
renderHeader(),
|
|
10976
|
-
renderContent2()
|
|
10977
|
-
] });
|
|
10978
|
-
}
|
|
10979
|
-
};
|
|
10980
10988
|
if (layout === "tabs" && node.tabs && node.tabs.length > 0) {
|
|
10981
10989
|
const defaultTabId = node.defaultTabId ?? ((_a = node.tabs[0]) == null ? void 0 : _a.id);
|
|
10982
|
-
return /* @__PURE__ */ jsx(
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
|
|
10990
|
+
return /* @__PURE__ */ jsx(
|
|
10991
|
+
SectionContainer,
|
|
10992
|
+
{
|
|
10993
|
+
title: node.title,
|
|
10994
|
+
description: node.subtitle,
|
|
10995
|
+
variant: node.variant,
|
|
10996
|
+
className: node.className,
|
|
10997
|
+
headerClassName: node.headerClassName,
|
|
10998
|
+
contentClassName: node.contentClassName,
|
|
10999
|
+
children: /* @__PURE__ */ jsxs(Tabs, { defaultValue: defaultTabId, className: cn$1("space-y-2"), children: [
|
|
11000
|
+
/* @__PURE__ */ jsx(TabsList, { className: cn$1(node.tabsListClassName), children: node.tabs.map((tab) => /* @__PURE__ */ jsx(
|
|
11001
|
+
TabsTrigger,
|
|
11002
|
+
{
|
|
11003
|
+
value: tab.id,
|
|
11004
|
+
className: cn$1(tab.className),
|
|
11005
|
+
children: tab.label
|
|
11006
|
+
},
|
|
11007
|
+
tab.id
|
|
11008
|
+
)) }),
|
|
11009
|
+
node.tabs.map((tab) => /* @__PURE__ */ jsx(
|
|
11010
|
+
TabsContent,
|
|
11011
|
+
{
|
|
11012
|
+
value: tab.id,
|
|
11013
|
+
className: cn$1(node.tabsContentClassName, tab.contentClassName),
|
|
11014
|
+
children: /* @__PURE__ */ jsx(SectionNodeRenderer, { node: tab.node, renderLeaf })
|
|
11015
|
+
},
|
|
11016
|
+
tab.id
|
|
11017
|
+
))
|
|
11018
|
+
] })
|
|
11019
|
+
}
|
|
11020
|
+
);
|
|
10986
11021
|
}
|
|
10987
|
-
return /* @__PURE__ */ jsx(
|
|
10988
|
-
|
|
10989
|
-
|
|
11022
|
+
return /* @__PURE__ */ jsx(
|
|
11023
|
+
SectionContainer,
|
|
11024
|
+
{
|
|
11025
|
+
title: node.title,
|
|
11026
|
+
description: node.subtitle,
|
|
11027
|
+
variant: node.variant,
|
|
11028
|
+
className: node.className,
|
|
11029
|
+
headerClassName: node.headerClassName,
|
|
11030
|
+
contentClassName: node.contentClassName,
|
|
11031
|
+
children: /* @__PURE__ */ jsx("div", { className: containerClass, children: (node.children ?? []).map((child) => {
|
|
11032
|
+
if (isLeaf(child)) {
|
|
11033
|
+
return /* @__PURE__ */ jsx(
|
|
11034
|
+
SectionLeafRenderer,
|
|
11035
|
+
{
|
|
11036
|
+
leaf: child,
|
|
11037
|
+
renderLeaf
|
|
11038
|
+
},
|
|
11039
|
+
child.key
|
|
11040
|
+
);
|
|
11041
|
+
}
|
|
11042
|
+
if (child.hidden) return null;
|
|
11043
|
+
return /* @__PURE__ */ jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsx(
|
|
11044
|
+
SectionNodeRenderer,
|
|
11045
|
+
{
|
|
11046
|
+
node: child,
|
|
11047
|
+
renderLeaf
|
|
11048
|
+
}
|
|
11049
|
+
) }, child.id);
|
|
11050
|
+
}) })
|
|
10990
11051
|
}
|
|
10991
|
-
|
|
10992
|
-
return /* @__PURE__ */ jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsx(SectionNodeRenderer, { node: child, renderLeaf }) }, child.id);
|
|
10993
|
-
}) }) });
|
|
11052
|
+
);
|
|
10994
11053
|
}
|
|
10995
|
-
function SectionBuilder({
|
|
10996
|
-
|
|
11054
|
+
function SectionBuilder({
|
|
11055
|
+
sections,
|
|
11056
|
+
className,
|
|
11057
|
+
renderLeaf
|
|
11058
|
+
}) {
|
|
11059
|
+
return /* @__PURE__ */ jsx("div", { className: cn$1("space-y-6", className), children: sections.map((section) => /* @__PURE__ */ jsx(
|
|
11060
|
+
SectionNodeRenderer,
|
|
11061
|
+
{
|
|
11062
|
+
node: section,
|
|
11063
|
+
renderLeaf
|
|
11064
|
+
},
|
|
11065
|
+
section.id
|
|
11066
|
+
)) });
|
|
10997
11067
|
}
|
|
10998
11068
|
var NAME$4 = "Label";
|
|
10999
11069
|
var Label$3 = React.forwardRef((props2, forwardedRef) => {
|
|
@@ -18464,7 +18534,9 @@ function Autocomplete({
|
|
|
18464
18534
|
pageSize
|
|
18465
18535
|
});
|
|
18466
18536
|
res.items.forEach(storeOption);
|
|
18467
|
-
setItems(
|
|
18537
|
+
setItems(
|
|
18538
|
+
(prev) => pageNum === 1 ? res.items : [...prev, ...res.items]
|
|
18539
|
+
);
|
|
18468
18540
|
setHasMore(!!res.hasMore);
|
|
18469
18541
|
} catch (_error) {
|
|
18470
18542
|
if (pageNum === 1) setItems([]);
|
|
@@ -18473,7 +18545,9 @@ function Autocomplete({
|
|
|
18473
18545
|
setLoading(false);
|
|
18474
18546
|
}
|
|
18475
18547
|
} else {
|
|
18476
|
-
const filtered = search ? options.filter(
|
|
18548
|
+
const filtered = search ? options.filter(
|
|
18549
|
+
(o2) => o2.label.toLowerCase().includes(search.toLowerCase())
|
|
18550
|
+
) : options;
|
|
18477
18551
|
options.forEach(storeOption);
|
|
18478
18552
|
const start = (pageNum - 1) * pageSize;
|
|
18479
18553
|
const slice = filtered.slice(start, start + pageSize);
|
|
@@ -18487,11 +18561,11 @@ function Autocomplete({
|
|
|
18487
18561
|
if (!isOpen) return;
|
|
18488
18562
|
setPage(1);
|
|
18489
18563
|
loadData(1, debouncedSearch);
|
|
18490
|
-
}, [isOpen, debouncedSearch]);
|
|
18564
|
+
}, [isOpen, debouncedSearch, loadData]);
|
|
18491
18565
|
useEffect(() => {
|
|
18492
18566
|
if (!isOpen || page <= 1) return;
|
|
18493
18567
|
loadData(page, debouncedSearch);
|
|
18494
|
-
}, [page]);
|
|
18568
|
+
}, [isOpen, page, loadData, debouncedSearch]);
|
|
18495
18569
|
useEffect(() => {
|
|
18496
18570
|
if (initialSelectedOptions) {
|
|
18497
18571
|
const arr = Array.isArray(initialSelectedOptions) ? initialSelectedOptions : [initialSelectedOptions];
|
|
@@ -18499,7 +18573,8 @@ function Autocomplete({
|
|
|
18499
18573
|
}
|
|
18500
18574
|
}, [initialSelectedOptions, storeOption]);
|
|
18501
18575
|
useEffect(() => {
|
|
18502
|
-
if (!currentValue || Array.isArray(currentValue) && currentValue.length === 0)
|
|
18576
|
+
if (!currentValue || Array.isArray(currentValue) && currentValue.length === 0)
|
|
18577
|
+
return;
|
|
18503
18578
|
const values = Array.isArray(currentValue) ? currentValue : [currentValue];
|
|
18504
18579
|
const missingValues = values.filter((v) => !labelMapRef.current.has(v));
|
|
18505
18580
|
if (missingValues.length === 0) return;
|
|
@@ -18511,7 +18586,7 @@ function Autocomplete({
|
|
|
18511
18586
|
});
|
|
18512
18587
|
}, [currentValue, options, storeOption]);
|
|
18513
18588
|
const hasLoadedInitial = useRef(false);
|
|
18514
|
-
const [
|
|
18589
|
+
const [, setLabelsLoadedCounter] = useState(0);
|
|
18515
18590
|
useEffect(() => {
|
|
18516
18591
|
if (!loadSelected || hasLoadedInitial.current) return;
|
|
18517
18592
|
if (!currentValue) return;
|
|
@@ -18534,7 +18609,7 @@ function Autocomplete({
|
|
|
18534
18609
|
return () => {
|
|
18535
18610
|
cancelled = true;
|
|
18536
18611
|
};
|
|
18537
|
-
}, []);
|
|
18612
|
+
}, [loadSelected, storeOption, currentValue]);
|
|
18538
18613
|
useEffect(() => {
|
|
18539
18614
|
if (!loadSelected || !isOpen) return;
|
|
18540
18615
|
const values = Array.isArray(currentValue) ? currentValue : currentValue ? [currentValue] : [];
|
|
@@ -18554,12 +18629,23 @@ function Autocomplete({
|
|
|
18554
18629
|
}, []);
|
|
18555
18630
|
const selectedItems = useMemo(() => {
|
|
18556
18631
|
if (!isMultiple) {
|
|
18557
|
-
if (currentValue === null || currentValue === void 0 || Array.isArray(currentValue))
|
|
18558
|
-
|
|
18632
|
+
if (currentValue === null || currentValue === void 0 || Array.isArray(currentValue))
|
|
18633
|
+
return [];
|
|
18634
|
+
return [
|
|
18635
|
+
{
|
|
18636
|
+
value: currentValue,
|
|
18637
|
+
label: getLabel2(currentValue),
|
|
18638
|
+
raw: rawMapRef.current.get(currentValue)
|
|
18639
|
+
}
|
|
18640
|
+
];
|
|
18559
18641
|
}
|
|
18560
18642
|
const values = Array.isArray(currentValue) ? currentValue : [];
|
|
18561
|
-
return values.map((v) => ({
|
|
18562
|
-
|
|
18643
|
+
return values.map((v) => ({
|
|
18644
|
+
value: v,
|
|
18645
|
+
label: getLabel2(v),
|
|
18646
|
+
raw: rawMapRef.current.get(v)
|
|
18647
|
+
}));
|
|
18648
|
+
}, [currentValue, isMultiple, getLabel2]);
|
|
18563
18649
|
const handleSelect = useCallback(
|
|
18564
18650
|
(item) => {
|
|
18565
18651
|
if (!item) return;
|
|
@@ -18573,7 +18659,11 @@ function Autocomplete({
|
|
|
18573
18659
|
}
|
|
18574
18660
|
const newValues = [...values, item.value];
|
|
18575
18661
|
if (!isControlled) setInternalValue(newValues);
|
|
18576
|
-
const newOptions = newValues.map((v) => ({
|
|
18662
|
+
const newOptions = newValues.map((v) => ({
|
|
18663
|
+
value: v,
|
|
18664
|
+
label: getLabel2(v),
|
|
18665
|
+
raw: rawMapRef.current.get(v)
|
|
18666
|
+
}));
|
|
18577
18667
|
const raws = newOptions.map((o2) => o2.raw).filter((r2) => r2 !== void 0);
|
|
18578
18668
|
onChange == null ? void 0 : onChange(newValues, newOptions, raws);
|
|
18579
18669
|
setClearCounter((c2) => c2 + 1);
|
|
@@ -18590,7 +18680,11 @@ function Autocomplete({
|
|
|
18590
18680
|
const values = Array.isArray(currentValue) ? currentValue : [];
|
|
18591
18681
|
const newValues = values.filter((v) => v !== valueToRemove);
|
|
18592
18682
|
if (!isControlled) setInternalValue(newValues);
|
|
18593
|
-
const newOptions = newValues.map((v) => ({
|
|
18683
|
+
const newOptions = newValues.map((v) => ({
|
|
18684
|
+
value: v,
|
|
18685
|
+
label: getLabel2(v),
|
|
18686
|
+
raw: rawMapRef.current.get(v)
|
|
18687
|
+
}));
|
|
18594
18688
|
const raws = newOptions.map((o2) => o2.raw).filter((r2) => r2 !== void 0);
|
|
18595
18689
|
onChange == null ? void 0 : onChange(newValues, newOptions, raws);
|
|
18596
18690
|
},
|
|
@@ -18611,7 +18705,11 @@ function Autocomplete({
|
|
|
18611
18705
|
if (values.includes(trimmed)) return;
|
|
18612
18706
|
const newValues = [...values, trimmed];
|
|
18613
18707
|
if (!isControlled) setInternalValue(newValues);
|
|
18614
|
-
const newOptions = newValues.map((v) => ({
|
|
18708
|
+
const newOptions = newValues.map((v) => ({
|
|
18709
|
+
value: v,
|
|
18710
|
+
label: getLabel2(v),
|
|
18711
|
+
raw: rawMapRef.current.get(v)
|
|
18712
|
+
}));
|
|
18615
18713
|
onChange == null ? void 0 : onChange(newValues, newOptions, []);
|
|
18616
18714
|
setSearchInput("");
|
|
18617
18715
|
} else {
|
|
@@ -18620,7 +18718,16 @@ function Autocomplete({
|
|
|
18620
18718
|
setSearchInput("");
|
|
18621
18719
|
setIsOpen(false);
|
|
18622
18720
|
}
|
|
18623
|
-
}, [
|
|
18721
|
+
}, [
|
|
18722
|
+
searchInput,
|
|
18723
|
+
allowCustomValue,
|
|
18724
|
+
isMultiple,
|
|
18725
|
+
currentValue,
|
|
18726
|
+
isControlled,
|
|
18727
|
+
onChange,
|
|
18728
|
+
getLabel2,
|
|
18729
|
+
storeOption
|
|
18730
|
+
]);
|
|
18624
18731
|
const computedInputValue = useMemo(() => {
|
|
18625
18732
|
if (isMultiple || isOpen) {
|
|
18626
18733
|
return searchInput;
|
|
@@ -18630,12 +18737,7 @@ function Autocomplete({
|
|
|
18630
18737
|
}
|
|
18631
18738
|
return "";
|
|
18632
18739
|
}, [isMultiple, isOpen, searchInput, selectedItems]);
|
|
18633
|
-
const {
|
|
18634
|
-
getInputProps,
|
|
18635
|
-
getItemProps,
|
|
18636
|
-
getMenuProps,
|
|
18637
|
-
highlightedIndex
|
|
18638
|
-
} = useCombobox({
|
|
18740
|
+
const { getInputProps, getItemProps, getMenuProps, highlightedIndex } = useCombobox({
|
|
18639
18741
|
items,
|
|
18640
18742
|
itemToString: (item) => (item == null ? void 0 : item.label) ?? "",
|
|
18641
18743
|
selectedItem: isMultiple ? null : selectedItems[0] ?? null,
|
|
@@ -18677,21 +18779,29 @@ function Autocomplete({
|
|
|
18677
18779
|
className
|
|
18678
18780
|
),
|
|
18679
18781
|
children: [
|
|
18680
|
-
isMultiple && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: selectedItems.map((item) => /* @__PURE__ */ jsxs(
|
|
18681
|
-
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
|
|
18692
|
-
|
|
18693
|
-
|
|
18694
|
-
|
|
18782
|
+
isMultiple && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: selectedItems.map((item) => /* @__PURE__ */ jsxs(
|
|
18783
|
+
Badge,
|
|
18784
|
+
{
|
|
18785
|
+
variant: chipVariant,
|
|
18786
|
+
className: cn$1("gap-1", chipClassName),
|
|
18787
|
+
children: [
|
|
18788
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[150px] truncate", children: item.label }),
|
|
18789
|
+
/* @__PURE__ */ jsx(
|
|
18790
|
+
"button",
|
|
18791
|
+
{
|
|
18792
|
+
type: "button",
|
|
18793
|
+
onClick: (e2) => {
|
|
18794
|
+
e2.stopPropagation();
|
|
18795
|
+
handleRemove(item.value);
|
|
18796
|
+
},
|
|
18797
|
+
className: "rounded-sm opacity-70 hover:opacity-100",
|
|
18798
|
+
children: /* @__PURE__ */ jsx(X$1, { className: "h-3 w-3" })
|
|
18799
|
+
}
|
|
18800
|
+
)
|
|
18801
|
+
]
|
|
18802
|
+
},
|
|
18803
|
+
item.value
|
|
18804
|
+
)) }),
|
|
18695
18805
|
/* @__PURE__ */ jsx(
|
|
18696
18806
|
"input",
|
|
18697
18807
|
{
|
|
@@ -18752,7 +18862,7 @@ function Autocomplete({
|
|
|
18752
18862
|
'Press Enter to add "',
|
|
18753
18863
|
searchInput.trim(),
|
|
18754
18864
|
'"'
|
|
18755
|
-
] }) : emptyText }) :
|
|
18865
|
+
] }) : emptyText }) : items.map((item, index2) => {
|
|
18756
18866
|
const isSelected = isMultiple ? Array.isArray(currentValue) && currentValue.includes(item.value) : currentValue === item.value;
|
|
18757
18867
|
const isHighlighted = highlightedIndex === index2;
|
|
18758
18868
|
return /* @__PURE__ */ jsxs(
|
|
@@ -18771,7 +18881,7 @@ function Autocomplete({
|
|
|
18771
18881
|
},
|
|
18772
18882
|
item.value
|
|
18773
18883
|
);
|
|
18774
|
-
})
|
|
18884
|
+
}),
|
|
18775
18885
|
hasMore && items.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center border-t py-2", children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18776
18886
|
/* @__PURE__ */ jsx(LoaderCircle, { className: "h-3 w-3 animate-spin mr-1" }),
|
|
18777
18887
|
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Loading more..." })
|
|
@@ -18783,13 +18893,26 @@ function Autocomplete({
|
|
|
18783
18893
|
)
|
|
18784
18894
|
] });
|
|
18785
18895
|
}
|
|
18786
|
-
function AutocompleteField({
|
|
18787
|
-
|
|
18788
|
-
|
|
18896
|
+
function AutocompleteField({
|
|
18897
|
+
field,
|
|
18898
|
+
value,
|
|
18899
|
+
onChange,
|
|
18900
|
+
className
|
|
18901
|
+
}) {
|
|
18902
|
+
const options = (field.options ?? []).filter(
|
|
18903
|
+
(o2) => o2.value !== null && o2.value !== void 0
|
|
18904
|
+
).map((o2) => ({
|
|
18905
|
+
label: o2.label,
|
|
18906
|
+
value: o2.value,
|
|
18907
|
+
raw: o2.raw
|
|
18908
|
+
}));
|
|
18909
|
+
let defaultValueShaped;
|
|
18789
18910
|
if (field.defaultValue !== void 0) {
|
|
18790
18911
|
if (field.multiple) {
|
|
18791
18912
|
if (Array.isArray(field.defaultValue)) {
|
|
18792
|
-
defaultValueShaped = field.defaultValue.filter(
|
|
18913
|
+
defaultValueShaped = field.defaultValue.filter(
|
|
18914
|
+
(v) => typeof v === "string" || typeof v === "number"
|
|
18915
|
+
);
|
|
18793
18916
|
} else if (field.defaultValue === null || field.defaultValue === void 0) {
|
|
18794
18917
|
defaultValueShaped = [];
|
|
18795
18918
|
} else if (typeof field.defaultValue === "string" || typeof field.defaultValue === "number") {
|
|
@@ -18842,7 +18965,13 @@ function Input({ className, type, ...props2 }) {
|
|
|
18842
18965
|
}
|
|
18843
18966
|
);
|
|
18844
18967
|
}
|
|
18845
|
-
function TextField({
|
|
18968
|
+
function TextField({
|
|
18969
|
+
field,
|
|
18970
|
+
fieldPath,
|
|
18971
|
+
value,
|
|
18972
|
+
onChange,
|
|
18973
|
+
className
|
|
18974
|
+
}) {
|
|
18846
18975
|
const type = field.type === "email" || field.type === "password" ? field.type : "text";
|
|
18847
18976
|
return /* @__PURE__ */ jsx(
|
|
18848
18977
|
Input,
|
|
@@ -18857,7 +18986,12 @@ function TextField({ field, fieldPath, value, onChange, className }) {
|
|
|
18857
18986
|
}
|
|
18858
18987
|
);
|
|
18859
18988
|
}
|
|
18860
|
-
function NumberField({
|
|
18989
|
+
function NumberField({
|
|
18990
|
+
field,
|
|
18991
|
+
value,
|
|
18992
|
+
onChange,
|
|
18993
|
+
className
|
|
18994
|
+
}) {
|
|
18861
18995
|
return /* @__PURE__ */ jsx(
|
|
18862
18996
|
Input,
|
|
18863
18997
|
{
|
|
@@ -18883,7 +19017,12 @@ function Textarea({ className, ...props2 }) {
|
|
|
18883
19017
|
}
|
|
18884
19018
|
);
|
|
18885
19019
|
}
|
|
18886
|
-
function TextareaField({
|
|
19020
|
+
function TextareaField({
|
|
19021
|
+
field,
|
|
19022
|
+
value,
|
|
19023
|
+
onChange,
|
|
19024
|
+
className
|
|
19025
|
+
}) {
|
|
18887
19026
|
return /* @__PURE__ */ jsx(
|
|
18888
19027
|
Textarea,
|
|
18889
19028
|
{
|
|
@@ -20223,7 +20362,12 @@ function SelectScrollDownButton({
|
|
|
20223
20362
|
);
|
|
20224
20363
|
}
|
|
20225
20364
|
const NULL_SENTINEL$1 = "__NULL__";
|
|
20226
|
-
function SelectField({
|
|
20365
|
+
function SelectField({
|
|
20366
|
+
field,
|
|
20367
|
+
value,
|
|
20368
|
+
onChange,
|
|
20369
|
+
className
|
|
20370
|
+
}) {
|
|
20227
20371
|
var _a;
|
|
20228
20372
|
const toUiValue = (val) => val === null || val === void 0 ? NULL_SENTINEL$1 : String(val);
|
|
20229
20373
|
const fromUiValue = (val) => {
|
|
@@ -20239,12 +20383,25 @@ function SelectField({ field, value, onChange, className }) {
|
|
|
20239
20383
|
disabled: field.disabled,
|
|
20240
20384
|
children: [
|
|
20241
20385
|
/* @__PURE__ */ jsx(SelectTrigger, { className, children: /* @__PURE__ */ jsx(SelectValue, { placeholder: field.placeholder }) }),
|
|
20242
|
-
/* @__PURE__ */ jsx(SelectContent, { children: (_a = field.options) == null ? void 0 : _a.map((option) => /* @__PURE__ */ jsx(
|
|
20386
|
+
/* @__PURE__ */ jsx(SelectContent, { children: (_a = field.options) == null ? void 0 : _a.map((option) => /* @__PURE__ */ jsx(
|
|
20387
|
+
SelectItem,
|
|
20388
|
+
{
|
|
20389
|
+
value: toUiValue(option.value),
|
|
20390
|
+
children: option.label
|
|
20391
|
+
},
|
|
20392
|
+
toUiValue(option.value)
|
|
20393
|
+
)) })
|
|
20243
20394
|
]
|
|
20244
20395
|
}
|
|
20245
20396
|
);
|
|
20246
20397
|
}
|
|
20247
|
-
function CheckboxField({
|
|
20398
|
+
function CheckboxField({
|
|
20399
|
+
field,
|
|
20400
|
+
fieldPath,
|
|
20401
|
+
value,
|
|
20402
|
+
onChange,
|
|
20403
|
+
className
|
|
20404
|
+
}) {
|
|
20248
20405
|
const placement = field.labelPlacement ?? "inline";
|
|
20249
20406
|
if (placement === "stacked") {
|
|
20250
20407
|
const labelId = `${fieldPath}-label`;
|
|
@@ -20289,10 +20446,17 @@ function CheckboxField({ field, fieldPath, value, onChange, className }) {
|
|
|
20289
20446
|
className: cn$1(className)
|
|
20290
20447
|
}
|
|
20291
20448
|
),
|
|
20292
|
-
/* @__PURE__ */ jsxs(
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20449
|
+
/* @__PURE__ */ jsxs(
|
|
20450
|
+
Label$2,
|
|
20451
|
+
{
|
|
20452
|
+
htmlFor: fieldPath,
|
|
20453
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
20454
|
+
children: [
|
|
20455
|
+
field.label,
|
|
20456
|
+
field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
20457
|
+
]
|
|
20458
|
+
}
|
|
20459
|
+
)
|
|
20296
20460
|
] });
|
|
20297
20461
|
}
|
|
20298
20462
|
var SWITCH_NAME = "Switch";
|
|
@@ -20460,7 +20624,13 @@ function Switch({
|
|
|
20460
20624
|
}
|
|
20461
20625
|
);
|
|
20462
20626
|
}
|
|
20463
|
-
function SwitchField({
|
|
20627
|
+
function SwitchField({
|
|
20628
|
+
field,
|
|
20629
|
+
fieldPath,
|
|
20630
|
+
value,
|
|
20631
|
+
onChange,
|
|
20632
|
+
className
|
|
20633
|
+
}) {
|
|
20464
20634
|
const placement = field.labelPlacement ?? "inline";
|
|
20465
20635
|
if (placement === "stacked") {
|
|
20466
20636
|
const labelId = `${fieldPath}-label`;
|
|
@@ -20505,10 +20675,17 @@ function SwitchField({ field, fieldPath, value, onChange, className }) {
|
|
|
20505
20675
|
className: cn$1(className)
|
|
20506
20676
|
}
|
|
20507
20677
|
),
|
|
20508
|
-
/* @__PURE__ */ jsxs(
|
|
20509
|
-
|
|
20510
|
-
|
|
20511
|
-
|
|
20678
|
+
/* @__PURE__ */ jsxs(
|
|
20679
|
+
Label$2,
|
|
20680
|
+
{
|
|
20681
|
+
htmlFor: fieldPath,
|
|
20682
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
20683
|
+
children: [
|
|
20684
|
+
field.label,
|
|
20685
|
+
field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
20686
|
+
]
|
|
20687
|
+
}
|
|
20688
|
+
)
|
|
20512
20689
|
] });
|
|
20513
20690
|
}
|
|
20514
20691
|
var RADIO_NAME = "Radio";
|
|
@@ -20683,7 +20860,7 @@ var RadioGroup$2 = React.forwardRef(
|
|
|
20683
20860
|
value,
|
|
20684
20861
|
onValueChange: setValue,
|
|
20685
20862
|
children: /* @__PURE__ */ jsx(
|
|
20686
|
-
Root$
|
|
20863
|
+
Root$e,
|
|
20687
20864
|
{
|
|
20688
20865
|
asChild: true,
|
|
20689
20866
|
...rovingFocusGroupScope,
|
|
@@ -20817,7 +20994,13 @@ function RadioGroupItem({
|
|
|
20817
20994
|
);
|
|
20818
20995
|
}
|
|
20819
20996
|
const NULL_SENTINEL = "__NULL__";
|
|
20820
|
-
function RadioField({
|
|
20997
|
+
function RadioField({
|
|
20998
|
+
field,
|
|
20999
|
+
value,
|
|
21000
|
+
onChange,
|
|
21001
|
+
className,
|
|
21002
|
+
fieldPath
|
|
21003
|
+
}) {
|
|
20821
21004
|
var _a;
|
|
20822
21005
|
const toUiValue = (val) => val === null || val === void 0 ? NULL_SENTINEL : String(val);
|
|
20823
21006
|
const fromUiValue = (val) => {
|
|
@@ -20832,14 +21015,32 @@ function RadioField({ field, value, onChange, className, fieldPath }) {
|
|
|
20832
21015
|
onValueChange: (val) => onChange(fromUiValue(val)),
|
|
20833
21016
|
disabled: field.disabled,
|
|
20834
21017
|
className,
|
|
20835
|
-
children: (_a = field.options) == null ? void 0 : _a.map((option) => /* @__PURE__ */ jsxs(
|
|
20836
|
-
|
|
20837
|
-
|
|
20838
|
-
|
|
21018
|
+
children: (_a = field.options) == null ? void 0 : _a.map((option) => /* @__PURE__ */ jsxs(
|
|
21019
|
+
"div",
|
|
21020
|
+
{
|
|
21021
|
+
className: "flex items-center space-x-2",
|
|
21022
|
+
children: [
|
|
21023
|
+
/* @__PURE__ */ jsx(
|
|
21024
|
+
RadioGroupItem,
|
|
21025
|
+
{
|
|
21026
|
+
value: toUiValue(option.value),
|
|
21027
|
+
id: `${fieldPath}-${toUiValue(option.value)}`
|
|
21028
|
+
}
|
|
21029
|
+
),
|
|
21030
|
+
/* @__PURE__ */ jsx(Label$2, { htmlFor: `${fieldPath}-${toUiValue(option.value)}`, children: option.label })
|
|
21031
|
+
]
|
|
21032
|
+
},
|
|
21033
|
+
toUiValue(option.value)
|
|
21034
|
+
))
|
|
20839
21035
|
}
|
|
20840
21036
|
);
|
|
20841
21037
|
}
|
|
20842
|
-
function DateField({
|
|
21038
|
+
function DateField({
|
|
21039
|
+
field,
|
|
21040
|
+
value,
|
|
21041
|
+
onChange,
|
|
21042
|
+
className
|
|
21043
|
+
}) {
|
|
20843
21044
|
return /* @__PURE__ */ jsx(
|
|
20844
21045
|
Input,
|
|
20845
21046
|
{
|
|
@@ -24883,7 +25084,11 @@ function DatePicker({
|
|
|
24883
25084
|
if (inDisabled$3(date2, disabledDates)) return true;
|
|
24884
25085
|
return false;
|
|
24885
25086
|
};
|
|
24886
|
-
const label = value ? format2 ? format2(value) : value.toLocaleDateString(void 0, {
|
|
25087
|
+
const label = value ? format2 ? format2(value) : value.toLocaleDateString(void 0, {
|
|
25088
|
+
year: "numeric",
|
|
25089
|
+
month: "short",
|
|
25090
|
+
day: "2-digit"
|
|
25091
|
+
}) : placeholder;
|
|
24887
25092
|
return /* @__PURE__ */ jsx("div", { className: cn$1("w-fit", className), ...props2, children: /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: setOpen, children: [
|
|
24888
25093
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
24889
25094
|
Button$1,
|
|
@@ -24891,7 +25096,10 @@ function DatePicker({
|
|
|
24891
25096
|
type: "button",
|
|
24892
25097
|
disabled,
|
|
24893
25098
|
variant: buttonVariant,
|
|
24894
|
-
className: cn$1(
|
|
25099
|
+
className: cn$1(
|
|
25100
|
+
"w-[240px] justify-start text-left font-normal",
|
|
25101
|
+
!value && "text-muted-foreground"
|
|
25102
|
+
),
|
|
24895
25103
|
children: [
|
|
24896
25104
|
/* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
|
|
24897
25105
|
label
|
|
@@ -24947,7 +25155,12 @@ function DatePicker({
|
|
|
24947
25155
|
] }) });
|
|
24948
25156
|
}
|
|
24949
25157
|
DatePicker.displayName = "DatePicker";
|
|
24950
|
-
function DatePickerField({
|
|
25158
|
+
function DatePickerField({
|
|
25159
|
+
field,
|
|
25160
|
+
value,
|
|
25161
|
+
onChange,
|
|
25162
|
+
className
|
|
25163
|
+
}) {
|
|
24951
25164
|
const v = React.useMemo(() => {
|
|
24952
25165
|
if (!value) return null;
|
|
24953
25166
|
if (value instanceof Date) return value;
|
|
@@ -25070,8 +25283,10 @@ function DateRangePicker({
|
|
|
25070
25283
|
const lastDay = new Date(yyyy, mm, 0).getDate();
|
|
25071
25284
|
if (dd < 1 || dd > lastDay) return void 0;
|
|
25072
25285
|
const out = new Date(yyyy, mm - 1, dd);
|
|
25073
|
-
if (minDate && out < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()))
|
|
25074
|
-
|
|
25286
|
+
if (minDate && out < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()))
|
|
25287
|
+
return void 0;
|
|
25288
|
+
if (maxDate && out > new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()))
|
|
25289
|
+
return void 0;
|
|
25075
25290
|
if (inDisabled$2(out, disabledDates)) return void 0;
|
|
25076
25291
|
return out;
|
|
25077
25292
|
};
|
|
@@ -25118,16 +25333,22 @@ function DateRangePicker({
|
|
|
25118
25333
|
return out;
|
|
25119
25334
|
};
|
|
25120
25335
|
const defaultPresets = [
|
|
25121
|
-
{
|
|
25122
|
-
|
|
25123
|
-
|
|
25124
|
-
|
|
25125
|
-
|
|
25126
|
-
|
|
25127
|
-
|
|
25128
|
-
|
|
25129
|
-
|
|
25130
|
-
|
|
25336
|
+
{
|
|
25337
|
+
label: "Today",
|
|
25338
|
+
getRange: () => {
|
|
25339
|
+
const t2 = startOfDay2(/* @__PURE__ */ new Date());
|
|
25340
|
+
return { from: clamp2(t2), to: clamp2(t2) };
|
|
25341
|
+
}
|
|
25342
|
+
},
|
|
25343
|
+
{
|
|
25344
|
+
label: "Yesterday",
|
|
25345
|
+
getRange: () => {
|
|
25346
|
+
const t2 = startOfDay2(/* @__PURE__ */ new Date());
|
|
25347
|
+
const y = new Date(t2);
|
|
25348
|
+
y.setDate(t2.getDate() - 1);
|
|
25349
|
+
return { from: clamp2(y), to: clamp2(y) };
|
|
25350
|
+
}
|
|
25351
|
+
},
|
|
25131
25352
|
{
|
|
25132
25353
|
label: "Last 7 days",
|
|
25133
25354
|
getRange: () => {
|
|
@@ -25202,139 +25423,160 @@ function DateRangePicker({
|
|
|
25202
25423
|
type: "button",
|
|
25203
25424
|
disabled,
|
|
25204
25425
|
variant: buttonVariant,
|
|
25205
|
-
className: cn$1(
|
|
25426
|
+
className: cn$1(
|
|
25427
|
+
"w-[280px] justify-start text-left font-normal",
|
|
25428
|
+
!(value == null ? void 0 : value.from) && "text-muted-foreground"
|
|
25429
|
+
),
|
|
25206
25430
|
children: [
|
|
25207
25431
|
/* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
|
|
25208
25432
|
label
|
|
25209
25433
|
]
|
|
25210
25434
|
}
|
|
25211
25435
|
) }),
|
|
25212
|
-
/* @__PURE__ */ jsxs(
|
|
25213
|
-
|
|
25214
|
-
|
|
25215
|
-
|
|
25436
|
+
/* @__PURE__ */ jsxs(
|
|
25437
|
+
PopoverContent,
|
|
25438
|
+
{
|
|
25439
|
+
className: "w-auto p-4",
|
|
25440
|
+
align: "start",
|
|
25441
|
+
side: props2.popoverSide ?? "bottom",
|
|
25442
|
+
sideOffset: 8,
|
|
25443
|
+
children: [
|
|
25444
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-6 min-w-[900px]", children: [
|
|
25445
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 pr-2", children: [
|
|
25446
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 mb-4 rounded-md border border-input bg-background/50 px-2 py-1 w-fit mx-auto", children: [
|
|
25447
|
+
/* @__PURE__ */ jsx(
|
|
25448
|
+
"input",
|
|
25449
|
+
{
|
|
25450
|
+
type: "text",
|
|
25451
|
+
inputMode: "numeric",
|
|
25452
|
+
value: fromInput,
|
|
25453
|
+
onChange: (e2) => onFromChange(e2.target.value),
|
|
25454
|
+
onBlur: applyFromInput,
|
|
25455
|
+
placeholder: "dd/mm/yyyy",
|
|
25456
|
+
className: cn$1(
|
|
25457
|
+
"h-9 w-40 rounded-md border bg-background px-3 text-sm shadow-xs outline-hidden",
|
|
25458
|
+
fromInvalid ? "border-destructive ring-1 ring-destructive/50" : "border-input"
|
|
25459
|
+
)
|
|
25460
|
+
}
|
|
25461
|
+
),
|
|
25462
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "–" }),
|
|
25463
|
+
/* @__PURE__ */ jsx(
|
|
25464
|
+
"input",
|
|
25465
|
+
{
|
|
25466
|
+
type: "text",
|
|
25467
|
+
inputMode: "numeric",
|
|
25468
|
+
value: toInput,
|
|
25469
|
+
onChange: (e2) => onToChange(e2.target.value),
|
|
25470
|
+
onBlur: applyToInput,
|
|
25471
|
+
placeholder: "dd/mm/yyyy",
|
|
25472
|
+
className: cn$1(
|
|
25473
|
+
"h-9 w-40 rounded-md border bg-background px-3 text-sm shadow-xs outline-hidden",
|
|
25474
|
+
toInvalid ? "border-destructive ring-1 ring-destructive/50" : "border-input"
|
|
25475
|
+
)
|
|
25476
|
+
}
|
|
25477
|
+
)
|
|
25478
|
+
] }),
|
|
25479
|
+
/* @__PURE__ */ jsx(
|
|
25480
|
+
Calendar,
|
|
25481
|
+
{
|
|
25482
|
+
mode: "range",
|
|
25483
|
+
numberOfMonths,
|
|
25484
|
+
selected: selectedRange,
|
|
25485
|
+
onSelect: (range) => {
|
|
25486
|
+
if (disabled) return;
|
|
25487
|
+
if (!range) {
|
|
25488
|
+
setDraft(null);
|
|
25489
|
+
return;
|
|
25490
|
+
}
|
|
25491
|
+
const { from, to } = range;
|
|
25492
|
+
if (from && isDisabled(from)) {
|
|
25493
|
+
setDraft(null);
|
|
25494
|
+
return;
|
|
25495
|
+
}
|
|
25496
|
+
if (to && isDisabled(to)) {
|
|
25497
|
+
setDraft({ from, to: void 0 });
|
|
25498
|
+
return;
|
|
25499
|
+
}
|
|
25500
|
+
if (from && to && rangeContainsDisabled$1(from, to, disabledDates)) {
|
|
25501
|
+
setDraft(null);
|
|
25502
|
+
setFromTouched(true);
|
|
25503
|
+
setToTouched(true);
|
|
25504
|
+
setFromInput("");
|
|
25505
|
+
setToInput("");
|
|
25506
|
+
return;
|
|
25507
|
+
}
|
|
25508
|
+
setDraft(range);
|
|
25509
|
+
setFromTouched(false);
|
|
25510
|
+
setToTouched(false);
|
|
25511
|
+
setFromInput(fmt(from));
|
|
25512
|
+
setToInput(fmt(to));
|
|
25513
|
+
},
|
|
25514
|
+
defaultMonth: (selectedRange == null ? void 0 : selectedRange.from) ?? (value == null ? void 0 : value.from) ?? /* @__PURE__ */ new Date(),
|
|
25515
|
+
disabled: isDisabled,
|
|
25516
|
+
buttonVariant: "ghost",
|
|
25517
|
+
showOutsideDays: true
|
|
25518
|
+
}
|
|
25519
|
+
)
|
|
25520
|
+
] }),
|
|
25521
|
+
(props2.presetsPanel ?? true) && presets.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-64 border-l pl-4 max-h-[420px] overflow-auto", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: presets.map((p2) => {
|
|
25522
|
+
const pr = p2.getRange();
|
|
25523
|
+
const active = eqRange(draft, pr);
|
|
25524
|
+
return /* @__PURE__ */ jsxs(
|
|
25525
|
+
Button$1,
|
|
25526
|
+
{
|
|
25527
|
+
type: "button",
|
|
25528
|
+
size: "sm",
|
|
25529
|
+
variant: active ? "secondary" : "ghost",
|
|
25530
|
+
className: "justify-between w-full",
|
|
25531
|
+
onClick: () => {
|
|
25532
|
+
if (rangeContainsDisabled$1(pr.from, pr.to, disabledDates))
|
|
25533
|
+
return;
|
|
25534
|
+
setDraft(pr);
|
|
25535
|
+
setFromTouched(false);
|
|
25536
|
+
setToTouched(false);
|
|
25537
|
+
setFromInput(fmt(pr.from));
|
|
25538
|
+
setToInput(fmt(pr.to));
|
|
25539
|
+
},
|
|
25540
|
+
children: [
|
|
25541
|
+
p2.label,
|
|
25542
|
+
active ? "✓" : ""
|
|
25543
|
+
]
|
|
25544
|
+
},
|
|
25545
|
+
p2.label
|
|
25546
|
+
);
|
|
25547
|
+
}) }) })
|
|
25548
|
+
] }),
|
|
25549
|
+
(props2.showFooter ?? true) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2 pt-3 mt-3 border-t", children: [
|
|
25216
25550
|
/* @__PURE__ */ jsx(
|
|
25217
|
-
|
|
25551
|
+
Button$1,
|
|
25218
25552
|
{
|
|
25219
|
-
type: "
|
|
25220
|
-
|
|
25221
|
-
|
|
25222
|
-
|
|
25223
|
-
|
|
25224
|
-
|
|
25225
|
-
|
|
25226
|
-
"h-9 w-40 rounded-md border bg-background px-3 text-sm shadow-xs outline-hidden",
|
|
25227
|
-
fromInvalid ? "border-destructive ring-1 ring-destructive/50" : "border-input"
|
|
25228
|
-
)
|
|
25553
|
+
type: "button",
|
|
25554
|
+
variant: "ghost",
|
|
25555
|
+
onClick: () => {
|
|
25556
|
+
setDraft(value ?? null);
|
|
25557
|
+
setOpen(false);
|
|
25558
|
+
},
|
|
25559
|
+
children: props2.cancelLabel ?? "Cancel"
|
|
25229
25560
|
}
|
|
25230
25561
|
),
|
|
25231
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "–" }),
|
|
25232
25562
|
/* @__PURE__ */ jsx(
|
|
25233
|
-
|
|
25563
|
+
Button$1,
|
|
25234
25564
|
{
|
|
25235
|
-
type: "
|
|
25236
|
-
|
|
25237
|
-
|
|
25238
|
-
|
|
25239
|
-
|
|
25240
|
-
|
|
25241
|
-
|
|
25242
|
-
|
|
25243
|
-
|
|
25244
|
-
)
|
|
25565
|
+
type: "button",
|
|
25566
|
+
variant: "default",
|
|
25567
|
+
onClick: () => {
|
|
25568
|
+
if (invalidRange || !mergedFrom || !mergedTo) return;
|
|
25569
|
+
onChange == null ? void 0 : onChange({ from: mergedFrom, to: mergedTo });
|
|
25570
|
+
setOpen(false);
|
|
25571
|
+
},
|
|
25572
|
+
disabled: disabled || invalidRange,
|
|
25573
|
+
children: props2.applyLabel ?? "Update"
|
|
25245
25574
|
}
|
|
25246
25575
|
)
|
|
25247
|
-
] })
|
|
25248
|
-
|
|
25249
|
-
|
|
25250
|
-
|
|
25251
|
-
mode: "range",
|
|
25252
|
-
numberOfMonths,
|
|
25253
|
-
selected: selectedRange,
|
|
25254
|
-
onSelect: (range) => {
|
|
25255
|
-
if (disabled) return;
|
|
25256
|
-
if (!range) {
|
|
25257
|
-
setDraft(null);
|
|
25258
|
-
return;
|
|
25259
|
-
}
|
|
25260
|
-
const { from, to } = range;
|
|
25261
|
-
if (from && isDisabled(from)) {
|
|
25262
|
-
setDraft(null);
|
|
25263
|
-
return;
|
|
25264
|
-
}
|
|
25265
|
-
if (to && isDisabled(to)) {
|
|
25266
|
-
setDraft({ from, to: void 0 });
|
|
25267
|
-
return;
|
|
25268
|
-
}
|
|
25269
|
-
if (from && to && rangeContainsDisabled$1(from, to, disabledDates)) {
|
|
25270
|
-
setDraft(null);
|
|
25271
|
-
setFromTouched(true);
|
|
25272
|
-
setToTouched(true);
|
|
25273
|
-
setFromInput("");
|
|
25274
|
-
setToInput("");
|
|
25275
|
-
return;
|
|
25276
|
-
}
|
|
25277
|
-
setDraft(range);
|
|
25278
|
-
setFromTouched(false);
|
|
25279
|
-
setToTouched(false);
|
|
25280
|
-
setFromInput(fmt(from));
|
|
25281
|
-
setToInput(fmt(to));
|
|
25282
|
-
},
|
|
25283
|
-
defaultMonth: (selectedRange == null ? void 0 : selectedRange.from) ?? (value == null ? void 0 : value.from) ?? /* @__PURE__ */ new Date(),
|
|
25284
|
-
disabled: isDisabled,
|
|
25285
|
-
buttonVariant: "ghost",
|
|
25286
|
-
showOutsideDays: true
|
|
25287
|
-
}
|
|
25288
|
-
)
|
|
25289
|
-
] }),
|
|
25290
|
-
(props2.presetsPanel ?? true) && presets.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-64 border-l pl-4 max-h-[420px] overflow-auto", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: presets.map((p2) => {
|
|
25291
|
-
const pr = p2.getRange();
|
|
25292
|
-
const active = eqRange(draft, pr);
|
|
25293
|
-
return /* @__PURE__ */ jsxs(
|
|
25294
|
-
Button$1,
|
|
25295
|
-
{
|
|
25296
|
-
type: "button",
|
|
25297
|
-
size: "sm",
|
|
25298
|
-
variant: active ? "secondary" : "ghost",
|
|
25299
|
-
className: "justify-between w-full",
|
|
25300
|
-
onClick: () => {
|
|
25301
|
-
if (rangeContainsDisabled$1(pr.from, pr.to, disabledDates)) return;
|
|
25302
|
-
setDraft(pr);
|
|
25303
|
-
setFromTouched(false);
|
|
25304
|
-
setToTouched(false);
|
|
25305
|
-
setFromInput(fmt(pr.from));
|
|
25306
|
-
setToInput(fmt(pr.to));
|
|
25307
|
-
},
|
|
25308
|
-
children: [
|
|
25309
|
-
p2.label,
|
|
25310
|
-
active ? "✓" : ""
|
|
25311
|
-
]
|
|
25312
|
-
},
|
|
25313
|
-
p2.label
|
|
25314
|
-
);
|
|
25315
|
-
}) }) })
|
|
25316
|
-
] }),
|
|
25317
|
-
(props2.showFooter ?? true) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2 pt-3 mt-3 border-t", children: [
|
|
25318
|
-
/* @__PURE__ */ jsx(Button$1, { type: "button", variant: "ghost", onClick: () => {
|
|
25319
|
-
setDraft(value ?? null);
|
|
25320
|
-
setOpen(false);
|
|
25321
|
-
}, children: props2.cancelLabel ?? "Cancel" }),
|
|
25322
|
-
/* @__PURE__ */ jsx(
|
|
25323
|
-
Button$1,
|
|
25324
|
-
{
|
|
25325
|
-
type: "button",
|
|
25326
|
-
variant: "default",
|
|
25327
|
-
onClick: () => {
|
|
25328
|
-
if (invalidRange || !mergedFrom || !mergedTo) return;
|
|
25329
|
-
onChange == null ? void 0 : onChange({ from: mergedFrom, to: mergedTo });
|
|
25330
|
-
setOpen(false);
|
|
25331
|
-
},
|
|
25332
|
-
disabled: disabled || invalidRange,
|
|
25333
|
-
children: props2.applyLabel ?? "Update"
|
|
25334
|
-
}
|
|
25335
|
-
)
|
|
25336
|
-
] })
|
|
25337
|
-
] })
|
|
25576
|
+
] })
|
|
25577
|
+
]
|
|
25578
|
+
}
|
|
25579
|
+
)
|
|
25338
25580
|
] }) });
|
|
25339
25581
|
}
|
|
25340
25582
|
DateRangePicker.displayName = "DateRangePicker";
|
|
@@ -25344,7 +25586,12 @@ function coerceDate(input) {
|
|
|
25344
25586
|
const d = new Date(input);
|
|
25345
25587
|
return Number.isNaN(d.getTime()) ? void 0 : d;
|
|
25346
25588
|
}
|
|
25347
|
-
function DateRangePickerField({
|
|
25589
|
+
function DateRangePickerField({
|
|
25590
|
+
field,
|
|
25591
|
+
value,
|
|
25592
|
+
onChange,
|
|
25593
|
+
className
|
|
25594
|
+
}) {
|
|
25348
25595
|
const v = React.useMemo(() => {
|
|
25349
25596
|
if (!value) return null;
|
|
25350
25597
|
if (typeof value === "object" && value !== null) {
|
|
@@ -25479,42 +25726,40 @@ function MonthCal({
|
|
|
25479
25726
|
)
|
|
25480
25727
|
] })
|
|
25481
25728
|
] }),
|
|
25482
|
-
/* @__PURE__ */ jsx("table", { className: "w-full border-collapse space-y-1", children: /* @__PURE__ */ jsx("tbody", { children: MONTHS$1.map((monthRow
|
|
25483
|
-
|
|
25484
|
-
|
|
25485
|
-
|
|
25486
|
-
|
|
25487
|
-
|
|
25488
|
-
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
|
|
25495
|
-
|
|
25496
|
-
|
|
25497
|
-
|
|
25498
|
-
|
|
25499
|
-
|
|
25500
|
-
|
|
25501
|
-
|
|
25502
|
-
|
|
25503
|
-
|
|
25504
|
-
|
|
25505
|
-
|
|
25506
|
-
|
|
25507
|
-
|
|
25508
|
-
|
|
25509
|
-
|
|
25510
|
-
|
|
25511
|
-
|
|
25512
|
-
|
|
25513
|
-
|
|
25514
|
-
|
|
25515
|
-
|
|
25516
|
-
}) }, `row-${a2}`)
|
|
25517
|
-
);
|
|
25729
|
+
/* @__PURE__ */ jsx("table", { className: "w-full border-collapse space-y-1", children: /* @__PURE__ */ jsx("tbody", { children: MONTHS$1.map((monthRow) => {
|
|
25730
|
+
const rowKey = monthRow.map((month2) => month2.number).join("-");
|
|
25731
|
+
return /* @__PURE__ */ jsx("tr", { className: "flex w-full mt-2", children: monthRow.map((m2) => {
|
|
25732
|
+
var _a, _b;
|
|
25733
|
+
return /* @__PURE__ */ jsx(
|
|
25734
|
+
"td",
|
|
25735
|
+
{
|
|
25736
|
+
className: "h-10 w-1/4 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
|
|
25737
|
+
children: /* @__PURE__ */ jsx(
|
|
25738
|
+
"button",
|
|
25739
|
+
{
|
|
25740
|
+
type: "button",
|
|
25741
|
+
onClick: () => {
|
|
25742
|
+
setMonth2(m2.number);
|
|
25743
|
+
setYear2(menuYear);
|
|
25744
|
+
if (onMonthSelect)
|
|
25745
|
+
onMonthSelect(new Date(menuYear, m2.number));
|
|
25746
|
+
},
|
|
25747
|
+
disabled: (maxDate ? menuYear > (maxDate == null ? void 0 : maxDate.getFullYear()) || menuYear === (maxDate == null ? void 0 : maxDate.getFullYear()) && m2.number > maxDate.getMonth() : false) || (minDate ? menuYear < (minDate == null ? void 0 : minDate.getFullYear()) || menuYear === (minDate == null ? void 0 : minDate.getFullYear()) && m2.number < minDate.getMonth() : false) || (disabledDatesMapped ? disabledDatesMapped == null ? void 0 : disabledDatesMapped.some(
|
|
25748
|
+
(d) => d.year === menuYear && d.month === m2.number
|
|
25749
|
+
) : false),
|
|
25750
|
+
className: cn$1(
|
|
25751
|
+
buttonVariants({
|
|
25752
|
+
variant: month === m2.number && menuYear === year ? ((_a = variant == null ? void 0 : variant.calendar) == null ? void 0 : _a.selected) ?? "default" : ((_b = variant == null ? void 0 : variant.calendar) == null ? void 0 : _b.main) ?? "ghost"
|
|
25753
|
+
}),
|
|
25754
|
+
"h-full w-full p-0 font-normal aria-selected:opacity-100"
|
|
25755
|
+
),
|
|
25756
|
+
children: (callbacks == null ? void 0 : callbacks.monthLabel) ? callbacks.monthLabel(m2) : m2.name
|
|
25757
|
+
}
|
|
25758
|
+
)
|
|
25759
|
+
},
|
|
25760
|
+
`month-${m2.number}`
|
|
25761
|
+
);
|
|
25762
|
+
}) }, rowKey);
|
|
25518
25763
|
}) }) })
|
|
25519
25764
|
] });
|
|
25520
25765
|
}
|
|
@@ -25549,7 +25794,10 @@ function MonthInput({
|
|
|
25549
25794
|
type: "button",
|
|
25550
25795
|
disabled,
|
|
25551
25796
|
variant: buttonVariant,
|
|
25552
|
-
className: cn$1(
|
|
25797
|
+
className: cn$1(
|
|
25798
|
+
"w-[240px] justify-start text-left font-normal",
|
|
25799
|
+
!value && "text-muted-foreground"
|
|
25800
|
+
),
|
|
25553
25801
|
children: [
|
|
25554
25802
|
/* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
|
|
25555
25803
|
label
|
|
@@ -25604,7 +25852,12 @@ function MonthInput({
|
|
|
25604
25852
|
] }) });
|
|
25605
25853
|
}
|
|
25606
25854
|
MonthInput.displayName = "MonthInput";
|
|
25607
|
-
function MonthPickerField({
|
|
25855
|
+
function MonthPickerField({
|
|
25856
|
+
field,
|
|
25857
|
+
value,
|
|
25858
|
+
onChange,
|
|
25859
|
+
className
|
|
25860
|
+
}) {
|
|
25608
25861
|
var _a;
|
|
25609
25862
|
const v = React.useMemo(() => {
|
|
25610
25863
|
if (!value) return void 0;
|
|
@@ -25620,7 +25873,9 @@ function MonthPickerField({ field, value, onChange, className }) {
|
|
|
25620
25873
|
onChange: (d) => onChange(d),
|
|
25621
25874
|
minDate: field.minDate,
|
|
25622
25875
|
maxDate: field.maxDate,
|
|
25623
|
-
disabledDates: (_a = field.disabledDates) == null ? void 0 : _a.filter(
|
|
25876
|
+
disabledDates: (_a = field.disabledDates) == null ? void 0 : _a.filter(
|
|
25877
|
+
(it) => it instanceof Date
|
|
25878
|
+
),
|
|
25624
25879
|
showFooter: true,
|
|
25625
25880
|
clearLabel: field.cancelLabel,
|
|
25626
25881
|
closeLabel: field.applyLabel
|
|
@@ -25794,63 +26049,39 @@ function MonthRangeCal({
|
|
|
25794
26049
|
] }),
|
|
25795
26050
|
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: (callbacks == null ? void 0 : callbacks.yearLabel) ? callbacks == null ? void 0 : callbacks.yearLabel(menuYear + 1) : menuYear + 1 })
|
|
25796
26051
|
] }),
|
|
25797
|
-
/* @__PURE__ */ jsx("table", { className: "w-full border-collapse space-y-1", children: /* @__PURE__ */ jsx("tbody", { children: MONTHS.map((monthRow
|
|
25798
|
-
|
|
25799
|
-
|
|
25800
|
-
|
|
25801
|
-
|
|
25802
|
-
|
|
25803
|
-
|
|
25804
|
-
|
|
25805
|
-
|
|
26052
|
+
/* @__PURE__ */ jsx("table", { className: "w-full border-collapse space-y-1", children: /* @__PURE__ */ jsx("tbody", { children: MONTHS.map((monthRow) => {
|
|
26053
|
+
const rowKey = monthRow.map((month) => `${month.yearOffset}-${month.number}`).join("-");
|
|
26054
|
+
return /* @__PURE__ */ jsx("tr", { className: "flex w-full mt-2", children: monthRow.map((m2, i2) => {
|
|
26055
|
+
var _a2, _b2;
|
|
26056
|
+
return /* @__PURE__ */ jsx(
|
|
26057
|
+
"td",
|
|
26058
|
+
{
|
|
26059
|
+
className: cn$1(
|
|
26060
|
+
cn$1(
|
|
25806
26061
|
cn$1(
|
|
25807
26062
|
cn$1(
|
|
25808
|
-
|
|
25809
|
-
|
|
25810
|
-
(menuYear + m2.yearOffset > startYear || menuYear + m2.yearOffset === startYear && m2.number > startMonth) && (menuYear + m2.yearOffset < endYear || menuYear + m2.yearOffset === endYear && m2.number < endMonth) && (rangePending || endLocked) ? "text-accent-foreground bg-accent" : ""
|
|
25811
|
-
),
|
|
25812
|
-
menuYear + m2.yearOffset === startYear && m2.number === startMonth && (rangePending || endLocked) ? "text-accent-foreground bg-accent rounded-l-md" : ""
|
|
26063
|
+
"h-10 w-1/4 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
|
|
26064
|
+
(menuYear + m2.yearOffset > startYear || menuYear + m2.yearOffset === startYear && m2.number > startMonth) && (menuYear + m2.yearOffset < endYear || menuYear + m2.yearOffset === endYear && m2.number < endMonth) && (rangePending || endLocked) ? "text-accent-foreground bg-accent" : ""
|
|
25813
26065
|
),
|
|
25814
|
-
menuYear + m2.yearOffset ===
|
|
26066
|
+
menuYear + m2.yearOffset === startYear && m2.number === startMonth && (rangePending || endLocked) ? "text-accent-foreground bg-accent rounded-l-md" : ""
|
|
25815
26067
|
),
|
|
25816
|
-
|
|
26068
|
+
menuYear + m2.yearOffset === endYear && m2.number === endMonth && (rangePending || endLocked) && menuYear + m2.yearOffset >= startYear && m2.number >= startMonth ? "text-accent-foreground bg-accent rounded-r-md" : ""
|
|
25817
26069
|
),
|
|
25818
|
-
|
|
25819
|
-
|
|
25820
|
-
|
|
25821
|
-
|
|
25822
|
-
|
|
25823
|
-
|
|
25824
|
-
|
|
25825
|
-
|
|
25826
|
-
|
|
25827
|
-
|
|
25828
|
-
|
|
25829
|
-
|
|
25830
|
-
|
|
25831
|
-
|
|
25832
|
-
|
|
25833
|
-
setStartMonth(m2.number);
|
|
25834
|
-
setStartYear(menuYear + m2.yearOffset);
|
|
25835
|
-
setEndYear(menuYear + m2.yearOffset);
|
|
25836
|
-
setEndMonth(m2.number);
|
|
25837
|
-
if (onStartMonthSelect)
|
|
25838
|
-
onStartMonthSelect(
|
|
25839
|
-
new Date(menuYear + m2.yearOffset, m2.number)
|
|
25840
|
-
);
|
|
25841
|
-
} else {
|
|
25842
|
-
setRangePending(false);
|
|
25843
|
-
setEndLocked(true);
|
|
25844
|
-
if (onMonthRangeSelect)
|
|
25845
|
-
onMonthRangeSelect({
|
|
25846
|
-
start: new Date(startYear, startMonth),
|
|
25847
|
-
end: new Date(
|
|
25848
|
-
menuYear + m2.yearOffset,
|
|
25849
|
-
m2.number
|
|
25850
|
-
)
|
|
25851
|
-
});
|
|
25852
|
-
}
|
|
25853
|
-
} else {
|
|
26070
|
+
i2 === 3 ? "mr-2" : i2 === 4 ? "ml-2" : ""
|
|
26071
|
+
),
|
|
26072
|
+
onMouseEnter: () => {
|
|
26073
|
+
if (rangePending && !endLocked) {
|
|
26074
|
+
setEndYear(menuYear + m2.yearOffset);
|
|
26075
|
+
setEndMonth(m2.number);
|
|
26076
|
+
}
|
|
26077
|
+
},
|
|
26078
|
+
children: /* @__PURE__ */ jsx(
|
|
26079
|
+
"button",
|
|
26080
|
+
{
|
|
26081
|
+
type: "button",
|
|
26082
|
+
onClick: () => {
|
|
26083
|
+
if (rangePending) {
|
|
26084
|
+
if (menuYear + m2.yearOffset < startYear || menuYear + m2.yearOffset === startYear && m2.number < startMonth) {
|
|
25854
26085
|
setRangePending(true);
|
|
25855
26086
|
setEndLocked(false);
|
|
25856
26087
|
setStartMonth(m2.number);
|
|
@@ -25861,23 +26092,45 @@ function MonthRangeCal({
|
|
|
25861
26092
|
onStartMonthSelect(
|
|
25862
26093
|
new Date(menuYear + m2.yearOffset, m2.number)
|
|
25863
26094
|
);
|
|
26095
|
+
} else {
|
|
26096
|
+
setRangePending(false);
|
|
26097
|
+
setEndLocked(true);
|
|
26098
|
+
if (onMonthRangeSelect)
|
|
26099
|
+
onMonthRangeSelect({
|
|
26100
|
+
start: new Date(startYear, startMonth),
|
|
26101
|
+
end: new Date(
|
|
26102
|
+
menuYear + m2.yearOffset,
|
|
26103
|
+
m2.number
|
|
26104
|
+
)
|
|
26105
|
+
});
|
|
25864
26106
|
}
|
|
25865
|
-
}
|
|
25866
|
-
|
|
25867
|
-
|
|
25868
|
-
|
|
25869
|
-
|
|
25870
|
-
|
|
25871
|
-
|
|
25872
|
-
|
|
25873
|
-
|
|
25874
|
-
|
|
25875
|
-
|
|
25876
|
-
|
|
25877
|
-
|
|
25878
|
-
|
|
25879
|
-
|
|
25880
|
-
|
|
26107
|
+
} else {
|
|
26108
|
+
setRangePending(true);
|
|
26109
|
+
setEndLocked(false);
|
|
26110
|
+
setStartMonth(m2.number);
|
|
26111
|
+
setStartYear(menuYear + m2.yearOffset);
|
|
26112
|
+
setEndYear(menuYear + m2.yearOffset);
|
|
26113
|
+
setEndMonth(m2.number);
|
|
26114
|
+
if (onStartMonthSelect)
|
|
26115
|
+
onStartMonthSelect(
|
|
26116
|
+
new Date(menuYear + m2.yearOffset, m2.number)
|
|
26117
|
+
);
|
|
26118
|
+
}
|
|
26119
|
+
},
|
|
26120
|
+
disabled: (maxDate ? menuYear + m2.yearOffset > (maxDate == null ? void 0 : maxDate.getFullYear()) || menuYear + m2.yearOffset === (maxDate == null ? void 0 : maxDate.getFullYear()) && m2.number > maxDate.getMonth() : false) || (minDate ? menuYear + m2.yearOffset < (minDate == null ? void 0 : minDate.getFullYear()) || menuYear + m2.yearOffset === (minDate == null ? void 0 : minDate.getFullYear()) && m2.number < minDate.getMonth() : false),
|
|
26121
|
+
className: cn$1(
|
|
26122
|
+
buttonVariants({
|
|
26123
|
+
variant: startMonth === m2.number && menuYear + m2.yearOffset === startYear || endMonth === m2.number && menuYear + m2.yearOffset === endYear && !rangePending ? ((_a2 = variant == null ? void 0 : variant.calendar) == null ? void 0 : _a2.selected) ?? "default" : ((_b2 = variant == null ? void 0 : variant.calendar) == null ? void 0 : _b2.main) ?? "ghost"
|
|
26124
|
+
}),
|
|
26125
|
+
"h-full w-full p-0 font-normal aria-selected:opacity-100"
|
|
26126
|
+
),
|
|
26127
|
+
children: (callbacks == null ? void 0 : callbacks.monthLabel) ? callbacks.monthLabel(m2) : m2.name
|
|
26128
|
+
}
|
|
26129
|
+
)
|
|
26130
|
+
},
|
|
26131
|
+
`${m2.number}-${m2.yearOffset}`
|
|
26132
|
+
);
|
|
26133
|
+
}) }, rowKey);
|
|
25881
26134
|
}) }) })
|
|
25882
26135
|
] }),
|
|
25883
26136
|
showQuickSelectors ? /* @__PURE__ */ jsx("div", { className: " flex flex-col gap-1 justify-center", children: quickSelectors.map((s2) => {
|
|
@@ -25947,68 +26200,85 @@ function MonthRangeInput({
|
|
|
25947
26200
|
type: "button",
|
|
25948
26201
|
disabled,
|
|
25949
26202
|
variant: buttonVariant,
|
|
25950
|
-
className: cn$1(
|
|
26203
|
+
className: cn$1(
|
|
26204
|
+
"w-[280px] justify-start text-left font-normal",
|
|
26205
|
+
!value && "text-muted-foreground"
|
|
26206
|
+
),
|
|
25951
26207
|
children: [
|
|
25952
26208
|
/* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
|
|
25953
26209
|
label
|
|
25954
26210
|
]
|
|
25955
26211
|
}
|
|
25956
26212
|
) }),
|
|
25957
|
-
/* @__PURE__ */ jsxs(
|
|
25958
|
-
|
|
25959
|
-
|
|
25960
|
-
|
|
25961
|
-
|
|
25962
|
-
|
|
25963
|
-
|
|
25964
|
-
|
|
25965
|
-
|
|
25966
|
-
|
|
25967
|
-
|
|
25968
|
-
|
|
25969
|
-
|
|
25970
|
-
|
|
25971
|
-
|
|
25972
|
-
|
|
25973
|
-
|
|
25974
|
-
|
|
25975
|
-
|
|
25976
|
-
|
|
25977
|
-
|
|
25978
|
-
|
|
25979
|
-
|
|
25980
|
-
|
|
25981
|
-
|
|
25982
|
-
|
|
25983
|
-
|
|
25984
|
-
|
|
25985
|
-
|
|
25986
|
-
|
|
25987
|
-
|
|
25988
|
-
|
|
25989
|
-
|
|
25990
|
-
|
|
25991
|
-
|
|
25992
|
-
|
|
25993
|
-
|
|
25994
|
-
|
|
25995
|
-
|
|
25996
|
-
|
|
25997
|
-
|
|
25998
|
-
|
|
25999
|
-
|
|
26000
|
-
|
|
26001
|
-
|
|
26002
|
-
|
|
26003
|
-
|
|
26004
|
-
|
|
26005
|
-
|
|
26213
|
+
/* @__PURE__ */ jsxs(
|
|
26214
|
+
PopoverContent,
|
|
26215
|
+
{
|
|
26216
|
+
className: "p-2 w-auto max-w-none",
|
|
26217
|
+
align: "start",
|
|
26218
|
+
side: popoverSide,
|
|
26219
|
+
children: [
|
|
26220
|
+
/* @__PURE__ */ jsx(
|
|
26221
|
+
MonthRangePicker,
|
|
26222
|
+
{
|
|
26223
|
+
selectedMonthRange: (draft == null ? void 0 : draft.start) && (draft == null ? void 0 : draft.end) ? { start: draft.start, end: draft.end } : void 0,
|
|
26224
|
+
onStartMonthSelect: (d) => {
|
|
26225
|
+
if (disabled) return;
|
|
26226
|
+
setDraft({ start: d, end: d });
|
|
26227
|
+
},
|
|
26228
|
+
onMonthRangeSelect: ({ start, end }) => {
|
|
26229
|
+
if (disabled) return;
|
|
26230
|
+
setDraft({ start, end });
|
|
26231
|
+
},
|
|
26232
|
+
minDate,
|
|
26233
|
+
maxDate,
|
|
26234
|
+
showQuickSelectors,
|
|
26235
|
+
variant: {
|
|
26236
|
+
calendar: { main: "ghost", selected: "default" },
|
|
26237
|
+
chevrons: "outline"
|
|
26238
|
+
}
|
|
26239
|
+
}
|
|
26240
|
+
),
|
|
26241
|
+
(props2.showFooter ?? true) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 pt-2 border-t mt-3", children: [
|
|
26242
|
+
/* @__PURE__ */ jsx(
|
|
26243
|
+
Button$1,
|
|
26244
|
+
{
|
|
26245
|
+
type: "button",
|
|
26246
|
+
variant: "outline",
|
|
26247
|
+
size: "sm",
|
|
26248
|
+
onClick: () => setOpen(false),
|
|
26249
|
+
disabled,
|
|
26250
|
+
children: props2.cancelLabel ?? "Cancel"
|
|
26251
|
+
}
|
|
26252
|
+
),
|
|
26253
|
+
/* @__PURE__ */ jsx(
|
|
26254
|
+
Button$1,
|
|
26255
|
+
{
|
|
26256
|
+
type: "button",
|
|
26257
|
+
variant: "default",
|
|
26258
|
+
size: "sm",
|
|
26259
|
+
onClick: () => {
|
|
26260
|
+
onChange == null ? void 0 : onChange(draft ?? null);
|
|
26261
|
+
setOpen(false);
|
|
26262
|
+
},
|
|
26263
|
+
children: props2.applyLabel ?? "Apply"
|
|
26264
|
+
}
|
|
26265
|
+
)
|
|
26266
|
+
] })
|
|
26267
|
+
]
|
|
26268
|
+
}
|
|
26269
|
+
)
|
|
26006
26270
|
] }) });
|
|
26007
26271
|
}
|
|
26008
26272
|
MonthRangeInput.displayName = "MonthRangeInput";
|
|
26009
|
-
function MonthRangePickerField({
|
|
26273
|
+
function MonthRangePickerField({
|
|
26274
|
+
field,
|
|
26275
|
+
value,
|
|
26276
|
+
onChange,
|
|
26277
|
+
className
|
|
26278
|
+
}) {
|
|
26010
26279
|
const v = React.useMemo(() => {
|
|
26011
|
-
if (!value || typeof value !== "object")
|
|
26280
|
+
if (!value || typeof value !== "object")
|
|
26281
|
+
return void 0;
|
|
26012
26282
|
const anyVal = value;
|
|
26013
26283
|
const toDate2 = (x2) => {
|
|
26014
26284
|
if (!x2) return void 0;
|
|
@@ -26264,7 +26534,12 @@ function TimePicker({
|
|
|
26264
26534
|
] }) });
|
|
26265
26535
|
}
|
|
26266
26536
|
TimePicker.displayName = "TimePicker";
|
|
26267
|
-
function TimePickerField({
|
|
26537
|
+
function TimePickerField({
|
|
26538
|
+
field,
|
|
26539
|
+
value,
|
|
26540
|
+
onChange,
|
|
26541
|
+
className
|
|
26542
|
+
}) {
|
|
26268
26543
|
const v = React.useMemo(() => {
|
|
26269
26544
|
if (!value) return null;
|
|
26270
26545
|
if (value instanceof Date) return value;
|
|
@@ -26299,9 +26574,24 @@ function TimeUnitSelector({
|
|
|
26299
26574
|
value,
|
|
26300
26575
|
onChange
|
|
26301
26576
|
}) {
|
|
26302
|
-
const hours = React.useMemo(
|
|
26303
|
-
|
|
26304
|
-
|
|
26577
|
+
const hours = React.useMemo(
|
|
26578
|
+
() => hourCycle === 12 ? Array.from({ length: 12 }, (_2, i2) => i2 + 1) : Array.from({ length: 24 }, (_2, i2) => i2),
|
|
26579
|
+
[hourCycle]
|
|
26580
|
+
);
|
|
26581
|
+
const minutes = React.useMemo(
|
|
26582
|
+
() => Array.from(
|
|
26583
|
+
{ length: Math.ceil(60 / minuteStep) },
|
|
26584
|
+
(_2, i2) => i2 * minuteStep
|
|
26585
|
+
),
|
|
26586
|
+
[minuteStep]
|
|
26587
|
+
);
|
|
26588
|
+
const seconds = React.useMemo(
|
|
26589
|
+
() => Array.from(
|
|
26590
|
+
{ length: Math.ceil(60 / secondStep) },
|
|
26591
|
+
(_2, i2) => i2 * secondStep
|
|
26592
|
+
),
|
|
26593
|
+
[secondStep]
|
|
26594
|
+
);
|
|
26305
26595
|
const selectedHour = React.useMemo(() => {
|
|
26306
26596
|
if (!value) return hourCycle === 12 ? 12 : 0;
|
|
26307
26597
|
const h = value.getHours();
|
|
@@ -26313,7 +26603,15 @@ function TimeUnitSelector({
|
|
|
26313
26603
|
const setPart = (part, v) => {
|
|
26314
26604
|
const base = value ? new Date(value) : (() => {
|
|
26315
26605
|
const n2 = /* @__PURE__ */ new Date();
|
|
26316
|
-
return new Date(
|
|
26606
|
+
return new Date(
|
|
26607
|
+
n2.getFullYear(),
|
|
26608
|
+
n2.getMonth(),
|
|
26609
|
+
n2.getDate(),
|
|
26610
|
+
0,
|
|
26611
|
+
0,
|
|
26612
|
+
0,
|
|
26613
|
+
0
|
|
26614
|
+
);
|
|
26317
26615
|
})();
|
|
26318
26616
|
if (part === "hour") {
|
|
26319
26617
|
let h = Number(v);
|
|
@@ -26342,34 +26640,66 @@ function TimeUnitSelector({
|
|
|
26342
26640
|
/* @__PURE__ */ jsxs("div", { className: "flex items-end gap-2", children: [
|
|
26343
26641
|
/* @__PURE__ */ jsxs("div", { className: "w-24", children: [
|
|
26344
26642
|
/* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Hour" }),
|
|
26345
|
-
/* @__PURE__ */ jsxs(
|
|
26346
|
-
|
|
26347
|
-
|
|
26348
|
-
|
|
26643
|
+
/* @__PURE__ */ jsxs(
|
|
26644
|
+
Select$1,
|
|
26645
|
+
{
|
|
26646
|
+
disabled,
|
|
26647
|
+
value: String(selectedHour),
|
|
26648
|
+
onValueChange: (v) => setPart("hour", Number(v)),
|
|
26649
|
+
children: [
|
|
26650
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": `${label} hour`, children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
26651
|
+
/* @__PURE__ */ jsx(SelectContent, { children: hours.map((h) => /* @__PURE__ */ jsx(SelectItem, { value: String(h), children: hourCycle === 12 ? h : pad2$2(h) }, h)) })
|
|
26652
|
+
]
|
|
26653
|
+
}
|
|
26654
|
+
)
|
|
26349
26655
|
] }),
|
|
26350
26656
|
(precision === "minute" || precision === "second") && /* @__PURE__ */ jsxs("div", { className: "w-24", children: [
|
|
26351
26657
|
/* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Minute" }),
|
|
26352
|
-
/* @__PURE__ */ jsxs(
|
|
26353
|
-
|
|
26354
|
-
|
|
26355
|
-
|
|
26658
|
+
/* @__PURE__ */ jsxs(
|
|
26659
|
+
Select$1,
|
|
26660
|
+
{
|
|
26661
|
+
disabled,
|
|
26662
|
+
value: String(selectedMinute - selectedMinute % minuteStep),
|
|
26663
|
+
onValueChange: (v) => setPart("minute", Number(v)),
|
|
26664
|
+
children: [
|
|
26665
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": `${label} minute`, children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
26666
|
+
/* @__PURE__ */ jsx(SelectContent, { children: minutes.map((m2) => /* @__PURE__ */ jsx(SelectItem, { value: String(m2), children: pad2$2(m2) }, m2)) })
|
|
26667
|
+
]
|
|
26668
|
+
}
|
|
26669
|
+
)
|
|
26356
26670
|
] }),
|
|
26357
26671
|
precision === "second" && /* @__PURE__ */ jsxs("div", { className: "w-24", children: [
|
|
26358
26672
|
/* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Second" }),
|
|
26359
|
-
/* @__PURE__ */ jsxs(
|
|
26360
|
-
|
|
26361
|
-
|
|
26362
|
-
|
|
26673
|
+
/* @__PURE__ */ jsxs(
|
|
26674
|
+
Select$1,
|
|
26675
|
+
{
|
|
26676
|
+
disabled,
|
|
26677
|
+
value: String(selectedSecond - selectedSecond % secondStep),
|
|
26678
|
+
onValueChange: (v) => setPart("second", Number(v)),
|
|
26679
|
+
children: [
|
|
26680
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": `${label} second`, children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
26681
|
+
/* @__PURE__ */ jsx(SelectContent, { children: seconds.map((s2) => /* @__PURE__ */ jsx(SelectItem, { value: String(s2), children: pad2$2(s2) }, s2)) })
|
|
26682
|
+
]
|
|
26683
|
+
}
|
|
26684
|
+
)
|
|
26363
26685
|
] }),
|
|
26364
26686
|
hourCycle === 12 && /* @__PURE__ */ jsxs("div", { className: "w-24", children: [
|
|
26365
26687
|
/* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Period" }),
|
|
26366
|
-
/* @__PURE__ */ jsxs(
|
|
26367
|
-
|
|
26368
|
-
|
|
26369
|
-
|
|
26370
|
-
|
|
26371
|
-
|
|
26372
|
-
|
|
26688
|
+
/* @__PURE__ */ jsxs(
|
|
26689
|
+
Select$1,
|
|
26690
|
+
{
|
|
26691
|
+
disabled,
|
|
26692
|
+
value: selectedPeriod,
|
|
26693
|
+
onValueChange: (v) => setPart("period", v),
|
|
26694
|
+
children: [
|
|
26695
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": `${label} period`, children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
26696
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
26697
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "AM", children: "AM" }),
|
|
26698
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "PM", children: "PM" })
|
|
26699
|
+
] })
|
|
26700
|
+
]
|
|
26701
|
+
}
|
|
26702
|
+
)
|
|
26373
26703
|
] })
|
|
26374
26704
|
] })
|
|
26375
26705
|
] });
|
|
@@ -26391,7 +26721,9 @@ function TimeRangePicker({
|
|
|
26391
26721
|
const [internalOpen, setInternalOpen] = React.useState(false);
|
|
26392
26722
|
const isOpen = typeof props2.open === "boolean" ? props2.open : internalOpen;
|
|
26393
26723
|
const setOpen = (o2) => props2.onOpenChange ? props2.onOpenChange(o2) : setInternalOpen(o2);
|
|
26394
|
-
const [draft, setDraft] = React.useState(
|
|
26724
|
+
const [draft, setDraft] = React.useState(
|
|
26725
|
+
value ?? null
|
|
26726
|
+
);
|
|
26395
26727
|
React.useEffect(() => {
|
|
26396
26728
|
if (isOpen) setDraft(value ?? null);
|
|
26397
26729
|
}, [isOpen, value]);
|
|
@@ -26410,7 +26742,10 @@ function TimeRangePicker({
|
|
|
26410
26742
|
type: "button",
|
|
26411
26743
|
disabled,
|
|
26412
26744
|
variant: buttonVariant,
|
|
26413
|
-
className: cn$1(
|
|
26745
|
+
className: cn$1(
|
|
26746
|
+
"w-[280px] justify-start text-left font-normal",
|
|
26747
|
+
!value && "text-muted-foreground"
|
|
26748
|
+
),
|
|
26414
26749
|
children: [
|
|
26415
26750
|
/* @__PURE__ */ jsx(Clock, { className: "mr-2 h-4 w-4" }),
|
|
26416
26751
|
label
|
|
@@ -26489,9 +26824,15 @@ function TimeRangePicker({
|
|
|
26489
26824
|
] }) });
|
|
26490
26825
|
}
|
|
26491
26826
|
TimeRangePicker.displayName = "TimeRangePicker";
|
|
26492
|
-
function TimeRangePickerField({
|
|
26827
|
+
function TimeRangePickerField({
|
|
26828
|
+
field,
|
|
26829
|
+
value,
|
|
26830
|
+
onChange,
|
|
26831
|
+
className
|
|
26832
|
+
}) {
|
|
26493
26833
|
const v = React.useMemo(() => {
|
|
26494
|
-
if (!value || typeof value !== "object")
|
|
26834
|
+
if (!value || typeof value !== "object")
|
|
26835
|
+
return null;
|
|
26495
26836
|
const anyVal = value;
|
|
26496
26837
|
const toDate2 = (x2) => {
|
|
26497
26838
|
if (!x2) return void 0;
|
|
@@ -26550,9 +26891,24 @@ function TimeSelectors$1({
|
|
|
26550
26891
|
secondStep,
|
|
26551
26892
|
disabled
|
|
26552
26893
|
}) {
|
|
26553
|
-
const hours = React.useMemo(
|
|
26554
|
-
|
|
26555
|
-
|
|
26894
|
+
const hours = React.useMemo(
|
|
26895
|
+
() => hourCycle === 12 ? Array.from({ length: 12 }, (_2, i2) => i2 + 1) : Array.from({ length: 24 }, (_2, i2) => i2),
|
|
26896
|
+
[hourCycle]
|
|
26897
|
+
);
|
|
26898
|
+
const minutes = React.useMemo(
|
|
26899
|
+
() => Array.from(
|
|
26900
|
+
{ length: Math.ceil(60 / minuteStep) },
|
|
26901
|
+
(_2, i2) => i2 * minuteStep
|
|
26902
|
+
),
|
|
26903
|
+
[minuteStep]
|
|
26904
|
+
);
|
|
26905
|
+
const seconds = React.useMemo(
|
|
26906
|
+
() => Array.from(
|
|
26907
|
+
{ length: Math.ceil(60 / secondStep) },
|
|
26908
|
+
(_2, i2) => i2 * secondStep
|
|
26909
|
+
),
|
|
26910
|
+
[secondStep]
|
|
26911
|
+
);
|
|
26556
26912
|
const selectedHour = React.useMemo(() => {
|
|
26557
26913
|
if (!value) return hourCycle === 12 ? 12 : 0;
|
|
26558
26914
|
const h = value.getHours();
|
|
@@ -26564,7 +26920,15 @@ function TimeSelectors$1({
|
|
|
26564
26920
|
const setPart = (part, v) => {
|
|
26565
26921
|
const base = value ? new Date(value) : (() => {
|
|
26566
26922
|
const n2 = /* @__PURE__ */ new Date();
|
|
26567
|
-
return new Date(
|
|
26923
|
+
return new Date(
|
|
26924
|
+
n2.getFullYear(),
|
|
26925
|
+
n2.getMonth(),
|
|
26926
|
+
n2.getDate(),
|
|
26927
|
+
0,
|
|
26928
|
+
0,
|
|
26929
|
+
0,
|
|
26930
|
+
0
|
|
26931
|
+
);
|
|
26568
26932
|
})();
|
|
26569
26933
|
if (part === "hour") {
|
|
26570
26934
|
let h = Number(v);
|
|
@@ -26591,34 +26955,66 @@ function TimeSelectors$1({
|
|
|
26591
26955
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-2", children: [
|
|
26592
26956
|
/* @__PURE__ */ jsxs("div", { className: "w-24", children: [
|
|
26593
26957
|
/* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Hour" }),
|
|
26594
|
-
/* @__PURE__ */ jsxs(
|
|
26595
|
-
|
|
26596
|
-
|
|
26597
|
-
|
|
26958
|
+
/* @__PURE__ */ jsxs(
|
|
26959
|
+
Select$1,
|
|
26960
|
+
{
|
|
26961
|
+
disabled,
|
|
26962
|
+
value: String(selectedHour),
|
|
26963
|
+
onValueChange: (v) => setPart("hour", Number(v)),
|
|
26964
|
+
children: [
|
|
26965
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": "Hour", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
26966
|
+
/* @__PURE__ */ jsx(SelectContent, { children: hours.map((h) => /* @__PURE__ */ jsx(SelectItem, { value: String(h), children: hourCycle === 12 ? h : pad2$1(h) }, h)) })
|
|
26967
|
+
]
|
|
26968
|
+
}
|
|
26969
|
+
)
|
|
26598
26970
|
] }),
|
|
26599
26971
|
(precision === "minute" || precision === "second") && /* @__PURE__ */ jsxs("div", { className: "w-24", children: [
|
|
26600
26972
|
/* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Minute" }),
|
|
26601
|
-
/* @__PURE__ */ jsxs(
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
26973
|
+
/* @__PURE__ */ jsxs(
|
|
26974
|
+
Select$1,
|
|
26975
|
+
{
|
|
26976
|
+
disabled,
|
|
26977
|
+
value: String(selectedMinute - selectedMinute % minuteStep),
|
|
26978
|
+
onValueChange: (v) => setPart("minute", Number(v)),
|
|
26979
|
+
children: [
|
|
26980
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": "Minute", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
26981
|
+
/* @__PURE__ */ jsx(SelectContent, { children: minutes.map((m2) => /* @__PURE__ */ jsx(SelectItem, { value: String(m2), children: pad2$1(m2) }, m2)) })
|
|
26982
|
+
]
|
|
26983
|
+
}
|
|
26984
|
+
)
|
|
26605
26985
|
] }),
|
|
26606
26986
|
precision === "second" && /* @__PURE__ */ jsxs("div", { className: "w-24", children: [
|
|
26607
26987
|
/* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Second" }),
|
|
26608
|
-
/* @__PURE__ */ jsxs(
|
|
26609
|
-
|
|
26610
|
-
|
|
26611
|
-
|
|
26988
|
+
/* @__PURE__ */ jsxs(
|
|
26989
|
+
Select$1,
|
|
26990
|
+
{
|
|
26991
|
+
disabled,
|
|
26992
|
+
value: String(selectedSecond - selectedSecond % secondStep),
|
|
26993
|
+
onValueChange: (v) => setPart("second", Number(v)),
|
|
26994
|
+
children: [
|
|
26995
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": "Second", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
26996
|
+
/* @__PURE__ */ jsx(SelectContent, { children: seconds.map((s2) => /* @__PURE__ */ jsx(SelectItem, { value: String(s2), children: pad2$1(s2) }, s2)) })
|
|
26997
|
+
]
|
|
26998
|
+
}
|
|
26999
|
+
)
|
|
26612
27000
|
] }),
|
|
26613
27001
|
hourCycle === 12 && /* @__PURE__ */ jsxs("div", { className: "w-24", children: [
|
|
26614
27002
|
/* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Period" }),
|
|
26615
|
-
/* @__PURE__ */ jsxs(
|
|
26616
|
-
|
|
26617
|
-
|
|
26618
|
-
|
|
26619
|
-
|
|
26620
|
-
|
|
26621
|
-
|
|
27003
|
+
/* @__PURE__ */ jsxs(
|
|
27004
|
+
Select$1,
|
|
27005
|
+
{
|
|
27006
|
+
disabled,
|
|
27007
|
+
value: selectedPeriod,
|
|
27008
|
+
onValueChange: (v) => setPart("period", v),
|
|
27009
|
+
children: [
|
|
27010
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": "Period", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
27011
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
27012
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "AM", children: "AM" }),
|
|
27013
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "PM", children: "PM" })
|
|
27014
|
+
] })
|
|
27015
|
+
]
|
|
27016
|
+
}
|
|
27017
|
+
)
|
|
26622
27018
|
] })
|
|
26623
27019
|
] });
|
|
26624
27020
|
}
|
|
@@ -26652,7 +27048,11 @@ function DateTimePicker({
|
|
|
26652
27048
|
};
|
|
26653
27049
|
const fmtLabel = (d) => {
|
|
26654
27050
|
if (!d) return placeholder;
|
|
26655
|
-
const dateStr = d.toLocaleDateString(void 0, {
|
|
27051
|
+
const dateStr = d.toLocaleDateString(void 0, {
|
|
27052
|
+
year: "numeric",
|
|
27053
|
+
month: "short",
|
|
27054
|
+
day: "2-digit"
|
|
27055
|
+
});
|
|
26656
27056
|
const h = d.getHours();
|
|
26657
27057
|
const m2 = d.getMinutes();
|
|
26658
27058
|
const s2 = d.getSeconds();
|
|
@@ -26667,7 +27067,10 @@ function DateTimePicker({
|
|
|
26667
27067
|
type: "button",
|
|
26668
27068
|
disabled,
|
|
26669
27069
|
variant: buttonVariant,
|
|
26670
|
-
className: cn$1(
|
|
27070
|
+
className: cn$1(
|
|
27071
|
+
"w-[280px] justify-start text-left font-normal",
|
|
27072
|
+
!value && "text-muted-foreground"
|
|
27073
|
+
),
|
|
26671
27074
|
children: [
|
|
26672
27075
|
/* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
|
|
26673
27076
|
label
|
|
@@ -26686,10 +27089,26 @@ function DateTimePicker({
|
|
|
26686
27089
|
if (!d) return;
|
|
26687
27090
|
if (isDisabled(d)) return;
|
|
26688
27091
|
if (draft) {
|
|
26689
|
-
const nd = new Date(
|
|
27092
|
+
const nd = new Date(
|
|
27093
|
+
d.getFullYear(),
|
|
27094
|
+
d.getMonth(),
|
|
27095
|
+
d.getDate(),
|
|
27096
|
+
draft.getHours(),
|
|
27097
|
+
draft.getMinutes(),
|
|
27098
|
+
draft.getSeconds()
|
|
27099
|
+
);
|
|
26690
27100
|
setDraft(nd);
|
|
26691
27101
|
} else {
|
|
26692
|
-
setDraft(
|
|
27102
|
+
setDraft(
|
|
27103
|
+
new Date(
|
|
27104
|
+
d.getFullYear(),
|
|
27105
|
+
d.getMonth(),
|
|
27106
|
+
d.getDate(),
|
|
27107
|
+
0,
|
|
27108
|
+
0,
|
|
27109
|
+
0
|
|
27110
|
+
)
|
|
27111
|
+
);
|
|
26693
27112
|
}
|
|
26694
27113
|
},
|
|
26695
27114
|
defaultMonth: draft ?? /* @__PURE__ */ new Date(),
|
|
@@ -26715,9 +27134,29 @@ function DateTimePicker({
|
|
|
26715
27134
|
] })
|
|
26716
27135
|
] }),
|
|
26717
27136
|
(props2.showFooter ?? true) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 p-2 border-t", children: [
|
|
26718
|
-
/* @__PURE__ */ jsx(
|
|
27137
|
+
/* @__PURE__ */ jsx(
|
|
27138
|
+
Button$1,
|
|
27139
|
+
{
|
|
27140
|
+
type: "button",
|
|
27141
|
+
variant: "outline",
|
|
27142
|
+
size: "sm",
|
|
27143
|
+
onClick: () => setOpen(false),
|
|
27144
|
+
disabled,
|
|
27145
|
+
children: props2.cancelLabel ?? "Cancel"
|
|
27146
|
+
}
|
|
27147
|
+
),
|
|
26719
27148
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
26720
|
-
/* @__PURE__ */ jsx(
|
|
27149
|
+
/* @__PURE__ */ jsx(
|
|
27150
|
+
Button$1,
|
|
27151
|
+
{
|
|
27152
|
+
type: "button",
|
|
27153
|
+
variant: "ghost",
|
|
27154
|
+
size: "sm",
|
|
27155
|
+
onClick: () => onChange == null ? void 0 : onChange(null),
|
|
27156
|
+
disabled,
|
|
27157
|
+
children: props2.clearLabel ?? "Clear"
|
|
27158
|
+
}
|
|
27159
|
+
),
|
|
26721
27160
|
/* @__PURE__ */ jsx(
|
|
26722
27161
|
Button$1,
|
|
26723
27162
|
{
|
|
@@ -26737,7 +27176,12 @@ function DateTimePicker({
|
|
|
26737
27176
|
] }) });
|
|
26738
27177
|
}
|
|
26739
27178
|
DateTimePicker.displayName = "DateTimePicker";
|
|
26740
|
-
function DateTimePickerField({
|
|
27179
|
+
function DateTimePickerField({
|
|
27180
|
+
field,
|
|
27181
|
+
value,
|
|
27182
|
+
onChange,
|
|
27183
|
+
className
|
|
27184
|
+
}) {
|
|
26741
27185
|
const v = React.useMemo(() => {
|
|
26742
27186
|
if (!value) return null;
|
|
26743
27187
|
if (value instanceof Date) return value;
|
|
@@ -26816,9 +27260,24 @@ function TimeSelectors({
|
|
|
26816
27260
|
disabled,
|
|
26817
27261
|
compact: compact2
|
|
26818
27262
|
}) {
|
|
26819
|
-
const hours = React.useMemo(
|
|
26820
|
-
|
|
26821
|
-
|
|
27263
|
+
const hours = React.useMemo(
|
|
27264
|
+
() => hourCycle === 12 ? Array.from({ length: 12 }, (_2, i2) => i2 + 1) : Array.from({ length: 24 }, (_2, i2) => i2),
|
|
27265
|
+
[hourCycle]
|
|
27266
|
+
);
|
|
27267
|
+
const minutes = React.useMemo(
|
|
27268
|
+
() => Array.from(
|
|
27269
|
+
{ length: Math.ceil(60 / minuteStep) },
|
|
27270
|
+
(_2, i2) => i2 * minuteStep
|
|
27271
|
+
),
|
|
27272
|
+
[minuteStep]
|
|
27273
|
+
);
|
|
27274
|
+
const seconds = React.useMemo(
|
|
27275
|
+
() => Array.from(
|
|
27276
|
+
{ length: Math.ceil(60 / secondStep) },
|
|
27277
|
+
(_2, i2) => i2 * secondStep
|
|
27278
|
+
),
|
|
27279
|
+
[secondStep]
|
|
27280
|
+
);
|
|
26822
27281
|
const selectedHour = React.useMemo(() => {
|
|
26823
27282
|
if (!value) return hourCycle === 12 ? 12 : 0;
|
|
26824
27283
|
const h = value.getHours();
|
|
@@ -26830,7 +27289,15 @@ function TimeSelectors({
|
|
|
26830
27289
|
const setPart = (part, v) => {
|
|
26831
27290
|
const base = value ? new Date(value) : (() => {
|
|
26832
27291
|
const n2 = /* @__PURE__ */ new Date();
|
|
26833
|
-
return new Date(
|
|
27292
|
+
return new Date(
|
|
27293
|
+
n2.getFullYear(),
|
|
27294
|
+
n2.getMonth(),
|
|
27295
|
+
n2.getDate(),
|
|
27296
|
+
0,
|
|
27297
|
+
0,
|
|
27298
|
+
0,
|
|
27299
|
+
0
|
|
27300
|
+
);
|
|
26834
27301
|
})();
|
|
26835
27302
|
if (part === "hour") {
|
|
26836
27303
|
let h = Number(v);
|
|
@@ -26860,34 +27327,66 @@ function TimeSelectors({
|
|
|
26860
27327
|
/* @__PURE__ */ jsxs("div", { className: "flex items-end gap-2", children: [
|
|
26861
27328
|
/* @__PURE__ */ jsxs("div", { className: widthClass, children: [
|
|
26862
27329
|
!compact2 && /* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Hour" }),
|
|
26863
|
-
/* @__PURE__ */ jsxs(
|
|
26864
|
-
|
|
26865
|
-
|
|
26866
|
-
|
|
27330
|
+
/* @__PURE__ */ jsxs(
|
|
27331
|
+
Select$1,
|
|
27332
|
+
{
|
|
27333
|
+
disabled,
|
|
27334
|
+
value: String(selectedHour),
|
|
27335
|
+
onValueChange: (v) => setPart("hour", Number(v)),
|
|
27336
|
+
children: [
|
|
27337
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": `${label} hour`, children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
27338
|
+
/* @__PURE__ */ jsx(SelectContent, { children: hours.map((h) => /* @__PURE__ */ jsx(SelectItem, { value: String(h), children: hourCycle === 12 ? h : pad2(h) }, h)) })
|
|
27339
|
+
]
|
|
27340
|
+
}
|
|
27341
|
+
)
|
|
26867
27342
|
] }),
|
|
26868
27343
|
(precision === "minute" || precision === "second") && /* @__PURE__ */ jsxs("div", { className: widthClass, children: [
|
|
26869
27344
|
!compact2 && /* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Minute" }),
|
|
26870
|
-
/* @__PURE__ */ jsxs(
|
|
26871
|
-
|
|
26872
|
-
|
|
26873
|
-
|
|
27345
|
+
/* @__PURE__ */ jsxs(
|
|
27346
|
+
Select$1,
|
|
27347
|
+
{
|
|
27348
|
+
disabled,
|
|
27349
|
+
value: String(selectedMinute - selectedMinute % minuteStep),
|
|
27350
|
+
onValueChange: (v) => setPart("minute", Number(v)),
|
|
27351
|
+
children: [
|
|
27352
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": `${label} minute`, children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
27353
|
+
/* @__PURE__ */ jsx(SelectContent, { children: minutes.map((m2) => /* @__PURE__ */ jsx(SelectItem, { value: String(m2), children: pad2(m2) }, m2)) })
|
|
27354
|
+
]
|
|
27355
|
+
}
|
|
27356
|
+
)
|
|
26874
27357
|
] }),
|
|
26875
27358
|
precision === "second" && /* @__PURE__ */ jsxs("div", { className: widthClass, children: [
|
|
26876
27359
|
!compact2 && /* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Second" }),
|
|
26877
|
-
/* @__PURE__ */ jsxs(
|
|
26878
|
-
|
|
26879
|
-
|
|
26880
|
-
|
|
27360
|
+
/* @__PURE__ */ jsxs(
|
|
27361
|
+
Select$1,
|
|
27362
|
+
{
|
|
27363
|
+
disabled,
|
|
27364
|
+
value: String(selectedSecond - selectedSecond % secondStep),
|
|
27365
|
+
onValueChange: (v) => setPart("second", Number(v)),
|
|
27366
|
+
children: [
|
|
27367
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": `${label} second`, children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
27368
|
+
/* @__PURE__ */ jsx(SelectContent, { children: seconds.map((s2) => /* @__PURE__ */ jsx(SelectItem, { value: String(s2), children: pad2(s2) }, s2)) })
|
|
27369
|
+
]
|
|
27370
|
+
}
|
|
27371
|
+
)
|
|
26881
27372
|
] }),
|
|
26882
27373
|
hourCycle === 12 && /* @__PURE__ */ jsxs("div", { className: widthClass, children: [
|
|
26883
27374
|
!compact2 && /* @__PURE__ */ jsx("div", { className: "mb-1 block text-xs text-muted-foreground", children: "Period" }),
|
|
26884
|
-
/* @__PURE__ */ jsxs(
|
|
26885
|
-
|
|
26886
|
-
|
|
26887
|
-
|
|
26888
|
-
|
|
26889
|
-
|
|
26890
|
-
|
|
27375
|
+
/* @__PURE__ */ jsxs(
|
|
27376
|
+
Select$1,
|
|
27377
|
+
{
|
|
27378
|
+
disabled,
|
|
27379
|
+
value: selectedPeriod,
|
|
27380
|
+
onValueChange: (v) => setPart("period", v),
|
|
27381
|
+
children: [
|
|
27382
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "aria-label": `${label} period`, children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
27383
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
27384
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "AM", children: "AM" }),
|
|
27385
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "PM", children: "PM" })
|
|
27386
|
+
] })
|
|
27387
|
+
]
|
|
27388
|
+
}
|
|
27389
|
+
)
|
|
26891
27390
|
] })
|
|
26892
27391
|
] })
|
|
26893
27392
|
] });
|
|
@@ -26914,23 +27413,36 @@ function DateTimeRangePicker({
|
|
|
26914
27413
|
const [internalOpen, setInternalOpen] = React.useState(false);
|
|
26915
27414
|
const isOpen = typeof props2.open === "boolean" ? props2.open : internalOpen;
|
|
26916
27415
|
const setOpen = (o2) => props2.onOpenChange ? props2.onOpenChange(o2) : setInternalOpen(o2);
|
|
26917
|
-
const [draft, setDraft] = React.useState(
|
|
27416
|
+
const [draft, setDraft] = React.useState(
|
|
27417
|
+
value ?? null
|
|
27418
|
+
);
|
|
26918
27419
|
React.useEffect(() => {
|
|
26919
27420
|
if (isOpen) setDraft(value ?? null);
|
|
26920
27421
|
}, [isOpen, value]);
|
|
26921
|
-
const fmtTime = React.useCallback(
|
|
26922
|
-
|
|
26923
|
-
|
|
26924
|
-
|
|
26925
|
-
|
|
26926
|
-
|
|
26927
|
-
|
|
27422
|
+
const fmtTime = React.useCallback(
|
|
27423
|
+
(d) => {
|
|
27424
|
+
if (!d) return "";
|
|
27425
|
+
const h = d.getHours();
|
|
27426
|
+
const m2 = d.getMinutes();
|
|
27427
|
+
const s2 = d.getSeconds();
|
|
27428
|
+
return hourCycle === 12 ? `${h % 12 || 12}:${pad2(m2)}${timePrecision === "second" ? `:${pad2(s2)}` : ""} ${h >= 12 ? "PM" : "AM"}` : `${pad2(h)}:${pad2(m2)}${timePrecision === "second" ? `:${pad2(s2)}` : ""}`;
|
|
27429
|
+
},
|
|
27430
|
+
[hourCycle, timePrecision]
|
|
27431
|
+
);
|
|
26928
27432
|
const label = React.useMemo(() => {
|
|
26929
27433
|
const f = (draft == null ? void 0 : draft.from) ?? (value == null ? void 0 : value.from) ?? null;
|
|
26930
27434
|
const t2 = (draft == null ? void 0 : draft.to) ?? (value == null ? void 0 : value.to) ?? null;
|
|
26931
27435
|
if (f && t2) {
|
|
26932
|
-
const fd = f.toLocaleDateString(void 0, {
|
|
26933
|
-
|
|
27436
|
+
const fd = f.toLocaleDateString(void 0, {
|
|
27437
|
+
year: "numeric",
|
|
27438
|
+
month: "short",
|
|
27439
|
+
day: "2-digit"
|
|
27440
|
+
});
|
|
27441
|
+
const td = t2.toLocaleDateString(void 0, {
|
|
27442
|
+
year: "numeric",
|
|
27443
|
+
month: "short",
|
|
27444
|
+
day: "2-digit"
|
|
27445
|
+
});
|
|
26934
27446
|
return `${fd} ${fmtTime(f)} – ${td} ${fmtTime(t2)}`;
|
|
26935
27447
|
}
|
|
26936
27448
|
return placeholder;
|
|
@@ -26942,8 +27454,12 @@ function DateTimeRangePicker({
|
|
|
26942
27454
|
const yyyy = d.getFullYear();
|
|
26943
27455
|
return `${dd} / ${mm} / ${yyyy}`;
|
|
26944
27456
|
}, []);
|
|
26945
|
-
const [fromInput, setFromInput] = React.useState(
|
|
26946
|
-
|
|
27457
|
+
const [fromInput, setFromInput] = React.useState(
|
|
27458
|
+
fmtDate((draft == null ? void 0 : draft.from) ?? (value == null ? void 0 : value.from) ?? null)
|
|
27459
|
+
);
|
|
27460
|
+
const [toInput, setToInput] = React.useState(
|
|
27461
|
+
fmtDate((draft == null ? void 0 : draft.to) ?? (value == null ? void 0 : value.to) ?? null)
|
|
27462
|
+
);
|
|
26947
27463
|
React.useEffect(() => {
|
|
26948
27464
|
if (isOpen) {
|
|
26949
27465
|
setFromInput(fmtDate((value == null ? void 0 : value.from) ?? null));
|
|
@@ -26971,7 +27487,8 @@ function DateTimeRangePicker({
|
|
|
26971
27487
|
const lastDay = new Date(yyyy, mm, 0).getDate();
|
|
26972
27488
|
if (dd < 1 || dd > lastDay) return void 0;
|
|
26973
27489
|
const out = new Date(yyyy, mm - 1, dd);
|
|
26974
|
-
if (isBefore(out, minDate) || isAfter(out, maxDate) || inDisabled(out, disabledDates))
|
|
27490
|
+
if (isBefore(out, minDate) || isAfter(out, maxDate) || inDisabled(out, disabledDates))
|
|
27491
|
+
return void 0;
|
|
26975
27492
|
return out;
|
|
26976
27493
|
};
|
|
26977
27494
|
const fromParsed = parseMasked(fromInput);
|
|
@@ -27012,159 +27529,223 @@ function DateTimeRangePicker({
|
|
|
27012
27529
|
}, [toParsed, draft, value]);
|
|
27013
27530
|
const invalidRange = !mergedFrom || !mergedTo || isBefore(mergedFrom, minDate) || isAfter(mergedTo, maxDate) || mergedFrom > mergedTo || rangeContainsDisabled(mergedFrom, mergedTo, disabledDates);
|
|
27014
27531
|
return /* @__PURE__ */ jsx("div", { className: cn$1("w-fit", className), ...props2, children: /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: setOpen, children: [
|
|
27015
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
27016
|
-
|
|
27017
|
-
|
|
27018
|
-
|
|
27019
|
-
|
|
27020
|
-
|
|
27021
|
-
|
|
27022
|
-
|
|
27532
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
27533
|
+
Button$1,
|
|
27534
|
+
{
|
|
27535
|
+
type: "button",
|
|
27536
|
+
disabled,
|
|
27537
|
+
variant: buttonVariant,
|
|
27538
|
+
className: cn$1(
|
|
27539
|
+
"w-[360px] justify-start text-left font-normal",
|
|
27540
|
+
!value && "text-muted-foreground"
|
|
27541
|
+
),
|
|
27542
|
+
children: [
|
|
27543
|
+
/* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
|
|
27544
|
+
label
|
|
27545
|
+
]
|
|
27546
|
+
}
|
|
27547
|
+
) }),
|
|
27548
|
+
/* @__PURE__ */ jsxs(
|
|
27549
|
+
PopoverContent,
|
|
27550
|
+
{
|
|
27551
|
+
className: "w-auto max-w-none p-4",
|
|
27552
|
+
align: "start",
|
|
27553
|
+
side: popoverSide ?? "bottom",
|
|
27554
|
+
sideOffset: 8,
|
|
27555
|
+
children: [
|
|
27556
|
+
/* @__PURE__ */ jsxs("div", { className: cn$1("w-fit min-w-0", contentClassName), children: [
|
|
27557
|
+
/* @__PURE__ */ jsx("div", { className: "mb-3 rounded-md border border-input bg-background/50 px-3 py-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-end gap-3", children: [
|
|
27558
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-end gap-2", children: [
|
|
27559
|
+
/* @__PURE__ */ jsx(
|
|
27560
|
+
"input",
|
|
27561
|
+
{
|
|
27562
|
+
type: "text",
|
|
27563
|
+
inputMode: "numeric",
|
|
27564
|
+
value: fromInput,
|
|
27565
|
+
onChange: (e2) => setFromInput(maskDate(e2.target.value)),
|
|
27566
|
+
onBlur: () => {
|
|
27567
|
+
const p2 = parseMasked(fromInput);
|
|
27568
|
+
if (p2) {
|
|
27569
|
+
const prev = (draft == null ? void 0 : draft.from) ?? null;
|
|
27570
|
+
const withTime = new Date(
|
|
27571
|
+
p2.getFullYear(),
|
|
27572
|
+
p2.getMonth(),
|
|
27573
|
+
p2.getDate(),
|
|
27574
|
+
prev ? prev.getHours() : 0,
|
|
27575
|
+
prev ? prev.getMinutes() : 0,
|
|
27576
|
+
prev ? prev.getSeconds() : 0
|
|
27577
|
+
);
|
|
27578
|
+
setDraft((d) => ({ ...d ?? {}, from: withTime }));
|
|
27579
|
+
}
|
|
27580
|
+
},
|
|
27581
|
+
placeholder: "dd/mm/yyyy",
|
|
27582
|
+
className: "h-9 w-40 rounded-md border bg-background px-3 text-sm shadow-xs outline-hidden"
|
|
27583
|
+
}
|
|
27584
|
+
),
|
|
27585
|
+
/* @__PURE__ */ jsx(
|
|
27586
|
+
TimeSelectors,
|
|
27587
|
+
{
|
|
27588
|
+
label: "From",
|
|
27589
|
+
compact: true,
|
|
27590
|
+
value: (draft == null ? void 0 : draft.from) ?? null,
|
|
27591
|
+
onChange: (d) => setDraft((prev) => ({ ...prev ?? {}, from: d })),
|
|
27592
|
+
precision: timePrecision,
|
|
27593
|
+
hourCycle,
|
|
27594
|
+
minuteStep,
|
|
27595
|
+
secondStep,
|
|
27596
|
+
disabled
|
|
27597
|
+
}
|
|
27598
|
+
)
|
|
27599
|
+
] }),
|
|
27600
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "–" }),
|
|
27601
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-end gap-2", children: [
|
|
27602
|
+
/* @__PURE__ */ jsx(
|
|
27603
|
+
"input",
|
|
27604
|
+
{
|
|
27605
|
+
type: "text",
|
|
27606
|
+
inputMode: "numeric",
|
|
27607
|
+
value: toInput,
|
|
27608
|
+
onChange: (e2) => setToInput(maskDate(e2.target.value)),
|
|
27609
|
+
onBlur: () => {
|
|
27610
|
+
const p2 = parseMasked(toInput);
|
|
27611
|
+
if (p2) {
|
|
27612
|
+
const prev = (draft == null ? void 0 : draft.to) ?? null;
|
|
27613
|
+
const withTime = new Date(
|
|
27614
|
+
p2.getFullYear(),
|
|
27615
|
+
p2.getMonth(),
|
|
27616
|
+
p2.getDate(),
|
|
27617
|
+
prev ? prev.getHours() : 0,
|
|
27618
|
+
prev ? prev.getMinutes() : 0,
|
|
27619
|
+
prev ? prev.getSeconds() : 0
|
|
27620
|
+
);
|
|
27621
|
+
setDraft((d) => ({ ...d ?? {}, to: withTime }));
|
|
27622
|
+
}
|
|
27623
|
+
},
|
|
27624
|
+
placeholder: "dd/mm/yyyy",
|
|
27625
|
+
className: "h-9 w-40 rounded-md border bg-background px-3 text-sm shadow-xs outline-hidden"
|
|
27626
|
+
}
|
|
27627
|
+
),
|
|
27628
|
+
/* @__PURE__ */ jsx(
|
|
27629
|
+
TimeSelectors,
|
|
27630
|
+
{
|
|
27631
|
+
label: "To",
|
|
27632
|
+
compact: true,
|
|
27633
|
+
value: (draft == null ? void 0 : draft.to) ?? null,
|
|
27634
|
+
onChange: (d) => setDraft((prev) => ({ ...prev ?? {}, to: d })),
|
|
27635
|
+
precision: timePrecision,
|
|
27636
|
+
hourCycle,
|
|
27637
|
+
minuteStep,
|
|
27638
|
+
secondStep,
|
|
27639
|
+
disabled
|
|
27640
|
+
}
|
|
27641
|
+
)
|
|
27642
|
+
] })
|
|
27643
|
+
] }) }),
|
|
27023
27644
|
/* @__PURE__ */ jsx(
|
|
27024
|
-
|
|
27645
|
+
Calendar,
|
|
27025
27646
|
{
|
|
27026
|
-
|
|
27027
|
-
|
|
27028
|
-
|
|
27029
|
-
|
|
27030
|
-
|
|
27031
|
-
|
|
27032
|
-
if (
|
|
27033
|
-
|
|
27034
|
-
|
|
27035
|
-
p2.getFullYear(),
|
|
27036
|
-
p2.getMonth(),
|
|
27037
|
-
p2.getDate(),
|
|
27038
|
-
prev ? prev.getHours() : 0,
|
|
27039
|
-
prev ? prev.getMinutes() : 0,
|
|
27040
|
-
prev ? prev.getSeconds() : 0
|
|
27041
|
-
);
|
|
27042
|
-
setDraft((d) => ({ ...d ?? {}, from: withTime }));
|
|
27647
|
+
mode: "range",
|
|
27648
|
+
numberOfMonths,
|
|
27649
|
+
selected: (draft == null ? void 0 : draft.from) && (draft == null ? void 0 : draft.to) ? { from: draft.from, to: draft.to } : void 0,
|
|
27650
|
+
onSelect: (range) => {
|
|
27651
|
+
var _a, _b, _c, _d, _e2, _f;
|
|
27652
|
+
if (disabled) return;
|
|
27653
|
+
if (!range) {
|
|
27654
|
+
setDraft(null);
|
|
27655
|
+
return;
|
|
27043
27656
|
}
|
|
27657
|
+
const { from, to } = range;
|
|
27658
|
+
if (from && (isBefore(from, minDate) || isAfter(from, maxDate)))
|
|
27659
|
+
return;
|
|
27660
|
+
if (to && (isBefore(to, minDate) || isAfter(to, maxDate)))
|
|
27661
|
+
return;
|
|
27662
|
+
if (from && to && rangeContainsDisabled(from, to, disabledDates))
|
|
27663
|
+
return;
|
|
27664
|
+
const prevFrom = (draft == null ? void 0 : draft.from) ?? from;
|
|
27665
|
+
const prevTo = (draft == null ? void 0 : draft.to) ?? to;
|
|
27666
|
+
const nextFrom = from ? new Date(
|
|
27667
|
+
from.getFullYear(),
|
|
27668
|
+
from.getMonth(),
|
|
27669
|
+
from.getDate(),
|
|
27670
|
+
((_a = prevFrom == null ? void 0 : prevFrom.getHours) == null ? void 0 : _a.call(prevFrom)) ?? 0,
|
|
27671
|
+
((_b = prevFrom == null ? void 0 : prevFrom.getMinutes) == null ? void 0 : _b.call(prevFrom)) ?? 0,
|
|
27672
|
+
((_c = prevFrom == null ? void 0 : prevFrom.getSeconds) == null ? void 0 : _c.call(prevFrom)) ?? 0
|
|
27673
|
+
) : void 0;
|
|
27674
|
+
const nextTo = to ? new Date(
|
|
27675
|
+
to.getFullYear(),
|
|
27676
|
+
to.getMonth(),
|
|
27677
|
+
to.getDate(),
|
|
27678
|
+
((_d = prevTo == null ? void 0 : prevTo.getHours) == null ? void 0 : _d.call(prevTo)) ?? 0,
|
|
27679
|
+
((_e2 = prevTo == null ? void 0 : prevTo.getMinutes) == null ? void 0 : _e2.call(prevTo)) ?? 0,
|
|
27680
|
+
((_f = prevTo == null ? void 0 : prevTo.getSeconds) == null ? void 0 : _f.call(prevTo)) ?? 0
|
|
27681
|
+
) : void 0;
|
|
27682
|
+
setDraft({ from: nextFrom ?? null, to: nextTo ?? null });
|
|
27683
|
+
setFromInput(fmtDate(nextFrom ?? null));
|
|
27684
|
+
setToInput(fmtDate(nextTo ?? null));
|
|
27044
27685
|
},
|
|
27045
|
-
|
|
27046
|
-
|
|
27047
|
-
|
|
27048
|
-
|
|
27049
|
-
/* @__PURE__ */ jsx(
|
|
27050
|
-
TimeSelectors,
|
|
27051
|
-
{
|
|
27052
|
-
label: "From",
|
|
27053
|
-
compact: true,
|
|
27054
|
-
value: (draft == null ? void 0 : draft.from) ?? null,
|
|
27055
|
-
onChange: (d) => setDraft((prev) => ({ ...prev ?? {}, from: d })),
|
|
27056
|
-
precision: timePrecision,
|
|
27057
|
-
hourCycle,
|
|
27058
|
-
minuteStep,
|
|
27059
|
-
secondStep,
|
|
27060
|
-
disabled
|
|
27686
|
+
defaultMonth: (draft == null ? void 0 : draft.from) ?? (value == null ? void 0 : value.from) ?? /* @__PURE__ */ new Date(),
|
|
27687
|
+
disabled: (d) => isBefore(d, minDate) || isAfter(d, maxDate) || inDisabled(d, disabledDates),
|
|
27688
|
+
buttonVariant: "ghost",
|
|
27689
|
+
showOutsideDays: true
|
|
27061
27690
|
}
|
|
27062
27691
|
)
|
|
27063
27692
|
] }),
|
|
27064
|
-
/* @__PURE__ */
|
|
27065
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-end gap-2", children: [
|
|
27693
|
+
(props2.showFooter ?? true) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 pt-3 mt-3 border-t", children: [
|
|
27066
27694
|
/* @__PURE__ */ jsx(
|
|
27067
|
-
|
|
27695
|
+
Button$1,
|
|
27068
27696
|
{
|
|
27069
|
-
type: "
|
|
27070
|
-
|
|
27071
|
-
|
|
27072
|
-
|
|
27073
|
-
|
|
27074
|
-
|
|
27075
|
-
if (p2) {
|
|
27076
|
-
const prev = (draft == null ? void 0 : draft.to) ?? null;
|
|
27077
|
-
const withTime = new Date(
|
|
27078
|
-
p2.getFullYear(),
|
|
27079
|
-
p2.getMonth(),
|
|
27080
|
-
p2.getDate(),
|
|
27081
|
-
prev ? prev.getHours() : 0,
|
|
27082
|
-
prev ? prev.getMinutes() : 0,
|
|
27083
|
-
prev ? prev.getSeconds() : 0
|
|
27084
|
-
);
|
|
27085
|
-
setDraft((d) => ({ ...d ?? {}, to: withTime }));
|
|
27086
|
-
}
|
|
27087
|
-
},
|
|
27088
|
-
placeholder: "dd/mm/yyyy",
|
|
27089
|
-
className: "h-9 w-40 rounded-md border bg-background px-3 text-sm shadow-xs outline-hidden"
|
|
27697
|
+
type: "button",
|
|
27698
|
+
variant: "outline",
|
|
27699
|
+
size: "sm",
|
|
27700
|
+
onClick: () => setOpen(false),
|
|
27701
|
+
disabled,
|
|
27702
|
+
children: props2.cancelLabel ?? "Cancel"
|
|
27090
27703
|
}
|
|
27091
27704
|
),
|
|
27092
|
-
/* @__PURE__ */
|
|
27093
|
-
|
|
27094
|
-
|
|
27095
|
-
|
|
27096
|
-
|
|
27097
|
-
|
|
27098
|
-
|
|
27099
|
-
|
|
27100
|
-
|
|
27101
|
-
|
|
27102
|
-
|
|
27103
|
-
|
|
27104
|
-
|
|
27105
|
-
|
|
27705
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
27706
|
+
/* @__PURE__ */ jsx(
|
|
27707
|
+
Button$1,
|
|
27708
|
+
{
|
|
27709
|
+
type: "button",
|
|
27710
|
+
variant: "ghost",
|
|
27711
|
+
size: "sm",
|
|
27712
|
+
onClick: () => onChange == null ? void 0 : onChange(null),
|
|
27713
|
+
disabled,
|
|
27714
|
+
children: props2.clearLabel ?? "Clear"
|
|
27715
|
+
}
|
|
27716
|
+
),
|
|
27717
|
+
/* @__PURE__ */ jsx(
|
|
27718
|
+
Button$1,
|
|
27719
|
+
{
|
|
27720
|
+
type: "button",
|
|
27721
|
+
variant: "default",
|
|
27722
|
+
size: "sm",
|
|
27723
|
+
onClick: () => {
|
|
27724
|
+
if (invalidRange || !mergedFrom || !mergedTo) return;
|
|
27725
|
+
onChange == null ? void 0 : onChange({ from: mergedFrom, to: mergedTo });
|
|
27726
|
+
setOpen(false);
|
|
27727
|
+
},
|
|
27728
|
+
disabled: disabled || invalidRange,
|
|
27729
|
+
children: props2.applyLabel ?? "Apply"
|
|
27730
|
+
}
|
|
27731
|
+
)
|
|
27732
|
+
] })
|
|
27106
27733
|
] })
|
|
27107
|
-
]
|
|
27108
|
-
|
|
27109
|
-
|
|
27110
|
-
{
|
|
27111
|
-
mode: "range",
|
|
27112
|
-
numberOfMonths,
|
|
27113
|
-
selected: (draft == null ? void 0 : draft.from) && (draft == null ? void 0 : draft.to) ? { from: draft.from, to: draft.to } : void 0,
|
|
27114
|
-
onSelect: (range) => {
|
|
27115
|
-
var _a, _b, _c, _d, _e2, _f;
|
|
27116
|
-
if (disabled) return;
|
|
27117
|
-
if (!range) {
|
|
27118
|
-
setDraft(null);
|
|
27119
|
-
return;
|
|
27120
|
-
}
|
|
27121
|
-
const { from, to } = range;
|
|
27122
|
-
if (from && (isBefore(from, minDate) || isAfter(from, maxDate))) return;
|
|
27123
|
-
if (to && (isBefore(to, minDate) || isAfter(to, maxDate))) return;
|
|
27124
|
-
if (from && to && rangeContainsDisabled(from, to, disabledDates)) return;
|
|
27125
|
-
const prevFrom = (draft == null ? void 0 : draft.from) ?? from;
|
|
27126
|
-
const prevTo = (draft == null ? void 0 : draft.to) ?? to;
|
|
27127
|
-
const nextFrom = from ? new Date(from.getFullYear(), from.getMonth(), from.getDate(), ((_a = prevFrom == null ? void 0 : prevFrom.getHours) == null ? void 0 : _a.call(prevFrom)) ?? 0, ((_b = prevFrom == null ? void 0 : prevFrom.getMinutes) == null ? void 0 : _b.call(prevFrom)) ?? 0, ((_c = prevFrom == null ? void 0 : prevFrom.getSeconds) == null ? void 0 : _c.call(prevFrom)) ?? 0) : void 0;
|
|
27128
|
-
const nextTo = to ? new Date(to.getFullYear(), to.getMonth(), to.getDate(), ((_d = prevTo == null ? void 0 : prevTo.getHours) == null ? void 0 : _d.call(prevTo)) ?? 0, ((_e2 = prevTo == null ? void 0 : prevTo.getMinutes) == null ? void 0 : _e2.call(prevTo)) ?? 0, ((_f = prevTo == null ? void 0 : prevTo.getSeconds) == null ? void 0 : _f.call(prevTo)) ?? 0) : void 0;
|
|
27129
|
-
setDraft({ from: nextFrom ?? null, to: nextTo ?? null });
|
|
27130
|
-
setFromInput(fmtDate(nextFrom ?? null));
|
|
27131
|
-
setToInput(fmtDate(nextTo ?? null));
|
|
27132
|
-
},
|
|
27133
|
-
defaultMonth: (draft == null ? void 0 : draft.from) ?? (value == null ? void 0 : value.from) ?? /* @__PURE__ */ new Date(),
|
|
27134
|
-
disabled: (d) => isBefore(d, minDate) || isAfter(d, maxDate) || inDisabled(d, disabledDates),
|
|
27135
|
-
buttonVariant: "ghost",
|
|
27136
|
-
showOutsideDays: true
|
|
27137
|
-
}
|
|
27138
|
-
)
|
|
27139
|
-
] }),
|
|
27140
|
-
(props2.showFooter ?? true) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 pt-3 mt-3 border-t", children: [
|
|
27141
|
-
/* @__PURE__ */ jsx(Button$1, { type: "button", variant: "outline", size: "sm", onClick: () => setOpen(false), disabled, children: props2.cancelLabel ?? "Cancel" }),
|
|
27142
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
27143
|
-
/* @__PURE__ */ jsx(Button$1, { type: "button", variant: "ghost", size: "sm", onClick: () => onChange == null ? void 0 : onChange(null), disabled, children: props2.clearLabel ?? "Clear" }),
|
|
27144
|
-
/* @__PURE__ */ jsx(
|
|
27145
|
-
Button$1,
|
|
27146
|
-
{
|
|
27147
|
-
type: "button",
|
|
27148
|
-
variant: "default",
|
|
27149
|
-
size: "sm",
|
|
27150
|
-
onClick: () => {
|
|
27151
|
-
if (invalidRange || !mergedFrom || !mergedTo) return;
|
|
27152
|
-
onChange == null ? void 0 : onChange({ from: mergedFrom, to: mergedTo });
|
|
27153
|
-
setOpen(false);
|
|
27154
|
-
},
|
|
27155
|
-
disabled: disabled || invalidRange,
|
|
27156
|
-
children: props2.applyLabel ?? "Apply"
|
|
27157
|
-
}
|
|
27158
|
-
)
|
|
27159
|
-
] })
|
|
27160
|
-
] })
|
|
27161
|
-
] })
|
|
27734
|
+
]
|
|
27735
|
+
}
|
|
27736
|
+
)
|
|
27162
27737
|
] }) });
|
|
27163
27738
|
}
|
|
27164
27739
|
DateTimeRangePicker.displayName = "DateTimeRangePicker";
|
|
27165
|
-
function DateTimeRangePickerField({
|
|
27740
|
+
function DateTimeRangePickerField({
|
|
27741
|
+
field,
|
|
27742
|
+
value,
|
|
27743
|
+
onChange,
|
|
27744
|
+
className
|
|
27745
|
+
}) {
|
|
27166
27746
|
const v = React.useMemo(() => {
|
|
27167
|
-
if (!value || typeof value !== "object")
|
|
27747
|
+
if (!value || typeof value !== "object")
|
|
27748
|
+
return null;
|
|
27168
27749
|
const anyVal = value;
|
|
27169
27750
|
const toDate2 = (x2) => {
|
|
27170
27751
|
if (!x2) return void 0;
|
|
@@ -30217,25 +30798,53 @@ function formatBytes(bytes) {
|
|
|
30217
30798
|
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
|
30218
30799
|
if (bytes === 0) return "0 Byte";
|
|
30219
30800
|
const i2 = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
30220
|
-
return `${(bytes /
|
|
30801
|
+
return `${(bytes / 1024 ** i2).toFixed(2)} ${sizes[i2]}`;
|
|
30221
30802
|
}
|
|
30222
30803
|
function isImageType(type, name) {
|
|
30223
30804
|
if (!type && name) {
|
|
30224
30805
|
const ext = name.toLowerCase().split(".").pop();
|
|
30225
30806
|
if (!ext) return false;
|
|
30226
|
-
return [
|
|
30807
|
+
return [
|
|
30808
|
+
"png",
|
|
30809
|
+
"jpg",
|
|
30810
|
+
"jpeg",
|
|
30811
|
+
"webp",
|
|
30812
|
+
"gif",
|
|
30813
|
+
"bmp",
|
|
30814
|
+
"svg",
|
|
30815
|
+
"heic",
|
|
30816
|
+
"heif"
|
|
30817
|
+
].includes(ext);
|
|
30227
30818
|
}
|
|
30228
30819
|
return !!(type == null ? void 0 : type.startsWith("image/"));
|
|
30229
30820
|
}
|
|
30230
30821
|
function pickIconByType(type, name) {
|
|
30231
30822
|
const t2 = (type || "").toLowerCase();
|
|
30232
30823
|
const ext = ((name == null ? void 0 : name.split(".").pop()) || "").toLowerCase();
|
|
30233
|
-
if (t2.startsWith("image/") || [
|
|
30234
|
-
|
|
30235
|
-
|
|
30236
|
-
|
|
30237
|
-
|
|
30238
|
-
|
|
30824
|
+
if (t2.startsWith("image/") || [
|
|
30825
|
+
"png",
|
|
30826
|
+
"jpg",
|
|
30827
|
+
"jpeg",
|
|
30828
|
+
"webp",
|
|
30829
|
+
"gif",
|
|
30830
|
+
"bmp",
|
|
30831
|
+
"svg",
|
|
30832
|
+
"heic",
|
|
30833
|
+
"heif"
|
|
30834
|
+
].includes(ext))
|
|
30835
|
+
return /* @__PURE__ */ jsx(Image$1, { className: "h-8 w-8" });
|
|
30836
|
+
if (t2.startsWith("video/") || ["mp4", "mov", "webm", "mkv"].includes(ext))
|
|
30837
|
+
return /* @__PURE__ */ jsx(Video, { className: "h-8 w-8" });
|
|
30838
|
+
if (t2.startsWith("audio/") || ["mp3", "wav", "aac", "flac"].includes(ext))
|
|
30839
|
+
return /* @__PURE__ */ jsx(Music, { className: "h-8 w-8" });
|
|
30840
|
+
if (["zip", "rar", "7z", "tar", "gz"].includes(ext))
|
|
30841
|
+
return /* @__PURE__ */ jsx(Archive, { className: "h-8 w-8" });
|
|
30842
|
+
if (["txt", "md", "rtf"].includes(ext))
|
|
30843
|
+
return /* @__PURE__ */ jsx(FileText, { className: "h-8 w-8" });
|
|
30844
|
+
if (["js", "ts", "tsx", "json", "yml", "yaml", "xml", "html", "css"].includes(
|
|
30845
|
+
ext
|
|
30846
|
+
))
|
|
30847
|
+
return /* @__PURE__ */ jsx(FileCode, { className: "h-8 w-8" });
|
|
30239
30848
|
return /* @__PURE__ */ jsx(File, { className: "h-8 w-8" });
|
|
30240
30849
|
}
|
|
30241
30850
|
function getPreviewUrl(file) {
|
|
@@ -30275,7 +30884,9 @@ function FileUploader({
|
|
|
30275
30884
|
const prevUrlsRef = useRef(/* @__PURE__ */ new Set());
|
|
30276
30885
|
useEffect(() => {
|
|
30277
30886
|
return () => {
|
|
30278
|
-
prevUrlsRef.current.forEach((url) =>
|
|
30887
|
+
prevUrlsRef.current.forEach((url) => {
|
|
30888
|
+
URL.revokeObjectURL(url);
|
|
30889
|
+
});
|
|
30279
30890
|
prevUrlsRef.current.clear();
|
|
30280
30891
|
};
|
|
30281
30892
|
}, []);
|
|
@@ -30311,7 +30922,7 @@ function FileUploader({
|
|
|
30311
30922
|
});
|
|
30312
30923
|
return changed ? next : prev;
|
|
30313
30924
|
});
|
|
30314
|
-
}, [
|
|
30925
|
+
}, []);
|
|
30315
30926
|
const handleRemove = useCallback(
|
|
30316
30927
|
async (idx) => {
|
|
30317
30928
|
const target = files[idx];
|
|
@@ -30329,14 +30940,23 @@ function FileUploader({
|
|
|
30329
30940
|
try {
|
|
30330
30941
|
setFilesAndEmit((prev) => {
|
|
30331
30942
|
const n2 = [...prev];
|
|
30332
|
-
n2[index2] = {
|
|
30943
|
+
n2[index2] = {
|
|
30944
|
+
...n2[index2],
|
|
30945
|
+
status: "uploading",
|
|
30946
|
+
progress: 0,
|
|
30947
|
+
errorMessage: void 0
|
|
30948
|
+
};
|
|
30333
30949
|
return n2;
|
|
30334
30950
|
});
|
|
30335
30951
|
const result = await uploader(f, (pct) => {
|
|
30336
30952
|
setFilesAndEmit((prev) => {
|
|
30337
30953
|
const n2 = [...prev];
|
|
30338
30954
|
if (!n2[index2]) return prev;
|
|
30339
|
-
n2[index2] = {
|
|
30955
|
+
n2[index2] = {
|
|
30956
|
+
...n2[index2],
|
|
30957
|
+
progress: Math.min(100, Math.max(0, Math.round(pct))),
|
|
30958
|
+
status: "uploading"
|
|
30959
|
+
};
|
|
30340
30960
|
return n2;
|
|
30341
30961
|
});
|
|
30342
30962
|
});
|
|
@@ -30365,7 +30985,15 @@ function FileUploader({
|
|
|
30365
30985
|
if (failed) onUploadError == null ? void 0 : onUploadError(failed, err);
|
|
30366
30986
|
}
|
|
30367
30987
|
},
|
|
30368
|
-
[
|
|
30988
|
+
[
|
|
30989
|
+
files,
|
|
30990
|
+
isControlled,
|
|
30991
|
+
onUploadError,
|
|
30992
|
+
onUploadSuccess,
|
|
30993
|
+
setFilesAndEmit,
|
|
30994
|
+
uploader,
|
|
30995
|
+
value
|
|
30996
|
+
]
|
|
30369
30997
|
);
|
|
30370
30998
|
const handleRetry = useCallback(
|
|
30371
30999
|
(idx) => {
|
|
@@ -30412,14 +31040,26 @@ function FileUploader({
|
|
|
30412
31040
|
});
|
|
30413
31041
|
if (uploader) {
|
|
30414
31042
|
const baseIndex = ((_a = isControlled ? value : files) == null ? void 0 : _a.length) ?? 0;
|
|
30415
|
-
const capacity = typeof maxFiles === "number" ? Math.max(
|
|
31043
|
+
const capacity = typeof maxFiles === "number" ? Math.max(
|
|
31044
|
+
0,
|
|
31045
|
+
maxFiles - (((_b = isControlled ? value : files) == null ? void 0 : _b.length) ?? 0)
|
|
31046
|
+
) : acceptedFiles.length;
|
|
30416
31047
|
acceptedFiles.slice(0, capacity).forEach((f, i2) => {
|
|
30417
31048
|
const index2 = multiple ? baseIndex + i2 : 0;
|
|
30418
31049
|
void startUpload(index2, f);
|
|
30419
31050
|
});
|
|
30420
31051
|
}
|
|
30421
31052
|
},
|
|
30422
|
-
[
|
|
31053
|
+
[
|
|
31054
|
+
files,
|
|
31055
|
+
isControlled,
|
|
31056
|
+
maxFiles,
|
|
31057
|
+
multiple,
|
|
31058
|
+
startUpload,
|
|
31059
|
+
uploader,
|
|
31060
|
+
value,
|
|
31061
|
+
setFilesAndEmit
|
|
31062
|
+
]
|
|
30423
31063
|
);
|
|
30424
31064
|
const disabledBecauseFull = !!maxFiles && files.length >= maxFiles;
|
|
30425
31065
|
const { getRootProps, getInputProps, isDragActive, isDragReject, open } = useDropzone({
|
|
@@ -30463,88 +31103,131 @@ function FileUploader({
|
|
|
30463
31103
|
const onRetryAt = useCallback((i2) => {
|
|
30464
31104
|
retryRef.current(i2);
|
|
30465
31105
|
}, []);
|
|
30466
|
-
const FileItem = memo$1(
|
|
30467
|
-
|
|
30468
|
-
|
|
30469
|
-
|
|
30470
|
-
|
|
30471
|
-
|
|
30472
|
-
|
|
30473
|
-
|
|
30474
|
-
|
|
30475
|
-
|
|
30476
|
-
|
|
30477
|
-
|
|
30478
|
-
|
|
30479
|
-
|
|
30480
|
-
|
|
30481
|
-
|
|
30482
|
-
|
|
30483
|
-
|
|
30484
|
-
|
|
30485
|
-
|
|
30486
|
-
|
|
30487
|
-
|
|
30488
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
30489
|
-
|
|
30490
|
-
|
|
30491
|
-
|
|
30492
|
-
|
|
30493
|
-
|
|
30494
|
-
|
|
30495
|
-
|
|
30496
|
-
|
|
30497
|
-
|
|
30498
|
-
|
|
30499
|
-
|
|
30500
|
-
|
|
30501
|
-
|
|
30502
|
-
) }),
|
|
30503
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: "Retry" })
|
|
30504
|
-
] }) : null,
|
|
30505
|
-
withDownload2 && (fr.url || fr.thumbnailUrl) ? /* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
30506
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
30507
|
-
Button$1,
|
|
30508
|
-
{
|
|
30509
|
-
size: "icon",
|
|
30510
|
-
variant: "ghost",
|
|
30511
|
-
onClick: () => {
|
|
30512
|
-
const url = fr.url ?? fr.thumbnailUrl;
|
|
30513
|
-
if (url) {
|
|
30514
|
-
window.open(url, "_blank", "noopener,noreferrer");
|
|
31106
|
+
const FileItem = memo$1(
|
|
31107
|
+
function FileItem2({
|
|
31108
|
+
fr,
|
|
31109
|
+
idx,
|
|
31110
|
+
layout: layout2,
|
|
31111
|
+
withDownload: withDownload2,
|
|
31112
|
+
uploaderPresent,
|
|
31113
|
+
onRemove: onRemove2,
|
|
31114
|
+
onRetry: onRetry2
|
|
31115
|
+
}) {
|
|
31116
|
+
const name = fr.name;
|
|
31117
|
+
const size2 = formatBytes(fr.size);
|
|
31118
|
+
const error = fr.status === "error" ? fr.errorMessage : void 0;
|
|
31119
|
+
const preview = getPreviewUrl(fr);
|
|
31120
|
+
return /* @__PURE__ */ jsxs(
|
|
31121
|
+
"div",
|
|
31122
|
+
{
|
|
31123
|
+
className: cn$1(
|
|
31124
|
+
"flex items-center gap-3 border rounded-md p-2 bg-card",
|
|
31125
|
+
layout2 === "grid" ? "flex-col items-stretch" : "flex-row"
|
|
31126
|
+
),
|
|
31127
|
+
children: [
|
|
31128
|
+
/* @__PURE__ */ jsx("div", { className: cn$1(layout2 === "grid" ? "self-center" : ""), children: /* @__PURE__ */ jsxs(
|
|
31129
|
+
"div",
|
|
31130
|
+
{
|
|
31131
|
+
className: cn$1(
|
|
31132
|
+
"relative overflow-hidden bg-muted/40 border rounded-md flex items-center justify-center",
|
|
31133
|
+
layout2 === "grid" ? "h-28 w-28" : "h-16 w-16"
|
|
31134
|
+
),
|
|
31135
|
+
children: [
|
|
31136
|
+
preview ? /* @__PURE__ */ jsx(
|
|
31137
|
+
"img",
|
|
31138
|
+
{
|
|
31139
|
+
src: preview,
|
|
31140
|
+
alt: fr.name,
|
|
31141
|
+
className: "object-cover w-full h-full"
|
|
30515
31142
|
}
|
|
30516
|
-
},
|
|
30517
|
-
"
|
|
30518
|
-
children: /* @__PURE__ */ jsx(
|
|
30519
|
-
|
|
30520
|
-
|
|
30521
|
-
|
|
30522
|
-
|
|
30523
|
-
/* @__PURE__ */ jsxs(
|
|
30524
|
-
|
|
30525
|
-
|
|
30526
|
-
|
|
30527
|
-
|
|
30528
|
-
|
|
30529
|
-
|
|
30530
|
-
|
|
30531
|
-
|
|
30532
|
-
|
|
30533
|
-
|
|
30534
|
-
|
|
30535
|
-
|
|
30536
|
-
|
|
30537
|
-
|
|
30538
|
-
|
|
30539
|
-
|
|
30540
|
-
|
|
30541
|
-
|
|
30542
|
-
|
|
31143
|
+
) : /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center text-muted-foreground", children: pickIconByType(fr.type, fr.name) }),
|
|
31144
|
+
fr.status === "uploading" ? /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/40 flex items-center justify-center", children: /* @__PURE__ */ jsx(LoaderCircle, { className: "h-6 w-6 text-white animate-spin" }) }) : null,
|
|
31145
|
+
fr.status === "success" ? /* @__PURE__ */ jsx("div", { className: "absolute top-1 right-1 text-green-500", children: /* @__PURE__ */ jsx(CircleCheck, { className: "h-5 w-5 drop-shadow" }) }) : null,
|
|
31146
|
+
fr.status === "error" ? /* @__PURE__ */ jsx("div", { className: "absolute top-1 right-1 text-red-500", children: /* @__PURE__ */ jsx(CircleX, { className: "h-5 w-5 drop-shadow" }) }) : null
|
|
31147
|
+
]
|
|
31148
|
+
}
|
|
31149
|
+
) }),
|
|
31150
|
+
/* @__PURE__ */ jsxs(
|
|
31151
|
+
"div",
|
|
31152
|
+
{
|
|
31153
|
+
className: cn$1("min-w-0 flex-1", layout2 === "grid" ? "mt-2" : ""),
|
|
31154
|
+
children: [
|
|
31155
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
31156
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
31157
|
+
/* @__PURE__ */ jsx("div", { className: "truncate font-medium", title: name, children: name }),
|
|
31158
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: size2 })
|
|
31159
|
+
] }),
|
|
31160
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
31161
|
+
fr.status === "error" ? /* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
31162
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
31163
|
+
Button$1,
|
|
31164
|
+
{
|
|
31165
|
+
size: "icon",
|
|
31166
|
+
variant: "ghost",
|
|
31167
|
+
onClick: () => onRetry2(idx),
|
|
31168
|
+
"aria-label": "Retry upload",
|
|
31169
|
+
disabled: !uploaderPresent || !fr.file,
|
|
31170
|
+
children: /* @__PURE__ */ jsx(RotateCcw, { className: "h-4 w-4" })
|
|
31171
|
+
}
|
|
31172
|
+
) }),
|
|
31173
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: "Retry" })
|
|
31174
|
+
] }) : null,
|
|
31175
|
+
withDownload2 && (fr.url || fr.thumbnailUrl) ? /* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
31176
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
31177
|
+
Button$1,
|
|
31178
|
+
{
|
|
31179
|
+
size: "icon",
|
|
31180
|
+
variant: "ghost",
|
|
31181
|
+
onClick: () => {
|
|
31182
|
+
const url = fr.url ?? fr.thumbnailUrl;
|
|
31183
|
+
if (url) {
|
|
31184
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
31185
|
+
}
|
|
31186
|
+
},
|
|
31187
|
+
"aria-label": "Download",
|
|
31188
|
+
children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" })
|
|
31189
|
+
}
|
|
31190
|
+
) }),
|
|
31191
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: "Download" })
|
|
31192
|
+
] }) : null,
|
|
31193
|
+
/* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
31194
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
31195
|
+
Button$1,
|
|
31196
|
+
{
|
|
31197
|
+
size: "icon",
|
|
31198
|
+
variant: "ghost",
|
|
31199
|
+
onClick: () => onRemove2(idx),
|
|
31200
|
+
"aria-label": "Remove",
|
|
31201
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
|
|
31202
|
+
}
|
|
31203
|
+
) }),
|
|
31204
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: "Remove" })
|
|
31205
|
+
] })
|
|
31206
|
+
] })
|
|
31207
|
+
] }),
|
|
31208
|
+
fr.status === "uploading" ? /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(Progress, { value: fr.progress ?? 0 }) }) : null,
|
|
31209
|
+
error ? /* @__PURE__ */ jsx("div", { className: "mt-2 text-xs text-destructive", children: error }) : null
|
|
31210
|
+
]
|
|
31211
|
+
}
|
|
31212
|
+
)
|
|
31213
|
+
]
|
|
31214
|
+
}
|
|
31215
|
+
);
|
|
31216
|
+
},
|
|
31217
|
+
(prev, next) => prev.fr === next.fr && prev.layout === next.layout && prev.withDownload === next.withDownload && prev.uploaderPresent === next.uploaderPresent && prev.idx === next.idx
|
|
31218
|
+
);
|
|
30543
31219
|
return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-3", className), children: [
|
|
30544
31220
|
/* @__PURE__ */ jsxs("div", { ...getRootProps({ className: rootClasses }), children: [
|
|
30545
|
-
/* @__PURE__ */ jsx(
|
|
30546
|
-
|
|
30547
|
-
|
|
31221
|
+
/* @__PURE__ */ jsx(
|
|
31222
|
+
"input",
|
|
31223
|
+
{
|
|
31224
|
+
...getInputProps({
|
|
31225
|
+
onClick: (e2) => {
|
|
31226
|
+
e2.target.value = "";
|
|
31227
|
+
}
|
|
31228
|
+
})
|
|
31229
|
+
}
|
|
31230
|
+
),
|
|
30548
31231
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
30549
31232
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
30550
31233
|
/* @__PURE__ */ jsx(
|
|
@@ -30608,7 +31291,12 @@ function FileUploader({
|
|
|
30608
31291
|
) })
|
|
30609
31292
|
] });
|
|
30610
31293
|
}
|
|
30611
|
-
function FileField({
|
|
31294
|
+
function FileField({
|
|
31295
|
+
field,
|
|
31296
|
+
value,
|
|
31297
|
+
onChange,
|
|
31298
|
+
className
|
|
31299
|
+
}) {
|
|
30612
31300
|
const files = Array.isArray(value) ? value : [];
|
|
30613
31301
|
return /* @__PURE__ */ jsx(
|
|
30614
31302
|
FileUploader,
|
|
@@ -30650,7 +31338,13 @@ function ObjectField({ field, control, fieldPath }) {
|
|
|
30650
31338
|
)) }) })
|
|
30651
31339
|
] });
|
|
30652
31340
|
}
|
|
30653
|
-
function ArrayField({
|
|
31341
|
+
function ArrayField({
|
|
31342
|
+
field,
|
|
31343
|
+
control,
|
|
31344
|
+
fieldPath,
|
|
31345
|
+
value,
|
|
31346
|
+
onChange
|
|
31347
|
+
}) {
|
|
30654
31348
|
var _a, _b, _c, _d;
|
|
30655
31349
|
const { fields, append: append2, remove } = useFieldArray({
|
|
30656
31350
|
control,
|
|
@@ -30676,13 +31370,25 @@ function ArrayField({ field, control, fieldPath, value, onChange }) {
|
|
|
30676
31370
|
};
|
|
30677
31371
|
const removeItem = (index2) => remove(index2);
|
|
30678
31372
|
if (field.arrayLayout === "custom" && typeof field.arrayRender === "function") {
|
|
30679
|
-
return /* @__PURE__ */ jsx(Fragment, { children: field.arrayRender({
|
|
31373
|
+
return /* @__PURE__ */ jsx(Fragment, { children: field.arrayRender({
|
|
31374
|
+
field,
|
|
31375
|
+
control,
|
|
31376
|
+
fieldPath,
|
|
31377
|
+
value,
|
|
31378
|
+
onChange,
|
|
31379
|
+
addItem,
|
|
31380
|
+
removeItem,
|
|
31381
|
+
disabled: field.disabled,
|
|
31382
|
+
rows: fields
|
|
31383
|
+
}) });
|
|
30680
31384
|
}
|
|
30681
31385
|
if (field.arrayLayout === "table") {
|
|
30682
31386
|
const hasNested = Array.isArray(field.fields) && field.fields.length > 0;
|
|
30683
31387
|
const fFields = field.fields ?? [];
|
|
30684
31388
|
const isSubFieldHidden = (subField) => Boolean(subField == null ? void 0 : subField.hidden) || (subField == null ? void 0 : subField.type) === "hidden";
|
|
30685
|
-
const visibleSubFields = fFields.filter(
|
|
31389
|
+
const visibleSubFields = fFields.filter(
|
|
31390
|
+
(subField) => !isSubFieldHidden(subField)
|
|
31391
|
+
);
|
|
30686
31392
|
const singleNested = hasNested && visibleSubFields.length === 1;
|
|
30687
31393
|
const headerBg = ((_a = field.arrayColors) == null ? void 0 : _a.headerBgClass) ?? "bg-primary";
|
|
30688
31394
|
const headerText = ((_b = field.arrayColors) == null ? void 0 : _b.headerTextClass) ?? "text-primary-foreground";
|
|
@@ -30693,10 +31399,20 @@ function ArrayField({ field, control, fieldPath, value, onChange }) {
|
|
|
30693
31399
|
/* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: field.label }),
|
|
30694
31400
|
field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description })
|
|
30695
31401
|
] }),
|
|
30696
|
-
/* @__PURE__ */ jsxs(
|
|
30697
|
-
|
|
30698
|
-
|
|
30699
|
-
|
|
31402
|
+
/* @__PURE__ */ jsxs(
|
|
31403
|
+
Button$1,
|
|
31404
|
+
{
|
|
31405
|
+
type: "button",
|
|
31406
|
+
variant: "outline",
|
|
31407
|
+
size: "sm",
|
|
31408
|
+
onClick: addItem,
|
|
31409
|
+
disabled: field.disabled,
|
|
31410
|
+
children: [
|
|
31411
|
+
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 mr-1" }),
|
|
31412
|
+
"Add Item"
|
|
31413
|
+
]
|
|
31414
|
+
}
|
|
31415
|
+
)
|
|
30700
31416
|
] }) }),
|
|
30701
31417
|
/* @__PURE__ */ jsx(CardContent, { className: "space-y-4", children: fields.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground text-center py-2", children: 'No items added yet. Click "Add Item" to get started.' }) : /* @__PURE__ */ jsxs(Table, { children: [
|
|
30702
31418
|
/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { className: cn$1(headerBg, headerText), children: [
|
|
@@ -30705,37 +31421,60 @@ function ArrayField({ field, control, fieldPath, value, onChange }) {
|
|
|
30705
31421
|
] }) }),
|
|
30706
31422
|
/* @__PURE__ */ jsx(TableBody, { children: fields.map((item, index2) => {
|
|
30707
31423
|
var _a2, _b2;
|
|
30708
|
-
return /* @__PURE__ */ jsxs(
|
|
30709
|
-
|
|
30710
|
-
|
|
30711
|
-
|
|
30712
|
-
|
|
30713
|
-
|
|
30714
|
-
|
|
30715
|
-
|
|
30716
|
-
|
|
30717
|
-
|
|
30718
|
-
|
|
30719
|
-
|
|
30720
|
-
|
|
30721
|
-
|
|
30722
|
-
|
|
30723
|
-
|
|
30724
|
-
|
|
30725
|
-
|
|
30726
|
-
|
|
30727
|
-
|
|
30728
|
-
|
|
30729
|
-
|
|
30730
|
-
|
|
30731
|
-
|
|
30732
|
-
|
|
30733
|
-
|
|
30734
|
-
|
|
30735
|
-
|
|
30736
|
-
|
|
30737
|
-
|
|
30738
|
-
|
|
31424
|
+
return /* @__PURE__ */ jsxs(
|
|
31425
|
+
TableRow,
|
|
31426
|
+
{
|
|
31427
|
+
className: cn$1(index2 % 2 === 1 && altRow),
|
|
31428
|
+
children: [
|
|
31429
|
+
hasNested ? singleNested ? /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(
|
|
31430
|
+
FormBuilderField,
|
|
31431
|
+
{
|
|
31432
|
+
field: {
|
|
31433
|
+
...visibleSubFields[0],
|
|
31434
|
+
name: (_a2 = visibleSubFields[0]) == null ? void 0 : _a2.name,
|
|
31435
|
+
label: ((_b2 = visibleSubFields[0]) == null ? void 0 : _b2.label) || "Value"
|
|
31436
|
+
},
|
|
31437
|
+
control,
|
|
31438
|
+
parentPath: `${fieldPath}.${index2}`
|
|
31439
|
+
}
|
|
31440
|
+
) }) : visibleSubFields.map((subField) => /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(
|
|
31441
|
+
FormBuilderField,
|
|
31442
|
+
{
|
|
31443
|
+
field: subField,
|
|
31444
|
+
control,
|
|
31445
|
+
parentPath: `${fieldPath}.${index2}`
|
|
31446
|
+
}
|
|
31447
|
+
) }, subField.name)) : /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(
|
|
31448
|
+
Input,
|
|
31449
|
+
{
|
|
31450
|
+
value: String(
|
|
31451
|
+
(value == null ? void 0 : value[index2]) ?? ""
|
|
31452
|
+
),
|
|
31453
|
+
onChange: (e2) => {
|
|
31454
|
+
const current = value ?? [];
|
|
31455
|
+
const newArray = [...current];
|
|
31456
|
+
newArray[index2] = e2.target.value;
|
|
31457
|
+
onChange(newArray);
|
|
31458
|
+
},
|
|
31459
|
+
placeholder: `Item ${index2 + 1}`,
|
|
31460
|
+
disabled: field.disabled
|
|
31461
|
+
}
|
|
31462
|
+
) }),
|
|
31463
|
+
/* @__PURE__ */ jsx(TableCell, { className: "w-1 text-right", children: /* @__PURE__ */ jsx(
|
|
31464
|
+
Button$1,
|
|
31465
|
+
{
|
|
31466
|
+
type: "button",
|
|
31467
|
+
variant: "destructive",
|
|
31468
|
+
size: "sm",
|
|
31469
|
+
onClick: () => remove(index2),
|
|
31470
|
+
disabled: field.disabled,
|
|
31471
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
|
|
31472
|
+
}
|
|
31473
|
+
) })
|
|
31474
|
+
]
|
|
31475
|
+
},
|
|
31476
|
+
item.id
|
|
31477
|
+
);
|
|
30739
31478
|
}) })
|
|
30740
31479
|
] }) })
|
|
30741
31480
|
] });
|
|
@@ -30746,10 +31485,20 @@ function ArrayField({ field, control, fieldPath, value, onChange }) {
|
|
|
30746
31485
|
/* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: field.label }),
|
|
30747
31486
|
field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description })
|
|
30748
31487
|
] }),
|
|
30749
|
-
/* @__PURE__ */ jsxs(
|
|
30750
|
-
|
|
30751
|
-
|
|
30752
|
-
|
|
31488
|
+
/* @__PURE__ */ jsxs(
|
|
31489
|
+
Button$1,
|
|
31490
|
+
{
|
|
31491
|
+
type: "button",
|
|
31492
|
+
variant: "outline",
|
|
31493
|
+
size: "sm",
|
|
31494
|
+
onClick: addItem,
|
|
31495
|
+
disabled: field.disabled,
|
|
31496
|
+
children: [
|
|
31497
|
+
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 mr-1" }),
|
|
31498
|
+
"Add Item"
|
|
31499
|
+
]
|
|
31500
|
+
}
|
|
31501
|
+
)
|
|
30753
31502
|
] }) }),
|
|
30754
31503
|
/* @__PURE__ */ jsx(CardContent, { className: "space-y-4", children: fields.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground text-center py-2", children: 'No items added yet. Click "Add Item" to get started.' }) : fields.map((item, index2) => /* @__PURE__ */ jsxs(Card, { className: "relative py-3 rounded-md gap-3", children: [
|
|
30755
31504
|
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
@@ -30760,12 +31509,26 @@ function ArrayField({ field, control, fieldPath, value, onChange }) {
|
|
|
30760
31509
|
index2 + 1
|
|
30761
31510
|
] })
|
|
30762
31511
|
] }),
|
|
30763
|
-
/* @__PURE__ */ jsx(
|
|
31512
|
+
/* @__PURE__ */ jsx(
|
|
31513
|
+
Button$1,
|
|
31514
|
+
{
|
|
31515
|
+
type: "button",
|
|
31516
|
+
variant: "ghost",
|
|
31517
|
+
size: "sm",
|
|
31518
|
+
onClick: () => remove(index2),
|
|
31519
|
+
disabled: field.disabled,
|
|
31520
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
|
|
31521
|
+
}
|
|
31522
|
+
)
|
|
30764
31523
|
] }) }),
|
|
30765
31524
|
/* @__PURE__ */ jsx(CardContent, { children: field.fields && field.fields.length === 1 ? /* @__PURE__ */ jsx(
|
|
30766
31525
|
FormBuilderField,
|
|
30767
31526
|
{
|
|
30768
|
-
field: {
|
|
31527
|
+
field: {
|
|
31528
|
+
...field.fields[0],
|
|
31529
|
+
name: field.fields[0].name,
|
|
31530
|
+
label: field.fields[0].label || "Value"
|
|
31531
|
+
},
|
|
30769
31532
|
control,
|
|
30770
31533
|
parentPath: `${fieldPath}.${index2}`
|
|
30771
31534
|
}
|
|
@@ -30780,7 +31543,9 @@ function ArrayField({ field, control, fieldPath, value, onChange }) {
|
|
|
30780
31543
|
)) }) : /* @__PURE__ */ jsx(
|
|
30781
31544
|
Input,
|
|
30782
31545
|
{
|
|
30783
|
-
value: String(
|
|
31546
|
+
value: String(
|
|
31547
|
+
(value == null ? void 0 : value[index2]) ?? ""
|
|
31548
|
+
),
|
|
30784
31549
|
onChange: (e2) => {
|
|
30785
31550
|
const current = value ?? [];
|
|
30786
31551
|
const newArray = [...current];
|
|
@@ -30794,7 +31559,12 @@ function ArrayField({ field, control, fieldPath, value, onChange }) {
|
|
|
30794
31559
|
] }, item.id)) })
|
|
30795
31560
|
] });
|
|
30796
31561
|
}
|
|
30797
|
-
function FormBuilderField({
|
|
31562
|
+
function FormBuilderField({
|
|
31563
|
+
field,
|
|
31564
|
+
control,
|
|
31565
|
+
onChange,
|
|
31566
|
+
parentPath
|
|
31567
|
+
}) {
|
|
30798
31568
|
const fieldPath = parentPath ? `${parentPath}.${field.name}` : field.name;
|
|
30799
31569
|
const {
|
|
30800
31570
|
field: controllerField,
|
|
@@ -30804,10 +31574,13 @@ function FormBuilderField({ field, control, onChange, parentPath }) {
|
|
|
30804
31574
|
control,
|
|
30805
31575
|
disabled: field.disabled
|
|
30806
31576
|
});
|
|
30807
|
-
const handleChange = useCallback(
|
|
30808
|
-
|
|
30809
|
-
|
|
30810
|
-
|
|
31577
|
+
const handleChange = useCallback(
|
|
31578
|
+
(value, ...extras) => {
|
|
31579
|
+
controllerField.onChange(value);
|
|
31580
|
+
onChange == null ? void 0 : onChange(value, ...extras);
|
|
31581
|
+
},
|
|
31582
|
+
[controllerField, onChange]
|
|
31583
|
+
);
|
|
30811
31584
|
const baseClassName = cn$1(
|
|
30812
31585
|
error && "border-destructive focus-visible:ring-destructive",
|
|
30813
31586
|
field.className
|
|
@@ -31096,42 +31869,110 @@ function FormBuilderField({ field, control, onChange, parentPath }) {
|
|
|
31096
31869
|
return renderField();
|
|
31097
31870
|
}
|
|
31098
31871
|
if (field.type === "checkbox" || field.type === "switch") {
|
|
31099
|
-
return /* @__PURE__ */ jsxs(
|
|
31100
|
-
|
|
31101
|
-
|
|
31102
|
-
|
|
31103
|
-
|
|
31872
|
+
return /* @__PURE__ */ jsxs(
|
|
31873
|
+
"div",
|
|
31874
|
+
{
|
|
31875
|
+
className: cn$1(
|
|
31876
|
+
"space-y-2",
|
|
31877
|
+
field.gridCols && `md:col-span-${field.gridCols}`
|
|
31878
|
+
),
|
|
31879
|
+
children: [
|
|
31880
|
+
renderField(),
|
|
31881
|
+
field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
|
|
31882
|
+
error && /* @__PURE__ */ jsx(
|
|
31883
|
+
"p",
|
|
31884
|
+
{
|
|
31885
|
+
className: "text-sm font-medium text-destructive",
|
|
31886
|
+
role: "alert",
|
|
31887
|
+
"aria-live": "polite",
|
|
31888
|
+
children: error.message
|
|
31889
|
+
}
|
|
31890
|
+
)
|
|
31891
|
+
]
|
|
31892
|
+
}
|
|
31893
|
+
);
|
|
31104
31894
|
}
|
|
31105
31895
|
const placement = field.labelPlacement ?? "stacked";
|
|
31106
31896
|
if (placement === "hidden" || field.type === "array") {
|
|
31107
|
-
return /* @__PURE__ */ jsxs(
|
|
31108
|
-
|
|
31109
|
-
|
|
31110
|
-
|
|
31111
|
-
|
|
31897
|
+
return /* @__PURE__ */ jsxs(
|
|
31898
|
+
"div",
|
|
31899
|
+
{
|
|
31900
|
+
className: cn$1(
|
|
31901
|
+
"space-y-2",
|
|
31902
|
+
field.gridCols && `md:col-span-${field.gridCols}`
|
|
31903
|
+
),
|
|
31904
|
+
children: [
|
|
31905
|
+
renderField(),
|
|
31906
|
+
field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
|
|
31907
|
+
error && /* @__PURE__ */ jsx(
|
|
31908
|
+
"p",
|
|
31909
|
+
{
|
|
31910
|
+
className: "text-sm font-medium text-destructive",
|
|
31911
|
+
role: "alert",
|
|
31912
|
+
"aria-live": "polite",
|
|
31913
|
+
children: error.message
|
|
31914
|
+
}
|
|
31915
|
+
)
|
|
31916
|
+
]
|
|
31917
|
+
}
|
|
31918
|
+
);
|
|
31112
31919
|
}
|
|
31113
31920
|
if (placement === "inline") {
|
|
31114
|
-
return /* @__PURE__ */ jsxs(
|
|
31115
|
-
|
|
31921
|
+
return /* @__PURE__ */ jsxs(
|
|
31922
|
+
"div",
|
|
31923
|
+
{
|
|
31924
|
+
className: cn$1(
|
|
31925
|
+
"space-y-1",
|
|
31926
|
+
field.gridCols && `md:col-span-${field.gridCols}`
|
|
31927
|
+
),
|
|
31928
|
+
children: [
|
|
31929
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
31930
|
+
/* @__PURE__ */ jsxs(Label$2, { htmlFor: fieldPath, className: "text-sm font-medium", children: [
|
|
31931
|
+
field.label,
|
|
31932
|
+
field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
31933
|
+
] }),
|
|
31934
|
+
renderField()
|
|
31935
|
+
] }),
|
|
31936
|
+
field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
|
|
31937
|
+
error && /* @__PURE__ */ jsx(
|
|
31938
|
+
"p",
|
|
31939
|
+
{
|
|
31940
|
+
className: "text-sm font-medium text-destructive",
|
|
31941
|
+
role: "alert",
|
|
31942
|
+
"aria-live": "polite",
|
|
31943
|
+
children: error.message
|
|
31944
|
+
}
|
|
31945
|
+
)
|
|
31946
|
+
]
|
|
31947
|
+
}
|
|
31948
|
+
);
|
|
31949
|
+
}
|
|
31950
|
+
return /* @__PURE__ */ jsxs(
|
|
31951
|
+
"div",
|
|
31952
|
+
{
|
|
31953
|
+
className: cn$1(
|
|
31954
|
+
"space-y-2",
|
|
31955
|
+
field.gridCols && `md:col-span-${field.gridCols}`
|
|
31956
|
+
),
|
|
31957
|
+
children: [
|
|
31116
31958
|
/* @__PURE__ */ jsxs(Label$2, { htmlFor: fieldPath, className: "text-sm font-medium", children: [
|
|
31117
31959
|
field.label,
|
|
31118
31960
|
field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
31119
31961
|
] }),
|
|
31120
|
-
renderField()
|
|
31121
|
-
|
|
31122
|
-
|
|
31123
|
-
|
|
31124
|
-
|
|
31125
|
-
|
|
31126
|
-
|
|
31127
|
-
|
|
31128
|
-
|
|
31129
|
-
|
|
31130
|
-
|
|
31131
|
-
|
|
31132
|
-
|
|
31133
|
-
|
|
31134
|
-
] });
|
|
31962
|
+
renderField(),
|
|
31963
|
+
field.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: field.description }),
|
|
31964
|
+
error && /* @__PURE__ */ jsx(
|
|
31965
|
+
"p",
|
|
31966
|
+
{
|
|
31967
|
+
className: "text-sm font-medium text-destructive",
|
|
31968
|
+
role: "alert",
|
|
31969
|
+
"aria-live": "polite",
|
|
31970
|
+
children: error.message
|
|
31971
|
+
}
|
|
31972
|
+
)
|
|
31973
|
+
]
|
|
31974
|
+
}
|
|
31975
|
+
);
|
|
31135
31976
|
}
|
|
31136
31977
|
function buildSectionNodes(options) {
|
|
31137
31978
|
const {
|
|
@@ -31151,7 +31992,10 @@ function buildSectionNodes(options) {
|
|
|
31151
31992
|
return {
|
|
31152
31993
|
key: field.name,
|
|
31153
31994
|
span: isHiddenType ? void 0 : { base: 1, md: spanMd },
|
|
31154
|
-
className: cn$1(
|
|
31995
|
+
className: cn$1(
|
|
31996
|
+
field.wrapperClassName,
|
|
31997
|
+
isHiddenType ? "hidden" : void 0
|
|
31998
|
+
),
|
|
31155
31999
|
hidden: isHiddenType ? false : field.hidden,
|
|
31156
32000
|
content: /* @__PURE__ */ jsx(
|
|
31157
32001
|
FormBuilderField,
|
|
@@ -31163,7 +32007,11 @@ function buildSectionNodes(options) {
|
|
|
31163
32007
|
control,
|
|
31164
32008
|
onChange: (value, ...extras) => {
|
|
31165
32009
|
handleFieldChange(field, value, ...extras);
|
|
31166
|
-
onFieldChange == null ? void 0 : onFieldChange(
|
|
32010
|
+
onFieldChange == null ? void 0 : onFieldChange(
|
|
32011
|
+
field.name,
|
|
32012
|
+
value,
|
|
32013
|
+
getValues()
|
|
32014
|
+
);
|
|
31167
32015
|
},
|
|
31168
32016
|
onFieldChange
|
|
31169
32017
|
},
|
|
@@ -31189,7 +32037,9 @@ function buildSectionNodes(options) {
|
|
|
31189
32037
|
baseNode.tabsListClassName = section.tabsListClassName;
|
|
31190
32038
|
baseNode.tabsContentClassName = section.tabsContentClassName;
|
|
31191
32039
|
baseNode.tabs = section.tabs.map((tab, _tabIdx) => {
|
|
31192
|
-
const nestedNodes = tab.sections.map(
|
|
32040
|
+
const nestedNodes = tab.sections.map(
|
|
32041
|
+
(subSection, subIdx) => buildSectionNode(subSection, subIdx)
|
|
32042
|
+
);
|
|
31193
32043
|
const containerNode = {
|
|
31194
32044
|
id: `${baseNode.id}-tab-${tab.id}`,
|
|
31195
32045
|
variant: "plain",
|
|
@@ -31210,7 +32060,9 @@ function buildSectionNodes(options) {
|
|
|
31210
32060
|
baseNode.children = buildLeavesFromFields(section.fields);
|
|
31211
32061
|
return baseNode;
|
|
31212
32062
|
};
|
|
31213
|
-
return sections.map(
|
|
32063
|
+
return sections.map(
|
|
32064
|
+
(section, sectionIndex) => buildSectionNode(section, sectionIndex)
|
|
32065
|
+
);
|
|
31214
32066
|
}
|
|
31215
32067
|
const FormBuilderContext = createContext(null);
|
|
31216
32068
|
const r = (t2, r2, o2) => {
|
|
@@ -34726,9 +35578,16 @@ function useFormBuilder(options) {
|
|
|
34726
35578
|
case "radio":
|
|
34727
35579
|
case "autocomplete":
|
|
34728
35580
|
if (field.multiple) {
|
|
34729
|
-
baseSchema = array(
|
|
35581
|
+
baseSchema = array(
|
|
35582
|
+
union([string(), number(), boolean()])
|
|
35583
|
+
);
|
|
34730
35584
|
} else {
|
|
34731
|
-
baseSchema = union([
|
|
35585
|
+
baseSchema = union([
|
|
35586
|
+
string(),
|
|
35587
|
+
number(),
|
|
35588
|
+
boolean(),
|
|
35589
|
+
_null()
|
|
35590
|
+
]);
|
|
34732
35591
|
}
|
|
34733
35592
|
break;
|
|
34734
35593
|
case "file":
|
|
@@ -34800,7 +35659,10 @@ function useFormBuilder(options) {
|
|
|
34800
35659
|
return baseSchema.nullish();
|
|
34801
35660
|
}
|
|
34802
35661
|
if (baseSchema instanceof ZodString && !validationObj.minLength) {
|
|
34803
|
-
baseSchema = baseSchema.min(
|
|
35662
|
+
baseSchema = baseSchema.min(
|
|
35663
|
+
1,
|
|
35664
|
+
`${field.label || field.name} is required`
|
|
35665
|
+
);
|
|
34804
35666
|
}
|
|
34805
35667
|
if (baseSchema instanceof ZodUnion) {
|
|
34806
35668
|
baseSchema = baseSchema.refine(
|
|
@@ -34831,9 +35693,16 @@ function useFormBuilder(options) {
|
|
|
34831
35693
|
case "radio":
|
|
34832
35694
|
case "autocomplete":
|
|
34833
35695
|
if (field.multiple) {
|
|
34834
|
-
fieldSchema = array(
|
|
35696
|
+
fieldSchema = array(
|
|
35697
|
+
union([string(), number(), boolean()])
|
|
35698
|
+
);
|
|
34835
35699
|
} else {
|
|
34836
|
-
fieldSchema = union([
|
|
35700
|
+
fieldSchema = union([
|
|
35701
|
+
string(),
|
|
35702
|
+
number(),
|
|
35703
|
+
boolean(),
|
|
35704
|
+
_null()
|
|
35705
|
+
]);
|
|
34837
35706
|
}
|
|
34838
35707
|
break;
|
|
34839
35708
|
case "file": {
|
|
@@ -34897,7 +35766,10 @@ function useFormBuilder(options) {
|
|
|
34897
35766
|
fieldSchema = fieldSchema.min(1, `${fieldLabel} is required`);
|
|
34898
35767
|
}
|
|
34899
35768
|
if (fieldSchema instanceof ZodArray) {
|
|
34900
|
-
fieldSchema = fieldSchema.min(
|
|
35769
|
+
fieldSchema = fieldSchema.min(
|
|
35770
|
+
1,
|
|
35771
|
+
`${fieldLabel} requires at least 1 selection`
|
|
35772
|
+
);
|
|
34901
35773
|
}
|
|
34902
35774
|
if (fieldSchema instanceof ZodUnion) {
|
|
34903
35775
|
fieldSchema = fieldSchema.refine(
|
|
@@ -34924,7 +35796,9 @@ function useFormBuilder(options) {
|
|
|
34924
35796
|
return object(schemaObject);
|
|
34925
35797
|
}, [sections, providedSchema]);
|
|
34926
35798
|
const generatedDefaultValues = useMemo(() => {
|
|
34927
|
-
const values = {
|
|
35799
|
+
const values = {
|
|
35800
|
+
...defaultValues ?? {}
|
|
35801
|
+
};
|
|
34928
35802
|
const processFields = (fields) => {
|
|
34929
35803
|
for (const field of fields) {
|
|
34930
35804
|
if (values[field.name] !== void 0) {
|
|
@@ -35003,7 +35877,9 @@ function useFormBuilder(options) {
|
|
|
35003
35877
|
}, [sections, defaultValues]);
|
|
35004
35878
|
const form = useForm({
|
|
35005
35879
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35006
|
-
resolver: a$1(
|
|
35880
|
+
resolver: a$1(
|
|
35881
|
+
generatedSchema
|
|
35882
|
+
),
|
|
35007
35883
|
defaultValues: generatedDefaultValues
|
|
35008
35884
|
});
|
|
35009
35885
|
return {
|
|
@@ -35247,7 +36123,7 @@ function FormBuilder({
|
|
|
35247
36123
|
}
|
|
35248
36124
|
const commonValidations = {
|
|
35249
36125
|
email: string().email("Please enter a valid email address"),
|
|
35250
|
-
phone: string().regex(/^[
|
|
36126
|
+
phone: string().regex(/^[+]?[1-9][\d]{0,15}$/, "Please enter a valid phone number"),
|
|
35251
36127
|
url: string().url("Please enter a valid URL"),
|
|
35252
36128
|
password: string().min(8, "Password must be at least 8 characters"),
|
|
35253
36129
|
strongPassword: string().min(8, "Password must be at least 8 characters").regex(
|
|
@@ -35463,7 +36339,7 @@ const transformers = {
|
|
|
35463
36339
|
result[key] = parseValue(obj[key], [...path, key]);
|
|
35464
36340
|
if (numberFields.includes(currentPath) && typeof result[key] === "string") {
|
|
35465
36341
|
const num = Number(result[key]);
|
|
35466
|
-
if (!isNaN(num)) {
|
|
36342
|
+
if (!Number.isNaN(num)) {
|
|
35467
36343
|
result[key] = num;
|
|
35468
36344
|
}
|
|
35469
36345
|
}
|
|
@@ -35568,10 +36444,16 @@ const commonForms = {
|
|
|
35568
36444
|
])
|
|
35569
36445
|
]
|
|
35570
36446
|
};
|
|
35571
|
-
function DataTablePagination({
|
|
35572
|
-
|
|
36447
|
+
function DataTablePagination({
|
|
36448
|
+
table,
|
|
36449
|
+
paginationVariant = "full"
|
|
36450
|
+
}) {
|
|
36451
|
+
const pagination = table.getState().pagination ?? {
|
|
36452
|
+
pageIndex: 0,
|
|
36453
|
+
pageSize: 10
|
|
36454
|
+
};
|
|
35573
36455
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-2", children: [
|
|
35574
|
-
/* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex-1 text-sm", children: [
|
|
36456
|
+
paginationVariant === "full" && /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex-1 text-sm", children: [
|
|
35575
36457
|
table.getFilteredSelectedRowModel().rows.length,
|
|
35576
36458
|
" of",
|
|
35577
36459
|
" ",
|
|
@@ -35579,7 +36461,7 @@ function DataTablePagination({ table }) {
|
|
|
35579
36461
|
" row(s) selected."
|
|
35580
36462
|
] }),
|
|
35581
36463
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [
|
|
35582
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
36464
|
+
paginationVariant === "full" && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
35583
36465
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Rows per page" }),
|
|
35584
36466
|
/* @__PURE__ */ jsxs(
|
|
35585
36467
|
Select$1,
|
|
@@ -35912,7 +36794,7 @@ var MenuContentImpl = React.forwardRef(
|
|
|
35912
36794
|
onInteractOutside,
|
|
35913
36795
|
onDismiss,
|
|
35914
36796
|
children: /* @__PURE__ */ jsx(
|
|
35915
|
-
Root$
|
|
36797
|
+
Root$e,
|
|
35916
36798
|
{
|
|
35917
36799
|
asChild: true,
|
|
35918
36800
|
...rovingFocusGroupScope,
|
|
@@ -36951,12 +37833,22 @@ function DropdownMenuSubContent({
|
|
|
36951
37833
|
}
|
|
36952
37834
|
);
|
|
36953
37835
|
}
|
|
36954
|
-
function DataTableViewOptions({
|
|
37836
|
+
function DataTableViewOptions({
|
|
37837
|
+
table
|
|
37838
|
+
}) {
|
|
36955
37839
|
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
36956
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
36957
|
-
|
|
36958
|
-
|
|
36959
|
-
|
|
37840
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
37841
|
+
Button$1,
|
|
37842
|
+
{
|
|
37843
|
+
variant: "outline",
|
|
37844
|
+
size: "sm",
|
|
37845
|
+
className: "ml-auto hidden h-8 lg:flex",
|
|
37846
|
+
children: [
|
|
37847
|
+
/* @__PURE__ */ jsx(Settings2, { className: "mr-2 size-4" }),
|
|
37848
|
+
" View"
|
|
37849
|
+
]
|
|
37850
|
+
}
|
|
37851
|
+
) }),
|
|
36960
37852
|
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-[180px]", children: [
|
|
36961
37853
|
/* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
36962
37854
|
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
@@ -36988,6 +37880,7 @@ function DataTable({
|
|
|
36988
37880
|
onColumnFiltersChange,
|
|
36989
37881
|
rowCount,
|
|
36990
37882
|
pagination,
|
|
37883
|
+
paginationVariant = "full",
|
|
36991
37884
|
onPaginationChange,
|
|
36992
37885
|
paginationState,
|
|
36993
37886
|
columnVisibility,
|
|
@@ -37024,31 +37917,34 @@ function DataTable({
|
|
|
37024
37917
|
const isSortingEnabled = sorting;
|
|
37025
37918
|
const isColumnFiltersEnabled = columnFilters;
|
|
37026
37919
|
const isColumnVisibilityEnabled = columnVisibility;
|
|
37027
|
-
const selectionColumn = React.useMemo(
|
|
37028
|
-
|
|
37029
|
-
|
|
37030
|
-
|
|
37031
|
-
|
|
37032
|
-
|
|
37033
|
-
|
|
37034
|
-
|
|
37035
|
-
|
|
37036
|
-
|
|
37037
|
-
|
|
37038
|
-
|
|
37039
|
-
|
|
37040
|
-
|
|
37041
|
-
|
|
37042
|
-
|
|
37043
|
-
|
|
37044
|
-
|
|
37045
|
-
|
|
37046
|
-
|
|
37047
|
-
|
|
37048
|
-
|
|
37049
|
-
|
|
37050
|
-
|
|
37051
|
-
|
|
37920
|
+
const selectionColumn = React.useMemo(
|
|
37921
|
+
() => ({
|
|
37922
|
+
id: "__select",
|
|
37923
|
+
header: ({ table: table2 }) => /* @__PURE__ */ jsx(
|
|
37924
|
+
Checkbox,
|
|
37925
|
+
{
|
|
37926
|
+
checked: table2.getIsAllPageRowsSelected() || table2.getIsSomePageRowsSelected() && "indeterminate",
|
|
37927
|
+
onCheckedChange: (val) => table2.toggleAllPageRowsSelected(!!val),
|
|
37928
|
+
"aria-label": "Select all"
|
|
37929
|
+
}
|
|
37930
|
+
),
|
|
37931
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(
|
|
37932
|
+
Checkbox,
|
|
37933
|
+
{
|
|
37934
|
+
checked: row.getIsSelected(),
|
|
37935
|
+
onCheckedChange: (val) => row.toggleSelected(!!val),
|
|
37936
|
+
"aria-label": "Select row",
|
|
37937
|
+
onClick: (e2) => e2.stopPropagation()
|
|
37938
|
+
}
|
|
37939
|
+
),
|
|
37940
|
+
enableSorting: false,
|
|
37941
|
+
enableHiding: false,
|
|
37942
|
+
size: 32,
|
|
37943
|
+
minSize: 32,
|
|
37944
|
+
maxSize: 32
|
|
37945
|
+
}),
|
|
37946
|
+
[]
|
|
37947
|
+
);
|
|
37052
37948
|
const renderedColumns = React.useMemo(
|
|
37053
37949
|
() => selectable ? [selectionColumn, ...columns] : columns,
|
|
37054
37950
|
[selectable, selectionColumn, columns]
|
|
@@ -37073,22 +37969,30 @@ function DataTable({
|
|
|
37073
37969
|
enableSorting: isSortingEnabled,
|
|
37074
37970
|
enableColumnFilters: isColumnFiltersEnabled,
|
|
37075
37971
|
onSortingChange: isSortingEnabled ? (updater) => {
|
|
37076
|
-
const next = typeof updater === "function" ? updater(
|
|
37972
|
+
const next = typeof updater === "function" ? updater(
|
|
37973
|
+
effectiveSortingState
|
|
37974
|
+
) : updater;
|
|
37077
37975
|
setInternalSortingState(next);
|
|
37078
37976
|
onSortingChange == null ? void 0 : onSortingChange(next);
|
|
37079
37977
|
} : void 0,
|
|
37080
37978
|
onColumnFiltersChange: isColumnFiltersEnabled ? (updater) => {
|
|
37081
|
-
const next = typeof updater === "function" ? updater(
|
|
37979
|
+
const next = typeof updater === "function" ? updater(
|
|
37980
|
+
effectiveFiltersState
|
|
37981
|
+
) : updater;
|
|
37082
37982
|
setInternalFiltersState(next);
|
|
37083
37983
|
onColumnFiltersChange == null ? void 0 : onColumnFiltersChange(next);
|
|
37084
37984
|
} : void 0,
|
|
37085
37985
|
onPaginationChange: isPaginationEnabled ? (updater) => {
|
|
37086
|
-
const next = typeof updater === "function" ? updater(
|
|
37986
|
+
const next = typeof updater === "function" ? updater(
|
|
37987
|
+
effectivePaginationState
|
|
37988
|
+
) : updater;
|
|
37087
37989
|
setInternalPaginationState(next);
|
|
37088
37990
|
onPaginationChange == null ? void 0 : onPaginationChange(next);
|
|
37089
37991
|
} : void 0,
|
|
37090
37992
|
onColumnVisibilityChange: (updater) => {
|
|
37091
|
-
const next = typeof updater === "function" ? updater(
|
|
37993
|
+
const next = typeof updater === "function" ? updater(
|
|
37994
|
+
effectiveVisibilityState
|
|
37995
|
+
) : updater;
|
|
37092
37996
|
setInternalVisibilityState(next);
|
|
37093
37997
|
onColumnVisibilityChange == null ? void 0 : onColumnVisibilityChange(next);
|
|
37094
37998
|
},
|
|
@@ -37102,9 +38006,15 @@ function DataTable({
|
|
|
37102
38006
|
}, [onTable, table]);
|
|
37103
38007
|
const selectedRows = table.getSelectedRowModel().rows.map((r2) => r2.original);
|
|
37104
38008
|
const safeActions = React.useMemo(() => actions ?? [], [actions]);
|
|
37105
|
-
const safeBatchActions = React.useMemo(
|
|
38009
|
+
const safeBatchActions = React.useMemo(
|
|
38010
|
+
() => batchActions ?? [],
|
|
38011
|
+
[batchActions]
|
|
38012
|
+
);
|
|
37106
38013
|
const skeletonRowKeys = React.useMemo(
|
|
37107
|
-
() => Array.from(
|
|
38014
|
+
() => Array.from(
|
|
38015
|
+
{ length: Math.max(3, effectivePaginationState.pageSize ?? 10) },
|
|
38016
|
+
() => Math.random().toString(36).slice(2)
|
|
38017
|
+
),
|
|
37108
38018
|
[effectivePaginationState.pageSize]
|
|
37109
38019
|
);
|
|
37110
38020
|
const handleRefresh = React.useCallback(async () => {
|
|
@@ -37112,9 +38022,16 @@ function DataTable({
|
|
|
37112
38022
|
await onRefresh();
|
|
37113
38023
|
}, [onRefresh]);
|
|
37114
38024
|
const renderActionButton = (action, key) => {
|
|
37115
|
-
if (action.element)
|
|
38025
|
+
if (action.element)
|
|
38026
|
+
return /* @__PURE__ */ jsx(React.Fragment, { children: action.element }, key);
|
|
37116
38027
|
const content = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
37117
|
-
action.icon && /* @__PURE__ */ jsx(
|
|
38028
|
+
action.icon && /* @__PURE__ */ jsx(
|
|
38029
|
+
"span",
|
|
38030
|
+
{
|
|
38031
|
+
className: cn$1(action.iconPosition === "right" ? "order-last" : ""),
|
|
38032
|
+
children: action.icon
|
|
38033
|
+
}
|
|
38034
|
+
),
|
|
37118
38035
|
action.label
|
|
37119
38036
|
] });
|
|
37120
38037
|
return /* @__PURE__ */ jsx(
|
|
@@ -37131,13 +38048,23 @@ function DataTable({
|
|
|
37131
38048
|
);
|
|
37132
38049
|
};
|
|
37133
38050
|
const renderBatchButton = (action, key) => {
|
|
37134
|
-
if (action.element)
|
|
38051
|
+
if (action.element)
|
|
38052
|
+
return /* @__PURE__ */ jsx(React.Fragment, { children: action.element }, key);
|
|
37135
38053
|
const onClick = () => {
|
|
37136
38054
|
var _a2;
|
|
37137
|
-
return (_a2 = action.onClick) == null ? void 0 : _a2.call(action, {
|
|
38055
|
+
return (_a2 = action.onClick) == null ? void 0 : _a2.call(action, {
|
|
38056
|
+
selectedRows,
|
|
38057
|
+
clearSelection: () => table.resetRowSelection()
|
|
38058
|
+
});
|
|
37138
38059
|
};
|
|
37139
38060
|
const content = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
37140
|
-
action.icon && /* @__PURE__ */ jsx(
|
|
38061
|
+
action.icon && /* @__PURE__ */ jsx(
|
|
38062
|
+
"span",
|
|
38063
|
+
{
|
|
38064
|
+
className: cn$1(action.iconPosition === "right" ? "order-last" : ""),
|
|
38065
|
+
children: action.icon
|
|
38066
|
+
}
|
|
38067
|
+
),
|
|
37141
38068
|
action.label
|
|
37142
38069
|
] });
|
|
37143
38070
|
return /* @__PURE__ */ jsx(
|
|
@@ -37156,23 +38083,32 @@ function DataTable({
|
|
|
37156
38083
|
const effectiveFilterWrapper = filterWrapper ?? "accordion";
|
|
37157
38084
|
const effectiveFilterTitle = filterTitle ?? "Filters";
|
|
37158
38085
|
return /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-3", className), children: [
|
|
37159
|
-
formFilters
|
|
37160
|
-
|
|
37161
|
-
|
|
37162
|
-
|
|
37163
|
-
|
|
37164
|
-
|
|
37165
|
-
|
|
37166
|
-
|
|
37167
|
-
|
|
37168
|
-
|
|
37169
|
-
|
|
37170
|
-
|
|
37171
|
-
|
|
37172
|
-
|
|
37173
|
-
|
|
37174
|
-
|
|
37175
|
-
|
|
38086
|
+
(formFilters == null ? void 0 : formFilters.length) ? effectiveFilterWrapper === "accordion" ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-border", children: /* @__PURE__ */ jsx(
|
|
38087
|
+
Accordion,
|
|
38088
|
+
{
|
|
38089
|
+
type: "single",
|
|
38090
|
+
collapsible: true,
|
|
38091
|
+
className: "w-full",
|
|
38092
|
+
defaultValue: "filters",
|
|
38093
|
+
children: /* @__PURE__ */ jsxs(AccordionItem, { value: "filters", children: [
|
|
38094
|
+
/* @__PURE__ */ jsx(AccordionTrigger, { className: "px-4 py-3 border-b border-border text-md", children: effectiveFilterTitle }),
|
|
38095
|
+
/* @__PURE__ */ jsx(AccordionContent, { className: "px-4 pb-4 pt-5", children: /* @__PURE__ */ jsx(
|
|
38096
|
+
FormBuilder,
|
|
38097
|
+
{
|
|
38098
|
+
sections: formFilters,
|
|
38099
|
+
defaultValues: formFilterValues,
|
|
38100
|
+
onSubmit: (data2) => onFormFilterChange == null ? void 0 : onFormFilterChange(data2),
|
|
38101
|
+
onReset: () => onFormFilterChange == null ? void 0 : onFormFilterChange({}),
|
|
38102
|
+
showActions: true,
|
|
38103
|
+
submitLabel: "Apply",
|
|
38104
|
+
resetLabel: "Clear",
|
|
38105
|
+
showActionsSeparator: filterShowActionsSeparator
|
|
38106
|
+
},
|
|
38107
|
+
JSON.stringify(formFilterValues ?? {})
|
|
38108
|
+
) })
|
|
38109
|
+
] })
|
|
38110
|
+
}
|
|
38111
|
+
) }) : effectiveFilterWrapper === "card" ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-border p-4", children: /* @__PURE__ */ jsx(
|
|
37176
38112
|
FormBuilder,
|
|
37177
38113
|
{
|
|
37178
38114
|
sections: formFilters,
|
|
@@ -37212,8 +38148,14 @@ function DataTable({
|
|
|
37212
38148
|
className: "h-8",
|
|
37213
38149
|
title: "Refresh",
|
|
37214
38150
|
children: [
|
|
37215
|
-
/* @__PURE__ */ jsx(
|
|
37216
|
-
|
|
38151
|
+
/* @__PURE__ */ jsx(
|
|
38152
|
+
RefreshCw,
|
|
38153
|
+
{
|
|
38154
|
+
className: cn$1("h-4 w-4", loading && "animate-spin")
|
|
38155
|
+
}
|
|
38156
|
+
),
|
|
38157
|
+
" ",
|
|
38158
|
+
"Refresh"
|
|
37217
38159
|
]
|
|
37218
38160
|
}
|
|
37219
38161
|
),
|
|
@@ -37221,26 +38163,54 @@ function DataTable({
|
|
|
37221
38163
|
safeActions.map((a2) => renderActionButton(a2, a2.key))
|
|
37222
38164
|
] })
|
|
37223
38165
|
] }) }),
|
|
37224
|
-
/* @__PURE__ */ jsxs(
|
|
37225
|
-
|
|
37226
|
-
|
|
37227
|
-
"
|
|
37228
|
-
|
|
37229
|
-
|
|
37230
|
-
|
|
37231
|
-
|
|
37232
|
-
|
|
37233
|
-
|
|
37234
|
-
|
|
37235
|
-
|
|
37236
|
-
|
|
37237
|
-
|
|
37238
|
-
|
|
37239
|
-
|
|
37240
|
-
|
|
37241
|
-
|
|
37242
|
-
|
|
37243
|
-
|
|
38166
|
+
/* @__PURE__ */ jsxs(
|
|
38167
|
+
"div",
|
|
38168
|
+
{
|
|
38169
|
+
className: "relative overflow-hidden rounded-md border border-border",
|
|
38170
|
+
"aria-busy": loading || void 0,
|
|
38171
|
+
children: [
|
|
38172
|
+
loading && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 z-10 flex items-start justify-end p-2", children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2 rounded bg-background/80 px-2 py-1 text-xs shadow-sm ring-1 ring-border", children: [
|
|
38173
|
+
/* @__PURE__ */ jsx(LoaderCircle, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
38174
|
+
" Loading..."
|
|
38175
|
+
] }) }),
|
|
38176
|
+
/* @__PURE__ */ jsxs(Table, { children: [
|
|
38177
|
+
/* @__PURE__ */ jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(
|
|
38178
|
+
header.column.columnDef.header,
|
|
38179
|
+
header.getContext()
|
|
38180
|
+
) }, header.id)) }, headerGroup.id)) }),
|
|
38181
|
+
/* @__PURE__ */ jsx(TableBody, { children: loading ? skeletonRowKeys.map((rowKey) => /* @__PURE__ */ jsx(TableRow, { children: table.getVisibleLeafColumns().map((col) => /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" }) }, `skeleton-cell-${rowKey}-${col.id}`)) }, `skeleton-${rowKey}`)) : ((_a = table.getRowModel().rows) == null ? void 0 : _a.length) ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(
|
|
38182
|
+
TableRow,
|
|
38183
|
+
{
|
|
38184
|
+
"data-state": row.getIsSelected() && "selected",
|
|
38185
|
+
className: cn$1(
|
|
38186
|
+
onRowClick && "cursor-pointer hover:bg-muted/50"
|
|
38187
|
+
),
|
|
38188
|
+
onClick: onRowClick ? () => onRowClick(row.original) : void 0,
|
|
38189
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell, { children: flexRender(
|
|
38190
|
+
cell.column.columnDef.cell,
|
|
38191
|
+
cell.getContext()
|
|
38192
|
+
) }, cell.id))
|
|
38193
|
+
},
|
|
38194
|
+
row.id
|
|
38195
|
+
)) : /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(
|
|
38196
|
+
TableCell,
|
|
38197
|
+
{
|
|
38198
|
+
colSpan: table.getVisibleLeafColumns().length,
|
|
38199
|
+
className: "h-24 text-center",
|
|
38200
|
+
children: emptyText
|
|
38201
|
+
}
|
|
38202
|
+
) }) })
|
|
38203
|
+
] })
|
|
38204
|
+
]
|
|
38205
|
+
}
|
|
38206
|
+
),
|
|
38207
|
+
isPaginationEnabled && /* @__PURE__ */ jsx(
|
|
38208
|
+
DataTablePagination,
|
|
38209
|
+
{
|
|
38210
|
+
table,
|
|
38211
|
+
paginationVariant
|
|
38212
|
+
}
|
|
38213
|
+
)
|
|
37244
38214
|
] });
|
|
37245
38215
|
}
|
|
37246
38216
|
function DataTableColumnHeader({
|
|
@@ -37254,10 +38224,18 @@ function DataTableColumnHeader({
|
|
|
37254
38224
|
return /* @__PURE__ */ jsx("div", { className: cn$1(className), children: label });
|
|
37255
38225
|
}
|
|
37256
38226
|
return /* @__PURE__ */ jsx("div", { className: cn$1("flex items-center gap-2", className), children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
37257
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
37258
|
-
|
|
37259
|
-
|
|
37260
|
-
|
|
38227
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
38228
|
+
Button$1,
|
|
38229
|
+
{
|
|
38230
|
+
variant: "ghost",
|
|
38231
|
+
size: "sm",
|
|
38232
|
+
className: "data-[state=open]:bg-accent -ml-3 h-8",
|
|
38233
|
+
children: [
|
|
38234
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
38235
|
+
column.getIsSorted() === "desc" ? /* @__PURE__ */ jsx(ArrowDown, { className: "ml-2 size-4" }) : column.getIsSorted() === "asc" ? /* @__PURE__ */ jsx(ArrowUp, { className: "ml-2 size-4" }) : /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-2 size-4" })
|
|
38236
|
+
]
|
|
38237
|
+
}
|
|
38238
|
+
) }),
|
|
37261
38239
|
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "start", children: [
|
|
37262
38240
|
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(false), children: [
|
|
37263
38241
|
/* @__PURE__ */ jsx(ArrowUp, { className: "mr-2 size-4" }),
|
|
@@ -43463,7 +44441,8 @@ function DialogDescription({
|
|
|
43463
44441
|
const DialogContext = createContext(null);
|
|
43464
44442
|
function useDialogController() {
|
|
43465
44443
|
const ctx = use(DialogContext);
|
|
43466
|
-
if (!ctx)
|
|
44444
|
+
if (!ctx)
|
|
44445
|
+
throw new Error("useDialogController must be used within DialogProvider");
|
|
43467
44446
|
return ctx;
|
|
43468
44447
|
}
|
|
43469
44448
|
function DialogProvider({ children }) {
|
|
@@ -43472,7 +44451,9 @@ function DialogProvider({ children }) {
|
|
|
43472
44451
|
const [mode, setMode] = useState(null);
|
|
43473
44452
|
const [confirmOpts, setConfirmOpts] = useState({});
|
|
43474
44453
|
const [customRender, setCustomRender] = useState(null);
|
|
43475
|
-
const [customOpts, setCustomOpts] = useState(
|
|
44454
|
+
const [customOpts, setCustomOpts] = useState(
|
|
44455
|
+
void 0
|
|
44456
|
+
);
|
|
43476
44457
|
const confirm = useCallback((options) => {
|
|
43477
44458
|
setConfirmOpts(options ?? {});
|
|
43478
44459
|
setMode("confirm");
|
|
@@ -43481,15 +44462,18 @@ function DialogProvider({ children }) {
|
|
|
43481
44462
|
resolverRef.current = resolve;
|
|
43482
44463
|
});
|
|
43483
44464
|
}, []);
|
|
43484
|
-
const openCustom = useCallback(
|
|
43485
|
-
|
|
43486
|
-
|
|
43487
|
-
|
|
43488
|
-
|
|
43489
|
-
|
|
43490
|
-
|
|
43491
|
-
|
|
43492
|
-
|
|
44465
|
+
const openCustom = useCallback(
|
|
44466
|
+
(render, options) => {
|
|
44467
|
+
setCustomRender(() => render);
|
|
44468
|
+
setCustomOpts(options);
|
|
44469
|
+
setMode("custom");
|
|
44470
|
+
setOpen(true);
|
|
44471
|
+
return new Promise((resolve) => {
|
|
44472
|
+
resolverRef.current = resolve;
|
|
44473
|
+
});
|
|
44474
|
+
},
|
|
44475
|
+
[]
|
|
44476
|
+
);
|
|
43493
44477
|
const handleClose = useCallback((result) => {
|
|
43494
44478
|
setOpen(false);
|
|
43495
44479
|
if (resolverRef.current) {
|
|
@@ -43498,7 +44482,10 @@ function DialogProvider({ children }) {
|
|
|
43498
44482
|
}
|
|
43499
44483
|
setMode(null);
|
|
43500
44484
|
}, []);
|
|
43501
|
-
const value = useMemo(
|
|
44485
|
+
const value = useMemo(
|
|
44486
|
+
() => ({ confirm, open: openCustom }),
|
|
44487
|
+
[confirm, openCustom]
|
|
44488
|
+
);
|
|
43502
44489
|
const {
|
|
43503
44490
|
title: cTitle = "Are you sure?",
|
|
43504
44491
|
description: cDesc = "This action cannot be undone.",
|
|
@@ -43515,29 +44502,36 @@ function DialogProvider({ children }) {
|
|
|
43515
44502
|
cDesc ? /* @__PURE__ */ jsx(AlertDialogDescription, { className: "text-muted-foreground", children: cDesc }) : null
|
|
43516
44503
|
] }),
|
|
43517
44504
|
/* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
|
|
43518
|
-
/* @__PURE__ */ jsx(
|
|
43519
|
-
|
|
43520
|
-
] })
|
|
43521
|
-
] }) }),
|
|
43522
|
-
mode === "custom" && customRender && /* @__PURE__ */ jsx(
|
|
43523
|
-
Dialog,
|
|
43524
|
-
{
|
|
43525
|
-
open,
|
|
43526
|
-
onOpenChange: (o2) => !o2 && handleClose(void 0),
|
|
43527
|
-
children: /* @__PURE__ */ jsx(
|
|
43528
|
-
DialogContent,
|
|
44505
|
+
/* @__PURE__ */ jsx(
|
|
44506
|
+
AlertDialogCancel,
|
|
43529
44507
|
{
|
|
43530
|
-
|
|
43531
|
-
|
|
43532
|
-
|
|
43533
|
-
|
|
43534
|
-
|
|
43535
|
-
|
|
43536
|
-
|
|
44508
|
+
className: "text-foreground",
|
|
44509
|
+
onClick: () => handleClose(false),
|
|
44510
|
+
children: cCancelText
|
|
44511
|
+
}
|
|
44512
|
+
),
|
|
44513
|
+
/* @__PURE__ */ jsx(
|
|
44514
|
+
AlertDialogAction,
|
|
44515
|
+
{
|
|
44516
|
+
className: actionClass,
|
|
44517
|
+
onClick: () => handleClose(true),
|
|
44518
|
+
children: cConfirmText
|
|
43537
44519
|
}
|
|
43538
44520
|
)
|
|
44521
|
+
] })
|
|
44522
|
+
] }) }),
|
|
44523
|
+
mode === "custom" && customRender && /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (o2) => !o2 && handleClose(void 0), children: /* @__PURE__ */ jsx(
|
|
44524
|
+
DialogContent,
|
|
44525
|
+
{
|
|
44526
|
+
onEscapeKeyDown: (e2) => {
|
|
44527
|
+
if (customOpts == null ? void 0 : customOpts.preventCloseOnEscape) e2.preventDefault();
|
|
44528
|
+
},
|
|
44529
|
+
onInteractOutside: (e2) => {
|
|
44530
|
+
if (customOpts == null ? void 0 : customOpts.preventCloseOnInteractOutside) e2.preventDefault();
|
|
44531
|
+
},
|
|
44532
|
+
children: customRender({ close: (v) => handleClose(v) })
|
|
43539
44533
|
}
|
|
43540
|
-
)
|
|
44534
|
+
) })
|
|
43541
44535
|
] });
|
|
43542
44536
|
}
|
|
43543
44537
|
const useDialog = useDialogController;
|
|
@@ -43550,7 +44544,16 @@ const widthToClass = {
|
|
|
43550
44544
|
};
|
|
43551
44545
|
function renderAction(action) {
|
|
43552
44546
|
if (action.type === "button") {
|
|
43553
|
-
const {
|
|
44547
|
+
const {
|
|
44548
|
+
label,
|
|
44549
|
+
onClick,
|
|
44550
|
+
variant,
|
|
44551
|
+
size: size2,
|
|
44552
|
+
leftIcon,
|
|
44553
|
+
rightIcon,
|
|
44554
|
+
disabled,
|
|
44555
|
+
className
|
|
44556
|
+
} = action;
|
|
43554
44557
|
return /* @__PURE__ */ jsxs(
|
|
43555
44558
|
Button$1,
|
|
43556
44559
|
{
|
|
@@ -43623,20 +44626,39 @@ function Page({
|
|
|
43623
44626
|
footerRight,
|
|
43624
44627
|
children
|
|
43625
44628
|
}) {
|
|
43626
|
-
return /* @__PURE__ */ jsx("div", { className: cn$1("w-full", className), children: /* @__PURE__ */ jsxs(
|
|
43627
|
-
|
|
43628
|
-
|
|
43629
|
-
|
|
43630
|
-
|
|
43631
|
-
|
|
43632
|
-
|
|
43633
|
-
|
|
43634
|
-
|
|
43635
|
-
|
|
43636
|
-
|
|
43637
|
-
|
|
43638
|
-
|
|
43639
|
-
|
|
44629
|
+
return /* @__PURE__ */ jsx("div", { className: cn$1("w-full", className), children: /* @__PURE__ */ jsxs(
|
|
44630
|
+
"div",
|
|
44631
|
+
{
|
|
44632
|
+
className: cn$1(
|
|
44633
|
+
"px-4 sm:px-6 lg:px-8",
|
|
44634
|
+
widthToClass[containerWidth],
|
|
44635
|
+
"mx-auto"
|
|
44636
|
+
),
|
|
44637
|
+
children: [
|
|
44638
|
+
/* @__PURE__ */ jsxs(
|
|
44639
|
+
"header",
|
|
44640
|
+
{
|
|
44641
|
+
className: cn$1(
|
|
44642
|
+
"flex items-start justify-between gap-3 py-6",
|
|
44643
|
+
headerClassName
|
|
44644
|
+
),
|
|
44645
|
+
children: [
|
|
44646
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
44647
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold leading-none tracking-tight text-foreground", children: title }),
|
|
44648
|
+
subtitle ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: subtitle }) : null
|
|
44649
|
+
] }),
|
|
44650
|
+
actions && actions.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex shrink-0 flex-wrap items-center justify-end gap-2", children: actions.map(renderAction) }) : null
|
|
44651
|
+
]
|
|
44652
|
+
}
|
|
44653
|
+
),
|
|
44654
|
+
/* @__PURE__ */ jsx("main", { className: cn$1("pb-8", contentClassName), children }),
|
|
44655
|
+
(footerLeft || footerRight) && /* @__PURE__ */ jsx("footer", { className: "border-t pt-4 pb-8", children: /* @__PURE__ */ jsx("div", { className: cn$1("px-0", widthToClass[containerWidth]), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
44656
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: footerLeft }),
|
|
44657
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: footerRight })
|
|
44658
|
+
] }) }) })
|
|
44659
|
+
]
|
|
44660
|
+
}
|
|
44661
|
+
) });
|
|
43640
44662
|
}
|
|
43641
44663
|
const StackDialogContext = createContext({
|
|
43642
44664
|
activeDialogs: [],
|
|
@@ -43691,7 +44713,7 @@ function StackDialogContextProvider(props2) {
|
|
|
43691
44713
|
return clone2;
|
|
43692
44714
|
});
|
|
43693
44715
|
return dialogId;
|
|
43694
|
-
}, [
|
|
44716
|
+
}, []);
|
|
43695
44717
|
const handleCloseDialog = useCallback((id) => {
|
|
43696
44718
|
setActiveDialogs((prev) => {
|
|
43697
44719
|
const clone2 = [...prev];
|
|
@@ -43699,10 +44721,10 @@ function StackDialogContextProvider(props2) {
|
|
|
43699
44721
|
else clone2.splice(clone2.findIndex((d) => d.id === id));
|
|
43700
44722
|
return clone2;
|
|
43701
44723
|
});
|
|
43702
|
-
}, [
|
|
44724
|
+
}, []);
|
|
43703
44725
|
const handleCloseAllDialog = useCallback(() => {
|
|
43704
44726
|
setActiveDialogs([]);
|
|
43705
|
-
}, [
|
|
44727
|
+
}, []);
|
|
43706
44728
|
return /* @__PURE__ */ jsxs(
|
|
43707
44729
|
StackDialogContext.Provider,
|
|
43708
44730
|
{
|
|
@@ -43748,40 +44770,53 @@ function Login({
|
|
|
43748
44770
|
continueWith,
|
|
43749
44771
|
children
|
|
43750
44772
|
}) {
|
|
43751
|
-
return /* @__PURE__ */ jsxs(
|
|
43752
|
-
|
|
43753
|
-
|
|
43754
|
-
|
|
43755
|
-
|
|
43756
|
-
|
|
43757
|
-
|
|
43758
|
-
|
|
43759
|
-
|
|
43760
|
-
|
|
43761
|
-
" ",
|
|
43762
|
-
|
|
43763
|
-
|
|
43764
|
-
|
|
43765
|
-
|
|
43766
|
-
|
|
43767
|
-
|
|
43768
|
-
|
|
43769
|
-
|
|
43770
|
-
|
|
43771
|
-
|
|
43772
|
-
|
|
43773
|
-
|
|
43774
|
-
|
|
43775
|
-
|
|
43776
|
-
|
|
43777
|
-
|
|
43778
|
-
|
|
43779
|
-
|
|
43780
|
-
|
|
43781
|
-
|
|
43782
|
-
|
|
43783
|
-
|
|
43784
|
-
|
|
44773
|
+
return /* @__PURE__ */ jsxs(
|
|
44774
|
+
"div",
|
|
44775
|
+
{
|
|
44776
|
+
className: ["grid min-h-dvh grid-cols-1 md:grid-cols-2", className].filter(Boolean).join(" "),
|
|
44777
|
+
children: [
|
|
44778
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-6 md:p-10", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md", children: [
|
|
44779
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-6 text-center", children: [
|
|
44780
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold leading-tight tracking-tight", children: appTitle }),
|
|
44781
|
+
subtitle ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: subtitle }) : null
|
|
44782
|
+
] }),
|
|
44783
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-6", children: [
|
|
44784
|
+
children,
|
|
44785
|
+
forgotPasswordHref ? /* @__PURE__ */ jsxs("div", { className: "text-center text-sm", children: [
|
|
44786
|
+
forgotPasswordLabel,
|
|
44787
|
+
" ",
|
|
44788
|
+
/* @__PURE__ */ jsx(
|
|
44789
|
+
"a",
|
|
44790
|
+
{
|
|
44791
|
+
href: forgotPasswordHref,
|
|
44792
|
+
className: "underline underline-offset-4",
|
|
44793
|
+
children: forgotPasswordLinkLabel
|
|
44794
|
+
}
|
|
44795
|
+
)
|
|
44796
|
+
] }) : null,
|
|
44797
|
+
continueWith ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44798
|
+
/* @__PURE__ */ jsx("div", { className: "after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t", children: /* @__PURE__ */ jsx("span", { className: "bg-background text-muted-foreground relative z-10 px-2", children: "Or continue with" }) }),
|
|
44799
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-3", children: continueWith })
|
|
44800
|
+
] }) : null
|
|
44801
|
+
] }),
|
|
44802
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-6 text-center text-sm", children: [
|
|
44803
|
+
signupLabel,
|
|
44804
|
+
" ",
|
|
44805
|
+
/* @__PURE__ */ jsx("a", { href: signupHref, className: "underline underline-offset-4", children: signupLinkLabel })
|
|
44806
|
+
] })
|
|
44807
|
+
] }) }),
|
|
44808
|
+
/* @__PURE__ */ jsx("div", { className: "hidden md:block", children: rightImageSrc ? /* @__PURE__ */ jsx(
|
|
44809
|
+
"img",
|
|
44810
|
+
{
|
|
44811
|
+
src: rightImageSrc,
|
|
44812
|
+
alt: rightImageAlt,
|
|
44813
|
+
className: "h-full w-full object-cover",
|
|
44814
|
+
loading: "lazy"
|
|
44815
|
+
}
|
|
44816
|
+
) : /* @__PURE__ */ jsx("div", { className: "h-full w-full bg-muted" }) })
|
|
44817
|
+
]
|
|
44818
|
+
}
|
|
44819
|
+
);
|
|
43785
44820
|
}
|
|
43786
44821
|
const alertVariants = cva(
|
|
43787
44822
|
"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
@@ -43872,7 +44907,9 @@ function collectMessages(errors, parentPath = []) {
|
|
|
43872
44907
|
);
|
|
43873
44908
|
if (nestedEntries.length > 0) {
|
|
43874
44909
|
const nested = Object.fromEntries(nestedEntries);
|
|
43875
|
-
messages.push(
|
|
44910
|
+
messages.push(
|
|
44911
|
+
...collectMessages(nested, currentPath)
|
|
44912
|
+
);
|
|
43876
44913
|
}
|
|
43877
44914
|
}
|
|
43878
44915
|
}
|
|
@@ -43886,10 +44923,19 @@ function FormInfoError({
|
|
|
43886
44923
|
className,
|
|
43887
44924
|
showFieldPath = true
|
|
43888
44925
|
}) {
|
|
43889
|
-
const messages = collectMessages(
|
|
44926
|
+
const messages = collectMessages(
|
|
44927
|
+
errors
|
|
44928
|
+
);
|
|
43890
44929
|
if (messages.length === 0) {
|
|
43891
44930
|
return null;
|
|
43892
44931
|
}
|
|
44932
|
+
const keyOccurrences = /* @__PURE__ */ new Map();
|
|
44933
|
+
const getMessageKey = (path, message2) => {
|
|
44934
|
+
const baseKey = [path, message2].filter(Boolean).join(":") || message2;
|
|
44935
|
+
const occurrence = keyOccurrences.get(baseKey) ?? 0;
|
|
44936
|
+
keyOccurrences.set(baseKey, occurrence + 1);
|
|
44937
|
+
return occurrence === 0 ? baseKey : `${baseKey}:${occurrence}`;
|
|
44938
|
+
};
|
|
43893
44939
|
return /* @__PURE__ */ jsxs(Alert, { variant: "destructive", className: cn$1("gap-2", className), children: [
|
|
43894
44940
|
/* @__PURE__ */ jsx(CircleAlert, { className: "mt-1" }),
|
|
43895
44941
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
@@ -43897,19 +44943,21 @@ function FormInfoError({
|
|
|
43897
44943
|
/* @__PURE__ */ jsx(AlertTitle, { children: title ?? "Please review the following issues" }),
|
|
43898
44944
|
/* @__PURE__ */ jsx(AlertDescription, { children: description ?? "Some fields need your attention before continuing." })
|
|
43899
44945
|
] }),
|
|
43900
|
-
/* @__PURE__ */ jsx("ul", { className: "grid gap-1 text-sm text-destructive", children: messages.map(({ path, message: message2 }
|
|
44946
|
+
/* @__PURE__ */ jsx("ul", { className: "grid gap-1 text-sm text-destructive", children: messages.map(({ path, message: message2 }) => /* @__PURE__ */ jsxs("li", { className: "leading-snug", children: [
|
|
43901
44947
|
showFieldPath && path ? /* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
43902
44948
|
path,
|
|
43903
44949
|
": "
|
|
43904
44950
|
] }) : null,
|
|
43905
44951
|
/* @__PURE__ */ jsx("span", { children: message2 })
|
|
43906
|
-
] },
|
|
44952
|
+
] }, getMessageKey(path, message2))) })
|
|
43907
44953
|
] })
|
|
43908
44954
|
] });
|
|
43909
44955
|
}
|
|
43910
44956
|
const MOBILE_BREAKPOINT = 768;
|
|
43911
44957
|
function useIsMobile() {
|
|
43912
|
-
const [isMobile, setIsMobile] = React.useState(
|
|
44958
|
+
const [isMobile, setIsMobile] = React.useState(
|
|
44959
|
+
void 0
|
|
44960
|
+
);
|
|
43913
44961
|
React.useEffect(() => {
|
|
43914
44962
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
43915
44963
|
const onChange = () => {
|
|
@@ -44789,23 +45837,22 @@ function ThemeToggle({ className }) {
|
|
|
44789
45837
|
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
44790
45838
|
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setTheme("light"), children: [
|
|
44791
45839
|
/* @__PURE__ */ jsx(Sun, { className: "mr-2 h-4 w-4" }),
|
|
44792
|
-
" "
|
|
44793
|
-
"Light"
|
|
45840
|
+
" Light"
|
|
44794
45841
|
] }),
|
|
44795
45842
|
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setTheme("dark"), children: [
|
|
44796
45843
|
/* @__PURE__ */ jsx(Moon, { className: "mr-2 h-4 w-4" }),
|
|
44797
|
-
" "
|
|
44798
|
-
"Dark"
|
|
45844
|
+
" Dark"
|
|
44799
45845
|
] }),
|
|
44800
45846
|
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setTheme("system"), children: [
|
|
44801
45847
|
/* @__PURE__ */ jsx(Laptop, { className: "mr-2 h-4 w-4" }),
|
|
44802
|
-
" "
|
|
44803
|
-
"System"
|
|
45848
|
+
" System"
|
|
44804
45849
|
] })
|
|
44805
45850
|
] })
|
|
44806
45851
|
] });
|
|
44807
45852
|
}
|
|
44808
|
-
const AdminMenuContext = createContext(
|
|
45853
|
+
const AdminMenuContext = createContext(
|
|
45854
|
+
null
|
|
45855
|
+
);
|
|
44809
45856
|
function useAdminSidebarMenu() {
|
|
44810
45857
|
const ctx = useContext(AdminMenuContext);
|
|
44811
45858
|
if (!ctx) {
|
|
@@ -44825,44 +45872,59 @@ function useAdminSidebarMenuRegistration() {
|
|
|
44825
45872
|
const { setGroups, registerGroup, registerItem, clear } = useAdminSidebarMenu();
|
|
44826
45873
|
return { setGroups, registerGroup, registerItem, clear };
|
|
44827
45874
|
}
|
|
44828
|
-
function AdminMenuProvider({
|
|
45875
|
+
function AdminMenuProvider({
|
|
45876
|
+
initialGroups = [],
|
|
45877
|
+
children
|
|
45878
|
+
}) {
|
|
44829
45879
|
const [groups, setGroups] = useState(initialGroups);
|
|
44830
|
-
const registerGroup = useCallback(
|
|
44831
|
-
|
|
44832
|
-
|
|
44833
|
-
|
|
44834
|
-
|
|
44835
|
-
|
|
44836
|
-
|
|
44837
|
-
|
|
44838
|
-
|
|
44839
|
-
|
|
44840
|
-
|
|
44841
|
-
|
|
44842
|
-
|
|
44843
|
-
|
|
44844
|
-
|
|
44845
|
-
|
|
44846
|
-
|
|
44847
|
-
|
|
44848
|
-
|
|
44849
|
-
|
|
44850
|
-
|
|
44851
|
-
|
|
44852
|
-
const
|
|
44853
|
-
|
|
44854
|
-
|
|
44855
|
-
|
|
44856
|
-
|
|
44857
|
-
|
|
44858
|
-
|
|
45880
|
+
const registerGroup = useCallback(
|
|
45881
|
+
(group) => {
|
|
45882
|
+
setGroups((prev) => {
|
|
45883
|
+
if (process.env.NODE_ENV !== "production") {
|
|
45884
|
+
console.log("[AdminMenuProvider] registerGroup", group);
|
|
45885
|
+
}
|
|
45886
|
+
const exists = prev.some((g) => g.id === group.id);
|
|
45887
|
+
if (exists) return prev;
|
|
45888
|
+
return [
|
|
45889
|
+
...prev,
|
|
45890
|
+
{ id: group.id, label: group.label, items: group.items ?? [] }
|
|
45891
|
+
];
|
|
45892
|
+
});
|
|
45893
|
+
},
|
|
45894
|
+
[]
|
|
45895
|
+
);
|
|
45896
|
+
const registerItem = useCallback(
|
|
45897
|
+
(groupId, item) => {
|
|
45898
|
+
setGroups((prev) => {
|
|
45899
|
+
if (process.env.NODE_ENV !== "production") {
|
|
45900
|
+
console.log("[AdminMenuProvider] registerItem", groupId, item);
|
|
45901
|
+
}
|
|
45902
|
+
const idx = prev.findIndex((g) => g.id === groupId);
|
|
45903
|
+
if (idx >= 0) {
|
|
45904
|
+
const group = prev[idx];
|
|
45905
|
+
const items = [...group.items];
|
|
45906
|
+
const existingIdx = items.findIndex((it) => it.id === item.id);
|
|
45907
|
+
if (existingIdx >= 0) items[existingIdx] = item;
|
|
45908
|
+
else items.push(item);
|
|
45909
|
+
const next = [...prev];
|
|
45910
|
+
next[idx] = { ...group, items };
|
|
45911
|
+
return next;
|
|
45912
|
+
}
|
|
45913
|
+
return [...prev, { id: groupId, label: groupId, items: [item] }];
|
|
45914
|
+
});
|
|
45915
|
+
},
|
|
45916
|
+
[]
|
|
45917
|
+
);
|
|
44859
45918
|
const clear = useCallback(() => {
|
|
44860
45919
|
if (process.env.NODE_ENV !== "production") {
|
|
44861
45920
|
console.log("[AdminMenuProvider] clear");
|
|
44862
45921
|
}
|
|
44863
45922
|
setGroups([]);
|
|
44864
45923
|
}, []);
|
|
44865
|
-
const value = useMemo(
|
|
45924
|
+
const value = useMemo(
|
|
45925
|
+
() => ({ groups, setGroups, registerGroup, registerItem, clear }),
|
|
45926
|
+
[groups, registerGroup, registerItem, clear]
|
|
45927
|
+
);
|
|
44866
45928
|
return /* @__PURE__ */ jsx(AdminMenuContext.Provider, { value, children });
|
|
44867
45929
|
}
|
|
44868
45930
|
function AdminLayoutContent({
|
|
@@ -44883,14 +45945,16 @@ function AdminLayoutContent({
|
|
|
44883
45945
|
const sidebarTitle = sidebarHeaderTitle ?? "Application";
|
|
44884
45946
|
const isMenuItemActive = (itemUrl) => {
|
|
44885
45947
|
if (!itemUrl) return false;
|
|
44886
|
-
return location.pathname === itemUrl || location.pathname.startsWith(itemUrl
|
|
45948
|
+
return location.pathname === itemUrl || location.pathname.startsWith(`${itemUrl}/`);
|
|
44887
45949
|
};
|
|
44888
45950
|
const setOpen = useCallback((id, val) => {
|
|
44889
45951
|
setOpenMap((prev) => ({ ...prev, [id]: val ?? !prev[id] }));
|
|
44890
45952
|
}, []);
|
|
44891
45953
|
const hasActiveDescendant = (item) => {
|
|
44892
45954
|
if (!item.children || item.children.length === 0) return false;
|
|
44893
|
-
return item.children.some(
|
|
45955
|
+
return item.children.some(
|
|
45956
|
+
(c2) => isMenuItemActive(c2.url) || hasActiveDescendant(c2)
|
|
45957
|
+
);
|
|
44894
45958
|
};
|
|
44895
45959
|
const renderItem = (item, level = 0) => {
|
|
44896
45960
|
const hasChildren = Array.isArray(item.children) && item.children.length > 0;
|
|
@@ -44898,64 +45962,92 @@ function AdminLayoutContent({
|
|
|
44898
45962
|
const isOpen = openMap[item.id] ?? (hasChildren && hasActiveDescendant(item));
|
|
44899
45963
|
const indentClassMap = ["", "pl-6", "pl-10", "pl-14"];
|
|
44900
45964
|
const indent = indentClassMap[Math.min(level, 3)];
|
|
44901
|
-
const content = /* @__PURE__ */ jsxs(
|
|
44902
|
-
|
|
44903
|
-
|
|
44904
|
-
{
|
|
44905
|
-
|
|
44906
|
-
|
|
44907
|
-
|
|
44908
|
-
|
|
44909
|
-
|
|
44910
|
-
|
|
44911
|
-
|
|
44912
|
-
|
|
44913
|
-
|
|
44914
|
-
|
|
44915
|
-
item.
|
|
44916
|
-
{
|
|
44917
|
-
|
|
44918
|
-
|
|
44919
|
-
|
|
44920
|
-
|
|
44921
|
-
|
|
44922
|
-
|
|
44923
|
-
|
|
44924
|
-
|
|
44925
|
-
|
|
44926
|
-
|
|
44927
|
-
|
|
44928
|
-
|
|
44929
|
-
|
|
44930
|
-
|
|
44931
|
-
|
|
45965
|
+
const content = /* @__PURE__ */ jsxs(
|
|
45966
|
+
SidebarMenuItem,
|
|
45967
|
+
{
|
|
45968
|
+
className: `mb-1 ${level > 0 ? "ml-1" : ""}`,
|
|
45969
|
+
children: [
|
|
45970
|
+
/* @__PURE__ */ jsx(
|
|
45971
|
+
SidebarMenuButton,
|
|
45972
|
+
{
|
|
45973
|
+
asChild: !!item.url && !hasChildren,
|
|
45974
|
+
isActive,
|
|
45975
|
+
tooltip: item.title,
|
|
45976
|
+
onClick: () => {
|
|
45977
|
+
if (hasChildren) setOpen(item.id);
|
|
45978
|
+
},
|
|
45979
|
+
disabled: item.disabled,
|
|
45980
|
+
className: `group relative overflow-hidden rounded-lg transition-all duration-200 hover:bg-sidebar-accent/70 data-[active=true]:bg-primary data-[active=true]:text-primary-foreground ${indent}`,
|
|
45981
|
+
children: item.url && !hasChildren ? /* @__PURE__ */ jsxs(Link$1, { to: item.url, className: "flex items-center gap-3 px-3", children: [
|
|
45982
|
+
item.icon && /* @__PURE__ */ jsx(
|
|
45983
|
+
item.icon,
|
|
45984
|
+
{
|
|
45985
|
+
className: `h-4 w-4 transition-colors ${isActive ? "text-primary-foreground" : "text-sidebar-foreground group-hover:text-sidebar-accent-foreground"}`
|
|
45986
|
+
}
|
|
45987
|
+
),
|
|
45988
|
+
/* @__PURE__ */ jsx(
|
|
45989
|
+
"span",
|
|
45990
|
+
{
|
|
45991
|
+
className: `font-medium transition-colors ${isActive ? "text-primary-foreground" : "text-sidebar-foreground group-hover:text-sidebar-accent-foreground"}`,
|
|
45992
|
+
children: item.title
|
|
45993
|
+
}
|
|
45994
|
+
),
|
|
45995
|
+
item.badge && /* @__PURE__ */ jsx("span", { className: "ml-auto text-xs bg-primary/10 text-primary px-2 py-0.5 rounded-full", children: item.badge })
|
|
45996
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-3 py-2.5 w-full", children: [
|
|
45997
|
+
hasChildren && (isOpen ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3.5 w-3.5 text-muted-foreground" })),
|
|
45998
|
+
item.icon ? /* @__PURE__ */ jsx(item.icon, { className: "h-4 w-4 text-sidebar-foreground group-hover:text-sidebar-accent-foreground" }) : /* @__PURE__ */ jsx(FallbackIcon, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
45999
|
+
item.url ? /* @__PURE__ */ jsx(Link$1, { to: item.url, className: "flex-1 text-left", children: /* @__PURE__ */ jsx("span", { className: "font-medium text-sidebar-foreground group-hover:text-sidebar-accent-foreground", children: item.title }) }) : /* @__PURE__ */ jsx("span", { className: "font-medium text-sidebar-foreground group-hover:text-sidebar-accent-foreground flex-1", children: item.title }),
|
|
46000
|
+
item.badge && /* @__PURE__ */ jsx("span", { className: "ml-auto text-xs bg-primary/10 text-primary px-2 py-0.5 rounded-full", children: item.badge })
|
|
46001
|
+
] })
|
|
46002
|
+
}
|
|
46003
|
+
),
|
|
46004
|
+
hasChildren && isOpen && /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-col", children: (item.children ?? []).map(
|
|
46005
|
+
(child) => renderItem(child, Math.min(level + 1, 3))
|
|
46006
|
+
) })
|
|
46007
|
+
]
|
|
46008
|
+
},
|
|
46009
|
+
item.id
|
|
46010
|
+
);
|
|
44932
46011
|
return content;
|
|
44933
46012
|
};
|
|
44934
46013
|
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-dvh w-full", children: [
|
|
44935
|
-
/* @__PURE__ */ jsxs(
|
|
44936
|
-
|
|
44937
|
-
|
|
44938
|
-
|
|
44939
|
-
|
|
44940
|
-
|
|
44941
|
-
|
|
44942
|
-
|
|
44943
|
-
|
|
44944
|
-
|
|
44945
|
-
|
|
44946
|
-
|
|
44947
|
-
|
|
44948
|
-
|
|
44949
|
-
|
|
44950
|
-
|
|
44951
|
-
|
|
44952
|
-
|
|
44953
|
-
|
|
44954
|
-
|
|
44955
|
-
|
|
44956
|
-
|
|
44957
|
-
|
|
44958
|
-
|
|
46014
|
+
/* @__PURE__ */ jsxs(
|
|
46015
|
+
Sidebar,
|
|
46016
|
+
{
|
|
46017
|
+
className: "bg-sidebar border-r border-sidebar-border",
|
|
46018
|
+
collapsible: sidebarCollapsible ? "icon" : "none",
|
|
46019
|
+
children: [
|
|
46020
|
+
/* @__PURE__ */ jsx(SidebarHeader, { className: "bg-sidebar border-b border-sidebar-border", children: sidebarHeader ? sidebarHeader : /* @__PURE__ */ jsx("div", { className: "sidebar-header-content flex items-center justify-center px-4 py-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
46021
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(SidebarHeaderIcon, { className: "h-4 w-4" }) }),
|
|
46022
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-sidebar-foreground", children: sidebarTitle })
|
|
46023
|
+
] }) }) }),
|
|
46024
|
+
/* @__PURE__ */ jsx(SidebarContent, { className: "bg-sidebar px-2 py-4", children: sidebarGroups.map((group, idx) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
46025
|
+
/* @__PURE__ */ jsxs(SidebarGroup, { children: [
|
|
46026
|
+
/* @__PURE__ */ jsx(SidebarGroupLabel, { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider px-3 mb-2 group-data-[collapsible=icon]:hidden", children: group.label }),
|
|
46027
|
+
/* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { className: "group-data-[collapsible=icon]:items-center", children: group.items.map((item) => renderItem(item, 0)) }) })
|
|
46028
|
+
] }),
|
|
46029
|
+
idx < sidebarGroups.length - 1 && /* @__PURE__ */ jsx(
|
|
46030
|
+
Separator$2,
|
|
46031
|
+
{
|
|
46032
|
+
orientation: "horizontal",
|
|
46033
|
+
className: "bg-sidebar-border group-data-[collapsible=icon]:hidden"
|
|
46034
|
+
}
|
|
46035
|
+
)
|
|
46036
|
+
] }, group.id)) }),
|
|
46037
|
+
/* @__PURE__ */ jsx(SidebarFooter, { className: "bg-sidebar border-t border-sidebar-border px-2 py-3", children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { className: "group-data-[collapsible=icon]:flex group-data-[collapsible=icon]:w-full group-data-[collapsible=icon]:justify-center", children: /* @__PURE__ */ jsx(
|
|
46038
|
+
SidebarMenuButton,
|
|
46039
|
+
{
|
|
46040
|
+
tooltip: "Logout",
|
|
46041
|
+
className: "group relative overflow-hidden rounded-lg mx-1 transition-all duration-200 hover:bg-sidebar-accent/70 hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:flex group-data-[collapsible=icon]:w-full group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:!justify-center group-data-[collapsible=icon]:!px-0 group-data-[collapsible=icon]:!gap-0",
|
|
46042
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-3 py-2.5 group-data-[collapsible=icon]:w-full group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:!justify-center group-data-[collapsible=icon]:!gap-0 group-data-[collapsible=icon]:!px-0", children: [
|
|
46043
|
+
/* @__PURE__ */ jsx(LogOut, { className: "h-4 w-4 text-sidebar-foreground group-hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:mx-auto group-data-[collapsible=icon]:mr-0" }),
|
|
46044
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-sidebar-foreground group-hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:hidden", children: "Logout" })
|
|
46045
|
+
] })
|
|
46046
|
+
}
|
|
46047
|
+
) }) }) })
|
|
46048
|
+
]
|
|
46049
|
+
}
|
|
46050
|
+
),
|
|
44959
46051
|
/* @__PURE__ */ jsxs(SidebarInset, { children: [
|
|
44960
46052
|
/* @__PURE__ */ jsxs("header", { className: "flex h-16 shrink-0 items-center justify-between gap-4 border-b border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 px-6", children: [
|
|
44961
46053
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
@@ -57529,7 +58621,7 @@ var Menubar$1 = React.forwardRef(
|
|
|
57529
58621
|
dir: direction,
|
|
57530
58622
|
loop,
|
|
57531
58623
|
children: /* @__PURE__ */ jsx(Collection$2.Provider, { scope: __scopeMenubar, children: /* @__PURE__ */ jsx(Collection$2.Slot, { scope: __scopeMenubar, children: /* @__PURE__ */ jsx(
|
|
57532
|
-
Root$
|
|
58624
|
+
Root$e,
|
|
57533
58625
|
{
|
|
57534
58626
|
asChild: true,
|
|
57535
58627
|
...rovingFocusGroupScope,
|
|
@@ -62798,7 +63890,7 @@ var ToggleGroupImpl = React__default.forwardRef(
|
|
|
62798
63890
|
const direction = useDirection(dir);
|
|
62799
63891
|
const commonProps = { role: "group", dir: direction, ...toggleGroupProps };
|
|
62800
63892
|
return /* @__PURE__ */ jsx(ToggleGroupContext$1, { scope: __scopeToggleGroup, rovingFocus, disabled, children: rovingFocus ? /* @__PURE__ */ jsx(
|
|
62801
|
-
Root$
|
|
63893
|
+
Root$e,
|
|
62802
63894
|
{
|
|
62803
63895
|
asChild: true,
|
|
62804
63896
|
...rovingFocusGroupScope,
|