@altinn/altinn-components 0.56.11 → 0.56.13
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/SearchField-DhPNZyyE.js +687 -0
- package/dist/assets/AccountListVirtual.css +1 -1
- package/dist/assets/SearchField.css +1 -1
- package/dist/assets/TypingIcon.css +1 -0
- package/dist/components/Account/AccountListVirtual.js +23 -23
- package/dist/components/Account/AccountMenu.js +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +1 -1
- package/dist/components/Dialog/DialogActions.js +1 -1
- package/dist/components/Forms/SearchField.js +3 -2
- package/dist/components/Forms/index.js +1 -1
- package/dist/components/GlobalHeader/AccountSelector.js +1 -1
- package/dist/components/GlobalMenu/GlobalMenu.js +1 -1
- package/dist/components/GlobalMenu/LocaleSwitcher.js +1 -1
- package/dist/components/GlobalMenu_old/GlobalMenu.js +1 -1
- package/dist/components/Header/LocaleSwitcher.js +1 -1
- package/dist/components/Icon/TypingIcon.js +24 -0
- package/dist/components/Layout/Layout.js +1 -1
- package/dist/components/Menu/Menu.js +1 -1
- package/dist/components/Menu/MenuItems.js +1 -1
- package/dist/components/Menu/MenuListSearch.js +1 -1
- package/dist/components/Menu/VirtualizedMenuItems.js +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Toolbar/SelectDateFilter.js +1 -1
- package/dist/components/Toolbar/ToolbarFilterAddMenu.js +1 -1
- package/dist/components/Toolbar/ToolbarFilterMenu.js +40 -40
- package/dist/components/Toolbar/ToolbarMenu.js +12 -12
- package/dist/components/Toolbar/ToolbarSearch.js +20 -18
- package/dist/components/Toolbar/example.data.js +19 -19
- package/dist/components/Toolbar/example.hooks.js +25 -25
- package/dist/components/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/lib/components/Forms/SearchField.d.ts +3 -1
- package/dist/types/lib/components/Forms/SearchField.stories.d.ts +2 -1
- package/dist/types/lib/components/Icon/TypingIcon.d.ts +17 -0
- package/dist/types/lib/components/Toolbar/Toolbar.stories.d.ts +7 -6
- package/dist/types/lib/components/Toolbar/ToolbarSearch.d.ts +1 -1
- package/dist/types/lib/components/Toolbar/ToolbarSearch.stories.d.ts +5 -1
- package/dist/types/lib/components/Toolbar/example.hooks.d.ts +1 -1
- package/package.json +1 -1
- package/dist/SearchField-CYYz0JvC.js +0 -684
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o, jsxs as E } from "react/jsx-runtime";
|
|
3
|
+
import { c as oe } from "./index-p1eeF8LQ.js";
|
|
4
|
+
import { useRef as j, useState as Q, useMemo as V, useEffect as G, Fragment as Ie, useLayoutEffect as ne, useId as re } from "react";
|
|
5
|
+
import { Button as ie } from "./components/Button/Button.js";
|
|
6
|
+
import "react-dom";
|
|
7
|
+
import "./components/RootProvider/RootProvider.js";
|
|
8
|
+
import { useMenu as de } from "./hooks/useMenu.js";
|
|
9
|
+
import { Input as se } from "./components/Forms/Input.js";
|
|
10
|
+
import { FieldBase as ae } from "./components/Forms/FieldBase.js";
|
|
11
|
+
import "./components/Snackbar/useSnackbar.js";
|
|
12
|
+
import { TypingIcon as ve } from "./components/Icon/TypingIcon.js";
|
|
13
|
+
import { S as ce } from "./MagnifyingGlass-bwVhw07z.js";
|
|
14
|
+
import { S as le } from "./XMark-tKk6aExO.js";
|
|
15
|
+
import { MenuItem as fe } from "./components/Menu/MenuItem.js";
|
|
16
|
+
import { MenuList as Z } from "./components/Menu/MenuList.js";
|
|
17
|
+
import { MenuListItem as pe } from "./components/Menu/MenuListItem.js";
|
|
18
|
+
import { MenuListGroup as me } from "./components/Menu/MenuListGroup.js";
|
|
19
|
+
import { MenuListDivider as he } from "./components/Menu/MenuListDivider.js";
|
|
20
|
+
import { MenuListHeading as ye } from "./components/Menu/MenuListHeading.js";
|
|
21
|
+
import { a as be } from "./useMenuVirtualization-Cs426RCN.js";
|
|
22
|
+
import { useMenuSearch as we } from "./components/Menu/useMenuSearch.js";
|
|
23
|
+
import './assets/SearchField.css';const Ce = "_search_18jfe_1", ke = "_searchInput_18jfe_8", te = {
|
|
24
|
+
search: Ce,
|
|
25
|
+
searchInput: ke
|
|
26
|
+
}, xe = ({
|
|
27
|
+
style: v,
|
|
28
|
+
index: b,
|
|
29
|
+
name: B,
|
|
30
|
+
value: M,
|
|
31
|
+
placeholder: u = "Search",
|
|
32
|
+
clearButtonAltText: h = "Clear search",
|
|
33
|
+
onChange: A,
|
|
34
|
+
onClear: y,
|
|
35
|
+
onNavigate: k,
|
|
36
|
+
combobox: f = !1,
|
|
37
|
+
listId: c,
|
|
38
|
+
"aria-activedescendant": w,
|
|
39
|
+
onKeyDown: p,
|
|
40
|
+
onInput: m,
|
|
41
|
+
onFocus: _,
|
|
42
|
+
...x
|
|
43
|
+
}) => /* @__PURE__ */ o("li", { className: te.search, style: v, "data-index": b, "data-menu-search": "true", children: f ? (
|
|
44
|
+
// biome-ignore lint/a11y/useFocusableInteractive: <explanation>
|
|
45
|
+
// biome-ignore lint/a11y/useAriaPropsForRole: <explanation>
|
|
46
|
+
// biome-ignore lint/a11y/useSemanticElements: <explanation>
|
|
47
|
+
/* @__PURE__ */ o("div", { role: "combobox", "aria-expanded": !0, "aria-haspopup": "listbox", "aria-owns": c, children: /* @__PURE__ */ o(
|
|
48
|
+
ue,
|
|
49
|
+
{
|
|
50
|
+
size: "xs",
|
|
51
|
+
className: te.searchInput,
|
|
52
|
+
name: B,
|
|
53
|
+
value: M,
|
|
54
|
+
placeholder: u,
|
|
55
|
+
onChange: A,
|
|
56
|
+
onClear: y,
|
|
57
|
+
clearButtonAltText: h,
|
|
58
|
+
autoComplete: "off",
|
|
59
|
+
autoCorrect: "off",
|
|
60
|
+
autoCapitalize: "off",
|
|
61
|
+
"aria-autocomplete": "list",
|
|
62
|
+
"aria-controls": c,
|
|
63
|
+
"aria-activedescendant": w,
|
|
64
|
+
autoFocus: !0,
|
|
65
|
+
onKeyDown: (r) => {
|
|
66
|
+
(r.key === "ArrowUp" || r.key === "ArrowDown") && (r.preventDefault(), k?.()), p?.(r);
|
|
67
|
+
},
|
|
68
|
+
onInput: m,
|
|
69
|
+
onFocus: _,
|
|
70
|
+
...x
|
|
71
|
+
}
|
|
72
|
+
) })
|
|
73
|
+
) : /* @__PURE__ */ o(
|
|
74
|
+
ue,
|
|
75
|
+
{
|
|
76
|
+
size: "xs",
|
|
77
|
+
className: te.searchInput,
|
|
78
|
+
name: B,
|
|
79
|
+
value: M,
|
|
80
|
+
placeholder: u,
|
|
81
|
+
onChange: A,
|
|
82
|
+
onClear: y,
|
|
83
|
+
clearButtonAltText: h,
|
|
84
|
+
autoComplete: "off",
|
|
85
|
+
autoCorrect: "off",
|
|
86
|
+
autoCapitalize: "off",
|
|
87
|
+
autoFocus: !0,
|
|
88
|
+
onKeyDown: (r) => {
|
|
89
|
+
(r.key === "ArrowUp" || r.key === "ArrowDown") && (r.preventDefault(), k?.()), p?.(r);
|
|
90
|
+
},
|
|
91
|
+
onInput: m,
|
|
92
|
+
onFocus: _,
|
|
93
|
+
...x
|
|
94
|
+
}
|
|
95
|
+
) }), ge = ({
|
|
96
|
+
level: v = 0,
|
|
97
|
+
maxLevels: b,
|
|
98
|
+
expanded: B,
|
|
99
|
+
a11yMode: M = "menu",
|
|
100
|
+
open: u,
|
|
101
|
+
scrollToTopOnOpen: h = !1,
|
|
102
|
+
autoActivateFirstItem: A = !0,
|
|
103
|
+
autoFocusList: y = !0,
|
|
104
|
+
announceNoResults: k = !1,
|
|
105
|
+
search: f,
|
|
106
|
+
items: c,
|
|
107
|
+
groups: w = {},
|
|
108
|
+
size: p,
|
|
109
|
+
id: m,
|
|
110
|
+
color: _,
|
|
111
|
+
variant: x,
|
|
112
|
+
scrollRefStyles: r = {},
|
|
113
|
+
keyboardEvents: g = !1,
|
|
114
|
+
onSelect: T = () => {
|
|
115
|
+
},
|
|
116
|
+
onActiveItemIdChange: N
|
|
117
|
+
}) => {
|
|
118
|
+
if (b && v >= b)
|
|
119
|
+
return null;
|
|
120
|
+
const d = M === "combobox", i = d && m ? `${m}-listbox` : m, F = j(u), P = j(u), [R, C] = Q(!1), Y = V(
|
|
121
|
+
() => c.map((n, I) => ({
|
|
122
|
+
...n,
|
|
123
|
+
id: n.id || `${m}-item-${I}`
|
|
124
|
+
})),
|
|
125
|
+
[c, m]
|
|
126
|
+
), O = j(null), { menu: s, setActiveIndex: S, activeItem: W } = de({
|
|
127
|
+
items: Y,
|
|
128
|
+
groups: w,
|
|
129
|
+
groupByKey: "groupId",
|
|
130
|
+
keyboardEvents: g,
|
|
131
|
+
autoActivateFirstItem: A,
|
|
132
|
+
onSelect: T,
|
|
133
|
+
ref: O
|
|
134
|
+
});
|
|
135
|
+
return G(() => {
|
|
136
|
+
N?.(W?.id);
|
|
137
|
+
}, [W?.id, N]), G(() => {
|
|
138
|
+
if (!h) {
|
|
139
|
+
F.current = u;
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const n = F.current;
|
|
143
|
+
F.current = u, u && !n && O.current?.scrollTo({ top: 0 });
|
|
144
|
+
}, [u, h]), G(() => {
|
|
145
|
+
const n = P.current;
|
|
146
|
+
P.current = u, !(!g || f || !y) && u && !n && requestAnimationFrame(() => O.current?.focus?.({ preventScroll: !0 }));
|
|
147
|
+
}, [u, g, f]), G(() => {
|
|
148
|
+
if (d && k) {
|
|
149
|
+
S(0), C(!0);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
}, [k, d, S]), /* @__PURE__ */ E(
|
|
153
|
+
Z,
|
|
154
|
+
{
|
|
155
|
+
variant: x,
|
|
156
|
+
expanded: B,
|
|
157
|
+
ref: O,
|
|
158
|
+
style: r,
|
|
159
|
+
id: i,
|
|
160
|
+
role: d ? "listbox" : void 0,
|
|
161
|
+
tabIndex: g ? -1 : void 0,
|
|
162
|
+
children: [
|
|
163
|
+
f && /* @__PURE__ */ o(
|
|
164
|
+
xe,
|
|
165
|
+
{
|
|
166
|
+
...f,
|
|
167
|
+
combobox: d,
|
|
168
|
+
listId: i,
|
|
169
|
+
"aria-activedescendant": d && R ? W?.id : void 0,
|
|
170
|
+
onNavigate: d ? () => C(!0) : void 0,
|
|
171
|
+
onChange: (n) => {
|
|
172
|
+
C(!1), f.onChange?.(n);
|
|
173
|
+
},
|
|
174
|
+
onFocus: (n) => {
|
|
175
|
+
C(!1), f.onFocus?.(n);
|
|
176
|
+
},
|
|
177
|
+
onInput: (n) => {
|
|
178
|
+
C(!1), f.onInput?.(n);
|
|
179
|
+
},
|
|
180
|
+
onKeyDown: (n) => {
|
|
181
|
+
const I = n.key === "ArrowUp" || n.key === "ArrowDown", $ = n.key.length === 1 || n.key === "Backspace" || n.key === "Delete";
|
|
182
|
+
d && !I && $ && C(!1), f.onKeyDown?.(n);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
s.map((n, I) => {
|
|
187
|
+
const $ = n?.props || {}, { title: z, hidden: q = !1, divider: X = !0 } = $;
|
|
188
|
+
return /* @__PURE__ */ E(Ie, { children: [
|
|
189
|
+
(v > 0 || I) && X ? /* @__PURE__ */ o(he, {}) : "",
|
|
190
|
+
/* @__PURE__ */ o(me, { hidden: q, children: /* @__PURE__ */ E(Z, { role: "presentation", children: [
|
|
191
|
+
z && /* @__PURE__ */ o(ye, { title: z, level: v }),
|
|
192
|
+
n?.items.filter((H) => !H.props?.hidden).map((H, e) => {
|
|
193
|
+
const { active: t, onMouseEnter: l } = H, { groupId: K, ...a } = H.props || {}, { expanded: L } = a, U = Array.isArray(a?.items) && a.items.length > 0, J = a.role === "checkbox" || a.role === "radio", ee = d && !J ? "option" : a.role;
|
|
194
|
+
return /* @__PURE__ */ E(
|
|
195
|
+
pe,
|
|
196
|
+
{
|
|
197
|
+
expanded: L,
|
|
198
|
+
onMouseLeave: () => S(-1),
|
|
199
|
+
role: d || J ? "presentation" : void 0,
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ o(
|
|
202
|
+
fe,
|
|
203
|
+
{
|
|
204
|
+
...a,
|
|
205
|
+
size: a?.size || $?.size || p,
|
|
206
|
+
color: a?.color || $?.color || _,
|
|
207
|
+
variant: a?.variant || $?.variant || x,
|
|
208
|
+
active: t,
|
|
209
|
+
role: ee,
|
|
210
|
+
selected: a.selected,
|
|
211
|
+
tabIndex: a?.disabled || g ? -1 : a.tabIndex ?? 0,
|
|
212
|
+
onMouseEnter: l,
|
|
213
|
+
"aria-haspopup": U ? "menu" : void 0,
|
|
214
|
+
"aria-expanded": U ? L : void 0,
|
|
215
|
+
"aria-controls": U ? a.id + "-menu" : void 0
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
L && a?.items && /* @__PURE__ */ o(
|
|
219
|
+
ge,
|
|
220
|
+
{
|
|
221
|
+
id: a.id + "-menu",
|
|
222
|
+
expanded: L,
|
|
223
|
+
level: v + 1,
|
|
224
|
+
maxLevels: b,
|
|
225
|
+
items: a?.items,
|
|
226
|
+
groups: w,
|
|
227
|
+
size: p,
|
|
228
|
+
color: _,
|
|
229
|
+
variant: x
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
e
|
|
235
|
+
);
|
|
236
|
+
})
|
|
237
|
+
] }) }, I)
|
|
238
|
+
] }, I);
|
|
239
|
+
})
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
}, _e = (v) => {
|
|
244
|
+
const b = j(null), B = j(null), [M, u] = Q(0), {
|
|
245
|
+
search: h,
|
|
246
|
+
items: A,
|
|
247
|
+
groups: y = {},
|
|
248
|
+
size: k,
|
|
249
|
+
color: f,
|
|
250
|
+
variant: c,
|
|
251
|
+
keyboardEvents: w,
|
|
252
|
+
scrollRefStyles: p = {},
|
|
253
|
+
id: m,
|
|
254
|
+
expanded: _,
|
|
255
|
+
a11yMode: x = "menu",
|
|
256
|
+
open: r,
|
|
257
|
+
scrollToTopOnOpen: g = !1,
|
|
258
|
+
autoActivateFirstItem: T = !0,
|
|
259
|
+
announceNoResults: N = !1,
|
|
260
|
+
onActiveItemIdChange: d
|
|
261
|
+
} = v, i = x === "combobox", F = i && m ? `${m}-listbox` : m, P = j(r), [R, C] = Q(!1), Y = V(
|
|
262
|
+
() => A.map((e, t) => ({
|
|
263
|
+
...e,
|
|
264
|
+
id: e.id || `${m}-item-${t}`
|
|
265
|
+
})),
|
|
266
|
+
[A, m]
|
|
267
|
+
), { menu: O, activeItem: s, setActiveIndex: S, activeIndex: W } = de({
|
|
268
|
+
items: Y,
|
|
269
|
+
groups: y,
|
|
270
|
+
groupByKey: "groupId",
|
|
271
|
+
keyboardEvents: w,
|
|
272
|
+
autoActivateFirstItem: T,
|
|
273
|
+
ref: b
|
|
274
|
+
}), { flatMenu: n, virtualizer: I, scrollMaxHeight: $ } = be({
|
|
275
|
+
menu: O,
|
|
276
|
+
scrollRef: b
|
|
277
|
+
});
|
|
278
|
+
ne(() => {
|
|
279
|
+
const e = B.current;
|
|
280
|
+
if (!e) return;
|
|
281
|
+
const t = Math.round(e.offsetTop);
|
|
282
|
+
u((l) => l === t ? l : t);
|
|
283
|
+
});
|
|
284
|
+
const z = V(() => {
|
|
285
|
+
const e = s?.id;
|
|
286
|
+
if (e)
|
|
287
|
+
return n.findIndex((l) => l.type === "item" && l.itemProps?.id === e);
|
|
288
|
+
if (W < 0) return -1;
|
|
289
|
+
let t = -1;
|
|
290
|
+
for (let l = 0; l < n.length; l++)
|
|
291
|
+
if (n[l]?.type === "item" && (t += 1, t === W))
|
|
292
|
+
return l;
|
|
293
|
+
return -1;
|
|
294
|
+
}, [s?.id, W, n]), q = j(null);
|
|
295
|
+
ne(() => {
|
|
296
|
+
const e = q?.current, t = typeof e == "number" ? z <= e : !1;
|
|
297
|
+
q.current = z;
|
|
298
|
+
const l = t ? z : z + 2;
|
|
299
|
+
if (!t) {
|
|
300
|
+
const U = I.getOffsetForIndex(l, "auto");
|
|
301
|
+
if (!U) return;
|
|
302
|
+
const [J, ee] = U;
|
|
303
|
+
if (ee === "auto") return;
|
|
304
|
+
I.scrollToOffset(J + M + 10, { align: "start" });
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (z <= 3) {
|
|
308
|
+
I.scrollToOffset(0);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const K = I.getOffsetForIndex(z - 1, "auto");
|
|
312
|
+
if (!K) return;
|
|
313
|
+
const [a, L] = K;
|
|
314
|
+
L !== "auto" && I.scrollToOffset(a + M + 10, { align: "start" });
|
|
315
|
+
}, [z, M, I, q]);
|
|
316
|
+
const X = V(() => {
|
|
317
|
+
const e = /* @__PURE__ */ new Map();
|
|
318
|
+
let t = 0;
|
|
319
|
+
return n.forEach((l, K) => {
|
|
320
|
+
l.type === "item" && (t += 1, e.set(K, t));
|
|
321
|
+
}), { positions: e, total: t };
|
|
322
|
+
}, [n]);
|
|
323
|
+
G(() => {
|
|
324
|
+
d?.(s?.id);
|
|
325
|
+
}, [s?.id, d]), G(() => {
|
|
326
|
+
if (i && N) {
|
|
327
|
+
S(0), C(!0);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
}, [N, i, S]), G(() => {
|
|
331
|
+
if (!g) {
|
|
332
|
+
P.current = r;
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const e = P.current;
|
|
336
|
+
P.current = r, r && !e && b.current?.scrollTo({ top: 0 });
|
|
337
|
+
}, [r, g]);
|
|
338
|
+
const H = {
|
|
339
|
+
position: "relative",
|
|
340
|
+
maxHeight: p?.maxHeight || $,
|
|
341
|
+
margin: "-0.5rem",
|
|
342
|
+
padding: "0.5rem",
|
|
343
|
+
minWidth: p?.minWidth ?? "20rem",
|
|
344
|
+
overflowY: "auto",
|
|
345
|
+
...p
|
|
346
|
+
};
|
|
347
|
+
return /* @__PURE__ */ E(
|
|
348
|
+
Z,
|
|
349
|
+
{
|
|
350
|
+
ref: b,
|
|
351
|
+
style: H,
|
|
352
|
+
variant: c,
|
|
353
|
+
color: f,
|
|
354
|
+
expanded: _,
|
|
355
|
+
id: F,
|
|
356
|
+
role: i ? "listbox" : void 0,
|
|
357
|
+
children: [
|
|
358
|
+
h && /* @__PURE__ */ o(
|
|
359
|
+
xe,
|
|
360
|
+
{
|
|
361
|
+
...h,
|
|
362
|
+
combobox: i,
|
|
363
|
+
listId: F,
|
|
364
|
+
"aria-activedescendant": i && R ? s?.id : void 0,
|
|
365
|
+
onNavigate: i ? () => C(!0) : void 0,
|
|
366
|
+
onChange: (e) => {
|
|
367
|
+
C(!1), h.onChange?.(e);
|
|
368
|
+
},
|
|
369
|
+
onFocus: (e) => {
|
|
370
|
+
C(!1), h.onFocus?.(e);
|
|
371
|
+
},
|
|
372
|
+
onInput: (e) => {
|
|
373
|
+
C(!1), h.onInput?.(e);
|
|
374
|
+
},
|
|
375
|
+
onKeyDown: (e) => {
|
|
376
|
+
const t = e.key === "ArrowUp" || e.key === "ArrowDown", l = e.key.length === 1 || e.key === "Backspace" || e.key === "Delete";
|
|
377
|
+
i && !t && l && C(!1), h.onKeyDown?.(e);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
),
|
|
381
|
+
/* @__PURE__ */ o(
|
|
382
|
+
me,
|
|
383
|
+
{
|
|
384
|
+
ref: B,
|
|
385
|
+
style: {
|
|
386
|
+
position: "relative",
|
|
387
|
+
height: `${I.getTotalSize()}px`,
|
|
388
|
+
width: "100%"
|
|
389
|
+
},
|
|
390
|
+
children: /* @__PURE__ */ o(Z, { style: { width: "100%", minWidth: "100%" }, children: I.getVirtualItems().map((e) => {
|
|
391
|
+
const t = n[e.index];
|
|
392
|
+
if (!t) return null;
|
|
393
|
+
const l = {
|
|
394
|
+
position: "absolute",
|
|
395
|
+
top: 0,
|
|
396
|
+
left: 0,
|
|
397
|
+
width: "100%",
|
|
398
|
+
transform: `translateY(${e.start}px)`
|
|
399
|
+
}, K = {
|
|
400
|
+
style: l,
|
|
401
|
+
index: e.index,
|
|
402
|
+
"data-index": e.index,
|
|
403
|
+
ref: I.measureElement
|
|
404
|
+
};
|
|
405
|
+
switch (t.type) {
|
|
406
|
+
case "divider":
|
|
407
|
+
return /* @__PURE__ */ o(
|
|
408
|
+
he,
|
|
409
|
+
{
|
|
410
|
+
...K,
|
|
411
|
+
style: { ...l, padding: "0.25rem 0" }
|
|
412
|
+
},
|
|
413
|
+
e.key
|
|
414
|
+
);
|
|
415
|
+
case "header":
|
|
416
|
+
return /* @__PURE__ */ o(ye, { ...K, title: t.title || "", level: 1 }, e.key);
|
|
417
|
+
default: {
|
|
418
|
+
const a = t.itemProps?.role === "checkbox" || t.itemProps?.role === "radio", L = i && !a ? "option" : t.itemProps?.role;
|
|
419
|
+
return /* @__PURE__ */ o(
|
|
420
|
+
pe,
|
|
421
|
+
{
|
|
422
|
+
...K,
|
|
423
|
+
role: i || a ? "presentation" : "menuitem",
|
|
424
|
+
children: /* @__PURE__ */ o(
|
|
425
|
+
fe,
|
|
426
|
+
{
|
|
427
|
+
...t.itemProps || {},
|
|
428
|
+
size: t.itemProps?.size || k,
|
|
429
|
+
color: t.itemProps?.color || f,
|
|
430
|
+
variant: t.itemProps?.variant || c,
|
|
431
|
+
active: t.active,
|
|
432
|
+
role: L,
|
|
433
|
+
selected: t.itemProps?.selected,
|
|
434
|
+
"aria-posinset": i ? X.positions.get(e.index) : void 0,
|
|
435
|
+
"aria-setsize": i ? X.total : void 0,
|
|
436
|
+
tabIndex: t.itemProps?.disabled || w ? -1 : 0
|
|
437
|
+
}
|
|
438
|
+
)
|
|
439
|
+
},
|
|
440
|
+
e.key
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}) })
|
|
445
|
+
}
|
|
446
|
+
)
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
);
|
|
450
|
+
}, Me = ({
|
|
451
|
+
searchable: v,
|
|
452
|
+
search: b,
|
|
453
|
+
items: B = [],
|
|
454
|
+
groups: M = {},
|
|
455
|
+
variant: u = "default",
|
|
456
|
+
size: h,
|
|
457
|
+
level: A = 0,
|
|
458
|
+
maxLevels: y = 3,
|
|
459
|
+
virtualized: k = !1,
|
|
460
|
+
keyboardEvents: f = !1,
|
|
461
|
+
scrollRefStyles: c = {},
|
|
462
|
+
onActiveItemIdChange: w,
|
|
463
|
+
a11yMode: p = "menu",
|
|
464
|
+
open: m,
|
|
465
|
+
scrollToTopOnOpen: _,
|
|
466
|
+
autoFocusList: x,
|
|
467
|
+
id: r
|
|
468
|
+
}) => {
|
|
469
|
+
const g = we({ ...b, items: B, groups: M }), T = v ? g.search : b, N = v && g.hasQuery && g.resultCount === 0, d = v ? g.items : B, i = v ? { ...M, ...g.groups } : M, F = p !== "combobox";
|
|
470
|
+
return k ? /* @__PURE__ */ o(
|
|
471
|
+
_e,
|
|
472
|
+
{
|
|
473
|
+
id: r,
|
|
474
|
+
search: T,
|
|
475
|
+
announceNoResults: N,
|
|
476
|
+
items: d,
|
|
477
|
+
groups: i,
|
|
478
|
+
variant: u,
|
|
479
|
+
size: h,
|
|
480
|
+
level: A,
|
|
481
|
+
maxLevels: y,
|
|
482
|
+
keyboardEvents: f,
|
|
483
|
+
scrollRefStyles: c,
|
|
484
|
+
onActiveItemIdChange: w,
|
|
485
|
+
a11yMode: p,
|
|
486
|
+
open: m,
|
|
487
|
+
scrollToTopOnOpen: _,
|
|
488
|
+
autoActivateFirstItem: F,
|
|
489
|
+
autoFocusList: x
|
|
490
|
+
}
|
|
491
|
+
) : /* @__PURE__ */ o(
|
|
492
|
+
ge,
|
|
493
|
+
{
|
|
494
|
+
id: r,
|
|
495
|
+
search: T,
|
|
496
|
+
announceNoResults: N,
|
|
497
|
+
items: d,
|
|
498
|
+
groups: i,
|
|
499
|
+
variant: u,
|
|
500
|
+
size: h,
|
|
501
|
+
level: A,
|
|
502
|
+
maxLevels: y,
|
|
503
|
+
keyboardEvents: f,
|
|
504
|
+
scrollRefStyles: c,
|
|
505
|
+
onActiveItemIdChange: w,
|
|
506
|
+
a11yMode: p,
|
|
507
|
+
open: m,
|
|
508
|
+
scrollToTopOnOpen: _,
|
|
509
|
+
autoActivateFirstItem: F,
|
|
510
|
+
autoFocusList: x
|
|
511
|
+
}
|
|
512
|
+
);
|
|
513
|
+
}, Ae = "_fieldContainer_1986v_1", De = "_field_1986v_1", Be = "_icon_1986v_15", Ne = "_input_1986v_9", Fe = "_clear_1986v_61", Se = "_clearButton_1986v_74", ze = "_autocomplete_1986v_103", D = {
|
|
514
|
+
fieldContainer: Ae,
|
|
515
|
+
field: De,
|
|
516
|
+
icon: Be,
|
|
517
|
+
input: Ne,
|
|
518
|
+
clear: Fe,
|
|
519
|
+
clearButton: Se,
|
|
520
|
+
autocomplete: ze
|
|
521
|
+
}, ue = ({
|
|
522
|
+
className: v,
|
|
523
|
+
collapsible: b,
|
|
524
|
+
loading: B,
|
|
525
|
+
loadingLabel: M = "Loading ...",
|
|
526
|
+
size: u,
|
|
527
|
+
color: h = "neutral",
|
|
528
|
+
label: A,
|
|
529
|
+
value: y,
|
|
530
|
+
onClear: k,
|
|
531
|
+
clearButtonAltText: f = "Clear search",
|
|
532
|
+
menu: c,
|
|
533
|
+
minLength: w,
|
|
534
|
+
...p
|
|
535
|
+
}) => {
|
|
536
|
+
const m = re(), [_, x] = Q(!1), r = p.id || `search-field-${m}`, g = `${r}-listbox`, [T, N] = Q(void 0), d = "searchfield-clear-button-" + re(), i = V(() => !y || typeof w == "number" && typeof y == "string" && y.length < w ? !1 : _, [_, w, y]), F = V(() => (c?.items ?? []).map((s) => ({
|
|
537
|
+
...s,
|
|
538
|
+
onClick: () => {
|
|
539
|
+
s.onClick?.(), x(!1);
|
|
540
|
+
}
|
|
541
|
+
})), [c]), P = (s) => {
|
|
542
|
+
if (s.key === "Enter" && i) {
|
|
543
|
+
c?.items?.[0]?.onClick?.(), x(!1);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (s.key === "Escape" && i) {
|
|
547
|
+
s.preventDefault(), s.stopPropagation(), x(!1), c?.onClose(), document.getElementById(r)?.focus();
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
p.onKeyDown?.(s), x(!0);
|
|
551
|
+
}, R = () => {
|
|
552
|
+
x(!0);
|
|
553
|
+
}, C = (s) => {
|
|
554
|
+
if (!_) return;
|
|
555
|
+
const S = s.relatedTarget;
|
|
556
|
+
S && s.currentTarget.contains(S) || x(!1);
|
|
557
|
+
}, Y = (s) => {
|
|
558
|
+
s.preventDefault();
|
|
559
|
+
}, O = (s) => {
|
|
560
|
+
s.relatedTarget?.id === d && N(void 0), p.onBlur?.(s);
|
|
561
|
+
};
|
|
562
|
+
return c ? /* @__PURE__ */ E("div", { className: D.fieldContainer, children: [
|
|
563
|
+
/* @__PURE__ */ E(
|
|
564
|
+
ae,
|
|
565
|
+
{
|
|
566
|
+
size: u,
|
|
567
|
+
color: h,
|
|
568
|
+
label: A,
|
|
569
|
+
className: oe(D.field, v),
|
|
570
|
+
onBlurCapture: C,
|
|
571
|
+
children: [
|
|
572
|
+
/* @__PURE__ */ o(
|
|
573
|
+
se,
|
|
574
|
+
{
|
|
575
|
+
...p,
|
|
576
|
+
id: r,
|
|
577
|
+
type: "search",
|
|
578
|
+
value: y,
|
|
579
|
+
className: D.input,
|
|
580
|
+
"data-collapsible": b,
|
|
581
|
+
autoCapitalize: "off",
|
|
582
|
+
autoComplete: "off",
|
|
583
|
+
minLength: w,
|
|
584
|
+
onKeyDown: P,
|
|
585
|
+
onBlur: O,
|
|
586
|
+
...c && {
|
|
587
|
+
role: "combobox",
|
|
588
|
+
"aria-autocomplete": "list",
|
|
589
|
+
"aria-expanded": !!i,
|
|
590
|
+
"aria-haspopup": "listbox",
|
|
591
|
+
"aria-controls": g,
|
|
592
|
+
"aria-activedescendant": i ? T : void 0,
|
|
593
|
+
onFocus: R
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
),
|
|
597
|
+
/* @__PURE__ */ o(ce, { className: D.icon }),
|
|
598
|
+
k && !!y && /* @__PURE__ */ o("span", { className: D.clear, children: /* @__PURE__ */ o(
|
|
599
|
+
ie,
|
|
600
|
+
{
|
|
601
|
+
id: d,
|
|
602
|
+
"data-testid": "clear-button",
|
|
603
|
+
size: "xs",
|
|
604
|
+
rounded: !0,
|
|
605
|
+
icon: !0,
|
|
606
|
+
variant: "tinted",
|
|
607
|
+
className: D.clearButton,
|
|
608
|
+
onClick: () => {
|
|
609
|
+
k?.(), document.getElementById(r)?.focus();
|
|
610
|
+
},
|
|
611
|
+
"aria-label": f,
|
|
612
|
+
"data-action": "clear-input",
|
|
613
|
+
children: /* @__PURE__ */ o(le, {})
|
|
614
|
+
}
|
|
615
|
+
) })
|
|
616
|
+
]
|
|
617
|
+
}
|
|
618
|
+
),
|
|
619
|
+
c && i && /* @__PURE__ */ o("div", { className: D.autocomplete, "aria-hidden": !i, onMouseDown: Y, children: /* @__PURE__ */ o(
|
|
620
|
+
Me,
|
|
621
|
+
{
|
|
622
|
+
...c,
|
|
623
|
+
id: g,
|
|
624
|
+
items: F,
|
|
625
|
+
groups: c?.groups,
|
|
626
|
+
keyboardEvents: !0,
|
|
627
|
+
a11yMode: "combobox",
|
|
628
|
+
open: i,
|
|
629
|
+
autoFocusList: !1,
|
|
630
|
+
onActiveItemIdChange: N
|
|
631
|
+
}
|
|
632
|
+
) })
|
|
633
|
+
] }) : /* @__PURE__ */ E(
|
|
634
|
+
ae,
|
|
635
|
+
{
|
|
636
|
+
size: u,
|
|
637
|
+
color: h,
|
|
638
|
+
label: A,
|
|
639
|
+
className: oe(D.field, v),
|
|
640
|
+
onBlurCapture: C,
|
|
641
|
+
children: [
|
|
642
|
+
/* @__PURE__ */ o(
|
|
643
|
+
se,
|
|
644
|
+
{
|
|
645
|
+
...p,
|
|
646
|
+
id: r,
|
|
647
|
+
type: "search",
|
|
648
|
+
value: y,
|
|
649
|
+
className: D.input,
|
|
650
|
+
"data-collapsible": b,
|
|
651
|
+
autoCapitalize: "off",
|
|
652
|
+
autoComplete: "off",
|
|
653
|
+
minLength: w,
|
|
654
|
+
onKeyDown: P,
|
|
655
|
+
onBlur: O
|
|
656
|
+
}
|
|
657
|
+
),
|
|
658
|
+
B ? /* @__PURE__ */ o(ve, { "aria-hidden": !0, className: D.icon }) : /* @__PURE__ */ o(ce, { "aria-hidden": !0, className: D.icon }),
|
|
659
|
+
k && !!y && /* @__PURE__ */ o("span", { className: D.clear, children: /* @__PURE__ */ o(
|
|
660
|
+
ie,
|
|
661
|
+
{
|
|
662
|
+
id: d,
|
|
663
|
+
"data-testid": "clear-button",
|
|
664
|
+
size: "xs",
|
|
665
|
+
rounded: !0,
|
|
666
|
+
icon: !0,
|
|
667
|
+
variant: "tinted",
|
|
668
|
+
className: D.clearButton,
|
|
669
|
+
onClick: () => {
|
|
670
|
+
k?.(), document.getElementById(r)?.focus();
|
|
671
|
+
},
|
|
672
|
+
"aria-label": f,
|
|
673
|
+
"data-action": "clear-input",
|
|
674
|
+
children: /* @__PURE__ */ o(le, {})
|
|
675
|
+
}
|
|
676
|
+
) })
|
|
677
|
+
]
|
|
678
|
+
}
|
|
679
|
+
);
|
|
680
|
+
};
|
|
681
|
+
export {
|
|
682
|
+
Me as M,
|
|
683
|
+
ue as S,
|
|
684
|
+
_e as V,
|
|
685
|
+
ge as a,
|
|
686
|
+
xe as b
|
|
687
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._virtualScrollRef_1ahkg_1{height:100vh;overflow-y:auto;overflow-x:hidden;padding:0 .5rem;margin:0 -.5rem}._virtualList_1ahkg_9{list-style-type:none;padding:0;margin:0;isolation:isolate}._virtualListItem_1ahkg_16{position:absolute;top:0;left:0;width:100%}._virtualListItem_1ahkg_16:focus-within,._virtualListItem_1ahkg_16:has([aria-expanded=true]){z-index:20}._virtualListItem_1ahkg_16>*{margin:0}._lastChild_1ahkg_32{padding-bottom:1rem}._virtualTitleItem_1ahkg_36{position:absolute;top:0;left:0;width:100%;padding-top:1rem;padding-bottom:1rem}._virtualTitleItem_1ahkg_36:first-child{padding-top:0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._search_18jfe_1{position:sticky;top:0;z-index:1;background-color:var(--ds-color-surface-default)}._searchInput_18jfe_8{width:100%}._search_18jfe_1 input:focus-visible{outline-offset:0;outline-width:2px}.
|
|
1
|
+
._search_18jfe_1{position:sticky;top:0;z-index:1;background-color:var(--ds-color-surface-default)}._searchInput_18jfe_8{width:100%}._search_18jfe_1 input:focus-visible{outline-offset:0;outline-width:2px}._fieldContainer_1986v_1,._field_1986v_1{position:relative}._inputContainer_1986v_9{position:relative;display:inline-flex;width:100%}._icon_1986v_15{position:absolute;top:1px;bottom:1px;left:.3em;color:var(--ds-color-text-subtle);font-size:1.25em;width:1.25em;height:1.25em;pointer-events:none!important}._input_1986v_9{padding-left:2.25em;padding-right:2.25em}._input_1986v_9[type=search]::-webkit-search-decoration,._input_1986v_9[type=search]::-webkit-search-cancel-button{appearance:none}._spinnerContainer_1986v_39{position:absolute;top:1px;right:1px;bottom:1px;font-size:1rem;width:2.5em;display:flex;justify-content:center;align-items:center;margin:0}._spinner_1986v_39{width:2rem;height:2rem}._spinner_1986v_39 *{stroke-width:10!important}._clear_1986v_61{position:absolute;top:1px;right:1px;bottom:1px;width:2.5em;height:2.5em;display:flex;justify-content:center;align-items:center;margin:0}._clearButton_1986v_74[data-size=xs]{--dsc-button-size: 2.5em;--dsc-button-padding: 0;font-size:.75em;border:none}._clearButton_1986v_74:focus-visible{outline-offset:0;outline-width:2px}._input_1986v_9[data-collapsible=true]{transition:width .5s ease-in-out}._input_1986v_9[data-collapsible=true]:placeholder-shown{background-color:transparent;width:8rem}._input_1986v_9[data-collapsible=true]:focus,._input_1986v_9[data-collapsible=true]:not(:placeholder-shown){width:auto;background-color:var(--ds-color-background-default)}._autocomplete_1986v_103{--var-min-width: 100%;--var-max-width: 20rem;--var-width: 20rem;min-width:var(--var-min-width);max-width:var(--var-max-width);width:var(--var-width);position:absolute;top:100%;left:0;z-index:1;border-radius:.375rem;margin-top:.5rem;margin-bottom:.5rem;background-color:var(--ds-color-background-default);color:var(--ds-color-text-default);box-shadow:var(--ds-shadow-sm);display:flex;flex-direction:column;row-gap:.5rem;padding:.5rem;white-space:unset}._autocomplete_1986v_103[aria-hidden=true]{display:none}@media(max-width:479px){._fieldContainer_1986v_1,._field_1986v_1{width:100%}._autocomplete_1986v_103{--var-max-width: 100%;--var-width: 100%}._input_1986v_9[data-collapsible=true]:placeholder-shown,._input_1986v_9[data-collapsible=true]:focus,._input_1986v_9[data-collapsible=true]:not(:placeholder-shown){width:100%!important}._field_1986v_1[data-size=xs] input[type=search]{font-size:1rem;padding-left:2em;padding-right:2em}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._typingIcon_16t3v_1{fill:var(--ds-color-border-default)}
|