@payfit/unity-components 2.46.39 → 2.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/esm/components/definition-list/DefinitionList.context.js +17 -0
  2. package/dist/esm/components/definition-list/DefinitionList.js +23 -0
  3. package/dist/esm/components/definition-list/parts/DefinitionItem.js +51 -0
  4. package/dist/esm/components/multi-select/MultiSelect.d.ts +6 -1
  5. package/dist/esm/components/multi-select/MultiSelect.js +286 -238
  6. package/dist/esm/components/multi-select/Multiselect.context.d.ts +1 -1
  7. package/dist/esm/components/multi-select/MultiselectTypes.d.ts +5 -4
  8. package/dist/esm/components/multi-select/parts/MultiSelectOptGroup.d.ts +20 -13
  9. package/dist/esm/components/multi-select/parts/MultiSelectOptGroup.js +33 -22
  10. package/dist/esm/components/multi-select/parts/MultiSelectOption.d.ts +6 -3
  11. package/dist/esm/components/multi-select/parts/MultiSelectOption.js +51 -59
  12. package/dist/esm/components/multi-select/utils/selection-adapter.d.ts +5 -0
  13. package/dist/esm/components/multi-select/utils/selection-adapter.js +18 -0
  14. package/dist/esm/components/phone-number/PhoneNumberInput.js +38 -36
  15. package/dist/esm/components/select/Select.js +47 -44
  16. package/dist/esm/index.d.ts +2 -0
  17. package/dist/esm/index.js +444 -440
  18. package/package.json +7 -7
  19. package/dist/esm/components/multi-select/hooks/use-combobox-filter.d.ts +0 -12
  20. package/dist/esm/components/multi-select/hooks/use-combobox-filter.js +0 -22
  21. package/dist/esm/components/multi-select/hooks/use-multiselection-state.d.ts +0 -14
  22. package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +0 -47
  23. package/dist/esm/components/multi-select/parts/MultiSelectButton.d.ts +0 -18
  24. package/dist/esm/components/multi-select/parts/MultiSelectButton.js +0 -174
  25. package/dist/esm/components/multi-select/parts/MultiSelectPopover.d.ts +0 -7
  26. package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +0 -65
  27. package/dist/esm/components/select/parts/SearchInput.d.ts +0 -5
  28. package/dist/esm/components/select/parts/SearchInput.js +0 -59
@@ -0,0 +1,17 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { createContext as n, useContext as r } from "react";
3
+ const i = n(void 0), f = ({
4
+ children: t,
5
+ layout: e
6
+ }) => /* @__PURE__ */ o(i.Provider, { value: { layout: e }, children: t }), u = () => {
7
+ const t = r(i);
8
+ if (!t)
9
+ throw new Error(
10
+ "useDefinitionListContext must be used within a DefinitionList"
11
+ );
12
+ return t;
13
+ };
14
+ export {
15
+ f as DefinitionListContextProvider,
16
+ u as useDefinitionListContext
17
+ };
@@ -0,0 +1,23 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import * as e from "react";
3
+ import { uyTv as n } from "@payfit/unity-themes";
4
+ import { DefinitionListContextProvider as s } from "./DefinitionList.context.js";
5
+ const f = n({
6
+ base: "uy:flex uy:flex-col",
7
+ variants: {
8
+ layout: {
9
+ horizontal: [
10
+ "uy:gap-y-100",
11
+ "uy:grid uy:grid-cols-[auto_1fr] uy:gap-x-1000"
12
+ ],
13
+ vertical: "uy:gap-200"
14
+ }
15
+ },
16
+ defaultVariants: {
17
+ layout: "horizontal"
18
+ }
19
+ }), l = e.forwardRef(({ layout: i = "vertical", children: o, ...r }, a) => /* @__PURE__ */ t(s, { layout: i, children: /* @__PURE__ */ t("dl", { ref: a, className: f({ layout: i }), ...r, children: o }) }));
20
+ l.displayName = "DefinitionList";
21
+ export {
22
+ l as DefinitionList
23
+ };
@@ -0,0 +1,51 @@
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { forwardRef as d } from "react";
3
+ import { uyTv as u } from "@payfit/unity-themes";
4
+ import { Text as p } from "../../text/Text.js";
5
+ import { useDefinitionListContext as f } from "../DefinitionList.context.js";
6
+ const b = u({
7
+ slots: {
8
+ base: "uy:flex",
9
+ term: "uy:items-center uy:flex uy:gap-25",
10
+ description: "uy:flex-1 uy:typography-body"
11
+ },
12
+ variants: {
13
+ layout: {
14
+ horizontal: {
15
+ base: ["uy:grid uy:grid-cols-subgrid uy:col-span-2"]
16
+ },
17
+ vertical: { base: "uy:flex-col uy:gap-25" }
18
+ },
19
+ verticalAlign: {
20
+ start: {
21
+ base: "uy:items-start"
22
+ },
23
+ center: {
24
+ base: "uy:items-center"
25
+ }
26
+ }
27
+ },
28
+ defaultVariants: {
29
+ layout: "horizontal"
30
+ }
31
+ }), x = d(({ term: i, termSuffix: r, description: a, verticalAlign: o, ...s }, n) => {
32
+ const { layout: l } = f(), {
33
+ base: m,
34
+ term: y,
35
+ description: c
36
+ } = b({
37
+ layout: l,
38
+ verticalAlign: o
39
+ });
40
+ return /* @__PURE__ */ t("div", { ref: n, className: m(), ...s, children: [
41
+ /* @__PURE__ */ t("dt", { className: y(), children: [
42
+ /* @__PURE__ */ e(p, { variant: "bodyStrong", color: "inherit", asElement: "span", children: i }),
43
+ r
44
+ ] }),
45
+ /* @__PURE__ */ e("dd", { className: c(), "data-dd-privacy": "mask", children: a })
46
+ ] });
47
+ });
48
+ x.displayName = "DefinitionItem";
49
+ export {
50
+ x as DefinitionItem
51
+ };
@@ -4,6 +4,11 @@ import { MultiSelectComponent } from './MultiselectTypes.js';
4
4
  * The component provides two different APIs:
