@capitaltg/vero 1.8.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -185,8 +185,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
185
185
  text-sm outline-none focus:bg-accent focus:text-accent-foreground
186
186
  data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(eS,{children:f.jsx(Ot,{className:"h-4 w-4",strokeWidth:3})})}),f.jsx(J0,{children:t})]}));ja.displayName=Ld.displayName;const Fa=l.forwardRef(({className:e,children:t,isDisabled:n=!1,...r},o)=>{const a=De({isDisabled:n});return f.jsxs(jd,{ref:o,className:k(ie.input,ie.focusRing,`min-w-0 items-center justify-between text-left [&>span]:min-w-0 [&>span]:flex-1
187
187
  [&>span]:truncate [&>span]:text-muted-foreground [&>svg]:flex-shrink-0`,e),...r,...a,children:[t,f.jsx(q0,{asChild:!0,children:f.jsx(qo,{className:"h-4 w-4 opacity-50"})})]})});Fa.displayName=jd.displayName;const Bd=z0,tS=Q0,Vd=K0,$a=l.forwardRef(({options:e,value:t,onChange:n,placeholder:r="Select an option",className:o,zIndex:a,isDisabled:i,...s},c)=>{const u=Ye("dropdown",a);return f.jsxs(Bd,{value:t,onValueChange:n,children:[f.jsx(Fa,{ref:c,className:k("w-full justify-between",!t&&"text-muted-foreground",o),isDisabled:i,...s,children:f.jsx(Vd,{placeholder:r})}),f.jsx(_a,{zIndex:u,children:e.map(d=>f.jsx(ja,{value:d.value,children:d.label},d.value))})]})});$a.displayName="Select";const Yd=l.forwardRef(({className:e,...t},n)=>f.jsx($d,{ref:n,className:k("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Yd.displayName=$d.displayName;const Hd=l.forwardRef(({className:e,...t},n)=>f.jsx(Wd,{ref:n,className:k("-mx-1 my-1 h-px bg-muted",e),...t}));Hd.displayName=Wd.displayName;const nS=Se("flex",{variants:{orientation:{horizontal:"flex-row gap-6",vertical:"flex-col gap-10"}},defaultVariants:{orientation:"horizontal"}}),rS=Se(`text-md relative z-10 flex h-9 w-9 items-center justify-center rounded-full border-4 bg-white
188
- font-bold`,{variants:{status:{default:"border-muted text-muted-foreground",current:"border-primary-400 text-primary-400",completed:"border-primary-400 bg-primary-400 text-white"}},defaultVariants:{status:"default"}}),oS=Se("absolute",{variants:{status:{default:"bg-muted",current:"bg-muted",completed:"bg-primary-400"},orientation:{horizontal:"left-[calc(50%_+_1.5rem)] top-4 h-1 w-[calc(100%_-_1.5rem)]",vertical:"left-4 top-[calc(100%_-_0.125rem)] h-[calc(100%_-_0.25rem)] w-1"}},defaultVariants:{status:"default",orientation:"horizontal"}}),aS=Se("flex flex-col gap-8",{variants:{orientation:{horizontal:"",vertical:""}}}),sS=Se("flex gap-1",{variants:{orientation:{horizontal:"flex-row",vertical:"flex-col"}},defaultVariants:{orientation:"horizontal"}}),iS=Se("relative",{variants:{status:{default:"bg-muted",current:"bg-primary-400",completed:"bg-primary-500"},orientation:{horizontal:"h-2 max-h-2 min-h-2 flex-1",vertical:"w-2 min-w-2 max-w-2 flex-1"}},defaultVariants:{status:"default",orientation:"horizontal"}}),cS=Se("text-base font-medium leading-tight",{variants:{status:{default:"text-muted-foreground",completed:"text-foreground",current:"font-bold text-primary-400"}},defaultVariants:{status:"default"}}),lS=Se("mt-0.5 text-sm text-muted-foreground",{variants:{status:{default:"",completed:"text-foreground",current:"font-medium text-primary-400"}},defaultVariants:{status:"default"}});function Gd({className:e,description:t,label:n,status:r}){return f.jsxs("div",{className:e,children:[f.jsx("span",{className:k(cS({status:r})),children:n}),t?f.jsx("span",{className:k(lS({status:r})),children:t}):null]})}function Ud(e,t){return t?"completed":e?"current":"default"}function zd(e){return e==="completed"?" completed":e==="current"?"":" not completed"}function uS({currentStep:e,currentStepIndex:t,orientation:n,showCurrentAsCompleted:r,steps:o}){return f.jsx("ol",{"aria-label":"Steps",className:k(nS({orientation:n})),children:o.map((a,i)=>{const s=a.id===e,c=t!==-1&&(i<t||r&&s),u=Ud(s,c);return f.jsxs("li",{className:k("relative flex items-start",n==="horizontal"&&"flex-1 justify-center"),...s&&{"aria-current":"step"},children:[f.jsxs("span",{className:"sr-only",children:[a.label,zd(u)]}),f.jsxs("div",{className:k("relative flex",n==="vertical"?"flex-row items-start":"flex-col items-center"),children:[f.jsx("div",{className:k(rS({status:u})),children:u==="completed"?f.jsx(Ot,{className:"h-4 w-4",strokeWidth:3}):f.jsx("span",{children:(i+1).toString()})}),f.jsx(Gd,{className:k("flex flex-col",n==="vertical"?"ml-4":"mt-2 text-center"),description:a.description,label:a.label,status:u})]}),i<o.length-1?f.jsx("div",{className:k(oS({orientation:n,status:u}))}):null]},a.id)})})}function dS({currentStepLabel:e,currentStepNumber:t,headingLevel:n="h4",totalSteps:r}){const o=n;return f.jsxs(o,{className:"flex items-center gap-3 text-xl",children:[f.jsxs("span",{className:"inline-flex items-center gap-1",children:[f.jsx("span",{className:"sr-only",children:"Step"}),f.jsx("span",{className:`mr-0.5 inline-flex h-9 w-9 items-center justify-center rounded-full
189
- bg-primary-400 text-white`,children:t}),f.jsx("span",{className:"text-primary-400",children:"of"}),f.jsx("span",{className:"text-primary-400",children:r})]}),f.jsx("span",{className:"font-bold",children:e})]})}function fS({currentStep:e,currentStepIndex:t,showCurrentAsCompleted:n,steps:r}){return f.jsx("ol",{"aria-label":"Steps",className:k(sS({orientation:"horizontal"})),children:r.map((o,a)=>{const i=o.id===e,s=t!==-1&&(a<t||n&&i),c=Ud(i,s);return f.jsxs("li",{className:"flex flex-1 flex-col",...i&&{"aria-current":"step"},children:[f.jsx("div",{className:k(iS({status:c,orientation:"horizontal"})),children:f.jsxs("span",{className:"sr-only",children:[o.label,zd(c)]})}),f.jsx(Gd,{className:"mt-2 flex flex-col",description:o.description,label:o.label,status:c})]},o.id)})})}function mS({className:e,currentStep:t,headingLevel:n="h4",showCurrentAsCompleted:r=!1,variant:o="default",steps:a,...i},s){const c=a.findIndex(p=>p.id===t),u=a[c],d=c+1,m=a.length;return f.jsxs("section",{ref:s,"aria-label":"Step indicator",className:k(aS({orientation:"horizontal"}),e),...i,children:[o==="counter"?f.jsx(uS,{currentStep:t,currentStepIndex:c,orientation:"horizontal",showCurrentAsCompleted:r,steps:a}):f.jsx(fS,{currentStep:t,currentStepIndex:c,showCurrentAsCompleted:r,steps:a}),f.jsx(dS,{currentStepLabel:u==null?void 0:u.label,currentStepNumber:d,headingLevel:n,totalSteps:m})]})}const Kd=l.forwardRef(mS);Kd.displayName="StepIndicator";const pS=Kd;var Br="Switch",[hS,tE]=ve(Br),[gS,vS]=hS(Br),qd=l.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:a,required:i,disabled:s,value:c="on",onCheckedChange:u,form:d,...m}=e,[p,h]=l.useState(null),y=z(t,w=>h(w)),g=l.useRef(!1),v=p?d||!!p.closest("form"):!0,[b,x]=Ce({prop:o,defaultProp:a??!1,onChange:u,caller:Br});return f.jsxs(gS,{scope:n,checked:b,disabled:s,children:[f.jsx(V.button,{type:"button",role:"switch","aria-checked":b,"aria-required":i,"data-state":Jd(b),"data-disabled":s?"":void 0,disabled:s,value:c,...m,ref:y,onClick:O(e.onClick,w=>{x(S=>!S),v&&(g.current=w.isPropagationStopped(),g.current||w.stopPropagation())})}),v&&f.jsx(Qd,{control:p,bubbles:!g.current,name:r,value:c,checked:b,required:i,disabled:s,form:d,style:{transform:"translateX(-100%)"}})]})});qd.displayName=Br;var Xd="SwitchThumb",Zd=l.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=vS(Xd,n);return f.jsx(V.span,{"data-state":Jd(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});Zd.displayName=Xd;var yS="SwitchBubbleInput",Qd=l.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...o},a)=>{const i=l.useRef(null),s=z(i,a),c=Ir(n),u=Dn(t);return l.useEffect(()=>{const d=i.current;if(!d)return;const m=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==n&&h){const y=new Event("click",{bubbles:r});h.call(d,n),d.dispatchEvent(y)}},[c,n,r]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:s,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Qd.displayName=yS;function Jd(e){return e?"checked":"unchecked"}var ef=qd,bS=Zd;const La=l.forwardRef(({className:e,label:t,id:n,"aria-label":r,isChecked:o=!1,isDisabled:a=!1,...i},s)=>{const c=De({isDisabled:a});if(!t&&!r)throw new Error("Switch must have either a label prop or an aria-label attribute");if(t&&r)throw new Error("Switch must have either a label prop or an aria-label attribute, but not both");return f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(ef,{"aria-label":r,checked:o,className:k(ie.focusRingVisible,`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2
188
+ font-bold`,{variants:{status:{default:"border-muted text-muted-foreground",current:"border-primary-400 text-primary-400",completed:"border-primary-400 bg-primary-400 text-white"}},defaultVariants:{status:"default"}}),oS=Se("absolute",{variants:{status:{default:"bg-muted",current:"bg-muted",completed:"bg-primary-400"},orientation:{horizontal:"left-[calc(50%_+_1.5rem)] top-4 h-1 w-[calc(100%_-_1.5rem)]",vertical:"left-4 top-[calc(100%_-_0.125rem)] h-[calc(100%_-_0.25rem)] w-1"}},defaultVariants:{status:"default",orientation:"horizontal"}}),aS=Se("flex flex-col gap-8",{variants:{orientation:{horizontal:"",vertical:""}}}),sS=Se("mb-0 mt-0 flex gap-1 pl-0",{variants:{orientation:{horizontal:"flex-row",vertical:"flex-col"}},defaultVariants:{orientation:"horizontal"}}),iS=Se("relative",{variants:{status:{default:"bg-muted",current:"bg-primary-400",completed:"bg-primary-500"},orientation:{horizontal:"h-2 max-h-2 min-h-2 flex-1",vertical:"w-2 min-w-2 max-w-2 flex-1"}},defaultVariants:{status:"default",orientation:"horizontal"}}),cS=Se("text-base font-medium leading-tight",{variants:{status:{default:"text-muted-foreground",completed:"text-foreground",current:"font-bold text-primary-400"}},defaultVariants:{status:"default"}}),lS=Se("mt-0.5 text-sm text-muted-foreground",{variants:{status:{default:"",completed:"text-foreground",current:"font-medium text-primary-400"}},defaultVariants:{status:"default"}});function Gd({className:e,description:t,label:n,status:r}){return f.jsxs("div",{className:e,children:[f.jsx("span",{className:k(cS({status:r})),children:n}),t?f.jsx("span",{className:k(lS({status:r})),children:t}):null]})}function Ud(e,t){return t?"completed":e?"current":"default"}function zd(e){return e==="completed"?" completed":e==="current"?"":" not completed"}function uS({currentStep:e,currentStepIndex:t,orientation:n,showCurrentAsCompleted:r,showLabels:o,steps:a}){return f.jsx("ol",{"aria-label":"Steps",className:k(nS({orientation:n})),children:a.map((i,s)=>{const c=i.id===e,u=t!==-1&&(s<t||r&&c),d=Ud(c,u);return f.jsxs("li",{className:k("relative flex items-start",n==="horizontal"&&"flex-1 justify-center"),...c&&{"aria-current":"step"},children:[f.jsxs("span",{className:"sr-only",children:[i.label,zd(d)]}),f.jsxs("div",{className:k("relative flex",n==="vertical"?"flex-row items-start":"flex-col items-center"),children:[f.jsx("div",{className:k(rS({status:d})),children:d==="completed"?f.jsx(Ot,{className:"h-4 w-4",strokeWidth:3}):f.jsx("span",{children:(s+1).toString()})}),o?f.jsx(Gd,{className:k("flex flex-col",n==="vertical"?"ml-4":"mt-2 text-center"),description:i.description,label:i.label,status:d}):null]}),s<a.length-1?f.jsx("div",{className:k(oS({orientation:n,status:d}))}):null]},i.id)})})}function dS({currentStepLabel:e,currentStepNumber:t,headingLevel:n="h4",totalSteps:r}){const o=n;return f.jsxs(o,{className:"mb-0 mt-0 flex items-center gap-3 text-xl",children:[f.jsxs("span",{className:"inline-flex items-center gap-1",children:[f.jsx("span",{className:"sr-only",children:"Step"}),f.jsx("span",{className:`mr-0.5 inline-flex h-9 w-9 items-center justify-center rounded-full
189
+ bg-primary-400 text-white`,children:t}),f.jsx("span",{className:"text-primary-400",children:"of"}),f.jsx("span",{className:"text-primary-400",children:r})]}),f.jsx("span",{className:"font-bold",children:e})]})}function fS({currentStep:e,currentStepIndex:t,showCurrentAsCompleted:n,showLabels:r,steps:o}){return f.jsx("ol",{"aria-label":"Steps",className:k(sS({orientation:"horizontal"})),children:o.map((a,i)=>{const s=a.id===e,c=t!==-1&&(i<t||n&&s),u=Ud(s,c);return f.jsxs("li",{className:"flex flex-1 flex-col",...s&&{"aria-current":"step"},children:[f.jsx("div",{className:k(iS({status:u,orientation:"horizontal"})),children:f.jsxs("span",{className:"sr-only",children:[a.label,zd(u)]})}),r?f.jsx(Gd,{className:"mt-2 flex flex-col",description:a.description,label:a.label,status:u}):null]},a.id)})})}function mS({className:e,currentStep:t,headingLevel:n="h4",showCurrentAsCompleted:r=!1,showLabels:o=!0,variant:a="default",steps:i,...s},c){const u=i.findIndex(h=>h.id===t),d=i[u],m=u+1,p=i.length;return f.jsxs("section",{ref:c,"aria-label":"Step indicator",className:k(aS({orientation:"horizontal"}),e),...s,children:[a==="counter"?f.jsx(uS,{currentStep:t,currentStepIndex:u,orientation:"horizontal",showCurrentAsCompleted:r,showLabels:o,steps:i}):f.jsx(fS,{currentStep:t,currentStepIndex:u,showCurrentAsCompleted:r,showLabels:o,steps:i}),f.jsx(dS,{currentStepLabel:d==null?void 0:d.label,currentStepNumber:m,headingLevel:n,totalSteps:p})]})}const Kd=l.forwardRef(mS);Kd.displayName="StepIndicator";const pS=Kd;var Br="Switch",[hS,tE]=ve(Br),[gS,vS]=hS(Br),qd=l.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:a,required:i,disabled:s,value:c="on",onCheckedChange:u,form:d,...m}=e,[p,h]=l.useState(null),y=z(t,w=>h(w)),g=l.useRef(!1),v=p?d||!!p.closest("form"):!0,[b,x]=Ce({prop:o,defaultProp:a??!1,onChange:u,caller:Br});return f.jsxs(gS,{scope:n,checked:b,disabled:s,children:[f.jsx(V.button,{type:"button",role:"switch","aria-checked":b,"aria-required":i,"data-state":Jd(b),"data-disabled":s?"":void 0,disabled:s,value:c,...m,ref:y,onClick:O(e.onClick,w=>{x(S=>!S),v&&(g.current=w.isPropagationStopped(),g.current||w.stopPropagation())})}),v&&f.jsx(Qd,{control:p,bubbles:!g.current,name:r,value:c,checked:b,required:i,disabled:s,form:d,style:{transform:"translateX(-100%)"}})]})});qd.displayName=Br;var Xd="SwitchThumb",Zd=l.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=vS(Xd,n);return f.jsx(V.span,{"data-state":Jd(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});Zd.displayName=Xd;var yS="SwitchBubbleInput",Qd=l.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...o},a)=>{const i=l.useRef(null),s=z(i,a),c=Ir(n),u=Dn(t);return l.useEffect(()=>{const d=i.current;if(!d)return;const m=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==n&&h){const y=new Event("click",{bubbles:r});h.call(d,n),d.dispatchEvent(y)}},[c,n,r]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:s,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Qd.displayName=yS;function Jd(e){return e?"checked":"unchecked"}var ef=qd,bS=Zd;const La=l.forwardRef(({className:e,label:t,id:n,"aria-label":r,isChecked:o=!1,isDisabled:a=!1,...i},s)=>{const c=De({isDisabled:a});if(!t&&!r)throw new Error("Switch must have either a label prop or an aria-label attribute");if(t&&r)throw new Error("Switch must have either a label prop or an aria-label attribute, but not both");return f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(ef,{"aria-label":r,checked:o,className:k(ie.focusRingVisible,`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2
190
190
  border-transparent transition-colors disabled:cursor-not-allowed disabled:opacity-50
191
191
  data-[state=checked]:bg-primary-400 data-[state=unchecked]:bg-muted`,e),...i,...c,ref:s,id:n,children:f.jsx(bS,{className:k(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0
192
192
  transition-transform data-[state=checked]:translate-x-5