UNPKG

@vela-ui/react

Version:

Vela UI React components

3 lines (2 loc) 11 kB
"use client" "use strict";"use client";var h=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var W=(e,t)=>{for(var o in t)h(e,o,{get:t[o],enumerable:!0})},G=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of S(t))!F.call(e,a)&&a!==o&&h(e,a,{get:()=>t[a],enumerable:!(s=H(t,a))||s.enumerable});return e};var U=e=>G(h({},"__esModule",{value:!0}),e);var ue={};W(ue,{Dialog:()=>re,DialogBody:()=>ie,DialogClose:()=>me,DialogCloseIcon:()=>_,DialogContent:()=>ne,DialogContext:()=>P,DialogDescription:()=>pe,DialogFooter:()=>ce,DialogHeader:()=>le,DialogTitle:()=>de,DialogTrigger:()=>ae,useDialogContext:()=>z});module.exports=U(ue);var g=require("react"),d=require("react-aria-components");var x=require("react/jsx-runtime"),V=e=>(0,x.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,x.jsx)("path",{d:"M18 6 6 18"}),(0,x.jsx)("path",{d:"m6 6 12 12"})]});var b=require("react/jsx-runtime"),B=e=>(0,b.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,b.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})});var v=require("react/jsx-runtime"),R=e=>(0,v.jsxs)("svg",{fill:"none",width:"1em",height:"1em",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,v.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,v.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 k=require("clsx"),X=require("react-aria-components"),N=require("tailwind-merge"),c=(...e)=>(0,N.twMerge)((0,k.clsx)(...e));var f=require("react-aria-components"),O=require("tailwind-variants");var M=require("tailwind-variants"),A=(0,M.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 L=require("tailwind-variants");var r=require("react/jsx-runtime"),q=(0,L.tv)({base:"relative",variants:{size:{xs:"size-3",sm:"size-4",md:"size-5",lg:"size-8",xl:"size-10"}},defaultVariants:{size:"md"}});function Z({className:e,...t}){return(0,r.jsx)(B,{className:c("size-4 animate-spin",e),"data-slot":"icon",...t})}var J=({className:e,...t})=>(0,r.jsx)(R,{className:c("size-4 animate-spin",e),"data-slot":"icon",...t});function K({className:e,...t}){return(0,r.jsx)("svg",{className:c("size-4 stroke-current",e),"data-slot":"icon",viewBox:"0 0 2400 2400",...t,children:(0,r.jsxs)("g",{strokeWidth:"200",strokeLinecap:"round",fill:"none",children:[(0,r.jsx)("line",{x1:"1200",y1:"600",x2:"1200",y2:"100"}),(0,r.jsx)("line",{opacity:"0.5",x1:"1200",y1:"2300",x2:"1200",y2:"1800"}),(0,r.jsx)("line",{opacity:"0.917",x1:"900",y1:"680.4",x2:"650",y2:"247.4"}),(0,r.jsx)("line",{opacity:"0.417",x1:"1750",y1:"2152.6",x2:"1500",y2:"1719.6"}),(0,r.jsx)("line",{opacity:"0.833",x1:"680.4",y1:"900",x2:"247.4",y2:"650"}),(0,r.jsx)("line",{opacity:"0.333",x1:"2152.6",y1:"1750",x2:"1719.6",y2:"1500"}),(0,r.jsx)("line",{opacity:"0.75",x1:"600",y1:"1200",x2:"100",y2:"1200"}),(0,r.jsx)("line",{opacity:"0.25",x1:"2300",y1:"1200",x2:"1800",y2:"1200"}),(0,r.jsx)("line",{opacity:"0.667",x1:"680.4",y1:"1500",x2:"247.4",y2:"1750"}),(0,r.jsx)("line",{opacity:"0.167",x1:"2152.6",y1:"650",x2:"1719.6",y2:"900"}),(0,r.jsx)("line",{opacity:"0.583",x1:"900",y1:"1719.6",x2:"650",y2:"2152.6"}),(0,r.jsx)("line",{opacity:"0.083",x1:"1750",y1:"247.4",x2:"1500",y2:"680.4"}),(0,r.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 Q={default:Z,ring:J,spin:K},Y="default";function T(e){let{className:t,size:o,ref:s,variant:a,...i}=e,l=Q[a!=null?a:Y];return(0,r.jsx)(l,{role:"presentation",ref:s,className:q({size:o,className:t}),...i})}var p=require("react/jsx-runtime"),$=(0,O.tv)({extend:A,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 w({className:e,variant:t,size:o,shape:s,loader:a=(0,p.jsx)(T,{}),...i}){return(0,p.jsx)(f.Button,{"data-slot":"button",className:(0,f.composeRenderProps)(e,(l,u)=>$({...u,variant:t,size:o,shape:s,className:l})),...i,children:(0,f.composeRenderProps)(i.children,l=>(0,p.jsxs)(p.Fragment,{children:[i.isPending&&a,l]}))})}var m=require("react-aria-components"),C=require("tailwind-variants"),y=require("react/jsx-runtime"),j=(0,C.tv)({base:"fixed inset-0 z-50 flex w-full items-center justify-center bg-black/50",variants:{placement:{top:"items-start",center:"items-center",bottom:"items-end"},scrollBehavior:{inside:"items-stretch overflow-hidden",outside:"overflow-auto"},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"}},compoundVariants:[{placement:"center",scrollBehavior:"outside",className:"[&>div]:m-auto"},{placement:"bottom",scrollBehavior:"outside",className:"[&>div]:mt-auto"}],defaultVariants:{placement:"top",scrollBehavior:"outside",isBlurred:!1}}),ee=(0,C.tv)({base:"bg-background my-16 w-full max-w-[calc(100%-2rem)] rounded-lg border shadow-lg transition",variants:{scrollBehavior:{inside:"max-h-[calc(100%-7.5rem)]",outside:""},isEntering:{true:"animate-in zoom-in-95 duration-300 ease-out"},isExiting:{true:"animate-out zoom-out-95 duration-200 ease-in"},size:{xs:"sm:max-w-xs",sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl","3xl":"sm:max-w-3xl","4xl":"sm:max-w-4xl","5xl":"sm:max-w-5xl",full:"my-0 h-dvh max-w-full rounded-none"}},defaultVariants:{size:"lg"}});function te({className:e,placement:t,scrollBehavior:o,isBlurred:s,...a}){return(0,y.jsx)(m.ModalOverlay,{"data-slot":"modal-overlay",style:{height:"var(--visual-viewport-height)"},className:(0,m.composeRenderProps)(e,(i,l)=>j({...l,placement:t,scrollBehavior:o,isBlurred:s,className:i})),...a})}function oe({className:e,size:t,scrollBehavior:o,...s}){return(0,y.jsx)(m.Modal,{"data-slot":"modal",className:(0,m.composeRenderProps)(e,(a,i)=>ee({...i,size:t,scrollBehavior:o,className:a})),...s})}function I({className:e,overlayClassName:t,isDismissable:o=!0,isOpen:s,onOpenChange:a,size:i,placement:l,scrollBehavior:u,isBlurred:E,...D}){return(0,y.jsx)(te,{isDismissable:o,isOpen:s,onOpenChange:a,className:t,placement:l,scrollBehavior:u,isBlurred:E,...D,children:(0,y.jsx)(oe,{className:e,size:i,scrollBehavior:u,...D})})}var n=require("react/jsx-runtime"),ae=d.DialogTrigger,se={role:"dialog",isDismissable:!0,showCloseButton:!0,scrollBehavior:"outside"},P=(0,g.createContext)(se),z=()=>(0,g.useContext)(P),re=({role:e="dialog",showCloseButton:t=!0,isDismissable:o,scrollBehavior:s,...a})=>{let i=o!=null?o:e!=="alertdialog",l=(0,g.useMemo)(()=>({role:e,showCloseButton:t,isDismissable:i,scrollBehavior:s}),[e,t,i,s]);return(0,n.jsx)(P.Provider,{value:l,children:(0,n.jsx)(I,{isDismissable:i,scrollBehavior:s,...a})})},ne=({className:e,children:t,...o})=>{let{role:s,isDismissable:a,showCloseButton:i}=z(),l=i&&a;return(0,n.jsx)(d.Dialog,{role:s,"data-slot":"dialog-content",className:c("relative flex h-full w-full flex-col gap-4 p-6 outline-hidden",e),...o,children:(0,d.composeRenderProps)(t,u=>(0,n.jsxs)(n.Fragment,{children:[u,l&&(0,n.jsx)(_,{})]}))})},ie=({className:e,...t})=>{let{scrollBehavior:o}=z();return(0,n.jsx)("div",{"data-slot":"dialog-body",className:c("flex-1",o==="inside"?"overflow-auto":"",e),...t})},le=({className:e,...t})=>(0,n.jsx)("div",{"data-slot":"dialog-header",className:c("flex flex-col gap-2 text-left",e),...t}),ce=({className:e,...t})=>(0,n.jsx)("div",{"data-slot":"dialog-footer",className:c("flex flex-row flex-wrap justify-end gap-2",e),...t}),de=({className:e,...t})=>(0,n.jsx)(d.Heading,{slot:"title","data-slot":"dialog-title",className:c("text-lg leading-6 font-semibold",e),...t}),pe=({className:e,...t})=>(0,n.jsx)(d.Text,{elementType:"p",slot:"description","data-slot":"dialog-description",className:c("text-muted-foreground text-sm",e),...t}),_=({className:e,shape:t="circle",variant:o="ghost",size:s="xs",...a})=>(0,n.jsxs)(w,{"aria-label":"Close",slot:"close",className:c("absolute top-2 right-2",e),shape:t,variant:o,size:s,...a,children:[(0,n.jsx)(V,{}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]}),me=({className:e,variant:t="outline",...o})=>(0,n.jsx)(w,{slot:"close",className:e,variant:t,...o});0&&(module.exports={Dialog,DialogBody,DialogClose,DialogCloseIcon,DialogContent,DialogContext,DialogDescription,DialogFooter,DialogHeader,DialogTitle,DialogTrigger,useDialogContext});