5
5
  * 1. Static API - For simple cases where options are defined as direct children and use primitive values as keys (strings or numbers)
6
6
  * 2. Dynamic API - For data-driven cases where options are generated from a dynamic collection with typed objects
7
+ *
8
+ * Selection is backed by React Aria and exposed as a Set of option keys. For dynamic options,
9
+ * the selected keys are resolved back to their original items before calling `renderValue`.
10
+ * Searchable multiselects use each option's `textValue` when provided, then fall back to
11
+ * string children for filtering and typeahead.
7
12
  * @example
8
13
  * ```tsx
9
14
  * import { MultiSelect, MultiSelectOption, MultiSelectOptGroup } from '@payfit/unity-components'
@@ -44,7 +49,7 @@ import { MultiSelectComponent } from './MultiselectTypes.js';
44
49
  * }
45
50
  * >
46
51
  * {(item) => (
47
- * <MultiSelectOption value={item.id}>
52
+ * <MultiSelectOption value={item.id} textValue={item.name}>
48
53
  * {item.name}
49
54
  * </MultiSelectOption>
50
55
  * )}
@@ -1,256 +1,304 @@
1
- import { jsx as f, jsxs as ie, Fragment as fe } from "react/jsx-runtime";
2
- import { forwardRef as de, useMemo as I, useCallback as i, useRef as me } from "react";
3
- import { ComboboxProvider as Se, SelectProvider as q, useSelectContext as ye, useStoreState as pe } from "@ariakit/react";
4
- import { useComboboxFilter as he } from "./hooks/use-combobox-filter.js";
5
- import { useMultiSelectionState as Ve } from "./hooks/use-multiselection-state.js";
6
- import { MultiSelectContext as z } from "./Multiselect.context.js";
7
- import { MultiSelectButton as ge } from "./parts/MultiSelectButton.js";
8
- import { MultiSelectPopover as ve } from "./parts/MultiSelectPopover.js";
9
- function J(t) {
10
- return t instanceof Map;
11
- }
12
- function Ie(t) {
13
- return !Object.prototype.hasOwnProperty.call(t, "items");
14
- }
15
- function a(t) {
16
- return String(t);
17
- }
18
- function b(t) {
19
- return isNaN(Number(t)) ? t : Number(t);
20
- }
21
- function X(t) {
22
- return Array.from(t, a);
1
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
2
+ import { forwardRef as he, useRef as U, useState as W, useMemo as h, useCallback as l } from "react";
3
+ import { reactAriaValueToSet as ve, setToReactAriaDefaultValue as xe, setToReactAriaValue as Se } from "./utils/selection-adapter.js";
4
+ import { uyTv as we } from "@payfit/unity-themes";
5
+ import { useFilter as Ve, Autocomplete as Ce } from "react-aria-components/Autocomplete";
6
+ import { Button as Ie, ButtonContext as Me } from "react-aria-components/Button";
7
+ import { ListBox as q } from "react-aria-components/ListBox";
8
+ import { Popover as Oe } from "react-aria-components/Popover";
9
+ import { Select as Ne } from "react-aria-components/Select";
10
+ import { Separator as Pe } from "react-aria-components/Separator";
11
+ import { useIntl as Ae } from "react-intl";
12
+ import { Badge as Re } from "../badge/Badge.js";
13
+ import { CircularIconButton as Be } from "../icon-button/CircularIconButton.js";
14
+ import { Icon as H } from "../icon/Icon.js";
15
+ import { Search as De } from "../search/Search.js";
16
+ import { Spinner as je } from "../spinner/Spinner.js";
17
+ import { MultiSelectContext as Ee } from "./Multiselect.context.js";
18
+ const ze = we({
19
+ slots: {
20
+ root: "uy:relative uy:flex uy:flex-col uy:gap-100 uy:w-full",
21
+ trigger: "uy:relative uy:h-5.5 uy:sm:h-500 uy:flex uy:items-center uy:justify-between uy:py-125 uy:sm:py-100 uy:px-150 uy:w-full uy:border uy:border-solid uy:rounded-100 uy:sm:rounded-75 uy:focus-visible:outline-none uy:focus-visible:ring-2 uy:focus-visible:ring-utility-focus-ring uy:focus-visible:ring-offset-2 uy:active:not([disabled]):border-border-form-active uy:pointer-events-auto!",
22
+ inputValue: "uy:flex-1 uy:typography-body uy:text-left uy:line-clamp-1",
23
+ state: "uy:grow-0 uy:outline-none uy:typography-body uy:placeholder:text-content-neutral-lowest uy:inline-flex uy:gap-50 uy:items-center uy:px-100",
24
+ suffix: "uy:text-content-neutral-lowest",
25
+ clearButton: "uy:absolute uy:right-[36px] uy:top-1/2 uy:z-10 uy:-translate-y-1/2",
26
+ popover: "uy:shadow-300 uy:absolute uy:top-full uy:left-0 uy:z-50 uy:w-[var(--trigger-width)] uy:rounded-100 uy:sm:rounded-75 uy:border uy:border-solid uy:border-border-neutral uy:bg-surface-neutral uy:overflow-y-auto uy:overflow-x-hidden uy:max-h-[min(var(--popover-available-height,300px),300px)] uy:outline-none",
27
+ list: "uy:p-100 uy:overflow-y-auto uy:overflow-x-hidden"
28
+ },
29
+ variants: {
30
+ isDisabled: {
31
+ true: {
32
+ trigger: "uy:bg-surface-form-disabled uy:cursor-not-allowed uy:border-border-form-disabled uy:text-content-form-disabled",
33
+ inputValue: "uy:text-content-form-disabled!",
34
+ state: "uy:text-content-form-disabled",
35
+ suffix: "uy:text-content-form-disabled"
36
+ }
37
+ },
38
+ isReadOnly: {
39
+ true: {
40
+ trigger: "uy:bg-surface-form-disabled uy:cursor-not-allowed uy:border-border-form-disabled",
41
+ inputValue: "uy:text-content-form-disabled",
42
+ state: "uy:text-content-form-disabled",
43
+ suffix: "uy:text-content-form-disabled"
44
+ }
45
+ },
46
+ isInvalid: {
47
+ true: {
48
+ trigger: "uy:bg-surface-form-error uy:border-border-form-error",
49
+ inputValue: "uy:text-content-form-error",
50
+ state: "uy:text-content-form-error"
51
+ }
52
+ },
53
+ isEmpty: {
54
+ true: {
55
+ inputValue: "uy:text-content-neutral-lowest"
56
+ },
57
+ false: {
58
+ inputValue: "uy:text-content-form-enabled"
59
+ }
60
+ }
61
+ },
62
+ compoundVariants: [
63
+ {
64
+ isInvalid: !1,
65
+ isDisabled: !1,
66
+ isReadOnly: !1,
67
+ className: {
68
+ trigger: "uy:border-border-form-enabled uy:bg-surface-form-enabled",
69
+ inputValue: "uy:text-content-form-enabled uy:bg-surface-form-enabled",
70
+ state: "uy:text-content-neutral-disabled"
71
+ }
72
+ },
73
+ {
74
+ isEmpty: !0,
75
+ isDisabled: !1,
76
+ isReadOnly: !1,
77
+ isInvalid: !1,
78
+ className: {
79
+ inputValue: "uy:text-content-neutral-lowest"
80
+ }
81
+ }
82
+ ]
83
+ });
84
+ function J(e) {
85
+ return e instanceof Map;
23
86
  }
24
- function U(t) {
25
- return new Set(X(t));
87
+ function ke(e) {
88
+ return !Object.prototype.hasOwnProperty.call(e, "items");
26
89
  }
27
- function W({
28
- props: t,
29
- ref: C,
30
- content: r,
31
- typedRenderValue: A,
32
- selectedItemsForDisplay: O
33
- }) {
34
- const K = ye(), P = pe(K, "open"), u = me(!1), {
35
- placeholder: M,
36
- isDisabled: c,
37
- isReadOnly: y,
38
- isLoading: p,
39
- isInvalid: w,
40
- onClearButtonPress: x,
41
- onBlur: n,
42
- onFocus: R,
43
- ...j
44
- } = t, h = i(() => {
45
- P || !u.current && n && (u.current = !0, n());
46
- }, [P, n]), d = i(() => {
47
- u.current = !1, R?.();
48
- }, [R]), V = i(() => {
49
- setTimeout(() => {
50
- const S = document.activeElement, g = K?.getState().contentElement;
51
- g && S !== g && !g.contains(S) && !u.current && n && (u.current = !0, n());
52
- }, 0);
53
- }, [n, K]);
54
- return /* @__PURE__ */ ie(fe, { children: [
55
- /* @__PURE__ */ f(
56
- ge,
57
- {
58
- ref: C,
59
- placeholder: M,
60
- isDisabled: c,
61
- isReadOnly: y,
62
- isLoading: p,
63
- isInvalid: w,
64
- renderValue: A,
65
- selectedItems: O,
66
- onClearButtonPress: x,
67
- onBlur: h,
68
- onFocus: d,
69
- ...j
70
- }
71
- ),
72
- /* @__PURE__ */ f(ve, { onBlur: V, children: r })
73
- ] });
90
+ function Q(e) {
91
+ return typeof e == "object" && e !== null && "value" in e && (typeof e.value == "string" || typeof e.value == "number") ? e.value : typeof e == "object" && e !== null && "id" in e && (typeof e.id == "string" || typeof e.id == "number") ? e.id : typeof e == "string" || typeof e == "number" ? e : String(e);
74
92
  }
75
- const be = (t, C) => {
76
- const r = Ie(t), A = (e) => typeof e == "object" && e !== null && "value" in e && (typeof e.value == "string" || typeof e.value == "number") ? e.value : typeof e == "object" && e !== null && "id" in e && (typeof e.id == "string" || typeof e.id == "number") ? e.id : typeof e == "string" || typeof e == "number" ? e : String(e), P = r ? (e) => Array.from(e).map(String).join(", ") : (e) => Array.from(e).map((o) => A(o)).join(", "), u = t, M = t, c = I(
77
- () => r ? void 0 : u.items,
78
- [r, u.items]
79
- ), y = r ? void 0 : u.getItemValue, { children: p } = r ? M : u, w = r ? void 0 : u.searchOptions, { children: x } = M, n = i(
80
- (e) => r || !y ? A(e) : y(e),
81
- [r, y]
82
- ), {
83
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
84
- children: R,
85
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
86
- getItemValue: j,
87
- value: h,
88
- defaultValue: d,
89
- onChange: V,
90
- isSearchable: S,
91
- renderValue: g,
92
- maxVisibleItems: N = 7
93
- } = t, Y = g ?? P, v = i(() => r || !c ? [] : J(c) ? Array.from(c.values()).flat() : Array.from(c), [c, r]), Z = i(() => {
94
- if ("value" in t)
95
- return h ? U(h) : /* @__PURE__ */ new Set();
96
- }, [t, h]), $ = i(() => d ? U(d) : /* @__PURE__ */ new Set(), [d]), ee = i(
97
- (e) => {
98
- if (!V) return;
99
- const o = new Set(
100
- Array.from(e).map((s) => b(s))
101
- );
102
- V(o);
93
+ const Le = (e) => Array.from(e).map(String).join(", "), Te = (e) => Array.from(e).map((v) => Q(v)).join(", ");
94
+ function Fe(e, v) {
95
+ const d = Ae(), X = U(null), Y = U(null), [Z, C] = W(!1), o = ke(e), I = e, M = e, {
96
+ placeholder: c,
97
+ isDisabled: f,
98
+ isReadOnly: u,
99
+ isLoading: O,
100
+ isInvalid: y,
101
+ onClearButtonPress: N,
102
+ onBlur: _,
103
+ onFocus: $,
104
+ onChange: P,
105
+ onOpenChange: A,
106
+ value: x,
107
+ defaultValue: R,
108
+ isSearchable: B,
109
+ renderValue: ee,
110
+ maxVisibleItems: m = 7,
111
+ children: S,
112
+ searchOptions: te,
113
+ ...re
114
+ } = e, [D, oe] = W(() => new Set(R ?? [])), n = o ? void 0 : I.items, w = o ? void 0 : I.getItemValue, p = x !== void 0, a = h(
115
+ () => p ? new Set(x) : D,
116
+ [p, x, D]
117
+ ), j = ee ?? (o ? Le : Te), E = l(
118
+ (t) => o || !w ? Q(t) : w(t),
119
+ [w, o]
120
+ ), z = l(() => o || !n ? [] : J(n) ? Array.from(n.values()).flat() : Array.from(n), [n, o]), ne = h(() => {
121
+ if (o)
122
+ return new Set(a);
123
+ const t = z(), s = /* @__PURE__ */ new Set();
124
+ return a.forEach((V) => {
125
+ const K = t.find((ge) => E(ge) === V);
126
+ K && s.add(K);
127
+ }), s;
128
+ }, [z, o, E, a]), b = Array.from(ne), k = Math.max(
129
+ b.length - m,
130
+ 0
131
+ ), L = a.size > 0 && !f && !u && !O, {
132
+ root: ae,
133
+ trigger: le,
134
+ inputValue: se,
135
+ state: ue,
136
+ suffix: ie,
137
+ clearButton: de,
138
+ popover: ce,
139
+ list: T
140
+ } = ze({
141
+ isDisabled: !!f,
142
+ isReadOnly: !!u,
143
+ isInvalid: !!y,
144
+ isEmpty: a.size === 0
145
+ }), fe = h(() => {
146
+ if (b.length === 0) return c;
147
+ const t = b.slice(0, m), s = new Set(t);
148
+ return j(
149
+ s
150
+ );
151
+ }, [m, c, j, b]), g = l(
152
+ (t) => {
153
+ p || oe(t), P?.(t);
103
154
  },
104
- [V]
105
- ), {
106
- selectedKeys: m,
107
- selectKey: E,
108
- unselectKey: T
109
- } = Ve({
110
- selectedKeys: Z(),
111
- defaultSelectedKeys: $(),
112
- onSelectionChange: ee
113
- }), te = i(
114
- (e) => {
115
- E(a(e));
155
+ [p, P]
156
+ ), ye = l(
157
+ (t) => {
158
+ g(ve(t));
116
159
  },
117
- [E]
118
- ), re = i(
119
- (e) => {
120
- T(a(e));
160
+ [g]
161
+ ), me = l(() => {
162
+ g(/* @__PURE__ */ new Set()), N?.();
163
+ }, [N, g]), pe = l(
164
+ (t) => {
165
+ C(t), A?.(t);
121
166
  },
122
- [T]
123
- ), { setSearchQuery: ne, matchingItems: F } = he({
124
- items: v(),
125
- extractSearchableText: (e) => r ? [""] : [a(n(e))],
126
- enabled: S,
127
- searchOptions: w
128
- }), oe = () => {
129
- if (r) return Array.from(m);
130
- const e = v();
131
- return Array.from(m).map((o) => {
132
- const s = e.find(
133
- (l) => a(n(l)) === o
134
- );
135
- return s ? n(s) : b(o);
136
- });
137
- }, le = () => {
138
- if (r)
139
- return new Set(
140
- Array.from(m).map((s) => b(s))
141
- );
142
- const e = v(), o = /* @__PURE__ */ new Set();
143
- return Array.from(m).forEach((s) => {
144
- const l = e.find(
145
- (D) => a(n(D)) === s
146
- );
147
- l && o.add(l);
148
- }), o;
149
- }, se = () => {
150
- if (d)
151
- return X(d);
152
- }, B = I(oe, [
153
- m,
154
- r,
155
- n,
156
- v
157
- ]), G = I(le, [
158
- m,
159
- r,
160
- n,
161
- v
162
- ]), L = I(se, [d]), _ = (e) => {
163
- const o = new Set(e), s = new Set(B.map((l) => a(l)));
164
- for (const l of o)
165
- s.has(l) || te(b(l));
166
- for (const l of s)
167
- o.has(l) || re(b(l));
168
- }, H = i(() => {
169
- if (r)
170
- return x;
171
- if (!c) return null;
172
- if (J(c)) {
173
- const e = c;
174
- return Array.from(e.entries()).map(
175
- ([o, s]) => {
176
- const l = s.filter(
177
- (D) => F.some((ue) => {
178
- const ce = n(D), ae = n(ue);
179
- return a(ae) === a(ce);
180
- })
181
- );
182
- return p(o, l);
183
- }
167
+ [C, A]
168
+ ), F = l(() => {
169
+ if (o)
170
+ return M.children;
171
+ if (!n) return null;
172
+ if (J(n)) {
173
+ const t = n;
174
+ return Array.from(t.entries()).map(
175
+ ([s, V]) => S(s, V)
184
176
  );
185
177
  }
186
- return F.map(
187
- (e) => p(e)
178
+ return Array.from(n).map(
179
+ (t) => S(t)
188
180
  );
189
- }, [
190
- p,
191
- c,
192
- F,
193
- x,
194
- n,
195
- r
196
- ]), Q = I(() => H(), [H]), k = Y;
197
- return S ? /* @__PURE__ */ f(Se, { resetValueOnHide: !0, setValue: ne, children: /* @__PURE__ */ f(
198
- q,
181
+ }, [S, n, o, M.children]), G = h(() => F(), [F]), { contains: be } = Ve(te ?? { sensitivity: "base" });
182
+ return /* @__PURE__ */ r(
183
+ Ne,
199
184
  {
200
- value: B.map(
201
- (e) => a(e)
202
- ),
203
- defaultValue: L,
204
- setValue: _,
205
- focusLoop: !0,
206
- children: /* @__PURE__ */ f(
207
- z.Provider,
185
+ ...re,
186
+ ref: X,
187
+ className: ae(),
188
+ isDisabled: f || u,
189
+ isInvalid: y,
190
+ onBlur: _,
191
+ onChange: ye,
192
+ onFocus: $,
193
+ onOpenChange: pe,
194
+ placeholder: c,
195
+ selectionMode: "multiple",
196
+ shouldCloseOnSelect: !1,
197
+ value: Se(a),
198
+ defaultValue: xe(R),
199
+ allowsEmptyCollection: !0,
200
+ children: /* @__PURE__ */ i(
201
+ Ee.Provider,
208
202
  {
209
- value: { isSearchable: S, maxVisibleItems: N, selectedKeys: m },
210
- children: /* @__PURE__ */ f(
211
- W,
212
- {
213
- props: t,
214
- ref: C,
215
- content: Q,
216
- typedRenderValue: k,
217
- selectedItemsForDisplay: G
218
- }
219
- )
220
- }
221
- )
222
- }
223
- ) }) : /* @__PURE__ */ f(
224
- q,
225
- {
226
- value: B.map(
227
- (e) => a(e)
228
- ),
229
- defaultValue: L,
230
- setValue: _,
231
- focusLoop: !0,
232
- children: /* @__PURE__ */ f(
233
- z.Provider,
234
- {
235
- value: { isSearchable: S, maxVisibleItems: N, selectedKeys: m },
236
- children: /* @__PURE__ */ f(
237
- W,
238
- {
239
- props: t,
240
- ref: C,
241
- content: Q,
242
- typedRenderValue: k,
243
- selectedItemsForDisplay: G
244
- }
245
- )
203
+ value: { isSearchable: B, maxVisibleItems: m, selectedKeys: a },
204
+ children: [
205
+ /* @__PURE__ */ i(
206
+ Ie,
207
+ {
208
+ ref: v,
209
+ className: le(),
210
+ "data-dd-privacy": "mask",
211
+ isDisabled: f || u,
212
+ "aria-invalid": y,
213
+ "aria-readonly": u,
214
+ children: [
215
+ /* @__PURE__ */ r("span", { className: se(), translate: "no", children: a.size > 0 ? fe : c }),
216
+ /* @__PURE__ */ i("span", { className: ue(), children: [
217
+ O && /* @__PURE__ */ r(
218
+ je,
219
+ {
220
+ color: "inherit",
221
+ size: "small",
222
+ label: d.formatMessage({
223
+ id: "unity:component:form-field:form-input:spinner:label",
224
+ defaultMessage: "Loading"
225
+ })
226
+ }
227
+ ),
228
+ y && /* @__PURE__ */ r(
229
+ H,
230
+ {
231
+ src: "WarningCircleOutlined",
232
+ color: "content.form.invalid",
233
+ alt: d.formatMessage({
234
+ id: "unity:component:form-field:form-input:error:alt",
235
+ defaultMessage: "Error"
236
+ })
237
+ }
238
+ ),
239
+ k > 0 && /* @__PURE__ */ i(Re, { variant: "numeric", children: [
240
+ "+",
241
+ k
242
+ ] }),
243
+ L && /* @__PURE__ */ r("span", { className: "uy:w-300 uy:shrink-0", "aria-hidden": !0 })
244
+ ] }),
245
+ /* @__PURE__ */ r(
246
+ H,
247
+ {
248
+ className: ie(),
249
+ src: Z ? "CaretUpOutlined" : "CaretDownOutlined",
250
+ role: "presentation"
251
+ }
252
+ )
253
+ ]
254
+ }
255
+ ),
256
+ L && /* @__PURE__ */ r(Me.Provider, { value: null, children: /* @__PURE__ */ r(
257
+ Be,
258
+ {
259
+ title: d.formatMessage({
260
+ id: "unity:component:common:clear:title",
261
+ defaultMessage: "Clear"
262
+ }),
263
+ className: de(),
264
+ icon: "CloseOutlined",
265
+ onPress: me,
266
+ asElement: "button"
267
+ }
268
+ ) }),
269
+ /* @__PURE__ */ r(
270
+ Oe,
271
+ {
272
+ ref: Y,
273
+ offset: 1,
274
+ containerPadding: 8,
275
+ className: ce(),
276
+ children: B ? /* @__PURE__ */ i(Ce, { filter: be, children: [
277
+ /* @__PURE__ */ r("div", { className: "uy:m-100", children: /* @__PURE__ */ r(
278
+ De,
279
+ {
280
+ label: d.formatMessage({
281
+ id: "unity:component:select:search:label",
282
+ defaultMessage: "Search options"
283
+ }),
284
+ "data-dd-privacy": "mask"
285
+ }
286
+ ) }),
287
+ /* @__PURE__ */ r(Pe, { className: "uy:mx-100 uy:border-t uy:border-border-neutral uy:border-solid" }),
288
+ /* @__PURE__ */ r(q, { className: T(), children: G })
289
+ ] }) : /* @__PURE__ */ r(q, { className: T(), children: G })
290
+ }
291
+ )
292
+ ]
246
293
  }
247
294
  )
248
295
  }
249
296
  );
250
- }, Ce = de(
251
- be
297
+ }
298
+ const Ge = he(
299
+ Fe
252
300
  );
253
- Ce.displayName = "MultiSelect";
301
+ Ge.displayName = "MultiSelect";
254
302
  export {
255
- Ce as MultiSelect
303
+ Ge as MultiSelect
256
304
  };
@@ -1,7 +1,7 @@
1
1
  interface MultiSelectContextType {
2
2
  isSearchable?: boolean;
3
3
  maxVisibleItems?: number;
4
- selectedKeys?: Set<string>;
4
+ selectedKeys?: Set<string | number>;
5
5
  }
6
6
  export declare const MultiSelectContext: import('react').Context<MultiSelectContextType>;
7
7
  export {};