@radix-ui/react-alert-dialog 0.1.8-rc.7 → 1.0.0-rc.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/index.d.ts.map +1 -1
- package/dist/index.js +217 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +192 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +9 -9
- package/src/AlertDialog.stories.tsx +176 -174
- package/src/AlertDialog.test.tsx +1 -1
- package/src/index.ts +34 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;AAkBA,OAAA,6FAEE,CAAC;AAGH,mBAAmB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,IAAI,CAAC,CAAC;AAC/E,iCAA2B,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;CAAG;AAEhE,OAAA,MAAM,aAAa,MAAM,EAAE,CAAC,gBAAgB,CAI3C,CAAC;AAUF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCAAkC,SAAQ,kBAAkB;CAAG;AAE/D,OAAA,MAAM,qHAML,CAAC;AAUF,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,MAAM,CAAC,CAAC;AACvF,uCAAiC,SAAQ,iBAAiB;CAAG;AAE7D,OAAA,MAAM,mBAAmB,MAAM,EAAE,CAAC,sBAAsB,CAMvD,CAAC;AAWF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCAAkC,SAAQ,kBAAkB;CAAG;AAE/D,OAAA,MAAM,kHAML,CAAC;AAkBF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCACE,SAAQ,IAAI,CAAC,kBAAkB,EAAE,sBAAsB,GAAG,mBAAmB,CAAC;CAAG;AAEnF,OAAA,MAAM,kHA0CL,CAAC;AAWF,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,KAAK,CAAC,CAAC;AACrF,sCAAgC,SAAQ,gBAAgB;CAAG;AAE3D,OAAA,MAAM,kHAML,CAAC;AAWF,8BAA8B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,WAAW,CAAC,CAAC;AACjG,4CAAsC,SAAQ,sBAAsB;CAAG;AAEvE,OAAA,MAAM,gIAOJ,CAAC;AAWH,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,KAAK,CAAC,CAAC;AACrF,uCAAiC,SAAQ,gBAAgB;CAAG;AAE5D,OAAA,MAAM,mHAML,CAAC;AAWF,uCAAiC,SAAQ,gBAAgB;CAAG;AAE5D,OAAA,MAAM,mHAQL,CAAC;AA6BF,OAAA,MAAM,gCAAkB,CAAC;AACzB,OAAA,MAAM,0GAA4B,CAAC;AACnC,OAAA,MAAM,wCAA0B,CAAC;AACjC,OAAA,MAAM,uGAA4B,CAAC;AACnC,OAAA,MAAM,uGAA4B,CAAC;AACnC,OAAA,MAAM,wGAA0B,CAAC;AACjC,OAAA,MAAM,wGAA0B,CAAC;AACjC,OAAA,MAAM,uGAAwB,CAAC;AAC/B,OAAA,MAAM,qHAAoC,CAAC","sources":["packages/react/alert-dialog/src/packages/react/alert-dialog/src/AlertDialog.tsx","packages/react/alert-dialog/src/packages/react/alert-dialog/src/index.ts","packages/react/alert-dialog/src/index.ts"],"sourcesContent":[null,null,"export {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n} from './AlertDialog';\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n} from './AlertDialog';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,218 @@
|
|
|
1
|
-
var
|
|
1
|
+
var $hLIh8$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
|
|
2
|
+
var $hLIh8$react = require("react");
|
|
3
|
+
var $hLIh8$radixuireactcontext = require("@radix-ui/react-context");
|
|
4
|
+
var $hLIh8$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
|
|
5
|
+
var $hLIh8$radixuireactdialog = require("@radix-ui/react-dialog");
|
|
6
|
+
var $hLIh8$radixuiprimitive = require("@radix-ui/primitive");
|
|
7
|
+
var $hLIh8$radixuireactslot = require("@radix-ui/react-slot");
|
|
8
|
+
|
|
9
|
+
function $parcel$export(e, n, v, s) {
|
|
10
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
11
|
+
}
|
|
12
|
+
function $parcel$interopDefault(a) {
|
|
13
|
+
return a && a.__esModule ? a.default : a;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
$parcel$export(module.exports, "createAlertDialogScope", () => $8c7baeec26a63e97$export$b8891880751c2c5b);
|
|
17
|
+
$parcel$export(module.exports, "AlertDialog", () => $8c7baeec26a63e97$export$de466dd8317b0b75);
|
|
18
|
+
$parcel$export(module.exports, "AlertDialogTrigger", () => $8c7baeec26a63e97$export$6edd7a623ef0f40b);
|
|
19
|
+
$parcel$export(module.exports, "AlertDialogPortal", () => $8c7baeec26a63e97$export$660f2bfdb986706c);
|
|
20
|
+
$parcel$export(module.exports, "AlertDialogOverlay", () => $8c7baeec26a63e97$export$a707a4895ce23256);
|
|
21
|
+
$parcel$export(module.exports, "AlertDialogContent", () => $8c7baeec26a63e97$export$94e6af45f0af4efd);
|
|
22
|
+
$parcel$export(module.exports, "AlertDialogAction", () => $8c7baeec26a63e97$export$b454f818c58ee85d);
|
|
23
|
+
$parcel$export(module.exports, "AlertDialogCancel", () => $8c7baeec26a63e97$export$2f67a923571aaea0);
|
|
24
|
+
$parcel$export(module.exports, "AlertDialogTitle", () => $8c7baeec26a63e97$export$225e0da62d314b7);
|
|
25
|
+
$parcel$export(module.exports, "AlertDialogDescription", () => $8c7baeec26a63e97$export$a23b55cde55ad9a5);
|
|
26
|
+
$parcel$export(module.exports, "Root", () => $8c7baeec26a63e97$export$be92b6f5f03c0fe9);
|
|
27
|
+
$parcel$export(module.exports, "Trigger", () => $8c7baeec26a63e97$export$41fb9f06171c75f4);
|
|
28
|
+
$parcel$export(module.exports, "Portal", () => $8c7baeec26a63e97$export$602eac185826482c);
|
|
29
|
+
$parcel$export(module.exports, "Overlay", () => $8c7baeec26a63e97$export$c6fdb837b070b4ff);
|
|
30
|
+
$parcel$export(module.exports, "Content", () => $8c7baeec26a63e97$export$7c6e2c02157bb7d2);
|
|
31
|
+
$parcel$export(module.exports, "Action", () => $8c7baeec26a63e97$export$e19cd5f9376f8cee);
|
|
32
|
+
$parcel$export(module.exports, "Cancel", () => $8c7baeec26a63e97$export$848c9b7ead0df967);
|
|
33
|
+
$parcel$export(module.exports, "Title", () => $8c7baeec26a63e97$export$f99233281efd08a0);
|
|
34
|
+
$parcel$export(module.exports, "Description", () => $8c7baeec26a63e97$export$393edc798c47379d);
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/* -------------------------------------------------------------------------------------------------
|
|
44
|
+
* AlertDialog
|
|
45
|
+
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$ROOT_NAME = 'AlertDialog';
|
|
46
|
+
const [$8c7baeec26a63e97$var$createAlertDialogContext, $8c7baeec26a63e97$export$b8891880751c2c5b] = $hLIh8$radixuireactcontext.createContextScope($8c7baeec26a63e97$var$ROOT_NAME, [
|
|
47
|
+
$hLIh8$radixuireactdialog.createDialogScope
|
|
48
|
+
]);
|
|
49
|
+
const $8c7baeec26a63e97$var$useDialogScope = $hLIh8$radixuireactdialog.createDialogScope();
|
|
50
|
+
const $8c7baeec26a63e97$export$de466dd8317b0b75 = (props)=>{
|
|
51
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...alertDialogProps } = props;
|
|
52
|
+
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
|
|
53
|
+
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Root, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, alertDialogProps, {
|
|
54
|
+
modal: true
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$de466dd8317b0b75, {
|
|
58
|
+
displayName: $8c7baeec26a63e97$var$ROOT_NAME
|
|
59
|
+
});
|
|
60
|
+
/* -------------------------------------------------------------------------------------------------
|
|
61
|
+
* AlertDialogTrigger
|
|
62
|
+
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$TRIGGER_NAME = 'AlertDialogTrigger';
|
|
63
|
+
const $8c7baeec26a63e97$export$6edd7a623ef0f40b = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
|
|
64
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...triggerProps } = props;
|
|
65
|
+
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
|
|
66
|
+
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Trigger, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, triggerProps, {
|
|
67
|
+
ref: forwardedRef
|
|
68
|
+
}));
|
|
69
|
+
});
|
|
70
|
+
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$6edd7a623ef0f40b, {
|
|
71
|
+
displayName: $8c7baeec26a63e97$var$TRIGGER_NAME
|
|
72
|
+
});
|
|
73
|
+
/* -------------------------------------------------------------------------------------------------
|
|
74
|
+
* AlertDialogPortal
|
|
75
|
+
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$PORTAL_NAME = 'AlertDialogPortal';
|
|
76
|
+
const $8c7baeec26a63e97$export$660f2bfdb986706c = (props)=>{
|
|
77
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...portalProps } = props;
|
|
78
|
+
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
|
|
79
|
+
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Portal, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, portalProps));
|
|
80
|
+
};
|
|
81
|
+
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$660f2bfdb986706c, {
|
|
82
|
+
displayName: $8c7baeec26a63e97$var$PORTAL_NAME
|
|
83
|
+
});
|
|
84
|
+
/* -------------------------------------------------------------------------------------------------
|
|
85
|
+
* AlertDialogOverlay
|
|
86
|
+
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$OVERLAY_NAME = 'AlertDialogOverlay';
|
|
87
|
+
const $8c7baeec26a63e97$export$a707a4895ce23256 = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
|
|
88
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...overlayProps } = props;
|
|
89
|
+
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
|
|
90
|
+
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Overlay, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, overlayProps, {
|
|
91
|
+
ref: forwardedRef
|
|
92
|
+
}));
|
|
93
|
+
});
|
|
94
|
+
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$a707a4895ce23256, {
|
|
95
|
+
displayName: $8c7baeec26a63e97$var$OVERLAY_NAME
|
|
96
|
+
});
|
|
97
|
+
/* -------------------------------------------------------------------------------------------------
|
|
98
|
+
* AlertDialogContent
|
|
99
|
+
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$CONTENT_NAME = 'AlertDialogContent';
|
|
100
|
+
const [$8c7baeec26a63e97$var$AlertDialogContentProvider, $8c7baeec26a63e97$var$useAlertDialogContentContext] = $8c7baeec26a63e97$var$createAlertDialogContext($8c7baeec26a63e97$var$CONTENT_NAME);
|
|
101
|
+
const $8c7baeec26a63e97$export$94e6af45f0af4efd = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
|
|
102
|
+
const { __scopeAlertDialog: __scopeAlertDialog , children: children , ...contentProps } = props;
|
|
103
|
+
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
|
|
104
|
+
const contentRef = $hLIh8$react.useRef(null);
|
|
105
|
+
const composedRefs = $hLIh8$radixuireactcomposerefs.useComposedRefs(forwardedRef, contentRef);
|
|
106
|
+
const cancelRef = $hLIh8$react.useRef(null);
|
|
107
|
+
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.WarningProvider, {
|
|
108
|
+
contentName: $8c7baeec26a63e97$var$CONTENT_NAME,
|
|
109
|
+
titleName: $8c7baeec26a63e97$var$TITLE_NAME,
|
|
110
|
+
docsSlug: "alert-dialog"
|
|
111
|
+
}, /*#__PURE__*/ $hLIh8$react.createElement($8c7baeec26a63e97$var$AlertDialogContentProvider, {
|
|
112
|
+
scope: __scopeAlertDialog,
|
|
113
|
+
cancelRef: cancelRef
|
|
114
|
+
}, /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Content, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({
|
|
115
|
+
role: "alertdialog"
|
|
116
|
+
}, dialogScope, contentProps, {
|
|
117
|
+
ref: composedRefs,
|
|
118
|
+
onOpenAutoFocus: $hLIh8$radixuiprimitive.composeEventHandlers(contentProps.onOpenAutoFocus, (event)=>{
|
|
119
|
+
var _cancelRef$current;
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
(_cancelRef$current = cancelRef.current) === null || _cancelRef$current === void 0 || _cancelRef$current.focus({
|
|
122
|
+
preventScroll: true
|
|
123
|
+
});
|
|
124
|
+
}),
|
|
125
|
+
onPointerDownOutside: (event)=>event.preventDefault()
|
|
126
|
+
,
|
|
127
|
+
onInteractOutside: (event)=>event.preventDefault()
|
|
128
|
+
}), /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactslot.Slottable, null, children), false)));
|
|
129
|
+
});
|
|
130
|
+
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$94e6af45f0af4efd, {
|
|
131
|
+
displayName: $8c7baeec26a63e97$var$CONTENT_NAME
|
|
132
|
+
});
|
|
133
|
+
/* -------------------------------------------------------------------------------------------------
|
|
134
|
+
* AlertDialogTitle
|
|
135
|
+
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$TITLE_NAME = 'AlertDialogTitle';
|
|
136
|
+
const $8c7baeec26a63e97$export$225e0da62d314b7 = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
|
|
137
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...titleProps } = props;
|
|
138
|
+
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
|
|
139
|
+
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Title, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, titleProps, {
|
|
140
|
+
ref: forwardedRef
|
|
141
|
+
}));
|
|
142
|
+
});
|
|
143
|
+
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$225e0da62d314b7, {
|
|
144
|
+
displayName: $8c7baeec26a63e97$var$TITLE_NAME
|
|
145
|
+
});
|
|
146
|
+
/* -------------------------------------------------------------------------------------------------
|
|
147
|
+
* AlertDialogDescription
|
|
148
|
+
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$DESCRIPTION_NAME = 'AlertDialogDescription';
|
|
149
|
+
const $8c7baeec26a63e97$export$a23b55cde55ad9a5 = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
|
|
150
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...descriptionProps } = props;
|
|
151
|
+
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
|
|
152
|
+
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Description, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, descriptionProps, {
|
|
153
|
+
ref: forwardedRef
|
|
154
|
+
}));
|
|
155
|
+
});
|
|
156
|
+
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$a23b55cde55ad9a5, {
|
|
157
|
+
displayName: $8c7baeec26a63e97$var$DESCRIPTION_NAME
|
|
158
|
+
});
|
|
159
|
+
/* -------------------------------------------------------------------------------------------------
|
|
160
|
+
* AlertDialogAction
|
|
161
|
+
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$ACTION_NAME = 'AlertDialogAction';
|
|
162
|
+
const $8c7baeec26a63e97$export$b454f818c58ee85d = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
|
|
163
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...actionProps } = props;
|
|
164
|
+
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
|
|
165
|
+
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Close, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, actionProps, {
|
|
166
|
+
ref: forwardedRef
|
|
167
|
+
}));
|
|
168
|
+
});
|
|
169
|
+
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$b454f818c58ee85d, {
|
|
170
|
+
displayName: $8c7baeec26a63e97$var$ACTION_NAME
|
|
171
|
+
});
|
|
172
|
+
/* -------------------------------------------------------------------------------------------------
|
|
173
|
+
* AlertDialogCancel
|
|
174
|
+
* -----------------------------------------------------------------------------------------------*/ const $8c7baeec26a63e97$var$CANCEL_NAME = 'AlertDialogCancel';
|
|
175
|
+
const $8c7baeec26a63e97$export$2f67a923571aaea0 = /*#__PURE__*/ $hLIh8$react.forwardRef((props, forwardedRef)=>{
|
|
176
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...cancelProps } = props;
|
|
177
|
+
const { cancelRef: cancelRef } = $8c7baeec26a63e97$var$useAlertDialogContentContext($8c7baeec26a63e97$var$CANCEL_NAME, __scopeAlertDialog);
|
|
178
|
+
const dialogScope = $8c7baeec26a63e97$var$useDialogScope(__scopeAlertDialog);
|
|
179
|
+
const ref = $hLIh8$radixuireactcomposerefs.useComposedRefs(forwardedRef, cancelRef);
|
|
180
|
+
return /*#__PURE__*/ $hLIh8$react.createElement($hLIh8$radixuireactdialog.Close, ($parcel$interopDefault($hLIh8$babelruntimehelpersextends))({}, dialogScope, cancelProps, {
|
|
181
|
+
ref: ref
|
|
182
|
+
}));
|
|
183
|
+
});
|
|
184
|
+
/*#__PURE__*/ Object.assign($8c7baeec26a63e97$export$2f67a923571aaea0, {
|
|
185
|
+
displayName: $8c7baeec26a63e97$var$CANCEL_NAME
|
|
186
|
+
});
|
|
187
|
+
/* ---------------------------------------------------------------------------------------------- */ const $8c7baeec26a63e97$var$DescriptionWarning = ({ contentRef: contentRef })=>{
|
|
188
|
+
const MESSAGE = `\`${$8c7baeec26a63e97$var$CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
189
|
+
|
|
190
|
+
You can add a description to the \`${$8c7baeec26a63e97$var$CONTENT_NAME}\` by passing a \`${$8c7baeec26a63e97$var$DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
191
|
+
|
|
192
|
+
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 \`${$8c7baeec26a63e97$var$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.
|
|
193
|
+
|
|
194
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
|
|
195
|
+
$hLIh8$react.useEffect(()=>{
|
|
196
|
+
var _contentRef$current;
|
|
197
|
+
const hasDescription = document.getElementById((_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.getAttribute('aria-describedby'));
|
|
198
|
+
if (!hasDescription) console.warn(MESSAGE);
|
|
199
|
+
}, [
|
|
200
|
+
MESSAGE,
|
|
201
|
+
contentRef
|
|
202
|
+
]);
|
|
203
|
+
return null;
|
|
204
|
+
};
|
|
205
|
+
const $8c7baeec26a63e97$export$be92b6f5f03c0fe9 = $8c7baeec26a63e97$export$de466dd8317b0b75;
|
|
206
|
+
const $8c7baeec26a63e97$export$41fb9f06171c75f4 = $8c7baeec26a63e97$export$6edd7a623ef0f40b;
|
|
207
|
+
const $8c7baeec26a63e97$export$602eac185826482c = $8c7baeec26a63e97$export$660f2bfdb986706c;
|
|
208
|
+
const $8c7baeec26a63e97$export$c6fdb837b070b4ff = $8c7baeec26a63e97$export$a707a4895ce23256;
|
|
209
|
+
const $8c7baeec26a63e97$export$7c6e2c02157bb7d2 = $8c7baeec26a63e97$export$94e6af45f0af4efd;
|
|
210
|
+
const $8c7baeec26a63e97$export$e19cd5f9376f8cee = $8c7baeec26a63e97$export$b454f818c58ee85d;
|
|
211
|
+
const $8c7baeec26a63e97$export$848c9b7ead0df967 = $8c7baeec26a63e97$export$2f67a923571aaea0;
|
|
212
|
+
const $8c7baeec26a63e97$export$f99233281efd08a0 = $8c7baeec26a63e97$export$225e0da62d314b7;
|
|
213
|
+
const $8c7baeec26a63e97$export$393edc798c47379d = $8c7baeec26a63e97$export$a23b55cde55ad9a5;
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
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2D,GAAgB5D,EACzCG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBuD,MAAjBrD,EAAA,GAA2BL,EAAiByD,EAA5C,CAAyD5C,IAAKH,oCAUzE,MAKMiD,eAAoBnD,EAAMC,YAC9B,CAACZ,EAA4Ca,KAC3C,MAAMZ,mBAAEA,KAAuB8D,GAAgB/D,GACzCgC,UAAEA,GAAcR,EARN,oBAQgDvB,GAC1DE,EAAcL,EAAeG,GAC7Be,EAAMe,EAAgBlB,EAAcmB,gBAC1C,OAAO5B,EAAAC,cAACC,EAAgBuD,MAAjBrD,EAAA,GAA2BL,EAAiB4D,EAA5C,CAAyD/C,IAAKA,oCAYzE,MAmBMT,EAAOR,iBACb,MAAMgB,EAAUL,oBAChB,MAAMS,EAASF,mBACf,MAAMK,EAAUF,oBAChB,MAAMoB,EAAUf,oBAChB,MAAMuC,EAASL,mBACf,MAAMM,EAASH,mBACf,MAAMP,EAAQF,kBACd,MAAMK,EAAcF","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { createDialogScope } from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;\n};\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...triggerProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal';\n\ntype DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Portal {...dialogScope} {...portalProps} />;\n};\n\nAlertDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ntype AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;\ntype DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Overlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ntype DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const contentRef = React.useRef<AlertDialogContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);\n\n return (\n <DialogPrimitive.WarningProvider\n contentName={CONTENT_NAME}\n titleName={TITLE_NAME}\n docsSlug=\"alert-dialog\"\n >\n <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>\n <DialogPrimitive.Content\n role=\"alertdialog\"\n {...dialogScope}\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault();\n cancelRef.current?.focus({ preventScroll: true });\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogPrimitive.Content>\n </AlertDialogContentProvider>\n </DialogPrimitive.WarningProvider>\n );\n }\n);\n\nAlertDialogContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle';\n\ntype AlertDialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;\ntype DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\ninterface AlertDialogTitleProps extends DialogTitleProps {}\n\nconst AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(\n (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...titleProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Title {...dialogScope} {...titleProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription';\n\ntype AlertDialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Description>;\ntype DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;\ninterface AlertDialogDescriptionProps extends DialogDescriptionProps {}\n\nconst AlertDialogDescription = React.forwardRef<\n AlertDialogDescriptionElement,\n AlertDialogDescriptionProps\n>((props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...descriptionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Description {...dialogScope} {...descriptionProps} ref={forwardedRef} />;\n});\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction';\n\ntype AlertDialogActionElement = React.ElementRef<typeof DialogPrimitive.Close>;\ntype DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogActionProps extends DialogCloseProps {}\n\nconst AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(\n (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...actionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Close {...dialogScope} {...actionProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel';\n\ntype AlertDialogCancelElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(\n (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...cancelProps } = props;\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const ref = useComposedRefs(forwardedRef, cancelRef);\n return <DialogPrimitive.Close {...dialogScope} {...cancelProps} ref={ref} />;\n }\n);\n\nAlertDialogCancel.displayName = CANCEL_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<AlertDialogContentElement>;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n const MESSAGE = `\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;\n\n React.useEffect(() => {\n const hasDescription = document.getElementById(\n contentRef.current?.getAttribute('aria-describedby')!\n );\n if (!hasDescription) console.warn(MESSAGE);\n }, [MESSAGE, contentRef]);\n\n return null;\n};\n\nconst Root = AlertDialog;\nconst Trigger = AlertDialogTrigger;\nconst Portal = AlertDialogPortal;\nconst Overlay = AlertDialogOverlay;\nconst Content = AlertDialogContent;\nconst Action = AlertDialogAction;\nconst Cancel = AlertDialogCancel;\nconst Title = AlertDialogTitle;\nconst Description = AlertDialogDescription;\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n};\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n};\n"],"names":["a","__esModule","default","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","createAlertDialogContext","createAlertDialogScope","createContextScope","createDialogScope","useDialogScope","AlertDialog","props","__scopeAlertDialog","alertDialogProps","dialogScope","_react","createElement","_radixUiReactDialog","Root","_babelRuntimeHelpersExtends","modal","AlertDialogTrigger","React","forwardRef","forwardedRef","triggerProps","Trigger","ref","AlertDialogPortal","portalProps","Portal","AlertDialogOverlay","overlayProps","Overlay","AlertDialogContentProvider","useAlertDialogContentContext","AlertDialogContent","children","contentProps","contentRef","useRef","composedRefs","useComposedRefs","cancelRef","WarningProvider","contentName","titleName","TITLE_NAME","docsSlug","$ce6149552ca6be39fd0092c861815af$var$AlertDialogContentProvider","scope","Content","role","onOpenAutoFocus","composeEventHandlers","event","_cancelRef$current","preventDefault","current","focus","preventScroll","onPointerDownOutside","onInteractOutside","Slottable","AlertDialogTitle","titleProps","Title","AlertDialogDescription","descriptionProps","Description","AlertDialogAction","actionProps","Close","AlertDialogCancel","cancelProps","Action","Cancel"],"version":3,"file":"index.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;ACWA;;oGAEA,CAEA,MAAM0B,+BAAS,GAAG,aAAlB,AAAA;AAGA,MAAM,CAACC,8CAAD,EAA2B3B,yCAA3B,CAAA,GAAqDoB,6CAAkB,CAACM,+BAAD,EAAY;IACvFH,2CADuF;CAAZ,CAA7E,AAAA;AAGA,MAAMK,oCAAc,GAAGL,2CAAiB,EAAxC,AAAA;AAKA,MAAMtB,yCAAuC,GAAI4B,CAAAA,KAAD,GAA0C;IACxF,MAAM,E,oBAAEC,kBAAF,CAAA,EAAsB,GAAGC,gBAAH,EAAtB,GAA8CF,KAApD,AAAM;IACN,MAAMG,WAAW,GAAGJ,oCAAc,CAACE,kBAAD,CAAlC,AAAA;IACA,OAAA,aAAO,CAAA,0BAAA,CAAC,8BAAD,EAAA,2DAAA,CAAA,EAAA,EAA0BE,WAA1B,EAA2CD,gBAA3C,EAAP;QAAoE,KAAK,EAAE,IAAP;KAA7D,CAAA,CAAP,CAAO;CAHT,AAIC;AAED,aAAA,CAAA,MAAA,CAAA,MAAA,CAAA,yCAAA,EAAA;IAAA,WAAA,EAAA,+BAAA;CAAA,CAAA,CAAA;AAEA;;oGAEA,CACA,MAAME,kCAAY,GAAG,oBAArB,AAAA;AAMA,MAAM/B,yCAAkB,GAAA,aAAGiB,CAAAA,uBAAA,CACzB,CAACU,KAAD,EAA8CM,YAA9C,GAA+D;IAC7D,MAAM,E,oBAAEL,kBAAF,CAAA,EAAsB,GAAGM,YAAH,EAAtB,GAA0CP,KAAhD,AAAM;IACN,MAAMG,WAAW,GAAGJ,oCAAc,CAACE,kBAAD,CAAlC,AAAA;IACA,OAAA,aAAO,CAAA,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AAO,IAAP,CAAA;CAhBF,AAiBC;AAED,MAAMpC,yCAAI,GAAGT,yCAAb,AAAA;AACA,MAAMU,yCAAO,GAAGT,yCAAhB,AAAA;AACA,MAAMU,yCAAM,GAAGT,yCAAf,AAAA;AACA,MAAMU,yCAAO,GAAGT,yCAAhB,AAAA;AACA,MAAMU,yCAAO,GAAGT,yCAAhB,AAAA;AACA,MAAMU,yCAAM,GAAGT,yCAAf,AAAA;AACA,MAAMU,yCAAM,GAAGT,yCAAf,AAAA;AACA,MAAMU,yCAAK,GAAGT,wCAAd,AAAA;AACA,MAAMU,yCAAW,GAAGT,yCAApB,AAAA;;AD/QA","sources":["packages/react/alert-dialog/src/index.ts","packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["export {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n} from './AlertDialog';\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n} from './AlertDialog';\n","import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { createDialogScope } from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;\n};\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...triggerProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal';\n\ntype DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Portal {...dialogScope} {...portalProps} />;\n};\n\nAlertDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ntype AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;\ntype DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Overlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ntype DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const contentRef = React.useRef<AlertDialogContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);\n\n return (\n <DialogPrimitive.WarningProvider\n contentName={CONTENT_NAME}\n titleName={TITLE_NAME}\n docsSlug=\"alert-dialog\"\n >\n <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>\n <DialogPrimitive.Content\n role=\"alertdialog\"\n {...dialogScope}\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault();\n cancelRef.current?.focus({ preventScroll: true });\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogPrimitive.Content>\n </AlertDialogContentProvider>\n </DialogPrimitive.WarningProvider>\n );\n }\n);\n\nAlertDialogContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle';\n\ntype AlertDialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;\ntype DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\ninterface AlertDialogTitleProps extends DialogTitleProps {}\n\nconst AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(\n (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...titleProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Title {...dialogScope} {...titleProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription';\n\ntype AlertDialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Description>;\ntype DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;\ninterface AlertDialogDescriptionProps extends DialogDescriptionProps {}\n\nconst AlertDialogDescription = React.forwardRef<\n AlertDialogDescriptionElement,\n AlertDialogDescriptionProps\n>((props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...descriptionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Description {...dialogScope} {...descriptionProps} ref={forwardedRef} />;\n});\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction';\n\ntype AlertDialogActionElement = React.ElementRef<typeof DialogPrimitive.Close>;\ntype DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogActionProps extends DialogCloseProps {}\n\nconst AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(\n (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...actionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Close {...dialogScope} {...actionProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel';\n\ntype AlertDialogCancelElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(\n (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...cancelProps } = props;\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const ref = useComposedRefs(forwardedRef, cancelRef);\n return <DialogPrimitive.Close {...dialogScope} {...cancelProps} ref={ref} />;\n }\n);\n\nAlertDialogCancel.displayName = CANCEL_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<AlertDialogContentElement>;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n const MESSAGE = `\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;\n\n React.useEffect(() => {\n const hasDescription = document.getElementById(\n contentRef.current?.getAttribute('aria-describedby')!\n );\n if (!hasDescription) console.warn(MESSAGE);\n }, [MESSAGE, contentRef]);\n\n return null;\n};\n\nconst Root = AlertDialog;\nconst Trigger = AlertDialogTrigger;\nconst Portal = AlertDialogPortal;\nconst Overlay = AlertDialogOverlay;\nconst Content = AlertDialogContent;\nconst Action = AlertDialogAction;\nconst Cancel = AlertDialogCancel;\nconst Title = AlertDialogTitle;\nconst Description = AlertDialogDescription;\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n};\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n};\n"],"names":["createAlertDialogScope","AlertDialog","AlertDialogTrigger","AlertDialogPortal","AlertDialogOverlay","AlertDialogContent","AlertDialogAction","AlertDialogCancel","AlertDialogTitle","AlertDialogDescription","Root","Trigger","Portal","Overlay","Content","Action","Cancel","Title","Description","React","createContextScope","useComposedRefs","DialogPrimitive","createDialogScope","composeEventHandlers","Slottable","ROOT_NAME","createAlertDialogContext","useDialogScope","props","__scopeAlertDialog","alertDialogProps","dialogScope","TRIGGER_NAME","forwardRef","forwardedRef","triggerProps","PORTAL_NAME","portalProps","OVERLAY_NAME","overlayProps","CONTENT_NAME","AlertDialogContentProvider","useAlertDialogContentContext","children","contentProps","contentRef","useRef","composedRefs","cancelRef","TITLE_NAME","onOpenAutoFocus","event","preventDefault","current","focus","preventScroll","process","env","NODE_ENV","titleProps","DESCRIPTION_NAME","descriptionProps","ACTION_NAME","actionProps","CANCEL_NAME","cancelProps","ref","DescriptionWarning","MESSAGE","useEffect","hasDescription","document","getElementById","getAttribute","console","warn"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,193 @@
|
|
|
1
|
-
import
|
|
1
|
+
import $4k4D0$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import {createElement as $4k4D0$createElement, forwardRef as $4k4D0$forwardRef, useRef as $4k4D0$useRef, useEffect as $4k4D0$useEffect} from "react";
|
|
3
|
+
import {createContextScope as $4k4D0$createContextScope} from "@radix-ui/react-context";
|
|
4
|
+
import {useComposedRefs as $4k4D0$useComposedRefs} from "@radix-ui/react-compose-refs";
|
|
5
|
+
import {createDialogScope as $4k4D0$createDialogScope, Root as $4k4D0$Root, Trigger as $4k4D0$Trigger, Portal as $4k4D0$Portal, Overlay as $4k4D0$Overlay, WarningProvider as $4k4D0$WarningProvider, Content as $4k4D0$Content, Title as $4k4D0$Title, Description as $4k4D0$Description, Close as $4k4D0$Close} from "@radix-ui/react-dialog";
|
|
6
|
+
import {composeEventHandlers as $4k4D0$composeEventHandlers} from "@radix-ui/primitive";
|
|
7
|
+
import {Slottable as $4k4D0$Slottable} from "@radix-ui/react-slot";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/* -------------------------------------------------------------------------------------------------
|
|
18
|
+
* AlertDialog
|
|
19
|
+
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$ROOT_NAME = 'AlertDialog';
|
|
20
|
+
const [$905f4ae918aab1aa$var$createAlertDialogContext, $905f4ae918aab1aa$export$b8891880751c2c5b] = $4k4D0$createContextScope($905f4ae918aab1aa$var$ROOT_NAME, [
|
|
21
|
+
$4k4D0$createDialogScope
|
|
22
|
+
]);
|
|
23
|
+
const $905f4ae918aab1aa$var$useDialogScope = $4k4D0$createDialogScope();
|
|
24
|
+
const $905f4ae918aab1aa$export$de466dd8317b0b75 = (props)=>{
|
|
25
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...alertDialogProps } = props;
|
|
26
|
+
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
|
|
27
|
+
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Root, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, alertDialogProps, {
|
|
28
|
+
modal: true
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$de466dd8317b0b75, {
|
|
32
|
+
displayName: $905f4ae918aab1aa$var$ROOT_NAME
|
|
33
|
+
});
|
|
34
|
+
/* -------------------------------------------------------------------------------------------------
|
|
35
|
+
* AlertDialogTrigger
|
|
36
|
+
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$TRIGGER_NAME = 'AlertDialogTrigger';
|
|
37
|
+
const $905f4ae918aab1aa$export$6edd7a623ef0f40b = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
|
|
38
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...triggerProps } = props;
|
|
39
|
+
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
|
|
40
|
+
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Trigger, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, triggerProps, {
|
|
41
|
+
ref: forwardedRef
|
|
42
|
+
}));
|
|
43
|
+
});
|
|
44
|
+
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$6edd7a623ef0f40b, {
|
|
45
|
+
displayName: $905f4ae918aab1aa$var$TRIGGER_NAME
|
|
46
|
+
});
|
|
47
|
+
/* -------------------------------------------------------------------------------------------------
|
|
48
|
+
* AlertDialogPortal
|
|
49
|
+
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$PORTAL_NAME = 'AlertDialogPortal';
|
|
50
|
+
const $905f4ae918aab1aa$export$660f2bfdb986706c = (props)=>{
|
|
51
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...portalProps } = props;
|
|
52
|
+
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
|
|
53
|
+
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Portal, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, portalProps));
|
|
54
|
+
};
|
|
55
|
+
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$660f2bfdb986706c, {
|
|
56
|
+
displayName: $905f4ae918aab1aa$var$PORTAL_NAME
|
|
57
|
+
});
|
|
58
|
+
/* -------------------------------------------------------------------------------------------------
|
|
59
|
+
* AlertDialogOverlay
|
|
60
|
+
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$OVERLAY_NAME = 'AlertDialogOverlay';
|
|
61
|
+
const $905f4ae918aab1aa$export$a707a4895ce23256 = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
|
|
62
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...overlayProps } = props;
|
|
63
|
+
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
|
|
64
|
+
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Overlay, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, overlayProps, {
|
|
65
|
+
ref: forwardedRef
|
|
66
|
+
}));
|
|
67
|
+
});
|
|
68
|
+
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$a707a4895ce23256, {
|
|
69
|
+
displayName: $905f4ae918aab1aa$var$OVERLAY_NAME
|
|
70
|
+
});
|
|
71
|
+
/* -------------------------------------------------------------------------------------------------
|
|
72
|
+
* AlertDialogContent
|
|
73
|
+
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$CONTENT_NAME = 'AlertDialogContent';
|
|
74
|
+
const [$905f4ae918aab1aa$var$AlertDialogContentProvider, $905f4ae918aab1aa$var$useAlertDialogContentContext] = $905f4ae918aab1aa$var$createAlertDialogContext($905f4ae918aab1aa$var$CONTENT_NAME);
|
|
75
|
+
const $905f4ae918aab1aa$export$94e6af45f0af4efd = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
|
|
76
|
+
const { __scopeAlertDialog: __scopeAlertDialog , children: children , ...contentProps } = props;
|
|
77
|
+
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
|
|
78
|
+
const contentRef = $4k4D0$useRef(null);
|
|
79
|
+
const composedRefs = $4k4D0$useComposedRefs(forwardedRef, contentRef);
|
|
80
|
+
const cancelRef = $4k4D0$useRef(null);
|
|
81
|
+
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$WarningProvider, {
|
|
82
|
+
contentName: $905f4ae918aab1aa$var$CONTENT_NAME,
|
|
83
|
+
titleName: $905f4ae918aab1aa$var$TITLE_NAME,
|
|
84
|
+
docsSlug: "alert-dialog"
|
|
85
|
+
}, /*#__PURE__*/ $4k4D0$createElement($905f4ae918aab1aa$var$AlertDialogContentProvider, {
|
|
86
|
+
scope: __scopeAlertDialog,
|
|
87
|
+
cancelRef: cancelRef
|
|
88
|
+
}, /*#__PURE__*/ $4k4D0$createElement($4k4D0$Content, $4k4D0$babelruntimehelpersesmextends({
|
|
89
|
+
role: "alertdialog"
|
|
90
|
+
}, dialogScope, contentProps, {
|
|
91
|
+
ref: composedRefs,
|
|
92
|
+
onOpenAutoFocus: $4k4D0$composeEventHandlers(contentProps.onOpenAutoFocus, (event)=>{
|
|
93
|
+
var _cancelRef$current;
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
(_cancelRef$current = cancelRef.current) === null || _cancelRef$current === void 0 || _cancelRef$current.focus({
|
|
96
|
+
preventScroll: true
|
|
97
|
+
});
|
|
98
|
+
}),
|
|
99
|
+
onPointerDownOutside: (event)=>event.preventDefault()
|
|
100
|
+
,
|
|
101
|
+
onInteractOutside: (event)=>event.preventDefault()
|
|
102
|
+
}), /*#__PURE__*/ $4k4D0$createElement($4k4D0$Slottable, null, children), false)));
|
|
103
|
+
});
|
|
104
|
+
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$94e6af45f0af4efd, {
|
|
105
|
+
displayName: $905f4ae918aab1aa$var$CONTENT_NAME
|
|
106
|
+
});
|
|
107
|
+
/* -------------------------------------------------------------------------------------------------
|
|
108
|
+
* AlertDialogTitle
|
|
109
|
+
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$TITLE_NAME = 'AlertDialogTitle';
|
|
110
|
+
const $905f4ae918aab1aa$export$225e0da62d314b7 = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
|
|
111
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...titleProps } = props;
|
|
112
|
+
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
|
|
113
|
+
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Title, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, titleProps, {
|
|
114
|
+
ref: forwardedRef
|
|
115
|
+
}));
|
|
116
|
+
});
|
|
117
|
+
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$225e0da62d314b7, {
|
|
118
|
+
displayName: $905f4ae918aab1aa$var$TITLE_NAME
|
|
119
|
+
});
|
|
120
|
+
/* -------------------------------------------------------------------------------------------------
|
|
121
|
+
* AlertDialogDescription
|
|
122
|
+
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$DESCRIPTION_NAME = 'AlertDialogDescription';
|
|
123
|
+
const $905f4ae918aab1aa$export$a23b55cde55ad9a5 = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
|
|
124
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...descriptionProps } = props;
|
|
125
|
+
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
|
|
126
|
+
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Description, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, descriptionProps, {
|
|
127
|
+
ref: forwardedRef
|
|
128
|
+
}));
|
|
129
|
+
});
|
|
130
|
+
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$a23b55cde55ad9a5, {
|
|
131
|
+
displayName: $905f4ae918aab1aa$var$DESCRIPTION_NAME
|
|
132
|
+
});
|
|
133
|
+
/* -------------------------------------------------------------------------------------------------
|
|
134
|
+
* AlertDialogAction
|
|
135
|
+
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$ACTION_NAME = 'AlertDialogAction';
|
|
136
|
+
const $905f4ae918aab1aa$export$b454f818c58ee85d = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
|
|
137
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...actionProps } = props;
|
|
138
|
+
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
|
|
139
|
+
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Close, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, actionProps, {
|
|
140
|
+
ref: forwardedRef
|
|
141
|
+
}));
|
|
142
|
+
});
|
|
143
|
+
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$b454f818c58ee85d, {
|
|
144
|
+
displayName: $905f4ae918aab1aa$var$ACTION_NAME
|
|
145
|
+
});
|
|
146
|
+
/* -------------------------------------------------------------------------------------------------
|
|
147
|
+
* AlertDialogCancel
|
|
148
|
+
* -----------------------------------------------------------------------------------------------*/ const $905f4ae918aab1aa$var$CANCEL_NAME = 'AlertDialogCancel';
|
|
149
|
+
const $905f4ae918aab1aa$export$2f67a923571aaea0 = /*#__PURE__*/ $4k4D0$forwardRef((props, forwardedRef)=>{
|
|
150
|
+
const { __scopeAlertDialog: __scopeAlertDialog , ...cancelProps } = props;
|
|
151
|
+
const { cancelRef: cancelRef } = $905f4ae918aab1aa$var$useAlertDialogContentContext($905f4ae918aab1aa$var$CANCEL_NAME, __scopeAlertDialog);
|
|
152
|
+
const dialogScope = $905f4ae918aab1aa$var$useDialogScope(__scopeAlertDialog);
|
|
153
|
+
const ref = $4k4D0$useComposedRefs(forwardedRef, cancelRef);
|
|
154
|
+
return /*#__PURE__*/ $4k4D0$createElement($4k4D0$Close, $4k4D0$babelruntimehelpersesmextends({}, dialogScope, cancelProps, {
|
|
155
|
+
ref: ref
|
|
156
|
+
}));
|
|
157
|
+
});
|
|
158
|
+
/*#__PURE__*/ Object.assign($905f4ae918aab1aa$export$2f67a923571aaea0, {
|
|
159
|
+
displayName: $905f4ae918aab1aa$var$CANCEL_NAME
|
|
160
|
+
});
|
|
161
|
+
/* ---------------------------------------------------------------------------------------------- */ const $905f4ae918aab1aa$var$DescriptionWarning = ({ contentRef: contentRef })=>{
|
|
162
|
+
const MESSAGE = `\`${$905f4ae918aab1aa$var$CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
163
|
+
|
|
164
|
+
You can add a description to the \`${$905f4ae918aab1aa$var$CONTENT_NAME}\` by passing a \`${$905f4ae918aab1aa$var$DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
165
|
+
|
|
166
|
+
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 \`${$905f4ae918aab1aa$var$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.
|
|
167
|
+
|
|
168
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
|
|
169
|
+
$4k4D0$useEffect(()=>{
|
|
170
|
+
var _contentRef$current;
|
|
171
|
+
const hasDescription = document.getElementById((_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.getAttribute('aria-describedby'));
|
|
172
|
+
if (!hasDescription) console.warn(MESSAGE);
|
|
173
|
+
}, [
|
|
174
|
+
MESSAGE,
|
|
175
|
+
contentRef
|
|
176
|
+
]);
|
|
177
|
+
return null;
|
|
178
|
+
};
|
|
179
|
+
const $905f4ae918aab1aa$export$be92b6f5f03c0fe9 = $905f4ae918aab1aa$export$de466dd8317b0b75;
|
|
180
|
+
const $905f4ae918aab1aa$export$41fb9f06171c75f4 = $905f4ae918aab1aa$export$6edd7a623ef0f40b;
|
|
181
|
+
const $905f4ae918aab1aa$export$602eac185826482c = $905f4ae918aab1aa$export$660f2bfdb986706c;
|
|
182
|
+
const $905f4ae918aab1aa$export$c6fdb837b070b4ff = $905f4ae918aab1aa$export$a707a4895ce23256;
|
|
183
|
+
const $905f4ae918aab1aa$export$7c6e2c02157bb7d2 = $905f4ae918aab1aa$export$94e6af45f0af4efd;
|
|
184
|
+
const $905f4ae918aab1aa$export$e19cd5f9376f8cee = $905f4ae918aab1aa$export$b454f818c58ee85d;
|
|
185
|
+
const $905f4ae918aab1aa$export$848c9b7ead0df967 = $905f4ae918aab1aa$export$2f67a923571aaea0;
|
|
186
|
+
const $905f4ae918aab1aa$export$f99233281efd08a0 = $905f4ae918aab1aa$export$225e0da62d314b7;
|
|
187
|
+
const $905f4ae918aab1aa$export$393edc798c47379d = $905f4ae918aab1aa$export$a23b55cde55ad9a5;
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
export {$905f4ae918aab1aa$export$b8891880751c2c5b as createAlertDialogScope, $905f4ae918aab1aa$export$de466dd8317b0b75 as AlertDialog, $905f4ae918aab1aa$export$6edd7a623ef0f40b as AlertDialogTrigger, $905f4ae918aab1aa$export$660f2bfdb986706c as AlertDialogPortal, $905f4ae918aab1aa$export$a707a4895ce23256 as AlertDialogOverlay, $905f4ae918aab1aa$export$94e6af45f0af4efd as AlertDialogContent, $905f4ae918aab1aa$export$b454f818c58ee85d as AlertDialogAction, $905f4ae918aab1aa$export$2f67a923571aaea0 as AlertDialogCancel, $905f4ae918aab1aa$export$225e0da62d314b7 as AlertDialogTitle, $905f4ae918aab1aa$export$a23b55cde55ad9a5 as AlertDialogDescription, $905f4ae918aab1aa$export$be92b6f5f03c0fe9 as Root, $905f4ae918aab1aa$export$41fb9f06171c75f4 as Trigger, $905f4ae918aab1aa$export$602eac185826482c as Portal, $905f4ae918aab1aa$export$c6fdb837b070b4ff as Overlay, $905f4ae918aab1aa$export$7c6e2c02157bb7d2 as Content, $905f4ae918aab1aa$export$e19cd5f9376f8cee as Action, $905f4ae918aab1aa$export$848c9b7ead0df967 as Cancel, $905f4ae918aab1aa$export$f99233281efd08a0 as Title, $905f4ae918aab1aa$export$393ed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EA,KAAuB8D,GAAgB/D,GACzCgC,UAAEA,GAAcR,EARN,oBAQgDvB,GAC1DE,EAAcL,EAAeG,GAC7Be,EAAMe,EAAgBlB,EAAcmB,gBAC1C,OAAO5B,EAAAC,cAACC,EAAgBuD,MAAjBrD,EAAA,GAA2BL,EAAiB4D,EAA5C,CAAyD/C,IAAKA,4BA+BzE,MAAMT,KAAOR,mBACb,MAAMgB,QAAUL,0BAChB,MAAMS,OAASF,yBACf,MAAMK,QAAUF,0BAChB,MAAMoB,QAAUf,0BAChB,MAAMuC,OAASL,yBACf,MAAMM,OAASH,yBACf,MAAMP,MAAQF,wBACd,MAAMK,YAAcF","sources":["./packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { createDialogScope } from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;\n};\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...triggerProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal';\n\ntype DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Portal {...dialogScope} {...portalProps} />;\n};\n\nAlertDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ntype AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;\ntype DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Overlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ntype DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const contentRef = React.useRef<AlertDialogContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);\n\n return (\n <DialogPrimitive.WarningProvider\n contentName={CONTENT_NAME}\n titleName={TITLE_NAME}\n docsSlug=\"alert-dialog\"\n >\n <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>\n <DialogPrimitive.Content\n role=\"alertdialog\"\n {...dialogScope}\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault();\n cancelRef.current?.focus({ preventScroll: true });\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogPrimitive.Content>\n </AlertDialogContentProvider>\n </DialogPrimitive.WarningProvider>\n );\n }\n);\n\nAlertDialogContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle';\n\ntype AlertDialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;\ntype DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\ninterface AlertDialogTitleProps extends DialogTitleProps {}\n\nconst AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(\n (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...titleProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Title {...dialogScope} {...titleProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription';\n\ntype AlertDialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Description>;\ntype DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;\ninterface AlertDialogDescriptionProps extends DialogDescriptionProps {}\n\nconst AlertDialogDescription = React.forwardRef<\n AlertDialogDescriptionElement,\n AlertDialogDescriptionProps\n>((props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...descriptionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Description {...dialogScope} {...descriptionProps} ref={forwardedRef} />;\n});\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction';\n\ntype AlertDialogActionElement = React.ElementRef<typeof DialogPrimitive.Close>;\ntype DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogActionProps extends DialogCloseProps {}\n\nconst AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(\n (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...actionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Close {...dialogScope} {...actionProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel';\n\ntype AlertDialogCancelElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(\n (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...cancelProps } = props;\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const ref = useComposedRefs(forwardedRef, cancelRef);\n return <DialogPrimitive.Close {...dialogScope} {...cancelProps} ref={ref} />;\n }\n);\n\nAlertDialogCancel.displayName = CANCEL_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<AlertDialogContentElement>;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n const MESSAGE = `\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;\n\n React.useEffect(() => {\n const hasDescription = document.getElementById(\n contentRef.current?.getAttribute('aria-describedby')!\n );\n if (!hasDescription) console.warn(MESSAGE);\n }, [MESSAGE, contentRef]);\n\n return null;\n};\n\nconst Root = AlertDialog;\nconst Trigger = AlertDialogTrigger;\nconst Portal = AlertDialogPortal;\nconst Overlay = AlertDialogOverlay;\nconst Content = AlertDialogContent;\nconst Action = AlertDialogAction;\nconst Cancel = AlertDialogCancel;\nconst Title = AlertDialogTitle;\nconst Description = AlertDialogDescription;\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n};\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n};\n"],"names":["createAlertDialogContext","createAlertDialogScope","createContextScope","createDialogScope","useDialogScope","AlertDialog","props","__scopeAlertDialog","alertDialogProps","dialogScope","_react","createElement","_radixUiReactDialog","Root","_babelRuntimeHelpersEsmExtends","modal","AlertDialogTrigger","React","forwardRef","forwardedRef","triggerProps","Trigger","ref","AlertDialogPortal","portalProps","Portal","AlertDialogOverlay","overlayProps","Overlay","AlertDialogContentProvider","useAlertDialogContentContext","AlertDialogContent","children","contentProps","contentRef","useRef","composedRefs","useComposedRefs","cancelRef","WarningProvider","contentName","titleName","TITLE_NAME","docsSlug","$ef785a422a78f23629aa4850fe3fc$var$AlertDialogContentProvider","scope","Content","role","onOpenAutoFocus","composeEventHandlers","event","_cancelRef$current","preventDefault","current","focus","preventScroll","onPointerDownOutside","onInteractOutside","Slottable","AlertDialogTitle","titleProps","Title","AlertDialogDescription","descriptionProps","Description","AlertDialogAction","actionProps","Close","AlertDialogCancel","cancelProps","Action","Cancel"],"version":3,"file":"index.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;A;;;;;;;;ACWA;;oGAEA,CAEA,MAAM0B,+BAAS,GAAG,aAAlB,AAAA;AAGA,MAAM,CAACC,8CAAD,EAA2B3B,yCAA3B,CAAA,GAAqDoB,yBAAkB,CAACM,+BAAD,EAAY;IACvFH,wBADuF;CAAZ,CAA7E,AAAA;AAGA,MAAMK,oCAAc,GAAGL,wBAAiB,EAAxC,AAAA;AAKA,MAAMtB,yCAAuC,GAAI4B,CAAAA,KAAD,GAA0C;IACxF,MAAM,E,oBAAEC,kBAAF,CAAA,EAAsB,GAAGC,gBAAH,EAAtB,GAA8CF,KAApD,AAAM;IACN,MAAMG,WAAW,GAAGJ,oCAAc,CAACE,kBAAD,CAAlC,AAAA;IACA,OAAA,aAAO,CAAA,oBAAA,CAAC,WAAD,EAAA,oCAAA,CAAA,EAAA,EAA0BE,WAA1B,EAA2CD,gBAA3C,EAAP;QAAoE,KAAK,EAAE,IAAP;KAA7D,CAAA,CAAP,CAAO;CAHT,AAIC;AAED,aAAA,CAAA,MAAA,CAAA,MAAA,CAAA,yCAAA,EAAA;IAAA,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,QAAQ,CAACC,cAAT,CAAA,AAAA,CAAA,mBAAA,GACrB3B,UAAU,CAACQ,OADU,CAAA,KAAA,IAAA,IAAA,mBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GACrB,mBAAA,CAAoBoB,YAApB,CAAiC,kBAAjC,CADqB,CAAvB,AAAA;QAGA,IAAI,CAACH,cAAL,EAAqBI,OAAO,CAACC,IAAR,CAAaP,OAAb,CAArB,CAAA;KAJF,EAKG;QAACA,OAAD;QAAUvB,UAAV;KALH,CAKC,CAAA;IAED,OAAO,IAAP,CAAA;CAhBF,AAiBC;AAED,MAAMpC,yCAAI,GAAGT,yCAAb,AAAA;AACA,MAAMU,yCAAO,GAAGT,yCAAhB,AAAA;AACA,MAAMU,yCAAM,GAAGT,yCAAf,AAAA;AACA,MAAMU,yCAAO,GAAGT,yCAAhB,AAAA;AACA,MAAMU,yCAAO,GAAGT,yCAAhB,AAAA;AACA,MAAMU,yCAAM,GAAGT,yCAAf,AAAA;AACA,MAAMU,yCAAM,GAAGT,yCAAf,AAAA;AACA,MAAMU,yCAAK,GAAGT,wCAAd,AAAA;AACA,MAAMU,yCAAW,GAAGT,yCAApB,AAAA;;AD/QA","sources":["packages/react/alert-dialog/src/index.ts","packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["export {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n} from './AlertDialog';\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n} from './AlertDialog';\n","import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { createDialogScope } from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;\n};\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...triggerProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal';\n\ntype DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Portal {...dialogScope} {...portalProps} />;\n};\n\nAlertDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ntype AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;\ntype DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Overlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ntype DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const contentRef = React.useRef<AlertDialogContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);\n\n return (\n <DialogPrimitive.WarningProvider\n contentName={CONTENT_NAME}\n titleName={TITLE_NAME}\n docsSlug=\"alert-dialog\"\n >\n <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>\n <DialogPrimitive.Content\n role=\"alertdialog\"\n {...dialogScope}\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault();\n cancelRef.current?.focus({ preventScroll: true });\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogPrimitive.Content>\n </AlertDialogContentProvider>\n </DialogPrimitive.WarningProvider>\n );\n }\n);\n\nAlertDialogContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle';\n\ntype AlertDialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;\ntype DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\ninterface AlertDialogTitleProps extends DialogTitleProps {}\n\nconst AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(\n (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...titleProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Title {...dialogScope} {...titleProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription';\n\ntype AlertDialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Description>;\ntype DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;\ninterface AlertDialogDescriptionProps extends DialogDescriptionProps {}\n\nconst AlertDialogDescription = React.forwardRef<\n AlertDialogDescriptionElement,\n AlertDialogDescriptionProps\n>((props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...descriptionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Description {...dialogScope} {...descriptionProps} ref={forwardedRef} />;\n});\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction';\n\ntype AlertDialogActionElement = React.ElementRef<typeof DialogPrimitive.Close>;\ntype DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogActionProps extends DialogCloseProps {}\n\nconst AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(\n (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...actionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Close {...dialogScope} {...actionProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel';\n\ntype AlertDialogCancelElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(\n (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...cancelProps } = props;\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const ref = useComposedRefs(forwardedRef, cancelRef);\n return <DialogPrimitive.Close {...dialogScope} {...cancelProps} ref={ref} />;\n }\n);\n\nAlertDialogCancel.displayName = CANCEL_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<AlertDialogContentElement>;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n const MESSAGE = `\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;\n\n React.useEffect(() => {\n const hasDescription = document.getElementById(\n contentRef.current?.getAttribute('aria-describedby')!\n );\n if (!hasDescription) console.warn(MESSAGE);\n }, [MESSAGE, contentRef]);\n\n return null;\n};\n\nconst Root = AlertDialog;\nconst Trigger = AlertDialogTrigger;\nconst Portal = AlertDialogPortal;\nconst Overlay = AlertDialogOverlay;\nconst Content = AlertDialogContent;\nconst Action = AlertDialogAction;\nconst Cancel = AlertDialogCancel;\nconst Title = AlertDialogTitle;\nconst Description = AlertDialogDescription;\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n};\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n};\n"],"names":["createAlertDialogScope","AlertDialog","AlertDialogTrigger","AlertDialogPortal","AlertDialogOverlay","AlertDialogContent","AlertDialogAction","AlertDialogCancel","AlertDialogTitle","AlertDialogDescription","Root","Trigger","Portal","Overlay","Content","Action","Cancel","Title","Description","React","createContextScope","useComposedRefs","DialogPrimitive","createDialogScope","composeEventHandlers","Slottable","ROOT_NAME","createAlertDialogContext","useDialogScope","props","__scopeAlertDialog","alertDialogProps","dialogScope","TRIGGER_NAME","forwardRef","forwardedRef","triggerProps","PORTAL_NAME","portalProps","OVERLAY_NAME","overlayProps","CONTENT_NAME","AlertDialogContentProvider","useAlertDialogContentContext","children","contentProps","contentRef","useRef","composedRefs","cancelRef","TITLE_NAME","onOpenAutoFocus","event","preventDefault","current","focus","preventScroll","process","env","NODE_ENV","titleProps","DESCRIPTION_NAME","descriptionProps","ACTION_NAME","actionProps","CANCEL_NAME","cancelProps","ref","DescriptionWarning","MESSAGE","useEffect","hasDescription","document","getElementById","getAttribute","console","warn"],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-alert-dialog",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.13.10",
|
|
20
|
-
"@radix-ui/primitive": "0.1
|
|
21
|
-
"@radix-ui/react-compose-refs": "0.1
|
|
22
|
-
"@radix-ui/react-context": "0.
|
|
23
|
-
"@radix-ui/react-dialog": "0.
|
|
24
|
-
"@radix-ui/react-primitive": "0.1
|
|
25
|
-
"@radix-ui/react-slot": "0.1
|
|
20
|
+
"@radix-ui/primitive": "1.0.0-rc.1",
|
|
21
|
+
"@radix-ui/react-compose-refs": "1.0.0-rc.1",
|
|
22
|
+
"@radix-ui/react-context": "1.0.0-rc.1",
|
|
23
|
+
"@radix-ui/react-dialog": "1.0.0-rc.1",
|
|
24
|
+
"@radix-ui/react-primitive": "1.0.0-rc.1",
|
|
25
|
+
"@radix-ui/react-slot": "1.0.0-rc.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"react": "
|
|
29
|
-
"react-dom": "^16.8 || ^17.0"
|
|
28
|
+
"react": "^16.8 || ^17.0 || ^18.0",
|
|
29
|
+
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://radix-ui.com/primitives",
|
|
32
32
|
"repository": {
|
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
AlertDialog,
|
|
4
|
-
AlertDialogTrigger,
|
|
5
|
-
AlertDialogPortal,
|
|
6
|
-
AlertDialogOverlay,
|
|
7
|
-
AlertDialogContent,
|
|
8
|
-
AlertDialogTitle,
|
|
9
|
-
AlertDialogDescription,
|
|
10
|
-
AlertDialogAction,
|
|
11
|
-
AlertDialogCancel,
|
|
12
|
-
} from './AlertDialog';
|
|
13
2
|
import { css } from '../../../../stitches.config';
|
|
3
|
+
import * as AlertDialog from '@radix-ui/react-alert-dialog';
|
|
14
4
|
|
|
15
5
|
export default { title: 'Components/AlertDialog' };
|
|
16
6
|
|
|
17
7
|
export const Styled = () => (
|
|
18
|
-
<AlertDialog>
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<
|
|
8
|
+
<AlertDialog.Root>
|
|
9
|
+
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
|
|
10
|
+
<AlertDialog.Portal>
|
|
11
|
+
<AlertDialog.Overlay className={overlayClass()} />
|
|
12
|
+
<AlertDialog.Content className={contentClass()}>
|
|
13
|
+
<AlertDialog.Title className={titleClass()}>Are you sure?</AlertDialog.Title>
|
|
14
|
+
<AlertDialog.Description className={descriptionClass()}>
|
|
25
15
|
This will do a very dangerous thing. Thar be dragons!
|
|
26
|
-
</
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
</
|
|
30
|
-
</
|
|
31
|
-
</AlertDialog>
|
|
16
|
+
</AlertDialog.Description>
|
|
17
|
+
<AlertDialog.Action className={actionClass()}>yolo, do it</AlertDialog.Action>
|
|
18
|
+
<AlertDialog.Cancel className={cancelClass()}>maybe not</AlertDialog.Cancel>
|
|
19
|
+
</AlertDialog.Content>
|
|
20
|
+
</AlertDialog.Portal>
|
|
21
|
+
</AlertDialog.Root>
|
|
32
22
|
);
|
|
33
23
|
|
|
34
24
|
export const Controlled = () => {
|
|
@@ -40,8 +30,8 @@ export const Controlled = () => {
|
|
|
40
30
|
<div>
|
|
41
31
|
<img src="https://i.ibb.co/K54hsKt/house.jpg" alt="a large white house with a red roof" />
|
|
42
32
|
</div>
|
|
43
|
-
<AlertDialog open={open} onOpenChange={setOpen}>
|
|
44
|
-
<
|
|
33
|
+
<AlertDialog.Root open={open} onOpenChange={setOpen}>
|
|
34
|
+
<AlertDialog.Trigger
|
|
45
35
|
onClick={(e) => {
|
|
46
36
|
if (housePurchased) {
|
|
47
37
|
e.preventDefault();
|
|
@@ -50,24 +40,24 @@ export const Controlled = () => {
|
|
|
50
40
|
}}
|
|
51
41
|
>
|
|
52
42
|
{housePurchased ? 'You bought the house! Sell it!' : 'Buy this house'}
|
|
53
|
-
</
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
<
|
|
58
|
-
<
|
|
43
|
+
</AlertDialog.Trigger>
|
|
44
|
+
<AlertDialog.Portal>
|
|
45
|
+
<AlertDialog.Overlay className={overlayClass()} />
|
|
46
|
+
<AlertDialog.Content className={contentClass()}>
|
|
47
|
+
<AlertDialog.Title>Are you sure?</AlertDialog.Title>
|
|
48
|
+
<AlertDialog.Description>
|
|
59
49
|
Houses are very expensive and it looks like you only have €20 in the bank. Maybe
|
|
60
50
|
consult with a financial advisor?
|
|
61
|
-
</
|
|
62
|
-
<
|
|
51
|
+
</AlertDialog.Description>
|
|
52
|
+
<AlertDialog.Action className={actionClass()} onClick={() => setHousePurchased(true)}>
|
|
63
53
|
buy it anyway
|
|
64
|
-
</
|
|
65
|
-
<
|
|
54
|
+
</AlertDialog.Action>
|
|
55
|
+
<AlertDialog.Cancel className={cancelClass()}>
|
|
66
56
|
good point, I'll reconsider
|
|
67
|
-
</
|
|
68
|
-
</
|
|
69
|
-
</
|
|
70
|
-
</AlertDialog>
|
|
57
|
+
</AlertDialog.Cancel>
|
|
58
|
+
</AlertDialog.Content>
|
|
59
|
+
</AlertDialog.Portal>
|
|
60
|
+
</AlertDialog.Root>
|
|
71
61
|
</div>
|
|
72
62
|
);
|
|
73
63
|
};
|
|
@@ -84,188 +74,200 @@ export const Chromatic = () => (
|
|
|
84
74
|
<div>
|
|
85
75
|
<h1>Uncontrolled</h1>
|
|
86
76
|
<h2>Closed</h2>
|
|
87
|
-
<AlertDialog>
|
|
88
|
-
<
|
|
89
|
-
<
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
<
|
|
93
|
-
<
|
|
77
|
+
<AlertDialog.Root>
|
|
78
|
+
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
|
|
79
|
+
<AlertDialog.Portal>
|
|
80
|
+
<AlertDialog.Overlay className={overlayClass()} />
|
|
81
|
+
<AlertDialog.Content className={chromaticContentClass()}>
|
|
82
|
+
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
|
|
83
|
+
<AlertDialog.Description className={descriptionClass()}>
|
|
94
84
|
Description
|
|
95
|
-
</
|
|
96
|
-
<
|
|
97
|
-
<
|
|
98
|
-
</
|
|
99
|
-
</
|
|
100
|
-
</AlertDialog>
|
|
85
|
+
</AlertDialog.Description>
|
|
86
|
+
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
|
|
87
|
+
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
|
|
88
|
+
</AlertDialog.Content>
|
|
89
|
+
</AlertDialog.Portal>
|
|
90
|
+
</AlertDialog.Root>
|
|
101
91
|
|
|
102
92
|
<h2>Open</h2>
|
|
103
|
-
<AlertDialog defaultOpen>
|
|
104
|
-
<
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
className={overlayClass}
|
|
93
|
+
<AlertDialog.Root defaultOpen>
|
|
94
|
+
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
|
|
95
|
+
<AlertDialog.Portal>
|
|
96
|
+
<AlertDialog.Overlay
|
|
97
|
+
className={overlayClass()}
|
|
108
98
|
style={{ left: 0, bottom: '50%', width: '25%' }}
|
|
109
99
|
/>
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
100
|
+
<AlertDialog.Content
|
|
101
|
+
className={chromaticContentClass()}
|
|
102
|
+
style={{ top: '25%', left: '12%' }}
|
|
103
|
+
>
|
|
104
|
+
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
|
|
105
|
+
<AlertDialog.Description className={descriptionClass()}>
|
|
113
106
|
Description
|
|
114
|
-
</
|
|
115
|
-
<
|
|
116
|
-
<
|
|
117
|
-
</
|
|
118
|
-
</
|
|
119
|
-
</AlertDialog>
|
|
107
|
+
</AlertDialog.Description>
|
|
108
|
+
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
|
|
109
|
+
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
|
|
110
|
+
</AlertDialog.Content>
|
|
111
|
+
</AlertDialog.Portal>
|
|
112
|
+
</AlertDialog.Root>
|
|
120
113
|
</div>
|
|
121
114
|
|
|
122
115
|
<div>
|
|
123
116
|
<h1>Uncontrolled with reordered parts</h1>
|
|
124
117
|
<h2>Closed</h2>
|
|
125
|
-
<AlertDialog>
|
|
126
|
-
<
|
|
127
|
-
<
|
|
128
|
-
<
|
|
129
|
-
<
|
|
130
|
-
<
|
|
118
|
+
<AlertDialog.Root>
|
|
119
|
+
<AlertDialog.Portal>
|
|
120
|
+
<AlertDialog.Overlay className={overlayClass()} />
|
|
121
|
+
<AlertDialog.Content className={chromaticContentClass()}>
|
|
122
|
+
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
|
|
123
|
+
<AlertDialog.Description className={descriptionClass()}>
|
|
131
124
|
Description
|
|
132
|
-
</
|
|
133
|
-
<
|
|
134
|
-
<
|
|
135
|
-
</
|
|
136
|
-
</
|
|
137
|
-
<
|
|
138
|
-
</AlertDialog>
|
|
125
|
+
</AlertDialog.Description>
|
|
126
|
+
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
|
|
127
|
+
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
|
|
128
|
+
</AlertDialog.Content>
|
|
129
|
+
</AlertDialog.Portal>
|
|
130
|
+
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
|
|
131
|
+
</AlertDialog.Root>
|
|
139
132
|
|
|
140
133
|
<h2>Open</h2>
|
|
141
|
-
<AlertDialog defaultOpen>
|
|
142
|
-
<
|
|
143
|
-
<
|
|
144
|
-
className={overlayClass}
|
|
134
|
+
<AlertDialog.Root defaultOpen>
|
|
135
|
+
<AlertDialog.Portal>
|
|
136
|
+
<AlertDialog.Overlay
|
|
137
|
+
className={overlayClass()}
|
|
145
138
|
style={{ left: '25%', bottom: '50%', width: '25%' }}
|
|
146
139
|
/>
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
140
|
+
<AlertDialog.Content
|
|
141
|
+
className={chromaticContentClass()}
|
|
142
|
+
style={{ top: '25%', left: '37%' }}
|
|
143
|
+
>
|
|
144
|
+
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
|
|
145
|
+
<AlertDialog.Description className={descriptionClass()}>
|
|
150
146
|
Description
|
|
151
|
-
</
|
|
152
|
-
<
|
|
153
|
-
<
|
|
154
|
-
</
|
|
155
|
-
</
|
|
156
|
-
<
|
|
157
|
-
</AlertDialog>
|
|
147
|
+
</AlertDialog.Description>
|
|
148
|
+
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
|
|
149
|
+
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
|
|
150
|
+
</AlertDialog.Content>
|
|
151
|
+
</AlertDialog.Portal>
|
|
152
|
+
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
|
|
153
|
+
</AlertDialog.Root>
|
|
158
154
|
</div>
|
|
159
155
|
|
|
160
156
|
<div>
|
|
161
157
|
<h1>Controlled</h1>
|
|
162
158
|
<h2>Closed</h2>
|
|
163
|
-
<AlertDialog open={false}>
|
|
164
|
-
<
|
|
165
|
-
<
|
|
166
|
-
<
|
|
167
|
-
<
|
|
168
|
-
<
|
|
169
|
-
<
|
|
159
|
+
<AlertDialog.Root open={false}>
|
|
160
|
+
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
|
|
161
|
+
<AlertDialog.Portal>
|
|
162
|
+
<AlertDialog.Overlay className={overlayClass()} />
|
|
163
|
+
<AlertDialog.Content className={chromaticContentClass()}>
|
|
164
|
+
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
|
|
165
|
+
<AlertDialog.Description className={descriptionClass()}>
|
|
170
166
|
Description
|
|
171
|
-
</
|
|
172
|
-
<
|
|
173
|
-
<
|
|
174
|
-
</
|
|
175
|
-
</
|
|
176
|
-
</AlertDialog>
|
|
167
|
+
</AlertDialog.Description>
|
|
168
|
+
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
|
|
169
|
+
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
|
|
170
|
+
</AlertDialog.Content>
|
|
171
|
+
</AlertDialog.Portal>
|
|
172
|
+
</AlertDialog.Root>
|
|
177
173
|
|
|
178
174
|
<h2>Open</h2>
|
|
179
|
-
<AlertDialog open>
|
|
180
|
-
<
|
|
181
|
-
<
|
|
182
|
-
<
|
|
183
|
-
className={overlayClass}
|
|
175
|
+
<AlertDialog.Root open>
|
|
176
|
+
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
|
|
177
|
+
<AlertDialog.Portal>
|
|
178
|
+
<AlertDialog.Overlay
|
|
179
|
+
className={overlayClass()}
|
|
184
180
|
style={{ left: '50%', bottom: '50%', width: '25%' }}
|
|
185
181
|
/>
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
<AlertDialog.Content
|
|
183
|
+
className={chromaticContentClass()}
|
|
184
|
+
style={{ top: '25%', left: '62%' }}
|
|
185
|
+
>
|
|
186
|
+
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
|
|
187
|
+
<AlertDialog.Description className={descriptionClass()}>
|
|
189
188
|
Description
|
|
190
|
-
</
|
|
191
|
-
<
|
|
192
|
-
<
|
|
193
|
-
</
|
|
194
|
-
</
|
|
195
|
-
</AlertDialog>
|
|
189
|
+
</AlertDialog.Description>
|
|
190
|
+
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
|
|
191
|
+
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
|
|
192
|
+
</AlertDialog.Content>
|
|
193
|
+
</AlertDialog.Portal>
|
|
194
|
+
</AlertDialog.Root>
|
|
196
195
|
</div>
|
|
197
196
|
|
|
198
197
|
<div>
|
|
199
198
|
<h1>Controlled with reordered parts</h1>
|
|
200
199
|
<h2>Closed</h2>
|
|
201
|
-
<AlertDialog open={false}>
|
|
202
|
-
<
|
|
203
|
-
<
|
|
204
|
-
<
|
|
205
|
-
<
|
|
206
|
-
<
|
|
200
|
+
<AlertDialog.Root open={false}>
|
|
201
|
+
<AlertDialog.Portal>
|
|
202
|
+
<AlertDialog.Overlay className={overlayClass()} />
|
|
203
|
+
<AlertDialog.Content className={chromaticContentClass()}>
|
|
204
|
+
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
|
|
205
|
+
<AlertDialog.Description className={descriptionClass()}>
|
|
207
206
|
Description
|
|
208
|
-
</
|
|
209
|
-
<
|
|
210
|
-
<
|
|
211
|
-
</
|
|
212
|
-
</
|
|
213
|
-
<
|
|
214
|
-
</AlertDialog>
|
|
207
|
+
</AlertDialog.Description>
|
|
208
|
+
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
|
|
209
|
+
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
|
|
210
|
+
</AlertDialog.Content>
|
|
211
|
+
</AlertDialog.Portal>
|
|
212
|
+
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
|
|
213
|
+
</AlertDialog.Root>
|
|
215
214
|
|
|
216
215
|
<h2>Open</h2>
|
|
217
|
-
<AlertDialog open>
|
|
218
|
-
<
|
|
219
|
-
<
|
|
220
|
-
className={overlayClass}
|
|
216
|
+
<AlertDialog.Root open>
|
|
217
|
+
<AlertDialog.Portal>
|
|
218
|
+
<AlertDialog.Overlay
|
|
219
|
+
className={overlayClass()}
|
|
221
220
|
style={{ left: '75%', bottom: '50%', width: '25%' }}
|
|
222
221
|
/>
|
|
223
|
-
<
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
<AlertDialog.Content
|
|
223
|
+
className={chromaticContentClass()}
|
|
224
|
+
style={{ top: '25%', left: '88%' }}
|
|
225
|
+
>
|
|
226
|
+
<AlertDialog.Title className={titleClass()}>Title</AlertDialog.Title>
|
|
227
|
+
<AlertDialog.Description className={descriptionClass()}>
|
|
226
228
|
Description
|
|
227
|
-
</
|
|
228
|
-
<
|
|
229
|
-
<
|
|
230
|
-
</
|
|
231
|
-
</
|
|
232
|
-
<
|
|
233
|
-
</AlertDialog>
|
|
229
|
+
</AlertDialog.Description>
|
|
230
|
+
<AlertDialog.Action className={actionClass()}>Confirm</AlertDialog.Action>
|
|
231
|
+
<AlertDialog.Cancel className={cancelClass()}>Cancel</AlertDialog.Cancel>
|
|
232
|
+
</AlertDialog.Content>
|
|
233
|
+
</AlertDialog.Portal>
|
|
234
|
+
<AlertDialog.Trigger className={triggerClass()}>delete everything</AlertDialog.Trigger>
|
|
235
|
+
</AlertDialog.Root>
|
|
234
236
|
</div>
|
|
235
237
|
|
|
236
238
|
<div>
|
|
237
239
|
<h1>State attributes</h1>
|
|
238
240
|
<h2>Closed</h2>
|
|
239
|
-
<AlertDialog>
|
|
240
|
-
<
|
|
241
|
-
<
|
|
242
|
-
<
|
|
243
|
-
<
|
|
244
|
-
<
|
|
245
|
-
<
|
|
241
|
+
<AlertDialog.Root>
|
|
242
|
+
<AlertDialog.Trigger className={triggerAttrClass()}>delete everything</AlertDialog.Trigger>
|
|
243
|
+
<AlertDialog.Portal>
|
|
244
|
+
<AlertDialog.Overlay className={overlayAttrClass()} />
|
|
245
|
+
<AlertDialog.Content className={contentAttrClass()}>
|
|
246
|
+
<AlertDialog.Title className={titleAttrClass()}>Title</AlertDialog.Title>
|
|
247
|
+
<AlertDialog.Description className={descriptionAttrClass()}>
|
|
246
248
|
Description
|
|
247
|
-
</
|
|
248
|
-
<
|
|
249
|
-
<
|
|
250
|
-
</
|
|
251
|
-
</
|
|
252
|
-
</AlertDialog>
|
|
249
|
+
</AlertDialog.Description>
|
|
250
|
+
<AlertDialog.Action className={actionAttrClass()}>Confirm</AlertDialog.Action>
|
|
251
|
+
<AlertDialog.Cancel className={cancelAttrClass()}>Cancel</AlertDialog.Cancel>
|
|
252
|
+
</AlertDialog.Content>
|
|
253
|
+
</AlertDialog.Portal>
|
|
254
|
+
</AlertDialog.Root>
|
|
253
255
|
|
|
254
256
|
<h2>Open</h2>
|
|
255
|
-
<AlertDialog defaultOpen>
|
|
256
|
-
<
|
|
257
|
-
<
|
|
258
|
-
<
|
|
259
|
-
<
|
|
260
|
-
<
|
|
261
|
-
<
|
|
257
|
+
<AlertDialog.Root defaultOpen>
|
|
258
|
+
<AlertDialog.Trigger className={triggerAttrClass()}>delete everything</AlertDialog.Trigger>
|
|
259
|
+
<AlertDialog.Portal>
|
|
260
|
+
<AlertDialog.Overlay className={overlayAttrClass()} style={{ top: '50%' }} />
|
|
261
|
+
<AlertDialog.Content className={contentAttrClass()} style={{ top: '75%' }}>
|
|
262
|
+
<AlertDialog.Title className={titleAttrClass()}>Title</AlertDialog.Title>
|
|
263
|
+
<AlertDialog.Description className={descriptionAttrClass()}>
|
|
262
264
|
Description
|
|
263
|
-
</
|
|
264
|
-
<
|
|
265
|
-
<
|
|
266
|
-
</
|
|
267
|
-
</
|
|
268
|
-
</AlertDialog>
|
|
265
|
+
</AlertDialog.Description>
|
|
266
|
+
<AlertDialog.Action className={actionAttrClass()}>Confirm</AlertDialog.Action>
|
|
267
|
+
<AlertDialog.Cancel className={cancelAttrClass()}>Cancel</AlertDialog.Cancel>
|
|
268
|
+
</AlertDialog.Content>
|
|
269
|
+
</AlertDialog.Portal>
|
|
270
|
+
</AlertDialog.Root>
|
|
269
271
|
</div>
|
|
270
272
|
</div>
|
|
271
273
|
);
|
package/src/AlertDialog.test.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { axe } from 'jest-axe';
|
|
3
3
|
import { RenderResult } from '@testing-library/react';
|
|
4
4
|
import { render, fireEvent } from '@testing-library/react';
|
|
5
|
-
import * as AlertDialog from '
|
|
5
|
+
import * as AlertDialog from '@radix-ui/react-alert-dialog';
|
|
6
6
|
|
|
7
7
|
const OPEN_TEXT = 'Open';
|
|
8
8
|
const CANCEL_TEXT = 'Cancel';
|
package/src/index.ts
CHANGED
|
@@ -1 +1,34 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {
|
|
2
|
+
createAlertDialogScope,
|
|
3
|
+
//
|
|
4
|
+
AlertDialog,
|
|
5
|
+
AlertDialogTrigger,
|
|
6
|
+
AlertDialogPortal,
|
|
7
|
+
AlertDialogOverlay,
|
|
8
|
+
AlertDialogContent,
|
|
9
|
+
AlertDialogAction,
|
|
10
|
+
AlertDialogCancel,
|
|
11
|
+
AlertDialogTitle,
|
|
12
|
+
AlertDialogDescription,
|
|
13
|
+
//
|
|
14
|
+
Root,
|
|
15
|
+
Trigger,
|
|
16
|
+
Portal,
|
|
17
|
+
Overlay,
|
|
18
|
+
Content,
|
|
19
|
+
Action,
|
|
20
|
+
Cancel,
|
|
21
|
+
Title,
|
|
22
|
+
Description,
|
|
23
|
+
} from './AlertDialog';
|
|
24
|
+
export type {
|
|
25
|
+
AlertDialogProps,
|
|
26
|
+
AlertDialogTriggerProps,
|
|
27
|
+
AlertDialogPortalProps,
|
|
28
|
+
AlertDialogOverlayProps,
|
|
29
|
+
AlertDialogContentProps,
|
|
30
|
+
AlertDialogActionProps,
|
|
31
|
+
AlertDialogCancelProps,
|
|
32
|
+
AlertDialogTitleProps,
|
|
33
|
+
AlertDialogDescriptionProps,
|
|
34
|
+
} from './AlertDialog';
|