@povio/ui 0.0.8 → 0.0.9
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/dist/assets/icons/AlignCenter.js +21 -0
- package/dist/assets/icons/AlignLeft.js +21 -0
- package/dist/assets/icons/AlignLeftRight.js +21 -0
- package/dist/assets/icons/AlignRight.js +21 -0
- package/dist/assets/icons/ArrowDropDown.js +21 -0
- package/dist/assets/icons/ArrowDropUp.js +21 -0
- package/dist/assets/icons/ArrowLeft.js +21 -0
- package/dist/assets/icons/ArrowRight.js +21 -0
- package/dist/assets/icons/Bold.js +21 -0
- package/dist/assets/icons/BulletedList.js +21 -0
- package/dist/assets/icons/Calendar.js +23 -0
- package/dist/assets/icons/Check.js +23 -0
- package/dist/assets/icons/CheckCircle.js +21 -0
- package/dist/assets/icons/CheckboxCheckmark.js +24 -0
- package/dist/assets/icons/CheckboxIndeterminate.js +24 -0
- package/dist/assets/icons/ChevronDown.js +23 -0
- package/dist/assets/icons/ChevronLeft.js +23 -0
- package/dist/assets/icons/ChevronRight.js +23 -0
- package/dist/assets/icons/ChevronUp.js +23 -0
- package/dist/assets/icons/ChevronsLeft.js +23 -0
- package/dist/assets/icons/ChevronsRight.js +23 -0
- package/dist/assets/icons/Clock.js +21 -0
- package/dist/assets/icons/Close.js +21 -0
- package/dist/assets/icons/DateTime.js +32 -0
- package/dist/assets/icons/Drag.js +21 -0
- package/dist/assets/icons/File.js +23 -0
- package/dist/assets/icons/Highlight.js +21 -0
- package/dist/assets/icons/HighlightOn.js +30 -0
- package/dist/assets/icons/Info.js +32 -0
- package/dist/assets/icons/Italic.js +21 -0
- package/dist/assets/icons/Link.js +21 -0
- package/dist/assets/icons/Menu.js +21 -0
- package/dist/assets/icons/NumberedList.js +21 -0
- package/dist/assets/icons/PointerHorizontal.js +21 -0
- package/dist/assets/icons/PointerVertical.js +21 -0
- package/dist/assets/icons/Send.js +23 -0
- package/dist/assets/icons/Strikethrough.js +21 -0
- package/dist/assets/icons/TextColor.js +30 -0
- package/dist/assets/icons/Today.js +21 -0
- package/dist/assets/icons/Underlined.js +23 -0
- package/dist/assets/icons/Upload.js +30 -0
- package/dist/assets/icons/View.js +18 -0
- package/dist/assets/icons/ViewOff.js +18 -0
- package/dist/assets/icons/WarningFilled.js +23 -0
- package/dist/assets/locales/en/translation.json.js +14 -0
- package/dist/assets/locales/sl/translation.json.js +14 -0
- package/dist/components/Menu/Menu.js +14 -0
- package/{src → dist}/components/Menu/MenuDesktop.d.ts +1 -1
- package/dist/components/Menu/MenuDesktop.js +68 -0
- package/{src → dist}/components/Menu/MenuItem.d.ts +1 -1
- package/dist/components/Menu/MenuItem.js +33 -0
- package/{src → dist}/components/Menu/MenuMobile.d.ts +1 -1
- package/dist/components/Menu/MenuMobile.js +78 -0
- package/{src → dist}/components/Menu/MenuPopover.d.ts +1 -1
- package/dist/components/Menu/MenuPopover.js +38 -0
- package/{src → dist}/components/buttons/Button/Button.d.ts +1 -1
- package/dist/components/buttons/Button/Button.js +68 -0
- package/{src → dist}/components/buttons/Button/button.cva.d.ts +1 -1
- package/dist/components/buttons/Button/button.cva.js +672 -0
- package/{src → dist}/components/buttons/IconButton/IconButton.d.ts +1 -1
- package/dist/components/buttons/IconButton/IconButton.js +17 -0
- package/{src → dist}/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +18 -0
- package/{src → dist}/components/buttons/PillButton/PillButton.d.ts +2 -2
- package/dist/components/buttons/PillButton/PillButton.js +44 -0
- package/{src → dist}/components/buttons/PillButton/pillButton.cva.d.ts +1 -1
- package/dist/components/buttons/PillButton/pillButton.cva.js +86 -0
- package/{src → dist}/components/buttons/SplitButton/SplitButton.d.ts +2 -2
- package/dist/components/buttons/SplitButton/SplitButton.js +62 -0
- package/{src → dist}/components/buttons/TextButton/TextButton.d.ts +3 -3
- package/dist/components/buttons/TextButton/TextButton.js +18 -0
- package/{src → dist}/components/buttons/ToggleButton/ToggleButton.d.ts +3 -3
- package/dist/components/buttons/ToggleButton/ToggleButton.js +21 -0
- package/{src → dist}/components/buttons/shared/ButtonContent.d.ts +3 -3
- package/dist/components/buttons/shared/ButtonContent.js +53 -0
- package/dist/components/buttons/shared/buttonContent.cva.js +16 -0
- package/{src → dist}/components/inputs/Checkbox/Checkbox.d.ts +3 -3
- package/dist/components/inputs/Checkbox/Checkbox.js +81 -0
- package/{src → dist}/components/inputs/Checkbox/CheckboxCheckmark.d.ts +1 -1
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +49 -0
- package/{src → dist}/components/inputs/Checkbox/checkbox.cva.d.ts +1 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.js +47 -0
- package/{src → dist}/components/inputs/DateTime/DatePicker/DatePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +237 -0
- package/{src → dist}/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +674 -0
- package/{src → dist}/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +251 -0
- package/{src → dist}/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +224 -0
- package/dist/components/inputs/DateTime/shared/Calendar.js +85 -0
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +160 -0
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +67 -0
- package/{src → dist}/components/inputs/DateTime/shared/CalendarHeader.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +89 -0
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +203 -0
- package/dist/components/inputs/DateTime/shared/DateField.js +62 -0
- package/{src → dist}/components/inputs/DateTime/shared/DatePickerInput.d.ts +2 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +174 -0
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +55 -0
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +76 -0
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +41 -0
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +82 -0
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +131 -0
- package/dist/components/inputs/DateTime/shared/TimeField.js +26 -0
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +186 -0
- package/{src → dist}/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +114 -0
- package/dist/components/inputs/DateTime/shared/YearPicker.js +89 -0
- package/dist/components/inputs/File/FileUpload.js +254 -0
- package/dist/components/inputs/File/FileUploadContainer.js +17 -0
- package/dist/components/inputs/File/InputUpload.js +176 -0
- package/{src → dist}/components/inputs/File/fileUpload.types.d.ts +3 -3
- package/{src → dist}/components/inputs/File/inputUpload.types.d.ts +2 -2
- package/{src → dist}/components/inputs/File/shared/FileCard.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +67 -0
- package/{src → dist}/components/inputs/File/shared/FileCardList.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCardList.js +20 -0
- package/dist/components/inputs/File/shared/FileProgressBar.js +32 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContent.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContent.js +92 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentEmpty.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +92 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentError.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentError.js +167 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentFilled.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +176 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentLoading.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +128 -0
- package/{src → dist}/components/inputs/File/shared/InputUploadContent.d.ts +1 -1
- package/dist/components/inputs/File/shared/InputUploadContent.js +74 -0
- package/dist/components/inputs/File/shared/InputUploadFilled.js +45 -0
- package/dist/components/inputs/File/shared/fileUpload.cva.js +58 -0
- package/dist/components/inputs/File/shared/inputUploadButton.cva.js +49 -0
- package/{src → dist}/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +54 -0
- package/dist/components/inputs/FormField/FormFieldError.js +16 -0
- package/dist/components/inputs/FormField/FormFieldHeader.js +57 -0
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +20 -0
- package/{src → dist}/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +37 -0
- package/{src → dist}/components/inputs/Input/NumberInput/NumberInput.d.ts +4 -4
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +157 -0
- package/{src → dist}/components/inputs/Input/PasswordInput/PasswordInput.d.ts +2 -2
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +26 -0
- package/{src → dist}/components/inputs/Input/TextArea/TextArea.d.ts +3 -3
- package/dist/components/inputs/Input/TextArea/TextArea.js +146 -0
- package/{src → dist}/components/inputs/Input/TextInput/TextInput.d.ts +4 -4
- package/dist/components/inputs/Input/TextInput/TextInput.js +170 -0
- package/{src → dist}/components/inputs/Input/shared/InputContent.d.ts +3 -3
- package/dist/components/inputs/Input/shared/InputContent.js +114 -0
- package/{src → dist}/components/inputs/Inputs/Form.d.ts +2 -2
- package/dist/components/inputs/Inputs/Form.js +68 -0
- package/{src → dist}/components/inputs/Inputs/InputItem.d.ts +16 -16
- package/dist/components/inputs/Inputs/InputItem.js +63 -0
- package/dist/components/inputs/Inputs/Inputs.js +32 -0
- package/{src → dist}/components/inputs/RadioGroup/RadioGroup.d.ts +3 -3
- package/dist/components/inputs/RadioGroup/RadioGroup.js +113 -0
- package/{src → dist}/components/inputs/RadioGroup/radio.cva.d.ts +1 -1
- package/dist/components/inputs/RadioGroup/radio.cva.js +47 -0
- package/{src → dist}/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +3 -3
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +39 -0
- package/{src → dist}/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -3
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +25 -0
- package/{src → dist}/components/inputs/Selection/Select/Select.d.ts +3 -3
- package/dist/components/inputs/Selection/Select/Select.js +32 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectBase.d.ts +3 -3
- package/dist/components/inputs/Selection/shared/SelectBase.js +25 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +211 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectInput.d.ts +4 -4
- package/dist/components/inputs/Selection/shared/SelectInput.js +231 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectInputTags.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +22 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +108 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxItem.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +78 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxItemSelectAll.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +45 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxLoadingItem.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +47 -0
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +42 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +161 -0
- package/{src → dist}/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +244 -0
- package/{src → dist}/components/inputs/Selection/shared/select.types.d.ts +1 -1
- package/{src → dist}/components/inputs/Selection/shared/useSelectItems.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/useSelectItems.js +94 -0
- package/{src → dist}/components/inputs/Slider/Slider.d.ts +2 -2
- package/dist/components/inputs/Slider/Slider.js +137 -0
- package/{src → dist}/components/inputs/TextEditor/TextEditor.d.ts +2 -2
- package/dist/components/inputs/TextEditor/TextEditor.js +223 -0
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +34 -0
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +80 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/HyperlinkAction.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +92 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextAlignSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +56 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextColorSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +33 -0
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +31 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextHighlightSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +37 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextListActions.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +51 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextMarksActions.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +73 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextStyleSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +61 -0
- package/dist/components/inputs/TextEditor/textEditor.types.js +40 -0
- package/{src → dist}/components/inputs/Toggle/Toggle.d.ts +3 -3
- package/dist/components/inputs/Toggle/Toggle.js +65 -0
- package/{src → dist}/components/inputs/Toggle/toggle.cva.d.ts +1 -1
- package/dist/components/inputs/Toggle/toggle.cva.js +44 -0
- package/{src → dist}/components/inputs/shared/CheckContent.d.ts +1 -1
- package/dist/components/inputs/shared/CheckContent.js +22 -0
- package/dist/components/inputs/shared/InputClear.js +27 -0
- package/dist/components/inputs/shared/input.cva.js +168 -0
- package/{src → dist}/components/inputs/shared/label.cva.d.ts +1 -1
- package/dist/components/inputs/shared/label.cva.js +133 -0
- package/dist/components/outline.clsx.js +11 -0
- package/{src → dist}/components/overlays/ActionModal/ActionModal.d.ts +2 -2
- package/dist/components/overlays/ActionModal/ActionModal.js +80 -0
- package/dist/components/overlays/BottomSheet/BottomSheet.js +261 -0
- package/dist/components/overlays/Drawer/Drawer.js +84 -0
- package/{src → dist}/components/overlays/Modal/Modal.d.ts +1 -1
- package/dist/components/overlays/Modal/Modal.js +53 -0
- package/dist/components/overlays/Modal/modal.cva.js +53 -0
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +71 -0
- package/{src → dist}/components/overlays/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +70 -0
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +27 -0
- package/dist/components/overlays/Tooltip/tooltip.cva.js +60 -0
- package/dist/components/segment/Segment.js +119 -0
- package/dist/components/segment/SegmentItem.js +43 -0
- package/{src → dist}/components/segment/segment.types.d.ts +1 -1
- package/dist/components/shared/pagination/Pagination.js +75 -0
- package/{src → dist}/components/shared/pagination/PaginationList.d.ts +1 -1
- package/dist/components/shared/pagination/PaginationList.js +145 -0
- package/dist/components/shared/pagination/minWidth.cva.js +15 -0
- package/{src → dist}/components/status/Alert/Alert.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +41 -0
- package/dist/components/status/Alert/alert.cva.js +64 -0
- package/{src → dist}/components/status/Loader/Loader.d.ts +1 -1
- package/dist/components/status/Loader/Loader.js +37 -0
- package/dist/components/status/Loader/loader.cva.js +27 -0
- package/{src → dist}/components/status/Toast/Toast.d.ts +1 -1
- package/dist/components/status/Toast/Toast.js +64 -0
- package/{src → dist}/components/status/Toast/toast.cva.d.ts +1 -1
- package/dist/components/status/Toast/toast.cva.js +150 -0
- package/dist/components/status/Toast/useToast.js +83 -0
- package/dist/components/status/shared/status.cva.js +62 -0
- package/dist/components/table/CellText.js +18 -0
- package/dist/components/table/ColumnConfig.js +124 -0
- package/dist/components/table/HeaderText.js +15 -0
- package/dist/components/table/InfiniteTable.js +40 -0
- package/dist/components/table/PaginatedTable.js +33 -0
- package/dist/components/table/Table.js +370 -0
- package/dist/components/table/table.cva.js +63 -0
- package/{src → dist}/components/text/Link/Link.d.ts +1 -1
- package/dist/components/text/Link/Link.js +18 -0
- package/dist/components/text/Link/link.cva.js +18 -0
- package/{src → dist}/components/text/Tag/Tag.d.ts +1 -1
- package/dist/components/text/Tag/Tag.js +49 -0
- package/dist/components/text/Tag/tag.cva.js +59 -0
- package/{src → dist}/components/text/Typography/Typography.d.ts +1 -1
- package/dist/components/text/Typography/Typography.js +22 -0
- package/dist/components/text/Typography/typography.cva.js +100 -0
- package/{src → dist}/config/confirmation.context.d.ts +1 -1
- package/dist/config/confirmation.context.js +107 -0
- package/dist/config/i18n.js +15 -0
- package/dist/config/router.context.js +43 -0
- package/{src → dist}/config/uiConfig.context.d.ts +8 -8
- package/dist/config/uiConfig.context.js +67 -0
- package/{src → dist}/config/uiStyle.context.d.ts +14 -14
- package/dist/config/uiStyle.context.js +16 -0
- package/dist/helpers/dynamicColumns.js +359 -0
- package/{src → dist}/helpers/dynamicInputs.d.ts +2 -2
- package/dist/helpers/dynamicInputs.js +216 -0
- package/dist/hooks/useAutosave.js +83 -0
- package/dist/hooks/useBreakpoint.js +20 -0
- package/dist/hooks/useDebounceCallback.js +29 -0
- package/dist/hooks/useDeepCompare.js +25 -0
- package/dist/hooks/useFilters.js +120 -0
- package/dist/hooks/useForm.js +22 -0
- package/{src → dist}/hooks/useFormAutosave.d.ts +2 -2
- package/dist/hooks/useFormAutosave.js +67 -0
- package/dist/hooks/useIntersectionObserver.js +27 -0
- package/dist/hooks/useLocalStorage.js +63 -0
- package/dist/hooks/useLongPressRepeat.js +33 -0
- package/dist/hooks/usePagination.js +35 -0
- package/dist/hooks/useScrollableListBox.js +30 -0
- package/dist/hooks/useSorting.js +30 -0
- package/dist/hooks/useStateAndRef.js +17 -0
- package/dist/hooks/useTableColumnConfig.js +63 -0
- package/dist/hooks/useTableNav.js +409 -0
- package/dist/hooks/useTranslationMemo.js +14 -0
- package/dist/index.js +284 -0
- package/{src → dist}/types/react-query.d.ts +1 -1
- package/dist/utils/array.utils.js +12 -0
- package/dist/utils/compoundMapper.js +14 -0
- package/dist/utils/date-time.utils.js +77 -0
- package/dist/utils/date.utils.js +12 -0
- package/dist/utils/dom.utils.js +13 -0
- package/dist/utils/file.utils.js +63 -0
- package/dist/utils/isEqual.js +95 -0
- package/dist/utils/logger.js +19 -0
- package/dist/utils/object.utils.js +53 -0
- package/dist/utils/queries.utils.js +9 -0
- package/dist/utils/rest.utils.js +51 -0
- package/dist/utils/routing.utils.js +15 -0
- package/dist/utils/string.utils.js +12 -0
- package/{src → dist}/utils/vendor/acl/AclGuard.d.ts +1 -1
- package/dist/utils/vendor/acl/AclGuard.js +15 -0
- package/dist/utils/vendor/acl/Can.js +18 -0
- package/dist/utils/vendor/acl/ability.context.js +37 -0
- package/dist/utils/vendor/auth/AuthGuard.js +26 -0
- package/dist/utils/vendor/auth/auth.context.js +36 -0
- package/{src → dist}/utils/vendor/auth/withPrivateAuthGuard.d.ts +1 -1
- package/dist/utils/vendor/auth/withPrivateAuthGuard.js +17 -0
- package/dist/utils/vendor/error-handling.js +119 -0
- package/dist/utils/vendor/rest-interceptor.js +21 -0
- package/dist/utils/zod.utils.js +25 -0
- package/package.json +57 -5
- package/index.js +0 -62585
- package/povio-ui-0.0.8.tgz +0 -0
- package/vite.config.d.ts +0 -2
- /package/{src → dist}/assets/icons/AlignCenter.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignLeftRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowDropDown.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowDropUp.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/Bold.d.ts +0 -0
- /package/{src → dist}/assets/icons/BulletedList.d.ts +0 -0
- /package/{src → dist}/assets/icons/Calendar.d.ts +0 -0
- /package/{src → dist}/assets/icons/Check.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckCircle.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckboxCheckmark.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckboxIndeterminate.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronDown.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronUp.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronsLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronsRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/Clock.d.ts +0 -0
- /package/{src → dist}/assets/icons/Close.d.ts +0 -0
- /package/{src → dist}/assets/icons/DateTime.d.ts +0 -0
- /package/{src → dist}/assets/icons/Drag.d.ts +0 -0
- /package/{src → dist}/assets/icons/File.d.ts +0 -0
- /package/{src → dist}/assets/icons/Highlight.d.ts +0 -0
- /package/{src → dist}/assets/icons/HighlightOn.d.ts +0 -0
- /package/{src → dist}/assets/icons/Info.d.ts +0 -0
- /package/{src → dist}/assets/icons/Italic.d.ts +0 -0
- /package/{src → dist}/assets/icons/Link.d.ts +0 -0
- /package/{src → dist}/assets/icons/Menu.d.ts +0 -0
- /package/{src → dist}/assets/icons/NumberedList.d.ts +0 -0
- /package/{src → dist}/assets/icons/PointerHorizontal.d.ts +0 -0
- /package/{src → dist}/assets/icons/PointerVertical.d.ts +0 -0
- /package/{src → dist}/assets/icons/Send.d.ts +0 -0
- /package/{src → dist}/assets/icons/Strikethrough.d.ts +0 -0
- /package/{src → dist}/assets/icons/TextColor.d.ts +0 -0
- /package/{src → dist}/assets/icons/Today.d.ts +0 -0
- /package/{src → dist}/assets/icons/Underlined.d.ts +0 -0
- /package/{src → dist}/assets/icons/Upload.d.ts +0 -0
- /package/{src → dist}/assets/icons/View.d.ts +0 -0
- /package/{src → dist}/assets/icons/ViewOff.d.ts +0 -0
- /package/{src → dist}/assets/icons/WarningFilled.d.ts +0 -0
- /package/{src → dist}/components/Menu/Menu.d.ts +0 -0
- /package/{src → dist}/components/buttons/shared/buttonContent.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/Calendar.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarCell.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarGrid.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarSelectHeader.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateField.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateTimeDialog.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateTimeDialogFooter.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/MonthPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/RangeCalendar.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/TimeField.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/TimePickerForm.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/YearPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/FileUpload.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/FileUploadContainer.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/InputUpload.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/index.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/FileProgressBar.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/InputUploadFilled.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/fileUpload.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/inputUploadButton.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldError.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldHeader.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldHeaderClose.d.ts +0 -0
- /package/{src → dist}/components/inputs/Inputs/Inputs.d.ts +0 -0
- /package/{src → dist}/components/inputs/Selection/shared/SelectListBoxSelectionBar.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/ColorPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/TextEditorToolbar.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/textEditor.types.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/InputClear.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/form.types.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/input.cva.d.ts +0 -0
- /package/{src → dist}/components/outline.clsx.d.ts +0 -0
- /package/{src → dist}/components/overlays/BottomSheet/BottomSheet.d.ts +0 -0
- /package/{src → dist}/components/overlays/Drawer/Drawer.d.ts +0 -0
- /package/{src → dist}/components/overlays/Modal/modal.cva.d.ts +0 -0
- /package/{src → dist}/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +0 -0
- /package/{src → dist}/components/overlays/Tooltip/TooltipEllipsis.d.ts +0 -0
- /package/{src → dist}/components/overlays/Tooltip/tooltip.cva.d.ts +0 -0
- /package/{src → dist}/components/segment/Segment.d.ts +0 -0
- /package/{src → dist}/components/segment/SegmentItem.d.ts +0 -0
- /package/{src → dist}/components/shared/pagination/Pagination.d.ts +0 -0
- /package/{src → dist}/components/shared/pagination/minWidth.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Alert/alert.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Loader/loader.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Toast/useToast.d.ts +0 -0
- /package/{src → dist}/components/status/shared/status.cva.d.ts +0 -0
- /package/{src → dist}/components/table/CellText.d.ts +0 -0
- /package/{src → dist}/components/table/ColumnConfig.d.ts +0 -0
- /package/{src → dist}/components/table/HeaderText.d.ts +0 -0
- /package/{src → dist}/components/table/InfiniteTable.d.ts +0 -0
- /package/{src → dist}/components/table/PaginatedTable.d.ts +0 -0
- /package/{src → dist}/components/table/Table.d.ts +0 -0
- /package/{src → dist}/components/table/table.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Link/link.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Tag/tag.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Typography/typography.cva.d.ts +0 -0
- /package/{src → dist}/config/i18n.d.ts +0 -0
- /package/{src → dist}/config/router.context.d.ts +0 -0
- /package/{src → dist}/helpers/dynamicColumns.d.ts +0 -0
- /package/{src → dist}/hooks/useAutosave.d.ts +0 -0
- /package/{src → dist}/hooks/useBreakpoint.d.ts +0 -0
- /package/{src → dist}/hooks/useDebounceCallback.d.ts +0 -0
- /package/{src → dist}/hooks/useDeepCompare.d.ts +0 -0
- /package/{src → dist}/hooks/useFilters.d.ts +0 -0
- /package/{src → dist}/hooks/useForm.d.ts +0 -0
- /package/{src → dist}/hooks/useIntersectionObserver.d.ts +0 -0
- /package/{src → dist}/hooks/useLocalStorage.d.ts +0 -0
- /package/{src → dist}/hooks/useLongPressRepeat.d.ts +0 -0
- /package/{src → dist}/hooks/usePagination.d.ts +0 -0
- /package/{src → dist}/hooks/useScrollableListBox.d.ts +0 -0
- /package/{src → dist}/hooks/useSorting.d.ts +0 -0
- /package/{src → dist}/hooks/useStateAndRef.d.ts +0 -0
- /package/{src → dist}/hooks/useTableColumnConfig.d.ts +0 -0
- /package/{src → dist}/hooks/useTableNav.d.ts +0 -0
- /package/{src → dist}/hooks/useTranslationMemo.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{styles → dist/styles}/editor.css +0 -0
- /package/{styles → dist/styles}/index.css +0 -0
- /package/{src → dist}/types/common.d.ts +0 -0
- /package/{src → dist}/utils/array.utils.d.ts +0 -0
- /package/{src → dist}/utils/array.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/compoundMapper.d.ts +0 -0
- /package/{src → dist}/utils/compoundMapper.spec.d.ts +0 -0
- /package/{src → dist}/utils/date-time.utils.d.ts +0 -0
- /package/{src → dist}/utils/date-time.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/date.utils.d.ts +0 -0
- /package/{src → dist}/utils/date.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/dom.utils.d.ts +0 -0
- /package/{src → dist}/utils/file.utils.d.ts +0 -0
- /package/{src → dist}/utils/isEqual.d.ts +0 -0
- /package/{src → dist}/utils/logger.d.ts +0 -0
- /package/{src → dist}/utils/object.utils.d.ts +0 -0
- /package/{src → dist}/utils/queries.utils.d.ts +0 -0
- /package/{src → dist}/utils/rest.utils.d.ts +0 -0
- /package/{src → dist}/utils/routing.utils.d.ts +0 -0
- /package/{src → dist}/utils/string.utils.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/Can.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/ability.context.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/appAbility.types.d.ts +0 -0
- /package/{src → dist}/utils/vendor/auth/AuthGuard.d.ts +0 -0
- /package/{src → dist}/utils/vendor/auth/auth.context.d.ts +0 -0
- /package/{src → dist}/utils/vendor/error-handling.d.ts +0 -0
- /package/{src → dist}/utils/vendor/rest-client.types.d.ts +0 -0
- /package/{src → dist}/utils/vendor/rest-interceptor.d.ts +0 -0
- /package/{src → dist}/utils/zod.utils.d.ts +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useRef, useState, useCallback, useEffect } from "react";
|
|
2
|
+
function useDebounceCallback(callback, { delay = 500 } = {}) {
|
|
3
|
+
const timeoutRef = useRef(null);
|
|
4
|
+
const [isDebouncing, setIsDebouncing] = useState(false);
|
|
5
|
+
const debouncedCallback = useCallback(
|
|
6
|
+
(...args) => {
|
|
7
|
+
if (timeoutRef.current) {
|
|
8
|
+
clearTimeout(timeoutRef.current);
|
|
9
|
+
}
|
|
10
|
+
setIsDebouncing(true);
|
|
11
|
+
timeoutRef.current = setTimeout(() => {
|
|
12
|
+
setIsDebouncing(false);
|
|
13
|
+
callback?.(...args);
|
|
14
|
+
}, delay);
|
|
15
|
+
},
|
|
16
|
+
[callback, delay]
|
|
17
|
+
);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
return () => {
|
|
20
|
+
if (timeoutRef.current) {
|
|
21
|
+
clearTimeout(timeoutRef.current);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
return { callback: debouncedCallback, isDebouncing };
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
useDebounceCallback
|
|
29
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
2
|
+
import { isEqual } from "../utils/isEqual.js";
|
|
3
|
+
const useDeepCompareEffect = (callback, dependencies) => {
|
|
4
|
+
return useEffect(callback, useDeepCompareDeps(dependencies));
|
|
5
|
+
};
|
|
6
|
+
const useDeepCompareLayoutEffect = (callback, dependencies) => {
|
|
7
|
+
return useLayoutEffect(callback, useDeepCompareDeps(dependencies));
|
|
8
|
+
};
|
|
9
|
+
const useDeepCompareMemo = (factory, dependencies) => {
|
|
10
|
+
return useMemo(factory, useDeepCompareDeps(dependencies));
|
|
11
|
+
};
|
|
12
|
+
const useDeepCompareDeps = (value) => {
|
|
13
|
+
const ref = useRef(void 0);
|
|
14
|
+
const signalRef = useRef(0);
|
|
15
|
+
if (!isEqual(value, ref.current)) {
|
|
16
|
+
ref.current = value;
|
|
17
|
+
signalRef.current += 1;
|
|
18
|
+
}
|
|
19
|
+
return [signalRef.current];
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
useDeepCompareEffect,
|
|
23
|
+
useDeepCompareLayoutEffect,
|
|
24
|
+
useDeepCompareMemo
|
|
25
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import { UIRouter } from "../config/router.context.js";
|
|
3
|
+
const serializeFiltersToQuery = (filterData, prefix) => {
|
|
4
|
+
const query = {};
|
|
5
|
+
for (const [key, value] of Object.entries(filterData)) {
|
|
6
|
+
if (value === null || value === void 0) {
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
const filterKey = `filter[${prefix && `${prefix}-`}${key}]`;
|
|
10
|
+
if (Array.isArray(value) || typeof value === "object") {
|
|
11
|
+
query[filterKey] = JSON.stringify(value);
|
|
12
|
+
} else if (typeof value === "boolean") {
|
|
13
|
+
query[filterKey] = value ? "true" : "false";
|
|
14
|
+
} else {
|
|
15
|
+
query[filterKey] = value;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return query;
|
|
19
|
+
};
|
|
20
|
+
const parseFilterFromQuery = (query) => {
|
|
21
|
+
const filter = {};
|
|
22
|
+
for (const [key, value] of Object.entries(query)) {
|
|
23
|
+
const match = /^filter\[(.+?)\]$/.exec(key);
|
|
24
|
+
if (!match) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const filterKey = match[1];
|
|
28
|
+
const isArray = value.startsWith("[") && value.endsWith("]");
|
|
29
|
+
const isObject = value.startsWith("{") && value.endsWith("}");
|
|
30
|
+
const isNumber = !Number.isNaN(Number(value)) && value !== "";
|
|
31
|
+
const isBoolean = ["true", "false"].includes(value);
|
|
32
|
+
if (isArray || isObject || isNumber) {
|
|
33
|
+
filter[filterKey] = JSON.parse(value);
|
|
34
|
+
} else if (isBoolean) {
|
|
35
|
+
filter[filterKey] = value === "true";
|
|
36
|
+
} else {
|
|
37
|
+
filter[filterKey] = value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return filter;
|
|
41
|
+
};
|
|
42
|
+
const useFilters = (defaultFilterValues, prefix = "") => {
|
|
43
|
+
const { query, pathname, replace } = UIRouter.useUIRouter();
|
|
44
|
+
const queryFilters = parseFilterFromQuery(query);
|
|
45
|
+
const [filterData, setFilterData] = useState(queryFilters);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const setUrlToDefaultFilters = () => {
|
|
48
|
+
const flatFilterQuery = serializeFiltersToQuery(defaultFilterValues, prefix);
|
|
49
|
+
replace({
|
|
50
|
+
pathname,
|
|
51
|
+
query: {
|
|
52
|
+
...query,
|
|
53
|
+
...flatFilterQuery
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const currentFilters = parseFilterFromQuery(query);
|
|
58
|
+
const hasFiltersSet = Object.keys(currentFilters).length > 0;
|
|
59
|
+
if (defaultFilterValues && !hasFiltersSet) {
|
|
60
|
+
setUrlToDefaultFilters();
|
|
61
|
+
}
|
|
62
|
+
}, [defaultFilterValues, prefix]);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const newQueryFilters = parseFilterFromQuery(query);
|
|
65
|
+
setFilterData(newQueryFilters);
|
|
66
|
+
}, [query]);
|
|
67
|
+
const setFilterValue = (data) => {
|
|
68
|
+
let newFilters = { ...filterData };
|
|
69
|
+
const isReset = Object.keys(data).length === 0;
|
|
70
|
+
const isResetToDefault = data === defaultFilterValues;
|
|
71
|
+
if (isResetToDefault) {
|
|
72
|
+
newFilters = {
|
|
73
|
+
...defaultFilterValues
|
|
74
|
+
};
|
|
75
|
+
} else if (isReset) {
|
|
76
|
+
newFilters = {};
|
|
77
|
+
} else {
|
|
78
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
79
|
+
if (value === void 0) {
|
|
80
|
+
delete newFilters[key];
|
|
81
|
+
} else {
|
|
82
|
+
newFilters[key] = value;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const prefixPart = prefix ? `${prefix}-` : "";
|
|
87
|
+
const cleanedQuery = Object.keys(query).reduce(
|
|
88
|
+
(acc, k) => {
|
|
89
|
+
if (!k.startsWith(`filter[${prefixPart}`)) {
|
|
90
|
+
acc[k] = query[k];
|
|
91
|
+
}
|
|
92
|
+
return acc;
|
|
93
|
+
},
|
|
94
|
+
{}
|
|
95
|
+
);
|
|
96
|
+
const flatFilterQuery = serializeFiltersToQuery(newFilters, prefix);
|
|
97
|
+
replace({
|
|
98
|
+
pathname,
|
|
99
|
+
query: {
|
|
100
|
+
...cleanedQuery,
|
|
101
|
+
...flatFilterQuery
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
setFilterData(newFilters);
|
|
105
|
+
};
|
|
106
|
+
const getFilterValue = (keys) => {
|
|
107
|
+
const result = {};
|
|
108
|
+
keys.forEach((key) => {
|
|
109
|
+
result[key] = filterData[key];
|
|
110
|
+
});
|
|
111
|
+
return result;
|
|
112
|
+
};
|
|
113
|
+
const clearAllFilters = () => {
|
|
114
|
+
setFilterValue(defaultFilterValues ?? {});
|
|
115
|
+
};
|
|
116
|
+
return { filterData, setFilterValue, getFilterValue, clearAllFilters };
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
useFilters
|
|
120
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useForm as useForm$1 } from "react-hook-form";
|
|
4
|
+
function useForm({
|
|
5
|
+
resolver,
|
|
6
|
+
zodSchema,
|
|
7
|
+
defaultValues,
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
const formResolver = useMemo(
|
|
11
|
+
() => resolver ?? (zodSchema ? zodResolver(zodSchema) : void 0),
|
|
12
|
+
[resolver, zodSchema]
|
|
13
|
+
);
|
|
14
|
+
return useForm$1({
|
|
15
|
+
...props,
|
|
16
|
+
resolver: formResolver,
|
|
17
|
+
defaultValues
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
useForm
|
|
22
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DependencyList } from 'react';
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
|
-
import { UseAutosaveProps } from '
|
|
4
|
-
import { UseFormProps, UseFormResolverProps } from '
|
|
3
|
+
import { UseAutosaveProps } from './useAutosave';
|
|
4
|
+
import { UseFormProps, UseFormResolverProps } from './useForm';
|
|
5
5
|
export type UseFormAutosaveProps<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues, TResponse = unknown> = Omit<UseFormProps<TFieldValues, TContext, TTransformedValues>, "defaultValues"> & UseFormResolverProps<TFieldValues, TTransformedValues> & {
|
|
6
6
|
autosaveDelay?: UseAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>["delay"];
|
|
7
7
|
enableAutosave?: UseAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>["enabled"];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
import { useAutosave } from "./useAutosave.js";
|
|
3
|
+
import { useForm } from "./useForm.js";
|
|
4
|
+
import { ObjectUtils } from "../utils/object.utils.js";
|
|
5
|
+
const getResetTimeoutErrorMessage = (resetTimeout) => `Form Reset Timeout (${resetTimeout}ms) - Action Required
|
|
6
|
+
Problem: Form values weren't reset after submission.
|
|
7
|
+
|
|
8
|
+
Likely causes:
|
|
9
|
+
• Missing variables in reset dependency array
|
|
10
|
+
• Reset dependencies not updating after form save
|
|
11
|
+
• Async operations blocking timely reset
|
|
12
|
+
|
|
13
|
+
Solutions:
|
|
14
|
+
1. Ensure reset dependencies include all relevant state variables
|
|
15
|
+
2. Confirm your submission handler updates state properly (check query invalidation)
|
|
16
|
+
3. For slower operations, consider increasing the timeout threshold`;
|
|
17
|
+
function useFormAutosave({
|
|
18
|
+
autosaveDelay,
|
|
19
|
+
enableAutosave,
|
|
20
|
+
onAutosave,
|
|
21
|
+
getResetValues,
|
|
22
|
+
resetDeps,
|
|
23
|
+
resetTimeout = 5e3,
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
const form = useForm({ ...props, defaultValues: getResetValues() });
|
|
27
|
+
const shouldResetFormValuesRef = useRef(false);
|
|
28
|
+
const resetFormValuesTimeoutRef = useRef(void 0);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const resetValues = getResetValues();
|
|
31
|
+
if (resetValues === void 0) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const resetFormValues = async () => {
|
|
35
|
+
const keepStateOptions = shouldResetFormValuesRef.current ? { keepDirtyValues: true } : void 0;
|
|
36
|
+
shouldResetFormValuesRef.current = false;
|
|
37
|
+
let values = resetValues;
|
|
38
|
+
if (ObjectUtils.isFunction(resetValues)) {
|
|
39
|
+
values = await resetValues();
|
|
40
|
+
}
|
|
41
|
+
form.reset(values, keepStateOptions);
|
|
42
|
+
};
|
|
43
|
+
resetFormValues();
|
|
44
|
+
}, [...resetDeps]);
|
|
45
|
+
const onSaveSuccess = () => {
|
|
46
|
+
shouldResetFormValuesRef.current = true;
|
|
47
|
+
if (resetFormValuesTimeoutRef.current) {
|
|
48
|
+
clearTimeout(resetFormValuesTimeoutRef.current);
|
|
49
|
+
}
|
|
50
|
+
resetFormValuesTimeoutRef.current = setTimeout(() => {
|
|
51
|
+
if (shouldResetFormValuesRef.current) {
|
|
52
|
+
throw new Error(getResetTimeoutErrorMessage(resetTimeout));
|
|
53
|
+
}
|
|
54
|
+
}, resetTimeout);
|
|
55
|
+
};
|
|
56
|
+
useAutosave({
|
|
57
|
+
form,
|
|
58
|
+
delay: autosaveDelay,
|
|
59
|
+
enabled: enableAutosave,
|
|
60
|
+
onSave: onAutosave,
|
|
61
|
+
onSaveSuccess
|
|
62
|
+
});
|
|
63
|
+
return form;
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
useFormAutosave
|
|
67
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
const useIntersectionObserver = ({
|
|
3
|
+
onIntersection,
|
|
4
|
+
root,
|
|
5
|
+
rootMargin,
|
|
6
|
+
threshold
|
|
7
|
+
}) => {
|
|
8
|
+
const [ref, setRef] = useState(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const observer = new IntersectionObserver(
|
|
11
|
+
(entries) => {
|
|
12
|
+
if (entries.some((entry) => entry.isIntersecting)) {
|
|
13
|
+
onIntersection?.();
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{ root, rootMargin, threshold }
|
|
17
|
+
);
|
|
18
|
+
if (ref) {
|
|
19
|
+
observer.observe(ref);
|
|
20
|
+
}
|
|
21
|
+
return () => observer.disconnect();
|
|
22
|
+
}, [ref, root, rootMargin, threshold, onIntersection]);
|
|
23
|
+
return { setRef };
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
useIntersectionObserver
|
|
27
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback } from "react";
|
|
2
|
+
const useLocalStorage = ({ key, schema }) => {
|
|
3
|
+
const [value, setValue] = useState(null);
|
|
4
|
+
const [isInitialLoading, setIsInitialLoading] = useState(true);
|
|
5
|
+
const [error, setError] = useState(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!localStorage) {
|
|
8
|
+
setValue(null);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const lsValue = localStorage.getItem(key);
|
|
13
|
+
if (!lsValue) {
|
|
14
|
+
setValue(null);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let jsonOrString;
|
|
18
|
+
try {
|
|
19
|
+
jsonOrString = JSON.parse(lsValue);
|
|
20
|
+
} catch {
|
|
21
|
+
jsonOrString = lsValue;
|
|
22
|
+
}
|
|
23
|
+
const parsedValue = schema.safeParse(jsonOrString);
|
|
24
|
+
if (parsedValue.success) {
|
|
25
|
+
setValue(parsedValue.data);
|
|
26
|
+
} else {
|
|
27
|
+
setError(parsedValue.error);
|
|
28
|
+
setValue(null);
|
|
29
|
+
}
|
|
30
|
+
} finally {
|
|
31
|
+
setIsInitialLoading(false);
|
|
32
|
+
}
|
|
33
|
+
}, [key, schema]);
|
|
34
|
+
const set = useCallback(
|
|
35
|
+
(newValue) => {
|
|
36
|
+
if (!localStorage) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const parsedValue = schema.safeParse(newValue);
|
|
40
|
+
if (!parsedValue.success) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (typeof parsedValue.data === "string") {
|
|
44
|
+
localStorage.setItem(key, parsedValue.data);
|
|
45
|
+
} else {
|
|
46
|
+
localStorage.setItem(key, JSON.stringify(parsedValue.data));
|
|
47
|
+
}
|
|
48
|
+
setValue(parsedValue.data);
|
|
49
|
+
},
|
|
50
|
+
[key, schema]
|
|
51
|
+
);
|
|
52
|
+
const remove = useCallback(() => {
|
|
53
|
+
if (!localStorage) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
localStorage.removeItem(key);
|
|
57
|
+
setValue(null);
|
|
58
|
+
}, [key]);
|
|
59
|
+
return { value, set, remove, error, isInitialLoading };
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
useLocalStorage
|
|
63
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
const useLongPressRepeat = ({
|
|
3
|
+
onPress,
|
|
4
|
+
enabled = true,
|
|
5
|
+
interval = 85,
|
|
6
|
+
timeout = 500
|
|
7
|
+
}) => {
|
|
8
|
+
const intervalRef = useRef(void 0);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
return () => {
|
|
11
|
+
clearInterval(intervalRef.current);
|
|
12
|
+
};
|
|
13
|
+
}, []);
|
|
14
|
+
const onPressStart = () => {
|
|
15
|
+
onPress(false);
|
|
16
|
+
if (!enabled) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
intervalRef.current = setTimeout(() => {
|
|
20
|
+
onPress(true);
|
|
21
|
+
intervalRef.current = setInterval(() => {
|
|
22
|
+
onPress(true);
|
|
23
|
+
}, interval);
|
|
24
|
+
}, timeout);
|
|
25
|
+
};
|
|
26
|
+
const onPressEnd = () => {
|
|
27
|
+
clearInterval(intervalRef.current);
|
|
28
|
+
};
|
|
29
|
+
return { onPressStart, onPressEnd };
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
useLongPressRepeat
|
|
33
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import { UIRouter } from "../config/router.context.js";
|
|
3
|
+
const DEFAULT_STATE = {
|
|
4
|
+
pageIndex: 1,
|
|
5
|
+
pageSize: 20
|
|
6
|
+
};
|
|
7
|
+
function usePagination(defaultPagination) {
|
|
8
|
+
const { pathname, query, replace, searchParams } = UIRouter.useUIRouter();
|
|
9
|
+
const [pagination, setPagination] = useState(
|
|
10
|
+
defaultPagination ?? {
|
|
11
|
+
pageIndex: searchParams.has("page") ? Number.parseInt(searchParams.get("page") ?? "", 10) : DEFAULT_STATE.pageIndex,
|
|
12
|
+
pageSize: searchParams.has("size") ? Number.parseInt(searchParams.get("size") ?? "", 10) : DEFAULT_STATE.pageSize
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const { page: _page, size: _size, ...queryParms } = query;
|
|
17
|
+
replace({
|
|
18
|
+
pathname,
|
|
19
|
+
query: {
|
|
20
|
+
...queryParms,
|
|
21
|
+
...pagination.pageSize !== DEFAULT_STATE.pageSize ? { size: pagination.pageSize } : {},
|
|
22
|
+
...pagination.pageIndex !== DEFAULT_STATE.pageIndex ? { page: pagination.pageIndex } : {}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}, [pagination]);
|
|
26
|
+
return {
|
|
27
|
+
pagination,
|
|
28
|
+
setPagination,
|
|
29
|
+
pageIndex: pagination.pageIndex,
|
|
30
|
+
pageSize: pagination.pageSize
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
usePagination
|
|
35
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
import { useBreakpoint } from "./useBreakpoint.js";
|
|
3
|
+
function useScrollableListBox() {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
const isDesktop = useBreakpoint("md");
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const node = ref.current;
|
|
8
|
+
if (!node || isDesktop) {
|
|
9
|
+
return void 0;
|
|
10
|
+
}
|
|
11
|
+
const onPointerDownCapture = (e) => {
|
|
12
|
+
e.stopPropagation();
|
|
13
|
+
};
|
|
14
|
+
const onClickCapture = (e) => {
|
|
15
|
+
if (e.currentTarget?.contains(e.target) && e.target !== e.currentTarget) {
|
|
16
|
+
e.target.click();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
node.addEventListener("pointerdown", onPointerDownCapture);
|
|
20
|
+
node.addEventListener("click", onClickCapture);
|
|
21
|
+
return () => {
|
|
22
|
+
node.removeEventListener("pointerdown", onPointerDownCapture);
|
|
23
|
+
node.removeEventListener("click", onClickCapture);
|
|
24
|
+
};
|
|
25
|
+
}, [ref, isDesktop]);
|
|
26
|
+
return { ref };
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
useScrollableListBox
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useState, useMemo, useEffect } from "react";
|
|
2
|
+
import { UIRouter } from "../config/router.context.js";
|
|
3
|
+
function useSorting(defaultSorting, prefix = "") {
|
|
4
|
+
const { pathname, replace, searchParams, query } = UIRouter.useUIRouter();
|
|
5
|
+
const [sorting, setSorting] = useState(
|
|
6
|
+
defaultSorting ?? searchParams.get(`order${prefix && `-${prefix}`}`)?.split(",").map((item) => {
|
|
7
|
+
if (item.startsWith("-")) {
|
|
8
|
+
return { id: item.slice(1), desc: true };
|
|
9
|
+
}
|
|
10
|
+
if (item.startsWith("+")) {
|
|
11
|
+
return { id: item.slice(1), desc: false };
|
|
12
|
+
}
|
|
13
|
+
return { id: item, desc: false };
|
|
14
|
+
}) ?? []
|
|
15
|
+
);
|
|
16
|
+
const order = useMemo(() => {
|
|
17
|
+
return sorting.map((field) => `${field.desc ? "-" : "+"}${field.id}`).join(",");
|
|
18
|
+
}, [sorting]);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const { sort: _sort, ...queryParms } = query;
|
|
21
|
+
replace({
|
|
22
|
+
pathname,
|
|
23
|
+
query: { ...queryParms, ...order ? { [`order${prefix && `-${prefix}`}`]: order } : {} }
|
|
24
|
+
});
|
|
25
|
+
}, [order]);
|
|
26
|
+
return { sorting, setSorting, order };
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
useSorting
|
|
30
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useState, useRef, useCallback } from "react";
|
|
2
|
+
import { ObjectUtils } from "../utils/object.utils.js";
|
|
3
|
+
const useStateAndRef = (initialState) => {
|
|
4
|
+
const [state, setState] = useState(initialState);
|
|
5
|
+
const ref = useRef(state);
|
|
6
|
+
const updateValue = useCallback(
|
|
7
|
+
(value) => {
|
|
8
|
+
ref.current = ObjectUtils.isFunction(value) ? value(ref.current) : value;
|
|
9
|
+
setState(ref.current);
|
|
10
|
+
},
|
|
11
|
+
[setState]
|
|
12
|
+
);
|
|
13
|
+
return [state, ref, updateValue];
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
useStateAndRef
|
|
17
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback, useMemo } from "react";
|
|
2
|
+
function sortByKeyOrder(data, orderedKeys = []) {
|
|
3
|
+
return [...data].sort((a, b) => {
|
|
4
|
+
return orderedKeys.findIndex((key) => key === (a.id ?? a.accessorKey)) - orderedKeys.findIndex((key) => key === (b.id ?? b.accessorKey));
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
function useTableColumnConfig(defaultColumns, options = {}) {
|
|
8
|
+
const [internalVisibleColumns, setInternalVisibleColumns] = useState(
|
|
9
|
+
() => defaultColumns.reduce((acc, col) => {
|
|
10
|
+
const key = col.id ?? col.accessorKey;
|
|
11
|
+
acc[key] = true;
|
|
12
|
+
return acc;
|
|
13
|
+
}, {})
|
|
14
|
+
);
|
|
15
|
+
const [internalColumnOrder, setInternalColumnOrder] = useState(
|
|
16
|
+
() => defaultColumns.map((col) => col.id ?? col.accessorKey)
|
|
17
|
+
);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (options.visibleColumns) {
|
|
20
|
+
setInternalVisibleColumns(options.visibleColumns);
|
|
21
|
+
}
|
|
22
|
+
}, [options.visibleColumns]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (options.columnOrder) {
|
|
25
|
+
setInternalColumnOrder(options.columnOrder);
|
|
26
|
+
}
|
|
27
|
+
}, [options.columnOrder]);
|
|
28
|
+
const handleVisibilityChange = useCallback(
|
|
29
|
+
(value) => {
|
|
30
|
+
setInternalVisibleColumns(value);
|
|
31
|
+
options?.onVisibilityChange?.(value);
|
|
32
|
+
},
|
|
33
|
+
[options]
|
|
34
|
+
);
|
|
35
|
+
const handleOrderChange = useCallback(
|
|
36
|
+
(value) => {
|
|
37
|
+
setInternalColumnOrder(value);
|
|
38
|
+
options?.onOrderChange?.(value);
|
|
39
|
+
},
|
|
40
|
+
[options]
|
|
41
|
+
);
|
|
42
|
+
const configColumns = useMemo(
|
|
43
|
+
() => sortByKeyOrder(defaultColumns, internalColumnOrder),
|
|
44
|
+
[defaultColumns, internalColumnOrder]
|
|
45
|
+
);
|
|
46
|
+
const columns = useMemo(
|
|
47
|
+
() => configColumns.filter(
|
|
48
|
+
(col) => internalVisibleColumns?.[col.id ?? col.accessorKey] ?? true
|
|
49
|
+
),
|
|
50
|
+
[configColumns, internalVisibleColumns]
|
|
51
|
+
);
|
|
52
|
+
return {
|
|
53
|
+
configColumns,
|
|
54
|
+
columns,
|
|
55
|
+
visibleColumns: internalVisibleColumns,
|
|
56
|
+
columnOrder: internalColumnOrder,
|
|
57
|
+
onVisibilityChange: handleVisibilityChange,
|
|
58
|
+
onOrderChange: handleOrderChange
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
useTableColumnConfig
|
|
63
|
+
};
|