"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.LabeledIconDecorator = exports.LabeledIconBase = exports.LabeledIcon = 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(e) { return e && e.__esModule ? e : { "default": e }; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
 * An Agate-themed Labeled Icon component.
 *
 * @example
 * <LabeledIcon icon="star">Hello Enact!</LabeledIcon>
 *
 * @module agate/LabeledIcon
 * @exports LabeledIcon
 * @exports LabeledIconBase
 * @exports LabeledIconDecorator
 */
/**
 * A basic LabeledIcon component structure without any behaviors applied to it.
 *
 * @class LabeledIconBase
 * @memberof agate/LabeledIcon
 * @extends ui/LabeledIcon.LabeledIconBase
 * @ui
 * @public
 */
var LabeledIconBase = exports.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,
    /**
     * The size of the icon.
     *
     * @type {('smallest'|'small'|'large'|'huge')}
     * @default 'large'
     * @public
     */
    size: _propTypes["default"].oneOf(['smallest', 'small', 'large', 'huge'])
  },
  styles: {
    css: _LabeledIconModule["default"],
    className: 'labeledIcon',
    publicClassNames: true
  },
  computed: {
    className: function className(_ref) {
      var size = _ref.size,
        styler = _ref.styler;
      return styler.append(size);
    }
  },
  render: function render(props) {
    return _LabeledIcon.LabeledIconBase.inline(_objectSpread(_objectSpread({
      iconComponent: _Icon["default"]
    }, props), {}, {
      css: props.css
    }));
  }
});

/**
 * Adds Agate specific behaviors to {@link agate/LabeledIcon.LabeledIconBase|LabeledIconBase}.
 *
 * @hoc
 * @memberof agate/LabeledIcon
 * @mixes ui/LabeledIcon.LabeledIconDecorator
 * @mixes agate/Skinnable.Skinnable
 * @public
 */
var LabeledIconDecorator = exports.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
 */
var LabeledIcon = exports.LabeledIcon = LabeledIconDecorator(LabeledIconBase);
var _default = exports["default"] = LabeledIcon;