asma-ui-core 3.127.2 → 3.128.1
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/emoji-choice/StyledEmojiChoice.js +259 -0
- package/dist/components/inputs/emoji-choice/StyledEmojiChoice.module.js +27 -0
- package/dist/components/inputs/radio-button/base-ui/StyledRadio.js +15 -15
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +84 -84
- package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +45 -44
- package/dist/components/utils/bottom-sheet/formatResultsLabel.js +6 -2
- package/dist/components/utils/bottom-sheet/sheetCopy.js +15 -0
- package/dist/components/utils/popover/PopoverSheet.js +99 -97
- package/dist/index.js +162 -160
- package/dist/src/components/inputs/emoji-choice/StyledEmojiChoice.d.ts +37 -0
- package/dist/src/components/inputs/emoji-choice/index.d.ts +1 -0
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +3 -1
- package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +5 -2
- package/dist/src/components/utils/bottom-sheet/formatResultsLabel.d.ts +4 -1
- package/dist/src/components/utils/bottom-sheet/sheetCopy.d.ts +11 -0
- package/dist/src/components/utils/popover/PopoverSheet.d.ts +5 -2
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
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
|
|
7
|
-
import { StyledChip as
|
|
2
|
+
import { TOP_LAYER_PROPS as yt, TOP_LAYER_RESET_STYLE as vt, getOpenModalDialogAncestor as wt, shouldUsePopoverTopLayer as Dt, useTopLayerRef as It } from "../../../hooks/useTopLayer.hook.js";
|
|
3
|
+
import { ChevronDownIcon as Nt } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
4
|
+
import { CloseIcon as Pt } from "../../icons/close-icon/CloseIcon.js";
|
|
5
|
+
import { CheckIcon as Ct } from "../../icons/check-icon/CheckIcon.js";
|
|
6
|
+
import { PlusIconCircle as At } from "../../icons/plus-icon-circle/PlusIconCircle.js";
|
|
7
|
+
import { StyledChip as St } 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 Rt } from "../../../hooks/useMediaQuery.hook.js";
|
|
10
|
+
import { useBackCloses as Mt } from "../../../hooks/useBackCloses.hook.js";
|
|
11
|
+
import { fieldWidthStyle as $t } from "../field-styles.js";
|
|
12
|
+
import { LoadingIcon as Ft } from "../../../table/shared-components/LoadingIcon.js";
|
|
13
|
+
import { PickerLiveRegion as _t, useAnnouncer as Lt } from "../full-screen-picker/PickerLiveRegion.js";
|
|
14
|
+
import { getPickerText as Et } from "../full-screen-picker/pickerCopy.js";
|
|
15
|
+
import { readFieldName as Wt } from "./readFieldName.js";
|
|
16
|
+
import { getDraftChanges as jt } from "./draftChanges.js";
|
|
17
|
+
import { nextActiveIndex as zt } from "./listboxCursor.js";
|
|
18
|
+
import { SelectAutocompletePicker as Bt } 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
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
const l =
|
|
21
|
+
import { Fragment as Ht, jsx as o, jsxs as N } from "react/jsx-runtime";
|
|
22
|
+
import { FloatingPortal as Ut, autoUpdate as Vt, flip as Ot, offset as Yt, shift as qt, size as Tt, useDismiss as Qt, useFloating as Gt, useInteractions as Jt, useMergeRefs as Ie, useRole as Xt } from "@floating-ui/react";
|
|
23
|
+
var Zt = (r) => typeof r == "object" && r !== null && "label" in r ? String(r.label) : String(r), Kt = (r) => typeof r == "object" && r !== null && "disabled" in r && !!r.disabled;
|
|
24
|
+
function Dr({ 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, maxListHeight: _e = 320, multiple: Le, allowSelectAll: S, selectAllLabel: le = "Select all", width: oe = "full", fullWidth: er, classes: Ee, inputValue: L, onInputChange: We, open: ne, onOpen: je, onClose: ze, className: Be, wrapperClassName: He, getOptionDisabled: Ue, slotProps: se, pickerTitle: H, pickerText: Ve, locale: Oe = "en", disableFullScreenPicker: Ye }) {
|
|
25
|
+
const l = Le === !0, y = Rt() && !Ye, [ae, qe] = I({
|
|
26
26
|
label: "",
|
|
27
27
|
name: ""
|
|
28
|
-
}), [
|
|
29
|
-
e && (p || A) || (ne === void 0 &&
|
|
30
|
-
}, [
|
|
31
|
-
L === void 0 && ie(t),
|
|
32
|
-
}, [s, k] = I(null), V = `${r}-listbox`, ce = De([]), E = De(null), [
|
|
28
|
+
}), [Te, Qe] = Lt(), U = Et(Oe, Ve), d = Pe ?? Zt, v = (e, t) => Z ? Z(e, t) : e === t, [Ge, Je] = I(!1), n = ne ?? Ge, i = (e) => {
|
|
29
|
+
e && (p || A) || (ne === void 0 && Je(e), e && qe(Wt(E.current)), e ? je?.() : (k(null), ze?.()));
|
|
30
|
+
}, [Xe, ie] = I(""), g = L ?? Xe, R = (e, t, a) => {
|
|
31
|
+
L === void 0 && ie(t), We?.(e, t, a);
|
|
32
|
+
}, [s, k] = I(null), V = `${r}-listbox`, ce = De([]), E = De(null), [Ze, Ke] = I(null), [de, et] = I(null), c = l ? Array.isArray(F) ? F : [] : [], x = l ? null : F ?? null, ue = !l && x !== null ? d(x) : "";
|
|
33
33
|
we(() => {
|
|
34
34
|
L !== void 0 || l || ie(ue);
|
|
35
35
|
}, [
|
|
@@ -37,7 +37,7 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
37
37
|
l,
|
|
38
38
|
ue
|
|
39
39
|
]);
|
|
40
|
-
const O = (e) => l ? c.some((t) => v(e, t)) : x !== null && v(e, x), M = (e) =>
|
|
40
|
+
const O = (e) => l ? c.some((t) => v(e, t)) : x !== null && v(e, x), M = (e) => Ue?.(e) ?? Kt(e), fe = X(() => {
|
|
41
41
|
const e = [...b];
|
|
42
42
|
if (_) return _(e, { inputValue: g });
|
|
43
43
|
const t = !l && x !== null ? d(x).toLowerCase() : null;
|
|
@@ -62,27 +62,27 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
62
62
|
de,
|
|
63
63
|
$
|
|
64
64
|
]);
|
|
65
|
-
const { refs: j, floatingStyles:
|
|
65
|
+
const { refs: j, floatingStyles: tt, context: he } = Gt({
|
|
66
66
|
open: n,
|
|
67
67
|
onOpenChange: i,
|
|
68
68
|
placement: "bottom-start",
|
|
69
69
|
strategy: "fixed",
|
|
70
|
-
whileElementsMounted:
|
|
70
|
+
whileElementsMounted: Vt,
|
|
71
71
|
middleware: [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
Yt(0),
|
|
73
|
+
Ot({ padding: 8 }),
|
|
74
|
+
qt({ padding: 8 }),
|
|
75
|
+
Tt({ apply({ rects: e, availableHeight: t }) {
|
|
76
|
+
Ke(e.reference.width), et(Fe ? t - 8 : Math.min(t - 8, _e));
|
|
77
77
|
} })
|
|
78
78
|
]
|
|
79
|
-
}), { getReferenceProps:
|
|
80
|
-
|
|
79
|
+
}), { getReferenceProps: rt, getFloatingProps: lt, getItemProps: ot } = Jt([Qt(he, { enabled: !y }), Xt(he, { role: "listbox" })]);
|
|
80
|
+
Mt({
|
|
81
81
|
active: n && !y,
|
|
82
82
|
requestClose: () => i(!1)
|
|
83
83
|
});
|
|
84
|
-
const
|
|
85
|
-
W.length !== 0 && k((t) =>
|
|
84
|
+
const nt = Ie([j.setReference]), be = X(() => n ? wt(j.reference.current) : void 0, [n, j]), q = Dt(be), st = Ie([It(j.setFloating, q)]), at = (e) => Y.includes($) ? $ : Y[e === 1 ? 0 : Y.length - 1] ?? null, it = (e) => {
|
|
85
|
+
W.length !== 0 && k((t) => zt(W, t, $, e));
|
|
86
86
|
}, w = (e, t, a = !l || !Me) => {
|
|
87
87
|
if (l) {
|
|
88
88
|
const u = c.some((h) => v(t, h)), m = u ? c.filter((h) => !v(t, h)) : [...c, t];
|
|
@@ -91,15 +91,15 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
91
91
|
P?.(e, t, "selectOption", { option: t }), R(e, d(t), "reset"), a && i(!1);
|
|
92
92
|
}, T = (e) => {
|
|
93
93
|
P?.(e, l ? [] : null, "clear", void 0), R(e, "", "clear");
|
|
94
|
-
},
|
|
95
|
-
T(e), i(!1),
|
|
96
|
-
},
|
|
97
|
-
for (const { value: a, reason: u, option: m } of
|
|
94
|
+
}, ct = (e) => {
|
|
95
|
+
T(e), i(!1), Qe(U.cleared);
|
|
96
|
+
}, dt = (e, t) => {
|
|
97
|
+
for (const { value: a, reason: u, option: m } of jt(c, t, v)) P?.(e, a, u, m === void 0 ? void 0 : { option: m });
|
|
98
98
|
R(e, "", "reset"), i(!1);
|
|
99
99
|
}, Q = (e) => {
|
|
100
100
|
const t = b.length > 0 && c.length === b.length;
|
|
101
101
|
P?.(e, t ? [] : b, t ? "clear" : "selectOption", void 0);
|
|
102
|
-
},
|
|
102
|
+
}, ut = (e) => {
|
|
103
103
|
if (e.key === "Backspace" && g === "" && ge) {
|
|
104
104
|
const t = c[c.length - 1];
|
|
105
105
|
l ? t !== void 0 && w(e, t, !1) : T(e);
|
|
@@ -113,10 +113,10 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
113
113
|
M(t) || w(e, t, !0);
|
|
114
114
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
115
115
|
if (e.preventDefault(), !n) {
|
|
116
|
-
k(
|
|
116
|
+
k(at(e.key === "ArrowDown" ? 1 : -1)), i(!0);
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
it(e.key === "ArrowDown" ? 1 : -1);
|
|
120
120
|
} else if (e.key === "Home" || e.key === "End")
|
|
121
121
|
e.preventDefault(), k(W[e.key === "Home" ? 0 : W.length - 1] ?? null);
|
|
122
122
|
else if (e.key === " " && s === -1)
|
|
@@ -129,18 +129,18 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
129
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
|
-
const
|
|
132
|
+
const ft = (e) => {
|
|
133
133
|
e.preventDefault(), !(A || p) && (E.current?.focus(), i(!n));
|
|
134
|
-
},
|
|
134
|
+
}, pt = l ? K ? K(c, ({ index: e }) => ({ "data-index": e })) : c.map((e, t) => /* @__PURE__ */ o(St, {
|
|
135
135
|
dataTest: `selected-chip-${d(e)}`,
|
|
136
136
|
label: d(e),
|
|
137
137
|
readOnly: p,
|
|
138
138
|
deleteButtonTabIndex: -1,
|
|
139
139
|
onDelete: p ? void 0 : (a) => w(a, e)
|
|
140
|
-
}, C ? C(e) : `${d(e)}-${t}`)) : void 0,
|
|
140
|
+
}, C ? C(e) : `${d(e)}-${t}`)) : void 0, mt = /* @__PURE__ */ N("span", {
|
|
141
141
|
className: "flex items-center gap-1",
|
|
142
142
|
children: [
|
|
143
|
-
B && /* @__PURE__ */ o(
|
|
143
|
+
B && /* @__PURE__ */ o(Ft, {
|
|
144
144
|
width: 20,
|
|
145
145
|
height: 20,
|
|
146
146
|
className: "animate-spin"
|
|
@@ -153,7 +153,7 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
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
155
|
onClick: T,
|
|
156
|
-
children: /* @__PURE__ */ o(
|
|
156
|
+
children: /* @__PURE__ */ o(Pt, {
|
|
157
157
|
width: 20,
|
|
158
158
|
height: 20,
|
|
159
159
|
className: "text-delta-700"
|
|
@@ -167,23 +167,23 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
167
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
|
-
onClick:
|
|
171
|
-
children: $e ?? (l ? /* @__PURE__ */ o(
|
|
170
|
+
onClick: ft,
|
|
171
|
+
children: $e ?? (l ? /* @__PURE__ */ o(At, {
|
|
172
172
|
width: 24,
|
|
173
173
|
height: 24,
|
|
174
174
|
className: "text-delta-700"
|
|
175
|
-
}) : /* @__PURE__ */ o(
|
|
175
|
+
}) : /* @__PURE__ */ o(Nt, {
|
|
176
176
|
width: 24,
|
|
177
177
|
height: 24,
|
|
178
178
|
className: D(J["select-custom-icon"], n && J["select-custom-icon-open"], "text-delta-700")
|
|
179
179
|
}))
|
|
180
180
|
})
|
|
181
181
|
]
|
|
182
|
-
}),
|
|
182
|
+
}), ht = (e) => {
|
|
183
183
|
if (A || p || !(e.target instanceof Element)) return;
|
|
184
184
|
const t = e.target.closest('button, a, [role="button"], [data-chip]');
|
|
185
185
|
t && e.currentTarget.contains(t) || (E.current?.focus(), i(!0));
|
|
186
|
-
},
|
|
186
|
+
}, bt = {
|
|
187
187
|
disabled: A,
|
|
188
188
|
size: Se,
|
|
189
189
|
fullWidth: !0,
|
|
@@ -193,10 +193,10 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
193
193
|
onChange: (e) => {
|
|
194
194
|
y || (k(null), R(e, e.target.value, "input"), n || i(!0));
|
|
195
195
|
},
|
|
196
|
-
onKeyDown:
|
|
196
|
+
onKeyDown: ut,
|
|
197
197
|
slotProps: {
|
|
198
198
|
htmlInput: {
|
|
199
|
-
...
|
|
199
|
+
...rt(),
|
|
200
200
|
ref: E,
|
|
201
201
|
onClick: () => i(!0),
|
|
202
202
|
role: "combobox",
|
|
@@ -212,10 +212,10 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
212
212
|
} : {}
|
|
213
213
|
},
|
|
214
214
|
input: {
|
|
215
|
-
ref:
|
|
216
|
-
startAdornment:
|
|
217
|
-
endAdornment:
|
|
218
|
-
onClick:
|
|
215
|
+
ref: nt,
|
|
216
|
+
startAdornment: pt,
|
|
217
|
+
endAdornment: mt,
|
|
218
|
+
onClick: ht
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
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) => {
|
|
@@ -236,7 +236,7 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
236
236
|
decorative: !0
|
|
237
237
|
}) : /* @__PURE__ */ o("span", {
|
|
238
238
|
className: D("w-5", a.inPicker && "flex"),
|
|
239
|
-
children: a.selected && /* @__PURE__ */ o(
|
|
239
|
+
children: a.selected && /* @__PURE__ */ o(Ct, {
|
|
240
240
|
width: 20,
|
|
241
241
|
height: 20,
|
|
242
242
|
className: "text-gama-500"
|
|
@@ -248,9 +248,9 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
248
248
|
})
|
|
249
249
|
]
|
|
250
250
|
}, u);
|
|
251
|
-
},
|
|
251
|
+
}, gt = (e, t) => {
|
|
252
252
|
const a = M(e), u = {
|
|
253
|
-
...
|
|
253
|
+
...ot({
|
|
254
254
|
onMouseDown: (h) => h.preventDefault(),
|
|
255
255
|
onClick: (h) => {
|
|
256
256
|
a || w(h, e);
|
|
@@ -273,17 +273,17 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
273
273
|
inputValue: g
|
|
274
274
|
};
|
|
275
275
|
return z ? z(u, e, m) : ye(u, e, m);
|
|
276
|
-
},
|
|
276
|
+
}, xt = !!(S && l), G = b.length > 0 && c.length === b.length, kt = c.length > 0 && !G;
|
|
277
277
|
return /* @__PURE__ */ N("div", {
|
|
278
|
-
className: D(J.styledSelectAutocompleteWrapper,
|
|
278
|
+
className: D(J.styledSelectAutocompleteWrapper, He, Be),
|
|
279
279
|
"data-field-width": oe,
|
|
280
|
-
style:
|
|
280
|
+
style: $t(oe),
|
|
281
281
|
children: [
|
|
282
|
-
Ne(
|
|
283
|
-
y && /* @__PURE__ */ N(
|
|
284
|
-
announcement:
|
|
282
|
+
Ne(bt),
|
|
283
|
+
y && /* @__PURE__ */ N(Ht, { children: [/* @__PURE__ */ o(_t, {
|
|
284
|
+
announcement: Te,
|
|
285
285
|
dataTest: `${r}-live`
|
|
286
|
-
}), /* @__PURE__ */ o(
|
|
286
|
+
}), /* @__PURE__ */ o(Bt, {
|
|
287
287
|
open: n,
|
|
288
288
|
dataTest: r,
|
|
289
289
|
listboxId: V,
|
|
@@ -307,28 +307,28 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
307
307
|
allowSelectAll: S,
|
|
308
308
|
selectAllLabel: le,
|
|
309
309
|
onSelect: w,
|
|
310
|
-
onClear:
|
|
311
|
-
onApply:
|
|
310
|
+
onClear: ct,
|
|
311
|
+
onApply: dt,
|
|
312
312
|
onCancel: () => i(!1)
|
|
313
313
|
})] }),
|
|
314
|
-
n && !y && /* @__PURE__ */ o(
|
|
314
|
+
n && !y && /* @__PURE__ */ o(Ut, {
|
|
315
315
|
root: be,
|
|
316
316
|
children: /* @__PURE__ */ N("ul", {
|
|
317
|
-
ref:
|
|
318
|
-
...q ?
|
|
317
|
+
ref: st,
|
|
318
|
+
...q ? yt : {},
|
|
319
319
|
style: {
|
|
320
|
-
...q ?
|
|
321
|
-
...
|
|
322
|
-
width:
|
|
320
|
+
...q ? vt : {},
|
|
321
|
+
...tt,
|
|
322
|
+
width: Ze ?? void 0,
|
|
323
323
|
maxHeight: de ?? void 0,
|
|
324
324
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
325
325
|
...se?.popper?.style
|
|
326
326
|
},
|
|
327
|
-
...
|
|
327
|
+
...lt(),
|
|
328
328
|
id: V,
|
|
329
329
|
role: "listbox",
|
|
330
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)]",
|
|
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)]", xt && "py-0", "[&>li:not(:last-child)]:shadow-[inset_0_-1px_0_var(--colors-delta-200)]", Ee?.listbox, se?.popper?.className),
|
|
332
332
|
children: [S && l && /* @__PURE__ */ N("li", {
|
|
333
333
|
id: `${r}-select-all`,
|
|
334
334
|
role: "option",
|
|
@@ -347,7 +347,7 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
347
347
|
/* @__PURE__ */ o(ve, {
|
|
348
348
|
dataTest: `${r}-select-all`,
|
|
349
349
|
checked: G,
|
|
350
|
-
indeterminate:
|
|
350
|
+
indeterminate: kt,
|
|
351
351
|
size: "medium",
|
|
352
352
|
checkboxClassName: "!h-4 !w-4",
|
|
353
353
|
hideWrapper: !0,
|
|
@@ -366,12 +366,12 @@ function wr({ dataTest: r, options: b, renderInput: Ne, value: F, onChange: P, g
|
|
|
366
366
|
role: "presentation",
|
|
367
367
|
className: "px-3 py-2 text-sm text-delta-600",
|
|
368
368
|
children: te
|
|
369
|
-
}) : f.map(
|
|
369
|
+
}) : f.map(gt)]
|
|
370
370
|
})
|
|
371
371
|
})
|
|
372
372
|
]
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
375
|
export {
|
|
376
|
-
|
|
376
|
+
Dr as StyledSelectAutocomplete
|
|
377
377
|
};
|
|
@@ -2,26 +2,27 @@ import { cn as l } from "../../../helpers/cn.js";
|
|
|
2
2
|
import { registerOpenModalDialog as z } from "../../../hooks/useTopLayer.hook.js";
|
|
3
3
|
import { CloseIcon as J } from "../../icons/close-icon/CloseIcon.js";
|
|
4
4
|
import { IndeterminateIcon as W } from "../../icons/indeterminate-icon/IndeterminateIcon.js";
|
|
5
|
-
import { StyledButton as
|
|
6
|
-
import { useShortViewportMediaQuery as
|
|
7
|
-
import { OverlayBackOwnerContext as
|
|
8
|
-
import { useDebouncedValue as
|
|
9
|
-
import { useFocusTrap as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
5
|
+
import { StyledButton as _ } from "../../inputs/button/StyledButton.js";
|
|
6
|
+
import { useShortViewportMediaQuery as Z } from "../../../hooks/useMediaQuery.hook.js";
|
|
7
|
+
import { OverlayBackOwnerContext as ee, isOverlayBackEnabled as j, requestCloseTopOverlayBack as y, useBackCloses as te } from "../../../hooks/useBackCloses.hook.js";
|
|
8
|
+
import { useDebouncedValue as re } from "../../../hooks/useDebouncedValue.hook.js";
|
|
9
|
+
import { useFocusTrap as oe } from "../../../hooks/useFocusTrap.hook.js";
|
|
10
|
+
import { SHEET_TEXT as ne } from "./sheetCopy.js";
|
|
11
|
+
import { formatResultsLabel as ae } from "./formatResultsLabel.js";
|
|
12
|
+
import { useBodyScrollLock as se } from "../../../hooks/useBodyScrollLock.hook.js";
|
|
13
|
+
import ie from "./StyledBottomSheet.module.js";
|
|
14
|
+
import { useDragToDismiss as le } from "./useDragToDismiss.hook.js";
|
|
15
|
+
import { useEffect as g, useId as ce, useLayoutEffect as de, useRef as c, useState as ue } from "react";
|
|
15
16
|
import { jsx as o, jsxs as u } from "react/jsx-runtime";
|
|
16
|
-
var
|
|
17
|
-
const
|
|
17
|
+
var me = 500, Oe = ({ dataTest: d, id: P, open: t, onClose: s, title: m, ariaLabel: q, children: $, viewResultsAction: E, resetAction: A, footerActions: H, resultCount: S, locale: k = "en", closeLabel: U = ne[k].close, className: V, registerBackClose: K = !0, ownerRef: G }) => {
|
|
18
|
+
const N = ce(), i = c(null), R = c(null), B = c(null), L = G ?? i, h = c(!1), [x, C] = ue(!1), Q = Z(), f = c(s), O = c(t);
|
|
18
19
|
g(() => {
|
|
19
|
-
f.current = s,
|
|
20
|
+
f.current = s, O.current = t;
|
|
20
21
|
}, [s, t]);
|
|
21
|
-
const { dragHandleProps:
|
|
22
|
+
const { dragHandleProps: X, dragOffset: I } = le(R, () => {
|
|
22
23
|
f.current("drag");
|
|
23
24
|
});
|
|
24
|
-
|
|
25
|
+
se(t), oe(t, i), g(() => {
|
|
25
26
|
if (!t) return;
|
|
26
27
|
const e = (r) => {
|
|
27
28
|
r.key === "Escape" && (h.current = !0, window.setTimeout(() => {
|
|
@@ -35,20 +36,20 @@ var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLab
|
|
|
35
36
|
return window.addEventListener("keydown", e, !0), window.addEventListener("keydown", n), () => {
|
|
36
37
|
window.removeEventListener("keydown", e, !0), window.removeEventListener("keydown", n);
|
|
37
38
|
};
|
|
38
|
-
}, [t]),
|
|
39
|
-
active: t &&
|
|
39
|
+
}, [t]), te({
|
|
40
|
+
active: t && K,
|
|
40
41
|
requestClose: () => f.current("escape"),
|
|
41
42
|
ownerRef: L
|
|
42
|
-
}),
|
|
43
|
+
}), de(() => {
|
|
43
44
|
const e = i.current;
|
|
44
45
|
if (!t || !e) return;
|
|
45
|
-
|
|
46
|
+
B.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.open || e.showModal(), e.focus({ preventScroll: !0 });
|
|
46
47
|
const n = requestAnimationFrame(() => {
|
|
47
|
-
|
|
48
|
+
C(!0);
|
|
48
49
|
}), r = z(e);
|
|
49
50
|
return () => {
|
|
50
|
-
cancelAnimationFrame(n), r(),
|
|
51
|
-
const a =
|
|
51
|
+
cancelAnimationFrame(n), r(), C(!1), e.open && e.close();
|
|
52
|
+
const a = B.current;
|
|
52
53
|
a?.isConnected && a.focus({ preventScroll: !0 });
|
|
53
54
|
};
|
|
54
55
|
}, [t]), g(() => {
|
|
@@ -57,46 +58,46 @@ var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLab
|
|
|
57
58
|
let n = !1;
|
|
58
59
|
const r = () => {
|
|
59
60
|
requestAnimationFrame(() => {
|
|
60
|
-
n = !1,
|
|
61
|
+
n = !1, O.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
|
|
61
62
|
});
|
|
62
63
|
}, a = () => {
|
|
63
|
-
n || (n = !0,
|
|
64
|
+
n || (n = !0, j() && y(), r());
|
|
64
65
|
};
|
|
65
66
|
return e.addEventListener("close", a), () => e.removeEventListener("close", a);
|
|
66
67
|
}, [t]);
|
|
67
|
-
const
|
|
68
|
+
const D = ae(re(S, me), k);
|
|
68
69
|
if (!t) return null;
|
|
69
70
|
const Y = { close: () => {
|
|
70
71
|
s("action");
|
|
71
|
-
} }, p = (e) => typeof e == "function" ? e(Y) : e,
|
|
72
|
+
} }, p = (e) => typeof e == "function" ? e(Y) : e, T = S !== void 0, b = E !== void 0 ? p(E) : T ? /* @__PURE__ */ o(_, {
|
|
72
73
|
dataTest: `${d}-view-results`,
|
|
73
74
|
type: "button",
|
|
74
75
|
variant: "text",
|
|
75
76
|
onClick: () => {
|
|
76
77
|
s("viewResults");
|
|
77
78
|
},
|
|
78
|
-
children:
|
|
79
|
-
}) : void 0, F = p(
|
|
79
|
+
children: D
|
|
80
|
+
}) : void 0, F = p(A), v = p(H), w = !!(b ?? F), M = I > 0;
|
|
80
81
|
return /* @__PURE__ */ o("dialog", {
|
|
81
82
|
ref: i,
|
|
82
|
-
id:
|
|
83
|
+
id: P,
|
|
83
84
|
tabIndex: -1,
|
|
84
85
|
"aria-modal": "true",
|
|
85
|
-
"aria-labelledby": m ?
|
|
86
|
-
"aria-label": m ? void 0 :
|
|
86
|
+
"aria-labelledby": m ? N : void 0,
|
|
87
|
+
"aria-label": m ? void 0 : q,
|
|
87
88
|
"data-test": d,
|
|
88
89
|
"data-testid": d,
|
|
89
90
|
onCancel: (e) => {
|
|
90
91
|
if (e.cancelable && e.preventDefault(), !h.current) {
|
|
91
|
-
if (!
|
|
92
|
+
if (!j()) {
|
|
92
93
|
f.current("escape");
|
|
93
94
|
return;
|
|
94
95
|
}
|
|
95
96
|
y();
|
|
96
97
|
}
|
|
97
98
|
},
|
|
98
|
-
className: l(
|
|
99
|
-
children: /* @__PURE__ */ u(
|
|
99
|
+
className: l(ie.StyledBottomSheet, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none flex-col items-center justify-end overflow-hidden border-0 bg-transparent p-0 outline-none open:flex"),
|
|
100
|
+
children: /* @__PURE__ */ u(ee.Provider, {
|
|
100
101
|
value: L,
|
|
101
102
|
children: [/* @__PURE__ */ o("div", {
|
|
102
103
|
"aria-hidden": "true",
|
|
@@ -106,19 +107,19 @@ var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLab
|
|
|
106
107
|
},
|
|
107
108
|
className: l("absolute inset-0 bg-[#626e7eb2] transition-opacity duration-[250ms] ease-out motion-reduce:duration-150", x ? "opacity-100" : "opacity-0")
|
|
108
109
|
}), /* @__PURE__ */ u("div", {
|
|
109
|
-
ref:
|
|
110
|
+
ref: R,
|
|
110
111
|
"data-state": x ? "open" : "closed",
|
|
111
|
-
style: M ? { transform: `translateY(${
|
|
112
|
-
className: l("relative box-border flex w-full max-w-[640px] flex-col border border-solid border-delta-300 bg-white text-delta-700 outline-none",
|
|
112
|
+
style: M ? { transform: `translateY(${I}px)` } : void 0,
|
|
113
|
+
className: l("relative box-border flex w-full max-w-[640px] flex-col border border-solid border-delta-300 bg-white text-delta-700 outline-none", Q ? "h-full max-h-none rounded-none" : "max-h-[90dvh] rounded-t-[28px]", !M && ["ease-out motion-safe:transition-transform motion-safe:duration-[250ms] motion-reduce:transition-opacity motion-reduce:duration-150", x ? "translate-y-0 opacity-100" : "motion-safe:translate-y-full motion-reduce:opacity-0"], V),
|
|
113
114
|
children: [
|
|
114
115
|
/* @__PURE__ */ u("div", {
|
|
115
116
|
className: "border-b-solid shrink-0 border-b border-delta-200 pb-2",
|
|
116
117
|
children: [/* @__PURE__ */ u("div", {
|
|
117
|
-
...
|
|
118
|
+
...X,
|
|
118
119
|
className: "relative flex h-12 touch-none items-center gap-2 px-2",
|
|
119
120
|
children: [
|
|
120
121
|
/* @__PURE__ */ o("div", { className: "min-w-0 flex-1" }),
|
|
121
|
-
/* @__PURE__ */ o(
|
|
122
|
+
/* @__PURE__ */ o(_, {
|
|
122
123
|
dataTest: `${d}-close`,
|
|
123
124
|
variant: "textGray",
|
|
124
125
|
type: "button",
|
|
@@ -140,26 +141,26 @@ var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLab
|
|
|
140
141
|
})
|
|
141
142
|
]
|
|
142
143
|
}), m && /* @__PURE__ */ o("div", {
|
|
143
|
-
id:
|
|
144
|
+
id: N,
|
|
144
145
|
className: "truncate px-4 text-lg font-semibold leading-7 text-delta-800",
|
|
145
146
|
children: m
|
|
146
147
|
})]
|
|
147
148
|
}),
|
|
148
149
|
/* @__PURE__ */ o("div", {
|
|
149
150
|
className: l("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain pl-4 pr-2 pt-2", w || v ? "pb-2" : "pb-[max(0.5rem,env(safe-area-inset-bottom))]"),
|
|
150
|
-
children: p(
|
|
151
|
+
children: p($)
|
|
151
152
|
}),
|
|
152
153
|
w && /* @__PURE__ */ u("div", {
|
|
153
154
|
className: l("border-t-solid flex shrink-0 items-start border-t border-delta-200 bg-white p-1", b ? "justify-between" : "justify-end", "max-xs:flex-wrap max-xs:gap-y-2 max-xs:[&>:nth-child(2)]:ml-auto", !v && "pb-[max(0.25rem,env(safe-area-inset-bottom))]"),
|
|
154
155
|
children: [
|
|
155
156
|
b,
|
|
156
157
|
F,
|
|
157
|
-
|
|
158
|
+
T && /* @__PURE__ */ o("span", {
|
|
158
159
|
className: "sr-only",
|
|
159
160
|
role: "status",
|
|
160
161
|
"aria-live": "polite",
|
|
161
162
|
"aria-atomic": "true",
|
|
162
|
-
children:
|
|
163
|
+
children: D
|
|
163
164
|
})
|
|
164
165
|
]
|
|
165
166
|
}),
|
|
@@ -173,5 +174,5 @@ var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLab
|
|
|
173
174
|
});
|
|
174
175
|
};
|
|
175
176
|
export {
|
|
176
|
-
|
|
177
|
+
Oe as StyledBottomSheet
|
|
177
178
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { SHEET_TEXT as l } from "./sheetCopy.js";
|
|
2
|
+
var s = 9999, a = (r, t = "en") => {
|
|
3
|
+
const e = l[t];
|
|
4
|
+
return r == null ? e.showResults : r === 0 ? e.noMatches : r > s ? `${e.showResults} (${s}+)` : `${e.showResults} (${r})`;
|
|
5
|
+
};
|
|
2
6
|
export {
|
|
3
|
-
|
|
7
|
+
a as formatResultsLabel
|
|
4
8
|
};
|