@povio/ui 2.2.9-rc.28 → 2.2.9-rc.29

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.
@@ -190,7 +190,8 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
190
190
  "data-is-disabled": dataAttributes.dataIsDisabled || void 0,
191
191
  "data-disabled": dataAttributes.dataDisabled || void 0,
192
192
  "data-invalid": dataAttributes.dataInvalid || void 0,
193
- "data-has-selection": dataAttributes.dataHasSelection || void 0
193
+ "data-has-selection": dataAttributes.dataHasSelection || void 0,
194
+ "data-rac": true
194
195
  })
195
196
  });
196
197
  }
@@ -188,7 +188,8 @@ var TextInput = ({ renderStaticInput, ...props }) => {
188
188
  "data-is-disabled": dataAttributes.dataIsDisabled || void 0,
189
189
  "data-disabled": dataAttributes.dataDisabled || void 0,
190
190
  "data-invalid": dataAttributes.dataInvalid || void 0,
191
- "data-has-selection": dataAttributes.dataHasSelection || void 0
191
+ "data-has-selection": dataAttributes.dataHasSelection || void 0,
192
+ "data-rac": true
192
193
  })
193
194
  });
194
195
  }
@@ -79,6 +79,7 @@ function Autocomplete({ renderStaticInput, ...props }) {
79
79
  isDisabled,
80
80
  className: clsx("w-full", props.containerClassName),
81
81
  inputClassName: clsx(props.className, props.inputClassName),
82
+ contentWrapperClassName: "flex flex-1 flex-wrap gap-input-gap-input-text-to-elements truncate",
82
83
  labelPlacement: "content-row",
83
84
  dataAttributes: {
84
85
  dataIsEmpty: isEmpty,
@@ -99,7 +100,7 @@ function Autocomplete({ renderStaticInput, ...props }) {
99
100
  as,
100
101
  size: props.size ?? ui.input.size,
101
102
  variant: props.variant ?? ui.input.variant,
102
- actionContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
103
+ leadingContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
103
104
  className: "ml-input-side-default flex shrink-0 items-center",
104
105
  children: props.leadingContent
105
106
  }),
@@ -68,8 +68,7 @@ function Select({ renderStaticInput, ...props }) {
68
68
  });
69
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;
70
70
  const placeholder = as === "floating" ? null : props.placeholder;
71
- const shouldRenderPlaceholderAfterValue = mode !== "single" && props.placeholder && !isEmpty;
72
- return /* @__PURE__ */ jsxs(InputFrame, {
71
+ return /* @__PURE__ */ jsx(InputFrame, {
73
72
  ...props,
74
73
  isHeaderHidden: props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
75
74
  hideLabel: props.hideLabel ?? ui.input.hideLabel,
@@ -97,20 +96,17 @@ function Select({ renderStaticInput, ...props }) {
97
96
  as,
98
97
  size: props.size ?? ui.input.size,
99
98
  variant: props.variant ?? ui.input.variant,
100
- actionContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
99
+ leadingContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
101
100
  className: "ml-input-side-default flex shrink-0 items-center",
102
101
  children: props.leadingContent
103
102
  }),
104
103
  isClearable,
105
104
  showClear: false,
106
105
  trailingContent,
107
- children: [isEmpty ? /* @__PURE__ */ jsx("span", {
106
+ children: isEmpty ? /* @__PURE__ */ jsx("span", {
108
107
  className: "text-text-default-3",
109
108
  children: placeholder
110
- }) : displayValue, shouldRenderPlaceholderAfterValue && /* @__PURE__ */ jsx("div", {
111
- className: "shrink-0 text-text-default-3",
112
- children: props.placeholder
113
- })]
109
+ }) : displayValue
114
110
  });
115
111
  }
116
112
  return /* @__PURE__ */ jsx(_Select, {
@@ -44,7 +44,12 @@ var SelectContext;
44
44
  hasLoadMore,
45
45
  isClientSearchDisabled: ignoreInputValueFiltering ?? isClientSearchDisabled
46
46
  });
47
- const selectedItems = useMemo(() => allItems.filter(({ id }) => Array.isArray(fieldState.value) ? fieldState.value.includes(id) : id === fieldState.value), [allItems, fieldState.value]);
47
+ const selectedItems = useMemo(() => {
48
+ const getItem = (id) => allItems.find((item) => item.id === id) ?? null;
49
+ if (Array.isArray(fieldState.value)) return fieldState.value.map((id) => getItem(id)).filter((item) => item !== null);
50
+ const selectedItem = fieldState.value != null ? getItem(fieldState.value) : null;
51
+ return selectedItem ? [selectedItem] : [];
52
+ }, [allItems, fieldState.value]);
48
53
  const selectedIds = useMemo(() => selectedItems.map(({ id }) => id), [selectedItems]);
49
54
  const getItem = useCallback((value) => allItems.find((item) => item && item.id === value) ?? null, [allItems]);
50
55
  const updateValue = useCallback((value) => {
@@ -8,8 +8,7 @@ var getStaticSelectValue = ({ items, value, selectionMode, initialSelection, map
8
8
  const initialSelectedItems = initialSelection ? (Array.isArray(initialSelection) ? initialSelection : [initialSelection]).map((item) => mapInitialToSelectItem(item)) : [];
9
9
  const allItemsMap = /* @__PURE__ */ new Map();
10
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;
11
+ const getItem = (id) => allItemsMap.get(id) ?? null;
13
12
  const selectedItems = Array.isArray(value) ? value.map((id) => getItem(id)).filter((item) => item != null) : [];
14
13
  const selectedItem = !Array.isArray(value) && value != null ? getItem(value) : null;
15
14
  if (selectionMode === "multiple") return {
@@ -98,12 +98,14 @@ var InputFrame = ({ ref, children, formFieldRef, labelProps, headerProps, error,
98
98
  children: renderIconVisual(leadingIcon)
99
99
  }),
100
100
  labelPlacement === "content-row" && labelContent,
101
- labelPlacement === "content-row" && actionContent,
102
101
  /* @__PURE__ */ jsxs("div", {
103
- className: clsx(inputContentWrapperCva({ as }), contentWrapperClassName),
102
+ className: inputContentWrapperCva({
103
+ as,
104
+ className: contentWrapperClassName
105
+ }),
104
106
  children: [
105
107
  labelPlacement === "content-wrapper" && labelContent,
106
- labelPlacement === "content-wrapper" && actionContent,
108
+ actionContent,
107
109
  children
108
110
  ]
109
111
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.9-rc.28",
3
+ "version": "2.2.9-rc.29",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",