@povio/ui 2.2.9-rc.19 → 2.2.9-rc.20

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.
@@ -217,9 +217,9 @@ var DatePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput, ...pr
217
217
  const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
218
218
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
219
219
  const showDropdown = !props.disableDropdown || disableManualEntry;
220
- const staticPlaceholder = props.placeholder ?? DateTimeUtils.getDatePlaceholder(locale);
221
220
  const staticDateValue = rawValue ? parseCalendarDate(rawValue) : null;
222
221
  const displayValue = staticDateValue ? DateTimeUtils.formatCalendarDateLocalized(staticDateValue, locale) : "";
222
+ const staticPlaceholder = rawValue ? "" : props.placeholder ?? DateTimeUtils.getDatePlaceholder(locale);
223
223
  return /* @__PURE__ */ jsx(StaticInput, {
224
224
  ...props,
225
225
  onInteract: (focus) => {
@@ -237,8 +237,19 @@ var DatePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput, ...pr
237
237
  placeholder: staticPlaceholder,
238
238
  displayValue,
239
239
  isEmpty: !displayValue,
240
+ dataAttributes: {
241
+ dataIsEmpty: staticDateValue === null,
242
+ dataIsFilled: staticDateValue !== null,
243
+ dataIsDirty: props.isDirty,
244
+ dataIsRequired: props.isRequired,
245
+ dataIsDisabled: isDisabled,
246
+ dataDisabled: isDisabled,
247
+ dataInvalid: !!props.error,
248
+ dataHasSelection: staticDateValue !== null
249
+ },
240
250
  contentRowClassName: datePickerInputContentRowCva({ size }),
241
251
  leadingContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
252
+ leadingContentClassName: "ml-0!",
242
253
  trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0
243
254
  });
244
255
  }
@@ -13,7 +13,7 @@ import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
13
13
  import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
14
14
  import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
15
15
  import { RangeCalendar } from "../shared/RangeCalendar.js";
16
- import { jsx, jsxs } from "react/jsx-runtime";
16
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
17
  import { clsx } from "clsx";
18
18
  import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
19
19
  import { Button } from "react-aria-components";
@@ -616,17 +616,14 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
616
616
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
617
617
  const showDropdown = !props.disableDropdown || disableManualEntry;
618
618
  const defaultDatePlaceholder = DateTimeUtils.getDatePlaceholder(locale);
