@vela-ui/react
Version:
Vela UI React components
3 lines (2 loc) • 10.2 kB
JavaScript
"use client"
;"use client";var b=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var Q=(e,t)=>{for(var r in t)b(e,r,{get:t[r],enumerable:!0})},Y=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of J(t))!K.call(e,a)&&a!==r&&b(e,a,{get:()=>t[a],enumerable:!(n=Z(t,a))||n.enumerable});return e};var $=e=>Y(b({},"__esModule",{value:!0}),e);var be={};Q(be,{Drawer:()=>pe,DrawerBody:()=>ge,DrawerClose:()=>we,DrawerCloseIcon:()=>he,DrawerContent:()=>me,DrawerDescription:()=>ye,DrawerFooter:()=>fe,DrawerHeader:()=>xe,DrawerTitle:()=>ve,DrawerTrigger:()=>ue});module.exports=$(be);var X=require("react"),g=require("react-aria-components"),R=require("tailwind-variants");var V=require("tailwind-variants"),N=(0,V.tv)({base:"outline-hidden",variants:{isFocusVisible:{true:"border-ring ring-ring/50 ring-[3px]"},isInvalid:{true:"ring-destructive/20 dark:ring-destructive/40 border-destructive"}}});var f=require("react-aria-components"),_=require("tailwind-variants");var O=require("tailwind-variants");var m=require("react/jsx-runtime"),B=e=>(0,m.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"1em",height:"1em",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,m.jsx)("path",{d:"M18 6 6 18"}),(0,m.jsx)("path",{d:"m6 6 12 12"})]});var C=require("react/jsx-runtime"),T=e=>(0,C.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"1em",height:"1em",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,C.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})});var x=require("react/jsx-runtime"),A=e=>(0,x.jsxs)("svg",{fill:"none",width:"1em",height:"1em",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,x.jsx)("path",{stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"3.636",d:"M11.909 21a9.09 9.09 0 1 0 0-18.182 9.09 9.09 0 0 0 0 18.182Z"}),(0,x.jsx)("path",{fill:"currentColor",d:"M4.636 11.91a7.273 7.273 0 0 1 7.273-7.274V1C5.885 1 1 5.885 1 11.91zm1.819 4.81a7.24 7.24 0 0 1-1.819-4.81H1c0 2.764 1.032 5.294 2.727 7.215z"})]});var L=require("clsx"),j=require("react-aria-components"),M=require("tailwind-merge"),i=(...e)=>(0,M.twMerge)((0,L.clsx)(...e));var o=require("react/jsx-runtime"),ee=(0,O.tv)({base:"relative",variants:{size:{xs:"size-3",sm:"size-4",md:"size-5",lg:"size-8",xl:"size-10"}},defaultVariants:{size:"md"}});function te({className:e,...t}){return(0,o.jsx)(T,{className:i("size-4 animate-spin",e),"data-slot":"icon",...t})}var oe=({className:e,...t})=>(0,o.jsx)(A,{className:i("size-4 animate-spin",e),"data-slot":"icon",...t});function re({className:e,...t}){return(0,o.jsx)("svg",{className:i("size-4 stroke-current",e),"data-slot":"icon",viewBox:"0 0 2400 2400",...t,children:(0,o.jsxs)("g",{strokeWidth:"200",strokeLinecap:"round",fill:"none",children:[(0,o.jsx)("line",{x1:"1200",y1:"600",x2:"1200",y2:"100"}),(0,o.jsx)("line",{opacity:"0.5",x1:"1200",y1:"2300",x2:"1200",y2:"1800"}),(0,o.jsx)("line",{opacity:"0.917",x1:"900",y1:"680.4",x2:"650",y2:"247.4"}),(0,o.jsx)("line",{opacity:"0.417",x1:"1750",y1:"2152.6",x2:"1500",y2:"1719.6"}),(0,o.jsx)("line",{opacity:"0.833",x1:"680.4",y1:"900",x2:"247.4",y2:"650"}),(0,o.jsx)("line",{opacity:"0.333",x1:"2152.6",y1:"1750",x2:"1719.6",y2:"1500"}),(0,o.jsx)("line",{opacity:"0.75",x1:"600",y1:"1200",x2:"100",y2:"1200"}),(0,o.jsx)("line",{opacity:"0.25",x1:"2300",y1:"1200",x2:"1800",y2:"1200"}),(0,o.jsx)("line",{opacity:"0.667",x1:"680.4",y1:"1500",x2:"247.4",y2:"1750"}),(0,o.jsx)("line",{opacity:"0.167",x1:"2152.6",y1:"650",x2:"1719.6",y2:"900"}),(0,o.jsx)("line",{opacity:"0.583",x1:"900",y1:"1719.6",x2:"650",y2:"2152.6"}),(0,o.jsx)("line",{opacity:"0.083",x1:"1750",y1:"247.4",x2:"1500",y2:"680.4"}),(0,o.jsx)("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",keyTimes:"0;0.08333;0.16667;0.25;0.33333;0.41667;0.5;0.58333;0.66667;0.75;0.83333;0.91667",values:"0 1199 1199;30 1199 1199;60 1199 1199;90 1199 1199;120 1199 1199;150 1199 1199;180 1199 1199;210 1199 1199;240 1199 1199;270 1199 1199;300 1199 1199;330 1199 1199",dur:"0.83333s",begin:"0.08333s",repeatCount:"indefinite",calcMode:"discrete"})]})})}var ae={default:te,ring:oe,spin:re},se="default";function I(e){let{className:t,size:r,ref:n,variant:a,...d}=e,c=ae[a!=null?a:se];return(0,o.jsx)(c,{role:"presentation",ref:n,className:ee({size:r,className:t}),...d})}var p=require("react/jsx-runtime"),ne=(0,_.tv)({extend:N,base:"inline-flex shrink-0 items-center justify-center rounded-md font-medium whitespace-nowrap transition-all [&_svg]:pointer-events-none [&_svg]:shrink-0",variants:{variant:{neutral:"bg-neutral text-neutral-foreground hover:bg-neutral/90 shadow-xs",primary:"bg-primary text-primary-foreground hover:bg-primary/90 shadow-xs",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-xs",accent:"bg-accent text-accent-foreground hover:bg-accent/80 shadow-xs",destructive:"bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white shadow-xs",outline:"bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border shadow-xs",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{xs:"size-8 gap-1 text-xs [&_svg:not([class*='size-'])]:size-4",sm:"size-9 gap-2 text-sm [&_svg:not([class*='size-'])]:size-4",md:"size-10 gap-2 text-sm [&_svg:not([class*='size-'])]:size-5",lg:"size-11 gap-2.5 text-base [&_svg:not([class*='size-'])]:size-5",xl:"size-12 gap-2.5 text-base [&_svg:not([class*='size-'])]:size-5"},shape:{rectangle:"",square:"",circle:"rounded-full"},isDisabled:{true:"pointer-events-none opacity-50"},isPending:{true:"pointer-events-none opacity-50"}},compoundVariants:[{size:"xs",shape:"rectangle",className:"w-auto px-2.5"},{size:"sm",shape:"rectangle",className:"w-auto px-3.5"},{size:"md",shape:"rectangle",className:"w-auto px-4"},{size:"lg",shape:"rectangle",className:"w-auto px-5"},{size:"xl",shape:"rectangle",className:"w-auto px-5"}],defaultVariants:{variant:"primary",size:"md",shape:"rectangle"}});function D({className:e,variant:t,size:r,shape:n,loader:a=(0,p.jsx)(I,{}),...d}){return(0,p.jsx)(f.Button,{"data-slot":"button",className:(0,f.composeRenderProps)(e,(c,u)=>ne({...u,variant:t,size:r,shape:n,className:c})),...d,children:(0,f.composeRenderProps)(d.children,c=>(0,p.jsxs)(p.Fragment,{children:[d.isPending&&a,c]}))})}var v=require("react"),l=require("react-aria-components");var s=require("react/jsx-runtime"),E=l.DialogTrigger,ie={role:"dialog",isDismissable:!0,showCloseButton:!0,scrollBehavior:"outside"},P=(0,v.createContext)(ie),le=()=>(0,v.useContext)(P);var H=({className:e,children:t,...r})=>{let{role:n,isDismissable:a,showCloseButton:d}=le(),c=d&&a;return(0,s.jsx)(l.Dialog,{role:n,"data-slot":"dialog-content",className:i("relative flex h-full w-full flex-col gap-4 p-6 outline-hidden",e),...r,children:(0,l.composeRenderProps)(t,u=>(0,s.jsxs)(s.Fragment,{children:[u,c&&(0,s.jsx)(z,{})]}))})};var F=({className:e,...t})=>(0,s.jsx)("div",{"data-slot":"dialog-header",className:i("flex flex-col gap-2 text-left",e),...t}),S=({className:e,...t})=>(0,s.jsx)("div",{"data-slot":"dialog-footer",className:i("flex flex-row flex-wrap justify-end gap-2",e),...t}),W=({className:e,...t})=>(0,s.jsx)(l.Heading,{slot:"title","data-slot":"dialog-title",className:i("text-lg leading-6 font-semibold",e),...t}),G=({className:e,...t})=>(0,s.jsx)(l.Text,{elementType:"p",slot:"description","data-slot":"dialog-description",className:i("text-muted-foreground text-sm",e),...t}),z=({className:e,shape:t="circle",variant:r="ghost",size:n="xs",...a})=>(0,s.jsxs)(D,{"aria-label":"Close",slot:"close",className:i("absolute top-2 right-2",e),shape:t,variant:r,size:n,...a,children:[(0,s.jsx)(B,{}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]}),U=({className:e,variant:t="outline",...r})=>(0,s.jsx)(D,{slot:"close",className:e,variant:t,...r});var y=require("react/jsx-runtime"),de=(0,R.tv)({base:"fixed inset-0 z-50 flex w-full items-center justify-center bg-black/50",variants:{isBlurred:{true:"backdrop-blur-md backdrop-saturate-150"},isEntering:{true:"animate-in fade-in duration-300 ease-out"},isExiting:{true:"animate-out fade-out duration-200 ease-in"}}}),ce=(0,R.tv)({base:"bg-background fixed z-50 flex h-auto flex-col shadow-lg transition",variants:{placement:{top:"data-[entering]:slide-in-from-top data-[exiting]:slide-out-to-top inset-x-0 top-0 border-b",bottom:"data-[entering]:slide-in-from-bottom data-[exiting]:slide-out-to-bottom inset-x-0 bottom-0 border-t",left:"data-[entering]:slide-in-from-left data-[exiting]:slide-out-to-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",right:"data-[entering]:slide-in-from-right data-[exiting]:slide-out-to-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm"},isEntering:{true:"animate-in duration-300"},isExiting:{true:"animate-out duration-200"}},defaultVariants:{placement:"right",isBlurred:!1}}),pe=({className:e,overlayClassName:t,showCloseButton:r=!0,isDismissable:n=!0,isOpen:a,onOpenChange:d,placement:c,isBlurred:u,...k})=>{let q=(0,X.useMemo)(()=>({showCloseButton:r,isDismissable:n}),[r,n]);return(0,y.jsx)(P.Provider,{value:q,children:(0,y.jsx)(g.ModalOverlay,{"data-slot":"drawer-overlay",style:{height:"var(--visual-viewport-height)"},isOpen:a,onOpenChange:d,isDismissable:n,className:(0,g.composeRenderProps)(t,(h,w)=>de({...w,isBlurred:u,className:h})),...k,children:(0,y.jsx)(g.Modal,{"data-slot":"drawer",className:(0,g.composeRenderProps)(e,(h,w)=>ce({...w,placement:c,className:h})),...k})})})},ge=({className:e,...t})=>(0,y.jsx)("div",{"data-slot":"drawer-body",className:i("flex-1 overflow-auto",e),...t}),ue=E,me=H,xe=F,fe=S,ve=W,ye=G,he=z,we=U;0&&(module.exports={Drawer,DrawerBody,DrawerClose,DrawerCloseIcon,DrawerContent,DrawerDescription,DrawerFooter,DrawerHeader,DrawerTitle,DrawerTrigger});