@altinn/altinn-components 0.56.6 → 0.56.8

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