619
- const staticPlaceholder = props.placeholder ?? /* @__PURE__ */ jsxs("span", {
620
- className: "inline-flex items-center gap-input-gap-input-text-to-elements",
621
- children: [
622
- /* @__PURE__ */ jsx("span", { children: defaultDatePlaceholder }),
623
- /* @__PURE__ */ jsx("span", {
624
- className: "pointer-events-none select-none",
625
- children: "–"
626
- }),
627
- /* @__PURE__ */ jsx("span", { children: defaultDatePlaceholder })
628
- ]
629
- });
619
+ const staticPlaceholder = !!(rawValue?.start || rawValue?.end) ? "" : props.placeholder ?? /* @__PURE__ */ jsxs(Fragment, { children: [
620
+ /* @__PURE__ */ jsx("span", { children: defaultDatePlaceholder }),
621
+ /* @__PURE__ */ jsx("span", {
622
+ className: "pointer-events-none select-none",
623
+ children: ""
624
+ }),
625
+ /* @__PURE__ */ jsx("span", { children: defaultDatePlaceholder })
626
+ ] });
630
627
  const formatStaticDate = (value) => {
631
628
  if (!value) return "";
632
629
  const parsedDate = parseCalendarDate(value);
@@ -636,17 +633,14 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
636
633
  const start = formatStaticDate(rawValue?.start ?? null);
637
634
  const end = formatStaticDate(rawValue?.end ?? null);
638
635
  const hasRangeValue = !!(start && end);
639
- const displayValue = hasRangeValue ? /* @__PURE__ */ jsxs("span", {
640
- className: "inline-flex items-center gap-input-gap-input-text-to-elements",
641
- children: [
642
- /* @__PURE__ */ jsx("span", { children: start }),
643
- /* @__PURE__ */ jsx("span", {
644
- className: "pointer-events-none select-none",
645
- children: "–"
646
- }),
647
- /* @__PURE__ */ jsx("span", { children: end })
648
- ]
649
- }) : void 0;
636
+ const displayValue = hasRangeValue ? /* @__PURE__ */ jsxs(Fragment, { children: [
637
+ /* @__PURE__ */ jsx("span", { children: start }),
638
+ /* @__PURE__ */ jsx("span", {
639
+ className: "pointer-events-none select-none",
640
+ children: ""
641
+ }),
642
+ /* @__PURE__ */ jsx("span", { children: end })
643
+ ] }) : void 0;
650
644
  return /* @__PURE__ */ jsx(StaticInput, {
651
645
  ...props,
652
646
  onInteract: (focus) => {
@@ -664,8 +658,19 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
664
658
  placeholder: staticPlaceholder,
665
659
  displayValue,
666
660
  isEmpty: !hasRangeValue,
661
+ dataAttributes: {
662
+ dataIsEmpty: !hasRangeValue,
663
+ dataIsFilled: hasRangeValue,
664
+ dataIsDirty: props.isDirty,
665
+ dataIsRequired: props.isRequired,
666
+ dataIsDisabled: isDisabled,
667
+ dataDisabled: isDisabled,
668
+ dataInvalid: !!props.error,
669
+ dataHasSelection: hasRangeValue
670
+ },
667
671
  contentRowClassName: datePickerInputContentRowCva({ size }),
668
672
  leadingContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
673
+ leadingContentClassName: "ml-0!",
669
674
  trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0
670
675
  });
671
676
  }
@@ -230,9 +230,9 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
230
230
  const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
231
231
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
232
232
  const showDropdown = !props.disableDropdown || disableManualEntry;
233
- const staticPlaceholder = props.placeholder ?? DateTimeUtils.getDateTimePlaceholder(locale);
234
233
  const staticDateTimeValue = rawValue ? parseDateValue(rawValue) : null;
235
234
  const displayValue = staticDateTimeValue && "hour" in staticDateTimeValue ? DateTimeUtils.formatCalendarDateTimeLocalized(staticDateTimeValue, locale) : "";
235
+ const staticPlaceholder = rawValue ? "" : props.placeholder ?? DateTimeUtils.getDateTimePlaceholder(locale);
236
236
  return /* @__PURE__ */ jsx(StaticInput, {
237
237
  ...props,
238
238
  onInteract: (focus) => {
@@ -250,8 +250,19 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
250
250
  placeholder: staticPlaceholder,
251
251
  displayValue,
252
252
  isEmpty: !displayValue,
253
+ dataAttributes: {
254
+ dataIsEmpty: staticDateTimeValue === null,
255
+ dataIsFilled: staticDateTimeValue !== null,
256
+ dataIsDirty: props.isDirty,
257
+ dataIsRequired: props.isRequired,
258
+ dataIsDisabled: isDisabled,
259
+ dataDisabled: isDisabled,
260
+ dataInvalid: !!props.error,
261
+ dataHasSelection: staticDateTimeValue !== null
262
+ },
253
263
  contentRowClassName: datePickerInputContentRowCva({ size }),
254
264
  leadingContent: renderDatePickerTodayIcon(todayIcon, todayIconButtonSize),
265
+ leadingContentClassName: "ml-0!",
255
266
  trailingContent: showDropdown ? ui.dateInput.dateTimeIcon : void 0
256
267
  });
257
268
  }
@@ -177,9 +177,9 @@ var TimePicker = ({ renderStaticInput, ...props }) => {
177
177
  if (isFormControlDisabled) isDisabled = true;
178
178
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
179
179
  const showDropdown = !props.disableDropdown || disableManualEntry;
180
- const staticPlaceholder = props.placeholder ?? DateTimeUtils.getTimePlaceholder(locale);
181
180
  const staticTimeValue = rawValue ? parseTimeValue(rawValue) : null;
182
181
  const displayValue = staticTimeValue ? DateTimeUtils.formatTimeLocalized(staticTimeValue, locale) : "";
182
+ const staticPlaceholder = rawValue ? "" : props.placeholder ?? DateTimeUtils.getTimePlaceholder(locale);
183
183
  return /* @__PURE__ */ jsx(StaticInput, {
184
184
  ...props,
185
185
  onInteract: (focus) => {
@@ -197,6 +197,16 @@ var TimePicker = ({ renderStaticInput, ...props }) => {
197
197
  placeholder: staticPlaceholder,
198
198
  displayValue,
199
199
  isEmpty: !displayValue,
200
+ dataAttributes: {
201
+ dataIsEmpty: staticTimeValue === null,
202
+ dataIsFilled: staticTimeValue !== null,
203
+ dataIsDirty: props.isDirty,
204
+ dataIsRequired: props.isRequired,
205
+ dataIsDisabled: isDisabled,
206
+ dataDisabled: isDisabled,
207
+ dataInvalid: !!props.error,
208
+ dataHasSelection: staticTimeValue !== null
209
+ },
200
210
  trailingContent: showDropdown ? ui.dateInput.timeIcon : void 0
201
211
  });
202
212
  }
@@ -127,6 +127,7 @@ var renderIconVisual = (icon) => {
127
127
  };
128
128
  var NumberInput = ({ renderStaticInput, ...props }) => {
129
129
  const ui = UIConfig.useConfig();
130
+ const { locale } = useLocale();
130
131
  const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
131
132
  const [shouldFocus, setShouldFocus] = useState(false);
132
133
  const inputRef = useRef(null);
@@ -143,7 +144,8 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
143
144
  }, [renderInput, shouldFocus]);
144
145
  if (!renderInput) {
145
146
  const staticValue = watchedValue ?? props.value ?? props.defaultValue;
146
- const displayValue = staticValue == null ? "" : `${staticValue}`;
147
+ const formatOptions = props.formatOptions ?? ui.numberInput.formatOptions;
148
+ const displayValue = staticValue == null ? "" : new Intl.NumberFormat(locale, formatOptions).format(staticValue);
147
149
  const hasValue = displayValue !== "";
148
150
  const as = props.as ?? ui.input.as;
149
151
  const size = props.size ?? ui.input.size;
@@ -175,9 +177,19 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
175
177
  isDisabled,
176
178
  className: clsx("group w-full", as === "inline" && "h-full", props.className),
177
179
  inputClassName: props.inputClassName,
178
- placeholder: as === "floating" ? "" : props.placeholder,
180
+ placeholder: as === "floating" || staticValue ? "" : props.placeholder,
179
181
  displayValue,
180
182
  isEmpty: !hasValue,
183
+ dataAttributes: {
184
+ dataIsEmpty: !!!staticValue,
185
+ dataIsFilled: !(`${staticValue}` === "" || staticValue === null || staticValue === void 0),
186
+ dataIsDirty: props.isDirty,
187
+ dataIsRequired: props.isRequired,
188
+ dataIsDisabled: isDisabled,
189
+ dataDisabled: isDisabled,
190
+ dataInvalid: !!props.error,
191
+ dataHasSelection: hasValue
192
+ },
181
193
  leadingVisual: renderIconVisual(props.leadingIcon),
182
194
  trailingContent
183
195
  });
@@ -178,6 +178,16 @@ var TextInput = ({ renderStaticInput, ...props }) => {
178
178
  placeholder: as === "floating" ? "" : props.placeholder,
179
179
  displayValue,
180
180
  isEmpty: !hasValue,
181
+ dataAttributes: {
182
+ dataIsEmpty: !hasValue,
183
+ dataIsFilled: hasValue,
184
+ dataIsDirty: props.isDirty,
185
+ dataIsRequired: props.isRequired,
186
+ dataIsDisabled: isDisabled,
187
+ dataDisabled: isDisabled,
188
+ dataInvalid: !!props.error,
189
+ dataHasSelection: hasValue
190
+ },
181
191
  leadingVisual: renderIconVisual(props.leadingIcon),
182
192
  trailingContent
183
193
  });
