asma-ui-core 3.53.1 → 3.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
1
  import { cn as l } from "../../../helpers/cn.js";
2
- import { resolveSx as F } from "../../../helpers/sx.js";
3
- import { CloseIcon as $e } from "../../icons/close-icon/CloseIcon.js";
4
- import { ErrorOutlineIcon as je } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
5
- import { floatingLabelClass as ze, floatingLabelLayoutStyle as Ke, notchedLegendClass as Ue, notchedOutlineClass as J, singleLineInputLayoutStyle as Ve, singleLineShellLayoutStyle as We } from "../field-styles.js";
2
+ import { resolveSx as E } from "../../../helpers/sx.js";
3
+ import { CloseIcon as je } from "../../icons/close-icon/CloseIcon.js";
4
+ import { ErrorOutlineIcon as ze } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
5
+ import { floatingLabelClass as Ke, floatingLabelLayoutStyle as Ue, notchedLegendClass as Ve, notchedOutlineClass as J, singleLineInputLayoutStyle as We, singleLineShellLayoutStyle as Ye } from "../field-styles.js";
6
6
  import y from "./StyledInputField.module.js";
7
- import { Children as Ye, useCallback as Ge, useId as Je, useLayoutEffect as Q, useRef as X, useState as E } from "react";
7
+ import { Children as Ge, useCallback as Je, useId as Qe, useLayoutEffect as Q, useRef as X, useState as k } from "react";
8
8
  import { jsx as i, jsxs as m } from "react/jsx-runtime";
9
9
  import { useMergeRefs as Z } from "@floating-ui/react";
10
- var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlur: O, onFocus: ee, error: o, helperText: L, disabled: s, readOnly: n, required: v, allowClear: te, onClear: ne, type: ie = "text", placeholder: oe, name: ae, id: le, autoComplete: se, autoFocus: de, multiline: d, rows: A, minRows: I, maxRows: C, size: re = "medium", fullWidth: ce, className: he, style: me, sx: pe, inputRef: ue, slotProps: t, InputProps: k, onKeyDown: D, onClick: ge, variant: Qe }) => {
11
- const fe = Je(), T = le ?? fe, P = `${T}-helper-text`, $ = X(null), j = X(null), [xe, be] = E(void 0), [H, z] = E(!1), [ye, K] = E(S != null && S !== ""), _ = u !== void 0, U = _ ? u !== "" && u != null : ye, Se = !!s || !!n, R = t?.input?.startAdornment ?? k?.startAdornment, g = Ye.count(R) > 0, r = g && Array.isArray(R), f = t?.input?.endAdornment ?? k?.endAdornment, w = !!(te && U && !Se), { ref: Le, ...c } = t?.htmlInput ?? {}, Ie = ue ?? Le, { className: He, style: M, ref: Ne } = t?.input ?? {}, ve = Z([Ne]), Ae = t?.input?.onMouseDown, N = H || U || g, Ce = (e) => {
12
- n || (_ || K(e.target.value !== ""), q?.(e));
10
+ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlur: O, onFocus: ee, error: o, helperText: L, disabled: s, readOnly: n, required: v, allowClear: te, onClear: ne, type: ie = "text", placeholder: oe, name: ae, id: le, autoComplete: se, autoFocus: de, multiline: d, rows: A, minRows: I, maxRows: C, size: re = "medium", fullWidth: ce, className: he, style: me, sx: pe, inputRef: ue, slotProps: t, InputProps: D, onKeyDown: T, onClick: ge, variant: Xe }) => {
11
+ const fe = Qe(), _ = le ?? fe, P = `${_}-helper-text`, $ = X(null), j = X(null), [xe, be] = k(void 0), [H, z] = k(!1), [ye, K] = k(S != null && S !== ""), R = u !== void 0, U = R ? u !== "" && u != null : ye, Se = !!s || !!n, w = t?.input?.startAdornment ?? D?.startAdornment, g = Ge.count(w) > 0, r = g && Array.isArray(w), f = t?.input?.endAdornment ?? D?.endAdornment, M = !!(te && U && !Se), { ref: Le, ...c } = t?.htmlInput ?? {}, Ie = ue ?? Le, { className: He, style: B, ref: Ne } = t?.input ?? {}, ve = Z([Ne]), Ae = t?.input?.onMouseDown, N = H || U || g, Ce = (e) => {
12
+ n || (R || K(e.target.value !== ""), q?.(e));
13
13
  }, _e = (e) => {
14
14
  !s && !n && z(!0), ee?.(e);
15
15
  }, Re = (e) => {
@@ -19,8 +19,8 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
19
19
  const e = $.current;
20
20
  if (!d || A != null || !e) return;
21
21
  e.style.height = "auto";
22
- const h = getComputedStyle(e), b = Number.parseFloat(h.lineHeight) || 24, G = Number.parseFloat(h.paddingTop) + Number.parseFloat(h.paddingBottom), Te = I ? I * b + G : 0, Pe = C ? C * b + G : Number.POSITIVE_INFINITY;
23
- e.style.height = `${Math.min(Pe, Math.max(Te, e.scrollHeight))}px`;
22
+ const h = getComputedStyle(e), b = Number.parseFloat(h.lineHeight) || 24, G = Number.parseFloat(h.paddingTop) + Number.parseFloat(h.paddingBottom), Pe = I ? I * b + G : 0, $e = C ? C * b + G : Number.POSITIVE_INFINITY;
23
+ e.style.height = `${Math.min($e, Math.max(Pe, e.scrollHeight))}px`;
24
24
  }, [
25
25
  S,
26
26
  C,
@@ -29,32 +29,33 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
29
29
  A,
30
30
  u
31
31
  ]);
