@tamagui/alert-dialog 1.13.3 → 1.14.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.
@@ -1,324 +1,8 @@
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;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var AlertDialog_exports = {};
30
- __export(AlertDialog_exports, {
31
- AlertDialog: () => AlertDialog,
32
- AlertDialogAction: () => AlertDialogAction,
33
- AlertDialogCancel: () => AlertDialogCancel,
34
- AlertDialogContent: () => AlertDialogContent,
35
- AlertDialogDescription: () => AlertDialogDescription,
36
- AlertDialogOverlay: () => AlertDialogOverlay,
37
- AlertDialogPortal: () => AlertDialogPortal,
38
- AlertDialogTitle: () => AlertDialogTitle,
39
- AlertDialogTrigger: () => AlertDialogTrigger,
40
- createAlertDialogScope: () => createAlertDialogScope
41
- });
42
- module.exports = __toCommonJS(AlertDialog_exports);
43
- var import_jsx_runtime = require("react/jsx-runtime");
44
- var import_compose_refs = require("@tamagui/compose-refs");
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_stacks = require("@tamagui/stacks");
49
- var import_use_controllable_state = require("@tamagui/use-controllable-state");
50
- var React = __toESM(require("react"));
51
- var import_react_native = require("react-native");
52
- const ROOT_NAME = "AlertDialog";
53
- const [createAlertDialogContext, createAlertDialogScope] = (0, import_create_context.createContextScope)(ROOT_NAME, [
54
- import_dialog.createDialogScope
55
- ]);
56
- const useDialogScope = (0, import_dialog.createDialogScope)();
57
- const TRIGGER_NAME = "AlertDialogTrigger";
58
- const NativeAlertDialogTriggerFrame = (0, import_core.styled)(import_stacks.YStack, {
59
- name: "DialogTrigger"
60
- });
61
- const AlertDialogTrigger = React.forwardRef(
62
- (props, forwardedRef) => {
63
- if (props["__native"]) {
64
- const { __native, onPress, __onPress, ...rest } = props;
65
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
66
- NativeAlertDialogTriggerFrame,
67
- {
68
- ...rest,
69
- onPress: (0, import_core.composeEventHandlers)(onPress, __onPress)
70
- }
71
- );
72
- }
73
- const { __scopeAlertDialog, ...triggerProps } = props;
74
- const dialogScope = useDialogScope(__scopeAlertDialog);
75
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTrigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });
76
- }
77
- );
78
- AlertDialogTrigger.displayName = TRIGGER_NAME;
79
- const PORTAL_NAME = "AlertDialogPortal";
80
- const AlertDialogPortal = (props) => {
81
- const { __scopeAlertDialog, ...portalProps } = props;
82
- const dialogScope = useDialogScope(__scopeAlertDialog);
83
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogPortal, { ...dialogScope, ...portalProps });
84
- };
85
- AlertDialogPortal.displayName = PORTAL_NAME;
86
- const OVERLAY_NAME = "AlertDialogOverlay";
87
- const AlertDialogOverlayFrame = (0, import_core.styled)(import_dialog.DialogOverlayFrame, {
88
- name: OVERLAY_NAME
89
- });
90
- const AlertDialogOverlay = AlertDialogOverlayFrame.extractable(
91
- React.forwardRef(
92
- (props, forwardedRef) => {
93
- const { __scopeAlertDialog, ...overlayProps } = props;
94
- const dialogScope = useDialogScope(__scopeAlertDialog);
95
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogOverlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
96
- }
97
- )
98
- );
99
- AlertDialogOverlay.displayName = OVERLAY_NAME;
100
- const CONTENT_NAME = "AlertDialogContent";
101
- const [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
102
- const AlertDialogContent = React.forwardRef(
103
- (props, forwardedRef) => {
104
- const { __scopeAlertDialog, children, ...contentProps } = props;
105
- const dialogScope = useDialogScope(__scopeAlertDialog);
106
- const contentRef = React.useRef(null);
107
- const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef);
108
- const cancelRef = React.useRef(null);
109
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
110
- import_dialog.DialogWarningProvider,
111
- {
112
- contentName: CONTENT_NAME,
113
- titleName: TITLE_NAME,
114
- docsSlug: "alert-dialog",
115
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
116
- import_dialog.DialogContent,
117
- {
118
- role: "alertdialog",
119
- ...dialogScope,
120
- ...contentProps,
121
- ref: composedRefs,
122
- onOpenAutoFocus: (0, import_core.composeEventHandlers)(
123
- contentProps.onOpenAutoFocus,
124
- (event) => {
125
- var _a;
126
- event.preventDefault();
127
- if (import_core.isWeb) {
128
- (_a = cancelRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
129
- }
130
- }
131
- ),
132
- onPointerDownOutside: (event) => event.preventDefault(),
133
- onInteractOutside: (event) => event.preventDefault(),
134
- children: [
135
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slottable, { children }),
136
- process.env.NODE_ENV === "development" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionWarning, { contentRef })
137
- ]
138
- }
139
- ) })
140
- }
141
- );
142
- }
143
- );
144
- AlertDialogContent.displayName = CONTENT_NAME;
145
- const TITLE_NAME = "AlertDialogTitle";
146
- const AlertDialogTitle = React.forwardRef(
147
- (props, forwardedRef) => {
148
- const { __scopeAlertDialog, ...titleProps } = props;
149
- const dialogScope = useDialogScope(__scopeAlertDialog);
150
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTitle, { ...dialogScope, ...titleProps, ref: forwardedRef });
151
- }
152
- );
153
- AlertDialogTitle.displayName = TITLE_NAME;
154
- const DESCRIPTION_NAME = "AlertDialogDescription";
155
- const AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
156
- const { __scopeAlertDialog, ...descriptionProps } = props;
157
- const dialogScope = useDialogScope(__scopeAlertDialog);
158
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogDescription, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
159
- });
160
- AlertDialogDescription.displayName = DESCRIPTION_NAME;
161
- const ACTION_NAME = "AlertDialogAction";
162
- const AlertDialogAction = React.forwardRef(
163
- (props, forwardedRef) => {
164
- const { __scopeAlertDialog, ...actionProps } = props;
165
- const dialogScope = useDialogScope(__scopeAlertDialog);
166
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, { ...dialogScope, ...actionProps, ref: forwardedRef });
167
- }
168
- );
169
- AlertDialogAction.displayName = ACTION_NAME;
170
- const CANCEL_NAME = "AlertDialogCancel";
171
- const AlertDialogCancel = React.forwardRef(
172
- (props, forwardedRef) => {
173
- const { __scopeAlertDialog, ...cancelProps } = props;
174
- const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
175
- const dialogScope = useDialogScope(__scopeAlertDialog);
176
- const ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
177
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, { ...dialogScope, ...cancelProps, ref });
178
- }
179
- );
180
- AlertDialogCancel.displayName = CANCEL_NAME;
181
- const DescriptionWarning = ({ contentRef }) => {
182
- if (process.env.NODE_ENV === "development") {
183
- React.useEffect(() => {
184
- var _a;
185
- if (!import_core.isWeb)
186
- return;
187
- const hasDescription = document.getElementById(
188
- // @ts-ignore
189
- // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
190
- (_a = contentRef.current) == null ? void 0 : _a.getAttribute("aria-describedby")
191
- );
192
- if (!hasDescription) {
193
- console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
1
+ "use strict";var K=Object.create;var y=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var oe=(e,t)=>{for(var o in t)y(e,o,{get:t[o],enumerable:!0})},L=(e,t,o,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of X(t))!ee.call(e,a)&&a!==o&&y(e,a,{get:()=>t[a],enumerable:!(l=Q(t,a))||l.enumerable});return e};var te=(e,t,o)=>(o=e!=null?K(Z(e)):{},L(t||!e||!e.__esModule?y(o,"default",{value:e,enumerable:!0}):o,e)),re=e=>L(y({},"__esModule",{value:!0}),e);var De={};oe(De,{AlertDialog:()=>F,AlertDialogAction:()=>S,AlertDialogCancel:()=>N,AlertDialogContent:()=>E,AlertDialogDescription:()=>R,AlertDialogOverlay:()=>v,AlertDialogPortal:()=>T,AlertDialogTitle:()=>_,AlertDialogTrigger:()=>C,createAlertDialogScope:()=>H});module.exports=re(De);var s=require("react/jsx-runtime"),M=require("@tamagui/compose-refs"),i=require("@tamagui/core"),j=require("@tamagui/create-context"),r=require("@tamagui/dialog"),k=require("@tamagui/stacks"),q=require("@tamagui/use-controllable-state"),n=te(require("react")),B=require("react-native");const G="AlertDialog",[ae,H]=(0,j.createContextScope)(G,[r.createDialogScope]),D=(0,r.createDialogScope)(),$="AlertDialogTrigger",le=(0,i.styled)(k.YStack,{name:"DialogTrigger"}),C=n.forwardRef((e,t)=>{if(e.__native){const{__native:A,onPress:c,__onPress:d,...u}=e;return(0,s.jsx)(le,{...u,onPress:(0,i.composeEventHandlers)(c,d)})}const{__scopeAlertDialog:o,...l}=e,a=D(o);return(0,s.jsx)(r.DialogTrigger,{...a,...l,ref:t})});C.displayName=$;const ne="AlertDialogPortal",T=e=>{const{__scopeAlertDialog:t,...o}=e,l=D(t);return(0,s.jsx)(r.DialogPortal,{...l,...o})};T.displayName=ne;const Y="AlertDialogOverlay",ie=(0,i.styled)(r.DialogOverlayFrame,{name:Y}),v=ie.extractable(n.forwardRef((e,t)=>{const{__scopeAlertDialog:o,...l}=e,a=D(o);return(0,s.jsx)(r.DialogOverlay,{...a,...l,ref:t})}));v.displayName=Y;const P="AlertDialogContent",[se,ce]=ae(P),E=n.forwardRef((e,t)=>{const{__scopeAlertDialog:o,children:l,...a}=e,A=D(o),c=n.useRef(null),d=(0,M.useComposedRefs)(t,c),u=n.useRef(null);return(0,s.jsx)(r.DialogWarningProvider,{contentName:P,titleName:O,docsSlug:"alert-dialog",children:(0,s.jsx)(se,{scope:o,cancelRef:u,children:(0,s.jsxs)(r.DialogContent,{role:"alertdialog",...A,...a,ref:d,onOpenAutoFocus:(0,i.composeEventHandlers)(a.onOpenAutoFocus,p=>{var f;p.preventDefault(),i.isWeb&&((f=u.current)==null||f.focus({preventScroll:!0}))}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[(0,s.jsx)(i.Slottable,{children:l}),process.env.NODE_ENV==="development"&&(0,s.jsx)(pe,{contentRef:c})]})})})});E.displayName=P;const O="AlertDialogTitle",_=n.forwardRef((e,t)=>{const{__scopeAlertDialog:o,...l}=e,a=D(o);return(0,s.jsx)(r.DialogTitle,{...a,...l,ref:t})});_.displayName=O;const b="AlertDialogDescription",R=n.forwardRef((e,t)=>{const{__scopeAlertDialog:o,...l}=e,a=D(o);return(0,s.jsx)(r.DialogDescription,{...a,...l,ref:t})});R.displayName=b;const h="AlertDialogAction",S=n.forwardRef((e,t)=>{const{__scopeAlertDialog:o,...l}=e,a=D(o);return(0,s.jsx)(r.DialogClose,{...a,...l,ref:t})});S.displayName=h;const x="AlertDialogCancel",N=n.forwardRef((e,t)=>{const{__scopeAlertDialog:o,...l}=e,{cancelRef:a}=ce(x,o),A=D(o),c=(0,M.useComposedRefs)(t,a);return(0,s.jsx)(r.DialogClose,{...A,...l,ref:c})});N.displayName=x;const pe=({contentRef:e})=>(process.env.NODE_ENV==="development"&&n.useEffect(()=>{var o;if(!i.isWeb)return;document.getElementById((o=e.current)==null?void 0:o.getAttribute("aria-describedby"))||console.warn(`\`${P}\` requires a description for the component to be accessible for screen reader users.
194
2
 
195
- 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.
3
+ You can add a description to the \`${P}\` by passing a \`${b}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
196
4
 
197
- 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.
5
+ 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 \`${P}\`. 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.
198
6
 
199
- For more information, see https://tamagui.dev/docs/components/alert-dialog`);
200
- }
201
- }, [contentRef]);
202
- }
203
- return null;
204
- };
205
- const AlertDialogInner = (props) => {
206
- const { __scopeAlertDialog, native, ...alertDialogProps } = props;
207
- const dialogScope = useDialogScope(__scopeAlertDialog);
208
- if (process.env.TAMAGUI_TARGET === "native") {
209
- const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
210
- prop: props.open,
211
- defaultProp: props.defaultOpen || false,
212
- onChange: props.onOpenChange,
213
- transition: true
214
- });
215
- let triggerElement = null;
216
- let title = "";
217
- let description = "";
218
- const buttons = [];
219
- forEachChildDeep(React.Children.toArray(props.children), (child) => {
220
- if (!React.isValidElement(child))
221
- return false;
222
- const name = (0, import_core.isTamaguiElement)(child) ? child.type.staticConfig.componentName : child.type["displayName"];
223
- switch (name) {
224
- case TRIGGER_NAME: {
225
- triggerElement = React.cloneElement(child, {
226
- __native: true
227
- });
228
- return false;
229
- }
230
- case TITLE_NAME: {
231
- title = getStringChildren(child);
232
- return false;
233
- }
234
- case DESCRIPTION_NAME: {
235
- description = getStringChildren(child);
236
- return false;
237
- }
238
- case ACTION_NAME:
239
- case CANCEL_NAME: {
240
- const style = name === ACTION_NAME ? "default" : "cancel";
241
- const text = getStringChildren(child);
242
- const onPress = () => {
243
- var _a;
244
- const childProps = child.props;
245
- (_a = childProps == null ? void 0 : childProps.onPress) == null ? void 0 : _a.call(childProps, { native: true });
246
- setOpen(false);
247
- };
248
- buttons.push({
249
- style,
250
- text,
251
- // @ts-ignore
252
- onPress
253
- });
254
- return false;
255
- }
256
- default: {
257
- return true;
258
- }
259
- }
260
- });
261
- (0, import_core.useIsomorphicLayoutEffect)(() => {
262
- if (!open || !native)
263
- return;
264
- if (title || description) {
265
- import_react_native.Alert.alert(title, description, buttons);
266
- }
267
- }, [native, open]);
268
- if (native) {
269
- return React.cloneElement(triggerElement, {
270
- __onPress: () => {
271
- setOpen(true);
272
- }
273
- });
274
- }
275
- }
276
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, { ...dialogScope, ...alertDialogProps, modal: true });
277
- };
278
- function forEachChildDeep(children, onChild) {
279
- for (const child of children) {
280
- if (!React.isValidElement(child))
281
- continue;
282
- if (!onChild(child))
283
- continue;
284
- if (child.props.children) {
285
- forEachChildDeep(React.Children.toArray(child.props.children), onChild);
286
- }
287
- }
288
- }
289
- function getStringChildren(child) {
290
- let string = "";
291
- forEachChildDeep(React.Children.toArray(child), (child2) => {
292
- if (typeof child2.props.children === "string") {
293
- string = child2.props.children;
294
- return false;
295
- }
296
- return true;
297
- });
298
- return string;
299
- }
300
- const AlertDialog = (0, import_core.withStaticProperties)(AlertDialogInner, {
301
- Trigger: AlertDialogTrigger,
302
- Portal: AlertDialogPortal,
303
- Overlay: AlertDialogOverlay,
304
- Content: AlertDialogContent,
305
- Action: AlertDialogAction,
306
- Cancel: AlertDialogCancel,
307
- Title: AlertDialogTitle,
308
- Description: AlertDialogDescription
309
- });
310
- AlertDialog.displayName = ROOT_NAME;
311
- // Annotate the CommonJS export names for ESM import in node:
312
- 0 && (module.exports = {
313
- AlertDialog,
314
- AlertDialogAction,
315
- AlertDialogCancel,
316
- AlertDialogContent,
317
- AlertDialogDescription,
318
- AlertDialogOverlay,
319
- AlertDialogPortal,
320
- AlertDialogTitle,
321
- AlertDialogTrigger,
322
- createAlertDialogScope
323
- });
7
+ For more information, see https://tamagui.dev/docs/components/alert-dialog`)},[e]),null),ge=e=>{const{__scopeAlertDialog:t,native:o,...l}=e,a=D(t);if(process.env.TAMAGUI_TARGET==="native"){const[A,c]=(0,q.useControllableState)({prop:e.open,defaultProp:e.defaultOpen||!1,onChange:e.onOpenChange,transition:!0});let d=null,u="",p="";const f=[];if(w(n.Children.toArray(e.children),g=>{if(!n.isValidElement(g))return!1;const V=(0,i.isTamaguiElement)(g)?g.type.staticConfig.componentName:g.type.displayName;switch(V){case $:return d=n.cloneElement(g,{__native:!0}),!1;case O:return u=I(g),!1;case b:return p=I(g),!1;case h:case x:{const U=V===h?"default":"cancel",z=I(g),J=()=>{var W;const m=g.props;(W=m==null?void 0:m.onPress)==null||W.call(m,{native:!0}),c(!1)};return f.push({style:U,text:z,onPress:J}),!1}default:return!0}}),(0,i.useIsomorphicLayoutEffect)(()=>{!A||!o||(u||p)&&B.Alert.alert(u,p,f)},[o,A]),o)return n.cloneElement(d,{__onPress:()=>{c(!0)}})}return(0,s.jsx)(r.Dialog,{...a,...l,modal:!0})};function w(e,t){for(const o of e)n.isValidElement(o)&&t(o)&&o.props.children&&w(n.Children.toArray(o.props.children),t)}function I(e){let t="";return w(n.Children.toArray(e),o=>typeof o.props.children=="string"?(t=o.props.children,!1):!0),t}const F=(0,i.withStaticProperties)(ge,{Trigger:C,Portal:T,Overlay:v,Content:E,Action:S,Cancel:N,Title:_,Description:R});F.displayName=G;0&&(module.exports={AlertDialog,AlertDialogAction,AlertDialogCancel,AlertDialogContent,AlertDialogDescription,AlertDialogOverlay,AlertDialogPortal,AlertDialogTitle,AlertDialogTrigger,createAlertDialogScope});
324
8
  //# sourceMappingURL=AlertDialog.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/AlertDialog.tsx"],
