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 state_1 = require("@skava/state");

const exotic_1 = require("exotic");

const state_2 = require("./state");

function initMediaCarouselState() {
  return new state_2.MediaCarouselState();
}

exports.initMediaCarouselState = initMediaCarouselState;

function toMediaCarouselState(props) {
  if (props.state === undefined) {
    const state = initMediaCarouselState();
    state.update(props);
    return state;
  } else {
    return props.state;
  }
}

exports.toMediaCarouselState = toMediaCarouselState;

const getDeviceColSpan = props => {
  const currentDevice = state_1.application.isDesktop ? 'desktop' : state_1.application.isTablet ? 'tablet' : 'mobile';
  return props[currentDevice + 'ColSpan'];
};

exports.getDeviceColSpan = getDeviceColSpan;

const getCarouselPanelWidth = props => {
  const {
    list
  } = props;

  if (exotic_1.isArray(list) !== undefined) {
    const deviceColSpan = getDeviceColSpan(props);
    const deviceColSpanAsNumber = exotic_1.fromIshToNumber(deviceColSpan);
    const colSpan = deviceColSpanAsNumber > exotic_1.fromIshToNumber(list.length) ? exotic_1.fromIshToNumber(list.length) : deviceColSpanAsNumber;
    return 100 / colSpan;
  } else {
    return 100;
  }
};

exports.getCarouselPanelWidth = getCarouselPanelWidth; //# sourceMappingURL=deps.js.map