32
- const V = Z([Ie, Ge((e) => {
32
+ const V = Z([Ie, Je((e) => {
33
33
  $.current = e instanceof HTMLTextAreaElement ? e : null;
34
- }, [])]), { style: B, ...we } = c, x = !d && !r, { height: Xe, minHeight: Ze, maxHeight: qe, paddingTop: Oe, paddingBottom: et, ...Me } = M ?? {}, Be = x ? {
34
+ }, [])]), { style: F, ...we } = c, x = !d && !r, { height: Ze, minHeight: qe, maxHeight: Oe, paddingTop: et, paddingBottom: tt, ...Me } = B ?? {}, Be = x ? {
35
35
  ...Me,
36
- ...We()
36
+ ...Ye()
37
37
  } : r ? {
38
38
  boxSizing: "border-box",
39
39
  minHeight: 40,
40
- ...M
41
- } : M, { height: tt, minHeight: nt, maxHeight: it, paddingTop: ot, paddingBottom: at, paddingLeft: lt, paddingRight: Fe, ...Ee } = B ?? {}, ke = x ? {
40
+ ...B
41
+ } : B, { height: nt, minHeight: it, maxHeight: ot, paddingTop: at, paddingBottom: lt, paddingLeft: st, paddingRight: Fe, ...Ee } = F ?? {}, ke = x ? {
42
42
  ...Ee,
43
- ...Ve({
43
+ ...We({
44
44
  paddingLeft: g ? 40 : 14,
45
- paddingRight: Fe ?? xe ?? (w || f ? 40 : 14)
45
+ paddingRight: Fe ?? xe ?? (M || f ? 40 : 14)
46
46
  })
47
- } : B;
47
+ } : F;
48
48
  Q(() => {
49
49
  if (!x) return;
50
50
  const e = j.current, h = e ? Math.ceil(e.getBoundingClientRect().width) + 20 : void 0;
51
51
  be((b) => b === h ? b : h);
52
52
  });
53
- const W = {
53
+ const De = N || !a, W = {
54
54
  ...we,
55
- style: x ? ke : B,
55
+ style: x ? ke : F,
56
+ id: c.id ?? _,
56
57
  name: ae,
57
- placeholder: N || !a ? oe : void 0,
58
+ placeholder: De ? oe : void 0,
58
59
  disabled: s,
59
60
  readOnly: n,
60
61
  required: v,
@@ -68,12 +69,12 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
68
69
  onChange: Ce,
69
70
  onFocus: _e,
70
71
  onBlur: Re,
71
- onKeyDown: c.onKeyDown || D ? (e) => {
72
- D?.(e), e.defaultPrevented || c.onKeyDown?.(e);
72
+ onKeyDown: c.onKeyDown || T ? (e) => {
73
+ T?.(e), e.defaultPrevented || c.onKeyDown?.(e);
73
74
  } : void 0
74
- }, Y = l(y.Input, "peer border-0 bg-transparent text-base tracking-[0.00938em] text-delta-800 outline-none placeholder:text-delta-500", r ? "box-border h-8 min-w-[60px] flex-1 py-0 pl-0 pr-0 leading-[23px]" : d ? "w-full resize-none overflow-hidden p-0 pl-0 pr-0 leading-[23px]" : l("w-full", y["Input--singleLine"]), "disabled:text-delta-300", n && "text-delta-800", He), De = !d && !r ? {
75
+ }, Y = l(y.Input, "peer border-0 bg-transparent text-base tracking-[0.00938em] text-delta-800 outline-none placeholder:text-delta-500", r ? "box-border h-8 min-w-[60px] flex-1 py-0 pl-0 pr-0 leading-[23px]" : d ? "w-full resize-none overflow-hidden p-0 pl-0 pr-0 leading-[23px]" : l("w-full", y["Input--singleLine"]), "disabled:text-delta-300", n && "text-delta-800", He), Te = !d && !r ? {
75
76
  "data-start-adornment": g ? "true" : void 0,
76
- "data-end-adornment": w || f ? "true" : void 0
77
+ "data-end-adornment": M || f ? "true" : void 0
77
78
  } : {};
78
79
  return /* @__PURE__ */ m("div", {
79
80
  className: l("group relative inline-flex flex-col", he),
@@ -82,7 +83,7 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
82
83
  width: ce ? "100%" : 235,
83
84
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
84
85
  letterSpacing: "0.00938em",
85
- ...F(pe),
86
+ ...E(pe),
86
87
  ...me
87
88
  },
88
89
  children: [/* @__PURE__ */ m("div", {
@@ -96,7 +97,7 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
96
97
  children: [
97
98
  g && /* @__PURE__ */ i("span", {
98
99
  className: l("items-center text-delta-500", r ? "contents" : "absolute left-3 flex"),
99
- children: R
100
+ children: w
100
101
  }),
101
102
  d ? /* @__PURE__ */ i("textarea", {
102
103
  ...W,
@@ -106,21 +107,21 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
106
107
  className: Y
107
108
  }) : /* @__PURE__ */ i("input", {
108
109
  ...W,
109
- ...De,
110
+ ...Te,
110
111
  ref: V,
111
112
  "data-testid": p,
112
113
  type: ie,
113
114
  className: Y
114
115
  }),
115
- w ? /* @__PURE__ */ i("button", {
116
+ M ? /* @__PURE__ */ i("button", {
116
117
  type: "button",
117
118
  "aria-label": "Clear",
118
119
  "data-testid": `${p}-clear`,
119
120
  className: "absolute right-4 z-40 flex items-center justify-center rounded-full border-0 bg-transparent p-[2px] duration-300 hover:bg-gama-100",
120
121
  onClick: (e) => {
121
- e.stopPropagation(), e.preventDefault(), _ || K(!1), ne?.();
122
+ e.stopPropagation(), e.preventDefault(), R || K(!1), ne?.();
122
123
  },
123
- children: /* @__PURE__ */ i($e, {
124
+ children: /* @__PURE__ */ i(je, {
124
125
  width: 18,
125
126
  height: 18
126
127
  })
@@ -139,7 +140,7 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
139
140
  notched: !0
140
141
  }),
141
142
  children: /* @__PURE__ */ i("legend", {
142
- className: Ue(N),
143
+ className: Ve(N),
143
144
  children: /* @__PURE__ */ m("span", {
144
145
  className: "inline-block px-[5px]",
145
146
  children: [a, v && " *"]
@@ -157,8 +158,8 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
157
158
  })
158
159
  ]
159
160
  }), a && /* @__PURE__ */ m("label", {
160
- htmlFor: T,
161
- className: l(ze({
161
+ htmlFor: _,
162
+ className: l(Ke({
162
163
  shrink: N,
163
164
  focused: H,
164
165
  error: o,
@@ -167,17 +168,17 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
167
168
  size: re
168
169
  }), t?.inputLabel?.className),
169
170
  style: {
170
- ...F(t?.inputLabel?.sx),
171
+ ...E(t?.inputLabel?.sx),
171
172
  ...t?.inputLabel?.style,
172
- ...Ke(N)
173
+ ...Ue(N)
173
174
  },
174
175
  children: [a, v && " *"]
175
176
  })]
176
177
  }), !n && (L != null || o) && /* @__PURE__ */ m("div", {
177
178
  id: P,
178
179
  className: l(!t?.formHelperText && "mr-[14px] box-border min-h-[24px] pt-1", o && !t?.formHelperText?.hideErrorIcon && "flex items-start gap-1 text-error-500", !o && "text-delta-600", t?.formHelperText?.className),
179
- style: F(t?.formHelperText?.sx),
180
- children: [o && !t?.formHelperText?.hideErrorIcon && /* @__PURE__ */ i(je, {
180
+ style: E(t?.formHelperText?.sx),
181
+ children: [o && !t?.formHelperText?.hideErrorIcon && /* @__PURE__ */ i(ze, {
181
182
  width: 20,
182
183
  height: 20,
183
184
  className: "min-w-5 shrink-0"
@@ -1,39 +1,41 @@
1
- import { cn as E } from "../../../helpers/cn.js";
2
- import { resolveSx as p } from "../../../helpers/sx.js";
3
- import { TOP_LAYER_PROPS as F, TOP_LAYER_RESET_STYLE as O, getOpenModalDialogAncestor as L, useTopLayerRef as M } from "../../../hooks/useTopLayer.hook.js";
4
- import { useEffect as z, useMemo as f, useState as D } from "react";
5
- import { jsx as c } from "react/jsx-runtime";
6
- import { FloatingPortal as N, autoUpdate as k, flip as C, offset as U, shift as Y, useDismiss as H, useFloating as K, useInteractions as $, useMergeRefs as j } from "@floating-ui/react";
7
- var I = {
1
+ import { cn as O } from "../../../helpers/cn.js";
2
+ import { resolveSx as c } from "../../../helpers/sx.js";
3
+ import { TOP_LAYER_PROPS as L, TOP_LAYER_RESET_STYLE as M, getOpenModalDialogAncestor as z, useTopLayerRef as D } from "../../../hooks/useTopLayer.hook.js";
4
+ import { useEffect as N, useMemo as k, useState as d } from "react";
5
+ import { jsx as u } from "react/jsx-runtime";
6
+ import { FloatingPortal as C, autoUpdate as U, flip as Y, offset as H, shift as K, useDismiss as $, useFloating as j, useInteractions as I, useMergeRefs as q } from "@floating-ui/react";
7
+ var B = {
8
8
  vertical: "bottom",
9
9
  horizontal: "left"
10
- }, q = {
10
+ }, G = {
11
11
  vertical: "top",
12
12
  horizontal: "left"
13
- }, B = (e, o) => `${o.vertical === "bottom" ? "top" : o.vertical === "top" ? "bottom" : e.vertical === "top" ? "top" : "bottom"}${e.horizontal === "left" ? "-start" : e.horizontal === "right" ? "-end" : ""}`, Z = ({ open: e, anchorEl: o, onClose: d, anchorOrigin: i = I, transformOrigin: l = q, id: u, className: m, sx: v, slotProps: a, onClick: g, children: h, keepMounted: y = !1 }) => {
14
- const R = f(() => B(i, l), [i, l]), [n, _] = D(e);
15
- e && !n && _(!0);
16
- const r = e || y && n, { refs: s, floatingStyles: x, context: P } = K({
13
+ }, J = (e, o) => `${o.vertical === "bottom" ? "top" : o.vertical === "top" ? "bottom" : e.vertical === "top" ? "top" : "bottom"}${e.horizontal === "left" ? "-start" : e.horizontal === "right" ? "-end" : ""}`, te = ({ open: e, anchorEl: o, onClose: m, anchorOrigin: l = B, transformOrigin: n = G, id: v, className: g, sx: h, slotProps: r, onClick: y, children: R, keepMounted: P = !1 }) => {
14
+ const _ = k(() => J(l, n), [l, n]), [p, x] = d(e);
15
+ e && !p && x(!0);
16
+ const a = e || P && p, s = z(o), [f, w] = d(s);
17
+ o && f !== s && w(s);
18
+ const { refs: i, floatingStyles: S, context: T } = j({
17
19
  open: e,
18
- placement: R,
20
+ placement: _,
19
21
  strategy: "fixed",
20
- whileElementsMounted: k,
22
+ whileElementsMounted: U,
21
23
  elements: { reference: o ?? void 0 },
22
24
  middleware: [
23
- U(4),
24
- C({ padding: 8 }),
25
- Y({ padding: 8 })
25
+ H(4),
26
+ Y({ padding: 8 }),
27
+ K({ padding: 8 })
26
28
  ],
27
- onOpenChange: (t, b, A) => {
28
- t || d?.(b ?? {}, A === "escape-key" ? "escapeKeyDown" : "backdropClick");
29
+ onOpenChange: (t, E, F) => {
30
+ t || m?.(E ?? {}, F === "escape-key" ? "escapeKeyDown" : "backdropClick");
29
31
  }
30
- }), { getFloatingProps: w } = $([H(P, {
32
+ }), { getFloatingProps: b } = I([$(T, {
31
33
  outsidePress: !0,
32
34
  escapeKey: !0
33
- })]), S = j([M(s.setFloating)]), T = f(() => r ? L(o) : void 0, [r, o]);
34
- return z(() => {
35
- if (!r) return;
36
- const t = s.floating.current;
35
+ })]), A = q([D(i.setFloating)]);
36
+ return N(() => {
37
+ if (!a) return;
38
+ const t = i.floating.current;
37
39
  if (!(!t || typeof t.showPopover != "function"))
38
40
  try {
39
41
  e && !t.matches(":popover-open") && t.showPopover(), !e && t.matches(":popover-open") && t.hidePopover();
@@ -41,28 +43,28 @@ var I = {
41
43
  }
42
44
  }, [
43
45
  e,
44
- r,
45
- s.floating
46
- ]), r ? /* @__PURE__ */ c(N, {
47
- root: T,
48
- children: /* @__PURE__ */ c("div", {
49
- ref: S,
50
- id: u,
51
- ...F,
46
+ a,
47
+ i.floating
48
+ ]), a ? /* @__PURE__ */ u(C, {
49
+ root: f,
50
+ children: /* @__PURE__ */ u("div", {
51
+ ref: A,
52
+ id: v,
53
+ ...L,
52
54
  style: {
53
- ...O,
54
- ...e ? x : {},
55
- ...p(v),
56
- ...p(a?.paper?.sx),
57
- ...a?.paper?.style,
55
+ ...M,
56
+ ...e ? S : {},
57
+ ...c(h),
58
+ ...c(r?.paper?.sx),
59
+ ...r?.paper?.style,
58
60
  ...e ? null : { display: "none" }
59
61
  },
60
- ...e ? w({ onClick: g }) : {},
61
- className: E("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", m ?? "my-1", a?.paper?.className),
62
- children: h
62
+ ...e ? b({ onClick: y }) : {},
63
+ className: O("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", g ?? "my-1", r?.paper?.className),
64
+ children: R
63
65
  })
64
66
  }) : null;
65
67
  };
66
68
  export {
67
- Z as StyledPopover
69
+ te as StyledPopover
68
70
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.53.1",
6
+ "version": "3.54.1",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",