UNPKG

@anoki/fse-ui

Version:

FSE UI components library

9 lines (5 loc) 4.1 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react"),T=require("./index.cjs477.js"),E=require("./index.cjs478.js"),n=require("./index.cjs312.js"),h=require("./index.cjs479.js"),w=require("./index.cjs480.js"),i=require("./index.cjs237.js");function M(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const l=M(b);var j="AlertDialog",[q]=T.createContextScope(j,[n.createDialogScope]),s=n.createDialogScope(),d=e=>{const{__scopeAlertDialog:o,...t}=e,r=s(o);return i.jsxRuntimeExports.jsx(n.Root,{...r,...t,modal:!0})};d.displayName=j;var I="AlertDialogTrigger",_=l.forwardRef((e,o)=>{const{__scopeAlertDialog:t,...r}=e,a=s(t);return i.jsxRuntimeExports.jsx(n.Trigger,{...a,...r,ref:o})});_.displayName=I;var $="AlertDialogPortal",A=e=>{const{__scopeAlertDialog:o,...t}=e,r=s(o);return i.jsxRuntimeExports.jsx(n.Portal,{...r,...t})};A.displayName=$;var L="AlertDialogOverlay",D=l.forwardRef((e,o)=>{const{__scopeAlertDialog:t,...r}=e,a=s(t);return i.jsxRuntimeExports.jsx(n.Overlay,{...a,...r,ref:o})});D.displayName=L;var c="AlertDialogContent",[F,G]=q(c),W=w.createSlottable("AlertDialogContent"),v=l.forwardRef((e,o)=>{const{__scopeAlertDialog:t,children:r,...a}=e,g=s(t),u=l.useRef(null),P=E.useComposedRefs(o,u),R=l.useRef(null);return i.jsxRuntimeExports.jsx(n.WarningProvider,{contentName:c,titleName:C,docsSlug:"alert-dialog",children:i.jsxRuntimeExports.jsx(F,{scope:t,cancelRef:R,children:i.jsxRuntimeExports.jsxs(n.Content,{role:"alertdialog",...g,...a,ref:P,onOpenAutoFocus:h.composeEventHandlers(a.onOpenAutoFocus,p=>{var y;p.preventDefault(),(y=R.current)==null||y.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[i.jsxRuntimeExports.jsx(W,{children:r}),i.jsxRuntimeExports.jsx(k,{contentRef:u})]})})})});v.displayName=c;var C="AlertDialogTitle",f=l.forwardRef((e,o)=>{const{__scopeAlertDialog:t,...r}=e,a=s(t);return i.jsxRuntimeExports.jsx(n.Title,{...a,...r,ref:o})});f.displayName=C;var N="AlertDialogDescription",x=l.forwardRef((e,o)=>{const{__scopeAlertDialog:t,...r}=e,a=s(t);return i.jsxRuntimeExports.jsx(n.Description,{...a,...r,ref:o})});x.displayName=N;var Y="AlertDialogAction",S=l.forwardRef((e,o)=>{const{__scopeAlertDialog:t,...r}=e,a=s(t);return i.jsxRuntimeExports.jsx(n.Close,{...a,...r,ref:o})});S.displayName=Y;var O="AlertDialogCancel",m=l.forwardRef((e,o)=>{const{__scopeAlertDialog:t,...r}=e,{cancelRef:a}=G(O,t),g=s(t),u=E.useComposedRefs(o,a);return i.jsxRuntimeExports.jsx(n.Close,{...g,...r,ref:u})});m.displayName=O;var k=({contentRef:e})=>{const o=`\`${c}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${c}\` by passing a \`${N}\` 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 \`${c}\`. 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(o)},[o,e]),null},z=d,B=A,H=D,V=v,J=m,K=f,Q=x;exports.AlertDialog=d;exports.AlertDialogAction=S;exports.AlertDialogCancel=m;exports.AlertDialogContent=v;exports.AlertDialogDescription=x;exports.AlertDialogOverlay=D;exports.AlertDialogPortal=A;exports.AlertDialogTitle=f;exports.AlertDialogTrigger=_;exports.Cancel=J;exports.Content=V;exports.Description=Q;exports.Overlay=H;exports.Portal=B;exports.Root=z;exports.Title=K; //# sourceMappingURL=index.cjs303.js.map