@k3-universe/react-kit 0.0.28 → 0.0.30
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.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3794 -1426
- package/dist/kit/builder/auth/components/Can.d.ts +13 -0
- package/dist/kit/builder/auth/components/Can.d.ts.map +1 -0
- package/dist/kit/builder/auth/components/RequireAuth.d.ts +45 -0
- package/dist/kit/builder/auth/components/RequireAuth.d.ts.map +1 -0
- package/dist/kit/builder/auth/components/ShowWhenAuthenticated.d.ts +8 -0
- package/dist/kit/builder/auth/components/ShowWhenAuthenticated.d.ts.map +1 -0
- package/dist/kit/builder/auth/components/ShowWhenError.d.ts +8 -0
- package/dist/kit/builder/auth/components/ShowWhenError.d.ts.map +1 -0
- package/dist/kit/builder/auth/components/ShowWhenLoading.d.ts +8 -0
- package/dist/kit/builder/auth/components/ShowWhenLoading.d.ts.map +1 -0
- package/dist/kit/builder/auth/components/ShowWhenUnauthenticated.d.ts +8 -0
- package/dist/kit/builder/auth/components/ShowWhenUnauthenticated.d.ts.map +1 -0
- package/dist/kit/builder/auth/components/withPermission.d.ts +7 -0
- package/dist/kit/builder/auth/components/withPermission.d.ts.map +1 -0
- package/dist/kit/builder/auth/hooks/action-hooks.d.ts +18 -0
- package/dist/kit/builder/auth/hooks/action-hooks.d.ts.map +1 -0
- package/dist/kit/builder/auth/hooks/core-hooks.d.ts +56 -0
- package/dist/kit/builder/auth/hooks/core-hooks.d.ts.map +1 -0
- package/dist/kit/builder/auth/hooks/index.d.ts +5 -0
- package/dist/kit/builder/auth/hooks/index.d.ts.map +1 -0
- package/dist/kit/builder/auth/hooks/permission-hooks.d.ts +18 -0
- package/dist/kit/builder/auth/hooks/permission-hooks.d.ts.map +1 -0
- package/dist/kit/builder/auth/hooks/token-hooks.d.ts +13 -0
- package/dist/kit/builder/auth/hooks/token-hooks.d.ts.map +1 -0
- package/dist/kit/builder/auth/index.d.ts +17 -0
- package/dist/kit/builder/auth/index.d.ts.map +1 -0
- package/dist/kit/builder/auth/providers/AuthProvider.d.ts +36 -0
- package/dist/kit/builder/auth/providers/AuthProvider.d.ts.map +1 -0
- package/dist/kit/builder/auth/types/adapter-config.d.ts +31 -0
- package/dist/kit/builder/auth/types/adapter-config.d.ts.map +1 -0
- package/dist/kit/builder/auth/types/adapter.d.ts +80 -0
- package/dist/kit/builder/auth/types/adapter.d.ts.map +1 -0
- package/dist/kit/builder/auth/types/core.d.ts +16 -0
- package/dist/kit/builder/auth/types/core.d.ts.map +1 -0
- package/dist/kit/builder/auth/types/index.d.ts +10 -0
- package/dist/kit/builder/auth/types/index.d.ts.map +1 -0
- package/dist/kit/builder/auth/types/middleware.d.ts +11 -0
- package/dist/kit/builder/auth/types/middleware.d.ts.map +1 -0
- package/dist/kit/builder/auth/types/permissions.d.ts +17 -0
- package/dist/kit/builder/auth/types/permissions.d.ts.map +1 -0
- package/dist/kit/builder/auth/types/state.d.ts +13 -0
- package/dist/kit/builder/auth/types/state.d.ts.map +1 -0
- package/dist/kit/builder/auth/types/storage.d.ts +20 -0
- package/dist/kit/builder/auth/types/storage.d.ts.map +1 -0
- package/dist/kit/builder/auth/types/token-manager.d.ts +7 -0
- package/dist/kit/builder/auth/types/token-manager.d.ts.map +1 -0
- package/dist/kit/builder/auth/types/utils.d.ts +7 -0
- package/dist/kit/builder/auth/types/utils.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/auth-adapter.d.ts +14 -0
- package/dist/kit/builder/auth/utils/auth-adapter.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/client-adapters/apollo-link.d.ts +4 -0
- package/dist/kit/builder/auth/utils/client-adapters/apollo-link.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/client-adapters/axios.d.ts +6 -0
- package/dist/kit/builder/auth/utils/client-adapters/axios.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/client-adapters/fetch.d.ts +6 -0
- package/dist/kit/builder/auth/utils/client-adapters/fetch.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/client-adapters/graphql.d.ts +9 -0
- package/dist/kit/builder/auth/utils/client-adapters/graphql.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/client-adapters/index.d.ts +7 -0
- package/dist/kit/builder/auth/utils/client-adapters/index.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/client-adapters/rest.d.ts +9 -0
- package/dist/kit/builder/auth/utils/client-adapters/rest.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/client-adapters/urql-exchange.d.ts +14 -0
- package/dist/kit/builder/auth/utils/client-adapters/urql-exchange.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/permission-checker.d.ts +31 -0
- package/dist/kit/builder/auth/utils/permission-checker.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/storage/browser.d.ts +11 -0
- package/dist/kit/builder/auth/utils/storage/browser.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/storage/cookie.d.ts +3 -0
- package/dist/kit/builder/auth/utils/storage/cookie.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/storage/encryption.d.ts +7 -0
- package/dist/kit/builder/auth/utils/storage/encryption.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/storage/env.d.ts +2 -0
- package/dist/kit/builder/auth/utils/storage/env.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/storage/factory.d.ts +6 -0
- package/dist/kit/builder/auth/utils/storage/factory.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/storage/index.d.ts +7 -0
- package/dist/kit/builder/auth/utils/storage/index.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/storage/memory.d.ts +3 -0
- package/dist/kit/builder/auth/utils/storage/memory.d.ts.map +1 -0
- package/dist/kit/builder/auth/utils/token-manager.d.ts +9 -0
- package/dist/kit/builder/auth/utils/token-manager.d.ts.map +1 -0
- 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 +1 -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 +2 -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/kit/themes/base.css +1 -1
- package/dist/kit/themes/clean-slate.css +5 -5
- package/dist/kit/themes/default.css +5 -5
- package/dist/kit/themes/minimal-modern.css +5 -5
- package/dist/kit/themes/spotify.css +5 -5
- 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 +2 -1
- package/src/kit/builder/auth/components/Can.tsx +27 -0
- package/src/kit/builder/auth/components/RequireAuth.tsx +78 -0
- package/src/kit/builder/auth/components/ShowWhenAuthenticated.tsx +10 -0
- package/src/kit/builder/auth/components/ShowWhenError.tsx +10 -0
- package/src/kit/builder/auth/components/ShowWhenLoading.tsx +10 -0
- package/src/kit/builder/auth/components/ShowWhenUnauthenticated.tsx +10 -0
- package/src/kit/builder/auth/components/withPermission.tsx +23 -0
- package/src/kit/builder/auth/hooks/action-hooks.ts +34 -0
- package/src/kit/builder/auth/hooks/core-hooks.ts +65 -0
- package/src/kit/builder/auth/hooks/index.ts +4 -0
- package/src/kit/builder/auth/hooks/permission-hooks.ts +43 -0
- package/src/kit/builder/auth/hooks/token-hooks.ts +25 -0
- package/src/kit/builder/auth/index.ts +132 -0
- package/src/kit/builder/auth/providers/AuthProvider.tsx +131 -0
- package/src/kit/builder/auth/types/adapter-config.ts +44 -0
- package/src/kit/builder/auth/types/adapter.ts +132 -0
- package/src/kit/builder/auth/types/core.ts +27 -0
- package/src/kit/builder/auth/types/index.ts +9 -0
- package/src/kit/builder/auth/types/middleware.ts +20 -0
- package/src/kit/builder/auth/types/permissions.ts +23 -0
- package/src/kit/builder/auth/types/state.ts +16 -0
- package/src/kit/builder/auth/types/storage.ts +21 -0
- package/src/kit/builder/auth/types/token-manager.ts +9 -0
- package/src/kit/builder/auth/types/utils.ts +55 -0
- package/src/kit/builder/auth/utils/auth-adapter.ts +437 -0
- package/src/kit/builder/auth/utils/client-adapters/apollo-link.ts +30 -0
- package/src/kit/builder/auth/utils/client-adapters/axios.ts +61 -0
- package/src/kit/builder/auth/utils/client-adapters/fetch.ts +48 -0
- package/src/kit/builder/auth/utils/client-adapters/graphql.ts +60 -0
- package/src/kit/builder/auth/utils/client-adapters/index.ts +6 -0
- package/src/kit/builder/auth/utils/client-adapters/rest.ts +60 -0
- package/src/kit/builder/auth/utils/client-adapters/urql-exchange.ts +76 -0
- package/src/kit/builder/auth/utils/permission-checker.ts +150 -0
- package/src/kit/builder/auth/utils/storage/browser.ts +99 -0
- package/src/kit/builder/auth/utils/storage/cookie.ts +116 -0
- package/src/kit/builder/auth/utils/storage/encryption.ts +80 -0
- package/src/kit/builder/auth/utils/storage/env.ts +2 -0
- package/src/kit/builder/auth/utils/storage/factory.ts +37 -0
- package/src/kit/builder/auth/utils/storage/index.ts +6 -0
- package/src/kit/builder/auth/utils/storage/memory.ts +15 -0
- package/src/kit/builder/auth/utils/token-manager.ts +55 -0
- package/src/kit/builder/data-table/components/DataTable.tsx +214 -82
- package/src/kit/builder/data-table/components/DataTableColumnHeader.tsx +9 -5
- package/src/kit/builder/data-table/components/DataTablePagination.tsx +19 -5
- 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 +22 -11
- 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 +74 -38
- 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/storybook-static/assets/Accordion.stories-KU4JBR8U.js +52 -0
- package/storybook-static/assets/AdminLayout-CPvVCwfY.js +53 -0
- package/storybook-static/assets/AdminLayout.Basic.stories-DkP2UVXe.js +4 -0
- package/storybook-static/assets/AdminLayout.Collapsible.stories-BuuVjtpW.js +4 -0
- package/storybook-static/assets/AdminLayout.Complex.stories-D-k4H0hJ.js +29 -0
- package/storybook-static/assets/AdminLayout.CustomSidebarHeaderComponent.stories-B_0IEDd4.js +9 -0
- package/storybook-static/assets/AdminLayout.CustomSidebarTitleAndIcon.stories-CvAeXUyA.js +4 -0
- package/storybook-static/assets/AdminLayout.HeaderSlots.stories-RBFHoSZK.js +7 -0
- package/storybook-static/assets/Alert.stories-DKxKtIc0.js +27 -0
- package/storybook-static/assets/AlertDialog.stories-BqTpZ_nG.js +43 -0
- package/storybook-static/assets/AspectRatio.stories-DPO9QQ5F.js +22 -0
- package/storybook-static/assets/Autocomplete-Cpg4CaJe.js +56 -0
- package/storybook-static/assets/Autocomplete.stories-CWj4G5fh.js +56 -0
- package/storybook-static/assets/Avatar.stories-DPhov_2g.js +12 -0
- package/storybook-static/assets/Badge.stories-DFKrRdXq.js +12 -0
- package/storybook-static/assets/Breadcrumb.stories-CTE6CZUC.js +25 -0
- package/storybook-static/assets/Button.stories-cbt2InL-.js +26 -0
- package/storybook-static/assets/Calendar.stories-DRhTw_43.js +3 -0
- package/storybook-static/assets/Card.stories-Isf6n_K3.js +15 -0
- package/storybook-static/assets/Carousel.stories-Cmg0I3fR.js +15 -0
- package/storybook-static/assets/Chart.stories-aQ-fNijT.js +126 -0
- package/storybook-static/assets/Checkbox.stories-B7YMXPDc.js +12 -0
- package/storybook-static/assets/Collapsible.stories-BUzl17ZZ.js +18 -0
- package/storybook-static/assets/Combination-BdQWAuko.js +41 -0
- package/storybook-static/assets/Command.stories-DzBlWQs0.js +30 -0
- package/storybook-static/assets/ContextMenu.stories-CJlBQyXc.js +31 -0
- package/storybook-static/assets/DataTable.Basic.stories-BWYKFDmK.js +6 -0
- package/storybook-static/assets/DataTable.Filters.stories-uZdtJk8t.js +21 -0
- package/storybook-static/assets/DataTable.Pagination.stories-C5N1khkp.js +24 -0
- package/storybook-static/assets/DataTable.SelectionAndActions.stories-FhCqZKvO.js +26 -0
- package/storybook-static/assets/DataTable.Sorting.stories-D-k7EtRj.js +6 -0
- package/storybook-static/assets/Dialog.stories-C62AF-Gx.js +54 -0
- package/storybook-static/assets/Dialog.stories-lrjRwOus.js +18 -0
- package/storybook-static/assets/Drawer.stories-CGjkdJeV.js +24 -0
- package/storybook-static/assets/DropdownMenu.stories-DkGClRAA.js +35 -0
- package/storybook-static/assets/Form.ArrayLayouts.stories-C5d_062d.js +130 -0
- package/storybook-static/assets/Form.Autocomplete.stories-CPZPkk4o.js +142 -0
- package/storybook-static/assets/Form.Basic.stories-Bhcu3-3n.js +58 -0
- package/storybook-static/assets/Form.Complex.stories-QnXh5a7Q.js +361 -0
- package/storybook-static/assets/Form.Dynamic.stories-DFW6wIuT.js +502 -0
- package/storybook-static/assets/Form.Simple.stories-BhJcyhbE.js +53 -0
- package/storybook-static/assets/Form.stories-PFNsMYxO.js +3 -0
- package/storybook-static/assets/FormBuilder-BQBBxo_k.js +5 -0
- package/storybook-static/assets/HoverCard.stories-CAlQEVn8.js +21 -0
- package/storybook-static/assets/Input.stories-CEhODt0V.js +16 -0
- package/storybook-static/assets/InputOtp.stories-DSvNP4dS.js +42 -0
- package/storybook-static/assets/Label.stories-B3pa8ZLY.js +14 -0
- package/storybook-static/assets/Login.stories-C7KQkmR_.js +37 -0
- package/storybook-static/assets/Menubar.stories-CHXhSHxc.js +44 -0
- package/storybook-static/assets/MonthPicker.stories-BnrOc4fm.js +99 -0
- package/storybook-static/assets/MonthRangePicker.stories-55Gk1t-7.js +134 -0
- package/storybook-static/assets/NavigationMenu.stories-CXoS080P.js +30 -0
- package/storybook-static/assets/Page.stories-GdSJgZ6-.js +91 -0
- package/storybook-static/assets/Pagination.stories-BEBwqH4N.js +29 -0
- package/storybook-static/assets/Popover.stories-BICy98Cw.js +15 -0
- package/storybook-static/assets/Progress.stories-DECHNOME.js +8 -0
- package/storybook-static/assets/RadioGroup.stories-DA7-uKfV.js +16 -0
- package/storybook-static/assets/Resizable.stories-B99kWkH7.js +25 -0
- package/storybook-static/assets/ScrollArea.stories-BqvUAXqU.js +12 -0
- package/storybook-static/assets/Section.stories-lFMlFBQn.js +277 -0
- package/storybook-static/assets/SectionBuilder-BQW705x0.js +1 -0
- package/storybook-static/assets/Select.stories-BsKyZ6Io.js +17 -0
- package/storybook-static/assets/Separator.stories-BTDOaOM2.js +17 -0
- package/storybook-static/assets/Sheet.stories-Cam1gR6G.js +24 -0
- package/storybook-static/assets/Sidebar.stories-DnOa6G7y.js +106 -0
- package/storybook-static/assets/Skeleton.stories-BQNIuIe5.js +9 -0
- package/storybook-static/assets/Slider.stories-Bslq7hjq.js +6 -0
- package/storybook-static/assets/Sonner.stories-D34pBBtI.js +18 -0
- package/storybook-static/assets/Switch.stories-Puyb1-Bx.js +3 -0
- package/storybook-static/assets/Table.stories-ClZxAhut.js +35 -0
- package/storybook-static/assets/Tabs.stories-CURNTETB.js +10 -0
- package/storybook-static/assets/Textarea.stories-Cf1ZBrWw.js +17 -0
- package/storybook-static/assets/Toggle.stories-CdMHY_bi.js +3 -0
- package/storybook-static/assets/ToggleGroup.stories-BM68m1dX.js +13 -0
- package/storybook-static/assets/Tooltip.stories-DiQv64dM.js +10 -0
- package/storybook-static/assets/accordion-DVgwQcnw.js +1 -0
- package/storybook-static/assets/alert-dialog-DCUEwpqm.js +7 -0
- package/storybook-static/assets/avatar-BzwOE-mi.js +1 -0
- package/storybook-static/assets/axe-HmUsR1st.js +30 -0
- package/storybook-static/assets/badge-BnQWua6u.js +1 -0
- package/storybook-static/assets/button-0oMkiryo.js +1 -0
- package/storybook-static/assets/card-BJpPOzP8.js +1 -0
- package/storybook-static/assets/chart-column-DZGb4ZZS.js +6 -0
- package/storybook-static/assets/check-B9hBGj6o.js +6 -0
- package/storybook-static/assets/checkbox-CyIeaWHX.js +1 -0
- package/storybook-static/assets/chevron-down-D_37S6il.js +6 -0
- package/storybook-static/assets/chevron-left-BBoN0vbI.js +6 -0
- package/storybook-static/assets/chevron-right-B5vIMLxK.js +6 -0
- package/storybook-static/assets/circle-C5Lzx6Nx.js +6 -0
- package/storybook-static/assets/clean-slate-D1HmMFJM.css +1 -0
- package/storybook-static/assets/command-Csa9p8_a.js +6 -0
- package/storybook-static/assets/createLucideIcon-BrHXro7t.js +21 -0
- package/storybook-static/assets/default-CN_Fo1GY.css +1 -0
- package/storybook-static/assets/dependencies-ctrV69dx.js +1 -0
- package/storybook-static/assets/dialog-CsnqITTn.js +1 -0
- package/storybook-static/assets/dropdown-menu-BWxxwPHL.js +1 -0
- package/storybook-static/assets/ellipsis-BRS038RR.js +6 -0
- package/storybook-static/assets/grip-vertical-BxXG8KNA.js +6 -0
- package/storybook-static/assets/iframe-C9bogcIc.css +1 -0
- package/storybook-static/assets/iframe-v7iAhKit.js +1555 -0
- package/storybook-static/assets/index-0-qMRXou.js +1 -0
- package/storybook-static/assets/index-AvwFFKJc.js +1 -0
- package/storybook-static/assets/index-BVDb4dFc.js +1 -0
- package/storybook-static/assets/index-B_qx7A5T.js +1 -0
- package/storybook-static/assets/index-BdQq_4o_.js +1 -0
- package/storybook-static/assets/index-BfiCOk42.js +1 -0
- package/storybook-static/assets/index-Bv9yk470.js +1 -0
- package/storybook-static/assets/index-Bw1A27Kp.js +1 -0
- package/storybook-static/assets/index-ByqivBWx.js +1 -0
- package/storybook-static/assets/index-C9Ta0ZTH.js +1 -0
- package/storybook-static/assets/index-CDY5kTx5.js +1 -0
- package/storybook-static/assets/index-CGnyVRgB.js +1 -0
- package/storybook-static/assets/index-CGrAONsN.js +1 -0
- package/storybook-static/assets/index-CWjrGFAQ.js +1 -0
- package/storybook-static/assets/index-CwBdPBFz.js +9 -0
- package/storybook-static/assets/index-D8RXF03I.js +1 -0
- package/storybook-static/assets/index-DLIxT4Z7.js +1 -0
- package/storybook-static/assets/index-DW48STyt.js +1 -0
- package/storybook-static/assets/index-DbaA6-o1.js +1 -0
- package/storybook-static/assets/index-Dph_5COR.js +1 -0
- package/storybook-static/assets/index-DrN5n71E.js +1 -0
- package/storybook-static/assets/index-Tp9IdbR8.js +1 -0
- package/storybook-static/assets/index-WyF3-wTE.js +9 -0
- package/storybook-static/assets/index-XSmPROEP.js +1 -0
- package/storybook-static/assets/index-Z6wF44KX.js +5 -0
- package/storybook-static/assets/index-_RPqOjlQ.js +1 -0
- package/storybook-static/assets/index-jrimW4QO.js +1 -0
- package/storybook-static/assets/index-nqc17SX4.js +1 -0
- package/storybook-static/assets/input-11YRd9gD.js +1 -0
- package/storybook-static/assets/jsx-runtime-D_zvdyIk.js +9 -0
- package/storybook-static/assets/label-Do8ODIVk.js +1 -0
- package/storybook-static/assets/lodash-DDwpuhPG.js +73 -0
- package/storybook-static/assets/matchers-7Z3WT2CE-T3xScrR7.js +14 -0
- package/storybook-static/assets/minimal-modern-BlYVzfQU.css +1 -0
- package/storybook-static/assets/popover-CcciSWAw.js +1 -0
- package/storybook-static/assets/preload-helper-Dp1pzeXC.js +1 -0
- package/storybook-static/assets/radio-group-DiJ0Y_KQ.js +1 -0
- package/storybook-static/assets/react-18-Cr9fq_Ip.js +25 -0
- package/storybook-static/assets/react-icons.esm-B_ULMmNU.js +1 -0
- package/storybook-static/assets/refresh-cw-BmRDhIV_.js +6 -0
- package/storybook-static/assets/schemas-CGNYCiJ6.js +18 -0
- package/storybook-static/assets/section-factories-DCCY9R35.js +1 -0
- package/storybook-static/assets/select-DDrkxaOg.js +6 -0
- package/storybook-static/assets/separator-o5SAUnaJ.js +1 -0
- package/storybook-static/assets/settings-2-xWGvvbG6.js +6 -0
- package/storybook-static/assets/sheet-C7jhU3XE.js +1 -0
- package/storybook-static/assets/shopping-cart-BFlrufvo.js +11 -0
- package/storybook-static/assets/sidebar-C8hU1Mxy.js +6 -0
- package/storybook-static/assets/skeleton-CjDnQs43.js +1 -0
- package/storybook-static/assets/spotify-CUDj7g8m.css +1 -0
- package/storybook-static/assets/switch-CKGRuk3u.js +1 -0
- package/storybook-static/assets/table-CP3vMqFn.js +1 -0
- package/storybook-static/assets/tabs-CopK2m3j.js +1 -0
- package/storybook-static/assets/textarea-Dw2vruMl.js +1 -0
- package/storybook-static/assets/toggle-DmHbWetf.js +16 -0
- package/storybook-static/assets/tooltip-_LqYEYFw.js +1 -0
- package/storybook-static/assets/trash-2-xdbApPby.js +11 -0
- package/storybook-static/assets/utils-D-KgF5mV.js +1 -0
- package/storybook-static/assets/x-B1a4fyWM.js +6 -0
- package/storybook-static/favicon-wrapper.svg +46 -0
- package/storybook-static/favicon.svg +1 -0
- package/storybook-static/iframe.html +687 -0
- package/storybook-static/index.d.ts +64 -0
- package/storybook-static/index.d.ts.map +1 -0
- package/storybook-static/index.html +166 -0
- package/storybook-static/index.json +1 -0
- package/storybook-static/kit/builder/data-table/components/DataTable.d.ts +37 -0
- package/storybook-static/kit/builder/data-table/components/DataTable.d.ts.map +1 -0
- package/storybook-static/kit/builder/data-table/components/DataTableColumnHeader.d.ts +8 -0
- package/storybook-static/kit/builder/data-table/components/DataTableColumnHeader.d.ts.map +1 -0
- package/storybook-static/kit/builder/data-table/components/DataTablePagination.d.ts +6 -0
- package/storybook-static/kit/builder/data-table/components/DataTablePagination.d.ts.map +1 -0
- package/storybook-static/kit/builder/data-table/components/DataTableViewOptions.d.ts +5 -0
- package/storybook-static/kit/builder/data-table/components/DataTableViewOptions.d.ts.map +1 -0
- package/storybook-static/kit/builder/data-table/index.d.ts +7 -0
- package/storybook-static/kit/builder/data-table/index.d.ts.map +1 -0
- package/storybook-static/kit/builder/data-table/types.d.ts +27 -0
- package/storybook-static/kit/builder/data-table/types.d.ts.map +1 -0
- package/storybook-static/kit/builder/data-table/utils/dotAccessor.d.ts +2 -0
- package/storybook-static/kit/builder/data-table/utils/dotAccessor.d.ts.map +1 -0
- package/storybook-static/kit/builder/dialog/index.d.ts +3 -0
- package/storybook-static/kit/builder/dialog/index.d.ts.map +1 -0
- package/storybook-static/kit/builder/dialog/provider.d.ts +26 -0
- package/storybook-static/kit/builder/dialog/provider.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/FormBuilder.d.ts +137 -0
- package/storybook-static/kit/builder/form/components/FormBuilder.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/FormBuilderActions.d.ts +20 -0
- package/storybook-static/kit/builder/form/components/FormBuilderActions.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/FormBuilderField.d.ts +12 -0
- package/storybook-static/kit/builder/form/components/FormBuilderField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/ArrayField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/ArrayField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/AutocompleteField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/AutocompleteField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/CheckboxField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/CheckboxField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/DateField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/DateField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/FileField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/FileField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/NumberField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/NumberField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/ObjectField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/ObjectField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/RadioField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/RadioField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/SelectField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/SelectField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/SwitchField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/SwitchField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/TextField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/TextField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/TextareaField.d.ts +3 -0
- package/storybook-static/kit/builder/form/components/fields/TextareaField.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/index.d.ts +14 -0
- package/storybook-static/kit/builder/form/components/fields/index.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/fields/types.d.ts +14 -0
- package/storybook-static/kit/builder/form/components/fields/types.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/components/index.d.ts +4 -0
- package/storybook-static/kit/builder/form/components/index.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/index.d.ts +3 -0
- package/storybook-static/kit/builder/form/index.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/utils/common-forms.d.ts +7 -0
- package/storybook-static/kit/builder/form/utils/common-forms.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/utils/dependencies.d.ts +41 -0
- package/storybook-static/kit/builder/form/utils/dependencies.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/utils/field-factories.d.ts +23 -0
- package/storybook-static/kit/builder/form/utils/field-factories.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/utils/index.d.ts +15 -0
- package/storybook-static/kit/builder/form/utils/index.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/utils/section-factories.d.ts +7 -0
- package/storybook-static/kit/builder/form/utils/section-factories.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/utils/transformers.d.ts +6 -0
- package/storybook-static/kit/builder/form/utils/transformers.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/utils/validations.d.ts +13 -0
- package/storybook-static/kit/builder/form/utils/validations.d.ts.map +1 -0
- package/storybook-static/kit/builder/form/utils/validators.d.ts +8 -0
- package/storybook-static/kit/builder/form/utils/validators.d.ts.map +1 -0
- package/storybook-static/kit/builder/page/Page.d.ts +48 -0
- package/storybook-static/kit/builder/page/Page.d.ts.map +1 -0
- package/storybook-static/kit/builder/page/index.d.ts +2 -0
- package/storybook-static/kit/builder/page/index.d.ts.map +1 -0
- package/storybook-static/kit/builder/section/SectionBuilder.d.ts +3 -0
- package/storybook-static/kit/builder/section/SectionBuilder.d.ts.map +1 -0
- package/storybook-static/kit/builder/section/index.d.ts +3 -0
- package/storybook-static/kit/builder/section/index.d.ts.map +1 -0
- package/storybook-static/kit/builder/section/types.d.ts +70 -0
- package/storybook-static/kit/builder/section/types.d.ts.map +1 -0
- package/storybook-static/kit/builder/stack-dialog/context.d.ts +3 -0
- package/storybook-static/kit/builder/stack-dialog/context.d.ts.map +1 -0
- package/storybook-static/kit/builder/stack-dialog/hooks.d.ts +6 -0
- package/storybook-static/kit/builder/stack-dialog/hooks.d.ts.map +1 -0
- package/storybook-static/kit/builder/stack-dialog/index.d.ts +5 -0
- package/storybook-static/kit/builder/stack-dialog/index.d.ts.map +1 -0
- package/storybook-static/kit/builder/stack-dialog/provider.d.ts +3 -0
- package/storybook-static/kit/builder/stack-dialog/provider.d.ts.map +1 -0
- package/storybook-static/kit/builder/stack-dialog/renderer.d.ts +6 -0
- package/storybook-static/kit/builder/stack-dialog/renderer.d.ts.map +1 -0
- package/storybook-static/kit/builder/stack-dialog/types.d.ts +20 -0
- package/storybook-static/kit/builder/stack-dialog/types.d.ts.map +1 -0
- package/storybook-static/kit/components/autocomplete/Autocomplete.d.ts +53 -0
- package/storybook-static/kit/components/autocomplete/Autocomplete.d.ts.map +1 -0
- package/storybook-static/kit/components/autocomplete/index.d.ts +4 -0
- package/storybook-static/kit/components/autocomplete/index.d.ts.map +1 -0
- package/storybook-static/kit/components/autocomplete/types.d.ts +19 -0
- package/storybook-static/kit/components/autocomplete/types.d.ts.map +1 -0
- package/storybook-static/kit/components/login/Login.d.ts +29 -0
- package/storybook-static/kit/components/login/Login.d.ts.map +1 -0
- package/storybook-static/kit/components/login/index.d.ts +2 -0
- package/storybook-static/kit/components/login/index.d.ts.map +1 -0
- package/storybook-static/kit/components/monthpicker/MonthPicker.d.ts +32 -0
- package/storybook-static/kit/components/monthpicker/MonthPicker.d.ts.map +1 -0
- package/storybook-static/kit/components/monthpicker/MonthRangePicker.d.ts +48 -0
- package/storybook-static/kit/components/monthpicker/MonthRangePicker.d.ts.map +1 -0
- package/storybook-static/kit/layouts/admin/components/AdminLayout.d.ts +17 -0
- package/storybook-static/kit/layouts/admin/components/AdminLayout.d.ts.map +1 -0
- package/storybook-static/kit/layouts/admin/components/ThemeToggle.d.ts +5 -0
- package/storybook-static/kit/layouts/admin/components/ThemeToggle.d.ts.map +1 -0
- package/storybook-static/kit/layouts/admin/hooks/menu.d.ts +13 -0
- package/storybook-static/kit/layouts/admin/hooks/menu.d.ts.map +1 -0
- package/storybook-static/kit/layouts/admin/providers/AdminMenuProvider.d.ts +7 -0
- package/storybook-static/kit/layouts/admin/providers/AdminMenuProvider.d.ts.map +1 -0
- package/storybook-static/kit/layouts/admin/types/index.d.ts +27 -0
- package/storybook-static/kit/layouts/admin/types/index.d.ts.map +1 -0
- package/storybook-static/kit/providers/ThemeProvider.d.ts +14 -0
- package/storybook-static/kit/providers/ThemeProvider.d.ts.map +1 -0
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +1 -0
- package/storybook-static/sb-addons/a11y-5/manager-bundle.js +5 -0
- package/storybook-static/sb-addons/essentials-backgrounds-1/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-measure-2/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-outline-3/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/interactions-4/manager-bundle.js +57 -0
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +971 -0
- package/storybook-static/sb-addons/storysource-6/manager-bundle.js +3 -0
- package/storybook-static/sb-common-assets/favicon-wrapper.svg +46 -0
- package/storybook-static/sb-common-assets/favicon.svg +1 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +797 -0
- package/storybook-static/sb-manager/globals-runtime.js +69653 -0
- package/storybook-static/sb-manager/globals.js +34 -0
- package/storybook-static/sb-manager/runtime.js +13181 -0
- package/storybook-static/shadcn/hooks/use-mobile.d.ts +2 -0
- package/storybook-static/shadcn/hooks/use-mobile.d.ts.map +1 -0
- package/storybook-static/shadcn/lib/utils.d.ts +3 -0
- package/storybook-static/shadcn/lib/utils.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/accordion.d.ts +8 -0
- package/storybook-static/shadcn/ui/accordion.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/alert-dialog.d.ts +15 -0
- package/storybook-static/shadcn/ui/alert-dialog.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/alert.d.ts +10 -0
- package/storybook-static/shadcn/ui/alert.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/aspect-ratio.d.ts +4 -0
- package/storybook-static/shadcn/ui/aspect-ratio.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/avatar.d.ts +7 -0
- package/storybook-static/shadcn/ui/avatar.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/badge.d.ts +10 -0
- package/storybook-static/shadcn/ui/badge.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/breadcrumb.d.ts +12 -0
- package/storybook-static/shadcn/ui/breadcrumb.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/button.d.ts +11 -0
- package/storybook-static/shadcn/ui/button.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/calendar.d.ts +9 -0
- package/storybook-static/shadcn/ui/calendar.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/card.d.ts +10 -0
- package/storybook-static/shadcn/ui/card.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/carousel.d.ts +20 -0
- package/storybook-static/shadcn/ui/carousel.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/chart.d.ts +41 -0
- package/storybook-static/shadcn/ui/chart.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/checkbox.d.ts +5 -0
- package/storybook-static/shadcn/ui/checkbox.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/collapsible.d.ts +6 -0
- package/storybook-static/shadcn/ui/collapsible.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/command.d.ts +19 -0
- package/storybook-static/shadcn/ui/command.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/context-menu.d.ts +26 -0
- package/storybook-static/shadcn/ui/context-menu.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/dialog.d.ts +16 -0
- package/storybook-static/shadcn/ui/dialog.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/drawer.d.ts +14 -0
- package/storybook-static/shadcn/ui/drawer.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/dropdown-menu.d.ts +26 -0
- package/storybook-static/shadcn/ui/dropdown-menu.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/form.d.ts +25 -0
- package/storybook-static/shadcn/ui/form.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/hover-card.d.ts +7 -0
- package/storybook-static/shadcn/ui/hover-card.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/input-otp.d.ts +12 -0
- package/storybook-static/shadcn/ui/input-otp.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/input.d.ts +4 -0
- package/storybook-static/shadcn/ui/input.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/label.d.ts +5 -0
- package/storybook-static/shadcn/ui/label.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/menubar.d.ts +27 -0
- package/storybook-static/shadcn/ui/menubar.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/navigation-menu.d.ts +15 -0
- package/storybook-static/shadcn/ui/navigation-menu.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/pagination.d.ts +14 -0
- package/storybook-static/shadcn/ui/pagination.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/popover.d.ts +8 -0
- package/storybook-static/shadcn/ui/popover.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/progress.d.ts +5 -0
- package/storybook-static/shadcn/ui/progress.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/radio-group.d.ts +6 -0
- package/storybook-static/shadcn/ui/radio-group.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/resizable.d.ts +9 -0
- package/storybook-static/shadcn/ui/resizable.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/scroll-area.d.ts +6 -0
- package/storybook-static/shadcn/ui/scroll-area.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/select.d.ts +16 -0
- package/storybook-static/shadcn/ui/select.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/separator.d.ts +5 -0
- package/storybook-static/shadcn/ui/separator.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/sheet.d.ts +14 -0
- package/storybook-static/shadcn/ui/sheet.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/sidebar.d.ts +70 -0
- package/storybook-static/shadcn/ui/sidebar.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/skeleton.d.ts +3 -0
- package/storybook-static/shadcn/ui/skeleton.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/slider.d.ts +5 -0
- package/storybook-static/shadcn/ui/slider.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/sonner.d.ts +4 -0
- package/storybook-static/shadcn/ui/sonner.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/switch.d.ts +5 -0
- package/storybook-static/shadcn/ui/switch.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/table.d.ts +11 -0
- package/storybook-static/shadcn/ui/table.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/tabs.d.ts +8 -0
- package/storybook-static/shadcn/ui/tabs.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/textarea.d.ts +4 -0
- package/storybook-static/shadcn/ui/textarea.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/toggle-group.d.ts +8 -0
- package/storybook-static/shadcn/ui/toggle-group.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/toggle.d.ts +10 -0
- package/storybook-static/shadcn/ui/toggle.d.ts.map +1 -0
- package/storybook-static/shadcn/ui/tooltip.d.ts +8 -0
- package/storybook-static/shadcn/ui/tooltip.d.ts.map +1 -0
- package/storybook-static/vite-inject-mocker-entry.js +18 -0
- package/tsconfig.json +1 -5
- package/tsconfig.tsbuildinfo +1 -0
- package/eslint.config.mjs +0 -19
|
@@ -1,561 +1,643 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from
|
|
2
|
-
import { useCombobox } from
|
|
3
|
-
import { useDebounce } from
|
|
4
|
-
import { cn } from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { useCombobox } from 'downshift';
|
|
3
|
+
import { useDebounce } from 'use-debounce';
|
|
4
|
+
import { cn } from '../../../shadcn/lib/utils';
|
|
5
|
+
import {
|
|
6
|
+
Popover,
|
|
7
|
+
PopoverContent,
|
|
8
|
+
PopoverTrigger,
|
|
9
|
+
} from '../../../shadcn/ui/popover';
|
|
10
|
+
import { Badge } from '../../../shadcn/ui/badge';
|
|
11
|
+
import { ChevronsUpDown, X, Check, Loader2 } from 'lucide-react';
|
|
8
12
|
import type {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from
|
|
13
|
+
AutocompleteFetcher,
|
|
14
|
+
AutocompleteMode,
|
|
15
|
+
AutocompleteOption,
|
|
16
|
+
AutocompleteFetchResult,
|
|
17
|
+
} from './types';
|
|
14
18
|
|
|
15
19
|
export type AutocompleteProps<T = unknown> = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
mode: AutocompleteMode;
|
|
21
|
+
options?: AutocompleteOption<T>[];
|
|
22
|
+
fetcher?: AutocompleteFetcher<T>;
|
|
23
|
+
fetcherFilter?: () => Record<string, string | number | boolean | null>;
|
|
24
|
+
pageSize?: number;
|
|
25
|
+
value?: string | number | null | Array<string | number>;
|
|
26
|
+
onChange?: (
|
|
27
|
+
value: string | number | null | Array<string | number>,
|
|
28
|
+
selected: AutocompleteOption<T> | AutocompleteOption<T>[] | null,
|
|
29
|
+
raw?: T | T[] | null,
|
|
30
|
+
) => void;
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
className?: string;
|
|
35
|
+
chipVariant?: 'default' | 'secondary' | 'destructive' | 'outline';
|
|
36
|
+
chipClassName?: string;
|
|
37
|
+
emptyText?: string;
|
|
38
|
+
renderOption?: (
|
|
39
|
+
option: AutocompleteOption<T>,
|
|
40
|
+
selected: boolean,
|
|
41
|
+
) => React.ReactNode;
|
|
42
|
+
defaultOpen?: boolean;
|
|
43
|
+
defaultValue?: string | number | null | Array<string | number>;
|
|
44
|
+
allowCustomValue?: boolean;
|
|
45
|
+
clearable?: boolean;
|
|
46
|
+
initialSelectedOptions?: AutocompleteOption<T> | AutocompleteOption<T>[];
|
|
47
|
+
loadSelected?: (
|
|
48
|
+
values: Array<string | number>,
|
|
49
|
+
) => Promise<AutocompleteOption<T>[]>;
|
|
41
50
|
};
|
|
42
51
|
|
|
43
52
|
const DEFAULT_PAGE_SIZE = 50;
|
|
44
53
|
|
|
45
54
|
export function Autocomplete<T = unknown>({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
mode = 'client',
|
|
56
|
+
options = [],
|
|
57
|
+
fetcher,
|
|
58
|
+
fetcherFilter,
|
|
59
|
+
pageSize = DEFAULT_PAGE_SIZE,
|
|
60
|
+
value: controlledValue,
|
|
61
|
+
onChange,
|
|
62
|
+
placeholder = 'Search or select...',
|
|
63
|
+
disabled = false,
|
|
64
|
+
multiple = false,
|
|
65
|
+
className,
|
|
66
|
+
chipVariant = 'secondary',
|
|
67
|
+
chipClassName,
|
|
68
|
+
emptyText = 'No results found',
|
|
69
|
+
renderOption,
|
|
70
|
+
defaultOpen,
|
|
71
|
+
defaultValue,
|
|
72
|
+
allowCustomValue = false,
|
|
73
|
+
clearable = true,
|
|
74
|
+
initialSelectedOptions,
|
|
75
|
+
loadSelected,
|
|
67
76
|
}: AutocompleteProps<T>) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
77
|
+
const isMultiple = !!multiple;
|
|
78
|
+
const isControlled = controlledValue !== undefined;
|
|
79
|
+
|
|
80
|
+
// Internal value state
|
|
81
|
+
const [internalValue, setInternalValue] = useState<
|
|
82
|
+
string | number | null | Array<string | number>
|
|
83
|
+
>(() => {
|
|
84
|
+
if (defaultValue !== undefined) return defaultValue;
|
|
85
|
+
return isMultiple ? [] : null;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const currentValue = isControlled ? controlledValue : internalValue;
|
|
89
|
+
|
|
90
|
+
// Label and raw data maps
|
|
91
|
+
const labelMapRef = useRef<Map<string | number, string>>(new Map());
|
|
92
|
+
const rawMapRef = useRef<Map<string | number, T>>(new Map());
|
|
93
|
+
|
|
94
|
+
const storeOption = useCallback((opt: AutocompleteOption<T>) => {
|
|
95
|
+
labelMapRef.current.set(opt.value, opt.label);
|
|
96
|
+
if (opt.raw !== undefined) {
|
|
97
|
+
rawMapRef.current.set(opt.value, opt.raw);
|
|
98
|
+
}
|
|
99
|
+
}, []);
|
|
100
|
+
|
|
101
|
+
// Immediately populate labels for initial values (runs once on mount)
|
|
102
|
+
if (labelMapRef.current.size === 0 && currentValue) {
|
|
103
|
+
const values = Array.isArray(currentValue) ? currentValue : [currentValue];
|
|
104
|
+
// First, store initialSelectedOptions if provided
|
|
105
|
+
if (initialSelectedOptions) {
|
|
106
|
+
const arr = Array.isArray(initialSelectedOptions)
|
|
107
|
+
? initialSelectedOptions
|
|
108
|
+
: [initialSelectedOptions];
|
|
109
|
+
arr.forEach((opt) => {
|
|
110
|
+
labelMapRef.current.set(opt.value, opt.label);
|
|
111
|
+
if (opt.raw !== undefined) {
|
|
112
|
+
rawMapRef.current.set(opt.value, opt.raw);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// Then look up missing values in options array
|
|
117
|
+
values.forEach((val) => {
|
|
118
|
+
if (!labelMapRef.current.has(val)) {
|
|
119
|
+
const option = options.find((opt) => opt.value === val);
|
|
120
|
+
if (option) {
|
|
121
|
+
labelMapRef.current.set(option.value, option.label);
|
|
122
|
+
if (option.raw !== undefined) {
|
|
123
|
+
rawMapRef.current.set(option.value, option.raw);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Data state
|
|
131
|
+
const [items, setItems] = useState<AutocompleteOption<T>[]>([]);
|
|
132
|
+
const [loading, setLoading] = useState(false);
|
|
133
|
+
const [hasMore, setHasMore] = useState(false);
|
|
134
|
+
const [page, setPage] = useState(1);
|
|
135
|
+
const [searchInput, setSearchInput] = useState('');
|
|
136
|
+
const [debouncedSearch] = useDebounce(searchInput, 300);
|
|
137
|
+
const [clearCounter, setClearCounter] = useState(0);
|
|
138
|
+
|
|
139
|
+
// Popover state
|
|
140
|
+
const [isOpen, setIsOpen] = useState(!!defaultOpen);
|
|
141
|
+
|
|
142
|
+
// Clear input in multiple mode after selection
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (clearCounter > 0) {
|
|
145
|
+
setSearchInput('');
|
|
146
|
+
}
|
|
147
|
+
}, [clearCounter]);
|
|
148
|
+
|
|
149
|
+
// Load data
|
|
150
|
+
const loadData = useCallback(
|
|
151
|
+
async (pageNum: number, search: string) => {
|
|
152
|
+
if (mode === 'server') {
|
|
153
|
+
if (!fetcher) return;
|
|
154
|
+
setLoading(true);
|
|
155
|
+
try {
|
|
156
|
+
const res: AutocompleteFetchResult<T> = await fetcher({
|
|
157
|
+
search,
|
|
158
|
+
moreFilter: fetcherFilter,
|
|
159
|
+
cursor: null,
|
|
160
|
+
page: pageNum,
|
|
161
|
+
pageSize,
|
|
162
|
+
});
|
|
163
|
+
res.items.forEach(storeOption);
|
|
164
|
+
setItems((prev) =>
|
|
165
|
+
pageNum === 1 ? res.items : [...prev, ...res.items],
|
|
166
|
+
);
|
|
167
|
+
setHasMore(!!res.hasMore);
|
|
168
|
+
} catch (_error) {
|
|
169
|
+
if (pageNum === 1) setItems([]);
|
|
170
|
+
setHasMore(false);
|
|
171
|
+
} finally {
|
|
172
|
+
setLoading(false);
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
// Client mode
|
|
176
|
+
const filtered = search
|
|
177
|
+
? options.filter((o) =>
|
|
178
|
+
o.label.toLowerCase().includes(search.toLowerCase()),
|
|
179
|
+
)
|
|
180
|
+
: options;
|
|
181
|
+
options.forEach(storeOption);
|
|
182
|
+
const start = (pageNum - 1) * pageSize;
|
|
183
|
+
const slice = filtered.slice(start, start + pageSize);
|
|
184
|
+
setItems((prev) => (pageNum === 1 ? slice : [...prev, ...slice]));
|
|
185
|
+
setHasMore(start + pageSize < filtered.length);
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
[mode, fetcher, fetcherFilter, options, pageSize, storeOption],
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
// Reset and load on search change
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
if (!isOpen) return;
|
|
194
|
+
setPage(1);
|
|
195
|
+
loadData(1, debouncedSearch);
|
|
196
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
197
|
+
}, [isOpen, debouncedSearch, loadData]);
|
|
198
|
+
|
|
199
|
+
// Load more pages
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
if (!isOpen || page <= 1) return;
|
|
202
|
+
loadData(page, debouncedSearch);
|
|
203
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
204
|
+
}, [isOpen, page, loadData, debouncedSearch]);
|
|
205
|
+
|
|
206
|
+
// Store initial/selected options (takes precedence)
|
|
207
|
+
useEffect(() => {
|
|
208
|
+
if (initialSelectedOptions) {
|
|
209
|
+
const arr = Array.isArray(initialSelectedOptions)
|
|
210
|
+
? initialSelectedOptions
|
|
211
|
+
: [initialSelectedOptions];
|
|
212
|
+
arr.forEach(storeOption);
|
|
213
|
+
}
|
|
214
|
+
}, [initialSelectedOptions, storeOption]);
|
|
215
|
+
|
|
216
|
+
// Auto-populate missing initial options from provided options array
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
if (
|
|
219
|
+
!currentValue ||
|
|
220
|
+
(Array.isArray(currentValue) && currentValue.length === 0)
|
|
221
|
+
)
|
|
222
|
+
return;
|
|
223
|
+
|
|
224
|
+
const values = Array.isArray(currentValue) ? currentValue : [currentValue];
|
|
225
|
+
|
|
226
|
+
// Only look up values that are missing (not in label map)
|
|
227
|
+
const missingValues = values.filter((v) => !labelMapRef.current.has(v));
|
|
228
|
+
|
|
229
|
+
if (missingValues.length === 0) return;
|
|
230
|
+
|
|
231
|
+
// Look up missing values in the options array
|
|
232
|
+
missingValues.forEach((val) => {
|
|
233
|
+
const option = options.find((opt) => opt.value === val);
|
|
234
|
+
if (option) {
|
|
235
|
+
storeOption(option);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}, [currentValue, options, storeOption]);
|
|
239
|
+
|
|
240
|
+
// Load selected labels on mount for initial values
|
|
241
|
+
const hasLoadedInitial = useRef(false);
|
|
242
|
+
const [, setLabelsLoadedCounter] = useState(0);
|
|
243
|
+
|
|
244
|
+
useEffect(() => {
|
|
245
|
+
// Only run once on mount
|
|
246
|
+
if (!loadSelected || hasLoadedInitial.current) return;
|
|
247
|
+
if (!currentValue) return;
|
|
248
|
+
|
|
249
|
+
const values = Array.isArray(currentValue) ? currentValue : [currentValue];
|
|
250
|
+
if (values.length === 0) return;
|
|
251
|
+
|
|
252
|
+
// Check if any values are missing labels
|
|
253
|
+
const missing = values.filter((v) => !labelMapRef.current.has(v));
|
|
254
|
+
if (missing.length === 0) {
|
|
255
|
+
hasLoadedInitial.current = true;
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
hasLoadedInitial.current = true;
|
|
260
|
+
let cancelled = false;
|
|
261
|
+
loadSelected(missing)
|
|
262
|
+
.then((opts) => {
|
|
263
|
+
if (!cancelled && opts.length > 0) {
|
|
264
|
+
opts.forEach(storeOption);
|
|
265
|
+
// Only trigger re-render if we actually stored something
|
|
266
|
+
setLabelsLoadedCounter((c) => c + 1);
|
|
267
|
+
}
|
|
268
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
269
|
+
})
|
|
270
|
+
.catch(() => {});
|
|
271
|
+
return () => {
|
|
272
|
+
cancelled = true;
|
|
273
|
+
};
|
|
274
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
275
|
+
}, [loadSelected, storeOption, currentValue]); // Only run once on mount - uses closure values
|
|
276
|
+
|
|
277
|
+
// Load selected labels if missing when dropdown opens
|
|
278
|
+
useEffect(() => {
|
|
279
|
+
if (!loadSelected || !isOpen) return;
|
|
280
|
+
const values = Array.isArray(currentValue)
|
|
281
|
+
? currentValue
|
|
282
|
+
: currentValue
|
|
283
|
+
? [currentValue]
|
|
284
|
+
: [];
|
|
285
|
+
const missing = values.filter((v) => !labelMapRef.current.has(v));
|
|
286
|
+
if (missing.length === 0) return;
|
|
287
|
+
|
|
288
|
+
let cancelled = false;
|
|
289
|
+
loadSelected(missing)
|
|
290
|
+
.then((opts) => {
|
|
291
|
+
if (!cancelled) opts.forEach(storeOption);
|
|
292
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
293
|
+
})
|
|
294
|
+
.catch(() => {});
|
|
295
|
+
return () => {
|
|
296
|
+
cancelled = true;
|
|
297
|
+
};
|
|
298
|
+
}, [currentValue, loadSelected, isOpen, storeOption]);
|
|
299
|
+
|
|
300
|
+
// Get label helper
|
|
301
|
+
const getLabel = useCallback((v: string | number) => {
|
|
302
|
+
return labelMapRef.current.get(v) ?? String(v);
|
|
303
|
+
}, []);
|
|
304
|
+
|
|
305
|
+
// Selected items for display
|
|
306
|
+
const selectedItems = useMemo(() => {
|
|
307
|
+
if (!isMultiple) {
|
|
308
|
+
if (
|
|
309
|
+
currentValue === null ||
|
|
310
|
+
currentValue === undefined ||
|
|
311
|
+
Array.isArray(currentValue)
|
|
312
|
+
)
|
|
313
|
+
return [];
|
|
314
|
+
return [
|
|
315
|
+
{
|
|
316
|
+
value: currentValue,
|
|
317
|
+
label: getLabel(currentValue),
|
|
318
|
+
raw: rawMapRef.current.get(currentValue),
|
|
319
|
+
},
|
|
320
|
+
];
|
|
321
|
+
}
|
|
322
|
+
const values = Array.isArray(currentValue) ? currentValue : [];
|
|
323
|
+
return values.map((v) => ({
|
|
324
|
+
value: v,
|
|
325
|
+
label: getLabel(v),
|
|
326
|
+
raw: rawMapRef.current.get(v),
|
|
327
|
+
}));
|
|
328
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
329
|
+
}, [currentValue, isMultiple, getLabel]); // labelsLoadedCounter triggers re-compute when loadSelected completes
|
|
330
|
+
|
|
331
|
+
// Handle selection
|
|
332
|
+
const handleSelect = useCallback(
|
|
333
|
+
(item: AutocompleteOption<T> | null) => {
|
|
334
|
+
if (!item) return;
|
|
335
|
+
storeOption(item);
|
|
336
|
+
|
|
337
|
+
if (isMultiple) {
|
|
338
|
+
const values = Array.isArray(currentValue) ? currentValue : [];
|
|
339
|
+
const exists = values.includes(item.value);
|
|
340
|
+
|
|
341
|
+
// Skip if already selected (don't toggle), but still clear the search
|
|
342
|
+
if (exists) {
|
|
343
|
+
setClearCounter((c) => c + 1);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const newValues = [...values, item.value];
|
|
348
|
+
|
|
349
|
+
if (!isControlled) setInternalValue(newValues);
|
|
350
|
+
const newOptions = newValues.map((v) => ({
|
|
351
|
+
value: v,
|
|
352
|
+
label: getLabel(v),
|
|
353
|
+
raw: rawMapRef.current.get(v),
|
|
354
|
+
}));
|
|
355
|
+
const raws = newOptions
|
|
356
|
+
.map((o) => o.raw)
|
|
357
|
+
.filter((r): r is T => r !== undefined);
|
|
358
|
+
onChange?.(newValues, newOptions, raws);
|
|
359
|
+
|
|
360
|
+
// Trigger input clear
|
|
361
|
+
setClearCounter((c) => c + 1);
|
|
362
|
+
} else {
|
|
363
|
+
if (!isControlled) setInternalValue(item.value);
|
|
364
|
+
onChange?.(item.value, item, item.raw ?? null);
|
|
365
|
+
setIsOpen(false);
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
[isMultiple, currentValue, isControlled, onChange, getLabel, storeOption],
|
|
369
|
+
);
|
|
370
|
+
|
|
371
|
+
// Handle remove chip
|
|
372
|
+
const handleRemove = useCallback(
|
|
373
|
+
(valueToRemove: string | number) => {
|
|
374
|
+
const values = Array.isArray(currentValue) ? currentValue : [];
|
|
375
|
+
const newValues = values.filter((v) => v !== valueToRemove);
|
|
376
|
+
if (!isControlled) setInternalValue(newValues);
|
|
377
|
+
const newOptions = newValues.map((v) => ({
|
|
378
|
+
value: v,
|
|
379
|
+
label: getLabel(v),
|
|
380
|
+
raw: rawMapRef.current.get(v),
|
|
381
|
+
}));
|
|
382
|
+
const raws = newOptions
|
|
383
|
+
.map((o) => o.raw)
|
|
384
|
+
.filter((r): r is T => r !== undefined);
|
|
385
|
+
onChange?.(newValues, newOptions, raws);
|
|
386
|
+
},
|
|
387
|
+
[currentValue, isControlled, onChange, getLabel],
|
|
388
|
+
);
|
|
389
|
+
|
|
390
|
+
// Handle clear
|
|
391
|
+
const handleClear = useCallback(() => {
|
|
392
|
+
const newValue = isMultiple ? [] : null;
|
|
393
|
+
if (!isControlled) setInternalValue(newValue);
|
|
394
|
+
onChange?.(newValue, isMultiple ? [] : null, isMultiple ? [] : null);
|
|
395
|
+
}, [isMultiple, isControlled, onChange]);
|
|
396
|
+
|
|
397
|
+
// Handle custom value creation
|
|
398
|
+
const handleCreateCustom = useCallback(() => {
|
|
399
|
+
const trimmed = searchInput.trim();
|
|
400
|
+
if (!trimmed || !allowCustomValue) return;
|
|
401
|
+
|
|
402
|
+
const newOption: AutocompleteOption<T> = { value: trimmed, label: trimmed };
|
|
403
|
+
storeOption(newOption);
|
|
404
|
+
|
|
405
|
+
if (isMultiple) {
|
|
406
|
+
const values = Array.isArray(currentValue) ? currentValue : [];
|
|
407
|
+
if (values.includes(trimmed)) return;
|
|
408
|
+
const newValues = [...values, trimmed];
|
|
409
|
+
if (!isControlled) setInternalValue(newValues);
|
|
410
|
+
const newOptions = newValues.map((v) => ({
|
|
411
|
+
value: v,
|
|
412
|
+
label: getLabel(v),
|
|
413
|
+
raw: rawMapRef.current.get(v),
|
|
414
|
+
}));
|
|
415
|
+
onChange?.(newValues, newOptions, []);
|
|
416
|
+
setSearchInput('');
|
|
417
|
+
} else {
|
|
418
|
+
if (!isControlled) setInternalValue(trimmed);
|
|
419
|
+
onChange?.(trimmed, newOption, null);
|
|
420
|
+
setSearchInput('');
|
|
421
|
+
setIsOpen(false);
|
|
422
|
+
}
|
|
423
|
+
}, [
|
|
424
|
+
searchInput,
|
|
425
|
+
allowCustomValue,
|
|
426
|
+
isMultiple,
|
|
427
|
+
currentValue,
|
|
428
|
+
isControlled,
|
|
429
|
+
onChange,
|
|
430
|
+
getLabel,
|
|
431
|
+
storeOption,
|
|
432
|
+
]);
|
|
433
|
+
|
|
434
|
+
// Compute input value based on mode and state
|
|
435
|
+
const computedInputValue = useMemo(() => {
|
|
436
|
+
// In multiple mode or when dropdown is open, show search input
|
|
437
|
+
if (isMultiple || isOpen) {
|
|
438
|
+
return searchInput;
|
|
439
|
+
}
|
|
440
|
+
// In single mode when closed, show selected item label
|
|
441
|
+
if (selectedItems.length > 0) {
|
|
442
|
+
return selectedItems[0].label;
|
|
443
|
+
}
|
|
444
|
+
return '';
|
|
445
|
+
}, [isMultiple, isOpen, searchInput, selectedItems]);
|
|
446
|
+
|
|
447
|
+
// Downshift
|
|
448
|
+
const { getInputProps, getItemProps, getMenuProps, highlightedIndex } =
|
|
449
|
+
useCombobox({
|
|
450
|
+
items,
|
|
451
|
+
itemToString: (item) => item?.label ?? '',
|
|
452
|
+
selectedItem: isMultiple ? null : (selectedItems[0] ?? null),
|
|
453
|
+
onSelectedItemChange: ({ selectedItem }) => handleSelect(selectedItem),
|
|
454
|
+
isOpen,
|
|
455
|
+
onIsOpenChange: ({ isOpen: newIsOpen }) => setIsOpen(newIsOpen ?? false),
|
|
456
|
+
inputValue: computedInputValue,
|
|
457
|
+
onInputValueChange: ({ inputValue }) => setSearchInput(inputValue ?? ''),
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
// Refs
|
|
461
|
+
const parentRef = useRef<HTMLDivElement>(null);
|
|
462
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
463
|
+
|
|
464
|
+
// Stable ref callback for merging Downshift's ref with our parentRef
|
|
465
|
+
const menuRefCallback = useCallback((node: HTMLDivElement | null) => {
|
|
466
|
+
parentRef.current = node;
|
|
467
|
+
}, []);
|
|
468
|
+
|
|
469
|
+
const handleScroll = useCallback(() => {
|
|
470
|
+
if (!parentRef.current || !hasMore || loading) return;
|
|
471
|
+
|
|
472
|
+
const { scrollTop, scrollHeight, clientHeight } = parentRef.current;
|
|
473
|
+
const scrolledToBottom = scrollHeight - scrollTop - clientHeight < 50;
|
|
474
|
+
|
|
475
|
+
if (scrolledToBottom) {
|
|
476
|
+
setPage((p) => p + 1);
|
|
477
|
+
}
|
|
478
|
+
}, [hasMore, loading]);
|
|
479
|
+
|
|
480
|
+
useEffect(() => {
|
|
481
|
+
const element = parentRef.current;
|
|
482
|
+
if (!element) return;
|
|
483
|
+
|
|
484
|
+
element.addEventListener('scroll', handleScroll);
|
|
485
|
+
return () => element.removeEventListener('scroll', handleScroll);
|
|
486
|
+
}, [handleScroll]);
|
|
487
|
+
|
|
488
|
+
const showClearButton =
|
|
489
|
+
clearable &&
|
|
490
|
+
((isMultiple && selectedItems.length > 0) ||
|
|
491
|
+
(!isMultiple &&
|
|
492
|
+
currentValue !== null &&
|
|
493
|
+
currentValue !== undefined &&
|
|
494
|
+
!Array.isArray(currentValue)));
|
|
495
|
+
|
|
496
|
+
return (
|
|
497
|
+
<Popover open={isOpen} onOpenChange={setIsOpen}>
|
|
498
|
+
<PopoverTrigger asChild>
|
|
499
|
+
<div
|
|
500
|
+
className={cn(
|
|
501
|
+
'flex min-h-10 w-full items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm',
|
|
502
|
+
'ring-offset-background',
|
|
503
|
+
'focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2',
|
|
504
|
+
disabled && 'cursor-not-allowed opacity-50',
|
|
505
|
+
className,
|
|
506
|
+
)}
|
|
507
|
+
>
|
|
508
|
+
{isMultiple && (
|
|
509
|
+
<div className="flex flex-wrap gap-1">
|
|
510
|
+
{selectedItems.map((item) => (
|
|
511
|
+
<Badge
|
|
512
|
+
key={item.value}
|
|
513
|
+
variant={chipVariant}
|
|
514
|
+
className={cn('gap-1', chipClassName)}
|
|
515
|
+
>
|
|
516
|
+
<span className="max-w-[150px] truncate">{item.label}</span>
|
|
517
|
+
<button
|
|
518
|
+
type="button"
|
|
519
|
+
onClick={(e) => {
|
|
520
|
+
e.stopPropagation();
|
|
521
|
+
handleRemove(item.value);
|
|
522
|
+
}}
|
|
523
|
+
className="rounded-sm opacity-70 hover:opacity-100"
|
|
524
|
+
>
|
|
525
|
+
<X className="h-3 w-3" />
|
|
526
|
+
</button>
|
|
527
|
+
</Badge>
|
|
528
|
+
))}
|
|
529
|
+
</div>
|
|
530
|
+
)}
|
|
531
|
+
<input
|
|
532
|
+
{...getInputProps({
|
|
533
|
+
ref: inputRef,
|
|
534
|
+
placeholder,
|
|
535
|
+
disabled,
|
|
536
|
+
onClick: () => {
|
|
537
|
+
if (!isOpen) setIsOpen(true);
|
|
538
|
+
},
|
|
539
|
+
onKeyDown: (e) => {
|
|
540
|
+
if (
|
|
541
|
+
e.key === 'Enter' &&
|
|
542
|
+
allowCustomValue &&
|
|
543
|
+
searchInput.trim() &&
|
|
544
|
+
items.length === 0
|
|
545
|
+
) {
|
|
546
|
+
e.preventDefault();
|
|
547
|
+
handleCreateCustom();
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
})}
|
|
551
|
+
className="flex-1 bg-transparent outline-none placeholder:text-muted-foreground min-w-[120px]"
|
|
552
|
+
/>
|
|
553
|
+
<div className="flex items-center gap-2 shrink-0">
|
|
554
|
+
{showClearButton && (
|
|
555
|
+
<button
|
|
556
|
+
type="button"
|
|
557
|
+
onClick={(e) => {
|
|
558
|
+
e.stopPropagation();
|
|
559
|
+
handleClear();
|
|
560
|
+
}}
|
|
561
|
+
className="rounded-sm opacity-70 hover:opacity-100"
|
|
562
|
+
>
|
|
563
|
+
<X className="h-4 w-4" />
|
|
564
|
+
</button>
|
|
565
|
+
)}
|
|
566
|
+
<ChevronsUpDown className="h-4 w-4 opacity-50" />
|
|
567
|
+
</div>
|
|
568
|
+
</div>
|
|
569
|
+
</PopoverTrigger>
|
|
570
|
+
<PopoverContent
|
|
571
|
+
className="p-0"
|
|
572
|
+
style={{ width: 'var(--radix-popover-trigger-width)' }}
|
|
573
|
+
align="start"
|
|
574
|
+
onOpenAutoFocus={(e) => e.preventDefault()}
|
|
575
|
+
>
|
|
576
|
+
<div
|
|
577
|
+
{...getMenuProps({
|
|
578
|
+
ref: menuRefCallback,
|
|
579
|
+
})}
|
|
580
|
+
className="max-h-[300px] overflow-auto"
|
|
581
|
+
>
|
|
582
|
+
{loading && items.length === 0 ? (
|
|
583
|
+
<div className="flex items-center justify-center py-6">
|
|
584
|
+
<Loader2 className="h-4 w-4 animate-spin mr-2" />
|
|
585
|
+
<span className="text-sm text-muted-foreground">Loading...</span>
|
|
586
|
+
</div>
|
|
587
|
+
) : items.length === 0 ? (
|
|
588
|
+
<div className="py-6 text-center text-sm text-muted-foreground">
|
|
589
|
+
{allowCustomValue && searchInput.trim() ? (
|
|
590
|
+
<>Press Enter to add "{searchInput.trim()}"</>
|
|
591
|
+
) : (
|
|
592
|
+
emptyText
|
|
593
|
+
)}
|
|
594
|
+
</div>
|
|
595
|
+
) : (
|
|
596
|
+
items.map((item, index) => {
|
|
597
|
+
const isSelected = isMultiple
|
|
598
|
+
? Array.isArray(currentValue) &&
|
|
599
|
+
currentValue.includes(item.value)
|
|
600
|
+
: currentValue === item.value;
|
|
601
|
+
const isHighlighted = highlightedIndex === index;
|
|
602
|
+
|
|
603
|
+
return (
|
|
604
|
+
<div
|
|
605
|
+
key={item.value}
|
|
606
|
+
{...getItemProps({ item, index })}
|
|
607
|
+
className={cn(
|
|
608
|
+
'flex cursor-pointer items-center justify-between px-2 py-2 text-sm outline-none transition-colors',
|
|
609
|
+
isHighlighted && 'bg-accent text-accent-foreground',
|
|
610
|
+
isSelected && 'font-medium',
|
|
611
|
+
)}
|
|
612
|
+
>
|
|
613
|
+
<div className="flex-1 truncate">
|
|
614
|
+
{renderOption ? renderOption(item, isSelected) : item.label}
|
|
615
|
+
</div>
|
|
616
|
+
{isSelected && <Check className="h-4 w-4 shrink-0" />}
|
|
617
|
+
</div>
|
|
618
|
+
);
|
|
619
|
+
})
|
|
620
|
+
)}
|
|
621
|
+
{hasMore && items.length > 0 && (
|
|
622
|
+
<div className="flex items-center justify-center border-t py-2">
|
|
623
|
+
{loading ? (
|
|
624
|
+
<>
|
|
625
|
+
<Loader2 className="h-3 w-3 animate-spin mr-1" />
|
|
626
|
+
<span className="text-xs text-muted-foreground">
|
|
627
|
+
Loading more...
|
|
628
|
+
</span>
|
|
629
|
+
</>
|
|
630
|
+
) : (
|
|
631
|
+
<span className="text-xs text-muted-foreground">
|
|
632
|
+
Scroll for more
|
|
633
|
+
</span>
|
|
634
|
+
)}
|
|
635
|
+
</div>
|
|
636
|
+
)}
|
|
637
|
+
</div>
|
|
638
|
+
</PopoverContent>
|
|
639
|
+
</Popover>
|
|
640
|
+
);
|
|
559
641
|
}
|
|
560
642
|
|
|
561
643
|
export default Autocomplete;
|