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

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 +1 -1
  3. package/backlog/DateTime/DatePicker.js +1 -1
  4. package/backlog/DateTime/DatePickerCalendar.js +1 -1
  5. package/backlog/DateTime/DatePickerCalendarWithRange.js +1 -1
  6. package/backlog/DateTime/DateTimeRangePicker.js +2 -2
  7. package/backlog/DateTime/TimePicker.js +1 -1
  8. package/backlog/ErrorBoundary/ErrorBoundary.js +9 -7
  9. package/backlog/Flyout/Flyout.js +1 -1
  10. package/backlog/Form/Form.js +2 -2
  11. package/backlog/GooglePlacesSearchInput/GooglePlacesSearchInput.js +4 -1
  12. package/backlog/Notification/Notification.js +1 -1
  13. package/backlog/Portal/Portal.js +1 -1
  14. package/backlog/RenderInBody/RenderInBody.js +1 -1
  15. package/backlog/Select/Select.js +1 -1
  16. package/backlog/SelectControlled/SelectControlled.js +1 -1
  17. package/backlog/Tooltip/Tooltip.js +1 -1
  18. package/backlog/v1/components/Image/Image.js +1 -1
  19. package/backlog/v1/components/Modal/Modal.js +1 -1
  20. package/backlog/v1/components/Modal/ModalContent.js +1 -1
  21. package/package.json +21 -11
  22. package/styles/Chart/Chart.jsx +1 -1
  23. package/styles/DateTime/DatePicker.jsx +1 -1
  24. package/styles/DateTime/DatePickerCalendar.jsx +1 -1
  25. package/styles/DateTime/DatePickerCalendarWithRange.jsx +1 -1
  26. package/styles/DateTime/DateTimeRangePicker.jsx +2 -2
  27. package/styles/DateTime/TimePicker.jsx +1 -1
  28. package/styles/ErrorBoundary/ErrorBoundary.jsx +6 -7
  29. package/styles/Flyout/Flyout.jsx +1 -1
  30. package/styles/Form/Form.jsx +2 -2
  31. package/styles/GooglePlacesSearchInput/GooglePlacesSearchInput.jsx +2 -2
  32. package/styles/Notification/Notification.jsx +1 -1
  33. package/styles/Portal/Portal.jsx +1 -1
  34. package/styles/RenderInBody/RenderInBody.jsx +1 -1
  35. package/styles/Select/Select.jsx +1 -1
  36. package/styles/SelectControlled/SelectControlled.jsx +1 -1
  37. package/styles/Tooltip/Tooltip.jsx +1 -1
  38. package/styles/v1/components/Image/Image.jsx +1 -1
  39. package/styles/v1/components/Modal/Modal.jsx +1 -1
  40. package/styles/v1/components/Modal/ModalContent.jsx +1 -1
  41. package/styles/v1/components/Modal/stories/Content.stories.js +1 -1
  42. package/styles/v2/components/Image/Image.jsx +1 -1
  43. package/styles/v2/components/Modal/Modal.jsx +2 -2
  44. package/styles/v2/components/Modal/Modal.stories.js +4 -7
  45. package/v1/index.js +1 -1
  46. package/v1/index.js.map +1 -1
  47. package/v2/index.js +1 -1
  48. package/v2/index.js.map +1 -1
  49. package/backlog/utils/animation.js +0 -84
  50. package/backlog/utils/date.js +0 -233
  51. package/backlog/utils/dom.js +0 -441
  52. package/backlog/utils/environment.js +0 -422
  53. package/backlog/utils/number.js +0 -43
  54. package/backlog/utils/time.js +0 -282
  55. package/styles/utils/animation.js +0 -75
  56. package/styles/utils/date.js +0 -226
  57. package/styles/utils/dom.js +0 -428
  58. package/styles/utils/environment.js +0 -425
  59. package/styles/utils/number.js +0 -33
  60. package/styles/utils/time.js +0 -268
