asma-ui-core 3.95.1 → 3.97.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/input-field/StyledInputField.js +89 -84
- package/dist/components/inputs/input-field/StyledInputField.module.js +3 -3
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +63 -63
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.module.js +3 -3
- package/dist/components/utils/popover/PopoverSheet.js +40 -40
- 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,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 || S) || (q === void 0 &&
|
|
18
|
-
}, [
|
|
19
|
-
M === void 0 && J(t),
|
|
20
|
-
}, [o, x] = D(null), Q = `${l}-listbox`, X = de([]), Z = de(null), [
|
|
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
|
+
M === void 0 && J(t), Se?.(e, t, n);
|
|
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,7 +25,7 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, g
|
|
|
25
25
|
r,
|
|
26
26
|
ee
|
|
27
27
|
]);
|
|
28
|
-
const O = (e) => r ? i.some((t) => R(e, t)) : w !== null && R(e, w), $ = (e) =>
|
|
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
31
|
const t = !r && w !== null ? d(w).toLowerCase() : null;
|
|
@@ -50,26 +50,26 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, 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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
xt(0),
|
|
61
|
+
gt({ padding: 8 }),
|
|
62
|
+
wt({ padding: 8 }),
|
|
63
|
+
yt({ apply({ rects: e, availableHeight: t }) {
|
|
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
74
|
const f = i.some((m) => R(t, m)), y = f ? i.filter((m) => !R(t, m)) : [...i, t];
|
|
75
75
|
A?.(e, y, f ? "removeOption" : "selectOption", { option: t }), P(e, "", "reset"), n && u(!1);
|
|
@@ -80,7 +80,7 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, g
|
|
|
80
80
|
}, z = (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
|
+
}, 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: N, onChange: A, 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: N, onChange: A, 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 = !
|
|
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
|
|
113
|
+
const Je = (e) => {
|
|
114
114
|
e.preventDefault(), !(S || g) && (Z.current?.focus(), u(!a));
|
|
115
|
-
},
|
|
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
|
-
}, C ? C(e) : `${d(e)}-${t}`)) : void 0,
|
|
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: 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: 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,19 +148,19 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, 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
|
-
}),
|
|
163
|
+
}), Ze = {
|
|
164
164
|
disabled: S,
|
|
165
165
|
size: xe,
|
|
166
166
|
fullWidth: !0,
|
|
@@ -170,10 +170,10 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, 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,12 +185,12 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, 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
|
-
},
|
|
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
194
|
const { key: f, ...y } = e;
|
|
195
195
|
return /* @__PURE__ */ I("li", {
|
|
196
196
|
...y,
|
|
@@ -208,7 +208,7 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, g
|
|
|
208
208
|
decorative: !0
|
|
209
209
|
}) : /* @__PURE__ */ s("span", {
|
|
210
210
|
className: "w-5",
|
|
211
|
-
children: n.selected && /* @__PURE__ */ s(
|
|
211
|
+
children: n.selected && /* @__PURE__ */ s(nt, {
|
|
212
212
|
width: 20,
|
|
213
213
|
height: 20,
|
|
214
214
|
className: "text-gama-500"
|
|
@@ -220,9 +220,9 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, g
|
|
|
220
220
|
})
|
|
221
221
|
]
|
|
222
222
|
}, f);
|
|
223
|
-
},
|
|
223
|
+
}, tt = (e, t) => {
|
|
224
224
|
const n = $(e), f = {
|
|
225
|
-
...
|
|
225
|
+
...Ve({
|
|
226
226
|
onMouseDown: (m) => m.preventDefault(),
|
|
227
227
|
onClick: (m) => {
|
|
228
228
|
n || v(m, e);
|
|
@@ -238,34 +238,34 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, g
|
|
|
238
238
|
"aria-selected": O(e),
|
|
239
239
|
"aria-disabled": n || void 0,
|
|
240
240
|
"data-active": o === t ? "" : void 0,
|
|
241
|
-
className:
|
|
241
|
+
className: Ke
|
|
242
242
|
}, y = {
|
|
243
243
|
selected: O(e),
|
|
244
244
|
index: t,
|
|
245
245
|
inputValue: h
|
|
246
246
|
};
|
|
247
|
-
return B ? B(f, e, y) :
|
|
248
|
-
},
|
|
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;
|
|
249
249
|
return /* @__PURE__ */ I("div", {
|
|
250
|
-
className: E(W.styledSelectAutocompleteWrapper, !
|
|
251
|
-
children: [pe(
|
|
250
|
+
className: E(W.styledSelectAutocompleteWrapper, !Ae && "w-auto", $e, Pe),
|
|
251
|
+
children: [pe(Ze), a && /* @__PURE__ */ s(ht, {
|
|
252
252
|
root: oe,
|
|
253
253
|
children: /* @__PURE__ */ I("ul", {
|
|
254
|
-
ref:
|
|
255
|
-
...j ?
|
|
254
|
+
ref: Te,
|
|
255
|
+
...j ? ct : {},
|
|
256
256
|
style: {
|
|
257
|
-
...j ?
|
|
258
|
-
...
|
|
259
|
-
width:
|
|
257
|
+
...j ? dt : {},
|
|
258
|
+
...He,
|
|
259
|
+
width: Oe ?? void 0,
|
|
260
260
|
maxHeight: K ?? void 0,
|
|
261
261
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
262
262
|
...G?.popper?.style
|
|
263
263
|
},
|
|
264
|
-
...
|
|
264
|
+
...Ue(),
|
|
265
265
|
id: Q,
|
|
266
266
|
role: "listbox",
|
|
267
267
|
"aria-multiselectable": r ? !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)]",
|
|
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),
|
|
269
269
|
children: [F && r && /* @__PURE__ */ I("li", {
|
|
270
270
|
id: `${l}-select-all`,
|
|
271
271
|
role: "option",
|
|
@@ -284,7 +284,7 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, g
|
|
|
284
284
|
/* @__PURE__ */ s(ie, {
|
|
285
285
|
dataTest: `${l}-select-all`,
|
|
286
286
|
checked: H,
|
|
287
|
-
indeterminate:
|
|
287
|
+
indeterminate: rt,
|
|
288
288
|
size: "medium",
|
|
289
289
|
checkboxClassName: "!h-4 !w-4",
|
|
290
290
|
hideWrapper: !0,
|
|
@@ -292,7 +292,7 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, g
|
|
|
292
292
|
}),
|
|
293
293
|
/* @__PURE__ */ s("span", {
|
|
294
294
|
className: "flex-1 truncate",
|
|
295
|
-
children:
|
|
295
|
+
children: Ne
|
|
296
296
|
})
|
|
297
297
|
]
|
|
298
298
|
}), Y ? /* @__PURE__ */ s("li", {
|
|
@@ -303,11 +303,11 @@ function zt({ dataTest: l, options: b, renderInput: pe, value: N, onChange: A, g
|
|
|
303
303
|
role: "presentation",
|
|
304
304
|
className: "px-3 py-2 text-sm text-delta-600",
|
|
305
305
|
children: he
|
|
306
|
-
}) : p.map(
|
|
306
|
+
}) : p.map(tt)]
|
|
307
307
|
})
|
|
308
308
|
})]
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
export {
|
|
312
|
-
|
|
312
|
+
Ht as StyledSelectAutocomplete
|
|
313
313
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var e = "
|
|
1
|
+
var e = "_styledSelectAutocompleteWrapper_f4sqa_1", t = {
|
|
2
2
|
styledSelectAutocompleteWrapper: e,
|
|
3
|
-
"select-custom-icon": "_select-custom-
|
|
4
|
-
"select-custom-icon-open": "_select-custom-icon-
|
|
3
|
+
"select-custom-icon": "_select-custom-icon_f4sqa_6",
|
|
4
|
+
"select-custom-icon-open": "_select-custom-icon-open_f4sqa_14"
|
|
5
5
|
};
|
|
6
6
|
export {
|
|
7
7
|
t as default
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { firstTabbable as
|
|
3
|
-
import { TOP_LAYER_PROPS as
|
|
4
|
-
import { StyledButton as
|
|
5
|
-
import { useMobileMediaQuery as
|
|
6
|
-
import { useDebouncedValue as
|
|
7
|
-
import { useFocusTrap as
|
|
8
|
-
import { formatResultsLabel as
|
|
9
|
-
import { StyledBottomSheet as
|
|
10
|
-
import { PopoverAnatomy as
|
|
11
|
-
import { useCallback as m, useEffect as b, useId as
|
|
1
|
+
import { cn as re } from "../../../helpers/cn.js";
|
|
2
|
+
import { firstTabbable as ne } from "../../../helpers/focusable.js";
|
|
3
|
+
import { TOP_LAYER_PROPS as ie, TOP_LAYER_RESET_STYLE as se, getOpenModalDialogAncestor as ae, shouldUsePopoverTopLayer as ce, useTopLayerRef as le } from "../../../hooks/useTopLayer.hook.js";
|
|
4
|
+
import { StyledButton as ue } from "../../inputs/button/StyledButton.js";
|
|
5
|
+
import { useMobileMediaQuery as de } from "../../../hooks/useMediaQuery.hook.js";
|
|
6
|
+
import { useDebouncedValue as fe } from "../../../hooks/useDebouncedValue.hook.js";
|
|
7
|
+
import { useFocusTrap as pe } from "../../../hooks/useFocusTrap.hook.js";
|
|
8
|
+
import { formatResultsLabel as me } from "../bottom-sheet/formatResultsLabel.js";
|
|
9
|
+
import { StyledBottomSheet as ge } from "../bottom-sheet/StyledBottomSheet.js";
|
|
10
|
+
import { PopoverAnatomy as ve } from "./PopoverAnatomy.js";
|
|
11
|
+
import { useCallback as m, useEffect as b, useId as he, useRef as y, useState as g } from "react";
|
|
12
12
|
import { Fragment as N, jsx as c, jsxs as W } from "react/jsx-runtime";
|
|
13
|
-
import { FloatingPortal as
|
|
14
|
-
var
|
|
13
|
+
import { FloatingPortal as xe, autoUpdate as _e, flip as Pe, offset as be, shift as ye, size as Re, useDismiss as Ee, useFloating as Se, useInteractions as Te, useMergeRefs as Ae } from "@floating-ui/react";
|
|
14
|
+
var Me = 240, we = {
|
|
15
15
|
info: 472,
|
|
16
16
|
action: 472
|
|
17
|
-
},
|
|
18
|
-
const a =
|
|
17
|
+
}, Fe = 0.6, B = "calc(100vw - 32px)", qe = ({ dataTest: s, renderTrigger: R, variant: E = "info", title: l, children: S, viewResultsAction: T, resetAction: A, footerActions: M, resultCount: v, closeLabel: w = "Lukk", ariaLabel: F, onOpenChange: I, className: O }) => {
|
|
18
|
+
const a = he(), L = `${a}-title`, [o, X] = g(!1), [H, U] = g(), [Y, $] = g(), u = de(), t = E === "action", j = u && !t, k = u && t, d = m((e) => {
|
|
19
19
|
X(e), I?.(e);
|
|
20
|
-
}, [I]), { refs: h, floatingStyles: q, context: z } =
|
|
20
|
+
}, [I]), { refs: h, floatingStyles: q, context: z } = Se({
|
|
21
21
|
open: o,
|
|
22
22
|
onOpenChange: d,
|
|
23
23
|
placement: "bottom-start",
|
|
24
24
|
strategy: "fixed",
|
|
25
|
-
whileElementsMounted:
|
|
25
|
+
whileElementsMounted: _e,
|
|
26
26
|
middleware: [
|
|
27
|
-
|
|
28
|
-
...j ? [] : [
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
be(8),
|
|
28
|
+
...j ? [] : [Pe({ padding: 8 })],
|
|
29
|
+
ye({ padding: 8 }),
|
|
30
|
+
Re({
|
|
31
31
|
padding: 8,
|
|
32
32
|
apply({ availableHeight: e }) {
|
|
33
|
-
$(Math.min(e, Math.round(window.innerHeight *
|
|
33
|
+
$(Math.min(e, Math.round(window.innerHeight * Fe)));
|
|
34
34
|
}
|
|
35
35
|
})
|
|
36
36
|
]
|
|
37
|
-
}), { getFloatingProps: V } =
|
|
37
|
+
}), { getFloatingProps: V } = Te([Ee(z, {
|
|
38
38
|
enabled: !k,
|
|
39
39
|
escapeKey: !0,
|
|
40
40
|
outsidePress: (e) => {
|
|
41
41
|
const i = f.current;
|
|
42
42
|
return !(i && e.target instanceof Node && i.contains(e.target));
|
|
43
43
|
}
|
|
44
|
-
})]), x =
|
|
44
|
+
})]), x = ce(H), C = y(null), [r, G] = g(null), K = m((e) => {
|
|
45
45
|
C.current = e, G(e);
|
|
46
|
-
}, []), Q =
|
|
46
|
+
}, []), Q = Ae([le(h.setFloating, x), K]), f = y(null), J = m((e) => {
|
|
47
47
|
f.current = e, h.setReference(e);
|
|
48
48
|
}, [h]), n = m(() => {
|
|
49
49
|
d(!1);
|
|
50
50
|
}, [d]);
|
|
51
|
-
|
|
51
|
+
pe(o && t && r !== null, C), b(() => {
|
|
52
52
|
if (!r) return;
|
|
53
53
|
const e = requestAnimationFrame(() => {
|
|
54
|
-
(t ?
|
|
54
|
+
(t ? ne(r) : r)?.focus({ preventScroll: !0 });
|
|
55
55
|
});
|
|
56
56
|
return () => {
|
|
57
57
|
cancelAnimationFrame(e);
|
|
@@ -96,21 +96,21 @@ var Ae = 240, Me = {
|
|
|
96
96
|
n();
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
U(
|
|
99
|
+
U(ae(e.currentTarget)), d(!0);
|
|
100
100
|
},
|
|
101
101
|
"aria-expanded": o,
|
|
102
102
|
"aria-controls": o ? a : void 0,
|
|
103
103
|
"aria-haspopup": t ? "dialog" : void 0,
|
|
104
104
|
"aria-describedby": !t && o ? a : void 0
|
|
105
105
|
}
|
|
106
|
-
}, p = (e) => typeof e == "function" ? e({ close: n }) : e, Z =
|
|
106
|
+
}, p = (e) => typeof e == "function" ? e({ close: n }) : e, Z = fe(v, 500), ee = T ?? (v === void 0 ? void 0 : /* @__PURE__ */ c(ue, {
|
|
107
107
|
dataTest: `${s}-view-results`,
|
|
108
108
|
type: "button",
|
|
109
109
|
variant: "text",
|
|
110
110
|
onClick: n,
|
|
111
|
-
children:
|
|
112
|
-
})), te = u ? B :
|
|
113
|
-
return k ? /* @__PURE__ */ W(N, { children: [R(D), /* @__PURE__ */ c(
|
|
111
|
+
children: me(Z)
|
|
112
|
+
})), te = u ? B : we[E], oe = u ? B : void 0;
|
|
113
|
+
return k ? /* @__PURE__ */ W(N, { children: [R(D), /* @__PURE__ */ c(ge, {
|
|
114
114
|
id: a,
|
|
115
115
|
dataTest: s,
|
|
116
116
|
open: o,
|
|
@@ -124,7 +124,7 @@ var Ae = 240, Me = {
|
|
|
124
124
|
closeLabel: w,
|
|
125
125
|
className: O,
|
|
126
126
|
children: S
|
|
127
|
-
})] }) : /* @__PURE__ */ W(N, { children: [R(D), o && /* @__PURE__ */ c(
|
|
127
|
+
})] }) : /* @__PURE__ */ W(N, { children: [R(D), o && /* @__PURE__ */ c(xe, {
|
|
128
128
|
root: H,
|
|
129
129
|
children: /* @__PURE__ */ c("div", {
|
|
130
130
|
...V(),
|
|
@@ -136,17 +136,17 @@ var Ae = 240, Me = {
|
|
|
136
136
|
"aria-labelledby": t && l ? L : void 0,
|
|
137
137
|
"aria-label": t && !l ? F : void 0,
|
|
138
138
|
tabIndex: t ? void 0 : -1,
|
|
139
|
-
...x ?
|
|
139
|
+
...x ? ie : {},
|
|
140
140
|
style: {
|
|
141
|
-
...x ?
|
|
141
|
+
...x ? se : {},
|
|
142
142
|
...q,
|
|
143
|
-
minWidth:
|
|
144
|
-
width:
|
|
143
|
+
minWidth: Me,
|
|
144
|
+
width: oe,
|
|
145
145
|
maxWidth: te,
|
|
146
146
|
maxHeight: Y
|
|
147
147
|
},
|
|
148
|
-
className:
|
|
149
|
-
children: /* @__PURE__ */ c(
|
|
148
|
+
className: re("z-[1300]", "box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[inset_0_0_0_1px_var(--colors-delta-300),0px_4px_40px_0px_#22213366]", O),
|
|
149
|
+
children: /* @__PURE__ */ c(ve, {
|
|
150
150
|
dataTest: s,
|
|
151
151
|
title: l,
|
|
152
152
|
titleId: L,
|
|
@@ -161,5 +161,5 @@ var Ae = 240, Me = {
|
|
|
161
161
|
})] });
|
|
162
162
|
};
|
|
163
163
|
export {
|
|
164
|
-
|
|
164
|
+
qe as PopoverSheet
|
|
165
165
|
};
|
|
@@ -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 {};
|