@tamagui/alert-dialog 1.116.1 → 1.116.3

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,163 @@
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
@@ -0,0 +1,15 @@
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/alert-dialog",
3
- "version": "1.116.1",
3
+ "version": "1.116.3",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
@@ -35,26 +35,26 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@tamagui/animate-presence": "1.116.1",
39
- "@tamagui/aria-hidden": "1.116.1",
40
- "@tamagui/compose-refs": "1.116.1",
41
- "@tamagui/constants": "1.116.1",
42
- "@tamagui/core": "1.116.1",
43
- "@tamagui/create-context": "1.116.1",
44
- "@tamagui/dialog": "1.116.1",
45
- "@tamagui/dismissable": "1.116.1",
46
- "@tamagui/focus-scope": "1.116.1",
47
- "@tamagui/helpers": "1.116.1",
48
- "@tamagui/polyfill-dev": "1.116.1",
49
- "@tamagui/popper": "1.116.1",
50
- "@tamagui/portal": "1.116.1",
51
- "@tamagui/remove-scroll": "1.116.1",
52
- "@tamagui/stacks": "1.116.1",
53
- "@tamagui/text": "1.116.1",
54
- "@tamagui/use-controllable-state": "1.116.1"
38
+ "@tamagui/animate-presence": "1.116.3",
39
+ "@tamagui/aria-hidden": "1.116.3",
40
+ "@tamagui/compose-refs": "1.116.3",
41
+ "@tamagui/constants": "1.116.3",
42
+ "@tamagui/core": "1.116.3",
43
+ "@tamagui/create-context": "1.116.3",
44
+ "@tamagui/dialog": "1.116.3",
45
+ "@tamagui/dismissable": "1.116.3",
46
+ "@tamagui/focus-scope": "1.116.3",
47
+ "@tamagui/helpers": "1.116.3",
48
+ "@tamagui/polyfill-dev": "1.116.3",
49
+ "@tamagui/popper": "1.116.3",
50
+ "@tamagui/portal": "1.116.3",
51
+ "@tamagui/remove-scroll": "1.116.3",
52
+ "@tamagui/stacks": "1.116.3",
53
+ "@tamagui/text": "1.116.3",
54
+ "@tamagui/use-controllable-state": "1.116.3"
55
55
  },
56
56
  "devDependencies": {
57
- "@tamagui/build": "1.116.1",
57
+ "@tamagui/build": "1.116.3",
58
58
  "react": "^18.2.0 || ^19.0.0",
59
59
  "react-native": "0.74.1"
60
60
  },
File without changes