@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
|
@@ -1 +1,12 @@
|
|
|
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 classPrefix = "panel-dialog";
|
|
8
|
+
const EbayPanelDialog = ({ open, animated, position = "start", onClose = () => {
|
|
9
|
+
}, className, ...rest }) => React.createElement(dialogPreviousButton.DialogBaseWithState, { ...rest, "aria-label": "Infotip", classPrefix, buttonPosition: "right", onCloseBtnClick: onClose, onBackgroundClick: onClose, animated, className: classNames(className, { [`${classPrefix}--mask-fade-slow`]: animated }), windowClass: classNames(`${classPrefix}__window--slide`, {
|
|
10
|
+
[`${classPrefix}__window--end`]: position === "end"
|
|
11
|
+
}), open });
|
|
12
|
+
exports.EbayPanelDialog = EbayPanelDialog;
|
|
@@ -1 +1,6 @@
|
|
|
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 EbayProgressBar = ({ value = 0, max = 100, fluid, className, ...rest }) => React.createElement("progress", { ...rest, className: classNames("progress-bar", className, { "progress-bar--fluid": fluid }), value, max });
|
|
6
|
+
exports.EbayProgressBar = EbayProgressBar;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const progressSpinner = require("../progress-spinner-DOFKRtuu.js");
|
|
4
|
+
exports.EbayProgressSpinner = progressSpinner.EbayProgressSpinner;
|
|
@@ -1 +1,72 @@
|
|
|
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 icon = require("../icon-B17Di3YL.js");
|
|
6
|
+
const EbayProgressStepper = ({ direction = "row", defaultState = "active", children, className, ...rest }) => {
|
|
7
|
+
const childrenArray = React.Children.toArray(children);
|
|
8
|
+
const currentIndex = currentIndexByDefaultState(childrenArray, defaultState);
|
|
9
|
+
return React.createElement(
|
|
10
|
+
"div",
|
|
11
|
+
{ ...rest, className: classNames(className, "progress-stepper", {
|
|
12
|
+
"progress-stepper--vertical": direction === "column"
|
|
13
|
+
}) },
|
|
14
|
+
React.createElement("div", { role: "list", className: "progress-stepper__items" }, childrenArray.map((child, index) => React.createElement(
|
|
15
|
+
React.Fragment,
|
|
16
|
+
{ key: index },
|
|
17
|
+
index > 0 && React.createElement("hr", { className: "progress-stepper__separator", role: "presentation" }),
|
|
18
|
+
React.cloneElement(child, {
|
|
19
|
+
state: stepState(index, currentIndex),
|
|
20
|
+
...child.props,
|
|
21
|
+
current: currentIndex === index
|
|
22
|
+
})
|
|
23
|
+
)))
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
function currentIndexByDefaultState(steps, defaultState) {
|
|
27
|
+
const foundCurrentIndex = steps.findIndex((child) => child.props.current);
|
|
28
|
+
if (foundCurrentIndex === -1) {
|
|
29
|
+
switch (defaultState) {
|
|
30
|
+
case "complete":
|
|
31
|
+
return steps.length - 1;
|
|
32
|
+
case "upcoming":
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return foundCurrentIndex;
|
|
37
|
+
}
|
|
38
|
+
function stepState(stepIndex, currentIndex) {
|
|
39
|
+
if (stepIndex <= currentIndex)
|
|
40
|
+
return "complete";
|
|
41
|
+
if (stepIndex > currentIndex)
|
|
42
|
+
return "upcoming";
|
|
43
|
+
}
|
|
44
|
+
const typeIcons = {
|
|
45
|
+
complete: "stepperConfirmation24",
|
|
46
|
+
attention: "stepperAttention24",
|
|
47
|
+
upcoming: "stepperUpcoming24",
|
|
48
|
+
active: "stepperConfirmation24"
|
|
49
|
+
};
|
|
50
|
+
const EbayProgressStep = ({ current, state = "complete", children, className, ...rest }) => {
|
|
51
|
+
const childrenArray = React.Children.toArray(children);
|
|
52
|
+
const title = childrenArray.find((child) => child.type === EbayProgressTitle);
|
|
53
|
+
const text = childrenArray.filter((child) => child.type !== EbayProgressTitle);
|
|
54
|
+
const stepClassNames = classNames(className, "progress-stepper__item", { "progress-stepper__item--attention": state === "attention" });
|
|
55
|
+
const icon$1 = typeIcons[state];
|
|
56
|
+
const ariaLabel = current ? "current" : state;
|
|
57
|
+
return React.createElement(
|
|
58
|
+
"div",
|
|
59
|
+
{ ...rest, className: stepClassNames, role: "listitem", "aria-current": current ? "step" : void 0 },
|
|
60
|
+
React.createElement("div", { className: "progress-stepper__icon" }, icon$1 && React.createElement(icon.EbayIcon, { name: icon$1, "aria-label": ariaLabel })),
|
|
61
|
+
React.createElement(
|
|
62
|
+
"div",
|
|
63
|
+
{ className: "progress-stepper__text" },
|
|
64
|
+
title,
|
|
65
|
+
text
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
const EbayProgressTitle = ({ as: TitleComponent = "h4", children }) => React.createElement(TitleComponent, {}, children);
|
|
70
|
+
exports.EbayProgressStep = EbayProgressStep;
|
|
71
|
+
exports.EbayProgressStepper = EbayProgressStepper;
|
|
72
|
+
exports.EbayProgressTitle = EbayProgressTitle;
|
package/ebay-radio/index.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const ebayRadio_radio = require("./radio/index.js");
|
|
4
|
+
exports.EbayRadio = ebayRadio_radio;
|
|
@@ -1 +1,48 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
const React = require("react");
|
|
3
|
+
const classNames = require("classnames");
|
|
4
|
+
const icon = require("../../icon-B17Di3YL.js");
|
|
5
|
+
const label = require("../../label-C0AS4fnO.js");
|
|
6
|
+
const EbayRadio = ({ size = "default", checked, defaultChecked, className, style, id, onChange = () => {
|
|
7
|
+
}, onFocus = () => {
|
|
8
|
+
}, onKeyDown = () => {
|
|
9
|
+
}, children, ...rest }) => {
|
|
10
|
+
const handleChange = (e) => {
|
|
11
|
+
var _a;
|
|
12
|
+
return onChange(e, { value: (_a = e.target) == null ? void 0 : _a.value });
|
|
13
|
+
};
|
|
14
|
+
const handleFocus = (e) => {
|
|
15
|
+
var _a;
|
|
16
|
+
return onFocus(e, { value: (_a = e.target) == null ? void 0 : _a.value });
|
|
17
|
+
};
|
|
18
|
+
const handleKeyDown = (e) => {
|
|
19
|
+
const radioButton = e.target;
|
|
20
|
+
return onKeyDown(e, { value: radioButton == null ? void 0 : radioButton.value });
|
|
21
|
+
};
|
|
22
|
+
const containerClass = classNames("radio", className, { "radio--large": size === "large" });
|
|
23
|
+
const iconChecked = size === "large" ? React.createElement(icon.EbayIcon, { name: "radioChecked24", className: "radio__checked" }) : React.createElement(icon.EbayIcon, { name: "radioChecked18", className: "radio__checked" });
|
|
24
|
+
const iconUnChecked = size === "large" ? React.createElement(icon.EbayIcon, { name: "radioUnchecked24", className: "radio__unchecked" }) : React.createElement(icon.EbayIcon, { name: "radioUnchecked18", className: "radio__unchecked" });
|
|
25
|
+
const childrenArray = React.Children.toArray(children);
|
|
26
|
+
const ebayLabel = childrenArray.find((child) => child.type === label.Label);
|
|
27
|
+
return React.createElement(
|
|
28
|
+
React.Fragment,
|
|
29
|
+
null,
|
|
30
|
+
React.createElement(
|
|
31
|
+
"span",
|
|
32
|
+
{ className: containerClass, style: { ...style, alignItems: "center" } },
|
|
33
|
+
React.createElement("input", { ...rest, id, className: "radio__control", type: "radio", defaultChecked, checked, onChange: handleChange, onFocus: handleFocus, onKeyDown: handleKeyDown }),
|
|
34
|
+
React.createElement(
|
|
35
|
+
"span",
|
|
36
|
+
{ className: "radio__icon", hidden: true },
|
|
37
|
+
iconChecked,
|
|
38
|
+
iconUnChecked
|
|
39
|
+
)
|
|
40
|
+
),
|
|
41
|
+
ebayLabel ? React.cloneElement(ebayLabel, {
|
|
42
|
+
...ebayLabel.props,
|
|
43
|
+
position: "end",
|
|
44
|
+
htmlFor: id
|
|
45
|
+
}) : children
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
module.exports = EbayRadio;
|
|
@@ -1 +1,69 @@
|
|
|
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 noticeContent = require("../notice-content-BhUeK1pd.js");
|
|
6
|
+
const noticeContent$1 = require("../notice-content-BTXVxttv.js");
|
|
7
|
+
const icon = require("../icon-B17Di3YL.js");
|
|
8
|
+
const common_randomId = require("../common/random-id/index.js");
|
|
9
|
+
const noticeFooter = require("../notice-footer-CIQ8SM6N.js");
|
|
10
|
+
const common_noticeUtils_noticeCta = require("../common/notice-utils/notice-cta/index.js");
|
|
11
|
+
const EbaySectionNotice = ({ status = "general", children, className, "aria-label": ariaLabel, "aria-roledescription": ariaRoleDescription = "Notice", a11yDismissText, educationIcon, iconClass, prominent, onDismiss = () => {
|
|
12
|
+
}, ...rest }) => {
|
|
13
|
+
const [dismissed, setDismissed] = React.useState(false);
|
|
14
|
+
const [rId, setRandomId] = React.useState("");
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
setRandomId(common_randomId.randomId());
|
|
17
|
+
}, []);
|
|
18
|
+
const childrenArray = React.Children.toArray(children);
|
|
19
|
+
const content = childrenArray.find(({ type }) => type === noticeContent.EbayNoticeContent);
|
|
20
|
+
const hasStatus = status !== "general" && status !== "none";
|
|
21
|
+
const isEducational = status === "education";
|
|
22
|
+
let iconName = null;
|
|
23
|
+
if (hasStatus) {
|
|
24
|
+
if (isEducational) {
|
|
25
|
+
iconName = educationIcon || "lightbulb24";
|
|
26
|
+
} else {
|
|
27
|
+
iconName = `${status}Filled16`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (!content) {
|
|
31
|
+
throw new Error(`EbaySectionNotice: Please use a EbayNoticeContent that defines the content of the notice`);
|
|
32
|
+
}
|
|
33
|
+
const handleDismissed = (event) => {
|
|
34
|
+
setDismissed(true);
|
|
35
|
+
onDismiss(event);
|
|
36
|
+
};
|
|
37
|
+
return dismissed ? null : React.createElement(
|
|
38
|
+
"section",
|
|
39
|
+
{ ...rest, className: classNames(className, `section-notice`, {
|
|
40
|
+
[`section-notice--${status}`]: hasStatus,
|
|
41
|
+
"section-notice--education": isEducational && prominent,
|
|
42
|
+
"section-notice--large-icon": isEducational
|
|
43
|
+
}), role: "region", "aria-label": !hasStatus ? ariaLabel : null, "aria-labelledby": hasStatus ? `section-notice-${status}-${rId}` : null, "aria-roledescription": ariaRoleDescription },
|
|
44
|
+
iconName && React.createElement(
|
|
45
|
+
"div",
|
|
46
|
+
{ className: "section-notice__header", id: `section-notice-${status}-${rId}` },
|
|
47
|
+
React.createElement(icon.EbayIcon, { className: iconClass, name: iconName, a11yText: ariaLabel, a11yVariant: "label" })
|
|
48
|
+
),
|
|
49
|
+
React.createElement(noticeContent$1.NoticeContent, { ...content.props, type: "section" }),
|
|
50
|
+
children,
|
|
51
|
+
a11yDismissText && React.createElement(
|
|
52
|
+
EbaySectionNoticeFooter,
|
|
53
|
+
null,
|
|
54
|
+
React.createElement(
|
|
55
|
+
"button",
|
|
56
|
+
{ "aria-label": a11yDismissText, className: "fake-link page-notice__dismiss", onClick: handleDismissed },
|
|
57
|
+
React.createElement(icon.EbayIcon, { name: "close16" })
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
const EbaySectionNoticeTitle = ({ className, as, children, ...rest }) => React.createElement(noticeFooter.NoticeTitle, { ...rest, className, as, type: "section" }, children);
|
|
63
|
+
const EbaySectionNoticeFooter = ({ className, children }) => React.createElement(noticeFooter.NoticeFooter, { className, type: "section" }, children);
|
|
64
|
+
const EbaySectionNoticeCTA = ({ className, children }) => React.createElement(common_noticeUtils_noticeCta, { className, type: "section" }, children);
|
|
65
|
+
exports.EbayNoticeContent = noticeContent.EbayNoticeContent;
|
|
66
|
+
exports.EbaySectionNotice = EbaySectionNotice;
|
|
67
|
+
exports.EbaySectionNoticeCTA = EbaySectionNoticeCTA;
|
|
68
|
+
exports.EbaySectionNoticeFooter = EbaySectionNoticeFooter;
|
|
69
|
+
exports.EbaySectionNoticeTitle = EbaySectionNoticeTitle;
|
|
@@ -1 +1,38 @@
|
|
|
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_componentUtils_utils = require("../common/component-utils/utils/index.js");
|
|
6
|
+
const Cta = ({ ctaText, href, className, ...rest }) => {
|
|
7
|
+
if (!ctaText) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return React.createElement("a", { ...rest, className: classNames("section-title__cta", className), href }, ctaText);
|
|
11
|
+
};
|
|
12
|
+
const EbaySectionTitle = ({ href, ctaText, className, children, ...rest }) => {
|
|
13
|
+
const sectionTitleClass = classNames(className, "section-title");
|
|
14
|
+
const title = common_componentUtils_utils.findComponent(children, Title);
|
|
15
|
+
const subtitle = common_componentUtils_utils.findComponent(children, Subtitle);
|
|
16
|
+
const info = common_componentUtils_utils.findComponent(children, Info);
|
|
17
|
+
const overflow = common_componentUtils_utils.findComponent(children, Overflow);
|
|
18
|
+
return React.createElement(
|
|
19
|
+
"div",
|
|
20
|
+
{ ...rest, className: sectionTitleClass },
|
|
21
|
+
React.createElement(
|
|
22
|
+
"div",
|
|
23
|
+
{ className: "section-title__title-container" },
|
|
24
|
+
title || React.createElement(Title, null, children),
|
|
25
|
+
subtitle
|
|
26
|
+
),
|
|
27
|
+
href && React.createElement(Cta, { href, ctaText }) || info || overflow
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
const Title = ({ children, className, ...rest }) => React.createElement("h2", { ...rest, className: classNames(className, "section-title__title") }, children);
|
|
31
|
+
const Subtitle = ({ children, className, ...rest }) => React.createElement("span", { ...rest, className: classNames(className, "section-title__subtitle") }, children);
|
|
32
|
+
const Info = ({ className, children, ...rest }) => React.createElement("div", { ...rest, className: classNames(className, "section-title__info") }, children);
|
|
33
|
+
const Overflow = ({ children, className, ...rest }) => React.createElement("div", { ...rest, className: classNames(className, "section-title__overflow") }, children);
|
|
34
|
+
exports.EbaySectionTitle = EbaySectionTitle;
|
|
35
|
+
exports.EbaySectionTitleInfo = Info;
|
|
36
|
+
exports.EbaySectionTitleOverflow = Overflow;
|
|
37
|
+
exports.EbaySectionTitleSubtitle = Subtitle;
|
|
38
|
+
exports.EbaySectionTitleTitle = Title;
|
|
@@ -1 +1,46 @@
|
|
|
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_componentUtils_utils = require("../common/component-utils/utils/index.js");
|
|
6
|
+
const icon = require("../icon-B17Di3YL.js");
|
|
7
|
+
const SegmentedButton = ({ selected, children, className, ...rest }) => {
|
|
8
|
+
const icon$1 = common_componentUtils_utils.findComponent(children, icon.EbayIcon);
|
|
9
|
+
const iconWithText = () => {
|
|
10
|
+
const text = common_componentUtils_utils.excludeComponent(children, icon.EbayIcon);
|
|
11
|
+
return React.createElement(
|
|
12
|
+
"span",
|
|
13
|
+
{ className: "segmented-buttons__button-cell" },
|
|
14
|
+
icon$1,
|
|
15
|
+
React.createElement("span", null, text)
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
return React.createElement(
|
|
19
|
+
"li",
|
|
20
|
+
null,
|
|
21
|
+
React.createElement("button", { className: classNames("segmented-buttons__button", className), "aria-current": selected || void 0, ...rest }, icon$1 ? iconWithText() : children)
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
const EbaySegmentedButtons = ({ size, className, onChange = () => {
|
|
25
|
+
}, children, ...rest }) => {
|
|
26
|
+
const buttons = common_componentUtils_utils.filterByType(children, SegmentedButton);
|
|
27
|
+
const [selectedIndex, setSelectedIndex] = React.useState(buttons.findIndex((button) => button.props.selected) || 0);
|
|
28
|
+
const handleClick = (e, index, value) => {
|
|
29
|
+
setSelectedIndex(index);
|
|
30
|
+
onChange(e, { index, value });
|
|
31
|
+
};
|
|
32
|
+
return React.createElement(
|
|
33
|
+
"div",
|
|
34
|
+
{ className: classNames("segmented-buttons", size && `segmented-buttons--${size}`, className), ...rest },
|
|
35
|
+
React.createElement("ul", null, buttons.map((button, i) => {
|
|
36
|
+
const { value, ...buttonRest } = button.props;
|
|
37
|
+
return React.cloneElement(button, {
|
|
38
|
+
...buttonRest,
|
|
39
|
+
onClick: (e) => handleClick(e, i, value),
|
|
40
|
+
selected: i === selectedIndex
|
|
41
|
+
});
|
|
42
|
+
}))
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
exports.EbaySegmentedButton = SegmentedButton;
|
|
46
|
+
exports.EbaySegmentedButtons = EbaySegmentedButtons;
|
package/ebay-select/index.js
CHANGED
|
@@ -1 +1,98 @@
|
|
|
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 icon = require("../icon-B17Di3YL.js");
|
|
6
|
+
const common_componentUtils_forwardRef = require("../common/component-utils/forwardRef/index.js");
|
|
7
|
+
const common_componentUtils_utils = require("../common/component-utils/utils/index.js");
|
|
8
|
+
const common_floatingLabelUtils_hooks = require("../common/floating-label-utils/hooks/index.js");
|
|
9
|
+
const EbaySelectOption = ({ children, ...rest }) => React.createElement("option", { ...rest }, children);
|
|
10
|
+
const isControlled = (value) => typeof value !== "undefined";
|
|
11
|
+
const EbaySelect = ({ value: controlledValue, defaultValue, className, borderless, name, disabled, onChange = () => {
|
|
12
|
+
}, onBlur = () => {
|
|
13
|
+
}, onFocus = () => {
|
|
14
|
+
}, floatingLabel, forwardedRef, children, inputSize, invalid, ...rest }) => {
|
|
15
|
+
const isFieldInvalid = invalid || rest["aria-invalid"] === "true";
|
|
16
|
+
const [value, setValue] = React.useState(defaultValue);
|
|
17
|
+
const { label, Container, onBlur: onFloatingLabelBlur, onFocus: onFloatingLabelFocus, ref } = common_floatingLabelUtils_hooks.useFloatingLabel({
|
|
18
|
+
ref: forwardedRef,
|
|
19
|
+
inputId: rest.id,
|
|
20
|
+
className,
|
|
21
|
+
disabled,
|
|
22
|
+
label: floatingLabel,
|
|
23
|
+
inputValue: controlledValue,
|
|
24
|
+
inputSize,
|
|
25
|
+
invalid: isFieldInvalid
|
|
26
|
+
});
|
|
27
|
+
const handleSelectChange = (e) => {
|
|
28
|
+
const { value: newValue, selectedIndex } = e.target;
|
|
29
|
+
if (!isControlled(controlledValue)) {
|
|
30
|
+
setValue(newValue);
|
|
31
|
+
}
|
|
32
|
+
onChange(e, { index: selectedIndex, selected: [newValue] });
|
|
33
|
+
};
|
|
34
|
+
const handleBlur = (event) => {
|
|
35
|
+
onBlur(event);
|
|
36
|
+
onFloatingLabelBlur();
|
|
37
|
+
};
|
|
38
|
+
const handleFocus = (event) => {
|
|
39
|
+
onFocus(event);
|
|
40
|
+
onFloatingLabelFocus();
|
|
41
|
+
};
|
|
42
|
+
const selectClassName = classNames("select", className, {
|
|
43
|
+
"select--borderless": borderless,
|
|
44
|
+
"select--large": inputSize === `large`
|
|
45
|
+
});
|
|
46
|
+
return React.createElement(
|
|
47
|
+
Container,
|
|
48
|
+
null,
|
|
49
|
+
label,
|
|
50
|
+
React.createElement(
|
|
51
|
+
"span",
|
|
52
|
+
{ className: selectClassName },
|
|
53
|
+
React.createElement("select", { ...rest, name, value: isControlled(controlledValue) ? controlledValue : value, disabled, onChange: handleSelectChange, onBlur: handleBlur, onFocus: handleFocus, ref }, options(children)),
|
|
54
|
+
React.createElement(icon.EbayIcon, { name: "chevronDown12", height: "8", width: "8" })
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
const ebaySelect = common_componentUtils_forwardRef.withForwardRef(EbaySelect);
|
|
59
|
+
function optionGroups(data) {
|
|
60
|
+
const optGroups = {};
|
|
61
|
+
data.forEach((opt) => {
|
|
62
|
+
const option = opt.props;
|
|
63
|
+
if (option.optgroup) {
|
|
64
|
+
if (!Object.prototype.hasOwnProperty.call(optGroups, option.optgroup)) {
|
|
65
|
+
optGroups[option.optgroup] = [];
|
|
66
|
+
}
|
|
67
|
+
optGroups[option.optgroup].push(option);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return optGroups;
|
|
71
|
+
}
|
|
72
|
+
function options(children) {
|
|
73
|
+
const renderedGroups = [];
|
|
74
|
+
const allOptions = [];
|
|
75
|
+
let optGroups = {};
|
|
76
|
+
let withinGroup = false;
|
|
77
|
+
const childrenOpts = common_componentUtils_utils.filterByType(children, EbaySelectOption).map((c) => React.cloneElement(c, {}));
|
|
78
|
+
if (childrenOpts) {
|
|
79
|
+
optGroups = optionGroups(childrenOpts);
|
|
80
|
+
let currentGroupName;
|
|
81
|
+
childrenOpts.forEach((option, idx) => {
|
|
82
|
+
const { value, optionClassName, children: optionChildren, optgroup } = option.props;
|
|
83
|
+
withinGroup = optgroup && renderedGroups.indexOf(optgroup) === -1;
|
|
84
|
+
if (withinGroup) {
|
|
85
|
+
currentGroupName = optgroup;
|
|
86
|
+
const currentGroupOptions = optGroups[currentGroupName];
|
|
87
|
+
const opts = currentGroupOptions.map((groupOption) => React.createElement(EbaySelectOption, { key: `opt-${groupOption.value}`, value: groupOption.value, className: groupOption.optionClassName }, groupOption.children));
|
|
88
|
+
allOptions.push(React.createElement("optgroup", { key: idx, label: optgroup }, opts));
|
|
89
|
+
renderedGroups.push(optgroup);
|
|
90
|
+
} else if (!optgroup) {
|
|
91
|
+
allOptions.push(React.createElement(EbaySelectOption, { key: idx, value, className: optionClassName }, optionChildren));
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return allOptions;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.EbaySelect = ebaySelect;
|
|
98
|
+
exports.EbaySelectOption = EbaySelectOption;
|
package/ebay-signal/index.js
CHANGED
|
@@ -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 EbaySignal = ({ status = "neutral", ...rest }) => {
|
|
6
|
+
const className = classNames(`signal signal--${status}`, rest.className);
|
|
7
|
+
return React.createElement("span", { ...rest, className });
|
|
8
|
+
};
|
|
9
|
+
exports.EbaySignal = EbaySignal;
|
|
@@ -1 +1,81 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const classNames = require("classnames");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const dialogPreviousButton = require("../dialog-previous-button-EC_Y6KaT.js");
|
|
6
|
+
require("../icon-button-BQWoMgX1.js");
|
|
7
|
+
const EbaySnackbarDialogAction = ({ className, children, ...rest }) => React.createElement("button", { className: classNames(className, "fake-link"), ...rest }, children);
|
|
8
|
+
const DEFAULT_TIMEOUT_LENGTH = 6e3;
|
|
9
|
+
const EbaySnackbarDialog = ({ className, onOpen = () => {
|
|
10
|
+
}, onClose = () => {
|
|
11
|
+
}, layout, open, children, onAction, ...rest }) => {
|
|
12
|
+
const eventSet = React.useRef(/* @__PURE__ */ new Set());
|
|
13
|
+
const timeoutRef = React.useRef();
|
|
14
|
+
const [isOpen, setIsOpen] = React.useState(open);
|
|
15
|
+
const childrenArray = React.Children.toArray(children);
|
|
16
|
+
const action = childrenArray.find((child) => child.type === EbaySnackbarDialogAction);
|
|
17
|
+
const content = childrenArray.filter((child) => child.type !== EbaySnackbarDialogAction);
|
|
18
|
+
const cancelCurrentCloseRequest = () => {
|
|
19
|
+
clearTimeout(timeoutRef.current);
|
|
20
|
+
};
|
|
21
|
+
const closeDialog = () => {
|
|
22
|
+
setIsOpen(false);
|
|
23
|
+
onClose();
|
|
24
|
+
};
|
|
25
|
+
const requestToCloseDialog = () => {
|
|
26
|
+
if (eventSet.current.size === 0) {
|
|
27
|
+
cancelCurrentCloseRequest();
|
|
28
|
+
timeoutRef.current = setTimeout(() => {
|
|
29
|
+
closeDialog();
|
|
30
|
+
}, DEFAULT_TIMEOUT_LENGTH);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const openDialog = () => {
|
|
34
|
+
setIsOpen(true);
|
|
35
|
+
onOpen();
|
|
36
|
+
requestToCloseDialog();
|
|
37
|
+
};
|
|
38
|
+
const handleFocus = () => {
|
|
39
|
+
cancelCurrentCloseRequest();
|
|
40
|
+
eventSet.current.add("focus");
|
|
41
|
+
};
|
|
42
|
+
const handleBlur = () => {
|
|
43
|
+
eventSet.current.delete("focus");
|
|
44
|
+
requestToCloseDialog();
|
|
45
|
+
};
|
|
46
|
+
const handleMouseEnter = () => {
|
|
47
|
+
cancelCurrentCloseRequest();
|
|
48
|
+
eventSet.current.add("mouseEnter");
|
|
49
|
+
};
|
|
50
|
+
const handleMouseLeave = () => {
|
|
51
|
+
eventSet.current.delete("mouseEnter");
|
|
52
|
+
requestToCloseDialog();
|
|
53
|
+
};
|
|
54
|
+
const handleAction = (event) => {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
cancelCurrentCloseRequest();
|
|
57
|
+
onAction == null ? void 0 : onAction(event);
|
|
58
|
+
(_b = (_a = action == null ? void 0 : action.props) == null ? void 0 : _a.onClick) == null ? void 0 : _b.call(_a, event);
|
|
59
|
+
closeDialog();
|
|
60
|
+
};
|
|
61
|
+
React.useEffect(() => () => {
|
|
62
|
+
cancelCurrentCloseRequest();
|
|
63
|
+
}, []);
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
if (open) {
|
|
66
|
+
openDialog();
|
|
67
|
+
} else {
|
|
68
|
+
closeDialog();
|
|
69
|
+
}
|
|
70
|
+
}, [open]);
|
|
71
|
+
return React.createElement(
|
|
72
|
+
dialogPreviousButton.DialogBaseWithState,
|
|
73
|
+
{ ...rest, open: isOpen, isModal: false, baseEl: "aside", classPrefix: "snackbar-dialog", transitionElement: "root", a11yCloseText: "", buttonPosition: "hidden", className: classNames(className, "snackbar-dialog--transition"), windowClass: layout === "column" && "snackbar-dialog__window--column", onFocus: handleFocus, onBlur: handleBlur, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
|
|
74
|
+
content,
|
|
75
|
+
action ? React.createElement(dialogPreviousButton.EbayDialogActions, null, React.cloneElement(action, {
|
|
76
|
+
onClick: handleAction
|
|
77
|
+
})) : null
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
exports.EbaySnackbarDialog = EbaySnackbarDialog;
|
|
81
|
+
exports.EbaySnackbarDialogAction = EbaySnackbarDialogAction;
|
|
@@ -1 +1,22 @@
|
|
|
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 button = require("../button-B4bZIgwB.js");
|
|
6
|
+
const ebayMenuButton = require("../ebay-menu-button/index.js");
|
|
7
|
+
const menu = require("../menu-Bsy48CE1.js");
|
|
8
|
+
require("classnames");
|
|
9
|
+
const EbaySplitButton = ({ a11yMenuText, children, type, bodyState, a11yButtonLoadingText, onCollapse, onExpand, onSelect = () => {
|
|
10
|
+
}, onChange = () => {
|
|
11
|
+
}, ref, ...rest }) => {
|
|
12
|
+
const menuItemComponents = [menu.EbayMenuItem, ebayMenuButton.EbayMenuButtonSeparator];
|
|
13
|
+
const buttonLabel = common_componentUtils_utils.filterBy(children, (el) => !menuItemComponents.includes(el.type));
|
|
14
|
+
const menuItems = common_componentUtils_utils.filterByType(children, menuItemComponents);
|
|
15
|
+
return React.createElement(
|
|
16
|
+
"span",
|
|
17
|
+
{ className: "split-button" },
|
|
18
|
+
React.createElement(button.EbayButton, { "aria-label": bodyState === "loading" ? a11yButtonLoadingText : void 0, ...rest, split: "start", bodyState: bodyState === "expand" ? void 0 : bodyState }, buttonLabel),
|
|
19
|
+
React.createElement(ebayMenuButton.EbayMenuButton, { priority: rest.priority, disabled: rest.disabled, transparent: rest.transparent, size: rest.size, type, split: "end", reverse: true, a11yText: a11yMenuText, onCollapse, onExpand, onSelect, onChange }, menuItems)
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
exports.EbaySplitButton = EbaySplitButton;
|
|
@@ -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 icon = require("../icon-B17Di3YL.js");
|
|
6
|
+
const range = require("../range-C5qzyhg4.js");
|
|
7
|
+
const stars = range.range(1, 5);
|
|
8
|
+
const EbayStarRating = ({ value, a11yText, className, ...rest }) => React.createElement("div", { role: "img", "aria-label": a11yText, className: classNames("star-rating", className), "data-stars": value, ...rest }, stars.map((i) => React.createElement(icon.EbayIcon, { key: i, className: "star-rating__icon", name: "starDynamic" })));
|
|
9
|
+
exports.EbayStarRating = EbayStarRating;
|
|
@@ -1 +1,55 @@
|
|
|
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 icon = require("../icon-B17Di3YL.js");
|
|
6
|
+
const range = require("../range-C5qzyhg4.js");
|
|
7
|
+
const common_randomId = require("../common/random-id/index.js");
|
|
8
|
+
const stars = range.range(1, 5);
|
|
9
|
+
const getValue = (val) => {
|
|
10
|
+
let value = parseInt(val, 0) || 0;
|
|
11
|
+
if (value > 5) {
|
|
12
|
+
value = 0;
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
};
|
|
16
|
+
const EbayStarRatingSelect = ({ value = 0, a11yText, className, a11yStarText = [], disabled, onChange = () => {
|
|
17
|
+
}, onFocus = () => {
|
|
18
|
+
}, onKeyDown = () => {
|
|
19
|
+
}, name, ...rest }) => {
|
|
20
|
+
const rId = common_randomId.useRandomId();
|
|
21
|
+
const inputName = name || `star-rating-${rId}`;
|
|
22
|
+
const [checkedValue, setChecked] = React.useState(getValue(value));
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
setChecked(getValue(value));
|
|
25
|
+
}, [value]);
|
|
26
|
+
const handleKeyDown = (i) => (e) => {
|
|
27
|
+
if (!disabled) {
|
|
28
|
+
setChecked(getValue(i));
|
|
29
|
+
onKeyDown(e, { value: i });
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const handleClick = (i) => (e) => {
|
|
33
|
+
if (!disabled) {
|
|
34
|
+
setChecked(getValue(i));
|
|
35
|
+
onChange(e, { value: i });
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const handleFocus = (i) => (e) => {
|
|
39
|
+
if (!disabled) {
|
|
40
|
+
setChecked(getValue(i));
|
|
41
|
+
onFocus(e, { value: i });
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return React.createElement("div", { role: a11yText && "radiogroup", "aria-label": a11yText, className: classNames("star-rating-select", className), ...rest }, stars.map((i) => React.createElement(
|
|
45
|
+
"span",
|
|
46
|
+
{ className: "star-rating-select__radio", key: i },
|
|
47
|
+
React.createElement("input", { "aria-label": a11yStarText == null ? void 0 : a11yStarText[i - 1], className: classNames("star-rating-select__control", { "star-rating-select__control--filled": i <= checkedValue }), type: "radio", name: inputName, value: i, disabled, defaultChecked: checkedValue === i, onClick: handleClick(i), onFocus: handleFocus(i), onKeyDown: handleKeyDown(i) }),
|
|
48
|
+
React.createElement(
|
|
49
|
+
"span",
|
|
50
|
+
{ className: "star-rating-select__radio-icon" },
|
|
51
|
+
React.createElement(icon.EbayIcon, { className: "star-rating__icon", name: "starDynamic" })
|
|
52
|
+
)
|
|
53
|
+
)));
|
|
54
|
+
};
|
|
55
|
+
exports.EbayStarRatingSelect = EbayStarRatingSelect;
|