@radix-ui/react-alert-dialog 0.1.2-rc.1 → 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
@@ -10,6 +10,10 @@ type DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.
10
10
  export interface AlertDialogTriggerProps extends DialogTriggerProps {
11
11
  }
12
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>;
13
17
  type DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
14
18
  export interface AlertDialogOverlayProps extends DialogOverlayProps {
15
19
  }
@@ -35,6 +39,7 @@ export interface AlertDialogCancelProps extends DialogCloseProps {
35
39
  export const AlertDialogCancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
36
40
  export const Root: React.FC<AlertDialogProps>;
37
41
  export const Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
42
+ export const Portal: React.FC<AlertDialogPortalProps>;
38
43
  export const Overlay: React.ForwardRefExoticComponent<AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
39
44
  export const Content: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
40
45
  export const Action: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1 +1 @@
1
- {"mappings":"A;A;A;AAkBA,OAAA,6FAEE,CAAC;AAGH,mBAAmB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,IAAI,CAAC,CAAC;AAC/E,iCAA2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B,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=require("@radix-ui/react-dialog"),l=u({},o),n=o.createDialogScope,c=require("@radix-ui/react-compose-refs").useComposedRefs,a=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]=a("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=/*#__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=A;const[x,m]=p("AlertDialogContent"),_=/*#__PURE__*/s.forwardRef(((e,o)=>{const{__scopeAlertDialog:n,children:a,...u}=e,p=g(n),f=s.useRef(null),d=c(o,f),D=s.useRef(null);/*#__PURE__*/return s.createElement(l.LabelWarningProvider,{contentName:"AlertDialogContent",titleName:R,docsSlug:"alert-dialog"},/*#__PURE__*/s.createElement(x,{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,a),!1)))}));exports.AlertDialogContent=_;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 E=/*#__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=E;const C=/*#__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=C;const O=/*#__PURE__*/s.forwardRef(((e,t)=>{const{__scopeAlertDialog:r,...o}=e,{cancelRef:n}=m("AlertDialogCancel",r),a=g(r),u=c(t,n);/*#__PURE__*/return s.createElement(l.Close,i({},a,o,{ref:u}))}));exports.AlertDialogCancel=O;const w=d;exports.Root=w;const b=D;exports.Trigger=b;const q=A;exports.Overlay=q;const T=_;exports.Content=T;const S=C;exports.Action=S;const y=O;exports.Cancel=y;const h=v;exports.Title=h;const P=E;exports.Description=P;
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,sTAAAA,8CAClBA,EAAEC,WAAaD,EAAEE,QAAUF,EAWzC,SAASG,EAAuBC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OAAOzB,EAAAC,cAACC,EAAgBoD,MAAjBlD,EAAA,GAA2BL,EAAiByD,EAA5C,CAAyD5C,IAAKA,oCAYzE,MAmBMT,EAAOR,iBACb,MAAMgB,EAAUL,oBAChB,MAAMS,EAAUF,oBAChB,MAAMoB,EAAUf,oBAChB,MAAMuC,EAASL,mBACf,MAAMM,EAASH,mBACf,MAAMP,EAAQF,kBACd,MAAMK,EAAcF","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { createDialogScope } from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;\n};\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...triggerProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * 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 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 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","createAlertDialogContext","createAlertDialogScope","createContextScope","createDialogScope","useDialogScope","AlertDialog","props","__scopeAlertDialog","alertDialogProps","dialogScope","_react","createElement","_radixUiReactDialog","Root","_babelRuntimeHelpersExtends","modal","AlertDialogTrigger","React","forwardRef","forwardedRef","triggerProps","Trigger","ref","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
+ {"mappings":"IAAgCA,sTAAAA,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,ECXT,MAGOS,EAA0BC,GAA0BC,EAHzC,cAGuE,CACvFC,qCAEF,MAAMC,EAAiBD,IAKjBE,EAA2CC,IAC/C,MAAMC,mBAAEA,KAAuBC,GAAqBF,EAC9CG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBC,KAAjBC,EAAA,GAA0BL,EAAiBD,EAA3C,CAA6DO,OAAO,4BAQ7E,MAMMC,eAAqBC,EAAMC,YAC/B,CAACZ,EAA6Ca,KAC5C,MAAMZ,mBAAEA,KAAuBa,GAAiBd,EAC1CG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBS,QAAjBP,EAAA,GAA6BL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,KAC1C,MAAMZ,mBAAEA,KAAuBqD,GAAetD,EACxCG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBiD,MAAjB/C,EAAA,GAA2BL,EAAiBmD,EAA5C,CAAwDtC,IAAKH,mCAUxE,MAMM2C,eAAyB7C,EAAMC,YAGnC,CAACZ,EAAiDa,KAClD,MAAMZ,mBAAEA,KAAuBwD,GAAqBzD,EAC9CG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBoD,YAAjBlD,EAAA,GAAiCL,EAAiBsD,EAAlD,CAAoEzC,IAAKH,yCASlF,MAMM8C,eAAoBhD,EAAMC,YAC9B,CAACZ,EAA4Ca,KAC3C,MAAMZ,mBAAEA,KAAuB2D,GAAgB5D,EACzCG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBuD,MAAjBrD,EAAA,GAA2BL,EAAiByD,EAA5C,CAAyD5C,IAAKH,oCAUzE,MAKMiD,eAAoBnD,EAAMC,YAC9B,CAACZ,EAA4Ca,KAC3C,MAAMZ,mBAAEA,KAAuB8D,GAAgB/D,GACzCgC,UAAEA,GAAcR,EARN,oBAQgDvB,GAC1DE,EAAcL,EAAeG,GAC7Be,EAAMe,EAAgBlB,EAAcmB,gBAC1C,OAAO5B,EAAAC,cAACC,EAAgBuD,MAAjBrD,EAAA,GAA2BL,EAAiB4D,EAA5C,CAAyD/C,IAAKA,oCAYzE,MAmBMT,EAAOR,iBACb,MAAMgB,EAAUL,oBAChB,MAAMS,EAASF,mBACf,MAAMK,EAAUF,oBAChB,MAAMoB,EAAUf,oBAChB,MAAMuC,EAASL,mBACf,MAAMM,EAASH,mBACf,MAAMP,EAAQF,kBACd,MAAMK,EAAcF","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { createDialogScope } from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;\n};\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...triggerProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal';\n\ntype DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Portal {...dialogScope} {...portalProps} />;\n};\n\nAlertDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ntype AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;\ntype DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Overlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ntype DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const contentRef = React.useRef<AlertDialogContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);\n\n return (\n <DialogPrimitive.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{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 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,f]=c("AlertDialogContent");export const AlertDialogContent=/*#__PURE__*/a.forwardRef(((o,n)=>{const{__scopeAlertDialog:c,children:s,...f}=o,m=p(c),A=a.useRef(null),u=l(n,A),d=a.useRef(null);/*#__PURE__*/return a.createElement(r.LabelWarningProvider,{contentName:"AlertDialogContent",titleName:D,docsSlug:"alert-dialog"},/*#__PURE__*/a.createElement(g,{scope:c,cancelRef:d},/*#__PURE__*/a.createElement(r.Content,i({role:"alertdialog"},m,f,{ref:u,onOpenAutoFocus:t(f.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(e,null,s),!1)))}));/*#__PURE__*/const D="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}=f("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 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":"sZAeA,MAGOA,EAA0BC,GAA0BC,EAHzC,cAGuE,CACvFC,wCAEF,MAAMC,EAAiBD,WAKvB,MAAME,YAA2CC,IAC/C,MAAMC,mBAAEA,KAAuBC,GAAqBF,EAC9CG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBC,KAAjBC,EAAA,GAA0BL,EAAiBD,EAA3C,CAA6DO,OAAO,0BAc7E,MAAMC,gCAAqBC,EAAMC,YAC/B,CAACZ,EAA6Ca,KAC5C,MAAMZ,mBAAEA,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D,EACxCG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgB8C,MAAjB5C,EAAA,GAA2BL,EAAiBgD,EAA5C,CAAwDnC,IAAKH,4BAgBxE,MAAMwC,oCAAyB1C,EAAMC,YAGnC,CAACZ,EAAiDa,KAClD,MAAMZ,mBAAEA,KAAuBqD,GAAqBtD,EAC9CG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBiD,YAAjB/C,EAAA,GAAiCL,EAAiBmD,EAAlD,CAAoEtC,IAAKH,4BAelF,MAAM2C,+BAAoB7C,EAAMC,YAC9B,CAACZ,EAA4Ca,KAC3C,MAAMZ,mBAAEA,KAAuBwD,GAAgBzD,EACzCG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBoD,MAAjBlD,EAAA,GAA2BL,EAAiBsD,EAA5C,CAAyDzC,IAAKH,4BAezE,MAAM8C,+BAAoBhD,EAAMC,YAC9B,CAACZ,EAA4Ca,KAC3C,MAAMZ,mBAAEA,KAAuB2D,GAAgB5D,GACzC6B,UAAEA,GAAcR,EARN,oBAQgDpB,GAC1DE,EAAcL,EAAeG,GAC7Be,EAAMY,EAAgBf,EAAcgB,gBAC1C,OAAOzB,EAAAC,cAACC,EAAgBoD,MAAjBlD,EAAA,GAA2BL,EAAiByD,EAA5C,CAAyD5C,IAAKA,4BA+BzE,MAAMT,KAAOR,mBACb,MAAMgB,QAAUL,0BAChB,MAAMS,QAAUF,0BAChB,MAAMoB,QAAUf,0BAChB,MAAMuC,OAASL,yBACf,MAAMM,OAASH,yBACf,MAAMP,MAAQF,wBACd,MAAMK,YAAcF","sources":["./packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { createDialogScope } from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;\n};\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...triggerProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * 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 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 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":["createAlertDialogContext","createAlertDialogScope","createContextScope","createDialogScope","useDialogScope","AlertDialog","props","__scopeAlertDialog","alertDialogProps","dialogScope","_react","createElement","_radixUiReactDialog","Root","_babelRuntimeHelpersEsmExtends","modal","AlertDialogTrigger","React","forwardRef","forwardedRef","triggerProps","Trigger","ref","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"}
1
+ {"mappings":"sZAeA,MAGOA,EAA0BC,GAA0BC,EAHzC,cAGuE,CACvFC,wCAEF,MAAMC,EAAiBD,WAKvB,MAAME,YAA2CC,IAC/C,MAAMC,mBAAEA,KAAuBC,GAAqBF,EAC9CG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBC,KAAjBC,EAAA,GAA0BL,EAAiBD,EAA3C,CAA6DO,OAAO,0BAc7E,MAAMC,gCAAqBC,EAAMC,YAC/B,CAACZ,EAA6Ca,KAC5C,MAAMZ,mBAAEA,KAAuBa,GAAiBd,EAC1CG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBS,QAAjBP,EAAA,GAA6BL,EAAiBW,EAA9C,CAA4DE,IAAKH,4BAe5E,MAAMI,kBACJjB,IAEA,MAAMC,mBAAEA,KAAuBiB,GAAgBlB,EACzCG,EAAcL,EAAeG,gBAC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AjB/C,EAAA,GAA2BL,EAAiBmD,EAA5C,CAAwDtC,IAAKH,4BAgBxE,MAAM2C,oCAAyB7C,EAAMC,YAGnC,CAACZ,EAAiDa,KAClD,MAAMZ,mBAAEA,KAAuBwD,GAAqBzD,EAC9CG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBoD,YAAjBlD,EAAA,GAAiCL,EAAiBsD,EAAlD,CAAoEzC,IAAKH,4BAelF,MAAM8C,+BAAoBhD,EAAMC,YAC9B,CAACZ,EAA4Ca,KAC3C,MAAMZ,mBAAEA,KAAuB2D,GAAgB5D,EACzCG,EAAcL,EAAeG,gBACnC,OAAOG,EAAAC,cAACC,EAAgBuD,MAAjBrD,EAAA,GAA2BL,EAAiByD,EAA5C,CAAyD5C,IAAKH,4BAezE,MAAMiD,+BAAoBnD,EAAMC,YAC9B,CAACZ,EAA4Ca,KAC3C,MAAMZ,mBAAEA,KAAuB8D,GAAgB/D,GACzCgC,UAAEA,GAAcR,EARN,oBAQgDvB,GAC1DE,EAAcL,EAAeG,GAC7Be,EAAMe,EAAgBlB,EAAcmB,gBAC1C,OAAO5B,EAAAC,cAACC,EAAgBuD,MAAjBrD,EAAA,GAA2BL,EAAiB4D,EAA5C,CAAyD/C,IAAKA,4BA+BzE,MAAMT,KAAOR,mBACb,MAAMgB,QAAUL,0BAChB,MAAMS,OAASF,yBACf,MAAMK,QAAUF,0BAChB,MAAMoB,QAAUf,0BAChB,MAAMuC,OAASL,yBACf,MAAMM,OAASH,yBACf,MAAMP,MAAQF,wBACd,MAAMK,YAAcF","sources":["./packages/react/alert-dialog/src/AlertDialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { createDialogScope } from '@radix-ui/react-dialog';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Slottable } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nconst AlertDialog: React.FC<AlertDialogProps> = (props: ScopedProps<AlertDialogProps>) => {\n const { __scopeAlertDialog, ...alertDialogProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Root {...dialogScope} {...alertDialogProps} modal={true} />;\n};\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ntype DialogTriggerProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps extends DialogTriggerProps {}\n\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n (props: ScopedProps<AlertDialogTriggerProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...triggerProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Trigger {...dialogScope} {...triggerProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal';\n\ntype DialogPortalProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;\ninterface AlertDialogPortalProps extends DialogPortalProps {}\n\nconst AlertDialogPortal: React.FC<AlertDialogPortalProps> = (\n props: ScopedProps<AlertDialogPortalProps>\n) => {\n const { __scopeAlertDialog, ...portalProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Portal {...dialogScope} {...portalProps} />;\n};\n\nAlertDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ntype AlertDialogOverlayElement = React.ElementRef<typeof DialogPrimitive.Overlay>;\ntype DialogOverlayProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;\ninterface AlertDialogOverlayProps extends DialogOverlayProps {}\n\nconst AlertDialogOverlay = React.forwardRef<AlertDialogOverlayElement, AlertDialogOverlayProps>(\n (props: ScopedProps<AlertDialogOverlayProps>, forwardedRef) => {\n const { __scopeAlertDialog, ...overlayProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n return <DialogPrimitive.Overlay {...dialogScope} {...overlayProps} ref={forwardedRef} />;\n }\n);\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: React.MutableRefObject<AlertDialogCancelElement | null>;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype AlertDialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ntype DialogContentProps = Radix.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {}\n\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n (props: ScopedProps<AlertDialogContentProps>, forwardedRef) => {\n const { __scopeAlertDialog, children, ...contentProps } = props;\n const dialogScope = useDialogScope(__scopeAlertDialog);\n const contentRef = React.useRef<AlertDialogContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const cancelRef = React.useRef<AlertDialogCancelElement | null>(null);\n\n return (\n <DialogPrimitive.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.2-rc.1",
3
+ "version": "0.1.2-rc.10",
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.1",
23
- "@radix-ui/react-dialog": "0.1.1",
23
+ "@radix-ui/react-dialog": "0.1.2-rc.9",
24
24
  "@radix-ui/react-primitive": "0.1.1",
25
25
  "@radix-ui/react-slot": "0.1.1"
26
26
  },
@@ -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>
@@ -51,6 +51,25 @@ const AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDial
51
51
 
52
52
  AlertDialogTrigger.displayName = TRIGGER_NAME;
53
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
+
54
73
  /* -------------------------------------------------------------------------------------------------
55
74
  * AlertDialogOverlay
56
75
  * -----------------------------------------------------------------------------------------------*/
@@ -244,6 +263,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
244
263
 
245
264
  const Root = AlertDialog;
246
265
  const Trigger = AlertDialogTrigger;
266
+ const Portal = AlertDialogPortal;
247
267
  const Overlay = AlertDialogOverlay;
248
268
  const Content = AlertDialogContent;
249
269
  const Action = AlertDialogAction;
@@ -256,6 +276,7 @@ export {
256
276
  //
257
277
  AlertDialog,
258
278
  AlertDialogTrigger,
279
+ AlertDialogPortal,
259
280
  AlertDialogOverlay,
260
281
  AlertDialogContent,
261
282
  AlertDialogAction,
@@ -265,6 +286,7 @@ export {
265
286
  //
266
287
  Root,
267
288
  Trigger,
289
+ Portal,
268
290
  Overlay,
269
291
  Content,
270
292
  Action,
@@ -275,6 +297,7 @@ export {
275
297
  export type {
276
298
  AlertDialogProps,
277
299
  AlertDialogTriggerProps,
300
+ AlertDialogPortalProps,
278
301
  AlertDialogOverlayProps,
279
302
  AlertDialogContentProps,
280
303
  AlertDialogActionProps,