vendor: 4,030 bytes, line 1
1import{r as i,j as n}from"./index-C9LiJY1Y.js";import{u as S}from"./index-D0sHjcRD.js";import{u as H,c as N,a as z}from"./index-CCXtPiyo.js";import{u as G,a as K}from"./index-A1gEuipq.js";import{P as U}from"./index-C4RDP6HU.js";import{P}from"./index-C6UOAwmR.js";import{c as w}from"./utils-BQHNewu7.js";import{C as X}from"./check-BpIhD7gM.js";var y="Checkbox",[$]=z(y),[J,_]=$(y);function Q(t){const{__scopeCheckbox:s,checked:r,children:l,defaultChecked:c,disabled:e,form:f,name:h,onCheckedChange:d,required:m,value:k="on",internal_do_not_use_render:u}=t,[p,v]=H({prop:r,defaultProp:c??!1,onChange:d,caller:y}),[C,x]=i.useState(null),[g,o]=i.useState(null),a=i.useRef(!1),E=C?!!f||!!C.closest("form"):!0,R={checked:p,disabled:e,setChecked:v,control:C,setControl:x,name:h,form:f,value:k,hasConsumerStoppedPropagationRef:a,required:m,defaultChecked:b(c)?!1:c,isFormControl:E,bubbleInput:g,setBubbleInput:o};return n.jsx(J,{scope:s,...R,children:V(u)?u(R):l})}var B="CheckboxTrigger",M=i.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:r,...l},c)=>{const{control:e,value:f,disabled:h,checked:d,required:m,setControl:k,setChecked:u,hasConsumerStoppedPropagationRef:p,isFormControl:v,bubbleInput:C}=_(B,t),x=S(c,k),g=i.useRef(d);return i.useEffect(()=>{const o=e?.form;if(o){const a=()=>u(g.current);return o.addEventListener("reset",a),()=>o.removeEventListener("reset",a)}},[e,u]),n.jsx(P.button,{type:"button",role:"checkbox","aria-checked":b(d)?"mixed":d,"aria-required":m,"data-state":F(d),"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(a=>b(a)?!0:!a),C&&v&&(p.current=o.isPropagationStopped(),p.current||o.stopPropagation())})})});M.displayName=B;var I=i.forwardRef((t,s)=>{const{__scopeCheckbox:r,name:l,checked:c,defaultChecked:e,required:f,disabled:h,value:d,onCheckedChange:m,form:k,...u}=t;return n.jsx(Q,{__scopeCheckbox:r,checked:c,defaultChecked:e,disabled:h,required:f,onCheckedChange:m,name:l,form:k,value:d,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})]})})});I.displayName=y;var T="CheckboxIndicator",q=i.forwardRef((t,s)=>{const{__scopeCheckbox:r,forceMount:l,...c}=t,e=_(T,r);return n.jsx(U,{present:l||b(e.checked)||e.checked===!0,children:n.jsx(P.span,{"data-state":F(e.checked),"data-disabled":e.disabled?"":void 0,...c,ref:s,style:{pointerEvents:"none",...t.style}})})});q.displayName=T;var A="CheckboxBubbleInput",D=i.forwardRef(({__scopeCheckbox:t,...s},r)=>{const{control:l,hasConsumerStoppedPropagationRef:c,checked:e,defaultChecked:f,required:h,disabled:d,name:m,value:k,form:u,bubbleInput:p,setBubbleInput:v}=_(A,t),C=S(r,v),x=G(e),g=K(l);i.useEffect(()=>{const a=p;if(!a)return;const E=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(E,"checked").set,L=!c.current;if(x!==e&&j){const O=new Event("click",{bubbles:L});a.indeterminate=b(e),j.call(a,b(e)?!1:e),a.dispatchEvent(O)}},[p,x,e,c]);const o=i.useRef(b(e)?!1:e);return n.jsx(P.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??o.current,required:h,disabled:d,name:m,value:k,form:u,...s,tabIndex:-1,ref:C,style:{...s.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});D.displayName=A;function V(t){return typeof t=="function"}function b(t){return t==="indeterminate"}function F(t){return b(t)?"indeterminate":t?"checked":"unchecked"}const W=i.forwardRef(({className:t,...s},r)=>n.jsx(I,{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(X,{className:"h-4 w-4"})})}));W.displayName=I.displayName;export{W 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.