@tamagui/create-menu 2.0.0-1
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/LICENSE +21 -0
- package/dist/cjs/MenuPredefined.cjs +182 -0
- package/dist/cjs/MenuPredefined.js +162 -0
- package/dist/cjs/MenuPredefined.js.map +6 -0
- package/dist/cjs/MenuPredefined.native.js +185 -0
- package/dist/cjs/MenuPredefined.native.js.map +1 -0
- package/dist/cjs/createBaseMenu.cjs +927 -0
- package/dist/cjs/createBaseMenu.js +724 -0
- package/dist/cjs/createBaseMenu.js.map +6 -0
- package/dist/cjs/createBaseMenu.native.js +1105 -0
- package/dist/cjs/createBaseMenu.native.js.map +1 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.cjs +224 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.js +172 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.js.map +6 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.native.js +287 -0
- package/dist/cjs/createNativeMenu/createNativeMenu.native.js.map +1 -0
- package/dist/cjs/createNativeMenu/createNativeMenuTypes.cjs +16 -0
- package/dist/cjs/createNativeMenu/createNativeMenuTypes.js +14 -0
- package/dist/cjs/createNativeMenu/createNativeMenuTypes.js.map +6 -0
- package/dist/cjs/createNativeMenu/createNativeMenuTypes.native.js +19 -0
- package/dist/cjs/createNativeMenu/createNativeMenuTypes.native.js.map +1 -0
- package/dist/cjs/createNativeMenu/index.cjs +19 -0
- package/dist/cjs/createNativeMenu/index.js +16 -0
- package/dist/cjs/createNativeMenu/index.js.map +6 -0
- package/dist/cjs/createNativeMenu/index.native.js +22 -0
- package/dist/cjs/createNativeMenu/index.native.js.map +1 -0
- package/dist/cjs/createNativeMenu/utils.cjs +68 -0
- package/dist/cjs/createNativeMenu/utils.js +66 -0
- package/dist/cjs/createNativeMenu/utils.js.map +6 -0
- package/dist/cjs/createNativeMenu/utils.native.js +94 -0
- package/dist/cjs/createNativeMenu/utils.native.js.map +1 -0
- package/dist/cjs/createNativeMenu/withNativeMenu.cjs +37 -0
- package/dist/cjs/createNativeMenu/withNativeMenu.js +30 -0
- package/dist/cjs/createNativeMenu/withNativeMenu.js.map +6 -0
- package/dist/cjs/createNativeMenu/withNativeMenu.native.js +43 -0
- package/dist/cjs/createNativeMenu/withNativeMenu.native.js.map +1 -0
- package/dist/cjs/index.cjs +30 -0
- package/dist/cjs/index.js +24 -0
- package/dist/cjs/index.js.map +6 -0
- package/dist/cjs/index.native.js +33 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/esm/MenuPredefined.js +147 -0
- package/dist/esm/MenuPredefined.js.map +6 -0
- package/dist/esm/MenuPredefined.mjs +159 -0
- package/dist/esm/MenuPredefined.mjs.map +1 -0
- package/dist/esm/MenuPredefined.native.js +159 -0
- package/dist/esm/MenuPredefined.native.js.map +1 -0
- package/dist/esm/createBaseMenu.js +729 -0
- package/dist/esm/createBaseMenu.js.map +6 -0
- package/dist/esm/createBaseMenu.mjs +893 -0
- package/dist/esm/createBaseMenu.mjs.map +1 -0
- package/dist/esm/createBaseMenu.native.js +1068 -0
- package/dist/esm/createBaseMenu.native.js.map +1 -0
- package/dist/esm/createNativeMenu/createNativeMenu.js +150 -0
- package/dist/esm/createNativeMenu/createNativeMenu.js.map +6 -0
- package/dist/esm/createNativeMenu/createNativeMenu.mjs +190 -0
- package/dist/esm/createNativeMenu/createNativeMenu.mjs.map +1 -0
- package/dist/esm/createNativeMenu/createNativeMenu.native.js +250 -0
- package/dist/esm/createNativeMenu/createNativeMenu.native.js.map +1 -0
- package/dist/esm/createNativeMenu/createNativeMenuTypes.js +1 -0
- package/dist/esm/createNativeMenu/createNativeMenuTypes.js.map +6 -0
- package/dist/esm/createNativeMenu/createNativeMenuTypes.mjs +2 -0
- package/dist/esm/createNativeMenu/createNativeMenuTypes.mjs.map +1 -0
- package/dist/esm/createNativeMenu/createNativeMenuTypes.native.js +2 -0
- package/dist/esm/createNativeMenu/createNativeMenuTypes.native.js.map +1 -0
- package/dist/esm/createNativeMenu/index.js +3 -0
- package/dist/esm/createNativeMenu/index.js.map +6 -0
- package/dist/esm/createNativeMenu/index.mjs +3 -0
- package/dist/esm/createNativeMenu/index.mjs.map +1 -0
- package/dist/esm/createNativeMenu/index.native.js +3 -0
- package/dist/esm/createNativeMenu/index.native.js.map +1 -0
- package/dist/esm/createNativeMenu/utils.js +47 -0
- package/dist/esm/createNativeMenu/utils.js.map +6 -0
- package/dist/esm/createNativeMenu/utils.mjs +29 -0
- package/dist/esm/createNativeMenu/utils.mjs.map +1 -0
- package/dist/esm/createNativeMenu/utils.native.js +52 -0
- package/dist/esm/createNativeMenu/utils.native.js.map +1 -0
- package/dist/esm/createNativeMenu/withNativeMenu.js +15 -0
- package/dist/esm/createNativeMenu/withNativeMenu.js.map +6 -0
- package/dist/esm/createNativeMenu/withNativeMenu.mjs +14 -0
- package/dist/esm/createNativeMenu/withNativeMenu.mjs.map +1 -0
- package/dist/esm/createNativeMenu/withNativeMenu.native.js +17 -0
- package/dist/esm/createNativeMenu/withNativeMenu.native.js.map +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +6 -0
- package/dist/esm/index.mjs +6 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +6 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/jsx/MenuPredefined.js +147 -0
- package/dist/jsx/MenuPredefined.js.map +6 -0
- package/dist/jsx/MenuPredefined.mjs +159 -0
- package/dist/jsx/MenuPredefined.mjs.map +1 -0
- package/dist/jsx/MenuPredefined.native.js +185 -0
- package/dist/jsx/MenuPredefined.native.js.map +1 -0
- package/dist/jsx/createBaseMenu.js +729 -0
- package/dist/jsx/createBaseMenu.js.map +6 -0
- package/dist/jsx/createBaseMenu.mjs +893 -0
- package/dist/jsx/createBaseMenu.mjs.map +1 -0
- package/dist/jsx/createBaseMenu.native.js +1105 -0
- package/dist/jsx/createBaseMenu.native.js.map +1 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.js +150 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.js.map +6 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.mjs +190 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.mjs.map +1 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.native.js +287 -0
- package/dist/jsx/createNativeMenu/createNativeMenu.native.js.map +1 -0
- package/dist/jsx/createNativeMenu/createNativeMenuTypes.js +1 -0
- package/dist/jsx/createNativeMenu/createNativeMenuTypes.js.map +6 -0
- package/dist/jsx/createNativeMenu/createNativeMenuTypes.mjs +2 -0
- package/dist/jsx/createNativeMenu/createNativeMenuTypes.mjs.map +1 -0
- package/dist/jsx/createNativeMenu/createNativeMenuTypes.native.js +19 -0
- package/dist/jsx/createNativeMenu/createNativeMenuTypes.native.js.map +1 -0
- package/dist/jsx/createNativeMenu/index.js +3 -0
- package/dist/jsx/createNativeMenu/index.js.map +6 -0
- package/dist/jsx/createNativeMenu/index.mjs +3 -0
- package/dist/jsx/createNativeMenu/index.mjs.map +1 -0
- package/dist/jsx/createNativeMenu/index.native.js +22 -0
- package/dist/jsx/createNativeMenu/index.native.js.map +1 -0
- package/dist/jsx/createNativeMenu/utils.js +47 -0
- package/dist/jsx/createNativeMenu/utils.js.map +6 -0
- package/dist/jsx/createNativeMenu/utils.mjs +29 -0
- package/dist/jsx/createNativeMenu/utils.mjs.map +1 -0
- package/dist/jsx/createNativeMenu/utils.native.js +94 -0
- package/dist/jsx/createNativeMenu/utils.native.js.map +1 -0
- package/dist/jsx/createNativeMenu/withNativeMenu.js +15 -0
- package/dist/jsx/createNativeMenu/withNativeMenu.js.map +6 -0
- package/dist/jsx/createNativeMenu/withNativeMenu.mjs +14 -0
- package/dist/jsx/createNativeMenu/withNativeMenu.mjs.map +1 -0
- package/dist/jsx/createNativeMenu/withNativeMenu.native.js +43 -0
- package/dist/jsx/createNativeMenu/withNativeMenu.native.js.map +1 -0
- package/dist/jsx/index.js +8 -0
- package/dist/jsx/index.js.map +6 -0
- package/dist/jsx/index.mjs +6 -0
- package/dist/jsx/index.mjs.map +1 -0
- package/dist/jsx/index.native.js +33 -0
- package/dist/jsx/index.native.js.map +1 -0
- package/package.json +80 -0
- package/src/MenuPredefined.tsx +195 -0
- package/src/createBaseMenu.tsx +1703 -0
- package/src/createNativeMenu/createNativeMenu.tsx +372 -0
- package/src/createNativeMenu/createNativeMenuTypes.ts +214 -0
- package/src/createNativeMenu/index.tsx +7 -0
- package/src/createNativeMenu/utils.tsx +150 -0
- package/src/createNativeMenu/withNativeMenu.tsx +38 -0
- package/src/index.tsx +9 -0
- package/types/MenuPredefined.d.ts +28 -0
- package/types/MenuPredefined.d.ts.map +1 -0
- package/types/createBaseMenu.d.ts +207 -0
- package/types/createBaseMenu.d.ts.map +1 -0
- package/types/createNativeMenu/createNativeMenu.d.ts +42 -0
- package/types/createNativeMenu/createNativeMenu.d.ts.map +1 -0
- package/types/createNativeMenu/createNativeMenuTypes.d.ts +188 -0
- package/types/createNativeMenu/createNativeMenuTypes.d.ts.map +1 -0
- package/types/createNativeMenu/index.d.ts +4 -0
- package/types/createNativeMenu/index.d.ts.map +1 -0
- package/types/createNativeMenu/utils.d.ts +38 -0
- package/types/createNativeMenu/utils.d.ts.map +1 -0
- package/types/createNativeMenu/withNativeMenu.d.ts +9 -0
- package/types/createNativeMenu/withNativeMenu.d.ts.map +1 -0
- package/types/index.d.ts +6 -0
- package/types/index.d.ts.map +1 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credit to geist-ui/react, it's initially copied from there and updated.
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2020 Geist UI
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import React, {
|
|
28
|
+
Children,
|
|
29
|
+
type ReactElement,
|
|
30
|
+
type ReactNode,
|
|
31
|
+
cloneElement,
|
|
32
|
+
isValidElement,
|
|
33
|
+
} from 'react'
|
|
34
|
+
|
|
35
|
+
type ReactChildArray = ReturnType<typeof React.Children.toArray>
|
|
36
|
+
|
|
37
|
+
export function flattenChildrenKeyless(children: ReactNode): ReactChildArray {
|
|
38
|
+
const childrenArray = React.Children.toArray(children)
|
|
39
|
+
return childrenArray.reduce((flatChildren: ReactChildArray, child) => {
|
|
40
|
+
if ((child as React.ReactElement<any>).type === React.Fragment) {
|
|
41
|
+
return flatChildren.concat(
|
|
42
|
+
flattenChildren((child as React.ReactElement<any>).props.children)
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
flatChildren.push(child)
|
|
46
|
+
return flatChildren
|
|
47
|
+
}, [])
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function flattenChildren(
|
|
51
|
+
children: ReactNode,
|
|
52
|
+
componentNamesToIgnore?: string[],
|
|
53
|
+
depth = 0,
|
|
54
|
+
keys: (string | number)[] = []
|
|
55
|
+
): ReactNode[] {
|
|
56
|
+
return Children.toArray(children)
|
|
57
|
+
.flatMap((elem) => {
|
|
58
|
+
if (isValidElement(elem)) {
|
|
59
|
+
if (
|
|
60
|
+
typeof (elem as any)?.type == 'function' &&
|
|
61
|
+
componentNamesToIgnore?.some((skipComponentName) =>
|
|
62
|
+
(elem.type as any).displayName.includes(skipComponentName)
|
|
63
|
+
)
|
|
64
|
+
) {
|
|
65
|
+
return (elem as any).props.children
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return elem
|
|
69
|
+
})
|
|
70
|
+
.reduce((acc: ReactNode[], node: any, nodeIndex) => {
|
|
71
|
+
if (node.type === React.Fragment) {
|
|
72
|
+
acc.push.apply(
|
|
73
|
+
acc,
|
|
74
|
+
flattenChildren(
|
|
75
|
+
node.props.children,
|
|
76
|
+
componentNamesToIgnore,
|
|
77
|
+
depth + 1,
|
|
78
|
+
keys.concat(node.key || nodeIndex)
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
} else {
|
|
82
|
+
if (isValidElement(node)) {
|
|
83
|
+
acc.push(
|
|
84
|
+
cloneElement(node, {
|
|
85
|
+
key: keys.concat(String(node.key)).join('.'),
|
|
86
|
+
})
|
|
87
|
+
)
|
|
88
|
+
} else if (typeof node === 'string' || typeof node === 'number') {
|
|
89
|
+
acc.push(node)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return acc
|
|
93
|
+
}, [])
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const pickChildren = <Props = any>(
|
|
97
|
+
_children: ReactNode | undefined,
|
|
98
|
+
targetChild: React.ElementType,
|
|
99
|
+
componentNamesToIgnore?: string[]
|
|
100
|
+
) => {
|
|
101
|
+
const children = flattenChildren(_children, componentNamesToIgnore)
|
|
102
|
+
const target: ReactElement<Props>[] = []
|
|
103
|
+
const withoutTargetChildren = React.Children.map(children, (item) => {
|
|
104
|
+
if (!isValidElement(item)) return item
|
|
105
|
+
if (isInstanceOfComponent(item, targetChild)) {
|
|
106
|
+
// @ts-expect-error
|
|
107
|
+
target.push(cloneElement(item))
|
|
108
|
+
return null
|
|
109
|
+
}
|
|
110
|
+
return item
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
const targetChildren = target.length >= 0 ? target : undefined
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
targetChildren,
|
|
117
|
+
withoutTargetChildren,
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const isInstanceOfComponent = (
|
|
122
|
+
element: React.ReactElement | ReactNode | undefined,
|
|
123
|
+
targetElement: React.ElementType
|
|
124
|
+
) => {
|
|
125
|
+
const matches =
|
|
126
|
+
(element as any)?.type === targetElement ||
|
|
127
|
+
(typeof (element as any)?.type == 'function' &&
|
|
128
|
+
((element as any)?.type?.displayName === (targetElement as any).displayName ||
|
|
129
|
+
(element as any)?.type?.displayName ===
|
|
130
|
+
(targetElement as any).displayName + 'Wrapper'))
|
|
131
|
+
return matches
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export const filterNull = <T extends unknown | null | undefined>(
|
|
135
|
+
t: T
|
|
136
|
+
): t is NonNullable<T> => {
|
|
137
|
+
return t != null
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const create = <Props extends {}>(
|
|
141
|
+
Component: React.ComponentType<Props>,
|
|
142
|
+
displayName: string
|
|
143
|
+
) => {
|
|
144
|
+
const MenuComponent: React.FC<Props> = (props: Props) => {
|
|
145
|
+
return <Component {...(props as any)} />
|
|
146
|
+
}
|
|
147
|
+
MenuComponent.displayName = displayName
|
|
148
|
+
|
|
149
|
+
return MenuComponent
|
|
150
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { isWeb } from '@tamagui/web'
|
|
2
|
+
|
|
3
|
+
type CombinedProps<C, N> = C extends React.ComponentType<infer CP>
|
|
4
|
+
? N extends React.ComponentType<infer NP>
|
|
5
|
+
? CP & NP
|
|
6
|
+
: CP
|
|
7
|
+
: N extends React.ComponentType<infer NP>
|
|
8
|
+
? NP
|
|
9
|
+
: {}
|
|
10
|
+
|
|
11
|
+
export function withNativeMenu<
|
|
12
|
+
C extends React.ComponentType<any>,
|
|
13
|
+
N extends React.ComponentType<any>,
|
|
14
|
+
>({
|
|
15
|
+
Component,
|
|
16
|
+
NativeComponent,
|
|
17
|
+
}: {
|
|
18
|
+
Component: C
|
|
19
|
+
NativeComponent: N
|
|
20
|
+
scope?: string
|
|
21
|
+
isRoot?: boolean
|
|
22
|
+
}): React.FC<CombinedProps<C, N>> {
|
|
23
|
+
type Props = CombinedProps<C, N>
|
|
24
|
+
|
|
25
|
+
if (isWeb) {
|
|
26
|
+
return Component as React.FC<Props>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// On native platform, always use native component
|
|
30
|
+
const Menu: React.FC<Props> = (props) => {
|
|
31
|
+
return <NativeComponent {...(props as React.ComponentProps<N>)} />
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// displayName is required for Portal flattening (checks displayName.includes('Portal'))
|
|
35
|
+
Menu.displayName = NativeComponent.displayName || Component.displayName
|
|
36
|
+
|
|
37
|
+
return Menu
|
|
38
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import '@tamagui/polyfill-dev'
|
|
2
|
+
|
|
3
|
+
export * from './createBaseMenu'
|
|
4
|
+
export * from './createNativeMenu/index'
|
|
5
|
+
export type {
|
|
6
|
+
MenuItemImageProps,
|
|
7
|
+
MenuItemIconProps,
|
|
8
|
+
} from './createNativeMenu/createNativeMenuTypes'
|
|
9
|
+
export { MenuPredefined } from './MenuPredefined'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const MenuPredefined: {
|
|
2
|
+
MenuIcon: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
3
|
+
unstyled?: boolean | undefined;
|
|
4
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
5
|
+
MenuImage: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, unknown, import("@tamagui/web").TamaguiComponentPropsBaseBase & Partial<import("@tamagui/image").ImageProps>, import("@tamagui/web").StackStyleBase, {}, import("@tamagui/web").StaticConfigPublic>;
|
|
6
|
+
MenuIndicator: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
7
|
+
unstyled?: boolean | undefined;
|
|
8
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
9
|
+
MenuItem: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
10
|
+
unstyled?: boolean | undefined;
|
|
11
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
12
|
+
Title: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiTextElement, import("@tamagui/web").TextNonStyleProps, import("@tamagui/web").TextStylePropsBase, {
|
|
13
|
+
unstyled?: boolean | undefined;
|
|
14
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
15
|
+
SubTitle: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiTextElement, import("@tamagui/web").TextNonStyleProps, import("@tamagui/web").TextStylePropsBase, {
|
|
16
|
+
unstyled?: boolean | undefined;
|
|
17
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
18
|
+
MenuGroup: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
19
|
+
unstyled?: boolean | undefined;
|
|
20
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
21
|
+
MenuSeparator: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
22
|
+
unstyled?: boolean | undefined;
|
|
23
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
24
|
+
MenuLabel: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiTextElement, import("@tamagui/web").TextNonStyleProps, import("@tamagui/web").TextStylePropsBase, {
|
|
25
|
+
unstyled?: boolean | undefined;
|
|
26
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=MenuPredefined.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuPredefined.d.ts","sourceRoot":"","sources":["../src/MenuPredefined.tsx"],"names":[],"mappings":"AAwLA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;CAU1B,CAAA"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { Dismissable as DismissableLayer } from '@tamagui/dismissable';
|
|
2
|
+
import { FocusScope } from '@tamagui/focus-scope';
|
|
3
|
+
import type { PopperContentProps } from '@tamagui/popper';
|
|
4
|
+
import * as PopperPrimitive from '@tamagui/popper';
|
|
5
|
+
import type { RovingFocusGroupProps } from '@tamagui/roving-focus';
|
|
6
|
+
import type { TamaguiComponent, TextProps } from '@tamagui/web';
|
|
7
|
+
import { type Stack, type ViewProps } from '@tamagui/web';
|
|
8
|
+
import type { TamaguiElement } from '@tamagui/web/types';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import type { Image, ImageProps } from 'react-native';
|
|
11
|
+
type Direction = 'ltr' | 'rtl';
|
|
12
|
+
type ScopedProps<P> = P & {
|
|
13
|
+
scope?: string;
|
|
14
|
+
};
|
|
15
|
+
interface MenuBaseProps extends PopperPrimitive.PopperProps {
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
onOpenChange?(open: boolean): void;
|
|
19
|
+
dir?: Direction;
|
|
20
|
+
modal?: boolean;
|
|
21
|
+
native?: boolean;
|
|
22
|
+
}
|
|
23
|
+
type PopperAnchorProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.PopperAnchor>;
|
|
24
|
+
interface MenuAnchorProps extends PopperAnchorProps {
|
|
25
|
+
}
|
|
26
|
+
interface MenuPortalProps {
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Used to force mounting when more control is needed. Useful when
|
|
30
|
+
* controlling animation with React animation libraries.
|
|
31
|
+
*/
|
|
32
|
+
forceMount?: true;
|
|
33
|
+
zIndex?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* We purposefully don't union MenuRootContent and MenuSubContent props here because
|
|
37
|
+
* they have conflicting prop types. We agreed that we would allow MenuSubContent to
|
|
38
|
+
* accept props that it would just ignore.
|
|
39
|
+
*/
|
|
40
|
+
interface MenuContentProps extends MenuRootContentTypeProps {
|
|
41
|
+
/**
|
|
42
|
+
* Used to force mounting when more control is needed. Useful when
|
|
43
|
+
* controlling animation with React animation libraries.
|
|
44
|
+
*/
|
|
45
|
+
forceMount?: true;
|
|
46
|
+
}
|
|
47
|
+
interface MenuRootContentTypeProps extends Omit<MenuContentImplProps, keyof MenuContentImplPrivateProps> {
|
|
48
|
+
}
|
|
49
|
+
type MenuContentImplElement = React.ElementRef<typeof PopperPrimitive.PopperContent>;
|
|
50
|
+
type FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;
|
|
51
|
+
type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;
|
|
52
|
+
type MenuContentImplPrivateProps = {
|
|
53
|
+
onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
|
|
54
|
+
onDismiss?: DismissableLayerProps['onDismiss'];
|
|
55
|
+
disableOutsidePointerEvents?: DismissableLayerProps['disableOutsidePointerEvents'];
|
|
56
|
+
/**
|
|
57
|
+
* Whether scrolling outside the `MenuContent` should be prevented
|
|
58
|
+
* (default: `false`)
|
|
59
|
+
*/
|
|
60
|
+
disableOutsideScroll?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Whether focus should be trapped within the `MenuContent`
|
|
63
|
+
* (default: false)
|
|
64
|
+
*/
|
|
65
|
+
trapFocus?: FocusScopeProps['trapped'];
|
|
66
|
+
};
|
|
67
|
+
interface MenuContentImplProps extends MenuContentImplPrivateProps, Omit<PopperContentProps, 'dir' | 'onPlaced'> {
|
|
68
|
+
/**
|
|
69
|
+
* Event handler called when auto-focusing on close.
|
|
70
|
+
* Can be prevented.
|
|
71
|
+
*/
|
|
72
|
+
onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
|
|
73
|
+
/**
|
|
74
|
+
* Whether keyboard navigation should loop around
|
|
75
|
+
* @defaultValue false
|
|
76
|
+
*/
|
|
77
|
+
loop?: RovingFocusGroupProps['loop'];
|
|
78
|
+
onEntryFocus?: RovingFocusGroupProps['onEntryFocus'];
|
|
79
|
+
onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];
|
|
80
|
+
onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];
|
|
81
|
+
onFocusOutside?: DismissableLayerProps['onFocusOutside'];
|
|
82
|
+
onInteractOutside?: DismissableLayerProps['onInteractOutside'];
|
|
83
|
+
}
|
|
84
|
+
interface MenuGroupProps extends ViewProps {
|
|
85
|
+
}
|
|
86
|
+
interface MenuLabelProps extends ViewProps {
|
|
87
|
+
}
|
|
88
|
+
interface MenuItemProps extends Omit<MenuItemImplProps, 'onSelect'> {
|
|
89
|
+
onSelect?: (event: Event) => void;
|
|
90
|
+
unstyled?: boolean;
|
|
91
|
+
}
|
|
92
|
+
interface MenuItemImplProps extends ViewProps {
|
|
93
|
+
disabled?: boolean;
|
|
94
|
+
textValue?: string;
|
|
95
|
+
unstyled?: boolean;
|
|
96
|
+
}
|
|
97
|
+
interface MenuItemTitleProps extends TextProps {
|
|
98
|
+
}
|
|
99
|
+
interface MenuItemSubTitleProps extends TextProps {
|
|
100
|
+
}
|
|
101
|
+
type MenuItemIconProps = ViewProps;
|
|
102
|
+
type CheckedState = boolean | 'indeterminate';
|
|
103
|
+
interface MenuCheckboxItemProps extends MenuItemProps {
|
|
104
|
+
checked?: CheckedState;
|
|
105
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
106
|
+
}
|
|
107
|
+
interface MenuRadioGroupProps extends MenuGroupProps {
|
|
108
|
+
value?: string;
|
|
109
|
+
onValueChange?: (value: string) => void;
|
|
110
|
+
}
|
|
111
|
+
interface MenuRadioItemProps extends MenuItemProps {
|
|
112
|
+
value: string;
|
|
113
|
+
}
|
|
114
|
+
type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Stack>;
|
|
115
|
+
interface MenuItemIndicatorProps extends PrimitiveSpanProps {
|
|
116
|
+
/**
|
|
117
|
+
* Used to force mounting when more control is needed. Useful when
|
|
118
|
+
* controlling animation with React animation libraries.
|
|
119
|
+
*/
|
|
120
|
+
forceMount?: true;
|
|
121
|
+
}
|
|
122
|
+
interface MenuSeparatorProps extends ViewProps {
|
|
123
|
+
}
|
|
124
|
+
type PopperArrowProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.PopperArrow>;
|
|
125
|
+
interface MenuArrowProps extends PopperArrowProps {
|
|
126
|
+
unstyled?: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface MenuSubProps extends PopperPrimitive.PopperProps {
|
|
129
|
+
children?: React.ReactNode;
|
|
130
|
+
open?: boolean;
|
|
131
|
+
onOpenChange?(open: boolean): void;
|
|
132
|
+
}
|
|
133
|
+
interface MenuSubTriggerProps extends MenuItemImplProps {
|
|
134
|
+
}
|
|
135
|
+
export type MenuSubContentElement = MenuContentImplElement;
|
|
136
|
+
export interface MenuSubContentProps extends Omit<MenuContentImplProps, keyof MenuContentImplPrivateProps | 'onCloseAutoFocus' | 'onEntryFocus' | 'side' | 'align'> {
|
|
137
|
+
/**
|
|
138
|
+
* Used to force mounting when more control is needed. Useful when
|
|
139
|
+
* controlling animation with React animation libraries.
|
|
140
|
+
*/
|
|
141
|
+
forceMount?: true;
|
|
142
|
+
}
|
|
143
|
+
export type CreateBaseMenuProps = {
|
|
144
|
+
Item?: TamaguiComponent;
|
|
145
|
+
MenuGroup?: TamaguiComponent;
|
|
146
|
+
Title?: TamaguiComponent;
|
|
147
|
+
SubTitle?: TamaguiComponent;
|
|
148
|
+
Image?: React.ElementType;
|
|
149
|
+
Icon?: TamaguiComponent;
|
|
150
|
+
Indicator?: TamaguiComponent;
|
|
151
|
+
Separator?: TamaguiComponent;
|
|
152
|
+
Label?: TamaguiComponent;
|
|
153
|
+
};
|
|
154
|
+
export declare function createBaseMenu({ Item: _Item, Title: _Title, SubTitle: _SubTitle, Image: _Image, Icon: _Icon, Indicator: _Indicator, Separator: _Separator, MenuGroup: _MenuGroup, Label: _Label, }: CreateBaseMenuProps): {
|
|
155
|
+
Menu: {
|
|
156
|
+
(props: ScopedProps<MenuBaseProps>): import("react/jsx-runtime").JSX.Element;
|
|
157
|
+
displayName: string;
|
|
158
|
+
} & {
|
|
159
|
+
Anchor: {
|
|
160
|
+
(props: MenuAnchorProps): import("react/jsx-runtime").JSX.Element;
|
|
161
|
+
displayName: string;
|
|
162
|
+
};
|
|
163
|
+
Portal: {
|
|
164
|
+
(props: ScopedProps<MenuPortalProps>): import("react/jsx-runtime").JSX.Element;
|
|
165
|
+
displayName: string;
|
|
166
|
+
};
|
|
167
|
+
Content: React.ForwardRefExoticComponent<MenuContentProps & {
|
|
168
|
+
scope?: string;
|
|
169
|
+
} & React.RefAttributes<HTMLElement | import("react-native").View>>;
|
|
170
|
+
Group: TamaguiComponent;
|
|
171
|
+
Label: TamaguiComponent;
|
|
172
|
+
Item: React.ForwardRefExoticComponent<MenuItemProps & {
|
|
173
|
+
scope?: string;
|
|
174
|
+
} & React.RefAttributes<TamaguiElement>>;
|
|
175
|
+
CheckboxItem: React.ForwardRefExoticComponent<MenuCheckboxItemProps & {
|
|
176
|
+
scope?: string;
|
|
177
|
+
} & React.RefAttributes<TamaguiElement>>;
|
|
178
|
+
RadioGroup: TamaguiComponent<Omit<any, "scope" | keyof MenuRadioGroupProps> & MenuRadioGroupProps & {
|
|
179
|
+
scope?: string;
|
|
180
|
+
}, any, MenuRadioGroupProps & {
|
|
181
|
+
scope?: string;
|
|
182
|
+
}, {}, {}, {}>;
|
|
183
|
+
RadioItem: React.ForwardRefExoticComponent<MenuRadioItemProps & {
|
|
184
|
+
scope?: string;
|
|
185
|
+
} & React.RefAttributes<TamaguiElement>>;
|
|
186
|
+
ItemIndicator: TamaguiComponent<Omit<any, "scope" | keyof MenuItemIndicatorProps> & MenuItemIndicatorProps & {
|
|
187
|
+
scope?: string;
|
|
188
|
+
}, any, MenuItemIndicatorProps & {
|
|
189
|
+
scope?: string;
|
|
190
|
+
}, {}, {}, {}>;
|
|
191
|
+
Separator: TamaguiComponent;
|
|
192
|
+
Arrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<TamaguiElement>>;
|
|
193
|
+
Sub: React.FC<ScopedProps<MenuSubProps>>;
|
|
194
|
+
SubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & {
|
|
195
|
+
scope?: string;
|
|
196
|
+
} & React.RefAttributes<TamaguiElement>>;
|
|
197
|
+
SubContent: React.ForwardRefExoticComponent<MenuSubContentProps & {
|
|
198
|
+
scope?: string;
|
|
199
|
+
} & React.RefAttributes<HTMLElement | import("react-native").View>>;
|
|
200
|
+
ItemTitle: TamaguiComponent<any, any, {} & void, {}, {}, {}>;
|
|
201
|
+
ItemSubtitle: TamaguiComponent<any, any, {} & void, {}, {}, {}>;
|
|
202
|
+
ItemImage: React.ForwardRefExoticComponent<ImageProps & React.RefAttributes<Image>>;
|
|
203
|
+
ItemIcon: TamaguiComponent;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
export type { MenuAnchorProps, MenuArrowProps, MenuCheckboxItemProps, MenuContentProps, MenuGroupProps, MenuItemIconProps, MenuItemIndicatorProps, MenuItemProps, MenuItemSubTitleProps, MenuItemTitleProps, MenuLabelProps, MenuPortalProps, MenuBaseProps as MenuProps, MenuRadioGroupProps, MenuRadioItemProps, MenuSeparatorProps, MenuSubTriggerProps, };
|
|
207
|
+
//# sourceMappingURL=createBaseMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBaseMenu.d.ts","sourceRoot":"","sources":["../src/createBaseMenu.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,IAAI,gBAAgB,EAEhC,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,KAAK,eAAe,MAAM,iBAAiB,CAAA;AAGlD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAIlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EACL,KAAK,KAAK,EACV,KAAK,SAAS,EAUf,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIrD,KAAK,SAAS,GAAG,KAAK,GAAG,KAAK,CAAA;AA6B9B,KAA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AAkB,EAClB,mBAAmB,GACpB,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createNativeMenu - provides native menu implementation for React Native
|
|
3
|
+
*
|
|
4
|
+
* On Web: Returns empty stub components (withNativeMenu will use the web components instead)
|
|
5
|
+
* On Native: Uses Zeego for native menus (Credit to nandorojo/Zeego)
|
|
6
|
+
*/
|
|
7
|
+
import type { FC } from 'react';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type { ContextMenuPreviewProps, MenuArrowProps, MenuCheckboxItemProps, MenuContentProps, MenuGroupProps, MenuItemIconProps, MenuItemImageProps, MenuItemIndicatorProps, MenuItemProps, MenuItemSubtitleProps, MenuItemTitleProps, MenuLabelProps, MenuProps, MenuSeparatorProps, MenuSubContentProps, MenuSubProps, MenuSubTriggerProps, MenuTriggerProps } from './createNativeMenuTypes';
|
|
10
|
+
export type NativeMenuComponents = {
|
|
11
|
+
Menu: FC<MenuProps> & {
|
|
12
|
+
Trigger: FC<MenuTriggerProps>;
|
|
13
|
+
Content: FC<MenuContentProps>;
|
|
14
|
+
Item: FC<MenuItemProps>;
|
|
15
|
+
ItemTitle: FC<MenuItemTitleProps>;
|
|
16
|
+
ItemSubtitle: FC<MenuItemSubtitleProps>;
|
|
17
|
+
SubTrigger: FC<MenuSubTriggerProps>;
|
|
18
|
+
Group: FC<MenuGroupProps>;
|
|
19
|
+
ItemIcon: FC<MenuItemIconProps>;
|
|
20
|
+
Separator: FC<MenuSeparatorProps>;
|
|
21
|
+
CheckboxItem: FC<MenuCheckboxItemProps>;
|
|
22
|
+
ItemIndicator: FC<MenuItemIndicatorProps>;
|
|
23
|
+
ItemImage: FC<MenuItemImageProps>;
|
|
24
|
+
Label: FC<MenuLabelProps>;
|
|
25
|
+
Arrow: FC<MenuArrowProps>;
|
|
26
|
+
Sub: FC<MenuSubProps>;
|
|
27
|
+
SubContent: FC<MenuSubContentProps>;
|
|
28
|
+
Preview: FC<ContextMenuPreviewProps>;
|
|
29
|
+
Portal: FC<{
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
}>;
|
|
32
|
+
RadioGroup: FC<{
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
}>;
|
|
35
|
+
RadioItem: FC<{
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
}>;
|
|
38
|
+
Auxiliary: FC<any>;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export declare const createNativeMenu: (MenuType: "ContextMenu" | "Menu") => NativeMenuComponents;
|
|
42
|
+
//# sourceMappingURL=createNativeMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNativeMenu.d.ts","sourceRoot":"","sources":["../../src/createNativeMenu/createNativeMenu.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,yBAAyB,CAAA;AAEhC,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG;QACpB,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAA;QAC7B,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAA;QAC7B,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,CAAA;QACvB,SAAS,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAA;QACjC,YAAY,EAAE,EAAE,CAAC,qBAAqB,CAAC,CAAA;QACvC,UAAU,E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