@brand-map/primitives 0.0.0-broken.0 → 0.0.0-broken.2
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/package.json +2 -9
- package/src/accordion/accordion.tsx +17 -17
- package/src/accordion/accordion.web.tsx +13 -13
- package/src/alert-dialog/alert-dialog.tsx +28 -28
- package/src/alert-dialog/alert-dialog.web.tsx +18 -18
- package/src/alert-dialog/types.ts +3 -3
- package/src/aspect-ratio/aspect-ratio.tsx +3 -3
- package/src/avatar/avatar.tsx +10 -10
- package/src/avatar/types.ts +2 -2
- package/src/checkbox/checkbox.tsx +9 -9
- package/src/checkbox/checkbox.web.tsx +8 -8
- package/src/collapsible/collapsible.tsx +33 -35
- package/src/collapsible/collapsible.web.tsx +9 -9
- package/src/context-menu/context-menu.tsx +45 -45
- package/src/context-menu/context-menu.web.tsx +44 -44
- package/src/dialog/dialog.tsx +11 -11
- package/src/dialog/dialog.web.tsx +15 -15
- package/src/dialog/types.ts +5 -5
- package/src/dropdown-menu/dropdown-menu.tsx +43 -43
- package/src/dropdown-menu/dropdown-menu.web.tsx +45 -45
- package/src/hooks/use-Isomorphic-layout-effect.tsx +1 -2
- package/src/hooks/use-relative-position.tsx +2 -2
- package/src/hover-card/hover-card.tsx +40 -42
- package/src/hover-card/hover-card.web.tsx +9 -9
- package/src/label/label.tsx +3 -4
- package/src/label/label.web.tsx +5 -5
- package/src/menubar/menubar.tsx +45 -45
- package/src/menubar/menubar.web.tsx +47 -47
- package/src/navigation-menu/navigation-menu.tsx +23 -23
- package/src/navigation-menu/navigation-menu.web.tsx +26 -26
- package/src/popover/popover.tsx +20 -20
- package/src/popover/popover.web.tsx +14 -14
- package/src/progress/progress.tsx +4 -4
- package/src/progress/progress.web.tsx +5 -5
- package/src/radio-group/radio-group.tsx +11 -11
- package/src/radio-group/radio-group.web.tsx +9 -9
- package/src/render/index.ts +1 -0
- package/src/{slot/slot.tsx → render/render.tsx} +26 -27
- package/src/select/select.tsx +28 -28
- package/src/select/select.web.tsx +22 -22
- package/src/separator/separator.tsx +3 -3
- package/src/slider/slider.tsx +8 -8
- package/src/slider/slider.web.tsx +6 -6
- package/src/switch/switch.context.ts +16 -0
- package/src/switch/switch.tsx +68 -38
- package/src/switch/switch.web.tsx +9 -9
- package/src/switch/types.ts +27 -6
- package/src/table/table.tsx +9 -9
- package/src/tabs/tabs.tsx +13 -13
- package/src/tabs/tabs.web.tsx +10 -10
- package/src/toast/toast.tsx +14 -14
- package/src/toggle/toggle.tsx +5 -5
- package/src/toggle/toggle.web.tsx +5 -5
- package/src/toggle-group/toggle-group.tsx +11 -11
- package/src/toggle-group/toggle-group.web.tsx +10 -10
- package/src/toolbar/toolbar.tsx +12 -12
- package/src/toolbar/toolbar.web.tsx +12 -12
- package/src/tooltip/tooltip.tsx +17 -17
- package/src/tooltip/tooltip.web.tsx +11 -11
- package/src/types/index.ts +5 -15
- package/tsconfig.json +1 -0
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.oxfmtrc.json +0 -35
- package/.oxlintrc.json +0 -166
- package/README.md +0 -78
- package/bun.lock +0 -904
- package/mise.toml +0 -3
- package/src/slot/index.ts +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// import * as ContextMenu from "@radix-ui/react-context-menu";
|
|
2
|
-
//
|
|
2
|
+
//
|
|
3
3
|
// import { GestureResponderEvent, Pressable, Text, View } from "react-native";
|
|
4
4
|
|
|
5
5
|
// import { useAugmentedRef, useControllableState, useIsomorphicLayoutEffect } from "../hooks";
|
|
6
|
-
// import * as
|
|
6
|
+
// import * as Render from "../render";
|
|
7
7
|
// import { EmptyGestureResponderEvent } from "../utils";
|
|
8
8
|
|
|
9
9
|
// import type {
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
// TriggerRef,
|
|
41
41
|
// } from "./types";
|
|
42
42
|
|
|
43
|
-
// const ContextMenuContext =
|
|
43
|
+
// const ContextMenuContext = createContext<{
|
|
44
44
|
// open: boolean;
|
|
45
45
|
// onOpenChange: (open: boolean) => void;
|
|
46
46
|
// } | null>(null);
|
|
47
47
|
|
|
48
|
-
// const Root =
|
|
49
|
-
// const [open, setOpen] =
|
|
48
|
+
// const Root = forwardRef<RootRef, RootProps>(({ onOpenChange: onOpenChangeProp, ...viewProps }, ref) => {
|
|
49
|
+
// const [open, setOpen] = useState(false);
|
|
50
50
|
|
|
51
51
|
// function onOpenChange(value: boolean) {
|
|
52
52
|
// setOpen(value);
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
// Root.displayName = "RootWebContextMenu";
|
|
70
70
|
|
|
71
71
|
// function useRootContext() {
|
|
72
|
-
// const context =
|
|
72
|
+
// const context = useContext(ContextMenuContext);
|
|
73
73
|
// if (!context) {
|
|
74
74
|
// throw new Error("ContextMenu compound components cannot be rendered outside the ContextMenu component");
|
|
75
75
|
// }
|
|
76
76
|
// return context;
|
|
77
77
|
// }
|
|
78
78
|
|
|
79
|
-
// const Trigger =
|
|
79
|
+
// const Trigger = forwardRef<TriggerRef, TriggerProps>(({ disabled = false, ...props }, ref) => {
|
|
80
80
|
// const { open } = useRootContext();
|
|
81
81
|
// const augmentedRef = useAugmentedRef({
|
|
82
82
|
// ref,
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
// );
|
|
136
136
|
// }
|
|
137
137
|
|
|
138
|
-
// const Backdrop =
|
|
138
|
+
// const Backdrop = forwardRef<BackdropRef, BackdropProps>(({ ...props }, ref) => {
|
|
139
139
|
//
|
|
140
140
|
// return (
|
|
141
141
|
// <Component
|
|
@@ -147,11 +147,11 @@
|
|
|
147
147
|
|
|
148
148
|
// Backdrop.displayName = "BackdropWebContextMenu";
|
|
149
149
|
|
|
150
|
-
// const ContextMenuContentContext =
|
|
150
|
+
// const ContextMenuContentContext = createContext<{
|
|
151
151
|
// close: () => void;
|
|
152
152
|
// } | null>(null);
|
|
153
153
|
|
|
154
|
-
// const Content =
|
|
154
|
+
// const Content = forwardRef<ContentRef, ContentProps>(
|
|
155
155
|
// (
|
|
156
156
|
// {
|
|
157
157
|
// render = false,
|
|
@@ -220,18 +220,18 @@
|
|
|
220
220
|
// Content.displayName = "ContentWebContextMenu";
|
|
221
221
|
|
|
222
222
|
// function useContextMenuContentContext() {
|
|
223
|
-
// const context =
|
|
223
|
+
// const context = useContext(ContextMenuContentContext);
|
|
224
224
|
// if (!context) {
|
|
225
225
|
// throw new Error("ContextMenu compound components cannot be rendered outside the ContextMenu component");
|
|
226
226
|
// }
|
|
227
227
|
// return context;
|
|
228
228
|
// }
|
|
229
229
|
|
|
230
|
-
// const Item =
|
|
230
|
+
// const Item = forwardRef<ItemRef, ItemProps>(({ textValue, closeOnPress = true, onPress: onPressProp, ...props }, ref) => {
|
|
231
231
|
// const { close } = useContextMenuContentContext();
|
|
232
232
|
|
|
233
|
-
// function onKeyDown(
|
|
234
|
-
// if (
|
|
233
|
+
// function onKeyDown(event: React.KeyboardEvent) {
|
|
234
|
+
// if (event.key === "Enter" || event.key === " ") {
|
|
235
235
|
// onPressProp?.(EmptyGestureResponderEvent);
|
|
236
236
|
// if (closeOnPress) {
|
|
237
237
|
// close();
|
|
@@ -239,8 +239,8 @@
|
|
|
239
239
|
// }
|
|
240
240
|
// }
|
|
241
241
|
|
|
242
|
-
// function onPress(
|
|
243
|
-
// onPressProp?.(
|
|
242
|
+
// function onPress(event: GestureResponderEvent) {
|
|
243
|
+
// onPressProp?.(event);
|
|
244
244
|
// if (closeOnPress) {
|
|
245
245
|
// close();
|
|
246
246
|
// }
|
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
|
|
268
268
|
// Item.displayName = "ItemWebContextMenu";
|
|
269
269
|
|
|
270
|
-
// const Group =
|
|
270
|
+
// const Group = forwardRef<GroupRef, GroupProps>(({ ...props }, ref) => {
|
|
271
271
|
//
|
|
272
272
|
// return (
|
|
273
273
|
// <ContextMenu.Group render>
|
|
@@ -281,7 +281,7 @@
|
|
|
281
281
|
|
|
282
282
|
// Group.displayName = "GroupWebContextMenu";
|
|
283
283
|
|
|
284
|
-
// const Label =
|
|
284
|
+
// const Label = forwardRef<LabelRef, LabelProps>(({ ...props }, ref) => {
|
|
285
285
|
//
|
|
286
286
|
// return (
|
|
287
287
|
// <ContextMenu.Label render>
|
|
@@ -295,13 +295,13 @@
|
|
|
295
295
|
|
|
296
296
|
// Label.displayName = "LabelWebContextMenu";
|
|
297
297
|
|
|
298
|
-
// const CheckboxItem =
|
|
298
|
+
// const CheckboxItem = forwardRef<CheckboxItemRef, CheckboxItemProps>(
|
|
299
299
|
// ({ render, checked, onCheckedChange, textValue, disabled = false, closeOnPress = true, onPress: onPressProp, onKeyDown: onKeyDownProp, ...props }, ref) => {
|
|
300
300
|
// const { close } = useContextMenuContentContext();
|
|
301
301
|
|
|
302
|
-
// function onKeyDown(
|
|
303
|
-
// onKeyDownProp?.(
|
|
304
|
-
// if (
|
|
302
|
+
// function onKeyDown(event: React.KeyboardEvent) {
|
|
303
|
+
// onKeyDownProp?.(event);
|
|
304
|
+
// if (event.key === "Enter" || event.key === " ") {
|
|
305
305
|
// onPressProp?.(EmptyGestureResponderEvent);
|
|
306
306
|
// onCheckedChange?.(!checked);
|
|
307
307
|
// if (closeOnPress) {
|
|
@@ -310,8 +310,8 @@
|
|
|
310
310
|
// }
|
|
311
311
|
// }
|
|
312
312
|
|
|
313
|
-
// function onPress(
|
|
314
|
-
// onPressProp?.(
|
|
313
|
+
// function onPress(event: GestureResponderEvent) {
|
|
314
|
+
// onPressProp?.(event);
|
|
315
315
|
// onCheckedChange?.(!checked);
|
|
316
316
|
// if (closeOnPress) {
|
|
317
317
|
// close();
|
|
@@ -344,12 +344,12 @@
|
|
|
344
344
|
|
|
345
345
|
// CheckboxItem.displayName = "CheckboxItemWebContextMenu";
|
|
346
346
|
|
|
347
|
-
// const ContextMenuRadioGroupContext =
|
|
347
|
+
// const ContextMenuRadioGroupContext = createContext<{
|
|
348
348
|
// value?: string;
|
|
349
349
|
// onValueChange?: (value: string) => void;
|
|
350
350
|
// } | null>(null);
|
|
351
351
|
|
|
352
|
-
// const RadioGroup =
|
|
352
|
+
// const RadioGroup = forwardRef<RadioGroupRef, RadioGroupProps>(({ value, onValueChange, ...props }, ref) => {
|
|
353
353
|
//
|
|
354
354
|
// return (
|
|
355
355
|
// <ContextMenuRadioGroupContext.Provider value={{ value, onValueChange }}>
|
|
@@ -370,21 +370,21 @@
|
|
|
370
370
|
// RadioGroup.displayName = "RadioGroupWebContextMenu";
|
|
371
371
|
|
|
372
372
|
// function useContextMenuRadioGroupContext() {
|
|
373
|
-
// const context =
|
|
373
|
+
// const context = useContext(ContextMenuRadioGroupContext);
|
|
374
374
|
// if (!context) {
|
|
375
375
|
// throw new Error("ContextMenu compound components cannot be rendered outside the ContextMenu component");
|
|
376
376
|
// }
|
|
377
377
|
// return context;
|
|
378
378
|
// }
|
|
379
379
|
|
|
380
|
-
// const RadioItem =
|
|
380
|
+
// const RadioItem = forwardRef<RadioItemRef, RadioItemProps>(
|
|
381
381
|
// ({ render, value, textValue, closeOnPress = true, onPress: onPressProp, onKeyDown: onKeyDownProp, ...props }, ref) => {
|
|
382
382
|
// const { onValueChange } = useContextMenuRadioGroupContext();
|
|
383
383
|
// const { close } = useContextMenuContentContext();
|
|
384
384
|
|
|
385
|
-
// function onKeyDown(
|
|
386
|
-
// onKeyDownProp?.(
|
|
387
|
-
// if (
|
|
385
|
+
// function onKeyDown(event: React.KeyboardEvent) {
|
|
386
|
+
// onKeyDownProp?.(event);
|
|
387
|
+
// if (event.key === "Enter" || event.key === " ") {
|
|
388
388
|
// onValueChange?.(value);
|
|
389
389
|
// onPressProp?.(EmptyGestureResponderEvent);
|
|
390
390
|
// if (closeOnPress) {
|
|
@@ -393,9 +393,9 @@
|
|
|
393
393
|
// }
|
|
394
394
|
// }
|
|
395
395
|
|
|
396
|
-
// function onPress(
|
|
396
|
+
// function onPress(event: GestureResponderEvent) {
|
|
397
397
|
// onValueChange?.(value);
|
|
398
|
-
// onPressProp?.(
|
|
398
|
+
// onPressProp?.(event);
|
|
399
399
|
// if (closeOnPress) {
|
|
400
400
|
// close();
|
|
401
401
|
// }
|
|
@@ -423,7 +423,7 @@
|
|
|
423
423
|
|
|
424
424
|
// RadioItem.displayName = "RadioItemWebContextMenu";
|
|
425
425
|
|
|
426
|
-
// const ItemIndicator =
|
|
426
|
+
// const ItemIndicator = forwardRef<ItemIndicatorRef, ItemIndicatorProps>(({ keepMounted, ...props }, ref) => {
|
|
427
427
|
//
|
|
428
428
|
// return (
|
|
429
429
|
// <ContextMenu.ItemIndicator
|
|
@@ -440,7 +440,7 @@
|
|
|
440
440
|
|
|
441
441
|
// ItemIndicator.displayName = "ItemIndicatorWebContextMenu";
|
|
442
442
|
|
|
443
|
-
// const Separator =
|
|
443
|
+
// const Separator = forwardRef<SeparatorRef, SeparatorProps>(({ decorative, ...props }, ref) => {
|
|
444
444
|
//
|
|
445
445
|
// return (
|
|
446
446
|
// <ContextMenu.Separator render>
|
|
@@ -454,12 +454,12 @@
|
|
|
454
454
|
|
|
455
455
|
// Separator.displayName = "SeparatorWebContextMenu";
|
|
456
456
|
|
|
457
|
-
// const ContextMenuSubContext =
|
|
457
|
+
// const ContextMenuSubContext = createContext<{
|
|
458
458
|
// open: boolean;
|
|
459
459
|
// onOpenChange: (open: boolean) => void;
|
|
460
460
|
// } | null>(null);
|
|
461
461
|
|
|
462
|
-
// const Sub =
|
|
462
|
+
// const Sub = forwardRef<SubRef, SubProps>(({ defaultOpen, open: openProp, onOpenChange: onOpenChangeProp, ...props }, ref) => {
|
|
463
463
|
// const [open = false, onOpenChange] = useControllableState({
|
|
464
464
|
// prop: openProp,
|
|
465
465
|
// defaultProp: defaultOpen,
|
|
@@ -485,19 +485,19 @@
|
|
|
485
485
|
// Sub.displayName = "SubWebContextMenu";
|
|
486
486
|
|
|
487
487
|
// function useSubContext() {
|
|
488
|
-
// const context =
|
|
488
|
+
// const context = useContext(ContextMenuSubContext);
|
|
489
489
|
// if (!context) {
|
|
490
490
|
// throw new Error("ContextMenu compound components cannot be rendered outside the ContextMenu component");
|
|
491
491
|
// }
|
|
492
492
|
// return context;
|
|
493
493
|
// }
|
|
494
494
|
|
|
495
|
-
// const SubTrigger =
|
|
495
|
+
// const SubTrigger = forwardRef<SubTriggerRef, SubTriggerProps>(({ textValue, disabled = false, onPress: onPressProp, ...props }, ref) => {
|
|
496
496
|
// const { onOpenChange } = useSubContext();
|
|
497
497
|
|
|
498
|
-
// function onPress(
|
|
498
|
+
// function onPress(event: GestureResponderEvent) {
|
|
499
499
|
// onOpenChange(true);
|
|
500
|
-
// onPressProp?.(
|
|
500
|
+
// onPressProp?.(event);
|
|
501
501
|
// }
|
|
502
502
|
|
|
503
503
|
//
|
|
@@ -518,7 +518,7 @@
|
|
|
518
518
|
|
|
519
519
|
// SubTrigger.displayName = "SubTriggerWebContextMenu";
|
|
520
520
|
|
|
521
|
-
// const SubContent =
|
|
521
|
+
// const SubContent = forwardRef<SubContentRef, SubContentProps>(({ render = false, keepMounted, ...props }, ref) => {
|
|
522
522
|
//
|
|
523
523
|
// return (
|
|
524
524
|
// <ContextMenu.Portal>
|
|
@@ -555,6 +555,6 @@
|
|
|
555
555
|
// useSubContext,
|
|
556
556
|
// };
|
|
557
557
|
|
|
558
|
-
// function onSelected(
|
|
559
|
-
//
|
|
558
|
+
// function onSelected(event: Event) {
|
|
559
|
+
// event.preventDefault();
|
|
560
560
|
// }
|
package/src/dialog/dialog.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { BackHandler, GestureResponderEvent, Pressable, Text, View } from "react
|
|
|
3
3
|
|
|
4
4
|
import { useControllableState } from "../hooks";
|
|
5
5
|
import { Portal as BrandMapPrimitivesPortal } from "../portal";
|
|
6
|
-
import * as
|
|
6
|
+
import * as Render from "../render";
|
|
7
7
|
import { RenderViewProps } from "../types";
|
|
8
8
|
|
|
9
9
|
import type {
|
|
@@ -50,7 +50,7 @@ Root.displayName = "RootNativeDialog";
|
|
|
50
50
|
const Popup = ({ render, ref, ...props }: RenderViewProps) => {
|
|
51
51
|
if (render) {
|
|
52
52
|
return (
|
|
53
|
-
<
|
|
53
|
+
<Render.View
|
|
54
54
|
render={render}
|
|
55
55
|
ref={ref}
|
|
56
56
|
{...props}
|
|
@@ -70,16 +70,16 @@ Popup.displayName = "PopupNativeDialog";
|
|
|
70
70
|
const Trigger = forwardRef<TriggerRef, TriggerProps>(({ onPress: onPressProp, disabled = false, ...props }, ref) => {
|
|
71
71
|
const { open, onOpenChange } = useRootContext();
|
|
72
72
|
|
|
73
|
-
function onPress(
|
|
73
|
+
function onPress(event: GestureResponderEvent) {
|
|
74
74
|
if (disabled) return;
|
|
75
75
|
const newValue = !open;
|
|
76
76
|
onOpenChange(newValue);
|
|
77
|
-
onPressProp?.(
|
|
77
|
+
onPressProp?.(event);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (render) {
|
|
81
81
|
return (
|
|
82
|
-
<
|
|
82
|
+
<Render.Pressable
|
|
83
83
|
render={render}
|
|
84
84
|
ref={ref}
|
|
85
85
|
aria-disabled={disabled ?? undefined}
|
|
@@ -126,14 +126,14 @@ function Portal({ keepMounted, hostName, children }: PortalProps) {
|
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
const Backdrop = forwardRef<BackdropRef, BackdropProps>(({ keepMounted, closeOnPress = true, onPress:
|
|
129
|
+
const Backdrop = forwardRef<BackdropRef, BackdropProps>(({ keepMounted, closeOnPress = true, onPress: onPressProp, ...props }, ref) => {
|
|
130
130
|
const { open, onOpenChange } = useRootContext();
|
|
131
131
|
|
|
132
|
-
function onPress(
|
|
132
|
+
function onPress(event: GestureResponderEvent) {
|
|
133
133
|
if (closeOnPress) {
|
|
134
134
|
onOpenChange(!open);
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
onPressProp?.(event);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
if (!keepMounted) {
|
|
@@ -144,7 +144,7 @@ const Backdrop = forwardRef<BackdropRef, BackdropProps>(({ keepMounted, closeOnP
|
|
|
144
144
|
|
|
145
145
|
if (render) {
|
|
146
146
|
return (
|
|
147
|
-
<
|
|
147
|
+
<Render.Pressable
|
|
148
148
|
render={render}
|
|
149
149
|
ref={ref}
|
|
150
150
|
onPress={onPress}
|
|
@@ -186,7 +186,7 @@ const Content = forwardRef<ContentRef, ContentProps>(({ keepMounted, ...props },
|
|
|
186
186
|
|
|
187
187
|
if (render) {
|
|
188
188
|
return (
|
|
189
|
-
<
|
|
189
|
+
<Render.Pressable
|
|
190
190
|
render={render}
|
|
191
191
|
ref={ref}
|
|
192
192
|
role="dialog"
|
|
@@ -227,7 +227,7 @@ const Close = forwardRef<CloseRef, CloseProps>(({ onPress: onPressProp, disabled
|
|
|
227
227
|
|
|
228
228
|
if (render) {
|
|
229
229
|
return (
|
|
230
|
-
<
|
|
230
|
+
<Render.Pressable
|
|
231
231
|
ref={ref}
|
|
232
232
|
aria-disabled={disabled ?? undefined}
|
|
233
233
|
role="button"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// // @ts-nocheck
|
|
2
2
|
|
|
3
3
|
// import * as Dialog from "@radix-ui/react-dialog";
|
|
4
|
-
//
|
|
4
|
+
//
|
|
5
5
|
// import { Pressable, Text, View, type GestureResponderEvent } from "react-native";
|
|
6
6
|
|
|
7
7
|
// import { useAugmentedRef, useControllableState, useIsomorphicLayoutEffect } from "../hooks";
|
|
8
|
-
// import * as
|
|
8
|
+
// import * as Render from "../render";
|
|
9
9
|
|
|
10
10
|
// import type {
|
|
11
11
|
// CloseProps,
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
// TriggerRef,
|
|
27
27
|
// } from "./types";
|
|
28
28
|
|
|
29
|
-
// const DialogContext =
|
|
29
|
+
// const DialogContext = createContext<RootContext | null>(null);
|
|
30
30
|
|
|
31
|
-
// const Root =
|
|
31
|
+
// const Root = forwardRef<RootRef, RootProps>(({ open: openProp, defaultOpen, onOpenChange: onOpenChangeProp, ...viewProps }, ref) => {
|
|
32
32
|
// const [open = false, onOpenChange] = useControllableState({
|
|
33
33
|
// prop: openProp,
|
|
34
34
|
// defaultProp: defaultOpen,
|
|
@@ -54,19 +54,19 @@
|
|
|
54
54
|
// Root.displayName = "RootWebDialog";
|
|
55
55
|
|
|
56
56
|
// function useRootContext() {
|
|
57
|
-
// const context =
|
|
57
|
+
// const context = useContext(DialogContext);
|
|
58
58
|
// if (!context) {
|
|
59
59
|
// throw new Error("Dialog compound components cannot be rendered outside the Dialog component");
|
|
60
60
|
// }
|
|
61
61
|
// return context;
|
|
62
62
|
// }
|
|
63
63
|
|
|
64
|
-
// const Trigger =
|
|
64
|
+
// const Trigger = forwardRef<TriggerRef, TriggerProps>(({ onPress: onPressProp, role: _role, disabled, ...props }, ref) => {
|
|
65
65
|
// const augmentedRef = useAugmentedRef({ ref });
|
|
66
66
|
// const { onOpenChange, open } = useRootContext();
|
|
67
|
-
// function onPress(
|
|
67
|
+
// function onPress(event: GestureResponderEvent) {
|
|
68
68
|
// if (onPressProp) {
|
|
69
|
-
// onPressProp(
|
|
69
|
+
// onPressProp(event);
|
|
70
70
|
// }
|
|
71
71
|
// onOpenChange(!open);
|
|
72
72
|
// }
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
// );
|
|
109
109
|
// }
|
|
110
110
|
|
|
111
|
-
// const Backdrop =
|
|
111
|
+
// const Backdrop = forwardRef<BackdropRef, BackdropProps>(({ keepMounted, ...props }, ref) => {
|
|
112
112
|
//
|
|
113
113
|
// return (
|
|
114
114
|
// <Dialog.Backdrop keepMounted={keepMounted}>
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
|
|
123
123
|
// Backdrop.displayName = "BackdropWebDialog";
|
|
124
124
|
|
|
125
|
-
// const Content =
|
|
125
|
+
// const Content = forwardRef<ContentRef, ContentProps>(
|
|
126
126
|
// ({ render, keepMounted, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onInteractOutside, onPointerDownOutside, ...props }, ref) => {
|
|
127
127
|
//
|
|
128
128
|
// return (
|
|
@@ -145,13 +145,13 @@
|
|
|
145
145
|
|
|
146
146
|
// Content.displayName = "ContentWebDialog";
|
|
147
147
|
|
|
148
|
-
// const Close =
|
|
148
|
+
// const Close = forwardRef<CloseRef, CloseProps>(({ onPress: onPressProp, disabled, ...props }, ref) => {
|
|
149
149
|
// const augmentedRef = useAugmentedRef({ ref });
|
|
150
150
|
// const { onOpenChange, open } = useRootContext();
|
|
151
151
|
|
|
152
|
-
// function onPress(
|
|
152
|
+
// function onPress(event: GestureResponderEvent) {
|
|
153
153
|
// if (onPressProp) {
|
|
154
|
-
// onPressProp(
|
|
154
|
+
// onPressProp(event);
|
|
155
155
|
// }
|
|
156
156
|
// onOpenChange(!open);
|
|
157
157
|
// }
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
|
|
185
185
|
// Close.displayName = "CloseWebDialog";
|
|
186
186
|
|
|
187
|
-
// const Title =
|
|
187
|
+
// const Title = forwardRef<TitleRef, TitleProps>(({ ...props }, ref) => {
|
|
188
188
|
//
|
|
189
189
|
// return (
|
|
190
190
|
// <Dialog.Title render>
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
|
|
199
199
|
// Title.displayName = "TitleWebDialog";
|
|
200
200
|
|
|
201
|
-
// const Description =
|
|
201
|
+
// const Description = forwardRef<DescriptionRef, DescriptionProps>(({ ...props }, ref) => {
|
|
202
202
|
//
|
|
203
203
|
// return (
|
|
204
204
|
// <Dialog.Description render>
|
package/src/dialog/types.ts
CHANGED
|
@@ -36,27 +36,27 @@ type ContentProps = KeepMountable &
|
|
|
36
36
|
/**
|
|
37
37
|
* @platform: WEB ONLY
|
|
38
38
|
*/
|
|
39
|
-
onOpenAutoFocus?: (
|
|
39
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* @platform: WEB ONLY
|
|
43
43
|
*/
|
|
44
|
-
onCloseAutoFocus?: (
|
|
44
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* @platform: WEB ONLY
|
|
48
48
|
*/
|
|
49
|
-
onEscapeKeyDown?: (
|
|
49
|
+
onEscapeKeyDown?: (event: Event) => void;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* @platform: WEB ONLY
|
|
53
53
|
*/
|
|
54
|
-
onInteractOutside?: (
|
|
54
|
+
onInteractOutside?: (event: Event) => void;
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* @platform: WEB ONLY
|
|
58
58
|
*/
|
|
59
|
-
onPointerDownOutside?: (
|
|
59
|
+
onPointerDownOutside?: (event: Event) => void;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
type TriggerProps = RenderPressableProps;
|