@telia/teddy 0.0.4 → 0.0.6

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.
Files changed (48) hide show
  1. package/dist/assets/badge.css +1 -1
  2. package/dist/assets/flex.css +1 -0
  3. package/dist/assets/grid.css +1 -1
  4. package/dist/assets/main.css +1 -1
  5. package/dist/assets/radio-group.css +1 -0
  6. package/dist/assets/spinner.css +1 -1
  7. package/dist/badge-tBBi5HpV.js +720 -0
  8. package/dist/components/accordion/accordion.d.ts +1 -0
  9. package/dist/components/accordion/accordion.js +6 -3
  10. package/dist/components/accordion/index.js +1 -1
  11. package/dist/components/badge/badge.js +6 -3
  12. package/dist/components/badge/index.js +1 -1
  13. package/dist/components/box/box.d.ts +23 -0
  14. package/dist/components/box/box.js +13 -0
  15. package/dist/components/box/index.d.ts +2 -0
  16. package/dist/components/box/index.js +4 -0
  17. package/dist/components/card/card.d.ts +2 -2
  18. package/dist/components/card/card.js +6 -3
  19. package/dist/components/card/index.js +1 -1
  20. package/dist/components/flex/flex.d.ts +23 -0
  21. package/dist/components/flex/flex.js +16 -0
  22. package/dist/components/flex/index.d.ts +2 -0
  23. package/dist/components/flex/index.js +4 -0
  24. package/dist/components/grid/grid.d.ts +4 -58
  25. package/dist/components/grid/grid.js +12 -389
  26. package/dist/components/index.d.ts +3 -0
  27. package/dist/components/index.js +44 -38
  28. package/dist/components/input/input.d.ts +3 -0
  29. package/dist/components/input/input.js +50 -51
  30. package/dist/components/navigation-menu/index.js +1 -1
  31. package/dist/components/navigation-menu/navigation-menu.js +1033 -8
  32. package/dist/components/radio-group/index.d.ts +2 -0
  33. package/dist/components/radio-group/index.js +4 -0
  34. package/dist/components/radio-group/radio-group.d.ts +52 -0
  35. package/dist/components/radio-group/radio-group.js +9 -0
  36. package/dist/components/spinner/spinner.js +25 -25
  37. package/dist/components/switch/index.js +1 -1
  38. package/dist/components/switch/switch.d.ts +1 -1
  39. package/dist/components/switch/switch.js +6 -3
  40. package/dist/index-0Eg2mucA.js +305 -0
  41. package/dist/main.js +58 -52
  42. package/dist/radio-group-0Oc9WTDf.js +422 -0
  43. package/dist/utils/action.d.ts +1 -1
  44. package/dist/utils/layout.d.ts +141 -3
  45. package/dist/utils/layout.js +217 -7
  46. package/package.json +17 -16
  47. package/dist/badge-CbHdlkcM.js +0 -742
  48. package/dist/navigation-menu-BgN7IKev.js +0 -1334
