@povio/ui 2.1.14 → 2.1.15
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/README.md +74 -0
- package/dist/AclGuard.js +12 -0
- package/dist/ActionModal.js +51 -0
- package/dist/Alert.js +46 -0
- package/dist/AlignCenter.js +13 -0
- package/dist/AlignLeft.js +13 -0
- package/dist/AlignLeftRight.js +13 -0
- package/dist/AlignRight.js +13 -0
- package/dist/ArrowDropDown.js +13 -0
- package/dist/ArrowDropUp.js +13 -0
- package/dist/ArrowLeft.js +13 -0
- package/dist/ArrowRight.js +13 -0
- package/dist/AuthGuard.js +22 -0
- package/dist/Autocomplete.js +28 -0
- package/dist/Bold.js +13 -0
- package/dist/BottomSheet.js +191 -0
- package/dist/BulletedList.js +13 -0
- package/dist/Button.js +54 -0
- package/dist/ButtonContent.js +28 -0
- package/dist/Calendar.js +15 -0
- package/dist/Calendar2.js +54 -0
- package/dist/CalendarCell.js +130 -0
- package/dist/CalendarGrid.js +50 -0
- package/dist/CalendarHeader.js +75 -0
- package/dist/CalendarSelectHeader.js +170 -0
- package/dist/Can.js +13 -0
- package/dist/CellText.js +13 -0
- package/dist/Check.js +15 -0
- package/dist/CheckCircle.js +13 -0
- package/dist/CheckContent.js +16 -0
- package/dist/Checkbox.js +61 -0
- package/dist/CheckboxCheckmark.js +16 -0
- package/dist/CheckboxCheckmark2.js +25 -0
- package/dist/CheckboxIndeterminate.js +16 -0
- package/dist/ChevronDown.js +15 -0
- package/dist/ChevronLeft.js +15 -0
- package/dist/ChevronRight.js +15 -0
- package/dist/ChevronUp.js +15 -0
- package/dist/ChevronsLeft.js +15 -0
- package/dist/ChevronsRight.js +15 -0
- package/dist/Clock.js +13 -0
- package/dist/Close.js +13 -0
- package/dist/ColorPicker.js +16 -0
- package/dist/ColorPickerDropdown.js +51 -0
- package/dist/ColumnConfig.js +81 -0
- package/dist/DateField.js +89 -0
- package/dist/DatePicker.js +191 -0
- package/dist/DatePickerInput.js +158 -0
- package/dist/DateRangePicker.js +601 -0
- package/dist/DateSegmentItem.js +29 -0
- package/dist/DateTime.js +18 -0
- package/dist/DateTimeDialog.js +49 -0
- package/dist/DateTimeDialogFooter.js +25 -0
- package/dist/DateTimePicker.js +200 -0
- package/dist/Drag.js +13 -0
- package/dist/Drawer.js +43 -0
- package/dist/File.js +15 -0
- package/dist/FileCard.js +50 -0
- package/dist/FileCardList.js +17 -0
- package/dist/FileUpload.js +189 -0
- package/dist/FileUploadContainer.js +12 -0
- package/dist/FileUploadContent.js +61 -0
- package/dist/FileUploadContentEmpty.js +54 -0
- package/dist/FileUploadContentError.js +109 -0
- package/dist/FileUploadContentFilled.js +112 -0
- package/dist/FileUploadContentLoading.js +76 -0
- package/dist/Form.js +42 -0
- package/dist/FormField.js +35 -0
- package/dist/FormFieldError.js +11 -0
- package/dist/FormFieldHeader.js +36 -0
- package/dist/FormFieldHeaderClose.js +15 -0
- package/dist/FormFieldLabel.js +32 -0
- package/dist/HeaderText.js +10 -0
- package/dist/Highlight.js +13 -0
- package/dist/HighlightOn.js +19 -0
- package/dist/HyperlinkAction.js +70 -0
- package/dist/IconButton.js +12 -0
- package/dist/InfiniteTable.js +31 -0
- package/dist/Info.js +18 -0
- package/dist/InlineIconButton.js +13 -0
- package/dist/InputClear.js +19 -0
- package/dist/InputContent.js +94 -0
- package/dist/InputItem.js +54 -0
- package/dist/InputUpload.js +111 -0
- package/dist/InputUploadContent.js +52 -0
- package/dist/InputUploadFilled.js +26 -0
- package/dist/Inputs.js +15 -0
- package/dist/Italic.js +13 -0
- package/dist/Link.js +13 -0
- package/dist/Link2.js +19 -0
- package/dist/Loader.js +32 -0
- package/dist/Menu.js +13 -0
- package/dist/Menu2.js +9 -0
- package/dist/MenuDesktop.js +53 -0
- package/dist/MenuItem.js +21 -0
- package/dist/MenuMobile.js +64 -0
- package/dist/MenuPopover.js +30 -0
- package/dist/Modal.js +49 -0
- package/dist/MonthPicker.js +56 -0
- package/dist/NumberInput.js +132 -0
- package/dist/NumberedList.js +13 -0
- package/dist/PaginatedTable.js +26 -0
- package/dist/Pagination.js +43 -0
- package/dist/PaginationList.js +105 -0
- package/dist/PasswordInput.js +21 -0
- package/dist/PillButton.js +37 -0
- package/dist/PointerHorizontal.js +13 -0
- package/dist/PointerVertical.js +13 -0
- package/dist/ProgressBar.js +25 -0
- package/dist/QueryAutocomplete.js +18 -0
- package/dist/RadioGroup.js +81 -0
- package/dist/RangeCalendar.js +96 -0
- package/dist/ResponsivePopover.js +41 -0
- package/dist/Segment.js +82 -0
- package/dist/SegmentItem.js +23 -0
- package/dist/Select.js +24 -0
- package/dist/SelectBase.js +28 -0
- package/dist/SelectDesktop.js +147 -0
- package/dist/SelectInput.js +159 -0
- package/dist/SelectInputTags.js +29 -0
- package/dist/SelectListBox.js +73 -0
- package/dist/SelectListBoxItem.js +48 -0
- package/dist/SelectListBoxItemSelectAll.js +31 -0
- package/dist/SelectListBoxLoadingItem.js +41 -0
- package/dist/SelectListBoxSelectionBar.js +25 -0
- package/dist/SelectMobile.js +111 -0
- package/dist/Send.js +15 -0
- package/dist/Slider.js +93 -0
- package/dist/SplitButton.js +36 -0
- package/dist/Strikethrough.js +13 -0
- package/dist/Table.js +248 -0
- package/dist/Tag.js +42 -0
- package/dist/TextAlignSelect.js +44 -0
- package/dist/TextArea.js +120 -0
- package/dist/TextButton.js +13 -0
- package/dist/TextColor.js +16 -0
- package/dist/TextColorSelect.js +22 -0
- package/dist/TextEditor.js +143 -0
- package/dist/TextEditorToolbar.js +30 -0
- package/dist/TextHighlightSelect.js +24 -0
- package/dist/TextInput.js +125 -0
- package/dist/TextListActions.js +42 -0
- package/dist/TextMarksActions.js +67 -0
- package/dist/TextStyleSelect.js +52 -0
- package/dist/TimeField.js +17 -0
- package/dist/TimePicker.js +158 -0
- package/dist/TimePickerForm.js +158 -0
- package/dist/TimePickerInput.js +92 -0
- package/dist/Toast.js +58 -0
- package/dist/Today.js +13 -0
- package/dist/Toggle.js +60 -0
- package/dist/ToggleButton.js +13 -0
- package/dist/Tooltip.js +49 -0
- package/dist/TooltipEllipsis.js +18 -0
- package/dist/TooltipWrapper.js +19 -0
- package/dist/Typography.js +14 -0
- package/dist/Underlined.js +15 -0
- package/dist/Upload.js +16 -0
- package/dist/View.js +13 -0
- package/dist/ViewOff.js +13 -0
- package/dist/WarningFilled.js +15 -0
- package/dist/YearPicker.js +64 -0
- package/dist/ability.context.js +35 -0
- package/dist/alert.cva.js +62 -0
- package/dist/array.utils.js +8 -0
- package/dist/auth.context.js +37 -0
- package/dist/auth.js +6 -12
- package/dist/button.cva.js +656 -0
- package/dist/buttonContent.cva.js +10 -0
- package/dist/checkbox.cva.js +47 -0
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.d.ts +2 -2
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +5 -0
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +3 -1
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +3 -1
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +3 -1
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +8 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
- package/dist/components/inputs/File/fileUpload.types.d.ts +1 -0
- package/dist/components/inputs/FormField/FormField.d.ts +4 -1
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +4 -2
- package/dist/components/inputs/Input/TextArea/TextArea.d.ts +1 -0
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +2 -1
- package/dist/components/inputs/Input/shared/InputContent.d.ts +4 -3
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +3 -0
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
- package/dist/components/inputs/Toggle/Toggle.d.ts +2 -0
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/compoundMapper.js +11 -0
- package/dist/config/uiStyle.context.d.ts +2 -1
- package/dist/confirmation.context.js +78 -0
- package/dist/date-time.utils.js +50 -0
- package/dist/date.utils.js +17 -0
- package/dist/dom.utils.js +17 -0
- package/dist/dynamicColumns.js +272 -0
- package/dist/dynamicInputs.js +186 -0
- package/dist/error-handling.js +87 -0
- package/dist/file.utils.js +43 -0
- package/dist/fileUpload.cva.js +49 -0
- package/dist/i18n.js +8 -0
- package/dist/index.js +136 -278
- package/dist/input.cva.js +210 -0
- package/dist/inputUploadButton.cva.js +27 -0
- package/dist/isEqual.js +57 -0
- package/dist/label.cva.js +104 -0
- package/dist/link.context.js +17 -0
- package/dist/link.cva.js +7 -0
- package/dist/loader.cva.js +16 -0
- package/dist/logger.js +17 -0
- package/dist/menu.cva.js +27 -0
- package/dist/minWidth.cva.js +9 -0
- package/dist/modal.cva.js +31 -0
- package/dist/object.utils.js +36 -0
- package/dist/outline.clsx.js +4 -0
- package/dist/pillButton.cva.js +254 -0
- package/dist/queries.utils.js +7 -0
- package/dist/radio.cva.js +42 -0
- package/dist/react.js +6 -0
- package/dist/rest-interceptor.js +22 -0
- package/dist/rest.utils.js +31 -0
- package/dist/rolldown_runtime.js +16 -0
- package/dist/router.context.js +37 -0
- package/dist/routing.utils.js +9 -0
- package/dist/segment.cva.js +25 -0
- package/dist/select.context.js +190 -0
- package/dist/status.cva.js +57 -0
- package/dist/string.utils.js +10 -0
- package/dist/table.cva.js +35 -0
- package/dist/tag.cva.js +50 -0
- package/dist/text-editor.js +2 -4
- package/dist/textEditor.types.js +38 -0
- package/dist/theme.context.js +65 -0
- package/dist/toast.cva.js +158 -0
- package/dist/toggle.cva.js +27 -0
- package/dist/tooltip.cva.js +30 -0
- package/dist/translation.js +147 -0
- package/dist/translation2.js +145 -0
- package/dist/typography.cva.js +124 -0
- package/dist/uiConfig.context.js +58 -0
- package/dist/uiStyle.context.js +16 -0
- package/dist/useAutosave.js +62 -0
- package/dist/useBreakpoint.js +28 -0
- package/dist/useDebounceCallback.js +23 -0
- package/dist/useDeepCompare.js +21 -0
- package/dist/useFilters.js +121 -0
- package/dist/useForm.js +12 -0
- package/dist/useFormAutosave.js +52 -0
- package/dist/useIntersectionObserver.js +23 -0
- package/dist/useLocalStorage.js +35 -0
- package/dist/useLongPressRepeat.js +27 -0
- package/dist/usePagination.js +26 -0
- package/dist/useScrollableListBox.js +24 -0
- package/dist/useSelectItems.js +82 -0
- package/dist/useSorting.js +34 -0
- package/dist/useStateAndRef.js +15 -0
- package/dist/useTableColumnConfig.js +38 -0
- package/dist/useTableNav.js +279 -0
- package/dist/useToast.js +63 -0
- package/dist/useTranslationMemo.js +10 -0
- package/dist/zod.utils.js +17 -0
- package/package.json +14 -14
- package/dist/assets/icons/AlignCenter.js +0 -21
- package/dist/assets/icons/AlignLeft.js +0 -21
- package/dist/assets/icons/AlignLeftRight.js +0 -21
- package/dist/assets/icons/AlignRight.js +0 -21
- package/dist/assets/icons/ArrowDropDown.js +0 -21
- package/dist/assets/icons/ArrowDropUp.js +0 -21
- package/dist/assets/icons/ArrowLeft.js +0 -21
- package/dist/assets/icons/ArrowRight.js +0 -21
- package/dist/assets/icons/Bold.js +0 -21
- package/dist/assets/icons/BulletedList.js +0 -21
- package/dist/assets/icons/Calendar.js +0 -23
- package/dist/assets/icons/Check.js +0 -23
- package/dist/assets/icons/CheckCircle.js +0 -21
- package/dist/assets/icons/CheckboxCheckmark.js +0 -24
- package/dist/assets/icons/CheckboxIndeterminate.js +0 -24
- package/dist/assets/icons/ChevronDown.js +0 -23
- package/dist/assets/icons/ChevronLeft.js +0 -23
- package/dist/assets/icons/ChevronRight.js +0 -23
- package/dist/assets/icons/ChevronUp.js +0 -23
- package/dist/assets/icons/ChevronsLeft.js +0 -23
- package/dist/assets/icons/ChevronsRight.js +0 -23
- package/dist/assets/icons/Clock.js +0 -21
- package/dist/assets/icons/Close.js +0 -21
- package/dist/assets/icons/DateTime.js +0 -32
- package/dist/assets/icons/Drag.js +0 -21
- package/dist/assets/icons/File.js +0 -23
- package/dist/assets/icons/Highlight.js +0 -21
- package/dist/assets/icons/HighlightOn.js +0 -30
- package/dist/assets/icons/Info.js +0 -32
- package/dist/assets/icons/Italic.js +0 -21
- package/dist/assets/icons/Link.js +0 -21
- package/dist/assets/icons/Menu.js +0 -21
- package/dist/assets/icons/NumberedList.js +0 -21
- package/dist/assets/icons/PointerHorizontal.js +0 -21
- package/dist/assets/icons/PointerVertical.js +0 -21
- package/dist/assets/icons/Send.js +0 -23
- package/dist/assets/icons/Strikethrough.js +0 -21
- package/dist/assets/icons/TextColor.js +0 -30
- package/dist/assets/icons/Today.js +0 -21
- package/dist/assets/icons/Underlined.js +0 -23
- package/dist/assets/icons/Upload.js +0 -30
- package/dist/assets/icons/View.js +0 -18
- package/dist/assets/icons/ViewOff.js +0 -18
- package/dist/assets/icons/WarningFilled.js +0 -23
- package/dist/assets/locales/en/translation.json.js +0 -14
- package/dist/assets/locales/sl/translation.json.js +0 -14
- package/dist/components/Menu/Menu.js +0 -14
- package/dist/components/Menu/MenuDesktop.js +0 -74
- package/dist/components/Menu/MenuItem.js +0 -27
- package/dist/components/Menu/MenuMobile.js +0 -83
- package/dist/components/Menu/MenuPopover.js +0 -43
- package/dist/components/Menu/menu.cva.js +0 -45
- package/dist/components/buttons/Button/Button.js +0 -73
- package/dist/components/buttons/Button/button.cva.js +0 -666
- package/dist/components/buttons/IconButton/IconButton.js +0 -17
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +0 -18
- package/dist/components/buttons/PillButton/PillButton.js +0 -44
- package/dist/components/buttons/PillButton/pillButton.cva.js +0 -268
- package/dist/components/buttons/SplitButton/SplitButton.js +0 -65
- package/dist/components/buttons/TextButton/TextButton.js +0 -18
- package/dist/components/buttons/ToggleButton/ToggleButton.js +0 -21
- package/dist/components/buttons/shared/ButtonContent.js +0 -53
- package/dist/components/buttons/shared/buttonContent.cva.js +0 -16
- package/dist/components/inputs/Checkbox/Checkbox.js +0 -81
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +0 -32
- package/dist/components/inputs/Checkbox/checkbox.cva.js +0 -51
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +0 -251
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +0 -689
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +0 -265
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +0 -217
- package/dist/components/inputs/DateTime/shared/Calendar.js +0 -85
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +0 -160
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +0 -67
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +0 -89
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +0 -203
- package/dist/components/inputs/DateTime/shared/DateField.js +0 -77
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +0 -206
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +0 -55
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +0 -76
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +0 -47
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +0 -82
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +0 -133
- package/dist/components/inputs/DateTime/shared/TimeField.js +0 -26
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +0 -186
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +0 -125
- package/dist/components/inputs/DateTime/shared/YearPicker.js +0 -89
- package/dist/components/inputs/File/FileUpload.js +0 -257
- package/dist/components/inputs/File/FileUploadContainer.js +0 -17
- package/dist/components/inputs/File/InputUpload.js +0 -174
- package/dist/components/inputs/File/shared/FileCard.js +0 -67
- package/dist/components/inputs/File/shared/FileCardList.js +0 -20
- package/dist/components/inputs/File/shared/FileUploadContent.js +0 -92
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +0 -92
- package/dist/components/inputs/File/shared/FileUploadContentError.js +0 -167
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +0 -173
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +0 -128
- package/dist/components/inputs/File/shared/InputUploadContent.js +0 -73
- package/dist/components/inputs/File/shared/InputUploadFilled.js +0 -45
- package/dist/components/inputs/File/shared/ProgressBar.js +0 -42
- package/dist/components/inputs/File/shared/fileUpload.cva.js +0 -58
- package/dist/components/inputs/File/shared/inputUploadButton.cva.js +0 -49
- package/dist/components/inputs/FormField/FormField.js +0 -54
- package/dist/components/inputs/FormField/FormFieldError.js +0 -16
- package/dist/components/inputs/FormField/FormFieldHeader.js +0 -57
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +0 -20
- package/dist/components/inputs/FormField/FormFieldLabel.js +0 -37
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +0 -166
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +0 -26
- package/dist/components/inputs/Input/TextArea/TextArea.js +0 -155
- package/dist/components/inputs/Input/TextInput/TextInput.js +0 -162
- package/dist/components/inputs/Input/shared/InputContent.js +0 -114
- package/dist/components/inputs/Inputs/Form.js +0 -68
- package/dist/components/inputs/Inputs/InputItem.js +0 -61
- package/dist/components/inputs/Inputs/Inputs.js +0 -32
- package/dist/components/inputs/RadioGroup/RadioGroup.js +0 -103
- package/dist/components/inputs/RadioGroup/radio.cva.js +0 -57
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +0 -39
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +0 -25
- package/dist/components/inputs/Selection/Select/Select.js +0 -32
- package/dist/components/inputs/Selection/shared/SelectBase.js +0 -27
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +0 -223
- package/dist/components/inputs/Selection/shared/SelectInput.js +0 -234
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +0 -49
- package/dist/components/inputs/Selection/shared/SelectListBox.js +0 -127
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +0 -78
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +0 -45
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +0 -47
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +0 -42
- package/dist/components/inputs/Selection/shared/SelectMobile.js +0 -165
- package/dist/components/inputs/Selection/shared/select.context.js +0 -244
- package/dist/components/inputs/Selection/shared/useSelectItems.js +0 -94
- package/dist/components/inputs/Slider/Slider.js +0 -137
- package/dist/components/inputs/TextEditor/TextEditor.js +0 -223
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +0 -34
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +0 -80
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +0 -92
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +0 -56
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +0 -33
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +0 -31
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +0 -37
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +0 -51
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +0 -73
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +0 -61
- package/dist/components/inputs/TextEditor/textEditor.types.js +0 -40
- package/dist/components/inputs/Toggle/Toggle.js +0 -65
- package/dist/components/inputs/Toggle/toggle.cva.js +0 -44
- package/dist/components/inputs/shared/CheckContent.js +0 -22
- package/dist/components/inputs/shared/InputClear.js +0 -27
- package/dist/components/inputs/shared/TooltipWrapper.js +0 -23
- package/dist/components/inputs/shared/input.cva.js +0 -174
- package/dist/components/inputs/shared/label.cva.js +0 -128
- package/dist/components/outline.clsx.js +0 -11
- package/dist/components/overlays/ActionModal/ActionModal.js +0 -80
- package/dist/components/overlays/BottomSheet/BottomSheet.js +0 -261
- package/dist/components/overlays/Drawer/Drawer.js +0 -84
- package/dist/components/overlays/Modal/Modal.js +0 -64
- package/dist/components/overlays/Modal/modal.cva.js +0 -53
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +0 -71
- package/dist/components/overlays/Tooltip/Tooltip.js +0 -92
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +0 -27
- package/dist/components/overlays/Tooltip/tooltip.cva.js +0 -60
- package/dist/components/segment/Segment.js +0 -118
- package/dist/components/segment/SegmentItem.js +0 -35
- package/dist/components/segment/segment.cva.js +0 -35
- package/dist/components/shared/pagination/Pagination.js +0 -75
- package/dist/components/shared/pagination/PaginationList.js +0 -145
- package/dist/components/shared/pagination/minWidth.cva.js +0 -15
- package/dist/components/status/Alert/Alert.js +0 -41
- package/dist/components/status/Alert/alert.cva.js +0 -64
- package/dist/components/status/Loader/Loader.js +0 -37
- package/dist/components/status/Loader/loader.cva.js +0 -27
- package/dist/components/status/Toast/Toast.js +0 -65
- package/dist/components/status/Toast/toast.cva.js +0 -150
- package/dist/components/status/Toast/useToast.js +0 -94
- package/dist/components/status/shared/status.cva.js +0 -62
- package/dist/components/table/CellText.js +0 -18
- package/dist/components/table/ColumnConfig.js +0 -124
- package/dist/components/table/HeaderText.js +0 -15
- package/dist/components/table/InfiniteTable.js +0 -40
- package/dist/components/table/PaginatedTable.js +0 -33
- package/dist/components/table/Table.js +0 -370
- package/dist/components/table/table.cva.js +0 -63
- package/dist/components/text/Link/Link.js +0 -24
- package/dist/components/text/Link/link.cva.js +0 -18
- package/dist/components/text/Tag/Tag.js +0 -49
- package/dist/components/text/Tag/tag.cva.js +0 -59
- package/dist/components/text/Typography/Typography.js +0 -22
- package/dist/components/text/Typography/typography.cva.js +0 -100
- package/dist/config/confirmation.context.js +0 -107
- package/dist/config/i18n.js +0 -15
- package/dist/config/link.context.js +0 -19
- package/dist/config/router.context.js +0 -39
- package/dist/config/theme.context.js +0 -73
- package/dist/config/uiConfig.context.js +0 -69
- package/dist/config/uiStyle.context.js +0 -16
- package/dist/helpers/dynamicColumns.js +0 -359
- package/dist/helpers/dynamicInputs.js +0 -212
- package/dist/hooks/useAutosave.js +0 -83
- package/dist/hooks/useBreakpoint.js +0 -33
- package/dist/hooks/useDebounceCallback.js +0 -29
- package/dist/hooks/useDeepCompare.js +0 -25
- package/dist/hooks/useFilters.js +0 -160
- package/dist/hooks/useForm.js +0 -22
- package/dist/hooks/useFormAutosave.js +0 -67
- package/dist/hooks/useIntersectionObserver.js +0 -27
- package/dist/hooks/useLocalStorage.js +0 -54
- package/dist/hooks/useLongPressRepeat.js +0 -33
- package/dist/hooks/usePagination.js +0 -35
- package/dist/hooks/useScrollableListBox.js +0 -30
- package/dist/hooks/useSorting.js +0 -32
- package/dist/hooks/useStateAndRef.js +0 -17
- package/dist/hooks/useTableColumnConfig.js +0 -63
- package/dist/hooks/useTableNav.js +0 -394
- package/dist/hooks/useTranslationMemo.js +0 -14
- package/dist/utils/array.utils.js +0 -12
- package/dist/utils/compoundMapper.js +0 -14
- package/dist/utils/date-time.utils.js +0 -77
- package/dist/utils/date.utils.js +0 -23
- package/dist/utils/dom.utils.js +0 -13
- package/dist/utils/file.utils.js +0 -63
- package/dist/utils/isEqual.js +0 -95
- package/dist/utils/logger.js +0 -19
- package/dist/utils/object.utils.js +0 -53
- package/dist/utils/queries.utils.js +0 -9
- package/dist/utils/rest.utils.js +0 -51
- package/dist/utils/routing.utils.js +0 -15
- package/dist/utils/string.utils.js +0 -12
- package/dist/utils/vendor/acl/AclGuard.js +0 -14
- package/dist/utils/vendor/acl/Can.js +0 -18
- package/dist/utils/vendor/acl/ability.context.js +0 -37
- package/dist/utils/vendor/auth/AuthGuard.js +0 -26
- package/dist/utils/vendor/auth/auth.context.js +0 -41
- package/dist/utils/vendor/error-handling.js +0 -119
- package/dist/utils/vendor/rest-interceptor.js +0 -21
- package/dist/utils/zod.utils.js +0 -21
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, use } from "react";
|
|
3
|
+
let UIStyle;
|
|
4
|
+
(function(_UIStyle) {
|
|
5
|
+
const Context = createContext(null);
|
|
6
|
+
_UIStyle.Provider = ({ children, config }) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
8
|
+
value: config,
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
_UIStyle.useConfig = () => {
|
|
13
|
+
return use(Context);
|
|
14
|
+
};
|
|
15
|
+
})(UIStyle || (UIStyle = {}));
|
|
16
|
+
export { UIStyle };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ObjectUtils } from "./object.utils.js";
|
|
2
|
+
import { isEqual } from "./isEqual.js";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { useFormState, useWatch } from "react-hook-form";
|
|
5
|
+
function isNilOrEqual(left, right) {
|
|
6
|
+
if (ObjectUtils.isNil(left) && ObjectUtils.isNil(right)) return true;
|
|
7
|
+
return isEqual(left, right);
|
|
8
|
+
}
|
|
9
|
+
function diffLeftOnly(left, right, shallowKeys) {
|
|
10
|
+
if (!ObjectUtils.isObject(left) || ObjectUtils.isDate(left) || ObjectUtils.isRegExp(left)) return !isNilOrEqual(left, right) ? left : void 0;
|
|
11
|
+
if (Array.isArray(left)) return !isNilOrEqual(left, right) ? left : void 0;
|
|
12
|
+
const result = Object.entries(left).reduce((acc, [key, value]) => {
|
|
13
|
+
const shallowSubtree = shallowKeys?.[key];
|
|
14
|
+
if (shallowSubtree === true) {
|
|
15
|
+
if (!isNilOrEqual(value, right?.[key])) acc[key] = value;
|
|
16
|
+
return acc;
|
|
17
|
+
}
|
|
18
|
+
const diff = diffLeftOnly(value, right?.[key], shallowSubtree);
|
|
19
|
+
if (diff !== void 0 && (!ObjectUtils.isObject(diff) || !ObjectUtils.isEmpty(diff))) acc[key] = diff;
|
|
20
|
+
return acc;
|
|
21
|
+
}, {});
|
|
22
|
+
return ObjectUtils.isEmpty(result) ? void 0 : result;
|
|
23
|
+
}
|
|
24
|
+
function useAutosave({ form, delay = 500, enabled = true, onSave, onSaveSuccess }) {
|
|
25
|
+
const timeoutRef = useRef(void 0);
|
|
26
|
+
const { control, reset, handleSubmit } = form;
|
|
27
|
+
const { dirtyFields, defaultValues } = useFormState({ control });
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!enabled || Object.keys(dirtyFields).length === 0) return;
|
|
30
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
31
|
+
timeoutRef.current = setTimeout(() => {
|
|
32
|
+
handleSubmit(async (data) => {
|
|
33
|
+
const changedData = diffLeftOnly(Object.entries(dirtyFields).filter(([, value]) => value).reduce((acc, [key]) => {
|
|
34
|
+
acc[key] = data[key];
|
|
35
|
+
return acc;
|
|
36
|
+
}, {}), defaultValues, dirtyFields) ?? {};
|
|
37
|
+
if (Object.keys(changedData).length === 0) return;
|
|
38
|
+
try {
|
|
39
|
+
reset(void 0, { keepValues: true });
|
|
40
|
+
await onSave(changedData);
|
|
41
|
+
onSaveSuccess?.();
|
|
42
|
+
} catch {
|
|
43
|
+
reset(defaultValues);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
47
|
+
}, delay);
|
|
48
|
+
return () => {
|
|
49
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
50
|
+
};
|
|
51
|
+
}, [
|
|
52
|
+
defaultValues,
|
|
53
|
+
dirtyFields,
|
|
54
|
+
useWatch({ control }),
|
|
55
|
+
delay,
|
|
56
|
+
onSave,
|
|
57
|
+
handleSubmit,
|
|
58
|
+
enabled,
|
|
59
|
+
reset
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
export { useAutosave };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useMediaQuery } from "react-responsive";
|
|
3
|
+
var breakpoints = null;
|
|
4
|
+
function getBreakpoints() {
|
|
5
|
+
if (breakpoints) return breakpoints;
|
|
6
|
+
if (typeof window === "undefined") return {
|
|
7
|
+
sm: "23.75rem",
|
|
8
|
+
md: "37.5rem",
|
|
9
|
+
lg: "80rem",
|
|
10
|
+
xl: "105rem"
|
|
11
|
+
};
|
|
12
|
+
const cs = getComputedStyle(document.documentElement);
|
|
13
|
+
const entries = [
|
|
14
|
+
"sm",
|
|
15
|
+
"md",
|
|
16
|
+
"lg",
|
|
17
|
+
"xl",
|
|
18
|
+
"2xl"
|
|
19
|
+
].map((k) => [k, cs.getPropertyValue(`--breakpoint-${k}`).trim()]).filter(([, v]) => !!v);
|
|
20
|
+
breakpoints = Object.fromEntries(entries);
|
|
21
|
+
return breakpoints;
|
|
22
|
+
}
|
|
23
|
+
function useBreakpoint(breakpointKey) {
|
|
24
|
+
const breakpoints$1 = useMemo(() => getBreakpoints(), []);
|
|
25
|
+
if (!breakpoints$1) throw new Error("Tailwind config is missing theme.screens");
|
|
26
|
+
return useMediaQuery({ query: `(min-width: ${breakpoints$1[breakpointKey]})` });
|
|
27
|
+
}
|
|
28
|
+
export { useBreakpoint };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
function useDebounceCallback(callback, { delay = 500 } = {}) {
|
|
3
|
+
const timeoutRef = useRef(null);
|
|
4
|
+
const [isDebouncing, setIsDebouncing] = useState(false);
|
|
5
|
+
const debouncedCallback = useCallback((...args) => {
|
|
6
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
7
|
+
setIsDebouncing(true);
|
|
8
|
+
timeoutRef.current = setTimeout(() => {
|
|
9
|
+
setIsDebouncing(false);
|
|
10
|
+
callback?.(...args);
|
|
11
|
+
}, delay);
|
|
12
|
+
}, [callback, delay]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
return () => {
|
|
15
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
16
|
+
};
|
|
17
|
+
}, []);
|
|
18
|
+
return {
|
|
19
|
+
callback: debouncedCallback,
|
|
20
|
+
isDebouncing
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export { useDebounceCallback };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isEqual } from "./isEqual.js";
|
|
2
|
+
import { useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
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
|
+
var 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 { useDeepCompareEffect, useDeepCompareLayoutEffect, useDeepCompareMemo };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { UIRouter } from "./router.context.js";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
function getFieldType(schema, fieldKey) {
|
|
5
|
+
if (!schema || !schema.shape) return "unknown";
|
|
6
|
+
let fieldSchema = schema.shape[fieldKey];
|
|
7
|
+
while (fieldSchema) if (fieldSchema instanceof z.ZodOptional || fieldSchema instanceof z.ZodNullable) fieldSchema = fieldSchema.unwrap();
|
|
8
|
+
else break;
|
|
9
|
+
if (!fieldSchema) return "unknown";
|
|
10
|
+
if (fieldSchema instanceof z.ZodNumber) return "number";
|
|
11
|
+
if (fieldSchema instanceof z.ZodBoolean) return "boolean";
|
|
12
|
+
if (fieldSchema instanceof z.ZodString) return "string";
|
|
13
|
+
return "unknown";
|
|
14
|
+
}
|
|
15
|
+
var serializeFiltersToQuery = (filterData, prefix) => {
|
|
16
|
+
const query = {};
|
|
17
|
+
for (const [key, value] of Object.entries(filterData)) {
|
|
18
|
+
if (value === null || value === void 0) continue;
|
|
19
|
+
const filterKey = `filter[${prefix && `${prefix}-`}${key}]`;
|
|
20
|
+
if (Array.isArray(value) || typeof value === "object") query[filterKey] = JSON.stringify(value);
|
|
21
|
+
else if (typeof value === "boolean") query[filterKey] = value ? "true" : "false";
|
|
22
|
+
else query[filterKey] = value.toString();
|
|
23
|
+
}
|
|
24
|
+
return query;
|
|
25
|
+
};
|
|
26
|
+
var parseFilterFromQuery = (searchParams, schema) => {
|
|
27
|
+
const filter = {};
|
|
28
|
+
for (const [key, value] of searchParams.entries()) {
|
|
29
|
+
const match = /^filter\[(.+?)\]$/.exec(key);
|
|
30
|
+
if (!match) continue;
|
|
31
|
+
const filterKey = match[1];
|
|
32
|
+
const isArray = value.startsWith("[") && value.endsWith("]");
|
|
33
|
+
const isObject = value.startsWith("{") && value.endsWith("}");
|
|
34
|
+
const isNumber = !Number.isNaN(Number(value)) && value !== "";
|
|
35
|
+
const isBoolean = ["true", "false"].includes(value);
|
|
36
|
+
if (isArray || isObject || isNumber) filter[filterKey] = JSON.parse(value);
|
|
37
|
+
else if (isBoolean) filter[filterKey] = value === "true";
|
|
38
|
+
else {
|
|
39
|
+
const expectedType = getFieldType(schema, filterKey);
|
|
40
|
+
if (expectedType === "number" && !Number.isNaN(Number(value)) && value !== "" && value !== null) filter[filterKey] = Number(value);
|
|
41
|
+
else if (expectedType === "boolean" && ["true", "false"].includes(value)) filter[filterKey] = value === "true";
|
|
42
|
+
else filter[filterKey] = value;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return filter;
|
|
46
|
+
};
|
|
47
|
+
const useFilters = (defaultFilterValues, prefix = "", schema) => {
|
|
48
|
+
const { searchParams, pathname, replace } = UIRouter.useUIRouter();
|
|
49
|
+
const [filterData, setFilterData] = useState(() => parseFilterFromQuery(searchParams, schema));
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const setUrlToDefaultFilters = () => {
|
|
52
|
+
const flatFilterQuery = serializeFiltersToQuery(defaultFilterValues, prefix);
|
|
53
|
+
replace(`${pathname}?${new URLSearchParams({
|
|
54
|
+
...Object.fromEntries(searchParams.entries()),
|
|
55
|
+
...flatFilterQuery
|
|
56
|
+
}).toString()}`);
|
|
57
|
+
};
|
|
58
|
+
const currentFilters = parseFilterFromQuery(searchParams, schema);
|
|
59
|
+
const hasFiltersSet = Object.keys(currentFilters).length > 0;
|
|
60
|
+
if (defaultFilterValues && !hasFiltersSet) setUrlToDefaultFilters();
|
|
61
|
+
}, [
|
|
62
|
+
defaultFilterValues,
|
|
63
|
+
prefix,
|
|
64
|
+
schema
|
|
65
|
+
]);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
setFilterData(parseFilterFromQuery(searchParams, schema));
|
|
68
|
+
}, [searchParams, schema]);
|
|
69
|
+
const setFilterValue = useCallback((data) => {
|
|
70
|
+
let newFilters = { ...filterData };
|
|
71
|
+
const isReset = Object.keys(data).length === 0;
|
|
72
|
+
if (data === defaultFilterValues) newFilters = { ...defaultFilterValues };
|
|
73
|
+
else if (isReset) newFilters = {};
|
|
74
|
+
else Object.entries(data).forEach(([key, value]) => {
|
|
75
|
+
if (value === void 0) delete newFilters[key];
|
|
76
|
+
else newFilters[key] = value;
|
|
77
|
+
});
|
|
78
|
+
const prefixPart = prefix ? `${prefix}-` : "";
|
|
79
|
+
const cleanedQuery = searchParams.keys().reduce((acc, k) => {
|
|
80
|
+
if (!k.startsWith(`filter[${prefixPart}`)) acc[k] = searchParams.get(k) ?? "";
|
|
81
|
+
return acc;
|
|
82
|
+
}, {});
|
|
83
|
+
const flatFilterQuery = serializeFiltersToQuery(newFilters, prefix);
|
|
84
|
+
replace(`${pathname}?${new URLSearchParams({
|
|
85
|
+
...cleanedQuery,
|
|
86
|
+
...flatFilterQuery
|
|
87
|
+
}).toString()}`);
|
|
88
|
+
setFilterData(newFilters);
|
|
89
|
+
}, [
|
|
90
|
+
filterData,
|
|
91
|
+
prefix,
|
|
92
|
+
pathname,
|
|
93
|
+
replace,
|
|
94
|
+
defaultFilterValues,
|
|
95
|
+
searchParams
|
|
96
|
+
]);
|
|
97
|
+
const getFilterValue = useCallback((keys) => {
|
|
98
|
+
const result = {};
|
|
99
|
+
keys.forEach((key) => {
|
|
100
|
+
result[key] = filterData[key];
|
|
101
|
+
});
|
|
102
|
+
return result;
|
|
103
|
+
}, [filterData]);
|
|
104
|
+
const clearAllFilters = useCallback(() => {
|
|
105
|
+
setFilterValue(defaultFilterValues ?? {});
|
|
106
|
+
}, [defaultFilterValues, setFilterValue]);
|
|
107
|
+
return useMemo(() => {
|
|
108
|
+
return {
|
|
109
|
+
filterData,
|
|
110
|
+
setFilterValue,
|
|
111
|
+
getFilterValue,
|
|
112
|
+
clearAllFilters
|
|
113
|
+
};
|
|
114
|
+
}, [
|
|
115
|
+
filterData,
|
|
116
|
+
setFilterValue,
|
|
117
|
+
getFilterValue,
|
|
118
|
+
clearAllFilters
|
|
119
|
+
]);
|
|
120
|
+
};
|
|
121
|
+
export { useFilters };
|
package/dist/useForm.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useForm } from "react-hook-form";
|
|
3
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
4
|
+
function useForm$1({ resolver, zodSchema, defaultValues,...props }) {
|
|
5
|
+
const formResolver = useMemo(() => resolver ?? (zodSchema ? zodResolver(zodSchema) : void 0), [resolver, zodSchema]);
|
|
6
|
+
return useForm({
|
|
7
|
+
...props,
|
|
8
|
+
resolver: formResolver,
|
|
9
|
+
defaultValues
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export { useForm$1 as useForm };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ObjectUtils } from "./object.utils.js";
|
|
2
|
+
import { useAutosave } from "./useAutosave.js";
|
|
3
|
+
import { useForm } from "./useForm.js";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
var 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({ autosaveDelay, enableAutosave, onAutosave, getResetValues, resetDeps, resetTimeout = 5e3,...props }) {
|
|
18
|
+
const form = useForm({
|
|
19
|
+
...props,
|
|
20
|
+
defaultValues: getResetValues()
|
|
21
|
+
});
|
|
22
|
+
const shouldResetFormValuesRef = useRef(false);
|
|
23
|
+
const resetFormValuesTimeoutRef = useRef(void 0);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const resetValues = getResetValues();
|
|
26
|
+
if (resetValues === void 0) return;
|
|
27
|
+
const resetFormValues = async () => {
|
|
28
|
+
const keepStateOptions = shouldResetFormValuesRef.current ? { keepDirtyValues: true } : void 0;
|
|
29
|
+
shouldResetFormValuesRef.current = false;
|
|
30
|
+
let values = resetValues;
|
|
31
|
+
if (ObjectUtils.isFunction(resetValues)) values = await resetValues();
|
|
32
|
+
form.reset(values, keepStateOptions);
|
|
33
|
+
};
|
|
34
|
+
resetFormValues();
|
|
35
|
+
}, [...resetDeps]);
|
|
36
|
+
const onSaveSuccess = () => {
|
|
37
|
+
shouldResetFormValuesRef.current = true;
|
|
38
|
+
if (resetFormValuesTimeoutRef.current) clearTimeout(resetFormValuesTimeoutRef.current);
|
|
39
|
+
resetFormValuesTimeoutRef.current = setTimeout(() => {
|
|
40
|
+
if (shouldResetFormValuesRef.current) throw new Error(getResetTimeoutErrorMessage(resetTimeout));
|
|
41
|
+
}, resetTimeout);
|
|
42
|
+
};
|
|
43
|
+
useAutosave({
|
|
44
|
+
form,
|
|
45
|
+
delay: autosaveDelay,
|
|
46
|
+
enabled: enableAutosave,
|
|
47
|
+
onSave: onAutosave,
|
|
48
|
+
onSaveSuccess
|
|
49
|
+
});
|
|
50
|
+
return form;
|
|
51
|
+
}
|
|
52
|
+
export { useFormAutosave };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
const useIntersectionObserver = ({ onIntersection, root, rootMargin, threshold }) => {
|
|
3
|
+
const [ref, setRef] = useState(null);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
const observer = new IntersectionObserver((entries) => {
|
|
6
|
+
if (entries.some((entry) => entry.isIntersecting)) onIntersection?.();
|
|
7
|
+
}, {
|
|
8
|
+
root,
|
|
9
|
+
rootMargin,
|
|
10
|
+
threshold
|
|
11
|
+
});
|
|
12
|
+
if (ref) observer.observe(ref);
|
|
13
|
+
return () => observer.disconnect();
|
|
14
|
+
}, [
|
|
15
|
+
ref,
|
|
16
|
+
root,
|
|
17
|
+
rootMargin,
|
|
18
|
+
threshold,
|
|
19
|
+
onIntersection
|
|
20
|
+
]);
|
|
21
|
+
return { setRef };
|
|
22
|
+
};
|
|
23
|
+
export { useIntersectionObserver };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
var getValue = (key, schema) => {
|
|
3
|
+
if (!localStorage) return null;
|
|
4
|
+
const lsValue = localStorage.getItem(key);
|
|
5
|
+
if (!lsValue) return null;
|
|
6
|
+
let jsonOrString;
|
|
7
|
+
try {
|
|
8
|
+
jsonOrString = JSON.parse(lsValue);
|
|
9
|
+
} catch {
|
|
10
|
+
jsonOrString = lsValue;
|
|
11
|
+
}
|
|
12
|
+
const parsedValue = schema.safeParse(jsonOrString);
|
|
13
|
+
if (parsedValue.success) return parsedValue.data;
|
|
14
|
+
else return null;
|
|
15
|
+
};
|
|
16
|
+
const useLocalStorage = ({ key, schema }) => {
|
|
17
|
+
const [value, setValue] = useState(() => getValue(key, schema));
|
|
18
|
+
return {
|
|
19
|
+
value,
|
|
20
|
+
set: useCallback((newValue) => {
|
|
21
|
+
if (!localStorage) return;
|
|
22
|
+
const parsedValue = schema.safeParse(newValue);
|
|
23
|
+
if (!parsedValue.success) return;
|
|
24
|
+
if (typeof parsedValue.data === "string") localStorage.setItem(key, parsedValue.data);
|
|
25
|
+
else localStorage.setItem(key, JSON.stringify(parsedValue.data));
|
|
26
|
+
setValue(parsedValue.data);
|
|
27
|
+
}, [key, schema]),
|
|
28
|
+
remove: useCallback(() => {
|
|
29
|
+
if (!localStorage) return;
|
|
30
|
+
localStorage.removeItem(key);
|
|
31
|
+
setValue(null);
|
|
32
|
+
}, [key])
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export { useLocalStorage };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
const useLongPressRepeat = ({ onPress, enabled = true, interval = 85, timeout = 500 }) => {
|
|
3
|
+
const intervalRef = useRef(void 0);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
return () => {
|
|
6
|
+
clearInterval(intervalRef.current);
|
|
7
|
+
};
|
|
8
|
+
}, []);
|
|
9
|
+
const onPressStart = () => {
|
|
10
|
+
onPress(false);
|
|
11
|
+
if (!enabled) return;
|
|
12
|
+
intervalRef.current = setTimeout(() => {
|
|
13
|
+
onPress(true);
|
|
14
|
+
intervalRef.current = setInterval(() => {
|
|
15
|
+
onPress(true);
|
|
16
|
+
}, interval);
|
|
17
|
+
}, timeout);
|
|
18
|
+
};
|
|
19
|
+
const onPressEnd = () => {
|
|
20
|
+
clearInterval(intervalRef.current);
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
onPressStart,
|
|
24
|
+
onPressEnd
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export { useLongPressRepeat };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { UIRouter } from "./router.context.js";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
var DEFAULT_STATE = {
|
|
4
|
+
pageIndex: 1,
|
|
5
|
+
pageSize: 20
|
|
6
|
+
};
|
|
7
|
+
function usePagination(defaultPagination) {
|
|
8
|
+
const { pathname, replace, searchParams } = UIRouter.useUIRouter();
|
|
9
|
+
const [pagination, setPagination] = useState(defaultPagination ?? {
|
|
10
|
+
pageIndex: searchParams.has("page") ? Number.parseInt(searchParams.get("page") ?? "", 10) : DEFAULT_STATE.pageIndex,
|
|
11
|
+
pageSize: searchParams.has("size") ? Number.parseInt(searchParams.get("size") ?? "", 10) : DEFAULT_STATE.pageSize
|
|
12
|
+
});
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const params = new URLSearchParams(searchParams);
|
|
15
|
+
if (pagination.pageSize !== DEFAULT_STATE.pageSize) params.append("size", pagination.pageSize.toString());
|
|
16
|
+
if (pagination.pageIndex !== DEFAULT_STATE.pageIndex) params.append("page", pagination.pageIndex.toString());
|
|
17
|
+
replace(`${pathname}${params.size > 0 ? `?${params.toString()}` : ""}`);
|
|
18
|
+
}, [pagination]);
|
|
19
|
+
return {
|
|
20
|
+
pagination,
|
|
21
|
+
setPagination,
|
|
22
|
+
pageIndex: pagination.pageIndex,
|
|
23
|
+
pageSize: pagination.pageSize
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export { usePagination };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useBreakpoint } from "./useBreakpoint.js";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
function useScrollableListBox() {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
const isDesktop = useBreakpoint("md");
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const node = ref.current;
|
|
8
|
+
if (!node || isDesktop) return;
|
|
9
|
+
const onPointerDownCapture = (e) => {
|
|
10
|
+
e.stopPropagation();
|
|
11
|
+
};
|
|
12
|
+
const onClickCapture = (e) => {
|
|
13
|
+
if (e.currentTarget?.contains(e.target) && e.target !== e.currentTarget) e.target.click();
|
|
14
|
+
};
|
|
15
|
+
node.addEventListener("pointerdown", onPointerDownCapture);
|
|
16
|
+
node.addEventListener("click", onClickCapture);
|
|
17
|
+
return () => {
|
|
18
|
+
node.removeEventListener("pointerdown", onPointerDownCapture);
|
|
19
|
+
node.removeEventListener("click", onClickCapture);
|
|
20
|
+
};
|
|
21
|
+
}, [ref, isDesktop]);
|
|
22
|
+
return { ref };
|
|
23
|
+
}
|
|
24
|
+
export { useScrollableListBox };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useFilter } from "react-aria-components";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
const SelectAllItemId = "all-item-id";
|
|
4
|
+
var SelectAllItem = (inputValue) => ({
|
|
5
|
+
id: SelectAllItemId,
|
|
6
|
+
label: inputValue,
|
|
7
|
+
isSelectAllItem: true
|
|
8
|
+
});
|
|
9
|
+
const NewItemId = "new-item-id";
|
|
10
|
+
var NewItem = (inputValue) => ({
|
|
11
|
+
id: NewItemId,
|
|
12
|
+
label: inputValue,
|
|
13
|
+
isNewItem: true
|
|
14
|
+
});
|
|
15
|
+
const LoadingItemId = "loading-item-id";
|
|
16
|
+
var LoadingItem = (inputValue) => ({
|
|
17
|
+
id: LoadingItemId,
|
|
18
|
+
label: inputValue,
|
|
19
|
+
isLoadingItem: true
|
|
20
|
+
});
|
|
21
|
+
const ReservedItemIds = [
|
|
22
|
+
SelectAllItemId,
|
|
23
|
+
NewItemId,
|
|
24
|
+
LoadingItemId
|
|
25
|
+
];
|
|
26
|
+
function useSelectItems({ initialSelectedItems, selectedItems, cachedItems, inputValue, showAll, isMultiple, showSelectAllOption, showNewItemOption, newItemMinLength = 3, isLoading, hasLoadMore, isClientSearchDisabled }) {
|
|
27
|
+
const { contains } = useFilter({ sensitivity: "base" });
|
|
28
|
+
const allListItems = useMemo(() => {
|
|
29
|
+
const showSelectAllItem = isMultiple && showSelectAllOption && inputValue.length === 0 && !hasLoadMore;
|
|
30
|
+
const showNewItem = showNewItemOption && inputValue.length >= newItemMinLength && !cachedItems.find((item) => contains(item.label, inputValue));
|
|
31
|
+
const showLoadingItem = isLoading || hasLoadMore;
|
|
32
|
+
return [
|
|
33
|
+
...showSelectAllItem ? [SelectAllItem(inputValue)] : [],
|
|
34
|
+
...cachedItems,
|
|
35
|
+
...showNewItem ? [NewItem(inputValue)] : [],
|
|
36
|
+
...showLoadingItem ? [LoadingItem(inputValue)] : []
|
|
37
|
+
];
|
|
38
|
+
}, [
|
|
39
|
+
isMultiple,
|
|
40
|
+
showNewItemOption,
|
|
41
|
+
inputValue,
|
|
42
|
+
newItemMinLength,
|
|
43
|
+
cachedItems,
|
|
44
|
+
contains,
|
|
45
|
+
isLoading,
|
|
46
|
+
hasLoadMore,
|
|
47
|
+
showSelectAllOption
|
|
48
|
+
]);
|
|
49
|
+
const allItems = useMemo(() => {
|
|
50
|
+
const items = [
|
|
51
|
+
...Array.isArray(initialSelectedItems) ? initialSelectedItems : [initialSelectedItems],
|
|
52
|
+
...Array.isArray(selectedItems) ? selectedItems : [selectedItems],
|
|
53
|
+
...allListItems
|
|
54
|
+
].filter((item) => !!item);
|
|
55
|
+
const allItemsMap = /* @__PURE__ */ new Map();
|
|
56
|
+
items.forEach((item) => allItemsMap.set(item.id, item));
|
|
57
|
+
return Array.from(allItemsMap.values());
|
|
58
|
+
}, [
|
|
59
|
+
allListItems,
|
|
60
|
+
initialSelectedItems,
|
|
61
|
+
selectedItems
|
|
62
|
+
]);
|
|
63
|
+
const filteredListItems = useMemo(() => allListItems.filter((item) => contains(item.label, inputValue)), [
|
|
64
|
+
allListItems,
|
|
65
|
+
contains,
|
|
66
|
+
inputValue
|
|
67
|
+
]);
|
|
68
|
+
const listItems = useMemo(() => showAll || isClientSearchDisabled ? allListItems : filteredListItems, [
|
|
69
|
+
showAll,
|
|
70
|
+
isClientSearchDisabled,
|
|
71
|
+
allListItems,
|
|
72
|
+
filteredListItems
|
|
73
|
+
]);
|
|
74
|
+
return {
|
|
75
|
+
allItems,
|
|
76
|
+
allListItems,
|
|
77
|
+
filteredListItems,
|
|
78
|
+
listItems,
|
|
79
|
+
selectableListItems: useMemo(() => listItems.filter((item) => !item.isDisabled && !ReservedItemIds.includes(String(item.id))), [listItems])
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export { NewItemId, SelectAllItemId, useSelectItems };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { UIRouter } from "./router.context.js";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
function useSorting(defaultSorting, prefix = "") {
|
|
4
|
+
const { pathname, replace, searchParams } = UIRouter.useUIRouter();
|
|
5
|
+
const [sorting, setSorting] = useState(defaultSorting ?? searchParams.get(`order${prefix && `-${prefix}`}`)?.split(",").map((item) => {
|
|
6
|
+
if (item.startsWith("-")) return {
|
|
7
|
+
id: item.slice(1),
|
|
8
|
+
desc: true
|
|
9
|
+
};
|
|
10
|
+
if (item.startsWith("+")) return {
|
|
11
|
+
id: item.slice(1),
|
|
12
|
+
desc: false
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
id: item,
|
|
16
|
+
desc: false
|
|
17
|
+
};
|
|
18
|
+
}) ?? []);
|
|
19
|
+
const order = useMemo(() => {
|
|
20
|
+
return sorting.map((field) => `${field.desc ? "-" : "+"}${field.id}`).join(",");
|
|
21
|
+
}, [sorting]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const params = new URLSearchParams(searchParams);
|
|
24
|
+
params.delete("order");
|
|
25
|
+
if (order) params.append(`order${prefix && `-${prefix}`}`, order);
|
|
26
|
+
replace(`${pathname}${params.size > 0 ? `?${params.toString()}` : ""}`);
|
|
27
|
+
}, [order]);
|
|
28
|
+
return {
|
|
29
|
+
sorting,
|
|
30
|
+
setSorting,
|
|
31
|
+
order
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export { useSorting };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ObjectUtils } from "./object.utils.js";
|
|
2
|
+
import { useCallback, useRef, useState } from "react";
|
|
3
|
+
const useStateAndRef = (initialState) => {
|
|
4
|
+
const [state, setState] = useState(initialState);
|
|
5
|
+
const ref = useRef(state);
|
|
6
|
+
return [
|
|
7
|
+
state,
|
|
8
|
+
ref,
|
|
9
|
+
useCallback((value) => {
|
|
10
|
+
ref.current = ObjectUtils.isFunction(value) ? value(ref.current) : value;
|
|
11
|
+
setState(ref.current);
|
|
12
|
+
}, [setState])
|
|
13
|
+
];
|
|
14
|
+
};
|
|
15
|
+
export { useStateAndRef };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } 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(() => defaultColumns.reduce((acc, col) => {
|
|
9
|
+
const key = col.id ?? col.accessorKey;
|
|
10
|
+
acc[key] = true;
|
|
11
|
+
return acc;
|
|
12
|
+
}, {}));
|
|
13
|
+
const [internalColumnOrder, setInternalColumnOrder] = useState(() => defaultColumns.map((col) => col.id ?? col.accessorKey));
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (options.visibleColumns) setInternalVisibleColumns(options.visibleColumns);
|
|
16
|
+
}, [options.visibleColumns]);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (options.columnOrder) setInternalColumnOrder(options.columnOrder);
|
|
19
|
+
}, [options.columnOrder]);
|
|
20
|
+
const handleVisibilityChange = useCallback((value) => {
|
|
21
|
+
setInternalVisibleColumns(value);
|
|
22
|
+
options?.onVisibilityChange?.(value);
|
|
23
|
+
}, [options]);
|
|
24
|
+
const handleOrderChange = useCallback((value) => {
|
|
25
|
+
setInternalColumnOrder(value);
|
|
26
|
+
options?.onOrderChange?.(value);
|
|
27
|
+
}, [options]);
|
|
28
|
+
const configColumns = useMemo(() => sortByKeyOrder(defaultColumns, internalColumnOrder), [defaultColumns, internalColumnOrder]);
|
|
29
|
+
return {
|
|
30
|
+
configColumns,
|
|
31
|
+
columns: useMemo(() => configColumns.filter((col) => internalVisibleColumns?.[col.id ?? col.accessorKey] ?? true), [configColumns, internalVisibleColumns]),
|
|
32
|
+
visibleColumns: internalVisibleColumns,
|
|
33
|
+
columnOrder: internalColumnOrder,
|
|
34
|
+
onVisibilityChange: handleVisibilityChange,
|
|
35
|
+
onOrderChange: handleOrderChange
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export { useTableColumnConfig };
|