asma-ui-core 3.108.4 → 3.110.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 (58) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/data-display/interactive-chip/StyledInteractiveChip.js +18 -18
  3. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +17 -15
  4. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +26 -24
  5. package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +59 -55
  6. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +88 -84
  7. package/dist/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.js +15 -11
  8. package/dist/components/inputs/dynamic-select/components/DynamicSelectTitle.js +9 -0
  9. package/dist/components/inputs/field-styles.js +16 -6
  10. package/dist/components/inputs/form-layout/StyledFieldPair.js +22 -0
  11. package/dist/components/inputs/form-layout/StyledFieldPair.module.js +8 -0
  12. package/dist/components/inputs/form-layout/StyledFormColumn.js +13 -0
  13. package/dist/components/inputs/input-field/StyledInputField.js +235 -198
  14. package/dist/components/inputs/phone-field/StyledPhoneField.js +41 -39
  15. package/dist/components/inputs/search-field/StyledSearchField.js +22 -20
  16. package/dist/components/inputs/select/StyledSelect.js +110 -108
  17. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +111 -108
  18. package/dist/components/inputs/slider/StyledSlider.js +2 -2
  19. package/dist/components/inputs/textarea/StyledTextarea.js +50 -52
  20. package/dist/components/inputs/textarea/StyledTextarea.module.js +3 -3
  21. package/dist/components/miscellaneous/StyledFormControl.js +29 -25
  22. package/dist/components/miscellaneous/StyledInputLabel.js +28 -18
  23. package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +137 -122
  24. package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.js +17 -15
  25. package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.module.js +2 -2
  26. package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +9 -8
  27. package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectMonth.js +17 -14
  28. package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectYear.js +14 -9
  29. package/dist/datetime/components/time-picker/StyledTimePicker.js +78 -74
  30. package/dist/datetime/components/time-picker/TimePickerInput.js +43 -41
  31. package/dist/datetime/components/time-picker/helpers/timePickerWidth.js +12 -0
  32. package/dist/helpers/CharacterCounter.js +21 -0
  33. package/dist/index.js +219 -211
  34. package/dist/src/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.d.ts +2 -2
  35. package/dist/src/components/inputs/dynamic-select/components/DynamicSelectTitle.d.ts +14 -0
  36. package/dist/src/components/inputs/dynamic-select/types.d.ts +11 -2
  37. package/dist/src/components/inputs/field-styles.d.ts +22 -0
  38. package/dist/src/components/inputs/form-layout/StyledFieldPair.d.ts +18 -0
  39. package/dist/src/components/inputs/form-layout/StyledFormColumn.d.ts +12 -0
  40. package/dist/src/components/inputs/form-layout/index.d.ts +4 -0
  41. package/dist/src/components/inputs/input-field/StyledInputField.d.ts +19 -4
  42. package/dist/src/components/inputs/select/StyledSelect.d.ts +7 -2
  43. package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +5 -1
  44. package/dist/src/components/inputs/textarea/StyledTextarea.d.ts +6 -0
  45. package/dist/src/components/miscellaneous/StyledFormControl.d.ts +5 -2
  46. package/dist/src/components/miscellaneous/StyledInputLabel.d.ts +7 -5
  47. package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +2 -0
  48. package/dist/src/datetime/components/date-picker/types.d.ts +3 -0
  49. package/dist/src/datetime/components/time-picker/helpers/timePickerWidth.d.ts +7 -0
  50. package/dist/src/datetime/components/time-picker/types.d.ts +3 -1
  51. package/dist/src/helpers/CharacterCounter.d.ts +16 -0
  52. package/dist/src/helpers/CharacterCounter.test.d.ts +1 -0
  53. package/dist/src/index.d.ts +1 -0
  54. package/dist/tailwind.config.d.ts +14 -0
  55. package/package.json +1 -1
  56. package/src/styles/fieldWidthTokens.css +8 -0
  57. package/src/styles/index.css +1 -0
  58. package/tw-configs/twConfigs.json +14 -0
