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