@spothero/ui 15.0.0-beta.2 → 15.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +2 -2
  2. package/backlog/Chart/Chart.js +2 -2
  3. package/backlog/DateTime/DatePicker.js +4 -4
  4. package/backlog/DateTime/DatePickerCalendar.js +8 -8
  5. package/backlog/DateTime/DatePickerCalendarWithRange.js +6 -6
  6. package/backlog/DateTime/DateTimeRangePicker.js +6 -4
  7. package/backlog/DateTime/TimePicker.js +3 -3
  8. package/backlog/ErrorBoundary/ErrorBoundary.js +7 -9
  9. package/backlog/Flyout/Flyout.js +5 -5
  10. package/backlog/Form/Form.js +5 -3
  11. package/backlog/GooglePlacesSearchInput/GooglePlacesSearchInput.js +1 -4
  12. package/backlog/Notification/Notification.js +4 -4
  13. package/backlog/Portal/Portal.js +3 -3
  14. package/backlog/RenderInBody/RenderInBody.js +2 -2
  15. package/backlog/Select/Select.js +3 -3
  16. package/backlog/SelectControlled/SelectControlled.js +3 -3
  17. package/backlog/Tooltip/Tooltip.js +6 -6
  18. package/backlog/utils/animation.js +84 -0
  19. package/backlog/utils/date.js +233 -0
  20. package/backlog/utils/dom.js +441 -0
  21. package/backlog/utils/environment.js +422 -0
  22. package/backlog/utils/number.js +43 -0
  23. package/backlog/utils/time.js +282 -0
  24. package/backlog/v1/components/Image/Image.js +2 -2
  25. package/backlog/v1/components/Modal/Modal.js +12 -12
  26. package/backlog/v1/components/Modal/ModalContent.js +3 -3
  27. package/package.json +1 -2
  28. package/styles/Chart/Chart.jsx +1 -1
  29. package/styles/DateTime/DatePicker.jsx +1 -1
  30. package/styles/DateTime/DatePickerCalendar.jsx +1 -1
  31. package/styles/DateTime/DatePickerCalendarWithRange.jsx +1 -1
  32. package/styles/DateTime/DateTimeRangePicker.jsx +2 -1
  33. package/styles/DateTime/TimePicker.jsx +1 -1
  34. package/styles/ErrorBoundary/ErrorBoundary.jsx +7 -6
  35. package/styles/Flyout/Flyout.jsx +1 -1
  36. package/styles/Form/Form.jsx +2 -1
  37. package/styles/GooglePlacesSearchInput/GooglePlacesSearchInput.jsx +2 -2
  38. package/styles/Notification/Notification.jsx +1 -1
  39. package/styles/Portal/Portal.jsx +1 -1
  40. package/styles/RenderInBody/RenderInBody.jsx +1 -1
  41. package/styles/Select/Select.jsx +1 -1
  42. package/styles/SelectControlled/SelectControlled.jsx +1 -1
  43. package/styles/Tooltip/Tooltip.jsx +1 -1
  44. package/styles/utils/animation.js +75 -0
  45. package/styles/utils/date.js +226 -0
  46. package/styles/utils/dom.js +428 -0
  47. package/styles/utils/environment.js +425 -0
  48. package/styles/utils/number.js +33 -0
  49. package/styles/utils/time.js +268 -0
  50. package/styles/v1/components/Image/Image.jsx +1 -1
  51. package/styles/v1/components/Modal/Modal.jsx +1 -1
  52. package/styles/v1/components/Modal/ModalContent.jsx +1 -1
  53. package/styles/v1/components/Modal/stories/Content.stories.js +1 -1
  54. package/styles/v2/components/Image/Image.jsx +1 -1
  55. package/v1/index.js +1 -1
  56. package/v1/index.js.LICENSE.txt +0 -29
  57. package/v1/index.js.map +1 -1
  58. package/v2/index.js +1 -1
  59. package/v2/index.js.LICENSE.txt +0 -29
  60. package/v2/index.js.map +1 -1
