asma-ui-core 3.73.1 → 3.74.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.
@@ -1,4 +1,4 @@
1
- import { cn as L } from "../../../helpers/cn.js";
1
+ import { cn as k } from "../../../helpers/cn.js";
2
2
  import { ChevronDownIcon as Oe } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
3
3
  import { CloseIcon as Be } from "../../icons/close-icon/CloseIcon.js";
4
4
  import { CheckIcon as qe } from "../../icons/check-icon/CheckIcon.js";
@@ -8,17 +8,17 @@ import { StyledCheckbox as Q } from "../checkbox/base-ui/StyledCheckbox.js";
8
8
  import { TOP_LAYER_PROPS as Qe, TOP_LAYER_RESET_STYLE as Xe, getOpenModalDialogAncestor as Ze, shouldUsePopoverTopLayer as Ke, useTopLayerRef as et } from "../../../hooks/useTopLayer.hook.js";
9
9
  import { LoadingIcon as tt } from "../../../table/shared-components/LoadingIcon.js";
10
10
  import _ from "./StyledSelectAutocomplete.module.js";
11
- import { useEffect as rt, useMemo as E, useRef as X, useState as w } from "react";
11
+ import { useEffect as lt, useMemo as E, useRef as X, useState as w } from "react";
12
12
  import { jsx as s, jsxs as y } from "react/jsx-runtime";
13
- import { FloatingPortal as lt, autoUpdate as st, flip as ot, offset as at, shift as nt, size as ct, useDismiss as it, useFloating as dt, useInteractions as ut, useMergeRefs as Z, useRole as pt } from "@floating-ui/react";
14
- var mt = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), K = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
15
- function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, getOptionLabel: te, getOptionKey: R, isOptionEqualToValue: j, renderOption: z, renderValue: F, filterOptions: $, loading: W, loadingText: re = "Loading…", noOptionsText: le = "No options", disabled: D, readOnly: m, error: se, helperText: oe, size: ae = "small", disableClearable: ne, disableCloseOnSelect: ce, popupIcon: ie, autoHeight: de, multiple: ue, allowSelectAll: pe, selectAllLabel: U = "Select all", fullWidth: me, classes: fe, inputValue: S, onInputChange: he, open: T, onOpen: ge, onClose: be, className: xe, wrapperClassName: we, getOptionDisabled: ye, slotProps: V }) {
13
+ import { FloatingPortal as rt, autoUpdate as st, flip as ot, offset as at, shift as nt, size as ct, useDismiss as it, useFloating as dt, useInteractions as ut, useMergeRefs as Z, useRole as pt } from "@floating-ui/react";
14
+ var mt = (r) => typeof r == "object" && r !== null && "label" in r ? String(r.label) : String(r), K = (r) => typeof r == "object" && r !== null && "disabled" in r && !!r.disabled;
15
+ function Pt({ dataTest: r, options: p, renderInput: ee, value: v, onChange: N, getOptionLabel: te, getOptionKey: R, isOptionEqualToValue: j, renderOption: z, renderValue: F, filterOptions: L, loading: W, loadingText: le = "Loading…", noOptionsText: re = "No options", disabled: D, readOnly: m, error: se, helperText: oe, size: ae = "small", disableClearable: ne, disableCloseOnSelect: ce, popupIcon: ie, autoHeight: de, multiple: ue, allowSelectAll: pe, selectAllLabel: U = "Select all", fullWidth: me, classes: fe, inputValue: S, onInputChange: he, open: T, onOpen: ge, onClose: be, className: xe, wrapperClassName: we, getOptionDisabled: ye, slotProps: V }) {
16
16
  const o = ue === !0, n = te ?? mt, C = (e, t) => j ? j(e, t) : e === t, [ve, Ne] = w(!1), a = T ?? ve, f = (e) => {
17
17
  e && (m || D) || (T === void 0 && Ne(e), e ? ge?.() : be?.());
18
- }, [Re, H] = w(""), h = S ?? Re, P = (e, t, r) => {
19
- S === void 0 && H(t), he?.(e, t, r);
20
- }, [b, k] = w(null), De = X([]), Y = X(null), [Se, Ce] = w(null), [Pe, Ae] = w(null), c = o ? Array.isArray(v) ? v : [] : [], g = o ? null : v ?? null, O = !o && g !== null ? n(g) : "";
21
- rt(() => {
18
+ }, [Re, H] = w(""), h = S ?? Re, P = (e, t, l) => {
19
+ S === void 0 && H(t), he?.(e, t, l);
20
+ }, [b, $] = w(null), De = X([]), Y = X(null), [Se, Ce] = w(null), [Pe, Ae] = w(null), c = o ? Array.isArray(v) ? v : [] : [], g = o ? null : v ?? null, O = !o && g !== null ? n(g) : "";
21
+ lt(() => {
22
22
  S !== void 0 || o || H(O);
23
23
  }, [
24
24
  S,
@@ -27,17 +27,17 @@ function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, g
27
27
  ]);
28
28
  const B = (e) => o ? c.some((t) => C(e, t)) : g !== null && C(e, g), q = E(() => {
29
29
  const e = [...p];
30
- if ($) return $(e, { inputValue: h });
30
+ if (L) return L(e, { inputValue: h });
31
31
  const t = !o && g !== null ? n(g).toLowerCase() : null;
32
32
  if (!h || h.toLowerCase() === t) return e;
33
- const r = h.toLowerCase();
34
- return e.filter((d) => n(d).toLowerCase().includes(r));
33
+ const l = h.toLowerCase();
34
+ return e.filter((d) => n(d).toLowerCase().includes(l));
35
35
  }, [
36
36
  p,
37
37
  h,
38
- $,
38
+ L,
39
39
  v
40
- ]), i = E(() => q.slice(0, 100), [q]), { refs: A, floatingStyles: Le, context: G } = dt({
40
+ ]), i = E(() => q.slice(0, 100), [q]), { refs: A, floatingStyles: ke, context: G } = dt({
41
41
  open: a,
42
42
  onOpenChange: f,
43
43
  placement: "bottom-start",
@@ -51,10 +51,10 @@ function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, g
51
51
  Ce(e.reference.width), Ae(de ? t - 8 : Math.min(t - 8, 320));
52
52
  } })
53
53
  ]
54
- }), { getReferenceProps: $e, getFloatingProps: ke, getItemProps: Ie } = ut([it(G), pt(G, { role: "listbox" })]), Me = Z([A.setReference]), J = E(() => a ? Ze(A.reference.current) : void 0, [a, A]), I = Ke(J), _e = Z([et(A.setFloating, I)]), M = (e, t) => {
54
+ }), { getReferenceProps: Le, getFloatingProps: $e, getItemProps: Ie } = ut([it(G), pt(G, { role: "listbox" })]), Me = Z([A.setReference]), J = E(() => a ? Ze(A.reference.current) : void 0, [a, A]), I = Ke(J), _e = Z([et(A.setFloating, I)]), M = (e, t) => {
55
55
  if (o) {
56
- const r = c.some((u) => C(t, u)), d = r ? c.filter((u) => !C(t, u)) : [...c, t];
57
- N?.(e, d, r ? "removeOption" : "selectOption", { option: t }), P(e, "", "reset"), ce || f(!1);
56
+ const l = c.some((u) => C(t, u)), d = l ? c.filter((u) => !C(t, u)) : [...c, t];
57
+ N?.(e, d, l ? "removeOption" : "selectOption", { option: t }), P(e, "", "reset"), ce || f(!1);
58
58
  } else
59
59
  N?.(e, t, "selectOption", { option: t }), P(e, n(t), "reset"), f(!1);
60
60
  }, Ee = (e) => {
@@ -66,12 +66,12 @@ function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, g
66
66
  K(t) || M(e, t);
67
67
  } else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
