@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.
Files changed (153) hide show
  1. package/README.md +2 -2
  2. package/array.polyfill.flat-5BAolFdk.js +1 -0
  3. package/badge-CoHKfiPt.js +1 -0
  4. package/button-DGuEBUDJ.js +1 -0
  5. package/calendar-lAu6VfAb.js +1 -0
  6. package/common/component-utils/forwardRef/index.js +1 -10
  7. package/common/component-utils/index.js +1 -9
  8. package/common/component-utils/utils/index.js +1 -25
  9. package/common/event-utils/index.js +1 -113
  10. package/common/floating-label-utils/hooks/index.js +1 -106
  11. package/common/notice-utils/notice-cta/index.js +1 -5
  12. package/common/random-id/index.js +1 -13
  13. package/common/tooltip-utils/constants/index.js +1 -97
  14. package/common/tooltip-utils/index.js +1 -11
  15. package/debounce-BQsYxxOL.js +1 -0
  16. package/dialog-previous-button-CpuFLkQp.js +1 -0
  17. package/drawer-rqXAEeqd.js +1 -0
  18. package/ebay-alert-dialog/index.js +1 -26
  19. package/ebay-badge/index.js +1 -4
  20. package/ebay-breadcrumbs/index.js +1 -47
  21. package/ebay-button/index.js +1 -5
  22. package/ebay-calendar/index.js +1 -4
  23. package/ebay-carousel/index.js +1 -345
  24. package/ebay-checkbox/index.js +1 -52
  25. package/ebay-confirm-dialog/index.js +1 -28
  26. package/ebay-cta-button/index.js +1 -22
  27. package/ebay-date-textbox/index.js +1 -140
  28. package/ebay-dialog-base/components/animation/index.js +1 -92
  29. package/ebay-dialog-base/components/dialog-footer/index.js +1 -4
  30. package/ebay-dialog-base/components/dialog-header/index.js +1 -4
  31. package/ebay-dialog-base/index.js +1 -13
  32. package/ebay-drawer-dialog/index.js +1 -4
  33. package/ebay-eek/index.js +1 -54
  34. package/ebay-fake-menu/index.js +1 -10
  35. package/ebay-fake-menu/menu-item/index.js +1 -49
  36. package/ebay-fake-menu-button/index.js +1 -7
  37. package/ebay-fake-menu-button/menu-button/index.js +1 -12
  38. package/ebay-fake-tabs/index.js +1 -30
  39. package/ebay-field/index.js +1 -21
  40. package/ebay-fullscreen-dialog/index.js +1 -10
  41. package/ebay-icon/index.js +1 -4
  42. package/ebay-icon/types.d.ts +1 -1
  43. package/ebay-icon/types.d.ts.map +1 -1
  44. package/ebay-icon-button/index.js +1 -4
  45. package/ebay-infotip/index.js +1 -76
  46. package/ebay-inline-notice/index.js +1 -36
  47. package/ebay-lightbox-dialog/index.js +1 -12
  48. package/ebay-listbox-button/index.d.ts +2 -1
  49. package/ebay-listbox-button/index.d.ts.map +1 -1
  50. package/ebay-listbox-button/index.js +2 -151
  51. package/ebay-listbox-button/listbox-button-option.d.ts +10 -0
  52. package/ebay-listbox-button/listbox-button-option.d.ts.map +1 -0
  53. package/ebay-listbox-button/listbox-button.d.ts +5 -15
  54. package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
  55. package/ebay-menu/index.js +1 -9
  56. package/ebay-menu-button/index.js +1 -113
  57. package/ebay-notice-base/index.js +1 -7
  58. package/ebay-page-notice/index.js +1 -50
  59. package/ebay-pagination/index.js +1 -244
  60. package/ebay-panel-dialog/index.js +1 -12
  61. package/ebay-progress-bar/index.js +1 -6
  62. package/ebay-progress-spinner/index.js +1 -4
  63. package/ebay-progress-stepper/index.js +1 -72
  64. package/ebay-radio/index.js +1 -4
  65. package/ebay-radio/radio/index.js +1 -48
  66. package/ebay-section-notice/index.js +1 -69
  67. package/ebay-section-title/index.js +1 -38
  68. package/ebay-segmented-buttons/index.js +1 -46
  69. package/ebay-select/index.js +1 -98
  70. package/ebay-signal/index.js +1 -9
  71. package/ebay-snackbar-dialog/index.js +1 -81
  72. package/ebay-split-button/index.js +1 -22
  73. package/ebay-star-rating/index.js +1 -9
  74. package/ebay-star-rating-select/index.js +1 -55
  75. package/ebay-svg/index.js +1 -5189
  76. package/ebay-svg/symbols.d.ts.map +1 -1
  77. package/ebay-switch/index.js +1 -27
  78. package/ebay-tabs/index.js +1 -88
  79. package/ebay-textbox/index.js +1 -10
  80. package/ebay-toast-dialog/index.js +1 -9
  81. package/ebay-toggle-button/README.md +39 -0
  82. package/ebay-toggle-button/index.d.ts +3 -0
  83. package/ebay-toggle-button/index.d.ts.map +1 -0
  84. package/ebay-toggle-button/index.js +1 -0
  85. package/ebay-toggle-button/toggle-button.d.ts +5 -0
  86. package/ebay-toggle-button/toggle-button.d.ts.map +1 -0
  87. package/ebay-toggle-button/types.d.ts +23 -0
  88. package/ebay-toggle-button/types.d.ts.map +1 -0
  89. package/ebay-toggle-button-group/README.md +56 -0
  90. package/ebay-toggle-button-group/index.d.ts +3 -0
  91. package/ebay-toggle-button-group/index.d.ts.map +1 -0
  92. package/ebay-toggle-button-group/index.js +1 -0
  93. package/ebay-toggle-button-group/toggle-button-group.d.ts +5 -0
  94. package/ebay-toggle-button-group/toggle-button-group.d.ts.map +1 -0
  95. package/ebay-toggle-button-group/types.d.ts +20 -0
  96. package/ebay-toggle-button-group/types.d.ts.map +1 -0
  97. package/ebay-tooltip/index.js +1 -64
  98. package/ebay-tourtip/index.js +1 -54
  99. package/ebay-video/index.js +1 -229
  100. package/events/index.js +1 -18
  101. package/icon-TuxfQndO.js +1 -0
  102. package/icon-button-Cwaj-eT9.js +1 -0
  103. package/label-CnrpYJ-g.js +1 -0
  104. package/menu-CV-INYLM.js +1 -0
  105. package/menu-_LzP6yje.js +1 -0
  106. package/menu-button-BZ66jxvI.js +1 -0
  107. package/notice-content-9iF4T8uB.js +1 -0
  108. package/notice-content-C0ZStfuX.js +1 -0
  109. package/notice-footer-Cw1DMzoB.js +1 -0
  110. package/package.json +2 -5
  111. package/progress-spinner-U2qOANON.js +1 -0
  112. package/range-DOsPN0h5.js +1 -0
  113. package/textbox-dUhinDwj.js +1 -0
  114. package/toggle-button-D8l0YB43.js +1 -0
  115. package/use-roving-index-DoAVBgsp.js +1 -0
  116. package/use-tooltip-CL3_zAeg.js +1 -0
  117. package/utils/index.js +1 -13
  118. package/array.polyfill.flat-DyxysTxZ.js +0 -21
  119. package/badge-CR5t7-2L.js +0 -8
  120. package/button-B4bZIgwB.js +0 -83
  121. package/calendar-D-DWjrMU.js +0 -333
  122. package/debounce-v8bWAUnY.js +0 -9
  123. package/dialog-previous-button-EC_Y6KaT.js +0 -370
  124. package/drawer-DBDktEBZ.js +0 -69
  125. package/ebay-listbox/README.md +0 -100
  126. package/ebay-listbox/index.d.ts +0 -4
  127. package/ebay-listbox/index.d.ts.map +0 -1
  128. package/ebay-listbox/index.js +0 -6
  129. package/ebay-listbox/listbox-option-description.d.ts +0 -4
  130. package/ebay-listbox/listbox-option-description.d.ts.map +0 -1
  131. package/ebay-listbox/listbox-option.d.ts +0 -10
  132. package/ebay-listbox/listbox-option.d.ts.map +0 -1
  133. package/ebay-listbox/listbox.d.ts +0 -21
  134. package/ebay-listbox/listbox.d.ts.map +0 -1
  135. package/icon-B17Di3YL.js +0 -56
  136. package/icon-button-BQWoMgX1.js +0 -31
  137. package/index-BXizW4ue.js +0 -89
  138. package/index-DcH7Tjjd.js +0 -272
  139. package/label-C0AS4fnO.js +0 -19
  140. package/listbox-DGbY99kq.js +0 -674
  141. package/menu-Bsy48CE1.js +0 -163
  142. package/menu-button-CKGsgg6G.js +0 -89
  143. package/menu-fCOy6wBS.js +0 -29
  144. package/notice-content-BTXVxttv.js +0 -8
  145. package/notice-content-BhUeK1pd.js +0 -3
  146. package/notice-footer-CIQ8SM6N.js +0 -10
  147. package/progress-spinner-DOFKRtuu.js +0 -20
  148. package/range-C5qzyhg4.js +0 -3
  149. package/textbox-J291yCpJ.js +0 -136
  150. package/use-roving-index-CEM_UsCH.js +0 -58
  151. package/use-tooltip-7JxcZHJn.js +0 -92
  152. package/utils/scroll.d.ts +0 -2
  153. package/utils/scroll.d.ts.map +0 -1
