PageSourceSearch

https://saasrock.fly.dev/assets/InputCheckbox-5Ug2MnJE.js

js saasrock.fly.dev collected 2026-10-03 08:27:26 UTC 4,565 bytes, 1 lines download raw bytes

1import{r,R as h,j as e}from"./chunk-EPOLDU6W-CffQmu0Y.js";import{c as y}from"./clsx-B-dksMZM.js";import{E as O}from"./EntityIcon-C6zAMq3P.js";import{H as Q}from"./HintTooltip-CIUqaBvE.js";import{C as ee}from"./checkbox-BA4wZy06.js";import{$ as te,a as re}from"./useFocusRing-BxugBIFH.js";import{w as se,e as ae}from"./use-resolve-button-type-BVC0qs4o.js";import{l as oe,b as le,j as ne,g as ie}from"./form-fields-CY9MzSJv.js";import{Y as ce,K as P,m as ue,y as de,p as fe,b as C,c as me,V as pe,d as F}from"./keyboard-CUKk1vEI.js";import{M as he,H as xe,a as be,w as ve}from"./description-NPejS93j.js";import{Z as ge,V as we,u as ke,N as ye}from"./label-kwgGvMEU.js";import{s as $e}from"./bugs-D5tECy-l.js";let N=r.createContext(null);N.displayName="GroupContext";let je=r.Fragment;function Ce(a){var u;let[o,n]=r.useState(null),[f,m]=we(),[x,s]=xe(),p=r.useMemo(()=>({switch:o,setSwitch:n}),[o,n]),c={},b=a,d=P();return h.createElement(s,{name:"Switch.Description",value:x},h.createElement(m,{name:"Switch.Label",value:f,props:{htmlFor:(u=p.switch)==null?void 0:u.id,onClick(i){o&&(ue(i.currentTarget)&&i.preventDefault(),o.click(),o.focus({preventScroll:!0}))}}},h.createElement(N.Provider,{value:p},d({ourProps:c,theirProps:b,slot:{},defaultTag:je,name:"Switch.Group"}))))}let Ne="button";function Ee(a,u){var o;let n=r.useId(),f=ke(),m=be(),{id:x=f||`headlessui-switch-${n}`,disabled:s=m||!1,checked:p,defaultChecked:c,onChange:b,name:d,value:i,form:$,autoFocus:t=!1,...v}=a,g=r.useContext(N),[D,I]=r.useState(null),T=r.useRef(null),R=de(T,u,g===null?null:g.setSwitch,I),w=oe(c),[j,k]=le(p,b,w??!1),V=fe(),[G,E]=r.useState(!1),S=C(()=>{E(!0),k?.(!j),V.nextFrame(()=>{E(!1)})}),H=C(l=>{if($e(l.currentTarget))return l.preventDefault();l.preventDefault(),S()}),K=C(l=>{l.key===F.Space?(l.preventDefault(),S()):l.key===F.Enter&&ie(l.currentTarget)}),L=C(l=>l.preventDefault()),A=ye(),M=ve(),{isFocusVisible:U,focusProps:q}=te({autoFocus:t}),{isHovered:B,hoverProps:J}=re({isDisabled:s}),{pressed:W,pressProps:X}=se({disabled:s}),Y=me({checked:j,disabled:s,hover:B,focus:U,active:W,autofocus:t,changing:G}),Z=pe({id:x,ref:R,role:"switch",type:ae(a,D),tabIndex:a.tabIndex===-1?0:(o=a.tabIndex)!=null?o:0,"aria-checked":j,"aria-labelledby":A,"aria-describedby":M,disabled:s||void 0,autoFocus:t,onClick:H,onKeyUp:K,onKeyPress:L},q,J,X),_=r.useCallback(()=>{if(w!==void 0)return k?.(w)},[k,w]),z=P();return h.createElement(h.Fragment,null,d!=null&&h.createElement(ne,{disabled:s,data:{[d]:i||"on"},overrides:{type:"checkbox",checked:j},form:$,onReset:_}),z({ourProps:Z,theirProps:v,slot:Y,defaultTag:Ne,name:"Switch"}))}let Se=ce(Ee),Fe=Ce,Pe=ge,De=he,Ie=Object.assign(Se,{Group:Fe,Label:Pe,Description:De});function Je({name:a,title:u,withLabel:o=!0,value:n,setValue:f,className:m,required:x,disabled:s,asToggle:p,readOnly:c,hint:b,help:d,icon:i,autoFocus:$}){const[t,v]=r.useState(n??!1);return r.useEffect(()=>{v(n??!1)},[n]),r.useEffect(()=>{f&&t!==n&&f(t)},[t]),e.jsxs("div",{className:y(m,""),children:[o&&u&&e.jsxs("label",{htmlFor:a,className:"mb-1 flex justify-between space-x-2 text-xs font-medium",children:[e.jsxs("div",{className:" flex items-center space-x-1",children:[e.jsxs("div",{className:"truncate",children:[u,x&&e.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),e.jsx("div",{className:"",children:d&&e.jsx(Q,{text:d})})]}),b]}),e.jsxs("div",{className:y("relative flex w-full rounded-md"),children:[i&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3",children:e.jsx(O,{className:"text-muted-foreground h-5 w-5",icon:i})}),e.jsx("input",{type:"hidden",name:a,value:t===!0?"true":"false",hidden:!0,readOnly:!0}),p?e.jsx(Ie,{checked:t,onChange:v,disabled:s||c,autoFocus:$,className:y(t?"bg-primary":" bg-secondary ","focus:ring-primary relative inline-flex h-5 w-8 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-hidden focus:ring-2 focus:ring-offset-2",i&&"pl-10",(s||c)&&"cursor-not-allowed opacity-60"),children:e.jsx("span",{"aria-hidden":"true",className:y(t?"translate-x-3":"translate-x-0","bg-background pointer-events-none inline-block h-4 w-4 transform rounded-full shadow-xs ring-0 transition duration-200 ease-in-out")})}):e.jsx(ee,{id:a,name:a,onCheckedChange:g=>v(g==="indeterminate"?t:g),disabled:s||c,autoFocus:$,checked:t,className:y((s||c)&&"bg-secondary/90 curs
1or-not-allowed"," text-primary focus:ring-primary border-border mt-1 h-6 w-6 cursor-pointer rounded",m,i&&"pl-10")})]})]})}export{Je as I};

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.