@radix-ui/react-dialog 0.1.8-rc.9 → 1.0.1-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 CHANGED
@@ -1,29 +1,23 @@
1
1
  import * as React from "react";
2
2
  import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
3
3
  import { FocusScope } from "@radix-ui/react-focus-scope";
4
- import { UnstablePortal } from "@radix-ui/react-portal";
4
+ import { Portal as _Portal1 } from "@radix-ui/react-portal";
5
5
  import * as Radix from "@radix-ui/react-primitive";
6
6
  import { Primitive } from "@radix-ui/react-primitive";
7
- import { RemoveScroll } from "react-remove-scroll";
8
7
  export const createDialogScope: import("@radix-ui/react-context").CreateScope;
9
- type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>;
10
8
  export interface DialogProps {
11
9
  children?: React.ReactNode;
12
10
  open?: boolean;
13
11
  defaultOpen?: boolean;
14
12
  onOpenChange?(open: boolean): void;
15
13
  modal?: boolean;
16
- /**
17
- * @see https://github.com/theKashey/react-remove-scroll#usage
18
- */
19
- allowPinchZoom?: RemoveScrollProps['allowPinchZoom'];
20
14
  }
21
15
  export const Dialog: React.FC<DialogProps>;
22
16
  type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
23
17
  export interface DialogTriggerProps extends PrimitiveButtonProps {
24
18
  }
25
19
  export const DialogTrigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
