@tamagui/alert-dialog 1.114.3 → 1.115.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.
@@ -0,0 +1,256 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ 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", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var AlertDialog_exports = {};
33
+ __export(AlertDialog_exports, {
34
+ AlertDialog: () => AlertDialog,
35
+ AlertDialogAction: () => AlertDialogAction,
36
+ AlertDialogCancel: () => AlertDialogCancel,
37
+ AlertDialogContent: () => AlertDialogContent,
38
+ AlertDialogDescription: () => AlertDialogDescription,
39
+ AlertDialogOverlay: () => AlertDialogOverlay,
40
+ AlertDialogPortal: () => AlertDialogPortal,
41
+ AlertDialogTitle: () => AlertDialogTitle,
42
+ AlertDialogTrigger: () => AlertDialogTrigger,
43
+ createAlertDialogScope: () => createAlertDialogScope
44
+ });
45
+ module.exports = __toCommonJS(AlertDialog_exports);
46
+ var import_compose_refs = require("@tamagui/compose-refs"),
47
+ import_constants = require("@tamagui/constants"),
48
+ import_core = require("@tamagui/core"),
49
+ import_create_context = require("@tamagui/create-context"),
50
+ import_dialog = require("@tamagui/dialog"),
51
+ import_helpers = require("@tamagui/helpers"),
52
+ import_use_controllable_state = require("@tamagui/use-controllable-state"),
53
+ React = __toESM(require("react")),
54
+ import_react_native = require("react-native-web"),
55
+ import_jsx_runtime = require("react/jsx-runtime");
56
+ const ROOT_NAME = "AlertDialog",
57
+ [createAlertDialogContext, createAlertDialogScope] = (0, import_create_context.createContextScope)(ROOT_NAME, [import_dialog.createDialogScope]),
58
+ useDialogScope = (0, import_dialog.createDialogScope)(),
59
+ TRIGGER_NAME = "AlertDialogTrigger",
60
+ NativeAlertDialogTriggerFrame = (0, import_core.styled)(import_core.View, {
61
+ name: TRIGGER_NAME
62
+ }),
63
+ AlertDialogTrigger = React.forwardRef((props, forwardedRef) => {
64
+ if (props.__native) {
65
+ const {
66
+ __native,
67
+ onPress,
68
+ __onPress,
69
+ ...rest
70
+ } = props;
71
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(NativeAlertDialogTriggerFrame, {
72
+ ...rest,
73
+ onPress: (0, import_helpers.composeEventHandlers)(onPress, __onPress)
74
+ });
75
+ }
76
+ const {
77
+ __scopeAlertDialog,
78
+ ...triggerProps
79
+ } = props,
80
+ dialogScope = useDialogScope(__scopeAlertDialog);
81
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogTrigger, {
82
+ ...dialogScope,
83
+ ...triggerProps,
84
+ ref: forwardedRef
85
+ });
86
+ });
87
+ AlertDialogTrigger.displayName = TRIGGER_NAME;
88
+ const PORTAL_NAME = "AlertDialogPortal",
89
+ AlertDialogPortal = props => {
90
+ const {
91
+ __scopeAlertDialog,
92
+ ...portalProps
93
+ } = props,
94
+ dialogScope = useDialogScope(__scopeAlertDialog);
95
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogPortal, {
96
+ ...dialogScope,
97
+ ...portalProps
98
+ });
99
+ };
100
+ AlertDialogPortal.displayName = PORTAL_NAME;
101
+ const OVERLAY_NAME = "AlertDialogOverlay",
102
+ AlertDialogOverlayFrame = (0, import_core.styled)(import_dialog.DialogOverlayFrame, {
103
+ name: OVERLAY_NAME
104
+ }),
105
+ AlertDialogOverlay = AlertDialogOverlayFrame.extractable(React.forwardRef((props, forwardedRef) => {
106
+ const {
107
+ __scopeAlertDialog,
108
+ ...overlayProps
109
+ } = props,
110
+ dialogScope = useDialogScope(__scopeAlertDialog);
111
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogOverlay, {
112
+ ...dialogScope,
113
+ ...overlayProps,
114
+ ref: forwardedRef
115
+ });
116
+ }));
117
+ AlertDialogOverlay.displayName = OVERLAY_NAME;
118
+ const CONTENT_NAME = "AlertDialogContent",
119
+ [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME),
120
+ AlertDialogContent = React.forwardRef((props, forwardedRef) => {
121
+ const {
122
+ __scopeAlertDialog,
123
+ children,
124
+ ...contentProps
125
+ } = props,
126
+ dialogScope = useDialogScope(__scopeAlertDialog),
127
+ contentRef = React.useRef(null),
128
+ composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef),
129
+ cancelRef = React.useRef(null);
130
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogWarningProvider, {
131
+ contentName: CONTENT_NAME,
132
+ titleName: TITLE_NAME,
133
+ docsSlug: "alert-dialog",
134
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AlertDialogContentProvider, {
135
+ scope: __scopeAlertDialog,
136
+ cancelRef,
137
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_dialog.DialogContent, {
138
+ role: "alertdialog",
139
+ ...dialogScope,
140
+ ...contentProps,
141
+ ref: composedRefs,
142
+ onOpenAutoFocus: (0, import_helpers.composeEventHandlers)(contentProps.onOpenAutoFocus, event => {
143
+ event.preventDefault(), import_constants.isWeb && cancelRef.current?.focus({
144
+ preventScroll: !0
145
+ });
146
+ }),
147
+ onPointerDownOutside: event => event.preventDefault(),
148
+ onInteractOutside: event => event.preventDefault(),
149
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.Slottable, {
150
+ children
151
+ }), process.env.NODE_ENV === "development" && /* @__PURE__ */(0, import_jsx_runtime.jsx)(DescriptionWarning, {
152
+ contentRef
153
+ })]
154
+ })
155
+ })
156
+ });
157
+ });
158
+ AlertDialogContent.displayName = CONTENT_NAME;
159
+ const TITLE_NAME = "AlertDialogTitle",
160
+ AlertDialogTitle = React.forwardRef((props, forwardedRef) => {
161
+ const {
162
+ __scopeAlertDialog,
163
+ ...titleProps
164
+ } = props,
165
+ dialogScope = useDialogScope(__scopeAlertDialog);
166
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogTitle, {
167
+ ...dialogScope,
168
+ ...titleProps,
169
+ ref: forwardedRef
170
+ });
171
+ });
172
+ AlertDialogTitle.displayName = TITLE_NAME;
173
+ const DESCRIPTION_NAME = "AlertDialogDescription",
174
+ AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
175
+ const {
176
+ __scopeAlertDialog,
177
+ ...descriptionProps
178
+ } = props,
179
+ dialogScope = useDialogScope(__scopeAlertDialog);
180
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogDescription, {
181
+ ...dialogScope,
182
+ ...descriptionProps,
183
+ ref: forwardedRef
184
+ });
185
+ });
186
+ AlertDialogDescription.displayName = DESCRIPTION_NAME;
187
+ const ACTION_NAME = "AlertDialogAction",
188
+ AlertDialogAction = React.forwardRef((props, forwardedRef) => {
189
+ const {
190
+ __scopeAlertDialog,
191
+ ...actionProps
192
+ } = props,
193
+ dialogScope = useDialogScope(__scopeAlertDialog);
194
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogClose, {
195
+ ...dialogScope,
196
+ ...actionProps,
197
+ ref: forwardedRef
198
+ });
199
+ });
200
+ AlertDialogAction.displayName = ACTION_NAME;
201
+ const CANCEL_NAME = "AlertDialogCancel",
202
+ AlertDialogCancel = React.forwardRef((props, forwardedRef) => {
203
+ const {
204
+ __scopeAlertDialog,
205
+ ...cancelProps
206
+ } = props,
207
+ {
208
+ cancelRef
209
+ } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog),
210
+ dialogScope = useDialogScope(__scopeAlertDialog),
211
+ ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
212
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogClose, {
213
+ ...dialogScope,
214
+ ...cancelProps,
215
+ ref
216
+ });
217
+ });
218
+ AlertDialogCancel.displayName = CANCEL_NAME;
219
+ const DescriptionWarning = ({
220
+ contentRef
221
+ }) => (process.env.NODE_ENV === "development" && React.useEffect(() => {
222
+ if (!import_constants.isWeb) return;
223
+ document.getElementById(
224
+ // @ts-ignore
225
+ contentRef.current?.getAttribute("aria-describedby")) || console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
226
+
227
+ 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.
228
+
229
+ 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.
230
+
231
+ For more information, see https://tamagui.dev/docs/components/alert-dialog`);
232
+ }, [contentRef]), null),
233
+ AlertDialogInner = props => {
234
+ const {
235
+ __scopeAlertDialog,
236
+ native,
237
+ ...alertDialogProps
238
+ } = props,
239
+ dialogScope = useDialogScope(__scopeAlertDialog);
240
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.Dialog, {
241
+ ...dialogScope,
242
+ ...alertDialogProps,
243
+ modal: !0
244
+ });
245
+ };
246
+ const AlertDialog = (0, import_helpers.withStaticProperties)(AlertDialogInner, {
247
+ Trigger: AlertDialogTrigger,
248
+ Portal: AlertDialogPortal,
249
+ Overlay: AlertDialogOverlay,
250
+ Content: AlertDialogContent,
251
+ Action: AlertDialogAction,
252
+ Cancel: AlertDialogCancel,
253
+ Title: AlertDialogTitle,
254
+ Description: AlertDialogDescription
255
+ });
256
+ AlertDialog.displayName = ROOT_NAME;
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./AlertDialog.cjs"), module.exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/alert-dialog",
3
- "version": "1.114.3",
3
+ "version": "1.115.0",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
@@ -30,30 +30,31 @@
30
30
  "react-native": "./dist/cjs/index.native.js",