@@ -62,6 +62,8 @@ function Autocomplete({ renderStaticInput, ...props }) {
62
62
  items: props.items,
63
63
  value: currentValue,
64
64
  selectionMode: mode,
65
+ initialSelection: props.initialSelection,
66
+ mapInitialToSelectItem: props.mapInitialToSelectItem,
65
67
  showSelectionContent: props.showSelectionContent,
66
68
  isDisabled,
67
69
  collapseAfter: props.collapseAfter ?? ui.select.collapseAfter,
@@ -82,9 +84,20 @@ function Autocomplete({ renderStaticInput, ...props }) {
82
84
  isDisabled,
83
85
  className: clsx("w-full", props.containerClassName),
84
86
  inputClassName: clsx(props.className, props.inputClassName),
85
- placeholder: as === "floating" ? "" : props.placeholder,
87
+ placeholder: as === "floating" || mode === "single" && !isEmpty ? "" : props.placeholder,
86
88
  displayValue,
87
89
  isEmpty,
90
+ dataAttributes: {
91
+ dataIsEmpty: isEmpty,
92
+ dataIsFilled: !isEmpty,
93
+ dataIsDirty: props.isDirty,
94
+ dataIsRequired: props.isRequired,
95
+ dataIsDisabled: isDisabled,
96
+ dataDisabled: isDisabled,
97
+ dataInvalid: !!props.error,
98
+ dataHasSelection: !isEmpty,
99
+ dataHasSearch: false
100
+ },
88
101
  leadingContent: props.leadingContent,
89
102
  trailingContent
90
103
  });
