@altinn/altinn-components 0.22.7 → 0.23.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.
@@ -0,0 +1 @@
1
+ ._virtualScrollRef_1kwwy_1{max-height:400px;overflow:auto}._virtualMenuListItem_1kwwy_6{position:absolute;top:0;left:0;width:100%}
@@ -1,17 +1,18 @@
1
1
  "use client";
2
- import { jsx as v } from "react/jsx-runtime";
3
- import { useState as y } from "react";
2
+ import { jsx as y } from "react/jsx-runtime";
3
+ import { useState as L } from "react";
4
4
  import "../../index-L8X2o7IH.js";
5
5
  import "../RootProvider/RootProvider.js";
6
6
  import "../Search/AutocompleteBase.js";
7
7
  import "../Snackbar/useSnackbar.js";
8
- import { Menu as L } from "../Menu/Menu.js";
9
- const M = (d) => `${d} hits`, G = ({
8
+ import { Menu as M } from "../Menu/Menu.js";
9
+ const a = (d) => `${d} hits`, R = ({
10
10
  accounts: d = [],
11
11
  accountGroups: C = {},
12
12
  accountSearch: s,
13
13
  onSelectAccount: m,
14
- currentAccount: p
14
+ currentAccount: p,
15
+ isVirtualized: I
15
16
  }) => {
16
17
  var f;
17
18
  const t = d.map((e) => ({
@@ -38,35 +39,36 @@ const M = (d) => `${d} hits`, G = ({
38
39
  badge: e.badge,
39
40
  alertBadge: e.alertBadge,
40
41
  onClick: () => m == null ? void 0 : m(e.id || e.name)
41
- })), [i, g] = y(""), l = i ? t.filter((e) => {
42
+ })), [i, g] = L(""), l = i ? t.filter((e) => {
42
43
  var r;
43
44
  return (r = e == null ? void 0 : e.title) == null ? void 0 : r.toLowerCase().includes(i.toLowerCase());
44
45
  }).map((e) => ({
45
46
  ...e,
46
47
  groupId: "search"
47
- })) : t, I = i ? {
48
+ })) : t, b = i ? {
48
49
  search: {
49
- title: ((f = s == null ? void 0 : s.getResultsLabel) == null ? void 0 : f.call(s, l.length)) ?? M(l.length)
50
+ title: ((f = s == null ? void 0 : s.getResultsLabel) == null ? void 0 : f.call(s, l.length)) ?? a(l.length)
50
51
  }
51
- } : C, b = {
52
+ } : C, h = {
52
53
  name: "account-search",
53
54
  value: i,
54
55
  placeholder: (s == null ? void 0 : s.placeholder) ?? "Find account",
55
56
  onChange: (e) => g(e.target.value),
56
57
  onClear: () => g("")
57
- }, h = [
58
+ }, v = [
58
59
  ...l.length > 0 ? l : [{ id: "search", groupId: "search", hidden: !0 }]
59
60
  ];
60
- return /* @__PURE__ */ v(
61
- L,
61
+ return /* @__PURE__ */ y(
62
+ M,
62
63
  {
63
64
  theme: "default",
64
- search: s && b,
65
- groups: I,
66
- items: h
65
+ search: s && h,
66
+ groups: b,
67
+ items: v,
68
+ isVirtualized: I
67
69
  }
68
70
  );
69
71
  };
70
72
  export {
71
- G as AccountMenu
73
+ R as AccountMenu
72
74
  };
@@ -1,28 +1,41 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { MenuBase as f } from "./MenuBase.js";
3
- import { MenuItems as M } from "./MenuItems.js";
4
- const d = ({
5
- color: e,
6
- theme: o,
7
- defaultItemColor: m,
8
- defaultItemTheme: t,
9
- defaultItemSize: n,
10
- defaultIconTheme: i,
11
- groups: p,
12
- items: s = [],
13
- search: u
14
- }) => /* @__PURE__ */ r(f, { color: e, theme: o, children: /* @__PURE__ */ r(
15
- M,
2
+ import { MenuBase as x } from "./MenuBase.js";
3
+ import { MenuItems as j } from "./MenuItems.js";
4
+ import { MenuItemsVirtual as B } from "./MenuItemsVirtual.js";
5
+ const q = ({
6
+ color: n,
7
+ theme: i,
8
+ defaultItemColor: o,
9
+ defaultItemTheme: p,
10
+ defaultItemSize: M,
11
+ defaultIconTheme: m,
12
+ groups: s,
13
+ items: t = [],
14
+ search: u,
15
+ isVirtualized: f
16
+ }) => f ? /* @__PURE__ */ r(x, { color: n, theme: i, children: /* @__PURE__ */ r(
17
+ B,
16
18
  {
17
19
  search: u,
18
- items: s,
19
- groups: p,
20
- defaultItemSize: n,
21
- defaultItemColor: m,
22
- defaultItemTheme: t,
23
- defaultIconTheme: i
20
+ items: t,
21
+ groups: s,
22
+ defaultItemSize: M,
23
+ defaultItemColor: o,
24
+ defaultItemTheme: p,
25
+ defaultIconTheme: m
26
+ }
27
+ ) }) : /* @__PURE__ */ r(x, { color: n, theme: i, children: /* @__PURE__ */ r(
28
+ j,
29
+ {
30
+ search: u,
31
+ items: t,
32
+ groups: s,
33
+ defaultItemSize: M,
34
+ defaultItemColor: o,
35
+ defaultItemTheme: p,
36
+ defaultIconTheme: m
24
37
  }
25
38
  ) });
26
39
  export {
27
- d as Menu
40
+ q as Menu
28
41
  };
@@ -1,12 +1,19 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
2
  import { c as a } from "../../index-L8X2o7IH.js";
3
- import '../../assets/MenuBase.css';const i = "_menu_njba2_1", r = "_list_njba2_13", u = "_item_njba2_19", c = {
4
- menu: i,
5
- list: r,
6
- item: u
7
- }, C = ({ as: t = "nav", color: n, theme: e, className: o, children: s }) => /* @__PURE__ */ m(t, { className: a(c.menu, o), "data-color": n, "data-theme": e, children: s }), j = ({ as: t = "ul", role: n = "group", className: e, children: o }) => /* @__PURE__ */ m(t, { className: a(c.list, e), role: n, children: o }), b = ({ as: t = "li", role: n = "presentation", className: e, children: o }) => /* @__PURE__ */ m(t, { className: a(c.item, e), role: n, children: o });
3
+ import '../../assets/MenuBase.css';const r = "_menu_njba2_1", u = "_list_njba2_13", l = "_item_njba2_19", c = {
4
+ menu: r,
5
+ list: u,
6
+ item: l
7
+ }, d = ({ as: t = "nav", color: n, theme: e, className: o, children: s }) => /* @__PURE__ */ m(t, { className: a(c.menu, o), "data-color": n, "data-theme": e, children: s }), j = ({ as: t = "ul", role: n = "group", className: e, children: o }) => /* @__PURE__ */ m(t, { className: a(c.list, e), role: n, children: o }), x = ({
8
+ as: t = "li",
9
+ role: n = "presentation",
10
+ className: e,
11
+ children: o,
12
+ style: s,
13
+ dataIndex: i
14
+ }) => /* @__PURE__ */ m(t, { className: a(c.item, e), role: n, style: s, "data-index": i, children: o });
8
15
  export {
9
- C as MenuBase,
16
+ d as MenuBase,
10
17
  j as MenuList,
11
- b as MenuListItem
18
+ x as MenuListItem
12
19
  };
@@ -0,0 +1,636 @@
1
+ "use client";
2
+ import { jsxs as w, jsx as E } from "react/jsx-runtime";
3
+ import * as S from "react";
4
+ import { useRef as k, useEffect as A } from "react";
5
+ import { flushSync as N } from "react-dom";
6
+ import "../../index-L8X2o7IH.js";
7
+ import { useMenu as F } from "../../hooks/useMenu.js";
8
+ import "../RootProvider/RootProvider.js";
9
+ import { MenuItem as P } from "./MenuItem.js";
10
+ import { MenuSearch as V } from "./MenuSearch.js";
11
+ import { MenuHeader as L } from "./MenuHeader.js";
12
+ import { MenuList as W, MenuListItem as j } from "./MenuBase.js";
13
+ import "../Search/AutocompleteBase.js";
14
+ import "../Snackbar/useSnackbar.js";
15
+ import '../../assets/MenuItemsVirtual.css';function x(r, l, e) {
16
+ let s = e.initialDeps ?? [], t;
17
+ function n() {
18
+ var i, o, h, u;
19
+ let a;
20
+ e.key && ((i = e.debug) != null && i.call(e)) && (a = Date.now());
21
+ const f = r();
22
+ if (!(f.length !== s.length || f.some((c, p) => s[p] !== c)))
23
+ return t;
24
+ s = f;
25
+ let d;
26
+ if (e.key && ((o = e.debug) != null && o.call(e)) && (d = Date.now()), t = l(...f), e.key && ((h = e.debug) != null && h.call(e))) {
27
+ const c = Math.round((Date.now() - a) * 100) / 100, p = Math.round((Date.now() - d) * 100) / 100, v = p / 16, y = (g, b) => {
28
+ for (g = String(g); g.length < b; )
29
+ g = " " + g;
30
+ return g;
31
+ };
32
+ console.info(
33
+ `%c⏱ ${y(p, 5)} /${y(c, 5)} ms`,
34
+ `
35
+ font-size: .6rem;
36
+ font-weight: bold;
37
+ color: hsl(${Math.max(
38
+ 0,
39
+ Math.min(120 - 120 * v, 120)
40
+ )}deg 100% 31%);`,
41
+ e == null ? void 0 : e.key
42
+ );
43
+ }
44
+ return (u = e == null ? void 0 : e.onChange) == null || u.call(e, t), t;
45
+ }
46
+ return n.updateDeps = (i) => {
47
+ s = i;
48
+ }, n;
49
+ }
50
+ function I(r, l) {
51
+ if (r === void 0)
52
+ throw new Error("Unexpected undefined");
53
+ return r;
54
+ }
55
+ const B = (r, l) => Math.abs(r - l) < 1, $ = (r, l, e) => {
56
+ let s;
57
+ return function(...t) {
58
+ r.clearTimeout(s), s = r.setTimeout(() => l.apply(this, t), e);
59
+ };
60
+ }, K = (r) => r, q = (r) => {
61
+ const l = Math.max(r.startIndex - r.overscan, 0), e = Math.min(r.endIndex + r.overscan, r.count - 1), s = [];
62
+ for (let t = l; t <= e; t++)
63
+ s.push(t);
64
+ return s;
65
+ }, H = (r, l) => {
66
+ const e = r.scrollElement;
67
+ if (!e)
68
+ return;
69
+ const s = r.targetWindow;
70
+ if (!s)
71
+ return;
72
+ const t = (i) => {
73
+ const { width: o, height: h } = i;
74
+ l({ width: Math.round(o), height: Math.round(h) });
75
+ };
76
+ if (t(e.getBoundingClientRect()), !s.ResizeObserver)
77
+ return () => {
78
+ };
79
+ const n = new s.ResizeObserver((i) => {
80
+ const o = () => {
81
+ const h = i[0];
82
+ if (h != null && h.borderBoxSize) {
83
+ const u = h.borderBoxSize[0];
84
+ if (u) {
85
+ t({ width: u.inlineSize, height: u.blockSize });
86
+ return;
87
+ }
88
+ }
89
+ t(e.getBoundingClientRect());
90
+ };
91
+ r.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(o) : o();
92
+ });
93
+ return n.observe(e, { box: "border-box" }), () => {
94
+ n.unobserve(e);
95
+ };
96
+ }, C = {
97
+ passive: !0
98
+ }, T = typeof window > "u" ? !0 : "onscrollend" in window, U = (r, l) => {
99
+ const e = r.scrollElement;
100
+ if (!e)
101
+ return;
102
+ const s = r.targetWindow;
103
+ if (!s)
104
+ return;
105
+ let t = 0;
106
+ const n = r.options.useScrollendEvent && T ? () => {
107
+ } : $(
108
+ s,
109
+ () => {
110
+ l(t, !1);
111
+ },
112
+ r.options.isScrollingResetDelay
113
+ ), i = (a) => () => {
114
+ const { horizontal: f, isRtl: m } = r.options;
115
+ t = f ? e.scrollLeft * (m && -1 || 1) : e.scrollTop, n(), l(t, a);
116
+ }, o = i(!0), h = i(!1);
117
+ h(), e.addEventListener("scroll", o, C);
118
+ const u = r.options.useScrollendEvent && T;
119
+ return u && e.addEventListener("scrollend", h, C), () => {
120
+ e.removeEventListener("scroll", o), u && e.removeEventListener("scrollend", h);
121
+ };
122
+ }, Y = (r, l, e) => {
123
+ if (l != null && l.borderBoxSize) {
124
+ const s = l.borderBoxSize[0];
125
+ if (s)
126
+ return Math.round(
127
+ s[e.options.horizontal ? "inlineSize" : "blockSize"]
128
+ );
129
+ }
130
+ return Math.round(
131
+ r.getBoundingClientRect()[e.options.horizontal ? "width" : "height"]
132
+ );
133
+ }, G = (r, {
134
+ adjustments: l = 0,
135
+ behavior: e
136
+ }, s) => {
137
+ var t, n;
138
+ const i = r + l;
139
+ (n = (t = s.scrollElement) == null ? void 0 : t.scrollTo) == null || n.call(t, {
140
+ [s.options.horizontal ? "left" : "top"]: i,
141
+ behavior: e
142
+ });
143
+ };
144
+ class J {
145
+ constructor(l) {
146
+ this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollToIndexTimeoutId = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
147
+ let e = null;
148
+ const s = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((t) => {
149
+ t.forEach((n) => {
150
+ const i = () => {
151
+ this._measureElement(n.target, n);
152
+ };
153
+ this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(i) : i();
154
+ });
155
+ }));
156
+ return {
157
+ disconnect: () => {
158
+ var t;
159
+ (t = s()) == null || t.disconnect(), e = null;
160
+ },
161
+ observe: (t) => {
162
+ var n;
163
+ return (n = s()) == null ? void 0 : n.observe(t, { box: "border-box" });
164
+ },
165
+ unobserve: (t) => {
166
+ var n;
167
+ return (n = s()) == null ? void 0 : n.unobserve(t);
168
+ }
169
+ };
170
+ })(), this.range = null, this.setOptions = (e) => {
171
+ Object.entries(e).forEach(([s, t]) => {
172
+ typeof t > "u" && delete e[s];
173
+ }), this.options = {
174
+ debug: !1,
175
+ initialOffset: 0,
176
+ overscan: 1,
177
+ paddingStart: 0,
178
+ paddingEnd: 0,
179
+ scrollPaddingStart: 0,
180
+ scrollPaddingEnd: 0,
181
+ horizontal: !1,
182
+ getItemKey: K,
183
+ rangeExtractor: q,
184
+ onChange: () => {
185
+ },
186
+ measureElement: Y,
187
+ initialRect: { width: 0, height: 0 },
188
+ scrollMargin: 0,
189
+ gap: 0,
190
+ indexAttribute: "data-index",
191
+ initialMeasurementsCache: [],
192
+ lanes: 1,
193
+ isScrollingResetDelay: 150,
194
+ enabled: !0,
195
+ isRtl: !1,
196
+ useScrollendEvent: !1,
197
+ useAnimationFrameWithResizeObserver: !1,
198
+ ...e
199
+ };
200
+ }, this.notify = (e) => {
201
+ var s, t;
202
+ (t = (s = this.options).onChange) == null || t.call(s, this, e);
203
+ }, this.maybeNotify = x(
204
+ () => (this.calculateRange(), [
205
+ this.isScrolling,
206
+ this.range ? this.range.startIndex : null,
207
+ this.range ? this.range.endIndex : null
208
+ ]),
209
+ (e) => {
210
+ this.notify(e);
211
+ },
212
+ {
213
+ key: process.env.NODE_ENV !== "production" && "maybeNotify",
214
+ debug: () => this.options.debug,
215
+ initialDeps: [
216
+ this.isScrolling,
217
+ this.range ? this.range.startIndex : null,
218
+ this.range ? this.range.endIndex : null
219
+ ]
220
+ }
221
+ ), this.cleanup = () => {
222
+ this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.observer.disconnect(), this.scrollElement = null, this.targetWindow = null;
223
+ }, this._didMount = () => () => {
224
+ this.cleanup();
225
+ }, this._willUpdate = () => {
226
+ var e;
227
+ const s = this.options.enabled ? this.options.getScrollElement() : null;
228
+ if (this.scrollElement !== s) {
229
+ if (this.cleanup(), !s) {
230
+ this.maybeNotify();
231
+ return;
232
+ }
233
+ this.scrollElement = s, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((e = this.scrollElement) == null ? void 0 : e.window) ?? null, this.elementsCache.forEach((t) => {
234
+ this.observer.observe(t);
235
+ }), this._scrollToOffset(this.getScrollOffset(), {
236
+ adjustments: void 0,
237
+ behavior: void 0
238
+ }), this.unsubs.push(
239
+ this.options.observeElementRect(this, (t) => {
240
+ this.scrollRect = t, this.maybeNotify();
241
+ })
242
+ ), this.unsubs.push(
243
+ this.options.observeElementOffset(this, (t, n) => {
244
+ this.scrollAdjustments = 0, this.scrollDirection = n ? this.getScrollOffset() < t ? "forward" : "backward" : null, this.scrollOffset = t, this.isScrolling = n, this.maybeNotify();
245
+ })
246
+ );
247
+ }
248
+ }, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, s) => {
249
+ const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
250
+ for (let i = s - 1; i >= 0; i--) {
251
+ const o = e[i];
252
+ if (t.has(o.lane))
253
+ continue;
254
+ const h = n.get(
255
+ o.lane
256
+ );
257
+ if (h == null || o.end > h.end ? n.set(o.lane, o) : o.end < h.end && t.set(o.lane, !0), t.size === this.options.lanes)
258
+ break;
259
+ }
260
+ return n.size === this.options.lanes ? Array.from(n.values()).sort((i, o) => i.end === o.end ? i.index - o.index : i.end - o.end)[0] : void 0;
261
+ }, this.getMeasurementOptions = x(
262
+ () => [
263
+ this.options.count,
264
+ this.options.paddingStart,
265
+ this.options.scrollMargin,
266
+ this.options.getItemKey,
267
+ this.options.enabled
268
+ ],
269
+ (e, s, t, n, i) => (this.pendingMeasuredCacheIndexes = [], {
270
+ count: e,
271
+ paddingStart: s,
272
+ scrollMargin: t,
273
+ getItemKey: n,
274
+ enabled: i
275
+ }),
276
+ {
277
+ key: !1
278
+ }
279
+ ), this.getMeasurements = x(
280
+ () => [this.getMeasurementOptions(), this.itemSizeCache],
281
+ ({ count: e, paddingStart: s, scrollMargin: t, getItemKey: n, enabled: i }, o) => {
282
+ if (!i)
283
+ return this.measurementsCache = [], this.itemSizeCache.clear(), [];
284
+ this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((a) => {
285
+ this.itemSizeCache.set(a.key, a.size);
286
+ }));
287
+ const h = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
288
+ this.pendingMeasuredCacheIndexes = [];
289
+ const u = this.measurementsCache.slice(0, h);
290
+ for (let a = h; a < e; a++) {
291
+ const f = n(a), m = this.options.lanes === 1 ? u[a - 1] : this.getFurthestMeasurement(u, a), d = m ? m.end + this.options.gap : s + t, c = o.get(f), p = typeof c == "number" ? c : this.options.estimateSize(a), v = d + p, y = m ? m.lane : a % this.options.lanes;
292
+ u[a] = {
293
+ index: a,
294
+ start: d,
295
+ size: p,
296
+ end: v,
297
+ key: f,
298
+ lane: y
299
+ };
300
+ }
301
+ return this.measurementsCache = u, u;
302
+ },
303
+ {
304
+ key: process.env.NODE_ENV !== "production" && "getMeasurements",
305
+ debug: () => this.options.debug
306
+ }
307
+ ), this.calculateRange = x(
308
+ () => [
309
+ this.getMeasurements(),
310
+ this.getSize(),
311
+ this.getScrollOffset(),
312
+ this.options.lanes
313
+ ],
314
+ (e, s, t, n) => this.range = e.length > 0 && s > 0 ? Q({
315
+ measurements: e,
316
+ outerSize: s,
317
+ scrollOffset: t,
318
+ lanes: n
319
+ }) : null,
320
+ {
321
+ key: process.env.NODE_ENV !== "production" && "calculateRange",
322
+ debug: () => this.options.debug
323
+ }
324
+ ), this.getVirtualIndexes = x(
325
+ () => {
326
+ let e = null, s = null;
327
+ const t = this.calculateRange();
328
+ return t && (e = t.startIndex, s = t.endIndex), this.maybeNotify.updateDeps([this.isScrolling, e, s]), [
329
+ this.options.rangeExtractor,
330
+ this.options.overscan,
331
+ this.options.count,
332
+ e,
333
+ s
334
+ ];
335
+ },
336
+ (e, s, t, n, i) => n === null || i === null ? [] : e({
337
+ startIndex: n,
338
+ endIndex: i,
339
+ overscan: s,
340
+ count: t
341
+ }),
342
+ {
343
+ key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
344
+ debug: () => this.options.debug
345
+ }
346
+ ), this.indexFromElement = (e) => {
347
+ const s = this.options.indexAttribute, t = e.getAttribute(s);
348
+ return t ? parseInt(t, 10) : (console.warn(
349
+ `Missing attribute name '${s}={index}' on measured element.`
350
+ ), -1);
351
+ }, this._measureElement = (e, s) => {
352
+ const t = this.indexFromElement(e), n = this.measurementsCache[t];
353
+ if (!n)
354
+ return;
355
+ const i = n.key, o = this.elementsCache.get(i);
356
+ o !== e && (o && this.observer.unobserve(o), this.observer.observe(e), this.elementsCache.set(i, e)), e.isConnected && this.resizeItem(t, this.options.measureElement(e, s, this));
357
+ }, this.resizeItem = (e, s) => {
358
+ const t = this.measurementsCache[e];
359
+ if (!t)
360
+ return;
361
+ const n = this.itemSizeCache.get(t.key) ?? t.size, i = s - n;
362
+ i !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(t, i, this) : t.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", i), this._scrollToOffset(this.getScrollOffset(), {
363
+ adjustments: this.scrollAdjustments += i,
364
+ behavior: void 0
365
+ })), this.pendingMeasuredCacheIndexes.push(t.index), this.itemSizeCache = new Map(this.itemSizeCache.set(t.key, s)), this.notify(!1));
366
+ }, this.measureElement = (e) => {
367
+ if (!e) {
368
+ this.elementsCache.forEach((s, t) => {
369
+ s.isConnected || (this.observer.unobserve(s), this.elementsCache.delete(t));
370
+ });
371
+ return;
372
+ }
373
+ this._measureElement(e, void 0);
374
+ }, this.getVirtualItems = x(
375
+ () => [this.getVirtualIndexes(), this.getMeasurements()],
376
+ (e, s) => {
377
+ const t = [];
378
+ for (let n = 0, i = e.length; n < i; n++) {
379
+ const o = e[n], h = s[o];
380
+ t.push(h);
381
+ }
382
+ return t;
383
+ },
384
+ {
385
+ key: process.env.NODE_ENV !== "production" && "getVirtualItems",
386
+ debug: () => this.options.debug
387
+ }
388
+ ), this.getVirtualItemForOffset = (e) => {
389
+ const s = this.getMeasurements();
390
+ if (s.length !== 0)
391
+ return I(
392
+ s[D(
393
+ 0,
394
+ s.length - 1,
395
+ (t) => I(s[t]).start,
396
+ e
397
+ )]
398
+ );
399
+ }, this.getOffsetForAlignment = (e, s, t = 0) => {
400
+ const n = this.getSize(), i = this.getScrollOffset();
401
+ s === "auto" && (s = e >= i + n ? "end" : "start"), s === "center" ? e += (t - n) / 2 : s === "end" && (e -= n);
402
+ const o = this.options.horizontal ? "scrollWidth" : "scrollHeight", u = (this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[o] : this.scrollElement[o] : 0) - n;
403
+ return Math.max(Math.min(u, e), 0);
404
+ }, this.getOffsetForIndex = (e, s = "auto") => {
405
+ e = Math.max(0, Math.min(e, this.options.count - 1));
406
+ const t = this.measurementsCache[e];
407
+ if (!t)
408
+ return;
409
+ const n = this.getSize(), i = this.getScrollOffset();
410
+ if (s === "auto")
411
+ if (t.end >= i + n - this.options.scrollPaddingEnd)
412
+ s = "end";
413
+ else if (t.start <= i + this.options.scrollPaddingStart)
414
+ s = "start";
415
+ else
416
+ return [i, s];
417
+ const o = s === "end" ? t.end + this.options.scrollPaddingEnd : t.start - this.options.scrollPaddingStart;
418
+ return [
419
+ this.getOffsetForAlignment(o, s, t.size),
420
+ s
421
+ ];
422
+ }, this.isDynamicMode = () => this.elementsCache.size > 0, this.cancelScrollToIndex = () => {
423
+ this.scrollToIndexTimeoutId !== null && this.targetWindow && (this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId), this.scrollToIndexTimeoutId = null);
424
+ }, this.scrollToOffset = (e, { align: s = "start", behavior: t } = {}) => {
425
+ this.cancelScrollToIndex(), t === "smooth" && this.isDynamicMode() && console.warn(
426
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
427
+ ), this._scrollToOffset(this.getOffsetForAlignment(e, s), {
428
+ adjustments: void 0,
429
+ behavior: t
430
+ });
431
+ }, this.scrollToIndex = (e, { align: s = "auto", behavior: t } = {}) => {
432
+ e = Math.max(0, Math.min(e, this.options.count - 1)), this.cancelScrollToIndex(), t === "smooth" && this.isDynamicMode() && console.warn(
433
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
434
+ );
435
+ const n = this.getOffsetForIndex(e, s);
436
+ if (!n) return;
437
+ const [i, o] = n;
438
+ this._scrollToOffset(i, { adjustments: void 0, behavior: t }), t !== "smooth" && this.isDynamicMode() && this.targetWindow && (this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
439
+ if (this.scrollToIndexTimeoutId = null, this.elementsCache.has(
440
+ this.options.getItemKey(e)
441
+ )) {
442
+ const [u] = I(
443
+ this.getOffsetForIndex(e, o)
444
+ );
445
+ B(u, this.getScrollOffset()) || this.scrollToIndex(e, { align: o, behavior: t });
446
+ } else
447
+ this.scrollToIndex(e, { align: o, behavior: t });
448
+ }));
449
+ }, this.scrollBy = (e, { behavior: s } = {}) => {
450
+ this.cancelScrollToIndex(), s === "smooth" && this.isDynamicMode() && console.warn(
451
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
452
+ ), this._scrollToOffset(this.getScrollOffset() + e, {
453
+ adjustments: void 0,
454
+ behavior: s
455
+ });
456
+ }, this.getTotalSize = () => {
457
+ var e;
458
+ const s = this.getMeasurements();
459
+ let t;
460
+ if (s.length === 0)
461
+ t = this.options.paddingStart;
462
+ else if (this.options.lanes === 1)
463
+ t = ((e = s[s.length - 1]) == null ? void 0 : e.end) ?? 0;
464
+ else {
465
+ const n = Array(this.options.lanes).fill(null);
466
+ let i = s.length - 1;
467
+ for (; i > 0 && n.some((o) => o === null); ) {
468
+ const o = s[i];
469
+ n[o.lane] === null && (n[o.lane] = o.end), i--;
470
+ }
471
+ t = Math.max(...n.filter((o) => o !== null));
472
+ }
473
+ return Math.max(
474
+ t - this.options.scrollMargin + this.options.paddingEnd,
475
+ 0
476
+ );
477
+ }, this._scrollToOffset = (e, {
478
+ adjustments: s,
479
+ behavior: t
480
+ }) => {
481
+ this.options.scrollToFn(e, { behavior: t, adjustments: s }, this);
482
+ }, this.measure = () => {
483
+ this.itemSizeCache = /* @__PURE__ */ new Map(), this.notify(!1);
484
+ }, this.setOptions(l);
485
+ }
486
+ }
487
+ const D = (r, l, e, s) => {
488
+ for (; r <= l; ) {
489
+ const t = (r + l) / 2 | 0, n = e(t);
490
+ if (n < s)
491
+ r = t + 1;
492
+ else if (n > s)
493
+ l = t - 1;
494
+ else
495
+ return t;
496
+ }
497
+ return r > 0 ? r - 1 : 0;
498
+ };
499
+ function Q({
500
+ measurements: r,
501
+ outerSize: l,
502
+ scrollOffset: e,
503
+ lanes: s
504
+ }) {
505
+ const t = r.length - 1;
506
+ let i = D(
507
+ 0,
508
+ t,
509
+ (h) => r[h].start,
510
+ e
511
+ ), o = i;
512
+ if (s === 1)
513
+ for (; o < t && r[o].end < e + l; )
514
+ o++;
515
+ else if (s > 1) {
516
+ const h = Array(s).fill(0);
517
+ for (; o < t && h.some((a) => a < e + l); ) {
518
+ const a = r[o];
519
+ h[a.lane] = a.end, o++;
520
+ }
521
+ const u = Array(s).fill(e + l);
522
+ for (; i > 0 && u.some((a) => a >= e); ) {
523
+ const a = r[i];
524
+ u[a.lane] = a.start, i--;
525
+ }
526
+ i = Math.max(0, i - i % s), o = Math.min(t, o + (s - 1 - o % s));
527
+ }
528
+ return { startIndex: i, endIndex: o };
529
+ }
530
+ const _ = typeof document < "u" ? S.useLayoutEffect : S.useEffect;
531
+ function X(r) {
532
+ const l = S.useReducer(() => ({}), {})[1], e = {
533
+ ...r,
534
+ onChange: (t, n) => {
535
+ var i;
536
+ n ? N(l) : l(), (i = r.onChange) == null || i.call(r, t, n);
537
+ }
538
+ }, [s] = S.useState(
539
+ () => new J(e)
540
+ );
541
+ return s.setOptions(e), _(() => s._didMount(), []), _(() => s._willUpdate()), s;
542
+ }
543
+ function Z(r) {
544
+ return X({
545
+ observeElementRect: H,
546
+ observeElementOffset: U,
547
+ scrollToFn: G,
548
+ ...r
549
+ });
550
+ }
551
+ const ee = "_virtualScrollRef_1kwwy_1", te = "_virtualMenuListItem_1kwwy_6", R = {
552
+ virtualScrollRef: ee,
553
+ virtualMenuListItem: te
554
+ }, me = ({
555
+ level: r = 0,
556
+ search: l,
557
+ items: e,
558
+ groups: s = {},
559
+ defaultItemSize: t,
560
+ defaultItemColor: n,
561
+ defaultItemTheme: i,
562
+ defaultIconTheme: o
563
+ }) => {
564
+ const { menu: h } = F({
565
+ items: e,
566
+ groups: s,
567
+ groupByKey: "groupId",
568
+ keyboardEvents: !1
569
+ }), u = k(null), a = h.flatMap((d, c) => {
570
+ var g;
571
+ const p = (d == null ? void 0 : d.props) || {}, { title: v } = p, y = ((g = d == null ? void 0 : d.items) == null ? void 0 : g.filter((b) => {
572
+ var M;
573
+ return !((M = b.props) != null && M.hidden);
574
+ })) || [];
575
+ return [
576
+ ...c > 0 || r > 0 ? [{ type: "separator" }] : [],
577
+ ...v ? [{ type: "title", title: v }] : [],
578
+ ...y.map((b, M) => {
579
+ var z, O;
580
+ return {
581
+ type: "item",
582
+ itemProps: b.props || {},
583
+ active: b.active,
584
+ hasChildren: ((z = b.props) == null ? void 0 : z.expanded) && ((O = b.props) == null ? void 0 : O.items),
585
+ isLastItem: M === y.length - 1
586
+ };
587
+ })
588
+ ];
589
+ }), f = Z({
590
+ count: a.length,
591
+ estimateSize: (d) => {
592
+ const c = a[d];
593
+ return c ? c.type === "title" ? 44 : c.type === "separator" ? 1 : 44 : 0;
594
+ },
595
+ getScrollElement: () => u.current
596
+ }), m = f.getVirtualItems();
597
+ return A(() => {
598
+ for (const d of m) {
599
+ const c = document.querySelector(`[data-index="${d.index}"]`);
600
+ c && f.measureElement(c);
601
+ }
602
+ }, [m]), /* @__PURE__ */ w(W, { children: [
603
+ l && /* @__PURE__ */ E(V, { ...l }),
604
+ /* @__PURE__ */ E("div", { ref: u, className: R.virtualScrollRef, children: /* @__PURE__ */ E("div", { style: { position: "relative", height: `${f.getTotalSize()}px` }, children: m.map((d) => {
605
+ const c = a[d.index];
606
+ return c ? /* @__PURE__ */ w(
607
+ j,
608
+ {
609
+ dataIndex: d.index,
610
+ className: R.virtualMenuListItem,
611
+ style: { transform: `translateY(${d.start}px)` },
612
+ role: c.type === "separator" ? "separator" : void 0,
613
+ children: [
614
+ c.type === "title" && /* @__PURE__ */ E(L, { title: c.title }),
615
+ c.type === "item" && /* @__PURE__ */ E(
616
+ P,
617
+ {
618
+ ...c.itemProps,
619
+ size: c.itemProps.size || t,
620
+ color: c.itemProps.color || n,
621
+ theme: c.itemProps.theme || i,
622
+ iconTheme: c.itemProps.iconTheme || o,
623
+ active: c.active,
624
+ tabIndex: c.itemProps.disabled ? -1 : 0
625
+ }
626
+ )
627
+ ]
628
+ },
629
+ d.key
630
+ ) : null;
631
+ }) }) })
632
+ ] });
633
+ };
634
+ export {
635
+ me as MenuItemsVirtual
636
+ };
@@ -14,18 +14,18 @@ import '../../assets/MenuSearch.css';const f = "_field_8g6tu_1", _ = "_icon_8g6t
14
14
  input: g,
