asma-ui-core 3.86.2 → 3.87.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/components/custom/pathfinder-card/PathfinderCard.js +28 -28
- package/dist/components/data-display/chip/StyledChip.js +9 -9
- package/dist/components/feedback/snack-bar/components/StyledInfoSnackbar.js +10 -10
- package/dist/components/inputs/input-field/StyledInputField.js +16 -16
- package/dist/components/inputs/search-field/StyledSearchField.js +10 -10
- package/dist/components/inputs/select/StyledSelect.js +1 -1
- package/dist/components/inputs/select/StyledSelectItem.js +7 -7
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +54 -54
- package/dist/components/inputs/switch/base-ui/StyledSwitch.js +22 -22
- package/dist/components/navigation/link/StyledLink.js +8 -8
- package/dist/components/navigation/listbox/Listbox.js +67 -66
- package/dist/components/navigation/title-chevron/StyledTitleChevron.js +7 -7
- package/dist/components/utils/accordion/base-ui/StyledAccordionSummary.js +14 -14
- package/dist/table/components/TableRow.js +74 -68
- package/package.json +1 -1
- package/src/styles/touchHardening.interaction.test.tsx +269 -0
|
@@ -3,21 +3,21 @@ import { ChevronDownIcon as et } from "../../icons/chevron-down-icon/ChevronDown
|
|
|
3
3
|
import { CloseIcon as tt } from "../../icons/close-icon/CloseIcon.js";
|
|
4
4
|
import { CheckIcon as lt } from "../../icons/check-icon/CheckIcon.js";
|
|
5
5
|
import { PlusIconCircle as rt } from "../../icons/plus-icon-circle/PlusIconCircle.js";
|
|
6
|
-
import { StyledChip as
|
|
6
|
+
import { StyledChip as st } from "../../data-display/chip/StyledChip.js";
|
|
7
7
|
import { StyledCheckbox as ae } from "../checkbox/base-ui/StyledCheckbox.js";
|
|
8
|
-
import { TOP_LAYER_PROPS as
|
|
8
|
+
import { TOP_LAYER_PROPS as ot, TOP_LAYER_RESET_STYLE as nt, getOpenModalDialogAncestor as at, shouldUsePopoverTopLayer as it, useTopLayerRef as ct } from "../../../hooks/useTopLayer.hook.js";
|
|
9
9
|
import { LoadingIcon as dt } from "../../../table/shared-components/LoadingIcon.js";
|
|
10
10
|
import z from "./StyledSelectAutocomplete.module.js";
|
|
11
11
|
import { useEffect as ie, useMemo as W, useRef as ce, useState as D } from "react";
|
|
12
|
-
import { jsx as
|
|
13
|
-
import { FloatingPortal as ut, autoUpdate as
|
|
12
|
+
import { jsx as o, jsxs as I } from "react/jsx-runtime";
|
|
13
|
+
import { FloatingPortal as ut, autoUpdate as pt, flip as ft, offset as mt, shift as ht, size as bt, useDismiss as gt, useFloating as xt, useInteractions as wt, useMergeRefs as de, useRole as yt } from "@floating-ui/react";
|
|
14
14
|
var kt = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), vt = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
|
|
15
|
-
function Ft({ dataTest: l, options:
|
|
16
|
-
const r = ve === !0, d =
|
|
15
|
+
function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, getOptionLabel: pe, getOptionKey: C, isOptionEqualToValue: H, renderOption: U, renderValue: V, filterOptions: _, loading: B, loadingText: fe = "Loading…", noOptionsText: me = "No options", disabled: M, readOnly: g, error: he, helperText: be, size: ge = "small", disableClearable: xe, disableCloseOnSelect: we, popupIcon: ye, autoHeight: ke, multiple: ve, allowSelectAll: T, selectAllLabel: De = "Select all", fullWidth: Ie, classes: Ae, inputValue: R, onInputChange: Ne, open: Y, onOpen: Ce, onClose: Me, className: Re, wrapperClassName: Se, getOptionDisabled: $e, slotProps: q }) {
|
|
16
|
+
const r = ve === !0, d = pe ?? kt, S = (e, t) => H ? H(e, t) : e === t, [Pe, Le] = D(!1), a = Y ?? Pe, u = (e) => {
|
|
17
17
|
e && (g || M) || (Y === void 0 && Le(e), e ? Ce?.() : (x(null), Me?.()));
|
|
18
18
|
}, [Ee, G] = D(""), b = R ?? Ee, $ = (e, t, n) => {
|
|
19
19
|
R === void 0 && G(t), Ne?.(e, t, n);
|
|
20
|
-
}, [
|
|
20
|
+
}, [s, x] = D(null), J = `${l}-listbox`, Q = ce([]), X = ce(null), [_e, Fe] = D(null), [Z, Oe] = D(null), i = r ? Array.isArray(A) ? A : [] : [], w = r ? null : A ?? null, K = !r && w !== null ? d(w) : "";
|
|
21
21
|
ie(() => {
|
|
22
22
|
R !== void 0 || r || G(K);
|
|
23
23
|
}, [
|
|
@@ -26,26 +26,26 @@ function Ft({ dataTest: l, options: f, renderInput: ue, value: A, onChange: N, g
|
|
|
26
26
|
K
|
|
27
27
|
]);
|
|
28
28
|
const F = (e) => r ? i.some((t) => S(e, t)) : w !== null && S(e, w), P = (e) => $e?.(e) ?? vt(e), ee = W(() => {
|
|
29
|
-
const e = [...
|
|
29
|
+
const e = [...p];
|
|
30
30
|
if (_) return _(e, { inputValue: b });
|
|
31
31
|
const t = !r && w !== null ? d(w).toLowerCase() : null;
|
|
32
32
|
if (!b || b.toLowerCase() === t) return e;
|
|
33
33
|
const n = b.toLowerCase();
|
|
34
34
|
return e.filter((m) => d(m).toLowerCase().includes(n));
|
|
35
35
|
}, [
|
|
36
|
-
|
|
36
|
+
p,
|
|
37
37
|
b,
|
|
38
38
|
_,
|
|
39
39
|
A
|
|
40
|
-
]),
|
|
40
|
+
]), f = W(() => ee.slice(0, 100), [ee]), te = f.flatMap((e, t) => P(e) ? [] : [t]), c = T && r ? [-1, ...te] : te, k = f.findIndex(F);
|
|
41
41
|
ie(() => {
|
|
42
42
|
if (!a) return;
|
|
43
|
-
const e =
|
|
43
|
+
const e = s ?? k;
|
|
44
44
|
if (e < 0) return;
|
|
45
45
|
const t = requestAnimationFrame(() => Q.current[e]?.scrollIntoView({ block: "nearest" }));
|
|
46
46
|
return () => cancelAnimationFrame(t);
|
|
47
47
|
}, [
|
|
48
|
-
|
|
48
|
+
s,
|
|
49
49
|
a,
|
|
50
50
|
Z,
|
|
51
51
|
k
|
|
@@ -55,10 +55,10 @@ function Ft({ dataTest: l, options: f, renderInput: ue, value: A, onChange: N, g
|
|
|
55
55
|
onOpenChange: u,
|
|
56
56
|
placement: "bottom-start",
|
|
57
57
|
strategy: "fixed",
|
|
58
|
-
whileElementsMounted:
|
|
58
|
+
whileElementsMounted: pt,
|
|
59
59
|
middleware: [
|
|
60
60
|
mt(0),
|
|
61
|
-
|
|
61
|
+
ft({ padding: 8 }),
|
|
62
62
|
ht({ padding: 8 }),
|
|
63
63
|
bt({ apply({ rects: e, availableHeight: t }) {
|
|
64
64
|
Fe(e.reference.width), Oe(ke ? t - 8 : Math.min(t - 8, 320));
|
|
@@ -75,22 +75,22 @@ function Ft({ dataTest: l, options: f, renderInput: ue, value: A, onChange: N, g
|
|
|
75
75
|
N?.(e, y, m ? "removeOption" : "selectOption", { option: t }), $(e, "", "reset"), n && u(!1);
|
|
76
76
|
} else
|
|
77
77
|
N?.(e, t, "selectOption", { option: t }), $(e, d(t), "reset"), n && u(!1);
|
|
78
|
-
},
|
|
78
|
+
}, se = (e) => {
|
|
79
79
|
N?.(e, r ? [] : null, "clear", void 0), $(e, "", "clear");
|
|
80
80
|
}, j = (e) => {
|
|
81
|
-
const t =
|
|
82
|
-
N?.(e, t ? [] :
|
|
81
|
+
const t = p.length > 0 && i.length === p.length;
|
|
82
|
+
N?.(e, t ? [] : p, t ? "clear" : "selectOption", void 0);
|
|
83
83
|
}, Ye = (e) => {
|
|
84
|
-
if (e.key === "Backspace" && b === "" &&
|
|
84
|
+
if (e.key === "Backspace" && b === "" && oe) {
|
|
85
85
|
const t = i[i.length - 1];
|
|
86
|
-
r ? t !== void 0 && v(e, t, !1) :
|
|
86
|
+
r ? t !== void 0 && v(e, t, !1) : se(e);
|
|
87
87
|
} else if (e.key === "Enter" && !a)
|
|
88
88
|
e.preventDefault(), u(!0);
|
|
89
|
-
else if (e.key === "Enter" &&
|
|
89
|
+
else if (e.key === "Enter" && s === -1)
|
|
90
90
|
e.preventDefault(), j(e);
|
|
91
|
-
else if (e.key === "Enter" &&
|
|
91
|
+
else if (e.key === "Enter" && s != null && f[s] != null) {
|
|
92
92
|
e.preventDefault();
|
|
93
|
-
const t =
|
|
93
|
+
const t = f[s];
|
|
94
94
|
P(t) || v(e, t, !0);
|
|
95
95
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
96
96
|
if (e.preventDefault(), !a) {
|
|
@@ -100,19 +100,19 @@ function Ft({ dataTest: l, options: f, renderInput: ue, value: A, onChange: N, g
|
|
|
100
100
|
Te(e.key === "ArrowDown" ? 1 : -1);
|
|
101
101
|
} else if (e.key === "Home" || e.key === "End")
|
|
102
102
|
e.preventDefault(), x(c[e.key === "Home" ? 0 : c.length - 1] ?? null);
|
|
103
|
-
else if (e.key === " " &&
|
|
103
|
+
else if (e.key === " " && s === -1)
|
|
104
104
|
e.preventDefault(), j(e);
|
|
105
|
-
else if (e.key === " " &&
|
|
105
|
+
else if (e.key === " " && s != null && f[s] != null) {
|
|
106
106
|
e.preventDefault();
|
|
107
|
-
const t =
|
|
107
|
+
const t = f[s];
|
|
108
108
|
P(t) || v(e, t, !1);
|
|
109
109
|
} else e.key === "Escape" ? (e.preventDefault(), u(!1)) : e.key === "Tab" && u(!1);
|
|
110
|
-
},
|
|
110
|
+
}, oe = !xe && !g && !M && (r ? i.length > 0 : w !== null);
|
|
111
111
|
let ne;
|
|
112
|
-
a &&
|
|
112
|
+
a && s != null && (s === -1 || f[s] !== void 0) && (ne = s === -1 ? `${l}-select-all` : `${l}-option-${s}`);
|
|
113
113
|
const qe = (e) => {
|
|
114
114
|
e.preventDefault(), !(M || g) && (X.current?.focus(), u(!a));
|
|
115
|
-
}, Ge = r ? V ? V(i, ({ index: e }) => ({ "data-index": e })) : i.map((e, t) => /* @__PURE__ */
|
|
115
|
+
}, Ge = r ? V ? V(i, ({ index: e }) => ({ "data-index": e })) : i.map((e, t) => /* @__PURE__ */ o(st, {
|
|
116
116
|
dataTest: `selected-chip-${d(e)}`,
|
|
117
117
|
label: d(e),
|
|
118
118
|
readOnly: g,
|
|
@@ -121,26 +121,26 @@ function Ft({ dataTest: l, options: f, renderInput: ue, value: A, onChange: N, g
|
|
|
121
121
|
}, C ? C(e) : `${d(e)}-${t}`)) : void 0, Je = /* @__PURE__ */ I("span", {
|
|
122
122
|
className: "flex items-center gap-1",
|
|
123
123
|
children: [
|
|
124
|
-
B && /* @__PURE__ */
|
|
124
|
+
B && /* @__PURE__ */ o(dt, {
|
|
125
125
|
width: 20,
|
|
126
126
|
height: 20,
|
|
127
127
|
className: "animate-spin"
|
|
128
128
|
}),
|
|
129
|
-
|
|
129
|
+
oe && /* @__PURE__ */ o("button", {
|
|
130
130
|
type: "button",
|
|
131
131
|
tabIndex: -1,
|
|
132
132
|
"aria-label": "Clear",
|
|
133
133
|
"data-testid": `${l}-clear`,
|
|
134
134
|
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",
|
|
135
135
|
onMouseDown: (e) => e.preventDefault(),
|
|
136
|
-
onClick:
|
|
137
|
-
children: /* @__PURE__ */
|
|
136
|
+
onClick: se,
|
|
137
|
+
children: /* @__PURE__ */ o(tt, {
|
|
138
138
|
width: 20,
|
|
139
139
|
height: 20,
|
|
140
140
|
className: "text-delta-700"
|
|
141
141
|
})
|
|
142
142
|
}),
|
|
143
|
-
g ? null : /* @__PURE__ */
|
|
143
|
+
g ? null : /* @__PURE__ */ o("button", {
|
|
144
144
|
type: "button",
|
|
145
145
|
tabIndex: -1,
|
|
146
146
|
"aria-label": "Toggle options",
|
|
@@ -149,11 +149,11 @@ function Ft({ dataTest: l, options: f, renderInput: ue, value: A, onChange: N, g
|
|
|
149
149
|
className: "flex cursor-pointer items-center border-0 bg-transparent",
|
|
150
150
|
onMouseDown: (e) => e.preventDefault(),
|
|
151
151
|
onClick: qe,
|
|
152
|
-
children: ye ?? (r ? /* @__PURE__ */
|
|
152
|
+
children: ye ?? (r ? /* @__PURE__ */ o(rt, {
|
|
153
153
|
width: 24,
|
|
154
154
|
height: 24,
|
|
155
155
|
className: "text-delta-700"
|
|
156
|
-
}) : /* @__PURE__ */
|
|
156
|
+
}) : /* @__PURE__ */ o(et, {
|
|
157
157
|
width: 24,
|
|
158
158
|
height: 24,
|
|
159
159
|
className: E(z["select-custom-icon"], a && z["select-custom-icon-open"], "text-delta-700")
|
|
@@ -190,30 +190,30 @@ function Ft({ dataTest: l, options: f, renderInput: ue, value: A, onChange: N, g
|
|
|
190
190
|
endAdornment: Je
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
}, Xe = E("relative box-border flex min-h-10 cursor-pointer items-center gap-x-3 px-3 py-1.5 text-base text-delta-800", "aria-selected:bg-gama-50 hover:bg-delta-50", "aria-disabled:cursor-default aria-disabled:!bg-transparent aria-disabled:text-delta-300"), Ze = (e, t, n) => {
|
|
193
|
+
}, Xe = E("asma-pressable", "relative box-border flex min-h-10 cursor-pointer items-center gap-x-3 px-3 py-1.5 text-base text-delta-800", "aria-selected:bg-gama-50 hover:bg-delta-50", "aria-disabled:cursor-default aria-disabled:!bg-transparent aria-disabled:text-delta-300"), Ze = (e, t, n) => {
|
|
194
194
|
const { key: m, ...y } = e;
|
|
195
195
|
return /* @__PURE__ */ I("li", {
|
|
196
196
|
...y,
|
|
197
197
|
children: [
|
|
198
|
-
e["data-active"] !== void 0 && /* @__PURE__ */
|
|
198
|
+
e["data-active"] !== void 0 && /* @__PURE__ */ o("span", {
|
|
199
199
|
"aria-hidden": "true",
|
|
200
200
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
201
201
|
}),
|
|
202
|
-
r ? /* @__PURE__ */
|
|
202
|
+
r ? /* @__PURE__ */ o(ae, {
|
|
203
203
|
dataTest: `${l}-${d(t)}-checkbox`,
|
|
204
204
|
checked: n.selected,
|
|
205
205
|
size: "small",
|
|
206
206
|
hideWrapper: !0,
|
|
207
207
|
decorative: !0
|
|
208
|
-
}) : /* @__PURE__ */
|
|
208
|
+
}) : /* @__PURE__ */ o("span", {
|
|
209
209
|
className: "w-5",
|
|
210
|
-
children: n.selected && /* @__PURE__ */
|
|
210
|
+
children: n.selected && /* @__PURE__ */ o(lt, {
|
|
211
211
|
width: 20,
|
|
212
212
|
height: 20,
|
|
213
213
|
className: "text-gama-500"
|
|
214
214
|
})
|
|
215
215
|
}),
|
|
216
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ o("span", {
|
|
217
217
|
className: "line-clamp-2 min-w-0 flex-1 break-words",
|
|
218
218
|
children: d(t)
|
|
219
219
|
})
|
|
@@ -236,7 +236,7 @@ function Ft({ dataTest: l, options: f, renderInput: ue, value: A, onChange: N, g
|
|
|
236
236
|
id: `${l}-option-${t}`,
|
|
237
237
|
"aria-selected": F(e),
|
|
238
238
|
"aria-disabled": n || void 0,
|
|
239
|
-
"data-active":
|
|
239
|
+
"data-active": s === t ? "" : void 0,
|
|
240
240
|
className: Xe
|
|
241
241
|
}, y = {
|
|
242
242
|
selected: F(e),
|
|
@@ -247,11 +247,11 @@ function Ft({ dataTest: l, options: f, renderInput: ue, value: A, onChange: N, g
|
|
|
247
247
|
};
|
|
248
248
|
return /* @__PURE__ */ I("div", {
|
|
249
249
|
className: E(z.styledSelectAutocompleteWrapper, !Ie && "w-auto", Se, Re),
|
|
250
|
-
children: [ue(Qe), a && /* @__PURE__ */
|
|
250
|
+
children: [ue(Qe), a && /* @__PURE__ */ o(ut, {
|
|
251
251
|
root: re,
|
|
252
252
|
children: /* @__PURE__ */ I("ul", {
|
|
253
253
|
ref: Ve,
|
|
254
|
-
...O ?
|
|
254
|
+
...O ? ot : {},
|
|
255
255
|
style: {
|
|
256
256
|
...O ? nt : {},
|
|
257
257
|
...je,
|
|
@@ -268,39 +268,39 @@ function Ft({ dataTest: l, options: f, renderInput: ue, value: A, onChange: N, g
|
|
|
268
268
|
children: [T && r && /* @__PURE__ */ I("li", {
|
|
269
269
|
id: `${l}-select-all`,
|
|
270
270
|
role: "option",
|
|
271
|
-
"aria-selected":
|
|
272
|
-
"data-active":
|
|
271
|
+
"aria-selected": p.length > 0 && i.length === p.length,
|
|
272
|
+
"data-active": s === -1 ? "" : void 0,
|
|
273
273
|
tabIndex: -1,
|
|
274
274
|
onMouseDown: (e) => e.preventDefault(),
|
|
275
275
|
onClick: j,
|
|
276
276
|
onMouseMove: () => x(null),
|
|
277
277
|
className: "relative flex min-h-12 cursor-pointer items-center gap-x-1 border-0 border-b border-solid border-delta-200 px-4 text-sm text-delta-700 aria-selected:bg-gama-50 hover:bg-delta-50",
|
|
278
278
|
children: [
|
|
279
|
-
|
|
279
|
+
s === -1 && /* @__PURE__ */ o("span", {
|
|
280
280
|
"aria-hidden": "true",
|
|
281
281
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
282
282
|
}),
|
|
283
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ o(ae, {
|
|
284
284
|
dataTest: `${l}-select-all`,
|
|
285
|
-
checked:
|
|
285
|
+
checked: p.length > 0 && i.length === p.length,
|
|
286
286
|
size: "small",
|
|
287
287
|
hideWrapper: !0,
|
|
288
288
|
decorative: !0
|
|
289
289
|
}),
|
|
290
|
-
/* @__PURE__ */
|
|
290
|
+
/* @__PURE__ */ o("span", {
|
|
291
291
|
className: "flex-1 truncate py-2",
|
|
292
292
|
children: De
|
|
293
293
|
})
|
|
294
294
|
]
|
|
295
|
-
}), B ? /* @__PURE__ */
|
|
295
|
+
}), B ? /* @__PURE__ */ o("li", {
|
|
296
296
|
role: "presentation",
|
|
297
297
|
className: "px-3 py-2 text-sm text-delta-600",
|
|
298
|
-
children:
|
|
299
|
-
}) :
|
|
298
|
+
children: fe
|
|
299
|
+
}) : f.length === 0 ? /* @__PURE__ */ o("li", {
|
|
300
300
|
role: "presentation",
|
|
301
301
|
className: "px-3 py-2 text-sm text-delta-600",
|
|
302
302
|
children: me
|
|
303
|
-
}) :
|
|
303
|
+
}) : f.map(Ke)]
|
|
304
304
|
})
|
|
305
305
|
})]
|
|
306
306
|
});
|
|
@@ -15,53 +15,53 @@ var B = ({ className: t }) => /* @__PURE__ */ e("svg", {
|
|
|
15
15
|
fill: "currentColor",
|
|
16
16
|
rx: "0.75"
|
|
17
17
|
})
|
|
18
|
-
}), L = ({ width: t = 11, height: n = 11, className: i = "", onClick:
|
|
18
|
+
}), L = ({ width: t = 11, height: n = 11, className: i = "", onClick: a, color: c }) => /* @__PURE__ */ e("svg", {
|
|
19
19
|
xmlns: "http://www.w3.org/2000/svg",
|
|
20
20
|
width: t,
|
|
21
21
|
height: n,
|
|
22
22
|
viewBox: "0 0 448 512",
|
|
23
23
|
className: i,
|
|
24
|
-
onClick:
|
|
25
|
-
style: N(
|
|
24
|
+
onClick: a,
|
|
25
|
+
style: N(c),
|
|
26
26
|
"aria-hidden": "true",
|
|
27
27
|
focusable: "false",
|
|
28
28
|
children: /* @__PURE__ */ e("path", {
|
|
29
29
|
fill: "currentColor",
|
|
30
30
|
d: "M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7L393.4 105.4c12.5-12.5 32.8-12.5 45.2 0"
|
|
31
31
|
})
|
|
32
|
-
}), z = I(({ checked: t, defaultChecked: n = !1, onChange: i, disabled:
|
|
33
|
-
const [k, x] = b(n), d = t !== void 0,
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
d || x(
|
|
37
|
-
checked:
|
|
38
|
-
name:
|
|
39
|
-
} },
|
|
32
|
+
}), z = I(({ checked: t, defaultChecked: n = !1, onChange: i, disabled: a, readOnly: c, required: m, error: f, id: s, dataTest: u, className: v, onClick: w, ...p }, g) => {
|
|
33
|
+
const [k, x] = b(n), d = t !== void 0, o = d ? t : k, C = (S) => {
|
|
34
|
+
if (c || a) return;
|
|
35
|
+
const l = !o;
|
|
36
|
+
d || x(l), i?.({ target: {
|
|
37
|
+
checked: l,
|
|
38
|
+
name: s
|
|
39
|
+
} }, l), w?.(S);
|
|
40
40
|
}, h = r.iconContent;
|
|
41
41
|
return /* @__PURE__ */ e("button", {
|
|
42
42
|
...p,
|
|
43
43
|
ref: g,
|
|
44
44
|
type: "button",
|
|
45
45
|
role: "switch",
|
|
46
|
-
"aria-checked":
|
|
47
|
-
"aria-readonly":
|
|
46
|
+
"aria-checked": o,
|
|
47
|
+
"aria-readonly": c,
|
|
48
48
|
"aria-required": m,
|
|
49
|
-
className: y(r.switch, v),
|
|
49
|
+
className: y(r.switch, "asma-touch-ready asma-hit-area", v),
|
|
50
50
|
onClick: C,
|
|
51
|
-
disabled:
|
|
52
|
-
id:
|
|
53
|
-
name:
|
|
51
|
+
disabled: a,
|
|
52
|
+
id: s,
|
|
53
|
+
name: s,
|
|
54
54
|
"data-testid": u,
|
|
55
|
-
"data-checked":
|
|
56
|
-
"data-unchecked":
|
|
57
|
-
"data-disabled":
|
|
58
|
-
"data-readonly":
|
|
55
|
+
"data-checked": o ? "" : void 0,
|
|
56
|
+
"data-unchecked": o ? void 0 : "",
|
|
57
|
+
"data-disabled": a ? "" : void 0,
|
|
58
|
+
"data-readonly": c ? "" : void 0,
|
|
59
59
|
"data-error": f ? "" : void 0,
|
|
60
60
|
children: /* @__PURE__ */ e("span", {
|
|
61
61
|
className: r.thumb,
|
|
62
62
|
children: /* @__PURE__ */ e("span", {
|
|
63
63
|
className: r.icon,
|
|
64
|
-
children:
|
|
64
|
+
children: o ? /* @__PURE__ */ e(L, { className: h }) : /* @__PURE__ */ e(B, { className: h })
|
|
65
65
|
})
|
|
66
66
|
})
|
|
67
67
|
});
|
|
@@ -2,9 +2,9 @@ import e from "./StyledLink.module.js";
|
|
|
2
2
|
import t from "clsx";
|
|
3
3
|
import "react";
|
|
4
4
|
import { jsxs as i } from "react/jsx-runtime";
|
|
5
|
-
var
|
|
5
|
+
var u = ({ href: d, disabled: m, size: k = "large", dataTest: n, reflink: y, className: a, content: r, contentNode: s, ...c }) => {
|
|
6
6
|
let l = e["styled-link-large"];
|
|
7
|
-
switch (
|
|
7
|
+
switch (k) {
|
|
8
8
|
case "large":
|
|
9
9
|
l = e["styled-link-large"];
|
|
10
10
|
break;
|
|
@@ -15,19 +15,19 @@ var g = ({ href: d, disabled: k, size: m = "large", dataTest: n, reflink: y, cla
|
|
|
15
15
|
l = e["styled-link-xs"];
|
|
16
16
|
break;
|
|
17
17
|
}
|
|
18
|
-
return
|
|
19
|
-
className: t(e["styled-link"], e["styled-link-disabled"], l,
|
|
20
|
-
children: [
|
|
18
|
+
return m ? /* @__PURE__ */ i("span", {
|
|
19
|
+
className: t(e["styled-link"], e["styled-link-disabled"], l, a),
|
|
20
|
+
children: [r, s]
|
|
21
21
|
}) : /* @__PURE__ */ i("a", {
|
|
22
22
|
...c,
|
|
23
23
|
"data-testid": n,
|
|
24
24
|
ref: y,
|
|
25
25
|
href: d,
|
|
26
26
|
tabIndex: 0,
|
|
27
|
-
className: t(e["styled-link"], l,
|
|
28
|
-
children: [
|
|
27
|
+
className: t(e["styled-link"], "asma-touch-ready", l, a),
|
|
28
|
+
children: [r, s]
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
u as StyledLink
|
|
33
33
|
};
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { cn as w } from "../../../helpers/cn.js";
|
|
2
|
+
import { tabbableWithin as $ } from "../../../helpers/focusable.js";
|
|
3
|
+
import { ClickAwayListener as C } from "../../mui-compat/ClickAwayListener.js";
|
|
4
|
+
import { Children as O, cloneElement as g, createContext as D, isValidElement as B, useCallback as N, useContext as S, useEffect as I, useId as M, useMemo as T, useRef as q, useState as k } from "react";
|
|
5
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
6
|
+
var A = D(null), y = () => {
|
|
7
|
+
const t = S(A);
|
|
7
8
|
if (!t) throw new Error("Listbox.Button/Options/Option must be rendered inside <Listbox>");
|
|
8
9
|
return t;
|
|
9
|
-
}, h = (t,
|
|
10
|
-
function
|
|
11
|
-
const [s,
|
|
12
|
-
|
|
10
|
+
}, h = (t, a) => typeof t == "function" ? t(a) : t;
|
|
11
|
+
function P({ value: t, onChange: a, children: u }) {
|
|
12
|
+
const [s, d] = k(!1), [n, o] = k(null), r = `listbox-${M()}`, p = q(null), l = N(() => {
|
|
13
|
+
d(!1), o(null);
|
|
13
14
|
}, []);
|
|
14
|
-
|
|
15
|
+
I(() => {
|
|
15
16
|
if (!s) return;
|
|
16
|
-
const i = (
|
|
17
|
-
if (
|
|
17
|
+
const i = (b) => {
|
|
18
|
+
if (b.key !== "Escape") return;
|
|
18
19
|
const e = p.current;
|
|
19
|
-
e?.contains(document.activeElement) && e.querySelector('[role="combobox"]')?.focus(),
|
|
20
|
+
e?.contains(document.activeElement) && e.querySelector('[role="combobox"]')?.focus(), l();
|
|
20
21
|
};
|
|
21
22
|
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
22
|
-
}, [s,
|
|
23
|
+
}, [s, l]);
|
|
23
24
|
const f = T(() => ({
|
|
24
25
|
open: s,
|
|
25
26
|
select: (i) => {
|
|
26
|
-
|
|
27
|
+
a(i), l();
|
|
27
28
|
},
|
|
28
|
-
setOpen:
|
|
29
|
+
setOpen: d,
|
|
29
30
|
setActiveIndex: o,
|
|
30
31
|
activeIndex: n,
|
|
31
32
|
listboxId: r,
|
|
@@ -33,52 +34,52 @@ function K({ value: t, onChange: l, children: d }) {
|
|
|
33
34
|
}), [
|
|
34
35
|
s,
|
|
35
36
|
t,
|
|
36
|
-
|
|
37
|
+
a,
|
|
37
38
|
n,
|
|
38
39
|
r,
|
|
39
|
-
|
|
40
|
+
l
|
|
40
41
|
]);
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ m(A.Provider, {
|
|
42
43
|
value: f,
|
|
43
|
-
children: /* @__PURE__ */
|
|
44
|
-
onClickAway:
|
|
45
|
-
children: /* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ m(C, {
|
|
45
|
+
onClickAway: l,
|
|
46
|
+
children: /* @__PURE__ */ m("div", {
|
|
46
47
|
ref: (i) => {
|
|
47
48
|
p.current = i;
|
|
48
49
|
},
|
|
49
50
|
onBlur: (i) => {
|
|
50
|
-
i.relatedTarget && !i.currentTarget.contains(i.relatedTarget) &&
|
|
51
|
+
i.relatedTarget && !i.currentTarget.contains(i.relatedTarget) && l();
|
|
51
52
|
},
|
|
52
53
|
className: "relative w-full",
|
|
53
|
-
children:
|
|
54
|
+
children: u
|
|
54
55
|
})
|
|
55
56
|
})
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
|
-
var
|
|
59
|
-
const { activeIndex: n, listboxId: o, open: r, setActiveIndex: p, setOpen:
|
|
59
|
+
var R = ({ children: t, className: a, onClick: u, onKeyDown: s, ...d }) => {
|
|
60
|
+
const { activeIndex: n, listboxId: o, open: r, setActiveIndex: p, setOpen: l } = y(), f = () => Array.from(document.querySelectorAll(`#${CSS.escape(o)} [role="option"]:not([aria-disabled="true"])`)), i = (e) => {
|
|
60
61
|
const c = f();
|
|
61
62
|
if (c.length === 0) return;
|
|
62
|
-
const
|
|
63
|
-
p(Number(c[
|
|
63
|
+
const x = c.findIndex((L) => L.id === `${o}-option-${n}`), E = x === -1 ? e === 1 ? 0 : c.length - 1 : Math.min(Math.max(x + e, 0), c.length - 1);
|
|
64
|
+
p(Number(c[E].dataset.index));
|
|
65
|
+
}, b = (e) => {
|
|
66
|
+
if (s?.(e), !e.defaultPrevented)
|
|
67
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp")
|
|
68
|
+
e.preventDefault(), r ? i(e.key === "ArrowDown" ? 1 : -1) : (l(!0), requestAnimationFrame(() => i(e.key === "ArrowDown" ? 1 : -1)));
|
|
69
|
+
else if (r && (e.key === "Home" || e.key === "End")) {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
const c = f(), x = c[e.key === "Home" ? 0 : c.length - 1];
|
|
72
|
+
x && p(Number(x.dataset.index));
|
|
73
|
+
} else r && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), f().find((c) => c.id === `${o}-option-${n}`)?.click());
|
|
64
74
|
};
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
...
|
|
75
|
+
return /* @__PURE__ */ m("button", {
|
|
76
|
+
...d,
|
|
67
77
|
type: "button",
|
|
68
|
-
className:
|
|
78
|
+
className: w("asma-pressable", a),
|
|
69
79
|
onClick: (e) => {
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
onKeyDown: (e) => {
|
|
73
|
-
if (s?.(e), !e.defaultPrevented)
|
|
74
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp")
|
|
75
|
-
e.preventDefault(), r ? i(e.key === "ArrowDown" ? 1 : -1) : (a(!0), requestAnimationFrame(() => i(e.key === "ArrowDown" ? 1 : -1)));
|
|
76
|
-
else if (r && (e.key === "Home" || e.key === "End")) {
|
|
77
|
-
e.preventDefault();
|
|
78
|
-
const c = f(), m = c[e.key === "Home" ? 0 : c.length - 1];
|
|
79
|
-
m && p(Number(m.dataset.index));
|
|
80
|
-
} else r && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), f().find((c) => c.id === `${o}-option-${n}`)?.click());
|
|
80
|
+
u?.(e), e.defaultPrevented || l(!r);
|
|
81
81
|
},
|
|
82
|
+
onKeyDown: b,
|
|
82
83
|
role: "combobox",
|
|
83
84
|
"aria-haspopup": "listbox",
|
|
84
85
|
"aria-expanded": r,
|
|
@@ -86,45 +87,45 @@ var N = ({ children: t, className: l, onClick: d, onKeyDown: s, ...u }) => {
|
|
|
86
87
|
"aria-activedescendant": r && n !== null ? `${o}-option-${n}` : void 0,
|
|
87
88
|
children: h(t, { open: r })
|
|
88
89
|
});
|
|
89
|
-
},
|
|
90
|
-
const { activeIndex:
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
}, [
|
|
90
|
+
}, V = ({ children: t, className: a }) => {
|
|
91
|
+
const { activeIndex: u, listboxId: s, open: d } = y();
|
|
92
|
+
return I(() => {
|
|
93
|
+
u !== null && document.getElementById(`${s}-option-${u}`)?.scrollIntoView({ block: "nearest" });
|
|
94
|
+
}, [u, s]), d ? /* @__PURE__ */ m("div", {
|
|
94
95
|
id: s,
|
|
95
96
|
role: "listbox",
|
|
96
|
-
className:
|
|
97
|
+
className: a,
|
|
97
98
|
children: (() => {
|
|
98
99
|
let n = 0;
|
|
99
|
-
return
|
|
100
|
+
return O.toArray(t).map((o) => B(o) && o.type === v ? g(o, { optionIndex: n++ }) : o);
|
|
100
101
|
})()
|
|
101
102
|
}) : null;
|
|
102
103
|
};
|
|
103
|
-
function
|
|
104
|
-
const n =
|
|
105
|
-
|
|
104
|
+
function v({ value: t, disabled: a, children: u, className: s, optionIndex: d = 0 }) {
|
|
105
|
+
const n = y(), o = n.value === t, r = () => {
|
|
106
|
+
a || n.select(t);
|
|
106
107
|
};
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
id: `${n.listboxId}-option-${
|
|
108
|
+
return /* @__PURE__ */ m("div", {
|
|
109
|
+
id: `${n.listboxId}-option-${d}`,
|
|
109
110
|
role: "option",
|
|
110
111
|
"aria-selected": o,
|
|
111
|
-
"aria-disabled":
|
|
112
|
-
"data-index":
|
|
112
|
+
"aria-disabled": a,
|
|
113
|
+
"data-index": d,
|
|
113
114
|
tabIndex: -1,
|
|
114
|
-
className: s,
|
|
115
|
+
className: w("asma-pressable", s),
|
|
115
116
|
onMouseDown: (p) => {
|
|
116
|
-
const
|
|
117
|
-
|
|
117
|
+
const l = p.target;
|
|
118
|
+
$(p.currentTarget).some((f) => f.contains(l)) || p.preventDefault();
|
|
118
119
|
},
|
|
119
120
|
onClick: r,
|
|
120
|
-
children: h(
|
|
121
|
+
children: h(u, { selected: o })
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
|
-
var
|
|
124
|
-
Button:
|
|
125
|
-
Option:
|
|
126
|
-
Options:
|
|
124
|
+
var W = Object.assign(P, {
|
|
125
|
+
Button: R,
|
|
126
|
+
Option: v,
|
|
127
|
+
Options: V
|
|
127
128
|
});
|
|
128
129
|
export {
|
|
129
|
-
|
|
130
|
+
W as Listbox
|
|
130
131
|
};
|
|
@@ -5,22 +5,22 @@ var m = {
|
|
|
5
5
|
base: "text-sm",
|
|
6
6
|
medium: "text-base",
|
|
7
7
|
subtitle: "text-xl"
|
|
8
|
-
},
|
|
8
|
+
}, o = {
|
|
9
9
|
base: 20,
|
|
10
10
|
medium: 24,
|
|
11
11
|
subtitle: 28
|
|
12
|
-
}, f = ({ dataTest: e, children:
|
|
12
|
+
}, f = ({ dataTest: e, children: r, onClick: i, size: t = "base", className: s }) => /* @__PURE__ */ u("button", {
|
|
13
13
|
type: "button",
|
|
14
14
|
"data-test": e,
|
|
15
15
|
"data-testid": e,
|
|
16
|
-
onClick:
|
|
17
|
-
className: n("group flex min-h-11 w-full cursor-pointer items-center rounded border-0 bg-transparent p-0 text-left", "font-semibold text-delta-800 transition-colors duration-300", m[t], "hover:text-gama-500 focus-visible:text-gama-500 active:text-gama-600", "outline-gama-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2", s),
|
|
16
|
+
onClick: i,
|
|
17
|
+
className: n("group flex min-h-11 w-full cursor-pointer items-center rounded border-0 bg-transparent p-0 text-left", "font-semibold text-delta-800 transition-colors duration-300", m[t], "hover:text-gama-500 focus-visible:text-gama-500 active:text-gama-600", "asma-touch-ready", "outline-gama-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2", s),
|
|
18
18
|
children: [/* @__PURE__ */ a("span", {
|
|
19
19
|
className: "min-w-0 truncate",
|
|
20
|
-
children:
|
|
20
|
+
children: r
|
|
21
21
|
}), /* @__PURE__ */ a(l, {
|
|
22
|
-
width:
|
|
23
|
-
height:
|
|
22
|
+
width: o[t],
|
|
23
|
+
height: o[t],
|
|
24
24
|
"aria-hidden": !0,
|
|
25
25
|
className: "shrink-0 transition-transform duration-300 group-hover:translate-x-1 group-focus-visible:translate-x-1"
|
|
26
26
|
})]
|