asma-ui-core 3.59.0 → 3.61.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.
@@ -1,4 +1,4 @@
1
- import { cn as a } from "../../helpers/cn.js";
1
+ import { cn as n } from "../../helpers/cn.js";
2
2
  var d = () => ({
3
3
  boxSizing: "border-box",
4
4
  height: 40,
@@ -22,7 +22,7 @@ var d = () => ({
22
22
  } : {
23
23
  top: "50%",
24
24
  transform: "translateY(-50%)"
25
- }, x = ({ focused: e, error: r, disabled: t, readOnly: o }) => a("pointer-events-none absolute inset-0 rounded border border-solid transition-colors", t ? "border-delta-300" : o ? "border-delta-200" : r ? a("border-error-500", e && "border-2") : e ? "border-2 border-gama-400" : "border-delta-500 group-hover:border-2 group-hover:border-gama-300"), s = ({ focused: e, error: r, disabled: t, readOnly: o, notched: n = !0 }) => a("pointer-events-none absolute z-0 m-0 box-border min-w-0 overflow-hidden rounded border border-solid transition-colors", n ? "inset-x-0 bottom-0 top-[-5px] px-2 py-0" : "inset-0", t ? "border-delta-300" : o ? "border-delta-200" : r ? "border-error-500" : e ? "border-2 border-gama-400" : "border-delta-500 group-hover:border-2 group-hover:border-gama-300"), g = (e) => a("invisible block h-[11px] overflow-hidden p-0 text-xs leading-[23px] transition-[max-width] duration-150", e ? "max-w-full" : "max-w-[0.01px]"), p = ({ shrink: e, focused: r, error: t, disabled: o, readOnly: n }) => a("pointer-events-none absolute left-[14px] z-10 max-w-[calc(100%-1.75rem)] truncate transition-colors duration-150", o ? "text-delta-300" : n ? "text-delta-800" : t ? "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]");
25
+ }, x = ({ focused: e, error: r, disabled: t, readOnly: o, borderless: a }) => n("pointer-events-none absolute inset-0 rounded border border-solid transition-colors", a && !e ? "border-transparent" : t ? "border-delta-300" : o ? "border-delta-200" : r ? n("border-error-500", e && "border-2") : e ? "border-2 border-gama-400" : "border-delta-500 group-hover:border-2 group-hover:border-gama-300"), s = ({ focused: e, error: r, disabled: t, readOnly: o, notched: a = !0 }) => n("pointer-events-none absolute z-0 m-0 box-border min-w-0 overflow-hidden rounded border border-solid transition-colors", a ? "inset-x-0 bottom-0 top-[-5px] px-2 py-0" : "inset-0", t ? "border-delta-300" : o ? "border-delta-200" : r ? "border-error-500" : e ? "border-2 border-gama-400" : "border-delta-500 group-hover:border-2 group-hover:border-gama-300"), g = (e) => n("invisible block h-[11px] overflow-hidden p-0 text-xs leading-[23px] transition-[max-width] duration-150", e ? "max-w-full" : "max-w-[0.01px]"), p = ({ shrink: e, focused: r, error: t, disabled: o, readOnly: a }) => n("pointer-events-none absolute left-[14px] z-10 max-w-[calc(100%-1.75rem)] truncate transition-colors duration-150", o ? "text-delta-300" : a ? "text-delta-800" : t ? "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]");
26
26
  export {
27
27
  p as floatingLabelClass,
28
28
  b as floatingLabelLayoutStyle,
@@ -1,45 +1,45 @@
1
1
  import { cn as f } from "../../../helpers/cn.js";
2
- import { resolveSx as fe } from "../../../helpers/sx.js";
3
- import { ChevronDownIcon as pe } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
4
- import { CloseIcon as me } from "../../icons/close-icon/CloseIcon.js";
5
- import { ErrorOutlineIcon as xe } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
6
- import { TOP_LAYER_PROPS as ye, TOP_LAYER_RESET_STYLE as ge, getOpenModalDialogAncestor as be, useTopLayerRef as he } from "../../../hooks/useTopLayer.hook.js";
7
- import { outlineClass as we } from "../field-styles.js";
8
- import { useFormControlContext as Ae } from "../../miscellaneous/FormControlContext.js";
9
- import { StyledFormHelperText as ve } from "../../miscellaneous/StyledFormHelperText.js";
10
- import { Children as S, cloneElement as Re, isValidElement as E, useEffect as C, useMemo as ke, useRef as De, useState as N } from "react";
11
- import { jsx as n, jsxs as g } from "react/jsx-runtime";
12
- import { FloatingPortal as Fe, autoUpdate as Se, flip as Ee, offset as Ce, shift as Ne, size as _e, useClick as qe, useDismiss as Pe, useFloating as Te, useInteractions as Ve, useMergeRefs as K, useRole as je } from "@floating-ui/react";
13
- var Ge = ({ dataTest: _, value: q, defaultValue: L, onChange: P, error: M, errorText: H, allowClear: T, disabled: O, readOnly: c, name: p, placeholder: b, displayEmpty: h, multiple: d, renderValue: V, fullWidth: Y, className: z, style: W, sx: $, variant: G, children: w, MenuProps: J, onFocus: Q, onBlur: X, labelId: m }) => {
14
- const a = Ae(), j = `${_}-listbox`, A = G === "standard", I = M ?? a?.error ?? !1, s = O ?? a?.disabled ?? !1, [o, x] = N(!1), [v, R] = N(!1), [Z, U] = N(L), k = q !== void 0, r = k ? q : Z, l = Array.isArray(r) ? r.length > 0 : r !== void 0 && r !== "" && r !== null, i = De(null), { refs: u, floatingStyles: ee, context: D } = Te({
2
+ import { resolveSx as ge } from "../../../helpers/sx.js";
3
+ import { ChevronDownIcon as xe } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
4
+ import { CloseIcon as ye } from "../../icons/close-icon/CloseIcon.js";
5
+ import { ErrorOutlineIcon as be } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
6
+ import { TOP_LAYER_PROPS as he, TOP_LAYER_RESET_STYLE as we, getOpenModalDialogAncestor as Ae, useTopLayerRef as ve } from "../../../hooks/useTopLayer.hook.js";
7
+ import { outlineClass as Re } from "../field-styles.js";
8
+ import { useFormControlContext as ke } from "../../miscellaneous/FormControlContext.js";
9
+ import { StyledFormHelperText as Fe } from "../../miscellaneous/StyledFormHelperText.js";
10
+ import { Children as C, cloneElement as De, isValidElement as E, useEffect as N, useMemo as Se, useRef as Ce, useState as _ } from "react";
11
+ import { jsx as n, jsxs as h } from "react/jsx-runtime";
12
+ import { FloatingPortal as Ee, autoUpdate as Ne, flip as _e, offset as qe, shift as Pe, size as Te, useClick as Ve, useDismiss as je, useFloating as Be, useInteractions as Ie, useMergeRefs as L, useRole as Ue } from "@floating-ui/react";
13
+ var Xe = ({ dataTest: q, value: P, defaultValue: M, onChange: T, error: H, errorText: O, allowClear: V, disabled: Y, readOnly: c, name: m, placeholder: w, displayEmpty: A, multiple: d, renderValue: j, fullWidth: z, className: W, style: $, sx: G, variant: J, children: v, MenuProps: Q, onFocus: X, onBlur: Z, labelId: p }) => {
14
+ const a = ke(), B = `${q}-listbox`, g = J === "standard", I = H ?? a?.error ?? !1, s = Y ?? a?.disabled ?? !1, [o, x] = _(!1), [y, R] = _(!1), [ee, U] = _(M), k = P !== void 0, r = k ? P : ee, l = Array.isArray(r) ? r.length > 0 : r !== void 0 && r !== "" && r !== null, i = Ce(null), { refs: u, floatingStyles: te, context: F } = Be({
15
15
  open: o,
16
16
  onOpenChange: x,
17
17
  placement: "bottom-start",
18
18
  strategy: "fixed",
19
- whileElementsMounted: Se,
19
+ whileElementsMounted: Ne,
20
20
  middleware: [
21
- Ce(4),
22
- Ee({ padding: 8 }),
23
- Ne({ padding: 8 }),
24
- _e({ apply({ rects: e, elements: t }) {
21
+ qe(4),
22
+ _e({ padding: 8 }),
23
+ Pe({ padding: 8 }),
24
+ Te({ apply({ rects: e, elements: t }) {
25
25
  t.floating.style.minWidth = `${e.reference.width + 20}px`;
26
26
  } })
27
27
  ]
28
- }), { getReferenceProps: te, getFloatingProps: re } = Ve([
29
- qe(D, { enabled: !s && !c }),
30
- Pe(D),
31
- je(D, { role: "listbox" })
32
- ]), oe = K([u.setReference]), se = K([he(u.setFloating), i]), ne = ke(() => o ? be(u.reference.current) : void 0, [o, u]);
33
- C(() => a?.setFocused(o || v), [
28
+ }), { getReferenceProps: re, getFloatingProps: oe } = Ie([
29
+ Ve(F, { enabled: !s && !c }),
30
+ je(F),
31
+ Ue(F, { role: "listbox" })
32
+ ]), se = L([u.setReference]), ne = L([ve(u.setFloating), i]), le = Se(() => o ? Ae(u.reference.current) : void 0, [o, u]);
33
+ N(() => a?.setFocused(o || y), [
34
34
  o,
35
- v,
35
+ y,
36
36
  a
37
- ]), C(() => a?.setFilled(l || !!b || !!h), [
37
+ ]), N(() => a?.setFilled(l || !!w || !!A), [
38
38
  l,
39
- b,
40
- h,
39
+ w,
40
+ A,
41
41
  a
42
- ]), C(() => {
42
+ ]), N(() => {
43
43
  if (!o) return;
44
44
  const e = requestAnimationFrame(() => {
45
45
  const t = i.current?.querySelector('[role="option"][aria-selected="true"]');
@@ -47,31 +47,31 @@ var Ge = ({ dataTest: _, value: q, defaultValue: L, onChange: P, error: M, error
47
47
  });
48
48
  return () => cancelAnimationFrame(e);
49
49
  }, [o]);
50
- const le = (e, t) => {
51
- const y = d ? Array.isArray(r) && r.includes(e) ? r.filter((F) => F !== e) : [...Array.isArray(r) ? r : [], e] : e;
52
- k || U(y), P?.({ target: {
53
- value: y,
54
- name: p
50
+ const ae = (e, t) => {
51
+ const b = d ? Array.isArray(r) && r.includes(e) ? r.filter((S) => S !== e) : [...Array.isArray(r) ? r : [], e] : e;
52
+ k || U(b), T?.({ target: {
53
+ value: b,
54
+ name: m
55
55
  } }, t), d || (x(!1), requestAnimationFrame(() => u.domReference.current?.focus()));
56
- }, B = () => {
56
+ }, K = () => {
57
57
  const e = d ? [] : "";
58
- k || U(e), P?.({ target: {
58
+ k || U(e), T?.({ target: {
59
59
  value: e,
60
- name: p
60
+ name: m
61
61
  } }, null), x(!1), R(!1);
62
- }, ae = S.map(w, (e) => {
62
+ }, ie = C.map(v, (e) => {
63
63
  if (!E(e)) return e;
64
64
  const t = e.props.value;
65
- return Re(e, {
65
+ return De(e, {
66
66
  selected: d ? Array.isArray(r) && r.includes(t) : t === r,
67
- onClick: () => le(t, e.props.children)
67
+ onClick: () => ae(t, e.props.children)
68
68
  });
69
- }), ie = S.toArray(w).find((e) => E(e) && e.props.value === r), ce = V ? V(r) : d && Array.isArray(r) ? S.toArray(w).filter((e) => E(e) && r.includes(e.props.value)).map((e) => {
69
+ }), ce = C.toArray(v).find((e) => E(e) && e.props.value === r), de = j ? j(r) : d && Array.isArray(r) ? C.toArray(v).filter((e) => E(e) && r.includes(e.props.value)).map((e) => {
70
70
  const t = e.props.children;
71
71
  return typeof t == "string" || typeof t == "number" ? String(t) : "";
72
- }).join(", ") : ie?.props.children, de = (e) => {
73
- if ((e.key === "Backspace" || e.key === "Delete") && T && l && !s && !c) {
74
- e.preventDefault(), B();
72
+ }).join(", ") : ce?.props.children, ue = (e) => {
73
+ if ((e.key === "Backspace" || e.key === "Delete") && V && l && !s && !c) {
74
+ e.preventDefault(), K();
75
75
  return;
76
76
  }
77
77
  e.key !== "ArrowDown" && e.key !== "ArrowUp" || s || c || (e.preventDefault(), x(!0), requestAnimationFrame(() => {
@@ -79,103 +79,104 @@ var Ge = ({ dataTest: _, value: q, defaultValue: L, onChange: P, error: M, error
79
79
  const t = i.current?.querySelectorAll('[role="option"]:not([aria-disabled="true"])');
80
80
  t?.length && t[e.key === "ArrowUp" ? t.length - 1 : 0]?.focus();
81
81
  }));
82
- }, ue = (e) => {
82
+ }, fe = (e) => {
83
83
  const t = i.current ? Array.from(i.current.querySelectorAll('[role="option"]:not([aria-disabled="true"])')) : [];
84
84
  if (t.length === 0) return;
85
- const y = t.findIndex((F) => F === document.activeElement);
86
- e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), t[(y + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length]?.focus()) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), document.activeElement?.click());
87
- };
88
- return /* @__PURE__ */ g("div", {
89
- className: f("group relative inline-flex flex-col", Y && "w-full", z),
85
+ const b = t.findIndex((S) => S === document.activeElement);
86
+ e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), t[(b + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length]?.focus()) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), document.activeElement?.click());
87
+ }, D = g && (o || y), me = s ? "text-delta-300" : D ? "text-gama-500" : "text-delta-800", pe = s ? "text-delta-300" : "text-delta-700";
88
+ return /* @__PURE__ */ h("div", {
89
+ className: f("group relative inline-flex flex-col", z && "w-full", W),
90
90
  style: {
91
91
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
92
- ...fe($),
93
- ...W
92
+ ...ge(G),
93
+ ...$
94
94
  },
95
95
  children: [
96
- /* @__PURE__ */ g("button", {
97
- ref: oe,
96
+ /* @__PURE__ */ h("button", {
97
+ ref: se,
98
98
  type: "button",
99
- "data-testid": _,
100
- ...te({ onKeyDown: de }),
99
+ "data-testid": q,
100
+ ...re({ onKeyDown: ue }),
101
101
  role: "combobox",
102
102
  "aria-haspopup": "listbox",
103
103
  "aria-expanded": o,
104
- "aria-controls": j,
105
- "aria-labelledby": m,
106
- "aria-label": m ? void 0 : p,
104
+ "aria-controls": B,
105
+ "aria-labelledby": p,
106
+ "aria-label": p ? void 0 : m,
107
107
  "aria-disabled": s ? !0 : void 0,
108
108
  disabled: s,
109
109
  onFocus: (e) => {
110
- R(!0), Q?.(e);
110
+ R(!0), X?.(e);
111
111
  },
112
112
  onBlur: (e) => {
113
- R(!1), X?.(e);
113
+ R(!1), Z?.(e);
114
114
  },
115
- style: { minWidth: l && !A ? 105 : void 0 },
116
- className: f("relative flex w-full items-center justify-between bg-transparent text-left text-delta-800 outline-none", A ? "h-10 min-w-0 border-0 px-0 text-base" : "h-10 rounded-lg border-0 px-3 text-base", s && "cursor-not-allowed text-delta-300", c && "pointer-events-none"),
115
+ style: { minWidth: l && !g ? 105 : void 0 },
116
+ className: f("relative flex w-full items-center justify-between text-left outline-none", "h-10 rounded-lg border-0 px-3 text-base transition-colors", D ? "bg-gama-50" : "bg-transparent", me, g && "min-w-0", s && "cursor-not-allowed", c && "pointer-events-none"),
117
117
  children: [
118
118
  /* @__PURE__ */ n("span", {
119
119
  className: f("min-w-0 flex-1 truncate", !l && "text-delta-500"),
120
- children: l || h ? ce : b
120
+ children: l || A ? de : w
121
121
  }),
122
- /* @__PURE__ */ g("span", {
122
+ /* @__PURE__ */ h("span", {
123
123
  className: "flex items-center gap-1",
124
- children: [T && l && !s && /* @__PURE__ */ n("span", {
124
+ children: [V && l && !s && /* @__PURE__ */ n("span", {
125
125
  "aria-hidden": "true",
126
126
  "data-testid": "select-clear-button",
127
127
  className: "flex items-center justify-center rounded-full p-[2px] hover:bg-gama-100",
128
128
  onClick: (e) => {
129
- e.stopPropagation(), B();
129
+ e.stopPropagation(), K();
130
130
  },
131
- children: /* @__PURE__ */ n(me, {
131
+ children: /* @__PURE__ */ n(ye, {
132
132
  width: 18,
133
133
  height: 18
134
134
  })
135
- }), /* @__PURE__ */ n(pe, {
135
+ }), /* @__PURE__ */ n(xe, {
136
136
  width: 24,
137
137
  height: 24,
138
- className: f("shrink-0 transition-transform", s ? "text-delta-300" : "text-delta-700", o && "rotate-180")
138
+ className: f("shrink-0 transition-transform", D ? "text-gama-500" : pe, o && "rotate-180")
139
139
  })]
140
140
  }),
141
- !A && /* @__PURE__ */ n("div", { className: we({
142
- focused: o || v,
141
+ /* @__PURE__ */ n("div", { className: Re({
142
+ focused: o || y,
143
143
  error: I,
144
144
  disabled: s,
145
- readOnly: c
145
+ readOnly: c,
146
+ borderless: g
146
147
  }) })
147
148
  ]
148
149
  }),
149
- o && /* @__PURE__ */ n(Fe, {
150
- root: ne,
150
+ o && /* @__PURE__ */ n(Ee, {
151
+ root: le,
151
152
  children: /* @__PURE__ */ n("ul", {
152
- ref: se,
153
- id: j,
153
+ ref: ne,
154
+ id: B,
154
155
  role: "listbox",
155
- "aria-labelledby": m,
156
- "aria-label": m ? void 0 : p,
157
- ...ye,
156
+ "aria-labelledby": p,
157
+ "aria-label": p ? void 0 : m,
158
+ ...he,
158
159
  style: {
159
- ...ge,
160
- ...ee,
160
+ ...we,
161
+ ...te,
161
162
  fontFamily: "Roboto, Helvetica, Arial, sans-serif"
162
163
  },
163
- ...re(),
164
- onKeyDown: ue,
165
- className: f("z-[1300] m-0 max-h-72 list-none overflow-auto rounded-lg border border-solid border-delta-300 bg-white px-0 py-1 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", J?.className),
166
- children: ae
164
+ ...oe(),
165
+ onKeyDown: fe,
166
+ className: f("z-[1300] m-0 max-h-72 list-none overflow-auto rounded-lg border border-solid border-delta-300 bg-white px-0 py-1 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", Q?.className),
167
+ children: ie
167
168
  })
168
169
  }),
169
- I && /* @__PURE__ */ g(ve, {
170
+ I && /* @__PURE__ */ h(Fe, {
170
171
  className: "m-0 flex items-center gap-1 pt-1 text-sm text-error-500",
171
- children: [/* @__PURE__ */ n(xe, {
172
+ children: [/* @__PURE__ */ n(be, {
172
173
  width: 20,
173
174
  height: 20
174
- }), H ?? "Required"]
175
+ }), O ?? "Required"]
175
176
  })
176
177
  ]
177
178
  });
178
179
  };
179
180
  export {
180
- Ge as StyledSelect
181
+ Xe as StyledSelect
181
182
  };
@@ -9,7 +9,7 @@ function g(a) {
9
9
  return /* @__PURE__ */ l(S, {
10
10
  style: {
11
11
  marginLeft: "-2px",
12
- marginRight: "8px"
12
+ marginRight: "4px"
13
13
  },
14
14
  children: /* @__PURE__ */ l(s, {
15
15
  dataTest: "StyledCalendarPickerSelectMonth",
@@ -3,20 +3,17 @@ import { StyledSelectItem as u } from "../../../../components/inputs/select/Styl
3
3
  import { StyledFormControl as S } from "../../../../components/miscellaneous/StyledFormControl.js";
4
4
  import y from "./StyledCalendarPickerSelectPeriod.module.js";
5
5
  import { jsx as a } from "react/jsx-runtime";
6
- function C(l) {
7
- const { options: r = [], onChange: t, value: d, disabled: i, className: n, style: m, name: c } = l, s = l["aria-label"];
6
+ function h(l) {
7
+ const { options: r = [], onChange: t, value: d, disabled: n, className: i, style: m, name: c } = l, s = l["aria-label"];
8
8
  return /* @__PURE__ */ a(S, {
9
- style: {
10
- width: "70px",
11
- marginLeft: "5px"
12
- },
9
+ style: { marginLeft: "4px" },
13
10
  children: /* @__PURE__ */ a(o, {
14
11
  dataTest: "StyledCalendarPickerSelectYear",
15
12
  size: "small",
16
13
  variant: "standard",
17
14
  name: s ?? c,
18
- disabled: i,
19
- className: n,
15
+ disabled: n,
16
+ className: i,
20
17
  style: m,
21
18
  value: d ?? "",
22
19
  onChange: (e) => t?.(e),
@@ -30,5 +27,5 @@ function C(l) {
30
27
  });
31
28
  }
32
29
  export {
33
- C as StyledCalendarPickerSelectYear
30
+ h as StyledCalendarPickerSelectYear
34
31
  };
@@ -21,9 +21,11 @@ interface FieldState {
21
21
  error?: boolean;
22
22
  disabled?: boolean;
23
23
  readOnly?: boolean;
24
+ /** `variant="standard"`: same geometry as the outlined field, but the border is painted on focus only. */
25
+ borderless?: boolean;
24
26
  }
25
27
  /** The border overlay (an absolutely-positioned sibling so width changes never reflow the input). */
26
- export declare const outlineClass: ({ focused, error, disabled, readOnly }: FieldState) => string;
28
+ export declare const outlineClass: ({ focused, error, disabled, readOnly, borderless }: FieldState) => string;
27
29
  /** MUI-compatible fieldset outline used by text fields with floating labels. */
28
30
  export declare const notchedOutlineClass: ({ focused, error, disabled, readOnly, notched, }: FieldState & {
29
31
  notched?: boolean;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.59.0",
6
+ "version": "3.61.0",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",