asma-ui-core 3.58.3 → 3.58.5

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,113 +1,113 @@
1
- import { cn as l } from "../../../helpers/cn.js";
1
+ import { cn as s } from "../../../helpers/cn.js";
2
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";
3
+ import { CloseIcon as Ke } from "../../icons/close-icon/CloseIcon.js";
4
+ import { ErrorOutlineIcon as Ue } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
5
+ import { floatingLabelClass as Ve, floatingLabelLayoutStyle as We, notchedLegendClass as Ye, notchedOutlineClass as J, singleLineInputLayoutStyle as Ge, singleLineShellLayoutStyle as Je } from "../field-styles.js";
6
6
  import y from "./StyledInputField.module.js";
7
- import { Children as Ge, useCallback as Je, useId as Qe, useLayoutEffect as Q, useRef as X, useState as k } from "react";
8
- import { jsx as i, jsxs as m } from "react/jsx-runtime";
7
+ import { Children as Qe, useCallback as Xe, useId as Ze, useLayoutEffect as Q, useRef as X, useState as k } from "react";
8
+ import { jsx as i, jsxs as h } 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: 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) => {
10
+ var St = ({ dataTest: p, label: l, value: u, defaultValue: S, onChange: q, onBlur: O, onFocus: ee, error: o, helperText: L, disabled: d, readOnly: n, required: H, allowClear: te, onClear: ne, type: ie = "text", placeholder: oe, name: ae, id: le, autoComplete: se, autoFocus: de, multiline: r, rows: A, minRows: v, maxRows: C, size: re = "medium", fullWidth: ce, className: me, style: he, sx: pe, inputRef: ue, slotProps: t, InputProps: D, onKeyDown: T, onClick: ge, variant: qe }) => {
11
+ const fe = Ze(), _ = le ?? fe, P = `${_}-helper-text`, $ = X(null), j = X(null), [xe, be] = k(void 0), [I, z] = k(!1), [ye, K] = k(S != null && S !== ""), R = u !== void 0, U = R ? u !== "" && u != null : ye, Se = !!d || !!n, w = t?.input?.startAdornment ?? D?.startAdornment, g = Qe.count(w) > 0, c = g && Array.isArray(w), f = t?.input?.endAdornment ?? D?.endAdornment, M = !!(te && U && !Se), { ref: Le, ...a } = t?.htmlInput ?? {}, ve = ue ?? Le, { className: Ie, style: B, ref: Ne } = t?.input ?? {}, He = Z([Ne]), Ae = t?.input?.onMouseDown, Ce = se ?? a.autoComplete, _e = ae ?? a.name, N = I || U || g, Re = (e) => {
12
12
  n || (R || K(e.target.value !== ""), q?.(e));
13
- }, _e = (e) => {
14
- !s && !n && z(!0), ee?.(e);
15
- }, Re = (e) => {
16
- !s && !n && z(!1), O?.(e);
13
+ }, we = (e) => {
14
+ !d && !n && z(!0), ee?.(e);
15
+ }, Me = (e) => {
16
+ !d && !n && z(!1), O?.(e);
17
17
  };
18
18
  Q(() => {
19
19
  const e = $.current;
20
- if (!d || A != null || !e) return;
20
+ if (!r || 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), 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`;
22
+ const m = getComputedStyle(e), b = Number.parseFloat(m.lineHeight) || 24, G = Number.parseFloat(m.paddingTop) + Number.parseFloat(m.paddingBottom), je = v ? v * b + G : 0, ze = C ? C * b + G : Number.POSITIVE_INFINITY;
23
+ e.style.height = `${Math.min(ze, Math.max(je, e.scrollHeight))}px`;
24
24
  }, [
25
25
  S,
26
26
  C,
27
- I,
28
- d,
27
+ v,
28
+ r,
29
29
  A,
30
30
  u
31
31
  ]);
32
- const V = Z([Ie, Je((e) => {
32
+ const V = Z([ve, Xe((e) => {
33
33
  $.current = e instanceof HTMLTextAreaElement ? e : null;
34
- }, [])]), { style: F, ...we } = c, x = !d && !r, { height: Ze, minHeight: qe, maxHeight: Oe, paddingTop: et, paddingBottom: tt, ...Me } = B ?? {}, Be = x ? {
35
- ...Me,
36
- ...Ye()
37
- } : r ? {
34
+ }, [])]), { style: F, ...Be } = a, x = !r && !c, { height: Oe, minHeight: et, maxHeight: tt, paddingTop: nt, paddingBottom: it, ...Fe } = B ?? {}, Ee = x ? {
35
+ ...Fe,
36
+ ...Je()
37
+ } : c ? {
38
38
  boxSizing: "border-box",
39
39
  minHeight: 40,
40
40
  ...B
41
- } : B, { height: nt, minHeight: it, maxHeight: ot, paddingTop: at, paddingBottom: lt, paddingLeft: st, paddingRight: Fe, ...Ee } = F ?? {}, ke = x ? {
42
- ...Ee,
43
- ...We({
41
+ } : B, { height: ot, minHeight: at, maxHeight: lt, paddingTop: st, paddingBottom: dt, paddingLeft: rt, paddingRight: ke, ...De } = F ?? {}, Te = x ? {
42
+ ...De,
43
+ ...Ge({
44
44
  paddingLeft: g ? 40 : 14,
45
- paddingRight: Fe ?? xe ?? (M || f ? 40 : 14)
45
+ paddingRight: ke ?? xe ?? (M || f ? 40 : 14)
46
46
  })
47
47
  } : F;
48
48
  Q(() => {
49
49
  if (!x) return;
50
- const e = j.current, h = e ? Math.ceil(e.getBoundingClientRect().width) + 20 : void 0;
51
- be((b) => b === h ? b : h);
50
+ const e = j.current, m = e ? Math.ceil(e.getBoundingClientRect().width) + 20 : void 0;
51
+ be((b) => b === m ? b : m);
52
52
  });
53
- const De = N || !a, W = {
54
- ...we,
55
- style: x ? ke : F,
56
- id: c.id ?? _,
57
- name: ae,
58
- placeholder: De ? oe : void 0,
59
- disabled: s,
53
+ const Pe = N || !l, W = {
54
+ ...Be,
55
+ style: x ? Te : F,
56
+ id: a.id ?? _,
57
+ name: _e,
58
+ placeholder: Pe ? oe : void 0,
59
+ disabled: d,
60
60
  readOnly: n,
61
- required: v,
62
- autoComplete: se,
61
+ required: H,
62
+ autoComplete: Ce,
63
63
  autoFocus: de,
64
64
  value: u,
65
65
  defaultValue: S,
66
66
  "aria-invalid": o ? !0 : void 0,
67
- "aria-label": c["aria-label"] ?? (c["aria-labelledby"] ? void 0 : typeof a == "string" && a !== "" ? a : void 0),
68
- "aria-describedby": !n && (L != null || o) ? P : c["aria-describedby"],
69
- onChange: Ce,
70
- onFocus: _e,
71
- onBlur: Re,
72
- onKeyDown: c.onKeyDown || T ? (e) => {
73
- T?.(e), e.defaultPrevented || c.onKeyDown?.(e);
67
+ "aria-label": a["aria-label"] ?? (a["aria-labelledby"] ? void 0 : typeof l == "string" && l !== "" ? l : void 0),
68
+ "aria-describedby": !n && (L != null || o) ? P : a["aria-describedby"],
69
+ onChange: Re,
70
+ onFocus: we,
71
+ onBlur: Me,
72
+ onKeyDown: a.onKeyDown || T ? (e) => {
73
+ T?.(e), e.defaultPrevented || a.onKeyDown?.(e);
74
74
  } : void 0
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
+ }, Y = s(y.Input, "peer border-0 bg-transparent text-base tracking-[0.00938em] text-delta-800 outline-none placeholder:text-delta-500", c ? "box-border h-8 min-w-[60px] flex-1 py-0 pl-0 pr-0 leading-[23px]" : r ? "w-full resize-none overflow-hidden p-0 pl-0 pr-0 leading-[23px]" : s("w-full", y["Input--singleLine"]), "disabled:text-delta-300", n && "text-delta-800", Ie), $e = !r && !c ? {
76
76
  "data-start-adornment": g ? "true" : void 0,
77
77
  "data-end-adornment": M || f ? "true" : void 0
78
78
  } : {};
79
- return /* @__PURE__ */ m("div", {
80
- className: l("group relative inline-flex flex-col", he),
79
+ return /* @__PURE__ */ h("div", {
80
+ className: s("group relative inline-flex flex-col", me),
81
81
  onClick: ge,
82
82
  style: {
83
83
  width: ce ? "100%" : 235,
84
84
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
85
85
  letterSpacing: "0.00938em",
86
86
  ...E(pe),
87
- ...me
87
+ ...he
88
88
  },
89
- children: [/* @__PURE__ */ m("div", {
89
+ children: [/* @__PURE__ */ h("div", {
90
90
  className: "relative overflow-visible",
91
- children: [/* @__PURE__ */ m("div", {
92
- className: l("relative flex", x && y.InputShell, d && "box-border items-center px-[14px] py-[16.5px]", r && l(y.AdornmentList, f && y["AdornmentList--endAdornment"]), n && "rounded bg-delta-50"),
93
- ref: ve,
91
+ children: [/* @__PURE__ */ h("div", {
92
+ className: s("relative flex", x && y.InputShell, r && "box-border items-center px-[14px] py-[16.5px]", c && s(y.AdornmentList, f && y["AdornmentList--endAdornment"]), n && "rounded bg-delta-50"),
93
+ ref: He,
94
94
  onMouseDown: Ae,
95
- style: Be,
96
- "data-testid": r ? `${p}-adornment-list` : `${p}-shell`,
95
+ style: Ee,
96
+ "data-testid": c ? `${p}-adornment-list` : `${p}-shell`,
97
97
  children: [
98
98
  g && /* @__PURE__ */ i("span", {
99
- className: l("items-center text-delta-500", r ? "contents" : "absolute left-3 flex"),
99
+ className: s("items-center text-delta-500", c ? "contents" : "absolute left-3 flex"),
100
100
  children: w
101
101
  }),
102
- d ? /* @__PURE__ */ i("textarea", {
102
+ r ? /* @__PURE__ */ i("textarea", {
103
103
  ...W,
104
104
  ref: V,
105
105
  "data-testid": p,
106
- rows: A ?? I ?? 2,
106
+ rows: A ?? v ?? 2,
107
107
  className: Y
108
108
  }) : /* @__PURE__ */ i("input", {
109
109
  ...W,
110
- ...Te,
110
+ ...$e,
111
111
  ref: V,
112
112
  "data-testid": p,
113
113
  type: ie,
@@ -121,7 +121,7 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
121
121
  onClick: (e) => {
122
122
  e.stopPropagation(), e.preventDefault(), R || K(!1), ne?.();
123
123
  },
124
- children: /* @__PURE__ */ i(je, {
124
+ children: /* @__PURE__ */ i(Ke, {
125
125
  width: 18,
126
126
  height: 18
127
127
  })
@@ -130,55 +130,55 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
130
130
  className: "absolute inset-y-0 right-[14px] flex max-w-[calc(100%-28px)] items-center gap-1",
131
131
  children: f
132
132
  }),
133
- a ? /* @__PURE__ */ i("fieldset", {
133
+ l ? /* @__PURE__ */ i("fieldset", {
134
134
  "aria-hidden": !0,
135
135
  className: J({
136
- focused: H,
136
+ focused: I,
137
137
  error: o,
138
- disabled: s,
138
+ disabled: d,
139
139
  readOnly: n,
140
140
  notched: !0
141
141
  }),
142
142
  children: /* @__PURE__ */ i("legend", {
143
- className: Ve(N),
144
- children: /* @__PURE__ */ m("span", {
143
+ className: Ye(N),
144
+ children: /* @__PURE__ */ h("span", {
145
145
  className: "inline-block px-[5px]",
146
- children: [a, v && " *"]
146
+ children: [l, H && " *"]
147
147
  })
148
148
  })
149
149
  }) : /* @__PURE__ */ i("div", {
150
150
  "aria-hidden": !0,
151
151
  className: J({
152
- focused: H,
152
+ focused: I,
153
153
  error: o,
154
- disabled: s,
154
+ disabled: d,
155
155
  readOnly: n,
156
156
  notched: !1
157
157
  })
158
158
  })
159
159
  ]
160
- }), a && /* @__PURE__ */ m("label", {
160
+ }), l && /* @__PURE__ */ h("label", {
161
161
  htmlFor: _,
162
- className: l(Ke({
162
+ className: s(Ve({
163
163
  shrink: N,
164
- focused: H,
164
+ focused: I,
165
165
  error: o,
166
- disabled: s,
166
+ disabled: d,
167
167
  readOnly: n,
168
168
  size: re
169
169
  }), t?.inputLabel?.className),
170
170
  style: {
171
171
  ...E(t?.inputLabel?.sx),
172
172
  ...t?.inputLabel?.style,
173
- ...Ue(N)
173
+ ...We(N)
174
174
  },
175
- children: [a, v && " *"]
175
+ children: [l, H && " *"]
176
176
  })]
177
- }), !n && (L != null || o) && /* @__PURE__ */ m("div", {
177
+ }), !n && (L != null || o) && /* @__PURE__ */ h("div", {
178
178
  id: P,
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
+ className: s(!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),
180
180
  style: E(t?.formHelperText?.sx),
181
- children: [o && !t?.formHelperText?.hideErrorIcon && /* @__PURE__ */ i(ze, {
181
+ children: [o && !t?.formHelperText?.hideErrorIcon && /* @__PURE__ */ i(Ue, {
182
182
  width: 20,
183
183
  height: 20,
184
184
  className: "min-w-5 shrink-0"
@@ -190,5 +190,5 @@ var bt = ({ dataTest: p, label: a, value: u, defaultValue: S, onChange: q, onBlu
190
190
  });
191
191
  };
192
192
  export {
193
- bt as StyledInputField
193
+ St as StyledInputField
194
194
  };
@@ -46,6 +46,11 @@ export interface StyledInputFieldProps {
46
46
  placeholder?: string;
47
47
  name?: string;
48
48
  id?: string;
49
+ /**
50
+ * Standard HTML `autocomplete`. Left unset the browser decides, which is what a plain text field
51
+ * wants; a component that owns its own suggestion list (a combobox) must pass `'off'` so the
52
+ * browser's dropdown doesn't cover it. Also readable from `slotProps.htmlInput.autoComplete`.
53
+ */
49
54
  autoComplete?: string;
50
55
  autoFocus?: boolean;
51
56
  multiline?: boolean;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.58.3",
6
+ "version": "3.58.5",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",