asma-ui-core 3.130.0 → 3.130.2

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,17 +1,17 @@
1
- import { cn as u } from "../../../helpers/cn.js";
2
- import { ChevronDownIcon as L } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
3
- import { CloseIcon as F } from "../../icons/close-icon/CloseIcon.js";
4
- import { StyledButton as q } from "../button/StyledButton.js";
5
- import { StyledRadio as T } from "../radio-button/base-ui/StyledRadio.js";
6
- import { HelperRow as M } from "../../../helpers/HelperRow.js";
7
- import { useHelperSlot as V } from "../../../helpers/useHelperSlot.js";
8
- import { StyledInputField as K } from "../input-field/StyledInputField.js";
9
- import { getPickerText as X } from "../full-screen-picker/pickerCopy.js";
10
- import { StyledSelectAutocomplete as B } from "../select-autocomplete/StyledSelectAutocomplete.js";
1
+ import { cn as h } from "../../../helpers/cn.js";
2
+ import { ChevronDownIcon as q } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
3
+ import { CloseIcon as D } from "../../icons/close-icon/CloseIcon.js";
4
+ import { StyledButton as _ } from "../button/StyledButton.js";
5
+ import { StyledRadio as E } from "../radio-button/base-ui/StyledRadio.js";
6
+ import { HelperRow as L } from "../../../helpers/HelperRow.js";
7
+ import { useHelperSlot as F } from "../../../helpers/useHelperSlot.js";
8
+ import { StyledInputField as M } from "../input-field/StyledInputField.js";
9
+ import { getPickerText as V } from "../full-screen-picker/pickerCopy.js";
10
+ import { StyledSelectAutocomplete as K } from "../select-autocomplete/StyledSelectAutocomplete.js";
11
11
  import a from "./StyledEmojiChoice.module.js";
