asma-ui-core 3.107.0 → 3.107.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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +10 -9
- package/dist/components/inputs/select/StyledSelect.js +35 -35
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +71 -71
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import { DynamicInteractiveChipGroup as ne } from "./DynamicInteractiveChipGroup
|
|
|
11
11
|
import { createElement as F, forwardRef as se, useCallback as h, useState as de } from "react";
|
|
12
12
|
import { Fragment as K, jsx as l, jsxs as T } from "react/jsx-runtime";
|
|
13
13
|
var Ce = se((O, H) => {
|
|
14
|
-
const [_, S] = de(!1), { options: k, dataTest: f, value: g, readOnly: u, multiple: o, required: R, onChange: x, size:
|
|
14
|
+
const [_, S] = de(!1), { options: k, dataTest: f, value: g, readOnly: u, multiple: o, required: R, onChange: x, size: W, rowSize: y = "compact", title: v, noOptionsText: G, placeholder: J, disabled: I, helperText: M, disableHelperText: N, error: A, valueKey: P = "value", labelKey: Q = "label", renderLabel: s, getOptionTooltip: V, startAdornment: U, autocompleteProps: i, loading: m, maxTags: X, onFocus: Y, onBlur: Z } = O, d = (e) => typeof e == "object" ? e?.[Q]?.toString() ?? "" : e?.toString() ?? "", b = h((e) => typeof e == "object" ? e?.[P] : e, [P]), $ = h((e, t) => b(e) === b(t), [b]), w = (e) => {
|
|
15
15
|
const t = b(e);
|
|
16
16
|
return t == null ? "" : typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? String(t) : e == null ? "" : d(e);
|
|
17
17
|
}, B = h((e) => {
|
|
@@ -20,13 +20,13 @@ var Ce = se((O, H) => {
|
|
|
20
20
|
S(!1), i?.onClose?.(e, t);
|
|
21
21
|
}, [i]);
|
|
22
22
|
if (o && u) return /* @__PURE__ */ l(ne, { ...O });
|
|
23
|
-
const C =
|
|
23
|
+
const C = v ? `${f}-title` : void 0;
|
|
24
24
|
return /* @__PURE__ */ T("div", {
|
|
25
25
|
className: "flex w-full flex-col gap-y-1",
|
|
26
|
-
children: [
|
|
26
|
+
children: [v && /* @__PURE__ */ l("span", {
|
|
27
27
|
id: C,
|
|
28
28
|
className: "text-base font-semibold text-delta-800",
|
|
29
|
-
children:
|
|
29
|
+
children: v
|
|
30
30
|
}), /* @__PURE__ */ l(ie, {
|
|
31
31
|
open: _,
|
|
32
32
|
onOpen: B,
|
|
@@ -34,12 +34,12 @@ var Ce = se((O, H) => {
|
|
|
34
34
|
disableCloseOnSelect: o,
|
|
35
35
|
dataTest: f,
|
|
36
36
|
disabled: !!I || !!m,
|
|
37
|
-
noOptionsText:
|
|
37
|
+
noOptionsText: G,
|
|
38
38
|
loading: m,
|
|
39
39
|
readOnly: u,
|
|
40
40
|
value: g,
|
|
41
|
-
size:
|
|
42
|
-
rowSize:
|
|
41
|
+
size: W,
|
|
42
|
+
rowSize: y,
|
|
43
43
|
disableClearable: R,
|
|
44
44
|
options: k,
|
|
45
45
|
fullWidth: !0,
|
|
@@ -99,7 +99,7 @@ var Ce = se((O, H) => {
|
|
|
99
99
|
"aria-selected": L,
|
|
100
100
|
key: e.id,
|
|
101
101
|
onClick: r ? void 0 : e.onClick,
|
|
102
|
-
className: q("relative flex cursor-pointer items-center gap-x-1 bg-white px-2 text-base aria-selected:bg-gama-50 hover:bg-delta-50",
|
|
102
|
+
className: q("relative box-border flex cursor-pointer items-center gap-x-1 bg-white px-2 py-2 text-base aria-selected:bg-gama-50 hover:bg-delta-50", y === "regular" ? "min-h-12" : "min-h-10", r && "cursor-not-allowed bg-delta-50 aria-selected:!bg-delta-50 hover:!bg-delta-50 [&_*]:cursor-not-allowed"),
|
|
103
103
|
"aria-disabled": r,
|
|
104
104
|
"aria-describedby": a
|
|
105
105
|
}, j, e["data-active"] !== void 0 && /* @__PURE__ */ l("span", {
|
|
@@ -114,6 +114,7 @@ var Ce = se((O, H) => {
|
|
|
114
114
|
dataTest: `${w(t)}-checkbox`,
|
|
115
115
|
size: "small",
|
|
116
116
|
decorative: !0,
|
|
117
|
+
hideWrapper: !0,
|
|
117
118
|
className: "min-w-[36px]",
|
|
118
119
|
checked: L
|
|
119
120
|
}), s ? s(t) : /* @__PURE__ */ l("span", {
|
|
@@ -128,7 +129,7 @@ var Ce = se((O, H) => {
|
|
|
128
129
|
role: "option",
|
|
129
130
|
"aria-selected": D,
|
|
130
131
|
key: e.id,
|
|
131
|
-
className: q("relative flex cursor-pointer items-center gap-x-1 px-2 text-base aria-selected:bg-gama-50 hover:bg-delta-50",
|
|
132
|
+
className: q("relative box-border flex cursor-pointer items-center gap-x-1 px-2 py-2 text-base aria-selected:bg-gama-50 hover:bg-delta-50", y === "regular" ? "min-h-12" : "min-h-10", r && "cursor-not-allowed bg-delta-50 aria-selected:!bg-delta-50 hover:!bg-delta-50 [&_*]:cursor-not-allowed"),
|
|
132
133
|
onClick: r ? void 0 : e.onClick,
|
|
133
134
|
"aria-disabled": r,
|
|
134
135
|
"aria-describedby": a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as h } from "../../../helpers/cn.js";
|
|
2
2
|
import { resolveSx as je } from "../../../helpers/sx.js";
|
|
3
3
|
import { TOP_LAYER_PROPS as Ue, TOP_LAYER_RESET_STYLE as Ve, getOpenModalDialogAncestor as re, shouldUsePopoverTopLayer as qe, useTopLayerRef as Ye } from "../../../hooks/useTopLayer.hook.js";
|
|
4
4
|
import { ChevronDownIcon as ze } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
@@ -11,12 +11,12 @@ import { useFormControlContext as Xe } from "../../miscellaneous/FormControlCont
|
|
|
11
11
|
import { Children as se, cloneElement as Ze, isValidElement as f, useEffect as B, useId as et, useRef as tt, useState as x } from "react";
|
|
12
12
|
import { jsx as l, jsxs as L } from "react/jsx-runtime";
|
|
13
13
|
import { FloatingPortal as ot, autoUpdate as rt, flip as st, offset as nt, shift as lt, size as it, useClick as at, useDismiss as ct, useFloating as dt, useInteractions as ut, useMergeRefs as ft, useRole as pt } from "@floating-ui/react";
|
|
14
|
-
var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, errorText: ie, helperText: j, reserveHelperText: ae, expandHelperText: ce = !0, allowClear: U, disabled: de, readOnly: c, name: w, placeholder: S, displayEmpty: C, multiple: d, renderValue: V, fullWidth: ue, className: fe, style: pe, sx: me, variant:
|
|
15
|
-
const u = Xe(), A = `${T}-listbox`, R =
|
|
16
|
-
K(e), e ||
|
|
17
|
-
}, { refs: { domReference: De, reference: J, setFloating: Se, setReference: Ce }, floatingStyles: Fe, context:
|
|
14
|
+
var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, errorText: ie, helperText: j, reserveHelperText: ae, expandHelperText: ce = !0, allowClear: U, disabled: de, readOnly: c, name: w, placeholder: S, displayEmpty: C, multiple: d, renderValue: V, fullWidth: ue, className: fe, style: pe, sx: me, variant: ge, children: q, MenuProps: be, onFocus: ye, onBlur: he, labelId: v }) => {
|
|
15
|
+
const u = Xe(), A = `${T}-listbox`, R = ge === "standard", p = le ?? u?.error ?? !1, n = de ?? u?.disabled ?? !1, Y = p ? ie ?? j : j, { show: F, role: xe } = Je("StyledSelect", p, Y, ae, c), z = et(), { fieldRef: we, rowRef: ve, rowStyle: Ae } = Ge(ce && F), [r, K] = x(!1), [k, I] = x(!1), [m, g] = x(null), [Re, W] = x(ne), O = M !== void 0, o = O ? M : Re, i = Array.isArray(o) ? o.length > 0 : o !== void 0 && o !== "" && o !== null, b = se.toArray(q), G = (e) => d ? Array.isArray(o) && o.includes(e) : e === o, s = b.flatMap((e, t) => f(e) && !e.props.disabled ? [t] : []), _ = b.findIndex((e) => f(e) && G(e.props.value)), ke = (e = 1) => s.includes(_) ? _ : s[e === 1 ? 0 : s.length - 1] ?? null, D = m === null ? void 0 : `${A}-option-${m}`, E = tt(null), y = (e) => {
|
|
16
|
+
K(e), e || g(null);
|
|
17
|
+
}, { refs: { domReference: De, reference: J, setFloating: Se, setReference: Ce }, floatingStyles: Fe, context: P } = dt({
|
|
18
18
|
open: r,
|
|
19
|
-
onOpenChange:
|
|
19
|
+
onOpenChange: y,
|
|
20
20
|
placement: "bottom-start",
|
|
21
21
|
strategy: "fixed",
|
|
22
22
|
whileElementsMounted: rt,
|
|
@@ -29,10 +29,10 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
29
29
|
} })
|
|
30
30
|
]
|
|
31
31
|
}), { getReferenceProps: Ie, getFloatingProps: Oe } = ut([
|
|
32
|
-
at(
|
|
33
|
-
ct(
|
|
34
|
-
pt(
|
|
35
|
-
]), [Q, X] = x(),
|
|
32
|
+
at(P, { enabled: !n && !c }),
|
|
33
|
+
ct(P),
|
|
34
|
+
pt(P, { role: "listbox" })
|
|
35
|
+
]), [Q, X] = x(), N = qe(Q), _e = ft([Ye(Se, N), E]);
|
|
36
36
|
B(() => u?.setFocused(r || k), [
|
|
37
37
|
r,
|
|
38
38
|
k,
|
|
@@ -45,8 +45,8 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
45
45
|
]), B(() => {
|
|
46
46
|
if (!r) return;
|
|
47
47
|
const e = requestAnimationFrame(() => {
|
|
48
|
-
const t = D ? document.getElementById(D) :
|
|
49
|
-
t &&
|
|
48
|
+
const t = D ? document.getElementById(D) : E.current?.querySelector('[role="option"][aria-selected="true"]');
|
|
49
|
+
t && E.current?.contains(t) && t.scrollIntoView({ block: "nearest" });
|
|
50
50
|
});
|
|
51
51
|
return () => cancelAnimationFrame(e);
|
|
52
52
|
}, [D, r]);
|
|
@@ -55,14 +55,14 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
55
55
|
O || W(oe), $?.({ target: {
|
|
56
56
|
value: oe,
|
|
57
57
|
name: w
|
|
58
|
-
} }, t), a && (
|
|
58
|
+
} }, t), a && (y(!1), requestAnimationFrame(() => De.current?.focus()));
|
|
59
59
|
}, ee = () => {
|
|
60
60
|
const e = d ? [] : "";
|
|
61
61
|
O || W(e), $?.({ target: {
|
|
62
62
|
value: e,
|
|
63
63
|
name: w
|
|
64
|
-
} }, null),
|
|
65
|
-
},
|
|
64
|
+
} }, null), y(!1), I(!1);
|
|
65
|
+
}, Ee = se.map(q, (e, t) => {
|
|
66
66
|
if (!f(e)) return e;
|
|
67
67
|
const a = e.props.value;
|
|
68
68
|
return Ze(e, {
|
|
@@ -70,22 +70,22 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
70
70
|
active: t === m,
|
|
71
71
|
selected: G(a),
|
|
72
72
|
onClick: () => {
|
|
73
|
-
|
|
73
|
+
g(null), Z(a, e.props.children);
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
-
}),
|
|
76
|
+
}), Pe = b.find((e) => f(e) && e.props.value === o), Ne = V ? V(o) : d && Array.isArray(o) ? b.filter((e) => f(e) && o.includes(e.props.value)).map((e) => {
|
|
77
77
|
const t = e.props.children;
|
|
78
78
|
return typeof t == "string" || typeof t == "number" ? String(t) : "";
|
|
79
|
-
}).join(", ") :
|
|
80
|
-
s.length !== 0 &&
|
|
81
|
-
const a = s.indexOf(t ??
|
|
79
|
+
}).join(", ") : Pe?.props.children, He = (e) => {
|
|
80
|
+
s.length !== 0 && g((t) => {
|
|
81
|
+
const a = s.indexOf(t ?? _ ?? -1);
|
|
82
82
|
return a === -1 ? s[e === 1 ? 0 : s.length - 1] ?? null : s[Math.min(Math.max(a + e, 0), s.length - 1)] ?? null;
|
|
83
83
|
});
|
|
84
84
|
}, te = (e) => {
|
|
85
|
-
const t = m === null ? void 0 :
|
|
85
|
+
const t = m === null ? void 0 : b[m];
|
|
86
86
|
!f(t) || t.props.disabled || Z(t.props.value, t.props.children, e);
|
|
87
87
|
}, Be = (e = 1) => {
|
|
88
|
-
X(re(J.current)),
|
|
88
|
+
X(re(J.current)), g(ke(e)), K(!0);
|
|
89
89
|
}, Le = (e) => {
|
|
90
90
|
if ((e.key === "Backspace" || e.key === "Delete") && U && i && !n && !c) {
|
|
91
91
|
e.preventDefault(), ee();
|
|
@@ -96,12 +96,12 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
96
96
|
e.preventDefault(), Be(e.key === "ArrowDown" ? 1 : -1);
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
r && (e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), He(e.key === "ArrowDown" ? 1 : -1)) : e.key === "Home" || e.key === "End" ? (e.preventDefault(),
|
|
99
|
+
r && (e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), He(e.key === "ArrowDown" ? 1 : -1)) : e.key === "Home" || e.key === "End" ? (e.preventDefault(), g(s[e.key === "Home" ? 0 : s.length - 1] ?? null)) : e.key === " " ? (e.preventDefault(), te(!1)) : e.key === "Enter" ? (e.preventDefault(), te(!0)) : e.key === "Escape" ? (e.preventDefault(), y(!1)) : e.key === "Tab" && y(!1));
|
|
100
100
|
}
|
|
101
101
|
}, H = R && (r || k), Te = n ? "text-delta-300" : H ? "text-gama-500" : "text-delta-800", Me = n ? "text-delta-300" : "text-delta-700";
|
|
102
102
|
return /* @__PURE__ */ L("div", {
|
|
103
103
|
ref: we,
|
|
104
|
-
className:
|
|
104
|
+
className: h("group relative inline-flex flex-col", ue && "w-full", fe),
|
|
105
105
|
style: {
|
|
106
106
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
107
107
|
...je(me),
|
|
@@ -128,17 +128,17 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
128
128
|
"aria-disabled": n ? !0 : void 0,
|
|
129
129
|
disabled: n,
|
|
130
130
|
onFocus: (e) => {
|
|
131
|
-
I(!0),
|
|
131
|
+
I(!0), ye?.(e);
|
|
132
132
|
},
|
|
133
133
|
onBlur: (e) => {
|
|
134
|
-
I(!1),
|
|
134
|
+
I(!1), he?.(e);
|
|
135
135
|
},
|
|
136
136
|
style: { minWidth: i && !R ? 105 : void 0 },
|
|
137
|
-
className:
|
|
137
|
+
className: h("relative flex w-full items-center justify-between text-left outline-none", "h-10 rounded-lg border-0 px-3 text-base transition-colors", "asma-touch-ready", H ? "bg-gama-50" : "bg-transparent", Te, R && "min-w-0", n && "cursor-not-allowed", c && "pointer-events-none"),
|
|
138
138
|
children: [
|
|
139
139
|
/* @__PURE__ */ l("span", {
|
|
140
|
-
className:
|
|
141
|
-
children: i || C ?
|
|
140
|
+
className: h("min-w-0 flex-1 truncate", !i && "text-delta-500"),
|
|
141
|
+
children: i || C ? Ne : S
|
|
142
142
|
}),
|
|
143
143
|
/* @__PURE__ */ L("span", {
|
|
144
144
|
className: "flex items-center gap-1",
|
|
@@ -156,7 +156,7 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
156
156
|
}), /* @__PURE__ */ l(ze, {
|
|
157
157
|
width: 24,
|
|
158
158
|
height: 24,
|
|
159
|
-
className:
|
|
159
|
+
className: h("shrink-0 transition-transform", H ? "text-gama-500" : Me, r && "flip-180")
|
|
160
160
|
})]
|
|
161
161
|
}),
|
|
162
162
|
/* @__PURE__ */ l("div", { className: Qe({
|
|
@@ -171,21 +171,21 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
171
171
|
r && /* @__PURE__ */ l(ot, {
|
|
172
172
|
root: Q,
|
|
173
173
|
children: /* @__PURE__ */ l("ul", {
|
|
174
|
-
ref:
|
|
174
|
+
ref: _e,
|
|
175
175
|
...Oe(),
|
|
176
176
|
id: A,
|
|
177
177
|
role: "listbox",
|
|
178
178
|
"aria-multiselectable": d ? !0 : void 0,
|
|
179
179
|
"aria-labelledby": v,
|
|
180
180
|
"aria-label": v ? void 0 : w,
|
|
181
|
-
...
|
|
181
|
+
...N ? Ue : {},
|
|
182
182
|
style: {
|
|
183
|
-
...
|
|
183
|
+
...N ? Ve : {},
|
|
184
184
|
...Fe,
|
|
185
185
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif"
|
|
186
186
|
},
|
|
187
|
-
className:
|
|
188
|
-
children:
|
|
187
|
+
className: h("z-[1300] m-0 max-h-72 list-none overflow-auto rounded border border-solid border-delta-300 bg-white px-0 py-2 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", "[&>li:not(:last-child)]:shadow-[inset_0_-1px_0_var(--colors-delta-200)]", be?.className),
|
|
188
|
+
children: Ee
|
|
189
189
|
})
|
|
190
190
|
}),
|
|
191
191
|
F && /* @__PURE__ */ l(We, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as E } from "../../../helpers/cn.js";
|
|
2
2
|
import { TOP_LAYER_PROPS as nt, TOP_LAYER_RESET_STYLE as at, getOpenModalDialogAncestor as it, shouldUsePopoverTopLayer as ct, useTopLayerRef as dt } from "../../../hooks/useTopLayer.hook.js";
|
|
3
3
|
import { ChevronDownIcon as ut } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
4
4
|
import { CloseIcon as pt } from "../../icons/close-icon/CloseIcon.js";
|
|
@@ -9,26 +9,26 @@ import { StyledCheckbox as de } from "../checkbox/base-ui/StyledCheckbox.js";
|
|
|
9
9
|
import { LoadingIcon as bt } from "../../../table/shared-components/LoadingIcon.js";
|
|
10
10
|
import U from "./StyledSelectAutocomplete.module.js";
|
|
11
11
|
import { useEffect as ue, useMemo as V, useRef as pe, useState as D } from "react";
|
|
12
|
-
import { jsx as
|
|
13
|
-
import { FloatingPortal as gt, autoUpdate as xt, flip as
|
|
12
|
+
import { jsx as o, jsxs as I } from "react/jsx-runtime";
|
|
13
|
+
import { FloatingPortal as gt, autoUpdate as xt, flip as wt, offset as yt, shift as kt, size as vt, useDismiss as Dt, useFloating as It, useInteractions as Nt, useMergeRefs as fe, useRole as At } from "@floating-ui/react";
|
|
14
14
|
var Ct = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), St = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
|
|
15
|
-
function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, getOptionLabel: he, getOptionKey: C, isOptionEqualToValue: B, renderOption: T, renderValue: Y, filterOptions: O, loading: q, loadingText: be = "Loading…", noOptionsText: ge = "No options", disabled: S, readOnly: g, error: xe, helperText:
|
|
16
|
-
const
|
|
15
|
+
function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, getOptionLabel: he, getOptionKey: C, isOptionEqualToValue: B, renderOption: T, renderValue: Y, filterOptions: O, loading: q, loadingText: be = "Loading…", noOptionsText: ge = "No options", disabled: S, readOnly: g, error: xe, helperText: we, size: ye = "small", rowSize: ke = "compact", disableClearable: ve, disableCloseOnSelect: De, popupIcon: Ie, autoHeight: Ne, multiple: Ae, allowSelectAll: M, selectAllLabel: Ce = "Select all", fullWidth: Se, classes: Me, inputValue: R, onInputChange: Re, open: G, onOpen: Pe, onClose: $e, className: _e, wrapperClassName: Le, getOptionDisabled: Ee, slotProps: J }) {
|
|
16
|
+
const s = Ae === !0, c = he ?? Ct, P = (e, t) => B ? B(e, t) : e === t, [Oe, Fe] = D(!1), a = G ?? Oe, d = (e) => {
|
|
17
17
|
e && (g || S) || (G === void 0 && Fe(e), e ? Pe?.() : (x(null), $e?.()));
|
|
18
18
|
}, [je, Q] = D(""), m = R ?? je, $ = (e, t, n) => {
|
|
19
19
|
R === void 0 && Q(t), Re?.(e, t, n);
|
|
20
|
-
}, [
|
|
20
|
+
}, [r, x] = D(null), X = `${l}-listbox`, Z = pe([]), K = pe(null), [ze, He] = D(null), [ee, We] = D(null), i = s ? Array.isArray(N) ? N : [] : [], w = s ? null : N ?? null, te = !s && w !== null ? c(w) : "";
|
|
21
21
|
ue(() => {
|
|
22
|
-
R !== void 0 ||
|
|
22
|
+
R !== void 0 || s || Q(te);
|
|
23
23
|
}, [
|
|
24
24
|
R,
|
|
25
|
-
|
|
25
|
+
s,
|
|
26
26
|
te
|
|
27
27
|
]);
|
|
28
|
-
const F = (e) =>
|
|
28
|
+
const F = (e) => s ? i.some((t) => P(e, t)) : w !== null && P(e, w), _ = (e) => Ee?.(e) ?? St(e), le = V(() => {
|
|
29
29
|
const e = [...b];
|
|
30
30
|
if (O) return O(e, { inputValue: m });
|
|
31
|
-
const t = !
|
|
31
|
+
const t = !s && w !== null ? c(w).toLowerCase() : null;
|
|
32
32
|
if (!m || m.toLowerCase() === t) return e;
|
|
33
33
|
const n = m.toLowerCase();
|
|
34
34
|
return e.filter((p) => c(p).toLowerCase().includes(n));
|
|
@@ -37,61 +37,61 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
|
|
|
37
37
|
m,
|
|
38
38
|
O,
|
|
39
39
|
N
|
|
40
|
-
]), u = V(() => le.slice(0, 100), [le]),
|
|
40
|
+
]), u = V(() => le.slice(0, 100), [le]), se = u.flatMap((e, t) => _(e) ? [] : [t]), j = M && s ? [-1, ...se] : se, re = u.map((e, t) => t), h = M && s ? [-1, ...re] : re, k = u.findIndex(F);
|
|
41
41
|
ue(() => {
|
|
42
42
|
if (!a) return;
|
|
43
|
-
const e =
|
|
43
|
+
const e = r ?? k;
|
|
44
44
|
if (e < 0) return;
|
|
45
45
|
const t = requestAnimationFrame(() => Z.current[e]?.scrollIntoView({ block: "nearest" }));
|
|
46
46
|
return () => cancelAnimationFrame(t);
|
|
47
47
|
}, [
|
|
48
|
-
|
|
48
|
+
r,
|
|
49
49
|
a,
|
|
50
50
|
ee,
|
|
51
51
|
k
|
|
52
52
|
]);
|
|
53
|
-
const { refs:
|
|
53
|
+
const { refs: L, floatingStyles: Ue, context: oe } = It({
|
|
54
54
|
open: a,
|
|
55
55
|
onOpenChange: d,
|
|
56
56
|
placement: "bottom-start",
|
|
57
57
|
strategy: "fixed",
|
|
58
58
|
whileElementsMounted: xt,
|
|
59
59
|
middleware: [
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
yt(0),
|
|
61
|
+
wt({ padding: 8 }),
|
|
62
62
|
kt({ padding: 8 }),
|
|
63
63
|
vt({ apply({ rects: e, availableHeight: t }) {
|
|
64
64
|
He(e.reference.width), We(Ne ? t - 8 : Math.min(t - 8, 320));
|
|
65
65
|
} })
|
|
66
66
|
]
|
|
67
|
-
}), { getReferenceProps: Ve, getFloatingProps: Be, getItemProps: Te } = Nt([Dt(
|
|
67
|
+
}), { getReferenceProps: Ve, getFloatingProps: Be, getItemProps: Te } = Nt([Dt(oe), At(oe, { role: "listbox" })]), Ye = fe([L.setReference]), ne = V(() => a ? it(L.reference.current) : void 0, [a, L]), z = ct(ne), qe = fe([dt(L.setFloating, z)]), Ge = (e) => j.includes(k) ? k : j[e === 1 ? 0 : j.length - 1] ?? null, Je = (e) => {
|
|
68
68
|
h.length !== 0 && x((t) => {
|
|
69
69
|
const n = h.indexOf(t ?? k);
|
|
70
70
|
return n === -1 ? h[e === 1 ? 0 : h.length - 1] ?? null : h[Math.min(Math.max(n + e, 0), h.length - 1)] ?? null;
|
|
71
71
|
});
|
|
72
|
-
}, v = (e, t, n = !
|
|
73
|
-
if (
|
|
74
|
-
const p = i.some((f) => P(t, f)),
|
|
75
|
-
A?.(e,
|
|
72
|
+
}, v = (e, t, n = !s || !De) => {
|
|
73
|
+
if (s) {
|
|
74
|
+
const p = i.some((f) => P(t, f)), y = p ? i.filter((f) => !P(t, f)) : [...i, t];
|
|
75
|
+
A?.(e, y, p ? "removeOption" : "selectOption", { option: t }), $(e, "", "reset"), n && d(!1);
|
|
76
76
|
} else
|
|
77
77
|
A?.(e, t, "selectOption", { option: t }), $(e, c(t), "reset"), n && d(!1);
|
|
78
78
|
}, ae = (e) => {
|
|
79
|
-
A?.(e,
|
|
79
|
+
A?.(e, s ? [] : null, "clear", void 0), $(e, "", "clear");
|
|
80
80
|
}, H = (e) => {
|
|
81
81
|
const t = b.length > 0 && i.length === b.length;
|
|
82
82
|
A?.(e, t ? [] : b, t ? "clear" : "selectOption", void 0);
|
|
83
83
|
}, Qe = (e) => {
|
|
84
84
|
if (e.key === "Backspace" && m === "" && ie) {
|
|
85
85
|
const t = i[i.length - 1];
|
|
86
|
-
|
|
86
|
+
s ? t !== void 0 && v(e, t, !1) : ae(e);
|
|
87
87
|
} else if (e.key === "Enter" && !a)
|
|
88
88
|
e.preventDefault(), d(!0);
|
|
89
|
-
else if (e.key === "Enter" &&
|
|
89
|
+
else if (e.key === "Enter" && r === -1)
|
|
90
90
|
e.preventDefault(), H(e);
|
|
91
|
-
else if (e.key === "Enter" &&
|
|
91
|
+
else if (e.key === "Enter" && r != null && u[r] != null) {
|
|
92
92
|
e.preventDefault();
|
|
93
|
-
const t = u[
|
|
94
|
-
|
|
93
|
+
const t = u[r];
|
|
94
|
+
_(t) || v(e, t, !0);
|
|
95
95
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
96
96
|
if (e.preventDefault(), !a) {
|
|
97
97
|
x(Ge(e.key === "ArrowDown" ? 1 : -1)), d(!0);
|
|
@@ -100,19 +100,19 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
|
|
|
100
100
|
Je(e.key === "ArrowDown" ? 1 : -1);
|
|
101
101
|
} else if (e.key === "Home" || e.key === "End")
|
|
102
102
|
e.preventDefault(), x(h[e.key === "Home" ? 0 : h.length - 1] ?? null);
|
|
103
|
-
else if (e.key === " " &&
|
|
103
|
+
else if (e.key === " " && r === -1)
|
|
104
104
|
e.preventDefault(), H(e);
|
|
105
|
-
else if (e.key === " " &&
|
|
105
|
+
else if (e.key === " " && r != null && u[r] != null) {
|
|
106
106
|
e.preventDefault();
|
|
107
|
-
const t = u[
|
|
108
|
-
|
|
107
|
+
const t = u[r];
|
|
108
|
+
_(t) || v(e, t, !1);
|
|
109
109
|
} else e.key === "Escape" && a ? (e.preventDefault(), e.stopPropagation(), d(!1)) : e.key === "Tab" && d(!1);
|
|
110
|
-
}, ie = !ve && !g && !S && (
|
|
110
|
+
}, ie = !ve && !g && !S && (s ? i.length > 0 : w !== null);
|
|
111
111
|
let ce;
|
|
112
|
-
a &&
|
|
112
|
+
a && r != null && (r === -1 || u[r] !== void 0) && (ce = r === -1 ? `${l}-select-all` : `${l}-option-${r}`);
|
|
113
113
|
const Xe = (e) => {
|
|
114
114
|
e.preventDefault(), !(S || g) && (K.current?.focus(), d(!a));
|
|
115
|
-
}, Ze =
|
|
115
|
+
}, Ze = s ? Y ? Y(i, ({ index: e }) => ({ "data-index": e })) : i.map((e, t) => /* @__PURE__ */ o(ht, {
|
|
116
116
|
dataTest: `selected-chip-${c(e)}`,
|
|
117
117
|
label: c(e),
|
|
118
118
|
readOnly: g,
|
|
@@ -121,12 +121,12 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
|
|
|
121
121
|
}, C ? C(e) : `${c(e)}-${t}`)) : void 0, Ke = /* @__PURE__ */ I("span", {
|
|
122
122
|
className: "flex items-center gap-1",
|
|
123
123
|
children: [
|
|
124
|
-
q && /* @__PURE__ */
|
|
124
|
+
q && /* @__PURE__ */ o(bt, {
|
|
125
125
|
width: 20,
|
|
126
126
|
height: 20,
|
|
127
127
|
className: "animate-spin"
|
|
128
128
|
}),
|
|
129
|
-
ie && /* @__PURE__ */
|
|
129
|
+
ie && /* @__PURE__ */ o("button", {
|
|
130
130
|
type: "button",
|
|
131
131
|
tabIndex: -1,
|
|
132
132
|
"aria-label": "Clear",
|
|
@@ -134,13 +134,13 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
|
|
|
134
134
|
className: "invisible flex min-h-6 min-w-6 cursor-pointer items-center justify-center rounded-full border-0 bg-delta-50 group-focus-within:visible",
|
|
135
135
|
onMouseDown: (e) => e.preventDefault(),
|
|
136
136
|
onClick: ae,
|
|
137
|
-
children: /* @__PURE__ */
|
|
137
|
+
children: /* @__PURE__ */ o(pt, {
|
|
138
138
|
width: 20,
|
|
139
139
|
height: 20,
|
|
140
140
|
className: "text-delta-700"
|
|
141
141
|
})
|
|
142
142
|
}),
|
|
143
|
-
g ? null : /* @__PURE__ */
|
|
143
|
+
g ? null : /* @__PURE__ */ o("button", {
|
|
144
144
|
type: "button",
|
|
145
145
|
tabIndex: -1,
|
|
146
146
|
"aria-label": "Toggle options",
|
|
@@ -149,23 +149,23 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
|
|
|
149
149
|
className: "flex cursor-pointer items-center border-0 bg-transparent",
|
|
150
150
|
onMouseDown: (e) => e.preventDefault(),
|
|
151
151
|
onClick: Xe,
|
|
152
|
-
children: Ie ?? (
|
|
152
|
+
children: Ie ?? (s ? /* @__PURE__ */ o(mt, {
|
|
153
153
|
width: 24,
|
|
154
154
|
height: 24,
|
|
155
155
|
className: "text-delta-700"
|
|
156
|
-
}) : /* @__PURE__ */
|
|
156
|
+
}) : /* @__PURE__ */ o(ut, {
|
|
157
157
|
width: 24,
|
|
158
158
|
height: 24,
|
|
159
|
-
className:
|
|
159
|
+
className: E(U["select-custom-icon"], a && U["select-custom-icon-open"], "text-delta-700")
|
|
160
160
|
}))
|
|
161
161
|
})
|
|
162
162
|
]
|
|
163
163
|
}), et = {
|
|
164
164
|
disabled: S,
|
|
165
|
-
size:
|
|
165
|
+
size: ye,
|
|
166
166
|
fullWidth: !0,
|
|
167
167
|
error: xe,
|
|
168
|
-
helperText:
|
|
168
|
+
helperText: we,
|
|
169
169
|
value: m,
|
|
170
170
|
onChange: (e) => {
|
|
171
171
|
x(null), $(e, e.target.value, "input"), a || d(!0);
|
|
@@ -190,38 +190,38 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
|
|
|
190
190
|
endAdornment: Ke
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
}, tt =
|
|
194
|
-
const { key: p, ...
|
|
193
|
+
}, tt = E("asma-pressable", "relative box-border flex cursor-pointer items-center gap-x-3 px-3 py-2 text-base text-delta-800", ke === "regular" ? "min-h-12" : "min-h-10", "aria-selected:bg-gama-50 hover:bg-delta-50", "aria-disabled:cursor-default aria-disabled:!bg-transparent aria-disabled:text-delta-300"), lt = (e, t, n) => {
|
|
194
|
+
const { key: p, ...y } = e;
|
|
195
195
|
return /* @__PURE__ */ I("li", {
|
|
196
|
-
...
|
|
196
|
+
...y,
|
|
197
197
|
children: [
|
|
198
|
-
e["data-active"] !== void 0 && /* @__PURE__ */
|
|
198
|
+
e["data-active"] !== void 0 && /* @__PURE__ */ o("span", {
|
|
199
199
|
"aria-hidden": "true",
|
|
200
200
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
201
201
|
}),
|
|
202
|
-
|
|
202
|
+
s ? /* @__PURE__ */ o(de, {
|
|
203
203
|
dataTest: `${l}-${c(t)}-checkbox`,
|
|
204
204
|
checked: n.selected,
|
|
205
205
|
size: "medium",
|
|
206
206
|
checkboxClassName: "!h-4 !w-4",
|
|
207
207
|
hideWrapper: !0,
|
|
208
208
|
decorative: !0
|
|
209
|
-
}) : /* @__PURE__ */
|
|
209
|
+
}) : /* @__PURE__ */ o("span", {
|
|
210
210
|
className: "w-5",
|
|
211
|
-
children: n.selected && /* @__PURE__ */
|
|
211
|
+
children: n.selected && /* @__PURE__ */ o(ft, {
|
|
212
212
|
width: 20,
|
|
213
213
|
height: 20,
|
|
214
214
|
className: "text-gama-500"
|
|
215
215
|
})
|
|
216
216
|
}),
|
|
217
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ o("span", {
|
|
218
218
|
className: "line-clamp-2 min-w-0 flex-1 break-words",
|
|
219
219
|
children: c(t)
|
|
220
220
|
})
|
|
221
221
|
]
|
|
222
222
|
}, p);
|
|
223
|
-
},
|
|
224
|
-
const n =
|
|
223
|
+
}, st = (e, t) => {
|
|
224
|
+
const n = _(e), p = {
|
|
225
225
|
...Te({
|
|
226
226
|
onMouseDown: (f) => f.preventDefault(),
|
|
227
227
|
onClick: (f) => {
|
|
@@ -237,18 +237,18 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
|
|
|
237
237
|
id: `${l}-option-${t}`,
|
|
238
238
|
"aria-selected": F(e),
|
|
239
239
|
"aria-disabled": n || void 0,
|
|
240
|
-
"data-active":
|
|
240
|
+
"data-active": r === t ? "" : void 0,
|
|
241
241
|
className: tt
|
|
242
|
-
},
|
|
242
|
+
}, y = {
|
|
243
243
|
selected: F(e),
|
|
244
244
|
index: t,
|
|
245
245
|
inputValue: m
|
|
246
246
|
};
|
|
247
|
-
return T ? T(p, e,
|
|
248
|
-
},
|
|
247
|
+
return T ? T(p, e, y) : lt(p, e, y);
|
|
248
|
+
}, rt = !!(M && s), W = b.length > 0 && i.length === b.length, ot = i.length > 0 && !W;
|
|
249
249
|
return /* @__PURE__ */ I("div", {
|
|
250
|
-
className:
|
|
251
|
-
children: [me(et), a && /* @__PURE__ */
|
|
250
|
+
className: E(U.styledSelectAutocompleteWrapper, !Se && "w-auto", Le, _e),
|
|
251
|
+
children: [me(et), a && /* @__PURE__ */ o(gt, {
|
|
252
252
|
root: ne,
|
|
253
253
|
children: /* @__PURE__ */ I("ul", {
|
|
254
254
|
ref: qe,
|
|
@@ -264,46 +264,46 @@ function Ut({ dataTest: l, options: b, renderInput: me, value: N, onChange: A, g
|
|
|
264
264
|
...Be(),
|
|
265
265
|
id: X,
|
|
266
266
|
role: "listbox",
|
|
267
|
-
"aria-multiselectable":
|
|
268
|
-
className:
|
|
269
|
-
children: [M &&
|
|
267
|
+
"aria-multiselectable": s ? !0 : void 0,
|
|
268
|
+
className: E("z-[1300] m-0 list-none overflow-auto rounded border border-solid border-delta-300 bg-white px-0 py-2 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", rt && "py-0", "[&>li:not(:last-child)]:shadow-[inset_0_-1px_0_var(--colors-delta-200)]", Me?.listbox, J?.popper?.className),
|
|
269
|
+
children: [M && s && /* @__PURE__ */ I("li", {
|
|
270
270
|
id: `${l}-select-all`,
|
|
271
271
|
role: "option",
|
|
272
272
|
"aria-selected": W,
|
|
273
|
-
"data-active":
|
|
273
|
+
"data-active": r === -1 ? "" : void 0,
|
|
274
274
|
tabIndex: -1,
|
|
275
275
|
onMouseDown: (e) => e.preventDefault(),
|
|
276
276
|
onClick: H,
|
|
277
277
|
onMouseMove: () => x(null),
|
|
278
|
-
className: "relative flex h-8 cursor-pointer items-center gap-x-3
|
|
278
|
+
className: "relative box-border flex h-8 cursor-pointer items-center gap-x-3 bg-[var(--colors-gray-10)] px-3 text-xs font-semibold uppercase tracking-[0.2px] text-delta-600 hover:bg-delta-50",
|
|
279
279
|
children: [
|
|
280
|
-
|
|
280
|
+
r === -1 && /* @__PURE__ */ o("span", {
|
|
281
281
|
"aria-hidden": "true",
|
|
282
282
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
283
283
|
}),
|
|
284
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ o(de, {
|
|
285
285
|
dataTest: `${l}-select-all`,
|
|
286
286
|
checked: W,
|
|
287
|
-
indeterminate:
|
|
287
|
+
indeterminate: ot,
|
|
288
288
|
size: "medium",
|
|
289
289
|
checkboxClassName: "!h-4 !w-4",
|
|
290
290
|
hideWrapper: !0,
|
|
291
291
|
decorative: !0
|
|
292
292
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ o("span", {
|
|
294
294
|
className: "flex-1 truncate",
|
|
295
295
|
children: Ce
|
|
296
296
|
})
|
|
297
297
|
]
|
|
298
|
-
}), q ? /* @__PURE__ */
|
|
298
|
+
}), q ? /* @__PURE__ */ o("li", {
|
|
299
299
|
role: "presentation",
|
|
300
300
|
className: "px-3 py-2 text-sm text-delta-600",
|
|
301
301
|
children: be
|
|
302
|
-
}) : u.length === 0 ? /* @__PURE__ */
|
|
302
|
+
}) : u.length === 0 ? /* @__PURE__ */ o("li", {
|
|
303
303
|
role: "presentation",
|
|
304
304
|
className: "px-3 py-2 text-sm text-delta-600",
|
|
305
305
|
children: ge
|
|
306
|
-
}) : u.map(
|
|
306
|
+
}) : u.map(st)]
|
|
307
307
|
})
|
|
308
308
|
})]
|
|
309
309
|
});
|