@tamagui/alert-dialog 2.7.7 → 3.0.0-beta.643.1
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.cjs +173 -230
- package/dist/cjs/AlertDialog.native.cjs +309 -0
- package/dist/cjs/AlertDialog.native.js +255 -322
- package/dist/cjs/AlertDialog.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.native.cjs +21 -0
- package/dist/cjs/index.native.js +10 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/AlertDialog.mjs +138 -187
- package/dist/esm/AlertDialog.mjs.map +1 -1
- package/dist/esm/AlertDialog.native.js +227 -289
- package/dist/esm/AlertDialog.native.js.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.native.js +1 -2
- package/dist/jsx/AlertDialog.mjs +138 -187
- package/dist/jsx/AlertDialog.mjs.map +1 -1
- package/dist/jsx/AlertDialog.native.cjs +309 -0
- package/dist/jsx/AlertDialog.native.js +255 -322
- package/dist/jsx/AlertDialog.native.js.map +1 -1
- package/dist/jsx/index.js +1 -2
- package/dist/jsx/index.mjs +1 -2
- package/dist/jsx/index.native.cjs +21 -0
- package/dist/jsx/index.native.js +10 -10
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +20 -19
- package/src/AlertDialog.tsx +106 -75
- package/types/AlertDialog.d.ts +40 -74
- package/types/AlertDialog.d.ts.map +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
|
@@ -1,329 +1,267 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Slottable, View, createRefComponent, createStyledContext, createStyledHOC, isTamaguiElement, styled } from "@tamagui/core";
|
|
2
3
|
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
4
|
import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
4
|
-
import { Slottable, View, createStyledContext, isTamaguiElement, styled } from "@tamagui/core";
|
|
5
5
|
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogOverlayFrame, DialogPortal, DialogTitle, DialogTrigger, DialogWarningProvider } from "@tamagui/dialog";
|
|
6
6
|
import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
|
|
7
7
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { Alert } from "react-native";
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
|
|
11
|
+
var getAlertDialogScope = function(scope) {
|
|
12
|
+
return scope;
|
|
12
13
|
};
|
|
13
14
|
var ROOT_NAME = "AlertDialog";
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} = props;
|
|
35
|
-
return /* @__PURE__ */jsx(DialogTrigger, {
|
|
36
|
-
scope: getAlertDialogScope(scope),
|
|
37
|
-
...triggerProps,
|
|
38
|
-
ref: forwardedRef
|
|
39
|
-
});
|
|
15
|
+
var ALERT_DIALOG_PART = /* @__PURE__ */ Symbol("AlertDialogPart");
|
|
16
|
+
var markAlertDialogPart = function(component, part) {
|
|
17
|
+
Object.assign(component.staticConfig, { [ALERT_DIALOG_PART]: part });
|
|
18
|
+
};
|
|
19
|
+
var NativeAlertDialogTriggerFrame = styled(View, { displayName: "AlertDialogTrigger" });
|
|
20
|
+
markAlertDialogPart(NativeAlertDialogTriggerFrame, "trigger");
|
|
21
|
+
var AlertDialogTrigger = createStyledHOC(NativeAlertDialogTriggerFrame, function AlertDialogTrigger2(props, forwardedRef) {
|
|
22
|
+
if (props["__native"]) {
|
|
23
|
+
var { __native, onPress, __onPress, ...rest } = props;
|
|
24
|
+
return /* @__PURE__ */ jsx(NativeAlertDialogTriggerFrame, {
|
|
25
|
+
...rest,
|
|
26
|
+
onPress: composeEventHandlers(onPress, __onPress)
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
var { scope, ...triggerProps } = props;
|
|
30
|
+
return /* @__PURE__ */ jsx(DialogTrigger, {
|
|
31
|
+
scope: getAlertDialogScope(scope),
|
|
32
|
+
...triggerProps,
|
|
33
|
+
ref: forwardedRef
|
|
34
|
+
});
|
|
40
35
|
});
|
|
41
36
|
var AlertDialogPortal = function AlertDialogPortal2(props) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
scope: getAlertDialogScope(scope),
|
|
48
|
-
...portalProps
|
|
49
|
-
});
|
|
37
|
+
var { scope, ...portalProps } = props;
|
|
38
|
+
return /* @__PURE__ */ jsx(DialogPortal, {
|
|
39
|
+
scope: getAlertDialogScope(scope),
|
|
40
|
+
...portalProps
|
|
41
|
+
});
|
|
50
42
|
};
|
|
51
|
-
var AlertDialogOverlay = styled(DialogOverlayFrame, {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return /* @__PURE__ */jsx(DialogOverlay, {
|
|
59
|
-
scope: getAlertDialogScope(scope),
|
|
60
|
-
...overlayProps,
|
|
61
|
-
ref: forwardedRef
|
|
62
|
-
});
|
|
43
|
+
var AlertDialogOverlay = createStyledHOC(styled(DialogOverlayFrame, { displayName: "AlertDialogOverlay" }), function AlertDialogOverlay2(props, forwardedRef) {
|
|
44
|
+
var { scope, ...overlayProps } = props;
|
|
45
|
+
return /* @__PURE__ */ jsx(DialogOverlay, {
|
|
46
|
+
scope: getAlertDialogScope(scope),
|
|
47
|
+
...overlayProps,
|
|
48
|
+
ref: forwardedRef
|
|
49
|
+
});
|
|
63
50
|
});
|
|
64
51
|
var CONTENT_NAME = "AlertDialogContent";
|
|
65
|
-
var {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
return event.preventDefault();
|
|
104
|
-
},
|
|
105
|
-
onInteractOutside: function (event) {
|
|
106
|
-
return event.preventDefault();
|
|
107
|
-
},
|
|
108
|
-
children: [/* @__PURE__ */jsx(Slottable, {
|
|
109
|
-
children
|
|
110
|
-
}), process.env.NODE_ENV === "development" && /* @__PURE__ */jsx(DescriptionWarning, {
|
|
111
|
-
contentRef
|
|
112
|
-
})]
|
|
113
|
-
})
|
|
114
|
-
})
|
|
115
|
-
});
|
|
52
|
+
var { Provider: AlertDialogContextProvider, useStyledContext: useAlertDialogContentContext } = createStyledContext({}, "AlertDialogContext");
|
|
53
|
+
var AlertDialogContent = createRefComponent(function AlertDialogContent2(props, forwardedRef) {
|
|
54
|
+
var { scope, children, ...contentProps } = props;
|
|
55
|
+
var dialogScope = getAlertDialogScope(scope);
|
|
56
|
+
var contentRef = React.useRef(null);
|
|
57
|
+
var composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
58
|
+
var cancelRef = React.useRef(null);
|
|
59
|
+
return /* @__PURE__ */ jsx(DialogWarningProvider, {
|
|
60
|
+
contentName: CONTENT_NAME,
|
|
61
|
+
titleName: TITLE_NAME,
|
|
62
|
+
docsSlug: "alert-dialog",
|
|
63
|
+
children: /* @__PURE__ */ jsx(AlertDialogContextProvider, {
|
|
64
|
+
scope,
|
|
65
|
+
cancelRef,
|
|
66
|
+
destructiveRef: React.useRef(null),
|
|
67
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
68
|
+
role: "alertdialog",
|
|
69
|
+
"aria-modal": true,
|
|
70
|
+
scope: dialogScope,
|
|
71
|
+
...contentProps,
|
|
72
|
+
ref: composedRefs,
|
|
73
|
+
onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, function(event) {
|
|
74
|
+
event.cancel();
|
|
75
|
+
if (isWeb) {
|
|
76
|
+
var _cancelRef_current;
|
|
77
|
+
(_cancelRef_current = cancelRef.current) === null || _cancelRef_current === void 0 || _cancelRef_current.focus({ preventScroll: true });
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
onPointerDownOutside: function(event) {
|
|
81
|
+
return event.cancel();
|
|
82
|
+
},
|
|
83
|
+
onInteractOutside: function(event) {
|
|
84
|
+
return event.cancel();
|
|
85
|
+
},
|
|
86
|
+
children: [/* @__PURE__ */ jsx(Slottable, { children }), process.env.NODE_ENV === "development" && /* @__PURE__ */ jsx(DescriptionWarning, { contentRef })]
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
});
|
|
116
90
|
});
|
|
117
91
|
var TITLE_NAME = "AlertDialogTitle";
|
|
118
|
-
var
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
...titleProps,
|
|
128
|
-
ref: forwardedRef
|
|
129
|
-
});
|
|
92
|
+
var AlertDialogTitleFrame = styled(View, { displayName: TITLE_NAME });
|
|
93
|
+
markAlertDialogPart(AlertDialogTitleFrame, "title");
|
|
94
|
+
var AlertDialogTitle = createStyledHOC(AlertDialogTitleFrame, function AlertDialogTitle2(props, forwardedRef) {
|
|
95
|
+
var { scope, ...titleProps } = props;
|
|
96
|
+
return /* @__PURE__ */ jsx(DialogTitle, {
|
|
97
|
+
scope: getAlertDialogScope(scope),
|
|
98
|
+
...titleProps,
|
|
99
|
+
ref: forwardedRef
|
|
100
|
+
});
|
|
130
101
|
});
|
|
131
102
|
var DESCRIPTION_NAME = "AlertDialogDescription";
|
|
132
|
-
var
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
...descriptionProps,
|
|
142
|
-
ref: forwardedRef
|
|
143
|
-
});
|
|
103
|
+
var AlertDialogDescriptionFrame = styled(View, { displayName: DESCRIPTION_NAME });
|
|
104
|
+
markAlertDialogPart(AlertDialogDescriptionFrame, "description");
|
|
105
|
+
var AlertDialogDescription = createStyledHOC(AlertDialogDescriptionFrame, function AlertDialogDescription2(props, forwardedRef) {
|
|
106
|
+
var { scope, ...descriptionProps } = props;
|
|
107
|
+
return /* @__PURE__ */ jsx(DialogDescription, {
|
|
108
|
+
scope: getAlertDialogScope(scope),
|
|
109
|
+
...descriptionProps,
|
|
110
|
+
ref: forwardedRef
|
|
111
|
+
});
|
|
144
112
|
});
|
|
145
|
-
var
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
scope: getAlertDialogScope(scope),
|
|
155
|
-
...actionProps,
|
|
156
|
-
ref: forwardedRef
|
|
157
|
-
});
|
|
113
|
+
var AlertDialogActionFrame = styled(View, { displayName: "AlertDialogAction" });
|
|
114
|
+
markAlertDialogPart(AlertDialogActionFrame, "action");
|
|
115
|
+
var AlertDialogAction = createStyledHOC(AlertDialogActionFrame, function AlertDialogAction2(props, forwardedRef) {
|
|
116
|
+
var { scope, ...actionProps } = props;
|
|
117
|
+
return /* @__PURE__ */ jsx(DialogClose, {
|
|
118
|
+
scope: getAlertDialogScope(scope),
|
|
119
|
+
...actionProps,
|
|
120
|
+
ref: forwardedRef
|
|
121
|
+
});
|
|
158
122
|
});
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
var ref = useComposedRefs(forwardedRef, cancelRef);
|
|
171
|
-
return /* @__PURE__ */jsx(DialogClose, {
|
|
172
|
-
scope: getAlertDialogScope(scope),
|
|
173
|
-
...cancelProps,
|
|
174
|
-
ref
|
|
175
|
-
});
|
|
123
|
+
var AlertDialogCancelFrame = styled(View, { displayName: "AlertDialogCancel" });
|
|
124
|
+
markAlertDialogPart(AlertDialogCancelFrame, "cancel");
|
|
125
|
+
var AlertDialogCancel = createStyledHOC(AlertDialogCancelFrame, function AlertDialogCancel2(props, forwardedRef) {
|
|
126
|
+
var { scope, ...cancelProps } = props;
|
|
127
|
+
var { cancelRef } = useAlertDialogContentContext(scope);
|
|
128
|
+
var ref = useComposedRefs(forwardedRef, cancelRef);
|
|
129
|
+
return /* @__PURE__ */ jsx(DialogClose, {
|
|
130
|
+
scope: getAlertDialogScope(scope),
|
|
131
|
+
...cancelProps,
|
|
132
|
+
ref
|
|
133
|
+
});
|
|
176
134
|
});
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
var ref = useComposedRefs(forwardedRef, destructiveRef);
|
|
189
|
-
return /* @__PURE__ */jsx(DialogClose, {
|
|
190
|
-
scope: getAlertDialogScope(scope),
|
|
191
|
-
...destructiveProps,
|
|
192
|
-
ref
|
|
193
|
-
});
|
|
135
|
+
var AlertDialogDestructiveFrame = styled(View, { displayName: "AlertDialogDestructive" });
|
|
136
|
+
markAlertDialogPart(AlertDialogDestructiveFrame, "destructive");
|
|
137
|
+
var AlertDialogDestructive = createStyledHOC(AlertDialogDestructiveFrame, function AlertDialogDestructive2(props, forwardedRef) {
|
|
138
|
+
var { scope, ...destructiveProps } = props;
|
|
139
|
+
var { destructiveRef } = useAlertDialogContentContext(scope);
|
|
140
|
+
var ref = useComposedRefs(forwardedRef, destructiveRef);
|
|
141
|
+
return /* @__PURE__ */ jsx(DialogClose, {
|
|
142
|
+
scope: getAlertDialogScope(scope),
|
|
143
|
+
...destructiveProps,
|
|
144
|
+
ref
|
|
145
|
+
});
|
|
194
146
|
});
|
|
195
|
-
var DescriptionWarning = function
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (!isWeb) return;
|
|
202
|
-
if (!document.getElementById((_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.getAttribute("aria-describedby"))) console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
147
|
+
var DescriptionWarning = function(param) {
|
|
148
|
+
var { contentRef } = param;
|
|
149
|
+
if (process.env.NODE_ENV === "development") React.useEffect(function() {
|
|
150
|
+
var _contentRef_current;
|
|
151
|
+
if (!isWeb) return;
|
|
152
|
+
if (!document.getElementById((_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.getAttribute("aria-describedby"))) console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
203
153
|
|
|
204
154
|
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.
|
|
205
155
|
|
|
206
156
|
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.
|
|
207
157
|
|
|
208
158
|
For more information, see https://tamagui.dev/docs/components/alert-dialog`);
|
|
209
|
-
|
|
210
|
-
|
|
159
|
+
}, [contentRef]);
|
|
160
|
+
return null;
|
|
211
161
|
};
|
|
212
|
-
var AlertDialogInner = function
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}, [native, open]);
|
|
271
|
-
if (native) return /* @__PURE__ */React.cloneElement(triggerElement, {
|
|
272
|
-
__onPress: function () {
|
|
273
|
-
setOpen(true);
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
return /* @__PURE__ */jsx(Dialog, {
|
|
277
|
-
scope: dialogScope,
|
|
278
|
-
...alertDialogProps,
|
|
279
|
-
modal: true
|
|
280
|
-
});
|
|
162
|
+
var AlertDialogInner = function(props) {
|
|
163
|
+
var { scope, native, ...alertDialogProps } = props;
|
|
164
|
+
var dialogScope = getAlertDialogScope(scope);
|
|
165
|
+
var [open, setOpen] = useControllableState({
|
|
166
|
+
prop: props.open,
|
|
167
|
+
defaultProp: props.defaultOpen || false,
|
|
168
|
+
onChange: props.onOpenChange,
|
|
169
|
+
transition: true
|
|
170
|
+
});
|
|
171
|
+
var triggerElement = null;
|
|
172
|
+
var title = "";
|
|
173
|
+
var description = "";
|
|
174
|
+
var buttons = [];
|
|
175
|
+
forEachChildDeep(React.Children.toArray(props.children), function(child) {
|
|
176
|
+
if (!/* @__PURE__ */ React.isValidElement(child)) return false;
|
|
177
|
+
var part = isTamaguiElement(child) ? child.type.staticConfig[ALERT_DIALOG_PART] : void 0;
|
|
178
|
+
switch (part) {
|
|
179
|
+
case "trigger":
|
|
180
|
+
triggerElement = /* @__PURE__ */ React.cloneElement(child, { __native: true });
|
|
181
|
+
return false;
|
|
182
|
+
case "title":
|
|
183
|
+
title = getStringChildren(child);
|
|
184
|
+
return false;
|
|
185
|
+
case "description":
|
|
186
|
+
description = getStringChildren(child);
|
|
187
|
+
return false;
|
|
188
|
+
case "action":
|
|
189
|
+
case "destructive":
|
|
190
|
+
case "cancel":
|
|
191
|
+
var style = part === "action" ? "default" : part === "destructive" ? "destructive" : "cancel";
|
|
192
|
+
var text = getStringChildren(child);
|
|
193
|
+
var onPress = function() {
|
|
194
|
+
var _childProps_onPress;
|
|
195
|
+
var childProps = child.props;
|
|
196
|
+
childProps === null || childProps === void 0 || (_childProps_onPress = childProps.onPress) == null || _childProps_onPress.call(childProps, { native: true });
|
|
197
|
+
setOpen(false);
|
|
198
|
+
};
|
|
199
|
+
buttons.push({
|
|
200
|
+
style,
|
|
201
|
+
text,
|
|
202
|
+
onPress
|
|
203
|
+
});
|
|
204
|
+
return false;
|
|
205
|
+
default: return true;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
useIsomorphicLayoutEffect(function() {
|
|
209
|
+
if (!open || !native) return;
|
|
210
|
+
if (title || description) Alert.alert(title, description, buttons);
|
|
211
|
+
}, [native, open]);
|
|
212
|
+
if (native) return /* @__PURE__ */ React.cloneElement(triggerElement, { __onPress: function() {
|
|
213
|
+
setOpen(true);
|
|
214
|
+
} });
|
|
215
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
216
|
+
scope: dialogScope,
|
|
217
|
+
...alertDialogProps,
|
|
218
|
+
modal: true
|
|
219
|
+
});
|
|
281
220
|
};
|
|
282
221
|
function forEachChildDeep(children, onChild) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
}
|
|
222
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
223
|
+
try {
|
|
224
|
+
for (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
225
|
+
var child = _step.value;
|
|
226
|
+
if (!/* @__PURE__ */ React.isValidElement(child)) continue;
|
|
227
|
+
if (!onChild(child)) continue;
|
|
228
|
+
var childProps = child.props;
|
|
229
|
+
if (childProps.children) forEachChildDeep(React.Children.toArray(childProps.children), onChild);
|
|
230
|
+
}
|
|
231
|
+
} catch (err) {
|
|
232
|
+
_didIteratorError = true;
|
|
233
|
+
_iteratorError = err;
|
|
234
|
+
} finally {
|
|
235
|
+
try {
|
|
236
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
237
|
+
} finally {
|
|
238
|
+
if (_didIteratorError) throw _iteratorError;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
304
241
|
}
|
|
305
242
|
function getStringChildren(child) {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
243
|
+
var string = "";
|
|
244
|
+
forEachChildDeep(React.Children.toArray(child), function(child2) {
|
|
245
|
+
if (typeof child2.props.children === "string") {
|
|
246
|
+
string = child2.props.children;
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
return true;
|
|
250
|
+
});
|
|
251
|
+
return string;
|
|
315
252
|
}
|
|
316
253
|
var AlertDialog = withStaticProperties(AlertDialogInner, {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
254
|
+
Trigger: AlertDialogTrigger,
|
|
255
|
+
Portal: AlertDialogPortal,
|
|
256
|
+
Overlay: AlertDialogOverlay,
|
|
257
|
+
Content: AlertDialogContent,
|
|
258
|
+
Action: AlertDialogAction,
|
|
259
|
+
Cancel: AlertDialogCancel,
|
|
260
|
+
Destructive: AlertDialogDestructive,
|
|
261
|
+
Title: AlertDialogTitle,
|
|
262
|
+
Description: AlertDialogDescription
|
|
326
263
|
});
|
|
327
264
|
AlertDialog.displayName = ROOT_NAME;
|
|
265
|
+
|
|
328
266
|
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogDestructive, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
|
|
329
267
|
//# sourceMappingURL=AlertDialog.native.js.map
|