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 / dist / components / presets / RadioIconDropDown / RadioIconDropDown.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 exotic_1 = require("exotic");

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

const ToggleList_1 = require("../../molecules/ToggleList");

const SelectionState_1 = require("../../../state/SelectionState");

const SelectDropDown_1 = require("../../molecules/SelectDropDown");

const fixture_1 = require("./fixture");

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

const renderActiveItem = props => react_1.default.createElement(SelectDropDown_1.ActiveOption, Object.assign({
  label: "Distance"
}, props));

const renderItem = (itemProps, state) => {
  console.debug('[RadioDropDown] renderItem: ', itemProps.isSelected);

  const {
    label
  } = itemProps,
        remainingProps = tslib_1.__rest(itemProps, ["label"]);

  return react_1.default.createElement(ToggleList_1.ToggleItem, Object.assign({
    key: label,
    isRadio: true
  }, itemProps)); // return <ToggleList breedType="radio" list={list} />)
};

let RadioIconDropDown = class RadioIconDropDown extends react_1.default.Component {
  constructor() {
    super(...arguments);
    /**
     * Multi state object creation for selection state
     */

    this.observableState = new SelectionState_1.SelectionState();
  }

  componentWillMount() {
    const attributes = Object.assign({}, this.props, {
      list: this.props.list,
      onChange: exotic_1.NO_OP
    });
    this.observableState.decorateWithProps(attributes);
  }

  render() {
    // console.log('[StoreHoursDropDown] list', storeHoursList)
    return react_1.default.createElement(styled_1.StyledSelectDropDown, Object.assign({
      list: this.props.list,
      renderActiveItem: renderActiveItem,
      renderItem: renderItem
    }, this.props));
  }

};
RadioIconDropDown.defaultProps = {
  className: '',
  list: fixture_1.list || exotic_1.EMPTY_ARRAY
};
RadioIconDropDown = tslib_1.__decorate([mobx_react_1.observer], RadioIconDropDown);
exports.RadioIconDropDown = RadioIconDropDown;
exports.default = RadioIconDropDown; //# sourceMappingURL=RadioIconDropDown.js.map