15
15
  clear: d
16
16
  }, I = ({
17
- value: c,
17
+ value: i,
18
18
  name: r,
19
19
  placeholder: s = "Search",
20
20
  clearButtonAltText: e = "Clear search",
21
21
  onChange: n,
22
- onClear: i
22
+ onClear: c
23
23
  }) => /* @__PURE__ */ a("div", { className: t.field, children: [
24
24
  /* @__PURE__ */ o(
25
25
  "input",
26
26
  {
27
27
  type: "search",
28
- value: c,
28
+ value: i,
29
29
  name: r,
30
30
  placeholder: s,
31
31
  className: t.input,
@@ -34,14 +34,14 @@ import '../../assets/MenuSearch.css';const f = "_field_8g6tu_1", _ = "_icon_8g6t
34
34
  }
35
35
  ),
36
36
  /* @__PURE__ */ o(m, { svgElement: p, className: t.icon }),
37
- i && /* @__PURE__ */ o(
37
+ c && !!i && /* @__PURE__ */ o(
38
38
  l,
39
39
  {
40
40
  icon: u,
41
41
  variant: "solid",
42
42
  size: "custom",
43
43
  className: t.clear,
44
- onClick: i,
44
+ onClick: c,
45
45
  iconAltText: e
46
46
  }
47
47
  )
@@ -1,28 +1,29 @@
1
- import { jsxs as f, jsx as m } from "react/jsx-runtime";
1
+ import { jsxs as f, jsx as p } from "react/jsx-runtime";
2
+ import { createElement as n } from "react";
2
3
  import "../../index-L8X2o7IH.js";
3
- import "react";
4
- import { useRootContext as n } from "../RootProvider/RootProvider.js";
5
- import { DrawerOrDropdown as x } from "../Dropdown/DrawerOrDropdown.js";
6
- import { AccountMenu as T } from "../GlobalMenu/AccountMenu.js";
4
+ import { useRootContext as x } from "../RootProvider/RootProvider.js";
5
+ import { DrawerOrDropdown as T } from "../Dropdown/DrawerOrDropdown.js";
6
+ import { AccountMenu as b } from "../GlobalMenu/AccountMenu.js";
7
7
  import "../Search/AutocompleteBase.js";
8
8
  import "../Snackbar/useSnackbar.js";
9
- import { ToolbarButton as b } from "./ToolbarButton.js";
10
- import { ToolbarFilterBase as g } from "./ToolbarFilterBase.js";
11
- const y = ({
9
+ import { ToolbarButton as g } from "./ToolbarButton.js";
10
+ import { ToolbarFilterBase as h } from "./ToolbarFilterBase.js";
11
+ const v = ({
12
12
  currentAccount: o,
13
- id: i = "toolbar-accounts",
13
+ id: e = "toolbar-accounts",
14
14
  onSelectAccount: r,
15
- ...e
15
+ ...l
16
16
  }) => {
17
- const { currentId: s, toggleId: l, closeAll: p } = n(), a = () => l(i), t = s === i;
18
- return /* @__PURE__ */ f(g, { expanded: t, children: [
19
- /* @__PURE__ */ m(b, { type: "switch", onToggle: a, active: !!o, children: o == null ? void 0 : o.name }),
20
- /* @__PURE__ */ m(x, { open: t, drawerTitle: "Endre konto", onClose: p, children: /* @__PURE__ */ m(
21
- T,
17
+ const { currentId: m, toggleId: s, closeAll: t } = x(), a = () => s(e), i = m === e;
18
+ return /* @__PURE__ */ f(h, { expanded: i, children: [
19
+ /* @__PURE__ */ p(g, { type: "switch", onToggle: a, active: !!o, children: o == null ? void 0 : o.name }),
20
+ /* @__PURE__ */ p(T, { open: i, drawerTitle: "Endre konto", onClose: t, children: /* @__PURE__ */ n(
21
+ b,
22
22
  {
23
- ...e,
23
+ ...l,
24
+ key: m,
24
25
  onSelectAccount: (d) => {
25
- r == null || r(d), p();
26
+ r == null || r(d), t();
26
27
  },
27
28
  currentAccount: o
28
29
  }
@@ -30,5 +31,5 @@ const y = ({
30
31
  ] });
31
32
  };
32
33
  export {
33
- y as ToolbarAccountMenu
34
+ v as ToolbarAccountMenu
34
35
  };
@@ -1,7 +1,7 @@
1
1
  import { Color } from '../../types';
2
2
  import { SvgElement } from '../Icon';
3
3
  import { ListItemProps } from '../List';
4
- interface AccessAreaListItemDefaultProps extends Pick<ListItemProps, 'size' | 'onClick' | 'expanded' | 'loading'> {
4
+ interface AccessAreaListItemDefaultProps extends Pick<ListItemProps, 'size' | 'onClick' | 'expanded' | 'loading' | 'titleAs'> {
5
5
  /** Id of the item */
6
6
  id: string;
7
7
  /** Name of the Access Area */
@@ -1,5 +1,5 @@
1
1
  import { ListItemProps } from '../List';
2
- export interface AccessPackageListItemProps extends Pick<ListItemProps, 'color' | 'onClick' | 'as' | 'title' | 'description' | 'size' | 'controls' | 'loading'> {
2
+ export interface AccessPackageListItemProps extends Pick<ListItemProps, 'color' | 'onClick' | 'as' | 'title' | 'description' | 'size' | 'controls' | 'loading' | 'titleAs'> {
3
3
  id: string;
4
4
  }
5
5
  export declare const AccessPackageListItem: ({ as, title, color, ...props }: AccessPackageListItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -20,5 +20,6 @@ export interface AccountMenuProps {
20
20
  accountSearch?: AccountSearchProps;
21
21
  currentAccount?: AccountMenuItem;
22
22
  onSelectAccount?: (id: string) => void;
23
+ isVirtualized?: boolean;
23
24
  }
24
- export declare const AccountMenu: ({ accounts, accountGroups, accountSearch, onSelectAccount, currentAccount, }: AccountMenuProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const AccountMenu: ({ accounts, accountGroups, accountSearch, onSelectAccount, currentAccount, isVirtualized, }: AccountMenuProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- component: ({ accounts, accountGroups, accountSearch, onSelectAccount, currentAccount, }: import('./AccountMenu').AccountMenuProps) => import("react/jsx-runtime").JSX.Element;
4
+ component: ({ accounts, accountGroups, accountSearch, onSelectAccount, currentAccount, isVirtualized, }: import('./AccountMenu').AccountMenuProps) => import("react/jsx-runtime").JSX.Element;
5
5
  tags: string[];
6
6
  parameters: {};
7
7
  args: {
@@ -10,6 +10,7 @@ declare const meta: {
10
10
  accountSearch?: import('./AccountMenu').AccountSearchProps;
11
11
  currentAccount?: import('./AccountMenu').AccountMenuItem;
12
12
  onSelectAccount?: (id: string) => void;
13
+ isVirtualized?: boolean;
13
14
  };
14
15
  };
15
16
  export default meta;
@@ -20,6 +20,7 @@ declare const meta: {
20
20
  accounts?: import('./AccountMenu.tsx').AccountMenuItem[];
21
21
  accountGroups?: import('../index.ts').MenuItemGroups;
22
22
  accountSearch?: import('./AccountMenu.tsx').AccountSearchProps;
23
+ isVirtualized?: boolean;
23
24
  };
24
25
  };
25
26
  export default meta;
@@ -1,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- component: ({ color, theme, defaultItemColor, defaultItemTheme, defaultItemSize, defaultIconTheme, groups, items, search, }: import('./Menu').MenuProps) => import("react/jsx-runtime").JSX.Element;
4
+ component: ({ color, theme, defaultItemColor, defaultItemTheme, defaultItemSize, defaultIconTheme, groups, items, search, isVirtualized, }: import('./Menu').MenuProps) => import("react/jsx-runtime").JSX.Element;
5
5
  parameters: {};
6
6
  args: {};
7
7
  };
@@ -12,6 +12,7 @@ export declare const CompanyInboxMenu: {
12
12
  args: {
13
13
  color: string;
14
14
  theme: string;
15
+ isVirtualized?: boolean;
15
16
  level?: number;
16
17
  expanded?: boolean;
17
18
  search?: import('./MenuSearch').MenuSearchProps;
@@ -27,6 +28,7 @@ export declare const PersonInboxMenu: {
27
28
  args: {
28
29
  color: string;
29
30
  theme: string;
31
+ isVirtualized?: boolean;
30
32
  level?: number;
31
33
  expanded?: boolean;
32
34
  search?: import('./MenuSearch').MenuSearchProps;
@@ -43,6 +45,7 @@ export declare const NeutralCompanyMenu: {
43
45
  args: {
44
46
  color: string;
45
47
  theme?: import('./MenuBase').MenuTheme;
48
+ isVirtualized?: boolean;
46
49
  level?: number;
47
50
  expanded?: boolean;
48
51
  search?: import('./MenuSearch').MenuSearchProps;
@@ -59,6 +62,7 @@ export declare const NeutralPersonMenu: {
59
62
  args: {
60
63
  color: string;
61
64
  theme?: import('./MenuBase').MenuTheme;
65
+ isVirtualized?: boolean;
62
66
  level?: number;
63
67
  expanded?: boolean;
64
68
  search?: import('./MenuSearch').MenuSearchProps;
@@ -4,5 +4,6 @@ import { MenuItemsProps } from './MenuItems';
4
4
  export interface MenuProps extends MenuItemsProps {
5
5
  color?: MenuItemColor;
6
6
  theme?: MenuTheme;
7
+ isVirtualized?: boolean;
7
8
  }
8
- export declare const Menu: ({ color, theme, defaultItemColor, defaultItemTheme, defaultItemSize, defaultIconTheme, groups, items, search, }: MenuProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const Menu: ({ color, theme, defaultItemColor, defaultItemTheme, defaultItemSize, defaultIconTheme, groups, items, search, isVirtualized, }: MenuProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react';
2
2
  declare const meta: {
3
3
  title: string;
4
- component: ({ color, theme, defaultItemColor, defaultItemTheme, defaultItemSize, defaultIconTheme, groups, items, search, }: import('./Menu').MenuProps) => import("react/jsx-runtime").JSX.Element;
4
+ component: ({ color, theme, defaultItemColor, defaultItemTheme, defaultItemSize, defaultIconTheme, groups, items, search, isVirtualized, }: import('./Menu').MenuProps) => import("react/jsx-runtime").JSX.Element;
5
5
  parameters: {};
6
6
  args: {};
7
7
  };
@@ -24,7 +24,9 @@ export interface MenuListItemProps {
24
24
  expanded?: boolean;
25
25
  className?: string;
26
26
  children?: ReactNode;
27
+ style?: React.CSSProperties;
28
+ dataIndex?: number;
27
29
  }
28
30
  export declare const MenuBase: ({ as, color, theme, className, children }: MenuBaseProps) => import("react/jsx-runtime").JSX.Element;
29
31
  export declare const MenuList: ({ as, role, className, children }: MenuListProps) => import("react/jsx-runtime").JSX.Element;
30
- export declare const MenuListItem: ({ as, role, className, children }: MenuListItemProps) => import("react/jsx-runtime").JSX.Element;
32
+ export declare const MenuListItem: ({ as, role, className, children, style, dataIndex, }: MenuListItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { MenuItemsProps } from './MenuItems';
2
+ export declare const MenuItemsVirtual: ({ level, search, items, groups, defaultItemSize, defaultItemColor, defaultItemTheme, defaultIconTheme, }: MenuItemsProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,18 @@
1
1
  import { StoryObj } from '@storybook/react';
2
+ import { MenuSearchProps } from './MenuSearch';
2
3
  declare const meta: {
3
4
  title: string;
4
- component: ({ value, name, placeholder, clearButtonAltText, onChange, onClear, }: import('./MenuSearch').MenuSearchProps) => import("react/jsx-runtime").JSX.Element;
5
+ component: ({ value, name, placeholder, clearButtonAltText, onChange, onClear, }: MenuSearchProps) => import("react/jsx-runtime").JSX.Element;
5
6
  tags: string[];
6
7
  parameters: {};
7
8
  args: {
8
9
  name: string;
10
+ placeholder: string;
11
+ onClear: () => void;
12
+ onChange: () => void;
9
13
  };
10
14
  };
11
15
  export default meta;
12
16
  type Story = StoryObj<typeof meta>;
13
17
  export declare const Default: Story;
18
+ export declare const WithState: (args: MenuSearchProps) => import("react/jsx-runtime").JSX.Element;
@@ -18,5 +18,6 @@ export declare const StaticFilters: Story;
18
18
  export declare const HiddenFilters: Story;
19
19
  export declare const WithAccountMenu: Story;
20
20
  export declare const WithSearch: Story;
21
+ export declare const LongListAccounts: Story;
21
22
  export declare const ControlledStateFilters: (args: typeof Toolbar) => import("react/jsx-runtime").JSX.Element;
22
23
  export declare const ControlledStateAccount: () => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { AccountMenuProps } from '../';
2
2
  export interface ToolbarAccountMenuProps extends AccountMenuProps {
3
3
  id?: string;
4
+ isVirtualized?: boolean;
4
5
  }
5
6
  export declare const ToolbarAccountMenu: ({ currentAccount, id, onSelectAccount, ...rest }: ToolbarAccountMenuProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.22.7",
3
+ "version": "0.23.0",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",
@@ -21,6 +21,7 @@
21
21
  "license": "ISC",
22
22
  "dependencies": {
23
23
  "@navikt/aksel-icons": "^7.9.2",
24
+ "@tanstack/react-virtual": "^3.13.4",
24
25
  "classnames": "^2.5.1",
25
26
  "react": "^19.0.0",
26
27
  "react-dom": "^19.0.0"