@ebay/ui-core-react 6.2.1 → 6.3.0

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 (171) hide show
  1. package/common/component-utils/array.polyfill.flat.js +11 -13
  2. package/common/component-utils/forwardRef.js +4 -17
  3. package/common/component-utils/usePrevious.js +3 -3
  4. package/common/component-utils/utils.js +13 -26
  5. package/common/debounce.js +3 -7
  6. package/common/event-utils/index.js +8 -11
  7. package/common/event-utils/use-key-press.js +10 -12
  8. package/common/event-utils/use-roving-index.js +13 -24
  9. package/common/floating-label-utils/hooks.js +43 -53
  10. package/common/notice-utils/notice-content.js +5 -6
  11. package/common/notice-utils/notice-cta.js +5 -16
  12. package/common/notice-utils/notice-footer.js +5 -16
  13. package/common/notice-utils/notice-title.js +6 -17
  14. package/common/random-id.js +1 -1
  15. package/common/range.js +1 -4
  16. package/common/tooltip-utils/tooltip-close-button.js +1 -1
  17. package/common/tooltip-utils/tooltip-content.js +16 -28
  18. package/common/tooltip-utils/tooltip-footer.js +3 -6
  19. package/common/tooltip-utils/tooltip-host.js +5 -16
  20. package/common/tooltip-utils/tooltip.d.ts +1 -1
  21. package/common/tooltip-utils/tooltip.js +14 -26
  22. package/common/tooltip-utils/use-tooltip.js +8 -9
  23. package/ebay-alert-dialog/alert-dialog.js +11 -22
  24. package/ebay-badge/badge.js +6 -17
  25. package/ebay-breadcrumbs/breadcrumb-item.js +7 -18
  26. package/ebay-breadcrumbs/breadcrumbs.js +19 -30
  27. package/ebay-button/button-cell.js +5 -16
  28. package/ebay-button/button-expand.d.ts +4 -2
  29. package/ebay-button/button-expand.d.ts.map +1 -1
  30. package/ebay-button/button-expand.js +7 -10
  31. package/ebay-button/button-loading.js +5 -5
  32. package/ebay-button/button-text.js +3 -6
  33. package/ebay-button/button.d.ts +1 -1
  34. package/ebay-button/button.js +31 -43
  35. package/ebay-calendar/calendar.js +94 -111
  36. package/ebay-calendar/date-utils.js +9 -18
  37. package/ebay-carousel/carousel-control-button.js +9 -10
  38. package/ebay-carousel/carousel-item.d.ts +1 -1
  39. package/ebay-carousel/carousel-item.js +14 -25
  40. package/ebay-carousel/carousel-list.js +21 -22
  41. package/ebay-carousel/carousel.js +32 -44
  42. package/ebay-carousel/helpers.js +35 -47
  43. package/ebay-carousel/scroll-to-transition.js +15 -15
  44. package/ebay-checkbox/checkbox.js +21 -32
  45. package/ebay-confirm-dialog/confirm-dialog.js +11 -22
  46. package/ebay-cta-button/cta-button.d.ts +1 -1
  47. package/ebay-cta-button/cta-button.js +9 -20
  48. package/ebay-date-textbox/date-textbox.js +37 -53
  49. package/ebay-dialog-base/components/animation.d.ts +0 -1
  50. package/ebay-dialog-base/components/animation.d.ts.map +1 -1
  51. package/ebay-dialog-base/components/animation.js +25 -28
  52. package/ebay-dialog-base/components/dialog-actions.js +2 -5
  53. package/ebay-dialog-base/components/dialog-close-button.d.ts +5 -2
  54. package/ebay-dialog-base/components/dialog-close-button.d.ts.map +1 -1
  55. package/ebay-dialog-base/components/dialog-close-button.js +2 -5
  56. package/ebay-dialog-base/components/dialog-footer.js +2 -5
  57. package/ebay-dialog-base/components/dialog-header.js +4 -15
  58. package/ebay-dialog-base/components/dialog-previous-button.js +6 -17
  59. package/ebay-dialog-base/components/dialogBase.js +40 -51
  60. package/ebay-dialog-base/dialog-base-with-state.js +22 -35
  61. package/ebay-drawer-dialog/components/drawer.js +27 -50
  62. package/ebay-eek/eek-rating.js +8 -10
  63. package/ebay-eek/eek-util.d.ts +1 -1
  64. package/ebay-eek/eek-util.d.ts.map +1 -1
  65. package/ebay-eek/eek-util.js +7 -6
  66. package/ebay-fake-menu/menu-item-separator.js +5 -16
  67. package/ebay-fake-menu/menu-item.js +15 -26
  68. package/ebay-fake-menu/menu.js +11 -22
  69. package/ebay-fake-menu-button/menu-button-item.js +2 -2
  70. package/ebay-fake-menu-button/menu-button-label.d.ts +4 -2
  71. package/ebay-fake-menu-button/menu-button-label.d.ts.map +1 -1
  72. package/ebay-fake-menu-button/menu-button-label.js +2 -5
  73. package/ebay-fake-menu-button/menu-button-separator.js +5 -16
  74. package/ebay-fake-menu-button/menu-button.js +32 -45
  75. package/ebay-fake-tabs/fake-tabs.js +10 -23
  76. package/ebay-fake-tabs/tab.js +5 -16
  77. package/ebay-field/description.js +7 -19
  78. package/ebay-field/field.js +4 -5
  79. package/ebay-field/label.js +7 -18
  80. package/ebay-fullscreen-dialog/fullscreen-dialog.js +7 -18
  81. package/ebay-icon/icon.d.ts +1 -1
  82. package/ebay-icon/icon.js +17 -29
  83. package/ebay-icon-button/icon-button.d.ts +1 -1
  84. package/ebay-icon-button/icon-button.js +15 -27
  85. package/ebay-infotip/ebay-infotip-content.js +2 -5
  86. package/ebay-infotip/ebay-infotip-heading.js +5 -16
  87. package/ebay-infotip/ebay-infotip-host.d.ts +2 -2
  88. package/ebay-infotip/ebay-infotip-host.d.ts.map +1 -1
  89. package/ebay-infotip/ebay-infotip-host.js +10 -24
  90. package/ebay-infotip/ebay-infotip.d.ts.map +1 -1
  91. package/ebay-infotip/ebay-infotip.js +23 -34
  92. package/ebay-inline-notice/inline-notice.js +15 -27
  93. package/ebay-lightbox-dialog/lightbox-dialog.js +9 -21
  94. package/ebay-listbox-button/listbox-button-option.js +7 -18
  95. package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
  96. package/ebay-listbox-button/listbox-button.js +79 -100
  97. package/ebay-menu/menu-item-separator.js +5 -16
  98. package/ebay-menu/menu-item.js +12 -23
  99. package/ebay-menu/menu.d.ts +1 -1
  100. package/ebay-menu/menu.js +37 -64
  101. package/ebay-menu-button/README.md +1 -1
  102. package/ebay-menu-button/menu-button-item.js +1 -1
  103. package/ebay-menu-button/menu-button-label.d.ts +4 -2
  104. package/ebay-menu-button/menu-button-label.d.ts.map +1 -1
  105. package/ebay-menu-button/menu-button-label.js +2 -5
  106. package/ebay-menu-button/menu-button-separator.js +5 -16
  107. package/ebay-menu-button/menu-button.js +46 -60
  108. package/ebay-notice-base/components/ebay-notice-content/notice-content.js +1 -1
  109. package/ebay-notice-base/components/ebay-notice-title/notice-title.d.ts +5 -2
  110. package/ebay-notice-base/components/ebay-notice-title/notice-title.d.ts.map +1 -1
  111. package/ebay-notice-base/components/ebay-notice-title/notice-title.js +2 -5
  112. package/ebay-page-notice/page-notice-cta.js +3 -6
  113. package/ebay-page-notice/page-notice-footer.js +3 -6
  114. package/ebay-page-notice/page-notice-title.js +5 -16
  115. package/ebay-page-notice/page-notice.js +16 -27
  116. package/ebay-pagination/helpers.js +21 -24
  117. package/ebay-pagination/pagination-item.d.ts +1 -1
  118. package/ebay-pagination/pagination-item.js +16 -27
  119. package/ebay-pagination/pagination.js +52 -81
  120. package/ebay-panel-dialog/panel-dialog.js +9 -21
  121. package/ebay-progress-bar/progress-bar.js +5 -16
  122. package/ebay-progress-spinner/progress-spinner.js +7 -18
  123. package/ebay-progress-stepper/ebay-progress-step.js +14 -25
  124. package/ebay-progress-stepper/ebay-progress-stepper.js +10 -21
  125. package/ebay-progress-stepper/ebay-progress-title.js +2 -5
  126. package/ebay-radio/radio.js +18 -29
  127. package/ebay-section-notice/section-notice-footer.js +3 -6
  128. package/ebay-section-notice/section-notice-title.js +5 -16
  129. package/ebay-section-notice/section-notice.js +24 -39
  130. package/ebay-section-title/cta.js +5 -16
  131. package/ebay-section-title/info.js +5 -16
  132. package/ebay-section-title/overflow.js +5 -16
  133. package/ebay-section-title/section-title.js +13 -24
  134. package/ebay-section-title/subtitle.js +5 -16
  135. package/ebay-section-title/title.js +5 -16
  136. package/ebay-select/ebay-select-option.js +4 -15
  137. package/ebay-select/ebay-select.d.ts +1 -1
  138. package/ebay-select/ebay-select.js +34 -45
  139. package/ebay-signal/signal.js +6 -17
  140. package/ebay-snackbar-dialog/components/ebay-snackbar-dialog-action.js +5 -16
  141. package/ebay-snackbar-dialog/components/ebay-snackbar-dialog.js +27 -38
  142. package/ebay-split-button/split-button.js +10 -21
  143. package/ebay-star-rating/star-rating.js +8 -19
  144. package/ebay-star-rating-select/star-rating-select.js +20 -31
  145. package/ebay-svg/svg.js +3 -3
  146. package/ebay-switch/ebay-switch.js +10 -21
  147. package/ebay-tabs/tab-panel.js +5 -16
  148. package/ebay-tabs/tab.js +5 -16
  149. package/ebay-tabs/tabs.js +26 -40
  150. package/ebay-textbox/postfix-icon.js +7 -18
  151. package/ebay-textbox/prefix-icon.js +5 -16
  152. package/ebay-textbox/textbox.d.ts +1 -1
  153. package/ebay-textbox/textbox.js +42 -53
  154. package/ebay-toast-dialog/components/toast.js +6 -17
  155. package/ebay-tooltip/ebay-tooltip-content.js +1 -1
  156. package/ebay-tooltip/ebay-tooltip-host.js +1 -1
  157. package/ebay-tooltip/ebay-tooltip.js +21 -32
  158. package/ebay-tourtip/ebay-tourtip-content.js +1 -1
  159. package/ebay-tourtip/ebay-tourtip-footer.js +4 -7
  160. package/ebay-tourtip/ebay-tourtip-heading.js +6 -17
  161. package/ebay-tourtip/ebay-tourtip-host.js +1 -1
  162. package/ebay-tourtip/ebay-tourtip.js +22 -33
  163. package/ebay-video/controls.d.ts.map +1 -1
  164. package/ebay-video/controls.js +23 -46
  165. package/ebay-video/reportButton.d.ts +7 -2
  166. package/ebay-video/reportButton.d.ts.map +1 -1
  167. package/ebay-video/reportButton.js +5 -8
  168. package/ebay-video/source.js +3 -14
  169. package/ebay-video/video.d.ts.map +1 -1
  170. package/ebay-video/video.js +54 -80
  171. package/package.json +23 -18
