asma-ui-core 3.109.0 → 3.111.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.
Files changed (59) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +41 -39
  3. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +62 -60
  4. package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +61 -58
  5. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +74 -71
  6. package/dist/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.js +13 -10
  7. package/dist/components/inputs/field-styles.js +16 -6
  8. package/dist/components/inputs/form-layout/StyledFieldPair.js +22 -0
  9. package/dist/components/inputs/form-layout/StyledFieldPair.module.js +8 -0
  10. package/dist/components/inputs/form-layout/StyledFormColumn.js +13 -0
  11. package/dist/components/inputs/input-field/StyledInputField.js +235 -198
  12. package/dist/components/inputs/phone-field/StyledPhoneField.js +41 -39
  13. package/dist/components/inputs/search-field/StyledSearchField.js +22 -20
  14. package/dist/components/inputs/select/StyledSelect.js +110 -108
  15. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +111 -108
  16. package/dist/components/inputs/slider/StyledSlider.js +2 -2
  17. package/dist/components/inputs/textarea/StyledTextarea.js +50 -52
  18. package/dist/components/inputs/textarea/StyledTextarea.module.js +3 -3
  19. package/dist/components/miscellaneous/StyledFormControl.js +29 -25
  20. package/dist/components/miscellaneous/StyledInputLabel.js +28 -18
  21. package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +137 -122
  22. package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.js +17 -15
  23. package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.module.js +2 -2
  24. package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +9 -8
  25. package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectMonth.js +17 -14
  26. package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectYear.js +14 -9
  27. package/dist/datetime/components/time-picker/StyledTimePicker.js +78 -74
  28. package/dist/datetime/components/time-picker/TimePickerInput.js +43 -41
  29. package/dist/datetime/components/time-picker/helpers/timePickerWidth.js +12 -0
  30. package/dist/helpers/CharacterCounter.js +21 -0
  31. package/dist/hooks/useBackCloses.hook.js +67 -38
  32. package/dist/hooks/useTopLayer.hook.js +30 -26
  33. package/dist/index.js +284 -273
  34. package/dist/src/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.d.ts +2 -2
  35. package/dist/src/components/inputs/dynamic-select/types.d.ts +3 -0
  36. package/dist/src/components/inputs/field-styles.d.ts +22 -0
  37. package/dist/src/components/inputs/form-layout/StyledFieldPair.d.ts +18 -0
  38. package/dist/src/components/inputs/form-layout/StyledFormColumn.d.ts +12 -0
  39. package/dist/src/components/inputs/form-layout/index.d.ts +4 -0
  40. package/dist/src/components/inputs/input-field/StyledInputField.d.ts +19 -4
  41. package/dist/src/components/inputs/select/StyledSelect.d.ts +7 -2
  42. package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +5 -1
  43. package/dist/src/components/inputs/textarea/StyledTextarea.d.ts +6 -0
  44. package/dist/src/components/miscellaneous/StyledFormControl.d.ts +5 -2
  45. package/dist/src/components/miscellaneous/StyledInputLabel.d.ts +7 -5
  46. package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +2 -0
  47. package/dist/src/datetime/components/date-picker/types.d.ts +3 -0
  48. package/dist/src/datetime/components/time-picker/helpers/timePickerWidth.d.ts +7 -0
  49. package/dist/src/datetime/components/time-picker/types.d.ts +3 -1
  50. package/dist/src/helpers/CharacterCounter.d.ts +16 -0
  51. package/dist/src/helpers/CharacterCounter.test.d.ts +1 -0
  52. package/dist/src/hooks/useBackCloses.hook.d.ts +47 -2
  53. package/dist/src/hooks/useTopLayer.hook.d.ts +6 -0
  54. package/dist/src/index.d.ts +2 -0
  55. package/dist/tailwind.config.d.ts +14 -0
  56. package/package.json +1 -1
  57. package/src/styles/fieldWidthTokens.css +8 -0
  58. package/src/styles/index.css +1 -0
  59. package/tw-configs/twConfigs.json +14 -0
@@ -5,31 +5,32 @@ import { CloseIcon as pt } from "../../icons/close-icon/CloseIcon.js";
5
5
  import { CheckIcon as ft } from "../../icons/check-icon/CheckIcon.js";
6
6
  import { PlusIconCircle as mt } from "../../icons/plus-icon-circle/PlusIconCircle.js";
7
7
  import { StyledChip as ht } from "../../data-display/chip/StyledChip.js";
8
- import { StyledCheckbox as de } from "../checkbox/base-ui/StyledCheckbox.js";
8
+ import { StyledCheckbox as ue } from "../checkbox/base-ui/StyledCheckbox.js";
9
9
  import { useBackCloses as bt } from "../../../hooks/useBackCloses.hook.js";
10
- import { LoadingIcon as gt } from "../../../table/shared-components/LoadingIcon.js";
10
+ import { fieldWidthStyle as gt } from "../field-styles.js";
11
+ import { LoadingIcon as xt } from "../../../table/shared-components/LoadingIcon.js";
11
12
  import B from "./StyledSelectAutocomplete.module.js";
