@povio/ui 3.1.0 → 3.2.0
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 +26 -11
- package/dist/assets/icons/AlignLeft.js +26 -11
- package/dist/assets/icons/AlignLeftRight.js +26 -11
- package/dist/assets/icons/AlignRight.js +26 -11
- package/dist/assets/icons/ArrowDropDown.js +26 -11
- package/dist/assets/icons/ArrowDropUp.js +26 -11
- package/dist/assets/icons/ArrowLeft.js +26 -11
- package/dist/assets/icons/ArrowRight.js +26 -11
- package/dist/assets/icons/Bold.js +26 -11
- package/dist/assets/icons/BulletedList.js +26 -11
- package/dist/assets/icons/Calendar.js +28 -13
- package/dist/assets/icons/Check.js +28 -13
- package/dist/assets/icons/CheckCircle.js +26 -11
- package/dist/assets/icons/CheckboxCheckmark.js +29 -14
- package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
- package/dist/assets/icons/ChevronDown.js +28 -13
- package/dist/assets/icons/ChevronLeft.js +28 -13
- package/dist/assets/icons/ChevronRight.js +28 -13
- package/dist/assets/icons/ChevronUp.js +28 -13
- package/dist/assets/icons/ChevronsLeft.js +28 -13
- package/dist/assets/icons/ChevronsRight.js +28 -13
- package/dist/assets/icons/Clock.js +26 -11
- package/dist/assets/icons/Close.js +26 -11
- package/dist/assets/icons/DateTime.js +35 -14
- package/dist/assets/icons/DragIndicator.js +26 -11
- package/dist/assets/icons/File.js +28 -13
- package/dist/assets/icons/Highlight.js +26 -11
- package/dist/assets/icons/HighlightOn.js +49 -15
- package/dist/assets/icons/Home.js +26 -11
- package/dist/assets/icons/Info.js +37 -16
- package/dist/assets/icons/Italic.js +26 -11
- package/dist/assets/icons/Link.js +26 -11
- package/dist/assets/icons/Menu.js +26 -11
- package/dist/assets/icons/NumberedList.js +26 -11
- package/dist/assets/icons/PointerHorizontal.js +26 -11
- package/dist/assets/icons/PointerVertical.js +26 -11
- package/dist/assets/icons/Search.js +26 -11
- package/dist/assets/icons/Send.js +28 -13
- package/dist/assets/icons/Strikethrough.js +26 -11
- package/dist/assets/icons/TextColor.js +48 -14
- package/dist/assets/icons/Today.js +26 -11
- package/dist/assets/icons/Underlined.js +28 -13
- package/dist/assets/icons/Upload.js +35 -14
- package/dist/assets/icons/Visibility.js +26 -11
- package/dist/assets/icons/VisibilityOff.js +26 -11
- package/dist/assets/icons/WarningFilled.js +28 -13
- package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
- package/dist/components/Menu/Menu.js +18 -2
- package/dist/components/Menu/MenuDesktop.js +41 -7
- package/dist/components/Menu/MenuItem.js +32 -9
- package/dist/components/Menu/MenuMobile.js +102 -39
- package/dist/components/Menu/MenuPopover.js +105 -29
- package/dist/components/buttons/Button/button.cva.d.ts +3 -3
- package/dist/components/buttons/IconButton/IconButton.js +40 -8
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
- package/dist/components/buttons/PillButton/PillButton.js +55 -17
- package/dist/components/buttons/PillButton/pillButton.cva.d.ts +1 -1
- package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
- package/dist/components/buttons/TextButton/TextButton.js +30 -8
- package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
- package/dist/components/buttons/shared/ButtonContent.js +80 -22
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/inputs/Checkbox/Checkbox.js +201 -35
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +380 -75
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +499 -186
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +14 -5
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +280 -46
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +7 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +616 -121
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +342 -119
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +310 -103
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +150 -33
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +233 -98
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +288 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +14 -3
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +359 -129
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +18 -1
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +104 -11
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +83 -28
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
- package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +4 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +211 -65
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +5 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +15 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +32 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +41 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +99 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
- package/dist/components/inputs/File/FileUpload.js +91 -46
- package/dist/components/inputs/File/FileUploadContainer.js +15 -7
- package/dist/components/inputs/File/InputUpload.js +317 -79
- package/dist/components/inputs/File/index.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +104 -41
- package/dist/components/inputs/File/shared/FileCardList.js +47 -12
- package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
- package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
- package/dist/components/inputs/File/shared/InputUploadContent.js +148 -34
- package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
- package/dist/components/inputs/File/shared/ProgressBar.js +102 -15
- package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +0 -11
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -18
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +119 -37
- package/dist/components/inputs/FormField/FormFieldError.js +25 -5
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +81 -22
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
- package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +13 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +14 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +446 -97
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +571 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +574 -0
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +8 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
- package/dist/components/inputs/Input/TextArea/TextArea.js +305 -90
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +429 -90
- package/dist/components/inputs/Input/shared/InputContent.js +193 -59
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
- package/dist/components/inputs/Inputs/Form.js +40 -11
- package/dist/components/inputs/Inputs/InputItem.d.ts +15 -21
- package/dist/components/inputs/Inputs/InputItem.js +69 -14
- package/dist/components/inputs/Inputs/Inputs.js +37 -11
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +3 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +353 -61
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +45 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +48 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +217 -22
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -18
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +107 -8
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +37 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +14 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.js +178 -0
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +227 -18
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +8 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +69 -18
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +393 -138
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +397 -116
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +164 -52
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +9 -3
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +14 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +43 -0
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +67 -36
- package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +6 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +12 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +8 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +54 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
- package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +83 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +612 -0
- package/dist/components/inputs/Slider/Slider.d.ts +2 -1
- package/dist/components/inputs/Slider/Slider.js +265 -76
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
- package/dist/components/inputs/TextEditor/TextEditor.js +447 -98
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
- package/dist/components/inputs/Toggle/Toggle.d.ts +1 -0
- package/dist/components/inputs/Toggle/Toggle.js +214 -37
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
- package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/components/inputs/shared/CheckContent.js +21 -11
- package/dist/components/inputs/shared/InputClear.d.ts +2 -1
- package/dist/components/inputs/shared/InputClear.js +88 -12
- package/dist/components/inputs/shared/TooltipWrapper.js +50 -11
- package/dist/components/inputs/shared/input.cva.d.ts +28 -0
- package/dist/components/inputs/shared/input.cva.js +38 -4
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +8 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +15 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +112 -0
- package/dist/components/navigation/Accordion/Accordion.js +69 -22
- package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
- package/dist/components/navigation/Stepper/Stepper.js +67 -22
- package/dist/components/navigation/Stepper/StepperItem.js +104 -31
- package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
- package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
- package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
- package/dist/components/overlays/Drawer/Drawer.js +62 -20
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +85 -28
- package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
- package/dist/components/segment/Segment.js +218 -57
- package/dist/components/segment/SegmentItem.js +67 -10
- package/dist/components/shared/pagination/Pagination.js +108 -22
- package/dist/components/shared/pagination/PaginationList.js +167 -64
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +97 -30
- package/dist/components/status/Loader/Loader.js +77 -22
- package/dist/components/status/Toast/Toast.js +28 -14
- package/dist/components/status/Toast/toast.cva.d.ts +1 -1
- package/dist/components/status/Toast/useToast.js +62 -57
- package/dist/components/table/ColumnConfig.js +158 -54
- package/dist/components/table/InfiniteTable.js +67 -16
- package/dist/components/table/PaginatedTable.js +84 -18
- package/dist/components/table/Table.js +28 -27
- package/dist/components/text/Link/Link.js +19 -7
- package/dist/components/text/Typography/Typography.js +23 -8
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +23 -9
- package/dist/config/router.context.js +42 -16
- package/dist/config/theme.context.js +98 -45
- package/dist/config/uiConfig.context.d.ts +20 -6
- package/dist/config/uiConfig.context.js +68 -14
- package/dist/config/uiOverrides.context.d.ts +30 -11
- package/dist/config/uiOverrides.context.js +54 -14
- package/dist/helpers/dynamicInputs.d.ts +12 -9
- package/dist/helpers/dynamicInputs.js +13 -8
- package/dist/hooks/useAutosave.d.ts +2 -1
- package/dist/hooks/useAutosave.js +12 -4
- package/dist/hooks/useAutosave.spec.d.ts +1 -0
- package/dist/hooks/useBreakpoint.js +16 -3
- package/dist/hooks/useDebounceCallback.js +51 -17
- package/dist/hooks/useFilters.js +125 -64
- package/dist/hooks/useForm.js +42 -8
- package/dist/hooks/useFormAutosave.d.ts +3 -1
- package/dist/hooks/useFormAutosave.js +122 -30
- package/dist/hooks/useFormAutosave.spec.d.ts +1 -0
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +91 -24
- package/dist/hooks/useKeyInteractions.d.ts +20 -0
- package/dist/hooks/useKeyInteractions.js +54 -0
- package/dist/hooks/useKeyInteractions.spec.d.ts +1 -0
- package/dist/hooks/useLocalStorage.js +43 -10
- package/dist/hooks/useLongPressRepeat.js +55 -20
- package/dist/hooks/usePagination.js +49 -19
- package/dist/hooks/useQueryAutocomplete.d.ts +14 -0
- package/dist/hooks/useQueryAutocomplete.js +72 -0
- package/dist/hooks/useScrollableListBox.js +37 -16
- package/dist/hooks/useSorting.js +69 -28
- package/dist/hooks/useStateAndRef.js +21 -7
- package/dist/hooks/useTableColumnConfig.js +124 -31
- package/dist/hooks/useTranslationMemo.js +25 -5
- package/dist/index.d.ts +18 -3
- package/dist/index.js +15 -5
- package/dist/tw-ui-plugin.js +6 -0
- package/dist/utils/date-time.utils.d.ts +38 -10
- package/dist/utils/date-time.utils.js +136 -22
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/dist/utils/zod.utils.d.ts +2 -0
- package/dist/utils/zod.utils.js +5 -0
- package/package.json +2 -2
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { ClassProp } from 'class-variance-authority/types';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import { ButtonConfig, ButtonContentConfig, ButtonIconSizeConfig, ButtonSizeConfig } from '../components/buttons/Button/button.cva';
|
|
4
|
-
import { StatusIconConfig, StatusSeparatorConfig, ToastConfig, ToastContainerConfig } from '../components/status/Toast/toast.cva';
|
|
5
3
|
import { CompoundMapper, ConfigSchema } from '../utils/compoundMapper';
|
|
6
4
|
import { StyleMergeUtils } from '../utils/style-merge.util';
|
|
7
5
|
export declare namespace UIOverrides {
|
|
8
6
|
export type Cva<T> = (props?: (T & ClassProp) | ClassProp) => string;
|
|
9
7
|
type GenericCva = Cva<unknown>;
|
|
10
8
|
type Mapper = CompoundMapper<unknown, ConfigSchema>;
|
|
11
|
-
type CvaOption<TConfig extends StyleMergeUtils.CvaConfigShape> = StyleMergeUtils.CvaConfigOverride<TConfig> | GenericCva;
|
|
12
9
|
type GenericCvaOption = StyleMergeUtils.CvaConfigOverride | GenericCva;
|
|
13
10
|
type OptionKey = {
|
|
14
11
|
[K in keyof Options]: Options[K] extends object ? `${K & string}.${keyof Options[K] & string}` : never;
|
|
@@ -27,10 +24,10 @@ export declare namespace UIOverrides {
|
|
|
27
24
|
export type OverrideVariantProps<TOverride> = VariantProps<ExtractConfig<TOverride>>;
|
|
28
25
|
export interface Options {
|
|
29
26
|
button: {
|
|
30
|
-
cva?:
|
|
31
|
-
sizeCva?:
|
|
32
|
-
contentCva?:
|
|
33
|
-
iconSize?:
|
|
27
|
+
cva?: GenericCvaOption;
|
|
28
|
+
sizeCva?: GenericCvaOption;
|
|
29
|
+
contentCva?: GenericCvaOption;
|
|
30
|
+
iconSize?: GenericCvaOption;
|
|
34
31
|
typography?: Mapper;
|
|
35
32
|
};
|
|
36
33
|
pillButton: {
|
|
@@ -41,18 +38,22 @@ export declare namespace UIOverrides {
|
|
|
41
38
|
cva?: GenericCvaOption;
|
|
42
39
|
iconCva?: GenericCvaOption;
|
|
43
40
|
typography?: Mapper;
|
|
41
|
+
contentClassName?: Mapper;
|
|
44
42
|
};
|
|
45
43
|
radio: {
|
|
46
44
|
cva?: GenericCvaOption;
|
|
45
|
+
contentWrapperCva?: GenericCvaOption;
|
|
46
|
+
contentRowCva?: GenericCvaOption;
|
|
47
47
|
typography?: Mapper;
|
|
48
|
+
contentClassName?: Mapper;
|
|
48
49
|
};
|
|
49
50
|
status: {
|
|
50
|
-
iconCva?:
|
|
51
|
-
separatorCva?:
|
|
51
|
+
iconCva?: GenericCvaOption;
|
|
52
|
+
separatorCva?: GenericCvaOption;
|
|
52
53
|
};
|
|
53
54
|
toast: {
|
|
54
|
-
cva?:
|
|
55
|
-
containerCva?:
|
|
55
|
+
cva?: GenericCvaOption;
|
|
56
|
+
containerCva?: GenericCvaOption;
|
|
56
57
|
buttonColor?: Mapper;
|
|
57
58
|
};
|
|
58
59
|
alert: {
|
|
@@ -60,9 +61,20 @@ export declare namespace UIOverrides {
|
|
|
60
61
|
};
|
|
61
62
|
input: {
|
|
62
63
|
baseCva?: GenericCvaOption;
|
|
64
|
+
clearClassCva?: GenericCvaOption;
|
|
65
|
+
contentWrapperCva?: GenericCvaOption;
|
|
63
66
|
sizeCva?: GenericCvaOption;
|
|
64
67
|
sideCva?: GenericCvaOption;
|
|
65
68
|
};
|
|
69
|
+
textArea: {
|
|
70
|
+
wrapperCva?: GenericCvaOption;
|
|
71
|
+
};
|
|
72
|
+
tooltipWrapper: {
|
|
73
|
+
triggerCva?: GenericCvaOption;
|
|
74
|
+
};
|
|
75
|
+
datePickerInput: {
|
|
76
|
+
contentRowCva?: GenericCvaOption;
|
|
77
|
+
};
|
|
66
78
|
label: {
|
|
67
79
|
cva?: GenericCvaOption;
|
|
68
80
|
typography?: Mapper;
|
|
@@ -70,6 +82,7 @@ export declare namespace UIOverrides {
|
|
|
70
82
|
toggle: {
|
|
71
83
|
cva?: GenericCvaOption;
|
|
72
84
|
typography?: Mapper;
|
|
85
|
+
contentClassName?: Mapper;
|
|
73
86
|
};
|
|
74
87
|
typography: {
|
|
75
88
|
cva?: GenericCvaOption;
|
|
@@ -142,11 +155,14 @@ export declare namespace UIOverrides {
|
|
|
142
155
|
cva?: GenericCvaOption;
|
|
143
156
|
};
|
|
144
157
|
formField: {
|
|
158
|
+
headerCva?: GenericCvaOption;
|
|
145
159
|
errorLabelCva?: GenericCvaOption;
|
|
146
160
|
helperLabelCva?: GenericCvaOption;
|
|
147
161
|
};
|
|
148
162
|
select: {
|
|
149
163
|
listBoxItemCva?: GenericCvaOption;
|
|
164
|
+
popoverCva?: GenericCvaOption;
|
|
165
|
+
tagsContentWrapperCva?: GenericCvaOption;
|
|
150
166
|
};
|
|
151
167
|
progressBar: {
|
|
152
168
|
cva?: GenericCvaOption;
|
|
@@ -155,6 +171,9 @@ export declare namespace UIOverrides {
|
|
|
155
171
|
fillCva?: GenericCvaOption;
|
|
156
172
|
valueCva?: GenericCvaOption;
|
|
157
173
|
};
|
|
174
|
+
fileUpload: {
|
|
175
|
+
dropZoneCva?: GenericCvaOption;
|
|
176
|
+
};
|
|
158
177
|
}
|
|
159
178
|
export type Config = Partial<Options>;
|
|
160
179
|
interface ProviderProps {
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import { StyleMergeUtils } from "../utils/style-merge.util.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { clsx } from "clsx";
|
|
4
|
-
import { createContext, use
|
|
5
|
+
import { createContext, use } from "react";
|
|
5
6
|
import { cva } from "class-variance-authority";
|
|
6
7
|
//#region src/config/uiOverrides.context.tsx
|
|
7
8
|
var UIOverrides;
|
|
8
9
|
(function(_UIOverrides) {
|
|
9
10
|
const Context = createContext(null);
|
|
10
|
-
_UIOverrides.Provider = (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
_UIOverrides.Provider = (t0) => {
|
|
12
|
+
const $ = c(3);
|
|
13
|
+
const { children, config } = t0;
|
|
14
|
+
let t1;
|
|
15
|
+
if ($[0] !== children || $[1] !== config) {
|
|
16
|
+
t1 = /* @__PURE__ */ jsx(Context.Provider, {
|
|
17
|
+
value: config,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
$[0] = children;
|
|
21
|
+
$[1] = config;
|
|
22
|
+
$[2] = t1;
|
|
23
|
+
} else t1 = $[2];
|
|
24
|
+
return t1;
|
|
15
25
|
};
|
|
16
26
|
const useConfig = () => {
|
|
17
27
|
return use(Context);
|
|
@@ -45,21 +55,51 @@ var UIOverrides;
|
|
|
45
55
|
return "base" in item;
|
|
46
56
|
};
|
|
47
57
|
function useCva(key, fallback) {
|
|
58
|
+
const $ = c(6);
|
|
48
59
|
const override = useCvaOverride(key);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (isCvaFunction(
|
|
52
|
-
|
|
60
|
+
let t0;
|
|
61
|
+
bb0: {
|
|
62
|
+
if (isCvaFunction(override)) {
|
|
63
|
+
t0 = override;
|
|
64
|
+
break bb0;
|
|
65
|
+
}
|
|
66
|
+
if (isCvaFunction(fallback)) {
|
|
67
|
+
t0 = fallback;
|
|
68
|
+
break bb0;
|
|
69
|
+
}
|
|
70
|
+
if (!isDefinition(fallback)) {
|
|
71
|
+
t0 = _temp;
|
|
72
|
+
break bb0;
|
|
73
|
+
}
|
|
53
74
|
const definition = fallback;
|
|
54
75
|
const typedOverride = override;
|
|
55
76
|
if (isCvaOverrideConfig(typedOverride)) {
|
|
56
|
-
|
|
57
|
-
|
|
77
|
+
let t1;
|
|
78
|
+
if ($[0] !== definition || $[1] !== typedOverride) {
|
|
79
|
+
const mergedDefinition = StyleMergeUtils.mergeCvaDefinition(definition, typedOverride);
|
|
80
|
+
t1 = cva(clsx(mergedDefinition.base), mergedDefinition.config);
|
|
81
|
+
$[0] = definition;
|
|
82
|
+
$[1] = typedOverride;
|
|
83
|
+
$[2] = t1;
|
|
84
|
+
} else t1 = $[2];
|
|
85
|
+
t0 = t1;
|
|
86
|
+
break bb0;
|
|
58
87
|
}
|
|
59
|
-
|
|
60
|
-
|
|
88
|
+
let t1;
|
|
89
|
+
if ($[3] !== definition.base || $[4] !== definition.config) {
|
|
90
|
+
t1 = cva(clsx(definition.base), definition.config);
|
|
91
|
+
$[3] = definition.base;
|
|
92
|
+
$[4] = definition.config;
|
|
93
|
+
$[5] = t1;
|
|
94
|
+
} else t1 = $[5];
|
|
95
|
+
t0 = t1;
|
|
96
|
+
}
|
|
97
|
+
return t0;
|
|
61
98
|
}
|
|
62
99
|
_UIOverrides.useCva = useCva;
|
|
100
|
+
function _temp() {
|
|
101
|
+
return "";
|
|
102
|
+
}
|
|
63
103
|
_UIOverrides.useMapper = (key, fallback) => {
|
|
64
104
|
const uiOverrides = useConfig();
|
|
65
105
|
if (!uiOverrides) return fallback;
|
|
@@ -21,14 +21,14 @@ export type AllowedComponentType<TZodType extends z.ZodType> = ZodUtils.ZodTypeS
|
|
|
21
21
|
datetime: "datePicker" | "dateTimePicker" | "timePicker";
|
|
22
22
|
dateRange: "dateRangePicker";
|
|
23
23
|
boolean: "toggle" | "checkbox";
|
|
24
|
-
number: "numberInput" | "slider" | "select" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
25
|
-
enum: "select" | "autocomplete" | "segment";
|
|
26
|
-
string: "textInput" | "passwordInput" | "textArea" | "select" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
24
|
+
number: "numberInput" | "slider" | "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
25
|
+
enum: "select" | "querySelect" | "autocomplete" | "segment";
|
|
26
|
+
string: "textInput" | "passwordInput" | "textArea" | "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
27
27
|
email: "textInput";
|
|
28
|
-
array: "select" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
28
|
+
array: "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
29
29
|
object: InputComponentType;
|
|
30
30
|
unknown: InputComponentType;
|
|
31
|
-
uuid: "select" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
31
|
+
uuid: "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
|
|
32
32
|
}>;
|
|
33
33
|
interface DynamicInputDefBase<TProps> {
|
|
34
34
|
label?: string;
|
|
@@ -63,7 +63,8 @@ type GlobalProps = {
|
|
|
63
63
|
[T in Exclude<InputComponentType, "unknown">]: InputDefBaseProps<InputComponentProps<T>>;
|
|
64
64
|
}[Exclude<InputComponentType, "unknown">];
|
|
65
65
|
type SchemaKeyOrString<TSchema extends z.ZodObject<any>> = keyof z.infer<TSchema> | (string & {});
|
|
66
|
-
|
|
66
|
+
type DynamicInputsObjectSchema<TSchema extends z.ZodType> = TSchema extends z.ZodObject<any> ? TSchema : Extract<ZodUtils.UnwrapZod<TSchema>, z.ZodObject<any>>;
|
|
67
|
+
interface DynamicInputsObjectOptions<TSchema extends z.ZodObject<any>> {
|
|
67
68
|
inputs?: InputsConfig<TSchema>;
|
|
68
69
|
order?: SchemaKeyOrString<TSchema>[];
|
|
69
70
|
globalProps?: Partial<GlobalProps>;
|
|
@@ -72,12 +73,14 @@ export interface DynamicInputsOptions<TSchema extends z.ZodObject<any>> {
|
|
|
72
73
|
overridePresetLocales?: boolean;
|
|
73
74
|
includeAll?: boolean;
|
|
74
75
|
}
|
|
75
|
-
export
|
|
76
|
+
export type DynamicInputsOptions<TSchema extends z.ZodType> = DynamicInputsObjectOptions<DynamicInputsObjectSchema<TSchema>>;
|
|
77
|
+
export interface DynamicInputsParams<TSchema extends z.ZodType> {
|
|
76
78
|
schema: TSchema;
|
|
77
|
-
preset?: InputDef<z.infer<TSchema
|
|
79
|
+
preset?: InputDef<z.infer<DynamicInputsObjectSchema<TSchema>>>[];
|
|
78
80
|
options: DynamicInputsOptions<TSchema>;
|
|
79
81
|
}
|
|
80
82
|
export declare const getDefaultInputComponentType: (schemaType: z.core.$ZodType) => InputComponentType;
|
|
81
83
|
export declare const getDefaultSelectionMode: (keyType: z.core.$ZodType) => "single" | "multiple";
|
|
82
|
-
export declare
|
|
84
|
+
export declare function dynamicInputs<TSchema extends z.ZodObject<any>>(params: DynamicInputsParams<TSchema>): InputDef<z.infer<TSchema>>[];
|
|
85
|
+
export declare function dynamicInputs<TRawSchema extends z.ZodType>(params: DynamicInputsParams<TRawSchema>): InputDef<z.infer<DynamicInputsObjectSchema<TRawSchema>>>[];
|
|
83
86
|
export {};
|
|
@@ -81,6 +81,7 @@ var getDefaultProps = (componentType, keyType) => {
|
|
|
81
81
|
].includes(componentType)) props.items = getDefaultSelectionItems(unwrappedType);
|
|
82
82
|
if ([
|
|
83
83
|
"select",
|
|
84
|
+
"querySelect",
|
|
84
85
|
"autocomplete",
|
|
85
86
|
"queryAutocomplete",
|
|
86
87
|
"segment"
|
|
@@ -146,6 +147,8 @@ var populateInputDef = (schema, schemaKey, value, options) => {
|
|
|
146
147
|
const inputWrapper = value.inputWrapper ?? options.globalInputWrapper;
|
|
147
148
|
if ("render" in value) return {
|
|
148
149
|
name,
|
|
150
|
+
label,
|
|
151
|
+
placeholder,
|
|
149
152
|
render: value.render
|
|
150
153
|
};
|
|
151
154
|
const schemaKeyType = schema.shape[schemaKey];
|
|
@@ -172,17 +175,19 @@ var addMissingSchemaFields = (schema, existingInputDefs, options) => {
|
|
|
172
175
|
});
|
|
173
176
|
return [...existingInputDefs, ...additionalInputDefs];
|
|
174
177
|
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
function dynamicInputs({ schema: rawSchema, preset = [], options }) {
|
|
179
|
+
const schema = ZodUtils.unwrapToZodObject(rawSchema);
|
|
180
|
+
const objectOptions = options;
|
|
181
|
+
validateParams(schema, preset, objectOptions);
|
|
182
|
+
let entries = Object.entries(objectOptions.inputs ?? {});
|
|
178
183
|
entries = excludeEntries(entries);
|
|
179
184
|
const inputDefs = convertInputsConfigToObjectDefinitions(entries).map(([key, value]) => {
|
|
180
|
-
return populateInputDef(schema, key, value,
|
|
185
|
+
return populateInputDef(schema, key, value, objectOptions);
|
|
181
186
|
});
|
|
182
|
-
let presetInputDefs = removeOverriddenPresetInputs(preset,
|
|
183
|
-
if (
|
|
187
|
+
let presetInputDefs = removeOverriddenPresetInputs(preset, objectOptions);
|
|
188
|
+
if (objectOptions.overridePresetLocales) presetInputDefs = overridePresetLabelsAndPlaceholders(presetInputDefs, objectOptions);
|
|
184
189
|
const mergedInputDefs = [...presetInputDefs, ...inputDefs];
|
|
185
|
-
return sortInputDefs(
|
|
186
|
-
}
|
|
190
|
+
return sortInputDefs(objectOptions.includeAll ? addMissingSchemaFields(schema, mergedInputDefs, objectOptions) : mergedInputDefs, objectOptions.order);
|
|
191
|
+
}
|
|
187
192
|
//#endregion
|
|
188
193
|
export { dynamicInputs, getDefaultInputComponentType };
|
|
@@ -3,7 +3,8 @@ export interface UseAutosaveProps<TFieldValues extends FieldValues = FieldValues
|
|
|
3
3
|
form: UseFormReturn<TFieldValues, TContext, TTransformedValues>;
|
|
4
4
|
delay?: number;
|
|
5
5
|
enabled?: boolean;
|
|
6
|
+
trigger?: "change" | "blur";
|
|
6
7
|
onSave: (data: Partial<TTransformedValues>) => Promise<TResponse>;
|
|
7
8
|
onSaveSuccess?: () => void;
|
|
8
9
|
}
|
|
9
|
-
export declare function useAutosave<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues, TResponse = unknown>({ form, delay, enabled, onSave, onSaveSuccess, }: UseAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>): void;
|
|
10
|
+
export declare function useAutosave<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues, TResponse = unknown>({ form, delay, enabled, trigger, onSave, onSaveSuccess, }: UseAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>): void;
|
|
@@ -22,12 +22,19 @@ function diffLeftOnly(left, right, shallowKeys) {
|
|
|
22
22
|
}, {});
|
|
23
23
|
return ObjectUtils.isEmpty(result) ? void 0 : result;
|
|
24
24
|
}
|
|
25
|
-
function useAutosave({ form, delay = 500, enabled = true, onSave, onSaveSuccess }) {
|
|
25
|
+
function useAutosave({ form, delay = 500, enabled = true, trigger = "change", onSave, onSaveSuccess }) {
|
|
26
26
|
const timeoutRef = useRef(void 0);
|
|
27
|
+
const previousBlurTriggerFieldsRef = useRef(void 0);
|
|
27
28
|
const { control, reset, handleSubmit } = form;
|
|
28
|
-
const { dirtyFields, defaultValues } = useFormState({ control });
|
|
29
|
+
const { dirtyFields, touchedFields, defaultValues } = useFormState({ control });
|
|
30
|
+
const formData = useWatch({ control });
|
|
29
31
|
useEffect(() => {
|
|
30
32
|
if (!enabled || Object.keys(dirtyFields).length === 0) return;
|
|
33
|
+
if (trigger === "blur") {
|
|
34
|
+
const blurTriggerFields = JSON.stringify(touchedFields);
|
|
35
|
+
if (Object.keys(touchedFields).length === 0 || previousBlurTriggerFieldsRef.current === blurTriggerFields) return;
|
|
36
|
+
previousBlurTriggerFieldsRef.current = blurTriggerFields;
|
|
37
|
+
}
|
|
31
38
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
32
39
|
timeoutRef.current = setTimeout(() => {
|
|
33
40
|
handleSubmit(async (data) => {
|
|
@@ -52,12 +59,13 @@ function useAutosave({ form, delay = 500, enabled = true, onSave, onSaveSuccess
|
|
|
52
59
|
}, [
|
|
53
60
|
defaultValues,
|
|
54
61
|
dirtyFields,
|
|
55
|
-
|
|
62
|
+
trigger === "change" ? formData : touchedFields,
|
|
56
63
|
delay,
|
|
57
64
|
onSave,
|
|
58
65
|
handleSubmit,
|
|
59
66
|
enabled,
|
|
60
|
-
reset
|
|
67
|
+
reset,
|
|
68
|
+
trigger
|
|
61
69
|
]);
|
|
62
70
|
}
|
|
63
71
|
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
2
|
import { useMediaQuery } from "react-responsive";
|
|
3
3
|
//#region src/hooks/useBreakpoint.ts
|
|
4
4
|
var breakpoints = null;
|
|
@@ -22,9 +22,22 @@ function getBreakpoints() {
|
|
|
22
22
|
return breakpoints;
|
|
23
23
|
}
|
|
24
24
|
function useBreakpoint(breakpointKey) {
|
|
25
|
-
const
|
|
25
|
+
const $ = c(3);
|
|
26
|
+
let t0;
|
|
27
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
28
|
+
t0 = getBreakpoints();
|
|
29
|
+
$[0] = t0;
|
|
30
|
+
} else t0 = $[0];
|
|
31
|
+
const breakpoints = t0;
|
|
26
32
|
if (!breakpoints) throw new Error("Tailwind config is missing theme.screens");
|
|
27
|
-
|
|
33
|
+
const t1 = `(min-width: ${breakpoints[breakpointKey]})`;
|
|
34
|
+
let t2;
|
|
35
|
+
if ($[1] !== t1) {
|
|
36
|
+
t2 = { query: t1 };
|
|
37
|
+
$[1] = t1;
|
|
38
|
+
$[2] = t2;
|
|
39
|
+
} else t2 = $[2];
|
|
40
|
+
return useMediaQuery(t2);
|
|
28
41
|
}
|
|
29
42
|
//#endregion
|
|
30
43
|
export { useBreakpoint };
|
|
@@ -1,25 +1,59 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
3
|
//#region src/hooks/useDebounceCallback.ts
|
|
3
|
-
function useDebounceCallback(callback,
|
|
4
|
+
function useDebounceCallback(callback, t0) {
|
|
5
|
+
const $ = c(10);
|
|
6
|
+
let t1;
|
|
7
|
+
if ($[0] !== t0) {
|
|
8
|
+
t1 = t0 === void 0 ? {} : t0;
|
|
9
|
+
$[0] = t0;
|
|
10
|
+
$[1] = t1;
|
|
11
|
+
} else t1 = $[1];
|
|
12
|
+
const { delay: t2 } = t1;
|
|
13
|
+
const delay = t2 === void 0 ? 500 : t2;
|
|
4
14
|
const timeoutRef = useRef(null);
|
|
5
15
|
const [isDebouncing, setIsDebouncing] = useState(false);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
setIsDebouncing(false);
|
|
11
|
-
callback?.(...args);
|
|
12
|
-
}, delay);
|
|
13
|
-
}, [callback, delay]);
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
return () => {
|
|
16
|
+
let t3;
|
|
17
|
+
if ($[2] !== callback || $[3] !== delay) {
|
|
18
|
+
t3 = (...t4) => {
|
|
19
|
+
const args = t4;
|
|
16
20
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
21
|
+
setIsDebouncing(true);
|
|
22
|
+
timeoutRef.current = setTimeout(() => {
|
|
23
|
+
setIsDebouncing(false);
|
|
24
|
+
callback?.(...args);
|
|
25
|
+
}, delay);
|
|
17
26
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
$[2] = callback;
|
|
28
|
+
$[3] = delay;
|
|
29
|
+
$[4] = t3;
|
|
30
|
+
} else t3 = $[4];
|
|
31
|
+
const debouncedCallback = t3;
|
|
32
|
+
let t4;
|
|
33
|
+
let t5;
|
|
34
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
35
|
+
t4 = () => () => {
|
|
36
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
37
|
+
};
|
|
38
|
+
t5 = [];
|
|
39
|
+
$[5] = t4;
|
|
40
|
+
$[6] = t5;
|
|
41
|
+
} else {
|
|
42
|
+
t4 = $[5];
|
|
43
|
+
t5 = $[6];
|
|
44
|
+
}
|
|
45
|
+
useEffect(t4, t5);
|
|
46
|
+
let t6;
|
|
47
|
+
if ($[7] !== debouncedCallback || $[8] !== isDebouncing) {
|
|
48
|
+
t6 = {
|
|
49
|
+
callback: debouncedCallback,
|
|
50
|
+
isDebouncing
|
|
51
|
+
};
|
|
52
|
+
$[7] = debouncedCallback;
|
|
53
|
+
$[8] = isDebouncing;
|
|
54
|
+
$[9] = t6;
|
|
55
|
+
} else t6 = $[9];
|
|
56
|
+
return t6;
|
|
23
57
|
}
|
|
24
58
|
//#endregion
|
|
25
59
|
export { useDebounceCallback };
|
package/dist/hooks/useFilters.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UIRouter } from "../config/router.context.js";
|
|
2
2
|
import { RoutingUtils } from "../utils/routing.utils.js";
|
|
3
|
-
import {
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
//#region src/hooks/useFilters.ts
|
|
6
7
|
function getFieldType(schema, fieldKey) {
|
|
@@ -50,78 +51,138 @@ var parseFilterFromQuery = (searchParams, schema) => {
|
|
|
50
51
|
}
|
|
51
52
|
return filter;
|
|
52
53
|
};
|
|
53
|
-
var useFilters = (defaultFilterValues,
|
|
54
|
+
var useFilters = (defaultFilterValues, t0, schema) => {
|
|
55
|
+
const $ = c(33);
|
|
56
|
+
const prefix = t0 === void 0 ? "" : t0;
|
|
54
57
|
const { searchParams, replace } = UIRouter.useUIRouter();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
let t1;
|
|
59
|
+
if ($[0] !== schema || $[1] !== searchParams) {
|
|
60
|
+
t1 = () => parseFilterFromQuery(searchParams, schema);
|
|
61
|
+
$[0] = schema;
|
|
62
|
+
$[1] = searchParams;
|
|
63
|
+
$[2] = t1;
|
|
64
|
+
} else t1 = $[2];
|
|
65
|
+
const [filterData, setFilterData] = useState(t1);
|
|
66
|
+
let t2;
|
|
67
|
+
if ($[3] !== defaultFilterValues || $[4] !== prefix || $[5] !== replace || $[6] !== schema || $[7] !== searchParams) {
|
|
68
|
+
t2 = () => {
|
|
69
|
+
const setUrlToDefaultFilters = () => {
|
|
70
|
+
const flatFilterQuery = serializeFiltersToQuery(defaultFilterValues, prefix);
|
|
71
|
+
replace(".", {
|
|
72
|
+
...RoutingUtils.toRouterSearch(searchParams),
|
|
73
|
+
...flatFilterQuery
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
const currentFilters = parseFilterFromQuery(searchParams, schema);
|
|
77
|
+
const hasFiltersSet = Object.keys(currentFilters).length > 0;
|
|
78
|
+
if (defaultFilterValues && !hasFiltersSet) setUrlToDefaultFilters();
|
|
79
|
+
};
|
|
80
|
+
$[3] = defaultFilterValues;
|
|
81
|
+
$[4] = prefix;
|
|
82
|
+
$[5] = replace;
|
|
83
|
+
$[6] = schema;
|
|
84
|
+
$[7] = searchParams;
|
|
85
|
+
$[8] = t2;
|
|
86
|
+
} else t2 = $[8];
|
|
87
|
+
let t3;
|
|
88
|
+
if ($[9] !== defaultFilterValues || $[10] !== prefix || $[11] !== schema) {
|
|
89
|
+
t3 = [
|
|
90
|
+
defaultFilterValues,
|
|
91
|
+
prefix,
|
|
92
|
+
schema
|
|
93
|
+
];
|
|
94
|
+
$[9] = defaultFilterValues;
|
|
95
|
+
$[10] = prefix;
|
|
96
|
+
$[11] = schema;
|
|
97
|
+
$[12] = t3;
|
|
98
|
+
} else t3 = $[12];
|
|
99
|
+
useEffect(t2, t3);
|
|
100
|
+
let t4;
|
|
101
|
+
let t5;
|
|
102
|
+
if ($[13] !== schema || $[14] !== searchParams) {
|
|
103
|
+
t4 = () => {
|
|
104
|
+
setFilterData(parseFilterFromQuery(searchParams, schema));
|
|
105
|
+
};
|
|
106
|
+
t5 = [searchParams, schema];
|
|
107
|
+
$[13] = schema;
|
|
108
|
+
$[14] = searchParams;
|
|
109
|
+
$[15] = t4;
|
|
110
|
+
$[16] = t5;
|
|
111
|
+
} else {
|
|
112
|
+
t4 = $[15];
|
|
113
|
+
t5 = $[16];
|
|
114
|
+
}
|
|
115
|
+
useEffect(t4, t5);
|
|
116
|
+
let t6;
|
|
117
|
+
if ($[17] !== defaultFilterValues || $[18] !== filterData || $[19] !== prefix || $[20] !== replace || $[21] !== searchParams) {
|
|
118
|
+
t6 = (data) => {
|
|
119
|
+
let newFilters = { ...filterData };
|
|
120
|
+
const isReset = Object.keys(data).length === 0;
|
|
121
|
+
if (data === defaultFilterValues) newFilters = { ...defaultFilterValues };
|
|
122
|
+
else if (isReset) newFilters = {};
|
|
123
|
+
else Object.entries(data).forEach((t7) => {
|
|
124
|
+
const [key, value] = t7;
|
|
125
|
+
if (value === void 0) delete newFilters[key];
|
|
126
|
+
else newFilters[key] = value;
|
|
127
|
+
});
|
|
128
|
+
const prefixPart = prefix ? `${prefix}-` : "";
|
|
129
|
+
const cleanedQuery = RoutingUtils.toRouterSearch(searchParams);
|
|
130
|
+
Object.keys(cleanedQuery).forEach((key_0) => {
|
|
131
|
+
if (key_0.startsWith(`filter[${prefixPart}`)) delete cleanedQuery[key_0];
|
|
132
|
+
});
|
|
133
|
+
const flatFilterQuery_0 = serializeFiltersToQuery(newFilters, prefix);
|
|
59
134
|
replace(".", {
|
|
60
|
-
...
|
|
61
|
-
...
|
|
135
|
+
...cleanedQuery,
|
|
136
|
+
...flatFilterQuery_0
|
|
137
|
+
});
|
|
138
|
+
setFilterData(newFilters);
|
|
139
|
+
};
|
|
140
|
+
$[17] = defaultFilterValues;
|
|
141
|
+
$[18] = filterData;
|
|
142
|
+
$[19] = prefix;
|
|
143
|
+
$[20] = replace;
|
|
144
|
+
$[21] = searchParams;
|
|
145
|
+
$[22] = t6;
|
|
146
|
+
} else t6 = $[22];
|
|
147
|
+
const setFilterValue = t6;
|
|
148
|
+
let t7;
|
|
149
|
+
if ($[23] !== filterData) {
|
|
150
|
+
t7 = (keys) => {
|
|
151
|
+
const result = {};
|
|
152
|
+
keys.forEach((key_1) => {
|
|
153
|
+
result[key_1] = filterData[key_1];
|
|
62
154
|
});
|
|
155
|
+
return result;
|
|
156
|
+
};
|
|
157
|
+
$[23] = filterData;
|
|
158
|
+
$[24] = t7;
|
|
159
|
+
} else t7 = $[24];
|
|
160
|
+
const getFilterValue = t7;
|
|
161
|
+
let t8;
|
|
162
|
+
if ($[25] !== defaultFilterValues || $[26] !== setFilterValue) {
|
|
163
|
+
t8 = () => {
|
|
164
|
+
setFilterValue(defaultFilterValues ?? {});
|
|
63
165
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
setFilterData(parseFilterFromQuery(searchParams, schema));
|
|
74
|
-
}, [searchParams, schema]);
|
|
75
|
-
const setFilterValue = useCallback((data) => {
|
|
76
|
-
let newFilters = { ...filterData };
|
|
77
|
-
const isReset = Object.keys(data).length === 0;
|
|
78
|
-
if (data === defaultFilterValues) newFilters = { ...defaultFilterValues };
|
|
79
|
-
else if (isReset) newFilters = {};
|
|
80
|
-
else Object.entries(data).forEach(([key, value]) => {
|
|
81
|
-
if (value === void 0) delete newFilters[key];
|
|
82
|
-
else newFilters[key] = value;
|
|
83
|
-
});
|
|
84
|
-
const prefixPart = prefix ? `${prefix}-` : "";
|
|
85
|
-
const cleanedQuery = RoutingUtils.toRouterSearch(searchParams);
|
|
86
|
-
Object.keys(cleanedQuery).forEach((key) => {
|
|
87
|
-
if (key.startsWith(`filter[${prefixPart}`)) delete cleanedQuery[key];
|
|
88
|
-
});
|
|
89
|
-
const flatFilterQuery = serializeFiltersToQuery(newFilters, prefix);
|
|
90
|
-
replace(".", {
|
|
91
|
-
...cleanedQuery,
|
|
92
|
-
...flatFilterQuery
|
|
93
|
-
});
|
|
94
|
-
setFilterData(newFilters);
|
|
95
|
-
}, [
|
|
96
|
-
filterData,
|
|
97
|
-
prefix,
|
|
98
|
-
replace,
|
|
99
|
-
defaultFilterValues,
|
|
100
|
-
searchParams
|
|
101
|
-
]);
|
|
102
|
-
const getFilterValue = useCallback((keys) => {
|
|
103
|
-
const result = {};
|
|
104
|
-
keys.forEach((key) => {
|
|
105
|
-
result[key] = filterData[key];
|
|
106
|
-
});
|
|
107
|
-
return result;
|
|
108
|
-
}, [filterData]);
|
|
109
|
-
const clearAllFilters = useCallback(() => {
|
|
110
|
-
setFilterValue(defaultFilterValues ?? {});
|
|
111
|
-
}, [defaultFilterValues, setFilterValue]);
|
|
112
|
-
return useMemo(() => {
|
|
113
|
-
return {
|
|
166
|
+
$[25] = defaultFilterValues;
|
|
167
|
+
$[26] = setFilterValue;
|
|
168
|
+
$[27] = t8;
|
|
169
|
+
} else t8 = $[27];
|
|
170
|
+
const clearAllFilters = t8;
|
|
171
|
+
let t9;
|
|
172
|
+
if ($[28] !== clearAllFilters || $[29] !== filterData || $[30] !== getFilterValue || $[31] !== setFilterValue) {
|
|
173
|
+
t9 = {
|
|
114
174
|
filterData,
|
|
115
175
|
setFilterValue,
|
|
116
176
|
getFilterValue,
|
|
117
177
|
clearAllFilters
|
|
118
178
|
};
|
|
119
|
-
|
|
120
|
-
filterData
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
]
|
|
179
|
+
$[28] = clearAllFilters;
|
|
180
|
+
$[29] = filterData;
|
|
181
|
+
$[30] = getFilterValue;
|
|
182
|
+
$[31] = setFilterValue;
|
|
183
|
+
$[32] = t9;
|
|
184
|
+
} else t9 = $[32];
|
|
185
|
+
return t9;
|
|
125
186
|
};
|
|
126
187
|
//#endregion
|
|
127
188
|
export { useFilters };
|