From 9cac256ae4cde243edeee9bebb1060e0a245b42f Mon Sep 17 00:00:00 2001 From: Joe Lencioni <joe.lencioni@airbnb.com> Date: Mon, 23 Oct 2017 13:51:49 -0700 Subject: [PATCH] Build entry points These three files are used as entry points into the project, and we expect people to be importing them directly so they are at the top level for convenience. Because of this, they have not been getting run through Babel like the rest of the code here, so they were using older syntax. In this commit, I am moving these files into the src directory so they will be built into lib like the rest of the code here. In their place at the top level, I am creating some very light shims that simply bring in the built version of the module and re-export it if necessary. This gives us a couple of advantages. First, it makes more of our code consistent. Second, it makes it possible to produce two different kinds of builds, one for CommonJS consumers and another for ES modules consumers. --- constants.js | 27 +--------- index.js | 53 +------------------ initialize.js | 4 +- src/components/CalendarDay.jsx | 2 +- src/components/CalendarMonth.jsx | 2 +- src/components/CalendarMonthGrid.jsx | 2 +- src/components/DateInput.jsx | 2 +- src/components/DateRangePicker.jsx | 2 +- src/components/DateRangePickerInput.jsx | 2 +- .../DateRangePickerInputController.jsx | 2 +- src/components/DayPicker.jsx | 2 +- src/components/DayPickerNavigation.jsx | 2 +- src/components/DayPickerRangeController.jsx | 2 +- .../DayPickerSingleDateController.jsx | 2 +- src/components/SingleDatePicker.jsx | 2 +- src/components/SingleDatePickerInput.jsx | 2 +- src/constants.js | 23 ++++++++ src/index.js | 20 +++++++ src/initialize.js | 3 ++ src/shapes/AnchorDirectionShape.js | 2 +- src/shapes/DayOfWeekShape.js | 2 +- src/shapes/FocusedInputShape.js | 2 +- src/shapes/IconPositionShape.js | 2 +- src/shapes/OpenDirectionShape.js | 2 +- src/shapes/OrientationShape.js | 2 +- src/shapes/ScrollableOrientationShape.js | 2 +- src/utils/getCalendarMonthWeeks.js | 2 +- src/utils/getResponsiveContainerStyles.js | 2 +- src/utils/toISODateString.js | 2 +- src/utils/toISOMonthString.js | 2 +- src/utils/toLocalizedDateString.js | 2 +- src/utils/toMomentObject.js | 2 +- test/components/CalendarDay_spec.jsx | 2 +- .../DateRangePickerInputController_spec.jsx | 2 +- test/components/DateRangePicker_spec.jsx | 2 +- test/components/DayPickerNavigation_spec.jsx | 2 +- .../DayPickerRangeController_spec.jsx | 2 +- test/components/DayPicker_spec.jsx | 2 +- .../getResponsiveContainerStyles_spec.js | 2 +- test/utils/toISODateString_spec.js | 2 +- test/utils/toISOMonthString_spec.js | 2 +- test/utils/toLocalizedDateString_spec.js | 2 +- 42 files changed, 87 insertions(+), 115 deletions(-) create mode 100644 src/constants.js create mode 100644 src/index.js create mode 100644 src/initialize.js diff --git a/constants.js b/constants.js index d613b7ef..a3358962 100644 --- a/constants.js +++ b/constants.js @@ -1,25 +1,2 @@ -module.exports = { - DISPLAY_FORMAT: 'L', - ISO_FORMAT: 'YYYY-MM-DD', - ISO_MONTH_FORMAT: 'YYYY-MM', - - START_DATE: 'startDate', - END_DATE: 'endDate', - - HORIZONTAL_ORIENTATION: 'horizontal', - VERTICAL_ORIENTATION: 'vertical', - VERTICAL_SCROLLABLE: 'verticalScrollable', - - ICON_BEFORE_POSITION: 'before', - ICON_AFTER_POSITION: 'after', - - ANCHOR_LEFT: 'left', - ANCHOR_RIGHT: 'right', - - OPEN_DOWN: 'down', - OPEN_UP: 'up', - - DAY_SIZE: 39, - BLOCKED_MODIFIER: 'blocked', - WEEKDAYS: [0, 1, 2, 3, 4, 5, 6], -}; +// eslint-disable-next-line import/no-unresolved +module.exports = require('./lib/constants'); diff --git a/index.js b/index.js index 4e4d8764..3f16f627 100644 --- a/index.js +++ b/index.js @@ -1,51 +1,2 @@ -var DateRangePicker = require('./lib/components/DateRangePicker').default; -var DateRangePickerInput = require('./lib/components/DateRangePickerInput').default; -var DateRangePickerInputController = require('./lib/components/DateRangePickerInputController').default; -var SingleDatePicker = require('./lib/components/SingleDatePicker').default; -var SingleDatePickerInput = require('./lib/components/SingleDatePickerInput').default; -var DayPicker = require('./lib/components/DayPicker').default; -var DayPickerRangeController = require('./lib/components/DayPickerRangeController').default; -var DayPickerSingleDateController = require('./lib/components/DayPickerSingleDateController').default; -var CalendarMonthGrid = require('./lib/components/CalendarMonthGrid').default; -var CalendarMonth = require('./lib/components/CalendarMonth').default; -var CalendarDay = require('./lib/components/CalendarDay').default; - -var DateRangePickerShape = require('./lib/shapes/DateRangePickerShape').default; -var SingleDatePickerShape = require('./lib/shapes/SingleDatePickerShape').default; - -var isInclusivelyAfterDay = require('./lib/utils/isInclusivelyAfterDay').default; -var isInclusivelyBeforeDay = require('./lib/utils/isInclusivelyBeforeDay').default; -var isNextDay = require('./lib/utils/isNextDay').default; -var isSameDay = require('./lib/utils/isSameDay').default; - -var toISODateString = require('./lib/utils/toISODateString').default; -var toLocalizedDateString = require('./lib/utils/toLocalizedDateString').default; -var toMomentObject = require('./lib/utils/toMomentObject').default; - - -module.exports = { - DateRangePicker: DateRangePicker, - SingleDatePicker: SingleDatePicker, - - DateRangePickerInputController: DateRangePickerInputController, - DateRangePickerInput: DateRangePickerInput, - SingleDatePickerInput: SingleDatePickerInput, - DayPicker: DayPicker, - DayPickerRangeController: DayPickerRangeController, - DayPickerSingleDateController: DayPickerSingleDateController, - CalendarMonthGrid: CalendarMonthGrid, - CalendarMonth: CalendarMonth, - CalendarDay: CalendarDay, - - DateRangePickerShape: DateRangePickerShape, - SingleDatePickerShape: SingleDatePickerShape, - - isInclusivelyAfterDay: isInclusivelyAfterDay, - isInclusivelyBeforeDay: isInclusivelyBeforeDay, - isNextDay: isNextDay, - isSameDay: isSameDay, - - toISODateString: toISODateString, - toLocalizedDateString: toLocalizedDateString, - toMomentObject: toMomentObject, -}; +// eslint-disable-next-line import/no-unresolved +module.exports = require('./lib'); diff --git a/initialize.js b/initialize.js index 96d30fc6..fbd491b7 100644 --- a/initialize.js +++ b/initialize.js @@ -1,4 +1,2 @@ // eslint-disable-next-line import/no-unresolved -const registerCSSInterfaceWithDefaultTheme = require('./lib/utils/registerCSSInterfaceWithDefaultTheme.js').default; - -registerCSSInterfaceWithDefaultTheme(); +require('./lib/initialize'); diff --git a/src/components/CalendarDay.jsx b/src/components/CalendarDay.jsx index 0105a54e..bd101351 100644 --- a/src/components/CalendarDay.jsx +++ b/src/components/CalendarDay.jsx @@ -10,7 +10,7 @@ import { CalendarDayPhrases } from '../defaultPhrases'; import getPhrasePropTypes from '../utils/getPhrasePropTypes'; import getPhrase from '../utils/getPhrase'; -import { BLOCKED_MODIFIER, DAY_SIZE } from '../../constants'; +import { BLOCKED_MODIFIER, DAY_SIZE } from '../constants'; const propTypes = forbidExtraProps({ ...withStylesPropTypes, diff --git a/src/components/CalendarMonth.jsx b/src/components/CalendarMonth.jsx index d38e23c3..c2a1093f 100644 --- a/src/components/CalendarMonth.jsx +++ b/src/components/CalendarMonth.jsx @@ -26,7 +26,7 @@ import { VERTICAL_ORIENTATION, VERTICAL_SCROLLABLE, DAY_SIZE, -} from '../../constants'; +} from '../constants'; const propTypes = forbidExtraProps({ ...withStylesPropTypes, diff --git a/src/components/CalendarMonthGrid.jsx b/src/components/CalendarMonthGrid.jsx index 3db9b4ac..95c0a896 100644 --- a/src/components/CalendarMonthGrid.jsx +++ b/src/components/CalendarMonthGrid.jsx @@ -26,7 +26,7 @@ import { VERTICAL_ORIENTATION, VERTICAL_SCROLLABLE, DAY_SIZE, -} from '../../constants'; +} from '../constants'; const propTypes = forbidExtraProps({ ...withStylesPropTypes, diff --git a/src/components/DateInput.jsx b/src/components/DateInput.jsx index 30a9be26..85b86983 100644 --- a/src/components/DateInput.jsx +++ b/src/components/DateInput.jsx @@ -6,7 +6,7 @@ import throttle from 'lodash/throttle'; import isTouchDevice from 'is-touch-device'; import openDirectionShape from '../shapes/OpenDirectionShape'; -import { OPEN_DOWN, OPEN_UP } from '../../constants'; +import { OPEN_DOWN, OPEN_UP } from '../constants'; const propTypes = forbidExtraProps({ ...withStylesPropTypes, diff --git a/src/components/DateRangePicker.jsx b/src/components/DateRangePicker.jsx index 3d0a7c12..ed245174 100644 --- a/src/components/DateRangePicker.jsx +++ b/src/components/DateRangePicker.jsx @@ -32,7 +32,7 @@ import { OPEN_UP, DAY_SIZE, ICON_BEFORE_POSITION, -} from '../../constants'; +} from '../constants'; const propTypes = forbidExtraProps({ ...withStylesPropTypes, diff --git a/src/components/DateRangePickerInput.jsx b/src/components/DateRangePickerInput.jsx index 060f57d5..90573028 100644 --- a/src/components/DateRangePickerInput.jsx +++ b/src/components/DateRangePickerInput.jsx @@ -21,7 +21,7 @@ import { ICON_BEFORE_POSITION, ICON_AFTER_POSITION, OPEN_DOWN, -} from '../../constants'; +} from '../constants'; const propTypes = forbidExtraProps({ ...withStylesPropTypes, diff --git a/src/components/DateRangePickerInputController.jsx b/src/components/DateRangePickerInputController.jsx index d2255803..9892d9da 100644 --- a/src/components/DateRangePickerInputController.jsx +++ b/src/components/DateRangePickerInputController.jsx @@ -19,7 +19,7 @@ import toLocalizedDateString from '../utils/toLocalizedDateString'; import isInclusivelyAfterDay from '../utils/isInclusivelyAfterDay'; import isBeforeDay from '../utils/isBeforeDay'; -import { START_DATE, END_DATE, ICON_BEFORE_POSITION, OPEN_DOWN } from '../../constants'; +import { START_DATE, END_DATE, ICON_BEFORE_POSITION, OPEN_DOWN } from '../constants'; const propTypes = forbidExtraProps({ startDate: momentPropTypes.momentObj, diff --git a/src/components/DayPicker.jsx b/src/components/DayPicker.jsx index 14fbcefe..54dc1b11 100644 --- a/src/components/DayPicker.jsx +++ b/src/components/DayPicker.jsx @@ -32,7 +32,7 @@ import { VERTICAL_ORIENTATION, VERTICAL_SCROLLABLE, DAY_SIZE, -} from '../../constants'; +} from '../constants'; const MONTH_PADDING = 23; const DAY_PICKER_PADDING = 9; diff --git a/src/components/DayPickerNavigation.jsx b/src/components/DayPickerNavigation.jsx index 2795e225..5bcd3a27 100644 --- a/src/components/DayPickerNavigation.jsx +++ b/src/components/DayPickerNavigation.jsx @@ -15,7 +15,7 @@ import ScrollableOrientationShape from '../shapes/ScrollableOrientationShape'; import { HORIZONTAL_ORIENTATION, VERTICAL_SCROLLABLE, -} from '../../constants'; +} from '../constants'; const propTypes = forbidExtraProps({ ...withStylesPropTypes, diff --git a/src/components/DayPickerRangeController.jsx b/src/components/DayPickerRangeController.jsx index b3c3c9dc..01f96beb 100644 --- a/src/components/DayPickerRangeController.jsx +++ b/src/components/DayPickerRangeController.jsx @@ -31,7 +31,7 @@ import { HORIZONTAL_ORIENTATION, VERTICAL_SCROLLABLE, DAY_SIZE, -} from '../../constants'; +} from '../constants'; import DayPicker from './DayPicker'; diff --git a/src/components/DayPickerSingleDateController.jsx b/src/components/DayPickerSingleDateController.jsx index 3808951c..0e28733c 100644 --- a/src/components/DayPickerSingleDateController.jsx +++ b/src/components/DayPickerSingleDateController.jsx @@ -25,7 +25,7 @@ import { HORIZONTAL_ORIENTATION, VERTICAL_SCROLLABLE, DAY_SIZE, -} from '../../constants'; +} from '../constants'; import DayPicker from './DayPicker'; import OutsideClickHandler from './OutsideClickHandler'; diff --git a/src/components/SingleDatePicker.jsx b/src/components/SingleDatePicker.jsx index ca455f76..4f03949d 100644 --- a/src/components/SingleDatePicker.jsx +++ b/src/components/SingleDatePicker.jsx @@ -30,7 +30,7 @@ import { OPEN_UP, DAY_SIZE, ICON_BEFORE_POSITION, -} from '../../constants'; +} from '../constants'; const propTypes = forbidExtraProps({ ...withStylesPropTypes, diff --git a/src/components/SingleDatePickerInput.jsx b/src/components/SingleDatePickerInput.jsx index 44acd2ef..6b0b4d18 100644 --- a/src/components/SingleDatePickerInput.jsx +++ b/src/components/SingleDatePickerInput.jsx @@ -13,7 +13,7 @@ import CloseButton from './CloseButton'; import CalendarIcon from './CalendarIcon'; import openDirectionShape from '../shapes/OpenDirectionShape'; -import { ICON_BEFORE_POSITION, ICON_AFTER_POSITION, OPEN_DOWN } from '../../constants'; +import { ICON_BEFORE_POSITION, ICON_AFTER_POSITION, OPEN_DOWN } from '../constants'; const propTypes = forbidExtraProps({ ...withStylesPropTypes, diff --git a/src/constants.js b/src/constants.js new file mode 100644 index 00000000..c41193d1 --- /dev/null +++ b/src/constants.js @@ -0,0 +1,23 @@ +export const DISPLAY_FORMAT = 'L'; +export const ISO_FORMAT = 'YYYY-MM-DD'; +export const ISO_MONTH_FORMAT = 'YYYY-MM'; + +export const START_DATE = 'startDate'; +export const END_DATE = 'endDate'; + +export const HORIZONTAL_ORIENTATION = 'horizontal'; +export const VERTICAL_ORIENTATION = 'vertical'; +export const VERTICAL_SCROLLABLE = 'verticalScrollable'; + +export const ICON_BEFORE_POSITION = 'before'; +export const ICON_AFTER_POSITION = 'after'; + +export const ANCHOR_LEFT = 'left'; +export const ANCHOR_RIGHT = 'right'; + +export const OPEN_DOWN = 'down'; +export const OPEN_UP = 'up'; + +export const DAY_SIZE = 39; +export const BLOCKED_MODIFIER = 'blocked'; +export const WEEKDAYS = [0, 1, 2, 3, 4, 5, 6]; diff --git a/src/index.js b/src/index.js new file mode 100644 index 00000000..e94529f3 --- /dev/null +++ b/src/index.js @@ -0,0 +1,20 @@ +export { default as CalendarDay } from './components/CalendarDay'; +export { default as CalendarMonth } from './components/CalendarMonth'; +export { default as CalendarMonthGrid } from './components/CalendarMonthGrid'; +export { default as DateRangePicker } from './components/DateRangePicker'; +export { default as DateRangePickerInput } from './components/DateRangePickerInput'; +export { default as DateRangePickerInputController } from './components/DateRangePickerInputController'; +export { default as DateRangePickerShape } from './shapes/DateRangePickerShape'; +export { default as DayPicker } from './components/DayPicker'; +export { default as DayPickerRangeController } from './components/DayPickerRangeController'; +export { default as DayPickerSingleDateController } from './components/DayPickerSingleDateController'; +export { default as SingleDatePicker } from './components/SingleDatePicker'; +export { default as SingleDatePickerInput } from './components/SingleDatePickerInput'; +export { default as SingleDatePickerShape } from './shapes/SingleDatePickerShape'; +export { default as isInclusivelyAfterDay } from './utils/isInclusivelyAfterDay'; +export { default as isInclusivelyBeforeDay } from './utils/isInclusivelyBeforeDay'; +export { default as isNextDay } from './utils/isNextDay'; +export { default as isSameDay } from './utils/isSameDay'; +export { default as toISODateString } from './utils/toISODateString'; +export { default as toLocalizedDateString } from './utils/toLocalizedDateString'; +export { default as toMomentObject } from './utils/toMomentObject'; diff --git a/src/initialize.js b/src/initialize.js new file mode 100644 index 00000000..9b357071 --- /dev/null +++ b/src/initialize.js @@ -0,0 +1,3 @@ +import registerCSSInterfaceWithDefaultTheme from './utils/registerCSSInterfaceWithDefaultTheme'; + +registerCSSInterfaceWithDefaultTheme(); diff --git a/src/shapes/AnchorDirectionShape.js b/src/shapes/AnchorDirectionShape.js index 91834507..5bfdbe65 100644 --- a/src/shapes/AnchorDirectionShape.js +++ b/src/shapes/AnchorDirectionShape.js @@ -3,6 +3,6 @@ import PropTypes from 'prop-types'; import { ANCHOR_LEFT, ANCHOR_RIGHT, -} from '../../constants'; +} from '../constants'; export default PropTypes.oneOf([ANCHOR_LEFT, ANCHOR_RIGHT]); diff --git a/src/shapes/DayOfWeekShape.js b/src/shapes/DayOfWeekShape.js index 7a7b0872..39516d92 100644 --- a/src/shapes/DayOfWeekShape.js +++ b/src/shapes/DayOfWeekShape.js @@ -1,5 +1,5 @@ import PropTypes from 'prop-types'; -import { WEEKDAYS } from '../../constants'; +import { WEEKDAYS } from '../constants'; export default PropTypes.oneOf(WEEKDAYS); diff --git a/src/shapes/FocusedInputShape.js b/src/shapes/FocusedInputShape.js index 76e54115..db3a37cf 100644 --- a/src/shapes/FocusedInputShape.js +++ b/src/shapes/FocusedInputShape.js @@ -3,6 +3,6 @@ import PropTypes from 'prop-types'; import { START_DATE, END_DATE, -} from '../../constants'; +} from '../constants'; export default PropTypes.oneOf([START_DATE, END_DATE]); diff --git a/src/shapes/IconPositionShape.js b/src/shapes/IconPositionShape.js index 0fc7aeed..a9c53623 100644 --- a/src/shapes/IconPositionShape.js +++ b/src/shapes/IconPositionShape.js @@ -3,6 +3,6 @@ import PropTypes from 'prop-types'; import { ICON_BEFORE_POSITION, ICON_AFTER_POSITION, -} from '../../constants'; +} from '../constants'; export default PropTypes.oneOf([ICON_BEFORE_POSITION, ICON_AFTER_POSITION]); diff --git a/src/shapes/OpenDirectionShape.js b/src/shapes/OpenDirectionShape.js index da90c87d..204c2351 100644 --- a/src/shapes/OpenDirectionShape.js +++ b/src/shapes/OpenDirectionShape.js @@ -3,6 +3,6 @@ import PropTypes from 'prop-types'; import { OPEN_DOWN, OPEN_UP, -} from '../../constants'; +} from '../constants'; export default PropTypes.oneOf([OPEN_DOWN, OPEN_UP]); diff --git a/src/shapes/OrientationShape.js b/src/shapes/OrientationShape.js index 512302ef..b112529d 100644 --- a/src/shapes/OrientationShape.js +++ b/src/shapes/OrientationShape.js @@ -3,6 +3,6 @@ import PropTypes from 'prop-types'; import { HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION, -} from '../../constants'; +} from '../constants'; export default PropTypes.oneOf([HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION]); diff --git a/src/shapes/ScrollableOrientationShape.js b/src/shapes/ScrollableOrientationShape.js index 844a3580..b4262612 100644 --- a/src/shapes/ScrollableOrientationShape.js +++ b/src/shapes/ScrollableOrientationShape.js @@ -4,7 +4,7 @@ import { HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION, VERTICAL_SCROLLABLE, -} from '../../constants'; +} from '../constants'; export default PropTypes.oneOf([ HORIZONTAL_ORIENTATION, diff --git a/src/utils/getCalendarMonthWeeks.js b/src/utils/getCalendarMonthWeeks.js index fef9abe7..47b5bb25 100644 --- a/src/utils/getCalendarMonthWeeks.js +++ b/src/utils/getCalendarMonthWeeks.js @@ -1,6 +1,6 @@ import moment from 'moment'; -import { WEEKDAYS } from '../../constants'; +import { WEEKDAYS } from '../constants'; export default function getCalendarMonthWeeks( month, diff --git a/src/utils/getResponsiveContainerStyles.js b/src/utils/getResponsiveContainerStyles.js index 6ebb17cb..94e642b3 100644 --- a/src/utils/getResponsiveContainerStyles.js +++ b/src/utils/getResponsiveContainerStyles.js @@ -1,4 +1,4 @@ -import { ANCHOR_LEFT } from '../../constants'; +import { ANCHOR_LEFT } from '../constants'; export default function getResponsiveContainerStyles( anchorDirection, diff --git a/src/utils/toISODateString.js b/src/utils/toISODateString.js index b3da6484..de3cd5ac 100644 --- a/src/utils/toISODateString.js +++ b/src/utils/toISODateString.js @@ -2,7 +2,7 @@ import moment from 'moment'; import toMomentObject from './toMomentObject'; -import { ISO_FORMAT } from '../../constants'; +import { ISO_FORMAT } from '../constants'; export default function toISODateString(date, currentFormat) { const dateObj = moment.isMoment(date) ? date : toMomentObject(date, currentFormat); diff --git a/src/utils/toISOMonthString.js b/src/utils/toISOMonthString.js index 9845074c..d024d51c 100644 --- a/src/utils/toISOMonthString.js +++ b/src/utils/toISOMonthString.js @@ -2,7 +2,7 @@ import moment from 'moment'; import toMomentObject from './toMomentObject'; -import { ISO_MONTH_FORMAT } from '../../constants'; +import { ISO_MONTH_FORMAT } from '../constants'; export default function toISOMonthString(date, currentFormat) { const dateObj = moment.isMoment(date) ? date : toMomentObject(date, currentFormat); diff --git a/src/utils/toLocalizedDateString.js b/src/utils/toLocalizedDateString.js index d83ec644..e6e9e3e2 100644 --- a/src/utils/toLocalizedDateString.js +++ b/src/utils/toLocalizedDateString.js @@ -2,7 +2,7 @@ import moment from 'moment'; import toMomentObject from './toMomentObject'; -import { DISPLAY_FORMAT } from '../../constants'; +import { DISPLAY_FORMAT } from '../constants'; export default function toLocalizedDateString(date, currentFormat) { const dateObj = moment.isMoment(date) ? date : toMomentObject(date, currentFormat); diff --git a/src/utils/toMomentObject.js b/src/utils/toMomentObject.js index 51ab2a13..261922e5 100644 --- a/src/utils/toMomentObject.js +++ b/src/utils/toMomentObject.js @@ -1,6 +1,6 @@ import moment from 'moment'; -import { DISPLAY_FORMAT, ISO_FORMAT } from '../../constants'; +import { DISPLAY_FORMAT, ISO_FORMAT } from '../constants'; export default function toMomentObject(dateString, customFormat) { const dateFormats = customFormat ? diff --git a/test/components/CalendarDay_spec.jsx b/test/components/CalendarDay_spec.jsx index 30749777..77da4b3f 100644 --- a/test/components/CalendarDay_spec.jsx +++ b/test/components/CalendarDay_spec.jsx @@ -4,7 +4,7 @@ import sinon from 'sinon-sandbox'; import { shallow } from 'enzyme'; import moment from 'moment'; -import { BLOCKED_MODIFIER } from '../../constants'; +import { BLOCKED_MODIFIER } from '../../src/constants'; import CalendarDay, { PureCalendarDay } from '../../src/components/CalendarDay'; describe('CalendarDay', () => { diff --git a/test/components/DateRangePickerInputController_spec.jsx b/test/components/DateRangePickerInputController_spec.jsx index a68f78cd..79fae574 100644 --- a/test/components/DateRangePickerInputController_spec.jsx +++ b/test/components/DateRangePickerInputController_spec.jsx @@ -14,7 +14,7 @@ import isSameDay from '../../src/utils/isSameDay'; import { START_DATE, END_DATE, -} from '../../constants'; +} from '../../src/constants'; // Set to noon to mimic how days in the picker are configured internally const today = moment().startOf('day').hours(12); diff --git a/test/components/DateRangePicker_spec.jsx b/test/components/DateRangePicker_spec.jsx index 3c0a9a24..5cb2c64e 100644 --- a/test/components/DateRangePicker_spec.jsx +++ b/test/components/DateRangePicker_spec.jsx @@ -13,7 +13,7 @@ import DayPickerRangeController from '../../src/components/DayPickerRangeControl import { HORIZONTAL_ORIENTATION, START_DATE, -} from '../../constants'; +} from '../../src/constants'; const requiredProps = { onDatesChange: () => {}, diff --git a/test/components/DayPickerNavigation_spec.jsx b/test/components/DayPickerNavigation_spec.jsx index 506a2c55..e11b49ee 100644 --- a/test/components/DayPickerNavigation_spec.jsx +++ b/test/components/DayPickerNavigation_spec.jsx @@ -6,7 +6,7 @@ import { shallow } from 'enzyme'; import DayPickerNavigation from '../../src/components/DayPickerNavigation'; import { VERTICAL_SCROLLABLE, -} from '../../constants'; +} from '../../src/constants'; describe('DayPickerNavigation', () => { describe('#render', () => { diff --git a/test/components/DayPickerRangeController_spec.jsx b/test/components/DayPickerRangeController_spec.jsx index f37abe96..0cf38ff7 100644 --- a/test/components/DayPickerRangeController_spec.jsx +++ b/test/components/DayPickerRangeController_spec.jsx @@ -15,7 +15,7 @@ import isSameDay from '../../src/utils/isSameDay'; import * as isDayVisible from '../../src/utils/isDayVisible'; import getVisibleDays from '../../src/utils/getVisibleDays'; -import { START_DATE, END_DATE } from '../../constants'; +import { START_DATE, END_DATE } from '../../src/constants'; // Set to noon to mimic how days in the picker are configured internally const today = moment().startOf('day').hours(12); diff --git a/test/components/DayPicker_spec.jsx b/test/components/DayPicker_spec.jsx index 4c5c1d7f..2aa3dc1a 100644 --- a/test/components/DayPicker_spec.jsx +++ b/test/components/DayPicker_spec.jsx @@ -14,7 +14,7 @@ import { HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION, VERTICAL_SCROLLABLE, -} from '../../constants'; +} from '../../src/constants'; const today = moment(); const event = { preventDefault() {}, stopPropagation() {} }; diff --git a/test/utils/getResponsiveContainerStyles_spec.js b/test/utils/getResponsiveContainerStyles_spec.js index ad5f449e..07a2908d 100644 --- a/test/utils/getResponsiveContainerStyles_spec.js +++ b/test/utils/getResponsiveContainerStyles_spec.js @@ -3,7 +3,7 @@ import wrap from 'mocha-wrap'; import getResponsiveContainerStyles from '../../src/utils/getResponsiveContainerStyles'; -import { ANCHOR_LEFT, ANCHOR_RIGHT } from '../../constants'; +import { ANCHOR_LEFT, ANCHOR_RIGHT } from '../../src/constants'; const describeUnlessWindow = typeof window === 'undefined' ? describe : describe.skip; diff --git a/test/utils/toISODateString_spec.js b/test/utils/toISODateString_spec.js index fdcb9287..d089c8c0 100644 --- a/test/utils/toISODateString_spec.js +++ b/test/utils/toISODateString_spec.js @@ -2,7 +2,7 @@ import moment from 'moment'; import { expect } from 'chai'; import toISODateString from '../../src/utils/toISODateString'; -import { ISO_FORMAT } from '../../constants'; +import { ISO_FORMAT } from '../../src/constants'; describe('toISODateString', () => { it('returns null for falsy argument', () => { diff --git a/test/utils/toISOMonthString_spec.js b/test/utils/toISOMonthString_spec.js index a83c5ecb..943eaf2c 100644 --- a/test/utils/toISOMonthString_spec.js +++ b/test/utils/toISOMonthString_spec.js @@ -1,7 +1,7 @@ import moment from 'moment'; import { expect } from 'chai'; -import { ISO_FORMAT, ISO_MONTH_FORMAT } from '../../constants'; +import { ISO_FORMAT, ISO_MONTH_FORMAT } from '../../src/constants'; import toISOMonthString from '../../src/utils/toISOMonthString'; describe('#toISOMonthString', () => { diff --git a/test/utils/toLocalizedDateString_spec.js b/test/utils/toLocalizedDateString_spec.js index 134e104d..4bfbcde4 100644 --- a/test/utils/toLocalizedDateString_spec.js +++ b/test/utils/toLocalizedDateString_spec.js @@ -2,7 +2,7 @@ import moment from 'moment'; import { expect } from 'chai'; import toLocalizedDateString from '../../src/utils/toLocalizedDateString'; -import { ISO_FORMAT } from '../../constants'; +import { ISO_FORMAT } from '../../src/constants'; describe('toLocalizedDateString', () => { it('returns null for falsy argument', () => { -- GitLab