@tamagui/alert-dialog 2.7.7 → 3.0.0-beta.1091.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 +178 -234
- package/dist/cjs/AlertDialog.native.cjs +234 -0
- package/dist/cjs/AlertDialog.native.js +182 -324
- package/dist/cjs/AlertDialog.native.js.map +1 -1
- package/dist/cjs/alertDialogPart.cjs +30 -0
- package/dist/cjs/alertDialogPart.native.cjs +32 -0
- package/dist/cjs/alertDialogPart.native.js +34 -0
- package/dist/cjs/alertDialogPart.native.js.map +1 -0
- package/dist/cjs/index.cjs +9 -11
- package/dist/cjs/index.native.cjs +20 -0
- package/dist/cjs/index.native.js +9 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/useNativeAlertDialog.cjs +24 -0
- package/dist/cjs/useNativeAlertDialog.native.cjs +139 -0
- package/dist/cjs/useNativeAlertDialog.native.js +141 -0
- package/dist/cjs/useNativeAlertDialog.native.js.map +1 -0
- package/dist/esm/AlertDialog.mjs +153 -187
- package/dist/esm/AlertDialog.mjs.map +1 -1
- package/dist/esm/AlertDialog.native.js +158 -292
- package/dist/esm/AlertDialog.native.js.map +1 -1
- package/dist/esm/alertDialogPart.mjs +7 -0
- package/dist/esm/alertDialogPart.mjs.map +1 -0
- package/dist/esm/alertDialogPart.native.js +7 -0
- package/dist/esm/alertDialogPart.native.js.map +1 -0
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.native.js +1 -2
- package/dist/esm/useNativeAlertDialog.mjs +4 -0
- package/dist/esm/useNativeAlertDialog.mjs.map +1 -0
- package/dist/esm/useNativeAlertDialog.native.js +112 -0
- package/dist/esm/useNativeAlertDialog.native.js.map +1 -0
- package/dist/jsx/AlertDialog.mjs +153 -187
- package/dist/jsx/AlertDialog.mjs.map +1 -1
- package/dist/jsx/AlertDialog.native.cjs +234 -0
- package/dist/jsx/AlertDialog.native.js +182 -324
- package/dist/jsx/AlertDialog.native.js.map +1 -1
- package/dist/jsx/alertDialogPart.mjs +7 -0
- package/dist/jsx/alertDialogPart.mjs.map +1 -0
- package/dist/jsx/alertDialogPart.native.cjs +32 -0
- package/dist/jsx/alertDialogPart.native.js +34 -0
- package/dist/jsx/alertDialogPart.native.js.map +1 -0
- package/dist/jsx/index.js +1 -2
- package/dist/jsx/index.mjs +1 -2
- package/dist/jsx/index.native.cjs +20 -0
- package/dist/jsx/index.native.js +9 -10
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/useNativeAlertDialog.mjs +4 -0
- package/dist/jsx/useNativeAlertDialog.mjs.map +1 -0
- package/dist/jsx/useNativeAlertDialog.native.cjs +139 -0
- package/dist/jsx/useNativeAlertDialog.native.js +141 -0
- package/dist/jsx/useNativeAlertDialog.native.js.map +1 -0
- package/package.json +22 -20
- package/src/AlertDialog.tsx +80 -181
- package/src/alertDialogPart.ts +26 -0
- package/src/useNativeAlertDialog.native.tsx +129 -0
- package/src/useNativeAlertDialog.ts +11 -0
- package/types/AlertDialog.d.ts +28 -62
- package/types/AlertDialog.d.ts.map +1 -1
- package/types/alertDialogPart.d.ts +15 -0
- package/types/alertDialogPart.d.ts.map +1 -0
- package/types/useNativeAlertDialog.d.ts +11 -0
- package/types/useNativeAlertDialog.d.ts.map +1 -0
- package/types/useNativeAlertDialog.native.d.ts +11 -0
- package/types/useNativeAlertDialog.native.d.ts.map +1 -0
- 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,195 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Slottable, View, createRefComponent, createStyledContext, createStyledHOC, styled } from "@tamagui/core";
|
|
2
3
|
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
|
-
import { isWeb
|
|
4
|
-
import { Slottable, View, createStyledContext, isTamaguiElement, styled } from "@tamagui/core";
|
|
4
|
+
import { isWeb } from "@tamagui/constants";
|
|
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
|
-
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
8
7
|
import * as React from "react";
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import { markAlertDialogPart } from "./alertDialogPart.native.js";
|
|
9
|
+
import { useNativeAlertDialog } from "./useNativeAlertDialog.native.js";
|
|
10
|
+
|
|
11
|
+
var getAlertDialogScope = function(scope) {
|
|
12
|
+
return scope;
|
|
12
13
|
};
|
|
13
14
|
var ROOT_NAME = "AlertDialog";
|
|
14
15
|
var TRIGGER_NAME = "AlertDialogTrigger";
|
|
15
|
-
var NativeAlertDialogTriggerFrame = styled(View, {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var {
|
|
32
|
-
scope,
|
|
33
|
-
...triggerProps
|
|
34
|
-
} = props;
|
|
35
|
-
return /* @__PURE__ */jsx(DialogTrigger, {
|
|
36
|
-
scope: getAlertDialogScope(scope),
|
|
37
|
-
...triggerProps,
|
|
38
|
-
ref: forwardedRef
|
|
39
|
-
});
|
|
16
|
+
var NativeAlertDialogTriggerFrame = styled(View, { displayName: TRIGGER_NAME });
|
|
17
|
+
markAlertDialogPart(NativeAlertDialogTriggerFrame, "trigger");
|
|
18
|
+
var AlertDialogTrigger = createStyledHOC(NativeAlertDialogTriggerFrame, function AlertDialogTrigger2(props, forwardedRef) {
|
|
19
|
+
if (props["__native"]) {
|
|
20
|
+
var { __native, onPress, __onPress, ...rest } = props;
|
|
21
|
+
return /* @__PURE__ */ jsx(NativeAlertDialogTriggerFrame, {
|
|
22
|
+
...rest,
|
|
23
|
+
onPress: composeEventHandlers(onPress, __onPress)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
var { scope, ...triggerProps } = props;
|
|
27
|
+
return /* @__PURE__ */ jsx(DialogTrigger, {
|
|
28
|
+
scope: getAlertDialogScope(scope),
|
|
29
|
+
...triggerProps,
|
|
30
|
+
ref: forwardedRef
|
|
31
|
+
});
|
|
40
32
|
});
|
|
41
33
|
var AlertDialogPortal = function AlertDialogPortal2(props) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
scope: getAlertDialogScope(scope),
|
|
48
|
-
...portalProps
|
|
49
|
-
});
|
|
34
|
+
var { scope, ...portalProps } = props;
|
|
35
|
+
return /* @__PURE__ */ jsx(DialogPortal, {
|
|
36
|
+
scope: getAlertDialogScope(scope),
|
|
37
|
+
...portalProps
|
|
38
|
+
});
|
|
50
39
|
};
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
...overlayProps,
|
|
61
|
-
ref: forwardedRef
|
|
62
|
-
});
|
|
40
|
+
var OVERLAY_NAME = "AlertDialogOverlay";
|
|
41
|
+
var AlertDialogOverlayFrame = styled(DialogOverlayFrame, { displayName: OVERLAY_NAME });
|
|
42
|
+
var AlertDialogOverlay = createStyledHOC(AlertDialogOverlayFrame, function AlertDialogOverlay2(props, forwardedRef) {
|
|
43
|
+
var { scope, ...overlayProps } = props;
|
|
44
|
+
return /* @__PURE__ */ jsx(DialogOverlay, {
|
|
45
|
+
scope: getAlertDialogScope(scope),
|
|
46
|
+
...overlayProps,
|
|
47
|
+
ref: forwardedRef
|
|
48
|
+
});
|
|
63
49
|
});
|
|
64
50
|
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
|
-
|
|
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
|
-
});
|
|
51
|
+
var { Provider: AlertDialogContextProvider, useStyledContext: useAlertDialogContentContext } = createStyledContext({}, "AlertDialogContext");
|
|
52
|
+
var AlertDialogContent = createRefComponent(function AlertDialogContent2(props, forwardedRef) {
|
|
53
|
+
var { scope, children, ...contentProps } = props;
|
|
54
|
+
var dialogScope = getAlertDialogScope(scope);
|
|
55
|
+
var contentRef = React.useRef(null);
|
|
56
|
+
var composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
57
|
+
var cancelRef = React.useRef(null);
|
|
58
|
+
var destructiveRef = 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,
|
|
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 ? 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
113
|
var ACTION_NAME = "AlertDialogAction";
|
|
146
|
-
var
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
...actionProps,
|
|
156
|
-
ref: forwardedRef
|
|
157
|
-
});
|
|
114
|
+
var AlertDialogActionFrame = styled(View, { displayName: ACTION_NAME });
|
|
115
|
+
markAlertDialogPart(AlertDialogActionFrame, "action");
|
|
116
|
+
var AlertDialogAction = createStyledHOC(AlertDialogActionFrame, function AlertDialogAction2(props, forwardedRef) {
|
|
117
|
+
var { scope, ...actionProps } = props;
|
|
118
|
+
return /* @__PURE__ */ jsx(DialogClose, {
|
|
119
|
+
scope: getAlertDialogScope(scope),
|
|
120
|
+
...actionProps,
|
|
121
|
+
ref: forwardedRef
|
|
122
|
+
});
|
|
158
123
|
});
|
|
159
124
|
var CANCEL_NAME = "AlertDialogCancel";
|
|
160
|
-
var
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return /* @__PURE__ */jsx(DialogClose, {
|
|
172
|
-
scope: getAlertDialogScope(scope),
|
|
173
|
-
...cancelProps,
|
|
174
|
-
ref
|
|
175
|
-
});
|
|
125
|
+
var AlertDialogCancelFrame = styled(View, { displayName: CANCEL_NAME });
|
|
126
|
+
markAlertDialogPart(AlertDialogCancelFrame, "cancel");
|
|
127
|
+
var AlertDialogCancel = createStyledHOC(AlertDialogCancelFrame, function AlertDialogCancel2(props, forwardedRef) {
|
|
128
|
+
var { scope, ...cancelProps } = props;
|
|
129
|
+
var { cancelRef } = useAlertDialogContentContext(scope);
|
|
130
|
+
var ref = useComposedRefs(forwardedRef, cancelRef);
|
|
131
|
+
return /* @__PURE__ */ jsx(DialogClose, {
|
|
132
|
+
scope: getAlertDialogScope(scope),
|
|
133
|
+
...cancelProps,
|
|
134
|
+
ref
|
|
135
|
+
});
|
|
176
136
|
});
|
|
177
137
|
var DESTRUCTIVE_NAME = "AlertDialogDestructive";
|
|
178
|
-
var
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return /* @__PURE__ */jsx(DialogClose, {
|
|
190
|
-
scope: getAlertDialogScope(scope),
|
|
191
|
-
...destructiveProps,
|
|
192
|
-
ref
|
|
193
|
-
});
|
|
138
|
+
var AlertDialogDestructiveFrame = styled(View, { displayName: DESTRUCTIVE_NAME });
|
|
139
|
+
markAlertDialogPart(AlertDialogDestructiveFrame, "destructive");
|
|
140
|
+
var AlertDialogDestructive = createStyledHOC(AlertDialogDestructiveFrame, function AlertDialogDestructive2(props, forwardedRef) {
|
|
141
|
+
var { scope, ...destructiveProps } = props;
|
|
142
|
+
var { destructiveRef } = useAlertDialogContentContext(scope);
|
|
143
|
+
var ref = useComposedRefs(forwardedRef, destructiveRef);
|
|
144
|
+
return /* @__PURE__ */ jsx(DialogClose, {
|
|
145
|
+
scope: getAlertDialogScope(scope),
|
|
146
|
+
...destructiveProps,
|
|
147
|
+
ref
|
|
148
|
+
});
|
|
194
149
|
});
|
|
195
|
-
var DescriptionWarning = function
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
150
|
+
var DescriptionWarning = function(param) {
|
|
151
|
+
var { contentRef } = param;
|
|
152
|
+
if (process.env.NODE_ENV === "development") {
|
|
153
|
+
React.useEffect(function() {
|
|
154
|
+
var _contentRef_current;
|
|
155
|
+
if (!isWeb) return;
|
|
156
|
+
var hasDescription = document.getElementById((_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.getAttribute("aria-describedby"));
|
|
157
|
+
if (!hasDescription) {
|
|
158
|
+
console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
203
159
|
|
|
204
160
|
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
161
|
|
|
206
162
|
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
163
|
|
|
208
164
|
For more information, see https://tamagui.dev/docs/components/alert-dialog`);
|
|
209
|
-
|
|
210
|
-
|
|
165
|
+
}
|
|
166
|
+
}, [contentRef]);
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
211
169
|
};
|
|
212
|
-
var AlertDialogInner = function
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
onChange: props.onOpenChange,
|
|
223
|
-
transition: true
|
|
224
|
-
});
|
|
225
|
-
var triggerElement = null;
|
|
226
|
-
var title = "";
|
|
227
|
-
var description = "";
|
|
228
|
-
var buttons = [];
|
|
229
|
-
forEachChildDeep(React.Children.toArray(props.children), function (child) {
|
|
230
|
-
if (! /* @__PURE__ */React.isValidElement(child)) return false;
|
|
231
|
-
var name = isTamaguiElement(child) ? child.type.staticConfig.componentName : child.type["displayName"];
|
|
232
|
-
switch (name) {
|
|
233
|
-
case TRIGGER_NAME:
|
|
234
|
-
triggerElement = /* @__PURE__ */React.cloneElement(child, {
|
|
235
|
-
__native: true
|
|
236
|
-
});
|
|
237
|
-
return false;
|
|
238
|
-
case TITLE_NAME:
|
|
239
|
-
title = getStringChildren(child);
|
|
240
|
-
return false;
|
|
241
|
-
case DESCRIPTION_NAME:
|
|
242
|
-
description = getStringChildren(child);
|
|
243
|
-
return false;
|
|
244
|
-
case ACTION_NAME:
|
|
245
|
-
case DESTRUCTIVE_NAME:
|
|
246
|
-
case CANCEL_NAME:
|
|
247
|
-
var style = name === ACTION_NAME ? "default" : name === DESTRUCTIVE_NAME ? "destructive" : "cancel";
|
|
248
|
-
var text = getStringChildren(child);
|
|
249
|
-
var onPress = function () {
|
|
250
|
-
var _childProps_onPress;
|
|
251
|
-
var childProps = child.props;
|
|
252
|
-
childProps === null || childProps === void 0 || (_childProps_onPress = childProps.onPress) == null || _childProps_onPress.call(childProps, {
|
|
253
|
-
native: true
|
|
254
|
-
});
|
|
255
|
-
setOpen(false);
|
|
256
|
-
};
|
|
257
|
-
buttons.push({
|
|
258
|
-
style,
|
|
259
|
-
text,
|
|
260
|
-
onPress
|
|
261
|
-
});
|
|
262
|
-
return false;
|
|
263
|
-
default:
|
|
264
|
-
return true;
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
useIsomorphicLayoutEffect(function () {
|
|
268
|
-
if (!open || !native) return;
|
|
269
|
-
if (title || description) Alert.alert(title, description, buttons);
|
|
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
|
-
});
|
|
170
|
+
var AlertDialogInner = function(props) {
|
|
171
|
+
var { scope, native, ...alertDialogProps } = props;
|
|
172
|
+
var dialogScope = getAlertDialogScope(scope);
|
|
173
|
+
var nativeAlert = useNativeAlertDialog(props);
|
|
174
|
+
if (nativeAlert) return nativeAlert;
|
|
175
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
176
|
+
scope: dialogScope,
|
|
177
|
+
...alertDialogProps,
|
|
178
|
+
modal: true
|
|
179
|
+
});
|
|
281
180
|
};
|
|
282
|
-
function forEachChildDeep(children, onChild) {
|
|
283
|
-
var _iteratorNormalCompletion = true,
|
|
284
|
-
_didIteratorError = false,
|
|
285
|
-
_iteratorError = void 0;
|
|
286
|
-
try {
|
|
287
|
-
for (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
288
|
-
var child = _step.value;
|
|
289
|
-
if (! /* @__PURE__ */React.isValidElement(child)) continue;
|
|
290
|
-
if (!onChild(child)) continue;
|
|
291
|
-
var childProps = child.props;
|
|
292
|
-
if (childProps.children) forEachChildDeep(React.Children.toArray(childProps.children), onChild);
|
|
293
|
-
}
|
|
294
|
-
} catch (err) {
|
|
295
|
-
_didIteratorError = true;
|
|
296
|
-
_iteratorError = err;
|
|
297
|
-
} finally {
|
|
298
|
-
try {
|
|
299
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
300
|
-
} finally {
|
|
301
|
-
if (_didIteratorError) throw _iteratorError;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
function getStringChildren(child) {
|
|
306
|
-
var string = "";
|
|
307
|
-
forEachChildDeep(React.Children.toArray(child), function (child2) {
|
|
308
|
-
if (typeof child2.props.children === "string") {
|
|
309
|
-
string = child2.props.children;
|
|
310
|
-
return false;
|
|
311
|
-
}
|
|
312
|
-
return true;
|
|
313
|
-
});
|
|
314
|
-
return string;
|
|
315
|
-
}
|
|
316
181
|
var AlertDialog = withStaticProperties(AlertDialogInner, {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
182
|
+
Trigger: AlertDialogTrigger,
|
|
183
|
+
Portal: AlertDialogPortal,
|
|
184
|
+
Overlay: AlertDialogOverlay,
|
|
185
|
+
Content: AlertDialogContent,
|
|
186
|
+
Action: AlertDialogAction,
|
|
187
|
+
Cancel: AlertDialogCancel,
|
|
188
|
+
Destructive: AlertDialogDestructive,
|
|
189
|
+
Title: AlertDialogTitle,
|
|
190
|
+
Description: AlertDialogDescription
|
|
326
191
|
});
|
|
327
192
|
AlertDialog.displayName = ROOT_NAME;
|
|
193
|
+
|
|
328
194
|
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogDestructive, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
|
|
329
195
|
//# sourceMappingURL=AlertDialog.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["jsx","jsxs","useComposedRefs","isWeb","useIsomorphicLayoutEffect","Slottable","View","createStyledContext","isTamaguiElement","styled","Dialog","DialogClose","DialogContent","DialogDescription","DialogOverlay","DialogOverlayFrame","DialogPortal","DialogTitle","DialogTrigger","DialogWarningProvider","composeEventHandlers","withStaticProperties","useControllableState","React","Alert","getAlertDialogScope","scope","ROOT_NAME","TRIGGER_NAME","NativeAlertDialogTriggerFrame","name","AlertDialogTrigger","styleable","AlertDialogTrigger2","props","forwardedRef","__native","onPress","__onPress","rest","triggerProps","ref","AlertDialogPortal","AlertDialogPortal2","portalProps","AlertDialogOverlay","AlertDialogOverlay2","overlayProps","CONTENT_NAME","Provider","AlertDialogContextProvider","useStyledContext","useAlertDialogContentContext","AlertDialogContent","forwardRef","AlertDialogContent2","children","contentProps","dialogScope","contentRef","useRef","composedRefs","cancelRef","contentName","titleName","TITLE_NAME","docsSlug","destructiveRef","role","onOpenAutoFocus","event","preventDefault","_cancelRef_current","current","focus","preventScroll","onPointerDownOutside","onInteractOutside","process","env","NODE_ENV","DescriptionWarning","AlertDialogTitle","AlertDialogTitle2","titleProps","DESCRIPTION_NAME","AlertDialogDescription","AlertDialogDescription2","descriptionProps","ACTION_NAME","AlertDialogAction","AlertDialogAction2","actionProps","CANCEL_NAME","AlertDialogCancel","AlertDialogCancel2","cancelProps","DESTRUCTIVE_NAME","AlertDialogDestructive","AlertDialogDestructive2","destructiveProps","param","useEffect","_contentRef_current","document","getElementById","getAttribute","console","warn","AlertDialogInner","native","alertDialogProps","open","setOpen","prop","defaultProp","defaultOpen","onChange","onOpenChange","transition","triggerElement","title","description","buttons","forEachChildDeep","Children","toArray","child","isValidElement","type","staticConfig","componentName","cloneElement","getStringChildren","style","text","_childProps_onPress","childProps","call","push","alert","modal","onChild","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","value","err","return","string","child2","AlertDialog","Trigger","Portal","Overlay","Content","Action","Cancel","Destructive","Title","Description","displayName"],"sources":["AlertDialog.native.js"],"sourcesContent":["import { jsx, jsxs } from \"react/jsx-runtime\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { Slottable, View, createStyledContext, isTamaguiElement, styled } from \"@tamagui/core\";\nimport { Dialog, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogOverlayFrame, DialogPortal, DialogTitle, DialogTrigger, DialogWarningProvider } from \"@tamagui/dialog\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { Alert } from \"react-native\";\n\nvar getAlertDialogScope = function(scope) {\n\treturn scope;\n};\nvar ROOT_NAME = \"AlertDialog\";\nvar TRIGGER_NAME = \"AlertDialogTrigger\";\nvar NativeAlertDialogTriggerFrame = styled(View, { name: TRIGGER_NAME });\nvar AlertDialogTrigger = NativeAlertDialogTriggerFrame.styleable(function AlertDialogTrigger2(props, forwardedRef) {\n\tif (props[\"__native\"]) {\n\t\tvar { __native, onPress, __onPress, ...rest } = props;\n\t\treturn /* @__PURE__ */ jsx(NativeAlertDialogTriggerFrame, {\n\t\t\t...rest,\n\t\t\tonPress: composeEventHandlers(onPress, __onPress)\n\t\t});\n\t}\n\tvar { scope, ...triggerProps } = props;\n\treturn /* @__PURE__ */ jsx(DialogTrigger, {\n\t\tscope: getAlertDialogScope(scope),\n\t\t...triggerProps,\n\t\tref: forwardedRef\n\t});\n});\nvar AlertDialogPortal = function AlertDialogPortal2(props) {\n\tvar { scope, ...portalProps } = props;\n\treturn /* @__PURE__ */ jsx(DialogPortal, {\n\t\tscope: getAlertDialogScope(scope),\n\t\t...portalProps\n\t});\n};\nvar AlertDialogOverlay = styled(DialogOverlayFrame, { name: \"AlertDialogOverlay\" }).styleable(function AlertDialogOverlay2(props, forwardedRef) {\n\tvar { scope, ...overlayProps } = props;\n\treturn /* @__PURE__ */ jsx(DialogOverlay, {\n\t\tscope: getAlertDialogScope(scope),\n\t\t...overlayProps,\n\t\tref: forwardedRef\n\t});\n});\nvar CONTENT_NAME = \"AlertDialogContent\";\nvar { Provider: AlertDialogContextProvider, useStyledContext: useAlertDialogContentContext } = createStyledContext({}, \"AlertDialogContext\");\nvar AlertDialogContent = /* @__PURE__ */ React.forwardRef(function AlertDialogContent2(props, forwardedRef) {\n\tvar { scope, children, ...contentProps } = props;\n\tvar dialogScope = getAlertDialogScope(scope);\n\tvar contentRef = React.useRef(null);\n\tvar composedRefs = useComposedRefs(forwardedRef, contentRef);\n\tvar cancelRef = React.useRef(null);\n\treturn /* @__PURE__ */ jsx(DialogWarningProvider, {\n\t\tcontentName: CONTENT_NAME,\n\t\ttitleName: TITLE_NAME,\n\t\tdocsSlug: \"alert-dialog\",\n\t\tchildren: /* @__PURE__ */ jsx(AlertDialogContextProvider, {\n\t\t\tscope,\n\t\t\tcancelRef,\n\t\t\tdestructiveRef: React.useRef(null),\n\t\t\tchildren: /* @__PURE__ */ jsxs(DialogContent, {\n\t\t\t\trole: \"alertdialog\",\n\t\t\t\t\"aria-modal\": true,\n\t\t\t\tscope: dialogScope,\n\t\t\t\t...contentProps,\n\t\t\t\tref: composedRefs,\n\t\t\t\tonOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, function(event) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif (isWeb) {\n\t\t\t\t\t\tvar _cancelRef_current;\n\t\t\t\t\t\t(_cancelRef_current = cancelRef.current) === null || _cancelRef_current === void 0 || _cancelRef_current.focus({ preventScroll: true });\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tonPointerDownOutside: function(event) {\n\t\t\t\t\treturn event.preventDefault();\n\t\t\t\t},\n\t\t\t\tonInteractOutside: function(event) {\n\t\t\t\t\treturn event.preventDefault();\n\t\t\t\t},\n\t\t\t\tchildren: [/* @__PURE__ */ jsx(Slottable, { children }), process.env.NODE_ENV === \"development\" && /* @__PURE__ */ jsx(DescriptionWarning, { contentRef })]\n\t\t\t})\n\t\t})\n\t});\n});\nvar TITLE_NAME = \"AlertDialogTitle\";\nvar AlertDialogTitle = styled(View, { name: TITLE_NAME }).styleable(function AlertDialogTitle2(props, forwardedRef) {\n\tvar { scope, ...titleProps } = props;\n\treturn /* @__PURE__ */ jsx(DialogTitle, {\n\t\tscope: getAlertDialogScope(scope),\n\t\t...titleProps,\n\t\tref: forwardedRef\n\t});\n});\nvar DESCRIPTION_NAME = \"AlertDialogDescription\";\nvar AlertDialogDescription = styled(View, { name: DESCRIPTION_NAME }).styleable(function AlertDialogDescription2(props, forwardedRef) {\n\tvar { scope, ...descriptionProps } = props;\n\treturn /* @__PURE__ */ jsx(DialogDescription, {\n\t\tscope: getAlertDialogScope(scope),\n\t\t...descriptionProps,\n\t\tref: forwardedRef\n\t});\n});\nvar ACTION_NAME = \"AlertDialogAction\";\nvar AlertDialogAction = styled(View, { name: ACTION_NAME }).styleable(function AlertDialogAction2(props, forwardedRef) {\n\tvar { scope, ...actionProps } = props;\n\treturn /* @__PURE__ */ jsx(DialogClose, {\n\t\tscope: getAlertDialogScope(scope),\n\t\t...actionProps,\n\t\tref: forwardedRef\n\t});\n});\nvar CANCEL_NAME = \"AlertDialogCancel\";\nvar AlertDialogCancel = styled(View, { name: CANCEL_NAME }).styleable(function AlertDialogCancel2(props, forwardedRef) {\n\tvar { scope, ...cancelProps } = props;\n\tvar { cancelRef } = useAlertDialogContentContext(scope);\n\tvar ref = useComposedRefs(forwardedRef, cancelRef);\n\treturn /* @__PURE__ */ jsx(DialogClose, {\n\t\tscope: getAlertDialogScope(scope),\n\t\t...cancelProps,\n\t\tref\n\t});\n});\nvar DESTRUCTIVE_NAME = \"AlertDialogDestructive\";\nvar AlertDialogDestructive = styled(View, { name: DESTRUCTIVE_NAME }).styleable(function AlertDialogDestructive2(props, forwardedRef) {\n\tvar { scope, ...destructiveProps } = props;\n\tvar { destructiveRef } = useAlertDialogContentContext(scope);\n\tvar ref = useComposedRefs(forwardedRef, destructiveRef);\n\treturn /* @__PURE__ */ jsx(DialogClose, {\n\t\tscope: getAlertDialogScope(scope),\n\t\t...destructiveProps,\n\t\tref\n\t});\n});\nvar DescriptionWarning = function(param) {\n\tvar { contentRef } = param;\n\tif (process.env.NODE_ENV === \"development\") React.useEffect(function() {\n\t\tvar _contentRef_current;\n\t\tif (!isWeb) return;\n\t\tif (!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.\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\t}, [contentRef]);\n\treturn null;\n};\nvar AlertDialogInner = function(props) {\n\tvar { scope, native, ...alertDialogProps } = props;\n\tvar dialogScope = getAlertDialogScope(scope);\n\tvar [open, setOpen] = useControllableState({\n\t\tprop: props.open,\n\t\tdefaultProp: props.defaultOpen || false,\n\t\tonChange: props.onOpenChange,\n\t\ttransition: true\n\t});\n\tvar triggerElement = null;\n\tvar title = \"\";\n\tvar description = \"\";\n\tvar buttons = [];\n\tforEachChildDeep(React.Children.toArray(props.children), function(child) {\n\t\tif (!/* @__PURE__ */ React.isValidElement(child)) return false;\n\t\tvar name = isTamaguiElement(child) ? child.type.staticConfig.componentName : child.type[\"displayName\"];\n\t\tswitch (name) {\n\t\t\tcase TRIGGER_NAME:\n\t\t\t\ttriggerElement = /* @__PURE__ */ React.cloneElement(child, { __native: true });\n\t\t\t\treturn false;\n\t\t\tcase TITLE_NAME:\n\t\t\t\ttitle = getStringChildren(child);\n\t\t\t\treturn false;\n\t\t\tcase DESCRIPTION_NAME:\n\t\t\t\tdescription = getStringChildren(child);\n\t\t\t\treturn false;\n\t\t\tcase ACTION_NAME:\n\t\t\tcase DESTRUCTIVE_NAME:\n\t\t\tcase CANCEL_NAME:\n\t\t\t\tvar style = name === ACTION_NAME ? \"default\" : name === DESTRUCTIVE_NAME ? \"destructive\" : \"cancel\";\n\t\t\t\tvar text = getStringChildren(child);\n\t\t\t\tvar onPress = function() {\n\t\t\t\t\tvar _childProps_onPress;\n\t\t\t\t\tvar childProps = child.props;\n\t\t\t\t\tchildProps === null || childProps === void 0 || (_childProps_onPress = childProps.onPress) == null || _childProps_onPress.call(childProps, { native: true });\n\t\t\t\t\tsetOpen(false);\n\t\t\t\t};\n\t\t\t\tbuttons.push({\n\t\t\t\t\tstyle,\n\t\t\t\t\ttext,\n\t\t\t\t\tonPress\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\tdefault: return true;\n\t\t}\n\t});\n\tuseIsomorphicLayoutEffect(function() {\n\t\tif (!open || !native) return;\n\t\tif (title || description) Alert.alert(title, description, buttons);\n\t}, [native, open]);\n\tif (native) return /* @__PURE__ */ React.cloneElement(triggerElement, { __onPress: function() {\n\t\tsetOpen(true);\n\t} });\n\treturn /* @__PURE__ */ jsx(Dialog, {\n\t\tscope: dialogScope,\n\t\t...alertDialogProps,\n\t\tmodal: true\n\t});\n};\nfunction forEachChildDeep(children, onChild) {\n\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\ttry {\n\t\tfor (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\tvar child = _step.value;\n\t\t\tif (!/* @__PURE__ */ React.isValidElement(child)) continue;\n\t\t\tif (!onChild(child)) continue;\n\t\t\tvar childProps = child.props;\n\t\t\tif (childProps.children) forEachChildDeep(React.Children.toArray(childProps.children), onChild);\n\t\t}\n\t} catch (err) {\n\t\t_didIteratorError = true;\n\t\t_iteratorError = err;\n\t} finally {\n\t\ttry {\n\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t} finally {\n\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t}\n\t}\n}\nfunction getStringChildren(child) {\n\tvar string = \"\";\n\tforEachChildDeep(React.Children.toArray(child), function(child2) {\n\t\tif (typeof child2.props.children === \"string\") {\n\t\t\tstring = child2.props.children;\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\treturn string;\n}\nvar AlertDialog = withStaticProperties(AlertDialogInner, {\n\tTrigger: AlertDialogTrigger,\n\tPortal: AlertDialogPortal,\n\tOverlay: AlertDialogOverlay,\n\tContent: AlertDialogContent,\n\tAction: AlertDialogAction,\n\tCancel: AlertDialogCancel,\n\tDestructive: AlertDialogDestructive,\n\tTitle: AlertDialogTitle,\n\tDescription: AlertDialogDescription\n});\nAlertDialog.displayName = ROOT_NAME;\n\nexport { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogDestructive, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };"],"mappings":"AAAA,SAASA,GAAG,EAAEC,IAAI,QAAQ,mBAAmB;AAC7C,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,KAAK,EAAEC,yBAAyB,QAAQ,oBAAoB;AACrE,SAASC,SAAS,EAAEC,IAAI,EAAEC,mBAAmB,EAAEC,gBAAgB,EAAEC,MAAM,QAAQ,eAAe;AAC9F,SAASC,MAAM,EAAEC,WAAW,EAAEC,aAAa,EAAEC,iBAAiB,EAAEC,aAAa,EAAEC,kBAAkB,EAAEC,YAAY,EAAEC,WAAW,EAAEC,aAAa,EAAEC,qBAAqB,QAAQ,iBAAiB;AAC3L,SAASC,oBAAoB,EAAEC,oBAAoB,QAAQ,kBAAkB;AAC7E,SAASC,oBAAoB,QAAQ,iCAAiC;AACtE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,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"AlertDialog.native.js","names":[],"sources":["esm/AlertDialog.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { createStyledHOC, createRefComponent } from \"@tamagui/core\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { Slottable, View, createStyledContext, styled } from \"@tamagui/core\";\nimport { Dialog, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogOverlayFrame, DialogPortal, DialogTitle, DialogTrigger, DialogWarningProvider } from \"@tamagui/dialog\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport * as React from \"react\";\nimport { markAlertDialogPart } from \"./alertDialogPart\";\nimport { useNativeAlertDialog } from \"./useNativeAlertDialog\";\nvar getAlertDialogScope = function(scope) {\n return scope;\n};\nvar ROOT_NAME = \"AlertDialog\";\nvar TRIGGER_NAME = \"AlertDialogTrigger\";\nvar NativeAlertDialogTriggerFrame = styled(View, {\n displayName: TRIGGER_NAME\n});\nmarkAlertDialogPart(NativeAlertDialogTriggerFrame, \"trigger\");\nvar AlertDialogTrigger = createStyledHOC(NativeAlertDialogTriggerFrame, function AlertDialogTrigger2(props, forwardedRef) {\n if (props[\"__native\"]) {\n var { __native, onPress, __onPress, ...rest } = props;\n return /* @__PURE__ */ _jsx(NativeAlertDialogTriggerFrame, {\n ...rest,\n onPress: composeEventHandlers(onPress, __onPress)\n });\n }\n var { scope, ...triggerProps } = props;\n return /* @__PURE__ */ _jsx(DialogTrigger, {\n scope: getAlertDialogScope(scope),\n ...triggerProps,\n ref: forwardedRef\n });\n});\nvar AlertDialogPortal = function AlertDialogPortal2(props) {\n var { scope, ...portalProps } = props;\n return /* @__PURE__ */ _jsx(DialogPortal, {\n scope: getAlertDialogScope(scope),\n ...portalProps\n });\n};\nvar OVERLAY_NAME = \"AlertDialogOverlay\";\nvar AlertDialogOverlayFrame = styled(DialogOverlayFrame, {\n displayName: OVERLAY_NAME\n});\nvar AlertDialogOverlay = createStyledHOC(AlertDialogOverlayFrame, function AlertDialogOverlay2(props, forwardedRef) {\n var { scope, ...overlayProps } = props;\n return /* @__PURE__ */ _jsx(DialogOverlay, {\n scope: getAlertDialogScope(scope),\n ...overlayProps,\n ref: forwardedRef\n });\n});\nvar CONTENT_NAME = \"AlertDialogContent\";\nvar { Provider: AlertDialogContextProvider, useStyledContext: useAlertDialogContentContext } = createStyledContext({}, \"AlertDialogContext\");\nvar AlertDialogContent = createRefComponent(function AlertDialogContent2(props, forwardedRef) {\n var { scope, children, ...contentProps } = props;\n var dialogScope = getAlertDialogScope(scope);\n var contentRef = React.useRef(null);\n var composedRefs = useComposedRefs(forwardedRef, contentRef);\n var cancelRef = React.useRef(null);\n var destructiveRef = React.useRef(null);\n return /* @__PURE__ */ _jsx(DialogWarningProvider, {\n contentName: CONTENT_NAME,\n titleName: TITLE_NAME,\n docsSlug: \"alert-dialog\",\n children: /* @__PURE__ */ _jsx(AlertDialogContextProvider, {\n scope,\n cancelRef,\n destructiveRef,\n children: /* @__PURE__ */ _jsxs(DialogContent, {\n role: \"alertdialog\",\n \"aria-modal\": true,\n scope: dialogScope,\n ...contentProps,\n ref: composedRefs,\n onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, function(event) {\n event.cancel();\n if (isWeb) {\n var _cancelRef_current;\n (_cancelRef_current = cancelRef.current) === null || _cancelRef_current === void 0 ? void 0 : _cancelRef_current.focus({\n preventScroll: true\n });\n }\n }),\n onPointerDownOutside: function(event) {\n return event.cancel();\n },\n onInteractOutside: function(event) {\n return event.cancel();\n },\n children: [\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 /* @__PURE__ */ _jsx(Slottable, {\n children\n }),\n process.env.NODE_ENV === \"development\" && /* @__PURE__ */ _jsx(DescriptionWarning, {\n contentRef\n })\n ]\n })\n })\n });\n});\nvar TITLE_NAME = \"AlertDialogTitle\";\nvar AlertDialogTitleFrame = styled(View, {\n displayName: TITLE_NAME\n});\nmarkAlertDialogPart(AlertDialogTitleFrame, \"title\");\nvar AlertDialogTitle = createStyledHOC(AlertDialogTitleFrame, function AlertDialogTitle2(props, forwardedRef) {\n var { scope, ...titleProps } = props;\n return /* @__PURE__ */ _jsx(DialogTitle, {\n scope: getAlertDialogScope(scope),\n ...titleProps,\n ref: forwardedRef\n });\n});\nvar DESCRIPTION_NAME = \"AlertDialogDescription\";\nvar AlertDialogDescriptionFrame = styled(View, {\n displayName: DESCRIPTION_NAME\n});\nmarkAlertDialogPart(AlertDialogDescriptionFrame, \"description\");\nvar AlertDialogDescription = createStyledHOC(AlertDialogDescriptionFrame, function AlertDialogDescription2(props, forwardedRef) {\n var { scope, ...descriptionProps } = props;\n return /* @__PURE__ */ _jsx(DialogDescription, {\n scope: getAlertDialogScope(scope),\n ...descriptionProps,\n ref: forwardedRef\n });\n});\nvar ACTION_NAME = \"AlertDialogAction\";\nvar AlertDialogActionFrame = styled(View, {\n displayName: ACTION_NAME\n});\nmarkAlertDialogPart(AlertDialogActionFrame, \"action\");\nvar AlertDialogAction = createStyledHOC(AlertDialogActionFrame, function AlertDialogAction2(props, forwardedRef) {\n var { scope, ...actionProps } = props;\n return /* @__PURE__ */ _jsx(DialogClose, {\n scope: getAlertDialogScope(scope),\n ...actionProps,\n ref: forwardedRef\n });\n});\nvar CANCEL_NAME = \"AlertDialogCancel\";\nvar AlertDialogCancelFrame = styled(View, {\n displayName: CANCEL_NAME\n});\nmarkAlertDialogPart(AlertDialogCancelFrame, \"cancel\");\nvar AlertDialogCancel = createStyledHOC(AlertDialogCancelFrame, function AlertDialogCancel2(props, forwardedRef) {\n var { scope, ...cancelProps } = props;\n var { cancelRef } = useAlertDialogContentContext(scope);\n var ref = useComposedRefs(forwardedRef, cancelRef);\n return /* @__PURE__ */ _jsx(DialogClose, {\n scope: getAlertDialogScope(scope),\n ...cancelProps,\n ref\n });\n});\nvar DESTRUCTIVE_NAME = \"AlertDialogDestructive\";\nvar AlertDialogDestructiveFrame = styled(View, {\n displayName: DESTRUCTIVE_NAME\n});\nmarkAlertDialogPart(AlertDialogDestructiveFrame, \"destructive\");\nvar AlertDialogDestructive = createStyledHOC(AlertDialogDestructiveFrame, function AlertDialogDestructive2(props, forwardedRef) {\n var { scope, ...destructiveProps } = props;\n var { destructiveRef } = useAlertDialogContentContext(scope);\n var ref = useComposedRefs(forwardedRef, destructiveRef);\n return /* @__PURE__ */ _jsx(DialogClose, {\n scope: getAlertDialogScope(scope),\n ...destructiveProps,\n ref\n });\n});\nvar DescriptionWarning = function(param) {\n var { contentRef } = param;\n if (process.env.NODE_ENV === \"development\") {\n React.useEffect(function() {\n var _contentRef_current;\n if (!isWeb) return;\n var hasDescription = document.getElementById((_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.getAttribute(\"aria-describedby\"));\n if (!hasDescription) {\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 }, [\n contentRef\n ]);\n }\n return null;\n};\nvar AlertDialogInner = function(props) {\n var { scope, native, ...alertDialogProps } = props;\n var dialogScope = getAlertDialogScope(scope);\n var nativeAlert = useNativeAlertDialog(props);\n if (nativeAlert) return nativeAlert;\n return /* @__PURE__ */ _jsx(Dialog, {\n scope: dialogScope,\n ...alertDialogProps,\n modal: true\n });\n};\nvar AlertDialog = withStaticProperties(AlertDialogInner, {\n Trigger: AlertDialogTrigger,\n Portal: AlertDialogPortal,\n Overlay: AlertDialogOverlay,\n Content: AlertDialogContent,\n Action: AlertDialogAction,\n Cancel: AlertDialogCancel,\n Destructive: AlertDialogDestructive,\n Title: AlertDialogTitle,\n Description: AlertDialogDescription\n});\nAlertDialog.displayName = ROOT_NAME;\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogDestructive,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger\n};\n//# sourceMappingURL=AlertDialog.js.map\n"],"mappings":";;;;;;;;;;;AAUA,IAAI,sBAAsB,SAAS,OAAO;CACxC,OAAO;AACT;AACA,IAAI,YAAY;AAChB,IAAI,eAAe;AACnB,IAAI,gCAAgC,OAAO,MAAM,EAC/C,aAAa,aACf,CAAC;AACD,oBAAoB,+BAA+B,SAAS;AAC5D,IAAI,qBAAqB,gBAAgB,+BAA+B,SAAS,oBAAoB,OAAO,cAAc;CACxH,IAAI,MAAM,aAAa;EACrB,IAAI,EAAE,UAAU,SAAS,WAAW,GAAG,SAAS;EAChD,OAAuB,oBAAK,+BAA+B;GACzD,GAAG;GACH,SAAS,qBAAqB,SAAS,SAAS;EAClD,CAAC;CACH;CACA,IAAI,EAAE,OAAO,GAAG,iBAAiB;CACjC,OAAuB,oBAAK,eAAe;EACzC,OAAO,oBAAoB,KAAK;EAChC,GAAG;EACH,KAAK;CACP,CAAC;AACH,CAAC;AACD,IAAI,oBAAoB,SAAS,mBAAmB,OAAO;CACzD,IAAI,EAAE,OAAO,GAAG,gBAAgB;CAChC,OAAuB,oBAAK,cAAc;EACxC,OAAO,oBAAoB,KAAK;EAChC,GAAG;CACL,CAAC;AACH;AACA,IAAI,eAAe;AACnB,IAAI,0BAA0B,OAAO,oBAAoB,EACvD,aAAa,aACf,CAAC;AACD,IAAI,qBAAqB,gBAAgB,yBAAyB,SAAS,oBAAo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O;CACP,aAAa;AACf,CAAC;AACD,YAAY,cAAc"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const ALERT_DIALOG_PART = /* @__PURE__ */ Symbol("AlertDialogPart");
|
|
2
|
+
const markAlertDialogPart = (component, part) => {
|
|
3
|
+
Object.assign(component.staticConfig, { [ALERT_DIALOG_PART]: part });
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export { ALERT_DIALOG_PART, markAlertDialogPart };
|
|
7
|
+
//# sourceMappingURL=alertDialogPart.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alertDialogPart.js","names":[],"sources":["esm/alertDialogPart.js"],"sourcesContent":["const ALERT_DIALOG_PART = /* @__PURE__ */ Symbol(\"AlertDialogPart\");\nconst markAlertDialogPart = (component, part) => {\n Object.assign(component.staticConfig, { [ALERT_DIALOG_PART]: part });\n};\nexport {\n ALERT_DIALOG_PART,\n markAlertDialogPart\n};\n//# sourceMappingURL=alertDialogPart.js.map\n"],"mappings":";AAAA,MAAM,oBAAoC,uBAAO,iBAAiB;AAClE,MAAM,uBAAuB,WAAW,SAAS;CAC/C,OAAO,OAAO,UAAU,cAAc,GAAG,oBAAoB,KAAK,CAAC;AACrE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var ALERT_DIALOG_PART = /* @__PURE__ */ Symbol("AlertDialogPart");
|
|
2
|
+
var markAlertDialogPart = function(component, part) {
|
|
3
|
+
Object.assign(component.staticConfig, { [ALERT_DIALOG_PART]: part });
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export { ALERT_DIALOG_PART, markAlertDialogPart };
|
|
7
|
+
//# sourceMappingURL=alertDialogPart.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alertDialogPart.native.js","names":[],"sources":["esm/alertDialogPart.native.js"],"sourcesContent":["var ALERT_DIALOG_PART = /* @__PURE__ */ Symbol(\"AlertDialogPart\");\nvar markAlertDialogPart = function(component, part) {\n Object.assign(component.staticConfig, {\n [ALERT_DIALOG_PART]: part\n });\n};\nexport {\n ALERT_DIALOG_PART,\n markAlertDialogPart\n};\n//# sourceMappingURL=alertDialogPart.js.map\n"],"mappings":";AAAA,IAAI,oBAAoC,uBAAO,iBAAiB;AAChE,IAAI,sBAAsB,SAAS,WAAW,MAAM;CAClD,OAAO,OAAO,UAAU,cAAc,GACnC,oBAAoB,KACvB,CAAC;AACH"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./AlertDialog.mjs"
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from "./AlertDialog.mjs"
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./AlertDialog.mjs"
|
|
2
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
export * from "./AlertDialog.mjs"
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./AlertDialog.native.js"
|
|
2
|
-
//# sourceMappingURL=index.native.js.map
|
|
1
|
+
export * from "./AlertDialog.native.js"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNativeAlertDialog.js","names":[],"sources":["esm/useNativeAlertDialog.js"],"sourcesContent":["const useNativeAlertDialog = (_props) => null;\nexport {\n useNativeAlertDialog\n};\n//# sourceMappingURL=useNativeAlertDialog.js.map\n"],"mappings":";AAAA,MAAM,wBAAwB,WAAW"}
|