asma-ui-core 3.86.2 → 3.87.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.
@@ -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 ot } from "../../data-display/chip/StyledChip.js";
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 st, TOP_LAYER_RESET_STYLE as nt, getOpenModalDialogAncestor as at, shouldUsePopoverTopLayer as it, useTopLayerRef as ct } from "../../../hooks/useTopLayer.hook.js";
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 s, jsxs as I } from "react/jsx-runtime";
13
- import { FloatingPortal as ut, autoUpdate as ft, flip as pt, 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";
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: f, renderInput: ue, value: A, onChange: N, getOptionLabel: fe, getOptionKey: C, isOptionEqualToValue: H, renderOption: U, renderValue: V, filterOptions: _, loading: B, loadingText: pe = "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 = fe ?? kt, S = (e, t) => H ? H(e, t) : e === t, [Pe, Le] = D(!1), a = Y ?? Pe, u = (e) => {
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
- }, [o, 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) : "";
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 = [...f];
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
- f,
36
+ p,
37
37
  b,
38
38
  _,
39
39
  A
40
- ]), p = W(() => ee.slice(0, 100), [ee]), te = p.flatMap((e, t) => P(e) ? [] : [t]), c = T && r ? [-1, ...te] : te, k = p.findIndex(F);
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 = o ?? k;
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
- o,
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: ft,
58
+ whileElementsMounted: pt,
59
59
  middleware: [
60
60
  mt(0),
61
- pt({ padding: 8 }),
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
- }, oe = (e) => {
78
+ }, se = (e) => {
79
79
  N?.(e, r ? [] : null, "clear", void 0), $(e, "", "clear");
80
80
  }, j = (e) => {
81
- const t = f.length > 0 && i.length === f.length;
82
- N?.(e, t ? [] : f, t ? "clear" : "selectOption", void 0);
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 === "" && se) {
84
+ if (e.key === "Backspace" && b === "" && oe) {
85
85
  const t = i[i.length - 1];
86
- r ? t !== void 0 && v(e, t, !1) : oe(e);
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" && o === -1)
89
+ else if (e.key === "Enter" && s === -1)
90
90
  e.preventDefault(), j(e);
91
- else if (e.key === "Enter" && o != null && p[o] != null) {
91
+ else if (e.key === "Enter" && s != null && f[s] != null) {
92
92
  e.preventDefault();
93
- const t = p[o];
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 === " " && o === -1)
103
+ else if (e.key === " " && s === -1)
104
104
  e.preventDefault(), j(e);
105
- else if (e.key === " " && o != null && p[o] != null) {
105
+ else if (e.key === " " && s != null && f[s] != null) {
106
106
  e.preventDefault();
107
- const t = p[o];
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
- }, se = !xe && !g && !M && (r ? i.length > 0 : w !== null);
110
+ }, oe = !xe && !g && !M && (r ? i.length > 0 : w !== null);
111
111
  let ne;
112
- a && o != null && (o === -1 || p[o] !== void 0) && (ne = o === -1 ? `${l}-select-all` : `${l}-option-${o}`);
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__ */ s(ot, {
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__ */ s(dt, {
124
+ B && /* @__PURE__ */ o(dt, {
125
125
  width: 20,
126
126
  height: 20,
127
127
  className: "animate-spin"
128
128
  }),
129
- se && /* @__PURE__ */ s("button", {
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: oe,
137
- children: /* @__PURE__ */ s(tt, {
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__ */ s("button", {
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__ */ s(rt, {
152
+ children: ye ?? (r ? /* @__PURE__ */ o(rt, {
153
153
  width: 24,
154
154
  height: 24,
155
155
  className: "text-delta-700"
156
- }) : /* @__PURE__ */ s(et, {
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__ */ s("span", {
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__ */ s(ae, {
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__ */ s("span", {
208
+ }) : /* @__PURE__ */ o("span", {
209
209
  className: "w-5",
210
- children: n.selected && /* @__PURE__ */ s(lt, {
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__ */ s("span", {
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": o === t ? "" : void 0,
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__ */ s(ut, {
250
+ children: [ue(Qe), a && /* @__PURE__ */ o(ut, {
251
251
  root: re,
252
252
  children: /* @__PURE__ */ I("ul", {
253
253
  ref: Ve,
254
- ...O ? st : {},
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": f.length > 0 && i.length === f.length,
272
- "data-active": o === -1 ? "" : void 0,
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
- o === -1 && /* @__PURE__ */ s("span", {
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__ */ s(ae, {
283
+ /* @__PURE__ */ o(ae, {
284
284
  dataTest: `${l}-select-all`,
285
- checked: f.length > 0 && i.length === f.length,
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__ */ s("span", {
290
+ /* @__PURE__ */ o("span", {
291
291
  className: "flex-1 truncate py-2",
292
292
  children: De
293
293
  })
294
294
  ]
295
- }), B ? /* @__PURE__ */ s("li", {
295
+ }), B ? /* @__PURE__ */ o("li", {
296
296
  role: "presentation",
297
297
  className: "px-3 py-2 text-sm text-delta-600",
298
- children: pe
299
- }) : p.length === 0 ? /* @__PURE__ */ s("li", {
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
- }) : p.map(Ke)]
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: c, color: o }) => /* @__PURE__ */ e("svg", {
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: c,
25
- style: N(o),
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: c, readOnly: o, required: m, error: f, id: l, dataTest: u, className: v, onClick: w, ...p }, g) => {
33
- const [k, x] = b(n), d = t !== void 0, a = d ? t : k, C = (S) => {
34
- if (o || c) return;
35
- const s = !a;
36
- d || x(s), i?.({ target: {
37
- checked: s,
38
- name: l
39
- } }, s), w?.(S);
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": a,
47
- "aria-readonly": o,
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: c,
52
- id: l,
53
- name: l,
51
+ disabled: a,
52
+ id: s,
53
+ name: s,
54
54
  "data-testid": u,
55
- "data-checked": a ? "" : void 0,
56
- "data-unchecked": a ? void 0 : "",
57
- "data-disabled": c ? "" : void 0,
58
- "data-readonly": o ? "" : void 0,
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: a ? /* @__PURE__ */ e(L, { className: h }) : /* @__PURE__ */ e(B, { className: h })
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 g = ({ href: d, disabled: k, size: m = "large", dataTest: n, reflink: y, className: r, content: a, contentNode: s, ...c }) => {
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 (m) {
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 k ? /* @__PURE__ */ i("span", {
19
- className: t(e["styled-link"], e["styled-link-disabled"], l, r),
20
- children: [a, s]
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, r),
28
- children: [a, s]
27
+ className: t(e["styled-link"], "asma-touch-ready", l, a),
28
+ children: [r, s]
29
29
  });
30
30
  };
31
31
  export {
32
- g as StyledLink
32
+ u as StyledLink
33
33
  };
@@ -1,31 +1,32 @@
1
- import { tabbableWithin as L } from "../../../helpers/focusable.js";
2
- import { ClickAwayListener as $ } from "../../mui-compat/ClickAwayListener.js";
3
- import { Children as C, cloneElement as D, createContext as O, isValidElement as g, useCallback as B, useContext as S, useEffect as w, useId as M, useMemo as T, useRef as q, useState as k } from "react";
4
- import { jsx as x } from "react/jsx-runtime";
5
- var I = O(null), b = () => {
6
- const t = S(I);
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, l) => typeof t == "function" ? t(l) : t;
10
- function K({ value: t, onChange: l, children: d }) {
11
- const [s, u] = k(!1), [n, o] = k(null), r = `listbox-${M()}`, p = q(null), a = B(() => {
12
- u(!1), o(null);
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
- w(() => {
15
+ I(() => {
15
16
  if (!s) return;
16
- const i = (y) => {
17
- if (y.key !== "Escape") return;
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(), a();
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, a]);
23
+ }, [s, l]);
23
24
  const f = T(() => ({
24
25
  open: s,
25
26
  select: (i) => {
26
- l(i), a();
27
+ a(i), l();
27
28
  },
28
- setOpen: u,
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
- l,
37
+ a,
37
38
  n,
38
39
  r,
39
- a
40
+ l
40
41
  ]);
41
- return /* @__PURE__ */ x(I.Provider, {
42
+ return /* @__PURE__ */ m(A.Provider, {
42
43
  value: f,
43
- children: /* @__PURE__ */ x($, {
44
- onClickAway: a,
45
- children: /* @__PURE__ */ x("div", {
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) && a();
51
+ i.relatedTarget && !i.currentTarget.contains(i.relatedTarget) && l();
51
52
  },
52
53
  className: "relative w-full",
53
- children: d
54
+ children: u
54
55
  })
55
56
  })
56
57
  });
57
58
  }
58
- var N = ({ children: t, className: l, onClick: d, onKeyDown: s, ...u }) => {
59
- const { activeIndex: n, listboxId: o, open: r, setActiveIndex: p, setOpen: a } = b(), f = () => Array.from(document.querySelectorAll(`#${CSS.escape(o)} [role="option"]:not([aria-disabled="true"])`)), i = (e) => {
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 m = c.findIndex((E) => E.id === `${o}-option-${n}`), v = m === -1 ? e === 1 ? 0 : c.length - 1 : Math.min(Math.max(m + e, 0), c.length - 1);
63
- p(Number(c[v].dataset.index));
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__ */ x("button", {
66
- ...u,
75
+ return /* @__PURE__ */ m("button", {
76
+ ...d,
67
77
  type: "button",
68
- className: l,
78
+ className: w("asma-pressable", a),
69
79
  onClick: (e) => {
70
- d?.(e), e.defaultPrevented || a(!r);
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
- }, P = ({ children: t, className: l }) => {
90
- const { activeIndex: d, listboxId: s, open: u } = b();
91
- return w(() => {
92
- d !== null && document.getElementById(`${s}-option-${d}`)?.scrollIntoView({ block: "nearest" });
93
- }, [d, s]), u ? /* @__PURE__ */ x("div", {
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: l,
97
+ className: a,
97
98
  children: (() => {
98
99
  let n = 0;
99
- return C.toArray(t).map((o) => g(o) && o.type === A ? D(o, { optionIndex: n++ }) : o);
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 A({ value: t, disabled: l, children: d, className: s, optionIndex: u = 0 }) {
104
- const n = b(), o = n.value === t, r = () => {
105
- l || n.select(t);
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__ */ x("div", {
108
- id: `${n.listboxId}-option-${u}`,
108
+ return /* @__PURE__ */ m("div", {
109
+ id: `${n.listboxId}-option-${d}`,
109
110
  role: "option",
110
111
  "aria-selected": o,
111
- "aria-disabled": l,
112
- "data-index": u,
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 a = p.target;
117
- L(p.currentTarget).some((f) => f.contains(a)) || p.preventDefault();
117
+ const l = p.target;
118
+ $(p.currentTarget).some((f) => f.contains(l)) || p.preventDefault();
118
119
  },
119
120
  onClick: r,
120
- children: h(d, { selected: o })
121
+ children: h(u, { selected: o })
121
122
  });
122
123
  }
123
- var H = Object.assign(K, {
124
- Button: N,
125
- Option: A,
126
- Options: P
124
+ var W = Object.assign(P, {
125
+ Button: R,
126
+ Option: v,
127
+ Options: V
127
128
  });
128
129
  export {
129
- H as Listbox
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
- }, i = {
8
+ }, o = {
9
9
  base: 20,
10
10
  medium: 24,
11
11
  subtitle: 28
12
- }, f = ({ dataTest: e, children: o, onClick: r, size: t = "base", className: s }) => /* @__PURE__ */ u("button", {
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: r,
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: o
20
+ children: r
21
21
  }), /* @__PURE__ */ a(l, {
22
- width: i[t],
23
- height: i[t],
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
  })]