UNPKG

@vela-ui/react

Version:

Vela UI React components

3 lines (2 loc) 7.97 kB
"use client" "use strict";"use client";var f=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var G=(e,t)=>{for(var o in t)f(e,o,{get:t[o],enumerable:!0})},J=(e,t,o,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of W(t))!q.call(e,r)&&r!==o&&f(e,r,{get:()=>t[r],enumerable:!(l=H(t,r))||l.enumerable});return e};var K=e=>J(f({},"__esModule",{value:!0}),e);var de={};G(de,{Select:()=>te,SelectDescription:()=>le,SelectItem:()=>ce,SelectLabel:()=>pe,SelectList:()=>ie,SelectPopover:()=>se,SelectSection:()=>ne,SelectSeparator:()=>ae,SelectTrigger:()=>oe,SelectValue:()=>re});module.exports=K(de);var p=require("react-aria-components"),O=require("tailwind-variants");var v=require("react/jsx-runtime"),h=e=>(0,v.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,v.jsx)("path",{d:"M20 6 9 17l-5-5"})});var P=require("react/jsx-runtime"),D=e=>(0,P.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,P.jsx)("path",{d:"m6 9 6 6 6-6"})});var S=require("tailwind-variants"),T=(0,S.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 y=require("clsx"),A=require("react-aria-components"),x=require("tailwind-merge"),L=(...e)=>(0,x.twMerge)((0,y.clsx)(...e));function b(e,t){return(0,A.composeRenderProps)(e,o=>(0,x.twMerge)(t,o))}var s=require("react-aria-components"),w=require("tailwind-merge"),V=require("tailwind-variants");var n=require("react/jsx-runtime"),Q=(0,V.tv)({base:"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[selection-mode]:pr-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",variants:{variant:{default:"",destructive:"text-destructive *:[svg]:!text-destructive"},isFocused:{true:"bg-accent text-accent-foreground"},isHovered:{true:"bg-accent text-accent-foreground"},isDisabled:{true:"pointer-events-none opacity-50"}},compoundVariants:[{variant:"destructive",isFocused:!0,className:"bg-destructive/10 dark:bg-destructive/20 text-destructive"}]});function N({className:e,...t}){return(0,n.jsxs)(s.ListBoxSection,{className:e,children:["title"in t&&(0,n.jsx)(s.Header,{className:"text-muted-foreground px-2 py-1.5 text-xs",children:t.title}),(0,n.jsx)(s.Collection,{items:t.items,children:t.children})]})}function B({className:e,variant:t,...o}){let l=o.textValue||(typeof o.children=="string"?o.children:void 0);return(0,n.jsx)(s.ListBoxItem,{textValue:l,className:(0,s.composeRenderProps)(e,(r,c)=>Q({...c,variant:t,className:r})),...o,children:(0,s.composeRenderProps)(o.children,(r,{isSelected:c})=>(0,n.jsxs)(n.Fragment,{children:[c&&(0,n.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:(0,n.jsx)(h,{})}),r]}))})}function R({className:e,...t}){return(0,n.jsx)(s.Text,{slot:"label",className:e,...t})}function k({className:e,...t}){return(0,n.jsx)(s.Text,{slot:"description",className:(0,w.twMerge)("text-muted-foreground text-sm",e),...t})}function C({className:e,...t}){return(0,n.jsx)(s.Separator,{orientation:"horizontal",className:(0,w.twMerge)("bg-border -mx-1 my-1 h-px",e),...t})}var m=require("react-aria-components"),I=require("tailwind-variants"),g=require("react/jsx-runtime"),U=(0,I.tv)({slots:{label:"group-data-[invalid]:text-destructive flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",description:"text-muted-foreground text-sm",fieldError:"text-destructive text-sm"}}),{label:X,description:Y,fieldError:Z}=U();function z({className:e,...t}){return(0,g.jsx)(m.Label,{"data-slot":"label",className:X({className:e}),...t})}function F({className:e,...t}){return(0,g.jsx)(m.Text,{slot:"description",className:Y({className:e}),...t})}function E({className:e,...t}){return(0,g.jsx)(m.FieldError,{className:(0,m.composeRenderProps)(e,o=>Z({className:o})),...t})}var a=require("react-aria-components"),_=require("tailwind-variants");var d=require("react/jsx-runtime"),$=(0,_.tv)({base:"bg-popover text-popover-foreground z-50 rounded-md border shadow-md outline-hidden transition duration-200",variants:{isEntering:{true:["animate-in fade-in-0 zoom-in-95","data-[placement=left]:slide-in-from-right-2 data-[placement=right]:slide-in-from-left-2 data-[placement=top]:slide-in-from-bottom-2 data-[placement=bottom]:slide-in-from-top-2"]},isExiting:{true:["animate-out fade-out-0 zoom-out-95","data-[placement=left]:slide-out-to-right-2 data-[placement=right]:slide-out-to-left-2 data-[placement=top]:slide-out-to-bottom-2 data-[placement=bottom]:slide-out-to-top-2"]}}});var M=({className:e,showArrow:t,...o})=>{let l=(0,a.useSlottedContext)(a.PopoverContext),r=(l==null?void 0:l.trigger)==="SubmenuTrigger",c=t?12:8;return c=r?c-6:c,(0,d.jsx)(a.Popover,{"data-slot":"popover",offset:c,className:(0,a.composeRenderProps)(e,(u,j)=>$({...j,className:u})),...o,children:(0,a.composeRenderProps)(o.children,u=>(0,d.jsxs)(d.Fragment,{children:[t&&(0,d.jsx)(a.OverlayArrow,{className:"group",children:(0,d.jsx)("svg",{width:12,height:12,viewBox:"0 0 12 12",className:"fill-popover stroke-border block stroke-1 group-data-[placement=bottom]:rotate-180 group-data-[placement=left]:-rotate-90 group-data-[placement=right]:rotate-90",children:(0,d.jsx)("path",{d:"M0 0 L6 6 L12 0"})})}),u]}))})};var i=require("react/jsx-runtime"),ee=(0,O.tv)({extend:T,base:"border-input [&_svg:not([class*='text-'])]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 group-data-[invalid]:ring-destructive/20 group-data-[invalid]:dark:ring-destructive/40 group-data-[invalid]:border-destructive flex w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] [&_svg]:pointer-events-none [&_svg]:shrink-0",variants:{size:{xs:"h-8 [&_svg:not([class*='size-'])]:size-3.5",sm:"h-9 [&_svg:not([class*='size-'])]:size-4",md:"h-10 [&_svg:not([class*='size-'])]:size-4",lg:"h-11 [&_svg:not([class*='size-'])]:size-5"},isDisabled:{true:"cursor-not-allowed opacity-50"}},defaultVariants:{size:"md"}});function te({label:e,description:t,errorMessage:o,className:l,children:r,...c}){return(0,i.jsx)(p.Select,{"data-slot":"select",...c,className:b(l,"group flex w-full flex-col gap-2"),children:(0,p.composeRenderProps)(r,u=>(0,i.jsxs)(i.Fragment,{children:[e&&(0,i.jsx)(z,{children:e}),u,t&&(0,i.jsx)(F,{children:t}),(0,i.jsx)(E,{children:o})]}))})}function oe({className:e,size:t,children:o,...l}){return(0,i.jsx)(p.Button,{"data-slot":"select-trigger",className:(0,p.composeRenderProps)(e,(r,c)=>ee({...c,size:t,className:r})),...l,children:(0,p.composeRenderProps)(o,r=>(0,i.jsxs)(i.Fragment,{children:[r,(0,i.jsx)(D,{"aria-hidden":"true",className:"opacity-50"})]}))})}function re({className:e,...t}){return(0,i.jsx)(p.SelectValue,{"data-slot":"select-value",className:(0,p.composeRenderProps)(e,o=>L("data-[placeholder]:text-muted-foreground line-clamp-1 flex items-center gap-2","[&>[slot=description]]:hidden",o)),...t})}function se({className:e,...t}){return(0,i.jsx)(M,{showArrow:!1,className:e,style:{minWidth:"var(--trigger-width)"},...t})}function ie({className:e,...t}){return(0,i.jsx)(p.ListBox,{className:b(e,"max-h-[inherit] min-w-[inherit] overflow-auto p-1 outline-hidden"),...t})}var ne=N,ae=C,pe=R,le=k,ce=B;0&&(module.exports={Select,SelectDescription,SelectItem,SelectLabel,SelectList,SelectPopover,SelectSection,SelectSeparator,SelectTrigger,SelectValue});