@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,272 @@
|
|
|
1
|
+
import { StringUtils } from "./string.utils.js";
|
|
2
|
+
import { ZodUtils } from "./zod.utils.js";
|
|
3
|
+
import { DateUtils } from "./date.utils.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import i18next from "i18next";
|
|
6
|
+
var DEFAULT_NAMESPACE = "dynamicColumns";
|
|
7
|
+
var FORMAT_MAP = {
|
|
8
|
+
datetime: (value) => DateUtils.formatDate(new Date(value)),
|
|
9
|
+
dateRange: (value) => {
|
|
10
|
+
return `${DateUtils.formatDate(new Date(value.start))} - ${DateUtils.formatDate(new Date(value.end))}`;
|
|
11
|
+
},
|
|
12
|
+
enum: (value) => StringUtils.capitalize(value),
|
|
13
|
+
number: (value) => value.toLocaleString(i18next.language),
|
|
14
|
+
string: (value) => String(value),
|
|
15
|
+
boolean: (value) => {
|
|
16
|
+
const key = `${DEFAULT_NAMESPACE}.${value ? "yes" : "no"}`;
|
|
17
|
+
if (i18next.exists(key)) return String(i18next.t(key));
|
|
18
|
+
return value ? "Yes" : "No";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var ZOD_TYPE_FORMAT_MAP = [
|
|
22
|
+
[z.ZodEnum, FORMAT_MAP.enum],
|
|
23
|
+
[z.ZodNumber, FORMAT_MAP.number],
|
|
24
|
+
[z.ZodString, FORMAT_MAP.string],
|
|
25
|
+
[z.ZodBoolean, FORMAT_MAP.boolean],
|
|
26
|
+
[z.ZodISODateTime, FORMAT_MAP.datetime]
|
|
27
|
+
];
|
|
28
|
+
var configValueToColumnDef = (value) => {
|
|
29
|
+
if (typeof value === "function" || typeof value === "string") return { cell: value };
|
|
30
|
+
if (typeof value === "boolean" || value === void 0) return {};
|
|
31
|
+
return value;
|
|
32
|
+
};
|
|
33
|
+
var convertEntriesToColumnDefs = (entries) => {
|
|
34
|
+
return entries.map(([key, value]) => [key, configValueToColumnDef(value)]);
|
|
35
|
+
};
|
|
36
|
+
var customConfigValueToColumnDef = (value) => {
|
|
37
|
+
if (typeof value === "string") return {
|
|
38
|
+
accessorKey: value,
|
|
39
|
+
cell: value
|
|
40
|
+
};
|
|
41
|
+
if (typeof value === "function") return { cell: value };
|
|
42
|
+
return value;
|
|
43
|
+
};
|
|
44
|
+
var convertCustomEntriesToColumnDefs = (entries) => {
|
|
45
|
+
return entries.map(([key, value]) => [key, customConfigValueToColumnDef(value)]);
|
|
46
|
+
};
|
|
47
|
+
var excludeEntries = (entries) => {
|
|
48
|
+
return entries.filter(([, value]) => value !== false && value !== void 0);
|
|
49
|
+
};
|
|
50
|
+
const sortColumns = (columns, orderKeys) => {
|
|
51
|
+
if (!orderKeys) return columns;
|
|
52
|
+
const wildcardIndex = orderKeys.indexOf("*");
|
|
53
|
+
if (wildcardIndex === -1) return columns.sort((columnA, columnB) => {
|
|
54
|
+
const idA = columnA.id;
|
|
55
|
+
const idB = columnB.id;
|
|
56
|
+
const orderMap = new Map(orderKeys.map((key, index) => [String(key), index]));
|
|
57
|
+
const orderA = orderMap.get(String(idA));
|
|
58
|
+
const orderB = orderMap.get(String(idB));
|
|
59
|
+
if (orderA !== void 0 && orderB !== void 0) return orderA - orderB;
|
|
60
|
+
if (orderA !== void 0 && orderB === void 0) return -1;
|
|
61
|
+
if (orderA === void 0 && orderB !== void 0) return 1;
|
|
62
|
+
return 0;
|
|
63
|
+
});
|
|
64
|
+
const beforeWildcard = orderKeys.slice(0, wildcardIndex);
|
|
65
|
+
const afterWildcard = orderKeys.slice(wildcardIndex + 1);
|
|
66
|
+
const beforeMap = new Map(beforeWildcard.map((key, index) => [String(key), index]));
|
|
67
|
+
const afterMap = new Map(afterWildcard.map((key, index) => [String(key), index]));
|
|
68
|
+
const before = [];
|
|
69
|
+
const middle = [];
|
|
70
|
+
const after = [];
|
|
71
|
+
columns.forEach((column) => {
|
|
72
|
+
const id = String(column.id);
|
|
73
|
+
if (beforeMap.has(id)) before.push(column);
|
|
74
|
+
else if (afterMap.has(id)) after.push(column);
|
|
75
|
+
else middle.push(column);
|
|
76
|
+
});
|
|
77
|
+
before.sort((a, b) => beforeMap.get(String(a.id)) - beforeMap.get(String(b.id)));
|
|
78
|
+
after.sort((a, b) => afterMap.get(String(a.id)) - afterMap.get(String(b.id)));
|
|
79
|
+
return [
|
|
80
|
+
...before,
|
|
81
|
+
...middle,
|
|
82
|
+
...after
|
|
83
|
+
];
|
|
84
|
+
};
|
|
85
|
+
var formatValueByType = (value, schemaType) => {
|
|
86
|
+
if (value === null || value === void 0) return null;
|
|
87
|
+
if (ZodUtils.isDateRange(schemaType)) return FORMAT_MAP.dateRange(value);
|
|
88
|
+
const unwrappedType = ZodUtils.unwrapZodType(schemaType);
|
|
89
|
+
if (unwrappedType instanceof z.ZodArray) {
|
|
90
|
+
if (!Array.isArray(value)) return null;
|
|
91
|
+
const elementType = unwrappedType.element;
|
|
92
|
+
return value.map((element) => formatValueByType(element, elementType)).join(", ");
|
|
93
|
+
}
|
|
94
|
+
const formatFunction = ZOD_TYPE_FORMAT_MAP.find(([zodType]) => unwrappedType instanceof zodType)?.[1];
|
|
95
|
+
if (formatFunction) return formatFunction(value);
|
|
96
|
+
return String(value);
|
|
97
|
+
};
|
|
98
|
+
var getNestedValue = (obj, path) => {
|
|
99
|
+
return path.split(".").reduce((current, key) => {
|
|
100
|
+
return current && typeof current === "object" ? current[key] : void 0;
|
|
101
|
+
}, obj);
|
|
102
|
+
};
|
|
103
|
+
var getKeyType = (schema, key) => {
|
|
104
|
+
const pathParts = key.split(".");
|
|
105
|
+
let currentType = schema.shape[pathParts[0]];
|
|
106
|
+
for (let i = 1; i < pathParts.length; i++) if (currentType instanceof z.ZodObject) currentType = currentType.shape[pathParts[i]];
|
|
107
|
+
else {
|
|
108
|
+
currentType = schema.shape[key];
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
return currentType;
|
|
112
|
+
};
|
|
113
|
+
var getCellFunction = (schema, schemaKey, columnDef, options) => {
|
|
114
|
+
const { cell } = columnDef;
|
|
115
|
+
if (typeof cell === "function") return cell;
|
|
116
|
+
return ({ data }) => {
|
|
117
|
+
const key = typeof cell === "string" ? cell : schemaKey;
|
|
118
|
+
const value = getNestedValue(data, key);
|
|
119
|
+
const keyType = getKeyType(schema, key);
|
|
120
|
+
let finalValue = !options.disableFormatting?.includes(key) ? formatValueByType(value, keyType) : value;
|
|
121
|
+
if (options.emptyValue && !finalValue) finalValue = options.emptyValue;
|
|
122
|
+
if (options.globalWrapper) return options.globalWrapper(finalValue);
|
|
123
|
+
return finalValue;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
var normalizeSortable = (sortable) => {
|
|
127
|
+
if (!sortable) return;
|
|
128
|
+
if (Array.isArray(sortable)) return sortable;
|
|
129
|
+
if (sortable instanceof z.ZodEnum) return Object.values(sortable.enum);
|
|
130
|
+
};
|
|
131
|
+
var getDefaultColumnHeader = (key, options) => {
|
|
132
|
+
const localeKey = `${options.namespace ?? DEFAULT_NAMESPACE}.${key}`;
|
|
133
|
+
if (i18next.exists(localeKey)) return String(i18next.t(localeKey));
|
|
134
|
+
return StringUtils.capitalize(key);
|
|
135
|
+
};
|
|
136
|
+
var overridePresetColumnsHeaders = (presetColumns, options) => {
|
|
137
|
+
const namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
138
|
+
return presetColumns.map((columnDef) => {
|
|
139
|
+
const localeKey = `${namespace}.${columnDef.id}`;
|
|
140
|
+
const header = i18next.exists(localeKey) ? i18next.t(localeKey) : columnDef.header;
|
|
141
|
+
return {
|
|
142
|
+
...columnDef,
|
|
143
|
+
header: typeof header === "string" ? header : columnDef.header
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
var populateColumnDef = (schema, key, columnDef, options, sortableKeys) => {
|
|
148
|
+
const id = columnDef.id ?? key;
|
|
149
|
+
const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
|
|
150
|
+
const header = columnDef.header ?? getDefaultColumnHeader(key, options);
|
|
151
|
+
const cell = getCellFunction(schema, key, columnDef, options);
|
|
152
|
+
return {
|
|
153
|
+
...columnDef,
|
|
154
|
+
id,
|
|
155
|
+
accessorKey: key,
|
|
156
|
+
meta: {
|
|
157
|
+
width: "flex-1",
|
|
158
|
+
...options.globalMeta,
|
|
159
|
+
...columnDef.meta
|
|
160
|
+
},
|
|
161
|
+
header,
|
|
162
|
+
enableSorting,
|
|
163
|
+
cell
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
var populateCustomColumnDef = (schema, key, columnDef, options, sortableKeys) => {
|
|
167
|
+
const id = columnDef.id ?? key;
|
|
168
|
+
const accessorKey = columnDef.accessorKey ?? id;
|
|
169
|
+
const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
|
|
170
|
+
const header = columnDef.header ?? getDefaultColumnHeader(key, options);
|
|
171
|
+
const cell = getCellFunction(schema, key, columnDef, options);
|
|
172
|
+
return {
|
|
173
|
+
...columnDef,
|
|
174
|
+
id,
|
|
175
|
+
accessorKey,
|
|
176
|
+
meta: {
|
|
177
|
+
width: "flex-1",
|
|
178
|
+
...options.globalMeta,
|
|
179
|
+
...columnDef.meta
|
|
180
|
+
},
|
|
181
|
+
header,
|
|
182
|
+
enableSorting,
|
|
183
|
+
cell
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
var addMissingSchemaFields = (schema, existingColumns, options, sortableKeys) => {
|
|
187
|
+
const schemaFields = getAllSchemaKeys(schema);
|
|
188
|
+
const definedFields = new Set(existingColumns.map((col) => col.id));
|
|
189
|
+
const additionalColumns = schemaFields.filter((field) => !definedFields.has(field)).map((field) => {
|
|
190
|
+
return populateColumnDef(schema, field, {}, options, sortableKeys);
|
|
191
|
+
});
|
|
192
|
+
return [...existingColumns, ...additionalColumns];
|
|
193
|
+
};
|
|
194
|
+
var removeOverriddenPresetColumns = (presetColumns, options) => {
|
|
195
|
+
if (presetColumns.length === 0) return presetColumns;
|
|
196
|
+
const usedColumnsIds = Object.entries(options.columns ?? {}).map(([key, value]) => {
|
|
197
|
+
return value.id ?? key;
|
|
198
|
+
});
|
|
199
|
+
const usedCustomColumnsIds = Object.entries(options.customColumns ?? {}).map(([key, value]) => {
|
|
200
|
+
return value.id ?? key;
|
|
201
|
+
});
|
|
202
|
+
const usedIds = new Set([...usedColumnsIds, ...usedCustomColumnsIds]);
|
|
203
|
+
return presetColumns.filter((column) => {
|
|
204
|
+
if (!column.id) return true;
|
|
205
|
+
return !usedIds.has(column.id);
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
var getAllSchemaKeys = (schema) => {
|
|
209
|
+
const keys = [];
|
|
210
|
+
const { shape } = schema;
|
|
211
|
+
const traverse = (obj, prefix = "") => {
|
|
212
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
213
|
+
const currentPath = prefix ? `${prefix}.${key}` : key;
|
|
214
|
+
keys.push(currentPath);
|
|
215
|
+
if (value instanceof z.ZodObject) traverse(value.shape, currentPath);
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
traverse(shape);
|
|
219
|
+
return keys;
|
|
220
|
+
};
|
|
221
|
+
var validateCustomColumnKeys = (schema, customColumnKeys) => {
|
|
222
|
+
const schemaKeys = getAllSchemaKeys(schema);
|
|
223
|
+
const invalidCustomColumnKeys = customColumnKeys.filter((key) => schemaKeys.includes(key));
|
|
224
|
+
if (invalidCustomColumnKeys.length > 0) throw new Error(`Invalid custom column keys: [${invalidCustomColumnKeys.join(", ")}]. Custom column keys cannot be part of the schema. Define these columns in the "columns" property instead.`);
|
|
225
|
+
};
|
|
226
|
+
var validateOptionKeyArray = (usedKeys, optionKeys, optionName) => {
|
|
227
|
+
if (!optionKeys) return;
|
|
228
|
+
const extraUnusedKeys = optionKeys.filter((key) => !usedKeys.has(key));
|
|
229
|
+
if (extraUnusedKeys.length > 0) throw new Error(`Found unnecessary keys in "${optionName}": [${extraUnusedKeys.join(", ")}].\n\nAll available options are: [${Array.from(usedKeys).join(", ")}].`);
|
|
230
|
+
};
|
|
231
|
+
var validateParams = (schema, presetColumns, options) => {
|
|
232
|
+
const { columns, customColumns, sortable, order, disableFormatting, includeAll } = options;
|
|
233
|
+
const columnKeys = Object.keys(columns ?? {});
|
|
234
|
+
const customColumnKeys = customColumns ? Object.keys(customColumns) : [];
|
|
235
|
+
const usedKeys = new Set([...columnKeys, ...customColumnKeys]);
|
|
236
|
+
const presetKeys = presetColumns.map((column) => column.id).filter((id) => id !== void 0);
|
|
237
|
+
const schemaKeys = includeAll ? getAllSchemaKeys(schema) : [];
|
|
238
|
+
const allKeys = new Set([
|
|
239
|
+
...presetKeys,
|
|
240
|
+
...usedKeys,
|
|
241
|
+
...schemaKeys,
|
|
242
|
+
"*"
|
|
243
|
+
]);
|
|
244
|
+
if (customColumns) validateCustomColumnKeys(schema, customColumnKeys);
|
|
245
|
+
if (Array.isArray(sortable)) validateOptionKeyArray(usedKeys, sortable, "sortable");
|
|
246
|
+
validateOptionKeyArray(allKeys, order, "order");
|
|
247
|
+
validateOptionKeyArray(usedKeys, disableFormatting, "disableFormatting");
|
|
248
|
+
};
|
|
249
|
+
const dynamicColumns = ({ schema, preset = [], options }) => {
|
|
250
|
+
validateParams(schema, preset, options);
|
|
251
|
+
const sortableKeys = normalizeSortable(options.sortable);
|
|
252
|
+
let entries = Object.entries(options.columns ?? {});
|
|
253
|
+
entries = excludeEntries(entries);
|
|
254
|
+
entries = convertEntriesToColumnDefs(entries);
|
|
255
|
+
const columns = entries.map(([key, value]) => {
|
|
256
|
+
return populateColumnDef(schema, key, value, options, sortableKeys);
|
|
257
|
+
});
|
|
258
|
+
let customEntries = Object.entries(options.customColumns ?? {});
|
|
259
|
+
customEntries = convertCustomEntriesToColumnDefs(customEntries);
|
|
260
|
+
const customColumns = customEntries.map(([key, value]) => {
|
|
261
|
+
return populateCustomColumnDef(schema, key, value, options, sortableKeys);
|
|
262
|
+
});
|
|
263
|
+
let presetColumns = removeOverriddenPresetColumns(preset, options);
|
|
264
|
+
if (options.overridePresetLocales) presetColumns = overridePresetColumnsHeaders(presetColumns, options);
|
|
265
|
+
const mergedColumns = [
|
|
266
|
+
...presetColumns,
|
|
267
|
+
...columns,
|
|
268
|
+
...customColumns
|
|
269
|
+
];
|
|
270
|
+
return sortColumns(options.includeAll ? addMissingSchemaFields(schema, mergedColumns, options, sortableKeys) : mergedColumns, options.order);
|
|
271
|
+
};
|
|
272
|
+
export { dynamicColumns };
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { StringUtils } from "./string.utils.js";
|
|
2
|
+
import { ZodUtils } from "./zod.utils.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import i18next from "i18next";
|
|
5
|
+
var defaultComponentTypes = {
|
|
6
|
+
datetime: "datePicker",
|
|
7
|
+
dateRange: "dateRangePicker",
|
|
8
|
+
boolean: "toggle",
|
|
9
|
+
number: "numberInput",
|
|
10
|
+
enum: "select",
|
|
11
|
+
string: "textInput",
|
|
12
|
+
email: "textInput",
|
|
13
|
+
object: "unknown",
|
|
14
|
+
array: "select",
|
|
15
|
+
uuid: "select",
|
|
16
|
+
unknown: "unknown"
|
|
17
|
+
};
|
|
18
|
+
var ZOD_TYPE_COMPONENT_TYPE = [
|
|
19
|
+
[z.ZodBoolean, defaultComponentTypes.boolean],
|
|
20
|
+
[z.ZodNumber, defaultComponentTypes.number],
|
|
21
|
+
[z.ZodEnum, defaultComponentTypes.enum],
|
|
22
|
+
[z.ZodISODateTime, defaultComponentTypes.datetime],
|
|
23
|
+
[z.ZodString, defaultComponentTypes.string],
|
|
24
|
+
[z.ZodEmail, defaultComponentTypes.email],
|
|
25
|
+
[z.ZodObject, defaultComponentTypes.object],
|
|
26
|
+
[z.ZodArray, defaultComponentTypes.array],
|
|
27
|
+
[z.ZodUUID, defaultComponentTypes.uuid]
|
|
28
|
+
];
|
|
29
|
+
var DEFAULT_NAMESPACE = "dynamicInputs";
|
|
30
|
+
var sortInputDefs = (inputDefs, orderKeys) => {
|
|
31
|
+
if (!orderKeys) return inputDefs;
|
|
32
|
+
return inputDefs.sort((a, b) => {
|
|
33
|
+
const orderMap = new Map(orderKeys.map((key, index) => [key, index]));
|
|
34
|
+
const orderA = orderMap.get(a.name);
|
|
35
|
+
const orderB = orderMap.get(b.name);
|
|
36
|
+
if (orderA !== void 0 && orderB !== void 0) return orderA - orderB;
|
|
37
|
+
if (orderA !== void 0 && orderB === void 0) return -1;
|
|
38
|
+
if (orderA === void 0 && orderB !== void 0) return 1;
|
|
39
|
+
return 0;
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
var excludeEntries = (entries) => {
|
|
43
|
+
return entries.filter(([, value]) => value !== false && value !== void 0);
|
|
44
|
+
};
|
|
45
|
+
var inputConfigToObjectDefinition = (value) => {
|
|
46
|
+
if (typeof value === "object") return value;
|
|
47
|
+
if (typeof value === "function") return { render: value };
|
|
48
|
+
return {};
|
|
49
|
+
};
|
|
50
|
+
var convertInputsConfigToObjectDefinitions = (entries) => {
|
|
51
|
+
return entries.map(([key, value]) => {
|
|
52
|
+
return [key, inputConfigToObjectDefinition(value)];
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const getDefaultInputComponentType = (schemaType) => {
|
|
56
|
+
if (ZodUtils.isDateRange(schemaType)) return defaultComponentTypes.dateRange;
|
|
57
|
+
const unwrappedType = ZodUtils.unwrapZodType(schemaType);
|
|
58
|
+
const componentType = ZOD_TYPE_COMPONENT_TYPE.find(([zodType]) => unwrappedType instanceof zodType)?.[1];
|
|
59
|
+
if (componentType) return componentType;
|
|
60
|
+
return defaultComponentTypes.unknown;
|
|
61
|
+
};
|
|
62
|
+
var getDefaultSelectionItems = (keyType) => {
|
|
63
|
+
const unwrappedType = ZodUtils.unwrapZodType(keyType instanceof z.ZodArray ? keyType.element : keyType);
|
|
64
|
+
if (unwrappedType instanceof z.ZodEnum) return Object.values(unwrappedType.options).filter((value) => typeof value === "string").map((value) => ({
|
|
65
|
+
id: value,
|
|
66
|
+
label: StringUtils.capitalize(value)
|
|
67
|
+
}));
|
|
68
|
+
return [];
|
|
69
|
+
};
|
|
70
|
+
const getDefaultSelectionMode = (keyType) => {
|
|
71
|
+
return keyType instanceof z.ZodArray ? "multiple" : "single";
|
|
72
|
+
};
|
|
73
|
+
var getDefaultProps = (componentType, keyType) => {
|
|
74
|
+
const props = {};
|
|
75
|
+
const unwrappedType = ZodUtils.unwrapZodType(keyType);
|
|
76
|
+
if ([
|
|
77
|
+
"select",
|
|
78
|
+
"autocomplete",
|
|
79
|
+
"segment"
|
|
80
|
+
].includes(componentType)) props.items = getDefaultSelectionItems(unwrappedType);
|
|
81
|
+
if ([
|
|
82
|
+
"select",
|
|
83
|
+
"autocomplete",
|
|
84
|
+
"queryAutocomplete",
|
|
85
|
+
"segment"
|
|
86
|
+
].includes(componentType)) props.selectionMode = getDefaultSelectionMode(unwrappedType);
|
|
87
|
+
return props;
|
|
88
|
+
};
|
|
89
|
+
var getLabelAndPlaceholder = (value, options, schemaKey) => {
|
|
90
|
+
const namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
91
|
+
const stringKey = String(schemaKey);
|
|
92
|
+
let { label, placeholder } = value;
|
|
93
|
+
if (!label) {
|
|
94
|
+
const key = `${namespace}.${stringKey}.label`;
|
|
95
|
+
const translation = i18next.exists(key) ? i18next.t(key) : null;
|
|
96
|
+
label = typeof translation === "string" ? translation : StringUtils.capitalize(stringKey);
|
|
97
|
+
}
|
|
98
|
+
if (!placeholder) {
|
|
99
|
+
const key = `${namespace}.${stringKey}.placeholder`;
|
|
100
|
+
const translation = i18next.exists(key) ? i18next.t(key) : null;
|
|
101
|
+
placeholder = typeof translation === "string" ? translation : void 0;
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
label,
|
|
105
|
+
placeholder
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
var overridePresetLabelsAndPlaceholders = (presetInputDefs, options) => {
|
|
109
|
+
const namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
110
|
+
return presetInputDefs.map((inputDef) => {
|
|
111
|
+
const labelName = String(inputDef.name);
|
|
112
|
+
const labelKey = `${namespace}.${labelName}.label`;
|
|
113
|
+
const placeholderKey = `${namespace}.${labelName}.placeholder`;
|
|
114
|
+
const labelTranslation = i18next.exists(labelKey) ? i18next.t(labelKey) : null;
|
|
115
|
+
const placeholderTranslation = i18next.exists(placeholderKey) ? i18next.t(placeholderKey) : null;
|
|
116
|
+
return {
|
|
117
|
+
...inputDef,
|
|
118
|
+
label: typeof labelTranslation === "string" ? labelTranslation : inputDef.label,
|
|
119
|
+
placeholder: typeof placeholderTranslation === "string" ? placeholderTranslation : inputDef.placeholder
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
var removeOverriddenPresetInputs = (presetInputs, options) => {
|
|
124
|
+
if (presetInputs.length === 0) return presetInputs;
|
|
125
|
+
const usedKeys = new Set(Object.keys(options.inputs ?? {}).map(String));
|
|
126
|
+
return presetInputs.filter((input) => !usedKeys.has(String(input.name)));
|
|
127
|
+
};
|
|
128
|
+
var validateParams = (schema, presetInputs, options) => {
|
|
129
|
+
const { inputs, order, includeAll } = options;
|
|
130
|
+
if (!order) return;
|
|
131
|
+
const inputKeys = Object.keys(inputs ?? {});
|
|
132
|
+
const presetKeys = presetInputs.map((input) => input.name).filter((name) => name !== void 0);
|
|
133
|
+
const schemaKeys = includeAll ? Object.keys(schema.shape) : [];
|
|
134
|
+
const allInputKeys = new Set([
|
|
135
|
+
...inputKeys,
|
|
136
|
+
...presetKeys,
|
|
137
|
+
...schemaKeys
|
|
138
|
+
]);
|
|
139
|
+
const unnecessaryOrderKeys = order.filter((key) => !allInputKeys.has(key));
|
|
140
|
+
if (unnecessaryOrderKeys.length > 0) throw new Error(`Found unnecessary keys in "order": [${unnecessaryOrderKeys.join(", ")}]. These keys are not found in any of the input definitions.\nAll defined input keys are: [${Array.from(allInputKeys).join(", ")}].\nIn the case of a preset input definition, the key is the name attribute.`);
|
|
141
|
+
};
|
|
142
|
+
var populateInputDef = (schema, schemaKey, value, options) => {
|
|
143
|
+
const name = String(schemaKey);
|
|
144
|
+
const { label, placeholder } = getLabelAndPlaceholder(value, options, schemaKey);
|
|
145
|
+
const inputWrapper = value.inputWrapper ?? options.globalInputWrapper;
|
|
146
|
+
if ("render" in value) return {
|
|
147
|
+
name,
|
|
148
|
+
render: value.render
|
|
149
|
+
};
|
|
150
|
+
const schemaKeyType = schema.shape[schemaKey];
|
|
151
|
+
const componentType = "type" in value ? value.type : getDefaultInputComponentType(schemaKeyType);
|
|
152
|
+
const props = {
|
|
153
|
+
...componentType ? getDefaultProps(componentType, schemaKeyType) : {},
|
|
154
|
+
...options.globalProps,
|
|
155
|
+
...value.props
|
|
156
|
+
};
|
|
157
|
+
return {
|
|
158
|
+
type: componentType === "unknown" ? null : componentType,
|
|
159
|
+
name,
|
|
160
|
+
label,
|
|
161
|
+
placeholder,
|
|
162
|
+
inputWrapper,
|
|
163
|
+
props
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
var addMissingSchemaFields = (schema, existingInputDefs, options) => {
|
|
167
|
+
const schemaFields = Object.keys(schema.shape);
|
|
168
|
+
const definedFields = new Set(existingInputDefs.map((def) => def.name));
|
|
169
|
+
const additionalInputDefs = schemaFields.filter((field) => !definedFields.has(field)).map((field) => {
|
|
170
|
+
return populateInputDef(schema, field, {}, options);
|
|
171
|
+
});
|
|
172
|
+
return [...existingInputDefs, ...additionalInputDefs];
|
|
173
|
+
};
|
|
174
|
+
const dynamicInputs = ({ schema, preset = [], options }) => {
|
|
175
|
+
validateParams(schema, preset, options);
|
|
176
|
+
let entries = Object.entries(options.inputs ?? {});
|
|
177
|
+
entries = excludeEntries(entries);
|
|
178
|
+
const inputDefs = convertInputsConfigToObjectDefinitions(entries).map(([key, value]) => {
|
|
179
|
+
return populateInputDef(schema, key, value, options);
|
|
180
|
+
});
|
|
181
|
+
let presetInputDefs = removeOverriddenPresetInputs(preset, options);
|
|
182
|
+
if (options.overridePresetLocales) presetInputDefs = overridePresetLabelsAndPlaceholders(presetInputDefs, options);
|
|
183
|
+
const mergedInputDefs = [...presetInputDefs, ...inputDefs];
|
|
184
|
+
return sortInputDefs(options.includeAll ? addMissingSchemaFields(schema, mergedInputDefs, options) : mergedInputDefs, options.order);
|
|
185
|
+
};
|
|
186
|
+
export { dynamicInputs, getDefaultInputComponentType };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ns } from "./i18n.js";
|
|
2
|
+
import { RestUtils } from "./rest.utils.js";
|
|
3
|
+
import { logger } from "./logger.js";
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import i18next from "i18next";
|
|
7
|
+
var ApplicationException = class extends Error {
|
|
8
|
+
constructor(message, code, serverMessage) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.serverMessage = null;
|
|
11
|
+
this.code = code;
|
|
12
|
+
this.serverMessage = serverMessage;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var ErrorHandler = class {
|
|
16
|
+
constructor(entries) {
|
|
17
|
+
this.entries = [];
|
|
18
|
+
const dataValidationError = {
|
|
19
|
+
code: "DATA_VALIDATION_ERROR",
|
|
20
|
+
condition: (e) => {
|
|
21
|
+
return e instanceof z.ZodError;
|
|
22
|
+
},
|
|
23
|
+
getMessage: () => i18next.t(($) => $.sharedErrors.dataValidation, { ns: "ui" })
|
|
24
|
+
};
|
|
25
|
+
const internalError = {
|
|
26
|
+
code: "INTERNAL_ERROR",
|
|
27
|
+
condition: (e) => {
|
|
28
|
+
if (axios.isAxiosError(e)) return e.response?.status != null && e.response.status >= 500 && e.response.status < 600;
|
|
29
|
+
return false;
|
|
30
|
+
},
|
|
31
|
+
getMessage: () => i18next.t(($) => $.sharedErrors.internalError, { ns: "ui" })
|
|
32
|
+
};
|
|
33
|
+
const networkError = {
|
|
34
|
+
code: "NETWORK_ERROR",
|
|
35
|
+
condition: (e) => {
|
|
36
|
+
if (axios.isAxiosError(e)) return e.code === "ERR_NETWORK";
|
|
37
|
+
return false;
|
|
38
|
+
},
|
|
39
|
+
getMessage: () => i18next.t(($) => $.sharedErrors.networkError, { ns: "ui" })
|
|
40
|
+
};
|
|
41
|
+
const canceledError = {
|
|
42
|
+
code: "CANCELED_ERROR",
|
|
43
|
+
condition: (e) => {
|
|
44
|
+
if (axios.isCancel(e)) return true;
|
|
45
|
+
if (axios.isAxiosError(e) && e.code === "ECONNABORTED") return true;
|
|
46
|
+
return false;
|
|
47
|
+
},
|
|
48
|
+
getMessage: () => i18next.t(($) => $.sharedErrors.canceledError, { ns: "ui" })
|
|
49
|
+
};
|
|
50
|
+
const unknownError = {
|
|
51
|
+
code: "UNKNOWN_ERROR",
|
|
52
|
+
condition: () => true,
|
|
53
|
+
getMessage: () => i18next.t(($) => $.sharedErrors.unknownError, { ns: "ui" })
|
|
54
|
+
};
|
|
55
|
+
this.entries = [
|
|
56
|
+
...entries,
|
|
57
|
+
dataValidationError,
|
|
58
|
+
internalError,
|
|
59
|
+
networkError,
|
|
60
|
+
canceledError,
|
|
61
|
+
unknownError
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
rethrowError(error) {
|
|
65
|
+
logger.error(error);
|
|
66
|
+
const errorEntry = this.entries.find((entry) => entry.condition(error ?? {}));
|
|
67
|
+
const serverMessage = RestUtils.extractServerErrorMessage(error);
|
|
68
|
+
throw new ApplicationException(errorEntry.getMessage(error), errorEntry.code, serverMessage);
|
|
69
|
+
}
|
|
70
|
+
getError(error) {
|
|
71
|
+
if (error instanceof ApplicationException) return error;
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
getErrorCode(error) {
|
|
75
|
+
if (error instanceof ApplicationException) return error.code;
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
static getErrorMessage(error, fallbackToUnknown = true) {
|
|
79
|
+
if (typeof error === "string") return error;
|
|
80
|
+
if (error instanceof Error) return error.message;
|
|
81
|
+
if (error instanceof ApplicationException) return error.message;
|
|
82
|
+
if (fallbackToUnknown) return i18next.t(($) => $.sharedErrors.unknownError, { ns: "ui" });
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const SharedErrorHandler = new ErrorHandler([]);
|
|
87
|
+
export { ApplicationException, ErrorHandler, SharedErrorHandler };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { RestUtils } from "./rest.utils.js";
|
|
2
|
+
let FileUtils;
|
|
3
|
+
(function(_FileUtils) {
|
|
4
|
+
const getObjectUrl = _FileUtils.getObjectUrl = (data, revokeTimeoutMs = 4e4) => {
|
|
5
|
+
const url = URL.createObjectURL(data instanceof Blob ? data : data.data);
|
|
6
|
+
setTimeout(() => URL.revokeObjectURL(url), revokeTimeoutMs);
|
|
7
|
+
return url;
|
|
8
|
+
};
|
|
9
|
+
_FileUtils.openFile = (data, target = "_blank", revokeTimeoutMs) => {
|
|
10
|
+
const url = getObjectUrl(data, revokeTimeoutMs);
|
|
11
|
+
window.open(url, target);
|
|
12
|
+
};
|
|
13
|
+
_FileUtils.downloadFile = (data, fileName, revokeTimeoutMs) => {
|
|
14
|
+
const url = getObjectUrl(data, revokeTimeoutMs);
|
|
15
|
+
const contentDispositionFileName = data instanceof Blob ? void 0 : RestUtils.extractContentDispositionFilename(data.headers);
|
|
16
|
+
const a = document.createElement("a");
|
|
17
|
+
a.download = fileName ?? contentDispositionFileName ?? "download";
|
|
18
|
+
a.rel = "noopener";
|
|
19
|
+
a.href = url;
|
|
20
|
+
setTimeout(() => a.dispatchEvent(new MouseEvent("click")));
|
|
21
|
+
};
|
|
22
|
+
_FileUtils.isFileTypeAccepted = (file, fileTypes) => {
|
|
23
|
+
if (!fileTypes || fileTypes.length === 0) return true;
|
|
24
|
+
return fileTypes.some((type) => {
|
|
25
|
+
if (type.includes("/")) return file.type === type || type.endsWith("/*") && file.type.startsWith(type.slice(0, -1));
|
|
26
|
+
return file.name.toLowerCase().endsWith(type.toLowerCase());
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
_FileUtils.getCalculatedFileSize = (file) => {
|
|
30
|
+
if (!file) return "";
|
|
31
|
+
if (file.size < 1024) return `${file.size} B`;
|
|
32
|
+
if (file.size < 1024 * 1024) return `${(file.size / 1024).toFixed(2)} KB`;
|
|
33
|
+
if (file.size < 1024 * 1024 * 1024) return `${(file.size / 1024 / 1024).toFixed(2)} MB`;
|
|
34
|
+
return `${(file.size / 1024 / 1024 / 1024).toFixed(2)} GB`;
|
|
35
|
+
};
|
|
36
|
+
_FileUtils.formatBytes = (size, decimals = 2) => {
|
|
37
|
+
if (size < 1024) return `${size} B`;
|
|
38
|
+
if (size < 1024 * 1024) return `${(size / 1024).toFixed(decimals)} KB`;
|
|
39
|
+
if (size < 1024 * 1024 * 1024) return `${(size / 1024 / 1024).toFixed(decimals)} MB`;
|
|
40
|
+
return `${(size / 1024 / 1024 / 1024).toFixed(decimals)} GB`;
|
|
41
|
+
};
|
|
42
|
+
})(FileUtils || (FileUtils = {}));
|
|
43
|
+
export { FileUtils };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
const fileUploadDropZoneBase = cva(["relative w-full rounded-input-rounding-default"], {
|
|
4
|
+
variants: {
|
|
5
|
+
variant: {
|
|
6
|
+
vertical: ["flex-col justify-center"],
|
|
7
|
+
horizontal: ["flex-row justify-between"]
|
|
8
|
+
},
|
|
9
|
+
isContainer: {
|
|
10
|
+
true: [
|
|
11
|
+
"data-[drop-target]:before:content-['']",
|
|
12
|
+
"data-[drop-target]:before:absolute",
|
|
13
|
+
"data-[drop-target]:before:z-40",
|
|
14
|
+
"data-[drop-target]:before:width-full",
|
|
15
|
+
"data-[drop-target]:before:height-full",
|
|
16
|
+
"data-[drop-target]:before:top-0",
|
|
17
|
+
"data-[drop-target]:before:left-0",
|
|
18
|
+
"data-[drop-target]:border data-[drop-target]:border-dashed",
|
|
19
|
+
"data-[drop-target]:border-elevation-outline-default-2",
|
|
20
|
+
"data-[drop-target]:before:pointer-events-none data-[drop-target]:before:inset-0",
|
|
21
|
+
"data-[drop-target]:before:bg-elevation-fill-default-2"
|
|
22
|
+
],
|
|
23
|
+
false: [
|
|
24
|
+
"flex items-center",
|
|
25
|
+
"py-file-upload-container-height-top-bottom",
|
|
26
|
+
"px-file-upload-container-side-default",
|
|
27
|
+
"gap-gap-file-upload-content-gap-icon-to-content",
|
|
28
|
+
"border border-input-outlined-outline-idle border-dashed bg-input-outlined-idle",
|
|
29
|
+
"hover:border-elevation-outline-default-2 hover:bg-elevation-fill-default-2",
|
|
30
|
+
"invalid:border invalid:border-input-outlined-outline-error",
|
|
31
|
+
"data-[drop-target]:border-elevation-outline-default-2 data-[drop-target]:bg-elevation-fill-default-2",
|
|
32
|
+
"data-[has-files]:border-solid"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: { variant: "vertical" }
|
|
37
|
+
});
|
|
38
|
+
const fileUploadDropZone = (props) => {
|
|
39
|
+
const { className,...rest } = props;
|
|
40
|
+
return clsx(fileUploadDropZoneBase(rest), className);
|
|
41
|
+
};
|
|
42
|
+
cva(["flex gap-3"], {
|
|
43
|
+
variants: { variant: {
|
|
44
|
+
vertical: ["flex-col"],
|
|
45
|
+
horizontal: ["flex-row flex-wrap"]
|
|
46
|
+
} },
|
|
47
|
+
defaultVariants: { variant: "vertical" }
|
|
48
|
+
});
|
|
49
|
+
export { fileUploadDropZone };
|
package/dist/i18n.js
ADDED