@ebay/ui-core-react 7.4.0-alpha.6 → 7.4.0-alpha.8
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-DyxysTxZ.js +21 -0
- package/badge-CR5t7-2L.js +8 -0
- package/button-B4bZIgwB.js +83 -0
- package/calendar-D-DWjrMU.js +333 -0
- package/common/component-utils/forwardRef/index.js +10 -1
- package/common/component-utils/index.js +9 -1
- package/common/component-utils/utils/index.js +25 -1
- package/common/event-utils/index.js +113 -1
- package/common/floating-label-utils/hooks/index.js +106 -1
- package/common/notice-utils/notice-cta/index.js +5 -1
- package/common/random-id/index.js +13 -1
- package/common/tooltip-utils/constants/index.js +97 -1
- package/common/tooltip-utils/index.js +11 -1
- package/debounce-v8bWAUnY.js +9 -0
- package/dialog-previous-button-EC_Y6KaT.js +370 -0
- package/drawer-DBDktEBZ.js +69 -0
- package/ebay-alert-dialog/index.js +26 -1
- package/ebay-badge/index.js +4 -1
- package/ebay-breadcrumbs/index.js +47 -1
- package/ebay-button/index.js +5 -1
- package/ebay-calendar/index.js +4 -1
- package/ebay-carousel/index.js +345 -1
- package/ebay-checkbox/index.js +52 -1
- package/ebay-confirm-dialog/index.js +28 -1
- package/ebay-cta-button/index.js +22 -1
- package/ebay-date-textbox/index.js +140 -1
- package/ebay-dialog-base/components/animation/index.js +92 -1
- package/ebay-dialog-base/components/dialog-footer/index.js +4 -1
- package/ebay-dialog-base/components/dialog-header/index.js +4 -1
- package/ebay-dialog-base/index.js +13 -1
- package/ebay-drawer-dialog/index.js +4 -1
- package/ebay-eek/index.js +54 -1
- package/ebay-fake-menu/index.js +10 -1
- package/ebay-fake-menu/menu-item/index.js +49 -1
- package/ebay-fake-menu-button/index.js +7 -1
- package/ebay-fake-menu-button/menu-button/index.js +12 -1
- package/ebay-fake-tabs/index.js +30 -1
- package/ebay-field/index.js +21 -1
- package/ebay-fullscreen-dialog/index.js +10 -1
- package/ebay-icon/index.js +4 -1
- package/ebay-icon-button/index.js +4 -1
- package/ebay-infotip/index.js +76 -1
- package/ebay-inline-notice/index.js +36 -1
- package/ebay-lightbox-dialog/index.js +12 -1
- package/ebay-listbox/index.js +6 -1
- package/ebay-listbox/listbox.d.ts.map +1 -1
- package/ebay-listbox-button/index.js +151 -1
- package/ebay-menu/index.js +9 -1
- package/ebay-menu-button/index.js +113 -1
- package/ebay-notice-base/index.js +7 -1
- package/ebay-page-notice/index.js +50 -1
- package/ebay-pagination/index.js +244 -1
- package/ebay-panel-dialog/index.js +12 -1
- package/ebay-progress-bar/index.js +6 -1
- package/ebay-progress-spinner/index.js +4 -1
- package/ebay-progress-stepper/index.js +72 -1
- package/ebay-radio/index.js +4 -1
- package/ebay-radio/radio/index.js +48 -1
- package/ebay-section-notice/index.js +69 -1
- package/ebay-section-title/index.js +38 -1
- package/ebay-segmented-buttons/index.js +46 -1
- package/ebay-select/index.js +98 -1
- package/ebay-signal/index.js +9 -1
- package/ebay-snackbar-dialog/index.js +81 -1
- package/ebay-split-button/index.js +22 -1
- package/ebay-star-rating/index.js +9 -1
- package/ebay-star-rating-select/index.js +55 -1
- package/ebay-svg/index.js +5189 -1
- package/ebay-switch/index.js +27 -1
- package/ebay-tabs/index.js +88 -1
- package/ebay-textbox/index.js +10 -1
- package/ebay-toast-dialog/index.js +9 -1
- package/ebay-tooltip/index.js +64 -1
- package/ebay-tourtip/index.js +54 -1
- package/ebay-video/index.js +229 -1
- package/events/index.js +18 -1
- package/icon-B17Di3YL.js +56 -0
- package/icon-button-BQWoMgX1.js +31 -0
- package/index-BXizW4ue.js +89 -0
- package/index-DcH7Tjjd.js +272 -0
- package/label-C0AS4fnO.js +19 -0
- package/listbox-DGbY99kq.js +674 -0
- package/menu-Bsy48CE1.js +163 -0
- package/menu-button-CKGsgg6G.js +89 -0
- package/menu-fCOy6wBS.js +29 -0
- package/notice-content-BTXVxttv.js +8 -0
- package/notice-content-BhUeK1pd.js +3 -0
- package/notice-footer-CIQ8SM6N.js +10 -0
- package/package.json +1 -1
- package/progress-spinner-DOFKRtuu.js +20 -0
- package/range-C5qzyhg4.js +3 -0
- package/textbox-J291yCpJ.js +136 -0
- package/use-roving-index-CEM_UsCH.js +58 -0
- package/use-tooltip-7JxcZHJn.js +92 -0
- package/utils/index.js +13 -1
- package/array.polyfill.flat-5BAolFdk.js +0 -1
- package/badge-CoHKfiPt.js +0 -1
- package/button-DGuEBUDJ.js +0 -1
- package/calendar-lAu6VfAb.js +0 -1
- package/debounce-BQsYxxOL.js +0 -1
- package/dialog-previous-button-5cTKpmJ-.js +0 -1
- package/drawer-xTtCoO3F.js +0 -1
- package/icon-TuxfQndO.js +0 -1
- package/icon-button-Cwaj-eT9.js +0 -1
- package/index-D3xZmuzJ.js +0 -1
- package/index-Dkz0UnlJ.js +0 -1
- package/label-CnrpYJ-g.js +0 -1
- package/listbox-Ck3BxDm4.js +0 -1
- package/menu-CV-INYLM.js +0 -1
- package/menu-_LzP6yje.js +0 -1
- package/menu-button-BZ66jxvI.js +0 -1
- package/notice-content-9iF4T8uB.js +0 -1
- package/notice-content-C0ZStfuX.js +0 -1
- package/notice-footer-Cw1DMzoB.js +0 -1
- package/progress-spinner-U2qOANON.js +0 -1
- package/range-DOsPN0h5.js +0 -1
- package/textbox-dUhinDwj.js +0 -1
- package/use-roving-index-DoAVBgsp.js +0 -1
- package/use-tooltip-CL3_zAeg.js +0 -1
package/ebay-switch/index.js
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const classNames = require("classnames");
|
|
5
|
+
const isControlled = (checked) => typeof checked !== "undefined";
|
|
6
|
+
const EbaySwitch = ({ id, value, name, className, checked, defaultChecked = false, onChange = () => {
|
|
7
|
+
}, ...rest }) => {
|
|
8
|
+
const [isChecked, setChecked] = React.useState(defaultChecked);
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
setChecked(!!checked);
|
|
11
|
+
}, [checked]);
|
|
12
|
+
const handleChange = (e) => {
|
|
13
|
+
const { value: inputValue = "", checked: inputChecked = false } = e.target || {};
|
|
14
|
+
onChange(e, {
|
|
15
|
+
value: inputValue,
|
|
16
|
+
checked: inputChecked
|
|
17
|
+
});
|
|
18
|
+
setChecked(inputChecked);
|
|
19
|
+
};
|
|
20
|
+
return React.createElement(
|
|
21
|
+
"span",
|
|
22
|
+
{ className: "switch" },
|
|
23
|
+
React.createElement("input", { ...rest, className: classNames("switch__control", className), id, role: "switch", type: "checkbox", value, "aria-checked": isControlled(checked) ? checked : isChecked, checked: isControlled(checked) ? checked : isChecked, name, onChange: handleChange }),
|
|
24
|
+
React.createElement("span", { className: "switch__button" })
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
exports.EbaySwitch = EbaySwitch;
|
package/ebay-tabs/index.js
CHANGED
|
@@ -1 +1,88 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const classNames = require("classnames");
|
|
5
|
+
const common_eventUtils = require("../common/event-utils/index.js");
|
|
6
|
+
const common_componentUtils_utils = require("../common/component-utils/utils/index.js");
|
|
7
|
+
const Tab = ({ children, index, parentId, selected, focused, className, refCallback, ...rest }) => React.createElement(
|
|
8
|
+
"div",
|
|
9
|
+
{ ...rest, ref: refCallback, "aria-controls": `${parentId || "default"}-tabpanel-${index}`, "aria-selected": selected, className: classNames(className, "tabs__item"), id: `${parentId || "default"}-tab-${index}`, role: "tab", tabIndex: focused ? 0 : -1 },
|
|
10
|
+
React.createElement("span", null, children)
|
|
11
|
+
);
|
|
12
|
+
const TabPanel = ({ children, index, parentId, selected, className, ...rest }) => React.createElement(
|
|
13
|
+
"div",
|
|
14
|
+
{ ...rest, "aria-labelledby": `default-tab-${index}`, className: classNames(className, "tabs__panel"), id: `${parentId || "default"}-tabpanel-${index}`, role: "tabpanel", hidden: !selected },
|
|
15
|
+
React.createElement("div", { className: "tabs__cell" }, children)
|
|
16
|
+
);
|
|
17
|
+
const Tabs = ({ id, className, index = 0, size = "medium", activation = "auto", onSelect = () => {
|
|
18
|
+
}, onTabSelect = () => {
|
|
19
|
+
}, children }) => {
|
|
20
|
+
const headings = [];
|
|
21
|
+
const [selectedIndex, setSelectedIndex] = React.useState(index);
|
|
22
|
+
const [focusedIndex, setFocusedIndex] = React.useState(index);
|
|
23
|
+
const handleSelect = (i) => {
|
|
24
|
+
onSelect({ selectedIndex: i });
|
|
25
|
+
onTabSelect(i);
|
|
26
|
+
setSelectedIndex(i);
|
|
27
|
+
};
|
|
28
|
+
const onKeyDown = (ev, i) => {
|
|
29
|
+
common_eventUtils.handleActionKeydown(ev, () => {
|
|
30
|
+
ev.preventDefault();
|
|
31
|
+
if (activation === "manual") {
|
|
32
|
+
handleSelect(i);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
common_eventUtils.handleLeftRightArrowsKeydown(ev, () => {
|
|
36
|
+
var _a;
|
|
37
|
+
ev.preventDefault();
|
|
38
|
+
const len = common_componentUtils_utils.filterByType(children, Tab).length;
|
|
39
|
+
const direction = ["Left", "ArrowLeft"].includes(ev.key) ? -1 : 1;
|
|
40
|
+
const currentIndex = focusedIndex === void 0 ? selectedIndex : focusedIndex;
|
|
41
|
+
const nextIndex = (currentIndex + len + direction) % len;
|
|
42
|
+
setFocusedIndex(nextIndex);
|
|
43
|
+
(_a = headings[nextIndex]) == null ? void 0 : _a.focus();
|
|
44
|
+
if (activation !== "manual") {
|
|
45
|
+
handleSelect(nextIndex);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
handleSelect(index);
|
|
51
|
+
}, [index]);
|
|
52
|
+
const isLarge = size === "large";
|
|
53
|
+
const tabHeadings = common_componentUtils_utils.filterByType(children, Tab).map((item, i) => React.cloneElement(item, {
|
|
54
|
+
...item.props,
|
|
55
|
+
refCallback: (ref) => {
|
|
56
|
+
headings[i] = ref;
|
|
57
|
+
},
|
|
58
|
+
index: i,
|
|
59
|
+
parentId: id,
|
|
60
|
+
selected: selectedIndex === i,
|
|
61
|
+
focused: focusedIndex === i,
|
|
62
|
+
onClick: () => {
|
|
63
|
+
handleSelect(i);
|
|
64
|
+
setFocusedIndex(i);
|
|
65
|
+
},
|
|
66
|
+
onKeyDown: (e) => {
|
|
67
|
+
onKeyDown(e, i);
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
const tabPanels = common_componentUtils_utils.filterByType(children, TabPanel).map((item, i) => {
|
|
71
|
+
const itemProps = {
|
|
72
|
+
index: i,
|
|
73
|
+
parentId: id,
|
|
74
|
+
selected: selectedIndex === i,
|
|
75
|
+
children: item.props.children
|
|
76
|
+
};
|
|
77
|
+
return React.cloneElement(item, itemProps);
|
|
78
|
+
});
|
|
79
|
+
return React.createElement(
|
|
80
|
+
"div",
|
|
81
|
+
{ id, className: classNames(className, "tabs") },
|
|
82
|
+
React.createElement("div", { className: classNames("tabs__items", { "tabs__items--large": isLarge }), role: "tablist" }, tabHeadings),
|
|
83
|
+
React.createElement("div", { className: "tabs__content" }, tabPanels)
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
exports.EbayTab = Tab;
|
|
87
|
+
exports.EbayTabPanel = TabPanel;
|
|
88
|
+
exports.EbayTabs = Tabs;
|
package/ebay-textbox/index.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const textbox = require("../textbox-J291yCpJ.js");
|
|
4
|
+
const common_floatingLabelUtils_hooks = require("../common/floating-label-utils/hooks/index.js");
|
|
5
|
+
exports.EbayTextbox = textbox.EbayTextbox;
|
|
6
|
+
exports.EbayTextboxPostfixIcon = textbox.EbayTextboxPostfixIcon;
|
|
7
|
+
exports.EbayTextboxPostfixText = textbox.EbayTextboxPostfixText;
|
|
8
|
+
exports.EbayTextboxPrefixIcon = textbox.EbayTextboxPrefixIcon;
|
|
9
|
+
exports.EbayTextboxPrefixText = textbox.EbayTextboxPrefixText;
|
|
10
|
+
exports.useFloatingLabel = common_floatingLabelUtils_hooks.useFloatingLabel;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const classNames = require("classnames");
|
|
5
|
+
const dialogPreviousButton = require("../dialog-previous-button-EC_Y6KaT.js");
|
|
6
|
+
require("../icon-button-BQWoMgX1.js");
|
|
7
|
+
const EbayToast = ({ className, onClose = () => {
|
|
8
|
+
}, ...rest }) => React.createElement(dialogPreviousButton.DialogBaseWithState, { ...rest, isModal: false, baseEl: "aside", classPrefix: "toast-dialog", buttonPosition: "right", transitionElement: "root", className: classNames(className, "toast-dialog--transition"), onCloseBtnClick: onClose });
|
|
9
|
+
exports.EbayToast = EbayToast;
|
package/ebay-tooltip/index.js
CHANGED
|
@@ -1 +1,64 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const common_componentUtils_utils = require("../common/component-utils/utils/index.js");
|
|
5
|
+
const useTooltip = require("../use-tooltip-7JxcZHJn.js");
|
|
6
|
+
require("classnames");
|
|
7
|
+
require("../icon-B17Di3YL.js");
|
|
8
|
+
require("../array.polyfill.flat-DyxysTxZ.js");
|
|
9
|
+
const common_tooltipUtils_constants = require("../common/tooltip-utils/constants/index.js");
|
|
10
|
+
const EbayTooltipContent = () => null;
|
|
11
|
+
const EbayTooltipHost = () => null;
|
|
12
|
+
const EbayTooltip = ({ className, pointer, overlayStyle, noHover, onFocus = () => {
|
|
13
|
+
}, onBlur = () => {
|
|
14
|
+
}, onMouseEnter = () => {
|
|
15
|
+
}, onMouseLeave = () => {
|
|
16
|
+
}, onExpand, onCollapse, children, ...rest }) => {
|
|
17
|
+
const { isExpanded, expandTooltip, collapseTooltip } = useTooltip.useTooltip({ onCollapse, onExpand });
|
|
18
|
+
const timeoutRef = React.useRef();
|
|
19
|
+
const handleOnMouseEnter = (event) => {
|
|
20
|
+
onMouseEnter(event);
|
|
21
|
+
if (!noHover) {
|
|
22
|
+
clearTimeout(timeoutRef.current);
|
|
23
|
+
expandTooltip();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const handleOnMouseLeave = (event) => {
|
|
27
|
+
onMouseLeave(event);
|
|
28
|
+
if (!noHover) {
|
|
29
|
+
clearTimeout(timeoutRef.current);
|
|
30
|
+
timeoutRef.current = setTimeout(() => {
|
|
31
|
+
collapseTooltip();
|
|
32
|
+
}, 300);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const handleOnFocus = (event) => {
|
|
36
|
+
onFocus(event);
|
|
37
|
+
expandTooltip();
|
|
38
|
+
};
|
|
39
|
+
const handleOnBlur = (event) => {
|
|
40
|
+
onBlur(event);
|
|
41
|
+
collapseTooltip();
|
|
42
|
+
};
|
|
43
|
+
const content = common_componentUtils_utils.findComponent(children, EbayTooltipContent);
|
|
44
|
+
const host = common_componentUtils_utils.findComponent(children, EbayTooltipHost);
|
|
45
|
+
if (!host) {
|
|
46
|
+
throw new Error(`EbayTooltip: Please use a EbayTooltipHost that defines the host of the tooltip`);
|
|
47
|
+
}
|
|
48
|
+
if (!content) {
|
|
49
|
+
throw new Error(`EbayTooltip: Please use a EbayTooltipContent that defines the content of the tooltip`);
|
|
50
|
+
}
|
|
51
|
+
return React.createElement(
|
|
52
|
+
useTooltip.Tooltip,
|
|
53
|
+
{ ...rest, className, type: "tooltip", isExpanded, onFocus: handleOnFocus, onBlur: handleOnBlur, onMouseEnter: handleOnMouseEnter, onMouseLeave: handleOnMouseLeave },
|
|
54
|
+
React.createElement(useTooltip.TooltipHost, { ...host.props }),
|
|
55
|
+
React.createElement(useTooltip.TooltipContent, { ...content.props, type: "tooltip", style: overlayStyle, pointer })
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
exports.Tooltip = useTooltip.Tooltip;
|
|
59
|
+
exports.TooltipFooter = useTooltip.TooltipFooter;
|
|
60
|
+
exports.DEFAULT_POINTER_DIRECTION = common_tooltipUtils_constants.DEFAULT_POINTER_DIRECTION;
|
|
61
|
+
exports.POINTER_STYLES = common_tooltipUtils_constants.POINTER_STYLES;
|
|
62
|
+
exports.EbayTooltip = EbayTooltip;
|
|
63
|
+
exports.EbayTooltipContent = EbayTooltipContent;
|
|
64
|
+
exports.EbayTooltipHost = EbayTooltipHost;
|
package/ebay-tourtip/index.js
CHANGED
|
@@ -1 +1,54 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const common_componentUtils_utils = require("../common/component-utils/utils/index.js");
|
|
5
|
+
const useTooltip = require("../use-tooltip-7JxcZHJn.js");
|
|
6
|
+
const classNames = require("classnames");
|
|
7
|
+
require("../icon-B17Di3YL.js");
|
|
8
|
+
require("../array.polyfill.flat-DyxysTxZ.js");
|
|
9
|
+
const EbayTourtipContent = () => null;
|
|
10
|
+
const EbayTourtipHost = () => null;
|
|
11
|
+
const EbayTourtipFooter = ({ index, children }) => React.createElement(
|
|
12
|
+
React.Fragment,
|
|
13
|
+
null,
|
|
14
|
+
index !== void 0 && React.createElement("span", { className: "tourtip__index" }, index),
|
|
15
|
+
children
|
|
16
|
+
);
|
|
17
|
+
const EbayTourtipHeading = ({ as, children, className, ...props }) => {
|
|
18
|
+
const HeadingTag = as || "h2";
|
|
19
|
+
return React.createElement(HeadingTag, { ...props, className: classNames(`tourtip__heading`, className) }, children);
|
|
20
|
+
};
|
|
21
|
+
const EbayTourtip = ({ a11yCloseText, "aria-label": ariaLabel, className, children, onCollapse, onExpand, overlayStyle, pointer, ...rest }) => {
|
|
22
|
+
const hostRef = React.useRef();
|
|
23
|
+
const { isExpanded, collapseTooltip } = useTooltip.useTooltip({ onExpand, onCollapse, initialExpanded: true, hostRef });
|
|
24
|
+
const containerRef = React.useRef();
|
|
25
|
+
const content = common_componentUtils_utils.findComponent(children, EbayTourtipContent);
|
|
26
|
+
if (!content) {
|
|
27
|
+
throw new Error(`EbayTourtip: Please use a EbayTourtipContent that defines the content of the tourtip`);
|
|
28
|
+
}
|
|
29
|
+
const { children: contentChildren, contentProps } = content.props;
|
|
30
|
+
const host = common_componentUtils_utils.findComponent(children, EbayTourtipHost);
|
|
31
|
+
if (!host) {
|
|
32
|
+
throw new Error(`EbayTourtip: Please use a EbayTourtipHost that defines the host of the tourtip`);
|
|
33
|
+
}
|
|
34
|
+
const heading = common_componentUtils_utils.findComponent(children, EbayTourtipHeading);
|
|
35
|
+
const footer = common_componentUtils_utils.findComponent(children, EbayTourtipFooter);
|
|
36
|
+
return React.createElement(
|
|
37
|
+
useTooltip.Tooltip,
|
|
38
|
+
{ ...rest, className, type: "tourtip", isExpanded, ref: containerRef },
|
|
39
|
+
React.createElement(useTooltip.TooltipHost, { ...host.props, forwardedRef: hostRef, "aria-label": ariaLabel, "aria-expanded": isExpanded }),
|
|
40
|
+
React.createElement(
|
|
41
|
+
useTooltip.TooltipContent,
|
|
42
|
+
{ ...contentProps, a11yCloseText, onClose: collapseTooltip, pointer, showCloseButton: true, style: overlayStyle, type: "tourtip" },
|
|
43
|
+
heading,
|
|
44
|
+
contentChildren,
|
|
45
|
+
footer && React.createElement(useTooltip.TooltipFooter, { type: "tourtip" }, footer)
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
exports.Tooltip = useTooltip.Tooltip;
|
|
50
|
+
exports.EbayTourtip = EbayTourtip;
|
|
51
|
+
exports.EbayTourtipContent = EbayTourtipContent;
|
|
52
|
+
exports.EbayTourtipFooter = EbayTourtipFooter;
|
|
53
|
+
exports.EbayTourtipHeading = EbayTourtipHeading;
|
|
54
|
+
exports.EbayTourtipHost = EbayTourtipHost;
|
package/ebay-video/index.js
CHANGED
|
@@ -1 +1,229 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
|
+
const React = require("react");
|
|
7
|
+
const classNames = require("classnames");
|
|
8
|
+
const shaka = require("shaka-player/dist/shaka-player.ui");
|
|
9
|
+
const common_componentUtils_utils = require("../common/component-utils/utils/index.js");
|
|
10
|
+
const icon = require("../icon-B17Di3YL.js");
|
|
11
|
+
const progressSpinner = require("../progress-spinner-DOFKRtuu.js");
|
|
12
|
+
const client = require("react-dom/client");
|
|
13
|
+
const EbayVideoSource = ({ ...rest }) => React.createElement("source", { ...rest });
|
|
14
|
+
const ERROR_ANOTHER_LOAD = 7e3;
|
|
15
|
+
const ERROR_NO_PLAYER = 11;
|
|
16
|
+
const defaultVideoConfig = {
|
|
17
|
+
addBigPlayButton: false,
|
|
18
|
+
addSeekBar: true,
|
|
19
|
+
controlPanelElements: [
|
|
20
|
+
"play_pause",
|
|
21
|
+
"time_and_duration",
|
|
22
|
+
"spacer",
|
|
23
|
+
"mute",
|
|
24
|
+
"report",
|
|
25
|
+
"captions",
|
|
26
|
+
// 'quality', // uncomment this to show a gear icon for video quality control
|
|
27
|
+
"fullscreen"
|
|
28
|
+
]
|
|
29
|
+
};
|
|
30
|
+
const ReportButton = ({ callback, children }) => React.createElement(
|
|
31
|
+
"button",
|
|
32
|
+
{ className: "video-player__report-button", ref: callback },
|
|
33
|
+
React.createElement(icon.EbayIcon, { name: "flag24" }),
|
|
34
|
+
children
|
|
35
|
+
);
|
|
36
|
+
function customControls(onReport = () => {
|
|
37
|
+
}) {
|
|
38
|
+
const Report = class extends shaka.ui.Element {
|
|
39
|
+
constructor(parent, controls, text) {
|
|
40
|
+
super(parent, controls);
|
|
41
|
+
const tempEl = document.createElement("div");
|
|
42
|
+
const buttonCallback = () => {
|
|
43
|
+
const reportButton = tempEl.firstChild;
|
|
44
|
+
parent.appendChild(reportButton);
|
|
45
|
+
tempEl.remove();
|
|
46
|
+
this.eventManager.listen(reportButton, "click", onReport);
|
|
47
|
+
};
|
|
48
|
+
client.createRoot(tempEl).render(React.createElement(ReportButton, { callback: buttonCallback }, text));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
Report.Factory = class {
|
|
52
|
+
constructor(reportText) {
|
|
53
|
+
__publicField(this, "reportText");
|
|
54
|
+
this.reportText = reportText;
|
|
55
|
+
}
|
|
56
|
+
create(rootElement, controls) {
|
|
57
|
+
return new Report(rootElement, controls, this.reportText);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return { Report };
|
|
61
|
+
}
|
|
62
|
+
const EbayVideo = ({ width, height, thumbnail, action, muted, playView = "inline", a11yLoadText, a11yPlayText, reportText, volumeSlider, volume = 1, hideReportButton, errorText, onVolumeChange = () => {
|
|
63
|
+
}, onLoadError = () => {
|
|
64
|
+
}, onPlay = () => {
|
|
65
|
+
}, onReport = () => {
|
|
66
|
+
}, children, ...rest }) => {
|
|
67
|
+
const [loaded, setLoaded] = React.useState();
|
|
68
|
+
const [buffering, setBuffering] = React.useState();
|
|
69
|
+
const [playing, setPlaying] = React.useState();
|
|
70
|
+
const [failed, setFailed] = React.useState();
|
|
71
|
+
const containerRef = React.useRef(null);
|
|
72
|
+
const videoRef = React.useRef(null);
|
|
73
|
+
const playerRef = React.useRef(null);
|
|
74
|
+
const uiRef = React.useRef(null);
|
|
75
|
+
const sources = common_componentUtils_utils.filterByType(children, EbayVideoSource).map(({ props }) => props);
|
|
76
|
+
const handleError = (err) => {
|
|
77
|
+
setLoaded(true);
|
|
78
|
+
setFailed(true);
|
|
79
|
+
onLoadError(err);
|
|
80
|
+
};
|
|
81
|
+
const loadSource = (index = 0) => {
|
|
82
|
+
var _a;
|
|
83
|
+
if (!sources.length || !playerRef.current)
|
|
84
|
+
return;
|
|
85
|
+
setLoaded(false);
|
|
86
|
+
playerRef.current.load((_a = sources[index]) == null ? void 0 : _a.src).then(() => {
|
|
87
|
+
setFailed(false);
|
|
88
|
+
}).catch((err) => {
|
|
89
|
+
console.error(err);
|
|
90
|
+
switch (err.code) {
|
|
91
|
+
case ERROR_ANOTHER_LOAD:
|
|
92
|
+
return;
|
|
93
|
+
case ERROR_NO_PLAYER:
|
|
94
|
+
setTimeout(() => loadSource(index), 0);
|
|
95
|
+
break;
|
|
96
|
+
default: {
|
|
97
|
+
const nextIndex = sources.length > index + 1 && index + 1;
|
|
98
|
+
if (nextIndex) {
|
|
99
|
+
setTimeout(() => loadSource(nextIndex), 0);
|
|
100
|
+
} else {
|
|
101
|
+
handleError(err);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}).finally(() => {
|
|
106
|
+
setLoaded(true);
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
React.useEffect(() => {
|
|
110
|
+
const video = videoRef.current;
|
|
111
|
+
const container = containerRef.current;
|
|
112
|
+
if (!video || !container)
|
|
113
|
+
return;
|
|
114
|
+
video.volume = volume;
|
|
115
|
+
shaka.polyfill.installAll();
|
|
116
|
+
playerRef.current = new shaka.Player(video);
|
|
117
|
+
if (!playerRef.current)
|
|
118
|
+
return;
|
|
119
|
+
playerRef.current.addEventListener("error", handleError);
|
|
120
|
+
playerRef.current.addEventListener("buffering", (e) => {
|
|
121
|
+
setBuffering(e.buffering);
|
|
122
|
+
});
|
|
123
|
+
uiRef.current = new shaka.ui.Overlay(playerRef.current, container, video, reportText);
|
|
124
|
+
uiRef.current.configure({
|
|
125
|
+
addBigPlayButton: true,
|
|
126
|
+
controlPanelElements: [],
|
|
127
|
+
addSeekBar: false
|
|
128
|
+
});
|
|
129
|
+
if (!hideReportButton) {
|
|
130
|
+
const { Report } = customControls(onReport);
|
|
131
|
+
shaka.ui.Controls.registerElement("report", new Report.Factory(reportText));
|
|
132
|
+
}
|
|
133
|
+
loadSource();
|
|
134
|
+
hideSpinner(container);
|
|
135
|
+
}, []);
|
|
136
|
+
React.useEffect(() => {
|
|
137
|
+
switch (action) {
|
|
138
|
+
case "play":
|
|
139
|
+
videoRef.current.play();
|
|
140
|
+
break;
|
|
141
|
+
case "pause":
|
|
142
|
+
videoRef.current.pause();
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}, [action]);
|
|
146
|
+
const showControls = () => {
|
|
147
|
+
if (!uiRef.current)
|
|
148
|
+
return;
|
|
149
|
+
const updatedControls = volumeSlider ? {
|
|
150
|
+
controlPanelElements: withVolumeControl(defaultVideoConfig.controlPanelElements)
|
|
151
|
+
} : {};
|
|
152
|
+
uiRef.current.configure({
|
|
153
|
+
...defaultVideoConfig,
|
|
154
|
+
...updatedControls
|
|
155
|
+
});
|
|
156
|
+
videoRef.current.controls = false;
|
|
157
|
+
};
|
|
158
|
+
const handlePlaying = (e) => {
|
|
159
|
+
e.stopPropagation();
|
|
160
|
+
showControls();
|
|
161
|
+
if (playView === "fullscreen") {
|
|
162
|
+
videoRef.current.requestFullscreen();
|
|
163
|
+
}
|
|
164
|
+
setPlaying(true);
|
|
165
|
+
onPlay(e, { player: playerRef.current });
|
|
166
|
+
};
|
|
167
|
+
const handleOnPlayClick = () => {
|
|
168
|
+
videoRef.current.play();
|
|
169
|
+
};
|
|
170
|
+
const handleVolumeChange = (e) => {
|
|
171
|
+
const eventTarget = e.currentTarget;
|
|
172
|
+
onVolumeChange(e, {
|
|
173
|
+
volume: Math.round((eventTarget.volume + Number.EPSILON) * 100) / 100,
|
|
174
|
+
muted: eventTarget.muted
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
const handleOnPause = () => {
|
|
178
|
+
videoRef.current.controls = false;
|
|
179
|
+
};
|
|
180
|
+
const style = {
|
|
181
|
+
width: width ? `${width}px` : void 0,
|
|
182
|
+
height: height ? `${height}px` : void 0
|
|
183
|
+
};
|
|
184
|
+
return React.createElement(
|
|
185
|
+
"div",
|
|
186
|
+
{ style, className: classNames("video-player", { "video-player--poster": !playing }) },
|
|
187
|
+
!playing && loaded && !failed && !buffering && React.createElement(
|
|
188
|
+
"div",
|
|
189
|
+
{ className: "shaka-play-button-container" },
|
|
190
|
+
React.createElement(
|
|
191
|
+
"button",
|
|
192
|
+
{ onClick: handleOnPlayClick, className: "shaka-play-button", style: { opacity: 1, zIndex: 999 }, "aria-label": a11yPlayText },
|
|
193
|
+
React.createElement(icon.EbayIcon, { name: "playFilled64Colored" })
|
|
194
|
+
)
|
|
195
|
+
),
|
|
196
|
+
React.createElement(
|
|
197
|
+
"div",
|
|
198
|
+
{ className: "video-player__container", ref: containerRef },
|
|
199
|
+
React.createElement("video", { ref: videoRef, style, poster: thumbnail, muted: muted || false, onPlaying: handlePlaying, onPause: handleOnPause, onVolumeChange: handleVolumeChange, ...rest }, sources.map((source, i) => React.createElement("source", { key: i, ...source })))
|
|
200
|
+
),
|
|
201
|
+
React.createElement(
|
|
202
|
+
"div",
|
|
203
|
+
{ className: classNames("video-player__overlay", { "video-player__overlay--hidden": !failed }) },
|
|
204
|
+
React.createElement(icon.EbayIcon, { name: "attention64" }),
|
|
205
|
+
React.createElement("div", { className: "video-player__overlay-text" }, errorText)
|
|
206
|
+
),
|
|
207
|
+
React.createElement(
|
|
208
|
+
"div",
|
|
209
|
+
{ className: classNames("video-player__overlay", {
|
|
210
|
+
"video-player__overlay--hidden": loaded && (failed || !buffering)
|
|
211
|
+
}) },
|
|
212
|
+
React.createElement(progressSpinner.EbayProgressSpinner, { size: "large", "aria-label": a11yLoadText })
|
|
213
|
+
)
|
|
214
|
+
);
|
|
215
|
+
};
|
|
216
|
+
function withVolumeControl(controls) {
|
|
217
|
+
const insertAt = controls.length - 2 > 0 ? controls.length - 2 : controls.length;
|
|
218
|
+
const controlsWithVolume = [...controls];
|
|
219
|
+
controlsWithVolume.splice(insertAt, 0, "volume");
|
|
220
|
+
return controlsWithVolume;
|
|
221
|
+
}
|
|
222
|
+
function hideSpinner(container) {
|
|
223
|
+
const shakaSpinner = container.querySelectorAll(".shaka-spinner")[0];
|
|
224
|
+
if (shakaSpinner) {
|
|
225
|
+
shakaSpinner.setAttribute("hidden", "");
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
exports.EbayVideo = EbayVideo;
|
|
229
|
+
exports.EbayVideoSource = EbayVideoSource;
|
package/events/index.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const common_eventUtils = require("../common/event-utils/index.js");
|
|
4
|
+
const useRovingIndex = require("../use-roving-index-CEM_UsCH.js");
|
|
5
|
+
exports.addEventListener = common_eventUtils.addEventListener;
|
|
6
|
+
exports.handleActionKeydown = common_eventUtils.handleActionKeydown;
|
|
7
|
+
exports.handleEnterKeydown = common_eventUtils.handleEnterKeydown;
|
|
8
|
+
exports.handleEscapeKeydown = common_eventUtils.handleEscapeKeydown;
|
|
9
|
+
exports.handleLeftRightArrowsKeydown = common_eventUtils.handleLeftRightArrowsKeydown;
|
|
10
|
+
exports.handleResize = common_eventUtils.handleResize;
|
|
11
|
+
exports.handleTextInput = common_eventUtils.handleTextInput;
|
|
12
|
+
exports.handleUpDownArrowsKeydown = common_eventUtils.handleUpDownArrowsKeydown;
|
|
13
|
+
exports.isActionKey = common_eventUtils.isActionKey;
|
|
14
|
+
exports.preventDefaultIfHijax = common_eventUtils.preventDefaultIfHijax;
|
|
15
|
+
exports.removeEventListener = common_eventUtils.removeEventListener;
|
|
16
|
+
exports.wrapEvent = common_eventUtils.wrapEvent;
|
|
17
|
+
exports.useKeyPress = useRovingIndex.useKeyPress;
|
|
18
|
+
exports.useRovingIndex = useRovingIndex.useRovingIndex;
|
package/icon-B17Di3YL.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const React = require("react");
|
|
3
|
+
const classNames = require("classnames");
|
|
4
|
+
const common_componentUtils_forwardRef = require("./common/component-utils/forwardRef/index.js");
|
|
5
|
+
require("./array.polyfill.flat-DyxysTxZ.js");
|
|
6
|
+
const common_randomId = require("./common/random-id/index.js");
|
|
7
|
+
const EbayIcon = ({ name, className: extraClass, noSkinClasses = false, a11yText, a11yVariant, forwardedRef, ...rest }) => {
|
|
8
|
+
const [rId, setRandomId] = React.useState("");
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
setRandomId(common_randomId.randomId());
|
|
11
|
+
}, []);
|
|
12
|
+
const withAriaLabel = a11yVariant === "label";
|
|
13
|
+
const a11yTextId = a11yText && `icon-title-${rId}`;
|
|
14
|
+
const a11yProps = a11yText ? {
|
|
15
|
+
"aria-labelledby": withAriaLabel ? void 0 : a11yTextId,
|
|
16
|
+
"aria-label": withAriaLabel ? a11yText : void 0,
|
|
17
|
+
role: "img"
|
|
18
|
+
} : {
|
|
19
|
+
"aria-hidden": true
|
|
20
|
+
};
|
|
21
|
+
const kebabName = kebabCased(name);
|
|
22
|
+
const size = getIconSize(kebabName) || kebabName;
|
|
23
|
+
const skinClassName = [`icon`, `icon--${size}`, getFilledIconName(kebabName)].filter(Boolean).join(" ");
|
|
24
|
+
const className = classNames(extraClass, { [skinClassName]: !noSkinClasses });
|
|
25
|
+
return React.createElement(
|
|
26
|
+
"svg",
|
|
27
|
+
{ ...rest, className, xmlns: "http://www.w3.org/2000/svg", focusable: false, ref: forwardedRef, ...a11yProps },
|
|
28
|
+
a11yText && !withAriaLabel && React.createElement("title", { id: a11yTextId }, a11yText),
|
|
29
|
+
React.createElement("use", { xlinkHref: `#icon-${kebabName}` })
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
function getIconSize(iconName) {
|
|
33
|
+
const iconNameArray = iconName.split("-");
|
|
34
|
+
const size = iconNameArray[iconNameArray.length - 1];
|
|
35
|
+
if (size === "colored") {
|
|
36
|
+
return iconNameArray[iconNameArray.length - 2];
|
|
37
|
+
}
|
|
38
|
+
if (isNaN(Number(size))) {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
return size;
|
|
42
|
+
}
|
|
43
|
+
function getFilledIconName(iconName) {
|
|
44
|
+
const iconNameArray = iconName.split("-");
|
|
45
|
+
const filledIndex = iconNameArray.indexOf("filled");
|
|
46
|
+
if (filledIndex === -1) {
|
|
47
|
+
return "";
|
|
48
|
+
}
|
|
49
|
+
return `icon--${iconNameArray.slice(0, filledIndex + 1).join("-")}`;
|
|
50
|
+
}
|
|
51
|
+
function kebabCased(str) {
|
|
52
|
+
return str.replace(/([0-9]+)/g, (s, n) => `-${n}`).replace(/([A-Z])/g, (s, c) => `-${c.toLowerCase()}`);
|
|
53
|
+
}
|
|
54
|
+
const EbayIcon$1 = common_componentUtils_forwardRef.withForwardRef(EbayIcon);
|
|
55
|
+
exports.EbayIcon = EbayIcon$1;
|
|
56
|
+
exports.kebabCased = kebabCased;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const React = require("react");
|
|
3
|
+
const classNames = require("classnames");
|
|
4
|
+
const icon = require("./icon-B17Di3YL.js");
|
|
5
|
+
const badge = require("./badge-CR5t7-2L.js");
|
|
6
|
+
const common_componentUtils_forwardRef = require("./common/component-utils/forwardRef/index.js");
|
|
7
|
+
require("./array.polyfill.flat-DyxysTxZ.js");
|
|
8
|
+
const EbayIconButton = ({ href, icon: icon$1, badgeNumber, badgeAriaLabel, transparent, className: extraClasses, forwardedRef, size, onEscape = () => {
|
|
9
|
+
}, onKeyDown = () => {
|
|
10
|
+
}, ...rest }) => {
|
|
11
|
+
const classPrefix = href ? "icon-link" : "icon-btn";
|
|
12
|
+
const className = classNames(extraClasses, classPrefix, size && `${classPrefix}--${size}`, {
|
|
13
|
+
[`${classPrefix}--badged`]: badgeNumber,
|
|
14
|
+
[`${classPrefix}--transparent`]: transparent
|
|
15
|
+
});
|
|
16
|
+
const children = React.createElement(
|
|
17
|
+
React.Fragment,
|
|
18
|
+
null,
|
|
19
|
+
React.createElement(icon.EbayIcon, { name: icon$1 }),
|
|
20
|
+
badgeNumber && React.createElement(badge.EbayBadge, { type: "icon", number: badgeNumber, "aria-label": badgeAriaLabel })
|
|
21
|
+
);
|
|
22
|
+
const keyDownHandler = (e) => {
|
|
23
|
+
if (e.key === "Escape" || e.key === "Esc") {
|
|
24
|
+
onEscape(e);
|
|
25
|
+
}
|
|
26
|
+
onKeyDown(e);
|
|
27
|
+
};
|
|
28
|
+
return href ? React.createElement("a", { ref: forwardedRef, className, href, onKeyDown: keyDownHandler, ...rest }, children) : React.createElement("button", { ref: forwardedRef, type: "button", className, onKeyDown: keyDownHandler, ...rest }, children);
|
|
29
|
+
};
|
|
30
|
+
const EbayIconButton$1 = common_componentUtils_forwardRef.withForwardRef(EbayIconButton);
|
|
31
|
+
exports.EbayIconButton = EbayIconButton$1;
|