@ebay/ui-core-react 7.4.0-alpha.7 → 7.4.0-alpha.9
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 +1 -0
- package/ebay-listbox/listbox.d.ts.map +1 -1
- package/ebay-listbox-button/index.js +151 -1
- package/ebay-listbox-button/listbox-button.d.ts.map +1 -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-DfOw_fJc.js +662 -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-Br0AMj3v.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 = "lightbox-dialog";
|
|
8
|
+
const EbayLightboxDialog = ({ open, mode, size, onClose = () => {
|
|
9
|
+
}, ...rest }) => React.createElement(dialogPreviousButton.DialogBaseWithState, { buttonPosition: "right", ...rest, classPrefix, onCloseBtnClick: onClose, onBackgroundClick: onClose, className: classNames(rest.className, `${classPrefix}--mask-fade`, size && `${classPrefix}--${size}`), windowClass: classNames("lightbox-dialog__window--fade", {
|
|
10
|
+
[`${classPrefix}__window--mini`]: mode === "mini"
|
|
11
|
+
}), open });
|
|
12
|
+
exports.EbayLightboxDialog = EbayLightboxDialog;
|
package/ebay-listbox/index.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const listbox = require("../listbox-DfOw_fJc.js");
|
|
4
|
+
exports.EbayListbox = listbox.EbayListbox;
|
|
5
|
+
exports.EbayListboxOption = listbox.EbayListboxOption;
|
|
6
|
+
exports.EbayListboxOptionDescription = listbox.EbayListboxOptionDescription;
|
|
@@ -14,6 +14,7 @@ export type EbayListboxProps = Omit<ComponentProps<'div'>, 'onChange'> & {
|
|
|
14
14
|
typeaheadTimeoutLength?: number;
|
|
15
15
|
maxHeight?: string | number;
|
|
16
16
|
selectClassName?: string;
|
|
17
|
+
activeClassName?: string;
|
|
17
18
|
onChange?: EbayChangeEventHandler<HTMLSpanElement, ChangeEventProps>;
|
|
18
19
|
onEscape?: () => void;
|
|
19
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox/listbox.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA6B,EAAE,EAA4B,MAAM,OAAO,CAAA;AAItF,OAAO,EAAE,cAAc,EAAE,SAAS,EAAoB,MAAM,OAAO,CAAA;AAInE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAIlD,MAAM,MAAM,gBAAgB,GA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EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IACrE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACxB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA2L5C,CAAA"}
|
|
@@ -1 +1,151 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const index = require("../index-DcH7Tjjd.js");
|
|
5
|
+
const classNames = require("classnames");
|
|
6
|
+
const listbox = require("../listbox-DfOw_fJc.js");
|
|
7
|
+
const common_componentUtils_utils = require("../common/component-utils/utils/index.js");
|
|
8
|
+
const icon = require("../icon-B17Di3YL.js");
|
|
9
|
+
function onKeyDown(e) {
|
|
10
|
+
if (e.keyCode >= 32 && e.keyCode <= 40) {
|
|
11
|
+
e.preventDefault();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function add(el) {
|
|
15
|
+
el.addEventListener("keydown", onKeyDown);
|
|
16
|
+
}
|
|
17
|
+
function remove(el) {
|
|
18
|
+
el.removeEventListener("keydown", onKeyDown);
|
|
19
|
+
}
|
|
20
|
+
const RenderText = ({ alwaysDisplay, icon: icon2, labelId, text, unselectedText, postfixLabel }) => {
|
|
21
|
+
if (icon2) {
|
|
22
|
+
return React.createElement("span", { id: labelId, className: "btn__text" }, icon2);
|
|
23
|
+
}
|
|
24
|
+
if (text || alwaysDisplay) {
|
|
25
|
+
const displayText = text || unselectedText;
|
|
26
|
+
return React.createElement(
|
|
27
|
+
"span",
|
|
28
|
+
{ id: labelId, className: "btn__text" },
|
|
29
|
+
displayText,
|
|
30
|
+
postfixLabel && React.createElement("span", { className: "btn__postfix-label" }, postfixLabel)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
function getSelectedValueIndex({ selected, value, options }) {
|
|
35
|
+
if (selected !== void 0) {
|
|
36
|
+
return selected;
|
|
37
|
+
}
|
|
38
|
+
if (value !== void 0) {
|
|
39
|
+
return options.findIndex((option) => option.props.value === value);
|
|
40
|
+
}
|
|
41
|
+
return options.findIndex((option) => option.props.selected);
|
|
42
|
+
}
|
|
43
|
+
const EbayListboxButtonOption = listbox.EbayListboxOption;
|
|
44
|
+
const EbayListboxButton = ({ "aria-invalid": invalid, a11yIconPrefixText, borderless, children, className, collapseOnSelect, disabled, floatingLabel, fluid, hasError, listSelection, maxHeight, name, postfixLabel, prefixId, prefixLabel, selected, split, truncate, unselectedText = "-", value, variant, onChange = () => {
|
|
45
|
+
}, onExpand = () => {
|
|
46
|
+
}, onCollapse = () => {
|
|
47
|
+
}, ...rest }) => {
|
|
48
|
+
const containerRef = React.useRef();
|
|
49
|
+
const buttonRef = React.useRef();
|
|
50
|
+
const expanderRef = React.useRef();
|
|
51
|
+
const options = common_componentUtils_utils.filterByType(children, listbox.EbayListboxOption);
|
|
52
|
+
const [selectedIndex, setSelectedIndex] = React.useState(getSelectedValueIndex({ selected, value, options }));
|
|
53
|
+
const selectedOption = options[selectedIndex];
|
|
54
|
+
const selectedText = selectedOption && (selectedOption.props.text || selectedOption.props.children);
|
|
55
|
+
const selectedIcon = selectedOption && selectedOption.props.icon;
|
|
56
|
+
const a11ySelectedIconText = selectedIcon && selectedText;
|
|
57
|
+
const labelId = prefixId && "expand-btn-text";
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
setSelectedIndex(getSelectedValueIndex({ selected, value, options }));
|
|
60
|
+
}, [value, selected]);
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
function handleExpand() {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
(_b = (_a = containerRef.current) == null ? void 0 : _a.querySelector(".listbox-button__listbox")) == null ? void 0 : _b.scroll();
|
|
65
|
+
onExpand();
|
|
66
|
+
}
|
|
67
|
+
function handleCollapse() {
|
|
68
|
+
requestAnimationFrame(() => {
|
|
69
|
+
var _a;
|
|
70
|
+
(_a = buttonRef.current) == null ? void 0 : _a.focus();
|
|
71
|
+
});
|
|
72
|
+
onCollapse();
|
|
73
|
+
}
|
|
74
|
+
if (options.length && !disabled) {
|
|
75
|
+
expanderRef.current = new index.src_default(containerRef.current, {
|
|
76
|
+
alwaysDoFocusManagement: true,
|
|
77
|
+
autoCollapse: true,
|
|
78
|
+
expandOnClick: true,
|
|
79
|
+
simulateSpacebarClick: true,
|
|
80
|
+
contentSelector: ".listbox-button__listbox",
|
|
81
|
+
hostSelector: ".listbox-button__control",
|
|
82
|
+
expandedClass: "listbox-button--expanded",
|
|
83
|
+
focusManagement: "content"
|
|
84
|
+
});
|
|
85
|
+
containerRef.current.addEventListener("expander-expand", handleExpand);
|
|
86
|
+
containerRef.current.addEventListener("expander-collapse", handleCollapse);
|
|
87
|
+
}
|
|
88
|
+
add(buttonRef.current);
|
|
89
|
+
return () => {
|
|
90
|
+
if (expanderRef.current) {
|
|
91
|
+
expanderRef.current.destroy();
|
|
92
|
+
expanderRef.current = void 0;
|
|
93
|
+
}
|
|
94
|
+
if (containerRef.current) {
|
|
95
|
+
containerRef.current.removeEventListener("expander-expand", handleExpand);
|
|
96
|
+
containerRef.current.removeEventListener("expander-collapse", handleCollapse);
|
|
97
|
+
}
|
|
98
|
+
if (buttonRef.current) {
|
|
99
|
+
remove(buttonRef.current);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}, [disabled]);
|
|
103
|
+
function handleListboxChange(event, data) {
|
|
104
|
+
if (collapseOnSelect !== false) {
|
|
105
|
+
expanderRef.current.expanded = false;
|
|
106
|
+
}
|
|
107
|
+
setSelectedIndex(data.index);
|
|
108
|
+
onChange(event, data);
|
|
109
|
+
}
|
|
110
|
+
function handleListboxEscape() {
|
|
111
|
+
expanderRef.current.expanded = false;
|
|
112
|
+
}
|
|
113
|
+
const Container = truncate && !fluid ? "div" : "span";
|
|
114
|
+
return React.createElement(
|
|
115
|
+
Container,
|
|
116
|
+
{ ref: containerRef, className: classNames("listbox-button", className, {
|
|
117
|
+
"listbox-button--fluid": fluid,
|
|
118
|
+
"listbox-button--form": variant === "form",
|
|
119
|
+
"listbox-button--error": invalid || hasError
|
|
120
|
+
}) },
|
|
121
|
+
React.createElement(
|
|
122
|
+
"button",
|
|
123
|
+
{ ...rest, disabled, ref: buttonRef, className: classNames("listbox-button__control", "btn", {
|
|
124
|
+
[`btn--split-${split}`]: split,
|
|
125
|
+
"btn--borderless": borderless,
|
|
126
|
+
"btn--form": !borderless,
|
|
127
|
+
"btn--truncated": truncate,
|
|
128
|
+
"btn--floating-label": floatingLabel
|
|
129
|
+
}), "aria-label": a11ySelectedIconText && `${a11yIconPrefixText}: ${a11ySelectedIconText}`, value: selectedText, type: "button", "aria-haspopup": "listbox", "aria-labelledby": labelId && `${prefixId} ${labelId}`, "aria-invalid": invalid || hasError },
|
|
130
|
+
React.createElement(
|
|
131
|
+
"span",
|
|
132
|
+
{ className: "btn__cell" },
|
|
133
|
+
floatingLabel ? React.createElement(
|
|
134
|
+
React.Fragment,
|
|
135
|
+
null,
|
|
136
|
+
React.createElement("span", { className: classNames("btn__floating-label", "btn__floating-label--animate", !selectedText && "btn__floating-label--inline") }, floatingLabel),
|
|
137
|
+
React.createElement(RenderText, { icon: selectedIcon, labelId, text: selectedText, unselectedText, postfixLabel })
|
|
138
|
+
) : React.createElement(
|
|
139
|
+
React.Fragment,
|
|
140
|
+
null,
|
|
141
|
+
prefixLabel ? React.createElement("span", { className: "btn__label" }, prefixLabel) : null,
|
|
142
|
+
React.createElement(RenderText, { alwaysDisplay: true, icon: selectedIcon, labelId, text: selectedText, unselectedText, postfixLabel })
|
|
143
|
+
),
|
|
144
|
+
React.createElement(icon.EbayIcon, { name: "chevronDown12" })
|
|
145
|
+
)
|
|
146
|
+
),
|
|
147
|
+
React.createElement(listbox.EbayListbox, { className: "listbox-button__listbox listbox-button__options", selectClassName: "listbox-button__native", activeClassName: "listbox-button__option--active", tabIndex: -1, listSelection, name, maxHeight, onChange: handleListboxChange, onEscape: handleListboxEscape }, options.map((option, index2) => React.createElement(listbox.EbayListboxOption, { ...option.props, key: option.props.value || index2, selected: index2 === selectedIndex, className: classNames("listbox-button__option", option.props.className) })))
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
exports.EbayListboxButton = EbayListboxButton;
|
|
151
|
+
exports.EbayListboxButtonOption = EbayListboxButtonOption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox-button.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEV,cAAc,EACd,EAAE,EAKL,MAAM,OAAO,CAAA;AAOd,OAAO,EAAe,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAiDhD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,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,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IACrE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAA;AAED,eAAO,MAAM,uBAAuB,2EAAoB,CAAA;AAExD,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA+LxD,CAAA"}
|
package/ebay-menu/index.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const menu = require("../menu-Bsy48CE1.js");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const classNames = require("classnames");
|
|
6
|
+
const EbayMenuItemSeparator = ({ className, ...rest }) => React.createElement("hr", { ...rest, className: classNames(className, "menu__separator"), role: "separator" });
|
|
7
|
+
exports.EbayMenu = menu.EbayMenu;
|
|
8
|
+
exports.EbayMenuItem = menu.EbayMenuItem;
|
|
9
|
+
exports.EbayMenuSeparator = EbayMenuItemSeparator;
|
|
@@ -1 +1,113 @@
|
|
|
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 menu = require("../menu-Bsy48CE1.js");
|
|
7
|
+
const button = require("../button-B4bZIgwB.js");
|
|
8
|
+
const iconButton = require("../icon-button-BQWoMgX1.js");
|
|
9
|
+
const icon = require("../icon-B17Di3YL.js");
|
|
10
|
+
const common_randomId = require("../common/random-id/index.js");
|
|
11
|
+
const common_eventUtils = require("../common/event-utils/index.js");
|
|
12
|
+
const EbayMenuButton = ({ type, variant = "button", className, text = "", fixWidth, reverse, expanded: defaultExpanded, noToggleIcon, checked, collapseOnSelect, a11yText, prefixId, prefixLabel, onClick = () => {
|
|
13
|
+
}, onExpand = () => {
|
|
14
|
+
}, onCollapse = () => {
|
|
15
|
+
}, onChange = () => {
|
|
16
|
+
}, onSelect = () => {
|
|
17
|
+
}, children, ...rest }) => {
|
|
18
|
+
const [expanded, setExpanded] = React.useState(defaultExpanded);
|
|
19
|
+
const [menuId, setMenuId] = React.useState();
|
|
20
|
+
const buttonRef = React.useRef(null);
|
|
21
|
+
const menuRef = React.useRef();
|
|
22
|
+
const menuItems = common_componentUtils_utils.filterByType(children, [menu.EbayMenuItem, EbayMenuButtonSeparator]);
|
|
23
|
+
const defaultIndexes = menuItems.map((item) => Boolean(item.props.checked));
|
|
24
|
+
const [checkedIndexes, setCheckedIndexes] = React.useState(defaultIndexes);
|
|
25
|
+
const menuButtonLabel = common_componentUtils_utils.findComponent(children, EbayMenuButtonLabel);
|
|
26
|
+
const icon$1 = common_componentUtils_utils.findComponent(children, icon.EbayIcon);
|
|
27
|
+
const label = labelWithPrefixAndIcon({ text, prefixId, prefixLabel, menuButtonLabel, icon: icon$1 });
|
|
28
|
+
const wrapperClasses = classNames("menu-button", className);
|
|
29
|
+
const menuClasses = classNames("menu-button__menu", {
|
|
30
|
+
"menu-button__menu--fix-width": fixWidth,
|
|
31
|
+
"menu-button__menu--reverse": reverse
|
|
32
|
+
});
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
const handleBackgroundClick = (e) => {
|
|
35
|
+
const menuEl = menuRef.current;
|
|
36
|
+
const menuClicked = menuEl && menuEl.contains(e.target);
|
|
37
|
+
if (collapseOnSelect || !menuClicked) {
|
|
38
|
+
setExpanded(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
if (expanded) {
|
|
42
|
+
onExpand();
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
document.addEventListener("click", handleBackgroundClick, false);
|
|
45
|
+
});
|
|
46
|
+
} else if (expanded === false) {
|
|
47
|
+
onCollapse();
|
|
48
|
+
}
|
|
49
|
+
return () => document.removeEventListener("click", handleBackgroundClick, false);
|
|
50
|
+
}, [expanded]);
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
setMenuId(common_randomId.randomId());
|
|
53
|
+
}, []);
|
|
54
|
+
const handleMenuKeydown = (e) => {
|
|
55
|
+
common_eventUtils.handleEscapeKeydown(e, () => {
|
|
56
|
+
var _a;
|
|
57
|
+
setExpanded(false);
|
|
58
|
+
(_a = buttonRef.current) == null ? void 0 : _a.focus();
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
const buttonProps = {
|
|
62
|
+
ref: buttonRef,
|
|
63
|
+
className: "menu-button__button",
|
|
64
|
+
"aria-expanded": !!expanded,
|
|
65
|
+
"aria-haspopup": true,
|
|
66
|
+
"aria-label": a11yText,
|
|
67
|
+
"aria-controls": menuId,
|
|
68
|
+
"aria-labelledby": prefixId,
|
|
69
|
+
onClick: (e) => {
|
|
70
|
+
setExpanded(!expanded);
|
|
71
|
+
onClick(e);
|
|
72
|
+
},
|
|
73
|
+
...rest
|
|
74
|
+
};
|
|
75
|
+
const handleOnChange = (e, eventProps) => {
|
|
76
|
+
if (type === "radio" || type === "checkbox") {
|
|
77
|
+
const newCheckedIndexes = checkedIndexes.map((_, i) => eventProps.indexes.includes(i));
|
|
78
|
+
setCheckedIndexes(newCheckedIndexes);
|
|
79
|
+
}
|
|
80
|
+
onChange(e, eventProps);
|
|
81
|
+
};
|
|
82
|
+
const checkedIndex = () => {
|
|
83
|
+
const index = checkedIndexes.findIndex(Boolean);
|
|
84
|
+
return index > -1 ? index : checked;
|
|
85
|
+
};
|
|
86
|
+
return React.createElement(
|
|
87
|
+
"span",
|
|
88
|
+
{ className: wrapperClasses },
|
|
89
|
+
variant === "overflow" ? React.createElement(iconButton.EbayIconButton, { icon: "overflowVertical16", ...buttonProps }) : React.createElement(button.EbayButton, { variant: variant === "form" ? "form" : void 0, bodyState: noToggleIcon ? void 0 : "expand", ...buttonProps }, label),
|
|
90
|
+
expanded && React.createElement(menu.EbayMenu, { baseEl: "div", ref: menuRef, type, className: menuClasses, tabIndex: -1, id: menuId, autofocus: true, checked: checkedIndex(), onKeyDown: handleMenuKeydown, onChange: handleOnChange, onSelect }, menuItems.map((item, i) => React.cloneElement(item, {
|
|
91
|
+
...item.props,
|
|
92
|
+
className: classNames(item.props.className, "menu-button__item"),
|
|
93
|
+
key: i,
|
|
94
|
+
checked: checkedIndexes[i]
|
|
95
|
+
})))
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
function labelWithPrefixAndIcon({ text, prefixId, prefixLabel, menuButtonLabel, icon: icon2 }) {
|
|
99
|
+
const textLabelElement = text.length ? React.createElement("span", null, text) : null;
|
|
100
|
+
const prefixLabelElement = !prefixId && prefixLabel && [
|
|
101
|
+
React.createElement("span", { className: "menu-button-prefix-label" }, prefixLabel),
|
|
102
|
+
React.createElement(React.Fragment, null, " ")
|
|
103
|
+
];
|
|
104
|
+
const labelWithPrefix = [prefixLabelElement, menuButtonLabel || textLabelElement];
|
|
105
|
+
const labelArray = [icon2, labelWithPrefix].flat().filter(Boolean);
|
|
106
|
+
return labelArray.length ? labelArray : null;
|
|
107
|
+
}
|
|
108
|
+
const EbayMenuButtonSeparator = ({ className, ...rest }) => React.createElement("hr", { ...rest, className: classNames(className, "menu-button__separator"), role: "separator" });
|
|
109
|
+
const EbayMenuButtonLabel = ({ children }) => React.createElement(React.Fragment, null, children);
|
|
110
|
+
exports.EbayMenuButtonItem = menu.EbayMenuItem;
|
|
111
|
+
exports.EbayMenuButton = EbayMenuButton;
|
|
112
|
+
exports.EbayMenuButtonLabel = EbayMenuButtonLabel;
|
|
113
|
+
exports.EbayMenuButtonSeparator = EbayMenuButtonSeparator;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const noticeContent = require("../notice-content-BhUeK1pd.js");
|
|
5
|
+
const EbayNoticeTitle = ({ children }) => React.createElement("span", { className: "page-notice__title" }, children);
|
|
6
|
+
exports.EbayNoticeContent = noticeContent.EbayNoticeContent;
|
|
7
|
+
exports.EbayNoticeTitle = EbayNoticeTitle;
|
|
@@ -1 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const noticeContent$1 = require("../notice-content-BTXVxttv.js");
|
|
5
|
+
const noticeContent = require("../notice-content-BhUeK1pd.js");
|
|
6
|
+
const icon = require("../icon-B17Di3YL.js");
|
|
7
|
+
require("classnames");
|
|
8
|
+
const noticeFooter = require("../notice-footer-CIQ8SM6N.js");
|
|
9
|
+
const common_noticeUtils_noticeCta = require("../common/notice-utils/notice-cta/index.js");
|
|
10
|
+
const EbayPageNotice = ({ id, status = "general", children, a11yDismissText, "aria-label": ariaLabel, onDismiss = () => {
|
|
11
|
+
}, ...rest }) => {
|
|
12
|
+
const [dismissed, setDismissed] = React.useState(false);
|
|
13
|
+
const childrenArray = React.Children.toArray(children);
|
|
14
|
+
const content = childrenArray.find((child) => child.type === noticeContent.EbayNoticeContent);
|
|
15
|
+
if (!content) {
|
|
16
|
+
throw new Error(`EbayPageNotice: Please use a EbayNoticeContent that defines the content of the notice`);
|
|
17
|
+
}
|
|
18
|
+
const handleDismissed = (event) => {
|
|
19
|
+
setDismissed(true);
|
|
20
|
+
onDismiss(event);
|
|
21
|
+
};
|
|
22
|
+
return dismissed ? null : React.createElement(
|
|
23
|
+
"section",
|
|
24
|
+
{ ...rest, "aria-labelledby": id || `${status}-status`, className: `page-notice ${status !== `general` ? `page-notice--${status}` : ``}`, role: "region" },
|
|
25
|
+
status !== `general` ? React.createElement(
|
|
26
|
+
"div",
|
|
27
|
+
{ className: "page-notice__header", id: id || `${status}-status` },
|
|
28
|
+
React.createElement(icon.EbayIcon, { name: `${status}Filled16`, a11yText: ariaLabel, a11yVariant: "label" })
|
|
29
|
+
) : null,
|
|
30
|
+
React.createElement(noticeContent$1.NoticeContent, { ...content.props, type: "page" }),
|
|
31
|
+
children,
|
|
32
|
+
a11yDismissText && React.createElement(
|
|
33
|
+
EbayPageNoticeFooter,
|
|
34
|
+
null,
|
|
35
|
+
React.createElement(
|
|
36
|
+
"button",
|
|
37
|
+
{ "aria-label": a11yDismissText, className: "fake-link page-notice__dismiss", onClick: handleDismissed },
|
|
38
|
+
React.createElement(icon.EbayIcon, { name: "close16" })
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
const EbayPageNoticeTitle = ({ className, as, children, ...rest }) => React.createElement(noticeFooter.NoticeTitle, { ...rest, className, as, type: "page" }, children);
|
|
44
|
+
const EbayPageNoticeFooter = ({ className, children }) => React.createElement(noticeFooter.NoticeFooter, { className, type: "page" }, children);
|
|
45
|
+
const EbayPageNoticeCTA = ({ className, children }) => React.createElement(common_noticeUtils_noticeCta, { className, type: "page" }, children);
|
|
46
|
+
exports.EbayNoticeContent = noticeContent.EbayNoticeContent;
|
|
47
|
+
exports.EbayPageNotice = EbayPageNotice;
|
|
48
|
+
exports.EbayPageNoticeCTA = EbayPageNoticeCTA;
|
|
49
|
+
exports.EbayPageNoticeFooter = EbayPageNoticeFooter;
|
|
50
|
+
exports.EbayPageNoticeTitle = EbayPageNoticeTitle;
|