@ebay/ui-core-react 6.2.2-rc.1 → 6.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @ebay/ui-core-react might be problematic. Click here for more details.

Files changed (171) hide show
  1. package/common/component-utils/array.polyfill.flat.js +13 -11
  2. package/common/component-utils/forwardRef.js +17 -4
  3. package/common/component-utils/usePrevious.js +3 -3
  4. package/common/component-utils/utils.js +26 -13
  5. package/common/debounce.js +7 -3
  6. package/common/event-utils/index.js +11 -8
  7. package/common/event-utils/use-key-press.js +12 -10
  8. package/common/event-utils/use-roving-index.js +24 -13
  9. package/common/floating-label-utils/hooks.js +53 -43
  10. package/common/notice-utils/notice-content.js +6 -5
  11. package/common/notice-utils/notice-cta.js +16 -5
  12. package/common/notice-utils/notice-footer.js +16 -5
  13. package/common/notice-utils/notice-title.js +17 -6
  14. package/common/random-id.js +1 -1
  15. package/common/range.js +4 -1
  16. package/common/tooltip-utils/tooltip-close-button.js +1 -1
  17. package/common/tooltip-utils/tooltip-content.js +28 -16
  18. package/common/tooltip-utils/tooltip-footer.js +6 -3
  19. package/common/tooltip-utils/tooltip-host.js +16 -5
  20. package/common/tooltip-utils/tooltip.d.ts +1 -1
  21. package/common/tooltip-utils/tooltip.js +26 -14
  22. package/common/tooltip-utils/use-tooltip.js +9 -8
  23. package/ebay-alert-dialog/alert-dialog.js +22 -11
  24. package/ebay-badge/badge.js +17 -6
  25. package/ebay-breadcrumbs/breadcrumb-item.js +18 -7
  26. package/ebay-breadcrumbs/breadcrumbs.js +30 -19
  27. package/ebay-button/button-cell.js +16 -5
  28. package/ebay-button/button-expand.d.ts +2 -4
  29. package/ebay-button/button-expand.d.ts.map +1 -1
  30. package/ebay-button/button-expand.js +10 -7
  31. package/ebay-button/button-loading.js +5 -5
  32. package/ebay-button/button-text.js +6 -3
  33. package/ebay-button/button.d.ts +1 -1
  34. package/ebay-button/button.js +43 -31
  35. package/ebay-calendar/calendar.js +111 -94
  36. package/ebay-calendar/date-utils.js +18 -9
  37. package/ebay-carousel/carousel-control-button.js +10 -9
  38. package/ebay-carousel/carousel-item.d.ts +1 -1
  39. package/ebay-carousel/carousel-item.js +25 -14
  40. package/ebay-carousel/carousel-list.js +22 -21
  41. package/ebay-carousel/carousel.js +44 -32
  42. package/ebay-carousel/helpers.js +47 -35
  43. package/ebay-carousel/scroll-to-transition.js +15 -15
  44. package/ebay-checkbox/checkbox.js +32 -21
  45. package/ebay-confirm-dialog/confirm-dialog.js +22 -11
  46. package/ebay-cta-button/cta-button.d.ts +1 -1
  47. package/ebay-cta-button/cta-button.js +20 -9
  48. package/ebay-date-textbox/date-textbox.js +53 -37
  49. package/ebay-dialog-base/components/animation.d.ts +1 -0
  50. package/ebay-dialog-base/components/animation.d.ts.map +1 -1
  51. package/ebay-dialog-base/components/animation.js +28 -25
  52. package/ebay-dialog-base/components/dialog-actions.js +5 -2
  53. package/ebay-dialog-base/components/dialog-close-button.d.ts +2 -5
  54. package/ebay-dialog-base/components/dialog-close-button.d.ts.map +1 -1
  55. package/ebay-dialog-base/components/dialog-close-button.js +5 -2
  56. package/ebay-dialog-base/components/dialog-footer.js +5 -2
  57. package/ebay-dialog-base/components/dialog-header.js +15 -4
  58. package/ebay-dialog-base/components/dialog-previous-button.js +17 -6
  59. package/ebay-dialog-base/components/dialogBase.js +51 -40
  60. package/ebay-dialog-base/dialog-base-with-state.js +35 -22
  61. package/ebay-drawer-dialog/components/drawer.js +50 -27
  62. package/ebay-eek/eek-rating.js +10 -8
  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 +6 -7
  66. package/ebay-fake-menu/menu-item-separator.js +16 -5
  67. package/ebay-fake-menu/menu-item.js +26 -15
  68. package/ebay-fake-menu/menu.js +22 -11
  69. package/ebay-fake-menu-button/menu-button-item.js +2 -2
  70. package/ebay-fake-menu-button/menu-button-label.d.ts +2 -4
  71. package/ebay-fake-menu-button/menu-button-label.d.ts.map +1 -1
  72. package/ebay-fake-menu-button/menu-button-label.js +5 -2
  73. package/ebay-fake-menu-button/menu-button-separator.js +16 -5
  74. package/ebay-fake-menu-button/menu-button.js +45 -32
  75. package/ebay-fake-tabs/fake-tabs.js +23 -10
  76. package/ebay-fake-tabs/tab.js +16 -5
  77. package/ebay-field/description.js +19 -7
  78. package/ebay-field/field.js +5 -4
  79. package/ebay-field/label.js +18 -7
  80. package/ebay-fullscreen-dialog/fullscreen-dialog.js +18 -7
  81. package/ebay-icon/icon.d.ts +1 -1
  82. package/ebay-icon/icon.js +29 -17
  83. package/ebay-icon-button/icon-button.d.ts +1 -1
  84. package/ebay-icon-button/icon-button.js +27 -15
  85. package/ebay-infotip/ebay-infotip-content.js +5 -2
  86. package/ebay-infotip/ebay-infotip-heading.js +16 -5
  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 +24 -10
  90. package/ebay-infotip/ebay-infotip.d.ts.map +1 -1
  91. package/ebay-infotip/ebay-infotip.js +34 -23
  92. package/ebay-inline-notice/inline-notice.js +27 -15
  93. package/ebay-lightbox-dialog/lightbox-dialog.js +21 -9
  94. package/ebay-listbox-button/listbox-button-option.js +18 -7
  95. package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
  96. package/ebay-listbox-button/listbox-button.js +100 -79
  97. package/ebay-menu/menu-item-separator.js +16 -5
  98. package/ebay-menu/menu-item.js +23 -12
  99. package/ebay-menu/menu.d.ts +1 -1
  100. package/ebay-menu/menu.js +64 -37
  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 +2 -4
  104. package/ebay-menu-button/menu-button-label.d.ts.map +1 -1
  105. package/ebay-menu-button/menu-button-label.js +5 -2
  106. package/ebay-menu-button/menu-button-separator.js +16 -5
  107. package/ebay-menu-button/menu-button.js +60 -46
  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 +2 -5
  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 +5 -2
  112. package/ebay-page-notice/page-notice-cta.js +6 -3
  113. package/ebay-page-notice/page-notice-footer.js +6 -3
  114. package/ebay-page-notice/page-notice-title.js +16 -5
  115. package/ebay-page-notice/page-notice.js +27 -16
  116. package/ebay-pagination/helpers.js +24 -21
  117. package/ebay-pagination/pagination-item.d.ts +1 -1
  118. package/ebay-pagination/pagination-item.js +27 -16
  119. package/ebay-pagination/pagination.js +81 -52
  120. package/ebay-panel-dialog/panel-dialog.js +21 -9
  121. package/ebay-progress-bar/progress-bar.js +16 -5
  122. package/ebay-progress-spinner/progress-spinner.js +18 -7
  123. package/ebay-progress-stepper/ebay-progress-step.js +25 -14
  124. package/ebay-progress-stepper/ebay-progress-stepper.js +21 -10
  125. package/ebay-progress-stepper/ebay-progress-title.js +5 -2
  126. package/ebay-radio/radio.js +29 -18
  127. package/ebay-section-notice/section-notice-footer.js +6 -3
  128. package/ebay-section-notice/section-notice-title.js +16 -5
  129. package/ebay-section-notice/section-notice.js +39 -24
  130. package/ebay-section-title/cta.js +16 -5
  131. package/ebay-section-title/info.js +16 -5
  132. package/ebay-section-title/overflow.js +16 -5
  133. package/ebay-section-title/section-title.js +24 -13
  134. package/ebay-section-title/subtitle.js +16 -5
  135. package/ebay-section-title/title.js +16 -5
  136. package/ebay-select/ebay-select-option.js +15 -4
  137. package/ebay-select/ebay-select.d.ts +1 -1
  138. package/ebay-select/ebay-select.js +45 -34
  139. package/ebay-signal/signal.js +17 -6
  140. package/ebay-snackbar-dialog/components/ebay-snackbar-dialog-action.js +16 -5
  141. package/ebay-snackbar-dialog/components/ebay-snackbar-dialog.js +38 -27
  142. package/ebay-split-button/split-button.js +21 -10
  143. package/ebay-star-rating/star-rating.js +19 -8
  144. package/ebay-star-rating-select/star-rating-select.js +31 -20
  145. package/ebay-svg/svg.js +3 -3
  146. package/ebay-switch/ebay-switch.js +21 -10
  147. package/ebay-tabs/tab-panel.js +16 -5
  148. package/ebay-tabs/tab.js +16 -5
  149. package/ebay-tabs/tabs.js +40 -26
  150. package/ebay-textbox/postfix-icon.js +18 -7
  151. package/ebay-textbox/prefix-icon.js +16 -5
  152. package/ebay-textbox/textbox.d.ts +1 -1
  153. package/ebay-textbox/textbox.js +53 -42
  154. package/ebay-toast-dialog/components/toast.js +17 -6
  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 +32 -21
  158. package/ebay-tourtip/ebay-tourtip-content.js +1 -1
  159. package/ebay-tourtip/ebay-tourtip-footer.js +7 -4
  160. package/ebay-tourtip/ebay-tourtip-heading.js +17 -6
  161. package/ebay-tourtip/ebay-tourtip-host.js +1 -1
  162. package/ebay-tourtip/ebay-tourtip.js +33 -22
  163. package/ebay-video/controls.d.ts.map +1 -1
  164. package/ebay-video/controls.js +46 -23
  165. package/ebay-video/reportButton.d.ts +2 -7
  166. package/ebay-video/reportButton.d.ts.map +1 -1
  167. package/ebay-video/reportButton.js +8 -5
  168. package/ebay-video/source.js +14 -3
  169. package/ebay-video/video.d.ts.map +1 -1
  170. package/ebay-video/video.js +80 -54
  171. package/package.json +19 -23
