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    
@skava/ui-presets / dist / presets / Checkout / DeliveryInstruction / DeliveryInstruction.js
Size: Mime:
"use strict";

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

const tslib_1 = require("tslib");

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

const mobx_react_1 = require("xmobx/mobx-react");

const DeliveryInstruction_1 = require("../../../abstractions/Checkout/DeliveryInstruction");

const ExpandableCard_1 = require("@skava/ui/dist/components/organisms/ExpandableCard");

const renderProps_1 = require("./renderProps");

let DeliveryInstruction = class DeliveryInstruction extends react_1.default.Component {
  constructor() {
    super(...arguments);
    this.observableState = new ExpandableCard_1.ExpandableState();
  }

  componentWillMount() {
    const {
      isSelected
    } = this.props;

    if (isSelected === true) {
      this.observableState.handleToggle();
    }
  }

  render() {
    const _a = this.props,
          {
      renderToggleButton,
      renderExpandedView
    } = _a,
          remainingProps = tslib_1.__rest(_a, ["renderToggleButton", "renderExpandedView"]);

    return react_1.default.createElement(DeliveryInstruction_1.DeliveryInstruction, Object.assign({
      renderExpandedView: renderExpandedView,
      renderToggleButton: renderToggleButton,
      state: this.observableState
    }, remainingProps));
  }

};
DeliveryInstruction.defaultProps = {
  className: '',
  isSelected: false,
  renderToggleButton: renderProps_1.defaultRenderToggleButton,
  renderExpandedView: renderProps_1.defaultRenderExpandedView
};
DeliveryInstruction = tslib_1.__decorate([mobx_react_1.observer], DeliveryInstruction);
exports.DeliveryInstruction = DeliveryInstruction;
exports.default = DeliveryInstruction;