@povio/ui 2.2.9-rc.4 → 2.2.9-rc.40

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.
Files changed (124) hide show
  1. package/dist/components/buttons/Button/Button.d.ts +2 -1
  2. package/dist/components/buttons/Button/Button.js +41 -32
  3. package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
  4. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +2 -2
  5. package/dist/components/inputs/Checkbox/Checkbox.js +6 -1
  6. package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
  7. package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
  8. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +8 -3
  9. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +81 -6
  10. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +7 -2
  11. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +83 -5
  12. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +8 -2
  13. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +84 -7
  14. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +2 -1
  15. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +60 -4
  16. package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
  17. package/dist/components/inputs/DateTime/shared/Calendar.js +23 -6
  18. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
  19. package/dist/components/inputs/DateTime/shared/CalendarCell.js +3 -3
  20. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
  21. package/dist/components/inputs/DateTime/shared/DateField.js +3 -10
  22. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -2
  23. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +65 -55
  24. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +14 -0
  25. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +19 -6
  26. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +4 -2
  27. package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +4 -0
  28. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +7 -0
  29. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +13 -0
  30. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +6 -0
  31. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +21 -0
  32. package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
  33. package/dist/components/inputs/DateTime/shared/dateSegment.utils.js +9 -0
  34. package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
  35. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +35 -0
  36. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +80 -0
  37. package/dist/components/inputs/File/FileUpload.js +1 -0
  38. package/dist/components/inputs/File/shared/InputUploadContent.js +1 -0
  39. package/dist/components/inputs/FormField/FormField.d.ts +3 -3
  40. package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
  41. package/dist/components/inputs/FormField/FormFieldHeader.js +3 -1
  42. package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
  43. package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +6 -0
  44. package/dist/components/inputs/FormField/formFieldHeader.cva.js +11 -0
  45. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
  46. package/dist/components/inputs/Input/NumberInput/NumberInput.js +78 -7
  47. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
  48. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +146 -0
  49. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
  50. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +233 -0
  51. package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +4 -0
  52. package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
  53. package/dist/components/inputs/Input/TextArea/TextArea.js +3 -1
  54. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
  55. package/dist/components/inputs/Input/TextInput/TextInput.js +77 -7
  56. package/dist/components/inputs/Input/shared/InputContent.js +7 -6
  57. package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
  58. package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
  59. package/dist/components/inputs/Inputs/InputItem.d.ts +12 -9
  60. package/dist/components/inputs/Inputs/InputItem.js +2 -0
  61. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +2 -1
  62. package/dist/components/inputs/RadioGroup/RadioGroup.js +106 -25
  63. package/dist/components/inputs/RadioGroup/radio.cva.d.ts +17 -0
  64. package/dist/components/inputs/RadioGroup/radio.cva.js +42 -1
  65. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
  66. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +98 -6
  67. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
  68. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +15 -10
  69. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +25 -19
  70. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +3 -3
  71. package/dist/components/inputs/Selection/Select/QuerySelect.js +8 -35
  72. package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
  73. package/dist/components/inputs/Selection/Select/Select.js +111 -4
  74. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +4 -1
  75. package/dist/components/inputs/Selection/shared/SelectBase.js +3 -2
  76. package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
  77. package/dist/components/inputs/Selection/shared/SelectDesktop.js +8 -4
  78. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  79. package/dist/components/inputs/Selection/shared/SelectInput.js +13 -2
  80. package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
  81. package/dist/components/inputs/Selection/shared/SelectListBox.js +3 -3
  82. package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
  83. package/dist/components/inputs/Selection/shared/SelectMobile.js +5 -3
  84. package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
  85. package/dist/components/inputs/Selection/shared/select.context.js +27 -4
  86. package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
  87. package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +3 -0
  88. package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
  89. package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
  90. package/dist/components/inputs/Selection/shared/staticSelect.utils.js +37 -0
  91. package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
  92. package/dist/components/inputs/Skeleton/InputFrame.d.ts +77 -0
  93. package/dist/components/inputs/Skeleton/InputFrame.js +200 -0
  94. package/dist/components/inputs/TextEditor/TextEditor.js +1 -0
  95. package/dist/components/inputs/Toggle/Toggle.js +6 -1
  96. package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
  97. package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
  98. package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
  99. package/dist/components/inputs/shared/CheckContent.js +3 -4
  100. package/dist/components/inputs/shared/InputClear.d.ts +2 -1
  101. package/dist/components/inputs/shared/InputClear.js +13 -1
  102. package/dist/components/inputs/shared/StaticInput.d.ts +38 -0
  103. package/dist/components/inputs/shared/TooltipWrapper.js +5 -1
  104. package/dist/components/inputs/shared/input.cva.d.ts +10 -0
  105. package/dist/components/inputs/shared/input.cva.js +19 -1
  106. package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
  107. package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
  108. package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +13 -0
  109. package/dist/components/inputs/shared/useStaticInputHandoff.js +47 -0
  110. package/dist/config/uiConfig.context.d.ts +8 -2
  111. package/dist/config/uiConfig.context.js +12 -1
  112. package/dist/config/uiStyle.context.d.ts +27 -4
  113. package/dist/hooks/useIntersectionObserver.d.ts +1 -1
  114. package/dist/hooks/useIntersectionObserver.js +29 -10
  115. package/dist/hooks/useQueryAutocomplete.d.ts +5 -16
  116. package/dist/hooks/useQueryAutocomplete.js +20 -5
  117. package/dist/index.d.ts +5 -0
  118. package/dist/index.js +3 -2
  119. package/dist/tw-ui-plugin.js +2 -0
  120. package/dist/utils/date-time.utils.d.ts +30 -9
  121. package/dist/utils/date-time.utils.js +113 -1
  122. package/dist/utils/query.utils.d.ts +4 -0
  123. package/dist/utils/query.utils.js +8 -0
  124. package/package.json +1 -1
