UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

2 lines (1 loc) 554 B
import{jsx as o,jsxs as l}from"react/jsx-runtime";import"./Checkbox.scss";import m from"classnames";import{useEffect as h,useId as u,useRef as x}from"react";const d=({name:t,value:c,label:a,ariaLabel:f,size:n="md",indeterminate:r=!1,onChange:i})=>{const s=u(),e=x(null);return h(()=>{e.current&&(e.current.indeterminate=r)},[r]),l("div",{className:m({"efp-checkbox":!0,[`efp-checkbox--${n}`]:!0}),children:[o("input",{ref:e,type:"checkbox",id:s,name:t,checked:c,"aria-label":f,onChange:()=>i(!c)}),o("label",{htmlFor:s,children:a})]})};export default d;