@huin-core/react-navigation-menu 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +137 -0
- package/dist/index.d.ts +137 -0
- package/dist/index.js +1002 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +970 -0
- package/dist/index.mjs.map +7 -0
- package/package.json +1 -1
package/dist/index.d.mts
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import React__default from 'react';
|
3
|
+
import { Primitive } from '@huin-core/react-primitive';
|
4
|
+
import { Scope as Scope$1 } from '@huin-core/react-context';
|
5
|
+
import * as VisuallyHiddenPrimitive from '@huin-core/react-visually-hidden';
|
6
|
+
import { DismissableLayer } from '@huin-core/react-dismissable-layer';
|
7
|
+
|
8
|
+
type Scope<C = any> = {
|
9
|
+
[scopeName: string]: React.Context<C>[];
|
10
|
+
} | undefined;
|
11
|
+
type ScopeHook = (scope: Scope) => {
|
12
|
+
[__scopeProp: string]: Scope;
|
13
|
+
};
|
14
|
+
interface CreateScope {
|
15
|
+
scopeName: string;
|
16
|
+
(): ScopeHook;
|
17
|
+
}
|
18
|
+
|
19
|
+
type PrimitiveDivProps = React__default.ComponentPropsWithoutRef<typeof Primitive.div>;
|
20
|
+
interface NavigationMenuSubProps extends Omit<NavigationMenuProviderProps, keyof NavigationMenuProviderPrivateProps>, PrimitiveDivProps {
|
21
|
+
value?: string;
|
22
|
+
defaultValue?: string;
|
23
|
+
onValueChange?: (value: string) => void;
|
24
|
+
orientation?: Orientation;
|
25
|
+
}
|
26
|
+
declare const NavigationMenuSub: React__default.ForwardRefExoticComponent<NavigationMenuSubProps & React__default.RefAttributes<HTMLDivElement>>;
|
27
|
+
interface NavigationMenuProviderPrivateProps {
|
28
|
+
isRootMenu: boolean;
|
29
|
+
scope: Scope$1;
|
30
|
+
children: React__default.ReactNode;
|
31
|
+
orientation: Orientation;
|
32
|
+
dir: Direction;
|
33
|
+
rootNavigationMenu: NavigationMenuElement | null;
|
34
|
+
value: string;
|
35
|
+
onTriggerEnter(itemValue: string): void;
|
36
|
+
onTriggerLeave?(): void;
|
37
|
+
onContentEnter?(): void;
|
38
|
+
onContentLeave?(): void;
|
39
|
+
onItemSelect(itemValue: string): void;
|
40
|
+
onItemDismiss(): void;
|
41
|
+
}
|
42
|
+
interface NavigationMenuProviderProps extends NavigationMenuProviderPrivateProps {
|
43
|
+
}
|
44
|
+
|
45
|
+
type NavigationMenuTriggerElement = React__default.ElementRef<typeof Primitive.button>;
|
46
|
+
type PrimitiveButtonProps = React__default.ComponentPropsWithoutRef<typeof Primitive.button>;
|
47
|
+
interface NavigationMenuTriggerProps extends PrimitiveButtonProps {
|
48
|
+
}
|
49
|
+
declare const NavigationMenuTrigger: React__default.ForwardRefExoticComponent<NavigationMenuTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
|
50
|
+
|
51
|
+
type FocusProxyElement = React__default.ElementRef<typeof VisuallyHiddenPrimitive.Root>;
|
52
|
+
type PrimitiveListItemProps = React__default.ComponentPropsWithoutRef<typeof Primitive.li>;
|
53
|
+
interface NavigationMenuItemProps extends PrimitiveListItemProps {
|
54
|
+
value?: string;
|
55
|
+
}
|
56
|
+
declare const NavigationMenuItem: React__default.ForwardRefExoticComponent<NavigationMenuItemProps & React__default.RefAttributes<HTMLLIElement>>;
|
57
|
+
|
58
|
+
interface NavigationMenuContentProps extends Omit<NavigationMenuContentImplProps, keyof NavigationMenuContentImplPrivateProps> {
|
59
|
+
/**
|
60
|
+
* Used to force mounting when more control is needed. Useful when
|
61
|
+
* controlling animation with React animation libraries.
|
62
|
+
*/
|
63
|
+
forceMount?: true;
|
64
|
+
}
|
65
|
+
declare const NavigationMenuContent: React__default.ForwardRefExoticComponent<NavigationMenuContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
66
|
+
type DismissableLayerProps = React__default.ComponentPropsWithoutRef<typeof DismissableLayer>;
|
67
|
+
interface NavigationMenuContentImplPrivateProps {
|
68
|
+
value: string;
|
69
|
+
triggerRef: React__default.RefObject<NavigationMenuTriggerElement>;
|
70
|
+
focusProxyRef: React__default.RefObject<FocusProxyElement>;
|
71
|
+
wasEscapeCloseRef: React__default.MutableRefObject<boolean>;
|
72
|
+
onContentFocusOutside(): void;
|
73
|
+
onRootContentClose(): void;
|
74
|
+
}
|
75
|
+
interface NavigationMenuContentImplProps extends Omit<DismissableLayerProps, "onDismiss" | "disableOutsidePointerEvents">, NavigationMenuContentImplPrivateProps {
|
76
|
+
}
|
77
|
+
|
78
|
+
interface NavigationMenuViewportProps extends Omit<NavigationMenuViewportImplProps, "children" | "activeContentValue"> {
|
79
|
+
/**
|
80
|
+
* Used to force mounting when more control is needed. Useful when
|
81
|
+
* controlling animation with React animation libraries.
|
82
|
+
*/
|
83
|
+
forceMount?: true;
|
84
|
+
}
|
85
|
+
declare const NavigationMenuViewport: React__default.ForwardRefExoticComponent<NavigationMenuViewportProps & React__default.RefAttributes<HTMLDivElement>>;
|
86
|
+
interface NavigationMenuViewportImplProps extends PrimitiveDivProps {
|
87
|
+
}
|
88
|
+
|
89
|
+
type Orientation = "vertical" | "horizontal";
|
90
|
+
type Direction = "ltr" | "rtl";
|
91
|
+
declare const createNavigationMenuScope: CreateScope;
|
92
|
+
type NavigationMenuElement = React.ElementRef<typeof Primitive.nav>;
|
93
|
+
type PrimitiveNavProps = React.ComponentPropsWithoutRef<typeof Primitive.nav>;
|
94
|
+
interface NavigationMenuProps extends Omit<NavigationMenuProviderProps, keyof NavigationMenuProviderPrivateProps>, PrimitiveNavProps {
|
95
|
+
value?: string;
|
96
|
+
defaultValue?: string;
|
97
|
+
onValueChange?: (value: string) => void;
|
98
|
+
dir?: Direction;
|
99
|
+
orientation?: Orientation;
|
100
|
+
/**
|
101
|
+
* The duration from when the pointer enters the trigger until the tooltip gets opened.
|
102
|
+
* @defaultValue 200
|
103
|
+
*/
|
104
|
+
delayDuration?: number;
|
105
|
+
/**
|
106
|
+
* How much time a user has to enter another trigger without incurring a delay again.
|
107
|
+
* @defaultValue 300
|
108
|
+
*/
|
109
|
+
skipDelayDuration?: number;
|
110
|
+
}
|
111
|
+
declare const NavigationMenu: React.ForwardRefExoticComponent<NavigationMenuProps & React.RefAttributes<HTMLElement>>;
|
112
|
+
declare const Root: React.ForwardRefExoticComponent<NavigationMenuProps & React.RefAttributes<HTMLElement>>;
|
113
|
+
|
114
|
+
type PrimitiveUnorderedListProps = React__default.ComponentPropsWithoutRef<typeof Primitive.ul>;
|
115
|
+
interface NavigationMenuListProps extends PrimitiveUnorderedListProps {
|
116
|
+
}
|
117
|
+
declare const NavigationMenuList: React__default.ForwardRefExoticComponent<NavigationMenuListProps & React__default.RefAttributes<HTMLUListElement>>;
|
118
|
+
|
119
|
+
type PrimitiveLinkProps = React__default.ComponentPropsWithoutRef<typeof Primitive.a>;
|
120
|
+
interface NavigationMenuLinkProps extends Omit<PrimitiveLinkProps, "onSelect"> {
|
121
|
+
active?: boolean;
|
122
|
+
onSelect?: (event: Event) => void;
|
123
|
+
}
|
124
|
+
declare const NavigationMenuLink: React__default.ForwardRefExoticComponent<NavigationMenuLinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
|
125
|
+
|
126
|
+
interface NavigationMenuIndicatorProps extends NavigationMenuIndicatorImplProps {
|
127
|
+
/**
|
128
|
+
* Used to force mounting when more control is needed. Useful when
|
129
|
+
* controlling animation with React animation libraries.
|
130
|
+
*/
|
131
|
+
forceMount?: true;
|
132
|
+
}
|
133
|
+
declare const NavigationMenuIndicator: React__default.ForwardRefExoticComponent<NavigationMenuIndicatorProps & React__default.RefAttributes<HTMLDivElement>>;
|
134
|
+
interface NavigationMenuIndicatorImplProps extends PrimitiveDivProps {
|
135
|
+
}
|
136
|
+
|
137
|
+
export { 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, createNavigationMenuScope };
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import React__default from 'react';
|
3
|
+
import { Primitive } from '@huin-core/react-primitive';
|
4
|
+
import { Scope as Scope$1 } from '@huin-core/react-context';
|
5
|
+
import * as VisuallyHiddenPrimitive from '@huin-core/react-visually-hidden';
|
6
|
+
import { DismissableLayer } from '@huin-core/react-dismissable-layer';
|
7
|
+
|
8
|
+
type Scope<C = any> = {
|
9
|
+
[scopeName: string]: React.Context<C>[];
|
10
|
+
} | undefined;
|
11
|
+
type ScopeHook = (scope: Scope) => {
|
12
|
+
[__scopeProp: string]: Scope;
|
13
|
+
};
|
14
|
+
interface CreateScope {
|
15
|
+
scopeName: string;
|
16
|
+
(): ScopeHook;
|
17
|
+
}
|
18
|
+
|
19
|
+
type PrimitiveDivProps = React__default.ComponentPropsWithoutRef<typeof Primitive.div>;
|
20
|
+
interface NavigationMenuSubProps extends Omit<NavigationMenuProviderProps, keyof NavigationMenuProviderPrivateProps>, PrimitiveDivProps {
|
21
|
+
value?: string;
|
22
|
+
defaultValue?: string;
|
23
|
+
onValueChange?: (value: string) => void;
|
24
|
+
orientation?: Orientation;
|
25
|
+
}
|
26
|
+
declare const NavigationMenuSub: React__default.ForwardRefExoticComponent<NavigationMenuSubProps & React__default.RefAttributes<HTMLDivElement>>;
|
27
|
+
interface NavigationMenuProviderPrivateProps {
|
28
|
+
isRootMenu: boolean;
|
29
|
+
scope: Scope$1;
|
30
|
+
children: React__default.ReactNode;
|
31
|
+
orientation: Orientation;
|
32
|
+
dir: Direction;
|
33
|
+
rootNavigationMenu: NavigationMenuElement | null;
|
34
|
+
value: string;
|
35
|
+
onTriggerEnter(itemValue: string): void;
|
36
|
+
onTriggerLeave?(): void;
|
37
|
+
onContentEnter?(): void;
|
38
|
+
onContentLeave?(): void;
|
39
|
+
onItemSelect(itemValue: string): void;
|
40
|
+
onItemDismiss(): void;
|
41
|
+
}
|
42
|
+
interface NavigationMenuProviderProps extends NavigationMenuProviderPrivateProps {
|
43
|
+
}
|
44
|
+
|
45
|
+
type NavigationMenuTriggerElement = React__default.ElementRef<typeof Primitive.button>;
|
46
|
+
type PrimitiveButtonProps = React__default.ComponentPropsWithoutRef<typeof Primitive.button>;
|
47
|
+
interface NavigationMenuTriggerProps extends PrimitiveButtonProps {
|
48
|
+
}
|
49
|
+
declare const NavigationMenuTrigger: React__default.ForwardRefExoticComponent<NavigationMenuTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
|
50
|
+
|
51
|
+
type FocusProxyElement = React__default.ElementRef<typeof VisuallyHiddenPrimitive.Root>;
|
52
|
+
type PrimitiveListItemProps = React__default.ComponentPropsWithoutRef<typeof Primitive.li>;
|
53
|
+
interface NavigationMenuItemProps extends PrimitiveListItemProps {
|
54
|
+
value?: string;
|
55
|
+
}
|
56
|
+
declare const NavigationMenuItem: React__default.ForwardRefExoticComponent<NavigationMenuItemProps & React__default.RefAttributes<HTMLLIElement>>;
|
57
|
+
|
58
|
+
interface NavigationMenuContentProps extends Omit<NavigationMenuContentImplProps, keyof NavigationMenuContentImplPrivateProps> {
|
59
|
+
/**
|
60
|
+
* Used to force mounting when more control is needed. Useful when
|
61
|
+
* controlling animation with React animation libraries.
|
62
|
+
*/
|
63
|
+
forceMount?: true;
|
64
|
+
}
|
65
|
+
declare const NavigationMenuContent: React__default.ForwardRefExoticComponent<NavigationMenuContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
66
|
+
type DismissableLayerProps = React__default.ComponentPropsWithoutRef<typeof DismissableLayer>;
|
67
|
+
interface NavigationMenuContentImplPrivateProps {
|
68
|
+
value: string;
|
69
|
+
triggerRef: React__default.RefObject<NavigationMenuTriggerElement>;
|
70
|
+
focusProxyRef: React__default.RefObject<FocusProxyElement>;
|
71
|
+
wasEscapeCloseRef: React__default.MutableRefObject<boolean>;
|
72
|
+
onContentFocusOutside(): void;
|
73
|
+
onRootContentClose(): void;
|
74
|
+
}
|
75
|
+
interface NavigationMenuContentImplProps extends Omit<DismissableLayerProps, "onDismiss" | "disableOutsidePointerEvents">, NavigationMenuContentImplPrivateProps {
|
76
|
+
}
|
77
|
+
|
78
|
+
interface NavigationMenuViewportProps extends Omit<NavigationMenuViewportImplProps, "children" | "activeContentValue"> {
|
79
|
+
/**
|
80
|
+
* Used to force mounting when more control is needed. Useful when
|
81
|
+
* controlling animation with React animation libraries.
|
82
|
+
*/
|
83
|
+
forceMount?: true;
|
84
|
+
}
|
85
|
+
declare const NavigationMenuViewport: React__default.ForwardRefExoticComponent<NavigationMenuViewportProps & React__default.RefAttributes<HTMLDivElement>>;
|
86
|
+
interface NavigationMenuViewportImplProps extends PrimitiveDivProps {
|
87
|
+
}
|
88
|
+
|
89
|
+
type Orientation = "vertical" | "horizontal";
|
90
|
+
type Direction = "ltr" | "rtl";
|
91
|
+
declare const createNavigationMenuScope: CreateScope;
|
92
|
+
type NavigationMenuElement = React.ElementRef<typeof Primitive.nav>;
|
93
|
+
type PrimitiveNavProps = React.ComponentPropsWithoutRef<typeof Primitive.nav>;
|
94
|
+
interface NavigationMenuProps extends Omit<NavigationMenuProviderProps, keyof NavigationMenuProviderPrivateProps>, PrimitiveNavProps {
|
95
|
+
value?: string;
|
96
|
+
defaultValue?: string;
|
97
|
+
onValueChange?: (value: string) => void;
|
98
|
+
dir?: Direction;
|
99
|
+
orientation?: Orientation;
|
100
|
+
/**
|
101
|
+
* The duration from when the pointer enters the trigger until the tooltip gets opened.
|
102
|
+
* @defaultValue 200
|
103
|
+
*/
|
104
|
+
delayDuration?: number;
|
105
|
+
/**
|
106
|
+
* How much time a user has to enter another trigger without incurring a delay again.
|
107
|
+
* @defaultValue 300
|
108
|
+
*/
|
109
|
+
skipDelayDuration?: number;
|
110
|
+
}
|
111
|
+
declare const NavigationMenu: React.ForwardRefExoticComponent<NavigationMenuProps & React.RefAttributes<HTMLElement>>;
|
112
|
+
declare const Root: React.ForwardRefExoticComponent<NavigationMenuProps & React.RefAttributes<HTMLElement>>;
|
113
|
+
|
114
|
+
type PrimitiveUnorderedListProps = React__default.ComponentPropsWithoutRef<typeof Primitive.ul>;
|
115
|
+
interface NavigationMenuListProps extends PrimitiveUnorderedListProps {
|
116
|
+
}
|
117
|
+
declare const NavigationMenuList: React__default.ForwardRefExoticComponent<NavigationMenuListProps & React__default.RefAttributes<HTMLUListElement>>;
|
118
|
+
|
119
|
+
type PrimitiveLinkProps = React__default.ComponentPropsWithoutRef<typeof Primitive.a>;
|
120
|
+
interface NavigationMenuLinkProps extends Omit<PrimitiveLinkProps, "onSelect"> {
|
121
|
+
active?: boolean;
|
122
|
+
onSelect?: (event: Event) => void;
|
123
|
+
}
|
124
|
+
declare const NavigationMenuLink: React__default.ForwardRefExoticComponent<NavigationMenuLinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
|
125
|
+
|
126
|
+
interface NavigationMenuIndicatorProps extends NavigationMenuIndicatorImplProps {
|
127
|
+
/**
|
128
|
+
* Used to force mounting when more control is needed. Useful when
|
129
|
+
* controlling animation with React animation libraries.
|
130
|
+
*/
|
131
|
+
forceMount?: true;
|
132
|
+
}
|
133
|
+
declare const NavigationMenuIndicator: React__default.ForwardRefExoticComponent<NavigationMenuIndicatorProps & React__default.RefAttributes<HTMLDivElement>>;
|
134
|
+
interface NavigationMenuIndicatorImplProps extends PrimitiveDivProps {
|
135
|
+
}
|
136
|
+
|
137
|
+
export { 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, createNavigationMenuScope };
|