"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.LabeledIconDecorator = exports.LabeledIconBase = exports.LabeledIcon = exports["default"] = void 0;

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

var _LabeledIcon = require("@enact/ui/LabeledIcon");

var _Pure = _interopRequireDefault(require("@enact/ui/internal/Pure"));

var _compose = _interopRequireDefault(require("ramda/src/compose"));

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

var _Icon = _interopRequireDefault(require("../Icon"));

var _Skinnable = _interopRequireDefault(require("../Skinnable"));

var _LabeledIconModule = _interopRequireDefault(require("./LabeledIcon.module.css"));

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

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

/**
 * A basic LabeledIcon component structure without any behaviors applied to it.
 *
 * @class LabeledIconBase
 * @memberof agate/LabeledIcon
 * @extends ui/LabeledIcon.LabeledIconBase
 * @ui
 * @public
 */
var LabeledIconBase = (0, _kind["default"])({
  name: 'LabeledIcon',
  propTypes:
  /** @lends agate/LabeledIcon.LabeledIconBase.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:
     *
     * * `labeledIcon` - The root class name
     * * `label` - Applied to the label element
     *
     * @type {Object}
     * @public
     */
    css: _propTypes["default"].object
  },
  styles: {
    css: _LabeledIconModule["default"],
    className: 'labeledIcon',
    publicClassNames: true
  },
  render: function render(props) {
    return _LabeledIcon.LabeledIconBase.inline(_objectSpread(_objectSpread({
      iconComponent: _Icon["default"]
    }, props), {}, {
      css: props.css
    }));
  }
});
/**
 * Adds Agate specific behaviors to [LabeledIconBase]{@link agate/LabeledIcon.LabeledIconBase}.
 *
 * @hoc
 * @memberof agate/LabeledIcon
 * @mixes ui/LabeledIcon.LabeledIconDecorator
 * @mixes agate/Skinnable.Skinnable
 * @public
 */

exports.LabeledIconBase = LabeledIconBase;
var LabeledIconDecorator = (0, _compose["default"])(_LabeledIcon.LabeledIconDecorator, _Pure["default"], _Skinnable["default"]);
/**
 * An Agate-styled icon component with a label.
 *
 * Usage:
 * ```
 * <LabeledIcon icon="star" labelPosition="after">
 *   Favorite
 * </LabeledIcon>
 * ```
 *
 * @class LabeledIcon
 * @memberof agate/LabeledIcon
 * @extends agate/LabeledIcon.LabeledIconBase
 * @mixes agate/LabeledIcon.LabeledIconDecorator
 * @ui
 * @public
 */

exports.LabeledIconDecorator = LabeledIconDecorator;
var LabeledIcon = LabeledIconDecorator(LabeledIconBase);
exports.LabeledIcon = LabeledIcon;
var _default = LabeledIcon;
exports["default"] = _default;