@@ -1,24 +1,27 @@
1
1
  import { ComponentProps, JSXElementConstructor, ReactElement, ReactNode } from 'react';
2
2
  import { Control, UseFormReturn } from 'react-hook-form';
3
3
  import { z } from 'zod';
4
+ import { Autocomplete } from '../Selection/Autocomplete/Autocomplete';
5
+ import { Select } from '../Selection/Select/Select';
4
6
  import { HasRequiredProperty } from '../../../types/common';
5
7
  declare const componentRegistry: {
6
8
  readonly toggle: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Toggle/Toggle').ControlledToggleProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
7
9
  readonly checkbox: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Checkbox/Checkbox').ControlledCheckboxProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
8
- readonly numberInput: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/NumberInput/NumberInput').ControlledNumberInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
10
+ readonly numberInput: <TFieldValues extends import('react-hook-form').FieldValues>({ renderStaticInput, ...props }: import('../Input/NumberInput/NumberInput').ControlledNumberInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
11
+ readonly numberRangeInput: <TFieldValues extends import('react-hook-form').FieldValues>({ renderStaticInput, ...props }: import('../Input/NumberRangeInput/NumberRangeInput').ControlledNumberRangeInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
9
12
  readonly slider: <TFieldValues extends import('react-hook-form').FieldValues, IsRange extends boolean = false>(props: import('../Slider/Slider').ControlledSliderProps<TFieldValues, IsRange>) => import("react/jsx-runtime").JSX.Element;
10
- readonly textInput: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/TextInput/TextInput').ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
13
+ readonly textInput: <TFieldValues extends import('react-hook-form').FieldValues>({ renderStaticInput, ...props }: import('../Input/TextInput/TextInput').ControlledTextInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
11
14
  readonly passwordInput: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/PasswordInput/PasswordInput').ControlledPasswordInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
12
15
  readonly textArea: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../Input/TextArea/TextArea').ControlledTextAreaProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
13
- readonly select: <TFieldValues extends import('react-hook-form').FieldValues, TKey extends import('react-aria').Key = import('react-aria').Key, TInitialSelectItem = import('../Selection/shared/select.types').DefaultInitialSelectItem<TKey>>(props: import('../Selection/Select/Select').ControlledSelectProps<TFieldValues, TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
16
+ readonly select: typeof Select;
14
17
  readonly querySelect: <TFieldValues extends import('react-hook-form').FieldValues, TQueryFn extends import('../Selection/shared/querySelect.utils').QueryFn, TKey extends import('react-aria').Key = import('react-aria').Key>({ query, queryParams, queryOptions, queryMap, ...props }: import('../Selection/Select/QuerySelect.js').QuerySelectProps<TFieldValues, TQueryFn, TKey>) => import("react/jsx-runtime").JSX.Element;
15
- readonly autocomplete: <TFieldValues extends import('react-hook-form').FieldValues, TKey extends import('react-aria').Key = import('react-aria').Key, TInitialSelectItem = import('../Selection/shared/select.types').DefaultInitialSelectItem<TKey>>(props: import('../Selection/Autocomplete/Autocomplete').ControlledAutocompleteProps<TFieldValues, TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
16
- readonly queryAutocomplete: <TFieldValues extends import('react-hook-form').FieldValues, TSelectItem extends import('../Selection/shared/select.types').SelectItem<any>, TQueryFn extends import('../Selection/Autocomplete/queryAutocomplete.types').QueryFn<TSelectItem>>({ query, queryParams, queryOptions, queryMap, ...props }: import('../Selection/Autocomplete/queryAutocomplete.types').QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
18
+ readonly autocomplete: typeof Autocomplete;
19
+ readonly queryAutocomplete: <TFieldValues extends import('react-hook-form').FieldValues, TSelectItem extends import('../../..').SelectItem<any>, TQueryFn extends import('../Selection/Autocomplete/queryAutocomplete.types').QueryFn>({ query, queryParams, queryOptions, queryMap, leadingContent, ...props }: import('../Selection/Autocomplete/queryAutocomplete.types').QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
17
20
  readonly segment: <TFieldValues extends import('react-hook-form').FieldValues, TKey extends import('react-aria').Key = import('react-aria').Key>(props: import('../../..').ControlledSegmentProps<TFieldValues, TKey>) => import("react/jsx-runtime").JSX.Element;
18
- readonly datePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, ...props }: import('../DateTime/DatePicker/DatePicker').ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
19
- readonly dateTimePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, ...props }: import('../DateTime/DateTimePicker/DateTimePicker').ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
20
- readonly timePicker: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../DateTime/TimePicker/TimePicker').ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
21
- readonly dateRangePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, ...props }: import('../DateTime/DateRangePicker/DateRangePicker').ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
21
+ readonly datePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, renderStaticInput, ...props }: import('../DateTime/DatePicker/DatePicker').ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
22
+ readonly dateTimePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, renderStaticInput, ...props }: import('../DateTime/DateTimePicker/DateTimePicker').ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
23
+ readonly timePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ renderStaticInput, ...props }: import('../DateTime/TimePicker/TimePicker').ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
24
+ readonly dateRangePicker: <TFieldValues extends import('react-hook-form').FieldValues>({ fullIso, minValue, maxValue, renderStaticInput, ...props }: import('../DateTime/DateRangePicker/DateRangePicker').ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
22
25
  readonly textEditor: <TFieldValues extends import('react-hook-form').FieldValues>(props: import('../../../text-editor.js').ControlledTextEditorProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
23
26
  readonly unknown: null;
24
27
  };
@@ -6,6 +6,7 @@ import { DateRangePicker } from "../DateTime/DateRangePicker/DateRangePicker.js"
6
6
  import { DateTimePicker } from "../DateTime/DateTimePicker/DateTimePicker.js";
7
7
  import { TimePicker } from "../DateTime/TimePicker/TimePicker.js";
8
8
  import { NumberInput } from "../Input/NumberInput/NumberInput.js";
9
+ import { NumberRangeInput } from "../Input/NumberRangeInput/NumberRangeInput.js";
9
10
  import { PasswordInput } from "../Input/PasswordInput/PasswordInput.js";
10
11
  import { TextArea } from "../Input/TextArea/TextArea.js";
11
12
  import { Autocomplete } from "../Selection/Autocomplete/Autocomplete.js";
@@ -21,6 +22,7 @@ var componentRegistry = {
21
22
  toggle: Toggle,
22
23
  checkbox: Checkbox,
23
24
  numberInput: NumberInput,
25
+ numberRangeInput: NumberRangeInput,
24
26
  slider: Slider,
25
27
  textInput: TextInput,
26
28
  passwordInput: PasswordInput,
@@ -4,7 +4,8 @@ import { FieldValues } from 'react-hook-form';
4
4
  import { FormFieldProps } from '../FormField/FormField';
5
5
  import { RadioVariantProps } from './radio.cva';
6
6
  import { ControlProps } from '../shared/form.types';
7
- interface RadioGroupBaseProps extends Omit<FormFieldProps, "variant">, RadioVariantProps, Omit<AriaRadioGroupProps, "className"> {
7
+ import { InputVariantProps } from '../shared/input.cva';
8
+ interface RadioGroupBaseProps extends Omit<FormFieldProps, "variant">, RadioVariantProps, Omit<InputVariantProps, "variant">, Omit<AriaRadioGroupProps, "className"> {
8
9
  ref?: Ref<HTMLDivElement>;
9
10
  options: {
10
11
  label: string | ReactElement;
@@ -1,19 +1,44 @@
1
1
  import { UIStyle } from "../../../config/uiStyle.context.js";
2
2
  import { UIConfig } from "../../../config/uiConfig.context.js";
3
3
  import { CheckContent } from "../shared/CheckContent.js";
4
+ import { FormFieldLabel } from "../FormField/FormFieldLabel.js";
5
+ import { inputBase, inputSize } from "../shared/input.cva.js";
4
6
  import { FormField } from "../FormField/FormField.js";
5
- import { radio, radioIndicatorClass, radioTypography } from "./radio.cva.js";
7
+ import { TooltipWrapper } from "../shared/TooltipWrapper.js";
8
+ import { radio, radioContentClassName, radioContentRow, radioContentWrapper, radioIndicatorClass, radioTypography } from "./radio.cva.js";
6
9
  import { jsx, jsxs } from "react/jsx-runtime";
7
10
  import { clsx } from "clsx";
8
11
  import { Radio, RadioGroup } from "react-aria-components";
12
+ import { useLabel } from "react-aria";
9
13
  import { mergeRefs } from "@react-aria/utils";
10
14
  import { Controller } from "react-hook-form";
11
15
  //#region src/components/inputs/RadioGroup/RadioGroup.tsx
12
16
  var RadioGroupBase = (props) => {
13
17
  const ui = UIConfig.useConfig();
14
18
  const radioCva = UIStyle.useCva("radio.cva", radio);
19
+ const radioContentWrapperCva = UIStyle.useCva("radio.contentWrapperCva", radioContentWrapper);
20
+ const radioContentRowCva = UIStyle.useCva("radio.contentRowCva", radioContentRow);
21
+ const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
22
+ const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
15
23
  const radioTypographyMap = UIStyle.useMapper("radio.typography", radioTypography);
16
- const { label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options, variant = ui.radioGroup.variant, hideLabel = ui.radioGroup.hideLabel, ...rest } = props;
24
+ const radioContentClassNameMap = UIStyle.useMapper("radio.contentClassName", radioContentClassName);
25
+ const { ref, label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options, value, defaultValue, as: asProp, size: sizeProp, variant: variantProp, hideLabel: hideLabelProp, ...rest } = props;
26
+ const as = asProp ?? ui.input.as;
27
+ const size = sizeProp ?? ui.input.size;
28
+ const variant = variantProp ?? ui.radioGroup.variant;
29
+ const hideLabel = hideLabelProp ?? ui.radioGroup.hideLabel;
30
+ const radioClassName = radioCva({
31
+ variant,
32
+ ...rest
33
+ });
34
+ const radioTypographyProps = radioTypographyMap({
35
+ variant,
36
+ ...rest
37
+ });
38
+ const radioContentClassNameValue = radioContentClassNameMap({
39
+ variant,
40
+ ...rest
41
+ });
17
42
  const formFieldProps = {
18
43
  className,
19
44
  error,
@@ -22,37 +47,93 @@ var RadioGroupBase = (props) => {
22
47
  helperText,
23
48
  isRequired,
24
49
  rightContent,
25
- isHeaderHidden,
50
+ isHeaderHidden: isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
26
51
  hideLabel,
27
52
  isDisabled,
28
53
  headerClassName,
29
54
  errorClassName
30
55
  };
31
- return /* @__PURE__ */ jsx(RadioGroup, {
32
- ...rest,
56
+ const { labelProps, fieldProps } = useLabel({ label });
57
+ const headerProps = {
58
+ label,
59
+ tooltipText,
60
+ helperText,
61
+ isRequired,
62
+ rightContent,
63
+ isHeaderHidden: hideLabel || isHeaderHidden,
33
64
  isDisabled,
34
- isInvalid: !!error,
35
- "data-is-dirty": isDirty || void 0,
36
- "data-is-required": isRequired || void 0,
37
- children: /* @__PURE__ */ jsx(FormField, {
38
- ...formFieldProps,
39
- children: /* @__PURE__ */ jsx("div", {
40
- className: clsx("flex flex-col", inputClassName),
41
- children: options.map((option) => /* @__PURE__ */ jsxs(Radio, {
42
- value: option.value,
43
- className: clsx("relative", radioIndicatorClass),
44
- children: [/* @__PURE__ */ jsx("div", { className: radioCva({
45
- variant,
46
- ...rest
47
- }) }), /* @__PURE__ */ jsx(CheckContent, {
48
- typography: radioTypographyMap({
65
+ className: headerClassName,
66
+ labelProps
67
+ };
68
+ const selectedValue = value ?? defaultValue;
69
+ const shouldRenderInputFrame = as !== "default";
70
+ return /* @__PURE__ */ jsx(TooltipWrapper, {
71
+ as,
72
+ error,
73
+ triggerTabIndex: as === "inline" ? -1 : void 0,
74
+ children: /* @__PURE__ */ jsx(RadioGroup, {
75
+ ...rest,
76
+ ...fieldProps,
77
+ ref,
78
+ value,
79
+ defaultValue,
80
+ isDisabled,
81
+ isInvalid: !!error,
82
+ "data-is-dirty": isDirty || void 0,
83
+ "data-is-required": isRequired || void 0,
84
+ children: /* @__PURE__ */ jsx(FormField, {
85
+ ...formFieldProps,
86
+ as,
87
+ labelProps,
88
+ className: clsx("w-full", as === "inline" && "h-full", className),
89
+ tabIndex: as === "inline" ? -1 : void 0,
90
+ children: /* @__PURE__ */ jsx("div", {
91
+ className: clsx("group/radio-group-content relative", shouldRenderInputFrame && inputBaseCva({
92
+ variant: ui.input.variant,
93
+ as
94
+ }), inputClassName),
95
+ "data-rac": "",
96
+ "data-disabled": isDisabled || void 0,
97
+ "data-is-disabled": isDisabled || void 0,
98
+ "data-invalid": !!error || void 0,
99
+ "data-has-selection": selectedValue != null && selectedValue !== "" ? true : void 0,
100
+ "data-radio-group-content": "",
101
+ children: /* @__PURE__ */ jsxs("div", {
102
+ className: clsx(radioContentWrapperCva({
49
103
  variant,
104
+ as,
105
+ hasInputFrame: shouldRenderInputFrame,
50
106
  ...rest
51
- }),
52
- className: labelClassName,
53
- children: option.label
54
- })]
55
- }, option.value))
107
+ }), shouldRenderInputFrame && inputSizeCva({
108
+ as,
109
+ size
110
+ })),
111
+ "data-is-dirty": isDirty || void 0,
112
+ "data-is-required": isRequired || void 0,
113
+ children: [as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
114
+ as,
115
+ size,
116
+ ...headerProps
117
+ }), /* @__PURE__ */ jsx("div", {
118
+ className: radioContentRowCva({
119
+ variant,
120
+ as,
121
+ hasInputFrame: shouldRenderInputFrame,
122
+ ...rest
123
+ }),
124
+ children: options.map((option) => /* @__PURE__ */ jsxs(Radio, {
125
+ value: option.value,
126
+ className: clsx("relative", radioIndicatorClass),
127
+ children: [/* @__PURE__ */ jsx("div", { className: radioClassName }), /* @__PURE__ */ jsx(CheckContent, {
128
+ typography: radioTypographyProps,
129
+ contentClassName: radioContentClassNameValue,
130
+ className: labelClassName,
131
+ children: option.label
132
+ })]
133
+ }, option.value))
134
+ })]
135
+ })
136
+ })
56
137
  })
57
138
  })
58
139
  });
@@ -5,7 +5,24 @@ export declare const radio: (props?: ({
5
5
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
6
  export interface RadioVariantProps extends VariantProps<typeof radio> {
7
7
  }
8
+ export declare const radioContentWrapper: (props?: ({
9
+ variant?: "default" | null | undefined;
10
+ as?: "filter" | "default" | "floating" | "inline" | null | undefined;
11
+ hasInputFrame?: boolean | null | undefined;
12
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
13
+ export interface RadioContentWrapperVariantProps extends VariantProps<typeof radioContentWrapper> {
14
+ }
15
+ export declare const radioContentRow: (props?: ({
16
+ variant?: "default" | null | undefined;
17
+ as?: "filter" | "default" | "floating" | "inline" | null | undefined;
18
+ hasInputFrame?: boolean | null | undefined;
19
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
20
+ export interface RadioContentRowVariantProps extends VariantProps<typeof radioContentRow> {
21
+ }
8
22
  export declare const radioIndicatorClass = "group flex items-center gap-2";
9
23
  export declare const radioTypography: (props: {
10
24
  variant?: "default" | null | undefined;
11
25
  }) => TypographyVariantProps | undefined;
26
+ export declare const radioContentClassName: (props: {
27
+ variant?: "default" | null | undefined;
28
+ }) => string | undefined;
@@ -25,11 +25,52 @@ var radio = cva([
25
25
  ] } },
26
26
  defaultVariants: { variant: "default" }
27
27
  });
28
+ var radioContentWrapper = cva("relative flex", {
29
+ variants: {
30
+ variant: { default: "" },
31
+ as: {
32
+ default: "flex-col",
33
+ floating: "flex-col",
34
+ filter: "flex-row flex-wrap items-center gap-2",
35
+ inline: "flex-row flex-wrap items-center gap-2"
36
+ },
37
+ hasInputFrame: {
38
+ true: "gap-2",
39
+ false: ""
40
+ }
41
+ },
42
+ defaultVariants: {
43
+ variant: "default",
44
+ as: "default",
45
+ hasInputFrame: false
46
+ }
47
+ });
48
+ var radioContentRow = cva("flex", {
49
+ variants: {
50
+ variant: { default: "" },
51
+ as: {
52
+ default: "flex-col",
53
+ floating: "flex-col",
54
+ filter: "flex-row flex-wrap items-center gap-2",
55
+ inline: "flex-row flex-wrap items-center gap-2"
56
+ },
57
+ hasInputFrame: {
58
+ true: "gap-2",
59
+ false: ""
60
+ }
61
+ },
62
+ defaultVariants: {
63
+ variant: "default",
64
+ as: "default",
65
+ hasInputFrame: false
66
+ }
67
+ });
28
68
  var radioIndicatorClass = "group flex items-center gap-2";
29
69
  var radioTypography = compoundMapper({ default: {
30
70
  size: "label-1",
31
71
  sizeMobile: "label-1",
32
72
  variant: "default"
33
73
  } });
74
+ var radioContentClassName = compoundMapper({ default: "text-text-default-2" });
34
75
  //#endregion
35
- export { radio, radioIndicatorClass, radioTypography };
76
+ export { radio, radioContentClassName, radioContentRow, radioContentWrapper, radioIndicatorClass, radioTypography };
@@ -1,8 +1,12 @@
1
+ import { ReactElement } from 'react';
1
2
  import { Key } from 'react-aria-components';
2
3
  import { FieldValues } from 'react-hook-form';
3
4
  import { SelectBaseProps } from '../shared/SelectBase';
4
5
  import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps } from '../shared/select.types';
5
6
  import { OmitDiscriminatedUnion } from '../../../../types/common';
6
- export type AutocompleteProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, "isSearchable">;
7
+ export type AutocompleteProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, "isSearchable"> & {
8
+ renderStaticInput?: boolean;
9
+ };
7
10
  export type ControlledAutocompleteProps<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = Omit<AutocompleteProps<TKey, TInitialSelectItem>, keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey, TInitialSelectItem>;
8
- export declare const Autocomplete: <TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: ControlledAutocompleteProps<TFieldValues, TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
11
+ export declare function Autocomplete<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: AutocompleteProps<TKey, TInitialSelectItem>): ReactElement;
12
+ export declare function Autocomplete<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: ControlledAutocompleteProps<TFieldValues, TKey, TInitialSelectItem>): ReactElement;
@@ -1,11 +1,18 @@
1
+ import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
2
+ import { UIConfig } from "../../../../config/uiConfig.context.js";
3
+ import { InputFrame } from "../../Skeleton/InputFrame.js";
4
+ import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
1
5
  import { SelectBase } from "../shared/SelectBase.js";
2
- import { jsx } from "react/jsx-runtime";
6
+ import { getStaticSelectValue } from "../shared/staticSelect.utils.js";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { clsx } from "clsx";
9
+ import { useRef, useState } from "react";
3
10
  import { mergeRefs } from "@react-aria/utils";
4
- import { Controller } from "react-hook-form";
11
+ import { Controller, useWatch } from "react-hook-form";
5
12
  //#region src/components/inputs/Selection/Autocomplete/Autocomplete.tsx
6
- var Autocomplete = (props) => {
13
+ function _Autocomplete(props) {
7
14
  if ("formControl" in props && props.formControl) {
8
- const { formControl, ref, ...innerProps } = props;
15
+ const { ignoreInputValueFiltering = true, formControl, ref, ...innerProps } = props;
9
16
  return /* @__PURE__ */ jsx(Controller, {
10
17
  control: formControl.control,
11
18
  name: formControl.name,
@@ -18,7 +25,8 @@ var Autocomplete = (props) => {
18
25
  isDirty,
19
26
  isDisabled: field.disabled || props.isDisabled,
20
27
  error: props.error ?? error?.message,
21
- isSearchable: true
28
+ isSearchable: true,
29
+ ignoreInputValueFiltering
22
30
  })
23
31
  });
24
32
  }
@@ -26,6 +34,90 @@ var Autocomplete = (props) => {
26
34
  ...props,
27
35
  isSearchable: true
28
36
  });
29
- };
37
+ }
38
+ function Autocomplete({ renderStaticInput, ...props }) {
39
+ const ui = UIConfig.useConfig();
40
+ const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
41
+ const rootRef = useRef(null);
42
+ const { renderRealInput, replayStaticInputChange } = useStaticInputHandoff({
43
+ inputRef: rootRef,
44
+ renderInput,
45
+ setRenderInput,
46
+ getFocusTarget: (root) => root.querySelector("input, [data-type='select-trigger'], button, [tabindex]")
47
+ });
48
+ const currentValue = ("formControl" in props && props.formControl ? useWatch({
49
+ control: props.formControl.control,
50
+ name: props.formControl.name
51
+ }) : props.value) ?? props.value;
52
+ let isFormControlDisabled = false;
53
+ if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
54
+ if (!renderInput && !!props.customTrigger) setRenderInput(true);
55
+ if (!renderInput) {
56
+ const as = props.as ?? ui.input.as;
57
+ let isDisabled = !!props.isDisabled;
58
+ if (isFormControlDisabled) isDisabled = true;
59
+ const mode = props.selectionMode ?? ui.select.selectionMode;
60
+ const { selectedItem, displayValue, isEmpty } = getStaticSelectValue({
61
+ items: props.items,
62
+ value: currentValue,
63
+ selectionMode: mode,
64
+ initialSelection: props.initialSelection,
65
+ mapInitialToSelectItem: props.mapInitialToSelectItem,
66
+ showSelectionContent: props.showSelectionContent,
67
+ isDisabled,
68
+ collapseAfter: props.collapseAfter ?? ui.select.collapseAfter,
69
+ selectedTagsType: props.selectedTagsType ?? ui.select.selectedTagsType
70
+ });
71
+ const isMultiple = mode === "multiple";
72
+ const trailingContent = props.trailingContent || !props.hideDropdownIcon ? /* @__PURE__ */ jsxs(Fragment, { children: [props.trailingContent, !props.hideDropdownIcon ? /* @__PURE__ */ jsx(ArrowDropDownIcon, { className: "size-6 shrink-0 text-interactive-text-secondary-idle" }) : void 0] }) : void 0;
73
+ const placeholder = as === "floating" ? null : props.placeholder;
74
+ const shouldRenderPlaceholderAfterValue = mode !== "single" && props.placeholder && !isEmpty;
75
+ const inputValue = !isMultiple && selectedItem ? selectedItem.label : "";
76
+ const dataAttributes = {
77
+ dataIsEmpty: isEmpty,
78
+ dataIsFilled: !isEmpty,
79
+ dataIsDirty: props.isDirty,
80
+ dataIsRequired: props.isRequired,
81
+ dataIsDisabled: isDisabled,
82
+ dataDisabled: isDisabled,
83
+ dataInvalid: !!props.error,
84
+ dataHasSelection: !isEmpty,
85
+ dataHasSearch: false
86
+ };
87
+ return /* @__PURE__ */ jsx(InputFrame, {
88
+ ...props,
89
+ isDisabled,
90
+ className: clsx("w-full", props.containerClassName),
91
+ inputClassName: clsx(props.className, props.inputClassName),
92
+ contentWrapperClassName: "flex flex-1 flex-wrap gap-input-gap-input-text-to-elements truncate",
93
+ labelPlacement: "content-row",
94
+ dataAttributes,
95
+ renderStatic: true,
96
+ onStaticInteract: renderRealInput,
97
+ leadingContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
98
+ className: "ml-input-side-default flex shrink-0 items-center",
99
+ children: props.leadingContent
100
+ }),
101
+ trailingContent,
102
+ children: (dataAttributeProps) => /* @__PURE__ */ jsxs(Fragment, { children: [isMultiple && !isEmpty && displayValue, /* @__PURE__ */ jsx("input", {
103
+ disabled: isDisabled,
104
+ tabIndex: -1,
105
+ value: inputValue,
106
+ placeholder: isMultiple && shouldRenderPlaceholderAfterValue ? props.placeholder : placeholder ?? void 0,
107
+ className: clsx("w-full flex-1 bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled", props.inputClassName),
108
+ onChange: (event) => {
109
+ props?.onMouseEnter?.({});
110
+ replayStaticInputChange(event.target.value);
111
+ },
112
+ ...dataAttributeProps,
113
+ "data-rac": true
114
+ })] })
115
+ });
116
+ }
117
+ return /* @__PURE__ */ jsx(_Autocomplete, {
118
+ ...props,
119
+ ref: mergeRefs(props.ref, rootRef)
120
+ });
121
+ }
30
122
  //#endregion
31
123
  export { Autocomplete };
@@ -1,4 +1,4 @@
1
1
  import { FieldValues } from 'react-hook-form';
2
2
  import { QueryAutocompleteProps, QueryFn } from './queryAutocomplete.types';
3
3
  import { SelectItem } from '../shared/select.types';
4
- export declare const QueryAutocomplete: <TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>>({ query, queryParams, queryOptions, queryMap, ...props }: QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const QueryAutocomplete: <TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn>({ query, queryParams, queryOptions, queryMap, leadingContent, ...props }: QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
@@ -1,35 +1,40 @@
1
1
  import { UIConfig } from "../../../../config/uiConfig.context.js";
2
2
  import { Autocomplete } from "./Autocomplete.js";
3
+ import { getQueryItems } from "../shared/querySelect.utils.js";
3
4
  import { useQueryAutocomplete } from "../../../../hooks/useQueryAutocomplete.js";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  import { useState } from "react";
6
7
  //#region src/components/inputs/Selection/Autocomplete/QueryAutocomplete.tsx
7
- var QueryAutocomplete = ({ query, queryParams, queryOptions, queryMap, ...props }) => {
8
+ var QueryAutocomplete = ({ query, queryParams, queryOptions, queryMap, leadingContent, ...props }) => {
8
9
  const ui = UIConfig.useConfig();
9
10
  const [search, setSearch] = useState("");
10
- const mapItems = (data) => {
11
- const extractedData = Array.isArray(data) ? data : data.pages.flatMap((page) => page.items ?? []);
12
- return queryMap?.(extractedData) ?? extractedData;
13
- };
14
- const { items, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
11
+ const { onChange, ...restProps } = props;
12
+ const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
15
13
  query,
16
14
  queryParams,
17
15
  queryOptions,
18
- mapItems: (data) => mapItems(data),
16
+ mapItems: (data) => getQueryItems(data, queryMap),
19
17
  search,
20
18
  initialQueryState: props.isInitialQueryDisabled ?? ui.queryAutocomplete?.isInitialQueryDisabled
21
19
  });
22
- const { isInitialQueryDisabled: _, ...restProps } = props;
20
+ const handleChange = (value) => {
21
+ onChange?.(value);
22
+ props.onBlur?.({ target: { value: null } });
23
+ };
24
+ const { isInitialQueryDisabled: _, ...autocompleteProps } = restProps;
23
25
  return /* @__PURE__ */ jsx(Autocomplete, {
24
- ...restProps,
26
+ ...autocompleteProps,
25
27
  items,
28
+ totalItems,
26
29
  onSearchChange: setSearch,
27
30
  isClientSearchDisabled: true,
28
31
  isLoading,
32
+ onChange: handleChange,
29
33
  onMouseEnter: handleEnableQuery,
30
34
  onFocusCapture: handleEnableQuery,
35
+ leadingContent,
31
36
  hasLoadMore: hasNextPage,
32
- onLoadMore: fetchNextPage ? () => void fetchNextPage() : void 0
37
+ onLoadMore: fetchNextPage
33
38
  });
34
39
  };
35
40
  //#endregion
@@ -1,30 +1,36 @@
1
- import { UseInfiniteQueryResult, UseQueryResult } from '@tanstack/react-query';
1
+ import { InfiniteData, UseInfiniteQueryResult, UseQueryResult } from '@tanstack/react-query';
2
2
  import { Key } from 'react-aria-components';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
  import { AutocompleteProps } from './Autocomplete';
5
5
  import { GroupedSelectControlProps, GroupedSelectProps, SelectItem } from '../shared/select.types';
6
6
  import { OmitDiscriminatedUnion } from '../../../../types/common';
7
- export interface QueryAutocompleteInfinitePage<TSelectItem extends SelectItem = SelectItem> {
8
- items: Array<TSelectItem>;
7
+ export type InfiniteQueryPage<TKey extends Key> = {
8
+ items?: SelectItem<TKey>[];
9
9
  totalItems?: number;
10
- }
11
- export type QueryResult<TSelectItem extends SelectItem = SelectItem> = UseQueryResult<Array<TSelectItem>> | UseInfiniteQueryResult<QueryAutocompleteInfinitePage<TSelectItem>>;
12
- export type QueryFn<TSelectItem extends SelectItem = SelectItem> = (...args: any[]) => QueryResult<TSelectItem>;
13
- export type QueryAutocompleteExtractedData<TSelectItem extends SelectItem = SelectItem> = Array<TSelectItem>;
14
- export type QueryAutocompleteProps<TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>> = OmitDiscriminatedUnion<AutocompleteProps<TSelectItem["id"]>, "items" | "onSearchChange" | "isLoading" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TSelectItem["id"]> & {
15
- query: Parameters<TQueryFn>[0] extends {
16
- search?: string;
17
- } ? TQueryFn : never;
18
- queryParams?: Omit<Parameters<TQueryFn>[0], "search">;
19
- queryOptions?: Parameters<TQueryFn>[1];
20
- queryMap?: (data: QueryAutocompleteExtractedData<TSelectItem>) => SelectItem<TSelectItem["id"]>[];
10
+ };
11
+ export type QueryResult<TData> = UseQueryResult<TData> | UseInfiniteQueryResult<TData>;
12
+ export type QueryFn = (params: any, options?: any) => QueryResult<any>;
13
+ export type ExtractQueryParams<TQueryFn> = TQueryFn extends (params: infer TParams, ...args: any[]) => any ? TParams : never;
14
+ export type ExtractQueryOptions<TQueryFn> = TQueryFn extends (params: any, options?: infer TOptions) => any ? TOptions : never;
15
+ export type QueryDataType<TQueryFn extends QueryFn> = Exclude<ReturnType<TQueryFn>["data"], undefined>;
16
+ export type ExtractPageType<T> = T extends InfiniteData<infer TPage> ? TPage : T;
17
+ export type ExtractedDataType<TQueryFn extends QueryFn> = ExtractPageType<QueryDataType<TQueryFn>> | ExtractPageType<QueryDataType<TQueryFn>>[];
18
+ export type QueryAutocompleteProps<TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn> = OmitDiscriminatedUnion<AutocompleteProps<TSelectItem["id"]>, "items" | "onSearchChange" | "isLoading" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TSelectItem["id"]> & {
19
+ query: TQueryFn;
20
+ queryParams?: Omit<ExtractQueryParams<TQueryFn>, "search" | "limit"> & {
21
+ limit?: number;
22
+ };
23
+ queryOptions?: ExtractQueryOptions<TQueryFn>;
24
+ queryMap?: (data: ExtractedDataType<TQueryFn>) => SelectItem<TSelectItem["id"]>[];
21
25
  isInitialQueryDisabled?: boolean;
22
26
  };
23
- export interface UseQueryAutocompleteOptions<TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>, TKey extends Key = QueryAutocompleteExtractedData<TSelectItem>[number]["id"]> {
27
+ export interface UseQueryAutocompleteOptions<TQueryFn extends QueryFn, TKey extends Key = Key> {
24
28
  query: TQueryFn;
25
- queryParams?: Parameters<TQueryFn>[0];
26
- queryOptions?: Parameters<TQueryFn>[1];
27
- queryMap?: (data: QueryAutocompleteExtractedData<TSelectItem>) => SelectItem<TKey>[];
29
+ queryParams?: Omit<ExtractQueryParams<TQueryFn>, "search" | "limit"> & {
30
+ limit?: number;
31
+ };
32
+ queryOptions?: ExtractQueryOptions<TQueryFn>;
33
+ mapItems: (data: QueryDataType<TQueryFn>) => SelectItem<TKey>[];
28
34
  initialQueryState?: boolean;
29
- search: string;
35
+ search?: string;
30
36
  }
@@ -1,10 +1,10 @@
1
- import { GroupedSelectControlProps, GroupedSelectProps, SelectItem } from '../shared/select.types';
2
- import { SelectBaseProps } from '../shared/SelectBase';
1
+ import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps, SelectItem } from '../shared/select.types';
2
+ import { SelectProps } from './Select';
3
3
  import { QueryDataType, QueryFn } from '../shared/querySelect.utils';
4
4
  import { OmitDiscriminatedUnion } from '../../../../types/common';
5
5
  import { Key } from 'react-aria-components';
6
6
  import { FieldValues } from 'react-hook-form';
7
- export type QuerySelectProps<TFieldValues extends FieldValues, TQueryFn extends QueryFn, TKey extends Key = Key> = OmitDiscriminatedUnion<SelectBaseProps<TKey>, "items" | "isLoading" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey> & {
7
+ export type QuerySelectProps<TFieldValues extends FieldValues, TQueryFn extends QueryFn, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectProps<TKey, TInitialSelectItem>, "items" | "totalItems" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey, TInitialSelectItem> & {
8
8
  query: TQueryFn;
9
9
  queryParams?: Parameters<TQueryFn>[0];
10
10
  queryOptions?: Parameters<TQueryFn>[1];