asma-ui-core 3.125.0 → 3.126.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.
Files changed (25) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/data-display/interactive-chip/StyledInteractiveChip.js +6 -5
  3. package/dist/components/data-display/read-only-text/StyledReadOnlyText.js +56 -0
  4. package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.module.js +12 -12
  5. package/dist/components/inputs/field-styles.js +1 -1
  6. package/dist/components/inputs/input-field/StyledInputField.js +226 -205
  7. package/dist/components/miscellaneous/StyledFormControlLabel.js +14 -14
  8. package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +81 -73
  9. package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.js +28 -26
  10. package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +23 -21
  11. package/dist/datetime/components/time-picker/StyledTimePicker.js +25 -25
  12. package/dist/datetime/components/time-picker/TimePickerInput.js +41 -40
  13. package/dist/index.js +223 -221
  14. package/dist/src/components/data-display/read-only-text/StyledReadOnlyText.d.ts +38 -0
  15. package/dist/src/components/data-display/read-only-text/index.d.ts +1 -0
  16. package/dist/src/components/inputs/field-styles.d.ts +3 -1
  17. package/dist/src/components/inputs/input-field/StyledInputField.d.ts +14 -1
  18. package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +2 -0
  19. package/dist/src/datetime/components/date-picker/types.d.ts +7 -0
  20. package/dist/src/datetime/components/time-picker/types.d.ts +2 -0
  21. package/dist/src/index.d.ts +1 -0
  22. package/dist/src/table/components/table-header/SortIndicator.d.ts +3 -2
  23. package/dist/table/components/StyledTable.module.js +53 -53
  24. package/dist/table/shared-components/StyledCheckbox.module.js +11 -11
  25. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import { cn as o } from "../../../helpers/cn.js";
2
2
  import { StyledChip as v } from "../chip/StyledChip.js";
3
3
  import { StyledCheckbox as f } from "../../inputs/checkbox/base-ui/StyledCheckbox.js";
4
- import { StyledRadio as x } from "../../inputs/radio-button/base-ui/StyledRadio.js";
4
+ import { StyledRadio as y } from "../../inputs/radio-button/base-ui/StyledRadio.js";
5
5
  import i from "./StyledInteractiveChip.module.js";
6
- import { forwardRef as _ } from "react";
6
+ import { forwardRef as x } from "react";
7
7
  import { jsx as r } from "react/jsx-runtime";