12
- import { useId as w, useRef as E, useState as x } from "react";
13
- import { jsx as l, jsxs as f } from "react/jsx-runtime";
14
- var G = {
12
+ import { useId as S, useRef as x, useState as P } from "react";
13
+ import { jsx as l, jsxs as v } from "react/jsx-runtime";
14
+ var X = {
15
15
  en: {
16
16
  noAnswer: "No answer",
17
17
  showAllOptions: (e) => `Show all options (${e})`,
@@ -28,7 +28,7 @@ var G = {
28
28
  option: (e) => `Alternativ ${e}`,
29
29
  clearSelection: "Fjern valget"
30
30
  }
31
- }, z = 5, R = (e, n, o) => e.label ? e.label : e.emoji ? e.emoji : o.option(n), H = ({ option: e, className: n }) => e.emoji ? /* @__PURE__ */ l("span", {
31
+ }, B = 5, k = (e, n, i) => e.label ? e.label : e.emoji ? e.emoji : i.option(n), H = ({ option: e, className: n }) => e.emoji ? /* @__PURE__ */ l("span", {
32
32
  "aria-hidden": "true",
33
33
  className: n,
34
34
  children: e.emoji
@@ -36,13 +36,13 @@ var G = {
36
36
  alt: "",
37
37
  src: e.emojiImageSrc,
38
38
  className: n
39
- }) : null, $ = ({ option: e, position: n, text: o, radio: h }) => {
40
- const m = !!e.emoji || !!e.emojiImageSrc;
41
- return /* @__PURE__ */ f("span", {
42
- className: u(a.content, !m && a.noEmoji),
43
- children: [/* @__PURE__ */ f("span", {
39
+ }) : null, C = ({ option: e, position: n, text: i, radio: p }) => {
40
+ const u = !!e.emoji || !!e.emojiImageSrc;
41
+ return /* @__PURE__ */ v("span", {
42
+ className: h(a.content, !u && a.noEmoji),
43
+ children: [/* @__PURE__ */ v("span", {
44
44
  className: a.lead,
45
- children: [h, m && /* @__PURE__ */ l("span", {
45
+ children: [p, u && /* @__PURE__ */ l("span", {
46
46
  className: a.emojiSlot,
47
47
  children: /* @__PURE__ */ l(H, {
48
48
  option: e,
@@ -54,240 +54,230 @@ var G = {
54
54
  children: e.label
55
55
  }) : /* @__PURE__ */ l("span", {
56
56
  className: "sr-only",
57
- children: R(e, n, o)
57
+ children: k(e, n, i)
58
58
  })]
59
59
  });
60
- }, D = ({ dataTest: e, text: n, onClear: o, focusAfter: h }) => /* @__PURE__ */ l(q, {
60
+ }, G = ({ dataTest: e, text: n, onClear: i, focusAfter: p }) => /* @__PURE__ */ l(_, {
61
61
  dataTest: `${e}-clear`,
62
62
  variant: "text",
63
63
  type: "button",
64
64
  className: a.clear,
65
- startIcon: /* @__PURE__ */ l(F, {
65
+ startIcon: /* @__PURE__ */ l(D, {
66
66
  width: 24,
67
67
  height: 24
68
68
  }),
69
69
  onClick: () => {
70
- o(), h()?.focus({ preventScroll: !0 });
70
+ i(), p()?.focus({ preventScroll: !0 });
71
71
  },
72
72
  children: n.clearSelection
73
- }), J = (e) => {
73
+ }), z = (e) => {
74
74
  e.key === "Enter" && (e.preventDefault(), e.currentTarget.click());
75
- }, Q = ({ dataTest: e, options: n, value: o, onValueChange: h, onClear: m, question: O, "aria-labelledby": c, name: p, error: N, helperText: y, className: g, text: b }) => {
76
- const d = w(), s = w(), v = E(null), { show: S, role: A } = V("StyledEmojiChoice", N, y), I = n.some((r) => r.value === o);
77
- return /* @__PURE__ */ f("fieldset", {
78
- ref: v,
75
+ }, J = ({ dataTest: e, options: n, value: i, onValueChange: p, onClear: u, question: w, "aria-labelledby": c, name: f, error: y, helperText: g, className: b, text: O }) => {
76
+ const o = S(), t = S(), N = x(null), { show: I, role: j } = F("StyledEmojiChoice", y, g), d = n.some((m) => m.value === i);
77
+ return /* @__PURE__ */ v("fieldset", {
78
+ ref: N,
79
79
  tabIndex: -1,
80
80
  role: "group",
81
81
  "aria-labelledby": c,
82
- "aria-describedby": S ? s : void 0,
82
+ "aria-describedby": I ? t : void 0,
83
83
  "data-testid": e,
84
- className: u(a.group, g),
84
+ className: h(a.group, b),
85
85
  children: [
86
86
  !c && /* @__PURE__ */ l("legend", {
87
87
  className: a.question,
88
- children: O
88
+ children: w
89
89
  }),
90
90
  /* @__PURE__ */ l("div", {
91
91
  className: a.options,
92
- children: n.map((r, j) => {
93
- const C = r.value === o;
94
- return /* @__PURE__ */ f("label", {
95
- "data-testid": `${e}-option-${j}`,
96
- className: u(a.card, a.choice, !r.label && a.fit),
92
+ children: n.map((m, A) => {
93
+ const r = m.value === i;
94
+ return /* @__PURE__ */ v("label", {
95
+ "data-testid": `${e}-option-${A}`,
96
+ className: h(a.card, a.choice, !m.label && a.fit),
97
97
  children: [/* @__PURE__ */ l("input", {
98
98
  type: "radio",
99
99
  className: "sr-only",
100
- name: p ?? d,
101
- value: r.value,
102
- checked: C,
103
- onChange: () => h?.(r.value, r),
104
- onKeyDown: J
100
+ name: f ?? o,
101
+ value: m.value,
102
+ checked: r,
103
+ onChange: () => p?.(m.value, m),
104
+ onKeyDown: z
105
105
  }), /* @__PURE__ */ l("span", {
106
106
  className: a.body,
107
- children: /* @__PURE__ */ l($, {
108
- option: r,
109
- position: j + 1,
110
- text: b,
111
- radio: /* @__PURE__ */ l(T, {
107
+ children: /* @__PURE__ */ l(C, {
108
+ option: m,
109
+ position: A + 1,
110
+ text: O,
111
+ radio: /* @__PURE__ */ l(E, {
112
112
  decorative: !0,
113
- checked: C
113
+ checked: r
114
114
  })
115
115
  })
116
116
  })]
117
- }, `${j}-${r.value}`);
117
+ }, `${A}-${m.value}`);
118
118
  })
119
119
  }),
120
- m && I && /* @__PURE__ */ l(D, {
120
+ u && d && /* @__PURE__ */ l(G, {
121
121
  dataTest: e,
122
- text: b,
123
- onClear: m,
124
- focusAfter: () => v.current
122
+ text: O,
123
+ onClear: u,
124
+ focusAfter: () => N.current
125
125
  }),
126
- S && /* @__PURE__ */ l(M, {
127
- id: s,
128
- role: A,
129
- error: N,
130
- message: y,
131
- className: u("m-0", N && "font-medium")
126
+ I && /* @__PURE__ */ l(L, {
127
+ id: t,
128
+ role: j,
129
+ error: y,
130
+ message: g,
131
+ className: h("m-0", y && "font-medium")
132
132
  })
133
133
  ]
134
134
  });
135
- }, U = ({ dataTest: e, options: n, value: o, onValueChange: h, onClear: m, question: O, "aria-labelledby": c, error: p, helperText: N, placeholder: y, locale: g, className: b, text: d }) => {
136
- const s = w(), v = E(null), [S, A] = x(null), I = E(!1), r = n.find((t) => t.value === o) ?? null, j = r ? R(r, n.indexOf(r) + 1, d) : "", C = S === null && r !== null && (r.label !== "" || !r.emoji);
137
- return /* @__PURE__ */ f("div", {
138
- ref: v,
139
- className: u(a.dropdown, b),
140
- children: [
141
- !c && /* @__PURE__ */ l("span", {
142
- id: s,
143
- className: a.question,
144
- children: O
145
- }),
146
- /* @__PURE__ */ l(B, {
147
- dataTest: e,
148
- options: n,
149
- value: r,
150
- onChange: (t, i) => {
151
- i && h?.(i.value, i);
152
- },
153
- getOptionLabel: (t) => R(t, n.indexOf(t) + 1, d),
154
- getOptionKey: (t) => t.value,
155
- isOptionEqualToValue: (t, i) => t.value === i.value,
156
- inputValue: S ?? j,
157
- onInputChange: (t, i, k) => A(k === "input" ? i : null),
158
- onClose: () => A(null),
159
- disableClearable: !0,
160
- error: p,
161
- helperText: N,
162
- pickerTitle: O,
163
- locale: g,
164
- noOptionsText: X(g ?? "en").noMatches,
165
- maxListHeight: 322,
166
- slotProps: { popper: { className: a.menu } },
167
- renderOption: ({ key: t, className: i, ...k }, _, P) => /* @__PURE__ */ l("li", {
168
- ...k,
169
- className: u(a.menuOption, P.inPicker && a.pickerOption),
170
- children: /* @__PURE__ */ l("span", {
171
- className: u(a.card, a.body),
172
- children: /* @__PURE__ */ l($, {
173
- option: _,
174
- position: n.indexOf(_) + 1,
175
- text: d,
176
- radio: /* @__PURE__ */ l(T, {
177
- decorative: !0,
178
- checked: P.selected
179
- })
135
+ }, Q = ({ dataTest: e, options: n, value: i, onValueChange: p, onClear: u, question: w, "aria-labelledby": c, error: f, helperText: y, placeholder: g, locale: b, className: O, text: o }) => {
136
+ const t = S(), [N, I] = P(null), j = x(!1), d = n.find((r) => r.value === i) ?? null, m = d ? k(d, n.indexOf(d) + 1, o) : "", A = N === null && d !== null && (d.label !== "" || !d.emoji);
137
+ return /* @__PURE__ */ v("div", {
138
+ className: h(a.dropdown, O),
139
+ children: [!c && /* @__PURE__ */ l("span", {
140
+ id: t,
141
+ className: a.question,
142
+ children: w
143
+ }), /* @__PURE__ */ l(K, {
144
+ dataTest: e,
145
+ options: n,
146
+ value: d,
147
+ onChange: (r, s) => {
148
+ s ? p?.(s.value, s) : u?.();
149
+ },
150
+ getOptionLabel: (r) => k(r, n.indexOf(r) + 1, o),
151
+ getOptionKey: (r) => r.value,
152
+ isOptionEqualToValue: (r, s) => r.value === s.value,
153
+ inputValue: N ?? m,
154
+ onInputChange: (r, s, $) => I($ === "input" ? s : null),
155
+ onClose: () => I(null),
156
+ disableClearable: !u,
157
+ error: f,
158
+ helperText: y,
159
+ pickerTitle: w,
160
+ locale: b,
161
+ noOptionsText: V(b ?? "en").noMatches,
162
+ maxListHeight: 322,
163
+ slotProps: { popper: { className: a.menu } },
164
+ renderOption: ({ key: r, className: s, ...$ }, R, T) => /* @__PURE__ */ l("li", {
165
+ ...$,
166
+ className: h(a.menuOption, T.inPicker && a.pickerOption),
167
+ children: /* @__PURE__ */ l("span", {
168
+ className: h(a.card, a.body),
169
+ children: /* @__PURE__ */ l(C, {
170
+ option: R,
171
+ position: n.indexOf(R) + 1,
172
+ text: o,
173
+ radio: /* @__PURE__ */ l(E, {
174
+ decorative: !0,
175
+ checked: T.selected
180
176
  })
181
177
  })
182
- }, t),
183
- renderInput: (t) => /* @__PURE__ */ l(K, {
184
- ...t,
185
- dataTest: `${e}-input`,
186
- placeholder: y,
187
- onFocus: (i) => {
188
- t.onFocus?.(), i.currentTarget.select(), I.current = !0;
189
- },
190
- onClick: (i) => {
191
- I.current && i.target instanceof HTMLInputElement && i.target.select(), I.current = !1;
178
+ })
179
+ }, r),
180
+ renderInput: (r) => /* @__PURE__ */ l(M, {
181
+ ...r,
182
+ dataTest: `${e}-input`,
183
+ placeholder: g,
184
+ onFocus: (s) => {
185
+ r.onFocus?.(), s.currentTarget.select(), j.current = !0;
186
+ },
187
+ onClick: (s) => {
188
+ j.current && s.target instanceof HTMLInputElement && s.target.select(), j.current = !1;
189
+ },
190
+ slotProps: {
191
+ htmlInput: {
192
+ ...r.slotProps.htmlInput,
193
+ "aria-labelledby": c ?? t
192
194
  },
193
- slotProps: {
194
- htmlInput: {
195
- ...t.slotProps.htmlInput,
196
- "aria-labelledby": c ?? s
197
- },
198
- input: {
199
- ...t.slotProps.input,
200
- startAdornment: r && C ? /* @__PURE__ */ l(H, {
201
- option: r,
202
- className: a.fieldEmoji
203
- }) : void 0
204
- }
195
+ input: {
196
+ ...r.slotProps.input,
197
+ startAdornment: d && A ? /* @__PURE__ */ l(H, {
198
+ option: d,
199
+ className: a.fieldEmoji
200
+ }) : void 0
205
201
  }
206
- })
207
- }),
208
- m && r && /* @__PURE__ */ l(D, {
209
- dataTest: e,
210
- text: d,
211
- onClear: m,
212
- focusAfter: () => v.current?.querySelector("input")
202
+ }
213
203
  })
214
- ]
204
+ })]
215
205
  });
216
- }, W = ({ dataTest: e, options: n, value: o, question: h, "aria-labelledby": m, className: O, text: c }) => {
217
- const [p, N] = x(!1), y = w(), g = w(), b = w(), d = n.find((s) => s.value === o);
218
- return /* @__PURE__ */ f("dl", {
206
+ }, U = ({ dataTest: e, options: n, value: i, question: p, "aria-labelledby": u, className: w, text: c }) => {
207
+ const [f, y] = P(!1), g = S(), b = S(), O = S(), o = n.find((t) => t.value === i);
208
+ return /* @__PURE__ */ v("dl", {
219
209
  "data-testid": e,
220
- className: u(a.readOnly, O),
210
+ className: h(a.readOnly, w),
221
211
  children: [/* @__PURE__ */ l("dt", {
222
- id: y,
223
- className: m ? "sr-only" : a.question,
224
- children: h
225
- }), /* @__PURE__ */ f("dd", {
212
+ id: g,
213
+ className: u ? "sr-only" : a.question,
214
+ children: p
215
+ }), /* @__PURE__ */ v("dd", {
226
216
  className: a.readOnlyAnswer,
227
- children: [/* @__PURE__ */ f("div", {
217
+ children: [/* @__PURE__ */ v("div", {
228
218
  className: a.readOnlyCard,
229
- children: [d ? /* @__PURE__ */ l($, {
230
- option: d,
231
- position: n.indexOf(d) + 1,
219
+ children: [o ? /* @__PURE__ */ l(C, {
220
+ option: o,
221
+ position: n.indexOf(o) + 1,
232
222
  text: c
233
223
  }) : /* @__PURE__ */ l("span", {
234
224
  className: a.noAnswer,
235
225
  children: c.noAnswer
236
- }), n.length > 0 && /* @__PURE__ */ l(q, {
226
+ }), n.length > 0 && /* @__PURE__ */ l(_, {
237
227
  dataTest: `${e}-show-all`,
238
228
  variant: "text",
239
229
  type: "button",
240
230
  className: a.showAll,
241
- "aria-expanded": p,
242
- "aria-controls": b,
243
- "aria-labelledby": `${g} ${y}`,
244
- endIcon: /* @__PURE__ */ l(L, {
231
+ "aria-expanded": f,
232
+ "aria-controls": O,
233
+ "aria-labelledby": `${b} ${g}`,
234
+ endIcon: /* @__PURE__ */ l(q, {
245
235
  width: 24,
246
236
  height: 24,
247
- className: u(p && "flip-180")
237
+ className: h(f && "flip-180")
248
238
  }),
249
- onClick: () => N(!p),
239
+ onClick: () => y(!f),
250
240
  children: /* @__PURE__ */ l("span", {
251
- id: g,
252
- children: p ? c.hideOptions : c.showAllOptions(n.length)
241
+ id: b,
242
+ children: f ? c.hideOptions : c.showAllOptions(n.length)
253
243
  })
254
244
  })]
255
245
  }), /* @__PURE__ */ l("ul", {
256
- id: b,
257
- hidden: !p,
246
+ id: O,
247
+ hidden: !f,
258
248
  className: a.options,
259
- children: n.map((s, v) => /* @__PURE__ */ f("li", {
260
- className: u(a.card, a.body, !s.label && a.fit),
261
- children: [/* @__PURE__ */ l($, {
262
- option: s,
263
- position: v + 1,
249
+ children: n.map((t, N) => /* @__PURE__ */ v("li", {
250
+ className: h(a.card, a.body, !t.label && a.fit),
251
+ children: [/* @__PURE__ */ l(C, {
252
+ option: t,
253
+ position: N + 1,
264
254
  text: c,
265
- radio: /* @__PURE__ */ l(T, {
255
+ radio: /* @__PURE__ */ l(E, {
266
256
  decorative: !0,
267
257
  readOnly: !0,
268
- checked: s === d
258
+ checked: t === o
269
259
  })
270
- }), s === d && /* @__PURE__ */ l("span", {
260
+ }), t === o && /* @__PURE__ */ l("span", {
271
261
  className: "sr-only",
272
262
  children: `, ${c.selected}`
273
263
  })]
274
- }, `${v}-${s.value}`))
264
+ }, `${N}-${t.value}`))
275
265
  })]
276
266
  })]
277
267
  });
278
- }, me = (e) => {
279
- const n = G[e.locale ?? "en"];
280
- return e.readOnly ? /* @__PURE__ */ l(W, {
268
+ }, de = (e) => {
269
+ const n = X[e.locale ?? "en"];
270
+ return e.readOnly ? /* @__PURE__ */ l(U, {
281
271
  ...e,
282
272
  text: n
283
- }) : e.options.length > z ? /* @__PURE__ */ l(U, {
273
+ }) : e.options.length > B ? /* @__PURE__ */ l(Q, {
284
274
  ...e,
285
275
  text: n
286
- }) : /* @__PURE__ */ l(Q, {
276
+ }) : /* @__PURE__ */ l(J, {
287
277
  ...e,
288
278
  text: n
289
279
  });
290
280
  };
291
281
  export {
292
- me as StyledEmojiChoice
282
+ de as StyledEmojiChoice
293
283
  };
@@ -9,7 +9,7 @@ import { useHelperRowBudget as _t } from "../../../helpers/useHelperRowBudget.js
9
9
  import { useHelperSlot as At } from "../../../helpers/useHelperSlot.js";
10
10
  import { fieldLabelAboveClass as Ht, fieldWidthStyle as Ct, floatingLabelClass as Rt, floatingLabelLayoutStyle as wt, notchedLegendClass as Ft, notchedOutlineClass as he, singleLineInputLayoutStyle as Bt, singleLineShellLayoutStyle as Mt } from "../field-styles.js";
11
11
  import L from "./StyledInputField.module.js";
12
- import { Children as Et, useCallback as pe, useId as Ot, useLayoutEffect as M, useRef as Y, useState as E } from "react";
12
+ import { Children as Et, useCallback as pe, useId as Ot, useLayoutEffect as M, useRef as J, useState as E } from "react";
13
13
  import { Fragment as Tt, jsx as t, jsxs as f } from "react/jsx-runtime";
14
14
  import { useMergeRefs as me } from "@floating-ui/react";
15
15
  var ge = "peer-focus-visible:border-focus-ring peer-focus-visible:shadow-[inset_0_0_0_2px_var(--colors-focus-ring)]", Dt = "pointer-events-none absolute -inset-1 rounded peer-focus-visible:shadow-[inset_0_0_0_2px_var(--colors-focus-ring)]", kt = ({ reason: u, children: r }) => u === void 0 ? r : /* @__PURE__ */ t(vt, {
@@ -17,12 +17,12 @@ var ge = "peer-focus-visible:border-focus-ring peer-focus-visible:shadow-[inset_
17
17
  openOnTap: !0,
18
18
  persistentDescription: !0,
19
19
  children: r
20
- }), mn = ({ dataTest: u, label: r, labelPlacement: fe = "above", value: x, defaultValue: S, onChange: xe, onBlur: ye, onFocus: be, error: y, helperText: J, reserveHelperText: ve, expandHelperText: Le = !0, maxLength: Se, counter: Ie, locale: Ne, disabled: h, readOnly: _e, lockedReason: O, readOnlyReason: T, required: _, allowClear: Ae, onClear: He, type: Ce = "text", placeholder: Re, name: we, id: Fe, autoComplete: Be, autoFocus: Me, multiline: i, rows: A, minRows: D, maxRows: k, size: Ee = "medium", width: Q = "full", fullWidth: Wt, className: Oe, style: Te, sx: De, inputRef: ke, slotProps: n, InputProps: X, onKeyDown: Z, onClick: We, variant: $t }) => {
21
- const $e = Ot(), W = Fe ?? $e, q = `${W}-helper-text`, $ = Y(null), z = Y(0), ee = Y(null), [ze, Ue] = E(void 0), [H, te] = E(!1), [je, ne] = E(S != null && S !== ""), [Pe, Ke] = E(String(S ?? "").length), c = !!O || O === 0, o = !c && (!!T || T === 0), l = !!_e || c || o, C = x !== void 0, oe = C ? x !== "" && x != null : je, Ge = !!h || !!l, U = n?.input?.startAdornment ?? X?.startAdornment, I = Et.count(U) > 0, m = I && Array.isArray(U), j = n?.input?.endAdornment ?? X?.endAdornment, b = c ? /* @__PURE__ */ f(Tt, { children: [j, /* @__PURE__ */ t(St, {
20
+ }), mn = ({ dataTest: u, label: r, labelPlacement: fe = "above", value: x, defaultValue: S, onChange: xe, onBlur: ye, onFocus: be, error: y, helperText: Q, reserveHelperText: ve, expandHelperText: Le = !0, maxLength: Se, counter: Ie, locale: Ne, disabled: h, readOnly: _e, lockedReason: O, readOnlyReason: T, required: _, allowClear: Ae, onClear: He, type: Ce = "text", placeholder: Re, name: we, id: Fe, autoComplete: Be, autoFocus: Me, multiline: i, rows: A, minRows: D, maxRows: k, size: Ee = "medium", width: X = "full", fullWidth: Wt, className: Oe, style: Te, sx: De, inputRef: ke, slotProps: n, InputProps: Z, onKeyDown: q, onClick: We, variant: $t }) => {
21
+ const $e = Ot(), W = Fe ?? $e, ee = `${W}-helper-text`, $ = J(null), z = J(0), te = J(null), [ze, Ue] = E(void 0), [H, ne] = E(!1), [je, oe] = E(S != null && S !== ""), [Pe, Ke] = E(String(S ?? "").length), c = !!O || O === 0, o = !c && (!!T || T === 0), l = !!_e || c || o, C = x !== void 0, le = C ? x !== "" && x != null : je, Ge = !!h || !!l, U = n?.input?.startAdornment ?? Z?.startAdornment, I = Et.count(U) > 0, m = I && Array.isArray(U), j = n?.input?.endAdornment ?? Z?.endAdornment, b = c ? /* @__PURE__ */ f(Tt, { children: [j, /* @__PURE__ */ t(St, {
22
22
  width: 24,
23
23
  height: 24,
24
24
  className: "text-delta-700"
25
- })] }) : j, N = !!(Ae && oe && !Ge), { ref: Ve, ...s } = n?.htmlInput ?? {}, Ye = ke ?? Ve, { className: Je, style: P, ref: Qe } = n?.input ?? {}, Xe = me([Qe]), Ze = n?.input?.onMouseDown, le = n?.input?.onClick, qe = le ? { onClick: le } : {}, et = Be ?? s.autoComplete, tt = we ?? s.name, K = s.id ?? W, R = Se ?? s.maxLength, ie = `${W}-counter`, ae = Ie !== !1 && !!R && !o, nt = C ? String(x ?? "").length : Pe, w = fe === "floating" && !!r && !o, F = H || oe || I, g = pe(() => {
25
+ })] }) : j, N = !!(Ae && le && !Ge), { ref: Ve, ...s } = n?.htmlInput ?? {}, Ye = ke ?? Ve, { className: Je, style: P, ref: Qe } = n?.input ?? {}, Xe = me([Qe]), Ze = n?.input?.onMouseDown, ie = n?.input?.onClick, qe = ie ? { onClick: ie } : {}, et = Be ?? s.autoComplete, tt = we ?? s.name, K = s.id ?? W, R = Se ?? s.maxLength, ae = `${W}-counter`, G = Ie !== !1 && !!R && !o, nt = C ? String(x ?? "").length : Pe, w = fe === "floating" && !!r && !o, F = H || le || I, g = pe(() => {
26
26
  const e = $.current;
27
27
  if (!(!i || !e) && (z.current = e.offsetWidth, z.current !== 0)) {
28
28
  if (e.removeAttribute("data-scrollable"), A != null && !l) e.style.height = "";
@@ -43,11 +43,11 @@ var ge = "peer-focus-visible:border-focus-ring peer-focus-visible:shadow-[inset_
43
43
  l,
44
44
  A
45
45
  ]), ot = (e) => {
46
- l || (C || (ne(e.target.value !== ""), Ke(e.target.value.length), g()), xe?.(e));
46
+ l || (C || (oe(e.target.value !== ""), Ke(e.target.value.length), g()), xe?.(e));
47
47
  }, lt = (e) => {
48
- !h && !l && te(!0), be?.(e);
48
+ !h && !l && ne(!0), be?.(e);
49
49
  }, it = (e) => {
50
- !h && !l && te(!1), ye?.(e);
50
+ !h && !l && ne(!1), ye?.(e);
51
51
  };
52
52
  M(() => {
53
53
  g();
@@ -72,23 +72,23 @@ var ge = "peer-focus-visible:border-focus-ring peer-focus-visible:shadow-[inset_
72
72
  }, [i, g]);
73
73
  const re = me([Ye, pe((e) => {
74
74
  $.current = e instanceof HTMLTextAreaElement ? e : null;
75
- }, [])]), { style: G, ...at } = s, v = !i && !m && !o, { height: zt, minHeight: Ut, maxHeight: jt, paddingTop: Pt, paddingBottom: Kt, ...rt } = P ?? {}, st = v ? {
75
+ }, [])]), { style: V, ...at } = s, v = !i && !m && !o, { height: zt, minHeight: Ut, maxHeight: jt, paddingTop: Pt, paddingBottom: Kt, ...rt } = P ?? {}, st = v ? {
76
76
  ...rt,
77
77
  ...Mt()
78
78
  } : m ? {
79
79
  boxSizing: "border-box",
80
80
  minHeight: 40,
81
81
  ...P
82
- } : P, { height: Gt, minHeight: Vt, maxHeight: Yt, paddingTop: Jt, paddingBottom: Qt, paddingLeft: Xt, paddingRight: dt, ...ct } = G ?? {}, ut = v ? {
82
+ } : P, { height: Gt, minHeight: Vt, maxHeight: Yt, paddingTop: Jt, paddingBottom: Qt, paddingLeft: Xt, paddingRight: dt, ...ct } = V ?? {}, ut = v ? {
83
83
  ...ct,
84
84
  ...Bt({
85
85
  paddingLeft: I ? 40 : 14,
86
86
  paddingRight: dt ?? ze ?? (N || b ? 40 : 14)
87
87
  })
88
- } : G;
88
+ } : V;
89
89
  M(() => {
90
90
  if (!v) return;
91
- const e = ee.current, d = e ? Math.ceil(e.getBoundingClientRect().width) + 20 : void 0;
91
+ const e = te.current, d = e ? Math.ceil(e.getBoundingClientRect().width) + 20 : void 0;
92
92
  Ue((p) => p === d ? p : d);
93
93
  }, [
94
94
  v,
@@ -96,9 +96,9 @@ var ge = "peer-focus-visible:border-focus-ring peer-focus-visible:shadow-[inset_
96
96
  j,
97
97
  c
98
98
  ]);
99
- const ht = F || !w, { show: V, role: pt } = At("StyledInputField", y, J, ve, l), { fieldRef: mt, rowRef: gt, rowStyle: ft } = _t(Le && V), se = {
99
+ const ht = F || !w, { show: Y, role: pt } = At("StyledInputField", y, Q, ve, l, G), { fieldRef: mt, rowRef: gt, rowStyle: ft } = _t(Le && Y), se = {
100
100
  ...at,
101
- style: v ? ut : G,
101
+ style: v ? ut : V,
102
102
  id: K,
103
103
  name: tt,
104
104
  maxLength: R,
@@ -112,12 +112,12 @@ var ge = "peer-focus-visible:border-focus-ring peer-focus-visible:shadow-[inset_
112
112
  defaultValue: S,
113
113
  "aria-invalid": y ? !0 : void 0,
114
114
  "aria-label": s["aria-label"] ?? (s["aria-labelledby"] ? void 0 : typeof r == "string" && r !== "" ? r : void 0),
115
- "aria-describedby": [V ? q : s["aria-describedby"], ae ? ie : void 0].filter(Boolean).join(" ") || void 0,
115
+ "aria-describedby": [Y ? ee : s["aria-describedby"], G ? ae : void 0].filter(Boolean).join(" ") || void 0,
116
116
  onChange: ot,
117
117
  onFocus: lt,
118
118
  onBlur: it,
119
- onKeyDown: s.onKeyDown || Z ? (e) => {
120
- Z?.(e), e.defaultPrevented || s.onKeyDown?.(e);
119
+ onKeyDown: s.onKeyDown || q ? (e) => {
120
+ q?.(e), e.defaultPrevented || s.onKeyDown?.(e);
121
121
  } : void 0
122
122
  }, de = a(L.Input, "peer border-0 bg-transparent text-base tracking-[0.00938em] outline-none placeholder:text-delta-500", o ? "text-delta-700" : "text-delta-800", m ? "box-border h-8 min-w-[60px] flex-1 py-0 pl-0 pr-0 leading-[23px]" : i ? a("w-full resize-none p-0 pl-0 pr-0", o ? "leading-6" : "leading-[23px]", L["Input--multiline"]) : o ? "m-0 w-full p-0 text-base leading-6" : a("w-full", L["Input--singleLine"], !N && !b && "max-xs:pr-1.5"), "disabled:text-delta-300", l && !o && "text-delta-800", (c || o) && "cursor-default", Je), xt = !i && !m ? {
123
123
  "data-start-adornment": I ? "true" : void 0,
@@ -127,10 +127,10 @@ var ge = "peer-focus-visible:border-focus-ring peer-focus-visible:shadow-[inset_
127
127
  ref: mt,
128
128
  className: a("group relative min-w-0 flex-col", Oe),
129
129
  onClick: We,
130
- "data-field-width": Q,
130
+ "data-field-width": X,
131
131
  style: {
132
132
  display: "flex",
133
- ...Ct(Q),
133
+ ...Ct(X),
134
134
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
135
135
  letterSpacing: "0.00938em",
136
136
  ...B(De),
@@ -191,14 +191,14 @@ var ge = "peer-focus-visible:border-focus-ring peer-focus-visible:shadow-[inset_
191
191
  "data-testid": `${u}-clear`,
192
192
  className: "asma-pressable absolute right-4 z-40 flex items-center justify-center rounded-full border-0 bg-transparent p-[2px] duration-300 hover:bg-gama-100",
193
193
  onClick: (e) => {
194
- e.stopPropagation(), e.preventDefault(), C || ne(!1), He?.();
194
+ e.stopPropagation(), e.preventDefault(), C || oe(!1), He?.();
195
195
  },
196
196
  children: /* @__PURE__ */ t(Lt, {
197
197
  width: 18,
198
198
  height: 18
199
199
  })
200
200
  }) : b && /* @__PURE__ */ t("span", {
201
- ref: ee,
201
+ ref: te,
202
202
  className: "absolute inset-y-0 right-[14px] flex max-w-[calc(100%-28px)] items-center gap-1",
203
203
  children: b
204
204
  }),
@@ -251,12 +251,12 @@ var ge = "peer-focus-visible:border-focus-ring peer-focus-visible:shadow-[inset_
251
251
  })]
252
252
  })
253
253
  }),
254
- V && /* @__PURE__ */ t(Nt, {
254
+ Y && /* @__PURE__ */ t(Nt, {
255
255
  ref: gt,
256
- id: q,
256
+ id: ee,
257
257
  role: pt,
258
258
  error: y,
259
- message: J,
259
+ message: Q,
260
260
  hideErrorIcon: n?.formHelperText?.hideErrorIcon,
261
261
  className: a("mr-[14px] box-border items-start", n?.formHelperText?.className),
262
262
  style: {
@@ -264,8 +264,8 @@ var ge = "peer-focus-visible:border-focus-ring peer-focus-visible:shadow-[inset_
264
264
  ...B(n?.formHelperText?.sx)
265
265
  }
266
266
  }),
267
- ae && R ? /* @__PURE__ */ t(It, {
268
- id: ie,
267
+ G && R ? /* @__PURE__ */ t(It, {
268
+ id: ae,
269
269
  length: nt,
270
270
  limit: R,
271
271
  locale: Ne,
@@ -1,12 +1,13 @@
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)
1
+ import { useHelperAlertRole as p } from "./useHelperAlertRole.js";
2
+ import { warnMissingErrorMessage as f } from "./warnMissingErrorMessage.js";
3
+ var c = (r) => typeof r == "string" ? r.trim() !== "" : r != null && r !== !1;
4
+ function h(r, t, o, l, n, e) {
5
+ const u = e ? c(o) : l === !0 || o != null, i = n !== !0 && (u || !!t);
6
+ return f(r, t, o), {
7
+ show: i,
8
+ role: p(t)
8
9
  };
9
10
  }
10
11
  export {
11
- f as useHelperSlot
12
+ h as useHelperSlot
12
13
  };
@@ -16,8 +16,9 @@ export interface StyledEmojiChoiceProps {
16
16
  value?: string | null;
17
17
  onValueChange?: (value: string, option: EmojiChoiceOption) => void;
18
18
  /**
19
- * @figmaProp none — an optional question: *Clear selection* under the options while one is chosen,
20
- * as on `StyledDynamicSelect`. Leave unset for a required question.
19
+ * @figmaProp none — an optional question: *Clear selection* under the radio list while an option is
20
+ * chosen, as on `StyledDynamicSelect`; the dropdown clears with the field's own clear button.
21
+ * Leave unset for a required question.
21
22
  */
22
23
  onClear?: () => void;
23
24
  /** The question text. Shown above the options unless `aria-labelledby` points at a heading you render. */
@@ -7,5 +7,6 @@ export interface UseHelperSlotResult {
7
7
  * Shared logic for the helper-text row beneath input components.
8
8
  * Returns `show` (whether the slot should render) and `role` (ARIA live-region role).
9
9
  * Emits a dev-mode warning when `error` is set but `message` is empty.
10
+ * Under a character counter a blank slot is never reserved: the counter takes that line instead.
10
11
  */
11
- export declare function useHelperSlot(component: string, error: boolean | undefined, message: ReactNode, reserveHelperText?: boolean, readOnly?: boolean): UseHelperSlotResult;
12
+ export declare function useHelperSlot(component: string, error: boolean | undefined, message: ReactNode, reserveHelperText?: boolean, readOnly?: boolean, hasCounter?: boolean): UseHelperSlotResult;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.130.0",
6
+ "version": "3.130.2",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",