@bothub-chat/ui
Version:
Bothub UI Components
2 lines (1 loc) • 1.79 kB
JavaScript
import{__rest as e}from"tslib";import{jsxs as o,Fragment as t,jsx as r}from"react/jsx-runtime";import{useCallback as l}from"react";import{CheckboxStyled as n,CheckboxInput as s,CheckboxBlock as i,CheckboxCheckedIcon as a,CheckboxBlockSkeleton as c,CheckboxLabel as d}from"./styled.js";import"@react-spring/web";import"react-markdown";import"react-dom";import"../portal/styled.js";import"../tooltip/styled.js";import"../tooltip/arrow/styled.js";import"../../theme/index.js";import{useTooltip as p}from"../tooltip/context.js";import{Skeleton as m}from"../skeleton/index.js";const h=h=>{var u,{className:v,label:k,size:f=20,displayFlex:g=!1,skeleton:y=!1,rowReverse:j,fullWidth:x=!1,preventScrollOnFocus:C=!1,checkedIcon:$,checkedColor:b,dataTest:w,onValueChange:F,onPointerLeave:L}=h,O=e(h,["className","label","size","displayFlex","skeleton","rowReverse","fullWidth","preventScrollOnFocus","checkedIcon","checkedColor","dataTest","onValueChange","onPointerLeave"]);const{handleTooltipMouseEnter:z,handleTooltipMouseLeave:M}=p(),S=l(e=>{var o;null===(o=O.onChange)||void 0===o||o.call(O,e),null==F||F(e.target.checked)},[O.onChange,F]);return o(n,{$displayFlex:g,$disabled:null!==(u=O.disabled)&&void 0!==u&&u,$fullWidth:x,$rowReverse:j,$preventScrollOnFocus:C,className:v,onMouseEnter:z,onMouseLeave:M,onPointerLeave:L,"data-test":w,children:[!y&&o(t,{children:[r(s,Object.assign({},O,{$checkedColor:b,$preventScrollOnFocus:C,type:"checkbox",onChange:S})),r(i,{$checkedColor:b,children:$||r(a,{size:f})})]}),y&&r(c,{$size:f}),k&&y&&r(d,{children:r(m,{width:200})}),"string"==typeof k&&!y&&r(d,{children:k}),"string"!=typeof k&&!y&&k]})};export{h as Checkbox,i as CheckboxBlock,c as CheckboxBlockSkeleton,a as CheckboxCheckedIcon,s as CheckboxInput,d as CheckboxLabel,n as CheckboxStyled};