@admin-layout/tailwind-ui 10.1.1-alpha.9 → 11.2.1-alpha.1
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/README.md +20 -0
- package/lib/components/Button/Button.d.ts +13 -0
- package/lib/components/Button/Button.d.ts.map +1 -0
- package/lib/components/Button/Button.js +49 -0
- package/lib/components/Button/Button.js.map +1 -0
- package/lib/components/DatePicker/DatePicker.d.ts +5 -0
- package/lib/components/DatePicker/DatePicker.d.ts.map +1 -0
- package/lib/components/DatePicker/DatePicker.js +200 -0
- package/lib/components/DatePicker/DatePicker.js.map +1 -0
- package/lib/components/DatePicker/index.d.ts +3 -0
- package/lib/components/DatePicker/index.d.ts.map +1 -0
- package/lib/components/DatePicker/machine.d.ts +3 -0
- package/lib/components/DatePicker/machine.d.ts.map +1 -0
- package/lib/components/DatePicker/machine.js +95 -0
- package/lib/components/DatePicker/machine.js.map +1 -0
- package/lib/components/DatePicker/types.d.ts +34 -0
- package/lib/components/DatePicker/types.d.ts.map +1 -0
- package/lib/components/DatePicker/utils.d.ts +25 -0
- package/lib/components/DatePicker/utils.d.ts.map +1 -0
- package/lib/components/DatePicker/utils.js +28 -0
- package/lib/components/DatePicker/utils.js.map +1 -0
- package/lib/components/ErrorHandlers/ApplicationErrorHandler.d.ts +2 -1
- package/lib/components/ErrorHandlers/ApplicationErrorHandler.d.ts.map +1 -1
- package/lib/components/ErrorHandlers/ApplicationErrorHandler.js +6 -10
- package/lib/components/ErrorHandlers/ApplicationErrorHandler.js.map +1 -1
- package/lib/components/ErrorHandlers/ErrorBoundary.d.ts +2 -1
- package/lib/components/ErrorHandlers/ErrorBoundary.d.ts.map +1 -1
- package/lib/components/ErrorHandlers/ErrorBoundary.js +28 -35
- package/lib/components/ErrorHandlers/ErrorBoundary.js.map +1 -1
- package/lib/components/ErrorHandlers/LayoutErrorBoundary.d.ts +2 -1
- package/lib/components/ErrorHandlers/LayoutErrorBoundary.d.ts.map +1 -1
- package/lib/components/ErrorHandlers/LayoutErrorBoundary.js +15 -20
- package/lib/components/ErrorHandlers/LayoutErrorBoundary.js.map +1 -1
- package/lib/components/ErrorPages/403.d.ts +2 -1
- package/lib/components/ErrorPages/403.d.ts.map +1 -1
- package/lib/components/ErrorPages/403.js +18 -26
- package/lib/components/ErrorPages/403.js.map +1 -1
- package/lib/components/ErrorPages/404.d.ts +2 -1
- package/lib/components/ErrorPages/404.d.ts.map +1 -1
- package/lib/components/ErrorPages/404.js +18 -26
- package/lib/components/ErrorPages/404.js.map +1 -1
- package/lib/components/ErrorPages/500.d.ts +2 -1
- package/lib/components/ErrorPages/500.d.ts.map +1 -1
- package/lib/components/ErrorPages/500.js +18 -26
- package/lib/components/ErrorPages/500.js.map +1 -1
- package/lib/components/LanguageMenuDropdown/LanguageMenuDropdown.d.ts +6 -0
- package/lib/components/LanguageMenuDropdown/LanguageMenuDropdown.d.ts.map +1 -0
- package/lib/components/LanguageMenuDropdown/LanguageMenuDropdown.js +56 -0
- package/lib/components/LanguageMenuDropdown/LanguageMenuDropdown.js.map +1 -0
- package/lib/components/LanguageMenuDropdown/index.d.ts +2 -0
- package/lib/components/LanguageMenuDropdown/index.d.ts.map +1 -0
- package/lib/components/OTP/OTPInput.js +30 -32
- package/lib/components/OTP/OTPInput.js.map +1 -1
- package/lib/components/OTP/OTPVerification.js +55 -75
- package/lib/components/OTP/OTPVerification.js.map +1 -1
- package/lib/components/OTP/SingleInput.js +2 -2
- package/lib/components/OTP/SingleInput.js.map +1 -1
- package/lib/components/OTP/utils.js.map +1 -1
- package/lib/components/PageContainer/PageContainer.d.ts.map +1 -1
- package/lib/components/PageContainer/PageContainer.js +27 -28
- package/lib/components/PageContainer/PageContainer.js.map +1 -1
- package/lib/components/PageLoading/index.js +7 -8
- package/lib/components/PageLoading/index.js.map +1 -1
- package/lib/components/RJSFPreview/PreviewAsyncDropdown.d.ts +12 -0
- package/lib/components/RJSFPreview/PreviewAsyncDropdown.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewCheckboxWidget.d.ts +8 -0
- package/lib/components/RJSFPreview/PreviewCheckboxWidget.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewCustomFieldTemplate.d.ts +4 -0
- package/lib/components/RJSFPreview/PreviewCustomFieldTemplate.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewDateWidget.d.ts +8 -0
- package/lib/components/RJSFPreview/PreviewDateWidget.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewDialog.d.ts +9 -0
- package/lib/components/RJSFPreview/PreviewDialog.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewDropdownWidget.d.ts +8 -0
- package/lib/components/RJSFPreview/PreviewDropdownWidget.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewFieldTemplate.d.ts +4 -0
- package/lib/components/RJSFPreview/PreviewFieldTemplate.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewFileUploadWidget.d.ts +4 -0
- package/lib/components/RJSFPreview/PreviewFileUploadWidget.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewFormRenderer.d.ts +16 -0
- package/lib/components/RJSFPreview/PreviewFormRenderer.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewImageUploadWidget.d.ts +4 -0
- package/lib/components/RJSFPreview/PreviewImageUploadWidget.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewInputWidget.d.ts +4 -0
- package/lib/components/RJSFPreview/PreviewInputWidget.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewObjectFieldTemplate.d.ts +4 -0
- package/lib/components/RJSFPreview/PreviewObjectFieldTemplate.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewRadioWidget.d.ts +8 -0
- package/lib/components/RJSFPreview/PreviewRadioWidget.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewStepper.d.ts +9 -0
- package/lib/components/RJSFPreview/PreviewStepper.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewSwitchWidget.d.ts +9 -0
- package/lib/components/RJSFPreview/PreviewSwitchWidget.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewTab.d.ts +17 -0
- package/lib/components/RJSFPreview/PreviewTab.d.ts.map +1 -0
- package/lib/components/RJSFPreview/PreviewTextareaWidget.d.ts +8 -0
- package/lib/components/RJSFPreview/PreviewTextareaWidget.d.ts.map +1 -0
- package/lib/components/RJSFPreview/generateSchemaWithInputs.d.ts +9 -0
- package/lib/components/RJSFPreview/generateSchemaWithInputs.d.ts.map +1 -0
- package/lib/components/RJSFPreview/index.d.ts +2 -0
- package/lib/components/RJSFPreview/index.d.ts.map +1 -0
- package/lib/components/ReactTable/Table.d.ts +2 -1
- package/lib/components/ReactTable/Table.d.ts.map +1 -1
- package/lib/components/ReactTable/Table.js +71 -92
- package/lib/components/ReactTable/Table.js.map +1 -1
- package/lib/components/ReactTable/TableFilters.d.ts +3 -2
- package/lib/components/ReactTable/TableFilters.d.ts.map +1 -1
- package/lib/components/ReactTable/TableFilters.js +34 -40
- package/lib/components/ReactTable/TableFilters.js.map +1 -1
- package/lib/components/Search/SearchInput.d.ts +12 -0
- package/lib/components/Search/SearchInput.d.ts.map +1 -0
- package/lib/components/Search/SearchInput.js +32 -0
- package/lib/components/Search/SearchInput.js.map +1 -0
- package/lib/components/Search/index.d.ts +2 -0
- package/lib/components/Search/index.d.ts.map +1 -0
- package/lib/components/Select/Select.d.ts +35 -0
- package/lib/components/Select/Select.d.ts.map +1 -0
- package/lib/components/Select/Select.js +242 -0
- package/lib/components/Select/Select.js.map +1 -0
- package/lib/components/Select/index.d.ts +2 -0
- package/lib/components/Select/index.d.ts.map +1 -0
- package/lib/components/Spin/index.js +11 -14
- package/lib/components/Spin/index.js.map +1 -1
- package/lib/components/ThemeProvider/ThemeProvider.d.ts +16 -0
- package/lib/components/ThemeProvider/ThemeProvider.d.ts.map +1 -0
- package/lib/components/ThemeProvider/ThemeProvider.js +124 -0
- package/lib/components/ThemeProvider/ThemeProvider.js.map +1 -0
- package/lib/components/ThemeProvider/ThemeToggle.d.ts +7 -0
- package/lib/components/ThemeProvider/ThemeToggle.d.ts.map +1 -0
- package/lib/components/ThemeProvider/ThemeToggle.js +47 -0
- package/lib/components/ThemeProvider/ThemeToggle.js.map +1 -0
- package/lib/components/ThemeProvider/index.d.ts +4 -0
- package/lib/components/ThemeProvider/index.d.ts.map +1 -0
- package/lib/components/ThemeProvider/types.d.ts +27 -0
- package/lib/components/ThemeProvider/types.d.ts.map +1 -0
- package/lib/components/index.d.ts +6 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/hooks/index.d.ts +5 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/useMediaQuery.d.ts +14 -0
- package/lib/hooks/useMediaQuery.d.ts.map +1 -0
- package/lib/hooks/useMediaQuery.js +48 -0
- package/lib/hooks/useMediaQuery.js.map +1 -0
- package/lib/hooks/useTheme.d.ts +2 -0
- package/lib/hooks/useTheme.d.ts.map +1 -0
- package/lib/hooks/useTheme.js +7 -0
- package/lib/hooks/useTheme.js.map +1 -0
- package/lib/hooks/useToast.d.ts +1 -1
- package/lib/hooks/useToast.d.ts.map +1 -1
- package/lib/hooks/useToast.js +37 -46
- package/lib/hooks/useToast.js.map +1 -1
- package/lib/hooks/useWindowSize.d.ts +5 -0
- package/lib/hooks/useWindowSize.d.ts.map +1 -0
- package/lib/hooks/useWindowSize.js +20 -0
- package/lib/hooks/useWindowSize.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/shardui/accordion.d.ts +8 -0
- package/lib/shardui/accordion.d.ts.map +1 -0
- package/lib/shardui/accordion.js +36 -0
- package/lib/shardui/accordion.js.map +1 -0
- package/lib/shardui/alert-dialog.d.ts +21 -0
- package/lib/shardui/alert-dialog.d.ts.map +1 -0
- package/lib/shardui/alert-dialog.js +75 -0
- package/lib/shardui/alert-dialog.js.map +1 -0
- package/lib/shardui/alert.d.ts +9 -0
- package/lib/shardui/alert.d.ts.map +1 -0
- package/lib/shardui/alert.js +42 -0
- package/lib/shardui/alert.js.map +1 -0
- package/lib/shardui/aspect-ratio.d.ts +4 -0
- package/lib/shardui/aspect-ratio.d.ts.map +1 -0
- package/lib/shardui/aspect-ratio.js +1 -0
- package/lib/shardui/aspect-ratio.js.map +1 -0
- package/lib/shardui/avatar.d.ts +7 -0
- package/lib/shardui/avatar.d.ts.map +1 -0
- package/lib/shardui/avatar.js +27 -0
- package/lib/shardui/avatar.js.map +1 -0
- package/lib/shardui/badge.d.ts +10 -0
- package/lib/shardui/badge.d.ts.map +1 -0
- package/lib/shardui/badge.js +25 -0
- package/lib/shardui/badge.js.map +1 -0
- package/lib/shardui/breadcrumb.d.ts +20 -0
- package/lib/shardui/breadcrumb.d.ts.map +1 -0
- package/lib/shardui/breadcrumb.js +76 -0
- package/lib/shardui/breadcrumb.js.map +1 -0
- package/lib/shardui/button.d.ts +12 -0
- package/lib/shardui/button.d.ts.map +1 -0
- package/lib/shardui/button.js +41 -0
- package/lib/shardui/button.js.map +1 -0
- package/lib/shardui/calendar.d.ts +9 -0
- package/lib/shardui/calendar.d.ts.map +1 -0
- package/lib/shardui/calendar.js +53 -0
- package/lib/shardui/calendar.js.map +1 -0
- package/lib/shardui/card.d.ts +9 -0
- package/lib/shardui/card.d.ts.map +1 -0
- package/lib/shardui/card.js +54 -0
- package/lib/shardui/card.js.map +1 -0
- package/lib/shardui/carousel.d.ts +19 -0
- package/lib/shardui/carousel.d.ts.map +1 -0
- package/lib/shardui/carousel.js +169 -0
- package/lib/shardui/carousel.js.map +1 -0
- package/lib/shardui/chart.d.ts +63 -0
- package/lib/shardui/chart.d.ts.map +1 -0
- package/lib/shardui/chart.js +182 -0
- package/lib/shardui/chart.js.map +1 -0
- package/lib/shardui/checkbox.d.ts +5 -0
- package/lib/shardui/checkbox.d.ts.map +1 -0
- package/lib/shardui/checkbox.js +13 -0
- package/lib/shardui/checkbox.js.map +1 -0
- package/lib/shardui/collapsible.d.ts +6 -0
- package/lib/shardui/collapsible.d.ts.map +1 -0
- package/lib/shardui/collapsible.js +3 -0
- package/lib/shardui/collapsible.js.map +1 -0
- package/lib/shardui/command.d.ts +83 -0
- package/lib/shardui/command.d.ts.map +1 -0
- package/lib/shardui/command.js +87 -0
- package/lib/shardui/command.js.map +1 -0
- package/lib/shardui/context-menu.d.ts +28 -0
- package/lib/shardui/context-menu.d.ts.map +1 -0
- package/lib/shardui/context-menu.js +106 -0
- package/lib/shardui/context-menu.js.map +1 -0
- package/lib/shardui/dialog.d.ts +20 -0
- package/lib/shardui/dialog.d.ts.map +1 -0
- package/lib/shardui/dialog.js +62 -0
- package/lib/shardui/dialog.js.map +1 -0
- package/lib/shardui/drawer.d.ts +23 -0
- package/lib/shardui/drawer.d.ts.map +1 -0
- package/lib/shardui/drawer.js +66 -0
- package/lib/shardui/drawer.js.map +1 -0
- package/lib/shardui/dropdown-menu.d.ts +28 -0
- package/lib/shardui/dropdown-menu.d.ts.map +1 -0
- package/lib/shardui/dropdown-menu.js +108 -0
- package/lib/shardui/dropdown-menu.js.map +1 -0
- package/lib/shardui/form.d.ts +24 -0
- package/lib/shardui/form.d.ts.map +1 -0
- package/lib/shardui/form.js +123 -0
- package/lib/shardui/form.js.map +1 -0
- package/lib/shardui/hover-card.d.ts +7 -0
- package/lib/shardui/hover-card.d.ts.map +1 -0
- package/lib/shardui/hover-card.js +15 -0
- package/lib/shardui/hover-card.js.map +1 -0
- package/lib/shardui/index.d.ts +50 -0
- package/lib/shardui/index.d.ts.map +1 -0
- package/lib/shardui/index.js +1 -0
- package/lib/shardui/index.js.map +1 -0
- package/lib/shardui/input-otp.d.ts +35 -0
- package/lib/shardui/input-otp.d.ts.map +1 -0
- package/lib/shardui/input-otp.js +50 -0
- package/lib/shardui/input-otp.js.map +1 -0
- package/lib/shardui/input.d.ts +4 -0
- package/lib/shardui/input.d.ts.map +1 -0
- package/lib/shardui/input.js +13 -0
- package/lib/shardui/input.js.map +1 -0
- package/lib/shardui/label.d.ts +6 -0
- package/lib/shardui/label.d.ts.map +1 -0
- package/lib/shardui/label.js +10 -0
- package/lib/shardui/label.js.map +1 -0
- package/lib/shardui/menubar.d.ts +34 -0
- package/lib/shardui/menubar.d.ts.map +1 -0
- package/lib/shardui/menubar.js +129 -0
- package/lib/shardui/menubar.js.map +1 -0
- package/lib/shardui/navigation-menu.d.ts +13 -0
- package/lib/shardui/navigation-menu.d.ts.map +1 -0
- package/lib/shardui/navigation-menu.js +66 -0
- package/lib/shardui/navigation-menu.js.map +1 -0
- package/lib/shardui/pagination.d.ts +29 -0
- package/lib/shardui/pagination.d.ts.map +1 -0
- package/lib/shardui/pagination.js +79 -0
- package/lib/shardui/pagination.js.map +1 -0
- package/lib/shardui/popover.d.ts +7 -0
- package/lib/shardui/popover.d.ts.map +1 -0
- package/lib/shardui/popover.js +15 -0
- package/lib/shardui/popover.js.map +1 -0
- package/lib/shardui/progress.d.ts +5 -0
- package/lib/shardui/progress.d.ts.map +1 -0
- package/lib/shardui/progress.js +15 -0
- package/lib/shardui/progress.js.map +1 -0
- package/lib/shardui/radio-group.d.ts +6 -0
- package/lib/shardui/radio-group.d.ts.map +1 -0
- package/lib/shardui/radio-group.js +26 -0
- package/lib/shardui/radio-group.js.map +1 -0
- package/lib/shardui/resizable.d.ts +25 -0
- package/lib/shardui/resizable.d.ts.map +1 -0
- package/lib/shardui/resizable.js +20 -0
- package/lib/shardui/resizable.js.map +1 -0
- package/lib/shardui/scroll-area.d.ts +6 -0
- package/lib/shardui/scroll-area.d.ts.map +1 -0
- package/lib/shardui/scroll-area.js +25 -0
- package/lib/shardui/scroll-area.js.map +1 -0
- package/lib/shardui/select.d.ts +14 -0
- package/lib/shardui/select.d.ts.map +1 -0
- package/lib/shardui/select.js +85 -0
- package/lib/shardui/select.js.map +1 -0
- package/lib/shardui/separator.d.ts +5 -0
- package/lib/shardui/separator.d.ts.map +1 -0
- package/lib/shardui/separator.js +13 -0
- package/lib/shardui/separator.js.map +1 -0
- package/lib/shardui/sheet.d.ts +26 -0
- package/lib/shardui/sheet.d.ts.map +1 -0
- package/lib/shardui/sheet.js +79 -0
- package/lib/shardui/sheet.js.map +1 -0
- package/lib/shardui/sidebar.d.ts +67 -0
- package/lib/shardui/sidebar.d.ts.map +1 -0
- package/lib/shardui/sidebar.js +474 -0
- package/lib/shardui/sidebar.js.map +1 -0
- package/lib/shardui/skeleton.d.ts +4 -0
- package/lib/shardui/skeleton.d.ts.map +1 -0
- package/lib/shardui/skeleton.js +9 -0
- package/lib/shardui/skeleton.js.map +1 -0
- package/lib/shardui/slider.d.ts +5 -0
- package/lib/shardui/slider.d.ts.map +1 -0
- package/lib/shardui/slider.js +15 -0
- package/lib/shardui/slider.js.map +1 -0
- package/lib/shardui/sonner.d.ts +6 -0
- package/lib/shardui/sonner.d.ts.map +1 -0
- package/lib/shardui/sonner.js +20 -0
- package/lib/shardui/sonner.js.map +1 -0
- package/lib/shardui/switch.d.ts +5 -0
- package/lib/shardui/switch.d.ts.map +1 -0
- package/lib/shardui/switch.js +11 -0
- package/lib/shardui/switch.js.map +1 -0
- package/lib/shardui/table.d.ts +11 -0
- package/lib/shardui/table.d.ts.map +1 -0
- package/lib/shardui/table.js +74 -0
- package/lib/shardui/table.js.map +1 -0
- package/lib/shardui/tabs.d.ts +8 -0
- package/lib/shardui/tabs.d.ts.map +1 -0
- package/lib/shardui/tabs.js +28 -0
- package/lib/shardui/tabs.js.map +1 -0
- package/lib/shardui/textarea.d.ts +6 -0
- package/lib/shardui/textarea.d.ts.map +1 -0
- package/lib/shardui/textarea.js +11 -0
- package/lib/shardui/textarea.js.map +1 -0
- package/lib/shardui/toast.d.ts +16 -0
- package/lib/shardui/toast.d.ts.map +1 -0
- package/lib/shardui/toast.js +74 -0
- package/lib/shardui/toast.js.map +1 -0
- package/lib/shardui/toaster.d.ts +3 -0
- package/lib/shardui/toaster.d.ts.map +1 -0
- package/lib/shardui/toaster.js +19 -0
- package/lib/shardui/toaster.js.map +1 -0
- package/lib/shardui/toggle-group.d.ts +13 -0
- package/lib/shardui/toggle-group.d.ts.map +1 -0
- package/lib/shardui/toggle-group.js +39 -0
- package/lib/shardui/toggle-group.js.map +1 -0
- package/lib/shardui/toggle.d.ts +13 -0
- package/lib/shardui/toggle.d.ts.map +1 -0
- package/lib/shardui/toggle.js +32 -0
- package/lib/shardui/toggle.js.map +1 -0
- package/lib/shardui/tooltip.d.ts +8 -0
- package/lib/shardui/tooltip.d.ts.map +1 -0
- package/lib/shardui/tooltip.js +14 -0
- package/lib/shardui/tooltip.js.map +1 -0
- package/lib/shardui/use-toast.d.ts +3 -0
- package/lib/shardui/use-toast.d.ts.map +1 -0
- package/lib/utils/hooks/use-mobile.d.ts +2 -0
- package/lib/utils/hooks/use-mobile.d.ts.map +1 -0
- package/lib/utils/hooks/use-mobile.js +14 -0
- package/lib/utils/hooks/use-mobile.js.map +1 -0
- package/lib/utils/hooks/use-toast.d.ts +45 -0
- package/lib/utils/hooks/use-toast.d.ts.map +1 -0
- package/lib/utils/hooks/use-toast.js +133 -0
- package/lib/utils/hooks/use-toast.js.map +1 -0
- package/lib/utils/index.d.ts +7 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/isBrowser/index.js +1 -0
- package/lib/utils/isBrowser/index.js.map +1 -0
- package/lib/utils/util.d.ts +3 -0
- package/lib/utils/util.d.ts.map +1 -0
- package/lib/utils/util.js +3 -0
- package/lib/utils/util.js.map +1 -0
- package/package.json +58 -3
package/README.md
CHANGED
|
@@ -18,6 +18,26 @@ We use Tailwind utility classes directly in our components. This approach provid
|
|
|
18
18
|
3. Ensures consistent styling across the application
|
|
19
19
|
4. Reduces overall bundle size by removing unnecessary CSS
|
|
20
20
|
|
|
21
|
+
## How to Use
|
|
22
|
+
|
|
23
|
+
### Importing Components from Admin Layout
|
|
24
|
+
|
|
25
|
+
**✅ Correct Import Method:**
|
|
26
|
+
|
|
27
|
+
```jsx
|
|
28
|
+
import { Button } from '@admin-layout/tailwind-ui/shardui/button.js';
|
|
29
|
+
import { Input } from '@admin-layout/tailwind-ui/shardui/input.js';
|
|
30
|
+
import { Card } from '@admin-layout/tailwind-ui/shardui/card.js';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**❌ Avoid Importing from lib:**
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
// DON'T DO THIS
|
|
37
|
+
import { Button } from '@admin-layout/tailwind-ui/lib/components/Button';
|
|
38
|
+
import { Button } from '@admin-layout/tailwind-ui';
|
|
39
|
+
```
|
|
40
|
+
|
|
21
41
|
## Tailwind CSS Implementation Guidelines
|
|
22
42
|
|
|
23
43
|
Follow these guidelines when implementing components with Tailwind:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'outline' | 'ghost';
|
|
3
|
+
export type ButtonSize = 'small' | 'medium' | 'large';
|
|
4
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
fullWidth?: boolean;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare const Button: ({ variant, size, isLoading, fullWidth, className, children, disabled, ...props }: ButtonProps) => React.JSX.Element;
|
|
12
|
+
export { Button as TailwindUiButton };
|
|
13
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AACrF,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAC9E,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,QAAA,MAAM,MAAM,GAAI,kFASb,WAAW,sBA6Cb,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React__default from'react';import {Loader2}from'lucide-react';const Button = ({
|
|
2
|
+
variant = 'primary',
|
|
3
|
+
size = 'medium',
|
|
4
|
+
isLoading = false,
|
|
5
|
+
fullWidth = false,
|
|
6
|
+
className = '',
|
|
7
|
+
children,
|
|
8
|
+
disabled,
|
|
9
|
+
...props
|
|
10
|
+
}) => {
|
|
11
|
+
const getVariantClasses = () => {
|
|
12
|
+
switch (variant) {
|
|
13
|
+
case 'primary':
|
|
14
|
+
return 'themed-button';
|
|
15
|
+
case 'secondary':
|
|
16
|
+
return 'bg-secondary text-secondary-foreground hover:bg-secondary/80';
|
|
17
|
+
case 'outline':
|
|
18
|
+
return 'border border-border bg-background text-foreground hover:bg-muted';
|
|
19
|
+
case 'ghost':
|
|
20
|
+
return 'bg-transparent text-foreground hover:bg-muted';
|
|
21
|
+
case 'danger':
|
|
22
|
+
return 'bg-destructive text-destructive-foreground hover:bg-destructive/90';
|
|
23
|
+
default:
|
|
24
|
+
return 'themed-button';
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const getSizeClasses = () => {
|
|
28
|
+
switch (size) {
|
|
29
|
+
case 'small':
|
|
30
|
+
return 'px-3 py-1.5 text-sm';
|
|
31
|
+
case 'large':
|
|
32
|
+
return 'px-6 py-3 text-lg';
|
|
33
|
+
default:
|
|
34
|
+
return 'px-4 py-2 text-base';
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const baseClasses = 'flex items-center justify-center transition-all duration-200 rounded-themed focus-themed';
|
|
38
|
+
const variantClasses = getVariantClasses();
|
|
39
|
+
const sizeClasses = getSizeClasses();
|
|
40
|
+
const widthClass = fullWidth ? 'w-full' : '';
|
|
41
|
+
const disabledClass = isLoading || disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer interactive-hover';
|
|
42
|
+
return React__default.createElement("button", {
|
|
43
|
+
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${widthClass} ${disabledClass} ${className}`,
|
|
44
|
+
disabled: isLoading || disabled,
|
|
45
|
+
...props
|
|
46
|
+
}, isLoading && React__default.createElement(Loader2, {
|
|
47
|
+
className: "w-4 h-4 mr-2 animate-spin"
|
|
48
|
+
}), children);
|
|
49
|
+
};export{Button as TailwindUiButton};//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":[null],"names":[],"mappings":"qEAIA,MAAM,MAAM;AAEZ,EAAA,OAAM,GAAA;MACF,GAAA,QAAU;WACH,GAAA,KAAA;WACP,GAAU,KAAE;WACZ,GAAU,EAAE;AACZ,EAAA,QAAA;AACH,EAAA,QAAA;AAED,EAAA,GAAA;AAwDA,CAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmPhD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import React__default,{useRef,useEffect}from'react';import {useActor}from'@xstate/react';import {datePickerMachine}from'./machine.js';import {getDaysInMonth,getYearsRange,months}from'./utils.js';const DatePicker = ({
|
|
2
|
+
value,
|
|
3
|
+
onChange,
|
|
4
|
+
placeholder = 'Select date',
|
|
5
|
+
className = ''
|
|
6
|
+
}) => {
|
|
7
|
+
const [state, send] = useActor(datePickerMachine.provide({
|
|
8
|
+
actors: {}
|
|
9
|
+
}));
|
|
10
|
+
const containerRef = useRef(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (value) {
|
|
13
|
+
send({
|
|
14
|
+
type: 'SELECT_DATE',
|
|
15
|
+
date: value
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}, [value]);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const handleClickOutside = event => {
|
|
21
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
22
|
+
send({
|
|
23
|
+
type: 'CLICK_OUTSIDE'
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
28
|
+
return () => {
|
|
29
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
const handleDateSelect = date => {
|
|
33
|
+
send({
|
|
34
|
+
type: 'SELECT_DATE',
|
|
35
|
+
date
|
|
36
|
+
});
|
|
37
|
+
onChange && onChange(date);
|
|
38
|
+
};
|
|
39
|
+
const currentDate = new Date();
|
|
40
|
+
const {
|
|
41
|
+
selectedDate,
|
|
42
|
+
currentMonth,
|
|
43
|
+
isOpen,
|
|
44
|
+
inputValue
|
|
45
|
+
} = state.context;
|
|
46
|
+
// Generate dates in a linear array
|
|
47
|
+
const daysInMonth = getDaysInMonth(currentMonth.getFullYear(), currentMonth.getMonth());
|
|
48
|
+
const dates = Array.from({
|
|
49
|
+
length: daysInMonth
|
|
50
|
+
}, (_, i) => {
|
|
51
|
+
return new Date(currentMonth.getFullYear(), currentMonth.getMonth(), i + 1);
|
|
52
|
+
});
|
|
53
|
+
// Group dates into rows (5 rows of 7 days each - may have empty cells)
|
|
54
|
+
const numberOfRows = Math.ceil(daysInMonth / 7);
|
|
55
|
+
const years = getYearsRange(currentDate.getFullYear());
|
|
56
|
+
return React__default.createElement("div", {
|
|
57
|
+
ref: containerRef,
|
|
58
|
+
className: `relative ${className}`
|
|
59
|
+
}, React__default.createElement("div", {
|
|
60
|
+
className: "relative"
|
|
61
|
+
}, React__default.createElement("input", {
|
|
62
|
+
type: "text",
|
|
63
|
+
className: "w-full px-2 py-1 h-7 border border-gray-300 hover:border-blue-400 focus:border-blue-400 \n rounded text-xs transition-colors duration-200 ease-in-out shadow-sm \n focus:outline-none focus:ring-0",
|
|
64
|
+
placeholder: placeholder,
|
|
65
|
+
value: inputValue,
|
|
66
|
+
onChange: e => send({
|
|
67
|
+
type: 'INPUT_CHANGE',
|
|
68
|
+
value: e.target.value
|
|
69
|
+
}),
|
|
70
|
+
onClick: () => send({
|
|
71
|
+
type: 'TOGGLE_CALENDAR'
|
|
72
|
+
}),
|
|
73
|
+
readOnly: true
|
|
74
|
+
}), React__default.createElement("div", {
|
|
75
|
+
className: "absolute inset-y-0 right-0 flex items-center px-2 cursor-pointer text-gray-400",
|
|
76
|
+
onClick: () => send({
|
|
77
|
+
type: 'TOGGLE_CALENDAR'
|
|
78
|
+
})
|
|
79
|
+
}, React__default.createElement("svg", {
|
|
80
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
81
|
+
className: "h-3 w-3",
|
|
82
|
+
fill: "none",
|
|
83
|
+
viewBox: "0 0 24 24",
|
|
84
|
+
stroke: "currentColor"
|
|
85
|
+
}, React__default.createElement("path", {
|
|
86
|
+
strokeLinecap: "round",
|
|
87
|
+
strokeLinejoin: "round",
|
|
88
|
+
strokeWidth: 2,
|
|
89
|
+
d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
90
|
+
})))), isOpen && React__default.createElement("div", {
|
|
91
|
+
className: "absolute z-50 mt-1 w-72 bg-white rounded shadow-md border border-gray-200"
|
|
92
|
+
}, React__default.createElement("div", {
|
|
93
|
+
className: "px-1 py-1 border-b border-gray-200"
|
|
94
|
+
}, React__default.createElement("div", {
|
|
95
|
+
className: "flex justify-between items-center"
|
|
96
|
+
}, React__default.createElement("button", {
|
|
97
|
+
className: "p-0.5 hover:bg-gray-100 text-gray-600 rounded flex items-center justify-center w-5 h-5",
|
|
98
|
+
onClick: () => send({
|
|
99
|
+
type: 'PREV_MONTH'
|
|
100
|
+
})
|
|
101
|
+
}, React__default.createElement("svg", {
|
|
102
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
103
|
+
className: "h-3 w-3",
|
|
104
|
+
fill: "none",
|
|
105
|
+
viewBox: "0 0 24 24",
|
|
106
|
+
stroke: "currentColor"
|
|
107
|
+
}, React__default.createElement("path", {
|
|
108
|
+
strokeLinecap: "round",
|
|
109
|
+
strokeLinejoin: "round",
|
|
110
|
+
strokeWidth: 2.5,
|
|
111
|
+
d: "M15 19l-7-7 7-7"
|
|
112
|
+
}))), React__default.createElement("div", {
|
|
113
|
+
className: "flex items-center space-x-1 text-xs"
|
|
114
|
+
}, React__default.createElement("select", {
|
|
115
|
+
className: "appearance-none bg-transparent cursor-pointer py-0 px-1 pr-6 w-20 rounded hover:bg-gray-100 text-gray-800 border-0 focus:outline-none focus:ring-0 text-xs",
|
|
116
|
+
value: currentMonth.getMonth(),
|
|
117
|
+
onChange: e => send({
|
|
118
|
+
type: 'SELECT_MONTH',
|
|
119
|
+
month: parseInt(e.target.value)
|
|
120
|
+
}),
|
|
121
|
+
style: {
|
|
122
|
+
backgroundPosition: 'right 4px center'
|
|
123
|
+
}
|
|
124
|
+
}, months.map((month, index) => React__default.createElement("option", {
|
|
125
|
+
key: month,
|
|
126
|
+
value: index
|
|
127
|
+
}, month))), React__default.createElement("select", {
|
|
128
|
+
className: "appearance-none bg-transparent cursor-pointer py-0 px-1 pr-6 w-14 rounded hover:bg-gray-100 text-gray-800 border-0 focus:outline-none focus:ring-0 text-xs",
|
|
129
|
+
value: currentMonth.getFullYear(),
|
|
130
|
+
onChange: e => send({
|
|
131
|
+
type: 'SELECT_YEAR',
|
|
132
|
+
year: parseInt(e.target.value)
|
|
133
|
+
}),
|
|
134
|
+
style: {
|
|
135
|
+
backgroundPosition: 'right 4px center'
|
|
136
|
+
}
|
|
137
|
+
}, years.map(year => React__default.createElement("option", {
|
|
138
|
+
key: year,
|
|
139
|
+
value: year
|
|
140
|
+
}, year)))), React__default.createElement("button", {
|
|
141
|
+
className: "p-0.5 hover:bg-gray-100 text-gray-600 rounded flex items-center justify-center w-5 h-5",
|
|
142
|
+
onClick: () => send({
|
|
143
|
+
type: 'NEXT_MONTH'
|
|
144
|
+
})
|
|
145
|
+
}, React__default.createElement("svg", {
|
|
146
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
147
|
+
className: "h-3 w-3",
|
|
148
|
+
fill: "none",
|
|
149
|
+
viewBox: "0 0 24 24",
|
|
150
|
+
stroke: "currentColor"
|
|
151
|
+
}, React__default.createElement("path", {
|
|
152
|
+
strokeLinecap: "round",
|
|
153
|
+
strokeLinejoin: "round",
|
|
154
|
+
strokeWidth: 2.5,
|
|
155
|
+
d: "M9 5l7 7-7 7"
|
|
156
|
+
}))))), React__default.createElement("div", {
|
|
157
|
+
className: "border-b border-gray-200"
|
|
158
|
+
}, React__default.createElement("div", {
|
|
159
|
+
className: "flex border-b border-gray-100 bg-gray-50"
|
|
160
|
+
}, ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].map((day, index) => React__default.createElement("div", {
|
|
161
|
+
key: day,
|
|
162
|
+
className: `flex-1 px-1 py-1 text-xs text-center font-medium text-gray-700 ${index < 6 ? 'border-r border-gray-100' : ''}`
|
|
163
|
+
}, day))), React__default.createElement("div", {
|
|
164
|
+
className: "p-0"
|
|
165
|
+
}, Array.from({
|
|
166
|
+
length: numberOfRows
|
|
167
|
+
}).map((_, rowIndex) => React__default.createElement("div", {
|
|
168
|
+
key: `row-${rowIndex}`,
|
|
169
|
+
className: "flex border-b border-gray-100 last:border-b-0"
|
|
170
|
+
}, Array.from({
|
|
171
|
+
length: 7
|
|
172
|
+
}).map((_, colIndex) => {
|
|
173
|
+
const dateIndex = rowIndex * 7 + colIndex;
|
|
174
|
+
// Return empty cell if out of range
|
|
175
|
+
if (dateIndex >= dates.length) {
|
|
176
|
+
return React__default.createElement("div", {
|
|
177
|
+
key: `empty-${rowIndex}-${colIndex}`,
|
|
178
|
+
className: "flex-1 h-6 border-r border-gray-100 last:border-r-0"
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
const date = dates[dateIndex];
|
|
182
|
+
const isToday = date.getDate() === currentDate.getDate() && date.getMonth() === currentDate.getMonth() && date.getFullYear() === currentDate.getFullYear();
|
|
183
|
+
const isSelected = selectedDate && date.getDate() === selectedDate.getDate() && date.getMonth() === selectedDate.getMonth() && date.getFullYear() === selectedDate.getFullYear();
|
|
184
|
+
return React__default.createElement("div", {
|
|
185
|
+
key: `date-${date.getDate()}`,
|
|
186
|
+
className: `
|
|
187
|
+
flex-1 h-6 flex items-center justify-center text-xs cursor-pointer transition-colors
|
|
188
|
+
border-r border-gray-100 last:border-r-0
|
|
189
|
+
${isToday && !isSelected ? 'font-bold text-blue-600' : ''}
|
|
190
|
+
${isSelected ? 'bg-blue-50 text-blue-700 font-medium' : 'hover:bg-gray-50'}
|
|
191
|
+
`,
|
|
192
|
+
onClick: () => handleDateSelect(date)
|
|
193
|
+
}, date.getDate());
|
|
194
|
+
}))))), React__default.createElement("div", {
|
|
195
|
+
className: "py-1 px-1 flex justify-end"
|
|
196
|
+
}, React__default.createElement("button", {
|
|
197
|
+
className: "px-2 py-0.5 text-xs text-blue-600 hover:bg-blue-50 transition-colors",
|
|
198
|
+
onClick: () => handleDateSelect(new Date())
|
|
199
|
+
}, "Today"))));
|
|
200
|
+
};export{DatePicker,DatePicker as default};//# sourceMappingURL=DatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DatePickerContext, DatePickerEvent } from './types';
|
|
2
|
+
export declare const datePickerMachine: import("xstate").StateMachine<DatePickerContext, DatePickerEvent, Record<string, import("xstate").AnyActorRef>, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, string, import("xstate").StateValue, string, unknown, {}, import("xstate").EventObject, import("xstate").MetaObject, any>;
|
|
3
|
+
//# sourceMappingURL=machine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/machine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG7D,eAAO,MAAM,iBAAiB,uVAgF5B,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {createMachine,assign}from'xstate';import {formatDate}from'./utils.js';const datePickerMachine = createMachine({
|
|
2
|
+
id: 'datePicker',
|
|
3
|
+
types: {},
|
|
4
|
+
initial: 'idle',
|
|
5
|
+
context: {
|
|
6
|
+
selectedDate: null,
|
|
7
|
+
currentMonth: new Date(),
|
|
8
|
+
isOpen: false,
|
|
9
|
+
inputValue: ''
|
|
10
|
+
},
|
|
11
|
+
states: {
|
|
12
|
+
idle: {
|
|
13
|
+
on: {
|
|
14
|
+
TOGGLE_CALENDAR: {
|
|
15
|
+
actions: assign(({
|
|
16
|
+
context
|
|
17
|
+
}) => ({
|
|
18
|
+
isOpen: !context.isOpen
|
|
19
|
+
}))
|
|
20
|
+
},
|
|
21
|
+
SELECT_DATE: {
|
|
22
|
+
actions: assign(({
|
|
23
|
+
context,
|
|
24
|
+
event
|
|
25
|
+
}) => {
|
|
26
|
+
const formattedDate = formatDate(event.date);
|
|
27
|
+
return {
|
|
28
|
+
selectedDate: event.date,
|
|
29
|
+
inputValue: formattedDate,
|
|
30
|
+
isOpen: false
|
|
31
|
+
};
|
|
32
|
+
})
|
|
33
|
+
},
|
|
34
|
+
NEXT_MONTH: {
|
|
35
|
+
actions: assign(({
|
|
36
|
+
context
|
|
37
|
+
}) => {
|
|
38
|
+
const nextMonth = new Date(context.currentMonth);
|
|
39
|
+
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
|
40
|
+
return {
|
|
41
|
+
currentMonth: nextMonth
|
|
42
|
+
};
|
|
43
|
+
})
|
|
44
|
+
},
|
|
45
|
+
PREV_MONTH: {
|
|
46
|
+
actions: assign(({
|
|
47
|
+
context
|
|
48
|
+
}) => {
|
|
49
|
+
const prevMonth = new Date(context.currentMonth);
|
|
50
|
+
prevMonth.setMonth(prevMonth.getMonth() - 1);
|
|
51
|
+
return {
|
|
52
|
+
currentMonth: prevMonth
|
|
53
|
+
};
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
SELECT_YEAR: {
|
|
57
|
+
actions: assign(({
|
|
58
|
+
context,
|
|
59
|
+
event
|
|
60
|
+
}) => {
|
|
61
|
+
const newDate = new Date(context.currentMonth);
|
|
62
|
+
newDate.setFullYear(event.year);
|
|
63
|
+
return {
|
|
64
|
+
currentMonth: newDate
|
|
65
|
+
};
|
|
66
|
+
})
|
|
67
|
+
},
|
|
68
|
+
SELECT_MONTH: {
|
|
69
|
+
actions: assign(({
|
|
70
|
+
context,
|
|
71
|
+
event
|
|
72
|
+
}) => {
|
|
73
|
+
const newDate = new Date(context.currentMonth);
|
|
74
|
+
newDate.setMonth(event.month);
|
|
75
|
+
return {
|
|
76
|
+
currentMonth: newDate
|
|
77
|
+
};
|
|
78
|
+
})
|
|
79
|
+
},
|
|
80
|
+
INPUT_CHANGE: {
|
|
81
|
+
actions: assign(({
|
|
82
|
+
event
|
|
83
|
+
}) => ({
|
|
84
|
+
inputValue: event.value
|
|
85
|
+
}))
|
|
86
|
+
},
|
|
87
|
+
CLICK_OUTSIDE: {
|
|
88
|
+
actions: assign({
|
|
89
|
+
isOpen: false
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});export{datePickerMachine};//# sourceMappingURL=machine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machine.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type DatePickerContext = {
|
|
2
|
+
selectedDate: Date | null;
|
|
3
|
+
currentMonth: Date;
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
inputValue: string;
|
|
6
|
+
};
|
|
7
|
+
export type DatePickerEvent = {
|
|
8
|
+
type: 'TOGGLE_CALENDAR';
|
|
9
|
+
} | {
|
|
10
|
+
type: 'SELECT_DATE';
|
|
11
|
+
date: Date;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'NEXT_MONTH';
|
|
14
|
+
} | {
|
|
15
|
+
type: 'PREV_MONTH';
|
|
16
|
+
} | {
|
|
17
|
+
type: 'SELECT_YEAR';
|
|
18
|
+
year: number;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'SELECT_MONTH';
|
|
21
|
+
month: number;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'INPUT_CHANGE';
|
|
24
|
+
value: string;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'CLICK_OUTSIDE';
|
|
27
|
+
};
|
|
28
|
+
export interface DatePickerProps {
|
|
29
|
+
value?: Date;
|
|
30
|
+
onChange?: (date: Date) => void;
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC5B,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,IAAI,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GACrB;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC5B,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a date to a readable string (e.g. "Jan 1, 2023")
|
|
3
|
+
*/
|
|
4
|
+
export declare const formatDate: (date: Date) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Returns the number of days in a month
|
|
7
|
+
*/
|
|
8
|
+
export declare const getDaysInMonth: (year: number, month: number) => number;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the day of week (0-6) for the first day of the month
|
|
11
|
+
*/
|
|
12
|
+
export declare const getFirstDayOfMonth: (year: number, month: number) => number;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a grid of days for a month calendar view
|
|
15
|
+
*/
|
|
16
|
+
export declare const createDaysGrid: (year: number, month: number) => any[];
|
|
17
|
+
/**
|
|
18
|
+
* Array of month names
|
|
19
|
+
*/
|
|
20
|
+
export declare const months: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Creates an array of years for year selection (20 years before and after current year)
|
|
23
|
+
*/
|
|
24
|
+
export declare const getYearsRange: (currentYear: number) => number[];
|
|
25
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,KAAG,MAMvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAE5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAEhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,UAgBzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,MAAM,UAalB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,aAAa,MAAM,KAAG,MAAM,EAEzD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a date to a readable string (e.g. "Jan 1, 2023")
|
|
3
|
+
*/
|
|
4
|
+
const formatDate = date => {
|
|
5
|
+
return date.toLocaleDateString('en-US', {
|
|
6
|
+
year: 'numeric',
|
|
7
|
+
month: 'short',
|
|
8
|
+
day: 'numeric'
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Returns the number of days in a month
|
|
13
|
+
*/
|
|
14
|
+
const getDaysInMonth = (year, month) => {
|
|
15
|
+
return new Date(year, month + 1, 0).getDate();
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Array of month names
|
|
19
|
+
*/
|
|
20
|
+
const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
21
|
+
/**
|
|
22
|
+
* Creates an array of years for year selection (20 years before and after current year)
|
|
23
|
+
*/
|
|
24
|
+
const getYearsRange = currentYear => {
|
|
25
|
+
return Array.from({
|
|
26
|
+
length: 41
|
|
27
|
+
}, (_, i) => currentYear - 20 + i);
|
|
28
|
+
};export{formatDate,getDaysInMonth,getYearsRange,months};//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/components/DatePicker/utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;AAEG;AACH,MAAA,UAAa,GAAA,IAAA,IAAc;AAQ3B,EAAA,OAAA,IAAA,CAAA,kBAAA,CAAA,OAAA,EAAA;;AAEG,IAAA,KAAA,EAAA,OAAA;AACH,IAAA,GAAA,EAAA;AAIA,GAAA,CAAA;;AAEG;AACH;AAIA;;AAEG,EAAA,OAAA,IAAA,IAAA,CAAA,IAAA,EAAA,KAAA,GAAA,CAAA,EAAA,CAAA,CAAA,CAAA,OAAA,EAAA;AACH;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const ApplicationErrorHandler: (props: any) => React.JSX.Element;
|
|
2
3
|
//# sourceMappingURL=ApplicationErrorHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationErrorHandler.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorHandlers/ApplicationErrorHandler.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApplicationErrorHandler.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorHandlers/ApplicationErrorHandler.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,eAAO,MAAM,uBAAuB,GAAI,UAAK,sBAG5C,CAAC"}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ApplicationErrorHandlerCommon}from'@admin-layout/client';import*as React from'react';import {logger}from'@cdm-logger/client';import'../ThemeProvider/ThemeProvider.js';import {toast}from'sonner';const FallbackComponent = ({
|
|
2
2
|
error
|
|
3
3
|
}) => {
|
|
4
|
-
const toast = useToast();
|
|
5
4
|
React.useLayoutEffect(() => {
|
|
6
5
|
if (process.env.NODE_ENV !== 'production') {
|
|
7
|
-
toast({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
status: 'error',
|
|
11
|
-
duration: 9000,
|
|
12
|
-
isClosable: true
|
|
6
|
+
toast.error('Server Errors. Please try again later...', {
|
|
7
|
+
description: error?.payload.message,
|
|
8
|
+
duration: 9000
|
|
13
9
|
});
|
|
14
10
|
}
|
|
15
11
|
logger.error('Application Backend Error', error?.payload.message);
|
|
16
|
-
}, [
|
|
12
|
+
}, []);
|
|
17
13
|
return null;
|
|
18
14
|
};
|
|
19
15
|
const ApplicationErrorHandler = props => {
|
|
20
16
|
const CommonHandler = ApplicationErrorHandlerCommon(FallbackComponent);
|
|
21
|
-
return
|
|
17
|
+
return React.createElement(CommonHandler, {
|
|
22
18
|
...props
|
|
23
19
|
});
|
|
24
20
|
};export{ApplicationErrorHandler};//# sourceMappingURL=ApplicationErrorHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationErrorHandler.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApplicationErrorHandler.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorHandlers/ErrorBoundary.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorHandlers/ErrorBoundary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwC/B,eAAO,MAAM,aAAa,GAAI,UAAK,sBAElC,CAAC"}
|