Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radix-ui/react-alert-dialog

Package Overview
Dependencies
Maintainers
5
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-alert-dialog - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

69

dist/index.d.ts
import * as React from "react";
import { Dialog } from "@radix-ui/react-dialog";
import { Primitive } from "@radix-ui/react-primitive";
import { Dialog, DialogContent, DialogClose } from "@radix-ui/react-dialog";
import * as Polymorphic from "@radix-ui/react-polymorphic";
export const AlertDialog: React.FC<React.ComponentProps<typeof Dialog>>;
export const AlertDialogCancel: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", Pick<{}, never>>;
type AlertDialogContentOwnProps = {
refToFocusOnOpen: never;
id: never;
};
export const AlertDialogContent: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", import("@radix-ui/react-polymorphic").MergeProps<import("@radix-ui/react-polymorphic").MergeProps<import("@radix-ui/react-dialog").DialogContentImplOwnProps, import("@radix-ui/react-dialog").DialogContentOwnProps>, AlertDialogContentOwnProps>>;
export const AlertDialogTitle: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"h2", {}>;
export const AlertDialogDescription: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"p", {}>;
export const AlertDialogTrigger: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", Pick<{}, never>>;
export const AlertDialogOverlay: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", Pick<import("@radix-ui/react-polymorphic").MergeProps<{}, import("@radix-ui/react-dialog").DialogOverlayOwnProps>, "forceMount">>;
export const AlertDialogAction: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", Pick<{}, never>>;
export const Root: React.FC<React.PropsWithChildren<import("@radix-ui/react-dialog").DialogOwnProps>>;
export const Title: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"h2", {}>;
export const Cancel: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", Pick<{}, never>>;
export const Action: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", Pick<{}, never>>;
export const Content: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", import("@radix-ui/react-polymorphic").MergeProps<import("@radix-ui/react-polymorphic").MergeProps<import("@radix-ui/react-dialog").DialogContentImplOwnProps, import("@radix-ui/react-dialog").DialogContentOwnProps>, AlertDialogContentOwnProps>>;
export const Description: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"p", {}>;
export const Overlay: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", Pick<import("@radix-ui/react-polymorphic").MergeProps<{}, import("@radix-ui/react-dialog").DialogOverlayOwnProps>, "forceMount">>;
export const Trigger: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", Pick<{}, never>>;
type AlertDialogCancelOwnProps = Polymorphic.OwnProps<typeof DialogClose>;
type AlertDialogCancelPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof DialogClose>, AlertDialogCancelOwnProps>;
export const AlertDialogCancel: AlertDialogCancelPrimitive;
type AlertDialogContentOwnProps = Omit<Polymorphic.OwnProps<typeof DialogContent>, 'refToFocusOnOpen' | 'id'>;
type AlertDialogContentPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof DialogContent>, AlertDialogContentOwnProps>;
export const AlertDialogContent: AlertDialogContentPrimitive;
declare const TITLE_DEFAULT_TAG = "h2";
type AlertDialogTitleOwnProps = Polymorphic.OwnProps<typeof Primitive>;
type AlertDialogTitlePrimitive = Polymorphic.ForwardRefComponent<typeof TITLE_DEFAULT_TAG, AlertDialogTitleOwnProps>;
export const AlertDialogTitle: AlertDialogTitlePrimitive;
declare const DESCRIPTION_DEFAULT_TAG = "p";
type AlertDialogDescriptionOwnProps = Polymorphic.OwnProps<typeof Primitive>;
type AlertDialogDescriptionPrimitive = Polymorphic.ForwardRefComponent<typeof DESCRIPTION_DEFAULT_TAG, AlertDialogDescriptionOwnProps>;
export const AlertDialogDescription: AlertDialogDescriptionPrimitive;
export const AlertDialogTrigger: Polymorphic.ForwardRefComponent<"button", {
selector?: string | null | undefined;
}>;
export const AlertDialogOverlay: Polymorphic.ForwardRefComponent<"div", import("@radix-ui/utils").Merge<{
selector?: string | null | undefined;
}, {
forceMount?: true | undefined;
}>>;
export const AlertDialogAction: Polymorphic.ForwardRefComponent<"button", {
selector?: string | null | undefined;
}>;
export const Root: React.FC<React.PropsWithChildren<{
id?: string | undefined;
open?: boolean | undefined;
defaultOpen?: boolean | undefined;
onOpenChange?: ((open: boolean) => void) | undefined;
}>>;
export const Title: AlertDialogTitlePrimitive;
export const Cancel: AlertDialogCancelPrimitive;
export const Action: Polymorphic.ForwardRefComponent<"button", {
selector?: string | null | undefined;
}>;
export const Content: AlertDialogContentPrimitive;
export const Description: AlertDialogDescriptionPrimitive;
export const Overlay: Polymorphic.ForwardRefComponent<"div", import("@radix-ui/utils").Merge<{
selector?: string | null | undefined;
}, {
forceMount?: true | undefined;
}>>;
export const Trigger: Polymorphic.ForwardRefComponent<"button", {
selector?: string | null | undefined;
}>;
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