26
- type PortalProps = React.ComponentPropsWithoutRef<typeof UnstablePortal>;
20
+ type PortalProps = React.ComponentPropsWithoutRef<typeof _Portal1>;
27
21
  export interface DialogPortalProps extends Omit<PortalProps, 'asChild'> {
28
22
  children?: React.ReactNode;
29
23
  /**
@@ -1 +1 @@
1
- {"mappings":"A;A;A;A;A;A;A;AA0BA,OAAA,wFAAgF,CAAC;AAiBjF,yBAAyB,MAAM,cAAc,CAAC,mBAAmB,CAAC,CA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BAAuB,CAAC,CAAC;AACrF,uBAAuB,MAAM,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;AACzE,gCAAiC,SAAQ,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC;IAC/E;A;A;A;OAIG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAEvC;A;A;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAEtD;A;A;OAGG;IACH,gBAAgB,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC;CAC1D;AAmDD,8BAA8B,MAAM,wBAAwB,CAAC,OAAO,UAAU,EAAE,CAAC,CAAC;AAClF,iCAA2B,SAAQ,sBAAsB;CAAG;AAE5D,OAAA,MAAM,wGAML,CAAC;AAWF,+BAA+B,MAAM,wBAAwB,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAClF,uCAAiC,SAAQ,uBAAuB;CAAG;AAEnE,OAAA,MAAM,sHAML,CAAC;AAWF,iCAA2B,SAAQ,oBAAoB;CAAG;AAE1D,OAAA,MAAM,uGAaL,CAAC;AAYF,OAAA;A;A;A;A;A;A;A;A;CAIE,CAAC;AA8CH,OAAA,MAAM,2BAAa,CAAC;AACpB,OAAA,MAAM,qGAAuB,CAAC;AAC9B,OAAA,MAAM,mCAAqB,CAAC;AAC5B,OAAA,MAAM,kGAAuB,CAAC;AAC9B,OAAA,MAAM,kGAAuB,CAAC;AAC9B,OAAA,MAAM,kGAAmB,CAAC;AAC1B,OAAA,MAAM,gHAA+B,CAAC;AACtC,OAAA,MAAM,iGAAmB,CAAC","sources":["./packages/react/dialog/src/packages/react/dialog/src/Dialog.tsx","./packages/react/dialog/src/packages/react/dialog/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
1
+ {"mappings":";;;;;;AA0BA,OAAA,wFAAgF,CAAC;AAgBjF;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IA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;IAC/E;;;;OAIG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAEvC;;;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAEtD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC;CAC1D;AAmDD,8BAA8B,MAAM,wBAAwB,CAAC,OAAO,UAAU,EAAE,CAAC,CAAC;AAClF,iCAA2B,SAAQ,sBAAsB;CAAG;AAE5D,OAAA,MAAM,wGAML,CAAC;AAWF,+BAA+B,MAAM,wBAAwB,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAClF,uCAAiC,SAAQ,uBAAuB;CAAG;AAEnE,OAAA,MAAM,sHAML,CAAC;AAWF,iCAA2B,SAAQ,oBAAoB;CAAG;AAE1D,OAAA,MAAM,uGAaL,CAAC;AAYF,OAAA;;;;;;;;;CAIE,CAAC;AA8CH,OAAA,MAAM,2BAAa,CAAC;AACpB,OAAA,MAAM,qGAAuB,CAAC;AAC9B,OAAA,MAAM,mCAAqB,CAAC;AAC5B,OAAA,MAAM,kGAAuB,CAAC;AAC9B,OAAA,MAAM,kGAAuB,CAAC;AAC9B,OAAA,MAAM,kGAAmB,CAAC;AAC1B,OAAA,MAAM,gHAA+B,CAAC;AACtC,OAAA,MAAM,iGAAmB,CAAC","sources":["packages/react/dialog/src/packages/react/dialog/src/Dialog.tsx","packages/react/dialog/src/packages/react/dialog/src/index.ts","packages/react/dialog/src/index.ts"],"sourcesContent":[null,null,"export {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Title,\n Description,\n Close,\n //\n WarningProvider,\n} from './Dialog';\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogCloseProps,\n} from './Dialog';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js CHANGED
@@ -1,2 +1,383 @@
1
- var e,o,t,r=require("@radix-ui/react-slot").Slot,n=require("aria-hidden").hideOthers,a=require("react-remove-scroll").RemoveScroll,i=require("@radix-ui/react-focus-guards").useFocusGuards,l=require("@radix-ui/react-primitive").Primitive,s=require("@radix-ui/react-presence").Presence,c=require("@radix-ui/react-portal").UnstablePortal,u=require("@radix-ui/react-focus-scope").FocusScope,d=require("@radix-ui/react-dismissable-layer").DismissableLayer,p=require("@radix-ui/react-use-controllable-state").useControllableState,g=require("@radix-ui/react-id").useId,f=require("@radix-ui/react-context"),D=f.createContext,m=f.createContextScope,v=require("@radix-ui/react-compose-refs").useComposedRefs,x=require("@radix-ui/primitive").composeEventHandlers,C=(e={},o=require("react"),Object.keys(o).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})})),e),_=(t=require("@babel/runtime/helpers/extends"))&&t.__esModule?t.default:t;const[E,R]=m("Dialog");exports.createDialogScope=R;const[O,b]=E("Dialog"),h=e=>{const{__scopeDialog:o,children:t,open:r,defaultOpen:n,onOpenChange:a,modal:i=!0,allowPinchZoom:l}=e,s=C.useRef(null),c=C.useRef(null),[u=!1,d]=p({prop:r,defaultProp:n,onChange:a});/*#__PURE__*/return C.createElement(O,{scope:o,triggerRef:s,contentRef:c,contentId:g(),titleId:g(),descriptionId:g(),open:u,onOpenChange:d,onOpenToggle:C.useCallback((()=>d((e=>!e))),[d]),modal:i,allowPinchZoom:l},t)};exports.Dialog=h;const P=/*#__PURE__*/C.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,n=b("DialogTrigger",t),a=v(o,n.triggerRef);/*#__PURE__*/return C.createElement(l.button,_({type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":N(n.open)},r,{ref:a,onClick:x(e.onClick,n.onOpenToggle)}))}));exports.DialogTrigger=P;const[q,w]=E("DialogPortal",{forceMount:void 0}),y=e=>{const{__scopeDialog:o,forceMount:t,children:r,container:n}=e,a=b("DialogPortal",o);/*#__PURE__*/return C.createElement(q,{scope:o,forceMount:t},C.Children.map(r,(e=>/*#__PURE__*/C.createElement(s,{present:t||a.open},/*#__PURE__*/C.createElement(c,{asChild:!0,container:n},e)))))};exports.DialogPortal=y;const F=/*#__PURE__*/C.forwardRef(((e,o)=>{const t=w("DialogOverlay",e.__scopeDialog),{forceMount:r=t.forceMount,...n}=e,a=b("DialogOverlay",e.__scopeDialog);return a.modal?/*#__PURE__*/C.createElement(s,{present:r||a.open},/*#__PURE__*/C.createElement(I,_({},n,{ref:o}))):null}));exports.DialogOverlay=F;const I=/*#__PURE__*/C.forwardRef(((e,o)=>{const{__scopeDialog:t,...n}=e,i=b("DialogOverlay",t);/*#__PURE__*/return C.createElement(a,{as:r,allowPinchZoom:i.allowPinchZoom,shards:[i.contentRef]},/*#__PURE__*/C.createElement(l.div,_({"data-state":N(i.open)},n,{ref:o,style:{pointerEvents:"auto",...n.style}})))})),M=/*#__PURE__*/C.forwardRef(((e,o)=>{const t=w("DialogContent",e.__scopeDialog),{forceMount:r=t.forceMount,...n}=e,a=b("DialogContent",e.__scopeDialog);/*#__PURE__*/return C.createElement(s,{present:r||a.open},a.modal?/*#__PURE__*/C.createElement(T,_({},n,{ref:o})):/*#__PURE__*/C.createElement(A,_({},n,{ref:o})))}));exports.DialogContent=M;const T=/*#__PURE__*/C.forwardRef(((e,o)=>{const t=b("DialogContent",e.__scopeDialog),r=C.useRef(null),a=v(o,t.contentRef,r);return C.useEffect((()=>{const e=r.current;if(e)return n(e)}),[]),/*#__PURE__*/C.createElement(S,_({},e,{ref:a,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:x(e.onCloseAutoFocus,(e=>{var o;e.preventDefault(),null===(o=t.triggerRef.current)||void 0===o||o.focus()})),onPointerDownOutside:x(e.onPointerDownOutside,(e=>{const o=e.detail.originalEvent,t=0===o.button&&!0===o.ctrlKey;(2===o.button||t)&&e.preventDefault()})),onFocusOutside:x(e.onFocusOutside,(e=>e.preventDefault()))}))})),A=/*#__PURE__*/C.forwardRef(((e,o)=>{const t=b("DialogContent",e.__scopeDialog),r=C.useRef(!1);/*#__PURE__*/return C.createElement(S,_({},e,{ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var n,a;(null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,o),o.defaultPrevented)||(r.current||null===(a=t.triggerRef.current)||void 0===a||a.focus(),o.preventDefault());r.current=!1},onInteractOutside:o=>{var n,a;null===(n=e.onInteractOutside)||void 0===n||n.call(e,o),o.defaultPrevented||(r.current=!0);const i=o.target;(null===(a=t.triggerRef.current)||void 0===a?void 0:a.contains(i))&&o.preventDefault()}}))})),S=/*#__PURE__*/C.forwardRef(((e,o)=>{const{__scopeDialog:t,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:a,...l}=e,s=b("DialogContent",t),c=C.useRef(null),p=v(o,c);return i(),/*#__PURE__*/C.createElement(C.Fragment,null,/*#__PURE__*/C.createElement(u,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:a},/*#__PURE__*/C.createElement(d,_({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":N(s.open)},l,{ref:p,onDismiss:()=>s.onOpenChange(!1)}))),!1)})),k=/*#__PURE__*/C.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,n=b("DialogTitle",t);/*#__PURE__*/return C.createElement(l.h2,_({id:n.titleId},r,{ref:o}))}));exports.DialogTitle=k;const Z=/*#__PURE__*/C.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,n=b("DialogDescription",t);/*#__PURE__*/return C.createElement(l.p,_({id:n.descriptionId},r,{ref:o}))}));exports.DialogDescription=Z;const j=/*#__PURE__*/C.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,n=b("DialogClose",t);/*#__PURE__*/return C.createElement(l.button,_({type:"button"},r,{ref:o,onClick:x(e.onClick,(()=>n.onOpenChange(!1)))}))}));function N(e){return e?"open":"closed"}exports.DialogClose=j;const[U,W]=D("DialogTitleWarning",{contentName:"DialogContent",titleName:"DialogTitle",docsSlug:"dialog"});exports.WarningProvider=U;const G=h;exports.Root=G;const H=P;exports.Trigger=H;const K=y;exports.Portal=K;const L=F;exports.Overlay=L;const z=M;exports.Content=z;const B=k;exports.Title=B;const J=Z;exports.Description=J;const Q=j;exports.Close=Q;
1
+ var $aJCrN$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
2
+ var $aJCrN$react = require("react");
3
+ var $aJCrN$radixuiprimitive = require("@radix-ui/primitive");
4
+ var $aJCrN$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
5
+ var $aJCrN$radixuireactcontext = require("@radix-ui/react-context");
6
+ var $aJCrN$radixuireactid = require("@radix-ui/react-id");
7
+ var $aJCrN$radixuireactusecontrollablestate = require("@radix-ui/react-use-controllable-state");
8
+ var $aJCrN$radixuireactdismissablelayer = require("@radix-ui/react-dismissable-layer");
9
+ var $aJCrN$radixuireactfocusscope = require("@radix-ui/react-focus-scope");
10
+ var $aJCrN$radixuireactportal = require("@radix-ui/react-portal");
11
+ var $aJCrN$radixuireactpresence = require("@radix-ui/react-presence");
12
+ var $aJCrN$radixuireactprimitive = require("@radix-ui/react-primitive");
13
+ var $aJCrN$radixuireactfocusguards = require("@radix-ui/react-focus-guards");
14
+ var $aJCrN$reactremovescroll = require("react-remove-scroll");
15
+ var $aJCrN$ariahidden = require("aria-hidden");
16
+ var $aJCrN$radixuireactslot = require("@radix-ui/react-slot");
17
+
18
+ function $parcel$export(e, n, v, s) {
19
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
20
+ }
21
+ function $parcel$interopDefault(a) {
22
+ return a && a.__esModule ? a.default : a;
23
+ }
24
+
25
+ $parcel$export(module.exports, "createDialogScope", () => $f4833395aa1bca1a$export$cc702773b8ea3e41);
26
+ $parcel$export(module.exports, "Dialog", () => $f4833395aa1bca1a$export$3ddf2d174ce01153);
27
+ $parcel$export(module.exports, "DialogTrigger", () => $f4833395aa1bca1a$export$2e1e1122cf0cba88);
28
+ $parcel$export(module.exports, "DialogPortal", () => $f4833395aa1bca1a$export$dad7c95542bacce0);
29
+ $parcel$export(module.exports, "DialogOverlay", () => $f4833395aa1bca1a$export$bd1d06c79be19e17);
30
+ $parcel$export(module.exports, "DialogContent", () => $f4833395aa1bca1a$export$b6d9565de1e068cf);
31
+ $parcel$export(module.exports, "DialogTitle", () => $f4833395aa1bca1a$export$16f7638e4a34b909);
32
+ $parcel$export(module.exports, "DialogDescription", () => $f4833395aa1bca1a$export$94e94c2ec2c954d5);
33
+ $parcel$export(module.exports, "DialogClose", () => $f4833395aa1bca1a$export$fba2fb7cd781b7ac);
34
+ $parcel$export(module.exports, "Root", () => $f4833395aa1bca1a$export$be92b6f5f03c0fe9);
35
+ $parcel$export(module.exports, "Trigger", () => $f4833395aa1bca1a$export$41fb9f06171c75f4);
36
+ $parcel$export(module.exports, "Portal", () => $f4833395aa1bca1a$export$602eac185826482c);
37
+ $parcel$export(module.exports, "Overlay", () => $f4833395aa1bca1a$export$c6fdb837b070b4ff);
38
+ $parcel$export(module.exports, "Content", () => $f4833395aa1bca1a$export$7c6e2c02157bb7d2);
39
+ $parcel$export(module.exports, "Title", () => $f4833395aa1bca1a$export$f99233281efd08a0);
40
+ $parcel$export(module.exports, "Description", () => $f4833395aa1bca1a$export$393edc798c47379d);
41
+ $parcel$export(module.exports, "Close", () => $f4833395aa1bca1a$export$f39c2d165cd861fe);
42
+ $parcel$export(module.exports, "WarningProvider", () => $f4833395aa1bca1a$export$69b62a49393917d6);
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+ /* -------------------------------------------------------------------------------------------------
60
+ * Dialog
61
+ * -----------------------------------------------------------------------------------------------*/ const $f4833395aa1bca1a$var$DIALOG_NAME = 'Dialog';
62
+ const [$f4833395aa1bca1a$var$createDialogContext, $f4833395aa1bca1a$export$cc702773b8ea3e41] = $aJCrN$radixuireactcontext.createContextScope($f4833395aa1bca1a$var$DIALOG_NAME);
63
+ const [$f4833395aa1bca1a$var$DialogProvider, $f4833395aa1bca1a$var$useDialogContext] = $f4833395aa1bca1a$var$createDialogContext($f4833395aa1bca1a$var$DIALOG_NAME);
64
+ const $f4833395aa1bca1a$export$3ddf2d174ce01153 = (props)=>{
65
+ const { __scopeDialog: __scopeDialog , children: children , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , modal: modal = true } = props;
66
+ const triggerRef = $aJCrN$react.useRef(null);
67
+ const contentRef = $aJCrN$react.useRef(null);
68
+ const [open = false, setOpen] = $aJCrN$radixuireactusecontrollablestate.useControllableState({
69
+ prop: openProp,
70
+ defaultProp: defaultOpen,
71
+ onChange: onOpenChange
72
+ });
73
+ return /*#__PURE__*/ $aJCrN$react.createElement($f4833395aa1bca1a$var$DialogProvider, {
74
+ scope: __scopeDialog,
75
+ triggerRef: triggerRef,
76
+ contentRef: contentRef,
77
+ contentId: $aJCrN$radixuireactid.useId(),
78
+ titleId: $aJCrN$radixuireactid.useId(),
79
+ descriptionId: $aJCrN$radixuireactid.useId(),
80
+ open: open,
81
+ onOpenChange: setOpen,
82
+ onOpenToggle: $aJCrN$react.useCallback(()=>setOpen((prevOpen)=>!prevOpen
83
+ )
84
+ , [
85
+ setOpen
86
+ ]),
87
+ modal: modal
88
+ }, children);
89
+ };
90
+ /*#__PURE__*/ Object.assign($f4833395aa1bca1a$export$3ddf2d174ce01153, {
91
+ displayName: $f4833395aa1bca1a$var$DIALOG_NAME
92
+ });
93
+ /* -------------------------------------------------------------------------------------------------
94
+ * DialogTrigger
95
+ * -----------------------------------------------------------------------------------------------*/ const $f4833395aa1bca1a$var$TRIGGER_NAME = 'DialogTrigger';
96
+ const $f4833395aa1bca1a$export$2e1e1122cf0cba88 = /*#__PURE__*/ $aJCrN$react.forwardRef((props, forwardedRef)=>{
97
+ const { __scopeDialog: __scopeDialog , ...triggerProps } = props;
98
+ const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$TRIGGER_NAME, __scopeDialog);
99
+ const composedTriggerRef = $aJCrN$radixuireactcomposerefs.useComposedRefs(forwardedRef, context.triggerRef);
100
+ return /*#__PURE__*/ $aJCrN$react.createElement($aJCrN$radixuireactprimitive.Primitive.button, ($parcel$interopDefault($aJCrN$babelruntimehelpersextends))({
101
+ type: "button",
102
+ "aria-haspopup": "dialog",
103
+ "aria-expanded": context.open,
104
+ "aria-controls": context.contentId,
105
+ "data-state": $f4833395aa1bca1a$var$getState(context.open)
106
+ }, triggerProps, {
107
+ ref: composedTriggerRef,
108
+ onClick: $aJCrN$radixuiprimitive.composeEventHandlers(props.onClick, context.onOpenToggle)
109
+ }));
110
+ });
111
+ /*#__PURE__*/ Object.assign($f4833395aa1bca1a$export$2e1e1122cf0cba88, {
112
+ displayName: $f4833395aa1bca1a$var$TRIGGER_NAME
113
+ });
114
+ /* -------------------------------------------------------------------------------------------------
115
+ * DialogPortal
116
+ * -----------------------------------------------------------------------------------------------*/ const $f4833395aa1bca1a$var$PORTAL_NAME = 'DialogPortal';
117
+ const [$f4833395aa1bca1a$var$PortalProvider, $f4833395aa1bca1a$var$usePortalContext] = $f4833395aa1bca1a$var$createDialogContext($f4833395aa1bca1a$var$PORTAL_NAME, {
118
+ forceMount: undefined
119
+ });
120
+ const $f4833395aa1bca1a$export$dad7c95542bacce0 = (props)=>{
121
+ const { __scopeDialog: __scopeDialog , forceMount: forceMount , children: children , container: container } = props;
122
+ const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$PORTAL_NAME, __scopeDialog);
123
+ return /*#__PURE__*/ $aJCrN$react.createElement($f4833395aa1bca1a$var$PortalProvider, {
124
+ scope: __scopeDialog,
125
+ forceMount: forceMount
126
+ }, $aJCrN$react.Children.map(children, (child)=>/*#__PURE__*/ $aJCrN$react.createElement($aJCrN$radixuireactpresence.Presence, {
127
+ present: forceMount || context.open
128
+ }, /*#__PURE__*/ $aJCrN$react.createElement($aJCrN$radixuireactportal.Portal, {
129
+ asChild: true,
130
+ container: container
131
+ }, child))
132
+ ));
133
+ };
134
+ /*#__PURE__*/ Object.assign($f4833395aa1bca1a$export$dad7c95542bacce0, {
135
+ displayName: $f4833395aa1bca1a$var$PORTAL_NAME
136
+ });
137
+ /* -------------------------------------------------------------------------------------------------
138
+ * DialogOverlay
139
+ * -----------------------------------------------------------------------------------------------*/ const $f4833395aa1bca1a$var$OVERLAY_NAME = 'DialogOverlay';
140
+ const $f4833395aa1bca1a$export$bd1d06c79be19e17 = /*#__PURE__*/ $aJCrN$react.forwardRef((props, forwardedRef)=>{
141
+ const portalContext = $f4833395aa1bca1a$var$usePortalContext($f4833395aa1bca1a$var$OVERLAY_NAME, props.__scopeDialog);
142
+ const { forceMount: forceMount = portalContext.forceMount , ...overlayProps } = props;
143
+ const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$OVERLAY_NAME, props.__scopeDialog);
144
+ return context.modal ? /*#__PURE__*/ $aJCrN$react.createElement($aJCrN$radixuireactpresence.Presence, {
145
+ present: forceMount || context.open
146
+ }, /*#__PURE__*/ $aJCrN$react.createElement($f4833395aa1bca1a$var$DialogOverlayImpl, ($parcel$interopDefault($aJCrN$babelruntimehelpersextends))({}, overlayProps, {
147
+ ref: forwardedRef
148
+ }))) : null;
149
+ });
150
+ /*#__PURE__*/ Object.assign($f4833395aa1bca1a$export$bd1d06c79be19e17, {
151
+ displayName: $f4833395aa1bca1a$var$OVERLAY_NAME
152
+ });
153
+ const $f4833395aa1bca1a$var$DialogOverlayImpl = /*#__PURE__*/ $aJCrN$react.forwardRef((props, forwardedRef)=>{
154
+ const { __scopeDialog: __scopeDialog , ...overlayProps } = props;
155
+ const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$OVERLAY_NAME, __scopeDialog);
156
+ return(/*#__PURE__*/ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
157
+ // ie. when `Overlay` and `Content` are siblings
158
+ $aJCrN$react.createElement($aJCrN$reactremovescroll.RemoveScroll, {
159
+ as: $aJCrN$radixuireactslot.Slot,
160
+ allowPinchZoom: true,
161
+ shards: [
162
+ context.contentRef
163
+ ]
164
+ }, /*#__PURE__*/ $aJCrN$react.createElement($aJCrN$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($aJCrN$babelruntimehelpersextends))({
165
+ "data-state": $f4833395aa1bca1a$var$getState(context.open)
166
+ }, overlayProps, {
167
+ ref: forwardedRef // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.
168
+ ,
169
+ style: {
170
+ pointerEvents: 'auto',
171
+ ...overlayProps.style
172
+ }
173
+ }))));
174
+ });
175
+ /* -------------------------------------------------------------------------------------------------
176
+ * DialogContent
177
+ * -----------------------------------------------------------------------------------------------*/ const $f4833395aa1bca1a$var$CONTENT_NAME = 'DialogContent';
178
+ const $f4833395aa1bca1a$export$b6d9565de1e068cf = /*#__PURE__*/ $aJCrN$react.forwardRef((props, forwardedRef)=>{
179
+ const portalContext = $f4833395aa1bca1a$var$usePortalContext($f4833395aa1bca1a$var$CONTENT_NAME, props.__scopeDialog);
180
+ const { forceMount: forceMount = portalContext.forceMount , ...contentProps } = props;
181
+ const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$CONTENT_NAME, props.__scopeDialog);
182
+ return /*#__PURE__*/ $aJCrN$react.createElement($aJCrN$radixuireactpresence.Presence, {
183
+ present: forceMount || context.open
184
+ }, context.modal ? /*#__PURE__*/ $aJCrN$react.createElement($f4833395aa1bca1a$var$DialogContentModal, ($parcel$interopDefault($aJCrN$babelruntimehelpersextends))({}, contentProps, {
185
+ ref: forwardedRef
186
+ })) : /*#__PURE__*/ $aJCrN$react.createElement($f4833395aa1bca1a$var$DialogContentNonModal, ($parcel$interopDefault($aJCrN$babelruntimehelpersextends))({}, contentProps, {
187
+ ref: forwardedRef
188
+ })));
189
+ });
190
+ /*#__PURE__*/ Object.assign($f4833395aa1bca1a$export$b6d9565de1e068cf, {
191
+ displayName: $f4833395aa1bca1a$var$CONTENT_NAME
192
+ });
193
+ /* -----------------------------------------------------------------------------------------------*/ const $f4833395aa1bca1a$var$DialogContentModal = /*#__PURE__*/ $aJCrN$react.forwardRef((props, forwardedRef)=>{
194
+ const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$CONTENT_NAME, props.__scopeDialog);
195
+ const contentRef = $aJCrN$react.useRef(null);
196
+ const composedRefs = $aJCrN$radixuireactcomposerefs.useComposedRefs(forwardedRef, context.contentRef, contentRef); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
197
+ $aJCrN$react.useEffect(()=>{
198
+ const content = contentRef.current;
199
+ if (content) return $aJCrN$ariahidden.hideOthers(content);
200
+ }, []);
201
+ return /*#__PURE__*/ $aJCrN$react.createElement($f4833395aa1bca1a$var$DialogContentImpl, ($parcel$interopDefault($aJCrN$babelruntimehelpersextends))({}, props, {
202
+ ref: composedRefs // we make sure focus isn't trapped once `DialogContent` has been closed
203
+ ,
204
+ trapFocus: context.open,
205
+ disableOutsidePointerEvents: true,
206
+ onCloseAutoFocus: $aJCrN$radixuiprimitive.composeEventHandlers(props.onCloseAutoFocus, (event)=>{
207
+ var _context$triggerRef$c;
208
+ event.preventDefault();
209
+ (_context$triggerRef$c = context.triggerRef.current) === null || _context$triggerRef$c === void 0 || _context$triggerRef$c.focus();
210
+ }),
211
+ onPointerDownOutside: $aJCrN$radixuiprimitive.composeEventHandlers(props.onPointerDownOutside, (event)=>{
212
+ const originalEvent = event.detail.originalEvent;
213
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
214
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick; // If the event is a right-click, we shouldn't close because
215
+ // it is effectively as if we right-clicked the `Overlay`.
216
+ if (isRightClick) event.preventDefault();
217
+ }) // When focus is trapped, a `focusout` event may still happen.
218
+ ,
219
+ onFocusOutside: $aJCrN$radixuiprimitive.composeEventHandlers(props.onFocusOutside, (event)=>event.preventDefault()
220
+ )
221
+ }));
222
+ });
223
+ /* -----------------------------------------------------------------------------------------------*/ const $f4833395aa1bca1a$var$DialogContentNonModal = /*#__PURE__*/ $aJCrN$react.forwardRef((props, forwardedRef)=>{
224
+ const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$CONTENT_NAME, props.__scopeDialog);
225
+ const hasInteractedOutsideRef = $aJCrN$react.useRef(false);
226
+ return /*#__PURE__*/ $aJCrN$react.createElement($f4833395aa1bca1a$var$DialogContentImpl, ($parcel$interopDefault($aJCrN$babelruntimehelpersextends))({}, props, {
227
+ ref: forwardedRef,
228
+ trapFocus: false,
229
+ disableOutsidePointerEvents: false,
230
+ onCloseAutoFocus: (event)=>{
231
+ var _props$onCloseAutoFoc;
232
+ (_props$onCloseAutoFoc = props.onCloseAutoFocus) === null || _props$onCloseAutoFoc === void 0 || _props$onCloseAutoFoc.call(props, event);
233
+ if (!event.defaultPrevented) {
234
+ var _context$triggerRef$c2;
235
+ if (!hasInteractedOutsideRef.current) (_context$triggerRef$c2 = context.triggerRef.current) === null || _context$triggerRef$c2 === void 0 || _context$triggerRef$c2.focus(); // Always prevent auto focus because we either focus manually or want user agent focus
236
+ event.preventDefault();
237
+ }
238
+ hasInteractedOutsideRef.current = false;
239
+ },
240
+ onInteractOutside: (event)=>{
241
+ var _props$onInteractOuts, _context$triggerRef$c3;
242
+ (_props$onInteractOuts = props.onInteractOutside) === null || _props$onInteractOuts === void 0 || _props$onInteractOuts.call(props, event);
243
+ if (!event.defaultPrevented) hasInteractedOutsideRef.current = true; // Prevent dismissing when clicking the trigger.
244
+ // As the trigger is already setup to close, without doing so would
245
+ // cause it to close and immediately open.
246
+ //
247
+ // We use `onInteractOutside` as some browsers also
248
+ // focus on pointer down, creating the same issue.
249
+ const target = event.target;
250
+ const targetIsTrigger = (_context$triggerRef$c3 = context.triggerRef.current) === null || _context$triggerRef$c3 === void 0 ? void 0 : _context$triggerRef$c3.contains(target);
251
+ if (targetIsTrigger) event.preventDefault();
252
+ }
253
+ }));
254
+ });
255
+ /* -----------------------------------------------------------------------------------------------*/ const $f4833395aa1bca1a$var$DialogContentImpl = /*#__PURE__*/ $aJCrN$react.forwardRef((props, forwardedRef)=>{
256
+ const { __scopeDialog: __scopeDialog , trapFocus: trapFocus , onOpenAutoFocus: onOpenAutoFocus , onCloseAutoFocus: onCloseAutoFocus , ...contentProps } = props;
257
+ const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$CONTENT_NAME, __scopeDialog);
258
+ const contentRef = $aJCrN$react.useRef(null);
259
+ const composedRefs = $aJCrN$radixuireactcomposerefs.useComposedRefs(forwardedRef, contentRef); // Make sure the whole tree has focus guards as our `Dialog` will be
260
+ // the last element in the DOM (beacuse of the `Portal`)
261
+ $aJCrN$radixuireactfocusguards.useFocusGuards();
262
+ return /*#__PURE__*/ $aJCrN$react.createElement($aJCrN$react.Fragment, null, /*#__PURE__*/ $aJCrN$react.createElement($aJCrN$radixuireactfocusscope.FocusScope, {
263
+ asChild: true,
264
+ loop: true,
265
+ trapped: trapFocus,
266
+ onMountAutoFocus: onOpenAutoFocus,
267
+ onUnmountAutoFocus: onCloseAutoFocus
268
+ }, /*#__PURE__*/ $aJCrN$react.createElement($aJCrN$radixuireactdismissablelayer.DismissableLayer, ($parcel$interopDefault($aJCrN$babelruntimehelpersextends))({
269
+ role: "dialog",
270
+ id: context.contentId,
271
+ "aria-describedby": context.descriptionId,
272
+ "aria-labelledby": context.titleId,
273
+ "data-state": $f4833395aa1bca1a$var$getState(context.open)
274
+ }, contentProps, {
275
+ ref: composedRefs,
276
+ onDismiss: ()=>context.onOpenChange(false)
277
+ }))), false);
278
+ });
279
+ /* -------------------------------------------------------------------------------------------------
280
+ * DialogTitle
281
+ * -----------------------------------------------------------------------------------------------*/ const $f4833395aa1bca1a$var$TITLE_NAME = 'DialogTitle';
282
+ const $f4833395aa1bca1a$export$16f7638e4a34b909 = /*#__PURE__*/ $aJCrN$react.forwardRef((props, forwardedRef)=>{
283
+ const { __scopeDialog: __scopeDialog , ...titleProps } = props;
284
+ const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$TITLE_NAME, __scopeDialog);
285
+ return /*#__PURE__*/ $aJCrN$react.createElement($aJCrN$radixuireactprimitive.Primitive.h2, ($parcel$interopDefault($aJCrN$babelruntimehelpersextends))({
286
+ id: context.titleId
287
+ }, titleProps, {
288
+ ref: forwardedRef
289
+ }));
290
+ });
291
+ /*#__PURE__*/ Object.assign($f4833395aa1bca1a$export$16f7638e4a34b909, {
292
+ displayName: $f4833395aa1bca1a$var$TITLE_NAME
293
+ });
294
+ /* -------------------------------------------------------------------------------------------------
295
+ * DialogDescription
296
+ * -----------------------------------------------------------------------------------------------*/ const $f4833395aa1bca1a$var$DESCRIPTION_NAME = 'DialogDescription';
297
+ const $f4833395aa1bca1a$export$94e94c2ec2c954d5 = /*#__PURE__*/ $aJCrN$react.forwardRef((props, forwardedRef)=>{
298
+ const { __scopeDialog: __scopeDialog , ...descriptionProps } = props;
299
+ const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$DESCRIPTION_NAME, __scopeDialog);
300
+ return /*#__PURE__*/ $aJCrN$react.createElement($aJCrN$radixuireactprimitive.Primitive.p, ($parcel$interopDefault($aJCrN$babelruntimehelpersextends))({
301
+ id: context.descriptionId
302
+ }, descriptionProps, {
303
+ ref: forwardedRef
304
+ }));
305
+ });
306
+ /*#__PURE__*/ Object.assign($f4833395aa1bca1a$export$94e94c2ec2c954d5, {
307
+ displayName: $f4833395aa1bca1a$var$DESCRIPTION_NAME
308
+ });
309
+ /* -------------------------------------------------------------------------------------------------
310
+ * DialogClose
311
+ * -----------------------------------------------------------------------------------------------*/ const $f4833395aa1bca1a$var$CLOSE_NAME = 'DialogClose';
312
+ const $f4833395aa1bca1a$export$fba2fb7cd781b7ac = /*#__PURE__*/ $aJCrN$react.forwardRef((props, forwardedRef)=>{
313
+ const { __scopeDialog: __scopeDialog , ...closeProps } = props;
314
+ const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$CLOSE_NAME, __scopeDialog);
315
+ return /*#__PURE__*/ $aJCrN$react.createElement($aJCrN$radixuireactprimitive.Primitive.button, ($parcel$interopDefault($aJCrN$babelruntimehelpersextends))({
316
+ type: "button"
317
+ }, closeProps, {
318
+ ref: forwardedRef,
319
+ onClick: $aJCrN$radixuiprimitive.composeEventHandlers(props.onClick, ()=>context.onOpenChange(false)
320
+ )
321
+ }));
322
+ });
323
+ /*#__PURE__*/ Object.assign($f4833395aa1bca1a$export$fba2fb7cd781b7ac, {
324
+ displayName: $f4833395aa1bca1a$var$CLOSE_NAME
325
+ });
326
+ /* -----------------------------------------------------------------------------------------------*/ function $f4833395aa1bca1a$var$getState(open) {
327
+ return open ? 'open' : 'closed';
328
+ }
329
+ const $f4833395aa1bca1a$var$TITLE_WARNING_NAME = 'DialogTitleWarning';
330
+ const [$f4833395aa1bca1a$export$69b62a49393917d6, $f4833395aa1bca1a$var$useWarningContext] = $aJCrN$radixuireactcontext.createContext($f4833395aa1bca1a$var$TITLE_WARNING_NAME, {
331
+ contentName: $f4833395aa1bca1a$var$CONTENT_NAME,
332
+ titleName: $f4833395aa1bca1a$var$TITLE_NAME,
333
+ docsSlug: 'dialog'
334
+ });
335
+ const $f4833395aa1bca1a$var$TitleWarning = ({ titleId: titleId })=>{
336
+ const titleWarningContext = $f4833395aa1bca1a$var$useWarningContext($f4833395aa1bca1a$var$TITLE_WARNING_NAME);
337
+ const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
338
+
339
+ If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
340
+
341
+ For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
342
+ $aJCrN$react.useEffect(()=>{
343
+ if (titleId) {
344
+ const hasTitle = document.getElementById(titleId);
345
+ if (!hasTitle) throw new Error(MESSAGE);
346
+ }
347
+ }, [
348
+ MESSAGE,
349
+ titleId
350
+ ]);
351
+ return null;
352
+ };
353
+ const $f4833395aa1bca1a$var$DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning';
354
+ const $f4833395aa1bca1a$var$DescriptionWarning = ({ contentRef: contentRef , descriptionId: descriptionId })=>{
355
+ const descriptionWarningContext = $f4833395aa1bca1a$var$useWarningContext($f4833395aa1bca1a$var$DESCRIPTION_WARNING_NAME);
356
+ const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
357
+ $aJCrN$react.useEffect(()=>{
358
+ var _contentRef$current;
359
+ const describedById = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.getAttribute('aria-describedby'); // if we have an id and the user hasn't set aria-describedby={undefined}
360
+ if (descriptionId && describedById) {
361
+ const hasDescription = document.getElementById(descriptionId);
362
+ if (!hasDescription) console.warn(MESSAGE);
363
+ }
364
+ }, [
365
+ MESSAGE,
366
+ contentRef,
367
+ descriptionId
368
+ ]);
369
+ return null;
370
+ };
371
+ const $f4833395aa1bca1a$export$be92b6f5f03c0fe9 = $f4833395aa1bca1a$export$3ddf2d174ce01153;
372
+ const $f4833395aa1bca1a$export$41fb9f06171c75f4 = $f4833395aa1bca1a$export$2e1e1122cf0cba88;
373
+ const $f4833395aa1bca1a$export$602eac185826482c = $f4833395aa1bca1a$export$dad7c95542bacce0;
374
+ const $f4833395aa1bca1a$export$c6fdb837b070b4ff = $f4833395aa1bca1a$export$bd1d06c79be19e17;
375
+ const $f4833395aa1bca1a$export$7c6e2c02157bb7d2 = $f4833395aa1bca1a$export$b6d9565de1e068cf;
376
+ const $f4833395aa1bca1a$export$f99233281efd08a0 = $f4833395aa1bca1a$export$16f7638e4a34b909;
377
+ const $f4833395aa1bca1a$export$393edc798c47379d = $f4833395aa1bca1a$export$94e94c2ec2c954d5;
378
+ const $f4833395aa1bca1a$export$f39c2d165cd861fe = $f4833395aa1bca1a$export$fba2fb7cd781b7ac;
379
+
380
+
381
+
382
+
2
383
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":"IAYgCA,EAAMC,EAZNC,2uBAYAF,KAAMC,mBACpCE,OAAOC,KAAKH,GAAQI,SAAQ,SAASC,GACvB,YAARA,GAA6B,eAARA,GAIzBH,OAAOI,eAAeP,EAAMM,EAAK,CAC/BE,YAAY,EACZC,IAAK,WACH,OAAOR,EAAOK,SAKbN,MA1BuBE,8CAClBA,EAAEQ,WAAaR,EAAES,QAAUT,ECsBzC,MAGOU,EAAqBC,GAAqBC,EAH7B,sCAkBpB,MAAOC,EAAgBC,GAAoBJ,EAlBvB,UAiCdK,EAAiCC,IACrC,MAAMC,cACJA,EADIC,SAEJA,EACAC,KAAMC,EAHFC,YAIJA,EAJIC,aAKJA,EALIC,MAMJA,GAAQ,EANJC,eAOJA,GACER,EACES,EAAaC,EAAMC,OAA0B,MAC7CC,EAAaF,EAAMC,OAA6B,OAC/CR,GAAO,EAAOU,GAAWC,EAAqB,CACnDC,KAAMX,EACNY,YAAaX,EACbY,SAAUX,iBAGZ,OACEY,EAAAC,cAACC,EAAD,CACEC,MAAOpB,EACPQ,WAAYA,EACZG,WAAYA,EACZU,UAAWC,IACXC,QAASD,IACTE,cAAeF,IACfpB,KAAMA,EACNG,aAAcO,EACda,aAAchB,EAAMiB,aAAY,IAAMd,GAASe,IAAcA,KAAW,CAACf,IACzEN,MAAOA,EACPC,eAAgBA,GAEfN,qBAWP,MAMM2B,eAAgBnB,EAAMoB,YAC1B,CAAC9B,EAAwC+B,KACvC,MAAM9B,cAAEA,KA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,EAFlB,qBAEoD,CAC7EC,YA1QmB,gBA2QnBC,UAxEiB,cAyEjBC,SAAU,qCAKZ,MA0CMC,EAAOrI,iBACb,MAAMsI,EAAUxG,oBAChB,MAAMyG,EAAStF,mBACf,MAAMuF,EAAU7E,oBAChB,MAAM8E,EAAUlE,oBAChB,MAAMmE,EAAQnB,kBACd,MAAMoB,EAAcjB,wBACpB,MAAMkB,EAAQf","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/dialog/src/Dialog.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 { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContext, createContextScope } from '@radix-ui/react-context';\nimport { useId } from '@radix-ui/react-id';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { UnstablePortal } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { hideOthers } from 'aria-hidden';\nimport { Slot } 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 * Dialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst DIALOG_NAME = 'Dialog';\n\ntype ScopedProps<P> = P & { __scopeDialog?: Scope };\nconst [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);\n\ntype DialogContextValue = {\n triggerRef: React.RefObject<HTMLButtonElement>;\n contentRef: React.RefObject<DialogContentElement>;\n contentId: string;\n titleId: string;\n descriptionId: string;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n allowPinchZoom: DialogProps['allowPinchZoom'];\n};\n\nconst [DialogProvider, useDialogContext] = createDialogContext<DialogContextValue>(DIALOG_NAME);\n\ntype RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>;\ninterface DialogProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n modal?: boolean;\n /**\n * @see https://github.com/theKashey/react-remove-scroll#usage\n */\n allowPinchZoom?: RemoveScrollProps['allowPinchZoom'];\n}\n\nconst Dialog: React.FC<DialogProps> = (props: ScopedProps<DialogProps>) => {\n const {\n __scopeDialog,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n allowPinchZoom,\n } = props;\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const contentRef = React.useRef<DialogContentElement>(null);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <DialogProvider\n scope={__scopeDialog}\n triggerRef={triggerRef}\n contentRef={contentRef}\n contentId={useId()}\n titleId={useId()}\n descriptionId={useId()}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n allowPinchZoom={allowPinchZoom}\n >\n {children}\n </DialogProvider>\n );\n};\n\nDialog.displayName = DIALOG_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DialogTrigger';\n\ntype DialogTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface DialogTriggerProps extends PrimitiveButtonProps {}\n\nconst DialogTrigger = React.forwardRef<DialogTriggerElement, DialogTriggerProps>(\n (props: ScopedProps<DialogTriggerProps>, forwardedRef) => {\n const { __scopeDialog, ...triggerProps } = props;\n const context = useDialogContext(TRIGGER_NAME, __scopeDialog);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n return (\n <Primitive.button\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onClick={composeEventHandlers(props.onClick, context.onOpenToggle)}\n />\n );\n }\n);\n\nDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DialogPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createDialogContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof UnstablePortal>;\ninterface DialogPortalProps extends Omit<PortalProps, 'asChild'> {\n children?: React.ReactNode;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogPortal: React.FC<DialogPortalProps> = (props: ScopedProps<DialogPortalProps>) => {\n const { __scopeDialog, forceMount, children, container } = props;\n const context = useDialogContext(PORTAL_NAME, __scopeDialog);\n return (\n <PortalProvider scope={__scopeDialog} forceMount={forceMount}>\n {React.Children.map(children, (child) => (\n <Presence present={forceMount || context.open}>\n <UnstablePortal asChild container={container}>\n {child}\n </UnstablePortal>\n </Presence>\n ))}\n </PortalProvider>\n );\n};\n\nDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'DialogOverlay';\n\ntype DialogOverlayElement = DialogOverlayImplElement;\ninterface DialogOverlayProps extends DialogOverlayImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogOverlay = React.forwardRef<DialogOverlayElement, DialogOverlayProps>(\n (props: ScopedProps<DialogOverlayProps>, forwardedRef) => {\n const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);\n return context.modal ? (\n <Presence present={forceMount || context.open}>\n <DialogOverlayImpl {...overlayProps} ref={forwardedRef} />\n </Presence>\n ) : null;\n }\n);\n\nDialogOverlay.displayName = OVERLAY_NAME;\n\ntype DialogOverlayImplElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface DialogOverlayImplProps extends PrimitiveDivProps {}\n\nconst DialogOverlayImpl = React.forwardRef<DialogOverlayImplElement, DialogOverlayImplProps>(\n (props: ScopedProps<DialogOverlayImplProps>, forwardedRef) => {\n const { __scopeDialog, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog);\n return (\n // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`\n // ie. when `Overlay` and `Content` are siblings\n <RemoveScroll as={Slot} allowPinchZoom={context.allowPinchZoom} shards={[context.contentRef]}>\n <Primitive.div\n data-state={getState(context.open)}\n {...overlayProps}\n ref={forwardedRef}\n // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.\n style={{ pointerEvents: 'auto', ...overlayProps.style }}\n />\n </RemoveScroll>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DialogContent';\n\ntype DialogContentElement = DialogContentTypeElement;\ninterface DialogContentProps extends DialogContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogContent = React.forwardRef<DialogContentElement, DialogContentProps>(\n (props: ScopedProps<DialogContentProps>, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n return (\n <Presence present={forceMount || context.open}>\n {context.modal ? (\n <DialogContentModal {...contentProps} ref={forwardedRef} />\n ) : (\n <DialogContentNonModal {...contentProps} ref={forwardedRef} />\n )}\n </Presence>\n );\n }\n);\n\nDialogContent.displayName = CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentTypeElement = DialogContentImplElement;\ninterface DialogContentTypeProps\n extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {}\n\nconst DialogContentModal = React.forwardRef<DialogContentTypeElement, DialogContentTypeProps>(\n (props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <DialogContentImpl\n {...props}\n ref={composedRefs}\n // we make sure focus isn't trapped once `DialogContent` has been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n // If the event is a right-click, we shouldn't close because\n // it is effectively as if we right-clicked the `Overlay`.\n if (isRightClick) event.preventDefault();\n })}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) =>\n event.preventDefault()\n )}\n />\n );\n }\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst DialogContentNonModal = React.forwardRef<DialogContentTypeElement, DialogContentTypeProps>(\n (props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n <DialogContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) hasInteractedOutsideRef.current = true;\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n //\n // We use `onInteractOutside` as some browsers also\n // focus on pointer down, creating the same issue.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n }}\n />\n );\n }\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentImplElement = React.ElementRef<typeof DismissableLayer>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;\ninterface DialogContentImplProps extends Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * When `true`, focus cannot escape the `Content` via keyboard,\n * pointer, or a programmatic focus.\n * @defaultValue false\n */\n trapFocus?: FocusScopeProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n}\n\nconst DialogContentImpl = React.forwardRef<DialogContentImplElement, DialogContentImplProps>(\n (props: ScopedProps<DialogContentImplProps>, forwardedRef) => {\n const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, __scopeDialog);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n\n // Make sure the whole tree has focus guards as our `Dialog` will be\n // the last element in the DOM (beacuse of the `Portal`)\n useFocusGuards();\n\n return (\n <>\n <FocusScope\n asChild\n loop\n trapped={trapFocus}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <DismissableLayer\n role=\"dialog\"\n id={context.contentId}\n aria-describedby={context.descriptionId}\n aria-labelledby={context.titleId}\n data-state={getState(context.open)}\n {...contentProps}\n ref={composedRefs}\n onDismiss={() => context.onOpenChange(false)}\n />\n </FocusScope>\n {process.env.NODE_ENV !== 'production' && (\n <>\n <TitleWarning titleId={context.titleId} />\n <DescriptionWarning contentRef={contentRef} descriptionId={context.descriptionId} />\n </>\n )}\n </>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'DialogTitle';\n\ntype DialogTitleElement = React.ElementRef<typeof Primitive.h2>;\ntype PrimitiveHeading2Props = Radix.ComponentPropsWithoutRef<typeof Primitive.h2>;\ninterface DialogTitleProps extends PrimitiveHeading2Props {}\n\nconst DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>(\n (props: ScopedProps<DialogTitleProps>, forwardedRef) => {\n const { __scopeDialog, ...titleProps } = props;\n const context = useDialogContext(TITLE_NAME, __scopeDialog);\n return <Primitive.h2 id={context.titleId} {...titleProps} ref={forwardedRef} />;\n }\n);\n\nDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'DialogDescription';\n\ntype DialogDescriptionElement = React.ElementRef<typeof Primitive.p>;\ntype PrimitiveParagraphProps = Radix.ComponentPropsWithoutRef<typeof Primitive.p>;\ninterface DialogDescriptionProps extends PrimitiveParagraphProps {}\n\nconst DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>(\n (props: ScopedProps<DialogDescriptionProps>, forwardedRef) => {\n const { __scopeDialog, ...descriptionProps } = props;\n const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);\n return <Primitive.p id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />;\n }\n);\n\nDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'DialogClose';\n\ntype DialogCloseElement = React.ElementRef<typeof Primitive.button>;\ninterface DialogCloseProps extends PrimitiveButtonProps {}\n\nconst DialogClose = React.forwardRef<DialogCloseElement, DialogCloseProps>(\n (props: ScopedProps<DialogCloseProps>, forwardedRef) => {\n const { __scopeDialog, ...closeProps } = props;\n const context = useDialogContext(CLOSE_NAME, __scopeDialog);\n return (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, () => context.onOpenChange(false))}\n />\n );\n }\n);\n\nDialogClose.displayName = CLOSE_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nconst TITLE_WARNING_NAME = 'DialogTitleWarning';\n\nconst [WarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {\n contentName: CONTENT_NAME,\n titleName: TITLE_NAME,\n docsSlug: 'dialog',\n});\n\ntype TitleWarningProps = { titleId?: string };\n\nconst TitleWarning: React.FC<TitleWarningProps> = ({ titleId }) => {\n const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);\n\n const MESSAGE = `\\`${titleWarningContext.contentName}\\` requires a \\`${titleWarningContext.titleName}\\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \\`${titleWarningContext.titleName}\\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;\n\n React.useEffect(() => {\n if (titleId) {\n const hasTitle = document.getElementById(titleId);\n if (!hasTitle) throw new Error(MESSAGE);\n }\n }, [MESSAGE, titleId]);\n\n return null;\n};\n\nconst DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning';\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<DialogContentElement>;\n descriptionId?: string;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef, descriptionId }) => {\n const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);\n const MESSAGE = `Warning: Missing \\`Description\\` or \\`aria-describedby={undefined}\\` for {${descriptionWarningContext.contentName}}.`;\n\n React.useEffect(() => {\n const describedById = contentRef.current?.getAttribute('aria-describedby');\n // if we have an id and the user hasn't set aria-describedby={undefined}\n if (descriptionId && describedById) {\n const hasDescription = document.getElementById(descriptionId);\n if (!hasDescription) console.warn(MESSAGE);\n }\n }, [MESSAGE, contentRef, descriptionId]);\n\n return null;\n};\n\nconst Root = Dialog;\nconst Trigger = DialogTrigger;\nconst Portal = DialogPortal;\nconst Overlay = DialogOverlay;\nconst Content = DialogContent;\nconst Title = DialogTitle;\nconst Description = DialogDescription;\nconst Close = DialogClose;\n\nexport {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Title,\n Description,\n Close,\n //\n WarningProvider,\n};\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogCloseProps,\n};\n"],"names":["dest","source","a","Object","keys","forEach","key","defineProperty","enumerable","get","__esModule","default","createDialogContext","createDialogScope","createContextScope","DialogProvider","useDialogContext","Dialog","props","__scopeDialog","children","open","openProp","defaultOpen","onOpenChange","modal","allowPinchZoom","triggerRef","React","useRef","contentRef","setOpen","useControllableState","prop","defaultProp","onChange","_react","createElement","$b0496301423b3238f89fb15bee25ad02$var$DialogProvider","scope","contentId","useId","titleId","descriptionId","onOpenToggle","useCallback","prevOpen","DialogTrigger","forwardRef","forwardedRef","triggerProps","context","composedTriggerRef","useComposedRefs","Primitive","button","_babelRuntimeHelpersExtends","type","getState","ref","onClick","composeEventHandlers","PortalProvider","usePortalContext","forceMount","undefined","DialogPortal","container","$b0496301423b3238f89fb15bee25ad02$var$PortalProvider","Children","map","child","Presence","present","UnstablePortal","asChild","DialogOverlay","portalContext","overlayProps","$b0496301423b3238f89fb15bee25ad02$var$DialogOverlayImpl","DialogOverlayImpl","RemoveScroll","as","Slot","shards","div","style","pointerEvents","DialogContent","contentProps","$b0496301423b3238f89fb15bee25ad02$var$DialogContentModal","$b0496301423b3238f89fb15bee25ad02$var$DialogContentNonModal","DialogContentModal","composedRefs","useEffect","content","current","hideOthers","$b0496301423b3238f89fb15bee25ad02$var$DialogContentImpl","trapFocus","disableOutsidePointerEvents","onCloseAutoFocus","event","_context$triggerRef$c","preventDefault","focus","onPointerDownOutside","originalEvent","detail","ctrlLeftClick","ctrlKey","onFocusOutside","DialogContentNonModal","hasInteractedOutsideRef","_props$onCloseAutoFoc","_context$triggerRef$c2","call","defaultPrevented","onInteractOutside","_props$onInteractOuts","_context$triggerRef$c3","target","contains","DialogContentImpl","onOpenAutoFocus","useFocusGuards","Fragment","FocusScope","loop","trapped","onMountAutoFocus","onUnmountAutoFocus","DismissableLayer","role","id","onDismiss","DialogTitle","titleProps","h2","DialogDescription","descriptionProps","p","DialogClose","closeProps","WarningProvider","useWarningContext","createContext","contentName","titleName","docsSlug","Root","Trigger","Portal","Overlay","Content","Title","Description","Close"],"version":3,"file":"index.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;;;ACmBA;;oGAEA,CAEA,MAAMkC,iCAAW,GAAG,QAApB,AAAA;AAGA,MAAM,CAACC,yCAAD,EAAsBnC,yCAAtB,CAAA,GAA2CsB,6CAAkB,CAACY,iCAAD,CAAnE,AAAA;AAcA,MAAM,CAACE,oCAAD,EAAiBC,sCAAjB,CAAA,GAAqCF,yCAAmB,CAAqBD,iCAArB,CAA9D,AAAA;AAUA,MAAMjC,yCAA6B,GAAIqC,CAAAA,KAAD,GAAqC;IACzE,MAAM,E,eACJC,aADI,CAAA,E,UAEJC,QAFI,CAAA,EAGJC,IAAI,EAAEC,QAHF,CAAA,E,aAIJC,WAJI,CAAA,E,cAKJC,YALI,CAAA,SAMJC,KAAK,GAAG,IAARA,GANI,GAOFP,KAPJ,AAAM;IAQN,MAAMQ,UAAU,GAAG5B,mBAAA,CAAgC,IAAhC,CAAnB,AAAA;IACA,MAAM8B,UAAU,GAAG9B,mBAAA,CAAmC,IAAnC,CAAnB,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AiC,kBAAjC,CAAtB,AADoB,EAEpB,wEADA;QAEA,IAAI3B,aAAa,IAAI0B,aAArB,EAAoC;YAClC,MAAME,cAAc,GAAGR,QAAQ,CAACC,cAAT,CAAwBrB,aAAxB,CAAvB,AAAA;YACA,IAAI,CAAC4B,cAAL,EAAqBC,OAAO,CAACC,IAAR,CAAaZ,OAAb,CAArB,CAAA;SACD;KANH,EAOG;QAACA,OAAD;QAAU/E,UAAV;QAAsB6D,aAAtB;KAPH,CAOC,CAAA;IAED,OAAO,IAAP,CAAA;CAbF,AAcC;AAED,MAAMpG,yCAAI,GAAGR,yCAAb,AAAA;AACA,MAAMS,yCAAO,GAAGR,yCAAhB,AAAA;AACA,MAAMS,yCAAM,GAAGR,yCAAf,AAAA;AACA,MAAMS,yCAAO,GAAGR,yCAAhB,AAAA;AACA,MAAMS,yCAAO,GAAGR,yCAAhB,AAAA;AACA,MAAMS,yCAAK,GAAGR,yCAAd,AAAA;AACA,MAAMS,yCAAW,GAAGR,yCAApB,AAAA;AACA,MAAMS,yCAAK,GAAGR,yCAAd,AAAA;;AD1hBA","sources":["packages/react/dialog/src/index.ts","packages/react/dialog/src/Dialog.tsx"],"sourcesContent":["export {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Title,\n Description,\n Close,\n //\n WarningProvider,\n} from './Dialog';\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogCloseProps,\n} from './Dialog';\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContext, createContextScope } from '@radix-ui/react-context';\nimport { useId } from '@radix-ui/react-id';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { hideOthers } from 'aria-hidden';\nimport { Slot } 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 * Dialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst DIALOG_NAME = 'Dialog';\n\ntype ScopedProps<P> = P & { __scopeDialog?: Scope };\nconst [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);\n\ntype DialogContextValue = {\n triggerRef: React.RefObject<HTMLButtonElement>;\n contentRef: React.RefObject<DialogContentElement>;\n contentId: string;\n titleId: string;\n descriptionId: string;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n};\n\nconst [DialogProvider, useDialogContext] = createDialogContext<DialogContextValue>(DIALOG_NAME);\n\ninterface DialogProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n modal?: boolean;\n}\n\nconst Dialog: React.FC<DialogProps> = (props: ScopedProps<DialogProps>) => {\n const {\n __scopeDialog,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n } = props;\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const contentRef = React.useRef<DialogContentElement>(null);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <DialogProvider\n scope={__scopeDialog}\n triggerRef={triggerRef}\n contentRef={contentRef}\n contentId={useId()}\n titleId={useId()}\n descriptionId={useId()}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n >\n {children}\n </DialogProvider>\n );\n};\n\nDialog.displayName = DIALOG_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DialogTrigger';\n\ntype DialogTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface DialogTriggerProps extends PrimitiveButtonProps {}\n\nconst DialogTrigger = React.forwardRef<DialogTriggerElement, DialogTriggerProps>(\n (props: ScopedProps<DialogTriggerProps>, forwardedRef) => {\n const { __scopeDialog, ...triggerProps } = props;\n const context = useDialogContext(TRIGGER_NAME, __scopeDialog);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n return (\n <Primitive.button\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onClick={composeEventHandlers(props.onClick, context.onOpenToggle)}\n />\n );\n }\n);\n\nDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DialogPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createDialogContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface DialogPortalProps extends Omit<PortalProps, 'asChild'> {\n children?: React.ReactNode;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogPortal: React.FC<DialogPortalProps> = (props: ScopedProps<DialogPortalProps>) => {\n const { __scopeDialog, forceMount, children, container } = props;\n const context = useDialogContext(PORTAL_NAME, __scopeDialog);\n return (\n <PortalProvider scope={__scopeDialog} forceMount={forceMount}>\n {React.Children.map(children, (child) => (\n <Presence present={forceMount || context.open}>\n <PortalPrimitive asChild container={container}>\n {child}\n </PortalPrimitive>\n </Presence>\n ))}\n </PortalProvider>\n );\n};\n\nDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'DialogOverlay';\n\ntype DialogOverlayElement = DialogOverlayImplElement;\ninterface DialogOverlayProps extends DialogOverlayImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogOverlay = React.forwardRef<DialogOverlayElement, DialogOverlayProps>(\n (props: ScopedProps<DialogOverlayProps>, forwardedRef) => {\n const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);\n return context.modal ? (\n <Presence present={forceMount || context.open}>\n <DialogOverlayImpl {...overlayProps} ref={forwardedRef} />\n </Presence>\n ) : null;\n }\n);\n\nDialogOverlay.displayName = OVERLAY_NAME;\n\ntype DialogOverlayImplElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface DialogOverlayImplProps extends PrimitiveDivProps {}\n\nconst DialogOverlayImpl = React.forwardRef<DialogOverlayImplElement, DialogOverlayImplProps>(\n (props: ScopedProps<DialogOverlayImplProps>, forwardedRef) => {\n const { __scopeDialog, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog);\n return (\n // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`\n // ie. when `Overlay` and `Content` are siblings\n <RemoveScroll as={Slot} allowPinchZoom shards={[context.contentRef]}>\n <Primitive.div\n data-state={getState(context.open)}\n {...overlayProps}\n ref={forwardedRef}\n // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.\n style={{ pointerEvents: 'auto', ...overlayProps.style }}\n />\n </RemoveScroll>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DialogContent';\n\ntype DialogContentElement = DialogContentTypeElement;\ninterface DialogContentProps extends DialogContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogContent = React.forwardRef<DialogContentElement, DialogContentProps>(\n (props: ScopedProps<DialogContentProps>, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n return (\n <Presence present={forceMount || context.open}>\n {context.modal ? (\n <DialogContentModal {...contentProps} ref={forwardedRef} />\n ) : (\n <DialogContentNonModal {...contentProps} ref={forwardedRef} />\n )}\n </Presence>\n );\n }\n);\n\nDialogContent.displayName = CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentTypeElement = DialogContentImplElement;\ninterface DialogContentTypeProps\n extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {}\n\nconst DialogContentModal = React.forwardRef<DialogContentTypeElement, DialogContentTypeProps>(\n (props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <DialogContentImpl\n {...props}\n ref={composedRefs}\n // we make sure focus isn't trapped once `DialogContent` has been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n // If the event is a right-click, we shouldn't close because\n // it is effectively as if we right-clicked the `Overlay`.\n if (isRightClick) event.preventDefault();\n })}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) =>\n event.preventDefault()\n )}\n />\n );\n }\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst DialogContentNonModal = React.forwardRef<DialogContentTypeElement, DialogContentTypeProps>(\n (props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n <DialogContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) hasInteractedOutsideRef.current = true;\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n //\n // We use `onInteractOutside` as some browsers also\n // focus on pointer down, creating the same issue.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n }}\n />\n );\n }\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentImplElement = React.ElementRef<typeof DismissableLayer>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;\ninterface DialogContentImplProps extends Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * When `true`, focus cannot escape the `Content` via keyboard,\n * pointer, or a programmatic focus.\n * @defaultValue false\n */\n trapFocus?: FocusScopeProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n}\n\nconst DialogContentImpl = React.forwardRef<DialogContentImplElement, DialogContentImplProps>(\n (props: ScopedProps<DialogContentImplProps>, forwardedRef) => {\n const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, __scopeDialog);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n\n // Make sure the whole tree has focus guards as our `Dialog` will be\n // the last element in the DOM (beacuse of the `Portal`)\n useFocusGuards();\n\n return (\n <>\n <FocusScope\n asChild\n loop\n trapped={trapFocus}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <DismissableLayer\n role=\"dialog\"\n id={context.contentId}\n aria-describedby={context.descriptionId}\n aria-labelledby={context.titleId}\n data-state={getState(context.open)}\n {...contentProps}\n ref={composedRefs}\n onDismiss={() => context.onOpenChange(false)}\n />\n </FocusScope>\n {process.env.NODE_ENV !== 'production' && (\n <>\n <TitleWarning titleId={context.titleId} />\n <DescriptionWarning contentRef={contentRef} descriptionId={context.descriptionId} />\n </>\n )}\n </>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'DialogTitle';\n\ntype DialogTitleElement = React.ElementRef<typeof Primitive.h2>;\ntype PrimitiveHeading2Props = Radix.ComponentPropsWithoutRef<typeof Primitive.h2>;\ninterface DialogTitleProps extends PrimitiveHeading2Props {}\n\nconst DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>(\n (props: ScopedProps<DialogTitleProps>, forwardedRef) => {\n const { __scopeDialog, ...titleProps } = props;\n const context = useDialogContext(TITLE_NAME, __scopeDialog);\n return <Primitive.h2 id={context.titleId} {...titleProps} ref={forwardedRef} />;\n }\n);\n\nDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'DialogDescription';\n\ntype DialogDescriptionElement = React.ElementRef<typeof Primitive.p>;\ntype PrimitiveParagraphProps = Radix.ComponentPropsWithoutRef<typeof Primitive.p>;\ninterface DialogDescriptionProps extends PrimitiveParagraphProps {}\n\nconst DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>(\n (props: ScopedProps<DialogDescriptionProps>, forwardedRef) => {\n const { __scopeDialog, ...descriptionProps } = props;\n const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);\n return <Primitive.p id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />;\n }\n);\n\nDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'DialogClose';\n\ntype DialogCloseElement = React.ElementRef<typeof Primitive.button>;\ninterface DialogCloseProps extends PrimitiveButtonProps {}\n\nconst DialogClose = React.forwardRef<DialogCloseElement, DialogCloseProps>(\n (props: ScopedProps<DialogCloseProps>, forwardedRef) => {\n const { __scopeDialog, ...closeProps } = props;\n const context = useDialogContext(CLOSE_NAME, __scopeDialog);\n return (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, () => context.onOpenChange(false))}\n />\n );\n }\n);\n\nDialogClose.displayName = CLOSE_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nconst TITLE_WARNING_NAME = 'DialogTitleWarning';\n\nconst [WarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {\n contentName: CONTENT_NAME,\n titleName: TITLE_NAME,\n docsSlug: 'dialog',\n});\n\ntype TitleWarningProps = { titleId?: string };\n\nconst TitleWarning: React.FC<TitleWarningProps> = ({ titleId }) => {\n const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);\n\n const MESSAGE = `\\`${titleWarningContext.contentName}\\` requires a \\`${titleWarningContext.titleName}\\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \\`${titleWarningContext.titleName}\\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;\n\n React.useEffect(() => {\n if (titleId) {\n const hasTitle = document.getElementById(titleId);\n if (!hasTitle) throw new Error(MESSAGE);\n }\n }, [MESSAGE, titleId]);\n\n return null;\n};\n\nconst DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning';\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<DialogContentElement>;\n descriptionId?: string;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef, descriptionId }) => {\n const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);\n const MESSAGE = `Warning: Missing \\`Description\\` or \\`aria-describedby={undefined}\\` for {${descriptionWarningContext.contentName}}.`;\n\n React.useEffect(() => {\n const describedById = contentRef.current?.getAttribute('aria-describedby');\n // if we have an id and the user hasn't set aria-describedby={undefined}\n if (descriptionId && describedById) {\n const hasDescription = document.getElementById(descriptionId);\n if (!hasDescription) console.warn(MESSAGE);\n }\n }, [MESSAGE, contentRef, descriptionId]);\n\n return null;\n};\n\nconst Root = Dialog;\nconst Trigger = DialogTrigger;\nconst Portal = DialogPortal;\nconst Overlay = DialogOverlay;\nconst Content = DialogContent;\nconst Title = DialogTitle;\nconst Description = DialogDescription;\nconst Close = DialogClose;\n\nexport {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Title,\n Description,\n Close,\n //\n WarningProvider,\n};\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogCloseProps,\n};\n"],"names":["createDialogScope","Dialog","DialogTrigger","DialogPortal","DialogOverlay","DialogContent","DialogTitle","DialogDescription","DialogClose","Root","Trigger","Portal","Overlay","Content","Title","Description","Close","WarningProvider","React","composeEventHandlers","useComposedRefs","createContext","createContextScope","useId","useControllableState","DismissableLayer","FocusScope","PortalPrimitive","Presence","Primitive","useFocusGuards","RemoveScroll","hideOthers","Slot","DIALOG_NAME","createDialogContext","DialogProvider","useDialogContext","props","__scopeDialog","children","open","openProp","defaultOpen","onOpenChange","modal","triggerRef","useRef","contentRef","setOpen","prop","defaultProp","onChange","useCallback","prevOpen","TRIGGER_NAME","forwardRef","forwardedRef","triggerProps","context","composedTriggerRef","contentId","getState","onClick","onOpenToggle","PORTAL_NAME","PortalProvider","usePortalContext","forceMount","undefined","container","Children","map","child","OVERLAY_NAME","portalContext","overlayProps","DialogOverlayImpl","pointerEvents","style","CONTENT_NAME","contentProps","DialogContentModal","composedRefs","useEffect","content","current","onCloseAutoFocus","event","preventDefault","focus","onPointerDownOutside","originalEvent","detail","ctrlLeftClick","button","ctrlKey","isRightClick","onFocusOutside","DialogContentNonModal","hasInteractedOutsideRef","defaultPrevented","onInteractOutside","target","targetIsTrigger","contains","DialogContentImpl","trapFocus","onOpenAutoFocus","descriptionId","titleId","process","env","NODE_ENV","TITLE_NAME","titleProps","DESCRIPTION_NAME","descriptionProps","CLOSE_NAME","closeProps","TITLE_WARNING_NAME","useWarningContext","contentName","titleName","docsSlug","TitleWarning","titleWarningContext","MESSAGE","hasTitle","document","getElementById","Error","DESCRIPTION_WARNING_NAME","DescriptionWarning","descriptionWarningContext","describedById","getAttribute","hasDescription","console","warn"],"version":3,"file":"index.js.map"}
@@ -1,2 +1,359 @@
1
- import{Slot as e}from"@radix-ui/react-slot";import{hideOthers as o}from"aria-hidden";import{RemoveScroll as t}from"react-remove-scroll";import{useFocusGuards as r}from"@radix-ui/react-focus-guards";import{Primitive as n}from"@radix-ui/react-primitive";import{Presence as a}from"@radix-ui/react-presence";import{UnstablePortal as i}from"@radix-ui/react-portal";import{FocusScope as l}from"@radix-ui/react-focus-scope";import{DismissableLayer as c}from"@radix-ui/react-dismissable-layer";import{useControllableState as s}from"@radix-ui/react-use-controllable-state";import{useId as u}from"@radix-ui/react-id";import{createContext as p,createContextScope as d}from"@radix-ui/react-context";import{useComposedRefs as f}from"@radix-ui/react-compose-refs";import{composeEventHandlers as g}from"@radix-ui/primitive";import*as m from"react";import D from"@babel/runtime/helpers/esm/extends";const[x,v]=d("Dialog");export{v as createDialogScope};const[C,_]=x("Dialog");export const Dialog=e=>{const{__scopeDialog:o,children:t,open:r,defaultOpen:n,onOpenChange:a,modal:i=!0,allowPinchZoom:l}=e,c=m.useRef(null),p=m.useRef(null),[d=!1,f]=s({prop:r,defaultProp:n,onChange:a});/*#__PURE__*/return m.createElement(C,{scope:o,triggerRef:c,contentRef:p,contentId:u(),titleId:u(),descriptionId:u(),open:d,onOpenChange:f,onOpenToggle:m.useCallback((()=>f((e=>!e))),[f]),modal:i,allowPinchZoom:l},t)};/*#__PURE__*/export const DialogTrigger=/*#__PURE__*/m.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,a=_("DialogTrigger",t),i=f(o,a.triggerRef);/*#__PURE__*/return m.createElement(n.button,D({type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":P(a.open)},r,{ref:i,onClick:g(e.onClick,a.onOpenToggle)}))}));/*#__PURE__*/const[E,R]=x("DialogPortal",{forceMount:void 0});export const DialogPortal=e=>{const{__scopeDialog:o,forceMount:t,children:r,container:n}=e,l=_("DialogPortal",o);/*#__PURE__*/return m.createElement(E,{scope:o,forceMount:t},m.Children.map(r,(e=>/*#__PURE__*/m.createElement(a,{present:t||l.open},/*#__PURE__*/m.createElement(i,{asChild:!0,container:n},e)))))};/*#__PURE__*/export const DialogOverlay=/*#__PURE__*/m.forwardRef(((e,o)=>{const t=R("DialogOverlay",e.__scopeDialog),{forceMount:r=t.forceMount,...n}=e,i=_("DialogOverlay",e.__scopeDialog);return i.modal?/*#__PURE__*/m.createElement(a,{present:r||i.open},/*#__PURE__*/m.createElement(O,D({},n,{ref:o}))):null}));/*#__PURE__*/const O=/*#__PURE__*/m.forwardRef(((o,r)=>{const{__scopeDialog:a,...i}=o,l=_("DialogOverlay",a);/*#__PURE__*/return m.createElement(t,{as:e,allowPinchZoom:l.allowPinchZoom,shards:[l.contentRef]},/*#__PURE__*/m.createElement(n.div,D({"data-state":P(l.open)},i,{ref:r,style:{pointerEvents:"auto",...i.style}})))}));export const DialogContent=/*#__PURE__*/m.forwardRef(((e,o)=>{const t=R("DialogContent",e.__scopeDialog),{forceMount:r=t.forceMount,...n}=e,i=_("DialogContent",e.__scopeDialog);/*#__PURE__*/return m.createElement(a,{present:r||i.open},i.modal?/*#__PURE__*/m.createElement(h,D({},n,{ref:o})):/*#__PURE__*/m.createElement(b,D({},n,{ref:o})))}));/*#__PURE__*/const h=/*#__PURE__*/m.forwardRef(((e,t)=>{const r=_("DialogContent",e.__scopeDialog),n=m.useRef(null),a=f(t,r.contentRef,n);return m.useEffect((()=>{const e=n.current;if(e)return o(e)}),[]),/*#__PURE__*/m.createElement(w,D({},e,{ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(e.onCloseAutoFocus,(e=>{var o;e.preventDefault(),null===(o=r.triggerRef.current)||void 0===o||o.focus()})),onPointerDownOutside:g(e.onPointerDownOutside,(e=>{const o=e.detail.originalEvent,t=0===o.button&&!0===o.ctrlKey;(2===o.button||t)&&e.preventDefault()})),onFocusOutside:g(e.onFocusOutside,(e=>e.preventDefault()))}))})),b=/*#__PURE__*/m.forwardRef(((e,o)=>{const t=_("DialogContent",e.__scopeDialog),r=m.useRef(!1);/*#__PURE__*/return m.createElement(w,D({},e,{ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var n,a;(null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,o),o.defaultPrevented)||(r.current||null===(a=t.triggerRef.current)||void 0===a||a.focus(),o.preventDefault());r.current=!1},onInteractOutside:o=>{var n,a;null===(n=e.onInteractOutside)||void 0===n||n.call(e,o),o.defaultPrevented||(r.current=!0);const i=o.target;(null===(a=t.triggerRef.current)||void 0===a?void 0:a.contains(i))&&o.preventDefault()}}))})),w=/*#__PURE__*/m.forwardRef(((e,o)=>{const{__scopeDialog:t,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,...s}=e,u=_("DialogContent",t),p=m.useRef(null),d=f(o,p);return r(),/*#__PURE__*/m.createElement(m.Fragment,null,/*#__PURE__*/m.createElement(l,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i},/*#__PURE__*/m.createElement(c,D({role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":P(u.open)},s,{ref:d,onDismiss:()=>u.onOpenChange(!1)}))),!1)}));export const DialogTitle=/*#__PURE__*/m.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,a=_("DialogTitle",t);/*#__PURE__*/return m.createElement(n.h2,D({id:a.titleId},r,{ref:o}))}));/*#__PURE__*/export const DialogDescription=/*#__PURE__*/m.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,a=_("DialogDescription",t);/*#__PURE__*/return m.createElement(n.p,D({id:a.descriptionId},r,{ref:o}))}));/*#__PURE__*/export const DialogClose=/*#__PURE__*/m.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,a=_("DialogClose",t);/*#__PURE__*/return m.createElement(n.button,D({type:"button"},r,{ref:o,onClick:g(e.onClick,(()=>a.onOpenChange(!1)))}))}));/*#__PURE__*/function P(e){return e?"open":"closed"}const[y,F]=p("DialogTitleWarning",{contentName:"DialogContent",titleName:"DialogTitle",docsSlug:"dialog"});export{y as WarningProvider};export const Root=Dialog;export const Trigger=DialogTrigger;export const Portal=DialogPortal;export const Overlay=DialogOverlay;export const Content=DialogContent;export const Title=DialogTitle;export const Description=DialogDescription;export const Close=DialogClose;
1
+ import $67UHm$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
2
+ import {useRef as $67UHm$useRef, createElement as $67UHm$createElement, useCallback as $67UHm$useCallback, forwardRef as $67UHm$forwardRef, Children as $67UHm$Children, useEffect as $67UHm$useEffect, Fragment as $67UHm$Fragment} from "react";
3
+ import {composeEventHandlers as $67UHm$composeEventHandlers} from "@radix-ui/primitive";
4
+ import {useComposedRefs as $67UHm$useComposedRefs} from "@radix-ui/react-compose-refs";
5
+ import {createContextScope as $67UHm$createContextScope, createContext as $67UHm$createContext} from "@radix-ui/react-context";
6
+ import {useId as $67UHm$useId} from "@radix-ui/react-id";
7
+ import {useControllableState as $67UHm$useControllableState} from "@radix-ui/react-use-controllable-state";
8
+ import {DismissableLayer as $67UHm$DismissableLayer} from "@radix-ui/react-dismissable-layer";
9
+ import {FocusScope as $67UHm$FocusScope} from "@radix-ui/react-focus-scope";
10
+ import {Portal as $67UHm$Portal} from "@radix-ui/react-portal";
11
+ import {Presence as $67UHm$Presence} from "@radix-ui/react-presence";
12
+ import {Primitive as $67UHm$Primitive} from "@radix-ui/react-primitive";
13
+ import {useFocusGuards as $67UHm$useFocusGuards} from "@radix-ui/react-focus-guards";
14
+ import {RemoveScroll as $67UHm$RemoveScroll} from "react-remove-scroll";
15
+ import {hideOthers as $67UHm$hideOthers} from "aria-hidden";
16
+ import {Slot as $67UHm$Slot} from "@radix-ui/react-slot";
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+ /* -------------------------------------------------------------------------------------------------
35
+ * Dialog
36
+ * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DIALOG_NAME = 'Dialog';
37
+ const [$5d3850c4d0b4e6c7$var$createDialogContext, $5d3850c4d0b4e6c7$export$cc702773b8ea3e41] = $67UHm$createContextScope($5d3850c4d0b4e6c7$var$DIALOG_NAME);
38
+ const [$5d3850c4d0b4e6c7$var$DialogProvider, $5d3850c4d0b4e6c7$var$useDialogContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$DIALOG_NAME);
39
+ const $5d3850c4d0b4e6c7$export$3ddf2d174ce01153 = (props)=>{
40
+ const { __scopeDialog: __scopeDialog , children: children , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , modal: modal = true } = props;
41
+ const triggerRef = $67UHm$useRef(null);
42
+ const contentRef = $67UHm$useRef(null);
43
+ const [open = false, setOpen] = $67UHm$useControllableState({
44
+ prop: openProp,
45
+ defaultProp: defaultOpen,
46
+ onChange: onOpenChange
47
+ });
48
+ return /*#__PURE__*/ $67UHm$createElement($5d3850c4d0b4e6c7$var$DialogProvider, {
49
+ scope: __scopeDialog,
50
+ triggerRef: triggerRef,
51
+ contentRef: contentRef,
52
+ contentId: $67UHm$useId(),
53
+ titleId: $67UHm$useId(),
54
+ descriptionId: $67UHm$useId(),
55
+ open: open,
56
+ onOpenChange: setOpen,
57
+ onOpenToggle: $67UHm$useCallback(()=>setOpen((prevOpen)=>!prevOpen
58
+ )
59
+ , [
60
+ setOpen
61
+ ]),
62
+ modal: modal
63
+ }, children);
64
+ };
65
+ /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$3ddf2d174ce01153, {
66
+ displayName: $5d3850c4d0b4e6c7$var$DIALOG_NAME
67
+ });
68
+ /* -------------------------------------------------------------------------------------------------
69
+ * DialogTrigger
70
+ * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$TRIGGER_NAME = 'DialogTrigger';
71
+ const $5d3850c4d0b4e6c7$export$2e1e1122cf0cba88 = /*#__PURE__*/ $67UHm$forwardRef((props, forwardedRef)=>{
72
+ const { __scopeDialog: __scopeDialog , ...triggerProps } = props;
73
+ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$TRIGGER_NAME, __scopeDialog);
74
+ const composedTriggerRef = $67UHm$useComposedRefs(forwardedRef, context.triggerRef);
75
+ return /*#__PURE__*/ $67UHm$createElement($67UHm$Primitive.button, $67UHm$babelruntimehelpersesmextends({
76
+ type: "button",
77
+ "aria-haspopup": "dialog",
78
+ "aria-expanded": context.open,
79
+ "aria-controls": context.contentId,
80
+ "data-state": $5d3850c4d0b4e6c7$var$getState(context.open)
81
+ }, triggerProps, {
82
+ ref: composedTriggerRef,
83
+ onClick: $67UHm$composeEventHandlers(props.onClick, context.onOpenToggle)
84
+ }));
85
+ });
86
+ /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$2e1e1122cf0cba88, {
87
+ displayName: $5d3850c4d0b4e6c7$var$TRIGGER_NAME
88
+ });
89
+ /* -------------------------------------------------------------------------------------------------
90
+ * DialogPortal
91
+ * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$PORTAL_NAME = 'DialogPortal';
92
+ const [$5d3850c4d0b4e6c7$var$PortalProvider, $5d3850c4d0b4e6c7$var$usePortalContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$PORTAL_NAME, {
93
+ forceMount: undefined
94
+ });
95
+ const $5d3850c4d0b4e6c7$export$dad7c95542bacce0 = (props)=>{
96
+ const { __scopeDialog: __scopeDialog , forceMount: forceMount , children: children , container: container } = props;
97
+ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$PORTAL_NAME, __scopeDialog);
98
+ return /*#__PURE__*/ $67UHm$createElement($5d3850c4d0b4e6c7$var$PortalProvider, {
99
+ scope: __scopeDialog,
100
+ forceMount: forceMount
101
+ }, $67UHm$Children.map(children, (child)=>/*#__PURE__*/ $67UHm$createElement($67UHm$Presence, {
102
+ present: forceMount || context.open
103
+ }, /*#__PURE__*/ $67UHm$createElement($67UHm$Portal, {
104
+ asChild: true,
105
+ container: container
106
+ }, child))
107
+ ));
108
+ };
109
+ /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$dad7c95542bacce0, {
110
+ displayName: $5d3850c4d0b4e6c7$var$PORTAL_NAME
111
+ });
112
+ /* -------------------------------------------------------------------------------------------------
113
+ * DialogOverlay
114
+ * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$OVERLAY_NAME = 'DialogOverlay';
115
+ const $5d3850c4d0b4e6c7$export$bd1d06c79be19e17 = /*#__PURE__*/ $67UHm$forwardRef((props, forwardedRef)=>{
116
+ const portalContext = $5d3850c4d0b4e6c7$var$usePortalContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, props.__scopeDialog);
117
+ const { forceMount: forceMount = portalContext.forceMount , ...overlayProps } = props;
118
+ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, props.__scopeDialog);
119
+ return context.modal ? /*#__PURE__*/ $67UHm$createElement($67UHm$Presence, {
120
+ present: forceMount || context.open
121
+ }, /*#__PURE__*/ $67UHm$createElement($5d3850c4d0b4e6c7$var$DialogOverlayImpl, $67UHm$babelruntimehelpersesmextends({}, overlayProps, {
122
+ ref: forwardedRef
123
+ }))) : null;
124
+ });
125
+ /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$bd1d06c79be19e17, {
126
+ displayName: $5d3850c4d0b4e6c7$var$OVERLAY_NAME
127
+ });
128
+ const $5d3850c4d0b4e6c7$var$DialogOverlayImpl = /*#__PURE__*/ $67UHm$forwardRef((props, forwardedRef)=>{
129
+ const { __scopeDialog: __scopeDialog , ...overlayProps } = props;
130
+ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, __scopeDialog);
131
+ return(/*#__PURE__*/ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
132
+ // ie. when `Overlay` and `Content` are siblings
133
+ $67UHm$createElement($67UHm$RemoveScroll, {
134
+ as: $67UHm$Slot,
135
+ allowPinchZoom: true,
136
+ shards: [
137
+ context.contentRef
138
+ ]
139
+ }, /*#__PURE__*/ $67UHm$createElement($67UHm$Primitive.div, $67UHm$babelruntimehelpersesmextends({
140
+ "data-state": $5d3850c4d0b4e6c7$var$getState(context.open)
141
+ }, overlayProps, {
142
+ ref: forwardedRef // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.
143
+ ,
144
+ style: {
145
+ pointerEvents: 'auto',
146
+ ...overlayProps.style
147
+ }
148
+ }))));
149
+ });
150
+ /* -------------------------------------------------------------------------------------------------
151
+ * DialogContent
152
+ * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$CONTENT_NAME = 'DialogContent';
153
+ const $5d3850c4d0b4e6c7$export$b6d9565de1e068cf = /*#__PURE__*/ $67UHm$forwardRef((props, forwardedRef)=>{
154
+ const portalContext = $5d3850c4d0b4e6c7$var$usePortalContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
155
+ const { forceMount: forceMount = portalContext.forceMount , ...contentProps } = props;
156
+ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
157
+ return /*#__PURE__*/ $67UHm$createElement($67UHm$Presence, {
158
+ present: forceMount || context.open
159
+ }, context.modal ? /*#__PURE__*/ $67UHm$createElement($5d3850c4d0b4e6c7$var$DialogContentModal, $67UHm$babelruntimehelpersesmextends({}, contentProps, {
160
+ ref: forwardedRef
161
+ })) : /*#__PURE__*/ $67UHm$createElement($5d3850c4d0b4e6c7$var$DialogContentNonModal, $67UHm$babelruntimehelpersesmextends({}, contentProps, {
162
+ ref: forwardedRef
163
+ })));
164
+ });
165
+ /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$b6d9565de1e068cf, {
166
+ displayName: $5d3850c4d0b4e6c7$var$CONTENT_NAME
167
+ });
168
+ /* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentModal = /*#__PURE__*/ $67UHm$forwardRef((props, forwardedRef)=>{
169
+ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
170
+ const contentRef = $67UHm$useRef(null);
171
+ const composedRefs = $67UHm$useComposedRefs(forwardedRef, context.contentRef, contentRef); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
172
+ $67UHm$useEffect(()=>{
173
+ const content = contentRef.current;
174
+ if (content) return $67UHm$hideOthers(content);
175
+ }, []);
176
+ return /*#__PURE__*/ $67UHm$createElement($5d3850c4d0b4e6c7$var$DialogContentImpl, $67UHm$babelruntimehelpersesmextends({}, props, {
177
+ ref: composedRefs // we make sure focus isn't trapped once `DialogContent` has been closed
178
+ ,
179
+ trapFocus: context.open,
180
+ disableOutsidePointerEvents: true,
181
+ onCloseAutoFocus: $67UHm$composeEventHandlers(props.onCloseAutoFocus, (event)=>{
182
+ var _context$triggerRef$c;
183
+ event.preventDefault();
184
+ (_context$triggerRef$c = context.triggerRef.current) === null || _context$triggerRef$c === void 0 || _context$triggerRef$c.focus();
185
+ }),
186
+ onPointerDownOutside: $67UHm$composeEventHandlers(props.onPointerDownOutside, (event)=>{
187
+ const originalEvent = event.detail.originalEvent;
188
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
189
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick; // If the event is a right-click, we shouldn't close because
190
+ // it is effectively as if we right-clicked the `Overlay`.
191
+ if (isRightClick) event.preventDefault();
192
+ }) // When focus is trapped, a `focusout` event may still happen.
193
+ ,
194
+ onFocusOutside: $67UHm$composeEventHandlers(props.onFocusOutside, (event)=>event.preventDefault()
195
+ )
196
+ }));
197
+ });
198
+ /* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentNonModal = /*#__PURE__*/ $67UHm$forwardRef((props, forwardedRef)=>{
199
+ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
200
+ const hasInteractedOutsideRef = $67UHm$useRef(false);
201
+ return /*#__PURE__*/ $67UHm$createElement($5d3850c4d0b4e6c7$var$DialogContentImpl, $67UHm$babelruntimehelpersesmextends({}, props, {
202
+ ref: forwardedRef,
203
+ trapFocus: false,
204
+ disableOutsidePointerEvents: false,
205
+ onCloseAutoFocus: (event)=>{
206
+ var _props$onCloseAutoFoc;
207
+ (_props$onCloseAutoFoc = props.onCloseAutoFocus) === null || _props$onCloseAutoFoc === void 0 || _props$onCloseAutoFoc.call(props, event);
208
+ if (!event.defaultPrevented) {
209
+ var _context$triggerRef$c2;
210
+ if (!hasInteractedOutsideRef.current) (_context$triggerRef$c2 = context.triggerRef.current) === null || _context$triggerRef$c2 === void 0 || _context$triggerRef$c2.focus(); // Always prevent auto focus because we either focus manually or want user agent focus
211
+ event.preventDefault();
212
+ }
213
+ hasInteractedOutsideRef.current = false;
214
+ },
215
+ onInteractOutside: (event)=>{
216
+ var _props$onInteractOuts, _context$triggerRef$c3;
217
+ (_props$onInteractOuts = props.onInteractOutside) === null || _props$onInteractOuts === void 0 || _props$onInteractOuts.call(props, event);
218
+ if (!event.defaultPrevented) hasInteractedOutsideRef.current = true; // Prevent dismissing when clicking the trigger.
219
+ // As the trigger is already setup to close, without doing so would
220
+ // cause it to close and immediately open.
221
+ //
222
+ // We use `onInteractOutside` as some browsers also
223
+ // focus on pointer down, creating the same issue.
224
+ const target = event.target;
225
+ const targetIsTrigger = (_context$triggerRef$c3 = context.triggerRef.current) === null || _context$triggerRef$c3 === void 0 ? void 0 : _context$triggerRef$c3.contains(target);
226
+ if (targetIsTrigger) event.preventDefault();
227
+ }
228
+ }));
229
+ });
230
+ /* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentImpl = /*#__PURE__*/ $67UHm$forwardRef((props, forwardedRef)=>{
231
+ const { __scopeDialog: __scopeDialog , trapFocus: trapFocus , onOpenAutoFocus: onOpenAutoFocus , onCloseAutoFocus: onCloseAutoFocus , ...contentProps } = props;
232
+ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, __scopeDialog);
233
+ const contentRef = $67UHm$useRef(null);
234
+ const composedRefs = $67UHm$useComposedRefs(forwardedRef, contentRef); // Make sure the whole tree has focus guards as our `Dialog` will be
235
+ // the last element in the DOM (beacuse of the `Portal`)
236
+ $67UHm$useFocusGuards();
237
+ return /*#__PURE__*/ $67UHm$createElement($67UHm$Fragment, null, /*#__PURE__*/ $67UHm$createElement($67UHm$FocusScope, {
238
+ asChild: true,
239
+ loop: true,
240
+ trapped: trapFocus,
241
+ onMountAutoFocus: onOpenAutoFocus,
242
+ onUnmountAutoFocus: onCloseAutoFocus
243
+ }, /*#__PURE__*/ $67UHm$createElement($67UHm$DismissableLayer, $67UHm$babelruntimehelpersesmextends({
244
+ role: "dialog",
245
+ id: context.contentId,
246
+ "aria-describedby": context.descriptionId,
247
+ "aria-labelledby": context.titleId,
248
+ "data-state": $5d3850c4d0b4e6c7$var$getState(context.open)
249
+ }, contentProps, {
250
+ ref: composedRefs,
251
+ onDismiss: ()=>context.onOpenChange(false)
252
+ }))), false);
253
+ });
254
+ /* -------------------------------------------------------------------------------------------------
255
+ * DialogTitle
256
+ * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$TITLE_NAME = 'DialogTitle';
257
+ const $5d3850c4d0b4e6c7$export$16f7638e4a34b909 = /*#__PURE__*/ $67UHm$forwardRef((props, forwardedRef)=>{
258
+ const { __scopeDialog: __scopeDialog , ...titleProps } = props;
259
+ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$TITLE_NAME, __scopeDialog);
260
+ return /*#__PURE__*/ $67UHm$createElement($67UHm$Primitive.h2, $67UHm$babelruntimehelpersesmextends({
261
+ id: context.titleId
262
+ }, titleProps, {
263
+ ref: forwardedRef
264
+ }));
265
+ });
266
+ /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$16f7638e4a34b909, {
267
+ displayName: $5d3850c4d0b4e6c7$var$TITLE_NAME
268
+ });
269
+ /* -------------------------------------------------------------------------------------------------
270
+ * DialogDescription
271
+ * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DESCRIPTION_NAME = 'DialogDescription';
272
+ const $5d3850c4d0b4e6c7$export$94e94c2ec2c954d5 = /*#__PURE__*/ $67UHm$forwardRef((props, forwardedRef)=>{
273
+ const { __scopeDialog: __scopeDialog , ...descriptionProps } = props;
274
+ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$DESCRIPTION_NAME, __scopeDialog);
275
+ return /*#__PURE__*/ $67UHm$createElement($67UHm$Primitive.p, $67UHm$babelruntimehelpersesmextends({
276
+ id: context.descriptionId
277
+ }, descriptionProps, {
278
+ ref: forwardedRef
279
+ }));
280
+ });
281
+ /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$94e94c2ec2c954d5, {
282
+ displayName: $5d3850c4d0b4e6c7$var$DESCRIPTION_NAME
283
+ });
284
+ /* -------------------------------------------------------------------------------------------------
285
+ * DialogClose
286
+ * -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$CLOSE_NAME = 'DialogClose';
287
+ const $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac = /*#__PURE__*/ $67UHm$forwardRef((props, forwardedRef)=>{
288
+ const { __scopeDialog: __scopeDialog , ...closeProps } = props;
289
+ const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CLOSE_NAME, __scopeDialog);
290
+ return /*#__PURE__*/ $67UHm$createElement($67UHm$Primitive.button, $67UHm$babelruntimehelpersesmextends({
291
+ type: "button"
292
+ }, closeProps, {
293
+ ref: forwardedRef,
294
+ onClick: $67UHm$composeEventHandlers(props.onClick, ()=>context.onOpenChange(false)
295
+ )
296
+ }));
297
+ });
298
+ /*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac, {
299
+ displayName: $5d3850c4d0b4e6c7$var$CLOSE_NAME
300
+ });
301
+ /* -----------------------------------------------------------------------------------------------*/ function $5d3850c4d0b4e6c7$var$getState(open) {
302
+ return open ? 'open' : 'closed';
303
+ }
304
+ const $5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME = 'DialogTitleWarning';
305
+ const [$5d3850c4d0b4e6c7$export$69b62a49393917d6, $5d3850c4d0b4e6c7$var$useWarningContext] = $67UHm$createContext($5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME, {
306
+ contentName: $5d3850c4d0b4e6c7$var$CONTENT_NAME,
307
+ titleName: $5d3850c4d0b4e6c7$var$TITLE_NAME,
308
+ docsSlug: 'dialog'
309
+ });
310
+ const $5d3850c4d0b4e6c7$var$TitleWarning = ({ titleId: titleId })=>{
311
+ const titleWarningContext = $5d3850c4d0b4e6c7$var$useWarningContext($5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME);
312
+ const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
313
+
314
+ If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
315
+
316
+ For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
317
+ $67UHm$useEffect(()=>{
318
+ if (titleId) {
319
+ const hasTitle = document.getElementById(titleId);
320
+ if (!hasTitle) throw new Error(MESSAGE);
321
+ }
322
+ }, [
323
+ MESSAGE,
324
+ titleId
325
+ ]);
326
+ return null;
327
+ };
328
+ const $5d3850c4d0b4e6c7$var$DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning';
329
+ const $5d3850c4d0b4e6c7$var$DescriptionWarning = ({ contentRef: contentRef , descriptionId: descriptionId })=>{
330
+ const descriptionWarningContext = $5d3850c4d0b4e6c7$var$useWarningContext($5d3850c4d0b4e6c7$var$DESCRIPTION_WARNING_NAME);
331
+ const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
332
+ $67UHm$useEffect(()=>{
333
+ var _contentRef$current;
334
+ const describedById = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.getAttribute('aria-describedby'); // if we have an id and the user hasn't set aria-describedby={undefined}
335
+ if (descriptionId && describedById) {
336
+ const hasDescription = document.getElementById(descriptionId);
337
+ if (!hasDescription) console.warn(MESSAGE);
338
+ }
339
+ }, [
340
+ MESSAGE,
341
+ contentRef,
342
+ descriptionId
343
+ ]);
344
+ return null;
345
+ };
346
+ const $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9 = $5d3850c4d0b4e6c7$export$3ddf2d174ce01153;
347
+ const $5d3850c4d0b4e6c7$export$41fb9f06171c75f4 = $5d3850c4d0b4e6c7$export$2e1e1122cf0cba88;
348
+ const $5d3850c4d0b4e6c7$export$602eac185826482c = $5d3850c4d0b4e6c7$export$dad7c95542bacce0;
349
+ const $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff = $5d3850c4d0b4e6c7$export$bd1d06c79be19e17;
350
+ const $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 = $5d3850c4d0b4e6c7$export$b6d9565de1e068cf;
351
+ const $5d3850c4d0b4e6c7$export$f99233281efd08a0 = $5d3850c4d0b4e6c7$export$16f7638e4a34b909;
352
+ const $5d3850c4d0b4e6c7$export$393edc798c47379d = $5d3850c4d0b4e6c7$export$94e94c2ec2c954d5;
353
+ const $5d3850c4d0b4e6c7$export$f39c2d165cd861fe = $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac;
354
+
355
+
356
+
357
+
358
+ export {$5d3850c4d0b4e6c7$export$cc702773b8ea3e41 as createDialogScope, $5d3850c4d0b4e6c7$export$3ddf2d174ce01153 as Dialog, $5d3850c4d0b4e6c7$export$2e1e1122cf0cba88 as DialogTrigger, $5d3850c4d0b4e6c7$export$dad7c95542bacce0 as DialogPortal, $5d3850c4d0b4e6c7$export$bd1d06c79be19e17 as DialogOverlay, $5d3850c4d0b4e6c7$export$b6d9565de1e068cf as DialogContent, $5d3850c4d0b4e6c7$export$16f7638e4a34b909 as DialogTitle, $5d3850c4d0b4e6c7$export$94e94c2ec2c954d5 as DialogDescription, $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac as DialogClose, $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9 as Root, $5d3850c4d0b4e6c7$export$41fb9f06171c75f4 as Trigger, $5d3850c4d0b4e6c7$export$602eac185826482c as Portal, $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff as Overlay, $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 as Content, $5d3850c4d0b4e6c7$export$f99233281efd08a0 as Title, $5d3850c4d0b4e6c7$export$393edc798c47379d as Description, $5d3850c4d0b4e6c7$export$f39c2d165cd861fe as Close, $5d3850c4d0b4e6c7$export$69b62a49393917d6 as WarningProvider};
2
359
  //# sourceMappingURL=index.module.js.map
