@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
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import type { FieldRenderProps } from './types'
|
|
3
|
-
import { DateTimeRangePicker } from '../../../../components/datetimepicker/DateTimeRangePicker'
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FieldRenderProps } from './types';
|
|
3
|
+
import { DateTimeRangePicker } from '../../../../components/datetimepicker/DateTimeRangePicker';
|
|
4
4
|
|
|
5
|
-
export function DateTimeRangePickerField({
|
|
5
|
+
export function DateTimeRangePickerField({
|
|
6
|
+
field,
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
className,
|
|
10
|
+
}: FieldRenderProps) {
|
|
6
11
|
const v = React.useMemo(() => {
|
|
7
|
-
if (!value || typeof value !== 'object')
|
|
8
|
-
|
|
12
|
+
if (!value || typeof value !== 'object')
|
|
13
|
+
return null as { from?: Date | null; to?: Date | null } | null;
|
|
14
|
+
const anyVal = value as { from?: unknown; to?: unknown };
|
|
9
15
|
const toDate = (x: unknown) => {
|
|
10
|
-
if (!x) return undefined
|
|
11
|
-
if (x instanceof Date) return x
|
|
12
|
-
const d = new Date(x as string)
|
|
13
|
-
return Number.isNaN(d.getTime()) ? undefined : d
|
|
14
|
-
}
|
|
15
|
-
const from = toDate(anyVal.from) ?? null
|
|
16
|
-
const to = toDate(anyVal.to) ?? null
|
|
17
|
-
return { from, to }
|
|
18
|
-
}, [value])
|
|
16
|
+
if (!x) return undefined;
|
|
17
|
+
if (x instanceof Date) return x;
|
|
18
|
+
const d = new Date(x as string);
|
|
19
|
+
return Number.isNaN(d.getTime()) ? undefined : d;
|
|
20
|
+
};
|
|
21
|
+
const from = toDate(anyVal.from) ?? null;
|
|
22
|
+
const to = toDate(anyVal.to) ?? null;
|
|
23
|
+
return { from, to };
|
|
24
|
+
}, [value]);
|
|
19
25
|
|
|
20
26
|
return (
|
|
21
27
|
<DateTimeRangePicker
|
|
@@ -36,7 +42,7 @@ export function DateTimeRangePickerField({ field, value, onChange, className }:
|
|
|
36
42
|
cancelLabel={field.cancelLabel}
|
|
37
43
|
applyLabel={field.applyLabel}
|
|
38
44
|
/>
|
|
39
|
-
)
|
|
45
|
+
);
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
export default DateTimeRangePickerField
|
|
48
|
+
export default DateTimeRangePickerField;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import type { FieldRenderProps } from './types'
|
|
2
|
-
import { FileUploader } from '../../../../components/fileuploader/FileUploader'
|
|
1
|
+
import type { FieldRenderProps } from './types';
|
|
2
|
+
import { FileUploader } from '../../../../components/fileuploader/FileUploader';
|
|
3
3
|
|
|
4
|
-
export function FileField({
|
|
5
|
-
|
|
4
|
+
export function FileField({
|
|
5
|
+
field,
|
|
6
|
+
value,
|
|
7
|
+
onChange,
|
|
8
|
+
className,
|
|
9
|
+
}: FieldRenderProps) {
|
|
10
|
+
const files = Array.isArray(value) ? value : [];
|
|
6
11
|
return (
|
|
7
12
|
<FileUploader
|
|
8
13
|
className={className}
|
|
@@ -22,5 +27,5 @@ export function FileField({ field, value, onChange, className }: FieldRenderProp
|
|
|
22
27
|
onRetry={field.fileOnRetry}
|
|
23
28
|
onRetryAll={field.fileOnRetryAll}
|
|
24
29
|
/>
|
|
25
|
-
)
|
|
30
|
+
);
|
|
26
31
|
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import type { FieldRenderProps } from './types'
|
|
3
|
-
import { MonthInput } from '../../../../components/monthpicker/MonthInput'
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FieldRenderProps } from './types';
|
|
3
|
+
import { MonthInput } from '../../../../components/monthpicker/MonthInput';
|
|
4
4
|
|
|
5
|
-
export function MonthPickerField({
|
|
5
|
+
export function MonthPickerField({
|
|
6
|
+
field,
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
className,
|
|
10
|
+
}: FieldRenderProps) {
|
|
6
11
|
const v = React.useMemo(() => {
|
|
7
|
-
if (!value) return undefined
|
|
8
|
-
if (value instanceof Date) return value
|
|
9
|
-
const d = new Date(value as string)
|
|
10
|
-
return Number.isNaN(d.getTime()) ? undefined : d
|
|
11
|
-
}, [value])
|
|
12
|
+
if (!value) return undefined;
|
|
13
|
+
if (value instanceof Date) return value;
|
|
14
|
+
const d = new Date(value as string);
|
|
15
|
+
return Number.isNaN(d.getTime()) ? undefined : d;
|
|
16
|
+
}, [value]);
|
|
12
17
|
|
|
13
18
|
return (
|
|
14
19
|
<MonthInput
|
|
@@ -17,10 +22,12 @@ export function MonthPickerField({ field, value, onChange, className }: FieldRen
|
|
|
17
22
|
onChange={(d: Date | null) => onChange(d)}
|
|
18
23
|
minDate={field.minDate}
|
|
19
24
|
maxDate={field.maxDate}
|
|
20
|
-
disabledDates={
|
|
25
|
+
disabledDates={field.disabledDates?.filter(
|
|
26
|
+
(it): it is Date => it instanceof Date,
|
|
27
|
+
)}
|
|
21
28
|
showFooter
|
|
22
29
|
clearLabel={field.cancelLabel}
|
|
23
30
|
closeLabel={field.applyLabel}
|
|
24
31
|
/>
|
|
25
|
-
)
|
|
32
|
+
);
|
|
26
33
|
}
|
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import type { FieldRenderProps } from './types'
|
|
3
|
-
import { MonthRangeInput } from '../../../../components/monthpicker/MonthRangeInput'
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FieldRenderProps } from './types';
|
|
3
|
+
import { MonthRangeInput } from '../../../../components/monthpicker/MonthRangeInput';
|
|
4
4
|
|
|
5
|
-
export function MonthRangePickerField({
|
|
5
|
+
export function MonthRangePickerField({
|
|
6
|
+
field,
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
className,
|
|
10
|
+
}: FieldRenderProps) {
|
|
6
11
|
const v = React.useMemo(() => {
|
|
7
|
-
if (!value || typeof value !== 'object')
|
|
8
|
-
|
|
12
|
+
if (!value || typeof value !== 'object')
|
|
13
|
+
return undefined as { start: Date; end: Date } | undefined;
|
|
14
|
+
const anyVal = value as { start?: unknown; end?: unknown };
|
|
9
15
|
const toDate = (x: unknown) => {
|
|
10
|
-
if (!x) return undefined
|
|
11
|
-
if (x instanceof Date) return x
|
|
12
|
-
const d = new Date(x as string)
|
|
13
|
-
return Number.isNaN(d.getTime()) ? undefined : d
|
|
14
|
-
}
|
|
15
|
-
const start = toDate(anyVal.start)
|
|
16
|
-
const end = toDate(anyVal.end)
|
|
17
|
-
if (!start || !end) return undefined
|
|
18
|
-
return { start, end }
|
|
19
|
-
}, [value])
|
|
16
|
+
if (!x) return undefined;
|
|
17
|
+
if (x instanceof Date) return x;
|
|
18
|
+
const d = new Date(x as string);
|
|
19
|
+
return Number.isNaN(d.getTime()) ? undefined : d;
|
|
20
|
+
};
|
|
21
|
+
const start = toDate(anyVal.start);
|
|
22
|
+
const end = toDate(anyVal.end);
|
|
23
|
+
if (!start || !end) return undefined;
|
|
24
|
+
return { start, end };
|
|
25
|
+
}, [value]);
|
|
20
26
|
|
|
21
27
|
return (
|
|
22
28
|
<MonthRangeInput
|
|
@@ -31,5 +37,5 @@ export function MonthRangePickerField({ field, value, onChange, className }: Fie
|
|
|
31
37
|
cancelLabel={field.cancelLabel}
|
|
32
38
|
applyLabel={field.applyLabel}
|
|
33
39
|
/>
|
|
34
|
-
)
|
|
40
|
+
);
|
|
35
41
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { Input } from '../../../../../shadcn/ui/input'
|
|
2
|
-
import type { FieldRenderProps } from './types'
|
|
1
|
+
import { Input } from '../../../../../shadcn/ui/input';
|
|
2
|
+
import type { FieldRenderProps } from './types';
|
|
3
3
|
|
|
4
|
-
export function NumberField({
|
|
4
|
+
export function NumberField({
|
|
5
|
+
field,
|
|
6
|
+
value,
|
|
7
|
+
onChange,
|
|
8
|
+
className,
|
|
9
|
+
}: FieldRenderProps) {
|
|
5
10
|
return (
|
|
6
11
|
<Input
|
|
7
12
|
className={className}
|
|
@@ -11,5 +16,5 @@ export function NumberField({ field, value, onChange, className }: FieldRenderPr
|
|
|
11
16
|
value={(value as number | string) ?? ''}
|
|
12
17
|
onChange={(e) => onChange(Number(e.target.value))}
|
|
13
18
|
/>
|
|
14
|
-
)
|
|
19
|
+
);
|
|
15
20
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
Card,
|
|
3
|
+
CardContent,
|
|
4
|
+
CardHeader,
|
|
5
|
+
CardTitle,
|
|
6
|
+
} from '../../../../../shadcn/ui/card';
|
|
7
|
+
import { cn } from '../../../../../shadcn/lib/utils';
|
|
8
|
+
import type { FieldRenderProps } from './types';
|
|
9
|
+
import { FormBuilderField } from '../FormBuilderField';
|
|
5
10
|
|
|
6
11
|
export function ObjectField({ field, control, fieldPath }: FieldRenderProps) {
|
|
7
|
-
if (!field.fields) return null
|
|
12
|
+
if (!field.fields) return null;
|
|
8
13
|
return (
|
|
9
14
|
<Card className={cn(field.className)}>
|
|
10
15
|
<CardHeader className="pb-3">
|
|
@@ -15,7 +20,7 @@ export function ObjectField({ field, control, fieldPath }: FieldRenderProps) {
|
|
|
15
20
|
</CardHeader>
|
|
16
21
|
<CardContent className="space-y-4">
|
|
17
22
|
<div className="grid gap-4 md:grid-cols-2">
|
|
18
|
-
{field.fields.map(subField => (
|
|
23
|
+
{field.fields.map((subField) => (
|
|
19
24
|
<FormBuilderField
|
|
20
25
|
key={subField.name}
|
|
21
26
|
field={subField}
|
|
@@ -26,5 +31,5 @@ export function ObjectField({ field, control, fieldPath }: FieldRenderProps) {
|
|
|
26
31
|
</div>
|
|
27
32
|
</CardContent>
|
|
28
33
|
</Card>
|
|
29
|
-
)
|
|
34
|
+
);
|
|
30
35
|
}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
RadioGroup,
|
|
3
|
+
RadioGroupItem,
|
|
4
|
+
} from '../../../../../shadcn/ui/radio-group';
|
|
5
|
+
import { Label } from '../../../../../shadcn/ui/label';
|
|
6
|
+
import type { FieldRenderProps } from './types';
|
|
4
7
|
|
|
5
|
-
const NULL_SENTINEL = '__NULL__'
|
|
8
|
+
const NULL_SENTINEL = '__NULL__';
|
|
6
9
|
|
|
7
|
-
export function RadioField({
|
|
8
|
-
|
|
10
|
+
export function RadioField({
|
|
11
|
+
field,
|
|
12
|
+
value,
|
|
13
|
+
onChange,
|
|
14
|
+
className,
|
|
15
|
+
fieldPath,
|
|
16
|
+
}: FieldRenderProps) {
|
|
17
|
+
const toUiValue = (val: unknown) =>
|
|
18
|
+
val === null || val === undefined ? NULL_SENTINEL : String(val);
|
|
9
19
|
const fromUiValue = (val: string) => {
|
|
10
|
-
const match = field.options?.find(opt => toUiValue(opt.value) === val)
|
|
11
|
-
return match ? match.value : null
|
|
12
|
-
}
|
|
20
|
+
const match = field.options?.find((opt) => toUiValue(opt.value) === val);
|
|
21
|
+
return match ? match.value : null;
|
|
22
|
+
};
|
|
13
23
|
|
|
14
24
|
return (
|
|
15
25
|
<RadioGroup
|
|
@@ -18,12 +28,20 @@ export function RadioField({ field, value, onChange, className, fieldPath }: Fie
|
|
|
18
28
|
disabled={field.disabled}
|
|
19
29
|
className={className}
|
|
20
30
|
>
|
|
21
|
-
{field.options?.map(option => (
|
|
22
|
-
<div
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
{field.options?.map((option) => (
|
|
32
|
+
<div
|
|
33
|
+
key={toUiValue(option.value)}
|
|
34
|
+
className="flex items-center space-x-2"
|
|
35
|
+
>
|
|
36
|
+
<RadioGroupItem
|
|
37
|
+
value={toUiValue(option.value)}
|
|
38
|
+
id={`${fieldPath}-${toUiValue(option.value)}`}
|
|
39
|
+
/>
|
|
40
|
+
<Label htmlFor={`${fieldPath}-${toUiValue(option.value)}`}>
|
|
41
|
+
{option.label}
|
|
42
|
+
</Label>
|
|
25
43
|
</div>
|
|
26
44
|
))}
|
|
27
45
|
</RadioGroup>
|
|
28
|
-
)
|
|
46
|
+
);
|
|
29
47
|
}
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
Select,
|
|
3
|
+
SelectContent,
|
|
4
|
+
SelectItem,
|
|
5
|
+
SelectTrigger,
|
|
6
|
+
SelectValue,
|
|
7
|
+
} from '../../../../../shadcn/ui/select';
|
|
8
|
+
import type { FieldRenderProps } from './types';
|
|
3
9
|
|
|
4
|
-
const NULL_SENTINEL = '__NULL__'
|
|
10
|
+
const NULL_SENTINEL = '__NULL__';
|
|
5
11
|
|
|
6
|
-
export function SelectField({
|
|
7
|
-
|
|
12
|
+
export function SelectField({
|
|
13
|
+
field,
|
|
14
|
+
value,
|
|
15
|
+
onChange,
|
|
16
|
+
className,
|
|
17
|
+
}: FieldRenderProps) {
|
|
18
|
+
const toUiValue = (val: unknown) =>
|
|
19
|
+
val === null || val === undefined ? NULL_SENTINEL : String(val);
|
|
8
20
|
const fromUiValue = (val: string) => {
|
|
9
|
-
const match = field.options?.find(opt => toUiValue(opt.value) === val)
|
|
10
|
-
return match ? match.value : null
|
|
11
|
-
}
|
|
21
|
+
const match = field.options?.find((opt) => toUiValue(opt.value) === val);
|
|
22
|
+
return match ? match.value : null;
|
|
23
|
+
};
|
|
12
24
|
|
|
13
25
|
return (
|
|
14
26
|
<Select
|
|
@@ -20,12 +32,15 @@ export function SelectField({ field, value, onChange, className }: FieldRenderPr
|
|
|
20
32
|
<SelectValue placeholder={field.placeholder} />
|
|
21
33
|
</SelectTrigger>
|
|
22
34
|
<SelectContent>
|
|
23
|
-
{field.options?.map(option => (
|
|
24
|
-
<SelectItem
|
|
35
|
+
{field.options?.map((option) => (
|
|
36
|
+
<SelectItem
|
|
37
|
+
key={toUiValue(option.value)}
|
|
38
|
+
value={toUiValue(option.value)}
|
|
39
|
+
>
|
|
25
40
|
{option.label}
|
|
26
41
|
</SelectItem>
|
|
27
42
|
))}
|
|
28
43
|
</SelectContent>
|
|
29
44
|
</Select>
|
|
30
|
-
)
|
|
45
|
+
);
|
|
31
46
|
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { Switch } from '../../../../../shadcn/ui/switch'
|
|
2
|
-
import { Label } from '../../../../../shadcn/ui/label'
|
|
3
|
-
import { cn } from '../../../../../shadcn/lib/utils'
|
|
4
|
-
import type { FieldRenderProps } from './types'
|
|
1
|
+
import { Switch } from '../../../../../shadcn/ui/switch';
|
|
2
|
+
import { Label } from '../../../../../shadcn/ui/label';
|
|
3
|
+
import { cn } from '../../../../../shadcn/lib/utils';
|
|
4
|
+
import type { FieldRenderProps } from './types';
|
|
5
5
|
|
|
6
|
-
export function SwitchField({
|
|
7
|
-
|
|
6
|
+
export function SwitchField({
|
|
7
|
+
field,
|
|
8
|
+
fieldPath,
|
|
9
|
+
value,
|
|
10
|
+
onChange,
|
|
11
|
+
className,
|
|
12
|
+
}: FieldRenderProps) {
|
|
13
|
+
const placement = field.labelPlacement ?? 'inline';
|
|
8
14
|
|
|
9
15
|
if (placement === 'stacked') {
|
|
10
|
-
const labelId = `${fieldPath}-label
|
|
16
|
+
const labelId = `${fieldPath}-label`;
|
|
11
17
|
return (
|
|
12
18
|
<div className="space-y-2">
|
|
13
19
|
<Label id={labelId} className="text-sm font-medium">
|
|
@@ -23,7 +29,7 @@ export function SwitchField({ field, fieldPath, value, onChange, className }: Fi
|
|
|
23
29
|
className={cn(className)}
|
|
24
30
|
/>
|
|
25
31
|
</div>
|
|
26
|
-
)
|
|
32
|
+
);
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
if (placement === 'hidden') {
|
|
@@ -35,7 +41,7 @@ export function SwitchField({ field, fieldPath, value, onChange, className }: Fi
|
|
|
35
41
|
disabled={field.disabled}
|
|
36
42
|
className={cn(className)}
|
|
37
43
|
/>
|
|
38
|
-
)
|
|
44
|
+
);
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
return (
|
|
@@ -47,10 +53,13 @@ export function SwitchField({ field, fieldPath, value, onChange, className }: Fi
|
|
|
47
53
|
disabled={field.disabled}
|
|
48
54
|
className={cn(className)}
|
|
49
55
|
/>
|
|
50
|
-
<Label
|
|
56
|
+
<Label
|
|
57
|
+
htmlFor={fieldPath}
|
|
58
|
+
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
59
|
+
>
|
|
51
60
|
{field.label}
|
|
52
61
|
{field.required && <span className="text-destructive ml-1">*</span>}
|
|
53
62
|
</Label>
|
|
54
63
|
</div>
|
|
55
|
-
)
|
|
64
|
+
);
|
|
56
65
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { Input } from '../../../../../shadcn/ui/input'
|
|
2
|
-
import type { FieldRenderProps } from './types'
|
|
1
|
+
import { Input } from '../../../../../shadcn/ui/input';
|
|
2
|
+
import type { FieldRenderProps } from './types';
|
|
3
3
|
|
|
4
|
-
export function TextField({
|
|
4
|
+
export function TextField({
|
|
5
|
+
field,
|
|
6
|
+
fieldPath,
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
className,
|
|
10
|
+
}: FieldRenderProps) {
|
|
5
11
|
const type: 'text' | 'email' | 'password' =
|
|
6
|
-
field.type === 'email' || field.type === 'password' ? field.type : 'text'
|
|
12
|
+
field.type === 'email' || field.type === 'password' ? field.type : 'text';
|
|
7
13
|
return (
|
|
8
14
|
<Input
|
|
9
15
|
id={fieldPath}
|
|
@@ -14,5 +20,5 @@ export function TextField({ field, fieldPath, value, onChange, className }: Fiel
|
|
|
14
20
|
value={(value as string) || ''}
|
|
15
21
|
onChange={(e) => onChange(e.target.value)}
|
|
16
22
|
/>
|
|
17
|
-
)
|
|
23
|
+
);
|
|
18
24
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { Textarea } from '../../../../../shadcn/ui/textarea'
|
|
2
|
-
import type { FieldRenderProps } from './types'
|
|
1
|
+
import { Textarea } from '../../../../../shadcn/ui/textarea';
|
|
2
|
+
import type { FieldRenderProps } from './types';
|
|
3
3
|
|
|
4
|
-
export function TextareaField({
|
|
4
|
+
export function TextareaField({
|
|
5
|
+
field,
|
|
6
|
+
value,
|
|
7
|
+
onChange,
|
|
8
|
+
className,
|
|
9
|
+
}: FieldRenderProps) {
|
|
5
10
|
return (
|
|
6
11
|
<Textarea
|
|
7
12
|
className={className}
|
|
@@ -11,5 +16,5 @@ export function TextareaField({ field, value, onChange, className }: FieldRender
|
|
|
11
16
|
onChange={(e) => onChange(e.target.value)}
|
|
12
17
|
rows={4}
|
|
13
18
|
/>
|
|
14
|
-
)
|
|
19
|
+
);
|
|
15
20
|
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import type { FieldRenderProps } from './types'
|
|
3
|
-
import { TimePicker } from '../../../../components/timepicker/TimePicker'
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FieldRenderProps } from './types';
|
|
3
|
+
import { TimePicker } from '../../../../components/timepicker/TimePicker';
|
|
4
4
|
|
|
5
|
-
export function TimePickerField({
|
|
5
|
+
export function TimePickerField({
|
|
6
|
+
field,
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
className,
|
|
10
|
+
}: FieldRenderProps) {
|
|
6
11
|
const v = React.useMemo(() => {
|
|
7
|
-
if (!value) return null
|
|
8
|
-
if (value instanceof Date) return value
|
|
9
|
-
const d = new Date(value as string)
|
|
10
|
-
return Number.isNaN(d.getTime()) ? null : d
|
|
11
|
-
}, [value])
|
|
12
|
+
if (!value) return null;
|
|
13
|
+
if (value instanceof Date) return value;
|
|
14
|
+
const d = new Date(value as string);
|
|
15
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
16
|
+
}, [value]);
|
|
12
17
|
|
|
13
18
|
return (
|
|
14
19
|
<TimePicker
|
|
@@ -24,7 +29,7 @@ export function TimePickerField({ field, value, onChange, className }: FieldRend
|
|
|
24
29
|
cancelLabel={field.cancelLabel}
|
|
25
30
|
applyLabel={field.applyLabel}
|
|
26
31
|
/>
|
|
27
|
-
)
|
|
32
|
+
);
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
export default TimePickerField
|
|
35
|
+
export default TimePickerField;
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import type { FieldRenderProps } from './types'
|
|
3
|
-
import { TimeRangePicker } from '../../../../components/timepicker/TimeRangePicker'
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FieldRenderProps } from './types';
|
|
3
|
+
import { TimeRangePicker } from '../../../../components/timepicker/TimeRangePicker';
|
|
4
4
|
|
|
5
|
-
export function TimeRangePickerField({
|
|
5
|
+
export function TimeRangePickerField({
|
|
6
|
+
field,
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
className,
|
|
10
|
+
}: FieldRenderProps) {
|
|
6
11
|
const v = React.useMemo(() => {
|
|
7
|
-
if (!value || typeof value !== 'object')
|
|
8
|
-
|
|
12
|
+
if (!value || typeof value !== 'object')
|
|
13
|
+
return null as { from?: Date | null; to?: Date | null } | null;
|
|
14
|
+
const anyVal = value as { from?: unknown; to?: unknown };
|
|
9
15
|
const toDate = (x: unknown) => {
|
|
10
|
-
if (!x) return undefined
|
|
11
|
-
if (x instanceof Date) return x
|
|
12
|
-
const d = new Date(x as string)
|
|
13
|
-
return Number.isNaN(d.getTime()) ? undefined : d
|
|
14
|
-
}
|
|
15
|
-
const from = toDate(anyVal.from) ?? null
|
|
16
|
-
const to = toDate(anyVal.to) ?? null
|
|
17
|
-
return { from, to }
|
|
18
|
-
}, [value])
|
|
16
|
+
if (!x) return undefined;
|
|
17
|
+
if (x instanceof Date) return x;
|
|
18
|
+
const d = new Date(x as string);
|
|
19
|
+
return Number.isNaN(d.getTime()) ? undefined : d;
|
|
20
|
+
};
|
|
21
|
+
const from = toDate(anyVal.from) ?? null;
|
|
22
|
+
const to = toDate(anyVal.to) ?? null;
|
|
23
|
+
return { from, to };
|
|
24
|
+
}, [value]);
|
|
19
25
|
|
|
20
26
|
return (
|
|
21
27
|
<TimeRangePicker
|
|
@@ -31,7 +37,7 @@ export function TimeRangePickerField({ field, value, onChange, className }: Fiel
|
|
|
31
37
|
cancelLabel={field.cancelLabel}
|
|
32
38
|
applyLabel={field.applyLabel}
|
|
33
39
|
/>
|
|
34
|
-
)
|
|
40
|
+
);
|
|
35
41
|
}
|
|
36
42
|
|
|
37
|
-
export default TimeRangePickerField
|
|
43
|
+
export default TimeRangePickerField;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export * from './types'
|
|
2
|
-
export * from './AutocompleteField'
|
|
3
|
-
export * from './TextField'
|
|
4
|
-
export * from './NumberField'
|
|
5
|
-
export * from './TextareaField'
|
|
6
|
-
export * from './SelectField'
|
|
7
|
-
export * from './CheckboxField'
|
|
8
|
-
export * from './SwitchField'
|
|
9
|
-
export * from './RadioField'
|
|
10
|
-
export * from './DateField'
|
|
11
|
-
export * from './DatePickerField'
|
|
12
|
-
export * from './DateRangePickerField'
|
|
13
|
-
export * from './MonthPickerField'
|
|
14
|
-
export * from './MonthRangePickerField'
|
|
15
|
-
export * from './TimePickerField'
|
|
16
|
-
export * from './TimeRangePickerField'
|
|
17
|
-
export * from './DateTimePickerField'
|
|
18
|
-
export * from './DateTimeRangePickerField'
|
|
19
|
-
export * from './FileField'
|
|
20
|
-
export * from './ObjectField'
|
|
21
|
-
export * from './ArrayField'
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './AutocompleteField';
|
|
3
|
+
export * from './TextField';
|
|
4
|
+
export * from './NumberField';
|
|
5
|
+
export * from './TextareaField';
|
|
6
|
+
export * from './SelectField';
|
|
7
|
+
export * from './CheckboxField';
|
|
8
|
+
export * from './SwitchField';
|
|
9
|
+
export * from './RadioField';
|
|
10
|
+
export * from './DateField';
|
|
11
|
+
export * from './DatePickerField';
|
|
12
|
+
export * from './DateRangePickerField';
|
|
13
|
+
export * from './MonthPickerField';
|
|
14
|
+
export * from './MonthRangePickerField';
|
|
15
|
+
export * from './TimePickerField';
|
|
16
|
+
export * from './TimeRangePickerField';
|
|
17
|
+
export * from './DateTimePickerField';
|
|
18
|
+
export * from './DateTimeRangePickerField';
|
|
19
|
+
export * from './FileField';
|
|
20
|
+
export * from './ObjectField';
|
|
21
|
+
export * from './ArrayField';
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import type { Control, FieldValues } from 'react-hook-form'
|
|
2
|
-
import type { FormBuilderFieldConfig } from '../../types'
|
|
1
|
+
import type { Control, FieldValues } from 'react-hook-form';
|
|
2
|
+
import type { FormBuilderFieldConfig } from '../../types';
|
|
3
3
|
|
|
4
4
|
export interface FieldRenderProps {
|
|
5
|
-
field: FormBuilderFieldConfig<any, any
|
|
6
|
-
control: Control<FieldValues
|
|
7
|
-
fieldPath: string
|
|
8
|
-
value: unknown
|
|
9
|
-
onChange: (value: unknown, ...extras: unknown[]) => void
|
|
10
|
-
className?: string
|
|
11
|
-
disabled?: boolean
|
|
12
|
-
errorMessage?: string
|
|
13
|
-
onFieldChange?: (
|
|
5
|
+
field: FormBuilderFieldConfig<any, any>;
|
|
6
|
+
control: Control<FieldValues>;
|
|
7
|
+
fieldPath: string;
|
|
8
|
+
value: unknown;
|
|
9
|
+
onChange: (value: unknown, ...extras: unknown[]) => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
onFieldChange?: (
|
|
14
|
+
name: string,
|
|
15
|
+
value: unknown,
|
|
16
|
+
allValues: Record<string, unknown>,
|
|
17
|
+
) => void;
|
|
14
18
|
}
|