UNPKG

react-dates

Version:

A responsive and accessible date range picker component built with React

8 lines 558 B
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; import { ANCHOR_LEFT } from '../constants'; export default function getResponsiveContainerStyles(anchorDirection, currentOffset, containerEdge, margin) { var windowWidth = typeof window !== 'undefined' ? window.innerWidth : 0; var calculatedOffset = anchorDirection === ANCHOR_LEFT ? windowWidth - containerEdge : containerEdge; var calculatedMargin = margin || 0; return _defineProperty({}, anchorDirection, Math.min(currentOffset + calculatedOffset - calculatedMargin, 0)); }