@@ -1,244 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const ebayFakeMenuButton_menuButton = require("../menu-button-CKGsgg6G.js");
5
- const classNames = require("classnames");
6
- const debounce = require("../debounce-v8bWAUnY.js");
7
- const common_componentUtils_utils = require("../common/component-utils/utils/index.js");
8
- const icon = require("../icon-B17Di3YL.js");
9
- const common_componentUtils_forwardRef = require("../common/component-utils/forwardRef/index.js");
10
- require("../array.polyfill.flat-DyxysTxZ.js");
11
- const MIN_PAGES = 1;
12
- const MAX_PAGES = 9;
13
- const MIN_VISIBLE_ITEMS = 4;
14
- const LEADING_SPACE_WITH_DOT = 2;
15
- const TRAILING_SPACE_WITH_DOT = MAX_PAGES - LEADING_SPACE_WITH_DOT;
16
- function pageNumbersAround(totalPages, selectedPage, maxVisiblePages = totalPages, variant = null) {
17
- const withDots = variant === "show-last" || variant === "overflow" && totalPages > MAX_PAGES;
18
- const hasLeadingDots = variant === "overflow" && totalPages > MAX_PAGES;
19
- const visibleItems = Math.min(maxVisiblePages, totalPages);
20
- const startIndexWithoutDots = Math.max(0, selectedPage - Math.ceil((visibleItems - 1) / 2));
21
- const startIndexWithDots = visibleItems < MIN_VISIBLE_ITEMS ? selectedPage : Math.max(0, selectedPage - Math.floor((visibleItems - 1) / 2));
22
- const endIndex = (withDots ? startIndexWithDots : startIndexWithoutDots) + visibleItems;
23
- const closeToEnd = endIndex >= totalPages;
24
- const closeToFront = selectedPage <= MIN_VISIBLE_ITEMS;
25
- const visibleRangeWithDots = (start, end) => {
26
- const items = visibleRange(totalPages, start, end);
27
- if (visibleItems > 2) {
28
- items[end - 2] = "dots";
29
- items[end - 1] = "hidden";
30
- items[totalPages - 1] = "visible";
31
- } else if (visibleItems > 1) {
32
- items[end - 1] = "dots";
33
- }
34
- return items;
35
- };
36
- const visibleRangeWithOverflowDots = (start, end) => {
37
- if (closeToFront) {
38
- return visibleRangeWithDots(0, end);
39
- } else if (closeToEnd) {
40
- const items2 = visibleRange(totalPages, totalPages - TRAILING_SPACE_WITH_DOT, totalPages);
41
- items2[0] = "visible";
42
- items2[1] = "dots";
43
- return items2;
44
- }
45
- const items = visibleRange(totalPages, selectedPage - LEADING_SPACE_WITH_DOT, selectedPage + LEADING_SPACE_WITH_DOT + 1);
46
- items[0] = "visible";
47
- items[1] = closeToFront ? "visible" : "dots";
48
- items[totalPages - 2] = "dots";
49
- items[totalPages - 1] = "visible";
50
- return items;
51
- };
52
- if (closeToEnd && totalPages <= MAX_PAGES) {
53
- return visibleRange(totalPages, totalPages - visibleItems);
54
- }
55
- if (withDots) {
56
- return hasLeadingDots ? visibleRangeWithOverflowDots(startIndexWithDots, endIndex) : visibleRangeWithDots(startIndexWithDots, endIndex);
57
- }
58
- return visibleRange(totalPages, startIndexWithoutDots, endIndex);
59
- }
60
- function calcPageState(selectedPage, visiblePages, totalPages, variant = "show-range") {
61
- if (selectedPage === -1) {
62
- return [];
63
- }
64
- const adjustedNumPages = variant === "overflow" ? MAX_PAGES : clamp(Math.min(totalPages, visiblePages), MIN_PAGES, MAX_PAGES);
65
- return pageNumbersAround(totalPages, selectedPage - 1, adjustedNumPages, variant);
66
- }
67
- function clamp(n, min, max) {
68
- return n <= min ? min : n >= max ? max : n;
69
- }
70
- function visibleRange(totalItems, start, end) {
71
- return Array(totalItems).fill("hidden").fill("visible", start, end);
72
- }
73
- function getMaxWidth(el) {
74
- if (!el) {
75
- return 0;
76
- }
77
- el.style.width = "100vw";
78
- const result = el.offsetWidth;
79
- el.style.width = null;
80
- return result;
81
- }
82
- const EbayPagination = ({ id = "ebay-pagination", className, a11yCurrentText = "Pagination - Current Page", a11yPreviousText = "Previous page", a11yNextText = "Next page", variant = "show-range", fluid = false, onPrevious = () => {
83
- }, onNext = () => {
84
- }, onSelect = () => {
85
- }, children, ...rest }) => {
86
- const paginationContainerRef = React.useRef(null);
87
- const childPageRefs = React.useRef([]);
88
- childPageRefs.current = React.Children.map(children, React.createRef);
89
- const totalPages = common_componentUtils_utils.filterBy(children, ({ props }) => props.type === void 0 || props.type === "page").length;
90
- const itemWidthRef = React.useRef(0);
91
- const arrowWidthRef = React.useRef(0);
92
- const getNumOfVisiblePageItems = () => {
93
- var _a, _b, _c, _d;
94
- const pageArrowWidth = arrowWidthRef.current || ((_b = (_a = childPageRefs.current[0]) == null ? void 0 : _a.current) == null ? void 0 : _b.offsetWidth);
95
- arrowWidthRef.current = pageArrowWidth;
96
- const pageItemWidth = itemWidthRef.current || ((_d = (_c = childPageRefs.current[1]) == null ? void 0 : _c.current) == null ? void 0 : _d.offsetWidth);
97
- itemWidthRef.current = pageItemWidth;
98
- return pageItemWidth ? Math.floor((getMaxWidth(paginationContainerRef.current) - pageArrowWidth * 2) / pageItemWidth) : 0;
99
- };
100
- const [page, setPage] = React.useState([]);
101
- const [selectedIndex, setSelectedIndex] = React.useState(0);
102
- const updatePages = (selectedPageIndexFromDotMenu) => {
103
- const selectedPageIndex = selectedPageIndexFromDotMenu || childPageRefs.current.findIndex((pageRef) => {
104
- var _a;
105
- return ((_a = pageRef.current) == null ? void 0 : _a.getAttribute("aria-current")) === "page";
106
- });
107
- const visiblePageItems = getNumOfVisiblePageItems();
108
- const pageState = calcPageState(selectedPageIndex, visiblePageItems, totalPages, variant);
109
- setSelectedIndex(selectedPageIndex);
110
- setPage(["hidden", ...pageState]);
111
- };
112
- React.useEffect(() => {
113
- const debouncedUpdate = debounce.debounce(updatePages, 16);
114
- updatePages();
115
- window.addEventListener("resize", () => debouncedUpdate());
116
- return () => {
117
- window.removeEventListener("resize", () => debouncedUpdate());
118
- };
119
- }, [children]);
120
- const createChildItems = (itemType) => {
121
- let pageIndex = 0;
122
- const firstDotItems = [];
123
- const secondDotItems = [];
124
- const allDotItems = [];
125
- const firstDot = page.indexOf("dots");
126
- const lastDot = page.lastIndexOf("dots");
127
- return React.Children.map(children, (item, index) => {
128
- const { type = "page", current, disabled, href, children: text } = item.props;
129
- const isDot = page[index] === "dots";
130
- const key = `${id}-item-${index}`;
131
- const hide = page[index] === "hidden";
132
- const isSeparator = isDot && type === "page";
133
- const newProps = {
134
- current,
135
- disabled,
136
- href,
137
- type: isSeparator ? "separator" : type,
138
- children: isDot ? React.createElement(icon.EbayIcon, { name: "overflowHorizontal24", focusable: false }) : text,
139
- pageIndex: type === "page" ? pageIndex++ : void 0,
140
- key,
141
- hide,
142
- onPrevious,
143
- onNext,
144
- onSelect,
145
- a11yPreviousText,
146
- a11yNextText,
147
- ref: childPageRefs.current[index]
148
- };
149
- if ((hide || isDot) && type === "page") {
150
- const itemComponent = React.createElement(ebayFakeMenuButton_menuButton.EbayFakeMenuButtonItem, { key, href, onClick: (event) => {
151
- if (!href) {
152
- event.preventDefault();
153
- }
154
- const currentTarget = event.currentTarget;
155
- onSelect(event, { value: (currentTarget == null ? void 0 : currentTarget.innerText) || "", index: pageIndex });
156
- updatePages(Number(currentTarget == null ? void 0 : currentTarget.innerText));
157
- } }, text);
158
- if (firstDot === lastDot) {
159
- allDotItems.push(itemComponent);
160
- }
161
- if (selectedIndex - 2 > firstDot && index < selectedIndex) {
162
- firstDotItems.push(itemComponent);
163
- }
164
- if (selectedIndex + 2 < lastDot && index > selectedIndex) {
165
- secondDotItems.push(itemComponent);
166
- }
167
- }
168
- if (itemType === "page" && isDot && variant === "overflow") {
169
- let childComponent = allDotItems;
170
- if (firstDot !== lastDot) {
171
- childComponent = index === 2 ? firstDotItems : secondDotItems;
172
- }
173
- return React.createElement(
174
- "li",
175
- { key },
176
- React.createElement(
177
- "span",
178
- { className: "pagination__item", role: "separator" },
179
- React.createElement(ebayFakeMenuButton_menuButton.EbayMenuButton, { a11yText: "Menu", borderless: true, variant: "overflow", noToggleIcon: true }, childComponent)
180
- )
181
- );
182
- }
183
- return itemType === type ? React.cloneElement(item, newProps) : null;
184
- });
185
- };
186
- const headingId = `${id}-pagination-heading`;
187
- return React.createElement(
188
- "nav",
189
- { ...rest, role: "navigation", className: classNames(className, "pagination", { "pagination--fluid": fluid }), "aria-labelledby": headingId, ref: paginationContainerRef },
190
- React.createElement(
191
- "span",
192
- { "aria-live": "polite", role: "status" },
193
- React.createElement("h2", { className: "clipped", id: headingId }, a11yCurrentText)
194
- ),
195
- createChildItems("previous"),
196
- React.createElement("ol", { className: "pagination__items" }, createChildItems("page")),
197
- createChildItems("next")
198
- );
199
- };
200
- const EbayPaginationItem = ({ pageIndex = 0, key, current, disabled, type = "page", href, hide, children, a11yPreviousText = "Previous page", a11yNextText = "Next page", onSelect, onNext, onPrevious, className, style, forwardedRef, ...rest }) => {
201
- const handlePageNumber = (e) => {
202
- var _a;
203
- onSelect(e, { value: ((_a = e.currentTarget) == null ? void 0 : _a.innerText) || "", index: pageIndex });
204
- };
205
- const handleNextPage = (e) => {
206
- if (!e.currentTarget.getAttribute("aria-disabled")) {
207
- onNext(e);
208
- }
209
- };
210
- const handlePreviousPage = (e) => {
211
- if (!e.currentTarget.getAttribute("aria-disabled")) {
212
- onPrevious(e);
213
- }
214
- };
215
- const isAnchor = !!href;
216
- const ButtonOrAnchor = isAnchor ? "a" : "button";
217
- const iconClassName = isAnchor ? "icon-link" : "icon-btn";
218
- const arrowStyle = { ...style, minWidth: "40px" };
219
- switch (type) {
220
- case "previous":
221
- return React.createElement(
222
- ButtonOrAnchor,
223
- { ...rest, ref: forwardedRef, "aria-disabled": disabled ? "true" : void 0, "aria-label": a11yPreviousText, href: disabled ? void 0 : href, className: classNames(iconClassName, "pagination__previous"), style: arrowStyle, onClick: handlePreviousPage },
224
- React.createElement(icon.EbayIcon, { name: "arrowLeft16" })
225
- );
226
- case "next":
227
- return React.createElement(
228
- ButtonOrAnchor,
229
- { ...rest, ref: forwardedRef, "aria-disabled": disabled ? "true" : void 0, "aria-label": a11yNextText, href: disabled ? void 0 : href, className: classNames(iconClassName, "pagination__next"), style: arrowStyle, onClick: handleNextPage },
230
- React.createElement(icon.EbayIcon, { name: "arrowRight16" })
231
- );
232
- case "separator":
233
- return React.createElement("span", { key, style, className: "pagination__item", ref: forwardedRef, role: "separator" }, children);
234
- default:
235
- return React.createElement(
236
- "li",
237
- { ...rest, hidden: hide },
238
- React.createElement(ButtonOrAnchor, { ref: forwardedRef, "aria-current": current ? "page" : void 0, href, className: "pagination__item", style, key, onClick: handlePageNumber }, children)
239
- );
240
- }
241
- };
242
- const paginationItem = common_componentUtils_forwardRef.withForwardRef(EbayPaginationItem);
243
- exports.EbayPagination = EbayPagination;
244
- exports.EbayPaginationItem = paginationItem;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),J=require("../menu-button-BZ66jxvI.js"),H=require("classnames"),ee=require("../debounce-BQsYxxOL.js"),te=require("../common/component-utils/utils/index.js"),U=require("../icon-TuxfQndO.js"),ne=require("../common/component-utils/forwardRef/index.js");require("../array.polyfill.flat-5BAolFdk.js");const re=1,T=9,K=4,$=2,oe=T-$;function ie(e,n,a=e,s=null){const h=s==="show-last"||s==="overflow"&&e>T,l=s==="overflow"&&e>T,c=Math.min(a,e),v=Math.max(0,n-Math.ceil((c-1)/2)),E=c<K?n:Math.max(0,n-Math.floor((c-1)/2)),m=(h?E:v)+c,d=m>=e,D=n<=K,I=(b,i)=>{const r=k(e,b,i);return c>2?(r[i-2]="dots",r[i-1]="hidden",r[e-1]="visible"):c>1&&(r[i-1]="dots"),r},g=(b,i)=>{if(D)return I(0,i);if(d){const _=k(e,e-oe,e);return _[0]="visible",_[1]="dots",_}const r=k(e,n-$,n+$+1);return r[0]="visible",r[1]=D?"visible":"dots",r[e-2]="dots",r[e-1]="visible",r};return d&&e<=T?k(e,e-c):h?l?g(E,m):I(E,m):k(e,v,m)}function ae(e,n,a,s="show-range"){if(e===-1)return[];const h=s==="overflow"?T:se(Math.min(a,n),re,T);return ie(a,e-1,h,s)}function se(e,n,a){return e<=n?n:e>=a?a:e}function k(e,n,a){return Array(e).fill("hidden").fill("visible",n,a)}function ce(e){if(!e)return 0;e.style.width="100vw";const n=e.offsetWidth;return e.style.width=null,n}const ue=({id:e="ebay-pagination",className:n,a11yCurrentText:a="Pagination - Current Page",a11yPreviousText:s="Previous page",a11yNextText:h="Next page",variant:l="show-range",fluid:c=!1,onPrevious:v=()=>{},onNext:E=()=>{},onSelect:m=()=>{},children:d,...D})=>{const I=t.useRef(null),g=t.useRef([]);g.current=t.Children.map(d,t.createRef);const b=te.filterBy(d,({props:o})=>o.type===void 0||o.type==="page").length,i=t.useRef(0),r=t.useRef(0),_=()=>{var y,N,x,p;const o=r.current||((N=(y=g.current[0])==null?void 0:y.current)==null?void 0:N.offsetWidth);r.current=o;const f=i.current||((p=(x=g.current[1])==null?void 0:x.current)==null?void 0:p.offsetWidth);return i.current=f,f?Math.floor((ce(I.current)-o*2)/f):0},[A,L]=t.useState([]),[w,q]=t.useState(0),S=o=>{const f=o||g.current.findIndex(x=>{var p;return((p=x.current)==null?void 0:p.getAttribute("aria-current"))==="page"}),y=_(),N=ae(f,y,b,l);q(f),L(["hidden",...N])};t.useEffect(()=>{const o=ee.debounce(S,16);return S(),window.addEventListener("resize",()=>o()),()=>{window.removeEventListener("resize",()=>o())}},[d]);const W=o=>{let f=0;const y=[],N=[],x=[],p=A.indexOf("dots"),F=A.lastIndexOf("dots");return t.Children.map(d,(j,M)=>{const{type:O="page",current:Q,disabled:Y,href:G,children:V}=j.props,B=A[M]==="dots",P=`${e}-item-${M}`,X=A[M]==="hidden",Z={current:Q,disabled:Y,href:G,type:B&&O==="page"?"separator":O,children:B?t.createElement(U.EbayIcon,{name:"overflowHorizontal24",focusable:!1}):V,pageIndex:O==="page"?f++:void 0,key:P,hide:X,onPrevious:v,onNext:E,onSelect:m,a11yPreviousText:s,a11yNextText:h,ref:g.current[M]};if((X||B)&&O==="page"){const C=t.createElement(J.EbayFakeMenuButtonItem,{key:P,href:G,onClick:z=>{G||z.preventDefault();const R=z.currentTarget;m(z,{value:(R==null?void 0:R.innerText)||"",index:f}),S(Number(R==null?void 0:R.innerText))}},V);p===F&&x.push(C),w-2>p&&M<w&&y.push(C),w+2<F&&M>w&&N.push(C)}if(o==="page"&&B&&l==="overflow"){let C=x;return p!==F&&(C=M===2?y:N),t.createElement("li",{key:P},t.createElement("span",{className:"pagination__item",role:"separator"},t.createElement(J.EbayMenuButton,{a11yText:"Menu",borderless:!0,variant:"overflow",noToggleIcon:!0},C)))}return o===O?t.cloneElement(j,Z):null})},u=`${e}-pagination-heading`;return t.createElement("nav",{...D,role:"navigation",className:H(n,"pagination",{"pagination--fluid":c}),"aria-labelledby":u,ref:I},t.createElement("span",{"aria-live":"polite",role:"status"},t.createElement("h2",{className:"clipped",id:u},a)),W("previous"),t.createElement("ol",{className:"pagination__items"},W("page")),W("next"))},le=({pageIndex:e=0,key:n,current:a,disabled:s,type:h="page",href:l,hide:c,children:v,a11yPreviousText:E="Previous page",a11yNextText:m="Next page",onSelect:d,onNext:D,onPrevious:I,className:g,style:b,forwardedRef:i,...r})=>{const _=u=>{var o;d(u,{value:((o=u.currentTarget)==null?void 0:o.innerText)||"",index:e})},A=u=>{u.currentTarget.getAttribute("aria-disabled")||D(u)},L=u=>{u.currentTarget.getAttribute("aria-disabled")||I(u)},w=!!l,q=w?"a":"button",S=w?"icon-link":"icon-btn",W={...b,minWidth:"40px"};switch(h){case"previous":return t.createElement(q,{...r,ref:i,"aria-disabled":s?"true":void 0,"aria-label":E,href:s?void 0:l,className:H(S,"pagination__previous"),style:W,onClick:L},t.createElement(U.EbayIcon,{name:"arrowLeft16"}));case"next":return t.createElement(q,{...r,ref:i,"aria-disabled":s?"true":void 0,"aria-label":m,href:s?void 0:l,className:H(S,"pagination__next"),style:W,onClick:A},t.createElement(U.EbayIcon,{name:"arrowRight16"}));case"separator":return t.createElement("span",{key:n,style:b,className:"pagination__item",ref:i,role:"separator"},v);default:return t.createElement("li",{...r,hidden:c},t.createElement(q,{ref:i,"aria-current":a?"page":void 0,href:l,className:"pagination__item",style:b,key:n,onClick:_},v))}},me=ne.withForwardRef(le);exports.EbayPagination=ue;exports.EbayPaginationItem=me;
@@ -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 = "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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),t=require("classnames"),c=require("../dialog-previous-button-CpuFLkQp.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,6 +1 @@
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
+ "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,4 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../progress-spinner-U2qOANON.js");exports.EbayProgressSpinner=e.EbayProgressSpinner;
@@ -1,72 +1 @@
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
+ "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,4 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./radio/index.js");exports.EbayRadio=e;
@@ -1,48 +1 @@
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
+ "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,69 +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 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
+ "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,38 +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 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
+ "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,46 +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 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
+ "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=_;