@brand-map/primitives 0.0.0-broken.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.
Files changed (121) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +11 -0
  3. package/.oxfmtrc.json +35 -0
  4. package/.oxlintrc.json +166 -0
  5. package/README.md +78 -0
  6. package/bun.lock +904 -0
  7. package/mise.toml +3 -0
  8. package/package.json +61 -0
  9. package/src/accordion/accordion.tsx +189 -0
  10. package/src/accordion/accordion.web.tsx +282 -0
  11. package/src/accordion/index.ts +2 -0
  12. package/src/accordion/types.ts +44 -0
  13. package/src/alert-dialog/alert-dialog.tsx +238 -0
  14. package/src/alert-dialog/alert-dialog.web.tsx +260 -0
  15. package/src/alert-dialog/index.ts +2 -0
  16. package/src/alert-dialog/types.ts +81 -0
  17. package/src/aspect-ratio/aspect-ratio.tsx +27 -0
  18. package/src/aspect-ratio/index.ts +1 -0
  19. package/src/avatar/avatar.tsx +122 -0
  20. package/src/avatar/index.ts +2 -0
  21. package/src/avatar/types.ts +20 -0
  22. package/src/checkbox/checkbox.tsx +95 -0
  23. package/src/checkbox/checkbox.web.tsx +111 -0
  24. package/src/checkbox/index.ts +2 -0
  25. package/src/checkbox/types.ts +14 -0
  26. package/src/collapsible/collapsible.tsx +98 -0
  27. package/src/collapsible/collapsible.web.tsx +149 -0
  28. package/src/collapsible/index.ts +2 -0
  29. package/src/collapsible/types.ts +23 -0
  30. package/src/context-menu/context-menu.tsx +616 -0
  31. package/src/context-menu/context-menu.web.tsx +560 -0
  32. package/src/context-menu/index.ts +2 -0
  33. package/src/context-menu/types.ts +136 -0
  34. package/src/dialog/dialog.tsx +286 -0
  35. package/src/dialog/dialog.web.tsx +215 -0
  36. package/src/dialog/index.ts +2 -0
  37. package/src/dialog/types.ts +92 -0
  38. package/src/dropdown-menu/dropdown-menu.tsx +575 -0
  39. package/src/dropdown-menu/dropdown-menu.web.tsx +565 -0
  40. package/src/dropdown-menu/index.ts +2 -0
  41. package/src/dropdown-menu/types.ts +121 -0
  42. package/src/hooks/index.ts +4 -0
  43. package/src/hooks/use-Isomorphic-layout-effect.tsx +12 -0
  44. package/src/hooks/use-augmented-ref.tsx +25 -0
  45. package/src/hooks/use-controllable-state.tsx +70 -0
  46. package/src/hooks/use-relative-position.tsx +175 -0
  47. package/src/hover-card/hover-card.tsx +255 -0
  48. package/src/hover-card/hover-card.web.tsx +161 -0
  49. package/src/hover-card/index.ts +2 -0
  50. package/src/hover-card/types.ts +56 -0
  51. package/src/label/index.ts +2 -0
  52. package/src/label/label.tsx +36 -0
  53. package/src/label/label.web.tsx +38 -0
  54. package/src/label/types.ts +24 -0
  55. package/src/menubar/index.ts +2 -0
  56. package/src/menubar/menubar.tsx +602 -0
  57. package/src/menubar/menubar.web.tsx +575 -0
  58. package/src/menubar/types.ts +126 -0
  59. package/src/navigation-menu/index.ts +2 -0
  60. package/src/navigation-menu/navigation-menu.tsx +302 -0
  61. package/src/navigation-menu/navigation-menu.web.tsx +259 -0
  62. package/src/navigation-menu/types.ts +85 -0
  63. package/src/popover/index.ts +2 -0
  64. package/src/popover/popover.tsx +279 -0
  65. package/src/popover/popover.web.tsx +217 -0
  66. package/src/popover/types.ts +44 -0
  67. package/src/portal/index.ts +1 -0
  68. package/src/portal/portal.tsx +56 -0
  69. package/src/progress/index.ts +2 -0
  70. package/src/progress/progress.tsx +59 -0
  71. package/src/progress/progress.web.tsx +46 -0
  72. package/src/progress/types.ts +14 -0
  73. package/src/radio-group/index.ts +2 -0
  74. package/src/radio-group/radio-group.tsx +106 -0
  75. package/src/radio-group/radio-group.web.tsx +85 -0
  76. package/src/radio-group/types.ts +24 -0
  77. package/src/select/index.ts +2 -0
  78. package/src/select/select.tsx +447 -0
  79. package/src/select/select.web.tsx +368 -0
  80. package/src/select/types.ts +145 -0
  81. package/src/separator/index.ts +2 -0
  82. package/src/separator/separator.tsx +21 -0
  83. package/src/separator/types.ts +10 -0
  84. package/src/slider/index.ts +2 -0
  85. package/src/slider/slider.tsx +77 -0
  86. package/src/slider/slider.web.tsx +75 -0
  87. package/src/slider/types.ts +39 -0
  88. package/src/slot/index.ts +1 -0
  89. package/src/slot/slot.tsx +224 -0
  90. package/src/switch/index.ts +2 -0
  91. package/src/switch/switch.tsx +49 -0
  92. package/src/switch/switch.web.tsx +60 -0
  93. package/src/switch/types.ts +19 -0
  94. package/src/table/index.ts +1 -0
  95. package/src/table/table.tsx +121 -0
  96. package/src/tabs/index.ts +2 -0
  97. package/src/tabs/tabs.tsx +120 -0
  98. package/src/tabs/tabs.web.tsx +106 -0
  99. package/src/tabs/types.ts +37 -0
  100. package/src/toast/index.ts +2 -0
  101. package/src/toast/toast.tsx +124 -0
  102. package/src/toast/types.ts +20 -0
  103. package/src/toggle/index.ts +2 -0
  104. package/src/toggle/toggle.tsx +35 -0
  105. package/src/toggle/toggle.web.tsx +36 -0
  106. package/src/toggle/types.ts +11 -0
  107. package/src/toggle-group/index.ts +2 -0
  108. package/src/toggle-group/toggle-group.tsx +100 -0
  109. package/src/toggle-group/toggle-group.web.tsx +103 -0
  110. package/src/toggle-group/types.ts +46 -0
  111. package/src/toolbar/index.ts +2 -0
  112. package/src/toolbar/toolbar.tsx +141 -0
  113. package/src/toolbar/toolbar.web.tsx +158 -0
  114. package/src/toolbar/types.ts +64 -0
  115. package/src/tooltip/index.ts +2 -0
  116. package/src/tooltip/tooltip.tsx +261 -0
  117. package/src/tooltip/tooltip.web.tsx +175 -0
  118. package/src/tooltip/types.ts +61 -0
  119. package/src/types/index.ts +141 -0
  120. package/src/utils/index.ts +69 -0
  121. package/tsconfig.json +23 -0