@@ -4,7 +4,7 @@ import { FieldValues } from 'react-hook-form';
4
4
  import { SelectBaseProps } from '../shared/SelectBase';
5
5
  import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps, SelectAsyncProps } from '../shared/select.types';
6
6
  import { OmitDiscriminatedUnion } from '../../../../types/common';
7
- export type SelectProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, "initialSelection" | "mapInitialToSelectItem" | keyof SelectAsyncProps> & {
7
+ export type SelectProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, keyof SelectAsyncProps> & {
8
8
  renderStaticInput?: boolean;
9
9
  };
10
10
  export type ControlledSelectProps<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = Omit<SelectProps<TKey, TInitialSelectItem>, keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey, TInitialSelectItem>;
@@ -58,6 +58,8 @@ function Select({ renderStaticInput, ...props }) {
58
58
  items: props.items,
59
59
  value: currentValue,
60
60
  selectionMode: mode,
61
+ initialSelection: props.initialSelection,
62
+ mapInitialToSelectItem: props.mapInitialToSelectItem,
61
63
  showSelectionContent: props.showSelectionContent,
62
64
  isDisabled,
63
65
  collapseAfter: props.collapseAfter ?? ui.select.collapseAfter,
@@ -78,9 +80,20 @@ function Select({ renderStaticInput, ...props }) {
78
80
  isDisabled,
79
81
  className: clsx("w-full", props.containerClassName),
80
82
  inputClassName: clsx(props.className, props.inputClassName),
81
- placeholder: as === "floating" ? "" : props.placeholder,
83
+ placeholder: as === "floating" || mode === "single" && !isEmpty ? "" : props.placeholder,
82
84
  displayValue,
83
85
  isEmpty,
86
+ dataAttributes: {
87
+ dataIsEmpty: isEmpty,
88
+ dataIsFilled: !isEmpty,
89
+ dataIsDirty: props.isDirty,
90
+ dataIsRequired: props.isRequired,
91
+ dataIsDisabled: isDisabled,
92
+ dataDisabled: isDisabled,
93
+ dataInvalid: !!props.error,
94
+ dataHasSelection: !isEmpty,
95
+ dataHasSearch: false
96
+ },
84
97
  leadingContent: props.leadingContent,
85
98
  trailingContent
86
99
  });
@@ -1,11 +1,13 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { Key } from 'react-aria-components';
3
3
  import { SelectBaseProps } from './SelectBase';
4
- import { SelectItem } from './select.types';
5
- interface GetStaticSelectValueOptions<TKey extends Key = Key> {
4
+ import { DefaultInitialSelectItem, SelectItem } from './select.types';
5
+ interface GetStaticSelectValueOptions<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> {
6
6
  items: SelectItem<TKey>[];
7
7
  value: TKey | TKey[] | null | undefined;
8
8
  selectionMode: SelectBaseProps<TKey>["selectionMode"];
9
+ initialSelection?: TInitialSelectItem | TInitialSelectItem[] | null;
10
+ mapInitialToSelectItem?: (item: TInitialSelectItem) => SelectItem<TKey>;
9
11
  showSelectionContent?: boolean;
10
12
  isDisabled?: boolean;
11
13
  collapseAfter?: SelectBaseProps<TKey>["collapseAfter"];
@@ -17,5 +19,5 @@ interface StaticSelectValueResult<TKey extends Key = Key> {
17
19
  displayValue: ReactNode;
18
20
  isEmpty: boolean;
19
21
  }
20
- export declare const getStaticSelectValue: <TKey extends Key = Key>({ items, value, selectionMode, showSelectionContent, isDisabled, collapseAfter, selectedTagsType, }: GetStaticSelectValueOptions<TKey>) => StaticSelectValueResult<TKey>;
22
+ export declare const getStaticSelectValue: <TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>({ items, value, selectionMode, initialSelection, mapInitialToSelectItem, showSelectionContent, isDisabled, collapseAfter, selectedTagsType, }: GetStaticSelectValueOptions<TKey, TInitialSelectItem>) => StaticSelectValueResult<TKey>;
21
23
  export {};
@@ -1,8 +1,15 @@
1
1
  import { SelectInputTags } from "./SelectInputTags.js";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/inputs/Selection/shared/staticSelect.utils.tsx
4
- var getStaticSelectValue = ({ items, value, selectionMode, showSelectionContent, isDisabled, collapseAfter, selectedTagsType }) => {
5
- const getItem = (id) => items.find((item) => item.id === id) ?? null;
4
+ var getStaticSelectValue = ({ items, value, selectionMode, initialSelection, mapInitialToSelectItem = ((item) => ({
5
+ id: item.id,
6
+ label: item.label ?? item.name ?? ""
7
+ })), showSelectionContent, isDisabled, collapseAfter, selectedTagsType }) => {
8
+ const initialSelectedItems = initialSelection ? (Array.isArray(initialSelection) ? initialSelection : [initialSelection]).map((item) => mapInitialToSelectItem(item)) : [];
9
+ const allItemsMap = /* @__PURE__ */ new Map();
10
+ [...initialSelectedItems, ...items].forEach((item) => allItemsMap.set(item.id, item));
11
+ const allItems = Array.from(allItemsMap.values());
12
+ const getItem = (id) => allItems.find((item) => item.id === id) ?? null;
6
13
  const selectedItems = Array.isArray(value) ? value.map((id) => getItem(id)).filter((item) => item != null) : [];
7
14
  const selectedItem = !Array.isArray(value) && value != null ? getItem(value) : null;
8
15
  if (selectionMode === "multiple") return {
@@ -2,6 +2,17 @@ import { ReactNode } from 'react';
2
2
  import { FormFieldProps } from '../FormField/FormField';
3
3
  import { TextInputProps } from '../Input/TextInput/TextInput';
4
4
  import { InputSizeProps, InputVariantProps } from './input.cva';
5
+ type StaticInputDataAttributes = {
6
+ dataDisabled?: boolean;
7
+ dataHasSearch?: boolean;
8
+ dataHasSelection?: boolean;
9
+ dataInvalid?: boolean;
10
+ dataIsDirty?: boolean;
11
+ dataIsDisabled?: boolean;
12
+ dataIsEmpty?: boolean;
13
+ dataIsFilled?: boolean;
14
+ dataIsRequired?: boolean;
15
+ };
5
16
  interface StaticInputProps extends FormFieldProps {
6
17
  onInteract: (shouldFocus: boolean) => void;
7
18
  as?: TextInputProps["as"];
@@ -13,9 +24,11 @@ interface StaticInputProps extends FormFieldProps {
13
24
  isEmpty?: boolean;
14
25
  leadingVisual?: ReactNode;
15
26
  leadingContent?: ReactNode;
27
+ leadingContentClassName?: string;
16
28
  trailingContent?: ReactNode;
17
29
  contentRowClassName?: string;
18
30
  inputClassName?: string;
31
+ dataAttributes?: StaticInputDataAttributes;
19
32
  }
20
- export declare const StaticInput: ({ onInteract, as, size, variant, applyMinInputWidth, placeholder, displayValue, isEmpty, leadingVisual, leadingContent, trailingContent, contentRowClassName, inputClassName, className, ...formFieldProps }: StaticInputProps) => import("react/jsx-runtime").JSX.Element;
33
+ export declare const StaticInput: ({ onInteract, as, size, variant, applyMinInputWidth, placeholder, displayValue, isEmpty, leadingVisual, leadingContent, leadingContentClassName, trailingContent, contentRowClassName, inputClassName, dataAttributes, className, ...formFieldProps }: StaticInputProps) => import("react/jsx-runtime").JSX.Element;
21
34
  export {};
@@ -5,7 +5,7 @@ import { FormField } from "../FormField/FormField.js";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { clsx } from "clsx";
7
7
  //#region src/components/inputs/shared/StaticInput.tsx
8
- var StaticInput = ({ onInteract, as, size, variant, applyMinInputWidth, placeholder, displayValue, isEmpty, leadingVisual, leadingContent, trailingContent, contentRowClassName, inputClassName, className, ...formFieldProps }) => {
8
+ var StaticInput = ({ onInteract, as, size, variant, applyMinInputWidth, placeholder, displayValue, isEmpty, leadingVisual, leadingContent, leadingContentClassName, trailingContent, contentRowClassName, inputClassName, dataAttributes, className, ...formFieldProps }) => {
9
9
  const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
10
10
  const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
11
11
  let hasValue = !!displayValue;
@@ -14,6 +14,13 @@ var StaticInput = ({ onInteract, as, size, variant, applyMinInputWidth, placehol
14
14
  if (hasValue) staticDisplayContent = displayValue;
15
15
  else if (as === "floating") staticDisplayContent = null;
16
16
  const shouldRenderFloatingLineSpacer = as === "floating" && !hasValue;
17
+ const inputDataAttributes = {
18
+ dataIsEmpty: !hasValue,
19
+ dataDisabled: formFieldProps.isDisabled,
20
+ dataIsDisabled: formFieldProps.isDisabled,
21
+ dataHasSelection: hasValue,
22
+ ...dataAttributes
23
+ };
17
24
  return /* @__PURE__ */ jsx(FormField, {
18
25
  ...formFieldProps,
19
26
  as,
@@ -25,44 +32,48 @@ var StaticInput = ({ onInteract, as, size, variant, applyMinInputWidth, placehol
25
32
  onFocus: () => onInteract(true),
26
33
  onClick: () => onInteract(true),
27
34
  onPointerDown: () => onInteract(true),
28
- "data-is-empty": !hasValue || void 0,
29
- "data-disabled": formFieldProps.isDisabled || void 0,
30
- "data-is-disabled": formFieldProps.isDisabled || void 0,
31
- "data-has-selection": hasValue || void 0,
35
+ "data-is-empty": inputDataAttributes.dataIsEmpty || void 0,
36
+ "data-disabled": inputDataAttributes.dataDisabled || void 0,
37
+ "data-is-disabled": inputDataAttributes.dataIsDisabled || void 0,
38
+ "data-has-selection": inputDataAttributes.dataHasSelection || void 0,
39
+ "data-has-search": inputDataAttributes.dataHasSearch || void 0,
40
+ "data-invalid": inputDataAttributes.dataInvalid || void 0,
41
+ "data-is-dirty": inputDataAttributes.dataIsDirty || void 0,
42
+ "data-is-filled": inputDataAttributes.dataIsFilled || void 0,
43
+ "data-is-required": inputDataAttributes.dataIsRequired || void 0,
32
44
  "data-rac": "",
33
45
  className: clsx("group/static-input group/input-content group/select-content relative flex items-center gap-input-gap-input-text-to-elements", applyMinInputWidth && "min-w-input-width-min-width", inputBaseCva({
34
46
  as,
35
47
  variant
36
- }), inputClassName),
37
- children: [/* @__PURE__ */ jsx("div", {
38
- className: "flex w-full items-center gap-input-gap-input-text-to-elements",
39
- children: /* @__PURE__ */ jsxs("div", {
40
- className: clsx(inputSizeCva({
48
+ }), !hasValue && "text-text-default-3", inputClassName),
49
+ children: [/* @__PURE__ */ jsxs("div", {
50
+ className: clsx("group/input-content flex w-full items-center gap-input-gap-input-text-to-elements pr-0!", inputSizeCva({
51
+ size,
52
+ as
53
+ }), contentRowClassName),
54
+ children: [
55
+ leadingVisual && /* @__PURE__ */ jsx("div", {
56
+ className: "pointer-events-none shrink-0",
57
+ children: leadingVisual
58
+ }),
59
+ as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
60
+ as,
41
61
  size,
42
- as
43
- }), "group/input-content flex w-full items-center gap-input-gap-input-text-to-elements pr-0!", contentRowClassName),
44
- children: [
45
- leadingVisual && /* @__PURE__ */ jsx("div", {
46
- className: "pointer-events-none shrink-0",
47
- children: leadingVisual
48
- }),
49
- as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
50
- as,
51
- size,
52
- label: formFieldProps.label,
53
- isRequired: formFieldProps.isRequired,
54
- isDisabled: formFieldProps.isDisabled
55
- }),
56
- leadingContent && /* @__PURE__ */ jsx("div", {
57
- className: "ml-input-side-default flex shrink-0 items-center",
58
- children: leadingContent
59
- }),
60
- /* @__PURE__ */ jsxs("div", {
61
- className: clsx("w-full truncate", !hasValue && "text-text-default-3"),
62
- children: [staticDisplayContent, shouldRenderFloatingLineSpacer && /* @__PURE__ */ jsx(Fragment, { children: "\xA0" })]
63
- })
64
- ]
65
- })
62
+ label: formFieldProps.label,
63
+ isRequired: formFieldProps.isRequired,
64
+ isDisabled: formFieldProps.isDisabled
65
+ }),
66
+ leadingContent && /* @__PURE__ */ jsx("div", {
67
+ className: clsx("ml-input-side-default flex shrink-0 items-center", leadingContentClassName),
68
+ children: leadingContent
69
+ }),
70
+ staticDisplayContent,
71
+ shouldRenderFloatingLineSpacer && /* @__PURE__ */ jsx(Fragment, { children: "\xA0" }),
72
+ placeholder && hasValue && /* @__PURE__ */ jsx("div", {
73
+ className: "text-text-default-3",
74
+ children: placeholder
75
+ })
76
+ ]
66
77
  }), trailingContent && /* @__PURE__ */ jsx("div", {
67
78
  className: clsx(inputSizeCva({
68
79
  size,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.9-rc.19",
3
+ "version": "2.2.9-rc.20",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",