@@ -1 +1 @@
1
- {"mappings":"m3BAuBA,MAGOA,EAAqBC,GAAqBC,EAH7B,yCAkBpB,MAAOC,EAAgBC,GAAoBJ,EAlBvB,iBAiCpB,MAAMK,OAAiCC,IACrC,MAAMC,cACJ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/G,EAAMoB,YAC9B,CAAC9B,EAA4C+B,KAC3C,MAAM9B,cAAEA,KAAkByH,GAAqB1H,EACzCiC,EAAUnC,EATK,oBAS8BG,gBACnD,OAAOiB,EAAAC,cAACiB,EAAUuF,EAAXrF,EAAA,CAAa8E,GAAInF,EAAQR,eAAmBiG,EAA5C,CAA8DjF,IAAKV,4BAe9E,MAAM6F,yBAAclH,EAAMoB,YACxB,CAAC9B,EAAsC+B,KACrC,MAAM9B,cAAEA,KAAkB4H,GAAe7H,EACnCiC,EAAUnC,EARD,cAQ8BG,gBAC7C,OACEiB,EAAAC,cAACiB,EAAUC,OAAXC,EAAA,CACEC,KAAK,UACDsF,EAFN,CAGEpF,IAAKV,EACLW,QAASC,EAAqB3C,EAAM0C,SAAS,IAAMT,EAAQ3B,cAAa,wBAUhF,SAASkC,EAASrC,GAChB,OAAOA,EAAO,OAAS,SAGzB,MAEO2H,EAAiBC,GAAqBC,EAFlB,qBAEoD,CAC7EC,YA1QmB,gBA2QnBC,UAxEiB,cAyEjBC,SAAU,+CA+CZ,MAAMC,KAAOrI,cACb,MAAMsI,QAAUxG,qBAChB,MAAMyG,OAAStF,oBACf,MAAMuF,QAAU7E,qBAChB,MAAM8E,QAAUlE,qBAChB,MAAMmE,MAAQnB,mBACd,MAAMoB,YAAcjB,yBACpB,MAAMkB,MAAQf","sources":["./packages/react/dialog/src/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContext, createContextScope } from '@radix-ui/react-context';\nimport { useId } from '@radix-ui/react-id';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { UnstablePortal } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { hideOthers } from 'aria-hidden';\nimport { Slot } 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 * Dialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst DIALOG_NAME = 'Dialog';\n\ntype ScopedProps<P> = P & { __scopeDialog?: Scope };\nconst [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);\n\ntype DialogContextValue = {\n triggerRef: React.RefObject<HTMLButtonElement>;\n contentRef: React.RefObject<DialogContentElement>;\n contentId: string;\n titleId: string;\n descriptionId: string;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n allowPinchZoom: DialogProps['allowPinchZoom'];\n};\n\nconst [DialogProvider, useDialogContext] = createDialogContext<DialogContextValue>(DIALOG_NAME);\n\ntype RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>;\ninterface DialogProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n modal?: boolean;\n /**\n * @see https://github.com/theKashey/react-remove-scroll#usage\n */\n allowPinchZoom?: RemoveScrollProps['allowPinchZoom'];\n}\n\nconst Dialog: React.FC<DialogProps> = (props: ScopedProps<DialogProps>) => {\n const {\n __scopeDialog,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n allowPinchZoom,\n } = props;\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const contentRef = React.useRef<DialogContentElement>(null);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <DialogProvider\n scope={__scopeDialog}\n triggerRef={triggerRef}\n contentRef={contentRef}\n contentId={useId()}\n titleId={useId()}\n descriptionId={useId()}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n allowPinchZoom={allowPinchZoom}\n >\n {children}\n </DialogProvider>\n );\n};\n\nDialog.displayName = DIALOG_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DialogTrigger';\n\ntype DialogTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface DialogTriggerProps extends PrimitiveButtonProps {}\n\nconst DialogTrigger = React.forwardRef<DialogTriggerElement, DialogTriggerProps>(\n (props: ScopedProps<DialogTriggerProps>, forwardedRef) => {\n const { __scopeDialog, ...triggerProps } = props;\n const context = useDialogContext(TRIGGER_NAME, __scopeDialog);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n return (\n <Primitive.button\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onClick={composeEventHandlers(props.onClick, context.onOpenToggle)}\n />\n );\n }\n);\n\nDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DialogPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createDialogContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof UnstablePortal>;\ninterface DialogPortalProps extends Omit<PortalProps, 'asChild'> {\n children?: React.ReactNode;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogPortal: React.FC<DialogPortalProps> = (props: ScopedProps<DialogPortalProps>) => {\n const { __scopeDialog, forceMount, children, container } = props;\n const context = useDialogContext(PORTAL_NAME, __scopeDialog);\n return (\n <PortalProvider scope={__scopeDialog} forceMount={forceMount}>\n {React.Children.map(children, (child) => (\n <Presence present={forceMount || context.open}>\n <UnstablePortal asChild container={container}>\n {child}\n </UnstablePortal>\n </Presence>\n ))}\n </PortalProvider>\n );\n};\n\nDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'DialogOverlay';\n\ntype DialogOverlayElement = DialogOverlayImplElement;\ninterface DialogOverlayProps extends DialogOverlayImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogOverlay = React.forwardRef<DialogOverlayElement, DialogOverlayProps>(\n (props: ScopedProps<DialogOverlayProps>, forwardedRef) => {\n const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);\n return context.modal ? (\n <Presence present={forceMount || context.open}>\n <DialogOverlayImpl {...overlayProps} ref={forwardedRef} />\n </Presence>\n ) : null;\n }\n);\n\nDialogOverlay.displayName = OVERLAY_NAME;\n\ntype DialogOverlayImplElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface DialogOverlayImplProps extends PrimitiveDivProps {}\n\nconst DialogOverlayImpl = React.forwardRef<DialogOverlayImplElement, DialogOverlayImplProps>(\n (props: ScopedProps<DialogOverlayImplProps>, forwardedRef) => {\n const { __scopeDialog, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog);\n return (\n // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`\n // ie. when `Overlay` and `Content` are siblings\n <RemoveScroll as={Slot} allowPinchZoom={context.allowPinchZoom} shards={[context.contentRef]}>\n <Primitive.div\n data-state={getState(context.open)}\n {...overlayProps}\n ref={forwardedRef}\n // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.\n style={{ pointerEvents: 'auto', ...overlayProps.style }}\n />\n </RemoveScroll>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DialogContent';\n\ntype DialogContentElement = DialogContentTypeElement;\ninterface DialogContentProps extends DialogContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogContent = React.forwardRef<DialogContentElement, DialogContentProps>(\n (props: ScopedProps<DialogContentProps>, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n return (\n <Presence present={forceMount || context.open}>\n {context.modal ? (\n <DialogContentModal {...contentProps} ref={forwardedRef} />\n ) : (\n <DialogContentNonModal {...contentProps} ref={forwardedRef} />\n )}\n </Presence>\n );\n }\n);\n\nDialogContent.displayName = CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentTypeElement = DialogContentImplElement;\ninterface DialogContentTypeProps\n extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {}\n\nconst DialogContentModal = React.forwardRef<DialogContentTypeElement, DialogContentTypeProps>(\n (props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <DialogContentImpl\n {...props}\n ref={composedRefs}\n // we make sure focus isn't trapped once `DialogContent` has been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n // If the event is a right-click, we shouldn't close because\n // it is effectively as if we right-clicked the `Overlay`.\n if (isRightClick) event.preventDefault();\n })}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) =>\n event.preventDefault()\n )}\n />\n );\n }\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst DialogContentNonModal = React.forwardRef<DialogContentTypeElement, DialogContentTypeProps>(\n (props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n <DialogContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) hasInteractedOutsideRef.current = true;\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n //\n // We use `onInteractOutside` as some browsers also\n // focus on pointer down, creating the same issue.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n }}\n />\n );\n }\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentImplElement = React.ElementRef<typeof DismissableLayer>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;\ninterface DialogContentImplProps extends Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * When `true`, focus cannot escape the `Content` via keyboard,\n * pointer, or a programmatic focus.\n * @defaultValue false\n */\n trapFocus?: FocusScopeProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n}\n\nconst DialogContentImpl = React.forwardRef<DialogContentImplElement, DialogContentImplProps>(\n (props: ScopedProps<DialogContentImplProps>, forwardedRef) => {\n const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, __scopeDialog);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n\n // Make sure the whole tree has focus guards as our `Dialog` will be\n // the last element in the DOM (beacuse of the `Portal`)\n useFocusGuards();\n\n return (\n <>\n <FocusScope\n asChild\n loop\n trapped={trapFocus}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <DismissableLayer\n role=\"dialog\"\n id={context.contentId}\n aria-describedby={context.descriptionId}\n aria-labelledby={context.titleId}\n data-state={getState(context.open)}\n {...contentProps}\n ref={composedRefs}\n onDismiss={() => context.onOpenChange(false)}\n />\n </FocusScope>\n {process.env.NODE_ENV !== 'production' && (\n <>\n <TitleWarning titleId={context.titleId} />\n <DescriptionWarning contentRef={contentRef} descriptionId={context.descriptionId} />\n </>\n )}\n </>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'DialogTitle';\n\ntype DialogTitleElement = React.ElementRef<typeof Primitive.h2>;\ntype PrimitiveHeading2Props = Radix.ComponentPropsWithoutRef<typeof Primitive.h2>;\ninterface DialogTitleProps extends PrimitiveHeading2Props {}\n\nconst DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>(\n (props: ScopedProps<DialogTitleProps>, forwardedRef) => {\n const { __scopeDialog, ...titleProps } = props;\n const context = useDialogContext(TITLE_NAME, __scopeDialog);\n return <Primitive.h2 id={context.titleId} {...titleProps} ref={forwardedRef} />;\n }\n);\n\nDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'DialogDescription';\n\ntype DialogDescriptionElement = React.ElementRef<typeof Primitive.p>;\ntype PrimitiveParagraphProps = Radix.ComponentPropsWithoutRef<typeof Primitive.p>;\ninterface DialogDescriptionProps extends PrimitiveParagraphProps {}\n\nconst DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>(\n (props: ScopedProps<DialogDescriptionProps>, forwardedRef) => {\n const { __scopeDialog, ...descriptionProps } = props;\n const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);\n return <Primitive.p id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />;\n }\n);\n\nDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'DialogClose';\n\ntype DialogCloseElement = React.ElementRef<typeof Primitive.button>;\ninterface DialogCloseProps extends PrimitiveButtonProps {}\n\nconst DialogClose = React.forwardRef<DialogCloseElement, DialogCloseProps>(\n (props: ScopedProps<DialogCloseProps>, forwardedRef) => {\n const { __scopeDialog, ...closeProps } = props;\n const context = useDialogContext(CLOSE_NAME, __scopeDialog);\n return (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, () => context.onOpenChange(false))}\n />\n );\n }\n);\n\nDialogClose.displayName = CLOSE_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nconst TITLE_WARNING_NAME = 'DialogTitleWarning';\n\nconst [WarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {\n contentName: CONTENT_NAME,\n titleName: TITLE_NAME,\n docsSlug: 'dialog',\n});\n\ntype TitleWarningProps = { titleId?: string };\n\nconst TitleWarning: React.FC<TitleWarningProps> = ({ titleId }) => {\n const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);\n\n const MESSAGE = `\\`${titleWarningContext.contentName}\\` requires a \\`${titleWarningContext.titleName}\\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \\`${titleWarningContext.titleName}\\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;\n\n React.useEffect(() => {\n if (titleId) {\n const hasTitle = document.getElementById(titleId);\n if (!hasTitle) throw new Error(MESSAGE);\n }\n }, [MESSAGE, titleId]);\n\n return null;\n};\n\nconst DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning';\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<DialogContentElement>;\n descriptionId?: string;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef, descriptionId }) => {\n const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);\n const MESSAGE = `Warning: Missing \\`Description\\` or \\`aria-describedby={undefined}\\` for {${descriptionWarningContext.contentName}}.`;\n\n React.useEffect(() => {\n const describedById = contentRef.current?.getAttribute('aria-describedby');\n // if we have an id and the user hasn't set aria-describedby={undefined}\n if (descriptionId && describedById) {\n const hasDescription = document.getElementById(descriptionId);\n if (!hasDescription) console.warn(MESSAGE);\n }\n }, [MESSAGE, contentRef, descriptionId]);\n\n return null;\n};\n\nconst Root = Dialog;\nconst Trigger = DialogTrigger;\nconst Portal = DialogPortal;\nconst Overlay = DialogOverlay;\nconst Content = DialogContent;\nconst Title = DialogTitle;\nconst Description = DialogDescription;\nconst Close = DialogClose;\n\nexport {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Title,\n Description,\n Close,\n //\n WarningProvider,\n};\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogCloseProps,\n};\n"],"names":["createDialogContext","createDialogScope","createContextScope","DialogProvider","useDialogContext","Dialog","props","__scopeDialog","children","open","openProp","defaultOpen","onOpenChange","modal","allowPinchZoom","triggerRef","React","useRef","contentRef","setOpen","useControllableState","prop","defaultProp","onChange","_react","createElement","$da81f3af863821fb8a193d321c41d$var$DialogProvider","scope","contentId","useId","titleId","descriptionId","onOpenToggle","useCallback","prevOpen","DialogTrigger","forwardRef","forwardedRef","triggerProps","context","composedTriggerRef","useComposedRefs","Primitive","button","_babelRuntimeHelpersEsmExtends","type","getState","ref","onClick","composeEventHandlers","PortalProvider","usePortalContext","forceMount","undefined","DialogPortal","container","$da81f3af863821fb8a193d321c41d$var$PortalProvider","Children","map","child","Presence","present","UnstablePortal","asChild","DialogOverlay","portalContext","overlayProps","$da81f3af863821fb8a193d321c41d$var$DialogOverlayImpl","DialogOverlayImpl","RemoveScroll","as","Slot","shards","div","style","pointerEvents","DialogContent","contentProps","$da81f3af863821fb8a193d321c41d$var$DialogContentModal","$da81f3af863821fb8a193d321c41d$var$DialogContentNonModal","DialogContentModal","composedRefs","useEffect","content","current","hideOthers","$da81f3af863821fb8a193d321c41d$var$DialogContentImpl","trapFocus","disableOutsidePointerEvents","onCloseAutoFocus","event","_context$triggerRef$c","preventDefault","focus","onPointerDownOutside","originalEvent","detail","ctrlLeftClick","ctrlKey","onFocusOutside","DialogContentNonModal","hasInteractedOutsideRef","_props$onCloseAutoFoc","_context$triggerRef$c2","call","defaultPrevented","onInteractOutside","_props$onInteractOuts","_context$triggerRef$c3","target","contains","DialogContentImpl","onOpenAutoFocus","useFocusGuards","Fragment","FocusScope","loop","trapped","onMountAutoFocus","onUnmountAutoFocus","DismissableLayer","role","id","onDismiss","DialogTitle","titleProps","h2","DialogDescription","descriptionProps","p","DialogClose","closeProps","WarningProvider","useWarningContext","createContext","contentName","titleName","docsSlug","Root","Trigger","Portal","Overlay","Content","Title","Description","Close"],"version":3,"file":"index.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;;;ACmBA;;oGAEA,CAEA,MAAMkC,iCAAW,GAAG,QAApB,AAAA;AAGA,MAAM,CAACC,yCAAD,EAAsBnC,yCAAtB,CAAA,GAA2CsB,yBAAkB,CAACY,iCAAD,CAAnE,AAAA;AAcA,MAAM,CAACE,oCAAD,EAAiBC,sCAAjB,CAAA,GAAqCF,yCAAmB,CAAqBD,iCAArB,CAA9D,AAAA;AAUA,MAAMjC,yCAA6B,GAAIqC,CAAAA,KAAD,GAAqC;IACzE,MAAM,E,eACJC,aADI,CAAA,E,UAEJC,QAFI,CAAA,EAGJC,IAAI,EAAEC,QAHF,CAAA,E,aAIJC,WAJI,CAAA,E,cAKJC,YALI,CAAA,SAMJC,KAAK,GAAG,IAARA,GANI,GAOFP,KAPJ,AAAM;IAQN,MAAMQ,UAAU,GAAG5B,aAAA,CAAgC,IAAhC,CAAnB,AAAA;IACA,MAAM8B,UAAU,GAAG9B,aAAA,CAAmC,IAAnC,CAAnB,AAAA;IACA,MAAM,CAACuB,IAAI,GAAG,KAAR,EAAeQ,OAAf,CAAA,GAA0BzB,2BAAoB,CAAC;QACnD0B,IAA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CAACC,cAAT,CAAwBrB,aAAxB,CAAvB,AAAA;YACA,IAAI,CAAC4B,cAAL,EAAqBC,OAAO,CAACC,IAAR,CAAaZ,OAAb,CAArB,CAAA;SACD;KANH,EAOG;QAACA,OAAD;QAAU/E,UAAV;QAAsB6D,aAAtB;KAPH,CAOC,CAAA;IAED,OAAO,IAAP,CAAA;CAbF,AAcC;AAED,MAAMpG,yCAAI,GAAGR,yCAAb,AAAA;AACA,MAAMS,yCAAO,GAAGR,yCAAhB,AAAA;AACA,MAAMS,yCAAM,GAAGR,yCAAf,AAAA;AACA,MAAMS,yCAAO,GAAGR,yCAAhB,AAAA;AACA,MAAMS,yCAAO,GAAGR,yCAAhB,AAAA;AACA,MAAMS,yCAAK,GAAGR,yCAAd,AAAA;AACA,MAAMS,yCAAW,GAAGR,yCAApB,AAAA;AACA,MAAMS,yCAAK,GAAGR,yCAAd,AAAA;;AD1hBA","sources":["packages/react/dialog/src/index.ts","packages/react/dialog/src/Dialog.tsx"],"sourcesContent":["export {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Title,\n Description,\n Close,\n //\n WarningProvider,\n} from './Dialog';\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogCloseProps,\n} from './Dialog';\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContext, createContextScope } from '@radix-ui/react-context';\nimport { useId } from '@radix-ui/react-id';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { hideOthers } from 'aria-hidden';\nimport { Slot } 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 * Dialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst DIALOG_NAME = 'Dialog';\n\ntype ScopedProps<P> = P & { __scopeDialog?: Scope };\nconst [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);\n\ntype DialogContextValue = {\n triggerRef: React.RefObject<HTMLButtonElement>;\n contentRef: React.RefObject<DialogContentElement>;\n contentId: string;\n titleId: string;\n descriptionId: string;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n};\n\nconst [DialogProvider, useDialogContext] = createDialogContext<DialogContextValue>(DIALOG_NAME);\n\ninterface DialogProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n modal?: boolean;\n}\n\nconst Dialog: React.FC<DialogProps> = (props: ScopedProps<DialogProps>) => {\n const {\n __scopeDialog,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n } = props;\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const contentRef = React.useRef<DialogContentElement>(null);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <DialogProvider\n scope={__scopeDialog}\n triggerRef={triggerRef}\n contentRef={contentRef}\n contentId={useId()}\n titleId={useId()}\n descriptionId={useId()}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n >\n {children}\n </DialogProvider>\n );\n};\n\nDialog.displayName = DIALOG_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DialogTrigger';\n\ntype DialogTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface DialogTriggerProps extends PrimitiveButtonProps {}\n\nconst DialogTrigger = React.forwardRef<DialogTriggerElement, DialogTriggerProps>(\n (props: ScopedProps<DialogTriggerProps>, forwardedRef) => {\n const { __scopeDialog, ...triggerProps } = props;\n const context = useDialogContext(TRIGGER_NAME, __scopeDialog);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n return (\n <Primitive.button\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onClick={composeEventHandlers(props.onClick, context.onOpenToggle)}\n />\n );\n }\n);\n\nDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DialogPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createDialogContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface DialogPortalProps extends Omit<PortalProps, 'asChild'> {\n children?: React.ReactNode;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogPortal: React.FC<DialogPortalProps> = (props: ScopedProps<DialogPortalProps>) => {\n const { __scopeDialog, forceMount, children, container } = props;\n const context = useDialogContext(PORTAL_NAME, __scopeDialog);\n return (\n <PortalProvider scope={__scopeDialog} forceMount={forceMount}>\n {React.Children.map(children, (child) => (\n <Presence present={forceMount || context.open}>\n <PortalPrimitive asChild container={container}>\n {child}\n </PortalPrimitive>\n </Presence>\n ))}\n </PortalProvider>\n );\n};\n\nDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'DialogOverlay';\n\ntype DialogOverlayElement = DialogOverlayImplElement;\ninterface DialogOverlayProps extends DialogOverlayImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogOverlay = React.forwardRef<DialogOverlayElement, DialogOverlayProps>(\n (props: ScopedProps<DialogOverlayProps>, forwardedRef) => {\n const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);\n return context.modal ? (\n <Presence present={forceMount || context.open}>\n <DialogOverlayImpl {...overlayProps} ref={forwardedRef} />\n </Presence>\n ) : null;\n }\n);\n\nDialogOverlay.displayName = OVERLAY_NAME;\n\ntype DialogOverlayImplElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface DialogOverlayImplProps extends PrimitiveDivProps {}\n\nconst DialogOverlayImpl = React.forwardRef<DialogOverlayImplElement, DialogOverlayImplProps>(\n (props: ScopedProps<DialogOverlayImplProps>, forwardedRef) => {\n const { __scopeDialog, ...overlayProps } = props;\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog);\n return (\n // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`\n // ie. when `Overlay` and `Content` are siblings\n <RemoveScroll as={Slot} allowPinchZoom shards={[context.contentRef]}>\n <Primitive.div\n data-state={getState(context.open)}\n {...overlayProps}\n ref={forwardedRef}\n // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.\n style={{ pointerEvents: 'auto', ...overlayProps.style }}\n />\n </RemoveScroll>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DialogContent';\n\ntype DialogContentElement = DialogContentTypeElement;\ninterface DialogContentProps extends DialogContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst DialogContent = React.forwardRef<DialogContentElement, DialogContentProps>(\n (props: ScopedProps<DialogContentProps>, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n return (\n <Presence present={forceMount || context.open}>\n {context.modal ? (\n <DialogContentModal {...contentProps} ref={forwardedRef} />\n ) : (\n <DialogContentNonModal {...contentProps} ref={forwardedRef} />\n )}\n </Presence>\n );\n }\n);\n\nDialogContent.displayName = CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentTypeElement = DialogContentImplElement;\ninterface DialogContentTypeProps\n extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {}\n\nconst DialogContentModal = React.forwardRef<DialogContentTypeElement, DialogContentTypeProps>(\n (props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <DialogContentImpl\n {...props}\n ref={composedRefs}\n // we make sure focus isn't trapped once `DialogContent` has been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n // If the event is a right-click, we shouldn't close because\n // it is effectively as if we right-clicked the `Overlay`.\n if (isRightClick) event.preventDefault();\n })}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) =>\n event.preventDefault()\n )}\n />\n );\n }\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst DialogContentNonModal = React.forwardRef<DialogContentTypeElement, DialogContentTypeProps>(\n (props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n <DialogContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) hasInteractedOutsideRef.current = true;\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n //\n // We use `onInteractOutside` as some browsers also\n // focus on pointer down, creating the same issue.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n }}\n />\n );\n }\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentImplElement = React.ElementRef<typeof DismissableLayer>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;\ninterface DialogContentImplProps extends Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * When `true`, focus cannot escape the `Content` via keyboard,\n * pointer, or a programmatic focus.\n * @defaultValue false\n */\n trapFocus?: FocusScopeProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n}\n\nconst DialogContentImpl = React.forwardRef<DialogContentImplElement, DialogContentImplProps>(\n (props: ScopedProps<DialogContentImplProps>, forwardedRef) => {\n const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;\n const context = useDialogContext(CONTENT_NAME, __scopeDialog);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n\n // Make sure the whole tree has focus guards as our `Dialog` will be\n // the last element in the DOM (beacuse of the `Portal`)\n useFocusGuards();\n\n return (\n <>\n <FocusScope\n asChild\n loop\n trapped={trapFocus}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <DismissableLayer\n role=\"dialog\"\n id={context.contentId}\n aria-describedby={context.descriptionId}\n aria-labelledby={context.titleId}\n data-state={getState(context.open)}\n {...contentProps}\n ref={composedRefs}\n onDismiss={() => context.onOpenChange(false)}\n />\n </FocusScope>\n {process.env.NODE_ENV !== 'production' && (\n <>\n <TitleWarning titleId={context.titleId} />\n <DescriptionWarning contentRef={contentRef} descriptionId={context.descriptionId} />\n </>\n )}\n </>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'DialogTitle';\n\ntype DialogTitleElement = React.ElementRef<typeof Primitive.h2>;\ntype PrimitiveHeading2Props = Radix.ComponentPropsWithoutRef<typeof Primitive.h2>;\ninterface DialogTitleProps extends PrimitiveHeading2Props {}\n\nconst DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>(\n (props: ScopedProps<DialogTitleProps>, forwardedRef) => {\n const { __scopeDialog, ...titleProps } = props;\n const context = useDialogContext(TITLE_NAME, __scopeDialog);\n return <Primitive.h2 id={context.titleId} {...titleProps} ref={forwardedRef} />;\n }\n);\n\nDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'DialogDescription';\n\ntype DialogDescriptionElement = React.ElementRef<typeof Primitive.p>;\ntype PrimitiveParagraphProps = Radix.ComponentPropsWithoutRef<typeof Primitive.p>;\ninterface DialogDescriptionProps extends PrimitiveParagraphProps {}\n\nconst DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>(\n (props: ScopedProps<DialogDescriptionProps>, forwardedRef) => {\n const { __scopeDialog, ...descriptionProps } = props;\n const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);\n return <Primitive.p id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />;\n }\n);\n\nDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DialogClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'DialogClose';\n\ntype DialogCloseElement = React.ElementRef<typeof Primitive.button>;\ninterface DialogCloseProps extends PrimitiveButtonProps {}\n\nconst DialogClose = React.forwardRef<DialogCloseElement, DialogCloseProps>(\n (props: ScopedProps<DialogCloseProps>, forwardedRef) => {\n const { __scopeDialog, ...closeProps } = props;\n const context = useDialogContext(CLOSE_NAME, __scopeDialog);\n return (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, () => context.onOpenChange(false))}\n />\n );\n }\n);\n\nDialogClose.displayName = CLOSE_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nconst TITLE_WARNING_NAME = 'DialogTitleWarning';\n\nconst [WarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {\n contentName: CONTENT_NAME,\n titleName: TITLE_NAME,\n docsSlug: 'dialog',\n});\n\ntype TitleWarningProps = { titleId?: string };\n\nconst TitleWarning: React.FC<TitleWarningProps> = ({ titleId }) => {\n const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);\n\n const MESSAGE = `\\`${titleWarningContext.contentName}\\` requires a \\`${titleWarningContext.titleName}\\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \\`${titleWarningContext.titleName}\\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;\n\n React.useEffect(() => {\n if (titleId) {\n const hasTitle = document.getElementById(titleId);\n if (!hasTitle) throw new Error(MESSAGE);\n }\n }, [MESSAGE, titleId]);\n\n return null;\n};\n\nconst DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning';\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<DialogContentElement>;\n descriptionId?: string;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef, descriptionId }) => {\n const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);\n const MESSAGE = `Warning: Missing \\`Description\\` or \\`aria-describedby={undefined}\\` for {${descriptionWarningContext.contentName}}.`;\n\n React.useEffect(() => {\n const describedById = contentRef.current?.getAttribute('aria-describedby');\n // if we have an id and the user hasn't set aria-describedby={undefined}\n if (descriptionId && describedById) {\n const hasDescription = document.getElementById(descriptionId);\n if (!hasDescription) console.warn(MESSAGE);\n }\n }, [MESSAGE, contentRef, descriptionId]);\n\n return null;\n};\n\nconst Root = Dialog;\nconst Trigger = DialogTrigger;\nconst Portal = DialogPortal;\nconst Overlay = DialogOverlay;\nconst Content = DialogContent;\nconst Title = DialogTitle;\nconst Description = DialogDescription;\nconst Close = DialogClose;\n\nexport {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Title,\n Description,\n Close,\n //\n WarningProvider,\n};\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogCloseProps,\n};\n"],"names":["createDialogScope","Dialog","DialogTrigger","DialogPortal","DialogOverlay","DialogContent","DialogTitle","DialogDescription","DialogClose","Root","Trigger","Portal","Overlay","Content","Title","Description","Close","WarningProvider","React","composeEventHandlers","useComposedRefs","createContext","createContextScope","useId","useControllableState","DismissableLayer","FocusScope","PortalPrimitive","Presence","Primitive","useFocusGuards","RemoveScroll","hideOthers","Slot","DIALOG_NAME","createDialogContext","DialogProvider","useDialogContext","props","__scopeDialog","children","open","openProp","defaultOpen","onOpenChange","modal","triggerRef","useRef","contentRef","setOpen","prop","defaultProp","onChange","useCallback","prevOpen","TRIGGER_NAME","forwardRef","forwardedRef","triggerProps","context","composedTriggerRef","contentId","getState","onClick","onOpenToggle","PORTAL_NAME","PortalProvider","usePortalContext","forceMount","undefined","container","Children","map","child","OVERLAY_NAME","portalContext","overlayProps","DialogOverlayImpl","pointerEvents","style","CONTENT_NAME","contentProps","DialogContentModal","composedRefs","useEffect","content","current","onCloseAutoFocus","event","preventDefault","focus","onPointerDownOutside","originalEvent","detail","ctrlLeftClick","button","ctrlKey","isRightClick","onFocusOutside","DialogContentNonModal","hasInteractedOutsideRef","defaultPrevented","onInteractOutside","target","targetIsTrigger","contains","DialogContentImpl","trapFocus","onOpenAutoFocus","descriptionId","titleId","process","env","NODE_ENV","TITLE_NAME","titleProps","DESCRIPTION_NAME","descriptionProps","CLOSE_NAME","closeProps","TITLE_WARNING_NAME","useWarningContext","contentName","titleName","docsSlug","TitleWarning","titleWarningContext","MESSAGE","hasTitle","document","getElementById","Error","DESCRIPTION_WARNING_NAME","DescriptionWarning","descriptionWarningContext","describedById","getAttribute","hasDescription","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-dialog",
3
- "version": "0.1.8-rc.9",
3
+ "version": "1.0.1-rc.1",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -17,20 +17,20 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@babel/runtime": "^7.13.10",
20
- "@radix-ui/primitive": "0.1.0",
21
- "@radix-ui/react-compose-refs": "0.1.1-rc.2",
22
- "@radix-ui/react-context": "0.1.2-rc.2",
23
- "@radix-ui/react-dismissable-layer": "0.1.6-rc.2",
24
- "@radix-ui/react-focus-guards": "0.1.1-rc.2",
25
- "@radix-ui/react-focus-scope": "0.1.5-rc.2",
26
- "@radix-ui/react-id": "0.1.6-rc.2",
27
- "@radix-ui/react-portal": "0.1.5-rc.2",
28
- "@radix-ui/react-presence": "0.1.3-rc.2",
29
- "@radix-ui/react-primitive": "0.1.5-rc.2",
30
- "@radix-ui/react-slot": "0.1.3-rc.2",
31
- "@radix-ui/react-use-controllable-state": "0.1.1-rc.2",
20
+ "@radix-ui/primitive": "1.0.0",
21
+ "@radix-ui/react-compose-refs": "1.0.0",
22
+ "@radix-ui/react-context": "1.0.0",
23
+ "@radix-ui/react-dismissable-layer": "1.0.1-rc.1",
24
+ "@radix-ui/react-focus-guards": "1.0.0",
25
+ "@radix-ui/react-focus-scope": "1.0.0",
26
+ "@radix-ui/react-id": "1.0.0",
27
+ "@radix-ui/react-portal": "1.0.0",
28
+ "@radix-ui/react-presence": "1.0.0",
29
+ "@radix-ui/react-primitive": "1.0.0",
30
+ "@radix-ui/react-slot": "1.0.0",
31
+ "@radix-ui/react-use-controllable-state": "1.0.0",
32
32
  "aria-hidden": "^1.1.1",
33
- "react-remove-scroll": "^2.4.0"
33
+ "react-remove-scroll": "2.5.5"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^16.8 || ^17.0 || ^18.0",
@@ -44,5 +44,5 @@
44
44
  "bugs": {
45
45
  "url": "https://github.com/radix-ui/primitives/issues"
46
46
  },
47
- "stableVersion": "0.1.7"
47
+ "stableVersion": "1.0.0"
48
48
  }