@@ -1,441 +0,0 @@
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 _isArray = _interopRequireDefault(require("lodash/isArray"));
11
-
12
- var _isString = _interopRequireDefault(require("lodash/isString"));
13
-
14
- var _includes = _interopRequireDefault(require("lodash/includes"));
15
-
16
- // import {document, window} from 'ssr-window';
17
- // import forEach from 'lodash/forEach';
18
- // import isArrayLikeObject from 'lodash/isArrayLikeObject';
19
- // import CustomEvent from 'custom-event';
20
- // import EnvironmentUtils from '../environment/environment';
21
-
22
- /**
23
- * Utilities for working with the Document Object Model (DOM).
24
- * @module DOMUtils
25
- */
26
- var DOMUtils = {
27
- // /**
28
- // * Returns the tag name of the specified element.
29
- // * @static
30
- // * @function tag
31
- // * @param {Element} el - The element to check the tag of.
32
- // * @param {Boolean} [lowercase=true] - Whether to normalize the tag name for comparison as lowercase.
33
- // * @example
34
- // * DOMUtils.tag(document.querySelector('.foo'));
35
- // * @returns {String} - The tag of the specified element.
36
- // */
37
- // tag(el, lowercase = true) {
38
- // return lowercase ? el.nodeName.toLowerCase() : el.nodeName;
39
- // },
40
-
41
- /**
42
- * Returns the element(s) matching the specified selector.
43
- * @static
44
- * @function el
45
- * @param {String} selector - The selector of the element to query.
46
- * @example
47
- * DOMUtils.el('.foo');
48
- * @returns {Element|Array} - The element or array of elements matching the selector.
49
- */
50
- el: function el(selector) {
51
- var els = document.querySelectorAll(selector);
52
-
53
- if (els.length > 1) {
54
- return els;
55
- } else {
56
- return els[0];
57
- }
58
- },
59
-
60
- /**
61
- * Returns the element's parent or the closest ancestor matching the specified selector if provided.
62
- * @static
63
- * @function parent
64
- * @param {String|Element} item - The selector or element to find the parent of.
65
- * @param {String} [parentSelector] - The selector of the ancestor to find.
66
- * @example
67
- * DOMUtils.parent('.foo', '.bar');
68
- * @returns {Element} - The parent of the item.
69
- */
70
- parent: function parent(item, parentSelector) {
71
- var el = (0, _isString.default)(item) ? DOMUtils.el(item) : item;
72
-
73
- if (!el) {
74
- return;
75
- }
76
-
77
- if (parentSelector) {
78
- var allParents = document.querySelectorAll(parentSelector);
79
- var currentParent = el.parentNode;
80
-
81
- while (currentParent && !(0, _includes.default)(allParents, currentParent)) {
82
- currentParent = currentParent.parentNode;
83
- }
84
-
85
- return currentParent;
86
- } else {
87
- return el.parentNode;
88
- }
89
- },
90
-
91
- /**
92
- * Returns the attribute of the specified element.
93
- * @static
94
- * @function attr
95
- * @param {String|Element} item - The selector or element to query.
96
- * @param {String} attribute - The attribute to query.
97
- * @example
98
- * DOMUtils.attr('.foo', 'data-baz');
99
- * @returns {String} - The value of the attribute.
100
- */
101
- attr: function attr(item, attribute) {
102
- var el = (0, _isString.default)(item) ? DOMUtils.el(item) : item;
103
-
104
- if (!el) {
105
- return;
106
- }
107
-
108
- return el.getAttribute(attribute);
109
- },
110
-
111
- /**
112
- * Adds a class to the specified element.
113
- * @static
114
- * @function addClass
115
- * @param {String|Element} item - The selector or element to add the class to.
116
- * @param {String|Array.<String>} className - The class(es) to add.
117
- * @example
118
- * DOMUtils.addClass(evt.currentTarget, 'foo');
119
- * @returns {void}
120
- */
121
- addClass: function addClass(item, className) {
122
- var el = (0, _isString.default)(item) ? DOMUtils.el(item) : item;
123
-
124
- if (!el) {
125
- return;
126
- }
127
-
128
- var classes = (0, _isString.default)(className) ? className.split(' ') : className;
129
- classes.forEach(function (itemClassName) {
130
- el.classList.add(itemClassName);
131
- });
132
- },
133
-
134
- /**
135
- * Removes a class from the specified element.
136
- * @static
137
- * @function removeClass
138
- * @param {String|Element} item - The selector or element to remove the class from.
139
- * @param {String|Array.<String>} className - The class(es) to remove.
140
- * @example
141
- * DOMUtils.removeClass(evt.currentTarget, 'foo');
142
- * @returns {void}
143
- */
144
- removeClass: function removeClass(item, className) {
145
- var el = (0, _isString.default)(item) ? DOMUtils.el(item) : item;
146
-
147
- if (!el) {
148
- return;
149
- }
150
-
151
- var classes = (0, _isString.default)(className) ? className.split(' ') : className;
152
- classes.forEach(function (itemClassName) {
153
- el.classList.remove(itemClassName);
154
- });
155
- },
156
-
157
- /**
158
- * Checks if an element has a specified class.
159
- * @static
160
- * @function hasClass
161
- * @param {String|Element} item - The selector or element to check.
162
- * @param {String} className - The class to check for.
163
- * @example
164
- * DOMUtils.hasClass(evt.currentTarget, 'foo');
165
- * @returns {Boolean} - Whether the element has the class or not.
166
- */
167
- hasClass: function hasClass(item, className) {
168
- var el = (0, _isString.default)(item) ? DOMUtils.el(item) : item;
169
-
170
- if (!el) {
171
- return false;
172
- }
173
-
174
- return el.classList.contains(className) || false;
175
- },
176
- // /**
177
- // * Toggles a class on or off for the specified element.
178
- // * @static
179
- // * @function toggleClass
180
- // * @param {String|Element} item - The selector or element to toggle the class on.
181
- // * @param {String} className - The class to toggle.
182
- // * @example
183
- // * DOMUtils.toggleClass(evt.currentTarget, 'foo');
184
- // * @returns {void}
185
- // */
186
- // toggleClass(item, className) {
187
- // if (DOMUtils.hasClass(item, className)) {
188
- // DOMUtils.removeClass(item, className);
189
- // } else {
190
- // DOMUtils.addClass(item, className);
191
- // }
192
- // },
193
-
194
- /**
195
- * Get the height of the specified element.
196
- * @static
197
- * @function height
198
- * @param {String|Element} item - The selector or element to find the height of.
199
- * @param {Boolean} [includeMargin=true] - Whether to include the margins in the calculation effectively getting the outerHeight.
200
- * @param {Boolean} [includePadding=true] - Whether to include the padding in the calculation.
201
- * @example
202
- * DOMUtils.height('.foo');
203
- * @returns {Number} - The height of the element.
204
- */
205
- height: function height(item) {
206
- var includeMargin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
207
- var includePadding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
208
- var el = (0, _isString.default)(item) ? DOMUtils.el(item) : item;
209
-
210
- if (!el) {
211
- return 0;
212
- }
213
-
214
- var _window$getComputedSt = window.getComputedStyle(el),
215
- marginTop = _window$getComputedSt.marginTop,
216
- marginBottom = _window$getComputedSt.marginBottom,
217
- paddingTop = _window$getComputedSt.paddingTop,
218
- paddingBottom = _window$getComputedSt.paddingBottom;
219
-
220
- var height = el.offsetHeight;
221
-
222
- if (includeMargin) {
223
- height += parseInt(marginTop, 10) + parseInt(marginBottom, 10);
224
- }
225
-
226
- if (!includePadding) {
227
- height -= parseInt(paddingTop, 10) + parseInt(paddingBottom, 10);
228
- }
229
-
230
- return height;
231
- },
232
- // /**
233
- // * Get the width of the specified element.
234
- // * @static
235
- // * @function width
236
- // * @param {String|Element} item - The selector or element to find the width of.
237
- // * @param {Boolean} [includeMargin=true] - Whether to include the margins in the calculation effectively getting the outerWidth.
238
- // * @param {Boolean} [includePadding=true] - Whether to include the padding in the calculation.
239
- // * @example
240
- // * DOMUtils.width('.foo');
241
- // * @returns {Number} - The width of the element.
242
- // */
243
- // width(item, includeMargin = true, includePadding = true) {
244
- // const el = isString(item) ? DOMUtils.el(item) : item;
245
- //
246
- // if (!el) {
247
- // return 0;
248
- // }
249
- //
250
- // const {
251
- // marginLeft,
252
- // marginRight,
253
- // paddingLeft,
254
- // paddingRight,
255
- // } = window.getComputedStyle(el);
256
- // let width = el.offsetWidth;
257
- //
258
- // if (includeMargin) {
259
- // width += parseInt(marginLeft, 10) + parseInt(marginRight, 10);
260
- // }
261
- //
262
- // if (!includePadding) {
263
- // width -= parseInt(paddingLeft, 10) + parseInt(paddingRight, 10);
264
- // }
265
- //
266
- // return width;
267
- // },
268
-
269
- /**
270
- * Removes element(s) from the DOM.
271
- * @static
272
- * @function remove
273
- * @param {String|Element|Array} items - The selector or element(s) to remove from the DOM.
274
- * @example
275
- * DOMUtils.remove('.class-to-remove');
276
- * @returns {void}
277
- */
278
- remove: function remove(items) {
279
- var el = (0, _isString.default)(items) ? DOMUtils.el(items) : items;
280
-
281
- if (!el) {
282
- return;
283
- }
284
-
285
- if ((0, _isArray.default)(el) || el instanceof NodeList) {
286
- var len = el.length;
287
- var i = 0;
288
-
289
- for (i; i < len; ++i) {
290
- el.outerHTML = '';
291
- }
292
- } else {
293
- el.outerHTML = '';
294
- }
295
- },
296
- //
297
- // /**
298
- // * Adds event listener for an element or NodeList.
299
- // * @static
300
- // * @function addEventListener
301
- // * @param {Object} data - The data to pass to the function.
302
- // * @param {String} data.event - The DOM event to take action on.
303
- // * @param {String|Element} [data.target='document'] - The selector or element to attach the event to.
304
- // * @param {Function} data.handler - The function to run when the event triggers.
305
- // * @example
306
- // * DOMUtils.addEventListener({target: '.foo', event: 'click', handler: functionName});
307
- // * @returns {void}
308
- // */
309
- // addEventListener({event, target = 'document', handler}) {
310
- // if (target && target !== 'document') {
311
- // const el = isString(target) ? DOMUtils.el(target) : target;
312
- //
313
- // if (!el) {
314
- // return;
315
- // }
316
- //
317
- // if (isArrayLikeObject(el)) {
318
- // forEach(el, thisEl => {
319
- // thisEl.addEventListener(event, handler);
320
- // });
321
- // } else {
322
- // el.addEventListener(event, handler);
323
- // }
324
- // } else {
325
- // document.addEventListener(event, handler, {capture: true});
326
- // }
327
- // },
328
- //
329
- // /**
330
- // * Removes event listener for an element or NodeList.
331
- // * @static
332
- // * @function removeEventListener
333
- // * @param {Object} data - The data to pass to the function.
334
- // * @param {String} data.event - The DOM event to remove.
335
- // * @param {String|Element} [data.target='document'] - The selector or element to remove the event from.
336
- // * @param {Function} data.handler - The function that is triggered to handle the event.
337
- // * @example
338
- // * DOMUtils.removeEventListener({target: '.foo', event: 'click', handler: functionName});
339
- // * @returns {void}
340
- // */
341
- // removeEventListener({event, target = 'document', handler}) {
342
- // if (target && target !== 'document') {
343
- // const el = isString(target) ? DOMUtils.el(target) : target;
344
- //
345
- // if (!el) {
346
- // return;
347
- // }
348
- //
349
- // if (isArrayLikeObject(el)) {
350
- // forEach(el, thisEl => {
351
- // thisEl.removeEventListener(event, handler);
352
- // });
353
- // } else {
354
- // el.removeEventListener(event, handler);
355
- // }
356
- // } else {
357
- // document.removeEventListener(event, handler);
358
- // }
359
- // },
360
- //
361
- // /**
362
- // * Creates and dispatches a custom event, with or without data.
363
- // * @static
364
- // * @function sendCustomEvent
365
- // * @param {String} eventName - The name for the custom event.
366
- // * @param {Object} [data=null] - The data to send with the custom event.
367
- // * @example
368
- // * DOMUtils.sendCustomEvent('open-my-mind', {mind: 'free'});
369
- // * @returns {void}
370
- // */
371
- // sendCustomEvent(eventName, data = null) {
372
- // if (!eventName) {
373
- // throw new Error(
374
- // `The 'eventName' is required when sending custom events.`
375
- // );
376
- // }
377
- //
378
- // const customEvent = new CustomEvent(eventName, {detail: data});
379
- //
380
- // document.dispatchEvent(customEvent);
381
- // },
382
-
383
- /**
384
- * Gets the offset of an element relative to the document.
385
- * @static
386
- * @function getDocumentOffset
387
- * @param {String|Element} item - The selector or element to get the offset of.
388
- * @example
389
- * DOMUtils.getDocumentOffset('.foo');
390
- * @returns {Object} - The top and left values of the offset.
391
- */
392
- getDocumentOffset: function getDocumentOffset(item) {
393
- var el = (0, _isString.default)(item) ? DOMUtils.el(item) : item;
394
- var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
395
- var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
396
- var rect = el ? el.getBoundingClientRect() : {
397
- top: 0,
398
- left: 0
399
- };
400
- return {
401
- top: rect.top + scrollTop,
402
- left: rect.left + scrollLeft
403
- };
404
- } //
405
- // /**
406
- // * Loads a script into an element in the document. Pass a fully qualified, exact URL to enable proper matching against a pre-existing script of the same path.
407
- // * @static
408
- // * @function loadScript
409
- // * @param {String} src - The exact script path to load.
410
- // * @param {String} [appendTo='head'] - Where to append the script ('head', 'body') in the document.
411
- // * @example
412
- // * DOMUtils.loadScript({src: 'https://js.stripe.com/v3/'});
413
- // * @returns {Promise} - The promise that is either fulfilled or rejected as a result of loading the script.
414
- // */
415
- // loadScript({src, appendTo = 'head'}) {
416
- // if (!EnvironmentUtils.isBrowser()) {
417
- // return;
418
- // }
419
- //
420
- // const isDuplicate = [...document.querySelectorAll('script')].some(
421
- // script => {
422
- // return script.src === src;
423
- // }
424
- // );
425
- //
426
- // return new Promise((resolve, reject) => {
427
- // const s = document.createElement('script');
428
- //
429
- // s.src = src;
430
- // s.onload = resolve;
431
- // s.onerror = reject;
432
- //
433
- // if (!isDuplicate) {
434
- // document[appendTo].appendChild(s);
435
- // }
436
- // });
437
- // },
438
-
439
- };
440
- var _default = DOMUtils;
441
- exports.default = _default;