@k3-tech/react-kit 0.0.72 → 0.0.73
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/dist/index.js +1 -1
- package/package.json +5 -1
- package/.babelrc +0 -12
- package/.storybook/main.ts +0 -22
- package/.storybook/preview.ts +0 -198
- package/Dockerfile.storybook +0 -43
- package/biome.json +0 -10
- package/components.json +0 -20
- package/dist/chunks/index.js +0 -5168
- package/dist/chunks/ort.bundle.min.js +0 -4
- package/dist/chunks/ort.webgpu.bundle.min.js +0 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/kit/builder/auth/components/Can.d.ts.map +0 -1
- package/dist/kit/builder/auth/components/RequireAuth.d.ts.map +0 -1
- package/dist/kit/builder/auth/components/ShowWhenAuthenticated.d.ts.map +0 -1
- package/dist/kit/builder/auth/components/ShowWhenError.d.ts.map +0 -1
- package/dist/kit/builder/auth/components/ShowWhenLoading.d.ts.map +0 -1
- package/dist/kit/builder/auth/components/ShowWhenUnauthenticated.d.ts.map +0 -1
- package/dist/kit/builder/auth/components/withPermission.d.ts.map +0 -1
- package/dist/kit/builder/auth/hooks/action-hooks.d.ts.map +0 -1
- package/dist/kit/builder/auth/hooks/core-hooks.d.ts.map +0 -1
- package/dist/kit/builder/auth/hooks/index.d.ts.map +0 -1
- package/dist/kit/builder/auth/hooks/permission-hooks.d.ts.map +0 -1
- package/dist/kit/builder/auth/hooks/token-hooks.d.ts.map +0 -1
- package/dist/kit/builder/auth/index.d.ts.map +0 -1
- package/dist/kit/builder/auth/providers/AuthProvider.d.ts.map +0 -1
- package/dist/kit/builder/auth/types/adapter-config.d.ts.map +0 -1
- package/dist/kit/builder/auth/types/adapter.d.ts.map +0 -1
- package/dist/kit/builder/auth/types/core.d.ts.map +0 -1
- package/dist/kit/builder/auth/types/index.d.ts.map +0 -1
- package/dist/kit/builder/auth/types/middleware.d.ts.map +0 -1
- package/dist/kit/builder/auth/types/permissions.d.ts.map +0 -1
- package/dist/kit/builder/auth/types/state.d.ts.map +0 -1
- package/dist/kit/builder/auth/types/storage.d.ts.map +0 -1
- package/dist/kit/builder/auth/types/token-manager.d.ts.map +0 -1
- package/dist/kit/builder/auth/types/utils.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/auth-adapter.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/client-adapters/apollo-link.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/client-adapters/axios.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/client-adapters/fetch.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/client-adapters/graphql.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/client-adapters/index.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/client-adapters/rest.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/client-adapters/urql-exchange.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/permission-checker.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/storage/browser.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/storage/cookie.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/storage/encryption.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/storage/env.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/storage/factory.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/storage/index.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/storage/memory.d.ts.map +0 -1
- package/dist/kit/builder/auth/utils/token-manager.d.ts.map +0 -1
- package/dist/kit/builder/data-table/components/DataTable.d.ts.map +0 -1
- package/dist/kit/builder/data-table/components/DataTableColumnHeader.d.ts.map +0 -1
- package/dist/kit/builder/data-table/components/DataTableFilterPanel.d.ts.map +0 -1
- package/dist/kit/builder/data-table/components/DataTablePagination.d.ts.map +0 -1
- package/dist/kit/builder/data-table/components/DataTableViewOptions.d.ts.map +0 -1
- package/dist/kit/builder/data-table/index.d.ts.map +0 -1
- package/dist/kit/builder/data-table/types.d.ts.map +0 -1
- package/dist/kit/builder/data-table/utils/dotAccessor.d.ts.map +0 -1
- package/dist/kit/builder/dialog/index.d.ts.map +0 -1
- package/dist/kit/builder/dialog/provider.d.ts.map +0 -1
- package/dist/kit/builder/form/components/FormBuilder.d.ts.map +0 -1
- package/dist/kit/builder/form/components/FormBuilderActions.d.ts.map +0 -1
- package/dist/kit/builder/form/components/FormBuilderContext.d.ts.map +0 -1
- package/dist/kit/builder/form/components/FormBuilderField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/ArrayField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/AutocompleteField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/CheckboxField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/DateField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/DatePickerField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/DateRangePickerField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/DateTimePickerField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/DateTimeRangePickerField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/FileField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/MonthPickerField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/MonthRangePickerField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/NumberField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/ObjectField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/RadioField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/SelectField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/SwitchField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/TextField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/TextareaField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/TimePickerField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/TimeRangePickerField.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/index.d.ts.map +0 -1
- package/dist/kit/builder/form/components/fields/types.d.ts.map +0 -1
- package/dist/kit/builder/form/components/index.d.ts.map +0 -1
- package/dist/kit/builder/form/components/sectionNodes.d.ts.map +0 -1
- package/dist/kit/builder/form/hooks/useFormBuilder.d.ts.map +0 -1
- package/dist/kit/builder/form/index.d.ts.map +0 -1
- package/dist/kit/builder/form/types.d.ts.map +0 -1
- package/dist/kit/builder/form/utils/common-forms.d.ts.map +0 -1
- package/dist/kit/builder/form/utils/dependencies.d.ts.map +0 -1
- package/dist/kit/builder/form/utils/field-factories.d.ts.map +0 -1
- package/dist/kit/builder/form/utils/index.d.ts.map +0 -1
- package/dist/kit/builder/form/utils/section-factories.d.ts.map +0 -1
- package/dist/kit/builder/form/utils/transformers.d.ts.map +0 -1
- package/dist/kit/builder/form/utils/validations.d.ts.map +0 -1
- package/dist/kit/builder/form/utils/validators.d.ts.map +0 -1
- package/dist/kit/builder/page/Page.d.ts.map +0 -1
- package/dist/kit/builder/page/PageBackButton.d.ts.map +0 -1
- package/dist/kit/builder/page/index.d.ts.map +0 -1
- package/dist/kit/builder/section/SectionBuilder.d.ts.map +0 -1
- package/dist/kit/builder/section/SectionContainer.d.ts.map +0 -1
- package/dist/kit/builder/section/index.d.ts.map +0 -1
- package/dist/kit/builder/section/types.d.ts.map +0 -1
- package/dist/kit/builder/stack-dialog/context.d.ts.map +0 -1
- package/dist/kit/builder/stack-dialog/hooks.d.ts.map +0 -1
- package/dist/kit/builder/stack-dialog/index.d.ts.map +0 -1
- package/dist/kit/builder/stack-dialog/provider.d.ts.map +0 -1
- package/dist/kit/builder/stack-dialog/renderer.d.ts.map +0 -1
- package/dist/kit/builder/stack-dialog/types.d.ts.map +0 -1
- package/dist/kit/components/autocomplete/Autocomplete.d.ts.map +0 -1
- package/dist/kit/components/autocomplete/index.d.ts.map +0 -1
- package/dist/kit/components/autocomplete/types.d.ts.map +0 -1
- package/dist/kit/components/data-table-headers/DataTableHeader.d.ts.map +0 -1
- package/dist/kit/components/data-table-headers/DebouncedFilterField.d.ts.map +0 -1
- package/dist/kit/components/data-table-headers/FilterFieldRenderer.d.ts.map +0 -1
- package/dist/kit/components/data-table-headers/index.d.ts.map +0 -1
- package/dist/kit/components/data-table-headers/types.d.ts.map +0 -1
- package/dist/kit/components/data-table-headers/urlSerialization.d.ts.map +0 -1
- package/dist/kit/components/data-table-headers/useDataTableHeaderUrl.d.ts.map +0 -1
- package/dist/kit/components/datepicker/DatePicker.d.ts.map +0 -1
- package/dist/kit/components/datepicker/DateRangePicker.d.ts.map +0 -1
- package/dist/kit/components/datepicker/index.d.ts.map +0 -1
- package/dist/kit/components/datetimepicker/DateTimePicker.d.ts.map +0 -1
- package/dist/kit/components/datetimepicker/DateTimeRangePicker.d.ts.map +0 -1
- package/dist/kit/components/datetimepicker/index.d.ts.map +0 -1
- package/dist/kit/components/fileuploader/FileUploader.d.ts.map +0 -1
- package/dist/kit/components/fileuploader/image-preprocess.d.ts.map +0 -1
- package/dist/kit/components/fileuploader/index.d.ts.map +0 -1
- package/dist/kit/components/fileuploader/types.d.ts.map +0 -1
- package/dist/kit/components/forminfo/FormInfoError.d.ts.map +0 -1
- package/dist/kit/components/forminfo/index.d.ts.map +0 -1
- package/dist/kit/components/info-tooltip/InfoTooltip.d.ts.map +0 -1
- package/dist/kit/components/keyboard/Keyboard.d.ts.map +0 -1
- package/dist/kit/components/keyboard/index.d.ts.map +0 -1
- package/dist/kit/components/login/Login.d.ts.map +0 -1
- package/dist/kit/components/login/index.d.ts.map +0 -1
- package/dist/kit/components/monthpicker/MonthInput.d.ts.map +0 -1
- package/dist/kit/components/monthpicker/MonthPicker.d.ts.map +0 -1
- package/dist/kit/components/monthpicker/MonthRangeInput.d.ts.map +0 -1
- package/dist/kit/components/monthpicker/MonthRangePicker.d.ts.map +0 -1
- package/dist/kit/components/numpad/Numpad.d.ts.map +0 -1
- package/dist/kit/components/numpad/index.d.ts.map +0 -1
- package/dist/kit/components/timepicker/TimePicker.d.ts.map +0 -1
- package/dist/kit/components/timepicker/TimeRangePicker.d.ts.map +0 -1
- package/dist/kit/components/timepicker/index.d.ts.map +0 -1
- package/dist/kit/layouts/admin/components/AdminLayout.d.ts.map +0 -1
- package/dist/kit/layouts/admin/components/ThemeToggle.d.ts.map +0 -1
- package/dist/kit/layouts/admin/hooks/menu.d.ts.map +0 -1
- package/dist/kit/layouts/admin/providers/AdminMenuProvider.d.ts.map +0 -1
- package/dist/kit/layouts/admin/types/index.d.ts.map +0 -1
- package/dist/kit/providers/ThemeProvider.d.ts.map +0 -1
- package/dist/shadcn/hooks/use-mobile.d.ts.map +0 -1
- package/dist/shadcn/lib/utils.d.ts.map +0 -1
- package/dist/shadcn/ui/accordion.d.ts.map +0 -1
- package/dist/shadcn/ui/alert-dialog.d.ts.map +0 -1
- package/dist/shadcn/ui/alert.d.ts.map +0 -1
- package/dist/shadcn/ui/aspect-ratio.d.ts.map +0 -1
- package/dist/shadcn/ui/avatar.d.ts.map +0 -1
- package/dist/shadcn/ui/badge.d.ts.map +0 -1
- package/dist/shadcn/ui/breadcrumb.d.ts.map +0 -1
- package/dist/shadcn/ui/button.d.ts.map +0 -1
- package/dist/shadcn/ui/calendar.d.ts.map +0 -1
- package/dist/shadcn/ui/card.d.ts.map +0 -1
- package/dist/shadcn/ui/carousel.d.ts.map +0 -1
- package/dist/shadcn/ui/chart.d.ts.map +0 -1
- package/dist/shadcn/ui/checkbox.d.ts.map +0 -1
- package/dist/shadcn/ui/collapsible.d.ts.map +0 -1
- package/dist/shadcn/ui/command.d.ts.map +0 -1
- package/dist/shadcn/ui/context-menu.d.ts.map +0 -1
- package/dist/shadcn/ui/dialog.d.ts.map +0 -1
- package/dist/shadcn/ui/drawer.d.ts.map +0 -1
- package/dist/shadcn/ui/dropdown-menu.d.ts.map +0 -1
- package/dist/shadcn/ui/form.d.ts.map +0 -1
- package/dist/shadcn/ui/hover-card.d.ts.map +0 -1
- package/dist/shadcn/ui/input-otp.d.ts.map +0 -1
- package/dist/shadcn/ui/input.d.ts.map +0 -1
- package/dist/shadcn/ui/label.d.ts.map +0 -1
- package/dist/shadcn/ui/menubar.d.ts.map +0 -1
- package/dist/shadcn/ui/navigation-menu.d.ts.map +0 -1
- package/dist/shadcn/ui/pagination.d.ts.map +0 -1
- package/dist/shadcn/ui/popover.d.ts.map +0 -1
- package/dist/shadcn/ui/progress.d.ts.map +0 -1
- package/dist/shadcn/ui/radio-group.d.ts.map +0 -1
- package/dist/shadcn/ui/resizable.d.ts.map +0 -1
- package/dist/shadcn/ui/scroll-area.d.ts.map +0 -1
- package/dist/shadcn/ui/select.d.ts.map +0 -1
- package/dist/shadcn/ui/separator.d.ts.map +0 -1
- package/dist/shadcn/ui/sheet.d.ts.map +0 -1
- package/dist/shadcn/ui/sidebar.d.ts.map +0 -1
- package/dist/shadcn/ui/skeleton.d.ts.map +0 -1
- package/dist/shadcn/ui/slider.d.ts.map +0 -1
- package/dist/shadcn/ui/sonner.d.ts.map +0 -1
- package/dist/shadcn/ui/switch.d.ts.map +0 -1
- package/dist/shadcn/ui/table.d.ts.map +0 -1
- package/dist/shadcn/ui/tabs.d.ts.map +0 -1
- package/dist/shadcn/ui/textarea.d.ts.map +0 -1
- package/dist/shadcn/ui/toggle-group.d.ts.map +0 -1
- package/dist/shadcn/ui/toggle.d.ts.map +0 -1
- package/dist/shadcn/ui/tooltip.d.ts.map +0 -1
- package/src/index.ts +0 -100
- package/src/kit/builder/auth/components/Can.tsx +0 -27
- package/src/kit/builder/auth/components/RequireAuth.tsx +0 -78
- package/src/kit/builder/auth/components/ShowWhenAuthenticated.tsx +0 -10
- package/src/kit/builder/auth/components/ShowWhenError.tsx +0 -10
- package/src/kit/builder/auth/components/ShowWhenLoading.tsx +0 -10
- package/src/kit/builder/auth/components/ShowWhenUnauthenticated.tsx +0 -10
- package/src/kit/builder/auth/components/withPermission.tsx +0 -23
- package/src/kit/builder/auth/hooks/action-hooks.ts +0 -34
- package/src/kit/builder/auth/hooks/core-hooks.ts +0 -65
- package/src/kit/builder/auth/hooks/index.ts +0 -4
- package/src/kit/builder/auth/hooks/permission-hooks.ts +0 -43
- package/src/kit/builder/auth/hooks/token-hooks.ts +0 -25
- package/src/kit/builder/auth/index.ts +0 -132
- package/src/kit/builder/auth/providers/AuthProvider.tsx +0 -131
- package/src/kit/builder/auth/types/adapter-config.ts +0 -44
- package/src/kit/builder/auth/types/adapter.ts +0 -132
- package/src/kit/builder/auth/types/core.ts +0 -27
- package/src/kit/builder/auth/types/index.ts +0 -9
- package/src/kit/builder/auth/types/middleware.ts +0 -20
- package/src/kit/builder/auth/types/permissions.ts +0 -23
- package/src/kit/builder/auth/types/state.ts +0 -16
- package/src/kit/builder/auth/types/storage.ts +0 -21
- package/src/kit/builder/auth/types/token-manager.ts +0 -9
- package/src/kit/builder/auth/types/utils.ts +0 -55
- package/src/kit/builder/auth/utils/auth-adapter.ts +0 -437
- package/src/kit/builder/auth/utils/client-adapters/apollo-link.ts +0 -30
- package/src/kit/builder/auth/utils/client-adapters/axios.ts +0 -61
- package/src/kit/builder/auth/utils/client-adapters/fetch.ts +0 -48
- package/src/kit/builder/auth/utils/client-adapters/graphql.ts +0 -60
- package/src/kit/builder/auth/utils/client-adapters/index.ts +0 -6
- package/src/kit/builder/auth/utils/client-adapters/rest.ts +0 -60
- package/src/kit/builder/auth/utils/client-adapters/urql-exchange.ts +0 -76
- package/src/kit/builder/auth/utils/permission-checker.ts +0 -150
- package/src/kit/builder/auth/utils/storage/browser.ts +0 -99
- package/src/kit/builder/auth/utils/storage/cookie.ts +0 -116
- package/src/kit/builder/auth/utils/storage/encryption.ts +0 -80
- package/src/kit/builder/auth/utils/storage/env.ts +0 -2
- package/src/kit/builder/auth/utils/storage/factory.ts +0 -37
- package/src/kit/builder/auth/utils/storage/index.ts +0 -6
- package/src/kit/builder/auth/utils/storage/memory.ts +0 -15
- package/src/kit/builder/auth/utils/token-manager.ts +0 -55
- package/src/kit/builder/data-table/components/DataTable.tsx +0 -662
- package/src/kit/builder/data-table/components/DataTableColumnHeader.tsx +0 -67
- package/src/kit/builder/data-table/components/DataTableFilterPanel.tsx +0 -160
- package/src/kit/builder/data-table/components/DataTablePagination.tsx +0 -135
- package/src/kit/builder/data-table/components/DataTableViewOptions.tsx +0 -51
- package/src/kit/builder/data-table/index.ts +0 -6
- package/src/kit/builder/data-table/types.ts +0 -44
- package/src/kit/builder/data-table/utils/dotAccessor.ts +0 -6
- package/src/kit/builder/dialog/index.ts +0 -6
- package/src/kit/builder/dialog/provider.tsx +0 -170
- package/src/kit/builder/form/components/FormBuilder.tsx +0 -333
- package/src/kit/builder/form/components/FormBuilderActions.tsx +0 -78
- package/src/kit/builder/form/components/FormBuilderContext.tsx +0 -52
- package/src/kit/builder/form/components/FormBuilderField.tsx +0 -476
- package/src/kit/builder/form/components/fields/ArrayField.tsx +0 -312
- package/src/kit/builder/form/components/fields/AutocompleteField.tsx +0 -99
- package/src/kit/builder/form/components/fields/CheckboxField.tsx +0 -78
- package/src/kit/builder/form/components/fields/DateField.tsx +0 -55
- package/src/kit/builder/form/components/fields/DatePickerField.tsx +0 -48
- package/src/kit/builder/form/components/fields/DateRangePickerField.tsx +0 -72
- package/src/kit/builder/form/components/fields/DateTimePickerField.tsx +0 -55
- package/src/kit/builder/form/components/fields/DateTimeRangePickerField.tsx +0 -65
- package/src/kit/builder/form/components/fields/FileField.tsx +0 -38
- package/src/kit/builder/form/components/fields/MonthPickerField.tsx +0 -34
- package/src/kit/builder/form/components/fields/MonthRangePickerField.tsx +0 -42
- package/src/kit/builder/form/components/fields/NumberField.tsx +0 -88
- package/src/kit/builder/form/components/fields/ObjectField.tsx +0 -35
- package/src/kit/builder/form/components/fields/RadioField.tsx +0 -48
- package/src/kit/builder/form/components/fields/SelectField.tsx +0 -47
- package/src/kit/builder/form/components/fields/SwitchField.tsx +0 -76
- package/src/kit/builder/form/components/fields/TextField.tsx +0 -26
- package/src/kit/builder/form/components/fields/TextareaField.tsx +0 -21
- package/src/kit/builder/form/components/fields/TimePickerField.tsx +0 -36
- package/src/kit/builder/form/components/fields/TimeRangePickerField.tsx +0 -44
- package/src/kit/builder/form/components/fields/index.ts +0 -21
- package/src/kit/builder/form/components/fields/types.ts +0 -18
- package/src/kit/builder/form/components/index.ts +0 -3
- package/src/kit/builder/form/components/sectionNodes.tsx +0 -148
- package/src/kit/builder/form/hooks/useFormBuilder.ts +0 -457
- package/src/kit/builder/form/index.ts +0 -4
- package/src/kit/builder/form/types.ts +0 -294
- package/src/kit/builder/form/utils/common-forms.ts +0 -68
- package/src/kit/builder/form/utils/dependencies.ts +0 -56
- package/src/kit/builder/form/utils/field-factories.ts +0 -177
- package/src/kit/builder/form/utils/index.ts +0 -17
- package/src/kit/builder/form/utils/section-factories.ts +0 -38
- package/src/kit/builder/form/utils/transformers.ts +0 -100
- package/src/kit/builder/form/utils/validations.ts +0 -22
- package/src/kit/builder/form/utils/validators.ts +0 -20
- package/src/kit/builder/page/Page.tsx +0 -205
- package/src/kit/builder/page/PageBackButton.tsx +0 -52
- package/src/kit/builder/page/index.ts +0 -1
- package/src/kit/builder/section/SectionBuilder.tsx +0 -443
- package/src/kit/builder/section/SectionContainer.tsx +0 -85
- package/src/kit/builder/section/index.ts +0 -2
- package/src/kit/builder/section/types.ts +0 -83
- package/src/kit/builder/stack-dialog/context.ts +0 -15
- package/src/kit/builder/stack-dialog/hooks.ts +0 -13
- package/src/kit/builder/stack-dialog/index.ts +0 -12
- package/src/kit/builder/stack-dialog/provider.tsx +0 -51
- package/src/kit/builder/stack-dialog/renderer.tsx +0 -36
- package/src/kit/builder/stack-dialog/types.ts +0 -34
- package/src/kit/components/autocomplete/Autocomplete.tsx +0 -732
- package/src/kit/components/autocomplete/index.ts +0 -3
- package/src/kit/components/autocomplete/types.ts +0 -27
- package/src/kit/components/data-table-headers/DataTableHeader.tsx +0 -158
- package/src/kit/components/data-table-headers/DebouncedFilterField.tsx +0 -83
- package/src/kit/components/data-table-headers/FilterFieldRenderer.tsx +0 -194
- package/src/kit/components/data-table-headers/index.ts +0 -6
- package/src/kit/components/data-table-headers/types.ts +0 -89
- package/src/kit/components/data-table-headers/urlSerialization.ts +0 -173
- package/src/kit/components/data-table-headers/useDataTableHeaderUrl.ts +0 -107
- package/src/kit/components/datepicker/DatePicker.tsx +0 -173
- package/src/kit/components/datepicker/DateRangePicker.tsx +0 -526
- package/src/kit/components/datepicker/index.ts +0 -2
- package/src/kit/components/datetimepicker/DateTimePicker.tsx +0 -420
- package/src/kit/components/datetimepicker/DateTimeRangePicker.tsx +0 -676
- package/src/kit/components/datetimepicker/index.ts +0 -2
- package/src/kit/components/fileuploader/FileUploader.tsx +0 -880
- package/src/kit/components/fileuploader/image-preprocess.ts +0 -253
- package/src/kit/components/fileuploader/index.ts +0 -4
- package/src/kit/components/fileuploader/types.ts +0 -94
- package/src/kit/components/forminfo/FormInfoError.tsx +0 -135
- package/src/kit/components/forminfo/index.ts +0 -1
- package/src/kit/components/info-tooltip/InfoTooltip.tsx +0 -18
- package/src/kit/components/keyboard/Keyboard.tsx +0 -916
- package/src/kit/components/keyboard/index.ts +0 -4
- package/src/kit/components/login/Login.tsx +0 -141
- package/src/kit/components/login/index.ts +0 -1
- package/src/kit/components/monthpicker/MonthInput.tsx +0 -131
- package/src/kit/components/monthpicker/MonthPicker.tsx +0 -224
- package/src/kit/components/monthpicker/MonthRangeInput.tsx +0 -153
- package/src/kit/components/monthpicker/MonthRangePicker.tsx +0 -409
- package/src/kit/components/numpad/Numpad.tsx +0 -377
- package/src/kit/components/numpad/index.ts +0 -4
- package/src/kit/components/timepicker/TimePicker.tsx +0 -319
- package/src/kit/components/timepicker/TimeRangePicker.tsx +0 -368
- package/src/kit/components/timepicker/index.ts +0 -2
- package/src/kit/layouts/admin/components/AdminLayout.tsx +0 -419
- package/src/kit/layouts/admin/components/ThemeToggle.tsx +0 -54
- package/src/kit/layouts/admin/hooks/menu.ts +0 -32
- package/src/kit/layouts/admin/providers/AdminMenuProvider.tsx +0 -78
- package/src/kit/layouts/admin/types/index.ts +0 -26
- package/src/kit/providers/ThemeProvider.tsx +0 -90
- package/src/kit/themes/base.css +0 -11
- package/src/kit/themes/clean-slate.css +0 -155
- package/src/kit/themes/default.css +0 -197
- package/src/kit/themes/minimal-modern.css +0 -155
- package/src/kit/themes/spotify.css +0 -164
- package/src/shadcn/hooks/use-mobile.ts +0 -21
- package/src/shadcn/lib/utils.ts +0 -6
- package/src/shadcn/ui/accordion.tsx +0 -66
- package/src/shadcn/ui/alert-dialog.tsx +0 -157
- package/src/shadcn/ui/alert.tsx +0 -66
- package/src/shadcn/ui/aspect-ratio.tsx +0 -11
- package/src/shadcn/ui/avatar.tsx +0 -53
- package/src/shadcn/ui/badge.tsx +0 -46
- package/src/shadcn/ui/breadcrumb.tsx +0 -111
- package/src/shadcn/ui/button.tsx +0 -59
- package/src/shadcn/ui/calendar.tsx +0 -217
- package/src/shadcn/ui/card.tsx +0 -92
- package/src/shadcn/ui/carousel.tsx +0 -240
- package/src/shadcn/ui/chart.tsx +0 -353
- package/src/shadcn/ui/checkbox.tsx +0 -32
- package/src/shadcn/ui/collapsible.tsx +0 -33
- package/src/shadcn/ui/command.tsx +0 -184
- package/src/shadcn/ui/context-menu.tsx +0 -252
- package/src/shadcn/ui/dialog.tsx +0 -146
- package/src/shadcn/ui/drawer.tsx +0 -135
- package/src/shadcn/ui/dropdown-menu.tsx +0 -257
- package/src/shadcn/ui/form.tsx +0 -168
- package/src/shadcn/ui/hover-card.tsx +0 -44
- package/src/shadcn/ui/input-otp.tsx +0 -77
- package/src/shadcn/ui/input.tsx +0 -21
- package/src/shadcn/ui/label.tsx +0 -24
- package/src/shadcn/ui/menubar.tsx +0 -276
- package/src/shadcn/ui/navigation-menu.tsx +0 -168
- package/src/shadcn/ui/pagination.tsx +0 -128
- package/src/shadcn/ui/popover.tsx +0 -48
- package/src/shadcn/ui/progress.tsx +0 -31
- package/src/shadcn/ui/radio-group.tsx +0 -45
- package/src/shadcn/ui/resizable.tsx +0 -56
- package/src/shadcn/ui/scroll-area.tsx +0 -58
- package/src/shadcn/ui/select.tsx +0 -185
- package/src/shadcn/ui/separator.tsx +0 -28
- package/src/shadcn/ui/sheet.tsx +0 -139
- package/src/shadcn/ui/sidebar.tsx +0 -726
- package/src/shadcn/ui/skeleton.tsx +0 -13
- package/src/shadcn/ui/slider.tsx +0 -63
- package/src/shadcn/ui/sonner.tsx +0 -37
- package/src/shadcn/ui/switch.tsx +0 -31
- package/src/shadcn/ui/table.tsx +0 -134
- package/src/shadcn/ui/tabs.tsx +0 -66
- package/src/shadcn/ui/textarea.tsx +0 -18
- package/src/shadcn/ui/toggle-group.tsx +0 -73
- package/src/shadcn/ui/toggle.tsx +0 -47
- package/src/shadcn/ui/tooltip.tsx +0 -61
- package/src/stories/FileUploader.stories.tsx +0 -185
- package/src/stories/kit/builder/DataTable.Basic.stories.tsx +0 -71
- package/src/stories/kit/builder/DataTable.Filters.stories.tsx +0 -98
- package/src/stories/kit/builder/DataTable.Pagination.stories.tsx +0 -73
- package/src/stories/kit/builder/DataTable.SelectionAndActions.stories.tsx +0 -77
- package/src/stories/kit/builder/DataTable.Sorting.stories.tsx +0 -67
- package/src/stories/kit/builder/Dialog.stories.tsx +0 -90
- package/src/stories/kit/builder/Form.ArrayLayouts.stories.tsx +0 -177
- package/src/stories/kit/builder/Form.Autocomplete.stories.tsx +0 -220
- package/src/stories/kit/builder/Form.Basic.stories.tsx +0 -79
- package/src/stories/kit/builder/Form.Complex.stories.tsx +0 -569
- package/src/stories/kit/builder/Form.DateTime.stories.tsx +0 -70
- package/src/stories/kit/builder/Form.Dynamic.stories.tsx +0 -926
- package/src/stories/kit/builder/Form.Files.stories.tsx +0 -136
- package/src/stories/kit/builder/Form.MultipleFormBuilder.stories.tsx +0 -377
- package/src/stories/kit/builder/Form.Pickers.stories.tsx +0 -75
- package/src/stories/kit/builder/Form.Simple.stories.tsx +0 -91
- package/src/stories/kit/builder/Form.Time.stories.tsx +0 -68
- package/src/stories/kit/builder/Page.stories.tsx +0 -115
- package/src/stories/kit/builder/Section.stories.tsx +0 -282
- package/src/stories/kit/components/Autocomplete.stories.tsx +0 -313
- package/src/stories/kit/components/DatePicker.stories.tsx +0 -195
- package/src/stories/kit/components/DateRangePicker.stories.tsx +0 -195
- package/src/stories/kit/components/Keyboard.stories.tsx +0 -263
- package/src/stories/kit/components/Login.stories.tsx +0 -167
- package/src/stories/kit/components/MonthPicker.stories.tsx +0 -100
- package/src/stories/kit/components/MonthRangePicker.stories.tsx +0 -117
- package/src/stories/kit/components/Numpad.stories.tsx +0 -195
- package/src/stories/kit/components/TimePicker.stories.tsx +0 -71
- package/src/stories/kit/components/TimeRangePicker.stories.tsx +0 -43
- package/src/stories/kit/layouts/admin/AdminLayout.Basic.stories.tsx +0 -118
- package/src/stories/kit/layouts/admin/AdminLayout.Collapsible.stories.tsx +0 -81
- package/src/stories/kit/layouts/admin/AdminLayout.Complex.stories.tsx +0 -251
- package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarHeaderComponent.stories.tsx +0 -80
- package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarTitleAndIcon.stories.tsx +0 -70
- package/src/stories/kit/layouts/admin/AdminLayout.HeaderSlots.stories.tsx +0 -87
- package/src/stories/shadcn/ui/Accordion.stories.tsx +0 -117
- package/src/stories/shadcn/ui/Alert.stories.tsx +0 -36
- package/src/stories/shadcn/ui/AlertDialog.stories.tsx +0 -73
- package/src/stories/shadcn/ui/AspectRatio.stories.tsx +0 -58
- package/src/stories/shadcn/ui/Avatar.stories.tsx +0 -26
- package/src/stories/shadcn/ui/Badge.stories.tsx +0 -28
- package/src/stories/shadcn/ui/Breadcrumb.stories.tsx +0 -47
- package/src/stories/shadcn/ui/Button.stories.tsx +0 -51
- package/src/stories/shadcn/ui/Calendar.stories.tsx +0 -33
- package/src/stories/shadcn/ui/Card.stories.tsx +0 -39
- package/src/stories/shadcn/ui/Carousel.stories.tsx +0 -37
- package/src/stories/shadcn/ui/Chart.stories.tsx +0 -72
- package/src/stories/shadcn/ui/Checkbox.stories.tsx +0 -64
- package/src/stories/shadcn/ui/Collapsible.stories.tsx +0 -40
- package/src/stories/shadcn/ui/Command.stories.tsx +0 -53
- package/src/stories/shadcn/ui/ContextMenu.stories.tsx +0 -67
- package/src/stories/shadcn/ui/Dialog.stories.tsx +0 -45
- package/src/stories/shadcn/ui/Drawer.stories.tsx +0 -49
- package/src/stories/shadcn/ui/DropdownMenu.stories.tsx +0 -75
- package/src/stories/shadcn/ui/Form.stories.tsx +0 -93
- package/src/stories/shadcn/ui/HoverCard.stories.tsx +0 -43
- package/src/stories/shadcn/ui/Input.stories.tsx +0 -41
- package/src/stories/shadcn/ui/InputOtp.stories.tsx +0 -39
- package/src/stories/shadcn/ui/Label.stories.tsx +0 -29
- package/src/stories/shadcn/ui/Menubar.stories.tsx +0 -87
- package/src/stories/shadcn/ui/NavigationMenu.stories.tsx +0 -78
- package/src/stories/shadcn/ui/Pagination.stories.tsx +0 -51
- package/src/stories/shadcn/ui/Popover.stories.tsx +0 -53
- package/src/stories/shadcn/ui/Progress.stories.tsx +0 -30
- package/src/stories/shadcn/ui/RadioGroup.stories.tsx +0 -31
- package/src/stories/shadcn/ui/Resizable.stories.tsx +0 -55
- package/src/stories/shadcn/ui/ScrollArea.stories.tsx +0 -84
- package/src/stories/shadcn/ui/Select.stories.tsx +0 -61
- package/src/stories/shadcn/ui/Separator.stories.tsx +0 -35
- package/src/stories/shadcn/ui/Sheet.stories.tsx +0 -48
- package/src/stories/shadcn/ui/Sidebar.stories.tsx +0 -131
- package/src/stories/shadcn/ui/Skeleton.stories.tsx +0 -23
- package/src/stories/shadcn/ui/Slider.stories.tsx +0 -21
- package/src/stories/shadcn/ui/Sonner.stories.tsx +0 -49
- package/src/stories/shadcn/ui/Switch.stories.tsx +0 -28
- package/src/stories/shadcn/ui/Table.stories.tsx +0 -374
- package/src/stories/shadcn/ui/Tabs.stories.tsx +0 -31
- package/src/stories/shadcn/ui/Textarea.stories.tsx +0 -42
- package/src/stories/shadcn/ui/Toggle.stories.tsx +0 -44
- package/src/stories/shadcn/ui/ToggleGroup.stories.tsx +0 -28
- package/src/stories/shadcn/ui/Tooltip.stories.tsx +0 -30
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -52
- package/tsconfig.spec.json +0 -38
- package/tsconfig.tsbuildinfo +0 -1
- package/vite.config.ts +0 -93
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { Delete, ChevronLeft } from "lucide-react";
|
|
5
|
-
import { cn } from "../../../shadcn/lib/utils";
|
|
6
|
-
import { Button } from "../../../shadcn/ui/button";
|
|
7
|
-
|
|
8
|
-
// Constants
|
|
9
|
-
const NUMBER_BUTTON_BASE_CLASSES =
|
|
10
|
-
"rounded-xl border-2 border-teal-200 bg-white text-3xl font-semibold text-teal-600 hover:text-teal-900 transition-colors hover:bg-teal-50 h-auto";
|
|
11
|
-
const CLEAR_BUTTON_CLASSES =
|
|
12
|
-
"rounded-xl border-2 border-teal-200 bg-white text-2xl font-semibold text-teal-600 hover:text-teal-900 transition-colors hover:bg-teal-50 h-auto";
|
|
13
|
-
const BACKSPACE_BUTTON_CLASSES =
|
|
14
|
-
"rounded-xl bg-red-600 text-white transition-colors hover:bg-red-700 h-auto";
|
|
15
|
-
const SUBMIT_BUTTON_CLASSES =
|
|
16
|
-
"row-span-3 rounded-xl bg-green-400 transition-colors hover:bg-green-500 h-auto";
|
|
17
|
-
|
|
18
|
-
export interface NumpadProps
|
|
19
|
-
extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
20
|
-
value?: string;
|
|
21
|
-
onChange?: (value: string) => void;
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
allowDecimal?: boolean;
|
|
24
|
-
allowDoubleZero?: boolean;
|
|
25
|
-
maxLength?: number;
|
|
26
|
-
className?: string;
|
|
27
|
-
buttonClassName?: string;
|
|
28
|
-
customKeyStyle?: React.CSSProperties;
|
|
29
|
-
customKeyClassName?: string;
|
|
30
|
-
customSubmitStyle?: React.CSSProperties;
|
|
31
|
-
customSubmitClassName?: string;
|
|
32
|
-
showBackspaceButton?: boolean;
|
|
33
|
-
showClearButton?: boolean;
|
|
34
|
-
showSubmitButton?: boolean;
|
|
35
|
-
onSubmit?: () => void;
|
|
36
|
-
inputRef?: React.RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function Numpad({
|
|
40
|
-
value: controlledValue,
|
|
41
|
-
onChange,
|
|
42
|
-
disabled = false,
|
|
43
|
-
allowDecimal = false,
|
|
44
|
-
allowDoubleZero = true,
|
|
45
|
-
maxLength,
|
|
46
|
-
className,
|
|
47
|
-
buttonClassName,
|
|
48
|
-
customKeyStyle,
|
|
49
|
-
customKeyClassName,
|
|
50
|
-
customSubmitStyle,
|
|
51
|
-
customSubmitClassName,
|
|
52
|
-
showBackspaceButton = true,
|
|
53
|
-
showClearButton = true,
|
|
54
|
-
showSubmitButton = false,
|
|
55
|
-
onSubmit,
|
|
56
|
-
inputRef,
|
|
57
|
-
...props
|
|
58
|
-
}: NumpadProps) {
|
|
59
|
-
const [internalValue, setInternalValue] = React.useState("");
|
|
60
|
-
const isControlled = controlledValue !== undefined;
|
|
61
|
-
const value = isControlled ? controlledValue : internalValue;
|
|
62
|
-
|
|
63
|
-
// Helper function to update input value with cursor position handling
|
|
64
|
-
const updateInputValue = React.useCallback(
|
|
65
|
-
(
|
|
66
|
-
input: HTMLInputElement | HTMLTextAreaElement,
|
|
67
|
-
newValue: string,
|
|
68
|
-
cursorPos: number
|
|
69
|
-
) => {
|
|
70
|
-
input.value = newValue;
|
|
71
|
-
input.setSelectionRange(cursorPos, cursorPos);
|
|
72
|
-
const event = new Event("input", { bubbles: true });
|
|
73
|
-
input.dispatchEvent(event);
|
|
74
|
-
|
|
75
|
-
if (!isControlled) {
|
|
76
|
-
setInternalValue(newValue);
|
|
77
|
-
}
|
|
78
|
-
onChange?.(newValue);
|
|
79
|
-
},
|
|
80
|
-
[isControlled, onChange]
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
const handleValueChange = React.useCallback(
|
|
84
|
-
(newValue: string) => {
|
|
85
|
-
if (disabled) return;
|
|
86
|
-
if (maxLength && newValue.length > maxLength) return;
|
|
87
|
-
|
|
88
|
-
if (!isControlled) {
|
|
89
|
-
setInternalValue(newValue);
|
|
90
|
-
}
|
|
91
|
-
onChange?.(newValue);
|
|
92
|
-
},
|
|
93
|
-
[disabled, maxLength, isControlled, onChange]
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
const handleNumberClick = React.useCallback(
|
|
97
|
-
(num: string) => {
|
|
98
|
-
if (disabled) return;
|
|
99
|
-
|
|
100
|
-
if (inputRef?.current) {
|
|
101
|
-
const input = inputRef.current;
|
|
102
|
-
const start = input.selectionStart ?? 0;
|
|
103
|
-
const end = input.selectionEnd ?? 0;
|
|
104
|
-
const newValue =
|
|
105
|
-
input.value.slice(0, start) + num + input.value.slice(end);
|
|
106
|
-
const newCursorPos = start + num.length;
|
|
107
|
-
|
|
108
|
-
if (maxLength && newValue.length > maxLength) return;
|
|
109
|
-
|
|
110
|
-
updateInputValue(input, newValue, newCursorPos);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
handleValueChange(value + num);
|
|
115
|
-
},
|
|
116
|
-
[disabled, value, handleValueChange, inputRef, maxLength, updateInputValue]
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
const handleDecimalClick = React.useCallback(() => {
|
|
120
|
-
if (disabled || !allowDecimal) return;
|
|
121
|
-
|
|
122
|
-
if (inputRef?.current) {
|
|
123
|
-
const input = inputRef.current;
|
|
124
|
-
if (input.value.includes(".")) return;
|
|
125
|
-
|
|
126
|
-
const start = input.selectionStart ?? 0;
|
|
127
|
-
const end = input.selectionEnd ?? 0;
|
|
128
|
-
const newValue = input.value.slice(0, start) + "." + input.value.slice(end);
|
|
129
|
-
const newCursorPos = start + 1;
|
|
130
|
-
|
|
131
|
-
if (maxLength && newValue.length > maxLength) return;
|
|
132
|
-
|
|
133
|
-
updateInputValue(input, newValue, newCursorPos);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (value.includes(".")) return;
|
|
138
|
-
handleValueChange(value + ".");
|
|
139
|
-
}, [
|
|
140
|
-
disabled,
|
|
141
|
-
allowDecimal,
|
|
142
|
-
value,
|
|
143
|
-
handleValueChange,
|
|
144
|
-
inputRef,
|
|
145
|
-
maxLength,
|
|
146
|
-
updateInputValue,
|
|
147
|
-
]);
|
|
148
|
-
|
|
149
|
-
const handleBackspace = React.useCallback(() => {
|
|
150
|
-
if (disabled) return;
|
|
151
|
-
|
|
152
|
-
if (inputRef?.current) {
|
|
153
|
-
const input = inputRef.current;
|
|
154
|
-
const start = input.selectionStart ?? 0;
|
|
155
|
-
const end = input.selectionEnd ?? 0;
|
|
156
|
-
|
|
157
|
-
if (start === end && start === 0) return;
|
|
158
|
-
|
|
159
|
-
const newValue =
|
|
160
|
-
start !== end
|
|
161
|
-
? input.value.slice(0, start) + input.value.slice(end)
|
|
162
|
-
: input.value.slice(0, start - 1) + input.value.slice(start);
|
|
163
|
-
const newCursorPos = start !== end ? start : Math.max(0, start - 1);
|
|
164
|
-
|
|
165
|
-
updateInputValue(input, newValue, newCursorPos);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (value.length > 0) {
|
|
170
|
-
handleValueChange(value.slice(0, -1));
|
|
171
|
-
}
|
|
172
|
-
}, [disabled, value, handleValueChange, inputRef, updateInputValue]);
|
|
173
|
-
|
|
174
|
-
const handleClear = React.useCallback(() => {
|
|
175
|
-
handleValueChange("");
|
|
176
|
-
}, [handleValueChange]);
|
|
177
|
-
|
|
178
|
-
const handleSubmit = React.useCallback(() => {
|
|
179
|
-
if (disabled) return;
|
|
180
|
-
|
|
181
|
-
// If inputRef is provided, handle Enter like a real keyboard
|
|
182
|
-
if (inputRef?.current) {
|
|
183
|
-
const input = inputRef.current;
|
|
184
|
-
const isTextarea = input.tagName === 'TEXTAREA';
|
|
185
|
-
const isInput = input.tagName === 'INPUT';
|
|
186
|
-
|
|
187
|
-
if (isTextarea) {
|
|
188
|
-
const start = input.selectionStart ?? 0;
|
|
189
|
-
const end = input.selectionEnd ?? 0;
|
|
190
|
-
const newValue =
|
|
191
|
-
input.value.slice(0, start) + "\n" + input.value.slice(end);
|
|
192
|
-
const newCursorPos = start + 1;
|
|
193
|
-
updateInputValue(input, newValue, newCursorPos);
|
|
194
|
-
} else if (isInput) {
|
|
195
|
-
// For input: trigger Enter key events like real keyboard
|
|
196
|
-
// This will trigger form submission if inside a form
|
|
197
|
-
|
|
198
|
-
// Create and dispatch keydown event
|
|
199
|
-
const keyDownEvent = new KeyboardEvent('keydown', {
|
|
200
|
-
key: 'Enter',
|
|
201
|
-
code: 'Enter',
|
|
202
|
-
keyCode: 13,
|
|
203
|
-
which: 13,
|
|
204
|
-
bubbles: true,
|
|
205
|
-
cancelable: true,
|
|
206
|
-
});
|
|
207
|
-
input.dispatchEvent(keyDownEvent);
|
|
208
|
-
|
|
209
|
-
// Only trigger keypress and keyup if keydown wasn't prevented
|
|
210
|
-
if (!keyDownEvent.defaultPrevented) {
|
|
211
|
-
// Create and dispatch keypress event
|
|
212
|
-
const keyPressEvent = new KeyboardEvent('keypress', {
|
|
213
|
-
key: 'Enter',
|
|
214
|
-
code: 'Enter',
|
|
215
|
-
keyCode: 13,
|
|
216
|
-
which: 13,
|
|
217
|
-
bubbles: true,
|
|
218
|
-
cancelable: true,
|
|
219
|
-
});
|
|
220
|
-
input.dispatchEvent(keyPressEvent);
|
|
221
|
-
|
|
222
|
-
// Create and dispatch keyup event
|
|
223
|
-
const keyUpEvent = new KeyboardEvent('keyup', {
|
|
224
|
-
key: 'Enter',
|
|
225
|
-
code: 'Enter',
|
|
226
|
-
keyCode: 13,
|
|
227
|
-
which: 13,
|
|
228
|
-
bubbles: true,
|
|
229
|
-
cancelable: true,
|
|
230
|
-
});
|
|
231
|
-
input.dispatchEvent(keyUpEvent);
|
|
232
|
-
|
|
233
|
-
// If input is inside a form, trigger form submit
|
|
234
|
-
const form = input.closest('form');
|
|
235
|
-
if (form && !keyPressEvent.defaultPrevented) {
|
|
236
|
-
// Trigger form submit event
|
|
237
|
-
const submitEvent = new Event('submit', {
|
|
238
|
-
bubbles: true,
|
|
239
|
-
cancelable: true,
|
|
240
|
-
});
|
|
241
|
-
form.dispatchEvent(submitEvent);
|
|
242
|
-
|
|
243
|
-
// If submit wasn't prevented, actually submit the form
|
|
244
|
-
if (!submitEvent.defaultPrevented) {
|
|
245
|
-
form.requestSubmit();
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
onSubmit?.();
|
|
253
|
-
}, [disabled, onSubmit, inputRef, updateInputValue]);
|
|
254
|
-
|
|
255
|
-
// Helper component for number buttons
|
|
256
|
-
const NumberButton = React.useCallback(
|
|
257
|
-
({ num, onClick }: { num: string; onClick: () => void }) => (
|
|
258
|
-
<Button
|
|
259
|
-
type="button"
|
|
260
|
-
disabled={disabled}
|
|
261
|
-
onClick={onClick}
|
|
262
|
-
style={customKeyStyle}
|
|
263
|
-
className={cn(
|
|
264
|
-
NUMBER_BUTTON_BASE_CLASSES,
|
|
265
|
-
buttonClassName,
|
|
266
|
-
customKeyClassName
|
|
267
|
-
)}
|
|
268
|
-
>
|
|
269
|
-
{num}
|
|
270
|
-
</Button>
|
|
271
|
-
),
|
|
272
|
-
[disabled, customKeyStyle, buttonClassName, customKeyClassName]
|
|
273
|
-
);
|
|
274
|
-
|
|
275
|
-
return (
|
|
276
|
-
<div className={cn("grid grid-cols-4 gap-3 w-fit", className)} {...props}>
|
|
277
|
-
{/* Layout: 1,2,3,Delete | 4,5,6,Submit | 7,8,9 | 0,00,000 */}
|
|
278
|
-
{/* Row 1: 1, 2, 3, Delete */}
|
|
279
|
-
<NumberButton num="1" onClick={() => handleNumberClick("1")} />
|
|
280
|
-
<NumberButton num="2" onClick={() => handleNumberClick("2")} />
|
|
281
|
-
<NumberButton num="3" onClick={() => handleNumberClick("3")} />
|
|
282
|
-
{showBackspaceButton && (
|
|
283
|
-
<button
|
|
284
|
-
type="button"
|
|
285
|
-
disabled={disabled || value.length === 0}
|
|
286
|
-
onClick={handleBackspace}
|
|
287
|
-
style={customKeyStyle}
|
|
288
|
-
className={cn(
|
|
289
|
-
BACKSPACE_BUTTON_CLASSES,
|
|
290
|
-
buttonClassName,
|
|
291
|
-
customKeyClassName
|
|
292
|
-
)}
|
|
293
|
-
>
|
|
294
|
-
<Delete className="mx-auto h-8 w-8" />
|
|
295
|
-
</button>
|
|
296
|
-
)}
|
|
297
|
-
|
|
298
|
-
{/* Row 2: 4, 5, 6, Clear */}
|
|
299
|
-
<NumberButton num="4" onClick={() => handleNumberClick("4")} />
|
|
300
|
-
<NumberButton num="5" onClick={() => handleNumberClick("5")} />
|
|
301
|
-
<NumberButton num="6" onClick={() => handleNumberClick("6")} />
|
|
302
|
-
{showClearButton && (
|
|
303
|
-
<Button
|
|
304
|
-
type="button"
|
|
305
|
-
disabled={disabled || value.length === 0}
|
|
306
|
-
onClick={handleClear}
|
|
307
|
-
style={customKeyStyle}
|
|
308
|
-
className={cn(
|
|
309
|
-
CLEAR_BUTTON_CLASSES,
|
|
310
|
-
buttonClassName,
|
|
311
|
-
customKeyClassName
|
|
312
|
-
)}
|
|
313
|
-
>
|
|
314
|
-
Clear
|
|
315
|
-
</Button>
|
|
316
|
-
)}
|
|
317
|
-
{showSubmitButton && (
|
|
318
|
-
<>
|
|
319
|
-
<div />
|
|
320
|
-
<div />
|
|
321
|
-
<div />
|
|
322
|
-
<button
|
|
323
|
-
type="button"
|
|
324
|
-
disabled={disabled}
|
|
325
|
-
onClick={handleSubmit}
|
|
326
|
-
style={customSubmitStyle}
|
|
327
|
-
className={cn(
|
|
328
|
-
SUBMIT_BUTTON_CLASSES,
|
|
329
|
-
buttonClassName,
|
|
330
|
-
customSubmitClassName
|
|
331
|
-
)}
|
|
332
|
-
>
|
|
333
|
-
<ChevronLeft className="mx-auto h-12 w-12 rotate-180 text-gray-800" />
|
|
334
|
-
</button>
|
|
335
|
-
</>
|
|
336
|
-
)}
|
|
337
|
-
|
|
338
|
-
{/* Row 3: 7, 8, 9 */}
|
|
339
|
-
<NumberButton num="7" onClick={() => handleNumberClick("7")} />
|
|
340
|
-
<NumberButton num="8" onClick={() => handleNumberClick("8")} />
|
|
341
|
-
<NumberButton num="9" onClick={() => handleNumberClick("9")} />
|
|
342
|
-
|
|
343
|
-
{/* Row 4: 0, 00, 000 */}
|
|
344
|
-
<NumberButton num="0" onClick={() => handleNumberClick("0")} />
|
|
345
|
-
{allowDoubleZero ? (
|
|
346
|
-
<>
|
|
347
|
-
<NumberButton num="00" onClick={() => handleNumberClick("00")} />
|
|
348
|
-
<NumberButton num="000" onClick={() => handleNumberClick("000")} />
|
|
349
|
-
</>
|
|
350
|
-
) : allowDecimal ? (
|
|
351
|
-
<Button
|
|
352
|
-
type="button"
|
|
353
|
-
disabled={disabled}
|
|
354
|
-
onClick={handleDecimalClick}
|
|
355
|
-
style={customKeyStyle}
|
|
356
|
-
className={cn(
|
|
357
|
-
NUMBER_BUTTON_BASE_CLASSES,
|
|
358
|
-
buttonClassName,
|
|
359
|
-
customKeyClassName
|
|
360
|
-
)}
|
|
361
|
-
>
|
|
362
|
-
.
|
|
363
|
-
</Button>
|
|
364
|
-
) : (
|
|
365
|
-
<>
|
|
366
|
-
<div />
|
|
367
|
-
<div />
|
|
368
|
-
</>
|
|
369
|
-
)}
|
|
370
|
-
{showSubmitButton && <div />}
|
|
371
|
-
</div>
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
Numpad.displayName = "Numpad";
|
|
376
|
-
|
|
377
|
-
export default Numpad;
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Clock } from 'lucide-react';
|
|
5
|
-
import { cn } from '../../../shadcn/lib/utils';
|
|
6
|
-
import { Button } from '../../../shadcn/ui/button';
|
|
7
|
-
import {
|
|
8
|
-
Popover,
|
|
9
|
-
PopoverContent,
|
|
10
|
-
PopoverTrigger,
|
|
11
|
-
} from '../../../shadcn/ui/popover';
|
|
12
|
-
import {
|
|
13
|
-
Select,
|
|
14
|
-
SelectContent,
|
|
15
|
-
SelectItem,
|
|
16
|
-
SelectTrigger,
|
|
17
|
-
SelectValue,
|
|
18
|
-
} from '../../../shadcn/ui/select';
|
|
19
|
-
|
|
20
|
-
export type TimePrecision = 'hour' | 'minute' | 'second';
|
|
21
|
-
|
|
22
|
-
export interface TimePickerProps
|
|
23
|
-
extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
24
|
-
value?: Date | null;
|
|
25
|
-
onChange?: (date: Date | null) => void;
|
|
26
|
-
placeholder?: string;
|
|
27
|
-
disabled?: boolean;
|
|
28
|
-
precision?: TimePrecision; // default 'minute'
|
|
29
|
-
hourCycle?: 12 | 24; // default 24
|
|
30
|
-
minuteStep?: number; // default 5
|
|
31
|
-
secondStep?: number; // default 5
|
|
32
|
-
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
|
|
33
|
-
open?: boolean;
|
|
34
|
-
onOpenChange?: (open: boolean) => void;
|
|
35
|
-
showFooter?: boolean; // default true
|
|
36
|
-
cancelLabel?: string; // default 'Cancel'
|
|
37
|
-
applyLabel?: string; // default 'Apply'
|
|
38
|
-
clearLabel?: string; // default 'Clear'
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const clamp = (n: number, min: number, max: number) =>
|
|
42
|
-
Math.max(min, Math.min(max, n));
|
|
43
|
-
const pad2 = (n: number) => String(n).padStart(2, '0');
|
|
44
|
-
|
|
45
|
-
export function TimePicker({
|
|
46
|
-
value,
|
|
47
|
-
onChange,
|
|
48
|
-
placeholder = 'Pick a time',
|
|
49
|
-
disabled,
|
|
50
|
-
precision = 'minute',
|
|
51
|
-
hourCycle = 24,
|
|
52
|
-
minuteStep = 5,
|
|
53
|
-
secondStep = 5,
|
|
54
|
-
className,
|
|
55
|
-
buttonVariant = 'outline',
|
|
56
|
-
...props
|
|
57
|
-
}: TimePickerProps) {
|
|
58
|
-
const [internalOpen, setInternalOpen] = React.useState(false);
|
|
59
|
-
const isOpen = typeof props.open === 'boolean' ? props.open : internalOpen;
|
|
60
|
-
const setOpen = (o: boolean) =>
|
|
61
|
-
props.onOpenChange ? props.onOpenChange(o) : setInternalOpen(o);
|
|
62
|
-
|
|
63
|
-
const [draft, setDraft] = React.useState<Date | null>(value ?? null);
|
|
64
|
-
|
|
65
|
-
React.useEffect(() => {
|
|
66
|
-
if (isOpen) setDraft(value ?? null);
|
|
67
|
-
}, [isOpen, value]);
|
|
68
|
-
|
|
69
|
-
const fmtLabel = (d: Date | null): string => {
|
|
70
|
-
if (!d) return placeholder;
|
|
71
|
-
const h = d.getHours();
|
|
72
|
-
const m = d.getMinutes();
|
|
73
|
-
const s = d.getSeconds();
|
|
74
|
-
if (hourCycle === 12) {
|
|
75
|
-
const period = h >= 12 ? 'PM' : 'AM';
|
|
76
|
-
const hour12 = h % 12 === 0 ? 12 : h % 12;
|
|
77
|
-
if (precision === 'hour') return `${hour12} ${period}`;
|
|
78
|
-
if (precision === 'minute') return `${hour12}:${pad2(m)} ${period}`;
|
|
79
|
-
return `${hour12}:${pad2(m)}:${pad2(s)} ${period}`;
|
|
80
|
-
}
|
|
81
|
-
if (precision === 'hour') return `${pad2(h)}`;
|
|
82
|
-
if (precision === 'minute') return `${pad2(h)}:${pad2(m)}`;
|
|
83
|
-
return `${pad2(h)}:${pad2(m)}:${pad2(s)}`;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const setDraftPart = (
|
|
87
|
-
part: 'hour' | 'minute' | 'second' | 'period',
|
|
88
|
-
val: number | 'AM' | 'PM',
|
|
89
|
-
) => {
|
|
90
|
-
setDraft((prev) => {
|
|
91
|
-
const base = prev
|
|
92
|
-
? new Date(prev)
|
|
93
|
-
: (() => {
|
|
94
|
-
const n = new Date();
|
|
95
|
-
return new Date(
|
|
96
|
-
n.getFullYear(),
|
|
97
|
-
n.getMonth(),
|
|
98
|
-
n.getDate(),
|
|
99
|
-
0,
|
|
100
|
-
0,
|
|
101
|
-
0,
|
|
102
|
-
0,
|
|
103
|
-
);
|
|
104
|
-
})();
|
|
105
|
-
if (part === 'hour') {
|
|
106
|
-
let h = Number(val);
|
|
107
|
-
if (hourCycle === 12) {
|
|
108
|
-
const isPM = base.getHours() >= 12;
|
|
109
|
-
h = h % 12;
|
|
110
|
-
base.setHours(isPM ? (h === 12 ? 12 : h + 12) : h === 12 ? 0 : h);
|
|
111
|
-
} else {
|
|
112
|
-
base.setHours(clamp(h, 0, 23));
|
|
113
|
-
}
|
|
114
|
-
} else if (part === 'minute') {
|
|
115
|
-
base.setMinutes(clamp(Number(val), 0, 59));
|
|
116
|
-
} else if (part === 'second') {
|
|
117
|
-
base.setSeconds(clamp(Number(val), 0, 59));
|
|
118
|
-
} else if (part === 'period' && (val === 'AM' || val === 'PM')) {
|
|
119
|
-
const curH = base.getHours();
|
|
120
|
-
const isAMNow = curH < 12;
|
|
121
|
-
if (val === 'AM' && !isAMNow) base.setHours(curH - 12);
|
|
122
|
-
if (val === 'PM' && isAMNow) base.setHours(curH + 12);
|
|
123
|
-
}
|
|
124
|
-
base.setMilliseconds(0);
|
|
125
|
-
return new Date(base);
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const hours = React.useMemo(() => {
|
|
130
|
-
return hourCycle === 12
|
|
131
|
-
? Array.from({ length: 12 }, (_, i) => i + 1)
|
|
132
|
-
: Array.from({ length: 24 }, (_, i) => i);
|
|
133
|
-
}, [hourCycle]);
|
|
134
|
-
const minutes = React.useMemo(
|
|
135
|
-
() =>
|
|
136
|
-
Array.from(
|
|
137
|
-
{ length: Math.ceil(60 / minuteStep) },
|
|
138
|
-
(_, i) => i * minuteStep,
|
|
139
|
-
),
|
|
140
|
-
[minuteStep],
|
|
141
|
-
);
|
|
142
|
-
const seconds = React.useMemo(
|
|
143
|
-
() =>
|
|
144
|
-
Array.from(
|
|
145
|
-
{ length: Math.ceil(60 / secondStep) },
|
|
146
|
-
(_, i) => i * secondStep,
|
|
147
|
-
),
|
|
148
|
-
[secondStep],
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
const selectedHour = React.useMemo(() => {
|
|
152
|
-
if (!draft) return hourCycle === 12 ? 12 : 0;
|
|
153
|
-
const h = draft.getHours();
|
|
154
|
-
return hourCycle === 12 ? (h % 12 === 0 ? 12 : h % 12) : h;
|
|
155
|
-
}, [draft, hourCycle]);
|
|
156
|
-
const selectedMinute = draft?.getMinutes() ?? 0;
|
|
157
|
-
const selectedSecond = draft?.getSeconds() ?? 0;
|
|
158
|
-
const selectedPeriod: 'AM' | 'PM' =
|
|
159
|
-
draft && draft.getHours() >= 12 ? 'PM' : 'AM';
|
|
160
|
-
|
|
161
|
-
const label = fmtLabel(value ?? null);
|
|
162
|
-
|
|
163
|
-
return (
|
|
164
|
-
<div className={cn('w-fit', className)} {...props}>
|
|
165
|
-
<Popover open={isOpen} onOpenChange={setOpen}>
|
|
166
|
-
<PopoverTrigger asChild>
|
|
167
|
-
<Button
|
|
168
|
-
type="button"
|
|
169
|
-
disabled={disabled}
|
|
170
|
-
variant={buttonVariant}
|
|
171
|
-
className={cn(
|
|
172
|
-
'w-full justify-start text-left font-normal',
|
|
173
|
-
!value && 'text-muted-foreground',
|
|
174
|
-
)}
|
|
175
|
-
>
|
|
176
|
-
<Clock className="mr-2 h-4 w-4" />
|
|
177
|
-
{label}
|
|
178
|
-
</Button>
|
|
179
|
-
</PopoverTrigger>
|
|
180
|
-
<PopoverContent className="p-3 w-auto" align="start">
|
|
181
|
-
<div className="flex items-end gap-2">
|
|
182
|
-
<div className="w-24">
|
|
183
|
-
<div className="mb-1 block text-xs text-muted-foreground">
|
|
184
|
-
Hour
|
|
185
|
-
</div>
|
|
186
|
-
<Select
|
|
187
|
-
disabled={disabled}
|
|
188
|
-
value={String(selectedHour)}
|
|
189
|
-
onValueChange={(v) => setDraftPart('hour', Number(v))}
|
|
190
|
-
>
|
|
191
|
-
<SelectTrigger aria-label="Hour">
|
|
192
|
-
<SelectValue />
|
|
193
|
-
</SelectTrigger>
|
|
194
|
-
<SelectContent>
|
|
195
|
-
{hours.map((h) => (
|
|
196
|
-
<SelectItem key={h} value={String(h)}>
|
|
197
|
-
{hourCycle === 12 ? h : pad2(h)}
|
|
198
|
-
</SelectItem>
|
|
199
|
-
))}
|
|
200
|
-
</SelectContent>
|
|
201
|
-
</Select>
|
|
202
|
-
</div>
|
|
203
|
-
|
|
204
|
-
{(precision === 'minute' || precision === 'second') && (
|
|
205
|
-
<div className="w-24">
|
|
206
|
-
<div className="mb-1 block text-xs text-muted-foreground">
|
|
207
|
-
Minute
|
|
208
|
-
</div>
|
|
209
|
-
<Select
|
|
210
|
-
disabled={disabled}
|
|
211
|
-
value={String(selectedMinute - (selectedMinute % minuteStep))}
|
|
212
|
-
onValueChange={(v) => setDraftPart('minute', Number(v))}
|
|
213
|
-
>
|
|
214
|
-
<SelectTrigger aria-label="Minute">
|
|
215
|
-
<SelectValue />
|
|
216
|
-
</SelectTrigger>
|
|
217
|
-
<SelectContent>
|
|
218
|
-
{minutes.map((m) => (
|
|
219
|
-
<SelectItem key={m} value={String(m)}>
|
|
220
|
-
{pad2(m)}
|
|
221
|
-
</SelectItem>
|
|
222
|
-
))}
|
|
223
|
-
</SelectContent>
|
|
224
|
-
</Select>
|
|
225
|
-
</div>
|
|
226
|
-
)}
|
|
227
|
-
|
|
228
|
-
{precision === 'second' && (
|
|
229
|
-
<div className="w-24">
|
|
230
|
-
<div className="mb-1 block text-xs text-muted-foreground">
|
|
231
|
-
Second
|
|
232
|
-
</div>
|
|
233
|
-
<Select
|
|
234
|
-
disabled={disabled}
|
|
235
|
-
value={String(selectedSecond - (selectedSecond % secondStep))}
|
|
236
|
-
onValueChange={(v) => setDraftPart('second', Number(v))}
|
|
237
|
-
>
|
|
238
|
-
<SelectTrigger aria-label="Second">
|
|
239
|
-
<SelectValue />
|
|
240
|
-
</SelectTrigger>
|
|
241
|
-
<SelectContent>
|
|
242
|
-
{seconds.map((s) => (
|
|
243
|
-
<SelectItem key={s} value={String(s)}>
|
|
244
|
-
{pad2(s)}
|
|
245
|
-
</SelectItem>
|
|
246
|
-
))}
|
|
247
|
-
</SelectContent>
|
|
248
|
-
</Select>
|
|
249
|
-
</div>
|
|
250
|
-
)}
|
|
251
|
-
|
|
252
|
-
{hourCycle === 12 && (
|
|
253
|
-
<div className="w-24">
|
|
254
|
-
<div className="mb-1 block text-xs text-muted-foreground">
|
|
255
|
-
Period
|
|
256
|
-
</div>
|
|
257
|
-
<Select
|
|
258
|
-
disabled={disabled}
|
|
259
|
-
value={selectedPeriod}
|
|
260
|
-
onValueChange={(v) =>
|
|
261
|
-
setDraftPart('period', v as 'AM' | 'PM')
|
|
262
|
-
}
|
|
263
|
-
>
|
|
264
|
-
<SelectTrigger aria-label="Period">
|
|
265
|
-
<SelectValue />
|
|
266
|
-
</SelectTrigger>
|
|
267
|
-
<SelectContent>
|
|
268
|
-
<SelectItem value="AM">AM</SelectItem>
|
|
269
|
-
<SelectItem value="PM">PM</SelectItem>
|
|
270
|
-
</SelectContent>
|
|
271
|
-
</Select>
|
|
272
|
-
</div>
|
|
273
|
-
)}
|
|
274
|
-
</div>
|
|
275
|
-
|
|
276
|
-
{(props.showFooter ?? true) && (
|
|
277
|
-
<div className="flex items-center justify-between gap-2 pt-3 mt-3 border-t border-border">
|
|
278
|
-
<Button
|
|
279
|
-
type="button"
|
|
280
|
-
variant="outline"
|
|
281
|
-
size="sm"
|
|
282
|
-
onClick={() => setOpen(false)}
|
|
283
|
-
disabled={disabled}
|
|
284
|
-
>
|
|
285
|
-
{props.cancelLabel ?? 'Cancel'}
|
|
286
|
-
</Button>
|
|
287
|
-
<div className="flex gap-2">
|
|
288
|
-
<Button
|
|
289
|
-
type="button"
|
|
290
|
-
variant="ghost"
|
|
291
|
-
size="sm"
|
|
292
|
-
onClick={() => onChange?.(null)}
|
|
293
|
-
disabled={disabled}
|
|
294
|
-
>
|
|
295
|
-
{props.clearLabel ?? 'Clear'}
|
|
296
|
-
</Button>
|
|
297
|
-
<Button
|
|
298
|
-
type="button"
|
|
299
|
-
variant="default"
|
|
300
|
-
size="sm"
|
|
301
|
-
onClick={() => {
|
|
302
|
-
onChange?.(draft ?? null);
|
|
303
|
-
setOpen(false);
|
|
304
|
-
}}
|
|
305
|
-
>
|
|
306
|
-
{props.applyLabel ?? 'Apply'}
|
|
307
|
-
</Button>
|
|
308
|
-
</div>
|
|
309
|
-
</div>
|
|
310
|
-
)}
|
|
311
|
-
</PopoverContent>
|
|
312
|
-
</Popover>
|
|
313
|
-
</div>
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
TimePicker.displayName = 'TimePicker';
|
|
318
|
-
|
|
319
|
-
export default TimePicker;
|