import React from 'react' import { useDispatch } from 'react-redux' import OptionsSVG from '@epicformbuilder/admin/images/options.svg?react' import { updateComponentProperty } from '@epicformbuilder/admin/data' import { SettingsTab, DataTag, HelpCenter, Hint, Label, Required } from '@epicformbuilder/admin/editor/components' import Options from '../Options' export default function Checkbox ({ id, label, showLabel, showOther, inline, options, defaults, hint, showHint, tag, required, errorEmptyData }) { const tabs = { general: true, validation: false, advanced: false, help: true } const dispatch = useDispatch() const onChange = (id, property) => event => { const booleanProperties = ['showLabel', 'showHint', 'showOther', 'inline', 'required']; const value = 0 <= booleanProperties.indexOf(property) ?event.target.checked :event.target.value dispatch(updateComponentProperty(id, property, value)) } const handleResetDefaults = e => { e.preventDefault() dispatch(updateComponentProperty(id, 'defaults', [])) } return (