@@ -1,1334 +0,0 @@
1
- import './assets/navigation-menu.css';
2
- import { jsx as A, jsxs as Qe, Fragment as Ze } from "react/jsx-runtime";
3
- import * as Ce from "react";
4
- import h, { createContext as Q, useMemo as G, createElement as m, useContext as ce, useRef as M, useEffect as S, useCallback as z, useState as k, useLayoutEffect as et, Children as tt, cloneElement as nt, useReducer as ot, forwardRef as O, Fragment as $e } from "react";
5
- import { c as K } from "./clsx-DB4S2d7J.js";
6
- import { b as W, $ as ge, _ as R, c as rt } from "./index-DpfSJps6.js";
7
- import it, { flushSync as st } from "react-dom";
8
- import { $ as L, a as te } from "./index-DM5e-Whg.js";
9
- import { useComposedRefs as ue } from "./utils/composeRefs.js";
10
- import { VisuallyHidden as at } from "./components/visually-hidden/visually-hidden.js";
11
- import { composeEventHandlers as ne } from "./utils/composeEventHandlers.js";
12
- function Ne(e, t = []) {
13
- let n = [];
14
- function o(i, a) {
15
- const u = /* @__PURE__ */ Q(a), s = n.length;
16
- n = [
17
- ...n,
18
- a
19
- ];
20
- function d(l) {
21
- const { scope: g, children: v, ...f } = l, $ = (g == null ? void 0 : g[e][s]) || u, b = G(
22
- () => f,
23
- Object.values(f)
24
- );
25
- return /* @__PURE__ */ m($.Provider, {
26
- value: b
27
- }, v);
28
- }
29
- function c(l, g) {
30
- const v = (g == null ? void 0 : g[e][s]) || u, f = ce(v);
31
- if (f)
32
- return f;
33
- if (a !== void 0)
34
- return a;
35
- throw new Error(`\`${l}\` must be used within \`${i}\``);
36
- }
37
- return d.displayName = i + "Provider", [
38
- d,
39
- c
40
- ];
41
- }
42
- const r = () => {
43
- const i = n.map((a) => /* @__PURE__ */ Q(a));
44
- return function(u) {
45
- const s = (u == null ? void 0 : u[e]) || i;
46
- return G(
47
- () => ({
48
- [`__scope${e}`]: {
49
- ...u,
50
- [e]: s
51
- }
52
- }),
53
- [
54
- u,
55
- s
56
- ]
57
- );
58
- };
59
- };
60
- return r.scopeName = e, [
61
- o,
62
- ct(r, ...t)
63
- ];
64
- }
65
- function ct(...e) {
66
- const t = e[0];
67
- if (e.length === 1)
68
- return t;
69
- const n = () => {
70
- const o = e.map(
71
- (r) => ({
72
- useScope: r(),
73
- scopeName: r.scopeName
74
- })
75
- );
76
- return function(i) {
77
- const a = o.reduce((u, { useScope: s, scopeName: d }) => {
78
- const l = s(i)[`__scope${d}`];
79
- return {
80
- ...u,
81
- ...l
82
- };
83
- }, {});
84
- return G(
85
- () => ({
86
- [`__scope${t.scopeName}`]: a
87
- }),
88
- [
89
- a
90
- ]
91
- );
92
- };
93
- };
94
- return n.scopeName = t.scopeName, n;
95
- }
96
- function x(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
97
- return function(r) {
98
- if (e == null || e(r), n === !1 || !r.defaultPrevented)
99
- return t == null ? void 0 : t(r);
100
- };
101
- }
102
- function F(e) {
103
- const t = M(e);
104
- return S(() => {
105
- t.current = e;
106
- }), G(
107
- () => (...n) => {
108
- var o;
109
- return (o = t.current) === null || o === void 0 ? void 0 : o.call(t, ...n);
110
- },
111
- []
112
- );
113
- }
114
- function Me({ prop: e, defaultProp: t, onChange: n = () => {
115
- } }) {
116
- const [o, r] = ut({
117
- defaultProp: t,
118
- onChange: n
119
- }), i = e !== void 0, a = i ? e : o, u = F(n), s = z((d) => {
120
- if (i) {
121
- const l = typeof d == "function" ? d(e) : d;
122
- l !== e && u(l);
123
- } else
124
- r(d);
125
- }, [
126
- i,
127
- e,
128
- r,
129
- u
130
- ]);
131
- return [
132
- a,
133
- s
134
- ];
135
- }
136
- function ut({ defaultProp: e, onChange: t }) {
137
- const n = k(e), [o] = n, r = M(o), i = F(t);
138
- return S(() => {
139
- r.current !== o && (i(o), r.current = o);
140
- }, [
141
- o,
142
- r,
143
- i
144
- ]), n;
145
- }
146
- const lt = /* @__PURE__ */ Q(void 0);
147
- function dt(e) {
148
- const t = ce(lt);
149
- return e || t || "ltr";
150
- }
151
- const H = globalThis != null && globalThis.document ? et : () => {
152
- };
153
- function ft(e, t) {
154
- return ot((n, o) => {
155
- const r = t[n][o];
156
- return r ?? n;
157
- }, e);
158
- }
159
- const Y = (e) => {
160
- const { present: t, children: n } = e, o = vt(t), r = typeof n == "function" ? n({
161
- present: o.isPresent
162
- }) : tt.only(n), i = W(o.ref, r.ref);
163
- return typeof n == "function" || o.isPresent ? /* @__PURE__ */ nt(r, {
164
- ref: i
165
- }) : null;
166
- };
167
- Y.displayName = "Presence";
168
- function vt(e) {
169
- const [t, n] = k(), o = M({}), r = M(e), i = M("none"), a = e ? "mounted" : "unmounted", [u, s] = ft(a, {
170
- mounted: {
171
- UNMOUNT: "unmounted",
172
- ANIMATION_OUT: "unmountSuspended"
173
- },
174
- unmountSuspended: {
175
- MOUNT: "mounted",
176
- ANIMATION_END: "unmounted"
177
- },
178
- unmounted: {
179
- MOUNT: "mounted"
180
- }
181
- });
182
- return S(() => {
183
- const d = X(o.current);
184
- i.current = u === "mounted" ? d : "none";
185
- }, [
186
- u
187
- ]), H(() => {
188
- const d = o.current, c = r.current;
189
- if (c !== e) {
190
- const g = i.current, v = X(d);
191
- e ? s("MOUNT") : v === "none" || (d == null ? void 0 : d.display) === "none" ? s("UNMOUNT") : s(c && g !== v ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
192
- }
193
- }, [
194
- e,
195
- s
196
- ]), H(() => {
197
- if (t) {
198
- const d = (l) => {
199
- const v = X(o.current).includes(l.animationName);
200
- l.target === t && v && st(
201
- () => s("ANIMATION_END")
202
- );
203
- }, c = (l) => {
204
- l.target === t && (i.current = X(o.current));
205
- };
206
- return t.addEventListener("animationstart", c), t.addEventListener("animationcancel", d), t.addEventListener("animationend", d), () => {
207
- t.removeEventListener("animationstart", c), t.removeEventListener("animationcancel", d), t.removeEventListener("animationend", d);
208
- };
209
- } else
210
- s("ANIMATION_END");
211
- }, [
212
- t,
213
- s
214
- ]), {
215
- isPresent: [
216
- "mounted",
217
- "unmountSuspended"
218
- ].includes(u),
219
- ref: z((d) => {
220
- d && (o.current = getComputedStyle(d)), n(d);
221
- }, [])
222
- };
223
- }
224
- function X(e) {
225
- return (e == null ? void 0 : e.animationName) || "none";
226
- }
227
- const mt = Ce.useId || (() => {
228
- });
229
- let $t = 0;
230
- function Te(e) {
231
- const [t, n] = Ce.useState(mt());
232
- return H(() => {
233
- e || n(
234
- (o) => o ?? String($t++)
235
- );
236
- }, [
237
- e
238
- ]), e || (t ? `radix-${t}` : "");
239
- }
240
- function xe(e) {
241
- const t = e + "CollectionProvider", [n, o] = Ne(t), [r, i] = n(t, {
242
- collectionRef: {
243
- current: null
244
- },
245
- itemMap: /* @__PURE__ */ new Map()
246
- }), a = (v) => {
247
- const { scope: f, children: $ } = v, b = h.useRef(null), E = h.useRef(/* @__PURE__ */ new Map()).current;
248
- return /* @__PURE__ */ h.createElement(r, {
249
- scope: f,
250
- itemMap: E,
251
- collectionRef: b
252
- }, $);
253
- }, u = e + "CollectionSlot", s = /* @__PURE__ */ h.forwardRef((v, f) => {
254
- const { scope: $, children: b } = v, E = i(u, $), T = W(f, E.collectionRef);
255
- return /* @__PURE__ */ h.createElement(ge, {
256
- ref: T
257
- }, b);
258
- }), d = e + "CollectionItemSlot", c = "data-radix-collection-item", l = /* @__PURE__ */ h.forwardRef((v, f) => {
259
- const { scope: $, children: b, ...E } = v, T = h.useRef(null), p = W(f, T), y = i(d, $);
260
- return h.useEffect(() => (y.itemMap.set(T, {
261
- ref: T,
262
- ...E
263
- }), () => void y.itemMap.delete(T))), /* @__PURE__ */ h.createElement(ge, {
264
- [c]: "",
265
- ref: p
266
- }, b);
267
- });
268
- function g(v) {
269
- const f = i(e + "CollectionConsumer", v);
270
- return h.useCallback(() => {
271
- const b = f.collectionRef.current;
272
- if (!b)
273
- return [];
274
- const E = Array.from(b.querySelectorAll(`[${c}]`));
275
- return Array.from(f.itemMap.values()).sort(
276
- (y, _) => E.indexOf(y.ref.current) - E.indexOf(_.ref.current)
277
- );
278
- }, [
279
- f.collectionRef,
280
- f.itemMap
281
- ]);
282
- }
283
- return [
284
- {
285
- Provider: a,
286
- Slot: s,
287
- ItemSlot: l
288
- },
289
- g,
290
- o
291
- ];
292
- }
293
- function gt(e, t = globalThis == null ? void 0 : globalThis.document) {
294
- const n = F(e);
295
- S(() => {
296
- const o = (r) => {
297
- r.key === "Escape" && n(r);
298
- };
299
- return t.addEventListener("keydown", o), () => t.removeEventListener("keydown", o);
300
- }, [
301
- n,
302
- t
303
- ]);
304
- }
305
- const oe = "dismissableLayer.update", pt = "dismissableLayer.pointerDownOutside", bt = "dismissableLayer.focusOutside";
306
- let pe;
307
- const _t = /* @__PURE__ */ Q({
308
- layers: /* @__PURE__ */ new Set(),
309
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
310
- branches: /* @__PURE__ */ new Set()
311
- }), yt = /* @__PURE__ */ O((e, t) => {
312
- var n;
313
- const { disableOutsidePointerEvents: o = !1, onEscapeKeyDown: r, onPointerDownOutside: i, onFocusOutside: a, onInteractOutside: u, onDismiss: s, ...d } = e, c = ce(_t), [l, g] = k(null), v = (n = l == null ? void 0 : l.ownerDocument) !== null && n !== void 0 ? n : globalThis == null ? void 0 : globalThis.document, [, f] = k({}), $ = W(
314
- t,
315
- (C) => g(C)
316
- ), b = Array.from(c.layers), [E] = [
317
- ...c.layersWithOutsidePointerEventsDisabled
318
- ].slice(-1), T = b.indexOf(E), p = l ? b.indexOf(l) : -1, y = c.layersWithOutsidePointerEventsDisabled.size > 0, _ = p >= T, N = ht((C) => {
319
- const w = C.target, U = [
320
- ...c.branches
321
- ].some(
322
- (B) => B.contains(w)
323
- );
324
- !_ || U || (i == null || i(C), u == null || u(C), C.defaultPrevented || s == null || s());
325
- }, v), D = Et((C) => {
326
- const w = C.target;
327
- [
328
- ...c.branches
329
- ].some(
330
- (B) => B.contains(w)
331
- ) || (a == null || a(C), u == null || u(C), C.defaultPrevented || s == null || s());
332
- }, v);
333
- return gt((C) => {
334
- p === c.layers.size - 1 && (r == null || r(C), !C.defaultPrevented && s && (C.preventDefault(), s()));
335
- }, v), S(() => {
336
- if (l)
337
- return o && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (pe = v.body.style.pointerEvents, v.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(l)), c.layers.add(l), be(), () => {
338
- o && c.layersWithOutsidePointerEventsDisabled.size === 1 && (v.body.style.pointerEvents = pe);
339
- };
340
- }, [
341
- l,
342
- v,
343
- o,
344
- c
345
- ]), S(() => () => {
346
- l && (c.layers.delete(l), c.layersWithOutsidePointerEventsDisabled.delete(l), be());
347
- }, [
348
- l,
349
- c
350
- ]), S(() => {
351
- const C = () => f({});
352
- return document.addEventListener(oe, C), () => document.removeEventListener(oe, C);
353
- }, []), /* @__PURE__ */ m(L.div, R({}, d, {
354
- ref: $,
355
- style: {
356
- pointerEvents: y ? _ ? "auto" : "none" : void 0,
357
- ...e.style
358
- },
359
- onFocusCapture: x(e.onFocusCapture, D.onFocusCapture),
360
- onBlurCapture: x(e.onBlurCapture, D.onBlurCapture),
361
- onPointerDownCapture: x(e.onPointerDownCapture, N.onPointerDownCapture)
362
- }));
363
- });
364
- function ht(e, t = globalThis == null ? void 0 : globalThis.document) {
365
- const n = F(e), o = M(!1), r = M(() => {
366
- });
367
- return S(() => {
368
- const i = (u) => {
369
- if (u.target && !o.current) {
370
- let d = function() {
371
- Re(pt, n, s, {
372
- discrete: !0
373
- });
374
- };
375
- const s = {
376
- originalEvent: u
377
- };
378
- u.pointerType === "touch" ? (t.removeEventListener("click", r.current), r.current = d, t.addEventListener("click", r.current, {
379
- once: !0
380
- })) : d();
381
- } else
382
- t.removeEventListener("click", r.current);
383
- o.current = !1;
384
- }, a = window.setTimeout(() => {
385
- t.addEventListener("pointerdown", i);
386
- }, 0);
387
- return () => {
388
- window.clearTimeout(a), t.removeEventListener("pointerdown", i), t.removeEventListener("click", r.current);
389
- };
390
- }, [
391
- t,
392
- n
393
- ]), {
394
- // ensures we check React component tree (not just DOM tree)
395
- onPointerDownCapture: () => o.current = !0
396
- };
397
- }
398
- function Et(e, t = globalThis == null ? void 0 : globalThis.document) {
399
- const n = F(e), o = M(!1);
400
- return S(() => {
401
- const r = (i) => {
402
- i.target && !o.current && Re(bt, n, {
403
- originalEvent: i
404
- }, {
405
- discrete: !1
406
- });
407
- };
408
- return t.addEventListener("focusin", r), () => t.removeEventListener("focusin", r);
409
- }, [
410
- t,
411
- n
412
- ]), {
413
- onFocusCapture: () => o.current = !0,
414
- onBlurCapture: () => o.current = !1
415
- };
416
- }
417
- function be() {
418
- const e = new CustomEvent(oe);
419
- document.dispatchEvent(e);
420
- }
421
- function Re(e, t, n, { discrete: o }) {
422
- const r = n.originalEvent.target, i = new CustomEvent(e, {
423
- bubbles: !1,
424
- cancelable: !0,
425
- detail: n
426
- });
427
- t && r.addEventListener(e, t, {
428
- once: !0
429
- }), o ? te(r, i) : r.dispatchEvent(i);
430
- }
431
- function wt(e) {
432
- const t = M({
433
- value: e,
434
- previous: e
435
- });
436
- return G(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [
437
- e
438
- ]);
439
- }
440
- const Ct = /* @__PURE__ */ O((e, t) => /* @__PURE__ */ m(L.span, R({}, e, {
441
- ref: t,
442
- style: {
443
- // See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
444
- position: "absolute",
445
- border: 0,
446
- width: 1,
447
- height: 1,
448
- padding: 0,
449
- margin: -1,
450
- overflow: "hidden",
451
- clip: "rect(0, 0, 0, 0)",
452
- whiteSpace: "nowrap",
453
- wordWrap: "normal",
454
- ...e.style
455
- }
456
- }))), Nt = Ct, q = "NavigationMenu", [le, Pe, Mt] = xe(q), [re, Tt, xt] = xe(q), [de, Mn] = Ne(q, [
457
- Mt,
458
- xt
459
- ]), [Rt, V] = de(q), [Pt, It] = de(q), Ot = /* @__PURE__ */ O((e, t) => {
460
- const { __scopeNavigationMenu: n, value: o, onValueChange: r, defaultValue: i, delayDuration: a = 200, skipDelayDuration: u = 300, orientation: s = "horizontal", dir: d, ...c } = e, [l, g] = k(null), v = W(
461
- t,
462
- (w) => g(w)
463
- ), f = dt(d), $ = M(0), b = M(0), E = M(0), [T, p] = k(!0), [y = "", _] = Me({
464
- prop: o,
465
- onChange: (w) => {
466
- const U = w !== "", B = u > 0;
467
- U ? (window.clearTimeout(E.current), B && p(!1)) : (window.clearTimeout(E.current), E.current = window.setTimeout(
468
- () => p(!0),
469
- u
470
- )), r == null || r(w);
471
- },
472
- defaultProp: i
473
- }), N = z(() => {
474
- window.clearTimeout(b.current), b.current = window.setTimeout(
475
- () => _(""),
476
- 150
477
- );
478
- }, [
479
- _
480
- ]), D = z((w) => {
481
- window.clearTimeout(b.current), _(w);
482
- }, [
483
- _
484
- ]), C = z((w) => {
485
- y === w ? window.clearTimeout(b.current) : $.current = window.setTimeout(() => {
486
- window.clearTimeout(b.current), _(w);
487
- }, a);
488
- }, [
489
- y,
490
- _,
491
- a
492
- ]);
493
- return S(() => () => {
494
- window.clearTimeout($.current), window.clearTimeout(b.current), window.clearTimeout(E.current);
495
- }, []), /* @__PURE__ */ m(Ie, {
496
- scope: n,
497
- isRootMenu: !0,
498
- value: y,
499
- dir: f,
500
- orientation: s,
501
- rootNavigationMenu: l,
502
- onTriggerEnter: (w) => {
503
- window.clearTimeout($.current), T ? C(w) : D(w);
504
- },
505
- onTriggerLeave: () => {
506
- window.clearTimeout($.current), N();
507
- },
508
- onContentEnter: () => window.clearTimeout(b.current),
509
- onContentLeave: N,
510
- onItemSelect: (w) => {
511
- _(
512
- (U) => U === w ? "" : w
513
- );
514
- },
515
- onItemDismiss: () => _("")
516
- }, /* @__PURE__ */ m(L.nav, R({
517
- "aria-label": "Main",
518
- "data-orientation": s,
519
- dir: f
520
- }, c, {
521
- ref: v
522
- })));
523
- }), Dt = "NavigationMenuSub", At = /* @__PURE__ */ O((e, t) => {
524
- const { __scopeNavigationMenu: n, value: o, onValueChange: r, defaultValue: i, orientation: a = "horizontal", ...u } = e, s = V(Dt, n), [d = "", c] = Me({
525
- prop: o,
526
- onChange: r,
527
- defaultProp: i
528
- });
529
- return /* @__PURE__ */ m(Ie, {
530
- scope: n,
531
- isRootMenu: !1,
532
- value: d,
533
- dir: s.dir,
534
- orientation: a,
535
- rootNavigationMenu: s.rootNavigationMenu,
536
- onTriggerEnter: (l) => c(l),
537
- onItemSelect: (l) => c(l),
538
- onItemDismiss: () => c("")
539
- }, /* @__PURE__ */ m(L.div, R({
540
- "data-orientation": a
541
- }, u, {
542
- ref: t
543
- })));
544
- }), Ie = (e) => {
545
- const { scope: t, isRootMenu: n, rootNavigationMenu: o, dir: r, orientation: i, children: a, value: u, onItemSelect: s, onItemDismiss: d, onTriggerEnter: c, onTriggerLeave: l, onContentEnter: g, onContentLeave: v } = e, [f, $] = k(null), [b, E] = k(/* @__PURE__ */ new Map()), [T, p] = k(null);
546
- return /* @__PURE__ */ m(Rt, {
547
- scope: t,
548
- isRootMenu: n,
549
- rootNavigationMenu: o,
550
- value: u,
551
- previousValue: wt(u),
552
- baseId: Te(),
553
- dir: r,
554
- orientation: i,
555
- viewport: f,
556
- onViewportChange: $,
557
- indicatorTrack: T,
558
- onIndicatorTrackChange: p,
559
- onTriggerEnter: F(c),
560
- onTriggerLeave: F(l),
561
- onContentEnter: F(g),
562
- onContentLeave: F(v),
563
- onItemSelect: F(s),
564
- onItemDismiss: F(d),
565
- onViewportContentChange: z((y, _) => {
566
- E((N) => (N.set(y, _), new Map(N)));
567
- }, []),
568
- onViewportContentRemove: z((y) => {
569
- E((_) => _.has(y) ? (_.delete(y), new Map(_)) : _);
570
- }, [])
571
- }, /* @__PURE__ */ m(le.Provider, {
572
- scope: t
573
- }, /* @__PURE__ */ m(Pt, {
574
- scope: t,
575
- items: b
576
- }, a)));
577
- }, kt = "NavigationMenuList", Lt = /* @__PURE__ */ O((e, t) => {
578
- const { __scopeNavigationMenu: n, ...o } = e, r = V(kt, n), i = /* @__PURE__ */ m(L.ul, R({
579
- "data-orientation": r.orientation
580
- }, o, {
581
- ref: t
582
- }));
583
- return /* @__PURE__ */ m(L.div, {
584
- style: {
585
- position: "relative"
586
- },
587
- ref: r.onIndicatorTrackChange
588
- }, /* @__PURE__ */ m(le.Slot, {
589
- scope: n
590
- }, r.isRootMenu ? /* @__PURE__ */ m(Le, {
591
- asChild: !0
592
- }, i) : i));
593
- }), Ft = "NavigationMenuItem", [St, Oe] = de(Ft), Kt = /* @__PURE__ */ O((e, t) => {
594
- const { __scopeNavigationMenu: n, value: o, ...r } = e, i = Te(), a = o || i || "LEGACY_REACT_AUTO_VALUE", u = M(null), s = M(null), d = M(null), c = M(() => {
595
- }), l = M(!1), g = z((f = "start") => {
596
- if (u.current) {
597
- c.current();
598
- const $ = ie(u.current);
599
- $.length && fe(f === "start" ? $ : $.reverse());
600
- }
601
- }, []), v = z(() => {
602
- if (u.current) {
603
- const f = ie(u.current);
604
- f.length && (c.current = Xt(f));
605
- }
606
- }, []);
607
- return /* @__PURE__ */ m(St, {
608
- scope: n,
609
- value: a,
610
- triggerRef: s,
611
- contentRef: u,
612
- focusProxyRef: d,
613
- wasEscapeCloseRef: l,
614
- onEntryKeyDown: g,
615
- onFocusProxyEnter: g,
616
- onRootContentClose: v,
617
- onContentFocusOutside: v
618
- }, /* @__PURE__ */ m(L.li, R({}, r, {
619
- ref: t
620
- })));
621
- }), _e = "NavigationMenuTrigger", Vt = /* @__PURE__ */ O((e, t) => {
622
- const { __scopeNavigationMenu: n, disabled: o, ...r } = e, i = V(_e, e.__scopeNavigationMenu), a = Oe(_e, e.__scopeNavigationMenu), u = M(null), s = W(u, a.triggerRef, t), d = Se(i.baseId, a.value), c = Ke(i.baseId, a.value), l = M(!1), g = M(!1), v = a.value === i.value;
623
- return /* @__PURE__ */ m($e, null, /* @__PURE__ */ m(le.ItemSlot, {
624
- scope: n,
625
- value: a.value
626
- }, /* @__PURE__ */ m(Fe, {
627
- asChild: !0
628
- }, /* @__PURE__ */ m(L.button, R({
629
- id: d,
630
- disabled: o,
631
- "data-disabled": o ? "" : void 0,
632
- "data-state": ve(v),
633
- "aria-expanded": v,
634
- "aria-controls": c
635
- }, r, {
636
- ref: s,
637
- onPointerEnter: x(e.onPointerEnter, () => {
638
- g.current = !1, a.wasEscapeCloseRef.current = !1;
639
- }),
640
- onPointerMove: x(e.onPointerMove, Z(() => {
641
- o || g.current || a.wasEscapeCloseRef.current || l.current || (i.onTriggerEnter(a.value), l.current = !0);
642
- })),
643
- onPointerLeave: x(e.onPointerLeave, Z(() => {
644
- o || (i.onTriggerLeave(), l.current = !1);
645
- })),
646
- onClick: x(e.onClick, () => {
647
- i.onItemSelect(a.value), g.current = v;
648
- }),
649
- onKeyDown: x(e.onKeyDown, (f) => {
650
- const b = {
651
- horizontal: "ArrowDown",
652
- vertical: i.dir === "rtl" ? "ArrowLeft" : "ArrowRight"
653
- }[i.orientation];
654
- v && f.key === b && (a.onEntryKeyDown(), f.preventDefault());
655
- })
656
- })))), v && /* @__PURE__ */ m($e, null, /* @__PURE__ */ m(Nt, {
657
- "aria-hidden": !0,
658
- tabIndex: 0,
659
- ref: a.focusProxyRef,
660
- onFocus: (f) => {
661
- const $ = a.contentRef.current, b = f.relatedTarget, E = b === u.current, T = $ == null ? void 0 : $.contains(b);
662
- (E || !T) && a.onFocusProxyEnter(E ? "start" : "end");
663
- }
664
- }), i.viewport && /* @__PURE__ */ m("span", {
665
- "aria-owns": c
666
- })));
667
- }), ye = "navigationMenu.linkSelect", Ut = /* @__PURE__ */ O((e, t) => {
668
- const { __scopeNavigationMenu: n, active: o, onSelect: r, ...i } = e;
669
- return /* @__PURE__ */ m(Fe, {
670
- asChild: !0
671
- }, /* @__PURE__ */ m(L.a, R({
672
- "data-active": o ? "" : void 0,
673
- "aria-current": o ? "page" : void 0
674
- }, i, {
675
- ref: t,
676
- onClick: x(e.onClick, (a) => {
677
- const u = a.target, s = new CustomEvent(ye, {
678
- bubbles: !0,
679
- cancelable: !0
680
- });
681
- if (u.addEventListener(
682
- ye,
683
- (d) => r == null ? void 0 : r(d),
684
- {
685
- once: !0
686
- }
687
- ), te(u, s), !s.defaultPrevented && !a.metaKey) {
688
- const d = new CustomEvent(J, {
689
- bubbles: !0,
690
- cancelable: !0
691
- });
692
- te(u, d);
693
- }
694
- }, {
695
- checkForDefaultPrevented: !1
696
- })
697
- })));
698
- }), De = "NavigationMenuIndicator", zt = /* @__PURE__ */ O((e, t) => {
699
- const { forceMount: n, ...o } = e, r = V(De, e.__scopeNavigationMenu), i = !!r.value;
700
- return r.indicatorTrack ? /* @__PURE__ */ it.createPortal(/* @__PURE__ */ m(Y, {
701
- present: n || i
702
- }, /* @__PURE__ */ m(Wt, R({}, o, {
703
- ref: t
704
- }))), r.indicatorTrack) : null;
705
- }), Wt = /* @__PURE__ */ O((e, t) => {
706
- const { __scopeNavigationMenu: n, ...o } = e, r = V(De, n), i = Pe(n), [a, u] = k(null), [s, d] = k(null), c = r.orientation === "horizontal", l = !!r.value;
707
- S(() => {
708
- var v;
709
- const $ = (v = i().find(
710
- (b) => b.value === r.value
711
- )) === null || v === void 0 ? void 0 : v.ref.current;
712
- $ && u($);
713
- }, [
714
- i,
715
- r.value
716
- ]);
717
- const g = () => {
718
- a && d({
719
- size: c ? a.offsetWidth : a.offsetHeight,
720
- offset: c ? a.offsetLeft : a.offsetTop
721
- });
722
- };
723
- return se(a, g), se(r.indicatorTrack, g), s ? /* @__PURE__ */ m(L.div, R({
724
- "aria-hidden": !0,
725
- "data-state": l ? "visible" : "hidden",
726
- "data-orientation": r.orientation
727
- }, o, {
728
- ref: t,
729
- style: {
730
- position: "absolute",
731
- ...c ? {
732
- left: 0,
733
- width: s.size + "px",
734
- transform: `translateX(${s.offset}px)`
735
- } : {
736
- top: 0,
737
- height: s.size + "px",
738
- transform: `translateY(${s.offset}px)`
739
- },
740
- ...o.style
741
- }
742
- })) : null;
743
- }), j = "NavigationMenuContent", Bt = /* @__PURE__ */ O((e, t) => {
744
- const { forceMount: n, ...o } = e, r = V(j, e.__scopeNavigationMenu), i = Oe(j, e.__scopeNavigationMenu), a = W(i.contentRef, t), u = i.value === r.value, s = {
745
- value: i.value,
746
- triggerRef: i.triggerRef,
747
- focusProxyRef: i.focusProxyRef,
748
- wasEscapeCloseRef: i.wasEscapeCloseRef,
749
- onContentFocusOutside: i.onContentFocusOutside,
750
- onRootContentClose: i.onRootContentClose,
751
- ...o
752
- };
753
- return r.viewport ? /* @__PURE__ */ m(Gt, R({
754
- forceMount: n
755
- }, s, {
756
- ref: a
757
- })) : /* @__PURE__ */ m(Y, {
758
- present: n || u
759
- }, /* @__PURE__ */ m(Ae, R({
760
- "data-state": ve(u)
761
- }, s, {
762
- ref: a,
763
- onPointerEnter: x(e.onPointerEnter, r.onContentEnter),
764
- onPointerLeave: x(e.onPointerLeave, Z(r.onContentLeave)),
765
- style: {
766
- // Prevent interaction when animating out
767
- pointerEvents: !u && r.isRootMenu ? "none" : void 0,
768
- ...s.style
769
- }
770
- })));
771
- }), Gt = /* @__PURE__ */ O((e, t) => {
772
- const n = V(j, e.__scopeNavigationMenu), { onViewportContentChange: o, onViewportContentRemove: r } = n;
773
- return H(() => {
774
- o(e.value, {
775
- ref: t,
776
- ...e
777
- });
778
- }, [
779
- e,
780
- t,
781
- o
782
- ]), H(() => () => r(e.value), [
783
- e.value,
784
- r
785
- ]), null;
786
- }), J = "navigationMenu.rootContentDismiss", Ae = /* @__PURE__ */ O((e, t) => {
787
- const { __scopeNavigationMenu: n, value: o, triggerRef: r, focusProxyRef: i, wasEscapeCloseRef: a, onRootContentClose: u, onContentFocusOutside: s, ...d } = e, c = V(j, n), l = M(null), g = W(l, t), v = Se(c.baseId, o), f = Ke(c.baseId, o), $ = Pe(n), b = M(null), { onItemDismiss: E } = c;
788
- S(() => {
789
- const p = l.current;
790
- if (c.isRootMenu && p) {
791
- const y = () => {
792
- var _;
793
- E(), u(), p.contains(document.activeElement) && ((_ = r.current) === null || _ === void 0 || _.focus());
794
- };
795
- return p.addEventListener(J, y), () => p.removeEventListener(J, y);
796
- }
797
- }, [
798
- c.isRootMenu,
799
- e.value,
800
- r,
801
- E,
802
- u
803
- ]);
804
- const T = G(() => {
805
- const y = $().map(
806
- (U) => U.value
807
- );
808
- c.dir === "rtl" && y.reverse();
809
- const _ = y.indexOf(c.value), N = y.indexOf(c.previousValue), D = o === c.value, C = N === y.indexOf(o);
810
- if (!D && !C)
811
- return b.current;
812
- const w = (() => {
813
- if (_ !== N) {
814
- if (D && N !== -1)
815
- return _ > N ? "from-end" : "from-start";
816
- if (C && _ !== -1)
817
- return _ > N ? "to-start" : "to-end";
818
- }
819
- return null;
820
- })();
821
- return b.current = w, w;
822
- }, [
823
- c.previousValue,
824
- c.value,
825
- c.dir,
826
- $,
827
- o
828
- ]);
829
- return /* @__PURE__ */ m(Le, {
830
- asChild: !0
831
- }, /* @__PURE__ */ m(yt, R({
832
- id: f,
833
- "aria-labelledby": v,
834
- "data-motion": T,
835
- "data-orientation": c.orientation
836
- }, d, {
837
- ref: g,
838
- onDismiss: () => {
839
- var p;
840
- const y = new Event(J, {
841
- bubbles: !0,
842
- cancelable: !0
843
- });
844
- (p = l.current) === null || p === void 0 || p.dispatchEvent(y);
845
- },
846
- onFocusOutside: x(e.onFocusOutside, (p) => {
847
- var y;
848
- s();
849
- const _ = p.target;
850
- (y = c.rootNavigationMenu) !== null && y !== void 0 && y.contains(_) && p.preventDefault();
851
- }),
852
- onPointerDownOutside: x(e.onPointerDownOutside, (p) => {
853
- var y;
854
- const _ = p.target, N = $().some((C) => {
855
- var w;
856
- return (w = C.ref.current) === null || w === void 0 ? void 0 : w.contains(_);
857
- }), D = c.isRootMenu && ((y = c.viewport) === null || y === void 0 ? void 0 : y.contains(_));
858
- (N || D || !c.isRootMenu) && p.preventDefault();
859
- }),
860
- onKeyDown: x(e.onKeyDown, (p) => {
861
- const y = p.altKey || p.ctrlKey || p.metaKey;
862
- if (p.key === "Tab" && !y) {
863
- const D = ie(p.currentTarget), C = document.activeElement, w = D.findIndex(
864
- (Je) => Je === C
865
- ), B = p.shiftKey ? D.slice(0, w).reverse() : D.slice(w + 1, D.length);
866
- if (fe(B))
867
- p.preventDefault();
868
- else {
869
- var N;
870
- (N = i.current) === null || N === void 0 || N.focus();
871
- }
872
- }
873
- }),
874
- onEscapeKeyDown: x(e.onEscapeKeyDown, (p) => {
875
- a.current = !0;
876
- })
877
- })));
878
- }), ke = "NavigationMenuViewport", Ht = /* @__PURE__ */ O((e, t) => {
879
- const { forceMount: n, ...o } = e, i = !!V(ke, e.__scopeNavigationMenu).value;
880
- return /* @__PURE__ */ m(Y, {
881
- present: n || i
882
- }, /* @__PURE__ */ m(jt, R({}, o, {
883
- ref: t
884
- })));
885
- }), jt = /* @__PURE__ */ O((e, t) => {
886
- const { __scopeNavigationMenu: n, children: o, ...r } = e, i = V(ke, n), a = W(t, i.onViewportChange), u = It(j, e.__scopeNavigationMenu), [s, d] = k(null), [c, l] = k(null), g = s ? (s == null ? void 0 : s.width) + "px" : void 0, v = s ? (s == null ? void 0 : s.height) + "px" : void 0, f = !!i.value, $ = f ? i.value : i.previousValue;
887
- return se(c, () => {
888
- c && d({
889
- width: c.offsetWidth,
890
- height: c.offsetHeight
891
- });
892
- }), /* @__PURE__ */ m(L.div, R({
893
- "data-state": ve(f),
894
- "data-orientation": i.orientation
895
- }, r, {
896
- ref: a,
897
- style: {
898
- // Prevent interaction when animating out
899
- pointerEvents: !f && i.isRootMenu ? "none" : void 0,
900
- "--radix-navigation-menu-viewport-width": g,
901
- "--radix-navigation-menu-viewport-height": v,
902
- ...r.style
903
- },
904
- onPointerEnter: x(e.onPointerEnter, i.onContentEnter),
905
- onPointerLeave: x(e.onPointerLeave, Z(i.onContentLeave))
906
- }), Array.from(u.items).map(([E, { ref: T, forceMount: p, ...y }]) => {
907
- const _ = $ === E;
908
- return /* @__PURE__ */ m(Y, {
909
- key: E,
910
- present: p || _
911
- }, /* @__PURE__ */ m(Ae, R({}, y, {
912
- ref: rt(T, (N) => {
913
- _ && N && l(N);
914
- })
915
- })));
916
- }));
917
- }), Yt = "FocusGroup", Le = /* @__PURE__ */ O((e, t) => {
918
- const { __scopeNavigationMenu: n, ...o } = e, r = V(Yt, n);
919
- return /* @__PURE__ */ m(re.Provider, {
920
- scope: n
921
- }, /* @__PURE__ */ m(re.Slot, {
922
- scope: n
923
- }, /* @__PURE__ */ m(L.div, R({
924
- dir: r.dir
925
- }, o, {
926
- ref: t
927
- }))));
928
- }), he = [
929
- "ArrowRight",
930
- "ArrowLeft",
931
- "ArrowUp",
932
- "ArrowDown"
933
- ], qt = "FocusGroupItem", Fe = /* @__PURE__ */ O((e, t) => {
934
- const { __scopeNavigationMenu: n, ...o } = e, r = Tt(n), i = V(qt, n);
935
- return /* @__PURE__ */ m(re.ItemSlot, {
936
- scope: n
937
- }, /* @__PURE__ */ m(L.button, R({}, o, {
938
- ref: t,
939
- onKeyDown: x(e.onKeyDown, (a) => {
940
- if ([
941
- "Home",
942
- "End",
943
- ...he
944
- ].includes(a.key)) {
945
- let s = r().map(
946
- (l) => l.ref.current
947
- );
948
- if ([
949
- i.dir === "rtl" ? "ArrowRight" : "ArrowLeft",
950
- "ArrowUp",
951
- "End"
952
- ].includes(a.key) && s.reverse(), he.includes(a.key)) {
953
- const l = s.indexOf(a.currentTarget);
954
- s = s.slice(l + 1);
955
- }
956
- setTimeout(
957
- () => fe(s)
958
- ), a.preventDefault();
959
- }
960
- })
961
- })));
962
- });
963
- function ie(e) {
964
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
965
- acceptNode: (o) => {
966
- const r = o.tagName === "INPUT" && o.type === "hidden";
967
- return o.disabled || o.hidden || r ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
968
- }
969
- });
970
- for (; n.nextNode(); )
971
- t.push(n.currentNode);
972
- return t;
973
- }
974
- function fe(e) {
975
- const t = document.activeElement;
976
- return e.some((n) => n === t ? !0 : (n.focus(), document.activeElement !== t));
977
- }
978
- function Xt(e) {
979
- return e.forEach((t) => {
980
- t.dataset.tabindex = t.getAttribute("tabindex") || "", t.setAttribute("tabindex", "-1");
981
- }), () => {
982
- e.forEach((t) => {
983
- const n = t.dataset.tabindex;
984
- t.setAttribute("tabindex", n);
985
- });
986
- };
987
- }
988
- function se(e, t) {
989
- const n = F(t);
990
- H(() => {
991
- let o = 0;
992
- if (e) {
993
- const r = new ResizeObserver(() => {
994
- cancelAnimationFrame(o), o = window.requestAnimationFrame(n);
995
- });
996
- return r.observe(e), () => {
997
- window.cancelAnimationFrame(o), r.unobserve(e);
998
- };
999
- }
1000
- }, [
1001
- e,
1002
- n
1003
- ]);
1004
- }
1005
- function ve(e) {
1006
- return e ? "open" : "closed";
1007
- }
1008
- function Se(e, t) {
1009
- return `${e}-trigger-${t}`;
1010
- }
1011
- function Ke(e, t) {
1012
- return `${e}-content-${t}`;
1013
- }
1014
- function Z(e) {
1015
- return (t) => t.pointerType === "mouse" ? e(t) : void 0;
1016
- }
1017
- const Jt = Ot, Qt = At, Zt = Lt, en = Kt, tn = Vt, nn = Ut, on = zt, rn = Bt, sn = Ht, an = "_enterFromLeft_8k0ri_1", cn = "_enterFromRight_8k0ri_1", un = "_exitToLeft_8k0ri_1", ln = "_exitToRight_8k0ri_1", dn = "_scaleIn_8k0ri_1", fn = "_scaleOut_8k0ri_1", P = {
1018
- "teddy-navigation-menu": "_teddy-navigation-menu_8k0ri_1",
1019
- "teddy-navigation-menu__viewport": "_teddy-navigation-menu__viewport_8k0ri_33",
1020
- "teddy-navigation-menu__list": "_teddy-navigation-menu__list_8k0ri_36",
1021
- "teddy-navigation-menu__top-menu-list": "_teddy-navigation-menu__top-menu-list_8k0ri_55",
1022
- "teddy-navigation-menu__top-menu-trigger": "_teddy-navigation-menu__top-menu-trigger_8k0ri_75",
1023
- "teddy-navigation-menu__top-menu-trigger--small": "_teddy-navigation-menu__top-menu-trigger--small_8k0ri_93",
1024
- "teddy-navigation-menu__top-menu-trigger--button": "_teddy-navigation-menu__top-menu-trigger--button_8k0ri_98",
1025
- "teddy-navigation-menu__content": "_teddy-navigation-menu__content_8k0ri_160",
1026
- enterFromLeft: an,
1027
- enterFromRight: cn,
1028
- exitToLeft: un,
1029
- exitToRight: ln,
1030
- "teddy-navigation-menu__trigger": "_teddy-navigation-menu__trigger_8k0ri_205",
1031
- "teddy-navigation-menu__trigger--small": "_teddy-navigation-menu__trigger--small_8k0ri_223",
1032
- "teddy-navigation-menu__trigger--button": "_teddy-navigation-menu__trigger--button_8k0ri_228",
1033
- "teddy-navigation-menu__link": "_teddy-navigation-menu__link_8k0ri_290",
1034
- "teddy-navigation-menu__link--small": "_teddy-navigation-menu__link--small_8k0ri_308",
1035
- "teddy-navigation-menu__link--button": "_teddy-navigation-menu__link--button_8k0ri_313",
1036
- scaleIn: dn,
1037
- scaleOut: fn
1038
- }, I = "teddy-navigation-menu", ee = h.createContext({
1039
- selectedTopMenu: void 0,
1040
- setSelectedTopMenu: () => {
1041
- },
1042
- contentRef: { current: null },
1043
- focusProxyRef: { current: null },
1044
- topMenuRef: { current: null },
1045
- id: "",
1046
- dir: "ltr",
1047
- orientation: "horizontal",
1048
- onEntryKeyDown: () => {
1049
- },
1050
- onFocusProxyEnter: () => {
1051
- },
1052
- onContentFocusOutside: () => {
1053
- }
1054
- }), Ve = h.forwardRef(
1055
- ({ className: e, defaultTopMenuValue: t, ...n }, o) => {
1056
- const [r, i] = h.useState(t), a = h.useRef(null), u = h.useRef(() => {
1057
- }), s = h.useRef(null), d = h.useRef(null), c = h.useId(), l = h.useCallback((f = "start") => {
1058
- if (a.current) {
1059
- u.current();
1060
- const $ = ae(a.current);
1061
- $.length && me(f === "start" ? $ : $.reverse());
1062
- }
1063
- }, []), g = h.useCallback(() => {
1064
- if (a.current) {
1065
- const f = ae(a.current);
1066
- f.length && (u.current = gn(f));
1067
- }
1068
- }, []), v = K([P[`${I}`]], e);
1069
- return /* @__PURE__ */ A(
1070
- ee.Provider,
1071
- {
1072
- value: {
1073
- contentRef: a,
1074
- focusProxyRef: s,
1075
- topMenuRef: d,
1076
- id: c,
1077
- dir: n.dir || "ltr",
1078
- orientation: n.orientation || "horizontal",
1079
- onEntryKeyDown: l,
1080
- onFocusProxyEnter: l,
1081
- onContentFocusOutside: g,
1082
- selectedTopMenu: r,
1083
- setSelectedTopMenu: i
1084
- },
1085
- children: /* @__PURE__ */ A(Jt, { ...n, ref: o, className: v })
1086
- }
1087
- );
1088
- }
1089
- );
1090
- Ve.displayName = "NavigationMenu";
1091
- const Ue = h.forwardRef(
1092
- ({ className: e, ...t }, n) => {
1093
- const o = K([P[`${I}__top-menu-list`]], e), r = h.useContext(ee), i = ue(r.topMenuRef, n);
1094
- return /* @__PURE__ */ A("ul", { ...t, ref: i, className: o });
1095
- }
1096
- );
1097
- Ue.displayName = "NavigationMenu.TopMenuList";
1098
- const vn = h.forwardRef(
1099
- ({ className: e, ...t }, n) => {
1100
- const o = K([P[`${I}__top-menu-item`]], e);
1101
- return /* @__PURE__ */ A("li", { ...t, ref: n, className: o });
1102
- }
1103
- ), mn = h.forwardRef(
1104
- ({ className: e, ...t }, n) => {
1105
- const o = K(
1106
- [P[`${I}__top-menu-trigger`], P[`${I}__top-menu-trigger--small`]],
1107
- e
1108
- ), r = h.useContext(ee), i = h.useRef(null), a = ue(i, n), u = r.selectedTopMenu === t.value;
1109
- return /* @__PURE__ */ Qe(Ze, { children: [
1110
- /* @__PURE__ */ A(
1111
- "button",
1112
- {
1113
- ...t,
1114
- ref: a,
1115
- className: o,
1116
- "data-state": u ? "open" : "closed",
1117
- "aria-expanded": u,
1118
- "aria-controls": Xe({ value: t.value, baseId: r.id }),
1119
- [Ee]: "",
1120
- onClick: ne(t.onClick, () => {
1121
- r.setSelectedTopMenu(t.value);
1122
- }),
1123
- onKeyDown: ne(t.onKeyDown, (s) => {
1124
- var g;
1125
- const c = { horizontal: "ArrowDown", vertical: r.dir === "rtl" ? "ArrowLeft" : "ArrowRight" }[r.orientation];
1126
- if (u && s.key === c)
1127
- return r.onEntryKeyDown(), s.preventDefault();
1128
- if (["Home", "End", ...we].includes(s.key)) {
1129
- const v = (g = r.topMenuRef.current) == null ? void 0 : g.querySelectorAll(`[${Ee}]`);
1130
- if (!v)
1131
- return;
1132
- let f = Array.from(v == null ? void 0 : v.values());
1133
- if ([r.dir === "rtl" ? "ArrowRight" : "ArrowLeft", "ArrowUp", "End"].includes(s.key) && f.reverse(), we.includes(s.key)) {
1134
- const E = f.indexOf(s.currentTarget);
1135
- f = f.slice(E + 1), me(f), s.preventDefault();
1136
- }
1137
- }
1138
- })
1139
- }
1140
- ),
1141
- u && /* @__PURE__ */ A(
1142
- at,
1143
- {
1144
- "aria-hidden": !0,
1145
- tabIndex: 0,
1146
- ref: r.focusProxyRef,
1147
- onFocus: (s) => {
1148
- const d = r.contentRef.current, c = s.relatedTarget, l = c === i.current, g = d == null ? void 0 : d.contains(c);
1149
- (l || !g) && r.onFocusProxyEnter(l ? "start" : "end");
1150
- }
1151
- }
1152
- )
1153
- ] });
1154
- }
1155
- ), ze = h.forwardRef(
1156
- ({ className: e, variant: t, value: n, ...o }, r) => {
1157
- const i = K([P[`${I}__list`]], [P[`${I}__list--${t}`]], e), a = h.useContext(ee), u = ue(a.contentRef, r), s = a.selectedTopMenu !== void 0, d = a.selectedTopMenu === n;
1158
- return /* @__PURE__ */ A(
1159
- Zt,
1160
- {
1161
- ref: s && d ? u : r,
1162
- id: n && Xe({ value: n, baseId: a.id }),
1163
- hidden: s ? !d : void 0,
1164
- ...o,
1165
- onKeyDown: ne(o.onKeyDown, (c) => {
1166
- var v;
1167
- if (!n)
1168
- return;
1169
- const l = c.altKey || c.ctrlKey || c.metaKey;
1170
- if (c.key === "Tab" && !l) {
1171
- const f = ae(c.currentTarget), $ = document.activeElement, b = f.findIndex((p) => p === $), T = c.shiftKey ? f.slice(0, b).reverse() : f.slice(b + 1, f.length);
1172
- me(T) ? c.preventDefault() : ((v = a.focusProxyRef.current) == null || v.focus(), a.onContentFocusOutside());
1173
- }
1174
- }),
1175
- style: s && !d ? { display: "none", ...o.style } : o.style,
1176
- className: i
1177
- }
1178
- );
1179
- }
1180
- );
1181
- ze.displayName = "NavigationMenu.List";
1182
- const We = h.forwardRef(
1183
- ({ className: e, ...t }, n) => {
1184
- const o = K([P[`${I}__item`]], e);
1185
- return /* @__PURE__ */ A(en, { ...t, ref: n, className: o });
1186
- }
1187
- );
1188
- We.displayName = "NavigationMenu.Item";
1189
- const Be = h.forwardRef(
1190
- ({ className: e, variant: t = "default", ...n }, o) => {
1191
- const r = K(
1192
- [P[`${I}__trigger`]],
1193
- [P[`${I}__trigger--${t}`]],
1194
- e
1195
- );
1196
- return /* @__PURE__ */ A(
1197
- tn,
1198
- {
1199
- onPointerEnter: (i) => i.preventDefault(),
1200
- onPointerMove: (i) => i.preventDefault(),
1201
- onPointerLeave: (i) => i.preventDefault(),
1202
- ...n,
1203
- ref: o,
1204
- className: r,
1205
- "data-text": qe(n.children)
1206
- }
1207
- );
1208
- }
1209
- );
1210
- Be.displayName = "NavigationMenu.Trigger";
1211
- const $n = h.forwardRef(
1212
- ({ className: e, variant: t = "default", ...n }, o) => {
1213
- const r = K(
1214
- [P[`${I}__content`]],
1215
- [P[`${I}__content--${t}`]],
1216
- e
1217
- );
1218
- return /* @__PURE__ */ A(
1219
- rn,
1220
- {
1221
- onPointerEnter: (i) => i.preventDefault(),
1222
- onPointerLeave: (i) => i.preventDefault(),
1223
- ...n,
1224
- ref: o,
1225
- className: r
1226
- }
1227
- );
1228
- }
1229
- ), Ge = h.forwardRef(
1230
- ({ className: e, variant: t = "default", ...n }, o) => {
1231
- const r = K([P[`${I}__link`]], [P[`${I}__link--${t}`]], e);
1232
- return /* @__PURE__ */ A(
1233
- nn,
1234
- {
1235
- ...n,
1236
- ref: o,
1237
- className: r,
1238
- "data-text": qe(n.children)
1239
- }
1240
- );
1241
- }
1242
- );
1243
- Ge.displayName = "NavigationMenu.Link";
1244
- const He = h.forwardRef(
1245
- ({ className: e, ...t }, n) => {
1246
- const o = K([P[`${I}__indicator`]], e);
1247
- return /* @__PURE__ */ A(on, { ...t, ref: n, className: o });
1248
- }
1249
- );
1250
- He.displayName = "NavigationMenu.Indicator";
1251
- const je = h.forwardRef(
1252
- ({ className: e, ...t }, n) => {
1253
- const o = K([P[`${I}__viewport`]], e);
1254
- return /* @__PURE__ */ A(sn, { ...t, ref: n, className: o });
1255
- }
1256
- );
1257
- je.displayName = "NavigationMenu.Viewport";
1258
- const Ye = h.forwardRef(
1259
- ({ className: e, ...t }, n) => {
1260
- const o = K([P[`${I}__sub`]], e);
1261
- return /* @__PURE__ */ A(Qt, { ...t, ref: n, className: o });
1262
- }
1263
- );
1264
- Ye.displayName = "NavigationMenu.Sub";
1265
- function qe(e) {
1266
- function t(n) {
1267
- if (typeof n == "string")
1268
- return n;
1269
- if (h.isValidElement(n) && n.props.children)
1270
- return t(n.props.children);
1271
- if (Array.isArray(n))
1272
- for (let o = n.length - 1; o >= 0; o--) {
1273
- const r = t(n[o]);
1274
- if (r)
1275
- return r;
1276
- }
1277
- }
1278
- return t(e);
1279
- }
1280
- function ae(e) {
1281
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
1282
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1283
- acceptNode: (o) => {
1284
- const r = o.tagName === "INPUT" && o.type === "hidden";
1285
- return o.disabled || o.hidden || r ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
1286
- }
1287
- });
1288
- for (; n.nextNode(); )
1289
- t.push(n.currentNode);
1290
- return t;
1291
- }
1292
- function me(e) {
1293
- const t = document.activeElement;
1294
- return e.some((n) => n === t ? !0 : (n.focus(), document.activeElement !== t));
1295
- }
1296
- function gn(e) {
1297
- return e.forEach((t) => {
1298
- t.dataset.tabindex = t.getAttribute("tabindex") || "", t.setAttribute("tabindex", "-1");
1299
- }), () => {
1300
- e.forEach((t) => {
1301
- const n = t.dataset.tabindex;
1302
- t.setAttribute("tabindex", n);
1303
- });
1304
- };
1305
- }
1306
- const Ee = "data-teddy-top-selector-trigger", we = ["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"];
1307
- function Xe(e) {
1308
- return `teddy-navigation-menu-${e.baseId}-${e.value}-content`;
1309
- }
1310
- const Tn = Object.assign(Ve, {
1311
- List: ze,
1312
- Item: We,
1313
- Trigger: Be,
1314
- Content: $n,
1315
- Link: Ge,
1316
- Indicator: He,
1317
- Viewport: je,
1318
- Sub: Ye,
1319
- TopMenuList: Ue,
1320
- TopMenuItem: vn,
1321
- TopMenuTrigger: mn
1322
- });
1323
- export {
1324
- H as $,
1325
- Tn as N,
1326
- Ne as a,
1327
- Me as b,
1328
- x as c,
1329
- wt as d,
1330
- Te as e,
1331
- Y as f,
1332
- xe as g,
1333
- dt as h
1334
- };