UNPKG

ivt

Version:

Ivt Components Library

3 lines (2 loc) 5.64 kB
import*as e from"react";import{c as t}from"../chunks/index-Dr5ObK3L.mjs";import{u as a}from"../chunks/index-C-j8pU3U.mjs";import{c as r,R as o,P as n,O as s,b as l,W as i,a as c,T as d,D as m,C as u}from"../chunks/index-D1EuiH1M.mjs";import{c as p}from"../chunks/index-DVnblQ-a.mjs";import{createSlottable as f}from"@radix-ui/react-slot";import{jsx as g,jsxs as h}from"react/jsx-runtime";import{c as x}from"../chunks/utils-C-nkZ_Ir.mjs";import{b as v}from"../chunks/button-CWf6NSDH.mjs";import"../chunks/index-UQBMY2z8.mjs";import"../chunks/index-0-u0cdz8.mjs";import"../chunks/index-BOUg6o32.mjs";import"../chunks/index-C_Mk3Jfk.mjs";import"../chunks/index-DiPp8h7C.mjs";import"react-dom";import"../chunks/index-DSUHCtxx.mjs";import"../chunks/index-lVEpnR8T.mjs";import"../chunks/tslib.es6-Bvey-QDo.mjs";import"../chunks/index-1xuBLrml.mjs";import"../chunks/bundle-mjs-DHbvkKp4.mjs";import"class-variance-authority";var N="AlertDialog",[y,D]=t(N,[r]),b=r(),A=e=>{const{__scopeAlertDialog:t,...a}=e,r=b(t);return g(o,{...r,...a,modal:!0})};A.displayName=N;var j=e.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...r}=e,o=b(a);return g(l,{...o,...r,ref:t})});j.displayName="AlertDialogTrigger";var k=e=>{const{__scopeAlertDialog:t,...a}=e,r=b(t);return g(n,{...r,...a})};k.displayName="AlertDialogPortal";var _=e.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...r}=e,o=b(a);return g(s,{...o,...r,ref:t})});_.displayName="AlertDialogOverlay";var w="AlertDialogContent",[E,R]=y(w),O=f("AlertDialogContent"),z=e.forwardRef((t,r)=>{const{__scopeAlertDialog:o,children:n,...s}=t,l=b(o),d=e.useRef(null),m=a(r,d),u=e.useRef(null);return g(i,{contentName:w,titleName:C,docsSlug:"alert-dialog",children:g(E,{scope:o,cancelRef:u,children:h(c,{role:"alertdialog",...l,...s,ref:m,onOpenAutoFocus:p(s.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[g(O,{children:n}),g(q,{contentRef:d})]})})})});z.displayName=w;var C="AlertDialogTitle",$=e.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...r}=e,o=b(a);return g(d,{...o,...r,ref:t})});$.displayName=C;var F="AlertDialogDescription",I=e.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...r}=e,o=b(a);return g(m,{...o,...r,ref:t})});I.displayName=F;var P=e.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...r}=e,o=b(a);return g(u,{...o,...r,ref:t})});P.displayName="AlertDialogAction";var T="AlertDialogCancel",S=e.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...o}=e,{cancelRef:n}=R(T,r),s=b(r),l=a(t,n);return g(u,{...s,...o,ref:l})});S.displayName=T;var q=({contentRef:t})=>{const a=`\`${w}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${w}\` by passing a \`${F}\` 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 \`${w}\`. 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`;return e.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))},[a,t]),null},B=A,W=j,Y=k,G=_,H=z,J=P,K=S,L=$,M=I;function Q({...t}){return e.createElement(B,{"data-slot":"alert-dialog",...t})}function U({...t}){return e.createElement(W,{"data-slot":"alert-dialog-trigger",...t})}function V({...t}){return e.createElement(Y,{"data-slot":"alert-dialog-portal",...t})}function X({className:t,...a}){return e.createElement(G,{"data-slot":"alert-dialog-overlay",className:x("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function Z({className:t,...a}){return e.createElement(V,null,e.createElement(X,null),e.createElement(H,{"data-slot":"alert-dialog-content",className:x("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...a}))}function ee({className:t,...a}){return e.createElement("div",{"data-slot":"alert-dialog-header",className:x("flex flex-col gap-2 text-center sm:text-left",t),...a})}function te({className:t,...a}){return e.createElement("div",{"data-slot":"alert-dialog-footer",className:x("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function ae({className:t,...a}){return e.createElement(L,{"data-slot":"alert-dialog-title",className:x("text-lg font-semibold",t),...a})}function re({className:t,...a}){return e.createElement(M,{"data-slot":"alert-dialog-description",className:x("text-muted-foreground text-sm",t),...a})}function oe({className:t,...a}){return e.createElement(J,{className:x(v(),t),...a})}function ne({className:t,...a}){return e.createElement(K,{className:x(v({variant:"outline"}),t),...a})}export{Q as AlertDialog,oe as AlertDialogAction,ne as AlertDialogCancel,Z as AlertDialogContent,re as AlertDialogDescription,te as AlertDialogFooter,ee as AlertDialogHeader,X as AlertDialogOverlay,V as AlertDialogPortal,ae as AlertDialogTitle,U as AlertDialogTrigger}; //# sourceMappingURL=index.mjs.map