Repository URL to install this package:
|
Version:
4.2.0-a11y.0 ▾
|
"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