@k3-universe/react-kit 0.0.41 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +12 -12
- package/.storybook/main.ts +22 -22
- package/.storybook/preview.ts +198 -198
- package/Dockerfile.storybook +43 -43
- package/README.md +9 -9
- package/biome.json +10 -10
- package/components.json +20 -20
- package/dist/index.js +32 -14
- package/dist/kit/builder/auth/hooks/core-hooks.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/AutocompleteField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/DatePickerField.d.ts.map +1 -1
- package/dist/kit/builder/form/components/fields/DateRangePickerField.d.ts.map +1 -1
- package/dist/kit/builder/form/types.d.ts +2 -0
- package/dist/kit/builder/form/types.d.ts.map +1 -1
- package/dist/kit/components/autocomplete/Autocomplete.d.ts +2 -1
- package/dist/kit/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/kit/layouts/admin/hooks/menu.d.ts.map +1 -1
- package/dist/kit/themes/clean-slate.css +4 -8
- package/dist/kit/themes/default.css +5 -9
- package/dist/kit/themes/minimal-modern.css +4 -8
- package/dist/kit/themes/spotify.css +4 -8
- package/package.json +1 -1
- package/src/index.ts +99 -99
- package/src/kit/builder/auth/components/Can.tsx +27 -27
- package/src/kit/builder/auth/components/RequireAuth.tsx +78 -78
- package/src/kit/builder/auth/components/ShowWhenAuthenticated.tsx +10 -10
- package/src/kit/builder/auth/components/ShowWhenError.tsx +10 -10
- package/src/kit/builder/auth/components/ShowWhenLoading.tsx +10 -10
- package/src/kit/builder/auth/components/ShowWhenUnauthenticated.tsx +10 -10
- package/src/kit/builder/auth/components/withPermission.tsx +23 -23
- package/src/kit/builder/auth/hooks/action-hooks.ts +34 -34
- package/src/kit/builder/auth/hooks/core-hooks.ts +65 -65
- package/src/kit/builder/auth/hooks/index.ts +4 -4
- package/src/kit/builder/auth/hooks/permission-hooks.ts +43 -43
- package/src/kit/builder/auth/hooks/token-hooks.ts +25 -25
- package/src/kit/builder/auth/index.ts +132 -132
- package/src/kit/builder/auth/providers/AuthProvider.tsx +131 -131
- package/src/kit/builder/auth/types/adapter-config.ts +44 -44
- package/src/kit/builder/auth/types/adapter.ts +132 -132
- package/src/kit/builder/auth/types/core.ts +27 -27
- package/src/kit/builder/auth/types/index.ts +9 -9
- package/src/kit/builder/auth/types/middleware.ts +20 -20
- package/src/kit/builder/auth/types/permissions.ts +23 -23
- package/src/kit/builder/auth/types/state.ts +16 -16
- package/src/kit/builder/auth/types/storage.ts +21 -21
- package/src/kit/builder/auth/types/token-manager.ts +9 -9
- package/src/kit/builder/auth/types/utils.ts +55 -55
- package/src/kit/builder/auth/utils/auth-adapter.ts +437 -437
- package/src/kit/builder/auth/utils/client-adapters/apollo-link.ts +30 -30
- package/src/kit/builder/auth/utils/client-adapters/axios.ts +61 -61
- package/src/kit/builder/auth/utils/client-adapters/fetch.ts +48 -48
- package/src/kit/builder/auth/utils/client-adapters/graphql.ts +60 -60
- package/src/kit/builder/auth/utils/client-adapters/index.ts +6 -6
- package/src/kit/builder/auth/utils/client-adapters/rest.ts +60 -60
- package/src/kit/builder/auth/utils/client-adapters/urql-exchange.ts +76 -76
- package/src/kit/builder/auth/utils/permission-checker.ts +150 -150
- package/src/kit/builder/auth/utils/storage/browser.ts +99 -99
- package/src/kit/builder/auth/utils/storage/cookie.ts +116 -116
- package/src/kit/builder/auth/utils/storage/encryption.ts +80 -80
- package/src/kit/builder/auth/utils/storage/env.ts +2 -2
- package/src/kit/builder/auth/utils/storage/factory.ts +37 -37
- package/src/kit/builder/auth/utils/storage/index.ts +6 -6
- package/src/kit/builder/auth/utils/storage/memory.ts +15 -15
- package/src/kit/builder/auth/utils/token-manager.ts +55 -55
- package/src/kit/builder/data-table/components/DataTable.tsx +547 -547
- package/src/kit/builder/data-table/components/DataTableColumnHeader.tsx +67 -67
- package/src/kit/builder/data-table/components/DataTablePagination.tsx +112 -112
- package/src/kit/builder/data-table/components/DataTableViewOptions.tsx +51 -51
- package/src/kit/builder/data-table/index.ts +6 -6
- package/src/kit/builder/data-table/types.ts +44 -44
- package/src/kit/builder/data-table/utils/dotAccessor.ts +6 -6
- package/src/kit/builder/dialog/index.ts +6 -6
- package/src/kit/builder/dialog/provider.tsx +170 -170
- package/src/kit/builder/form/components/FormBuilder.tsx +295 -295
- package/src/kit/builder/form/components/FormBuilderActions.tsx +78 -78
- package/src/kit/builder/form/components/FormBuilderContext.tsx +52 -52
- package/src/kit/builder/form/components/FormBuilderField.tsx +456 -456
- package/src/kit/builder/form/components/fields/ArrayField.tsx +311 -311
- package/src/kit/builder/form/components/fields/AutocompleteField.tsx +89 -88
- package/src/kit/builder/form/components/fields/CheckboxField.tsx +65 -65
- package/src/kit/builder/form/components/fields/DateField.tsx +26 -26
- package/src/kit/builder/form/components/fields/DatePickerField.tsx +31 -29
- package/src/kit/builder/form/components/fields/DateRangePickerField.tsx +55 -46
- package/src/kit/builder/form/components/fields/DateTimePickerField.tsx +38 -38
- package/src/kit/builder/form/components/fields/DateTimeRangePickerField.tsx +48 -48
- package/src/kit/builder/form/components/fields/FileField.tsx +31 -31
- package/src/kit/builder/form/components/fields/MonthPickerField.tsx +33 -33
- package/src/kit/builder/form/components/fields/MonthRangePickerField.tsx +41 -41
- package/src/kit/builder/form/components/fields/NumberField.tsx +20 -20
- package/src/kit/builder/form/components/fields/ObjectField.tsx +35 -35
- package/src/kit/builder/form/components/fields/RadioField.tsx +47 -47
- package/src/kit/builder/form/components/fields/SelectField.tsx +46 -46
- package/src/kit/builder/form/components/fields/SwitchField.tsx +65 -65
- package/src/kit/builder/form/components/fields/TextField.tsx +25 -25
- package/src/kit/builder/form/components/fields/TextareaField.tsx +20 -20
- package/src/kit/builder/form/components/fields/TimePickerField.tsx +35 -35
- package/src/kit/builder/form/components/fields/TimeRangePickerField.tsx +43 -43
- package/src/kit/builder/form/components/fields/index.ts +21 -21
- package/src/kit/builder/form/components/fields/types.ts +18 -18
- package/src/kit/builder/form/components/index.ts +3 -3
- package/src/kit/builder/form/components/sectionNodes.tsx +147 -147
- package/src/kit/builder/form/hooks/useFormBuilder.ts +451 -451
- package/src/kit/builder/form/index.ts +4 -4
- package/src/kit/builder/form/types.ts +245 -243
- package/src/kit/builder/form/utils/common-forms.ts +68 -68
- package/src/kit/builder/form/utils/dependencies.ts +56 -56
- package/src/kit/builder/form/utils/field-factories.ts +177 -177
- package/src/kit/builder/form/utils/index.ts +17 -17
- package/src/kit/builder/form/utils/section-factories.ts +38 -38
- package/src/kit/builder/form/utils/transformers.ts +100 -100
- package/src/kit/builder/form/utils/validations.ts +22 -22
- package/src/kit/builder/form/utils/validators.ts +20 -20
- package/src/kit/builder/page/Page.tsx +202 -202
- package/src/kit/builder/page/index.ts +1 -1
- package/src/kit/builder/section/SectionBuilder.tsx +435 -435
- package/src/kit/builder/section/SectionContainer.tsx +85 -85
- package/src/kit/builder/section/index.ts +2 -2
- package/src/kit/builder/section/types.ts +80 -80
- package/src/kit/builder/stack-dialog/context.ts +15 -15
- package/src/kit/builder/stack-dialog/hooks.ts +13 -13
- package/src/kit/builder/stack-dialog/index.ts +12 -12
- package/src/kit/builder/stack-dialog/provider.tsx +51 -51
- package/src/kit/builder/stack-dialog/renderer.tsx +36 -36
- package/src/kit/builder/stack-dialog/types.ts +34 -34
- package/src/kit/components/autocomplete/Autocomplete.tsx +671 -664
- package/src/kit/components/autocomplete/index.ts +3 -3
- package/src/kit/components/autocomplete/types.ts +27 -27
- package/src/kit/components/datepicker/DatePicker.tsx +173 -173
- package/src/kit/components/datepicker/DateRangePicker.tsx +526 -526
- package/src/kit/components/datepicker/index.ts +2 -2
- package/src/kit/components/datetimepicker/DateTimePicker.tsx +420 -420
- package/src/kit/components/datetimepicker/DateTimeRangePicker.tsx +676 -676
- package/src/kit/components/datetimepicker/index.ts +2 -2
- package/src/kit/components/fileuploader/FileUploader.tsx +626 -626
- package/src/kit/components/fileuploader/index.ts +3 -3
- package/src/kit/components/fileuploader/types.ts +76 -76
- package/src/kit/components/forminfo/FormInfoError.tsx +135 -135
- package/src/kit/components/forminfo/index.ts +1 -1
- package/src/kit/components/keyboard/Keyboard.tsx +916 -916
- package/src/kit/components/keyboard/index.ts +4 -4
- package/src/kit/components/login/Login.tsx +141 -141
- package/src/kit/components/login/index.ts +1 -1
- package/src/kit/components/monthpicker/MonthInput.tsx +131 -131
- package/src/kit/components/monthpicker/MonthPicker.tsx +224 -224
- package/src/kit/components/monthpicker/MonthRangeInput.tsx +153 -153
- package/src/kit/components/monthpicker/MonthRangePicker.tsx +409 -409
- package/src/kit/components/numpad/Numpad.tsx +377 -377
- package/src/kit/components/numpad/index.ts +4 -4
- package/src/kit/components/timepicker/TimePicker.tsx +319 -319
- package/src/kit/components/timepicker/TimeRangePicker.tsx +368 -368
- package/src/kit/components/timepicker/index.ts +2 -2
- package/src/kit/layouts/admin/components/AdminLayout.tsx +286 -286
- package/src/kit/layouts/admin/components/ThemeToggle.tsx +54 -54
- package/src/kit/layouts/admin/hooks/menu.ts +32 -32
- package/src/kit/layouts/admin/providers/AdminMenuProvider.tsx +78 -78
- package/src/kit/layouts/admin/types/index.ts +26 -26
- package/src/kit/providers/ThemeProvider.tsx +90 -90
- package/src/kit/themes/base.css +11 -11
- package/src/kit/themes/clean-slate.css +155 -155
- package/src/kit/themes/default.css +192 -192
- package/src/kit/themes/minimal-modern.css +155 -155
- package/src/kit/themes/spotify.css +164 -164
- package/src/shadcn/hooks/use-mobile.ts +21 -21
- package/src/shadcn/lib/utils.ts +6 -6
- package/src/shadcn/ui/accordion.tsx +66 -66
- package/src/shadcn/ui/alert-dialog.tsx +157 -157
- package/src/shadcn/ui/alert.tsx +66 -66
- package/src/shadcn/ui/aspect-ratio.tsx +11 -11
- package/src/shadcn/ui/avatar.tsx +53 -53
- package/src/shadcn/ui/badge.tsx +46 -46
- package/src/shadcn/ui/breadcrumb.tsx +108 -108
- package/src/shadcn/ui/button.tsx +59 -59
- package/src/shadcn/ui/calendar.tsx +217 -217
- package/src/shadcn/ui/card.tsx +92 -92
- package/src/shadcn/ui/carousel.tsx +240 -240
- package/src/shadcn/ui/chart.tsx +353 -353
- package/src/shadcn/ui/checkbox.tsx +32 -32
- package/src/shadcn/ui/collapsible.tsx +33 -33
- package/src/shadcn/ui/command.tsx +184 -184
- package/src/shadcn/ui/context-menu.tsx +252 -252
- package/src/shadcn/ui/dialog.tsx +143 -143
- package/src/shadcn/ui/drawer.tsx +135 -135
- package/src/shadcn/ui/dropdown-menu.tsx +257 -257
- package/src/shadcn/ui/form.tsx +168 -168
- package/src/shadcn/ui/hover-card.tsx +44 -44
- package/src/shadcn/ui/input-otp.tsx +77 -77
- package/src/shadcn/ui/input.tsx +21 -21
- package/src/shadcn/ui/label.tsx +24 -24
- package/src/shadcn/ui/menubar.tsx +276 -276
- package/src/shadcn/ui/navigation-menu.tsx +168 -168
- package/src/shadcn/ui/pagination.tsx +127 -127
- package/src/shadcn/ui/popover.tsx +48 -48
- package/src/shadcn/ui/progress.tsx +31 -31
- package/src/shadcn/ui/radio-group.tsx +45 -45
- package/src/shadcn/ui/resizable.tsx +56 -56
- package/src/shadcn/ui/scroll-area.tsx +58 -58
- package/src/shadcn/ui/select.tsx +185 -185
- package/src/shadcn/ui/separator.tsx +28 -28
- package/src/shadcn/ui/sheet.tsx +139 -139
- package/src/shadcn/ui/sidebar.tsx +726 -726
- package/src/shadcn/ui/skeleton.tsx +13 -13
- package/src/shadcn/ui/slider.tsx +63 -63
- package/src/shadcn/ui/sonner.tsx +25 -25
- package/src/shadcn/ui/switch.tsx +31 -31
- package/src/shadcn/ui/table.tsx +116 -116
- package/src/shadcn/ui/tabs.tsx +66 -66
- package/src/shadcn/ui/textarea.tsx +18 -18
- package/src/shadcn/ui/toggle-group.tsx +73 -73
- package/src/shadcn/ui/toggle.tsx +47 -47
- package/src/shadcn/ui/tooltip.tsx +61 -61
- package/src/stories/FileUploader.stories.tsx +185 -185
- package/src/stories/kit/builder/DataTable.Basic.stories.tsx +71 -71
- package/src/stories/kit/builder/DataTable.Filters.stories.tsx +98 -98
- package/src/stories/kit/builder/DataTable.Pagination.stories.tsx +73 -73
- package/src/stories/kit/builder/DataTable.SelectionAndActions.stories.tsx +77 -77
- package/src/stories/kit/builder/DataTable.Sorting.stories.tsx +67 -67
- package/src/stories/kit/builder/Dialog.stories.tsx +90 -90
- package/src/stories/kit/builder/Form.ArrayLayouts.stories.tsx +177 -177
- package/src/stories/kit/builder/Form.Autocomplete.stories.tsx +220 -220
- package/src/stories/kit/builder/Form.Basic.stories.tsx +79 -79
- package/src/stories/kit/builder/Form.Complex.stories.tsx +569 -569
- package/src/stories/kit/builder/Form.DateTime.stories.tsx +70 -70
- package/src/stories/kit/builder/Form.Dynamic.stories.tsx +926 -926
- package/src/stories/kit/builder/Form.Files.stories.tsx +136 -136
- package/src/stories/kit/builder/Form.MultipleFormBuilder.stories.tsx +377 -377
- package/src/stories/kit/builder/Form.Pickers.stories.tsx +75 -75
- package/src/stories/kit/builder/Form.Simple.stories.tsx +91 -91
- package/src/stories/kit/builder/Form.Time.stories.tsx +68 -68
- package/src/stories/kit/builder/Page.stories.tsx +115 -115
- package/src/stories/kit/builder/Section.stories.tsx +282 -282
- package/src/stories/kit/components/Autocomplete.stories.tsx +313 -313
- package/src/stories/kit/components/DatePicker.stories.tsx +195 -195
- package/src/stories/kit/components/DateRangePicker.stories.tsx +195 -195
- package/src/stories/kit/components/Keyboard.stories.tsx +263 -263
- package/src/stories/kit/components/Login.stories.tsx +167 -167
- package/src/stories/kit/components/MonthPicker.stories.tsx +100 -100
- package/src/stories/kit/components/MonthRangePicker.stories.tsx +117 -117
- package/src/stories/kit/components/Numpad.stories.tsx +195 -195
- package/src/stories/kit/components/TimePicker.stories.tsx +71 -71
- package/src/stories/kit/components/TimeRangePicker.stories.tsx +43 -43
- package/src/stories/kit/layouts/admin/AdminLayout.Basic.stories.tsx +118 -118
- package/src/stories/kit/layouts/admin/AdminLayout.Collapsible.stories.tsx +81 -81
- package/src/stories/kit/layouts/admin/AdminLayout.Complex.stories.tsx +251 -251
- package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarHeaderComponent.stories.tsx +80 -80
- package/src/stories/kit/layouts/admin/AdminLayout.CustomSidebarTitleAndIcon.stories.tsx +70 -70
- package/src/stories/kit/layouts/admin/AdminLayout.HeaderSlots.stories.tsx +87 -87
- package/src/stories/shadcn/ui/Accordion.stories.tsx +117 -117
- package/src/stories/shadcn/ui/Alert.stories.tsx +36 -36
- package/src/stories/shadcn/ui/AlertDialog.stories.tsx +73 -73
- package/src/stories/shadcn/ui/AspectRatio.stories.tsx +58 -58
- package/src/stories/shadcn/ui/Avatar.stories.tsx +26 -26
- package/src/stories/shadcn/ui/Badge.stories.tsx +28 -28
- package/src/stories/shadcn/ui/Breadcrumb.stories.tsx +47 -47
- package/src/stories/shadcn/ui/Button.stories.tsx +51 -51
- package/src/stories/shadcn/ui/Calendar.stories.tsx +33 -33
- package/src/stories/shadcn/ui/Card.stories.tsx +39 -39
- package/src/stories/shadcn/ui/Carousel.stories.tsx +37 -37
- package/src/stories/shadcn/ui/Chart.stories.tsx +72 -72
- package/src/stories/shadcn/ui/Checkbox.stories.tsx +64 -64
- package/src/stories/shadcn/ui/Collapsible.stories.tsx +40 -40
- package/src/stories/shadcn/ui/Command.stories.tsx +53 -53
- package/src/stories/shadcn/ui/ContextMenu.stories.tsx +67 -67
- package/src/stories/shadcn/ui/Dialog.stories.tsx +45 -45
- package/src/stories/shadcn/ui/Drawer.stories.tsx +49 -49
- package/src/stories/shadcn/ui/DropdownMenu.stories.tsx +75 -75
- package/src/stories/shadcn/ui/Form.stories.tsx +93 -93
- package/src/stories/shadcn/ui/HoverCard.stories.tsx +43 -43
- package/src/stories/shadcn/ui/Input.stories.tsx +41 -41
- package/src/stories/shadcn/ui/InputOtp.stories.tsx +39 -39
- package/src/stories/shadcn/ui/Label.stories.tsx +29 -29
- package/src/stories/shadcn/ui/Menubar.stories.tsx +87 -87
- package/src/stories/shadcn/ui/NavigationMenu.stories.tsx +78 -78
- package/src/stories/shadcn/ui/Pagination.stories.tsx +51 -51
- package/src/stories/shadcn/ui/Popover.stories.tsx +53 -53
- package/src/stories/shadcn/ui/Progress.stories.tsx +30 -30
- package/src/stories/shadcn/ui/RadioGroup.stories.tsx +31 -31
- package/src/stories/shadcn/ui/Resizable.stories.tsx +55 -55
- package/src/stories/shadcn/ui/ScrollArea.stories.tsx +84 -84
- package/src/stories/shadcn/ui/Select.stories.tsx +61 -61
- package/src/stories/shadcn/ui/Separator.stories.tsx +35 -35
- package/src/stories/shadcn/ui/Sheet.stories.tsx +48 -48
- package/src/stories/shadcn/ui/Sidebar.stories.tsx +131 -131
- package/src/stories/shadcn/ui/Skeleton.stories.tsx +23 -23
- package/src/stories/shadcn/ui/Slider.stories.tsx +21 -21
- package/src/stories/shadcn/ui/Sonner.stories.tsx +49 -49
- package/src/stories/shadcn/ui/Switch.stories.tsx +28 -28
- package/src/stories/shadcn/ui/Table.stories.tsx +374 -374
- package/src/stories/shadcn/ui/Tabs.stories.tsx +31 -31
- package/src/stories/shadcn/ui/Textarea.stories.tsx +42 -42
- package/src/stories/shadcn/ui/Toggle.stories.tsx +44 -44
- package/src/stories/shadcn/ui/ToggleGroup.stories.tsx +28 -28
- package/src/stories/shadcn/ui/Tooltip.stories.tsx +30 -30
- package/tsconfig.json +20 -20
- package/tsconfig.lib.json +52 -52
- package/tsconfig.spec.json +38 -38
- package/vite.config.ts +93 -93
- package/storybook-static/assets/Accordion.stories-KU4JBR8U.js +0 -52
- package/storybook-static/assets/AdminLayout-CPvVCwfY.js +0 -53
- package/storybook-static/assets/AdminLayout.Basic.stories-DkP2UVXe.js +0 -4
- package/storybook-static/assets/AdminLayout.Collapsible.stories-BuuVjtpW.js +0 -4
- package/storybook-static/assets/AdminLayout.Complex.stories-D-k4H0hJ.js +0 -29
- package/storybook-static/assets/AdminLayout.CustomSidebarHeaderComponent.stories-B_0IEDd4.js +0 -9
- package/storybook-static/assets/AdminLayout.CustomSidebarTitleAndIcon.stories-CvAeXUyA.js +0 -4
- package/storybook-static/assets/AdminLayout.HeaderSlots.stories-RBFHoSZK.js +0 -7
- package/storybook-static/assets/Alert.stories-DKxKtIc0.js +0 -27
- package/storybook-static/assets/AlertDialog.stories-BqTpZ_nG.js +0 -43
- package/storybook-static/assets/AspectRatio.stories-DPO9QQ5F.js +0 -22
- package/storybook-static/assets/Autocomplete-Cpg4CaJe.js +0 -56
- package/storybook-static/assets/Autocomplete.stories-CWj4G5fh.js +0 -56
- package/storybook-static/assets/Avatar.stories-DPhov_2g.js +0 -12
- package/storybook-static/assets/Badge.stories-DFKrRdXq.js +0 -12
- package/storybook-static/assets/Breadcrumb.stories-CTE6CZUC.js +0 -25
- package/storybook-static/assets/Button.stories-cbt2InL-.js +0 -26
- package/storybook-static/assets/Calendar.stories-DRhTw_43.js +0 -3
- package/storybook-static/assets/Card.stories-Isf6n_K3.js +0 -15
- package/storybook-static/assets/Carousel.stories-Cmg0I3fR.js +0 -15
- package/storybook-static/assets/Chart.stories-aQ-fNijT.js +0 -126
- package/storybook-static/assets/Checkbox.stories-B7YMXPDc.js +0 -12
- package/storybook-static/assets/Collapsible.stories-BUzl17ZZ.js +0 -18
- package/storybook-static/assets/Combination-BdQWAuko.js +0 -41
- package/storybook-static/assets/Command.stories-DzBlWQs0.js +0 -30
- package/storybook-static/assets/ContextMenu.stories-CJlBQyXc.js +0 -31
- package/storybook-static/assets/DataTable.Basic.stories-BWYKFDmK.js +0 -6
- package/storybook-static/assets/DataTable.Filters.stories-uZdtJk8t.js +0 -21
- package/storybook-static/assets/DataTable.Pagination.stories-C5N1khkp.js +0 -24
- package/storybook-static/assets/DataTable.SelectionAndActions.stories-FhCqZKvO.js +0 -26
- package/storybook-static/assets/DataTable.Sorting.stories-D-k7EtRj.js +0 -6
- package/storybook-static/assets/Dialog.stories-C62AF-Gx.js +0 -54
- package/storybook-static/assets/Dialog.stories-lrjRwOus.js +0 -18
- package/storybook-static/assets/Drawer.stories-CGjkdJeV.js +0 -24
- package/storybook-static/assets/DropdownMenu.stories-DkGClRAA.js +0 -35
- package/storybook-static/assets/Form.ArrayLayouts.stories-C5d_062d.js +0 -130
- package/storybook-static/assets/Form.Autocomplete.stories-CPZPkk4o.js +0 -142
- package/storybook-static/assets/Form.Basic.stories-Bhcu3-3n.js +0 -58
- package/storybook-static/assets/Form.Complex.stories-QnXh5a7Q.js +0 -361
- package/storybook-static/assets/Form.Dynamic.stories-DFW6wIuT.js +0 -502
- package/storybook-static/assets/Form.Simple.stories-BhJcyhbE.js +0 -53
- package/storybook-static/assets/Form.stories-PFNsMYxO.js +0 -3
- package/storybook-static/assets/FormBuilder-BQBBxo_k.js +0 -5
- package/storybook-static/assets/HoverCard.stories-CAlQEVn8.js +0 -21
- package/storybook-static/assets/Input.stories-CEhODt0V.js +0 -16
- package/storybook-static/assets/InputOtp.stories-DSvNP4dS.js +0 -42
- package/storybook-static/assets/Label.stories-B3pa8ZLY.js +0 -14
- package/storybook-static/assets/Login.stories-C7KQkmR_.js +0 -37
- package/storybook-static/assets/Menubar.stories-CHXhSHxc.js +0 -44
- package/storybook-static/assets/MonthPicker.stories-BnrOc4fm.js +0 -99
- package/storybook-static/assets/MonthRangePicker.stories-55Gk1t-7.js +0 -134
- package/storybook-static/assets/NavigationMenu.stories-CXoS080P.js +0 -30
- package/storybook-static/assets/Page.stories-GdSJgZ6-.js +0 -91
- package/storybook-static/assets/Pagination.stories-BEBwqH4N.js +0 -29
- package/storybook-static/assets/Popover.stories-BICy98Cw.js +0 -15
- package/storybook-static/assets/Progress.stories-DECHNOME.js +0 -8
- package/storybook-static/assets/RadioGroup.stories-DA7-uKfV.js +0 -16
- package/storybook-static/assets/Resizable.stories-B99kWkH7.js +0 -25
- package/storybook-static/assets/ScrollArea.stories-BqvUAXqU.js +0 -12
- package/storybook-static/assets/Section.stories-lFMlFBQn.js +0 -277
- package/storybook-static/assets/SectionBuilder-BQW705x0.js +0 -1
- package/storybook-static/assets/Select.stories-BsKyZ6Io.js +0 -17
- package/storybook-static/assets/Separator.stories-BTDOaOM2.js +0 -17
- package/storybook-static/assets/Sheet.stories-Cam1gR6G.js +0 -24
- package/storybook-static/assets/Sidebar.stories-DnOa6G7y.js +0 -106
- package/storybook-static/assets/Skeleton.stories-BQNIuIe5.js +0 -9
- package/storybook-static/assets/Slider.stories-Bslq7hjq.js +0 -6
- package/storybook-static/assets/Sonner.stories-D34pBBtI.js +0 -18
- package/storybook-static/assets/Switch.stories-Puyb1-Bx.js +0 -3
- package/storybook-static/assets/Table.stories-ClZxAhut.js +0 -35
- package/storybook-static/assets/Tabs.stories-CURNTETB.js +0 -10
- package/storybook-static/assets/Textarea.stories-Cf1ZBrWw.js +0 -17
- package/storybook-static/assets/Toggle.stories-CdMHY_bi.js +0 -3
- package/storybook-static/assets/ToggleGroup.stories-BM68m1dX.js +0 -13
- package/storybook-static/assets/Tooltip.stories-DiQv64dM.js +0 -10
- package/storybook-static/assets/accordion-DVgwQcnw.js +0 -1
- package/storybook-static/assets/alert-dialog-DCUEwpqm.js +0 -7
- package/storybook-static/assets/avatar-BzwOE-mi.js +0 -1
- package/storybook-static/assets/axe-HmUsR1st.js +0 -30
- package/storybook-static/assets/badge-BnQWua6u.js +0 -1
- package/storybook-static/assets/button-0oMkiryo.js +0 -1
- package/storybook-static/assets/card-BJpPOzP8.js +0 -1
- package/storybook-static/assets/chart-column-DZGb4ZZS.js +0 -6
- package/storybook-static/assets/check-B9hBGj6o.js +0 -6
- package/storybook-static/assets/checkbox-CyIeaWHX.js +0 -1
- package/storybook-static/assets/chevron-down-D_37S6il.js +0 -6
- package/storybook-static/assets/chevron-left-BBoN0vbI.js +0 -6
- package/storybook-static/assets/chevron-right-B5vIMLxK.js +0 -6
- package/storybook-static/assets/circle-C5Lzx6Nx.js +0 -6
- package/storybook-static/assets/clean-slate-D1HmMFJM.css +0 -1
- package/storybook-static/assets/command-Csa9p8_a.js +0 -6
- package/storybook-static/assets/createLucideIcon-BrHXro7t.js +0 -21
- package/storybook-static/assets/default-CN_Fo1GY.css +0 -1
- package/storybook-static/assets/dependencies-ctrV69dx.js +0 -1
- package/storybook-static/assets/dialog-CsnqITTn.js +0 -1
- package/storybook-static/assets/dropdown-menu-BWxxwPHL.js +0 -1
- package/storybook-static/assets/ellipsis-BRS038RR.js +0 -6
- package/storybook-static/assets/grip-vertical-BxXG8KNA.js +0 -6
- package/storybook-static/assets/iframe-C9bogcIc.css +0 -1
- package/storybook-static/assets/iframe-v7iAhKit.js +0 -1555
- package/storybook-static/assets/index-0-qMRXou.js +0 -1
- package/storybook-static/assets/index-AvwFFKJc.js +0 -1
- package/storybook-static/assets/index-BVDb4dFc.js +0 -1
- package/storybook-static/assets/index-B_qx7A5T.js +0 -1
- package/storybook-static/assets/index-BdQq_4o_.js +0 -1
- package/storybook-static/assets/index-BfiCOk42.js +0 -1
- package/storybook-static/assets/index-Bv9yk470.js +0 -1
- package/storybook-static/assets/index-Bw1A27Kp.js +0 -1
- package/storybook-static/assets/index-ByqivBWx.js +0 -1
- package/storybook-static/assets/index-C9Ta0ZTH.js +0 -1
- package/storybook-static/assets/index-CDY5kTx5.js +0 -1
- package/storybook-static/assets/index-CGnyVRgB.js +0 -1
- package/storybook-static/assets/index-CGrAONsN.js +0 -1
- package/storybook-static/assets/index-CWjrGFAQ.js +0 -1
- package/storybook-static/assets/index-CwBdPBFz.js +0 -9
- package/storybook-static/assets/index-D8RXF03I.js +0 -1
- package/storybook-static/assets/index-DLIxT4Z7.js +0 -1
- package/storybook-static/assets/index-DW48STyt.js +0 -1
- package/storybook-static/assets/index-DbaA6-o1.js +0 -1
- package/storybook-static/assets/index-Dph_5COR.js +0 -1
- package/storybook-static/assets/index-DrN5n71E.js +0 -1
- package/storybook-static/assets/index-Tp9IdbR8.js +0 -1
- package/storybook-static/assets/index-WyF3-wTE.js +0 -9
- package/storybook-static/assets/index-XSmPROEP.js +0 -1
- package/storybook-static/assets/index-Z6wF44KX.js +0 -5
- package/storybook-static/assets/index-_RPqOjlQ.js +0 -1
- package/storybook-static/assets/index-jrimW4QO.js +0 -1
- package/storybook-static/assets/index-nqc17SX4.js +0 -1
- package/storybook-static/assets/input-11YRd9gD.js +0 -1
- package/storybook-static/assets/jsx-runtime-D_zvdyIk.js +0 -9
- package/storybook-static/assets/label-Do8ODIVk.js +0 -1
- package/storybook-static/assets/lodash-DDwpuhPG.js +0 -73
- package/storybook-static/assets/matchers-7Z3WT2CE-T3xScrR7.js +0 -14
- package/storybook-static/assets/minimal-modern-BlYVzfQU.css +0 -1
- package/storybook-static/assets/popover-CcciSWAw.js +0 -1
- package/storybook-static/assets/preload-helper-Dp1pzeXC.js +0 -1
- package/storybook-static/assets/radio-group-DiJ0Y_KQ.js +0 -1
- package/storybook-static/assets/react-18-Cr9fq_Ip.js +0 -25
- package/storybook-static/assets/react-icons.esm-B_ULMmNU.js +0 -1
- package/storybook-static/assets/refresh-cw-BmRDhIV_.js +0 -6
- package/storybook-static/assets/schemas-CGNYCiJ6.js +0 -18
- package/storybook-static/assets/section-factories-DCCY9R35.js +0 -1
- package/storybook-static/assets/select-DDrkxaOg.js +0 -6
- package/storybook-static/assets/separator-o5SAUnaJ.js +0 -1
- package/storybook-static/assets/settings-2-xWGvvbG6.js +0 -6
- package/storybook-static/assets/sheet-C7jhU3XE.js +0 -1
- package/storybook-static/assets/shopping-cart-BFlrufvo.js +0 -11
- package/storybook-static/assets/sidebar-C8hU1Mxy.js +0 -6
- package/storybook-static/assets/skeleton-CjDnQs43.js +0 -1
- package/storybook-static/assets/spotify-CUDj7g8m.css +0 -1
- package/storybook-static/assets/switch-CKGRuk3u.js +0 -1
- package/storybook-static/assets/table-CP3vMqFn.js +0 -1
- package/storybook-static/assets/tabs-CopK2m3j.js +0 -1
- package/storybook-static/assets/textarea-Dw2vruMl.js +0 -1
- package/storybook-static/assets/toggle-DmHbWetf.js +0 -16
- package/storybook-static/assets/tooltip-_LqYEYFw.js +0 -1
- package/storybook-static/assets/trash-2-xdbApPby.js +0 -11
- package/storybook-static/assets/utils-D-KgF5mV.js +0 -1
- package/storybook-static/assets/x-B1a4fyWM.js +0 -6
- package/storybook-static/favicon-wrapper.svg +0 -46
- package/storybook-static/favicon.svg +0 -1
- package/storybook-static/iframe.html +0 -687
- package/storybook-static/index.d.ts +0 -64
- package/storybook-static/index.d.ts.map +0 -1
- package/storybook-static/index.html +0 -166
- package/storybook-static/index.json +0 -1
- package/storybook-static/kit/builder/data-table/components/DataTable.d.ts +0 -37
- package/storybook-static/kit/builder/data-table/components/DataTable.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/components/DataTableColumnHeader.d.ts +0 -8
- package/storybook-static/kit/builder/data-table/components/DataTableColumnHeader.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/components/DataTablePagination.d.ts +0 -6
- package/storybook-static/kit/builder/data-table/components/DataTablePagination.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/components/DataTableViewOptions.d.ts +0 -5
- package/storybook-static/kit/builder/data-table/components/DataTableViewOptions.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/index.d.ts +0 -7
- package/storybook-static/kit/builder/data-table/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/types.d.ts +0 -27
- package/storybook-static/kit/builder/data-table/types.d.ts.map +0 -1
- package/storybook-static/kit/builder/data-table/utils/dotAccessor.d.ts +0 -2
- package/storybook-static/kit/builder/data-table/utils/dotAccessor.d.ts.map +0 -1
- package/storybook-static/kit/builder/dialog/index.d.ts +0 -3
- package/storybook-static/kit/builder/dialog/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/dialog/provider.d.ts +0 -26
- package/storybook-static/kit/builder/dialog/provider.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/FormBuilder.d.ts +0 -137
- package/storybook-static/kit/builder/form/components/FormBuilder.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/FormBuilderActions.d.ts +0 -20
- package/storybook-static/kit/builder/form/components/FormBuilderActions.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/FormBuilderField.d.ts +0 -12
- package/storybook-static/kit/builder/form/components/FormBuilderField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/ArrayField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/ArrayField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/AutocompleteField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/AutocompleteField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/CheckboxField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/CheckboxField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/DateField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/DateField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/FileField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/FileField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/NumberField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/NumberField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/ObjectField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/ObjectField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/RadioField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/RadioField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/SelectField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/SelectField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/SwitchField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/SwitchField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/TextField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/TextField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/TextareaField.d.ts +0 -3
- package/storybook-static/kit/builder/form/components/fields/TextareaField.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/index.d.ts +0 -14
- package/storybook-static/kit/builder/form/components/fields/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/fields/types.d.ts +0 -14
- package/storybook-static/kit/builder/form/components/fields/types.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/components/index.d.ts +0 -4
- package/storybook-static/kit/builder/form/components/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/index.d.ts +0 -3
- package/storybook-static/kit/builder/form/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/common-forms.d.ts +0 -7
- package/storybook-static/kit/builder/form/utils/common-forms.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/dependencies.d.ts +0 -41
- package/storybook-static/kit/builder/form/utils/dependencies.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/field-factories.d.ts +0 -23
- package/storybook-static/kit/builder/form/utils/field-factories.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/index.d.ts +0 -15
- package/storybook-static/kit/builder/form/utils/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/section-factories.d.ts +0 -7
- package/storybook-static/kit/builder/form/utils/section-factories.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/transformers.d.ts +0 -6
- package/storybook-static/kit/builder/form/utils/transformers.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/validations.d.ts +0 -13
- package/storybook-static/kit/builder/form/utils/validations.d.ts.map +0 -1
- package/storybook-static/kit/builder/form/utils/validators.d.ts +0 -8
- package/storybook-static/kit/builder/form/utils/validators.d.ts.map +0 -1
- package/storybook-static/kit/builder/page/Page.d.ts +0 -48
- package/storybook-static/kit/builder/page/Page.d.ts.map +0 -1
- package/storybook-static/kit/builder/page/index.d.ts +0 -2
- package/storybook-static/kit/builder/page/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/section/SectionBuilder.d.ts +0 -3
- package/storybook-static/kit/builder/section/SectionBuilder.d.ts.map +0 -1
- package/storybook-static/kit/builder/section/index.d.ts +0 -3
- package/storybook-static/kit/builder/section/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/section/types.d.ts +0 -70
- package/storybook-static/kit/builder/section/types.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/context.d.ts +0 -3
- package/storybook-static/kit/builder/stack-dialog/context.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/hooks.d.ts +0 -6
- package/storybook-static/kit/builder/stack-dialog/hooks.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/index.d.ts +0 -5
- package/storybook-static/kit/builder/stack-dialog/index.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/provider.d.ts +0 -3
- package/storybook-static/kit/builder/stack-dialog/provider.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/renderer.d.ts +0 -6
- package/storybook-static/kit/builder/stack-dialog/renderer.d.ts.map +0 -1
- package/storybook-static/kit/builder/stack-dialog/types.d.ts +0 -20
- package/storybook-static/kit/builder/stack-dialog/types.d.ts.map +0 -1
- package/storybook-static/kit/components/autocomplete/Autocomplete.d.ts +0 -53
- package/storybook-static/kit/components/autocomplete/Autocomplete.d.ts.map +0 -1
- package/storybook-static/kit/components/autocomplete/index.d.ts +0 -4
- package/storybook-static/kit/components/autocomplete/index.d.ts.map +0 -1
- package/storybook-static/kit/components/autocomplete/types.d.ts +0 -19
- package/storybook-static/kit/components/autocomplete/types.d.ts.map +0 -1
- package/storybook-static/kit/components/login/Login.d.ts +0 -29
- package/storybook-static/kit/components/login/Login.d.ts.map +0 -1
- package/storybook-static/kit/components/login/index.d.ts +0 -2
- package/storybook-static/kit/components/login/index.d.ts.map +0 -1
- package/storybook-static/kit/components/monthpicker/MonthPicker.d.ts +0 -32
- package/storybook-static/kit/components/monthpicker/MonthPicker.d.ts.map +0 -1
- package/storybook-static/kit/components/monthpicker/MonthRangePicker.d.ts +0 -48
- package/storybook-static/kit/components/monthpicker/MonthRangePicker.d.ts.map +0 -1
- package/storybook-static/kit/layouts/admin/components/AdminLayout.d.ts +0 -17
- package/storybook-static/kit/layouts/admin/components/AdminLayout.d.ts.map +0 -1
- package/storybook-static/kit/layouts/admin/components/ThemeToggle.d.ts +0 -5
- package/storybook-static/kit/layouts/admin/components/ThemeToggle.d.ts.map +0 -1
- package/storybook-static/kit/layouts/admin/hooks/menu.d.ts +0 -13
- package/storybook-static/kit/layouts/admin/hooks/menu.d.ts.map +0 -1
- package/storybook-static/kit/layouts/admin/providers/AdminMenuProvider.d.ts +0 -7
- package/storybook-static/kit/layouts/admin/providers/AdminMenuProvider.d.ts.map +0 -1
- package/storybook-static/kit/layouts/admin/types/index.d.ts +0 -27
- package/storybook-static/kit/layouts/admin/types/index.d.ts.map +0 -1
- package/storybook-static/kit/providers/ThemeProvider.d.ts +0 -14
- package/storybook-static/kit/providers/ThemeProvider.d.ts.map +0 -1
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +0 -1
- package/storybook-static/sb-addons/a11y-5/manager-bundle.js +0 -5
- package/storybook-static/sb-addons/essentials-backgrounds-1/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-measure-2/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-outline-3/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/interactions-4/manager-bundle.js +0 -57
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -971
- package/storybook-static/sb-addons/storysource-6/manager-bundle.js +0 -3
- package/storybook-static/sb-common-assets/favicon-wrapper.svg +0 -46
- package/storybook-static/sb-common-assets/favicon.svg +0 -1
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +0 -797
- package/storybook-static/sb-manager/globals-runtime.js +0 -69653
- package/storybook-static/sb-manager/globals.js +0 -34
- package/storybook-static/sb-manager/runtime.js +0 -13181
- package/storybook-static/shadcn/hooks/use-mobile.d.ts +0 -2
- package/storybook-static/shadcn/hooks/use-mobile.d.ts.map +0 -1
- package/storybook-static/shadcn/lib/utils.d.ts +0 -3
- package/storybook-static/shadcn/lib/utils.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/accordion.d.ts +0 -8
- package/storybook-static/shadcn/ui/accordion.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/alert-dialog.d.ts +0 -15
- package/storybook-static/shadcn/ui/alert-dialog.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/alert.d.ts +0 -10
- package/storybook-static/shadcn/ui/alert.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/aspect-ratio.d.ts +0 -4
- package/storybook-static/shadcn/ui/aspect-ratio.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/avatar.d.ts +0 -7
- package/storybook-static/shadcn/ui/avatar.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/badge.d.ts +0 -10
- package/storybook-static/shadcn/ui/badge.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/breadcrumb.d.ts +0 -12
- package/storybook-static/shadcn/ui/breadcrumb.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/button.d.ts +0 -11
- package/storybook-static/shadcn/ui/button.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/calendar.d.ts +0 -9
- package/storybook-static/shadcn/ui/calendar.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/card.d.ts +0 -10
- package/storybook-static/shadcn/ui/card.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/carousel.d.ts +0 -20
- package/storybook-static/shadcn/ui/carousel.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/chart.d.ts +0 -41
- package/storybook-static/shadcn/ui/chart.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/checkbox.d.ts +0 -5
- package/storybook-static/shadcn/ui/checkbox.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/collapsible.d.ts +0 -6
- package/storybook-static/shadcn/ui/collapsible.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/command.d.ts +0 -19
- package/storybook-static/shadcn/ui/command.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/context-menu.d.ts +0 -26
- package/storybook-static/shadcn/ui/context-menu.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/dialog.d.ts +0 -16
- package/storybook-static/shadcn/ui/dialog.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/drawer.d.ts +0 -14
- package/storybook-static/shadcn/ui/drawer.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/dropdown-menu.d.ts +0 -26
- package/storybook-static/shadcn/ui/dropdown-menu.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/form.d.ts +0 -25
- package/storybook-static/shadcn/ui/form.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/hover-card.d.ts +0 -7
- package/storybook-static/shadcn/ui/hover-card.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/input-otp.d.ts +0 -12
- package/storybook-static/shadcn/ui/input-otp.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/input.d.ts +0 -4
- package/storybook-static/shadcn/ui/input.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/label.d.ts +0 -5
- package/storybook-static/shadcn/ui/label.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/menubar.d.ts +0 -27
- package/storybook-static/shadcn/ui/menubar.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/navigation-menu.d.ts +0 -15
- package/storybook-static/shadcn/ui/navigation-menu.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/pagination.d.ts +0 -14
- package/storybook-static/shadcn/ui/pagination.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/popover.d.ts +0 -8
- package/storybook-static/shadcn/ui/popover.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/progress.d.ts +0 -5
- package/storybook-static/shadcn/ui/progress.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/radio-group.d.ts +0 -6
- package/storybook-static/shadcn/ui/radio-group.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/resizable.d.ts +0 -9
- package/storybook-static/shadcn/ui/resizable.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/scroll-area.d.ts +0 -6
- package/storybook-static/shadcn/ui/scroll-area.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/select.d.ts +0 -16
- package/storybook-static/shadcn/ui/select.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/separator.d.ts +0 -5
- package/storybook-static/shadcn/ui/separator.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/sheet.d.ts +0 -14
- package/storybook-static/shadcn/ui/sheet.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/sidebar.d.ts +0 -70
- package/storybook-static/shadcn/ui/sidebar.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/skeleton.d.ts +0 -3
- package/storybook-static/shadcn/ui/skeleton.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/slider.d.ts +0 -5
- package/storybook-static/shadcn/ui/slider.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/sonner.d.ts +0 -4
- package/storybook-static/shadcn/ui/sonner.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/switch.d.ts +0 -5
- package/storybook-static/shadcn/ui/switch.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/table.d.ts +0 -11
- package/storybook-static/shadcn/ui/table.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/tabs.d.ts +0 -8
- package/storybook-static/shadcn/ui/tabs.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/textarea.d.ts +0 -4
- package/storybook-static/shadcn/ui/textarea.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/toggle-group.d.ts +0 -8
- package/storybook-static/shadcn/ui/toggle-group.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/toggle.d.ts +0 -10
- package/storybook-static/shadcn/ui/toggle.d.ts.map +0 -1
- package/storybook-static/shadcn/ui/tooltip.d.ts +0 -8
- package/storybook-static/shadcn/ui/tooltip.d.ts.map +0 -1
- package/storybook-static/vite-inject-mocker-entry.js +0 -18
|
@@ -1,437 +1,437 @@
|
|
|
1
|
-
import { createMemoryStorage } from './storage';
|
|
2
|
-
import { createTokenManager } from './token-manager';
|
|
3
|
-
import {
|
|
4
|
-
checkPermissions,
|
|
5
|
-
checkRoles,
|
|
6
|
-
evaluatePermissionRule,
|
|
7
|
-
expandPermissions,
|
|
8
|
-
expandRoles,
|
|
9
|
-
} from './permission-checker';
|
|
10
|
-
import type {
|
|
11
|
-
AuthAdapter,
|
|
12
|
-
AuthAdapterConfig,
|
|
13
|
-
AuthAdapterState,
|
|
14
|
-
AuthAdapterSubscriber,
|
|
15
|
-
AuthSession,
|
|
16
|
-
AuthStatus,
|
|
17
|
-
PermissionPolicy,
|
|
18
|
-
PermissionRule,
|
|
19
|
-
} from '../types';
|
|
20
|
-
|
|
21
|
-
const unique = <T>(values: T[]): T[] => {
|
|
22
|
-
return Array.from(new Set(values));
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Enhanced Authentication Adapter
|
|
27
|
-
*
|
|
28
|
-
* Features:
|
|
29
|
-
* - Token management with auto-refresh
|
|
30
|
-
* - Permission and role hierarchies
|
|
31
|
-
* - Middleware support
|
|
32
|
-
* - Retry logic
|
|
33
|
-
* - Advanced permission checking (AND/OR policies)
|
|
34
|
-
* - Session persistence
|
|
35
|
-
*/
|
|
36
|
-
export function createAuthAdapter<
|
|
37
|
-
TUser = unknown,
|
|
38
|
-
TRole extends string = string,
|
|
39
|
-
TPermission extends string = string,
|
|
40
|
-
TSession extends AuthSession<TUser, TRole, TPermission> = AuthSession<
|
|
41
|
-
TUser,
|
|
42
|
-
TRole,
|
|
43
|
-
TPermission
|
|
44
|
-
>,
|
|
45
|
-
TCredentials = unknown,
|
|
46
|
-
>(
|
|
47
|
-
config: AuthAdapterConfig<TUser, TRole, TPermission, TSession, TCredentials>,
|
|
48
|
-
): AuthAdapter<TUser, TRole, TPermission, TSession, TCredentials> {
|
|
49
|
-
// ============================================================================
|
|
50
|
-
// Configuration & State
|
|
51
|
-
// ============================================================================
|
|
52
|
-
|
|
53
|
-
const storage = config.storage ?? createMemoryStorage<TSession>();
|
|
54
|
-
const tokenManager =
|
|
55
|
-
config.tokenManager ??
|
|
56
|
-
createTokenManager({
|
|
57
|
-
refreshThreshold: config.refreshThreshold ?? 300,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const subscribers = new Set<
|
|
61
|
-
AuthAdapterSubscriber<TSession, TUser, TRole, TPermission>
|
|
62
|
-
>();
|
|
63
|
-
|
|
64
|
-
const resolveUser =
|
|
65
|
-
config.resolveUser ?? ((session: TSession | null) => session?.user ?? null);
|
|
66
|
-
const resolveRoles =
|
|
67
|
-
config.resolveRoles ??
|
|
68
|
-
((session: TSession | null) =>
|
|
69
|
-
session?.roles?.filter((role): role is TRole => role != null) ?? []);
|
|
70
|
-
const resolvePermissions =
|
|
71
|
-
config.resolvePermissions ??
|
|
72
|
-
((session: TSession | null) =>
|
|
73
|
-
session?.permissions?.filter(
|
|
74
|
-
(permission): permission is TPermission => permission != null,
|
|
75
|
-
) ?? []);
|
|
76
|
-
|
|
77
|
-
let state: AuthAdapterState<TSession, TUser, TRole, TPermission> = {
|
|
78
|
-
status: 'idle',
|
|
79
|
-
session: null,
|
|
80
|
-
user: null,
|
|
81
|
-
roles: [],
|
|
82
|
-
permissions: [],
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
let autoRefreshCleanup: (() => void) | null = null;
|
|
86
|
-
|
|
87
|
-
// ============================================================================
|
|
88
|
-
// Middleware Execution
|
|
89
|
-
// ============================================================================
|
|
90
|
-
|
|
91
|
-
const executeMiddleware = async <
|
|
92
|
-
T extends keyof NonNullable<typeof config.middleware>[number],
|
|
93
|
-
>(
|
|
94
|
-
hook: T,
|
|
95
|
-
...args: Parameters<
|
|
96
|
-
NonNullable<NonNullable<typeof config.middleware>[number][T]>
|
|
97
|
-
>
|
|
98
|
-
): Promise<void> => {
|
|
99
|
-
if (!config.middleware) return;
|
|
100
|
-
|
|
101
|
-
for (const middleware of config.middleware) {
|
|
102
|
-
const fn = middleware[hook];
|
|
103
|
-
if (fn) {
|
|
104
|
-
try {
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
|
-
await (fn as any)(...args);
|
|
107
|
-
} catch (error) {
|
|
108
|
-
console.error(`[auth2] Middleware error in ${String(hook)}:`, error);
|
|
109
|
-
if (middleware.onError) {
|
|
110
|
-
await middleware.onError(error);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
// ============================================================================
|
|
118
|
-
// State Management
|
|
119
|
-
// ============================================================================
|
|
120
|
-
|
|
121
|
-
const notify = () => {
|
|
122
|
-
for (const listener of subscribers) listener(state);
|
|
123
|
-
config.onStateChange?.(state);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const setState = (
|
|
127
|
-
next: AuthAdapterState<TSession, TUser, TRole, TPermission>,
|
|
128
|
-
) => {
|
|
129
|
-
state = next;
|
|
130
|
-
notify();
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const computeState = (
|
|
134
|
-
session: TSession | null,
|
|
135
|
-
status: AuthStatus,
|
|
136
|
-
error?: unknown,
|
|
137
|
-
): AuthAdapterState<TSession, TUser, TRole, TPermission> => {
|
|
138
|
-
const user = resolveUser(session);
|
|
139
|
-
const baseRoles = resolveRoles(session);
|
|
140
|
-
const basePermissions = resolvePermissions(session);
|
|
141
|
-
|
|
142
|
-
// Apply hierarchies
|
|
143
|
-
const roles = unique(expandRoles(baseRoles, config.roleHierarchy));
|
|
144
|
-
const permissions = unique(
|
|
145
|
-
expandPermissions(basePermissions, config.permissionHierarchy),
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
const tokenExpiresIn = session?.expiresAt
|
|
149
|
-
? tokenManager.getTimeUntilExpiry(session.expiresAt)
|
|
150
|
-
: undefined;
|
|
151
|
-
|
|
152
|
-
return {
|
|
153
|
-
status,
|
|
154
|
-
session,
|
|
155
|
-
user,
|
|
156
|
-
roles,
|
|
157
|
-
permissions,
|
|
158
|
-
error,
|
|
159
|
-
lastRefresh: Date.now(),
|
|
160
|
-
tokenExpiresIn,
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
// ============================================================================
|
|
165
|
-
// Storage Operations
|
|
166
|
-
// ============================================================================
|
|
167
|
-
|
|
168
|
-
const readStorage = async () => {
|
|
169
|
-
const stored = await Promise.resolve(storage.get());
|
|
170
|
-
return stored ?? null;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
const writeStorage = async (next: TSession | null) => {
|
|
174
|
-
if (next === null) {
|
|
175
|
-
await Promise.resolve(storage.clear());
|
|
176
|
-
} else {
|
|
177
|
-
await Promise.resolve(storage.set(next));
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
// ============================================================================
|
|
182
|
-
// Auto-Refresh Management
|
|
183
|
-
// ============================================================================
|
|
184
|
-
|
|
185
|
-
const setupAutoRefresh = () => {
|
|
186
|
-
if (autoRefreshCleanup) {
|
|
187
|
-
autoRefreshCleanup();
|
|
188
|
-
autoRefreshCleanup = null;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (!config.autoRefresh || !config.refresh || !state.session?.expiresAt) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (tokenManager.scheduleRefresh) {
|
|
196
|
-
autoRefreshCleanup = tokenManager.scheduleRefresh(() => {
|
|
197
|
-
refresh().catch((error) => {
|
|
198
|
-
console.error('[auth2] Auto-refresh failed:', error);
|
|
199
|
-
});
|
|
200
|
-
}, state.session.expiresAt);
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
// ============================================================================
|
|
205
|
-
// Session Management
|
|
206
|
-
// ============================================================================
|
|
207
|
-
|
|
208
|
-
const setSession = async (
|
|
209
|
-
session: TSession | null,
|
|
210
|
-
statusOverride?: AuthStatus,
|
|
211
|
-
error?: unknown,
|
|
212
|
-
) => {
|
|
213
|
-
await writeStorage(session);
|
|
214
|
-
const status: AuthStatus =
|
|
215
|
-
statusOverride ?? (session ? 'authenticated' : 'unauthenticated');
|
|
216
|
-
const nextState = computeState(session, status, error);
|
|
217
|
-
setState(nextState);
|
|
218
|
-
|
|
219
|
-
setupAutoRefresh();
|
|
220
|
-
|
|
221
|
-
return nextState;
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
const sync = async () => {
|
|
225
|
-
setState({ ...state, status: 'loading' });
|
|
226
|
-
try {
|
|
227
|
-
const session =
|
|
228
|
-
(await config.loadSession?.()) ?? (await readStorage()) ?? null;
|
|
229
|
-
|
|
230
|
-
// Check if session is expired
|
|
231
|
-
if (session?.expiresAt && tokenManager.isExpired(session.expiresAt)) {
|
|
232
|
-
// Try to refresh if possible
|
|
233
|
-
if (config.refresh && session.refreshToken) {
|
|
234
|
-
try {
|
|
235
|
-
const refreshed = await config.refresh(session);
|
|
236
|
-
return await setSession(refreshed, 'authenticated');
|
|
237
|
-
} catch {
|
|
238
|
-
// Refresh failed, session is expired
|
|
239
|
-
await executeMiddleware('onSessionExpired');
|
|
240
|
-
return await setSession(null, 'unauthenticated');
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
await executeMiddleware('onSessionExpired');
|
|
245
|
-
return await setSession(null, 'unauthenticated');
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
return await setSession(
|
|
249
|
-
session,
|
|
250
|
-
session ? 'authenticated' : 'unauthenticated',
|
|
251
|
-
);
|
|
252
|
-
} catch (error) {
|
|
253
|
-
await executeMiddleware('onError', error);
|
|
254
|
-
return await setSession(null, 'error', error);
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
// ============================================================================
|
|
259
|
-
// Retry Logic
|
|
260
|
-
// ============================================================================
|
|
261
|
-
|
|
262
|
-
const withRetry = async <T>(
|
|
263
|
-
fn: () => Promise<T>,
|
|
264
|
-
context: string,
|
|
265
|
-
): Promise<T> => {
|
|
266
|
-
const maxRetries = config.retryConfig?.maxRetries ?? 0;
|
|
267
|
-
const retryDelay = config.retryConfig?.retryDelay ?? 1000;
|
|
268
|
-
const shouldRetry = config.retryConfig?.retryOn;
|
|
269
|
-
|
|
270
|
-
let lastError: unknown;
|
|
271
|
-
|
|
272
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
273
|
-
try {
|
|
274
|
-
return await fn();
|
|
275
|
-
} catch (error) {
|
|
276
|
-
lastError = error;
|
|
277
|
-
|
|
278
|
-
const isLastAttempt = attempt === maxRetries;
|
|
279
|
-
const shouldRetryError = shouldRetry ? shouldRetry(error) : false;
|
|
280
|
-
|
|
281
|
-
if (isLastAttempt || !shouldRetryError) {
|
|
282
|
-
throw error;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
console.warn(
|
|
286
|
-
`[auth2] ${context} failed (attempt ${attempt + 1}/${maxRetries + 1}), retrying...`,
|
|
287
|
-
);
|
|
288
|
-
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
throw lastError;
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
// ============================================================================
|
|
296
|
-
// Authentication Operations
|
|
297
|
-
// ============================================================================
|
|
298
|
-
|
|
299
|
-
const refresh = async () => {
|
|
300
|
-
const refreshFn = config.refresh;
|
|
301
|
-
const currentSession = state.session;
|
|
302
|
-
|
|
303
|
-
if (!refreshFn) return state;
|
|
304
|
-
if (!currentSession) return state;
|
|
305
|
-
|
|
306
|
-
try {
|
|
307
|
-
const refreshed = await withRetry(
|
|
308
|
-
() => refreshFn(currentSession),
|
|
309
|
-
'refresh',
|
|
310
|
-
);
|
|
311
|
-
const nextState = await setSession(refreshed, 'authenticated');
|
|
312
|
-
await executeMiddleware('onRefresh', nextState);
|
|
313
|
-
return nextState;
|
|
314
|
-
} catch (error) {
|
|
315
|
-
await executeMiddleware('onError', error);
|
|
316
|
-
return await setSession(state.session, 'error', error);
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
const login = async (credentials: TCredentials) => {
|
|
321
|
-
const loginFn = config.login;
|
|
322
|
-
if (!loginFn) throw new Error('Auth adapter login is not configured');
|
|
323
|
-
|
|
324
|
-
setState({ ...state, status: 'loading' });
|
|
325
|
-
|
|
326
|
-
try {
|
|
327
|
-
await executeMiddleware('onBeforeLogin', credentials);
|
|
328
|
-
|
|
329
|
-
const session = await withRetry(() => loginFn(credentials), 'login');
|
|
330
|
-
|
|
331
|
-
const nextState = await setSession(session, 'authenticated');
|
|
332
|
-
await executeMiddleware('onAfterLogin', nextState);
|
|
333
|
-
|
|
334
|
-
return nextState;
|
|
335
|
-
} catch (error) {
|
|
336
|
-
await executeMiddleware('onError', error);
|
|
337
|
-
await setSession(null, 'error', error);
|
|
338
|
-
throw error;
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
const logout = async () => {
|
|
343
|
-
const current = state.session;
|
|
344
|
-
|
|
345
|
-
try {
|
|
346
|
-
await executeMiddleware('onBeforeLogout');
|
|
347
|
-
await config.logout?.(current ?? null);
|
|
348
|
-
} finally {
|
|
349
|
-
if (autoRefreshCleanup) {
|
|
350
|
-
autoRefreshCleanup();
|
|
351
|
-
autoRefreshCleanup = null;
|
|
352
|
-
}
|
|
353
|
-
await setSession(null, 'unauthenticated');
|
|
354
|
-
await executeMiddleware('onAfterLogout');
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
// ============================================================================
|
|
359
|
-
// Permission Checking
|
|
360
|
-
// ============================================================================
|
|
361
|
-
|
|
362
|
-
const hasRole = (
|
|
363
|
-
target: TRole | TRole[],
|
|
364
|
-
options?: { requireAll?: boolean },
|
|
365
|
-
): boolean => {
|
|
366
|
-
return checkRoles(state.roles, target, options);
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
const hasPermission = (
|
|
370
|
-
target: TPermission | TPermission[] | PermissionPolicy<TPermission>,
|
|
371
|
-
options?: { requireAll?: boolean },
|
|
372
|
-
): boolean => {
|
|
373
|
-
return checkPermissions(state.permissions, target, options);
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
const can = (rule: PermissionRule<TRole, TPermission>): boolean => {
|
|
377
|
-
return evaluatePermissionRule(state.roles, state.permissions, rule);
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
// ============================================================================
|
|
381
|
-
// Token Management
|
|
382
|
-
// ============================================================================
|
|
383
|
-
|
|
384
|
-
const getToken = (): string | null => {
|
|
385
|
-
return state.session?.accessToken ?? null;
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
const isTokenExpired = (): boolean => {
|
|
389
|
-
return tokenManager.isExpired(state.session?.expiresAt);
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
const getTimeUntilExpiry = (): number => {
|
|
393
|
-
return tokenManager.getTimeUntilExpiry(state.session?.expiresAt);
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
const scheduleAutoRefresh = (): (() => void) => {
|
|
397
|
-
setupAutoRefresh();
|
|
398
|
-
return () => {
|
|
399
|
-
if (autoRefreshCleanup) {
|
|
400
|
-
autoRefreshCleanup();
|
|
401
|
-
autoRefreshCleanup = null;
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
// ============================================================================
|
|
407
|
-
// API
|
|
408
|
-
// ============================================================================
|
|
409
|
-
|
|
410
|
-
const api: AuthAdapter<TUser, TRole, TPermission, TSession, TCredentials> = {
|
|
411
|
-
getState: () => state,
|
|
412
|
-
subscribe: (listener) => {
|
|
413
|
-
subscribers.add(listener);
|
|
414
|
-
return () => {
|
|
415
|
-
subscribers.delete(listener);
|
|
416
|
-
};
|
|
417
|
-
},
|
|
418
|
-
sync,
|
|
419
|
-
login: config.login ? login : undefined,
|
|
420
|
-
logout,
|
|
421
|
-
refresh: async () => {
|
|
422
|
-
return await refresh();
|
|
423
|
-
},
|
|
424
|
-
setSession: async (session) => {
|
|
425
|
-
return await setSession(session);
|
|
426
|
-
},
|
|
427
|
-
hasRole,
|
|
428
|
-
hasPermission,
|
|
429
|
-
can,
|
|
430
|
-
getToken,
|
|
431
|
-
isTokenExpired,
|
|
432
|
-
getTimeUntilExpiry,
|
|
433
|
-
scheduleAutoRefresh,
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
return api;
|
|
437
|
-
}
|
|
1
|
+
import { createMemoryStorage } from './storage';
|
|
2
|
+
import { createTokenManager } from './token-manager';
|
|
3
|
+
import {
|
|
4
|
+
checkPermissions,
|
|
5
|
+
checkRoles,
|
|
6
|
+
evaluatePermissionRule,
|
|
7
|
+
expandPermissions,
|
|
8
|
+
expandRoles,
|
|
9
|
+
} from './permission-checker';
|
|
10
|
+
import type {
|
|
11
|
+
AuthAdapter,
|
|
12
|
+
AuthAdapterConfig,
|
|
13
|
+
AuthAdapterState,
|
|
14
|
+
AuthAdapterSubscriber,
|
|
15
|
+
AuthSession,
|
|
16
|
+
AuthStatus,
|
|
17
|
+
PermissionPolicy,
|
|
18
|
+
PermissionRule,
|
|
19
|
+
} from '../types';
|
|
20
|
+
|
|
21
|
+
const unique = <T>(values: T[]): T[] => {
|
|
22
|
+
return Array.from(new Set(values));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Enhanced Authentication Adapter
|
|
27
|
+
*
|
|
28
|
+
* Features:
|
|
29
|
+
* - Token management with auto-refresh
|
|
30
|
+
* - Permission and role hierarchies
|
|
31
|
+
* - Middleware support
|
|
32
|
+
* - Retry logic
|
|
33
|
+
* - Advanced permission checking (AND/OR policies)
|
|
34
|
+
* - Session persistence
|
|
35
|
+
*/
|
|
36
|
+
export function createAuthAdapter<
|
|
37
|
+
TUser = unknown,
|
|
38
|
+
TRole extends string = string,
|
|
39
|
+
TPermission extends string = string,
|
|
40
|
+
TSession extends AuthSession<TUser, TRole, TPermission> = AuthSession<
|
|
41
|
+
TUser,
|
|
42
|
+
TRole,
|
|
43
|
+
TPermission
|
|
44
|
+
>,
|
|
45
|
+
TCredentials = unknown,
|
|
46
|
+
>(
|
|
47
|
+
config: AuthAdapterConfig<TUser, TRole, TPermission, TSession, TCredentials>,
|
|
48
|
+
): AuthAdapter<TUser, TRole, TPermission, TSession, TCredentials> {
|
|
49
|
+
// ============================================================================
|
|
50
|
+
// Configuration & State
|
|
51
|
+
// ============================================================================
|
|
52
|
+
|
|
53
|
+
const storage = config.storage ?? createMemoryStorage<TSession>();
|
|
54
|
+
const tokenManager =
|
|
55
|
+
config.tokenManager ??
|
|
56
|
+
createTokenManager({
|
|
57
|
+
refreshThreshold: config.refreshThreshold ?? 300,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const subscribers = new Set<
|
|
61
|
+
AuthAdapterSubscriber<TSession, TUser, TRole, TPermission>
|
|
62
|
+
>();
|
|
63
|
+
|
|
64
|
+
const resolveUser =
|
|
65
|
+
config.resolveUser ?? ((session: TSession | null) => session?.user ?? null);
|
|
66
|
+
const resolveRoles =
|
|
67
|
+
config.resolveRoles ??
|
|
68
|
+
((session: TSession | null) =>
|
|
69
|
+
session?.roles?.filter((role): role is TRole => role != null) ?? []);
|
|
70
|
+
const resolvePermissions =
|
|
71
|
+
config.resolvePermissions ??
|
|
72
|
+
((session: TSession | null) =>
|
|
73
|
+
session?.permissions?.filter(
|
|
74
|
+
(permission): permission is TPermission => permission != null,
|
|
75
|
+
) ?? []);
|
|
76
|
+
|
|
77
|
+
let state: AuthAdapterState<TSession, TUser, TRole, TPermission> = {
|
|
78
|
+
status: 'idle',
|
|
79
|
+
session: null,
|
|
80
|
+
user: null,
|
|
81
|
+
roles: [],
|
|
82
|
+
permissions: [],
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
let autoRefreshCleanup: (() => void) | null = null;
|
|
86
|
+
|
|
87
|
+
// ============================================================================
|
|
88
|
+
// Middleware Execution
|
|
89
|
+
// ============================================================================
|
|
90
|
+
|
|
91
|
+
const executeMiddleware = async <
|
|
92
|
+
T extends keyof NonNullable<typeof config.middleware>[number],
|
|
93
|
+
>(
|
|
94
|
+
hook: T,
|
|
95
|
+
...args: Parameters<
|
|
96
|
+
NonNullable<NonNullable<typeof config.middleware>[number][T]>
|
|
97
|
+
>
|
|
98
|
+
): Promise<void> => {
|
|
99
|
+
if (!config.middleware) return;
|
|
100
|
+
|
|
101
|
+
for (const middleware of config.middleware) {
|
|
102
|
+
const fn = middleware[hook];
|
|
103
|
+
if (fn) {
|
|
104
|
+
try {
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
|
+
await (fn as any)(...args);
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error(`[auth2] Middleware error in ${String(hook)}:`, error);
|
|
109
|
+
if (middleware.onError) {
|
|
110
|
+
await middleware.onError(error);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// ============================================================================
|
|
118
|
+
// State Management
|
|
119
|
+
// ============================================================================
|
|
120
|
+
|
|
121
|
+
const notify = () => {
|
|
122
|
+
for (const listener of subscribers) listener(state);
|
|
123
|
+
config.onStateChange?.(state);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const setState = (
|
|
127
|
+
next: AuthAdapterState<TSession, TUser, TRole, TPermission>,
|
|
128
|
+
) => {
|
|
129
|
+
state = next;
|
|
130
|
+
notify();
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const computeState = (
|
|
134
|
+
session: TSession | null,
|
|
135
|
+
status: AuthStatus,
|
|
136
|
+
error?: unknown,
|
|
137
|
+
): AuthAdapterState<TSession, TUser, TRole, TPermission> => {
|
|
138
|
+
const user = resolveUser(session);
|
|
139
|
+
const baseRoles = resolveRoles(session);
|
|
140
|
+
const basePermissions = resolvePermissions(session);
|
|
141
|
+
|
|
142
|
+
// Apply hierarchies
|
|
143
|
+
const roles = unique(expandRoles(baseRoles, config.roleHierarchy));
|
|
144
|
+
const permissions = unique(
|
|
145
|
+
expandPermissions(basePermissions, config.permissionHierarchy),
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
const tokenExpiresIn = session?.expiresAt
|
|
149
|
+
? tokenManager.getTimeUntilExpiry(session.expiresAt)
|
|
150
|
+
: undefined;
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
status,
|
|
154
|
+
session,
|
|
155
|
+
user,
|
|
156
|
+
roles,
|
|
157
|
+
permissions,
|
|
158
|
+
error,
|
|
159
|
+
lastRefresh: Date.now(),
|
|
160
|
+
tokenExpiresIn,
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
// ============================================================================
|
|
165
|
+
// Storage Operations
|
|
166
|
+
// ============================================================================
|
|
167
|
+
|
|
168
|
+
const readStorage = async () => {
|
|
169
|
+
const stored = await Promise.resolve(storage.get());
|
|
170
|
+
return stored ?? null;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const writeStorage = async (next: TSession | null) => {
|
|
174
|
+
if (next === null) {
|
|
175
|
+
await Promise.resolve(storage.clear());
|
|
176
|
+
} else {
|
|
177
|
+
await Promise.resolve(storage.set(next));
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// ============================================================================
|
|
182
|
+
// Auto-Refresh Management
|
|
183
|
+
// ============================================================================
|
|
184
|
+
|
|
185
|
+
const setupAutoRefresh = () => {
|
|
186
|
+
if (autoRefreshCleanup) {
|
|
187
|
+
autoRefreshCleanup();
|
|
188
|
+
autoRefreshCleanup = null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!config.autoRefresh || !config.refresh || !state.session?.expiresAt) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (tokenManager.scheduleRefresh) {
|
|
196
|
+
autoRefreshCleanup = tokenManager.scheduleRefresh(() => {
|
|
197
|
+
refresh().catch((error) => {
|
|
198
|
+
console.error('[auth2] Auto-refresh failed:', error);
|
|
199
|
+
});
|
|
200
|
+
}, state.session.expiresAt);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// ============================================================================
|
|
205
|
+
// Session Management
|
|
206
|
+
// ============================================================================
|
|
207
|
+
|
|
208
|
+
const setSession = async (
|
|
209
|
+
session: TSession | null,
|
|
210
|
+
statusOverride?: AuthStatus,
|
|
211
|
+
error?: unknown,
|
|
212
|
+
) => {
|
|
213
|
+
await writeStorage(session);
|
|
214
|
+
const status: AuthStatus =
|
|
215
|
+
statusOverride ?? (session ? 'authenticated' : 'unauthenticated');
|
|
216
|
+
const nextState = computeState(session, status, error);
|
|
217
|
+
setState(nextState);
|
|
218
|
+
|
|
219
|
+
setupAutoRefresh();
|
|
220
|
+
|
|
221
|
+
return nextState;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const sync = async () => {
|
|
225
|
+
setState({ ...state, status: 'loading' });
|
|
226
|
+
try {
|
|
227
|
+
const session =
|
|
228
|
+
(await config.loadSession?.()) ?? (await readStorage()) ?? null;
|
|
229
|
+
|
|
230
|
+
// Check if session is expired
|
|
231
|
+
if (session?.expiresAt && tokenManager.isExpired(session.expiresAt)) {
|
|
232
|
+
// Try to refresh if possible
|
|
233
|
+
if (config.refresh && session.refreshToken) {
|
|
234
|
+
try {
|
|
235
|
+
const refreshed = await config.refresh(session);
|
|
236
|
+
return await setSession(refreshed, 'authenticated');
|
|
237
|
+
} catch {
|
|
238
|
+
// Refresh failed, session is expired
|
|
239
|
+
await executeMiddleware('onSessionExpired');
|
|
240
|
+
return await setSession(null, 'unauthenticated');
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
await executeMiddleware('onSessionExpired');
|
|
245
|
+
return await setSession(null, 'unauthenticated');
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return await setSession(
|
|
249
|
+
session,
|
|
250
|
+
session ? 'authenticated' : 'unauthenticated',
|
|
251
|
+
);
|
|
252
|
+
} catch (error) {
|
|
253
|
+
await executeMiddleware('onError', error);
|
|
254
|
+
return await setSession(null, 'error', error);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// ============================================================================
|
|
259
|
+
// Retry Logic
|
|
260
|
+
// ============================================================================
|
|
261
|
+
|
|
262
|
+
const withRetry = async <T>(
|
|
263
|
+
fn: () => Promise<T>,
|
|
264
|
+
context: string,
|
|
265
|
+
): Promise<T> => {
|
|
266
|
+
const maxRetries = config.retryConfig?.maxRetries ?? 0;
|
|
267
|
+
const retryDelay = config.retryConfig?.retryDelay ?? 1000;
|
|
268
|
+
const shouldRetry = config.retryConfig?.retryOn;
|
|
269
|
+
|
|
270
|
+
let lastError: unknown;
|
|
271
|
+
|
|
272
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
273
|
+
try {
|
|
274
|
+
return await fn();
|
|
275
|
+
} catch (error) {
|
|
276
|
+
lastError = error;
|
|
277
|
+
|
|
278
|
+
const isLastAttempt = attempt === maxRetries;
|
|
279
|
+
const shouldRetryError = shouldRetry ? shouldRetry(error) : false;
|
|
280
|
+
|
|
281
|
+
if (isLastAttempt || !shouldRetryError) {
|
|
282
|
+
throw error;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
console.warn(
|
|
286
|
+
`[auth2] ${context} failed (attempt ${attempt + 1}/${maxRetries + 1}), retrying...`,
|
|
287
|
+
);
|
|
288
|
+
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
throw lastError;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// ============================================================================
|
|
296
|
+
// Authentication Operations
|
|
297
|
+
// ============================================================================
|
|
298
|
+
|
|
299
|
+
const refresh = async () => {
|
|
300
|
+
const refreshFn = config.refresh;
|
|
301
|
+
const currentSession = state.session;
|
|
302
|
+
|
|
303
|
+
if (!refreshFn) return state;
|
|
304
|
+
if (!currentSession) return state;
|
|
305
|
+
|
|
306
|
+
try {
|
|
307
|
+
const refreshed = await withRetry(
|
|
308
|
+
() => refreshFn(currentSession),
|
|
309
|
+
'refresh',
|
|
310
|
+
);
|
|
311
|
+
const nextState = await setSession(refreshed, 'authenticated');
|
|
312
|
+
await executeMiddleware('onRefresh', nextState);
|
|
313
|
+
return nextState;
|
|
314
|
+
} catch (error) {
|
|
315
|
+
await executeMiddleware('onError', error);
|
|
316
|
+
return await setSession(state.session, 'error', error);
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
const login = async (credentials: TCredentials) => {
|
|
321
|
+
const loginFn = config.login;
|
|
322
|
+
if (!loginFn) throw new Error('Auth adapter login is not configured');
|
|
323
|
+
|
|
324
|
+
setState({ ...state, status: 'loading' });
|
|
325
|
+
|
|
326
|
+
try {
|
|
327
|
+
await executeMiddleware('onBeforeLogin', credentials);
|
|
328
|
+
|
|
329
|
+
const session = await withRetry(() => loginFn(credentials), 'login');
|
|
330
|
+
|
|
331
|
+
const nextState = await setSession(session, 'authenticated');
|
|
332
|
+
await executeMiddleware('onAfterLogin', nextState);
|
|
333
|
+
|
|
334
|
+
return nextState;
|
|
335
|
+
} catch (error) {
|
|
336
|
+
await executeMiddleware('onError', error);
|
|
337
|
+
await setSession(null, 'error', error);
|
|
338
|
+
throw error;
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
const logout = async () => {
|
|
343
|
+
const current = state.session;
|
|
344
|
+
|
|
345
|
+
try {
|
|
346
|
+
await executeMiddleware('onBeforeLogout');
|
|
347
|
+
await config.logout?.(current ?? null);
|
|
348
|
+
} finally {
|
|
349
|
+
if (autoRefreshCleanup) {
|
|
350
|
+
autoRefreshCleanup();
|
|
351
|
+
autoRefreshCleanup = null;
|
|
352
|
+
}
|
|
353
|
+
await setSession(null, 'unauthenticated');
|
|
354
|
+
await executeMiddleware('onAfterLogout');
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
// ============================================================================
|
|
359
|
+
// Permission Checking
|
|
360
|
+
// ============================================================================
|
|
361
|
+
|
|
362
|
+
const hasRole = (
|
|
363
|
+
target: TRole | TRole[],
|
|
364
|
+
options?: { requireAll?: boolean },
|
|
365
|
+
): boolean => {
|
|
366
|
+
return checkRoles(state.roles, target, options);
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
const hasPermission = (
|
|
370
|
+
target: TPermission | TPermission[] | PermissionPolicy<TPermission>,
|
|
371
|
+
options?: { requireAll?: boolean },
|
|
372
|
+
): boolean => {
|
|
373
|
+
return checkPermissions(state.permissions, target, options);
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
const can = (rule: PermissionRule<TRole, TPermission>): boolean => {
|
|
377
|
+
return evaluatePermissionRule(state.roles, state.permissions, rule);
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
// ============================================================================
|
|
381
|
+
// Token Management
|
|
382
|
+
// ============================================================================
|
|
383
|
+
|
|
384
|
+
const getToken = (): string | null => {
|
|
385
|
+
return state.session?.accessToken ?? null;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
const isTokenExpired = (): boolean => {
|
|
389
|
+
return tokenManager.isExpired(state.session?.expiresAt);
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
const getTimeUntilExpiry = (): number => {
|
|
393
|
+
return tokenManager.getTimeUntilExpiry(state.session?.expiresAt);
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const scheduleAutoRefresh = (): (() => void) => {
|
|
397
|
+
setupAutoRefresh();
|
|
398
|
+
return () => {
|
|
399
|
+
if (autoRefreshCleanup) {
|
|
400
|
+
autoRefreshCleanup();
|
|
401
|
+
autoRefreshCleanup = null;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// ============================================================================
|
|
407
|
+
// API
|
|
408
|
+
// ============================================================================
|
|
409
|
+
|
|
410
|
+
const api: AuthAdapter<TUser, TRole, TPermission, TSession, TCredentials> = {
|
|
411
|
+
getState: () => state,
|
|
412
|
+
subscribe: (listener) => {
|
|
413
|
+
subscribers.add(listener);
|
|
414
|
+
return () => {
|
|
415
|
+
subscribers.delete(listener);
|
|
416
|
+
};
|
|
417
|
+
},
|
|
418
|
+
sync,
|
|
419
|
+
login: config.login ? login : undefined,
|
|
420
|
+
logout,
|
|
421
|
+
refresh: async () => {
|
|
422
|
+
return await refresh();
|
|
423
|
+
},
|
|
424
|
+
setSession: async (session) => {
|
|
425
|
+
return await setSession(session);
|
|
426
|
+
},
|
|
427
|
+
hasRole,
|
|
428
|
+
hasPermission,
|
|
429
|
+
can,
|
|
430
|
+
getToken,
|
|
431
|
+
isTokenExpired,
|
|
432
|
+
getTimeUntilExpiry,
|
|
433
|
+
scheduleAutoRefresh,
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
return api;
|
|
437
|
+
}
|