asma-ui-core 3.111.0 → 3.113.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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +95 -93
- package/dist/components/inputs/full-screen-picker/FullScreenPicker.js +93 -0
- package/dist/components/inputs/full-screen-picker/PickerLiveRegion.js +34 -0
- package/dist/components/inputs/full-screen-picker/pickerCopy.js +34 -0
- package/dist/components/inputs/full-screen-picker/useVisualViewportHeight.js +10 -0
- package/dist/components/inputs/input-field/StyledInputField.js +147 -157
- package/dist/components/inputs/phone-field/CountryCodeOptions.js +28 -24
- package/dist/components/inputs/phone-field/CountryCodeSelect.js +82 -75
- package/dist/components/inputs/select-autocomplete/SelectAutocompletePicker.js +217 -0
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +270 -220
- package/dist/components/inputs/select-autocomplete/draftChanges.js +24 -0
- package/dist/components/inputs/select-autocomplete/listboxCursor.js +7 -0
- package/dist/components/inputs/select-autocomplete/readFieldName.js +18 -0
- package/dist/components/inputs/textarea/StyledTextarea.js +46 -47
- package/dist/hooks/useMediaQuery.hook.js +12 -8
- package/dist/index.js +137 -133
- package/dist/src/components/inputs/dynamic-select/StyledDynamicSelect.d.ts +4 -1
- package/dist/src/components/inputs/full-screen-picker/FullScreenPicker.d.ts +62 -0
- package/dist/src/components/inputs/full-screen-picker/PickerLiveRegion.d.ts +31 -0
- package/dist/src/components/inputs/full-screen-picker/index.d.ts +2 -0
- package/dist/src/components/inputs/full-screen-picker/pickerCopy.d.ts +29 -0
- package/dist/src/components/inputs/full-screen-picker/useVisualViewportHeight.d.ts +8 -0
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +4 -1
- package/dist/src/components/inputs/phone-field/CountryCodeOptions.d.ts +9 -1
- package/dist/src/components/inputs/phone-field/CountryCodeSelect.d.ts +4 -3
- package/dist/src/components/inputs/phone-field/useCountryPicker.d.ts +2 -1
- package/dist/src/components/inputs/select-autocomplete/SelectAutocompletePicker.d.ts +52 -0
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +21 -2
- package/dist/src/components/inputs/select-autocomplete/draftChanges.d.ts +17 -0
- package/dist/src/components/inputs/select-autocomplete/listboxCursor.d.ts +9 -0
- package/dist/src/components/inputs/select-autocomplete/readFieldName.d.ts +13 -0
- package/dist/src/helpers/CharacterCounter.d.ts +2 -1
- package/dist/src/hooks/useMediaQuery.hook.d.ts +6 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,77 +1,89 @@
|
|
|
1
1
|
import { cn as f } from "../../../helpers/cn.js";
|
|
2
|
-
import { ChevronDownIcon as
|
|
3
|
-
import {
|
|
4
|
-
import { StyledDialog as z } from "../../feedback/dialog/StyledDialog.js";
|
|
2
|
+
import { ChevronDownIcon as F } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
3
|
+
import { useFullScreenPickerMediaQuery as M } from "../../../hooks/useMediaQuery.hook.js";
|
|
5
4
|
import { StyledPopover as Q } from "../../utils/popover/StyledPopover.js";
|
|
6
5
|
import { notchedOutlineClass as U } from "../field-styles.js";
|
|
7
|
-
import { StyledSearchField as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
import { StyledSearchField as q } from "../search-field/StyledSearchField.js";
|
|
7
|
+
import { FullScreenPicker as L } from "../full-screen-picker/FullScreenPicker.js";
|
|
8
|
+
import { CountryCodeOptions as G } from "./CountryCodeOptions.js";
|
|
9
|
+
import { useCountryPicker as H } from "./useCountryPicker.js";
|
|
10
|
+
import { useEffect as P, useId as J, useRef as w, useState as m } from "react";
|
|
11
|
+
import { Fragment as V, jsx as n, jsxs as h } from "react/jsx-runtime";
|
|
12
|
+
var ae = ({ dataTest: r, countries: y, value: s, onChange: O, disabled: c, selectCountryLabel: g, searchPlaceholder: A, renderFlag: x, labelledBy: E, className: B }) => {
|
|
13
|
+
const [t, d] = m(!1), [R, u] = m(!1), [b, a] = m(""), [W, j] = m(null), v = w(null), I = w(null), C = w(!1), i = M(), l = `${J()}-country-listbox`, k = y.find((e) => e.iso2 === s), D = k === void 0 ? "" : `+${k.dialCode}`, o = H({
|
|
14
|
+
countries: y,
|
|
15
15
|
selectedIso2: s,
|
|
16
|
-
query:
|
|
16
|
+
query: b,
|
|
17
17
|
listId: l,
|
|
18
|
-
onSelect: (
|
|
19
|
-
|
|
18
|
+
onSelect: (e, p = !0) => {
|
|
19
|
+
O(e), p && (d(!1), a(""));
|
|
20
20
|
},
|
|
21
21
|
onDismiss: () => {
|
|
22
22
|
d(!1), a("");
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
|
|
26
|
-
t && !
|
|
27
|
-
}, [t,
|
|
28
|
-
C.current && !t &&
|
|
25
|
+
P(() => {
|
|
26
|
+
t && !i && v.current?.focus();
|
|
27
|
+
}, [t, i]), P(() => {
|
|
28
|
+
C.current && !t && I.current?.focus(), C.current = t;
|
|
29
29
|
}, [t]);
|
|
30
|
-
const
|
|
30
|
+
const K = (e) => {
|
|
31
|
+
e.key !== "Tab" && o.handleKeyDown(e);
|
|
32
|
+
}, z = (e) => {
|
|
33
|
+
if (e.key !== " ") {
|
|
34
|
+
K(e);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
const p = o.activeIndex === null ? void 0 : o.visible[o.activeIndex];
|
|
39
|
+
p !== void 0 && o.select(p.iso2, !1);
|
|
40
|
+
}, N = (e) => /* @__PURE__ */ n(G, {
|
|
31
41
|
dataTest: r,
|
|
32
|
-
visible:
|
|
42
|
+
visible: o.visible,
|
|
33
43
|
selectedIso2: s,
|
|
34
|
-
activeIndex:
|
|
35
|
-
optionId:
|
|
36
|
-
onSelect:
|
|
44
|
+
activeIndex: o.activeIndex,
|
|
45
|
+
optionId: o.optionId,
|
|
46
|
+
onSelect: o.select,
|
|
37
47
|
listId: l,
|
|
38
|
-
label:
|
|
39
|
-
renderFlag:
|
|
40
|
-
|
|
48
|
+
label: g,
|
|
49
|
+
renderFlag: x,
|
|
50
|
+
onKeyDown: e ? z : void 0,
|
|
51
|
+
onFocus: e && o.activeIndex === null ? () => o.openWithKeyboard(1) : void 0
|
|
52
|
+
}), S = {
|
|
41
53
|
role: "combobox",
|
|
42
|
-
"aria-activedescendant":
|
|
54
|
+
"aria-activedescendant": o.activeIndex === null ? void 0 : o.optionId(o.activeIndex),
|
|
43
55
|
"aria-autocomplete": "list",
|
|
44
56
|
"aria-controls": l,
|
|
45
57
|
"aria-expanded": !0
|
|
46
|
-
},
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
ref:
|
|
58
|
+
}, $ = t && !i;
|
|
59
|
+
return /* @__PURE__ */ h(V, { children: [/* @__PURE__ */ h("div", {
|
|
60
|
+
ref: j,
|
|
49
61
|
"data-testid": `${r}-shell`,
|
|
50
62
|
style: { height: 40 },
|
|
51
63
|
className: f("group relative flex w-32 shrink-0 items-center gap-1.5 rounded px-3 text-base", c ? "cursor-not-allowed text-delta-300" : "text-delta-800"),
|
|
52
64
|
children: [/* @__PURE__ */ n("span", {
|
|
53
65
|
"aria-hidden": "true",
|
|
54
66
|
className: f(U({
|
|
55
|
-
focused:
|
|
67
|
+
focused: R || $,
|
|
56
68
|
disabled: c,
|
|
57
69
|
notched: !1
|
|
58
|
-
}),
|
|
59
|
-
}),
|
|
70
|
+
}), B)
|
|
71
|
+
}), $ ? /* @__PURE__ */ h("span", {
|
|
60
72
|
className: "relative z-[1] flex w-full items-center gap-1.5",
|
|
61
73
|
children: [
|
|
62
|
-
|
|
74
|
+
x?.(s, "eager"),
|
|
63
75
|
/* @__PURE__ */ n("input", {
|
|
64
|
-
ref:
|
|
76
|
+
ref: v,
|
|
65
77
|
role: "combobox",
|
|
66
78
|
"data-testid": `${r}-search`,
|
|
67
79
|
className: "w-12 min-w-0 border-0 bg-transparent p-0 text-base outline-none",
|
|
68
|
-
value:
|
|
69
|
-
placeholder:
|
|
70
|
-
onChange: (
|
|
71
|
-
onKeyDown:
|
|
80
|
+
value: b,
|
|
81
|
+
placeholder: D,
|
|
82
|
+
onChange: (e) => a(e.target.value),
|
|
83
|
+
onKeyDown: o.handleKeyDown,
|
|
72
84
|
"aria-controls": l,
|
|
73
85
|
"aria-expanded": !0,
|
|
74
|
-
"aria-activedescendant":
|
|
86
|
+
"aria-activedescendant": S["aria-activedescendant"],
|
|
75
87
|
"aria-autocomplete": "list",
|
|
76
88
|
"aria-haspopup": "listbox",
|
|
77
89
|
onFocus: () => u(!0),
|
|
@@ -83,76 +95,71 @@ var re = ({ dataTest: r, countries: g, value: s, onChange: A, disabled: c, selec
|
|
|
83
95
|
tabIndex: -1,
|
|
84
96
|
"aria-hidden": "true",
|
|
85
97
|
"aria-expanded": !0,
|
|
86
|
-
onClick:
|
|
98
|
+
onClick: o.dismiss,
|
|
87
99
|
className: "ml-auto flex shrink-0 cursor-pointer border-0 bg-transparent p-0 outline-none focus:shadow-none focus:outline-none focus:ring-0",
|
|
88
|
-
children: /* @__PURE__ */ n(
|
|
100
|
+
children: /* @__PURE__ */ n(F, {
|
|
89
101
|
width: 20,
|
|
90
102
|
height: 20,
|
|
91
103
|
className: "flip-180"
|
|
92
104
|
})
|
|
93
105
|
})
|
|
94
106
|
]
|
|
95
|
-
}) : /* @__PURE__ */
|
|
96
|
-
ref:
|
|
107
|
+
}) : /* @__PURE__ */ h("button", {
|
|
108
|
+
ref: I,
|
|
97
109
|
type: "button",
|
|
98
110
|
"data-testid": r,
|
|
99
111
|
disabled: c,
|
|
100
|
-
"aria-haspopup": "listbox",
|
|
112
|
+
"aria-haspopup": i ? "dialog" : "listbox",
|
|
101
113
|
"aria-expanded": t,
|
|
102
114
|
"aria-controls": t ? l : void 0,
|
|
103
|
-
"aria-labelledby":
|
|
115
|
+
"aria-labelledby": E,
|
|
104
116
|
role: "combobox",
|
|
105
117
|
onClick: () => d(!0),
|
|
106
|
-
onKeyDown: (
|
|
107
|
-
|
|
118
|
+
onKeyDown: (e) => {
|
|
119
|
+
e.key !== "ArrowDown" && e.key !== "ArrowUp" || (e.preventDefault(), o.openWithKeyboard(e.key === "ArrowUp" ? -1 : 1), d(!0));
|
|
108
120
|
},
|
|
109
121
|
onFocus: () => u(!0),
|
|
110
122
|
onBlur: () => u(!1),
|
|
111
123
|
className: f("relative z-[1] flex w-full items-center gap-1.5 border-0 bg-transparent p-0 text-base outline-none focus:shadow-none focus:outline-none focus:ring-0", c ? "cursor-not-allowed text-delta-300" : "cursor-pointer text-delta-800"),
|
|
112
124
|
children: [
|
|
113
|
-
|
|
125
|
+
x?.(s, "eager"),
|
|
114
126
|
/* @__PURE__ */ n("span", {
|
|
115
127
|
className: "w-12 text-left",
|
|
116
|
-
children:
|
|
128
|
+
children: D
|
|
117
129
|
}),
|
|
118
|
-
/* @__PURE__ */ n(
|
|
130
|
+
/* @__PURE__ */ n(F, {
|
|
119
131
|
width: 20,
|
|
120
132
|
height: 20,
|
|
121
133
|
className: f("ml-auto shrink-0 transition-transform", t && "flip-180")
|
|
122
134
|
})
|
|
123
135
|
]
|
|
124
136
|
})]
|
|
125
|
-
}),
|
|
137
|
+
}), i ? /* @__PURE__ */ n(L, {
|
|
126
138
|
open: t,
|
|
127
|
-
onClose:
|
|
139
|
+
onClose: o.dismiss,
|
|
128
140
|
dataTest: `${r}-dialog`,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
onKeyDown: e.handleKeyDown,
|
|
143
|
-
slotProps: { htmlInput: D }
|
|
144
|
-
})
|
|
145
|
-
}), N]
|
|
146
|
-
})
|
|
141
|
+
title: g,
|
|
142
|
+
closeLabel: "Close",
|
|
143
|
+
search: /* @__PURE__ */ n(q, {
|
|
144
|
+
dataTest: `${r}-search`,
|
|
145
|
+
label: A,
|
|
146
|
+
value: b,
|
|
147
|
+
fullWidth: !0,
|
|
148
|
+
onChange: (e) => a(e.target.value),
|
|
149
|
+
onClear: () => a(""),
|
|
150
|
+
onKeyDown: K,
|
|
151
|
+
slotProps: { htmlInput: S }
|
|
152
|
+
}),
|
|
153
|
+
children: N(!0)
|
|
147
154
|
}) : /* @__PURE__ */ n(Q, {
|
|
148
155
|
open: t,
|
|
149
|
-
anchorEl:
|
|
150
|
-
onClose:
|
|
156
|
+
anchorEl: W,
|
|
157
|
+
onClose: o.dismiss,
|
|
151
158
|
tabIntoContent: !1,
|
|
152
159
|
slotProps: { paper: { className: "flex max-h-80 w-80 flex-col overflow-hidden py-2" } },
|
|
153
|
-
children: N
|
|
160
|
+
children: N(!1)
|
|
154
161
|
})] });
|
|
155
162
|
};
|
|
156
163
|
export {
|
|
157
|
-
|
|
164
|
+
ae as CountryCodeSelect
|
|
158
165
|
};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { cn as re } from "../../../helpers/cn.js";
|
|
2
|
+
import { StyledCheckbox as Ne } from "../checkbox/base-ui/StyledCheckbox.js";
|
|
3
|
+
import { StyledButton as K } from "../button/StyledButton.js";
|
|
4
|
+
import { StyledSearchField as De } from "../search-field/StyledSearchField.js";
|
|
5
|
+
import { useAnnouncer as $e } from "../full-screen-picker/PickerLiveRegion.js";
|
|
6
|
+
import { nextActiveIndex as Se } from "./listboxCursor.js";
|
|
7
|
+
import { FullScreenPicker as Ie } from "../full-screen-picker/FullScreenPicker.js";
|
|
8
|
+
import { useEffect as ee, useMemo as _e, useRef as Me, useState as v } from "react";
|
|
9
|
+
import { jsx as o, jsxs as b } from "react/jsx-runtime";
|
|
10
|
+
var F = 50, Re = 500, le = "px-3 py-2 text-sm text-delta-600", te = "[&>div]:px-0";
|
|
11
|
+
function Oe({ open: r, dataTest: t, listboxId: u, title: D, name: g, text: a, options: f, multiple: i, value: h, clearable: j, isEqual: x, isOptionDisabled: B, getLabel: E, getOptionKey: H, filterOptions: $, renderOptionRow: ne, optionRowClassName: W, loading: U, loadingText: oe, noOptionsText: ae, allowSelectAll: se, selectAllLabel: ce, onSelect: ie, onClear: de, onApply: ue, onCancel: fe }) {
|
|
12
|
+
const [s, S] = v(""), [n, p] = v(null), [c, z] = v([]), [me, he] = v(!1), [pe, we] = v(!1), [ke, I, ye] = $e();
|
|
13
|
+
r !== pe && (we(r), r && (S(""), p(null), z(Array.isArray(h) ? [...h] : []), he(!i && j && h !== null && !Array.isArray(h)), ye()));
|
|
14
|
+
const _ = Me([]), O = i ? null : h, Q = (e) => i ? c.some((l) => x(e, l)) : O !== null && x(e, O), m = _e(() => {
|
|
15
|
+
const e = [...f];
|
|
16
|
+
if ($) return $(e, { inputValue: s });
|
|
17
|
+
const l = s.trim().toLowerCase();
|
|
18
|
+
return l ? e.filter((y) => E(y).toLowerCase().includes(l)) : e;
|
|
19
|
+
}, [
|
|
20
|
+
f,
|
|
21
|
+
s,
|
|
22
|
+
$
|
|
23
|
+
]), d = m.slice(0, F), M = !!(se && i), w = M ? [-1, ...d.map((e, l) => l)] : d.map((e, l) => l), k = d.findIndex(Q), { noMatches: Y, matchCount: G } = a;
|
|
24
|
+
ee(() => {
|
|
25
|
+
if (s === "") return;
|
|
26
|
+
const e = window.setTimeout(() => I(m.length === 0 ? Y : G(m.length)), Re);
|
|
27
|
+
return () => window.clearTimeout(e);
|
|
28
|
+
}, [
|
|
29
|
+
I,
|
|
30
|
+
m.length,
|
|
31
|
+
s,
|
|
32
|
+
Y,
|
|
33
|
+
G
|
|
34
|
+
]), ee(() => {
|
|
35
|
+
r && k >= 0 && _.current[k]?.scrollIntoView({ block: "nearest" });
|
|
36
|
+
}, [r]);
|
|
37
|
+
const R = (e) => {
|
|
38
|
+
p(e), e !== null && e >= 0 && _.current[e]?.scrollIntoView({ block: "nearest" });
|
|
39
|
+
}, L = (e, l = a.selectedCount(e.length)) => {
|
|
40
|
+
z(e), I(l);
|
|
41
|
+
}, Ce = (e) => {
|
|
42
|
+
L(c.some((l) => x(e, l)) ? c.filter((l) => !x(e, l)) : [...c, e]);
|
|
43
|
+
}, A = f.length > 0 && c.length === f.length, J = () => L(A ? [] : [...f]), X = (e, l, y = !0) => {
|
|
44
|
+
B(l) || (i ? Ce(l) : ie(e, l, y));
|
|
45
|
+
}, P = (e, l) => {
|
|
46
|
+
n === -1 ? J() : n !== null && d[n] !== void 0 && X(e, d[n], l);
|
|
47
|
+
}, Z = (e) => {
|
|
48
|
+
e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), R(Se(w, n, k, e.key === "ArrowDown" ? 1 : -1))) : e.key === "Home" || e.key === "End" ? (e.preventDefault(), R(w[e.key === "Home" ? 0 : w.length - 1] ?? null)) : e.key === "Enter" ? (e.preventDefault(), P(e, !0)) : e.key === " " && s === "" && n !== null && (e.preventDefault(), P(e, !1));
|
|
49
|
+
}, ve = (e) => {
|
|
50
|
+
if (e.key !== " ") {
|
|
51
|
+
Z(e);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
e.preventDefault(), P(e, !1);
|
|
55
|
+
}, be = () => {
|
|
56
|
+
n === null && R(k >= 0 ? k : w[0] ?? null);
|
|
57
|
+
}, q = (e) => `${t}-option-${e}`;
|
|
58
|
+
let N;
|
|
59
|
+
n === -1 && M ? N = `${t}-select-all` : n !== null && d[n] !== void 0 && (N = q(n));
|
|
60
|
+
const ge = (e, l) => {
|
|
61
|
+
const y = B(e), T = Q(e);
|
|
62
|
+
return ne({
|
|
63
|
+
key: H ? String(H(e)) : `${E(e)}-${l}`,
|
|
64
|
+
ref: (C) => {
|
|
65
|
+
_.current[l] = C;
|
|
66
|
+
},
|
|
67
|
+
role: "option",
|
|
68
|
+
id: q(l),
|
|
69
|
+
"aria-selected": T,
|
|
70
|
+
"aria-disabled": y || void 0,
|
|
71
|
+
"data-active": n === l ? "" : void 0,
|
|
72
|
+
className: W,
|
|
73
|
+
onMouseDown: (C) => C.preventDefault(),
|
|
74
|
+
onClick: (C) => X(C, e),
|
|
75
|
+
onMouseMove: () => p(null)
|
|
76
|
+
}, e, {
|
|
77
|
+
selected: T,
|
|
78
|
+
index: l,
|
|
79
|
+
inputValue: s,
|
|
80
|
+
inPicker: !0
|
|
81
|
+
});
|
|
82
|
+
}, xe = r ? U ? /* @__PURE__ */ o("li", {
|
|
83
|
+
role: "presentation",
|
|
84
|
+
className: le,
|
|
85
|
+
children: oe
|
|
86
|
+
}) : d.length === 0 ? /* @__PURE__ */ o("li", {
|
|
87
|
+
role: "presentation",
|
|
88
|
+
className: le,
|
|
89
|
+
"data-testid": `${t}-picker-empty`,
|
|
90
|
+
children: s === "" ? ae : a.noMatches
|
|
91
|
+
}) : d.map(ge) : null, Ae = /* @__PURE__ */ o(De, {
|
|
92
|
+
dataTest: `${t}-picker-search`,
|
|
93
|
+
label: a.search,
|
|
94
|
+
value: s,
|
|
95
|
+
fullWidth: !0,
|
|
96
|
+
onChange: (e) => {
|
|
97
|
+
S(e.target.value), p(null);
|
|
98
|
+
},
|
|
99
|
+
onClear: () => {
|
|
100
|
+
S(""), p(null);
|
|
101
|
+
},
|
|
102
|
+
onKeyDown: Z,
|
|
103
|
+
autoComplete: "off",
|
|
104
|
+
slotProps: { htmlInput: {
|
|
105
|
+
role: "combobox",
|
|
106
|
+
"aria-controls": u,
|
|
107
|
+
"aria-expanded": !0,
|
|
108
|
+
"aria-activedescendant": N,
|
|
109
|
+
"aria-autocomplete": "list"
|
|
110
|
+
} }
|
|
111
|
+
});
|
|
112
|
+
let V;
|
|
113
|
+
return i ? V = /* @__PURE__ */ o(Le, {
|
|
114
|
+
dataTest: t,
|
|
115
|
+
count: a.selectedCount(c.length),
|
|
116
|
+
clearAllLabel: j ? a.clearAll : void 0,
|
|
117
|
+
clearAllShown: c.length > 0,
|
|
118
|
+
doneLabel: a.done,
|
|
119
|
+
onClearAll: () => L([], a.clearedAll),
|
|
120
|
+
onDone: (e) => ue(e, c)
|
|
121
|
+
}) : me && (V = /* @__PURE__ */ o(Pe, {
|
|
122
|
+
dataTest: t,
|
|
123
|
+
label: a.clearOne,
|
|
124
|
+
onClear: de
|
|
125
|
+
})), /* @__PURE__ */ b(Ie, {
|
|
126
|
+
open: r,
|
|
127
|
+
onClose: fe,
|
|
128
|
+
dataTest: `${t}-picker`,
|
|
129
|
+
title: D,
|
|
130
|
+
fallbackName: g,
|
|
131
|
+
closeLabel: a.close,
|
|
132
|
+
search: Ae,
|
|
133
|
+
headerRow: V,
|
|
134
|
+
announcement: ke,
|
|
135
|
+
children: [/* @__PURE__ */ b("ul", {
|
|
136
|
+
id: u,
|
|
137
|
+
role: "listbox",
|
|
138
|
+
"aria-label": g,
|
|
139
|
+
"aria-multiselectable": i || void 0,
|
|
140
|
+
tabIndex: 0,
|
|
141
|
+
"aria-activedescendant": N,
|
|
142
|
+
onKeyDown: ve,
|
|
143
|
+
onFocus: be,
|
|
144
|
+
className: re("m-0 list-none p-0 [&>li:not(:last-child)]:shadow-[inset_0_-1px_0_var(--colors-delta-200)]", w.length > 0 && "outline-none", "[&>li[role=option]]:pr-4 [&>li[role=option]]:text-delta-700", i ? "[&>li[aria-selected=true]:not(:hover)]:bg-white" : "[&>li[aria-selected=true]:not([aria-disabled=true])]:bg-gama-25 [&>li[role=option]]:gap-x-1 [&>li[role=option]]:pl-2"),
|
|
145
|
+
children: [M && /* @__PURE__ */ b("li", {
|
|
146
|
+
id: `${t}-select-all`,
|
|
147
|
+
role: "option",
|
|
148
|
+
"aria-selected": A,
|
|
149
|
+
"data-active": n === -1 ? "" : void 0,
|
|
150
|
+
tabIndex: -1,
|
|
151
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
152
|
+
onClick: J,
|
|
153
|
+
className: W,
|
|
154
|
+
children: [
|
|
155
|
+
n === -1 && /* @__PURE__ */ o("span", {
|
|
156
|
+
"aria-hidden": "true",
|
|
157
|
+
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ o(Ne, {
|
|
160
|
+
dataTest: `${t}-picker-select-all`,
|
|
161
|
+
checked: A,
|
|
162
|
+
indeterminate: c.length > 0 && !A,
|
|
163
|
+
size: "medium",
|
|
164
|
+
checkboxClassName: "!h-4 !w-4",
|
|
165
|
+
hideWrapper: !0,
|
|
166
|
+
decorative: !0
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ o("span", {
|
|
169
|
+
className: "min-w-0 flex-1 break-words",
|
|
170
|
+
children: ce
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
}), xe]
|
|
174
|
+
}), !U && m.length > F && /* @__PURE__ */ o("p", {
|
|
175
|
+
className: "m-0 px-3 py-2 text-sm text-delta-600",
|
|
176
|
+
"data-testid": `${t}-picker-truncated`,
|
|
177
|
+
children: a.truncated(F, m.length)
|
|
178
|
+
})]
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
var Le = ({ dataTest: r, count: t, clearAllLabel: u, clearAllShown: D, doneLabel: g, onClearAll: a, onDone: f }) => /* @__PURE__ */ b("div", {
|
|
182
|
+
className: "flex items-center justify-between gap-6 px-4 py-2",
|
|
183
|
+
"data-testid": `${r}-picker-selection-row`,
|
|
184
|
+
children: [/* @__PURE__ */ b("div", {
|
|
185
|
+
className: "flex min-w-0 flex-wrap items-center gap-x-1",
|
|
186
|
+
children: [/* @__PURE__ */ o("span", {
|
|
187
|
+
className: "text-base text-delta-600",
|
|
188
|
+
"data-testid": `${r}-picker-count`,
|
|
189
|
+
children: t
|
|
190
|
+
}), u !== void 0 && /* @__PURE__ */ o(K, {
|
|
191
|
+
dataTest: `${r}-picker-clear-all`,
|
|
192
|
+
variant: "text",
|
|
193
|
+
className: re(te, !D && "invisible"),
|
|
194
|
+
onClick: a,
|
|
195
|
+
children: u
|
|
196
|
+
})]
|
|
197
|
+
}), /* @__PURE__ */ o(K, {
|
|
198
|
+
dataTest: `${r}-picker-done`,
|
|
199
|
+
variant: "contained",
|
|
200
|
+
className: "shrink-0 whitespace-nowrap",
|
|
201
|
+
onClick: f,
|
|
202
|
+
children: g
|
|
203
|
+
})]
|
|
204
|
+
}), Pe = ({ dataTest: r, label: t, onClear: u }) => /* @__PURE__ */ o("div", {
|
|
205
|
+
className: "flex px-4 py-2",
|
|
206
|
+
"data-testid": `${r}-picker-clear-row`,
|
|
207
|
+
children: /* @__PURE__ */ o(K, {
|
|
208
|
+
dataTest: `${r}-picker-clear`,
|
|
209
|
+
variant: "text",
|
|
210
|
+
className: te,
|
|
211
|
+
onClick: u,
|
|
212
|
+
children: t
|
|
213
|
+
})
|
|
214
|
+
});
|
|
215
|
+
export {
|
|
216
|
+
Oe as SelectAutocompletePicker
|
|
217
|
+
};
|