@ebay/ui-core-react 7.4.0-alpha.8 → 7.4.0
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/README.md +2 -2
- package/array.polyfill.flat-5BAolFdk.js +1 -0
- package/badge-CoHKfiPt.js +1 -0
- package/button-DGuEBUDJ.js +1 -0
- package/calendar-lAu6VfAb.js +1 -0
- package/common/component-utils/forwardRef/index.js +1 -10
- package/common/component-utils/index.js +1 -9
- package/common/component-utils/utils/index.js +1 -25
- package/common/event-utils/index.js +1 -113
- package/common/floating-label-utils/hooks/index.js +1 -106
- package/common/notice-utils/notice-cta/index.js +1 -5
- package/common/random-id/index.js +1 -13
- package/common/tooltip-utils/constants/index.js +1 -97
- package/common/tooltip-utils/index.js +1 -11
- package/debounce-BQsYxxOL.js +1 -0
- package/dialog-previous-button-CpuFLkQp.js +1 -0
- package/drawer-rqXAEeqd.js +1 -0
- package/ebay-alert-dialog/index.js +1 -26
- package/ebay-badge/index.js +1 -4
- package/ebay-breadcrumbs/index.js +1 -47
- package/ebay-button/index.js +1 -5
- package/ebay-calendar/index.js +1 -4
- package/ebay-carousel/index.js +1 -345
- package/ebay-checkbox/index.js +1 -52
- package/ebay-confirm-dialog/index.js +1 -28
- package/ebay-cta-button/index.js +1 -22
- package/ebay-date-textbox/index.js +1 -140
- package/ebay-dialog-base/components/animation/index.js +1 -92
- package/ebay-dialog-base/components/dialog-footer/index.js +1 -4
- package/ebay-dialog-base/components/dialog-header/index.js +1 -4
- package/ebay-dialog-base/index.js +1 -13
- package/ebay-drawer-dialog/index.js +1 -4
- package/ebay-eek/index.js +1 -54
- package/ebay-fake-menu/index.js +1 -10
- package/ebay-fake-menu/menu-item/index.js +1 -49
- package/ebay-fake-menu-button/index.js +1 -7
- package/ebay-fake-menu-button/menu-button/index.js +1 -12
- package/ebay-fake-tabs/index.js +1 -30
- package/ebay-field/index.js +1 -21
- package/ebay-fullscreen-dialog/index.js +1 -10
- package/ebay-icon/index.js +1 -4
- package/ebay-icon/types.d.ts +1 -1
- package/ebay-icon/types.d.ts.map +1 -1
- package/ebay-icon-button/index.js +1 -4
- package/ebay-infotip/index.js +1 -76
- package/ebay-inline-notice/index.js +1 -36
- package/ebay-lightbox-dialog/index.js +1 -12
- package/ebay-listbox-button/index.d.ts +2 -1
- package/ebay-listbox-button/index.d.ts.map +1 -1
- package/ebay-listbox-button/index.js +2 -151
- package/ebay-listbox-button/listbox-button-option.d.ts +10 -0
- package/ebay-listbox-button/listbox-button-option.d.ts.map +1 -0
- package/ebay-listbox-button/listbox-button.d.ts +5 -15
- package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
- package/ebay-menu/index.js +1 -9
- package/ebay-menu-button/index.js +1 -113
- package/ebay-notice-base/index.js +1 -7
- package/ebay-page-notice/index.js +1 -50
- package/ebay-pagination/index.js +1 -244
- package/ebay-panel-dialog/index.js +1 -12
- package/ebay-progress-bar/index.js +1 -6
- package/ebay-progress-spinner/index.js +1 -4
- package/ebay-progress-stepper/index.js +1 -72
- package/ebay-radio/index.js +1 -4
- package/ebay-radio/radio/index.js +1 -48
- package/ebay-section-notice/index.js +1 -69
- package/ebay-section-title/index.js +1 -38
- package/ebay-segmented-buttons/index.js +1 -46
- package/ebay-select/index.js +1 -98
- package/ebay-signal/index.js +1 -9
- package/ebay-snackbar-dialog/index.js +1 -81
- package/ebay-split-button/index.js +1 -22
- package/ebay-star-rating/index.js +1 -9
- package/ebay-star-rating-select/index.js +1 -55
- package/ebay-svg/index.js +1 -5189
- package/ebay-svg/symbols.d.ts.map +1 -1
- package/ebay-switch/index.js +1 -27
- package/ebay-tabs/index.js +1 -88
- package/ebay-textbox/index.js +1 -10
- package/ebay-toast-dialog/index.js +1 -9
- package/ebay-toggle-button/README.md +39 -0
- package/ebay-toggle-button/index.d.ts +3 -0
- package/ebay-toggle-button/index.d.ts.map +1 -0
- package/ebay-toggle-button/index.js +1 -0
- package/ebay-toggle-button/toggle-button.d.ts +5 -0
- package/ebay-toggle-button/toggle-button.d.ts.map +1 -0
- package/ebay-toggle-button/types.d.ts +23 -0
- package/ebay-toggle-button/types.d.ts.map +1 -0
- package/ebay-toggle-button-group/README.md +56 -0
- package/ebay-toggle-button-group/index.d.ts +3 -0
- package/ebay-toggle-button-group/index.d.ts.map +1 -0
- package/ebay-toggle-button-group/index.js +1 -0
- package/ebay-toggle-button-group/toggle-button-group.d.ts +5 -0
- package/ebay-toggle-button-group/toggle-button-group.d.ts.map +1 -0
- package/ebay-toggle-button-group/types.d.ts +20 -0
- package/ebay-toggle-button-group/types.d.ts.map +1 -0
- package/ebay-tooltip/index.js +1 -64
- package/ebay-tourtip/index.js +1 -54
- package/ebay-video/index.js +1 -229
- package/events/index.js +1 -18
- package/icon-TuxfQndO.js +1 -0
- package/icon-button-Cwaj-eT9.js +1 -0
- package/label-CnrpYJ-g.js +1 -0
- package/menu-CV-INYLM.js +1 -0
- package/menu-_LzP6yje.js +1 -0
- package/menu-button-BZ66jxvI.js +1 -0
- package/notice-content-9iF4T8uB.js +1 -0
- package/notice-content-C0ZStfuX.js +1 -0
- package/notice-footer-Cw1DMzoB.js +1 -0
- package/package.json +2 -5
- package/progress-spinner-U2qOANON.js +1 -0
- package/range-DOsPN0h5.js +1 -0
- package/textbox-dUhinDwj.js +1 -0
- package/toggle-button-D8l0YB43.js +1 -0
- package/use-roving-index-DoAVBgsp.js +1 -0
- package/use-tooltip-CL3_zAeg.js +1 -0
- package/utils/index.js +1 -13
- package/array.polyfill.flat-DyxysTxZ.js +0 -21
- package/badge-CR5t7-2L.js +0 -8
- package/button-B4bZIgwB.js +0 -83
- package/calendar-D-DWjrMU.js +0 -333
- package/debounce-v8bWAUnY.js +0 -9
- package/dialog-previous-button-EC_Y6KaT.js +0 -370
- package/drawer-DBDktEBZ.js +0 -69
- package/ebay-listbox/README.md +0 -100
- package/ebay-listbox/index.d.ts +0 -4
- package/ebay-listbox/index.d.ts.map +0 -1
- package/ebay-listbox/index.js +0 -6
- package/ebay-listbox/listbox-option-description.d.ts +0 -4
- package/ebay-listbox/listbox-option-description.d.ts.map +0 -1
- package/ebay-listbox/listbox-option.d.ts +0 -10
- package/ebay-listbox/listbox-option.d.ts.map +0 -1
- package/ebay-listbox/listbox.d.ts +0 -21
- package/ebay-listbox/listbox.d.ts.map +0 -1
- package/icon-B17Di3YL.js +0 -56
- package/icon-button-BQWoMgX1.js +0 -31
- package/index-BXizW4ue.js +0 -89
- package/index-DcH7Tjjd.js +0 -272
- package/label-C0AS4fnO.js +0 -19
- package/listbox-DGbY99kq.js +0 -674
- package/menu-Bsy48CE1.js +0 -163
- package/menu-button-CKGsgg6G.js +0 -89
- package/menu-fCOy6wBS.js +0 -29
- package/notice-content-BTXVxttv.js +0 -8
- package/notice-content-BhUeK1pd.js +0 -3
- package/notice-footer-CIQ8SM6N.js +0 -10
- package/progress-spinner-DOFKRtuu.js +0 -20
- package/range-C5qzyhg4.js +0 -3
- package/textbox-J291yCpJ.js +0 -136
- package/use-roving-index-CEM_UsCH.js +0 -58
- package/use-tooltip-7JxcZHJn.js +0 -92
- package/utils/scroll.d.ts +0 -2
- package/utils/scroll.d.ts.map +0 -1
|
@@ -1,36 +1 @@
|
|
|
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 common_componentUtils_utils = require("../common/component-utils/utils/index.js");
|
|
8
|
-
const icon = require("../icon-B17Di3YL.js");
|
|
9
|
-
const EbayInlineNotice = ({ className, status = "general", children, hidden = false, "aria-label": ariaLabel, onNoticeShow = () => {
|
|
10
|
-
}, ...rest }) => {
|
|
11
|
-
React.useEffect(() => {
|
|
12
|
-
if (!hidden) {
|
|
13
|
-
onNoticeShow();
|
|
14
|
-
}
|
|
15
|
-
}, [hidden]);
|
|
16
|
-
if (hidden) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
const content = common_componentUtils_utils.findComponent(children, noticeContent.EbayNoticeContent);
|
|
20
|
-
if (!content) {
|
|
21
|
-
throw new Error(`EbayInlineNotice: Please use a EbayNoticeContent that defines the content of the notice`);
|
|
22
|
-
}
|
|
23
|
-
const isGeneral = status === `general`;
|
|
24
|
-
return React.createElement(
|
|
25
|
-
"div",
|
|
26
|
-
{ ...rest, className: classNames(className, "inline-notice", { [`inline-notice--${status}`]: !isGeneral }) },
|
|
27
|
-
!isGeneral ? React.createElement(
|
|
28
|
-
"span",
|
|
29
|
-
{ className: "inline-notice__header" },
|
|
30
|
-
React.createElement(icon.EbayIcon, { name: `${status}Filled16`, a11yText: ariaLabel, a11yVariant: "label" })
|
|
31
|
-
) : null,
|
|
32
|
-
React.createElement(noticeContent$1.NoticeContent, { ...content.props, type: "inline" })
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
exports.EbayNoticeContent = noticeContent.EbayNoticeContent;
|
|
36
|
-
exports.EbayInlineNotice = EbayInlineNotice;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),E=require("classnames"),c=require("../notice-content-C0ZStfuX.js"),m=require("../notice-content-9iF4T8uB.js"),y=require("../common/component-utils/utils/index.js"),b=require("../icon-TuxfQndO.js"),N=({className:a,status:n="general",children:r,hidden:t=!1,"aria-label":l,onNoticeShow:s=()=>{},...u})=>{if(e.useEffect(()=>{t||s()},[t]),t)return null;const o=y.findComponent(r,c.EbayNoticeContent);if(!o)throw new Error("EbayInlineNotice: Please use a EbayNoticeContent that defines the content of the notice");const i=n==="general";return e.createElement("div",{...u,className:E(a,"inline-notice",{[`inline-notice--${n}`]:!i})},i?null:e.createElement("span",{className:"inline-notice__header"},e.createElement(b.EbayIcon,{name:`${n}Filled16`,a11yText:l,a11yVariant:"label"})),e.createElement(m.NoticeContent,{...o.props,type:"inline"}))};exports.EbayNoticeContent=c.EbayNoticeContent;exports.EbayInlineNotice=N;
|
|
@@ -1,12 +1 @@
|
|
|
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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),a=require("classnames"),c=require("../dialog-previous-button-CpuFLkQp.js");require("../icon-button-Cwaj-eT9.js");const i="lightbox-dialog",r=({open:s,mode:l,size:o,onClose:e=()=>{},...t})=>n.createElement(c.DialogBaseWithState,{buttonPosition:"right",...t,classPrefix:i,onCloseBtnClick:e,onBackgroundClick:e,className:a(t.className,`${i}--mask-fade`,o&&`${i}--${o}`),windowClass:a("lightbox-dialog__window--fade",{[`${i}__window--mini`]:l==="mini"}),open:s});exports.EbayLightboxDialog=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -1,151 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const index = require("../index-DcH7Tjjd.js");
|
|
5
|
-
const classNames = require("classnames");
|
|
6
|
-
const listbox = require("../listbox-DGbY99kq.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", selectClassName: "listbox-button__native", tabIndex: -1, listSelection, name, maxHeight, onChange: handleListboxChange, onEscape: handleListboxEscape }, options.map((option, index2) => React.createElement(listbox.EbayListboxOption, { key: option.props.value || index2, selected: index2 === selectedIndex, className: classNames("listbox-button__option", option.props.className), ...option.props })))
|
|
148
|
-
);
|
|
149
|
-
};
|
|
150
|
-
exports.EbayListboxButton = EbayListboxButton;
|
|
151
|
-
exports.EbayListboxButtonOption = EbayListboxButtonOption;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),O=require("classnames"),$=require("../icon-TuxfQndO.js"),be=require("../common/component-utils/utils/index.js"),F=({value:m,children:y,selected:r,onClick:f,index:d,innerRef:g,className:k,...h})=>{const p=O("listbox-button__option",k,{"listbox-button__option--active":r});return o.createElement("div",{...h,className:p,role:"option","aria-selected":r,ref:g,onClick:v=>{f(v,m,d)}},o.createElement("span",{className:"listbox-button__value"},y),o.createElement($.EbayIcon,{name:"tick16"}))},me=({children:m,name:y,value:r,selected:f,borderless:d,fluid:g,className:k,maxHeight:h,prefixId:p,prefixLabel:v,floatingLabel:x,unselectedText:V="-",onChange:S=()=>{},onCollapse:j=()=>{},onExpand:W=()=>{},...z})=>{var K;const i=o.useRef(null),N=o.useRef(),B=o.useRef(new Map),E=o.useRef(),c=be.filterByType(m,F);if(!c.length)throw new Error(`EbayListboxButton: Please use a
|
|
2
|
+
EbayListboxButtonOption that defines the options of the listbox`);const G=()=>{const e=f!==void 0?f:c.findIndex(({props:s})=>r!==void 0&&s.value===r),t=e>-1||x?e:void 0;return{option:c[t],index:t}},{option:T,index:C}=G(),[a,b]=o.useState(T),[n,D]=o.useState(C),[_,I]=o.useState(),[J,Q]=o.useState(!1),[L,A]=o.useState();o.useEffect(()=>{b(T)},[r]);const l=o.Children.toArray(m),R=e=>l[e].props.value,X=o.useCallback(e=>l.findIndex(({props:t})=>t.value===e),[l]),Y=e=>B.current.get(e),u=()=>{I(!1),j()},Z=()=>{I(!0),W()},ee=()=>{_?u():Z()},H=(e,t)=>{b(l[t]),D(t),u(),E.current.focus(),S(e,{index:t,selected:[R(t)],wasClicked:L}),A(!1)},te=()=>{u(),b(l[C])},oe=e=>{const t=i.current.children[e];t.setAttribute("aria-selected","true"),t.classList.add("listbox-button__option--active")},ne=e=>{const t=i.current.children[e];t.setAttribute("aria-selected","false"),t.classList.remove("listbox-button__option--active")},se=e=>{const t=N.current,s=Y(e);if(t.scrollHeight>t.clientHeight){const pe=t.clientHeight+t.scrollTop,M=s.offsetTop+s.offsetHeight;M>pe?t.scrollTop=M-t.clientHeight:s.offsetTop<t.scrollTop&&(t.scrollTop=s.offsetTop)}},P=e=>{oe(n===void 0||e===-1?0:e),ne(n===void 0||n===-1?0:n),se(e),D(e),b(l[e])},U=e=>setTimeout(()=>{var t;return(t=i==null?void 0:i.current)==null?void 0:t.focus(e)},0),ae=()=>{ee(),U({preventScroll:!0})},ce=e=>{switch(e.key){case"Escape":u();break;case"Enter":U();break}},le=e=>{switch(e.key){case" ":case"PageUp":case"PageDown":case"Home":case"End":e.preventDefault();break;case"Down":case"ArrowDown":e.preventDefault(),n!==c.length-1&&P(n<c.length-1?n+1:0);break;case"Up":case"ArrowUp":e.preventDefault(),n!==0&&P(n>0?n-1:c.length-1);break;case"Enter":u(),setTimeout(()=>b(l[n])),setTimeout(()=>E.current.focus(),0),S(e,{index:n,selected:[R(n)],wasClicked:L});break;case"Esc":case"Escape":te();break}},w=c.map((e,t)=>o.cloneElement(e,{index:t,key:t,selected:a&&e.props.value===a.props.value,id:e.props.id||`listbox_btn_${e.props.value}_${t}`,onClick:s=>H(s,t),innerRef:s=>s?B.current.set(t,s):B.current.delete(t)})),re=O("listbox-button",k,{"listbox-button--fluid":g}),ie=O("btn",{"btn--form":!d,"btn--borderless":d,"btn--floating-label":x&&a}),q=p&&"expand-btn-text",ue=o.createElement(o.Fragment,null,x&&o.createElement("span",{className:"btn__floating-label"},x),v&&o.createElement("span",{className:"btn__label"},v),o.createElement("span",{className:"btn__text",id:q},(a==null?void 0:a.props.children)||V));return o.createElement("span",{className:re},o.createElement("button",{...z,onFocus:()=>Q(!0),type:"button",className:ie,"aria-expanded":!!_,"aria-haspopup":"listbox","aria-labelledby":p&&`${p} ${q}`,onClick:ae,onMouseDown:e=>e.preventDefault(),onKeyUp:ce,ref:E},o.createElement("span",{className:"btn__cell"},ue,o.createElement($.EbayIcon,{name:"chevronDown12"}))),(_||J)&&o.createElement("div",{className:"listbox-button__listbox",ref:N,style:{maxHeight:h}},o.createElement("div",{className:"listbox-button__options",role:"listbox",tabIndex:_?0:-1,ref:i,"aria-activedescendant":(K=w[n])==null?void 0:K.props.id,onKeyDown:e=>le(e),onMouseDown:e=>{e.preventDefault(),A(!0)},onBlur:()=>{u(),setTimeout(()=>E.current.focus(),0)}},w)),o.createElement("select",{hidden:!0,className:"listbox-button__native",name:y,onChange:e=>H(e,X(e.target.value)),value:a?a==null?void 0:a.props.value:""},w.map((e,t)=>o.createElement("option",{value:e.props.value,key:t}))))};exports.EbayListboxButton=me;exports.EbayListboxButtonOption=F;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentProps, FC, MouseEvent, RefObject } from 'react';
|
|
2
|
+
type EbayListboxButtonOptionProps = ComponentProps<'input'> & {
|
|
3
|
+
selected?: boolean;
|
|
4
|
+
index?: number;
|
|
5
|
+
onClick?: (event: MouseEvent<HTMLDivElement>, value: any, index: number) => void;
|
|
6
|
+
innerRef?: RefObject<HTMLDivElement>;
|
|
7
|
+
};
|
|
8
|
+
declare const ListboxOption: FC<EbayListboxButtonOptionProps>;
|
|
9
|
+
export default ListboxOption;
|
|
10
|
+
//# sourceMappingURL=listbox-button-option.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listbox-button-option.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button-option.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIxE,KAAK,4BAA4B,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjF,QAAQ,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;CACxC,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,4BAA4B,CAwBnD,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { EbayChangeEventHandler } from '../events';
|
|
4
|
-
import { EbayButtonProps } from '../ebay-button';
|
|
1
|
+
import { ComponentProps, FC } from 'react';
|
|
2
|
+
import { EbayChangeEventHandler } from '../common/event-utils/types';
|
|
5
3
|
export type ChangeEventProps = {
|
|
6
4
|
index: number;
|
|
7
5
|
selected: string[];
|
|
@@ -16,18 +14,10 @@ export type EbayListboxButtonProps = Omit<ComponentProps<'button'>, 'onChange'>
|
|
|
16
14
|
prefixLabel?: string;
|
|
17
15
|
floatingLabel?: string;
|
|
18
16
|
unselectedText?: string;
|
|
19
|
-
|
|
20
|
-
collapseOnSelect?: boolean;
|
|
21
|
-
hasError?: boolean;
|
|
22
|
-
listSelection?: EbayListboxProps['listSelection'];
|
|
23
|
-
postfixLabel?: string;
|
|
24
|
-
split?: EbayButtonProps['split'];
|
|
25
|
-
truncate?: EbayButtonProps['truncate'];
|
|
26
|
-
variant?: 'form';
|
|
27
|
-
onChange?: EbayChangeEventHandler<HTMLSpanElement, ChangeEventProps>;
|
|
17
|
+
onChange?: EbayChangeEventHandler<HTMLButtonElement, ChangeEventProps>;
|
|
28
18
|
onCollapse?: () => void;
|
|
29
19
|
onExpand?: () => void;
|
|
30
20
|
};
|
|
31
|
-
|
|
32
|
-
export
|
|
21
|
+
declare const ListboxButton: FC<EbayListboxButtonProps>;
|
|
22
|
+
export default ListboxButton;
|
|
33
23
|
//# sourceMappingURL=listbox-button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox-button.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"listbox-button.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button.tsx"],"names":[],"mappings":"AAAA,OAAc,EAEV,cAAc,EAAE,EAAE,EACrB,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,sBAAsB,EAAO,MAAM,6BAA6B,CAAA;AAIzE,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,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,QAAQ,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACvE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,sBAAsB,CA2R7C,CAAA;AAED,eAAe,aAAa,CAAA"}
|
package/ebay-menu/index.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
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
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../menu-CV-INYLM.js"),t=require("react"),n=require("classnames"),u=({className:a,...r})=>t.createElement("hr",{...r,className:n(a,"menu__separator"),role:"separator"});exports.EbayMenu=e.EbayMenu;exports.EbayMenuItem=e.EbayMenuItem;exports.EbayMenuSeparator=u;
|
|
@@ -1,113 +1 @@
|
|
|
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
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("classnames"),y=require("../common/component-utils/utils/index.js"),h=require("../menu-CV-INYLM.js"),Q=require("../button-DGuEBUDJ.js"),X=require("../icon-button-Cwaj-eT9.js"),Y=require("../icon-TuxfQndO.js"),Z=require("../common/random-id/index.js"),ee=require("../common/event-utils/index.js"),ne=({type:t,variant:a="button",className:c,text:m="",fixWidth:d,reverse:i,expanded:x,noToggleIcon:b,checked:u,collapseOnSelect:w,a11yText:N,prefixId:I,prefixLabel:S,onClick:L=()=>{},onExpand:R=()=>{},onCollapse:K=()=>{},onChange:P=()=>{},onSelect:T=()=>{},children:f,...A})=>{const[s,E]=e.useState(x),[_,F]=e.useState(),B=e.useRef(null),k=e.useRef(),M=y.filterByType(f,[h.EbayMenuItem,v]),O=M.map(n=>!!n.props.checked),[p,U]=e.useState(O),W=y.findComponent(f,q),j=y.findComponent(f,Y.EbayIcon),D=te({text:m,prefixId:I,prefixLabel:S,menuButtonLabel:W,icon:j}),V=r("menu-button",c),$=r("menu-button__menu",{"menu-button__menu--fix-width":d,"menu-button__menu--reverse":i});e.useEffect(()=>{const n=o=>{const l=k.current,g=l&&l.contains(o.target);(w||!g)&&E(!1)};return s?(R(),setTimeout(()=>{document.addEventListener("click",n,!1)})):s===!1&&K(),()=>document.removeEventListener("click",n,!1)},[s]),e.useEffect(()=>{F(Z.randomId())},[]);const z=n=>{ee.handleEscapeKeydown(n,()=>{var o;E(!1),(o=B.current)==null||o.focus()})},C={ref:B,className:"menu-button__button","aria-expanded":!!s,"aria-haspopup":!0,"aria-label":N,"aria-controls":_,"aria-labelledby":I,onClick:n=>{E(!s),L(n)},...A},G=(n,o)=>{if(t==="radio"||t==="checkbox"){const l=p.map((g,J)=>o.indexes.includes(J));U(l)}P(n,o)},H=()=>{const n=p.findIndex(Boolean);return n>-1?n:u};return e.createElement("span",{className:V},a==="overflow"?e.createElement(X.EbayIconButton,{icon:"overflowVertical16",...C}):e.createElement(Q.EbayButton,{variant:a==="form"?"form":void 0,bodyState:b?void 0:"expand",...C},D),s&&e.createElement(h.EbayMenu,{baseEl:"div",ref:k,type:t,className:$,tabIndex:-1,id:_,autofocus:!0,checked:H(),onKeyDown:z,onChange:G,onSelect:T},M.map((n,o)=>e.cloneElement(n,{...n.props,className:r(n.props.className,"menu-button__item"),key:o,checked:p[o]}))))};function te({text:t,prefixId:a,prefixLabel:c,menuButtonLabel:m,icon:d}){const i=t.length?e.createElement("span",null,t):null,b=[!a&&c&&[e.createElement("span",{className:"menu-button-prefix-label"},c),e.createElement(e.Fragment,null," ")],m||i],u=[d,b].flat().filter(Boolean);return u.length?u:null}const v=({className:t,...a})=>e.createElement("hr",{...a,className:r(t,"menu-button__separator"),role:"separator"}),q=({children:t})=>e.createElement(e.Fragment,null,t);exports.EbayMenuButtonItem=h.EbayMenuItem;exports.EbayMenuButton=ne;exports.EbayMenuButtonLabel=q;exports.EbayMenuButtonSeparator=v;
|
|
@@ -1,7 +1 @@
|
|
|
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
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),o=require("../notice-content-C0ZStfuX.js"),n=({children:e})=>t.createElement("span",{className:"page-notice__title"},e);exports.EbayNoticeContent=o.EbayNoticeContent;exports.EbayNoticeTitle=n;
|
|
@@ -1,50 +1 @@
|
|
|
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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),p=require("../notice-content-9iF4T8uB.js"),l=require("../notice-content-C0ZStfuX.js"),r=require("../icon-TuxfQndO.js");require("classnames");const s=require("../notice-footer-Cw1DMzoB.js"),u=require("../common/notice-utils/notice-cta/index.js"),C=({id:n,status:e="general",children:a,a11yDismissText:o,"aria-label":E,onDismiss:b=()=>{},...g})=>{const[m,N]=t.useState(!1),i=t.Children.toArray(a).find(c=>c.type===l.EbayNoticeContent);if(!i)throw new Error("EbayPageNotice: Please use a EbayNoticeContent that defines the content of the notice");const d=c=>{N(!0),b(c)};return m?null:t.createElement("section",{...g,"aria-labelledby":n||`${e}-status`,className:`page-notice ${e!=="general"?`page-notice--${e}`:""}`,role:"region"},e!=="general"?t.createElement("div",{className:"page-notice__header",id:n||`${e}-status`},t.createElement(r.EbayIcon,{name:`${e}Filled16`,a11yText:E,a11yVariant:"label"})):null,t.createElement(p.NoticeContent,{...i.props,type:"page"}),a,o&&t.createElement(y,null,t.createElement("button",{"aria-label":o,className:"fake-link page-notice__dismiss",onClick:d},t.createElement(r.EbayIcon,{name:"close16"}))))},P=({className:n,as:e,children:a,...o})=>t.createElement(s.NoticeTitle,{...o,className:n,as:e,type:"page"},a),y=({className:n,children:e})=>t.createElement(s.NoticeFooter,{className:n,type:"page"},e),h=({className:n,children:e})=>t.createElement(u,{className:n,type:"page"},e);exports.EbayNoticeContent=l.EbayNoticeContent;exports.EbayPageNotice=C;exports.EbayPageNoticeCTA=h;exports.EbayPageNoticeFooter=y;exports.EbayPageNoticeTitle=P;
|