@tamagui/alert-dialog 1.0.1-beta.151 → 1.0.1-beta.154
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/dist/cjs/AlertDialog.js +124 -96
- package/dist/cjs/AlertDialog.js.map +2 -2
- package/dist/esm/AlertDialog.js +120 -95
- package/dist/esm/AlertDialog.js.map +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/jsx/AlertDialog.js +68 -52
- package/dist/jsx/AlertDialog.js.map +2 -2
- package/dist/jsx/index.js.map +1 -1
- package/package.json +17 -17
package/dist/cjs/AlertDialog.js
CHANGED
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var AlertDialog_exports = {};
|
|
23
26
|
__export(AlertDialog_exports, {
|
|
@@ -33,6 +36,7 @@ __export(AlertDialog_exports, {
|
|
|
33
36
|
createAlertDialogScope: () => createAlertDialogScope
|
|
34
37
|
});
|
|
35
38
|
module.exports = __toCommonJS(AlertDialog_exports);
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
40
|
var import_compose_refs = require("@tamagui/compose-refs");
|
|
37
41
|
var import_core = require("@tamagui/core");
|
|
38
42
|
var import_create_context = require("@tamagui/create-context");
|
|
@@ -50,123 +54,145 @@ const TRIGGER_NAME = "AlertDialogTrigger";
|
|
|
50
54
|
const NativeAlertDialogTriggerFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
51
55
|
name: "DialogTrigger"
|
|
52
56
|
});
|
|
53
|
-
const AlertDialogTrigger = React.forwardRef(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
const AlertDialogTrigger = React.forwardRef(
|
|
58
|
+
(props, forwardedRef) => {
|
|
59
|
+
if (props["__native"]) {
|
|
60
|
+
const { __native, onPress, __onPress, ...rest } = props;
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeAlertDialogTriggerFrame, {
|
|
62
|
+
...rest,
|
|
63
|
+
onPress: (0, import_core.composeEventHandlers)(onPress, __onPress)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const { __scopeAlertDialog, ...triggerProps } = props;
|
|
67
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTrigger, {
|
|
69
|
+
...dialogScope,
|
|
70
|
+
...triggerProps,
|
|
71
|
+
ref: forwardedRef
|
|
59
72
|
});
|
|
60
73
|
}
|
|
61
|
-
|
|
62
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
63
|
-
return /* @__PURE__ */ React.createElement(import_dialog.DialogTrigger, {
|
|
64
|
-
...dialogScope,
|
|
65
|
-
...triggerProps,
|
|
66
|
-
ref: forwardedRef
|
|
67
|
-
});
|
|
68
|
-
});
|
|
74
|
+
);
|
|
69
75
|
AlertDialogTrigger.displayName = TRIGGER_NAME;
|
|
70
76
|
const PORTAL_NAME = "AlertDialogPortal";
|
|
71
77
|
const AlertDialogPortal = (props) => {
|
|
72
78
|
const { __scopeAlertDialog, ...portalProps } = props;
|
|
73
79
|
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
74
|
-
return /* @__PURE__ */
|
|
80
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogPortal, {
|
|
75
81
|
...dialogScope,
|
|
76
82
|
...portalProps
|
|
77
83
|
});
|
|
78
84
|
};
|
|
79
85
|
AlertDialogPortal.displayName = PORTAL_NAME;
|
|
80
86
|
const OVERLAY_NAME = "AlertDialogOverlay";
|
|
81
|
-
const AlertDialogOverlay = React.forwardRef(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
87
|
+
const AlertDialogOverlay = React.forwardRef(
|
|
88
|
+
(props, forwardedRef) => {
|
|
89
|
+
const { __scopeAlertDialog, ...overlayProps } = props;
|
|
90
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
91
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogOverlay, {
|
|
92
|
+
...dialogScope,
|
|
93
|
+
...overlayProps,
|
|
94
|
+
ref: forwardedRef
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
);
|
|
90
98
|
AlertDialogOverlay.displayName = OVERLAY_NAME;
|
|
91
99
|
const CONTENT_NAME = "AlertDialogContent";
|
|
92
100
|
const [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
|
|
93
|
-
const AlertDialogContent = React.forwardRef(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
101
|
+
const AlertDialogContent = React.forwardRef(
|
|
102
|
+
(props, forwardedRef) => {
|
|
103
|
+
const { __scopeAlertDialog, children, ...contentProps } = props;
|
|
104
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
105
|
+
const contentRef = React.useRef(null);
|
|
106
|
+
const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef);
|
|
107
|
+
const cancelRef = React.useRef(null);
|
|
108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogWarningProvider, {
|
|
109
|
+
contentName: CONTENT_NAME,
|
|
110
|
+
titleName: TITLE_NAME,
|
|
111
|
+
docsSlug: "alert-dialog",
|
|
112
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContentProvider, {
|
|
113
|
+
scope: __scopeAlertDialog,
|
|
114
|
+
cancelRef,
|
|
115
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.DialogContent, {
|
|
116
|
+
role: "alertdialog",
|
|
117
|
+
...dialogScope,
|
|
118
|
+
...contentProps,
|
|
119
|
+
ref: composedRefs,
|
|
120
|
+
onOpenAutoFocus: (0, import_core.composeEventHandlers)(contentProps.onOpenAutoFocus, (event) => {
|
|
121
|
+
var _a;
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
if (import_core.isWeb) {
|
|
124
|
+
(_a = cancelRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
125
|
+
}
|
|
126
|
+
}),
|
|
127
|
+
onPointerDownOutside: (event) => event.preventDefault(),
|
|
128
|
+
onInteractOutside: (event) => event.preventDefault(),
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slottable, {
|
|
131
|
+
children
|
|
132
|
+
}),
|
|
133
|
+
process.env.NODE_ENV === "development" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionWarning, {
|
|
134
|
+
contentRef
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
);
|
|
124
142
|
AlertDialogContent.displayName = CONTENT_NAME;
|
|
125
143
|
const TITLE_NAME = "AlertDialogTitle";
|
|
126
|
-
const AlertDialogTitle = React.forwardRef(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
144
|
+
const AlertDialogTitle = React.forwardRef(
|
|
145
|
+
(props, forwardedRef) => {
|
|
146
|
+
const { __scopeAlertDialog, ...titleProps } = props;
|
|
147
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTitle, {
|
|
149
|
+
...dialogScope,
|
|
150
|
+
...titleProps,
|
|
151
|
+
ref: forwardedRef
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
);
|
|
135
155
|
AlertDialogTitle.displayName = TITLE_NAME;
|
|
136
156
|
const DESCRIPTION_NAME = "AlertDialogDescription";
|
|
137
|
-
const AlertDialogDescription = React.forwardRef(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
});
|
|
157
|
+
const AlertDialogDescription = React.forwardRef(
|
|
158
|
+
(props, forwardedRef) => {
|
|
159
|
+
const { __scopeAlertDialog, ...descriptionProps } = props;
|
|
160
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogDescription, {
|
|
162
|
+
...dialogScope,
|
|
163
|
+
...descriptionProps,
|
|
164
|
+
ref: forwardedRef
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
);
|
|
146
168
|
AlertDialogDescription.displayName = DESCRIPTION_NAME;
|
|
147
169
|
const ACTION_NAME = "AlertDialogAction";
|
|
148
|
-
const AlertDialogAction = React.forwardRef(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
});
|
|
170
|
+
const AlertDialogAction = React.forwardRef(
|
|
171
|
+
(props, forwardedRef) => {
|
|
172
|
+
const { __scopeAlertDialog, ...actionProps } = props;
|
|
173
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, {
|
|
175
|
+
...dialogScope,
|
|
176
|
+
...actionProps,
|
|
177
|
+
ref: forwardedRef
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
);
|
|
157
181
|
AlertDialogAction.displayName = ACTION_NAME;
|
|
158
182
|
const CANCEL_NAME = "AlertDialogCancel";
|
|
159
|
-
const AlertDialogCancel = React.forwardRef(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
});
|
|
183
|
+
const AlertDialogCancel = React.forwardRef(
|
|
184
|
+
(props, forwardedRef) => {
|
|
185
|
+
const { __scopeAlertDialog, ...cancelProps } = props;
|
|
186
|
+
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
|
|
187
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
188
|
+
const ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
|
|
189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, {
|
|
190
|
+
...dialogScope,
|
|
191
|
+
...cancelProps,
|
|
192
|
+
ref
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
);
|
|
170
196
|
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
171
197
|
const DescriptionWarning = ({ contentRef }) => {
|
|
172
198
|
if (process.env.NODE_ENV === "development") {
|
|
@@ -174,7 +200,9 @@ const DescriptionWarning = ({ contentRef }) => {
|
|
|
174
200
|
var _a;
|
|
175
201
|
if (!import_core.isWeb)
|
|
176
202
|
return;
|
|
177
|
-
const hasDescription = document.getElementById(
|
|
203
|
+
const hasDescription = document.getElementById(
|
|
204
|
+
(_a = contentRef.current) == null ? void 0 : _a.getAttribute("aria-describedby")
|
|
205
|
+
);
|
|
178
206
|
if (!hasDescription) {
|
|
179
207
|
console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
180
208
|
|
|
@@ -257,7 +285,7 @@ const AlertDialogInner = (props) => {
|
|
|
257
285
|
});
|
|
258
286
|
}
|
|
259
287
|
}
|
|
260
|
-
return /* @__PURE__ */
|
|
288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, {
|
|
261
289
|
...dialogScope,
|
|
262
290
|
...alertDialogProps,
|
|
263
291
|
modal: true
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/AlertDialog.tsx"],
|
|
4
4
|
"sourcesContent": ["// forked from radix-ui\n// https://github.com/radix-ui/primitives/blob/main/packages/react/alert-dialog/src/AlertDialog.tsx\n\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n Slottable,\n TamaguiElement,\n composeEventHandlers,\n isTamaguiElement,\n isWeb,\n styled,\n withStaticProperties,\n} from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport {\n Dialog,\n DialogClose,\n DialogCloseProps,\n DialogContent,\n DialogContentProps,\n DialogDescription,\n DialogDescriptionProps,\n DialogOverlay,\n DialogOverlayProps,\n DialogPortal,\n DialogPortalProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n DialogTrigger,\n DialogTriggerProps,\n DialogWarningProvider,\n createDialogScope,\n} from '@tamagui/dialog'\nimport { YStack } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\nimport { Alert } from 'react-native'\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog'\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope }\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n])\n\nconst useDialogScope = createDialogScope()\n\ntype AlertDialogProps = DialogProps & {\n native?: boolean\n}\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'AlertDialogTrigger'\n\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst NativeAlertDialogTriggerFrame = styled(YStack, {\n name: 'DialogTrigger',\n})\n\nconst AlertDialogTrigger = React.forwardRef<TamaguiElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n if (props['__native']) {\n const { __native, onPress, __onPress, ...rest } = props as any\n return (\n <NativeAlertDialogTriggerFrame\n {...rest}\n onPress={composeEventHandlers(onPress, __onPress)}\n />\n )\n }\n\n const { __scopeAlertDialog, ...triggerProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogTrigger {...dialogScope} {...triggerProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal'\n\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogPortal {...dialogScope} {...portalProps} />\n}\n\nAlertDialogPortal.displayName = PORTAL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay'\n\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<TamaguiElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogOverlay {...dialogScope} {...overlayProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogOverlay.displayName = OVERLAY_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent'\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<TamaguiElement | null>\n}\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME)\n\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<TamaguiElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n const contentRef = React.useRef<TamaguiElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const cancelRef = React.useRef<TamaguiElement | null>(null)\n\n return (\n <DialogWarningProvider\n contentName={CONTENT_NAME}\n titleName={TITLE_NAME}\n docsSlug=\"alert-dialog\"\n >\n <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>\n <DialogContent\n // @ts-ignore\n role=\"alertdialog\"\n {...dialogScope}\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault()\n if (isWeb) {\n // @ts-ignore\n cancelRef.current?.focus({ preventScroll: true })\n }\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogContent>\n </AlertDialogContentProvider>\n </DialogWarningProvider>\n )\n }\n)\n\nAlertDialogContent.displayName = CONTENT_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle'\n\ntype AlertDialogTitleProps = DialogTitleProps\n\nconst AlertDialogTitle = React.forwardRef<TamaguiElement, AlertDialogTitleProps>(\n (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...titleProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogTitle {...dialogScope} {...titleProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogTitle.displayName = TITLE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription'\n\ntype AlertDialogDescriptionProps = DialogDescriptionProps\n\nconst AlertDialogDescription = React.forwardRef<TamaguiElement, AlertDialogDescriptionProps>(\n (props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...descriptionProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogDescription {...dialogScope} {...descriptionProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction'\n\ntype AlertDialogActionProps = DialogCloseProps\n\nconst AlertDialogAction = React.forwardRef<TamaguiElement, AlertDialogActionProps>(\n (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...actionProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogClose {...dialogScope} {...actionProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogAction.displayName = ACTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel'\n\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<TamaguiElement, AlertDialogCancelProps>(\n (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...cancelProps } = props\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog)\n const dialogScope = useDialogScope(__scopeAlertDialog)\n const ref = useComposedRefs(forwardedRef, cancelRef)\n return <DialogClose {...dialogScope} {...cancelProps} ref={ref} />\n }\n)\n\nAlertDialogCancel.displayName = CANCEL_NAME\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<TamaguiElement>\n}\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n if (process.env.NODE_ENV === 'development') {\n React.useEffect(() => {\n if (!isWeb) return\n const hasDescription = document.getElementById(\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain\n contentRef.current?.getAttribute('aria-describedby')!\n )\n if (!hasDescription) {\n // eslint-disable-next-line no-console\n console.warn(`\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n \n You can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n \n Alternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n \n For more information, see https://tamagui.dev/docs/components/alert-dialog`)\n }\n }, [contentRef])\n }\n\n return null\n}\n\nconst AlertDialogInner: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, native, ...alertDialogProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n const [open, setOpen] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen || false,\n onChange: props.onOpenChange,\n })\n\n let triggerElement: any = null\n let title = ''\n let description = ''\n const buttons: {\n text: string\n onPress: (value?: string | undefined) => void\n style?: 'default' | 'cancel' | 'destructive'\n }[] = []\n\n forEachChildDeep(React.Children.toArray(props.children), (child) => {\n if (!React.isValidElement(child)) return false\n const name = isTamaguiElement(child)\n ? child.type.staticConfig.componentName\n : (child.type['displayName'] as string | undefined)\n switch (name) {\n case TRIGGER_NAME: {\n triggerElement = React.cloneElement(child as any, {\n __native: true,\n })\n return false\n }\n case TITLE_NAME: {\n title = getStringChildren(child)\n return false\n }\n case DESCRIPTION_NAME: {\n description = getStringChildren(child)\n return false\n }\n case ACTION_NAME:\n case CANCEL_NAME: {\n const style = name === ACTION_NAME ? 'default' : 'cancel'\n const text = getStringChildren(child)\n const onPress = () => {\n const childProps = child.props as any\n childProps?.onPress?.({ native: true })\n setOpen(false)\n }\n buttons.push({\n style,\n text,\n // @ts-ignore\n onPress,\n })\n return false\n }\n default: {\n return true\n }\n }\n })\n\n React.useLayoutEffect(() => {\n if (!open || !native) return\n if (title || description) {\n Alert.alert(title, description, buttons)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [native, open])\n\n if (native) {\n return React.cloneElement(triggerElement, {\n __onPress: () => {\n setOpen(true)\n },\n })\n }\n }\n\n return <Dialog {...dialogScope} {...alertDialogProps} modal />\n}\n\nfunction forEachChildDeep(\n children: React.ReactNode[],\n onChild: (el: React.ReactElement) => boolean\n) {\n for (const child of children) {\n if (!React.isValidElement(child)) continue\n if (!onChild(child)) continue\n if (child.props.children) {\n forEachChildDeep(React.Children.toArray(child.props.children), onChild)\n }\n }\n}\n\nfunction getStringChildren(child: React.ReactElement) {\n let string = ''\n forEachChildDeep(React.Children.toArray(child), (child) => {\n if (typeof child.props.children === 'string') {\n string = child.props.children\n return false\n }\n return true\n })\n return string\n}\n\nconst AlertDialog = withStaticProperties(AlertDialogInner, {\n Trigger: AlertDialogTrigger,\n Portal: AlertDialogPortal,\n Overlay: AlertDialogOverlay,\n Content: AlertDialogContent,\n Action: AlertDialogAction,\n Cancel: AlertDialogCancel,\n Title: AlertDialogTitle,\n Description: AlertDialogDescription,\n})\n\nAlertDialog.displayName = ROOT_NAME\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n}\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyEQ;AAtER,0BAAgC;AAChC,kBAQO;AACP,4BAA0C;AAC1C,oBAmBO;AACP,oBAAuB;AACvB,oCAAqC;AACrC,YAAuB;AACvB,0BAAsB;AAMtB,MAAM,YAAY;AAGlB,MAAM,CAAC,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1,4 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
2
3
|
import {
|
|
3
4
|
Slottable,
|
|
@@ -33,123 +34,145 @@ const TRIGGER_NAME = "AlertDialogTrigger";
|
|
|
33
34
|
const NativeAlertDialogTriggerFrame = styled(YStack, {
|
|
34
35
|
name: "DialogTrigger"
|
|
35
36
|
});
|
|
36
|
-
const AlertDialogTrigger = React.forwardRef(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
const AlertDialogTrigger = React.forwardRef(
|
|
38
|
+
(props, forwardedRef) => {
|
|
39
|
+
if (props["__native"]) {
|
|
40
|
+
const { __native, onPress, __onPress, ...rest } = props;
|
|
41
|
+
return /* @__PURE__ */ jsx(NativeAlertDialogTriggerFrame, {
|
|
42
|
+
...rest,
|
|
43
|
+
onPress: composeEventHandlers(onPress, __onPress)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const { __scopeAlertDialog, ...triggerProps } = props;
|
|
47
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
48
|
+
return /* @__PURE__ */ jsx(DialogTrigger, {
|
|
49
|
+
...dialogScope,
|
|
50
|
+
...triggerProps,
|
|
51
|
+
ref: forwardedRef
|
|
42
52
|
});
|
|
43
53
|
}
|
|
44
|
-
|
|
45
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
46
|
-
return /* @__PURE__ */ React.createElement(DialogTrigger, {
|
|
47
|
-
...dialogScope,
|
|
48
|
-
...triggerProps,
|
|
49
|
-
ref: forwardedRef
|
|
50
|
-
});
|
|
51
|
-
});
|
|
54
|
+
);
|
|
52
55
|
AlertDialogTrigger.displayName = TRIGGER_NAME;
|
|
53
56
|
const PORTAL_NAME = "AlertDialogPortal";
|
|
54
57
|
const AlertDialogPortal = (props) => {
|
|
55
58
|
const { __scopeAlertDialog, ...portalProps } = props;
|
|
56
59
|
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
57
|
-
return /* @__PURE__ */
|
|
60
|
+
return /* @__PURE__ */ jsx(DialogPortal, {
|
|
58
61
|
...dialogScope,
|
|
59
62
|
...portalProps
|
|
60
63
|
});
|
|
61
64
|
};
|
|
62
65
|
AlertDialogPortal.displayName = PORTAL_NAME;
|
|
63
66
|
const OVERLAY_NAME = "AlertDialogOverlay";
|
|
64
|
-
const AlertDialogOverlay = React.forwardRef(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
});
|
|
67
|
+
const AlertDialogOverlay = React.forwardRef(
|
|
68
|
+
(props, forwardedRef) => {
|
|
69
|
+
const { __scopeAlertDialog, ...overlayProps } = props;
|
|
70
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
71
|
+
return /* @__PURE__ */ jsx(DialogOverlay, {
|
|
72
|
+
...dialogScope,
|
|
73
|
+
...overlayProps,
|
|
74
|
+
ref: forwardedRef
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
);
|
|
73
78
|
AlertDialogOverlay.displayName = OVERLAY_NAME;
|
|
74
79
|
const CONTENT_NAME = "AlertDialogContent";
|
|
75
80
|
const [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
|
|
76
|
-
const AlertDialogContent = React.forwardRef(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
81
|
+
const AlertDialogContent = React.forwardRef(
|
|
82
|
+
(props, forwardedRef) => {
|
|
83
|
+
const { __scopeAlertDialog, children, ...contentProps } = props;
|
|
84
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
85
|
+
const contentRef = React.useRef(null);
|
|
86
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
87
|
+
const cancelRef = React.useRef(null);
|
|
88
|
+
return /* @__PURE__ */ jsx(DialogWarningProvider, {
|
|
89
|
+
contentName: CONTENT_NAME,
|
|
90
|
+
titleName: TITLE_NAME,
|
|
91
|
+
docsSlug: "alert-dialog",
|
|
92
|
+
children: /* @__PURE__ */ jsx(AlertDialogContentProvider, {
|
|
93
|
+
scope: __scopeAlertDialog,
|
|
94
|
+
cancelRef,
|
|
95
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
96
|
+
role: "alertdialog",
|
|
97
|
+
...dialogScope,
|
|
98
|
+
...contentProps,
|
|
99
|
+
ref: composedRefs,
|
|
100
|
+
onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
|
|
101
|
+
var _a;
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
if (isWeb) {
|
|
104
|
+
(_a = cancelRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
105
|
+
}
|
|
106
|
+
}),
|
|
107
|
+
onPointerDownOutside: (event) => event.preventDefault(),
|
|
108
|
+
onInteractOutside: (event) => event.preventDefault(),
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsx(Slottable, {
|
|
111
|
+
children
|
|
112
|
+
}),
|
|
113
|
+
process.env.NODE_ENV === "development" && /* @__PURE__ */ jsx(DescriptionWarning, {
|
|
114
|
+
contentRef
|
|
115
|
+
})
|
|
116
|
+
]
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
);
|
|
107
122
|
AlertDialogContent.displayName = CONTENT_NAME;
|
|
108
123
|
const TITLE_NAME = "AlertDialogTitle";
|
|
109
|
-
const AlertDialogTitle = React.forwardRef(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
});
|
|
124
|
+
const AlertDialogTitle = React.forwardRef(
|
|
125
|
+
(props, forwardedRef) => {
|
|
126
|
+
const { __scopeAlertDialog, ...titleProps } = props;
|
|
127
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
128
|
+
return /* @__PURE__ */ jsx(DialogTitle, {
|
|
129
|
+
...dialogScope,
|
|
130
|
+
...titleProps,
|
|
131
|
+
ref: forwardedRef
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
);
|
|
118
135
|
AlertDialogTitle.displayName = TITLE_NAME;
|
|
119
136
|
const DESCRIPTION_NAME = "AlertDialogDescription";
|
|
120
|
-
const AlertDialogDescription = React.forwardRef(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
});
|
|
137
|
+
const AlertDialogDescription = React.forwardRef(
|
|
138
|
+
(props, forwardedRef) => {
|
|
139
|
+
const { __scopeAlertDialog, ...descriptionProps } = props;
|
|
140
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
141
|
+
return /* @__PURE__ */ jsx(DialogDescription, {
|
|
142
|
+
...dialogScope,
|
|
143
|
+
...descriptionProps,
|
|
144
|
+
ref: forwardedRef
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
);
|
|
129
148
|
AlertDialogDescription.displayName = DESCRIPTION_NAME;
|
|
130
149
|
const ACTION_NAME = "AlertDialogAction";
|
|
131
|
-
const AlertDialogAction = React.forwardRef(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
});
|
|
150
|
+
const AlertDialogAction = React.forwardRef(
|
|
151
|
+
(props, forwardedRef) => {
|
|
152
|
+
const { __scopeAlertDialog, ...actionProps } = props;
|
|
153
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
154
|
+
return /* @__PURE__ */ jsx(DialogClose, {
|
|
155
|
+
...dialogScope,
|
|
156
|
+
...actionProps,
|
|
157
|
+
ref: forwardedRef
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
);
|
|
140
161
|
AlertDialogAction.displayName = ACTION_NAME;
|
|
141
162
|
const CANCEL_NAME = "AlertDialogCancel";
|
|
142
|
-
const AlertDialogCancel = React.forwardRef(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
});
|
|
163
|
+
const AlertDialogCancel = React.forwardRef(
|
|
164
|
+
(props, forwardedRef) => {
|
|
165
|
+
const { __scopeAlertDialog, ...cancelProps } = props;
|
|
166
|
+
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
|
|
167
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
168
|
+
const ref = useComposedRefs(forwardedRef, cancelRef);
|
|
169
|
+
return /* @__PURE__ */ jsx(DialogClose, {
|
|
170
|
+
...dialogScope,
|
|
171
|
+
...cancelProps,
|
|
172
|
+
ref
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
);
|
|
153
176
|
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
154
177
|
const DescriptionWarning = ({ contentRef }) => {
|
|
155
178
|
if (process.env.NODE_ENV === "development") {
|
|
@@ -157,7 +180,9 @@ const DescriptionWarning = ({ contentRef }) => {
|
|
|
157
180
|
var _a;
|
|
158
181
|
if (!isWeb)
|
|
159
182
|
return;
|
|
160
|
-
const hasDescription = document.getElementById(
|
|
183
|
+
const hasDescription = document.getElementById(
|
|
184
|
+
(_a = contentRef.current) == null ? void 0 : _a.getAttribute("aria-describedby")
|
|
185
|
+
);
|
|
161
186
|
if (!hasDescription) {
|
|
162
187
|
console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
163
188
|
|
|
@@ -240,7 +265,7 @@ const AlertDialogInner = (props) => {
|
|
|
240
265
|
});
|
|
241
266
|
}
|
|
242
267
|
}
|
|
243
|
-
return /* @__PURE__ */
|
|
268
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
244
269
|
...dialogScope,
|
|
245
270
|
...alertDialogProps,
|
|
246
271
|
modal: true
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/AlertDialog.tsx"],
|
|
4
4
|
"sourcesContent": ["// forked from radix-ui\n// https://github.com/radix-ui/primitives/blob/main/packages/react/alert-dialog/src/AlertDialog.tsx\n\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n Slottable,\n TamaguiElement,\n composeEventHandlers,\n isTamaguiElement,\n isWeb,\n styled,\n withStaticProperties,\n} from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport {\n Dialog,\n DialogClose,\n DialogCloseProps,\n DialogContent,\n DialogContentProps,\n DialogDescription,\n DialogDescriptionProps,\n DialogOverlay,\n DialogOverlayProps,\n DialogPortal,\n DialogPortalProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n DialogTrigger,\n DialogTriggerProps,\n DialogWarningProvider,\n createDialogScope,\n} from '@tamagui/dialog'\nimport { YStack } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\nimport { Alert } from 'react-native'\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog'\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope }\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n])\n\nconst useDialogScope = createDialogScope()\n\ntype AlertDialogProps = DialogProps & {\n native?: boolean\n}\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'AlertDialogTrigger'\n\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst NativeAlertDialogTriggerFrame = styled(YStack, {\n name: 'DialogTrigger',\n})\n\nconst AlertDialogTrigger = React.forwardRef<TamaguiElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n if (props['__native']) {\n const { __native, onPress, __onPress, ...rest } = props as any\n return (\n <NativeAlertDialogTriggerFrame\n {...rest}\n onPress={composeEventHandlers(onPress, __onPress)}\n />\n )\n }\n\n const { __scopeAlertDialog, ...triggerProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogTrigger {...dialogScope} {...triggerProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal'\n\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogPortal {...dialogScope} {...portalProps} />\n}\n\nAlertDialogPortal.displayName = PORTAL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay'\n\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<TamaguiElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogOverlay {...dialogScope} {...overlayProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogOverlay.displayName = OVERLAY_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent'\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<TamaguiElement | null>\n}\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME)\n\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<TamaguiElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n const contentRef = React.useRef<TamaguiElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const cancelRef = React.useRef<TamaguiElement | null>(null)\n\n return (\n <DialogWarningProvider\n contentName={CONTENT_NAME}\n titleName={TITLE_NAME}\n docsSlug=\"alert-dialog\"\n >\n <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>\n <DialogContent\n // @ts-ignore\n role=\"alertdialog\"\n {...dialogScope}\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault()\n if (isWeb) {\n // @ts-ignore\n cancelRef.current?.focus({ preventScroll: true })\n }\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogContent>\n </AlertDialogContentProvider>\n </DialogWarningProvider>\n )\n }\n)\n\nAlertDialogContent.displayName = CONTENT_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle'\n\ntype AlertDialogTitleProps = DialogTitleProps\n\nconst AlertDialogTitle = React.forwardRef<TamaguiElement, AlertDialogTitleProps>(\n (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...titleProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogTitle {...dialogScope} {...titleProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogTitle.displayName = TITLE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription'\n\ntype AlertDialogDescriptionProps = DialogDescriptionProps\n\nconst AlertDialogDescription = React.forwardRef<TamaguiElement, AlertDialogDescriptionProps>(\n (props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...descriptionProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogDescription {...dialogScope} {...descriptionProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction'\n\ntype AlertDialogActionProps = DialogCloseProps\n\nconst AlertDialogAction = React.forwardRef<TamaguiElement, AlertDialogActionProps>(\n (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...actionProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogClose {...dialogScope} {...actionProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogAction.displayName = ACTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel'\n\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<TamaguiElement, AlertDialogCancelProps>(\n (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...cancelProps } = props\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog)\n const dialogScope = useDialogScope(__scopeAlertDialog)\n const ref = useComposedRefs(forwardedRef, cancelRef)\n return <DialogClose {...dialogScope} {...cancelProps} ref={ref} />\n }\n)\n\nAlertDialogCancel.displayName = CANCEL_NAME\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<TamaguiElement>\n}\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n if (process.env.NODE_ENV === 'development') {\n React.useEffect(() => {\n if (!isWeb) return\n const hasDescription = document.getElementById(\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain\n contentRef.current?.getAttribute('aria-describedby')!\n )\n if (!hasDescription) {\n // eslint-disable-next-line no-console\n console.warn(`\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n \n You can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n \n Alternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n \n For more information, see https://tamagui.dev/docs/components/alert-dialog`)\n }\n }, [contentRef])\n }\n\n return null\n}\n\nconst AlertDialogInner: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, native, ...alertDialogProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n const [open, setOpen] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen || false,\n onChange: props.onOpenChange,\n })\n\n let triggerElement: any = null\n let title = ''\n let description = ''\n const buttons: {\n text: string\n onPress: (value?: string | undefined) => void\n style?: 'default' | 'cancel' | 'destructive'\n }[] = []\n\n forEachChildDeep(React.Children.toArray(props.children), (child) => {\n if (!React.isValidElement(child)) return false\n const name = isTamaguiElement(child)\n ? child.type.staticConfig.componentName\n : (child.type['displayName'] as string | undefined)\n switch (name) {\n case TRIGGER_NAME: {\n triggerElement = React.cloneElement(child as any, {\n __native: true,\n })\n return false\n }\n case TITLE_NAME: {\n title = getStringChildren(child)\n return false\n }\n case DESCRIPTION_NAME: {\n description = getStringChildren(child)\n return false\n }\n case ACTION_NAME:\n case CANCEL_NAME: {\n const style = name === ACTION_NAME ? 'default' : 'cancel'\n const text = getStringChildren(child)\n const onPress = () => {\n const childProps = child.props as any\n childProps?.onPress?.({ native: true })\n setOpen(false)\n }\n buttons.push({\n style,\n text,\n // @ts-ignore\n onPress,\n })\n return false\n }\n default: {\n return true\n }\n }\n })\n\n React.useLayoutEffect(() => {\n if (!open || !native) return\n if (title || description) {\n Alert.alert(title, description, buttons)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [native, open])\n\n if (native) {\n return React.cloneElement(triggerElement, {\n __onPress: () => {\n setOpen(true)\n },\n })\n }\n }\n\n return <Dialog {...dialogScope} {...alertDialogProps} modal />\n}\n\nfunction forEachChildDeep(\n children: React.ReactNode[],\n onChild: (el: React.ReactElement) => boolean\n) {\n for (const child of children) {\n if (!React.isValidElement(child)) continue\n if (!onChild(child)) continue\n if (child.props.children) {\n forEachChildDeep(React.Children.toArray(child.props.children), onChild)\n }\n }\n}\n\nfunction getStringChildren(child: React.ReactElement) {\n let string = ''\n forEachChildDeep(React.Children.toArray(child), (child) => {\n if (typeof child.props.children === 'string') {\n string = child.props.children\n return false\n }\n return true\n })\n return string\n}\n\nconst AlertDialog = withStaticProperties(AlertDialogInner, {\n Trigger: AlertDialogTrigger,\n Portal: AlertDialogPortal,\n Overlay: AlertDialogOverlay,\n Content: AlertDialogContent,\n Action: AlertDialogAction,\n Cancel: AlertDialogCancel,\n Title: AlertDialogTitle,\n Description: AlertDialogDescription,\n})\n\nAlertDialog.displayName = ROOT_NAME\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n}\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAyEQ,cAkFE,YAlFF;AAtER,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,0BAA0B;AAC1C;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAGA;AAAA,EAEA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC,YAAY,WAAW;AACvB,SAAS,aAAa;AAMtB,MAAM,YAAY;AAGlB,MAAM,CAAC,0BAA0B,sBAAsB,IAAI,mBAAmB,WAAW;AAAA,EACvF;AACF,CAAC;AAED,MAAM,i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NativeAlertDialogTriggerFrame = styled(YStack, {
|
|
34
34
|
name: "DialogTrigger"
|
|
35
35
|
});
|
|
36
|
-
const AlertDialogTrigger = React.forwardRef(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
const AlertDialogTrigger = React.forwardRef(
|
|
37
|
+
(props, forwardedRef) => {
|
|
38
|
+
if (props["__native"]) {
|
|
39
|
+
const { __native, onPress, __onPress, ...rest } = props;
|
|
40
|
+
return <NativeAlertDialogTriggerFrame {...rest} onPress={composeEventHandlers(onPress, __onPress)} />;
|
|
41
|
+
}
|
|
42
|
+
const { __scopeAlertDialog, ...triggerProps } = props;
|
|
43
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
44
|
+
return <DialogTrigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;
|
|
40
45
|
}
|
|
41
|
-
|
|
42
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
43
|
-
return <DialogTrigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;
|
|
44
|
-
});
|
|
46
|
+
);
|
|
45
47
|
AlertDialogTrigger.displayName = TRIGGER_NAME;
|
|
46
48
|
const PORTAL_NAME = "AlertDialogPortal";
|
|
47
49
|
const AlertDialogPortal = (props) => {
|
|
@@ -51,67 +53,81 @@ const AlertDialogPortal = (props) => {
|
|
|
51
53
|
};
|
|
52
54
|
AlertDialogPortal.displayName = PORTAL_NAME;
|
|
53
55
|
const OVERLAY_NAME = "AlertDialogOverlay";
|
|
54
|
-
const AlertDialogOverlay = React.forwardRef(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
56
|
+
const AlertDialogOverlay = React.forwardRef(
|
|
57
|
+
(props, forwardedRef) => {
|
|
58
|
+
const { __scopeAlertDialog, ...overlayProps } = props;
|
|
59
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
60
|
+
return <DialogOverlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;
|
|
61
|
+
}
|
|
62
|
+
);
|
|
59
63
|
AlertDialogOverlay.displayName = OVERLAY_NAME;
|
|
60
64
|
const CONTENT_NAME = "AlertDialogContent";
|
|
61
65
|
const [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
|
|
62
|
-
const AlertDialogContent = React.forwardRef(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
const AlertDialogContent = React.forwardRef(
|
|
67
|
+
(props, forwardedRef) => {
|
|
68
|
+
const { __scopeAlertDialog, children, ...contentProps } = props;
|
|
69
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
70
|
+
const contentRef = React.useRef(null);
|
|
71
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
72
|
+
const cancelRef = React.useRef(null);
|
|
73
|
+
return <DialogWarningProvider contentName={CONTENT_NAME} titleName={TITLE_NAME} docsSlug="alert-dialog"><AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}><DialogContent role="alertdialog" {...dialogScope} {...contentProps} ref={composedRefs} onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
if (isWeb) {
|
|
76
|
+
cancelRef.current?.focus({ preventScroll: true });
|
|
77
|
+
}
|
|
78
|
+
})} onPointerDownOutside={(event) => event.preventDefault()} onInteractOutside={(event) => event.preventDefault()}>
|
|
79
|
+
<Slottable>{children}</Slottable>
|
|
80
|
+
{process.env.NODE_ENV === "development" && <DescriptionWarning contentRef={contentRef} />}
|
|
81
|
+
</DialogContent></AlertDialogContentProvider></DialogWarningProvider>;
|
|
82
|
+
}
|
|
83
|
+
);
|
|
78
84
|
AlertDialogContent.displayName = CONTENT_NAME;
|
|
79
85
|
const TITLE_NAME = "AlertDialogTitle";
|
|
80
|
-
const AlertDialogTitle = React.forwardRef(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
86
|
+
const AlertDialogTitle = React.forwardRef(
|
|
87
|
+
(props, forwardedRef) => {
|
|
88
|
+
const { __scopeAlertDialog, ...titleProps } = props;
|
|
89
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
90
|
+
return <DialogTitle {...dialogScope} {...titleProps} ref={forwardedRef} />;
|
|
91
|
+
}
|
|
92
|
+
);
|
|
85
93
|
AlertDialogTitle.displayName = TITLE_NAME;
|
|
86
94
|
const DESCRIPTION_NAME = "AlertDialogDescription";
|
|
87
|
-
const AlertDialogDescription = React.forwardRef(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
95
|
+
const AlertDialogDescription = React.forwardRef(
|
|
96
|
+
(props, forwardedRef) => {
|
|
97
|
+
const { __scopeAlertDialog, ...descriptionProps } = props;
|
|
98
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
99
|
+
return <DialogDescription {...dialogScope} {...descriptionProps} ref={forwardedRef} />;
|
|
100
|
+
}
|
|
101
|
+
);
|
|
92
102
|
AlertDialogDescription.displayName = DESCRIPTION_NAME;
|
|
93
103
|
const ACTION_NAME = "AlertDialogAction";
|
|
94
|
-
const AlertDialogAction = React.forwardRef(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
104
|
+
const AlertDialogAction = React.forwardRef(
|
|
105
|
+
(props, forwardedRef) => {
|
|
106
|
+
const { __scopeAlertDialog, ...actionProps } = props;
|
|
107
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
108
|
+
return <DialogClose {...dialogScope} {...actionProps} ref={forwardedRef} />;
|
|
109
|
+
}
|
|
110
|
+
);
|
|
99
111
|
AlertDialogAction.displayName = ACTION_NAME;
|
|
100
112
|
const CANCEL_NAME = "AlertDialogCancel";
|
|
101
|
-
const AlertDialogCancel = React.forwardRef(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
113
|
+
const AlertDialogCancel = React.forwardRef(
|
|
114
|
+
(props, forwardedRef) => {
|
|
115
|
+
const { __scopeAlertDialog, ...cancelProps } = props;
|
|
116
|
+
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
|
|
117
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
118
|
+
const ref = useComposedRefs(forwardedRef, cancelRef);
|
|
119
|
+
return <DialogClose {...dialogScope} {...cancelProps} ref={ref} />;
|
|
120
|
+
}
|
|
121
|
+
);
|
|
108
122
|
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
109
123
|
const DescriptionWarning = ({ contentRef }) => {
|
|
110
124
|
if (process.env.NODE_ENV === "development") {
|
|
111
125
|
React.useEffect(() => {
|
|
112
126
|
if (!isWeb)
|
|
113
127
|
return;
|
|
114
|
-
const hasDescription = document.getElementById(
|
|
128
|
+
const hasDescription = document.getElementById(
|
|
129
|
+
contentRef.current?.getAttribute("aria-describedby")
|
|
130
|
+
);
|
|
115
131
|
if (!hasDescription) {
|
|
116
132
|
console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
117
133
|
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/AlertDialog.tsx"],
|
|
4
4
|
"sourcesContent": ["// forked from radix-ui\n// https://github.com/radix-ui/primitives/blob/main/packages/react/alert-dialog/src/AlertDialog.tsx\n\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n Slottable,\n TamaguiElement,\n composeEventHandlers,\n isTamaguiElement,\n isWeb,\n styled,\n withStaticProperties,\n} from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport {\n Dialog,\n DialogClose,\n DialogCloseProps,\n DialogContent,\n DialogContentProps,\n DialogDescription,\n DialogDescriptionProps,\n DialogOverlay,\n DialogOverlayProps,\n DialogPortal,\n DialogPortalProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n DialogTrigger,\n DialogTriggerProps,\n DialogWarningProvider,\n createDialogScope,\n} from '@tamagui/dialog'\nimport { YStack } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\nimport { Alert } from 'react-native'\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog'\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope }\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n])\n\nconst useDialogScope = createDialogScope()\n\ntype AlertDialogProps = DialogProps & {\n native?: boolean\n}\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'AlertDialogTrigger'\n\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst NativeAlertDialogTriggerFrame = styled(YStack, {\n name: 'DialogTrigger',\n})\n\nconst AlertDialogTrigger = React.forwardRef<TamaguiElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n if (props['__native']) {\n const { __native, onPress, __onPress, ...rest } = props as any\n return (\n <NativeAlertDialogTriggerFrame\n {...rest}\n onPress={composeEventHandlers(onPress, __onPress)}\n />\n )\n }\n\n const { __scopeAlertDialog, ...triggerProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogTrigger {...dialogScope} {...triggerProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal'\n\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogPortal {...dialogScope} {...portalProps} />\n}\n\nAlertDialogPortal.displayName = PORTAL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay'\n\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<TamaguiElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogOverlay {...dialogScope} {...overlayProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogOverlay.displayName = OVERLAY_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent'\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<TamaguiElement | null>\n}\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME)\n\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<TamaguiElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n const contentRef = React.useRef<TamaguiElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const cancelRef = React.useRef<TamaguiElement | null>(null)\n\n return (\n <DialogWarningProvider\n contentName={CONTENT_NAME}\n titleName={TITLE_NAME}\n docsSlug=\"alert-dialog\"\n >\n <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>\n <DialogContent\n // @ts-ignore\n role=\"alertdialog\"\n {...dialogScope}\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault()\n if (isWeb) {\n // @ts-ignore\n cancelRef.current?.focus({ preventScroll: true })\n }\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogContent>\n </AlertDialogContentProvider>\n </DialogWarningProvider>\n )\n }\n)\n\nAlertDialogContent.displayName = CONTENT_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle'\n\ntype AlertDialogTitleProps = DialogTitleProps\n\nconst AlertDialogTitle = React.forwardRef<TamaguiElement, AlertDialogTitleProps>(\n (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...titleProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogTitle {...dialogScope} {...titleProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogTitle.displayName = TITLE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription'\n\ntype AlertDialogDescriptionProps = DialogDescriptionProps\n\nconst AlertDialogDescription = React.forwardRef<TamaguiElement, AlertDialogDescriptionProps>(\n (props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...descriptionProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogDescription {...dialogScope} {...descriptionProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction'\n\ntype AlertDialogActionProps = DialogCloseProps\n\nconst AlertDialogAction = React.forwardRef<TamaguiElement, AlertDialogActionProps>(\n (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...actionProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogClose {...dialogScope} {...actionProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogAction.displayName = ACTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel'\n\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<TamaguiElement, AlertDialogCancelProps>(\n (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...cancelProps } = props\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog)\n const dialogScope = useDialogScope(__scopeAlertDialog)\n const ref = useComposedRefs(forwardedRef, cancelRef)\n return <DialogClose {...dialogScope} {...cancelProps} ref={ref} />\n }\n)\n\nAlertDialogCancel.displayName = CANCEL_NAME\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<TamaguiElement>\n}\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n if (process.env.NODE_ENV === 'development') {\n React.useEffect(() => {\n if (!isWeb) return\n const hasDescription = document.getElementById(\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain\n contentRef.current?.getAttribute('aria-describedby')!\n )\n if (!hasDescription) {\n // eslint-disable-next-line no-console\n console.warn(`\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n \n You can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n \n Alternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n \n For more information, see https://tamagui.dev/docs/components/alert-dialog`)\n }\n }, [contentRef])\n }\n\n return null\n}\n\nconst AlertDialogInner: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, native, ...alertDialogProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n const [open, setOpen] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen || false,\n onChange: props.onOpenChange,\n })\n\n let triggerElement: any = null\n let title = ''\n let description = ''\n const buttons: {\n text: string\n onPress: (value?: string | undefined) => void\n style?: 'default' | 'cancel' | 'destructive'\n }[] = []\n\n forEachChildDeep(React.Children.toArray(props.children), (child) => {\n if (!React.isValidElement(child)) return false\n const name = isTamaguiElement(child)\n ? child.type.staticConfig.componentName\n : (child.type['displayName'] as string | undefined)\n switch (name) {\n case TRIGGER_NAME: {\n triggerElement = React.cloneElement(child as any, {\n __native: true,\n })\n return false\n }\n case TITLE_NAME: {\n title = getStringChildren(child)\n return false\n }\n case DESCRIPTION_NAME: {\n description = getStringChildren(child)\n return false\n }\n case ACTION_NAME:\n case CANCEL_NAME: {\n const style = name === ACTION_NAME ? 'default' : 'cancel'\n const text = getStringChildren(child)\n const onPress = () => {\n const childProps = child.props as any\n childProps?.onPress?.({ native: true })\n setOpen(false)\n }\n buttons.push({\n style,\n text,\n // @ts-ignore\n onPress,\n })\n return false\n }\n default: {\n return true\n }\n }\n })\n\n React.useLayoutEffect(() => {\n if (!open || !native) return\n if (title || description) {\n Alert.alert(title, description, buttons)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [native, open])\n\n if (native) {\n return React.cloneElement(triggerElement, {\n __onPress: () => {\n setOpen(true)\n },\n })\n }\n }\n\n return <Dialog {...dialogScope} {...alertDialogProps} modal />\n}\n\nfunction forEachChildDeep(\n children: React.ReactNode[],\n onChild: (el: React.ReactElement) => boolean\n) {\n for (const child of children) {\n if (!React.isValidElement(child)) continue\n if (!onChild(child)) continue\n if (child.props.children) {\n forEachChildDeep(React.Children.toArray(child.props.children), onChild)\n }\n }\n}\n\nfunction getStringChildren(child: React.ReactElement) {\n let string = ''\n forEachChildDeep(React.Children.toArray(child), (child) => {\n if (typeof child.props.children === 'string') {\n string = child.props.children\n return false\n }\n return true\n })\n return string\n}\n\nconst AlertDialog = withStaticProperties(AlertDialogInner, {\n Trigger: AlertDialogTrigger,\n Portal: AlertDialogPortal,\n Overlay: AlertDialogOverlay,\n Content: AlertDialogContent,\n Action: AlertDialogAction,\n Cancel: AlertDialogCancel,\n Title: AlertDialogTitle,\n Description: AlertDialogDescription,\n})\n\nAlertDialog.displayName = ROOT_NAME\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n}\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n}\n"],
|
|
5
|
-
"mappings": "AAGA;
|
|
6
|
-
"names": []
|
|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|
2
2
|
"name": "@tamagui/alert-dialog",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.154",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -21,21 +21,21 @@
|
|
|
21
21
|
"clean:build": "tamagui-build clean:build"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tamagui/animate-presence": "^1.0.1-beta.
|
|
25
|
-
"@tamagui/aria-hidden": "^1.0.1-beta.
|
|
26
|
-
"@tamagui/compose-refs": "^1.0.1-beta.
|
|
27
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
28
|
-
"@tamagui/create-context": "^1.0.1-beta.
|
|
29
|
-
"@tamagui/dialog": "^1.0.1-beta.
|
|
30
|
-
"@tamagui/dismissable": "^1.0.1-beta.
|
|
31
|
-
"@tamagui/focus-scope": "^1.0.1-beta.
|
|
32
|
-
"@tamagui/polyfill-dev": "^1.0.1-beta.
|
|
33
|
-
"@tamagui/popper": "^1.0.1-beta.
|
|
34
|
-
"@tamagui/portal": "^1.0.1-beta.
|
|
35
|
-
"@tamagui/remove-scroll": "^1.0.1-beta.
|
|
36
|
-
"@tamagui/stacks": "^1.0.1-beta.
|
|
37
|
-
"@tamagui/text": "^1.0.1-beta.
|
|
38
|
-
"@tamagui/use-controllable-state": "^1.0.1-beta.
|
|
24
|
+
"@tamagui/animate-presence": "^1.0.1-beta.154",
|
|
25
|
+
"@tamagui/aria-hidden": "^1.0.1-beta.154",
|
|
26
|
+
"@tamagui/compose-refs": "^1.0.1-beta.154",
|
|
27
|
+
"@tamagui/core": "^1.0.1-beta.154",
|
|
28
|
+
"@tamagui/create-context": "^1.0.1-beta.154",
|
|
29
|
+
"@tamagui/dialog": "^1.0.1-beta.154",
|
|
30
|
+
"@tamagui/dismissable": "^1.0.1-beta.154",
|
|
31
|
+
"@tamagui/focus-scope": "^1.0.1-beta.154",
|
|
32
|
+
"@tamagui/polyfill-dev": "^1.0.1-beta.154",
|
|
33
|
+
"@tamagui/popper": "^1.0.1-beta.154",
|
|
34
|
+
"@tamagui/portal": "^1.0.1-beta.154",
|
|
35
|
+
"@tamagui/remove-scroll": "^1.0.1-beta.154",
|
|
36
|
+
"@tamagui/stacks": "^1.0.1-beta.154",
|
|
37
|
+
"@tamagui/text": "^1.0.1-beta.154",
|
|
38
|
+
"@tamagui/use-controllable-state": "^1.0.1-beta.154"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "*",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react-native": "*"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
46
|
+
"@tamagui/build": "^1.0.1-beta.154",
|
|
47
47
|
"@types/react-dom": "^18.0.3",
|
|
48
48
|
"@types/react-native": "^0.69.2",
|
|
49
49
|
"react": "*",
|