@@ -1,231 +1,268 @@
1
- import { cn as r } from "../../../helpers/cn.js";
2
- import { resolveSx as P } from "../../../helpers/sx.js";
3
- import { CloseIcon as tt } from "../../icons/close-icon/CloseIcon.js";
4
- import { HelperRow as nt } from "../../../helpers/HelperRow.js";
5
- import { useHelperRowBudget as ot } from "../../../helpers/useHelperRowBudget.js";
6
- import { useHelperSlot as it } from "../../../helpers/useHelperSlot.js";
7
- import { floatingLabelClass as st, floatingLabelLayoutStyle as lt, notchedLegendClass as rt, notchedOutlineClass as ne, singleLineInputLayoutStyle as at, singleLineShellLayoutStyle as dt } from "../field-styles.js";
8
- import g from "./StyledInputField.module.js";
9
- import { Children as ct, useCallback as oe, useId as ut, useLayoutEffect as A, useRef as z, useState as $ } from "react";
10
- import { jsx as s, jsxs as S } from "react/jsx-runtime";
11
- import { useMergeRefs as ie } from "@floating-ui/react";
12
- var Tt = ({ dataTest: x, label: a, value: b, defaultValue: v, onChange: se, onBlur: le, onFocus: re, error: m, helperText: j, reserveHelperText: ae, expandHelperText: de = !0, disabled: c, readOnly: t, required: N, allowClear: ce, onClear: ue, type: pe = "text", placeholder: me, name: he, id: fe, autoComplete: ge, autoFocus: xe, multiline: o, rows: L, minRows: C, maxRows: w, size: be = "medium", fullWidth: W, className: ye, style: Se, sx: ve, inputRef: Le, slotProps: n, InputProps: K, onKeyDown: U, onClick: He, variant: pt }) => {
13
- const Ie = ut(), F = fe ?? Ie, V = `${F}-helper-text`, _ = z(null), M = z(0), Y = z(null), [Re, Ae] = $(void 0), [H, G] = $(!1), [Ne, J] = $(v != null && v !== ""), B = b !== void 0, Q = B ? b !== "" && b != null : Ne, Ce = !!c || !!t, k = n?.input?.startAdornment ?? K?.startAdornment, y = ct.count(k) > 0, u = y && Array.isArray(k), h = n?.input?.endAdornment ?? K?.endAdornment, I = !!(ce && Q && !Ce), { ref: we, ...l } = n?.htmlInput ?? {}, Fe = Le ?? we, { className: _e, style: E, ref: Me } = n?.input ?? {}, Be = ie([Me]), ke = n?.input?.onMouseDown, X = n?.input?.onClick, Ee = X ? { onClick: X } : {}, Te = ge ?? l.autoComplete, De = he ?? l.name, R = H || Q || y, p = oe(() => {
14
- const e = _.current;
15
- if (!(!o || !e) && (M.current = e.offsetWidth, M.current !== 0)) {
16
- if (e.removeAttribute("data-scrollable"), L != null && !t) e.style.height = "";
1
+ import { cn as l } from "../../../helpers/cn.js";
2
+ import { resolveSx as v } from "../../../helpers/sx.js";
3
+ import { CloseIcon as pt } from "../../icons/close-icon/CloseIcon.js";
4
+ import { CharacterCounter as gt } from "../../../helpers/CharacterCounter.js";
5
+ import { HelperRow as re } from "../../../helpers/HelperRow.js";
6
+ import { useHelperRowBudget as ft } from "../../../helpers/useHelperRowBudget.js";
7
+ import { useHelperSlot as xt } from "../../../helpers/useHelperSlot.js";
8
+ import { fieldLabelAboveClass as bt, fieldWidthStyle as yt, floatingLabelClass as Lt, floatingLabelLayoutStyle as St, notchedLegendClass as vt, notchedOutlineClass as de, singleLineInputLayoutStyle as Ht, singleLineShellLayoutStyle as It } from "../field-styles.js";
9
+ import b from "./StyledInputField.module.js";
10
+ import { Children as Nt, useCallback as ce, useId as At, useLayoutEffect as B, useRef as G, useState as M } from "react";
11
+ import { jsx as o, jsxs as p } from "react/jsx-runtime";
12
+ import { useMergeRefs as he } from "@floating-ui/react";
13
+ var Ot = ({ dataTest: y, label: r, labelPlacement: me = "above", value: g, defaultValue: L, onChange: ue, onBlur: pe, onFocus: ge, error: h, helperText: E, reserveHelperText: fe, expandHelperText: xe = !0, maxLength: be, counter: ye, locale: Le, disabled: d, readOnly: n, required: H, allowClear: Se, onClear: ve, type: He = "text", placeholder: Ie, name: Ne, id: Ae, autoComplete: Ce, autoFocus: Re, multiline: i, rows: I, minRows: k, maxRows: T, size: we = "medium", width: J = "full", fullWidth: Ct, className: Fe, style: _e, sx: Be, inputRef: Me, slotProps: t, InputProps: Q, onKeyDown: V, onClick: Ee, variant: Rt }) => {
14
+ const ke = At(), D = Ae ?? ke, W = `${D}-helper-text`, $ = G(null), j = G(0), X = G(null), [Te, De] = M(void 0), [N, Z] = M(!1), [We, q] = M(L != null && L !== ""), [$e, je] = M(String(L ?? "").length), A = g !== void 0, O = A ? g !== "" && g != null : We, ze = !!d || !!n, z = t?.input?.startAdornment ?? Q?.startAdornment, S = Nt.count(z) > 0, m = S && Array.isArray(z), f = t?.input?.endAdornment ?? Q?.endAdornment, C = !!(Se && O && !ze), { ref: Ue, ...a } = t?.htmlInput ?? {}, Ke = Me ?? Ue, { className: Pe, style: U, ref: Ye } = t?.input ?? {}, Ge = he([Ye]), Je = t?.input?.onMouseDown, ee = t?.input?.onClick, Qe = ee ? { onClick: ee } : {}, Ve = Ce ?? a.autoComplete, Xe = Ne ?? a.name, K = a.id ?? D, R = be ?? a.maxLength, te = `${D}-counter`, P = !!(ye && R && !n), Ze = A ? String(g ?? "").length : $e, w = me === "floating" && !!r, F = N || O || S, u = ce(() => {
15
+ const e = $.current;
16
+ if (!(!i || !e) && (j.current = e.offsetWidth, j.current !== 0)) {
17
+ if (e.removeAttribute("data-scrollable"), I != null && !n) e.style.height = "";
17
18
  else {
18
19
  if (e.style.height = "auto", e.scrollHeight === 0) {
19
20
  e.style.height = "";
20
21
  return;
21
22
  }
22
- const i = getComputedStyle(e), d = Number.parseFloat(i.lineHeight) || 24, ee = Number.parseFloat(i.paddingTop) + Number.parseFloat(i.paddingBottom), te = L ?? C, Oe = te ? te * d + ee : 0, et = t || !w ? Number.POSITIVE_INFINITY : w * d + ee;
23
- e.style.height = `${Math.min(et, Math.max(Oe, e.scrollHeight))}px`;
23
+ const s = getComputedStyle(e), c = Number.parseFloat(s.lineHeight) || 24, ae = Number.parseFloat(s.paddingTop) + Number.parseFloat(s.paddingBottom), se = I ?? k, mt = se ? se * c + ae : 0, ut = n || !T ? Number.POSITIVE_INFINITY : T * c + ae;
24
+ e.style.height = `${Math.min(ut, Math.max(mt, e.scrollHeight))}px`;
24
25
  }
25
26
  e.scrollHeight > e.clientHeight + 1 && e.setAttribute("data-scrollable", "true");
26
27
  }
27
28
  }, [
28
- w,
29
- C,
30
- o,
31
- t,
32
- L
33
- ]), Pe = (e) => {
34
- t || (B || (J(e.target.value !== ""), p()), se?.(e));
35
- }, ze = (e) => {
36
- !c && !t && G(!0), re?.(e);
37
- }, $e = (e) => {
38
- !c && !t && G(!1), le?.(e);
29
+ T,
30
+ k,
31
+ i,
32
+ n,
33
+ I
34
+ ]), qe = (e) => {
35
+ n || (A || (q(e.target.value !== ""), je(e.target.value.length), u()), ue?.(e));
36
+ }, Oe = (e) => {
37
+ !d && !n && Z(!0), ge?.(e);
38
+ }, et = (e) => {
39
+ !d && !n && Z(!1), pe?.(e);
39
40
  };
40
- A(() => {
41
- p();
41
+ B(() => {
42
+ u();
42
43
  }, [
43
- p,
44
- v,
45
- b
46
- ]), A(() => {
47
- if (!o || !document.fonts) return;
48
- const e = () => p();
44
+ u,
45
+ L,
46
+ g
47
+ ]), B(() => {
48
+ if (!i || !document.fonts) return;
49
+ const e = () => u();
49
50
  return document.fonts.addEventListener("loadingdone", e), () => document.fonts.removeEventListener("loadingdone", e);
50
- }, [o, p]), A(() => {
51
- const e = _.current;
52
- if (!o || !e || typeof ResizeObserver > "u") return;
53
- let i = 0;
54
- const d = new ResizeObserver(() => {
55
- e.offsetWidth !== M.current && (cancelAnimationFrame(i), i = requestAnimationFrame(p));
51
+ }, [i, u]), B(() => {
52
+ const e = $.current;
53
+ if (!i || !e || typeof ResizeObserver > "u") return;
54
+ let s = 0;
55
+ const c = new ResizeObserver(() => {
56
+ e.offsetWidth !== j.current && (cancelAnimationFrame(s), s = requestAnimationFrame(u));
56
57
  });
57
- return d.observe(e), () => {
58
- cancelAnimationFrame(i), d.disconnect();
58
+ return c.observe(e), () => {
59
+ cancelAnimationFrame(s), c.disconnect();
59
60
  };
60
- }, [o, p]);
61
- const Z = ie([Fe, oe((e) => {
62
- _.current = e instanceof HTMLTextAreaElement ? e : null;
63
- }, [])]), { style: T, ...je } = l, f = !o && !u, { height: mt, minHeight: ht, maxHeight: ft, paddingTop: gt, paddingBottom: xt, ...We } = E ?? {}, Ke = f ? {
64
- ...We,
65
- ...dt()
66
- } : u ? {
61
+ }, [i, u]);
62
+ const ne = he([Ke, ce((e) => {
63
+ $.current = e instanceof HTMLTextAreaElement ? e : null;
64
+ }, [])]), { style: Y, ...tt } = a, x = !i && !m, { height: wt, minHeight: Ft, maxHeight: _t, paddingTop: Bt, paddingBottom: Mt, ...nt } = U ?? {}, ot = x ? {
65
+ ...nt,
66
+ ...It()
67
+ } : m ? {
67
68
  boxSizing: "border-box",
68
69
  minHeight: 40,
69
- ...E
70
- } : E, { height: bt, minHeight: yt, maxHeight: St, paddingTop: vt, paddingBottom: Lt, paddingLeft: Ht, paddingRight: Ue, ...Ve } = T ?? {}, Ye = f ? {
71
- ...Ve,
72
- ...at({
73
- paddingLeft: y ? 40 : 14,
74
- paddingRight: Ue ?? Re ?? (I || h ? 40 : 14)
70
+ ...U
71
+ } : U, { height: Et, minHeight: kt, maxHeight: Tt, paddingTop: Dt, paddingBottom: Wt, paddingLeft: $t, paddingRight: it, ...lt } = Y ?? {}, at = x ? {
72
+ ...lt,
73
+ ...Ht({
74
+ paddingLeft: S ? 40 : 14,
75
+ paddingRight: it ?? Te ?? (C || f ? 40 : 14)
75
76
  })
76
- } : T;
77
- A(() => {
78
- if (!f) return;
79
- const e = Y.current, i = e ? Math.ceil(e.getBoundingClientRect().width) + 20 : void 0;
80
- Ae((d) => d === i ? d : i);
77
+ } : Y;
78
+ B(() => {
79
+ if (!x) return;
80
+ const e = X.current, s = e ? Math.ceil(e.getBoundingClientRect().width) + 20 : void 0;
81
+ De((c) => c === s ? c : s);
81
82
  }, [
82
- f,
83
- I,
84
- h
83
+ x,
84
+ C,
85
+ f
85
86
  ]);
86
- const Ge = R || !a, { show: D, role: Je } = it("StyledInputField", m, j, ae, t), { fieldRef: Qe, rowRef: Xe, rowStyle: Ze } = ot(de && D), q = {
87
- ...je,
88
- style: f ? Ye : T,
89
- id: l.id ?? F,
90
- name: De,
91
- placeholder: Ge ? me : void 0,
92
- disabled: c,
93
- readOnly: t,
94
- required: N,
95
- autoComplete: Te,
96
- autoFocus: xe,
97
- value: b,
98
- defaultValue: v,
99
- "aria-invalid": m ? !0 : void 0,
100
- "aria-label": l["aria-label"] ?? (l["aria-labelledby"] ? void 0 : typeof a == "string" && a !== "" ? a : void 0),
101
- "aria-describedby": D ? V : l["aria-describedby"],
102
- onChange: Pe,
103
- onFocus: ze,
104
- onBlur: $e,
105
- onKeyDown: l.onKeyDown || U ? (e) => {
106
- U?.(e), e.defaultPrevented || l.onKeyDown?.(e);
87
+ const st = F || !w, { show: _, role: oe } = xt("StyledInputField", h, E, fe, n), { fieldRef: rt, rowRef: dt, rowStyle: ct } = ft(xe && _ && !P), ie = {
88
+ ...tt,
89
+ style: x ? at : Y,
90
+ id: K,
91
+ name: Xe,
92
+ maxLength: R,
93
+ placeholder: st ? Ie : void 0,
94
+ disabled: d,
95
+ readOnly: n,
96
+ required: H,
97
+ autoComplete: Ve,
98
+ autoFocus: Re,
99
+ value: g,
100
+ defaultValue: L,
101
+ "aria-invalid": h ? !0 : void 0,
102
+ "aria-label": a["aria-label"] ?? (a["aria-labelledby"] ? void 0 : typeof r == "string" && r !== "" ? r : void 0),
103
+ "aria-describedby": [_ ? W : a["aria-describedby"], P ? te : void 0].filter(Boolean).join(" ") || void 0,
104
+ onChange: qe,
105
+ onFocus: Oe,
106
+ onBlur: et,
107
+ onKeyDown: a.onKeyDown || V ? (e) => {
108
+ V?.(e), e.defaultPrevented || a.onKeyDown?.(e);
107
109
  } : void 0
108
- }, O = r(g.Input, "peer border-0 bg-transparent text-base tracking-[0.00938em] text-delta-800 outline-none placeholder:text-delta-500", u ? "box-border h-8 min-w-[60px] flex-1 py-0 pl-0 pr-0 leading-[23px]" : o ? r("w-full resize-none p-0 pl-0 pr-0 leading-[23px]", g["Input--multiline"]) : r("w-full", g["Input--singleLine"]), "disabled:text-delta-300", t && "text-delta-800", _e), qe = !o && !u ? {
109
- "data-start-adornment": y ? "true" : void 0,
110
- "data-end-adornment": I || h ? "true" : void 0
110
+ }, le = l(b.Input, "peer border-0 bg-transparent text-base tracking-[0.00938em] text-delta-800 outline-none placeholder:text-delta-500", m ? "box-border h-8 min-w-[60px] flex-1 py-0 pl-0 pr-0 leading-[23px]" : i ? l("w-full resize-none p-0 pl-0 pr-0 leading-[23px]", b["Input--multiline"]) : l("w-full", b["Input--singleLine"]), "disabled:text-delta-300", n && "text-delta-800", Pe), ht = !i && !m ? {
111
+ "data-start-adornment": S ? "true" : void 0,
112
+ "data-end-adornment": C || f ? "true" : void 0
111
113
  } : {};
112
- return /* @__PURE__ */ S("div", {
113
- ref: Qe,
114
- className: r("group relative min-w-0 flex-col", ye),
115
- onClick: He,
114
+ return /* @__PURE__ */ p("div", {
115
+ ref: rt,
116
+ className: l("group relative min-w-0 flex-col", Fe),
117
+ onClick: Ee,
118
+ "data-field-width": J,
116
119
  style: {
117
- display: W ? "flex" : "inline-flex",
118
- width: W ? "100%" : 235,
120
+ display: "flex",
121
+ ...yt(J),
119
122
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
120
123
  letterSpacing: "0.00938em",
121
- ...P(ve),
122
- ...Se
124
+ ...v(Be),
125
+ ..._e
123
126
  },
124
- children: [/* @__PURE__ */ S("div", {
125
- className: "relative overflow-visible",
126
- children: [/* @__PURE__ */ S("div", {
127
- className: r("relative flex", f && g.InputShell, o && "box-border items-center px-[14px] py-[16.5px]", u && r(g.AdornmentList, h && g["AdornmentList--endAdornment"]), t && "rounded bg-delta-50"),
128
- ref: Be,
129
- onMouseDown: ke,
130
- ...Ee,
131
- style: Ke,
132
- "data-testid": u ? `${x}-adornment-list` : `${x}-shell`,
133
- children: [
134
- y && /* @__PURE__ */ s("span", {
135
- className: r("items-center text-delta-500", u ? "contents" : "absolute left-3 flex"),
136
- children: k
137
- }),
138
- o ? /* @__PURE__ */ s("textarea", {
139
- ...q,
140
- ref: Z,
141
- "data-testid": x,
142
- rows: L ?? C ?? 2,
143
- className: O
144
- }) : /* @__PURE__ */ s("input", {
145
- ...q,
146
- ...qe,
147
- ref: Z,
148
- "data-testid": x,
149
- type: pe,
150
- className: O
151
- }),
152
- I ? /* @__PURE__ */ s("button", {
153
- type: "button",
154
- tabIndex: -1,
155
- "aria-label": "Clear",
156
- "data-testid": `${x}-clear`,
157
- 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",
158
- onClick: (e) => {
159
- e.stopPropagation(), e.preventDefault(), B || J(!1), ue?.();
160
- },
161
- children: /* @__PURE__ */ s(tt, {
162
- width: 18,
163
- height: 18
164
- })
165
- }) : h && /* @__PURE__ */ s("span", {
166
- ref: Y,
167
- className: "absolute inset-y-0 right-[14px] flex max-w-[calc(100%-28px)] items-center gap-1",
168
- children: h
169
- }),
170
- a ? /* @__PURE__ */ s("fieldset", {
171
- "aria-hidden": !0,
172
- className: ne({
173
- focused: H,
174
- error: m,
175
- disabled: c,
176
- readOnly: t,
177
- notched: !0
127
+ children: [
128
+ r && !w && /* @__PURE__ */ o("div", {
129
+ className: l(bt({ disabled: d }), t?.inputLabel?.className),
130
+ style: {
131
+ ...v(t?.inputLabel?.sx),
132
+ ...t?.inputLabel?.style
133
+ },
134
+ children: /* @__PURE__ */ p("label", {
135
+ htmlFor: K,
136
+ children: [r, H && /* @__PURE__ */ o("span", {
137
+ "aria-hidden": "true",
138
+ children: " *"
139
+ })]
140
+ })
141
+ }),
142
+ /* @__PURE__ */ p("div", {
143
+ className: "relative overflow-visible",
144
+ children: [/* @__PURE__ */ p("div", {
145
+ className: l("relative flex", x && b.InputShell, i && "box-border items-center px-[14px] py-[16.5px]", m && l(b.AdornmentList, f && b["AdornmentList--endAdornment"]), n && "rounded bg-delta-50"),
146
+ ref: Ge,
147
+ onMouseDown: Je,
148
+ ...Qe,
149
+ style: ot,
150
+ "data-testid": m ? `${y}-adornment-list` : `${y}-shell`,
151
+ children: [
152
+ S && /* @__PURE__ */ o("span", {
153
+ className: l("items-center text-delta-500", m ? "contents" : "absolute left-3 flex"),
154
+ children: z
155
+ }),
156
+ i ? /* @__PURE__ */ o("textarea", {
157
+ ...ie,
158
+ ref: ne,
159
+ "data-testid": y,
160
+ rows: I ?? k ?? 2,
161
+ className: le
162
+ }) : /* @__PURE__ */ o("input", {
163
+ ...ie,
164
+ ...ht,
165
+ ref: ne,
166
+ "data-testid": y,
167
+ type: He,
168
+ className: le
178
169
  }),
179
- children: /* @__PURE__ */ s("legend", {
180
- className: rt(R),
181
- children: /* @__PURE__ */ S("span", {
182
- className: "inline-block px-[5px]",
183
- children: [a, N && " *"]
170
+ C ? /* @__PURE__ */ o("button", {
171
+ type: "button",
172
+ tabIndex: -1,
173
+ "aria-label": "Clear",
174
+ "data-testid": `${y}-clear`,
175
+ 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",
176
+ onClick: (e) => {
177
+ e.stopPropagation(), e.preventDefault(), A || q(!1), ve?.();
178
+ },
179
+ children: /* @__PURE__ */ o(pt, {
180
+ width: 18,
181
+ height: 18
182
+ })
183
+ }) : f && /* @__PURE__ */ o("span", {
184
+ ref: X,
185
+ className: "absolute inset-y-0 right-[14px] flex max-w-[calc(100%-28px)] items-center gap-1",
186
+ children: f
187
+ }),
188
+ w ? /* @__PURE__ */ o("fieldset", {
189
+ "aria-hidden": !0,
190
+ className: de({
191
+ focused: N,
192
+ error: h,
193
+ disabled: d,
194
+ readOnly: n,
195
+ notched: !0
196
+ }),
197
+ children: /* @__PURE__ */ o("legend", {
198
+ className: vt(F),
199
+ children: /* @__PURE__ */ p("span", {
200
+ className: "inline-block px-[5px]",
201
+ children: [r, H && " *"]
202
+ })
203
+ })
204
+ }) : /* @__PURE__ */ o("div", {
205
+ "aria-hidden": !0,
206
+ className: de({
207
+ focused: N,
208
+ error: h,
209
+ disabled: d,
210
+ readOnly: n,
211
+ notched: !1
184
212
  })
185
213
  })
186
- }) : /* @__PURE__ */ s("div", {
187
- "aria-hidden": !0,
188
- className: ne({
189
- focused: H,
190
- error: m,
191
- disabled: c,
192
- readOnly: t,
193
- notched: !1
194
- })
195
- })
196
- ]
197
- }), a && /* @__PURE__ */ S("label", {
198
- htmlFor: F,
199
- className: r(st({
200
- shrink: R,
201
- focused: H,
202
- error: m,
203
- disabled: c,
204
- readOnly: t,
205
- size: be
206
- }), n?.inputLabel?.className),
214
+ ]
215
+ }), w && /* @__PURE__ */ p("label", {
216
+ htmlFor: K,
217
+ className: l(Lt({
218
+ shrink: F,
219
+ focused: N,
220
+ error: h,
221
+ disabled: d,
222
+ readOnly: n,
223
+ size: we
224
+ }), t?.inputLabel?.className),
225
+ style: {
226
+ ...v(t?.inputLabel?.sx),
227
+ ...t?.inputLabel?.style,
228
+ ...St(F)
229
+ },
230
+ children: [r, H && " *"]
231
+ })]
232
+ }),
233
+ P && R ? /* @__PURE__ */ p("div", {
234
+ className: "flex items-start justify-between gap-4",
235
+ children: [_ && /* @__PURE__ */ o(re, {
236
+ id: W,
237
+ role: oe,
238
+ error: h,
239
+ message: E,
240
+ hideErrorIcon: t?.formHelperText?.hideErrorIcon,
241
+ className: l("box-border min-w-0 flex-1 items-start", t?.formHelperText?.className),
242
+ style: v(t?.formHelperText?.sx)
243
+ }), /* @__PURE__ */ o(gt, {
244
+ id: te,
245
+ length: Ze,
246
+ limit: R,
247
+ locale: Le,
248
+ className: "ml-auto shrink-0 whitespace-nowrap pt-1"
249
+ })]
250
+ }) : _ && /* @__PURE__ */ o(re, {
251
+ ref: dt,
252
+ id: W,
253
+ role: oe,
254
+ error: h,
255
+ message: E,
256
+ hideErrorIcon: t?.formHelperText?.hideErrorIcon,
257
+ className: l("mr-[14px] box-border items-start", t?.formHelperText?.className),
207
258
  style: {
208
- ...P(n?.inputLabel?.sx),
209
- ...n?.inputLabel?.style,
210
- ...lt(R)
211
- },
212
- children: [a, N && " *"]
213
- })]
214
- }), D && /* @__PURE__ */ s(nt, {
215
- ref: Xe,
216
- id: V,
217
- role: Je,
218
- error: m,
219
- message: j,
220
- hideErrorIcon: n?.formHelperText?.hideErrorIcon,
221
- className: r("mr-[14px] box-border items-start", n?.formHelperText?.className),
222
- style: {
223
- ...Ze,
224
- ...P(n?.formHelperText?.sx)
225
- }
226
- })]
259
+ ...ct,
260
+ ...v(t?.formHelperText?.sx)
261
+ }
262
+ })
263
+ ]
227
264
  });
228
265
  };
229
266
  export {
230
- Tt as StyledInputField
267
+ Ot as StyledInputField
231
268
  };
@@ -1,28 +1,31 @@
1
- import { cn as L } from "../../../helpers/cn.js";
2
- import { StyledInputField as M } from "../input-field/StyledInputField.js";
3
- import { StyledLink as V } from "../../navigation/link/StyledLink.js";
4
- import { CountryCodeSelect as W } from "./CountryCodeSelect.js";
5
- import { useId as z } from "react";
6
- import { jsx as t, jsxs as d } from "react/jsx-runtime";
7
- var E = (e) => e.replace(/\D/g, ""), U = ({ dataTest: e, label: l, countries: h, country: n, onCountryChange: x, value: s, onChange: f, onBlur: v, error: y, helperText: N, reserveHelperText: b = !0, disabled: i, readOnly: g, readOnlyText: m, readOnlyHref: c, required: p, placeholder: $, formatNationalNumber: I, renderFlag: C, selectCountryLabel: S, searchPlaceholder: F, id: j, name: P, size: k = "medium", fieldClassName: u, helperTextClassName: w, className: A }) => {
8
- const B = z(), a = j ?? `${B}-phone`, o = `${a}-label`, r = I?.(s, n) ?? s;
1
+ import { cn as D } from "../../../helpers/cn.js";
2
+ import { fieldLabelAboveClass as M } from "../field-styles.js";
3
+ import { StyledInputField as V } from "../input-field/StyledInputField.js";
4
+ import { StyledLink as z } from "../../navigation/link/StyledLink.js";
5
+ import { CountryCodeSelect as E } from "./CountryCodeSelect.js";
6
+ import { useId as G } from "react";
7
+ import { jsx as l, jsxs as d } from "react/jsx-runtime";
8
+ var H = (e) => e.replace(/\D/g, ""), Y = ({ dataTest: e, label: t, countries: h, country: i, onCountryChange: f, value: n, onChange: v, onBlur: x, error: y, helperText: N, reserveHelperText: g = !0, disabled: s, readOnly: $, readOnlyText: m, readOnlyHref: c, required: p, placeholder: b, formatNationalNumber: I, renderFlag: C, selectCountryLabel: S, searchPlaceholder: F, id: j, name: A, size: L = "medium", fieldClassName: u, helperTextClassName: P, className: k }) => {
9
+ const w = G(), o = j ?? `${w}-phone`, a = `${o}-label`, r = I?.(n, i) ?? n;
9
10
  return /* @__PURE__ */ d("div", {
10
- className: L("flex flex-col", A),
11
+ className: D("flex flex-col", k),
11
12
  "data-testid": `${e}-root`,
12
- children: [l != null && /* @__PURE__ */ d("label", {
13
- id: o,
14
- htmlFor: a,
15
- className: "pb-1 text-base font-semibold text-delta-800",
16
- children: [l, p === !0 && /* @__PURE__ */ t("span", {
17
- "aria-hidden": "true",
18
- children: " *"
19
- })]
20
- }), g === !0 ? /* @__PURE__ */ t("span", {
13
+ children: [t != null && /* @__PURE__ */ l("div", {
14
+ className: M(),
15
+ children: /* @__PURE__ */ d("label", {
16
+ id: a,
17
+ htmlFor: o,
18
+ children: [t, p === !0 && /* @__PURE__ */ l("span", {
19
+ "aria-hidden": "true",
20
+ children: " *"
21
+ })]
22
+ })
23
+ }), $ === !0 ? /* @__PURE__ */ l("span", {
21
24
  className: "py-2 text-base text-delta-800",
22
- children: c === void 0 ? /* @__PURE__ */ t("span", {
25
+ children: c === void 0 ? /* @__PURE__ */ l("span", {
23
26
  "data-testid": `${e}-readonly`,
24
27
  children: m ?? r
25
- }) : /* @__PURE__ */ t(V, {
28
+ }) : /* @__PURE__ */ l(z, {
26
29
  dataTest: `${e}-readonly`,
27
30
  href: c,
28
31
  className: "-ml-1",
@@ -30,46 +33,45 @@ var E = (e) => e.replace(/\D/g, ""), U = ({ dataTest: e, label: l, countries: h,
30
33
  })
31
34
  }) : /* @__PURE__ */ d("div", {
32
35
  className: "flex items-start gap-2.5",
33
- children: [/* @__PURE__ */ t(W, {
36
+ children: [/* @__PURE__ */ l(E, {
34
37
  dataTest: `${e}-country`,
35
38
  countries: h,
36
- value: n,
37
- onChange: x,
38
- disabled: i,
39
+ value: i,
40
+ onChange: f,
41
+ disabled: s,
39
42
  selectCountryLabel: S,
40
43
  searchPlaceholder: F,
41
44
  renderFlag: C,
42
- labelledBy: l == null ? void 0 : o,
45
+ labelledBy: t == null ? void 0 : a,
43
46
  className: u
44
- }), /* @__PURE__ */ t(M, {
47
+ }), /* @__PURE__ */ l(V, {
45
48
  dataTest: `${e}-number`,
46
- className: "max-w-[200px]",
47
- id: a,
48
- name: P,
49
+ width: "s",
50
+ id: o,
51
+ name: A,
49
52
  value: r,
50
- onChange: (D) => f(E(D.target.value)),
51
- onBlur: v,
52
- placeholder: $,
53
+ onChange: (B) => v(H(B.target.value)),
54
+ onBlur: x,
55
+ placeholder: b,
53
56
  error: y,
54
- disabled: i,
57
+ disabled: s,
55
58
  required: p,
56
- fullWidth: !0,
57
59
  helperText: N,
58
- reserveHelperText: b,
59
- size: k,
60
+ reserveHelperText: g,
61
+ size: L,
60
62
  slotProps: {
61
63
  htmlInput: {
62
64
  inputMode: "tel",
63
65
  autoComplete: "tel",
64
- "aria-labelledby": l == null ? void 0 : o
66
+ "aria-labelledby": t == null ? void 0 : a
65
67
  },
66
68
  input: { className: u },
67
- formHelperText: { className: w }
69
+ formHelperText: { className: P }
68
70
  }
69
71
  })]
70
72
  })]
71
73
  });
72
74
  };
73
75
  export {
74
- U as StyledPhoneField
76
+ Y as StyledPhoneField
75
77
  };