"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),v=require("@styled/tokens"),y=require("../icons/ico-checkmark.js"),k=require("./text.js"),q=require("../../hooks/useToggleState.js"),l=require("@styled/css"),C=require("@styled/jsx"),S=require("@styled/jsx/flex"),o=require("react"),i=require("react-aria");const b=o.forwardRef((c,h)=>{const{label:a,indeterminate:r=!1,disabled:n=!1,checked:x,"aria-label":f,...m}=c,s=q.useToggleState({...c,isSelected:x}),g=o.useRef(null),t=h||g;o.useEffect(()=>{const u="current"in t?t.current:null;u&&(u.indeterminate=!!r)},[r,t]);const{inputProps:p}=i.useCheckbox({...m,"aria-label":a||f||"Checkbox",isDisabled:n,isIndeterminate:r},s,t),{isFocusVisible:d,focusProps:j}=i.useFocusRing();return e.jsxs("label",{className:l.css({display:"flex",alignItems:"center",rounded:"sm",opacity:n?.3:1}),children:[e.jsx(i.VisuallyHidden,{children:e.jsx("input",{...i.mergeProps(p,j),ref:t})}),e.jsx("div",{className:l.css({display:"flex",alignItems:"center",justifyContent:"center",width:5,height:5,bg:s.isSelected?"brand.base":"transparent",borderWidth:"thick",borderColor:s.isSelected||d?"brand.base":"text.tertiary",transition:"background-color 0.2s ease, border-color 0.2s ease",_hover:{cursor:"pointer",borderColor:"brand.base"},pointerEvents:n?"none":"auto",rounded:"sm",boxSizing:"border-box",outlineColor:d?"brand.base":"transparent",outlineStyle:"solid",outlineWidth:"thick",outlineOffset:.5}),children:e.jsxs("span",{children:[s.isSelected&&!r&&e.jsx(y.default,{height:16,width:16,color:v.token("colors.surface.primary")}),s.isSelected&&!!r&&e.jsx(S.Flex,{justifyContent:"center",alignItems:"center",children:e.jsx("div",{className:l.css({w:2.5,h:.5,bg:"surface.primary"})})})]})}),a&&e.jsx(C.Box,{ml:3,children:e.jsx(k.default,{fontWeight:"medium",styles:{lineHeight:1},children:a})})]})});b.displayName="Checkbox",exports.default=b;
//# sourceMappingURL=checkbox.js.map
