@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,238 @@
1
+ import * as React from "react";
2
+ import { BackHandler, Pressable, Text, View, type GestureResponderEvent } from "react-native";
3
+
4
+ import { useControllableState } from "../hooks";
5
+ import { Portal as RNPPortal } from "../portal";
6
+ import * as Slot from "../slot";
7
+
8
+ import type {
9
+ ActionProps,
10
+ ActionRef,
11
+ CancelProps,
12
+ CancelRef,
13
+ ContentProps,
14
+ ContentRef,
15
+ DescriptionProps,
16
+ DescriptionRef,
17
+ BackdropProps,
18
+ BackdropRef,
19
+ PortalProps,
20
+ RootContext,
21
+ RootProps,
22
+ RootRef,
23
+ TitleProps,
24
+ TitleRef,
25
+ TriggerProps,
26
+ TriggerRef,
27
+ } from "./types";
28
+
29
+ const AlertDialogContext = React.createContext<(RootContext & { nativeID: string }) | null>(null);
30
+
31
+ const Root = React.forwardRef<RootRef, RootProps>(({ open: openProp, defaultOpen, onOpenChange: onOpenChangeProp, ...viewProps }, ref) => {
32
+ const nativeID = React.useId();
33
+ const [open = false, onOpenChange] = useControllableState({
34
+ prop: openProp,
35
+ defaultProp: defaultOpen,
36
+ onChange: onOpenChangeProp,
37
+ });
38
+
39
+ return (
40
+ <AlertDialogContext.Provider
41
+ value={{
42
+ open,
43
+ onOpenChange,
44
+ nativeID,
45
+ }}
46
+ >
47
+ <Slot.View
48
+ ref={ref}
49
+ {...viewProps}
50
+ />
51
+ </AlertDialogContext.Provider>
52
+ );
53
+ });
54
+
55
+ Root.displayName = "RootNativeAlertDialog";
56
+
57
+ function useRootContext() {
58
+ const context = React.useContext(AlertDialogContext);
59
+ if (!context) {
60
+ throw new Error("AlertDialog compound components cannot be rendered outside the AlertDialog component");
61
+ }
62
+ return context;
63
+ }
64
+
65
+ const Trigger = React.forwardRef<TriggerRef, TriggerProps>(({ onPress: onPressProp, disabled = false, ...props }, ref) => {
66
+ const { open: value, onOpenChange } = useRootContext();
67
+
68
+ function onPress(ev: GestureResponderEvent) {
69
+ onOpenChange(!value);
70
+ onPressProp?.(ev);
71
+ }
72
+
73
+ return (
74
+ <Slot.Pressable
75
+ ref={ref}
76
+ aria-disabled={disabled ?? undefined}
77
+ role="button"
78
+ onPress={onPress}
79
+ disabled={disabled ?? undefined}
80
+ {...props}
81
+ />
82
+ );
83
+ });
84
+
85
+ Trigger.displayName = "TriggerNativeAlertDialog";
86
+
87
+ /**
88
+ * @warning when using a custom `<PortalHost />`, you might have to adjust the Content's sideOffset to account for nav elements like headers.
89
+ */
90
+ function Portal({ keepMounted, hostName, children }: PortalProps) {
91
+ const value = useRootContext();
92
+
93
+ if (!keepMounted) {
94
+ if (!value.open) {
95
+ return null;
96
+ }
97
+ }
98
+
99
+ return (
100
+ <RNPPortal
101
+ hostName={hostName}
102
+ name={`${value.nativeID}_portal`}
103
+ >
104
+ <AlertDialogContext.Provider value={value}>{children}</AlertDialogContext.Provider>
105
+ </RNPPortal>
106
+ );
107
+ }
108
+
109
+ const Backdrop = React.forwardRef<BackdropRef, BackdropProps>(({ keepMounted, ...props }, ref) => {
110
+ const { open: value } = useRootContext();
111
+
112
+ if (!keepMounted) {
113
+ if (!value) {
114
+ return null;
115
+ }
116
+ }
117
+
118
+ return (
119
+ <Slot.View
120
+ ref={ref}
121
+ {...props}
122
+ />
123
+ );
124
+ });
125
+
126
+ Backdrop.displayName = "BackdropNativeAlertDialog";
127
+
128
+ const Content = React.forwardRef<ContentRef, ContentProps>(({ keepMounted, ...props }, ref) => {
129
+ const { open: value, nativeID, onOpenChange } = useRootContext();
130
+
131
+ React.useEffect(() => {
132
+ const backHandler = BackHandler.addEventListener("hardwareBackPress", () => {
133
+ onOpenChange(false);
134
+ return true;
135
+ });
136
+
137
+ return () => {
138
+ backHandler.remove();
139
+ };
140
+ }, []);
141
+
142
+ if (!keepMounted) {
143
+ if (!value) {
144
+ return null;
145
+ }
146
+ }
147
+
148
+ return (
149
+ <Slot.View
150
+ ref={ref}
151
+ role="alertdialog"
152
+ nativeID={nativeID}
153
+ aria-labelledby={`${nativeID}_label`}
154
+ aria-describedby={`${nativeID}_desc`}
155
+ aria-modal={true}
156
+ {...props}
157
+ />
158
+ );
159
+ });
160
+
161
+ Content.displayName = "ContentNativeAlertDialog";
162
+
163
+ const Cancel = React.forwardRef<CancelRef, CancelProps>(({ onPress: onPressProp, disabled = false, ...props }, ref) => {
164
+ const { onOpenChange } = useRootContext();
165
+
166
+ function onPress(ev: GestureResponderEvent) {
167
+ if (disabled) return;
168
+ onOpenChange(false);
169
+ onPressProp?.(ev);
170
+ }
171
+
172
+ return (
173
+ <Slot.Pressable
174
+ ref={ref}
175
+ aria-disabled={disabled ?? undefined}
176
+ role="button"
177
+ onPress={onPress}
178
+ disabled={disabled ?? undefined}
179
+ {...props}
180
+ />
181
+ );
182
+ });
183
+
184
+ Cancel.displayName = "CloseNativeAlertDialog";
185
+
186
+ const Action = React.forwardRef<ActionRef, ActionProps>(({ onPress: onPressProp, disabled = false, ...props }, ref) => {
187
+ const { onOpenChange } = useRootContext();
188
+
189
+ function onPress(ev: GestureResponderEvent) {
190
+ if (disabled) return;
191
+ onOpenChange(false);
192
+ onPressProp?.(ev);
193
+ }
194
+
195
+ return (
196
+ <Slot.Pressable
197
+ ref={ref}
198
+ aria-disabled={disabled ?? undefined}
199
+ role="button"
200
+ onPress={onPress}
201
+ disabled={disabled ?? undefined}
202
+ {...props}
203
+ />
204
+ );
205
+ });
206
+
207
+ Action.displayName = "ActionNativeAlertDialog";
208
+
209
+ const Title = React.forwardRef<TitleRef, TitleProps>(({ ...props }, ref) => {
210
+ const { nativeID } = useRootContext();
211
+
212
+ return (
213
+ <Slot.Text
214
+ ref={ref}
215
+ role="heading"
216
+ nativeID={`${nativeID}_label`}
217
+ {...props}
218
+ />
219
+ );
220
+ });
221
+
222
+ Title.displayName = "TitleNativeAlertDialog";
223
+
224
+ const Description = React.forwardRef<DescriptionRef, DescriptionProps>(({ ...props }, ref) => {
225
+ const { nativeID } = useRootContext();
226
+
227
+ return (
228
+ <Slot.Text
229
+ ref={ref}
230
+ nativeID={`${nativeID}_desc`}
231
+ {...props}
232
+ />
233
+ );
234
+ });
235
+
236
+ Description.displayName = "DescriptionNativeAlertDialog";
237
+
238
+ export { Action, Cancel, Content, Description, Backdrop, Portal, Root, Title, Trigger, useRootContext };
@@ -0,0 +1,260 @@
1
+ // import { useAugmentedRef, useControllableState, useIsomorphicLayoutEffect } from "../hooks";
2
+ // import * as Slot from "../slot";
3
+ // import * as AlertDialog from "@radix-ui/react-alert-dialog";
4
+ // import * as React from "react";
5
+ // import { Pressable, Text, View, type GestureResponderEvent } from "react-native";
6
+
7
+ // import type {
8
+ // ActionProps,
9
+ // ActionRef,
10
+ // CancelProps,
11
+ // CancelRef,
12
+ // ContentProps,
13
+ // ContentRef,
14
+ // DescriptionProps,
15
+ // DescriptionRef,
16
+ // BackdropProps,
17
+ // BackdropRef,
18
+ // PortalProps,
19
+ // RootContext,
20
+ // RootProps,
21
+ // RootRef,
22
+ // TitleProps,
23
+ // TitleRef,
24
+ // TriggerProps,
25
+ // TriggerRef,
26
+ // } from "./types";
27
+
28
+ // const AlertDialogContext = React.createContext<RootContext | null>(null);
29
+
30
+ // const Root = React.forwardRef<RootRef, RootProps>(({ open: openProp, defaultOpen, onOpenChange: onOpenChangeProp, ...viewProps }, ref) => {
31
+ // const [open = false, onOpenChange] = useControllableState({
32
+ // prop: openProp,
33
+ // defaultProp: defaultOpen,
34
+ // onChange: onOpenChangeProp,
35
+ // });
36
+ //
37
+ // return (
38
+ // <AlertDialogContext.Provider value={{ open, onOpenChange }}>
39
+ // <AlertDialog.Root
40
+ // open={open}
41
+ // defaultOpen={defaultOpen}
42
+ // onOpenChange={onOpenChange}
43
+ // >
44
+ // <Component
45
+ // ref={ref}
46
+ // {...viewProps}
47
+ // />
48
+ // </AlertDialog.Root>
49
+ // </AlertDialogContext.Provider>
50
+ // );
51
+ // });
52
+
53
+ // Root.displayName = "RootAlertWebDialog";
54
+
55
+ // function useRootContext() {
56
+ // const context = React.useContext(AlertDialogContext);
57
+ // if (!context) {
58
+ // throw new Error("AlertDialog compound components cannot be rendered outside the AlertDialog component");
59
+ // }
60
+ // return context;
61
+ // }
62
+
63
+ // const Trigger = React.forwardRef<TriggerRef, TriggerProps>(({ onPress: onPressProp, role: _role, disabled, ...props }, ref) => {
64
+ // const augmentedRef = useAugmentedRef({ ref });
65
+ // const { onOpenChange, open } = useRootContext();
66
+ // function onPress(ev: GestureResponderEvent) {
67
+ // if (onPressProp) {
68
+ // onPressProp(ev);
69
+ // }
70
+ // onOpenChange(!open);
71
+ // }
72
+
73
+ // useIsomorphicLayoutEffect(() => {
74
+ // if (augmentedRef.current) {
75
+ // const augRef = augmentedRef.current as unknown as HTMLButtonElement;
76
+ // augRef.dataset.state = open ? "open" : "closed";
77
+ // augRef.type = "button";
78
+ // }
79
+ // }, [open]);
80
+
81
+ //
82
+ // return (
83
+ // <AlertDialog.Trigger
84
+ // disabled={disabled ?? undefined}
85
+ // render
86
+ // >
87
+ // <Component
88
+ // ref={augmentedRef}
89
+ // onPress={onPress}
90
+ // role="button"
91
+ // disabled={disabled}
92
+ // {...props}
93
+ // />
94
+ // </AlertDialog.Trigger>
95
+ // );
96
+ // });
97
+
98
+ // Trigger.displayName = "TriggerAlertWebDialog";
99
+
100
+ // function Portal({ keepMounted, container, children }: PortalProps) {
101
+ // return (
102
+ // <AlertDialog.Portal
103
+ // keepMounted={keepMounted}
104
+ // children={children}
105
+ // container={container}
106
+ // />
107
+ // );
108
+ // }
109
+
110
+ // const Backdrop = React.forwardRef<BackdropRef, BackdropProps>(({ keepMounted, ...props }, ref) => {
111
+ //
112
+ // return (
113
+ // <AlertDialog.Backdrop keepMounted={keepMounted}>
114
+ // <Component
115
+ // ref={ref}
116
+ // {...props}
117
+ // />
118
+ // </AlertDialog.Backdrop>
119
+ // );
120
+ // });
121
+
122
+ // Backdrop.displayName = "BackdropAlertWebDialog";
123
+
124
+ // const Content = React.forwardRef<ContentRef, ContentProps>(({ keepMounted, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, ...props }, ref) => {
125
+ // const augmentedRef = useAugmentedRef({ ref });
126
+ // const { open } = useRootContext();
127
+
128
+ // useIsomorphicLayoutEffect(() => {
129
+ // if (augmentedRef.current) {
130
+ // const augRef = augmentedRef.current as unknown as HTMLDivElement;
131
+ // augRef.dataset.state = open ? "open" : "closed";
132
+ // }
133
+ // }, [open]);
134
+
135
+ //
136
+ // return (
137
+ // <AlertDialog.Content
138
+ // onOpenAutoFocus={onOpenAutoFocus}
139
+ // onCloseAutoFocus={onCloseAutoFocus}
140
+ // onEscapeKeyDown={onEscapeKeyDown}
141
+ // keepMounted={keepMounted}
142
+ // render
143
+ // >
144
+ // <Component
145
+ // ref={augmentedRef}
146
+ // {...props}
147
+ // />
148
+ // </AlertDialog.Content>
149
+ // );
150
+ // });
151
+
152
+ // Content.displayName = "ContentAlertWebDialog";
153
+
154
+ // const Cancel = React.forwardRef<CancelRef, CancelProps>(({ onPress: onPressProp, disabled, ...props }, ref) => {
155
+ // const augmentedRef = useAugmentedRef({ ref });
156
+ // const { onOpenChange, open } = useRootContext();
157
+
158
+ // function onPress(ev: GestureResponderEvent) {
159
+ // if (onPressProp) {
160
+ // onPressProp(ev);
161
+ // }
162
+ // onOpenChange(!open);
163
+ // }
164
+
165
+ // useIsomorphicLayoutEffect(() => {
166
+ // if (augmentedRef.current) {
167
+ // const augRef = augmentedRef.current as unknown as HTMLButtonElement;
168
+ // augRef.type = "button";
169
+ // }
170
+ // }, []);
171
+
172
+ //
173
+ // return (
174
+ // <>
175
+ // <AlertDialog.Cancel
176
+ // disabled={disabled ?? undefined}
177
+ // render
178
+ // >
179
+ // <Component
180
+ // ref={augmentedRef}
181
+ // onPress={onPress}
182
+ // role="button"
183
+ // disabled={disabled}
184
+ // {...props}
185
+ // />
186
+ // </AlertDialog.Cancel>
187
+ // </>
188
+ // );
189
+ // });
190
+
191
+ // Cancel.displayName = "CancelAlertWebDialog";
192
+
193
+ // const Action = React.forwardRef<ActionRef, ActionProps>(({ onPress: onPressProp, disabled, ...props }, ref) => {
194
+ // const augmentedRef = useAugmentedRef({ ref });
195
+ // const { onOpenChange, open } = useRootContext();
196
+
197
+ // function onPress(ev: GestureResponderEvent) {
198
+ // if (onPressProp) {
199
+ // onPressProp(ev);
200
+ // }
201
+ // onOpenChange(!open);
202
+ // }
203
+
204
+ // useIsomorphicLayoutEffect(() => {
205
+ // if (augmentedRef.current) {
206
+ // const augRef = augmentedRef.current as unknown as HTMLButtonElement;
207
+ // augRef.type = "button";
208
+ // }
209
+ // }, []);
210
+
211
+ //
212
+ // return (
213
+ // <>
214
+ // <AlertDialog.Action
215
+ // disabled={disabled ?? undefined}
216
+ // render
217
+ // >
218
+ // <Component
219
+ // ref={augmentedRef}
220
+ // onPress={onPress}
221
+ // role="button"
222
+ // disabled={disabled}
223
+ // {...props}
224
+ // />
225
+ // </AlertDialog.Action>
226
+ // </>
227
+ // );
228
+ // });
229
+
230
+ // Action.displayName = "ActionAlertWebDialog";
231
+
232
+ // const Title = React.forwardRef<TitleRef, TitleProps>(({ ...props }, ref) => {
233
+ //
234
+ // return (
235
+ // <AlertDialog.Title render>
236
+ // <Component
237
+ // ref={ref}
238
+ // {...props}
239
+ // />
240
+ // </AlertDialog.Title>
241
+ // );
242
+ // });
243
+
244
+ // Title.displayName = "TitleAlertWebDialog";
245
+
246
+ // const Description = React.forwardRef<DescriptionRef, DescriptionProps>(({ ...props }, ref) => {
247
+ //
248
+ // return (
249
+ // <AlertDialog.Description render>
250
+ // <Component
251
+ // ref={ref}
252
+ // {...props}
253
+ // />
254
+ // </AlertDialog.Description>
255
+ // );
256
+ // });
257
+
258
+ // Description.displayName = "DescriptionAlertWebDialog";
259
+
260
+ // export { Action, Cancel, Content, Description, Backdrop, Portal, Root, Title, Trigger, useRootContext };
@@ -0,0 +1,2 @@
1
+ export * from "./alert-dialog";
2
+ export * from "./types";
@@ -0,0 +1,81 @@
1
+ import type { KeepMountable, PressableRef, RenderPressableProps, RenderTextProps, RenderViewProps, TextRef, ViewRef } from "../types";
2
+
3
+ type RootProps = {
4
+ open?: boolean;
5
+ onOpenChange?: (value: boolean) => void;
6
+ defaultOpen?: boolean;
7
+ } & RenderViewProps;
8
+
9
+ interface RootContext {
10
+ open: boolean;
11
+ onOpenChange: (value: boolean) => void;
12
+ }
13
+
14
+ interface PortalProps extends KeepMountable {
15
+ children: React.ReactNode;
16
+
17
+ /**
18
+ * @platform: NATIVE ONLY
19
+ */
20
+ hostName?: string;
21
+
22
+ /**
23
+ * @platform: WEB ONLY
24
+ */
25
+ container?: HTMLElement | null | undefined;
26
+ }
27
+ type BackdropProps = KeepMountable & RenderViewProps;
28
+
29
+ type ContentProps = KeepMountable &
30
+ RenderViewProps & {
31
+ /**
32
+ * @platform: WEB ONLY
33
+ */
34
+ onOpenAutoFocus?: (ev: Event) => void;
35
+
36
+ /**
37
+ * @platform: WEB ONLY
38
+ */
39
+ onCloseAutoFocus?: (ev: Event) => void;
40
+
41
+ /**
42
+ * @platform: WEB ONLY
43
+ */
44
+ onEscapeKeyDown?: (ev: Event) => void;
45
+ };
46
+
47
+ type TriggerProps = RenderPressableProps;
48
+ type CancelProps = RenderPressableProps;
49
+ type ActionProps = RenderPressableProps;
50
+ type TitleProps = RenderTextProps;
51
+ type DescriptionProps = RenderTextProps;
52
+
53
+ type ActionRef = PressableRef;
54
+ type CancelRef = PressableRef;
55
+ type ContentRef = ViewRef;
56
+ type DescriptionRef = TextRef;
57
+ type BackdropRef = ViewRef;
58
+ type RootRef = ViewRef;
59
+ type TitleRef = TextRef;
60
+ type TriggerRef = PressableRef;
61
+
62
+ export type {
63
+ ActionProps,
64
+ ActionRef,
65
+ CancelProps,
66
+ CancelRef,
67
+ ContentProps,
68
+ ContentRef,
69
+ DescriptionProps,
70
+ DescriptionRef,
71
+ BackdropProps,
72
+ BackdropRef,
73
+ PortalProps,
74
+ RootContext,
75
+ RootProps,
76
+ RootRef,
77
+ TitleProps,
78
+ TitleRef,
79
+ TriggerProps,
80
+ TriggerRef,
81
+ };
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ import { View, type ViewStyle } from "react-native";
3
+
4
+ import * as Slot from "../slot";
5
+ import type { RenderViewProps, ViewRef } from "../types";
6
+
7
+ type RootProps = Omit<RenderViewProps, "style"> & {
8
+ ratio?: number;
9
+ style?: ViewStyle;
10
+ };
11
+
12
+ type RootRef = ViewRef;
13
+
14
+ const Root = React.forwardRef<RootRef, RootProps>(({ ratio = 1, style, ...props }, ref) => {
15
+ return (
16
+ <Component
17
+ ref={ref}
18
+ style={[style, { aspectRatio: ratio }]}
19
+ {...props}
20
+ />
21
+ );
22
+ });
23
+
24
+ Root.displayName = "RootAspectRatio";
25
+
26
+ export { Root };
27
+ export type { RootProps, RootRef };
@@ -0,0 +1 @@
1
+ export * from "./aspect-ratio";