8
- var y = "[&[data-testid][role]]:border-gama-400 [&[data-testid][role]]:shadow-[inset_0_0_0_1px_var(--colors-gama-400)] [&[data-testid][role]]:bg-gama-25", S = { paddingLeft: "6px" }, R = _(({ type: l = "checkbox", checked: e, size: d = "small", ariaLabel: n, ...a }, c) => {
8
+ var _ = "[&[data-testid][role]]:border-gama-400 [&[data-testid][role]]:shadow-[inset_0_0_0_1px_var(--colors-gama-400)] [&[data-testid][role]]:bg-gama-25", S = { paddingLeft: "6px" }, R = x(({ type: l = "checkbox", checked: e, size: d = "small", ariaLabel: n, ...a }, c) => {
9
9
  const t = l === "checkbox", m = n ?? (typeof a.label == "string" ? a.label : void 0), s = !a.readOnly && !t && !!e, b = t ? /* @__PURE__ */ r(f, {
10
10
  dataTest: a.dataTest,
11
11
  disableRipple: !0,
@@ -14,10 +14,11 @@ var y = "[&[data-testid][role]]:border-gama-400 [&[data-testid][role]]:shadow-[i
14
14
  readOnly: a.readOnly,
15
15
  decorative: !0,
16
16
  className: o("pointer-events-none", i.control)
17
- }) : /* @__PURE__ */ r(x, {
17
+ }) : /* @__PURE__ */ r(y, {
18
18
  dataTest: a.dataTest,
19
19
  checked: e,
20
20
  size: d,
21
+ readOnly: a.readOnly,
21
22
  decorative: !0,
22
23
  className: o("pointer-events-none", i.control)
23
24
  });
@@ -31,7 +32,7 @@ var y = "[&[data-testid][role]]:border-gama-400 [&[data-testid][role]]:shadow-[i
31
32
  clickable: !0,
32
33
  tabIndex: 0,
33
34
  ...a,
34
- className: o(s && y, a.className),
35
+ className: o(s && _, a.className),
35
36
  sx: {
36
37
  ...S,
37
38
  ...a.sx
@@ -0,0 +1,56 @@
1
+ import { cn as h } from "../../../helpers/cn.js";
2
+ import { StyledFormLabel as o } from "../form-label/components/StyledFormLabel.js";
3
+ import { Fragment as y, jsx as s, jsxs as a } from "react/jsx-runtime";
4
+ var l = "flex h-6 w-6 shrink-0 items-center justify-center [&>svg]:h-6 [&>svg]:w-6", x = "flex h-5 w-5 shrink-0 items-center justify-center [&>svg]:h-5 [&>svg]:w-5", b = (e) => e == null || e === !1 || typeof e == "string" && e.trim() === "", C = ({ title: e, value: r, emptyText: f = "-", multiline: N, horizontal: m, titleIcon: n, titleInfo: c, startIcon: t, endIcon: d, helperText: i, helperIcon: p, id: v, className: w, dataTest: g }) => /* @__PURE__ */ a("div", {
5
+ className: h("flex min-w-0", m ? "items-center gap-1" : "flex-col", w),
6
+ children: [e != null && /* @__PURE__ */ a("div", {
7
+ className: "flex shrink-0 items-center gap-1 text-delta-800",
8
+ children: [
9
+ n && /* @__PURE__ */ s("span", {
10
+ className: l,
11
+ children: n
12
+ }),
13
+ /* @__PURE__ */ s(o, {
14
+ title: m ? /* @__PURE__ */ a(y, { children: [e, ":"] }) : e,
15
+ className: "pb-0"
16
+ }),
17
+ c && /* @__PURE__ */ s("span", {
18
+ className: x,
19
+ children: c
20
+ })
21
+ ]
22
+ }), /* @__PURE__ */ a("div", {
23
+ className: "flex min-w-0 flex-col",
24
+ children: [/* @__PURE__ */ a("div", {
25
+ className: "flex items-center gap-1 text-delta-700",
26
+ children: [
27
+ t && /* @__PURE__ */ s("span", {
28
+ className: l,
29
+ children: t
30
+ }),
31
+ /* @__PURE__ */ s("span", {
32
+ id: v,
33
+ "data-testid": g,
34
+ className: h("min-w-0 flex-1 break-words text-base", N && "whitespace-pre-wrap"),
35
+ children: b(r) ? f : r
36
+ }),
37
+ d && /* @__PURE__ */ s("span", {
38
+ className: l,
39
+ children: d
40
+ })
41
+ ]
42
+ }), i != null && /* @__PURE__ */ a("div", {
43
+ className: "flex items-start gap-1 py-0.5 text-delta-600",
44
+ children: [p && /* @__PURE__ */ s("span", {
45
+ className: x,
46
+ children: p
47
+ }), /* @__PURE__ */ s("span", {
48
+ className: "min-w-0 text-sm",
49
+ children: i
50
+ })]
51
+ })]
52
+ })]
53
+ });
54
+ export {
55
+ C as StyledReadOnlyText
56
+ };
@@ -1,18 +1,18 @@
1
- var a = "_CheckboxWrapper_ajsar_1", r = "_Checkbox_ajsar_1", e = "_Indeterminate_ajsar_34", _ = "_ReadOnly_ajsar_110", o = "_Indicator_ajsar_119", p = "_HideWrapper_ajsar_123", i = "_CheckboxHover_ajsar_130", s = "_CheckboxRippleContainer_ajsar_130", l = "_CheckboxRipple_ajsar_130", d = "_ripple_ajsar_1", c = {
2
- CheckboxWrapper: a,
3
- "size-small": "_size-small_ajsar_17",
4
- "size-medium": "_size-medium_ajsar_21",
5
- Checkbox: r,
6
- Indeterminate: e,
7
- Error: "_Error_ajsar_61",
8
- ReadOnly: _,
1
+ var e = "_CheckboxWrapper_1341w_1", _ = "_Checkbox_1341w_1", r = "_Indeterminate_1341w_34", a = "_ReadOnly_1341w_110", o = "_Indicator_1341w_122", p = "_HideWrapper_1341w_126", i = "_CheckboxHover_1341w_133", l = "_CheckboxRippleContainer_1341w_133", d = "_CheckboxRipple_1341w_133", c = "_ripple_1341w_1", v = {
2
+ CheckboxWrapper: e,
3
+ "size-small": "_size-small_1341w_17",
4
+ "size-medium": "_size-medium_1341w_21",
5
+ Checkbox: _,
6
+ Indeterminate: r,
7
+ Error: "_Error_1341w_61",
8
+ ReadOnly: a,
9
9
  Indicator: o,
10
10
  HideWrapper: p,
11
11
  CheckboxHover: i,
12
- CheckboxRippleContainer: s,
13
- CheckboxRipple: l,
14
- ripple: d
12
+ CheckboxRippleContainer: l,
13
+ CheckboxRipple: d,
14
+ ripple: c
15
15
  };
16
16
  export {
17
- c as default
17
+ v as default
18
18
  };
@@ -28,7 +28,7 @@ var l = () => ({
28
28
  }), p = {
29
29
  "--field-width-full": "100%",
30
30
  "--form-column-width": "100%"
31
- }, g = (e) => e <= 9 ? "xs" : e <= 15 ? "s" : e <= 27 ? "m" : "full", h = ({ disabled: e } = {}) => t("block pb-1 text-base font-semibold", e ? "text-delta-300" : "text-delta-800"), n = "shadow-[inset_0_0_0_2px_var(--colors-error-500)]", u = ({ focused: e, error: r, disabled: o, readOnly: a, borderless: i }) => t("pointer-events-none absolute inset-0 rounded border border-solid transition-colors", i && !e ? "border-transparent" : o ? "border-delta-300" : a ? "border-delta-200" : r ? t("border-error-500", e && n) : e ? "border-focus-ring shadow-[inset_0_0_0_2px_var(--colors-focus-ring)]" : "border-delta-500 group-hover:border-2 group-hover:border-gama-300"), v = ({ focused: e, error: r, disabled: o, readOnly: a, notched: i = !0 }) => t("pointer-events-none absolute z-0 m-0 box-border min-w-0 overflow-hidden rounded border border-solid transition-colors", i ? "inset-x-0 bottom-0 top-[-5px] px-2 py-0" : "inset-0", o ? "border-delta-300" : a ? "border-delta-200" : r ? t("border-error-500", e && n) : e ? "border-focus-ring shadow-[inset_0_0_0_2px_var(--colors-focus-ring)]" : "border-delta-500 group-hover:border-2 group-hover:border-gama-300"), m = (e) => t("block h-[11px] overflow-hidden bg-white p-0 text-xs leading-[23px] text-transparent transition-[max-width] duration-150", e ? "max-w-full" : "max-w-[0.01px]"), f = ({ shrink: e, focused: r, error: o, disabled: a, readOnly: i }) => t("pointer-events-none absolute left-[14px] z-10 max-w-[calc(100%-1.75rem)] truncate transition-colors duration-150", a ? "text-delta-300" : i ? "text-delta-800" : o ? "text-error-500" : r ? "text-gama-500" : e ? "text-delta-800" : "text-delta-500", e ? "bg-white px-1 text-xs leading-[16px] tracking-[0.24px]" : "text-base leading-[23px] tracking-[0.00938em]");
31
+ }, g = (e) => e <= 9 ? "xs" : e <= 15 ? "s" : e <= 27 ? "m" : "full", h = ({ disabled: e, flush: r } = {}) => t("block text-base font-semibold", !r && "pb-1", e ? "text-delta-300" : "text-delta-800"), n = "shadow-[inset_0_0_0_2px_var(--colors-error-500)]", u = ({ focused: e, error: r, disabled: o, readOnly: a, borderless: i }) => t("pointer-events-none absolute inset-0 rounded border border-solid transition-colors", i && !e ? "border-transparent" : o ? "border-delta-300" : a ? "border-delta-200" : r ? t("border-error-500", e && n) : e ? "border-focus-ring shadow-[inset_0_0_0_2px_var(--colors-focus-ring)]" : "border-delta-500 group-hover:border-2 group-hover:border-gama-300"), v = ({ focused: e, error: r, disabled: o, readOnly: a, notched: i = !0 }) => t("pointer-events-none absolute z-0 m-0 box-border min-w-0 overflow-hidden rounded border border-solid transition-colors", i ? "inset-x-0 bottom-0 top-[-5px] px-2 py-0" : "inset-0", o ? "border-delta-300" : a ? "border-delta-200" : r ? t("border-error-500", e && n) : e ? "border-focus-ring shadow-[inset_0_0_0_2px_var(--colors-focus-ring)]" : "border-delta-500 group-hover:border-2 group-hover:border-gama-300"), m = (e) => t("block h-[11px] overflow-hidden bg-white p-0 text-xs leading-[23px] text-transparent transition-[max-width] duration-150", e ? "max-w-full" : "max-w-[0.01px]"), f = ({ shrink: e, focused: r, error: o, disabled: a, readOnly: i }) => t("pointer-events-none absolute left-[14px] z-10 max-w-[calc(100%-1.75rem)] truncate transition-colors duration-150", a ? "text-delta-300" : i ? "text-delta-800" : o ? "text-error-500" : r ? "text-gama-500" : e ? "text-delta-800" : "text-delta-500", e ? "bg-white px-1 text-xs leading-[16px] tracking-[0.24px]" : "text-base leading-[23px] tracking-[0.00938em]");
32
32
  export {
33
33
  h as fieldLabelAboveClass,
34
34
  g as fieldWidthForMaxLength,
@@ -1,258 +1,279 @@
1
- import { cn as s } from "../../../helpers/cn.js";
2
- import { resolveSx as F } from "../../../helpers/sx.js";
3
- import { CloseIcon as mt } from "../../icons/close-icon/CloseIcon.js";
4
- import { CharacterCounter as pt } from "../../../helpers/CharacterCounter.js";
5
- import { HelperRow as gt } 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 se, singleLineInputLayoutStyle as Ht, singleLineShellLayoutStyle as It } from "../field-styles.js";
9
- import x from "./StyledInputField.module.js";
10
- import { Children as At, useCallback as re, useId as Ct, useLayoutEffect as _, useRef as U, useState as B } from "react";
11
- import { jsx as o, jsxs as b } from "react/jsx-runtime";
12
- import { useMergeRefs as de } from "@floating-ui/react";
13
- var Ot = ({ dataTest: y, label: r, labelPlacement: ce = "above", value: p, defaultValue: L, onChange: ue, onBlur: he, onFocus: me, error: g, helperText: K, reserveHelperText: pe, expandHelperText: ge = !0, maxLength: fe, counter: xe, locale: be, disabled: d, readOnly: n, required: H, allowClear: ye, onClear: Le, type: Se = "text", placeholder: ve, name: He, id: Ie, autoComplete: Ae, autoFocus: Ce, multiline: i, rows: I, minRows: M, maxRows: k, size: Ne = "medium", width: Y = "full", fullWidth: Nt, className: Re, style: we, sx: Fe, inputRef: _e, slotProps: t, InputProps: G, onKeyDown: J, onClick: Be, variant: Rt }) => {
14
- const Me = Ct(), E = Ie ?? Me, Q = `${E}-helper-text`, T = U(null), D = U(0), V = U(null), [ke, Ee] = B(void 0), [A, X] = B(!1), [Te, Z] = B(L != null && L !== ""), [De, We] = B(String(L ?? "").length), C = p !== void 0, q = C ? p !== "" && p != null : Te, $e = !!d || !!n, W = t?.input?.startAdornment ?? G?.startAdornment, S = At.count(W) > 0, u = S && Array.isArray(W), h = t?.input?.endAdornment ?? G?.endAdornment, v = !!(ye && q && !$e), { ref: ze, ...l } = t?.htmlInput ?? {}, je = _e ?? ze, { className: Pe, style: $, ref: Ue } = t?.input ?? {}, Ke = de([Ue]), Ye = t?.input?.onMouseDown, O = t?.input?.onClick, Ge = O ? { onClick: O } : {}, Je = Ae ?? l.autoComplete, Qe = He ?? l.name, z = l.id ?? E, N = fe ?? l.maxLength, ee = `${E}-counter`, te = xe !== !1 && !!N, Ve = C ? String(p ?? "").length : De, R = ce === "floating" && !!r, w = A || q || S, m = re(() => {
15
- const e = T.current;
16
- if (!(!i || !e) && (D.current = e.offsetWidth, D.current !== 0)) {
17
- if (e.removeAttribute("data-scrollable"), I != null && !n) e.style.height = "";
1
+ import { cn as a } from "../../../helpers/cn.js";
2
+ import { resolveSx as B } from "../../../helpers/sx.js";
3
+ import { StyledTooltip as vt } from "../../data-display/tooltip/StyledTooltip.js";
4
+ import { CloseIcon as Lt } from "../../icons/close-icon/CloseIcon.js";
5
+ import { LockIcon as St } from "../../icons/lock-icon/LockIcon.js";
6
+ import { CharacterCounter as It } from "../../../helpers/CharacterCounter.js";
7
+ import { HelperRow as Nt } from "../../../helpers/HelperRow.js";
8
+ import { useHelperRowBudget as _t } from "../../../helpers/useHelperRowBudget.js";
9
+ import { useHelperSlot as At } from "../../../helpers/useHelperSlot.js";
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
+ 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";
13
+ import { Fragment as Tt, jsx as t, jsxs as f } from "react/jsx-runtime";
14
+ import { useMergeRefs as me } from "@floating-ui/react";
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, {
16
+ title: u,
17
+ openOnTap: !0,
18
+ persistentDescription: !0,
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, {
22
+ width: 24,
23
+ height: 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(() => {
26
+ const e = $.current;
27
+ if (!(!i || !e) && (z.current = e.offsetWidth, z.current !== 0)) {
28
+ if (e.removeAttribute("data-scrollable"), A != null && !l) e.style.height = "";
18
29
  else {
19
30
  if (e.style.height = "auto", e.scrollHeight === 0) {
20
31
  e.style.height = "";
21
32
  return;
22
33
  }
23
- const a = getComputedStyle(e), c = Number.parseFloat(a.lineHeight) || 24, le = Number.parseFloat(a.paddingTop) + Number.parseFloat(a.paddingBottom), ae = I ?? M, ut = ae ? ae * c + le : 0, ht = n || !k ? Number.POSITIVE_INFINITY : k * c + le;
24
- e.style.height = `${Math.min(ht, Math.max(ut, e.scrollHeight))}px`;
34
+ const d = getComputedStyle(e), p = Number.parseFloat(d.lineHeight) || 24, ce = Number.parseFloat(d.paddingTop) + Number.parseFloat(d.paddingBottom), ue = A ?? D, yt = ue ? ue * p + ce : 0, bt = l || !k ? Number.POSITIVE_INFINITY : k * p + ce;
35
+ e.style.height = `${Math.min(bt, Math.max(yt, e.scrollHeight))}px`;
25
36
  }
26
37
  e.scrollHeight > e.clientHeight + 1 && e.setAttribute("data-scrollable", "true");
27
38
  }
28
39
  }, [
29
40
  k,
30
- M,
41
+ D,
31
42
  i,
32
- n,
33
- I
34
- ]), Xe = (e) => {
35
- n || (C || (Z(e.target.value !== ""), We(e.target.value.length), m()), ue?.(e));
36
- }, Ze = (e) => {
37
- !d && !n && X(!0), me?.(e);
38
- }, qe = (e) => {
39
- !d && !n && X(!1), he?.(e);
43
+ l,
44
+ A
45
+ ]), ot = (e) => {
46
+ l || (C || (ne(e.target.value !== ""), Ke(e.target.value.length), g()), xe?.(e));
47
+ }, lt = (e) => {
48
+ !h && !l && te(!0), be?.(e);
49
+ }, it = (e) => {
50
+ !h && !l && te(!1), ye?.(e);
40
51
  };
41
- _(() => {
42
- m();
52
+ M(() => {
53
+ g();
43
54
  }, [
44
- m,
45
- L,
46
- p
47
- ]), _(() => {
55
+ g,
56
+ S,
57
+ x
58
+ ]), M(() => {
48
59
  if (!i || !document.fonts) return;
49
- const e = () => m();
60
+ const e = () => g();
50
61
  return document.fonts.addEventListener("loadingdone", e), () => document.fonts.removeEventListener("loadingdone", e);
51
- }, [i, m]), _(() => {
52
- const e = T.current;
62
+ }, [i, g]), M(() => {
63
+ const e = $.current;
53
64
  if (!i || !e || typeof ResizeObserver > "u") return;
54
- let a = 0;
55
- const c = new ResizeObserver(() => {
56
- e.offsetWidth !== D.current && (cancelAnimationFrame(a), a = requestAnimationFrame(m));
65
+ let d = 0;
66
+ const p = new ResizeObserver(() => {
67
+ e.offsetWidth !== z.current && (cancelAnimationFrame(d), d = requestAnimationFrame(g));
57
68
  });
58
- return c.observe(e), () => {
59
- cancelAnimationFrame(a), c.disconnect();
69
+ return p.observe(e), () => {
70
+ cancelAnimationFrame(d), p.disconnect();
60
71
  };
61
- }, [i, m]);
62
- const ne = de([je, re((e) => {
63
- T.current = e instanceof HTMLTextAreaElement ? e : null;
64
- }, [])]), { style: j, ...Oe } = l, f = !i && !u, { height: wt, minHeight: Ft, maxHeight: _t, paddingTop: Bt, paddingBottom: Mt, ...et } = $ ?? {}, tt = f ? {
65
- ...et,
66
- ...It()
67
- } : u ? {
72
+ }, [i, g]);
73
+ const re = me([Ye, pe((e) => {
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 ? {
76
+ ...rt,
77
+ ...Mt()
78
+ } : m ? {
68
79
  boxSizing: "border-box",
69
80
  minHeight: 40,
70
- ...$
71
- } : $, { height: kt, minHeight: Et, maxHeight: Tt, paddingTop: Dt, paddingBottom: Wt, paddingLeft: $t, paddingRight: nt, ...ot } = j ?? {}, it = f ? {
72
- ...ot,
73
- ...Ht({
74
- paddingLeft: S ? 40 : 14,
75
- paddingRight: nt ?? ke ?? (v || h ? 40 : 14)
81
+ ...P
82
+ } : P, { height: Gt, minHeight: Vt, maxHeight: Yt, paddingTop: Jt, paddingBottom: Qt, paddingLeft: Xt, paddingRight: dt, ...ct } = G ?? {}, ut = v ? {
83
+ ...ct,
84
+ ...Bt({
85
+ paddingLeft: I ? 40 : 14,
86
+ paddingRight: dt ?? ze ?? (N || b ? 40 : 14)
76
87
  })
77
- } : j;
78
- _(() => {
79
- if (!f) return;
80
- const e = V.current, a = e ? Math.ceil(e.getBoundingClientRect().width) + 20 : void 0;
81
- Ee((c) => c === a ? c : a);
88
+ } : G;
89
+ M(() => {
90
+ if (!v) return;
91
+ const e = ee.current, d = e ? Math.ceil(e.getBoundingClientRect().width) + 20 : void 0;
92
+ Ue((p) => p === d ? p : d);
82
93
  }, [
83
- f,
84
94
  v,
85
- h
95
+ N,
96
+ j,
97
+ c
86
98
  ]);
87
- const lt = w || !R, { show: P, role: at } = xt("StyledInputField", g, K, pe, n), { fieldRef: st, rowRef: rt, rowStyle: dt } = ft(ge && P), oe = {
88
- ...Oe,
89
- style: f ? it : j,
90
- id: z,
91
- name: Qe,
92
- maxLength: N,
93
- placeholder: lt ? ve : void 0,
94
- disabled: d,
95
- readOnly: n,
96
- required: H,
97
- autoComplete: Je,
98
- autoFocus: Ce,
99
- value: p,
100
- defaultValue: L,
101
- "aria-invalid": g ? !0 : void 0,
102
- "aria-label": l["aria-label"] ?? (l["aria-labelledby"] ? void 0 : typeof r == "string" && r !== "" ? r : void 0),
103
- "aria-describedby": [P ? Q : l["aria-describedby"], te ? ee : void 0].filter(Boolean).join(" ") || void 0,
104
- onChange: Xe,
105
- onFocus: Ze,
106
- onBlur: qe,
107
- onKeyDown: l.onKeyDown || J ? (e) => {
108
- J?.(e), e.defaultPrevented || l.onKeyDown?.(e);
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 = {
100
+ ...at,
101
+ style: v ? ut : G,
102
+ id: K,
103
+ name: tt,
104
+ maxLength: R,
105
+ placeholder: ht ? Re : void 0,
106
+ disabled: h,
107
+ readOnly: l,
108
+ required: _,
109
+ autoComplete: et,
110
+ autoFocus: Me,
111
+ value: x,
112
+ defaultValue: S,
113
+ "aria-invalid": y ? !0 : void 0,
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,
116
+ onChange: ot,
117
+ onFocus: lt,
118
+ onBlur: it,
119
+ onKeyDown: s.onKeyDown || Z ? (e) => {
120
+ Z?.(e), e.defaultPrevented || s.onKeyDown?.(e);
109
121
  } : void 0
110
- }, ie = s(x.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]" : i ? s("w-full resize-none p-0 pl-0 pr-0 leading-[23px]", x["Input--multiline"]) : s("w-full", x["Input--singleLine"], !v && !h && "max-xs:pr-1.5"), "disabled:text-delta-300", n && "text-delta-800", Pe), ct = !i && !u ? {
111
- "data-start-adornment": S ? "true" : void 0,
112
- "data-end-adornment": v || h ? "true" : void 0
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
+ "data-start-adornment": I ? "true" : void 0,
124
+ "data-end-adornment": N || b ? "true" : void 0
113
125
  } : {};
114
- return /* @__PURE__ */ b("div", {
115
- ref: st,
116
- className: s("group relative min-w-0 flex-col", Re),
117
- onClick: Be,
118
- "data-field-width": Y,
126
+ return /* @__PURE__ */ f("div", {
127
+ ref: mt,
128
+ className: a("group relative min-w-0 flex-col", Oe),
129
+ onClick: We,
130
+ "data-field-width": Q,
119
131
  style: {
120
132
  display: "flex",
121
- ...yt(Y),
133
+ ...Ct(Q),
122
134
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
123
135
  letterSpacing: "0.00938em",
124
- ...F(Fe),
125
- ...we
136
+ ...B(De),
137
+ ...Te
126
138
  },
127
139
  children: [
128
- r && !R && /* @__PURE__ */ o("div", {
129
- className: s(bt({ disabled: d }), t?.inputLabel?.className),
140
+ r && !w && /* @__PURE__ */ t("div", {
141
+ className: a(Ht({
142
+ disabled: h,
143
+ flush: o
144
+ }), n?.inputLabel?.className),
130
145
  style: {
131
- ...F(t?.inputLabel?.sx),
132
- ...t?.inputLabel?.style
146
+ ...B(n?.inputLabel?.sx),
147
+ ...n?.inputLabel?.style
133
148
  },
134
- children: /* @__PURE__ */ b("label", {
135
- htmlFor: z,
136
- children: [r, H && /* @__PURE__ */ o("span", {
149
+ children: /* @__PURE__ */ f("label", {
150
+ htmlFor: K,
151
+ children: [r, _ && /* @__PURE__ */ t("span", {
137
152
  "aria-hidden": "true",
138
153
  children: " *"
139
154
  })]
140
155
  })
141
156
  }),
142
- /* @__PURE__ */ b("div", {
143
- className: "relative overflow-visible",
144
- children: [/* @__PURE__ */ b("div", {
145
- className: s("relative flex", f && x.InputShell, i && "box-border items-center px-[14px] py-[16.5px]", u && s(x.AdornmentList, h && x["AdornmentList--endAdornment"]), n && "rounded bg-delta-50"),
146
- ref: Ke,
147
- onMouseDown: Ye,
148
- ...Ge,
149
- style: tt,
150
- "data-testid": u ? `${y}-adornment-list` : `${y}-shell`,
151
- children: [
152
- S && /* @__PURE__ */ o("span", {
153
- className: s("items-center text-delta-500", u ? "contents" : "absolute left-3 flex"),
154
- children: W
155
- }),
156
- i ? /* @__PURE__ */ o("textarea", {
157
- ...oe,
158
- ref: ne,
159
- "data-testid": y,
160
- rows: I ?? M ?? 2,
161
- className: ie
162
- }) : /* @__PURE__ */ o("input", {
163
- ...oe,
164
- ...ct,
165
- ref: ne,
166
- "data-testid": y,
167
- type: Se,
168
- className: ie
169
- }),
170
- v ? /* @__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(), C || Z(!1), Le?.();
178
- },
179
- children: /* @__PURE__ */ o(mt, {
180
- width: 18,
181
- height: 18
182
- })
183
- }) : h && /* @__PURE__ */ o("span", {
184
- ref: V,
185
- className: "absolute inset-y-0 right-[14px] flex max-w-[calc(100%-28px)] items-center gap-1",
186
- children: h
187
- }),
188
- R ? /* @__PURE__ */ o("fieldset", {
189
- "aria-hidden": !0,
190
- className: se({
191
- focused: A,
192
- error: g,
193
- disabled: d,
194
- readOnly: n,
195
- notched: !0
157
+ /* @__PURE__ */ t(kt, {
158
+ reason: c ? O : o ? T : void 0,
159
+ children: /* @__PURE__ */ f("div", {
160
+ className: "relative overflow-visible",
161
+ children: [/* @__PURE__ */ f("div", {
162
+ className: a("relative flex", v && L.InputShell, i && !o && "box-border items-center px-[14px] py-[16.5px]", m && a(L.AdornmentList, b && L["AdornmentList--endAdornment"]), l && !o && "rounded bg-delta-50", c && i && "pr-[44px]"),
163
+ ref: Xe,
164
+ onMouseDown: Ze,
165
+ ...qe,
166
+ style: st,
167
+ "data-testid": m ? `${u}-adornment-list` : `${u}-shell`,
168
+ children: [
169
+ I && /* @__PURE__ */ t("span", {
170
+ className: a("items-center text-delta-500", m ? "contents" : "absolute left-3 flex"),
171
+ children: U
172
+ }),
173
+ i ? /* @__PURE__ */ t("textarea", {
174
+ ...se,
175
+ ref: re,
176
+ "data-testid": u,
177
+ rows: A ?? D ?? 2,
178
+ className: de
179
+ }) : /* @__PURE__ */ t("input", {
180
+ ...se,
181
+ ...xt,
182
+ ref: re,
183
+ "data-testid": u,
184
+ type: Ce,
185
+ className: de
196
186
  }),
197
- children: /* @__PURE__ */ o("legend", {
198
- className: vt(w),
199
- children: /* @__PURE__ */ b("span", {
200
- className: "inline-block px-[5px]",
201
- children: [r, H && " *"]
187
+ N ? /* @__PURE__ */ t("button", {
188
+ type: "button",
189
+ tabIndex: -1,
190
+ "aria-label": "Clear",
191
+ "data-testid": `${u}-clear`,
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
+ onClick: (e) => {
194
+ e.stopPropagation(), e.preventDefault(), C || ne(!1), He?.();
195
+ },
196
+ children: /* @__PURE__ */ t(Lt, {
197
+ width: 18,
198
+ height: 18
202
199
  })
200
+ }) : b && /* @__PURE__ */ t("span", {
201
+ ref: ee,
202
+ className: "absolute inset-y-0 right-[14px] flex max-w-[calc(100%-28px)] items-center gap-1",
203
+ children: b
204
+ }),
205
+ o ? /* @__PURE__ */ t("div", {
206
+ "aria-hidden": !0,
207
+ className: Dt
208
+ }) : w ? /* @__PURE__ */ t("fieldset", {
209
+ "aria-hidden": !0,
210
+ className: a(he({
211
+ focused: H,
212
+ error: y,
213
+ disabled: h,
214
+ readOnly: l,
215
+ notched: !0
216
+ }), c && ge),
217
+ children: /* @__PURE__ */ t("legend", {
218
+ className: Ft(F),
219
+ children: /* @__PURE__ */ f("span", {
220
+ className: "inline-block px-[5px]",
221
+ children: [r, _ && " *"]
222
+ })
223
+ })
224
+ }) : /* @__PURE__ */ t("div", {
225
+ "aria-hidden": !0,
226
+ className: a(he({
227
+ focused: H,
228
+ error: y,
229
+ disabled: h,
230
+ readOnly: l,
231
+ notched: !1
232
+ }), c && ge)
203
233
  })
204
- }) : /* @__PURE__ */ o("div", {
205
- "aria-hidden": !0,
206
- className: se({
207
- focused: A,
208
- error: g,
209
- disabled: d,
210
- readOnly: n,
211
- notched: !1
212
- })
213
- })
214
- ]
215
- }), R && /* @__PURE__ */ b("label", {
216
- htmlFor: z,
217
- className: s(Lt({
218
- shrink: w,
219
- focused: A,
220
- error: g,
221
- disabled: d,
222
- readOnly: n,
223
- size: Ne
224
- }), t?.inputLabel?.className),
225
- style: {
226
- ...F(t?.inputLabel?.sx),
227
- ...t?.inputLabel?.style,
228
- ...St(w)
229
- },
230
- children: [r, H && " *"]
231
- })]
234
+ ]
235
+ }), w && /* @__PURE__ */ f("label", {
236
+ htmlFor: K,
237
+ className: a(Rt({
238
+ shrink: F,
239
+ focused: H,
240
+ error: y,
241
+ disabled: h,
242
+ readOnly: l,
243
+ size: Ee
244
+ }), n?.inputLabel?.className),
245
+ style: {
246
+ ...B(n?.inputLabel?.sx),
247
+ ...n?.inputLabel?.style,
248
+ ...wt(F)
249
+ },
250
+ children: [r, _ && " *"]
251
+ })]
252
+ })
232
253
  }),
233
- P && /* @__PURE__ */ o(gt, {
234
- ref: rt,
235
- id: Q,
236
- role: at,
237
- error: g,
238
- message: K,
239
- hideErrorIcon: t?.formHelperText?.hideErrorIcon,
240
- className: s("mr-[14px] box-border items-start", t?.formHelperText?.className),
254
+ V && /* @__PURE__ */ t(Nt, {
255
+ ref: gt,
256
+ id: q,
257
+ role: pt,
258
+ error: y,
259
+ message: J,
260
+ hideErrorIcon: n?.formHelperText?.hideErrorIcon,
261
+ className: a("mr-[14px] box-border items-start", n?.formHelperText?.className),
241
262
  style: {
242
- ...dt,
243
- ...F(t?.formHelperText?.sx)
263
+ ...ft,
264
+ ...B(n?.formHelperText?.sx)
244
265
  }
245
266
  }),
246
- te && N ? /* @__PURE__ */ o(pt, {
247
- id: ee,
248
- length: Ve,
249
- limit: N,
250
- locale: be,
267
+ ae && R ? /* @__PURE__ */ t(It, {
268
+ id: ie,
269
+ length: nt,
270
+ limit: R,
271
+ locale: Ne,
251
272
  className: "pt-1"
252
273
  }) : null
253
274
  ]
254
275
  });
255
276
  };
256
277
  export {
257
- Ot as StyledInputField
278
+ mn as StyledInputField
258
279
  };