68
68
  if (e.preventDefault(), !a) {
69
- k(null), f(!0);
69
+ $(null), f(!0);
70
70
  return;
71
71
  }
72
72
  if (i.length === 0) return;
73
73
  const t = e.key === "ArrowDown" ? 1 : -1;
74
- k((r) => r == null ? t > 0 ? 0 : i.length - 1 : (r + t + i.length) % i.length);
74
+ $((l) => l == null ? t > 0 ? 0 : i.length - 1 : (l + t + i.length) % i.length);
75
75
  }
76
76
  }, ze = !ne && !m && !D && (o ? c.length > 0 : g !== null), Fe = (e) => {
77
77
  e.preventDefault(), !(D || m) && (Y.current?.focus(), f(!a));
@@ -79,7 +79,7 @@ function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, g
79
79
  dataTest: `selected-chip-${n(e)}`,
80
80
  label: n(e),
81
81
  readOnly: m,
82
- onDelete: m ? void 0 : (r) => M(r, e)
82
+ onDelete: m ? void 0 : (l) => M(l, e)
83
83
  }, R ? R(e) : `${n(e)}-${t}`)) : void 0, Ue = /* @__PURE__ */ y("span", {
84
84
  className: "flex items-center gap-1",
85
85
  children: [
@@ -91,7 +91,7 @@ function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, g
91
91
  ze && /* @__PURE__ */ s("button", {
92
92
  type: "button",
93
93
  "aria-label": "Clear",
94
- "data-testid": `${l}-clear`,
94
+ "data-testid": `${r}-clear`,
95
95
  className: "flex min-h-6 min-w-6 cursor-pointer items-center justify-center rounded-full border-0 bg-delta-50",
96
96
  onMouseDown: (e) => {
97
97
  e.preventDefault(), Ee(e);
@@ -106,7 +106,7 @@ function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, g
106
106
  type: "button",
107
107
  "aria-label": "Toggle options",
108
108
  "aria-expanded": a,
109
- "data-testid": `${l}-popup-indicator`,
109
+ "data-testid": `${r}-popup-indicator`,
110
110
  className: "flex cursor-pointer items-center border-0 bg-transparent",
111
111
  onMouseDown: Fe,
112
112
  children: ie ?? (o ? /* @__PURE__ */ s(Ge, {
@@ -116,7 +116,7 @@ function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, g
116
116
  }) : /* @__PURE__ */ s(Oe, {
117
117
  width: 24,
118
118
  height: 24,
119
- className: L(_["select-custom-icon"], a && _["select-custom-icon-open"], "text-delta-700")
119
+ className: k(_["select-custom-icon"], a && _["select-custom-icon-open"], "text-delta-700")
120
120
  }))
121
121
  })
122
122
  ]
@@ -133,13 +133,13 @@ function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, g
133
133
  onKeyDown: je,
134
134
  slotProps: {
135
135
  htmlInput: {
136
- ...$e(),
136
+ ...Le(),
137
137
  ref: Y,
138
138
  onClick: () => f(!0),
139
139
  role: "combobox",
140
140
  "aria-autocomplete": "list",
141
141
  "aria-expanded": a,
142
- "aria-activedescendant": a && b != null ? `${l}-option-${b}` : void 0,
142
+ "aria-activedescendant": a && b != null ? `${r}-option-${b}` : void 0,
143
143
  autoComplete: "off",
144
144
  readOnly: m
145
145
  },
@@ -149,45 +149,45 @@ function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, g
149
149
  endAdornment: Ue
150
150
  }
151
151
  }
152
- }, Ve = L("box-border flex min-h-10 cursor-pointer items-center gap-x-3 px-3 py-1.5 text-base text-delta-800 first:-mt-1", "aria-selected:bg-gama-50 data-[active]:bg-gama-50 data-[active]:text-delta-800", "aria-disabled:cursor-default aria-disabled:!bg-transparent aria-disabled:text-delta-300", o && "border-0 border-b border-solid border-delta-200"), He = (e, t, r) => {
152
+ }, Ve = k("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 data-[active]:bg-gama-50 data-[active]:text-delta-800", "aria-disabled:cursor-default aria-disabled:!bg-transparent aria-disabled:text-delta-300", "border-0 border-b border-solid border-delta-200 last:border-b-0"), He = (e, t, l) => {
153
153
  const { key: d, ...u } = e;
154
154
  return /* @__PURE__ */ y("li", {
155
155
  ...u,
156
156
  children: [o ? /* @__PURE__ */ s(Q, {
157
- dataTest: `${l}-${n(t)}-checkbox`,
158
- checked: r.selected,
157
+ dataTest: `${r}-${n(t)}-checkbox`,
158
+ checked: l.selected,
159
159
  size: "small",
160
160
  hideWrapper: !0,
161
161
  decorative: !0
162
162
  }) : /* @__PURE__ */ s("span", {
163
163
  className: "w-5",
164
- children: r.selected && /* @__PURE__ */ s(qe, {
164
+ children: l.selected && /* @__PURE__ */ s(qe, {
165
165
  width: 20,
166
166
  height: 20,
167
167
  className: "text-gama-500"
168
168
  })
169
169
  }), /* @__PURE__ */ s("span", {
170
- className: "flex-1 truncate",
170
+ className: "line-clamp-2 min-w-0 flex-1 break-words",
171
171
  children: n(t)
172
172
  })]
173
173
  }, d);
174
174
  }, Ye = (e, t) => {
175
- const r = ye?.(e) ?? K(e), d = {
175
+ const l = ye?.(e) ?? K(e), d = {
176
176
  ...Ie({
177
177
  onMouseDown: (x) => x.preventDefault(),
178
178
  onClick: (x) => {
179
- r || M(x, e);
179
+ l || M(x, e);
180
180
  },
181
- onMouseMove: () => k(r ? null : t)
181
+ onMouseMove: () => $(l ? null : t)
182
182
  }),
183
183
  key: R ? String(R(e)) : `${n(e)}-${t}`,
184
184
  ref: (x) => {
185
185
  De.current[t] = x;
186
186
  },
187
187
  role: "option",
188
- id: `${l}-option-${t}`,
188
+ id: `${r}-option-${t}`,
189
189
  "aria-selected": B(e),
190
- "aria-disabled": r || void 0,
190
+ "aria-disabled": l || void 0,
191
191
  "data-active": b === t ? "" : void 0,
192
192
  className: Ve
193
193
  }, u = {
@@ -198,27 +198,27 @@ function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, g
198
198
  return z ? z(d, e, u) : He(d, e, u);
199
199
  };
200
200
  return /* @__PURE__ */ y("div", {
201
- className: L(_.styledSelectAutocompleteWrapper, !me && "w-auto", we, xe),
202
- children: [ee(Te), a && /* @__PURE__ */ s(lt, {
201
+ className: k(_.styledSelectAutocompleteWrapper, !me && "w-auto", we, xe),
202
+ children: [ee(Te), a && /* @__PURE__ */ s(rt, {
203
203
  root: J,
204
204
  children: /* @__PURE__ */ y("ul", {
205
205
  ref: _e,
206
206
  ...I ? Qe : {},
207
207
  style: {
208
208
  ...I ? Xe : {},
209
- ...Le,
209
+ ...ke,
210
210
  width: Se ?? void 0,
211
211
  maxHeight: Pe ?? void 0,
212
212
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
213
213
  ...V?.popper?.style
214
214
  },
215
- ...ke(),
216
- className: L("z-[1300] m-0 list-none overflow-auto rounded-lg border border-solid border-delta-300 bg-white p-0 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", fe?.listbox, V?.popper?.className),
215
+ ...$e(),
216
+ className: k("z-[1300] m-0 list-none overflow-auto rounded-lg border border-solid border-delta-300 bg-white px-0 py-2 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", fe?.listbox, V?.popper?.className),
217
217
  children: [pe && o && /* @__PURE__ */ y("div", {
218
218
  role: "group",
219
219
  className: "flex min-h-12 items-center gap-x-1 border-0 border-b border-solid border-delta-200 px-4 text-sm text-delta-700",
220
220
  children: [/* @__PURE__ */ s(Q, {
221
- dataTest: `${l}-select-all`,
221
+ dataTest: `${r}-select-all`,
222
222
  "aria-label": U,
223
223
  checked: p.length > 0 && c.length === p.length,
224
224
  size: "small",
@@ -235,11 +235,11 @@ function Pt({ dataTest: l, options: p, renderInput: ee, value: v, onChange: N, g
235
235
  }), W ? /* @__PURE__ */ s("li", {
236
236
  role: "presentation",
237
237
  className: "px-3 py-2 text-sm text-delta-600",
238
- children: re
238
+ children: le
239
239
  }) : i.length === 0 ? /* @__PURE__ */ s("li", {
240
240
  role: "presentation",
241
241
  className: "px-3 py-2 text-sm text-delta-600",
242
- children: le
242
+ children: re
243
243
  }) : i.map(Ye)]
244
244
  })
245
245
  })]
@@ -1,61 +1,58 @@
1
- import { cn as n } from "../../../helpers/cn.js";
2
- import { ErrorOutlineIcon as et } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
3
- import { useHelperAlertRole as lt } from "../../../helpers/useHelperAlertRole.js";
4
- import { warnMissingErrorMessage as at } from "../../../helpers/warnMissingErrorMessage.js";
5
- import y from "./StyledSlider.module.js";
6
- import { useId as rt, useState as ot } from "react";
7
- import { jsx as m, jsxs as M } from "react/jsx-runtime";
8
- var D = (c, e, o) => o === e ? 0 : Math.min(100, Math.max(0, (c - e) / (o - e) * 100)), nt = (c) => Array.isArray(c) ? [c[0] ?? 0, c[1] ?? 0] : null, mt = ({ dataTest: c, min: e = 0, max: o = 100, step: p = 1, value: H, defaultValue: X, disabled: v, size: L = "medium", orientation: U = "horizontal", marks: w, name: Y, className: q, classes: u, slotProps: S, error: b, errorText: G, helperText: _, reserveHelperText: J = !0, ariaLabel: x, ariaLabelledBy: Q, onChange: j, onChangeCommitted: B }) => {
9
- const E = rt(), a = U === "vertical", d = L === "small" ? 6 : 8, [W, Z] = ot(X ?? e), A = H ?? W, i = nt(A), f = i !== null, $ = b ? G ?? _ : _, V = J || $ != null || !!b;
10
- at("StyledSlider", b, $);
11
- const C = lt(b), P = (w === !0 && Number.isFinite(p) && p > 0 && o > e ? Array.from({ length: Math.floor((o - e) / p) + 1 }, (t, l) => ({ value: e + p * l })) : Array.isArray(w) ? w : []).filter((t) => t.value >= e && t.value <= o), k = f ? Math.min(i[0], i[1]) : e, R = f ? Math.max(i[0], i[1]) : A, F = (t) => f ? t >= k && t <= R : t <= R, T = f ? D(k, e, o) : 0, K = D(R, e, o) - T, I = a ? {
12
- bottom: `${T}%`,
13
- height: `${K}%`
1
+ import { cn as i } from "../../../helpers/cn.js";
2
+ import { HelperRow as et } from "../../../helpers/HelperRow.js";
3
+ import { useHelperSlot as lt } from "../../../helpers/useHelperSlot.js";
4
+ import g from "./StyledSlider.module.js";
5
+ import { useId as at, useState as rt } from "react";
6
+ import { jsx as p, jsxs as H } from "react/jsx-runtime";
7
+ var T = (c, e, o) => o === e ? 0 : Math.min(100, Math.max(0, (c - e) / (o - e) * 100)), ot = (c) => Array.isArray(c) ? [c[0] ?? 0, c[1] ?? 0] : null, ft = ({ dataTest: c, min: e = 0, max: o = 100, step: b = 1, value: z, defaultValue: E, disabled: v, size: D = "medium", orientation: L = "horizontal", marks: w, name: G, className: J, classes: u, slotProps: M, error: y, errorText: O, helperText: U, reserveHelperText: Q, ariaLabel: S, ariaLabelledBy: W, onChange: _, onChangeCommitted: j }) => {
8
+ const V = at(), a = L === "vertical", d = D === "small" ? 6 : 8, [Z, k] = rt(E ?? e), A = z ?? Z, n = ot(A), f = n !== null, B = y ? O ?? U : U, { show: F, role: C } = lt("StyledSlider", y, B, Q), $ = (w === !0 && Number.isFinite(b) && b > 0 && o > e ? Array.from({ length: Math.floor((o - e) / b) + 1 }, (t, l) => ({ value: e + b * l })) : Array.isArray(w) ? w : []).filter((t) => t.value >= e && t.value <= o), K = f ? Math.min(n[0], n[1]) : e, x = f ? Math.max(n[0], n[1]) : A, X = (t) => f ? t >= K && t <= x : t <= x, P = f ? T(K, e, o) : 0, Y = T(x, e, o) - P, I = a ? {
9
+ bottom: `${P}%`,
10
+ height: `${Y}%`
14
11
  } : {
15
- left: `${T}%`,
16
- width: `${K}%`
17
- }, O = (t) => {
18
- const l = D(t, e, o);
12
+ left: `${P}%`,
13
+ width: `${Y}%`
14
+ }, q = (t) => {
15
+ const l = T(t, e, o);
19
16
  return a ? { bottom: `${l}%` } : { left: `${l}%` };
20
17
  }, tt = (t) => {
21
18
  if (v) return;
22
- const l = t.currentTarget.getBoundingClientRect(), r = a ? 1 - (t.clientY - l.top) / l.height : (t.clientX - l.left) / l.width, g = e + Math.round(Math.min(1, Math.max(0, r)) * ((o - e) / p)) * p, h = Math.min(o, Math.max(e, g));
23
- N(j, t, h, f && Math.abs((i?.[1] ?? e) - h) < Math.abs((i?.[0] ?? e) - h) ? 1 : 0);
24
- }, N = (t, l, r, g) => {
19
+ const l = t.currentTarget.getBoundingClientRect(), r = a ? 1 - (t.clientY - l.top) / l.height : (t.clientX - l.left) / l.width, m = e + Math.round(Math.min(1, Math.max(0, r)) * ((o - e) / b)) * b, h = Math.min(o, Math.max(e, m));
20
+ N(_, t, h, f && Math.abs((n?.[1] ?? e) - h) < Math.abs((n?.[0] ?? e) - h) ? 1 : 0);
21
+ }, N = (t, l, r, m) => {
25
22
  let h = r;
26
23
  if (!f) h = r;
27
24
  else {
28
- const s = [i?.[0] ?? 0, i?.[1] ?? 0];
29
- s[g] = r, g === 0 && s[0] > s[1] && (s[0] = s[1]), g === 1 && s[1] < s[0] && (s[1] = s[0]), h = s;
25
+ const s = [n?.[0] ?? 0, n?.[1] ?? 0];
26
+ s[m] = r, m === 0 && s[0] > s[1] && (s[0] = s[1]), m === 1 && s[1] < s[0] && (s[1] = s[0]), h = s;
30
27
  }
31
- H === void 0 && Z(h), t && t(l, h, g);
32
- }, z = (t, l) => /* @__PURE__ */ m("input", {
28
+ z === void 0 && k(h), t && t(l, h, m);
29
+ }, R = (t, l) => /* @__PURE__ */ p("input", {
33
30
  type: "range",
34
31
  "data-testid": f ? `${c}-thumb-${t}` : c,
35
- name: Y,
32
+ name: G,
36
33
  min: e,
37
34
  max: o,
38
- step: p,
35
+ step: b,
39
36
  value: l,
40
37
  disabled: v,
41
- "aria-orientation": U,
42
- "aria-label": typeof x == "function" ? x(t) : x,
43
- "aria-labelledby": Q,
44
- "aria-invalid": b ? !0 : void 0,
45
- "aria-describedby": V ? E : void 0,
46
- className: n(y.SliderInput, a ? y.Vertical : y.Horizontal, !a && "z-0", L === "small" && y.Small, v && y.Disabled, u?.thumb, S?.thumb?.className),
47
- onChange: (r) => N(j, r, Number(r.currentTarget.value), t),
48
- onPointerUp: (r) => N(B, r, Number(r.currentTarget.value), t),
49
- onKeyUp: (r) => N(B, r, Number(r.currentTarget.value), t)
38
+ "aria-orientation": L,
39
+ "aria-label": typeof S == "function" ? S(t) : S,
40
+ "aria-labelledby": W,
41
+ "aria-invalid": y ? !0 : void 0,
42
+ "aria-describedby": F ? V : void 0,
43
+ className: i(g.SliderInput, a ? g.Vertical : g.Horizontal, !a && "z-0", D === "small" && g.Small, v && g.Disabled, u?.thumb, M?.thumb?.className),
44
+ onChange: (r) => N(_, r, Number(r.currentTarget.value), t),
45
+ onPointerUp: (r) => N(j, r, Number(r.currentTarget.value), t),
46
+ onKeyUp: (r) => N(j, r, Number(r.currentTarget.value), t)
50
47
  }, t);
51
- return /* @__PURE__ */ M("div", {
52
- className: n("relative flex", a ? "h-full w-8 flex-col items-center" : "mt-px w-full flex-col", u?.root, q),
48
+ return /* @__PURE__ */ H("div", {
49
+ className: i("relative flex", a ? "h-full w-8 flex-col items-center" : "mt-px w-full flex-col", u?.root, J),
53
50
  children: [
54
- /* @__PURE__ */ M("div", {
55
- className: n("relative", a ? "h-full w-8" : "h-4 w-full"),
56
- children: [/* @__PURE__ */ M("div", {
51
+ /* @__PURE__ */ H("div", {
52
+ className: i("relative", a ? "h-full w-8" : "h-4 w-full"),
53
+ children: [/* @__PURE__ */ H("div", {
57
54
  onPointerDown: tt,
58
- className: n("absolute", a ? "left-1/2 w-1 -translate-x-1/2" : "top-[calc(50%+6px)] h-1 -translate-y-1/2"),
55
+ className: i("absolute", a ? "left-1/2 w-1 -translate-x-1/2" : "top-[calc(50%+6px)] h-1 -translate-y-1/2"),
59
56
  style: a ? {
60
57
  top: d,
61
58
  bottom: d
@@ -64,23 +61,23 @@ var D = (c, e, o) => o === e ? 0 : Math.min(100, Math.max(0, (c - e) / (o - e) *
64
61
  right: d
65
62
  },
66
63
  children: [
67
- /* @__PURE__ */ m("div", { className: n("absolute inset-0 rounded-full bg-delta-100", u?.rail, S?.rail?.className) }),
68
- /* @__PURE__ */ m("div", {
69
- className: n("absolute rounded-full", a ? "left-0 w-full" : "top-0 h-full", v ? "bg-delta-200" : "bg-gama-500", u?.track),
64
+ /* @__PURE__ */ p("div", { className: i("absolute inset-0 rounded-full bg-delta-100", u?.rail, M?.rail?.className) }),
65
+ /* @__PURE__ */ p("div", {
66
+ className: i("absolute rounded-full", a ? "left-0 w-full" : "top-0 h-full", v ? "bg-delta-200" : "bg-gama-500", u?.track),
70
67
  style: I
71
68
  }),
72
- P.map((t) => {
73
- const l = F(t.value);
74
- return /* @__PURE__ */ m("span", {
75
- className: n("absolute z-10 box-border h-2 w-2 -translate-x-1/2 rounded-full border border-solid", a ? "left-1/2 translate-y-1/2" : "top-1/2 -translate-y-1/2", l ? n(v ? "border-delta-200 bg-delta-200" : "border-gama-500 bg-gama-500", u?.markActive) : n("border-delta-300 bg-white", u?.mark)),
76
- style: O(t.value)
69
+ $.map((t) => {
70
+ const l = X(t.value);
71
+ return /* @__PURE__ */ p("span", {
72
+ className: i("absolute z-10 box-border h-2 w-2 -translate-x-1/2 rounded-full border border-solid", a ? "left-1/2 translate-y-1/2" : "top-1/2 -translate-y-1/2", l ? i(v ? "border-delta-200 bg-delta-200" : "border-gama-500 bg-gama-500", u?.markActive) : i("border-delta-300 bg-white", u?.mark)),
73
+ style: q(t.value)
77
74
  }, t.value);
78
75
  })
79
76
  ]
80
- }), f ? [z(0, i[0]), z(1, i[1])] : z(0, A)]
77
+ }), f ? [R(0, n[0]), R(1, n[1])] : R(0, A)]
81
78
  }),
82
- P.some((t) => t.label != null) && /* @__PURE__ */ m("div", {
83
- className: n(a ? "pointer-events-none absolute inset-x-0" : "relative mt-[14px] h-6"),
79
+ $.some((t) => t.label != null) && /* @__PURE__ */ p("div", {
80
+ className: i(a ? "pointer-events-none absolute inset-x-0" : "relative mt-[14px] h-6"),
84
81
  style: a ? {
85
82
  top: d,
86
83
  bottom: d
@@ -88,25 +85,22 @@ var D = (c, e, o) => o === e ? 0 : Math.min(100, Math.max(0, (c - e) / (o - e) *
88
85
  marginLeft: d,
89
86
  marginRight: d
90
87
  },
91
- children: P.map((t) => t.label == null ? null : /* @__PURE__ */ m("span", {
92
- className: n("absolute text-base font-semibold text-delta-700", a ? "left-[37px] translate-y-1/2" : "-translate-x-1/2", F(t.value) && u?.markLabelActive, u?.markLabel, S?.markLabel?.className),
93
- style: O(t.value),
88
+ children: $.map((t) => t.label == null ? null : /* @__PURE__ */ p("span", {
89
+ className: i("absolute text-base font-semibold text-delta-700", a ? "left-[37px] translate-y-1/2" : "-translate-x-1/2", X(t.value) && u?.markLabelActive, u?.markLabel, M?.markLabel?.className),
90
+ style: q(t.value),
94
91
  children: t.label
95
92
  }, t.value))
96
93
  }),
97
- V && /* @__PURE__ */ M("div", {
98
- id: E,
94
+ F && /* @__PURE__ */ p(et, {
95
+ id: V,
99
96
  role: C,
100
- className: n("m-0 flex min-h-[24px] items-center gap-1 pt-1 text-sm leading-5 tracking-[0.03333em]", b ? "text-error-500" : "text-delta-600"),
101
- children: [b && /* @__PURE__ */ m(et, {
102
- width: 20,
103
- height: 20,
104
- className: "min-w-5 shrink-0"
105
- }), /* @__PURE__ */ m("span", { children: $ })]
97
+ error: y,
98
+ message: B,
99
+ className: "m-0 items-center"
106
100
  })
107
101
  ]
108
102
  });
109
103
  };
110
104
  export {
111
- mt as StyledSlider
105
+ ft as StyledSlider
112
106
  };
@@ -1,77 +1,74 @@
1
- import { useHelperAlertRole as Q } from "../../../helpers/useHelperAlertRole.js";
2
- import { warnMissingErrorMessage as U } from "../../../helpers/warnMissingErrorMessage.js";
3
- import a from "./StyledTextarea.module.js";
4
- import { useEffect as V, useId as m, useRef as W } from "react";
5
- import { Fragment as X, jsx as o, jsxs as c } from "react/jsx-runtime";
6
- var at = ({ id: M, variant: x = "active", label: d = "", labelClassName: S = "", description: l = "", reserveHelperText: j = !0, value: e = "", minRows: r = 3, maxRows: i = 1 / 0, disabled: g, error: t, errorMessage: y, containerClassName: B = "", className: _ = "", maxLength: w = 1 / 0, counter: E, refLink: k, dataTest: C, counterLimit: p, ...b }) => {
7
- const R = W(null), f = k ?? R, s = !!(E && p), u = m(), $ = m(), q = m(), v = M ?? q, N = t ? y : l, I = j || N != null || !!t;
8
- U("StyledTextarea", t, y);
9
- const z = Q(t);
10
- V(() => {
11
- const n = f.current;
12
- if (!n) return;
13
- const h = window.getComputedStyle(n), A = parseFloat(h.lineHeight) || 24, F = parseFloat(h.paddingTop), H = parseFloat(h.paddingBottom);
14
- n.style.height = "auto";
15
- const J = n.scrollHeight - F - H, K = Math.max(1, Math.ceil(J / A)), O = Math.min(Math.max(K, r), i);
16
- n.style.height = `${O * A + F + H}px`;
1
+ import { useHelperSlot as R } from "../../../helpers/useHelperSlot.js";
2
+ import e from "./StyledTextarea.module.js";
3
+ import { useEffect as U, useId as m, useRef as V } from "react";
4
+ import { Fragment as W, jsx as n, jsxs as c } from "react/jsx-runtime";
5
+ var tt = ({ id: H, variant: x = "active", label: d = "", labelClassName: A = "", description: l = "", reserveHelperText: M, value: t = "", minRows: r = 3, maxRows: i = 1 / 0, disabled: g, error: a, errorMessage: j, containerClassName: _ = "", className: w = "", maxLength: B = 1 / 0, counter: E, refLink: k, dataTest: C, counterLimit: p, ...y }) => {
6
+ const q = V(null), h = k ?? q, s = !!(E && p), b = m(), u = m(), z = m(), $ = H ?? z, v = a ? j : l, { show: N, role: D } = R("StyledTextarea", a, v, M);
7
+ U(() => {
8
+ const o = h.current;
9
+ if (!o) return;
10
+ const f = window.getComputedStyle(o), S = parseFloat(f.lineHeight) || 24, T = parseFloat(f.paddingTop), F = parseFloat(f.paddingBottom);
11
+ o.style.height = "auto";
12
+ const K = o.scrollHeight - T - F, O = Math.max(1, Math.ceil(K / S)), Q = Math.min(Math.max(O, r), i);
13
+ o.style.height = `${Q * S + T + F}px`;
17
14
  }, [
18
- f,
19
- e,
15
+ h,
16
+ t,
20
17
  r,
21
18
  i,
22
19
  s
23
20
  ]), i < r && (r = i);
24
- const D = t ? "error" : "active", T = t ? "error" : g ? "disabled" : "active", G = typeof d != "string" || d.trim() !== "" ? void 0 : typeof l == "string" && l.trim() !== "" ? l : b.placeholder;
21
+ const G = a ? "error" : "active", I = a ? "error" : g ? "disabled" : "active", J = typeof d != "string" || d.trim() !== "" ? void 0 : typeof l == "string" && l.trim() !== "" ? l : y.placeholder;
25
22
  return /* @__PURE__ */ c("div", {
26
- className: `relative flex flex-col gap-1 ${B}`,
23
+ className: `relative flex flex-col gap-1 ${_}`,
27
24
  "data-testid": C,
28
25
  children: [
29
- /* @__PURE__ */ o("label", {
30
- htmlFor: v,
31
- className: `${a.label} ${a[T]} ${S}`,
26
+ /* @__PURE__ */ n("label", {
27
+ htmlFor: $,
28
+ className: `${e.label} ${e[I]} ${A}`,
32
29
  children: d
33
30
  }),
34
- I && /* @__PURE__ */ o("span", {
35
- id: u,
36
- role: z,
37
- className: `${a.description} ${a[T]} min-h-[24px]`,
38
- children: N
31
+ N && /* @__PURE__ */ n("span", {
32
+ id: b,
33
+ role: D,
34
+ className: `${e.description} ${e[I]} min-h-[24px]`,
35
+ children: v
39
36
  }),
40
- x === "view_only" ? /* @__PURE__ */ o("div", {
37
+ x === "view_only" ? /* @__PURE__ */ n("div", {
41
38
  className: "pt-3 font-roboto text-base font-normal text-delta-700",
42
- children: e
43
- }) : x === "not_editable" ? /* @__PURE__ */ o("div", {
39
+ children: t
40
+ }) : x === "not_editable" ? /* @__PURE__ */ n("div", {
44
41
  className: "rounded bg-delta-50 p-3 font-roboto text-base font-normal text-delta-700",
45
- children: e
46
- }) : /* @__PURE__ */ o("textarea", {
47
- ...b,
48
- "aria-describedby": [I ? u : null, s ? $ : null].filter(Boolean).join(" ") || void 0,
49
- "aria-invalid": t,
50
- "aria-label": G,
51
- id: v,
52
- ref: f,
53
- className: `${a.textarea} ${a[D]} ${_} ${s ? "pb-[32px]" : ""}`,
42
+ children: t
43
+ }) : /* @__PURE__ */ n("textarea", {
44
+ ...y,
45
+ "aria-describedby": [N ? b : null, s ? u : null].filter(Boolean).join(" ") || void 0,
46
+ "aria-invalid": a,
47
+ "aria-label": J,
48
+ id: $,
49
+ ref: h,
50
+ className: `${e.textarea} ${e[G]} ${w} ${s ? "pb-[32px]" : ""}`,
54
51
  wrap: "soft",
55
- value: e,
52
+ value: t,
56
53
  disabled: g,
57
- maxLength: w
54
+ maxLength: B
58
55
  }),
59
- s && /* @__PURE__ */ c(X, { children: [/* @__PURE__ */ c("div", {
56
+ s && /* @__PURE__ */ c(W, { children: [/* @__PURE__ */ c("div", {
60
57
  className: "pointer-events-none absolute bottom-3 right-3 flex h-[15px] justify-end font-roboto text-[10px]",
61
58
  children: [
62
- e.length,
59
+ t.length,
63
60
  "/",
64
61
  p
65
62
  ]
66
63
  }), /* @__PURE__ */ c("div", {
67
- id: $,
64
+ id: u,
68
65
  "aria-live": "polite",
69
66
  className: "sr-only",
70
- children: [p - e.length, " characters remaining"]
67
+ children: [p - t.length, " characters remaining"]
71
68
  })] })
72
69
  ]
73
70
  });
74
71
  };
75
72
  export {
76
- at as StyledTextarea
73
+ tt as StyledTextarea
77
74
  };
@@ -0,0 +1,19 @@
1
+ import { cn as s } from "./cn.js";
2
+ import { ErrorOutlineIcon as l } from "../components/icons/error-outline-icon/ErrorOutlineIcon.js";
3
+ import { forwardRef as x } from "react";
4
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
5
+ var w = x(({ id: t, role: i, error: r, message: m, hideErrorIcon: o, className: a, style: n }, p) => /* @__PURE__ */ c("div", {
6
+ ref: p,
7
+ id: t,
8
+ role: i,
9
+ className: s("flex min-h-[24px] gap-1 pt-1 text-sm leading-5 tracking-[0.03333em]", r ? "text-error-500" : "text-delta-600", a),
10
+ style: n,
11
+ children: [r && !o && /* @__PURE__ */ e(l, {
12
+ width: 20,
13
+ height: 20,
14
+ className: "min-w-5 shrink-0"
15
+ }), /* @__PURE__ */ e("span", { children: m })]
16
+ }));
17
+ export {
18
+ w as HelperRow
19
+ };
@@ -0,0 +1,12 @@
1
+ import { useHelperAlertRole as u } from "./useHelperAlertRole.js";
2
+ import { warnMissingErrorMessage as s } from "./warnMissingErrorMessage.js";
3
+ function f(r, e, o, t, l) {
4
+ const n = l !== !0 && (t === !0 || o != null || !!e);
5
+ return s(r, e, o), {
6
+ show: n,
7
+ role: u(e)
8
+ };
9
+ }
10
+ export {
11
+ f as useHelperSlot
12
+ };
@@ -0,0 +1,16 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ export interface HelperRowProps {
3
+ id: string;
4
+ role: 'alert' | 'status';
5
+ error?: boolean;
6
+ message?: ReactNode;
7
+ hideErrorIcon?: boolean;
8
+ className?: string;
9
+ style?: CSSProperties;
10
+ }
11
+ /**
12
+ * Shared helper-text row rendered beneath input components (Figma "Helper text" row,
13
+ * 24 px min-height, pt 4 px, gap 4 px). Renders error icon + message text with proper
14
+ * ARIA role. Consumers add layout tweaks (margin, alignment) via `className`.
15
+ */
16
+ export declare const HelperRow: import('react').ForwardRefExoticComponent<HelperRowProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ export interface UseHelperSlotResult {
3
+ show: boolean;
4
+ role: 'alert' | 'status';
5
+ }
6
+ /**
7
+ * Shared logic for the helper-text row beneath input components.
8
+ * Returns `show` (whether the slot should render) and `role` (ARIA live-region role).
9
+ * Emits a dev-mode warning when `error` is set but `message` is empty.
10
+ */
11
+ export declare function useHelperSlot(component: string, error: boolean | undefined, message: ReactNode, reserveHelperText?: boolean, readOnly?: boolean): UseHelperSlotResult;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.73.1",
6
+ "version": "3.74.1",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",