@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.
Files changed (119) hide show
  1. package/array.polyfill.flat-DyxysTxZ.js +21 -0
  2. package/badge-CR5t7-2L.js +8 -0
  3. package/button-B4bZIgwB.js +83 -0
  4. package/calendar-D-DWjrMU.js +333 -0
  5. package/common/component-utils/forwardRef/index.js +10 -1
  6. package/common/component-utils/index.js +9 -1
  7. package/common/component-utils/utils/index.js +25 -1
  8. package/common/event-utils/index.js +113 -1
  9. package/common/floating-label-utils/hooks/index.js +106 -1
  10. package/common/notice-utils/notice-cta/index.js +5 -1
  11. package/common/random-id/index.js +13 -1
  12. package/common/tooltip-utils/constants/index.js +97 -1
  13. package/common/tooltip-utils/index.js +11 -1
  14. package/debounce-v8bWAUnY.js +9 -0
  15. package/dialog-previous-button-EC_Y6KaT.js +370 -0
  16. package/drawer-DBDktEBZ.js +69 -0
  17. package/ebay-alert-dialog/index.js +26 -1
  18. package/ebay-badge/index.js +4 -1
  19. package/ebay-breadcrumbs/index.js +47 -1
  20. package/ebay-button/index.js +5 -1
  21. package/ebay-calendar/index.js +4 -1
  22. package/ebay-carousel/index.js +345 -1
  23. package/ebay-checkbox/index.js +52 -1
  24. package/ebay-confirm-dialog/index.js +28 -1
  25. package/ebay-cta-button/index.js +22 -1
  26. package/ebay-date-textbox/index.js +140 -1
  27. package/ebay-dialog-base/components/animation/index.js +92 -1
  28. package/ebay-dialog-base/components/dialog-footer/index.js +4 -1
  29. package/ebay-dialog-base/components/dialog-header/index.js +4 -1
  30. package/ebay-dialog-base/index.js +13 -1
  31. package/ebay-drawer-dialog/index.js +4 -1
  32. package/ebay-eek/index.js +54 -1
  33. package/ebay-fake-menu/index.js +10 -1
  34. package/ebay-fake-menu/menu-item/index.js +49 -1
  35. package/ebay-fake-menu-button/index.js +7 -1
  36. package/ebay-fake-menu-button/menu-button/index.js +12 -1
  37. package/ebay-fake-tabs/index.js +30 -1
  38. package/ebay-field/index.js +21 -1
  39. package/ebay-fullscreen-dialog/index.js +10 -1
  40. package/ebay-icon/index.js +4 -1
  41. package/ebay-icon-button/index.js +4 -1
  42. package/ebay-infotip/index.js +76 -1
  43. package/ebay-inline-notice/index.js +36 -1
  44. package/ebay-lightbox-dialog/index.js +12 -1
  45. package/ebay-listbox/index.js +6 -1
  46. package/ebay-listbox/listbox.d.ts.map +1 -1
  47. package/ebay-listbox-button/index.js +151 -1
  48. package/ebay-menu/index.js +9 -1
  49. package/ebay-menu-button/index.js +113 -1
  50. package/ebay-notice-base/index.js +7 -1
  51. package/ebay-page-notice/index.js +50 -1
  52. package/ebay-pagination/index.js +244 -1
  53. package/ebay-panel-dialog/index.js +12 -1
  54. package/ebay-progress-bar/index.js +6 -1
  55. package/ebay-progress-spinner/index.js +4 -1
  56. package/ebay-progress-stepper/index.js +72 -1
  57. package/ebay-radio/index.js +4 -1
  58. package/ebay-radio/radio/index.js +48 -1
  59. package/ebay-section-notice/index.js +69 -1
  60. package/ebay-section-title/index.js +38 -1
  61. package/ebay-segmented-buttons/index.js +46 -1
  62. package/ebay-select/index.js +98 -1
  63. package/ebay-signal/index.js +9 -1
  64. package/ebay-snackbar-dialog/index.js +81 -1
  65. package/ebay-split-button/index.js +22 -1
  66. package/ebay-star-rating/index.js +9 -1
  67. package/ebay-star-rating-select/index.js +55 -1
  68. package/ebay-svg/index.js +5189 -1
  69. package/ebay-switch/index.js +27 -1
  70. package/ebay-tabs/index.js +88 -1
  71. package/ebay-textbox/index.js +10 -1
  72. package/ebay-toast-dialog/index.js +9 -1
  73. package/ebay-tooltip/index.js +64 -1
  74. package/ebay-tourtip/index.js +54 -1
  75. package/ebay-video/index.js +229 -1
  76. package/events/index.js +18 -1
  77. package/icon-B17Di3YL.js +56 -0
  78. package/icon-button-BQWoMgX1.js +31 -0
  79. package/index-BXizW4ue.js +89 -0
  80. package/index-DcH7Tjjd.js +272 -0
  81. package/label-C0AS4fnO.js +19 -0
  82. package/listbox-DGbY99kq.js +674 -0
  83. package/menu-Bsy48CE1.js +163 -0
  84. package/menu-button-CKGsgg6G.js +89 -0
  85. package/menu-fCOy6wBS.js +29 -0
  86. package/notice-content-BTXVxttv.js +8 -0
  87. package/notice-content-BhUeK1pd.js +3 -0
  88. package/notice-footer-CIQ8SM6N.js +10 -0
  89. package/package.json +1 -1
  90. package/progress-spinner-DOFKRtuu.js +20 -0
  91. package/range-C5qzyhg4.js +3 -0
  92. package/textbox-J291yCpJ.js +136 -0
  93. package/use-roving-index-CEM_UsCH.js +58 -0
  94. package/use-tooltip-7JxcZHJn.js +92 -0
  95. package/utils/index.js +13 -1
  96. package/array.polyfill.flat-5BAolFdk.js +0 -1
  97. package/badge-CoHKfiPt.js +0 -1
  98. package/button-DGuEBUDJ.js +0 -1
  99. package/calendar-lAu6VfAb.js +0 -1
  100. package/debounce-BQsYxxOL.js +0 -1
  101. package/dialog-previous-button-5cTKpmJ-.js +0 -1
  102. package/drawer-xTtCoO3F.js +0 -1
  103. package/icon-TuxfQndO.js +0 -1
  104. package/icon-button-Cwaj-eT9.js +0 -1
  105. package/index-D3xZmuzJ.js +0 -1
  106. package/index-Dkz0UnlJ.js +0 -1
  107. package/label-CnrpYJ-g.js +0 -1
  108. package/listbox-Ck3BxDm4.js +0 -1
  109. package/menu-CV-INYLM.js +0 -1
  110. package/menu-_LzP6yje.js +0 -1
  111. package/menu-button-BZ66jxvI.js +0 -1
  112. package/notice-content-9iF4T8uB.js +0 -1
  113. package/notice-content-C0ZStfuX.js +0 -1
  114. package/notice-footer-Cw1DMzoB.js +0 -1
  115. package/progress-spinner-U2qOANON.js +0 -1
  116. package/range-DOsPN0h5.js +0 -1
  117. package/textbox-dUhinDwj.js +0 -1
  118. package/use-roving-index-DoAVBgsp.js +0 -1
  119. package/use-tooltip-CL3_zAeg.js +0 -1
