@tamagui/alert-dialog 1.130.8 → 1.131.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/AlertDialog.cjs +66 -83
- package/dist/cjs/AlertDialog.js +74 -52
- package/dist/cjs/AlertDialog.js.map +1 -1
- package/dist/cjs/AlertDialog.native.js +33 -50
- package/dist/cjs/AlertDialog.native.js.map +2 -2
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/AlertDialog.js +80 -55
- package/dist/esm/AlertDialog.js.map +1 -1
- package/dist/esm/AlertDialog.mjs +68 -84
- package/dist/esm/AlertDialog.mjs.map +1 -1
- package/dist/esm/AlertDialog.native.js +62 -74
- package/dist/esm/AlertDialog.native.js.map +1 -1
- package/dist/jsx/AlertDialog.js +80 -55
- package/dist/jsx/AlertDialog.js.map +1 -1
- package/dist/jsx/AlertDialog.mjs +68 -84
- package/dist/jsx/AlertDialog.mjs.map +1 -1
- package/dist/jsx/AlertDialog.native.js +34 -51
- package/dist/jsx/AlertDialog.native.js.map +2 -2
- package/package.json +19 -19
- package/src/AlertDialog.tsx +96 -81
- package/types/AlertDialog.d.ts +118 -65
- package/types/AlertDialog.d.ts.map +1 -1
package/dist/cjs/AlertDialog.cjs
CHANGED
|
@@ -39,28 +39,26 @@ __export(AlertDialog_exports, {
|
|
|
39
39
|
AlertDialogOverlay: () => AlertDialogOverlay,
|
|
40
40
|
AlertDialogPortal: () => AlertDialogPortal,
|
|
41
41
|
AlertDialogTitle: () => AlertDialogTitle,
|
|
42
|
-
AlertDialogTrigger: () => AlertDialogTrigger
|
|
43
|
-
createAlertDialogScope: () => createAlertDialogScope
|
|
42
|
+
AlertDialogTrigger: () => AlertDialogTrigger
|
|
44
43
|
});
|
|
45
44
|
module.exports = __toCommonJS(AlertDialog_exports);
|
|
46
45
|
var import_compose_refs = require("@tamagui/compose-refs"),
|
|
47
46
|
import_constants = require("@tamagui/constants"),
|
|
48
47
|
import_core = require("@tamagui/core"),
|
|
49
|
-
import_create_context = require("@tamagui/create-context"),
|
|
50
48
|
import_dialog = require("@tamagui/dialog"),
|
|
51
49
|
import_helpers = require("@tamagui/helpers"),
|
|
52
50
|
import_use_controllable_state = require("@tamagui/use-controllable-state"),
|
|
53
51
|
React = __toESM(require("react")),
|
|
54
52
|
import_react_native = require("react-native-web"),
|
|
55
53
|
import_jsx_runtime = require("react/jsx-runtime");
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
const AlertScopePrefix = "Alert__",
|
|
55
|
+
getAlertDialogScope = scope => AlertScopePrefix + scope,
|
|
56
|
+
ROOT_NAME = "AlertDialog",
|
|
59
57
|
TRIGGER_NAME = "AlertDialogTrigger",
|
|
60
58
|
NativeAlertDialogTriggerFrame = (0, import_core.styled)(import_core.View, {
|
|
61
59
|
name: TRIGGER_NAME
|
|
62
60
|
}),
|
|
63
|
-
AlertDialogTrigger = React.forwardRef((props, forwardedRef)
|
|
61
|
+
AlertDialogTrigger = React.forwardRef(function (props, forwardedRef) {
|
|
64
62
|
if (props.__native) {
|
|
65
63
|
const {
|
|
66
64
|
__native,
|
|
@@ -74,56 +72,52 @@ const ROOT_NAME = "AlertDialog",
|
|
|
74
72
|
});
|
|
75
73
|
}
|
|
76
74
|
const {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
dialogScope = useDialogScope(__scopeAlertDialog);
|
|
75
|
+
scope,
|
|
76
|
+
...triggerProps
|
|
77
|
+
} = props;
|
|
81
78
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogTrigger, {
|
|
82
|
-
|
|
79
|
+
scope: getAlertDialogScope(scope),
|
|
83
80
|
...triggerProps,
|
|
84
81
|
ref: forwardedRef
|
|
85
82
|
});
|
|
86
83
|
});
|
|
87
|
-
|
|
88
|
-
const PORTAL_NAME = "AlertDialogPortal",
|
|
89
|
-
AlertDialogPortal = props => {
|
|
84
|
+
const AlertDialogPortal = function (props) {
|
|
90
85
|
const {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
dialogScope = useDialogScope(__scopeAlertDialog);
|
|
86
|
+
scope,
|
|
87
|
+
...portalProps
|
|
88
|
+
} = props;
|
|
95
89
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogPortal, {
|
|
96
|
-
|
|
90
|
+
scope: getAlertDialogScope(scope),
|
|
97
91
|
...portalProps
|
|
98
92
|
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const OVERLAY_NAME = "AlertDialogOverlay",
|
|
93
|
+
},
|
|
94
|
+
OVERLAY_NAME = "AlertDialogOverlay",
|
|
102
95
|
AlertDialogOverlayFrame = (0, import_core.styled)(import_dialog.DialogOverlayFrame, {
|
|
103
96
|
name: OVERLAY_NAME
|
|
104
97
|
}),
|
|
105
|
-
AlertDialogOverlay = AlertDialogOverlayFrame.extractable(React.forwardRef((props, forwardedRef)
|
|
98
|
+
AlertDialogOverlay = AlertDialogOverlayFrame.extractable(React.forwardRef(function (props, forwardedRef) {
|
|
106
99
|
const {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
dialogScope = useDialogScope(__scopeAlertDialog);
|
|
100
|
+
scope,
|
|
101
|
+
...overlayProps
|
|
102
|
+
} = props;
|
|
111
103
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogOverlay, {
|
|
112
|
-
|
|
104
|
+
scope: getAlertDialogScope(scope),
|
|
113
105
|
...overlayProps,
|
|
114
106
|
ref: forwardedRef
|
|
115
107
|
});
|
|
116
|
-
}))
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
108
|
+
})),
|
|
109
|
+
CONTENT_NAME = "AlertDialogContent",
|
|
110
|
+
{
|
|
111
|
+
Provider: AlertDialogContextProvider,
|
|
112
|
+
useStyledContext: useAlertDialogContentContext
|
|
113
|
+
} = (0, import_core.createStyledContext)({}, "AlertDialogContext"),
|
|
114
|
+
AlertDialogContent = React.forwardRef(function (props, forwardedRef) {
|
|
121
115
|
const {
|
|
122
|
-
|
|
116
|
+
scope,
|
|
123
117
|
children,
|
|
124
118
|
...contentProps
|
|
125
119
|
} = props,
|
|
126
|
-
dialogScope =
|
|
120
|
+
dialogScope = getAlertDialogScope(scope),
|
|
127
121
|
contentRef = React.useRef(null),
|
|
128
122
|
composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef),
|
|
129
123
|
cancelRef = React.useRef(null);
|
|
@@ -131,12 +125,12 @@ const CONTENT_NAME = "AlertDialogContent",
|
|
|
131
125
|
contentName: CONTENT_NAME,
|
|
132
126
|
titleName: TITLE_NAME,
|
|
133
127
|
docsSlug: "alert-dialog",
|
|
134
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(
|
|
135
|
-
scope
|
|
128
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AlertDialogContextProvider, {
|
|
129
|
+
scope,
|
|
136
130
|
cancelRef,
|
|
137
131
|
children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_dialog.DialogContent, {
|
|
138
132
|
role: "alertdialog",
|
|
139
|
-
|
|
133
|
+
scope: dialogScope,
|
|
140
134
|
...contentProps,
|
|
141
135
|
ref: composedRefs,
|
|
142
136
|
onOpenAutoFocus: (0, import_helpers.composeEventHandlers)(contentProps.onOpenAutoFocus, event => {
|
|
@@ -154,69 +148,58 @@ const CONTENT_NAME = "AlertDialogContent",
|
|
|
154
148
|
})
|
|
155
149
|
})
|
|
156
150
|
});
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
AlertDialogTitle = React.forwardRef((props, forwardedRef) => {
|
|
151
|
+
}),
|
|
152
|
+
TITLE_NAME = "AlertDialogTitle",
|
|
153
|
+
AlertDialogTitle = React.forwardRef(function (props, forwardedRef) {
|
|
161
154
|
const {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
dialogScope = useDialogScope(__scopeAlertDialog);
|
|
155
|
+
scope,
|
|
156
|
+
...titleProps
|
|
157
|
+
} = props;
|
|
166
158
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogTitle, {
|
|
167
|
-
|
|
159
|
+
scope: getAlertDialogScope(scope),
|
|
168
160
|
...titleProps,
|
|
169
161
|
ref: forwardedRef
|
|
170
162
|
});
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
|
|
163
|
+
}),
|
|
164
|
+
DESCRIPTION_NAME = "AlertDialogDescription",
|
|
165
|
+
AlertDialogDescription = React.forwardRef(function (props, forwardedRef) {
|
|
175
166
|
const {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
dialogScope = useDialogScope(__scopeAlertDialog);
|
|
167
|
+
scope,
|
|
168
|
+
...descriptionProps
|
|
169
|
+
} = props;
|
|
180
170
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogDescription, {
|
|
181
|
-
|
|
171
|
+
scope: getAlertDialogScope(scope),
|
|
182
172
|
...descriptionProps,
|
|
183
173
|
ref: forwardedRef
|
|
184
174
|
});
|
|
185
175
|
});
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
...dialogScope,
|
|
196
|
-
...actionProps,
|
|
197
|
-
ref: forwardedRef
|
|
198
|
-
});
|
|
176
|
+
const AlertDialogAction = React.forwardRef(function (props, forwardedRef) {
|
|
177
|
+
const {
|
|
178
|
+
scope,
|
|
179
|
+
...actionProps
|
|
180
|
+
} = props;
|
|
181
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogClose, {
|
|
182
|
+
scope: getAlertDialogScope(scope),
|
|
183
|
+
...actionProps,
|
|
184
|
+
ref: forwardedRef
|
|
199
185
|
});
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
AlertDialogCancel = React.forwardRef((props, forwardedRef) => {
|
|
186
|
+
});
|
|
187
|
+
const AlertDialogCancel = React.forwardRef(function (props, forwardedRef) {
|
|
203
188
|
const {
|
|
204
|
-
|
|
189
|
+
scope,
|
|
205
190
|
...cancelProps
|
|
206
191
|
} = props,
|
|
207
192
|
{
|
|
208
193
|
cancelRef
|
|
209
|
-
} = useAlertDialogContentContext(
|
|
210
|
-
dialogScope = useDialogScope(__scopeAlertDialog),
|
|
194
|
+
} = useAlertDialogContentContext(scope),
|
|
211
195
|
ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
|
|
212
196
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.DialogClose, {
|
|
213
|
-
|
|
197
|
+
scope: getAlertDialogScope(scope),
|
|
214
198
|
...cancelProps,
|
|
215
199
|
ref
|
|
216
200
|
});
|
|
217
|
-
})
|
|
218
|
-
|
|
219
|
-
const DescriptionWarning = ({
|
|
201
|
+
}),
|
|
202
|
+
DescriptionWarning = ({
|
|
220
203
|
contentRef
|
|
221
204
|
}) => (process.env.NODE_ENV === "development" && React.useEffect(() => {
|
|
222
205
|
if (!import_constants.isWeb) return;
|
|
@@ -232,13 +215,13 @@ const DescriptionWarning = ({
|
|
|
232
215
|
}, [contentRef]), null),
|
|
233
216
|
AlertDialogInner = props => {
|
|
234
217
|
const {
|
|
235
|
-
|
|
218
|
+
scope,
|
|
236
219
|
native,
|
|
237
220
|
...alertDialogProps
|
|
238
221
|
} = props,
|
|
239
|
-
dialogScope =
|
|
222
|
+
dialogScope = getAlertDialogScope(scope);
|
|
240
223
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dialog.Dialog, {
|
|
241
|
-
|
|
224
|
+
scope: dialogScope,
|
|
242
225
|
...alertDialogProps,
|
|
243
226
|
modal: !0
|
|
244
227
|
});
|
package/dist/cjs/AlertDialog.js
CHANGED
|
@@ -30,17 +30,14 @@ __export(AlertDialog_exports, {
|
|
|
30
30
|
AlertDialogOverlay: () => AlertDialogOverlay,
|
|
31
31
|
AlertDialogPortal: () => AlertDialogPortal,
|
|
32
32
|
AlertDialogTitle: () => AlertDialogTitle,
|
|
33
|
-
AlertDialogTrigger: () => AlertDialogTrigger
|
|
34
|
-
createAlertDialogScope: () => createAlertDialogScope
|
|
33
|
+
AlertDialogTrigger: () => AlertDialogTrigger
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(AlertDialog_exports);
|
|
37
|
-
var import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"),
|
|
38
|
-
const ROOT_NAME = "AlertDialog",
|
|
39
|
-
import_dialog.createDialogScope
|
|
40
|
-
]), useDialogScope = (0, import_dialog.createDialogScope)(), TRIGGER_NAME = "AlertDialogTrigger", NativeAlertDialogTriggerFrame = (0, import_core.styled)(import_core.View, {
|
|
36
|
+
var import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), 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");
|
|
37
|
+
const AlertScopePrefix = "Alert__", getAlertDialogScope = (scope) => AlertScopePrefix + scope, ROOT_NAME = "AlertDialog", TRIGGER_NAME = "AlertDialogTrigger", NativeAlertDialogTriggerFrame = (0, import_core.styled)(import_core.View, {
|
|
41
38
|
name: TRIGGER_NAME
|
|
42
39
|
}), AlertDialogTrigger = React.forwardRef(
|
|
43
|
-
(props, forwardedRef)
|
|
40
|
+
function(props, forwardedRef) {
|
|
44
41
|
if (props.__native) {
|
|
45
42
|
const { __native, onPress, __onPress, ...rest } = props;
|
|
46
43
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -51,41 +48,53 @@ const ROOT_NAME = "AlertDialog", [createAlertDialogContext, createAlertDialogSco
|
|
|
51
48
|
}
|
|
52
49
|
);
|
|
53
50
|
}
|
|
54
|
-
const {
|
|
55
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
const { scope, ...triggerProps } = props;
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
+
import_dialog.DialogTrigger,
|
|
54
|
+
{
|
|
55
|
+
scope: getAlertDialogScope(scope),
|
|
56
|
+
...triggerProps,
|
|
57
|
+
ref: forwardedRef
|
|
58
|
+
}
|
|
59
|
+
);
|
|
56
60
|
}
|
|
57
61
|
);
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
AlertDialogPortal.displayName = PORTAL_NAME;
|
|
64
|
-
const OVERLAY_NAME = "AlertDialogOverlay", AlertDialogOverlayFrame = (0, import_core.styled)(import_dialog.DialogOverlayFrame, {
|
|
62
|
+
const AlertDialogPortal = function(props) {
|
|
63
|
+
const { scope, ...portalProps } = props;
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogPortal, { scope: getAlertDialogScope(scope), ...portalProps });
|
|
65
|
+
}, OVERLAY_NAME = "AlertDialogOverlay", AlertDialogOverlayFrame = (0, import_core.styled)(import_dialog.DialogOverlayFrame, {
|
|
65
66
|
name: OVERLAY_NAME
|
|
66
67
|
}), AlertDialogOverlay = AlertDialogOverlayFrame.extractable(
|
|
67
68
|
React.forwardRef(
|
|
68
|
-
(props, forwardedRef)
|
|
69
|
-
const {
|
|
70
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
function(props, forwardedRef) {
|
|
70
|
+
const { scope, ...overlayProps } = props;
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
+
import_dialog.DialogOverlay,
|
|
73
|
+
{
|
|
74
|
+
scope: getAlertDialogScope(scope),
|
|
75
|
+
...overlayProps,
|
|
76
|
+
ref: forwardedRef
|
|
77
|
+
}
|
|
78
|
+
);
|
|
71
79
|
}
|
|
72
80
|
)
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
), CONTENT_NAME = "AlertDialogContent", {
|
|
82
|
+
Provider: AlertDialogContextProvider,
|
|
83
|
+
useStyledContext: useAlertDialogContentContext
|
|
84
|
+
} = (0, import_core.createStyledContext)({}, "AlertDialogContext"), AlertDialogContent = React.forwardRef(
|
|
85
|
+
function(props, forwardedRef) {
|
|
86
|
+
const { scope, children, ...contentProps } = props, dialogScope = getAlertDialogScope(scope), contentRef = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef), cancelRef = React.useRef(null);
|
|
78
87
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
88
|
import_dialog.DialogWarningProvider,
|
|
80
89
|
{
|
|
81
90
|
contentName: CONTENT_NAME,
|
|
82
91
|
titleName: TITLE_NAME,
|
|
83
92
|
docsSlug: "alert-dialog",
|
|
84
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
93
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContextProvider, { scope, cancelRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
85
94
|
import_dialog.DialogContent,
|
|
86
95
|
{
|
|
87
96
|
role: "alertdialog",
|
|
88
|
-
|
|
97
|
+
scope: dialogScope,
|
|
89
98
|
...contentProps,
|
|
90
99
|
ref: composedRefs,
|
|
91
100
|
onOpenAutoFocus: (0, import_helpers.composeEventHandlers)(
|
|
@@ -105,35 +114,48 @@ const CONTENT_NAME = "AlertDialogContent", [AlertDialogContentProvider, useAlert
|
|
|
105
114
|
}
|
|
106
115
|
);
|
|
107
116
|
}
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
), TITLE_NAME = "AlertDialogTitle", AlertDialogTitle = React.forwardRef(
|
|
118
|
+
function(props, forwardedRef) {
|
|
119
|
+
const { scope, ...titleProps } = props;
|
|
120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
121
|
+
import_dialog.DialogTitle,
|
|
122
|
+
{
|
|
123
|
+
scope: getAlertDialogScope(scope),
|
|
124
|
+
...titleProps,
|
|
125
|
+
ref: forwardedRef
|
|
126
|
+
}
|
|
127
|
+
);
|
|
114
128
|
}
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
129
|
+
), DESCRIPTION_NAME = "AlertDialogDescription", AlertDialogDescription = React.forwardRef(function(props, forwardedRef) {
|
|
130
|
+
const { scope, ...descriptionProps } = props;
|
|
131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
132
|
+
import_dialog.DialogDescription,
|
|
133
|
+
{
|
|
134
|
+
scope: getAlertDialogScope(scope),
|
|
135
|
+
...descriptionProps,
|
|
136
|
+
ref: forwardedRef
|
|
137
|
+
}
|
|
138
|
+
);
|
|
120
139
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
140
|
+
const AlertDialogAction = React.forwardRef(
|
|
141
|
+
function(props, forwardedRef) {
|
|
142
|
+
const { scope, ...actionProps } = props;
|
|
143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
|
+
import_dialog.DialogClose,
|
|
145
|
+
{
|
|
146
|
+
scope: getAlertDialogScope(scope),
|
|
147
|
+
...actionProps,
|
|
148
|
+
ref: forwardedRef
|
|
149
|
+
}
|
|
150
|
+
);
|
|
126
151
|
}
|
|
127
152
|
);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, { ...dialogScope, ...cancelProps, ref });
|
|
153
|
+
const AlertDialogCancel = React.forwardRef(
|
|
154
|
+
function(props, forwardedRef) {
|
|
155
|
+
const { scope, ...cancelProps } = props, { cancelRef } = useAlertDialogContentContext(scope), ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
|
|
156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, { scope: getAlertDialogScope(scope), ...cancelProps, ref });
|
|
133
157
|
}
|
|
134
|
-
)
|
|
135
|
-
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
136
|
-
const DescriptionWarning = ({ contentRef }) => (process.env.NODE_ENV === "development" && React.useEffect(() => {
|
|
158
|
+
), DescriptionWarning = ({ contentRef }) => (process.env.NODE_ENV === "development" && React.useEffect(() => {
|
|
137
159
|
if (!import_constants.isWeb) return;
|
|
138
160
|
document.getElementById(
|
|
139
161
|
// @ts-ignore
|
|
@@ -146,8 +168,8 @@ const DescriptionWarning = ({ contentRef }) => (process.env.NODE_ENV === "develo
|
|
|
146
168
|
|
|
147
169
|
For more information, see https://tamagui.dev/docs/components/alert-dialog`);
|
|
148
170
|
}, [contentRef]), null), AlertDialogInner = (props) => {
|
|
149
|
-
const {
|
|
150
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, {
|
|
171
|
+
const { scope, native, ...alertDialogProps } = props, dialogScope = getAlertDialogScope(scope);
|
|
172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, { scope: dialogScope, ...alertDialogProps, modal: !0 });
|
|
151
173
|
};
|
|
152
174
|
const AlertDialog = (0, import_helpers.withStaticProperties)(AlertDialogInner, {
|
|
153
175
|
Trigger: AlertDialogTrigger,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/AlertDialog.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;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,GAAG,iBAAiB,IAAI,OACzC,cAAc,oBAAoB,KAAK;AA8E7C,SAAO,4CAAC,wBAAO,OAAO,aAAc,GAAG,kBAAkB,OAAK,IAAC;AACjE;AA6BA,MAAM,kBAAc,qCAAqB,kBAAkB;AAAA,EACzD,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAED,YAAY,cAAc;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -31,13 +31,12 @@ __export(AlertDialog_exports, {
|
|
|
31
31
|
AlertDialogOverlay: () => AlertDialogOverlay,
|
|
32
32
|
AlertDialogPortal: () => AlertDialogPortal,
|
|
33
33
|
AlertDialogTitle: () => AlertDialogTitle,
|
|
34
|
-
AlertDialogTrigger: () => AlertDialogTrigger
|
|
35
|
-
createAlertDialogScope: () => createAlertDialogScope
|
|
34
|
+
AlertDialogTrigger: () => AlertDialogTrigger
|
|
36
35
|
});
|
|
37
36
|
module.exports = __toCommonJS(AlertDialog_exports);
|
|
38
|
-
var import_jsx_runtime = require("react/jsx-runtime"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"),
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), 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"), AlertScopePrefix = "Alert__", getAlertDialogScope = function(scope) {
|
|
38
|
+
return AlertScopePrefix + scope;
|
|
39
|
+
}, ROOT_NAME = "AlertDialog", TRIGGER_NAME = "AlertDialogTrigger", NativeAlertDialogTriggerFrame = (0, import_core.styled)(import_core.View, {
|
|
41
40
|
name: TRIGGER_NAME
|
|
42
41
|
}), AlertDialogTrigger = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
43
42
|
if (props.__native) {
|
|
@@ -47,46 +46,41 @@ var import_jsx_runtime = require("react/jsx-runtime"), import_compose_refs = req
|
|
|
47
46
|
onPress: (0, import_helpers.composeEventHandlers)(onPress, __onPress)
|
|
48
47
|
});
|
|
49
48
|
}
|
|
50
|
-
var {
|
|
49
|
+
var { scope, ...triggerProps } = props;
|
|
51
50
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTrigger, {
|
|
52
|
-
|
|
51
|
+
scope: getAlertDialogScope(scope),
|
|
53
52
|
...triggerProps,
|
|
54
53
|
ref: forwardedRef
|
|
55
54
|
});
|
|
56
55
|
});
|
|
57
|
-
|
|
58
|
-
var
|
|
59
|
-
var { __scopeAlertDialog, ...portalProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
56
|
+
var AlertDialogPortal = function(props) {
|
|
57
|
+
var { scope, ...portalProps } = props;
|
|
60
58
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogPortal, {
|
|
61
|
-
|
|
59
|
+
scope: getAlertDialogScope(scope),
|
|
62
60
|
...portalProps
|
|
63
61
|
});
|
|
64
|
-
}
|
|
65
|
-
AlertDialogPortal.displayName = PORTAL_NAME;
|
|
66
|
-
var OVERLAY_NAME = "AlertDialogOverlay", AlertDialogOverlayFrame = (0, import_core.styled)(import_dialog.DialogOverlayFrame, {
|
|
62
|
+
}, OVERLAY_NAME = "AlertDialogOverlay", AlertDialogOverlayFrame = (0, import_core.styled)(import_dialog.DialogOverlayFrame, {
|
|
67
63
|
name: OVERLAY_NAME
|
|
68
64
|
}), AlertDialogOverlay = AlertDialogOverlayFrame.extractable(/* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
69
|
-
var {
|
|
65
|
+
var { scope, ...overlayProps } = props;
|
|
70
66
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogOverlay, {
|
|
71
|
-
|
|
67
|
+
scope: getAlertDialogScope(scope),
|
|
72
68
|
...overlayProps,
|
|
73
69
|
ref: forwardedRef
|
|
74
70
|
});
|
|
75
|
-
}))
|
|
76
|
-
|
|
77
|
-
var CONTENT_NAME = "AlertDialogContent", [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME), AlertDialogContent = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
78
|
-
var { __scopeAlertDialog, children, ...contentProps } = props, dialogScope = useDialogScope(__scopeAlertDialog), contentRef = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef), cancelRef = React.useRef(null);
|
|
71
|
+
})), CONTENT_NAME = "AlertDialogContent", { Provider: AlertDialogContextProvider, useStyledContext: useAlertDialogContentContext } = (0, import_core.createStyledContext)({}, "AlertDialogContext"), AlertDialogContent = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
72
|
+
var { scope, children, ...contentProps } = props, dialogScope = getAlertDialogScope(scope), contentRef = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef), cancelRef = React.useRef(null);
|
|
79
73
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogWarningProvider, {
|
|
80
74
|
contentName: CONTENT_NAME,
|
|
81
75
|
titleName: TITLE_NAME,
|
|
82
76
|
docsSlug: "alert-dialog",
|
|
83
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
-
scope
|
|
77
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContextProvider, {
|
|
78
|
+
scope,
|
|
85
79
|
cancelRef,
|
|
86
80
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.DialogContent, {
|
|
87
81
|
// @ts-ignore
|
|
88
82
|
role: "alertdialog",
|
|
89
|
-
|
|
83
|
+
scope: dialogScope,
|
|
90
84
|
...contentProps,
|
|
91
85
|
ref: composedRefs,
|
|
92
86
|
onOpenAutoFocus: (0, import_helpers.composeEventHandlers)(contentProps.onOpenAutoFocus, function(event) {
|
|
@@ -120,45 +114,35 @@ var CONTENT_NAME = "AlertDialogContent", [AlertDialogContentProvider, useAlertDi
|
|
|
120
114
|
})
|
|
121
115
|
})
|
|
122
116
|
});
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
var TITLE_NAME = "AlertDialogTitle", AlertDialogTitle = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
126
|
-
var { __scopeAlertDialog, ...titleProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
117
|
+
}), TITLE_NAME = "AlertDialogTitle", AlertDialogTitle = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
118
|
+
var { scope, ...titleProps } = props;
|
|
127
119
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTitle, {
|
|
128
|
-
|
|
120
|
+
scope: getAlertDialogScope(scope),
|
|
129
121
|
...titleProps,
|
|
130
122
|
ref: forwardedRef
|
|
131
123
|
});
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
var DESCRIPTION_NAME = "AlertDialogDescription", AlertDialogDescription = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
135
|
-
var { __scopeAlertDialog, ...descriptionProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
124
|
+
}), DESCRIPTION_NAME = "AlertDialogDescription", AlertDialogDescription = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
125
|
+
var { scope, ...descriptionProps } = props;
|
|
136
126
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogDescription, {
|
|
137
|
-
|
|
127
|
+
scope: getAlertDialogScope(scope),
|
|
138
128
|
...descriptionProps,
|
|
139
129
|
ref: forwardedRef
|
|
140
130
|
});
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
var ACTION_NAME = "AlertDialogAction", AlertDialogAction = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
144
|
-
var { __scopeAlertDialog, ...actionProps } = props, dialogScope = useDialogScope(__scopeAlertDialog);
|
|
131
|
+
}), ACTION_NAME = "AlertDialogAction", AlertDialogAction = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
132
|
+
var { scope, ...actionProps } = props;
|
|
145
133
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, {
|
|
146
|
-
|
|
134
|
+
scope: getAlertDialogScope(scope),
|
|
147
135
|
...actionProps,
|
|
148
136
|
ref: forwardedRef
|
|
149
137
|
});
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
var CANCEL_NAME = "AlertDialogCancel", AlertDialogCancel = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
153
|
-
var { __scopeAlertDialog, ...cancelProps } = props, { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog), dialogScope = useDialogScope(__scopeAlertDialog), ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
|
|
138
|
+
}), CANCEL_NAME = "AlertDialogCancel", AlertDialogCancel = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
139
|
+
var { scope, ...cancelProps } = props, { cancelRef } = useAlertDialogContentContext(scope), ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
|
|
154
140
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogClose, {
|
|
155
|
-
|
|
141
|
+
scope: getAlertDialogScope(scope),
|
|
156
142
|
...cancelProps,
|
|
157
143
|
ref
|
|
158
144
|
});
|
|
159
|
-
})
|
|
160
|
-
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
161
|
-
var DescriptionWarning = function(param) {
|
|
145
|
+
}), DescriptionWarning = function(param) {
|
|
162
146
|
var { contentRef } = param;
|
|
163
147
|
return process.env.NODE_ENV === "development" && React.useEffect(function() {
|
|
164
148
|
var _contentRef_current;
|
|
@@ -176,7 +160,7 @@ var DescriptionWarning = function(param) {
|
|
|
176
160
|
contentRef
|
|
177
161
|
]), null;
|
|
178
162
|
}, AlertDialogInner = function(props) {
|
|
179
|
-
var {
|
|
163
|
+
var { scope, native, ...alertDialogProps } = props, dialogScope = getAlertDialogScope(scope), [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
|
|
180
164
|
prop: props.open,
|
|
181
165
|
defaultProp: props.defaultOpen || !1,
|
|
182
166
|
onChange: props.onOpenChange,
|
|
@@ -222,7 +206,7 @@ var DescriptionWarning = function(param) {
|
|
|
222
206
|
setOpen(!0);
|
|
223
207
|
}
|
|
224
208
|
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, {
|
|
225
|
-
|
|
209
|
+
scope: dialogScope,
|
|
226
210
|
...alertDialogProps,
|
|
227
211
|
modal: !0
|
|
228
212
|
});
|
|
@@ -275,7 +259,6 @@ AlertDialog.displayName = ROOT_NAME;
|
|
|
275
259
|
AlertDialogOverlay,
|
|
276
260
|
AlertDialogPortal,
|
|
277
261
|
AlertDialogTitle,
|
|
278
|
-
AlertDialogTrigger
|
|
279
|
-
createAlertDialogScope
|
|
262
|
+
AlertDialogTrigger
|
|
280
263
|
});
|
|
281
264
|
//# sourceMappingURL=AlertDialog.js.map
|