UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

2 lines (1 loc) 644 B
import{jsx as n,jsxs as m}from"react/jsx-runtime";import"./CheckboxButton.scss";import c from"classnames";import{useState as u}from"react";const l=({checked:t,label:e,ariaLabel:a,className:s,onClick:i})=>{const[r,o]=u(!1),b=()=>{o(!0),i(),setTimeout(()=>{o(!1)},320)};return m("button",{type:"button",role:"checkbox","aria-checked":t,"aria-label":a??(e?void 0:"Toggle"),className:c("efp-checkbox-button",s,{"efp-checkbox-button--checked":t}),onClick:b,children:[n("div",{className:c("efp-checkbox-button__inner",{"efp-checkbox-button__inner--animate":r})}),e&&n("span",{className:"efp-checkbox-button__label",children:e})]})};export default l;