dgz-ui
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript
9 lines (5 loc) • 5.76 kB
JavaScript
;const o=require("react/jsx-runtime"),J=require("react"),m=require("./index-D9zW9Tk7.cjs.js"),v=require("./index-jFOWwfD3.cjs.js"),i=require("./index-CtCzh8NB.cjs.js"),c=require("./utils-C4d7Ql9-.cjs.js"),y=require("./button-CpKtD3qG.cjs.js");function K(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const l=K(J);var Q=Symbol("radix.slottable");function U(e){const t=({children:a})=>o.jsx(o.Fragment,{children:a});return t.displayName=`${e}.Slottable`,t.__radixId=Q,t}var N="AlertDialog",[X]=m.createContextScope(N,[i.createDialogScope]),n=i.createDialogScope(),x=e=>{const{__scopeAlertDialog:t,...a}=e,r=n(t);return o.jsx(i.Root,{...r,...a,modal:!0})};x.displayName=N;var Z="AlertDialogTrigger",_=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...r}=e,s=n(a);return o.jsx(i.Trigger,{...s,...r,ref:t})});_.displayName=Z;var ee="AlertDialogPortal",b=e=>{const{__scopeAlertDialog:t,...a}=e,r=n(t);return o.jsx(i.Portal,{...r,...a})};b.displayName=ee;var te="AlertDialogOverlay",j=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...r}=e,s=n(a);return o.jsx(i.Overlay,{...s,...r,ref:t})});j.displayName=te;var d="AlertDialogContent",[ae,oe]=X(d),re=U("AlertDialogContent"),R=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,children:r,...s}=e,u=n(a),g=l.useRef(null),Y=v.useComposedRefs(t,g),A=l.useRef(null);return o.jsx(i.WarningProvider,{contentName:d,titleName:C,docsSlug:"alert-dialog",children:o.jsx(ae,{scope:a,cancelRef:A,children:o.jsxs(i.Content,{role:"alertdialog",...u,...s,ref:Y,onOpenAutoFocus:m.composeEventHandlers(s.onOpenAutoFocus,p=>{var D;p.preventDefault(),(D=A.current)==null||D.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[o.jsx(re,{children:r}),o.jsx(se,{contentRef:g})]})})})});R.displayName=d;var C="AlertDialogTitle",S=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...r}=e,s=n(a);return o.jsx(i.Title,{...s,...r,ref:t})});S.displayName=C;var T="AlertDialogDescription",E=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...r}=e,s=n(a);return o.jsx(i.Description,{...s,...r,ref:t})});E.displayName=T;var le="AlertDialogAction",O=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...r}=e,s=n(a);return o.jsx(i.Close,{...s,...r,ref:t})});O.displayName=le;var h="AlertDialogCancel",w=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...r}=e,{cancelRef:s}=oe(h,a),u=n(a),g=v.useComposedRefs(t,s);return o.jsx(i.Close,{...u,...r,ref:g})});w.displayName=h;var se=({contentRef:e})=>{const t=`\`${d}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${d}\` by passing a \`${T}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
Alternatively, 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 \`${d}\`. 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.
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return l.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},ie=x,ne=_,ce=b,P=j,$=R,I=O,M=w,q=S,F=E;const de=ie,pe=ne,L=ce,f=l.forwardRef(({className:e,...t},a)=>o.jsx(P,{className:c.cn("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/80",e),...t,ref:a}));f.displayName=P.displayName;const z=l.forwardRef(({className:e,...t},a)=>o.jsxs(L,{children:[o.jsx(f,{}),o.jsx($,{ref:a,className:c.cn("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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",e),...t})]}));z.displayName=$.displayName;const H=({className:e,...t})=>o.jsx("div",{className:c.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});H.displayName="AlertDialogHeader";const k=({className:e,...t})=>o.jsx("div",{className:c.cn("flex gap-2 sm:justify-end",e),...t});k.displayName="AlertDialogFooter";const G=l.forwardRef(({className:e,...t},a)=>o.jsx(q,{ref:a,className:c.cn("text-lg font-semibold",e),...t}));G.displayName=q.displayName;const V=l.forwardRef(({className:e,...t},a)=>o.jsx(F,{ref:a,className:c.cn("text-muted-foreground text-sm",e),...t}));V.displayName=F.displayName;const B=l.forwardRef(({className:e,...t},a)=>o.jsx(I,{ref:a,className:c.cn(y.buttonVariants(),e),...t}));B.displayName=I.displayName;const W=l.forwardRef(({className:e,...t},a)=>o.jsx(M,{ref:a,className:c.cn(y.buttonVariants({variant:"tertiary"}),e),...t}));W.displayName=M.displayName;exports.AlertDialog=de;exports.AlertDialogAction=B;exports.AlertDialogCancel=W;exports.AlertDialogContent=z;exports.AlertDialogDescription=V;exports.AlertDialogFooter=k;exports.AlertDialogHeader=H;exports.AlertDialogOverlay=f;exports.AlertDialogPortal=L;exports.AlertDialogTitle=G;exports.AlertDialogTrigger=pe;
//# sourceMappingURL=alert-dialog-BfBtlIHj.cjs.js.map