var e,r,t=require("@radix-ui/react-dialog"),n=t.Dialog,o=t.DialogOverlay,a=t.DialogContent,i=t.DialogTrigger,l=t.DialogClose,c=require("@radix-ui/react-primitive").Primitive,s=require("@radix-ui/react-utils"),u=s.createContext,d=s.useComposedRefs,p=s.useId,g=s.useDocumentRef,f=s.composeEventHandlers,y=s.extendComponent,v=require("@radix-ui/utils"),b=v.getSelector,m=v.makeId,D=(v.warning,e={},r=require("react"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e);function A(){return(A=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function h(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function x(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,a=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw a}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return C(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return C(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var O=x(u("AlertDialogContext","AlertDialog"),2),w=O[0],I=O[1],T=x(u("AlertDialogContext","AlertDialog"),2),j=T[0],R=T[1],S=function(e){var r=e.children,t=e.id,o=h(e,["children","id"]),a=m("alert-dialog",p()),i=t||a,l=m(i,"description"),c=m(i,"title");return D.createElement(n,o,D.createElement(w.Provider,{value:D.useMemo((function(){return{descriptionId:l,titleId:c}}),[l,c])},r))};exports.AlertDialog=S,S.displayName="AlertDialog";var E=D.forwardRef((function(e,r){var t=R("AlertDialogCancel").cancelRef,n=d(r,t);return D.createElement(l,A({selector:b("AlertDialogCancel")},e,{ref:n}))}));exports.AlertDialogCancel=E,E.displayName="AlertDialogCancel";var q=D.forwardRef((function(e,r){var t=e["aria-label"],n=e["aria-labelledby"],o=e["aria-describedby"],i=e.children,l=h(e,["aria-label","aria-labelledby","aria-describedby","children"]),c=I("AlertDialogContent"),s=c.descriptionId,u=c.titleId,p=D.useRef(null),y=D.useRef(null),v=g(y),m=d(r,y);return D.createElement(a,A({selector:b("AlertDialogContent"),role:"alertdialog","aria-describedby":o||s,"aria-labelledby":t?void 0:n||u,"aria-label":t||void 0},l,{ref:m,onOpenAutoFocus:f(l.onOpenAutoFocus,(function(e){var r;e.preventDefault(),null===(r=p.current)||void 0===r||r.focus({preventScroll:!0})}))}),D.createElement(j.Provider,{value:D.useMemo((function(){return{cancelRef:p,ownerDocumentRef:v}}),[p,v])},!1,i))}));exports.AlertDialogContent=q,q.displayName="AlertDialogContent";var N=D.forwardRef((function(e,r){var t=I("AlertDialogTitle").titleId;return D.createElement(c,A({as:"h2",selector:b("AlertDialogTitle"),id:t},e,{ref:r}))}));exports.AlertDialogTitle=N,N.displayName="AlertDialogTitle";var P=D.forwardRef((function(e,r){var t=I("AlertDialogDescription").descriptionId;return D.createElement(c,A({as:"p",selector:b("AlertDialogDescription"),id:t},e,{ref:r}))}));exports.AlertDialogDescription=P,P.displayName="AlertDialogDescription";var F=y(i,"AlertDialogTrigger");exports.AlertDialogTrigger=F;var M=y(o,"AlertDialogOverlay");exports.AlertDialogOverlay=M;var k=y(l,"AlertDialogAction");exports.AlertDialogAction=k;"".concat("AlertDialogContent"," requires a label for the component to be accessible for screen reader users.\n\nYou can label the ").concat("AlertDialogContent"," by passing a ").concat("AlertDialogTitle"," 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 title by assigning it an `id` and passing the same value to the `aria-labelledby` prop in ").concat("AlertDialogContent",". If the label is confusing or duplicative for sighted users, you can also pass a label directly by using the `aria-label` prop.\n\nFor more information, see https://LINK-TO-DOCS.com"),"".concat("AlertDialogContent"," requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the ").concat("AlertDialogContent"," by passing a ").concat("AlertDialogDescription"," 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 ").concat("AlertDialogContent",". 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://LINK-TO-DOCS.com");var K=S;exports.Root=K;var L=N;exports.Title=L;var Y=E;exports.Cancel=Y;var _=k;exports.Action=_;var H=q;exports.Content=H;var U=P;exports.Description=U;var $=M;exports.Overlay=$;var z=F;exports.Trigger=z;
var e,r,t=require("@radix-ui/react-dialog"),o=t.Dialog,a=t.DialogOverlay,n=t.DialogContent,i=t.DialogTrigger,l=t.DialogClose,c=require("@radix-ui/react-primitive").Primitive,s=require("@radix-ui/react-utils"),u=s.createContext,d=s.useComposedRefs,p=s.useId,g=s.useDocumentRef,f=s.composeEventHandlers,v=s.extendComponent,y=require("@radix-ui/utils"),b=y.getSelector,m=y.makeId,D=(y.warning,e={},r=require("react"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e);function A(){return(A=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)}function h(e,r){if(null==e)return{};var t,o,a=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function x(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],o=!0,a=!1,n=void 0;try{for(var i,l=e[Symbol.iterator]();!(o=(i=l.next()).done)&&(t.push(i.value),!r||t.length!==r);o=!0);}catch(e){a=!0,n=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw n}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return C(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return C(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=new Array(r);t<r;t++)o[t]=e[t];return o}var O=x(u("AlertDialogContext","AlertDialog"),2),w=O[0],I=O[1],T=x(u("AlertDialogContext","AlertDialog"),2),j=T[0],R=T[1],S=function(e){var r=e.children,t=e.id,a=h(e,["children","id"]),n=m("alert-dialog",p()),i=t||n,l=m(i,"description"),c=m(i,"title");return D.createElement(o,a,D.createElement(w.Provider,{value:D.useMemo((function(){return{descriptionId:l,titleId:c}}),[l,c])},r))};exports.AlertDialog=S,S.displayName="AlertDialog";var E=D.forwardRef((function(e,r){var t=e.selector,o=void 0===t?b("AlertDialogCancel"):t,a=h(e,["selector"]),n=R("AlertDialogCancel").cancelRef,i=d(r,n);return D.createElement(l,A({},a,{selector:o,ref:i}))}));exports.AlertDialogCancel=E,E.displayName="AlertDialogCancel";var q=D.forwardRef((function(e,r){var t=e.selector,o=void 0===t?b("AlertDialogContent"):t,a=e["aria-label"],i=e["aria-labelledby"],l=e["aria-describedby"],c=e.children,s=h(e,["selector","aria-label","aria-labelledby","aria-describedby","children"]),u=I("AlertDialogContent"),p=u.descriptionId,v=u.titleId,y=D.useRef(null),m=D.useRef(null),x=g(m),C=d(r,m);return D.createElement(n,A({role:"alertdialog","aria-describedby":l||p,"aria-labelledby":a?void 0:i||v,"aria-label":a||void 0},s,{selector:o,ref:C,onOpenAutoFocus:f(s.onOpenAutoFocus,(function(e){var r;e.preventDefault(),null===(r=y.current)||void 0===r||r.focus({preventScroll:!0})}))}),D.createElement(j.Provider,{value:D.useMemo((function(){return{cancelRef:y,ownerDocumentRef:x}}),[y,x])},!1,c))}));exports.AlertDialogContent=q,q.displayName="AlertDialogContent";var N=D.forwardRef((function(e,r){var t=e.as,o=void 0===t?"h2":t,a=e.selector,n=void 0===a?b("AlertDialogTitle"):a,i=h(e,["as","selector"]),l=I("AlertDialogTitle").titleId;return D.createElement(c,A({id:l},i,{as:o,selector:n,ref:r}))}));exports.AlertDialogTitle=N,N.displayName="AlertDialogTitle";var P=D.forwardRef((function(e,r){var t=e.as,o=void 0===t?"p":t,a=e.selector,n=void 0===a?b("AlertDialogDescription"):a,i=h(e,["as","selector"]),l=I("AlertDialogDescription").descriptionId;return D.createElement(c,A({id:l},i,{as:o,selector:n,ref:r}))}));exports.AlertDialogDescription=P,P.displayName="AlertDialogDescription";var F=v(i,"AlertDialogTrigger");exports.AlertDialogTrigger=F;var M=v(a,"AlertDialogOverlay");exports.AlertDialogOverlay=M;var k=v(l,"AlertDialogAction");exports.AlertDialogAction=k;"".concat("AlertDialogContent"," requires a label for the component to be accessible for screen reader users.\n\nYou can label the ").concat("AlertDialogContent"," by passing a ").concat("AlertDialogTitle"," 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 title by assigning it an `id` and passing the same value to the `aria-labelledby` prop in ").concat("AlertDialogContent",". If the label is confusing or duplicative for sighted users, you can also pass a label directly by using the `aria-label` prop.\n\nFor more information, see https://LINK-TO-DOCS.com"),"".concat("AlertDialogContent"," requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the ").concat("AlertDialogContent"," by passing a ").concat("AlertDialogDescription"," 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 ").concat("AlertDialogContent",". 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://LINK-TO-DOCS.com");var K=S;exports.Root=K;var L=N;exports.Title=L;var Y=E;exports.Cancel=Y;var _=k;exports.Action=_;var H=q;exports.Content=H;var U=P;exports.Description=U;var $=M;exports.Overlay=$;var z=F;exports.Trigger=z;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{Dialog as e,DialogOverlay as t,DialogContent as r,DialogTrigger as o,DialogClose as i}from"@radix-ui/react-dialog";import{Primitive as l}from"@radix-ui/react-primitive";import{createContext as a,useComposedRefs as n,useId as c,useDocumentRef as s,composeEventHandlers as d,extendComponent as g}from"@radix-ui/react-utils";import{getSelector as p,makeId as u,warning as D}from"@radix-ui/utils";import*as A from"react";function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function b(e,t){if(null==e)return{};var r,o,i=function(e,t){if(null==e)return{};var r,o,i={},l=Object.keys(e);for(o=0;o<l.length;o++)r=l[o],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o<l.length;o++)r=l[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}const[m,y]=a("AlertDialogContext","AlertDialog"),[h,v]=a("AlertDialogContext","AlertDialog");export const AlertDialog=t=>{const{children:r,id:o}=t,i=b(t,["children","id"]),l=u("alert-dialog",c()),a=o||l,n=u(a,"description"),s=u(a,"title");return A.createElement(e,i,A.createElement(m.Provider,{value:A.useMemo((()=>({descriptionId:n,titleId:s})),[n,s])},r))};AlertDialog.displayName="AlertDialog";export const AlertDialogCancel=A.forwardRef(((e,t)=>{const{cancelRef:r}=v("AlertDialogCancel"),o=n(t,r);return A.createElement(i,f({selector:p("AlertDialogCancel")},e,{ref:o}))}));AlertDialogCancel.displayName="AlertDialogCancel";export const AlertDialogContent=A.forwardRef(((e,t)=>{const{"aria-label":o,"aria-labelledby":i,"aria-describedby":l,children:a}=e,c=b(e,["aria-label","aria-labelledby","aria-describedby","children"]),{descriptionId:g,titleId:u}=y("AlertDialogContent"),D=A.useRef(null),m=A.useRef(null),v=s(m),x=n(t,m);return A.createElement(r,f({selector:p("AlertDialogContent"),role:"alertdialog","aria-describedby":l||g,"aria-labelledby":o?void 0:i||u,"aria-label":o||void 0},c,{ref:x,onOpenAutoFocus:d(c.onOpenAutoFocus,(e=>{var t;e.preventDefault(),null===(t=D.current)||void 0===t||t.focus({preventScroll:!0})}))}),A.createElement(h.Provider,{value:A.useMemo((()=>({cancelRef:D,ownerDocumentRef:v})),[D,v])},!1,a))}));AlertDialogContent.displayName="AlertDialogContent";export const AlertDialogTitle=A.forwardRef(((e,t)=>{const{titleId:r}=y("AlertDialogTitle");return A.createElement(l,f({as:"h2",selector:p("AlertDialogTitle"),id:r},e,{ref:t}))}));AlertDialogTitle.displayName="AlertDialogTitle";export const AlertDialogDescription=A.forwardRef(((e,t)=>{const{descriptionId:r}=y("AlertDialogDescription");return A.createElement(l,f({as:"p",selector:p("AlertDialogDescription"),id:r},e,{ref:t}))}));AlertDialogDescription.displayName="AlertDialogDescription";export const AlertDialogTrigger=g(o,"AlertDialogTrigger");export const AlertDialogOverlay=g(t,"AlertDialogOverlay");export const AlertDialogAction=g(i,"AlertDialogAction");"".concat("AlertDialogContent"," requires a label for the component to be accessible for screen reader users.\n\nYou can label the ").concat("AlertDialogContent"," by passing a ").concat("AlertDialogTitle"," 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 title by assigning it an `id` and passing the same value to the `aria-labelledby` prop in ").concat("AlertDialogContent",". If the label is confusing or duplicative for sighted users, you can also pass a label directly by using the `aria-label` prop.\n\nFor more information, see https://LINK-TO-DOCS.com"),"".concat("AlertDialogContent"," requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the ").concat("AlertDialogContent"," by passing a ").concat("AlertDialogDescription"," 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 ").concat("AlertDialogContent",". 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://LINK-TO-DOCS.com");export const Root=AlertDialog;export const Title=AlertDialogTitle;export const Cancel=AlertDialogCancel;export const Action=AlertDialogAction;export const Content=AlertDialogContent;export const Description=AlertDialogDescription;export const Overlay=AlertDialogOverlay;export const Trigger=AlertDialogTrigger;
import{Dialog as e,DialogOverlay as t,DialogContent as r,DialogTrigger as o,DialogClose as a}from"@radix-ui/react-dialog";import{Primitive as i}from"@radix-ui/react-primitive";import{createContext as l,useComposedRefs as n,useId as c,useDocumentRef as s,composeEventHandlers as d,extendComponent as p}from"@radix-ui/react-utils";import{getSelector as u,makeId as g,warning as f}from"@radix-ui/utils";import*as b from"react";function m(){return(m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function y(e,t){if(null==e)return{};var r,o,a=function(e,t){if(null==e)return{};var r,o,a={},i=Object.keys(e);for(o=0;o<i.length;o++)r=i[o],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}const[D,A]=l("AlertDialogContext","AlertDialog"),[h,v]=l("AlertDialogContext","AlertDialog");export const AlertDialog=t=>{const{children:r,id:o}=t,a=y(t,["children","id"]),i=g("alert-dialog",c()),l=o||i,n=g(l,"description"),s=g(l,"title");return b.createElement(e,a,b.createElement(D.Provider,{value:b.useMemo((()=>({descriptionId:n,titleId:s})),[n,s])},r))};AlertDialog.displayName="AlertDialog";const x="AlertDialogCancel";export const AlertDialogCancel=b.forwardRef(((e,t)=>{const{selector:r=u(x)}=e,o=y(e,["selector"]),{cancelRef:i}=v(x),l=n(t,i);return b.createElement(a,m({},o,{selector:r,ref:l}))}));AlertDialogCancel.displayName=x;const O="AlertDialogContent";export const AlertDialogContent=b.forwardRef(((e,t)=>{const{selector:o=u(O),"aria-label":a,"aria-labelledby":i,"aria-describedby":l,children:c}=e,p=y(e,["selector","aria-label","aria-labelledby","aria-describedby","children"]),{descriptionId:g,titleId:f}=A(O),D=b.useRef(null),v=b.useRef(null),x=s(v),C=n(t,v);return b.createElement(r,m({role:"alertdialog","aria-describedby":l||g,"aria-labelledby":a?void 0:i||f,"aria-label":a||void 0},p,{selector:o,ref:C,onOpenAutoFocus:d(p.onOpenAutoFocus,(e=>{var t;e.preventDefault(),null===(t=D.current)||void 0===t||t.focus({preventScroll:!0})}))}),b.createElement(h.Provider,{value:b.useMemo((()=>({cancelRef:D,ownerDocumentRef:x})),[D,x])},!1,c))}));AlertDialogContent.displayName=O;const C="AlertDialogTitle",w="h2";export const AlertDialogTitle=b.forwardRef(((e,t)=>{const{as:r=w,selector:o=u(C)}=e,a=y(e,["as","selector"]),{titleId:l}=A(C);return b.createElement(i,m({id:l},a,{as:r,selector:o,ref:t}))}));AlertDialogTitle.displayName=C;const I="AlertDialogDescription",T="p";export const AlertDialogDescription=b.forwardRef(((e,t)=>{const{as:r=T,selector:o=u(I)}=e,a=y(e,["as","selector"]),{descriptionId:l}=A(I);return b.createElement(i,m({id:l},a,{as:r,selector:o,ref:t}))}));AlertDialogDescription.displayName=I;export const AlertDialogTrigger=p(o,"AlertDialogTrigger");export const AlertDialogOverlay=p(t,"AlertDialogOverlay");export const AlertDialogAction=p(a,"AlertDialogAction");"".concat(O," requires a label for the component to be accessible for screen reader users.\n\nYou can label the ").concat(O," by passing a ").concat(C," 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 title by assigning it an `id` and passing the same value to the `aria-labelledby` prop in ").concat(O,". If the label is confusing or duplicative for sighted users, you can also pass a label directly by using the `aria-label` prop.\n\nFor more information, see https://LINK-TO-DOCS.com"),"".concat(O," requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the ").concat(O," by passing a ").concat(I," 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 ").concat(O,". 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://LINK-TO-DOCS.com");export const Root=AlertDialog;export const Title=AlertDialogTitle;export const Cancel=AlertDialogCancel;export const Action=AlertDialogAction;export const Content=AlertDialogContent;export const Description=AlertDialogDescription;export const Overlay=AlertDialogOverlay;export const Trigger=AlertDialogTrigger;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-alert-dialog",
"version": "0.0.3",
"version": "0.0.4",
"license": "MIT",

@@ -15,13 +15,11 @@ "source": "src/index.ts",

"scripts": {
"build": "parcel build src/index.ts --no-cache",
"clean": "rm -rf dist",
"version": "yarn version",
"prepublish": "yarn clean && yarn build"
"prepublish": "yarn clean"
},
"dependencies": {
"@radix-ui/react-dialog": "0.0.3",
"@radix-ui/react-polymorphic": "0.0.2",
"@radix-ui/react-primitive": "0.0.1",
"@radix-ui/react-utils": "0.0.2",
"@radix-ui/utils": "0.0.2"
"@radix-ui/react-dialog": "0.0.4",
"@radix-ui/react-polymorphic": "0.0.3",
"@radix-ui/react-primitive": "0.0.2",
"@radix-ui/react-utils": "0.0.3",
"@radix-ui/utils": "0.0.3"
},

@@ -28,0 +26,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc