@telia/teddy 0.0.15 → 0.0.16

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 (116) hide show
  1. package/dist/components/accordion/accordion.d.ts +2 -1
  2. package/dist/components/accordion/accordion.js +90 -24
  3. package/dist/components/accordion/index.js +2 -2
  4. package/dist/components/badge/badge.js +40 -24
  5. package/dist/components/badge/index.js +2 -2
  6. package/dist/components/box/box.js +14 -10
  7. package/dist/components/box/index.js +2 -2
  8. package/dist/components/button/button.js +60 -52
  9. package/dist/components/button/index.js +2 -2
  10. package/dist/components/card/card.d.ts +29 -3
  11. package/dist/components/card/card.js +202 -25
  12. package/dist/components/card/index.js +2 -2
  13. package/dist/components/field-error-text/field-error-text.js +21 -19
  14. package/dist/components/field-error-text/index.js +2 -2
  15. package/dist/components/flex/flex.js +15 -12
  16. package/dist/components/flex/index.js +2 -2
  17. package/dist/components/grid/grid.js +15 -12
  18. package/dist/components/grid/index.js +2 -2
  19. package/dist/components/heading/heading.js +22 -19
  20. package/dist/components/heading/index.js +2 -2
  21. package/dist/components/helper-text/helper-text.js +14 -13
  22. package/dist/components/helper-text/index.js +2 -2
  23. package/dist/components/icon/icon.js +16 -14
  24. package/dist/components/icon/index.js +4 -4
  25. package/dist/components/index.js +51 -46
  26. package/dist/components/input/index.js +3 -3
  27. package/dist/components/input/input.js +79 -66
  28. package/dist/components/label/index.js +2 -2
  29. package/dist/components/label/label.js +17 -23
  30. package/dist/components/link/index.js +2 -2
  31. package/dist/components/link/link.js +20 -19
  32. package/dist/components/modal/index.js +2 -2
  33. package/dist/components/modal/modal.js +173 -14
  34. package/dist/components/navigation-menu/index.js +2 -2
  35. package/dist/components/navigation-menu/navigation-menu.js +391 -8
  36. package/dist/components/notification/index.js +2 -2
  37. package/dist/components/notification/notification.d.ts +8 -7
  38. package/dist/components/notification/notification.js +96 -24
  39. package/dist/components/radio-group/index.js +2 -2
  40. package/dist/components/radio-group/radio-group.js +91 -8
  41. package/dist/components/spinner/index.js +2 -2
  42. package/dist/components/spinner/spinner.js +36 -29
  43. package/dist/components/text/index.js +2 -2
  44. package/dist/components/text/text.js +18 -17
  45. package/dist/components/text-field/index.js +2 -2
  46. package/dist/components/text-field/text-field.js +110 -90
  47. package/dist/components/text-spacing/index.js +2 -2
  48. package/dist/components/text-spacing/text-spacing.js +14 -12
  49. package/dist/components/toggle/index.js +2 -2
  50. package/dist/components/toggle/toggle.d.ts +1 -1
  51. package/dist/components/toggle/toggle.js +84 -23
  52. package/dist/components/visually-hidden/index.js +2 -2
  53. package/dist/components/visually-hidden/visually-hidden.js +17 -15
  54. package/dist/icons/category.js +2 -2
  55. package/dist/icons/name.js +2 -2
  56. package/dist/main.js +359 -61
  57. package/dist/style.css +3402 -0
  58. package/dist/tokens/border/variables.js +18 -10
  59. package/dist/tokens/breakpoint/variables.js +8 -5
  60. package/dist/tokens/color/variables.js +452 -227
  61. package/dist/tokens/index.d.ts +7 -7
  62. package/dist/tokens/index.js +308 -14
  63. package/dist/tokens/motion/variables.js +22 -12
  64. package/dist/tokens/shadow/variables.js +8 -5
  65. package/dist/tokens/spacing/variables.js +46 -24
  66. package/dist/tokens/typography/variables.js +48 -25
  67. package/dist/utils/action.js +10 -7
  68. package/dist/utils/composeEventHandlers.js +7 -5
  69. package/dist/utils/composeRefs.js +13 -9
  70. package/dist/utils/layout/align.js +5 -4
  71. package/dist/utils/layout/flex.js +25 -18
  72. package/dist/utils/layout/gap.js +7 -6
  73. package/dist/utils/layout/grid.js +31 -24
  74. package/dist/utils/layout/height.js +12 -11
  75. package/dist/utils/layout/index.js +76 -59
  76. package/dist/utils/layout/inset.js +10 -9
  77. package/dist/utils/layout/justify.js +6 -5
  78. package/dist/utils/layout/margin.js +10 -9
  79. package/dist/utils/layout/padding.js +10 -9
  80. package/dist/utils/layout/position.js +6 -5
  81. package/dist/utils/layout/util.js +7 -6
  82. package/dist/utils/layout/width.js +8 -7
  83. package/package.json +21 -14
  84. package/dist/assets/badge.css +0 -1
  85. package/dist/assets/button.css +0 -1
  86. package/dist/assets/field-error-text.css +0 -1
  87. package/dist/assets/flex.css +0 -1
  88. package/dist/assets/grid.css +0 -1
  89. package/dist/assets/heading.css +0 -1
  90. package/dist/assets/helper-text.css +0 -1
  91. package/dist/assets/icon.css +0 -1
  92. package/dist/assets/input.css +0 -1
  93. package/dist/assets/label.css +0 -1
  94. package/dist/assets/link.css +0 -1
  95. package/dist/assets/main.css +0 -1
  96. package/dist/assets/navigation-menu.css +0 -1
  97. package/dist/assets/radio-group.css +0 -1
  98. package/dist/assets/spinner.css +0 -1
  99. package/dist/assets/text-field.css +0 -1
  100. package/dist/assets/text-spacing.css +0 -1
  101. package/dist/assets/text.css +0 -1
  102. package/dist/assets/visually-hidden.css +0 -1
  103. package/dist/badge-Cnug5TzH.js +0 -1855
  104. package/dist/clsx-DB4S2d7J.js +0 -22
  105. package/dist/index-DM5e-Whg.js +0 -43
  106. package/dist/index-DpfSJps6.js +0 -75
  107. package/dist/index-FPIZOCcD.js +0 -305
  108. package/dist/navigation-menu-DKuyW8zE.js +0 -1036
  109. package/dist/radio-group-B--zT3OL.js +0 -440
  110. package/dist/variables-BKiPmtHY.js +0 -458
  111. package/dist/variables-BkY5b0io.js +0 -14
  112. package/dist/variables-Bq0YUbLS.js +0 -14
  113. package/dist/variables-CDK515QX.js +0 -52
  114. package/dist/variables-CMRTN8qo.js +0 -28
  115. package/dist/variables-Dmoh9YtD.js +0 -54
  116. package/dist/variables-IczXZ5CN.js +0 -24
