asma-ui-core 3.95.0 → 3.96.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/dynamic-select/components/DynamicSelectAutocomplete.js +62 -61
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +76 -74
- package/dist/src/components/inputs/dynamic-select/types.d.ts +6 -0
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +8 -1
- package/package.json +1 -1
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { LoadingIcon as
|
|
3
|
-
import { CheckIcon as
|
|
4
|
-
import { PlusIconCircle as
|
|
5
|
-
import { StyledChip as
|
|
6
|
-
import { StyledCheckbox as
|
|
7
|
-
import { StyledTooltip as
|
|
8
|
-
import { StyledInputField as
|
|
9
|
-
import { StyledSelectAutocomplete as
|
|
10
|
-
import { DynamicInteractiveChipGroup as
|
|
11
|
-
import { createElement as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
var
|
|
14
|
-
const [F,
|
|
1
|
+
import { cn as j } from "../../../../helpers/cn.js";
|
|
2
|
+
import { LoadingIcon as Y } from "../../../icons/loading-icon/LoadingIcon.js";
|
|
3
|
+
import { CheckIcon as Z } from "../../../icons/check-icon/CheckIcon.js";
|
|
4
|
+
import { PlusIconCircle as ee } from "../../../icons/plus-icon-circle/PlusIconCircle.js";
|
|
5
|
+
import { StyledChip as D } from "../../../data-display/chip/StyledChip.js";
|
|
6
|
+
import { StyledCheckbox as te } from "../../checkbox/base-ui/StyledCheckbox.js";
|
|
7
|
+
import { StyledTooltip as L } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
8
|
+
import { StyledInputField as le } from "../../input-field/StyledInputField.js";
|
|
9
|
+
import { StyledSelectAutocomplete as ae } from "../../select-autocomplete/StyledSelectAutocomplete.js";
|
|
10
|
+
import { DynamicInteractiveChipGroup as re } from "./DynamicInteractiveChipGroup.js";
|
|
11
|
+
import { createElement as q, forwardRef as oe, useCallback as f, useState as ne } from "react";
|
|
12
|
+
import { Fragment as z, jsx as l, jsxs as T } from "react/jsx-runtime";
|
|
13
|
+
var ve = oe((O, E) => {
|
|
14
|
+
const [F, S] = ne(!1), { options: k, dataTest: h, value: g, readOnly: u, multiple: o, required: K, onChange: x, size: H, rowSize: v = "compact", title: y, noOptionsText: _, placeholder: R, disabled: I, helperText: G, disableHelperText: N, error: A, valueKey: P = "value", labelKey: W = "label", renderLabel: i, getOptionTooltip: V, startAdornment: J, autocompleteProps: n, loading: m, maxTags: M, onFocus: Q, onBlur: U } = O, s = (e) => typeof e == "object" ? e?.[W]?.toString() ?? "" : e?.toString() ?? "", p = f((e) => typeof e == "object" ? e?.[P] : e, [P]), B = f((e, t) => p(e) === p(t), [p]), w = (e) => {
|
|
15
15
|
const t = p(e);
|
|
16
16
|
return t == null ? "" : typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? String(t) : e == null ? "" : s(e);
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
}, [n]),
|
|
20
|
-
|
|
17
|
+
}, $ = f((e) => {
|
|
18
|
+
S(!0), n?.onOpen?.(e);
|
|
19
|
+
}, [n]), X = f((e, t) => {
|
|
20
|
+
S(!1), n?.onClose?.(e, t);
|
|
21
21
|
}, [n]);
|
|
22
|
-
if (o && u) return /* @__PURE__ */ l(
|
|
23
|
-
const
|
|
24
|
-
return /* @__PURE__ */
|
|
22
|
+
if (o && u) return /* @__PURE__ */ l(re, { ...O });
|
|
23
|
+
const C = y ? `${h}-title` : void 0;
|
|
24
|
+
return /* @__PURE__ */ T("div", {
|
|
25
25
|
className: "flex w-full flex-col gap-y-1",
|
|
26
|
-
children: [
|
|
27
|
-
id:
|
|
26
|
+
children: [y && /* @__PURE__ */ l("span", {
|
|
27
|
+
id: C,
|
|
28
28
|
className: "text-base font-semibold text-delta-800",
|
|
29
|
-
children:
|
|
30
|
-
}), /* @__PURE__ */ l(
|
|
29
|
+
children: y
|
|
30
|
+
}), /* @__PURE__ */ l(ae, {
|
|
31
31
|
open: F,
|
|
32
|
-
onOpen:
|
|
33
|
-
onClose:
|
|
32
|
+
onOpen: $,
|
|
33
|
+
onClose: X,
|
|
34
34
|
disableCloseOnSelect: o,
|
|
35
35
|
dataTest: h,
|
|
36
|
-
disabled: !!
|
|
37
|
-
noOptionsText:
|
|
36
|
+
disabled: !!I || !!m,
|
|
37
|
+
noOptionsText: _,
|
|
38
38
|
loading: m,
|
|
39
39
|
readOnly: u,
|
|
40
40
|
value: g,
|
|
41
|
-
size:
|
|
41
|
+
size: H,
|
|
42
|
+
rowSize: v,
|
|
42
43
|
disableClearable: K,
|
|
43
44
|
options: k,
|
|
44
45
|
fullWidth: !0,
|
|
@@ -48,14 +49,14 @@ var xe = re((T, E) => {
|
|
|
48
49
|
x(t);
|
|
49
50
|
},
|
|
50
51
|
filterSelectedOptions: !1,
|
|
51
|
-
isOptionEqualToValue: n?.isOptionEqualToValue ??
|
|
52
|
+
isOptionEqualToValue: n?.isOptionEqualToValue ?? B,
|
|
52
53
|
autoHeight: !0,
|
|
53
54
|
multiple: o,
|
|
54
55
|
renderValue: o ? (e) => {
|
|
55
56
|
if (!Array.isArray(e)) return null;
|
|
56
|
-
const t = e, d =
|
|
57
|
-
return [...a.map((r) => /* @__PURE__ */ l(
|
|
58
|
-
dataTest: `${
|
|
57
|
+
const t = e, d = M ?? k.length, a = t.slice(0, d), c = t.length - d;
|
|
58
|
+
return [...a.map((r) => /* @__PURE__ */ l(D, {
|
|
59
|
+
dataTest: `${w(r)}-chip`,
|
|
59
60
|
readOnly: u,
|
|
60
61
|
variant: "outlined",
|
|
61
62
|
label: i ? i(r) : s(r),
|
|
@@ -63,47 +64,47 @@ var xe = re((T, E) => {
|
|
|
63
64
|
root: "h-fit w-fit min-h-[32px]",
|
|
64
65
|
label: "block whitespace-normal"
|
|
65
66
|
},
|
|
66
|
-
disabled: !!
|
|
67
|
+
disabled: !!I || !!m,
|
|
67
68
|
deleteButtonTabIndex: -1,
|
|
68
69
|
onDelete: () => {
|
|
69
|
-
Array.isArray(g) && x(g.filter((b) => !
|
|
70
|
+
Array.isArray(g) && x(g.filter((b) => !B(b, r)));
|
|
70
71
|
}
|
|
71
|
-
},
|
|
72
|
+
}, w(r))), c > 0 ? /* @__PURE__ */ l(D, {
|
|
72
73
|
dataTest: "remaining-count-tag-chip",
|
|
73
74
|
label: `+${c}`,
|
|
74
75
|
variant: "outlined",
|
|
75
76
|
tabIndex: -1,
|
|
76
|
-
onClick:
|
|
77
|
+
onClick: $
|
|
77
78
|
}, "remaining-count") : null];
|
|
78
79
|
} : void 0,
|
|
79
|
-
popupIcon: m ? /* @__PURE__ */ l(
|
|
80
|
+
popupIcon: m ? /* @__PURE__ */ l(Y, {
|
|
80
81
|
height: 24,
|
|
81
82
|
width: 24
|
|
82
|
-
}) : o ? /* @__PURE__ */ l(
|
|
83
|
+
}) : o ? /* @__PURE__ */ l(ee, {
|
|
83
84
|
height: 24,
|
|
84
85
|
width: 24
|
|
85
86
|
}) : void 0,
|
|
86
87
|
renderOption: (e, t, d) => {
|
|
87
|
-
const a = typeof t == "object" ? !!t?.disabled : !1, c =
|
|
88
|
+
const a = typeof t == "object" ? !!t?.disabled : !1, c = V ? V(t) : null;
|
|
88
89
|
if (o) {
|
|
89
90
|
const b = d.selected;
|
|
90
|
-
return /* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ q("li", {
|
|
91
92
|
...e,
|
|
92
93
|
role: "option",
|
|
93
94
|
"aria-selected": b,
|
|
94
95
|
key: e.id,
|
|
95
96
|
onClick: a ? void 0 : e.onClick,
|
|
96
|
-
className:
|
|
97
|
+
className: j("relative flex cursor-pointer items-center gap-x-1 bg-white px-2 text-base aria-selected:bg-gama-50 hover:bg-delta-50", v === "regular" ? "min-h-12" : "min-h-10", a && "cursor-not-allowed bg-delta-50 aria-selected:!bg-delta-50 hover:!bg-delta-50 [&_*]:cursor-not-allowed"),
|
|
97
98
|
"aria-disabled": a
|
|
98
99
|
}, e["data-active"] !== void 0 && /* @__PURE__ */ l("span", {
|
|
99
100
|
"aria-hidden": "true",
|
|
100
101
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
101
|
-
}), /* @__PURE__ */ l(
|
|
102
|
+
}), /* @__PURE__ */ l(L, {
|
|
102
103
|
arrow: !0,
|
|
103
104
|
title: c,
|
|
104
|
-
children: /* @__PURE__ */
|
|
105
|
+
children: /* @__PURE__ */ T(z, { children: [/* @__PURE__ */ l(te, {
|
|
105
106
|
disabled: a,
|
|
106
|
-
dataTest: `${
|
|
107
|
+
dataTest: `${w(t)}-checkbox`,
|
|
107
108
|
size: "small",
|
|
108
109
|
decorative: !0,
|
|
109
110
|
className: "min-w-[36px]",
|
|
@@ -115,23 +116,23 @@ var xe = re((T, E) => {
|
|
|
115
116
|
}));
|
|
116
117
|
}
|
|
117
118
|
const r = d.selected;
|
|
118
|
-
return /* @__PURE__ */
|
|
119
|
+
return /* @__PURE__ */ q("li", {
|
|
119
120
|
...e,
|
|
120
121
|
role: "option",
|
|
121
122
|
"aria-selected": r,
|
|
122
123
|
key: e.id,
|
|
123
|
-
className:
|
|
124
|
+
className: j("relative flex cursor-pointer items-center gap-x-1 px-2 text-base aria-selected:bg-gama-50 hover:bg-delta-50", v === "regular" ? "min-h-12" : "min-h-10", a && "cursor-not-allowed bg-delta-50 aria-selected:!bg-delta-50 hover:!bg-delta-50 [&_*]:cursor-not-allowed"),
|
|
124
125
|
onClick: a ? void 0 : e.onClick,
|
|
125
126
|
"aria-disabled": a
|
|
126
127
|
}, e["data-active"] !== void 0 && /* @__PURE__ */ l("span", {
|
|
127
128
|
"aria-hidden": "true",
|
|
128
129
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
129
|
-
}), /* @__PURE__ */ l(
|
|
130
|
+
}), /* @__PURE__ */ l(L, {
|
|
130
131
|
arrow: !0,
|
|
131
132
|
title: c,
|
|
132
|
-
children: /* @__PURE__ */
|
|
133
|
+
children: /* @__PURE__ */ T(z, { children: [/* @__PURE__ */ l("span", {
|
|
133
134
|
className: "w-5 min-w-5",
|
|
134
|
-
children: r && /* @__PURE__ */ l(
|
|
135
|
+
children: r && /* @__PURE__ */ l(Z, {
|
|
135
136
|
className: "size-5 min-h-5 min-w-5 text-gama-500",
|
|
136
137
|
height: 20,
|
|
137
138
|
width: 20
|
|
@@ -142,30 +143,30 @@ var xe = re((T, E) => {
|
|
|
142
143
|
})] })
|
|
143
144
|
}));
|
|
144
145
|
},
|
|
145
|
-
renderInput: (e) => /* @__PURE__ */ l(
|
|
146
|
+
renderInput: (e) => /* @__PURE__ */ l(le, {
|
|
146
147
|
dataTest: `${h}-input-field`,
|
|
147
148
|
...e,
|
|
148
149
|
inputRef: E,
|
|
149
|
-
error:
|
|
150
|
-
helperText:
|
|
151
|
-
reserveHelperText:
|
|
150
|
+
error: A,
|
|
151
|
+
helperText: N ? void 0 : G,
|
|
152
|
+
reserveHelperText: N ? !1 : A !== void 0,
|
|
152
153
|
variant: "outlined",
|
|
153
154
|
label: "",
|
|
154
|
-
placeholder:
|
|
155
|
+
placeholder: R,
|
|
155
156
|
readOnly: u,
|
|
156
|
-
onFocus:
|
|
157
|
-
onBlur:
|
|
157
|
+
onFocus: Q,
|
|
158
|
+
onBlur: U,
|
|
158
159
|
onKeyDown: e.onKeyDown,
|
|
159
160
|
autoComplete: "off",
|
|
160
161
|
slotProps: {
|
|
161
162
|
...e.slotProps,
|
|
162
163
|
input: {
|
|
163
164
|
...e.slotProps?.input ?? {},
|
|
164
|
-
startAdornment:
|
|
165
|
+
startAdornment: J ?? e.slotProps?.input?.startAdornment
|
|
165
166
|
},
|
|
166
167
|
htmlInput: {
|
|
167
168
|
...e.slotProps?.htmlInput ?? {},
|
|
168
|
-
...
|
|
169
|
+
...C ? { "aria-labelledby": C } : {}
|
|
169
170
|
}
|
|
170
171
|
}
|
|
171
172
|
}),
|
|
@@ -174,5 +175,5 @@ var xe = re((T, E) => {
|
|
|
174
175
|
});
|
|
175
176
|
});
|
|
176
177
|
export {
|
|
177
|
-
|
|
178
|
+
ve as DynamicSelectAutocomplete
|
|
178
179
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { cn as E } from "../../../helpers/cn.js";
|
|
2
|
-
import { ChevronDownIcon as
|
|
3
|
-
import { CloseIcon as
|
|
4
|
-
import { CheckIcon as
|
|
5
|
-
import { PlusIconCircle as
|
|
6
|
-
import { StyledChip as
|
|
2
|
+
import { ChevronDownIcon as ot } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
3
|
+
import { CloseIcon as st } from "../../icons/close-icon/CloseIcon.js";
|
|
4
|
+
import { CheckIcon as nt } from "../../icons/check-icon/CheckIcon.js";
|
|
5
|
+
import { PlusIconCircle as at } from "../../icons/plus-icon-circle/PlusIconCircle.js";
|
|
6
|
+
import { StyledChip as it } from "../../data-display/chip/StyledChip.js";
|
|
7
7
|
import { StyledCheckbox as ie } from "../checkbox/base-ui/StyledCheckbox.js";
|
|
8
|
-
import { TOP_LAYER_PROPS as
|
|
9
|
-
import { LoadingIcon as
|
|
8
|
+
import { TOP_LAYER_PROPS as ct, TOP_LAYER_RESET_STYLE as dt, getOpenModalDialogAncestor as ut, shouldUsePopoverTopLayer as pt, useTopLayerRef as ft } from "../../../hooks/useTopLayer.hook.js";
|
|
9
|
+
import { LoadingIcon as mt } from "../../../table/shared-components/LoadingIcon.js";
|
|
10
10
|
import W from "./StyledSelectAutocomplete.module.js";
|
|
11
11
|
import { useEffect as ce, useMemo as U, useRef as de, useState as D } from "react";
|
|
12
12
|
import { jsx as s, jsxs as I } from "react/jsx-runtime";
|
|
13
|
-
import { FloatingPortal as
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
const r =
|
|
17
|
-
e && (g ||
|
|
18
|
-
}, [
|
|
13
|
+
import { FloatingPortal as ht, autoUpdate as bt, flip as gt, offset as xt, shift as wt, size as yt, useDismiss as kt, useFloating as vt, useInteractions as Dt, useMergeRefs as ue, useRole as It } from "@floating-ui/react";
|
|
14
|
+
var Nt = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), At = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
|
|
15
|
+
function Ht({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, getOptionLabel: fe, getOptionKey: C, isOptionEqualToValue: V, renderOption: B, renderValue: T, filterOptions: _, loading: Y, loadingText: me = "Loading…", noOptionsText: he = "No options", disabled: S, readOnly: g, error: be, helperText: ge, size: xe = "small", rowSize: we = "compact", disableClearable: ye, disableCloseOnSelect: ke, popupIcon: ve, autoHeight: De, multiple: Ie, allowSelectAll: F, selectAllLabel: Ne = "Select all", fullWidth: Ae, classes: Ce, inputValue: M, onInputChange: Se, open: q, onOpen: Me, onClose: Re, className: Pe, wrapperClassName: $e, getOptionDisabled: Le, slotProps: G }) {
|
|
16
|
+
const r = Ie === !0, d = fe ?? Nt, R = (e, t) => V ? V(e, t) : e === t, [Ee, _e] = D(!1), a = q ?? Ee, u = (e) => {
|
|
17
|
+
e && (g || S) || (q === void 0 && _e(e), e ? Me?.() : (x(null), Re?.()));
|
|
18
|
+
}, [Fe, J] = D(""), h = M ?? Fe, P = (e, t, n) => {
|
|
19
19
|
M === void 0 && J(t), Se?.(e, t, n);
|
|
20
|
-
}, [o, x] = D(null), Q = `${l}-listbox`, X = de([]), Z = de(null), [
|
|
20
|
+
}, [o, x] = D(null), Q = `${l}-listbox`, X = de([]), Z = de(null), [Oe, je] = D(null), [K, ze] = D(null), i = r ? Array.isArray(N) ? N : [] : [], w = r ? null : N ?? null, ee = !r && w !== null ? d(w) : "";
|
|
21
21
|
ce(() => {
|
|
22
22
|
M !== void 0 || r || J(ee);
|
|
23
23
|
}, [
|
|
@@ -25,10 +25,10 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
25
25
|
r,
|
|
26
26
|
ee
|
|
27
27
|
]);
|
|
28
|
-
const O = (e) => r ? i.some((t) => R(e, t)) :
|
|
28
|
+
const O = (e) => r ? i.some((t) => R(e, t)) : w !== null && R(e, w), $ = (e) => Le?.(e) ?? At(e), te = U(() => {
|
|
29
29
|
const e = [...b];
|
|
30
30
|
if (_) return _(e, { inputValue: h });
|
|
31
|
-
const t = !r &&
|
|
31
|
+
const t = !r && w !== null ? d(w).toLowerCase() : null;
|
|
32
32
|
if (!h || h.toLowerCase() === t) return e;
|
|
33
33
|
const n = h.toLowerCase();
|
|
34
34
|
return e.filter((f) => d(f).toLowerCase().includes(n));
|
|
@@ -36,7 +36,7 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
36
36
|
b,
|
|
37
37
|
h,
|
|
38
38
|
_,
|
|
39
|
-
|
|
39
|
+
N
|
|
40
40
|
]), p = U(() => te.slice(0, 100), [te]), le = p.flatMap((e, t) => $(e) ? [] : [t]), c = F && r ? [-1, ...le] : le, k = p.findIndex(O);
|
|
41
41
|
ce(() => {
|
|
42
42
|
if (!a) return;
|
|
@@ -50,37 +50,37 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
50
50
|
K,
|
|
51
51
|
k
|
|
52
52
|
]);
|
|
53
|
-
const { refs: L, floatingStyles:
|
|
53
|
+
const { refs: L, floatingStyles: He, context: re } = vt({
|
|
54
54
|
open: a,
|
|
55
55
|
onOpenChange: u,
|
|
56
56
|
placement: "bottom-start",
|
|
57
57
|
strategy: "fixed",
|
|
58
|
-
whileElementsMounted:
|
|
58
|
+
whileElementsMounted: bt,
|
|
59
59
|
middleware: [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
xt(0),
|
|
61
|
+
gt({ padding: 8 }),
|
|
62
|
+
wt({ padding: 8 }),
|
|
63
63
|
yt({ apply({ rects: e, availableHeight: t }) {
|
|
64
|
-
|
|
64
|
+
je(e.reference.width), ze(De ? t - 8 : Math.min(t - 8, 320));
|
|
65
65
|
} })
|
|
66
66
|
]
|
|
67
|
-
}), { getReferenceProps:
|
|
67
|
+
}), { getReferenceProps: We, getFloatingProps: Ue, getItemProps: Ve } = Dt([kt(re), It(re, { role: "listbox" })]), Be = ue([L.setReference]), oe = U(() => a ? ut(L.reference.current) : void 0, [a, L]), j = pt(oe), Te = ue([ft(L.setFloating, j)]), Ye = (e) => c.includes(k) ? k : c[e === 1 ? 0 : c.length - 1] ?? null, qe = (e) => {
|
|
68
68
|
c.length !== 0 && x((t) => {
|
|
69
69
|
const n = c.indexOf(t ?? k);
|
|
70
70
|
return n === -1 ? c[e === 1 ? 0 : c.length - 1] ?? null : c[Math.min(Math.max(n + e, 0), c.length - 1)] ?? null;
|
|
71
71
|
});
|
|
72
|
-
}, v = (e, t, n = !r || !
|
|
72
|
+
}, v = (e, t, n = !r || !ke) => {
|
|
73
73
|
if (r) {
|
|
74
|
-
const f = i.some((m) => R(t, m)),
|
|
75
|
-
|
|
74
|
+
const f = i.some((m) => R(t, m)), y = f ? i.filter((m) => !R(t, m)) : [...i, t];
|
|
75
|
+
A?.(e, y, f ? "removeOption" : "selectOption", { option: t }), P(e, "", "reset"), n && u(!1);
|
|
76
76
|
} else
|
|
77
|
-
|
|
77
|
+
A?.(e, t, "selectOption", { option: t }), P(e, d(t), "reset"), n && u(!1);
|
|
78
78
|
}, se = (e) => {
|
|
79
|
-
|
|
79
|
+
A?.(e, r ? [] : null, "clear", void 0), P(e, "", "clear");
|
|
80
80
|
}, z = (e) => {
|
|
81
81
|
const t = b.length > 0 && i.length === b.length;
|
|
82
|
-
|
|
83
|
-
},
|
|
82
|
+
A?.(e, t ? [] : b, t ? "clear" : "selectOption", void 0);
|
|
83
|
+
}, Ge = (e) => {
|
|
84
84
|
if (e.key === "Backspace" && h === "" && ne) {
|
|
85
85
|
const t = i[i.length - 1];
|
|
86
86
|
r ? t !== void 0 && v(e, t, !1) : se(e);
|
|
@@ -94,10 +94,10 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
94
94
|
$(t) || v(e, t, !0);
|
|
95
95
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
96
96
|
if (e.preventDefault(), !a) {
|
|
97
|
-
x(
|
|
97
|
+
x(Ye(e.key === "ArrowDown" ? 1 : -1)), u(!0);
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
qe(e.key === "ArrowDown" ? 1 : -1);
|
|
101
101
|
} else if (e.key === "Home" || e.key === "End")
|
|
102
102
|
e.preventDefault(), x(c[e.key === "Home" ? 0 : c.length - 1] ?? null);
|
|
103
103
|
else if (e.key === " " && o === -1)
|
|
@@ -107,21 +107,21 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
107
107
|
const t = p[o];
|
|
108
108
|
$(t) || v(e, t, !1);
|
|
109
109
|
} else e.key === "Escape" && a ? (e.preventDefault(), e.stopPropagation(), u(!1)) : e.key === "Tab" && u(!1);
|
|
110
|
-
}, ne = !ye && !g && !
|
|
110
|
+
}, ne = !ye && !g && !S && (r ? i.length > 0 : w !== null);
|
|
111
111
|
let ae;
|
|
112
112
|
a && o != null && (o === -1 || p[o] !== void 0) && (ae = o === -1 ? `${l}-select-all` : `${l}-option-${o}`);
|
|
113
|
-
const
|
|
114
|
-
e.preventDefault(), !(
|
|
115
|
-
},
|
|
113
|
+
const Je = (e) => {
|
|
114
|
+
e.preventDefault(), !(S || g) && (Z.current?.focus(), u(!a));
|
|
115
|
+
}, Qe = r ? T ? T(i, ({ index: e }) => ({ "data-index": e })) : i.map((e, t) => /* @__PURE__ */ s(it, {
|
|
116
116
|
dataTest: `selected-chip-${d(e)}`,
|
|
117
117
|
label: d(e),
|
|
118
118
|
readOnly: g,
|
|
119
119
|
deleteButtonTabIndex: -1,
|
|
120
120
|
onDelete: g ? void 0 : (n) => v(n, e)
|
|
121
|
-
},
|
|
121
|
+
}, C ? C(e) : `${d(e)}-${t}`)) : void 0, Xe = /* @__PURE__ */ I("span", {
|
|
122
122
|
className: "flex items-center gap-1",
|
|
123
123
|
children: [
|
|
124
|
-
Y && /* @__PURE__ */ s(
|
|
124
|
+
Y && /* @__PURE__ */ s(mt, {
|
|
125
125
|
width: 20,
|
|
126
126
|
height: 20,
|
|
127
127
|
className: "animate-spin"
|
|
@@ -134,7 +134,7 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, 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: se,
|
|
137
|
-
children: /* @__PURE__ */ s(
|
|
137
|
+
children: /* @__PURE__ */ s(st, {
|
|
138
138
|
width: 20,
|
|
139
139
|
height: 20,
|
|
140
140
|
className: "text-delta-700"
|
|
@@ -148,20 +148,20 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
148
148
|
"data-testid": `${l}-popup-indicator`,
|
|
149
149
|
className: "flex cursor-pointer items-center border-0 bg-transparent",
|
|
150
150
|
onMouseDown: (e) => e.preventDefault(),
|
|
151
|
-
onClick:
|
|
152
|
-
children:
|
|
151
|
+
onClick: Je,
|
|
152
|
+
children: ve ?? (r ? /* @__PURE__ */ s(at, {
|
|
153
153
|
width: 24,
|
|
154
154
|
height: 24,
|
|
155
155
|
className: "text-delta-700"
|
|
156
|
-
}) : /* @__PURE__ */ s(
|
|
156
|
+
}) : /* @__PURE__ */ s(ot, {
|
|
157
157
|
width: 24,
|
|
158
158
|
height: 24,
|
|
159
159
|
className: E(W["select-custom-icon"], a && W["select-custom-icon-open"], "text-delta-700")
|
|
160
160
|
}))
|
|
161
161
|
})
|
|
162
162
|
]
|
|
163
|
-
}),
|
|
164
|
-
disabled:
|
|
163
|
+
}), Ze = {
|
|
164
|
+
disabled: S,
|
|
165
165
|
size: xe,
|
|
166
166
|
fullWidth: !0,
|
|
167
167
|
error: be,
|
|
@@ -170,10 +170,10 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
170
170
|
onChange: (e) => {
|
|
171
171
|
x(null), P(e, e.target.value, "input"), a || u(!0);
|
|
172
172
|
},
|
|
173
|
-
onKeyDown:
|
|
173
|
+
onKeyDown: Ge,
|
|
174
174
|
slotProps: {
|
|
175
175
|
htmlInput: {
|
|
176
|
-
...
|
|
176
|
+
...We(),
|
|
177
177
|
ref: Z,
|
|
178
178
|
onClick: () => u(!0),
|
|
179
179
|
role: "combobox",
|
|
@@ -185,15 +185,15 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
185
185
|
readOnly: g
|
|
186
186
|
},
|
|
187
187
|
input: {
|
|
188
|
-
ref:
|
|
189
|
-
startAdornment:
|
|
190
|
-
endAdornment:
|
|
188
|
+
ref: Be,
|
|
189
|
+
startAdornment: Qe,
|
|
190
|
+
endAdornment: Xe
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
},
|
|
194
|
-
const { key: f, ...
|
|
193
|
+
}, Ke = E("asma-pressable", "relative box-border flex cursor-pointer items-center gap-x-3 px-3 py-1.5 text-base text-delta-800", we === "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"), et = (e, t, n) => {
|
|
194
|
+
const { key: f, ...y } = e;
|
|
195
195
|
return /* @__PURE__ */ I("li", {
|
|
196
|
-
...
|
|
196
|
+
...y,
|
|
197
197
|
children: [
|
|
198
198
|
e["data-active"] !== void 0 && /* @__PURE__ */ s("span", {
|
|
199
199
|
"aria-hidden": "true",
|
|
@@ -203,11 +203,12 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
203
203
|
dataTest: `${l}-${d(t)}-checkbox`,
|
|
204
204
|
checked: n.selected,
|
|
205
205
|
size: "medium",
|
|
206
|
+
checkboxClassName: "!h-4 !w-4",
|
|
206
207
|
hideWrapper: !0,
|
|
207
208
|
decorative: !0
|
|
208
209
|
}) : /* @__PURE__ */ s("span", {
|
|
209
210
|
className: "w-5",
|
|
210
|
-
children: n.selected && /* @__PURE__ */ s(
|
|
211
|
+
children: n.selected && /* @__PURE__ */ s(nt, {
|
|
211
212
|
width: 20,
|
|
212
213
|
height: 20,
|
|
213
214
|
className: "text-gama-500"
|
|
@@ -219,16 +220,16 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
219
220
|
})
|
|
220
221
|
]
|
|
221
222
|
}, f);
|
|
222
|
-
},
|
|
223
|
+
}, tt = (e, t) => {
|
|
223
224
|
const n = $(e), f = {
|
|
224
|
-
...
|
|
225
|
+
...Ve({
|
|
225
226
|
onMouseDown: (m) => m.preventDefault(),
|
|
226
227
|
onClick: (m) => {
|
|
227
228
|
n || v(m, e);
|
|
228
229
|
},
|
|
229
230
|
onMouseMove: () => x(null)
|
|
230
231
|
}),
|
|
231
|
-
key:
|
|
232
|
+
key: C ? String(C(e)) : `${d(e)}-${t}`,
|
|
232
233
|
ref: (m) => {
|
|
233
234
|
X.current[t] = m;
|
|
234
235
|
},
|
|
@@ -237,34 +238,34 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
237
238
|
"aria-selected": O(e),
|
|
238
239
|
"aria-disabled": n || void 0,
|
|
239
240
|
"data-active": o === t ? "" : void 0,
|
|
240
|
-
className:
|
|
241
|
-
},
|
|
241
|
+
className: Ke
|
|
242
|
+
}, y = {
|
|
242
243
|
selected: O(e),
|
|
243
244
|
index: t,
|
|
244
245
|
inputValue: h
|
|
245
246
|
};
|
|
246
|
-
return B ? B(f, e,
|
|
247
|
-
},
|
|
247
|
+
return B ? B(f, e, y) : et(f, e, y);
|
|
248
|
+
}, lt = !!(F && r), H = b.length > 0 && i.length === b.length, rt = i.length > 0 && !H;
|
|
248
249
|
return /* @__PURE__ */ I("div", {
|
|
249
|
-
className: E(W.styledSelectAutocompleteWrapper, !Ae && "w-auto",
|
|
250
|
-
children: [pe(
|
|
250
|
+
className: E(W.styledSelectAutocompleteWrapper, !Ae && "w-auto", $e, Pe),
|
|
251
|
+
children: [pe(Ze), a && /* @__PURE__ */ s(ht, {
|
|
251
252
|
root: oe,
|
|
252
253
|
children: /* @__PURE__ */ I("ul", {
|
|
253
|
-
ref:
|
|
254
|
-
...j ?
|
|
254
|
+
ref: Te,
|
|
255
|
+
...j ? ct : {},
|
|
255
256
|
style: {
|
|
256
|
-
...j ?
|
|
257
|
-
...
|
|
258
|
-
width:
|
|
257
|
+
...j ? dt : {},
|
|
258
|
+
...He,
|
|
259
|
+
width: Oe ?? void 0,
|
|
259
260
|
maxHeight: K ?? void 0,
|
|
260
261
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
261
262
|
...G?.popper?.style
|
|
262
263
|
},
|
|
263
|
-
...
|
|
264
|
+
...Ue(),
|
|
264
265
|
id: Q,
|
|
265
266
|
role: "listbox",
|
|
266
267
|
"aria-multiselectable": r ? !0 : void 0,
|
|
267
|
-
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)]",
|
|
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)]", lt && "py-0", "[&>li:not(:last-child)]:border-0 [&>li:not(:last-child)]:border-b", "[&>li:not(:last-child)]:border-solid [&>li:not(:last-child)]:border-delta-200", Ce?.listbox, G?.popper?.className),
|
|
268
269
|
children: [F && r && /* @__PURE__ */ I("li", {
|
|
269
270
|
id: `${l}-select-all`,
|
|
270
271
|
role: "option",
|
|
@@ -283,14 +284,15 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
283
284
|
/* @__PURE__ */ s(ie, {
|
|
284
285
|
dataTest: `${l}-select-all`,
|
|
285
286
|
checked: H,
|
|
286
|
-
indeterminate:
|
|
287
|
+
indeterminate: rt,
|
|
287
288
|
size: "medium",
|
|
289
|
+
checkboxClassName: "!h-4 !w-4",
|
|
288
290
|
hideWrapper: !0,
|
|
289
291
|
decorative: !0
|
|
290
292
|
}),
|
|
291
293
|
/* @__PURE__ */ s("span", {
|
|
292
294
|
className: "flex-1 truncate",
|
|
293
|
-
children:
|
|
295
|
+
children: Ne
|
|
294
296
|
})
|
|
295
297
|
]
|
|
296
298
|
}), Y ? /* @__PURE__ */ s("li", {
|
|
@@ -301,11 +303,11 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: A, onChange: N, g
|
|
|
301
303
|
role: "presentation",
|
|
302
304
|
className: "px-3 py-2 text-sm text-delta-600",
|
|
303
305
|
children: he
|
|
304
|
-
}) : p.map(
|
|
306
|
+
}) : p.map(tt)]
|
|
305
307
|
})
|
|
306
308
|
})]
|
|
307
309
|
});
|
|
308
310
|
}
|
|
309
311
|
export {
|
|
310
|
-
|
|
312
|
+
Ht as StyledSelectAutocomplete
|
|
311
313
|
};
|
|
@@ -34,6 +34,12 @@ interface DynamicSelectCommonProps<TOption extends DynamicSelectOption> {
|
|
|
34
34
|
title?: string;
|
|
35
35
|
/** @figmaProp none — app size (chips/buttons). Defaults to `'medium'`. */
|
|
36
36
|
size?: 'small' | 'medium';
|
|
37
|
+
/**
|
|
38
|
+
* Option-row density in the autocomplete dropdown. `'compact'` (default) matches the Figma Menus
|
|
39
|
+
* item at 40px; `'regular'` gives a roomier 48px row. Rows still grow taller when a label wraps.
|
|
40
|
+
* No effect on the chip-group variant (≤5 options).
|
|
41
|
+
*/
|
|
42
|
+
rowSize?: 'compact' | 'regular';
|
|
37
43
|
/** Placeholder text shown in the autocomplete input when no value is selected. */
|
|
38
44
|
placeholder?: string;
|
|
39
45
|
/** @figmaProp State = true→"Disabled" */
|
|
@@ -82,6 +82,13 @@ export interface StyledSelectAutocompleteProps<T, Multiple extends boolean | und
|
|
|
82
82
|
helperText?: ReactNode;
|
|
83
83
|
/** @figmaProp none — FieldSize (both render the 40px field) */
|
|
84
84
|
size?: 'small' | 'medium';
|
|
85
|
+
/**
|
|
86
|
+
* Option-row density in the popover. `'compact'` (default) matches the Figma Menus item at 40px
|
|
87
|
+
* (`min-h-10`); `'regular'` gives a roomier 48px row (`min-h-12`). Rows still grow taller when a
|
|
88
|
+
* label wraps to a second line — this only sets the minimum. Does not affect the 32px select-all
|
|
89
|
+
* header, the input field, or single-select rows' left check column.
|
|
90
|
+
*/
|
|
91
|
+
rowSize?: 'compact' | 'regular';
|
|
85
92
|
/** @figmaProp Clear (trigger clear button) */
|
|
86
93
|
disableClearable?: boolean;
|
|
87
94
|
freeSolo?: boolean;
|
|
@@ -125,5 +132,5 @@ export interface StyledSelectAutocompleteProps<T, Multiple extends boolean | und
|
|
|
125
132
|
* ponytail: `freeSolo` is accepted (arbitrary input is emitted via onInputChange) but not turned
|
|
126
133
|
* into option values; exact keyboard-parity edge cases are Chromatic/axe-gated.
|
|
127
134
|
*/
|
|
128
|
-
export declare function StyledSelectAutocomplete<T, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false>({ dataTest, options, renderInput, value, onChange, getOptionLabel, getOptionKey, isOptionEqualToValue, renderOption, renderValue, filterOptions, loading, loadingText, noOptionsText, disabled, readOnly, error, helperText, size, disableClearable, disableCloseOnSelect, popupIcon, autoHeight, multiple, allowSelectAll, selectAllLabel, fullWidth, classes, inputValue: controlledInput, onInputChange, open: controlledOpen, onOpen, onClose, className, wrapperClassName, getOptionDisabled, slotProps, }: StyledSelectAutocompleteProps<T, Multiple, DisableClearable, FreeSolo>): JSX.Element;
|
|
135
|
+
export declare function StyledSelectAutocomplete<T, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false>({ dataTest, options, renderInput, value, onChange, getOptionLabel, getOptionKey, isOptionEqualToValue, renderOption, renderValue, filterOptions, loading, loadingText, noOptionsText, disabled, readOnly, error, helperText, size, rowSize, disableClearable, disableCloseOnSelect, popupIcon, autoHeight, multiple, allowSelectAll, selectAllLabel, fullWidth, classes, inputValue: controlledInput, onInputChange, open: controlledOpen, onOpen, onClose, className, wrapperClassName, getOptionDisabled, slotProps, }: StyledSelectAutocompleteProps<T, Multiple, DisableClearable, FreeSolo>): JSX.Element;
|
|
129
136
|
export {};
|