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