@ebay/ui-core-react 7.0.2 → 7.1.0-alpha.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.
- package/array.polyfill.flat-5BAolFdk.js +1 -0
- package/badge-CoHKfiPt.js +1 -0
- package/button-o4ao46WM.js +1 -0
- package/calendar-CPKqwJVQ.js +1 -0
- package/debounce-BQsYxxOL.js +1 -0
- package/dialog-previous-button-7ePoYWyj.js +1 -0
- package/drawer-BxxlJwkZ.js +1 -0
- package/ebay-alert-dialog.js +1 -0
- package/ebay-badge.js +1 -0
- package/ebay-breadcrumbs.js +1 -0
- package/ebay-button.js +1 -0
- package/ebay-calendar.js +1 -0
- package/ebay-carousel.js +1 -0
- package/ebay-checkbox.js +1 -0
- package/ebay-confirm-dialog.js +1 -0
- package/ebay-cta-button.js +1 -0
- package/ebay-date-textbox.js +1 -0
- package/ebay-dialog-base.js +1 -0
- package/ebay-drawer-dialog.js +1 -0
- package/ebay-eek.js +1 -0
- package/ebay-fake-menu-button.js +1 -0
- package/ebay-fake-menu.js +1 -0
- package/ebay-fake-tabs.js +1 -0
- package/ebay-field.js +1 -0
- package/ebay-fullscreen-dialog.js +1 -0
- package/ebay-icon-button.js +1 -0
- package/ebay-icon.js +1 -0
- package/ebay-infotip.js +1 -0
- package/ebay-inline-notice.js +1 -0
- package/ebay-lightbox-dialog.js +1 -0
- package/ebay-listbox-button.js +2 -0
- package/ebay-menu/menu.d.ts +1 -1
- package/ebay-menu/menu.d.ts.map +1 -1
- package/ebay-menu-button.js +1 -0
- package/ebay-menu.js +1 -0
- package/ebay-notice-base.js +1 -0
- package/ebay-page-notice.js +1 -0
- package/ebay-pagination.js +1 -0
- package/ebay-panel-dialog.js +1 -0
- package/ebay-progress-bar.js +1 -0
- package/ebay-progress-spinner.js +1 -0
- package/ebay-progress-stepper.js +1 -0
- package/ebay-radio.js +1 -0
- package/ebay-section-notice.js +1 -0
- package/ebay-section-title/index.d.ts.map +1 -1
- package/ebay-section-title.js +1 -0
- package/ebay-select.js +1 -0
- package/ebay-signal.js +1 -0
- package/ebay-snackbar-dialog.js +1 -0
- package/ebay-split-button.js +1 -0
- package/ebay-star-rating-select.js +1 -0
- package/ebay-star-rating.js +1 -0
- package/ebay-svg.js +1 -0
- package/ebay-switch.js +1 -0
- package/ebay-tabs.js +1 -0
- package/ebay-textbox.js +1 -0
- package/ebay-toast-dialog.js +1 -0
- package/ebay-tooltip.js +1 -0
- package/ebay-tourtip.js +1 -0
- package/ebay-video.js +1 -0
- package/hooks-Ctier7Yv.js +1 -0
- package/icon-DK6eEQD8.js +1 -0
- package/icon-button-BB6GFLm7.js +1 -0
- package/index-DbjwTbDP.js +1 -0
- package/label-CnrpYJ-g.js +1 -0
- package/menu-DZU8jEPV.js +1 -0
- package/menu-button-label-BcgasGA4.js +1 -0
- package/menu-item-DBi1NcrM.js +1 -0
- package/notice-content-9iF4T8uB.js +1 -0
- package/notice-content-C0ZStfuX.js +1 -0
- package/notice-footer-Cw1DMzoB.js +1 -0
- package/package.json +19 -8
- package/progress-spinner-CDgxI8R_.js +1 -0
- package/range-DOsPN0h5.js +1 -0
- package/textbox-WnB-9F4y.js +1 -0
- package/use-tooltip-BavqG36Z.js +1 -0
- package/utils-C9NL3q0j.js +1 -0
- package/common/component-utils/array.polyfill.flat.js +0 -32
- package/common/component-utils/forwardRef.js +0 -37
- package/common/component-utils/index.js +0 -18
- package/common/component-utils/usePrevious.js +0 -12
- package/common/component-utils/utils.js +0 -26
- package/common/debounce.js +0 -11
- package/common/event-utils/index.js +0 -123
- package/common/event-utils/types.js +0 -14
- package/common/event-utils/use-key-press.js +0 -33
- package/common/event-utils/use-roving-index.js +0 -35
- package/common/floating-label-utils/hooks.js +0 -133
- package/common/notice-utils/notice-content.js +0 -12
- package/common/notice-utils/notice-cta.js +0 -23
- package/common/notice-utils/notice-footer.js +0 -23
- package/common/notice-utils/notice-title.js +0 -24
- package/common/random-id.js +0 -5
- package/common/range.js +0 -5
- package/common/tooltip-utils/constants.js +0 -95
- package/common/tooltip-utils/index.js +0 -19
- package/common/tooltip-utils/tooltip-close-button.js +0 -8
- package/common/tooltip-utils/tooltip-content.js +0 -25
- package/common/tooltip-utils/tooltip-footer.js +0 -9
- package/common/tooltip-utils/tooltip-host.js +0 -24
- package/common/tooltip-utils/tooltip.js +0 -60
- package/common/tooltip-utils/types.js +0 -2
- package/common/tooltip-utils/use-tooltip.js +0 -27
- package/ebay-alert-dialog/alert-dialog.js +0 -55
- package/ebay-alert-dialog/index.js +0 -8
- package/ebay-badge/badge.js +0 -25
- package/ebay-badge/index.js +0 -8
- package/ebay-breadcrumbs/breadcrumb-item.js +0 -27
- package/ebay-breadcrumbs/breadcrumbs.js +0 -64
- package/ebay-breadcrumbs/index.js +0 -10
- package/ebay-button/button-cell.js +0 -29
- package/ebay-button/button-expand.js +0 -13
- package/ebay-button/button-loading.js +0 -11
- package/ebay-button/button-text.js +0 -9
- package/ebay-button/button.js +0 -95
- package/ebay-button/index.js +0 -10
- package/ebay-button/types.js +0 -2
- package/ebay-calendar/calendar.js +0 -306
- package/ebay-calendar/date-utils.js +0 -58
- package/ebay-calendar/index.js +0 -8
- package/ebay-carousel/carousel-control-button.js +0 -24
- package/ebay-carousel/carousel-item.js +0 -59
- package/ebay-carousel/carousel-list.js +0 -81
- package/ebay-carousel/carousel.js +0 -109
- package/ebay-carousel/helpers.js +0 -123
- package/ebay-carousel/index.js +0 -10
- package/ebay-carousel/scroll-to-transition.js +0 -102
- package/ebay-carousel/types.js +0 -2
- package/ebay-checkbox/checkbox.js +0 -77
- package/ebay-checkbox/index.js +0 -8
- package/ebay-confirm-dialog/confirm-dialog.js +0 -56
- package/ebay-confirm-dialog/index.js +0 -8
- package/ebay-cta-button/cta-button.js +0 -30
- package/ebay-cta-button/index.js +0 -8
- package/ebay-date-textbox/date-textbox.js +0 -179
- package/ebay-date-textbox/index.js +0 -8
- package/ebay-dialog-base/components/animation.js +0 -96
- package/ebay-dialog-base/components/dialog-actions.js +0 -8
- package/ebay-dialog-base/components/dialog-close-button.js +0 -8
- package/ebay-dialog-base/components/dialog-footer.js +0 -8
- package/ebay-dialog-base/components/dialog-header.js +0 -22
- package/ebay-dialog-base/components/dialog-previous-button.js +0 -24
- package/ebay-dialog-base/components/dialogBase.js +0 -152
- package/ebay-dialog-base/dialog-base-with-state.js +0 -63
- package/ebay-dialog-base/index.js +0 -18
- package/ebay-drawer-dialog/components/drawer.js +0 -104
- package/ebay-drawer-dialog/index.js +0 -8
- package/ebay-eek/eek-rating.js +0 -23
- package/ebay-eek/eek-util.js +0 -34
- package/ebay-eek/index.js +0 -8
- package/ebay-fake-menu/index.js +0 -12
- package/ebay-fake-menu/menu-item-separator.js +0 -23
- package/ebay-fake-menu/menu-item.js +0 -72
- package/ebay-fake-menu/menu.js +0 -57
- package/ebay-fake-menu-button/index.js +0 -14
- package/ebay-fake-menu-button/menu-button-item.js +0 -5
- package/ebay-fake-menu-button/menu-button-label.js +0 -8
- package/ebay-fake-menu-button/menu-button-separator.js +0 -23
- package/ebay-fake-menu-button/menu-button.js +0 -105
- package/ebay-fake-tabs/fake-tabs.js +0 -54
- package/ebay-fake-tabs/index.js +0 -10
- package/ebay-fake-tabs/tab.js +0 -24
- package/ebay-field/description.js +0 -26
- package/ebay-field/field.js +0 -12
- package/ebay-field/index.js +0 -12
- package/ebay-field/label.js +0 -29
- package/ebay-field/types.js +0 -2
- package/ebay-fullscreen-dialog/fullscreen-dialog.js +0 -25
- package/ebay-fullscreen-dialog/index.js +0 -8
- package/ebay-icon/icon.js +0 -98
- package/ebay-icon/index.js +0 -8
- package/ebay-icon/types.js +0 -3
- package/ebay-icon-button/icon-button.js +0 -40
- package/ebay-icon-button/index.js +0 -8
- package/ebay-infotip/ebay-infotip-content.js +0 -12
- package/ebay-infotip/ebay-infotip-heading.js +0 -23
- package/ebay-infotip/ebay-infotip-host.js +0 -28
- package/ebay-infotip/ebay-infotip.js +0 -79
- package/ebay-infotip/index.js +0 -14
- package/ebay-infotip/types.js +0 -2
- package/ebay-inline-notice/index.js +0 -10
- package/ebay-inline-notice/inline-notice.js +0 -66
- package/ebay-inline-notice/types.js +0 -2
- package/ebay-lightbox-dialog/index.js +0 -8
- package/ebay-lightbox-dialog/lightbox-dialog.js +0 -27
- package/ebay-listbox-button/index.js +0 -10
- package/ebay-listbox-button/listbox-button-option.js +0 -27
- package/ebay-listbox-button/listbox-button.js +0 -252
- package/ebay-menu/index.js +0 -27
- package/ebay-menu/menu-item-separator.js +0 -23
- package/ebay-menu/menu-item.js +0 -67
- package/ebay-menu/menu.js +0 -149
- package/ebay-menu/types.js +0 -2
- package/ebay-menu-button/index.js +0 -29
- package/ebay-menu-button/menu-button-item.js +0 -5
- package/ebay-menu-button/menu-button-label.js +0 -8
- package/ebay-menu-button/menu-button-separator.js +0 -23
- package/ebay-menu-button/menu-button.js +0 -132
- package/ebay-menu-button/types.js +0 -2
- package/ebay-notice-base/components/ebay-notice-content/index.js +0 -8
- package/ebay-notice-base/components/ebay-notice-content/notice-content.js +0 -4
- package/ebay-notice-base/components/ebay-notice-title/index.js +0 -8
- package/ebay-notice-base/components/ebay-notice-title/notice-title.js +0 -8
- package/ebay-notice-base/index.js +0 -7
- package/ebay-page-notice/index.js +0 -16
- package/ebay-page-notice/page-notice-cta.js +0 -9
- package/ebay-page-notice/page-notice-footer.js +0 -9
- package/ebay-page-notice/page-notice-title.js +0 -23
- package/ebay-page-notice/page-notice.js +0 -66
- package/ebay-pagination/const.js +0 -8
- package/ebay-pagination/helpers.js +0 -92
- package/ebay-pagination/index.js +0 -10
- package/ebay-pagination/pagination-item.js +0 -55
- package/ebay-pagination/pagination.js +0 -146
- package/ebay-pagination/types.js +0 -2
- package/ebay-panel-dialog/index.js +0 -8
- package/ebay-panel-dialog/panel-dialog.js +0 -27
- package/ebay-progress-bar/index.js +0 -8
- package/ebay-progress-bar/progress-bar.js +0 -23
- package/ebay-progress-spinner/index.js +0 -8
- package/ebay-progress-spinner/progress-spinner.js +0 -35
- package/ebay-progress-stepper/ebay-progress-step.js +0 -64
- package/ebay-progress-stepper/ebay-progress-stepper.js +0 -70
- package/ebay-progress-stepper/ebay-progress-title.js +0 -5
- package/ebay-progress-stepper/index.js +0 -12
- package/ebay-progress-stepper/types.js +0 -2
- package/ebay-radio/index.js +0 -8
- package/ebay-radio/radio.js +0 -71
- package/ebay-section-notice/index.js +0 -14
- package/ebay-section-notice/section-notice-footer.js +0 -9
- package/ebay-section-notice/section-notice-title.js +0 -23
- package/ebay-section-notice/section-notice.js +0 -82
- package/ebay-section-title/cta.js +0 -26
- package/ebay-section-title/index.js +0 -16
- package/ebay-section-title/info.js +0 -23
- package/ebay-section-title/overflow.js +0 -23
- package/ebay-section-title/section-title.js +0 -35
- package/ebay-section-title/subtitle.js +0 -23
- package/ebay-section-title/title.js +0 -23
- package/ebay-select/ebay-select-option.js +0 -22
- package/ebay-select/ebay-select.js +0 -129
- package/ebay-select/index.js +0 -10
- package/ebay-signal/index.js +0 -8
- package/ebay-signal/signal.js +0 -24
- package/ebay-snackbar-dialog/components/ebay-snackbar-dialog-action.js +0 -24
- package/ebay-snackbar-dialog/components/ebay-snackbar-dialog.js +0 -122
- package/ebay-snackbar-dialog/index.js +0 -7
- package/ebay-split-button/index.js +0 -23
- package/ebay-split-button/split-button.js +0 -30
- package/ebay-split-button/types.js +0 -2
- package/ebay-star-rating/index.js +0 -23
- package/ebay-star-rating/star-rating.js +0 -26
- package/ebay-star-rating-select/index.js +0 -23
- package/ebay-star-rating-select/star-rating-select.js +0 -82
- package/ebay-svg/index.js +0 -8
- package/ebay-svg/svg.js +0 -2548
- package/ebay-switch/ebay-switch.js +0 -61
- package/ebay-switch/index.js +0 -8
- package/ebay-tabs/index.js +0 -12
- package/ebay-tabs/tab-panel.js +0 -24
- package/ebay-tabs/tab.js +0 -24
- package/ebay-tabs/tabs.js +0 -90
- package/ebay-tabs/types.js +0 -2
- package/ebay-textbox/index.js +0 -16
- package/ebay-textbox/postfix-icon.js +0 -26
- package/ebay-textbox/postfix-text.js +0 -8
- package/ebay-textbox/prefix-icon.js +0 -23
- package/ebay-textbox/prefix-text.js +0 -8
- package/ebay-textbox/textbox.js +0 -147
- package/ebay-textbox/types.js +0 -2
- package/ebay-toast-dialog/components/toast.js +0 -26
- package/ebay-toast-dialog/index.js +0 -8
- package/ebay-tooltip/ebay-tooltip-content.js +0 -8
- package/ebay-tooltip/ebay-tooltip-host.js +0 -8
- package/ebay-tooltip/ebay-tooltip.js +0 -85
- package/ebay-tooltip/index.js +0 -14
- package/ebay-tourtip/ebay-tourtip-content.js +0 -8
- package/ebay-tourtip/ebay-tourtip-footer.js +0 -10
- package/ebay-tourtip/ebay-tourtip-heading.js +0 -24
- package/ebay-tourtip/ebay-tourtip-host.js +0 -8
- package/ebay-tourtip/ebay-tourtip.js +0 -70
- package/ebay-tourtip/index.js +0 -18
- package/ebay-video/const.js +0 -19
- package/ebay-video/controls.js +0 -40
- package/ebay-video/index.js +0 -25
- package/ebay-video/reportButton.js +0 -12
- package/ebay-video/source.js +0 -22
- package/ebay-video/types.js +0 -2
- package/ebay-video/video.js +0 -210
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
const react_1 = __importStar(require("react"));
|
|
41
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
42
|
-
const ebay_dialog_base_1 = require("../../ebay-dialog-base");
|
|
43
|
-
const THRESHOLD_TOUCH = 30;
|
|
44
|
-
const classPrefix = 'drawer-dialog';
|
|
45
|
-
const EbayDrawerDialog = (_a) => {
|
|
46
|
-
var { expanded: controlledExpanded = false, noHandle, onClose = () => { }, onCollapsed = () => { }, onExpanded = () => { }, a11yMaximizeText, a11yMinimizeText, children } = _a, rest = __rest(_a, ["expanded", "noHandle", "onClose", "onCollapsed", "onExpanded", "a11yMaximizeText", "a11yMinimizeText", "children"]);
|
|
47
|
-
let touches = [];
|
|
48
|
-
const [expanded, setExpanded] = (0, react_1.useState)(controlledExpanded);
|
|
49
|
-
(0, react_1.useEffect)(() => {
|
|
50
|
-
setExpanded(controlledExpanded);
|
|
51
|
-
}, [controlledExpanded]);
|
|
52
|
-
const setExpandedState = (expand) => {
|
|
53
|
-
setExpanded(expand);
|
|
54
|
-
if (expand) {
|
|
55
|
-
onExpanded();
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
onCollapsed();
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const handleTouchStart = (e) => {
|
|
62
|
-
touches = Array.from(e.changedTouches).map(({ identifier, pageY }) => ({ identifier, pageY }));
|
|
63
|
-
};
|
|
64
|
-
const handleTouchEnd = (e) => {
|
|
65
|
-
Array.from(e.changedTouches).forEach(({ identifier }) => {
|
|
66
|
-
const idx = touches.findIndex((touch) => touch.identifier === identifier);
|
|
67
|
-
if (idx > -1) {
|
|
68
|
-
touches.splice(idx, 1);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
const handleTouchMove = (e) => {
|
|
73
|
-
if (touches.length) {
|
|
74
|
-
Array.from(e.changedTouches).forEach(({ identifier, pageY }) => {
|
|
75
|
-
const compare = touches.findIndex(touch => touch.identifier === identifier);
|
|
76
|
-
const diff = pageY - touches[compare].pageY;
|
|
77
|
-
if (diff > THRESHOLD_TOUCH) {
|
|
78
|
-
// Drag down, collpase
|
|
79
|
-
if (expanded) {
|
|
80
|
-
setExpandedState(false);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
onClose();
|
|
84
|
-
}
|
|
85
|
-
handleTouchEnd(e);
|
|
86
|
-
}
|
|
87
|
-
else if (diff < -THRESHOLD_TOUCH) {
|
|
88
|
-
setExpandedState(true);
|
|
89
|
-
handleTouchEnd(e);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const handle = noHandle ? null : (react_1.default.createElement("button", { "aria-label": expanded ? a11yMinimizeText : a11yMaximizeText, className: `${classPrefix}__handle`, onClick: () => setExpandedState(!expanded), onScroll: () => setExpandedState(true), onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, type: "button" }));
|
|
95
|
-
const childrenArray = react_1.Children.toArray(children);
|
|
96
|
-
const header = childrenArray.find(({ type }) => type === ebay_dialog_base_1.EbayDialogHeader);
|
|
97
|
-
const withoutHeader = childrenArray.filter(({ type }) => type !== ebay_dialog_base_1.EbayDialogHeader);
|
|
98
|
-
return (react_1.default.createElement(ebay_dialog_base_1.DialogBaseWithState, Object.assign({}, rest, { classPrefix: classPrefix, onCloseBtnClick: onClose, className: (0, classnames_1.default)(rest.className, `${classPrefix}--mask-fade-slow`), windowClass: (0, classnames_1.default)(rest.windowClass, `${classPrefix}__window`, `${classPrefix}__window--slide`, {
|
|
99
|
-
[`${classPrefix}__window--expanded`]: expanded
|
|
100
|
-
}), onBackgroundClick: onClose, top: handle }),
|
|
101
|
-
header || react_1.default.createElement(ebay_dialog_base_1.EbayDialogHeader, null),
|
|
102
|
-
withoutHeader));
|
|
103
|
-
};
|
|
104
|
-
exports.default = EbayDrawerDialog;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EbayDrawerDialog = void 0;
|
|
7
|
-
var drawer_1 = require("./components/drawer");
|
|
8
|
-
Object.defineProperty(exports, "EbayDrawerDialog", { enumerable: true, get: function () { return __importDefault(drawer_1).default; } });
|
package/ebay-eek/eek-rating.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
8
|
-
const eek_util_1 = __importDefault(require("./eek-util"));
|
|
9
|
-
const ebay_icon_1 = require("../ebay-icon");
|
|
10
|
-
const EbayEek = ({ min = '', max = '', rating, a11yText, className: extraClasses }) => {
|
|
11
|
-
const parsedRating = (0, eek_util_1.default)({ rating, min, max });
|
|
12
|
-
const className = (0, classnames_1.default)(extraClasses, 'eek', { [`eek--rating-${parsedRating}`]: !!parsedRating });
|
|
13
|
-
const backupA11yText = `Energy Rating: ${rating}. Range: ${max} - ${min}.`;
|
|
14
|
-
return (react_1.default.createElement("div", { className: className, role: "figure", "aria-label": a11yText || backupA11yText },
|
|
15
|
-
react_1.default.createElement("div", { className: "eek__container", "aria-hidden": true },
|
|
16
|
-
react_1.default.createElement("span", { className: "eek__rating-range" },
|
|
17
|
-
react_1.default.createElement("span", { "aria-hidden": "true" }, max),
|
|
18
|
-
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "eekRangeArrow" }),
|
|
19
|
-
react_1.default.createElement("span", { "aria-hidden": "true" }, min)),
|
|
20
|
-
react_1.default.createElement("span", { className: "eek__rating", "aria-hidden": "true" }, rating)),
|
|
21
|
-
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "eekArrow" })));
|
|
22
|
-
};
|
|
23
|
-
exports.default = EbayEek;
|
package/ebay-eek/eek-util.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const validRanges = {
|
|
4
|
-
'A+++': ['D', 'E', 'G'],
|
|
5
|
-
'A++': ['E', 'G'],
|
|
6
|
-
'A+': ['F', 'G'],
|
|
7
|
-
A: ['G']
|
|
8
|
-
};
|
|
9
|
-
exports.default = (input) => {
|
|
10
|
-
const { max, min, rating } = input;
|
|
11
|
-
const validMax = validRanges[max];
|
|
12
|
-
if (!(validMax && validMax.indexOf(min) > -1)) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
// Count from max until you reach rating
|
|
16
|
-
let current = max;
|
|
17
|
-
let i = 1;
|
|
18
|
-
while (current !== rating) {
|
|
19
|
-
i++;
|
|
20
|
-
if (min === current) {
|
|
21
|
-
// It's at end, didn't match rating
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
else if (current.length > 1) {
|
|
25
|
-
// Has + in string, remove one plus
|
|
26
|
-
current = current.slice(0, current.length - 1);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
// No pluses get next character code
|
|
30
|
-
current = String.fromCharCode(current.charCodeAt(0) + 1);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return i > 7 ? 7 : i;
|
|
34
|
-
};
|
package/ebay-eek/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EbayEek = void 0;
|
|
7
|
-
var eek_rating_1 = require("./eek-rating");
|
|
8
|
-
Object.defineProperty(exports, "EbayEek", { enumerable: true, get: function () { return __importDefault(eek_rating_1).default; } });
|
package/ebay-fake-menu/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EbayFakeMenuSeparator = exports.EbayFakeMenuItem = exports.EbayFakeMenu = void 0;
|
|
7
|
-
var menu_1 = require("./menu");
|
|
8
|
-
Object.defineProperty(exports, "EbayFakeMenu", { enumerable: true, get: function () { return __importDefault(menu_1).default; } });
|
|
9
|
-
var menu_item_1 = require("./menu-item");
|
|
10
|
-
Object.defineProperty(exports, "EbayFakeMenuItem", { enumerable: true, get: function () { return __importDefault(menu_item_1).default; } });
|
|
11
|
-
var menu_item_separator_1 = require("./menu-item-separator");
|
|
12
|
-
Object.defineProperty(exports, "EbayFakeMenuSeparator", { enumerable: true, get: function () { return __importDefault(menu_item_separator_1).default; } });
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
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, 'fake-menu__separator'), role: "separator" })));
|
|
22
|
-
};
|
|
23
|
-
exports.default = EbayMenuItemSeparator;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
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 ebay_badge_1 = require("../ebay-badge");
|
|
44
|
-
const EbayMenuItem = (_a) => {
|
|
45
|
-
var { className, current, disabled, autoFocus, type, badgeNumber, badgeAriaLabel, children } = _a, rest = __rest(_a, ["className", "current", "disabled", "autoFocus", "type", "badgeNumber", "badgeAriaLabel", "children"]);
|
|
46
|
-
const ref = (0, react_1.useRef)();
|
|
47
|
-
const hasBadge = badgeNumber !== undefined;
|
|
48
|
-
(0, react_1.useEffect)(() => {
|
|
49
|
-
var _a;
|
|
50
|
-
if (autoFocus) {
|
|
51
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
const itemProps = Object.assign(Object.assign({}, rest), { ref, className: (0, classnames_1.default)(className, 'fake-menu__item', hasBadge && 'menu__item--badged'), 'aria-label': badgeAriaLabel });
|
|
55
|
-
const tick = react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "tick16" });
|
|
56
|
-
// todo: remove this workaround when Skin team fixes https://github.com/eBay/skin/issues/2208
|
|
57
|
-
const badgeStyleFix = {
|
|
58
|
-
marginLeft: 'var(--spacing-100)',
|
|
59
|
-
marginRight: 'var(--spacing-100)'
|
|
60
|
-
};
|
|
61
|
-
const badge = hasBadge && react_1.default.createElement(ebay_badge_1.EbayBadge, { type: "menu", number: badgeNumber, style: badgeStyleFix });
|
|
62
|
-
return type === 'button' ? (react_1.default.createElement("button", Object.assign({}, itemProps, { type: "button", disabled: disabled }),
|
|
63
|
-
react_1.default.createElement("span", null,
|
|
64
|
-
children,
|
|
65
|
-
badge),
|
|
66
|
-
tick)) : (react_1.default.createElement("a", Object.assign({}, itemProps, { "aria-disabled": disabled ? 'true' : undefined }),
|
|
67
|
-
react_1.default.createElement("span", null,
|
|
68
|
-
children,
|
|
69
|
-
badge),
|
|
70
|
-
tick));
|
|
71
|
-
};
|
|
72
|
-
exports.default = EbayMenuItem;
|
package/ebay-fake-menu/menu.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
const react_1 = __importStar(require("react"));
|
|
41
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
42
|
-
const EbayFakeMenu = (_a) => {
|
|
43
|
-
var { className, itemMatchesUrl = true, onKeyDown = () => { }, onSelect = () => { }, children } = _a, rest = __rest(_a, ["className", "itemMatchesUrl", "onKeyDown", "onSelect", "children"]);
|
|
44
|
-
const childrenArray = react_1.Children.toArray(children);
|
|
45
|
-
const defaultAriaCurrent = itemMatchesUrl === false ? 'true' : 'page';
|
|
46
|
-
return (react_1.default.createElement("div", Object.assign({}, rest, { className: (0, classnames_1.default)(className, 'fake-menu') }),
|
|
47
|
-
react_1.default.createElement("ul", { className: "fake-menu__items", tabIndex: -1 }, childrenArray.map((child, i) => {
|
|
48
|
-
const _a = child.props, { current, onClick = () => { } } = _a, itemRest = __rest(_a, ["current", "onClick"]);
|
|
49
|
-
return (react_1.default.createElement("li", { key: i }, (0, react_1.cloneElement)(child, Object.assign(Object.assign({}, itemRest), { 'aria-current': current ? defaultAriaCurrent : undefined, onClick: e => {
|
|
50
|
-
onSelect(e, { index: i });
|
|
51
|
-
onClick(e);
|
|
52
|
-
}, onKeyDown: e => {
|
|
53
|
-
onKeyDown(e, { index: i });
|
|
54
|
-
} }))));
|
|
55
|
-
}))));
|
|
56
|
-
};
|
|
57
|
-
exports.default = EbayFakeMenu;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EbayFakeMenuButtonLabel = exports.EbayFakeMenuButtonSeparator = exports.EbayFakeMenuButtonItem = exports.EbayFakeMenuButton = void 0;
|
|
7
|
-
var menu_button_1 = require("./menu-button");
|
|
8
|
-
Object.defineProperty(exports, "EbayFakeMenuButton", { enumerable: true, get: function () { return __importDefault(menu_button_1).default; } });
|
|
9
|
-
var menu_button_item_1 = require("./menu-button-item");
|
|
10
|
-
Object.defineProperty(exports, "EbayFakeMenuButtonItem", { enumerable: true, get: function () { return __importDefault(menu_button_item_1).default; } });
|
|
11
|
-
var menu_button_separator_1 = require("./menu-button-separator");
|
|
12
|
-
Object.defineProperty(exports, "EbayFakeMenuButtonSeparator", { enumerable: true, get: function () { return __importDefault(menu_button_separator_1).default; } });
|
|
13
|
-
var menu_button_label_1 = require("./menu-button-label");
|
|
14
|
-
Object.defineProperty(exports, "EbayFakeMenuButtonLabel", { enumerable: true, get: function () { return __importDefault(menu_button_label_1).default; } });
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const EbayFakeMenuButtonLabel = ({ children }) => (react_1.default.createElement(react_1.default.Fragment, null, children));
|
|
8
|
-
exports.default = EbayFakeMenuButtonLabel;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const react_1 = __importDefault(require("react"));
|
|
18
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
19
|
-
const EbayMenuButtonSeparator = (_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-button__separator'), role: "separator" })));
|
|
22
|
-
};
|
|
23
|
-
exports.default = EbayMenuButtonSeparator;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
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 event_utils_1 = require("../common/event-utils");
|
|
44
|
-
const random_id_1 = require("../common/random-id");
|
|
45
|
-
const ebay_button_1 = require("../ebay-button");
|
|
46
|
-
const ebay_icon_1 = require("../ebay-icon");
|
|
47
|
-
const ebay_icon_button_1 = require("../ebay-icon-button");
|
|
48
|
-
const ebay_fake_menu_1 = require("../ebay-fake-menu");
|
|
49
|
-
const _1 = require(".");
|
|
50
|
-
const EbayMenuButton = (_a) => {
|
|
51
|
-
var { a11yText, noToggleIcon, fixWidth, reverse, variant, expanded: defaultExpanded = false, className, onCollapse = () => { }, onExpand = () => { }, onMouseDown = () => { }, onSelect = () => { }, text = '', children } = _a, rest = __rest(_a, ["a11yText", "noToggleIcon", "fixWidth", "reverse", "variant", "expanded", "className", "onCollapse", "onExpand", "onMouseDown", "onSelect", "text", "children"]);
|
|
52
|
-
const [expanded, setExpanded] = (0, react_1.useState)(defaultExpanded);
|
|
53
|
-
const [menuId, setMenuId] = (0, react_1.useState)();
|
|
54
|
-
const ref = (0, react_1.useRef)();
|
|
55
|
-
const icon = (0, component_utils_1.findComponent)(children, ebay_icon_1.EbayIcon);
|
|
56
|
-
const label = (0, component_utils_1.findComponent)(children, _1.EbayFakeMenuButtonLabel) || (icon ? react_1.default.createElement("span", null, text) : text);
|
|
57
|
-
const menuItems = (0, component_utils_1.filterByType)(children, [_1.EbayFakeMenuButtonItem, _1.EbayFakeMenuButtonSeparator]);
|
|
58
|
-
(0, react_1.useEffect)(() => {
|
|
59
|
-
const handleBackgroundClick = (e) => {
|
|
60
|
-
if (ref.current && !ref.current.contains(e.currentTarget)) {
|
|
61
|
-
setExpanded(false);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
if (expanded) {
|
|
65
|
-
onExpand();
|
|
66
|
-
// On React 18 useEffect hooks runs synchronous instead of asynchronous as React 17 or prior
|
|
67
|
-
// causing the event listener to be attached to the document at the same time that the dialog
|
|
68
|
-
// opens. Adding a timeout so the event is attached after the click event that opened the modal
|
|
69
|
-
// is finished.
|
|
70
|
-
setTimeout(() => {
|
|
71
|
-
document.addEventListener('click', handleBackgroundClick, false);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else if (expanded === false) {
|
|
75
|
-
onCollapse();
|
|
76
|
-
}
|
|
77
|
-
return () => document.removeEventListener('click', handleBackgroundClick, false);
|
|
78
|
-
}, [expanded]);
|
|
79
|
-
(0, react_1.useEffect)(() => {
|
|
80
|
-
setMenuId((0, random_id_1.randomId)());
|
|
81
|
-
}, []);
|
|
82
|
-
const handleMenuKeydown = e => {
|
|
83
|
-
(0, event_utils_1.handleEscapeKeydown)(e, () => {
|
|
84
|
-
var _a;
|
|
85
|
-
setExpanded(false);
|
|
86
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
const menuClasses = (0, classnames_1.default)('fake-menu-button__menu', {
|
|
90
|
-
'menu-button__menu--fix-width': fixWidth,
|
|
91
|
-
'menu-button__menu--reverse': reverse
|
|
92
|
-
});
|
|
93
|
-
const buttonProps = Object.assign({ ref: ref, className: 'fake-menu-button__button', 'aria-expanded': !!expanded, 'aria-haspopup': true, 'aria-label': a11yText, 'aria-controls': menuId, onClick: () => setExpanded(!expanded) }, rest);
|
|
94
|
-
return (react_1.default.createElement("span", { className: (0, classnames_1.default)('fake-menu-button', className) },
|
|
95
|
-
variant === 'overflow' ?
|
|
96
|
-
react_1.default.createElement(ebay_icon_button_1.EbayIconButton, Object.assign({ icon: "overflowHorizontal24" }, buttonProps)) :
|
|
97
|
-
react_1.default.createElement(ebay_button_1.EbayButton, Object.assign({ variant: variant === 'form' ? 'form' : undefined, bodyState: noToggleIcon ? undefined : 'expand' }, buttonProps),
|
|
98
|
-
icon,
|
|
99
|
-
label),
|
|
100
|
-
expanded &&
|
|
101
|
-
react_1.default.createElement(ebay_fake_menu_1.EbayFakeMenu, { className: menuClasses, id: menuId, tabIndex: -1, onKeyDown: handleMenuKeydown, onSelect: onSelect }, menuItems.map((item, i) => (0, react_1.cloneElement)(item, Object.assign(Object.assign({}, item.props), { onMouseDown: (e) => {
|
|
102
|
-
onMouseDown(e, { index: i });
|
|
103
|
-
}, className: (0, classnames_1.default)(item.props.className, 'fake-menu-button__item'), key: i, autoFocus: i === 0 }))))));
|
|
104
|
-
};
|
|
105
|
-
exports.default = EbayMenuButton;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
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 tab_1 = __importDefault(require("./tab"));
|
|
44
|
-
const EbayFakeTabs = (_a) => {
|
|
45
|
-
var { selectedIndex = 0, tabMatchesCurrentUrl, className, children } = _a, rest = __rest(_a, ["selectedIndex", "tabMatchesCurrentUrl", "className", "children"]);
|
|
46
|
-
const ariaCurrent = tabMatchesCurrentUrl === false ? 'true' : 'page';
|
|
47
|
-
const tabHeadings = (0, component_utils_1.filterByType)(children, tab_1.default).map((item, i) => (0, react_1.cloneElement)(item, Object.assign(Object.assign({}, item.props), { ariaCurrent: selectedIndex === i ? ariaCurrent : null })));
|
|
48
|
-
const tabContent = (0, component_utils_1.excludeComponent)(children, tab_1.default);
|
|
49
|
-
return (react_1.default.createElement("div", Object.assign({}, rest, { className: (0, classnames_1.default)(className, 'fake-tabs') }),
|
|
50
|
-
react_1.default.createElement("ul", { className: "fake-tabs__items" }, tabHeadings),
|
|
51
|
-
react_1.default.createElement("div", { className: "fake-tabs__content" },
|
|
52
|
-
react_1.default.createElement("div", { className: "fake-tabs__cell" }, tabContent))));
|
|
53
|
-
};
|
|
54
|
-
exports.default = EbayFakeTabs;
|
package/ebay-fake-tabs/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EbayFakeTab = exports.EbayFakeTabs = void 0;
|
|
7
|
-
var fake_tabs_1 = require("./fake-tabs");
|
|
8
|
-
Object.defineProperty(exports, "EbayFakeTabs", { enumerable: true, get: function () { return __importDefault(fake_tabs_1).default; } });
|
|
9
|
-
var tab_1 = require("./tab");
|
|
10
|
-
Object.defineProperty(exports, "EbayFakeTab", { enumerable: true, get: function () { return __importDefault(tab_1).default; } });
|
package/ebay-fake-tabs/tab.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const react_1 = __importDefault(require("react"));
|
|
18
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
19
|
-
const Tab = (_a) => {
|
|
20
|
-
var { children, href, ariaCurrent, className } = _a, rest = __rest(_a, ["children", "href", "ariaCurrent", "className"]);
|
|
21
|
-
return (react_1.default.createElement("li", Object.assign({}, rest, { className: (0, classnames_1.default)(className, 'fake-tabs__item') }),
|
|
22
|
-
react_1.default.createElement("a", { href: href, "aria-current": ariaCurrent }, children)));
|
|
23
|
-
};
|
|
24
|
-
exports.default = Tab;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const react_1 = __importDefault(require("react"));
|
|
18
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
19
|
-
const Description = (_a) => {
|
|
20
|
-
var { type, position = 'below', className, children } = _a, rest = __rest(_a, ["type", "position", "className", "children"]);
|
|
21
|
-
const wrapperClassName = (0, classnames_1.default)(className, 'field__description', { [`field__description--${type}`]: type });
|
|
22
|
-
const WrapperElement = position === 'below' ? `div` : `span`;
|
|
23
|
-
return (react_1.default.createElement(WrapperElement, Object.assign({}, rest, { className: wrapperClassName }),
|
|
24
|
-
react_1.default.createElement("span", null, children)));
|
|
25
|
-
};
|
|
26
|
-
exports.default = Description;
|