import{a as e,n as t}from"./chunk-BneVvdWh.js";import{t as n}from"./react-C7IZe2D1.js";import{ht as r,t as i,y as a}from"./dist-DtfJeYQK.js";import{t as o}from"./jsx-runtime-C2wGStra.js";import{n as s,t as c}from"./dist-Cc1j9Pjk.js";import{n as l,t as u}from"./filterAttributesPassedByRadixUIAtRuntime-CGiuUnR2.js";import{n as d,t as f}from"./render-icon-CUp_n6rD.js";import{n as p,t as m}from"./useMergeRefs-BZP37fIn.js";var h,g,_,v,y=t((()=>{h=e(n()),g=e(n()),_=({title:e,titleId:t,...n},r)=>h.createElement(`svg`,{"data-preply-ds-component":`SvgTokyoUIIcon`,viewBox:`0 0 14 2`,xmlns:`http://www.w3.org/2000/svg`,ref:r,"aria-labelledby":t,...n},e?h.createElement(`title`,{id:t},e):null,h.createElement(`path`,{d:`M0 0h14v2H0z`})),v=(0,g.forwardRef)(_)})),b,x,S,C,w=t((()=>{b=e(n()),x=e(n()),S=({title:e,titleId:t,...n},r)=>b.createElement(`svg`,{"data-preply-ds-component":`SvgTokyoUIIcon`,viewBox:`0 0 13 11`,xmlns:`http://www.w3.org/2000/svg`,ref:r,"aria-labelledby":t,...n},e?b.createElement(`title`,{id:t},e):null,b.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.923 10.101 0 6.18 1.179 5l2.744 2.744L11.667 0l1.178 1.179z`})),C=(0,x.forwardRef)(S)})),T,E,D,O,k=t((()=>{T=`checkbox__-j3Cu`,E=`remove__Tu7KI`,D=`checkmark__-fsuM`,O={checkbox:T,remove:E,checkmark:D}}));function A({ref:e,onChange:t,indeterminate:n,onCheckedChange:r}){let i=(0,j.useRef)(null),a=p(i,e);(0,j.useLayoutEffect)(()=>{i.current&&typeof n==`boolean`&&(i.current.indeterminate=n)},[n]);let o=(0,j.useCallback)(e=>{t?.(e),typeof n==`boolean`&&(e.target.indeterminate=n),r?.(e.target.checked)},[t,n,r]);return{mergedRef:a,ariaChecked:n?`mixed`:void 0,onChangeHandler:o}}var j,M=t((()=>{j=e(n(),1),m()})),N,P,F,I=t((()=>{N=e(n(),1),c(),i(),f(),l(),y(),w(),k(),M(),P=o(),F=(0,N.forwardRef)(function({id:e,name:t,checked:n,defaultChecked:i,indeterminate:o,onChange:c,onCheckedChange:l,hasError:f,disabled:p,required:m,"aria-label":h,"aria-labelledby":g,"aria-describedby":_,dataset:y,onBlur:b,onFocus:x,...S},w){let{mergedRef:T,onChangeHandler:E,ariaChecked:D}=A({ref:w,onChange:c,indeterminate:o,onCheckedChange:l}),k=a(O,`checkbox`);return(0,P.jsxs)(`div`,{...u(S),className:k.join(` `),"data-preply-ds-component":s.Checkbox,children:[(0,P.jsx)(`input`,{id:e,name:t,type:`checkbox`,required:m,disabled:p,checked:n,defaultChecked:i,"aria-checked":D,"aria-invalid":f===!0?!0:void 0,"aria-label":h,"aria-labelledby":g,"aria-describedby":_,onChange:E,ref:T,onBlur:b,onFocus:x,...r(y)}),d(C,{focusable:`false`,"aria-hidden":`true`,className:O.checkmark}),d(v,{focusable:`false`,"aria-hidden":`true`,className:O.remove})]})});try{F.displayName=`Checkbox`,F.__docgenInfo={description:"To make this accessible, you must label it using a `<label>` or `aria-label`:",displayName:`Checkbox`,props:{hasError:{defaultValue:null,description:'Shows the component\'s error state, and sets `aria-invalid="true"` on the input element.',name:`hasError`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},indeterminate:{defaultValue:null,description:`Makes the component look indeterminate. Please note that the indeterminate state is parallel
to che checked/unchecked state, meaning that a checkbox can be checked and indeterminate at
the same time. it's up to you to handle the logic of when to set this prop.

If you're implementing a tri-state checkbox group, pleas refer to the
{@link https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/ARIA Checkbox Pattern}.`,name:`indeterminate`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},onCheckedChange:{defaultValue:null,description:``,name:`onCheckedChange`,required:!1,type:{name:`enum`,value:[{value:`(checked: boolean) => void`}]}},dataset:{defaultValue:null,description:`Sets data attributes on the DOM element.
@example <Checkbox dataset={{ 'qa-id': 'accept-conditions' }} /> // will add data-qa-id="accept-conditions" to the HTML element`,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}}}}}catch{}}));export{I as n,F as t};