asma-ui-core 3.111.0 → 3.113.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 +95 -93
- package/dist/components/inputs/full-screen-picker/FullScreenPicker.js +93 -0
- package/dist/components/inputs/full-screen-picker/PickerLiveRegion.js +34 -0
- package/dist/components/inputs/full-screen-picker/pickerCopy.js +34 -0
- package/dist/components/inputs/full-screen-picker/useVisualViewportHeight.js +10 -0
- package/dist/components/inputs/input-field/StyledInputField.js +147 -157
- package/dist/components/inputs/phone-field/CountryCodeOptions.js +28 -24
- package/dist/components/inputs/phone-field/CountryCodeSelect.js +82 -75
- package/dist/components/inputs/select-autocomplete/SelectAutocompletePicker.js +217 -0
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +270 -220
- package/dist/components/inputs/select-autocomplete/draftChanges.js +24 -0
- package/dist/components/inputs/select-autocomplete/listboxCursor.js +7 -0
- package/dist/components/inputs/select-autocomplete/readFieldName.js +18 -0
- package/dist/components/inputs/textarea/StyledTextarea.js +46 -47
- package/dist/hooks/useMediaQuery.hook.js +12 -8
- package/dist/index.js +137 -133
- package/dist/src/components/inputs/dynamic-select/StyledDynamicSelect.d.ts +4 -1
- package/dist/src/components/inputs/full-screen-picker/FullScreenPicker.d.ts +62 -0
- package/dist/src/components/inputs/full-screen-picker/PickerLiveRegion.d.ts +31 -0
- package/dist/src/components/inputs/full-screen-picker/index.d.ts +2 -0
- package/dist/src/components/inputs/full-screen-picker/pickerCopy.d.ts +29 -0
- package/dist/src/components/inputs/full-screen-picker/useVisualViewportHeight.d.ts +8 -0
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +4 -1
- package/dist/src/components/inputs/phone-field/CountryCodeOptions.d.ts +9 -1
- package/dist/src/components/inputs/phone-field/CountryCodeSelect.d.ts +4 -3
- package/dist/src/components/inputs/phone-field/useCountryPicker.d.ts +2 -1
- package/dist/src/components/inputs/select-autocomplete/SelectAutocompletePicker.d.ts +52 -0
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +21 -2
- package/dist/src/components/inputs/select-autocomplete/draftChanges.d.ts +17 -0
- package/dist/src/components/inputs/select-autocomplete/listboxCursor.d.ts +9 -0
- package/dist/src/components/inputs/select-autocomplete/readFieldName.d.ts +13 -0
- package/dist/src/helpers/CharacterCounter.d.ts +2 -1
- package/dist/src/hooks/useMediaQuery.hook.d.ts +6 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,212 +1,228 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { TOP_LAYER_PROPS as
|
|
3
|
-
import { ChevronDownIcon as
|
|
4
|
-
import { CloseIcon as
|
|
5
|
-
import { CheckIcon as
|
|
6
|
-
import { PlusIconCircle as
|
|
7
|
-
import { StyledChip as
|
|
8
|
-
import { StyledCheckbox as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { cn as D } from "../../../helpers/cn.js";
|
|
2
|
+
import { TOP_LAYER_PROPS as xt, TOP_LAYER_RESET_STYLE as yt, getOpenModalDialogAncestor as kt, shouldUsePopoverTopLayer as vt, useTopLayerRef as wt } from "../../../hooks/useTopLayer.hook.js";
|
|
3
|
+
import { ChevronDownIcon as Dt } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
4
|
+
import { CloseIcon as It } from "../../icons/close-icon/CloseIcon.js";
|
|
5
|
+
import { CheckIcon as Nt } from "../../icons/check-icon/CheckIcon.js";
|
|
6
|
+
import { PlusIconCircle as Pt } from "../../icons/plus-icon-circle/PlusIconCircle.js";
|
|
7
|
+
import { StyledChip as At } from "../../data-display/chip/StyledChip.js";
|
|
8
|
+
import { StyledCheckbox as ve } from "../checkbox/base-ui/StyledCheckbox.js";
|
|
9
|
+
import { useFullScreenPickerMediaQuery as Ct } from "../../../hooks/useMediaQuery.hook.js";
|
|
10
|
+
import { useBackCloses as St } from "../../../hooks/useBackCloses.hook.js";
|
|
11
|
+
import { fieldWidthStyle as Rt } from "../field-styles.js";
|
|
12
|
+
import { LoadingIcon as Mt } from "../../../table/shared-components/LoadingIcon.js";
|
|
13
|
+
import { PickerLiveRegion as $t, useAnnouncer as _t } from "../full-screen-picker/PickerLiveRegion.js";
|
|
14
|
+
import { getPickerText as Ft } from "../full-screen-picker/pickerCopy.js";
|
|
15
|
+
import { readFieldName as Lt } from "./readFieldName.js";
|
|
16
|
+
import { getDraftChanges as Et } from "./draftChanges.js";
|
|
17
|
+
import { nextActiveIndex as Wt } from "./listboxCursor.js";
|
|
18
|
+
import { SelectAutocompletePicker as jt } from "./SelectAutocompletePicker.js";
|
|
19
|
+
import J from "./StyledSelectAutocomplete.module.js";
|
|
20
|
+
import { useEffect as we, useMemo as X, useRef as De, useState as I } from "react";
|
|
21
|
+
import { Fragment as zt, jsx as o, jsxs as N } from "react/jsx-runtime";
|
|
22
|
+
import { FloatingPortal as Ht, autoUpdate as Bt, flip as Ut, offset as Vt, shift as Ot, size as Yt, useDismiss as qt, useFloating as Qt, useInteractions as Tt, useMergeRefs as Ie, useRole as Gt } from "@floating-ui/react";
|
|
23
|
+
var Jt = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), Xt = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
|
|
24
|
+
function vl({ dataTest: l, options: h, renderInput: Ne, value: $, onChange: P, getOptionLabel: Pe, getOptionKey: A, isOptionEqualToValue: Z, renderOption: j, renderValue: K, filterOptions: _, loading: z, loadingText: ee = "Loading…", noOptionsText: te = "No options", disabled: F, readOnly: b, error: Ae, helperText: Ce, size: Se = "small", rowSize: Re = "compact", disableClearable: le, disableCloseOnSelect: Me, popupIcon: $e, autoHeight: _e, multiple: Fe, allowSelectAll: C, selectAllLabel: re = "Select all", width: oe = "full", fullWidth: Zt, classes: Le, inputValue: L, onInputChange: Ee, open: se, onOpen: We, onClose: je, className: ze, wrapperClassName: He, getOptionDisabled: Be, slotProps: ne, pickerTitle: H, pickerText: Ue, locale: Ve = "en", disableFullScreenPicker: Oe }) {
|
|
25
|
+
const r = Fe === !0, k = Ct() && !Oe, [ae, Ye] = I({
|
|
26
|
+
label: "",
|
|
27
|
+
name: ""
|
|
28
|
+
}), [qe, Qe] = _t(), B = Ft(Ve, Ue), d = Pe ?? Jt, v = (e, t) => Z ? Z(e, t) : e === t, [Te, Ge] = I(!1), s = se ?? Te, i = (e) => {
|
|
29
|
+
e && (b || F) || (se === void 0 && Ge(e), e && Ye(Lt(V.current)), e ? We?.() : (y(null), je?.()));
|
|
30
|
+
}, [Je, ie] = I(""), g = L ?? Je, S = (e, t, a) => {
|
|
31
|
+
L === void 0 && ie(t), Ee?.(e, t, a);
|
|
32
|
+
}, [n, y] = I(null), U = `${l}-listbox`, ce = De([]), V = De(null), [Xe, Ze] = I(null), [de, Ke] = I(null), c = r ? Array.isArray($) ? $ : [] : [], x = r ? null : $ ?? null, ue = !r && x !== null ? d(x) : "";
|
|
33
|
+
we(() => {
|
|
34
|
+
L !== void 0 || r || ie(ue);
|
|
25
35
|
}, [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
L,
|
|
37
|
+
r,
|
|
38
|
+
ue
|
|
29
39
|
]);
|
|
30
|
-
const
|
|
31
|
-
const e = [...
|
|
32
|
-
if (
|
|
33
|
-
const t = !
|
|
34
|
-
if (!
|
|
35
|
-
const a =
|
|
36
|
-
return e.filter((
|
|
40
|
+
const O = (e) => r ? c.some((t) => v(e, t)) : x !== null && v(e, x), R = (e) => Be?.(e) ?? Xt(e), pe = X(() => {
|
|
41
|
+
const e = [...h];
|
|
42
|
+
if (_) return _(e, { inputValue: g });
|
|
43
|
+
const t = !r && x !== null ? d(x).toLowerCase() : null;
|
|
44
|
+
if (!g || g.toLowerCase() === t) return e;
|
|
45
|
+
const a = g.toLowerCase();
|
|
46
|
+
return e.filter((u) => d(u).toLowerCase().includes(a));
|
|
37
47
|
}, [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
]),
|
|
43
|
-
|
|
44
|
-
if (!
|
|
45
|
-
const e =
|
|
48
|
+
h,
|
|
49
|
+
g,
|
|
50
|
+
_,
|
|
51
|
+
$
|
|
52
|
+
]), p = X(() => pe.slice(0, 100), [pe]), fe = p.flatMap((e, t) => R(e) ? [] : [t]), Y = C && r ? [-1, ...fe] : fe, me = p.map((e, t) => t), E = C && r ? [-1, ...me] : me, M = p.findIndex(O);
|
|
53
|
+
we(() => {
|
|
54
|
+
if (!s) return;
|
|
55
|
+
const e = n ?? M;
|
|
46
56
|
if (e < 0) return;
|
|
47
|
-
const t = requestAnimationFrame(() =>
|
|
57
|
+
const t = requestAnimationFrame(() => ce.current[e]?.scrollIntoView({ block: "nearest" }));
|
|
48
58
|
return () => cancelAnimationFrame(t);
|
|
49
59
|
}, [
|
|
50
|
-
r,
|
|
51
60
|
n,
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
s,
|
|
62
|
+
de,
|
|
63
|
+
M
|
|
54
64
|
]);
|
|
55
|
-
const { refs:
|
|
56
|
-
open:
|
|
57
|
-
onOpenChange:
|
|
65
|
+
const { refs: W, floatingStyles: et, context: he } = Qt({
|
|
66
|
+
open: s,
|
|
67
|
+
onOpenChange: i,
|
|
58
68
|
placement: "bottom-start",
|
|
59
69
|
strategy: "fixed",
|
|
60
|
-
whileElementsMounted:
|
|
70
|
+
whileElementsMounted: Bt,
|
|
61
71
|
middleware: [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
Vt(0),
|
|
73
|
+
Ut({ padding: 8 }),
|
|
74
|
+
Ot({ padding: 8 }),
|
|
75
|
+
Yt({ apply({ rects: e, availableHeight: t }) {
|
|
76
|
+
Ze(e.reference.width), Ke(_e ? t - 8 : Math.min(t - 8, 320));
|
|
67
77
|
} })
|
|
68
78
|
]
|
|
69
|
-
}), { getReferenceProps:
|
|
70
|
-
|
|
71
|
-
active:
|
|
72
|
-
requestClose: () =>
|
|
79
|
+
}), { getReferenceProps: tt, getFloatingProps: lt, getItemProps: rt } = Tt([qt(he, { enabled: !k }), Gt(he, { role: "listbox" })]);
|
|
80
|
+
St({
|
|
81
|
+
active: s && !k,
|
|
82
|
+
requestClose: () => i(!1)
|
|
73
83
|
});
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (s) {
|
|
81
|
-
const p = i.some((f) => P(t, f)), w = p ? i.filter((f) => !P(t, f)) : [...i, t];
|
|
82
|
-
C?.(e, w, p ? "removeOption" : "selectOption", { option: t }), _(e, "", "reset"), a && c(!1);
|
|
84
|
+
const ot = Ie([W.setReference]), be = X(() => s ? kt(W.reference.current) : void 0, [s, W]), q = vt(be), st = Ie([wt(W.setFloating, q)]), nt = (e) => Y.includes(M) ? M : Y[e === 1 ? 0 : Y.length - 1] ?? null, at = (e) => {
|
|
85
|
+
E.length !== 0 && y((t) => Wt(E, t, M, e));
|
|
86
|
+
}, w = (e, t, a = !r || !Me) => {
|
|
87
|
+
if (r) {
|
|
88
|
+
const u = c.some((m) => v(t, m)), f = u ? c.filter((m) => !v(t, m)) : [...c, t];
|
|
89
|
+
P?.(e, f, u ? "removeOption" : "selectOption", { option: t }), S(e, "", "reset"), a && i(!1);
|
|
83
90
|
} else
|
|
84
|
-
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
P?.(e, t, "selectOption", { option: t }), S(e, d(t), "reset"), a && i(!1);
|
|
92
|
+
}, Q = (e) => {
|
|
93
|
+
P?.(e, r ? [] : null, "clear", void 0), S(e, "", "clear");
|
|
94
|
+
}, it = (e) => {
|
|
95
|
+
Q(e), i(!1), Qe(B.cleared);
|
|
96
|
+
}, ct = (e, t) => {
|
|
97
|
+
for (const { value: a, reason: u, option: f } of Et(c, t, v)) P?.(e, a, u, f === void 0 ? void 0 : { option: f });
|
|
98
|
+
S(e, "", "reset"), i(!1);
|
|
99
|
+
}, T = (e) => {
|
|
100
|
+
const t = h.length > 0 && c.length === h.length;
|
|
101
|
+
P?.(e, t ? [] : h, t ? "clear" : "selectOption", void 0);
|
|
102
|
+
}, dt = (e) => {
|
|
103
|
+
if (e.key === "Backspace" && g === "" && ge) {
|
|
104
|
+
const t = c[c.length - 1];
|
|
105
|
+
r ? t !== void 0 && w(e, t, !1) : Q(e);
|
|
106
|
+
} else if (e.key === "Enter" && !s)
|
|
107
|
+
e.preventDefault(), i(!0);
|
|
108
|
+
else if (e.key === "Enter" && n === -1)
|
|
109
|
+
e.preventDefault(), T(e);
|
|
110
|
+
else if (e.key === "Enter" && n != null && p[n] != null) {
|
|
99
111
|
e.preventDefault();
|
|
100
|
-
const t =
|
|
101
|
-
|
|
112
|
+
const t = p[n];
|
|
113
|
+
R(t) || w(e, t, !0);
|
|
102
114
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
103
|
-
if (e.preventDefault(), !
|
|
104
|
-
|
|
115
|
+
if (e.preventDefault(), !s) {
|
|
116
|
+
y(nt(e.key === "ArrowDown" ? 1 : -1)), i(!0);
|
|
105
117
|
return;
|
|
106
118
|
}
|
|
107
|
-
|
|
119
|
+
at(e.key === "ArrowDown" ? 1 : -1);
|
|
108
120
|
} else if (e.key === "Home" || e.key === "End")
|
|
109
|
-
e.preventDefault(),
|
|
110
|
-
else if (e.key === " " &&
|
|
111
|
-
e.preventDefault(),
|
|
112
|
-
else if (e.key === " " &&
|
|
121
|
+
e.preventDefault(), y(E[e.key === "Home" ? 0 : E.length - 1] ?? null);
|
|
122
|
+
else if (e.key === " " && n === -1)
|
|
123
|
+
e.preventDefault(), T(e);
|
|
124
|
+
else if (e.key === " " && n != null && p[n] != null) {
|
|
113
125
|
e.preventDefault();
|
|
114
|
-
const t =
|
|
115
|
-
|
|
116
|
-
} else e.key === "Escape" &&
|
|
117
|
-
},
|
|
118
|
-
let
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
e.preventDefault(), !(
|
|
122
|
-
},
|
|
126
|
+
const t = p[n];
|
|
127
|
+
R(t) || w(e, t, !1);
|
|
128
|
+
} else e.key === "Escape" && s ? (e.preventDefault(), e.stopPropagation(), i(!1)) : e.key === "Tab" && i(!1);
|
|
129
|
+
}, ge = !le && !b && !F && (r ? c.length > 0 : x !== null);
|
|
130
|
+
let xe;
|
|
131
|
+
s && n != null && (n === -1 || p[n] !== void 0) && (xe = n === -1 ? `${l}-select-all` : `${l}-option-${n}`);
|
|
132
|
+
const ut = (e) => {
|
|
133
|
+
e.preventDefault(), !(F || b) && (V.current?.focus(), i(!s));
|
|
134
|
+
}, pt = r ? K ? K(c, ({ index: e }) => ({ "data-index": e })) : c.map((e, t) => /* @__PURE__ */ o(At, {
|
|
123
135
|
dataTest: `selected-chip-${d(e)}`,
|
|
124
136
|
label: d(e),
|
|
125
|
-
readOnly:
|
|
137
|
+
readOnly: b,
|
|
126
138
|
deleteButtonTabIndex: -1,
|
|
127
|
-
onDelete:
|
|
128
|
-
}, A ? A(e) : `${d(e)}-${t}`)) : void 0,
|
|
139
|
+
onDelete: b ? void 0 : (a) => w(a, e)
|
|
140
|
+
}, A ? A(e) : `${d(e)}-${t}`)) : void 0, ft = /* @__PURE__ */ N("span", {
|
|
129
141
|
className: "flex items-center gap-1",
|
|
130
142
|
children: [
|
|
131
|
-
|
|
143
|
+
z && /* @__PURE__ */ o(Mt, {
|
|
132
144
|
width: 20,
|
|
133
145
|
height: 20,
|
|
134
146
|
className: "animate-spin"
|
|
135
147
|
}),
|
|
136
|
-
|
|
148
|
+
ge && /* @__PURE__ */ o("button", {
|
|
137
149
|
type: "button",
|
|
138
150
|
tabIndex: -1,
|
|
139
151
|
"aria-label": "Clear",
|
|
140
152
|
"data-testid": `${l}-clear`,
|
|
141
153
|
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",
|
|
142
154
|
onMouseDown: (e) => e.preventDefault(),
|
|
143
|
-
onClick:
|
|
144
|
-
children: /* @__PURE__ */ o(
|
|
155
|
+
onClick: Q,
|
|
156
|
+
children: /* @__PURE__ */ o(It, {
|
|
145
157
|
width: 20,
|
|
146
158
|
height: 20,
|
|
147
159
|
className: "text-delta-700"
|
|
148
160
|
})
|
|
149
161
|
}),
|
|
150
|
-
|
|
162
|
+
b ? null : /* @__PURE__ */ o("button", {
|
|
151
163
|
type: "button",
|
|
152
164
|
tabIndex: -1,
|
|
153
165
|
"aria-label": "Toggle options",
|
|
154
|
-
"aria-expanded":
|
|
166
|
+
"aria-expanded": s,
|
|
155
167
|
"data-testid": `${l}-popup-indicator`,
|
|
156
168
|
className: "flex cursor-pointer items-center border-0 bg-transparent",
|
|
157
169
|
onMouseDown: (e) => e.preventDefault(),
|
|
158
|
-
onClick:
|
|
159
|
-
children:
|
|
170
|
+
onClick: ut,
|
|
171
|
+
children: $e ?? (r ? /* @__PURE__ */ o(Pt, {
|
|
160
172
|
width: 24,
|
|
161
173
|
height: 24,
|
|
162
174
|
className: "text-delta-700"
|
|
163
|
-
}) : /* @__PURE__ */ o(
|
|
175
|
+
}) : /* @__PURE__ */ o(Dt, {
|
|
164
176
|
width: 24,
|
|
165
177
|
height: 24,
|
|
166
|
-
className:
|
|
178
|
+
className: D(J["select-custom-icon"], s && J["select-custom-icon-open"], "text-delta-700")
|
|
167
179
|
}))
|
|
168
180
|
})
|
|
169
181
|
]
|
|
170
|
-
}),
|
|
171
|
-
disabled:
|
|
172
|
-
size:
|
|
182
|
+
}), mt = {
|
|
183
|
+
disabled: F,
|
|
184
|
+
size: Se,
|
|
173
185
|
fullWidth: !0,
|
|
174
|
-
error:
|
|
175
|
-
helperText:
|
|
176
|
-
value:
|
|
186
|
+
error: Ae,
|
|
187
|
+
helperText: Ce,
|
|
188
|
+
value: g,
|
|
177
189
|
onChange: (e) => {
|
|
178
|
-
|
|
190
|
+
k || (y(null), S(e, e.target.value, "input"), s || i(!0));
|
|
179
191
|
},
|
|
180
|
-
onKeyDown:
|
|
192
|
+
onKeyDown: dt,
|
|
181
193
|
slotProps: {
|
|
182
194
|
htmlInput: {
|
|
183
|
-
...
|
|
184
|
-
ref:
|
|
185
|
-
onClick: () =>
|
|
195
|
+
...tt(),
|
|
196
|
+
ref: V,
|
|
197
|
+
onClick: () => i(!0),
|
|
186
198
|
role: "combobox",
|
|
187
199
|
"aria-autocomplete": "list",
|
|
188
|
-
"aria-expanded":
|
|
189
|
-
"aria-controls":
|
|
190
|
-
"aria-activedescendant":
|
|
200
|
+
"aria-expanded": s,
|
|
201
|
+
"aria-controls": s ? U : void 0,
|
|
202
|
+
"aria-activedescendant": xe,
|
|
191
203
|
autoComplete: "off",
|
|
192
|
-
readOnly:
|
|
204
|
+
readOnly: b,
|
|
205
|
+
...k ? {
|
|
206
|
+
inputMode: "none",
|
|
207
|
+
"aria-haspopup": "dialog"
|
|
208
|
+
} : {}
|
|
193
209
|
},
|
|
194
210
|
input: {
|
|
195
|
-
ref:
|
|
196
|
-
startAdornment:
|
|
197
|
-
endAdornment:
|
|
211
|
+
ref: ot,
|
|
212
|
+
startAdornment: pt,
|
|
213
|
+
endAdornment: ft
|
|
198
214
|
}
|
|
199
215
|
}
|
|
200
|
-
},
|
|
201
|
-
const { key:
|
|
202
|
-
return /* @__PURE__ */
|
|
203
|
-
...
|
|
216
|
+
}, ye = D("asma-pressable", "relative box-border flex cursor-pointer items-center gap-x-3 px-3 py-2 text-base text-delta-800", Re === "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"), ke = (e, t, a) => {
|
|
217
|
+
const { key: u, ...f } = e;
|
|
218
|
+
return /* @__PURE__ */ N("li", {
|
|
219
|
+
...f,
|
|
204
220
|
children: [
|
|
205
221
|
e["data-active"] !== void 0 && /* @__PURE__ */ o("span", {
|
|
206
222
|
"aria-hidden": "true",
|
|
207
223
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
208
224
|
}),
|
|
209
|
-
|
|
225
|
+
r ? /* @__PURE__ */ o(ve, {
|
|
210
226
|
dataTest: `${l}-${d(t)}-checkbox`,
|
|
211
227
|
checked: a.selected,
|
|
212
228
|
size: "medium",
|
|
@@ -214,109 +230,143 @@ function qt({ dataTest: l, options: b, renderInput: he, value: N, onChange: C, g
|
|
|
214
230
|
hideWrapper: !0,
|
|
215
231
|
decorative: !0
|
|
216
232
|
}) : /* @__PURE__ */ o("span", {
|
|
217
|
-
className: "w-5",
|
|
218
|
-
children: a.selected && /* @__PURE__ */ o(
|
|
233
|
+
className: D("w-5", a.inPicker && "flex"),
|
|
234
|
+
children: a.selected && /* @__PURE__ */ o(Nt, {
|
|
219
235
|
width: 20,
|
|
220
236
|
height: 20,
|
|
221
237
|
className: "text-gama-500"
|
|
222
238
|
})
|
|
223
239
|
}),
|
|
224
240
|
/* @__PURE__ */ o("span", {
|
|
225
|
-
className: "line-clamp-2 min-w-0 flex-1 break-words",
|
|
241
|
+
className: D(!a.inPicker && "line-clamp-2", "min-w-0 flex-1 break-words"),
|
|
226
242
|
children: d(t)
|
|
227
243
|
})
|
|
228
244
|
]
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
const a =
|
|
232
|
-
...
|
|
233
|
-
onMouseDown: (
|
|
234
|
-
onClick: (
|
|
235
|
-
a ||
|
|
245
|
+
}, u);
|
|
246
|
+
}, ht = (e, t) => {
|
|
247
|
+
const a = R(e), u = {
|
|
248
|
+
...rt({
|
|
249
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
250
|
+
onClick: (m) => {
|
|
251
|
+
a || w(m, e);
|
|
236
252
|
},
|
|
237
|
-
onMouseMove: () =>
|
|
253
|
+
onMouseMove: () => y(null)
|
|
238
254
|
}),
|
|
239
255
|
key: A ? String(A(e)) : `${d(e)}-${t}`,
|
|
240
|
-
ref: (
|
|
241
|
-
|
|
256
|
+
ref: (m) => {
|
|
257
|
+
ce.current[t] = m;
|
|
242
258
|
},
|
|
243
259
|
role: "option",
|
|
244
260
|
id: `${l}-option-${t}`,
|
|
245
|
-
"aria-selected":
|
|
261
|
+
"aria-selected": O(e),
|
|
246
262
|
"aria-disabled": a || void 0,
|
|
247
|
-
"data-active":
|
|
248
|
-
className:
|
|
249
|
-
},
|
|
250
|
-
selected:
|
|
263
|
+
"data-active": n === t ? "" : void 0,
|
|
264
|
+
className: ye
|
|
265
|
+
}, f = {
|
|
266
|
+
selected: O(e),
|
|
251
267
|
index: t,
|
|
252
|
-
inputValue:
|
|
268
|
+
inputValue: g
|
|
253
269
|
};
|
|
254
|
-
return
|
|
255
|
-
},
|
|
256
|
-
return /* @__PURE__ */
|
|
257
|
-
className:
|
|
258
|
-
"data-field-width":
|
|
259
|
-
style:
|
|
260
|
-
children: [
|
|
261
|
-
|
|
262
|
-
children: /* @__PURE__ */
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
role: "
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
270
|
+
return j ? j(u, e, f) : ke(u, e, f);
|
|
271
|
+
}, bt = !!(C && r), G = h.length > 0 && c.length === h.length, gt = c.length > 0 && !G;
|
|
272
|
+
return /* @__PURE__ */ N("div", {
|
|
273
|
+
className: D(J.styledSelectAutocompleteWrapper, He, ze),
|
|
274
|
+
"data-field-width": oe,
|
|
275
|
+
style: Rt(oe),
|
|
276
|
+
children: [
|
|
277
|
+
Ne(mt),
|
|
278
|
+
k && /* @__PURE__ */ N(zt, { children: [/* @__PURE__ */ o($t, {
|
|
279
|
+
announcement: qe,
|
|
280
|
+
dataTest: `${l}-live`
|
|
281
|
+
}), /* @__PURE__ */ o(jt, {
|
|
282
|
+
open: s,
|
|
283
|
+
dataTest: l,
|
|
284
|
+
listboxId: U,
|
|
285
|
+
title: H ?? (ae.label || void 0),
|
|
286
|
+
name: typeof H == "string" ? H : ae.name || B.search,
|
|
287
|
+
text: B,
|
|
288
|
+
options: h,
|
|
289
|
+
multiple: r,
|
|
290
|
+
value: r ? c : x,
|
|
291
|
+
clearable: !le && !b,
|
|
292
|
+
isEqual: v,
|
|
293
|
+
isOptionDisabled: R,
|
|
294
|
+
getLabel: d,
|
|
295
|
+
getOptionKey: A,
|
|
296
|
+
filterOptions: _,
|
|
297
|
+
renderOptionRow: j ?? ke,
|
|
298
|
+
optionRowClassName: ye,
|
|
299
|
+
loading: z,
|
|
300
|
+
loadingText: ee,
|
|
301
|
+
noOptionsText: te,
|
|
302
|
+
allowSelectAll: C,
|
|
303
|
+
selectAllLabel: re,
|
|
304
|
+
onSelect: w,
|
|
305
|
+
onClear: it,
|
|
306
|
+
onApply: ct,
|
|
307
|
+
onCancel: () => i(!1)
|
|
308
|
+
})] }),
|
|
309
|
+
s && !k && /* @__PURE__ */ o(Ht, {
|
|
310
|
+
root: be,
|
|
311
|
+
children: /* @__PURE__ */ N("ul", {
|
|
312
|
+
ref: st,
|
|
313
|
+
...q ? xt : {},
|
|
314
|
+
style: {
|
|
315
|
+
...q ? yt : {},
|
|
316
|
+
...et,
|
|
317
|
+
width: Xe ?? void 0,
|
|
318
|
+
maxHeight: de ?? void 0,
|
|
319
|
+
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
320
|
+
...ne?.popper?.style
|
|
321
|
+
},
|
|
322
|
+
...lt(),
|
|
323
|
+
id: U,
|
|
324
|
+
role: "listbox",
|
|
325
|
+
"aria-multiselectable": r ? !0 : void 0,
|
|
326
|
+
className: D("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)]", bt && "py-0", "[&>li:not(:last-child)]:shadow-[inset_0_-1px_0_var(--colors-delta-200)]", Le?.listbox, ne?.popper?.className),
|
|
327
|
+
children: [C && r && /* @__PURE__ */ N("li", {
|
|
328
|
+
id: `${l}-select-all`,
|
|
329
|
+
role: "option",
|
|
330
|
+
"aria-selected": G,
|
|
331
|
+
"data-active": n === -1 ? "" : void 0,
|
|
332
|
+
tabIndex: -1,
|
|
333
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
334
|
+
onClick: T,
|
|
335
|
+
onMouseMove: () => y(null),
|
|
336
|
+
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",
|
|
337
|
+
children: [
|
|
338
|
+
n === -1 && /* @__PURE__ */ o("span", {
|
|
339
|
+
"aria-hidden": "true",
|
|
340
|
+
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
341
|
+
}),
|
|
342
|
+
/* @__PURE__ */ o(ve, {
|
|
343
|
+
dataTest: `${l}-select-all`,
|
|
344
|
+
checked: G,
|
|
345
|
+
indeterminate: gt,
|
|
346
|
+
size: "medium",
|
|
347
|
+
checkboxClassName: "!h-4 !w-4",
|
|
348
|
+
hideWrapper: !0,
|
|
349
|
+
decorative: !0
|
|
350
|
+
}),
|
|
351
|
+
/* @__PURE__ */ o("span", {
|
|
352
|
+
className: "flex-1 truncate",
|
|
353
|
+
children: re
|
|
354
|
+
})
|
|
355
|
+
]
|
|
356
|
+
}), z ? /* @__PURE__ */ o("li", {
|
|
357
|
+
role: "presentation",
|
|
358
|
+
className: "px-3 py-2 text-sm text-delta-600",
|
|
359
|
+
children: ee
|
|
360
|
+
}) : p.length === 0 ? /* @__PURE__ */ o("li", {
|
|
361
|
+
role: "presentation",
|
|
362
|
+
className: "px-3 py-2 text-sm text-delta-600",
|
|
363
|
+
children: te
|
|
364
|
+
}) : p.map(ht)]
|
|
365
|
+
})
|
|
316
366
|
})
|
|
317
|
-
|
|
367
|
+
]
|
|
318
368
|
});
|
|
319
369
|
}
|
|
320
370
|
export {
|
|
321
|
-
|
|
371
|
+
vl as StyledSelectAutocomplete
|
|
322
372
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var u = (t, r, s) => {
|
|
2
|
+
if (r.length === 0) return t.length > 0 ? [{
|
|
3
|
+
value: [],
|
|
4
|
+
reason: "clear"
|
|
5
|
+
}] : [];
|
|
6
|
+
const c = [];
|
|
7
|
+
let o = [...t];
|
|
8
|
+
for (const e of t)
|
|
9
|
+
r.some((n) => s(e, n)) || (o = o.filter((n) => !s(n, e)), c.push({
|
|
10
|
+
value: o,
|
|
11
|
+
reason: "removeOption",
|
|
12
|
+
option: e
|
|
13
|
+
}));
|
|
14
|
+
for (const e of r)
|
|
15
|
+
t.some((n) => s(e, n)) || (o = [...o, e], c.push({
|
|
16
|
+
value: o,
|
|
17
|
+
reason: "selectOption",
|
|
18
|
+
option: e
|
|
19
|
+
}));
|
|
20
|
+
return c;
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
u as getDraftChanges
|
|
24
|
+
};
|