@tamagui/alert-dialog 1.61.2 → 1.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/AlertDialog.js +40 -185
- package/dist/cjs/AlertDialog.js.map +2 -2
- package/dist/cjs/AlertDialog.native.js +233 -0
- package/dist/cjs/AlertDialog.native.js.map +6 -0
- package/dist/cjs/index.js +4 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +20 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/esm/AlertDialog.js +35 -169
- package/dist/esm/AlertDialog.js.map +2 -2
- package/dist/jsx/AlertDialog.js +33 -164
- package/dist/jsx/AlertDialog.js.map +2 -2
- package/dist/jsx/AlertDialog.native.js +219 -0
- package/dist/jsx/AlertDialog.native.js.map +6 -0
- package/dist/jsx/index.native.js +2 -0
- package/dist/jsx/index.native.js.map +6 -0
- package/package.json +17 -17
package/dist/cjs/AlertDialog.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
14
11
|
for (let key of __getOwnPropNames(from))
|
|
15
|
-
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
13
|
return to;
|
|
19
14
|
};
|
|
20
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
@@ -22,10 +17,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
17
|
// file that has been converted to a CommonJS file using a Babel-
|
|
23
18
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
19
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable:
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
26
21
|
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
29
23
|
var AlertDialog_exports = {};
|
|
30
24
|
__export(AlertDialog_exports, {
|
|
31
25
|
AlertDialog: () => AlertDialog,
|
|
@@ -40,26 +34,14 @@ __export(AlertDialog_exports, {
|
|
|
40
34
|
createAlertDialogScope: () => createAlertDialogScope
|
|
41
35
|
});
|
|
42
36
|
module.exports = __toCommonJS(AlertDialog_exports);
|
|
43
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
-
|
|
45
|
-
var import_core = require("@tamagui/core");
|
|
46
|
-
var import_create_context = require("@tamagui/create-context");
|
|
47
|
-
var import_dialog = require("@tamagui/dialog");
|
|
48
|
-
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
49
|
-
var React = __toESM(require("react"));
|
|
50
|
-
var import_react_native = require("react-native");
|
|
51
|
-
const ROOT_NAME = "AlertDialog";
|
|
52
|
-
const [createAlertDialogContext, createAlertDialogScope] = (0, import_create_context.createContextScope)(ROOT_NAME, [
|
|
37
|
+
var import_compose_refs = require("@tamagui/compose-refs"), import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_dialog = require("@tamagui/dialog"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_react_native = require("react-native"), import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
const ROOT_NAME = "AlertDialog", [createAlertDialogContext, createAlertDialogScope] = (0, import_create_context.createContextScope)(ROOT_NAME, [
|
|
53
39
|
import_dialog.createDialogScope
|
|
54
|
-
])
|
|
55
|
-
const useDialogScope = (0, import_dialog.createDialogScope)();
|
|
56
|
-
const TRIGGER_NAME = "AlertDialogTrigger";
|
|
57
|
-
const NativeAlertDialogTriggerFrame = (0, import_core.styled)(import_core.View, {
|
|
40
|
+
]), useDialogScope = (0, import_dialog.createDialogScope)(), TRIGGER_NAME = "AlertDialogTrigger", NativeAlertDialogTriggerFrame = (0, import_core.styled)(import_core.View, {
|
|
58
41
|
name: TRIGGER_NAME
|
|
59
|
-
})
|
|
60
|
-
const AlertDialogTrigger = React.forwardRef(
|
|
42
|
+
}), AlertDialogTrigger = React.forwardRef(
|
|
61
43
|
(props, forwardedRef) => {
|
|
62
|
-
if (props
|
|
44
|
+
if (props.__native) {
|
|
63
45
|
const { __native, onPress, __onPress, ...rest } = props;
|
|
64
46
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
47
|
NativeAlertDialogTriggerFrame,
|
|
@@ -69,42 +51,30 @@ const AlertDialogTrigger = React.forwardRef(
|
|
|
69
51
|
}
|
|
70
52
|
);
|
|
71
53
|
}
|
|
72
|
-
const { __scopeAlertDialog, ...triggerProps } = props;
|
|
73
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
54
|
+
const { __scopeAlertDialog, ...triggerProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
74
55
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTrigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });
|
|
75
56
|
}
|
|
76
57
|
);
|
|
77
58
|
AlertDialogTrigger.displayName = TRIGGER_NAME;
|
|
78
|
-
const PORTAL_NAME = "AlertDialogPortal"
|
|
79
|
-
const
|
|
80
|
-
const { __scopeAlertDialog, ...portalProps } = props;
|
|
81
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
59
|
+
const PORTAL_NAME = "AlertDialogPortal", AlertDialogPortal = (props) => {
|
|
60
|
+
const { __scopeAlertDialog, ...portalProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
82
61
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogPortal, { ...dialogScope, ...portalProps });
|
|
83
62
|
};
|
|
84
63
|
AlertDialogPortal.displayName = PORTAL_NAME;
|
|
85
|
-
const OVERLAY_NAME = "AlertDialogOverlay"
|
|
86
|
-
const AlertDialogOverlayFrame = (0, import_core.styled)(import_dialog.DialogOverlayFrame, {
|
|
64
|
+
const OVERLAY_NAME = "AlertDialogOverlay", AlertDialogOverlayFrame = (0, import_core.styled)(import_dialog.DialogOverlayFrame, {
|
|
87
65
|
name: OVERLAY_NAME
|
|
88
|
-
})
|
|
89
|
-
const AlertDialogOverlay = AlertDialogOverlayFrame.extractable(
|
|
66
|
+
}), AlertDialogOverlay = AlertDialogOverlayFrame.extractable(
|
|
90
67
|
React.forwardRef(
|
|
91
68
|
(props, forwardedRef) => {
|
|
92
|
-
const { __scopeAlertDialog, ...overlayProps } = props;
|
|
93
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
69
|
+
const { __scopeAlertDialog, ...overlayProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
94
70
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogOverlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
|
|
95
71
|
}
|
|
96
72
|
)
|
|
97
73
|
);
|
|
98
74
|
AlertDialogOverlay.displayName = OVERLAY_NAME;
|
|
99
|
-
const CONTENT_NAME = "AlertDialogContent"
|
|
100
|
-
const [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
|
|
101
|
-
const AlertDialogContent = React.forwardRef(
|
|
75
|
+
const CONTENT_NAME = "AlertDialogContent", [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME), AlertDialogContent = React.forwardRef(
|
|
102
76
|
(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);
|
|
77
|
+
const { __scopeAlertDialog, children, ...contentProps } = props, dialogScope = useDialogScope(__scopeAlertDialog), contentRef = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef), cancelRef = React.useRef(null);
|
|
108
78
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
109
79
|
import_dialog.DialogWarningProvider,
|
|
110
80
|
{
|
|
@@ -121,11 +91,7 @@ const AlertDialogContent = React.forwardRef(
|
|
|
121
91
|
onOpenAutoFocus: (0, import_core.composeEventHandlers)(
|
|
122
92
|
contentProps.onOpenAutoFocus,
|
|
123
93
|
(event) => {
|
|
124
|
-
|
|
125
|
-
event.preventDefault();
|
|
126
|
-
if (import_core.isWeb) {
|
|
127
|
-
(_a = cancelRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
128
|
-
}
|
|
94
|
+
event.preventDefault(), import_core.isWeb && cancelRef.current?.focus({ preventScroll: !0 });
|
|
129
95
|
}
|
|
130
96
|
),
|
|
131
97
|
onPointerDownOutside: (event) => event.preventDefault(),
|
|
@@ -141,161 +107,50 @@ const AlertDialogContent = React.forwardRef(
|
|
|
141
107
|
}
|
|
142
108
|
);
|
|
143
109
|
AlertDialogContent.displayName = CONTENT_NAME;
|
|
144
|
-
const TITLE_NAME = "AlertDialogTitle"
|
|
145
|
-
const AlertDialogTitle = React.forwardRef(
|
|
110
|
+
const TITLE_NAME = "AlertDialogTitle", AlertDialogTitle = React.forwardRef(
|
|
146
111
|
(props, forwardedRef) => {
|
|
147
|
-
const { __scopeAlertDialog, ...titleProps } = props;
|
|
148
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
112
|
+
const { __scopeAlertDialog, ...titleProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
149
113
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTitle, { ...dialogScope, ...titleProps, ref: forwardedRef });
|
|
150
114
|
}
|
|
151
115
|
);
|
|
152
116
|
AlertDialogTitle.displayName = TITLE_NAME;
|
|
153
|
-
const DESCRIPTION_NAME = "AlertDialogDescription"
|
|
154
|
-
const
|
|
155
|
-
const { __scopeAlertDialog, ...descriptionProps } = props;
|
|
156
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
117
|
+
const DESCRIPTION_NAME = "AlertDialogDescription", AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
|
|
118
|
+
const { __scopeAlertDialog, ...descriptionProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
157
119
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogDescription, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
|
|
158
120
|
});
|
|
159
121
|
AlertDialogDescription.displayName = DESCRIPTION_NAME;
|
|
160
|
-
const ACTION_NAME = "AlertDialogAction"
|
|
161
|
-
const AlertDialogAction = React.forwardRef(
|
|
122
|
+
const ACTION_NAME = "AlertDialogAction", AlertDialogAction = React.forwardRef(
|
|
162
123
|
(props, forwardedRef) => {
|
|
163
|
-
const { __scopeAlertDialog, ...actionProps } = props;
|
|
164
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
124
|
+
const { __scopeAlertDialog, ...actionProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
165
125
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, { ...dialogScope, ...actionProps, ref: forwardedRef });
|
|
166
126
|
}
|
|
167
127
|
);
|
|
168
128
|
AlertDialogAction.displayName = ACTION_NAME;
|
|
169
|
-
const CANCEL_NAME = "AlertDialogCancel"
|
|
170
|
-
const AlertDialogCancel = React.forwardRef(
|
|
129
|
+
const CANCEL_NAME = "AlertDialogCancel", AlertDialogCancel = React.forwardRef(
|
|
171
130
|
(props, forwardedRef) => {
|
|
172
|
-
const { __scopeAlertDialog, ...cancelProps } = props;
|
|
173
|
-
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
|
|
174
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
175
|
-
const ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
|
|
131
|
+
const { __scopeAlertDialog, ...cancelProps } = props, { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog), dialogScope = useDialogScope(__scopeAlertDialog), ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
|
|
176
132
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, { ...dialogScope, ...cancelProps, ref });
|
|
177
133
|
}
|
|
178
134
|
);
|
|
179
135
|
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
180
|
-
const DescriptionWarning = ({ contentRef }) => {
|
|
181
|
-
if (
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
|
189
|
-
(_a = contentRef.current) == null ? void 0 : _a.getAttribute("aria-describedby")
|
|
190
|
-
);
|
|
191
|
-
if (!hasDescription) {
|
|
192
|
-
console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
136
|
+
const DescriptionWarning = ({ contentRef }) => (process.env.NODE_ENV === "development" && React.useEffect(() => {
|
|
137
|
+
if (!import_core.isWeb)
|
|
138
|
+
return;
|
|
139
|
+
document.getElementById(
|
|
140
|
+
// @ts-ignore
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
|
142
|
+
contentRef.current?.getAttribute("aria-describedby")
|
|
143
|
+
) || console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
193
144
|
|
|
194
145
|
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.
|
|
195
146
|
|
|
196
147
|
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.
|
|
197
148
|
|
|
198
149
|
For more information, see https://tamagui.dev/docs/components/alert-dialog`);
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
return null;
|
|
150
|
+
}, [contentRef]), null), AlertDialogInner = (props) => {
|
|
151
|
+
const { __scopeAlertDialog, native, ...alertDialogProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, { ...dialogScope, ...alertDialogProps, modal: !0 });
|
|
203
153
|
};
|
|
204
|
-
const AlertDialogInner = (props) => {
|
|
205
|
-
const { __scopeAlertDialog, native, ...alertDialogProps } = props;
|
|
206
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
207
|
-
if (process.env.TAMAGUI_TARGET === "native") {
|
|
208
|
-
const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
|
|
209
|
-
prop: props.open,
|
|
210
|
-
defaultProp: props.defaultOpen || false,
|
|
211
|
-
onChange: props.onOpenChange,
|
|
212
|
-
transition: true
|
|
213
|
-
});
|
|
214
|
-
let triggerElement = null;
|
|
215
|
-
let title = "";
|
|
216
|
-
let description = "";
|
|
217
|
-
const buttons = [];
|
|
218
|
-
forEachChildDeep(React.Children.toArray(props.children), (child) => {
|
|
219
|
-
if (!React.isValidElement(child))
|
|
220
|
-
return false;
|
|
221
|
-
const name = (0, import_core.isTamaguiElement)(child) ? child.type.staticConfig.componentName : child.type["displayName"];
|
|
222
|
-
switch (name) {
|
|
223
|
-
case TRIGGER_NAME: {
|
|
224
|
-
triggerElement = React.cloneElement(child, {
|
|
225
|
-
__native: true
|
|
226
|
-
});
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
case TITLE_NAME: {
|
|
230
|
-
title = getStringChildren(child);
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
case DESCRIPTION_NAME: {
|
|
234
|
-
description = getStringChildren(child);
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
|
-
case ACTION_NAME:
|
|
238
|
-
case CANCEL_NAME: {
|
|
239
|
-
const style = name === ACTION_NAME ? "default" : "cancel";
|
|
240
|
-
const text = getStringChildren(child);
|
|
241
|
-
const onPress = () => {
|
|
242
|
-
var _a;
|
|
243
|
-
const childProps = child.props;
|
|
244
|
-
(_a = childProps == null ? void 0 : childProps.onPress) == null ? void 0 : _a.call(childProps, { native: true });
|
|
245
|
-
setOpen(false);
|
|
246
|
-
};
|
|
247
|
-
buttons.push({
|
|
248
|
-
style,
|
|
249
|
-
text,
|
|
250
|
-
// @ts-ignore
|
|
251
|
-
onPress
|
|
252
|
-
});
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
default: {
|
|
256
|
-
return true;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
(0, import_core.useIsomorphicLayoutEffect)(() => {
|
|
261
|
-
if (!open || !native)
|
|
262
|
-
return;
|
|
263
|
-
if (title || description) {
|
|
264
|
-
import_react_native.Alert.alert(title, description, buttons);
|
|
265
|
-
}
|
|
266
|
-
}, [native, open]);
|
|
267
|
-
if (native) {
|
|
268
|
-
return React.cloneElement(triggerElement, {
|
|
269
|
-
__onPress: () => {
|
|
270
|
-
setOpen(true);
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, { ...dialogScope, ...alertDialogProps, modal: true });
|
|
276
|
-
};
|
|
277
|
-
function forEachChildDeep(children, onChild) {
|
|
278
|
-
for (const child of children) {
|
|
279
|
-
if (!React.isValidElement(child))
|
|
280
|
-
continue;
|
|
281
|
-
if (!onChild(child))
|
|
282
|
-
continue;
|
|
283
|
-
if (child.props.children) {
|
|
284
|
-
forEachChildDeep(React.Children.toArray(child.props.children), onChild);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
function getStringChildren(child) {
|
|
289
|
-
let string = "";
|
|
290
|
-
forEachChildDeep(React.Children.toArray(child), (child2) => {
|
|
291
|
-
if (typeof child2.props.children === "string") {
|
|
292
|
-
string = child2.props.children;
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
return true;
|
|
296
|
-
});
|
|
297
|
-
return string;
|
|
298
|
-
}
|
|
299
154
|
const AlertDialog = (0, import_core.withStaticProperties)(AlertDialogInner, {
|
|
300
155
|
Trigger: AlertDialogTrigger,
|
|
301
156
|
Portal: AlertDialogPortal,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources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AA;AAAA,6CAEO,YAAY,qBAAqB,gBAAgB;AAAA;AAAA,oKAEsE,YAAY;AAAA;AAAA,mFAE7F;AAE/E,GAAG,CAAC,UAAU,CAAC,GAGV,OAGH,mBAA+C,CACnD,UACG;AACH,QAAM,EAAE,oBAAoB,QAAQ,GAAG,iBAAiB,IAAI,OACtD,cAAc,eAAe,kBAAkB;AA+ErD,SAAO,4CAAC,wBAAQ,GAAG,aAAc,GAAG,kBAAkB,OAAK,IAAC;AAC9D;AA2BA,MAAM,kBAAc,kCAAqB,kBAAkB;AAAA,EACzD,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAED,YAAY,cAAc;",
|
|
5
|
+
"names": []
|
|
6
6
|
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
10
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
+
var AlertDialog_exports = {};
|
|
25
|
+
__export(AlertDialog_exports, {
|
|
26
|
+
AlertDialog: () => AlertDialog,
|
|
27
|
+
AlertDialogAction: () => AlertDialogAction,
|
|
28
|
+
AlertDialogCancel: () => AlertDialogCancel,
|
|
29
|
+
AlertDialogContent: () => AlertDialogContent,
|
|
30
|
+
AlertDialogDescription: () => AlertDialogDescription,
|
|
31
|
+
AlertDialogOverlay: () => AlertDialogOverlay,
|
|
32
|
+
AlertDialogPortal: () => AlertDialogPortal,
|
|
33
|
+
AlertDialogTitle: () => AlertDialogTitle,
|
|
34
|
+
AlertDialogTrigger: () => AlertDialogTrigger,
|
|
35
|
+
createAlertDialogScope: () => createAlertDialogScope
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(AlertDialog_exports);
|
|
38
|
+
var import_compose_refs = require("@tamagui/compose-refs"), import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_dialog = require("@tamagui/dialog"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_react_native = require("react-native"), import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
+
const ROOT_NAME = "AlertDialog", [createAlertDialogContext, createAlertDialogScope] = (0, import_create_context.createContextScope)(ROOT_NAME, [
|
|
40
|
+
import_dialog.createDialogScope
|
|
41
|
+
]), useDialogScope = (0, import_dialog.createDialogScope)(), TRIGGER_NAME = "AlertDialogTrigger", NativeAlertDialogTriggerFrame = (0, import_core.styled)(import_core.View, {
|
|
42
|
+
name: TRIGGER_NAME
|
|
43
|
+
}), AlertDialogTrigger = React.forwardRef(
|
|
44
|
+
(props, forwardedRef) => {
|
|
45
|
+
if (props.__native) {
|
|
46
|
+
const { __native, onPress, __onPress, ...rest } = props;
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
+
NativeAlertDialogTriggerFrame,
|
|
49
|
+
{
|
|
50
|
+
...rest,
|
|
51
|
+
onPress: (0, import_core.composeEventHandlers)(onPress, __onPress)
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
const { __scopeAlertDialog, ...triggerProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTrigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
AlertDialogTrigger.displayName = TRIGGER_NAME;
|
|
60
|
+
const PORTAL_NAME = "AlertDialogPortal", AlertDialogPortal = (props) => {
|
|
61
|
+
const { __scopeAlertDialog, ...portalProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogPortal, { ...dialogScope, ...portalProps });
|
|
63
|
+
};
|
|
64
|
+
AlertDialogPortal.displayName = PORTAL_NAME;
|
|
65
|
+
const OVERLAY_NAME = "AlertDialogOverlay", AlertDialogOverlayFrame = (0, import_core.styled)(import_dialog.DialogOverlayFrame, {
|
|
66
|
+
name: OVERLAY_NAME
|
|
67
|
+
}), AlertDialogOverlay = AlertDialogOverlayFrame.extractable(
|
|
68
|
+
React.forwardRef(
|
|
69
|
+
(props, forwardedRef) => {
|
|
70
|
+
const { __scopeAlertDialog, ...overlayProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogOverlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
);
|
|
75
|
+
AlertDialogOverlay.displayName = OVERLAY_NAME;
|
|
76
|
+
const CONTENT_NAME = "AlertDialogContent", [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME), AlertDialogContent = React.forwardRef(
|
|
77
|
+
(props, forwardedRef) => {
|
|
78
|
+
const { __scopeAlertDialog, children, ...contentProps } = props, dialogScope = useDialogScope(__scopeAlertDialog), contentRef = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef), cancelRef = React.useRef(null);
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
import_dialog.DialogWarningProvider,
|
|
81
|
+
{
|
|
82
|
+
contentName: CONTENT_NAME,
|
|
83
|
+
titleName: TITLE_NAME,
|
|
84
|
+
docsSlug: "alert-dialog",
|
|
85
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
86
|
+
import_dialog.DialogContent,
|
|
87
|
+
{
|
|
88
|
+
role: "alertdialog",
|
|
89
|
+
...dialogScope,
|
|
90
|
+
...contentProps,
|
|
91
|
+
ref: composedRefs,
|
|
92
|
+
onOpenAutoFocus: (0, import_core.composeEventHandlers)(
|
|
93
|
+
contentProps.onOpenAutoFocus,
|
|
94
|
+
(event) => {
|
|
95
|
+
event.preventDefault(), import_core.isWeb && cancelRef.current?.focus({ preventScroll: !0 });
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
onPointerDownOutside: (event) => event.preventDefault(),
|
|
99
|
+
onInteractOutside: (event) => event.preventDefault(),
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slottable, { children }),
|
|
102
|
+
process.env.NODE_ENV === "development" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionWarning, { contentRef })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
) })
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
AlertDialogContent.displayName = CONTENT_NAME;
|
|
111
|
+
const TITLE_NAME = "AlertDialogTitle", AlertDialogTitle = React.forwardRef(
|
|
112
|
+
(props, forwardedRef) => {
|
|
113
|
+
const { __scopeAlertDialog, ...titleProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTitle, { ...dialogScope, ...titleProps, ref: forwardedRef });
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
AlertDialogTitle.displayName = TITLE_NAME;
|
|
118
|
+
const DESCRIPTION_NAME = "AlertDialogDescription", AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
|
|
119
|
+
const { __scopeAlertDialog, ...descriptionProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogDescription, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
|
|
121
|
+
});
|
|
122
|
+
AlertDialogDescription.displayName = DESCRIPTION_NAME;
|
|
123
|
+
const ACTION_NAME = "AlertDialogAction", AlertDialogAction = React.forwardRef(
|
|
124
|
+
(props, forwardedRef) => {
|
|
125
|
+
const { __scopeAlertDialog, ...actionProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, { ...dialogScope, ...actionProps, ref: forwardedRef });
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
AlertDialogAction.displayName = ACTION_NAME;
|
|
130
|
+
const CANCEL_NAME = "AlertDialogCancel", AlertDialogCancel = React.forwardRef(
|
|
131
|
+
(props, forwardedRef) => {
|
|
132
|
+
const { __scopeAlertDialog, ...cancelProps } = props, { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog), dialogScope = useDialogScope(__scopeAlertDialog), ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
|
|
133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, { ...dialogScope, ...cancelProps, ref });
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
137
|
+
const DescriptionWarning = ({ contentRef }) => (process.env.NODE_ENV === "development" && React.useEffect(() => {
|
|
138
|
+
if (!import_core.isWeb)
|
|
139
|
+
return;
|
|
140
|
+
document.getElementById(
|
|
141
|
+
// @ts-ignore
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
|
143
|
+
contentRef.current?.getAttribute("aria-describedby")
|
|
144
|
+
) || console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
145
|
+
|
|
146
|
+
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.
|
|
147
|
+
|
|
148
|
+
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.
|
|
149
|
+
|
|
150
|
+
For more information, see https://tamagui.dev/docs/components/alert-dialog`);
|
|
151
|
+
}, [contentRef]), null), AlertDialogInner = (props) => {
|
|
152
|
+
const { __scopeAlertDialog, native, ...alertDialogProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
153
|
+
{
|
|
154
|
+
const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
|
|
155
|
+
prop: props.open,
|
|
156
|
+
defaultProp: props.defaultOpen || !1,
|
|
157
|
+
onChange: props.onOpenChange,
|
|
158
|
+
transition: !0
|
|
159
|
+
});
|
|
160
|
+
let triggerElement = null, title = "", description = "";
|
|
161
|
+
const buttons = [];
|
|
162
|
+
if (forEachChildDeep(React.Children.toArray(props.children), (child) => {
|
|
163
|
+
if (!React.isValidElement(child))
|
|
164
|
+
return !1;
|
|
165
|
+
const name = (0, import_core.isTamaguiElement)(child) ? child.type.staticConfig.componentName : child.type.displayName;
|
|
166
|
+
switch (name) {
|
|
167
|
+
case TRIGGER_NAME:
|
|
168
|
+
return triggerElement = React.cloneElement(child, {
|
|
169
|
+
__native: !0
|
|
170
|
+
}), !1;
|
|
171
|
+
case TITLE_NAME:
|
|
172
|
+
return title = getStringChildren(child), !1;
|
|
173
|
+
case DESCRIPTION_NAME:
|
|
174
|
+
return description = getStringChildren(child), !1;
|
|
175
|
+
case ACTION_NAME:
|
|
176
|
+
case CANCEL_NAME: {
|
|
177
|
+
const style = name === ACTION_NAME ? "default" : "cancel", text = getStringChildren(child), onPress = () => {
|
|
178
|
+
child.props?.onPress?.({ native: !0 }), setOpen(!1);
|
|
179
|
+
};
|
|
180
|
+
return buttons.push({
|
|
181
|
+
style,
|
|
182
|
+
text,
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
onPress
|
|
185
|
+
}), !1;
|
|
186
|
+
}
|
|
187
|
+
default:
|
|
188
|
+
return !0;
|
|
189
|
+
}
|
|
190
|
+
}), (0, import_core.useIsomorphicLayoutEffect)(() => {
|
|
191
|
+
!open || !native || (title || description) && import_react_native.Alert.alert(title, description, buttons);
|
|
192
|
+
}, [native, open]), native)
|
|
193
|
+
return React.cloneElement(triggerElement, {
|
|
194
|
+
__onPress: () => {
|
|
195
|
+
setOpen(!0);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, { ...dialogScope, ...alertDialogProps, modal: !0 });
|
|
200
|
+
};
|
|
201
|
+
function forEachChildDeep(children, onChild) {
|
|
202
|
+
for (const child of children)
|
|
203
|
+
React.isValidElement(child) && onChild(child) && child.props.children && forEachChildDeep(React.Children.toArray(child.props.children), onChild);
|
|
204
|
+
}
|
|
205
|
+
function getStringChildren(child) {
|
|
206
|
+
let string = "";
|
|
207
|
+
return forEachChildDeep(React.Children.toArray(child), (child2) => typeof child2.props.children == "string" ? (string = child2.props.children, !1) : !0), string;
|
|
208
|
+
}
|
|
209
|
+
const AlertDialog = (0, import_core.withStaticProperties)(AlertDialogInner, {
|
|
210
|
+
Trigger: AlertDialogTrigger,
|
|
211
|
+
Portal: AlertDialogPortal,
|
|
212
|
+
Overlay: AlertDialogOverlay,
|
|
213
|
+
Content: AlertDialogContent,
|
|
214
|
+
Action: AlertDialogAction,
|
|
215
|
+
Cancel: AlertDialogCancel,
|
|
216
|
+
Title: AlertDialogTitle,
|
|
217
|
+
Description: AlertDialogDescription
|
|
218
|
+
});
|
|
219
|
+
AlertDialog.displayName = ROOT_NAME;
|
|
220
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
221
|
+
0 && (module.exports = {
|
|
222
|
+
AlertDialog,
|
|
223
|
+
AlertDialogAction,
|
|
224
|
+
AlertDialogCancel,
|
|
225
|
+
AlertDialogContent,
|
|
226
|
+
AlertDialogDescription,
|
|
227
|
+
AlertDialogOverlay,
|
|
228
|
+
AlertDialogPortal,
|
|
229
|
+
AlertDialogTitle,
|
|
230
|
+
AlertDialogTrigger,
|
|
231
|
+
createAlertDialogScope
|
|
232
|
+
});
|
|
233
|
+
//# sourceMappingURL=AlertDialog.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/AlertDialog.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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MAAM;AACf,kBAAQ,EAAI;AAAA,QACd;AAAA,MACF,CAAC;AAAA,EAEL;AAEA,SAAO,4CAAC,wBAAQ,GAAG,aAAc,GAAG,kBAAkB,OAAK,IAAC;AAC9D;AAEA,SAAS,iBACP,UACA,SACA;AACA,aAAW,SAAS;AAClB,IAAK,MAAM,eAAe,KAAK,KAC1B,QAAQ,KAAK,KACd,MAAM,MAAM,YACd,iBAAiB,MAAM,SAAS,QAAQ,MAAM,MAAM,QAAQ,GAAG,OAAO;AAG5E;AAEA,SAAS,kBAAkB,OAA2B;AACpD,MAAI,SAAS;AACb,0BAAiB,MAAM,SAAS,QAAQ,KAAK,GAAG,CAACA,WAC3C,OAAOA,OAAM,MAAM,YAAa,YAClC,SAASA,OAAM,MAAM,UACd,MAEF,EACR,GACM;AACT;AAEA,MAAM,kBAAc,kCAAqB,kBAAkB;AAAA,EACzD,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAED,YAAY,cAAc;",
|
|
5
|
+
"names": ["child"]
|
|
6
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
7
|
for (let key of __getOwnPropNames(from))
|
|
9
|
-
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
8
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
9
|
return to;
|
|
13
|
-
};
|
|
14
|
-
var
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
10
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
12
|
var src_exports = {};
|
|
17
13
|
module.exports = __toCommonJS(src_exports);
|
|
18
14
|
__reExport(src_exports, require("./AlertDialog"), module.exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
+
var src_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(src_exports);
|
|
15
|
+
__reExport(src_exports, require("./AlertDialog"), module.exports);
|
|
16
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
17
|
+
0 && (module.exports = {
|
|
18
|
+
...require("./AlertDialog")
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=index.js.map
|