"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CheckboxItemBase = exports.CheckboxItem = exports.default = void 0;

var _kind = _interopRequireDefault(require("@enact/core/kind"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _react = _interopRequireDefault(require("react"));

var _Checkbox = _interopRequireDefault(require("../Checkbox"));

var _ToggleItem = _interopRequireDefault(require("../ToggleItem"));

var _CheckboxItem = _interopRequireDefault(require("./CheckboxItem.less"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

/**
 * An item with a checkbox component, ready to use in Moonstone applications.
 *
 * `CheckboxItem` may be used to allow the user to select a single option or used as part of a
 * [Group]{@link ui/Group} when multiple [selections]{@link ui/Group.Group.select} are possible.
 *
 * Usage:
 * ```
 * <CheckboxItem
 * 	defaultSelected={selected}
 * 	onToggle={handleToggle}
 * >
 *  Item with a Checkbox
 * </CheckboxItem>
 * ```
 *
 * @class CheckboxItem
 * @memberof moonstone/CheckboxItem
 * @extends moonstone/ToggleItem.ToggleItem
 * @ui
 * @public
 */
var CheckboxItemBase = (0, _kind.default)({
  name: 'CheckboxItem',
  propTypes:
  /** @lends moonstone/CheckboxItem.CheckboxItem.prototype */
  {
    /**
     * Customizes the component by mapping the supplied collection of CSS class names to the
     * corresponding internal Elements and states of this component.
     *
     * The following classes are supported:
     *
     * * `checkboxItem` - The root class name
     *
     * @type {Object}
     * @public
     */
    css: _propTypes.default.object
  },
  styles: {
    css: _CheckboxItem.default,
    className: 'checkboxItem',
    publicClassNames: ['checkboxItem']
  },
  render: function render(props) {
    return _react.default.createElement(_ToggleItem.default, _extends({
      "data-webos-voice-intent": "SelectCheckItem"
    }, props, {
      css: props.css,
      iconComponent: _Checkbox.default
    }));
  }
});
exports.CheckboxItemBase = exports.CheckboxItem = CheckboxItemBase;
var _default = CheckboxItemBase;
exports.default = _default;