4
4
  "sourcesContent": ["// forked from radix-ui\n// https://github.com/radix-ui/primitives/blob/main/packages/react/alert-dialog/src/AlertDialog.tsx\n\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n Slottable,\n TamaguiElement,\n composeEventHandlers,\n isTamaguiElement,\n isWeb,\n styled,\n useIsomorphicLayoutEffect,\n withStaticProperties,\n} from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport {\n Dialog,\n DialogClose,\n DialogCloseProps,\n DialogContent,\n DialogContentProps,\n DialogDescription,\n DialogDescriptionProps,\n DialogOverlay,\n DialogOverlayFrame,\n DialogOverlayProps,\n DialogPortal,\n DialogPortalProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n DialogTrigger,\n DialogTriggerProps,\n DialogWarningProvider,\n createDialogScope,\n} from '@tamagui/dialog'\nimport { YStack } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\nimport { Alert } from 'react-native'\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog'\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope }\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n])\n\nconst useDialogScope = createDialogScope()\n\ntype AlertDialogProps = DialogProps & {\n native?: boolean\n}\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'AlertDialogTrigger'\n\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst NativeAlertDialogTriggerFrame = styled(YStack, {\n name: 'DialogTrigger',\n})\n\nconst AlertDialogTrigger = React.forwardRef<TamaguiElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n if (props['__native']) {\n const { __native, onPress, __onPress, ...rest } = props as any\n return (\n <NativeAlertDialogTriggerFrame\n {...rest}\n onPress={composeEventHandlers(onPress, __onPress)}\n />\n )\n }\n\n const { __scopeAlertDialog, ...triggerProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogTrigger {...dialogScope} {...triggerProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal'\n\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogPortal {...dialogScope} {...portalProps} />\n}\n\nAlertDialogPortal.displayName = PORTAL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay'\n\nconst AlertDialogOverlayFrame = styled(DialogOverlayFrame, {\n name: OVERLAY_NAME,\n})\n\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = AlertDialogOverlayFrame.extractable(\n React.forwardRef<TamaguiElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogOverlay {...dialogScope} {...overlayProps} ref={forwardedRef} />\n }\n )\n)\n\nAlertDialogOverlay.displayName = OVERLAY_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent'\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<TamaguiElement | null>\n}\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME)\n\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<TamaguiElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n const contentRef = React.useRef<TamaguiElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const cancelRef = React.useRef<TamaguiElement | null>(null)\n\n return (\n <DialogWarningProvider\n contentName={CONTENT_NAME}\n titleName={TITLE_NAME}\n docsSlug=\"alert-dialog\"\n >\n <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>\n <DialogContent\n // @ts-ignore\n role=\"alertdialog\"\n {...dialogScope}\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(\n contentProps.onOpenAutoFocus,\n (event) => {\n event.preventDefault()\n if (isWeb) {\n // @ts-ignore\n cancelRef.current?.focus({ preventScroll: true })\n }\n }\n )}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogContent>\n </AlertDialogContentProvider>\n </DialogWarningProvider>\n )\n }\n)\n\nAlertDialogContent.displayName = CONTENT_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle'\n\ntype AlertDialogTitleProps = DialogTitleProps\n\nconst AlertDialogTitle = React.forwardRef<TamaguiElement, AlertDialogTitleProps>(\n (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...titleProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogTitle {...dialogScope} {...titleProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogTitle.displayName = TITLE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription'\n\ntype AlertDialogDescriptionProps = DialogDescriptionProps\n\nconst AlertDialogDescription = React.forwardRef<\n TamaguiElement,\n AlertDialogDescriptionProps\n>((props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...descriptionProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogDescription {...dialogScope} {...descriptionProps} ref={forwardedRef} />\n})\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction'\n\ntype AlertDialogActionProps = DialogCloseProps\n\nconst AlertDialogAction = React.forwardRef<TamaguiElement, AlertDialogActionProps>(\n (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...actionProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogClose {...dialogScope} {...actionProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogAction.displayName = ACTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel'\n\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<TamaguiElement, AlertDialogCancelProps>(\n (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...cancelProps } = props\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog)\n const dialogScope = useDialogScope(__scopeAlertDialog)\n const ref = useComposedRefs(forwardedRef, cancelRef)\n return <DialogClose {...dialogScope} {...cancelProps} ref={ref} />\n }\n)\n\nAlertDialogCancel.displayName = CANCEL_NAME\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<TamaguiElement>\n}\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n if (process.env.NODE_ENV === 'development') {\n React.useEffect(() => {\n if (!isWeb) return\n const hasDescription = document.getElementById(\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain\n contentRef.current?.getAttribute('aria-describedby')!\n )\n if (!hasDescription) {\n // eslint-disable-next-line no-console\n console.warn(`\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n \n You can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n \n Alternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n \n For more information, see https://tamagui.dev/docs/components/alert-dialog`)\n }\n }, [contentRef])\n }\n\n return null\n}\n\nconst AlertDialogInner: React.FC<AlertDialogProps> = (\n props: ScopedProps<AlertDialogProps>\n) => {\n const { __scopeAlertDialog, native, ...alertDialogProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n const [open, setOpen] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen || false,\n onChange: props.onOpenChange,\n transition: true,\n })\n\n let triggerElement: any = null\n let title = ''\n let description = ''\n const buttons: {\n text: string\n onPress: (value?: string | undefined) => void\n style?: 'default' | 'cancel' | 'destructive'\n }[] = []\n\n forEachChildDeep(React.Children.toArray(props.children), (child) => {\n if (!React.isValidElement(child)) return false\n const name = isTamaguiElement(child)\n ? child.type.staticConfig.componentName\n : (child.type['displayName'] as string | undefined)\n switch (name) {\n case TRIGGER_NAME: {\n triggerElement = React.cloneElement(child as any, {\n __native: true,\n })\n return false\n }\n case TITLE_NAME: {\n title = getStringChildren(child)\n return false\n }\n case DESCRIPTION_NAME: {\n description = getStringChildren(child)\n return false\n }\n case ACTION_NAME:\n case CANCEL_NAME: {\n const style = name === ACTION_NAME ? 'default' : 'cancel'\n const text = getStringChildren(child)\n const onPress = () => {\n const childProps = child.props as any\n childProps?.onPress?.({ native: true })\n setOpen(false)\n }\n buttons.push({\n style,\n text,\n // @ts-ignore\n onPress,\n })\n return false\n }\n default: {\n return true\n }\n }\n })\n\n useIsomorphicLayoutEffect(() => {\n if (!open || !native) return\n if (title || description) {\n Alert.alert(title, description, buttons)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [native, open])\n\n if (native) {\n return React.cloneElement(triggerElement, {\n __onPress: () => {\n setOpen(true)\n },\n })\n }\n }\n\n return <Dialog {...dialogScope} {...alertDialogProps} modal />\n}\n\nfunction forEachChildDeep(\n children: React.ReactNode[],\n onChild: (el: React.ReactElement) => boolean\n) {\n for (const child of children) {\n if (!React.isValidElement(child)) continue\n if (!onChild(child)) continue\n if (child.props.children) {\n forEachChildDeep(React.Children.toArray(child.props.children), onChild)\n }\n }\n}\n\nfunction getStringChildren(child: React.ReactElement) {\n let string = ''\n forEachChildDeep(React.Children.toArray(child), (child) => {\n if (typeof child.props.children === 'string') {\n string = child.props.children\n return false\n }\n return true\n })\n return string\n}\n\nconst AlertDialog = withStaticProperties(AlertDialogInner, {\n Trigger: AlertDialogTrigger,\n Portal: AlertDialogPortal,\n Overlay: AlertDialogOverlay,\n Content: AlertDialogContent,\n Action: AlertDialogAction,\n Cancel: AlertDialogCancel,\n Title: AlertDialogTitle,\n Description: AlertDialogDescription,\n})\n\nAlertDialog.displayName = ROOT_NAME\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n}\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2EQ;AAxER,0B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BzC,EAAU,IAAM,CAlWhC,IAAAqB,EAmWY,MAAMyB,EAAaL,EAAM,OACzBpB,EAAAyB,GAAA,YAAAA,EAAY,UAAZ,MAAAzB,EAAA,KAAAyB,EAAsB,CAAE,OAAQ,EAAK,GACrCX,EAAQ,EAAK,CACf,EACA,OAAAI,EAAQ,KAAK,CACX,MAAAK,EACA,KAAAC,EAEA,QAAA7C,CACF,CAAC,EACM,EACT,CACA,QACE,MAAO,EAEX,CACF,CAAC,KAED,6BAA0B,IAAM,CAC1B,CAACkC,GAAQ,CAACF,IACVK,GAASC,IACX,QAAM,MAAMD,EAAOC,EAAaC,CAAO,CAG3C,EAAG,CAACP,EAAQE,CAAI,CAAC,EAEbF,EACF,OAAO1C,EAAM,aAAa8C,EAAgB,CACxC,UAAW,IAAM,CACfD,EAAQ,EAAI,CACd,CACF,CAAC,CAEL,CAEA,SAAO,OAAC,UAAQ,GAAG9B,EAAc,GAAG4B,EAAkB,MAAK,GAAC,CAC9D,EAEA,SAASO,EACP1B,EACAiC,EACA,CACA,UAAWN,KAAS3B,EACbxB,EAAM,eAAemD,CAAK,GAC1BM,EAAQN,CAAK,GACdA,EAAM,MAAM,UACdD,EAAiBlD,EAAM,SAAS,QAAQmD,EAAM,MAAM,QAAQ,EAAGM,CAAO,CAG5E,CAEA,SAASJ,EAAkBF,EAA2B,CACpD,IAAIO,EAAS,GACb,OAAAR,EAAiBlD,EAAM,SAAS,QAAQmD,CAAK,EAAIA,GAC3C,OAAOA,EAAM,MAAM,UAAa,UAClCO,EAASP,EAAM,MAAM,SACd,IAEF,EACR,EACMO,CACT,CAEA,MAAM5E,KAAc,wBAAqB2D,GAAkB,CACzD,QAASnD,EACT,OAAQF,EACR,QAASD,EACT,QAASF,EACT,OAAQF,EACR,OAAQC,EACR,MAAOK,EACP,YAAaH,CACf,CAAC,EAEDJ,EAAY,YAAcoB",
6
+ "names": ["AlertDialog_exports", "__export", "AlertDialog", "AlertDialogAction", "AlertDialogCancel", "AlertDialogContent", "AlertDialogDescription", "AlertDialogOverlay", "AlertDialogPortal", "AlertDialogTitle", "AlertDialogTrigger", "createAlertDialogScope", "__toCommonJS", "import_jsx_runtime", "import_compose_refs", "import_core", "import_create_context", "import_dialog", "import_stacks", "import_use_controllable_state", "React", "import_react_native", "ROOT_NAME", "createAlertDialogContext", "useDialogScope", "TRIGGER_NAME", "NativeAlertDialogTriggerFrame", "props", "forwardedRef", "__native", "onPress", "__onPress", "rest", "__scopeAlertDialog", "triggerProps", "dialogScope", "PORTAL_NAME", "portalProps", "OVERLAY_NAME", "AlertDialogOverlayFrame", "overlayProps", "CONTENT_NAME", "AlertDialogContentProvider", "useAlertDialogContentContext", "children", "contentProps", "contentRef", "composedRefs", "cancelRef", "TITLE_NAME", "event", "_a", "DescriptionWarning", "titleProps", "DESCRIPTION_NAME", "descriptionProps", "ACTION_NAME", "actionProps", "CANCEL_NAME", "cancelProps", "ref", "AlertDialogInner", "native", "alertDialogProps", "open", "setOpen", "triggerElement", "title", "description", "buttons", "forEachChildDeep", "child", "name", "getStringChildren", "style", "text", "childProps", "onChild", "string"]
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -1,19 +1,2 @@
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
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var src_exports = {};
17
- module.exports = __toCommonJS(src_exports);
18
- __reExport(src_exports, require("./AlertDialog"), module.exports);
1
+ "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("./AlertDialog"),module.exports);
19
2
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
4
  "sourcesContent": ["export * from './AlertDialog'\n"],
5
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,0BAAd;",
6
- "names": []
5
+ "mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,yBAAd",
6
+ "names": ["src_exports", "__toCommonJS", "__reExport"]
7
7
  }