@povio/ui 0.0.6 → 0.0.8
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/index.js +62585 -0
- package/package.json +5 -57
- package/povio-ui-0.0.8.tgz +0 -0
- package/{dist → src}/components/inputs/FormField/FormFieldLabel.d.ts +3 -2
- package/{dist → src}/components/inputs/Input/TextInput/TextInput.d.ts +1 -0
- package/{dist → src}/components/inputs/Selection/shared/SelectBase.d.ts +3 -2
- package/{dist → src}/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/src/components/inputs/Selection/shared/SelectInputTags.d.ts +11 -0
- package/{dist → src}/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/{dist → src}/components/inputs/Selection/shared/select.types.d.ts +8 -0
- package/src/components/inputs/shared/InputClear.d.ts +8 -0
- package/{dist → src}/components/overlays/Tooltip/Tooltip.d.ts +4 -2
- package/src/components/overlays/Tooltip/tooltip.cva.d.ts +21 -0
- package/{dist → src}/components/table/table.cva.d.ts +7 -3
- package/{dist → src}/config/uiConfig.context.d.ts +3 -1
- package/{dist → src}/config/uiStyle.context.d.ts +2 -1
- package/{dist → src}/helpers/dynamicInputs.d.ts +2 -0
- package/{dist → src}/index.d.ts +12 -6
- package/src/utils/vendor/acl/AclGuard.d.ts +8 -0
- package/src/utils/vendor/acl/Can.d.ts +9 -0
- package/src/utils/vendor/acl/ability.context.d.ts +15 -0
- package/src/utils/vendor/acl/appAbility.types.d.ts +3 -0
- package/src/utils/vendor/auth/AuthGuard.d.ts +6 -0
- package/src/utils/vendor/auth/auth.context.d.ts +21 -0
- package/src/utils/vendor/auth/withPrivateAuthGuard.d.ts +6 -0
- package/{dist/utils/rest/rest-client.d.ts → src/utils/vendor/rest-client.types.d.ts} +8 -14
- package/{dist → src}/utils/zod.utils.d.ts +2 -1
- package/vite.config.d.ts +2 -0
- 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 -34
- package/dist/assets/icons/ChevronsRight.js +0 -34
- package/dist/assets/icons/Clock.js +0 -21
- package/dist/assets/icons/Close.js +0 -21
- package/dist/assets/icons/DateTime.js +0 -25
- 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 -34
- package/dist/assets/icons/Italic.js +0 -21
- package/dist/assets/icons/Link.js +0 -21
- package/dist/assets/icons/Menu.js +0 -23
- 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 -68
- package/dist/components/Menu/MenuItem.js +0 -33
- package/dist/components/Menu/MenuMobile.js +0 -78
- package/dist/components/Menu/MenuPopover.js +0 -38
- package/dist/components/buttons/Button/Button.js +0 -68
- package/dist/components/buttons/Button/button.cva.js +0 -672
- 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 -86
- package/dist/components/buttons/SplitButton/SplitButton.js +0 -62
- 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 -49
- package/dist/components/inputs/Checkbox/checkbox.cva.js +0 -47
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +0 -234
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +0 -668
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +0 -248
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +0 -224
- 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 -62
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +0 -163
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +0 -54
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +0 -76
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +0 -41
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +0 -82
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +0 -131
- 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 -107
- package/dist/components/inputs/DateTime/shared/YearPicker.js +0 -89
- package/dist/components/inputs/File/FileUpload.js +0 -254
- package/dist/components/inputs/File/FileUploadContainer.js +0 -17
- package/dist/components/inputs/File/InputUpload.js +0 -176
- 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/FileProgressBar.js +0 -32
- 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 -176
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +0 -128
- package/dist/components/inputs/File/shared/InputUploadContent.js +0 -68
- package/dist/components/inputs/File/shared/InputUploadFilled.js +0 -31
- package/dist/components/inputs/File/shared/fileUpload.cva.js +0 -57
- package/dist/components/inputs/File/shared/inputUploadButton.cva.js +0 -48
- 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 -31
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +0 -157
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +0 -26
- package/dist/components/inputs/Input/TextArea/TextArea.js +0 -149
- package/dist/components/inputs/Input/TextInput/TextInput.js +0 -147
- package/dist/components/inputs/Input/shared/InputContent.js +0 -106
- package/dist/components/inputs/Inputs/Form.js +0 -68
- package/dist/components/inputs/Inputs/InputItem.js +0 -63
- package/dist/components/inputs/Inputs/Inputs.js +0 -32
- package/dist/components/inputs/RadioGroup/RadioGroup.js +0 -113
- package/dist/components/inputs/RadioGroup/radio.cva.js +0 -47
- 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 -24
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +0 -211
- package/dist/components/inputs/Selection/shared/SelectInput.js +0 -237
- package/dist/components/inputs/Selection/shared/SelectListBox.js +0 -97
- 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 -161
- package/dist/components/inputs/Selection/shared/select.context.js +0 -243
- 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.d.ts +0 -6
- package/dist/components/inputs/shared/InputClear.js +0 -26
- package/dist/components/inputs/shared/input.cva.js +0 -167
- package/dist/components/inputs/shared/label.cva.js +0 -133
- 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 -256
- package/dist/components/overlays/Drawer/Drawer.js +0 -84
- package/dist/components/overlays/Modal/Modal.js +0 -53
- 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 -44
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +0 -27
- package/dist/components/segment/Segment.js +0 -113
- package/dist/components/segment/SegmentItem.js +0 -41
- 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 -64
- package/dist/components/status/Toast/toast.cva.js +0 -150
- package/dist/components/status/Toast/useToast.js +0 -83
- 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 -352
- package/dist/components/table/table.cva.js +0 -37
- package/dist/components/text/Link/Link.js +0 -18
- 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/router.context.js +0 -43
- package/dist/config/uiConfig.context.js +0 -62
- package/dist/config/uiStyle.context.js +0 -16
- package/dist/helpers/dynamicColumns.js +0 -359
- package/dist/helpers/dynamicInputs.js +0 -214
- package/dist/hooks/useAutosave.js +0 -80
- package/dist/hooks/useBreakpoint.js +0 -20
- package/dist/hooks/useDebounceCallback.js +0 -29
- package/dist/hooks/useDeepCompare.js +0 -25
- package/dist/hooks/useFilters.js +0 -120
- 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 -63
- package/dist/hooks/useLongPressRepeat.js +0 -33
- package/dist/hooks/usePagination.js +0 -35
- package/dist/hooks/useScrollableListBox.js +0 -30
- package/dist/hooks/useSingletonMutation.d.ts +0 -4
- package/dist/hooks/useSingletonMutation.js +0 -27
- package/dist/hooks/useSorting.js +0 -30
- package/dist/hooks/useStateAndRef.js +0 -17
- package/dist/hooks/useTableColumnConfig.js +0 -59
- package/dist/hooks/useTableNav.js +0 -409
- package/dist/hooks/useTranslationMemo.js +0 -14
- package/dist/index.js +0 -280
- 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 -12
- package/dist/utils/dom.utils.js +0 -13
- package/dist/utils/file.utils.js +0 -63
- package/dist/utils/isEqual.js +0 -94
- 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/interceptors/logging.interceptor.d.ts +0 -2
- package/dist/utils/rest/interceptors/logging.interceptor.js +0 -17
- package/dist/utils/rest/interceptors/response.interceptor.d.ts +0 -2
- package/dist/utils/rest/interceptors/response.interceptor.js +0 -25
- package/dist/utils/rest/interceptors/rest-interceptor.js +0 -21
- package/dist/utils/rest/rest-client.js +0 -62
- package/dist/utils/rest/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/error-handling.js +0 -119
- package/dist/utils/zod.utils.js +0 -25
- /package/{dist → src}/assets/icons/AlignCenter.d.ts +0 -0
- /package/{dist → src}/assets/icons/AlignLeft.d.ts +0 -0
- /package/{dist → src}/assets/icons/AlignLeftRight.d.ts +0 -0
- /package/{dist → src}/assets/icons/AlignRight.d.ts +0 -0
- /package/{dist → src}/assets/icons/ArrowDropDown.d.ts +0 -0
- /package/{dist → src}/assets/icons/ArrowDropUp.d.ts +0 -0
- /package/{dist → src}/assets/icons/ArrowLeft.d.ts +0 -0
- /package/{dist → src}/assets/icons/ArrowRight.d.ts +0 -0
- /package/{dist → src}/assets/icons/Bold.d.ts +0 -0
- /package/{dist → src}/assets/icons/BulletedList.d.ts +0 -0
- /package/{dist → src}/assets/icons/Calendar.d.ts +0 -0
- /package/{dist → src}/assets/icons/Check.d.ts +0 -0
- /package/{dist → src}/assets/icons/CheckCircle.d.ts +0 -0
- /package/{dist → src}/assets/icons/CheckboxCheckmark.d.ts +0 -0
- /package/{dist → src}/assets/icons/CheckboxIndeterminate.d.ts +0 -0
- /package/{dist → src}/assets/icons/ChevronDown.d.ts +0 -0
- /package/{dist → src}/assets/icons/ChevronLeft.d.ts +0 -0
- /package/{dist → src}/assets/icons/ChevronRight.d.ts +0 -0
- /package/{dist → src}/assets/icons/ChevronUp.d.ts +0 -0
- /package/{dist → src}/assets/icons/ChevronsLeft.d.ts +0 -0
- /package/{dist → src}/assets/icons/ChevronsRight.d.ts +0 -0
- /package/{dist → src}/assets/icons/Clock.d.ts +0 -0
- /package/{dist → src}/assets/icons/Close.d.ts +0 -0
- /package/{dist → src}/assets/icons/DateTime.d.ts +0 -0
- /package/{dist → src}/assets/icons/Drag.d.ts +0 -0
- /package/{dist → src}/assets/icons/File.d.ts +0 -0
- /package/{dist → src}/assets/icons/Highlight.d.ts +0 -0
- /package/{dist → src}/assets/icons/HighlightOn.d.ts +0 -0
- /package/{dist → src}/assets/icons/Info.d.ts +0 -0
- /package/{dist → src}/assets/icons/Italic.d.ts +0 -0
- /package/{dist → src}/assets/icons/Link.d.ts +0 -0
- /package/{dist → src}/assets/icons/Menu.d.ts +0 -0
- /package/{dist → src}/assets/icons/NumberedList.d.ts +0 -0
- /package/{dist → src}/assets/icons/PointerHorizontal.d.ts +0 -0
- /package/{dist → src}/assets/icons/PointerVertical.d.ts +0 -0
- /package/{dist → src}/assets/icons/Send.d.ts +0 -0
- /package/{dist → src}/assets/icons/Strikethrough.d.ts +0 -0
- /package/{dist → src}/assets/icons/TextColor.d.ts +0 -0
- /package/{dist → src}/assets/icons/Today.d.ts +0 -0
- /package/{dist → src}/assets/icons/Underlined.d.ts +0 -0
- /package/{dist → src}/assets/icons/Upload.d.ts +0 -0
- /package/{dist → src}/assets/icons/View.d.ts +0 -0
- /package/{dist → src}/assets/icons/ViewOff.d.ts +0 -0
- /package/{dist/assets/icons/Warningfilled.d.ts → src/assets/icons/WarningFilled.d.ts} +0 -0
- /package/{dist → src}/components/Menu/Menu.d.ts +0 -0
- /package/{dist → src}/components/Menu/MenuDesktop.d.ts +0 -0
- /package/{dist → src}/components/Menu/MenuItem.d.ts +0 -0
- /package/{dist → src}/components/Menu/MenuMobile.d.ts +0 -0
- /package/{dist → src}/components/Menu/MenuPopover.d.ts +0 -0
- /package/{dist → src}/components/buttons/Button/Button.d.ts +0 -0
- /package/{dist → src}/components/buttons/Button/button.cva.d.ts +0 -0
- /package/{dist → src}/components/buttons/IconButton/IconButton.d.ts +0 -0
- /package/{dist → src}/components/buttons/InlineIconButton/InlineIconButton.d.ts +0 -0
- /package/{dist → src}/components/buttons/PillButton/PillButton.d.ts +0 -0
- /package/{dist → src}/components/buttons/PillButton/pillButton.cva.d.ts +0 -0
- /package/{dist → src}/components/buttons/SplitButton/SplitButton.d.ts +0 -0
- /package/{dist → src}/components/buttons/TextButton/TextButton.d.ts +0 -0
- /package/{dist → src}/components/buttons/ToggleButton/ToggleButton.d.ts +0 -0
- /package/{dist → src}/components/buttons/shared/ButtonContent.d.ts +0 -0
- /package/{dist → src}/components/buttons/shared/buttonContent.cva.d.ts +0 -0
- /package/{dist → src}/components/inputs/Checkbox/Checkbox.d.ts +0 -0
- /package/{dist → src}/components/inputs/Checkbox/CheckboxCheckmark.d.ts +0 -0
- /package/{dist → src}/components/inputs/Checkbox/checkbox.cva.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/DatePicker/DatePicker.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/TimePicker/TimePicker.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/Calendar.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/CalendarCell.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/CalendarGrid.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/CalendarHeader.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/CalendarSelectHeader.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/DateField.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/DatePickerInput.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/DateTimeDialog.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/DateTimeDialogFooter.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/MonthPicker.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/RangeCalendar.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/TimeField.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/TimePickerForm.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/TimePickerInput.d.ts +0 -0
- /package/{dist → src}/components/inputs/DateTime/shared/YearPicker.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/FileUpload.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/FileUploadContainer.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/InputUpload.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/fileUpload.types.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/index.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/inputUpload.types.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/FileCard.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/FileCardList.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/FileProgressBar.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/FileUploadContent.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/FileUploadContentEmpty.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/FileUploadContentError.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/FileUploadContentFilled.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/FileUploadContentLoading.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/InputUploadContent.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/InputUploadFilled.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/fileUpload.cva.d.ts +0 -0
- /package/{dist → src}/components/inputs/File/shared/inputUploadButton.cva.d.ts +0 -0
- /package/{dist → src}/components/inputs/FormField/FormField.d.ts +0 -0
- /package/{dist → src}/components/inputs/FormField/FormFieldError.d.ts +0 -0
- /package/{dist → src}/components/inputs/FormField/FormFieldHeader.d.ts +0 -0
- /package/{dist → src}/components/inputs/FormField/FormFieldHeaderClose.d.ts +0 -0
- /package/{dist → src}/components/inputs/Input/NumberInput/NumberInput.d.ts +0 -0
- /package/{dist → src}/components/inputs/Input/PasswordInput/PasswordInput.d.ts +0 -0
- /package/{dist → src}/components/inputs/Input/TextArea/TextArea.d.ts +0 -0
- /package/{dist → src}/components/inputs/Input/shared/InputContent.d.ts +0 -0
- /package/{dist → src}/components/inputs/Inputs/Form.d.ts +0 -0
- /package/{dist → src}/components/inputs/Inputs/InputItem.d.ts +0 -0
- /package/{dist → src}/components/inputs/Inputs/Inputs.d.ts +0 -0
- /package/{dist → src}/components/inputs/RadioGroup/RadioGroup.d.ts +0 -0
- /package/{dist → src}/components/inputs/RadioGroup/radio.cva.d.ts +0 -0
- /package/{dist → src}/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +0 -0
- /package/{dist → src}/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +0 -0
- /package/{dist → src}/components/inputs/Selection/Select/Select.d.ts +0 -0
- /package/{dist → src}/components/inputs/Selection/shared/SelectDesktop.d.ts +0 -0
- /package/{dist → src}/components/inputs/Selection/shared/SelectListBoxItem.d.ts +0 -0
- /package/{dist → src}/components/inputs/Selection/shared/SelectListBoxItemSelectAll.d.ts +0 -0
- /package/{dist → src}/components/inputs/Selection/shared/SelectListBoxLoadingItem.d.ts +0 -0
- /package/{dist → src}/components/inputs/Selection/shared/SelectListBoxSelectionBar.d.ts +0 -0
- /package/{dist → src}/components/inputs/Selection/shared/SelectMobile.d.ts +0 -0
- /package/{dist → src}/components/inputs/Selection/shared/select.context.d.ts +0 -0
- /package/{dist → src}/components/inputs/Selection/shared/useSelectItems.d.ts +0 -0
- /package/{dist → src}/components/inputs/Slider/Slider.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/TextEditor.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/Toolbar/ColorPicker.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/Toolbar/HyperlinkAction.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/Toolbar/TextAlignSelect.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/Toolbar/TextColorSelect.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/Toolbar/TextEditorToolbar.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/Toolbar/TextHighlightSelect.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/Toolbar/TextListActions.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/Toolbar/TextMarksActions.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/Toolbar/TextStyleSelect.d.ts +0 -0
- /package/{dist → src}/components/inputs/TextEditor/textEditor.types.d.ts +0 -0
- /package/{dist → src}/components/inputs/Toggle/Toggle.d.ts +0 -0
- /package/{dist → src}/components/inputs/Toggle/toggle.cva.d.ts +0 -0
- /package/{dist → src}/components/inputs/shared/CheckContent.d.ts +0 -0
- /package/{dist → src}/components/inputs/shared/form.types.d.ts +0 -0
- /package/{dist → src}/components/inputs/shared/input.cva.d.ts +0 -0
- /package/{dist → src}/components/inputs/shared/label.cva.d.ts +0 -0
- /package/{dist → src}/components/outline.clsx.d.ts +0 -0
- /package/{dist → src}/components/overlays/ActionModal/ActionModal.d.ts +0 -0
- /package/{dist → src}/components/overlays/BottomSheet/BottomSheet.d.ts +0 -0
- /package/{dist → src}/components/overlays/Drawer/Drawer.d.ts +0 -0
- /package/{dist → src}/components/overlays/Modal/Modal.d.ts +0 -0
- /package/{dist → src}/components/overlays/Modal/modal.cva.d.ts +0 -0
- /package/{dist → src}/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +0 -0
- /package/{dist → src}/components/overlays/Tooltip/TooltipEllipsis.d.ts +0 -0
- /package/{dist → src}/components/segment/Segment.d.ts +0 -0
- /package/{dist → src}/components/segment/SegmentItem.d.ts +0 -0
- /package/{dist → src}/components/segment/segment.types.d.ts +0 -0
- /package/{dist → src}/components/shared/pagination/Pagination.d.ts +0 -0
- /package/{dist → src}/components/shared/pagination/PaginationList.d.ts +0 -0
- /package/{dist → src}/components/shared/pagination/minWidth.cva.d.ts +0 -0
- /package/{dist → src}/components/status/Alert/Alert.d.ts +0 -0
- /package/{dist → src}/components/status/Alert/alert.cva.d.ts +0 -0
- /package/{dist → src}/components/status/Loader/Loader.d.ts +0 -0
- /package/{dist → src}/components/status/Loader/loader.cva.d.ts +0 -0
- /package/{dist → src}/components/status/Toast/Toast.d.ts +0 -0
- /package/{dist → src}/components/status/Toast/toast.cva.d.ts +0 -0
- /package/{dist → src}/components/status/Toast/useToast.d.ts +0 -0
- /package/{dist → src}/components/status/shared/status.cva.d.ts +0 -0
- /package/{dist → src}/components/table/CellText.d.ts +0 -0
- /package/{dist → src}/components/table/ColumnConfig.d.ts +0 -0
- /package/{dist → src}/components/table/HeaderText.d.ts +0 -0
- /package/{dist → src}/components/table/InfiniteTable.d.ts +0 -0
- /package/{dist → src}/components/table/PaginatedTable.d.ts +0 -0
- /package/{dist → src}/components/table/Table.d.ts +0 -0
- /package/{dist → src}/components/text/Link/Link.d.ts +0 -0
- /package/{dist → src}/components/text/Link/link.cva.d.ts +0 -0
- /package/{dist → src}/components/text/Tag/Tag.d.ts +0 -0
- /package/{dist → src}/components/text/Tag/tag.cva.d.ts +0 -0
- /package/{dist → src}/components/text/Typography/Typography.d.ts +0 -0
- /package/{dist → src}/components/text/Typography/typography.cva.d.ts +0 -0
- /package/{dist → src}/config/confirmation.context.d.ts +0 -0
- /package/{dist → src}/config/i18n.d.ts +0 -0
- /package/{dist → src}/config/router.context.d.ts +0 -0
- /package/{dist → src}/helpers/dynamicColumns.d.ts +0 -0
- /package/{dist → src}/hooks/useAutosave.d.ts +0 -0
- /package/{dist → src}/hooks/useBreakpoint.d.ts +0 -0
- /package/{dist → src}/hooks/useDebounceCallback.d.ts +0 -0
- /package/{dist → src}/hooks/useDeepCompare.d.ts +0 -0
- /package/{dist → src}/hooks/useFilters.d.ts +0 -0
- /package/{dist → src}/hooks/useForm.d.ts +0 -0
- /package/{dist → src}/hooks/useFormAutosave.d.ts +0 -0
- /package/{dist → src}/hooks/useIntersectionObserver.d.ts +0 -0
- /package/{dist → src}/hooks/useLocalStorage.d.ts +0 -0
- /package/{dist → src}/hooks/useLongPressRepeat.d.ts +0 -0
- /package/{dist → src}/hooks/usePagination.d.ts +0 -0
- /package/{dist → src}/hooks/useScrollableListBox.d.ts +0 -0
- /package/{dist → src}/hooks/useSorting.d.ts +0 -0
- /package/{dist → src}/hooks/useStateAndRef.d.ts +0 -0
- /package/{dist → src}/hooks/useTableColumnConfig.d.ts +0 -0
- /package/{dist → src}/hooks/useTableNav.d.ts +0 -0
- /package/{dist → src}/hooks/useTranslationMemo.d.ts +0 -0
- /package/{dist → src}/types/common.d.ts +0 -0
- /package/{dist → src}/types/react-query.d.ts +0 -0
- /package/{dist → src}/utils/array.utils.d.ts +0 -0
- /package/{dist → src}/utils/array.utils.spec.d.ts +0 -0
- /package/{dist → src}/utils/compoundMapper.d.ts +0 -0
- /package/{dist → src}/utils/compoundMapper.spec.d.ts +0 -0
- /package/{dist → src}/utils/date-time.utils.d.ts +0 -0
- /package/{dist → src}/utils/date-time.utils.spec.d.ts +0 -0
- /package/{dist → src}/utils/date.utils.d.ts +0 -0
- /package/{dist → src}/utils/date.utils.spec.d.ts +0 -0
- /package/{dist → src}/utils/dom.utils.d.ts +0 -0
- /package/{dist → src}/utils/file.utils.d.ts +0 -0
- /package/{dist → src}/utils/isEqual.d.ts +0 -0
- /package/{dist → src}/utils/logger.d.ts +0 -0
- /package/{dist → src}/utils/object.utils.d.ts +0 -0
- /package/{dist → src}/utils/queries.utils.d.ts +0 -0
- /package/{dist/utils/rest → src/utils}/rest.utils.d.ts +0 -0
- /package/{dist → src}/utils/routing.utils.d.ts +0 -0
- /package/{dist → src}/utils/string.utils.d.ts +0 -0
- /package/{dist → src}/utils/vendor/error-handling.d.ts +0 -0
- /package/{dist/utils/rest/interceptors → src/utils/vendor}/rest-interceptor.d.ts +0 -0
- /package/{dist/styles → styles}/editor.css +0 -0
- /package/{dist/styles → styles}/index.css +0 -0
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useState, useCallback, useMemo, use } from "react";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
import { ActionModal } from "../components/overlays/ActionModal/ActionModal.js";
|
|
5
|
-
import { ns } from "./i18n.js";
|
|
6
|
-
var Confirmation;
|
|
7
|
-
((Confirmation2) => {
|
|
8
|
-
const DEFAULT_STATE = {
|
|
9
|
-
heading: "",
|
|
10
|
-
description: "",
|
|
11
|
-
isOpen: false,
|
|
12
|
-
primaryAction: {
|
|
13
|
-
label: "",
|
|
14
|
-
onPress: () => {
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
secondaryAction: {
|
|
18
|
-
label: "",
|
|
19
|
-
onPress: () => {
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const Context = createContext(null);
|
|
24
|
-
Confirmation2.Provider = ({ children }) => {
|
|
25
|
-
const [state, setState] = useState(DEFAULT_STATE);
|
|
26
|
-
const { t } = useTranslation(ns);
|
|
27
|
-
const onCancel = () => setState(DEFAULT_STATE);
|
|
28
|
-
const confirm = useCallback(
|
|
29
|
-
async ({
|
|
30
|
-
heading,
|
|
31
|
-
description,
|
|
32
|
-
buttonSize,
|
|
33
|
-
textAlign,
|
|
34
|
-
modalClassName,
|
|
35
|
-
cancelLabel = t(($) => $.ui.confirmation.cancel),
|
|
36
|
-
confirmLabel = t(($) => $.ui.confirmation.confirm),
|
|
37
|
-
confirmVariant,
|
|
38
|
-
confirmColor,
|
|
39
|
-
cancelVariant,
|
|
40
|
-
cancelColor
|
|
41
|
-
}) => {
|
|
42
|
-
return new Promise((resolve) => {
|
|
43
|
-
setState({
|
|
44
|
-
heading,
|
|
45
|
-
description,
|
|
46
|
-
buttonSize,
|
|
47
|
-
textAlign,
|
|
48
|
-
modalClassName,
|
|
49
|
-
primaryAction: {
|
|
50
|
-
label: confirmLabel,
|
|
51
|
-
onPress() {
|
|
52
|
-
setState({
|
|
53
|
-
...state,
|
|
54
|
-
isOpen: false,
|
|
55
|
-
heading: "",
|
|
56
|
-
description: ""
|
|
57
|
-
});
|
|
58
|
-
resolve(true);
|
|
59
|
-
},
|
|
60
|
-
variant: confirmVariant,
|
|
61
|
-
color: confirmColor
|
|
62
|
-
},
|
|
63
|
-
secondaryAction: {
|
|
64
|
-
label: cancelLabel,
|
|
65
|
-
onPress() {
|
|
66
|
-
onCancel();
|
|
67
|
-
resolve(false);
|
|
68
|
-
},
|
|
69
|
-
variant: cancelVariant,
|
|
70
|
-
color: cancelColor
|
|
71
|
-
},
|
|
72
|
-
isOpen: !state.isOpen
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
[state, t]
|
|
77
|
-
);
|
|
78
|
-
const value = useMemo(
|
|
79
|
-
() => ({
|
|
80
|
-
confirm
|
|
81
|
-
}),
|
|
82
|
-
[confirm]
|
|
83
|
-
);
|
|
84
|
-
return /* @__PURE__ */ jsxs(Context.Provider, { value, children: [
|
|
85
|
-
/* @__PURE__ */ jsx(
|
|
86
|
-
ActionModal,
|
|
87
|
-
{
|
|
88
|
-
...state,
|
|
89
|
-
onClose: state.secondaryAction?.onPress ?? onCancel,
|
|
90
|
-
primaryAction: state.primaryAction,
|
|
91
|
-
secondaryAction: state.secondaryAction
|
|
92
|
-
}
|
|
93
|
-
),
|
|
94
|
-
children
|
|
95
|
-
] });
|
|
96
|
-
};
|
|
97
|
-
Confirmation2.useConfirmation = () => {
|
|
98
|
-
const context = use(Context);
|
|
99
|
-
if (!context) {
|
|
100
|
-
throw new Error("Confirmation.useConfirmation must be used within a Confirmation.Provider");
|
|
101
|
-
}
|
|
102
|
-
return context;
|
|
103
|
-
};
|
|
104
|
-
})(Confirmation || (Confirmation = {}));
|
|
105
|
-
export {
|
|
106
|
-
Confirmation
|
|
107
|
-
};
|
package/dist/config/i18n.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import translationEN from "../assets/locales/en/translation.json.js";
|
|
2
|
-
import translationSL from "../assets/locales/sl/translation.json.js";
|
|
3
|
-
const ns = "ui";
|
|
4
|
-
const resources = {
|
|
5
|
-
en: {
|
|
6
|
-
[ns]: translationEN
|
|
7
|
-
},
|
|
8
|
-
sl: {
|
|
9
|
-
[ns]: translationSL
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
ns,
|
|
14
|
-
resources
|
|
15
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, use } from "react";
|
|
3
|
-
import { RouterProvider } from "react-aria";
|
|
4
|
-
var UIRouter;
|
|
5
|
-
((UIRouter2) => {
|
|
6
|
-
const UIRouterContext = createContext(null);
|
|
7
|
-
UIRouter2.UIRouterProvider = ({
|
|
8
|
-
children,
|
|
9
|
-
pathname,
|
|
10
|
-
push,
|
|
11
|
-
query,
|
|
12
|
-
replace
|
|
13
|
-
}) => {
|
|
14
|
-
const searchParams = new URLSearchParams();
|
|
15
|
-
for (const [k, v] of Object.entries(query)) {
|
|
16
|
-
if (Array.isArray(v)) {
|
|
17
|
-
for (const item of v) {
|
|
18
|
-
searchParams.append(k, item);
|
|
19
|
-
}
|
|
20
|
-
} else {
|
|
21
|
-
searchParams.set(k, v);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const value = {
|
|
25
|
-
searchParams,
|
|
26
|
-
pathname,
|
|
27
|
-
push,
|
|
28
|
-
query,
|
|
29
|
-
replace
|
|
30
|
-
};
|
|
31
|
-
return /* @__PURE__ */ jsx(UIRouterContext, { value, children: /* @__PURE__ */ jsx(RouterProvider, { navigate: (href) => push(href), children }) });
|
|
32
|
-
};
|
|
33
|
-
UIRouter2.useUIRouter = () => {
|
|
34
|
-
const context = use(UIRouterContext);
|
|
35
|
-
if (!context) {
|
|
36
|
-
throw new Error("useUIRouter must be used within a UIRouterContext");
|
|
37
|
-
}
|
|
38
|
-
return context;
|
|
39
|
-
};
|
|
40
|
-
})(UIRouter || (UIRouter = {}));
|
|
41
|
-
export {
|
|
42
|
-
UIRouter
|
|
43
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, use } from "react";
|
|
3
|
-
import { useDeepCompareMemo } from "../hooks/useDeepCompare.js";
|
|
4
|
-
import { ObjectUtils } from "../utils/object.utils.js";
|
|
5
|
-
var UIConfig;
|
|
6
|
-
((UIConfig2) => {
|
|
7
|
-
const DEFAULT_CONFIG = {
|
|
8
|
-
input: {
|
|
9
|
-
variant: "outlined",
|
|
10
|
-
as: "default",
|
|
11
|
-
size: "default",
|
|
12
|
-
isClearable: false,
|
|
13
|
-
hideLabel: false
|
|
14
|
-
},
|
|
15
|
-
numberInput: {
|
|
16
|
-
formatOptions: {
|
|
17
|
-
minimumFractionDigits: 0,
|
|
18
|
-
maximumFractionDigits: 3
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
radioGroup: {
|
|
22
|
-
variant: "default",
|
|
23
|
-
hideLabel: false
|
|
24
|
-
},
|
|
25
|
-
checkbox: {
|
|
26
|
-
variant: "default"
|
|
27
|
-
},
|
|
28
|
-
select: {
|
|
29
|
-
selectionMode: "single",
|
|
30
|
-
isSearchable: false
|
|
31
|
-
},
|
|
32
|
-
toggle: {
|
|
33
|
-
variant: "default"
|
|
34
|
-
},
|
|
35
|
-
slider: {
|
|
36
|
-
minValue: 0,
|
|
37
|
-
maxValue: 100
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const Context = createContext(DEFAULT_CONFIG);
|
|
41
|
-
UIConfig2.Provider = ({ config = {}, children }) => {
|
|
42
|
-
const parentConfig = use(Context) || DEFAULT_CONFIG;
|
|
43
|
-
const value = useDeepCompareMemo(() => {
|
|
44
|
-
return ObjectUtils.deepConditionalMerge(
|
|
45
|
-
parentConfig,
|
|
46
|
-
config,
|
|
47
|
-
(val) => val !== null && val !== void 0
|
|
48
|
-
);
|
|
49
|
-
}, [config, parentConfig]);
|
|
50
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
51
|
-
};
|
|
52
|
-
UIConfig2.useConfig = () => {
|
|
53
|
-
const context = use(Context);
|
|
54
|
-
if (!context) {
|
|
55
|
-
throw new Error("UIConfig.useConfig must be used within a UIConfig.Provider");
|
|
56
|
-
}
|
|
57
|
-
return context;
|
|
58
|
-
};
|
|
59
|
-
})(UIConfig || (UIConfig = {}));
|
|
60
|
-
export {
|
|
61
|
-
UIConfig
|
|
62
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, use } from "react";
|
|
3
|
-
var UIStyle;
|
|
4
|
-
((UIStyle2) => {
|
|
5
|
-
const Context = createContext(null);
|
|
6
|
-
UIStyle2.Provider = ({ children, config }) => {
|
|
7
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value: config, children });
|
|
8
|
-
};
|
|
9
|
-
UIStyle2.useConfig = () => {
|
|
10
|
-
const context = use(Context);
|
|
11
|
-
return context;
|
|
12
|
-
};
|
|
13
|
-
})(UIStyle || (UIStyle = {}));
|
|
14
|
-
export {
|
|
15
|
-
UIStyle
|
|
16
|
-
};
|
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
import i18next from "i18next";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { DateUtils } from "../utils/date.utils.js";
|
|
4
|
-
import { StringUtils } from "../utils/string.utils.js";
|
|
5
|
-
import { ZodUtils } from "../utils/zod.utils.js";
|
|
6
|
-
const DEFAULT_NAMESPACE = "dynamicColumns";
|
|
7
|
-
const FORMAT_MAP = {
|
|
8
|
-
datetime: (value) => DateUtils.formatDate(new Date(value)),
|
|
9
|
-
dateRange: (value) => {
|
|
10
|
-
const startDate = DateUtils.formatDate(new Date(value.start));
|
|
11
|
-
const endDate = DateUtils.formatDate(new Date(value.end));
|
|
12
|
-
return `${startDate} - ${endDate}`;
|
|
13
|
-
},
|
|
14
|
-
enum: (value) => StringUtils.capitalize(value),
|
|
15
|
-
number: (value) => value.toLocaleString(i18next.language),
|
|
16
|
-
string: (value) => String(value),
|
|
17
|
-
boolean: (value) => {
|
|
18
|
-
const key = `${DEFAULT_NAMESPACE}.${value ? "yes" : "no"}`;
|
|
19
|
-
if (i18next.exists(key)) {
|
|
20
|
-
return String(i18next.t(key));
|
|
21
|
-
}
|
|
22
|
-
return value ? "Yes" : "No";
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const ZOD_TYPE_FORMAT_MAP = [
|
|
26
|
-
[z.ZodEnum, FORMAT_MAP.enum],
|
|
27
|
-
[z.ZodNumber, FORMAT_MAP.number],
|
|
28
|
-
[z.ZodString, FORMAT_MAP.string],
|
|
29
|
-
[z.ZodBoolean, FORMAT_MAP.boolean],
|
|
30
|
-
[z.ZodISODateTime, FORMAT_MAP.datetime]
|
|
31
|
-
];
|
|
32
|
-
const configValueToColumnDef = (value) => {
|
|
33
|
-
if (typeof value === "function" || typeof value === "string") {
|
|
34
|
-
return {
|
|
35
|
-
cell: value
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
if (typeof value === "boolean" || value === void 0) {
|
|
39
|
-
return {};
|
|
40
|
-
}
|
|
41
|
-
return value;
|
|
42
|
-
};
|
|
43
|
-
const convertEntriesToColumnDefs = (entries) => {
|
|
44
|
-
return entries.map(([key, value]) => [key, configValueToColumnDef(value)]);
|
|
45
|
-
};
|
|
46
|
-
const customConfigValueToColumnDef = (value) => {
|
|
47
|
-
if (typeof value === "string") {
|
|
48
|
-
return {
|
|
49
|
-
accessorKey: value,
|
|
50
|
-
cell: value
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
if (typeof value === "function") {
|
|
54
|
-
return {
|
|
55
|
-
cell: value
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
return value;
|
|
59
|
-
};
|
|
60
|
-
const convertCustomEntriesToColumnDefs = (entries) => {
|
|
61
|
-
return entries.map(([key, value]) => [key, customConfigValueToColumnDef(value)]);
|
|
62
|
-
};
|
|
63
|
-
const excludeEntries = (entries) => {
|
|
64
|
-
return entries.filter(([, value]) => value !== false && value !== void 0);
|
|
65
|
-
};
|
|
66
|
-
const sortColumns = (columns, orderKeys) => {
|
|
67
|
-
if (!orderKeys) {
|
|
68
|
-
return columns;
|
|
69
|
-
}
|
|
70
|
-
const wildcardIndex = orderKeys.indexOf("*");
|
|
71
|
-
if (wildcardIndex === -1) {
|
|
72
|
-
return columns.sort((columnA, columnB) => {
|
|
73
|
-
const idA = columnA.id;
|
|
74
|
-
const idB = columnB.id;
|
|
75
|
-
const orderMap = new Map(orderKeys.map((key, index) => [String(key), index]));
|
|
76
|
-
const orderA = orderMap.get(String(idA));
|
|
77
|
-
const orderB = orderMap.get(String(idB));
|
|
78
|
-
if (orderA !== void 0 && orderB !== void 0) {
|
|
79
|
-
return orderA - orderB;
|
|
80
|
-
}
|
|
81
|
-
if (orderA !== void 0 && orderB === void 0) {
|
|
82
|
-
return -1;
|
|
83
|
-
}
|
|
84
|
-
if (orderA === void 0 && orderB !== void 0) {
|
|
85
|
-
return 1;
|
|
86
|
-
}
|
|
87
|
-
return 0;
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
const beforeWildcard = orderKeys.slice(0, wildcardIndex);
|
|
91
|
-
const afterWildcard = orderKeys.slice(wildcardIndex + 1);
|
|
92
|
-
const beforeMap = new Map(beforeWildcard.map((key, index) => [String(key), index]));
|
|
93
|
-
const afterMap = new Map(afterWildcard.map((key, index) => [String(key), index]));
|
|
94
|
-
const before = [];
|
|
95
|
-
const middle = [];
|
|
96
|
-
const after = [];
|
|
97
|
-
columns.forEach((column) => {
|
|
98
|
-
const id = String(column.id);
|
|
99
|
-
if (beforeMap.has(id)) {
|
|
100
|
-
before.push(column);
|
|
101
|
-
} else if (afterMap.has(id)) {
|
|
102
|
-
after.push(column);
|
|
103
|
-
} else {
|
|
104
|
-
middle.push(column);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
before.sort((a, b) => beforeMap.get(String(a.id)) - beforeMap.get(String(b.id)));
|
|
108
|
-
after.sort((a, b) => afterMap.get(String(a.id)) - afterMap.get(String(b.id)));
|
|
109
|
-
return [...before, ...middle, ...after];
|
|
110
|
-
};
|
|
111
|
-
const formatValueByType = (value, schemaType) => {
|
|
112
|
-
if (value === null || value === void 0) {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
if (ZodUtils.isDateRange(schemaType)) {
|
|
116
|
-
return FORMAT_MAP.dateRange(value);
|
|
117
|
-
}
|
|
118
|
-
const unwrappedType = ZodUtils.unwrapZodType(schemaType);
|
|
119
|
-
if (unwrappedType instanceof z.ZodArray) {
|
|
120
|
-
if (!Array.isArray(value)) {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
const elementType = unwrappedType.element;
|
|
124
|
-
const formattedElements = value.map((element) => formatValueByType(element, elementType));
|
|
125
|
-
return formattedElements.join(", ");
|
|
126
|
-
}
|
|
127
|
-
const formatFunction = ZOD_TYPE_FORMAT_MAP.find(([zodType]) => unwrappedType instanceof zodType)?.[1];
|
|
128
|
-
if (formatFunction) {
|
|
129
|
-
return formatFunction(value);
|
|
130
|
-
}
|
|
131
|
-
return String(value);
|
|
132
|
-
};
|
|
133
|
-
const getNestedValue = (obj, path) => {
|
|
134
|
-
return path.split(".").reduce((current, key) => {
|
|
135
|
-
return current && typeof current === "object" ? current[key] : void 0;
|
|
136
|
-
}, obj);
|
|
137
|
-
};
|
|
138
|
-
const getKeyType = (schema, key) => {
|
|
139
|
-
const pathParts = key.split(".");
|
|
140
|
-
let currentType = schema.shape[pathParts[0]];
|
|
141
|
-
for (let i = 1; i < pathParts.length; i++) {
|
|
142
|
-
if (currentType instanceof z.ZodObject) {
|
|
143
|
-
currentType = currentType.shape[pathParts[i]];
|
|
144
|
-
} else {
|
|
145
|
-
currentType = schema.shape[key];
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return currentType;
|
|
150
|
-
};
|
|
151
|
-
const getCellFunction = (schema, schemaKey, columnDef, options) => {
|
|
152
|
-
const { cell } = columnDef;
|
|
153
|
-
if (typeof cell === "function") {
|
|
154
|
-
return cell;
|
|
155
|
-
}
|
|
156
|
-
return ({ data }) => {
|
|
157
|
-
const isCellKeyString = typeof cell === "string";
|
|
158
|
-
const key = isCellKeyString ? cell : schemaKey;
|
|
159
|
-
const value = getNestedValue(data, key);
|
|
160
|
-
const keyType = getKeyType(schema, key);
|
|
161
|
-
const shouldFormat = !options.disableFormatting?.includes(key);
|
|
162
|
-
const formattedValue = shouldFormat ? formatValueByType(value, keyType) : value;
|
|
163
|
-
let finalValue = formattedValue;
|
|
164
|
-
if (options.emptyValue && !finalValue) {
|
|
165
|
-
finalValue = options.emptyValue;
|
|
166
|
-
}
|
|
167
|
-
if (options.globalWrapper) {
|
|
168
|
-
return options.globalWrapper(finalValue);
|
|
169
|
-
}
|
|
170
|
-
return finalValue;
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
const normalizeSortable = (sortable) => {
|
|
174
|
-
if (!sortable) {
|
|
175
|
-
return void 0;
|
|
176
|
-
}
|
|
177
|
-
if (Array.isArray(sortable)) {
|
|
178
|
-
return sortable;
|
|
179
|
-
}
|
|
180
|
-
if (sortable instanceof z.ZodEnum) {
|
|
181
|
-
return Object.values(sortable.enum);
|
|
182
|
-
}
|
|
183
|
-
return void 0;
|
|
184
|
-
};
|
|
185
|
-
const getDefaultColumnHeader = (key, options) => {
|
|
186
|
-
const namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
187
|
-
const localeKey = `${namespace}.${key}`;
|
|
188
|
-
if (i18next.exists(localeKey)) {
|
|
189
|
-
return String(i18next.t(localeKey));
|
|
190
|
-
}
|
|
191
|
-
return StringUtils.capitalize(key);
|
|
192
|
-
};
|
|
193
|
-
const overridePresetColumnsHeaders = (presetColumns, options) => {
|
|
194
|
-
const namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
195
|
-
return presetColumns.map((columnDef) => {
|
|
196
|
-
const localeKey = `${namespace}.${columnDef.id}`;
|
|
197
|
-
const header = i18next.exists(localeKey) ? i18next.t(localeKey) : columnDef.header;
|
|
198
|
-
return {
|
|
199
|
-
...columnDef,
|
|
200
|
-
header: typeof header === "string" ? header : columnDef.header
|
|
201
|
-
};
|
|
202
|
-
});
|
|
203
|
-
};
|
|
204
|
-
const populateColumnDef = (schema, key, columnDef, options, sortableKeys) => {
|
|
205
|
-
const id = columnDef.id ?? key;
|
|
206
|
-
const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
|
|
207
|
-
const header = columnDef.header ?? getDefaultColumnHeader(key, options);
|
|
208
|
-
const cell = getCellFunction(schema, key, columnDef, options);
|
|
209
|
-
return {
|
|
210
|
-
...columnDef,
|
|
211
|
-
id,
|
|
212
|
-
accessorKey: key,
|
|
213
|
-
meta: {
|
|
214
|
-
width: "flex-1",
|
|
215
|
-
...options.globalMeta,
|
|
216
|
-
...columnDef.meta
|
|
217
|
-
},
|
|
218
|
-
header,
|
|
219
|
-
enableSorting,
|
|
220
|
-
cell
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
const populateCustomColumnDef = (schema, key, columnDef, options, sortableKeys) => {
|
|
224
|
-
const id = columnDef.id ?? key;
|
|
225
|
-
const accessorKey = columnDef.accessorKey ?? id;
|
|
226
|
-
const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
|
|
227
|
-
const header = columnDef.header ?? getDefaultColumnHeader(key, options);
|
|
228
|
-
const cell = getCellFunction(schema, key, columnDef, options);
|
|
229
|
-
return {
|
|
230
|
-
...columnDef,
|
|
231
|
-
id,
|
|
232
|
-
accessorKey,
|
|
233
|
-
meta: {
|
|
234
|
-
width: "flex-1",
|
|
235
|
-
...options.globalMeta,
|
|
236
|
-
...columnDef.meta
|
|
237
|
-
},
|
|
238
|
-
header,
|
|
239
|
-
enableSorting,
|
|
240
|
-
cell
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
const addMissingSchemaFields = (schema, existingColumns, options, sortableKeys) => {
|
|
244
|
-
const schemaFields = getAllSchemaKeys(schema);
|
|
245
|
-
const definedFields = new Set(existingColumns.map((col) => col.id));
|
|
246
|
-
const missingFields = schemaFields.filter((field) => !definedFields.has(field));
|
|
247
|
-
const additionalColumns = missingFields.map((field) => {
|
|
248
|
-
return populateColumnDef(schema, field, {}, options, sortableKeys);
|
|
249
|
-
});
|
|
250
|
-
return [...existingColumns, ...additionalColumns];
|
|
251
|
-
};
|
|
252
|
-
const removeOverriddenPresetColumns = (presetColumns, options) => {
|
|
253
|
-
if (presetColumns.length === 0) {
|
|
254
|
-
return presetColumns;
|
|
255
|
-
}
|
|
256
|
-
const usedColumnsIds = Object.entries(options.columns ?? {}).map(([key, value]) => {
|
|
257
|
-
const columnDef = value;
|
|
258
|
-
return columnDef.id ?? key;
|
|
259
|
-
});
|
|
260
|
-
const usedCustomColumnsIds = Object.entries(options.customColumns ?? {}).map(([key, value]) => {
|
|
261
|
-
const columnDef = value;
|
|
262
|
-
return columnDef.id ?? key;
|
|
263
|
-
});
|
|
264
|
-
const usedIds = [...usedColumnsIds, ...usedCustomColumnsIds];
|
|
265
|
-
return presetColumns.filter((column) => {
|
|
266
|
-
if (!column.id) {
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
269
|
-
return !usedIds.includes(column.id);
|
|
270
|
-
});
|
|
271
|
-
};
|
|
272
|
-
const getAllSchemaKeys = (schema) => {
|
|
273
|
-
const keys = [];
|
|
274
|
-
const { shape } = schema;
|
|
275
|
-
const traverse = (obj, prefix = "") => {
|
|
276
|
-
Object.entries(obj).forEach(([key, value]) => {
|
|
277
|
-
const currentPath = prefix ? `${prefix}.${key}` : key;
|
|
278
|
-
keys.push(currentPath);
|
|
279
|
-
if (value instanceof z.ZodObject) {
|
|
280
|
-
traverse(value.shape, currentPath);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
};
|
|
284
|
-
traverse(shape);
|
|
285
|
-
return keys;
|
|
286
|
-
};
|
|
287
|
-
const validateCustomColumnKeys = (schema, customColumnKeys) => {
|
|
288
|
-
const schemaKeys = getAllSchemaKeys(schema);
|
|
289
|
-
const invalidCustomColumnKeys = customColumnKeys.filter(
|
|
290
|
-
(key) => schemaKeys.includes(key)
|
|
291
|
-
);
|
|
292
|
-
if (invalidCustomColumnKeys.length > 0) {
|
|
293
|
-
throw new Error(
|
|
294
|
-
`Invalid custom column keys: [${invalidCustomColumnKeys.join(", ")}]. Custom column keys cannot be part of the schema. Define these columns in the "columns" property instead.`
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
const validateOptionKeyArray = (usedKeys, optionKeys, optionName) => {
|
|
299
|
-
if (!optionKeys) {
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
const extraUnusedKeys = optionKeys.filter((key) => !usedKeys.has(key));
|
|
303
|
-
if (extraUnusedKeys.length > 0) {
|
|
304
|
-
throw new Error(
|
|
305
|
-
`Found unnecessary keys in "${optionName}": [${extraUnusedKeys.join(", ")}].
|
|
306
|
-
|
|
307
|
-
All available options are: [${Array.from(usedKeys).join(", ")}].`
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
const validateParams = (schema, presetColumns, options) => {
|
|
312
|
-
const { columns, customColumns, sortable, order, disableFormatting, includeAll } = options;
|
|
313
|
-
const columnKeys = Object.keys(columns ?? {});
|
|
314
|
-
const customColumnKeys = customColumns ? Object.keys(customColumns) : [];
|
|
315
|
-
const usedKeys = /* @__PURE__ */ new Set([...columnKeys, ...customColumnKeys]);
|
|
316
|
-
const presetKeys = presetColumns.map((column) => column.id).filter((id) => id !== void 0);
|
|
317
|
-
const schemaKeys = includeAll ? getAllSchemaKeys(schema) : [];
|
|
318
|
-
const allKeys = /* @__PURE__ */ new Set([...presetKeys, ...usedKeys, ...schemaKeys, "*"]);
|
|
319
|
-
if (customColumns) {
|
|
320
|
-
validateCustomColumnKeys(schema, customColumnKeys);
|
|
321
|
-
}
|
|
322
|
-
if (Array.isArray(sortable)) {
|
|
323
|
-
validateOptionKeyArray(usedKeys, sortable, "sortable");
|
|
324
|
-
}
|
|
325
|
-
validateOptionKeyArray(allKeys, order, "order");
|
|
326
|
-
validateOptionKeyArray(usedKeys, disableFormatting, "disableFormatting");
|
|
327
|
-
};
|
|
328
|
-
const dynamicColumns = ({
|
|
329
|
-
schema,
|
|
330
|
-
preset = [],
|
|
331
|
-
options
|
|
332
|
-
}) => {
|
|
333
|
-
validateParams(schema, preset, options);
|
|
334
|
-
const sortableKeys = normalizeSortable(options.sortable);
|
|
335
|
-
let entries = Object.entries(options.columns ?? {});
|
|
336
|
-
entries = excludeEntries(entries);
|
|
337
|
-
entries = convertEntriesToColumnDefs(entries);
|
|
338
|
-
const columns = entries.map(([key, value]) => {
|
|
339
|
-
const columnDef = value;
|
|
340
|
-
return populateColumnDef(schema, key, columnDef, options, sortableKeys);
|
|
341
|
-
});
|
|
342
|
-
let customEntries = Object.entries(options.customColumns ?? {});
|
|
343
|
-
customEntries = convertCustomEntriesToColumnDefs(customEntries);
|
|
344
|
-
const customColumns = customEntries.map(([key, value]) => {
|
|
345
|
-
const columnDef = value;
|
|
346
|
-
return populateCustomColumnDef(schema, key, columnDef, options, sortableKeys);
|
|
347
|
-
});
|
|
348
|
-
let presetColumns = removeOverriddenPresetColumns(preset, options);
|
|
349
|
-
if (options.overridePresetLocales) {
|
|
350
|
-
presetColumns = overridePresetColumnsHeaders(presetColumns, options);
|
|
351
|
-
}
|
|
352
|
-
const mergedColumns = [...presetColumns, ...columns, ...customColumns];
|
|
353
|
-
const allColumns = options.includeAll ? addMissingSchemaFields(schema, mergedColumns, options, sortableKeys) : mergedColumns;
|
|
354
|
-
return sortColumns(allColumns, options.order);
|
|
355
|
-
};
|
|
356
|
-
export {
|
|
357
|
-
dynamicColumns,
|
|
358
|
-
sortColumns
|
|
359
|
-
};
|