import{jsxs as f,jsx as t}from"react/jsx-runtime";import b from"./text.js";import{useToggleState as g}from"../../hooks/useToggleState.js";import{css as h}from"@styled/css";import{Box as S}from"@styled/jsx";import{Flex as x}from"@styled/jsx/flex";import{circle as k}from"@styled/patterns";import{forwardRef as y,useRef as w}from"react";import{useToggleButton as v,useFocusRing as B,mergeProps as F}from"react-aria";const i=y((r,s)=>{const{checked:l,disabled:n=!1,label:o,...a}=r,d=w(null),c=s||d,e=g({...r,isSelected:l}),{buttonProps:m}=v({...a,isDisabled:n},e,c),{isFocusVisible:p,focusProps:u}=B();return f(x,{alignItems:"center",children:[o&&t(S,{mr:2,children:t(b,{fontWeight:"medium",styles:{lineHeight:1},children:o})}),t("button",{...F(m,u),className:h({px:.5,h:5,width:11,_disabled:{opacity:.3,pointerEvents:"none"},bg:e.isSelected?"brand.base":"neutral.primary",_hover:{bg:e.isSelected?"brand.base":"ink.70",_dark:{bg:e.isSelected?"brand.base":"slate.4"}},transition:"background-color 0.2s ease",rounded:"full",outlineColor:p?"brand.base":"transparent",outlineStyle:"solid",outlineWidth:"thick",outlineOffset:.5,cursor:"pointer"}),children:t("span",{className:k({h:4,w:4,bg:"paper",position:"relative",left:e.isSelected?6:0,transition:"left 0.2s ease"})})})]})});i.displayName="Switch";export{i as default};
//# sourceMappingURL=switch.js.map
