@povio/ui 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/AlignCenter.js +21 -0
- package/dist/assets/icons/AlignLeft.js +21 -0
- package/dist/assets/icons/AlignLeftRight.js +21 -0
- package/dist/assets/icons/AlignRight.js +21 -0
- package/dist/assets/icons/ArrowDropDown.js +21 -0
- package/dist/assets/icons/ArrowDropUp.js +21 -0
- package/dist/assets/icons/ArrowLeft.js +21 -0
- package/dist/assets/icons/ArrowRight.js +21 -0
- package/dist/assets/icons/Bold.js +21 -0
- package/dist/assets/icons/BulletedList.js +21 -0
- package/dist/assets/icons/Calendar.js +23 -0
- package/dist/assets/icons/Check.js +23 -0
- package/dist/assets/icons/CheckCircle.js +21 -0
- package/dist/assets/icons/CheckboxCheckmark.js +24 -0
- package/dist/assets/icons/CheckboxIndeterminate.js +24 -0
- package/dist/assets/icons/ChevronDown.js +23 -0
- package/dist/assets/icons/ChevronLeft.js +23 -0
- package/dist/assets/icons/ChevronRight.js +23 -0
- package/dist/assets/icons/ChevronUp.js +23 -0
- package/dist/assets/icons/ChevronsLeft.js +23 -0
- package/dist/assets/icons/ChevronsRight.js +23 -0
- package/dist/assets/icons/Clock.js +21 -0
- package/dist/assets/icons/Close.js +21 -0
- package/dist/assets/icons/DateTime.js +32 -0
- package/dist/assets/icons/Drag.js +21 -0
- package/dist/assets/icons/File.js +23 -0
- package/dist/assets/icons/Highlight.js +21 -0
- package/dist/assets/icons/HighlightOn.js +30 -0
- package/dist/assets/icons/Info.js +32 -0
- package/dist/assets/icons/Italic.js +21 -0
- package/dist/assets/icons/Link.js +21 -0
- package/dist/assets/icons/Menu.js +21 -0
- package/dist/assets/icons/NumberedList.js +21 -0
- package/dist/assets/icons/PointerHorizontal.js +21 -0
- package/dist/assets/icons/PointerVertical.js +21 -0
- package/dist/assets/icons/Send.js +23 -0
- package/dist/assets/icons/Strikethrough.js +21 -0
- package/dist/assets/icons/TextColor.js +30 -0
- package/dist/assets/icons/Today.js +21 -0
- package/dist/assets/icons/Underlined.js +23 -0
- package/dist/assets/icons/Upload.js +30 -0
- package/dist/assets/icons/View.js +18 -0
- package/dist/assets/icons/ViewOff.js +18 -0
- package/dist/assets/icons/WarningFilled.js +23 -0
- package/dist/assets/locales/en/translation.json.js +14 -0
- package/dist/assets/locales/sl/translation.json.js +14 -0
- package/dist/components/Menu/Menu.js +14 -0
- package/{src → dist}/components/Menu/MenuDesktop.d.ts +1 -1
- package/dist/components/Menu/MenuDesktop.js +68 -0
- package/{src → dist}/components/Menu/MenuItem.d.ts +1 -1
- package/dist/components/Menu/MenuItem.js +33 -0
- package/{src → dist}/components/Menu/MenuMobile.d.ts +1 -1
- package/dist/components/Menu/MenuMobile.js +78 -0
- package/{src → dist}/components/Menu/MenuPopover.d.ts +1 -1
- package/dist/components/Menu/MenuPopover.js +38 -0
- package/{src → dist}/components/buttons/Button/Button.d.ts +1 -1
- package/dist/components/buttons/Button/Button.js +68 -0
- package/{src → dist}/components/buttons/Button/button.cva.d.ts +1 -1
- package/dist/components/buttons/Button/button.cva.js +672 -0
- package/{src → dist}/components/buttons/IconButton/IconButton.d.ts +1 -1
- package/dist/components/buttons/IconButton/IconButton.js +17 -0
- package/{src → dist}/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +18 -0
- package/{src → dist}/components/buttons/PillButton/PillButton.d.ts +2 -2
- package/dist/components/buttons/PillButton/PillButton.js +44 -0
- package/{src → dist}/components/buttons/PillButton/pillButton.cva.d.ts +1 -1
- package/dist/components/buttons/PillButton/pillButton.cva.js +86 -0
- package/{src → dist}/components/buttons/SplitButton/SplitButton.d.ts +2 -2
- package/dist/components/buttons/SplitButton/SplitButton.js +62 -0
- package/{src → dist}/components/buttons/TextButton/TextButton.d.ts +3 -3
- package/dist/components/buttons/TextButton/TextButton.js +18 -0
- package/{src → dist}/components/buttons/ToggleButton/ToggleButton.d.ts +3 -3
- package/dist/components/buttons/ToggleButton/ToggleButton.js +21 -0
- package/{src → dist}/components/buttons/shared/ButtonContent.d.ts +3 -3
- package/dist/components/buttons/shared/ButtonContent.js +53 -0
- package/dist/components/buttons/shared/buttonContent.cva.js +16 -0
- package/{src → dist}/components/inputs/Checkbox/Checkbox.d.ts +3 -3
- package/dist/components/inputs/Checkbox/Checkbox.js +81 -0
- package/{src → dist}/components/inputs/Checkbox/CheckboxCheckmark.d.ts +1 -1
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +49 -0
- package/{src → dist}/components/inputs/Checkbox/checkbox.cva.d.ts +1 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.js +47 -0
- package/{src → dist}/components/inputs/DateTime/DatePicker/DatePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +237 -0
- package/{src → dist}/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +674 -0
- package/{src → dist}/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +251 -0
- package/{src → dist}/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +224 -0
- package/dist/components/inputs/DateTime/shared/Calendar.js +85 -0
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +160 -0
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +67 -0
- package/{src → dist}/components/inputs/DateTime/shared/CalendarHeader.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +89 -0
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +203 -0
- package/dist/components/inputs/DateTime/shared/DateField.js +62 -0
- package/{src → dist}/components/inputs/DateTime/shared/DatePickerInput.d.ts +2 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +174 -0
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +55 -0
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +76 -0
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +41 -0
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +82 -0
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +131 -0
- package/dist/components/inputs/DateTime/shared/TimeField.js +26 -0
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +186 -0
- package/{src → dist}/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +114 -0
- package/dist/components/inputs/DateTime/shared/YearPicker.js +89 -0
- package/dist/components/inputs/File/FileUpload.js +254 -0
- package/dist/components/inputs/File/FileUploadContainer.js +17 -0
- package/dist/components/inputs/File/InputUpload.js +176 -0
- package/{src → dist}/components/inputs/File/fileUpload.types.d.ts +3 -3
- package/{src → dist}/components/inputs/File/inputUpload.types.d.ts +2 -2
- package/{src → dist}/components/inputs/File/shared/FileCard.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +67 -0
- package/{src → dist}/components/inputs/File/shared/FileCardList.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCardList.js +20 -0
- package/dist/components/inputs/File/shared/FileProgressBar.js +32 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContent.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContent.js +92 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentEmpty.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +92 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentError.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentError.js +167 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentFilled.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +176 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentLoading.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +128 -0
- package/{src → dist}/components/inputs/File/shared/InputUploadContent.d.ts +1 -1
- package/dist/components/inputs/File/shared/InputUploadContent.js +74 -0
- package/dist/components/inputs/File/shared/InputUploadFilled.js +45 -0
- package/dist/components/inputs/File/shared/fileUpload.cva.js +58 -0
- package/dist/components/inputs/File/shared/inputUploadButton.cva.js +49 -0
- package/{src → dist}/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +54 -0
- package/dist/components/inputs/FormField/FormFieldError.js +16 -0
- package/dist/components/inputs/FormField/FormFieldHeader.js +57 -0
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +20 -0
- package/{src → dist}/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +37 -0
- package/{src → dist}/components/inputs/Input/NumberInput/NumberInput.d.ts +4 -4
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +157 -0
- package/{src → dist}/components/inputs/Input/PasswordInput/PasswordInput.d.ts +2 -2
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +26 -0
- package/{src → dist}/components/inputs/Input/TextArea/TextArea.d.ts +3 -3
- package/dist/components/inputs/Input/TextArea/TextArea.js +146 -0
- package/{src → dist}/components/inputs/Input/TextInput/TextInput.d.ts +4 -4
- package/dist/components/inputs/Input/TextInput/TextInput.js +170 -0
- package/{src → dist}/components/inputs/Input/shared/InputContent.d.ts +3 -3
- package/dist/components/inputs/Input/shared/InputContent.js +114 -0
- package/{src → dist}/components/inputs/Inputs/Form.d.ts +2 -2
- package/dist/components/inputs/Inputs/Form.js +68 -0
- package/{src → dist}/components/inputs/Inputs/InputItem.d.ts +16 -16
- package/dist/components/inputs/Inputs/InputItem.js +63 -0
- package/dist/components/inputs/Inputs/Inputs.js +32 -0
- package/{src → dist}/components/inputs/RadioGroup/RadioGroup.d.ts +3 -3
- package/dist/components/inputs/RadioGroup/RadioGroup.js +113 -0
- package/{src → dist}/components/inputs/RadioGroup/radio.cva.d.ts +1 -1
- package/dist/components/inputs/RadioGroup/radio.cva.js +47 -0
- package/{src → dist}/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +3 -3
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +39 -0
- package/{src → dist}/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -3
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +25 -0
- package/{src → dist}/components/inputs/Selection/Select/Select.d.ts +3 -3
- package/dist/components/inputs/Selection/Select/Select.js +32 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectBase.d.ts +3 -3
- package/dist/components/inputs/Selection/shared/SelectBase.js +25 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +211 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectInput.d.ts +4 -4
- package/dist/components/inputs/Selection/shared/SelectInput.js +231 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectInputTags.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +22 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +108 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxItem.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +78 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxItemSelectAll.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +45 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxLoadingItem.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +47 -0
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +42 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +161 -0
- package/{src → dist}/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +244 -0
- package/{src → dist}/components/inputs/Selection/shared/select.types.d.ts +1 -1
- package/{src → dist}/components/inputs/Selection/shared/useSelectItems.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/useSelectItems.js +94 -0
- package/{src → dist}/components/inputs/Slider/Slider.d.ts +2 -2
- package/dist/components/inputs/Slider/Slider.js +137 -0
- package/{src → dist}/components/inputs/TextEditor/TextEditor.d.ts +2 -2
- package/dist/components/inputs/TextEditor/TextEditor.js +223 -0
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +34 -0
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +80 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/HyperlinkAction.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +92 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextAlignSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +56 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextColorSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +33 -0
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +31 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextHighlightSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +37 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextListActions.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +51 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextMarksActions.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +73 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextStyleSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +61 -0
- package/dist/components/inputs/TextEditor/textEditor.types.js +40 -0
- package/{src → dist}/components/inputs/Toggle/Toggle.d.ts +3 -3
- package/dist/components/inputs/Toggle/Toggle.js +65 -0
- package/{src → dist}/components/inputs/Toggle/toggle.cva.d.ts +1 -1
- package/dist/components/inputs/Toggle/toggle.cva.js +44 -0
- package/{src → dist}/components/inputs/shared/CheckContent.d.ts +1 -1
- package/dist/components/inputs/shared/CheckContent.js +22 -0
- package/dist/components/inputs/shared/InputClear.js +27 -0
- package/dist/components/inputs/shared/input.cva.js +168 -0
- package/{src → dist}/components/inputs/shared/label.cva.d.ts +1 -1
- package/dist/components/inputs/shared/label.cva.js +133 -0
- package/dist/components/outline.clsx.js +11 -0
- package/{src → dist}/components/overlays/ActionModal/ActionModal.d.ts +2 -2
- package/dist/components/overlays/ActionModal/ActionModal.js +80 -0
- package/dist/components/overlays/BottomSheet/BottomSheet.js +261 -0
- package/dist/components/overlays/Drawer/Drawer.js +84 -0
- package/{src → dist}/components/overlays/Modal/Modal.d.ts +1 -1
- package/dist/components/overlays/Modal/Modal.js +53 -0
- package/dist/components/overlays/Modal/modal.cva.js +53 -0
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +71 -0
- package/{src → dist}/components/overlays/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +70 -0
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +27 -0
- package/dist/components/overlays/Tooltip/tooltip.cva.js +60 -0
- package/dist/components/segment/Segment.js +119 -0
- package/dist/components/segment/SegmentItem.js +43 -0
- package/{src → dist}/components/segment/segment.types.d.ts +1 -1
- package/dist/components/shared/pagination/Pagination.js +75 -0
- package/{src → dist}/components/shared/pagination/PaginationList.d.ts +1 -1
- package/dist/components/shared/pagination/PaginationList.js +145 -0
- package/dist/components/shared/pagination/minWidth.cva.js +15 -0
- package/{src → dist}/components/status/Alert/Alert.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +41 -0
- package/dist/components/status/Alert/alert.cva.js +64 -0
- package/{src → dist}/components/status/Loader/Loader.d.ts +1 -1
- package/dist/components/status/Loader/Loader.js +37 -0
- package/dist/components/status/Loader/loader.cva.js +27 -0
- package/{src → dist}/components/status/Toast/Toast.d.ts +1 -1
- package/dist/components/status/Toast/Toast.js +64 -0
- package/{src → dist}/components/status/Toast/toast.cva.d.ts +1 -1
- package/dist/components/status/Toast/toast.cva.js +150 -0
- package/dist/components/status/Toast/useToast.js +83 -0
- package/dist/components/status/shared/status.cva.js +62 -0
- package/dist/components/table/CellText.js +18 -0
- package/dist/components/table/ColumnConfig.js +124 -0
- package/dist/components/table/HeaderText.js +15 -0
- package/dist/components/table/InfiniteTable.js +40 -0
- package/dist/components/table/PaginatedTable.js +33 -0
- package/dist/components/table/Table.js +370 -0
- package/dist/components/table/table.cva.js +63 -0
- package/{src → dist}/components/text/Link/Link.d.ts +1 -1
- package/dist/components/text/Link/Link.js +18 -0
- package/dist/components/text/Link/link.cva.js +18 -0
- package/{src → dist}/components/text/Tag/Tag.d.ts +1 -1
- package/dist/components/text/Tag/Tag.js +49 -0
- package/dist/components/text/Tag/tag.cva.js +59 -0
- package/{src → dist}/components/text/Typography/Typography.d.ts +1 -1
- package/dist/components/text/Typography/Typography.js +22 -0
- package/dist/components/text/Typography/typography.cva.js +100 -0
- package/{src → dist}/config/confirmation.context.d.ts +1 -1
- package/dist/config/confirmation.context.js +107 -0
- package/dist/config/i18n.js +15 -0
- package/dist/config/router.context.js +43 -0
- package/{src → dist}/config/uiConfig.context.d.ts +8 -8
- package/dist/config/uiConfig.context.js +67 -0
- package/{src → dist}/config/uiStyle.context.d.ts +14 -14
- package/dist/config/uiStyle.context.js +16 -0
- package/dist/helpers/dynamicColumns.js +359 -0
- package/{src → dist}/helpers/dynamicInputs.d.ts +2 -2
- package/dist/helpers/dynamicInputs.js +216 -0
- package/dist/hooks/useAutosave.js +83 -0
- package/dist/hooks/useBreakpoint.js +20 -0
- package/dist/hooks/useDebounceCallback.js +29 -0
- package/dist/hooks/useDeepCompare.js +25 -0
- package/dist/hooks/useFilters.js +120 -0
- package/dist/hooks/useForm.js +22 -0
- package/{src → dist}/hooks/useFormAutosave.d.ts +2 -2
- package/dist/hooks/useFormAutosave.js +67 -0
- package/dist/hooks/useIntersectionObserver.js +27 -0
- package/dist/hooks/useLocalStorage.js +63 -0
- package/dist/hooks/useLongPressRepeat.js +33 -0
- package/dist/hooks/usePagination.js +35 -0
- package/dist/hooks/useScrollableListBox.js +30 -0
- package/dist/hooks/useSorting.js +30 -0
- package/dist/hooks/useStateAndRef.js +17 -0
- package/dist/hooks/useTableColumnConfig.js +63 -0
- package/dist/hooks/useTableNav.js +409 -0
- package/dist/hooks/useTranslationMemo.js +14 -0
- package/dist/index.js +284 -0
- package/{src → dist}/types/react-query.d.ts +1 -1
- package/dist/utils/array.utils.js +12 -0
- package/dist/utils/compoundMapper.js +14 -0
- package/dist/utils/date-time.utils.js +77 -0
- package/dist/utils/date.utils.js +12 -0
- package/dist/utils/dom.utils.js +13 -0
- package/dist/utils/file.utils.js +63 -0
- package/dist/utils/isEqual.js +95 -0
- package/dist/utils/logger.js +19 -0
- package/dist/utils/object.utils.js +53 -0
- package/dist/utils/queries.utils.js +9 -0
- package/dist/utils/rest.utils.js +51 -0
- package/dist/utils/routing.utils.js +15 -0
- package/dist/utils/string.utils.js +12 -0
- package/{src → dist}/utils/vendor/acl/AclGuard.d.ts +1 -1
- package/dist/utils/vendor/acl/AclGuard.js +15 -0
- package/dist/utils/vendor/acl/Can.js +18 -0
- package/dist/utils/vendor/acl/ability.context.js +37 -0
- package/dist/utils/vendor/auth/AuthGuard.js +26 -0
- package/dist/utils/vendor/auth/auth.context.js +36 -0
- package/{src → dist}/utils/vendor/auth/withPrivateAuthGuard.d.ts +1 -1
- package/dist/utils/vendor/auth/withPrivateAuthGuard.js +17 -0
- package/dist/utils/vendor/error-handling.js +119 -0
- package/dist/utils/vendor/rest-interceptor.js +21 -0
- package/dist/utils/zod.utils.js +25 -0
- package/package.json +57 -5
- package/index.js +0 -62585
- package/povio-ui-0.0.8.tgz +0 -0
- package/vite.config.d.ts +0 -2
- /package/{src → dist}/assets/icons/AlignCenter.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignLeftRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowDropDown.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowDropUp.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/Bold.d.ts +0 -0
- /package/{src → dist}/assets/icons/BulletedList.d.ts +0 -0
- /package/{src → dist}/assets/icons/Calendar.d.ts +0 -0
- /package/{src → dist}/assets/icons/Check.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckCircle.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckboxCheckmark.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckboxIndeterminate.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronDown.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronUp.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronsLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronsRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/Clock.d.ts +0 -0
- /package/{src → dist}/assets/icons/Close.d.ts +0 -0
- /package/{src → dist}/assets/icons/DateTime.d.ts +0 -0
- /package/{src → dist}/assets/icons/Drag.d.ts +0 -0
- /package/{src → dist}/assets/icons/File.d.ts +0 -0
- /package/{src → dist}/assets/icons/Highlight.d.ts +0 -0
- /package/{src → dist}/assets/icons/HighlightOn.d.ts +0 -0
- /package/{src → dist}/assets/icons/Info.d.ts +0 -0
- /package/{src → dist}/assets/icons/Italic.d.ts +0 -0
- /package/{src → dist}/assets/icons/Link.d.ts +0 -0
- /package/{src → dist}/assets/icons/Menu.d.ts +0 -0
- /package/{src → dist}/assets/icons/NumberedList.d.ts +0 -0
- /package/{src → dist}/assets/icons/PointerHorizontal.d.ts +0 -0
- /package/{src → dist}/assets/icons/PointerVertical.d.ts +0 -0
- /package/{src → dist}/assets/icons/Send.d.ts +0 -0
- /package/{src → dist}/assets/icons/Strikethrough.d.ts +0 -0
- /package/{src → dist}/assets/icons/TextColor.d.ts +0 -0
- /package/{src → dist}/assets/icons/Today.d.ts +0 -0
- /package/{src → dist}/assets/icons/Underlined.d.ts +0 -0
- /package/{src → dist}/assets/icons/Upload.d.ts +0 -0
- /package/{src → dist}/assets/icons/View.d.ts +0 -0
- /package/{src → dist}/assets/icons/ViewOff.d.ts +0 -0
- /package/{src → dist}/assets/icons/WarningFilled.d.ts +0 -0
- /package/{src → dist}/components/Menu/Menu.d.ts +0 -0
- /package/{src → dist}/components/buttons/shared/buttonContent.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/Calendar.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarCell.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarGrid.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarSelectHeader.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateField.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateTimeDialog.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateTimeDialogFooter.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/MonthPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/RangeCalendar.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/TimeField.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/TimePickerForm.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/YearPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/FileUpload.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/FileUploadContainer.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/InputUpload.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/index.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/FileProgressBar.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/InputUploadFilled.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/fileUpload.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/inputUploadButton.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldError.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldHeader.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldHeaderClose.d.ts +0 -0
- /package/{src → dist}/components/inputs/Inputs/Inputs.d.ts +0 -0
- /package/{src → dist}/components/inputs/Selection/shared/SelectListBoxSelectionBar.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/ColorPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/TextEditorToolbar.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/textEditor.types.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/InputClear.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/form.types.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/input.cva.d.ts +0 -0
- /package/{src → dist}/components/outline.clsx.d.ts +0 -0
- /package/{src → dist}/components/overlays/BottomSheet/BottomSheet.d.ts +0 -0
- /package/{src → dist}/components/overlays/Drawer/Drawer.d.ts +0 -0
- /package/{src → dist}/components/overlays/Modal/modal.cva.d.ts +0 -0
- /package/{src → dist}/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +0 -0
- /package/{src → dist}/components/overlays/Tooltip/TooltipEllipsis.d.ts +0 -0
- /package/{src → dist}/components/overlays/Tooltip/tooltip.cva.d.ts +0 -0
- /package/{src → dist}/components/segment/Segment.d.ts +0 -0
- /package/{src → dist}/components/segment/SegmentItem.d.ts +0 -0
- /package/{src → dist}/components/shared/pagination/Pagination.d.ts +0 -0
- /package/{src → dist}/components/shared/pagination/minWidth.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Alert/alert.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Loader/loader.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Toast/useToast.d.ts +0 -0
- /package/{src → dist}/components/status/shared/status.cva.d.ts +0 -0
- /package/{src → dist}/components/table/CellText.d.ts +0 -0
- /package/{src → dist}/components/table/ColumnConfig.d.ts +0 -0
- /package/{src → dist}/components/table/HeaderText.d.ts +0 -0
- /package/{src → dist}/components/table/InfiniteTable.d.ts +0 -0
- /package/{src → dist}/components/table/PaginatedTable.d.ts +0 -0
- /package/{src → dist}/components/table/Table.d.ts +0 -0
- /package/{src → dist}/components/table/table.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Link/link.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Tag/tag.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Typography/typography.cva.d.ts +0 -0
- /package/{src → dist}/config/i18n.d.ts +0 -0
- /package/{src → dist}/config/router.context.d.ts +0 -0
- /package/{src → dist}/helpers/dynamicColumns.d.ts +0 -0
- /package/{src → dist}/hooks/useAutosave.d.ts +0 -0
- /package/{src → dist}/hooks/useBreakpoint.d.ts +0 -0
- /package/{src → dist}/hooks/useDebounceCallback.d.ts +0 -0
- /package/{src → dist}/hooks/useDeepCompare.d.ts +0 -0
- /package/{src → dist}/hooks/useFilters.d.ts +0 -0
- /package/{src → dist}/hooks/useForm.d.ts +0 -0
- /package/{src → dist}/hooks/useIntersectionObserver.d.ts +0 -0
- /package/{src → dist}/hooks/useLocalStorage.d.ts +0 -0
- /package/{src → dist}/hooks/useLongPressRepeat.d.ts +0 -0
- /package/{src → dist}/hooks/usePagination.d.ts +0 -0
- /package/{src → dist}/hooks/useScrollableListBox.d.ts +0 -0
- /package/{src → dist}/hooks/useSorting.d.ts +0 -0
- /package/{src → dist}/hooks/useStateAndRef.d.ts +0 -0
- /package/{src → dist}/hooks/useTableColumnConfig.d.ts +0 -0
- /package/{src → dist}/hooks/useTableNav.d.ts +0 -0
- /package/{src → dist}/hooks/useTranslationMemo.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{styles → dist/styles}/editor.css +0 -0
- /package/{styles → dist/styles}/index.css +0 -0
- /package/{src → dist}/types/common.d.ts +0 -0
- /package/{src → dist}/utils/array.utils.d.ts +0 -0
- /package/{src → dist}/utils/array.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/compoundMapper.d.ts +0 -0
- /package/{src → dist}/utils/compoundMapper.spec.d.ts +0 -0
- /package/{src → dist}/utils/date-time.utils.d.ts +0 -0
- /package/{src → dist}/utils/date-time.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/date.utils.d.ts +0 -0
- /package/{src → dist}/utils/date.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/dom.utils.d.ts +0 -0
- /package/{src → dist}/utils/file.utils.d.ts +0 -0
- /package/{src → dist}/utils/isEqual.d.ts +0 -0
- /package/{src → dist}/utils/logger.d.ts +0 -0
- /package/{src → dist}/utils/object.utils.d.ts +0 -0
- /package/{src → dist}/utils/queries.utils.d.ts +0 -0
- /package/{src → dist}/utils/rest.utils.d.ts +0 -0
- /package/{src → dist}/utils/routing.utils.d.ts +0 -0
- /package/{src → dist}/utils/string.utils.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/Can.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/ability.context.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/appAbility.types.d.ts +0 -0
- /package/{src → dist}/utils/vendor/auth/AuthGuard.d.ts +0 -0
- /package/{src → dist}/utils/vendor/auth/auth.context.d.ts +0 -0
- /package/{src → dist}/utils/vendor/error-handling.d.ts +0 -0
- /package/{src → dist}/utils/vendor/rest-client.types.d.ts +0 -0
- /package/{src → dist}/utils/vendor/rest-interceptor.d.ts +0 -0
- /package/{src → dist}/utils/zod.utils.d.ts +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { WithPrivateAuthGuardProps } from '
|
|
1
|
+
import { WithPrivateAuthGuardProps } from '../auth/withPrivateAuthGuard';
|
|
2
2
|
import { AppAbilities } from './appAbility.types';
|
|
3
3
|
export declare const createAclGuard: <TAppAbilities extends AppAbilities = AppAbilities>() => ({ privateAuthGuardProps, ...props }: {
|
|
4
4
|
canUse: TAppAbilities;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UIRouter } from "../../../config/router.context.js";
|
|
2
|
+
import { AbilityContext } from "./ability.context.js";
|
|
3
|
+
import { withPrivateAuthGuard } from "../auth/withPrivateAuthGuard.js";
|
|
4
|
+
const createAclGuard = () => withPrivateAuthGuard(({ canUse, redirectTo = "/", children }) => {
|
|
5
|
+
const ability = AbilityContext.useAbility();
|
|
6
|
+
const { replace } = UIRouter.useUIRouter();
|
|
7
|
+
if (!ability.can(canUse[0], canUse[1])) {
|
|
8
|
+
replace(redirectTo);
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return children;
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
createAclGuard
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, 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
|
+
routes,
|
|
14
|
+
loadingState,
|
|
15
|
+
children
|
|
16
|
+
}) => {
|
|
17
|
+
const value = {
|
|
18
|
+
isAuthenticated,
|
|
19
|
+
isInitializing,
|
|
20
|
+
logout,
|
|
21
|
+
updateTokens,
|
|
22
|
+
accessToken,
|
|
23
|
+
user,
|
|
24
|
+
routes,
|
|
25
|
+
loadingState
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
28
|
+
};
|
|
29
|
+
AuthContext2.useAuth = () => {
|
|
30
|
+
const auth = use(Context);
|
|
31
|
+
return auth;
|
|
32
|
+
};
|
|
33
|
+
})(AuthContext || (AuthContext = {}));
|
|
34
|
+
export {
|
|
35
|
+
AuthContext
|
|
36
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType, PropsWithChildren } from 'react';
|
|
2
|
-
import { AuthGuardProps } from '
|
|
2
|
+
import { AuthGuardProps } from './AuthGuard';
|
|
3
3
|
export interface WithPrivateAuthGuardProps {
|
|
4
4
|
privateAuthGuardProps?: Omit<AuthGuardProps, "type">;
|
|
5
5
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AuthGuard } from "./AuthGuard.js";
|
|
3
|
+
const withPrivateAuthGuard = (WrappedComponent) => {
|
|
4
|
+
return ({ privateAuthGuardProps, ...props }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
AuthGuard,
|
|
7
|
+
{
|
|
8
|
+
type: "private",
|
|
9
|
+
...privateAuthGuardProps,
|
|
10
|
+
children: /* @__PURE__ */ jsx(WrappedComponent, { ...props })
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
withPrivateAuthGuard
|
|
17
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
ZodUtils2.isTextEditor = (schemaType) => {
|
|
19
|
+
const unwrappedType = (0, ZodUtils2.unwrapZodType)(schemaType);
|
|
20
|
+
return unwrappedType instanceof z.ZodObject && hasZodObjectProperty(unwrappedType, "html", z.ZodString) && hasZodObjectProperty(unwrappedType, "json", z.ZodObject);
|
|
21
|
+
};
|
|
22
|
+
})(ZodUtils || (ZodUtils = {}));
|
|
23
|
+
export {
|
|
24
|
+
ZodUtils
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,17 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@povio/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
5
|
+
"module": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
6
7
|
"exports": {
|
|
7
|
-
".": "./index.
|
|
8
|
-
"./styles": "./index.css"
|
|
8
|
+
".": "./dist/index.js",
|
|
9
|
+
"./styles": "./dist/styles/index.css"
|
|
9
10
|
},
|
|
10
|
-
"
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
11
14
|
"homepage": "https://povio.com",
|
|
12
15
|
"license": "UNLICENSED",
|
|
13
16
|
"peerDependencies": {
|
|
14
17
|
"react": "^19.1.0",
|
|
15
18
|
"react-dom": "^19.1.0"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@dnd-kit/core": "^6.3.1",
|
|
22
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
23
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
24
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
25
|
+
"@hookform/resolvers": "^5.2.2",
|
|
26
|
+
"@internationalized/date": "^3.10.0",
|
|
27
|
+
"@react-aria/button": "^3.14.2",
|
|
28
|
+
"@react-aria/calendar": "^3.9.2",
|
|
29
|
+
"@react-aria/focus": "^3.21.2",
|
|
30
|
+
"@react-aria/i18n": "^3.12.13",
|
|
31
|
+
"@react-aria/utils": "^3.31.0",
|
|
32
|
+
"@react-stately/calendar": "^3.9.0",
|
|
33
|
+
"@react-stately/datepicker": "^3.15.2",
|
|
34
|
+
"@react-types/shared": "^3.32.1",
|
|
35
|
+
"@tanstack/react-query": "~5.85.9",
|
|
36
|
+
"@tanstack/react-table": "^8.21.3",
|
|
37
|
+
"@tiptap/core": "^2.26.3",
|
|
38
|
+
"@tiptap/extension-color": "^2.26.3",
|
|
39
|
+
"@tiptap/extension-heading": "^2.26.3",
|
|
40
|
+
"@tiptap/extension-highlight": "^2.26.3",
|
|
41
|
+
"@tiptap/extension-link": "^2.26.3",
|
|
42
|
+
"@tiptap/extension-placeholder": "^2.26.3",
|
|
43
|
+
"@tiptap/extension-text-align": "^2.26.3",
|
|
44
|
+
"@tiptap/extension-text-style": "^2.26.3",
|
|
45
|
+
"@tiptap/extension-underline": "^2.26.3",
|
|
46
|
+
"@tiptap/pm": "^2.26.3",
|
|
47
|
+
"@tiptap/react": "^2.26.3",
|
|
48
|
+
"@tiptap/starter-kit": "^2.26.3",
|
|
49
|
+
"axios": "^1.13.1",
|
|
50
|
+
"class-variance-authority": "^0.7.1",
|
|
51
|
+
"clsx": "^2.1.1",
|
|
52
|
+
"i18next": "^25.6.0",
|
|
53
|
+
"loglevel": "^1.9.2",
|
|
54
|
+
"loglevel-plugin-prefix": "^0.8.4",
|
|
55
|
+
"luxon": "^3.7.2",
|
|
56
|
+
"motion": "~12.23.24",
|
|
57
|
+
"react-aria": "^3.44.0",
|
|
58
|
+
"react-aria-components": "^1.13.0",
|
|
59
|
+
"react-hook-form": "^7.65.0",
|
|
60
|
+
"react-i18next": "^16.2.3",
|
|
61
|
+
"react-responsive": "^10.0.1",
|
|
62
|
+
"react-stately": "^3.42.0",
|
|
63
|
+
"react-toastify": "^11.0.5",
|
|
64
|
+
"react-use-measure": "^2.1.7",
|
|
65
|
+
"tailwindcss": "^4.1.15",
|
|
66
|
+
"tailwindcss-react-aria-components": "^2.0.1",
|
|
67
|
+
"zod": "^4.1.12"
|
|
16
68
|
}
|
|
17
69
|
}
|