@vela-ui/react
Version:
Vela UI React components
3 lines (2 loc) • 2.42 kB
JavaScript
"use client"
;"use client";var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var C=(e,r)=>{for(var s in r)p(e,s,{get:r[s],enumerable:!0})},y=(e,r,s,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of f(r))!w.call(e,t)&&t!==s&&p(e,t,{get:()=>r[t],enumerable:!(n=v(r,t))||n.enumerable});return e};var P=e=>y(p({},"__esModule",{value:!0}),e);var I={};C(I,{Checkbox:()=>R});module.exports=P(I);var i=require("react-aria-components"),u=require("tailwind-variants");var d=require("react/jsx-runtime"),h=e=>(0,d.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,d.jsx)("path",{d:"M20 6 9 17l-5-5"})});var l=require("react/jsx-runtime"),g=e=>(0,l.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,l.jsx)("path",{d:"M5 12h14"})});var x=require("tailwind-variants"),b=(0,x.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 o=require("react/jsx-runtime"),z=(0,u.tv)({base:"group relative flex items-center gap-2 text-sm transition",variants:{isDisabled:{true:"cursor-not-allowed opacity-50"}}}),V=(0,u.tv)({extend:b,base:"peer border-input dark:bg-input/30 flex shrink-0 items-center justify-center rounded-[4px] border shadow-xs transition-shadow [&_svg]:size-full",variants:{size:{sm:"size-4",md:"size-5 p-0.5",lg:"size-6 p-0.5"},isSelected:{true:"bg-primary dark:bg-primary text-primary-foreground border-primary"},isDisabled:{true:"cursor-not-allowed opacity-50"}},defaultVariants:{size:"md"}});function R({className:e,children:r,indicatorClassName:s,size:n,...t}){return(0,o.jsx)(i.Checkbox,{className:(0,i.composeRenderProps)(e,(c,a)=>z({...a,className:c})),...t,children:(0,i.composeRenderProps)(r,(c,{isSelected:a,isIndeterminate:m,...k})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{"data-slot":"checkbox-indicator",className:V({isSelected:a||m,size:n,...k,className:s}),children:m?(0,o.jsx)(g,{}):a?(0,o.jsx)(h,{}):null}),c]}))})}0&&(module.exports={Checkbox});