Files
aiops/backend/static/assets/switch-8l7ThrsD.js
T
Logan.Li 921b44d6a4 chore: 同步 embed 静态资源(base=/ 修复深链白屏)
二进制 / K8s embed 模式 go:embed 使用 backend/static
2026-06-26 11:04:50 +08:00

2 lines
2.6 KiB
JavaScript

import{r as s,ad as C,ac as T,j as o,a9 as I,ab as y,ae as M,af as H,$ as g}from"./index-BTQygws6.js";import{u as z}from"./index-WFeZT6kc.js";var b="Switch",[A]=I(b),[U,q]=A(b),P=s.forwardRef((e,a)=>{const{__scopeSwitch:t,name:n,checked:r,defaultChecked:m,required:d,disabled:c,value:u="on",onCheckedChange:w,form:i,...k}=e,[l,p]=s.useState(null),v=C(a,f=>p(f)),x=s.useRef(!1),S=l?i||!!l.closest("form"):!0,[h,N]=T({prop:r,defaultProp:m??!1,onChange:w,caller:b});return o.jsxs(U,{scope:t,checked:h,disabled:c,children:[o.jsx(y.button,{type:"button",role:"switch","aria-checked":h,"aria-required":d,"data-state":_(h),"data-disabled":c?"":void 0,disabled:c,value:u,...k,ref:v,onClick:M(e.onClick,f=>{N(B=>!B),S&&(x.current=f.isPropagationStopped(),x.current||f.stopPropagation())})}),S&&o.jsx(j,{control:l,bubbles:!x.current,name:n,value:u,checked:h,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=b;var E="SwitchThumb",R=s.forwardRef((e,a)=>{const{__scopeSwitch:t,...n}=e,r=q(E,t);return o.jsx(y.span,{"data-state":_(r.checked),"data-disabled":r.disabled?"":void 0,...n,ref:a})});R.displayName=E;var L="SwitchBubbleInput",j=s.forwardRef(({__scopeSwitch:e,control:a,checked:t,bubbles:n=!0,...r},m)=>{const d=s.useRef(null),c=C(d,m),u=z(t),w=H(a);return s.useEffect(()=>{const i=d.current;if(!i)return;const k=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(k,"checked").set;if(u!==t&&p){const v=new Event("click",{bubbles:n});p.call(i,t),i.dispatchEvent(v)}},[u,t,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:c,style:{...r.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});j.displayName=L;function _(e){return e?"checked":"unchecked"}var O=P,$=R;function W({className:e,...a}){return o.jsx(O,{"code-path":"src/components/ui/switch.tsx:13:5","data-slot":"switch",className:g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...a,children:o.jsx($,{"code-path":"src/components/ui/switch.tsx:21:7","data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{W as S};