@povio/ui 2.1.13 → 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 +5 -1
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +5 -1
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +5 -1
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -0
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +3 -1
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +11 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +4 -1
- package/dist/components/inputs/File/fileUpload.types.d.ts +3 -0
- package/dist/components/inputs/File/inputUpload.types.d.ts +2 -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/uiConfig.context.d.ts +1 -1
- 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/hooks/useBreakpoint.d.ts +1 -1
- 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 -246
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +0 -684
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +0 -260
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +0 -233
- 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 -175
- 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 -115
- 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/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 -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 -68
- 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 -25
- 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
package/dist/utils/isEqual.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { ObjectUtils } from "./object.utils.js";
|
|
2
|
-
const isEqual = (a, b) => {
|
|
3
|
-
return eq(a, b);
|
|
4
|
-
};
|
|
5
|
-
const eq = (a, b, aStack, bStack) => {
|
|
6
|
-
if (a === b) {
|
|
7
|
-
return a !== 0 || 1 / a === 1 / b;
|
|
8
|
-
}
|
|
9
|
-
if (a == null || b == null) {
|
|
10
|
-
return a === b;
|
|
11
|
-
}
|
|
12
|
-
if (a !== a) {
|
|
13
|
-
return b !== b;
|
|
14
|
-
}
|
|
15
|
-
const type = typeof a;
|
|
16
|
-
if (type !== "function" && type !== "object" && typeof b !== "object") {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
return deepEq(a, b, aStack, bStack);
|
|
20
|
-
};
|
|
21
|
-
const deepEq = (a, b, aStack, bStack) => {
|
|
22
|
-
const className = toString.call(a);
|
|
23
|
-
if (className !== toString.call(b)) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
switch (className) {
|
|
27
|
-
// Strings, numbers, regular expressions, dates, and booleans are compared by value.
|
|
28
|
-
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
|
|
29
|
-
case "[object RegExp]":
|
|
30
|
-
case "[object String]":
|
|
31
|
-
return `${a}` === `${b}`;
|
|
32
|
-
case "[object Number]":
|
|
33
|
-
if (+a !== +a) {
|
|
34
|
-
return +b !== +b;
|
|
35
|
-
}
|
|
36
|
-
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
|
|
37
|
-
case "[object Date]":
|
|
38
|
-
case "[object Boolean]":
|
|
39
|
-
return +a === +b;
|
|
40
|
-
case "[object Symbol]":
|
|
41
|
-
return Symbol.prototype.valueOf.call(a) === Symbol.prototype.valueOf.call(b);
|
|
42
|
-
}
|
|
43
|
-
const areArrays = className === "[object Array]";
|
|
44
|
-
if (!areArrays) {
|
|
45
|
-
if (typeof a !== "object" || typeof b !== "object") {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
const aCtor = a.constructor;
|
|
49
|
-
const bCtor = b.constructor;
|
|
50
|
-
if (aCtor !== bCtor && !(ObjectUtils.isFunction(aCtor) && aCtor instanceof aCtor && ObjectUtils.isFunction(bCtor) && bCtor instanceof bCtor) && "constructor" in a && "constructor" in b) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
aStack = aStack || [];
|
|
55
|
-
bStack = bStack || [];
|
|
56
|
-
let { length } = aStack;
|
|
57
|
-
while (length--) {
|
|
58
|
-
if (aStack[length] === a) {
|
|
59
|
-
return bStack[length] === b;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
aStack.push(a);
|
|
63
|
-
bStack.push(b);
|
|
64
|
-
if (areArrays) {
|
|
65
|
-
length = a.length;
|
|
66
|
-
if (length !== b.length) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
while (length--) {
|
|
70
|
-
if (!eq(a[length], b[length], aStack, bStack)) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
const keys = Object.keys(a);
|
|
76
|
-
let key;
|
|
77
|
-
length = keys.length;
|
|
78
|
-
if (Object.keys(b).length !== length) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
while (length--) {
|
|
82
|
-
key = keys[length];
|
|
83
|
-
if (!(Object.prototype.hasOwnProperty.call(b, key) && // oxlint-disable-next-line no-explicit-any
|
|
84
|
-
eq(a[key], b[key], aStack, bStack))) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
aStack.pop();
|
|
90
|
-
bStack.pop();
|
|
91
|
-
return true;
|
|
92
|
-
};
|
|
93
|
-
export {
|
|
94
|
-
isEqual
|
|
95
|
-
};
|
package/dist/utils/logger.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import log from "loglevel";
|
|
2
|
-
import prefix from "loglevel-plugin-prefix";
|
|
3
|
-
prefix.reg(log);
|
|
4
|
-
prefix.apply(log, {
|
|
5
|
-
template: "[%t] %l:",
|
|
6
|
-
timestampFormatter: (date) => {
|
|
7
|
-
return date.toISOString();
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
const logger = {
|
|
11
|
-
info: (...args) => log.info(...args),
|
|
12
|
-
debug: (...args) => log.debug(...args),
|
|
13
|
-
warn: (...args) => log.warn(...args),
|
|
14
|
-
error: (...args) => log.error(...args),
|
|
15
|
-
trace: (...args) => log.trace(...args)
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
logger
|
|
19
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
var ObjectUtils;
|
|
2
|
-
((ObjectUtils2) => {
|
|
3
|
-
ObjectUtils2.isNil = (obj) => {
|
|
4
|
-
return obj === null || obj === void 0;
|
|
5
|
-
};
|
|
6
|
-
ObjectUtils2.isFunction = (obj) => {
|
|
7
|
-
return typeof obj === "function";
|
|
8
|
-
};
|
|
9
|
-
ObjectUtils2.isObject = (obj) => {
|
|
10
|
-
return typeof obj === "object" && !!obj;
|
|
11
|
-
};
|
|
12
|
-
ObjectUtils2.isString = (obj) => {
|
|
13
|
-
return Object.prototype.toString.call(obj) === "[object String]";
|
|
14
|
-
};
|
|
15
|
-
ObjectUtils2.isDate = (obj) => {
|
|
16
|
-
return Object.prototype.toString.call(obj) === "[object Date]";
|
|
17
|
-
};
|
|
18
|
-
ObjectUtils2.isRegExp = (obj) => {
|
|
19
|
-
return Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
20
|
-
};
|
|
21
|
-
ObjectUtils2.isEmpty = (obj) => {
|
|
22
|
-
if (obj === null || obj === void 0) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
if (Array.isArray(obj) || (0, ObjectUtils2.isString)(obj)) {
|
|
26
|
-
return obj.length === 0;
|
|
27
|
-
}
|
|
28
|
-
return Object.keys(obj).length === 0;
|
|
29
|
-
};
|
|
30
|
-
ObjectUtils2.deepConditionalMerge = (target, source, condition) => {
|
|
31
|
-
const output = { ...target };
|
|
32
|
-
for (const key in source) {
|
|
33
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
34
|
-
const value = source[key];
|
|
35
|
-
if (condition(value, key)) {
|
|
36
|
-
if (typeof value === "object" && !Array.isArray(value)) {
|
|
37
|
-
output[key] = (0, ObjectUtils2.deepConditionalMerge)(
|
|
38
|
-
output[key],
|
|
39
|
-
value,
|
|
40
|
-
condition
|
|
41
|
-
);
|
|
42
|
-
} else {
|
|
43
|
-
output[key] = value;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return output;
|
|
49
|
-
};
|
|
50
|
-
})(ObjectUtils || (ObjectUtils = {}));
|
|
51
|
-
export {
|
|
52
|
-
ObjectUtils
|
|
53
|
-
};
|
package/dist/utils/rest.utils.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
var RestUtils;
|
|
4
|
-
((RestUtils2) => {
|
|
5
|
-
RestUtils2.extractServerResponseCode = (e) => {
|
|
6
|
-
if (e instanceof z.ZodError) {
|
|
7
|
-
return "validation-exception";
|
|
8
|
-
}
|
|
9
|
-
if (!axios.isAxiosError(e)) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
if (!e.response) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
const data = e.response.data;
|
|
16
|
-
if (typeof data?.code === "string") {
|
|
17
|
-
return data.code;
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
};
|
|
21
|
-
RestUtils2.doesServerErrorMessageContain = (e, text) => {
|
|
22
|
-
const message = (0, RestUtils2.extractServerErrorMessage)(e);
|
|
23
|
-
if (message === null || message === void 0) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
return message.toLowerCase().includes(text.toLowerCase());
|
|
27
|
-
};
|
|
28
|
-
RestUtils2.extractServerErrorMessage = (e) => {
|
|
29
|
-
if (e instanceof z.ZodError) {
|
|
30
|
-
return e.message;
|
|
31
|
-
}
|
|
32
|
-
if (!axios.isAxiosError(e)) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
if (!e.response) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
const data = e.response.data;
|
|
39
|
-
if (typeof data?.message === "string") {
|
|
40
|
-
return data.message;
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
43
|
-
};
|
|
44
|
-
RestUtils2.extractContentDispositionFilename = (headers) => {
|
|
45
|
-
const contentDisposition = headers["content-disposition"];
|
|
46
|
-
return contentDisposition ? /filename=["']?([^"';]+)/i.exec(contentDisposition)?.[1] : void 0;
|
|
47
|
-
};
|
|
48
|
-
})(RestUtils || (RestUtils = {}));
|
|
49
|
-
export {
|
|
50
|
-
RestUtils
|
|
51
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var RoutingUtils;
|
|
2
|
-
((RoutingUtils2) => {
|
|
3
|
-
RoutingUtils2.addQueryParams = (path, params) => {
|
|
4
|
-
const sParams = new URLSearchParams();
|
|
5
|
-
for (const [key, value] of Object.entries(params)) {
|
|
6
|
-
if (value) {
|
|
7
|
-
sParams.append(key, value.toString());
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return `${path}?${sParams.toString()}`;
|
|
11
|
-
};
|
|
12
|
-
})(RoutingUtils || (RoutingUtils = {}));
|
|
13
|
-
export {
|
|
14
|
-
RoutingUtils
|
|
15
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
var StringUtils;
|
|
2
|
-
((StringUtils2) => {
|
|
3
|
-
StringUtils2.containsCaseInsensitive = (str, substr) => {
|
|
4
|
-
return str.toLowerCase().includes(substr.toLowerCase());
|
|
5
|
-
};
|
|
6
|
-
StringUtils2.capitalize = (str) => {
|
|
7
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
8
|
-
};
|
|
9
|
-
})(StringUtils || (StringUtils = {}));
|
|
10
|
-
export {
|
|
11
|
-
StringUtils
|
|
12
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { UIRouter } from "../../../config/router.context.js";
|
|
2
|
-
import { AbilityContext } from "./ability.context.js";
|
|
3
|
-
const createAclGuard = () => ({ canUse, redirectTo = "/", children }) => {
|
|
4
|
-
const ability = AbilityContext.useAbility();
|
|
5
|
-
const { replace } = UIRouter.useUIRouter();
|
|
6
|
-
if (!ability.can(canUse[0], canUse[1])) {
|
|
7
|
-
replace(redirectTo);
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
return children;
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
createAclGuard
|
|
14
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContextualCan } from "@casl/react";
|
|
3
|
-
import { AbilityContext } from "./ability.context.js";
|
|
4
|
-
const ContextualCan = createContextualCan(AbilityContext.Consumer);
|
|
5
|
-
const Can = ({ use, ...props }) => {
|
|
6
|
-
const [action, subject] = use;
|
|
7
|
-
return /* @__PURE__ */ jsx(
|
|
8
|
-
ContextualCan,
|
|
9
|
-
{
|
|
10
|
-
...props,
|
|
11
|
-
do: action,
|
|
12
|
-
on: subject
|
|
13
|
-
}
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
Can
|
|
18
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { AbilityBuilder, createMongoAbility } from "@casl/ability";
|
|
3
|
-
import { unpackRules } from "@casl/ability/extra";
|
|
4
|
-
import { useAbility } from "@casl/react";
|
|
5
|
-
import { createContext, useState, useEffect } from "react";
|
|
6
|
-
import { AuthContext } from "../auth/auth.context.js";
|
|
7
|
-
var AbilityContext;
|
|
8
|
-
((AbilityContext2) => {
|
|
9
|
-
const createAppAbilityBuilder = () => new AbilityBuilder(createMongoAbility);
|
|
10
|
-
const initialAppAbility = createAppAbilityBuilder().build();
|
|
11
|
-
const Context = createContext({});
|
|
12
|
-
({ Consumer: AbilityContext2.Consumer } = Context);
|
|
13
|
-
AbilityContext2.Provider = ({ children }) => {
|
|
14
|
-
const [ability, setAbility] = useState(initialAppAbility);
|
|
15
|
-
const { user } = AuthContext.useAuth();
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (!user || !("aclRules" in user)) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const { can, build } = createAppAbilityBuilder();
|
|
21
|
-
const packedRules = user.aclRules;
|
|
22
|
-
const rules = unpackRules(packedRules);
|
|
23
|
-
rules.forEach(({ action, subject, conditions }) => {
|
|
24
|
-
can(action, subject, conditions);
|
|
25
|
-
});
|
|
26
|
-
setAbility(build());
|
|
27
|
-
}, [user]);
|
|
28
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value: ability, children });
|
|
29
|
-
};
|
|
30
|
-
AbilityContext2.useAbility = () => {
|
|
31
|
-
const ability = useAbility(Context);
|
|
32
|
-
return ability;
|
|
33
|
-
};
|
|
34
|
-
})(AbilityContext || (AbilityContext = {}));
|
|
35
|
-
export {
|
|
36
|
-
AbilityContext
|
|
37
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from "react";
|
|
2
|
-
import { UIRouter } from "../../../config/router.context.js";
|
|
3
|
-
import { AuthContext } from "./auth.context.js";
|
|
4
|
-
const AuthGuard = ({ type, redirectTo, children }) => {
|
|
5
|
-
const { isAuthenticated, routes, loadingState } = AuthContext.useAuth();
|
|
6
|
-
const { replace } = UIRouter.useUIRouter();
|
|
7
|
-
const [hasMounted, setHasMounted] = useState(false);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
setHasMounted(true);
|
|
10
|
-
}, []);
|
|
11
|
-
if (!hasMounted) {
|
|
12
|
-
return loadingState;
|
|
13
|
-
}
|
|
14
|
-
if (type === "private" && !isAuthenticated) {
|
|
15
|
-
replace(redirectTo || routes?.unauthenticated || "/");
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
if (type === "public-only" && isAuthenticated) {
|
|
19
|
-
replace(redirectTo || routes?.authenticated || "/");
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
return children;
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
AuthGuard
|
|
26
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useMemo, use } from "react";
|
|
3
|
-
var AuthContext;
|
|
4
|
-
((AuthContext2) => {
|
|
5
|
-
const Context = createContext({});
|
|
6
|
-
AuthContext2.Provider = ({
|
|
7
|
-
isAuthenticated,
|
|
8
|
-
isInitializing,
|
|
9
|
-
logout,
|
|
10
|
-
updateTokens,
|
|
11
|
-
accessToken,
|
|
12
|
-
user,
|
|
13
|
-
userPromise,
|
|
14
|
-
routes,
|
|
15
|
-
loadingState,
|
|
16
|
-
children
|
|
17
|
-
}) => {
|
|
18
|
-
const value = useMemo(
|
|
19
|
-
() => ({
|
|
20
|
-
isAuthenticated,
|
|
21
|
-
isInitializing,
|
|
22
|
-
logout,
|
|
23
|
-
updateTokens,
|
|
24
|
-
accessToken,
|
|
25
|
-
user,
|
|
26
|
-
userPromise,
|
|
27
|
-
routes,
|
|
28
|
-
loadingState
|
|
29
|
-
}),
|
|
30
|
-
[isAuthenticated, isInitializing, logout, updateTokens, accessToken, user, userPromise, routes, loadingState]
|
|
31
|
-
);
|
|
32
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
33
|
-
};
|
|
34
|
-
AuthContext2.useAuth = () => {
|
|
35
|
-
const auth = use(Context);
|
|
36
|
-
return auth;
|
|
37
|
-
};
|
|
38
|
-
})(AuthContext || (AuthContext = {}));
|
|
39
|
-
export {
|
|
40
|
-
AuthContext
|
|
41
|
-
};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import i18next from "i18next";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { ns } from "../../config/i18n.js";
|
|
5
|
-
import { logger } from "../logger.js";
|
|
6
|
-
import { RestUtils } from "../rest.utils.js";
|
|
7
|
-
class ApplicationException 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
|
-
class ErrorHandler {
|
|
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, {
|
|
24
|
-
ns
|
|
25
|
-
})
|
|
26
|
-
};
|
|
27
|
-
const internalError = {
|
|
28
|
-
code: "INTERNAL_ERROR",
|
|
29
|
-
condition: (e) => {
|
|
30
|
-
if (axios.isAxiosError(e)) {
|
|
31
|
-
return e.response?.status != null && e.response.status >= 500 && e.response.status < 600;
|
|
32
|
-
}
|
|
33
|
-
return false;
|
|
34
|
-
},
|
|
35
|
-
getMessage: () => i18next.t(($) => $.sharedErrors.internalError, {
|
|
36
|
-
ns
|
|
37
|
-
})
|
|
38
|
-
};
|
|
39
|
-
const networkError = {
|
|
40
|
-
code: "NETWORK_ERROR",
|
|
41
|
-
condition: (e) => {
|
|
42
|
-
if (axios.isAxiosError(e)) {
|
|
43
|
-
return e.code === "ERR_NETWORK";
|
|
44
|
-
}
|
|
45
|
-
return false;
|
|
46
|
-
},
|
|
47
|
-
getMessage: () => i18next.t(($) => $.sharedErrors.networkError, {
|
|
48
|
-
ns
|
|
49
|
-
})
|
|
50
|
-
};
|
|
51
|
-
const canceledError = {
|
|
52
|
-
code: "CANCELED_ERROR",
|
|
53
|
-
condition: (e) => {
|
|
54
|
-
if (axios.isCancel(e)) {
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
if (axios.isAxiosError(e) && e.code === "ECONNABORTED") {
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
return false;
|
|
61
|
-
},
|
|
62
|
-
getMessage: () => i18next.t(($) => $.sharedErrors.canceledError, {
|
|
63
|
-
ns
|
|
64
|
-
})
|
|
65
|
-
};
|
|
66
|
-
const unknownError = {
|
|
67
|
-
code: "UNKNOWN_ERROR",
|
|
68
|
-
condition: () => true,
|
|
69
|
-
getMessage: () => i18next.t(($) => $.sharedErrors.unknownError, {
|
|
70
|
-
ns
|
|
71
|
-
})
|
|
72
|
-
};
|
|
73
|
-
this.entries = [...entries, dataValidationError, internalError, networkError, canceledError, unknownError];
|
|
74
|
-
}
|
|
75
|
-
// convert the error into an application exception
|
|
76
|
-
rethrowError(error) {
|
|
77
|
-
logger.error(error);
|
|
78
|
-
const errorEntry = this.entries.find((entry) => entry.condition(error ?? {}));
|
|
79
|
-
const serverMessage = RestUtils.extractServerErrorMessage(error);
|
|
80
|
-
throw new ApplicationException(errorEntry.getMessage(error), errorEntry.code, serverMessage);
|
|
81
|
-
}
|
|
82
|
-
// oxlint-disable-next-line class-methods-use-this
|
|
83
|
-
getError(error) {
|
|
84
|
-
if (error instanceof ApplicationException) {
|
|
85
|
-
return error;
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
// oxlint-disable-next-line class-methods-use-this
|
|
90
|
-
getErrorCode(error) {
|
|
91
|
-
if (error instanceof ApplicationException) {
|
|
92
|
-
return error.code;
|
|
93
|
-
}
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
static getErrorMessage(error, fallbackToUnknown = true) {
|
|
97
|
-
if (typeof error === "string") {
|
|
98
|
-
return error;
|
|
99
|
-
}
|
|
100
|
-
if (error instanceof Error) {
|
|
101
|
-
return error.message;
|
|
102
|
-
}
|
|
103
|
-
if (error instanceof ApplicationException) {
|
|
104
|
-
return error.message;
|
|
105
|
-
}
|
|
106
|
-
if (fallbackToUnknown) {
|
|
107
|
-
return i18next.t(($) => $.sharedErrors.unknownError, {
|
|
108
|
-
ns
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
const SharedErrorHandler = new ErrorHandler([]);
|
|
115
|
-
export {
|
|
116
|
-
ApplicationException,
|
|
117
|
-
ErrorHandler,
|
|
118
|
-
SharedErrorHandler
|
|
119
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
class RestInterceptor {
|
|
2
|
-
constructor(applyInterceptor) {
|
|
3
|
-
this.applyInterceptor = applyInterceptor;
|
|
4
|
-
this.interceptorIdMap = [];
|
|
5
|
-
}
|
|
6
|
-
addInterceptor(client, ...args) {
|
|
7
|
-
this.removeInterceptor(client);
|
|
8
|
-
const interceptorId = this.applyInterceptor(client, ...args);
|
|
9
|
-
this.interceptorIdMap.push({ client, interceptorId });
|
|
10
|
-
}
|
|
11
|
-
removeInterceptor(client) {
|
|
12
|
-
const interceptorId = this.interceptorIdMap.find((i) => i.client === client)?.interceptorId;
|
|
13
|
-
if (interceptorId != null) {
|
|
14
|
-
client.interceptors.request.eject(interceptorId);
|
|
15
|
-
this.interceptorIdMap = this.interceptorIdMap.filter((i) => i.client !== client);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
RestInterceptor
|
|
21
|
-
};
|
package/dist/utils/zod.utils.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
var ZodUtils;
|
|
3
|
-
((ZodUtils2) => {
|
|
4
|
-
ZodUtils2.unwrapZodType = (schemaType) => {
|
|
5
|
-
let unwrappedType = schemaType;
|
|
6
|
-
while (unwrappedType instanceof z.ZodNullable || unwrappedType instanceof z.ZodOptional) {
|
|
7
|
-
unwrappedType = unwrappedType.unwrap();
|
|
8
|
-
}
|
|
9
|
-
return unwrappedType;
|
|
10
|
-
};
|
|
11
|
-
const hasZodObjectProperty = (schemaType, property, type) => {
|
|
12
|
-
return property in schemaType.shape && schemaType.shape[property] instanceof z.core.$ZodType && (0, ZodUtils2.unwrapZodType)(schemaType.shape[property]) instanceof type;
|
|
13
|
-
};
|
|
14
|
-
ZodUtils2.isDateRange = (schemaType) => {
|
|
15
|
-
const unwrappedType = (0, ZodUtils2.unwrapZodType)(schemaType);
|
|
16
|
-
return unwrappedType instanceof z.ZodObject && hasZodObjectProperty(unwrappedType, "start", z.ZodISODateTime) && hasZodObjectProperty(unwrappedType, "end", z.ZodISODateTime);
|
|
17
|
-
};
|
|
18
|
-
})(ZodUtils || (ZodUtils = {}));
|
|
19
|
-
export {
|
|
20
|
-
ZodUtils
|
|
21
|
-
};
|