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