PageSourceSearch

https://splashiq.ai/assets/checkbox-G3X53UcF.js

js splashiq.ai collected 2026-10-05 12:43:00 UTC 3,812 bytes, 1 lines download raw bytes

vendor: 3,812 bytes, line 1
1import{r as d,j as n,aV as H,aW as _,aX as X,aY as S,aZ as N,a_ as z,a$ as G,b0 as K,f as U,c as w}from"./index-CzAkNt2W.js";var y="Checkbox",[$]=K(y),[V,I]=$(y);function W(t){const{__scopeCheckbox:s,checked:r,children:l,defaultChecked:a,disabled:e,form:f,name:h,onCheckedChange:i,required:k,value:C="on",internal_do_not_use_render:u}=t,[p,v]=X({prop:r,defaultProp:a??!1,onChange:i,caller:y}),[m,x]=d.useState(null),[g,o]=d.useState(null),c=d.useRef(!1),E=m?!!f||!!m.closest("form"):!0,R={checked:p,disabled:e,setChecked:v,control:m,setControl:x,name:h,form:f,value:C,hasConsumerStoppedPropagationRef:c,required:k,defaultChecked:b(a)?!1:a,isFormControl:E,bubbleInput:g,setBubbleInput:o};return n.jsx(V,{scope:s,...R,children:Y(u)?u(R):l})}var B="CheckboxTrigger",M=d.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:r,...l},a)=>{const{control:e,value:f,disabled:h,checked:i,required:k,setControl:C,setChecked:u,hasConsumerStoppedPropagationRef:p,isFormControl:v,bubbleInput:m}=I(B,t),x=S(a,C),g=d.useRef(i);return d.useEffect(()=>{const o=e?.form;if(o){const c=()=>u(g.current);return o.addEventListener("reset",c),()=>o.removeEventListener("reset",c)}},[e,u]),n.jsx(_.button,{type:"button",role:"checkbox","aria-checked":b(i)?"mixed":i,"aria-required":k,"data-state":F(i),"data-disabled":h?"":void 0,disabled:h,value:f,...l,ref:x,onKeyDown:N(s,o=>{o.key==="Enter"&&o.preventDefault()}),onClick:N(r,o=>{u(c=>b(c)?!0:!c),m&&v&&(p.current=o.isPropagationStopped(),p.current||o.stopPropagation())})})});M.displayName=B;var P=d.forwardRef((t,s)=>{const{__scopeCheckbox:r,name:l,checked:a,defaultChecked:e,required:f,disabled:h,value:i,onCheckedChange:k,form:C,...u}=t;return n.jsx(W,{__scopeCheckbox:r,checked:a,defaultChecked:e,disabled:h,required:f,onCheckedChange:k,name:l,form:C,value:i,internal_do_not_use_render:({isFormControl:p})=>n.jsxs(n.Fragment,{children:[n.jsx(M,{...u,ref:s,__scopeCheckbox:r}),p&&n.jsx(D,{__scopeCheckbox:r})]})})});P.displayName=y;var T="CheckboxIndicator",q=d.forwardRef((t,s)=>{const{__scopeCheckbox:r,forceMount:l,...a}=t,e=I(T,r);return n.jsx(H,{present:l||b(e.checked)||e.checked===!0,children:n.jsx(_.span,{"data-state":F(e.checked),"data-disabled":e.disabled?"":void 0,...a,ref:s,style:{pointerEvents:"none",...t.style}})})});q.displayName=T;var A="CheckboxBubbleInput",D=d.forwardRef(({__scopeCheckbox:t,...s},r)=>{const{control:l,hasConsumerStoppedPropagationRef:a,checked:e,defaultChecked:f,required:h,disabled:i,name:k,value:C,form:u,bubbleInput:p,setBubbleInput:v}=I(A,t),m=S(r,v),x=z(e),g=G(l);d.useEffect(()=>{const c=p;if(!c)return;const E=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(E,"checked").set,L=!a.current;if(x!==e&&j){const O=new Event("click",{bubbles:L});c.indeterminate=b(e),j.call(c,b(e)?!1:e),c.dispatchEvent(O)}},[p,x,e,a]);const o=d.useRef(b(e)?!1:e);return n.jsx(_.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??o.current,required:h,disabled:i,name:k,value:C,form:u,...s,tabIndex:-1,ref:m,style:{...s.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});D.displayName=A;function Y(t){return typeof t=="function"}function b(t){return t==="indeterminate"}function F(t){return b(t)?"indeterminate":t?"checked":"unchecked"}const Z=d.forwardRef(({className:t,...s},r)=>n.jsx(P,{ref:r,className:w("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...s,children:n.jsx(q,{className:w("grid place-content-center text-current"),children:n.jsx(U,{className:"h-4 w-4"})})}));Z.displayName=P.displayName;export{Z as C};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.