@majapisoftwares/ui 4.0.2
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/base.css +359 -0
- package/bootstrap/AppProps.d.ts +10 -0
- package/bootstrap/AppProps.js +1 -0
- package/bootstrap/index.d.ts +1 -0
- package/bootstrap/index.js +1 -0
- package/bootstrap/modeScript.d.ts +2 -0
- package/bootstrap/modeScript.js +35 -0
- package/bootstrap/nprogress.d.ts +1 -0
- package/bootstrap/nprogress.js +19 -0
- package/bootstrap/scrolledScript.d.ts +2 -0
- package/bootstrap/scrolledScript.js +27 -0
- package/bootstrap/setupFocusManager.d.ts +1 -0
- package/bootstrap/setupFocusManager.js +13 -0
- package/bootstrap/suppressConsoleLog.d.ts +1 -0
- package/bootstrap/suppressConsoleLog.js +8 -0
- package/components/Accordion/Accordion.d.ts +19 -0
- package/components/Accordion/Accordion.jsx +27 -0
- package/components/Accordion/index.d.ts +3 -0
- package/components/Accordion/index.jsx +3 -0
- package/components/Alert/Alert.d.ts +31 -0
- package/components/Alert/Alert.jsx +53 -0
- package/components/Alert/index.d.ts +3 -0
- package/components/Alert/index.jsx +3 -0
- package/components/Aurora/Aurora.d.ts +10 -0
- package/components/Aurora/Aurora.jsx +189 -0
- package/components/Aurora/index.d.ts +3 -0
- package/components/Aurora/index.jsx +3 -0
- package/components/Autocomplete/Autocomplete.d.ts +7 -0
- package/components/Autocomplete/Autocomplete.jsx +23 -0
- package/components/Autocomplete/UnstyledAutocomplete.d.ts +36 -0
- package/components/Autocomplete/UnstyledAutocomplete.jsx +73 -0
- package/components/Autocomplete/index.d.ts +5 -0
- package/components/Autocomplete/index.jsx +5 -0
- package/components/BackgroundEffects/BottomBlurryPoint.d.ts +3 -0
- package/components/BackgroundEffects/BottomBlurryPoint.jsx +14 -0
- package/components/BackgroundEffects/TopBlurryPoint.d.ts +3 -0
- package/components/BackgroundEffects/TopBlurryPoint.jsx +14 -0
- package/components/Badge/Badge.d.ts +42 -0
- package/components/Badge/Badge.jsx +50 -0
- package/components/Badge/index.d.ts +3 -0
- package/components/Badge/index.jsx +3 -0
- package/components/Breadcrumbs/Breadcrumbs.d.ts +11 -0
- package/components/Breadcrumbs/Breadcrumbs.jsx +42 -0
- package/components/Breadcrumbs/index.d.ts +3 -0
- package/components/Breadcrumbs/index.jsx +3 -0
- package/components/Button/Button.d.ts +111 -0
- package/components/Button/Button.jsx +129 -0
- package/components/Button/UnstyledButton.d.ts +10 -0
- package/components/Button/UnstyledButton.jsx +13 -0
- package/components/Button/index.d.ts +3 -0
- package/components/Button/index.jsx +3 -0
- package/components/Carousel/Carousel.d.ts +19 -0
- package/components/Carousel/Carousel.jsx +55 -0
- package/components/Carousel/index.d.ts +3 -0
- package/components/Carousel/index.jsx +3 -0
- package/components/Checkbox/Checkbox.d.ts +14 -0
- package/components/Checkbox/Checkbox.jsx +45 -0
- package/components/Checkbox/index.d.ts +3 -0
- package/components/Checkbox/index.js +3 -0
- package/components/Code/Code.d.ts +12 -0
- package/components/Code/Code.jsx +25 -0
- package/components/Code/Json.d.ts +5 -0
- package/components/Code/Json.jsx +7 -0
- package/components/Code/index.d.ts +4 -0
- package/components/Code/index.jsx +4 -0
- package/components/ConfirmationButton/ConfirmationButton.d.ts +17 -0
- package/components/ConfirmationButton/ConfirmationButton.jsx +13 -0
- package/components/ConfirmationButton/index.d.ts +3 -0
- package/components/ConfirmationButton/index.jsx +3 -0
- package/components/ContextMenu/ContextMenu.d.ts +28 -0
- package/components/ContextMenu/ContextMenu.jsx +70 -0
- package/components/ContextMenu/index.d.ts +3 -0
- package/components/ContextMenu/index.jsx +3 -0
- package/components/CopyButton/CopyButton.d.ts +7 -0
- package/components/CopyButton/CopyButton.jsx +29 -0
- package/components/CopyButton/index.d.ts +3 -0
- package/components/CopyButton/index.jsx +3 -0
- package/components/DateInput/DateInput.d.ts +6 -0
- package/components/DateInput/DateInput.jsx +19 -0
- package/components/DateInput/DateTimeInput.d.ts +3 -0
- package/components/DateInput/DateTimeInput.jsx +8 -0
- package/components/DateInput/index.d.ts +4 -0
- package/components/DateInput/index.jsx +4 -0
- package/components/DateInput/useRefValue.d.ts +5 -0
- package/components/DateInput/useRefValue.js +48 -0
- package/components/DatePicker/DatePicker.d.ts +19 -0
- package/components/DatePicker/DatePicker.jsx +55 -0
- package/components/DatePicker/index.d.ts +3 -0
- package/components/DatePicker/index.jsx +3 -0
- package/components/DateRangePicker/DateRangePicker.d.ts +16 -0
- package/components/DateRangePicker/DateRangePicker.jsx +56 -0
- package/components/DateRangePicker/index.d.ts +3 -0
- package/components/DateRangePicker/index.jsx +3 -0
- package/components/Dialog/Dialog.d.ts +25 -0
- package/components/Dialog/Dialog.jsx +35 -0
- package/components/Dialog/Dialogs.d.ts +1 -0
- package/components/Dialog/Dialogs.jsx +21 -0
- package/components/Dialog/dialogs.state.d.ts +21 -0
- package/components/Dialog/dialogs.state.js +40 -0
- package/components/Dialog/index.d.ts +6 -0
- package/components/Dialog/index.jsx +7 -0
- package/components/Drawer/Drawer.d.ts +15 -0
- package/components/Drawer/Drawer.jsx +72 -0
- package/components/Drawer/index.d.ts +3 -0
- package/components/Drawer/index.jsx +3 -0
- package/components/DropdownMenu/DropdownMenu.d.ts +33 -0
- package/components/DropdownMenu/DropdownMenu.jsx +74 -0
- package/components/DropdownMenu/index.d.ts +3 -0
- package/components/DropdownMenu/index.jsx +3 -0
- package/components/ErrorBoundary/ErrorBoundary.d.ts +18 -0
- package/components/ErrorBoundary/ErrorBoundary.jsx +32 -0
- package/components/ErrorBoundary/index.d.ts +3 -0
- package/components/ErrorBoundary/index.jsx +3 -0
- package/components/ErrorPage/Error404Page.d.ts +1 -0
- package/components/ErrorPage/Error404Page.jsx +4 -0
- package/components/ErrorPage/Error500Page.d.ts +1 -0
- package/components/ErrorPage/Error500Page.jsx +4 -0
- package/components/ErrorPage/ErrorPage.d.ts +11 -0
- package/components/ErrorPage/ErrorPage.jsx +23 -0
- package/components/FileInput/FileInput.d.ts +47 -0
- package/components/FileInput/FileInput.jsx +144 -0
- package/components/FileInput/PreviewFile.d.ts +13 -0
- package/components/FileInput/PreviewFile.jsx +55 -0
- package/components/FileInput/index.d.ts +3 -0
- package/components/FileInput/index.jsx +3 -0
- package/components/FileSelect/FileSelect.d.ts +31 -0
- package/components/FileSelect/FileSelect.jsx +143 -0
- package/components/FileSelect/index.d.ts +3 -0
- package/components/FileSelect/index.jsx +3 -0
- package/components/Footer/Footer.d.ts +19 -0
- package/components/Footer/Footer.jsx +30 -0
- package/components/Footer/index.d.ts +3 -0
- package/components/Footer/index.jsx +3 -0
- package/components/GridPattern/GridPattern.d.ts +2 -0
- package/components/GridPattern/GridPattern.jsx +12 -0
- package/components/GridPattern/index.d.ts +3 -0
- package/components/GridPattern/index.jsx +3 -0
- package/components/Group/Group.d.ts +5 -0
- package/components/Group/Group.jsx +6 -0
- package/components/Group/index.d.ts +3 -0
- package/components/Group/index.jsx +3 -0
- package/components/Header/Header.d.ts +5 -0
- package/components/Header/Header.jsx +19 -0
- package/components/Header/index.d.ts +3 -0
- package/components/Header/index.jsx +3 -0
- package/components/ImageInput/ImageInput.d.ts +4 -0
- package/components/ImageInput/ImageInput.jsx +8 -0
- package/components/ImageInput/index.d.ts +3 -0
- package/components/ImageInput/index.jsx +3 -0
- package/components/Input/Input.d.ts +14 -0
- package/components/Input/Input.jsx +57 -0
- package/components/Input/InputIcon.d.ts +9 -0
- package/components/Input/InputIcon.jsx +7 -0
- package/components/Input/MultiSelectInput.d.ts +13 -0
- package/components/Input/MultiSelectInput.jsx +28 -0
- package/components/Input/NumericInput.d.ts +6 -0
- package/components/Input/NumericInput.jsx +6 -0
- package/components/Input/PatternInput.d.ts +6 -0
- package/components/Input/PatternInput.jsx +6 -0
- package/components/Input/UnstyledInput.d.ts +22 -0
- package/components/Input/UnstyledInput.jsx +28 -0
- package/components/Input/index.d.ts +6 -0
- package/components/Input/index.jsx +6 -0
- package/components/Input2/InputWrapper.d.ts +11 -0
- package/components/Input2/InputWrapper.jsx +11 -0
- package/components/Link/Link.d.ts +3 -0
- package/components/Link/Link.jsx +9 -0
- package/components/Link/index.d.ts +3 -0
- package/components/Link/index.jsx +3 -0
- package/components/Loading/Loading.d.ts +3 -0
- package/components/Loading/Loading.jsx +13 -0
- package/components/Loading/index.d.ts +3 -0
- package/components/Loading/index.jsx +3 -0
- package/components/Magnet/Magnet.d.ts +13 -0
- package/components/Magnet/Magnet.jsx +50 -0
- package/components/Magnet/index.d.ts +3 -0
- package/components/Magnet/index.jsx +3 -0
- package/components/Markdown/Markdown.d.ts +8 -0
- package/components/Markdown/Markdown.jsx +13 -0
- package/components/Markdown/index.d.ts +3 -0
- package/components/Markdown/index.jsx +3 -0
- package/components/Menu/Menu.d.ts +28 -0
- package/components/Menu/Menu.jsx +54 -0
- package/components/Modal/Modal.d.ts +45 -0
- package/components/Modal/Modal.jsx +65 -0
- package/components/Modal/index.d.ts +4 -0
- package/components/Modal/index.jsx +4 -0
- package/components/Modal/useModalState.d.ts +6 -0
- package/components/Modal/useModalState.js +16 -0
- package/components/ModeToggle/ModeToggle.d.ts +9 -0
- package/components/ModeToggle/ModeToggle.jsx +12 -0
- package/components/ModeToggle/index.d.ts +4 -0
- package/components/ModeToggle/index.jsx +5 -0
- package/components/ModeToggle/useModeToggle.d.ts +1 -0
- package/components/ModeToggle/useModeToggle.js +21 -0
- package/components/MultiSelect/MultiSelect.d.ts +28 -0
- package/components/MultiSelect/MultiSelect.jsx +130 -0
- package/components/MultiSelect/index.d.ts +3 -0
- package/components/MultiSelect/index.jsx +3 -0
- package/components/MultiText/MultiText.d.ts +23 -0
- package/components/MultiText/MultiText.jsx +119 -0
- package/components/MultiText/index.d.ts +3 -0
- package/components/MultiText/index.jsx +3 -0
- package/components/NavigationDrawer/NavigationDrawer.d.ts +9 -0
- package/components/NavigationDrawer/NavigationDrawer.jsx +29 -0
- package/components/NavigationDrawer/NavigationItem.d.ts +13 -0
- package/components/NavigationDrawer/NavigationItem.jsx +24 -0
- package/components/NavigationDrawer/index.d.ts +6 -0
- package/components/NavigationDrawer/index.jsx +6 -0
- package/components/NavigationDrawer/navigationDrawer.state.d.ts +9 -0
- package/components/NavigationDrawer/navigationDrawer.state.js +19 -0
- package/components/NoSsr/NoSsr.d.ts +4 -0
- package/components/NoSsr/NoSsr.jsx +8 -0
- package/components/NoSsr/index.d.ts +3 -0
- package/components/NoSsr/index.jsx +3 -0
- package/components/Noise/Noise.d.ts +11 -0
- package/components/Noise/Noise.jsx +69 -0
- package/components/Noise/index.d.ts +3 -0
- package/components/Noise/index.jsx +3 -0
- package/components/Notifications/Notifications.d.ts +3 -0
- package/components/Notifications/Notifications.jsx +60 -0
- package/components/Notifications/index.d.ts +5 -0
- package/components/Notifications/index.jsx +6 -0
- package/components/Notifications/notifications.state.d.ts +24 -0
- package/components/Notifications/notifications.state.js +41 -0
- package/components/Orb/Orb.d.ts +8 -0
- package/components/Orb/Orb.jsx +258 -0
- package/components/Orb/index.d.ts +3 -0
- package/components/Orb/index.jsx +3 -0
- package/components/Pagination/Pagination.d.ts +13 -0
- package/components/Pagination/Pagination.jsx +64 -0
- package/components/Pagination/index.d.ts +3 -0
- package/components/Pagination/index.jsx +3 -0
- package/components/Particles/Particles.d.ts +18 -0
- package/components/Particles/Particles.jsx +205 -0
- package/components/Particles/index.d.ts +3 -0
- package/components/Particles/index.jsx +3 -0
- package/components/PictureCropInput/PictureCropInput.d.ts +17 -0
- package/components/PictureCropInput/PictureCropInput.jsx +153 -0
- package/components/PictureCropInput/canvasPreview.d.ts +2 -0
- package/components/PictureCropInput/canvasPreview.js +37 -0
- package/components/PictureCropInput/index.d.ts +3 -0
- package/components/PictureCropInput/index.js +3 -0
- package/components/Popover/Popover.d.ts +13 -0
- package/components/Popover/Popover.jsx +22 -0
- package/components/Popover/index.d.ts +3 -0
- package/components/Popover/index.jsx +3 -0
- package/components/Resizable/Resizable.d.ts +12 -0
- package/components/Resizable/Resizable.jsx +54 -0
- package/components/Resizable/index.d.ts +3 -0
- package/components/Resizable/index.jsx +3 -0
- package/components/ScrollArea/ScrollArea.d.ts +9 -0
- package/components/ScrollArea/ScrollArea.jsx +16 -0
- package/components/ScrollArea/index.d.ts +3 -0
- package/components/ScrollArea/index.jsx +3 -0
- package/components/Select/Select.d.ts +24 -0
- package/components/Select/Select.jsx +55 -0
- package/components/Select/index.d.ts +3 -0
- package/components/Select/index.jsx +3 -0
- package/components/Skeleton/Skeleton.d.ts +2 -0
- package/components/Skeleton/Skeleton.jsx +8 -0
- package/components/Skeleton/index.d.ts +3 -0
- package/components/Skeleton/index.jsx +3 -0
- package/components/Slider/Slider.d.ts +10 -0
- package/components/Slider/Slider.jsx +21 -0
- package/components/Slider/index.d.ts +3 -0
- package/components/Slider/index.jsx +3 -0
- package/components/Spotlight/Spotlight.d.ts +30 -0
- package/components/Spotlight/Spotlight.jsx +77 -0
- package/components/Spotlight/index.d.ts +3 -0
- package/components/Spotlight/index.jsx +3 -0
- package/components/SpotlightCard/SpotlightCard.d.ts +7 -0
- package/components/SpotlightCard/SpotlightCard.jsx +35 -0
- package/components/SpotlightCard/index.d.ts +3 -0
- package/components/SpotlightCard/index.jsx +3 -0
- package/components/Stack/Stack.d.ts +4 -0
- package/components/Stack/Stack.jsx +5 -0
- package/components/Stack/index.d.ts +3 -0
- package/components/Stack/index.jsx +3 -0
- package/components/StarBorder/StarBorder.d.ts +11 -0
- package/components/StarBorder/StarBorder.jsx +19 -0
- package/components/StarBorder/index.d.ts +3 -0
- package/components/StarBorder/index.jsx +3 -0
- package/components/Switch/Switch.d.ts +16 -0
- package/components/Switch/Switch.jsx +24 -0
- package/components/Switch/index.d.ts +3 -0
- package/components/Switch/index.jsx +3 -0
- package/components/Table/DataTable.d.ts +57 -0
- package/components/Table/DataTable.jsx +155 -0
- package/components/Table/Table.d.ts +27 -0
- package/components/Table/Table.jsx +31 -0
- package/components/Table/TableActionButton.d.ts +6 -0
- package/components/Table/TableActionButton.jsx +20 -0
- package/components/Table/TableBody.d.ts +6 -0
- package/components/Table/TableBody.jsx +10 -0
- package/components/Table/TableCell.d.ts +9 -0
- package/components/Table/TableCell.jsx +18 -0
- package/components/Table/TableFooter.d.ts +5 -0
- package/components/Table/TableFooter.jsx +5 -0
- package/components/Table/TableFooterWithPagination.d.ts +13 -0
- package/components/Table/TableFooterWithPagination.jsx +57 -0
- package/components/Table/TableHead.d.ts +5 -0
- package/components/Table/TableHead.jsx +9 -0
- package/components/Table/TableHeadContext.d.ts +4 -0
- package/components/Table/TableHeadContext.jsx +3 -0
- package/components/Table/TableHeader.d.ts +7 -0
- package/components/Table/TableHeader.jsx +15 -0
- package/components/Table/TableRow.d.ts +8 -0
- package/components/Table/TableRow.jsx +9 -0
- package/components/Table/index.d.ts +3 -0
- package/components/Table/index.jsx +3 -0
- package/components/Tabs/Tabs.d.ts +9 -0
- package/components/Tabs/Tabs.jsx +13 -0
- package/components/Tabs/index.d.ts +3 -0
- package/components/Tabs/index.jsx +3 -0
- package/components/TabsSwitcher/Tab.d.ts +15 -0
- package/components/TabsSwitcher/Tab.jsx +18 -0
- package/components/TabsSwitcher/TabsSwitcher.d.ts +22 -0
- package/components/TabsSwitcher/TabsSwitcher.jsx +31 -0
- package/components/TabsSwitcher/index.d.ts +4 -0
- package/components/TabsSwitcher/index.jsx +4 -0
- package/components/Text/Text.d.ts +24 -0
- package/components/Text/Text.jsx +28 -0
- package/components/Text/index.d.ts +3 -0
- package/components/Text/index.jsx +3 -0
- package/components/Textarea/Textarea.d.ts +5 -0
- package/components/Textarea/Textarea.jsx +6 -0
- package/components/Textarea/index.d.ts +3 -0
- package/components/Textarea/index.js +3 -0
- package/components/Threads/Threads.d.ts +9 -0
- package/components/Threads/Threads.jsx +203 -0
- package/components/Threads/index.d.ts +3 -0
- package/components/Threads/index.jsx +3 -0
- package/components/Tooltip/Tooltip.d.ts +11 -0
- package/components/Tooltip/Tooltip.jsx +21 -0
- package/components/Tooltip/index.d.ts +3 -0
- package/components/Tooltip/index.jsx +3 -0
- package/components/VisibilityActivatedButton/VisibilityActivatedButton.d.ts +7 -0
- package/components/VisibilityActivatedButton/VisibilityActivatedButton.jsx +18 -0
- package/components/VisibilityActivatedButton/index.d.ts +3 -0
- package/components/VisibilityActivatedButton/index.jsx +3 -0
- package/form.d.ts +82 -0
- package/form.js +113 -0
- package/form2.d.ts +15 -0
- package/form2.jsx +29 -0
- package/hooks/useBeforeUnload.d.ts +1 -0
- package/hooks/useBeforeUnload.js +17 -0
- package/hooks/useDebounceEffect.d.ts +2 -0
- package/hooks/useDebounceEffect.js +14 -0
- package/hooks/useDebouncedValue.d.ts +2 -0
- package/hooks/useDebouncedValue.js +14 -0
- package/hooks/useLagRadar.d.ts +1 -0
- package/hooks/useLagRadar.jsx +124 -0
- package/hooks/useMediaQuery.d.ts +1 -0
- package/hooks/useMediaQuery.js +37 -0
- package/hooks/useMutationWindowCloseProtection.d.ts +2 -0
- package/hooks/useMutationWindowCloseProtection.js +13 -0
- package/hooks/useScroll.d.ts +3 -0
- package/hooks/useScroll.js +47 -0
- package/hooks/useTranslation.d.ts +4 -0
- package/hooks/useTranslation.js +11 -0
- package/hooks/useWhyDidYouUpdate.d.ts +3 -0
- package/hooks/useWhyDidYouUpdate.js +44 -0
- package/imgur.d.ts +1 -0
- package/imgur.js +13 -0
- package/package.json +9 -0
- package/styles/DayPicker.classNames.d.ts +29 -0
- package/styles/DayPicker.classNames.js +30 -0
- package/styles/DayPicker.classNames.ts +81 -0
- package/styles/Dropdown.classNames.d.ts +6 -0
- package/styles/Dropdown.classNames.js +7 -0
- package/styles/Dropdown.classNames.ts +38 -0
- package/styles/Input.css +23 -0
- package/styles/Modal.classNames.d.ts +2 -0
- package/styles/Modal.classNames.js +3 -0
- package/styles/Modal.classNames.ts +15 -0
- package/styles/MultiText.css +40 -0
- package/styles/Pagination.css +19 -0
- package/styles/Tabs.css +23 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/types.d.ts +6 -0
- package/types.js +1 -0
- package/utils/UseState.d.ts +3 -0
- package/utils/UseState.js +1 -0
- package/utils/blobToText.d.ts +1 -0
- package/utils/blobToText.js +13 -0
- package/utils/capitalize.d.ts +1 -0
- package/utils/capitalize.js +6 -0
- package/utils/clsx.d.ts +2 -0
- package/utils/clsx.js +5 -0
- package/utils/copy2DToClipboard.d.ts +1 -0
- package/utils/copy2DToClipboard.js +44 -0
- package/utils/cpfCpnjUtils.d.ts +3 -0
- package/utils/cpfCpnjUtils.js +43 -0
- package/utils/createLocalStorageStateHydration.d.ts +1 -0
- package/utils/createLocalStorageStateHydration.js +18 -0
- package/utils/createStateHydration.d.ts +3 -0
- package/utils/createStateHydration.js +49 -0
- package/utils/csvBlobToJson.d.ts +2 -0
- package/utils/csvBlobToJson.js +60 -0
- package/utils/downloadArrayAsCSV.d.ts +1 -0
- package/utils/downloadArrayAsCSV.js +34 -0
- package/utils/emailRegExp.d.ts +2 -0
- package/utils/emailRegExp.js +3 -0
- package/utils/fakeArray.d.ts +1 -0
- package/utils/fakeArray.js +3 -0
- package/utils/filterBoolean.d.ts +1 -0
- package/utils/filterBoolean.js +3 -0
- package/utils/formatClock.d.ts +1 -0
- package/utils/formatClock.js +21 -0
- package/utils/formatTime.d.ts +2 -0
- package/utils/formatTime.js +40 -0
- package/utils/getInitials.d.ts +4 -0
- package/utils/getInitials.js +8 -0
- package/utils/isBrowser.d.ts +12 -0
- package/utils/isBrowser.js +26 -0
- package/utils/ms.d.ts +6 -0
- package/utils/ms.js +31 -0
- package/utils/preventDefault.d.ts +1 -0
- package/utils/preventDefault.js +3 -0
- package/utils/recursiveChildrenMap.d.ts +2 -0
- package/utils/recursiveChildrenMap.js +16 -0
- package/utils/setSelectionRange.d.ts +1 -0
- package/utils/setSelectionRange.js +55 -0
- package/utils/smoothScrollToHref.d.ts +2 -0
- package/utils/smoothScrollToHref.js +10 -0
- package/utils/stopPropagation.d.ts +2 -0
- package/utils/stopPropagation.js +3 -0
- package/utils/stripHtml.d.ts +1 -0
- package/utils/stripHtml.js +4 -0
- package/utils/stripLineBreak.d.ts +1 -0
- package/utils/stripLineBreak.js +4 -0
- package/utils/stripMarkdown.d.ts +1 -0
- package/utils/stripMarkdown.js +28 -0
- package/utils/xlsxBlobToJson.d.ts +2 -0
- package/utils/xlsxBlobToJson.js +59 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import clsx from "../../utils/clsx";
|
|
3
|
+
import { ClipboardIcon } from "@heroicons/react/24/outline";
|
|
4
|
+
import Button from "../Button";
|
|
5
|
+
export default function CopyButton({ text, copyText = "Copy", copiedText = "Copied!", className, }) {
|
|
6
|
+
const [copyCount, setCopyCount] = useState(0);
|
|
7
|
+
const copied = copyCount > 0;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (copyCount > 0) {
|
|
10
|
+
const timeout = setTimeout(() => setCopyCount(0), 1000);
|
|
11
|
+
return () => {
|
|
12
|
+
clearTimeout(timeout);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}, [copyCount]);
|
|
16
|
+
return (<Button type="button" color={copied ? "success" : undefined} size="sm" className={clsx("absolute right-2.5 top-2.5 opacity-0 backdrop-blur-sm focus:opacity-100 group-hover:opacity-100", className)} onClick={() => {
|
|
17
|
+
window.navigator.clipboard.writeText(text).then(() => {
|
|
18
|
+
setCopyCount((count) => count + 1);
|
|
19
|
+
});
|
|
20
|
+
}} rounded>
|
|
21
|
+
<span aria-hidden={copied} className={clsx("pointer-events-none flex items-center gap-0.5 transition-[transform,opacity]", copied && "-translate-y-1.5 opacity-0")}>
|
|
22
|
+
<ClipboardIcon className="mr-2 h-4 w-4"/>
|
|
23
|
+
{copyText}
|
|
24
|
+
</span>
|
|
25
|
+
<span aria-hidden={!copied} className={clsx("pointer-events-none absolute inset-0 flex items-center justify-center transition-[transform,opacity]", !copied && "translate-y-1.5 opacity-0")}>
|
|
26
|
+
{copiedText}
|
|
27
|
+
</span>
|
|
28
|
+
</Button>);
|
|
29
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InputProps } from "../Input";
|
|
2
|
+
declare function DateInput({ readOnly, value, onValueChange, ref, ...props }: Omit<InputProps<false>, "value"> & {
|
|
3
|
+
value?: string;
|
|
4
|
+
onValueChange?: (value?: string) => void;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
export default DateInput;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import Input from "../Input";
|
|
3
|
+
import { CalendarIcon } from "@heroicons/react/20/solid";
|
|
4
|
+
import { useRefValue } from "./useRefValue";
|
|
5
|
+
import dayjs from "dayjs";
|
|
6
|
+
function DateInput({ readOnly, value, onValueChange, ref, ...props }) {
|
|
7
|
+
const realRef = useRefValue(ref);
|
|
8
|
+
const formattedValue = useMemo(() => (value && value.includes("T") ? value.split("T")[0] : value) || "", [value]);
|
|
9
|
+
return (<Input {...props} onChange={(e) => onValueChange?.(e.target.value
|
|
10
|
+
? `${e.target.value}T${dayjs()
|
|
11
|
+
.set("hour", 0)
|
|
12
|
+
.set("minute", 0)
|
|
13
|
+
.set("second", 0)
|
|
14
|
+
.set("millisecond", 0)
|
|
15
|
+
.toISOString()
|
|
16
|
+
.split("T")[1]}`
|
|
17
|
+
: e.target.value)} ref={realRef} type="date" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" trailing={!readOnly ? <CalendarIcon className="w-5"/> : undefined} inputClassName="pr-3!" readOnly={readOnly} value={formattedValue}/>);
|
|
18
|
+
}
|
|
19
|
+
export default DateInput;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Input from "../Input";
|
|
2
|
+
import { CalendarIcon } from "@heroicons/react/20/solid";
|
|
3
|
+
import { useRefValue } from "./useRefValue";
|
|
4
|
+
function DateTimeInput({ readOnly, ref, ...props }) {
|
|
5
|
+
const realRef = useRefValue(ref);
|
|
6
|
+
return (<Input {...props} ref={realRef} type="datetime-local" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}" trailing={!readOnly ? <CalendarIcon className="w-5"/> : undefined} inputClassName="pr-3!" readOnly={readOnly}/>);
|
|
7
|
+
}
|
|
8
|
+
export default DateTimeInput;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Ref } from "react";
|
|
2
|
+
import "dayjs/locale/pt-br";
|
|
3
|
+
export declare function parseDate(value: string): string;
|
|
4
|
+
export declare function formatDate(value: string): string;
|
|
5
|
+
export declare function useRefValue(ref?: Ref<HTMLInputElement>): import("react").RefObject<HTMLInputElement | null>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import "dayjs/locale/pt-br";
|
|
4
|
+
dayjs.locale("pt-br");
|
|
5
|
+
export function parseDate(value) {
|
|
6
|
+
try {
|
|
7
|
+
// noinspection SpellCheckingInspection
|
|
8
|
+
return dayjs(value, "YYYY-MM-DDTHH:mm").toISOString();
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
+
}
|
|
11
|
+
catch (e) {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function formatDate(value) {
|
|
16
|
+
try {
|
|
17
|
+
// noinspection SpellCheckingInspection
|
|
18
|
+
return dayjs(value).format("YYYY-MM-DDTHH:mm");
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export function useRefValue(ref) {
|
|
26
|
+
const realRef = useRef(null);
|
|
27
|
+
const innerRef = useRef({
|
|
28
|
+
get value() {
|
|
29
|
+
return parseDate(realRef.current?.value || "");
|
|
30
|
+
},
|
|
31
|
+
set value(value) {
|
|
32
|
+
if (realRef.current) {
|
|
33
|
+
realRef.current.value = formatDate(value);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (ref) {
|
|
39
|
+
if (typeof ref === "function") {
|
|
40
|
+
ref(innerRef.current);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
ref.current = innerRef.current;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, [ref]);
|
|
47
|
+
return realRef;
|
|
48
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { ComponentProps, ReactElement, ReactNode } from "react";
|
|
2
|
+
import { DateRange, Matcher, ModifiersClassNames } from "react-day-picker";
|
|
3
|
+
import Button from "../Button";
|
|
4
|
+
import type { DayPickerProps } from "react-day-picker/src/types/props";
|
|
5
|
+
export type { DateRange };
|
|
6
|
+
export default function DatePicker({ value, onValueChange, children, buttonProps, fromDate, toDate, footer, monthFooter, modifiers, modifiersClassNames, disabled, defaultMonth, }: {
|
|
7
|
+
value?: Date | string;
|
|
8
|
+
onValueChange?: (value?: Date) => void;
|
|
9
|
+
children?: (value: string) => ReactElement;
|
|
10
|
+
buttonProps?: ComponentProps<typeof Button>;
|
|
11
|
+
fromDate?: Date;
|
|
12
|
+
toDate?: Date;
|
|
13
|
+
footer?: ReactNode;
|
|
14
|
+
monthFooter?: ReactNode;
|
|
15
|
+
modifiers?: DayPickerProps["modifiers"];
|
|
16
|
+
modifiersClassNames?: ModifiersClassNames;
|
|
17
|
+
disabled?: Matcher | Matcher[];
|
|
18
|
+
defaultMonth?: Date;
|
|
19
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useState, } from "react";
|
|
2
|
+
import { DayPicker, } from "react-day-picker";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
import { CalendarIcon } from "@heroicons/react/20/solid";
|
|
5
|
+
import Button from "../Button";
|
|
6
|
+
import clsx from "../../utils/clsx";
|
|
7
|
+
import { useDeepCompareEffect } from "react-use";
|
|
8
|
+
import Popover from "../Popover";
|
|
9
|
+
import { dayPickerButtonClassName, dayPickerClassNames, } from "../../styles/DayPicker.classNames";
|
|
10
|
+
export default function DatePicker({ value, onValueChange, children, buttonProps, fromDate, toDate, footer, monthFooter, modifiers, modifiersClassNames, disabled, defaultMonth, }) {
|
|
11
|
+
const [open, setOpen] = useState(false);
|
|
12
|
+
const convertedValue = value && typeof value === "string"
|
|
13
|
+
? dayjs(value).toDate()
|
|
14
|
+
: (value || undefined);
|
|
15
|
+
const [date, setDate] = useState(convertedValue);
|
|
16
|
+
useDeepCompareEffect(() => {
|
|
17
|
+
onValueChange?.(date);
|
|
18
|
+
}, [date || {}]);
|
|
19
|
+
useDeepCompareEffect(() => {
|
|
20
|
+
setDate(convertedValue);
|
|
21
|
+
}, [convertedValue || {}]);
|
|
22
|
+
const buttonText = useMemo(() => {
|
|
23
|
+
return date ? dayjs(date).format("ll") : "";
|
|
24
|
+
}, [date]);
|
|
25
|
+
const children2 = children ? (children(buttonText)) : (<Button {...buttonProps} leading={buttonProps?.leading || <CalendarIcon />} className={clsx(dayPickerButtonClassName, buttonProps?.className)}>
|
|
26
|
+
{buttonText}
|
|
27
|
+
</Button>);
|
|
28
|
+
const defaultDisabled = useMemo(() => [
|
|
29
|
+
...(fromDate
|
|
30
|
+
? [
|
|
31
|
+
{
|
|
32
|
+
before: fromDate,
|
|
33
|
+
},
|
|
34
|
+
]
|
|
35
|
+
: []),
|
|
36
|
+
...(toDate
|
|
37
|
+
? [
|
|
38
|
+
{
|
|
39
|
+
after: toDate,
|
|
40
|
+
},
|
|
41
|
+
]
|
|
42
|
+
: []),
|
|
43
|
+
], [fromDate, toDate]);
|
|
44
|
+
const onSelect = useCallback((value) => {
|
|
45
|
+
setOpen(false);
|
|
46
|
+
setDate(value);
|
|
47
|
+
}, []);
|
|
48
|
+
return (<Popover.Root open={open} onOpenChange={setOpen}>
|
|
49
|
+
<Popover.Trigger asChild>{children2}</Popover.Trigger>
|
|
50
|
+
<Popover.Content>
|
|
51
|
+
<DayPicker mode="single" selected={date} onSelect={onSelect} showOutsideDays classNames={dayPickerClassNames} startMonth={fromDate} endMonth={toDate} footer={monthFooter} modifiers={modifiers} modifiersClassNames={modifiersClassNames} disabled={disabled || defaultDisabled} defaultMonth={defaultMonth}/>
|
|
52
|
+
{footer}
|
|
53
|
+
</Popover.Content>
|
|
54
|
+
</Popover.Root>);
|
|
55
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { ComponentProps, ReactElement, ReactNode } from "react";
|
|
2
|
+
import { DateRange } from "react-day-picker";
|
|
3
|
+
import Button from "../Button";
|
|
4
|
+
export type { DateRange };
|
|
5
|
+
export default function DateRangePicker({ value, onValueChange, children, buttonProps, fromDate, toDate, min, max, footer, monthFooter, }: {
|
|
6
|
+
value?: DateRange;
|
|
7
|
+
onValueChange?: (value?: DateRange) => void;
|
|
8
|
+
children?: (value: string) => ReactElement;
|
|
9
|
+
buttonProps?: ComponentProps<typeof Button>;
|
|
10
|
+
fromDate?: Date;
|
|
11
|
+
toDate?: Date;
|
|
12
|
+
min?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
footer?: ReactNode;
|
|
15
|
+
monthFooter?: ReactNode;
|
|
16
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useMemo, useState, } from "react";
|
|
2
|
+
import { DayPicker } from "react-day-picker";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
import { CalendarIcon } from "@heroicons/react/20/solid";
|
|
5
|
+
import Button from "../Button";
|
|
6
|
+
import clsx from "../../utils/clsx";
|
|
7
|
+
import { useDeepCompareEffect } from "react-use";
|
|
8
|
+
import Popover from "../Popover";
|
|
9
|
+
import { dayPickerButtonClassName, dayPickerClassNames, } from "../../styles/DayPicker.classNames";
|
|
10
|
+
export default function DateRangePicker({ value, onValueChange, children, buttonProps, fromDate, toDate, min, max, footer, monthFooter, }) {
|
|
11
|
+
const [range, setRange] = useState(value);
|
|
12
|
+
useDeepCompareEffect(() => {
|
|
13
|
+
onValueChange?.(range);
|
|
14
|
+
}, [range || {}]);
|
|
15
|
+
useDeepCompareEffect(() => {
|
|
16
|
+
setRange(value);
|
|
17
|
+
}, [value || {}]);
|
|
18
|
+
const buttonText = useMemo(() => {
|
|
19
|
+
let buttonText = "";
|
|
20
|
+
if (range?.from) {
|
|
21
|
+
if (!range.to) {
|
|
22
|
+
buttonText = dayjs(range.from).format("ll");
|
|
23
|
+
}
|
|
24
|
+
else if (range.to) {
|
|
25
|
+
buttonText = `${dayjs(range.from).format("ll")} – ${dayjs(range.to).format("ll")}`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return buttonText;
|
|
29
|
+
}, [range]);
|
|
30
|
+
const children2 = children ? (children(buttonText)) : (<Button {...buttonProps} leading={buttonProps?.leading || <CalendarIcon />} className={clsx(dayPickerButtonClassName, buttonProps?.className)}>
|
|
31
|
+
{buttonText}
|
|
32
|
+
</Button>);
|
|
33
|
+
const hidden = useMemo(() => [
|
|
34
|
+
...(fromDate
|
|
35
|
+
? [
|
|
36
|
+
{
|
|
37
|
+
before: fromDate,
|
|
38
|
+
},
|
|
39
|
+
]
|
|
40
|
+
: []),
|
|
41
|
+
...(toDate
|
|
42
|
+
? [
|
|
43
|
+
{
|
|
44
|
+
after: toDate,
|
|
45
|
+
},
|
|
46
|
+
]
|
|
47
|
+
: []),
|
|
48
|
+
], [fromDate, toDate]);
|
|
49
|
+
return (<Popover.Root>
|
|
50
|
+
<Popover.Trigger asChild>{children2}</Popover.Trigger>
|
|
51
|
+
<Popover.Content>
|
|
52
|
+
<DayPicker mode="range" defaultMonth={value?.from} selected={range} onSelect={setRange} numberOfMonths={2} showOutsideDays classNames={dayPickerClassNames} startMonth={fromDate} endMonth={toDate} hidden={hidden} min={min} max={max} footer={monthFooter} excludeDisabled/>
|
|
53
|
+
{footer}
|
|
54
|
+
</Popover.Content>
|
|
55
|
+
</Popover.Root>);
|
|
56
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as RDialog from "@radix-ui/react-dialog";
|
|
2
|
+
import { DialogContentProps } from "@radix-ui/react-dialog";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
export interface DialogProps {
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
contentClassName?: string;
|
|
8
|
+
contentOverflowClassName?: string;
|
|
9
|
+
closeButtonClassName?: string;
|
|
10
|
+
overlayClassName?: string;
|
|
11
|
+
titleClassName?: string;
|
|
12
|
+
descriptionClassName?: string;
|
|
13
|
+
hideTitle?: boolean;
|
|
14
|
+
contentProps?: Omit<DialogContentProps, "children">;
|
|
15
|
+
hideCloseButton?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare function Dialog({ children, title, description, open, onOpenChange, contentClassName, contentOverflowClassName, closeButtonClassName, overlayClassName, titleClassName, descriptionClassName, hideTitle, contentProps, hideCloseButton, }: {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
open: boolean;
|
|
20
|
+
onOpenChange: (open: boolean) => void;
|
|
21
|
+
} & DialogProps): import("react").JSX.Element;
|
|
22
|
+
declare namespace Dialog {
|
|
23
|
+
var Close: import("react").ForwardRefExoticComponent<RDialog.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
24
|
+
}
|
|
25
|
+
export default Dialog;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as RDialog from "@radix-ui/react-dialog";
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { XMarkIcon } from "@heroicons/react/20/solid";
|
|
4
|
+
import Button from "../Button";
|
|
5
|
+
import clsx from "../../utils/clsx";
|
|
6
|
+
import { modalContentClassName } from "../../styles/Modal.classNames";
|
|
7
|
+
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
8
|
+
export default function Dialog({ children, title, description, open, onOpenChange, contentClassName, contentOverflowClassName, closeButtonClassName, overlayClassName, titleClassName, descriptionClassName, hideTitle, contentProps, hideCloseButton, }) {
|
|
9
|
+
const TitleWrapper = !hideTitle ? Fragment : VisuallyHidden;
|
|
10
|
+
return (<RDialog.Root open={open} onOpenChange={onOpenChange}>
|
|
11
|
+
<RDialog.Portal>
|
|
12
|
+
<RDialog.Overlay className={clsx("ui-dialog-overlay", "fixed inset-0 z-20 flex items-center justify-center bg-black/50", "data-[state=closed]:animate-fade-out data-[state=open]:animate-slide-up-and-fade will-change-[opacity,transform]", overlayClassName)}>
|
|
13
|
+
<RDialog.Content className={clsx(modalContentClassName, "ui-dialog-content", "relative p-0 focus:outline-hidden", contentClassName, contentProps?.className)} {...(!description ? { "aria-describedby": undefined } : {})} {...contentProps}>
|
|
14
|
+
<div className={clsx("flex max-h-[85vh] w-[90vw] max-w-[450px] flex-col gap-3 overflow-auto p-4", contentOverflowClassName)}>
|
|
15
|
+
<TitleWrapper>
|
|
16
|
+
<RDialog.Title className={clsx("ui-dialog-title", "text-lg leading-none font-medium text-zinc-900 dark:text-zinc-50", titleClassName)}>
|
|
17
|
+
{title}
|
|
18
|
+
</RDialog.Title>
|
|
19
|
+
</TitleWrapper>
|
|
20
|
+
{description && (<RDialog.Description className={clsx("ui-dialog-description", "text-zinc-700 dark:text-zinc-300", descriptionClassName)}>
|
|
21
|
+
{description}
|
|
22
|
+
</RDialog.Description>)}
|
|
23
|
+
{children}
|
|
24
|
+
{!hideCloseButton && (<RDialog.Close asChild>
|
|
25
|
+
<Button className={clsx("absolute top-1 right-1 p-1.5", "ui-dialog-close-button", closeButtonClassName)} aria-label="Close" variant="text" icon>
|
|
26
|
+
<XMarkIcon />
|
|
27
|
+
</Button>
|
|
28
|
+
</RDialog.Close>)}
|
|
29
|
+
</div>
|
|
30
|
+
</RDialog.Content>
|
|
31
|
+
</RDialog.Overlay>
|
|
32
|
+
</RDialog.Portal>
|
|
33
|
+
</RDialog.Root>);
|
|
34
|
+
}
|
|
35
|
+
Dialog.Close = RDialog.Close;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Dialogs(): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useSnapshot } from "valtio";
|
|
2
|
+
import dialogsState, { closeDialog } from "./dialogs.state";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import Dialog from "./Dialog";
|
|
5
|
+
export default function Dialogs() {
|
|
6
|
+
const { dialogs, setRendered } = useSnapshot(dialogsState);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
setRendered(true);
|
|
9
|
+
return () => {
|
|
10
|
+
setRendered(false);
|
|
11
|
+
};
|
|
12
|
+
}, [setRendered]);
|
|
13
|
+
return (<>
|
|
14
|
+
{dialogs.map((dialog) => (<Dialog key={dialog._id} open={dialog.open} onOpenChange={() => {
|
|
15
|
+
closeDialog(dialog._id);
|
|
16
|
+
dialog.props.onClose?.(dialog._id);
|
|
17
|
+
}} {...dialog.props} title={dialog.props.title} description={dialog.props.description}>
|
|
18
|
+
{dialog.props.content}
|
|
19
|
+
</Dialog>))}
|
|
20
|
+
</>);
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { DialogProps } from "./Dialog";
|
|
3
|
+
export type IDialog = {
|
|
4
|
+
_id: string;
|
|
5
|
+
open: boolean;
|
|
6
|
+
props: {
|
|
7
|
+
content: ReactNode;
|
|
8
|
+
onClose?: (_id: string) => void;
|
|
9
|
+
} & DialogProps;
|
|
10
|
+
};
|
|
11
|
+
declare const dialogsState: {
|
|
12
|
+
rendered: boolean;
|
|
13
|
+
setRendered(rendered: boolean): void;
|
|
14
|
+
dialogs: IDialog[];
|
|
15
|
+
add({ _id, open, ...dialog }: Partial<Omit<IDialog, "props">> & IDialog["props"]): void;
|
|
16
|
+
remove(_id: string): void;
|
|
17
|
+
update(dialog: Pick<IDialog, "_id"> & Partial<Omit<IDialog, "_id">>): void;
|
|
18
|
+
};
|
|
19
|
+
export declare function showDialog(dialog: Partial<Omit<IDialog, "props">> & IDialog["props"]): void;
|
|
20
|
+
export declare function closeDialog(_id: string): void;
|
|
21
|
+
export default dialogsState;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { proxy, ref } from "valtio";
|
|
2
|
+
import isomorphicObjectId from "@majapisoftwares/next/utils/isomorphicObjectId";
|
|
3
|
+
import { find } from "lodash-es";
|
|
4
|
+
const dialogsState = proxy({
|
|
5
|
+
rendered: false,
|
|
6
|
+
setRendered(rendered) {
|
|
7
|
+
dialogsState.rendered = rendered;
|
|
8
|
+
},
|
|
9
|
+
dialogs: [],
|
|
10
|
+
add({ _id = isomorphicObjectId().toString(), open = true, ...dialog }) {
|
|
11
|
+
if (!dialogsState.rendered) {
|
|
12
|
+
console.error("<Dialogs /> is not rendered. The dialog will be ignored.");
|
|
13
|
+
}
|
|
14
|
+
dialogsState.dialogs.push({
|
|
15
|
+
_id,
|
|
16
|
+
open,
|
|
17
|
+
props: ref(dialog),
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
remove(_id) {
|
|
21
|
+
dialogsState.dialogs.splice(dialogsState.dialogs.findIndex((n) => n._id === _id), 1);
|
|
22
|
+
},
|
|
23
|
+
update(dialog) {
|
|
24
|
+
const updateDialog = find(dialogsState.dialogs, { _id: dialog._id });
|
|
25
|
+
if (updateDialog) {
|
|
26
|
+
Object.assign(updateDialog, dialog);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
export function showDialog(dialog) {
|
|
31
|
+
dialogsState.add(dialog);
|
|
32
|
+
}
|
|
33
|
+
export function closeDialog(_id) {
|
|
34
|
+
dialogsState.update({
|
|
35
|
+
_id,
|
|
36
|
+
open: false,
|
|
37
|
+
});
|
|
38
|
+
setTimeout(() => dialogsState.remove(_id), 300);
|
|
39
|
+
}
|
|
40
|
+
export default dialogsState;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Dialog from "./Dialog";
|
|
2
|
+
export * from "./Dialogs";
|
|
3
|
+
export { default as Dialogs } from "./Dialogs";
|
|
4
|
+
export default Dialog;
|
|
5
|
+
// noinspection JSUnusedGlobalSymbols
|
|
6
|
+
export { default as dialogsState } from "./dialogs.state";
|
|
7
|
+
export * from "./dialogs.state";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { 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;
|
|
@@ -0,0 +1,72 @@
|
|
|
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="fixed inset-0 bg-black/70 bg-opacity-75 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
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { 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;
|