@povio/ui 3.4.0-rc.15 → 3.4.0-rc.17
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 +1 -1
- package/dist/assets/locales/en/{translation.json.js → translation.js} +1 -0
- package/dist/assets/locales/sl/{translation.json.js → translation.js} +1 -0
- package/dist/components/Breadcrumbs/breadcrumbs.cva.d.ts +39 -40
- package/dist/components/Breadcrumbs/breadcrumbs.cva.js +5 -5
- package/dist/components/Menu/MenuDesktop.js +2 -2
- package/dist/components/Menu/MenuItem.d.ts +6 -3
- package/dist/components/Menu/MenuItem.js +2 -2
- package/dist/components/Menu/MenuMobile.js +3 -3
- package/dist/components/Menu/MenuPopover.d.ts +7 -5
- package/dist/components/Menu/MenuPopover.js +2 -2
- package/dist/components/Menu/menu.cva.d.ts +35 -35
- package/dist/components/Menu/menu.cva.js +4 -4
- package/dist/components/accordion.d.ts +5 -0
- package/dist/components/accordion.js +81 -0
- package/dist/components/action-modal.d.ts +26 -0
- package/dist/components/action-modal.js +188 -0
- package/dist/components/alert.d.ts +14 -0
- package/dist/components/alert.js +114 -0
- package/dist/components/autocomplete.d.ts +16 -0
- package/dist/components/{inputs/Selection/Autocomplete/Autocomplete.js → autocomplete.js} +34 -64
- package/dist/components/bottom-sheet.d.ts +34 -0
- package/dist/components/{overlays/BottomSheet/BottomSheet.js → bottom-sheet.js} +17 -14
- package/dist/components/breadcrumbs.d.ts +19 -0
- package/dist/components/breadcrumbs.js +263 -0
- package/dist/components/button.d.ts +3 -0
- package/dist/components/button.js +2 -0
- package/dist/components/buttons/Button/Button.d.ts +25 -23
- package/dist/components/buttons/Button/Button.js +1 -1
- package/dist/components/buttons/Button/button.cva.d.ts +89 -95
- package/dist/components/buttons/Button/button.cva.js +8 -44
- package/dist/components/buttons/PillButton/pillButton.cva.d.ts +33 -38
- package/dist/components/buttons/PillButton/pillButton.cva.js +5 -5
- package/dist/components/buttons/shared/ButtonContent.js +81 -23
- package/dist/components/buttons/shared/buttonContent.cva.d.ts +6 -8
- package/dist/components/buttons/shared/buttonContent.cva.js +1 -1
- package/dist/components/checkbox-group.d.ts +28 -0
- package/dist/components/checkbox-group.js +163 -0
- package/dist/components/checkbox.d.ts +24 -0
- package/dist/components/checkbox.js +80 -0
- package/dist/components/date-picker.d.ts +2 -0
- package/dist/components/date-picker.js +2 -0
- package/dist/components/date-range-picker.d.ts +2 -0
- package/dist/components/date-range-picker.js +2 -0
- package/dist/components/date-time-picker.d.ts +2 -0
- package/dist/components/date-time-picker.js +2 -0
- package/dist/components/drawer.d.ts +18 -0
- package/dist/components/{overlays/Drawer/Drawer.js → drawer.js} +4 -4
- package/dist/components/file-upload-container.d.ts +5 -0
- package/dist/components/file-upload-container.js +15 -0
- package/dist/components/file-upload.d.ts +7 -0
- package/dist/components/{inputs/File/FileUpload.js → file-upload.js} +59 -98
- package/dist/components/form-field.d.ts +24 -0
- package/dist/components/form-field.js +47 -0
- package/dist/components/icon-button.d.ts +14 -0
- package/dist/components/{buttons/IconButton/IconButton.js → icon-button.js} +3 -3
- package/dist/components/inline-icon-button.d.ts +16 -0
- package/dist/components/inline-icon-button.js +40 -0
- package/dist/components/input-upload.d.ts +7 -0
- package/dist/components/input-upload.js +118 -0
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +1 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +73 -89
- package/dist/components/inputs/Checkbox/checkbox.cva.js +8 -8
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +40 -37
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +44 -36
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +46 -43
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +174 -170
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +41 -38
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +21 -20
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +29 -26
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +166 -542
- package/dist/components/inputs/DateTime/shared/Calendar.js +17 -14
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +18 -18
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +6 -5
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +9 -8
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +45 -45
- package/dist/components/inputs/DateTime/shared/DateField.js +19 -20
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +11 -45
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +3 -3
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +26 -102
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +29 -84
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +3 -3
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +59 -104
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +82 -193
- package/dist/components/inputs/DateTime/shared/TimeField.js +8 -27
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +113 -283
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +73 -216
- package/dist/components/inputs/DateTime/shared/YearPicker.js +69 -120
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +8 -5
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +16 -15
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +1 -1
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +13 -52
- package/dist/components/inputs/DateTime/shared/datePickerValue.utils.js +1 -1
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +13 -12
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.js +12 -26
- package/dist/components/inputs/File/fileUpload.types.d.ts +87 -84
- package/dist/components/inputs/File/inputUpload.types.d.ts +34 -32
- package/dist/components/inputs/File/inputUpload.types.js +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +47 -110
- package/dist/components/inputs/File/shared/FileCardList.js +16 -54
- package/dist/components/inputs/File/shared/FileUploadContent.js +47 -188
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +3 -3
- package/dist/components/inputs/File/shared/FileUploadContentError.js +6 -6
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +6 -6
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +3 -3
- package/dist/components/inputs/File/shared/InputUploadContent.js +38 -151
- package/dist/components/inputs/File/shared/InputUploadFilled.js +10 -50
- package/dist/components/inputs/File/shared/ProgressBar.d.ts +6 -4
- package/dist/components/inputs/File/shared/ProgressBar.js +2 -2
- package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +17 -16
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -1
- package/dist/components/inputs/File/shared/inputUploadButton.cva.d.ts +24 -25
- package/dist/components/inputs/File/shared/inputUploadButton.cva.js +5 -5
- package/dist/components/inputs/File/shared/progressBar.cva.d.ts +34 -33
- package/dist/components/inputs/File/shared/progressBar.cva.js +5 -5
- package/dist/components/inputs/FormField/FormFieldError.d.ts +9 -6
- package/dist/components/inputs/FormField/FormFieldError.js +6 -24
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +15 -13
- package/dist/components/inputs/FormField/FormFieldHeader.js +24 -80
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +7 -31
- package/dist/components/inputs/FormField/FormFieldHelper.js +7 -25
- package/dist/components/inputs/FormField/FormFieldLabel.js +9 -40
- package/dist/components/inputs/FormField/formFieldError.cva.d.ts +13 -12
- package/dist/components/inputs/FormField/formFieldError.cva.js +1 -1
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +13 -12
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +1 -1
- package/dist/components/inputs/FormField/formFieldHelper.cva.d.ts +13 -12
- package/dist/components/inputs/FormField/formFieldHelper.cva.js +1 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +11 -45
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +121 -554
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +8 -7
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +1 -1
- package/dist/components/inputs/Input/shared/InputContent.d.ts +25 -27
- package/dist/components/inputs/Input/shared/InputContent.js +61 -195
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +1 -1
- package/dist/components/inputs/Inputs/Form.d.ts +19 -19
- package/dist/components/inputs/Inputs/Form.js +23 -51
- package/dist/components/inputs/Inputs/InputItem.d.ts +77 -58
- package/dist/components/inputs/Inputs/InputItem.js +29 -78
- package/dist/components/inputs/Inputs/Inputs.d.ts +12 -9
- package/dist/components/inputs/Inputs/Inputs.js +11 -37
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +49 -59
- package/dist/components/inputs/RadioGroup/radio.cva.js +6 -6
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +25 -38
- package/dist/components/inputs/Selection/Select/Select.d.ts +15 -11
- package/dist/components/inputs/Selection/Select/Select.js +36 -112
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +39 -37
- package/dist/components/inputs/Selection/shared/SelectBase.js +26 -70
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +145 -393
- package/dist/components/inputs/Selection/shared/SelectInput.js +162 -429
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +27 -101
- package/dist/components/inputs/Selection/shared/SelectListBox.js +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +35 -85
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +16 -69
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +24 -72
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +10 -59
- package/dist/components/inputs/Selection/shared/SelectMobile.js +4 -4
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +14 -39
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +8 -15
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +6 -6
- package/dist/components/inputs/Selection/shared/select.context.js +52 -52
- package/dist/components/inputs/Selection/shared/select.types.d.ts +60 -62
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +8 -5
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +1 -1
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +12 -11
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +1 -1
- package/dist/components/inputs/Selection/shared/selectItem.cva.d.ts +16 -15
- package/dist/components/inputs/Selection/shared/selectItem.cva.js +1 -1
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +3 -3
- package/dist/components/inputs/Selection/shared/useSelectItems.js +12 -12
- package/dist/components/inputs/Skeleton/InputFrame.js +30 -30
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +24 -20
- package/dist/components/inputs/TextEditor/TextEditor.js +22 -63
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +11 -37
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +31 -103
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +48 -197
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +28 -88
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +14 -48
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +19 -66
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +15 -49
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +33 -93
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +55 -127
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +39 -142
- package/dist/components/inputs/TextEditor/textEditor.types.js +1 -1
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +15 -18
- package/dist/components/inputs/Toggle/toggle.cva.js +3 -3
- package/dist/components/inputs/shared/CheckContent.js +11 -21
- package/dist/components/inputs/shared/InputClear.js +31 -103
- package/dist/components/inputs/shared/TooltipWrapper.js +14 -49
- package/dist/components/inputs/shared/form.binding.d.ts +7 -27
- package/dist/components/inputs/shared/form.binding.js +8 -37
- package/dist/components/inputs/shared/form.types.d.ts +11 -11
- package/dist/components/inputs/shared/form.types.js +1 -1
- package/dist/components/inputs/shared/input.cva.d.ts +76 -85
- package/dist/components/inputs/shared/input.cva.js +9 -19
- package/dist/components/inputs/shared/label.cva.d.ts +18 -18
- package/dist/components/inputs/shared/label.cva.js +2 -2
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +10 -7
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +1 -1
- package/dist/components/inputs/shared/useFieldAccessibility.js +19 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +50 -105
- package/dist/components/link.d.ts +11 -0
- package/dist/components/{text/Link/Link.js → link.js} +7 -7
- package/dist/components/loader.d.ts +7 -0
- package/dist/components/{status/Loader/Loader.js → loader.js} +2 -2
- package/dist/components/menu.d.ts +23 -0
- package/dist/components/{Menu/Menu.js → menu.js} +4 -4
- package/dist/components/modal.d.ts +2 -0
- package/dist/components/modal.js +2 -0
- package/dist/components/navigation/Accordion/AccordionItem.js +87 -42
- package/dist/components/navigation/Accordion/accordion.cva.d.ts +76 -100
- package/dist/components/navigation/Accordion/accordion.cva.js +10 -10
- package/dist/components/navigation/Accordion/accordion.types.d.ts +52 -49
- package/dist/components/navigation/Stepper/StepperItem.js +3 -3
- package/dist/components/navigation/Stepper/StepperSeparator.js +1 -1
- package/dist/components/navigation/Stepper/stepper.cva.d.ts +73 -86
- package/dist/components/navigation/Stepper/stepper.cva.js +7 -7
- package/dist/components/navigation/Stepper/stepper.types.d.ts +29 -37
- package/dist/components/number-input.d.ts +27 -0
- package/dist/components/number-input.js +245 -0
- package/dist/components/number-range-input.d.ts +39 -0
- package/dist/components/number-range-input.js +267 -0
- package/dist/components/outline.clsx.d.ts +4 -2
- package/dist/components/outline.clsx.js +2 -2
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +3 -3
- package/dist/components/overlays/Modal/Modal.d.ts +18 -14
- package/dist/components/overlays/Modal/Modal.js +4 -2
- package/dist/components/overlays/Modal/modal.cva.d.ts +34 -34
- package/dist/components/overlays/Modal/modal.cva.js +4 -4
- package/dist/components/overlays/Tooltip/tooltip.cva.d.ts +39 -45
- package/dist/components/overlays/Tooltip/tooltip.cva.js +4 -4
- package/dist/components/pagination.d.ts +12 -0
- package/dist/components/pagination.js +131 -0
- package/dist/components/password-input.d.ts +10 -0
- package/dist/components/password-input.js +23 -0
- package/dist/components/pill-button.d.ts +15 -0
- package/dist/components/{buttons/PillButton/PillButton.js → pill-button.js} +5 -5
- package/dist/components/pill.d.ts +18 -0
- package/dist/components/{text/Pill/Pill.js → pill.js} +6 -6
- package/dist/components/query-autocomplete.d.ts +8 -0
- package/dist/components/query-autocomplete.js +105 -0
- package/dist/components/query-select.d.ts +19 -0
- package/dist/components/query-select.js +115 -0
- package/dist/components/radio-group.d.ts +24 -0
- package/dist/components/radio-group.js +165 -0
- package/dist/components/responsive-popover.d.ts +19 -0
- package/dist/components/responsive-popover.js +126 -0
- package/dist/components/segment/SegmentItem.js +3 -3
- package/dist/components/segment/segment.cva.d.ts +20 -18
- package/dist/components/segment/segment.cva.js +2 -2
- package/dist/components/segment/segment.types.d.ts +33 -30
- package/dist/components/segment.d.ts +7 -0
- package/dist/components/{segment/Segment.js → segment.js} +8 -8
- package/dist/components/select.d.ts +4 -0
- package/dist/components/select.js +2 -0
- package/dist/components/shared/pagination/PaginationList.d.ts +17 -14
- package/dist/components/shared/pagination/PaginationList.js +2 -2
- package/dist/components/shared/pagination/minWidth.cva.js +1 -1
- package/dist/components/shared/popover.cva.d.ts +8 -7
- package/dist/components/shared/popover.cva.js +1 -1
- package/dist/components/slider.d.ts +22 -0
- package/dist/components/slider.js +103 -0
- package/dist/components/split-button.d.ts +15 -0
- package/dist/components/{buttons/SplitButton/SplitButton.js → split-button.js} +5 -5
- package/dist/components/status/Alert/alert.cva.d.ts +21 -18
- package/dist/components/status/Alert/alert.cva.js +1 -1
- package/dist/components/status/Loader/loader.cva.d.ts +23 -26
- package/dist/components/status/Loader/loader.cva.js +4 -4
- package/dist/components/status/Toast/toast.cva.d.ts +58 -77
- package/dist/components/status/Toast/toast.cva.js +6 -6
- package/dist/components/status/Toast/useToast.d.ts +14 -11
- package/dist/components/status/Toast/useToast.js +2 -2
- package/dist/components/status/shared/status.cva.d.ts +32 -28
- package/dist/components/status/shared/status.cva.js +2 -2
- package/dist/components/stepper.d.ts +5 -0
- package/dist/components/stepper.js +79 -0
- package/dist/components/table/CellText.d.ts +10 -7
- package/dist/components/table/CellText.js +4 -3
- package/dist/components/table/ColumnConfig.d.ts +12 -9
- package/dist/components/table/ColumnConfig.js +8 -7
- package/dist/components/table/HeaderText.d.ts +10 -7
- package/dist/components/table/HeaderText.js +4 -3
- package/dist/components/table/InfiniteTable.d.ts +10 -8
- package/dist/components/table/InfiniteTable.js +68 -17
- package/dist/components/table/PaginatedTable.d.ts +12 -10
- package/dist/components/table/PaginatedTable.js +2 -2
- package/dist/components/table/Table.d.ts +34 -35
- package/dist/components/table/Table.js +19 -17
- package/dist/components/table/table.cva.d.ts +40 -59
- package/dist/components/table/table.cva.js +7 -7
- package/dist/components/tag.d.ts +18 -0
- package/dist/components/{text/Tag/Tag.js → tag.js} +6 -6
- package/dist/components/text/Link/link.cva.d.ts +14 -11
- package/dist/components/text/Link/link.cva.js +1 -1
- package/dist/components/text/Tag/tag.cva.d.ts +18 -15
- package/dist/components/text/Tag/tag.cva.js +1 -1
- package/dist/components/text/Typography/typography.cva.d.ts +51 -48
- package/dist/components/text/Typography/typography.cva.js +1 -1
- package/dist/components/text-area.d.ts +21 -0
- package/dist/components/text-area.js +138 -0
- package/dist/components/text-button.d.ts +15 -0
- package/dist/components/{buttons/TextButton/TextButton.js → text-button.js} +2 -2
- package/dist/components/text-input.d.ts +27 -0
- package/dist/components/text-input.js +241 -0
- package/dist/components/time-picker.d.ts +2 -0
- package/dist/components/time-picker.js +2 -0
- package/dist/components/toast.d.ts +17 -0
- package/dist/components/{status/Toast/Toast.js → toast.js} +11 -11
- package/dist/components/toggle-button.d.ts +12 -0
- package/dist/components/{buttons/ToggleButton/ToggleButton.js → toggle-button.js} +2 -2
- package/dist/components/toggle.d.ts +19 -0
- package/dist/components/toggle.js +74 -0
- package/dist/components/tooltip-ellipsis.d.ts +11 -0
- package/dist/components/{overlays/Tooltip/TooltipEllipsis.js → tooltip-ellipsis.js} +3 -3
- package/dist/components/tooltip.d.ts +16 -0
- package/dist/components/{overlays/Tooltip/Tooltip.js → tooltip.js} +9 -9
- package/dist/components/typography.d.ts +12 -0
- package/dist/components/typography.js +31 -0
- package/dist/config/confirmation.context.d.ts +22 -19
- package/dist/config/confirmation.context.js +3 -3
- package/dist/config/i18n.d.ts +311 -308
- package/dist/config/i18n.js +4 -4
- package/dist/config/link.context.d.ts +9 -7
- package/dist/config/link.context.js +2 -2
- package/dist/config/router.context.d.ts +11 -9
- package/dist/config/router.context.js +2 -2
- package/dist/config/theme.context.d.ts +19 -16
- package/dist/config/theme.context.js +99 -46
- package/dist/config/uiConfig.context.d.ts +80 -75
- package/dist/config/uiConfig.context.js +46 -9
- package/dist/config/uiOverrides.context.d.ts +205 -204
- package/dist/config/uiOverrides.context.js +2 -2
- package/dist/helpers/dynamicColumns.d.ts +27 -28
- package/dist/helpers/dynamicColumns.js +32 -31
- package/dist/helpers/dynamicInputs.d.ts +66 -74
- package/dist/helpers/dynamicInputs.js +21 -20
- package/dist/hooks/useAutosave.d.ts +12 -9
- package/dist/hooks/useAutosave.js +1 -1
- package/dist/hooks/useBreakpoint.d.ts +4 -2
- package/dist/hooks/useBreakpoint.js +37 -10
- package/dist/hooks/useDebounceCallback.d.ts +7 -4
- package/dist/hooks/useDebounceCallback.js +51 -17
- package/dist/hooks/useDeepCompare.d.ts +7 -4
- package/dist/hooks/useDeepCompare.js +4 -4
- package/dist/hooks/useFilters.d.ts +10 -7
- package/dist/hooks/useFilters.js +8 -6
- package/dist/hooks/useForm.d.ts +35 -35
- package/dist/hooks/useForm.js +6 -6
- package/dist/hooks/useFormAutosave.d.ts +16 -13
- package/dist/hooks/useFormAutosave.js +18 -17
- package/dist/hooks/useIntersectionObserver.d.ts +7 -5
- package/dist/hooks/useIntersectionObserver.js +2 -2
- package/dist/hooks/useKeyInteractions.d.ts +19 -16
- package/dist/hooks/useKeyInteractions.js +5 -5
- package/dist/hooks/useLocalStorage.d.ts +10 -8
- package/dist/hooks/useLocalStorage.js +3 -3
- package/dist/hooks/useLongPressRepeat.d.ts +10 -7
- package/dist/hooks/useLongPressRepeat.js +55 -20
- package/dist/hooks/usePagination.d.ts +9 -6
- package/dist/hooks/usePagination.js +2 -2
- package/dist/hooks/useQueryAutocomplete.js +2 -2
- package/dist/hooks/useScrollableListBox.d.ts +5 -2
- package/dist/hooks/useScrollableListBox.js +1 -1
- package/dist/hooks/useSorting.d.ts +8 -5
- package/dist/hooks/useSorting.js +1 -1
- package/dist/hooks/useStateAndRef.d.ts +5 -3
- package/dist/hooks/useStateAndRef.js +2 -2
- package/dist/hooks/useTableColumnConfig.d.ts +15 -13
- package/dist/hooks/useTableColumnConfig.js +1 -1
- package/dist/hooks/useTableNav.d.ts +79 -77
- package/dist/hooks/useTableNav.js +19 -37
- package/dist/hooks/useTranslationMemo.d.ts +5 -3
- package/dist/index.d.ts +145 -1
- package/dist/index.js +29 -29
- package/dist/rhf/Inputs.d.ts +55 -54
- package/dist/rhf/Inputs.js +62 -17
- package/dist/rhf/autocomplete.d.ts +3 -0
- package/dist/rhf/autocomplete.js +2 -0
- package/dist/rhf/checkbox-group.d.ts +3 -0
- package/dist/rhf/checkbox-group.js +2 -0
- package/dist/rhf/checkbox.d.ts +3 -0
- package/dist/rhf/checkbox.js +2 -0
- package/dist/rhf/components.d.ts +77 -75
- package/dist/rhf/components.js +43 -43
- package/dist/rhf/date-picker.d.ts +3 -0
- package/dist/rhf/date-picker.js +2 -0
- package/dist/rhf/date-range-picker.d.ts +3 -0
- package/dist/rhf/date-range-picker.js +2 -0
- package/dist/rhf/date-time-picker.d.ts +3 -0
- package/dist/rhf/date-time-picker.js +2 -0
- package/dist/rhf/dynamicInputs.d.ts +16 -14
- package/dist/rhf/dynamicInputs.js +1 -1
- package/dist/rhf/entry.utils.js +5 -0
- package/dist/rhf/fieldAdapter.d.ts +8 -6
- package/dist/rhf/form.types.d.ts +11 -10
- package/dist/rhf/number-input.d.ts +8 -0
- package/dist/rhf/number-input.js +7 -0
- package/dist/rhf/number-range-input.d.ts +8 -0
- package/dist/rhf/number-range-input.js +7 -0
- package/dist/rhf/password-input.d.ts +8 -0
- package/dist/rhf/password-input.js +7 -0
- package/dist/rhf/query-autocomplete.d.ts +2 -0
- package/dist/rhf/query-autocomplete.js +2 -0
- package/dist/rhf/query-select.d.ts +2 -0
- package/dist/rhf/query-select.js +2 -0
- package/dist/rhf/radio-group.d.ts +3 -0
- package/dist/rhf/radio-group.js +2 -0
- package/dist/rhf/segment.d.ts +3 -0
- package/dist/rhf/segment.js +2 -0
- package/dist/rhf/select.d.ts +3 -0
- package/dist/rhf/select.js +2 -0
- package/dist/rhf/slider.d.ts +3 -0
- package/dist/rhf/slider.js +2 -0
- package/dist/rhf/text-area.d.ts +8 -0
- package/dist/rhf/text-area.js +7 -0
- package/dist/rhf/text-input.d.ts +8 -0
- package/dist/rhf/text-input.js +7 -0
- package/dist/rhf/time-picker.d.ts +3 -0
- package/dist/rhf/time-picker.js +2 -0
- package/dist/rhf/toggle.d.ts +3 -0
- package/dist/rhf/toggle.js +2 -0
- package/dist/rhf/useAutosave.d.ts +12 -9
- package/dist/rhf/useForm.d.ts +13 -13
- package/dist/rhf/useFormAutosave.d.ts +17 -14
- package/dist/rhf/useFormAutosave.js +121 -34
- package/dist/rhf.d.ts +146 -225
- package/dist/rhf.js +120 -0
- package/dist/tanstack/autocomplete.d.ts +2 -0
- package/dist/tanstack/autocomplete.js +2 -0
- package/dist/tanstack/checkbox-group.d.ts +2 -0
- package/dist/tanstack/checkbox-group.js +2 -0
- package/dist/tanstack/checkbox.d.ts +2 -0
- package/dist/tanstack/checkbox.js +2 -0
- package/dist/tanstack/date-picker.d.ts +2 -0
- package/dist/tanstack/date-picker.js +2 -0
- package/dist/tanstack/date-range-picker.d.ts +2 -0
- package/dist/tanstack/date-range-picker.js +2 -0
- package/dist/tanstack/date-time-picker.d.ts +2 -0
- package/dist/tanstack/date-time-picker.js +2 -0
- package/dist/tanstack/form.d.ts +3 -0
- package/dist/tanstack/form.js +3 -0
- package/dist/tanstack/number-input.d.ts +2 -0
- package/dist/tanstack/number-input.js +2 -0
- package/dist/tanstack/number-range-input.d.ts +3 -0
- package/dist/tanstack/number-range-input.js +2 -0
- package/dist/tanstack/password-input.d.ts +2 -0
- package/dist/tanstack/password-input.js +2 -0
- package/dist/tanstack/query-autocomplete.d.ts +2 -0
- package/dist/tanstack/query-autocomplete.js +2 -0
- package/dist/tanstack/query-select.d.ts +2 -0
- package/dist/tanstack/query-select.js +2 -0
- package/dist/tanstack/radio-group.d.ts +2 -0
- package/dist/tanstack/radio-group.js +2 -0
- package/dist/tanstack/segment.d.ts +3 -0
- package/dist/tanstack/segment.js +2 -0
- package/dist/tanstack/select.d.ts +2 -0
- package/dist/tanstack/select.js +2 -0
- package/dist/tanstack/slider.d.ts +2 -0
- package/dist/tanstack/slider.js +2 -0
- package/dist/tanstack/table.d.ts +12 -0
- package/dist/tanstack/table.js +11 -0
- package/dist/tanstack/text-area.d.ts +2 -0
- package/dist/tanstack/text-area.js +2 -0
- package/dist/tanstack/text-input.d.ts +2 -0
- package/dist/tanstack/text-input.js +2 -0
- package/dist/tanstack/time-picker.d.ts +2 -0
- package/dist/tanstack/time-picker.js +2 -0
- package/dist/tanstack/toggle.d.ts +2 -0
- package/dist/tanstack/toggle.js +2 -0
- package/dist/tanstack.d.ts +151 -224
- package/dist/tanstack.js +45 -45
- package/dist/text-editor.d.ts +2 -2
- package/dist/tw-ui-plugin.d.ts +4 -2
- package/dist/tw-ui-plugin.js +1 -1
- package/dist/types/common.d.ts +11 -12
- package/dist/types/error-handling.d.ts +8 -5
- package/dist/utils/array.utils.d.ts +5 -2
- package/dist/utils/array.utils.js +1 -1
- package/dist/utils/compoundMapper.d.ts +12 -14
- package/dist/utils/compoundMapper.js +1 -1
- package/dist/utils/date-time.utils.d.ts +44 -41
- package/dist/utils/date-time.utils.js +7 -9
- package/dist/utils/date.utils.d.ts +6 -4
- package/dist/utils/date.utils.js +29 -6
- package/dist/utils/dom.utils.d.ts +7 -4
- package/dist/utils/dom.utils.js +2 -2
- package/dist/utils/file.utils.d.ts +20 -12
- package/dist/utils/file.utils.js +19 -8
- package/dist/utils/intl.utils.d.ts +7 -5
- package/dist/utils/intl.utils.js +2 -2
- package/dist/utils/isEqual.d.ts +4 -1
- package/dist/utils/isEqual.js +3 -3
- package/dist/utils/logger.d.ts +9 -6
- package/dist/utils/logger.js +1 -1
- package/dist/utils/object.utils.d.ts +12 -9
- package/dist/utils/object.utils.js +1 -1
- package/dist/utils/queries.utils.d.ts +6 -3
- package/dist/utils/queries.utils.js +1 -1
- package/dist/utils/query.utils.js +1 -1
- package/dist/utils/routing.utils.d.ts +6 -3
- package/dist/utils/routing.utils.js +1 -1
- package/dist/utils/string.utils.d.ts +6 -3
- package/dist/utils/string.utils.js +1 -1
- package/dist/utils/style-merge.util.d.ts +38 -41
- package/dist/utils/style-merge.util.js +7 -4
- package/dist/utils/zod.utils.d.ts +22 -19
- package/dist/utils/zod.utils.js +1 -1
- package/package.json +475 -8
- package/dist/assets/locales/en/translation.json.d.ts +0 -158
- package/dist/assets/locales/sl/translation.json.d.ts +0 -154
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +0 -16
- package/dist/components/Breadcrumbs/Breadcrumbs.js +0 -112
- package/dist/components/Menu/Menu.d.ts +0 -21
- package/dist/components/Menu/MenuDesktop.d.ts +0 -2
- package/dist/components/Menu/MenuMobile.d.ts +0 -2
- package/dist/components/buttons/IconButton/IconButton.d.ts +0 -11
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +0 -13
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +0 -15
- package/dist/components/buttons/PillButton/PillButton.d.ts +0 -12
- package/dist/components/buttons/SplitButton/SplitButton.d.ts +0 -12
- package/dist/components/buttons/TextButton/TextButton.d.ts +0 -12
- package/dist/components/buttons/ToggleButton/ToggleButton.d.ts +0 -9
- package/dist/components/buttons/shared/ButtonContent.d.ts +0 -14
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +0 -20
- package/dist/components/inputs/Checkbox/Checkbox.js +0 -236
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.d.ts +0 -9
- package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +0 -26
- package/dist/components/inputs/Checkbox/CheckboxGroup.js +0 -392
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +0 -29
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +0 -22
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +0 -27
- package/dist/components/inputs/DateTime/shared/CalendarHeader.d.ts +0 -18
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.d.ts +0 -17
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +0 -21
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -28
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.d.ts +0 -18
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.d.ts +0 -8
- package/dist/components/inputs/DateTime/shared/MonthPicker.d.ts +0 -11
- package/dist/components/inputs/DateTime/shared/RangeCalendar.d.ts +0 -26
- package/dist/components/inputs/DateTime/shared/TimeField.d.ts +0 -12
- package/dist/components/inputs/DateTime/shared/TimePickerForm.d.ts +0 -10
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +0 -25
- package/dist/components/inputs/DateTime/shared/YearPicker.d.ts +0 -12
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +0 -15
- package/dist/components/inputs/DateTime/shared/datePickerValue.utils.d.ts +0 -1
- package/dist/components/inputs/DateTime/shared/datePickerValue.utils.spec.d.ts +0 -1
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +0 -2
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +0 -1
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +0 -41
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +0 -1
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.d.ts +0 -2
- package/dist/components/inputs/File/FileUpload.d.ts +0 -4
- package/dist/components/inputs/File/FileUploadContainer.d.ts +0 -3
- package/dist/components/inputs/File/FileUploadContainer.js +0 -22
- package/dist/components/inputs/File/InputUpload.d.ts +0 -4
- package/dist/components/inputs/File/InputUpload.js +0 -157
- package/dist/components/inputs/File/index.d.ts +0 -9
- package/dist/components/inputs/File/shared/FileCard.d.ts +0 -9
- package/dist/components/inputs/File/shared/FileCardList.d.ts +0 -9
- package/dist/components/inputs/File/shared/FileUploadContent.d.ts +0 -10
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.d.ts +0 -9
- package/dist/components/inputs/File/shared/FileUploadContentError.d.ts +0 -11
- package/dist/components/inputs/File/shared/FileUploadContentFilled.d.ts +0 -11
- package/dist/components/inputs/File/shared/FileUploadContentLoading.d.ts +0 -9
- package/dist/components/inputs/File/shared/InputUploadContent.d.ts +0 -9
- package/dist/components/inputs/File/shared/InputUploadFilled.d.ts +0 -8
- package/dist/components/inputs/FormField/FormField.d.ts +0 -20
- package/dist/components/inputs/FormField/FormField.js +0 -127
- package/dist/components/inputs/FormField/FormFieldHeaderClose.d.ts +0 -5
- package/dist/components/inputs/FormField/FormFieldHelper.d.ts +0 -8
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +0 -13
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +0 -23
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +0 -494
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +0 -36
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +0 -338
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.d.ts +0 -7
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +0 -61
- package/dist/components/inputs/Input/TextArea/TextArea.d.ts +0 -19
- package/dist/components/inputs/Input/TextArea/TextArea.js +0 -346
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +0 -23
- package/dist/components/inputs/Input/TextInput/TextInput.js +0 -470
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +0 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +0 -22
- package/dist/components/inputs/RadioGroup/RadioGroup.js +0 -371
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +0 -12
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +0 -4
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +0 -176
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +0 -15
- package/dist/components/inputs/Selection/Select/QuerySelect.js +0 -172
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +0 -5
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +0 -15
- package/dist/components/inputs/Selection/shared/SelectInputTags.d.ts +0 -12
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +0 -9
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.d.ts +0 -7
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.d.ts +0 -4
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.d.ts +0 -6
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.d.ts +0 -5
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +0 -5
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +0 -9
- package/dist/components/inputs/Selection/shared/select.context.d.ts +0 -32
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +0 -23
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +0 -1
- package/dist/components/inputs/Selection/shared/useSelectItems.d.ts +0 -23
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +0 -84
- package/dist/components/inputs/Slider/Slider.d.ts +0 -19
- package/dist/components/inputs/Slider/Slider.js +0 -285
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.d.ts +0 -7
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.d.ts +0 -10
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.d.ts +0 -6
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.d.ts +0 -2
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.d.ts +0 -2
- package/dist/components/inputs/TextEditor/textEditor.types.d.ts +0 -5
- package/dist/components/inputs/Toggle/Toggle.d.ts +0 -16
- package/dist/components/inputs/Toggle/Toggle.js +0 -234
- package/dist/components/inputs/shared/CheckContent.d.ts +0 -9
- package/dist/components/inputs/shared/InputClear.d.ts +0 -10
- package/dist/components/inputs/shared/TooltipWrapper.d.ts +0 -10
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +0 -15
- package/dist/components/navigation/Accordion/Accordion.d.ts +0 -3
- package/dist/components/navigation/Accordion/Accordion.js +0 -34
- package/dist/components/navigation/Accordion/AccordionItem.d.ts +0 -2
- package/dist/components/navigation/Stepper/Stepper.d.ts +0 -2
- package/dist/components/navigation/Stepper/Stepper.js +0 -34
- package/dist/components/navigation/Stepper/StepperItem.d.ts +0 -2
- package/dist/components/navigation/Stepper/StepperSeparator.d.ts +0 -5
- package/dist/components/overlays/ActionModal/ActionModal.d.ts +0 -24
- package/dist/components/overlays/ActionModal/ActionModal.js +0 -54
- package/dist/components/overlays/BottomSheet/BottomSheet.d.ts +0 -32
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.d.ts +0 -13
- package/dist/components/overlays/Drawer/Drawer.d.ts +0 -15
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +0 -17
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +0 -45
- package/dist/components/overlays/Tooltip/Tooltip.d.ts +0 -13
- package/dist/components/overlays/Tooltip/TooltipEllipsis.d.ts +0 -8
- package/dist/components/segment/Segment.d.ts +0 -4
- package/dist/components/segment/SegmentItem.d.ts +0 -2
- package/dist/components/shared/pagination/Pagination.d.ts +0 -9
- package/dist/components/shared/pagination/Pagination.js +0 -45
- package/dist/components/shared/pagination/minWidth.cva.d.ts +0 -3
- package/dist/components/status/Alert/Alert.d.ts +0 -11
- package/dist/components/status/Alert/Alert.js +0 -47
- package/dist/components/status/Loader/Loader.d.ts +0 -5
- package/dist/components/status/Toast/Toast.d.ts +0 -14
- package/dist/components/text/Link/Link.d.ts +0 -9
- package/dist/components/text/Pill/Pill.d.ts +0 -15
- package/dist/components/text/Tag/Tag.d.ts +0 -15
- package/dist/components/text/Typography/Typography.d.ts +0 -11
- package/dist/components/text/Typography/Typography.js +0 -16
- package/dist/hooks/useFormAutosave.spec.d.ts +0 -1
- package/dist/hooks/useKeyInteractions.spec.d.ts +0 -1
- package/dist/hooks/useQueryAutocomplete.d.ts +0 -13
- package/dist/rhf/entrypoints.type-test.d.ts +0 -1
- package/dist/types/react-query.d.ts +0 -6
- package/dist/utils/array.utils.spec.d.ts +0 -1
- package/dist/utils/compoundMapper.spec.d.ts +0 -1
- package/dist/utils/date-time.utils.spec.d.ts +0 -1
- package/dist/utils/date.utils.spec.d.ts +0 -1
- package/dist/utils/intl.utils.spec.d.ts +0 -1
- package/dist/utils/query.utils.d.ts +0 -4
- package/dist/utils/rest.utils.d.ts +0 -10
- package/dist/utils/rest.utils.js +0 -33
- package/dist/utils/style-merge.util.spec.d.ts +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { IntlUtils } from "../utils/intl.utils.js";
|
|
2
|
+
import { DateUtils } from "../utils/date.utils.js";
|
|
2
3
|
import { StringUtils } from "../utils/string.utils.js";
|
|
3
4
|
import { ZodUtils } from "../utils/zod.utils.js";
|
|
4
|
-
import { DateUtils } from "../utils/date.utils.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import i18next from "i18next";
|
|
7
7
|
//#region src/helpers/dynamicColumns.ts
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const DEFAULT_NAMESPACE = "dynamicColumns";
|
|
9
|
+
const FORMAT_MAP = {
|
|
10
10
|
datetime: (value) => DateUtils.formatDate(new Date(value)),
|
|
11
11
|
dateRange: (value) => {
|
|
12
12
|
return `${DateUtils.formatDate(new Date(value.start))} - ${DateUtils.formatDate(new Date(value.end))}`;
|
|
@@ -20,22 +20,22 @@ var FORMAT_MAP = {
|
|
|
20
20
|
return value ? "Yes" : "No";
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
const ZOD_TYPE_FORMAT_MAP = [
|
|
24
24
|
[z.ZodEnum, FORMAT_MAP.enum],
|
|
25
25
|
[z.ZodNumber, FORMAT_MAP.number],
|
|
26
26
|
[z.ZodString, FORMAT_MAP.string],
|
|
27
27
|
[z.ZodBoolean, FORMAT_MAP.boolean],
|
|
28
28
|
[z.ZodISODateTime, FORMAT_MAP.datetime]
|
|
29
29
|
];
|
|
30
|
-
|
|
30
|
+
const configValueToColumnDef = (value) => {
|
|
31
31
|
if (typeof value === "function" || typeof value === "string") return { cell: value };
|
|
32
32
|
if (typeof value === "boolean" || value === void 0) return {};
|
|
33
33
|
return value;
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
const convertEntriesToColumnDefs = (entries) => {
|
|
36
36
|
return entries.map(([key, value]) => [key, configValueToColumnDef(value)]);
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
const customConfigValueToColumnDef = (value) => {
|
|
39
39
|
if (typeof value === "string") return {
|
|
40
40
|
accessorKey: value,
|
|
41
41
|
cell: value
|
|
@@ -43,13 +43,13 @@ var customConfigValueToColumnDef = (value) => {
|
|
|
43
43
|
if (typeof value === "function") return { cell: value };
|
|
44
44
|
return value;
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
const convertCustomEntriesToColumnDefs = (entries) => {
|
|
47
47
|
return entries.map(([key, value]) => [key, customConfigValueToColumnDef(value)]);
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
const excludeEntries = (entries) => {
|
|
50
50
|
return entries.filter(([, value]) => value !== false && value !== void 0);
|
|
51
51
|
};
|
|
52
|
-
|
|
52
|
+
const sortColumns = (columns, orderKeys) => {
|
|
53
53
|
if (!orderKeys) return columns;
|
|
54
54
|
const wildcardIndex = orderKeys.indexOf("*");
|
|
55
55
|
if (wildcardIndex === -1) return columns.sort((columnA, columnB) => {
|
|
@@ -84,7 +84,7 @@ var sortColumns = (columns, orderKeys) => {
|
|
|
84
84
|
...after
|
|
85
85
|
];
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
const formatValueByType = (value, schemaType) => {
|
|
88
88
|
if (value === null || value === void 0) return null;
|
|
89
89
|
if (ZodUtils.isDateRange(schemaType)) return FORMAT_MAP.dateRange(value);
|
|
90
90
|
const unwrappedType = ZodUtils.unwrapZodType(schemaType);
|
|
@@ -97,12 +97,12 @@ var formatValueByType = (value, schemaType) => {
|
|
|
97
97
|
if (formatFunction) return formatFunction(value);
|
|
98
98
|
return String(value);
|
|
99
99
|
};
|
|
100
|
-
|
|
100
|
+
const getNestedValue = (obj, path) => {
|
|
101
101
|
return path.split(".").reduce((current, key) => {
|
|
102
102
|
return current && typeof current === "object" ? current[key] : void 0;
|
|
103
103
|
}, obj);
|
|
104
104
|
};
|
|
105
|
-
|
|
105
|
+
const getKeyType = (schema, key) => {
|
|
106
106
|
const pathParts = key.split(".");
|
|
107
107
|
let currentType = schema.shape[pathParts[0]];
|
|
108
108
|
for (let i = 1; i < pathParts.length; i++) if (currentType instanceof z.ZodObject) currentType = currentType.shape[pathParts[i]];
|
|
@@ -112,7 +112,7 @@ var getKeyType = (schema, key) => {
|
|
|
112
112
|
}
|
|
113
113
|
return currentType;
|
|
114
114
|
};
|
|
115
|
-
|
|
115
|
+
const getCellFunction = (schema, schemaKey, columnDef, options) => {
|
|
116
116
|
const { cell } = columnDef;
|
|
117
117
|
if (typeof cell === "function") return cell;
|
|
118
118
|
return ({ data }) => {
|
|
@@ -125,17 +125,17 @@ var getCellFunction = (schema, schemaKey, columnDef, options) => {
|
|
|
125
125
|
return finalValue;
|
|
126
126
|
};
|
|
127
127
|
};
|
|
128
|
-
|
|
128
|
+
const normalizeSortable = (sortable) => {
|
|
129
129
|
if (!sortable) return;
|
|
130
130
|
if (Array.isArray(sortable)) return sortable;
|
|
131
131
|
if (sortable instanceof z.ZodEnum) return Object.values(sortable.enum);
|
|
132
132
|
};
|
|
133
|
-
|
|
133
|
+
const getDefaultColumnHeader = (key, options) => {
|
|
134
134
|
const localeKey = `${options.namespace ?? DEFAULT_NAMESPACE}.${key}`;
|
|
135
135
|
if (i18next.exists(localeKey)) return String(i18next.t(localeKey));
|
|
136
136
|
return StringUtils.capitalize(key);
|
|
137
137
|
};
|
|
138
|
-
|
|
138
|
+
const overridePresetColumnsHeaders = (presetColumns, options) => {
|
|
139
139
|
const namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
140
140
|
return presetColumns.map((columnDef) => {
|
|
141
141
|
const localeKey = `${namespace}.${columnDef.id}`;
|
|
@@ -146,7 +146,7 @@ var overridePresetColumnsHeaders = (presetColumns, options) => {
|
|
|
146
146
|
};
|
|
147
147
|
});
|
|
148
148
|
};
|
|
149
|
-
|
|
149
|
+
const populateColumnDef = (schema, key, columnDef, options, sortableKeys) => {
|
|
150
150
|
const id = columnDef.id ?? key;
|
|
151
151
|
const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
|
|
152
152
|
const header = columnDef.header ?? getDefaultColumnHeader(key, options);
|
|
@@ -165,7 +165,7 @@ var populateColumnDef = (schema, key, columnDef, options, sortableKeys) => {
|
|
|
165
165
|
cell
|
|
166
166
|
};
|
|
167
167
|
};
|
|
168
|
-
|
|
168
|
+
const populateCustomColumnDef = (schema, key, columnDef, options, sortableKeys) => {
|
|
169
169
|
const id = columnDef.id ?? key;
|
|
170
170
|
const accessorKey = columnDef.accessorKey ?? id;
|
|
171
171
|
const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
|
|
@@ -185,7 +185,7 @@ var populateCustomColumnDef = (schema, key, columnDef, options, sortableKeys) =>
|
|
|
185
185
|
cell
|
|
186
186
|
};
|
|
187
187
|
};
|
|
188
|
-
|
|
188
|
+
const addMissingSchemaFields = (schema, existingColumns, options, sortableKeys) => {
|
|
189
189
|
const schemaFields = getAllSchemaKeys(schema);
|
|
190
190
|
const definedFields = new Set(existingColumns.map((col) => col.id));
|
|
191
191
|
const additionalColumns = schemaFields.filter((field) => !definedFields.has(field)).map((field) => {
|
|
@@ -193,7 +193,7 @@ var addMissingSchemaFields = (schema, existingColumns, options, sortableKeys) =>
|
|
|
193
193
|
});
|
|
194
194
|
return [...existingColumns, ...additionalColumns];
|
|
195
195
|
};
|
|
196
|
-
|
|
196
|
+
const removeOverriddenPresetColumns = (presetColumns, options) => {
|
|
197
197
|
if (presetColumns.length === 0) return presetColumns;
|
|
198
198
|
const usedColumnsIds = Object.entries(options.columns ?? {}).map(([key, value]) => {
|
|
199
199
|
return value.id ?? key;
|
|
@@ -201,13 +201,13 @@ var removeOverriddenPresetColumns = (presetColumns, options) => {
|
|
|
201
201
|
const usedCustomColumnsIds = Object.entries(options.customColumns ?? {}).map(([key, value]) => {
|
|
202
202
|
return value.id ?? key;
|
|
203
203
|
});
|
|
204
|
-
const usedIds = new Set([...usedColumnsIds, ...usedCustomColumnsIds]);
|
|
204
|
+
const usedIds = /* @__PURE__ */ new Set([...usedColumnsIds, ...usedCustomColumnsIds]);
|
|
205
205
|
return presetColumns.filter((column) => {
|
|
206
206
|
if (!column.id) return true;
|
|
207
207
|
return !usedIds.has(column.id);
|
|
208
208
|
});
|
|
209
209
|
};
|
|
210
|
-
|
|
210
|
+
const getAllSchemaKeys = (schema) => {
|
|
211
211
|
const keys = [];
|
|
212
212
|
const { shape } = schema;
|
|
213
213
|
const traverse = (obj, prefix = "") => {
|
|
@@ -220,24 +220,24 @@ var getAllSchemaKeys = (schema) => {
|
|
|
220
220
|
traverse(shape);
|
|
221
221
|
return keys;
|
|
222
222
|
};
|
|
223
|
-
|
|
223
|
+
const validateCustomColumnKeys = (schema, customColumnKeys) => {
|
|
224
224
|
const schemaKeys = getAllSchemaKeys(schema);
|
|
225
225
|
const invalidCustomColumnKeys = customColumnKeys.filter((key) => schemaKeys.includes(key));
|
|
226
226
|
if (invalidCustomColumnKeys.length > 0) throw new Error(`Invalid custom column keys: [${invalidCustomColumnKeys.join(", ")}]. Custom column keys cannot be part of the schema. Define these columns in the "columns" property instead.`);
|
|
227
227
|
};
|
|
228
|
-
|
|
228
|
+
const validateOptionKeyArray = (usedKeys, optionKeys, optionName) => {
|
|
229
229
|
if (!optionKeys) return;
|
|
230
230
|
const extraUnusedKeys = optionKeys.filter((key) => !usedKeys.has(key));
|
|
231
231
|
if (extraUnusedKeys.length > 0) throw new Error(`Found unnecessary keys in "${optionName}": [${extraUnusedKeys.join(", ")}].\n\nAll available options are: [${Array.from(usedKeys).join(", ")}].`);
|
|
232
232
|
};
|
|
233
|
-
|
|
233
|
+
const validateParams = (schema, presetColumns, options) => {
|
|
234
234
|
const { columns, customColumns, sortable, order, disableFormatting, includeAll } = options;
|
|
235
235
|
const columnKeys = Object.keys(columns ?? {});
|
|
236
236
|
const customColumnKeys = customColumns ? Object.keys(customColumns) : [];
|
|
237
|
-
const usedKeys = new Set([...columnKeys, ...customColumnKeys]);
|
|
237
|
+
const usedKeys = /* @__PURE__ */ new Set([...columnKeys, ...customColumnKeys]);
|
|
238
238
|
const presetKeys = presetColumns.map((column) => column.id).filter((id) => id !== void 0);
|
|
239
239
|
const schemaKeys = includeAll ? getAllSchemaKeys(schema) : [];
|
|
240
|
-
const allKeys = new Set([
|
|
240
|
+
const allKeys = /* @__PURE__ */ new Set([
|
|
241
241
|
...presetKeys,
|
|
242
242
|
...usedKeys,
|
|
243
243
|
...schemaKeys,
|
|
@@ -248,7 +248,7 @@ var validateParams = (schema, presetColumns, options) => {
|
|
|
248
248
|
validateOptionKeyArray(allKeys, order, "order");
|
|
249
249
|
validateOptionKeyArray(usedKeys, disableFormatting, "disableFormatting");
|
|
250
250
|
};
|
|
251
|
-
|
|
251
|
+
const dynamicColumns = ({ schema, preset = [], options }) => {
|
|
252
252
|
validateParams(schema, preset, options);
|
|
253
253
|
const sortableKeys = normalizeSortable(options.sortable);
|
|
254
254
|
let entries = Object.entries(options.columns ?? {});
|
|
@@ -269,7 +269,8 @@ var dynamicColumns = ({ schema, preset = [], options }) => {
|
|
|
269
269
|
...columns,
|
|
270
270
|
...customColumns
|
|
271
271
|
];
|
|
272
|
-
|
|
272
|
+
const allColumns = options.includeAll ? addMissingSchemaFields(schema, mergedColumns, options, sortableKeys) : mergedColumns;
|
|
273
|
+
return sortColumns(allColumns, options.order);
|
|
273
274
|
};
|
|
274
275
|
//#endregion
|
|
275
|
-
export { dynamicColumns };
|
|
276
|
+
export { dynamicColumns, sortColumns };
|
|
@@ -1,86 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { FormInstance } from "../components/inputs/shared/form.binding.js";
|
|
2
|
+
import { InputComponentProps, InputComponentType, InputDef, InputDefBaseProps, InputWrapperType } from "../components/inputs/Inputs/InputItem.js";
|
|
3
|
+
import { ZodUtils } from "../utils/zod.utils.js";
|
|
4
|
+
import { ReactElement } from "react";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
//#region src/helpers/dynamicInputs.d.ts
|
|
6
7
|
declare const defaultComponentTypes: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
readonly datetime: "datePicker";
|
|
9
|
+
readonly dateRange: "dateRangePicker";
|
|
10
|
+
readonly boolean: "toggle";
|
|
11
|
+
readonly number: "numberInput";
|
|
12
|
+
readonly enum: "select";
|
|
13
|
+
readonly string: "textInput";
|
|
14
|
+
readonly email: "textInput";
|
|
15
|
+
readonly object: "unknown";
|
|
16
|
+
readonly array: "select";
|
|
17
|
+
readonly uuid: "select";
|
|
18
|
+
readonly unknown: "unknown";
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
type DefaultComponentType<TZodType extends z.ZodType> = ZodUtils.ZodTypeSwitch<TZodType, typeof defaultComponentTypes>;
|
|
21
|
+
type AllowedComponentType<TZodType extends z.ZodType> = ZodUtils.ZodTypeSwitch<TZodType, {
|
|
22
|
+
datetime: "datePicker" | "dateTimePicker" | "timePicker";
|
|
23
|
+
dateRange: "dateRangePicker";
|
|
24
|
+
boolean: "toggle" | "checkbox";
|
|
25
|
+
number: "numberInput" | "slider" | "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
26
|
+
enum: "select" | "querySelect" | "autocomplete" | "segment";
|
|
27
|
+
string: "textInput" | "passwordInput" | "textArea" | "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
28
|
+
email: "textInput";
|
|
29
|
+
array: "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
30
|
+
object: InputComponentType;
|
|
31
|
+
unknown: InputComponentType;
|
|
32
|
+
uuid: "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
32
33
|
}>;
|
|
33
34
|
interface DynamicInputDefBase<TProps> {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
label?: string;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
props?: Partial<TProps>;
|
|
38
|
+
inputWrapper?: InputWrapperType;
|
|
38
39
|
}
|
|
39
|
-
type ConfigInputDef<TSchema extends z.ZodObject<any>, K extends keyof z.infer<TSchema>> = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
[T in DefaultComponentType<TSchema["shape"][K]>]: {
|
|
46
|
-
type?: never;
|
|
47
|
-
} & DynamicInputDefBase<InputDefBaseProps<InputComponentProps<T>>>;
|
|
48
|
-
}[DefaultComponentType<TSchema["shape"][K]>];
|
|
40
|
+
type ConfigInputDef<TSchema extends z.ZodObject<any>, K extends keyof z.infer<TSchema>> = { [T in AllowedComponentType<TSchema["shape"][K]>]: {
|
|
41
|
+
type: T;
|
|
42
|
+
} & DynamicInputDefBase<InputDefBaseProps<InputComponentProps<T>>>; }[AllowedComponentType<TSchema["shape"][K]>];
|
|
43
|
+
type UnknownInputDef<TSchema extends z.ZodObject<any>, K extends keyof z.infer<TSchema>> = { [T in DefaultComponentType<TSchema["shape"][K]>]: {
|
|
44
|
+
type?: never;
|
|
45
|
+
} & DynamicInputDefBase<InputDefBaseProps<InputComponentProps<T>>>; }[DefaultComponentType<TSchema["shape"][K]>];
|
|
49
46
|
type RenderInputDef<TSchema extends z.ZodObject<any>, K extends keyof z.infer<TSchema>> = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
render: (field: {
|
|
48
|
+
form: FormInstance<z.infer<TSchema>>;
|
|
49
|
+
name: K;
|
|
50
|
+
}, form: FormInstance<z.infer<TSchema>>) => ReactElement;
|
|
54
51
|
} & DynamicInputDefBase<Record<string, never>>;
|
|
55
52
|
type DynamicInputDef<TSchema extends z.ZodObject<any>, K extends keyof z.infer<TSchema>> = ConfigInputDef<TSchema, K> | UnknownInputDef<TSchema, K> | RenderInputDef<TSchema, K>;
|
|
56
|
-
type InputsConfig<TSchema extends z.ZodObject<any>> = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
type GlobalProps = {
|
|
63
|
-
[T in Exclude<InputComponentType, "unknown">]: InputDefBaseProps<InputComponentProps<T>>;
|
|
64
|
-
}[Exclude<InputComponentType, "unknown">];
|
|
53
|
+
type InputsConfig<TSchema extends z.ZodObject<any>> = { [K in keyof z.infer<TSchema>]?: DynamicInputDef<TSchema, K> | ((field: {
|
|
54
|
+
form: FormInstance<z.infer<TSchema>>;
|
|
55
|
+
name: K;
|
|
56
|
+
}, form: FormInstance<z.infer<TSchema>>) => ReactElement) | boolean; };
|
|
57
|
+
type GlobalProps = { [T in Exclude<InputComponentType, "unknown">]: InputDefBaseProps<InputComponentProps<T>>; }[Exclude<InputComponentType, "unknown">];
|
|
65
58
|
type SchemaKeyOrString<TSchema extends z.ZodObject<any>> = keyof z.infer<TSchema> | (string & {});
|
|
66
|
-
|
|
59
|
+
type DynamicInputsObjectSchema<TSchema extends z.ZodType> = TSchema extends z.ZodObject<any> ? TSchema : Extract<ZodUtils.UnwrapZod<TSchema>, z.ZodObject<any>>;
|
|
67
60
|
interface DynamicInputsObjectOptions<TSchema extends z.ZodObject<any>> {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
inputs?: InputsConfig<TSchema>;
|
|
62
|
+
order?: SchemaKeyOrString<TSchema>[];
|
|
63
|
+
globalProps?: Partial<GlobalProps>;
|
|
64
|
+
globalInputWrapper?: InputWrapperType;
|
|
65
|
+
namespace?: string;
|
|
66
|
+
overridePresetLocales?: boolean;
|
|
67
|
+
includeAll?: boolean;
|
|
75
68
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
type DynamicInputsOptions<TSchema extends z.ZodType> = DynamicInputsObjectOptions<DynamicInputsObjectSchema<TSchema>>;
|
|
70
|
+
interface DynamicInputsParams<TSchema extends z.ZodType> {
|
|
71
|
+
schema: TSchema;
|
|
72
|
+
preset?: InputDef<z.infer<DynamicInputsObjectSchema<TSchema>>>[];
|
|
73
|
+
options: DynamicInputsOptions<TSchema>;
|
|
81
74
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
export
|
|
86
|
-
export {};
|
|
75
|
+
declare function dynamicInputs<TSchema extends z.ZodObject<any>>(params: DynamicInputsParams<TSchema>): InputDef<z.infer<TSchema>>[];
|
|
76
|
+
declare function dynamicInputs<TRawSchema extends z.ZodType>(params: DynamicInputsParams<TRawSchema>): InputDef<z.infer<DynamicInputsObjectSchema<TRawSchema>>>[];
|
|
77
|
+
//#endregion
|
|
78
|
+
export { AllowedComponentType, DefaultComponentType, DynamicInputsObjectSchema, DynamicInputsOptions, DynamicInputsParams, dynamicInputs };
|
|
@@ -3,7 +3,7 @@ import { ZodUtils } from "../utils/zod.utils.js";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import i18next from "i18next";
|
|
5
5
|
//#region src/helpers/dynamicInputs.ts
|
|
6
|
-
|
|
6
|
+
const defaultComponentTypes = {
|
|
7
7
|
datetime: "datePicker",
|
|
8
8
|
dateRange: "dateRangePicker",
|
|
9
9
|
boolean: "toggle",
|
|
@@ -16,7 +16,7 @@ var defaultComponentTypes = {
|
|
|
16
16
|
uuid: "select",
|
|
17
17
|
unknown: "unknown"
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
const ZOD_TYPE_COMPONENT_TYPE = [
|
|
20
20
|
[z.ZodBoolean, defaultComponentTypes.boolean],
|
|
21
21
|
[z.ZodNumber, defaultComponentTypes.number],
|
|
22
22
|
[z.ZodEnum, defaultComponentTypes.enum],
|
|
@@ -27,8 +27,8 @@ var ZOD_TYPE_COMPONENT_TYPE = [
|
|
|
27
27
|
[z.ZodArray, defaultComponentTypes.array],
|
|
28
28
|
[z.ZodUUID, defaultComponentTypes.uuid]
|
|
29
29
|
];
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const DEFAULT_NAMESPACE = "dynamicInputs";
|
|
31
|
+
const sortInputDefs = (inputDefs, orderKeys) => {
|
|
32
32
|
if (!orderKeys) return inputDefs;
|
|
33
33
|
return inputDefs.sort((a, b) => {
|
|
34
34
|
const orderMap = new Map(orderKeys.map((key, index) => [key, index]));
|
|
@@ -40,27 +40,27 @@ var sortInputDefs = (inputDefs, orderKeys) => {
|
|
|
40
40
|
return 0;
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
const excludeEntries = (entries) => {
|
|
44
44
|
return entries.filter(([, value]) => value !== false && value !== void 0);
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
const inputConfigToObjectDefinition = (value) => {
|
|
47
47
|
if (typeof value === "object") return value;
|
|
48
48
|
if (typeof value === "function") return { render: value };
|
|
49
49
|
return {};
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
const convertInputsConfigToObjectDefinitions = (entries) => {
|
|
52
52
|
return entries.map(([key, value]) => {
|
|
53
53
|
return [key, inputConfigToObjectDefinition(value)];
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
const getDefaultInputComponentType = (schemaType) => {
|
|
57
57
|
if (ZodUtils.isDateRange(schemaType)) return defaultComponentTypes.dateRange;
|
|
58
58
|
const unwrappedType = ZodUtils.unwrapZodType(schemaType);
|
|
59
59
|
const componentType = ZOD_TYPE_COMPONENT_TYPE.find(([zodType]) => unwrappedType instanceof zodType)?.[1];
|
|
60
60
|
if (componentType) return componentType;
|
|
61
61
|
return defaultComponentTypes.unknown;
|
|
62
62
|
};
|
|
63
|
-
|
|
63
|
+
const getDefaultSelectionItems = (keyType) => {
|
|
64
64
|
const unwrappedType = ZodUtils.unwrapZodType(keyType instanceof z.ZodArray ? keyType.element : keyType);
|
|
65
65
|
if (unwrappedType instanceof z.ZodEnum) return Object.values(unwrappedType.options).filter((value) => typeof value === "string").map((value) => ({
|
|
66
66
|
id: value,
|
|
@@ -68,10 +68,10 @@ var getDefaultSelectionItems = (keyType) => {
|
|
|
68
68
|
}));
|
|
69
69
|
return [];
|
|
70
70
|
};
|
|
71
|
-
|
|
71
|
+
const getDefaultSelectionMode = (keyType) => {
|
|
72
72
|
return keyType instanceof z.ZodArray ? "multiple" : "single";
|
|
73
73
|
};
|
|
74
|
-
|
|
74
|
+
const getDefaultProps = (componentType, keyType) => {
|
|
75
75
|
const props = {};
|
|
76
76
|
const unwrappedType = ZodUtils.unwrapZodType(keyType);
|
|
77
77
|
if ([
|
|
@@ -88,7 +88,7 @@ var getDefaultProps = (componentType, keyType) => {
|
|
|
88
88
|
].includes(componentType)) props.selectionMode = getDefaultSelectionMode(unwrappedType);
|
|
89
89
|
return props;
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
const getLabelAndPlaceholder = (value, options, schemaKey) => {
|
|
92
92
|
const namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
93
93
|
const stringKey = String(schemaKey);
|
|
94
94
|
let { label, placeholder } = value;
|
|
@@ -107,7 +107,7 @@ var getLabelAndPlaceholder = (value, options, schemaKey) => {
|
|
|
107
107
|
placeholder
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
|
-
|
|
110
|
+
const overridePresetLabelsAndPlaceholders = (presetInputDefs, options) => {
|
|
111
111
|
const namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
112
112
|
return presetInputDefs.map((inputDef) => {
|
|
113
113
|
const labelName = String(inputDef.name);
|
|
@@ -122,18 +122,18 @@ var overridePresetLabelsAndPlaceholders = (presetInputDefs, options) => {
|
|
|
122
122
|
};
|
|
123
123
|
});
|
|
124
124
|
};
|
|
125
|
-
|
|
125
|
+
const removeOverriddenPresetInputs = (presetInputs, options) => {
|
|
126
126
|
if (presetInputs.length === 0) return presetInputs;
|
|
127
127
|
const usedKeys = new Set(Object.keys(options.inputs ?? {}).map(String));
|
|
128
128
|
return presetInputs.filter((input) => !usedKeys.has(String(input.name)));
|
|
129
129
|
};
|
|
130
|
-
|
|
130
|
+
const validateParams = (schema, presetInputs, options) => {
|
|
131
131
|
const { inputs, order, includeAll } = options;
|
|
132
132
|
if (!order) return;
|
|
133
133
|
const inputKeys = Object.keys(inputs ?? {});
|
|
134
134
|
const presetKeys = presetInputs.map((input) => input.name).filter((name) => name !== void 0);
|
|
135
135
|
const schemaKeys = includeAll ? Object.keys(schema.shape) : [];
|
|
136
|
-
const allInputKeys = new Set([
|
|
136
|
+
const allInputKeys = /* @__PURE__ */ new Set([
|
|
137
137
|
...inputKeys,
|
|
138
138
|
...presetKeys,
|
|
139
139
|
...schemaKeys
|
|
@@ -141,7 +141,7 @@ var validateParams = (schema, presetInputs, options) => {
|
|
|
141
141
|
const unnecessaryOrderKeys = order.filter((key) => !allInputKeys.has(key));
|
|
142
142
|
if (unnecessaryOrderKeys.length > 0) throw new Error(`Found unnecessary keys in "order": [${unnecessaryOrderKeys.join(", ")}]. These keys are not found in any of the input definitions.\nAll defined input keys are: [${Array.from(allInputKeys).join(", ")}].\nIn the case of a preset input definition, the key is the name attribute.`);
|
|
143
143
|
};
|
|
144
|
-
|
|
144
|
+
const populateInputDef = (schema, schemaKey, value, options) => {
|
|
145
145
|
const name = String(schemaKey);
|
|
146
146
|
const { label, placeholder } = getLabelAndPlaceholder(value, options, schemaKey);
|
|
147
147
|
const inputWrapper = value.inputWrapper ?? options.globalInputWrapper;
|
|
@@ -167,7 +167,7 @@ var populateInputDef = (schema, schemaKey, value, options) => {
|
|
|
167
167
|
props
|
|
168
168
|
};
|
|
169
169
|
};
|
|
170
|
-
|
|
170
|
+
const addMissingSchemaFields = (schema, existingInputDefs, options) => {
|
|
171
171
|
const schemaFields = Object.keys(schema.shape);
|
|
172
172
|
const definedFields = new Set(existingInputDefs.map((def) => def.name));
|
|
173
173
|
const additionalInputDefs = schemaFields.filter((field) => !definedFields.has(field)).map((field) => {
|
|
@@ -187,7 +187,8 @@ function dynamicInputs({ schema: rawSchema, preset = [], options }) {
|
|
|
187
187
|
let presetInputDefs = removeOverriddenPresetInputs(preset, objectOptions);
|
|
188
188
|
if (objectOptions.overridePresetLocales) presetInputDefs = overridePresetLabelsAndPlaceholders(presetInputDefs, objectOptions);
|
|
189
189
|
const mergedInputDefs = [...presetInputDefs, ...inputDefs];
|
|
190
|
-
|
|
190
|
+
const allInputDefs = objectOptions.includeAll ? addMissingSchemaFields(schema, mergedInputDefs, objectOptions) : mergedInputDefs;
|
|
191
|
+
return sortInputDefs(allInputDefs, objectOptions.order);
|
|
191
192
|
}
|
|
192
193
|
//#endregion
|
|
193
|
-
export { dynamicInputs, getDefaultInputComponentType };
|
|
194
|
+
export { dynamicInputs, getDefaultInputComponentType, getDefaultSelectionMode };
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { UIForm } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { UIForm } from "./useForm.js";
|
|
2
|
+
//#region src/hooks/useAutosave.d.ts
|
|
3
|
+
interface UseAutosaveProps<TFieldValues extends Record<string, unknown>, TTransformedValues = TFieldValues, TResponse = unknown> {
|
|
4
|
+
form: UIForm<TFieldValues>;
|
|
5
|
+
delay?: number;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
trigger?: "change" | "blur";
|
|
8
|
+
onSave: (data: Partial<TTransformedValues>) => Promise<TResponse>;
|
|
9
|
+
onSaveSuccess?: () => void;
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
declare function useAutosave<TFieldValues extends Record<string, unknown>, TTransformedValues = TFieldValues, TResponse = unknown>({ form, delay, enabled, trigger, onSave, onSaveSuccess }: UseAutosaveProps<TFieldValues, TTransformedValues, TResponse>): void;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { UseAutosaveProps, useAutosave };
|
|
@@ -12,7 +12,7 @@ function diffLeftOnly(left, right) {
|
|
|
12
12
|
}, {});
|
|
13
13
|
return ObjectUtils.isEmpty(result) ? void 0 : result;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
const snapshot = (value) => structuredClone(value);
|
|
16
16
|
function pickChangedValues(source, changes) {
|
|
17
17
|
if (!ObjectUtils.isObject(changes) || Array.isArray(changes)) return source;
|
|
18
18
|
return Object.entries(changes).reduce((result, [key, value]) => {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
//#region src/hooks/useBreakpoint.d.ts
|
|
1
2
|
type Breakpoint = "sm" | "md" | "lg" | "xl";
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
declare function useBreakpoint(breakpointKey: Breakpoint): boolean;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { Breakpoint, useBreakpoint };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { UIConfig } from "../config/uiConfig.context.js";
|
|
1
2
|
import { c } from "react/compiler-runtime";
|
|
2
|
-
import {
|
|
3
|
+
import { useSyncExternalStore } from "react";
|
|
3
4
|
//#region src/hooks/useBreakpoint.ts
|
|
4
|
-
|
|
5
|
+
let breakpoints = null;
|
|
5
6
|
function getBreakpoints() {
|
|
6
7
|
if (breakpoints) return breakpoints;
|
|
7
8
|
if (typeof window === "undefined") return {
|
|
@@ -22,7 +23,8 @@ function getBreakpoints() {
|
|
|
22
23
|
return breakpoints;
|
|
23
24
|
}
|
|
24
25
|
function useBreakpoint(breakpointKey) {
|
|
25
|
-
const $ = c(
|
|
26
|
+
const $ = c(10);
|
|
27
|
+
const ui = UIConfig.useConfig();
|
|
26
28
|
let t0;
|
|
27
29
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
28
30
|
t0 = getBreakpoints();
|
|
@@ -30,14 +32,39 @@ function useBreakpoint(breakpointKey) {
|
|
|
30
32
|
} else t0 = $[0];
|
|
31
33
|
const breakpoints = t0;
|
|
32
34
|
if (!breakpoints) throw new Error("Tailwind config is missing theme.screens");
|
|
33
|
-
const
|
|
35
|
+
const query = `(min-width: ${breakpoints[breakpointKey]})`;
|
|
36
|
+
let t1;
|
|
37
|
+
if ($[1] !== query) {
|
|
38
|
+
t1 = typeof window === "undefined" ? null : window.matchMedia(query);
|
|
39
|
+
$[1] = query;
|
|
40
|
+
$[2] = t1;
|
|
41
|
+
} else t1 = $[2];
|
|
42
|
+
const mediaQuery = t1;
|
|
34
43
|
let t2;
|
|
35
|
-
if ($[
|
|
36
|
-
t2 =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
if ($[3] !== mediaQuery) {
|
|
45
|
+
t2 = (onStoreChange) => {
|
|
46
|
+
mediaQuery?.addEventListener("change", onStoreChange);
|
|
47
|
+
return () => mediaQuery?.removeEventListener("change", onStoreChange);
|
|
48
|
+
};
|
|
49
|
+
$[3] = mediaQuery;
|
|
50
|
+
$[4] = t2;
|
|
51
|
+
} else t2 = $[4];
|
|
52
|
+
const subscribe = t2;
|
|
53
|
+
let t3;
|
|
54
|
+
if ($[5] !== mediaQuery?.matches) {
|
|
55
|
+
t3 = () => mediaQuery?.matches ?? false;
|
|
56
|
+
$[5] = mediaQuery?.matches;
|
|
57
|
+
$[6] = t3;
|
|
58
|
+
} else t3 = $[6];
|
|
59
|
+
const getSnapshot = t3;
|
|
60
|
+
let t4;
|
|
61
|
+
if ($[7] !== breakpointKey || $[8] !== ui.responsive.ssrMatches) {
|
|
62
|
+
t4 = () => ui.responsive.ssrMatches[breakpointKey];
|
|
63
|
+
$[7] = breakpointKey;
|
|
64
|
+
$[8] = ui.responsive.ssrMatches;
|
|
65
|
+
$[9] = t4;
|
|
66
|
+
} else t4 = $[9];
|
|
67
|
+
return useSyncExternalStore(subscribe, getSnapshot, t4);
|
|
41
68
|
}
|
|
42
69
|
//#endregion
|
|
43
70
|
export { useBreakpoint };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/hooks/useDebounceCallback.d.ts
|
|
2
|
+
declare function useDebounceCallback<T extends (...args: any[]) => any>(callback?: T, { delay }?: {
|
|
3
|
+
delay?: number;
|
|
3
4
|
}): {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
callback: (...args: Parameters<T>) => void;
|
|
6
|
+
isDebouncing: boolean;
|
|
6
7
|
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { useDebounceCallback };
|