@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,7 +0,0 @@
|
|
|
1
|
-
import { type ComponentProps } from "react";
|
|
2
|
-
import Button from "../Button";
|
|
3
|
-
export default function VisibilityActivatedButton({ rootMargin, threshold, root, ...props }: ComponentProps<typeof Button> & {
|
|
4
|
-
root?: Element | Document | null;
|
|
5
|
-
threshold?: number;
|
|
6
|
-
rootMargin?: string;
|
|
7
|
-
}): import("react").JSX.Element;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react";
|
|
2
|
-
import { useIntersection } from "react-use";
|
|
3
|
-
import Button from "../Button";
|
|
4
|
-
export default function VisibilityActivatedButton({ rootMargin, threshold, root, ...props }) {
|
|
5
|
-
const observerRef = useRef(null);
|
|
6
|
-
const intersection = useIntersection(observerRef, {
|
|
7
|
-
root,
|
|
8
|
-
rootMargin,
|
|
9
|
-
threshold,
|
|
10
|
-
});
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (intersection && intersection.isIntersecting) {
|
|
13
|
-
observerRef.current?.click();
|
|
14
|
-
}
|
|
15
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
-
}, [intersection?.isIntersecting]);
|
|
17
|
-
return <Button ref={observerRef} {...props}/>;
|
|
18
|
-
}
|
package/form.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { type FormEvent } from "react";
|
|
2
|
-
import type { ArrayKey, IsTuple, TupleKeys } from "react-hook-form/dist/types/path/common";
|
|
3
|
-
import type { Get, PartialDeep, RequiredDeep, WritableDeep } from "type-fest";
|
|
4
|
-
import type { DeepPartial } from "redux";
|
|
5
|
-
type Any = any;
|
|
6
|
-
export type DeepMapValues<T, V> = {
|
|
7
|
-
[K in keyof T]: T[K] extends Array<Any> ? DeepMapValues<T[K][0], V> & V : T[K] extends object ? DeepMapValues<T[K], V> : V;
|
|
8
|
-
};
|
|
9
|
-
export type IsEqual<T1, T2> = T1 extends T2 ? (<G>() => G extends T1 ? 1 : 2) extends <G>() => G extends T2 ? 1 : 2 ? true : false : false;
|
|
10
|
-
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
11
|
-
export type BrowserNativeObject = Date | FileList | File;
|
|
12
|
-
export type FieldValues = Record<string, Any>;
|
|
13
|
-
export type AnyIsEqual<T1, T2> = T1 extends T2 ? IsEqual<T1, T2> extends true ? true : never : never;
|
|
14
|
-
export type PathImpl<K extends string | number, V, TraversedTypes> = V extends Primitive | BrowserNativeObject ? `${K}` : true extends AnyIsEqual<TraversedTypes, V> ? `${K}` : `${K}` | `${K}.${PathInternal<V, TraversedTypes | V>}`;
|
|
15
|
-
export type PathInternal<T, TraversedTypes = T> = T extends ReadonlyArray<infer V> ? IsTuple<T> extends true ? {
|
|
16
|
-
[K in TupleKeys<T>]-?: PathImpl<K & string, T[K], TraversedTypes>;
|
|
17
|
-
}[TupleKeys<T>] : PathImpl<ArrayKey, V, TraversedTypes> : {
|
|
18
|
-
[K in keyof T]-?: PathImpl<K & string, T[K], TraversedTypes>;
|
|
19
|
-
}[keyof T];
|
|
20
|
-
export type Path<T> = T extends Any ? PathInternal<T> : never;
|
|
21
|
-
export type FieldPath<TFieldValues extends FieldValues> = Path<TFieldValues>;
|
|
22
|
-
export type DeepRequiredByValidation<T, V extends {
|
|
23
|
-
[K in keyof T]?: Any;
|
|
24
|
-
}> = {
|
|
25
|
-
[P in keyof T]-?: P extends keyof V ? T[P] extends object ? DeepRequiredByValidation<T[P], V[P]> : DeepRequiredByValidation<NonNullable<T[P]>, V[P]> : T[P];
|
|
26
|
-
};
|
|
27
|
-
export type Validation = {
|
|
28
|
-
required?: string;
|
|
29
|
-
min?: [number, string];
|
|
30
|
-
pattern?: [RegExp, string];
|
|
31
|
-
};
|
|
32
|
-
export declare function createFormState<T extends object, V extends PartialDeep<DeepMapValues<RequiredDeep<T>, Validation>>>(options: {
|
|
33
|
-
defaultValues: T;
|
|
34
|
-
validation?: V;
|
|
35
|
-
}): {
|
|
36
|
-
options: {
|
|
37
|
-
defaultValues: T;
|
|
38
|
-
validation?: V;
|
|
39
|
-
};
|
|
40
|
-
values: DeepRequiredByValidation<T, V>;
|
|
41
|
-
setValue<N extends FieldPath<T>>(name: N, value: DeepPartial<Get<T, N>>): void;
|
|
42
|
-
errors: DeepMapValues<RequiredDeep<T>, {
|
|
43
|
-
message: string;
|
|
44
|
-
}>;
|
|
45
|
-
registeredFields: {
|
|
46
|
-
value: string[];
|
|
47
|
-
} & {
|
|
48
|
-
$$valtioSnapshot: {
|
|
49
|
-
value: string[];
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
reset(values?: DeepPartial<T>): void;
|
|
53
|
-
};
|
|
54
|
-
export declare function useForm<T extends ReturnType<typeof createFormState>>(state: T, options?: {
|
|
55
|
-
onSubmit?: (values: T["values"]) => void;
|
|
56
|
-
resetOnUnmount?: boolean;
|
|
57
|
-
}): WritableDeep<import("valtio").Snapshot<T>> & {
|
|
58
|
-
onSubmit: (e: FormEvent<HTMLFormElement>) => void;
|
|
59
|
-
register: <N extends FieldPath<T["values"]>>(name: N, handler?: {
|
|
60
|
-
onChange?: (e: Any) => Any;
|
|
61
|
-
onValueChange?: (e: Any) => Any;
|
|
62
|
-
}) => {
|
|
63
|
-
onChange(event: {
|
|
64
|
-
target: {
|
|
65
|
-
value: Any;
|
|
66
|
-
};
|
|
67
|
-
}): void;
|
|
68
|
-
name: N;
|
|
69
|
-
value: any;
|
|
70
|
-
error: boolean;
|
|
71
|
-
helpText: any;
|
|
72
|
-
required: boolean;
|
|
73
|
-
} | {
|
|
74
|
-
onValueChange(value: Any): void;
|
|
75
|
-
name: N;
|
|
76
|
-
value: any;
|
|
77
|
-
error: boolean;
|
|
78
|
-
helpText: any;
|
|
79
|
-
required: boolean;
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
export {};
|
package/form.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { proxy, ref, useSnapshot } from "valtio";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
import { cloneDeep, get, isNil, merge, set, unset } from "lodash-es";
|
|
4
|
-
import { useUnmount } from "react-use";
|
|
5
|
-
export function createFormState(options) {
|
|
6
|
-
const defaultValues = cloneDeep(options.defaultValues);
|
|
7
|
-
const valuesState = proxy(defaultValues);
|
|
8
|
-
const errorsState = proxy({});
|
|
9
|
-
const formState = proxy({
|
|
10
|
-
options,
|
|
11
|
-
values: valuesState,
|
|
12
|
-
setValue(name, value) {
|
|
13
|
-
unset(errorsState, name);
|
|
14
|
-
set(valuesState, name, value);
|
|
15
|
-
},
|
|
16
|
-
errors: errorsState,
|
|
17
|
-
registeredFields: ref({
|
|
18
|
-
value: [],
|
|
19
|
-
}),
|
|
20
|
-
reset(values) {
|
|
21
|
-
const update = merge(cloneDeep(defaultValues), cloneDeep(values));
|
|
22
|
-
for (const key in formState.values) {
|
|
23
|
-
delete formState.values[key];
|
|
24
|
-
}
|
|
25
|
-
for (const key in update) {
|
|
26
|
-
const typedKey = key;
|
|
27
|
-
formState.setValue(typedKey, update[key]);
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
return formState;
|
|
32
|
-
}
|
|
33
|
-
// noinspection JSUnusedGlobalSymbols
|
|
34
|
-
export function useForm(state, options) {
|
|
35
|
-
const snapshot = useSnapshot(state, {
|
|
36
|
-
sync: true,
|
|
37
|
-
});
|
|
38
|
-
useUnmount(() => {
|
|
39
|
-
if (options?.resetOnUnmount) {
|
|
40
|
-
snapshot.reset();
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return {
|
|
44
|
-
...snapshot,
|
|
45
|
-
onSubmit: (e) => {
|
|
46
|
-
e.preventDefault();
|
|
47
|
-
const fields = Array.from(e.currentTarget.querySelectorAll(`[name],[data-input-name]`)).map((f) => f.getAttribute("name") || f.getAttribute("data-input-name"));
|
|
48
|
-
for (const field of fields) {
|
|
49
|
-
const nameWithoutIndexes = field
|
|
50
|
-
.split(".")
|
|
51
|
-
.filter((n) => isNaN(+n))
|
|
52
|
-
.join(".");
|
|
53
|
-
const validation = get(snapshot.options.validation, nameWithoutIndexes);
|
|
54
|
-
const value = get(snapshot.values, field);
|
|
55
|
-
if (validation?.required &&
|
|
56
|
-
(Array.isArray(value) ? !value.length : !value)) {
|
|
57
|
-
set(state.errors, field, { message: validation.required });
|
|
58
|
-
}
|
|
59
|
-
else if (validation?.pattern &&
|
|
60
|
-
!validation.pattern[0].test(value)) {
|
|
61
|
-
set(state.errors, field, { message: validation.pattern[1] });
|
|
62
|
-
}
|
|
63
|
-
else if (!isNil(validation?.min) &&
|
|
64
|
-
value.length < validation?.min[0]) {
|
|
65
|
-
set(state.errors, field, { message: validation?.min[1] });
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if (Object.keys(state.errors).length === 0) {
|
|
69
|
-
options?.onSubmit?.(snapshot.values);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
console.error(state.errors);
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
register: useCallback((name, handler) => {
|
|
76
|
-
if (!state.registeredFields.value.includes(name)) {
|
|
77
|
-
state.registeredFields.value.push(name);
|
|
78
|
-
}
|
|
79
|
-
const nameWithoutIndexes = name
|
|
80
|
-
.split(".")
|
|
81
|
-
.filter((n) => isNaN(+n))
|
|
82
|
-
.join(".");
|
|
83
|
-
const value = get(snapshot.values, name);
|
|
84
|
-
const props = {
|
|
85
|
-
name,
|
|
86
|
-
value: !isNil(value) ? value : "",
|
|
87
|
-
error: !!get(snapshot.errors, name),
|
|
88
|
-
// @ts-expect-error the type is correct
|
|
89
|
-
helpText: get(snapshot.errors, name)?.message,
|
|
90
|
-
required: !!get(snapshot.options.validation, nameWithoutIndexes)?.required,
|
|
91
|
-
...(handler?.onChange || !handler?.onValueChange
|
|
92
|
-
? {
|
|
93
|
-
onChange(event) {
|
|
94
|
-
snapshot.setValue(name, (handler?.onChange
|
|
95
|
-
? handler?.onChange(event)
|
|
96
|
-
: event.target.value));
|
|
97
|
-
},
|
|
98
|
-
}
|
|
99
|
-
: {
|
|
100
|
-
onValueChange(value) {
|
|
101
|
-
snapshot.setValue(name, handler.onValueChange(value));
|
|
102
|
-
},
|
|
103
|
-
}),
|
|
104
|
-
};
|
|
105
|
-
if (!props.helpText) {
|
|
106
|
-
delete props.helpText;
|
|
107
|
-
}
|
|
108
|
-
return props;
|
|
109
|
-
},
|
|
110
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
|
-
[snapshot]),
|
|
112
|
-
};
|
|
113
|
-
}
|
package/form2.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type ControllerFieldState, type ControllerProps, type ControllerRenderProps, type FieldPath, type FieldValues, type UseFormProps, type UseFormReturn, type UseFormStateReturn } from "react-hook-form";
|
|
2
|
-
import * as z from "zod";
|
|
3
|
-
import React from "react";
|
|
4
|
-
export declare function useForm<TSchema extends z.Schema<any, any>, TFieldValues extends FieldValues = z.infer<TSchema>>({ schema, ...props }: UseFormProps<TFieldValues> & {
|
|
5
|
-
schema?: TSchema;
|
|
6
|
-
}): UseFormReturn<TFieldValues>;
|
|
7
|
-
export declare function Controller<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(props: Omit<ControllerProps<TFieldValues, TName>, "render"> & {
|
|
8
|
-
render: ({ field, fieldState, formState, }: {
|
|
9
|
-
field: ControllerRenderProps<TFieldValues, TName> & {
|
|
10
|
-
error?: string;
|
|
11
|
-
};
|
|
12
|
-
fieldState: ControllerFieldState;
|
|
13
|
-
formState: UseFormStateReturn<TFieldValues>;
|
|
14
|
-
}) => React.ReactElement;
|
|
15
|
-
}): React.JSX.Element;
|
package/form2.jsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Controller as RHFController, useForm as useRHForm, } from "react-hook-form";
|
|
2
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
3
|
-
import * as z from "zod";
|
|
4
|
-
import React, { useMemo } from "react";
|
|
5
|
-
import { get } from "lodash-es";
|
|
6
|
-
export function useForm({ schema, ...props }) {
|
|
7
|
-
const jsonProps = JSON.stringify(props);
|
|
8
|
-
const config = useMemo(() => ({
|
|
9
|
-
resolver: schema ? zodResolver(schema) : undefined,
|
|
10
|
-
...props,
|
|
11
|
-
}),
|
|
12
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13
|
-
[jsonProps, schema]);
|
|
14
|
-
const formReturn = useRHForm(config);
|
|
15
|
-
const register = formReturn.register;
|
|
16
|
-
formReturn.register = function (name, options) {
|
|
17
|
-
const registerReturn = register(name, options);
|
|
18
|
-
const zodProperty = schema
|
|
19
|
-
?.shape?.[name];
|
|
20
|
-
return {
|
|
21
|
-
...registerReturn,
|
|
22
|
-
error: get(formReturn.formState.errors, name)?.message,
|
|
23
|
-
required: !!zodProperty && !zodProperty.isOptional(),
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
return formReturn;
|
|
27
|
-
}
|
|
28
|
-
export function Controller(props) {
|
|
29
|
-
return <RHFController {...props}/>;
|
|
30
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useBeforeUnload(message?: string | false): void;
|
package/hooks/useBeforeUnload.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
export default function useBeforeUnload(message) {
|
|
3
|
-
useEffect(() => {
|
|
4
|
-
if (message) {
|
|
5
|
-
const handleBeforeUnload = (e) => {
|
|
6
|
-
e.preventDefault();
|
|
7
|
-
// noinspection JSDeprecatedSymbols
|
|
8
|
-
e.returnValue = message; // This message is not shown in most browsers
|
|
9
|
-
return message; // Some older browsers may display this message
|
|
10
|
-
};
|
|
11
|
-
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
12
|
-
return () => {
|
|
13
|
-
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
}, [message]);
|
|
17
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
export default function useDebounceEffect(fn, waitTime, deps) {
|
|
3
|
-
useEffect(() => {
|
|
4
|
-
const t = setTimeout(() => {
|
|
5
|
-
// @ts-expect-error trust me
|
|
6
|
-
// eslint-disable-next-line prefer-spread
|
|
7
|
-
fn.apply(undefined, deps);
|
|
8
|
-
}, waitTime);
|
|
9
|
-
return () => {
|
|
10
|
-
clearTimeout(t);
|
|
11
|
-
};
|
|
12
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13
|
-
}, deps);
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import ms, {} from "ms";
|
|
3
|
-
export default function useDebounce(value, delay) {
|
|
4
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
const handler = setTimeout(() => {
|
|
7
|
-
setDebouncedValue(value);
|
|
8
|
-
}, typeof delay !== "number" ? ms(delay) : delay);
|
|
9
|
-
return () => {
|
|
10
|
-
clearTimeout(handler);
|
|
11
|
-
};
|
|
12
|
-
}, [value, delay]);
|
|
13
|
-
return debouncedValue;
|
|
14
|
-
}
|
package/hooks/useLagRadar.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useLagRadar(): void;
|
package/hooks/useLagRadar.jsx
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { useWindowSize } from "react-use";
|
|
3
|
-
export default function useLagRadar() {
|
|
4
|
-
const { width, height } = useWindowSize();
|
|
5
|
-
React.useEffect(() => {
|
|
6
|
-
return lagRadar({
|
|
7
|
-
frames: 60, // number of frames to draw, more = worse performance
|
|
8
|
-
speed: 0.0017, // how fast the sweep moves (rads per ms)
|
|
9
|
-
size: Math.min(width, height) / 3, // outer frame px
|
|
10
|
-
inset: 3, // circle inset px
|
|
11
|
-
parent: document.body, // DOM node to attach to
|
|
12
|
-
});
|
|
13
|
-
}, [width, height]);
|
|
14
|
-
}
|
|
15
|
-
function lagRadar(config = {}) {
|
|
16
|
-
const { frames = 50, // number of frames to draw, more = worse performance
|
|
17
|
-
speed = 0.0017, // how fast the sweep moves (rads per ms)
|
|
18
|
-
size = 300, // outer frame px
|
|
19
|
-
inset = 3, // circle inset px
|
|
20
|
-
parent = document.body, // DOM node to attach to
|
|
21
|
-
} = config;
|
|
22
|
-
const styles = document.createTextNode(`
|
|
23
|
-
.lagRadar {
|
|
24
|
-
position: fixed;
|
|
25
|
-
bottom: 0.5rem;
|
|
26
|
-
right: 0.5rem;
|
|
27
|
-
}
|
|
28
|
-
.lagRadar {
|
|
29
|
-
pointer-events: none;
|
|
30
|
-
}
|
|
31
|
-
.lagRadar-sweep > * {
|
|
32
|
-
shape-rendering: crispEdges;
|
|
33
|
-
}
|
|
34
|
-
.lagRadar-face {
|
|
35
|
-
fill: transparent;
|
|
36
|
-
}
|
|
37
|
-
.lagRadar-hand {
|
|
38
|
-
stroke-width: 4px;
|
|
39
|
-
stroke-linecap: round;
|
|
40
|
-
}
|
|
41
|
-
`);
|
|
42
|
-
function $svg(tag, props = {}, children = []) {
|
|
43
|
-
const el = document.createElementNS("http://www.w3.org/2000/svg", tag);
|
|
44
|
-
Object.keys(props).forEach((prop) => el.setAttribute(prop, props[prop]));
|
|
45
|
-
children.forEach((child) => el.appendChild(child));
|
|
46
|
-
return el;
|
|
47
|
-
}
|
|
48
|
-
const PI2 = Math.PI * 2;
|
|
49
|
-
const middle = size / 2;
|
|
50
|
-
const radius = middle - inset;
|
|
51
|
-
const $hand = $svg("path", { class: "lagRadar-hand" });
|
|
52
|
-
const $arcs = new Array(frames).fill("path").map((t) => $svg(t));
|
|
53
|
-
const $root = $svg("svg", {
|
|
54
|
-
class: "lagRadar",
|
|
55
|
-
height: size,
|
|
56
|
-
width: size,
|
|
57
|
-
}, [
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
-
$svg("style", { type: "text/css" }, [styles]),
|
|
60
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
-
$svg("g", { class: "lagRadar-sweep" }, $arcs),
|
|
62
|
-
$hand,
|
|
63
|
-
$svg("circle", {
|
|
64
|
-
class: "lagRadar-face",
|
|
65
|
-
cx: middle,
|
|
66
|
-
cy: middle,
|
|
67
|
-
r: radius,
|
|
68
|
-
}),
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
-
]);
|
|
71
|
-
parent.appendChild($root);
|
|
72
|
-
let frame;
|
|
73
|
-
let framePtr = 0;
|
|
74
|
-
let last = {
|
|
75
|
-
rotation: 0,
|
|
76
|
-
now: Date.now(),
|
|
77
|
-
tx: middle + radius,
|
|
78
|
-
ty: middle,
|
|
79
|
-
};
|
|
80
|
-
const calcHue = (() => {
|
|
81
|
-
const max_hue = 120;
|
|
82
|
-
const max_ms = 1000;
|
|
83
|
-
const log_f = 10;
|
|
84
|
-
// noinspection SpellCheckingInspection
|
|
85
|
-
const mult = max_hue / Math.log(max_ms / log_f);
|
|
86
|
-
return function (ms_delta) {
|
|
87
|
-
return (max_hue -
|
|
88
|
-
Math.max(0, Math.min(mult * Math.log(ms_delta / log_f), max_hue)));
|
|
89
|
-
};
|
|
90
|
-
})();
|
|
91
|
-
function animate() {
|
|
92
|
-
const now = Date.now();
|
|
93
|
-
const rDelta = Math.min(PI2 - speed, speed * (now - last.now));
|
|
94
|
-
const rotation = (last.rotation + rDelta) % PI2;
|
|
95
|
-
const tx = middle + radius * Math.cos(rotation);
|
|
96
|
-
const ty = middle + radius * Math.sin(rotation);
|
|
97
|
-
const bigArc = rDelta < Math.PI ? "0" : "1";
|
|
98
|
-
const path = `M${tx} ${ty}A${radius} ${radius} 0 ${bigArc} 0 ${last.tx} ${last.ty}L${middle} ${middle}`;
|
|
99
|
-
const hue = calcHue(rDelta / speed);
|
|
100
|
-
$arcs[framePtr % frames].setAttribute("d", path);
|
|
101
|
-
$arcs[framePtr % frames].setAttribute("fill", `hsl(${hue}, 80%, 40%)`);
|
|
102
|
-
$hand.setAttribute("d", `M${middle} ${middle}L${tx} ${ty}`);
|
|
103
|
-
$hand.setAttribute("stroke", `hsl(${hue}, 80%, 60%)`);
|
|
104
|
-
for (let i = 0; i < frames; i++) {
|
|
105
|
-
$arcs[(frames + framePtr - i) % frames].style.fillOpacity = (1 -
|
|
106
|
-
i / frames);
|
|
107
|
-
}
|
|
108
|
-
framePtr++;
|
|
109
|
-
last = {
|
|
110
|
-
now,
|
|
111
|
-
rotation,
|
|
112
|
-
tx,
|
|
113
|
-
ty,
|
|
114
|
-
};
|
|
115
|
-
frame = window.requestAnimationFrame(animate);
|
|
116
|
-
}
|
|
117
|
-
animate();
|
|
118
|
-
return function destroy() {
|
|
119
|
-
if (frame) {
|
|
120
|
-
window.cancelAnimationFrame(frame);
|
|
121
|
-
}
|
|
122
|
-
$root.remove();
|
|
123
|
-
};
|
|
124
|
-
}
|
package/hooks/useMediaQuery.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useMediaQuery(query: string): boolean;
|
package/hooks/useMediaQuery.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// noinspection JSDeprecatedSymbols
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
export default function useMediaQuery(query) {
|
|
4
|
-
const getMatches = (query) => {
|
|
5
|
-
// Prevents SSR issues
|
|
6
|
-
if (typeof window !== "undefined") {
|
|
7
|
-
return window.matchMedia(query).matches;
|
|
8
|
-
}
|
|
9
|
-
return false;
|
|
10
|
-
};
|
|
11
|
-
const [matches, setMatches] = useState(getMatches(query));
|
|
12
|
-
function handleChange() {
|
|
13
|
-
setMatches(getMatches(query));
|
|
14
|
-
}
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
const matchMedia = window.matchMedia(query);
|
|
17
|
-
// Triggered at the first client-side load and if query changes
|
|
18
|
-
handleChange();
|
|
19
|
-
// Listen matchMedia
|
|
20
|
-
if (matchMedia.addListener) {
|
|
21
|
-
matchMedia.addListener(handleChange);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
matchMedia.addEventListener("change", handleChange);
|
|
25
|
-
}
|
|
26
|
-
return () => {
|
|
27
|
-
if (matchMedia.removeListener) {
|
|
28
|
-
matchMedia.removeListener(handleChange);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
matchMedia.removeEventListener("change", handleChange);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
-
}, [query]);
|
|
36
|
-
return matches;
|
|
37
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useIsMutating } from "@tanstack/react-query";
|
|
2
|
-
import useBeforeUnload from "./useBeforeUnload";
|
|
3
|
-
export default function useMutationWindowCloseProtection() {
|
|
4
|
-
const isMutating = useIsMutating();
|
|
5
|
-
useBeforeUnload(isMutating
|
|
6
|
-
? "Mutation in progress. Are you sure you want to leave this page?"
|
|
7
|
-
: false);
|
|
8
|
-
}
|
|
9
|
-
// noinspection JSUnusedGlobalSymbols
|
|
10
|
-
export function MutationWindowCloseProtection() {
|
|
11
|
-
useMutationWindowCloseProtection();
|
|
12
|
-
return null;
|
|
13
|
-
}
|
package/hooks/useScroll.d.ts
DELETED
package/hooks/useScroll.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from "react";
|
|
2
|
-
import { isBrowser } from "../utils/isBrowser";
|
|
3
|
-
// noinspection JSUnusedGlobalSymbols
|
|
4
|
-
export function useIsScrolled(disabled) {
|
|
5
|
-
return useScrollY(disabled) > 0;
|
|
6
|
-
}
|
|
7
|
-
export function useScrollY(disabled) {
|
|
8
|
-
const [scrollY, setScrollY] = useState(isBrowser ? window.scrollY : 0);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
function onScroll() {
|
|
11
|
-
setScrollY(window.scrollY);
|
|
12
|
-
}
|
|
13
|
-
if (!disabled) {
|
|
14
|
-
onScroll();
|
|
15
|
-
window.addEventListener("scroll", onScroll, { passive: true });
|
|
16
|
-
return () => {
|
|
17
|
-
window.removeEventListener("scroll", onScroll);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
}, [disabled]);
|
|
21
|
-
return scrollY;
|
|
22
|
-
}
|
|
23
|
-
export function useScrollYMovement(max = Infinity, callback, disabled) {
|
|
24
|
-
const scrollYMovement = useRef(0);
|
|
25
|
-
const previousScrollYMovement = useRef(0);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
function onScroll() {
|
|
28
|
-
const movement = window.scrollY - previousScrollYMovement.current;
|
|
29
|
-
scrollYMovement.current = scrollYMovement.current + movement;
|
|
30
|
-
scrollYMovement.current =
|
|
31
|
-
scrollYMovement.current > max
|
|
32
|
-
? max
|
|
33
|
-
: scrollYMovement.current < 0 || window.scrollY <= 0
|
|
34
|
-
? 0
|
|
35
|
-
: scrollYMovement.current;
|
|
36
|
-
callback(scrollYMovement.current);
|
|
37
|
-
previousScrollYMovement.current = window.scrollY;
|
|
38
|
-
}
|
|
39
|
-
if (!disabled) {
|
|
40
|
-
onScroll();
|
|
41
|
-
window.addEventListener("scroll", onScroll, { passive: true });
|
|
42
|
-
return () => {
|
|
43
|
-
window.removeEventListener("scroll", onScroll);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}, [callback, max, disabled]);
|
|
47
|
-
}
|
package/hooks/useTranslation.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import { get } from "lodash-es";
|
|
3
|
-
export default function useTranslation(intl, prePath) {
|
|
4
|
-
return useCallback((sentence, path) => {
|
|
5
|
-
return (get(intl, [
|
|
6
|
-
...(prePath?.split(".") || []),
|
|
7
|
-
...(path?.split(".") || []),
|
|
8
|
-
sentence,
|
|
9
|
-
].filter(Boolean)) || sentence);
|
|
10
|
-
}, [intl, prePath]);
|
|
11
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react";
|
|
2
|
-
import { isEqual } from "lodash-es";
|
|
3
|
-
export default function useWhyDidYouUpdate(name, props) {
|
|
4
|
-
// create a reference to track the previous data
|
|
5
|
-
const previousProps = useRef({});
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
if (previousProps.current) {
|
|
8
|
-
// merge the keys of previous and current data
|
|
9
|
-
const keys = Object.keys({ ...previousProps.current, ...props });
|
|
10
|
-
// to store what has changed
|
|
11
|
-
const changesObj = {};
|
|
12
|
-
// check what values have changed between the previous and current
|
|
13
|
-
keys.forEach((key) => {
|
|
14
|
-
// if both are object
|
|
15
|
-
if (typeof props[key] === "object" &&
|
|
16
|
-
typeof previousProps.current[key] === "object") {
|
|
17
|
-
if (!isEqual(previousProps.current[key], props[key])) {
|
|
18
|
-
// add to changesObj
|
|
19
|
-
changesObj[key] = {
|
|
20
|
-
from: previousProps.current[key],
|
|
21
|
-
to: props[key],
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
// if both are non-object
|
|
27
|
-
if (previousProps.current[key] !== props[key]) {
|
|
28
|
-
// add to changesObj
|
|
29
|
-
changesObj[key] = {
|
|
30
|
-
from: previousProps.current[key],
|
|
31
|
-
to: props[key],
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
// if changesObj not empty, print the cause
|
|
37
|
-
if (Object.keys(changesObj).length) {
|
|
38
|
-
console.info("This is causing re-renders", name, changesObj);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
// update the previous props with the current
|
|
42
|
-
previousProps.current = props;
|
|
43
|
-
});
|
|
44
|
-
}
|
package/imgur.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function uploadToImgur(file: Blob): Promise<string>;
|