@@ -1,4 +1,15 @@
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
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -37,23 +48,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
48
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
49
  };
39
50
  Object.defineProperty(exports, "__esModule", { value: true });
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 = () => {
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 () {
57
69
  if (isExpanded) {
58
70
  collapseTooltip();
59
71
  }
@@ -62,17 +74,16 @@ const EbayInfotip = ({ variant = 'default', pointer, overlayStyle, disabled, onE
62
74
  }
63
75
  };
64
76
  if (!content) {
65
- throw new Error(`EbayInfotip: Please use a EbayInfotipContent that defines the content of the infotip`);
77
+ throw new Error("EbayInfotip: Please use a EbayInfotipContent that defines the content of the infotip");
66
78
  }
67
- const _a = content.props, { children: contentChildren } = _a, contentProps = __rest(_a, ["children"]);
79
+ var _e = content.props, contentChildren = _e.children, contentProps = __rest(_e, ["children"]);
68
80
  return (react_1.default.createElement(react_1.default.Fragment, null,
69
81
  react_1.default.createElement(tooltip_utils_1.Tooltip, { type: "infotip", isExpanded: isExpanded, className: (0, classnames_1.default)(className, { 'dialog--mini': isModal }), ref: containerRef },
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 }),
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 }),
73
84
  heading,
74
85
  contentChildren))),
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 }),
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 }),
76
87
  react_1.default.createElement(ebay_dialog_base_1.EbayDialogHeader, null, heading),
