asma-ui-core 3.58.5 → 3.60.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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/inputs/field-styles.js +2 -2
- package/dist/components/inputs/select/StyledSelect.js +70 -61
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectMonth.js +1 -1
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectYear.js +6 -9
- package/dist/src/components/inputs/field-styles.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn as
|
|
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 }) =>
|
|
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,19 +1,19 @@
|
|
|
1
1
|
import { cn as f } from "../../../helpers/cn.js";
|
|
2
|
-
import { resolveSx as
|
|
2
|
+
import { resolveSx as fe } from "../../../helpers/sx.js";
|
|
3
3
|
import { ChevronDownIcon as pe } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
4
4
|
import { CloseIcon as me } from "../../icons/close-icon/CloseIcon.js";
|
|
5
|
-
import { ErrorOutlineIcon as
|
|
6
|
-
import { TOP_LAYER_PROPS as ge, TOP_LAYER_RESET_STYLE as
|
|
5
|
+
import { ErrorOutlineIcon as ye } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
|
|
6
|
+
import { TOP_LAYER_PROPS as ge, TOP_LAYER_RESET_STYLE as xe, getOpenModalDialogAncestor as be, useTopLayerRef as he } from "../../../hooks/useTopLayer.hook.js";
|
|
7
7
|
import { outlineClass as we } from "../field-styles.js";
|
|
8
8
|
import { useFormControlContext as Ae } from "../../miscellaneous/FormControlContext.js";
|
|
9
9
|
import { StyledFormHelperText as ve } from "../../miscellaneous/StyledFormHelperText.js";
|
|
10
|
-
import { Children as S, cloneElement as Re, isValidElement as E, useEffect as
|
|
11
|
-
import { jsx as n, jsxs as
|
|
12
|
-
import { FloatingPortal as Fe, autoUpdate as Se, flip as Ee, offset as Ce, shift as Ne, size as _e, useClick as
|
|
13
|
-
var Ge = ({ dataTest:
|
|
14
|
-
const a = Ae(),
|
|
15
|
-
open:
|
|
16
|
-
onOpenChange:
|
|
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 x } 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, y] = 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({
|
|
15
|
+
open: o,
|
|
16
|
+
onOpenChange: y,
|
|
17
17
|
placement: "bottom-start",
|
|
18
18
|
strategy: "fixed",
|
|
19
19
|
whileElementsMounted: Se,
|
|
@@ -25,79 +25,87 @@ var Ge = ({ dataTest: N, value: _, defaultValue: L, onChange: P, error: M, error
|
|
|
25
25
|
t.floating.style.minWidth = `${e.reference.width + 20}px`;
|
|
26
26
|
} })
|
|
27
27
|
]
|
|
28
|
-
}), { getReferenceProps: te, getFloatingProps: re } =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]), oe = K([
|
|
33
|
-
|
|
34
|
-
|
|
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), [
|
|
34
|
+
o,
|
|
35
35
|
v,
|
|
36
36
|
a
|
|
37
|
-
]),
|
|
37
|
+
]), C(() => a?.setFilled(l || !!b || !!h), [
|
|
38
38
|
l,
|
|
39
39
|
b,
|
|
40
40
|
h,
|
|
41
41
|
a
|
|
42
|
-
])
|
|
42
|
+
]), C(() => {
|
|
43
|
+
if (!o) return;
|
|
44
|
+
const e = requestAnimationFrame(() => {
|
|
45
|
+
const t = i.current?.querySelector('[role="option"][aria-selected="true"]');
|
|
46
|
+
t && (t.scrollIntoView({ block: "nearest" }), t.focus());
|
|
47
|
+
});
|
|
48
|
+
return () => cancelAnimationFrame(e);
|
|
49
|
+
}, [o]);
|
|
43
50
|
const le = (e, t) => {
|
|
44
|
-
const g =
|
|
45
|
-
k ||
|
|
51
|
+
const g = d ? Array.isArray(r) && r.includes(e) ? r.filter((F) => F !== e) : [...Array.isArray(r) ? r : [], e] : e;
|
|
52
|
+
k || U(g), P?.({ target: {
|
|
46
53
|
value: g,
|
|
47
|
-
name:
|
|
48
|
-
} }, t),
|
|
54
|
+
name: p
|
|
55
|
+
} }, t), d || (y(!1), requestAnimationFrame(() => u.domReference.current?.focus()));
|
|
49
56
|
}, B = () => {
|
|
50
|
-
const e =
|
|
51
|
-
k ||
|
|
57
|
+
const e = d ? [] : "";
|
|
58
|
+
k || U(e), P?.({ target: {
|
|
52
59
|
value: e,
|
|
53
|
-
name:
|
|
54
|
-
} }, null),
|
|
60
|
+
name: p
|
|
61
|
+
} }, null), y(!1), R(!1);
|
|
55
62
|
}, ae = S.map(w, (e) => {
|
|
56
63
|
if (!E(e)) return e;
|
|
57
64
|
const t = e.props.value;
|
|
58
65
|
return Re(e, {
|
|
59
|
-
selected:
|
|
66
|
+
selected: d ? Array.isArray(r) && r.includes(t) : t === r,
|
|
60
67
|
onClick: () => le(t, e.props.children)
|
|
61
68
|
});
|
|
62
|
-
}), ie = S.toArray(w).find((e) => E(e) && e.props.value === r), ce =
|
|
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) => {
|
|
63
70
|
const t = e.props.children;
|
|
64
71
|
return typeof t == "string" || typeof t == "number" ? String(t) : "";
|
|
65
72
|
}).join(", ") : ie?.props.children, de = (e) => {
|
|
66
|
-
if ((e.key === "Backspace" || e.key === "Delete") && T && l && !
|
|
73
|
+
if ((e.key === "Backspace" || e.key === "Delete") && T && l && !s && !c) {
|
|
67
74
|
e.preventDefault(), B();
|
|
68
75
|
return;
|
|
69
76
|
}
|
|
70
|
-
e.key !== "ArrowDown" && e.key !== "ArrowUp" ||
|
|
71
|
-
|
|
77
|
+
e.key !== "ArrowDown" && e.key !== "ArrowUp" || s || c || (e.preventDefault(), y(!0), requestAnimationFrame(() => {
|
|
78
|
+
if (i.current?.querySelector('[role="option"][aria-selected="true"]')) return;
|
|
79
|
+
const t = i.current?.querySelectorAll('[role="option"]:not([aria-disabled="true"])');
|
|
72
80
|
t?.length && t[e.key === "ArrowUp" ? t.length - 1 : 0]?.focus();
|
|
73
81
|
}));
|
|
74
|
-
},
|
|
75
|
-
const t =
|
|
82
|
+
}, ue = (e) => {
|
|
83
|
+
const t = i.current ? Array.from(i.current.querySelectorAll('[role="option"]:not([aria-disabled="true"])')) : [];
|
|
76
84
|
if (t.length === 0) return;
|
|
77
85
|
const g = t.findIndex((F) => F === document.activeElement);
|
|
78
86
|
e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), t[(g + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length]?.focus()) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), document.activeElement?.click());
|
|
79
87
|
};
|
|
80
|
-
return /* @__PURE__ */
|
|
88
|
+
return /* @__PURE__ */ x("div", {
|
|
81
89
|
className: f("group relative inline-flex flex-col", Y && "w-full", z),
|
|
82
90
|
style: {
|
|
83
91
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
84
|
-
...
|
|
92
|
+
...fe($),
|
|
85
93
|
...W
|
|
86
94
|
},
|
|
87
95
|
children: [
|
|
88
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ x("button", {
|
|
89
97
|
ref: oe,
|
|
90
98
|
type: "button",
|
|
91
|
-
"data-testid":
|
|
99
|
+
"data-testid": _,
|
|
92
100
|
...te({ onKeyDown: de }),
|
|
93
101
|
role: "combobox",
|
|
94
102
|
"aria-haspopup": "listbox",
|
|
95
|
-
"aria-expanded":
|
|
96
|
-
"aria-controls":
|
|
97
|
-
"aria-labelledby":
|
|
98
|
-
"aria-label":
|
|
99
|
-
"aria-disabled":
|
|
100
|
-
disabled:
|
|
103
|
+
"aria-expanded": o,
|
|
104
|
+
"aria-controls": j,
|
|
105
|
+
"aria-labelledby": m,
|
|
106
|
+
"aria-label": m ? void 0 : p,
|
|
107
|
+
"aria-disabled": s ? !0 : void 0,
|
|
108
|
+
disabled: s,
|
|
101
109
|
onFocus: (e) => {
|
|
102
110
|
R(!0), Q?.(e);
|
|
103
111
|
},
|
|
@@ -105,15 +113,15 @@ var Ge = ({ dataTest: N, value: _, defaultValue: L, onChange: P, error: M, error
|
|
|
105
113
|
R(!1), X?.(e);
|
|
106
114
|
},
|
|
107
115
|
style: { minWidth: l && !A ? 105 : void 0 },
|
|
108
|
-
className: f("relative flex w-full items-center justify-between bg-transparent text-left text-delta-800 outline-none",
|
|
116
|
+
className: f("relative flex w-full items-center justify-between bg-transparent text-left text-delta-800 outline-none", "h-10 rounded-lg border-0 px-3 text-base", A && "min-w-0", s && "cursor-not-allowed text-delta-300", c && "pointer-events-none"),
|
|
109
117
|
children: [
|
|
110
118
|
/* @__PURE__ */ n("span", {
|
|
111
119
|
className: f("min-w-0 flex-1 truncate", !l && "text-delta-500"),
|
|
112
120
|
children: l || h ? ce : b
|
|
113
121
|
}),
|
|
114
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ x("span", {
|
|
115
123
|
className: "flex items-center gap-1",
|
|
116
|
-
children: [T && l && !
|
|
124
|
+
children: [T && l && !s && /* @__PURE__ */ n("span", {
|
|
117
125
|
"aria-hidden": "true",
|
|
118
126
|
"data-testid": "select-clear-button",
|
|
119
127
|
className: "flex items-center justify-center rounded-full p-[2px] hover:bg-gama-100",
|
|
@@ -127,40 +135,41 @@ var Ge = ({ dataTest: N, value: _, defaultValue: L, onChange: P, error: M, error
|
|
|
127
135
|
}), /* @__PURE__ */ n(pe, {
|
|
128
136
|
width: 24,
|
|
129
137
|
height: 24,
|
|
130
|
-
className: f("shrink-0 transition-transform",
|
|
138
|
+
className: f("shrink-0 transition-transform", s ? "text-delta-300" : "text-delta-700", o && "rotate-180")
|
|
131
139
|
})]
|
|
132
140
|
}),
|
|
133
|
-
|
|
134
|
-
focused:
|
|
135
|
-
error:
|
|
136
|
-
disabled:
|
|
137
|
-
readOnly:
|
|
141
|
+
/* @__PURE__ */ n("div", { className: we({
|
|
142
|
+
focused: o || v,
|
|
143
|
+
error: I,
|
|
144
|
+
disabled: s,
|
|
145
|
+
readOnly: c,
|
|
146
|
+
borderless: A
|
|
138
147
|
}) })
|
|
139
148
|
]
|
|
140
149
|
}),
|
|
141
|
-
|
|
150
|
+
o && /* @__PURE__ */ n(Fe, {
|
|
142
151
|
root: ne,
|
|
143
152
|
children: /* @__PURE__ */ n("ul", {
|
|
144
153
|
ref: se,
|
|
145
|
-
id:
|
|
154
|
+
id: j,
|
|
146
155
|
role: "listbox",
|
|
147
|
-
"aria-labelledby":
|
|
148
|
-
"aria-label":
|
|
156
|
+
"aria-labelledby": m,
|
|
157
|
+
"aria-label": m ? void 0 : p,
|
|
149
158
|
...ge,
|
|
150
159
|
style: {
|
|
151
|
-
...
|
|
160
|
+
...xe,
|
|
152
161
|
...ee,
|
|
153
162
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif"
|
|
154
163
|
},
|
|
155
164
|
...re(),
|
|
156
|
-
onKeyDown:
|
|
165
|
+
onKeyDown: ue,
|
|
157
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)]", J?.className),
|
|
158
167
|
children: ae
|
|
159
168
|
})
|
|
160
169
|
}),
|
|
161
|
-
|
|
170
|
+
I && /* @__PURE__ */ x(ve, {
|
|
162
171
|
className: "m-0 flex items-center gap-1 pt-1 text-sm text-error-500",
|
|
163
|
-
children: [/* @__PURE__ */ n(
|
|
172
|
+
children: [/* @__PURE__ */ n(ye, {
|
|
164
173
|
width: 20,
|
|
165
174
|
height: 20
|
|
166
175
|
}), H ?? "Required"]
|
|
@@ -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
|
|
7
|
-
const { options: r = [], onChange: t, value: d, disabled:
|
|
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:
|
|
19
|
-
className:
|
|
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
|
-
|
|
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;
|