@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,565 @@
1
+ // import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
2
+ // import * as React from "react";
3
+ // import { GestureResponderEvent, Pressable, Text, View } from "react-native";
4
+
5
+ // import { useAugmentedRef, useControllableState, useIsomorphicLayoutEffect } from "../hooks";
6
+ // import * as Slot from "../slot";
7
+ // import { EmptyGestureResponderEvent } from "../utils";
8
+
9
+ // import type {
10
+ // CheckboxItemProps,
11
+ // CheckboxItemRef,
12
+ // ContentProps,
13
+ // ContentRef,
14
+ // GroupProps,
15
+ // GroupRef,
16
+ // ItemIndicatorProps,
17
+ // ItemIndicatorRef,
18
+ // ItemProps,
19
+ // ItemRef,
20
+ // LabelProps,
21
+ // LabelRef,
22
+ // BackdropProps,
23
+ // BackdropRef,
24
+ // PortalProps,
25
+ // RadioGroupProps,
26
+ // RadioGroupRef,
27
+ // RadioItemProps,
28
+ // RadioItemRef,
29
+ // RootProps,
30
+ // RootRef,
31
+ // SeparatorProps,
32
+ // SeparatorRef,
33
+ // SubContentProps,
34
+ // SubContentRef,
35
+ // SubProps,
36
+ // SubRef,
37
+ // SubTriggerProps,
38
+ // SubTriggerRef,
39
+ // TriggerProps,
40
+ // TriggerRef,
41
+ // } from "./types";
42
+
43
+ // const DropdownMenuContext = React.createContext<{
44
+ // open: boolean;
45
+ // onOpenChange: (open: boolean) => void;
46
+ // } | null>(null);
47
+
48
+ // const Root = React.forwardRef<RootRef, RootProps>(({ onOpenChange: onOpenChangeProp, ...viewProps }, ref) => {
49
+ // const [open, setOpen] = React.useState(false);
50
+
51
+ // function onOpenChange(open: boolean) {
52
+ // setOpen(open);
53
+ // onOpenChangeProp?.(open);
54
+ // }
55
+
56
+ //
57
+ // return (
58
+ // <DropdownMenuContext.Provider value={{ open, onOpenChange }}>
59
+ // <DropdownMenu.Root
60
+ // open={open}
61
+ // onOpenChange={onOpenChange}
62
+ // >
63
+ // <Component
64
+ // ref={ref}
65
+ // {...viewProps}
66
+ // />
67
+ // </DropdownMenu.Root>
68
+ // </DropdownMenuContext.Provider>
69
+ // );
70
+ // });
71
+
72
+ // Root.displayName = "RootWebDropdownMenu";
73
+
74
+ // function useRootContext() {
75
+ // const context = React.useContext(DropdownMenuContext);
76
+ // if (!context) {
77
+ // throw new Error("DropdownMenu compound components cannot be rendered outside the DropdownMenu component");
78
+ // }
79
+ // return context;
80
+ // }
81
+
82
+ // const Trigger = React.forwardRef<TriggerRef, TriggerProps>(({ disabled = false, ...props }, ref) => {
83
+ // const { open, onOpenChange } = useRootContext();
84
+ // const augmentedRef = useAugmentedRef({
85
+ // ref,
86
+ // methods: {
87
+ // open() {
88
+ // onOpenChange(true);
89
+ // },
90
+ // close() {
91
+ // onOpenChange(false);
92
+ // },
93
+ // },
94
+ // });
95
+
96
+ // useIsomorphicLayoutEffect(() => {
97
+ // if (augmentedRef.current) {
98
+ // const augRef = augmentedRef.current as unknown as HTMLDivElement;
99
+ // augRef.dataset.state = open ? "open" : "closed";
100
+ // }
101
+ // }, [open]);
102
+
103
+ // useIsomorphicLayoutEffect(() => {
104
+ // if (augmentedRef.current) {
105
+ // const augRef = augmentedRef.current as unknown as HTMLDivElement;
106
+ // if (disabled) {
107
+ // augRef.dataset.disabled = "true";
108
+ // } else {
109
+ // augRef.dataset.disabled = undefined;
110
+ // }
111
+ // }
112
+ // }, [disabled]);
113
+
114
+ //
115
+ // return (
116
+ // <DropdownMenu.Trigger
117
+ // disabled={disabled ?? undefined}
118
+ // render
119
+ // >
120
+ // <Component
121
+ // ref={augmentedRef}
122
+ // {...props}
123
+ // />
124
+ // </DropdownMenu.Trigger>
125
+ // );
126
+ // });
127
+
128
+ // Trigger.displayName = "TriggerWebDropdownMenu";
129
+
130
+ // function Portal({ keepMounted, container, children }: PortalProps) {
131
+ // return (
132
+ // <DropdownMenu.Portal
133
+ // keepMounted={keepMounted}
134
+ // container={container}
135
+ // children={children}
136
+ // />
137
+ // );
138
+ // }
139
+
140
+ // const Backdrop = React.forwardRef<BackdropRef, BackdropProps>(({ ...props }, ref) => {
141
+ //
142
+ // return (
143
+ // <Component
144
+ // ref={ref}
145
+ // {...props}
146
+ // />
147
+ // );
148
+ // });
149
+
150
+ // Backdrop.displayName = "BackdropWebDropdownMenu";
151
+
152
+ // const DropdownMenuContentContext = React.createContext<{
153
+ // close: () => void;
154
+ // } | null>(null);
155
+
156
+ // const Content = React.forwardRef<ContentRef, ContentProps>(
157
+ // (
158
+ // {
159
+ // render = false,
160
+ // keepMounted,
161
+ // align,
162
+ // side,
163
+ // sideOffset,
164
+ // alignOffset = 0,
165
+ // avoidCollisions = true,
166
+ // insets,
167
+ // loop = true,
168
+ // onCloseAutoFocus,
169
+ // onEscapeKeyDown,
170
+ // onPointerDownOutside,
171
+ // onFocusOutside,
172
+ // onInteractOutside,
173
+ // collisionBoundary,
174
+ // sticky,
175
+ // hideWhenDetached,
176
+ // ...props
177
+ // },
178
+ // ref,
179
+ // ) => {
180
+ // const itemRef = React.useRef<HTMLDivElement>(null);
181
+
182
+ // function close() {
183
+ // itemRef.current?.click();
184
+ // }
185
+ //
186
+ // return (
187
+ // <DropdownMenuContentContext.Provider value={{ close }}>
188
+ // <DropdownMenu.Content
189
+ // keepMounted={keepMounted}
190
+ // alignOffset={alignOffset}
191
+ // avoidCollisions={avoidCollisions}
192
+ // collisionPadding={insets}
193
+ // loop={loop}
194
+ // onCloseAutoFocus={onCloseAutoFocus}
195
+ // onEscapeKeyDown={onEscapeKeyDown}
196
+ // onPointerDownOutside={onPointerDownOutside}
197
+ // onFocusOutside={onFocusOutside}
198
+ // onInteractOutside={onInteractOutside}
199
+ // collisionBoundary={collisionBoundary}
200
+ // sticky={sticky}
201
+ // hideWhenDetached={hideWhenDetached}
202
+ // align={align}
203
+ // side={side}
204
+ // sideOffset={sideOffset}
205
+ // >
206
+ // <Component
207
+ // ref={ref}
208
+ // {...props}
209
+ // />
210
+ // <DropdownMenu.Item
211
+ // ref={itemRef}
212
+ // aria-hidden
213
+ // style={{ position: "fixed", top: 0, left: 0, zIndex: -999999999 }}
214
+ // aria-disabled
215
+ // tabIndex={-1}
216
+ // hidden
217
+ // />
218
+ // </DropdownMenu.Content>
219
+ // </DropdownMenuContentContext.Provider>
220
+ // );
221
+ // },
222
+ // );
223
+
224
+ // Content.displayName = "ContentWebDropdownMenu";
225
+
226
+ // function useDropdownMenuContentContext() {
227
+ // const context = React.useContext(DropdownMenuContentContext);
228
+ // if (!context) {
229
+ // throw new Error("DropdownMenu compound components cannot be rendered outside the DropdownMenu component");
230
+ // }
231
+ // return context;
232
+ // }
233
+
234
+ // const Item = React.forwardRef<ItemRef, ItemProps>(
235
+ // ({ render, textValue, closeOnPress = true, onPress: onPressProp, onKeyDown: onKeyDownProp, ...props }, ref) => {
236
+ // const { close } = useDropdownMenuContentContext();
237
+
238
+ // function onKeyDown(ev: React.KeyboardEvent) {
239
+ // onKeyDownProp?.(ev);
240
+ // if (ev.key === "Enter" || ev.key === " ") {
241
+ // onPressProp?.(EmptyGestureResponderEvent);
242
+ // if (closeOnPress) {
243
+ // close();
244
+ // }
245
+ // }
246
+ // }
247
+
248
+ // function onPress(ev: GestureResponderEvent) {
249
+ // onPressProp?.(ev);
250
+ // if (closeOnPress) {
251
+ // close();
252
+ // }
253
+ // }
254
+
255
+ //
256
+ // return (
257
+ // <DropdownMenu.Item
258
+ // textValue={textValue}
259
+ // disabled={props.disabled ?? undefined}
260
+ // onSelect={closeOnPress ? undefined : onSelected}
261
+ // render
262
+ // >
263
+ // <Component
264
+ // ref={ref}
265
+ // // @ts-expect-error web only
266
+ // onKeyDown={onKeyDown}
267
+ // onPress={onPress}
268
+ // {...props}
269
+ // />
270
+ // </DropdownMenu.Item>
271
+ // );
272
+ // },
273
+ // );
274
+
275
+ // Item.displayName = "ItemWebDropdownMenu";
276
+
277
+ // const Group = React.forwardRef<GroupRef, GroupProps>(({ ...props }, ref) => {
278
+ //
279
+ // return (
280
+ // <DropdownMenu.Group render>
281
+ // <Component
282
+ // ref={ref}
283
+ // {...props}
284
+ // />
285
+ // </DropdownMenu.Group>
286
+ // );
287
+ // });
288
+
289
+ // Group.displayName = "GroupWebDropdownMenu";
290
+
291
+ // const Label = React.forwardRef<LabelRef, LabelProps>(({ ...props }, ref) => {
292
+ //
293
+ // return (
294
+ // <DropdownMenu.Label render>
295
+ // <Component
296
+ // ref={ref}
297
+ // {...props}
298
+ // />
299
+ // </DropdownMenu.Label>
300
+ // );
301
+ // });
302
+
303
+ // Label.displayName = "LabelWebDropdownMenu";
304
+
305
+ // const CheckboxItem = React.forwardRef<CheckboxItemRef, CheckboxItemProps>(
306
+ // ({ render, checked, onCheckedChange, textValue, disabled = false, closeOnPress = true, onPress: onPressProp, onKeyDown: onKeyDownProp, ...props }, ref) => {
307
+ // const { close } = useDropdownMenuContentContext();
308
+
309
+ // function onKeyDown(ev: React.KeyboardEvent) {
310
+ // onKeyDownProp?.(ev);
311
+ // if (ev.key === "Enter" || ev.key === " ") {
312
+ // onPressProp?.(EmptyGestureResponderEvent);
313
+ // onCheckedChange?.(!checked);
314
+ // if (closeOnPress) {
315
+ // close();
316
+ // }
317
+ // }
318
+ // }
319
+
320
+ // function onPress(ev: GestureResponderEvent) {
321
+ // onPressProp?.(ev);
322
+ // onCheckedChange?.(!checked);
323
+ // if (closeOnPress) {
324
+ // close();
325
+ // }
326
+ // }
327
+ //
328
+ // return (
329
+ // <DropdownMenu.CheckboxItem
330
+ // textValue={textValue}
331
+ // checked={checked}
332
+ // onCheckedChange={onCheckedChange}
333
+ // onSelect={closeOnPress ? undefined : onSelected}
334
+ // disabled={disabled ?? undefined}
335
+ // render
336
+ // >
337
+ // <Component
338
+ // ref={ref}
339
+ // // @ts-expect-error web only
340
+ // onKeyDown={onKeyDown}
341
+ // onPress={onPress}
342
+ // role="button"
343
+ // {...props}
344
+ // />
345
+ // </DropdownMenu.CheckboxItem>
346
+ // );
347
+ // },
348
+ // );
349
+
350
+ // CheckboxItem.displayName = "CheckboxItemWebDropdownMenu";
351
+
352
+ // const DropdownMenuRadioGroupContext = React.createContext<{
353
+ // value?: string;
354
+ // onValueChange?: (value: string) => void;
355
+ // } | null>(null);
356
+
357
+ // const RadioGroup = React.forwardRef<RadioGroupRef, RadioGroupProps>(({ value, onValueChange, ...props }, ref) => {
358
+ //
359
+ // return (
360
+ // <DropdownMenuRadioGroupContext.Provider value={{ value, onValueChange }}>
361
+ // <DropdownMenu.RadioGroup
362
+ // value={value}
363
+ // onValueChange={onValueChange}
364
+ // render
365
+ // >
366
+ // <Component
367
+ // ref={ref}
368
+ // {...props}
369
+ // />
370
+ // </DropdownMenu.RadioGroup>
371
+ // </DropdownMenuRadioGroupContext.Provider>
372
+ // );
373
+ // });
374
+
375
+ // RadioGroup.displayName = "RadioGroupWebDropdownMenu";
376
+
377
+ // function useDropdownMenuRadioGroupContext() {
378
+ // const context = React.useContext(DropdownMenuRadioGroupContext);
379
+ // if (!context) {
380
+ // throw new Error("DropdownMenuRadioGroup compound components cannot be rendered outside the DropdownMenuRadioGroup component");
381
+ // }
382
+ // return context;
383
+ // }
384
+
385
+ // const RadioItem = React.forwardRef<RadioItemRef, RadioItemProps>(
386
+ // ({ render, value, textValue, closeOnPress = true, onPress: onPressProp, onKeyDown: onKeyDownProp, ...props }, ref) => {
387
+ // const { onValueChange } = useDropdownMenuRadioGroupContext();
388
+ // const { close } = useDropdownMenuContentContext();
389
+
390
+ // function onKeyDown(ev: React.KeyboardEvent) {
391
+ // onKeyDownProp?.(ev);
392
+ // if (ev.key === "Enter" || ev.key === " ") {
393
+ // onValueChange?.(value);
394
+ // onPressProp?.(EmptyGestureResponderEvent);
395
+ // if (closeOnPress) {
396
+ // close();
397
+ // }
398
+ // }
399
+ // }
400
+
401
+ // function onPress(ev: GestureResponderEvent) {
402
+ // onValueChange?.(value);
403
+ // onPressProp?.(ev);
404
+ // if (closeOnPress) {
405
+ // close();
406
+ // }
407
+ // }
408
+ //
409
+ // return (
410
+ // <DropdownMenu.RadioItem
411
+ // value={value}
412
+ // textValue={textValue}
413
+ // disabled={props.disabled ?? undefined}
414
+ // onSelect={closeOnPress ? undefined : onSelected}
415
+ // render
416
+ // >
417
+ // <Component
418
+ // ref={ref}
419
+ // // @ts-expect-error web only
420
+ // onKeyDown={onKeyDown}
421
+ // onPress={onPress}
422
+ // {...props}
423
+ // />
424
+ // </DropdownMenu.RadioItem>
425
+ // );
426
+ // },
427
+ // );
428
+
429
+ // RadioItem.displayName = "RadioItemWebDropdownMenu";
430
+
431
+ // const ItemIndicator = React.forwardRef<ItemIndicatorRef, ItemIndicatorProps>(({ keepMounted, ...props }, ref) => {
432
+ //
433
+ // return (
434
+ // <DropdownMenu.ItemIndicator
435
+ // keepMounted={keepMounted}
436
+ // render
437
+ // >
438
+ // <Component
439
+ // ref={ref}
440
+ // {...props}
441
+ // />
442
+ // </DropdownMenu.ItemIndicator>
443
+ // );
444
+ // });
445
+
446
+ // ItemIndicator.displayName = "ItemIndicatorWebDropdownMenu";
447
+
448
+ // const Separator = React.forwardRef<SeparatorRef, SeparatorProps>(({ decorative, ...props }, ref) => {
449
+ //
450
+ // return (
451
+ // <DropdownMenu.Separator render>
452
+ // <Component
453
+ // ref={ref}
454
+ // {...props}
455
+ // />
456
+ // </DropdownMenu.Separator>
457
+ // );
458
+ // });
459
+
460
+ // Separator.displayName = "SeparatorWebDropdownMenu";
461
+
462
+ // const DropdownMenuSubContext = React.createContext<{
463
+ // open: boolean;
464
+ // onOpenChange: (open: boolean) => void;
465
+ // } | null>(null);
466
+
467
+ // const Sub = React.forwardRef<SubRef, SubProps>(({ defaultOpen, open: openProp, onOpenChange: onOpenChangeProp, ...props }, ref) => {
468
+ // const [open = false, onOpenChange] = useControllableState({
469
+ // prop: openProp,
470
+ // defaultProp: defaultOpen,
471
+ // onChange: onOpenChangeProp,
472
+ // });
473
+
474
+ //
475
+ // return (
476
+ // <DropdownMenuSubContext.Provider value={{ open, onOpenChange }}>
477
+ // <DropdownMenu.Sub
478
+ // open={open}
479
+ // onOpenChange={onOpenChange}
480
+ // >
481
+ // <Component
482
+ // ref={ref}
483
+ // {...props}
484
+ // />
485
+ // </DropdownMenu.Sub>
486
+ // </DropdownMenuSubContext.Provider>
487
+ // );
488
+ // });
489
+
490
+ // Sub.displayName = "SubWebDropdownMenu";
491
+
492
+ // function useSubContext() {
493
+ // const context = React.useContext(DropdownMenuSubContext);
494
+ // if (!context) {
495
+ // throw new Error("DropdownMenu compound components cannot be rendered outside the DropdownMenu component");
496
+ // }
497
+ // return context;
498
+ // }
499
+
500
+ // const SubTrigger = React.forwardRef<SubTriggerRef, SubTriggerProps>(({ textValue, disabled = false, onPress: onPressProp, ...props }, ref) => {
501
+ // const { onOpenChange } = useSubContext();
502
+
503
+ // function onPress(ev: GestureResponderEvent) {
504
+ // onOpenChange(true);
505
+ // onPressProp?.(ev);
506
+ // }
507
+
508
+ //
509
+ // return (
510
+ // <DropdownMenu.SubTrigger
511
+ // disabled={disabled ?? undefined}
512
+ // textValue={textValue}
513
+ // render
514
+ // >
515
+ // <Component
516
+ // ref={ref}
517
+ // onPress={onPress}
518
+ // {...props}
519
+ // />
520
+ // </DropdownMenu.SubTrigger>
521
+ // );
522
+ // });
523
+
524
+ // SubTrigger.displayName = "SubTriggerWebDropdownMenu";
525
+
526
+ // const SubContent = React.forwardRef<SubContentRef, SubContentProps>(({ render = false, keepMounted, ...props }, ref) => {
527
+ //
528
+ // return (
529
+ // <DropdownMenu.Portal>
530
+ // <DropdownMenu.SubContent keepMounted={keepMounted}>
531
+ // <Component
532
+ // ref={ref}
533
+ // {...props}
534
+ // />
535
+ // </DropdownMenu.SubContent>
536
+ // </DropdownMenu.Portal>
537
+ // );
538
+ // });
539
+
540
+ // Content.displayName = "ContentWebDropdownMenu";
541
+
542
+ // export {
543
+ // CheckboxItem,
544
+ // Content,
545
+ // Group,
546
+ // Item,
547
+ // ItemIndicator,
548
+ // Label,
549
+ // Backdrop,
550
+ // Portal,
551
+ // RadioGroup,
552
+ // RadioItem,
553
+ // Root,
554
+ // Separator,
555
+ // Sub,
556
+ // SubContent,
557
+ // SubTrigger,
558
+ // Trigger,
559
+ // useRootContext,
560
+ // useSubContext,
561
+ // };
562
+
563
+ // function onSelected(ev: Event) {
564
+ // ev.preventDefault();
565
+ // }
@@ -0,0 +1,2 @@
1
+ export * from "./dropdown-menu";
2
+ export * from "./types";
@@ -0,0 +1,121 @@
1
+ import type { KeepMountable, PositionedContentProps, PressableRef, RenderPressableProps, RenderTextProps, RenderViewProps, TextRef, ViewRef } from "../types";
2
+
3
+ type RootProps = RenderViewProps & {
4
+ onOpenChange?: (open: boolean) => void;
5
+ };
6
+
7
+ interface PortalProps extends KeepMountable {
8
+ children: React.ReactNode;
9
+
10
+ /**
11
+ * @platform: NATIVE ONLY
12
+ */
13
+ hostName?: string;
14
+
15
+ /**
16
+ * @platform: WEB ONLY
17
+ */
18
+ container?: HTMLElement | null | undefined;
19
+ }
20
+
21
+ type BackdropProps = KeepMountable &
22
+ RenderPressableProps & {
23
+ closeOnPress?: boolean;
24
+ };
25
+
26
+ type ItemProps = RenderPressableProps & {
27
+ textValue?: string;
28
+ closeOnPress?: boolean;
29
+ };
30
+
31
+ type CheckboxItemProps = RenderPressableProps & {
32
+ checked: boolean;
33
+ onCheckedChange: (checked: boolean) => void;
34
+ closeOnPress?: boolean;
35
+ textValue?: string;
36
+ };
37
+
38
+ type RadioGroupProps = RenderViewProps & {
39
+ value: string | undefined;
40
+ onValueChange: (value: string) => void;
41
+ };
42
+
43
+ type RadioItemProps = RenderPressableProps & {
44
+ value: string;
45
+ textValue?: string;
46
+ closeOnPress?: boolean;
47
+ };
48
+
49
+ type SeparatorProps = RenderViewProps & {
50
+ decorative?: boolean;
51
+ };
52
+
53
+ type SubProps = RenderViewProps & {
54
+ defaultOpen?: boolean;
55
+ open?: boolean;
56
+ onOpenChange?: (value: boolean) => void;
57
+ };
58
+
59
+ type SubTriggerProps = RenderPressableProps & {
60
+ textValue?: string;
61
+ };
62
+
63
+ type TriggerProps = RenderPressableProps;
64
+ type ContentProps = RenderPressableProps & PositionedContentProps;
65
+ type SubContentProps = RenderPressableProps & KeepMountable;
66
+ type ItemIndicatorProps = RenderViewProps & KeepMountable;
67
+ type GroupProps = RenderViewProps;
68
+ type LabelProps = RenderTextProps;
69
+
70
+ type CheckboxItemRef = PressableRef;
71
+ type ContentRef = ViewRef;
72
+ type GroupRef = ViewRef;
73
+ type ItemIndicatorRef = ViewRef;
74
+ type ItemRef = PressableRef;
75
+ type LabelRef = TextRef;
76
+ type BackdropRef = PressableRef;
77
+ type RadioGroupRef = ViewRef;
78
+ type RadioItemRef = PressableRef;
79
+ type RootRef = ViewRef;
80
+ type SeparatorRef = ViewRef;
81
+ type SubContentRef = PressableRef;
82
+ type SubRef = ViewRef;
83
+ type SubTriggerRef = PressableRef;
84
+ type TriggerRef = PressableRef & {
85
+ open: () => void;
86
+ close: () => void;
87
+ };
88
+
89
+ export type {
90
+ CheckboxItemProps,
91
+ CheckboxItemRef,
92
+ ContentProps,
93
+ ContentRef,
94
+ GroupProps,
95
+ GroupRef,
96
+ ItemIndicatorProps,
97
+ ItemIndicatorRef,
98
+ ItemProps,
99
+ ItemRef,
100
+ LabelProps,
101
+ LabelRef,
102
+ BackdropProps,
103
+ BackdropRef,
104
+ PortalProps,
105
+ RadioGroupProps,
106
+ RadioGroupRef,
107
+ RadioItemProps,
108
+ RadioItemRef,
109
+ RootProps,
110
+ RootRef,
111
+ SeparatorProps,
112
+ SeparatorRef,
113
+ SubContentProps,
114
+ SubContentRef,
115
+ SubProps,
116
+ SubRef,
117
+ SubTriggerProps,
118
+ SubTriggerRef,
119
+ TriggerProps,
120
+ TriggerRef,
121
+ };
@@ -0,0 +1,4 @@
1
+ export { useAugmentedRef } from "./use-augmented-ref";
2
+ export { useRelativePosition, type LayoutPosition } from "./use-relative-position";
3
+ export { useControllableState } from "./use-controllable-state";
4
+ export { useIsomorphicLayoutEffect } from "./use-Isomorphic-layout-effect";
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { Platform } from "react-native";
3
+
4
+ function useIsomorphicLayoutEffect(effect: React.EffectCallback, dependencies?: React.DependencyList) {
5
+ if (Platform.OS === "web" && typeof window === "undefined") {
6
+ React.useEffect(effect, dependencies);
7
+ } else {
8
+ React.useLayoutEffect(effect, dependencies);
9
+ }
10
+ }
11
+
12
+ export { useIsomorphicLayoutEffect };