@@ -0,0 +1,302 @@
1
+ import * as React from "react";
2
+ import { BackHandler, Pressable, View, type GestureResponderEvent, type LayoutChangeEvent, type LayoutRectangle } from "react-native";
3
+
4
+ import { useRelativePosition, type LayoutPosition } from "../hooks";
5
+ import { Portal as RNPPortal } from "../portal";
6
+ import * as Slot from "../slot";
7
+
8
+ import type {
9
+ ContentProps,
10
+ ContentRef,
11
+ IndicatorProps,
12
+ IndicatorRef,
13
+ ItemProps,
14
+ ItemRef,
15
+ LinkProps,
16
+ LinkRef,
17
+ ListProps,
18
+ ListRef,
19
+ PortalProps,
20
+ RootProps,
21
+ RootRef,
22
+ TriggerProps,
23
+ TriggerRef,
24
+ ViewportProps,
25
+ ViewportRef,
26
+ } from "./types";
27
+
28
+ interface INavigationMenuRootContext extends RootProps {
29
+ triggerPosition: LayoutPosition | null;
30
+ setTriggerPosition: (triggerPosition: LayoutPosition | null) => void;
31
+ contentLayout: LayoutRectangle | null;
32
+ setContentLayout: (contentLayout: LayoutRectangle | null) => void;
33
+ nativeID: string;
34
+ }
35
+
36
+ const RootContext = React.createContext<INavigationMenuRootContext | null>(null);
37
+
38
+ const Root = React.forwardRef<RootRef, RootProps>(({ value, onValueChange, ...viewProps }, ref) => {
39
+ const nativeID = React.useId();
40
+ const [triggerPosition, setTriggerPosition] = React.useState<LayoutPosition | null>(null);
41
+ const [contentLayout, setContentLayout] = React.useState<LayoutRectangle | null>(null);
42
+
43
+ return (
44
+ <RootContext.Provider
45
+ value={{
46
+ value,
47
+ onValueChange,
48
+ nativeID,
49
+ contentLayout,
50
+ setContentLayout,
51
+ setTriggerPosition,
52
+ triggerPosition,
53
+ }}
54
+ >
55
+ <Component
56
+ ref={ref}
57
+ role="navigation"
58
+ {...viewProps}
59
+ />
60
+ </RootContext.Provider>
61
+ );
62
+ });
63
+
64
+ Root.displayName = "RootNativeNavigationMenu";
65
+
66
+ function useRootContext() {
67
+ const context = React.useContext(RootContext);
68
+ if (!context) {
69
+ throw new Error("NavigationMenu compound components cannot be rendered outside the NavigationMenu component");
70
+ }
71
+ return context;
72
+ }
73
+
74
+ const List = React.forwardRef<ListRef, ListProps>(({ ...viewProps }, ref) => {
75
+ return (
76
+ <Component
77
+ ref={ref}
78
+ role="menubar"
79
+ {...viewProps}
80
+ />
81
+ );
82
+ });
83
+
84
+ List.displayName = "ListNativeNavigationMenu";
85
+
86
+ const ItemContext = React.createContext<(ItemProps & { nativeID: string }) | null>(null);
87
+
88
+ const Item = React.forwardRef<ItemRef, ItemProps>(({ value, ...viewProps }, ref) => {
89
+ const nativeID = React.useId();
90
+
91
+ return (
92
+ <ItemContext.Provider
93
+ value={{
94
+ value,
95
+ nativeID,
96
+ }}
97
+ >
98
+ <Component
99
+ ref={ref}
100
+ role="menuitem"
101
+ {...viewProps}
102
+ />
103
+ </ItemContext.Provider>
104
+ );
105
+ });
106
+
107
+ Item.displayName = "ItemNativeNavigationMenu";
108
+
109
+ function useItemContext() {
110
+ const context = React.useContext(ItemContext);
111
+ if (!context) {
112
+ throw new Error("NavigationMenu compound components cannot be rendered outside the NavigationMenu component");
113
+ }
114
+ return context;
115
+ }
116
+
117
+ const Trigger = React.forwardRef<TriggerRef, TriggerProps>(({ onPress: onPressProp, disabled = false, ...props }, ref) => {
118
+ const triggerRef = React.useRef<View>(null);
119
+ const { value, onValueChange, setTriggerPosition } = useRootContext();
120
+ const { value: menuValue } = useItemContext();
121
+
122
+ React.useImperativeHandle(ref, () => {
123
+ if (!triggerRef.current) {
124
+ return new View({});
125
+ }
126
+ return triggerRef.current;
127
+ }, [triggerRef.current]);
128
+
129
+ function onPress(ev: GestureResponderEvent) {
130
+ if (disabled) return;
131
+ triggerRef.current?.measure((_x, _y, width, height, pageX, pageY) => {
132
+ setTriggerPosition({ width, pageX, pageY: pageY, height });
133
+ });
134
+
135
+ onValueChange(menuValue === value ? "" : menuValue);
136
+ onPressProp?.(ev);
137
+ }
138
+
139
+ return (
140
+ <Component
141
+ ref={triggerRef}
142
+ aria-disabled={disabled ?? undefined}
143
+ role="button"
144
+ onPress={onPress}
145
+ disabled={disabled ?? undefined}
146
+ aria-expanded={value === menuValue}
147
+ {...props}
148
+ />
149
+ );
150
+ });
151
+
152
+ Trigger.displayName = "TriggerNativeNavigationMenu";
153
+
154
+ /**
155
+ * @warning when using a custom `<PortalHost />`, you will have to adjust the Content's sideOffset to account for nav elements like headers.
156
+ */
157
+ function Portal({ keepMounted, hostName, children }: PortalProps) {
158
+ const navigationMenu = useRootContext();
159
+ const item = useItemContext();
160
+
161
+ if (!navigationMenu.triggerPosition) {
162
+ return null;
163
+ }
164
+
165
+ if (!keepMounted) {
166
+ if (navigationMenu.value !== item.value) {
167
+ return null;
168
+ }
169
+ }
170
+
171
+ return (
172
+ <RNPPortal
173
+ hostName={hostName}
174
+ name={`${navigationMenu.nativeID}_portal_provider`}
175
+ >
176
+ <RootContext.Provider
177
+ value={navigationMenu}
178
+ key={`RootContext_${navigationMenu.nativeID}_portal_provider`}
179
+ >
180
+ <ItemContext.Provider value={item}>{children}</ItemContext.Provider>
181
+ </RootContext.Provider>
182
+ </RNPPortal>
183
+ );
184
+ }
185
+
186
+ /**
187
+ * @info `position`, `top`, `left`, and `maxWidth` style properties are controlled internally. Opt out of this behavior by setting `disablePositioningStyle` to `true`.
188
+ */
189
+ const Content = React.forwardRef<ContentRef, ContentProps>(
190
+ (
191
+ {
192
+ render = false,
193
+ keepMounted,
194
+ align = "center",
195
+ side = "bottom",
196
+ sideOffset = 0,
197
+ alignOffset = 0,
198
+ avoidCollisions = true,
199
+ onLayout: onLayoutProp,
200
+ insets,
201
+ style,
202
+ disablePositioningStyle,
203
+ ...props
204
+ },
205
+ ref,
206
+ ) => {
207
+ const { value, onValueChange, triggerPosition, setTriggerPosition, contentLayout, setContentLayout } = useRootContext();
208
+ const { value: menuValue, nativeID } = useItemContext();
209
+
210
+ React.useEffect(() => {
211
+ const backHandler = BackHandler.addEventListener("hardwareBackPress", () => {
212
+ setTriggerPosition(null);
213
+ setContentLayout(null);
214
+ onValueChange("");
215
+ return true;
216
+ });
217
+
218
+ return () => {
219
+ setContentLayout(null);
220
+ backHandler.remove();
221
+ };
222
+ }, []);
223
+
224
+ const positionStyle = useRelativePosition({
225
+ align,
226
+ avoidCollisions,
227
+ triggerPosition,
228
+ contentLayout,
229
+ alignOffset,
230
+ insets,
231
+ sideOffset,
232
+ side,
233
+ disablePositioningStyle,
234
+ });
235
+
236
+ function onLayout(event: LayoutChangeEvent) {
237
+ setContentLayout(event.nativeEvent.layout);
238
+ onLayoutProp?.(event);
239
+ }
240
+
241
+ if (!keepMounted) {
242
+ if (value !== menuValue) {
243
+ return null;
244
+ }
245
+ }
246
+
247
+ return (
248
+ <Component
249
+ ref={ref}
250
+ role="menu"
251
+ nativeID={nativeID}
252
+ aria-modal={true}
253
+ style={[positionStyle, style]}
254
+ onLayout={onLayout}
255
+ onStartShouldSetResponder={onStartShouldSetResponder}
256
+ {...props}
257
+ />
258
+ );
259
+ },
260
+ );
261
+
262
+ Content.displayName = "ContentNativeNavigationMenu";
263
+
264
+ const Link = React.forwardRef<LinkRef, LinkProps>(({ ...props }, ref) => {
265
+ return (
266
+ <Component
267
+ ref={ref}
268
+ role="link"
269
+ {...props}
270
+ />
271
+ );
272
+ });
273
+
274
+ Link.displayName = "LinkNativeNavigationMenu";
275
+
276
+ const Viewport = React.forwardRef<ViewportRef, ViewportProps>((props, ref) => {
277
+ return (
278
+ <View
279
+ ref={ref}
280
+ {...props}
281
+ />
282
+ );
283
+ });
284
+
285
+ Viewport.displayName = "ViewportNativeNavigationMenu";
286
+
287
+ const Indicator = React.forwardRef<IndicatorRef, IndicatorProps>(({ ...props }, ref) => {
288
+ return (
289
+ <Component
290
+ ref={ref}
291
+ {...props}
292
+ />
293
+ );
294
+ });
295
+
296
+ Indicator.displayName = "IndicatorNativeNavigationMenu";
297
+
298
+ export { Content, Indicator, Item, Link, List, Portal, Root, Trigger, useItemContext, useRootContext, Viewport };
299
+
300
+ function onStartShouldSetResponder() {
301
+ return true;
302
+ }
@@ -0,0 +1,259 @@
1
+ // import * as NavigationMenu from "@radix-ui/react-navigation-menu";
2
+ // import * as React from "react";
3
+ // import { GestureResponderEvent, Pressable, View } from "react-native";
4
+
5
+ // import { useAugmentedRef, useIsomorphicLayoutEffect } from "../hooks";
6
+ // import * as Slot from "../slot";
7
+ // import { EmptyGestureResponderEvent } from "../utils";
8
+
9
+ // import type {
10
+ // ContentProps,
11
+ // ContentRef,
12
+ // IndicatorProps,
13
+ // IndicatorRef,
14
+ // ItemProps,
15
+ // ItemRef,
16
+ // LinkProps,
17
+ // LinkRef,
18
+ // ListProps,
19
+ // ListRef,
20
+ // PortalProps,
21
+ // RootProps,
22
+ // RootRef,
23
+ // TriggerProps,
24
+ // TriggerRef,
25
+ // ViewportProps,
26
+ // ViewportRef,
27
+ // } from "./types";
28
+
29
+ // const NavigationMenuContext = React.createContext<RootProps | null>(null);
30
+
31
+ // const Root = React.forwardRef<RootRef, RootProps>(
32
+ // ({ render, value, onValueChange, delayDuration, skipDelayDuration, dir, orientation, ...viewProps }, ref) => {
33
+ //
34
+ // return (
35
+ // <NavigationMenuContext.Provider value={{ value, onValueChange, orientation }}>
36
+ // <NavigationMenu.Root
37
+ // value={value}
38
+ // onValueChange={onValueChange}
39
+ // delayDuration={delayDuration}
40
+ // skipDelayDuration={skipDelayDuration}
41
+ // dir={dir}
42
+ // orientation={orientation}
43
+ // >
44
+ // <Component
45
+ // ref={ref}
46
+ // {...viewProps}
47
+ // />
48
+ // </NavigationMenu.Root>
49
+ // </NavigationMenuContext.Provider>
50
+ // );
51
+ // },
52
+ // );
53
+
54
+ // Root.displayName = "RootWebNavigationMenu";
55
+
56
+ // function useRootContext() {
57
+ // const context = React.useContext(NavigationMenuContext);
58
+ // if (!context) {
59
+ // throw new Error("NavigationMenu compound components cannot be rendered outside the NavigationMenu component");
60
+ // }
61
+ // return context;
62
+ // }
63
+
64
+ // const List = React.forwardRef<ListRef, ListProps>(({ ...viewProps }, ref) => {
65
+ // const augmentedRef = useAugmentedRef({ ref });
66
+ // const { orientation } = useRootContext();
67
+
68
+ // useIsomorphicLayoutEffect(() => {
69
+ // if (augmentedRef.current) {
70
+ // const augRef = augmentedRef.current as unknown as HTMLDivElement;
71
+ // augRef.dataset.orientation = orientation;
72
+ // }
73
+ // }, [orientation]);
74
+
75
+ //
76
+ // return (
77
+ // <NavigationMenu.List render>
78
+ // <Component
79
+ // ref={ref}
80
+ // {...viewProps}
81
+ // />
82
+ // </NavigationMenu.List>
83
+ // );
84
+ // });
85
+
86
+ // List.displayName = "ListWebNavigationMenu";
87
+
88
+ // const ItemContext = React.createContext<ItemProps | null>(null);
89
+
90
+ // const Item = React.forwardRef<ItemRef, ItemProps>(({ value, ...props }, ref) => {
91
+ //
92
+ // return (
93
+ // <ItemContext.Provider value={{ value }}>
94
+ // <NavigationMenu.Item
95
+ // value={value}
96
+ // render
97
+ // >
98
+ // <Component
99
+ // ref={ref}
100
+ // {...props}
101
+ // />
102
+ // </NavigationMenu.Item>
103
+ // </ItemContext.Provider>
104
+ // );
105
+ // });
106
+
107
+ // Item.displayName = "ItemWebNavigationMenu";
108
+
109
+ // function useItemContext() {
110
+ // const context = React.useContext(ItemContext);
111
+ // if (!context) {
112
+ // throw new Error("NavigationMenu compound components cannot be rendered outside the NavigationMenu component");
113
+ // }
114
+ // return context;
115
+ // }
116
+
117
+ // const Trigger = React.forwardRef<TriggerRef, TriggerProps>(({ onPress: onPressProp, disabled = false, onKeyDown: onKeyDownProp, ...props }, ref) => {
118
+ // const { value: rootValue, onValueChange } = useRootContext();
119
+ // const { value } = useItemContext();
120
+ // function onKeyDown(ev: React.KeyboardEvent) {
121
+ // onKeyDownProp?.(ev);
122
+ // if (ev.key === " ") {
123
+ // onPressProp?.(EmptyGestureResponderEvent);
124
+ // onValueChange(value === rootValue ? "" : value);
125
+ // }
126
+ // }
127
+
128
+ // function onPress(ev: GestureResponderEvent) {
129
+ // onPressProp?.(ev);
130
+ // onValueChange(value === rootValue ? "" : value);
131
+ // }
132
+
133
+ //
134
+ // return (
135
+ // <NavigationMenu.Trigger
136
+ // disabled={disabled ?? undefined}
137
+ // render
138
+ // >
139
+ // <Component
140
+ // ref={ref}
141
+ // // @ts-expect-error web only
142
+ // onKeyDown={onKeyDown}
143
+ // onPress={onPress}
144
+ // {...props}
145
+ // />
146
+ // </NavigationMenu.Trigger>
147
+ // );
148
+ // });
149
+
150
+ // Trigger.displayName = "TriggerWebNavigationMenu";
151
+
152
+ // function Portal({ children }: PortalProps) {
153
+ // return <>{children}</>;
154
+ // }
155
+
156
+ // const Content = React.forwardRef<ContentRef, ContentProps>(
157
+ // (
158
+ // {
159
+ // render = false,
160
+ // keepMounted,
161
+ // align: _align,
162
+ // side: _side,
163
+ // sideOffset: _sideOffset,
164
+ // alignOffset: _alignOffset,
165
+ // avoidCollisions: _avoidCollisions,
166
+ // onLayout: onLayoutProp,
167
+ // insets: _insets,
168
+ // disablePositioningStyle: _disablePositioningStyle,
169
+ // onEscapeKeyDown,
170
+ // onPointerDownOutside,
171
+ // onFocusOutside,
172
+ // onInteractOutside,
173
+ // ...props
174
+ // },
175
+ // ref,
176
+ // ) => {
177
+ //
178
+ // return (
179
+ // <NavigationMenu.Content
180
+ // keepMounted={keepMounted}
181
+ // onEscapeKeyDown={onEscapeKeyDown}
182
+ // onPointerDownOutside={onPointerDownOutside}
183
+ // onFocusOutside={onFocusOutside}
184
+ // onInteractOutside={onInteractOutside}
185
+ // >
186
+ // <Component
187
+ // ref={ref}
188
+ // {...props}
189
+ // />
190
+ // </NavigationMenu.Content>
191
+ // );
192
+ // },
193
+ // );
194
+
195
+ // Content.displayName = "ContentWebNavigationMenu";
196
+
197
+ // const Link = React.forwardRef<LinkRef, LinkProps>(({ active, onPress: onPressProp, onKeyDown: onKeyDownProp, ...props }, ref) => {
198
+ // const { onValueChange } = useRootContext();
199
+ // function onKeyDown(ev: React.KeyboardEvent) {
200
+ // onKeyDownProp?.(ev);
201
+ // if (ev.key === "Enter" || ev.key === " ") {
202
+ // onPressProp?.(EmptyGestureResponderEvent);
203
+ // onValueChange("");
204
+ // }
205
+ // }
206
+
207
+ // function onPress(ev: GestureResponderEvent) {
208
+ // onPressProp?.(ev);
209
+ // onValueChange("");
210
+ // }
211
+
212
+ //
213
+ // return (
214
+ // <NavigationMenu.Link
215
+ // active={active}
216
+ // render
217
+ // >
218
+ // <Component
219
+ // ref={ref}
220
+ // role="link"
221
+ // // @ts-expect-error web only
222
+ // onKeyDown={onKeyDown}
223
+ // onPress={onPress}
224
+ // {...props}
225
+ // />
226
+ // </NavigationMenu.Link>
227
+ // );
228
+ // });
229
+
230
+ // Link.displayName = "LinkWebNavigationMenu";
231
+
232
+ // const Viewport = React.forwardRef<ViewportRef, ViewportProps>((props, ref) => {
233
+ // return (
234
+ // <Slot.View
235
+ // ref={ref}
236
+ // {...props}
237
+ // >
238
+ // <NavigationMenu.Viewport />
239
+ // </Slot.View>
240
+ // );
241
+ // });
242
+
243
+ // Viewport.displayName = "ViewportWebNavigationMenu";
244
+
245
+ // const Indicator = React.forwardRef<IndicatorRef, IndicatorProps>(({ ...props }, ref) => {
246
+ //
247
+ // return (
248
+ // <NavigationMenu.Indicator render>
249
+ // <Component
250
+ // ref={ref}
251
+ // {...props}
252
+ // />
253
+ // </NavigationMenu.Indicator>
254
+ // );
255
+ // });
256
+
257
+ // Indicator.displayName = "IndicatorWebNavigationMenu";
258
+
259
+ // export { Content, Indicator, Item, Link, List, Portal, Root, Trigger, useItemContext, useRootContext, Viewport };
@@ -0,0 +1,85 @@
1
+ import type { ViewProps } from "react-native";
2
+
3
+ import type { KeepMountable, PositionedContentProps, PressableRef, RenderPressableProps, RenderViewProps, ViewRef } from "../types";
4
+
5
+ type RootProps = RenderViewProps & {
6
+ value: string | undefined;
7
+ onValueChange: (value: string | undefined) => void;
8
+
9
+ /**
10
+ * @platform: WEB ONLY
11
+ */
12
+ delayDuration?: number;
13
+
14
+ /**
15
+ * @platform: WEB ONLY
16
+ */
17
+ skipDelayDuration?: number;
18
+
19
+ /**
20
+ * @platform: WEB ONLY
21
+ */
22
+ dir?: "ltr" | "rtl";
23
+
24
+ /**
25
+ * @platform: WEB ONLY
26
+ */
27
+ orientation?: "horizontal" | "vertical";
28
+ };
29
+
30
+ type ItemProps = RenderViewProps & {
31
+ value: string | undefined;
32
+ };
33
+
34
+ interface PortalProps extends KeepMountable {
35
+ children: React.ReactNode;
36
+
37
+ /**
38
+ * @platform: NATIVE ONLY
39
+ */
40
+ hostName?: string;
41
+
42
+ /**
43
+ * @platform: WEB ONLY
44
+ */
45
+ container?: HTMLElement | null | undefined;
46
+ }
47
+
48
+ type LinkProps = RenderPressableProps & {
49
+ active?: boolean;
50
+ };
51
+
52
+ type ListProps = RenderViewProps;
53
+ type TriggerProps = RenderPressableProps;
54
+ type ContentProps = RenderViewProps & PositionedContentProps;
55
+ type IndicatorProps = RenderViewProps;
56
+ type ViewportProps = Omit<ViewProps, "children">;
57
+
58
+ type ContentRef = ViewRef;
59
+ type IndicatorRef = ViewRef;
60
+ type ItemRef = ViewRef;
61
+ type LinkRef = PressableRef;
62
+ type ListRef = ViewRef;
63
+ type RootRef = ViewRef;
64
+ type ViewportRef = ViewRef;
65
+ type TriggerRef = PressableRef;
66
+
67
+ export type {
68
+ ContentProps,
69
+ ContentRef,
70
+ IndicatorProps,
71
+ IndicatorRef,
72
+ ItemProps,
73
+ ItemRef,
74
+ LinkProps,
75
+ LinkRef,
76
+ ListProps,
77
+ ListRef,
78
+ PortalProps,
79
+ RootProps,
80
+ RootRef,
81
+ TriggerProps,
82
+ TriggerRef,
83
+ ViewportProps,
84
+ ViewportRef,
85
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./popover";
2
+ export * from "./types";