UNPKG

@yandex/ui

Version:

Yandex UI components

15 lines (14 loc) 528 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.calculateItemWidth = void 0; var calculateItemWidth = function (element, withMargins) { if (!(element && element.current)) return 0; var style = window.getComputedStyle(element.current); var width = parseInt(style.width || '0'); if (withMargins) { return width + parseInt(style.marginLeft || '0') + parseInt(style.marginRight || '0'); } return width; }; exports.calculateItemWidth = calculateItemWidth;