@radix-ui/react-alert-dialog 0.1.1-rc.8 → 0.1.2-rc.10

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,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import * as DialogPrimitive from "@radix-ui/react-dialog";
3
3
  import * as Radix from "@radix-ui/react-primitive";
4
+ export const createAlertDialogScope: import("@radix-ui/react-context").CreateScope;
4
5
  type DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
5
6
  export interface AlertDialogProps extends Omit<DialogProps, 'modal'> {
6
7
  }
@@ -9,6 +10,10 @@ type DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.
9
10
  export interface AlertDialogTriggerProps extends DialogTriggerProps {
10
11
  }
11
12
  export const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
13
+ type DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
14
+ export interface AlertDialogPortalProps extends DialogPortalProps {
15
+ }
16
+ export const AlertDialogPortal: React.FC<AlertDialogPortalProps>;
12
17
  type DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
13
18
  export interface AlertDialogOverlayProps extends DialogOverlayProps {
14
19
  }
@@ -34,6 +39,7 @@ export interface AlertDialogCancelProps extends DialogCloseProps {
34
39
  export const AlertDialogCancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
35
40
  export const Root: React.FC<AlertDialogProps>;
36
41
  export const Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
42
+ export const Portal: React.FC<AlertDialogPortalProps>;
37
43
  export const Overlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
38
44
  export const Content: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
39
45
  export const Action: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1 +1 @@
1
- {"mappings":"A;A;A;AAeA,mBAAmB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,IAAI,CAAC,CAAC;AAC/E,iCAA2B,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;CAAG;AAEhE,OAAA,MAAM,aAAa,MAAM,EAAE,CAAC,gBAAgB,CAE3C,CAAC;AAUF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCAAkC,SAAQ,kBAAkB;CAAG;AAE/D,OAAA,MAAM,qHAEL,CAAC;AAWF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCAAkC,SAAQ,kBAAkB;CAAG;AAE/D,OAAA,MAAM,kHAEL,CAAC;AAkBF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCACE,SAAQ,IAAI,CAAC,kBAAkB,EAAE,sBAAsB,GAAG,mBAAmB,CAAC;CAAG;AAEnF,OAAA,MAAM,kHAyCL,CAAC;AAWF,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,KAAK,CAAC,CAAC;AACrF,sCAAgC,SAAQ,gBAAgB;CAAG;AAE3D,OAAA,MAAM,kHAEL,CAAC;AAWF,8BAA8B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,WAAW,CAAC,CAAC;AACjG,4CAAsC,SAAQ,sBAAsB;CAAG;AAEvE,OAAA,MAAM,gIAGmF,CAAC;AAW1F,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,KAAK,CAAC,CAAC;AACrF,uCAAiC,SAAQ,gBAAgB;CAAG;AAE5D,OAAA,MAAM,mHAEL,CAAC;AAWF,uCAAiC,SAAQ,gBAAgB;CAAG;AAE5D,OAAA,MAAM,mHAML,CAAC;AA6BF,OAAA,MAAM,gCAAkB,CAAC;AACzB,OAAA,MAAM,0GAA4B,CAAC;AACnC,OAAA,MAAM,uGAA4B,CAAC;AACnC,OAAA,MAAM,uGAA4B,CAAC;AACnC,OAAA,MAAM,wGAA0B,CAAC;AACjC,OAAA,MAAM,wGAA0B,CAAC;AACjC,OAAA,MAAM,uGAAwB,CAAC;AAC/B,OAAA,MAAM,qHAAoC,CAAC","sources":["./packages/react/alert-dialog/src/packages/react/alert-dialog/src/AlertDialog.tsx","./packages/react/alert-dialog/src/packages/react/alert-dialog/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
1
+ {"mappings":"A;A;A;AAkBA,OAAA,6FAEE,CAAC;AAGH,mBAAmB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,IAAI,CAAC,CAAC;AAC/E,iCAA2B,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;CAAG;AAEhE,OAAA,MAAM,aAAa,MAAM,EAAE,CAAC,gBAAgB,CAI3C,CAAC;AAUF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCAAkC,SAAQ,kBAAkB;CAAG;AAE/D,OAAA,MAAM,qHAML,CAAC;AAUF,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,MAAM,CAAC,CAAC;AACvF,uCAAiC,SAAQ,iBAAiB;CAAG;AAE7D,OAAA,MAAM,mBAAmB,MAAM,EAAE,CAAC,sBAAsB,CAMvD,CAAC;AAWF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCAAkC,SAAQ,kBAAkB;CAAG;AAE/D,OAAA,MAAM,kHAML,CAAC;AAkBF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACzF,wCACE,SAAQ,IAAI,CAAC,kBAAkB,EAAE,sBAAsB,GAAG,mBAAmB,CAAC;CAAG;AAEnF,OAAA,MAAM,kHA0CL,CAAC;AAWF,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,KAAK,CAAC,CAAC;AACrF,sCAAgC,SAAQ,gBAAgB;CAAG;AAE3D,OAAA,MAAM,kHAML,CAAC;AAWF,8BAA8B,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,WAAW,CAAC,CAAC;AACjG,4CAAsC,SAAQ,sBAAsB;CAAG;AAEvE,OAAA,MAAM,gIAOJ,CAAC;AAWH,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,KAAK,CAAC,CAAC;AACrF,uCAAiC,SAAQ,gBAAgB;CAAG;AAE5D,OAAA,MAAM,mHAML,CAAC;AAWF,uCAAiC,SAAQ,gBAAgB;CAAG;AAE5D,OAAA,MAAM,mHAQL,CAAC;AA6BF,OAAA,MAAM,gCAAkB,CAAC;AACzB,OAAA,MAAM,0GAA4B,CAAC;AACnC,OAAA,MAAM,wCAA0B,CAAC;AACjC,OAAA,MAAM,uGAA4B,CAAC;AACnC,OAAA,MAAM,uGAA4B,CAAC;AACnC,OAAA,MAAM,wGAA0B,CAAC;AACjC,OAAA,MAAM,wGAA0B,CAAC;AACjC,OAAA,MAAM,uGAAwB,CAAC;AAC/B,OAAA,MAAM,qHAAoC,CAAC","sources":["./packages/react/alert-dialog/src/packages/react/alert-dialog/src/AlertDialog.tsx","./packages/react/alert-dialog/src/packages/react/alert-dialog/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var e,t=require("@radix-ui/react-slot").Slottable,r=require("@radix-ui/primitive").composeEventHandlers,o=i({},require("@radix-ui/react-dialog")),n=require("@radix-ui/react-compose-refs").useComposedRefs,l=require("@radix-ui/react-context").createContext,a=i({},require("react")),c=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function i(e,t){return Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e}const s=e=>/*#__PURE__*/a.createElement(o.Root,c({},e,{modal:!0}));exports.AlertDialog=s;const u=/*#__PURE__*/a.forwardRef(((e,t)=>/*#__PURE__*/a.createElement(o.Trigger,c({},e,{ref:t}))));exports.AlertDialogTrigger=u;const f=/*#__PURE__*/a.forwardRef(((e,t)=>/*#__PURE__*/a.createElement(o.Overlay,c({},e,{ref:t}))));exports.AlertDialogOverlay=f;const[p,d]=l("AlertDialogContent"),g=/*#__PURE__*/a.forwardRef(((e,l)=>{const{children:i,...s}=e,u=a.useRef(null),f=n(l,u),d=a.useRef(null);/*#__PURE__*/return a.createElement(o.LabelWarningProvider,{value:a.useMemo((()=>({contentName:"AlertDialogContent",titleName:x,docsSlug:"alert-dialog"})),[])},/*#__PURE__*/a.createElement(p,{cancelRef:d},/*#__PURE__*/a.createElement(o.Content,c({role:"alertdialog"},s,{ref:f,onOpenAutoFocus:r(s.onOpenAutoFocus,(e=>{var t;e.preventDefault(),null===(t=d.current)||void 0===t||t.focus({preventScroll:!0})})),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()}),/*#__PURE__*/a.createElement(t,null,i),!1)))}));exports.AlertDialogContent=g;const x="AlertDialogTitle",m=/*#__PURE__*/a.forwardRef(((e,t)=>/*#__PURE__*/a.createElement(o.Title,c({},e,{ref:t}))));exports.AlertDialogTitle=m;const D=/*#__PURE__*/a.forwardRef(((e,t)=>/*#__PURE__*/a.createElement(o.Description,c({},e,{ref:t}))));exports.AlertDialogDescription=D;const A=/*#__PURE__*/a.forwardRef(((e,t)=>/*#__PURE__*/a.createElement(o.Close,c({},e,{ref:t}))));exports.AlertDialogAction=A;const v=/*#__PURE__*/a.forwardRef(((e,t)=>{const{cancelRef:r}=d("AlertDialogCancel"),l=n(t,r);/*#__PURE__*/return a.createElement(o.Close,c({},e,{ref:l}))}));exports.AlertDialogCancel=v;const R=s;exports.Root=R;const E=u;exports.Trigger=E;const C=f;exports.Overlay=C;const O=g;exports.Content=O;const w=A;exports.Action=w;const b=v;exports.Cancel=b;const q=m;exports.Title=q;const T=D;exports.Description=T;
1
+ var e,t=require("@radix-ui/react-slot").Slottable,r=require("@radix-ui/primitive").composeEventHandlers,o=require("@radix-ui/react-dialog"),l=u({},o),n=o.createDialogScope,a=require("@radix-ui/react-compose-refs").useComposedRefs,c=require("@radix-ui/react-context").createContextScope,s=u({},require("react")),i=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function u(e,t){return Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e}const[p,f]=c("AlertDialog",[n]);exports.createAlertDialogScope=f;const g=n(),D=e=>{const{__scopeAlertDialog:t,...r}=e,o=g(t);/*#__PURE__*/return s.createElement(l.Root,i({},o,r,{modal:!0}))};exports.AlertDialog=D;const d=/*#__PURE__*/s.forwardRef(((e,t)=>{const{__scopeAlertDialog:r,...o}=e,n=g(r);/*#__PURE__*/return s.createElement(l.Trigger,i({},n,o,{ref:t}))}));exports.AlertDialogTrigger=d;const A=e=>{const{__scopeAlertDialog:t,...r}=e,o=g(t);/*#__PURE__*/return s.createElement(l.Portal,i({},o,r))};exports.AlertDialogPortal=A;const x=/*#__PURE__*/s.forwardRef(((e,t)=>{const{__scopeAlertDialog:r,...o}=e,n=g(r);/*#__PURE__*/return s.createElement(l.Overlay,i({},n,o,{ref:t}))}));exports.AlertDialogOverlay=x;const[_,m]=p("AlertDialogContent"),E=/*#__PURE__*/s.forwardRef(((e,o)=>{const{__scopeAlertDialog:n,children:c,...u}=e,p=g(n),f=s.useRef(null),D=a(o,f),d=s.useRef(null);/*#__PURE__*/return s.createElement(l.LabelWarningProvider,{contentName:"AlertDialogContent",titleName:R,docsSlug:"alert-dialog"},/*#__PURE__*/s.createElement(_,{scope:n,cancelRef:d},/*#__PURE__*/s.createElement(l.Content,i({role:"alertdialog"},p,u,{ref:D,onOpenAutoFocus:r(u.onOpenAutoFocus,(e=>{var t;e.preventDefault(),null===(t=d.current)||void 0===t||t.focus({preventScroll:!0})})),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()}),/*#__PURE__*/s.createElement(t,null,c),!1)))}));exports.AlertDialogContent=E;const R="AlertDialogTitle",v=/*#__PURE__*/s.forwardRef(((e,t)=>{const{__scopeAlertDialog:r,...o}=e,n=g(r);/*#__PURE__*/return s.createElement(l.Title,i({},n,o,{ref:t}))}));exports.AlertDialogTitle=v;const C=/*#__PURE__*/s.forwardRef(((e,t)=>{const{__scopeAlertDialog:r,...o}=e,n=g(r);/*#__PURE__*/return s.createElement(l.Description,i({},n,o,{ref:t}))}));exports.AlertDialogDescription=C;const O=/*#__PURE__*/s.forwardRef(((e,t)=>{const{__scopeAlertDialog:r,...o}=e,n=g(r);/*#__PURE__*/return s.createElement(l.Close,i({},n,o,{ref:t}))}));exports.AlertDialogAction=O;const w=/*#__PURE__*/s.forwardRef(((e,t)=>{const{__scopeAlertDialog:r,...o}=e,{cancelRef:n}=m("AlertDialogCancel",r),c=g(r),u=a(t,n);/*#__PURE__*/return s.createElement(l.Close,i({},c,o,{ref:u}))}));exports.AlertDialogCancel=w;const b=D;exports.Root=b;const q=d;exports.Trigger=q;const T=A;exports.Portal=T;const P=x;exports.Overlay=P;const S=E;exports.Content=S;const y=O;exports.Action=y;const h=w;exports.Cancel=h;const j=v;exports.Title=j;const F=C;exports.Description=F;
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":"IAAgCA,uRAAAA,8CAClBA,EAAEC,WAAaD,EAAEE,QAAUF,EAWzC,SAASG,EAAuBC,EAAMC,GAcpC,OAbAC,OAAOC,KAAKF,GAAQG,SAAQ,SAASC,GACvB,YAARA,GAA6B,eAARA,GAIzBH,OAAOI,eAAeN,EAAMK,EAAK,CAC/BE,YAAY,EACZC,IAAK,WACH,OAAOP,EAAOI,SAKbL,ECbT,MAKMS,EAA2CC,gBAC/CC,EAAAC,cAACC,EAAgBC,KAAjBC,EAAA,GAA0BL,EAA1B,CAAiCM,OAAO,2BAQ1C,MAMMC,eAAqBC,EAAMC,YAC/B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgBQ,QAAjBN,EAAA,GAA6BL,EAA7B,CAAoCY,IAAKF,oCASpE,MAMMG,eAAqBL,EAAMC,YAC/B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgBW,QAAjBT,EAAA,GAA6BL,EAA7B,CAAoCY,IAAKF,oCASpE,MAMOK,EAA4BC,GACjCC,EAPmB,sBAcfC,eAAqBV,EAAMC,YAC/B,CAACT,EAAOU,KACN,MAAMS,SAAEA,KAAaC,GAAiBpB,EAChCqB,EAAab,EAAMc,OAAkC,MACrDC,EAAeC,EAAgBd,EAAcW,GAC7CI,EAAYjB,EAAMc,OAAwC,mBAEhE,OACErB,EAAAC,cAACC,EAAgBuB,qBAAjB,CACEC,MAAOnB,EAAMoB,SACX,KAAA,CAASC,YAxBE,qBAwByBC,UAAWC,EAAYC,SAAU,kBACrE,kBAGF/B,EAAAC,cAAC+B,EAAD,CAA4BR,UAAWA,gBACrCxB,EAAAC,cAACC,EAAgB+B,QAAjB7B,EAAA,CACE8B,KAAK,eACDf,EAFN,CAGER,IAAKW,EACLa,gBAAiBC,EAAqBjB,EAAagB,iBAAkBE,IAAU,IAAAC,EAC7ED,EAAME,iBACN,QAAAD,EAAAd,EAAUgB,eAAV,IAAAF,GAAAA,EAAmBG,MAAM,CAAEC,eAAe,OAE5CC,qBAAuBN,GAAUA,EAAME,iBACvCK,kBAAoBP,GAAUA,EAAME,gCAQpCvC,EAAAC,cAAC4C,EAAD,KAAY3B,IACX,qCAgBb,MAAMY,EAAa,mBAMbgB,eAAmBvC,EAAMC,YAC7B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgB6C,MAAjB3C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKF,kCASlE,MAMMuC,eAAyBzC,EAAMC,YAGnC,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgB+C,YAAjB7C,EAAA,GAAiCL,EAAjC,CAAwCY,IAAKF,wCAQxE,MAMMyC,eAAoB3C,EAAMC,YAC9B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgBiD,MAAjB/C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKF,mCASlE,MAKM2C,eAAoB7C,EAAMC,YAC9B,CAACT,EAAOU,KACN,MAAMe,UAAEA,GAAcT,EAPN,qBAQVJ,EAAMY,EAAgBd,EAAce,gBAC1C,OAAOxB,EAAAC,cAACC,EAAgBiD,MAAjB/C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKA,oCAYlD,MAmBMR,EAAOL,iBACb,MAAMY,EAAUJ,oBAChB,MAAMO,EAAUD,oBAChB,MAAMqB,EAAUhB,oBAChB,MAAMoC,EAASH,mBACf,MAAMI,EAASF,mBACf,MAAML,EAAQD,kBACd,MAAMG,EAAcD","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { createContext } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props) => (\n <DialogPrimitive.Root {...props} modal={true} />\n);\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props, forwardedRef) => <DialogPrimitive.Trigger {...props} ref={forwardedRef} />\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ntype AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;\ntype DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(\n (props, forwardedRef) => <DialogPrimitive.Overlay {...props} ref={forwardedRef} />\n);\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ntype DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n (props, forwardedRef) => {\n const { children, ...contentProps } = props;\n const contentRef = React.useRef<AlertDialogContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);\n\n return (\n <DialogPrimitive.LabelWarningProvider\n value={React.useMemo(\n () => ({ contentName: CONTENT_NAME, titleName: TITLE_NAME, docsSlug: 'alert-dialog' }),\n []\n )}\n >\n <AlertDialogContentProvider cancelRef={cancelRef}>\n <DialogPrimitive.Content\n role=\"alertdialog\"\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault();\n cancelRef.current?.focus({ preventScroll: true });\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogPrimitive.Content>\n </AlertDialogContentProvider>\n </DialogPrimitive.LabelWarningProvider>\n );\n }\n);\n\nAlertDialogContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle';\n\ntype AlertDialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;\ntype DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\ninterface AlertDialogTitleProps extends DialogTitleProps {}\n\nconst AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(\n (props, forwardedRef) => <DialogPrimitive.Title {...props} ref={forwardedRef} />\n);\n\nAlertDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription';\n\ntype AlertDialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Description>;\ntype DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;\ninterface AlertDialogDescriptionProps extends DialogDescriptionProps {}\n\nconst AlertDialogDescription = React.forwardRef<\n AlertDialogDescriptionElement,\n AlertDialogDescriptionProps\n>((props, forwardedRef) => <DialogPrimitive.Description {...props} ref={forwardedRef} />);\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction';\n\ntype AlertDialogActionElement = React.ElementRef<typeof DialogPrimitive.Close>;\ntype DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogActionProps extends DialogCloseProps {}\n\nconst AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(\n (props, forwardedRef) => <DialogPrimitive.Close {...props} ref={forwardedRef} />\n);\n\nAlertDialogAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel';\n\ntype AlertDialogCancelElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(\n (props, forwardedRef) => {\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME);\n const ref = useComposedRefs(forwardedRef, cancelRef);\n return <DialogPrimitive.Close {...props} ref={ref} />;\n }\n);\n\nAlertDialogCancel.displayName = CANCEL_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<AlertDialogContentElement>;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n const MESSAGE = `\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;\n\n React.useEffect(() => {\n const hasDescription = document.getElementById(\n contentRef.current?.getAttribute('aria-describedby')!\n );\n if (!hasDescription) console.warn(MESSAGE);\n }, [MESSAGE, contentRef]);\n\n return null;\n};\n\nconst Root = AlertDialog;\nconst Trigger = AlertDialogTrigger;\nconst Overlay = AlertDialogOverlay;\nconst Content = AlertDialogContent;\nconst Action = AlertDialogAction;\nconst Cancel = AlertDialogCancel;\nconst Title = AlertDialogTitle;\nconst Description = AlertDialogDescription;\n\nexport {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n};\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n};\n"],"names":["a","__esModule","default","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","AlertDialog","props","_react","createElement","_radixUiReactDialog","Root","_babelRuntimeHelpersExtends","modal","AlertDialogTrigger","React","forwardRef","forwardedRef","Trigger","ref","AlertDialogOverlay","Overlay","AlertDialogContentProvider","useAlertDialogContentContext","createContext","AlertDialogContent","children","contentProps","contentRef","useRef","composedRefs","useComposedRefs","cancelRef","LabelWarningProvider","value","useMemo","contentName","titleName","TITLE_NAME","docsSlug","$ce6149552ca6be39fd0092c861815af$var$AlertDialogContentProvider","Content","role","onOpenAutoFocus","composeEventHandlers","event","_cancelRef$current","preventDefault","current","focus","preventScroll","onPointerDownOutside","onInteractOutside","Slottable","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogAction","Close","AlertDialogCancel","Action","Cancel"],"version":3,"file":"index.js.map"}
1
+ {"mappings":"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","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { createDialogScope } from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;\n};\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...triggerProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal';\n\ntype DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Portal {...dialogScope} {...portalProps} />;\n};\n\nAlertDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ntype AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;\ntype DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Overlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ntype DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const contentRef = React.useRef<AlertDialogContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);\n\n return (\n <DialogPrimitive.LabelWarningProvider\n contentName={CONTENT_NAME}\n titleName={TITLE_NAME}\n docsSlug=\"alert-dialog\"\n >\n <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>\n <DialogPrimitive.Content\n role=\"alertdialog\"\n {...dialogScope}\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault();\n cancelRef.current?.focus({ preventScroll: true });\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogPrimitive.Content>\n </AlertDialogContentProvider>\n </DialogPrimitive.LabelWarningProvider>\n );\n }\n);\n\nAlertDialogContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle';\n\ntype AlertDialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;\ntype DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\ninterface AlertDialogTitleProps extends DialogTitleProps {}\n\nconst AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(\n (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...titleProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Title {...dialogScope} {...titleProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription';\n\ntype AlertDialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Description>;\ntype DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;\ninterface AlertDialogDescriptionProps extends DialogDescriptionProps {}\n\nconst AlertDialogDescription = React.forwardRef<\n AlertDialogDescriptionElement,\n AlertDialogDescriptionProps\n>((props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...descriptionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Description {...dialogScope} {...descriptionProps} ref={forwardedRef} />;\n});\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction';\n\ntype AlertDialogActionElement = React.ElementRef<typeof DialogPrimitive.Close>;\ntype DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogActionProps extends DialogCloseProps {}\n\nconst AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(\n (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...actionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Close {...dialogScope} {...actionProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel';\n\ntype AlertDialogCancelElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(\n (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...cancelProps } = props;\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const ref = useComposedRefs(forwardedRef, cancelRef);\n return <DialogPrimitive.Close {...dialogScope} {...cancelProps} ref={ref} />;\n }\n);\n\nAlertDialogCancel.displayName = CANCEL_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<AlertDialogContentElement>;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n const MESSAGE = `\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;\n\n React.useEffect(() => {\n const hasDescription = document.getElementById(\n contentRef.current?.getAttribute('aria-describedby')!\n );\n if (!hasDescription) console.warn(MESSAGE);\n }, [MESSAGE, contentRef]);\n\n return null;\n};\n\nconst Root = AlertDialog;\nconst Trigger = AlertDialogTrigger;\nconst Portal = AlertDialogPortal;\nconst Overlay = AlertDialogOverlay;\nconst Content = AlertDialogContent;\nconst Action = AlertDialogAction;\nconst Cancel = AlertDialogCancel;\nconst Title = AlertDialogTitle;\nconst Description = AlertDialogDescription;\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n};\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n};\n"],"names":["a","__esModule","default","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","createAlertDialogContext","createAlertDialogScope","createContextScope","createDialogScope","useDialogScope","AlertDialog","props","__scopeAlertDialog","alertDialogProps","dialogScope","_react","createElement","_radixUiReactDialog","Root","_babelRuntimeHelpersExtends","modal","AlertDialogTrigger","React","forwardRef","forwardedRef","triggerProps","Trigger","ref","AlertDialogPortal","portalProps","Portal","AlertDialogOverlay","overlayProps","Overlay","AlertDialogContentProvider","useAlertDialogContentContext","AlertDialogContent","children","contentProps","contentRef","useRef","composedRefs","useComposedRefs","cancelRef","LabelWarningProvider","contentName","titleName","TITLE_NAME","docsSlug","$ce6149552ca6be39fd0092c861815af$var$AlertDialogContentProvider","scope","Content","role","onOpenAutoFocus","composeEventHandlers","event","_cancelRef$current","preventDefault","current","focus","preventScroll","onPointerDownOutside","onInteractOutside","Slottable","AlertDialogTitle","titleProps","Title","AlertDialogDescription","descriptionProps","Description","AlertDialogAction","actionProps","Close","AlertDialogCancel","cancelProps","Action","Cancel"],"version":3,"file":"index.js.map"}
@@ -1,2 +1,2 @@
1
- import{Slottable as e}from"@radix-ui/react-slot";import{composeEventHandlers as t}from"@radix-ui/primitive";import*as r from"@radix-ui/react-dialog";import{useComposedRefs as o}from"@radix-ui/react-compose-refs";import{createContext as l}from"@radix-ui/react-context";import*as n from"react";import a from"@babel/runtime/helpers/esm/extends";export const AlertDialog=e=>/*#__PURE__*/n.createElement(r.Root,a({},e,{modal:!0}))/*#__PURE__*/;export const AlertDialogTrigger=/*#__PURE__*/n.forwardRef(((e,t)=>/*#__PURE__*/n.createElement(r.Trigger,a({},e,{ref:t}))));/*#__PURE__*/export const AlertDialogOverlay=/*#__PURE__*/n.forwardRef(((e,t)=>/*#__PURE__*/n.createElement(r.Overlay,a({},e,{ref:t}))));/*#__PURE__*/const[i,c]=l("AlertDialogContent");export const AlertDialogContent=/*#__PURE__*/n.forwardRef(((l,c)=>{const{children:f,...p}=l,g=n.useRef(null),m=o(c,g),u=n.useRef(null);/*#__PURE__*/return n.createElement(r.LabelWarningProvider,{value:n.useMemo((()=>({contentName:"AlertDialogContent",titleName:s,docsSlug:"alert-dialog"})),[])},/*#__PURE__*/n.createElement(i,{cancelRef:u},/*#__PURE__*/n.createElement(r.Content,a({role:"alertdialog"},p,{ref:m,onOpenAutoFocus:t(p.onOpenAutoFocus,(e=>{var t;e.preventDefault(),null===(t=u.current)||void 0===t||t.focus({preventScroll:!0})})),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()}),/*#__PURE__*/n.createElement(e,null,f),!1)))}));/*#__PURE__*/const s="AlertDialogTitle";export const AlertDialogTitle=/*#__PURE__*/n.forwardRef(((e,t)=>/*#__PURE__*/n.createElement(r.Title,a({},e,{ref:t}))));/*#__PURE__*/export const AlertDialogDescription=/*#__PURE__*/n.forwardRef(((e,t)=>/*#__PURE__*/n.createElement(r.Description,a({},e,{ref:t}))));/*#__PURE__*/export const AlertDialogAction=/*#__PURE__*/n.forwardRef(((e,t)=>/*#__PURE__*/n.createElement(r.Close,a({},e,{ref:t}))));/*#__PURE__*/export const AlertDialogCancel=/*#__PURE__*/n.forwardRef(((e,t)=>{const{cancelRef:l}=c("AlertDialogCancel"),i=o(t,l);/*#__PURE__*/return n.createElement(r.Close,a({},e,{ref:i}))}));/*#__PURE__*/export const Root=AlertDialog;export const Trigger=AlertDialogTrigger;export const Overlay=AlertDialogOverlay;export const Content=AlertDialogContent;export const Action=AlertDialogAction;export const Cancel=AlertDialogCancel;export const Title=AlertDialogTitle;export const Description=AlertDialogDescription;
1
+ import{Slottable as e}from"@radix-ui/react-slot";import{composeEventHandlers as t}from"@radix-ui/primitive";import*as r from"@radix-ui/react-dialog";import{createDialogScope as o}from"@radix-ui/react-dialog";import{useComposedRefs as l}from"@radix-ui/react-compose-refs";import{createContextScope as n}from"@radix-ui/react-context";import*as a from"react";import i from"@babel/runtime/helpers/esm/extends";const[c,s]=n("AlertDialog",[o]);export{s as createAlertDialogScope};const p=o();export const AlertDialog=e=>{const{__scopeAlertDialog:t,...o}=e,l=p(t);/*#__PURE__*/return a.createElement(r.Root,i({},l,o,{modal:!0}))};/*#__PURE__*/export const AlertDialogTrigger=/*#__PURE__*/a.forwardRef(((e,t)=>{const{__scopeAlertDialog:o,...l}=e,n=p(o);/*#__PURE__*/return a.createElement(r.Trigger,i({},n,l,{ref:t}))}));/*#__PURE__*/export const AlertDialogPortal=e=>{const{__scopeAlertDialog:t,...o}=e,l=p(t);/*#__PURE__*/return a.createElement(r.Portal,i({},l,o))};/*#__PURE__*/export const AlertDialogOverlay=/*#__PURE__*/a.forwardRef(((e,t)=>{const{__scopeAlertDialog:o,...l}=e,n=p(o);/*#__PURE__*/return a.createElement(r.Overlay,i({},n,l,{ref:t}))}));/*#__PURE__*/const[g,D]=c("AlertDialogContent");export const AlertDialogContent=/*#__PURE__*/a.forwardRef(((o,n)=>{const{__scopeAlertDialog:c,children:s,...D}=o,A=p(c),m=a.useRef(null),u=l(n,m),x=a.useRef(null);/*#__PURE__*/return a.createElement(r.LabelWarningProvider,{contentName:"AlertDialogContent",titleName:f,docsSlug:"alert-dialog"},/*#__PURE__*/a.createElement(g,{scope:c,cancelRef:x},/*#__PURE__*/a.createElement(r.Content,i({role:"alertdialog"},A,D,{ref:u,onOpenAutoFocus:t(D.onOpenAutoFocus,(e=>{var t;e.preventDefault(),null===(t=x.current)||void 0===t||t.focus({preventScroll:!0})})),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()}),/*#__PURE__*/a.createElement(e,null,s),!1)))}));/*#__PURE__*/const f="AlertDialogTitle";export const AlertDialogTitle=/*#__PURE__*/a.forwardRef(((e,t)=>{const{__scopeAlertDialog:o,...l}=e,n=p(o);/*#__PURE__*/return a.createElement(r.Title,i({},n,l,{ref:t}))}));/*#__PURE__*/export const AlertDialogDescription=/*#__PURE__*/a.forwardRef(((e,t)=>{const{__scopeAlertDialog:o,...l}=e,n=p(o);/*#__PURE__*/return a.createElement(r.Description,i({},n,l,{ref:t}))}));/*#__PURE__*/export const AlertDialogAction=/*#__PURE__*/a.forwardRef(((e,t)=>{const{__scopeAlertDialog:o,...l}=e,n=p(o);/*#__PURE__*/return a.createElement(r.Close,i({},n,l,{ref:t}))}));/*#__PURE__*/export const AlertDialogCancel=/*#__PURE__*/a.forwardRef(((e,t)=>{const{__scopeAlertDialog:o,...n}=e,{cancelRef:c}=D("AlertDialogCancel",o),s=p(o),g=l(t,c);/*#__PURE__*/return a.createElement(r.Close,i({},s,n,{ref:g}))}));/*#__PURE__*/export const Root=AlertDialog;export const Trigger=AlertDialogTrigger;export const Portal=AlertDialogPortal;export const Overlay=AlertDialogOverlay;export const Content=AlertDialogContent;export const Action=AlertDialogAction;export const Cancel=AlertDialogCancel;export const Title=AlertDialogTitle;export const Description=AlertDialogDescription;
2
2
  //# sourceMappingURL=index.module.js.map
@@ -1 +1 @@
1
- {"mappings":"6VAkBA,MAAMA,YAA2CC,gBAC/CC,EAAAC,cAACC,EAAgBC,KAAjBC,EAAA,GAA0BL,EAA1B,CAAiCM,OAAO,yBAc1C,MAAMC,gCAAqBC,EAAMC,YAC/B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgBQ,QAAjBN,EAAA,GAA6BL,EAA7B,CAAoCY,IAAKF,2BAepE,MAAMG,gCAAqBL,EAAMC,YAC/B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgBW,QAAjBT,EAAA,GAA6BL,EAA7B,CAAoCY,IAAKF,oBASpE,MAMOK,EAA4BC,GACjCC,EAPmB,6BAcrB,MAAMC,gCAAqBV,EAAMC,YAC/B,CAACT,EAAOU,KACN,MAAMS,SAAEA,KAAaC,GAAiBpB,EAChCqB,EAAab,EAAMc,OAAkC,MACrDC,EAAeC,EAAgBd,EAAcW,GAC7CI,EAAYjB,EAAMc,OAAwC,mBAEhE,OACErB,EAAAC,cAACC,EAAgBuB,qBAAjB,CACEC,MAAOnB,EAAMoB,SACX,KAAA,CAASC,YAxBE,qBAwByBC,UAAWC,EAAYC,SAAU,kBACrE,kBAGF/B,EAAAC,cAAC+B,EAAD,CAA4BR,UAAWA,gBACrCxB,EAAAC,cAACC,EAAgB+B,QAAjB7B,EAAA,CACE8B,KAAK,eACDf,EAFN,CAGER,IAAKW,EACLa,gBAAiBC,EAAqBjB,EAAagB,iBAAkBE,IAAU,IAAAC,EAC7ED,EAAME,iBACN,QAAAD,EAAAd,EAAUgB,eAAV,IAAAF,GAAAA,EAAmBG,MAAM,CAAEC,eAAe,OAE5CC,qBAAuBN,GAAUA,EAAME,iBACvCK,kBAAoBP,GAAUA,EAAME,gCAQpCvC,EAAAC,cAAC4C,EAAD,KAAY3B,IACX,qBAgBb,MAAMY,EAAa,0BAMnB,MAAMgB,8BAAmBvC,EAAMC,YAC7B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgB6C,MAAjB3C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKF,2BAelE,MAAMuC,oCAAyBzC,EAAMC,YAGnC,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgB+C,YAAjB7C,EAAA,GAAiCL,EAAjC,CAAwCY,IAAKF,2BAcxE,MAAMyC,+BAAoB3C,EAAMC,YAC9B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgBiD,MAAjB/C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKF,2BAclE,MAAM2C,+BAAoB7C,EAAMC,YAC9B,CAACT,EAAOU,KACN,MAAMe,UAAEA,GAAcT,EAPN,qBAQVJ,EAAMY,EAAgBd,EAAce,gBAC1C,OAAOxB,EAAAC,cAACC,EAAgBiD,MAAjB/C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKA,4BA+BlD,MAAMR,KAAOL,mBACb,MAAMY,QAAUJ,0BAChB,MAAMO,QAAUD,0BAChB,MAAMqB,QAAUhB,0BAChB,MAAMoC,OAASH,yBACf,MAAMI,OAASF,yBACf,MAAML,MAAQD,wBACd,MAAMG,YAAcD","sources":["./packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { createContext } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props) => (\n <DialogPrimitive.Root {...props} modal={true} />\n);\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props, forwardedRef) => <DialogPrimitive.Trigger {...props} ref={forwardedRef} />\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ntype AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;\ntype DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(\n (props, forwardedRef) => <DialogPrimitive.Overlay {...props} ref={forwardedRef} />\n);\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ntype DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n (props, forwardedRef) => {\n const { children, ...contentProps } = props;\n const contentRef = React.useRef<AlertDialogContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);\n\n return (\n <DialogPrimitive.LabelWarningProvider\n value={React.useMemo(\n () => ({ contentName: CONTENT_NAME, titleName: TITLE_NAME, docsSlug: 'alert-dialog' }),\n []\n )}\n >\n <AlertDialogContentProvider cancelRef={cancelRef}>\n <DialogPrimitive.Content\n role=\"alertdialog\"\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault();\n cancelRef.current?.focus({ preventScroll: true });\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogPrimitive.Content>\n </AlertDialogContentProvider>\n </DialogPrimitive.LabelWarningProvider>\n );\n }\n);\n\nAlertDialogContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle';\n\ntype AlertDialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;\ntype DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\ninterface AlertDialogTitleProps extends DialogTitleProps {}\n\nconst AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(\n (props, forwardedRef) => <DialogPrimitive.Title {...props} ref={forwardedRef} />\n);\n\nAlertDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription';\n\ntype AlertDialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Description>;\ntype DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;\ninterface AlertDialogDescriptionProps extends DialogDescriptionProps {}\n\nconst AlertDialogDescription = React.forwardRef<\n AlertDialogDescriptionElement,\n AlertDialogDescriptionProps\n>((props, forwardedRef) => <DialogPrimitive.Description {...props} ref={forwardedRef} />);\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction';\n\ntype AlertDialogActionElement = React.ElementRef<typeof DialogPrimitive.Close>;\ntype DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogActionProps extends DialogCloseProps {}\n\nconst AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(\n (props, forwardedRef) => <DialogPrimitive.Close {...props} ref={forwardedRef} />\n);\n\nAlertDialogAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel';\n\ntype AlertDialogCancelElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(\n (props, forwardedRef) => {\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME);\n const ref = useComposedRefs(forwardedRef, cancelRef);\n return <DialogPrimitive.Close {...props} ref={ref} />;\n }\n);\n\nAlertDialogCancel.displayName = CANCEL_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<AlertDialogContentElement>;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n const MESSAGE = `\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;\n\n React.useEffect(() => {\n const hasDescription = document.getElementById(\n contentRef.current?.getAttribute('aria-describedby')!\n );\n if (!hasDescription) console.warn(MESSAGE);\n }, [MESSAGE, contentRef]);\n\n return null;\n};\n\nconst Root = AlertDialog;\nconst Trigger = AlertDialogTrigger;\nconst Overlay = AlertDialogOverlay;\nconst Content = AlertDialogContent;\nconst Action = AlertDialogAction;\nconst Cancel = AlertDialogCancel;\nconst Title = AlertDialogTitle;\nconst Description = AlertDialogDescription;\n\nexport {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n};\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n};\n"],"names":["AlertDialog","props","_react","createElement","_radixUiReactDialog","Root","_babelRuntimeHelpersEsmExtends","modal","AlertDialogTrigger","React","forwardRef","forwardedRef","Trigger","ref","AlertDialogOverlay","Overlay","AlertDialogContentProvider","useAlertDialogContentContext","createContext","AlertDialogContent","children","contentProps","contentRef","useRef","composedRefs","useComposedRefs","cancelRef","LabelWarningProvider","value","useMemo","contentName","titleName","TITLE_NAME","docsSlug","$ef785a422a78f23629aa4850fe3fc$var$AlertDialogContentProvider","Content","role","onOpenAutoFocus","composeEventHandlers","event","_cancelRef$current","preventDefault","current","focus","preventScroll","onPointerDownOutside","onInteractOutside","Slottable","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogAction","Close","AlertDialogCancel","Action","Cancel"],"version":3,"file":"index.module.js.map"}
1
+ {"mappings":"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","sources":["./packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { createDialogScope } from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;\n};\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...triggerProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal';\n\ntype DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Portal {...dialogScope} {...portalProps} />;\n};\n\nAlertDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ntype AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;\ntype DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Overlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ntype DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const contentRef = React.useRef<AlertDialogContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);\n\n return (\n <DialogPrimitive.LabelWarningProvider\n contentName={CONTENT_NAME}\n titleName={TITLE_NAME}\n docsSlug=\"alert-dialog\"\n >\n <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>\n <DialogPrimitive.Content\n role=\"alertdialog\"\n {...dialogScope}\n {...contentProps}\n ref={composedRefs}\n onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {\n event.preventDefault();\n cancelRef.current?.focus({ preventScroll: true });\n })}\n onPointerDownOutside={(event) => event.preventDefault()}\n onInteractOutside={(event) => event.preventDefault()}\n >\n {/**\n * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`\n * around everything, otherwise the `DescriptionWarning` would be rendered straight away.\n * This is because we want the accessibility checks to run only once the content is actually\n * open and that behaviour is already encapsulated in `DialogContent`.\n */}\n <Slottable>{children}</Slottable>\n {process.env.NODE_ENV === 'development' && (\n <DescriptionWarning contentRef={contentRef} />\n )}\n </DialogPrimitive.Content>\n </AlertDialogContentProvider>\n </DialogPrimitive.LabelWarningProvider>\n );\n }\n);\n\nAlertDialogContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle';\n\ntype AlertDialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;\ntype DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\ninterface AlertDialogTitleProps extends DialogTitleProps {}\n\nconst AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(\n (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...titleProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Title {...dialogScope} {...titleProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription';\n\ntype AlertDialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Description>;\ntype DialogDescriptionProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;\ninterface AlertDialogDescriptionProps extends DialogDescriptionProps {}\n\nconst AlertDialogDescription = React.forwardRef<\n AlertDialogDescriptionElement,\n AlertDialogDescriptionProps\n>((props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...descriptionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Description {...dialogScope} {...descriptionProps} ref={forwardedRef} />;\n});\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction';\n\ntype AlertDialogActionElement = React.ElementRef<typeof DialogPrimitive.Close>;\ntype DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogActionProps extends DialogCloseProps {}\n\nconst AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(\n (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...actionProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Close {...dialogScope} {...actionProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel';\n\ntype AlertDialogCancelElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface AlertDialogCancelProps extends DialogCloseProps {}\n\nconst AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(\n (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...cancelProps } = props;\n const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const ref = useComposedRefs(forwardedRef, cancelRef);\n return <DialogPrimitive.Close {...dialogScope} {...cancelProps} ref={ref} />;\n }\n);\n\nAlertDialogCancel.displayName = CANCEL_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<AlertDialogContentElement>;\n};\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef }) => {\n const MESSAGE = `\\`${CONTENT_NAME}\\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \\`${CONTENT_NAME}\\` by passing a \\`${DESCRIPTION_NAME}\\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \\`id\\` and passing the same value to the \\`aria-describedby\\` prop in \\`${CONTENT_NAME}\\`. If the description is confusing or duplicative for sighted users, you can use the \\`@radix-ui/react-visually-hidden\\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;\n\n React.useEffect(() => {\n const hasDescription = document.getElementById(\n contentRef.current?.getAttribute('aria-describedby')!\n );\n if (!hasDescription) console.warn(MESSAGE);\n }, [MESSAGE, contentRef]);\n\n return null;\n};\n\nconst Root = AlertDialog;\nconst Trigger = AlertDialogTrigger;\nconst Portal = AlertDialogPortal;\nconst Overlay = AlertDialogOverlay;\nconst Content = AlertDialogContent;\nconst Action = AlertDialogAction;\nconst Cancel = AlertDialogCancel;\nconst Title = AlertDialogTitle;\nconst Description = AlertDialogDescription;\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n};\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n};\n"],"names":["createAlertDialogContext","createAlertDialogScope","createContextScope","createDialogScope","useDialogScope","AlertDialog","props","__scopeAlertDialog","alertDialogProps","dialogScope","_react","createElement","_radixUiReactDialog","Root","_babelRuntimeHelpersEsmExtends","modal","AlertDialogTrigger","React","forwardRef","forwardedRef","triggerProps","Trigger","ref","AlertDialogPortal","portalProps","Portal","AlertDialogOverlay","overlayProps","Overlay","AlertDialogContentProvider","useAlertDialogContentContext","AlertDialogContent","children","contentProps","contentRef","useRef","composedRefs","useComposedRefs","cancelRef","LabelWarningProvider","contentName","titleName","TITLE_NAME","docsSlug","$ef785a422a78f23629aa4850fe3fc$var$AlertDialogContentProvider","scope","Content","role","onOpenAutoFocus","composeEventHandlers","event","_cancelRef$current","preventDefault","current","focus","preventScroll","onPointerDownOutside","onInteractOutside","Slottable","AlertDialogTitle","titleProps","Title","AlertDialogDescription","descriptionProps","Description","AlertDialogAction","actionProps","Close","AlertDialogCancel","cancelProps","Action","Cancel"],"version":3,"file":"index.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-alert-dialog",
3
- "version": "0.1.1-rc.8",
3
+ "version": "0.1.2-rc.10",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -19,9 +19,10 @@
19
19
  "@babel/runtime": "^7.13.10",
20
20
  "@radix-ui/primitive": "0.1.0",
21
21
  "@radix-ui/react-compose-refs": "0.1.0",
22
- "@radix-ui/react-context": "0.1.0",
23
- "@radix-ui/react-dialog": "0.1.1-rc.7",
24
- "@radix-ui/react-slot": "0.1.1-rc.3"
22
+ "@radix-ui/react-context": "0.1.1",
23
+ "@radix-ui/react-dialog": "0.1.2-rc.9",
24
+ "@radix-ui/react-primitive": "0.1.1",
25
+ "@radix-ui/react-slot": "0.1.1"
25
26
  },
26
27
  "peerDependencies": {
27
28
  "react": ">=16.8",
@@ -35,5 +36,5 @@
35
36
  "bugs": {
36
37
  "url": "https://github.com/radix-ui/primitives/issues"
37
38
  },
38
- "stableVersion": "0.1.0"
39
+ "stableVersion": "0.1.1"
39
40
  }
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import {
3
3
  AlertDialog,
4
4
  AlertDialogTrigger,
5
+ AlertDialogPortal,
5
6
  AlertDialogOverlay,
6
7
  AlertDialogContent,
7
8
  AlertDialogTitle,
@@ -16,15 +17,17 @@ export default { title: 'Components/AlertDialog' };
16
17
  export const Styled = () => (
17
18
  <AlertDialog>
18
19
  <AlertDialogTrigger className={triggerClass}>delete everything</AlertDialogTrigger>
19
- <AlertDialogOverlay className={overlayClass} />
20
- <AlertDialogContent className={contentClass}>
21
- <AlertDialogTitle className={titleClass}>Are you sure?</AlertDialogTitle>
22
- <AlertDialogDescription className={descriptionClass}>
23
- This will do a very dangerous thing. Thar be dragons!
24
- </AlertDialogDescription>
25
- <AlertDialogAction className={actionClass}>yolo, do it</AlertDialogAction>
26
- <AlertDialogCancel className={cancelClass}>maybe not</AlertDialogCancel>
27
- </AlertDialogContent>
20
+ <AlertDialogPortal>
21
+ <AlertDialogOverlay className={overlayClass} />
22
+ <AlertDialogContent className={contentClass}>
23
+ <AlertDialogTitle className={titleClass}>Are you sure?</AlertDialogTitle>
24
+ <AlertDialogDescription className={descriptionClass}>
25
+ This will do a very dangerous thing. Thar be dragons!
26
+ </AlertDialogDescription>
27
+ <AlertDialogAction className={actionClass}>yolo, do it</AlertDialogAction>
28
+ <AlertDialogCancel className={cancelClass}>maybe not</AlertDialogCancel>
29
+ </AlertDialogContent>
30
+ </AlertDialogPortal>
28
31
  </AlertDialog>
29
32
  );
30
33
 
@@ -48,18 +51,22 @@ export const Controlled = () => {
48
51
  >
49
52
  {housePurchased ? 'You bought the house! Sell it!' : 'Buy this house'}
50
53
  </AlertDialogTrigger>
51
- <AlertDialogOverlay className={overlayClass} />
52
- <AlertDialogContent className={contentClass}>
53
- <AlertDialogTitle>Are you sure?</AlertDialogTitle>
54
- <AlertDialogDescription>
55
- Houses are very expensive and it looks like you only have €20 in the bank. Maybe consult
56
- with a financial advisor?
57
- </AlertDialogDescription>
58
- <AlertDialogAction className={actionClass} onClick={() => setHousePurchased(true)}>
59
- buy it anyway
60
- </AlertDialogAction>
61
- <AlertDialogCancel className={cancelClass}>good point, I'll reconsider</AlertDialogCancel>
62
- </AlertDialogContent>
54
+ <AlertDialogPortal>
55
+ <AlertDialogOverlay className={overlayClass} />
56
+ <AlertDialogContent className={contentClass}>
57
+ <AlertDialogTitle>Are you sure?</AlertDialogTitle>
58
+ <AlertDialogDescription>
59
+ Houses are very expensive and it looks like you only have €20 in the bank. Maybe
60
+ consult with a financial advisor?
61
+ </AlertDialogDescription>
62
+ <AlertDialogAction className={actionClass} onClick={() => setHousePurchased(true)}>
63
+ buy it anyway
64
+ </AlertDialogAction>
65
+ <AlertDialogCancel className={cancelClass}>
66
+ good point, I'll reconsider
67
+ </AlertDialogCancel>
68
+ </AlertDialogContent>
69
+ </AlertDialogPortal>
63
70
  </AlertDialog>
64
71
  </div>
65
72
  );
@@ -79,28 +86,36 @@ export const Chromatic = () => (
79
86
  <h2>Closed</h2>
80
87
  <AlertDialog>
81
88
  <AlertDialogTrigger className={triggerClass}>delete everything</AlertDialogTrigger>
82
- <AlertDialogOverlay className={overlayClass} />
83
- <AlertDialogContent className={chromaticContentClass}>
84
- <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
85
- <AlertDialogDescription className={descriptionClass}>Description</AlertDialogDescription>
86
- <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
87
- <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
88
- </AlertDialogContent>
89
+ <AlertDialogPortal>
90
+ <AlertDialogOverlay className={overlayClass} />
91
+ <AlertDialogContent className={chromaticContentClass}>
92
+ <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
93
+ <AlertDialogDescription className={descriptionClass}>
94
+ Description
95
+ </AlertDialogDescription>
96
+ <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
97
+ <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
98
+ </AlertDialogContent>
99
+ </AlertDialogPortal>
89
100
  </AlertDialog>
90
101
 
91
102
  <h2>Open</h2>
92
103
  <AlertDialog defaultOpen>
93
104
  <AlertDialogTrigger className={triggerClass}>delete everything</AlertDialogTrigger>
94
- <AlertDialogOverlay
95
- className={overlayClass}
96
- style={{ left: 0, bottom: '50%', width: '25%' }}
97
- />
98
- <AlertDialogContent className={chromaticContentClass} style={{ top: '25%', left: '12%' }}>
99
- <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
100
- <AlertDialogDescription className={descriptionClass}>Description</AlertDialogDescription>
101
- <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
102
- <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
103
- </AlertDialogContent>
105
+ <AlertDialogPortal>
106
+ <AlertDialogOverlay
107
+ className={overlayClass}
108
+ style={{ left: 0, bottom: '50%', width: '25%' }}
109
+ />
110
+ <AlertDialogContent className={chromaticContentClass} style={{ top: '25%', left: '12%' }}>
111
+ <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
112
+ <AlertDialogDescription className={descriptionClass}>
113
+ Description
114
+ </AlertDialogDescription>
115
+ <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
116
+ <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
117
+ </AlertDialogContent>
118
+ </AlertDialogPortal>
104
119
  </AlertDialog>
105
120
  </div>
106
121
 
@@ -108,28 +123,36 @@ export const Chromatic = () => (
108
123
  <h1>Uncontrolled with reordered parts</h1>
109
124
  <h2>Closed</h2>
110
125
  <AlertDialog>
111
- <AlertDialogOverlay className={overlayClass} />
112
- <AlertDialogContent className={chromaticContentClass}>
113
- <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
114
- <AlertDialogDescription className={descriptionClass}>Description</AlertDialogDescription>
115
- <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
116
- <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
117
- </AlertDialogContent>
126
+ <AlertDialogPortal>
127
+ <AlertDialogOverlay className={overlayClass} />
128
+ <AlertDialogContent className={chromaticContentClass}>
129
+ <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
130
+ <AlertDialogDescription className={descriptionClass}>
131
+ Description
132
+ </AlertDialogDescription>
133
+ <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
134
+ <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
135
+ </AlertDialogContent>
136
+ </AlertDialogPortal>
118
137
  <AlertDialogTrigger className={triggerClass}>delete everything</AlertDialogTrigger>
119
138
  </AlertDialog>
120
139
 
121
140
  <h2>Open</h2>
122
141
  <AlertDialog defaultOpen>
123
- <AlertDialogOverlay
124
- className={overlayClass}
125
- style={{ left: '25%', bottom: '50%', width: '25%' }}
126
- />
127
- <AlertDialogContent className={chromaticContentClass} style={{ top: '25%', left: '37%' }}>
128
- <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
129
- <AlertDialogDescription className={descriptionClass}>Description</AlertDialogDescription>
130
- <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
131
- <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
132
- </AlertDialogContent>
142
+ <AlertDialogPortal>
143
+ <AlertDialogOverlay
144
+ className={overlayClass}
145
+ style={{ left: '25%', bottom: '50%', width: '25%' }}
146
+ />
147
+ <AlertDialogContent className={chromaticContentClass} style={{ top: '25%', left: '37%' }}>
148
+ <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
149
+ <AlertDialogDescription className={descriptionClass}>
150
+ Description
151
+ </AlertDialogDescription>
152
+ <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
153
+ <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
154
+ </AlertDialogContent>
155
+ </AlertDialogPortal>
133
156
  <AlertDialogTrigger className={triggerClass}>delete everything</AlertDialogTrigger>
134
157
  </AlertDialog>
135
158
  </div>
@@ -139,28 +162,36 @@ export const Chromatic = () => (
139
162
  <h2>Closed</h2>
140
163
  <AlertDialog open={false}>
141
164
  <AlertDialogTrigger className={triggerClass}>delete everything</AlertDialogTrigger>
142
- <AlertDialogOverlay className={overlayClass} />
143
- <AlertDialogContent className={chromaticContentClass}>
144
- <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
145
- <AlertDialogDescription className={descriptionClass}>Description</AlertDialogDescription>
146
- <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
147
- <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
148
- </AlertDialogContent>
165
+ <AlertDialogPortal>
166
+ <AlertDialogOverlay className={overlayClass} />
167
+ <AlertDialogContent className={chromaticContentClass}>
168
+ <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
169
+ <AlertDialogDescription className={descriptionClass}>
170
+ Description
171
+ </AlertDialogDescription>
172
+ <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
173
+ <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
174
+ </AlertDialogContent>
175
+ </AlertDialogPortal>
149
176
  </AlertDialog>
150
177
 
151
178
  <h2>Open</h2>
152
179
  <AlertDialog open>
153
180
  <AlertDialogTrigger className={triggerClass}>delete everything</AlertDialogTrigger>
154
- <AlertDialogOverlay
155
- className={overlayClass}
156
- style={{ left: '50%', bottom: '50%', width: '25%' }}
157
- />
158
- <AlertDialogContent className={chromaticContentClass} style={{ top: '25%', left: '62%' }}>
159
- <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
160
- <AlertDialogDescription className={descriptionClass}>Description</AlertDialogDescription>
161
- <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
162
- <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
163
- </AlertDialogContent>
181
+ <AlertDialogPortal>
182
+ <AlertDialogOverlay
183
+ className={overlayClass}
184
+ style={{ left: '50%', bottom: '50%', width: '25%' }}
185
+ />
186
+ <AlertDialogContent className={chromaticContentClass} style={{ top: '25%', left: '62%' }}>
187
+ <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
188
+ <AlertDialogDescription className={descriptionClass}>
189
+ Description
190
+ </AlertDialogDescription>
191
+ <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
192
+ <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
193
+ </AlertDialogContent>
194
+ </AlertDialogPortal>
164
195
  </AlertDialog>
165
196
  </div>
166
197
 
@@ -168,28 +199,36 @@ export const Chromatic = () => (
168
199
  <h1>Controlled with reordered parts</h1>
169
200
  <h2>Closed</h2>
170
201
  <AlertDialog open={false}>
171
- <AlertDialogOverlay className={overlayClass} />
172
- <AlertDialogContent className={chromaticContentClass}>
173
- <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
174
- <AlertDialogDescription className={descriptionClass}>Description</AlertDialogDescription>
175
- <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
176
- <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
177
- </AlertDialogContent>
202
+ <AlertDialogPortal>
203
+ <AlertDialogOverlay className={overlayClass} />
204
+ <AlertDialogContent className={chromaticContentClass}>
205
+ <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
206
+ <AlertDialogDescription className={descriptionClass}>
207
+ Description
208
+ </AlertDialogDescription>
209
+ <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
210
+ <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
211
+ </AlertDialogContent>
212
+ </AlertDialogPortal>
178
213
  <AlertDialogTrigger className={triggerClass}>delete everything</AlertDialogTrigger>
179
214
  </AlertDialog>
180
215
 
181
216
  <h2>Open</h2>
182
217
  <AlertDialog open>
183
- <AlertDialogOverlay
184
- className={overlayClass}
185
- style={{ left: '75%', bottom: '50%', width: '25%' }}
186
- />
187
- <AlertDialogContent className={chromaticContentClass} style={{ top: '25%', left: '88%' }}>
188
- <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
189
- <AlertDialogDescription className={descriptionClass}>Description</AlertDialogDescription>
190
- <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
191
- <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
192
- </AlertDialogContent>
218
+ <AlertDialogPortal>
219
+ <AlertDialogOverlay
220
+ className={overlayClass}
221
+ style={{ left: '75%', bottom: '50%', width: '25%' }}
222
+ />
223
+ <AlertDialogContent className={chromaticContentClass} style={{ top: '25%', left: '88%' }}>
224
+ <AlertDialogTitle className={titleClass}>Title</AlertDialogTitle>
225
+ <AlertDialogDescription className={descriptionClass}>
226
+ Description
227
+ </AlertDialogDescription>
228
+ <AlertDialogAction className={actionClass}>Confirm</AlertDialogAction>
229
+ <AlertDialogCancel className={cancelClass}>Cancel</AlertDialogCancel>
230
+ </AlertDialogContent>
231
+ </AlertDialogPortal>
193
232
  <AlertDialogTrigger className={triggerClass}>delete everything</AlertDialogTrigger>
194
233
  </AlertDialog>
195
234
  </div>
@@ -199,29 +238,33 @@ export const Chromatic = () => (
199
238
  <h2>Closed</h2>
200
239
  <AlertDialog>
201
240
  <AlertDialogTrigger className={triggerAttrClass}>delete everything</AlertDialogTrigger>
202
- <AlertDialogOverlay className={overlayAttrClass} />
203
- <AlertDialogContent className={contentAttrClass}>
204
- <AlertDialogTitle className={titleAttrClass}>Title</AlertDialogTitle>
205
- <AlertDialogDescription className={descriptionAttrClass}>
206
- Description
207
- </AlertDialogDescription>
208
- <AlertDialogAction className={actionAttrClass}>Confirm</AlertDialogAction>
209
- <AlertDialogCancel className={cancelAttrClass}>Cancel</AlertDialogCancel>
210
- </AlertDialogContent>
241
+ <AlertDialogPortal>
242
+ <AlertDialogOverlay className={overlayAttrClass} />
243
+ <AlertDialogContent className={contentAttrClass}>
244
+ <AlertDialogTitle className={titleAttrClass}>Title</AlertDialogTitle>
245
+ <AlertDialogDescription className={descriptionAttrClass}>
246
+ Description
247
+ </AlertDialogDescription>
248
+ <AlertDialogAction className={actionAttrClass}>Confirm</AlertDialogAction>
249
+ <AlertDialogCancel className={cancelAttrClass}>Cancel</AlertDialogCancel>
250
+ </AlertDialogContent>
251
+ </AlertDialogPortal>
211
252
  </AlertDialog>
212
253
 
213
254
  <h2>Open</h2>
214
255
  <AlertDialog defaultOpen>
215
256
  <AlertDialogTrigger className={triggerAttrClass}>delete everything</AlertDialogTrigger>
216
- <AlertDialogOverlay className={overlayAttrClass} style={{ top: '50%' }} />
217
- <AlertDialogContent className={contentAttrClass} style={{ top: '75%' }}>
218
- <AlertDialogTitle className={titleAttrClass}>Title</AlertDialogTitle>
219
- <AlertDialogDescription className={descriptionAttrClass}>
220
- Description
221
- </AlertDialogDescription>
222
- <AlertDialogAction className={actionAttrClass}>Confirm</AlertDialogAction>
223
- <AlertDialogCancel className={cancelAttrClass}>Cancel</AlertDialogCancel>
224
- </AlertDialogContent>
257
+ <AlertDialogPortal>
258
+ <AlertDialogOverlay className={overlayAttrClass} style={{ top: '50%' }} />
259
+ <AlertDialogContent className={contentAttrClass} style={{ top: '75%' }}>
260
+ <AlertDialogTitle className={titleAttrClass}>Title</AlertDialogTitle>
261
+ <AlertDialogDescription className={descriptionAttrClass}>
262
+ Description
263
+ </AlertDialogDescription>
264
+ <AlertDialogAction className={actionAttrClass}>Confirm</AlertDialogAction>
265
+ <AlertDialogCancel className={cancelAttrClass}>Cancel</AlertDialogCancel>
266
+ </AlertDialogContent>
267
+ </AlertDialogPortal>
225
268
  </AlertDialog>
226
269
  </div>
227
270
  </div>
@@ -1,11 +1,13 @@
1
1
  import * as React from 'react';
2
- import { createContext } from '@radix-ui/react-context';
2
+ import { createContextScope } from '@radix-ui/react-context';
3
3
  import { useComposedRefs } from '@radix-ui/react-compose-refs';
4
4
  import * as DialogPrimitive from '@radix-ui/react-dialog';
5
+ import { createDialogScope } from '@radix-ui/react-dialog';
5
6
  import { composeEventHandlers } from '@radix-ui/primitive';
6
7
  import { Slottable } from '@radix-ui/react-slot';
7
8
 
8
9
  import type * as Radix from '@radix-ui/react-primitive';
10
+ import type { Scope } from '@radix-ui/react-context';
9
11
 
10
12
  /* -------------------------------------------------------------------------------------------------
11
13
  * AlertDialog
@@ -13,12 +15,20 @@ import type * as Radix from '@radix-ui/react-primitive';
13
15
 
14
16
  const ROOT_NAME = 'AlertDialog';
15
17
 
18
+ type ScopedProps<P> = P & { __scopeAlertDialog?: Scope };
19
+ const [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [
20
+ createDialogScope,
21
+ ]);
22
+ const useDialogScope = createDialogScope();
23
+
16
24
  type DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
17
25
  interface AlertDialogProps extends Omit<DialogProps, 'modal'> {}
18
26
 
19
- const AlertDialog: React.FC<AlertDialogProps> = (props) => (
20
- <DialogPrimitive.Root {...props} modal={true} />
21
- );
27
+ const AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {
28
+ const { __scopeAlertDialog, ...alertDialogProps } = props;
29
+ const dialogScope = useDialogScope(__scopeAlertDialog);
30
+ return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;
31
+ };
22
32
 
23
33
  AlertDialog.displayName = ROOT_NAME;
24
34
 
@@ -32,11 +42,34 @@ type DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.
32
42
  interface AlertDialogTriggerProps extends DialogTriggerProps {}
33
43
 
34
44
  const AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(
35
- (props, forwardedRef) => <DialogPrimitive.Trigger {...props} ref={forwardedRef} />
45
+ (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {
46
+ const { __scopeAlertDialog, ...triggerProps } = props;
47
+ const dialogScope = useDialogScope(__scopeAlertDialog);
48
+ return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;
49
+ }
36
50
  );
37
51
 
38
52
  AlertDialogTrigger.displayName = TRIGGER_NAME;
39
53
 
54
+ /* -------------------------------------------------------------------------------------------------
55
+ * AlertDialogPortal
56
+ * -----------------------------------------------------------------------------------------------*/
57
+
58
+ const PORTAL_NAME = 'AlertDialogPortal';
59
+
60
+ type DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
61
+ interface AlertDialogPortalProps extends DialogPortalProps {}
62
+
63
+ const AlertDialogPortal: React.FC<AlertDialogPortalProps> = (
64
+ props: ScopedProps<AlertDialogPortalProps>
65
+ ) => {
66
+ const { __scopeAlertDialog, ...portalProps } = props;
67
+ const dialogScope = useDialogScope(__scopeAlertDialog);
68
+ return <DialogPrimitive.Portal {...dialogScope} {...portalProps} />;
69
+ };
70
+
71
+ AlertDialogPortal.displayName = PORTAL_NAME;
72
+
40
73
  /* -------------------------------------------------------------------------------------------------
41
74
  * AlertDialogOverlay
42
75
  * -----------------------------------------------------------------------------------------------*/
@@ -48,7 +81,11 @@ type DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.
48
81
  interface AlertDialogOverlayProps extends DialogOverlayProps {}
49
82
 
50
83
  const AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(
51
- (props, forwardedRef) => <DialogPrimitive.Overlay {...props} ref={forwardedRef} />
84
+ (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {
85
+ const { __scopeAlertDialog, ...overlayProps } = props;
86
+ const dialogScope = useDialogScope(__scopeAlertDialog);
87
+ return <DialogPrimitive.Overlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;
88
+ }
52
89
  );
53
90
 
54
91
  AlertDialogOverlay.displayName = OVERLAY_NAME;
@@ -64,7 +101,7 @@ type AlertDialogContentContextValue = {
64
101
  };
65
102
 
66
103
  const [AlertDialogContentProvider, useAlertDialogContentContext] =
67
- createContext<AlertDialogContentContextValue>(CONTENT_NAME);
104
+ createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);
68
105
 
69
106
  type AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;
70
107
  type DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
@@ -72,22 +109,23 @@ interface AlertDialogContentProps
72
109
  extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}
73
110
 
74
111
  const AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(
75
- (props, forwardedRef) => {
76
- const { children, ...contentProps } = props;
112
+ (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {
113
+ const { __scopeAlertDialog, children, ...contentProps } = props;
114
+ const dialogScope = useDialogScope(__scopeAlertDialog);
77
115
  const contentRef = React.useRef<AlertDialogContentElement>(null);
78
116
  const composedRefs = useComposedRefs(forwardedRef, contentRef);
79
117
  const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);
80
118
 
81
119
  return (
82
120
  <DialogPrimitive.LabelWarningProvider
83
- value={React.useMemo(
84
- () => ({ contentName: CONTENT_NAME, titleName: TITLE_NAME, docsSlug: 'alert-dialog' }),
85
- []
86
- )}
121
+ contentName={CONTENT_NAME}
122
+ titleName={TITLE_NAME}
123
+ docsSlug="alert-dialog"
87
124
  >
88
- <AlertDialogContentProvider cancelRef={cancelRef}>
125
+ <AlertDialogContentProvider scope={__scopeAlertDialog} cancelRef={cancelRef}>
89
126
  <DialogPrimitive.Content
90
127
  role="alertdialog"
128
+ {...dialogScope}
91
129
  {...contentProps}
92
130
  ref={composedRefs}
93
131
  onOpenAutoFocus={composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
@@ -127,7 +165,11 @@ type DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Ti
127
165
  interface AlertDialogTitleProps extends DialogTitleProps {}
128
166
 
129
167
  const AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(
130
- (props, forwardedRef) => <DialogPrimitive.Title {...props} ref={forwardedRef} />
168
+ (props: ScopedProps<AlertDialogTitleProps>, forwardedRef) => {
169
+ const { __scopeAlertDialog, ...titleProps } = props;
170
+ const dialogScope = useDialogScope(__scopeAlertDialog);
171
+ return <DialogPrimitive.Title {...dialogScope} {...titleProps} ref={forwardedRef} />;
172
+ }
131
173
  );
132
174
 
133
175
  AlertDialogTitle.displayName = TITLE_NAME;
@@ -145,7 +187,11 @@ interface AlertDialogDescriptionProps extends DialogDescriptionProps {}
145
187
  const AlertDialogDescription = React.forwardRef<
146
188
  AlertDialogDescriptionElement,
147
189
  AlertDialogDescriptionProps
148
- >((props, forwardedRef) => <DialogPrimitive.Description {...props} ref={forwardedRef} />);
190
+ >((props: ScopedProps<AlertDialogDescriptionProps>, forwardedRef) => {
191
+ const { __scopeAlertDialog, ...descriptionProps } = props;
192
+ const dialogScope = useDialogScope(__scopeAlertDialog);
193
+ return <DialogPrimitive.Description {...dialogScope} {...descriptionProps} ref={forwardedRef} />;
194
+ });
149
195
 
150
196
  AlertDialogDescription.displayName = DESCRIPTION_NAME;
151
197
 
@@ -160,7 +206,11 @@ type DialogCloseProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Cl
160
206
  interface AlertDialogActionProps extends DialogCloseProps {}
161
207
 
162
208
  const AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(
163
- (props, forwardedRef) => <DialogPrimitive.Close {...props} ref={forwardedRef} />
209
+ (props: ScopedProps<AlertDialogActionProps>, forwardedRef) => {
210
+ const { __scopeAlertDialog, ...actionProps } = props;
211
+ const dialogScope = useDialogScope(__scopeAlertDialog);
212
+ return <DialogPrimitive.Close {...dialogScope} {...actionProps} ref={forwardedRef} />;
213
+ }
164
214
  );
165
215
 
166
216
  AlertDialogAction.displayName = ACTION_NAME;
@@ -175,10 +225,12 @@ type AlertDialogCancelElement = React.ElementRef<typeof DialogPrimitive.Close>;
175
225
  interface AlertDialogCancelProps extends DialogCloseProps {}
176
226
 
177
227
  const AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(
178
- (props, forwardedRef) => {
179
- const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME);
228
+ (props: ScopedProps<AlertDialogCancelProps>, forwardedRef) => {
229
+ const { __scopeAlertDialog, ...cancelProps } = props;
230
+ const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
231
+ const dialogScope = useDialogScope(__scopeAlertDialog);
180
232
  const ref = useComposedRefs(forwardedRef, cancelRef);
181
- return <DialogPrimitive.Close {...props} ref={ref} />;
233
+ return <DialogPrimitive.Close {...dialogScope} {...cancelProps} ref={ref} />;
182
234
  }
183
235
  );
184
236
 
@@ -211,6 +263,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
211
263
 
212
264
  const Root = AlertDialog;
213
265
  const Trigger = AlertDialogTrigger;
266
+ const Portal = AlertDialogPortal;
214
267
  const Overlay = AlertDialogOverlay;
215
268
  const Content = AlertDialogContent;
216
269
  const Action = AlertDialogAction;
@@ -219,8 +272,11 @@ const Title = AlertDialogTitle;
219
272
  const Description = AlertDialogDescription;
220
273
 
221
274
  export {
275
+ createAlertDialogScope,
276
+ //
222
277
  AlertDialog,
223
278
  AlertDialogTrigger,
279
+ AlertDialogPortal,
224
280
  AlertDialogOverlay,
225
281
  AlertDialogContent,
226
282
  AlertDialogAction,
@@ -230,6 +286,7 @@ export {
230
286
  //
231
287
  Root,
232
288
  Trigger,
289
+ Portal,
233
290
  Overlay,
234
291
  Content,
235
292
  Action,
@@ -240,6 +297,7 @@ export {
240
297
  export type {
241
298
  AlertDialogProps,
242
299
  AlertDialogTriggerProps,
300
+ AlertDialogPortalProps,
243
301
  AlertDialogOverlayProps,
244
302
  AlertDialogContentProps,
245
303
  AlertDialogActionProps,