77
88
  contentChildren))));
78
89
  };
@@ -1,4 +1,15 @@
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
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -37,15 +48,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
48
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
49
  };
39
50
  Object.defineProperty(exports, "__esModule", { value: true });
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)(() => {
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 () {
49
61
  if (!hidden) {
50
62
  onNoticeShow();
51
63
  }
@@ -53,14 +65,14 @@ const EbayInlineNotice = (_a) => {
53
65
  if (hidden) {
54
66
  return null;
55
67
  }
56
- const content = (0, component_utils_1.findComponent)(children, ebay_notice_content_1.EbayNoticeContent);
68
+ var content = (0, component_utils_1.findComponent)(children, ebay_notice_content_1.EbayNoticeContent);
57
69
  if (!content) {
58
- throw new Error(`EbayInlineNotice: Please use a EbayNoticeContent that defines the content of the notice`);
70
+ throw new Error("EbayInlineNotice: Please use a EbayNoticeContent that defines the content of the notice");
59
71
  }
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 }) }),
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)) }),
62
74
  !isGeneral ? (react_1.default.createElement("span", { className: "inline-notice__header" },
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" }))));
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" }))));
65
77
  };
66
78
  exports.default = EbayInlineNotice;
@@ -1,4 +1,15 @@
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
+ };
2
13
  var __rest = (this && this.__rest) || function (s, e) {
3
14
  var t = {};
4
15
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -14,14 +25,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
26
  };
