@wordpress/components
Version:
UI components for WordPress.
35 lines (33 loc) • 826 B
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { createElement } from "@wordpress/element";
/**
* WordPress dependencies
*/
import { memo } from '@wordpress/element';
/**
* Internal dependencies
*/
import SwitchCell from '../mobile/bottom-sheet/switch-cell';
const ToggleControl = memo(_ref => {
let {
label,
checked,
help,
instanceId,
className,
onChange,
...props
} = _ref;
const id = `inspector-toggle-control-${instanceId}`;
const helpLabel = help && typeof help === 'function' ? help(checked) : help;
return createElement(SwitchCell, _extends({
label: label,
id: id,
help: helpLabel,
className: className,
value: checked,
onValueChange: onChange
}, props));
});
export default ToggleControl;
//# sourceMappingURL=index.native.js.map