@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,15 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
export type DialogProps = {
|
|
3
|
-
open?: boolean;
|
|
4
|
-
onClose?: (open: boolean) => void;
|
|
5
|
-
onChangeOpen?: (open: boolean) => void;
|
|
6
|
-
title?: ReactNode;
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
position?: "left" | "right";
|
|
9
|
-
actions?: ReactNode;
|
|
10
|
-
hideOverlay?: boolean;
|
|
11
|
-
className?: string;
|
|
12
|
-
noPadding?: boolean;
|
|
13
|
-
panelClassName?: string;
|
|
14
|
-
};
|
|
15
|
-
export default function Drawer({ open: defaultOpen, onClose, onChangeOpen, title, children, position, actions, hideOverlay, className, noPadding, panelClassName, }: DialogProps): import("react").JSX.Element;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Fragment, useCallback, useEffect, useState, } from "react";
|
|
2
|
-
import { Dialog as HuiDialog, Transition } from "@headlessui/react";
|
|
3
|
-
import { XMarkIcon } from "@heroicons/react/24/outline";
|
|
4
|
-
import Button from "../Button/Button";
|
|
5
|
-
import Group from "../Group/Group";
|
|
6
|
-
import clsx from "../../utils/clsx";
|
|
7
|
-
export default function Drawer({ open: defaultOpen, onClose, onChangeOpen, title, children, position = "left", actions, hideOverlay, className, noPadding, panelClassName, }) {
|
|
8
|
-
const [open, setOpen] = useState(defaultOpen);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (onClose && !open) {
|
|
11
|
-
onClose(false);
|
|
12
|
-
}
|
|
13
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
|
-
}, [open]);
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
if (onChangeOpen) {
|
|
17
|
-
onChangeOpen(open || false);
|
|
18
|
-
}
|
|
19
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
-
}, [open]);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
setOpen(defaultOpen);
|
|
23
|
-
}, [defaultOpen]);
|
|
24
|
-
return (<Transition.Root show={open} as={Fragment}>
|
|
25
|
-
<HuiDialog as="div" className={clsx("relative z-20", className)} onClose={setOpen}>
|
|
26
|
-
{!hideOverlay ? (<Transition.Child as={Fragment} enter="ease-in-out duration-300" enterFrom="opacity-0" enterTo="opacity-100" leave="ease-in-out duration-300" leaveFrom="opacity-100" leaveTo="opacity-0">
|
|
27
|
-
<div className="bg-opacity-75 fixed inset-0 bg-black/70 transition-opacity"/>
|
|
28
|
-
</Transition.Child>) : (<div className="fixed inset-0"/>)}
|
|
29
|
-
|
|
30
|
-
<div className="fixed inset-0 overflow-hidden">
|
|
31
|
-
<div className="absolute inset-0 overflow-hidden">
|
|
32
|
-
<div className={clsx("pointer-events-none fixed inset-y-0 flex max-w-full", {
|
|
33
|
-
["left-0 pr-10"]: !noPadding && position === "left",
|
|
34
|
-
["right-0 pl-10"]: !noPadding && position === "right",
|
|
35
|
-
})}>
|
|
36
|
-
<Transition.Child as={Fragment} enter="transform transition ease-in-out duration-300 sm:duration-500" enterFrom={position === "right"
|
|
37
|
-
? "translate-x-full"
|
|
38
|
-
: "-translate-x-full"} enterTo={position === "right" ? "translate-x-0" : "translate-x-0"} leave="transform transition ease-in-out duration-300 sm:duration-500" leaveFrom={position === "right" ? "translate-x-0" : "translate-x-0"} leaveTo={position === "right"
|
|
39
|
-
? "translate-x-full"
|
|
40
|
-
: "-translate-x-full"}>
|
|
41
|
-
<HuiDialog.Panel className="pointer-events-auto w-screen max-w-md">
|
|
42
|
-
<div className={clsx("flex h-full flex-col divide-y divide-zinc-200 bg-white shadow-xl dark:bg-zinc-900", panelClassName)}>
|
|
43
|
-
<div className="flex min-h-0 flex-1 flex-col overflow-y-auto pb-6">
|
|
44
|
-
<div className="sticky top-0 z-10 bg-white/95 px-4 py-6 backdrop-blur-sm sm:px-6 [@supports(backdrop-filter:blur(0))]:bg-white/50 dark:[@supports(backdrop-filter:blur(0))]:bg-zinc-900/75">
|
|
45
|
-
<div className="flex items-start">
|
|
46
|
-
{title && (<HuiDialog.Title className="text-lg font-medium text-zinc-900">
|
|
47
|
-
{title}
|
|
48
|
-
</HuiDialog.Title>)}
|
|
49
|
-
<div className="grow"/>
|
|
50
|
-
<div className="ml-3 flex h-7 items-center">
|
|
51
|
-
<Button icon variant="text" onClick={useCallback(() => setOpen(false), [])}>
|
|
52
|
-
<XMarkIcon className="h-6 w-6" aria-hidden="true"/>
|
|
53
|
-
</Button>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
<div className="relative flex-1 px-4 pt-1 sm:px-6">
|
|
58
|
-
{children}
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
{actions && (<Group className="shrink-0 justify-end px-4 py-4">
|
|
62
|
-
{actions}
|
|
63
|
-
</Group>)}
|
|
64
|
-
</div>
|
|
65
|
-
</HuiDialog.Panel>
|
|
66
|
-
</Transition.Child>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
</HuiDialog>
|
|
71
|
-
</Transition.Root>);
|
|
72
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React, { type ComponentProps } from "react";
|
|
2
|
-
import * as RDropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
3
|
-
declare function DropdownMenuContent({ className, arrowClassName, children, sideOffset, collisionPadding, ...props }: ComponentProps<typeof RDropdownMenu.Content> & {
|
|
4
|
-
arrowClassName?: string;
|
|
5
|
-
}): React.JSX.Element;
|
|
6
|
-
declare function DropdownMenuSeparator({ className, ...props }: ComponentProps<typeof RDropdownMenu.Separator>): React.JSX.Element;
|
|
7
|
-
declare function DropdownMenuItem({ className, href, target, ...props }: ComponentProps<typeof RDropdownMenu.Item> & {
|
|
8
|
-
href?: string;
|
|
9
|
-
target?: string;
|
|
10
|
-
}): React.JSX.Element;
|
|
11
|
-
declare function DropdownMenuLabel({ className, ...props }: ComponentProps<typeof RDropdownMenu.Item>): React.JSX.Element;
|
|
12
|
-
declare function DropdownMenuItemIndicator({ className, ...props }: ComponentProps<typeof RDropdownMenu.ItemIndicator>): React.JSX.Element;
|
|
13
|
-
declare function DropdownMenuCheckboxItem({ className, children, indicatorClassName, ...props }: ComponentProps<typeof RDropdownMenu.CheckboxItem> & {
|
|
14
|
-
indicatorClassName?: string;
|
|
15
|
-
}): React.JSX.Element;
|
|
16
|
-
declare function DropdownMenuSubContent({ className, children, sideOffset, alignOffset, ...props }: ComponentProps<typeof RDropdownMenu.SubContent>): React.JSX.Element;
|
|
17
|
-
declare function DropdownMenuSubTrigger({ className, href, children, ...props }: ComponentProps<typeof RDropdownMenu.SubTrigger> & {
|
|
18
|
-
href?: string;
|
|
19
|
-
}): React.JSX.Element;
|
|
20
|
-
declare const DropdownMenu: {
|
|
21
|
-
Root: React.FC<RDropdownMenu.DropdownMenuProps>;
|
|
22
|
-
Trigger: React.ForwardRefExoticComponent<RDropdownMenu.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
-
Content: typeof DropdownMenuContent;
|
|
24
|
-
Item: typeof DropdownMenuItem;
|
|
25
|
-
Separator: typeof DropdownMenuSeparator;
|
|
26
|
-
CheckboxItem: typeof DropdownMenuCheckboxItem;
|
|
27
|
-
Label: typeof DropdownMenuLabel;
|
|
28
|
-
ItemIndicator: typeof DropdownMenuItemIndicator;
|
|
29
|
-
Sub: React.FC<RDropdownMenu.DropdownMenuSubProps>;
|
|
30
|
-
SubContent: typeof DropdownMenuSubContent;
|
|
31
|
-
SubTrigger: typeof DropdownMenuSubTrigger;
|
|
32
|
-
};
|
|
33
|
-
export default DropdownMenu;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import React, { Fragment } from "react";
|
|
2
|
-
import * as RDropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
3
|
-
import clsx from "../../utils/clsx";
|
|
4
|
-
import { CheckIcon, ChevronRightIcon } from "@heroicons/react/20/solid";
|
|
5
|
-
import Link from "next/link";
|
|
6
|
-
import { dropdownCheckboxItemClassName, dropdownItemClassName, dropdownItemIndicatorClassName, dropdownLabelClassName, dropdownSeparatorClassName, } from "../../styles/Dropdown.classNames";
|
|
7
|
-
import { modalArrowClassName, modalContentClassName, } from "../../styles/Modal.classNames";
|
|
8
|
-
function DropdownMenuContent({ className, arrowClassName, children, sideOffset = 4, collisionPadding = 8, ...props }) {
|
|
9
|
-
return (<RDropdownMenu.Portal>
|
|
10
|
-
<RDropdownMenu.Content sideOffset={sideOffset} collisionPadding={collisionPadding} {...props} className={clsx(modalContentClassName, "ui-dropdown-menu-content", className)}>
|
|
11
|
-
{children}
|
|
12
|
-
<RDropdownMenu.Arrow className={clsx(modalArrowClassName, "ui-dropdown-menu-arrow", arrowClassName)}/>
|
|
13
|
-
</RDropdownMenu.Content>
|
|
14
|
-
</RDropdownMenu.Portal>);
|
|
15
|
-
}
|
|
16
|
-
function DropdownMenuSeparator({ className, ...props }) {
|
|
17
|
-
return (<RDropdownMenu.Separator {...props} className={clsx(dropdownSeparatorClassName, "ui-dropdown-menu-separator", className)}/>);
|
|
18
|
-
}
|
|
19
|
-
function DropdownMenuItem({ className, href, target, ...props }) {
|
|
20
|
-
const Wrapper = href ? Link : Fragment;
|
|
21
|
-
return (
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
<Wrapper {...(href ? { href, target } : {})}>
|
|
24
|
-
<RDropdownMenu.Item {...props} className={clsx(dropdownItemClassName, "ui-dropdown-menu-item", className)}/>
|
|
25
|
-
</Wrapper>);
|
|
26
|
-
}
|
|
27
|
-
function DropdownMenuLabel({ className, ...props }) {
|
|
28
|
-
return (<RDropdownMenu.Item {...props} className={clsx(dropdownLabelClassName, "ui-dropdown-menu-label", className)}/>);
|
|
29
|
-
}
|
|
30
|
-
function DropdownMenuItemIndicator({ className, ...props }) {
|
|
31
|
-
return (<RDropdownMenu.ItemIndicator className={clsx(dropdownItemIndicatorClassName, "ui-dropdown-menu-checkbox-item-indicator", className)} {...props}/>);
|
|
32
|
-
}
|
|
33
|
-
function DropdownMenuCheckboxItem({ className, children, indicatorClassName, ...props }) {
|
|
34
|
-
return (<RDropdownMenu.CheckboxItem {...props} className={clsx(dropdownCheckboxItemClassName, "ui-dropdown-menu-checkbox-item", className)}>
|
|
35
|
-
<DropdownMenuItemIndicator className={indicatorClassName}>
|
|
36
|
-
<CheckIcon />
|
|
37
|
-
</DropdownMenuItemIndicator>
|
|
38
|
-
{children}
|
|
39
|
-
</RDropdownMenu.CheckboxItem>);
|
|
40
|
-
}
|
|
41
|
-
function DropdownMenuSubContent({ className, children, sideOffset = 2, alignOffset = -5, ...props }) {
|
|
42
|
-
return (<RDropdownMenu.Portal>
|
|
43
|
-
<RDropdownMenu.SubContent sideOffset={sideOffset} alignOffset={alignOffset} {...props} className={clsx(modalContentClassName, "ui-dropdown-menu-sub-content", className)}>
|
|
44
|
-
{children}
|
|
45
|
-
</RDropdownMenu.SubContent>
|
|
46
|
-
</RDropdownMenu.Portal>);
|
|
47
|
-
}
|
|
48
|
-
function DropdownMenuSubTrigger({ className, href, children, ...props }) {
|
|
49
|
-
const Wrapper = href ? Link : Fragment;
|
|
50
|
-
return (
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
-
<Wrapper {...(href ? { href } : {})}>
|
|
53
|
-
<RDropdownMenu.SubTrigger {...props} className={clsx(dropdownItemClassName, "ui-dropdown-menu-sub-trigger", className)}>
|
|
54
|
-
{children}
|
|
55
|
-
<div className={clsx("absolute top-1.5 right-1.5 inline-flex items-center justify-center", "[&>svg]:h-4 [&>svg]:w-4")}>
|
|
56
|
-
<ChevronRightIcon />
|
|
57
|
-
</div>
|
|
58
|
-
</RDropdownMenu.SubTrigger>
|
|
59
|
-
</Wrapper>);
|
|
60
|
-
}
|
|
61
|
-
const DropdownMenu = {
|
|
62
|
-
Root: RDropdownMenu.Root,
|
|
63
|
-
Trigger: RDropdownMenu.Trigger,
|
|
64
|
-
Content: DropdownMenuContent,
|
|
65
|
-
Item: DropdownMenuItem,
|
|
66
|
-
Separator: DropdownMenuSeparator,
|
|
67
|
-
CheckboxItem: DropdownMenuCheckboxItem,
|
|
68
|
-
Label: DropdownMenuLabel,
|
|
69
|
-
ItemIndicator: DropdownMenuItemIndicator,
|
|
70
|
-
Sub: RDropdownMenu.Sub,
|
|
71
|
-
SubContent: DropdownMenuSubContent,
|
|
72
|
-
SubTrigger: DropdownMenuSubTrigger,
|
|
73
|
-
};
|
|
74
|
-
export default DropdownMenu;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Component, type ErrorInfo, type ReactNode } from "react";
|
|
2
|
-
export default class ErrorBoundary extends Component<{
|
|
3
|
-
title?: ReactNode;
|
|
4
|
-
content?: ReactNode;
|
|
5
|
-
tryAgain?: string;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}, {
|
|
8
|
-
hasError: boolean;
|
|
9
|
-
}> {
|
|
10
|
-
constructor(props: {
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
});
|
|
13
|
-
static getDerivedStateFromError(_error: Error): {
|
|
14
|
-
hasError: boolean;
|
|
15
|
-
};
|
|
16
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
17
|
-
render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
18
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Component } from "react";
|
|
3
|
-
import Alert from "../Alert/Alert";
|
|
4
|
-
import Button from "../Button/Button";
|
|
5
|
-
export default class ErrorBoundary extends Component {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super(props);
|
|
8
|
-
// Define a state variable to track whether is an error or not
|
|
9
|
-
this.state = { hasError: false };
|
|
10
|
-
}
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
|
-
static getDerivedStateFromError(_error) {
|
|
13
|
-
// Update state so the next render will show the fallback UI
|
|
14
|
-
return { hasError: true };
|
|
15
|
-
}
|
|
16
|
-
componentDidCatch(error, errorInfo) {
|
|
17
|
-
console.error({ error, errorInfo });
|
|
18
|
-
}
|
|
19
|
-
render() {
|
|
20
|
-
// Check if the error is thrown
|
|
21
|
-
if (this.state.hasError) {
|
|
22
|
-
// You can render any custom fallback UI
|
|
23
|
-
return (<Alert variant="error" title={this.props.title || "Oops, there was an unexpected error"} actions={this.props.tryAgain && (<Button variant="text" color="error" onClick={() => this.setState({ hasError: false })}>
|
|
24
|
-
{this.props.tryAgain}
|
|
25
|
-
</Button>)}>
|
|
26
|
-
{this.props.content}
|
|
27
|
-
</Alert>);
|
|
28
|
-
}
|
|
29
|
-
// Return children components in case of no error
|
|
30
|
-
return this.props.children;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function Error404Page(): import("react").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function Error500Page(): import("react").JSX.Element;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import ErrorPage from "./ErrorPage";
|
|
2
|
-
export default function Error500Page() {
|
|
3
|
-
return (<ErrorPage error={500} title="Something bad just happened..." description="Our servers could not handle your request. Don't worry, our development team was already notified. Try refreshing the page."/>);
|
|
4
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
export type ErrorProps = {
|
|
3
|
-
error: number;
|
|
4
|
-
background?: string;
|
|
5
|
-
title: string;
|
|
6
|
-
description: string;
|
|
7
|
-
defaultActionLabel?: string;
|
|
8
|
-
defaultActionHref?: string;
|
|
9
|
-
action?: ReactNode;
|
|
10
|
-
};
|
|
11
|
-
export default function ErrorPage({ error, background, title, description, defaultActionLabel, defaultActionHref, action, }: ErrorProps): import("react").JSX.Element;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import Button from "../Button/Button";
|
|
2
|
-
import { NextSeo } from "next-seo";
|
|
3
|
-
export default function ErrorPage({ error, background = "https://images.unsplash.com/photo-1545972154-9bb223aac798?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=3050&q=80&exp=8&con=-15&sat=-75", title, description, defaultActionLabel = "Go back home", defaultActionHref = "/", action = (<Button variant="text" href={defaultActionHref} className="bg-opacity-75 text-opacity-75 sm:bg-opacity-25 sm:hover:bg-opacity-50 inline-flex items-center rounded-md border border-transparent bg-white px-4 py-2 text-sm font-medium text-black">
|
|
4
|
-
{defaultActionLabel}
|
|
5
|
-
</Button>), }) {
|
|
6
|
-
return (<main className="min-h-full bg-slate-400 bg-cover bg-top sm:bg-top" style={{
|
|
7
|
-
backgroundImage: `url("${background}")`,
|
|
8
|
-
}}>
|
|
9
|
-
<NextSeo title={error.toString()}/>
|
|
10
|
-
<div className="mx-auto max-w-7xl px-4 py-16 text-center sm:px-6 sm:py-24 lg:px-8 lg:py-48">
|
|
11
|
-
<p className="text-opacity-50 text-base font-semibold text-black">
|
|
12
|
-
{error}
|
|
13
|
-
</p>
|
|
14
|
-
<h1 className="mt-2 text-4xl font-bold tracking-tight text-white sm:text-5xl">
|
|
15
|
-
{title}
|
|
16
|
-
</h1>
|
|
17
|
-
<p className="text-opacity-50 mt-2 text-lg font-medium text-black">
|
|
18
|
-
{description}
|
|
19
|
-
</p>
|
|
20
|
-
<div className="mt-6">{action}</div>
|
|
21
|
-
</div>
|
|
22
|
-
</main>);
|
|
23
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { type ComponentPropsWithRef, type ComponentType, type ReactNode } from "react";
|
|
2
|
-
import { type InputProps } from "../Input";
|
|
3
|
-
import { type FileSelectProps } from "../FileSelect";
|
|
4
|
-
import { type PreviewFileProps } from "./PreviewFile";
|
|
5
|
-
export type FileFile = {
|
|
6
|
-
_id: string;
|
|
7
|
-
file: File;
|
|
8
|
-
description?: string;
|
|
9
|
-
name: string;
|
|
10
|
-
type: string;
|
|
11
|
-
size: number;
|
|
12
|
-
url: string;
|
|
13
|
-
};
|
|
14
|
-
export type FileUrl = {
|
|
15
|
-
_id: string;
|
|
16
|
-
url: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
name: string;
|
|
19
|
-
type: string;
|
|
20
|
-
size: number;
|
|
21
|
-
};
|
|
22
|
-
export type FileInputFile = FileFile | FileUrl;
|
|
23
|
-
declare function FileInput<PFP extends object>({ error, className, helpText, onChange, name, limit, label, id, required, onMouseOver, onMouseOut, readOnly, value, emptyText, downloadText, openText, fileDisplay, asyncUpload, onRejectFiles, loading, maxConcurrentUploads, fileAdditionalInfo, ref, fileSelectClassName, previewFileClassName, filesPerPage, previewFileComponent, previewFileProps, filesClassName, ...props }: Pick<InputProps<false>, "error" | "className" | "helpText" | "name" | "label" | "id" | "required" | "onMouseOver" | "onMouseOut"> & Omit<FileSelectProps, "onAcceptFiles" | "onRejectFiles"> & {
|
|
24
|
-
readOnly?: boolean;
|
|
25
|
-
value?: FileInputFile[];
|
|
26
|
-
onChange?: (event: {
|
|
27
|
-
target: {
|
|
28
|
-
value: FileInputFile[];
|
|
29
|
-
};
|
|
30
|
-
}) => void;
|
|
31
|
-
emptyText?: string;
|
|
32
|
-
downloadText?: string;
|
|
33
|
-
openText?: string;
|
|
34
|
-
fileDisplay?: "info" | "preview" | "both";
|
|
35
|
-
asyncUpload?: (file: FileFile & {
|
|
36
|
-
_id: string;
|
|
37
|
-
}) => Promise<FileUrl & {
|
|
38
|
-
_id: string;
|
|
39
|
-
}>;
|
|
40
|
-
onRejectFiles?: (files: File[], reason: "type" | "size" | "limit" | "upload-error") => void;
|
|
41
|
-
loading?: boolean;
|
|
42
|
-
maxConcurrentUploads?: number;
|
|
43
|
-
fileAdditionalInfo?: (file: FileInputFile, index: number) => ReactNode;
|
|
44
|
-
fileSelectClassName?: string;
|
|
45
|
-
previewFileClassName?: string;
|
|
46
|
-
filesPerPage?: number;
|
|
47
|
-
previewFileComponent?: ComponentType<PreviewFileProps & PFP>;
|
|
48
|
-
previewFileProps?: PFP;
|
|
49
|
-
filesClassName?: string;
|
|
50
|
-
}): import("react").JSX.Element;
|
|
51
|
-
export type FileInputProps = ComponentPropsWithRef<typeof FileInput>;
|
|
52
|
-
declare const _default: typeof FileInput;
|
|
53
|
-
export default _default;
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import clsx from "../../utils/clsx";
|
|
2
|
-
import { memo, useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
3
|
-
import { useDeepCompareEffect } from "react-use";
|
|
4
|
-
import { defaultHelpTextClassName, defaultLabelClassName, } from "../Input";
|
|
5
|
-
import FileSelect, {} from "../FileSelect";
|
|
6
|
-
import isomorphicObjectId from "@majapisoftwares/next/utils/isomorphicObjectId";
|
|
7
|
-
import { isEqual } from "lodash-es";
|
|
8
|
-
import Text from "../Text";
|
|
9
|
-
import PreviewFile, {} from "./PreviewFile";
|
|
10
|
-
import concurrentForOf from "@majapisoftwares/next/utils/concurrentForOf";
|
|
11
|
-
import paginated from "@majapisoftwares/next/utils/paginated";
|
|
12
|
-
import Pagination from "../Pagination";
|
|
13
|
-
function FileInput({ error, className, helpText, onChange, name, limit, label, id, required, onMouseOver, onMouseOut, readOnly, value, emptyText = "No files", downloadText = "Download", openText = "Open", fileDisplay, asyncUpload, onRejectFiles, loading, maxConcurrentUploads = 1, fileAdditionalInfo, ref, fileSelectClassName, previewFileClassName, filesPerPage = 10, previewFileComponent, previewFileProps, filesClassName, ...props }) {
|
|
14
|
-
const [uploading, setUploading] = useState(false);
|
|
15
|
-
const [innerValue, setInnerValue] = useState(value || []);
|
|
16
|
-
const [currentPage, setCurrentPage] = useState(1);
|
|
17
|
-
const PreviewFileComponent = useMemo(() => memo(previewFileComponent || PreviewFile, isEqual), [previewFileComponent]);
|
|
18
|
-
const paginatedValue = paginated(innerValue, currentPage - 1, filesPerPage);
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
const totalPages = Math.ceil(innerValue.length / filesPerPage);
|
|
21
|
-
if (currentPage > totalPages && totalPages > 0) {
|
|
22
|
-
setCurrentPage(totalPages);
|
|
23
|
-
}
|
|
24
|
-
}, [innerValue.length, currentPage, filesPerPage]);
|
|
25
|
-
useDeepCompareEffect(() => {
|
|
26
|
-
if (value && !isEqual(value, innerValue)) {
|
|
27
|
-
setInnerValue(value);
|
|
28
|
-
}
|
|
29
|
-
}, [{ value }]);
|
|
30
|
-
const innerRef = useRef({
|
|
31
|
-
get value() {
|
|
32
|
-
return innerValue;
|
|
33
|
-
},
|
|
34
|
-
set value(value) {
|
|
35
|
-
setInnerValue(value || []);
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (ref) {
|
|
40
|
-
if (typeof ref === "function") {
|
|
41
|
-
ref(innerRef.current);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
try {
|
|
45
|
-
ref.current = innerRef.current;
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
// do nothing
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}, [ref]);
|
|
54
|
-
const handleAcceptFiles = async (files) => {
|
|
55
|
-
if (!asyncUpload) {
|
|
56
|
-
setInnerValue((value) => [
|
|
57
|
-
...value,
|
|
58
|
-
...files
|
|
59
|
-
.filter((_file, index) => !limit || index <= limit - value.length - 1)
|
|
60
|
-
.map((file) => ({
|
|
61
|
-
_id: isomorphicObjectId().toString(),
|
|
62
|
-
name: file.name,
|
|
63
|
-
file,
|
|
64
|
-
type: file.type,
|
|
65
|
-
size: file.size,
|
|
66
|
-
url: URL.createObjectURL(file),
|
|
67
|
-
})),
|
|
68
|
-
]);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
setUploading(true);
|
|
72
|
-
if (onRejectFiles) {
|
|
73
|
-
const rejectedFilesLimit = files.filter((_file, index) => !(!limit || index <= limit - innerValue.length - 1));
|
|
74
|
-
if (rejectedFilesLimit.length) {
|
|
75
|
-
onRejectFiles(rejectedFilesLimit, "limit");
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const acceptedFiles = files.filter((_file, index) => !limit || index <= limit - innerValue.length - 1);
|
|
79
|
-
const filesNotUploaded = [];
|
|
80
|
-
await concurrentForOf(acceptedFiles, async (file) => {
|
|
81
|
-
try {
|
|
82
|
-
const uploadedFile = await asyncUpload({
|
|
83
|
-
_id: isomorphicObjectId().toString(),
|
|
84
|
-
name: file.name,
|
|
85
|
-
file,
|
|
86
|
-
type: file.type,
|
|
87
|
-
size: file.size,
|
|
88
|
-
url: URL.createObjectURL(file),
|
|
89
|
-
});
|
|
90
|
-
setInnerValue((value) => [...value, uploadedFile]);
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
92
|
-
}
|
|
93
|
-
catch (e) {
|
|
94
|
-
filesNotUploaded.push(file);
|
|
95
|
-
}
|
|
96
|
-
}, maxConcurrentUploads);
|
|
97
|
-
if (onRejectFiles && filesNotUploaded.length) {
|
|
98
|
-
onRejectFiles(filesNotUploaded, "upload-error");
|
|
99
|
-
}
|
|
100
|
-
setUploading(false);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
useDeepCompareEffect(() => {
|
|
104
|
-
if (onChange) {
|
|
105
|
-
onChange({
|
|
106
|
-
target: {
|
|
107
|
-
name,
|
|
108
|
-
value: innerValue,
|
|
109
|
-
},
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}, [innerValue]);
|
|
114
|
-
const handleDeleteClick = useCallback((clickedFile) => () => {
|
|
115
|
-
setInnerValue((value) => [
|
|
116
|
-
...value.filter((file) => file !== clickedFile),
|
|
117
|
-
]);
|
|
118
|
-
}, []);
|
|
119
|
-
return (<div data-input-name={name} data-error={error ? "" : undefined} data-loading={loading ? "" : undefined} className={clsx("relative data-loading:animate-pulse", className)} onMouseOver={onMouseOver} onMouseOut={onMouseOut}>
|
|
120
|
-
{label && (<label htmlFor={id} className={defaultLabelClassName}>
|
|
121
|
-
{label}
|
|
122
|
-
{required && (<>
|
|
123
|
-
{" "}
|
|
124
|
-
<span className="text-red-500">*</span>
|
|
125
|
-
</>)}
|
|
126
|
-
</label>)}
|
|
127
|
-
<div className={clsx("flex flex-col gap-4", {
|
|
128
|
-
"md:grid md:grid-cols-2": !!innerValue.length,
|
|
129
|
-
"min-h-[140px]": !!innerValue.length || !readOnly,
|
|
130
|
-
}, filesClassName)}>
|
|
131
|
-
{paginatedValue.map((file, index) => (<PreviewFileComponent key={index} file={file} readOnly={readOnly} handleDeleteClick={handleDeleteClick(file)} downloadText={downloadText} display={fileDisplay} openText={openText} additionalInfo={fileAdditionalInfo} index={index} className={previewFileClassName} filesPerPage={filesPerPage} currentPage={currentPage} {...previewFileProps}/>))}
|
|
132
|
-
{innerValue.length > filesPerPage && (<Pagination className="mx-auto md:col-span-2" currentPage={currentPage} totalItems={innerValue.length} onChangePage={setCurrentPage} itemsPerPage={filesPerPage}/>)}
|
|
133
|
-
{readOnly && !innerValue.length && (<Text variant="secondary">{emptyText}</Text>)}
|
|
134
|
-
{!readOnly && (!limit || innerValue.length < limit) && (<FileSelect {...props} className={fileSelectClassName} id={id} onAcceptFiles={handleAcceptFiles} limit={limit ? limit - innerValue.length : undefined} uploading={uploading} onRejectFiles={onRejectFiles} error={error}/>)}
|
|
135
|
-
</div>
|
|
136
|
-
{helpText && (<div className={clsx(defaultHelpTextClassName, "in-data-error:text-error-500")}>
|
|
137
|
-
{helpText}
|
|
138
|
-
</div>)}
|
|
139
|
-
</div>);
|
|
140
|
-
}
|
|
141
|
-
export default memo(FileInput, isEqual);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { FileInputFile } from "./FileInput";
|
|
2
|
-
import { type ReactNode } from "react";
|
|
3
|
-
export type PreviewFileProps = {
|
|
4
|
-
file: FileInputFile;
|
|
5
|
-
readOnly?: boolean;
|
|
6
|
-
handleDeleteClick: () => void;
|
|
7
|
-
downloadText: string;
|
|
8
|
-
openText: string;
|
|
9
|
-
display?: "info" | "preview" | "both";
|
|
10
|
-
additionalInfo?: (file: FileInputFile, index: number) => ReactNode;
|
|
11
|
-
index: number;
|
|
12
|
-
className?: string;
|
|
13
|
-
filesPerPage: number;
|
|
14
|
-
currentPage: number;
|
|
15
|
-
};
|
|
16
|
-
declare function PreviewFile({ file, readOnly, handleDeleteClick, downloadText, openText, display, additionalInfo, index, className, filesPerPage, currentPage, }: PreviewFileProps): import("react").JSX.Element;
|
|
17
|
-
declare const _default: import("react").MemoExoticComponent<typeof PreviewFile>;
|
|
18
|
-
export default _default;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import Group from "../Group";
|
|
2
|
-
import { ArrowDownTrayIcon, DocumentIcon } from "@heroicons/react/24/outline";
|
|
3
|
-
import Stack from "../Stack";
|
|
4
|
-
import Text from "../Text";
|
|
5
|
-
import numeral from "numeral";
|
|
6
|
-
import Button from "../Button";
|
|
7
|
-
import { ArrowTopRightOnSquareIcon, TrashIcon, } from "@heroicons/react/20/solid";
|
|
8
|
-
import { memo } from "react";
|
|
9
|
-
import clsx from "../../utils/clsx";
|
|
10
|
-
import checkIsVideo from "./isVideo";
|
|
11
|
-
import checkIsImage from "./isImage";
|
|
12
|
-
import { isEqual } from "lodash-es";
|
|
13
|
-
function PreviewFile({ file, readOnly, handleDeleteClick, downloadText, openText, display = "info", additionalInfo, index, className, filesPerPage, currentPage, }) {
|
|
14
|
-
const isVideo = file.type?.startsWith("video") || checkIsVideo(file.url);
|
|
15
|
-
const isImage = file.type?.startsWith("image") || checkIsImage(file.url);
|
|
16
|
-
if (display === "preview" && !isVideo && !isImage) {
|
|
17
|
-
display = "info";
|
|
18
|
-
}
|
|
19
|
-
return (<div className={clsx("group relative flex flex-wrap items-center justify-center rounded-md bg-zinc-200 dark:bg-zinc-800", className)}>
|
|
20
|
-
{["preview", "both"].includes(display) &&
|
|
21
|
-
(isVideo ? (<video className="max-h-96 rounded-md" src={file.url} controls/>) : (
|
|
22
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
23
|
-
<img src={file.url} alt={file.description} className="max-h-96 rounded-md"/>))}
|
|
24
|
-
{["info", "both"].includes(display) && (<Group className="w-full items-center gap-0">
|
|
25
|
-
{display === "info" && (<div className="m-2 mr-0 rounded-lg bg-zinc-300 p-2 dark:bg-zinc-800">
|
|
26
|
-
<DocumentIcon className="h-5 w-5"/>
|
|
27
|
-
</div>)}
|
|
28
|
-
<Stack className="w-full overflow-hidden p-3">
|
|
29
|
-
<Stack className="gap-1">
|
|
30
|
-
<div className="flex-1 truncate" title={file.name}>
|
|
31
|
-
{file.name}
|
|
32
|
-
</div>
|
|
33
|
-
{file.description && <div>{file.description}</div>}
|
|
34
|
-
<Text size="sm">{file.type}</Text>
|
|
35
|
-
{!!file.size && (<Text size="sm">{numeral(file.size).format("0b")}</Text>)}
|
|
36
|
-
{!file.url.startsWith("blob") && (<Group className="mr-auto">
|
|
37
|
-
<Button leading={<ArrowTopRightOnSquareIcon />} href={file.url} target="_blank">
|
|
38
|
-
{openText}
|
|
39
|
-
</Button>
|
|
40
|
-
<Button leading={<ArrowDownTrayIcon />} href={file.url} download={file.name}>
|
|
41
|
-
{downloadText}
|
|
42
|
-
</Button>
|
|
43
|
-
</Group>)}
|
|
44
|
-
</Stack>
|
|
45
|
-
{additionalInfo &&
|
|
46
|
-
additionalInfo(file, index + (currentPage - 1) * filesPerPage)}
|
|
47
|
-
</Stack>
|
|
48
|
-
</Group>)}
|
|
49
|
-
{!readOnly && (<Button icon variant="filled" color="default" className="absolute top-2 right-2 group-hover:opacity-100 sm:opacity-0" onClick={handleDeleteClick}>
|
|
50
|
-
<TrashIcon />
|
|
51
|
-
</Button>)}
|
|
52
|
-
</div>);
|
|
53
|
-
}
|
|
54
|
-
export default memo(PreviewFile, isEqual);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function isImage(file: File | string): boolean;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const imageExtensions = [".png", ".jpg", ".jpeg", ".webp"];
|
|
2
|
-
export default function isImage(file) {
|
|
3
|
-
if (typeof file === "string") {
|
|
4
|
-
return imageExtensions.some((ext) => file.endsWith(ext));
|
|
5
|
-
}
|
|
6
|
-
if (file instanceof File) {
|
|
7
|
-
return imageExtensions.some((ext) => file.name.endsWith(ext));
|
|
8
|
-
}
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function isVideo(file: File | string): boolean;
|