@@ -0,0 +1,282 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
11
+
12
+ var _isNumber = _interopRequireDefault(require("lodash/isNumber"));
13
+
14
+ var _isString = _interopRequireDefault(require("lodash/isString"));
15
+
16
+ var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
17
+
18
+ var _number = _interopRequireDefault(require("./number"));
19
+
20
+ // import StringUtils from '../string/string';
21
+
22
+ /**
23
+ * Utilities for working with times.
24
+ * @module TimeUtils
25
+ */
26
+ var TimeUtils = {
27
+ // /**
28
+ // * Normalizes the provided time down to the provided step.
29
+ // * @static
30
+ // * @function normalizeToStep
31
+ // * @param {String} time - The input value in the format hh:mm A.
32
+ // * @param {Number} [step=1] - The step to round down to.
33
+ // * @example
34
+ // * TimeUtils.normalizeToStep('07:07 PM', 15); // '07:00 PM'
35
+ // * @returns {String} - The normalized time.
36
+ // */
37
+ // normalizeToStep(time, step = 1) {
38
+ // if (isEmpty(time)) {
39
+ // return time;
40
+ // }
41
+ //
42
+ // if (!isString(time)) {
43
+ // throw new Error('The supplied time is not a string.');
44
+ // }
45
+ //
46
+ // const {hours, mins} = TimeUtils.getValuesFromString(time, step);
47
+ //
48
+ // return TimeUtils.getFromValuesAsString(hours, mins);
49
+ // },
50
+ //
51
+
52
+ /**
53
+ * Provides the hours, minutes, and meridiem from a time string.
54
+ * @static
55
+ * @function getValuesFromString
56
+ * @param {String} time - The input value in the format hh:mm A.
57
+ * @param {Number} [step=1] - The step to round down to.
58
+ * @example
59
+ * TimeUtils.getValuesFromString('10:19 AM');
60
+ * @returns {Object} - The object containing the hours, minutes, and meridiem.
61
+ */
62
+ getValuesFromString: function getValuesFromString(time) {
63
+ var step = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
64
+
65
+ if ((0, _isEmpty.default)(time)) {
66
+ return time;
67
+ }
68
+
69
+ if (!(0, _isString.default)(time)) {
70
+ throw new Error('The supplied time is not a string.');
71
+ }
72
+
73
+ var firstPartials = time.split(':');
74
+ var secondPartials = firstPartials[1].split(' ');
75
+ var isAM = secondPartials[1] === 'AM';
76
+ var mins = parseInt(secondPartials[0], 10);
77
+
78
+ var minsRounded = _number.default.roundDownToNearestStep(mins, step);
79
+
80
+ var hours = parseInt(firstPartials[0], 10);
81
+
82
+ if (isAM && hours === 12) {
83
+ hours = 0;
84
+ } else if (!isAM && hours !== 12) {
85
+ hours += 12;
86
+ }
87
+
88
+ return {
89
+ hours: hours,
90
+ mins: minsRounded,
91
+ isAM: isAM
92
+ };
93
+ },
94
+ //
95
+ // /**
96
+ // * Provides the formatted time from hours and minutes values.
97
+ // * @static
98
+ // * @function getFromValuesAsString
99
+ // * @param {Number} hours - The hours in a 24 hour format.
100
+ // * @param {Number} minutes - The minutes from 0 - 60.
101
+ // * @param {Boolean} [roundMinutesDown=false] - Whether to round the minutes down to the provided step.
102
+ // * @param {Number} [step=1] - The step to round minutes down to.
103
+ // * @example
104
+ // * TimeUtils.getFromValuesAsString(20, 35); // '08:35 PM'
105
+ // * @returns {String} - The formatted time.
106
+ // */
107
+ // getFromValuesAsString(hours, minutes, roundMinutesDown = false, step = 1) {
108
+ // const meridiem = hours < 12 ? 'AM' : 'PM';
109
+ // let newHours = hours;
110
+ // let newMinutes = minutes;
111
+ //
112
+ // if (newHours > 12) {
113
+ // newHours -= 12;
114
+ // } else if (newHours === 0) {
115
+ // newHours = 12;
116
+ // }
117
+ //
118
+ // if (roundMinutesDown) {
119
+ // newMinutes = NumberUtils.roundDownToNearestStep(newMinutes, step);
120
+ // }
121
+ //
122
+ // return `${StringUtils.padWith(newHours)}:${StringUtils.padWith(
123
+ // newMinutes
124
+ // )} ${meridiem}`;
125
+ // },
126
+ //
127
+ // /**
128
+ // * Converts a mobile input time to a string in the format hh:mm A.
129
+ // * @static
130
+ // * @function getMobileAsString
131
+ // * @param {String} time - The input value in the format HH:mm (24 hour format).
132
+ // * @param {Number} [step=1] - The step to round down to.
133
+ // * @example
134
+ // * TimeUtils.getMobileAsString('22:19'); // 10:19 PM
135
+ // * @returns {String} - The formatted time.
136
+ // */
137
+ // getMobileAsString(time, step = 1) {
138
+ // if (!isString(time)) {
139
+ // throw new Error('The supplied time is not a string.');
140
+ // }
141
+ //
142
+ // const frags = time.split(':');
143
+ // const mins = parseInt(frags[1], 10);
144
+ // const minsRounded = NumberUtils.roundDownToNearestStep(mins, step);
145
+ // const hours = parseInt(frags[0], 10);
146
+ // const meridiem = hours < 12 ? 'AM' : 'PM';
147
+ // let hh = hours;
148
+ //
149
+ // if (hours > 12) {
150
+ // hh -= 12;
151
+ // } else if (hours === 0) {
152
+ // hh = 12;
153
+ // }
154
+ //
155
+ // return `${StringUtils.padWith(hh)}:${StringUtils.padWith(
156
+ // minsRounded
157
+ // )} ${meridiem}`;
158
+ // },
159
+ //
160
+ // /**
161
+ // * Converts a time to a date object.
162
+ // * @static
163
+ // * @function getAsDate
164
+ // * @param {String} time - The input value in the format hh:mm A.
165
+ // * @example
166
+ // * TimeUtils.getAsDate('10:19 PM');
167
+ // * @returns {Date} - The time inside of a date object.
168
+ // */
169
+ // getAsDate(time) {
170
+ // if (isEmpty(time)) {
171
+ // return null;
172
+ // }
173
+ //
174
+ // if (!isString(time)) {
175
+ // throw new Error('The supplied time is not a string.');
176
+ // }
177
+ //
178
+ // const {hours, mins} = TimeUtils.getValuesFromString(time);
179
+ // const d = new Date();
180
+ //
181
+ // d.setHours(hours);
182
+ // d.setMinutes(mins);
183
+ // d.setSeconds(0);
184
+ //
185
+ // return d;
186
+ // },
187
+
188
+ /**
189
+ * Converts a time to a moment instance.
190
+ * @static
191
+ * @function getAsMoment
192
+ * @param {String} time - The input value in the format hh:mm A.
193
+ * @example
194
+ * TimeUtils.getAsMoment('10:19 PM');
195
+ * @returns {Moment} - The time inside of a moment instance.
196
+ */
197
+ getAsMoment: function getAsMoment(time) {
198
+ if ((0, _isEmpty.default)(time)) {
199
+ return null;
200
+ }
201
+
202
+ if (!(0, _isString.default)(time)) {
203
+ throw new Error('The supplied time is not a string.');
204
+ }
205
+
206
+ var _TimeUtils$getValuesF = TimeUtils.getValuesFromString(time),
207
+ hours = _TimeUtils$getValuesF.hours,
208
+ mins = _TimeUtils$getValuesF.mins;
209
+
210
+ return (0, _momentTimezone.default)([1, 1]).startOf('day').add(hours, 'hours').add(mins, 'minutes');
211
+ },
212
+
213
+ /**
214
+ * Generate an array of times.
215
+ * @static
216
+ * @function getTimes
217
+ * @param {Object} data - The data to pass to the function.
218
+ * @param {Number} [data.step=30] - Increment times by this many minutes.
219
+ * @param {String} [data.format='hh:mm A'] - Moment.js format (http://momentjs.com/docs/#/displaying/format/).
220
+ * @param {String} [data.ignoreBefore] - Number of minutes to ignore times before in the output.
221
+ * @param {String} [data.ignoreAfter] - Number of minutes to ignore times after in the output.
222
+ * @example
223
+ * TimeUtils.getTimes({
224
+ * step: 30,
225
+ * format: 'hh:mm A'
226
+ * });
227
+ * @returns {Array} times - An array of times.
228
+ */
229
+ getTimes: function getTimes() {
230
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
231
+ _ref$step = _ref.step,
232
+ step = _ref$step === void 0 ? 30 : _ref$step,
233
+ _ref$format = _ref.format,
234
+ format = _ref$format === void 0 ? 'hh:mm A' : _ref$format,
235
+ ignoreBefore = _ref.ignoreBefore,
236
+ ignoreAfter = _ref.ignoreAfter;
237
+
238
+ if (ignoreBefore && !(0, _isNumber.default)(ignoreBefore)) {
239
+ throw new Error('The ignoreBefore value passed was not a number.');
240
+ }
241
+
242
+ if (ignoreAfter && !(0, _isNumber.default)(ignoreAfter)) {
243
+ throw new Error('The ignoreAfter value passed was not a number.');
244
+ }
245
+
246
+ if (ignoreBefore && ignoreAfter && ignoreBefore > ignoreAfter) {
247
+ throw new Error('The value of ignoreBefore should be less than the value of ignoreAfter.');
248
+ }
249
+
250
+ var dateTime = (0, _momentTimezone.default)([0, 0]);
251
+ var total = 1440;
252
+ var len = total / step;
253
+ var times = [];
254
+ var beforeMoment = ignoreBefore ? dateTime.clone().startOf('day').add(ignoreBefore, 'minutes') : null;
255
+ var afterMoment = ignoreAfter ? dateTime.clone().startOf('day').add(ignoreAfter, 'minutes') : null;
256
+ var i = 0;
257
+ var id = 0;
258
+ var shouldAdd = true;
259
+ var time;
260
+
261
+ for (i; i < len; i++) {
262
+ id = i * step;
263
+ time = dateTime.clone().startOf('day').add(id, 'minutes');
264
+ shouldAdd = beforeMoment ? time.isSameOrAfter(beforeMoment) : shouldAdd;
265
+
266
+ if (shouldAdd) {
267
+ shouldAdd = afterMoment ? time.isSameOrBefore(afterMoment) : shouldAdd;
268
+ }
269
+
270
+ if (shouldAdd) {
271
+ times.push({
272
+ id: id,
273
+ formatted: time.format(format)
274
+ });
275
+ }
276
+ }
277
+
278
+ return times;
279
+ }
280
+ };
281
+ var _default = TimeUtils;
282
+ exports.default = _default;
@@ -43,7 +43,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
43
43
 
