"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react/jsx-runtime"),h=require("./text.js"),v=require("../../hooks/useToggleState.js"),x=require("@styled/css"),m=require("@styled/jsx"),q=require("@styled/jsx/flex"),S=require("@styled/patterns"),a=require("react"),s=require("react-aria");const l=a.forwardRef((t,n)=>{const{checked:o,disabled:u=!1,label:i,...c}=t,d=a.useRef(null),b=n||d,e=v.useToggleState({...t,isSelected:o}),{buttonProps:p}=s.useToggleButton({...c,isDisabled:u},e,b),{isFocusVisible:g,focusProps:f}=s.useFocusRing();return r.jsxs(q.Flex,{alignItems:"center",children:[i&&r.jsx(m.Box,{mr:2,children:r.jsx(h.default,{fontWeight:"medium",styles:{lineHeight:1},children:i})}),r.jsx("button",{...s.mergeProps(p,f),className:x.css({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:g?"brand.base":"transparent",outlineStyle:"solid",outlineWidth:"thick",outlineOffset:.5,cursor:"pointer"}),children:r.jsx("span",{className:S.circle({h:4,w:4,bg:"paper",position:"relative",left:e.isSelected?6:0,transition:"left 0.2s ease"})})})]})});l.displayName="Switch",exports.default=l;
//# sourceMappingURL=switch.js.map
