@phillips/seldon 1.246.0 → 1.247.0
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/_virtual/index12.js +2 -2
- package/dist/_virtual/index13.js +2 -2
- package/dist/assets/formatted/Search.js +8 -9
- package/dist/components/Input/utils.js +5 -3
- package/dist/components/Navigation/Navigation.js +51 -27
- package/dist/components/Navigation/Navigation.stories.d.ts +1 -2
- package/dist/components/Navigation/NavigationItem/NavigationItem.d.ts +8 -0
- package/dist/components/Navigation/NavigationItem/NavigationItem.js +43 -42
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationDesktopSubmenu.d.ts +17 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationDesktopSubmenu.js +70 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationItemWithSubmenu.d.ts +31 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationItemWithSubmenu.js +68 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/index.d.ts +2 -0
- package/dist/components/Navigation/NavigationList/NavigationList.d.ts +11 -8
- package/dist/components/Navigation/NavigationList/NavigationList.js +21 -46
- package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.d.ts +33 -0
- package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.js +41 -0
- package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.test.d.ts +1 -0
- package/dist/components/Search/Search.js +51 -47
- package/dist/components/Search/SearchButton.js +10 -10
- package/dist/components/Search/SearchResults/SearchResults.d.ts +2 -1
- package/dist/components/Search/SearchResults/SearchResults.js +22 -21
- package/dist/index.d.ts +3 -1
- package/dist/index.js +201 -197
- package/dist/node_modules/@radix-ui/react-navigation-menu/dist/index.js +597 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-collection/dist/index.js +50 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-presence/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-slot/dist/index.js +49 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +52 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-visually-hidden/dist/index.js +32 -0
- package/dist/node_modules/ics/dist/schema/index.js +1 -1
- package/dist/node_modules/ics/dist/utils/index.js +1 -1
- package/dist/patterns/UserManagement/UserManagement.js +45 -27
- package/dist/scss/componentStyles.scss +1 -1
- package/dist/scss/components/Accordion/_accordion.scss +6 -0
- package/dist/scss/components/Navigation/NavigationItem/_navigationItem.scss +0 -12
- package/dist/scss/components/Navigation/NavigationItemWithSubmenu/_navigationItemWithSubmenu.scss +114 -0
- package/dist/scss/components/Navigation/NavigationList/_navigationList.scss +15 -3
- package/dist/scss/components/Navigation/_navigation.scss +109 -0
- package/dist/scss/components/Search/_search.scss +1 -0
- package/dist/scss/site-furniture/Header/_header.scss +24 -0
- package/dist/site-furniture/Header/Header.d.ts +8 -4
- package/dist/site-furniture/Header/Header.js +55 -50
- package/dist/site-furniture/Header/Header.stories.d.ts +278 -0
- package/dist/site-furniture/Header/utils.js +1 -2
- package/package.json +5 -1
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.d.ts +0 -22
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.js +0 -80
- package/dist/scss/components/Navigation/NavigationItemTrigger/_navigationItemTrigger.scss +0 -111
- /package/dist/components/Navigation/{NavigationItemTrigger/NavigationItemTrigger.test.d.ts → NavigationItemWithSubmenu/NavigationItemWithSubmenu.test.d.ts} +0 -0
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import Ee from "react-dom";
|
|
3
|
+
import { createContextScope as Te } from "../../react-context/dist/index.js";
|
|
4
|
+
import { composeEventHandlers as y } from "../node_modules/@radix-ui/primitive/dist/index.js";
|
|
5
|
+
import { Primitive as b, dispatchDiscreteCustomEvent as Q } from "../node_modules/@radix-ui/react-primitive/dist/index.js";
|
|
6
|
+
import { useControllableState as oe } from "../node_modules/@radix-ui/react-use-controllable-state/dist/index.js";
|
|
7
|
+
import { useComposedRefs as k, composeRefs as ye } from "../../react-compose-refs/dist/index.js";
|
|
8
|
+
import { useDirection as Ie } from "../../react-direction/dist/index.js";
|
|
9
|
+
import { Presence as K } from "../node_modules/@radix-ui/react-presence/dist/index.js";
|
|
10
|
+
import { useId as re } from "../../react-id/dist/index.js";
|
|
11
|
+
import { createCollection as ie } from "../node_modules/@radix-ui/react-collection/dist/index.js";
|
|
12
|
+
import { DismissableLayer as be } from "../node_modules/@radix-ui/react-dismissable-layer/dist/index.js";
|
|
13
|
+
import { usePrevious as _e } from "../../react-use-previous/dist/index.js";
|
|
14
|
+
import { useLayoutEffect as z } from "../../react-use-layout-effect/dist/index.js";
|
|
15
|
+
import { useCallbackRef as D } from "../../react-use-callback-ref/dist/index.js";
|
|
16
|
+
import { Root as Pe } from "../node_modules/@radix-ui/react-visually-hidden/dist/index.js";
|
|
17
|
+
import { jsx as u, jsxs as Z, Fragment as ee } from "react/jsx-runtime";
|
|
18
|
+
var A = "NavigationMenu", [$, ae, xe] = ie(A), [G, Se, De] = ie(A), [Y] = Te(
|
|
19
|
+
A,
|
|
20
|
+
[xe, De]
|
|
21
|
+
), [Ae, I] = Y(A), [Oe, ke] = Y(A), se = a.forwardRef(
|
|
22
|
+
(e, t) => {
|
|
23
|
+
const {
|
|
24
|
+
__scopeNavigationMenu: r,
|
|
25
|
+
value: i,
|
|
26
|
+
onValueChange: n,
|
|
27
|
+
defaultValue: o,
|
|
28
|
+
delayDuration: s = 200,
|
|
29
|
+
skipDelayDuration: d = 300,
|
|
30
|
+
orientation: l = "horizontal",
|
|
31
|
+
dir: R,
|
|
32
|
+
...c
|
|
33
|
+
} = e, [m, h] = a.useState(null), E = k(t, (M) => h(M)), p = Ie(R), w = a.useRef(0), N = a.useRef(0), T = a.useRef(0), [_, f] = a.useState(!0), [g, v] = oe({
|
|
34
|
+
prop: i,
|
|
35
|
+
onChange: (M) => {
|
|
36
|
+
const x = M !== "", V = d > 0;
|
|
37
|
+
x ? (window.clearTimeout(T.current), V && f(!1)) : (window.clearTimeout(T.current), T.current = window.setTimeout(
|
|
38
|
+
() => f(!0),
|
|
39
|
+
d
|
|
40
|
+
)), n?.(M);
|
|
41
|
+
},
|
|
42
|
+
defaultProp: o ?? "",
|
|
43
|
+
caller: A
|
|
44
|
+
}), C = a.useCallback(() => {
|
|
45
|
+
window.clearTimeout(N.current), N.current = window.setTimeout(() => v(""), 150);
|
|
46
|
+
}, [v]), P = a.useCallback(
|
|
47
|
+
(M) => {
|
|
48
|
+
window.clearTimeout(N.current), v(M);
|
|
49
|
+
},
|
|
50
|
+
[v]
|
|
51
|
+
), S = a.useCallback(
|
|
52
|
+
(M) => {
|
|
53
|
+
g === M ? window.clearTimeout(N.current) : w.current = window.setTimeout(() => {
|
|
54
|
+
window.clearTimeout(N.current), v(M);
|
|
55
|
+
}, s);
|
|
56
|
+
},
|
|
57
|
+
[g, v, s]
|
|
58
|
+
);
|
|
59
|
+
return a.useEffect(() => () => {
|
|
60
|
+
window.clearTimeout(w.current), window.clearTimeout(N.current), window.clearTimeout(T.current);
|
|
61
|
+
}, []), /* @__PURE__ */ u(
|
|
62
|
+
ce,
|
|
63
|
+
{
|
|
64
|
+
scope: r,
|
|
65
|
+
isRootMenu: !0,
|
|
66
|
+
value: g,
|
|
67
|
+
dir: p,
|
|
68
|
+
orientation: l,
|
|
69
|
+
rootNavigationMenu: m,
|
|
70
|
+
onTriggerEnter: (M) => {
|
|
71
|
+
window.clearTimeout(w.current), _ ? S(M) : P(M);
|
|
72
|
+
},
|
|
73
|
+
onTriggerLeave: () => {
|
|
74
|
+
window.clearTimeout(w.current), C();
|
|
75
|
+
},
|
|
76
|
+
onContentEnter: () => window.clearTimeout(N.current),
|
|
77
|
+
onContentLeave: C,
|
|
78
|
+
onItemSelect: (M) => {
|
|
79
|
+
v((x) => x === M ? "" : M);
|
|
80
|
+
},
|
|
81
|
+
onItemDismiss: () => v(""),
|
|
82
|
+
children: /* @__PURE__ */ u(
|
|
83
|
+
b.nav,
|
|
84
|
+
{
|
|
85
|
+
"aria-label": "Main",
|
|
86
|
+
"data-orientation": l,
|
|
87
|
+
dir: p,
|
|
88
|
+
...c,
|
|
89
|
+
ref: E
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
se.displayName = A;
|
|
97
|
+
var U = "NavigationMenuSub", Le = a.forwardRef(
|
|
98
|
+
(e, t) => {
|
|
99
|
+
const {
|
|
100
|
+
__scopeNavigationMenu: r,
|
|
101
|
+
value: i,
|
|
102
|
+
onValueChange: n,
|
|
103
|
+
defaultValue: o,
|
|
104
|
+
orientation: s = "horizontal",
|
|
105
|
+
...d
|
|
106
|
+
} = e, l = I(U, r), [R, c] = oe({
|
|
107
|
+
prop: i,
|
|
108
|
+
onChange: n,
|
|
109
|
+
defaultProp: o ?? "",
|
|
110
|
+
caller: U
|
|
111
|
+
});
|
|
112
|
+
return /* @__PURE__ */ u(
|
|
113
|
+
ce,
|
|
114
|
+
{
|
|
115
|
+
scope: r,
|
|
116
|
+
isRootMenu: !1,
|
|
117
|
+
value: R,
|
|
118
|
+
dir: l.dir,
|
|
119
|
+
orientation: s,
|
|
120
|
+
rootNavigationMenu: l.rootNavigationMenu,
|
|
121
|
+
onTriggerEnter: (m) => c(m),
|
|
122
|
+
onItemSelect: (m) => c(m),
|
|
123
|
+
onItemDismiss: () => c(""),
|
|
124
|
+
children: /* @__PURE__ */ u(b.div, { "data-orientation": s, ...d, ref: t })
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
Le.displayName = U;
|
|
130
|
+
var ce = (e) => {
|
|
131
|
+
const {
|
|
132
|
+
scope: t,
|
|
133
|
+
isRootMenu: r,
|
|
134
|
+
rootNavigationMenu: i,
|
|
135
|
+
dir: n,
|
|
136
|
+
orientation: o,
|
|
137
|
+
children: s,
|
|
138
|
+
value: d,
|
|
139
|
+
onItemSelect: l,
|
|
140
|
+
onItemDismiss: R,
|
|
141
|
+
onTriggerEnter: c,
|
|
142
|
+
onTriggerLeave: m,
|
|
143
|
+
onContentEnter: h,
|
|
144
|
+
onContentLeave: E
|
|
145
|
+
} = e, [p, w] = a.useState(null), [N, T] = a.useState(/* @__PURE__ */ new Map()), [_, f] = a.useState(null);
|
|
146
|
+
return /* @__PURE__ */ u(
|
|
147
|
+
Ae,
|
|
148
|
+
{
|
|
149
|
+
scope: t,
|
|
150
|
+
isRootMenu: r,
|
|
151
|
+
rootNavigationMenu: i,
|
|
152
|
+
value: d,
|
|
153
|
+
previousValue: _e(d),
|
|
154
|
+
baseId: re(),
|
|
155
|
+
dir: n,
|
|
156
|
+
orientation: o,
|
|
157
|
+
viewport: p,
|
|
158
|
+
onViewportChange: w,
|
|
159
|
+
indicatorTrack: _,
|
|
160
|
+
onIndicatorTrackChange: f,
|
|
161
|
+
onTriggerEnter: D(c),
|
|
162
|
+
onTriggerLeave: D(m),
|
|
163
|
+
onContentEnter: D(h),
|
|
164
|
+
onContentLeave: D(E),
|
|
165
|
+
onItemSelect: D(l),
|
|
166
|
+
onItemDismiss: D(R),
|
|
167
|
+
onViewportContentChange: a.useCallback((g, v) => {
|
|
168
|
+
T((C) => (C.set(g, v), new Map(C)));
|
|
169
|
+
}, []),
|
|
170
|
+
onViewportContentRemove: a.useCallback((g) => {
|
|
171
|
+
T((v) => v.has(g) ? (v.delete(g), new Map(v)) : v);
|
|
172
|
+
}, []),
|
|
173
|
+
children: /* @__PURE__ */ u($.Provider, { scope: t, children: /* @__PURE__ */ u(Oe, { scope: t, items: N, children: s }) })
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
}, ue = "NavigationMenuList", le = a.forwardRef(
|
|
177
|
+
(e, t) => {
|
|
178
|
+
const { __scopeNavigationMenu: r, ...i } = e, n = I(ue, r), o = /* @__PURE__ */ u(b.ul, { "data-orientation": n.orientation, ...i, ref: t });
|
|
179
|
+
return /* @__PURE__ */ u(b.div, { style: { position: "relative" }, ref: n.onIndicatorTrackChange, children: /* @__PURE__ */ u($.Slot, { scope: r, children: n.isRootMenu ? /* @__PURE__ */ u(Re, { asChild: !0, children: o }) : o }) });
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
le.displayName = ue;
|
|
183
|
+
var de = "NavigationMenuItem", [Fe, fe] = Y(de), ve = a.forwardRef(
|
|
184
|
+
(e, t) => {
|
|
185
|
+
const { __scopeNavigationMenu: r, value: i, ...n } = e, o = re(), s = i || o || "LEGACY_REACT_AUTO_VALUE", d = a.useRef(null), l = a.useRef(null), R = a.useRef(null), c = a.useRef(() => {
|
|
186
|
+
}), m = a.useRef(!1), h = a.useCallback((p = "start") => {
|
|
187
|
+
if (d.current) {
|
|
188
|
+
c.current();
|
|
189
|
+
const w = B(d.current);
|
|
190
|
+
w.length && X(p === "start" ? w : w.reverse());
|
|
191
|
+
}
|
|
192
|
+
}, []), E = a.useCallback(() => {
|
|
193
|
+
if (d.current) {
|
|
194
|
+
const p = B(d.current);
|
|
195
|
+
p.length && (c.current = We(p));
|
|
196
|
+
}
|
|
197
|
+
}, []);
|
|
198
|
+
return /* @__PURE__ */ u(
|
|
199
|
+
Fe,
|
|
200
|
+
{
|
|
201
|
+
scope: r,
|
|
202
|
+
value: s,
|
|
203
|
+
triggerRef: l,
|
|
204
|
+
contentRef: d,
|
|
205
|
+
focusProxyRef: R,
|
|
206
|
+
wasEscapeCloseRef: m,
|
|
207
|
+
onEntryKeyDown: h,
|
|
208
|
+
onFocusProxyEnter: h,
|
|
209
|
+
onRootContentClose: E,
|
|
210
|
+
onContentFocusOutside: E,
|
|
211
|
+
children: /* @__PURE__ */ u(b.li, { ...n, ref: t })
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
ve.displayName = de;
|
|
217
|
+
var H = "NavigationMenuTrigger", me = a.forwardRef((e, t) => {
|
|
218
|
+
const { __scopeNavigationMenu: r, disabled: i, ...n } = e, o = I(H, e.__scopeNavigationMenu), s = fe(H, e.__scopeNavigationMenu), d = a.useRef(null), l = k(d, s.triggerRef, t), R = Ne(o.baseId, s.value), c = he(o.baseId, s.value), m = a.useRef(!1), h = a.useRef(!1), E = s.value === o.value;
|
|
219
|
+
return /* @__PURE__ */ Z(ee, { children: [
|
|
220
|
+
/* @__PURE__ */ u($.ItemSlot, { scope: r, value: s.value, children: /* @__PURE__ */ u(Me, { asChild: !0, children: /* @__PURE__ */ u(
|
|
221
|
+
b.button,
|
|
222
|
+
{
|
|
223
|
+
id: R,
|
|
224
|
+
disabled: i,
|
|
225
|
+
"data-disabled": i ? "" : void 0,
|
|
226
|
+
"data-state": J(E),
|
|
227
|
+
"aria-expanded": E,
|
|
228
|
+
"aria-controls": c,
|
|
229
|
+
...n,
|
|
230
|
+
ref: l,
|
|
231
|
+
onPointerEnter: y(e.onPointerEnter, () => {
|
|
232
|
+
h.current = !1, s.wasEscapeCloseRef.current = !1;
|
|
233
|
+
}),
|
|
234
|
+
onPointerMove: y(
|
|
235
|
+
e.onPointerMove,
|
|
236
|
+
F(() => {
|
|
237
|
+
i || h.current || s.wasEscapeCloseRef.current || m.current || (o.onTriggerEnter(s.value), m.current = !0);
|
|
238
|
+
})
|
|
239
|
+
),
|
|
240
|
+
onPointerLeave: y(
|
|
241
|
+
e.onPointerLeave,
|
|
242
|
+
F(() => {
|
|
243
|
+
i || (o.onTriggerLeave(), m.current = !1);
|
|
244
|
+
})
|
|
245
|
+
),
|
|
246
|
+
onClick: y(e.onClick, () => {
|
|
247
|
+
o.onItemSelect(s.value), h.current = E;
|
|
248
|
+
}),
|
|
249
|
+
onKeyDown: y(e.onKeyDown, (p) => {
|
|
250
|
+
const N = { horizontal: "ArrowDown", vertical: o.dir === "rtl" ? "ArrowLeft" : "ArrowRight" }[o.orientation];
|
|
251
|
+
E && p.key === N && (s.onEntryKeyDown(), p.preventDefault());
|
|
252
|
+
})
|
|
253
|
+
}
|
|
254
|
+
) }) }),
|
|
255
|
+
E && /* @__PURE__ */ Z(ee, { children: [
|
|
256
|
+
/* @__PURE__ */ u(
|
|
257
|
+
Pe,
|
|
258
|
+
{
|
|
259
|
+
"aria-hidden": !0,
|
|
260
|
+
tabIndex: 0,
|
|
261
|
+
ref: s.focusProxyRef,
|
|
262
|
+
onFocus: (p) => {
|
|
263
|
+
const w = s.contentRef.current, N = p.relatedTarget, T = N === d.current, _ = w?.contains(N);
|
|
264
|
+
(T || !_) && s.onFocusProxyEnter(T ? "start" : "end");
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
),
|
|
268
|
+
o.viewport && /* @__PURE__ */ u("span", { "aria-owns": c })
|
|
269
|
+
] })
|
|
270
|
+
] });
|
|
271
|
+
});
|
|
272
|
+
me.displayName = H;
|
|
273
|
+
var Ke = "NavigationMenuLink", te = "navigationMenu.linkSelect", ge = a.forwardRef(
|
|
274
|
+
(e, t) => {
|
|
275
|
+
const { __scopeNavigationMenu: r, active: i, onSelect: n, ...o } = e;
|
|
276
|
+
return /* @__PURE__ */ u(Me, { asChild: !0, children: /* @__PURE__ */ u(
|
|
277
|
+
b.a,
|
|
278
|
+
{
|
|
279
|
+
"data-active": i ? "" : void 0,
|
|
280
|
+
"aria-current": i ? "page" : void 0,
|
|
281
|
+
...o,
|
|
282
|
+
ref: t,
|
|
283
|
+
onClick: y(
|
|
284
|
+
e.onClick,
|
|
285
|
+
(s) => {
|
|
286
|
+
const d = s.target, l = new CustomEvent(te, {
|
|
287
|
+
bubbles: !0,
|
|
288
|
+
cancelable: !0
|
|
289
|
+
});
|
|
290
|
+
if (d.addEventListener(te, (R) => n?.(R), { once: !0 }), Q(d, l), !l.defaultPrevented && !s.metaKey) {
|
|
291
|
+
const R = new CustomEvent(L, {
|
|
292
|
+
bubbles: !0,
|
|
293
|
+
cancelable: !0
|
|
294
|
+
});
|
|
295
|
+
Q(d, R);
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
{ checkForDefaultPrevented: !1 }
|
|
299
|
+
)
|
|
300
|
+
}
|
|
301
|
+
) });
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
ge.displayName = Ke;
|
|
305
|
+
var j = "NavigationMenuIndicator", Ve = a.forwardRef((e, t) => {
|
|
306
|
+
const { forceMount: r, ...i } = e, n = I(j, e.__scopeNavigationMenu), o = !!n.value;
|
|
307
|
+
return n.indicatorTrack ? Ee.createPortal(
|
|
308
|
+
/* @__PURE__ */ u(K, { present: r || o, children: /* @__PURE__ */ u(ze, { ...i, ref: t }) }),
|
|
309
|
+
n.indicatorTrack
|
|
310
|
+
) : null;
|
|
311
|
+
});
|
|
312
|
+
Ve.displayName = j;
|
|
313
|
+
var ze = a.forwardRef((e, t) => {
|
|
314
|
+
const { __scopeNavigationMenu: r, ...i } = e, n = I(j, r), o = ae(r), [s, d] = a.useState(
|
|
315
|
+
null
|
|
316
|
+
), [l, R] = a.useState(null), c = n.orientation === "horizontal", m = !!n.value;
|
|
317
|
+
a.useEffect(() => {
|
|
318
|
+
const p = o().find((w) => w.value === n.value)?.ref.current;
|
|
319
|
+
p && d(p);
|
|
320
|
+
}, [o, n.value]);
|
|
321
|
+
const h = () => {
|
|
322
|
+
s && R({
|
|
323
|
+
size: c ? s.offsetWidth : s.offsetHeight,
|
|
324
|
+
offset: c ? s.offsetLeft : s.offsetTop
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
return W(s, h), W(n.indicatorTrack, h), l ? /* @__PURE__ */ u(
|
|
328
|
+
b.div,
|
|
329
|
+
{
|
|
330
|
+
"aria-hidden": !0,
|
|
331
|
+
"data-state": m ? "visible" : "hidden",
|
|
332
|
+
"data-orientation": n.orientation,
|
|
333
|
+
...i,
|
|
334
|
+
ref: t,
|
|
335
|
+
style: {
|
|
336
|
+
position: "absolute",
|
|
337
|
+
...c ? {
|
|
338
|
+
left: 0,
|
|
339
|
+
width: l.size + "px",
|
|
340
|
+
transform: `translateX(${l.offset}px)`
|
|
341
|
+
} : {
|
|
342
|
+
top: 0,
|
|
343
|
+
height: l.size + "px",
|
|
344
|
+
transform: `translateY(${l.offset}px)`
|
|
345
|
+
},
|
|
346
|
+
...i.style
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
) : null;
|
|
350
|
+
}), O = "NavigationMenuContent", pe = a.forwardRef((e, t) => {
|
|
351
|
+
const { forceMount: r, ...i } = e, n = I(O, e.__scopeNavigationMenu), o = fe(O, e.__scopeNavigationMenu), s = k(o.contentRef, t), d = o.value === n.value, l = {
|
|
352
|
+
value: o.value,
|
|
353
|
+
triggerRef: o.triggerRef,
|
|
354
|
+
focusProxyRef: o.focusProxyRef,
|
|
355
|
+
wasEscapeCloseRef: o.wasEscapeCloseRef,
|
|
356
|
+
onContentFocusOutside: o.onContentFocusOutside,
|
|
357
|
+
onRootContentClose: o.onRootContentClose,
|
|
358
|
+
...i
|
|
359
|
+
};
|
|
360
|
+
return n.viewport ? /* @__PURE__ */ u(Ge, { forceMount: r, ...l, ref: s }) : /* @__PURE__ */ u(K, { present: r || d, children: /* @__PURE__ */ u(
|
|
361
|
+
we,
|
|
362
|
+
{
|
|
363
|
+
"data-state": J(d),
|
|
364
|
+
...l,
|
|
365
|
+
ref: s,
|
|
366
|
+
onPointerEnter: y(e.onPointerEnter, n.onContentEnter),
|
|
367
|
+
onPointerLeave: y(
|
|
368
|
+
e.onPointerLeave,
|
|
369
|
+
F(n.onContentLeave)
|
|
370
|
+
),
|
|
371
|
+
style: {
|
|
372
|
+
// Prevent interaction when animating out
|
|
373
|
+
pointerEvents: !d && n.isRootMenu ? "none" : void 0,
|
|
374
|
+
...l.style
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
) });
|
|
378
|
+
});
|
|
379
|
+
pe.displayName = O;
|
|
380
|
+
var Ge = a.forwardRef((e, t) => {
|
|
381
|
+
const r = I(O, e.__scopeNavigationMenu), { onViewportContentChange: i, onViewportContentRemove: n } = r;
|
|
382
|
+
return z(() => {
|
|
383
|
+
i(e.value, {
|
|
384
|
+
ref: t,
|
|
385
|
+
...e
|
|
386
|
+
});
|
|
387
|
+
}, [e, t, i]), z(() => () => n(e.value), [e.value, n]), null;
|
|
388
|
+
}), L = "navigationMenu.rootContentDismiss", we = a.forwardRef((e, t) => {
|
|
389
|
+
const {
|
|
390
|
+
__scopeNavigationMenu: r,
|
|
391
|
+
value: i,
|
|
392
|
+
triggerRef: n,
|
|
393
|
+
focusProxyRef: o,
|
|
394
|
+
wasEscapeCloseRef: s,
|
|
395
|
+
onRootContentClose: d,
|
|
396
|
+
onContentFocusOutside: l,
|
|
397
|
+
...R
|
|
398
|
+
} = e, c = I(O, r), m = a.useRef(null), h = k(m, t), E = Ne(c.baseId, i), p = he(c.baseId, i), w = ae(r), N = a.useRef(null), { onItemDismiss: T } = c;
|
|
399
|
+
a.useEffect(() => {
|
|
400
|
+
const f = m.current;
|
|
401
|
+
if (c.isRootMenu && f) {
|
|
402
|
+
const g = () => {
|
|
403
|
+
T(), d(), f.contains(document.activeElement) && n.current?.focus();
|
|
404
|
+
};
|
|
405
|
+
return f.addEventListener(L, g), () => f.removeEventListener(L, g);
|
|
406
|
+
}
|
|
407
|
+
}, [c.isRootMenu, e.value, n, T, d]);
|
|
408
|
+
const _ = a.useMemo(() => {
|
|
409
|
+
const g = w().map((x) => x.value);
|
|
410
|
+
c.dir === "rtl" && g.reverse();
|
|
411
|
+
const v = g.indexOf(c.value), C = g.indexOf(c.previousValue), P = i === c.value, S = C === g.indexOf(i);
|
|
412
|
+
if (!P && !S) return N.current;
|
|
413
|
+
const M = (() => {
|
|
414
|
+
if (v !== C) {
|
|
415
|
+
if (P && C !== -1) return v > C ? "from-end" : "from-start";
|
|
416
|
+
if (S && v !== -1) return v > C ? "to-start" : "to-end";
|
|
417
|
+
}
|
|
418
|
+
return null;
|
|
419
|
+
})();
|
|
420
|
+
return N.current = M, M;
|
|
421
|
+
}, [c.previousValue, c.value, c.dir, w, i]);
|
|
422
|
+
return /* @__PURE__ */ u(Re, { asChild: !0, children: /* @__PURE__ */ u(
|
|
423
|
+
be,
|
|
424
|
+
{
|
|
425
|
+
id: p,
|
|
426
|
+
"aria-labelledby": E,
|
|
427
|
+
"data-motion": _,
|
|
428
|
+
"data-orientation": c.orientation,
|
|
429
|
+
...R,
|
|
430
|
+
ref: h,
|
|
431
|
+
disableOutsidePointerEvents: !1,
|
|
432
|
+
onDismiss: () => {
|
|
433
|
+
const f = new Event(L, {
|
|
434
|
+
bubbles: !0,
|
|
435
|
+
cancelable: !0
|
|
436
|
+
});
|
|
437
|
+
m.current?.dispatchEvent(f);
|
|
438
|
+
},
|
|
439
|
+
onFocusOutside: y(e.onFocusOutside, (f) => {
|
|
440
|
+
l();
|
|
441
|
+
const g = f.target;
|
|
442
|
+
c.rootNavigationMenu?.contains(g) && f.preventDefault();
|
|
443
|
+
}),
|
|
444
|
+
onPointerDownOutside: y(e.onPointerDownOutside, (f) => {
|
|
445
|
+
const g = f.target, v = w().some((P) => P.ref.current?.contains(g)), C = c.isRootMenu && c.viewport?.contains(g);
|
|
446
|
+
(v || C || !c.isRootMenu) && f.preventDefault();
|
|
447
|
+
}),
|
|
448
|
+
onKeyDown: y(e.onKeyDown, (f) => {
|
|
449
|
+
const g = f.altKey || f.ctrlKey || f.metaKey;
|
|
450
|
+
if (f.key === "Tab" && !g) {
|
|
451
|
+
const C = B(f.currentTarget), P = document.activeElement, S = C.findIndex((V) => V === P), x = f.shiftKey ? C.slice(0, S).reverse() : C.slice(S + 1, C.length);
|
|
452
|
+
X(x) ? f.preventDefault() : o.current?.focus();
|
|
453
|
+
}
|
|
454
|
+
}),
|
|
455
|
+
onEscapeKeyDown: y(e.onEscapeKeyDown, (f) => {
|
|
456
|
+
s.current = !0;
|
|
457
|
+
})
|
|
458
|
+
}
|
|
459
|
+
) });
|
|
460
|
+
}), q = "NavigationMenuViewport", Ce = a.forwardRef((e, t) => {
|
|
461
|
+
const { forceMount: r, ...i } = e, o = !!I(q, e.__scopeNavigationMenu).value;
|
|
462
|
+
return /* @__PURE__ */ u(K, { present: r || o, children: /* @__PURE__ */ u(Ue, { ...i, ref: t }) });
|
|
463
|
+
});
|
|
464
|
+
Ce.displayName = q;
|
|
465
|
+
var Ue = a.forwardRef((e, t) => {
|
|
466
|
+
const { __scopeNavigationMenu: r, children: i, ...n } = e, o = I(q, r), s = k(t, o.onViewportChange), d = ke(
|
|
467
|
+
O,
|
|
468
|
+
e.__scopeNavigationMenu
|
|
469
|
+
), [l, R] = a.useState(null), [c, m] = a.useState(null), h = l ? l?.width + "px" : void 0, E = l ? l?.height + "px" : void 0, p = !!o.value, w = p ? o.value : o.previousValue;
|
|
470
|
+
return W(c, () => {
|
|
471
|
+
c && R({ width: c.offsetWidth, height: c.offsetHeight });
|
|
472
|
+
}), /* @__PURE__ */ u(
|
|
473
|
+
b.div,
|
|
474
|
+
{
|
|
475
|
+
"data-state": J(p),
|
|
476
|
+
"data-orientation": o.orientation,
|
|
477
|
+
...n,
|
|
478
|
+
ref: s,
|
|
479
|
+
style: {
|
|
480
|
+
// Prevent interaction when animating out
|
|
481
|
+
pointerEvents: !p && o.isRootMenu ? "none" : void 0,
|
|
482
|
+
"--radix-navigation-menu-viewport-width": h,
|
|
483
|
+
"--radix-navigation-menu-viewport-height": E,
|
|
484
|
+
...n.style
|
|
485
|
+
},
|
|
486
|
+
onPointerEnter: y(e.onPointerEnter, o.onContentEnter),
|
|
487
|
+
onPointerLeave: y(e.onPointerLeave, F(o.onContentLeave)),
|
|
488
|
+
children: Array.from(d.items).map(([T, { ref: _, forceMount: f, ...g }]) => {
|
|
489
|
+
const v = w === T;
|
|
490
|
+
return /* @__PURE__ */ u(K, { present: f || v, children: /* @__PURE__ */ u(
|
|
491
|
+
we,
|
|
492
|
+
{
|
|
493
|
+
...g,
|
|
494
|
+
ref: ye(_, (C) => {
|
|
495
|
+
v && C && m(C);
|
|
496
|
+
})
|
|
497
|
+
}
|
|
498
|
+
) }, T);
|
|
499
|
+
})
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
}), He = "FocusGroup", Re = a.forwardRef(
|
|
503
|
+
(e, t) => {
|
|
504
|
+
const { __scopeNavigationMenu: r, ...i } = e, n = I(He, r);
|
|
505
|
+
return /* @__PURE__ */ u(G.Provider, { scope: r, children: /* @__PURE__ */ u(G.Slot, { scope: r, children: /* @__PURE__ */ u(b.div, { dir: n.dir, ...i, ref: t }) }) });
|
|
506
|
+
}
|
|
507
|
+
), ne = ["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"], Be = "FocusGroupItem", Me = a.forwardRef(
|
|
508
|
+
(e, t) => {
|
|
509
|
+
const { __scopeNavigationMenu: r, ...i } = e, n = Se(r), o = I(Be, r);
|
|
510
|
+
return /* @__PURE__ */ u(G.ItemSlot, { scope: r, children: /* @__PURE__ */ u(
|
|
511
|
+
b.button,
|
|
512
|
+
{
|
|
513
|
+
...i,
|
|
514
|
+
ref: t,
|
|
515
|
+
onKeyDown: y(e.onKeyDown, (s) => {
|
|
516
|
+
if (["Home", "End", ...ne].includes(s.key)) {
|
|
517
|
+
let l = n().map((m) => m.ref.current);
|
|
518
|
+
if ([o.dir === "rtl" ? "ArrowRight" : "ArrowLeft", "ArrowUp", "End"].includes(s.key) && l.reverse(), ne.includes(s.key)) {
|
|
519
|
+
const m = l.indexOf(s.currentTarget);
|
|
520
|
+
l = l.slice(m + 1);
|
|
521
|
+
}
|
|
522
|
+
setTimeout(() => X(l)), s.preventDefault();
|
|
523
|
+
}
|
|
524
|
+
})
|
|
525
|
+
}
|
|
526
|
+
) });
|
|
527
|
+
}
|
|
528
|
+
);
|
|
529
|
+
function B(e) {
|
|
530
|
+
const t = [], r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
531
|
+
acceptNode: (i) => {
|
|
532
|
+
const n = i.tagName === "INPUT" && i.type === "hidden";
|
|
533
|
+
return i.disabled || i.hidden || n ? NodeFilter.FILTER_SKIP : i.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
for (; r.nextNode(); ) t.push(r.currentNode);
|
|
537
|
+
return t;
|
|
538
|
+
}
|
|
539
|
+
function X(e) {
|
|
540
|
+
const t = document.activeElement;
|
|
541
|
+
return e.some((r) => r === t ? !0 : (r.focus(), document.activeElement !== t));
|
|
542
|
+
}
|
|
543
|
+
function We(e) {
|
|
544
|
+
return e.forEach((t) => {
|
|
545
|
+
t.dataset.tabindex = t.getAttribute("tabindex") || "", t.setAttribute("tabindex", "-1");
|
|
546
|
+
}), () => {
|
|
547
|
+
e.forEach((t) => {
|
|
548
|
+
const r = t.dataset.tabindex;
|
|
549
|
+
t.setAttribute("tabindex", r);
|
|
550
|
+
});
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function W(e, t) {
|
|
554
|
+
const r = D(t);
|
|
555
|
+
z(() => {
|
|
556
|
+
let i = 0;
|
|
557
|
+
if (e) {
|
|
558
|
+
const n = new ResizeObserver(() => {
|
|
559
|
+
cancelAnimationFrame(i), i = window.requestAnimationFrame(r);
|
|
560
|
+
});
|
|
561
|
+
return n.observe(e), () => {
|
|
562
|
+
window.cancelAnimationFrame(i), n.unobserve(e);
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
}, [e, r]);
|
|
566
|
+
}
|
|
567
|
+
function J(e) {
|
|
568
|
+
return e ? "open" : "closed";
|
|
569
|
+
}
|
|
570
|
+
function Ne(e, t) {
|
|
571
|
+
return `${e}-trigger-${t}`;
|
|
572
|
+
}
|
|
573
|
+
function he(e, t) {
|
|
574
|
+
return `${e}-content-${t}`;
|
|
575
|
+
}
|
|
576
|
+
function F(e) {
|
|
577
|
+
return (t) => t.pointerType === "mouse" ? e(t) : void 0;
|
|
578
|
+
}
|
|
579
|
+
var ct = se, ut = le, lt = ve, dt = me, ft = ge, vt = pe, mt = Ce;
|
|
580
|
+
export {
|
|
581
|
+
vt as Content,
|
|
582
|
+
lt as Item,
|
|
583
|
+
ft as Link,
|
|
584
|
+
ut as List,
|
|
585
|
+
se as NavigationMenu,
|
|
586
|
+
pe as NavigationMenuContent,
|
|
587
|
+
Ve as NavigationMenuIndicator,
|
|
588
|
+
ve as NavigationMenuItem,
|
|
589
|
+
ge as NavigationMenuLink,
|
|
590
|
+
le as NavigationMenuList,
|
|
591
|
+
Le as NavigationMenuSub,
|
|
592
|
+
me as NavigationMenuTrigger,
|
|
593
|
+
Ce as NavigationMenuViewport,
|
|
594
|
+
ct as Root,
|
|
595
|
+
dt as Trigger,
|
|
596
|
+
mt as Viewport
|
|
597
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import r from "react";
|
|
2
|
+
import { createContextScope as y } from "../../../../../react-context/dist/index.js";
|
|
3
|
+
import { useComposedRefs as M } from "../../../../../react-compose-refs/dist/index.js";
|
|
4
|
+
import { createSlot as x } from "../../react-slot/dist/index.js";
|
|
5
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
6
|
+
function g(s) {
|
|
7
|
+
const m = s + "CollectionProvider", [A, N] = y(m), [_, f] = A(
|
|
8
|
+
m,
|
|
9
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
10
|
+
), p = (c) => {
|
|
11
|
+
const { scope: e, children: l } = c, o = r.useRef(null), t = r.useRef(/* @__PURE__ */ new Map()).current;
|
|
12
|
+
return /* @__PURE__ */ u(_, { scope: e, itemMap: t, collectionRef: o, children: l });
|
|
13
|
+
};
|
|
14
|
+
p.displayName = m;
|
|
15
|
+
const a = s + "CollectionSlot", E = x(a), C = r.forwardRef(
|
|
16
|
+
(c, e) => {
|
|
17
|
+
const { scope: l, children: o } = c, t = f(a, l), n = M(e, t.collectionRef);
|
|
18
|
+
return /* @__PURE__ */ u(E, { ref: n, children: o });
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
C.displayName = a;
|
|
22
|
+
const d = s + "CollectionItemSlot", R = "data-radix-collection-item", T = x(d), I = r.forwardRef(
|
|
23
|
+
(c, e) => {
|
|
24
|
+
const { scope: l, children: o, ...t } = c, n = r.useRef(null), S = M(e, n), i = f(d, l);
|
|
25
|
+
return r.useEffect(() => (i.itemMap.set(n, { ref: n, ...t }), () => {
|
|
26
|
+
i.itemMap.delete(n);
|
|
27
|
+
})), /* @__PURE__ */ u(T, { [R]: "", ref: S, children: o });
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
I.displayName = d;
|
|
31
|
+
function O(c) {
|
|
32
|
+
const e = f(s + "CollectionConsumer", c);
|
|
33
|
+
return r.useCallback(() => {
|
|
34
|
+
const o = e.collectionRef.current;
|
|
35
|
+
if (!o) return [];
|
|
36
|
+
const t = Array.from(o.querySelectorAll(`[${R}]`));
|
|
37
|
+
return Array.from(e.itemMap.values()).sort(
|
|
38
|
+
(i, v) => t.indexOf(i.ref.current) - t.indexOf(v.ref.current)
|
|
39
|
+
);
|
|
40
|
+
}, [e.collectionRef, e.itemMap]);
|
|
41
|
+
}
|
|
42
|
+
return [
|
|
43
|
+
{ Provider: p, Slot: C, ItemSlot: I },
|
|
44
|
+
O,
|
|
45
|
+
N
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
g as createCollection
|
|
50
|
+
};
|