44
44
  var _reactLazyLoad = _interopRequireDefault(require("react-lazy-load"));
45
45
 
46
- var _utils = require("@spothero/utils");
46
+ var _environment = _interopRequireDefault(require("../../../utils/environment"));
47
47
 
48
48
  var _PulseLoader = _interopRequireDefault(require("../../../PulseLoader/PulseLoader"));
49
49
 
@@ -113,7 +113,7 @@ var Image = /*#__PURE__*/function (_Component) {
113
113
  return;
114
114
  }
115
115
 
116
- var tmpl = cloudinaryTemplate ? cloudinaryTemplate : (0, _concat.default)(_context = (0, _concat.default)(_context2 = "https://res.cloudinary.com/".concat(cloudinaryCloudName, "/image/upload/$w_{{WIDTH}},$h_{{HEIGHT}},$q_{{QUALITY}}/c_fill,f_auto,fl_progressive,dpr_")).call(_context2, _utils.EnvironmentUtils.isHighDensityDisplay() ? 2 : 1, ",h_$h,q_$q,w_$w/")).call(_context, cloudinaryImageId);
116
+ var tmpl = cloudinaryTemplate ? cloudinaryTemplate : (0, _concat.default)(_context = (0, _concat.default)(_context2 = "https://res.cloudinary.com/".concat(cloudinaryCloudName, "/image/upload/$w_{{WIDTH}},$h_{{HEIGHT}},$q_{{QUALITY}}/c_fill,f_auto,fl_progressive,dpr_")).call(_context2, _environment.default.isHighDensityDisplay() ? 2 : 1, ",h_$h,q_$q,w_$w/")).call(_context, cloudinaryImageId);
117
117
  this._imageProps.src = (0, _template.default)(tmpl, {
118
118
  interpolate: /{{([\s\S]+?)}}/g // matches template vars in the format '{{ var }}' or '{{var}}'
119
119
 
@@ -41,7 +41,7 @@ var _chevronLeft = _interopRequireDefault(require("@spothero/icons/chevron-left"
41
41
 
42
42
  var _times = _interopRequireDefault(require("@spothero/icons/times"));
43
43
 
44
- var _utils = require("@spothero/utils");
44
+ var _dom = _interopRequireDefault(require("../../../utils/dom"));
45
45
 
46
46
  var _Button = _interopRequireDefault(require("../Button/Button"));
47
47
 
@@ -83,7 +83,7 @@ var Modal = /*#__PURE__*/function (_PureComponent) {
83
83
  useShim = _this$props.useShim,
84
84
  closeOnShimClick = _this$props.closeOnShimClick;
85
85
 
86
- if (useShim && closeOnShimClick && _utils.DOMUtils.hasClass(evt.target, 'Modal-wrapper')) {
86
+ if (useShim && closeOnShimClick && _dom.default.hasClass(evt.target, 'Modal-wrapper')) {
87
87
  _this._onCloseClick();
88
88
  }
89
89
  });
@@ -122,7 +122,7 @@ var Modal = /*#__PURE__*/function (_PureComponent) {
122
122
  var newWidth = (0, _isNumber.default)(width) ? "".concat(width, "px") // numerical width, set accordingly
123
123
  : width; // percentage width, retain and set
124
124
 
125
- _utils.DOMUtils.addClass(_this2._container, 'Modal-container-custom');
125
+ _dom.default.addClass(_this2._container, 'Modal-container-custom');
126
126
 
127
127
  _this2._container.style.width = newWidth;
128
128
  }
@@ -133,7 +133,7 @@ var Modal = /*#__PURE__*/function (_PureComponent) {
133
133
  }, {
134
134
  key: "componentWillUnmount",
135
135
  value: function componentWillUnmount() {
136
- _utils.DOMUtils.removeClass('html', 'Modal-open');
136
+ _dom.default.removeClass('html', 'Modal-open');
137
137
  }
138
138
  }, {
139
139
  key: "_show",
@@ -148,14 +148,14 @@ var Modal = /*#__PURE__*/function (_PureComponent) {
148
148
  var node = useShim ? this._modal : this._container;
149
149
  var showClass = useShim ? 'Modal-showing' : 'Modal-container-showing';
150
150
 
151
- _utils.DOMUtils.addClass(node, showClass);
151
+ _dom.default.addClass(node, showClass);
152
152
 
153
153
  if (renderInBody) {
154
- _utils.DOMUtils.addClass('html', 'Modal-open');
154
+ _dom.default.addClass('html', 'Modal-open');
155
155
  }
156
156
 
157
157
  if (!useShim) {
158
- _utils.DOMUtils.addClass(this._modal, 'Modal-no-shim');
158
+ _dom.default.addClass(this._modal, 'Modal-no-shim');
159
159
  }
160
160
 
161
161
  if (animateOnShow) {
@@ -268,17 +268,17 @@ var Modal = /*#__PURE__*/function (_PureComponent) {
268
268
  var showClass = useShim ? 'Modal-showing' : 'Modal-container-showing';
269
269
 
270
270
  if (!animateOnShow) {
271
- _utils.DOMUtils.addClass(node, showClass.replace('showing', 'animated'));
271
+ _dom.default.addClass(node, showClass.replace('showing', 'animated'));
272
272
  }
273
273
 
274
274
  if (!useShim) {
275
- _utils.DOMUtils.removeClass(this._modal, 'Modal-no-shim');
275
+ _dom.default.removeClass(this._modal, 'Modal-no-shim');
276
276
  }
277
277
 
278
- _utils.DOMUtils.removeClass(node, showClass);
278
+ _dom.default.removeClass(node, showClass);
279
279
 
280
280
  if (renderInBody) {
281
- _utils.DOMUtils.removeClass('html', 'Modal-open');
281
+ _dom.default.removeClass('html', 'Modal-open');
282
282
  }
283
283
 
284
284
  (_window$transitionEnd2 = (_window2 = window).transitionEnd) === null || _window$transitionEnd2 === void 0 ? void 0 : _window$transitionEnd2.call(_window2, node).bind(function () {
@@ -286,7 +286,7 @@ var Modal = /*#__PURE__*/function (_PureComponent) {
286
286
  _this5._isAnimating = false;
287
287
 
288
288
  if (!animateOnShow) {
289
- _utils.DOMUtils.removeClass(node, "".concat(showClass, "-animated"));
289
+ _dom.default.removeClass(node, "".concat(showClass, "-animated"));
290
290
  }
291
291
 
292
292
  if (onHidden) {
@@ -41,7 +41,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
41
41
 
42
42
  var _ssrWindow = require("ssr-window");
43
43
 
44
- var _utils = require("@spothero/utils");
44
+ var _dom = _interopRequireDefault(require("../../../utils/dom"));
45
45
 
46
46
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
47
47
 
@@ -70,10 +70,10 @@ var ModalContent = /*#__PURE__*/function (_Component) {
70
70
  var calculatedMax = maxHeight;
71
71
 
72
72
  if ((0, _isString.default)(calculatedMax) && calculatedMax === 'auto') {
73
- var modalWrapperEl = _utils.DOMUtils.parent(_this._container, '.Modal-wrapper');
73
+ var modalWrapperEl = _dom.default.parent(_this._container, '.Modal-wrapper');
74
74
 
75
75
  var titleEl = modalWrapperEl.querySelector('.Modal-title');
76
- var finalContentAreaHeight = (0, _isUndefined.default)(contentAreaHeight) ? _utils.DOMUtils.height(modalWrapperEl, true, false) - _utils.DOMUtils.height(titleEl) : (0, _isFunction.default)(contentAreaHeight) ? contentAreaHeight() : contentAreaHeight;
76
+ var finalContentAreaHeight = (0, _isUndefined.default)(contentAreaHeight) ? _dom.default.height(modalWrapperEl, true, false) - _dom.default.height(titleEl) : (0, _isFunction.default)(contentAreaHeight) ? contentAreaHeight() : contentAreaHeight;
77
77
  calculatedMax = windowWidth < 768 ? finalContentAreaHeight : finalContentAreaHeight - verticalModalPadding - 24; // 24 is margin-bottom
78
78
  }
79
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spothero/ui",
3
- "version": "15.0.0-beta.2",
3
+ "version": "15.0.0-beta.3",
4
4
  "description": "SpotHero's React component UI library.",
5
5
  "main": "v2/index.js",
6
6
  "module": "v2/index.js",
@@ -133,7 +133,6 @@
133
133
  "@chakra-ui/theme-tools": "1.3.6",
134
134
  "@emotion/react": "11.1.5",
135
135
  "@emotion/styled": "11.1.5",
136
- "@spothero/utils": "10.1.0-beta.2",
137
136
  "@storybook/addon-a11y": "6.3.4",
138
137
  "axe-core": "4.1.3",
139
138
  "chartist": "0.11.4",
@@ -4,7 +4,7 @@ import React, {Component} from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import classNames from 'classnames';
6
6
  import Chartist from 'chartist';
7
- import {DOMUtils} from '@spothero/utils';
7
+ import DOMUtils from '../utils/dom';
8
8
 
9
9
  export default class Chart extends Component {
10
10
  static propTypes = {
@@ -6,7 +6,7 @@ import {document} from 'ssr-window';
6
6
  import TetherComponent from 'react-tether';
7
7
  import omit from 'lodash/omit';
8
8
  import IconCalendar from '@spothero/icons/calendar';
9
- import {DOMUtils} from '@spothero/utils';
9
+ import DOMUtils from '../utils/dom';
10
10
  import DatePickerCalendar from './DatePickerCalendar';
11
11
  import TextInput from '../TextInput/TextInput';
12
12
  import Portal from '../Portal/Portal';
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import classNames from 'classnames';
5
5
  import moment from 'moment';
6
6
  import DayPicker, {DateUtils as DayPickerDateUtils} from 'react-day-picker';
7
- import {DateUtils} from '@spothero/utils';
7
+ import DateUtils from '../utils/date';
8
8
  import DatePickerCalendarNavigation from './DatePickerCalendarNavigation';
9
9
 
10
10
  const DATE = new Date();
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import moment from 'moment';
5
5
  import DayPicker, {DateUtils as DayPickerDateUtils} from 'react-day-picker';
6
- import {DateUtils} from '@spothero/utils';
6
+ import DateUtils from '../utils/date';
7
7
  import DatePickerCalendarNavigation from './DatePickerCalendarNavigation';
8
8
 
9
9
  const DATE = new Date();
@@ -2,7 +2,8 @@ import React, {Component} from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import uuidV4 from 'uuid/v4';
5
- import {DateUtils, TimeUtils} from '@spothero/utils';
5
+ import DateUtils from '../utils/date';
6
+ import TimeUtils from '../utils/time';
6
7
  import DateTimePicker from './DateTimePicker';
7
8
 
8
9
  const TOOLTIP_TYPES = ['date', 'time', 'none'];
@@ -4,7 +4,7 @@ import classNames from 'classnames';
4
4
  import moment from 'moment';
5
5
  import omit from 'lodash/omit';
6
6
  import IconClock from '@spothero/icons/clock';
7
- import {TimeUtils} from '@spothero/utils';
7
+ import TimeUtils from '../utils/time';
8
8
  import Select from '../Select/Select';
9
9
 
10
10
  export default class TimePicker extends Component {
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import classNames from 'classnames';
3
3
  import React, {Component} from 'react';
4
- import {SentryUtils} from '@spothero/utils';
4
+ // import SentryUtils from '@spothero/utils/sentry';
5
5
 
6
6
  export default class ErrorBoundary extends Component {
7
7
  static propTypes = {
@@ -40,11 +40,12 @@ export default class ErrorBoundary extends Component {
40
40
  }
41
41
 
42
42
  if (reportToSentry) {
43
- SentryUtils.addData(info);
44
- SentryUtils.sendMessage({
45
- message: error.message,
46
- level: 'error',
47
- });
43
+ //TODO: breaking change. pass function prop that invokes these in parent application
44
+ // SentryUtils.addData(info);
45
+ // SentryUtils.sendMessage({
46
+ // message: error.message,
47
+ // level: 'error',
48
+ // });
48
49
  }
49
50
  }
50
51
 
@@ -3,7 +3,7 @@ import React, {Component} from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import classNames from 'classnames';
5
5
  import IconTimes from '@spothero/icons/times';
6
- import {DOMUtils} from '@spothero/utils';
6
+ import DOMUtils from '../utils/dom';
7
7
  import Button from 'v1/components/Button/Button';
8
8
  import Portal from '../Portal/Portal';
9
9
 
@@ -2,7 +2,8 @@ import React, {Component} from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import serialize from 'form-serialize';
5
- import {DOMUtils, AnimationUtils} from '@spothero/utils';
5
+ import AnimationUtils from '../utils/animation';
6
+ import DOMUtils from '../utils/dom';
6
7
 
7
8
  export default class Form extends Component {
8
9
  static propTypes = {
@@ -3,7 +3,7 @@ import React, {Component} from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import classNames from 'classnames';
5
5
  import IconSearch from '@spothero/icons/search';
6
- import {EnvironmentUtils} from '@spothero/utils';
6
+ // import EnvironmentUtils from '@spothero/utils/environment';
7
7
  import AutoSuggestInput from '../AutoSuggestInput/AutoSuggestInput';
8
8
  import TextInputPropTypes from '../TextInput/TextInputPropTypes';
9
9
 
@@ -50,7 +50,7 @@ export default class GooglePlacesSearchInput extends Component {
50
50
  super(props);
51
51
 
52
52
  const {googleMaps} = props;
53
- const isBrowser = EnvironmentUtils.isBrowser();
53
+ const isBrowser = typeof window !== 'undefined'; //EnvironmentUtils.isBrowser();
54
54
 
55
55
  this._suggestionFetch = throttle(this._searchSuggestions, 500);
56
56
  this._gmaps = googleMaps;
@@ -8,7 +8,7 @@ import IconExclamationCircle from '@spothero/icons/exclamation-circle';
8
8
  import IconExclamationTriangle from '@spothero/icons/exclamation-triangle';
9
9
  import IconHeroCar from '@spothero/icons/hero-car';
10
10
  import IconTimes from '@spothero/icons/times';
11
- import {DOMUtils} from '@spothero/utils';
11
+ import DOMUtils from '../utils/dom';
12
12
  import Button from 'v1/components/Button/Button';
13
13
  import NotificationPropTypes from './NotificationPropTypes';
14
14
 
@@ -5,7 +5,7 @@ import {createPortal} from 'react-dom';
5
5
  import PropTypes from 'prop-types';
6
6
  import {Provider} from 'react-redux';
7
7
  import {document} from 'ssr-window';
8
- import {DOMUtils} from '@spothero/utils';
8
+ import DOMUtils from '../utils/dom';
9
9
 
10
10
  export default class Portal extends PureComponent {
11
11
  static propTypes = {
@@ -2,7 +2,7 @@ import React, {Component} from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import {unmountComponentAtNode, render as renderDOM} from 'react-dom';
4
4
  import {Provider} from 'react-redux';
5
- import {DOMUtils} from '@spothero/utils';
5
+ import DOMUtils from '../utils/dom';
6
6
 
7
7
  export default class RenderInBody extends Component {
8
8
  static propTypes = {
@@ -3,7 +3,7 @@ import React, {Component, cloneElement} from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import cn from 'classnames';
5
5
  import IconChevronDown from '@spothero/icons/chevron-down';
6
- import {DOMUtils} from '@spothero/utils';
6
+ import DOMUtils from '../utils/dom';
7
7
  import Loader from 'v1/components/Loader/Loader';
8
8
  import omit from 'lodash/omit';
9
9
  // import {
@@ -3,7 +3,7 @@ import React, {Component, cloneElement} from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import cn from 'classnames';
5
5
  import IconChevronDown from '@spothero/icons/chevron-down';
6
- import {DOMUtils} from '@spothero/utils';
6
+ import DOMUtils from '../utils/dom';
7
7
  import Loader from 'v1/components/Loader/Loader';
8
8
  // import {
9
9
  // SelectItemPropTypes,
@@ -3,7 +3,7 @@ import React, {Component} from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import classNames from 'classnames';
5
5
  import IconTimes from '@spothero/icons/times';
6
- import {DOMUtils} from '@spothero/utils';
6
+ import DOMUtils from '../utils/dom';
7
7
  import Button from 'v1/components/Button/Button';
8
8
  import Portal from '../Portal/Portal';
9
9