@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.
- package/common/component-utils/array.polyfill.flat.js +13 -11
- package/common/component-utils/forwardRef.js +17 -4
- package/common/component-utils/usePrevious.js +3 -3
- package/common/component-utils/utils.js +26 -13
- package/common/debounce.js +7 -3
- package/common/event-utils/index.js +11 -8
- package/common/event-utils/use-key-press.js +12 -10
- package/common/event-utils/use-roving-index.js +24 -13
- package/common/floating-label-utils/hooks.js +53 -43
- package/common/notice-utils/notice-content.js +6 -5
- package/common/notice-utils/notice-cta.js +16 -5
- package/common/notice-utils/notice-footer.js +16 -5
- package/common/notice-utils/notice-title.js +17 -6
- package/common/random-id.js +1 -1
- package/common/range.js +4 -1
- package/common/tooltip-utils/tooltip-close-button.js +1 -1
- package/common/tooltip-utils/tooltip-content.js +28 -16
- package/common/tooltip-utils/tooltip-footer.js +6 -3
- package/common/tooltip-utils/tooltip-host.js +16 -5
- package/common/tooltip-utils/tooltip.d.ts +1 -1
- package/common/tooltip-utils/tooltip.js +26 -14
- package/common/tooltip-utils/use-tooltip.js +9 -8
- package/ebay-alert-dialog/alert-dialog.js +22 -11
- package/ebay-badge/badge.js +17 -6
- package/ebay-breadcrumbs/breadcrumb-item.js +18 -7
- package/ebay-breadcrumbs/breadcrumbs.js +30 -19
- package/ebay-button/button-cell.js +16 -5
- package/ebay-button/button-expand.d.ts +2 -4
- package/ebay-button/button-expand.d.ts.map +1 -1
- package/ebay-button/button-expand.js +10 -7
- package/ebay-button/button-loading.js +5 -5
- package/ebay-button/button-text.js +6 -3
- package/ebay-button/button.d.ts +1 -1
- package/ebay-button/button.js +43 -31
- package/ebay-calendar/calendar.js +111 -94
- package/ebay-calendar/date-utils.js +18 -9
- package/ebay-carousel/carousel-control-button.js +10 -9
- package/ebay-carousel/carousel-item.d.ts +1 -1
- package/ebay-carousel/carousel-item.js +25 -14
- package/ebay-carousel/carousel-list.js +22 -21
- package/ebay-carousel/carousel.js +44 -32
- package/ebay-carousel/helpers.js +47 -35
- package/ebay-carousel/scroll-to-transition.js +15 -15
- package/ebay-checkbox/checkbox.js +32 -21
- package/ebay-confirm-dialog/confirm-dialog.js +22 -11
- package/ebay-cta-button/cta-button.d.ts +1 -1
- package/ebay-cta-button/cta-button.js +20 -9
- package/ebay-date-textbox/date-textbox.js +53 -37
- package/ebay-dialog-base/components/animation.d.ts +1 -0
- package/ebay-dialog-base/components/animation.d.ts.map +1 -1
- package/ebay-dialog-base/components/animation.js +28 -25
- package/ebay-dialog-base/components/dialog-actions.js +5 -2
- package/ebay-dialog-base/components/dialog-close-button.d.ts +2 -5
- package/ebay-dialog-base/components/dialog-close-button.d.ts.map +1 -1
- package/ebay-dialog-base/components/dialog-close-button.js +5 -2
- package/ebay-dialog-base/components/dialog-footer.js +5 -2
- package/ebay-dialog-base/components/dialog-header.js +15 -4
- package/ebay-dialog-base/components/dialog-previous-button.js +17 -6
- package/ebay-dialog-base/components/dialogBase.js +51 -40
- package/ebay-dialog-base/dialog-base-with-state.js +35 -22
- package/ebay-drawer-dialog/components/drawer.js +50 -27
- package/ebay-eek/eek-rating.js +10 -8
- package/ebay-eek/eek-util.d.ts +1 -1
- package/ebay-eek/eek-util.d.ts.map +1 -1
- package/ebay-eek/eek-util.js +6 -7
- package/ebay-fake-menu/menu-item-separator.js +16 -5
- package/ebay-fake-menu/menu-item.js +26 -15
- package/ebay-fake-menu/menu.js +22 -11
- package/ebay-fake-menu-button/menu-button-item.js +2 -2
- package/ebay-fake-menu-button/menu-button-label.d.ts +2 -4
- package/ebay-fake-menu-button/menu-button-label.d.ts.map +1 -1
- package/ebay-fake-menu-button/menu-button-label.js +5 -2
- package/ebay-fake-menu-button/menu-button-separator.js +16 -5
- package/ebay-fake-menu-button/menu-button.js +45 -32
- package/ebay-fake-tabs/fake-tabs.js +23 -10
- package/ebay-fake-tabs/tab.js +16 -5
- package/ebay-field/description.js +19 -7
- package/ebay-field/field.js +5 -4
- package/ebay-field/label.js +18 -7
- package/ebay-fullscreen-dialog/fullscreen-dialog.js +18 -7
- package/ebay-icon/icon.d.ts +1 -1
- package/ebay-icon/icon.js +29 -17
- package/ebay-icon-button/icon-button.d.ts +1 -1
- package/ebay-icon-button/icon-button.js +27 -15
- package/ebay-infotip/ebay-infotip-content.js +5 -2
- package/ebay-infotip/ebay-infotip-heading.js +16 -5
- package/ebay-infotip/ebay-infotip-host.d.ts +2 -2
- package/ebay-infotip/ebay-infotip-host.d.ts.map +1 -1
- package/ebay-infotip/ebay-infotip-host.js +24 -10
- package/ebay-infotip/ebay-infotip.d.ts.map +1 -1
- package/ebay-infotip/ebay-infotip.js +34 -23
- package/ebay-inline-notice/inline-notice.js +27 -15
- package/ebay-lightbox-dialog/lightbox-dialog.js +21 -9
- package/ebay-listbox-button/listbox-button-option.js +18 -7
- package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
- package/ebay-listbox-button/listbox-button.js +100 -79
- package/ebay-menu/menu-item-separator.js +16 -5
- package/ebay-menu/menu-item.js +23 -12
- package/ebay-menu/menu.d.ts +1 -1
- package/ebay-menu/menu.js +64 -37
- package/ebay-menu-button/README.md +1 -1
- package/ebay-menu-button/menu-button-item.js +1 -1
- package/ebay-menu-button/menu-button-label.d.ts +2 -4
- package/ebay-menu-button/menu-button-label.d.ts.map +1 -1
- package/ebay-menu-button/menu-button-label.js +5 -2
- package/ebay-menu-button/menu-button-separator.js +16 -5
- package/ebay-menu-button/menu-button.js +60 -46
- package/ebay-notice-base/components/ebay-notice-content/notice-content.js +1 -1
- package/ebay-notice-base/components/ebay-notice-title/notice-title.d.ts +2 -5
- package/ebay-notice-base/components/ebay-notice-title/notice-title.d.ts.map +1 -1
- package/ebay-notice-base/components/ebay-notice-title/notice-title.js +5 -2
- package/ebay-page-notice/page-notice-cta.js +6 -3
- package/ebay-page-notice/page-notice-footer.js +6 -3
- package/ebay-page-notice/page-notice-title.js +16 -5
- package/ebay-page-notice/page-notice.js +27 -16
- package/ebay-pagination/helpers.js +24 -21
- package/ebay-pagination/pagination-item.d.ts +1 -1
- package/ebay-pagination/pagination-item.js +27 -16
- package/ebay-pagination/pagination.js +81 -52
- package/ebay-panel-dialog/panel-dialog.js +21 -9
- package/ebay-progress-bar/progress-bar.js +16 -5
- package/ebay-progress-spinner/progress-spinner.js +18 -7
- package/ebay-progress-stepper/ebay-progress-step.js +25 -14
- package/ebay-progress-stepper/ebay-progress-stepper.js +21 -10
- package/ebay-progress-stepper/ebay-progress-title.js +5 -2
- package/ebay-radio/radio.js +29 -18
- package/ebay-section-notice/section-notice-footer.js +6 -3
- package/ebay-section-notice/section-notice-title.js +16 -5
- package/ebay-section-notice/section-notice.js +39 -24
- package/ebay-section-title/cta.js +16 -5
- package/ebay-section-title/info.js +16 -5
- package/ebay-section-title/overflow.js +16 -5
- package/ebay-section-title/section-title.js +24 -13
- package/ebay-section-title/subtitle.js +16 -5
- package/ebay-section-title/title.js +16 -5
- package/ebay-select/ebay-select-option.js +15 -4
- package/ebay-select/ebay-select.d.ts +1 -1
- package/ebay-select/ebay-select.js +45 -34
- package/ebay-signal/signal.js +17 -6
- package/ebay-snackbar-dialog/components/ebay-snackbar-dialog-action.js +16 -5
- package/ebay-snackbar-dialog/components/ebay-snackbar-dialog.js +38 -27
- package/ebay-split-button/split-button.js +21 -10
- package/ebay-star-rating/star-rating.js +19 -8
- package/ebay-star-rating-select/star-rating-select.js +31 -20
- package/ebay-svg/svg.js +3 -3
- package/ebay-switch/ebay-switch.js +21 -10
- package/ebay-tabs/tab-panel.js +16 -5
- package/ebay-tabs/tab.js +16 -5
- package/ebay-tabs/tabs.js +40 -26
- package/ebay-textbox/postfix-icon.js +18 -7
- package/ebay-textbox/prefix-icon.js +16 -5
- package/ebay-textbox/textbox.d.ts +1 -1
- package/ebay-textbox/textbox.js +53 -42
- package/ebay-toast-dialog/components/toast.js +17 -6
- package/ebay-tooltip/ebay-tooltip-content.js +1 -1
- package/ebay-tooltip/ebay-tooltip-host.js +1 -1
- package/ebay-tooltip/ebay-tooltip.js +32 -21
- package/ebay-tourtip/ebay-tourtip-content.js +1 -1
- package/ebay-tourtip/ebay-tourtip-footer.js +7 -4
- package/ebay-tourtip/ebay-tourtip-heading.js +17 -6
- package/ebay-tourtip/ebay-tourtip-host.js +1 -1
- package/ebay-tourtip/ebay-tourtip.js +33 -22
- package/ebay-video/controls.d.ts.map +1 -1
- package/ebay-video/controls.js +46 -23
- package/ebay-video/reportButton.d.ts +2 -7
- package/ebay-video/reportButton.d.ts.map +1 -1
- package/ebay-video/reportButton.js +8 -5
- package/ebay-video/source.js +14 -3
- package/ebay-video/video.d.ts.map +1 -1
- package/ebay-video/video.js +80 -54
- 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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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(
|
|
77
|
+
throw new Error("EbayInfotip: Please use a EbayInfotipContent that defines the content of the infotip");
|
|
66
78
|
}
|
|
67
|
-
|
|
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,
|
|
71
|
-
|
|
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,
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
|
|
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
|
-
|
|
68
|
+
var content = (0, component_utils_1.findComponent)(children, ebay_notice_content_1.EbayNoticeContent);
|
|
57
69
|
if (!content) {
|
|
58
|
-
throw new Error(
|
|
70
|
+
throw new Error("EbayInlineNotice: Please use a EbayNoticeContent that defines the content of the notice");
|
|
59
71
|
}
|
|
60
|
-
|
|
61
|
-
return (react_1.default.createElement("div",
|
|
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:
|
|
64
|
-
react_1.default.createElement(notice_content_1.default,
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
return (react_1.default.createElement("div",
|
|
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,
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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(
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
78
|
+
var _f = getInitialSelectedOption(), selectedOptionFromValue = _f.option, initialSelectedOptionIndex = _f.index;
|
|
66
79
|
// Update the selected option to the state
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
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
|
-
|
|
73
|
-
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
};
|
|
85
|
-
|
|
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
|
-
|
|
107
|
+
var expandListbox = function () {
|
|
90
108
|
setExpanded(true);
|
|
91
109
|
onExpand();
|
|
92
110
|
};
|
|
93
|
-
|
|
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
|
-
|
|
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
|
-
|
|
129
|
+
var reset = function () {
|
|
112
130
|
collapseListbox();
|
|
113
131
|
setSelectedOption(childrenArray[initialSelectedOptionIndex]);
|
|
114
132
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
optionEle.setAttribute(
|
|
118
|
-
optionEle.classList.add(
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
optionEle.setAttribute(
|
|
123
|
-
optionEle.classList.remove(
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
145
|
+
var scrollOptions = function (index) {
|
|
146
|
+
var listboxOptionsContainerNode = optionsParentContainerRef.current;
|
|
147
|
+
var currentTarget = getSelectedOption(index);
|
|
130
148
|
if (listboxOptionsContainerNode.scrollHeight > listboxOptionsContainerNode.clientHeight) {
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
|
|
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
|
-
|
|
150
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(()
|
|
193
|
-
setTimeout(()
|
|
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
|
-
|
|
211
|
-
.map((child, index)
|
|
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)
|
|
216
|
-
innerRef: 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
|
-
|
|
221
|
-
|
|
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
|
-
|
|
227
|
-
|
|
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",
|
|
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)
|
|
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)
|
|
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(()
|
|
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)
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
return (react_1.default.createElement("hr",
|
|
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;
|