@@ -1,1036 +0,0 @@
1
- import './assets/navigation-menu.css';
2
- import { jsx as F, jsxs as He, Fragment as Ge } from "react/jsx-runtime";
3
- import E, { useEffect as z, forwardRef as I, useContext as Ye, useState as K, createElement as d, useRef as P, createContext as je, useCallback as U, Fragment as de, useMemo as Xe } from "react";
4
- import { c as A } from "./clsx-DB4S2d7J.js";
5
- import { b as B, _ as M, c as qe } from "./index-DpfSJps6.js";
6
- import Je from "react-dom";
7
- import { d as V, e as T, $ as _e, a as Qe, b as Ze, c as we, i as et, f as ye, h as X, g as Q } from "./index-FPIZOCcD.js";
8
- import { $ as L, a as Z } from "./index-DM5e-Whg.js";
9
- import { useComposedRefs as q } from "./utils/composeRefs.js";
10
- import { VisuallyHidden as tt } from "./components/visually-hidden/visually-hidden.js";
11
- import { composeEventHandlers as ee } from "./utils/composeEventHandlers.js";
12
- function nt(e, t = globalThis == null ? void 0 : globalThis.document) {
13
- const n = V(e);
14
- z(() => {
15
- const o = (r) => {
16
- r.key === "Escape" && n(r);
17
- };
18
- return t.addEventListener("keydown", o), () => t.removeEventListener("keydown", o);
19
- }, [
20
- n,
21
- t
22
- ]);
23
- }
24
- const te = "dismissableLayer.update", ot = "dismissableLayer.pointerDownOutside", rt = "dismissableLayer.focusOutside";
25
- let fe;
26
- const it = /* @__PURE__ */ je({
27
- layers: /* @__PURE__ */ new Set(),
28
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
29
- branches: /* @__PURE__ */ new Set()
30
- }), at = /* @__PURE__ */ I((e, t) => {
31
- var n;
32
- const { disableOutsidePointerEvents: o = !1, onEscapeKeyDown: r, onPointerDownOutside: i, onFocusOutside: a, onInteractOutside: u, onDismiss: c, ...f } = e, s = Ye(it), [l, h] = K(null), v = (n = l == null ? void 0 : l.ownerDocument) !== null && n !== void 0 ? n : globalThis == null ? void 0 : globalThis.document, [, g] = K({}), $ = B(
33
- t,
34
- (y) => h(y)
35
- ), w = Array.from(s.layers), [x] = [
36
- ...s.layersWithOutsidePointerEventsDisabled
37
- ].slice(-1), D = w.indexOf(x), m = l ? w.indexOf(l) : -1, b = s.layersWithOutsidePointerEventsDisabled.size > 0, p = m >= D, C = st((y) => {
38
- const _ = y.target, S = [
39
- ...s.branches
40
- ].some(
41
- (W) => W.contains(_)
42
- );
43
- !p || S || (i == null || i(y), u == null || u(y), y.defaultPrevented || c == null || c());
44
- }, v), O = ct((y) => {
45
- const _ = y.target;
46
- [
47
- ...s.branches
48
- ].some(
49
- (W) => W.contains(_)
50
- ) || (a == null || a(y), u == null || u(y), y.defaultPrevented || c == null || c());
51
- }, v);
52
- return nt((y) => {
53
- m === s.layers.size - 1 && (r == null || r(y), !y.defaultPrevented && c && (y.preventDefault(), c()));
54
- }, v), z(() => {
55
- if (l)
56
- return o && (s.layersWithOutsidePointerEventsDisabled.size === 0 && (fe = v.body.style.pointerEvents, v.body.style.pointerEvents = "none"), s.layersWithOutsidePointerEventsDisabled.add(l)), s.layers.add(l), ve(), () => {
57
- o && s.layersWithOutsidePointerEventsDisabled.size === 1 && (v.body.style.pointerEvents = fe);
58
- };
59
- }, [
60
- l,
61
- v,
62
- o,
63
- s
64
- ]), z(() => () => {
65
- l && (s.layers.delete(l), s.layersWithOutsidePointerEventsDisabled.delete(l), ve());
66
- }, [
67
- l,
68
- s
69
- ]), z(() => {
70
- const y = () => g({});
71
- return document.addEventListener(te, y), () => document.removeEventListener(te, y);
72
- }, []), /* @__PURE__ */ d(L.div, M({}, f, {
73
- ref: $,
74
- style: {
75
- pointerEvents: b ? p ? "auto" : "none" : void 0,
76
- ...e.style
77
- },
78
- onFocusCapture: T(e.onFocusCapture, O.onFocusCapture),
79
- onBlurCapture: T(e.onBlurCapture, O.onBlurCapture),
80
- onPointerDownCapture: T(e.onPointerDownCapture, C.onPointerDownCapture)
81
- }));
82
- });
83
- function st(e, t = globalThis == null ? void 0 : globalThis.document) {
84
- const n = V(e), o = P(!1), r = P(() => {
85
- });
86
- return z(() => {
87
- const i = (u) => {
88
- if (u.target && !o.current) {
89
- let f = function() {
90
- Ee(ot, n, c, {
91
- discrete: !0
92
- });
93
- };
94
- const c = {
95
- originalEvent: u
96
- };
97
- u.pointerType === "touch" ? (t.removeEventListener("click", r.current), r.current = f, t.addEventListener("click", r.current, {
98
- once: !0
99
- })) : f();
100
- } else
101
- t.removeEventListener("click", r.current);
102
- o.current = !1;
103
- }, a = window.setTimeout(() => {
104
- t.addEventListener("pointerdown", i);
105
- }, 0);
106
- return () => {
107
- window.clearTimeout(a), t.removeEventListener("pointerdown", i), t.removeEventListener("click", r.current);
108
- };
109
- }, [
110
- t,
111
- n
112
- ]), {
113
- // ensures we check React component tree (not just DOM tree)
114
- onPointerDownCapture: () => o.current = !0
115
- };
116
- }
117
- function ct(e, t = globalThis == null ? void 0 : globalThis.document) {
118
- const n = V(e), o = P(!1);
119
- return z(() => {
120
- const r = (i) => {
121
- i.target && !o.current && Ee(rt, n, {
122
- originalEvent: i
123
- }, {
124
- discrete: !1
125
- });
126
- };
127
- return t.addEventListener("focusin", r), () => t.removeEventListener("focusin", r);
128
- }, [
129
- t,
130
- n
131
- ]), {
132
- onFocusCapture: () => o.current = !0,
133
- onBlurCapture: () => o.current = !1
134
- };
135
- }
136
- function ve() {
137
- const e = new CustomEvent(te);
138
- document.dispatchEvent(e);
139
- }
140
- function Ee(e, t, n, { discrete: o }) {
141
- const r = n.originalEvent.target, i = new CustomEvent(e, {
142
- bubbles: !1,
143
- cancelable: !0,
144
- detail: n
145
- });
146
- t && r.addEventListener(e, t, {
147
- once: !0
148
- }), o ? Z(r, i) : r.dispatchEvent(i);
149
- }
150
- const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(L.span, M({}, e, {
151
- ref: t,
152
- style: {
153
- // See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
154
- position: "absolute",
155
- border: 0,
156
- width: 1,
157
- height: 1,
158
- padding: 0,
159
- margin: -1,
160
- overflow: "hidden",
161
- clip: "rect(0, 0, 0, 0)",
162
- whiteSpace: "nowrap",
163
- wordWrap: "normal",
164
- ...e.style
165
- }
166
- }))), lt = ut, G = "NavigationMenu", [ae, he, dt] = _e(G), [ne, ft, vt] = _e(G), [se, fn] = Qe(G, [
167
- dt,
168
- vt
169
- ]), [gt, k] = se(G), [$t, mt] = se(G), pt = /* @__PURE__ */ I((e, t) => {
170
- const { __scopeNavigationMenu: n, value: o, onValueChange: r, defaultValue: i, delayDuration: a = 200, skipDelayDuration: u = 300, orientation: c = "horizontal", dir: f, ...s } = e, [l, h] = K(null), v = B(
171
- t,
172
- (_) => h(_)
173
- ), g = Ze(f), $ = P(0), w = P(0), x = P(0), [D, m] = K(!0), [b = "", p] = we({
174
- prop: o,
175
- onChange: (_) => {
176
- const S = _ !== "", W = u > 0;
177
- S ? (window.clearTimeout(x.current), W && m(!1)) : (window.clearTimeout(x.current), x.current = window.setTimeout(
178
- () => m(!0),
179
- u
180
- )), r == null || r(_);
181
- },
182
- defaultProp: i
183
- }), C = U(() => {
184
- window.clearTimeout(w.current), w.current = window.setTimeout(
185
- () => p(""),
186
- 150
187
- );
188
- }, [
189
- p
190
- ]), O = U((_) => {
191
- window.clearTimeout(w.current), p(_);
192
- }, [
193
- p
194
- ]), y = U((_) => {
195
- b === _ ? window.clearTimeout(w.current) : $.current = window.setTimeout(() => {
196
- window.clearTimeout(w.current), p(_);
197
- }, a);
198
- }, [
199
- b,
200
- p,
201
- a
202
- ]);
203
- return z(() => () => {
204
- window.clearTimeout($.current), window.clearTimeout(w.current), window.clearTimeout(x.current);
205
- }, []), /* @__PURE__ */ d(Ce, {
206
- scope: n,
207
- isRootMenu: !0,
208
- value: b,
209
- dir: g,
210
- orientation: c,
211
- rootNavigationMenu: l,
212
- onTriggerEnter: (_) => {
213
- window.clearTimeout($.current), D ? y(_) : O(_);
214
- },
215
- onTriggerLeave: () => {
216
- window.clearTimeout($.current), C();
217
- },
218
- onContentEnter: () => window.clearTimeout(w.current),
219
- onContentLeave: C,
220
- onItemSelect: (_) => {
221
- p(
222
- (S) => S === _ ? "" : _
223
- );
224
- },
225
- onItemDismiss: () => p("")
226
- }, /* @__PURE__ */ d(L.nav, M({
227
- "aria-label": "Main",
228
- "data-orientation": c,
229
- dir: g
230
- }, s, {
231
- ref: v
232
- })));
233
- }), bt = "NavigationMenuSub", _t = /* @__PURE__ */ I((e, t) => {
234
- const { __scopeNavigationMenu: n, value: o, onValueChange: r, defaultValue: i, orientation: a = "horizontal", ...u } = e, c = k(bt, n), [f = "", s] = we({
235
- prop: o,
236
- onChange: r,
237
- defaultProp: i
238
- });
239
- return /* @__PURE__ */ d(Ce, {
240
- scope: n,
241
- isRootMenu: !1,
242
- value: f,
243
- dir: c.dir,
244
- orientation: a,
245
- rootNavigationMenu: c.rootNavigationMenu,
246
- onTriggerEnter: (l) => s(l),
247
- onItemSelect: (l) => s(l),
248
- onItemDismiss: () => s("")
249
- }, /* @__PURE__ */ d(L.div, M({
250
- "data-orientation": a
251
- }, u, {
252
- ref: t
253
- })));
254
- }), Ce = (e) => {
255
- const { scope: t, isRootMenu: n, rootNavigationMenu: o, dir: r, orientation: i, children: a, value: u, onItemSelect: c, onItemDismiss: f, onTriggerEnter: s, onTriggerLeave: l, onContentEnter: h, onContentLeave: v } = e, [g, $] = K(null), [w, x] = K(/* @__PURE__ */ new Map()), [D, m] = K(null);
256
- return /* @__PURE__ */ d(gt, {
257
- scope: t,
258
- isRootMenu: n,
259
- rootNavigationMenu: o,
260
- value: u,
261
- previousValue: et(u),
262
- baseId: ye(),
263
- dir: r,
264
- orientation: i,
265
- viewport: g,
266
- onViewportChange: $,
267
- indicatorTrack: D,
268
- onIndicatorTrackChange: m,
269
- onTriggerEnter: V(s),
270
- onTriggerLeave: V(l),
271
- onContentEnter: V(h),
272
- onContentLeave: V(v),
273
- onItemSelect: V(c),
274
- onItemDismiss: V(f),
275
- onViewportContentChange: U((b, p) => {
276
- x((C) => (C.set(b, p), new Map(C)));
277
- }, []),
278
- onViewportContentRemove: U((b) => {
279
- x((p) => p.has(b) ? (p.delete(b), new Map(p)) : p);
280
- }, [])
281
- }, /* @__PURE__ */ d(ae.Provider, {
282
- scope: t
283
- }, /* @__PURE__ */ d($t, {
284
- scope: t,
285
- items: w
286
- }, a)));
287
- }, wt = "NavigationMenuList", yt = /* @__PURE__ */ I((e, t) => {
288
- const { __scopeNavigationMenu: n, ...o } = e, r = k(wt, n), i = /* @__PURE__ */ d(L.ul, M({
289
- "data-orientation": r.orientation
290
- }, o, {
291
- ref: t
292
- }));
293
- return /* @__PURE__ */ d(L.div, {
294
- style: {
295
- position: "relative"
296
- },
297
- ref: r.onIndicatorTrackChange
298
- }, /* @__PURE__ */ d(ae.Slot, {
299
- scope: n
300
- }, r.isRootMenu ? /* @__PURE__ */ d(Re, {
301
- asChild: !0
302
- }, i) : i));
303
- }), Et = "NavigationMenuItem", [ht, xe] = se(Et), Ct = /* @__PURE__ */ I((e, t) => {
304
- const { __scopeNavigationMenu: n, value: o, ...r } = e, i = ye(), a = o || i || "LEGACY_REACT_AUTO_VALUE", u = P(null), c = P(null), f = P(null), s = P(() => {
305
- }), l = P(!1), h = U((g = "start") => {
306
- if (u.current) {
307
- s.current();
308
- const $ = oe(u.current);
309
- $.length && ce(g === "start" ? $ : $.reverse());
310
- }
311
- }, []), v = U(() => {
312
- if (u.current) {
313
- const g = oe(u.current);
314
- g.length && (s.current = Lt(g));
315
- }
316
- }, []);
317
- return /* @__PURE__ */ d(ht, {
318
- scope: n,
319
- value: a,
320
- triggerRef: c,
321
- contentRef: u,
322
- focusProxyRef: f,
323
- wasEscapeCloseRef: l,
324
- onEntryKeyDown: h,
325
- onFocusProxyEnter: h,
326
- onRootContentClose: v,
327
- onContentFocusOutside: v
328
- }, /* @__PURE__ */ d(L.li, M({}, r, {
329
- ref: t
330
- })));
331
- }), ge = "NavigationMenuTrigger", xt = /* @__PURE__ */ I((e, t) => {
332
- const { __scopeNavigationMenu: n, disabled: o, ...r } = e, i = k(ge, e.__scopeNavigationMenu), a = xe(ge, e.__scopeNavigationMenu), u = P(null), c = B(u, a.triggerRef, t), f = Pe(i.baseId, a.value), s = De(i.baseId, a.value), l = P(!1), h = P(!1), v = a.value === i.value;
333
- return /* @__PURE__ */ d(de, null, /* @__PURE__ */ d(ae.ItemSlot, {
334
- scope: n,
335
- value: a.value
336
- }, /* @__PURE__ */ d(Ie, {
337
- asChild: !0
338
- }, /* @__PURE__ */ d(L.button, M({
339
- id: f,
340
- disabled: o,
341
- "data-disabled": o ? "" : void 0,
342
- "data-state": ue(v),
343
- "aria-expanded": v,
344
- "aria-controls": s
345
- }, r, {
346
- ref: c,
347
- onPointerEnter: T(e.onPointerEnter, () => {
348
- h.current = !1, a.wasEscapeCloseRef.current = !1;
349
- }),
350
- onPointerMove: T(e.onPointerMove, j(() => {
351
- o || h.current || a.wasEscapeCloseRef.current || l.current || (i.onTriggerEnter(a.value), l.current = !0);
352
- })),
353
- onPointerLeave: T(e.onPointerLeave, j(() => {
354
- o || (i.onTriggerLeave(), l.current = !1);
355
- })),
356
- onClick: T(e.onClick, () => {
357
- i.onItemSelect(a.value), h.current = v;
358
- }),
359
- onKeyDown: T(e.onKeyDown, (g) => {
360
- const w = {
361
- horizontal: "ArrowDown",
362
- vertical: i.dir === "rtl" ? "ArrowLeft" : "ArrowRight"
363
- }[i.orientation];
364
- v && g.key === w && (a.onEntryKeyDown(), g.preventDefault());
365
- })
366
- })))), v && /* @__PURE__ */ d(de, null, /* @__PURE__ */ d(lt, {
367
- "aria-hidden": !0,
368
- tabIndex: 0,
369
- ref: a.focusProxyRef,
370
- onFocus: (g) => {
371
- const $ = a.contentRef.current, w = g.relatedTarget, x = w === u.current, D = $ == null ? void 0 : $.contains(w);
372
- (x || !D) && a.onFocusProxyEnter(x ? "start" : "end");
373
- }
374
- }), i.viewport && /* @__PURE__ */ d("span", {
375
- "aria-owns": s
376
- })));
377
- }), $e = "navigationMenu.linkSelect", Tt = /* @__PURE__ */ I((e, t) => {
378
- const { __scopeNavigationMenu: n, active: o, onSelect: r, ...i } = e;
379
- return /* @__PURE__ */ d(Ie, {
380
- asChild: !0
381
- }, /* @__PURE__ */ d(L.a, M({
382
- "data-active": o ? "" : void 0,
383
- "aria-current": o ? "page" : void 0
384
- }, i, {
385
- ref: t,
386
- onClick: T(e.onClick, (a) => {
387
- const u = a.target, c = new CustomEvent($e, {
388
- bubbles: !0,
389
- cancelable: !0
390
- });
391
- if (u.addEventListener(
392
- $e,
393
- (f) => r == null ? void 0 : r(f),
394
- {
395
- once: !0
396
- }
397
- ), Z(u, c), !c.defaultPrevented && !a.metaKey) {
398
- const f = new CustomEvent(Y, {
399
- bubbles: !0,
400
- cancelable: !0
401
- });
402
- Z(u, f);
403
- }
404
- }, {
405
- checkForDefaultPrevented: !1
406
- })
407
- })));
408
- }), Te = "NavigationMenuIndicator", Mt = /* @__PURE__ */ I((e, t) => {
409
- const { forceMount: n, ...o } = e, r = k(Te, e.__scopeNavigationMenu), i = !!r.value;
410
- return r.indicatorTrack ? /* @__PURE__ */ Je.createPortal(/* @__PURE__ */ d(X, {
411
- present: n || i
412
- }, /* @__PURE__ */ d(Nt, M({}, o, {
413
- ref: t
414
- }))), r.indicatorTrack) : null;
415
- }), Nt = /* @__PURE__ */ I((e, t) => {
416
- const { __scopeNavigationMenu: n, ...o } = e, r = k(Te, n), i = he(n), [a, u] = K(null), [c, f] = K(null), s = r.orientation === "horizontal", l = !!r.value;
417
- z(() => {
418
- var v;
419
- const $ = (v = i().find(
420
- (w) => w.value === r.value
421
- )) === null || v === void 0 ? void 0 : v.ref.current;
422
- $ && u($);
423
- }, [
424
- i,
425
- r.value
426
- ]);
427
- const h = () => {
428
- a && f({
429
- size: s ? a.offsetWidth : a.offsetHeight,
430
- offset: s ? a.offsetLeft : a.offsetTop
431
- });
432
- };
433
- return re(a, h), re(r.indicatorTrack, h), c ? /* @__PURE__ */ d(L.div, M({
434
- "aria-hidden": !0,
435
- "data-state": l ? "visible" : "hidden",
436
- "data-orientation": r.orientation
437
- }, o, {
438
- ref: t,
439
- style: {
440
- position: "absolute",
441
- ...s ? {
442
- left: 0,
443
- width: c.size + "px",
444
- transform: `translateX(${c.offset}px)`
445
- } : {
446
- top: 0,
447
- height: c.size + "px",
448
- transform: `translateY(${c.offset}px)`
449
- },
450
- ...o.style
451
- }
452
- })) : null;
453
- }), H = "NavigationMenuContent", Rt = /* @__PURE__ */ I((e, t) => {
454
- const { forceMount: n, ...o } = e, r = k(H, e.__scopeNavigationMenu), i = xe(H, e.__scopeNavigationMenu), a = B(i.contentRef, t), u = i.value === r.value, c = {
455
- value: i.value,
456
- triggerRef: i.triggerRef,
457
- focusProxyRef: i.focusProxyRef,
458
- wasEscapeCloseRef: i.wasEscapeCloseRef,
459
- onContentFocusOutside: i.onContentFocusOutside,
460
- onRootContentClose: i.onRootContentClose,
461
- ...o
462
- };
463
- return r.viewport ? /* @__PURE__ */ d(It, M({
464
- forceMount: n
465
- }, c, {
466
- ref: a
467
- })) : /* @__PURE__ */ d(X, {
468
- present: n || u
469
- }, /* @__PURE__ */ d(Me, M({
470
- "data-state": ue(u)
471
- }, c, {
472
- ref: a,
473
- onPointerEnter: T(e.onPointerEnter, r.onContentEnter),
474
- onPointerLeave: T(e.onPointerLeave, j(r.onContentLeave)),
475
- style: {
476
- // Prevent interaction when animating out
477
- pointerEvents: !u && r.isRootMenu ? "none" : void 0,
478
- ...c.style
479
- }
480
- })));
481
- }), It = /* @__PURE__ */ I((e, t) => {
482
- const n = k(H, e.__scopeNavigationMenu), { onViewportContentChange: o, onViewportContentRemove: r } = n;
483
- return Q(() => {
484
- o(e.value, {
485
- ref: t,
486
- ...e
487
- });
488
- }, [
489
- e,
490
- t,
491
- o
492
- ]), Q(() => () => r(e.value), [
493
- e.value,
494
- r
495
- ]), null;
496
- }), Y = "navigationMenu.rootContentDismiss", Me = /* @__PURE__ */ I((e, t) => {
497
- const { __scopeNavigationMenu: n, value: o, triggerRef: r, focusProxyRef: i, wasEscapeCloseRef: a, onRootContentClose: u, onContentFocusOutside: c, ...f } = e, s = k(H, n), l = P(null), h = B(l, t), v = Pe(s.baseId, o), g = De(s.baseId, o), $ = he(n), w = P(null), { onItemDismiss: x } = s;
498
- z(() => {
499
- const m = l.current;
500
- if (s.isRootMenu && m) {
501
- const b = () => {
502
- var p;
503
- x(), u(), m.contains(document.activeElement) && ((p = r.current) === null || p === void 0 || p.focus());
504
- };
505
- return m.addEventListener(Y, b), () => m.removeEventListener(Y, b);
506
- }
507
- }, [
508
- s.isRootMenu,
509
- e.value,
510
- r,
511
- x,
512
- u
513
- ]);
514
- const D = Xe(() => {
515
- const b = $().map(
516
- (S) => S.value
517
- );
518
- s.dir === "rtl" && b.reverse();
519
- const p = b.indexOf(s.value), C = b.indexOf(s.previousValue), O = o === s.value, y = C === b.indexOf(o);
520
- if (!O && !y)
521
- return w.current;
522
- const _ = (() => {
523
- if (p !== C) {
524
- if (O && C !== -1)
525
- return p > C ? "from-end" : "from-start";
526
- if (y && p !== -1)
527
- return p > C ? "to-start" : "to-end";
528
- }
529
- return null;
530
- })();
531
- return w.current = _, _;
532
- }, [
533
- s.previousValue,
534
- s.value,
535
- s.dir,
536
- $,
537
- o
538
- ]);
539
- return /* @__PURE__ */ d(Re, {
540
- asChild: !0
541
- }, /* @__PURE__ */ d(at, M({
542
- id: g,
543
- "aria-labelledby": v,
544
- "data-motion": D,
545
- "data-orientation": s.orientation
546
- }, f, {
547
- ref: h,
548
- onDismiss: () => {
549
- var m;
550
- const b = new Event(Y, {
551
- bubbles: !0,
552
- cancelable: !0
553
- });
554
- (m = l.current) === null || m === void 0 || m.dispatchEvent(b);
555
- },
556
- onFocusOutside: T(e.onFocusOutside, (m) => {
557
- var b;
558
- c();
559
- const p = m.target;
560
- (b = s.rootNavigationMenu) !== null && b !== void 0 && b.contains(p) && m.preventDefault();
561
- }),
562
- onPointerDownOutside: T(e.onPointerDownOutside, (m) => {
563
- var b;
564
- const p = m.target, C = $().some((y) => {
565
- var _;
566
- return (_ = y.ref.current) === null || _ === void 0 ? void 0 : _.contains(p);
567
- }), O = s.isRootMenu && ((b = s.viewport) === null || b === void 0 ? void 0 : b.contains(p));
568
- (C || O || !s.isRootMenu) && m.preventDefault();
569
- }),
570
- onKeyDown: T(e.onKeyDown, (m) => {
571
- const b = m.altKey || m.ctrlKey || m.metaKey;
572
- if (m.key === "Tab" && !b) {
573
- const O = oe(m.currentTarget), y = document.activeElement, _ = O.findIndex(
574
- (Be) => Be === y
575
- ), W = m.shiftKey ? O.slice(0, _).reverse() : O.slice(_ + 1, O.length);
576
- if (ce(W))
577
- m.preventDefault();
578
- else {
579
- var C;
580
- (C = i.current) === null || C === void 0 || C.focus();
581
- }
582
- }
583
- }),
584
- onEscapeKeyDown: T(e.onEscapeKeyDown, (m) => {
585
- a.current = !0;
586
- })
587
- })));
588
- }), Ne = "NavigationMenuViewport", Pt = /* @__PURE__ */ I((e, t) => {
589
- const { forceMount: n, ...o } = e, i = !!k(Ne, e.__scopeNavigationMenu).value;
590
- return /* @__PURE__ */ d(X, {
591
- present: n || i
592
- }, /* @__PURE__ */ d(Dt, M({}, o, {
593
- ref: t
594
- })));
595
- }), Dt = /* @__PURE__ */ I((e, t) => {
596
- const { __scopeNavigationMenu: n, children: o, ...r } = e, i = k(Ne, n), a = B(t, i.onViewportChange), u = mt(H, e.__scopeNavigationMenu), [c, f] = K(null), [s, l] = K(null), h = c ? (c == null ? void 0 : c.width) + "px" : void 0, v = c ? (c == null ? void 0 : c.height) + "px" : void 0, g = !!i.value, $ = g ? i.value : i.previousValue;
597
- return re(s, () => {
598
- s && f({
599
- width: s.offsetWidth,
600
- height: s.offsetHeight
601
- });
602
- }), /* @__PURE__ */ d(L.div, M({
603
- "data-state": ue(g),
604
- "data-orientation": i.orientation
605
- }, r, {
606
- ref: a,
607
- style: {
608
- // Prevent interaction when animating out
609
- pointerEvents: !g && i.isRootMenu ? "none" : void 0,
610
- "--radix-navigation-menu-viewport-width": h,
611
- "--radix-navigation-menu-viewport-height": v,
612
- ...r.style
613
- },
614
- onPointerEnter: T(e.onPointerEnter, i.onContentEnter),
615
- onPointerLeave: T(e.onPointerLeave, j(i.onContentLeave))
616
- }), Array.from(u.items).map(([x, { ref: D, forceMount: m, ...b }]) => {
617
- const p = $ === x;
618
- return /* @__PURE__ */ d(X, {
619
- key: x,
620
- present: m || p
621
- }, /* @__PURE__ */ d(Me, M({}, b, {
622
- ref: qe(D, (C) => {
623
- p && C && l(C);
624
- })
625
- })));
626
- }));
627
- }), Ot = "FocusGroup", Re = /* @__PURE__ */ I((e, t) => {
628
- const { __scopeNavigationMenu: n, ...o } = e, r = k(Ot, n);
629
- return /* @__PURE__ */ d(ne.Provider, {
630
- scope: n
631
- }, /* @__PURE__ */ d(ne.Slot, {
632
- scope: n
633
- }, /* @__PURE__ */ d(L.div, M({
634
- dir: r.dir
635
- }, o, {
636
- ref: t
637
- }))));
638
- }), me = [
639
- "ArrowRight",
640
- "ArrowLeft",
641
- "ArrowUp",
642
- "ArrowDown"
643
- ], Ft = "FocusGroupItem", Ie = /* @__PURE__ */ I((e, t) => {
644
- const { __scopeNavigationMenu: n, ...o } = e, r = ft(n), i = k(Ft, n);
645
- return /* @__PURE__ */ d(ne.ItemSlot, {
646
- scope: n
647
- }, /* @__PURE__ */ d(L.button, M({}, o, {
648
- ref: t,
649
- onKeyDown: T(e.onKeyDown, (a) => {
650
- if ([
651
- "Home",
652
- "End",
653
- ...me
654
- ].includes(a.key)) {
655
- let c = r().map(
656
- (l) => l.ref.current
657
- );
658
- if ([
659
- i.dir === "rtl" ? "ArrowRight" : "ArrowLeft",
660
- "ArrowUp",
661
- "End"
662
- ].includes(a.key) && c.reverse(), me.includes(a.key)) {
663
- const l = c.indexOf(a.currentTarget);
664
- c = c.slice(l + 1);
665
- }
666
- setTimeout(
667
- () => ce(c)
668
- ), a.preventDefault();
669
- }
670
- })
671
- })));
672
- });
673
- function oe(e) {
674
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
675
- acceptNode: (o) => {
676
- const r = o.tagName === "INPUT" && o.type === "hidden";
677
- return o.disabled || o.hidden || r ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
678
- }
679
- });
680
- for (; n.nextNode(); )
681
- t.push(n.currentNode);
682
- return t;
683
- }
684
- function ce(e) {
685
- const t = document.activeElement;
686
- return e.some((n) => n === t ? !0 : (n.focus(), document.activeElement !== t));
687
- }
688
- function Lt(e) {
689
- return e.forEach((t) => {
690
- t.dataset.tabindex = t.getAttribute("tabindex") || "", t.setAttribute("tabindex", "-1");
691
- }), () => {
692
- e.forEach((t) => {
693
- const n = t.dataset.tabindex;
694
- t.setAttribute("tabindex", n);
695
- });
696
- };
697
- }
698
- function re(e, t) {
699
- const n = V(t);
700
- Q(() => {
701
- let o = 0;
702
- if (e) {
703
- const r = new ResizeObserver(() => {
704
- cancelAnimationFrame(o), o = window.requestAnimationFrame(n);
705
- });
706
- return r.observe(e), () => {
707
- window.cancelAnimationFrame(o), r.unobserve(e);
708
- };
709
- }
710
- }, [
711
- e,
712
- n
713
- ]);
714
- }
715
- function ue(e) {
716
- return e ? "open" : "closed";
717
- }
718
- function Pe(e, t) {
719
- return `${e}-trigger-${t}`;
720
- }
721
- function De(e, t) {
722
- return `${e}-content-${t}`;
723
- }
724
- function j(e) {
725
- return (t) => t.pointerType === "mouse" ? e(t) : void 0;
726
- }
727
- const At = pt, kt = _t, Kt = yt, St = Ct, Vt = xt, zt = Tt, Wt = Mt, Ut = Rt, Bt = Pt, Ht = "_enterFromLeft_139wf_1", Gt = "_enterFromRight_139wf_1", Yt = "_exitToLeft_139wf_1", jt = "_exitToRight_139wf_1", Xt = "_scaleIn_139wf_1", qt = "_scaleOut_139wf_1", N = {
728
- "teddy-navigation-menu": "_teddy-navigation-menu_139wf_1",
729
- "teddy-navigation-menu__viewport": "_teddy-navigation-menu__viewport_139wf_33",
730
- "teddy-navigation-menu__list": "_teddy-navigation-menu__list_139wf_36",
731
- "teddy-navigation-menu__top-menu-list": "_teddy-navigation-menu__top-menu-list_139wf_55",
732
- "teddy-navigation-menu__top-menu-trigger": "_teddy-navigation-menu__top-menu-trigger_139wf_75",
733
- "teddy-navigation-menu__top-menu-trigger--small": "_teddy-navigation-menu__top-menu-trigger--small_139wf_93",
734
- "teddy-navigation-menu__top-menu-trigger--button": "_teddy-navigation-menu__top-menu-trigger--button_139wf_98",
735
- "teddy-navigation-menu__content": "_teddy-navigation-menu__content_139wf_163",
736
- enterFromLeft: Ht,
737
- enterFromRight: Gt,
738
- exitToLeft: Yt,
739
- exitToRight: jt,
740
- "teddy-navigation-menu__trigger": "_teddy-navigation-menu__trigger_139wf_208",
741
- "teddy-navigation-menu__trigger--small": "_teddy-navigation-menu__trigger--small_139wf_226",
742
- "teddy-navigation-menu__trigger--button": "_teddy-navigation-menu__trigger--button_139wf_231",
743
- "teddy-navigation-menu__link": "_teddy-navigation-menu__link_139wf_296",
744
- "teddy-navigation-menu__link--small": "_teddy-navigation-menu__link--small_139wf_314",
745
- "teddy-navigation-menu__link--button": "_teddy-navigation-menu__link--button_139wf_319",
746
- scaleIn: Xt,
747
- scaleOut: qt
748
- }, R = "teddy-navigation-menu", J = E.createContext({
749
- selectedTopMenu: void 0,
750
- setSelectedTopMenu: () => {
751
- },
752
- contentRef: { current: null },
753
- focusProxyRef: { current: null },
754
- topMenuRef: { current: null },
755
- id: "",
756
- dir: "ltr",
757
- orientation: "horizontal",
758
- onEntryKeyDown: () => {
759
- },
760
- onFocusProxyEnter: () => {
761
- },
762
- onContentFocusOutside: () => {
763
- }
764
- }), Oe = E.forwardRef(
765
- ({ className: e, defaultTopMenuValue: t, ...n }, o) => {
766
- const [r, i] = E.useState(t), a = E.useRef(null), u = E.useRef(() => {
767
- }), c = E.useRef(null), f = E.useRef(null), s = E.useId(), l = E.useCallback((g = "start") => {
768
- if (a.current) {
769
- u.current();
770
- const $ = ie(a.current);
771
- $.length && le(g === "start" ? $ : $.reverse());
772
- }
773
- }, []), h = E.useCallback(() => {
774
- if (a.current) {
775
- const g = ie(a.current);
776
- g.length && (u.current = en(g));
777
- }
778
- }, []), v = A([N[`${R}`]], e);
779
- return /* @__PURE__ */ F(
780
- J.Provider,
781
- {
782
- value: {
783
- contentRef: a,
784
- focusProxyRef: c,
785
- topMenuRef: f,
786
- id: s,
787
- dir: n.dir || "ltr",
788
- orientation: n.orientation || "horizontal",
789
- onEntryKeyDown: l,
790
- onFocusProxyEnter: l,
791
- onContentFocusOutside: h,
792
- selectedTopMenu: r,
793
- setSelectedTopMenu: i
794
- },
795
- children: /* @__PURE__ */ F(At, { ...n, ref: o, className: v })
796
- }
797
- );
798
- }
799
- );
800
- Oe.displayName = "NavigationMenu";
801
- const Fe = E.forwardRef(
802
- ({ className: e, ...t }, n) => {
803
- const o = A([N[`${R}__top-menu-list`]], e), r = E.useContext(J), i = q(r.topMenuRef, n);
804
- return /* @__PURE__ */ F("ul", { ...t, ref: i, className: o });
805
- }
806
- );
807
- Fe.displayName = "NavigationMenu.TopMenuList";
808
- const Jt = E.forwardRef(
809
- ({ className: e, ...t }, n) => {
810
- const o = A([N[`${R}__top-menu-item`]], e);
811
- return /* @__PURE__ */ F("li", { ...t, ref: n, className: o });
812
- }
813
- ), Qt = E.forwardRef(
814
- ({ className: e, active: t, ...n }, o) => {
815
- const r = A(
816
- [N[`${R}__top-menu-trigger`], N[`${R}__top-menu-trigger--small`]],
817
- e
818
- ), i = E.useContext(J), a = E.useRef(null), u = q(a, o), c = i.selectedTopMenu === n.value;
819
- return /* @__PURE__ */ He(Ge, { children: [
820
- /* @__PURE__ */ F(
821
- "button",
822
- {
823
- ...n,
824
- ref: u,
825
- className: r,
826
- "data-state": c ? "open" : "closed",
827
- "data-active": t ? "true" : void 0,
828
- "aria-expanded": c,
829
- "aria-controls": Ue({ value: n.value, baseId: i.id }),
830
- [pe]: "",
831
- onClick: ee(n.onClick, () => {
832
- i.setSelectedTopMenu(n.value);
833
- }),
834
- onKeyDown: ee(n.onKeyDown, (f) => {
835
- var v;
836
- const l = { horizontal: "ArrowDown", vertical: i.dir === "rtl" ? "ArrowLeft" : "ArrowRight" }[i.orientation];
837
- if (c && f.key === l)
838
- return i.onEntryKeyDown(), f.preventDefault();
839
- if (["Home", "End", ...be].includes(f.key)) {
840
- const g = (v = i.topMenuRef.current) == null ? void 0 : v.querySelectorAll(`[${pe}]`);
841
- if (!g)
842
- return;
843
- let $ = Array.from(g == null ? void 0 : g.values());
844
- if ([i.dir === "rtl" ? "ArrowRight" : "ArrowLeft", "ArrowUp", "End"].includes(f.key) && $.reverse(), be.includes(f.key)) {
845
- const D = $.indexOf(f.currentTarget);
846
- $ = $.slice(D + 1), le($), f.preventDefault();
847
- }
848
- }
849
- })
850
- }
851
- ),
852
- c && /* @__PURE__ */ F(
853
- tt,
854
- {
855
- "aria-hidden": !0,
856
- tabIndex: 0,
857
- ref: i.focusProxyRef,
858
- onFocus: (f) => {
859
- const s = i.contentRef.current, l = f.relatedTarget, h = l === a.current, v = s == null ? void 0 : s.contains(l);
860
- (h || !v) && i.onFocusProxyEnter(h ? "start" : "end");
861
- }
862
- }
863
- )
864
- ] });
865
- }
866
- ), Le = E.forwardRef(
867
- ({ className: e, variant: t, value: n, ...o }, r) => {
868
- const i = A([N[`${R}__list`]], [N[`${R}__list--${t}`]], e), a = E.useContext(J), u = q(a.contentRef, r), c = a.selectedTopMenu !== void 0;
869
- return a.selectedTopMenu === n ? /* @__PURE__ */ F(
870
- Kt,
871
- {
872
- ref: c ? u : r,
873
- id: n && Ue({ value: n, baseId: a.id }),
874
- ...o,
875
- onKeyDown: ee(o.onKeyDown, (s) => {
876
- var v;
877
- if (!n)
878
- return;
879
- const l = s.altKey || s.ctrlKey || s.metaKey;
880
- if (s.key === "Tab" && !l) {
881
- const g = ie(s.currentTarget), $ = document.activeElement, w = g.findIndex((m) => m === $), D = s.shiftKey ? g.slice(0, w).reverse() : g.slice(w + 1, g.length);
882
- le(D) ? s.preventDefault() : ((v = a.focusProxyRef.current) == null || v.focus(), a.onContentFocusOutside());
883
- }
884
- }),
885
- className: i
886
- }
887
- ) : null;
888
- }
889
- );
890
- Le.displayName = "NavigationMenu.List";
891
- const Ae = E.forwardRef(
892
- ({ className: e, ...t }, n) => {
893
- const o = A([N[`${R}__item`]], e);
894
- return /* @__PURE__ */ F(St, { ...t, ref: n, className: o });
895
- }
896
- );
897
- Ae.displayName = "NavigationMenu.Item";
898
- const ke = E.forwardRef(
899
- ({ className: e, active: t, variant: n = "default", ...o }, r) => {
900
- const i = A(
901
- [N[`${R}__trigger`]],
902
- [N[`${R}__trigger--${n}`]],
903
- e
904
- ), a = E.useRef(null), u = q(r, a);
905
- return /* @__PURE__ */ F(
906
- Vt,
907
- {
908
- onPointerEnter: (c) => c.preventDefault(),
909
- onPointerMove: (c) => c.preventDefault(),
910
- onPointerLeave: (c) => c.preventDefault(),
911
- ...o,
912
- ref: u,
913
- "data-active": t ? "true" : void 0,
914
- className: i,
915
- "data-text": We(o.children)
916
- }
917
- );
918
- }
919
- );
920
- ke.displayName = "NavigationMenu.Trigger";
921
- const Zt = E.forwardRef(
922
- ({ className: e, variant: t = "default", ...n }, o) => {
923
- const r = A(
924
- [N[`${R}__content`]],
925
- [N[`${R}__content--${t}`]],
926
- e
927
- );
928
- return /* @__PURE__ */ F(
929
- Ut,
930
- {
931
- onPointerEnter: (i) => i.preventDefault(),
932
- onPointerLeave: (i) => i.preventDefault(),
933
- ...n,
934
- ref: o,
935
- className: r
936
- }
937
- );
938
- }
939
- ), Ke = E.forwardRef(
940
- ({ className: e, variant: t = "default", ...n }, o) => {
941
- const r = A([N[`${R}__link`]], [N[`${R}__link--${t}`]], e);
942
- return /* @__PURE__ */ F(
943
- zt,
944
- {
945
- ...n,
946
- ref: o,
947
- className: r,
948
- "data-text": We(n.children)
949
- }
950
- );
951
- }
952
- );
953
- Ke.displayName = "NavigationMenu.Link";
954
- const Se = E.forwardRef(
955
- ({ className: e, ...t }, n) => {
956
- const o = A([N[`${R}__indicator`]], e);
957
- return /* @__PURE__ */ F(Wt, { ...t, ref: n, className: o });
958
- }
959
- );
960
- Se.displayName = "NavigationMenu.Indicator";
961
- const Ve = E.forwardRef(
962
- ({ className: e, ...t }, n) => {
963
- const o = A([N[`${R}__viewport`]], e);
964
- return /* @__PURE__ */ F(Bt, { ...t, ref: n, className: o });
965
- }
966
- );
967
- Ve.displayName = "NavigationMenu.Viewport";
968
- const ze = E.forwardRef(
969
- ({ className: e, ...t }, n) => {
970
- const o = A([N[`${R}__sub`]], e);
971
- return /* @__PURE__ */ F(kt, { ...t, ref: n, className: o });
972
- }
973
- );
974
- ze.displayName = "NavigationMenu.Sub";
975
- function We(e) {
976
- function t(n) {
977
- if (typeof n == "string")
978
- return n;
979
- if (E.isValidElement(n) && n.props.children)
980
- return t(n.props.children);
981
- if (Array.isArray(n))
982
- for (let o = n.length - 1; o >= 0; o--) {
983
- const r = t(n[o]);
984
- if (r)
985
- return r;
986
- }
987
- }
988
- return t(e);
989
- }
990
- function ie(e) {
991
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
992
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
993
- acceptNode: (o) => {
994
- const r = o.tagName === "INPUT" && o.type === "hidden";
995
- return o.disabled || o.hidden || r ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
996
- }
997
- });
998
- for (; n.nextNode(); )
999
- t.push(n.currentNode);
1000
- return t;
1001
- }
1002
- function le(e) {
1003
- const t = document.activeElement;
1004
- return e.some((n) => n === t ? !0 : (n.focus(), document.activeElement !== t));
1005
- }
1006
- function en(e) {
1007
- return e.forEach((t) => {
1008
- t.dataset.tabindex = t.getAttribute("tabindex") || "", t.setAttribute("tabindex", "-1");
1009
- }), () => {
1010
- e.forEach((t) => {
1011
- const n = t.dataset.tabindex;
1012
- t.setAttribute("tabindex", n);
1013
- });
1014
- };
1015
- }
1016
- const pe = "data-teddy-top-selector-trigger", be = ["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"];
1017
- function Ue(e) {
1018
- return `teddy-navigation-menu-${e.baseId}-${e.value}-content`;
1019
- }
1020
- const vn = Object.assign(Oe, {
1021
- List: Le,
1022
- Item: Ae,
1023
- Trigger: ke,
1024
- Content: Zt,
1025
- Link: Ke,
1026
- Indicator: Se,
1027
- Viewport: Ve,
1028
- Sub: ze,
1029
- TopMenuList: Fe,
1030
- TopMenuItem: Jt,
1031
- TopMenuTrigger: Qt
1032
- });
1033
- export {
1034
- at as $,
1035
- vn as N
1036
- };