@@ -14,19 +14,17 @@ if (!Array.prototype.flat) {
14
14
  configurable: true,
15
15
  writable: true,
16
16
  value: function (d) {
17
- var depthArg = typeof d === 'undefined' ? 1 : Number(d) || 0;
18
- var result = [];
19
- var forEach = result.forEach;
20
- var flatDeep = function (arr, depth) {
21
- return forEach.call(arr, function (val) {
22
- if (depth > 0 && Array.isArray(val)) {
23
- flatDeep(val, depth - 1);
24
- }
25
- else {
26
- result.push(val);
27
- }
28
- });
29
- };
17
+ const depthArg = typeof d === 'undefined' ? 1 : Number(d) || 0;
18
+ const result = [];
19
+ const forEach = result.forEach;
20
+ const flatDeep = (arr, depth) => forEach.call(arr, val => {
21
+ if (depth > 0 && Array.isArray(val)) {
22
+ flatDeep(val, depth - 1);
23
+ }
24
+ else {
25
+ result.push(val);
26
+ }
27
+ });
30
28
  flatDeep(this, depthArg);
31
29
  return result;
32
30
  }
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
3
  if (k2 === undefined) k2 = k;
15
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -35,15 +24,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
35
24
  };
36
25
  Object.defineProperty(exports, "__esModule", { value: true });