31
31
  "types": "./types/index.d.ts",
32
32
  "import": "./dist/esm/index.mjs",
33
- "require": "./dist/cjs/index.js"
33
+ "require": "./dist/cjs/index.cjs",
34
+ "default": "./dist/cjs/index.native.js"
34
35
  }
35
36
  },
36
37
  "dependencies": {
37
- "@tamagui/animate-presence": "1.114.3",
38
- "@tamagui/aria-hidden": "1.114.3",
39
- "@tamagui/compose-refs": "1.114.3",
40
- "@tamagui/constants": "1.114.3",
41
- "@tamagui/core": "1.114.3",
42
- "@tamagui/create-context": "1.114.3",
43
- "@tamagui/dialog": "1.114.3",
44
- "@tamagui/dismissable": "1.114.3",
45
- "@tamagui/focus-scope": "1.114.3",
46
- "@tamagui/helpers": "1.114.3",
47
- "@tamagui/polyfill-dev": "1.114.3",
48
- "@tamagui/popper": "1.114.3",
49
- "@tamagui/portal": "1.114.3",
50
- "@tamagui/remove-scroll": "1.114.3",
51
- "@tamagui/stacks": "1.114.3",
52
- "@tamagui/text": "1.114.3",
53
- "@tamagui/use-controllable-state": "1.114.3"
38
+ "@tamagui/animate-presence": "1.115.0",
39
+ "@tamagui/aria-hidden": "1.115.0",
40
+ "@tamagui/compose-refs": "1.115.0",
41
+ "@tamagui/constants": "1.115.0",
42
+ "@tamagui/core": "1.115.0",
43
+ "@tamagui/create-context": "1.115.0",
44
+ "@tamagui/dialog": "1.115.0",
45
+ "@tamagui/dismissable": "1.115.0",
46
+ "@tamagui/focus-scope": "1.115.0",
47
+ "@tamagui/helpers": "1.115.0",
48
+ "@tamagui/polyfill-dev": "1.115.0",
49
+ "@tamagui/popper": "1.115.0",
50
+ "@tamagui/portal": "1.115.0",
51
+ "@tamagui/remove-scroll": "1.115.0",
52
+ "@tamagui/stacks": "1.115.0",
53
+ "@tamagui/text": "1.115.0",
54
+ "@tamagui/use-controllable-state": "1.115.0"
54
55
  },
