PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.0-beta1
Elementor Website Builder – more than just a page builder v3.8.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
elementor / app / assets / js / ui / atoms / checkbox.js

checkbox.js in Elementor Website Builder – more than just a page builder 3.8.0-beta1, at app/assets/js/ui/atoms/checkbox.js

50 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { arrayToClassName } from 'elementor-app/utils/utils.js';
2
3 import './checkbox.scss';
4
5 export default function Checkbox( { className, checked, rounded, indeterminate, error, disabled, onChange } ) {
6 const baseClassName = 'eps-checkbox',
7 classes = [ baseClassName, className ];
8
9 if ( rounded ) {
10 classes.push( baseClassName + '--rounded' );
11 }
12
13 if ( indeterminate ) {
14 classes.push( baseClassName + '--indeterminate' );
15 }
16
17 if ( error ) {
18 classes.push( baseClassName + '--error' );
19 }
20
21 return (
22 <input
23 className={ arrayToClassName( classes ) }
24 type="checkbox"
25 checked={ checked }
26 disabled={ disabled }
27 onChange={ onChange }
28 />
29 );
30 }
31
32 Checkbox.propTypes = {
33 className: PropTypes.string,
34 checked: PropTypes.bool,
35 disabled: PropTypes.bool,
36 indeterminate: PropTypes.bool,
37 rounded: PropTypes.bool,
38 error: PropTypes.bool,
39 onChange: PropTypes.func,
40 };
41
42 Checkbox.defaultProps = {
43 className: '',
44 checked: null,
45 disabled: false,
46 indeterminate: false,
47 error: false,
48 onChange: () => {},
49 };
50