12
- import { useEffect as ue, useMemo as U, useRef as pe, useState as D } from "react";
13
- import { jsx as r, jsxs as I } from "react/jsx-runtime";
14
- import { FloatingPortal as xt, autoUpdate as wt, flip as yt, offset as kt, shift as vt, size as Dt, useDismiss as It, useFloating as Nt, useInteractions as Ct, useMergeRefs as fe, useRole as At } from "@floating-ui/react";
15
- var St = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), Mt = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
16
- function Vt({ dataTest: l, options: b, renderInput: me, value: N, onChange: C, getOptionLabel: he, getOptionKey: A, isOptionEqualToValue: V, renderOption: T, renderValue: Y, filterOptions: O, loading: q, loadingText: be = "Loading…", noOptionsText: ge = "No options", disabled: S, readOnly: g, error: xe, helperText: we, size: ye = "small", rowSize: ke = "compact", disableClearable: ve, disableCloseOnSelect: De, popupIcon: Ie, autoHeight: Ne, multiple: Ce, allowSelectAll: M, selectAllLabel: Ae = "Select all", fullWidth: Se, classes: Me, inputValue: R, onInputChange: Re, open: G, onOpen: Pe, onClose: $e, className: _e, wrapperClassName: Le, getOptionDisabled: Ee, slotProps: J }) {
17
- const s = Ce === !0, d = he ?? St, P = (e, t) => V ? V(e, t) : e === t, [Oe, Fe] = D(!1), n = G ?? Oe, c = (e) => {
18
- e && (g || S) || (G === void 0 && Fe(e), e ? Pe?.() : (x(null), $e?.()));
19
- }, [je, Q] = D(""), m = R ?? je, $ = (e, t, a) => {
20
- R === void 0 && Q(t), Re?.(e, t, a);
21
- }, [o, x] = D(null), X = `${l}-listbox`, Z = pe([]), K = pe(null), [ze, He] = D(null), [ee, We] = D(null), i = s ? Array.isArray(N) ? N : [] : [], w = s ? null : N ?? null, te = !s && w !== null ? d(w) : "";
22
- ue(() => {
23
- R !== void 0 || s || Q(te);
13
+ import { useEffect as pe, useMemo as U, useRef as fe, useState as D } from "react";
14
+ import { jsx as o, jsxs as I } from "react/jsx-runtime";
15
+ import { FloatingPortal as yt, autoUpdate as wt, flip as kt, offset as vt, shift as Dt, size as It, useDismiss as Nt, useFloating as Ct, useInteractions as At, useMergeRefs as me, useRole as St } from "@floating-ui/react";
16
+ var Mt = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), Rt = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
17
+ function qt({ dataTest: l, options: b, renderInput: he, value: N, onChange: C, getOptionLabel: be, getOptionKey: A, isOptionEqualToValue: V, renderOption: T, renderValue: Y, filterOptions: O, loading: q, loadingText: ge = "Loading…", noOptionsText: xe = "No options", disabled: S, readOnly: g, error: ye, helperText: we, size: ke = "small", rowSize: ve = "compact", disableClearable: De, disableCloseOnSelect: Ie, popupIcon: Ne, autoHeight: Ce, multiple: Ae, allowSelectAll: M, selectAllLabel: Se = "Select all", width: G = "full", fullWidth: Pt, classes: Me, inputValue: R, onInputChange: Re, open: J, onOpen: Pe, onClose: _e, className: $e, wrapperClassName: Le, getOptionDisabled: Ee, slotProps: Q }) {
18
+ const s = Ae === !0, d = be ?? Mt, P = (e, t) => V ? V(e, t) : e === t, [Oe, We] = D(!1), n = J ?? Oe, c = (e) => {
19
+ e && (g || S) || (J === void 0 && We(e), e ? Pe?.() : (x(null), _e?.()));
20
+ }, [Fe, X] = D(""), m = R ?? Fe, _ = (e, t, a) => {
21
+ R === void 0 && X(t), Re?.(e, t, a);
22
+ }, [r, x] = D(null), Z = `${l}-listbox`, K = fe([]), ee = fe(null), [je, ze] = D(null), [te, He] = D(null), i = s ? Array.isArray(N) ? N : [] : [], y = s ? null : N ?? null, le = !s && y !== null ? d(y) : "";
23
+ pe(() => {
24
+ R !== void 0 || s || X(le);
24
25
  }, [
25
26
  R,
26
27
  s,
27
- te
28
+ le
28
29
  ]);
29
- const F = (e) => s ? i.some((t) => P(e, t)) : w !== null && P(e, w), _ = (e) => Ee?.(e) ?? Mt(e), le = U(() => {
30
+ const W = (e) => s ? i.some((t) => P(e, t)) : y !== null && P(e, y), $ = (e) => Ee?.(e) ?? Rt(e), se = U(() => {
30
31
  const e = [...b];
31
32
  if (O) return O(e, { inputValue: m });
32
- const t = !s && w !== null ? d(w).toLowerCase() : null;
33
+ const t = !s && y !== null ? d(y).toLowerCase() : null;
33
34
  if (!m || m.toLowerCase() === t) return e;
34
35
  const a = m.toLowerCase();
35
36
  return e.filter((p) => d(p).toLowerCase().includes(a));
@@ -38,66 +39,66 @@ function Vt({ dataTest: l, options: b, renderInput: me, value: N, onChange: C, g
38
39
  m,
39
40
  O,
40
41
  N
41
- ]), u = U(() => le.slice(0, 100), [le]), se = u.flatMap((e, t) => _(e) ? [] : [t]), j = M && s ? [-1, ...se] : se, oe = u.map((e, t) => t), h = M && s ? [-1, ...oe] : oe, k = u.findIndex(F);
42
- ue(() => {
42
+ ]), u = U(() => se.slice(0, 100), [se]), re = u.flatMap((e, t) => $(e) ? [] : [t]), F = M && s ? [-1, ...re] : re, oe = u.map((e, t) => t), h = M && s ? [-1, ...oe] : oe, k = u.findIndex(W);
43
+ pe(() => {
43
44
  if (!n) return;
44
- const e = o ?? k;
45
+ const e = r ?? k;
45
46
  if (e < 0) return;
46
- const t = requestAnimationFrame(() => Z.current[e]?.scrollIntoView({ block: "nearest" }));
47
+ const t = requestAnimationFrame(() => K.current[e]?.scrollIntoView({ block: "nearest" }));
47
48
  return () => cancelAnimationFrame(t);
48
49
  }, [
49
- o,
50
+ r,
50
51
  n,
51
- ee,
52
+ te,
52
53
  k
53
54
  ]);
54
- const { refs: L, floatingStyles: Be, context: re } = Nt({
55
+ const { refs: L, floatingStyles: Be, context: ne } = Ct({
55
56
  open: n,
56
57
  onOpenChange: c,
57
58
  placement: "bottom-start",
58
59
  strategy: "fixed",
59
60
  whileElementsMounted: wt,
60
61
  middleware: [
61
- kt(0),
62
- yt({ padding: 8 }),
63
- vt({ padding: 8 }),
64
- Dt({ apply({ rects: e, availableHeight: t }) {
65
- He(e.reference.width), We(Ne ? t - 8 : Math.min(t - 8, 320));
62
+ vt(0),
63
+ kt({ padding: 8 }),
64
+ Dt({ padding: 8 }),
65
+ It({ apply({ rects: e, availableHeight: t }) {
66
+ ze(e.reference.width), He(Ce ? t - 8 : Math.min(t - 8, 320));
66
67
  } })
67
68
  ]
68
- }), { getReferenceProps: Ue, getFloatingProps: Ve, getItemProps: Te } = Ct([It(re), At(re, { role: "listbox" })]);
69
+ }), { getReferenceProps: Ue, getFloatingProps: Ve, getItemProps: Te } = At([Nt(ne), St(ne, { role: "listbox" })]);
69
70
  bt({
70
71
  active: n,
71
72
  requestClose: () => c(!1)
72
73
  });
73
- const Ye = fe([L.setReference]), ne = U(() => n ? it(L.reference.current) : void 0, [n, L]), z = ct(ne), qe = fe([dt(L.setFloating, z)]), Ge = (e) => j.includes(k) ? k : j[e === 1 ? 0 : j.length - 1] ?? null, Je = (e) => {
74
+ const Ye = me([L.setReference]), ae = U(() => n ? it(L.reference.current) : void 0, [n, L]), j = ct(ae), qe = me([dt(L.setFloating, j)]), Ge = (e) => F.includes(k) ? k : F[e === 1 ? 0 : F.length - 1] ?? null, Je = (e) => {
74
75
  h.length !== 0 && x((t) => {
75
76
  const a = h.indexOf(t ?? k);
76
77
  return a === -1 ? h[e === 1 ? 0 : h.length - 1] ?? null : h[Math.min(Math.max(a + e, 0), h.length - 1)] ?? null;
77
78
  });
78
- }, v = (e, t, a = !s || !De) => {
79
+ }, v = (e, t, a = !s || !Ie) => {
79
80
  if (s) {
80
- const p = i.some((f) => P(t, f)), y = p ? i.filter((f) => !P(t, f)) : [...i, t];
81
- C?.(e, y, p ? "removeOption" : "selectOption", { option: t }), $(e, "", "reset"), a && c(!1);
81
+ const p = i.some((f) => P(t, f)), w = p ? i.filter((f) => !P(t, f)) : [...i, t];
82
+ C?.(e, w, p ? "removeOption" : "selectOption", { option: t }), _(e, "", "reset"), a && c(!1);
82
83
  } else
83
- C?.(e, t, "selectOption", { option: t }), $(e, d(t), "reset"), a && c(!1);
84
- }, ae = (e) => {
85
- C?.(e, s ? [] : null, "clear", void 0), $(e, "", "clear");
86
- }, H = (e) => {
84
+ C?.(e, t, "selectOption", { option: t }), _(e, d(t), "reset"), a && c(!1);
85
+ }, ie = (e) => {
86
+ C?.(e, s ? [] : null, "clear", void 0), _(e, "", "clear");
87
+ }, z = (e) => {
87
88
  const t = b.length > 0 && i.length === b.length;
88
89
  C?.(e, t ? [] : b, t ? "clear" : "selectOption", void 0);
89
90
  }, Qe = (e) => {
90
- if (e.key === "Backspace" && m === "" && ie) {
91
+ if (e.key === "Backspace" && m === "" && ce) {
91
92
  const t = i[i.length - 1];
92
- s ? t !== void 0 && v(e, t, !1) : ae(e);
93
+ s ? t !== void 0 && v(e, t, !1) : ie(e);
93
94
  } else if (e.key === "Enter" && !n)
94
95
  e.preventDefault(), c(!0);
95
- else if (e.key === "Enter" && o === -1)
96
- e.preventDefault(), H(e);
97
- else if (e.key === "Enter" && o != null && u[o] != null) {
96
+ else if (e.key === "Enter" && r === -1)
97
+ e.preventDefault(), z(e);
98
+ else if (e.key === "Enter" && r != null && u[r] != null) {
98
99
  e.preventDefault();
99
- const t = u[o];
100
- _(t) || v(e, t, !0);
100
+ const t = u[r];
101
+ $(t) || v(e, t, !0);
101
102
  } else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
102
103
  if (e.preventDefault(), !n) {
103
104
  x(Ge(e.key === "ArrowDown" ? 1 : -1)), c(!0);
@@ -106,19 +107,19 @@ function Vt({ dataTest: l, options: b, renderInput: me, value: N, onChange: C, g
106
107
  Je(e.key === "ArrowDown" ? 1 : -1);
107
108
  } else if (e.key === "Home" || e.key === "End")
108
109
  e.preventDefault(), x(h[e.key === "Home" ? 0 : h.length - 1] ?? null);
109
- else if (e.key === " " && o === -1)
110
- e.preventDefault(), H(e);
111
- else if (e.key === " " && o != null && u[o] != null) {
110
+ else if (e.key === " " && r === -1)
111
+ e.preventDefault(), z(e);
112
+ else if (e.key === " " && r != null && u[r] != null) {
112
113
  e.preventDefault();
113
- const t = u[o];
114
- _(t) || v(e, t, !1);
114
+ const t = u[r];
115
+ $(t) || v(e, t, !1);
115
116
  } else e.key === "Escape" && n ? (e.preventDefault(), e.stopPropagation(), c(!1)) : e.key === "Tab" && c(!1);
116
- }, ie = !ve && !g && !S && (s ? i.length > 0 : w !== null);
117
- let ce;
118
- n && o != null && (o === -1 || u[o] !== void 0) && (ce = o === -1 ? `${l}-select-all` : `${l}-option-${o}`);
117
+ }, ce = !De && !g && !S && (s ? i.length > 0 : y !== null);
118
+ let de;
119
+ n && r != null && (r === -1 || u[r] !== void 0) && (de = r === -1 ? `${l}-select-all` : `${l}-option-${r}`);
119
120
  const Xe = (e) => {
120
- e.preventDefault(), !(S || g) && (K.current?.focus(), c(!n));
121
- }, Ze = s ? Y ? Y(i, ({ index: e }) => ({ "data-index": e })) : i.map((e, t) => /* @__PURE__ */ r(ht, {
121
+ e.preventDefault(), !(S || g) && (ee.current?.focus(), c(!n));
122
+ }, Ze = s ? Y ? Y(i, ({ index: e }) => ({ "data-index": e })) : i.map((e, t) => /* @__PURE__ */ o(ht, {
122
123
  dataTest: `selected-chip-${d(e)}`,
123
124
  label: d(e),
124
125
  readOnly: g,
@@ -127,26 +128,26 @@ function Vt({ dataTest: l, options: b, renderInput: me, value: N, onChange: C, g
127
128
  }, A ? A(e) : `${d(e)}-${t}`)) : void 0, Ke = /* @__PURE__ */ I("span", {
128
129
  className: "flex items-center gap-1",
129
130
  children: [
130
- q && /* @__PURE__ */ r(gt, {
131
+ q && /* @__PURE__ */ o(xt, {
131
132
  width: 20,
132
133
  height: 20,
133
134
  className: "animate-spin"
134
135
  }),
135
- ie && /* @__PURE__ */ r("button", {
136
+ ce && /* @__PURE__ */ o("button", {
136
137
  type: "button",
137
138
  tabIndex: -1,
138
139
  "aria-label": "Clear",
139
140
  "data-testid": `${l}-clear`,
140
141
  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",
141
142
  onMouseDown: (e) => e.preventDefault(),
142
- onClick: ae,
143
- children: /* @__PURE__ */ r(pt, {
143
+ onClick: ie,
144
+ children: /* @__PURE__ */ o(pt, {
144
145
  width: 20,
145
146
  height: 20,
146
147
  className: "text-delta-700"
147
148
  })
148
149
  }),
149
- g ? null : /* @__PURE__ */ r("button", {
150
+ g ? null : /* @__PURE__ */ o("button", {
150
151
  type: "button",
151
152
  tabIndex: -1,
152
153
  "aria-label": "Toggle options",
@@ -155,11 +156,11 @@ function Vt({ dataTest: l, options: b, renderInput: me, value: N, onChange: C, g
155
156
  className: "flex cursor-pointer items-center border-0 bg-transparent",
156
157
  onMouseDown: (e) => e.preventDefault(),
157
158
  onClick: Xe,
158
- children: Ie ?? (s ? /* @__PURE__ */ r(mt, {
159
+ children: Ne ?? (s ? /* @__PURE__ */ o(mt, {
159
160
  width: 24,
160
161
  height: 24,
161
162
  className: "text-delta-700"
162
- }) : /* @__PURE__ */ r(ut, {
163
+ }) : /* @__PURE__ */ o(ut, {
163
164
  width: 24,
164
165
  height: 24,
165
166
  className: E(B["select-custom-icon"], n && B["select-custom-icon-open"], "text-delta-700")
@@ -168,25 +169,25 @@ function Vt({ dataTest: l, options: b, renderInput: me, value: N, onChange: C, g
168
169
  ]
169
170
  }), et = {
170
171
  disabled: S,
171
- size: ye,
172
+ size: ke,
172
173
  fullWidth: !0,
173
- error: xe,
174
+ error: ye,
174
175
  helperText: we,
175
176
  value: m,
176
177
  onChange: (e) => {
177
- x(null), $(e, e.target.value, "input"), n || c(!0);
178
+ x(null), _(e, e.target.value, "input"), n || c(!0);
178
179
  },
179
180
  onKeyDown: Qe,
180
181
  slotProps: {
181
182
  htmlInput: {
182
183
  ...Ue(),
183
- ref: K,
184
+ ref: ee,
184
185
  onClick: () => c(!0),
185
186
  role: "combobox",
186
187
  "aria-autocomplete": "list",
187
188
  "aria-expanded": n,
188
- "aria-controls": n ? X : void 0,
189
- "aria-activedescendant": ce,
189
+ "aria-controls": n ? Z : void 0,
190
+ "aria-activedescendant": de,
190
191
  autoComplete: "off",
191
192
  readOnly: g
192
193
  },
@@ -196,38 +197,38 @@ function Vt({ dataTest: l, options: b, renderInput: me, value: N, onChange: C, g
196
197
  endAdornment: Ke
197
198
  }
198
199
  }
199
- }, tt = E("asma-pressable", "relative box-border flex cursor-pointer items-center gap-x-3 px-3 py-2 text-base text-delta-800", ke === "regular" ? "min-h-12" : "min-h-10", "aria-selected:bg-gama-50 hover:bg-delta-50", "aria-disabled:cursor-default aria-disabled:!bg-transparent aria-disabled:text-delta-300"), lt = (e, t, a) => {
200
- const { key: p, ...y } = e;
200
+ }, tt = E("asma-pressable", "relative box-border flex cursor-pointer items-center gap-x-3 px-3 py-2 text-base text-delta-800", ve === "regular" ? "min-h-12" : "min-h-10", "aria-selected:bg-gama-50 hover:bg-delta-50", "aria-disabled:cursor-default aria-disabled:!bg-transparent aria-disabled:text-delta-300"), lt = (e, t, a) => {
201
+ const { key: p, ...w } = e;
201
202
  return /* @__PURE__ */ I("li", {
202
- ...y,
203
+ ...w,
203
204
  children: [
204
- e["data-active"] !== void 0 && /* @__PURE__ */ r("span", {
205
+ e["data-active"] !== void 0 && /* @__PURE__ */ o("span", {
205
206
  "aria-hidden": "true",
206
207
  className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
207
208
  }),
208
- s ? /* @__PURE__ */ r(de, {
209
+ s ? /* @__PURE__ */ o(ue, {
209
210
  dataTest: `${l}-${d(t)}-checkbox`,
210
211
  checked: a.selected,
211
212
  size: "medium",
212
213
  checkboxClassName: "!h-4 !w-4",
213
214
  hideWrapper: !0,
214
215
  decorative: !0
215
- }) : /* @__PURE__ */ r("span", {
216
+ }) : /* @__PURE__ */ o("span", {
216
217
  className: "w-5",
217
- children: a.selected && /* @__PURE__ */ r(ft, {
218
+ children: a.selected && /* @__PURE__ */ o(ft, {
218
219
  width: 20,
219
220
  height: 20,
220
221
  className: "text-gama-500"
221
222
  })
222
223
  }),
223
- /* @__PURE__ */ r("span", {
224
+ /* @__PURE__ */ o("span", {
224
225
  className: "line-clamp-2 min-w-0 flex-1 break-words",
225
226
  children: d(t)
226
227
  })
227
228
  ]
228
229
  }, p);
229
230
  }, st = (e, t) => {
230
- const a = _(e), p = {
231
+ const a = $(e), p = {
231
232
  ...Te({
232
233
  onMouseDown: (f) => f.preventDefault(),
233
234
  onClick: (f) => {
@@ -237,83 +238,85 @@ function Vt({ dataTest: l, options: b, renderInput: me, value: N, onChange: C, g
237
238
  }),
238
239
  key: A ? String(A(e)) : `${d(e)}-${t}`,
239
240
  ref: (f) => {
240
- Z.current[t] = f;
241
+ K.current[t] = f;
241
242
  },
242
243
  role: "option",
243
244
  id: `${l}-option-${t}`,
244
- "aria-selected": F(e),
245
+ "aria-selected": W(e),
245
246
  "aria-disabled": a || void 0,
246
- "data-active": o === t ? "" : void 0,
247
+ "data-active": r === t ? "" : void 0,
247
248
  className: tt
248
- }, y = {
249
- selected: F(e),
249
+ }, w = {
250
+ selected: W(e),
250
251
  index: t,
251
252
  inputValue: m
252
253
  };
253
- return T ? T(p, e, y) : lt(p, e, y);
254
- }, ot = !!(M && s), W = b.length > 0 && i.length === b.length, rt = i.length > 0 && !W;
254
+ return T ? T(p, e, w) : lt(p, e, w);
255
+ }, rt = !!(M && s), H = b.length > 0 && i.length === b.length, ot = i.length > 0 && !H;
255
256
  return /* @__PURE__ */ I("div", {
256
- className: E(B.styledSelectAutocompleteWrapper, !Se && "w-auto", Le, _e),
257
- children: [me(et), n && /* @__PURE__ */ r(xt, {
258
- root: ne,
257
+ className: E(B.styledSelectAutocompleteWrapper, Le, $e),
258
+ "data-field-width": G,
259
+ style: gt(G),
260
+ children: [he(et), n && /* @__PURE__ */ o(yt, {
261
+ root: ae,
259
262
  children: /* @__PURE__ */ I("ul", {
260
263
  ref: qe,
261
- ...z ? nt : {},
264
+ ...j ? nt : {},
262
265
  style: {
263
- ...z ? at : {},
266
+ ...j ? at : {},
264
267
  ...Be,
265
- width: ze ?? void 0,
266
- maxHeight: ee ?? void 0,
268
+ width: je ?? void 0,
269
+ maxHeight: te ?? void 0,
267
270
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
268
- ...J?.popper?.style
271
+ ...Q?.popper?.style
269
272
  },
270
273
  ...Ve(),
271
- id: X,
274
+ id: Z,
272
275
  role: "listbox",
273
276
  "aria-multiselectable": s ? !0 : void 0,
274
- className: E("z-[1300] m-0 list-none overflow-auto rounded border border-solid border-delta-300 bg-white px-0 py-2 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", ot && "py-0", "[&>li:not(:last-child)]:shadow-[inset_0_-1px_0_var(--colors-delta-200)]", Me?.listbox, J?.popper?.className),
277
+ className: E("z-[1300] m-0 list-none overflow-auto rounded border border-solid border-delta-300 bg-white px-0 py-2 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", rt && "py-0", "[&>li:not(:last-child)]:shadow-[inset_0_-1px_0_var(--colors-delta-200)]", Me?.listbox, Q?.popper?.className),
275
278
  children: [M && s && /* @__PURE__ */ I("li", {
276
279
  id: `${l}-select-all`,
277
280
  role: "option",
278
- "aria-selected": W,
279
- "data-active": o === -1 ? "" : void 0,
281
+ "aria-selected": H,
282
+ "data-active": r === -1 ? "" : void 0,
280
283
  tabIndex: -1,
281
284
  onMouseDown: (e) => e.preventDefault(),
282
- onClick: H,
285
+ onClick: z,
283
286
  onMouseMove: () => x(null),
284
287
  className: "relative box-border flex h-8 cursor-pointer items-center gap-x-3 bg-[var(--colors-gray-10)] px-3 text-xs font-semibold uppercase tracking-[0.2px] text-delta-600 hover:bg-delta-50",
285
288
  children: [
286
- o === -1 && /* @__PURE__ */ r("span", {
289
+ r === -1 && /* @__PURE__ */ o("span", {
287
290
  "aria-hidden": "true",
288
291
  className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
289
292
  }),
290
- /* @__PURE__ */ r(de, {
293
+ /* @__PURE__ */ o(ue, {
291
294
  dataTest: `${l}-select-all`,
292
- checked: W,
293
- indeterminate: rt,
295
+ checked: H,
296
+ indeterminate: ot,
294
297
  size: "medium",
295
298
  checkboxClassName: "!h-4 !w-4",
296
299
  hideWrapper: !0,
297
300
  decorative: !0
298
301
  }),
299
- /* @__PURE__ */ r("span", {
302
+ /* @__PURE__ */ o("span", {
300
303
  className: "flex-1 truncate",
301
- children: Ae
304
+ children: Se
302
305
  })
303
306
  ]
304
- }), q ? /* @__PURE__ */ r("li", {
307
+ }), q ? /* @__PURE__ */ o("li", {
305
308
  role: "presentation",
306
309
  className: "px-3 py-2 text-sm text-delta-600",
307
- children: be
308
- }) : u.length === 0 ? /* @__PURE__ */ r("li", {
310
+ children: ge
311
+ }) : u.length === 0 ? /* @__PURE__ */ o("li", {
309
312
  role: "presentation",
310
313
  className: "px-3 py-2 text-sm text-delta-600",
311
- children: ge
314
+ children: xe
312
315
  }) : u.map(st)]
313
316
  })
314
317
  })]
315
318
  });
316
319
  }
317
320
  export {
318
- Vt as StyledSelectAutocomplete
321
+ qt as StyledSelectAutocomplete
319
322
  };
@@ -18,7 +18,7 @@ function Bt({ dataTest: i, min: r = 0, max: a = 100, step: h = 1, value: T, defa
18
18
  if (U?.length && Ut(U)) return /* @__PURE__ */ c(Dt, {
19
19
  dataTest: i,
20
20
  disableClearable: !0,
21
- className: u("min-w-[200px]", st),
21
+ className: st,
22
22
  size: "small",
23
23
  disabled: s,
24
24
  error: N,
@@ -103,7 +103,7 @@ function Bt({ dataTest: i, min: r = 0, max: a = 100, step: h = 1, value: T, defa
103
103
  onKeyUp: (e) => A(H, e, Number(e.currentTarget.value), t)
104
104
  }, t);
105
105
  return /* @__PURE__ */ x("div", {
106
- className: u("flex max-w-[600px] flex-col gap-3", n && "h-full"),
106
+ className: u("flex max-w-form-column flex-col gap-3", n && "h-full"),
107
107
  children: [
108
108
  !n && (D ?? $) && /* @__PURE__ */ x("div", {
109
109
  className: "grid w-full grid-cols-2 gap-4",
@@ -1,74 +1,72 @@
1
- import { useHelperSlot as R } from "../../../helpers/useHelperSlot.js";
2
- import e from "./StyledTextarea.module.js";
3
- import { useEffect as U, useId as x, 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: g = "active", label: d = "", labelClassName: A = "", description: l = "", reserveHelperText: M, value: t = "", minRows: r = 3, maxRows: i = 1 / 0, disabled: y, error: a, errorMessage: j, containerClassName: _ = "", className: w = "", maxLength: B = 1 / 0, counter: E, refLink: k, dataTest: C, counterLimit: p, ...h }) => {
6
- const q = V(null), f = k ?? q, s = !!(E && p), b = x(), u = x(), z = x(), $ = H ?? z, v = a ? j : l, { show: N, role: D } = R("StyledTextarea", a, v, M);
7
- U(() => {
8
- const o = f.current;
1
+ import { CharacterCounter as R } from "../../../helpers/CharacterCounter.js";
2
+ import { useHelperSlot as U } from "../../../helpers/useHelperSlot.js";
3
+ import { fieldWidthStyle as V } from "../field-styles.js";
4
+ import t from "./StyledTextarea.module.js";
5
+ import { useEffect as X, useId as m, useRef as Y } from "react";
6
+ import { jsx as e, jsxs as Z } from "react/jsx-runtime";
7
+ var nt = ({ id: A, variant: h = "active", label: s = "", labelClassName: M = "", description: n = "", reserveHelperText: F, value: a = "", minRows: r = 3, maxRows: i = 1 / 0, disabled: x, error: l, errorMessage: _, containerClassName: j = "", className: w = "", maxLength: B = 1 / 0, counter: C, refLink: E, dataTest: k, counterLimit: g, width: y = "full", locale: W, ...d }) => {
8
+ const q = Y(null), c = E ?? q, f = !!(C && g), u = m(), b = m(), z = m(), $ = A ?? z, I = l ? _ : n, { show: N, role: D } = U("StyledTextarea", l, I, F);
9
+ X(() => {
10
+ const o = c.current;
9
11
  if (!o) return;
10
- const m = window.getComputedStyle(o), S = parseFloat(m.lineHeight) || 24, T = parseFloat(m.paddingTop), F = parseFloat(m.paddingBottom);
12
+ const p = window.getComputedStyle(o), v = parseFloat(p.lineHeight) || 24, T = parseFloat(p.paddingTop), H = parseFloat(p.paddingBottom);
11
13
  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`;
14
+ const K = o.scrollHeight - T - H, O = Math.max(1, Math.ceil(K / v)), Q = Math.min(Math.max(O, r), i);
15
+ o.style.height = `${Q * v + T + H}px`;
14
16
  }, [
15
- f,
16
- t,
17
+ c,
18
+ a,
17
19
  r,
18
20
  i,
19
- s
21
+ f
20
22
  ]), i < r && (r = i);
21
- const G = a ? "error" : "active", I = a ? "error" : y ? "disabled" : "active", J = typeof d != "string" || d.trim() !== "" ? void 0 : typeof l == "string" && l.trim() !== "" ? l : h.placeholder;
22
- return /* @__PURE__ */ c("div", {
23
- className: `relative flex flex-col gap-1 ${_}`,
24
- "data-testid": C,
23
+ const G = l ? "error" : "active", S = l ? "error" : x ? "disabled" : "active", J = typeof s != "string" || s.trim() !== "" ? void 0 : typeof n == "string" && n.trim() !== "" ? n : d.placeholder;
24
+ return /* @__PURE__ */ Z("div", {
25
+ className: `relative flex flex-col gap-1 ${j}`,
26
+ "data-testid": k,
27
+ "data-field-width": y,
28
+ style: V(y),
25
29
  children: [
26
- /* @__PURE__ */ n("label", {
30
+ /* @__PURE__ */ e("label", {
27
31
  htmlFor: $,
28
- className: `${e.label} ${e[I]} ${A}`,
29
- children: d
32
+ className: `${t.label} ${t[S]} ${M}`,
33
+ children: s
30
34
  }),
31
- N && /* @__PURE__ */ n("span", {
32
- id: b,
35
+ N && /* @__PURE__ */ e("span", {
36
+ id: u,
33
37
  role: D,
34
- className: `${e.description} ${e[I]} min-h-[24px]`,
35
- children: v
38
+ className: `${t.description} ${t[S]} min-h-[24px]`,
39
+ children: I
36
40
  }),
37
- g === "view_only" ? /* @__PURE__ */ n("div", {
41
+ h === "view_only" ? /* @__PURE__ */ e("div", {
38
42
  className: "pt-3 font-roboto text-base font-normal text-delta-700",
39
- children: t
40
- }) : g === "not_editable" ? /* @__PURE__ */ n("div", {
43
+ children: a
44
+ }) : h === "not_editable" ? /* @__PURE__ */ e("div", {
41
45
  className: "rounded bg-delta-50 p-3 font-roboto text-base font-normal text-delta-700",
42
- children: t
43
- }) : /* @__PURE__ */ n("textarea", {
44
- ...h,
45
- "aria-describedby": [N ? b : null, s ? u : null].filter(Boolean).join(" ") || void 0,
46
- "aria-invalid": a,
47
- "aria-label": h["aria-label"] ?? J,
46
+ children: a
47
+ }) : /* @__PURE__ */ e("textarea", {
48
+ ...d,
49
+ "aria-describedby": [N ? u : null, f ? b : null].filter(Boolean).join(" ") || void 0,
50
+ "aria-invalid": l,
51
+ "aria-label": d["aria-label"] ?? J,
48
52
  id: $,
49
- ref: f,
50
- className: `${e.textarea} ${e[G]} ${w} ${s ? "pb-[32px]" : ""}`,
53
+ ref: c,
54
+ className: `${t.textarea} ${t[G]} ${w}`,
51
55
  wrap: "soft",
52
- value: t,
53
- disabled: y,
56
+ value: a,
57
+ disabled: x,
54
58
  maxLength: B
55
59
  }),
56
- s && /* @__PURE__ */ c(W, { children: [/* @__PURE__ */ c("div", {
57
- className: "pointer-events-none absolute bottom-3 right-3 flex h-[15px] justify-end font-roboto text-[10px]",
58
- children: [
59
- t.length,
60
- "/",
61
- p
62
- ]
63
- }), /* @__PURE__ */ c("div", {
64
- id: u,
65
- "aria-live": "polite",
66
- className: "sr-only",
67
- children: [p - t.length, " characters remaining"]
68
- })] })
60
+ f && /* @__PURE__ */ e(R, {
61
+ id: b,
62
+ length: a.length,
63
+ limit: g,
64
+ locale: W,
65
+ className: "self-end"
66
+ })
69
67
  ]
70
68
  });
71
69
  };
72
70
  export {
73
- tt as StyledTextarea
71
+ nt as StyledTextarea
74
72
  };
@@ -1,11 +1,11 @@
1
- var a = "_textarea_dmh6s_1", e = "_active_dmh6s_1", _ = "_error_dmh6s_41", r = "_label_dmh6s_82", d = "_disabled_dmh6s_90", t = "_description_dmh6s_95", s = {
1
+ var a = "_textarea_lhzo8_1", e = "_active_lhzo8_1", _ = "_error_lhzo8_41", r = "_label_lhzo8_82", l = "_disabled_lhzo8_90", t = "_description_lhzo8_95", o = {
2
2
  textarea: a,
3
3
  active: e,
4
4
  error: _,
5
5
  label: r,
6
- disabled: d,
6
+ disabled: l,
7
7
  description: t
8
8
  };
9
9
  export {
10
- s as default
10
+ o as default
11
11
  };