@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,24 +37,23 @@ 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 tooltip_utils_1 = require("../common/tooltip-utils");
55
- var ebay_drawer_dialog_1 = require("../ebay-drawer-dialog");
56
- var ebay_dialog_base_1 = require("../ebay-dialog-base");
57
- var ebay_infotip_host_1 = __importDefault(require("./ebay-infotip-host"));
58
- var index_1 = require("./index");
59
- var EbayInfotip = function (_a) {
60
- var _b = _a.variant, variant = _b === void 0 ? 'default' : _b, pointer = _a.pointer, overlayStyle = _a.overlayStyle, disabled = _a.disabled, onExpand = _a.onExpand, onCollapse = _a.onCollapse, children = _a.children, initialExpanded = _a.initialExpanded, _c = _a.icon, icon = _c === void 0 ? 'information16' : _c, a11yCloseText = _a.a11yCloseText, ariaLabel = _a["aria-label"], className = _a.className, a11yMaximizeText = _a.a11yMaximizeText, a11yMinimizeText = _a.a11yMinimizeText;
61
- var buttonRef = (0, react_1.useRef)();
62
- var _d = (0, tooltip_utils_1.useTooltip)({ onCollapse: onCollapse, onExpand: onExpand, initialExpanded: initialExpanded, hostRef: buttonRef }), isExpanded = _d.isExpanded, expandTooltip = _d.expandTooltip, collapseTooltip = _d.collapseTooltip;
63
- var isModal = variant === 'modal';
64
- var containerRef = (0, react_1.useRef)();
65
- var heading = (0, component_utils_1.findComponent)(children, index_1.EbayInfotipHeading);
66
- var content = (0, component_utils_1.findComponent)(children, index_1.EbayInfotipContent);
67
- var button = (0, component_utils_1.findComponent)(children, ebay_infotip_host_1.default) || (0, react_1.createElement)(ebay_infotip_host_1.default);
68
- var toggleTooltip = function () {
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 tooltip_utils_1 = require("../common/tooltip-utils");
44
+ const ebay_drawer_dialog_1 = require("../ebay-drawer-dialog");
45
+ const ebay_dialog_base_1 = require("../ebay-dialog-base");
46
+ const ebay_infotip_host_1 = __importDefault(require("./ebay-infotip-host"));
47
+ const index_1 = require("./index");
48
+ const EbayInfotip = ({ variant = 'default', pointer, overlayStyle, disabled, onExpand, onCollapse, children, initialExpanded, icon = 'information16', a11yCloseText, 'aria-label': ariaLabel, className, a11yMaximizeText, a11yMinimizeText }) => {
49
+ const buttonRef = (0, react_1.useRef)();
50
+ const { isExpanded, expandTooltip, collapseTooltip } = (0, tooltip_utils_1.useTooltip)({ onCollapse, onExpand, initialExpanded, hostRef: buttonRef });
51
+ const isModal = variant === 'modal';
52
+ const containerRef = (0, react_1.useRef)();
53
+ const heading = (0, component_utils_1.findComponent)(children, index_1.EbayInfotipHeading);
54
+ const content = (0, component_utils_1.findComponent)(children, index_1.EbayInfotipContent);
55
+ const button = (0, component_utils_1.findComponent)(children, ebay_infotip_host_1.default) || (0, react_1.createElement)(ebay_infotip_host_1.default);
56
+ const toggleTooltip = () => {
69
57
  if (isExpanded) {
70
58
  collapseTooltip();
71
59
  }
@@ -74,16 +62,17 @@ var EbayInfotip = function (_a) {
74
62
  }
75
63
  };
76
64
  if (!content) {
77
- throw new Error("EbayInfotip: Please use a EbayInfotipContent that defines the content of the infotip");
65
+ throw new Error(`EbayInfotip: Please use a EbayInfotipContent that defines the content of the infotip`);
78
66
  }
79
- var _e = content.props, contentChildren = _e.children, contentProps = __rest(_e, ["children"]);
67
+ const _a = content.props, { children: contentChildren } = _a, contentProps = __rest(_a, ["children"]);
80
68
  return (react_1.default.createElement(react_1.default.Fragment, null,
81
69
  react_1.default.createElement(tooltip_utils_1.Tooltip, { type: "infotip", isExpanded: isExpanded, className: (0, classnames_1.default)(className, { 'dialog--mini': isModal }), ref: containerRef },
82
- react_1.default.createElement(tooltip_utils_1.TooltipHost, null, (0, react_1.cloneElement)(button, __assign({ ref: buttonRef, onClick: toggleTooltip, disabled: disabled, variant: variant, 'aria-label': ariaLabel, 'aria-expanded': isExpanded, icon: icon }, button.props))),
83
- !isModal && (react_1.default.createElement(tooltip_utils_1.TooltipContent, __assign({}, contentProps, { type: "infotip", style: overlayStyle, pointer: pointer, showCloseButton: true, a11yCloseText: a11yCloseText, onClose: collapseTooltip }),
70
+ react_1.default.createElement(tooltip_utils_1.TooltipHost, null, (0, react_1.cloneElement)(button, Object.assign({ ref: buttonRef, onClick: toggleTooltip, disabled,
71
+ variant, 'aria-label': ariaLabel, 'aria-expanded': isExpanded, icon }, button.props))),
72
+ !isModal && (react_1.default.createElement(tooltip_utils_1.TooltipContent, Object.assign({}, contentProps, { type: "infotip", style: overlayStyle, pointer: pointer, showCloseButton: true, a11yCloseText: a11yCloseText, onClose: collapseTooltip }),
84
73
  heading,
85
74
  contentChildren))),
86
- isModal && (react_1.default.createElement(ebay_drawer_dialog_1.EbayDrawerDialog, __assign({}, contentProps, { open: isExpanded, onClose: collapseTooltip, mode: "mini", a11yCloseText: a11yCloseText, className: "dialog--mini__overlay", a11yMaximizeText: a11yMaximizeText, a11yMinimizeText: a11yMinimizeText }),
75
+ isModal && (react_1.default.createElement(ebay_drawer_dialog_1.EbayDrawerDialog, Object.assign({}, contentProps, { open: isExpanded, onClose: collapseTooltip, a11yCloseText: a11yCloseText, className: "dialog--mini__overlay", a11yMaximizeText: a11yMaximizeText, a11yMinimizeText: a11yMinimizeText }),
87
76
  react_1.default.createElement(ebay_dialog_base_1.EbayDialogHeader, null, heading),
88
77
  contentChildren))));
89
78
  };
@@ -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,16 +37,15 @@ 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 ebay_notice_content_1 = require("../ebay-notice-base/components/ebay-notice-content");
54
- var notice_content_1 = __importDefault(require("../common/notice-utils/notice-content"));
55
- var component_utils_1 = require("../common/component-utils");
56
- var ebay_icon_1 = require("../ebay-icon");
57
- var EbayInlineNotice = function (_a) {
58
- var _b;
59
- var className = _a.className, _c = _a.status, status = _c === void 0 ? 'general' : _c, children = _a.children, _d = _a.hidden, hidden = _d === void 0 ? false : _d, ariaLabel = _a["aria-label"], _e = _a.onNoticeShow, onNoticeShow = _e === void 0 ? function () { } : _e, rest = __rest(_a, ["className", "status", "children", "hidden", 'aria-label', "onNoticeShow"]);
60
- (0, react_1.useEffect)(function () {
40
+ const react_1 = __importStar(require("react"));
41
+ const classnames_1 = __importDefault(require("classnames"));
42
+ const ebay_notice_content_1 = require("../ebay-notice-base/components/ebay-notice-content");
43
+ const notice_content_1 = __importDefault(require("../common/notice-utils/notice-content"));
44
+ const component_utils_1 = require("../common/component-utils");
45
+ const ebay_icon_1 = require("../ebay-icon");
46
+ const EbayInlineNotice = (_a) => {
47
+ var { className, status = 'general', children, hidden = false, 'aria-label': ariaLabel, onNoticeShow = () => { } } = _a, rest = __rest(_a, ["className", "status", "children", "hidden", 'aria-label', "onNoticeShow"]);
48
+ (0, react_1.useEffect)(() => {
61
49
  if (!hidden) {
62
50
  onNoticeShow();
63
51
  }
@@ -65,14 +53,14 @@ var EbayInlineNotice = function (_a) {
65
53
  if (hidden) {
66
54
  return null;
67
55
  }
68
- var content = (0, component_utils_1.findComponent)(children, ebay_notice_content_1.EbayNoticeContent);
56
+ const content = (0, component_utils_1.findComponent)(children, ebay_notice_content_1.EbayNoticeContent);
69
57
  if (!content) {
70
- throw new Error("EbayInlineNotice: Please use a EbayNoticeContent that defines the content of the notice");
58
+ throw new Error(`EbayInlineNotice: Please use a EbayNoticeContent that defines the content of the notice`);
71
59
  }
72
- var isGeneral = status === "general";
73
- return (react_1.default.createElement("div", __assign({}, rest, { className: (0, classnames_1.default)(className, 'inline-notice', (_b = {}, _b["inline-notice--".concat(status)] = !isGeneral, _b)) }),
60
+ const isGeneral = status === `general`;
61
+ return (react_1.default.createElement("div", Object.assign({}, rest, { className: (0, classnames_1.default)(className, 'inline-notice', { [`inline-notice--${status}`]: !isGeneral }) }),
74
62
  !isGeneral ? (react_1.default.createElement("span", { className: "inline-notice__header" },
75
- react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "".concat(status, "Filled16"), a11yText: ariaLabel, a11yVariant: "label" }))) : null,
76
- react_1.default.createElement(notice_content_1.default, __assign({}, content.props, { type: "inline" }))));
63
+ react_1.default.createElement(ebay_icon_1.EbayIcon, { name: `${status}Filled16`, a11yText: ariaLabel, a11yVariant: "label" }))) : null,
64
+ react_1.default.createElement(notice_content_1.default, Object.assign({}, content.props, { type: "inline" }))));
77
65
  };
78
66
  exports.default = EbayInlineNotice;
@@ -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,15 +14,14 @@ 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 ebay_dialog_base_1 = require("../ebay-dialog-base");
31
- var classPrefix = 'lightbox-dialog';
32
- var EbayLightboxDialog = function (_a) {
33
- var _b;
34
- var open = _a.open, mode = _a.mode, size = _a.size, _c = _a.onClose, onClose = _c === void 0 ? function () { } : _c, rest = __rest(_a, ["open", "mode", "size", "onClose"]);
35
- return (react_1.default.createElement(ebay_dialog_base_1.DialogBaseWithState, __assign({ buttonPosition: "right" }, rest, { classPrefix: classPrefix, onCloseBtnClick: onClose, onBackgroundClick: onClose, className: (0, classnames_1.default)(rest.className, "".concat(classPrefix, "--mask-fade"), size && "".concat(classPrefix, "--").concat(size)), windowClass: (0, classnames_1.default)('lightbox-dialog__window--fade', (_b = {},
36
- _b["".concat(classPrefix, "__window--mini")] = mode === 'mini',
37
- _b)), open: open })));
17
+ const react_1 = __importDefault(require("react"));
18
+ const classnames_1 = __importDefault(require("classnames"));
19
+ const ebay_dialog_base_1 = require("../ebay-dialog-base");
20
+ const classPrefix = 'lightbox-dialog';
21
+ const EbayLightboxDialog = (_a) => {
22
+ var { open, mode, size, onClose = () => { } } = _a, rest = __rest(_a, ["open", "mode", "size", "onClose"]);
23
+ return (react_1.default.createElement(ebay_dialog_base_1.DialogBaseWithState, Object.assign({ buttonPosition: "right" }, rest, { classPrefix: classPrefix, onCloseBtnClick: onClose, onBackgroundClick: onClose, className: (0, classnames_1.default)(rest.className, `${classPrefix}--mask-fade`, size && `${classPrefix}--${size}`), windowClass: (0, classnames_1.default)('lightbox-dialog__window--fade', {
24
+ [`${classPrefix}__window--mini`]: mode === 'mini'
25
+ }), open: open })));
38
26
  };
39
27
  exports.default = EbayLightboxDialog;
@@ -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,13 +14,13 @@ 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 ebay_icon_1 = require("../ebay-icon");
31
- var ListboxOption = function (_a) {
32
- var value = _a.value, children = _a.children, selected = _a.selected, onClick = _a.onClick, index = _a.index, innerRef = _a.innerRef, className = _a.className, id = _a.id, rest = __rest(_a, ["value", "children", "selected", "onClick", "index", "innerRef", "className", "id"]);
33
- var wrapperClassName = (0, classnames_1.default)("listbox-button__option", className, { 'listbox-button__option--active': selected });
34
- return (react_1.default.createElement("div", __assign({}, rest, { className: wrapperClassName, role: "option", id: id || "listbox_btn_".concat(value, "_").concat(index), "aria-selected": selected, ref: innerRef, onClick: function (e) { onClick(e, value, index); } }),
17
+ const react_1 = __importDefault(require("react"));
18
+ const classnames_1 = __importDefault(require("classnames"));
19
+ const ebay_icon_1 = require("../ebay-icon");
20
+ const ListboxOption = (_a) => {
21
+ var { value, children, selected, onClick, index, innerRef, className, id } = _a, rest = __rest(_a, ["value", "children", "selected", "onClick", "index", "innerRef", "className", "id"]);
22
+ const wrapperClassName = (0, classnames_1.default)(`listbox-button__option`, className, { 'listbox-button__option--active': selected });
23
+ return (react_1.default.createElement("div", Object.assign({}, rest, { className: wrapperClassName, role: "option", id: id || `listbox_btn_${value}_${index}`, "aria-selected": selected, ref: innerRef, onClick: (e) => { onClick(e, value, index); } }),
35
24
  react_1.default.createElement("span", { className: "listbox-button__value" }, children),
36
25
  react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "tick16" })));
37
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"listbox-button.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button.tsx"],"names":[],"mappings":"AAAA,OAAc,EAEV,cAAc,EAAE,EAAE,EACrB,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,sBAAsB,EAAO,MAAM,6BAA6B,CAAA;AAIzE,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,GAAG;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACvE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,sBAAsB,CA8R7C,CAAA;AAED,eAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"listbox-button.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button.tsx"],"names":[],"mappings":"AAAA,OAAc,EAEV,cAAc,EAAE,EAAE,EACrB,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,sBAAsB,EAAO,MAAM,6BAA6B,CAAA;AAIzE,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,GAAG;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACvE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,sBAAsB,CA+R7C,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -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,67 +37,60 @@ 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 ebay_icon_1 = require("../ebay-icon");
54
- var component_utils_1 = require("../common/component-utils");
55
- var listbox_button_option_1 = __importDefault(require("./listbox-button-option"));
56
- var ListboxButton = function (_a) {
57
- var children = _a.children, name = _a.name, value = _a.value, selected = _a.selected, borderless = _a.borderless, fluid = _a.fluid, className = _a.className, maxHeight = _a.maxHeight, prefixId = _a.prefixId, prefixLabel = _a.prefixLabel, floatingLabel = _a.floatingLabel, _b = _a.unselectedText, unselectedText = _b === void 0 ? '-' : _b, _c = _a.onChange, onChange = _c === void 0 ? function () { } : _c, _d = _a.onCollapse, onCollapse = _d === void 0 ? function () { } : _d, _e = _a.onExpand, onExpand = _e === void 0 ? function () { } : _e, rest = __rest(_a, ["children", "name", "value", "selected", "borderless", "fluid", "className", "maxHeight", "prefixId", "prefixLabel", "floatingLabel", "unselectedText", "onChange", "onCollapse", "onExpand"]);
58
- var optionsContainerRef = (0, react_1.useRef)(null);
59
- var optionsParentContainerRef = (0, react_1.useRef)();
60
- var optionsByIndexRef = (0, react_1.useRef)(new Map());
61
- var buttonRef = (0, react_1.useRef)();
62
- var listBoxButtonOptions = (0, component_utils_1.filterByType)(children, listbox_button_option_1.default);
40
+ const react_1 = __importStar(require("react"));
41
+ const classnames_1 = __importDefault(require("classnames"));
42
+ const ebay_icon_1 = require("../ebay-icon");
43
+ const component_utils_1 = require("../common/component-utils");
44
+ const listbox_button_option_1 = __importDefault(require("./listbox-button-option"));
45
+ const ListboxButton = (_a) => {
46
+ var { children, name, value, selected, borderless, fluid, className, maxHeight, prefixId, prefixLabel, floatingLabel, unselectedText = '-', onChange = () => { }, onCollapse = () => { }, onExpand = () => { } } = _a, rest = __rest(_a, ["children", "name", "value", "selected", "borderless", "fluid", "className", "maxHeight", "prefixId", "prefixLabel", "floatingLabel", "unselectedText", "onChange", "onCollapse", "onExpand"]);
47
+ const optionsContainerRef = (0, react_1.useRef)(null);
48
+ const optionsParentContainerRef = (0, react_1.useRef)();
49
+ const optionsByIndexRef = (0, react_1.useRef)(new Map());
50
+ const buttonRef = (0, react_1.useRef)();
51
+ const listBoxButtonOptions = (0, component_utils_1.filterByType)(children, listbox_button_option_1.default);
63
52
  if (!listBoxButtonOptions.length) {
64
- throw new Error("EbayListboxButton: Please use a\n EbayListboxButtonOption that defines the options of the listbox");
53
+ throw new Error(`EbayListboxButton: Please use a
54
+ EbayListboxButtonOption that defines the options of the listbox`);
65
55
  }
66
- var getInitialSelectedOption = function () {
67
- var selectedIndex = selected !== undefined ? selected : listBoxButtonOptions.findIndex(function (_a) {
68
- var props = _a.props;
69
- return value !== undefined && props.value === value;
70
- });
71
- var index = selectedIndex > -1 || floatingLabel ? selectedIndex : undefined;
56
+ const getInitialSelectedOption = () => {
57
+ const selectedIndex = selected !== undefined ? selected : listBoxButtonOptions.findIndex(({ props }) => value !== undefined && props.value === value);
58
+ const index = selectedIndex > -1 || floatingLabel ? selectedIndex : undefined;
72
59
  return {
73
60
  option: listBoxButtonOptions[index],
74
- index: index
61
+ index
75
62
  };
76
63
  };
77
64
  // Get the default Selected value and set it in the state
78
- var _f = getInitialSelectedOption(), selectedOptionFromValue = _f.option, initialSelectedOptionIndex = _f.index;
65
+ const { option: selectedOptionFromValue, index: initialSelectedOptionIndex } = getInitialSelectedOption();
79
66
  // Update the selected option to the state
80
- var _g = (0, react_1.useState)(selectedOptionFromValue), selectedOption = _g[0], setSelectedOption = _g[1];
81
- var _h = (0, react_1.useState)(initialSelectedOptionIndex), selectedIndex = _h[0], setSelectedIndex = _h[1];
67
+ const [selectedOption, setSelectedOption] = (0, react_1.useState)(selectedOptionFromValue);
68
+ const [selectedIndex, setSelectedIndex] = (0, react_1.useState)(initialSelectedOptionIndex);
82
69
  // Update the expanded status to the state
83
- var _j = (0, react_1.useState)(), expanded = _j[0], setExpanded = _j[1];
70
+ const [expanded, setExpanded] = (0, react_1.useState)();
84
71
  // Additional flag to avoid multiple re-render when users tries to open and close
85
- var _k = (0, react_1.useState)(false), optionsOpened = _k[0], setOptionsOpened = _k[1];
86
- var _l = (0, react_1.useState)(), wasClicked = _l[0], setWasClicked = _l[1];
87
- (0, react_1.useEffect)(function () {
72
+ const [optionsOpened, setOptionsOpened] = (0, react_1.useState)(false);
73
+ const [wasClicked, setWasClicked] = (0, react_1.useState)();
74
+ (0, react_1.useEffect)(() => {
88
75
  setSelectedOption(selectedOptionFromValue);
89
76
  }, [value]);
90
- var childrenArray = react_1.Children.toArray(children);
91
- var getSelectedValueByIndex = function (index) { return childrenArray[index].props.value; };
92
- var getIndexByValue = (0, react_1.useCallback)(function (selectedValue) {
93
- return childrenArray.findIndex(function (_a) {
94
- var props = _a.props;
95
- return props.value === selectedValue;
96
- });
97
- }, [childrenArray]);
98
- var getSelectedOption = function (currentIndex) { return optionsByIndexRef.current.get(currentIndex); };
99
- var setActiveDescendant = function (index) {
100
- var optionsContainerEle = optionsContainerRef.current;
101
- optionsContainerEle === null || optionsContainerEle === void 0 ? void 0 : optionsContainerEle.setAttribute("aria-activedescendant", getSelectedOption(index).id);
102
- };
103
- var collapseListbox = function () {
77
+ const childrenArray = react_1.Children.toArray(children);
78
+ const getSelectedValueByIndex = (index) => childrenArray[index].props.value;
79
+ const getIndexByValue = (0, react_1.useCallback)((selectedValue) => childrenArray.findIndex(({ props }) => props.value === selectedValue), [childrenArray]);
80
+ const getSelectedOption = (currentIndex) => optionsByIndexRef.current.get(currentIndex);
81
+ const setActiveDescendant = (index) => {
82
+ const optionsContainerEle = optionsContainerRef.current;
83
+ optionsContainerEle === null || optionsContainerEle === void 0 ? void 0 : optionsContainerEle.setAttribute(`aria-activedescendant`, getSelectedOption(index).id);
84
+ };
85
+ const collapseListbox = () => {
104
86
  setExpanded(false);
105
87
  onCollapse();
106
88
  };
107
- var expandListbox = function () {
89
+ const expandListbox = () => {
108
90
  setExpanded(true);
109
91
  onExpand();
110
92
  };
111
- var toggleListbox = function () {
93
+ const toggleListbox = () => {
112
94
  if (expanded) {
113
95
  collapseListbox();
114
96
  }
@@ -116,38 +98,38 @@ var ListboxButton = function (_a) {
116
98
  expandListbox();
117
99
  }
118
100
  };
119
- var onOptionsSelect = function (e, index) {
101
+ const onOptionsSelect = (e, index) => {
120
102
  // OnSelect set the selectedValue to the state and expanded to false to close the list box
121
103
  setSelectedOption(childrenArray[index]);
122
104
  setSelectedIndex(index);
123
105
  collapseListbox();
124
106
  setActiveDescendant(index);
125
107
  buttonRef.current.focus();
126
- onChange(e, { index: index, selected: [getSelectedValueByIndex(index)], wasClicked: wasClicked });
108
+ onChange(e, { index, selected: [getSelectedValueByIndex(index)], wasClicked });
127
109
  setWasClicked(false);
128
110
  };
129
- var reset = function () {
111
+ const reset = () => {
130
112
  collapseListbox();
131
113
  setSelectedOption(childrenArray[initialSelectedOptionIndex]);
132
114
  };
133
- var makeOptionActive = function (index) {
134
- var optionEle = optionsContainerRef.current.children[index];
135
- optionEle.setAttribute("aria-selected", 'true');
136
- optionEle.classList.add("listbox-button__option--active");
115
+ const makeOptionActive = (index) => {
116
+ const optionEle = optionsContainerRef.current.children[index];
117
+ optionEle.setAttribute(`aria-selected`, 'true');
118
+ optionEle.classList.add(`listbox-button__option--active`);
137
119
  };
138
- var makeOptionInActive = function (index) {
139
- var optionEle = optionsContainerRef.current.children[index];
140
- optionEle.setAttribute("aria-selected", 'false');
141
- optionEle.classList.remove("listbox-button__option--active");
120
+ const makeOptionInActive = (index) => {
121
+ const optionEle = optionsContainerRef.current.children[index];
122
+ optionEle.setAttribute(`aria-selected`, 'false');
123
+ optionEle.classList.remove(`listbox-button__option--active`);
142
124
  };
143
125
  // Followed the implementation from W3
144
126
  // https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox-collapsible.html
145
- var scrollOptions = function (index) {
146
- var listboxOptionsContainerNode = optionsParentContainerRef.current;
147
- var currentTarget = getSelectedOption(index);
127
+ const scrollOptions = (index) => {
128
+ const listboxOptionsContainerNode = optionsParentContainerRef.current;
129
+ const currentTarget = getSelectedOption(index);
148
130
  if (listboxOptionsContainerNode.scrollHeight > listboxOptionsContainerNode.clientHeight) {
149
- var scrollBottom = listboxOptionsContainerNode.clientHeight + listboxOptionsContainerNode.scrollTop;
150
- var elementBottom = currentTarget.offsetTop + currentTarget.offsetHeight;
131
+ const scrollBottom = listboxOptionsContainerNode.clientHeight + listboxOptionsContainerNode.scrollTop;
132
+ const elementBottom = currentTarget.offsetTop + currentTarget.offsetHeight;
151
133
  if (elementBottom > scrollBottom) {
152
134
  listboxOptionsContainerNode.scrollTop = elementBottom - listboxOptionsContainerNode.clientHeight;
153
135
  }
@@ -156,7 +138,7 @@ var ListboxButton = function (_a) {
156
138
  }
157
139
  }
158
140
  };
159
- var makeSelections = function (updatedIndex) {
141
+ const makeSelections = (updatedIndex) => {
160
142
  makeOptionActive(selectedIndex === undefined || updatedIndex === -1 ? 0 : updatedIndex);
161
143
  makeOptionInActive(selectedIndex === undefined || selectedIndex === -1 ? 0 : selectedIndex);
162
144
  scrollOptions(updatedIndex);
@@ -164,15 +146,13 @@ var ListboxButton = function (_a) {
164
146
  setSelectedIndex(updatedIndex);
165
147
  setSelectedOption(childrenArray[updatedIndex]);
166
148
  };
167
- var focusOptionsContainer = function (focusOptions) {
168
- return setTimeout(function () { var _a; return (_a = optionsContainerRef === null || optionsContainerRef === void 0 ? void 0 : optionsContainerRef.current) === null || _a === void 0 ? void 0 : _a.focus(focusOptions); }, 0);
169
- };
170
- var onButtonClick = function () {
149
+ const focusOptionsContainer = (focusOptions) => setTimeout(() => { var _a; return (_a = optionsContainerRef === null || optionsContainerRef === void 0 ? void 0 : optionsContainerRef.current) === null || _a === void 0 ? void 0 : _a.focus(focusOptions); }, 0);
150
+ const onButtonClick = () => {
171
151
  toggleListbox();
172
152
  setOptionsOpened(true);
173
153
  focusOptionsContainer({ preventScroll: true });
174
154
  };
175
- var onButtonKeyup = function (e) {
155
+ const onButtonKeyup = (e) => {
176
156
  switch (e.key) {
177
157
  case 'Escape':
178
158
  collapseListbox();
@@ -184,7 +164,7 @@ var ListboxButton = function (_a) {
184
164
  break;
185
165
  }
186
166
  };
187
- var onOptionContainerKeydown = function (e) {
167
+ const onOptionContainerKeydown = (e) => {
188
168
  switch (e.key) {
189
169
  case ' ':
190
170
  case 'PageUp':
@@ -209,12 +189,12 @@ var ListboxButton = function (_a) {
209
189
  break;
210
190
  case 'Enter':
211
191
  collapseListbox();
212
- setTimeout(function () { return setSelectedOption(childrenArray[selectedIndex]); });
213
- setTimeout(function () { return buttonRef.current.focus(); }, 0);
192
+ setTimeout(() => setSelectedOption(childrenArray[selectedIndex]));
193
+ setTimeout(() => buttonRef.current.focus(), 0);
214
194
  onChange(e, {
215
195
  index: selectedIndex,
216
196
  selected: [getSelectedValueByIndex(selectedIndex)],
217
- wasClicked: wasClicked
197
+ wasClicked
218
198
  });
219
199
  break;
220
200
  case 'Esc':
@@ -227,47 +207,46 @@ var ListboxButton = function (_a) {
227
207
  };
228
208
  // We want to mimic the select box behavior, so we take the onSelect that passed
229
209
  // at the parent level and use it for the OnClick on the list box since it is a fake dropdown
230
- var updateListBoxButtonOptions = listBoxButtonOptions
231
- .map(function (child, index) { return (0, react_1.cloneElement)(child, {
232
- index: index,
210
+ const updateListBoxButtonOptions = listBoxButtonOptions
211
+ .map((child, index) => (0, react_1.cloneElement)(child, {
212
+ index,
233
213
  key: index,
234
214
  selected: selectedOption && child.props.value === selectedOption.props.value,
235
- onClick: function (e) { return onOptionsSelect(e, index); },
236
- innerRef: function (optionNode) { return !optionNode
215
+ onClick: (e) => onOptionsSelect(e, index),
216
+ innerRef: optionNode => !optionNode
237
217
  ? optionsByIndexRef.current.delete(index)
238
- : optionsByIndexRef.current.set(index, optionNode); }
239
- }); });
240
- var wrapperClassName = (0, classnames_1.default)('listbox-button', className, { 'listbox-button--fluid': fluid });
241
- var buttonClassName = (0, classnames_1.default)('btn btn--form', {
218
+ : optionsByIndexRef.current.set(index, optionNode)
219
+ }));
220
+ const wrapperClassName = (0, classnames_1.default)('listbox-button', className, { 'listbox-button--fluid': fluid });
221
+ const buttonClassName = (0, classnames_1.default)('btn', {
222
+ 'btn--form': !borderless,
242
223
  'btn--borderless': borderless,
243
224
  'btn--floating-label': floatingLabel && selectedOption
244
225
  });
245
- var expandBtnTextId = prefixId && 'expand-btn-text';
246
- var buttonLabel = (react_1.default.createElement(react_1.default.Fragment, null,
226
+ const expandBtnTextId = prefixId && 'expand-btn-text';
227
+ const buttonLabel = (react_1.default.createElement(react_1.default.Fragment, null,
247
228
  floatingLabel && react_1.default.createElement("span", { className: "btn__floating-label" }, floatingLabel),
248
229
  prefixLabel && react_1.default.createElement("span", { className: "btn__label" }, prefixLabel),
249
230
  react_1.default.createElement("span", { className: "btn__text", id: expandBtnTextId }, (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.props.children) || unselectedText)));
250
231
  return (react_1.default.createElement("span", { className: wrapperClassName },
251
- react_1.default.createElement("button", __assign({}, rest, { type: "button", className: buttonClassName, "aria-expanded": !!expanded, "aria-haspopup": "listbox", "aria-labelledby": prefixId && "".concat(prefixId, " ").concat(expandBtnTextId), onClick: onButtonClick,
232
+ react_1.default.createElement("button", Object.assign({}, rest, { type: "button", className: buttonClassName, "aria-expanded": !!expanded, "aria-haspopup": "listbox", "aria-labelledby": prefixId && `${prefixId} ${expandBtnTextId}`, onClick: onButtonClick,
252
233
  // https://stackoverflow.com/questions/17769005/onclick-and-onblur-ordering-issue
253
- onMouseDown: function (e) { return e.preventDefault(); }, onKeyUp: onButtonKeyup, ref: buttonRef }),
234
+ onMouseDown: (e) => e.preventDefault(), onKeyUp: onButtonKeyup, ref: buttonRef }),
254
235
  react_1.default.createElement("span", { className: "btn__cell" },
255
236
  buttonLabel,
256
237
  react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "chevronDown12" }))),
257
238
  (expanded || optionsOpened) &&
258
239
  react_1.default.createElement("div", { className: "listbox-button__listbox", ref: optionsParentContainerRef, style: { maxHeight: maxHeight } },
259
- react_1.default.createElement("div", { className: "listbox-button__options", role: "listbox", tabIndex: expanded ? 0 : -1, ref: optionsContainerRef, onKeyDown: function (e) { return onOptionContainerKeydown(e); },
240
+ react_1.default.createElement("div", { className: "listbox-button__options", role: "listbox", tabIndex: expanded ? 0 : -1, ref: optionsContainerRef, onKeyDown: (e) => onOptionContainerKeydown(e),
260
241
  // adding onMouseDown preventDefault b/c on IE the onClick event is not being fired on each
261
242
  // option https://stackoverflow.com/questions/17769005/onclick-and-onblur-ordering-issue
262
- onMouseDown: function (e) {
243
+ onMouseDown: (e) => {
263
244
  e.preventDefault();
264
245
  setWasClicked(true);
265
- }, onBlur: function () {
246
+ }, onBlur: () => {
266
247
  collapseListbox();
267
- setTimeout(function () { return buttonRef.current.focus(); }, 0);
248
+ setTimeout(() => buttonRef.current.focus(), 0);
268
249
  } }, updateListBoxButtonOptions)),
269
- react_1.default.createElement("select", { hidden: true, className: "listbox-button__native", name: name, onChange: function (e) { return onOptionsSelect(e, getIndexByValue(e.target.value)); }, value: selectedOption ? selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.props.value : '' }, updateListBoxButtonOptions.map(function (option, i) {
270
- return react_1.default.createElement("option", { value: option.props.value, key: i });
271
- }))));
250
+ react_1.default.createElement("select", { hidden: true, className: "listbox-button__native", name: name, onChange: (e) => onOptionsSelect(e, getIndexByValue(e.target.value)), value: selectedOption ? selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.props.value : '' }, updateListBoxButtonOptions.map((option, i) => react_1.default.createElement("option", { value: option.props.value, key: i })))));
272
251
  };
273
252
  exports.default = ListboxButton;
@@ -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 EbayMenuItemSeparator = function (_a) {
31
- var className = _a.className, rest = __rest(_a, ["className"]);
32
- return (react_1.default.createElement("hr", __assign({}, rest, { className: (0, classnames_1.default)(className, 'menu__separator'), role: "separator" })));
17
+ const react_1 = __importDefault(require("react"));
18
+ const classnames_1 = __importDefault(require("classnames"));
19
+ const EbayMenuItemSeparator = (_a) => {
20
+ var { className } = _a, rest = __rest(_a, ["className"]);
21
+ return (react_1.default.createElement("hr", Object.assign({}, rest, { className: (0, classnames_1.default)(className, 'menu__separator'), role: "separator" })));
33
22
  };
34
23
  exports.default = EbayMenuItemSeparator;