@povio/ui 2.3.0-rc.4 → 2.3.0-rc.6

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.
@@ -12,6 +12,7 @@ import { FormField } from "../../FormField/FormField.js";
12
12
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
13
13
  import { InputFrame } from "../../Skeleton/InputFrame.js";
14
14
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
15
+ import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
15
16
  import { jsx, jsxs } from "react/jsx-runtime";
16
17
  import { clsx } from "clsx";
17
18
  import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
@@ -63,12 +64,16 @@ var DatePickerBase = (props) => {
63
64
  const datePickerRef = useMemo(() => ({ get current() {
64
65
  return datePickerInputRef.current?.getContainer?.() || null;
65
66
  } }), []);
66
- useImperativeHandle(ref, () => ({ clear: () => {
67
- datePickerInputRef.current?.clear();
68
- } }));
67
+ useImperativeHandle(ref, () => ({
68
+ clear: () => {
69
+ datePickerInputRef.current?.clear();
70
+ },
71
+ getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
72
+ }));
69
73
  const handleBlur = (val) => {
70
74
  onBlur?.({ target: { value: val } });
71
75
  };
76
+ const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
72
77
  const dialogState = useDatePickerState({
73
78
  ...rest,
74
79
  defaultValue: value || rest.defaultValue,
@@ -88,6 +93,7 @@ var DatePickerBase = (props) => {
88
93
  }
89
94
  onChange?.(normalizedValue);
90
95
  dialogState.setValue(normalizedValue);
96
+ debouncedBlur(normalizedValue);
91
97
  if (normalizedValue) {
92
98
  calendarState.setFocusedDate(normalizedValue);
93
99
  return;
@@ -238,7 +244,8 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
238
244
  renderInput,
239
245
  setRenderInput,
240
246
  getFocusTarget: (input) => {
241
- return (input.getContainer?.() ?? input).querySelector("input, button, [tabindex]:not([tabindex='-1'])");
247
+ const container = input.getContainer?.() ?? input;
248
+ return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
242
249
  }
243
250
  });
244
251
  const watchedValue = "formControl" in props && props.formControl ? useWatch({
@@ -313,6 +320,8 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
313
320
  onStaticInteract: renderRealInput,
314
321
  actionContent: staticTodayIcon,
315
322
  actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
323
+ wrapContentAndTrailing: true,
324
+ contentAndTrailingClassName: "gap-2!",
316
325
  trailingClassName: "py-0! pl-0!",
317
326
  trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
318
327
  children: staticSegments
@@ -76,9 +76,12 @@ var DateRangePickerBase = (props) => {
76
76
  shouldForceLeadingZeros
77
77
  }, dialogState, dateRangePickerRef);
78
78
  const { locale } = useLocale$1();
79
- useImperativeHandle(ref, () => ({ clear: () => {
80
- datePickerInputRef.current?.clear();
81
- } }));
79
+ useImperativeHandle(ref, () => ({
80
+ clear: () => {
81
+ datePickerInputRef.current?.clear();
82
+ },
83
+ getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
84
+ }));
82
85
  const handleBlur = (newValue) => {
83
86
  onBlur?.({ target: { value: newValue } });
84
87
  };
@@ -570,7 +573,8 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
570
573
  renderInput,
571
574
  setRenderInput,
572
575
  getFocusTarget: (input) => {
573
- return (input.getContainer?.() ?? input).querySelector("input, button, [tabindex]:not([tabindex='-1'])");
576
+ const container = input.getContainer?.() ?? input;
577
+ return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
574
578
  }
575
579
  });
576
580
  const watchedValue = "formControl" in props && props.formControl ? useWatch({
@@ -661,6 +665,8 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
661
665
  onStaticInteract: renderRealInput,
662
666
  actionContent: staticTodayIcon,
663
667
  actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
668
+ wrapContentAndTrailing: true,
669
+ contentAndTrailingClassName: "gap-2!",
664
670
  trailingClassName: "py-0! pl-0!",
665
671
  trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
666
672
  children: staticSegments
@@ -57,9 +57,12 @@ var DateTimePickerBase = (props) => {
57
57
  const datePickerRef = useMemo(() => ({ get current() {
58
58
  return datePickerInputRef.current?.getContainer?.() || null;
59
59
  } }), []);
60
- useImperativeHandle(ref, () => ({ clear: () => {
61
- datePickerInputRef.current?.clear();
62
- } }));
60
+ useImperativeHandle(ref, () => ({
61
+ clear: () => {
62
+ datePickerInputRef.current?.clear();
63
+ },
64
+ getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
65
+ }));
63
66
  const handleBlur = (val) => {
64
67
  onBlur?.({ target: { value: val } });
65
68
  };
@@ -243,7 +246,8 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
243
246
  renderInput,
244
247
  setRenderInput,
245
248
  getFocusTarget: (input) => {
246
- return (input.getContainer?.() ?? input).querySelector("input, button, [tabindex]:not([tabindex='-1'])");
249
+ const container = input.getContainer?.() ?? input;
250
+ return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
247
251
  }
248
252
  });
249
253
  const watchedValue = "formControl" in props && props.formControl ? useWatch({
@@ -304,6 +308,8 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
304
308
  onStaticInteract: renderRealInput,
305
309
  actionContent: staticTodayIcon,
306
310
  actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
311
+ wrapContentAndTrailing: true,
312
+ contentAndTrailingClassName: "gap-2!",
307
313
  trailingClassName: "py-0! pl-0!",
308
314
  trailingContent: showDropdown ? ui.dateInput.dateTimeIcon : void 0,
309
315
  children: staticSegments
@@ -209,6 +209,7 @@ var TimePicker = ({ renderStaticInput, ...props }) => {
209
209
  },
210
210
  renderStatic: true,
211
211
  onStaticInteract: renderRealInput,
212
+ wrapContentAndTrailing: true,
212
213
  trailingClassName: "py-0! pl-0!",
213
214
  trailingContent: showDropdown ? ui.dateInput.timeIcon : void 0,
214
215
  children: staticSegments
@@ -120,6 +120,7 @@ var NumberRangeInputBase = (props) => {
120
120
  });
121
121
  };
122
122
  var NumberRangeInput = ({ renderStaticInput, ...props }) => {
123
+ const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
123
124
  const ui = UIConfig.useConfig();
124
125
  const { locale } = useLocale();
125
126
  const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
@@ -144,6 +145,7 @@ var NumberRangeInput = ({ renderStaticInput, ...props }) => {
144
145
  const rangeError = staticValue.min !== null && staticValue.max !== null && staticValue.min > staticValue.max ? props.invalidRangeError ?? "Minimum cannot be greater than maximum" : void 0;
145
146
  const effectiveError = props.error || rangeError;
146
147
  const as = props.as ?? ui.input.as;
148
+ const size = props.size ?? ui.input.size;
147
149
  let isDisabled = !!props.isDisabled;
148
150
  if (isFormControlDisabled) isDisabled = true;
149
151
  const isClearable = props.isClearable ?? ui.input.isClearable;
@@ -165,12 +167,15 @@ var NumberRangeInput = ({ renderStaticInput, ...props }) => {
165
167
  inputClassName: props.inputClassName,
166
168
  contentClassName: "pr-0!",
167
169
  trailingClassName: "py-0! pl-0!",
168
- contentWrapperClassName: "flex w-full items-center gap-input-gap-input-text-to-elements",
170
+ contentWrapperClassName: clsx("flex w-full items-center gap-input-gap-input-text-to-elements pr-0! py-0! px-0!", inputSizeCva({
171
+ size,
172
+ as
173
+ })),
169
174
  dataAttributes,
170
175
  renderStatic: true,
171
176
  onStaticInteract: renderRealInput,
172
177
  isClearable: false,
173
- labelPlacement: "content-row",
178
+ labelPlacement: "content-wrapper",
174
179
  children: ({ id, ...dataAttributeProps }) => /* @__PURE__ */ jsxs(Fragment, { children: [
175
180
  /* @__PURE__ */ jsx("input", {
176
181
  id,
@@ -1,8 +1,8 @@
1
- import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
2
1
  import { UIConfig } from "../../../../config/uiConfig.context.js";
3
2
  import { InputFrame } from "../../Skeleton/InputFrame.js";
4
3
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
5
4
  import { SelectBase } from "../shared/SelectBase.js";
5
+ import { StaticSelectTrailingContent } from "../shared/StaticSelectTrailingContent.js";
6
6
  import { getStaticSelectValue } from "../shared/staticSelect.utils.js";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { clsx } from "clsx";
@@ -54,6 +54,7 @@ function Autocomplete({ renderStaticInput, ...props }) {
54
54
  if (!renderInput && !!props.customTrigger) setRenderInput(true);
55
55
  if (!renderInput) {
56
56
  const as = props.as ?? ui.input.as;
57
+ const size = props.size ?? ui.input.size;
57
58
  let isDisabled = !!props.isDisabled;
58
59
  if (isFormControlDisabled) isDisabled = true;
59
60
  const mode = props.selectionMode ?? ui.select.selectionMode;
@@ -69,7 +70,12 @@ function Autocomplete({ renderStaticInput, ...props }) {
69
70
  selectedTagsType: props.selectedTagsType ?? ui.select.selectedTagsType
70
71
  });
71
72
  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 trailingContent = /* @__PURE__ */ jsx(StaticSelectTrailingContent, {
74
+ trailingContent: props.trailingContent,
75
+ hideDropdownIcon: props.hideDropdownIcon,
76
+ isDisabled,
77
+ size
78
+ });
73
79
  const placeholder = as === "floating" ? null : props.placeholder;
74
80
  const shouldRenderPlaceholderAfterValue = mode !== "single" && props.placeholder && !isEmpty;
75
81
  const inputValue = !isMultiple && selectedItem ? selectedItem.label : "";
@@ -94,7 +100,7 @@ function Autocomplete({ renderStaticInput, ...props }) {
94
100
  dataAttributes,
95
101
  renderStatic: true,
96
102
  onStaticInteract: renderRealInput,
97
- trailingClassName: "pl-1-5 gap-0!",
103
+ wrapTrailingContent: false,
98
104
  leadingContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
99
105
  className: "ml-input-side-default flex shrink-0 items-center",
100
106
  children: props.leadingContent
@@ -1,8 +1,9 @@
1
- import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
1
+ import { Typography } from "../../../text/Typography/Typography.js";
2
2
  import { UIConfig } from "../../../../config/uiConfig.context.js";
3
3
  import { InputFrame } from "../../Skeleton/InputFrame.js";
4
4
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
5
5
  import { SelectBase } from "../shared/SelectBase.js";
6
+ import { StaticSelectTrailingContent } from "../shared/StaticSelectTrailingContent.js";
6
7
  import { getStaticSelectValue } from "../shared/staticSelect.utils.js";
7
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
9
  import { clsx } from "clsx";
@@ -50,6 +51,7 @@ function Select({ renderStaticInput, ...props }) {
50
51
  if (!renderInput && !!props.customTrigger) setRenderInput(true);
51
52
  if (!renderInput) {
52
53
  const as = props.as ?? ui.input.as;
54
+ const size = props.size ?? ui.input.size;
53
55
  let isDisabled = !!props.isDisabled;
54
56
  if (isFormControlDisabled) isDisabled = true;
55
57
  const mode = props.selectionMode ?? ui.select.selectionMode;
@@ -66,7 +68,12 @@ function Select({ renderStaticInput, ...props }) {
66
68
  selectedTagsType: props.selectedTagsType ?? ui.select.selectedTagsType
67
69
  });
68
70
  const isSearchable = props.isSearchable ?? ui.select.isSearchable;
69
- const trailingContent = props.trailingContent || !props.hideDropdownIcon ? /* @__PURE__ */ jsxs(Fragment, { children: [props.trailingContent, !props.hideDropdownIcon ? /* @__PURE__ */ jsx(ArrowDropDownIcon, { className: `size-6 shrink-0 ${isDisabled ? "text-interactive-text-secondary-disabled" : "text-interactive-text-secondary-idle"}` }) : void 0] }) : void 0;
71
+ const trailingContent = /* @__PURE__ */ jsx(StaticSelectTrailingContent, {
72
+ trailingContent: props.trailingContent,
73
+ hideDropdownIcon: props.hideDropdownIcon,
74
+ isDisabled,
75
+ size
76
+ });
70
77
  const placeholder = as === "floating" ? null : props.placeholder;
71
78
  const inputValue = !isMultiple && selectedItem ? selectedItem.label : "";
72
79
  const shouldRenderPlaceholderAfterValue = isMultiple && props.placeholder && !isEmpty;
@@ -81,10 +88,17 @@ function Select({ renderStaticInput, ...props }) {
81
88
  dataHasSelection: !isEmpty,
82
89
  dataHasSearch: false
83
90
  };
84
- const buttonContent = isMultiple && !isEmpty ? /* @__PURE__ */ jsx(Fragment, { children: "\xA0" }) : isEmpty ? /* @__PURE__ */ jsx("span", {
85
- className: "text-text-default-3",
91
+ const buttonContent = isMultiple && !isEmpty ? /* @__PURE__ */ jsx(Fragment, { children: "\xA0" }) : isEmpty ? /* @__PURE__ */ jsx(Typography, {
92
+ size: "label-1",
93
+ as: "span",
94
+ className: "block truncate text-text-default-3",
86
95
  children: placeholder
87
- }) : displayValue;
96
+ }) : /* @__PURE__ */ jsx(Typography, {
97
+ size: "label-1",
98
+ as: "span",
99
+ className: "block truncate",
100
+ children: displayValue
101
+ });
88
102
  return /* @__PURE__ */ jsx(InputFrame, {
89
103
  ...props,
90
104
  isDisabled,
@@ -94,7 +108,7 @@ function Select({ renderStaticInput, ...props }) {
94
108
  labelPlacement: "content-row",
95
109
  dataAttributes,
96
110
  renderStatic: true,
97
- trailingClassName: "pl-1-5 gap-0!",
111
+ wrapTrailingContent: false,
98
112
  onStaticInteract: renderRealInput,
99
113
  leadingContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
100
114
  className: "ml-input-side-default flex shrink-0 items-center",
@@ -111,7 +125,7 @@ function Select({ renderStaticInput, ...props }) {
111
125
  "aria-expanded": false,
112
126
  value: inputValue,
113
127
  placeholder: shouldRenderPlaceholderAfterValue ? props.placeholder : placeholder ?? void 0,
114
- className: clsx("w-full flex-1 bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled", props.inputClassName),
128
+ className: clsx("w-full flex-1 bg-transparent text-label-1 outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled", props.inputClassName),
115
129
  onChange: (event) => replayStaticInputChange(event.target.value),
116
130
  ...dataAttributeProps,
117
131
  "data-rac": true
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { InputVariantProps } from '../../shared/input.cva';
3
+ interface StaticSelectTrailingContentProps extends Pick<InputVariantProps, "size"> {
4
+ trailingContent?: ReactNode;
5
+ hideDropdownIcon?: boolean;
6
+ isDisabled?: boolean;
7
+ }
8
+ export declare const StaticSelectTrailingContent: ({ trailingContent, hideDropdownIcon, isDisabled, size, }: StaticSelectTrailingContentProps) => import("react/jsx-runtime").JSX.Element | null;
9
+ export {};
@@ -0,0 +1,22 @@
1
+ import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
2
+ import { UIStyle } from "../../../../config/uiStyle.context.js";
3
+ import { inputSize } from "../../shared/input.cva.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { clsx } from "clsx";
6
+ //#region src/components/inputs/Selection/shared/StaticSelectTrailingContent.tsx
7
+ var StaticSelectTrailingContent = ({ trailingContent, hideDropdownIcon, isDisabled, size }) => {
8
+ const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
9
+ if (!trailingContent && hideDropdownIcon) return null;
10
+ return /* @__PURE__ */ jsxs(Fragment, { children: [trailingContent && /* @__PURE__ */ jsx("div", {
11
+ className: "flex shrink-0 items-center",
12
+ children: trailingContent
13
+ }), !hideDropdownIcon ? /* @__PURE__ */ jsx("button", {
14
+ type: "button",
15
+ tabIndex: -1,
16
+ className: clsx("self-stretch border-0! pl-1-5 outline-none", inputSizeCva({ size })),
17
+ "aria-hidden": "true",
18
+ children: /* @__PURE__ */ jsx(ArrowDropDownIcon, { className: clsx("size-6 shrink-0", isDisabled ? "text-interactive-text-secondary-disabled" : "text-interactive-text-secondary-idle") })
19
+ }) : void 0] });
20
+ };
21
+ //#endregion
22
+ export { StaticSelectTrailingContent };
@@ -3,4 +3,4 @@ import { Key } from 'react-aria-components';
3
3
  import { SelectItem } from './select.types';
4
4
  export type QueryFn<TData = any> = (...args: any[]) => UseQueryResult<TData> | UseInfiniteQueryResult<TData>;
5
5
  export type QueryDataType<TQueryFn extends QueryFn> = Exclude<ReturnType<TQueryFn>["data"], undefined>;
6
- export declare const getQueryItems: <TQueryFn extends QueryFn, TKey extends Key = Key>(data: QueryDataType<TQueryFn> | undefined, queryMap?: (data: QueryDataType<TQueryFn>) => SelectItem<TKey>[]) => SelectItem<TKey>[];
6
+ export declare const getQueryItems: <TQueryFn extends QueryFn, TKey extends Key = Key>(data: QueryDataType<TQueryFn> | undefined, queryMap?: (data: QueryDataType<TQueryFn>) => SelectItem<TKey>[]) => any;
@@ -1,8 +1,14 @@
1
1
  //#region src/components/inputs/Selection/shared/querySelect.utils.ts
2
+ var isQueryItemsPage = (page) => {
3
+ return !!page && typeof page === "object" && "items" in page && Array.isArray(page.items);
4
+ };
2
5
  var getQueryItems = (data, queryMap) => {
3
6
  if (!data) return [];
4
7
  if (queryMap) return queryMap(data);
5
- if (Array.isArray(data)) return data;
8
+ if (Array.isArray(data)) {
9
+ if (data.every(isQueryItemsPage)) return data.flatMap((page) => page.items);
10
+ return data;
11
+ }
6
12
  if (typeof data === "object" && data !== null) {
7
13
  if ("items" in data && Array.isArray(data.items)) return data.items;
8
14
  if ("pages" in data && Array.isArray(data.pages)) return data.pages.flatMap((page) => page && typeof page === "object" && "items" in page && Array.isArray(page.items) ? page.items : []);
@@ -1,5 +1,5 @@
1
- import { useSelectItems } from "./useSelectItems.js";
2
1
  import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
2
+ import { useSelectItems } from "./useSelectItems.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { createContext, use, useCallback, useEffect, useMemo, useRef, useState } from "react";
5
5
  //#region src/components/inputs/Selection/shared/select.context.tsx
@@ -69,7 +69,9 @@ export interface InputFrameProps extends InputVariantProps, Partial<FormFieldPro
69
69
  inputClassName?: string;
70
70
  contentClassName?: string;
71
71
  contentWrapperClassName?: string;
72
+ contentAndTrailingClassName?: string;
72
73
  wrapContentAndTrailing?: boolean;
74
+ wrapTrailingContent?: boolean;
73
75
  labelPlacement?: InputFrameLabelPlacement;
74
76
  trailingClassName?: string;
75
77
  }
@@ -19,7 +19,7 @@ var InputFrame = (props) => {
19
19
  const inputContentWrapperCva = UIStyle.useCva("input.contentWrapperCva", inputContentWrapper);
20
20
  const typographyCva = UIStyle.useCva("typography.cva", typography);
21
21
  const generatedInputId = useId();
22
- const { ref, children, formFieldRef, labelProps: labelPropsProp, headerProps, error, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isHeaderHidden, hideLabel: hideLabelProp, headerClassName, errorClassName, className, leadingContent, leadingIcon, actionContent, actionContentPlacement = "content-wrapper", trailingContent, trailingIcon, trailingAction, unit, isLoading, action, isClearable: isClearableProp, showClear, renderStatic, onStaticInteract, clearClassName, onClear, dataAttributes, typographySize, id: idProp, inputClassName, contentClassName, contentWrapperClassName, wrapContentAndTrailing, labelPlacement = "content-wrapper", trailingClassName, onMouseEnter, onFocusCapture, variant: variantProp, as: asProp, size: sizeProp } = props;
22
+ const { ref, children, formFieldRef, labelProps: labelPropsProp, headerProps, error, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isHeaderHidden, hideLabel: hideLabelProp, headerClassName, errorClassName, className, leadingContent, leadingIcon, actionContent, actionContentPlacement = "content-wrapper", trailingContent, trailingIcon, trailingAction, unit, isLoading, action, isClearable: isClearableProp, showClear, renderStatic, onStaticInteract, clearClassName, onClear, dataAttributes, typographySize, id: idProp, inputClassName, contentClassName, contentWrapperClassName, contentAndTrailingClassName, wrapContentAndTrailing, wrapTrailingContent = true, labelPlacement = "content-wrapper", trailingClassName, onMouseEnter, onFocusCapture, variant: variantProp, as: asProp, size: sizeProp } = props;
23
23
  const as = asProp ?? ui.input.as;
24
24
  const size = sizeProp ?? ui.input.size;
25
25
  const variant = variantProp ?? ui.input.variant;
@@ -96,47 +96,48 @@ var InputFrame = (props) => {
96
96
  })
97
97
  ]
98
98
  });
99
- const trailingRow = hasTrailingContent ? /* @__PURE__ */ jsxs("div", {
99
+ const trailingContentNodes = hasTrailingContent ? /* @__PURE__ */ jsxs(Fragment, { children: [
100
+ hasClear && /* @__PURE__ */ jsx(InputClear, {
101
+ onClear: () => onClear?.(),
102
+ className: clearClassName,
103
+ show: !!showClear,
104
+ renderStatic
105
+ }),
106
+ trailingContent,
107
+ unit && /* @__PURE__ */ jsx("span", {
108
+ className: typographyCva({
109
+ size: "label-2",
110
+ sizeMobile: "label-2",
111
+ variant: "prominent-1",
112
+ className: "text-text-default-3"
113
+ }),
114
+ children: unit
115
+ }),
116
+ isLoading && /* @__PURE__ */ jsx("div", {
117
+ className: "inline-flex",
118
+ children: /* @__PURE__ */ jsx(Loader, {})
119
+ }),
120
+ !isLoading && action && /* @__PURE__ */ jsx(InlineIconButton, {
121
+ color: "secondary",
122
+ icon: action.icon,
123
+ isDisabled,
124
+ onPress: action.onClick,
125
+ excludeFromTabOrder: true,
126
+ label: action.altText,
127
+ className: clsx("border-0!", action.className)
128
+ }),
129
+ !isLoading && !action && trailingIcon && renderIconVisual(trailingIcon),
130
+ trailingAction
131
+ ] }) : null;
132
+ const trailingRow = wrapTrailingContent && trailingContentNodes ? /* @__PURE__ */ jsx("div", {
100
133
  className: clsx("flex items-center gap-input-gap-trailing-elements", inputSizeCva({
101
134
  size,
102
135
  as
103
136
  }), !isTrailingInteractive && "pointer-events-none", trailingClassName),
104
- children: [
105
- hasClear && /* @__PURE__ */ jsx(InputClear, {
106
- onClear: () => onClear?.(),
107
- className: clearClassName,
108
- show: !!showClear,
109
- renderStatic
110
- }),
111
- trailingContent,
112
- unit && /* @__PURE__ */ jsx("span", {
113
- className: typographyCva({
114
- size: "label-2",
115
- sizeMobile: "label-2",
116
- variant: "prominent-1",
117
- className: "text-text-default-3"
118
- }),
119
- children: unit
120
- }),
121
- isLoading && /* @__PURE__ */ jsx("div", {
122
- className: "inline-flex",
123
- children: /* @__PURE__ */ jsx(Loader, {})
124
- }),
125
- !isLoading && action && /* @__PURE__ */ jsx(InlineIconButton, {
126
- color: "secondary",
127
- icon: action.icon,
128
- isDisabled,
129
- onPress: action.onClick,
130
- excludeFromTabOrder: true,
131
- label: action.altText,
132
- className: clsx("border-0!", action.className)
133
- }),
134
- !isLoading && !action && trailingIcon && renderIconVisual(trailingIcon),
135
- trailingAction
136
- ]
137
- }) : null;
137
+ children: trailingContentNodes
138
+ }) : trailingContentNodes;
138
139
  const inputFrameContent = wrapContentAndTrailing ? /* @__PURE__ */ jsxs("div", {
139
- className: "flex w-full items-center gap-input-gap-input-text-to-elements",
140
+ className: clsx("flex w-full items-center gap-input-gap-input-text-to-elements", contentAndTrailingClassName),
140
141
  children: [contentRow, trailingRow]
141
142
  }) : /* @__PURE__ */ jsxs(Fragment, { children: [contentRow, trailingRow] });
142
143
  return /* @__PURE__ */ jsx(TooltipWrapper, {
@@ -4,12 +4,24 @@ var useStaticInputHandoff = ({ inputRef, renderInput, setRenderInput, getFocusTa
4
4
  const [shouldFocus, setShouldFocus] = useState(false);
5
5
  const pendingStaticChangeRef = useRef(null);
6
6
  const shouldReplayStaticPressRef = useRef(false);
7
+ const shouldReplayStaticHoverRef = useRef(false);
7
8
  useLayoutEffect(() => {
8
- if (!renderInput || !shouldFocus) return;
9
- const focusRealInput = (replayPendingInteraction) => {
9
+ if (!renderInput) return;
10
+ const getInteractionTarget = () => {
10
11
  const input = inputRef.current;
12
+ return input ? getFocusTarget?.(input) ?? input : null;
13
+ };
14
+ if (shouldReplayStaticHoverRef.current) {
15
+ shouldReplayStaticHoverRef.current = false;
16
+ const target = getInteractionTarget();
17
+ target?.dispatchEvent(new PointerEvent("pointerover", { bubbles: true }));
18
+ target?.dispatchEvent(new MouseEvent("mouseover", { bubbles: true }));
19
+ target?.dispatchEvent(new MouseEvent("mouseenter"));
20
+ }
21
+ if (!shouldFocus) return;
22
+ const focusRealInput = (replayPendingInteraction) => {
11
23
  const pendingValue = pendingStaticChangeRef.current;
12
- const focusTarget = input ? getFocusTarget?.(input) ?? input : null;
24
+ const focusTarget = getInteractionTarget();
13
25
  if (replayPendingInteraction && focusTarget instanceof HTMLInputElement && pendingValue != null) {
14
26
  (Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set)?.call(focusTarget, pendingValue);
15
27
  focusTarget.dispatchEvent(new Event("input", { bubbles: true }));
@@ -39,14 +51,17 @@ var useStaticInputHandoff = ({ inputRef, renderInput, setRenderInput, getFocusTa
39
51
  shouldFocus,
40
52
  renderRealInput: (focus) => {
41
53
  setShouldFocus(focus);
54
+ shouldReplayStaticHoverRef.current = !focus;
42
55
  setRenderInput(true);
43
56
  },
44
57
  replayStaticInputChange: (value) => {
58
+ shouldReplayStaticHoverRef.current = false;
45
59
  pendingStaticChangeRef.current = value;
46
60
  setShouldFocus(true);
47
61
  setRenderInput(true);
48
62
  },
49
63
  replayStaticInputPress: () => {
64
+ shouldReplayStaticHoverRef.current = false;
50
65
  shouldReplayStaticPressRef.current = true;
51
66
  setShouldFocus(true);
52
67
  setRenderInput(true);
@@ -5,6 +5,7 @@ var isFilterSearchParams = (params) => {
5
5
  return typeof params === "object" && params !== null && "filter" in params;
6
6
  };
7
7
  var useQueryAutocomplete = ({ query, queryParams, queryOptions, mapItems, initialQueryState, search }) => {
8
+ "use no memo";
8
9
  const [isQueryEnabled, setIsQueryEnabled] = useState(!initialQueryState);
9
10
  const queryResult = query(search === void 0 ? queryParams : {
10
11
  ...queryParams,
@@ -34,7 +35,7 @@ var useQueryAutocomplete = ({ query, queryParams, queryOptions, mapItems, initia
34
35
  const totalItems = infiniteQueryResult?.data?.pages?.[0]?.totalItems;
35
36
  const items = useMemo(() => {
36
37
  if (!data) return [];
37
- return mapItems(isInfiniteQuery ? data.pages?.flatMap((page) => page?.items ?? []) : data);
38
+ return mapItems(isInfiniteQuery ? data.pages : data);
38
39
  }, [
39
40
  data,
40
41
  isInfiniteQuery,
package/dist/index.js CHANGED
@@ -69,9 +69,9 @@ import { useLongPressRepeat } from "./hooks/useLongPressRepeat.js";
69
69
  import { useScrollableListBox } from "./hooks/useScrollableListBox.js";
70
70
  import { DateTimeUtils } from "./utils/date-time.utils.js";
71
71
  import { FormField } from "./components/inputs/FormField/FormField.js";
72
+ import { useDebounceCallback } from "./hooks/useDebounceCallback.js";
72
73
  import { DatePicker } from "./components/inputs/DateTime/DatePicker/DatePicker.js";
73
74
  import { Tag } from "./components/text/Tag/Tag.js";
74
- import { useDebounceCallback } from "./hooks/useDebounceCallback.js";
75
75
  import { useIntersectionObserver } from "./hooks/useIntersectionObserver.js";
76
76
  import { TextInput } from "./components/inputs/Input/TextInput/TextInput.js";
77
77
  import { Select } from "./components/inputs/Selection/Select/Select.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.3.0-rc.4",
3
+ "version": "2.3.0-rc.6",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",