@radix-ui/react-alert-dialog 0.1.0 → 0.1.1-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export interface AlertDialogOverlayProps extends DialogOverlayProps {
14
14
  }
15
15
  export const AlertDialogOverlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
16
16
  type DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
17
- export interface AlertDialogContentProps extends Omit<DialogContentProps, 'onPointerDownOutside'> {
17
+ export interface AlertDialogContentProps extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {
18
18
  }
19
19
  export const AlertDialogContent: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
20
20
  type DialogTitleProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
@@ -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,wCAAkC,SAAQ,IAAI,CAAC,kBAAkB,EAAE,sBAAsB,CAAC;CAAG;AAE7F,OAAA,MAAM,kHAwCL,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;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"}
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()}),/*#__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 R=/*#__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=R;const v=s;exports.Root=v;const E=u;exports.Trigger=E;const C=f;exports.Overlay=C;const w=g;exports.Content=w;const O=A;exports.Action=O;const b=R;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=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;
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,sBAafC,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,YAvBE,qBAuByBC,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,gCAQvCvC,EAAAC,cAAC2C,EAAD,KAAY1B,IACX,qCAgBb,MAAMY,EAAa,mBAMbe,eAAmBtC,EAAMC,YAC7B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgB4C,MAAjB1C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKF,kCASlE,MAMMsC,eAAyBxC,EAAMC,YAGnC,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgB8C,YAAjB5C,EAAA,GAAiCL,EAAjC,CAAwCY,IAAKF,wCAQxE,MAMMwC,eAAoB1C,EAAMC,YAC9B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgBgD,MAAjB9C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKF,mCASlE,MAKM0C,eAAoB5C,EAAMC,YAC9B,CAACT,EAAOU,KACN,MAAMe,UAAEA,GAAcT,EAPN,qBAQVJ,EAAMY,EAAgBd,EAAce,gBAC1C,OAAOxB,EAAAC,cAACC,EAAgBgD,MAAjB9C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKA,oCAYlD,MAmBMR,EAAOL,iBACb,MAAMY,EAAUJ,oBAChB,MAAMO,EAAUD,oBAChB,MAAMqB,EAAUhB,oBAChB,MAAMmC,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 extends Omit<DialogContentProps, 'onPointerDownOutside'> {}\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 >\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","Slottable","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogAction","Close","AlertDialogCancel","Action","Cancel"],"version":3,"file":"index.js.map"}
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,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),D=n.useRef(null);/*#__PURE__*/return n.createElement(r.LabelWarningProvider,{value:n.useMemo((()=>({contentName:"AlertDialogContent",titleName:s,docsSlug:"alert-dialog"})),[])},/*#__PURE__*/n.createElement(i,{cancelRef:D},/*#__PURE__*/n.createElement(r.Content,a({role:"alertdialog"},p,{ref:m,onOpenAutoFocus:t(p.onOpenAutoFocus,(e=>{var t;e.preventDefault(),null===(t=D.current)||void 0===t||t.focus({preventScroll:!0})})),onPointerDownOutside: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{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;
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,6BAarB,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,YAvBE,qBAuByBC,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,gCAQvCvC,EAAAC,cAAC2C,EAAD,KAAY1B,IACX,qBAgBb,MAAMY,EAAa,0BAMnB,MAAMe,8BAAmBtC,EAAMC,YAC7B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgB4C,MAAjB1C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKF,2BAelE,MAAMsC,oCAAyBxC,EAAMC,YAGnC,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgB8C,YAAjB5C,EAAA,GAAiCL,EAAjC,CAAwCY,IAAKF,2BAcxE,MAAMwC,+BAAoB1C,EAAMC,YAC9B,CAACT,EAAOU,iBAAiBT,EAAAC,cAACC,EAAgBgD,MAAjB9C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKF,2BAclE,MAAM0C,+BAAoB5C,EAAMC,YAC9B,CAACT,EAAOU,KACN,MAAMe,UAAEA,GAAcT,EAPN,qBAQVJ,EAAMY,EAAgBd,EAAce,gBAC1C,OAAOxB,EAAAC,cAACC,EAAgBgD,MAAjB9C,EAAA,GAA2BL,EAA3B,CAAkCY,IAAKA,4BA+BlD,MAAMR,KAAOL,mBACb,MAAMY,QAAUJ,0BAChB,MAAMO,QAAUD,0BAChB,MAAMqB,QAAUhB,0BAChB,MAAMmC,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 extends Omit<DialogContentProps, 'onPointerDownOutside'> {}\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 >\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","Slottable","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogAction","Close","AlertDialogCancel","Action","Cancel"],"version":3,"file":"index.module.js.map"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-alert-dialog",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-rc.4",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "@radix-ui/primitive": "0.1.0",
21
21
  "@radix-ui/react-compose-refs": "0.1.0",
22
22
  "@radix-ui/react-context": "0.1.0",
23
- "@radix-ui/react-dialog": "0.1.0",
23
+ "@radix-ui/react-dialog": "0.1.1-rc.3",
24
24
  "@radix-ui/react-slot": "0.1.0"
25
25
  },
26
26
  "peerDependencies": {
@@ -34,5 +34,6 @@
34
34
  },
35
35
  "bugs": {
36
36
  "url": "https://github.com/radix-ui/primitives/issues"
37
- }
37
+ },
38
+ "stableVersion": "0.1.0"
38
39
  }
@@ -68,7 +68,8 @@ const [AlertDialogContentProvider, useAlertDialogContentContext] =
68
68
 
69
69
  type AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;
70
70
  type DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
71
- interface AlertDialogContentProps extends Omit<DialogContentProps, 'onPointerDownOutside'> {}
71
+ interface AlertDialogContentProps
72
+ extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}
72
73
 
73
74
  const AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(
74
75
  (props, forwardedRef) => {
@@ -94,6 +95,7 @@ const AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDial
94
95
  cancelRef.current?.focus({ preventScroll: true });
95
96
  })}
96
97
  onPointerDownOutside={(event) => event.preventDefault()}
98
+ onInteractOutside={(event) => event.preventDefault()}
97
99
  >
98
100
  {/**
99
101
  * We have to use `Slottable` here as we cannot wrap the `AlertDialogContentProvider`