PageSourceSearch

https://maherelgamil.com/build/assets/checkbox-DzOTPunw.js

js maherelgamil.com collected 2026-10-04 19:32:29 UTC 7,098 bytes, 1 lines download raw bytes

1import{r as i,j as p,c as H}from"./react-vendor-DzmMvBDS.js";import{g as L,i as V,k as I,n as j,y as q,z,c as W}from"./app-kRJUN747.js";import G from"./check-fvNBoAnc.js";import{u as K}from"./index-V9iUX1tE.js";function U(t,e=[]){let o=[];function s(n,c){const a=i.createContext(c),l=o.length;o=[...o,c];const d=u=>{const{scope:f,children:C,...m}=u,k=f?.[t]?.[l]||a,y=i.useMemo(()=>m,Object.values(m));return p.jsx(k.Provider,{value:y,children:C})};d.displayName=n+"Provider";function b(u,f){const C=f?.[t]?.[l]||a,m=i.useContext(C);if(m)return m;if(c!==void 0)return c;throw new Error(`\`${u}\` must be used within \`${n}\``)}return[d,b]}const r=()=>{const n=o.map(c=>i.createContext(c));return function(a){const l=a?.[t]||n;return i.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return r.scopeName=t,[s,X(r,...e)]}function X(...t){const e=t[0];if(t.length===1)return e;const o=()=>{const s=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(n){const c=s.reduce((a,{useScope:l,scopeName:d})=>{const u=l(n)[`__scope${d}`];return{...a,...u}},{});return i.useMemo(()=>({[`__scope${e.scopeName}`]:c}),[c])}};return o.scopeName=e.scopeName,o}function Z(t){const e=J(t),o=i.forwardRef((s,r)=>{const{children:n,...c}=s,a=i.Children.toArray(n),l=a.find(Y);if(l){const d=l.props.children,b=a.map(u=>u===l?i.Children.count(d)>1?i.Children.only(null):i.isValidElement(d)?d.props.children:null:u);return p.jsx(e,{...c,ref:r,children:i.isValidElement(d)?i.cloneElement(d,void 0,b):null})}return p.jsx(e,{...c,ref:r,children:n})});return o.displayName=`${t}.Slot`,o}function J(t){const e=i.forwardRef((o,s)=>{const{children:r,...n}=o;if(i.isValidElement(r)){const c=te(r),a=ee(n,r.props);return r.type!==i.Fragment&&(a.ref=s?L(s,c):c),i.cloneElement(r,a)}return i.Children.count(r)>1?i.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Q=Symbol("radix.slottable");function Y(t){return i.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Q}function ee(t,e){const o={...e};for(const s in e){const r=t[s],n=e[s];/^on[A-Z]/.test(s)?r&&n?o[s]=(...a)=>{const l=n(...a);return r(...a),l}:r&&(o[s]=r):s==="style"?o[s]={...r,...n}:s==="className"&&(o[s]=[r,n].filter(Boolean).join(" "))}return{...t,...o}}function te(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=e&&"isReactWarning"in e&&e.isReactWarning;return o?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=e&&"isReactWarning"in e&&e.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var re=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_=re.reduce((t,e)=>{const o=Z(`Primitive.${e}`),s=i.forwardRef((r,n)=>{const{asChild:c,...a}=r,l=c?o:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...a,ref:n})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{}),g="Checkbox",[ne]=U(g),[oe,P]=ne(g);function se(t){const{__scopeCheckbox:e,checked:o,children:s,defaultChecked:r,disabled:n,form:c,name:a,onCheckedChange:l,required:d,value:b="on",internal_do_not_use_render:u}=t,[f,C]=V({prop:o,defaultProp:r??!1,onChange:l,caller:g}),[m,k]=i.useState(null),[y,h]=i.useState(null),x=i.useRef(!1),E=m?!!c||!!m.closest("form"):!0,S={checked:f,disabled:n,setChecked:C,control:m,setControl:k,name:a,form:c,value:b,hasConsumerStoppedPropagationRef:x,required:d,defaultChecked:v(r)?!1:r,isFormControl:E,bubbleInput:y,setBubbleInput:h};return p.jsx(oe,{scope:e,...S,children:ce(u)?u(S):s})}var w="CheckboxTrigger",N=i.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:o,...s},r)=>{const{control:n,value:c,disabled:a,checked:l,required:d,setControl:b,setChecked:u,hasConsumerStoppedPropagationRef:f,isFormControl:C,bubbleInput:m}=P(w,t),k=I(r,b),y=i.useRef(l);return i.useEffect(()=>{const h=n?.form;if(h){const x=()=>u(y.current);return h.addEventListener("reset",x),()=>h.removeEventListener("reset",x)}},[n,u]),p.jsx(_.button,{type:"button",role:"checkbox","aria-checked":v(l)?"mixed":l,"aria-required":d,"data-state":T(l),"data-disabled":a?"":void 0,disabled:a,value:c,...s,ref:k,onKeyDown:j(e,h=>{h.key==="Enter"&&h.preventDefault()}),onClick:j(o,h=>{u(x=>v(x)?!0:!x),m&&C&&(f.current=h.isPropagationStopped(),f.current||h.stopPropagation())})})});N.displayName=w;var B=i.forwardRef((t,e)=>{const{__scopeCheckbox:o,name:s,checked:r,defaultChecked:n,required:c,disabled:a,value:l,onCheckedChange:d,form:b,...u}=t;return p.jsx(se,{__scopeCheckbox:o,checked:r,defaultChecked:n,disabled:a,required:c,onCheckedChange:d,name:s,form:b,value:l,internal_do_not_use_render:({isFormControl:f})=>p.jsxs(p.Fragment,{children:[p.jsx(N,{...u,ref:e,__scopeCheckbox:o}),f&&p.jsx(M,{__scopeCheckbox:o})]})})});B.displayName=g;var O="CheckboxIndicator",$=i.forwardRef((t,e)=>{const{__scopeCheckbox:o,forceMount:s,...r}=t,n=P(O,o);return p.jsx(z,{present:s||v(n.checked)||n.checked===!0,children:p.jsx(_.span,{"data-state":T(n.checked),"data-disabled":n.disabled?"":void 0,...r,ref:e,style:{pointerEvents:"none",...t.style}})})});$.displayName=O;var A="CheckboxBubbleInput",M=i.forwardRef(({__scopeCheckbox:t,...e},o)=>{const{control:s,hasConsumerStoppedPropagationRef:r,checked:n,defaultChecked:c,required:a,disabled:l,name:d,value:b,form:u,bubbleInput:f,setBubbleInput:C}=P(A,t),m=I(o,C),k=K(n),y=q(s);i.useEffect(()=>{const x=f;if(!x)return;const E=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(E,"checked").set,D=!r.current;if(k!==n&&R){const F=new Event("click",{bubbles:D});x.indeterminate=v(n),R.call(x,v(n)?!1:n),x.dispatchEvent(F)}},[f,k,n,r]);const h=i.useRef(v(n)?!1:n);return p.jsx(_.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??h.current,required:a,disabled:l,name:d,value:b,form:u,...e,tabIndex:-1,ref:m,style:{...e.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});M.displayName=A;function ce(t){return typeof t=="function"}function v(t){return t==="indeterminate"}function T(t){return v(t)?"indeterminate":t?"checked":"unchecked"}function de(t){const e=H.c(9);let o,s;e[0]!==t?({className:o,...s}=t,e[0]=t,e[1]=o,e[2]=s):(o=e[1],s=e[2]);let r;e[3]!==o?(r=W("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground",o),e[3]=o,e[4]=r):r=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=p.jsx($,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:p.jsx(G,{})}),e[5]=n):n=e[5];let c;return e[6]!==s||e[7]!==r?(c=p.jsx(B,{"data-slot":"checkbox",className:r,...s,children:n}),e[6]=s,e[7]=r,e[8]=c):c=e[8],c}export{de 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.