16
27
  Object.defineProperty(exports, "__esModule", { value: true });
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 })));
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 })));
26
38
  };
27
39
  exports.default = EbayLightboxDialog;
@@ -1,4 +1,15 @@
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
+ };
2
13
  var __rest = (this && this.__rest) || function (s, e) {
3
14
  var t = {};
4
15
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -14,13 +25,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
26
  };
16
27
  Object.defineProperty(exports, "__esModule", { value: true });
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); } }),
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); } }),
24
35
  react_1.default.createElement("span", { className: "listbox-button__value" }, children),
25
36
  react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "tick16" })));
26
37
  };
@@ -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,CA+R7C,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,CA8R7C,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -1,4 +1,15 @@
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
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -37,60 +48,67 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
48
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
49
  };
39
50
  Object.defineProperty(exports, "__esModule", { value: true });
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);
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);
52
63
  if (!listBoxButtonOptions.length) {
53
- throw new Error(`EbayListboxButton: Please use a
54
- EbayListboxButtonOption that defines the options of the listbox`);
64
+ throw new Error("EbayListboxButton: Please use a\n EbayListboxButtonOption that defines the options of the listbox");
55
65
  }
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;
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;
59
72
  return {
60
73
  option: listBoxButtonOptions[index],
61
- index
74
+ index: index
62
75
  };
63
76
  };
64
77
  // Get the default Selected value and set it in the state
65
- const { option: selectedOptionFromValue, index: initialSelectedOptionIndex } = getInitialSelectedOption();
78
+ var _f = getInitialSelectedOption(), selectedOptionFromValue = _f.option, initialSelectedOptionIndex = _f.index;
66
79
  // Update the selected option to the state
67
- const [selectedOption, setSelectedOption] = (0, react_1.useState)(selectedOptionFromValue);
68
- const [selectedIndex, setSelectedIndex] = (0, react_1.useState)(initialSelectedOptionIndex);
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];
69
82
  // Update the expanded status to the state
70
- const [expanded, setExpanded] = (0, react_1.useState)();
83
+ var _j = (0, react_1.useState)(), expanded = _j[0], setExpanded = _j[1];
71
84
  // Additional flag to avoid multiple re-render when users tries to open and close