37
26
  exports.withForwardRef = void 0;
38
- var react_1 = __importStar(require("react"));
39
- var getDisplayName = function (Component) { return Component.displayName || Component.name || 'Component'; };
27
+ const react_1 = __importStar(require("react"));
28
+ const getDisplayName = (Component) => Component.displayName || Component.name || 'Component';
40
29
  // Typescript will automatically find the return type crom forwardRef() function
41
30
  // Disabling eslint for this use case
42
31
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
43
- var withForwardRef = function (Component) {
44
- var ForwardRef = (0, react_1.forwardRef)(function (props, ref) {
45
- return react_1.default.createElement(Component, __assign({}, props, { forwardedRef: ref }));
46
- });
32
+ const withForwardRef = (Component) => {
33
+ const ForwardRef = (0, react_1.forwardRef)((props, ref) => react_1.default.createElement(Component, Object.assign({}, props, { forwardedRef: ref })));
47
34
  ForwardRef.displayName = getDisplayName(Component);
48
35
  return ForwardRef;
49
36
  };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.usePrevious = void 0;
4
- var react_1 = require("react");
4
+ const react_1 = require("react");
5
5
  function usePrevious(value) {
6
- var ref = (0, react_1.useRef)();
7
- (0, react_1.useEffect)(function () {
6
+ const ref = (0, react_1.useRef)();
7
+ (0, react_1.useEffect)(() => {
8
8
  ref.current = value;
9
9
  }, [value]);
10
10
  return ref.current;
@@ -1,39 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.filterBy = exports.filterByType = exports.excludeComponent = exports.findComponent = void 0;
4
- var react_1 = require("react");
4
+ const react_1 = require("react");
5
5
  require("./array.polyfill.flat"); // for Mobile Safari 11
6
- function findComponent(nodes, componentType) {
7
- if (nodes === void 0) { nodes = []; }
8
- var elements = react_1.Children.toArray(nodes);
9
- return elements.find(function (_a) {
10
- var type = _a.type;
11
- return type === componentType;
12
- }) || null;
6
+ function findComponent(nodes = [], componentType) {
7
+ const elements = react_1.Children.toArray(nodes);
8
+ return elements.find(({ type }) => type === componentType) || null;
13
9
  }
14
10
  exports.findComponent = findComponent;
15
- function excludeComponent(nodes, componentType) {
16
- if (nodes === void 0) { nodes = []; }
17
- var elements = react_1.Children.toArray(nodes);
18
- return elements.filter(function (_a) {
19
- var type = _a.type;
20
- return type !== componentType;
21
- });
11
+ function excludeComponent(nodes = [], componentType) {
12
+ const elements = react_1.Children.toArray(nodes);
13
+ return elements.filter(({ type }) => type !== componentType);
22
14
  }
23
15
  exports.excludeComponent = excludeComponent;
24
- function filterByType(nodes, componentType) {
25
- if (nodes === void 0) { nodes = []; }
26
- var elements = react_1.Children.toArray(nodes);
27
- var types = [componentType].flat();
28
- return elements.filter(function (_a) {
29
- var type = _a.type;
30
- return types.includes(type);
31
- });
16
+ function filterByType(nodes = [], componentType) {
17
+ const elements = react_1.Children.toArray(nodes);
18
+ const types = [componentType].flat();
19
+ return elements.filter(({ type }) => types.includes(type));
32
20
  }
33
21
  exports.filterByType = filterByType;
34
- function filterBy(nodes, predicate) {
35
- if (nodes === void 0) { nodes = []; }
36
- var elements = react_1.Children.toArray(nodes);
22
+ function filterBy(nodes = [], predicate) {
23
+ const elements = react_1.Children.toArray(nodes);
37
24
  return elements.filter(predicate);
38
25
  }
39
26
  exports.filterBy = filterBy;
@@ -2,14 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.debounce = void 0;
4
4
  function debounce(fn, ms) {
5
- var timer;
6
- return function () {
7
- var args = [];
8
- for (var _i = 0; _i < arguments.length; _i++) {
9
- args[_i] = arguments[_i];
10
- }
5
+ let timer;
6
+ return (...args) => {
11
7
  clearTimeout(timer);
12
- timer = setTimeout(function () { return fn.apply(void 0, args); }, ms);
8
+ timer = setTimeout(() => fn(...args), ms);
13
9
  };
14
10
  }
15
11
  exports.debounce = debounce;
@@ -10,15 +10,13 @@ exports.wrapEvent = exports.handleResize = exports.removeEventListener = exports
10
10
  * @param {KeyboardEvent} e
11
11
  * @param {Function} callback
12
12
  */
13
- function handleKeydown(keyList, e, callback) {
14
- if (callback === void 0) { callback = function () { }; }
13
+ function handleKeydown(keyList, e, callback = () => { }) {
15
14
  if (keyList.includes(e.key)) {
16
15
  callback();
17
16
  }
18
17
  }
19
18
  // inverse of found keys
20
- function handleNotKeydown(keyList, e, callback) {
21
- if (callback === void 0) { callback = function () { }; }
19
+ function handleNotKeydown(keyList, e, callback = () => { }) {
22
20
  if (!keyList.includes(e.key)) {
23
21
  callback();
24
22
  }
@@ -53,7 +51,7 @@ function handleLeftRightArrowsKeydown(e, callback) {
53
51
  exports.handleLeftRightArrowsKeydown = handleLeftRightArrowsKeydown;
54
52
  // only fire for character input, not modifier/meta keys (enter, escape, backspace, tab, etc.)
55
53
  function handleTextInput(e, callback) {
56
- var keyList = [
54
+ const keyList = [
57
55
  // Edge
58
56
  'Esc',
59
57
  'Left',
@@ -83,7 +81,7 @@ function preventDefaultIfHijax(e, hijax) {
83
81
  }
84
82
  }
85
83
  exports.preventDefaultIfHijax = preventDefaultIfHijax;
86
- var handlers = [];
84
+ const handlers = [];
87
85
  function addEventListener(_, handler) {
88
86
  if (handlers.length === 0) {
89
87
  window.addEventListener('resize', handleResize);
@@ -100,9 +98,9 @@ function removeEventListener(_, handler) {
100
98
  exports.removeEventListener = removeEventListener;
101
99
  function handleResize(e) {
102
100
  window.removeEventListener('resize', handleResize);
103
- var callback = function () {
101
+ const callback = () => {
104
102
  if (handlers.length) {
105
- handlers.forEach(function (handler) { return handler(e); });
103
+ handlers.forEach(handler => handler(e));
106
104
  window.addEventListener('resize', handleResize);
107
105
  }
108
106
  };
@@ -114,9 +112,8 @@ function handleResize(e) {
114
112
  }
115
113
  }
116
114
  exports.handleResize = handleResize;
117
- function wrapEvent(parentEventHandler, localEventHandler) {
118
- if (parentEventHandler === void 0) { parentEventHandler = function () { }; }
119
- return function (e) {
115
+ function wrapEvent(parentEventHandler = () => { }, localEventHandler) {
116
+ return (e) => {
120
117
  parentEventHandler(e);
121
118
  if (!e.defaultPrevented) {
122
119
  return localEventHandler(e);
@@ -1,31 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var react_1 = require("react");
4
- var useKeyPress = function () {
5
- var _a = (0, react_1.useState)(false), arrowUpPressed = _a[0], setArrowUpPressed = _a[1];
6
- var _b = (0, react_1.useState)(false), arrowDownPressed = _b[0], setArrowDownPressed = _b[1];
7
- var upHandler = function (_a) {
8
- var key = _a.key;
9
- var fn = {
3
+ const react_1 = require("react");
4
+ const useKeyPress = () => {
5
+ const [arrowUpPressed, setArrowUpPressed] = (0, react_1.useState)(false);
6
+ const [arrowDownPressed, setArrowDownPressed] = (0, react_1.useState)(false);
7
+ const upHandler = ({ key }) => {
8
+ const fn = {
10
9
  ArrowUp: setArrowUpPressed,
11
10
  ArrowDown: setArrowDownPressed
12
11
  }[key];
13
12
  if (fn)
14
13
  fn(false);
15
14
  };
16
- var downHandler = function (_a) {
17
- var key = _a.key;
18
- var fn = {
15
+ const downHandler = ({ key }) => {
16
+ const fn = {
19
17
  ArrowUp: setArrowUpPressed,
20
18
  ArrowDown: setArrowDownPressed
21
19
  }[key];
22
20
  if (fn)
23
21
  fn(true);
24
22
  };
25
- (0, react_1.useEffect)(function () {
23
+ (0, react_1.useEffect)(() => {
26
24
  window.addEventListener('keydown', downHandler);
27
25
  window.addEventListener('keyup', upHandler);
28
- return function () {
26
+ return () => {
29
27
  window.removeEventListener('keydown', downHandler);
30
28
  window.removeEventListener('keyup', upHandler);
31
29
  };
@@ -1,41 +1,30 @@
1
1
  "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
14
5
  Object.defineProperty(exports, "__esModule", { value: true });
15
- var react_1 = require("react");
16
- var use_key_press_1 = __importDefault(require("./use-key-press"));
17
- var useRovingIndex = function (children, FocusableType, defaultValue) {
18
- var _a = (0, react_1.useState)(defaultValue), rovingIndex = _a[0], setRovingIndex = _a[1];
19
- var _b = (0, use_key_press_1.default)(), arrowUpPressed = _b[0], arrowDownPressed = _b[1];
20
- var rovingIndexArray = react_1.Children
6
+ const react_1 = require("react");
7
+ const use_key_press_1 = __importDefault(require("./use-key-press"));
8
+ const useRovingIndex = (children, FocusableType, defaultValue) => {
9
+ const [rovingIndex, setRovingIndex] = (0, react_1.useState)(defaultValue);
10
+ const [arrowUpPressed, arrowDownPressed] = (0, use_key_press_1.default)();
11
+ const rovingIndexArray = react_1.Children
21
12
  .toArray(children)
22
- .reduce(function (focusables, child, i) {
23
- return child.type === FocusableType ? __spreadArray(__spreadArray([], focusables, true), [i], false) : focusables;
24
- }, []);
25
- var currentIndex = rovingIndexArray.indexOf(rovingIndex);
26
- var previousOrCurrent = function () {
13
+ .reduce((focusables, child, i) => child.type === FocusableType ? [...focusables, i] : focusables, []);
14
+ const currentIndex = rovingIndexArray.indexOf(rovingIndex);
15
+ const previousOrCurrent = () => {
27
16
  if (currentIndex === -1)
28
17
  return rovingIndex;
29
- var previousRovingIndex = rovingIndexArray[currentIndex - 1];
18
+ const previousRovingIndex = rovingIndexArray[currentIndex - 1];
30
19
  return previousRovingIndex === undefined ? rovingIndex : previousRovingIndex;
31
20
  };
32
- var nextOrCurrent = function () {
21
+ const nextOrCurrent = () => {
33
22
  if (currentIndex === -1)
34
23
  return rovingIndex;
35
- var nextRovingIndex = rovingIndexArray[currentIndex + 1];
24
+ const nextRovingIndex = rovingIndexArray[currentIndex + 1];
36
25
  return nextRovingIndex === undefined ? rovingIndex : nextRovingIndex;
37
26
  };
38
- (0, react_1.useEffect)(function () {
27
+ (0, react_1.useEffect)(() => {
39
28
  if (arrowUpPressed)
40
29
  setRovingIndex(previousOrCurrent());
41
30
  if (arrowDownPressed)
@@ -27,114 +27,104 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.useFloatingLabel = void 0;
30
- var react_1 = __importStar(require("react"));
31
- var classnames_1 = __importDefault(require("classnames"));
32
- var classPrefix = 'floating-label__label';
30
+ const react_1 = __importStar(require("react"));
31
+ const classnames_1 = __importDefault(require("classnames"));
32
+ const classPrefix = 'floating-label__label';
33
33
  // input background in Skin 12, used for autofill detection
34
- var textboxElementBackgroundRGB = [
34
+ const textboxElementBackgroundRGB = [
35
35
  'rgb(245, 245, 245)',
36
36
  'rgb(247, 247, 247)' // From skin version 12.6.0
37
37
  ];
38
38
  // check for computed background color because of Chrome autofill bug
39
39
  // https://stackoverflow.com/questions/35049555/chrome-autofill-autocomplete-no-value-for-password/35783761#35783761
40
- var isAutofilled = function (input) {
41
- return input && !textboxElementBackgroundRGB.includes(getComputedStyle(input).backgroundColor);
42
- };
43
- var hasValue = function (input) { var _a; return ((_a = input === null || input === void 0 ? void 0 : input.value) === null || _a === void 0 ? void 0 : _a.length) > 0; };
44
- var isSelect = function (element) { return (element === null || element === void 0 ? void 0 : element.tagName) === "SELECT"; };
45
- var setPlaceholder = function (element, value) {
40
+ const isAutofilled = (input) => input && !textboxElementBackgroundRGB.includes(getComputedStyle(input).backgroundColor);
41
+ const hasValue = (input) => { var _a; return ((_a = input === null || input === void 0 ? void 0 : input.value) === null || _a === void 0 ? void 0 : _a.length) > 0; };
42
+ const isSelect = (element) => (element === null || element === void 0 ? void 0 : element.tagName) === `SELECT`;
43
+ const setPlaceholder = (element, value) => {
46
44
  // For select elements we need to temporary remove the text of the first option
47
45
  // when the element is not focused, so only the label is shown. We still need to
48
46
  // maintain the width of the input so we manually change the "min-width"
49
47
  // Inspired by the marko implementation: https://github.com/makeup/makeup-js/blob/master/packages/makeup-floating-label/src/index.js
50
- if (isSelect(element) && !hasValue(element.querySelector("option"))) {
48
+ if (isSelect(element) && !hasValue(element.querySelector(`option`))) {
51
49
  element.style['min-width'] = '';
52
- var beforeWidth = element.offsetWidth;
53
- element.querySelector("option").text = value;
50
+ const beforeWidth = element.offsetWidth;
51
+ element.querySelector(`option`).text = value;
54
52
  if (!value && beforeWidth > element.offsetWidth) {
55
- element.style['min-width'] = "".concat(beforeWidth, "px");
53
+ element.style['min-width'] = `${beforeWidth}px`;
56
54
  }
57
55
  }
58
56
  };
59
- var getPlaceholder = function (element) {
57
+ const getPlaceholder = (element) => {
60
58
  if (isSelect(element)) {
61
- return element.querySelector("option").text;
59
+ return element.querySelector(`option`).text;
62
60
  }
63
61
  return element === null || element === void 0 ? void 0 : element.placeholder;
64
62
  };
65
- function useFloatingLabel(_a) {
66
- var _b;
67
- var ref = _a.ref, inputId = _a.inputId, className = _a.className, disabled = _a.disabled, label = _a.label, inputSize = _a.inputSize, inputValue = _a.inputValue, placeholder = _a.placeholder, invalid = _a.invalid, opaqueLabel = _a.opaqueLabel, type = _a.type, _c = _a.onMount, onMount = _c === void 0 ? function () { } : _c;
68
- var _internalInputRef = (0, react_1.useRef)(null);
69
- var inputRef = function () { return ref || _internalInputRef; };
70
- var _d = (0, react_1.useState)(Boolean(inputValue)), isFloating = _d[0], setFloating = _d[1];
71
- var _e = (0, react_1.useState)(false), shouldAnimate = _e[0], setAnimate = _e[1];
72
- var _f = (0, react_1.useState)(false), isFocused = _f[0], setFocused = _f[1];
73
- var selectFirstOptionText = (0, react_1.useRef)("");
74
- var onBlur = function () {
63
+ function useFloatingLabel({ ref, inputId, className, disabled, label, inputSize, inputValue, placeholder, invalid, opaqueLabel, type, onMount = () => { } }) {
64
+ const _internalInputRef = (0, react_1.useRef)(null);
65
+ const inputRef = () => ref || _internalInputRef;
66
+ const [isFloating, setFloating] = (0, react_1.useState)(Boolean(inputValue));
67
+ const [shouldAnimate, setAnimate] = (0, react_1.useState)(false);
68
+ const [isFocused, setFocused] = (0, react_1.useState)(false);
69
+ const selectFirstOptionText = (0, react_1.useRef)(``);
70
+ const onBlur = () => {
75
71
  var _a;
76
72
  setAnimate(true);
77
73
  setFloating(hasValue((_a = inputRef()) === null || _a === void 0 ? void 0 : _a.current));
78
74
  setFocused(false);
79
- setPlaceholder(inputRef().current, "");
75
+ setPlaceholder(inputRef().current, ``);
80
76
  };
81
- var onFocus = function () {
77
+ const onFocus = () => {
82
78
  var _a;
83
79
  setAnimate(true);
84
80
  setFloating(true);
85
81
  setFocused(true);
86
82
  setPlaceholder((_a = inputRef()) === null || _a === void 0 ? void 0 : _a.current, selectFirstOptionText.current);
87
83
  };
88
- (0, react_1.useEffect)(function () {
84
+ (0, react_1.useEffect)(() => {
89
85
  var _a, _b;
90
86
  if (!label) {
91
87
  return;
92
88
  }
93
89
  selectFirstOptionText.current = getPlaceholder((_a = inputRef()) === null || _a === void 0 ? void 0 : _a.current);
94
- setPlaceholder((_b = inputRef()) === null || _b === void 0 ? void 0 : _b.current, "");
90
+ setPlaceholder((_b = inputRef()) === null || _b === void 0 ? void 0 : _b.current, ``);
95
91
  onMount();
96
92
  }, []);
97
- (0, react_1.useEffect)(function () {
93
+ (0, react_1.useEffect)(() => {
98
94
  var _a, _b;
99
95
  if (!label) {
100
96
  return;
101
97
  }
102
98
  setFloating(isFocused || hasValue((_a = inputRef()) === null || _a === void 0 ? void 0 : _a.current) || isAutofilled((_b = inputRef()) === null || _b === void 0 ? void 0 : _b.current));
103
99
  }, [isFocused, inputValue]);
104
- var labelClassName = (0, classnames_1.default)(className, classPrefix, (_b = {},
105
- _b["".concat(classPrefix, "--disabled")] = disabled,
106
- _b["".concat(classPrefix, "--animate")] = shouldAnimate,
107
- _b["".concat(classPrefix, "--inline")] = !isFloating && type !== 'date',
108
- _b["".concat(classPrefix, "--invalid")] = invalid,
109
- _b));
110
- var floatingLabelClassName = (0, classnames_1.default)("floating-label", {
111
- 'floating-label--large': inputSize === "large",
100
+ const labelClassName = (0, classnames_1.default)(className, classPrefix, {
101
+ [`${classPrefix}--disabled`]: disabled,
102
+ [`${classPrefix}--animate`]: shouldAnimate,
103
+ [`${classPrefix}--inline`]: !isFloating && type !== 'date',
104
+ [`${classPrefix}--invalid`]: invalid
105
+ });
106
+ const floatingLabelClassName = (0, classnames_1.default)(`floating-label`, {
107
+ 'floating-label--large': inputSize === `large`,
112
108
  'floating-label--opaque': opaqueLabel
113
109
  });
114
- var FragmentContainer = (0, react_1.useCallback)(function (_a) {
115
- var children = _a.children;
116
- return react_1.default.createElement(react_1.default.Fragment, null, children);
117
- }, []);
118
- var FloatingLabelContainer = (0, react_1.useCallback)(function (_a) {
119
- var children = _a.children;
120
- return react_1.default.createElement("span", { className: floatingLabelClassName }, children);
121
- }, [floatingLabelClassName]);
110
+ const FragmentContainer = (0, react_1.useCallback)(({ children }) => react_1.default.createElement(react_1.default.Fragment, null, children), []);
111
+ const FloatingLabelContainer = (0, react_1.useCallback)(({ children }) => react_1.default.createElement("span", { className: floatingLabelClassName }, children), [floatingLabelClassName]);
122
112
  if (!label) {
123
113
  return {
124
114
  label: null,
125
115
  Container: FragmentContainer,
126
- onBlur: function () { },
127
- onFocus: function () { },
116
+ onBlur: () => { },
117
+ onFocus: () => { },
128
118
  ref: inputRef(),
129
- placeholder: placeholder
119
+ placeholder
130
120
  };
131
121
  }
132
- var labelElement = react_1.default.createElement("label", { htmlFor: inputId, className: labelClassName }, label);
122
+ const labelElement = react_1.default.createElement("label", { htmlFor: inputId, className: labelClassName }, label);
133
123
  return {
134
124
  label: labelElement,
135
125
  Container: FloatingLabelContainer,
136
- onBlur: onBlur,
137
- onFocus: onFocus,
126
+ onBlur,
127
+ onFocus,
138
128
  ref: inputRef(),
139
129
  placeholder: !isFloating ? null : placeholder
140
130
  };
@@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var react_1 = __importDefault(require("react"));
7
- var classnames_1 = __importDefault(require("classnames"));
8
- var NoticeContent = function (_a) {
9
- var className = _a.className, type = _a.type, children = _a.children;
10
- var ContentTag = type === 'inline' ? 'span' : 'div';
11
- return (react_1.default.createElement(ContentTag, { className: (0, classnames_1.default)(className, "".concat(type, "-notice__main")) }, children));
6
+ const react_1 = __importDefault(require("react"));
7
+ const classnames_1 = __importDefault(require("classnames"));
8
+ const NoticeContent = ({ className, type, children }) => {
9
+ const ContentTag = type === 'inline' ? 'span' : 'div';
10
+ return (react_1.default.createElement(ContentTag, { className: (0, classnames_1.default)(className, `${type}-notice__main`) }, children));
12
11
  };
13
12
  exports.default = NoticeContent;
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __rest = (this && this.__rest) || function (s, e) {
14
3
  var t = {};
15
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -25,10 +14,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
15
  };
27
16
  Object.defineProperty(exports, "__esModule", { value: true });
28
- var react_1 = __importDefault(require("react"));
29
- var classnames_1 = __importDefault(require("classnames"));
30
- var NoticeCTA = function (_a) {
31
- var className = _a.className, type = _a.type, children = _a.children, rest = __rest(_a, ["className", "type", "children"]);
32
- return (react_1.default.createElement("p", __assign({ className: (0, classnames_1.default)(className, "".concat(type, "-notice__cta")) }, rest), children));
17
+ const react_1 = __importDefault(require("react"));
18
+ const classnames_1 = __importDefault(require("classnames"));
19
+ const NoticeCTA = (_a) => {
20
+ var { className, type, children } = _a, rest = __rest(_a, ["className", "type", "children"]);
21
+ return (react_1.default.createElement("p", Object.assign({ className: (0, classnames_1.default)(className, `${type}-notice__cta`) }, rest), children));
33
22
  };
34
23
  exports.default = NoticeCTA;
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __rest = (this && this.__rest) || function (s, e) {
14
3
  var t = {};
15
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -25,10 +14,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
15
  };
27
16
  Object.defineProperty(exports, "__esModule", { value: true });
28
- var react_1 = __importDefault(require("react"));
29
- var classnames_1 = __importDefault(require("classnames"));
30
- var NoticeFooter = function (_a) {
31
- var className = _a.className, type = _a.type, children = _a.children, rest = __rest(_a, ["className", "type", "children"]);
32
- return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)(className, "".concat(type, "-notice__footer")) }, rest), children));
17
+ const react_1 = __importDefault(require("react"));
18
+ const classnames_1 = __importDefault(require("classnames"));
19
+ const NoticeFooter = (_a) => {
20
+ var { className, type, children } = _a, rest = __rest(_a, ["className", "type", "children"]);
21
+ return (react_1.default.createElement("div", Object.assign({ className: (0, classnames_1.default)(className, `${type}-notice__footer`) }, rest), children));
33
22
  };
34
23
  exports.default = NoticeFooter;
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __rest = (this && this.__rest) || function (s, e) {
14
3
  var t = {};
15
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -25,11 +14,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
15
  };
27
16
  Object.defineProperty(exports, "__esModule", { value: true });
28
- var react_1 = __importDefault(require("react"));
29
- var classnames_1 = __importDefault(require("classnames"));
30
- var NoticeTitle = function (_a) {
31
- var className = _a.className, type = _a.type, as = _a.as, children = _a.children, rest = __rest(_a, ["className", "type", "as", "children"]);
32
- var HeadingTag = as || "h2";
33
- return (react_1.default.createElement(HeadingTag, __assign({ className: (0, classnames_1.default)(className, "".concat(type, "-notice__title")) }, rest), children));
17
+ const react_1 = __importDefault(require("react"));
18
+ const classnames_1 = __importDefault(require("classnames"));
19
+ const NoticeTitle = (_a) => {
20
+ var { className, type, as, children } = _a, rest = __rest(_a, ["className", "type", "as", "children"]);
21
+ const HeadingTag = as || `h2`;
22
+ return (react_1.default.createElement(HeadingTag, Object.assign({ className: (0, classnames_1.default)(className, `${type}-notice__title`) }, rest), children));
34
23
  };
35
24
  exports.default = NoticeTitle;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.randomId = void 0;
4
- var randomId = function () { return Math.random().toString(16).slice(-4); };
4
+ const randomId = () => Math.random().toString(16).slice(-4);
5
5
  exports.randomId = randomId;
package/common/range.js CHANGED
@@ -1,8 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.range = void 0;
4
- var range = function (start, stop, step) {
5
- if (step === void 0) { step = 1; }
6
- return Array(Math.ceil(((stop + 1) - start) / step)).fill(start).map(function (x, y) { return x + y * step; });
7
- };
4
+ const range = (start, stop, step = 1) => Array(Math.ceil(((stop + 1) - start) / step)).fill(start).map((x, y) => x + y * step);
8
5
  exports.range = range;
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  * This is an empty component just to get extra property
5
5
  * for the button used in the EbayInfotipContent
6
6
  */
7
- var TooltipCloseButton = function () { return null; };
7
+ const TooltipCloseButton = () => null;
8
8
  exports.default = TooltipCloseButton;