@tamagui/alert-dialog 1.0.1-beta.104
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/LICENSE +21 -0
- package/dist/cjs/AlertDialog.js +219 -0
- package/dist/cjs/AlertDialog.js.map +7 -0
- package/dist/cjs/Dialog.js +523 -0
- package/dist/cjs/Dialog.js.map +7 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/esm/AlertDialog.js +202 -0
- package/dist/esm/AlertDialog.js.map +7 -0
- package/dist/esm/Dialog.js +498 -0
- package/dist/esm/Dialog.js.map +7 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/jsx/AlertDialog.js +144 -0
- package/dist/jsx/AlertDialog.js.map +7 -0
- package/dist/jsx/Dialog.js +355 -0
- package/dist/jsx/Dialog.js.map +7 -0
- package/dist/jsx/index.js +2 -0
- package/dist/jsx/index.js.map +7 -0
- package/package.json +56 -0
- package/src/AlertDialog.tsx +313 -0
- package/src/index.ts +1 -0
- package/types/AlertDialog.d.ts +1378 -0
- package/types/AlertDialog.d.ts.map +1 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
33
|
+
import {
|
|
34
|
+
Slottable,
|
|
35
|
+
composeEventHandlers,
|
|
36
|
+
isWeb,
|
|
37
|
+
withStaticProperties
|
|
38
|
+
} from "@tamagui/core";
|
|
39
|
+
import { createContextScope } from "@tamagui/create-context";
|
|
40
|
+
import {
|
|
41
|
+
Dialog,
|
|
42
|
+
DialogClose,
|
|
43
|
+
DialogContent,
|
|
44
|
+
DialogDescription,
|
|
45
|
+
DialogOverlay,
|
|
46
|
+
DialogPortal,
|
|
47
|
+
DialogTitle,
|
|
48
|
+
DialogTrigger,
|
|
49
|
+
DialogWarningProvider,
|
|
50
|
+
createDialogScope
|
|
51
|
+
} from "@tamagui/dialog";
|
|
52
|
+
import * as React from "react";
|
|
53
|
+
const ROOT_NAME = "AlertDialog";
|
|
54
|
+
const [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [
|
|
55
|
+
createDialogScope
|
|
56
|
+
]);
|
|
57
|
+
const useDialogScope = createDialogScope();
|
|
58
|
+
const TRIGGER_NAME = "AlertDialogTrigger";
|
|
59
|
+
const AlertDialogTrigger = React.forwardRef((props, forwardedRef) => {
|
|
60
|
+
const _a = props, { __scopeAlertDialog } = _a, triggerProps = __objRest(_a, ["__scopeAlertDialog"]);
|
|
61
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
62
|
+
return /* @__PURE__ */ React.createElement(DialogTrigger, __spreadProps(__spreadValues(__spreadValues({}, dialogScope), triggerProps), {
|
|
63
|
+
ref: forwardedRef
|
|
64
|
+
}));
|
|
65
|
+
});
|
|
66
|
+
AlertDialogTrigger.displayName = TRIGGER_NAME;
|
|
67
|
+
const PORTAL_NAME = "AlertDialogPortal";
|
|
68
|
+
const AlertDialogPortal = (props) => {
|
|
69
|
+
const _a = props, { __scopeAlertDialog } = _a, portalProps = __objRest(_a, ["__scopeAlertDialog"]);
|
|
70
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
71
|
+
return /* @__PURE__ */ React.createElement(DialogPortal, __spreadValues(__spreadValues({}, dialogScope), portalProps));
|
|
72
|
+
};
|
|
73
|
+
AlertDialogPortal.displayName = PORTAL_NAME;
|
|
74
|
+
const OVERLAY_NAME = "AlertDialogOverlay";
|
|
75
|
+
const AlertDialogOverlay = React.forwardRef((props, forwardedRef) => {
|
|
76
|
+
const _a = props, { __scopeAlertDialog } = _a, overlayProps = __objRest(_a, ["__scopeAlertDialog"]);
|
|
77
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
78
|
+
return /* @__PURE__ */ React.createElement(DialogOverlay, __spreadProps(__spreadValues(__spreadValues({}, dialogScope), overlayProps), {
|
|
79
|
+
ref: forwardedRef
|
|
80
|
+
}));
|
|
81
|
+
});
|
|
82
|
+
AlertDialogOverlay.displayName = OVERLAY_NAME;
|
|
83
|
+
const CONTENT_NAME = "AlertDialogContent";
|
|
84
|
+
const [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
|
|
85
|
+
const AlertDialogContent = React.forwardRef((props, forwardedRef) => {
|
|
86
|
+
const _a = props, { __scopeAlertDialog, children } = _a, contentProps = __objRest(_a, ["__scopeAlertDialog", "children"]);
|
|
87
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
88
|
+
const contentRef = React.useRef(null);
|
|
89
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
90
|
+
const cancelRef = React.useRef(null);
|
|
91
|
+
return /* @__PURE__ */ React.createElement(DialogWarningProvider, {
|
|
92
|
+
contentName: CONTENT_NAME,
|
|
93
|
+
titleName: TITLE_NAME,
|
|
94
|
+
docsSlug: "alert-dialog"
|
|
95
|
+
}, /* @__PURE__ */ React.createElement(AlertDialogContentProvider, {
|
|
96
|
+
scope: __scopeAlertDialog,
|
|
97
|
+
cancelRef
|
|
98
|
+
}, /* @__PURE__ */ React.createElement(DialogContent, __spreadProps(__spreadValues(__spreadValues({
|
|
99
|
+
role: "alertdialog"
|
|
100
|
+
}, dialogScope), contentProps), {
|
|
101
|
+
ref: composedRefs,
|
|
102
|
+
onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
|
|
103
|
+
var _a2;
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
if (isWeb) {
|
|
106
|
+
(_a2 = cancelRef.current) == null ? void 0 : _a2.focus({ preventScroll: true });
|
|
107
|
+
}
|
|
108
|
+
}),
|
|
109
|
+
onPointerDownOutside: (event) => event.preventDefault(),
|
|
110
|
+
onInteractOutside: (event) => event.preventDefault()
|
|
111
|
+
}), /* @__PURE__ */ React.createElement(Slottable, null, children), process.env.NODE_ENV === "development" && /* @__PURE__ */ React.createElement(DescriptionWarning, {
|
|
112
|
+
contentRef
|
|
113
|
+
}))));
|
|
114
|
+
});
|
|
115
|
+
AlertDialogContent.displayName = CONTENT_NAME;
|
|
116
|
+
const TITLE_NAME = "AlertDialogTitle";
|
|
117
|
+
const AlertDialogTitle = React.forwardRef((props, forwardedRef) => {
|
|
118
|
+
const _a = props, { __scopeAlertDialog } = _a, titleProps = __objRest(_a, ["__scopeAlertDialog"]);
|
|
119
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
120
|
+
return /* @__PURE__ */ React.createElement(DialogTitle, __spreadProps(__spreadValues(__spreadValues({}, dialogScope), titleProps), {
|
|
121
|
+
ref: forwardedRef
|
|
122
|
+
}));
|
|
123
|
+
});
|
|
124
|
+
AlertDialogTitle.displayName = TITLE_NAME;
|
|
125
|
+
const DESCRIPTION_NAME = "AlertDialogDescription";
|
|
126
|
+
const AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
|
|
127
|
+
const _a = props, { __scopeAlertDialog } = _a, descriptionProps = __objRest(_a, ["__scopeAlertDialog"]);
|
|
128
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
129
|
+
return /* @__PURE__ */ React.createElement(DialogDescription, __spreadProps(__spreadValues(__spreadValues({}, dialogScope), descriptionProps), {
|
|
130
|
+
ref: forwardedRef
|
|
131
|
+
}));
|
|
132
|
+
});
|
|
133
|
+
AlertDialogDescription.displayName = DESCRIPTION_NAME;
|
|
134
|
+
const ACTION_NAME = "AlertDialogAction";
|
|
135
|
+
const AlertDialogAction = React.forwardRef((props, forwardedRef) => {
|
|
136
|
+
const _a = props, { __scopeAlertDialog } = _a, actionProps = __objRest(_a, ["__scopeAlertDialog"]);
|
|
137
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
138
|
+
return /* @__PURE__ */ React.createElement(DialogClose, __spreadProps(__spreadValues(__spreadValues({}, dialogScope), actionProps), {
|
|
139
|
+
ref: forwardedRef
|
|
140
|
+
}));
|
|
141
|
+
});
|
|
142
|
+
AlertDialogAction.displayName = ACTION_NAME;
|
|
143
|
+
const CANCEL_NAME = "AlertDialogCancel";
|
|
144
|
+
const AlertDialogCancel = React.forwardRef((props, forwardedRef) => {
|
|
145
|
+
const _a = props, { __scopeAlertDialog } = _a, cancelProps = __objRest(_a, ["__scopeAlertDialog"]);
|
|
146
|
+
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
|
|
147
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
148
|
+
const ref = useComposedRefs(forwardedRef, cancelRef);
|
|
149
|
+
return /* @__PURE__ */ React.createElement(DialogClose, __spreadProps(__spreadValues(__spreadValues({}, dialogScope), cancelProps), {
|
|
150
|
+
ref
|
|
151
|
+
}));
|
|
152
|
+
});
|
|
153
|
+
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
154
|
+
const DescriptionWarning = ({ contentRef }) => {
|
|
155
|
+
const MESSAGE = `\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
156
|
+
|
|
157
|
+
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.
|
|
158
|
+
|
|
159
|
+
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.
|
|
160
|
+
|
|
161
|
+
For more information, see https://tamagui.dev/docs/components/alert-dialog`;
|
|
162
|
+
React.useEffect(() => {
|
|
163
|
+
var _a;
|
|
164
|
+
if (!isWeb)
|
|
165
|
+
return;
|
|
166
|
+
const hasDescription = document.getElementById((_a = contentRef.current) == null ? void 0 : _a.getAttribute("aria-describedby"));
|
|
167
|
+
if (!hasDescription)
|
|
168
|
+
console.warn(MESSAGE);
|
|
169
|
+
}, [MESSAGE, contentRef]);
|
|
170
|
+
return null;
|
|
171
|
+
};
|
|
172
|
+
const AlertDialogInner = (props) => {
|
|
173
|
+
const _a = props, { __scopeAlertDialog } = _a, alertDialogProps = __objRest(_a, ["__scopeAlertDialog"]);
|
|
174
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
175
|
+
return /* @__PURE__ */ React.createElement(Dialog, __spreadProps(__spreadValues(__spreadValues({}, dialogScope), alertDialogProps), {
|
|
176
|
+
modal: true
|
|
177
|
+
}));
|
|
178
|
+
};
|
|
179
|
+
const AlertDialog = withStaticProperties(AlertDialogInner, {
|
|
180
|
+
Trigger: AlertDialogTrigger,
|
|
181
|
+
Portal: AlertDialogPortal,
|
|
182
|
+
Overlay: AlertDialogOverlay,
|
|
183
|
+
Content: AlertDialogContent,
|
|
184
|
+
Action: AlertDialogAction,
|
|
185
|
+
Cancel: AlertDialogCancel,
|
|
186
|
+
Title: AlertDialogTitle,
|
|
187
|
+
Description: AlertDialogDescription
|
|
188
|
+
});
|
|
189
|
+
AlertDialog.displayName = ROOT_NAME;
|
|
190
|
+
export {
|
|
191
|
+
AlertDialog,
|
|
192
|
+
AlertDialogAction,
|
|
193
|
+
AlertDialogCancel,
|
|
194
|
+
AlertDialogContent,
|
|
195
|
+
AlertDialogDescription,
|
|
196
|
+
AlertDialogOverlay,
|
|
197
|
+
AlertDialogPortal,
|
|
198
|
+
AlertDialogTitle,
|
|
199
|
+
AlertDialogTrigger,
|
|
200
|
+
createAlertDialogScope
|
|
201
|
+
};
|
|
202
|
+
//# sourceMappingURL=AlertDialog.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/AlertDialog.tsx"],
|
|
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 isWeb,\n withStaticProperties,\n} from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport {\n Dialog,\n DialogClose,\n DialogCloseProps,\n DialogContent,\n DialogContentProps,\n DialogDescription,\n DialogDescriptionProps,\n DialogOverlay,\n DialogOverlayProps,\n DialogPortal,\n DialogPortalProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n DialogTrigger,\n DialogTriggerProps,\n DialogWarningProvider,\n createDialogScope,\n} from '@tamagui/dialog'\nimport * as React from 'react'\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\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger'\n\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<TamaguiElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...triggerProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogTrigger {...dialogScope} {...triggerProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal'\n\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogPortal {...dialogScope} {...portalProps} />\n}\n\nAlertDialogPortal.displayName = PORTAL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay'\n\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<TamaguiElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogOverlay {...dialogScope} {...overlayProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogOverlay.displayName = OVERLAY_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent'\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<TamaguiElement | null>\n}\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME)\n\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<TamaguiElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n const contentRef = React.useRef<TamaguiElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const cancelRef = React.useRef<TamaguiElement | null>(null)\n\n return (\n <DialogWarningProvider\n contentName={CONTENT_NAME}\n titleName={TITLE_NAME}\n docsSlug=\"alert-dialog\"\n >\n <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>\n <DialogContent\n // @ts-ignore\n role=\"alertdialog\"\n {...dialogScope}\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault()\n if (isWeb) {\n // @ts-ignore\n cancelRef.current?.focus({ preventScroll: true })\n }\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogContent>\n </AlertDialogContentProvider>\n </DialogWarningProvider>\n )\n }\n)\n\nAlertDialogContent.displayName = CONTENT_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle'\n\ntype AlertDialogTitleProps = DialogTitleProps\n\nconst AlertDialogTitle = React.forwardRef<TamaguiElement, AlertDialogTitleProps>(\n (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...titleProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogTitle {...dialogScope} {...titleProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogTitle.displayName = TITLE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription'\n\ntype AlertDialogDescriptionProps = DialogDescriptionProps\n\nconst AlertDialogDescription = React.forwardRef<TamaguiElement, AlertDialogDescriptionProps>(\n (props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...descriptionProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogDescription {...dialogScope} {...descriptionProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction'\n\ntype AlertDialogActionProps = DialogCloseProps\n\nconst AlertDialogAction = React.forwardRef<TamaguiElement, AlertDialogActionProps>(\n (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...actionProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <DialogClose {...dialogScope} {...actionProps} ref={forwardedRef} />\n }\n)\n\nAlertDialogAction.displayName = ACTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel'\n\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<TamaguiElement, AlertDialogCancelProps>(\n (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...cancelProps } = props\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog)\n const dialogScope = useDialogScope(__scopeAlertDialog)\n const ref = useComposedRefs(forwardedRef, cancelRef)\n return <DialogClose {...dialogScope} {...cancelProps} ref={ref} />\n }\n)\n\nAlertDialogCancel.displayName = CANCEL_NAME\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<TamaguiElement>\n}\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n const MESSAGE = `\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n\nYou 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\nAlternatively, 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\nFor more information, see https://tamagui.dev/docs/components/alert-dialog`\n\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) console.warn(MESSAGE)\n }, [MESSAGE, contentRef])\n\n return null\n}\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst AlertDialogInner: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props\n const dialogScope = useDialogScope(__scopeAlertDialog)\n return <Dialog {...dialogScope} {...alertDialogProps} modal={true} />\n}\n\nconst AlertDialog = withStaticProperties(AlertDialogInner, {\n Trigger: AlertDialogTrigger,\n Portal: AlertDialogPortal,\n Overlay: AlertDialogOverlay,\n Content: AlertDialogContent,\n Action: AlertDialogAction,\n Cancel: AlertDialogCancel,\n Title: AlertDialogTitle,\n Description: AlertDialogDescription,\n})\n\nAlertDialog.displayName = ROOT_NAME\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n}\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA;AAEA,MAAM,YAAY;AAGlB,MAAM,CAAC,0BAA0B,0BAA0B,mBAAmB,WAAW;AAAA,EACvF;AACF,CAAC;AAED,MAAM,iBAAiB,kBAAkB;AAOzC,MAAM,eAAe;AAIrB,MAAM,qBAAqB,MAAM,WAC/B,CAAC,O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