Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

const tslib_1 = require("tslib");

const react_1 = tslib_1.__importDefault(require("react"));

const words_1 = require("../../../../words");

const ProductItem_1 = require("./ProductItem");

const styled_1 = require("./styled");

function getHeaderContent(props, state) {
  const {
    mandatoryProducts,
    addonProducts,
    headerLabel
  } = props;
  const mandatoryProductCount = mandatoryProducts.length;
  const addonProductCount = addonProducts.length;
  const mandatoryBundleCaption = mandatoryProductCount > 1 ? words_1.wording.items : words_1.wording.item;
  const addonBundleCaption = addonProductCount > 1 ? words_1.wording.addonsText : words_1.wording.addonText;
  const itemCaption = `${mandatoryProductCount} ${mandatoryBundleCaption}, `;
  const addonCaption = `${addonProductCount} ${addonBundleCaption}`;
  const iconType = state.isExpanded ? 'up' : 'down';
  return {
    itemCaption,
    addonCaption,
    iconType,
    headerLabel
  };
}

function defaultRenderHeader(props, state) {
  const {
    itemCaption,
    addonCaption,
    iconType,
    headerLabel
  } = getHeaderContent(props, state);
  return react_1.default.createElement(styled_1.Header, {
    isExpanded: state.isExpanded
  }, react_1.default.createElement(styled_1.StyledText, null, react_1.default.createElement(styled_1.StyledItemText, null, itemCaption), react_1.default.createElement(styled_1.StyledAddonText, null, addonCaption)), react_1.default.createElement(styled_1.StyledViewButton, {
    breedType: "text-with-icon",
    iconType: iconType,
    iconAlignType: "suffix",
    text: headerLabel,
    onClick: state.handleToggle
  }));
}

exports.defaultRenderHeader = defaultRenderHeader;

function defaultRenderItem(props) {
  const {
    item,
    index
  } = props,
        remainingProps = tslib_1.__rest(props, ["item", "index"]);

  return react_1.default.createElement(ProductItem_1.ProductItem, Object.assign({
    key: index,
    item: item,
    index: index
  }, remainingProps));
}

exports.defaultRenderItem = defaultRenderItem; //# sourceMappingURL=renderProps.js.map