asma-ui-core 3.115.0 → 3.116.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/data-display/chip/StyledChip.js +1 -0
- package/dist/components/inputs/full-screen-picker/FullScreenPicker.js +15 -15
- package/dist/components/inputs/full-screen-picker/pickerCopy.js +4 -6
- package/dist/components/inputs/phone-field/CountryCodeOptions.js +31 -24
- package/dist/components/inputs/phone-field/CountryCodeSelect.js +2 -1
- package/dist/components/inputs/select-autocomplete/SelectAutocompletePicker.js +125 -123
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +177 -172
- package/dist/hooks/useMediaQuery.hook.js +8 -7
- package/dist/src/components/inputs/full-screen-picker/FullScreenPicker.d.ts +2 -1
- package/dist/src/components/inputs/full-screen-picker/pickerCopy.d.ts +0 -1
- package/dist/src/components/inputs/phone-field/CountryCodeOptions.d.ts +3 -1
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +1 -0
- package/dist/src/hooks/useMediaQuery.hook.d.ts +8 -0
- package/dist/tailwind.config.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,146 +1,146 @@
|
|
|
1
1
|
import { cn as D } from "../../../helpers/cn.js";
|
|
2
|
-
import { TOP_LAYER_PROPS as
|
|
3
|
-
import { ChevronDownIcon as
|
|
4
|
-
import { CloseIcon as
|
|
5
|
-
import { CheckIcon as
|
|
6
|
-
import { PlusIconCircle as
|
|
2
|
+
import { TOP_LAYER_PROPS as kt, TOP_LAYER_RESET_STYLE as yt, getOpenModalDialogAncestor as vt, shouldUsePopoverTopLayer as wt, useTopLayerRef as Dt } from "../../../hooks/useTopLayer.hook.js";
|
|
3
|
+
import { ChevronDownIcon as It } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
4
|
+
import { CloseIcon as Nt } from "../../icons/close-icon/CloseIcon.js";
|
|
5
|
+
import { CheckIcon as Pt } from "../../icons/check-icon/CheckIcon.js";
|
|
6
|
+
import { PlusIconCircle as Ct } from "../../icons/plus-icon-circle/PlusIconCircle.js";
|
|
7
7
|
import { StyledChip as At } from "../../data-display/chip/StyledChip.js";
|
|
8
8
|
import { StyledCheckbox as ve } from "../checkbox/base-ui/StyledCheckbox.js";
|
|
9
|
-
import { useFullScreenPickerMediaQuery as
|
|
10
|
-
import { useBackCloses as
|
|
11
|
-
import { fieldWidthStyle as
|
|
12
|
-
import { LoadingIcon as
|
|
13
|
-
import { PickerLiveRegion as
|
|
14
|
-
import { getPickerText as
|
|
15
|
-
import { readFieldName as
|
|
16
|
-
import { getDraftChanges as
|
|
17
|
-
import { nextActiveIndex as
|
|
18
|
-
import { SelectAutocompletePicker as
|
|
9
|
+
import { useFullScreenPickerMediaQuery as St } from "../../../hooks/useMediaQuery.hook.js";
|
|
10
|
+
import { useBackCloses as Rt } from "../../../hooks/useBackCloses.hook.js";
|
|
11
|
+
import { fieldWidthStyle as Mt } from "../field-styles.js";
|
|
12
|
+
import { LoadingIcon as $t } from "../../../table/shared-components/LoadingIcon.js";
|
|
13
|
+
import { PickerLiveRegion as Ft, useAnnouncer as _t } from "../full-screen-picker/PickerLiveRegion.js";
|
|
14
|
+
import { getPickerText as Lt } from "../full-screen-picker/pickerCopy.js";
|
|
15
|
+
import { readFieldName as Et } from "./readFieldName.js";
|
|
16
|
+
import { getDraftChanges as Wt } from "./draftChanges.js";
|
|
17
|
+
import { nextActiveIndex as jt } from "./listboxCursor.js";
|
|
18
|
+
import { SelectAutocompletePicker as zt } from "./SelectAutocompletePicker.js";
|
|
19
19
|
import J from "./StyledSelectAutocomplete.module.js";
|
|
20
20
|
import { useEffect as we, useMemo as X, useRef as De, useState as I } from "react";
|
|
21
|
-
import { Fragment as
|
|
22
|
-
import { FloatingPortal as Ht, autoUpdate as
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
const
|
|
21
|
+
import { Fragment as Bt, jsx as o, jsxs as N } from "react/jsx-runtime";
|
|
22
|
+
import { FloatingPortal as Ht, autoUpdate as Ut, flip as Vt, offset as Ot, shift as Yt, size as qt, useDismiss as Tt, useFloating as Qt, useInteractions as Gt, useMergeRefs as Ie, useRole as Jt } from "@floating-ui/react";
|
|
23
|
+
var Xt = (r) => typeof r == "object" && r !== null && "label" in r ? String(r.label) : String(r), Zt = (r) => typeof r == "object" && r !== null && "disabled" in r && !!r.disabled;
|
|
24
|
+
function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, getOptionLabel: Pe, getOptionKey: C, isOptionEqualToValue: Z, renderOption: z, renderValue: K, filterOptions: _, loading: B, loadingText: ee = "Loading…", noOptionsText: te = "No options", disabled: A, readOnly: p, error: Ce, helperText: Ae, size: Se = "small", rowSize: Re = "compact", disableClearable: re, disableCloseOnSelect: Me, popupIcon: $e, autoHeight: Fe, multiple: _e, allowSelectAll: S, selectAllLabel: le = "Select all", width: oe = "full", fullWidth: Kt, classes: Le, inputValue: L, onInputChange: Ee, open: ne, onOpen: We, onClose: je, className: ze, wrapperClassName: Be, getOptionDisabled: He, slotProps: se, pickerTitle: H, pickerText: Ue, locale: Ve = "en", disableFullScreenPicker: Oe }) {
|
|
25
|
+
const l = _e === !0, y = St() && !Oe, [ae, Ye] = I({
|
|
26
26
|
label: "",
|
|
27
27
|
name: ""
|
|
28
|
-
}), [qe,
|
|
29
|
-
e && (
|
|
30
|
-
}, [Je, ie] = I(""), g = L ?? Je,
|
|
28
|
+
}), [qe, Te] = _t(), U = Lt(Ve, Ue), d = Pe ?? Xt, v = (e, t) => Z ? Z(e, t) : e === t, [Qe, Ge] = I(!1), n = ne ?? Qe, i = (e) => {
|
|
29
|
+
e && (p || A) || (ne === void 0 && Ge(e), e && Ye(Et(E.current)), e ? We?.() : (k(null), je?.()));
|
|
30
|
+
}, [Je, ie] = I(""), g = L ?? Je, R = (e, t, a) => {
|
|
31
31
|
L === void 0 && ie(t), Ee?.(e, t, a);
|
|
32
|
-
}, [
|
|
32
|
+
}, [s, k] = I(null), V = `${r}-listbox`, ce = De([]), E = De(null), [Xe, Ze] = I(null), [de, Ke] = I(null), c = l ? Array.isArray(F) ? F : [] : [], x = l ? null : F ?? null, ue = !l && x !== null ? d(x) : "";
|
|
33
33
|
we(() => {
|
|
34
|
-
L !== void 0 ||
|
|
34
|
+
L !== void 0 || l || ie(ue);
|
|
35
35
|
}, [
|
|
36
36
|
L,
|
|
37
|
-
|
|
37
|
+
l,
|
|
38
38
|
ue
|
|
39
39
|
]);
|
|
40
|
-
const O = (e) =>
|
|
41
|
-
const e = [...
|
|
40
|
+
const O = (e) => l ? c.some((t) => v(e, t)) : x !== null && v(e, x), M = (e) => He?.(e) ?? Zt(e), fe = X(() => {
|
|
41
|
+
const e = [...b];
|
|
42
42
|
if (_) return _(e, { inputValue: g });
|
|
43
|
-
const t = !
|
|
43
|
+
const t = !l && x !== null ? d(x).toLowerCase() : null;
|
|
44
44
|
if (!g || g.toLowerCase() === t) return e;
|
|
45
45
|
const a = g.toLowerCase();
|
|
46
46
|
return e.filter((u) => d(u).toLowerCase().includes(a));
|
|
47
47
|
}, [
|
|
48
|
-
|
|
48
|
+
b,
|
|
49
49
|
g,
|
|
50
50
|
_,
|
|
51
|
-
|
|
52
|
-
]),
|
|
51
|
+
F
|
|
52
|
+
]), f = X(() => fe.slice(0, 100), [fe]), pe = f.flatMap((e, t) => M(e) ? [] : [t]), Y = S && l ? [-1, ...pe] : pe, me = f.map((e, t) => t), W = S && l ? [-1, ...me] : me, $ = f.findIndex(O);
|
|
53
53
|
we(() => {
|
|
54
|
-
if (!
|
|
55
|
-
const e =
|
|
54
|
+
if (!n) return;
|
|
55
|
+
const e = s ?? $;
|
|
56
56
|
if (e < 0) return;
|
|
57
57
|
const t = requestAnimationFrame(() => ce.current[e]?.scrollIntoView({ block: "nearest" }));
|
|
58
58
|
return () => cancelAnimationFrame(t);
|
|
59
59
|
}, [
|
|
60
|
-
n,
|
|
61
60
|
s,
|
|
61
|
+
n,
|
|
62
62
|
de,
|
|
63
|
-
|
|
63
|
+
$
|
|
64
64
|
]);
|
|
65
|
-
const { refs:
|
|
66
|
-
open:
|
|
65
|
+
const { refs: j, floatingStyles: et, context: he } = Qt({
|
|
66
|
+
open: n,
|
|
67
67
|
onOpenChange: i,
|
|
68
68
|
placement: "bottom-start",
|
|
69
69
|
strategy: "fixed",
|
|
70
|
-
whileElementsMounted:
|
|
70
|
+
whileElementsMounted: Ut,
|
|
71
71
|
middleware: [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Ze(e.reference.width), Ke(
|
|
72
|
+
Ot(0),
|
|
73
|
+
Vt({ padding: 8 }),
|
|
74
|
+
Yt({ padding: 8 }),
|
|
75
|
+
qt({ apply({ rects: e, availableHeight: t }) {
|
|
76
|
+
Ze(e.reference.width), Ke(Fe ? t - 8 : Math.min(t - 8, 320));
|
|
77
77
|
} })
|
|
78
78
|
]
|
|
79
|
-
}), { getReferenceProps: tt, getFloatingProps:
|
|
80
|
-
|
|
81
|
-
active:
|
|
79
|
+
}), { getReferenceProps: tt, getFloatingProps: rt, getItemProps: lt } = Gt([Tt(he, { enabled: !y }), Jt(he, { role: "listbox" })]);
|
|
80
|
+
Rt({
|
|
81
|
+
active: n && !y,
|
|
82
82
|
requestClose: () => i(!1)
|
|
83
83
|
});
|
|
84
|
-
const ot = Ie([
|
|
85
|
-
|
|
86
|
-
}, w = (e, t, a = !
|
|
87
|
-
if (
|
|
88
|
-
const u = c.some((
|
|
89
|
-
P?.(e,
|
|
84
|
+
const ot = Ie([j.setReference]), be = X(() => n ? vt(j.reference.current) : void 0, [n, j]), q = wt(be), nt = Ie([Dt(j.setFloating, q)]), st = (e) => Y.includes($) ? $ : Y[e === 1 ? 0 : Y.length - 1] ?? null, at = (e) => {
|
|
85
|
+
W.length !== 0 && k((t) => jt(W, t, $, e));
|
|
86
|
+
}, w = (e, t, a = !l || !Me) => {
|
|
87
|
+
if (l) {
|
|
88
|
+
const u = c.some((h) => v(t, h)), m = u ? c.filter((h) => !v(t, h)) : [...c, t];
|
|
89
|
+
P?.(e, m, u ? "removeOption" : "selectOption", { option: t }), R(e, "", "reset"), a && i(!1);
|
|
90
90
|
} else
|
|
91
|
-
P?.(e, t, "selectOption", { option: t }),
|
|
92
|
-
},
|
|
93
|
-
P?.(e,
|
|
91
|
+
P?.(e, t, "selectOption", { option: t }), R(e, d(t), "reset"), a && i(!1);
|
|
92
|
+
}, T = (e) => {
|
|
93
|
+
P?.(e, l ? [] : null, "clear", void 0), R(e, "", "clear");
|
|
94
94
|
}, it = (e) => {
|
|
95
|
-
|
|
95
|
+
T(e), i(!1), Te(U.cleared);
|
|
96
96
|
}, ct = (e, t) => {
|
|
97
|
-
for (const { value: a, reason: u, option:
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
const t =
|
|
101
|
-
P?.(e, t ? [] :
|
|
97
|
+
for (const { value: a, reason: u, option: m } of Wt(c, t, v)) P?.(e, a, u, m === void 0 ? void 0 : { option: m });
|
|
98
|
+
R(e, "", "reset"), i(!1);
|
|
99
|
+
}, Q = (e) => {
|
|
100
|
+
const t = b.length > 0 && c.length === b.length;
|
|
101
|
+
P?.(e, t ? [] : b, t ? "clear" : "selectOption", void 0);
|
|
102
102
|
}, dt = (e) => {
|
|
103
103
|
if (e.key === "Backspace" && g === "" && ge) {
|
|
104
104
|
const t = c[c.length - 1];
|
|
105
|
-
|
|
106
|
-
} else if (e.key === "Enter" && !
|
|
105
|
+
l ? t !== void 0 && w(e, t, !1) : T(e);
|
|
106
|
+
} else if (e.key === "Enter" && !n)
|
|
107
107
|
e.preventDefault(), i(!0);
|
|
108
|
-
else if (e.key === "Enter" &&
|
|
109
|
-
e.preventDefault(),
|
|
110
|
-
else if (e.key === "Enter" &&
|
|
108
|
+
else if (e.key === "Enter" && s === -1)
|
|
109
|
+
e.preventDefault(), Q(e);
|
|
110
|
+
else if (e.key === "Enter" && s != null && f[s] != null) {
|
|
111
111
|
e.preventDefault();
|
|
112
|
-
const t =
|
|
113
|
-
|
|
112
|
+
const t = f[s];
|
|
113
|
+
M(t) || w(e, t, !0);
|
|
114
114
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
115
|
-
if (e.preventDefault(), !
|
|
116
|
-
|
|
115
|
+
if (e.preventDefault(), !n) {
|
|
116
|
+
k(st(e.key === "ArrowDown" ? 1 : -1)), i(!0);
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
at(e.key === "ArrowDown" ? 1 : -1);
|
|
120
120
|
} else if (e.key === "Home" || e.key === "End")
|
|
121
|
-
e.preventDefault(),
|
|
122
|
-
else if (e.key === " " &&
|
|
123
|
-
e.preventDefault(),
|
|
124
|
-
else if (e.key === " " &&
|
|
121
|
+
e.preventDefault(), k(W[e.key === "Home" ? 0 : W.length - 1] ?? null);
|
|
122
|
+
else if (e.key === " " && s === -1)
|
|
123
|
+
e.preventDefault(), Q(e);
|
|
124
|
+
else if (e.key === " " && s != null && f[s] != null) {
|
|
125
125
|
e.preventDefault();
|
|
126
|
-
const t =
|
|
127
|
-
|
|
128
|
-
} else e.key === "Escape" &&
|
|
129
|
-
}, ge = !
|
|
126
|
+
const t = f[s];
|
|
127
|
+
M(t) || w(e, t, !1);
|
|
128
|
+
} else e.key === "Escape" && n ? (e.preventDefault(), e.stopPropagation(), i(!1)) : e.key === "Tab" && i(!1);
|
|
129
|
+
}, ge = !re && !p && !A && (l ? c.length > 0 : x !== null);
|
|
130
130
|
let xe;
|
|
131
|
-
|
|
131
|
+
n && s != null && (s === -1 || f[s] !== void 0) && (xe = s === -1 ? `${r}-select-all` : `${r}-option-${s}`);
|
|
132
132
|
const ut = (e) => {
|
|
133
|
-
e.preventDefault(), !(
|
|
134
|
-
},
|
|
133
|
+
e.preventDefault(), !(A || p) && (E.current?.focus(), i(!n));
|
|
134
|
+
}, ft = l ? K ? K(c, ({ index: e }) => ({ "data-index": e })) : c.map((e, t) => /* @__PURE__ */ o(At, {
|
|
135
135
|
dataTest: `selected-chip-${d(e)}`,
|
|
136
136
|
label: d(e),
|
|
137
|
-
readOnly:
|
|
137
|
+
readOnly: p,
|
|
138
138
|
deleteButtonTabIndex: -1,
|
|
139
|
-
onDelete:
|
|
140
|
-
},
|
|
139
|
+
onDelete: p ? void 0 : (a) => w(a, e)
|
|
140
|
+
}, C ? C(e) : `${d(e)}-${t}`)) : void 0, pt = /* @__PURE__ */ N("span", {
|
|
141
141
|
className: "flex items-center gap-1",
|
|
142
142
|
children: [
|
|
143
|
-
|
|
143
|
+
B && /* @__PURE__ */ o($t, {
|
|
144
144
|
width: 20,
|
|
145
145
|
height: 20,
|
|
146
146
|
className: "animate-spin"
|
|
@@ -149,81 +149,86 @@ function vl({ dataTest: l, options: h, renderInput: Ne, value: $, onChange: P, g
|
|
|
149
149
|
type: "button",
|
|
150
150
|
tabIndex: -1,
|
|
151
151
|
"aria-label": "Clear",
|
|
152
|
-
"data-testid": `${
|
|
152
|
+
"data-testid": `${r}-clear`,
|
|
153
153
|
className: "invisible flex min-h-6 min-w-6 cursor-pointer items-center justify-center rounded-full border-0 bg-delta-50 group-focus-within:visible",
|
|
154
154
|
onMouseDown: (e) => e.preventDefault(),
|
|
155
|
-
onClick:
|
|
156
|
-
children: /* @__PURE__ */ o(
|
|
155
|
+
onClick: T,
|
|
156
|
+
children: /* @__PURE__ */ o(Nt, {
|
|
157
157
|
width: 20,
|
|
158
158
|
height: 20,
|
|
159
159
|
className: "text-delta-700"
|
|
160
160
|
})
|
|
161
161
|
}),
|
|
162
|
-
|
|
162
|
+
p ? null : /* @__PURE__ */ o("button", {
|
|
163
163
|
type: "button",
|
|
164
164
|
tabIndex: -1,
|
|
165
165
|
"aria-label": "Toggle options",
|
|
166
|
-
"aria-expanded":
|
|
167
|
-
"data-testid": `${
|
|
166
|
+
"aria-expanded": n,
|
|
167
|
+
"data-testid": `${r}-popup-indicator`,
|
|
168
168
|
className: "flex cursor-pointer items-center border-0 bg-transparent",
|
|
169
169
|
onMouseDown: (e) => e.preventDefault(),
|
|
170
170
|
onClick: ut,
|
|
171
|
-
children: $e ?? (
|
|
171
|
+
children: $e ?? (l ? /* @__PURE__ */ o(Ct, {
|
|
172
172
|
width: 24,
|
|
173
173
|
height: 24,
|
|
174
174
|
className: "text-delta-700"
|
|
175
|
-
}) : /* @__PURE__ */ o(
|
|
175
|
+
}) : /* @__PURE__ */ o(It, {
|
|
176
176
|
width: 24,
|
|
177
177
|
height: 24,
|
|
178
|
-
className: D(J["select-custom-icon"],
|
|
178
|
+
className: D(J["select-custom-icon"], n && J["select-custom-icon-open"], "text-delta-700")
|
|
179
179
|
}))
|
|
180
180
|
})
|
|
181
181
|
]
|
|
182
|
-
}), mt = {
|
|
183
|
-
|
|
182
|
+
}), mt = (e) => {
|
|
183
|
+
if (A || p || !(e.target instanceof Element)) return;
|
|
184
|
+
const t = e.target.closest('button, a, [role="button"], [data-chip]');
|
|
185
|
+
t && e.currentTarget.contains(t) || (E.current?.focus(), i(!0));
|
|
186
|
+
}, ht = {
|
|
187
|
+
disabled: A,
|
|
184
188
|
size: Se,
|
|
185
189
|
fullWidth: !0,
|
|
186
|
-
error:
|
|
187
|
-
helperText:
|
|
190
|
+
error: Ce,
|
|
191
|
+
helperText: Ae,
|
|
188
192
|
value: g,
|
|
189
193
|
onChange: (e) => {
|
|
190
|
-
|
|
194
|
+
y || (k(null), R(e, e.target.value, "input"), n || i(!0));
|
|
191
195
|
},
|
|
192
196
|
onKeyDown: dt,
|
|
193
197
|
slotProps: {
|
|
194
198
|
htmlInput: {
|
|
195
199
|
...tt(),
|
|
196
|
-
ref:
|
|
200
|
+
ref: E,
|
|
197
201
|
onClick: () => i(!0),
|
|
198
202
|
role: "combobox",
|
|
199
203
|
"aria-autocomplete": "list",
|
|
200
|
-
"aria-expanded":
|
|
201
|
-
"aria-controls":
|
|
204
|
+
"aria-expanded": n,
|
|
205
|
+
"aria-controls": n ? V : void 0,
|
|
202
206
|
"aria-activedescendant": xe,
|
|
203
207
|
autoComplete: "off",
|
|
204
|
-
readOnly:
|
|
205
|
-
...
|
|
208
|
+
readOnly: p,
|
|
209
|
+
...y ? {
|
|
206
210
|
inputMode: "none",
|
|
207
211
|
"aria-haspopup": "dialog"
|
|
208
212
|
} : {}
|
|
209
213
|
},
|
|
210
214
|
input: {
|
|
211
215
|
ref: ot,
|
|
212
|
-
startAdornment:
|
|
213
|
-
endAdornment:
|
|
216
|
+
startAdornment: ft,
|
|
217
|
+
endAdornment: pt,
|
|
218
|
+
onClick: mt
|
|
214
219
|
}
|
|
215
220
|
}
|
|
216
|
-
},
|
|
217
|
-
const { key: u, ...
|
|
221
|
+
}, ke = D("asma-pressable", "relative box-border flex cursor-pointer items-center gap-x-3 px-3 py-2 text-base text-delta-800", Re === "regular" ? "min-h-12" : "min-h-10", "aria-selected:bg-gama-50 hover:bg-delta-50", "aria-disabled:cursor-default aria-disabled:!bg-transparent aria-disabled:text-delta-300"), ye = (e, t, a) => {
|
|
222
|
+
const { key: u, ...m } = e;
|
|
218
223
|
return /* @__PURE__ */ N("li", {
|
|
219
|
-
...
|
|
224
|
+
...m,
|
|
220
225
|
children: [
|
|
221
226
|
e["data-active"] !== void 0 && /* @__PURE__ */ o("span", {
|
|
222
227
|
"aria-hidden": "true",
|
|
223
228
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
224
229
|
}),
|
|
225
|
-
|
|
226
|
-
dataTest: `${
|
|
230
|
+
l ? /* @__PURE__ */ o(ve, {
|
|
231
|
+
dataTest: `${r}-${d(t)}-checkbox`,
|
|
227
232
|
checked: a.selected,
|
|
228
233
|
size: "medium",
|
|
229
234
|
checkboxClassName: "!h-4 !w-4",
|
|
@@ -231,7 +236,7 @@ function vl({ dataTest: l, options: h, renderInput: Ne, value: $, onChange: P, g
|
|
|
231
236
|
decorative: !0
|
|
232
237
|
}) : /* @__PURE__ */ o("span", {
|
|
233
238
|
className: D("w-5", a.inPicker && "flex"),
|
|
234
|
-
children: a.selected && /* @__PURE__ */ o(
|
|
239
|
+
children: a.selected && /* @__PURE__ */ o(Pt, {
|
|
235
240
|
width: 20,
|
|
236
241
|
height: 20,
|
|
237
242
|
className: "text-gama-500"
|
|
@@ -243,106 +248,106 @@ function vl({ dataTest: l, options: h, renderInput: Ne, value: $, onChange: P, g
|
|
|
243
248
|
})
|
|
244
249
|
]
|
|
245
250
|
}, u);
|
|
246
|
-
},
|
|
247
|
-
const a =
|
|
248
|
-
...
|
|
249
|
-
onMouseDown: (
|
|
250
|
-
onClick: (
|
|
251
|
-
a || w(
|
|
251
|
+
}, bt = (e, t) => {
|
|
252
|
+
const a = M(e), u = {
|
|
253
|
+
...lt({
|
|
254
|
+
onMouseDown: (h) => h.preventDefault(),
|
|
255
|
+
onClick: (h) => {
|
|
256
|
+
a || w(h, e);
|
|
252
257
|
},
|
|
253
|
-
onMouseMove: () =>
|
|
258
|
+
onMouseMove: () => k(null)
|
|
254
259
|
}),
|
|
255
|
-
key:
|
|
256
|
-
ref: (
|
|
257
|
-
ce.current[t] =
|
|
260
|
+
key: C ? String(C(e)) : `${d(e)}-${t}`,
|
|
261
|
+
ref: (h) => {
|
|
262
|
+
ce.current[t] = h;
|
|
258
263
|
},
|
|
259
264
|
role: "option",
|
|
260
|
-
id: `${
|
|
265
|
+
id: `${r}-option-${t}`,
|
|
261
266
|
"aria-selected": O(e),
|
|
262
267
|
"aria-disabled": a || void 0,
|
|
263
|
-
"data-active":
|
|
264
|
-
className:
|
|
265
|
-
},
|
|
268
|
+
"data-active": s === t ? "" : void 0,
|
|
269
|
+
className: ke
|
|
270
|
+
}, m = {
|
|
266
271
|
selected: O(e),
|
|
267
272
|
index: t,
|
|
268
273
|
inputValue: g
|
|
269
274
|
};
|
|
270
|
-
return
|
|
271
|
-
},
|
|
275
|
+
return z ? z(u, e, m) : ye(u, e, m);
|
|
276
|
+
}, gt = !!(S && l), G = b.length > 0 && c.length === b.length, xt = c.length > 0 && !G;
|
|
272
277
|
return /* @__PURE__ */ N("div", {
|
|
273
|
-
className: D(J.styledSelectAutocompleteWrapper,
|
|
278
|
+
className: D(J.styledSelectAutocompleteWrapper, Be, ze),
|
|
274
279
|
"data-field-width": oe,
|
|
275
|
-
style:
|
|
280
|
+
style: Mt(oe),
|
|
276
281
|
children: [
|
|
277
|
-
Ne(
|
|
278
|
-
|
|
282
|
+
Ne(ht),
|
|
283
|
+
y && /* @__PURE__ */ N(Bt, { children: [/* @__PURE__ */ o(Ft, {
|
|
279
284
|
announcement: qe,
|
|
280
|
-
dataTest: `${
|
|
281
|
-
}), /* @__PURE__ */ o(
|
|
282
|
-
open:
|
|
283
|
-
dataTest:
|
|
284
|
-
listboxId:
|
|
285
|
+
dataTest: `${r}-live`
|
|
286
|
+
}), /* @__PURE__ */ o(zt, {
|
|
287
|
+
open: n,
|
|
288
|
+
dataTest: r,
|
|
289
|
+
listboxId: V,
|
|
285
290
|
title: H ?? (ae.label || void 0),
|
|
286
|
-
name: typeof H == "string" ? H : ae.name ||
|
|
287
|
-
text:
|
|
288
|
-
options:
|
|
289
|
-
multiple:
|
|
290
|
-
value:
|
|
291
|
-
clearable: !
|
|
291
|
+
name: typeof H == "string" ? H : ae.name || U.search,
|
|
292
|
+
text: U,
|
|
293
|
+
options: b,
|
|
294
|
+
multiple: l,
|
|
295
|
+
value: l ? c : x,
|
|
296
|
+
clearable: !re && !p,
|
|
292
297
|
isEqual: v,
|
|
293
|
-
isOptionDisabled:
|
|
298
|
+
isOptionDisabled: M,
|
|
294
299
|
getLabel: d,
|
|
295
|
-
getOptionKey:
|
|
300
|
+
getOptionKey: C,
|
|
296
301
|
filterOptions: _,
|
|
297
|
-
renderOptionRow:
|
|
298
|
-
optionRowClassName:
|
|
299
|
-
loading:
|
|
302
|
+
renderOptionRow: z ?? ye,
|
|
303
|
+
optionRowClassName: ke,
|
|
304
|
+
loading: B,
|
|
300
305
|
loadingText: ee,
|
|
301
306
|
noOptionsText: te,
|
|
302
|
-
allowSelectAll:
|
|
303
|
-
selectAllLabel:
|
|
307
|
+
allowSelectAll: S,
|
|
308
|
+
selectAllLabel: le,
|
|
304
309
|
onSelect: w,
|
|
305
310
|
onClear: it,
|
|
306
311
|
onApply: ct,
|
|
307
312
|
onCancel: () => i(!1)
|
|
308
313
|
})] }),
|
|
309
|
-
|
|
314
|
+
n && !y && /* @__PURE__ */ o(Ht, {
|
|
310
315
|
root: be,
|
|
311
316
|
children: /* @__PURE__ */ N("ul", {
|
|
312
|
-
ref:
|
|
313
|
-
...q ?
|
|
317
|
+
ref: nt,
|
|
318
|
+
...q ? kt : {},
|
|
314
319
|
style: {
|
|
315
320
|
...q ? yt : {},
|
|
316
321
|
...et,
|
|
317
322
|
width: Xe ?? void 0,
|
|
318
323
|
maxHeight: de ?? void 0,
|
|
319
324
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
320
|
-
...
|
|
325
|
+
...se?.popper?.style
|
|
321
326
|
},
|
|
322
|
-
...
|
|
323
|
-
id:
|
|
327
|
+
...rt(),
|
|
328
|
+
id: V,
|
|
324
329
|
role: "listbox",
|
|
325
|
-
"aria-multiselectable":
|
|
326
|
-
className: D("z-[1300] m-0 list-none overflow-auto rounded border border-solid border-delta-300 bg-white px-0 py-2 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]",
|
|
327
|
-
children: [
|
|
328
|
-
id: `${
|
|
330
|
+
"aria-multiselectable": l ? !0 : void 0,
|
|
331
|
+
className: D("z-[1300] m-0 list-none overflow-auto rounded border border-solid border-delta-300 bg-white px-0 py-2 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", gt && "py-0", "[&>li:not(:last-child)]:shadow-[inset_0_-1px_0_var(--colors-delta-200)]", Le?.listbox, se?.popper?.className),
|
|
332
|
+
children: [S && l && /* @__PURE__ */ N("li", {
|
|
333
|
+
id: `${r}-select-all`,
|
|
329
334
|
role: "option",
|
|
330
335
|
"aria-selected": G,
|
|
331
|
-
"data-active":
|
|
336
|
+
"data-active": s === -1 ? "" : void 0,
|
|
332
337
|
tabIndex: -1,
|
|
333
338
|
onMouseDown: (e) => e.preventDefault(),
|
|
334
|
-
onClick:
|
|
335
|
-
onMouseMove: () =>
|
|
339
|
+
onClick: Q,
|
|
340
|
+
onMouseMove: () => k(null),
|
|
336
341
|
className: "relative box-border flex h-8 cursor-pointer items-center gap-x-3 bg-[var(--colors-gray-10)] px-3 text-xs font-semibold uppercase tracking-[0.2px] text-delta-600 hover:bg-delta-50",
|
|
337
342
|
children: [
|
|
338
|
-
|
|
343
|
+
s === -1 && /* @__PURE__ */ o("span", {
|
|
339
344
|
"aria-hidden": "true",
|
|
340
345
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
341
346
|
}),
|
|
342
347
|
/* @__PURE__ */ o(ve, {
|
|
343
|
-
dataTest: `${
|
|
348
|
+
dataTest: `${r}-select-all`,
|
|
344
349
|
checked: G,
|
|
345
|
-
indeterminate:
|
|
350
|
+
indeterminate: xt,
|
|
346
351
|
size: "medium",
|
|
347
352
|
checkboxClassName: "!h-4 !w-4",
|
|
348
353
|
hideWrapper: !0,
|
|
@@ -350,23 +355,23 @@ function vl({ dataTest: l, options: h, renderInput: Ne, value: $, onChange: P, g
|
|
|
350
355
|
}),
|
|
351
356
|
/* @__PURE__ */ o("span", {
|
|
352
357
|
className: "flex-1 truncate",
|
|
353
|
-
children:
|
|
358
|
+
children: le
|
|
354
359
|
})
|
|
355
360
|
]
|
|
356
|
-
}),
|
|
361
|
+
}), B ? /* @__PURE__ */ o("li", {
|
|
357
362
|
role: "presentation",
|
|
358
363
|
className: "px-3 py-2 text-sm text-delta-600",
|
|
359
364
|
children: ee
|
|
360
|
-
}) :
|
|
365
|
+
}) : f.length === 0 ? /* @__PURE__ */ o("li", {
|
|
361
366
|
role: "presentation",
|
|
362
367
|
className: "px-3 py-2 text-sm text-delta-600",
|
|
363
368
|
children: te
|
|
364
|
-
}) :
|
|
369
|
+
}) : f.map(bt)]
|
|
365
370
|
})
|
|
366
371
|
})
|
|
367
372
|
]
|
|
368
373
|
});
|
|
369
374
|
}
|
|
370
375
|
export {
|
|
371
|
-
|
|
376
|
+
wr as StyledSelectAutocomplete
|
|
372
377
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useSyncExternalStore as o } from "react";
|
|
2
|
-
function
|
|
2
|
+
function e(t) {
|
|
3
3
|
function i() {
|
|
4
4
|
return window.matchMedia(t).matches;
|
|
5
5
|
}
|
|
6
|
-
function a(
|
|
6
|
+
function a(r) {
|
|
7
7
|
const n = window.matchMedia(t);
|
|
8
|
-
return n.addEventListener("change",
|
|
9
|
-
n.removeEventListener("change",
|
|
8
|
+
return n.addEventListener("change", r), () => {
|
|
9
|
+
n.removeEventListener("change", r);
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
function u() {
|
|
@@ -16,9 +16,10 @@ function r(t) {
|
|
|
16
16
|
return o(a, i, u);
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
var h =
|
|
19
|
+
var h = e("(max-width: 743px)"), s = e("(max-height: 480px)"), c = e("(max-height: 480px) and (min-width: 480px)"), m = e("(max-width: 743px), (max-height: 480px)");
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
m as useFullScreenPickerMediaQuery,
|
|
22
22
|
h as useMobileMediaQuery,
|
|
23
|
-
c as
|
|
23
|
+
c as usePickerOneRowHeaderMediaQuery,
|
|
24
|
+
s as useShortViewportMediaQuery
|
|
24
25
|
};
|
|
@@ -28,7 +28,8 @@ export interface FullScreenPickerProps {
|
|
|
28
28
|
* search, optional selection/clear row; 1 px `border/separator` delta-200 under it) and one scrolling
|
|
29
29
|
* **List**. Title = Mobile/Page title, SemiBold 20/28, `text-icon/title-label` delta-800, wraps.
|
|
30
30
|
* Close = 40 × 40 Quaternary button with a 24 px ×. Search row = `pt-8 px-16`. On a short viewport
|
|
31
|
-
* (`Variant2`, ≤ 480 px high
|
|
31
|
+
* (`Variant2`, ≤ 480 px high and ≥ 480 px wide — a phone in landscape, not an upright phone whose
|
|
32
|
+
* keyboard is up) title, search (max 240 px) and close share the first row.
|
|
32
33
|
*
|
|
33
34
|
* The shared shell for every full-screen picker in ui-core: `StyledSelectAutocomplete` and
|
|
34
35
|
* `CountryCodeSelect` both render through it (ASMA-8468). Presentation only — the caller owns the
|
|
@@ -23,7 +23,6 @@ export interface PickerText {
|
|
|
23
23
|
cleared: string;
|
|
24
24
|
/** Announced after `clearAll`. */
|
|
25
25
|
clearedAll: string;
|
|
26
|
-
truncated: (shown: number, total: number) => string;
|
|
27
26
|
}
|
|
28
27
|
/** Default picker copy for `locale`, with any consumer overrides applied on top. */
|
|
29
28
|
export declare const getPickerText: (locale: UiCoreLocale, overrides?: Partial<PickerText>) => PickerText;
|
|
@@ -20,9 +20,11 @@ export interface CountryCodeOptionsProps {
|
|
|
20
20
|
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
21
21
|
/** Tabbing into the list: put the active-row marker on a row. */
|
|
22
22
|
onFocus?: () => void;
|
|
23
|
+
/** The list is showing: each opening starts at the chosen country (LIST-10, AC 17). */
|
|
24
|
+
open?: boolean;
|
|
23
25
|
}
|
|
24
26
|
/**
|
|
25
27
|
* The country listbox. Presentation only — filtering, the active row and the keyboard live in
|
|
26
28
|
* [[useCountryPicker]], so the desktop trigger and the mobile sheet render the same list.
|
|
27
29
|
*/
|
|
28
|
-
export declare const CountryCodeOptions: ({ dataTest, visible, selectedIso2, activeIndex, optionId, onSelect, listId, label, renderFlag, className, onKeyDown, onFocus, }: CountryCodeOptionsProps) => JSX.Element;
|
|
30
|
+
export declare const CountryCodeOptions: ({ dataTest, visible, selectedIso2, activeIndex, optionId, onSelect, listId, label, renderFlag, className, onKeyDown, onFocus, open, }: CountryCodeOptionsProps) => JSX.Element;
|