getWidth = function ({ parent, width }) {
  if (width < WIDTH_MIN_SIZE) {
    width = WIDTH_MIN_SIZE;

    // TODO: add check and test for parent == null
    let parentWidth = parent.offsetWidth;
    let parentNode = parent.parentNode;

    // get the fist parent that has a size over the minimum
    while (parentNode && parentWidth < width) {
      parentWidth = parentNode.offsetWidth;

      // set for next loop
      parentNode = parentNode.parentNode;
    }

    if (parentWidth > width) {
      width = parentWidth;
    }
  }
  return width;
}
Function that returns an element width that's equal to or greater than
WIDTH_MIN_SIZE.

If the element width is less than the minimum, it will recursively
look for first parent element with width greater than WIDTH_MIN_SIZE.

As a fallback, if the resulting width is still less than minimum, width
is set to WIDTH_MIN_SIZE.

We do this to avoid failing to resize when window expands and avoid
setting sizes to 0 when el.offsetWidth == 0.