55
56
  "devDependencies": {
56
- "@tamagui/build": "1.114.3",
57
+ "@tamagui/build": "1.115.0",
57
58
  "react": "^18.2.0 || ^19.0.0",
58
59
  "react-native": "0.74.1"
59
60
  },
@@ -1,163 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
- var AlertDialog_exports = {};
24
- __export(AlertDialog_exports, {
25
- AlertDialog: () => AlertDialog,
26
- AlertDialogAction: () => AlertDialogAction,
27
- AlertDialogCancel: () => AlertDialogCancel,
28
- AlertDialogContent: () => AlertDialogContent,
29
- AlertDialogDescription: () => AlertDialogDescription,
30
- AlertDialogOverlay: () => AlertDialogOverlay,
31
- AlertDialogPortal: () => AlertDialogPortal,
32
- AlertDialogTitle: () => AlertDialogTitle,
33
- AlertDialogTrigger: () => AlertDialogTrigger,
34
- createAlertDialogScope: () => createAlertDialogScope
35
- });
36
- module.exports = __toCommonJS(AlertDialog_exports);
37
- var import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_dialog = require("@tamagui/dialog"), import_helpers = require("@tamagui/helpers"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_react_native = require("react-native-web"), import_jsx_runtime = require("react/jsx-runtime");
38
- const ROOT_NAME = "AlertDialog", [createAlertDialogContext, createAlertDialogScope] = (0, import_create_context.createContextScope)(ROOT_NAME, [
39
- import_dialog.createDialogScope
40
- ]), useDialogScope = (0, import_dialog.createDialogScope)(), TRIGGER_NAME = "AlertDialogTrigger", NativeAlertDialogTriggerFrame = (0, import_core.styled)(import_core.View, {
41
- name: TRIGGER_NAME
42
- }), AlertDialogTrigger = React.forwardRef(
43
- (props, forwardedRef) => {
44
- if (props.__native) {
45
- const { __native, onPress, __onPress, ...rest } = props;
46
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
47
- NativeAlertDialogTriggerFrame,
48
- {
49
- ...rest,
50
- onPress: (0, import_helpers.composeEventHandlers)(onPress, __onPress)
51
- }
52
- );
53
- }
54
- const { __scopeAlertDialog, ...triggerProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
55
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTrigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });
56
- }
57
- );
58
- AlertDialogTrigger.displayName = TRIGGER_NAME;
59
- const PORTAL_NAME = "AlertDialogPortal", AlertDialogPortal = (props) => {
60
- const { __scopeAlertDialog, ...portalProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
61
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogPortal, { ...dialogScope, ...portalProps });
62
- };
63
- AlertDialogPortal.displayName = PORTAL_NAME;
64
- const OVERLAY_NAME = "AlertDialogOverlay", AlertDialogOverlayFrame = (0, import_core.styled)(import_dialog.DialogOverlayFrame, {
65
- name: OVERLAY_NAME
66
- }), AlertDialogOverlay = AlertDialogOverlayFrame.extractable(
67
- React.forwardRef(
68
- (props, forwardedRef) => {
69
- const { __scopeAlertDialog, ...overlayProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
70
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogOverlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
71
- }
72
- )
73
- );
74
- AlertDialogOverlay.displayName = OVERLAY_NAME;
75
- const CONTENT_NAME = "AlertDialogContent", [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME), AlertDialogContent = React.forwardRef(
76
- (props, forwardedRef) => {
77
- const { __scopeAlertDialog, children, ...contentProps } = props, dialogScope = useDialogScope(__scopeAlertDialog), contentRef = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef), cancelRef = React.useRef(null);
78
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
- import_dialog.DialogWarningProvider,
80
- {
81
- contentName: CONTENT_NAME,
82
- titleName: TITLE_NAME,
83
- docsSlug: "alert-dialog",
84
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
85
- import_dialog.DialogContent,
86
- {
87
- role: "alertdialog",
88
- ...dialogScope,
89
- ...contentProps,
90
- ref: composedRefs,
91
- onOpenAutoFocus: (0, import_helpers.composeEventHandlers)(
92
- contentProps.onOpenAutoFocus,
93
- (event) => {
94
- event.preventDefault(), import_constants.isWeb && cancelRef.current?.focus({ preventScroll: !0 });
95
- }
96
- ),
97
- onPointerDownOutside: (event) => event.preventDefault(),
98
- onInteractOutside: (event) => event.preventDefault(),
99
- children: [
100
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Slottable, { children }),
101
- process.env.NODE_ENV === "development" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionWarning, { contentRef })
102
- ]
103
- }
104
- ) })
105
- }
106
- );
107
- }
108
- );
109
- AlertDialogContent.displayName = CONTENT_NAME;
110
- const TITLE_NAME = "AlertDialogTitle", AlertDialogTitle = React.forwardRef(
111
- (props, forwardedRef) => {
112
- const { __scopeAlertDialog, ...titleProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
113
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTitle, { ...dialogScope, ...titleProps, ref: forwardedRef });
114
- }
115
- );
116
- AlertDialogTitle.displayName = TITLE_NAME;
117
- const DESCRIPTION_NAME = "AlertDialogDescription", AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
118
- const { __scopeAlertDialog, ...descriptionProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
119
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogDescription, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
120
- });
121
- AlertDialogDescription.displayName = DESCRIPTION_NAME;
122
- const ACTION_NAME = "AlertDialogAction", AlertDialogAction = React.forwardRef(
123
- (props, forwardedRef) => {
124
- const { __scopeAlertDialog, ...actionProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
125
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, { ...dialogScope, ...actionProps, ref: forwardedRef });
126
- }
127
- );
128
- AlertDialogAction.displayName = ACTION_NAME;
129
- const CANCEL_NAME = "AlertDialogCancel", AlertDialogCancel = React.forwardRef(
130
- (props, forwardedRef) => {
131
- const { __scopeAlertDialog, ...cancelProps } = props, { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog), dialogScope = useDialogScope(__scopeAlertDialog), ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
132
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, { ...dialogScope, ...cancelProps, ref });
133
- }
134
- );
135
- AlertDialogCancel.displayName = CANCEL_NAME;
136
- const DescriptionWarning = ({ contentRef }) => (process.env.NODE_ENV === "development" && React.useEffect(() => {
137
- if (!import_constants.isWeb) return;
138
- document.getElementById(
139
- // @ts-ignore
140
- contentRef.current?.getAttribute("aria-describedby")
141
- ) || console.warn(`\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
142
-
143
- 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.
144
-
145
- 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.
146
-
147
- For more information, see https://tamagui.dev/docs/components/alert-dialog`);
148
- }, [contentRef]), null), AlertDialogInner = (props) => {
149
- const { __scopeAlertDialog, native, ...alertDialogProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
150
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, { ...dialogScope, ...alertDialogProps, modal: !0 });
151
- };
152
- const AlertDialog = (0, import_helpers.withStaticProperties)(AlertDialogInner, {
153
- Trigger: AlertDialogTrigger,
154
- Portal: AlertDialogPortal,
155
- Overlay: AlertDialogOverlay,
156
- Content: AlertDialogContent,
157
- Action: AlertDialogAction,
158
- Cancel: AlertDialogCancel,
159
- Title: AlertDialogTitle,
160
- Description: AlertDialogDescription
161
- });
162
- AlertDialog.displayName = ROOT_NAME;
163
- //# sourceMappingURL=AlertDialog.js.map
package/dist/cjs/index.js DELETED
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function")
7
- for (let key of __getOwnPropNames(from))
8
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
- return to;
10
- }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
- var src_exports = {};
13
- module.exports = __toCommonJS(src_exports);
14
- __reExport(src_exports, require("./AlertDialog"), module.exports);
15
- //# sourceMappingURL=index.js.map
File without changes