import * as React from 'react'; import { IBaseControls } from '../IBaseControls'; import { Button } from '../Button'; import { Icon } from '../index'; import './checkboxInput.scss'; import { faCheckSquare, faSquare, faCheckCircle, faCircle, faMinusSquare as minusFaSquare } from '@fortawesome/free-regular-svg-icons'; import { faCheckSquare as solidFaCheckSquare, faSquare as solidFaSquare } from '@fortawesome/free-solid-svg-icons'; export interface ICheckboxProps extends IBaseControls { label?: string; checked: boolean; variant?: 'primary' | 'secondary'; autoFocus?: boolean; checkedButSome?: boolean; keepSingleClick?: boolean; } export const CheckboxInput = (props: ICheckboxProps) => { const { id, label, value, customClass, onChange, checked = false, disabled = false, variant = 'primary', autoFocus, checkedButSome // Used to show - icon when it means that some icons are selected, used in the grid select all checkbox } = props; const getClassName = (): any => { if (customClass === 'side-panel-column') return checked ? faCheckCircle : faCircle; // else return checked ? faCheckSquare : faSquare; else if (checked && checkedButSome) { return minusFaSquare; } else if (checked) { return faCheckSquare; } return faSquare; }; return (