@@ -1 +1,12 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),t=require("classnames"),c=require("../dialog-previous-button-5cTKpmJ-.js");require("../icon-button-Cwaj-eT9.js");const e="panel-dialog",d=({open:i,animated:a,position:s="start",onClose:o=()=>{},className:l,...n})=>r.createElement(c.DialogBaseWithState,{...n,"aria-label":"Infotip",classPrefix:e,buttonPosition:"right",onCloseBtnClick:o,onBackgroundClick:o,animated:a,className:t(l,{[`${e}--mask-fade-slow`]:a}),windowClass:t(`${e}__window--slide`,{[`${e}__window--end`]:s==="end"}),open:i});exports.EbayPanelDialog=d;
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),c=require("classnames"),g=({value:e=0,max:r=100,fluid:s,className:a,...o})=>t.createElement("progress",{...o,className:c("progress-bar",a,{"progress-bar--fluid":s}),value:e,max:r});exports.EbayProgressBar=g;
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../progress-spinner-U2qOANON.js");exports.EbayProgressSpinner=e.EbayProgressSpinner;
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),g=require("classnames"),E=require("../icon-TuxfQndO.js"),d=({direction:t="row",defaultState:r="active",children:s,className:o,...i})=>{const a=e.Children.toArray(s),c=f(a,r);return e.createElement("div",{...i,className:g(o,"progress-stepper",{"progress-stepper--vertical":t==="column"})},e.createElement("div",{role:"list",className:"progress-stepper__items"},a.map((p,n)=>e.createElement(e.Fragment,{key:n},n>0&&e.createElement("hr",{className:"progress-stepper__separator",role:"presentation"}),e.cloneElement(p,{state:_(n,c),...p.props,current:c===n})))))};function f(t,r){const s=t.findIndex(o=>o.props.current);if(s===-1)switch(r){case"complete":return t.length-1;case"upcoming":return 0}return s}function _(t,r){if(t<=r)return"complete";if(t>r)return"upcoming"}const b={complete:"stepperConfirmation24",attention:"stepperAttention24",upcoming:"stepperUpcoming24",active:"stepperConfirmation24"},v=({current:t,state:r="complete",children:s,className:o,...i})=>{const a=e.Children.toArray(s),c=a.find(l=>l.type===m),p=a.filter(l=>l.type!==m),n=g(o,"progress-stepper__item",{"progress-stepper__item--attention":r==="attention"}),u=b[r],y=t?"current":r;return e.createElement("div",{...i,className:n,role:"listitem","aria-current":t?"step":void 0},e.createElement("div",{className:"progress-stepper__icon"},u&&e.createElement(E.EbayIcon,{name:u,"aria-label":y})),e.createElement("div",{className:"progress-stepper__text"},c,p))},m=({as:t="h4",children:r})=>e.createElement(t,{},r);exports.EbayProgressStep=v;exports.EbayProgressStepper=d;exports.EbayProgressTitle=m;
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;
@@ -1 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./radio/index.js");exports.EbayRadio=e;
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";const e=require("react"),N=require("classnames"),c=require("../../icon-TuxfQndO.js"),v=require("../../label-CnrpYJ-g.js"),I=({size:r="default",checked:s,defaultChecked:d,className:i,style:m,id:o,onChange:u=()=>{},onFocus:h=()=>{},onKeyDown:y=()=>{},children:l,...E})=>{const _=a=>{var n;return u(a,{value:(n=a.target)==null?void 0:n.value})},g=a=>{var n;return h(a,{value:(n=a.target)==null?void 0:n.value})},k=a=>{const n=a.target;return y(a,{value:n==null?void 0:n.value})},b=N("radio",i,{"radio--large":r==="large"}),p=r==="large"?e.createElement(c.EbayIcon,{name:"radioChecked24",className:"radio__checked"}):e.createElement(c.EbayIcon,{name:"radioChecked18",className:"radio__checked"}),C=r==="large"?e.createElement(c.EbayIcon,{name:"radioUnchecked24",className:"radio__unchecked"}):e.createElement(c.EbayIcon,{name:"radioUnchecked18",className:"radio__unchecked"}),t=e.Children.toArray(l).find(a=>a.type===v.Label);return e.createElement(e.Fragment,null,e.createElement("span",{className:b,style:{...m,alignItems:"center"}},e.createElement("input",{...E,id:o,className:"radio__control",type:"radio",defaultChecked:d,checked:s,onChange:_,onFocus:g,onKeyDown:k}),e.createElement("span",{className:"radio__icon",hidden:!0},p,C)),t?e.cloneElement(t,{...t.props,position:"end",htmlFor:o}):l)};module.exports=I;
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),I=require("classnames"),y=require("../notice-content-C0ZStfuX.js"),T=require("../notice-content-9iF4T8uB.js"),E=require("../icon-TuxfQndO.js"),A=require("../common/random-id/index.js"),b=require("../notice-footer-Cw1DMzoB.js"),F=require("../common/notice-utils/notice-cta/index.js"),k=({status:t="general",children:n,className:a,"aria-label":o,"aria-roledescription":u="Notice",a11yDismissText:s,educationIcon:S,iconClass:C,prominent:f,onDismiss:h=()=>{},...p})=>{const[g,q]=e.useState(!1),[d,_]=e.useState("");e.useEffect(()=>{_(A.randomId())},[]);const m=e.Children.toArray(n).find(({type:l})=>l===y.EbayNoticeContent),c=t!=="general"&&t!=="none",r=t==="education";let i=null;if(c&&(r?i=S||"lightbulb24":i=`${t}Filled16`),!m)throw new Error("EbaySectionNotice: Please use a EbayNoticeContent that defines the content of the notice");const $=l=>{q(!0),h(l)};return g?null:e.createElement("section",{...p,className:I(a,"section-notice",{[`section-notice--${t}`]:c,"section-notice--education":r&&f,"section-notice--large-icon":r}),role:"region","aria-label":c?null:o,"aria-labelledby":c?`section-notice-${t}-${d}`:null,"aria-roledescription":u},i&&e.createElement("div",{className:"section-notice__header",id:`section-notice-${t}-${d}`},e.createElement(E.EbayIcon,{className:C,name:i,a11yText:o,a11yVariant:"label"})),e.createElement(T.NoticeContent,{...m.props,type:"section"}),n,s&&e.createElement(N,null,e.createElement("button",{"aria-label":s,className:"fake-link page-notice__dismiss",onClick:$},e.createElement(E.EbayIcon,{name:"close16"}))))},v=({className:t,as:n,children:a,...o})=>e.createElement(b.NoticeTitle,{...o,className:t,as:n,type:"section"},a),N=({className:t,children:n})=>e.createElement(b.NoticeFooter,{className:t,type:"section"},n),w=({className:t,children:n})=>e.createElement(F,{className:t,type:"section"},n);exports.EbayNoticeContent=y.EbayNoticeContent;exports.EbaySectionNotice=k;exports.EbaySectionNoticeCTA=w;exports.EbaySectionNoticeFooter=N;exports.EbaySectionNoticeTitle=v;
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),l=require("classnames"),s=require("../common/component-utils/utils/index.js"),v=({ctaText:e,href:t,className:n,...i})=>e?o.createElement("a",{...i,className:l("section-title__cta",n),href:t},e):null,T=({href:e,ctaText:t,className:n,children:i,...u})=>{const E=l(n,"section-title"),_=s.findComponent(i,c),f=s.findComponent(i,a),b=s.findComponent(i,m),S=s.findComponent(i,r);return o.createElement("div",{...u,className:E},o.createElement("div",{className:"section-title__title-container"},_||o.createElement(c,null,i),f),e&&o.createElement(v,{href:e,ctaText:t})||b||S)},c=({children:e,className:t,...n})=>o.createElement("h2",{...n,className:l(t,"section-title__title")},e),a=({children:e,className:t,...n})=>o.createElement("span",{...n,className:l(t,"section-title__subtitle")},e),m=({className:e,children:t,...n})=>o.createElement("div",{...n,className:l(e,"section-title__info")},t),r=({children:e,className:t,...n})=>o.createElement("div",{...n,className:l(t,"section-title__overflow")},e);exports.EbaySectionTitle=T;exports.EbaySectionTitleInfo=m;exports.EbaySectionTitleOverflow=r;exports.EbaySectionTitleSubtitle=a;exports.EbaySectionTitleTitle=c;
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),b=require("classnames"),d=require("../common/component-utils/utils/index.js"),i=require("../icon-TuxfQndO.js"),p=({selected:s,children:n,className:u,...a})=>{const c=d.findComponent(n,i.EbayIcon),l=()=>{const r=d.excludeComponent(n,i.EbayIcon);return e.createElement("span",{className:"segmented-buttons__button-cell"},c,e.createElement("span",null,r))};return e.createElement("li",null,e.createElement("button",{className:b("segmented-buttons__button",u),"aria-current":s||void 0,...a},c?l():n))},_=({size:s,className:n,onChange:u=()=>{},children:a,...c})=>{const l=d.filterByType(a,p),[r,E]=e.useState(l.findIndex(t=>t.props.selected)||0),g=(t,o,m)=>{E(o),u(t,{index:o,value:m})};return e.createElement("div",{className:b("segmented-buttons",s&&`segmented-buttons--${s}`,n),...c},e.createElement("ul",null,l.map((t,o)=>{const{value:m,...y}=t.props;return e.cloneElement(t,{...y,onClick:S=>g(S,o,m),selected:o===r})})))};exports.EbaySegmentedButton=p;exports.EbaySegmentedButtons=_;
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;
@@ -1 +1,98 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),L=require("classnames"),R=require("../icon-TuxfQndO.js"),U=require("../common/component-utils/forwardRef/index.js"),j=require("../common/component-utils/utils/index.js"),x=require("../common/floating-label-utils/hooks/index.js"),d=({children:e,...t})=>n.createElement("option",{...t},e),v=e=>typeof e<"u",P=({value:e,defaultValue:t,className:s,borderless:o,name:p,disabled:r,onChange:a=()=>{},onBlur:h=()=>{},onFocus:m=()=>{},floatingLabel:f,forwardedRef:b,children:y,inputSize:l,invalid:E,...u})=>{const c=E||u["aria-invalid"]==="true",[F,w]=n.useState(t),{label:C,Container:G,onBlur:S,onFocus:N,ref:O}=x.useFloatingLabel({ref:b,inputId:u.id,className:s,disabled:r,label:f,inputValue:e,inputSize:l,invalid:c}),q=i=>{const{value:g,selectedIndex:I}=i.target;v(e)||w(g),a(i,{index:I,selected:[g]})},_=i=>{h(i),S()},B=i=>{m(i),N()},k=L("select",s,{"select--borderless":o,"select--large":l==="large"});return n.createElement(G,null,C,n.createElement("span",{className:k},n.createElement("select",{...u,name:p,value:v(e)?e:F,disabled:r,onChange:q,onBlur:_,onFocus:B,ref:O},M(y)),n.createElement(R.EbayIcon,{name:"chevronDown12",height:"8",width:"8"})))},T=U.withForwardRef(P);function D(e){const t={};return e.forEach(s=>{const o=s.props;o.optgroup&&(Object.prototype.hasOwnProperty.call(t,o.optgroup)||(t[o.optgroup]=[]),t[o.optgroup].push(o))}),t}function M(e){const t=[],s=[];let o={},p=!1;const r=j.filterByType(e,d).map(a=>n.cloneElement(a,{}));if(r){o=D(r);let a;return r.forEach((h,m)=>{const{value:f,optionClassName:b,children:y,optgroup:l}=h.props;if(p=l&&t.indexOf(l)===-1,p){a=l;const u=o[a].map(c=>n.createElement(d,{key:`opt-${c.value}`,value:c.value,className:c.optionClassName},c.children));s.push(n.createElement("optgroup",{key:m,label:l},u)),t.push(l)}else l||s.push(n.createElement(d,{key:m,value:f,className:b},y))}),s}}exports.EbaySelect=T;exports.EbaySelectOption=d;
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;
@@ -1 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),t=require("classnames"),l=({status:a="neutral",...e})=>{const s=t(`signal signal--${a}`,e.className);return n.createElement("span",{...e,className:s})};exports.EbaySignal=l;
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("classnames"),e=require("react"),k=require("../dialog-previous-button-5cTKpmJ-.js");require("../icon-button-Cwaj-eT9.js");const f=({className:r,children:c,...l})=>e.createElement("button",{className:D(r,"fake-link"),...l},c),L=6e3,N=({className:r,onOpen:c=()=>{},onClose:l=()=>{},layout:S,open:i,children:h,onAction:u,...T})=>{const n=e.useRef(new Set),b=e.useRef(),[C,m]=e.useState(i),g=e.Children.toArray(h),o=g.find(t=>t.type===f),p=g.filter(t=>t.type!==f),s=()=>{clearTimeout(b.current)},d=()=>{m(!1),l()},E=()=>{n.current.size===0&&(s(),b.current=setTimeout(()=>{d()},L))},M=()=>{m(!0),c(),E()},q=()=>{s(),n.current.add("focus")},w=()=>{n.current.delete("focus"),E()},R=()=>{s(),n.current.add("mouseEnter")},v=()=>{n.current.delete("mouseEnter"),E()},B=t=>{var a,y;s(),u==null||u(t),(y=(a=o==null?void 0:o.props)==null?void 0:a.onClick)==null||y.call(a,t),d()};return e.useEffect(()=>()=>{s()},[]),e.useEffect(()=>{i?M():d()},[i]),e.createElement(k.DialogBaseWithState,{...T,open:C,isModal:!1,baseEl:"aside",classPrefix:"snackbar-dialog",transitionElement:"root",a11yCloseText:"",buttonPosition:"hidden",className:D(r,"snackbar-dialog--transition"),windowClass:S==="column"&&"snackbar-dialog__window--column",onFocus:q,onBlur:w,onMouseEnter:R,onMouseLeave:v},p,o?e.createElement(k.EbayDialogActions,null,e.cloneElement(o,{onClick:B})):null)};exports.EbaySnackbarDialog=N;exports.EbaySnackbarDialogAction=f;
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),a=require("../common/component-utils/utils/index.js"),B=require("../button-DGuEBUDJ.js"),i=require("../ebay-menu-button/index.js"),q=require("../menu-CV-INYLM.js");require("classnames");const M=({a11yMenuText:u,children:r,type:s,bodyState:t,a11yButtonLoadingText:l,onCollapse:c,onExpand:p,onSelect:b=()=>{},onChange:m=()=>{},ref:f,...e})=>{const o=[q.EbayMenuItem,i.EbayMenuButtonSeparator],y=a.filterBy(r,E=>!o.includes(E.type)),d=a.filterByType(r,o);return n.createElement("span",{className:"split-button"},n.createElement(B.EbayButton,{"aria-label":t==="loading"?l:void 0,...e,split:"start",bodyState:t==="expand"?void 0:t},y),n.createElement(i.EbayMenuButton,{priority:e.priority,disabled:e.disabled,transparent:e.transparent,size:e.size,type:s,split:"end",reverse:!0,a11yText:u,onCollapse:c,onExpand:p,onSelect:b,onChange:m},d))};exports.EbaySplitButton=M;
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),c=require("classnames"),i=require("../icon-TuxfQndO.js"),o=require("../range-DOsPN0h5.js"),l=o.range(1,5),m=({value:e,a11yText:t,className:r,...s})=>a.createElement("div",{role:"img","aria-label":t,className:c("star-rating",r),"data-stars":e,...s},l.map(n=>a.createElement(i.EbayIcon,{key:n,className:"star-rating__icon",name:"starDynamic"})));exports.EbayStarRating=m;
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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),u=require("classnames"),v=require("../icon-TuxfQndO.js"),y=require("../range-DOsPN0h5.js"),I=require("../common/random-id/index.js"),b=y.range(1,5),r=n=>{let a=parseInt(n,0)||0;return a>5&&(a=0),a},C=({value:n=0,a11yText:a,className:m,a11yStarText:l=[],disabled:s,onChange:g=()=>{},onFocus:d=()=>{},onKeyDown:_=()=>{},name:f,...p})=>{const E=I.useRandomId(),N=f||`star-rating-${E}`,[i,o]=t.useState(r(n));t.useEffect(()=>{o(r(n))},[n]);const h=e=>c=>{s||(o(r(e)),_(c,{value:e}))},k=e=>c=>{s||(o(r(e)),g(c,{value:e}))},q=e=>c=>{s||(o(r(e)),d(c,{value:e}))};return t.createElement("div",{role:a&&"radiogroup","aria-label":a,className:u("star-rating-select",m),...p},b.map(e=>t.createElement("span",{className:"star-rating-select__radio",key:e},t.createElement("input",{"aria-label":l==null?void 0:l[e-1],className:u("star-rating-select__control",{"star-rating-select__control--filled":e<=i}),type:"radio",name:N,value:e,disabled:s,defaultChecked:i===e,onClick:k(e),onFocus:q(e),onKeyDown:h(e)}),t.createElement("span",{className:"star-rating-select__radio-icon"},t.createElement(v.EbayIcon,{className:"star-rating__icon",name:"starDynamic"})))))};exports.EbayStarRatingSelect=C;
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;