72
- const [optionsOpened, setOptionsOpened] = (0, react_1.useState)(false);
73
- const [wasClicked, setWasClicked] = (0, react_1.useState)();
74
- (0, react_1.useEffect)(() => {
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 () {
75
88
  setSelectedOption(selectedOptionFromValue);
76
89
  }, [value]);
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 = () => {
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 () {
86
104
  setExpanded(false);
87
105
  onCollapse();
88
106
  };
89
- const expandListbox = () => {
107
+ var expandListbox = function () {
90
108
  setExpanded(true);
91
109
  onExpand();
92
110
  };
93
- const toggleListbox = () => {
111
+ var toggleListbox = function () {
94
112
  if (expanded) {
95
113
  collapseListbox();
96
114
  }
@@ -98,38 +116,38 @@ const ListboxButton = (_a) => {
98
116
  expandListbox();
99
117
  }
100
118
  };
101
- const onOptionsSelect = (e, index) => {
119
+ var onOptionsSelect = function (e, index) {
102
120
  // OnSelect set the selectedValue to the state and expanded to false to close the list box
103
121
  setSelectedOption(childrenArray[index]);
104
122
  setSelectedIndex(index);
105
123
  collapseListbox();
106
124
  setActiveDescendant(index);
107
125
  buttonRef.current.focus();
108
- onChange(e, { index, selected: [getSelectedValueByIndex(index)], wasClicked });
126
+ onChange(e, { index: index, selected: [getSelectedValueByIndex(index)], wasClicked: wasClicked });
109
127
  setWasClicked(false);
110
128
  };
111
- const reset = () => {
129
+ var reset = function () {
112
130
  collapseListbox();
113
131
  setSelectedOption(childrenArray[initialSelectedOptionIndex]);
114
132
  };
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`);
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");
119
137
  };
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`);
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");
124
142
  };
125
143
  // Followed the implementation from W3
126
144
  // https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox-collapsible.html
127
- const scrollOptions = (index) => {
128
- const listboxOptionsContainerNode = optionsParentContainerRef.current;
129
- const currentTarget = getSelectedOption(index);
145
+ var scrollOptions = function (index) {
146
+ var listboxOptionsContainerNode = optionsParentContainerRef.current;
147
+ var currentTarget = getSelectedOption(index);
130
148
  if (listboxOptionsContainerNode.scrollHeight > listboxOptionsContainerNode.clientHeight) {
131
- const scrollBottom = listboxOptionsContainerNode.clientHeight + listboxOptionsContainerNode.scrollTop;
132
- const elementBottom = currentTarget.offsetTop + currentTarget.offsetHeight;
149
+ var scrollBottom = listboxOptionsContainerNode.clientHeight + listboxOptionsContainerNode.scrollTop;
150
+ var elementBottom = currentTarget.offsetTop + currentTarget.offsetHeight;
133
151
  if (elementBottom > scrollBottom) {
134
152
  listboxOptionsContainerNode.scrollTop = elementBottom - listboxOptionsContainerNode.clientHeight;
135
153
  }
@@ -138,7 +156,7 @@ const ListboxButton = (_a) => {
138
156
  }
139
157
  }
140
158
  };
141
- const makeSelections = (updatedIndex) => {
159
+ var makeSelections = function (updatedIndex) {
142
160
  makeOptionActive(selectedIndex === undefined || updatedIndex === -1 ? 0 : updatedIndex);
143
161
  makeOptionInActive(selectedIndex === undefined || selectedIndex === -1 ? 0 : selectedIndex);
144
162
  scrollOptions(updatedIndex);
@@ -146,13 +164,15 @@ const ListboxButton = (_a) => {
146
164
  setSelectedIndex(updatedIndex);
147
165
  setSelectedOption(childrenArray[updatedIndex]);
148
166
  };
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 = () => {
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 () {
151
171
  toggleListbox();
152
172
  setOptionsOpened(true);
153
173
  focusOptionsContainer({ preventScroll: true });
154
174
  };
155
- const onButtonKeyup = (e) => {
175
+ var onButtonKeyup = function (e) {
156
176
  switch (e.key) {
157
177
  case 'Escape':
158
178
  collapseListbox();
@@ -164,7 +184,7 @@ const ListboxButton = (_a) => {
164
184
  break;
165
185
  }
166
186
  };
167
- const onOptionContainerKeydown = (e) => {
187
+ var onOptionContainerKeydown = function (e) {
168
188
  switch (e.key) {
169
189
  case ' ':
170
190
  case 'PageUp':
@@ -189,12 +209,12 @@ const ListboxButton = (_a) => {
189
209
  break;
190
210
  case 'Enter':
191
211
  collapseListbox();
192
- setTimeout(() => setSelectedOption(childrenArray[selectedIndex]));
193
- setTimeout(() => buttonRef.current.focus(), 0);
212
+ setTimeout(function () { return setSelectedOption(childrenArray[selectedIndex]); });
213
+ setTimeout(function () { return buttonRef.current.focus(); }, 0);
194
214
  onChange(e, {
195
215
  index: selectedIndex,
196
216
  selected: [getSelectedValueByIndex(selectedIndex)],
197
- wasClicked
217
+ wasClicked: wasClicked
198
218
  });
199
219
  break;
200
220
  case 'Esc':
@@ -207,46 +227,47 @@ const ListboxButton = (_a) => {
207
227
  };
208
228
  // We want to mimic the select box behavior, so we take the onSelect that passed
209
229
  // at the parent level and use it for the OnClick on the list box since it is a fake dropdown
210
- const updateListBoxButtonOptions = listBoxButtonOptions
211
- .map((child, index) => (0, react_1.cloneElement)(child, {
212
- index,
230
+ var updateListBoxButtonOptions = listBoxButtonOptions
231
+ .map(function (child, index) { return (0, react_1.cloneElement)(child, {
232
+ index: index,
213
233
  key: index,
214
234
  selected: selectedOption && child.props.value === selectedOption.props.value,
215
- onClick: (e) => onOptionsSelect(e, index),
216
- innerRef: optionNode => !optionNode
235
+ onClick: function (e) { return onOptionsSelect(e, index); },
236
+ innerRef: function (optionNode) { return !optionNode
217
237
  ? optionsByIndexRef.current.delete(index)
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,
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', {
223
242
  'btn--borderless': borderless,
224
243
  'btn--floating-label': floatingLabel && selectedOption
225
244
  });
226
- const expandBtnTextId = prefixId && 'expand-btn-text';
227
- const buttonLabel = (react_1.default.createElement(react_1.default.Fragment, null,
245
+ var expandBtnTextId = prefixId && 'expand-btn-text';
246
+ var buttonLabel = (react_1.default.createElement(react_1.default.Fragment, null,
228
247
  floatingLabel && react_1.default.createElement("span", { className: "btn__floating-label" }, floatingLabel),
229
248
  prefixLabel && react_1.default.createElement("span", { className: "btn__label" }, prefixLabel),
230
249
  react_1.default.createElement("span", { className: "btn__text", id: expandBtnTextId }, (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.props.children) || unselectedText)));
231
250
  return (react_1.default.createElement("span", { className: wrapperClassName },
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,
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,
233
252
  // https://stackoverflow.com/questions/17769005/onclick-and-onblur-ordering-issue
234
- onMouseDown: (e) => e.preventDefault(), onKeyUp: onButtonKeyup, ref: buttonRef }),
253
+ onMouseDown: function (e) { return e.preventDefault(); }, onKeyUp: onButtonKeyup, ref: buttonRef }),
235
254
  react_1.default.createElement("span", { className: "btn__cell" },
236
255
  buttonLabel,
237
256
  react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "chevronDown12" }))),
238
257
  (expanded || optionsOpened) &&
239
258
  react_1.default.createElement("div", { className: "listbox-button__listbox", ref: optionsParentContainerRef, style: { maxHeight: maxHeight } },
240
- react_1.default.createElement("div", { className: "listbox-button__options", role: "listbox", tabIndex: expanded ? 0 : -1, ref: optionsContainerRef, onKeyDown: (e) => onOptionContainerKeydown(e),
259
+ react_1.default.createElement("div", { className: "listbox-button__options", role: "listbox", tabIndex: expanded ? 0 : -1, ref: optionsContainerRef, onKeyDown: function (e) { return onOptionContainerKeydown(e); },
241
260
  // adding onMouseDown preventDefault b/c on IE the onClick event is not being fired on each
242
261
  // option https://stackoverflow.com/questions/17769005/onclick-and-onblur-ordering-issue
243
- onMouseDown: (e) => {
262
+ onMouseDown: function (e) {
244
263
  e.preventDefault();
245
264
  setWasClicked(true);
246
- }, onBlur: () => {
265
+ }, onBlur: function () {
247
266
  collapseListbox();
248
- setTimeout(() => buttonRef.current.focus(), 0);
267
+ setTimeout(function () { return buttonRef.current.focus(); }, 0);
249
268
  } }, updateListBoxButtonOptions)),
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 })))));
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
+ }))));
251
272
  };
252
273
  exports.default = ListboxButton;
@@ -1,4 +1,15 @@
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
+ };
2
13
  var __rest = (this && this.__rest) || function (s, e) {
3
14
  var t = {};
4
15
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -14,10 +25,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
26
  };
16
27
  Object.defineProperty(exports, "__esModule", { value: true });
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" })));
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" })));
22
33
  };
23
34
  exports.default = EbayMenuItemSeparator;