@telia/teddy 0.0.7 → 0.0.9
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.
|
@@ -47,6 +47,7 @@ type ItemProps = React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.I
|
|
|
47
47
|
* -----------------------------------------------------------------------------------------------*/
|
|
48
48
|
type TriggerProps = React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger> & {
|
|
49
49
|
variant?: 'default' | 'small';
|
|
50
|
+
active?: boolean;
|
|
50
51
|
};
|
|
51
52
|
/** -------------------------------------------------------------------------------------------------
|
|
52
53
|
* NavigationMenuContent
|
|
@@ -92,6 +93,7 @@ declare const NavigationMenu: React.ForwardRefExoticComponent<Omit<NavigationMen
|
|
|
92
93
|
} & React.RefAttributes<HTMLLIElement>>;
|
|
93
94
|
Trigger: React.ForwardRefExoticComponent<Omit<NavigationMenuPrimitive.NavigationMenuTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
94
95
|
variant?: "small" | "default" | undefined;
|
|
96
|
+
active?: boolean | undefined;
|
|
95
97
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
96
98
|
Content: React.ForwardRefExoticComponent<Omit<NavigationMenuPrimitive.NavigationMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
97
99
|
variant?: "default" | "float" | undefined;
|
|
@@ -4,11 +4,11 @@ import h, { useEffect as z, forwardRef as I, useContext as Ye, useState as K, cr
|
|
|
4
4
|
import { c as L } from "../../clsx-DB4S2d7J.js";
|
|
5
5
|
import { b as B, _ as M, c as Xe } from "../../index-DpfSJps6.js";
|
|
6
6
|
import Je from "react-dom";
|
|
7
|
-
import { d as V, e as T, $ as _e, a as Qe, b as Ze, c as ye, i as et, f as we, h as q, g as
|
|
8
|
-
import { $ as F, a as
|
|
9
|
-
import { useComposedRefs as
|
|
7
|
+
import { d as V, e as T, $ as _e, a as Qe, b as Ze, c as ye, i as et, f as we, h as q, g as Q } from "../../index-0Eg2mucA.js";
|
|
8
|
+
import { $ as F, a as Z } from "../../index-DM5e-Whg.js";
|
|
9
|
+
import { useComposedRefs as X } from "../../utils/composeRefs.js";
|
|
10
10
|
import { VisuallyHidden as tt } from "../visually-hidden/visually-hidden.js";
|
|
11
|
-
import { composeEventHandlers as
|
|
11
|
+
import { composeEventHandlers as ee } from "../../utils/composeEventHandlers.js";
|
|
12
12
|
function nt(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
13
13
|
const n = V(e);
|
|
14
14
|
z(() => {
|
|
@@ -21,7 +21,7 @@ function nt(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
|
21
21
|
t
|
|
22
22
|
]);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const te = "dismissableLayer.update", ot = "dismissableLayer.pointerDownOutside", rt = "dismissableLayer.focusOutside";
|
|
25
25
|
let fe;
|
|
26
26
|
const it = /* @__PURE__ */ je({
|
|
27
27
|
layers: /* @__PURE__ */ new Set(),
|
|
@@ -29,50 +29,50 @@ const it = /* @__PURE__ */ je({
|
|
|
29
29
|
branches: /* @__PURE__ */ new Set()
|
|
30
30
|
}), at = /* @__PURE__ */ I((e, t) => {
|
|
31
31
|
var n;
|
|
32
|
-
const { disableOutsidePointerEvents: r = !1, onEscapeKeyDown: o, onPointerDownOutside: i, onFocusOutside:
|
|
32
|
+
const { disableOutsidePointerEvents: r = !1, onEscapeKeyDown: o, onPointerDownOutside: i, onFocusOutside: c, onInteractOutside: u, onDismiss: a, ...m } = e, s = Ye(it), [l, y] = 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
33
|
t,
|
|
34
34
|
(E) => y(E)
|
|
35
|
-
), w = Array.from(
|
|
36
|
-
...
|
|
37
|
-
].slice(-1), k = w.indexOf(x),
|
|
35
|
+
), w = Array.from(s.layers), [x] = [
|
|
36
|
+
...s.layersWithOutsidePointerEventsDisabled
|
|
37
|
+
].slice(-1), k = w.indexOf(x), g = l ? w.indexOf(l) : -1, b = s.layersWithOutsidePointerEventsDisabled.size > 0, $ = g >= k, C = st((E) => {
|
|
38
38
|
const _ = E.target, S = [
|
|
39
|
-
...
|
|
39
|
+
...s.branches
|
|
40
40
|
].some(
|
|
41
41
|
(W) => W.contains(_)
|
|
42
42
|
);
|
|
43
|
-
|
|
43
|
+
!$ || S || (i == null || i(E), u == null || u(E), E.defaultPrevented || a == null || a());
|
|
44
44
|
}, v), D = ct((E) => {
|
|
45
45
|
const _ = E.target;
|
|
46
46
|
[
|
|
47
|
-
...
|
|
47
|
+
...s.branches
|
|
48
48
|
].some(
|
|
49
49
|
(W) => W.contains(_)
|
|
50
|
-
) || (
|
|
50
|
+
) || (c == null || c(E), u == null || u(E), E.defaultPrevented || a == null || a());
|
|
51
51
|
}, v);
|
|
52
52
|
return nt((E) => {
|
|
53
|
-
|
|
53
|
+
g === s.layers.size - 1 && (o == null || o(E), !E.defaultPrevented && a && (E.preventDefault(), a()));
|
|
54
54
|
}, v), z(() => {
|
|
55
55
|
if (l)
|
|
56
|
-
return r && (
|
|
57
|
-
r &&
|
|
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
58
|
};
|
|
59
59
|
}, [
|
|
60
60
|
l,
|
|
61
61
|
v,
|
|
62
62
|
r,
|
|
63
|
-
|
|
63
|
+
s
|
|
64
64
|
]), z(() => () => {
|
|
65
|
-
l && (
|
|
65
|
+
l && (s.layers.delete(l), s.layersWithOutsidePointerEventsDisabled.delete(l), ve());
|
|
66
66
|
}, [
|
|
67
67
|
l,
|
|
68
|
-
|
|
68
|
+
s
|
|
69
69
|
]), z(() => {
|
|
70
70
|
const E = () => f({});
|
|
71
|
-
return document.addEventListener(
|
|
72
|
-
}, []), /* @__PURE__ */ d(F.div, M({},
|
|
71
|
+
return document.addEventListener(te, E), () => document.removeEventListener(te, E);
|
|
72
|
+
}, []), /* @__PURE__ */ d(F.div, M({}, m, {
|
|
73
73
|
ref: p,
|
|
74
74
|
style: {
|
|
75
|
-
pointerEvents: b ?
|
|
75
|
+
pointerEvents: b ? $ ? "auto" : "none" : void 0,
|
|
76
76
|
...e.style
|
|
77
77
|
},
|
|
78
78
|
onFocusCapture: T(e.onFocusCapture, D.onFocusCapture),
|
|
@@ -86,25 +86,25 @@ function st(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
|
86
86
|
return z(() => {
|
|
87
87
|
const i = (u) => {
|
|
88
88
|
if (u.target && !r.current) {
|
|
89
|
-
let
|
|
90
|
-
Ee(ot, n,
|
|
89
|
+
let m = function() {
|
|
90
|
+
Ee(ot, n, a, {
|
|
91
91
|
discrete: !0
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
|
-
const
|
|
94
|
+
const a = {
|
|
95
95
|
originalEvent: u
|
|
96
96
|
};
|
|
97
|
-
u.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current =
|
|
97
|
+
u.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = m, t.addEventListener("click", o.current, {
|
|
98
98
|
once: !0
|
|
99
|
-
})) :
|
|
99
|
+
})) : m();
|
|
100
100
|
} else
|
|
101
101
|
t.removeEventListener("click", o.current);
|
|
102
102
|
r.current = !1;
|
|
103
|
-
},
|
|
103
|
+
}, c = window.setTimeout(() => {
|
|
104
104
|
t.addEventListener("pointerdown", i);
|
|
105
105
|
}, 0);
|
|
106
106
|
return () => {
|
|
107
|
-
window.clearTimeout(
|
|
107
|
+
window.clearTimeout(c), t.removeEventListener("pointerdown", i), t.removeEventListener("click", o.current);
|
|
108
108
|
};
|
|
109
109
|
}, [
|
|
110
110
|
t,
|
|
@@ -134,7 +134,7 @@ function ct(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
function ve() {
|
|
137
|
-
const e = new CustomEvent(
|
|
137
|
+
const e = new CustomEvent(te);
|
|
138
138
|
document.dispatchEvent(e);
|
|
139
139
|
}
|
|
140
140
|
function Ee(e, t, n, { discrete: r }) {
|
|
@@ -145,7 +145,7 @@ function Ee(e, t, n, { discrete: r }) {
|
|
|
145
145
|
});
|
|
146
146
|
t && o.addEventListener(e, t, {
|
|
147
147
|
once: !0
|
|
148
|
-
}), r ?
|
|
148
|
+
}), r ? Z(o, i) : o.dispatchEvent(i);
|
|
149
149
|
}
|
|
150
150
|
const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
151
151
|
ref: t,
|
|
@@ -163,42 +163,42 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
163
163
|
wordWrap: "normal",
|
|
164
164
|
...e.style
|
|
165
165
|
}
|
|
166
|
-
}))), lt = ut, G = "NavigationMenu", [ae, he, dt] = _e(G), [
|
|
166
|
+
}))), lt = ut, G = "NavigationMenu", [ae, he, dt] = _e(G), [ne, ft, vt] = _e(G), [se, fn] = Qe(G, [
|
|
167
167
|
dt,
|
|
168
168
|
vt
|
|
169
169
|
]), [gt, A] = se(G), [$t, mt] = se(G), pt = /* @__PURE__ */ I((e, t) => {
|
|
170
|
-
const { __scopeNavigationMenu: n, value: r, onValueChange: o, defaultValue: i, delayDuration:
|
|
170
|
+
const { __scopeNavigationMenu: n, value: r, onValueChange: o, defaultValue: i, delayDuration: c = 200, skipDelayDuration: u = 300, orientation: a = "horizontal", dir: m, ...s } = e, [l, y] = K(null), v = B(
|
|
171
171
|
t,
|
|
172
172
|
(_) => y(_)
|
|
173
|
-
), f = Ze(
|
|
173
|
+
), f = Ze(m), p = P(0), w = P(0), x = P(0), [k, g] = K(!0), [b = "", $] = ye({
|
|
174
174
|
prop: r,
|
|
175
175
|
onChange: (_) => {
|
|
176
176
|
const S = _ !== "", W = u > 0;
|
|
177
|
-
S ? (window.clearTimeout(x.current), W &&
|
|
178
|
-
() =>
|
|
177
|
+
S ? (window.clearTimeout(x.current), W && g(!1)) : (window.clearTimeout(x.current), x.current = window.setTimeout(
|
|
178
|
+
() => g(!0),
|
|
179
179
|
u
|
|
180
180
|
)), o == null || o(_);
|
|
181
181
|
},
|
|
182
182
|
defaultProp: i
|
|
183
183
|
}), C = U(() => {
|
|
184
184
|
window.clearTimeout(w.current), w.current = window.setTimeout(
|
|
185
|
-
() =>
|
|
185
|
+
() => $(""),
|
|
186
186
|
150
|
|
187
187
|
);
|
|
188
188
|
}, [
|
|
189
|
-
|
|
189
|
+
$
|
|
190
190
|
]), D = U((_) => {
|
|
191
|
-
window.clearTimeout(w.current),
|
|
191
|
+
window.clearTimeout(w.current), $(_);
|
|
192
192
|
}, [
|
|
193
|
-
|
|
193
|
+
$
|
|
194
194
|
]), E = U((_) => {
|
|
195
195
|
b === _ ? window.clearTimeout(w.current) : p.current = window.setTimeout(() => {
|
|
196
|
-
window.clearTimeout(w.current),
|
|
197
|
-
},
|
|
196
|
+
window.clearTimeout(w.current), $(_);
|
|
197
|
+
}, c);
|
|
198
198
|
}, [
|
|
199
199
|
b,
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
$,
|
|
201
|
+
c
|
|
202
202
|
]);
|
|
203
203
|
return z(() => () => {
|
|
204
204
|
window.clearTimeout(p.current), window.clearTimeout(w.current), window.clearTimeout(x.current);
|
|
@@ -207,7 +207,7 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
207
207
|
isRootMenu: !0,
|
|
208
208
|
value: b,
|
|
209
209
|
dir: f,
|
|
210
|
-
orientation:
|
|
210
|
+
orientation: a,
|
|
211
211
|
rootNavigationMenu: l,
|
|
212
212
|
onTriggerEnter: (_) => {
|
|
213
213
|
window.clearTimeout(p.current), k ? E(_) : D(_);
|
|
@@ -218,20 +218,20 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
218
218
|
onContentEnter: () => window.clearTimeout(w.current),
|
|
219
219
|
onContentLeave: C,
|
|
220
220
|
onItemSelect: (_) => {
|
|
221
|
-
|
|
221
|
+
$(
|
|
222
222
|
(S) => S === _ ? "" : _
|
|
223
223
|
);
|
|
224
224
|
},
|
|
225
|
-
onItemDismiss: () =>
|
|
225
|
+
onItemDismiss: () => $("")
|
|
226
226
|
}, /* @__PURE__ */ d(F.nav, M({
|
|
227
227
|
"aria-label": "Main",
|
|
228
|
-
"data-orientation":
|
|
228
|
+
"data-orientation": a,
|
|
229
229
|
dir: f
|
|
230
|
-
},
|
|
230
|
+
}, s, {
|
|
231
231
|
ref: v
|
|
232
232
|
})));
|
|
233
233
|
}), bt = "NavigationMenuSub", _t = /* @__PURE__ */ I((e, t) => {
|
|
234
|
-
const { __scopeNavigationMenu: n, value: r, onValueChange: o, defaultValue: i, orientation:
|
|
234
|
+
const { __scopeNavigationMenu: n, value: r, onValueChange: o, defaultValue: i, orientation: c = "horizontal", ...u } = e, a = A(bt, n), [m = "", s] = ye({
|
|
235
235
|
prop: r,
|
|
236
236
|
onChange: o,
|
|
237
237
|
defaultProp: i
|
|
@@ -239,20 +239,20 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
239
239
|
return /* @__PURE__ */ d(Ce, {
|
|
240
240
|
scope: n,
|
|
241
241
|
isRootMenu: !1,
|
|
242
|
-
value:
|
|
243
|
-
dir:
|
|
244
|
-
orientation:
|
|
245
|
-
rootNavigationMenu:
|
|
246
|
-
onTriggerEnter: (l) =>
|
|
247
|
-
onItemSelect: (l) =>
|
|
248
|
-
onItemDismiss: () =>
|
|
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
249
|
}, /* @__PURE__ */ d(F.div, M({
|
|
250
|
-
"data-orientation":
|
|
250
|
+
"data-orientation": c
|
|
251
251
|
}, u, {
|
|
252
252
|
ref: t
|
|
253
253
|
})));
|
|
254
254
|
}), Ce = (e) => {
|
|
255
|
-
const { scope: t, isRootMenu: n, rootNavigationMenu: r, dir: o, orientation: i, children:
|
|
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: y, onContentLeave: v } = e, [f, p] = K(null), [w, x] = K(/* @__PURE__ */ new Map()), [k, g] = K(null);
|
|
256
256
|
return /* @__PURE__ */ d(gt, {
|
|
257
257
|
scope: t,
|
|
258
258
|
isRootMenu: n,
|
|
@@ -265,25 +265,25 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
265
265
|
viewport: f,
|
|
266
266
|
onViewportChange: p,
|
|
267
267
|
indicatorTrack: k,
|
|
268
|
-
onIndicatorTrackChange:
|
|
269
|
-
onTriggerEnter: V(
|
|
268
|
+
onIndicatorTrackChange: g,
|
|
269
|
+
onTriggerEnter: V(s),
|
|
270
270
|
onTriggerLeave: V(l),
|
|
271
271
|
onContentEnter: V(y),
|
|
272
272
|
onContentLeave: V(v),
|
|
273
|
-
onItemSelect: V(
|
|
274
|
-
onItemDismiss: V(
|
|
275
|
-
onViewportContentChange: U((b,
|
|
276
|
-
x((C) => (C.set(b,
|
|
273
|
+
onItemSelect: V(a),
|
|
274
|
+
onItemDismiss: V(m),
|
|
275
|
+
onViewportContentChange: U((b, $) => {
|
|
276
|
+
x((C) => (C.set(b, $), new Map(C)));
|
|
277
277
|
}, []),
|
|
278
278
|
onViewportContentRemove: U((b) => {
|
|
279
|
-
x((
|
|
279
|
+
x(($) => $.has(b) ? ($.delete(b), new Map($)) : $);
|
|
280
280
|
}, [])
|
|
281
281
|
}, /* @__PURE__ */ d(ae.Provider, {
|
|
282
282
|
scope: t
|
|
283
283
|
}, /* @__PURE__ */ d($t, {
|
|
284
284
|
scope: t,
|
|
285
285
|
items: w
|
|
286
|
-
},
|
|
286
|
+
}, c)));
|
|
287
287
|
}, yt = "NavigationMenuList", wt = /* @__PURE__ */ I((e, t) => {
|
|
288
288
|
const { __scopeNavigationMenu: n, ...r } = e, o = A(yt, n), i = /* @__PURE__ */ d(F.ul, M({
|
|
289
289
|
"data-orientation": o.orientation
|
|
@@ -301,25 +301,25 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
301
301
|
asChild: !0
|
|
302
302
|
}, i) : i));
|
|
303
303
|
}), Et = "NavigationMenuItem", [ht, xe] = se(Et), Ct = /* @__PURE__ */ I((e, t) => {
|
|
304
|
-
const { __scopeNavigationMenu: n, value: r, ...o } = e, i = we(),
|
|
304
|
+
const { __scopeNavigationMenu: n, value: r, ...o } = e, i = we(), c = r || i || "LEGACY_REACT_AUTO_VALUE", u = P(null), a = P(null), m = P(null), s = P(() => {
|
|
305
305
|
}), l = P(!1), y = U((f = "start") => {
|
|
306
306
|
if (u.current) {
|
|
307
|
-
|
|
308
|
-
const p =
|
|
307
|
+
s.current();
|
|
308
|
+
const p = oe(u.current);
|
|
309
309
|
p.length && ce(f === "start" ? p : p.reverse());
|
|
310
310
|
}
|
|
311
311
|
}, []), v = U(() => {
|
|
312
312
|
if (u.current) {
|
|
313
|
-
const f =
|
|
314
|
-
f.length && (
|
|
313
|
+
const f = oe(u.current);
|
|
314
|
+
f.length && (s.current = Ft(f));
|
|
315
315
|
}
|
|
316
316
|
}, []);
|
|
317
317
|
return /* @__PURE__ */ d(ht, {
|
|
318
318
|
scope: n,
|
|
319
|
-
value:
|
|
320
|
-
triggerRef:
|
|
319
|
+
value: c,
|
|
320
|
+
triggerRef: a,
|
|
321
321
|
contentRef: u,
|
|
322
|
-
focusProxyRef:
|
|
322
|
+
focusProxyRef: m,
|
|
323
323
|
wasEscapeCloseRef: l,
|
|
324
324
|
onEntryKeyDown: y,
|
|
325
325
|
onFocusProxyEnter: y,
|
|
@@ -329,50 +329,50 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
329
329
|
ref: t
|
|
330
330
|
})));
|
|
331
331
|
}), ge = "NavigationMenuTrigger", xt = /* @__PURE__ */ I((e, t) => {
|
|
332
|
-
const { __scopeNavigationMenu: n, disabled: r, ...o } = e, i = A(ge, e.__scopeNavigationMenu),
|
|
332
|
+
const { __scopeNavigationMenu: n, disabled: r, ...o } = e, i = A(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), y = P(!1), v = c.value === i.value;
|
|
333
333
|
return /* @__PURE__ */ d(de, null, /* @__PURE__ */ d(ae.ItemSlot, {
|
|
334
334
|
scope: n,
|
|
335
|
-
value:
|
|
335
|
+
value: c.value
|
|
336
336
|
}, /* @__PURE__ */ d(Ie, {
|
|
337
337
|
asChild: !0
|
|
338
338
|
}, /* @__PURE__ */ d(F.button, M({
|
|
339
|
-
id:
|
|
339
|
+
id: m,
|
|
340
340
|
disabled: r,
|
|
341
341
|
"data-disabled": r ? "" : void 0,
|
|
342
342
|
"data-state": ue(v),
|
|
343
343
|
"aria-expanded": v,
|
|
344
|
-
"aria-controls":
|
|
344
|
+
"aria-controls": s
|
|
345
345
|
}, o, {
|
|
346
|
-
ref:
|
|
346
|
+
ref: a,
|
|
347
347
|
onPointerEnter: T(e.onPointerEnter, () => {
|
|
348
|
-
y.current = !1,
|
|
348
|
+
y.current = !1, c.wasEscapeCloseRef.current = !1;
|
|
349
349
|
}),
|
|
350
350
|
onPointerMove: T(e.onPointerMove, j(() => {
|
|
351
|
-
r || y.current ||
|
|
351
|
+
r || y.current || c.wasEscapeCloseRef.current || l.current || (i.onTriggerEnter(c.value), l.current = !0);
|
|
352
352
|
})),
|
|
353
353
|
onPointerLeave: T(e.onPointerLeave, j(() => {
|
|
354
354
|
r || (i.onTriggerLeave(), l.current = !1);
|
|
355
355
|
})),
|
|
356
356
|
onClick: T(e.onClick, () => {
|
|
357
|
-
i.onItemSelect(
|
|
357
|
+
i.onItemSelect(c.value), y.current = v;
|
|
358
358
|
}),
|
|
359
359
|
onKeyDown: T(e.onKeyDown, (f) => {
|
|
360
360
|
const w = {
|
|
361
361
|
horizontal: "ArrowDown",
|
|
362
362
|
vertical: i.dir === "rtl" ? "ArrowLeft" : "ArrowRight"
|
|
363
363
|
}[i.orientation];
|
|
364
|
-
v && f.key === w && (
|
|
364
|
+
v && f.key === w && (c.onEntryKeyDown(), f.preventDefault());
|
|
365
365
|
})
|
|
366
366
|
})))), v && /* @__PURE__ */ d(de, null, /* @__PURE__ */ d(lt, {
|
|
367
367
|
"aria-hidden": !0,
|
|
368
368
|
tabIndex: 0,
|
|
369
|
-
ref:
|
|
369
|
+
ref: c.focusProxyRef,
|
|
370
370
|
onFocus: (f) => {
|
|
371
|
-
const p =
|
|
372
|
-
(x || !k) &&
|
|
371
|
+
const p = c.contentRef.current, w = f.relatedTarget, x = w === u.current, k = p == null ? void 0 : p.contains(w);
|
|
372
|
+
(x || !k) && c.onFocusProxyEnter(x ? "start" : "end");
|
|
373
373
|
}
|
|
374
374
|
}), i.viewport && /* @__PURE__ */ d("span", {
|
|
375
|
-
"aria-owns":
|
|
375
|
+
"aria-owns": s
|
|
376
376
|
})));
|
|
377
377
|
}), $e = "navigationMenu.linkSelect", Tt = /* @__PURE__ */ I((e, t) => {
|
|
378
378
|
const { __scopeNavigationMenu: n, active: r, onSelect: o, ...i } = e;
|
|
@@ -383,23 +383,23 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
383
383
|
"aria-current": r ? "page" : void 0
|
|
384
384
|
}, i, {
|
|
385
385
|
ref: t,
|
|
386
|
-
onClick: T(e.onClick, (
|
|
387
|
-
const u =
|
|
386
|
+
onClick: T(e.onClick, (c) => {
|
|
387
|
+
const u = c.target, a = new CustomEvent($e, {
|
|
388
388
|
bubbles: !0,
|
|
389
389
|
cancelable: !0
|
|
390
390
|
});
|
|
391
391
|
if (u.addEventListener(
|
|
392
392
|
$e,
|
|
393
|
-
(
|
|
393
|
+
(m) => o == null ? void 0 : o(m),
|
|
394
394
|
{
|
|
395
395
|
once: !0
|
|
396
396
|
}
|
|
397
|
-
),
|
|
398
|
-
const
|
|
397
|
+
), Z(u, a), !a.defaultPrevented && !c.metaKey) {
|
|
398
|
+
const m = new CustomEvent(Y, {
|
|
399
399
|
bubbles: !0,
|
|
400
400
|
cancelable: !0
|
|
401
401
|
});
|
|
402
|
-
|
|
402
|
+
Z(u, m);
|
|
403
403
|
}
|
|
404
404
|
}, {
|
|
405
405
|
checkForDefaultPrevented: !1
|
|
@@ -413,7 +413,7 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
413
413
|
ref: t
|
|
414
414
|
}))), o.indicatorTrack) : null;
|
|
415
415
|
}), Nt = /* @__PURE__ */ I((e, t) => {
|
|
416
|
-
const { __scopeNavigationMenu: n, ...r } = e, o = A(Te, n), i = he(n), [
|
|
416
|
+
const { __scopeNavigationMenu: n, ...r } = e, o = A(Te, n), i = he(n), [c, u] = K(null), [a, m] = K(null), s = o.orientation === "horizontal", l = !!o.value;
|
|
417
417
|
z(() => {
|
|
418
418
|
var v;
|
|
419
419
|
const p = (v = i().find(
|
|
@@ -425,12 +425,12 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
425
425
|
o.value
|
|
426
426
|
]);
|
|
427
427
|
const y = () => {
|
|
428
|
-
|
|
429
|
-
size:
|
|
430
|
-
offset:
|
|
428
|
+
c && m({
|
|
429
|
+
size: s ? c.offsetWidth : c.offsetHeight,
|
|
430
|
+
offset: s ? c.offsetLeft : c.offsetTop
|
|
431
431
|
});
|
|
432
432
|
};
|
|
433
|
-
return
|
|
433
|
+
return re(c, y), re(o.indicatorTrack, y), a ? /* @__PURE__ */ d(F.div, M({
|
|
434
434
|
"aria-hidden": !0,
|
|
435
435
|
"data-state": l ? "visible" : "hidden",
|
|
436
436
|
"data-orientation": o.orientation
|
|
@@ -438,20 +438,20 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
438
438
|
ref: t,
|
|
439
439
|
style: {
|
|
440
440
|
position: "absolute",
|
|
441
|
-
...
|
|
441
|
+
...s ? {
|
|
442
442
|
left: 0,
|
|
443
|
-
width:
|
|
444
|
-
transform: `translateX(${
|
|
443
|
+
width: a.size + "px",
|
|
444
|
+
transform: `translateX(${a.offset}px)`
|
|
445
445
|
} : {
|
|
446
446
|
top: 0,
|
|
447
|
-
height:
|
|
448
|
-
transform: `translateY(${
|
|
447
|
+
height: a.size + "px",
|
|
448
|
+
transform: `translateY(${a.offset}px)`
|
|
449
449
|
},
|
|
450
450
|
...r.style
|
|
451
451
|
}
|
|
452
452
|
})) : null;
|
|
453
453
|
}), H = "NavigationMenuContent", Rt = /* @__PURE__ */ I((e, t) => {
|
|
454
|
-
const { forceMount: n, ...r } = e, o = A(H, e.__scopeNavigationMenu), i = xe(H, e.__scopeNavigationMenu),
|
|
454
|
+
const { forceMount: n, ...r } = e, o = A(H, e.__scopeNavigationMenu), i = xe(H, e.__scopeNavigationMenu), c = B(i.contentRef, t), u = i.value === o.value, a = {
|
|
455
455
|
value: i.value,
|
|
456
456
|
triggerRef: i.triggerRef,
|
|
457
457
|
focusProxyRef: i.focusProxyRef,
|
|
@@ -462,25 +462,25 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
462
462
|
};
|
|
463
463
|
return o.viewport ? /* @__PURE__ */ d(It, M({
|
|
464
464
|
forceMount: n
|
|
465
|
-
},
|
|
466
|
-
ref:
|
|
465
|
+
}, a, {
|
|
466
|
+
ref: c
|
|
467
467
|
})) : /* @__PURE__ */ d(q, {
|
|
468
468
|
present: n || u
|
|
469
469
|
}, /* @__PURE__ */ d(Me, M({
|
|
470
470
|
"data-state": ue(u)
|
|
471
|
-
},
|
|
472
|
-
ref:
|
|
471
|
+
}, a, {
|
|
472
|
+
ref: c,
|
|
473
473
|
onPointerEnter: T(e.onPointerEnter, o.onContentEnter),
|
|
474
474
|
onPointerLeave: T(e.onPointerLeave, j(o.onContentLeave)),
|
|
475
475
|
style: {
|
|
476
476
|
// Prevent interaction when animating out
|
|
477
477
|
pointerEvents: !u && o.isRootMenu ? "none" : void 0,
|
|
478
|
-
...
|
|
478
|
+
...a.style
|
|
479
479
|
}
|
|
480
480
|
})));
|
|
481
481
|
}), It = /* @__PURE__ */ I((e, t) => {
|
|
482
482
|
const n = A(H, e.__scopeNavigationMenu), { onViewportContentChange: r, onViewportContentRemove: o } = n;
|
|
483
|
-
return
|
|
483
|
+
return Q(() => {
|
|
484
484
|
r(e.value, {
|
|
485
485
|
ref: t,
|
|
486
486
|
...e
|
|
@@ -489,23 +489,23 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
489
489
|
e,
|
|
490
490
|
t,
|
|
491
491
|
r
|
|
492
|
-
]),
|
|
492
|
+
]), Q(() => () => o(e.value), [
|
|
493
493
|
e.value,
|
|
494
494
|
o
|
|
495
495
|
]), null;
|
|
496
496
|
}), Y = "navigationMenu.rootContentDismiss", Me = /* @__PURE__ */ I((e, t) => {
|
|
497
|
-
const { __scopeNavigationMenu: n, value: r, triggerRef: o, focusProxyRef: i, wasEscapeCloseRef:
|
|
497
|
+
const { __scopeNavigationMenu: n, value: r, triggerRef: o, focusProxyRef: i, wasEscapeCloseRef: c, onRootContentClose: u, onContentFocusOutside: a, ...m } = e, s = A(H, n), l = P(null), y = B(l, t), v = Pe(s.baseId, r), f = De(s.baseId, r), p = he(n), w = P(null), { onItemDismiss: x } = s;
|
|
498
498
|
z(() => {
|
|
499
|
-
const
|
|
500
|
-
if (
|
|
499
|
+
const g = l.current;
|
|
500
|
+
if (s.isRootMenu && g) {
|
|
501
501
|
const b = () => {
|
|
502
|
-
var
|
|
503
|
-
x(), u(),
|
|
502
|
+
var $;
|
|
503
|
+
x(), u(), g.contains(document.activeElement) && (($ = o.current) === null || $ === void 0 || $.focus());
|
|
504
504
|
};
|
|
505
|
-
return
|
|
505
|
+
return g.addEventListener(Y, b), () => g.removeEventListener(Y, b);
|
|
506
506
|
}
|
|
507
507
|
}, [
|
|
508
|
-
|
|
508
|
+
s.isRootMenu,
|
|
509
509
|
e.value,
|
|
510
510
|
o,
|
|
511
511
|
x,
|
|
@@ -515,24 +515,24 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
515
515
|
const b = p().map(
|
|
516
516
|
(S) => S.value
|
|
517
517
|
);
|
|
518
|
-
|
|
519
|
-
const
|
|
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
520
|
if (!D && !E)
|
|
521
521
|
return w.current;
|
|
522
522
|
const _ = (() => {
|
|
523
|
-
if (
|
|
523
|
+
if ($ !== C) {
|
|
524
524
|
if (D && C !== -1)
|
|
525
|
-
return
|
|
526
|
-
if (E &&
|
|
527
|
-
return
|
|
525
|
+
return $ > C ? "from-end" : "from-start";
|
|
526
|
+
if (E && $ !== -1)
|
|
527
|
+
return $ > C ? "to-start" : "to-end";
|
|
528
528
|
}
|
|
529
529
|
return null;
|
|
530
530
|
})();
|
|
531
531
|
return w.current = _, _;
|
|
532
532
|
}, [
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
533
|
+
s.previousValue,
|
|
534
|
+
s.value,
|
|
535
|
+
s.dir,
|
|
536
536
|
p,
|
|
537
537
|
r
|
|
538
538
|
]);
|
|
@@ -542,47 +542,47 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
542
542
|
id: f,
|
|
543
543
|
"aria-labelledby": v,
|
|
544
544
|
"data-motion": k,
|
|
545
|
-
"data-orientation":
|
|
546
|
-
},
|
|
545
|
+
"data-orientation": s.orientation
|
|
546
|
+
}, m, {
|
|
547
547
|
ref: y,
|
|
548
548
|
onDismiss: () => {
|
|
549
|
-
var
|
|
549
|
+
var g;
|
|
550
550
|
const b = new Event(Y, {
|
|
551
551
|
bubbles: !0,
|
|
552
552
|
cancelable: !0
|
|
553
553
|
});
|
|
554
|
-
(
|
|
554
|
+
(g = l.current) === null || g === void 0 || g.dispatchEvent(b);
|
|
555
555
|
},
|
|
556
|
-
onFocusOutside: T(e.onFocusOutside, (
|
|
556
|
+
onFocusOutside: T(e.onFocusOutside, (g) => {
|
|
557
557
|
var b;
|
|
558
|
-
|
|
559
|
-
const
|
|
560
|
-
(b =
|
|
558
|
+
a();
|
|
559
|
+
const $ = g.target;
|
|
560
|
+
(b = s.rootNavigationMenu) !== null && b !== void 0 && b.contains($) && g.preventDefault();
|
|
561
561
|
}),
|
|
562
|
-
onPointerDownOutside: T(e.onPointerDownOutside, (
|
|
562
|
+
onPointerDownOutside: T(e.onPointerDownOutside, (g) => {
|
|
563
563
|
var b;
|
|
564
|
-
const
|
|
564
|
+
const $ = g.target, C = p().some((E) => {
|
|
565
565
|
var _;
|
|
566
|
-
return (_ = E.ref.current) === null || _ === void 0 ? void 0 : _.contains(
|
|
567
|
-
}), D =
|
|
568
|
-
(C || D || !
|
|
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
569
|
}),
|
|
570
|
-
onKeyDown: T(e.onKeyDown, (
|
|
571
|
-
const b =
|
|
572
|
-
if (
|
|
573
|
-
const D =
|
|
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
574
|
(Be) => Be === E
|
|
575
|
-
), W =
|
|
575
|
+
), W = g.shiftKey ? D.slice(0, _).reverse() : D.slice(_ + 1, D.length);
|
|
576
576
|
if (ce(W))
|
|
577
|
-
|
|
577
|
+
g.preventDefault();
|
|
578
578
|
else {
|
|
579
579
|
var C;
|
|
580
580
|
(C = i.current) === null || C === void 0 || C.focus();
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
}),
|
|
584
|
-
onEscapeKeyDown: T(e.onEscapeKeyDown, (
|
|
585
|
-
|
|
584
|
+
onEscapeKeyDown: T(e.onEscapeKeyDown, (g) => {
|
|
585
|
+
c.current = !0;
|
|
586
586
|
})
|
|
587
587
|
})));
|
|
588
588
|
}), Ne = "NavigationMenuViewport", Pt = /* @__PURE__ */ I((e, t) => {
|
|
@@ -593,17 +593,17 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
593
593
|
ref: t
|
|
594
594
|
})));
|
|
595
595
|
}), Dt = /* @__PURE__ */ I((e, t) => {
|
|
596
|
-
const { __scopeNavigationMenu: n, children: r, ...o } = e, i = A(Ne, n),
|
|
597
|
-
return
|
|
598
|
-
|
|
599
|
-
width:
|
|
600
|
-
height:
|
|
596
|
+
const { __scopeNavigationMenu: n, children: r, ...o } = e, i = A(Ne, n), c = B(t, i.onViewportChange), u = mt(H, e.__scopeNavigationMenu), [a, m] = K(null), [s, l] = K(null), y = 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
601
|
});
|
|
602
602
|
}), /* @__PURE__ */ d(F.div, M({
|
|
603
603
|
"data-state": ue(f),
|
|
604
604
|
"data-orientation": i.orientation
|
|
605
605
|
}, o, {
|
|
606
|
-
ref:
|
|
606
|
+
ref: c,
|
|
607
607
|
style: {
|
|
608
608
|
// Prevent interaction when animating out
|
|
609
609
|
pointerEvents: !f && i.isRootMenu ? "none" : void 0,
|
|
@@ -613,22 +613,22 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
613
613
|
},
|
|
614
614
|
onPointerEnter: T(e.onPointerEnter, i.onContentEnter),
|
|
615
615
|
onPointerLeave: T(e.onPointerLeave, j(i.onContentLeave))
|
|
616
|
-
}), Array.from(u.items).map(([x, { ref: k, forceMount:
|
|
617
|
-
const
|
|
616
|
+
}), Array.from(u.items).map(([x, { ref: k, forceMount: g, ...b }]) => {
|
|
617
|
+
const $ = p === x;
|
|
618
618
|
return /* @__PURE__ */ d(q, {
|
|
619
619
|
key: x,
|
|
620
|
-
present:
|
|
620
|
+
present: g || $
|
|
621
621
|
}, /* @__PURE__ */ d(Me, M({}, b, {
|
|
622
622
|
ref: Xe(k, (C) => {
|
|
623
|
-
|
|
623
|
+
$ && C && l(C);
|
|
624
624
|
})
|
|
625
625
|
})));
|
|
626
626
|
}));
|
|
627
627
|
}), Ot = "FocusGroup", Re = /* @__PURE__ */ I((e, t) => {
|
|
628
628
|
const { __scopeNavigationMenu: n, ...r } = e, o = A(Ot, n);
|
|
629
|
-
return /* @__PURE__ */ d(
|
|
629
|
+
return /* @__PURE__ */ d(ne.Provider, {
|
|
630
630
|
scope: n
|
|
631
|
-
}, /* @__PURE__ */ d(
|
|
631
|
+
}, /* @__PURE__ */ d(ne.Slot, {
|
|
632
632
|
scope: n
|
|
633
633
|
}, /* @__PURE__ */ d(F.div, M({
|
|
634
634
|
dir: o.dir
|
|
@@ -642,35 +642,35 @@ const ut = /* @__PURE__ */ I((e, t) => /* @__PURE__ */ d(F.span, M({}, e, {
|
|
|
642
642
|
"ArrowDown"
|
|
643
643
|
], kt = "FocusGroupItem", Ie = /* @__PURE__ */ I((e, t) => {
|
|
644
644
|
const { __scopeNavigationMenu: n, ...r } = e, o = ft(n), i = A(kt, n);
|
|
645
|
-
return /* @__PURE__ */ d(
|
|
645
|
+
return /* @__PURE__ */ d(ne.ItemSlot, {
|
|
646
646
|
scope: n
|
|
647
647
|
}, /* @__PURE__ */ d(F.button, M({}, r, {
|
|
648
648
|
ref: t,
|
|
649
|
-
onKeyDown: T(e.onKeyDown, (
|
|
649
|
+
onKeyDown: T(e.onKeyDown, (c) => {
|
|
650
650
|
if ([
|
|
651
651
|
"Home",
|
|
652
652
|
"End",
|
|
653
653
|
...me
|
|
654
|
-
].includes(
|
|
655
|
-
let
|
|
654
|
+
].includes(c.key)) {
|
|
655
|
+
let a = o().map(
|
|
656
656
|
(l) => l.ref.current
|
|
657
657
|
);
|
|
658
658
|
if ([
|
|
659
659
|
i.dir === "rtl" ? "ArrowRight" : "ArrowLeft",
|
|
660
660
|
"ArrowUp",
|
|
661
661
|
"End"
|
|
662
|
-
].includes(
|
|
663
|
-
const l =
|
|
664
|
-
|
|
662
|
+
].includes(c.key) && a.reverse(), me.includes(c.key)) {
|
|
663
|
+
const l = a.indexOf(c.currentTarget);
|
|
664
|
+
a = a.slice(l + 1);
|
|
665
665
|
}
|
|
666
666
|
setTimeout(
|
|
667
|
-
() => ce(
|
|
668
|
-
),
|
|
667
|
+
() => ce(a)
|
|
668
|
+
), c.preventDefault();
|
|
669
669
|
}
|
|
670
670
|
})
|
|
671
671
|
})));
|
|
672
672
|
});
|
|
673
|
-
function
|
|
673
|
+
function oe(e) {
|
|
674
674
|
const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
675
675
|
acceptNode: (r) => {
|
|
676
676
|
const o = r.tagName === "INPUT" && r.type === "hidden";
|
|
@@ -695,9 +695,9 @@ function Ft(e) {
|
|
|
695
695
|
});
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function re(e, t) {
|
|
699
699
|
const n = V(t);
|
|
700
|
-
|
|
700
|
+
Q(() => {
|
|
701
701
|
let r = 0;
|
|
702
702
|
if (e) {
|
|
703
703
|
const o = new ResizeObserver(() => {
|
|
@@ -745,7 +745,7 @@ const Lt = pt, At = _t, Kt = wt, St = Ct, Vt = xt, zt = Tt, Wt = Mt, Ut = Rt, Bt
|
|
|
745
745
|
"teddy-navigation-menu__link--button": "_teddy-navigation-menu__link--button_8k0ri_313",
|
|
746
746
|
scaleIn: qt,
|
|
747
747
|
scaleOut: Xt
|
|
748
|
-
}, R = "teddy-navigation-menu",
|
|
748
|
+
}, R = "teddy-navigation-menu", J = h.createContext({
|
|
749
749
|
selectedTopMenu: void 0,
|
|
750
750
|
setSelectedTopMenu: () => {
|
|
751
751
|
},
|
|
@@ -763,27 +763,27 @@ const Lt = pt, At = _t, Kt = wt, St = Ct, Vt = xt, zt = Tt, Wt = Mt, Ut = Rt, Bt
|
|
|
763
763
|
}
|
|
764
764
|
}), Oe = h.forwardRef(
|
|
765
765
|
({ className: e, defaultTopMenuValue: t, ...n }, r) => {
|
|
766
|
-
const [o, i] = h.useState(t),
|
|
767
|
-
}),
|
|
768
|
-
if (
|
|
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
769
|
u.current();
|
|
770
|
-
const p =
|
|
770
|
+
const p = ie(c.current);
|
|
771
771
|
p.length && le(f === "start" ? p : p.reverse());
|
|
772
772
|
}
|
|
773
773
|
}, []), y = h.useCallback(() => {
|
|
774
|
-
if (
|
|
775
|
-
const f =
|
|
774
|
+
if (c.current) {
|
|
775
|
+
const f = ie(c.current);
|
|
776
776
|
f.length && (u.current = en(f));
|
|
777
777
|
}
|
|
778
778
|
}, []), v = L([N[`${R}`]], e);
|
|
779
779
|
return /* @__PURE__ */ O(
|
|
780
|
-
|
|
780
|
+
J.Provider,
|
|
781
781
|
{
|
|
782
782
|
value: {
|
|
783
|
-
contentRef:
|
|
784
|
-
focusProxyRef:
|
|
785
|
-
topMenuRef:
|
|
786
|
-
id:
|
|
783
|
+
contentRef: c,
|
|
784
|
+
focusProxyRef: a,
|
|
785
|
+
topMenuRef: m,
|
|
786
|
+
id: s,
|
|
787
787
|
dir: n.dir || "ltr",
|
|
788
788
|
orientation: n.orientation || "horizontal",
|
|
789
789
|
onEntryKeyDown: l,
|
|
@@ -800,7 +800,7 @@ const Lt = pt, At = _t, Kt = wt, St = Ct, Vt = xt, zt = Tt, Wt = Mt, Ut = Rt, Bt
|
|
|
800
800
|
Oe.displayName = "NavigationMenu";
|
|
801
801
|
const ke = h.forwardRef(
|
|
802
802
|
({ className: e, ...t }, n) => {
|
|
803
|
-
const r = L([N[`${R}__top-menu-list`]], e), o = h.useContext(
|
|
803
|
+
const r = L([N[`${R}__top-menu-list`]], e), o = h.useContext(J), i = X(o.topMenuRef, n);
|
|
804
804
|
return /* @__PURE__ */ O("ul", { ...t, ref: i, className: r });
|
|
805
805
|
}
|
|
806
806
|
);
|
|
@@ -815,34 +815,34 @@ const Jt = h.forwardRef(
|
|
|
815
815
|
const r = L(
|
|
816
816
|
[N[`${R}__top-menu-trigger`], N[`${R}__top-menu-trigger--small`]],
|
|
817
817
|
e
|
|
818
|
-
), o = h.useContext(
|
|
818
|
+
), o = h.useContext(J), i = h.useRef(null), c = X(i, n), u = o.selectedTopMenu === t.value;
|
|
819
819
|
return /* @__PURE__ */ He(Ge, { children: [
|
|
820
820
|
/* @__PURE__ */ O(
|
|
821
821
|
"button",
|
|
822
822
|
{
|
|
823
823
|
...t,
|
|
824
|
-
ref:
|
|
824
|
+
ref: c,
|
|
825
825
|
className: r,
|
|
826
826
|
"data-state": u ? "open" : "closed",
|
|
827
827
|
"aria-expanded": u,
|
|
828
828
|
"aria-controls": Ue({ value: t.value, baseId: o.id }),
|
|
829
829
|
[pe]: "",
|
|
830
|
-
onClick:
|
|
830
|
+
onClick: ee(t.onClick, () => {
|
|
831
831
|
o.setSelectedTopMenu(t.value);
|
|
832
832
|
}),
|
|
833
|
-
onKeyDown:
|
|
833
|
+
onKeyDown: ee(t.onKeyDown, (a) => {
|
|
834
834
|
var y;
|
|
835
|
-
const
|
|
836
|
-
if (u &&
|
|
837
|
-
return o.onEntryKeyDown(),
|
|
838
|
-
if (["Home", "End", ...be].includes(
|
|
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
839
|
const v = (y = o.topMenuRef.current) == null ? void 0 : y.querySelectorAll(`[${pe}]`);
|
|
840
840
|
if (!v)
|
|
841
841
|
return;
|
|
842
842
|
let f = Array.from(v == null ? void 0 : v.values());
|
|
843
|
-
if ([o.dir === "rtl" ? "ArrowRight" : "ArrowLeft", "ArrowUp", "End"].includes(
|
|
844
|
-
const x = f.indexOf(
|
|
845
|
-
f = f.slice(x + 1), le(f),
|
|
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
846
|
}
|
|
847
847
|
}
|
|
848
848
|
})
|
|
@@ -854,8 +854,8 @@ const Jt = h.forwardRef(
|
|
|
854
854
|
"aria-hidden": !0,
|
|
855
855
|
tabIndex: 0,
|
|
856
856
|
ref: o.focusProxyRef,
|
|
857
|
-
onFocus: (
|
|
858
|
-
const
|
|
857
|
+
onFocus: (a) => {
|
|
858
|
+
const m = o.contentRef.current, s = a.relatedTarget, l = s === i.current, y = m == null ? void 0 : m.contains(s);
|
|
859
859
|
(l || !y) && o.onFocusProxyEnter(l ? "start" : "end");
|
|
860
860
|
}
|
|
861
861
|
}
|
|
@@ -864,28 +864,26 @@ const Jt = h.forwardRef(
|
|
|
864
864
|
}
|
|
865
865
|
), Fe = h.forwardRef(
|
|
866
866
|
({ className: e, variant: t, value: n, ...r }, o) => {
|
|
867
|
-
const i = L([N[`${R}__list`]], [N[`${R}__list--${t}`]], e),
|
|
868
|
-
return /* @__PURE__ */ O(
|
|
867
|
+
const i = L([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
869
|
Kt,
|
|
870
870
|
{
|
|
871
|
-
ref:
|
|
872
|
-
id: n && Ue({ value: n, baseId:
|
|
873
|
-
hidden: c ? !g : void 0,
|
|
871
|
+
ref: a ? u : o,
|
|
872
|
+
id: n && Ue({ value: n, baseId: c.id }),
|
|
874
873
|
...r,
|
|
875
|
-
onKeyDown:
|
|
874
|
+
onKeyDown: ee(r.onKeyDown, (s) => {
|
|
876
875
|
var v;
|
|
877
876
|
if (!n)
|
|
878
877
|
return;
|
|
879
|
-
const l =
|
|
880
|
-
if (
|
|
881
|
-
const f =
|
|
882
|
-
le(k) ?
|
|
878
|
+
const l = s.altKey || s.ctrlKey || s.metaKey;
|
|
879
|
+
if (s.key === "Tab" && !l) {
|
|
880
|
+
const f = ie(s.currentTarget), p = document.activeElement, w = f.findIndex((g) => g === p), k = s.shiftKey ? f.slice(0, w).reverse() : f.slice(w + 1, f.length);
|
|
881
|
+
le(k) ? s.preventDefault() : ((v = c.focusProxyRef.current) == null || v.focus(), c.onContentFocusOutside());
|
|
883
882
|
}
|
|
884
883
|
}),
|
|
885
|
-
style: c && !g ? { display: "none", ...r.style } : r.style,
|
|
886
884
|
className: i
|
|
887
885
|
}
|
|
888
|
-
);
|
|
886
|
+
) : null;
|
|
889
887
|
}
|
|
890
888
|
);
|
|
891
889
|
Fe.displayName = "NavigationMenu.List";
|
|
@@ -897,22 +895,23 @@ const Le = h.forwardRef(
|
|
|
897
895
|
);
|
|
898
896
|
Le.displayName = "NavigationMenu.Item";
|
|
899
897
|
const Ae = h.forwardRef(
|
|
900
|
-
({ className: e,
|
|
901
|
-
const
|
|
898
|
+
({ className: e, active: t, variant: n = "default", ...r }, o) => {
|
|
899
|
+
const i = L(
|
|
902
900
|
[N[`${R}__trigger`]],
|
|
903
|
-
[N[`${R}__trigger--${
|
|
901
|
+
[N[`${R}__trigger--${n}`]],
|
|
904
902
|
e
|
|
905
|
-
);
|
|
903
|
+
), c = h.useRef(null), u = X(o, c);
|
|
906
904
|
return /* @__PURE__ */ O(
|
|
907
905
|
Vt,
|
|
908
906
|
{
|
|
909
|
-
onPointerEnter: (
|
|
910
|
-
onPointerMove: (
|
|
911
|
-
onPointerLeave: (
|
|
912
|
-
...
|
|
913
|
-
ref:
|
|
914
|
-
|
|
915
|
-
|
|
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)
|
|
916
915
|
}
|
|
917
916
|
);
|
|
918
917
|
}
|
|
@@ -987,7 +986,7 @@ function We(e) {
|
|
|
987
986
|
}
|
|
988
987
|
return t(e);
|
|
989
988
|
}
|
|
990
|
-
function
|
|
989
|
+
function ie(e) {
|
|
991
990
|
const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
992
991
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
993
992
|
acceptNode: (r) => {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"pnpm": ">=8"
|
|
12
12
|
},
|
|
13
13
|
"private": false,
|
|
14
|
-
"version": "0.0.
|
|
14
|
+
"version": "0.0.9",
|
|
15
15
|
"sideEffects": [
|
|
16
16
|
"**/*.css"
|
|
17
17
|
],
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"react-dom": "^18.0.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@changesets/cli": "^2.27.1",
|
|
24
23
|
"@chromatic-com/storybook": "^1.3.3",
|
|
25
24
|
"@laynezh/vite-plugin-lib-assets": "^0.5.19",
|
|
26
25
|
"@storybook/addon-a11y": "^8.0.9",
|
|
@@ -58,6 +57,7 @@
|
|
|
58
57
|
"prettier": "3.2.5",
|
|
59
58
|
"react": "^18.2.0",
|
|
60
59
|
"react-dom": "^18.2.0",
|
|
60
|
+
"react-router-dom": "^6.23.0",
|
|
61
61
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
62
62
|
"sass": "^1.70.0",
|
|
63
63
|
"storybook": "^8.0.9",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"@radix-ui/react-radio-group": "^1.1.3",
|
|
76
76
|
"@radix-ui/react-slot": "^1.0.2",
|
|
77
77
|
"@radix-ui/react-switch": "^1.0.3",
|
|
78
|
+
"@radix-ui/react-toast": "^1.1.5",
|
|
78
79
|
"@react-spring/web": "^9.7.3",
|
|
79
80
|
"clsx": "^2.1.0"
|
|
80
81
|
},
|
|
@@ -92,23 +93,5 @@
|
|
|
92
93
|
"bugs": {
|
|
93
94
|
"url": "https://github.com/telia-company/teddy/issues"
|
|
94
95
|
},
|
|
95
|
-
"homepage": "https://github.com/telia-company/teddy#readme"
|
|
96
|
-
"scripts": {
|
|
97
|
-
"build:icons": "tsx other/scripts/build-icons.ts",
|
|
98
|
-
"build:tokens": "tsx other/scripts/build-tokens.ts",
|
|
99
|
-
"build:storybook": "storybook build",
|
|
100
|
-
"build:storybook-ci": "storybook build --loglevel silly --disable-telemetry",
|
|
101
|
-
"create:component": "tsx node_modules/plop/bin/plop.js --plopfile other/scripts/plopfile.ts",
|
|
102
|
-
"clean": "rm -rf dist",
|
|
103
|
-
"prebuild": "pnpm run build:icons && pnpm run build:tokens",
|
|
104
|
-
"storybook": "storybook dev -p 6006",
|
|
105
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
106
|
-
"preinstall": "npx only-allow pnpm",
|
|
107
|
-
"dev": "vite",
|
|
108
|
-
"build": "pnpm run clean && tsc --p ./tsconfig.build.json && vite build",
|
|
109
|
-
"preview": "vite preview",
|
|
110
|
-
"release": "pnpm run build && changeset publish",
|
|
111
|
-
"format": "prettier --write .",
|
|
112
|
-
"lint:fix": "eslint . --ext ts,tsx --fix"
|
|
113
|
-
}
|
|
96
|
+
"homepage": "https://github.com/telia-company/teddy#readme"
|
|
114
97
|
}
|