@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
@@ -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);
@@ -48,49 +37,48 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
48
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
49
38
  };
50
39
  Object.defineProperty(exports, "__esModule", { value: true });
51
- var react_1 = __importStar(require("react"));
52
- var classnames_1 = __importDefault(require("classnames"));
53
- var component_utils_1 = require("../common/component-utils");
54
- var ebay_icon_1 = require("../ebay-icon");
55
- var button_loading_1 = __importDefault(require("./button-loading"));
56
- var button_expand_1 = __importDefault(require("./button-expand"));
57
- var EbayButton = function (_a) {
58
- var _b = _a.priority, priority = _b === void 0 ? 'secondary' : _b, _c = _a.variant, variant = _c === void 0 ? 'standard' : _c, _d = _a.size, size = _d === void 0 ? 'regular' : _d, bodyState = _a.bodyState, split = _a.split, _e = _a.transparent, transparent = _e === void 0 ? false : _e, _f = _a.fluid, fluid = _f === void 0 ? false : _f, disabled = _a.disabled, partiallyDisabled = _a.partiallyDisabled, children = _a.children, _g = _a.onKeyDown, onKeyDown = _g === void 0 ? function () { } : _g, _h = _a.onEscape, onEscape = _h === void 0 ? function () { } : _h, _j = _a.truncate, truncate = _j === void 0 ? false : _j, href = _a.href, extraClasses = _a.className, forwardedRef = _a.forwardedRef, borderless = _a.borderless, fixedHeight = _a.fixedHeight, rest = __rest(_a, ["priority", "variant", "size", "bodyState", "split", "transparent", "fluid", "disabled", "partiallyDisabled", "children", "onKeyDown", "onEscape", "truncate", "href", "className", "forwardedRef", "borderless", "fixedHeight"]);
59
- var classPrefix = href ? 'fake-btn' : 'btn';
60
- var priorityStyles = {
61
- primary: "".concat(classPrefix, "--primary"),
62
- secondary: "".concat(classPrefix, "--secondary"),
63
- tertiary: "".concat(classPrefix, "--tertiary"),
40
+ const react_1 = __importStar(require("react"));
41
+ const classnames_1 = __importDefault(require("classnames"));
42
+ const component_utils_1 = require("../common/component-utils");
43
+ const ebay_icon_1 = require("../ebay-icon");
44
+ const button_loading_1 = __importDefault(require("./button-loading"));
45
+ const button_expand_1 = __importDefault(require("./button-expand"));
46
+ const EbayButton = (_a) => {
47
+ var { priority = 'secondary', variant = 'standard', size = 'regular', bodyState, split, transparent = false, fluid = false, disabled, partiallyDisabled, children, onKeyDown = () => { }, onEscape = () => { }, truncate = false, href, className: extraClasses, forwardedRef, borderless, fixedHeight } = _a, rest = __rest(_a, ["priority", "variant", "size", "bodyState", "split", "transparent", "fluid", "disabled", "partiallyDisabled", "children", "onKeyDown", "onEscape", "truncate", "href", "className", "forwardedRef", "borderless", "fixedHeight"]);
48
+ const classPrefix = href ? 'fake-btn' : 'btn';
49
+ const priorityStyles = {
50
+ primary: `${classPrefix}--primary`,
51
+ secondary: `${classPrefix}--secondary`,
52
+ tertiary: `${classPrefix}--tertiary`,
64
53
  none: ''
65
54
  };
66
- var sizeStyles = {
67
- large: "".concat(classPrefix, "--large"),
68
- small: "".concat(classPrefix, "--small"),
55
+ const sizeStyles = {
56
+ large: `${classPrefix}--large`,
57
+ small: `${classPrefix}--small`,
69
58
  regular: '',
70
59
  default: ''
71
60
  };
72
- var splitStyles = {
73
- start: "".concat(classPrefix, "--split-start"),
74
- end: "".concat(classPrefix, "--split-end")
61
+ const splitStyles = {
62
+ start: `${classPrefix}--split-start`,
63
+ end: `${classPrefix}--split-end`
75
64
  };
76
- var isDestructive = variant === 'destructive';
77
- var isForm = variant === 'form';
78
- var isLoading = bodyState === 'loading';
79
- var isExpand = bodyState === 'expand';
80
- var isSlim = isForm && (isIconOnly(children) || (isExpand && !children));
81
- var className = (0, classnames_1.default)(classPrefix, extraClasses, priorityStyles[isForm || borderless ? 'none' : priority], sizeStyles[size], splitStyles[split], isDestructive && "".concat(classPrefix, "--destructive"), isForm && "".concat(classPrefix, "--form"), isSlim && "".concat(classPrefix, "--slim"), transparent && "".concat(classPrefix, "--transparent"), fluid && "".concat(classPrefix, "--fluid"), truncate && "".concat(classPrefix, "--truncated"), borderless && "".concat(classPrefix, "--borderless"), fixedHeight && (sizeStyles[size] ? "".concat(sizeStyles[size], "-").concat(fixedHeight) : "".concat(classPrefix, "--fixed-height")));
82
- var keyDownHandler = function (e) {
65
+ const isDestructive = variant === 'destructive';
66
+ const isForm = variant === 'form';
67
+ const isLoading = bodyState === 'loading';
68
+ const isExpand = bodyState === 'expand';
69
+ const isSlim = isForm && (isIconOnly(children) || (isExpand && !children));
70
+ const className = (0, classnames_1.default)(classPrefix, extraClasses, priorityStyles[isForm || borderless ? 'none' : priority], sizeStyles[size], splitStyles[split], isDestructive && `${classPrefix}--destructive`, isForm && `${classPrefix}--form`, isSlim && `${classPrefix}--slim`, transparent && `${classPrefix}--transparent`, fluid && `${classPrefix}--fluid`, truncate && `${classPrefix}--truncated`, borderless && `${classPrefix}--borderless`, fixedHeight && (sizeStyles[size] ? `${sizeStyles[size]}-${fixedHeight}` : `${classPrefix}--fixed-height`));
71
+ const keyDownHandler = (e) => {
83
72
  onKeyDown(e);
84
73
  if (e.key === 'Escape' || e.key === 'Esc') {
85
74
  onEscape(e);
86
75
  }
87
76
  };
88
- var bodyContent = getBodyContent(children, { isLoading: isLoading, isExpand: isExpand });
89
- var ariaLive = isLoading ? "polite" : null;
90
- return href ? (react_1.default.createElement("a", __assign({ className: className, href: disabled ? undefined : href, ref: forwardedRef, onKeyDown: keyDownHandler, "aria-live": ariaLive }, rest), bodyContent)) : (react_1.default.createElement("button", __assign({ disabled: disabled, "aria-disabled": partiallyDisabled, "aria-live": ariaLive, className: className, ref: forwardedRef, onKeyDown: keyDownHandler }, rest), bodyContent));
77
+ const bodyContent = getBodyContent(children, { isLoading, isExpand });
78
+ const ariaLive = isLoading ? `polite` : null;
79
+ return href ? (react_1.default.createElement("a", Object.assign({ className: className, href: disabled ? undefined : href, ref: forwardedRef, onKeyDown: keyDownHandler, "aria-live": ariaLive }, rest), bodyContent)) : (react_1.default.createElement("button", Object.assign({ disabled: disabled, "aria-disabled": partiallyDisabled, "aria-live": ariaLive, className: className, ref: forwardedRef, onKeyDown: keyDownHandler }, rest), bodyContent));
91
80
  };
92
- function getBodyContent(children, _a) {
93
- var isLoading = _a.isLoading, isExpand = _a.isExpand;
81
+ function getBodyContent(children, { isLoading, isExpand }) {
94
82
  switch (true) {
95
83
  case isLoading:
96
84
  return react_1.default.createElement(button_loading_1.default, null);
@@ -101,7 +89,7 @@ function getBodyContent(children, _a) {
101
89
  }
102
90
  }
103
91
  function isIconOnly(children) {
104
- var childrenArray = react_1.Children.toArray(children);
92
+ const childrenArray = react_1.Children.toArray(children);
105
93
  return childrenArray.length === 1 && childrenArray[0].type === ebay_icon_1.EbayIcon;
106
94
  }
107
95
  exports.default = (0, component_utils_1.withForwardRef)(EbayButton);
@@ -22,69 +22,57 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
26
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
27
- if (ar || !(i in from)) {
28
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
29
- ar[i] = from[i];
30
- }
31
- }
32
- return to.concat(ar || Array.prototype.slice.call(from));
33
- };
34
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
35
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
27
  };
37
28
  Object.defineProperty(exports, "__esModule", { value: true });
38
- var react_1 = __importStar(require("react"));
39
- var ebay_icon_button_1 = require("../ebay-icon-button");
40
- var date_utils_1 = require("./date-utils");
41
- var classnames_1 = __importDefault(require("classnames"));
42
- var DAY_UPDATE_KEYMAP = {
29
+ const react_1 = __importStar(require("react"));
30
+ const ebay_icon_button_1 = require("../ebay-icon-button");
31
+ const date_utils_1 = require("./date-utils");
32
+ const classnames_1 = __importDefault(require("classnames"));
33
+ const DAY_UPDATE_KEYMAP = {
43
34
  ArrowRight: 1,
44
35
  ArrowLeft: -1,
45
36
  ArrowDown: 7,
46
37
  ArrowUp: -7
47
38
  };
48
- var EbayCalendar = function (_a) {
49
- var selected = _a.selected, _b = _a.numMonths, numMonths = _b === void 0 ? 1 : _b, navigable = _a.navigable, interactive = _a.interactive, range = _a.range, locale = _a.locale, disableBefore = _a.disableBefore, disableAfter = _a.disableAfter, disableWeekdays = _a.disableWeekdays, disableList = _a.disableList, _c = _a.a11ySelectedText, a11ySelectedText = _c === void 0 ? 'selected' : _c, _d = _a.a11yRangeStartText, a11yRangeStartText = _d === void 0 ? 'start of range' : _d, _e = _a.a11yInRangeText, a11yInRangeText = _e === void 0 ? 'in range' : _e, _f = _a.a11yRangeEndText, a11yRangeEndText = _f === void 0 ? 'end of range' : _f, _g = _a.a11ySeparator, a11ySeparator = _g === void 0 ? '-' : _g, _h = _a.a11yTodayText, a11yTodayText = _h === void 0 ? 'today' : _h, _j = _a.a11yDisabledText, a11yDisabledText = _j === void 0 ? 'inactive' : _j, _k = _a.getA11yShowMonthText, getA11yShowMonthText = _k === void 0 ? function (monthTitle) { return "Show ".concat(monthTitle); } : _k, linkBuilder = _a.linkBuilder, _l = _a.onMonthChange, onMonthChange = _l === void 0 ? function () { } : _l, _m = _a.onFocus, onFocus = _m === void 0 ? function () { } : _m, _o = _a.onSelect, onSelect = _o === void 0 ? function () { } : _o;
50
- var todayISO = (0, date_utils_1.toISO)(new Date());
51
- var _p = (0, date_utils_1.getWeekdayInfo)((0, date_utils_1.localeOverride)(locale)), firstDayOfWeek = _p.firstDayOfWeek, weekdayLabels = _p.weekdayLabels;
52
- var containerRef = (0, react_1.useRef)(null);
53
- var _q = (0, react_1.useState)(0), offset = _q[0], setOffset = _q[1];
54
- var _r = (0, react_1.useState)(null), focusISO = _r[0], setFocusISO = _r[1];
55
- var _s = (0, react_1.useState)(todayISO), tabIndexISO = _s[0], setTabIndexISO = _s[1];
56
- var baseISO = (0, react_1.useRef)(todayISO);
57
- var getMonthDate = function (monthOffset) {
58
- var baseDate = (0, date_utils_1.fromISO)(baseISO.current);
59
- var date = new Date(Date.UTC(baseDate.getUTCFullYear(), baseDate.getUTCMonth() + monthOffset));
39
+ const EbayCalendar = ({ selected, numMonths = 1, navigable, interactive, range, locale, disableBefore, disableAfter, disableWeekdays, disableList, a11ySelectedText = 'selected', a11yRangeStartText = 'start of range', a11yInRangeText = 'in range', a11yRangeEndText = 'end of range', a11ySeparator = '-', a11yTodayText = 'today', a11yDisabledText = 'inactive', getA11yShowMonthText = (monthTitle) => `Show ${monthTitle}`, linkBuilder, onMonthChange = () => { }, onFocus = () => { }, onSelect = () => { } }) => {
40
+ const todayISO = (0, date_utils_1.toISO)(new Date());
41
+ const { firstDayOfWeek, weekdayLabels } = (0, date_utils_1.getWeekdayInfo)((0, date_utils_1.localeOverride)(locale));
42
+ const containerRef = (0, react_1.useRef)(null);
43
+ const [offset, setOffset] = (0, react_1.useState)(0);
44
+ const [focusISO, setFocusISO] = (0, react_1.useState)(null);
45
+ const [tabIndexISO, setTabIndexISO] = (0, react_1.useState)(todayISO);
46
+ const baseISO = (0, react_1.useRef)(todayISO);
47
+ const getMonthDate = (monthOffset) => {
48
+ const baseDate = (0, date_utils_1.fromISO)(baseISO.current);
49
+ const date = new Date(Date.UTC(baseDate.getUTCFullYear(), baseDate.getUTCMonth() + monthOffset));
60
50
  return date;
61
51
  };
62
- var getFirstVisibleISO = function () {
63
- return (0, date_utils_1.toISO)(getMonthDate(offset));
64
- };
65
- var getLastVisibleISO = function () {
66
- var baseDate = (0, date_utils_1.fromISO)(baseISO.current);
52
+ const getFirstVisibleISO = () => (0, date_utils_1.toISO)(getMonthDate(offset));
53
+ const getLastVisibleISO = () => {
54
+ const baseDate = (0, date_utils_1.fromISO)(baseISO.current);
67
55
  return (0, date_utils_1.toISO)(new Date(Date.UTC(baseDate.getUTCFullYear(), baseDate.getUTCMonth() + offset + (numMonths || 1), 0)));
68
56
  };
69
- (0, react_1.useEffect)(function () {
57
+ (0, react_1.useEffect)(() => {
70
58
  if (selected) {
71
- var selectedISOs = Array.isArray(selected) ? selected : [selected];
72
- var currFirstISO_1 = getFirstVisibleISO();
73
- var currLastISO_1 = getLastVisibleISO();
74
- var selectedTimeInView = selectedISOs.find(function (iso) { return iso >= currFirstISO_1 && iso <= currLastISO_1; });
59
+ const selectedISOs = Array.isArray(selected) ? selected : [selected];
60
+ const currFirstISO = getFirstVisibleISO();
61
+ const currLastISO = getLastVisibleISO();
62
+ const selectedTimeInView = selectedISOs.find((iso) => iso >= currFirstISO && iso <= currLastISO);
75
63
  if (selectedTimeInView === undefined) {
76
64
  baseISO.current = selectedISOs[0];
77
65
  setOffset(0);
78
66
  }
79
67
  }
80
68
  }, [selected]);
81
- var calculateRangeDisplay = function () {
69
+ const calculateRangeDisplay = () => {
82
70
  if (selected && range) {
83
- var iso1 = void 0;
84
- var iso2 = void 0;
71
+ let iso1;
72
+ let iso2;
85
73
  if (Array.isArray(selected)) {
86
74
  // Two elements are selected, we can use them as the ends of the range.
87
- iso1 = selected[0], iso2 = selected[1];
75
+ [iso1, iso2] = selected;
88
76
  }
89
77
  else if (focusISO) {
90
78
  // One element is selected and the user is focused on a date,
@@ -93,7 +81,7 @@ var EbayCalendar = function (_a) {
93
81
  iso2 = focusISO;
94
82
  }
95
83
  if (iso1 && iso2) {
96
- var _a = [iso1, iso2].sort(), start = _a[0], end = _a[1];
84
+ const [start, end] = [iso1, iso2].sort();
97
85
  return {
98
86
  rangeStart: start,
99
87
  rangeEnd: end
@@ -105,50 +93,48 @@ var EbayCalendar = function (_a) {
105
93
  rangeEnd: null
106
94
  };
107
95
  };
108
- var monthTitle = function (date) {
109
- var formatter = new Intl.DateTimeFormat((0, date_utils_1.localeOverride)(locale), {
96
+ const monthTitle = (date) => {
97
+ const formatter = new Intl.DateTimeFormat((0, date_utils_1.localeOverride)(locale), {
110
98
  month: 'long',
111
99
  year: 'numeric'
112
100
  });
113
101
  return formatter.format(new Date(date.getUTCFullYear(), date.getUTCMonth()));
114
102
  };
115
- var isDayDisabled = function (iso) {
116
- return (disableBefore && iso < disableBefore) ||
117
- (disableAfter && iso > disableAfter) ||
118
- (disableWeekdays && disableWeekdays.includes((0, date_utils_1.fromISO)(iso).getUTCDay())) ||
119
- (disableList && disableList.includes(iso));
120
- };
121
- var getFirstActiveISO = function () {
122
- var iso = getFirstVisibleISO();
123
- var lastVisible = getLastVisibleISO();
103
+ const isDayDisabled = (iso) => (disableBefore && iso < disableBefore) ||
104
+ (disableAfter && iso > disableAfter) ||
105
+ (disableWeekdays && disableWeekdays.includes((0, date_utils_1.fromISO)(iso).getUTCDay())) ||
106
+ (disableList && disableList.includes(iso));
107
+ const getFirstActiveISO = () => {
108
+ let iso = getFirstVisibleISO();
109
+ const lastVisible = getLastVisibleISO();
124
110
  while (iso <= lastVisible && isDayDisabled(iso)) {
125
111
  iso = (0, date_utils_1.offsetISO)(iso, 1);
126
112
  }
127
113
  return iso > lastVisible ? null : iso;
128
114
  };
129
- var getLastActiveISO = function () {
130
- var iso = getLastVisibleISO();
131
- var firstVisible = getFirstVisibleISO();
115
+ const getLastActiveISO = () => {
116
+ let iso = getLastVisibleISO();
117
+ const firstVisible = getFirstVisibleISO();
132
118
  while (iso >= firstVisible && isDayDisabled(iso)) {
133
119
  iso = (0, date_utils_1.offsetISO)(iso, -1);
134
120
  }
135
121
  return iso < firstVisible ? null : iso;
136
122
  };
137
- var setTabindexAndFocus = function (iso) {
123
+ const setTabindexAndFocus = (iso) => {
138
124
  setTabIndexISO(iso);
139
- setTimeout(function () {
125
+ setTimeout(() => {
140
126
  var _a;
141
- var elementToFocus = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("[data-iso=\"".concat(iso, "\"]"));
127
+ const elementToFocus = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-iso="${iso}"]`);
142
128
  elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.focus();
143
129
  });
144
130
  };
145
- var prevMonth = function (focus) {
131
+ const prevMonth = (focus) => {
146
132
  if (disableBefore && getFirstVisibleISO() <= disableBefore) {
147
133
  return false;
148
134
  }
149
- setOffset(function (currentOffset) { return currentOffset - 1; });
150
- var newTabIndexISO = tabIndexISO;
151
- var lastActiveISO = getLastActiveISO();
135
+ setOffset((currentOffset) => currentOffset - 1);
136
+ let newTabIndexISO = tabIndexISO;
137
+ const lastActiveISO = getLastActiveISO();
152
138
  if (lastActiveISO && lastActiveISO < tabIndexISO) {
153
139
  newTabIndexISO = lastActiveISO;
154
140
  setTabIndexISO(lastActiveISO);
@@ -161,13 +147,13 @@ var EbayCalendar = function (_a) {
161
147
  });
162
148
  return true;
163
149
  };
164
- var nextMonth = function (focus) {
150
+ const nextMonth = (focus) => {
165
151
  if (disableAfter && getLastVisibleISO() >= disableAfter) {
166
152
  return false;
167
153
  }
168
- setOffset(function (currentOffset) { return currentOffset + 1; });
169
- var newTabIndexISO = tabIndexISO;
170
- var firstActiveISO = getFirstActiveISO();
154
+ setOffset((currentOffset) => currentOffset + 1);
155
+ let newTabIndexISO = tabIndexISO;
156
+ const firstActiveISO = getFirstActiveISO();
171
157
  if (firstActiveISO && firstActiveISO > tabIndexISO) {
172
158
  newTabIndexISO = firstActiveISO;
173
159
  setTabIndexISO(firstActiveISO);
@@ -179,18 +165,18 @@ var EbayCalendar = function (_a) {
179
165
  iso: (0, date_utils_1.toISO)(getMonthDate(offset + (numMonths || 1)))
180
166
  });
181
167
  };
182
- var onKeyDown = function (event) {
183
- var dayChange = DAY_UPDATE_KEYMAP[event.key];
168
+ const onKeyDown = (event) => {
169
+ const dayChange = DAY_UPDATE_KEYMAP[event.key];
184
170
  if (dayChange) {
185
171
  event.preventDefault();
186
- var tries = 7;
187
- var iso = tabIndexISO;
172
+ let tries = 7;
173
+ let iso = tabIndexISO;
188
174
  do {
189
175
  iso = (0, date_utils_1.offsetISO)(iso, dayChange);
190
176
  } while (tries-- > 0 && isDayDisabled(iso));
191
177
  if (tries > 0) {
192
- var firstVisible = getFirstVisibleISO();
193
- var lastVisible = getLastVisibleISO();
178
+ const firstVisible = getFirstVisibleISO();
179
+ const lastVisible = getLastVisibleISO();
194
180
  if (iso < firstVisible) {
195
181
  if (navigable) {
196
182
  prevMonth();
@@ -228,19 +214,19 @@ var EbayCalendar = function (_a) {
228
214
  }
229
215
  }
230
216
  };
231
- var onDaySelect = function (event, iso) {
232
- onSelect(event, { iso: iso });
217
+ const onDaySelect = (event, iso) => {
218
+ onSelect(event, { iso });
233
219
  };
234
- var onDayFocus = function (event, day) {
220
+ const onDayFocus = (event, day) => {
235
221
  setFocusISO(day);
236
222
  setTabIndexISO(day);
237
223
  onFocus(event, { iso: day });
238
224
  };
239
- var onDayBlur = function () {
225
+ const onDayBlur = () => {
240
226
  setFocusISO(null);
241
227
  };
242
- var _t = calculateRangeDisplay(), rangeStart = _t.rangeStart, rangeEnd = _t.rangeEnd;
243
- var isDayInRange = function (iso) {
228
+ const { rangeStart, rangeEnd } = calculateRangeDisplay();
229
+ const isDayInRange = (iso) => {
244
230
  if (!rangeStart || !rangeEnd) {
245
231
  return false;
246
232
  }
@@ -249,28 +235,28 @@ var EbayCalendar = function (_a) {
249
235
  }
250
236
  return true;
251
237
  };
252
- var monthDates = __spreadArray([], Array(numMonths), true).map(function (_, i) { return getMonthDate(offset + i); });
238
+ const monthDates = [...Array(numMonths)].map((_, i) => getMonthDate(offset + i));
253
239
  return (react_1.default.createElement("div", { className: "calendar", ref: containerRef },
254
240
  navigable && (react_1.default.createElement("div", { className: "calendar__header" },
255
241
  react_1.default.createElement("div", { className: "calendar__header--inner" },
256
- react_1.default.createElement(ebay_icon_button_1.EbayIconButton, { transparent: true, size: "small", icon: "chevronLeft24", disabled: disableBefore && getFirstVisibleISO() <= disableBefore, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset - 1))), onClick: function () { return prevMonth(); } }),
257
- monthDates.map(function (monthDate, i) { return (react_1.default.createElement("h3", { key: i }, monthTitle(monthDate))); }),
258
- react_1.default.createElement(ebay_icon_button_1.EbayIconButton, { transparent: true, size: "small", icon: "chevronRight24", disabled: disableAfter && getLastVisibleISO() >= disableAfter, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset + numMonths))), onClick: function () { return nextMonth(); } })))),
259
- react_1.default.createElement("div", { className: "calendar__body" }, monthDates.map(function (monthDate, i) {
260
- var numBlankDays = (monthDate.getUTCDay() - firstDayOfWeek + 7) % 7;
261
- var year = monthDate.getUTCFullYear();
262
- var month = monthDate.getUTCMonth();
263
- var daysInMont = new Date(year, month + 1, 0).getDate();
264
- var calendarRows = __spreadArray([], Array(Math.ceil((numBlankDays + daysInMont) / 7)), true);
242
+ react_1.default.createElement(ebay_icon_button_1.EbayIconButton, { transparent: true, size: "small", icon: "chevronLeft24", disabled: disableBefore && getFirstVisibleISO() <= disableBefore, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset - 1))), onClick: () => prevMonth() }),
243
+ monthDates.map((monthDate, i) => (react_1.default.createElement("h3", { key: i }, monthTitle(monthDate)))),
244
+ react_1.default.createElement(ebay_icon_button_1.EbayIconButton, { transparent: true, size: "small", icon: "chevronRight24", disabled: disableAfter && getLastVisibleISO() >= disableAfter, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset + numMonths))), onClick: () => nextMonth() })))),
245
+ react_1.default.createElement("div", { className: "calendar__body" }, monthDates.map((monthDate, i) => {
246
+ const numBlankDays = (monthDate.getUTCDay() - firstDayOfWeek + 7) % 7;
247
+ const year = monthDate.getUTCFullYear();
248
+ const month = monthDate.getUTCMonth();
249
+ const daysInMont = new Date(year, month + 1, 0).getDate();
250
+ const calendarRows = [...Array(Math.ceil((numBlankDays + daysInMont) / 7))];
265
251
  return (react_1.default.createElement("div", { key: i, className: "calendar__month" },
266
252
  react_1.default.createElement("table", { onKeyDown: onKeyDown },
267
253
  react_1.default.createElement("caption", null, monthTitle(monthDate)),
268
254
  react_1.default.createElement("thead", null,
269
- react_1.default.createElement("tr", null, weekdayLabels.map(function (dayName) { return (react_1.default.createElement("th", { key: dayName, scope: "col" }, dayName)); }))),
270
- react_1.default.createElement("tbody", null, calendarRows.map(function (_, row) {
271
- var startDate = row * 7 - numBlankDays + 1;
272
- var endDate = startDate + 6;
273
- var columns = [];
255
+ react_1.default.createElement("tr", null, weekdayLabels.map((dayName) => (react_1.default.createElement("th", { key: dayName, scope: "col" }, dayName))))),
256
+ react_1.default.createElement("tbody", null, calendarRows.map((_, row) => {
257
+ let startDate = row * 7 - numBlankDays + 1;
258
+ let endDate = startDate + 6;
259
+ const columns = [];
274
260
  if (row === 0 && numBlankDays !== 0) {
275
261
  startDate = 1;
276
262
  columns.push(react_1.default.createElement("td", { key: "pre-column", colSpan: numBlankDays }));
@@ -278,17 +264,17 @@ var EbayCalendar = function (_a) {
278
264
  else if (endDate > daysInMont) {
279
265
  endDate = daysInMont;
280
266
  }
281
- var _loop_1 = function (day) {
282
- var dayISO = (0, date_utils_1.toISO)(new Date(Date.UTC(year, month, day)));
283
- var isToday = dayISO === todayISO;
284
- var isSelected = Array.isArray(selected)
285
- ? selected.some(function (iso) { return iso === dayISO; })
267
+ for (let day = startDate; day <= endDate; day++) {
268
+ const dayISO = (0, date_utils_1.toISO)(new Date(Date.UTC(year, month, day)));
269
+ const isToday = dayISO === todayISO;
270
+ const isSelected = Array.isArray(selected)
271
+ ? selected.some((iso) => iso === dayISO)
286
272
  : selected === dayISO;
287
- var isRangeStart = dayISO === rangeStart;
288
- var isInRange = isDayInRange(dayISO);
289
- var isRangeEnd = dayISO === rangeEnd;
290
- var isDisabled = isDayDisabled(dayISO);
291
- var a11yTexts = [
273
+ const isRangeStart = dayISO === rangeStart;
274
+ const isInRange = isDayInRange(dayISO);
275
+ const isRangeEnd = dayISO === rangeEnd;
276
+ const isDisabled = isDayDisabled(dayISO);
277
+ const a11yTexts = [
292
278
  '',
293
279
  isSelected && a11ySelectedText,
294
280
  isRangeStart && a11yRangeStartText,
@@ -296,25 +282,22 @@ var EbayCalendar = function (_a) {
296
282
  isRangeEnd && a11yRangeEndText,
297
283
  !interactive && isToday && a11yTodayText,
298
284
  !interactive && isDisabled && a11yDisabledText
299
- ].filter(function (value) { return typeof value !== 'boolean' || value !== false; });
300
- var link = !interactive && !isDisabled && linkBuilder && linkBuilder(dayISO);
301
- var NonInteractiveTag = link ? 'a' : 'span';
285
+ ].filter((value) => typeof value !== 'boolean' || value !== false);
286
+ const link = !interactive && !isDisabled && linkBuilder && linkBuilder(dayISO);
287
+ const NonInteractiveTag = link ? 'a' : 'span';
302
288
  columns.push(react_1.default.createElement("td", { key: day, className: (0, classnames_1.default)({
303
289
  'calendar__cell--selected': isSelected,
304
290
  'calendar__range--start': isRangeStart,
305
291
  'calendar__range': isInRange,
306
292
  'calendar__range--end': isRangeEnd
307
293
  }) }, interactive ? (react_1.default.createElement("button", { disabled: isDisabled, "aria-label": a11yTexts.length > 1
308
- ? "".concat(day).concat(a11yTexts.join(a11ySeparator))
309
- : undefined, tabIndex: tabIndexISO !== dayISO ? -1 : undefined, "aria-current": isToday ? 'date' : undefined, "aria-pressed": isSelected ? 'true' : undefined, onClick: function (event) { return onDaySelect(event, dayISO); }, onFocus: function (event) { return onDayFocus(event, dayISO); }, onMouseOver: function (event) { return onDayFocus(event, dayISO); }, onMouseOut: function (event) { return onDayBlur(); }, onBlur: function () { return onDayBlur(); }, "data-iso": dayISO }, day)) : (react_1.default.createElement(NonInteractiveTag, { className: (0, classnames_1.default)({
294
+ ? `${day}${a11yTexts.join(a11ySeparator)}`
295
+ : undefined, tabIndex: tabIndexISO !== dayISO ? -1 : undefined, "aria-current": isToday ? 'date' : undefined, "aria-pressed": isSelected ? 'true' : undefined, onClick: (event) => onDaySelect(event, dayISO), onFocus: (event) => onDayFocus(event, dayISO), onMouseOver: (event) => onDayFocus(event, dayISO), onMouseOut: (event) => onDayBlur(), onBlur: () => onDayBlur(), "data-iso": dayISO }, day)) : (react_1.default.createElement(NonInteractiveTag, { className: (0, classnames_1.default)({
310
296
  'calendar__cell--disabled': isDisabled,
311
297
  'calendar__cell--current': isToday
312
298
  }), href: link },
313
299
  day,
314
300
  a11yTexts.length > 1 && (react_1.default.createElement("span", { className: "clipped" }, a11yTexts.join(a11ySeparator)))))));
315
- };
316
- for (var day = startDate; day <= endDate; day++) {
317
- _loop_1(day);
318
301
  }
319
302
  return (react_1.default.createElement("tr", { key: row }, columns));
320
303
  })))));
@@ -1,19 +1,10 @@
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
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.localeOverride = exports.offsetISO = exports.fromISO = exports.toISO = exports.dateArgToISO = exports.getWeekdayInfo = exports.findFirstDayOfWeek = void 0;
13
4
  function findFirstDayOfWeek(localeName) {
14
5
  // weekInfo only exists on some browsers, so we default to Sunday otherwise
15
6
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/weekInfo
16
- var locale = new Intl.Locale(localeName);
7
+ const locale = new Intl.Locale(localeName);
17
8
  if (locale.weekInfo) {
18
9
  return locale.weekInfo.firstDay;
19
10
  }
@@ -21,19 +12,19 @@ function findFirstDayOfWeek(localeName) {
21
12
  }
22
13
  exports.findFirstDayOfWeek = findFirstDayOfWeek;
23
14
  function getWeekdayInfo(localeName) {
24
- var firstDayOfWeek = findFirstDayOfWeek(localeName);
25
- var weekdayLabelFormatter = new Intl.DateTimeFormat(localeName, {
15
+ const firstDayOfWeek = findFirstDayOfWeek(localeName);
16
+ const weekdayLabelFormatter = new Intl.DateTimeFormat(localeName, {
26
17
  weekday: 'short'
27
18
  });
28
- var weekday = new Date(2022, 9, 2 + firstDayOfWeek); // October 2, 2022 was a Sunday
29
- var weekdayLabels = __spreadArray([], Array(7), true).map(function () {
30
- var dayLabel = weekdayLabelFormatter.format(weekday);
19
+ const weekday = new Date(2022, 9, 2 + firstDayOfWeek); // October 2, 2022 was a Sunday
20
+ const weekdayLabels = [...Array(7)].map(() => {
21
+ const dayLabel = weekdayLabelFormatter.format(weekday);
31
22
  weekday.setDate(weekday.getDate() + 1);
32
23
  return dayLabel;
33
24
  });
34
25
  return {
35
- firstDayOfWeek: firstDayOfWeek,
36
- weekdayLabels: weekdayLabels
26
+ firstDayOfWeek,
27
+ weekdayLabels
37
28
  };
38
29
  }
39
30
  exports.getWeekdayInfo = getWeekdayInfo;
@@ -56,7 +47,7 @@ function fromISO(iso) {
56
47
  }
57
48
  exports.fromISO = fromISO;
58
49
  function offsetISO(iso, days) {
59
- var date = fromISO(iso);
50
+ const date = fromISO(iso);
60
51
  date.setUTCDate(date.getUTCDate() + days);
61
52
  return toISO(date);
62
53
  }
@@ -3,23 +3,22 @@ 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 ebay_icon_1 = require("../ebay-icon");
9
- var icon = {
6
+ const react_1 = __importDefault(require("react"));
7
+ const classnames_1 = __importDefault(require("classnames"));
8
+ const ebay_icon_1 = require("../ebay-icon");
9
+ const icon = {
10
10
  prev: 'chevronLeft12',
11
11
  next: 'chevronRight12'
12
12
  };
13
- var typeToDirection = {
13
+ const typeToDirection = {
14
14
  prev: 'LEFT',
15
15
  next: 'RIGHT'
16
16
  };
17
- var CarouselControlButton = function (_a) {
18
- var type = _a.type, label = _a.label, hidden = _a.hidden, disabled = _a.disabled, onClick = _a.onClick;
19
- var handleOnClick = function (event) {
17
+ const CarouselControlButton = ({ type, label, hidden, disabled, onClick }) => {
18
+ const handleOnClick = (event) => {
20
19
  onClick(event, { direction: typeToDirection[type] });
21
20
  };
22
- return (react_1.default.createElement("button", { className: (0, classnames_1.default)('carousel__control', "carousel__control--".concat(type)), "aria-label": label, "aria-disabled": disabled, disabled: disabled, onClick: handleOnClick },
23
- react_1.default.createElement(ebay_icon_1.EbayIcon, { className: (0, classnames_1.default)('icon', "icon--carousel-".concat(type)), focusable: false, name: icon[type], "aria-hidden": hidden })));
21
+ return (react_1.default.createElement("button", { className: (0, classnames_1.default)('carousel__control', `carousel__control--${type}`), "aria-label": label, "aria-disabled": disabled, disabled: disabled, onClick: handleOnClick },
22
+ react_1.default.createElement(ebay_icon_1.EbayIcon, { className: (0, classnames_1.default)('icon', `icon--carousel-${type}`), focusable: false, name: icon[type], "aria-hidden": hidden })));
24
23
  };
25
24
  exports.default = CarouselControlButton;
@@ -7,6 +7,6 @@ type CarouselItemProps = ListProps & {
7
7
  className?: string;
8
8
  forwardedRef?: RefObject<ListItemRef>;
9
9
  };
10
- declare const _default: React.ForwardRefExoticComponent<Pick<CarouselItemProps, "forwardedRef" | "key" | "offset" | "slideWidth" | keyof React.LiHTMLAttributes<HTMLLIElement>> & React.RefAttributes<React.FC<CarouselItemProps>>>;
10
+ declare const _default: React.ForwardRefExoticComponent<Omit<CarouselItemProps, "ref"> & React.RefAttributes<React.FC<CarouselItemProps>>>;
11
11
  export default _default;
12
12
  //# sourceMappingURL=carousel-item.d.ts.map
@@ -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);
@@ -45,26 +34,26 @@ var __rest = (this && this.__rest) || function (s, e) {
45
34
  return t;
46
35
  };
47
36
  Object.defineProperty(exports, "__esModule", { value: true });
48
- var react_1 = __importStar(require("react"));
49
- var component_utils_1 = require("../common/component-utils");
50
- var helpers_1 = require("./helpers");
51
- var EbayCarouselItem = function (_a) {
52
- var slideWidth = _a.slideWidth, offset = _a.offset, forwardedRef = _a.forwardedRef, children = _a.children, rest = __rest(_a, ["slideWidth", "offset", "forwardedRef", "children"]);
53
- var itemRef = (0, react_1.useRef)();
54
- var _b = (0, react_1.useState)(false), isVisible = _b[0], setIsVisible = _b[1];
55
- (0, react_1.useImperativeHandle)(forwardedRef, function () {
37
+ const react_1 = __importStar(require("react"));
38
+ const component_utils_1 = require("../common/component-utils");
39
+ const helpers_1 = require("./helpers");
40
+ const EbayCarouselItem = (_a) => {
41
+ var { slideWidth, offset, forwardedRef, children } = _a, rest = __rest(_a, ["slideWidth", "offset", "forwardedRef", "children"]);
42
+ const itemRef = (0, react_1.useRef)();
43
+ const [isVisible, setIsVisible] = (0, react_1.useState)(false);
44
+ (0, react_1.useImperativeHandle)(forwardedRef, () => {
56
45
  if (!itemRef.current)
57
46
  return;
58
- var _a = (0, helpers_1.getRelativeRects)(itemRef.current), left = _a.left, right = _a.right;
59
- var fullyVisible = left === undefined ||
47
+ const { left, right } = (0, helpers_1.getRelativeRects)(itemRef.current);
48
+ const fullyVisible = left === undefined ||
60
49
  (left - offset >= -0.01 && right - offset <= slideWidth + 0.01);
61
50
  setIsVisible(fullyVisible);
62
51
  return {
63
- left: left,
64
- right: right,
65
- fullyVisible: fullyVisible
52
+ left,
53
+ right,
54
+ fullyVisible
66
55
  };
67
56
  }, [slideWidth, offset]);
68
- return (react_1.default.createElement("li", __assign({ ref: itemRef, "aria-hidden": !isVisible }, rest), children));
57
+ return (react_1.default.createElement("li", Object.assign({ ref: itemRef, "aria-hidden": !isVisible }, rest), children));
69
58
  };
70
59
  exports.default = (0, component_utils_1.withForwardRef)(EbayCarouselItem);