@majapisoftwares/ui 4.3.16 → 5.0.0
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/AGENTS.md +17 -0
- package/README.md +71 -0
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/components.json +25 -0
- package/docs/MIGRATION-0.2.md +20 -0
- package/docs/NEXT-STARTER-VALIDATION.md +14 -0
- package/docs/STANDARDS.md +36 -0
- package/docs/VALIDATION.md +11 -0
- package/package.json +69 -2
- package/scripts/check-standards.mjs +39 -0
- package/src/components/ui/alert.tsx +77 -0
- package/src/components/ui/badge.tsx +55 -0
- package/src/components/ui/button.tsx +63 -0
- package/src/components/ui/empty.tsx +105 -0
- package/src/components/ui/field.tsx +238 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/native-select.tsx +66 -0
- package/src/components/ui/separator.tsx +24 -0
- package/src/components/ui/sheet.tsx +137 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/table.tsx +115 -0
- package/src/components/ui/tabs.tsx +81 -0
- package/src/lib/utils.ts +1 -0
- package/src/patterns/app-shell.tsx +70 -0
- package/src/patterns/data-table.tsx +225 -0
- package/src/patterns/details-sheet.tsx +51 -0
- package/src/patterns/page-header.tsx +40 -0
- package/src/patterns/status-badge.tsx +23 -0
- package/src/styles.css +465 -0
- package/src/templates/admin-dashboard.tsx +63 -0
- package/src/templates/auth-layout.tsx +36 -0
- package/src/templates/login-form.tsx +97 -0
- package/src/templates/signup-form.tsx +137 -0
- package/src/vite-env.d.ts +1 -0
- package/base.css +0 -360
- package/bootstrap/AppProps.d.ts +0 -9
- package/bootstrap/AppProps.js +0 -1
- package/bootstrap/index.d.ts +0 -1
- package/bootstrap/index.js +0 -1
- package/bootstrap/modeScript.d.ts +0 -2
- package/bootstrap/modeScript.js +0 -35
- package/bootstrap/nprogress.d.ts +0 -1
- package/bootstrap/nprogress.js +0 -19
- package/bootstrap/scrolledScript.d.ts +0 -2
- package/bootstrap/scrolledScript.js +0 -27
- package/bootstrap/setupFocusManager.d.ts +0 -1
- package/bootstrap/setupFocusManager.js +0 -13
- package/bootstrap/suppressConsoleLog.d.ts +0 -1
- package/bootstrap/suppressConsoleLog.js +0 -8
- package/components/Accordion/Accordion.d.ts +0 -16
- package/components/Accordion/Accordion.jsx +0 -27
- package/components/Accordion/index.d.ts +0 -3
- package/components/Accordion/index.jsx +0 -3
- package/components/Alert/Alert.d.ts +0 -31
- package/components/Alert/Alert.jsx +0 -53
- package/components/Alert/index.d.ts +0 -3
- package/components/Alert/index.jsx +0 -3
- package/components/AntiClickjacking/AntiClickjacking.d.ts +0 -1
- package/components/AntiClickjacking/AntiClickjacking.jsx +0 -17
- package/components/AntiClickjacking/index.d.ts +0 -2
- package/components/AntiClickjacking/index.jsx +0 -2
- package/components/Aurora/Aurora.d.ts +0 -10
- package/components/Aurora/Aurora.jsx +0 -189
- package/components/Aurora/index.d.ts +0 -3
- package/components/Aurora/index.jsx +0 -3
- package/components/Autocomplete/Autocomplete.d.ts +0 -7
- package/components/Autocomplete/Autocomplete.jsx +0 -23
- package/components/Autocomplete/UnstyledAutocomplete.d.ts +0 -36
- package/components/Autocomplete/UnstyledAutocomplete.jsx +0 -72
- package/components/Autocomplete/index.d.ts +0 -5
- package/components/Autocomplete/index.jsx +0 -5
- package/components/BackgroundEffects/BottomBlurryPoint.d.ts +0 -3
- package/components/BackgroundEffects/BottomBlurryPoint.jsx +0 -14
- package/components/BackgroundEffects/TopBlurryPoint.d.ts +0 -3
- package/components/BackgroundEffects/TopBlurryPoint.jsx +0 -14
- package/components/Badge/Badge.d.ts +0 -42
- package/components/Badge/Badge.jsx +0 -51
- package/components/Badge/index.d.ts +0 -3
- package/components/Badge/index.jsx +0 -3
- package/components/Breadcrumbs/Breadcrumbs.d.ts +0 -20
- package/components/Breadcrumbs/Breadcrumbs.jsx +0 -42
- package/components/Breadcrumbs/index.d.ts +0 -3
- package/components/Breadcrumbs/index.jsx +0 -3
- package/components/Button/Button.d.ts +0 -111
- package/components/Button/Button.jsx +0 -129
- package/components/Button/UnstyledButton.d.ts +0 -10
- package/components/Button/UnstyledButton.jsx +0 -13
- package/components/Button/index.d.ts +0 -3
- package/components/Button/index.jsx +0 -3
- package/components/Carousel/Carousel.d.ts +0 -19
- package/components/Carousel/Carousel.jsx +0 -55
- package/components/Carousel/index.d.ts +0 -3
- package/components/Carousel/index.jsx +0 -3
- package/components/Checkbox/Checkbox.d.ts +0 -14
- package/components/Checkbox/Checkbox.jsx +0 -45
- package/components/Checkbox/index.d.ts +0 -3
- package/components/Checkbox/index.js +0 -3
- package/components/Code/Code.d.ts +0 -12
- package/components/Code/Code.jsx +0 -25
- package/components/Code/Json.d.ts +0 -5
- package/components/Code/Json.jsx +0 -7
- package/components/Code/index.d.ts +0 -4
- package/components/Code/index.jsx +0 -4
- package/components/ConfirmationButton/ConfirmationButton.d.ts +0 -17
- package/components/ConfirmationButton/ConfirmationButton.jsx +0 -13
- package/components/ConfirmationButton/index.d.ts +0 -3
- package/components/ConfirmationButton/index.jsx +0 -3
- package/components/ContextMenu/ContextMenu.d.ts +0 -28
- package/components/ContextMenu/ContextMenu.jsx +0 -70
- package/components/ContextMenu/index.d.ts +0 -3
- package/components/ContextMenu/index.jsx +0 -3
- package/components/CopyButton/CopyButton.d.ts +0 -7
- package/components/CopyButton/CopyButton.jsx +0 -29
- package/components/CopyButton/index.d.ts +0 -3
- package/components/CopyButton/index.jsx +0 -3
- package/components/DateInput/DateInput.d.ts +0 -6
- package/components/DateInput/DateInput.jsx +0 -19
- package/components/DateInput/DateTimeInput.d.ts +0 -3
- package/components/DateInput/DateTimeInput.jsx +0 -8
- package/components/DateInput/index.d.ts +0 -4
- package/components/DateInput/index.jsx +0 -4
- package/components/DateInput/useRefValue.d.ts +0 -5
- package/components/DateInput/useRefValue.js +0 -48
- package/components/DatePicker/DatePicker.d.ts +0 -19
- package/components/DatePicker/DatePicker.jsx +0 -55
- package/components/DatePicker/index.d.ts +0 -3
- package/components/DatePicker/index.jsx +0 -3
- package/components/DateRangePicker/DateRangePicker.d.ts +0 -16
- package/components/DateRangePicker/DateRangePicker.jsx +0 -56
- package/components/DateRangePicker/index.d.ts +0 -3
- package/components/DateRangePicker/index.jsx +0 -3
- package/components/Dialog/Dialog.d.ts +0 -25
- package/components/Dialog/Dialog.jsx +0 -35
- package/components/Dialog/Dialogs.d.ts +0 -1
- package/components/Dialog/Dialogs.jsx +0 -21
- package/components/Dialog/dialogs.state.d.ts +0 -21
- package/components/Dialog/dialogs.state.js +0 -40
- package/components/Dialog/index.d.ts +0 -6
- package/components/Dialog/index.jsx +0 -7
- package/components/Drawer/Drawer.d.ts +0 -15
- package/components/Drawer/Drawer.jsx +0 -72
- package/components/Drawer/index.d.ts +0 -3
- package/components/Drawer/index.jsx +0 -3
- package/components/DropdownMenu/DropdownMenu.d.ts +0 -33
- package/components/DropdownMenu/DropdownMenu.jsx +0 -74
- package/components/DropdownMenu/index.d.ts +0 -3
- package/components/DropdownMenu/index.jsx +0 -3
- package/components/ErrorBoundary/ErrorBoundary.d.ts +0 -18
- package/components/ErrorBoundary/ErrorBoundary.jsx +0 -32
- package/components/ErrorBoundary/index.d.ts +0 -3
- package/components/ErrorBoundary/index.jsx +0 -3
- package/components/ErrorPage/Error404Page.d.ts +0 -1
- package/components/ErrorPage/Error404Page.jsx +0 -4
- package/components/ErrorPage/Error500Page.d.ts +0 -1
- package/components/ErrorPage/Error500Page.jsx +0 -4
- package/components/ErrorPage/ErrorPage.d.ts +0 -11
- package/components/ErrorPage/ErrorPage.jsx +0 -23
- package/components/FileInput/FileInput.d.ts +0 -53
- package/components/FileInput/FileInput.jsx +0 -141
- package/components/FileInput/PreviewFile.d.ts +0 -18
- package/components/FileInput/PreviewFile.jsx +0 -54
- package/components/FileInput/index.d.ts +0 -3
- package/components/FileInput/index.jsx +0 -3
- package/components/FileInput/isImage.d.ts +0 -1
- package/components/FileInput/isImage.js +0 -10
- package/components/FileInput/isVideo.d.ts +0 -1
- package/components/FileInput/isVideo.js +0 -10
- package/components/FileSelect/FileSelect.d.ts +0 -31
- package/components/FileSelect/FileSelect.jsx +0 -146
- package/components/FileSelect/index.d.ts +0 -3
- package/components/FileSelect/index.jsx +0 -3
- package/components/Footer/Footer.d.ts +0 -19
- package/components/Footer/Footer.jsx +0 -30
- package/components/Footer/index.d.ts +0 -3
- package/components/Footer/index.jsx +0 -3
- package/components/GridPattern/GridPattern.d.ts +0 -2
- package/components/GridPattern/GridPattern.jsx +0 -12
- package/components/GridPattern/index.d.ts +0 -3
- package/components/GridPattern/index.jsx +0 -3
- package/components/Group/Group.d.ts +0 -5
- package/components/Group/Group.jsx +0 -6
- package/components/Group/index.d.ts +0 -3
- package/components/Group/index.jsx +0 -3
- package/components/Header/Header.d.ts +0 -5
- package/components/Header/Header.jsx +0 -19
- package/components/Header/index.d.ts +0 -3
- package/components/Header/index.jsx +0 -3
- package/components/ImageInput/ImageInput.d.ts +0 -4
- package/components/ImageInput/ImageInput.jsx +0 -8
- package/components/ImageInput/index.d.ts +0 -3
- package/components/ImageInput/index.jsx +0 -3
- package/components/Input/Input.d.ts +0 -14
- package/components/Input/Input.jsx +0 -57
- package/components/Input/InputIcon.d.ts +0 -9
- package/components/Input/InputIcon.jsx +0 -7
- package/components/Input/MultiSelectInput.d.ts +0 -16
- package/components/Input/MultiSelectInput.jsx +0 -48
- package/components/Input/NumericInput.d.ts +0 -6
- package/components/Input/NumericInput.jsx +0 -6
- package/components/Input/PatternInput.d.ts +0 -6
- package/components/Input/PatternInput.jsx +0 -6
- package/components/Input/SelectInput.d.ts +0 -12
- package/components/Input/SelectInput.jsx +0 -25
- package/components/Input/UnstyledInput.d.ts +0 -22
- package/components/Input/UnstyledInput.jsx +0 -28
- package/components/Input/index.d.ts +0 -6
- package/components/Input/index.jsx +0 -6
- package/components/Input/useInputRefValue.d.ts +0 -11
- package/components/Input/useInputRefValue.jsx +0 -51
- package/components/Input2/InputWrapper.d.ts +0 -11
- package/components/Input2/InputWrapper.jsx +0 -11
- package/components/Link/Link.d.ts +0 -3
- package/components/Link/Link.jsx +0 -9
- package/components/Link/index.d.ts +0 -3
- package/components/Link/index.jsx +0 -3
- package/components/Loading/Loading.d.ts +0 -5
- package/components/Loading/Loading.jsx +0 -15
- package/components/Loading/index.d.ts +0 -3
- package/components/Loading/index.jsx +0 -3
- package/components/Magnet/Magnet.d.ts +0 -13
- package/components/Magnet/Magnet.jsx +0 -50
- package/components/Magnet/index.d.ts +0 -3
- package/components/Magnet/index.jsx +0 -3
- package/components/Markdown/Markdown.d.ts +0 -8
- package/components/Markdown/Markdown.jsx +0 -11
- package/components/Markdown/index.d.ts +0 -3
- package/components/Markdown/index.jsx +0 -3
- package/components/Menu/Menu.d.ts +0 -28
- package/components/Menu/Menu.jsx +0 -54
- package/components/Modal/Modal.d.ts +0 -45
- package/components/Modal/Modal.jsx +0 -65
- package/components/Modal/index.d.ts +0 -4
- package/components/Modal/index.jsx +0 -4
- package/components/Modal/useModalState.d.ts +0 -6
- package/components/Modal/useModalState.js +0 -16
- package/components/ModeToggle/ModeToggle.d.ts +0 -9
- package/components/ModeToggle/ModeToggle.jsx +0 -12
- package/components/ModeToggle/index.d.ts +0 -4
- package/components/ModeToggle/index.jsx +0 -5
- package/components/ModeToggle/useModeToggle.d.ts +0 -1
- package/components/ModeToggle/useModeToggle.js +0 -21
- package/components/MultiSelect/MultiSelect.d.ts +0 -28
- package/components/MultiSelect/MultiSelect.jsx +0 -116
- package/components/MultiSelect/MultiSelectInput.d.ts +0 -12
- package/components/MultiSelect/MultiSelectInput.jsx +0 -27
- package/components/MultiSelect/index.d.ts +0 -5
- package/components/MultiSelect/index.jsx +0 -5
- package/components/MultiText/MultiText.d.ts +0 -23
- package/components/MultiText/MultiText.jsx +0 -118
- package/components/MultiText/index.d.ts +0 -3
- package/components/MultiText/index.jsx +0 -3
- package/components/NavigationDrawer/NavigationDrawer.d.ts +0 -9
- package/components/NavigationDrawer/NavigationDrawer.jsx +0 -29
- package/components/NavigationDrawer/NavigationItem.d.ts +0 -13
- package/components/NavigationDrawer/NavigationItem.jsx +0 -24
- package/components/NavigationDrawer/index.d.ts +0 -6
- package/components/NavigationDrawer/index.jsx +0 -6
- package/components/NavigationDrawer/navigationDrawer.state.d.ts +0 -9
- package/components/NavigationDrawer/navigationDrawer.state.js +0 -19
- package/components/NoSsr/NoSsr.d.ts +0 -4
- package/components/NoSsr/NoSsr.jsx +0 -8
- package/components/NoSsr/index.d.ts +0 -3
- package/components/NoSsr/index.jsx +0 -3
- package/components/Noise/Noise.d.ts +0 -11
- package/components/Noise/Noise.jsx +0 -69
- package/components/Noise/index.d.ts +0 -3
- package/components/Noise/index.jsx +0 -3
- package/components/Notifications/Notifications.d.ts +0 -3
- package/components/Notifications/Notifications.jsx +0 -60
- package/components/Notifications/index.d.ts +0 -5
- package/components/Notifications/index.jsx +0 -6
- package/components/Notifications/notifications.state.d.ts +0 -24
- package/components/Notifications/notifications.state.js +0 -41
- package/components/Orb/Orb.d.ts +0 -8
- package/components/Orb/Orb.jsx +0 -258
- package/components/Orb/index.d.ts +0 -3
- package/components/Orb/index.jsx +0 -3
- package/components/Pagination/Pagination.d.ts +0 -13
- package/components/Pagination/Pagination.jsx +0 -64
- package/components/Pagination/index.d.ts +0 -3
- package/components/Pagination/index.jsx +0 -3
- package/components/Particles/Particles.d.ts +0 -18
- package/components/Particles/Particles.jsx +0 -205
- package/components/Particles/index.d.ts +0 -3
- package/components/Particles/index.jsx +0 -3
- package/components/PictureCropInput/PictureCropInput.d.ts +0 -20
- package/components/PictureCropInput/PictureCropInput.jsx +0 -174
- package/components/PictureCropInput/canvasPreview.d.ts +0 -2
- package/components/PictureCropInput/canvasPreview.js +0 -37
- package/components/PictureCropInput/index.d.ts +0 -3
- package/components/PictureCropInput/index.js +0 -3
- package/components/Popover/Popover.d.ts +0 -13
- package/components/Popover/Popover.jsx +0 -22
- package/components/Popover/index.d.ts +0 -3
- package/components/Popover/index.jsx +0 -3
- package/components/Resizable/Resizable.d.ts +0 -12
- package/components/Resizable/Resizable.jsx +0 -54
- package/components/Resizable/index.d.ts +0 -3
- package/components/Resizable/index.jsx +0 -3
- package/components/ScrollArea/ScrollArea.d.ts +0 -9
- package/components/ScrollArea/ScrollArea.jsx +0 -16
- package/components/ScrollArea/index.d.ts +0 -3
- package/components/ScrollArea/index.jsx +0 -3
- package/components/Select/Select.d.ts +0 -25
- package/components/Select/Select.jsx +0 -55
- package/components/Select/index.d.ts +0 -3
- package/components/Select/index.jsx +0 -3
- package/components/Skeleton/Skeleton.d.ts +0 -2
- package/components/Skeleton/Skeleton.jsx +0 -8
- package/components/Skeleton/index.d.ts +0 -3
- package/components/Skeleton/index.jsx +0 -3
- package/components/Slider/Slider.d.ts +0 -10
- package/components/Slider/Slider.jsx +0 -21
- package/components/Slider/index.d.ts +0 -3
- package/components/Slider/index.jsx +0 -3
- package/components/Spotlight/Spotlight.d.ts +0 -30
- package/components/Spotlight/Spotlight.jsx +0 -86
- package/components/Spotlight/index.d.ts +0 -3
- package/components/Spotlight/index.jsx +0 -3
- package/components/SpotlightCard/SpotlightCard.d.ts +0 -7
- package/components/SpotlightCard/SpotlightCard.jsx +0 -35
- package/components/SpotlightCard/index.d.ts +0 -3
- package/components/SpotlightCard/index.jsx +0 -3
- package/components/Stack/Stack.d.ts +0 -4
- package/components/Stack/Stack.jsx +0 -5
- package/components/Stack/index.d.ts +0 -3
- package/components/Stack/index.jsx +0 -3
- package/components/StarBorder/StarBorder.d.ts +0 -10
- package/components/StarBorder/StarBorder.jsx +0 -19
- package/components/StarBorder/index.d.ts +0 -3
- package/components/StarBorder/index.jsx +0 -3
- package/components/Switch/Switch.d.ts +0 -16
- package/components/Switch/Switch.jsx +0 -24
- package/components/Switch/index.d.ts +0 -3
- package/components/Switch/index.jsx +0 -3
- package/components/Table/DataTable.d.ts +0 -57
- package/components/Table/DataTable.jsx +0 -155
- package/components/Table/Table.d.ts +0 -27
- package/components/Table/Table.jsx +0 -31
- package/components/Table/TableActionButton.d.ts +0 -6
- package/components/Table/TableActionButton.jsx +0 -20
- package/components/Table/TableBody.d.ts +0 -6
- package/components/Table/TableBody.jsx +0 -10
- package/components/Table/TableCell.d.ts +0 -9
- package/components/Table/TableCell.jsx +0 -18
- package/components/Table/TableFooter.d.ts +0 -5
- package/components/Table/TableFooter.jsx +0 -5
- package/components/Table/TableFooterWithPagination.d.ts +0 -13
- package/components/Table/TableFooterWithPagination.jsx +0 -57
- package/components/Table/TableHead.d.ts +0 -5
- package/components/Table/TableHead.jsx +0 -9
- package/components/Table/TableHeadContext.d.ts +0 -4
- package/components/Table/TableHeadContext.jsx +0 -3
- package/components/Table/TableHeader.d.ts +0 -7
- package/components/Table/TableHeader.jsx +0 -15
- package/components/Table/TableRow.d.ts +0 -8
- package/components/Table/TableRow.jsx +0 -9
- package/components/Table/index.d.ts +0 -3
- package/components/Table/index.jsx +0 -3
- package/components/Tabs/Tabs.d.ts +0 -9
- package/components/Tabs/Tabs.jsx +0 -13
- package/components/Tabs/index.d.ts +0 -3
- package/components/Tabs/index.jsx +0 -3
- package/components/TabsSwitcher/Tab.d.ts +0 -15
- package/components/TabsSwitcher/Tab.jsx +0 -18
- package/components/TabsSwitcher/TabsSwitcher.d.ts +0 -22
- package/components/TabsSwitcher/TabsSwitcher.jsx +0 -31
- package/components/TabsSwitcher/index.d.ts +0 -4
- package/components/TabsSwitcher/index.jsx +0 -4
- package/components/Text/Text.d.ts +0 -24
- package/components/Text/Text.jsx +0 -29
- package/components/Text/index.d.ts +0 -3
- package/components/Text/index.jsx +0 -3
- package/components/Textarea/Textarea.d.ts +0 -5
- package/components/Textarea/Textarea.jsx +0 -6
- package/components/Textarea/index.d.ts +0 -3
- package/components/Textarea/index.js +0 -3
- package/components/Threads/Threads.d.ts +0 -9
- package/components/Threads/Threads.jsx +0 -203
- package/components/Threads/index.d.ts +0 -3
- package/components/Threads/index.jsx +0 -3
- package/components/Tooltip/Tooltip.d.ts +0 -11
- package/components/Tooltip/Tooltip.jsx +0 -21
- package/components/Tooltip/index.d.ts +0 -3
- package/components/Tooltip/index.jsx +0 -3
- package/components/VisibilityActivatedButton/VisibilityActivatedButton.d.ts +0 -7
- package/components/VisibilityActivatedButton/VisibilityActivatedButton.jsx +0 -18
- package/components/VisibilityActivatedButton/index.d.ts +0 -3
- package/components/VisibilityActivatedButton/index.jsx +0 -3
- package/form.d.ts +0 -82
- package/form.js +0 -113
- package/form2.d.ts +0 -15
- package/form2.jsx +0 -30
- package/hooks/useBeforeUnload.d.ts +0 -1
- package/hooks/useBeforeUnload.js +0 -17
- package/hooks/useDebounceEffect.d.ts +0 -2
- package/hooks/useDebounceEffect.js +0 -14
- package/hooks/useDebouncedValue.d.ts +0 -2
- package/hooks/useDebouncedValue.js +0 -14
- package/hooks/useLagRadar.d.ts +0 -1
- package/hooks/useLagRadar.jsx +0 -124
- package/hooks/useMediaQuery.d.ts +0 -1
- package/hooks/useMediaQuery.js +0 -37
- package/hooks/useMutationWindowCloseProtection.d.ts +0 -2
- package/hooks/useMutationWindowCloseProtection.js +0 -13
- package/hooks/useScroll.d.ts +0 -3
- package/hooks/useScroll.js +0 -47
- package/hooks/useTranslation.d.ts +0 -4
- package/hooks/useTranslation.js +0 -11
- package/hooks/useWhyDidYouUpdate.d.ts +0 -3
- package/hooks/useWhyDidYouUpdate.js +0 -44
- package/imgur.d.ts +0 -1
- package/imgur.js +0 -13
- package/styles/DayPicker.classNames.d.ts +0 -29
- package/styles/DayPicker.classNames.js +0 -30
- package/styles/DayPicker.classNames.ts +0 -81
- package/styles/Dropdown.classNames.d.ts +0 -6
- package/styles/Dropdown.classNames.js +0 -7
- package/styles/Dropdown.classNames.ts +0 -38
- package/styles/Input.css +0 -23
- package/styles/Modal.classNames.d.ts +0 -2
- package/styles/Modal.classNames.js +0 -3
- package/styles/Modal.classNames.ts +0 -15
- package/styles/MultiText.css +0 -40
- package/styles/Pagination.css +0 -19
- package/styles/Tabs.css +0 -23
- package/tsconfig.tsbuildinfo +0 -1
- package/types.d.ts +0 -6
- package/types.js +0 -1
- package/utils/UseState.d.ts +0 -2
- package/utils/UseState.js +0 -1
- package/utils/blobToText.d.ts +0 -1
- package/utils/blobToText.js +0 -13
- package/utils/capitalize.d.ts +0 -1
- package/utils/capitalize.js +0 -6
- package/utils/clsx.d.ts +0 -2
- package/utils/clsx.js +0 -5
- package/utils/copy2DToClipboard.d.ts +0 -1
- package/utils/copy2DToClipboard.js +0 -44
- package/utils/cpfCpnjUtils.d.ts +0 -3
- package/utils/cpfCpnjUtils.js +0 -43
- package/utils/createLocalStorageStateHydration.d.ts +0 -1
- package/utils/createLocalStorageStateHydration.js +0 -18
- package/utils/createStateHydration.d.ts +0 -3
- package/utils/createStateHydration.js +0 -49
- package/utils/csvBlobToJson.d.ts +0 -2
- package/utils/csvBlobToJson.js +0 -59
- package/utils/downloadArrayAsCSV.d.ts +0 -1
- package/utils/downloadArrayAsCSV.js +0 -34
- package/utils/emailRegExp.d.ts +0 -2
- package/utils/emailRegExp.js +0 -2
- package/utils/fakeArray.d.ts +0 -1
- package/utils/fakeArray.js +0 -3
- package/utils/filterBoolean.d.ts +0 -1
- package/utils/filterBoolean.js +0 -3
- package/utils/formatClock.d.ts +0 -1
- package/utils/formatClock.js +0 -21
- package/utils/getInitials.d.ts +0 -4
- package/utils/getInitials.js +0 -22
- package/utils/isBrowser.d.ts +0 -12
- package/utils/isBrowser.js +0 -26
- package/utils/ms.d.ts +0 -6
- package/utils/ms.js +0 -31
- package/utils/preventDefault.d.ts +0 -2
- package/utils/preventDefault.js +0 -3
- package/utils/recursiveChildrenMap.d.ts +0 -2
- package/utils/recursiveChildrenMap.js +0 -16
- package/utils/setSelectionRange.d.ts +0 -1
- package/utils/setSelectionRange.js +0 -55
- package/utils/smoothScrollToHref.d.ts +0 -2
- package/utils/smoothScrollToHref.js +0 -14
- package/utils/stopPropagation.d.ts +0 -2
- package/utils/stopPropagation.js +0 -3
- package/utils/stripHtml.d.ts +0 -1
- package/utils/stripHtml.js +0 -4
- package/utils/stripLineBreak.d.ts +0 -1
- package/utils/stripLineBreak.js +0 -4
- package/utils/stripMarkdown.d.ts +0 -1
- package/utils/stripMarkdown.js +0 -28
- package/utils/xlsxBlobToJson.d.ts +0 -2
- package/utils/xlsxBlobToJson.js +0 -62
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Combobox } from "@headlessui/react";
|
|
2
|
-
import Loading from "../Loading";
|
|
3
|
-
import { useCallback, useEffect, useMemo, useState, } from "react";
|
|
4
|
-
import Input, { defaultHelpTextClassName, defaultInputClassName, defaultLabelClassName, defaultLeadingInputClassName, defaultTrailingClassName, defaultTrailingInputClassName, UnstyledInput, } from "../Input";
|
|
5
|
-
import clsx from "../../utils/clsx";
|
|
6
|
-
import { isEqual, take } from "lodash-es";
|
|
7
|
-
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/20/solid";
|
|
8
|
-
import { useDeepCompareEffect } from "react-use";
|
|
9
|
-
import { getValue, MultiSelectInput } from "./MultiSelectInput";
|
|
10
|
-
const defaultMenuItemsClassName = "z-10 rounded-md bg-white shadow-lg ring-1 ring-black/5 dark:ring-zinc-700 focus:outline-hidden dark:bg-zinc-800";
|
|
11
|
-
export default function MultiSelect({ placeholder, emptyText = "No item found.", items = [], renderProperty = "title", renderFunction, filterProperty = "title", filterFunction, onChange, query: defaultQuery = "", onChangeQuery, loading, inputInnerClassName, inputElementClassName, as, trailing, trailingClassName, trailingInputClassName, leadingInputClassName, static: isStatic,
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
displayValue = (item) => item?.[renderProperty] || "", value, labelClassName, creatable, getCreateLabel = (query) => `+ create "${query}"`, itemsRenderLimit, className, valueProperty = "_id", label, required, readOnly, error, ...props }) {
|
|
14
|
-
const [query, setQuery] = useState(defaultQuery);
|
|
15
|
-
const [selectedItems, setSelectedItems] = useState(value || []);
|
|
16
|
-
// noinspection DuplicatedCode
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (query !== defaultQuery) {
|
|
19
|
-
setQuery(defaultQuery);
|
|
20
|
-
}
|
|
21
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
22
|
-
}, [defaultQuery]);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (onChangeQuery && query !== defaultQuery) {
|
|
25
|
-
onChangeQuery(query);
|
|
26
|
-
}
|
|
27
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28
|
-
}, [query]);
|
|
29
|
-
const filteredItems = useMemo(() => query === ""
|
|
30
|
-
? items
|
|
31
|
-
: items.filter(filterFunction ||
|
|
32
|
-
((item) => (typeof item === "string"
|
|
33
|
-
? item
|
|
34
|
-
: item[filterProperty])
|
|
35
|
-
.toLowerCase()
|
|
36
|
-
.includes(query.toLowerCase()))), [filterFunction, filterProperty, items, query]);
|
|
37
|
-
trailing = loading ? (<Loading />) : (trailing ||
|
|
38
|
-
(!readOnly ? (<Combobox.Button className="pointer-events-auto -mr-1 flex items-center">
|
|
39
|
-
<ChevronUpDownIcon className="h-5 w-5 text-zinc-400" aria-hidden="true"/>
|
|
40
|
-
</Combobox.Button>) : undefined));
|
|
41
|
-
const ComponentInput = as || UnstyledInput;
|
|
42
|
-
const doRender = useCallback((item) => renderFunction
|
|
43
|
-
? renderFunction(item)
|
|
44
|
-
: typeof item === "string"
|
|
45
|
-
? item
|
|
46
|
-
: item[renderProperty], [renderFunction, renderProperty]);
|
|
47
|
-
useDeepCompareEffect(() => {
|
|
48
|
-
onChange?.(selectedItems);
|
|
49
|
-
}, [selectedItems || {}]);
|
|
50
|
-
useDeepCompareEffect(() => {
|
|
51
|
-
if (!isEqual(selectedItems, value)) {
|
|
52
|
-
setSelectedItems(value || []);
|
|
53
|
-
}
|
|
54
|
-
}, [value || {}]);
|
|
55
|
-
const removeItem = useCallback((item) => () => setSelectedItems((selectedItems) => [
|
|
56
|
-
...selectedItems.filter((i) => getValue(valueProperty, i) !== getValue(valueProperty, item)),
|
|
57
|
-
]), [valueProperty]);
|
|
58
|
-
if (label && required) {
|
|
59
|
-
label = (<>
|
|
60
|
-
{label} <span className="text-red-500">*</span>
|
|
61
|
-
</>);
|
|
62
|
-
}
|
|
63
|
-
const renderedItems = itemsRenderLimit
|
|
64
|
-
? take(filteredItems, itemsRenderLimit)
|
|
65
|
-
: filteredItems;
|
|
66
|
-
let inputClassName = clsx(defaultInputClassName, "bg-white dark:bg-zinc-800 pl-0", inputElementClassName, {
|
|
67
|
-
"border-dashed": readOnly,
|
|
68
|
-
});
|
|
69
|
-
let helpTextClassName = defaultHelpTextClassName;
|
|
70
|
-
if (error) {
|
|
71
|
-
inputClassName = clsx(inputClassName, "border-error-300 dark:border-error-500 text-error-900 dark:text-error-500 placeholder-error-300 focus:border-error-500 dark:focus:border-error-500 focus:ring-error-500");
|
|
72
|
-
helpTextClassName = clsx(helpTextClassName, "text-error-600 dark:text-error-500");
|
|
73
|
-
}
|
|
74
|
-
return (<div className={clsx("relative", className)}>
|
|
75
|
-
<Combobox
|
|
76
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
77
|
-
onChange={setSelectedItems} value={selectedItems.map((item) => getValue(valueProperty, item))} multiple>
|
|
78
|
-
{({ open }) => (<div>
|
|
79
|
-
<ComponentInput
|
|
80
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
81
|
-
{...props} as={MultiSelectInput} placeholder={!readOnly ? placeholder : undefined} value={query} onChange={(event) => setQuery(event.target.value)} trailing={trailing} trailingClassName={clsx(defaultTrailingClassName, trailingClassName)} inputClassName={inputClassName} innerClassName={inputInnerClassName} trailingInputClassName={clsx(defaultTrailingInputClassName, trailingInputClassName)} leadingInputClassName={clsx(defaultLeadingInputClassName, leadingInputClassName)} displayValue={displayValue} labelClassName={clsx(defaultLabelClassName, labelClassName)} selectedItems={selectedItems} doRender={doRender} removeItem={removeItem} required={required && !selectedItems.length} label={label} readOnly={readOnly} valueProperty={valueProperty} helpTextClassName={helpTextClassName} items={items}/>
|
|
82
|
-
|
|
83
|
-
{!readOnly &&
|
|
84
|
-
((creatable && query) || filteredItems.length > 0) && (<Combobox.Options static={isStatic} className={clsx(defaultMenuItemsClassName, "absolute z-10 mt-1 max-h-72 w-full scroll-py-2 overflow-y-auto py-2 text-sm text-zinc-800 dark:text-zinc-200")}>
|
|
85
|
-
{!renderedItems.some((item) => getValue(valueProperty, item) === query) &&
|
|
86
|
-
creatable &&
|
|
87
|
-
!!query && (<Combobox.Option value={query} className={({ active }) => clsx("cursor-default px-4 py-2 select-none", {
|
|
88
|
-
"bg-primary-600 text-white": active,
|
|
89
|
-
})}>
|
|
90
|
-
{({ selected }) => (<div className="flex">
|
|
91
|
-
{selected && <CheckIcon className="mr-2 w-5"/>}
|
|
92
|
-
{selected ? query : getCreateLabel(query)}
|
|
93
|
-
</div>)}
|
|
94
|
-
</Combobox.Option>)}
|
|
95
|
-
{renderedItems.map((item) => (<Combobox.Option key={getValue(valueProperty, item)} value={getValue(valueProperty, item)} className={({ active }) => clsx("cursor-default px-4 py-2 select-none", {
|
|
96
|
-
"bg-primary-600 text-white": active,
|
|
97
|
-
})}>
|
|
98
|
-
{({ selected }) => (<div className="flex">
|
|
99
|
-
{selected && <CheckIcon className="mr-2 w-5"/>}
|
|
100
|
-
{doRender(item)}
|
|
101
|
-
</div>)}
|
|
102
|
-
</Combobox.Option>))}
|
|
103
|
-
</Combobox.Options>)}
|
|
104
|
-
|
|
105
|
-
{!readOnly &&
|
|
106
|
-
!creatable &&
|
|
107
|
-
open &&
|
|
108
|
-
emptyText &&
|
|
109
|
-
query !== "" &&
|
|
110
|
-
filteredItems.length === 0 && (<p className={clsx(defaultMenuItemsClassName, "absolute mt-1 w-full p-4 text-sm text-zinc-500 dark:text-zinc-400")}>
|
|
111
|
-
{emptyText}
|
|
112
|
-
</p>)}
|
|
113
|
-
</div>)}
|
|
114
|
-
</Combobox>
|
|
115
|
-
</div>);
|
|
116
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
export declare function getValue<Id extends string | number, T extends object | string>(id: Id, item: T): string | number;
|
|
3
|
-
export declare function MultiSelectInput<Id extends string | number, T extends object | string>({ className, selectedItems, doRender, removeItem, valueProperty, readOnly, items, ...props }: {
|
|
4
|
-
className?: string;
|
|
5
|
-
selectedItems: string[];
|
|
6
|
-
doRender: (item: T) => ReactNode;
|
|
7
|
-
removeItem: (item: T) => () => void;
|
|
8
|
-
valueProperty: Id;
|
|
9
|
-
readOnly?: boolean;
|
|
10
|
-
error?: boolean;
|
|
11
|
-
items?: T[];
|
|
12
|
-
}): import("react").JSX.Element;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useRef } from "react";
|
|
2
|
-
import clsx from "../../utils/clsx";
|
|
3
|
-
import Badge from "../Badge";
|
|
4
|
-
import { Combobox } from "@headlessui/react";
|
|
5
|
-
export function getValue(id, item) {
|
|
6
|
-
return typeof item === "string"
|
|
7
|
-
? item
|
|
8
|
-
: item[id];
|
|
9
|
-
}
|
|
10
|
-
export function MultiSelectInput({ className, selectedItems, doRender, removeItem, valueProperty, readOnly, items, ...props }) {
|
|
11
|
-
const ref = useRef(null);
|
|
12
|
-
return (<div className={clsx("focus-within:border-primary-500 focus-within:ring-primary-500 dark:focus-within:border-primary-500 flex flex-wrap border focus-within:ring-1", className)} onClick={() => ref.current?.focus()}>
|
|
13
|
-
{!!selectedItems.length && (<div className="flex flex-wrap items-center gap-1 p-1.5 pb-0">
|
|
14
|
-
{selectedItems.map((selectedItem) => {
|
|
15
|
-
const item = items?.find((item) => getValue(valueProperty, item) === selectedItem);
|
|
16
|
-
if (!item)
|
|
17
|
-
return null;
|
|
18
|
-
return (<Badge key={getValue(valueProperty, item)} onActionClick={!readOnly ? removeItem(item) : undefined}>
|
|
19
|
-
{doRender(item)}
|
|
20
|
-
</Badge>);
|
|
21
|
-
})}
|
|
22
|
-
</div>)}
|
|
23
|
-
{!readOnly && (<Combobox.Input
|
|
24
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
25
|
-
{...props} ref={ref} className="rounded-md border-none ring-transparent! disabled:cursor-not-allowed disabled:text-zinc-500 sm:text-sm dark:bg-zinc-800 dark:disabled:bg-zinc-900/90" readOnly={readOnly}/>)}
|
|
26
|
-
</div>);
|
|
27
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type ChangeEventHandler, type FocusEventHandler, type Ref } from "react";
|
|
2
|
-
export interface MultiTextProps {
|
|
3
|
-
value?: string[];
|
|
4
|
-
onChangeValue?: (value: string[]) => void;
|
|
5
|
-
name?: string;
|
|
6
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
7
|
-
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
8
|
-
id?: string;
|
|
9
|
-
className?: string;
|
|
10
|
-
helpText?: string;
|
|
11
|
-
label?: string;
|
|
12
|
-
validate?: (value: string) => boolean;
|
|
13
|
-
invalidHelpText?: string;
|
|
14
|
-
error?: boolean;
|
|
15
|
-
format?: (item: string) => string;
|
|
16
|
-
readOnly?: boolean;
|
|
17
|
-
loading?: boolean;
|
|
18
|
-
type?: string;
|
|
19
|
-
required?: boolean;
|
|
20
|
-
ref?: Ref<HTMLInputElement>;
|
|
21
|
-
}
|
|
22
|
-
declare function MultiText({ value, onChangeValue, onChange, onBlur, name, id, className, helpText, label, validate, invalidHelpText, error, format, readOnly, loading, type, required, ref, }: MultiTextProps): import("react").JSX.Element;
|
|
23
|
-
export default MultiText;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { useEffect, useId, useRef, useState, } from "react";
|
|
2
|
-
import { isEqual, uniq } from "lodash-es";
|
|
3
|
-
import { useDeepCompareEffect } from "react-use";
|
|
4
|
-
import { XMarkIcon } from "@heroicons/react/20/solid";
|
|
5
|
-
import InputWrapper from "../Input2/InputWrapper";
|
|
6
|
-
function defaultFormat(item) {
|
|
7
|
-
return item;
|
|
8
|
-
}
|
|
9
|
-
function MultiText({ value, onChangeValue, onChange, onBlur, name, id, className, helpText, label, validate, invalidHelpText, error, format = defaultFormat, readOnly, loading, type, required, ref, }) {
|
|
10
|
-
const innerId = useId();
|
|
11
|
-
id = id || innerId;
|
|
12
|
-
const inputRef = useRef(null);
|
|
13
|
-
const [innerFocused, setInnerFocused] = useState(false);
|
|
14
|
-
const [innerValue, setInnerValue] = useState(value || []);
|
|
15
|
-
const [inputValue, setInputValue] = useState("");
|
|
16
|
-
const [invalid, setInvalid] = useState(false);
|
|
17
|
-
useDeepCompareEffect(() => {
|
|
18
|
-
if (value && onChangeValue && !isEqual(value, innerValue)) {
|
|
19
|
-
onChangeValue(innerValue);
|
|
20
|
-
}
|
|
21
|
-
}, [innerValue]);
|
|
22
|
-
useDeepCompareEffect(() => {
|
|
23
|
-
if (value && !isEqual(value, innerValue)) {
|
|
24
|
-
setInnerValue(value);
|
|
25
|
-
}
|
|
26
|
-
}, [value || []]);
|
|
27
|
-
const innerRef = useRef({
|
|
28
|
-
get value() {
|
|
29
|
-
return innerValue;
|
|
30
|
-
},
|
|
31
|
-
set value(value) {
|
|
32
|
-
setInnerValue(value);
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (ref) {
|
|
37
|
-
if (typeof ref === "function") {
|
|
38
|
-
ref(innerRef.current);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
try {
|
|
42
|
-
ref.current = innerRef.current;
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
// do nothing
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}, [ref]);
|
|
51
|
-
useDeepCompareEffect(() => {
|
|
52
|
-
if (onChange) {
|
|
53
|
-
onChange({
|
|
54
|
-
target: {
|
|
55
|
-
name,
|
|
56
|
-
value: innerValue,
|
|
57
|
-
},
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}, [innerValue]);
|
|
62
|
-
return (<InputWrapper id={id} className={className} helpText={(invalid ? invalidHelpText : undefined) || helpText} label={label} error={invalid || error} required={required}>
|
|
63
|
-
<div className="ui-multi-text" onClick={() => inputRef.current?.focus()} data-focused={innerFocused ? "" : undefined} data-error={invalid || error ? "" : undefined} data-loading={loading ? "" : undefined} data-readonly={readOnly ? "" : undefined}>
|
|
64
|
-
{!!innerValue?.length && (<div className="-mx-2 flex w-full flex-wrap gap-0.5">
|
|
65
|
-
{innerValue.map((item, i) => {
|
|
66
|
-
const removeItem = () => {
|
|
67
|
-
const newValue = [...innerValue];
|
|
68
|
-
newValue.splice(i, 1);
|
|
69
|
-
setInnerValue(newValue);
|
|
70
|
-
inputRef.current?.focus();
|
|
71
|
-
};
|
|
72
|
-
return (<span className="ui-multi-text-item" key={i} onClick={(e) => e.stopPropagation()} onDoubleClick={() => {
|
|
73
|
-
setInputValue(item);
|
|
74
|
-
removeItem();
|
|
75
|
-
}}>
|
|
76
|
-
<span className="ui-multi-text-item-content">
|
|
77
|
-
{format(item)}
|
|
78
|
-
</span>
|
|
79
|
-
{!readOnly && (<button className="ui-multi-text-delete-button" onClick={removeItem} type="button">
|
|
80
|
-
<XMarkIcon className="ui-multi-text-delete-icon"/>
|
|
81
|
-
</button>)}
|
|
82
|
-
</span>);
|
|
83
|
-
})}
|
|
84
|
-
</div>)}
|
|
85
|
-
<input id={id} ref={inputRef} type={type || "text"} className="ui-multi-text-input" value={inputValue} onChange={(e) => {
|
|
86
|
-
setInvalid(false);
|
|
87
|
-
setInputValue(e.target.value);
|
|
88
|
-
}} onBlur={(e) => {
|
|
89
|
-
setInnerFocused(false);
|
|
90
|
-
const value = e.currentTarget.value;
|
|
91
|
-
if (value) {
|
|
92
|
-
if (!validate || validate(value)) {
|
|
93
|
-
setInvalid(false);
|
|
94
|
-
setInnerValue(uniq([...(innerValue || []), value]));
|
|
95
|
-
setInputValue("");
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
setInvalid(true);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
onBlur?.(e);
|
|
102
|
-
}} onKeyDown={(e) => {
|
|
103
|
-
const value = e.currentTarget.value;
|
|
104
|
-
if (e.code === "Enter") {
|
|
105
|
-
e.preventDefault();
|
|
106
|
-
if (!validate || validate(value)) {
|
|
107
|
-
setInnerValue(uniq([...(innerValue || []), value]));
|
|
108
|
-
setInputValue("");
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
setInvalid(true);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}} onFocus={() => setInnerFocused(true)} readOnly={readOnly} required={required && innerValue.length === 0}/>
|
|
115
|
-
</div>
|
|
116
|
-
</InputWrapper>);
|
|
117
|
-
}
|
|
118
|
-
export default MultiText;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
export default function NavigationDrawer({ children, navigationChildren, position, title, noPadding, panelClassName, }: {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
navigationChildren: ReactNode;
|
|
5
|
-
position?: "left" | "right";
|
|
6
|
-
title?: ReactNode;
|
|
7
|
-
noPadding?: boolean;
|
|
8
|
-
panelClassName?: string;
|
|
9
|
-
}): import("react").JSX.Element;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import Drawer from "../Drawer";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
import navigationDrawerState from "./navigationDrawer.state";
|
|
4
|
-
import { useSnapshot } from "valtio";
|
|
5
|
-
import clsx from "../../utils/clsx";
|
|
6
|
-
export default function NavigationDrawer({ children, navigationChildren, position, title, noPadding, panelClassName, }) {
|
|
7
|
-
const { isOpen } = useSnapshot(navigationDrawerState);
|
|
8
|
-
const handleChangeOpen = useCallback((open) => {
|
|
9
|
-
if (window.innerWidth <= 1024) {
|
|
10
|
-
navigationDrawerState.setOpen(open);
|
|
11
|
-
}
|
|
12
|
-
}, []);
|
|
13
|
-
return (<>
|
|
14
|
-
<Drawer open={isOpen} onChangeOpen={handleChangeOpen} className="lg:hidden" position={position} title={title} noPadding={noPadding} panelClassName={panelClassName}>
|
|
15
|
-
{navigationChildren}
|
|
16
|
-
</Drawer>
|
|
17
|
-
<div className={clsx("fixed top-0 left-0 z-10 hidden h-full w-full max-w-xs flex-1 overflow-y-auto px-4 py-4 pt-20 lg:block", "bg-zinc-100/95 backdrop-blur-sm [@supports(backdrop-filter:blur(0))]:bg-zinc-100/75", "dark:bg-zinc-900/95 dark:[@supports(backdrop-filter:blur(0))]:bg-zinc-900/75", "transition-transform", {
|
|
18
|
-
"translate-x-0": isOpen,
|
|
19
|
-
"-translate-x-full": !isOpen,
|
|
20
|
-
}, panelClassName)}>
|
|
21
|
-
{navigationChildren}
|
|
22
|
-
</div>
|
|
23
|
-
<div className={clsx("flex min-h-screen flex-col ring-offset-zinc-100 transition-all duration-300", {
|
|
24
|
-
"lg:pl-80 lg:duration-150": isOpen,
|
|
25
|
-
})}>
|
|
26
|
-
{children}
|
|
27
|
-
</div>
|
|
28
|
-
</>);
|
|
29
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
-
export default function NavigationItem({ icon, children, href, exact, alternativeActiveHrefs, className, disabled, active, }: {
|
|
3
|
-
icon?: ReactElement<{
|
|
4
|
-
className?: string;
|
|
5
|
-
}>;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
href: string;
|
|
8
|
-
exact?: boolean;
|
|
9
|
-
alternativeActiveHrefs?: string[];
|
|
10
|
-
className?: string;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
active?: boolean;
|
|
13
|
-
}): import("react").JSX.Element;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import clsx from "../../utils/clsx";
|
|
2
|
-
import { useRouter } from "next/router";
|
|
3
|
-
import { cloneElement } from "react";
|
|
4
|
-
import Button from "../Button";
|
|
5
|
-
import navigationDrawerState from "./navigationDrawer.state";
|
|
6
|
-
import useMediaQuery from "../../hooks/useMediaQuery";
|
|
7
|
-
export default function NavigationItem({ icon, children, href, exact, alternativeActiveHrefs, className, disabled, active, }) {
|
|
8
|
-
const router = useRouter();
|
|
9
|
-
active =
|
|
10
|
-
active === undefined
|
|
11
|
-
? exact
|
|
12
|
-
? router.asPath === href ||
|
|
13
|
-
alternativeActiveHrefs?.some((href) => router.asPath === href)
|
|
14
|
-
: router.asPath.includes(href) ||
|
|
15
|
-
alternativeActiveHrefs?.some((href) => router.asPath.includes(href))
|
|
16
|
-
: active;
|
|
17
|
-
const isMobile = useMediaQuery(`(max-width: 1024px)`);
|
|
18
|
-
return (<Button variant={active ? "light" : "text"} color={active ? "primary" : "default"} className={clsx("w-full justify-start border-transparent", className)} leading={icon &&
|
|
19
|
-
cloneElement(icon, {
|
|
20
|
-
className: clsx(icon.props?.className, "w-5! mr-3"),
|
|
21
|
-
})} href={href} onClick={isMobile ? navigationDrawerState.close : undefined} disabled={disabled}>
|
|
22
|
-
{children}
|
|
23
|
-
</Button>);
|
|
24
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import NavigationDrawer from "./NavigationDrawer";
|
|
2
|
-
export * from "./NavigationDrawer";
|
|
3
|
-
export default NavigationDrawer;
|
|
4
|
-
export { default as NavigationItem } from "./NavigationItem";
|
|
5
|
-
export { default as navigationDrawerState } from "./navigationDrawer.state";
|
|
6
|
-
export * from "./navigationDrawer.state";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import NavigationDrawer from "./NavigationDrawer";
|
|
2
|
-
export * from "./NavigationDrawer";
|
|
3
|
-
export default NavigationDrawer;
|
|
4
|
-
export { default as NavigationItem } from "./NavigationItem";
|
|
5
|
-
export { default as navigationDrawerState } from "./navigationDrawer.state";
|
|
6
|
-
export * from "./navigationDrawer.state";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const navigationDrawerState: {
|
|
2
|
-
isOpen: boolean;
|
|
3
|
-
open(): void;
|
|
4
|
-
close(): void;
|
|
5
|
-
setOpen(open: boolean): void;
|
|
6
|
-
toggle(): void;
|
|
7
|
-
};
|
|
8
|
-
export declare const hydrateNavigationDrawerState: (cookies?: object) => void;
|
|
9
|
-
export default navigationDrawerState;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { proxy } from "valtio";
|
|
2
|
-
import createStateHydration from "../../utils/createStateHydration";
|
|
3
|
-
const navigationDrawerState = proxy({
|
|
4
|
-
isOpen: false,
|
|
5
|
-
open() {
|
|
6
|
-
navigationDrawerState.isOpen = true;
|
|
7
|
-
},
|
|
8
|
-
close() {
|
|
9
|
-
navigationDrawerState.isOpen = false;
|
|
10
|
-
},
|
|
11
|
-
setOpen(open) {
|
|
12
|
-
navigationDrawerState.isOpen = open;
|
|
13
|
-
},
|
|
14
|
-
toggle() {
|
|
15
|
-
navigationDrawerState.isOpen = !navigationDrawerState.isOpen;
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
export const hydrateNavigationDrawerState = createStateHydration("navigationDrawerState", navigationDrawerState, ["isOpen"]);
|
|
19
|
-
export default navigationDrawerState;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface NoiseProps {
|
|
3
|
-
patternSize?: number;
|
|
4
|
-
patternScaleX?: number;
|
|
5
|
-
patternScaleY?: number;
|
|
6
|
-
patternRefreshInterval?: number;
|
|
7
|
-
patternAlpha?: number;
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
declare const Noise: React.FC<NoiseProps>;
|
|
11
|
-
export default Noise;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from "react";
|
|
2
|
-
import clsx from "../../utils/clsx";
|
|
3
|
-
const Noise = ({ patternSize = 250, patternScaleX = 1, patternScaleY = 1, patternRefreshInterval = 2, patternAlpha = 15, className, }) => {
|
|
4
|
-
const grainRef = useRef(null);
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
const canvas = grainRef.current;
|
|
7
|
-
if (!canvas)
|
|
8
|
-
return;
|
|
9
|
-
const ctx = canvas.getContext("2d");
|
|
10
|
-
if (!ctx)
|
|
11
|
-
return;
|
|
12
|
-
let frame = 0;
|
|
13
|
-
const patternCanvas = document.createElement("canvas");
|
|
14
|
-
patternCanvas.width = patternSize;
|
|
15
|
-
patternCanvas.height = patternSize;
|
|
16
|
-
const patternCtx = patternCanvas.getContext("2d");
|
|
17
|
-
if (!patternCtx)
|
|
18
|
-
return;
|
|
19
|
-
const patternData = patternCtx.createImageData(patternSize, patternSize);
|
|
20
|
-
const patternPixelDataLength = patternSize * patternSize * 4;
|
|
21
|
-
const resize = () => {
|
|
22
|
-
if (!canvas)
|
|
23
|
-
return;
|
|
24
|
-
canvas.width = window.innerWidth * window.devicePixelRatio;
|
|
25
|
-
canvas.height = window.innerHeight * window.devicePixelRatio;
|
|
26
|
-
ctx.scale(patternScaleX, patternScaleY);
|
|
27
|
-
};
|
|
28
|
-
const updatePattern = () => {
|
|
29
|
-
for (let i = 0; i < patternPixelDataLength; i += 4) {
|
|
30
|
-
const value = Math.random() * 255;
|
|
31
|
-
patternData.data[i] = value;
|
|
32
|
-
patternData.data[i + 1] = value;
|
|
33
|
-
patternData.data[i + 2] = value;
|
|
34
|
-
patternData.data[i + 3] = patternAlpha;
|
|
35
|
-
}
|
|
36
|
-
patternCtx.putImageData(patternData, 0, 0);
|
|
37
|
-
};
|
|
38
|
-
const drawGrain = () => {
|
|
39
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
40
|
-
const pattern = ctx.createPattern(patternCanvas, "repeat");
|
|
41
|
-
if (pattern) {
|
|
42
|
-
ctx.fillStyle = pattern;
|
|
43
|
-
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const loop = () => {
|
|
47
|
-
if (frame % patternRefreshInterval === 0) {
|
|
48
|
-
updatePattern();
|
|
49
|
-
drawGrain();
|
|
50
|
-
}
|
|
51
|
-
frame++;
|
|
52
|
-
window.requestAnimationFrame(loop);
|
|
53
|
-
};
|
|
54
|
-
window.addEventListener("resize", resize);
|
|
55
|
-
resize();
|
|
56
|
-
loop();
|
|
57
|
-
return () => {
|
|
58
|
-
window.removeEventListener("resize", resize);
|
|
59
|
-
};
|
|
60
|
-
}, [
|
|
61
|
-
patternSize,
|
|
62
|
-
patternScaleX,
|
|
63
|
-
patternScaleY,
|
|
64
|
-
patternRefreshInterval,
|
|
65
|
-
patternAlpha,
|
|
66
|
-
]);
|
|
67
|
-
return (<canvas className={clsx("absolute top-0 left-0 h-screen w-screen", className)} ref={grainRef}/>);
|
|
68
|
-
};
|
|
69
|
-
export default Noise;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { AnimatePresence, motion } from "motion/react";
|
|
2
|
-
import { useSnapshot } from "valtio";
|
|
3
|
-
import notificationsState from "./notifications.state";
|
|
4
|
-
import { CheckCircleIcon, ExclamationCircleIcon, } from "@heroicons/react/24/outline";
|
|
5
|
-
import { XMarkIcon } from "@heroicons/react/20/solid";
|
|
6
|
-
import Button from "../Button";
|
|
7
|
-
import { cloneElement, useEffect, } from "react";
|
|
8
|
-
import clsx from "../../utils/clsx";
|
|
9
|
-
export default function Notifications({ notificationClassName, }) {
|
|
10
|
-
const { notifications, remove, setRendered } = useSnapshot(notificationsState);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
setRendered(true);
|
|
13
|
-
return () => {
|
|
14
|
-
setRendered(false);
|
|
15
|
-
};
|
|
16
|
-
}, [setRendered]);
|
|
17
|
-
return (<ul id="ui-notifications" className="pointer-events-none fixed inset-0 z-30 flex flex-col items-center justify-end gap-3 px-4 py-6 sm:items-end sm:justify-start sm:p-6">
|
|
18
|
-
<AnimatePresence initial={false}>
|
|
19
|
-
{notifications.map(({ _id, dismissable, title, message, icon, actions, style, className, }) => {
|
|
20
|
-
const iconChild = (typeof icon === "string"
|
|
21
|
-
? {
|
|
22
|
-
success: <CheckCircleIcon className="text-success-400!"/>,
|
|
23
|
-
error: (<ExclamationCircleIcon className="text-error-400!"/>),
|
|
24
|
-
}[icon]
|
|
25
|
-
: icon);
|
|
26
|
-
// noinspection SuspiciousTypeOfGuard
|
|
27
|
-
return (<motion.li key={_id} layout initial={{ opacity: 0, y: 50, scale: 0.3 }} animate={{ opacity: 1, y: 0, scale: 1 }} exit={{ opacity: 0, scale: 0.5, transition: { duration: 0.2 } }} className={clsx("pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black/5 dark:bg-zinc-800 dark:ring-white/10", notificationClassName, className)} style={style}>
|
|
28
|
-
<div className="p-4">
|
|
29
|
-
<div className="flex items-start">
|
|
30
|
-
{iconChild && (<div className="mr-2 shrink-0">
|
|
31
|
-
{cloneElement(iconChild, {
|
|
32
|
-
className: clsx("h-6 w-6 text-zinc-400 dark:text-zinc-600", iconChild.props?.className),
|
|
33
|
-
"aria-hidden": "true",
|
|
34
|
-
})}
|
|
35
|
-
</div>)}
|
|
36
|
-
<div className="ml-1 w-0 flex-1 pt-0.5">
|
|
37
|
-
<p className="text-sm font-medium text-zinc-900 dark:text-zinc-100">
|
|
38
|
-
{title || message}
|
|
39
|
-
</p>
|
|
40
|
-
{title && message && (<p className="mt-1 text-sm text-zinc-500 dark:text-zinc-400">
|
|
41
|
-
{message}
|
|
42
|
-
</p>)}
|
|
43
|
-
{actions && (<div className="-m-3 mt-0 flex">
|
|
44
|
-
{actions}
|
|
45
|
-
</div>)}
|
|
46
|
-
</div>
|
|
47
|
-
{dismissable && (<div className="ml-4 flex shrink-0">
|
|
48
|
-
<Button icon onClick={() => {
|
|
49
|
-
remove(_id);
|
|
50
|
-
}} className="h-5 w-5 p-0!" variant="text">
|
|
51
|
-
<XMarkIcon className="h-5 w-5 text-zinc-400" aria-label="Close"/>
|
|
52
|
-
</Button>
|
|
53
|
-
</div>)}
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
</motion.li>);
|
|
57
|
-
})}
|
|
58
|
-
</AnimatePresence>
|
|
59
|
-
</ul>);
|
|
60
|
-
}
|