@radix-ui/react-alert-dialog 1.1.0-rc.2 → 1.1.0-rc.4

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.mts CHANGED
@@ -1,11 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import * as DialogPrimitive from '@radix-ui/react-dialog';
3
- import * as Radix from '@radix-ui/react-primitive';
4
3
 
5
- declare type Scope<C = any> = {
4
+ type Scope<C = any> = {
6
5
  [scopeName: string]: React.Context<C>[];
7
6
  } | undefined;
8
- declare type ScopeHook = (scope: Scope) => {
7
+ type ScopeHook = (scope: Scope) => {
9
8
  [__scopeProp: string]: Scope;
10
9
  };
11
10
  interface CreateScope {
@@ -14,35 +13,35 @@ interface CreateScope {
14
13
  }
15
14
 
16
15
  declare const createAlertDialogScope: CreateScope;
17
- declare type DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
16
+ type DialogProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
18
17
  interface AlertDialogProps extends Omit<DialogProps, 'modal'> {
19
18
  }
20
19
  declare const AlertDialog: React.FC<AlertDialogProps>;
21
- declare type DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
20
+ type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
22
21
  interface AlertDialogTriggerProps extends DialogTriggerProps {
23
22
  }
24
23
  declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
25
- declare type DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
24
+ type DialogPortalProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
26
25
  interface AlertDialogPortalProps extends DialogPortalProps {
27
26
  }
28
27
  declare const AlertDialogPortal: React.FC<AlertDialogPortalProps>;
29
- declare type DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
28
+ type DialogOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
30
29
  interface AlertDialogOverlayProps extends DialogOverlayProps {
31
30
  }
32
31
  declare const AlertDialogOverlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
33
- declare type DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
32
+ type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
34
33
  interface AlertDialogContentProps extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {
35
34
  }
36
35
  declare const AlertDialogContent: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
37
- declare type DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
36
+ type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
38
37
  interface AlertDialogTitleProps extends DialogTitleProps {
39
38
  }
40
39
  declare const AlertDialogTitle: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
41
- declare type DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
40
+ type DialogDescriptionProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
42
41
  interface AlertDialogDescriptionProps extends DialogDescriptionProps {
43
42
  }
44
43
  declare const AlertDialogDescription: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
45
- declare type DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
44
+ type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
46
45
  interface AlertDialogActionProps extends DialogCloseProps {
47
46
  }
48
47
  declare const AlertDialogAction: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import * as DialogPrimitive from '@radix-ui/react-dialog';
3
- import * as Radix from '@radix-ui/react-primitive';
4
3
 
5
- declare type Scope<C = any> = {
4
+ type Scope<C = any> = {
6
5
  [scopeName: string]: React.Context<C>[];
7
6
  } | undefined;
8
- declare type ScopeHook = (scope: Scope) => {
7
+ type ScopeHook = (scope: Scope) => {
9
8
  [__scopeProp: string]: Scope;
10
9
  };
11
10
  interface CreateScope {
@@ -14,35 +13,35 @@ interface CreateScope {
14
13
  }
15
14
 
16
15
  declare const createAlertDialogScope: CreateScope;
17
- declare type DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
16
+ type DialogProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
18
17
  interface AlertDialogProps extends Omit<DialogProps, 'modal'> {
19
18
  }
20
19
  declare const AlertDialog: React.FC<AlertDialogProps>;
21
- declare type DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
20
+ type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
22
21
  interface AlertDialogTriggerProps extends DialogTriggerProps {
23
22
  }
24
23
  declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
25
- declare type DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
24
+ type DialogPortalProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
26
25
  interface AlertDialogPortalProps extends DialogPortalProps {
27
26
  }
28
27
  declare const AlertDialogPortal: React.FC<AlertDialogPortalProps>;
29
- declare type DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
28
+ type DialogOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
30
29
  interface AlertDialogOverlayProps extends DialogOverlayProps {
31
30
  }
32
31
  declare const AlertDialogOverlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
33
- declare type DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
32
+ type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
34
33
  interface AlertDialogContentProps extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {
35
34
  }
36
35
  declare const AlertDialogContent: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
37
- declare type DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
36
+ type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
38
37
  interface AlertDialogTitleProps extends DialogTitleProps {
39
38
  }
40
39
  declare const AlertDialogTitle: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
41
- declare type DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
40
+ type DialogDescriptionProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
42
41
  interface AlertDialogDescriptionProps extends DialogDescriptionProps {
43
42
  }
44
43
  declare const AlertDialogDescription: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
45
- declare type DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
44
+ type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
46
45
  interface AlertDialogActionProps extends DialogCloseProps {
47
46
  }
48
47
  declare const AlertDialogAction: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
package/dist/index.js CHANGED
@@ -1,179 +1,201 @@
1
1
  "use strict";
2
2
  "use client";
3
- (() => {
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
12
- }) : x)(function(x) {
13
- if (typeof require !== "undefined") return require.apply(this, arguments);
14
- throw Error('Dynamic require of "' + x + '" is not supported');
15
- });
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") {
18
- for (let key of __getOwnPropNames(from))
19
- if (!__hasOwnProp.call(to, key) && key !== except)
20
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
- mod
31
- ));
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
30
 
33
- // packages/react/alert-dialog/src/AlertDialog.tsx
34
- var React = __toESM(__require("react"));
35
- var import_react_context = __require("@radix-ui/react-context");
36
- var import_react_compose_refs = __require("@radix-ui/react-compose-refs");
37
- var DialogPrimitive = __toESM(__require("@radix-ui/react-dialog"));
38
- var import_react_dialog = __require("@radix-ui/react-dialog");
39
- var import_primitive = __require("@radix-ui/primitive");
40
- var import_react_slot = __require("@radix-ui/react-slot");
41
- var import_jsx_runtime = __require("react/jsx-runtime");
42
- var ROOT_NAME = "AlertDialog";
43
- var [createAlertDialogContext, createAlertDialogScope] = (0, import_react_context.createContextScope)(ROOT_NAME, [
44
- import_react_dialog.createDialogScope
45
- ]);
46
- var useDialogScope = (0, import_react_dialog.createDialogScope)();
47
- var AlertDialog = (props) => {
48
- const { __scopeAlertDialog, ...alertDialogProps } = props;
31
+ // packages/react/alert-dialog/src/index.ts
32
+ var src_exports = {};
33
+ __export(src_exports, {
34
+ Action: () => Action,
35
+ AlertDialog: () => AlertDialog,
36
+ AlertDialogAction: () => AlertDialogAction,
37
+ AlertDialogCancel: () => AlertDialogCancel,
38
+ AlertDialogContent: () => AlertDialogContent,
39
+ AlertDialogDescription: () => AlertDialogDescription,
40
+ AlertDialogOverlay: () => AlertDialogOverlay,
41
+ AlertDialogPortal: () => AlertDialogPortal,
42
+ AlertDialogTitle: () => AlertDialogTitle,
43
+ AlertDialogTrigger: () => AlertDialogTrigger,
44
+ Cancel: () => Cancel,
45
+ Content: () => Content2,
46
+ Description: () => Description2,
47
+ Overlay: () => Overlay2,
48
+ Portal: () => Portal2,
49
+ Root: () => Root2,
50
+ Title: () => Title2,
51
+ Trigger: () => Trigger2,
52
+ createAlertDialogScope: () => createAlertDialogScope
53
+ });
54
+ module.exports = __toCommonJS(src_exports);
55
+
56
+ // packages/react/alert-dialog/src/AlertDialog.tsx
57
+ var React = __toESM(require("react"));
58
+ var import_react_context = require("@radix-ui/react-context");
59
+ var import_react_compose_refs = require("@radix-ui/react-compose-refs");
60
+ var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
61
+ var import_react_dialog = require("@radix-ui/react-dialog");
62
+ var import_primitive = require("@radix-ui/primitive");
63
+ var import_react_slot = require("@radix-ui/react-slot");
64
+ var import_jsx_runtime = require("react/jsx-runtime");
65
+ var ROOT_NAME = "AlertDialog";
66
+ var [createAlertDialogContext, createAlertDialogScope] = (0, import_react_context.createContextScope)(ROOT_NAME, [
67
+ import_react_dialog.createDialogScope
68
+ ]);
69
+ var useDialogScope = (0, import_react_dialog.createDialogScope)();
70
+ var AlertDialog = (props) => {
71
+ const { __scopeAlertDialog, ...alertDialogProps } = props;
72
+ const dialogScope = useDialogScope(__scopeAlertDialog);
73
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Root, { ...dialogScope, ...alertDialogProps, modal: true });
74
+ };
75
+ AlertDialog.displayName = ROOT_NAME;
76
+ var TRIGGER_NAME = "AlertDialogTrigger";
77
+ var AlertDialogTrigger = React.forwardRef(
78
+ (props, forwardedRef) => {
79
+ const { __scopeAlertDialog, ...triggerProps } = props;
80
+ const dialogScope = useDialogScope(__scopeAlertDialog);
81
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Trigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });
82
+ }
83
+ );
84
+ AlertDialogTrigger.displayName = TRIGGER_NAME;
85
+ var PORTAL_NAME = "AlertDialogPortal";
86
+ var AlertDialogPortal = (props) => {
87
+ const { __scopeAlertDialog, ...portalProps } = props;
88
+ const dialogScope = useDialogScope(__scopeAlertDialog);
89
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Portal, { ...dialogScope, ...portalProps });
90
+ };
91
+ AlertDialogPortal.displayName = PORTAL_NAME;
92
+ var OVERLAY_NAME = "AlertDialogOverlay";
93
+ var AlertDialogOverlay = React.forwardRef(
94
+ (props, forwardedRef) => {
95
+ const { __scopeAlertDialog, ...overlayProps } = props;
96
+ const dialogScope = useDialogScope(__scopeAlertDialog);
97
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Overlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
98
+ }
99
+ );
100
+ AlertDialogOverlay.displayName = OVERLAY_NAME;
101
+ var CONTENT_NAME = "AlertDialogContent";
102
+ var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
103
+ var AlertDialogContent = React.forwardRef(
104
+ (props, forwardedRef) => {
105
+ const { __scopeAlertDialog, children, ...contentProps } = props;
106
+ const dialogScope = useDialogScope(__scopeAlertDialog);
107
+ const contentRef = React.useRef(null);
108
+ const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, contentRef);
109
+ const cancelRef = React.useRef(null);
110
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
111
+ DialogPrimitive.WarningProvider,
112
+ {
113
+ contentName: CONTENT_NAME,
114
+ titleName: TITLE_NAME,
115
+ docsSlug: "alert-dialog",
116
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
117
+ DialogPrimitive.Content,
118
+ {
119
+ role: "alertdialog",
120
+ ...dialogScope,
121
+ ...contentProps,
122
+ ref: composedRefs,
123
+ onOpenAutoFocus: (0, import_primitive.composeEventHandlers)(contentProps.onOpenAutoFocus, (event) => {
124
+ event.preventDefault();
125
+ cancelRef.current?.focus({ preventScroll: true });
126
+ }),
127
+ onPointerDownOutside: (event) => event.preventDefault(),
128
+ onInteractOutside: (event) => event.preventDefault(),
129
+ children: [
130
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slottable, { children }),
131
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionWarning, { contentRef })
132
+ ]
133
+ }
134
+ ) })
135
+ }
136
+ );
137
+ }
138
+ );
139
+ AlertDialogContent.displayName = CONTENT_NAME;
140
+ var TITLE_NAME = "AlertDialogTitle";
141
+ var AlertDialogTitle = React.forwardRef(
142
+ (props, forwardedRef) => {
143
+ const { __scopeAlertDialog, ...titleProps } = props;
49
144
  const dialogScope = useDialogScope(__scopeAlertDialog);
50
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Root, { ...dialogScope, ...alertDialogProps, modal: true });
51
- };
52
- AlertDialog.displayName = ROOT_NAME;
53
- var TRIGGER_NAME = "AlertDialogTrigger";
54
- var AlertDialogTrigger = React.forwardRef(
55
- (props, forwardedRef) => {
56
- const { __scopeAlertDialog, ...triggerProps } = props;
57
- const dialogScope = useDialogScope(__scopeAlertDialog);
58
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Trigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });
59
- }
60
- );
61
- AlertDialogTrigger.displayName = TRIGGER_NAME;
62
- var PORTAL_NAME = "AlertDialogPortal";
63
- var AlertDialogPortal = (props) => {
64
- const { __scopeAlertDialog, ...portalProps } = props;
145
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Title, { ...dialogScope, ...titleProps, ref: forwardedRef });
146
+ }
147
+ );
148
+ AlertDialogTitle.displayName = TITLE_NAME;
149
+ var DESCRIPTION_NAME = "AlertDialogDescription";
150
+ var AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
151
+ const { __scopeAlertDialog, ...descriptionProps } = props;
152
+ const dialogScope = useDialogScope(__scopeAlertDialog);
153
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Description, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
154
+ });
155
+ AlertDialogDescription.displayName = DESCRIPTION_NAME;
156
+ var ACTION_NAME = "AlertDialogAction";
157
+ var AlertDialogAction = React.forwardRef(
158
+ (props, forwardedRef) => {
159
+ const { __scopeAlertDialog, ...actionProps } = props;
65
160
  const dialogScope = useDialogScope(__scopeAlertDialog);
66
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Portal, { ...dialogScope, ...portalProps });
67
- };
68
- AlertDialogPortal.displayName = PORTAL_NAME;
69
- var OVERLAY_NAME = "AlertDialogOverlay";
70
- var AlertDialogOverlay = React.forwardRef(
71
- (props, forwardedRef) => {
72
- const { __scopeAlertDialog, ...overlayProps } = props;
73
- const dialogScope = useDialogScope(__scopeAlertDialog);
74
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Overlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
75
- }
76
- );
77
- AlertDialogOverlay.displayName = OVERLAY_NAME;
78
- var CONTENT_NAME = "AlertDialogContent";
79
- var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
80
- var AlertDialogContent = React.forwardRef(
81
- (props, forwardedRef) => {
82
- const { __scopeAlertDialog, children, ...contentProps } = props;
83
- const dialogScope = useDialogScope(__scopeAlertDialog);
84
- const contentRef = React.useRef(null);
85
- const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, contentRef);
86
- const cancelRef = React.useRef(null);
87
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
88
- DialogPrimitive.WarningProvider,
89
- {
90
- contentName: CONTENT_NAME,
91
- titleName: TITLE_NAME,
92
- docsSlug: "alert-dialog",
93
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
94
- DialogPrimitive.Content,
95
- {
96
- role: "alertdialog",
97
- ...dialogScope,
98
- ...contentProps,
99
- ref: composedRefs,
100
- onOpenAutoFocus: (0, import_primitive.composeEventHandlers)(contentProps.onOpenAutoFocus, (event) => {
101
- event.preventDefault();
102
- cancelRef.current?.focus({ preventScroll: true });
103
- }),
104
- onPointerDownOutside: (event) => event.preventDefault(),
105
- onInteractOutside: (event) => event.preventDefault(),
106
- children: [
107
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slottable, { children }),
108
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionWarning, { contentRef })
109
- ]
110
- }
111
- ) })
112
- }
113
- );
114
- }
115
- );
116
- AlertDialogContent.displayName = CONTENT_NAME;
117
- var TITLE_NAME = "AlertDialogTitle";
118
- var AlertDialogTitle = React.forwardRef(
119
- (props, forwardedRef) => {
120
- const { __scopeAlertDialog, ...titleProps } = props;
121
- const dialogScope = useDialogScope(__scopeAlertDialog);
122
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Title, { ...dialogScope, ...titleProps, ref: forwardedRef });
123
- }
124
- );
125
- AlertDialogTitle.displayName = TITLE_NAME;
126
- var DESCRIPTION_NAME = "AlertDialogDescription";
127
- var AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
128
- const { __scopeAlertDialog, ...descriptionProps } = props;
161
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Close, { ...dialogScope, ...actionProps, ref: forwardedRef });
162
+ }
163
+ );
164
+ AlertDialogAction.displayName = ACTION_NAME;
165
+ var CANCEL_NAME = "AlertDialogCancel";
166
+ var AlertDialogCancel = React.forwardRef(
167
+ (props, forwardedRef) => {
168
+ const { __scopeAlertDialog, ...cancelProps } = props;
169
+ const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
129
170
  const dialogScope = useDialogScope(__scopeAlertDialog);
130
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Description, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
131
- });
132
- AlertDialogDescription.displayName = DESCRIPTION_NAME;
133
- var ACTION_NAME = "AlertDialogAction";
134
- var AlertDialogAction = React.forwardRef(
135
- (props, forwardedRef) => {
136
- const { __scopeAlertDialog, ...actionProps } = props;
137
- const dialogScope = useDialogScope(__scopeAlertDialog);
138
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Close, { ...dialogScope, ...actionProps, ref: forwardedRef });
139
- }
140
- );
141
- AlertDialogAction.displayName = ACTION_NAME;
142
- var CANCEL_NAME = "AlertDialogCancel";
143
- var AlertDialogCancel = React.forwardRef(
144
- (props, forwardedRef) => {
145
- const { __scopeAlertDialog, ...cancelProps } = props;
146
- const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
147
- const dialogScope = useDialogScope(__scopeAlertDialog);
148
- const ref = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
149
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Close, { ...dialogScope, ...cancelProps, ref });
150
- }
151
- );
152
- AlertDialogCancel.displayName = CANCEL_NAME;
153
- var DescriptionWarning = ({ contentRef }) => {
154
- const MESSAGE = `\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
171
+ const ref = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
172
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Close, { ...dialogScope, ...cancelProps, ref });
173
+ }
174
+ );
175
+ AlertDialogCancel.displayName = CANCEL_NAME;
176
+ var DescriptionWarning = ({ contentRef }) => {
177
+ const MESSAGE = `\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
155
178
 
156
179
  You can add a description to the \`${CONTENT_NAME}\` by passing a \`${DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
157
180
 
158
181
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
159
182
 
160
183
  For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
161
- React.useEffect(() => {
162
- const hasDescription = document.getElementById(
163
- contentRef.current?.getAttribute("aria-describedby")
164
- );
165
- if (!hasDescription) console.warn(MESSAGE);
166
- }, [MESSAGE, contentRef]);
167
- return null;
168
- };
169
- var Root2 = AlertDialog;
170
- var Trigger2 = AlertDialogTrigger;
171
- var Portal2 = AlertDialogPortal;
172
- var Overlay2 = AlertDialogOverlay;
173
- var Content2 = AlertDialogContent;
174
- var Action = AlertDialogAction;
175
- var Cancel = AlertDialogCancel;
176
- var Title2 = AlertDialogTitle;
177
- var Description2 = AlertDialogDescription;
178
- })();
184
+ React.useEffect(() => {
185
+ const hasDescription = document.getElementById(
186
+ contentRef.current?.getAttribute("aria-describedby")
187
+ );
188
+ if (!hasDescription) console.warn(MESSAGE);
189
+ }, [MESSAGE, contentRef]);
190
+ return null;
191
+ };
192
+ var Root2 = AlertDialog;
193
+ var Trigger2 = AlertDialogTrigger;
194
+ var Portal2 = AlertDialogPortal;
195
+ var Overlay2 = AlertDialogOverlay;
196
+ var Content2 = AlertDialogContent;
197
+ var Action = AlertDialogAction;
198
+ var Cancel = AlertDialogCancel;
199
+ var Title2 = AlertDialogTitle;
200
+ var Description2 = AlertDialogDescription;
179
201
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/AlertDialog.tsx"],
4
- "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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAuB;AACvB,6BAAmC;AACnC,kCAAgC;AAChC,wBAAiC;AACjC,4BAAkC;AAClC,yBAAqC;AACrC,0BAA0B;AAuBjB;AAdT,MAAM,YAAY;AAGlB,MAAM,CAAC,0BAA0B,sBAAsB,QAAI,yCAAmB,WAAW;AAAA,IACvF;AAAA,EACF,CAAC;AACD,MAAM,qBAAiB,uCAAkB;AAKzC,MAAM,cAA0C,CAAC,UAAyC;AACxF,UAAM,EAAE,oBAAoB,GAAG,iBAAiB,IAAI;AACpD,UAAM,cAAc,eAAe,kBAAkB;AACrD,WAAO,4CAAiB,sBAAhB,EAAsB,GAAG,aAAc,GAAG,kBAAkB,OAAO,MAAM;AAAA,EACnF;AAEA,cAAY,cAAc;AAK1B,MAAM,eAAe;AAMrB,MAAM,qBAA2B;AAAA,IAC/B,CAAC,OAA6C,iBAAiB;AAC7D,YAAM,EA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,oBAA0B;AAAA,IAC9B,CAAC,OAA4C,iBAAiB;AAC5D,YAAM,EAAE,oBAAoB,GAAG,YAAY,IAAI;AAC/C,YAAM,EAAE,UAAU,IAAI,6BAA6B,aAAa,kBAAkB;AAClF,YAAM,cAAc,eAAe,kBAAkB;AACrD,YAAM,UAAM,2CAAgB,cAAc,SAAS;AACnD,aAAO,4CAAiB,uBAAhB,EAAuB,GAAG,aAAc,GAAG,aAAa,KAAU;AAAA,IAC5E;AAAA,EACF;AAEA,oBAAkB,cAAc;AAQhC,MAAM,qBAAwD,CAAC,EAAE,WAAW,MAAM;AAChF,UAAM,UAAU,KAAK,YAAY;AAAA;AAAA,qCAEE,YAAY,qBAAqB,gBAAgB;AAAA;AAAA,4JAEsE,YAAY;AAAA;AAAA;AAItK,IAAM,gBAAU,MAAM;AACpB,YAAM,iBAAiB,SAAS;AAAA,QAC9B,WAAW,SAAS,aAAa,kBAAkB;AAAA,MACrD;AACA,UAAI,CAAC,eAAgB,SAAQ,KAAK,OAAO;AAAA,IAC3C,GAAG,CAAC,SAAS,UAAU,CAAC;AAExB,WAAO;AAAA,EACT;AAEA,MAAMA,QAAO;AACb,MAAMC,WAAU;AAChB,MAAMC,UAAS;AACf,MAAMC,WAAU;AAChB,MAAMC,WAAU;AAChB,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAMC,SAAQ;AACd,MAAMC,eAAc;",
6
- "names": ["Root", "Trigger", "Portal", "Overlay", "Content", "Title", "Description"]
3
+ "sources": ["../src/index.ts", "../src/AlertDialog.tsx"],
4
+ "sourcesContent": ["'use client';\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} 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 { 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 = React.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 = React.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 = React.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 = React.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 = React.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 = React.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 = React.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 = React.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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA,mBAAAC;AAAA,EAAA,eAAAC;AAAA,EAAA,cAAAC;AAAA,EAAA,YAAAC;AAAA,EAAA,aAAAC;AAAA,EAAA,eAAAC;AAAA,EAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,2BAAmC;AACnC,gCAAgC;AAChC,sBAAiC;AACjC,0BAAkC;AAClC,uBAAqC;AACrC,wBAA0B;AAsBjB;AAdT,IAAM,YAAY;AAGlB,IAAM,CA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portal", "Root", "Title", "Trigger", "Root", "Trigger", "Portal", "Overlay", "Content", "Title", "Description"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/AlertDialog.tsx"],
4
- "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"],
5
- "mappings": ";;;AAAA,YAAY,WAAW;AACvB,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,YAAY,qBAAqB;AACjC,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,iBAAiB;AAuBjB,cAgGC,YAhGD;AAdT,IAAM,YAAY;AAGlB,IAAM,CAAC,0BAA0B,sBAAsB,IAAI,mBAAmB,WAAW;AAAA,EACvF;AACF,CAAC;AACD,IAAM,iBAAiB,kBAAkB;AAKzC,IAAM,cAA0C,CAAC,UAAyC;AACxF,QAAM,EAAE,oBAAoB,GAAG,i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AG,YAAY,IAAI;AAC/C,UAAM,cAAc,eAAe,kBAAkB;AACrD,WAAO,oBAAiB,uBAAhB,EAAuB,GAAG,aAAc,GAAG,aAAa,KAAK,cAAc;AAAA,EACrF;AACF;AAEA,kBAAkB,cAAc;AAMhC,IAAM,cAAc;AAKpB,IAAM,oBAA0B;AAAA,EAC9B,CAAC,OAA4C,iBAAiB;AAC5D,UAAM,EAAE,oBAAoB,GAAG,YAAY,IAAI;AAC/C,UAAM,EAAE,UAAU,IAAI,6BAA6B,aAAa,kBAAkB;AAClF,UAAM,cAAc,eAAe,kBAAkB;AACrD,UAAM,MAAM,gBAAgB,cAAc,SAAS;AACnD,WAAO,oBAAiB,uBAAhB,EAAuB,GAAG,aAAc,GAAG,aAAa,KAAU;AAAA,EAC5E;AACF;AAEA,kBAAkB,cAAc;AAQhC,IAAM,qBAAwD,CAAC,EAAE,WAAW,MAAM;AAChF,QAAM,UAAU,KAAK,YAAY;AAAA;AAAA,qCAEE,YAAY,qBAAqB,gBAAgB;AAAA;AAAA,4JAEsE,YAAY;AAAA;AAAA;AAItK,EAAM,gBAAU,MAAM;AACpB,UAAM,iBAAiB,SAAS;AAAA,MAC9B,WAAW,SAAS,aAAa,kBAAkB;AAAA,IACrD;AACA,QAAI,CAAC,eAAgB,SAAQ,KAAK,OAAO;AAAA,EAC3C,GAAG,CAAC,SAAS,UAAU,CAAC;AAExB,SAAO;AACT;AAEA,IAAMA,QAAO;AACb,IAAMC,WAAU;AAChB,IAAMC,UAAS;AACf,IAAMC,WAAU;AAChB,IAAMC,WAAU;AAChB,IAAM,SAAS;AACf,IAAM,SAAS;AACf,IAAMC,SAAQ;AACd,IAAMC,eAAc;",
4
+ "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 { 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 = React.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 = React.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 = React.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 = React.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 = React.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 = React.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 = React.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 = React.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"],
5
+ "mappings": ";;;AAAA,YAAY,WAAW;AACvB,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,YAAY,qBAAqB;AACjC,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,iBAAiB;AAsBjB,cAgGC,YAhGD;AAdT,IAAM,YAAY;AAGlB,IAAM,CAAC,0BAA0B,sBAAsB,IAAI,mBAAmB,WAAW;AAAA,EACvF;AACF,CAAC;AACD,IAAM,iBAAiB,kBAAkB;AAKzC,IAAM,cAA0C,CAAC,UAAyC;AACxF,QAAM,EAAE,oBAAoB,GAAG,iBAAiB,IAAI;AACpD,QAAM,cAAc,eAAe,kBAAkB;AACrD,SAAO,oBAAiB,sBAAhB,EAAsB,GAAG,aAAc,GAAG,kBAAkB,OAAO,MAAM;AACnF;AAEA,YAAY,cAAc;AAK1B,IAAM,eAAe;AAMrB,IAAM,qBAA2B;AAAA,EAC/B,CAAC,OAA6C,iBAAiB;AAC7D,UAAM,EAAE,oBAAoB,GAAG,aAAa,IAAI;AAChD,UAAM,cAAc,eAAe,kBAAkB;AACrD,WAAO,oBAAiB,yBAAhB,EAAyB,GAAG,aAAc,GAAG,cAAc,KAAK,cAAc;AAAA,EACxF;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M,gBAAgB,cAAc,SAAS;AACnD,WAAO,oBAAiB,uBAAhB,EAAuB,GAAG,aAAc,GAAG,aAAa,KAAU;AAAA,EAC5E;AACF;AAEA,kBAAkB,cAAc;AAQhC,IAAM,qBAAwD,CAAC,EAAE,WAAW,MAAM;AAChF,QAAM,UAAU,KAAK,YAAY;AAAA;AAAA,qCAEE,YAAY,qBAAqB,gBAAgB;AAAA;AAAA,4JAEsE,YAAY;AAAA;AAAA;AAItK,EAAM,gBAAU,MAAM;AACpB,UAAM,iBAAiB,SAAS;AAAA,MAC9B,WAAW,SAAS,aAAa,kBAAkB;AAAA,IACrD;AACA,QAAI,CAAC,eAAgB,SAAQ,KAAK,OAAO;AAAA,EAC3C,GAAG,CAAC,SAAS,UAAU,CAAC;AAExB,SAAO;AACT;AAEA,IAAMA,QAAO;AACb,IAAMC,WAAU;AAChB,IAAMC,UAAS;AACf,IAAMC,WAAU;AAChB,IAAMC,WAAU;AAChB,IAAM,SAAS;AACf,IAAM,SAAS;AACf,IAAMC,SAAQ;AACd,IAAMC,eAAc;",
6
6
  "names": ["Root", "Trigger", "Portal", "Overlay", "Content", "Title", "Description"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-alert-dialog",
3
- "version": "1.1.0-rc.2",
3
+ "version": "1.1.0-rc.4",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -28,18 +28,18 @@
28
28
  "version": "yarn version"
29
29
  },
30
30
  "dependencies": {
31
- "@radix-ui/primitive": "1.1.0-rc.2",
32
- "@radix-ui/react-compose-refs": "1.1.0-rc.2",
33
- "@radix-ui/react-context": "1.1.0-rc.2",
34
- "@radix-ui/react-dialog": "1.1.0-rc.2",
35
- "@radix-ui/react-primitive": "1.1.0-rc.2",
36
- "@radix-ui/react-slot": "1.1.0-rc.2"
31
+ "@radix-ui/primitive": "1.1.0-rc.4",
32
+ "@radix-ui/react-compose-refs": "1.1.0-rc.4",
33
+ "@radix-ui/react-context": "1.1.0-rc.4",
34
+ "@radix-ui/react-dialog": "1.1.0-rc.4",
35
+ "@radix-ui/react-primitive": "2.0.0-rc.1",
36
+ "@radix-ui/react-slot": "1.1.0-rc.4"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@types/react": "*",
40
40
  "@types/react-dom": "*",
41
- "react": "^16.8 || ^17.0 || ^18.0",
42
- "react-dom": "^16.8 || ^17.0 || ^18.0"
41
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0",
42
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0"
43
43
  },
44
44
  "peerDependenciesMeta": {
45
45
  "@types/react": {
@@ -6,7 +6,6 @@ import { createDialogScope } from '@radix-ui/react-dialog';
6
6
  import { composeEventHandlers } from '@radix-ui/primitive';
7
7
  import { Slottable } from '@radix-ui/react-slot';
8
8
 
9
- import type * as Radix from '@radix-ui/react-primitive';
10
9
  import type { Scope } from '@radix-ui/react-context';
11
10
 
12
11
  /* -------------------------------------------------------------------------------------------------
@@ -21,7 +20,7 @@ const [createAlertDialogContext, createAlertDialogScope] = createContextScope(RO
21
20
  ]);
22
21
  const useDialogScope = createDialogScope();
23
22
 
24
- type DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
23
+ type DialogProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
25
24
  interface AlertDialogProps extends Omit<DialogProps, 'modal'> {}
26
25
 
27
26
  const AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {
@@ -38,7 +37,7 @@ AlertDialog.displayName = ROOT_NAME;
38
37
  const TRIGGER_NAME = 'AlertDialogTrigger';
39
38
 
40
39
  type AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;
41
- type DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
40
+ type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
42
41
  interface AlertDialogTriggerProps extends DialogTriggerProps {}
43
42
 
44
43
  const AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(
@@ -57,7 +56,7 @@ AlertDialogTrigger.displayName = TRIGGER_NAME;
57
56
 
58
57
  const PORTAL_NAME = 'AlertDialogPortal';
59
58
 
60
- type DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
59
+ type DialogPortalProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
61
60
  interface AlertDialogPortalProps extends DialogPortalProps {}
62
61
 
63
62
  const AlertDialogPortal: React.FC<AlertDialogPortalProps> = (
@@ -77,7 +76,7 @@ AlertDialogPortal.displayName = PORTAL_NAME;
77
76
  const OVERLAY_NAME = 'AlertDialogOverlay';
78
77
 
79
78
  type AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;
80
- type DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
79
+ type DialogOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
81
80
  interface AlertDialogOverlayProps extends DialogOverlayProps {}
82
81
 
83
82
  const AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(
@@ -104,7 +103,7 @@ const [AlertDialogContentProvider, useAlertDialogContentContext] =
104
103
  createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);
105
104
 
106
105
  type AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;
107
- type DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
106
+ type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
108
107
  interface AlertDialogContentProps
109
108
  extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}
110
109
 
@@ -161,7 +160,7 @@ AlertDialogContent.displayName = CONTENT_NAME;
161
160
  const TITLE_NAME = 'AlertDialogTitle';
162
161
 
163
162
  type AlertDialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;
164
- type DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
163
+ type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
165
164
  interface AlertDialogTitleProps extends DialogTitleProps {}
166
165
 
167
166
  const AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(
@@ -181,7 +180,7 @@ AlertDialogTitle.displayName = TITLE_NAME;
181
180
  const DESCRIPTION_NAME = 'AlertDialogDescription';
182
181
 
183
182
  type AlertDialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Description>;
184
- type DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
183
+ type DialogDescriptionProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
185
184
  interface AlertDialogDescriptionProps extends DialogDescriptionProps {}
186
185
 
187
186
  const AlertDialogDescription = React.forwardRef<
@@ -202,7 +201,7 @@ AlertDialogDescription.displayName = DESCRIPTION_NAME;
202
201
  const ACTION_NAME = 'AlertDialogAction';
203
202
 
204
203
  type AlertDialogActionElement = React.ElementRef<typeof DialogPrimitive.Close>;
205
- type DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
204
+ type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
206
205
  interface AlertDialogActionProps extends DialogCloseProps {}
207
206
 
208
207
  const AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(