@tamagui/toast 1.0.1-beta.139
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/Dialog.js +492 -0
- package/dist/cjs/Dialog.js.map +7 -0
- package/dist/cjs/Toast.js +468 -0
- package/dist/cjs/Toast.js.map +7 -0
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/esm/Dialog.js +465 -0
- package/dist/esm/Dialog.js.map +7 -0
- package/dist/esm/Toast.js +433 -0
- package/dist/esm/Toast.js.map +7 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/jsx/Dialog.js +348 -0
- package/dist/jsx/Dialog.js.map +7 -0
- package/dist/jsx/Toast.js +388 -0
- package/dist/jsx/Toast.js.map +7 -0
- package/dist/jsx/index.js +2 -0
- package/dist/jsx/index.js.map +7 -0
- package/package.json +54 -0
- package/src/Toast.tsx +964 -0
- package/src/index.ts +1 -0
- package/types/Toast.d.ts +75 -0
- package/types/index.d.ts +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 WorkOS and Tamagui
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var Dialog_exports = {};
|
|
23
|
+
__export(Dialog_exports, {
|
|
24
|
+
Dialog: () => Dialog2,
|
|
25
|
+
DialogClose: () => DialogClose,
|
|
26
|
+
DialogContent: () => DialogContent,
|
|
27
|
+
DialogDescription: () => DialogDescription,
|
|
28
|
+
DialogOverlay: () => DialogOverlay,
|
|
29
|
+
DialogPortal: () => DialogPortal,
|
|
30
|
+
DialogPortalFrame: () => DialogPortalFrame,
|
|
31
|
+
DialogSheetContents: () => DialogSheetContents,
|
|
32
|
+
DialogTitle: () => DialogTitle,
|
|
33
|
+
DialogTrigger: () => DialogTrigger,
|
|
34
|
+
DialogWarningProvider: () => DialogWarningProvider,
|
|
35
|
+
createDialogScope: () => createDialogScope
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(Dialog_exports);
|
|
38
|
+
var import_animate_presence = require("@tamagui/animate-presence");
|
|
39
|
+
var import_aria_hidden = require("@tamagui/aria-hidden");
|
|
40
|
+
var import_compose_refs = require("@tamagui/compose-refs");
|
|
41
|
+
var import_core = require("@tamagui/core");
|
|
42
|
+
var import_create_context = require("@tamagui/create-context");
|
|
43
|
+
var import_dismissable = require("@tamagui/dismissable");
|
|
44
|
+
var import_focus_scope = require("@tamagui/focus-scope");
|
|
45
|
+
var import_portal = require("@tamagui/portal");
|
|
46
|
+
var import_remove_scroll = require("@tamagui/remove-scroll");
|
|
47
|
+
var import_sheet = require("@tamagui/sheet");
|
|
48
|
+
var import_stacks = require("@tamagui/stacks");
|
|
49
|
+
var import_text = require("@tamagui/text");
|
|
50
|
+
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
51
|
+
var React = __toESM(require("react"));
|
|
52
|
+
const DIALOG_NAME = "Dialog";
|
|
53
|
+
const [createDialogContext, createDialogScope] = (0, import_create_context.createContextScope)(DIALOG_NAME);
|
|
54
|
+
const [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
55
|
+
const TRIGGER_NAME = "DialogTrigger";
|
|
56
|
+
const DialogTriggerFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
57
|
+
name: TRIGGER_NAME
|
|
58
|
+
});
|
|
59
|
+
const DialogTrigger = React.forwardRef((props, forwardedRef) => {
|
|
60
|
+
const { __scopeDialog, ...triggerProps } = props;
|
|
61
|
+
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
62
|
+
const composedTriggerRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef);
|
|
63
|
+
return /* @__PURE__ */ React.createElement(DialogTriggerFrame, {
|
|
64
|
+
tag: "button",
|
|
65
|
+
"aria-haspopup": "dialog",
|
|
66
|
+
"aria-expanded": context.open,
|
|
67
|
+
"aria-controls": context.contentId,
|
|
68
|
+
"data-state": getState(context.open),
|
|
69
|
+
...triggerProps,
|
|
70
|
+
ref: composedTriggerRef,
|
|
71
|
+
onPress: (0, import_core.composeEventHandlers)(props.onPress, context.onOpenToggle)
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
DialogTrigger.displayName = TRIGGER_NAME;
|
|
75
|
+
const PORTAL_NAME = "DialogPortal";
|
|
76
|
+
const [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
|
|
77
|
+
forceMount: void 0
|
|
78
|
+
});
|
|
79
|
+
const DialogPortalFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
fullscreen: true,
|
|
83
|
+
zIndex: 100,
|
|
84
|
+
...import_core.isWeb && {
|
|
85
|
+
maxHeight: "100vh"
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const DialogPortal = DialogPortalFrame.extractable((props) => {
|
|
89
|
+
const { __scopeDialog, forceMount, children, ...frameProps } = props;
|
|
90
|
+
const themeName = (0, import_core.useThemeName)();
|
|
91
|
+
const context = useDialogContext(PORTAL_NAME, __scopeDialog);
|
|
92
|
+
const isShowing = forceMount || context.open;
|
|
93
|
+
const contents = /* @__PURE__ */ React.createElement(import_animate_presence.AnimatePresence, null, isShowing ? children : null);
|
|
94
|
+
const isSheet = useShowDialogSheet(context);
|
|
95
|
+
if (!context.modal || isSheet) {
|
|
96
|
+
return contents;
|
|
97
|
+
}
|
|
98
|
+
return /* @__PURE__ */ React.createElement(import_portal.PortalItem, null, /* @__PURE__ */ React.createElement(DialogProvider, {
|
|
99
|
+
scope: __scopeDialog,
|
|
100
|
+
...context
|
|
101
|
+
}, /* @__PURE__ */ React.createElement(import_core.Theme, {
|
|
102
|
+
name: themeName
|
|
103
|
+
}, /* @__PURE__ */ React.createElement(PortalProvider, {
|
|
104
|
+
scope: __scopeDialog,
|
|
105
|
+
forceMount
|
|
106
|
+
}, /* @__PURE__ */ React.createElement(DialogPortalFrame, {
|
|
107
|
+
pointerEvents: isShowing ? "auto" : "none",
|
|
108
|
+
...frameProps
|
|
109
|
+
}, contents)))));
|
|
110
|
+
});
|
|
111
|
+
DialogPortal.displayName = PORTAL_NAME;
|
|
112
|
+
const OVERLAY_NAME = "DialogOverlay";
|
|
113
|
+
const DialogOverlayFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
114
|
+
name: OVERLAY_NAME,
|
|
115
|
+
backgrounded: true,
|
|
116
|
+
fullscreen: true
|
|
117
|
+
});
|
|
118
|
+
const DialogOverlay = React.forwardRef(({ __scopeDialog, ...props }, forwardedRef) => {
|
|
119
|
+
const portalContext = usePortalContext(OVERLAY_NAME, __scopeDialog);
|
|
120
|
+
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
121
|
+
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
122
|
+
const showSheet = useShowDialogSheet(context);
|
|
123
|
+
if (!forceMount) {
|
|
124
|
+
if (!context.modal || showSheet) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return /* @__PURE__ */ React.createElement(DialogOverlayImpl, {
|
|
129
|
+
context,
|
|
130
|
+
...overlayProps,
|
|
131
|
+
ref: forwardedRef
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
DialogOverlay.displayName = OVERLAY_NAME;
|
|
135
|
+
const DialogOverlayImpl = React.forwardRef((props, forwardedRef) => {
|
|
136
|
+
const { context, ...overlayProps } = props;
|
|
137
|
+
return /* @__PURE__ */ React.createElement(import_remove_scroll.RemoveScroll, {
|
|
138
|
+
enabled: context.open,
|
|
139
|
+
as: import_core.Slot,
|
|
140
|
+
allowPinchZoom: context.allowPinchZoom,
|
|
141
|
+
shards: [context.contentRef],
|
|
142
|
+
removeScrollBar: false
|
|
143
|
+
}, /* @__PURE__ */ React.createElement(DialogOverlayFrame, {
|
|
144
|
+
"data-state": getState(context.open),
|
|
145
|
+
pointerEvents: context.open ? "auto" : "none",
|
|
146
|
+
...overlayProps,
|
|
147
|
+
ref: forwardedRef
|
|
148
|
+
}));
|
|
149
|
+
});
|
|
150
|
+
const CONTENT_NAME = "DialogContent";
|
|
151
|
+
const DialogContentFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
152
|
+
name: CONTENT_NAME,
|
|
153
|
+
tag: "dialog",
|
|
154
|
+
position: "relative",
|
|
155
|
+
backgrounded: true,
|
|
156
|
+
padded: true,
|
|
157
|
+
radiused: true,
|
|
158
|
+
elevate: true,
|
|
159
|
+
variants: {
|
|
160
|
+
size: {
|
|
161
|
+
"...size": (val, extras) => {
|
|
162
|
+
return {};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
defaultVariants: {
|
|
167
|
+
size: "$4"
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
const DialogContent = DialogContentFrame.extractable(React.forwardRef(({ __scopeDialog, ...props }, forwardedRef) => {
|
|
171
|
+
const portalContext = usePortalContext(CONTENT_NAME, __scopeDialog);
|
|
172
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
173
|
+
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
174
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, context.modal ? /* @__PURE__ */ React.createElement(DialogContentModal, {
|
|
175
|
+
context,
|
|
176
|
+
...contentProps,
|
|
177
|
+
ref: forwardedRef
|
|
178
|
+
}) : /* @__PURE__ */ React.createElement(DialogContentNonModal, {
|
|
179
|
+
context,
|
|
180
|
+
...contentProps,
|
|
181
|
+
ref: forwardedRef
|
|
182
|
+
}));
|
|
183
|
+
}));
|
|
184
|
+
DialogContent.displayName = CONTENT_NAME;
|
|
185
|
+
const DialogContentModal = React.forwardRef(({ children, context, ...props }, forwardedRef) => {
|
|
186
|
+
const contentRef = React.useRef(null);
|
|
187
|
+
const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.contentRef, contentRef);
|
|
188
|
+
React.useEffect(() => {
|
|
189
|
+
if (!context.open)
|
|
190
|
+
return;
|
|
191
|
+
const content = contentRef.current;
|
|
192
|
+
if (content)
|
|
193
|
+
return (0, import_aria_hidden.hideOthers)(content);
|
|
194
|
+
}, [context.open]);
|
|
195
|
+
return /* @__PURE__ */ React.createElement(DialogContentImpl, {
|
|
196
|
+
...props,
|
|
197
|
+
context,
|
|
198
|
+
ref: composedRefs,
|
|
199
|
+
trapFocus: context.open,
|
|
200
|
+
disableOutsidePointerEvents: true,
|
|
201
|
+
onCloseAutoFocus: (0, import_core.composeEventHandlers)(props.onCloseAutoFocus, (event) => {
|
|
202
|
+
var _a;
|
|
203
|
+
event.preventDefault();
|
|
204
|
+
(_a = context.triggerRef.current) == null ? void 0 : _a.focus();
|
|
205
|
+
}),
|
|
206
|
+
onPointerDownOutside: (0, import_core.composeEventHandlers)(props.onPointerDownOutside, (event) => {
|
|
207
|
+
const originalEvent = event["detail"].originalEvent;
|
|
208
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
209
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
210
|
+
if (isRightClick)
|
|
211
|
+
event.preventDefault();
|
|
212
|
+
}),
|
|
213
|
+
onFocusOutside: (0, import_core.composeEventHandlers)(props.onFocusOutside, (event) => event.preventDefault())
|
|
214
|
+
}, children);
|
|
215
|
+
});
|
|
216
|
+
const DialogContentNonModal = React.forwardRef((props, forwardedRef) => {
|
|
217
|
+
const hasInteractedOutsideRef = React.useRef(false);
|
|
218
|
+
return /* @__PURE__ */ React.createElement(DialogContentImpl, {
|
|
219
|
+
...props,
|
|
220
|
+
ref: forwardedRef,
|
|
221
|
+
trapFocus: false,
|
|
222
|
+
disableOutsidePointerEvents: false,
|
|
223
|
+
onCloseAutoFocus: (event) => {
|
|
224
|
+
var _a, _b;
|
|
225
|
+
console.log("on close autofocus");
|
|
226
|
+
(_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
|
|
227
|
+
if (!event.defaultPrevented) {
|
|
228
|
+
if (!hasInteractedOutsideRef.current) {
|
|
229
|
+
(_b = props.context.triggerRef.current) == null ? void 0 : _b.focus();
|
|
230
|
+
}
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
}
|
|
233
|
+
hasInteractedOutsideRef.current = false;
|
|
234
|
+
},
|
|
235
|
+
onInteractOutside: (event) => {
|
|
236
|
+
var _a;
|
|
237
|
+
(_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
|
|
238
|
+
if (!event.defaultPrevented)
|
|
239
|
+
hasInteractedOutsideRef.current = true;
|
|
240
|
+
const target = event.target;
|
|
241
|
+
const trigger = props.context.triggerRef.current;
|
|
242
|
+
if (!(trigger instanceof HTMLElement))
|
|
243
|
+
return;
|
|
244
|
+
const targetIsTrigger = trigger.contains(target);
|
|
245
|
+
if (targetIsTrigger)
|
|
246
|
+
event.preventDefault();
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
const DialogContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
251
|
+
const {
|
|
252
|
+
__scopeDialog,
|
|
253
|
+
trapFocus,
|
|
254
|
+
onOpenAutoFocus,
|
|
255
|
+
onCloseAutoFocus,
|
|
256
|
+
disableOutsidePointerEvents,
|
|
257
|
+
onEscapeKeyDown,
|
|
258
|
+
onPointerDownOutside,
|
|
259
|
+
onFocusOutside,
|
|
260
|
+
onInteractOutside,
|
|
261
|
+
context,
|
|
262
|
+
...contentProps
|
|
263
|
+
} = props;
|
|
264
|
+
const contentRef = React.useRef(null);
|
|
265
|
+
const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef);
|
|
266
|
+
const showSheet = useShowDialogSheet(context);
|
|
267
|
+
const contents = /* @__PURE__ */ React.createElement(DialogContentFrame, {
|
|
268
|
+
id: context.contentId,
|
|
269
|
+
"aria-describedby": context.descriptionId,
|
|
270
|
+
"aria-labelledby": context.titleId,
|
|
271
|
+
"data-state": getState(context.open),
|
|
272
|
+
...contentProps
|
|
273
|
+
});
|
|
274
|
+
if (showSheet) {
|
|
275
|
+
return /* @__PURE__ */ React.createElement(import_portal.PortalItem, {
|
|
276
|
+
hostName: `${context.scopeKey}SheetContents`
|
|
277
|
+
}, contentProps.children);
|
|
278
|
+
}
|
|
279
|
+
if (!import_core.isWeb) {
|
|
280
|
+
return contents;
|
|
281
|
+
}
|
|
282
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(import_focus_scope.FocusScope, {
|
|
283
|
+
loop: true,
|
|
284
|
+
trapped: trapFocus,
|
|
285
|
+
onMountAutoFocus: onOpenAutoFocus,
|
|
286
|
+
forceUnmount: !context.open,
|
|
287
|
+
onUnmountAutoFocus: onCloseAutoFocus
|
|
288
|
+
}, /* @__PURE__ */ React.createElement(import_dismissable.Dismissable, {
|
|
289
|
+
disableOutsidePointerEvents: context.open && disableOutsidePointerEvents,
|
|
290
|
+
forceUnmount: !context.open,
|
|
291
|
+
onEscapeKeyDown,
|
|
292
|
+
onPointerDownOutside,
|
|
293
|
+
onFocusOutside,
|
|
294
|
+
onInteractOutside,
|
|
295
|
+
ref: composedRefs,
|
|
296
|
+
onDismiss: () => context.onOpenChange(false)
|
|
297
|
+
}, contents)), process.env.NODE_ENV === "development" && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TitleWarning, {
|
|
298
|
+
titleId: context.titleId
|
|
299
|
+
}), /* @__PURE__ */ React.createElement(DescriptionWarning, {
|
|
300
|
+
contentRef,
|
|
301
|
+
descriptionId: context.descriptionId
|
|
302
|
+
})));
|
|
303
|
+
});
|
|
304
|
+
const SHEET_CONTENTS_NAME = "DialogSheetContents";
|
|
305
|
+
const DialogSheetContents = ({ __scopeDialog }) => {
|
|
306
|
+
const context = useDialogContext(SHEET_CONTENTS_NAME, __scopeDialog);
|
|
307
|
+
return /* @__PURE__ */ React.createElement(import_portal.PortalHost, {
|
|
308
|
+
name: `${context.scopeKey}SheetContents`
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
DialogSheetContents.displayName = SHEET_CONTENTS_NAME;
|
|
312
|
+
const TITLE_NAME = "DialogTitle";
|
|
313
|
+
const DialogTitleFrame = (0, import_core.styled)(import_text.H2, {
|
|
314
|
+
name: TITLE_NAME
|
|
315
|
+
});
|
|
316
|
+
const DialogTitle = React.forwardRef((props, forwardedRef) => {
|
|
317
|
+
const { __scopeDialog, ...titleProps } = props;
|
|
318
|
+
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
319
|
+
return /* @__PURE__ */ React.createElement(DialogTitleFrame, {
|
|
320
|
+
id: context.titleId,
|
|
321
|
+
...titleProps,
|
|
322
|
+
ref: forwardedRef
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
DialogTitle.displayName = TITLE_NAME;
|
|
326
|
+
const DialogDescriptionFrame = (0, import_core.styled)(import_text.Paragraph, {
|
|
327
|
+
name: "DialogDescription"
|
|
328
|
+
});
|
|
329
|
+
const DESCRIPTION_NAME = "DialogDescription";
|
|
330
|
+
const DialogDescription = React.forwardRef((props, forwardedRef) => {
|
|
331
|
+
const { __scopeDialog, ...descriptionProps } = props;
|
|
332
|
+
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
333
|
+
return /* @__PURE__ */ React.createElement(DialogDescriptionFrame, {
|
|
334
|
+
id: context.descriptionId,
|
|
335
|
+
...descriptionProps,
|
|
336
|
+
ref: forwardedRef
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
340
|
+
const CLOSE_NAME = "DialogClose";
|
|
341
|
+
const DialogClose = React.forwardRef((props, forwardedRef) => {
|
|
342
|
+
const { __scopeDialog, ...closeProps } = props;
|
|
343
|
+
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
344
|
+
const isSheet = useShowDialogSheet(context);
|
|
345
|
+
if (isSheet) {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
return /* @__PURE__ */ React.createElement(import_stacks.YStack, {
|
|
349
|
+
tag: "button",
|
|
350
|
+
...closeProps,
|
|
351
|
+
ref: forwardedRef,
|
|
352
|
+
onPress: (0, import_core.composeEventHandlers)(props.onPress, () => context.onOpenChange(false))
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
DialogClose.displayName = CLOSE_NAME;
|
|
356
|
+
function getState(open) {
|
|
357
|
+
return open ? "open" : "closed";
|
|
358
|
+
}
|
|
359
|
+
const TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
360
|
+
const [DialogWarningProvider, useWarningContext] = (0, import_create_context.createContext)(TITLE_WARNING_NAME, {
|
|
361
|
+
contentName: CONTENT_NAME,
|
|
362
|
+
titleName: TITLE_NAME,
|
|
363
|
+
docsSlug: "dialog"
|
|
364
|
+
});
|
|
365
|
+
const TitleWarning = ({ titleId }) => {
|
|
366
|
+
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
367
|
+
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
368
|
+
|
|
369
|
+
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
370
|
+
|
|
371
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
372
|
+
React.useEffect(() => {
|
|
373
|
+
if (!import_core.isWeb)
|
|
374
|
+
return;
|
|
375
|
+
if (titleId) {
|
|
376
|
+
const hasTitle = document.getElementById(titleId);
|
|
377
|
+
if (!hasTitle)
|
|
378
|
+
throw new Error(MESSAGE);
|
|
379
|
+
}
|
|
380
|
+
}, [MESSAGE, titleId]);
|
|
381
|
+
return null;
|
|
382
|
+
};
|
|
383
|
+
const DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
384
|
+
const DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
385
|
+
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
386
|
+
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
387
|
+
React.useEffect(() => {
|
|
388
|
+
if (!import_core.isWeb)
|
|
389
|
+
return;
|
|
390
|
+
const contentNode = contentRef.current;
|
|
391
|
+
if (!(contentNode instanceof HTMLElement)) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
const describedById = contentNode.getAttribute("aria-describedby");
|
|
395
|
+
if (descriptionId && describedById) {
|
|
396
|
+
const hasDescription = document.getElementById(descriptionId);
|
|
397
|
+
if (!hasDescription)
|
|
398
|
+
console.warn(MESSAGE);
|
|
399
|
+
}
|
|
400
|
+
}, [MESSAGE, contentRef, descriptionId]);
|
|
401
|
+
return null;
|
|
402
|
+
};
|
|
403
|
+
const DialogInner = React.forwardRef(function Dialog(props, ref) {
|
|
404
|
+
const {
|
|
405
|
+
__scopeDialog,
|
|
406
|
+
children,
|
|
407
|
+
open: openProp,
|
|
408
|
+
defaultOpen = false,
|
|
409
|
+
onOpenChange,
|
|
410
|
+
modal = true,
|
|
411
|
+
allowPinchZoom = false,
|
|
412
|
+
sheetBreakpoint = false
|
|
413
|
+
} = props;
|
|
414
|
+
const triggerRef = React.useRef(null);
|
|
415
|
+
const contentRef = React.useRef(null);
|
|
416
|
+
const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
|
|
417
|
+
prop: openProp,
|
|
418
|
+
defaultProp: defaultOpen,
|
|
419
|
+
onChange: onOpenChange
|
|
420
|
+
});
|
|
421
|
+
React.useImperativeHandle(ref, () => ({
|
|
422
|
+
open: setOpen
|
|
423
|
+
}), [setOpen]);
|
|
424
|
+
return /* @__PURE__ */ React.createElement(DialogProvider, {
|
|
425
|
+
scope: __scopeDialog,
|
|
426
|
+
scopeKey: __scopeDialog ? Object.keys(__scopeDialog)[0] : "",
|
|
427
|
+
triggerRef,
|
|
428
|
+
contentRef,
|
|
429
|
+
contentId: (0, import_core.useId)() || "",
|
|
430
|
+
titleId: (0, import_core.useId)() || "",
|
|
431
|
+
descriptionId: (0, import_core.useId)() || "",
|
|
432
|
+
open,
|
|
433
|
+
onOpenChange: setOpen,
|
|
434
|
+
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
435
|
+
modal,
|
|
436
|
+
allowPinchZoom,
|
|
437
|
+
sheetBreakpoint
|
|
438
|
+
}, /* @__PURE__ */ React.createElement(DialogSheetController, {
|
|
439
|
+
onChangeOpen: setOpen,
|
|
440
|
+
__scopeDialog
|
|
441
|
+
}, children));
|
|
442
|
+
});
|
|
443
|
+
const Dialog2 = (0, import_core.withStaticProperties)(DialogInner, {
|
|
444
|
+
Trigger: DialogTrigger,
|
|
445
|
+
Portal: DialogPortal,
|
|
446
|
+
Overlay: DialogOverlay,
|
|
447
|
+
Content: DialogContent,
|
|
448
|
+
Title: DialogTitle,
|
|
449
|
+
Description: DialogDescription,
|
|
450
|
+
Close: DialogClose,
|
|
451
|
+
SheetContents: DialogSheetContents,
|
|
452
|
+
Sheet: import_sheet.Sheet
|
|
453
|
+
});
|
|
454
|
+
const DialogSheetController = (props) => {
|
|
455
|
+
const context = useDialogContext("DialogSheetController", props.__scopeDialog);
|
|
456
|
+
const showSheet = useShowDialogSheet(context);
|
|
457
|
+
const breakpointActive = useSheetBreakpointActive(context);
|
|
458
|
+
const getShowSheet = (0, import_core.useGet)(showSheet);
|
|
459
|
+
return /* @__PURE__ */ React.createElement(import_sheet.SheetController, {
|
|
460
|
+
onChangeOpen: (val) => {
|
|
461
|
+
if (getShowSheet()) {
|
|
462
|
+
props.onChangeOpen(val);
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
open: context.open,
|
|
466
|
+
hidden: breakpointActive === false
|
|
467
|
+
}, props.children);
|
|
468
|
+
};
|
|
469
|
+
const useSheetBreakpointActive = (context) => {
|
|
470
|
+
const media = (0, import_core.useMedia)();
|
|
471
|
+
return context.sheetBreakpoint ? media[context.sheetBreakpoint] : false;
|
|
472
|
+
};
|
|
473
|
+
const useShowDialogSheet = (context) => {
|
|
474
|
+
const breakpointActive = useSheetBreakpointActive(context);
|
|
475
|
+
return context.open === false ? false : breakpointActive;
|
|
476
|
+
};
|
|
477
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
478
|
+
0 && (module.exports = {
|
|
479
|
+
Dialog,
|
|
480
|
+
DialogClose,
|
|
481
|
+
DialogContent,
|
|
482
|
+
DialogDescription,
|
|
483
|
+
DialogOverlay,
|
|
484
|
+
DialogPortal,
|
|
485
|
+
DialogPortalFrame,
|
|
486
|
+
DialogSheetContents,
|
|
487
|
+
DialogTitle,
|
|
488
|
+
DialogTrigger,
|
|
489
|
+
DialogWarningProvider,
|
|
490
|
+
createDialogScope
|
|
491
|
+
});
|
|
492
|
+
//# sourceMappingURL=Dialog.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Dialog.tsx"],
|
|
4
|
+
"sourcesContent": ["import { AnimatePresence } from '@tamagui/animate-presence'\nimport { hideOthers } from '@tamagui/aria-hidden'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n GetProps,\n MediaPropKeys,\n Slot,\n TamaguiElement,\n Theme,\n composeEventHandlers,\n isWeb,\n styled,\n useGet,\n useId,\n useMedia,\n useThemeName,\n withStaticProperties,\n} from '@tamagui/core'\nimport { Scope, createContext, createContextScope } from '@tamagui/create-context'\nimport { Dismissable, DismissableProps } from '@tamagui/dismissable'\nimport { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'\nimport { PortalHost, PortalItem, PortalItemProps } from '@tamagui/portal'\nimport { RemoveScroll } from '@tamagui/remove-scroll'\nimport { Sheet, SheetController } from '@tamagui/sheet'\nimport { ThemeableStack, YStack, YStackProps } from '@tamagui/stacks'\nimport { H2, Paragraph } from '@tamagui/text'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\n\nconst DIALOG_NAME = 'Dialog'\n\ntype ScopedProps<P> = P & { __scopeDialog?: Scope }\n\nconst [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME)\n\ntype RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>\n\ninterface DialogProps {\n sheetBreakpoint?: MediaPropKeys | false\n children?: React.ReactNode\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?(open: boolean): void\n modal?: boolean\n\n /**\n * @see https://github.com/theKashey/react-remove-scroll#usage\n */\n allowPinchZoom?: RemoveScrollProps['allowPinchZoom']\n}\n\ntype NonNull<A> = Exclude<A, void | null>\n\ntype DialogContextValue = {\n triggerRef: React.RefObject<TamaguiElement>\n contentRef: React.RefObject<TamaguiElement>\n contentId: string\n titleId: string\n descriptionId: string\n onOpenToggle(): void\n open: NonNull<DialogProps['open']>\n onOpenChange: NonNull<DialogProps['onOpenChange']>\n modal: NonNull<DialogProps['modal']>\n allowPinchZoom: NonNull<DialogProps['allowPinchZoom']>\n sheetBreakpoint: NonNull<DialogProps['sheetBreakpoint']>\n scopeKey: string\n}\n\nconst [DialogProvider, useDialogContext] = createDialogContext<DialogContextValue>(DIALOG_NAME)\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DialogTrigger'\n\nconst DialogTriggerFrame = styled(YStack, {\n name: TRIGGER_NAME,\n})\n\ninterface DialogTriggerProps extends YStackProps {}\n\nconst DialogTrigger = React.forwardRef<TamaguiElement, DialogTriggerProps>(\n (props: ScopedProps<DialogTriggerProps>, forwardedRef) => {\n const { __scopeDialog, ...triggerProps } = props\n const context = useDialogContext(TRIGGER_NAME, __scopeDialog)\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef)\n return (\n <DialogTriggerFrame\n tag=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}\n />\n )\n }\n)\n\nDialogTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DialogPortal'\n\ntype PortalContextValue = { forceMount?: true }\nconst [PortalProvider, usePortalContext] = createDialogContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n})\n\ntype DialogPortalProps = Omit<PortalItemProps, 'asChild'> &\n YStackProps & {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true\n }\n\nexport const DialogPortalFrame = styled(YStack, {\n alignItems: 'center',\n justifyContent: 'center',\n fullscreen: true,\n zIndex: 100,\n ...(isWeb && {\n maxHeight: '100vh',\n }),\n})\n\nconst DialogPortal: React.FC<DialogPortalProps> = DialogPortalFrame.extractable(\n (props: ScopedProps<DialogPortalProps>) => {\n const { __scopeDialog, forceMount, children, ...frameProps } = props\n const themeName = useThemeName()\n const context = useDialogContext(PORTAL_NAME, __scopeDialog)\n const isShowing = forceMount || context.open\n const contents = <AnimatePresence>{isShowing ? children : null}</AnimatePresence>\n const isSheet = useShowDialogSheet(context)\n if (!context.modal || isSheet) {\n return contents\n }\n return (\n <PortalItem>\n {/* until we can use react-native portals natively */}\n {/* have to re-propogate context, sketch */}\n <DialogProvider scope={__scopeDialog} {...context}>\n <Theme name={themeName}>\n <PortalProvider scope={__scopeDialog} forceMount={forceMount}>\n <DialogPortalFrame pointerEvents={isShowing ? 'auto' : 'none'} {...frameProps}>\n {contents}\n </DialogPortalFrame>\n </PortalProvider>\n </Theme>\n </DialogProvider>\n </PortalItem>\n )\n }\n)\n\nDialogPortal.displayName = PORTAL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'DialogOverlay'\n\nconst DialogOverlayFrame = styled(ThemeableStack, {\n name: OVERLAY_NAME,\n backgrounded: true,\n fullscreen: true,\n})\n\ninterface DialogOverlayProps extends YStackProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true\n}\n\nconst DialogOverlay = React.forwardRef<TamaguiElement, DialogOverlayProps>(\n ({ __scopeDialog, ...props }: ScopedProps<DialogOverlayProps>, forwardedRef) => {\n const portalContext = usePortalContext(OVERLAY_NAME, __scopeDialog)\n const { forceMount = portalContext.forceMount, ...overlayProps } = props\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog)\n const showSheet = useShowDialogSheet(context)\n\n if (!forceMount) {\n if (!context.modal || showSheet) {\n return null\n }\n }\n\n return <DialogOverlayImpl context={context} {...overlayProps} ref={forwardedRef} />\n }\n)\n\nDialogOverlay.displayName = OVERLAY_NAME\n\ntype DialogOverlayImplProps = GetProps<typeof DialogOverlayFrame> & {\n context: DialogContextValue\n}\n\nconst DialogOverlayImpl = React.forwardRef<TamaguiElement, DialogOverlayImplProps>(\n (props, forwardedRef) => {\n const { context, ...overlayProps } = props\n\n return (\n // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`\n // ie. when `Overlay` and `Content` are siblings\n <RemoveScroll\n enabled={context.open}\n as={Slot}\n allowPinchZoom={context.allowPinchZoom}\n shards={[context.contentRef]}\n // causes lots of bugs on touch web on site\n removeScrollBar={false}\n >\n <DialogOverlayFrame\n data-state={getState(context.open)}\n // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.\n pointerEvents={context.open ? 'auto' : 'none'}\n {...overlayProps}\n ref={forwardedRef}\n />\n </RemoveScroll>\n )\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * DialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DialogContent'\n\nconst DialogContentFrame = styled(ThemeableStack, {\n name: CONTENT_NAME,\n tag: 'dialog',\n position: 'relative',\n backgrounded: true,\n padded: true,\n radiused: true,\n elevate: true,\n\n variants: {\n size: {\n '...size': (val, extras) => {\n return {}\n },\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\ntype DialogContentFrameProps = GetProps<typeof DialogContentFrame>\n\ninterface DialogContentProps\n extends DialogContentFrameProps,\n Omit<DialogContentTypeProps, 'context'> {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true\n}\n\nconst DialogContent = DialogContentFrame.extractable(\n React.forwardRef<TamaguiElement, DialogContentProps>(\n ({ __scopeDialog, ...props }: ScopedProps<DialogContentProps>, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, __scopeDialog)\n const { forceMount = portalContext.forceMount, ...contentProps } = props\n const context = useDialogContext(CONTENT_NAME, __scopeDialog)\n\n return (\n <>\n {context.modal ? (\n <DialogContentModal context={context} {...contentProps} ref={forwardedRef} />\n ) : (\n <DialogContentNonModal context={context} {...contentProps} ref={forwardedRef} />\n )}\n </>\n )\n }\n )\n)\n\nDialogContent.displayName = CONTENT_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\ninterface DialogContentTypeProps\n extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {\n context: DialogContextValue\n}\n\nconst DialogContentModal = React.forwardRef<TamaguiElement, DialogContentTypeProps>(\n ({ children, context, ...props }: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const contentRef = React.useRef<HTMLDivElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef)\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n if (!context.open) return\n const content = contentRef.current\n if (content) return hideOthers(content)\n }, [context.open])\n\n return (\n <DialogContentImpl\n {...props}\n context={context}\n ref={composedRefs}\n // we make sure focus isn't trapped once `DialogContent` has been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault()\n context.triggerRef.current?.focus()\n })}\n onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n const originalEvent = event['detail'].originalEvent\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick\n // If the event is a right-click, we shouldn't close because\n // it is effectively as if we right-clicked the `Overlay`.\n if (isRightClick) event.preventDefault()\n })}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) =>\n event.preventDefault()\n )}\n >\n {children}\n </DialogContentImpl>\n )\n }\n)\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst DialogContentNonModal = React.forwardRef<TamaguiElement, DialogContentTypeProps>(\n (props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const hasInteractedOutsideRef = React.useRef(false)\n\n return (\n <DialogContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n console.log('on close autofocus')\n props.onCloseAutoFocus?.(event)\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) {\n props.context.triggerRef.current?.focus()\n }\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault()\n }\n\n hasInteractedOutsideRef.current = false\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event)\n\n if (!event.defaultPrevented) hasInteractedOutsideRef.current = true\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n //\n // We use `onInteractOutside` as some browsers also\n // focus on pointer down, creating the same issue.\n const target = event.target as HTMLElement\n const trigger = props.context.triggerRef.current\n if (!(trigger instanceof HTMLElement)) return\n const targetIsTrigger = trigger.contains(target)\n if (targetIsTrigger) event.preventDefault()\n }}\n />\n )\n }\n)\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentImplProps = DialogContentFrameProps &\n Omit<DismissableProps, 'onDismiss'> & {\n /**\n * When `true`, focus cannot escape the `Content` via keyboard,\n * pointer, or a programmatic focus.\n * @defaultValue false\n */\n trapFocus?: FocusScopeProps['trapped']\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus']\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus']\n\n context: DialogContextValue\n }\n\nconst DialogContentImpl = React.forwardRef<TamaguiElement, DialogContentImplProps>(\n (props: ScopedProps<DialogContentImplProps>, forwardedRef) => {\n const {\n __scopeDialog,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n context,\n ...contentProps\n } = props\n const contentRef = React.useRef<HTMLDivElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const showSheet = useShowDialogSheet(context)\n\n const contents = (\n <DialogContentFrame\n id={context.contentId}\n aria-describedby={context.descriptionId}\n aria-labelledby={context.titleId}\n data-state={getState(context.open)}\n {...contentProps}\n />\n )\n\n if (showSheet) {\n return (\n <PortalItem hostName={`${context.scopeKey}SheetContents`}>\n {contentProps.children}\n </PortalItem>\n )\n }\n\n if (!isWeb) {\n return contents\n }\n\n return (\n <>\n <FocusScope\n loop\n trapped={trapFocus}\n onMountAutoFocus={onOpenAutoFocus}\n forceUnmount={!context.open}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <Dismissable\n disableOutsidePointerEvents={context.open && disableOutsidePointerEvents}\n forceUnmount={!context.open}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onInteractOutside={onInteractOutside}\n // @ts-ignore\n ref={composedRefs}\n onDismiss={() => context.onOpenChange(false)}\n >\n {contents}\n </Dismissable>\n </FocusScope>\n {process.env.NODE_ENV === 'development' && (\n <>\n <TitleWarning titleId={context.titleId} />\n <DescriptionWarning contentRef={contentRef} descriptionId={context.descriptionId} />\n </>\n )}\n </>\n )\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * DialogSheetContents\n * -----------------------------------------------------------------------------------------------*/\n\nconst SHEET_CONTENTS_NAME = 'DialogSheetContents'\n\nexport const DialogSheetContents = ({ __scopeDialog }: ScopedProps<{}>) => {\n const context = useDialogContext(SHEET_CONTENTS_NAME, __scopeDialog)\n return <PortalHost name={`${context.scopeKey}SheetContents`}></PortalHost>\n}\n\nDialogSheetContents.displayName = SHEET_CONTENTS_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'DialogTitle'\nconst DialogTitleFrame = styled(H2, {\n name: TITLE_NAME,\n})\n\ntype DialogTitleProps = GetProps<typeof DialogTitleFrame>\n\nconst DialogTitle = React.forwardRef<TamaguiElement, DialogTitleProps>(\n (props: ScopedProps<DialogTitleProps>, forwardedRef) => {\n const { __scopeDialog, ...titleProps } = props\n const context = useDialogContext(TITLE_NAME, __scopeDialog)\n return <DialogTitleFrame id={context.titleId} {...titleProps} ref={forwardedRef} />\n }\n)\n\nDialogTitle.displayName = TITLE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DialogDescriptionFrame = styled(Paragraph, {\n name: 'DialogDescription',\n})\n\ntype DialogDescriptionProps = GetProps<typeof DialogDescriptionFrame>\n\nconst DESCRIPTION_NAME = 'DialogDescription'\n\nconst DialogDescription = React.forwardRef<TamaguiElement, DialogDescriptionProps>(\n (props: ScopedProps<DialogDescriptionProps>, forwardedRef) => {\n const { __scopeDialog, ...descriptionProps } = props\n const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog)\n return (\n <DialogDescriptionFrame id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />\n )\n }\n)\n\nDialogDescription.displayName = DESCRIPTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'DialogClose'\n\ntype DialogCloseProps = YStackProps\n\nconst DialogClose = React.forwardRef<TamaguiElement, DialogCloseProps>(\n (props: ScopedProps<DialogCloseProps>, forwardedRef) => {\n const { __scopeDialog, ...closeProps } = props\n const context = useDialogContext(CLOSE_NAME, __scopeDialog)\n const isSheet = useShowDialogSheet(context)\n\n if (isSheet) {\n return null\n }\n\n return (\n <YStack\n tag=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onPress={composeEventHandlers(props.onPress, () => context.onOpenChange(false))}\n />\n )\n }\n)\n\nDialogClose.displayName = CLOSE_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed'\n}\n\nconst TITLE_WARNING_NAME = 'DialogTitleWarning'\n\nconst [DialogWarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {\n contentName: CONTENT_NAME,\n titleName: TITLE_NAME,\n docsSlug: 'dialog',\n})\n\ntype TitleWarningProps = { titleId?: string }\n\nconst TitleWarning: React.FC<TitleWarningProps> = ({ titleId }) => {\n const titleWarningContext = useWarningContext(TITLE_WARNING_NAME)\n\n const MESSAGE = `\\`${titleWarningContext.contentName}\\` requires a \\`${titleWarningContext.titleName}\\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \\`${titleWarningContext.titleName}\\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`\n\n React.useEffect(() => {\n if (!isWeb) return\n if (titleId) {\n const hasTitle = document.getElementById(titleId)\n if (!hasTitle) throw new Error(MESSAGE)\n }\n }, [MESSAGE, titleId])\n\n return null\n}\n\nconst DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning'\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<TamaguiElement>\n descriptionId?: string\n}\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef, descriptionId }) => {\n const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME)\n const MESSAGE = `Warning: Missing \\`Description\\` or \\`aria-describedby={undefined}\\` for {${descriptionWarningContext.contentName}}.`\n\n React.useEffect(() => {\n if (!isWeb) return\n const contentNode = contentRef.current\n if (!(contentNode instanceof HTMLElement)) {\n return\n }\n const describedById = contentNode.getAttribute('aria-describedby')\n // if we have an id and the user hasn't set aria-describedby={undefined}\n if (descriptionId && describedById) {\n const hasDescription = document.getElementById(descriptionId)\n if (!hasDescription) console.warn(MESSAGE)\n }\n }, [MESSAGE, contentRef, descriptionId])\n\n return null\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Dialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst DialogInner = React.forwardRef<{ open: (val: boolean) => void }, DialogProps>(function Dialog(\n props: ScopedProps<DialogProps>,\n ref\n) {\n const {\n __scopeDialog,\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n modal = true,\n allowPinchZoom = false,\n sheetBreakpoint = false,\n } = props\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const contentRef = React.useRef<TamaguiElement>(null)\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n })\n\n React.useImperativeHandle(\n ref,\n () => ({\n open: setOpen,\n }),\n [setOpen]\n )\n\n return (\n <DialogProvider\n scope={__scopeDialog}\n scopeKey={__scopeDialog ? Object.keys(__scopeDialog)[0] : ''}\n triggerRef={triggerRef}\n contentRef={contentRef}\n contentId={useId() || ''}\n titleId={useId() || ''}\n descriptionId={useId() || ''}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n allowPinchZoom={allowPinchZoom}\n sheetBreakpoint={sheetBreakpoint}\n >\n <DialogSheetController onChangeOpen={setOpen} __scopeDialog={__scopeDialog}>\n {children}\n </DialogSheetController>\n </DialogProvider>\n )\n})\n\nconst Dialog = withStaticProperties(DialogInner, {\n Trigger: DialogTrigger,\n Portal: DialogPortal,\n Overlay: DialogOverlay,\n Content: DialogContent,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n SheetContents: DialogSheetContents,\n Sheet,\n})\n\nconst DialogSheetController = (\n props: ScopedProps<{\n children: React.ReactNode\n onChangeOpen: React.Dispatch<React.SetStateAction<boolean>>\n }>\n) => {\n const context = useDialogContext('DialogSheetController', props.__scopeDialog)\n const showSheet = useShowDialogSheet(context)\n const breakpointActive = useSheetBreakpointActive(context)\n const getShowSheet = useGet(showSheet)\n return (\n <SheetController\n onChangeOpen={(val) => {\n if (getShowSheet()) {\n props.onChangeOpen(val)\n }\n }}\n open={context.open}\n hidden={breakpointActive === false}\n >\n {props.children}\n </SheetController>\n )\n}\n\nconst useSheetBreakpointActive = (context: DialogContextValue) => {\n const media = useMedia()\n return context.sheetBreakpoint ? media[context.sheetBreakpoint] : false\n}\n\nconst useShowDialogSheet = (context: DialogContextValue) => {\n const breakpointActive = useSheetBreakpointActive(context)\n return context.open === false ? false : breakpointActive\n}\n\nexport {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n DialogWarningProvider,\n}\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogCloseProps,\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAgC;AAChC,yBAA2B;AAC3B,0BAAgC;AAChC,kBAcO;AACP,4BAAyD;AACzD,yBAA8C;AAC9C,yBAA4C;AAC5C,oBAAwD;AACxD,2BAA6B;AAC7B,mBAAuC;AACvC,oBAAoD;AACpD,kBAA8B;AAC9B,oCAAqC;AACrC,YAAuB;AAEvB,MAAM,cAAc;AAIpB,MAAM,CAAC,qBAAqB,qBAAqB,8CAAmB,WAAW;AAmC/E,MAAM,CAAC,gBAAgB,oBAAoB,oBAAwC,WAAW;AAM9F,MAAM,eAAe;AAErB,MAAM,qBAAqB,wBAAO,sBAAQ;AAAA,EACxC,MAAM;AACR,CAAC;AAID,MAAM,gBAAgB,MAAM,WAC1B,CAAC,OAAwC,iBAAiB;AACxD,QAAM,EAAE,kBAAkB,iBAAiB;AAC3C,QAAM,UAAU,iBAAiB,cAAc,aAAa;AAC5D,QAAM,qBAAqB,yCAAgB,cAAc,QAAQ,UAAU;AAC3E,SACE,oCAAC;AAAA,IACC,KAAI;AAAA,IACJ,iBAAc;AAAA,IACd,iBAAe,QAAQ;AAAA,IACvB,iBAAe,QAAQ;AAAA,IACvB,cAAY,SAAS,QAAQ,IAAI;AAAA,IAChC,GAAG;AAAA,IACJ,KAAK;AAAA,IACL,SAAS,sCAAqB,MAAM,SAAS,QAAQ,YAAY;AAAA,GAC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