@radix-ui/react-navigation-menu 1.2.21 → 1.2.22
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/index.d.mts +16 -52
- package/dist/index.d.ts +16 -52
- package/dist/index.js +34 -71
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +34 -71
- package/dist/index.mjs.map +3 -3
- package/package.json +20 -20
package/dist/index.d.mts
CHANGED
|
@@ -5,21 +5,8 @@ import { Primitive } from '@radix-ui/react-primitive';
|
|
|
5
5
|
import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
|
|
6
6
|
import * as VisuallyHiddenPrimitive from '@radix-ui/react-visually-hidden';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
readonly Horizontal: "horizontal";
|
|
11
|
-
};
|
|
12
|
-
type Orientation = (typeof Orientation)[keyof typeof Orientation];
|
|
13
|
-
declare const Direction: {
|
|
14
|
-
readonly LTR: "ltr";
|
|
15
|
-
readonly RTL: "rtl";
|
|
16
|
-
};
|
|
17
|
-
type Direction = (typeof Direction)[keyof typeof Direction];
|
|
18
|
-
declare const ActivationMode: {
|
|
19
|
-
readonly Automatic: "automatic";
|
|
20
|
-
readonly Manual: "manual";
|
|
21
|
-
};
|
|
22
|
-
type ActivationMode = (typeof ActivationMode)[keyof typeof ActivationMode];
|
|
8
|
+
type Orientation = 'vertical' | 'horizontal';
|
|
9
|
+
type Direction = 'ltr' | 'rtl';
|
|
23
10
|
declare const createNavigationMenuScope: _radix_ui_react_context.CreateScope;
|
|
24
11
|
type NavigationMenuElement = React.ComponentRef<typeof Primitive.nav>;
|
|
25
12
|
type PrimitiveNavProps = React.ComponentPropsWithoutRef<typeof Primitive.nav>;
|
|
@@ -30,28 +17,15 @@ interface NavigationMenuProps extends Omit<NavigationMenuProviderProps, keyof Na
|
|
|
30
17
|
dir?: Direction;
|
|
31
18
|
orientation?: Orientation;
|
|
32
19
|
/**
|
|
33
|
-
* The duration from when the pointer enters the trigger until the tooltip
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @default 200
|
|
20
|
+
* The duration from when the pointer enters the trigger until the tooltip gets opened.
|
|
21
|
+
* @defaultValue 200
|
|
37
22
|
*/
|
|
38
23
|
delayDuration?: number;
|
|
39
24
|
/**
|
|
40
|
-
* How much time a user has to enter another trigger without incurring a delay
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* @default 300
|
|
25
|
+
* How much time a user has to enter another trigger without incurring a delay again.
|
|
26
|
+
* @defaultValue 300
|
|
44
27
|
*/
|
|
45
28
|
skipDelayDuration?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Whether an item is activated automatically or manually.
|
|
48
|
-
* - `"automatic"`: hovering or focusing a trigger opens its item, and moving
|
|
49
|
-
* away closes it after a short delay.
|
|
50
|
-
* - `"manual"`: clicking a trigger toggles the item; hover and focus are ignored
|
|
51
|
-
*
|
|
52
|
-
* @default "automatic"
|
|
53
|
-
*/
|
|
54
|
-
activationMode?: ActivationMode;
|
|
55
29
|
}
|
|
56
30
|
declare const NavigationMenu: React.ForwardRefExoticComponent<NavigationMenuProps & React.RefAttributes<HTMLElement>>;
|
|
57
31
|
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
@@ -60,24 +34,6 @@ interface NavigationMenuSubProps extends Omit<NavigationMenuProviderProps, keyof
|
|
|
60
34
|
defaultValue?: string;
|
|
61
35
|
onValueChange?: (value: string) => void;
|
|
62
36
|
orientation?: Orientation;
|
|
63
|
-
/**
|
|
64
|
-
* Whether an item is activated automatically or manually.
|
|
65
|
-
* - `"automatic"`: hovering or focusing a trigger opens its item, and moving
|
|
66
|
-
* away closes it after a short delay.
|
|
67
|
-
* - `"manual"`: clicking a trigger toggles the item; hover and focus are
|
|
68
|
-
* ignored
|
|
69
|
-
*
|
|
70
|
-
* The default value is inherited from the parent Navigation Menu root
|
|
71
|
-
* component. If no value is provided to the parent, the default value is
|
|
72
|
-
* `"automatic"`.
|
|
73
|
-
*/
|
|
74
|
-
activationMode?: ActivationMode;
|
|
75
|
-
/**
|
|
76
|
-
* When true, clicking a sub-menu item's trigger once it's active will not deactivate it.
|
|
77
|
-
*
|
|
78
|
-
* @default true
|
|
79
|
-
*/
|
|
80
|
-
disableToggle?: boolean;
|
|
81
37
|
}
|
|
82
38
|
declare const NavigationMenuSub: React.ForwardRefExoticComponent<NavigationMenuSubProps & React.RefAttributes<HTMLDivElement>>;
|
|
83
39
|
interface NavigationMenuProviderPrivateProps {
|
|
@@ -86,7 +42,6 @@ interface NavigationMenuProviderPrivateProps {
|
|
|
86
42
|
children: React.ReactNode;
|
|
87
43
|
orientation: Orientation;
|
|
88
44
|
dir: Direction;
|
|
89
|
-
activationMode: ActivationMode;
|
|
90
45
|
rootNavigationMenu: NavigationMenuElement | null;
|
|
91
46
|
value: string;
|
|
92
47
|
onTriggerEnter(itemValue: string): void;
|
|
@@ -158,5 +113,14 @@ interface NavigationMenuViewportProps extends Omit<NavigationMenuViewportImplPro
|
|
|
158
113
|
declare const NavigationMenuViewport: React.ForwardRefExoticComponent<NavigationMenuViewportProps & React.RefAttributes<HTMLDivElement>>;
|
|
159
114
|
interface NavigationMenuViewportImplProps extends PrimitiveDivProps {
|
|
160
115
|
}
|
|
116
|
+
declare const Root: React.ForwardRefExoticComponent<NavigationMenuProps & React.RefAttributes<HTMLElement>>;
|
|
117
|
+
declare const Sub: React.ForwardRefExoticComponent<NavigationMenuSubProps & React.RefAttributes<HTMLDivElement>>;
|
|
118
|
+
declare const List: React.ForwardRefExoticComponent<NavigationMenuListProps & React.RefAttributes<HTMLUListElement>>;
|
|
119
|
+
declare const Item: React.ForwardRefExoticComponent<NavigationMenuItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
120
|
+
declare const Trigger: React.ForwardRefExoticComponent<NavigationMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
121
|
+
declare const Link: React.ForwardRefExoticComponent<NavigationMenuLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
122
|
+
declare const Indicator: React.ForwardRefExoticComponent<NavigationMenuIndicatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
123
|
+
declare const Content: React.ForwardRefExoticComponent<NavigationMenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
124
|
+
declare const Viewport: React.ForwardRefExoticComponent<NavigationMenuViewportProps & React.RefAttributes<HTMLDivElement>>;
|
|
161
125
|
|
|
162
|
-
export {
|
|
126
|
+
export { Content, Indicator, Item, Link, List, NavigationMenu, NavigationMenuContent, type NavigationMenuContentProps, NavigationMenuIndicator, type NavigationMenuIndicatorProps, NavigationMenuItem, type NavigationMenuItemProps, NavigationMenuLink, type NavigationMenuLinkProps, NavigationMenuList, type NavigationMenuListProps, type NavigationMenuProps, NavigationMenuSub, type NavigationMenuSubProps, NavigationMenuTrigger, type NavigationMenuTriggerProps, NavigationMenuViewport, type NavigationMenuViewportProps, Root, Sub, Trigger, Viewport, createNavigationMenuScope };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,21 +5,8 @@ import { Primitive } from '@radix-ui/react-primitive';
|
|
|
5
5
|
import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
|
|
6
6
|
import * as VisuallyHiddenPrimitive from '@radix-ui/react-visually-hidden';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
readonly Horizontal: "horizontal";
|
|
11
|
-
};
|
|
12
|
-
type Orientation = (typeof Orientation)[keyof typeof Orientation];
|
|
13
|
-
declare const Direction: {
|
|
14
|
-
readonly LTR: "ltr";
|
|
15
|
-
readonly RTL: "rtl";
|
|
16
|
-
};
|
|
17
|
-
type Direction = (typeof Direction)[keyof typeof Direction];
|
|
18
|
-
declare const ActivationMode: {
|
|
19
|
-
readonly Automatic: "automatic";
|
|
20
|
-
readonly Manual: "manual";
|
|
21
|
-
};
|
|
22
|
-
type ActivationMode = (typeof ActivationMode)[keyof typeof ActivationMode];
|
|
8
|
+
type Orientation = 'vertical' | 'horizontal';
|
|
9
|
+
type Direction = 'ltr' | 'rtl';
|
|
23
10
|
declare const createNavigationMenuScope: _radix_ui_react_context.CreateScope;
|
|
24
11
|
type NavigationMenuElement = React.ComponentRef<typeof Primitive.nav>;
|
|
25
12
|
type PrimitiveNavProps = React.ComponentPropsWithoutRef<typeof Primitive.nav>;
|
|
@@ -30,28 +17,15 @@ interface NavigationMenuProps extends Omit<NavigationMenuProviderProps, keyof Na
|
|
|
30
17
|
dir?: Direction;
|
|
31
18
|
orientation?: Orientation;
|
|
32
19
|
/**
|
|
33
|
-
* The duration from when the pointer enters the trigger until the tooltip
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @default 200
|
|
20
|
+
* The duration from when the pointer enters the trigger until the tooltip gets opened.
|
|
21
|
+
* @defaultValue 200
|
|
37
22
|
*/
|
|
38
23
|
delayDuration?: number;
|
|
39
24
|
/**
|
|
40
|
-
* How much time a user has to enter another trigger without incurring a delay
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* @default 300
|
|
25
|
+
* How much time a user has to enter another trigger without incurring a delay again.
|
|
26
|
+
* @defaultValue 300
|
|
44
27
|
*/
|
|
45
28
|
skipDelayDuration?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Whether an item is activated automatically or manually.
|
|
48
|
-
* - `"automatic"`: hovering or focusing a trigger opens its item, and moving
|
|
49
|
-
* away closes it after a short delay.
|
|
50
|
-
* - `"manual"`: clicking a trigger toggles the item; hover and focus are ignored
|
|
51
|
-
*
|
|
52
|
-
* @default "automatic"
|
|
53
|
-
*/
|
|
54
|
-
activationMode?: ActivationMode;
|
|
55
29
|
}
|
|
56
30
|
declare const NavigationMenu: React.ForwardRefExoticComponent<NavigationMenuProps & React.RefAttributes<HTMLElement>>;
|
|
57
31
|
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
@@ -60,24 +34,6 @@ interface NavigationMenuSubProps extends Omit<NavigationMenuProviderProps, keyof
|
|
|
60
34
|
defaultValue?: string;
|
|
61
35
|
onValueChange?: (value: string) => void;
|
|
62
36
|
orientation?: Orientation;
|
|
63
|
-
/**
|
|
64
|
-
* Whether an item is activated automatically or manually.
|
|
65
|
-
* - `"automatic"`: hovering or focusing a trigger opens its item, and moving
|
|
66
|
-
* away closes it after a short delay.
|
|
67
|
-
* - `"manual"`: clicking a trigger toggles the item; hover and focus are
|
|
68
|
-
* ignored
|
|
69
|
-
*
|
|
70
|
-
* The default value is inherited from the parent Navigation Menu root
|
|
71
|
-
* component. If no value is provided to the parent, the default value is
|
|
72
|
-
* `"automatic"`.
|
|
73
|
-
*/
|
|
74
|
-
activationMode?: ActivationMode;
|
|
75
|
-
/**
|
|
76
|
-
* When true, clicking a sub-menu item's trigger once it's active will not deactivate it.
|
|
77
|
-
*
|
|
78
|
-
* @default true
|
|
79
|
-
*/
|
|
80
|
-
disableToggle?: boolean;
|
|
81
37
|
}
|
|
82
38
|
declare const NavigationMenuSub: React.ForwardRefExoticComponent<NavigationMenuSubProps & React.RefAttributes<HTMLDivElement>>;
|
|
83
39
|
interface NavigationMenuProviderPrivateProps {
|
|
@@ -86,7 +42,6 @@ interface NavigationMenuProviderPrivateProps {
|
|
|
86
42
|
children: React.ReactNode;
|
|
87
43
|
orientation: Orientation;
|
|
88
44
|
dir: Direction;
|
|
89
|
-
activationMode: ActivationMode;
|
|
90
45
|
rootNavigationMenu: NavigationMenuElement | null;
|
|
91
46
|
value: string;
|
|
92
47
|
onTriggerEnter(itemValue: string): void;
|
|
@@ -158,5 +113,14 @@ interface NavigationMenuViewportProps extends Omit<NavigationMenuViewportImplPro
|
|
|
158
113
|
declare const NavigationMenuViewport: React.ForwardRefExoticComponent<NavigationMenuViewportProps & React.RefAttributes<HTMLDivElement>>;
|
|
159
114
|
interface NavigationMenuViewportImplProps extends PrimitiveDivProps {
|
|
160
115
|
}
|
|
116
|
+
declare const Root: React.ForwardRefExoticComponent<NavigationMenuProps & React.RefAttributes<HTMLElement>>;
|
|
117
|
+
declare const Sub: React.ForwardRefExoticComponent<NavigationMenuSubProps & React.RefAttributes<HTMLDivElement>>;
|
|
118
|
+
declare const List: React.ForwardRefExoticComponent<NavigationMenuListProps & React.RefAttributes<HTMLUListElement>>;
|
|
119
|
+
declare const Item: React.ForwardRefExoticComponent<NavigationMenuItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
120
|
+
declare const Trigger: React.ForwardRefExoticComponent<NavigationMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
121
|
+
declare const Link: React.ForwardRefExoticComponent<NavigationMenuLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
122
|
+
declare const Indicator: React.ForwardRefExoticComponent<NavigationMenuIndicatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
123
|
+
declare const Content: React.ForwardRefExoticComponent<NavigationMenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
124
|
+
declare const Viewport: React.ForwardRefExoticComponent<NavigationMenuViewportProps & React.RefAttributes<HTMLDivElement>>;
|
|
161
125
|
|
|
162
|
-
export {
|
|
126
|
+
export { Content, Indicator, Item, Link, List, NavigationMenu, NavigationMenuContent, type NavigationMenuContentProps, NavigationMenuIndicator, type NavigationMenuIndicatorProps, NavigationMenuItem, type NavigationMenuItemProps, NavigationMenuLink, type NavigationMenuLinkProps, NavigationMenuList, type NavigationMenuListProps, type NavigationMenuProps, NavigationMenuSub, type NavigationMenuSubProps, NavigationMenuTrigger, type NavigationMenuTriggerProps, NavigationMenuViewport, type NavigationMenuViewportProps, Root, Sub, Trigger, Viewport, createNavigationMenuScope };
|
package/dist/index.js
CHANGED
|
@@ -32,11 +32,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
// src/index.ts
|
|
33
33
|
var index_exports = {};
|
|
34
34
|
__export(index_exports, {
|
|
35
|
-
Content: () =>
|
|
36
|
-
Indicator: () =>
|
|
37
|
-
Item: () =>
|
|
38
|
-
Link: () =>
|
|
39
|
-
List: () =>
|
|
35
|
+
Content: () => Content,
|
|
36
|
+
Indicator: () => Indicator,
|
|
37
|
+
Item: () => Item,
|
|
38
|
+
Link: () => Link,
|
|
39
|
+
List: () => List,
|
|
40
40
|
NavigationMenu: () => NavigationMenu,
|
|
41
41
|
NavigationMenuContent: () => NavigationMenuContent,
|
|
42
42
|
NavigationMenuIndicator: () => NavigationMenuIndicator,
|
|
@@ -46,10 +46,10 @@ __export(index_exports, {
|
|
|
46
46
|
NavigationMenuSub: () => NavigationMenuSub,
|
|
47
47
|
NavigationMenuTrigger: () => NavigationMenuTrigger,
|
|
48
48
|
NavigationMenuViewport: () => NavigationMenuViewport,
|
|
49
|
-
Root: () =>
|
|
50
|
-
Sub: () =>
|
|
51
|
-
Trigger: () =>
|
|
52
|
-
Viewport: () =>
|
|
49
|
+
Root: () => Root2,
|
|
50
|
+
Sub: () => Sub,
|
|
51
|
+
Trigger: () => Trigger,
|
|
52
|
+
Viewport: () => Viewport,
|
|
53
53
|
createNavigationMenuScope: () => createNavigationMenuScope
|
|
54
54
|
});
|
|
55
55
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -72,18 +72,6 @@ var import_react_use_layout_effect = require("@radix-ui/react-use-layout-effect"
|
|
|
72
72
|
var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
|
|
73
73
|
var VisuallyHiddenPrimitive = __toESM(require("@radix-ui/react-visually-hidden"));
|
|
74
74
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
75
|
-
var ActivationMode = {
|
|
76
|
-
Automatic: "automatic",
|
|
77
|
-
Manual: "manual"
|
|
78
|
-
};
|
|
79
|
-
var Orientation = {
|
|
80
|
-
Vertical: "vertical",
|
|
81
|
-
Horizontal: "horizontal"
|
|
82
|
-
};
|
|
83
|
-
var Direction = {
|
|
84
|
-
LTR: "ltr",
|
|
85
|
-
RTL: "rtl"
|
|
86
|
-
};
|
|
87
75
|
var NAVIGATION_MENU_NAME = "NavigationMenu";
|
|
88
76
|
var [Collection, useCollection, createCollectionScope] = (0, import_react_collection.createCollection)(NAVIGATION_MENU_NAME);
|
|
89
77
|
var [FocusGroupCollection, useFocusGroupCollection, createFocusGroupCollectionScope] = (0, import_react_collection.createCollection)(NAVIGATION_MENU_NAME);
|
|
@@ -102,9 +90,8 @@ var NavigationMenu = /* @__PURE__ */ React.forwardRef(
|
|
|
102
90
|
defaultValue,
|
|
103
91
|
delayDuration = 200,
|
|
104
92
|
skipDelayDuration = 300,
|
|
105
|
-
orientation =
|
|
93
|
+
orientation = "horizontal",
|
|
106
94
|
dir,
|
|
107
|
-
activationMode = ActivationMode.Automatic,
|
|
108
95
|
...NavigationMenuProps
|
|
109
96
|
} = props;
|
|
110
97
|
const [navigationMenu, setNavigationMenu] = React.useState(null);
|
|
@@ -174,34 +161,18 @@ var NavigationMenu = /* @__PURE__ */ React.forwardRef(
|
|
|
174
161
|
value,
|
|
175
162
|
dir: direction,
|
|
176
163
|
orientation,
|
|
177
|
-
activationMode,
|
|
178
164
|
rootNavigationMenu: navigationMenu,
|
|
179
165
|
onTriggerEnter: (itemValue) => {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
handleDelayedOpen(itemValue);
|
|
184
|
-
} else {
|
|
185
|
-
handleOpen(itemValue);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
166
|
+
window.clearTimeout(openTimerRef.current);
|
|
167
|
+
if (isOpenDelayed) handleDelayedOpen(itemValue);
|
|
168
|
+
else handleOpen(itemValue);
|
|
188
169
|
},
|
|
189
170
|
onTriggerLeave: () => {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
startCloseTimer();
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
onContentEnter: () => {
|
|
196
|
-
if (activationMode === ActivationMode.Automatic) {
|
|
197
|
-
window.clearTimeout(closeTimerRef.current);
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
onContentLeave: () => {
|
|
201
|
-
if (activationMode === ActivationMode.Automatic) {
|
|
202
|
-
startCloseTimer();
|
|
203
|
-
}
|
|
171
|
+
window.clearTimeout(openTimerRef.current);
|
|
172
|
+
startCloseTimer();
|
|
204
173
|
},
|
|
174
|
+
onContentEnter: () => window.clearTimeout(closeTimerRef.current),
|
|
175
|
+
onContentLeave: startCloseTimer,
|
|
205
176
|
onItemSelect: (itemValue) => {
|
|
206
177
|
setValue((prevValue) => prevValue === itemValue ? "" : itemValue);
|
|
207
178
|
},
|
|
@@ -229,13 +200,10 @@ var NavigationMenuSub = /* @__PURE__ */ React.forwardRef(
|
|
|
229
200
|
value: valueProp,
|
|
230
201
|
onValueChange,
|
|
231
202
|
defaultValue,
|
|
232
|
-
orientation =
|
|
233
|
-
activationMode: activationModeProp,
|
|
234
|
-
disableToggle = true,
|
|
203
|
+
orientation = "horizontal",
|
|
235
204
|
...subProps
|
|
236
205
|
} = props;
|
|
237
206
|
const context = useNavigationMenuContext(SUB_NAME, __scopeNavigationMenu);
|
|
238
|
-
const activationMode = activationModeProp ?? context.activationMode;
|
|
239
207
|
const [value, setValue] = (0, import_react_use_controllable_state.useControllableState)({
|
|
240
208
|
prop: valueProp,
|
|
241
209
|
onChange: onValueChange,
|
|
@@ -250,16 +218,9 @@ var NavigationMenuSub = /* @__PURE__ */ React.forwardRef(
|
|
|
250
218
|
value,
|
|
251
219
|
dir: context.dir,
|
|
252
220
|
orientation,
|
|
253
|
-
activationMode,
|
|
254
221
|
rootNavigationMenu: context.rootNavigationMenu,
|
|
255
|
-
onTriggerEnter: (itemValue) =>
|
|
256
|
-
|
|
257
|
-
setValue(itemValue);
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
onItemSelect: (itemValue) => {
|
|
261
|
-
setValue((prevValue) => disableToggle || prevValue !== itemValue ? itemValue : "");
|
|
262
|
-
},
|
|
222
|
+
onTriggerEnter: (itemValue) => setValue(itemValue),
|
|
223
|
+
onItemSelect: (itemValue) => setValue(itemValue),
|
|
263
224
|
onItemDismiss: () => setValue(""),
|
|
264
225
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { "data-orientation": orientation, ...subProps, ref: forwardedRef })
|
|
265
226
|
}
|
|
@@ -273,7 +234,6 @@ var NavigationMenuProvider = /* @__PURE__ */ __name((props) => {
|
|
|
273
234
|
rootNavigationMenu,
|
|
274
235
|
dir,
|
|
275
236
|
orientation,
|
|
276
|
-
activationMode,
|
|
277
237
|
children,
|
|
278
238
|
value,
|
|
279
239
|
onItemSelect,
|
|
@@ -297,7 +257,6 @@ var NavigationMenuProvider = /* @__PURE__ */ __name((props) => {
|
|
|
297
257
|
baseId: (0, import_react_id.useId)(),
|
|
298
258
|
dir,
|
|
299
259
|
orientation,
|
|
300
|
-
activationMode,
|
|
301
260
|
viewport,
|
|
302
261
|
onViewportChange: setViewport,
|
|
303
262
|
indicatorTrack,
|
|
@@ -430,7 +389,7 @@ var NavigationMenuTrigger = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __n
|
|
|
430
389
|
wasClickCloseRef.current = open;
|
|
431
390
|
}),
|
|
432
391
|
onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
|
|
433
|
-
const verticalEntryKey = context.dir ===
|
|
392
|
+
const verticalEntryKey = context.dir === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
434
393
|
const entryKey = { horizontal: "ArrowDown", vertical: verticalEntryKey }[context.orientation];
|
|
435
394
|
if (open && event.key === entryKey) {
|
|
436
395
|
itemContext.onEntryKeyDown();
|
|
@@ -515,7 +474,7 @@ var NavigationMenuIndicatorImpl = /* @__PURE__ */ React.forwardRef(/* @__PURE__
|
|
|
515
474
|
null
|
|
516
475
|
);
|
|
517
476
|
const [position, setPosition] = React.useState(null);
|
|
518
|
-
const isHorizontal = context.orientation ===
|
|
477
|
+
const isHorizontal = context.orientation === "horizontal";
|
|
519
478
|
const isVisible = Boolean(context.value);
|
|
520
479
|
React.useEffect(() => {
|
|
521
480
|
const items = getItems();
|
|
@@ -642,7 +601,7 @@ var NavigationMenuContentImpl = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */
|
|
|
642
601
|
const motionAttribute = React.useMemo(() => {
|
|
643
602
|
const items = getItems();
|
|
644
603
|
const values = items.map((item) => item.value);
|
|
645
|
-
if (context.dir ===
|
|
604
|
+
if (context.dir === "rtl") values.reverse();
|
|
646
605
|
const index = values.indexOf(context.value);
|
|
647
606
|
const prevIndex = values.indexOf(context.previousValue);
|
|
648
607
|
const isSelected = value === context.value;
|
|
@@ -678,12 +637,7 @@ var NavigationMenuContentImpl = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */
|
|
|
678
637
|
onFocusOutside: (0, import_primitive.composeEventHandlers)(props.onFocusOutside, (event) => {
|
|
679
638
|
onContentFocusOutside();
|
|
680
639
|
const target = event.target;
|
|
681
|
-
|
|
682
|
-
const focusMovedIntoMenu = context.rootNavigationMenu?.contains(target);
|
|
683
|
-
const focusCameFromMenu = context.rootNavigationMenu?.contains(relatedTarget);
|
|
684
|
-
if (focusMovedIntoMenu || !focusCameFromMenu) {
|
|
685
|
-
event.preventDefault();
|
|
686
|
-
}
|
|
640
|
+
if (context.rootNavigationMenu?.contains(target)) event.preventDefault();
|
|
687
641
|
}),
|
|
688
642
|
onPointerDownOutside: (0, import_primitive.composeEventHandlers)(props.onPointerDownOutside, (event) => {
|
|
689
643
|
const target = event.target;
|
|
@@ -810,7 +764,7 @@ var FocusGroupItem = /* @__PURE__ */ React.forwardRef(
|
|
|
810
764
|
const isFocusNavigationKey = ["Home", "End", ...ARROW_KEYS].includes(event.key);
|
|
811
765
|
if (isFocusNavigationKey) {
|
|
812
766
|
let candidateNodes = getItems().map((item) => item.ref.current);
|
|
813
|
-
const prevItemKey = context.dir ===
|
|
767
|
+
const prevItemKey = context.dir === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
814
768
|
const prevKeys = [prevItemKey, "ArrowUp", "End"];
|
|
815
769
|
if (prevKeys.includes(event.key)) candidateNodes.reverse();
|
|
816
770
|
if (ARROW_KEYS.includes(event.key)) {
|
|
@@ -894,4 +848,13 @@ function whenMouse(handler) {
|
|
|
894
848
|
return (event) => event.pointerType === "mouse" ? handler(event) : void 0;
|
|
895
849
|
}
|
|
896
850
|
__name(whenMouse, "whenMouse");
|
|
851
|
+
var Root2 = NavigationMenu;
|
|
852
|
+
var Sub = NavigationMenuSub;
|
|
853
|
+
var List = NavigationMenuList;
|
|
854
|
+
var Item = NavigationMenuItem;
|
|
855
|
+
var Trigger = NavigationMenuTrigger;
|
|
856
|
+
var Link = NavigationMenuLink;
|
|
857
|
+
var Indicator = NavigationMenuIndicator;
|
|
858
|
+
var Content = NavigationMenuContent;
|
|
859
|
+
var Viewport = NavigationMenuViewport;
|
|
897
860
|
//# sourceMappingURL=index.js.map
|