@ebay/ui-core-react 7.4.0-alpha.9 → 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 -22
  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-DfOw_fJc.js +0 -662
  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,370 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const reactRemoveScroll = require("react-remove-scroll");
4
- const classNames = require("classnames");
5
- const icon = require("./icon-B17Di3YL.js");
6
- const common_randomId = require("./common/random-id/index.js");
7
- const ebayDialogBase_components_animation = require("./ebay-dialog-base/components/animation/index.js");
8
- const ebayDialogBase_components_dialogHeader = require("./ebay-dialog-base/components/dialog-header/index.js");
9
- const ebayDialogBase_components_dialogFooter = require("./ebay-dialog-base/components/dialog-footer/index.js");
10
- const iconButton = require("./icon-button-BQWoMgX1.js");
11
- const EbayDialogCloseButton = ({ children }) => React.createElement(React.Fragment, null, children);
12
- const filterAncestor = (item) => item.nodeType === 1 && item.tagName.toLowerCase() !== "body" && item.tagName.toLowerCase() !== "html";
13
- const filterSibling = (item) => item.nodeType === 1 && item.tagName.toLowerCase() !== "script";
14
- const flattenArrays = (a, b) => a.concat(b);
15
- function getPreviousSiblings(el, siblings = []) {
16
- const previousSibling = el.previousSibling;
17
- if (!previousSibling) {
18
- return siblings;
19
- }
20
- siblings.push(previousSibling);
21
- return getPreviousSiblings(previousSibling, siblings);
22
- }
23
- function getNextSiblings(el, siblings = []) {
24
- const nextSibling = el.nextSibling;
25
- if (!nextSibling) {
26
- return siblings;
27
- }
28
- siblings.push(nextSibling);
29
- return getNextSiblings(nextSibling, siblings);
30
- }
31
- function getSiblings(el) {
32
- const allSiblings = getPreviousSiblings(el).concat(getNextSiblings(el));
33
- return allSiblings.filter(filterSibling);
34
- }
35
- function getAllAncestors(el, ancestors = []) {
36
- const nextAncestor = el.parentNode;
37
- if (!nextAncestor) {
38
- return ancestors;
39
- }
40
- ancestors.push(nextAncestor);
41
- return getAllAncestors(nextAncestor, ancestors);
42
- }
43
- function getAncestors(el) {
44
- return getAllAncestors(el).filter(filterAncestor);
45
- }
46
- function getSiblingsOfAncestors(el) {
47
- return getAncestors(el).map((item) => getSiblings(item)).reduce(flattenArrays, []);
48
- }
49
- let mainEl;
50
- let trappedEl$1;
51
- let dirtyObjects;
52
- const filterSvg = (item) => item.tagName.toLowerCase() !== "svg";
53
- function showElementPrep(el, useHiddenProperty) {
54
- let preparedElement;
55
- if (useHiddenProperty === false) {
56
- preparedElement = prepareElement(el, "aria-hidden", "false");
57
- } else {
58
- preparedElement = prepareElement(el, "hidden", false);
59
- }
60
- return preparedElement;
61
- }
62
- function hideElementPrep(el, useHiddenProperty) {
63
- let preparedElement;
64
- if (useHiddenProperty === false) {
65
- preparedElement = prepareElement(el, "aria-hidden", "true");
66
- } else {
67
- preparedElement = prepareElement(el, "hidden", true);
68
- }
69
- return preparedElement;
70
- }
71
- function prepareElement(el, attributeName, dirtyValue) {
72
- const isProperty = typeof dirtyValue === "boolean";
73
- return {
74
- el,
75
- attributeName,
76
- cleanValue: isProperty ? el[attributeName] : el.getAttribute(attributeName),
77
- dirtyValue,
78
- isProperty
79
- };
80
- }
81
- function dirtyElement(preparedObj) {
82
- if (preparedObj.isProperty === true) {
83
- preparedObj.el[preparedObj.attributeName] = preparedObj.dirtyValue;
84
- } else {
85
- preparedObj.el.setAttribute(preparedObj.attributeName, preparedObj.dirtyValue);
86
- }
87
- }
88
- function cleanElement(preparedObj) {
89
- if (preparedObj.cleanValue) {
90
- if (preparedObj.isProperty === true) {
91
- preparedObj.el[preparedObj.attributeName] = preparedObj.cleanValue;
92
- } else {
93
- preparedObj.el.setAttribute(preparedObj.attributeName, preparedObj.cleanValue);
94
- }
95
- } else {
96
- preparedObj.el.removeAttribute(preparedObj.attributeName);
97
- }
98
- }
99
- function untrap$1() {
100
- if (trappedEl$1) {
101
- dirtyObjects.forEach((item) => cleanElement(item));
102
- dirtyObjects = [];
103
- if (mainEl) {
104
- mainEl.setAttribute("role", "main");
105
- }
106
- trappedEl$1.dispatchEvent(new CustomEvent("screenreaderUntrap", { bubbles: true }));
107
- trappedEl$1 = null;
108
- }
109
- }
110
- const defaultOptions = {
111
- useHiddenProperty: false
112
- };
113
- function trap$1(el, selectedOptions) {
114
- untrap$1();
115
- const options = Object.assign({}, defaultOptions, selectedOptions);
116
- trappedEl$1 = el;
117
- mainEl = document.querySelector('main, [role="main"]');
118
- if (mainEl) {
119
- mainEl.setAttribute("role", "presentation");
120
- }
121
- const ancestors = getAncestors(trappedEl$1);
122
- let siblings = getSiblings(trappedEl$1);
123
- let siblingsOfAncestors = getSiblingsOfAncestors(trappedEl$1);
124
- if (options.useHiddenProperty === true) {
125
- siblings = siblings.filter(filterSvg);
126
- siblingsOfAncestors = siblingsOfAncestors.filter(filterSvg);
127
- }
128
- dirtyObjects = [showElementPrep(trappedEl$1, options.useHiddenProperty)].concat(ancestors.map((item) => showElementPrep(item, options.useHiddenProperty))).concat(siblings.map((item) => hideElementPrep(item, options.useHiddenProperty))).concat(siblingsOfAncestors.map((item) => hideElementPrep(item, options.useHiddenProperty)));
129
- dirtyObjects.forEach((item) => dirtyElement(item));
130
- trappedEl$1.dispatchEvent(new CustomEvent("screenreaderTrap", { bubbles: true }));
131
- }
132
- const focusableElList = [
133
- "a[href]",
134
- "area[href]",
135
- "button:not([disabled])",
136
- "embed",
137
- "iframe",
138
- "input:not([disabled])",
139
- "object",
140
- "select:not([disabled])",
141
- "textarea:not([disabled])",
142
- "*[tabindex]",
143
- "*[contenteditable]"
144
- ];
145
- const focusableElSelector = focusableElList.join();
146
- function src_default(el, keyboardOnly = false, callback) {
147
- return getFocusables(el, keyboardOnly);
148
- }
149
- function getFocusables(el, keyboardOnly = false) {
150
- let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));
151
- focusableEls = focusableEls.filter(function(focusableEl) {
152
- return window.getComputedStyle(focusableEl).display !== "none";
153
- });
154
- if (keyboardOnly === true) {
155
- focusableEls = focusableEls.filter(function(focusableEl) {
156
- return focusableEl.getAttribute("tabindex") !== "-1";
157
- });
158
- }
159
- return focusableEls;
160
- }
161
- let trappedEl;
162
- let topTrap;
163
- let outerTrapBefore;
164
- let innerTrapBefore;
165
- let innerTrapAfter;
166
- let outerTrapAfter;
167
- let botTrap;
168
- let firstFocusableElement;
169
- let lastFocusableElement;
170
- function createTrapBoundary() {
171
- const trapBoundary = document.createElement("div");
172
- trapBoundary.setAttribute("aria-hidden", "true");
173
- trapBoundary.setAttribute("tabindex", "0");
174
- trapBoundary.className = "keyboard-trap-boundary";
175
- return trapBoundary;
176
- }
177
- function setFocusToFirstFocusableElement() {
178
- firstFocusableElement.focus();
179
- }
180
- function setFocusToLastFocusableElement() {
181
- lastFocusableElement.focus();
182
- }
183
- function createTraps() {
184
- topTrap = createTrapBoundary();
185
- outerTrapBefore = topTrap.cloneNode();
186
- innerTrapBefore = topTrap.cloneNode();
187
- innerTrapAfter = topTrap.cloneNode();
188
- outerTrapAfter = topTrap.cloneNode();
189
- botTrap = topTrap.cloneNode();
190
- topTrap.addEventListener("focus", setFocusToFirstFocusableElement);
191
- outerTrapBefore.addEventListener("focus", setFocusToFirstFocusableElement);
192
- innerTrapBefore.addEventListener("focus", setFocusToLastFocusableElement);
193
- innerTrapAfter.addEventListener("focus", setFocusToFirstFocusableElement);
194
- outerTrapAfter.addEventListener("focus", setFocusToLastFocusableElement);
195
- botTrap.addEventListener("focus", setFocusToLastFocusableElement);
196
- }
197
- function untrap() {
198
- if (trappedEl) {
199
- topTrap = safeDetach(topTrap);
200
- outerTrapBefore = safeDetach(outerTrapBefore);
201
- innerTrapBefore = safeDetach(innerTrapBefore);
202
- innerTrapAfter = safeDetach(innerTrapAfter);
203
- outerTrapAfter = safeDetach(outerTrapAfter);
204
- botTrap = safeDetach(botTrap);
205
- trappedEl.classList.remove("keyboard-trap--active");
206
- trappedEl.dispatchEvent(new CustomEvent("keyboardUntrap", { bubbles: true }));
207
- trappedEl = null;
208
- }
209
- return trappedEl;
210
- }
211
- function safeDetach(el) {
212
- const parent = el.parentNode;
213
- return parent ? parent.removeChild(el) : el;
214
- }
215
- function trap(el) {
216
- if (!topTrap) {
217
- createTraps();
218
- } else {
219
- untrap();
220
- }
221
- trappedEl = el;
222
- const body = typeof document === "undefined" ? null : document.body;
223
- const focusableElements = src_default(trappedEl, true);
224
- firstFocusableElement = focusableElements[0];
225
- lastFocusableElement = focusableElements[focusableElements.length - 1];
226
- body.insertBefore(topTrap, body.childNodes[0]);
227
- trappedEl.parentNode.insertBefore(outerTrapBefore, trappedEl);
228
- trappedEl.insertBefore(innerTrapBefore, trappedEl.childNodes[0]);
229
- trappedEl.appendChild(innerTrapAfter);
230
- trappedEl.parentNode.insertBefore(outerTrapAfter, trappedEl.nextElementSibling);
231
- body.appendChild(botTrap);
232
- trappedEl.dispatchEvent(new CustomEvent("keyboardTrap", { bubbles: true }));
233
- trappedEl.classList.add("keyboard-trap--active");
234
- return trappedEl;
235
- }
236
- const DialogBase = ({ baseEl: Container = "div", classPrefix = "drawer-dialog", windowClass, windowType, mainId, top, header, buttonPosition = "right", children, ariaLabelledby, a11yCloseText, onCloseBtnClick = () => {
237
- }, footer, actions, onScroll, open = false, onOpen = () => {
238
- }, onBackgroundClick = () => {
239
- }, ignoreEscape, closeButton, previousButton, isModal, role = "dialog", focus, transitionElement, animated, closeButtonClass, ...props }) => {
240
- var _a;
241
- const dialogRef = React.useRef(null);
242
- const drawerBaseEl = React.useRef(null);
243
- const closeButtonRef = React.useRef(null);
244
- const [rId, setRandomId] = React.useState("");
245
- React.useEffect(() => {
246
- setRandomId(common_randomId.randomId());
247
- }, []);
248
- React.useEffect(() => {
249
- let timeout;
250
- const handleBackgroundClick = (e) => {
251
- if (drawerBaseEl.current && !drawerBaseEl.current.contains(e.target)) {
252
- onBackgroundClick(e);
253
- }
254
- };
255
- if (open && buttonPosition !== "hidden") {
256
- timeout = window.setTimeout(() => {
257
- document.addEventListener("click", handleBackgroundClick, false);
258
- });
259
- }
260
- return () => {
261
- clearTimeout(timeout);
262
- document.removeEventListener("click", handleBackgroundClick, false);
263
- };
264
- }, [onBackgroundClick, open]);
265
- React.useEffect(() => {
266
- if (open && isModal) {
267
- trap$1(drawerBaseEl.current);
268
- trap(drawerBaseEl.current);
269
- } else {
270
- untrap$1();
271
- untrap();
272
- }
273
- return () => {
274
- untrap$1();
275
- untrap();
276
- };
277
- }, [open, isModal]);
278
- ebayDialogBase_components_animation.useDialogAnimation({
279
- open,
280
- classPrefix,
281
- transitionElement,
282
- dialogRef,
283
- dialogWindowRef: drawerBaseEl,
284
- enabled: animated,
285
- onTransitionEnd: () => handleFocus(open)
286
- });
287
- const onKeyDown = (event) => {
288
- if (!ignoreEscape && event.key === "Escape") {
289
- event.stopPropagation();
290
- onCloseBtnClick(event);
291
- }
292
- };
293
- React.useEffect(() => {
294
- if (!animated) {
295
- handleFocus(open);
296
- }
297
- if (open) {
298
- onOpen();
299
- }
300
- }, [open]);
301
- function handleFocus(isOpen) {
302
- var _a2, _b;
303
- if (isOpen) {
304
- if (focus) {
305
- (_a2 = focus.current) == null ? void 0 : _a2.focus();
306
- } else if (isModal) {
307
- (_b = closeButtonRef.current) == null ? void 0 : _b.focus();
308
- }
309
- document.addEventListener("keydown", onKeyDown, false);
310
- return () => document.removeEventListener("keydown", onKeyDown, false);
311
- }
312
- }
313
- const closeButtonContent = buttonPosition !== "hidden" && React.createElement("button", { ref: closeButtonRef, className: classNames(`icon-btn`, closeButtonClass, `${classPrefix}__close`, {
314
- "icon-btn--transparent": classPrefix === `toast-dialog`
315
- }), type: "button", "aria-label": a11yCloseText, onClick: onCloseBtnClick }, closeButton || React.createElement(icon.EbayIcon, { name: "close16" }));
316
- const windowClassName = windowType ? `${classPrefix}__${windowType}-window` : `${classPrefix}__window`;
317
- const dialogTitleId = ((_a = header == null ? void 0 : header.props) == null ? void 0 : _a.id) || `dialog-title-${rId}`;
318
- const dialogLabelledBy = ariaLabelledby || dialogTitleId;
319
- const dialogHeader = header ? React.cloneElement(header, { ...header.props, id: dialogTitleId }) : null;
320
- return React.createElement(
321
- Container,
322
- { ...props, "aria-labelledby": dialogLabelledBy, "aria-modal": "true", role, hidden: !open, className: classNames(classPrefix, props.className), "aria-live": !isModal ? "polite" : void 0, ref: dialogRef, onKeyDown },
323
- React.createElement(
324
- "div",
325
- { className: classNames(windowClassName, windowClass), ref: drawerBaseEl },
326
- top,
327
- dialogHeader && React.createElement(
328
- "div",
329
- { className: `${classPrefix}__header` },
330
- previousButton,
331
- buttonPosition === "right" && dialogHeader,
332
- buttonPosition !== "bottom" && closeButtonContent,
333
- (buttonPosition === "left" || buttonPosition === "hidden") && dialogHeader
334
- ),
335
- React.createElement("div", { id: mainId, className: `${classPrefix}__main`, onScroll }, children),
336
- actions ? React.createElement("div", { className: `${classPrefix}__actions` }, actions) : null,
337
- footer || buttonPosition === "bottom" ? React.createElement(
338
- "div",
339
- { className: `${classPrefix}__footer` },
340
- footer,
341
- buttonPosition === "bottom" && closeButtonContent
342
- ) : null
343
- )
344
- );
345
- };
346
- const DialogBaseWithState = ({ isModal, open, children, animated = true, ...rest }) => {
347
- const shouldRenderModal = isModal !== false;
348
- const childrenArray = React.Children.toArray(children);
349
- const header = childrenArray.find((child) => child.type === ebayDialogBase_components_dialogHeader);
350
- const footer = childrenArray.find((child) => child.type === ebayDialogBase_components_dialogFooter);
351
- const actions = childrenArray.find((child) => child.type === EbayDialogActions);
352
- const closeButton = childrenArray.find((child) => child.type === EbayDialogCloseButton);
353
- const previousButton = childrenArray.find((child) => child.type === EbayDialogPreviousButton);
354
- const content = childrenArray.filter((child) => ![
355
- ebayDialogBase_components_dialogHeader,
356
- ebayDialogBase_components_dialogFooter,
357
- EbayDialogCloseButton,
358
- EbayDialogActions,
359
- EbayDialogPreviousButton
360
- ].some((c) => c === child.type));
361
- const dialogBase = React.createElement(DialogBase, { ...rest, open, isModal: shouldRenderModal, header, footer, actions, closeButton, previousButton, animated }, content);
362
- const renderOverLay = () => shouldRenderModal ? React.createElement(reactRemoveScroll.RemoveScroll, { enabled: open }, dialogBase) : dialogBase;
363
- return animated || open ? renderOverLay() : null;
364
- };
365
- const EbayDialogActions = ({ children }) => React.createElement(React.Fragment, null, children);
366
- const EbayDialogPreviousButton = ({ className, icon: icon2, ...rest }) => React.createElement(iconButton.EbayIconButton, { ...rest, icon: icon2 || "chevronLeft16", className: classNames(className, "lightbox-dialog__prev") });
367
- exports.DialogBaseWithState = DialogBaseWithState;
368
- exports.EbayDialogActions = EbayDialogActions;
369
- exports.EbayDialogCloseButton = EbayDialogCloseButton;
370
- exports.EbayDialogPreviousButton = EbayDialogPreviousButton;
@@ -1,69 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const classNames = require("classnames");
4
- const ebayDialogBase_components_dialogHeader = require("./ebay-dialog-base/components/dialog-header/index.js");
5
- const dialogPreviousButton = require("./dialog-previous-button-EC_Y6KaT.js");
6
- require("./icon-button-BQWoMgX1.js");
7
- const THRESHOLD_TOUCH = 30;
8
- const classPrefix = "drawer-dialog";
9
- const EbayDrawerDialog = ({ expanded: controlledExpanded = false, noHandle, onClose = () => {
10
- }, onCollapsed = () => {
11
- }, onExpanded = () => {
12
- }, a11yMaximizeText, a11yMinimizeText, children, ...rest }) => {
13
- let touches = [];
14
- const [expanded, setExpanded] = React.useState(controlledExpanded);
15
- React.useEffect(() => {
16
- setExpanded(controlledExpanded);
17
- }, [controlledExpanded]);
18
- const setExpandedState = (expand) => {
19
- setExpanded(expand);
20
- if (expand) {
21
- onExpanded();
22
- } else {
23
- onCollapsed();
24
- }
25
- };
26
- const handleTouchStart = (e) => {
27
- touches = Array.from(e.changedTouches).map(({ identifier, pageY }) => ({ identifier, pageY }));
28
- };
29
- const handleTouchEnd = (e) => {
30
- Array.from(e.changedTouches).forEach(({ identifier }) => {
31
- const idx = touches.findIndex((touch) => touch.identifier === identifier);
32
- if (idx > -1) {
33
- touches.splice(idx, 1);
34
- }
35
- });
36
- };
37
- const handleTouchMove = (e) => {
38
- if (touches.length) {
39
- Array.from(e.changedTouches).forEach(({ identifier, pageY }) => {
40
- const compare = touches.findIndex((touch) => touch.identifier === identifier);
41
- const diff = pageY - touches[compare].pageY;
42
- if (diff > THRESHOLD_TOUCH) {
43
- if (expanded) {
44
- setExpandedState(false);
45
- } else {
46
- onClose();
47
- }
48
- handleTouchEnd(e);
49
- } else if (diff < -THRESHOLD_TOUCH) {
50
- setExpandedState(true);
51
- handleTouchEnd(e);
52
- }
53
- });
54
- }
55
- };
56
- const handle = noHandle ? null : React.createElement("button", { "aria-label": expanded ? a11yMinimizeText : a11yMaximizeText, className: `${classPrefix}__handle`, onClick: () => setExpandedState(!expanded), onScroll: () => setExpandedState(true), onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, type: "button" });
57
- const childrenArray = React.Children.toArray(children);
58
- const header = childrenArray.find(({ type }) => type === ebayDialogBase_components_dialogHeader);
59
- const withoutHeader = childrenArray.filter(({ type }) => type !== ebayDialogBase_components_dialogHeader);
60
- return React.createElement(
61
- dialogPreviousButton.DialogBaseWithState,
62
- { ...rest, classPrefix, onCloseBtnClick: onClose, className: classNames(rest.className, `${classPrefix}--mask-fade-slow`), windowClass: classNames(rest.windowClass, `${classPrefix}__window`, `${classPrefix}__window--slide`, {
63
- [`${classPrefix}__window--expanded`]: expanded
64
- }), onBackgroundClick: onClose, top: handle },
65
- header || React.createElement(ebayDialogBase_components_dialogHeader, null),
66
- withoutHeader
67
- );
68
- };
69
- exports.EbayDrawerDialog = EbayDrawerDialog;
@@ -1,100 +0,0 @@
1
- # EbayListbox
2
-
3
- ## Demo
4
-
5
- [Storybook](https://opensource.ebay.com/ebayui-core-react/main/?path=/docs/building-blocks-ebay-listbox--docs)
6
-
7
- ## Import JS
8
-
9
- ```jsx harmony
10
- import {
11
- EbayListbox,
12
- EbayListboxOption,
13
- EbayListboxOptionDescription,
14
- } from "@ebay/ui-core-react/ebay-listbox";
15
- ```
16
-
17
- ## Import following styles from SKIN
18
-
19
- ```js
20
- import "@ebay/skin/listbox";
21
- ```
22
-
23
- ## Import styles using SCSS/CSS
24
-
25
- ```js
26
- import "@ebay/skin/listbox.css";
27
- ```
28
-
29
- ## Usage
30
-
31
- ```jsx
32
- <EbayListbox>
33
- <EbayListboxOption value="AA" text="Option 1" />
34
- <EbayListboxOption value="BB" text="Option 2" />
35
- <EbayListboxOption value="CC" text="Option 3" />
36
- </EbayListbox>
37
- ```
38
-
39
- ## Attributes
40
-
41
- ### EbayListbox
42
-
43
- | Name | Type | Required | Description |
44
- | ------------------------ | ------- | -------- | ------------------------------------------------------------------------------------------------------- |
45
- | `name` | string | No | Used for the name attribute of the native `<select>`. |
46
- | `disabled` | boolean | No | Set to true if the field is disabled. |
47
- | `listSelection` | string | No | If `manual`, the user will need to press enter to select an item using the keyboard. Otherwise, `auto` will automatically select as the user presses up/down. |
48
- | `typeaheadTimeoutLength` | number | No | Timeout length to pass to typeahead. |
49
- | `maxHeight` | string | No | Example: 100px, 200px, 10rem. |
50
-
51
- ### EbayListboxOption
52
-
53
- | Name | Type | Required | Description |
54
- | ---------- | ------------ | -------- | ---------------------------------- |
55
- | `icon` | ReactElement | No | An optional icon to display alongside the option text. |
56
- | `text` | string | No | The text to display for the option. |
57
- | `value` | string | Yes | The value of the option. |
58
- | `disabled` | boolean | No | Set to true if the option is disabled. |
59
- | `selected` | boolean | No | Set to true if the option is selected by default. |
60
-
61
- ## Callbacks
62
-
63
- | Name | Type | Required | Description | Data |
64
- | ---------- | -------- | -------- | ------------------------------ | ---------------------------------------------------------------------------- |
65
- | `onChange` | Function | No | triggered on change | `(ChangeEvent, { index: number, selected: string[] , wasClicked: boolean })` |
66
- | `onEscape` | Function | No | triggered on typing Escape key | `()` |
67
-
68
- ## Examples
69
-
70
- ### Default
71
-
72
- ```jsx
73
- <EbayListbox>
74
- <EbayListboxOption value="AA" text="Option 1" />
75
- <EbayListboxOption value="BB" text="Option 2" />
76
- <EbayListboxOption value="CC" text="Option 3" />
77
- </EbayListbox>
78
- ```
79
-
80
- ### With Description
81
-
82
- ```jsx
83
- <EbayListbox>
84
- <EbayListboxOption value="AA" text="Option 1">
85
- <EbayListboxOptionDescription>
86
- Option 1 extra info
87
- </EbayListboxOptionDescription>
88
- </EbayListboxOption>
89
- <EbayListboxOption value="BB" text="Option 2">
90
- <EbayListboxOptionDescription>
91
- Option 2 extra info
92
- </EbayListboxOptionDescription>
93
- </EbayListboxOption>
94
- <EbayListboxOption value="CC" text="Option 3">
95
- <EbayListboxOptionDescription>
96
- Option 3 extra info
97
- </EbayListboxOptionDescription>
98
- </EbayListboxOption>
99
- </EbayListbox>
100
- ```
@@ -1,4 +0,0 @@
1
- export * from './listbox';
2
- export * from './listbox-option';
3
- export * from './listbox-option-description';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const listbox = require("../listbox-DfOw_fJc.js");
4
- exports.EbayListbox = listbox.EbayListbox;
5
- exports.EbayListboxOption = listbox.EbayListboxOption;
6
- exports.EbayListboxOptionDescription = listbox.EbayListboxOptionDescription;
@@ -1,4 +0,0 @@
1
- import { ComponentProps, FC } from 'react';
2
- export type EbayListboxOptionDescriptionProps = ComponentProps<'div'>;
3
- export declare const EbayListboxOptionDescription: FC<EbayListboxOptionDescriptionProps>;
4
- //# sourceMappingURL=listbox-option-description.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"listbox-option-description.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox/listbox-option-description.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAGjD,MAAM,MAAM,iCAAiC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEtE,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAAC,iCAAiC,CACc,CAAA"}
@@ -1,10 +0,0 @@
1
- import { ComponentProps, FC, ReactElement } from 'react';
2
- export type EbayListboxOptionProps = ComponentProps<'div'> & {
3
- icon?: ReactElement;
4
- text?: string;
5
- value: string;
6
- disabled?: boolean;
7
- selected?: boolean;
8
- };
9
- export declare const EbayListboxOption: FC<EbayListboxOptionProps>;
10
- //# sourceMappingURL=listbox-option.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"listbox-option.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox/listbox-option.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAM/D,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAoCxD,CAAA"}
@@ -1,22 +0,0 @@
1
- import { FC } from 'react';
2
- import { ComponentProps, ReactNode } from 'react';
3
- import { EbayChangeEventHandler } from '../events';
4
- export type ChangeEventProps = {
5
- index: number;
6
- selected: string[];
7
- wasClicked: boolean;
8
- };
9
- export type EbayListboxProps = Omit<ComponentProps<'div'>, 'onChange'> & {
10
- name?: string;
11
- disabled?: boolean;
12
- children: ReactNode;
13
- listSelection?: 'auto' | 'manual';
14
- typeaheadTimeoutLength?: number;
15
- maxHeight?: string | number;
16
- selectClassName?: string;
17
- activeClassName?: string;
18
- onChange?: EbayChangeEventHandler<HTMLSpanElement, ChangeEventProps>;
19
- onEscape?: () => void;
20
- };
21
- export declare const EbayListbox: FC<EbayListboxProps>;
22
- //# sourceMappingURL=listbox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"listbox.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox/listbox.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA6B,EAAE,EAA4B,MAAM,OAAO,CAAA;AAItF,OAAO,EAAE,cAAc,EAAE,SAAS,EAAoB,MAAM,OAAO,CAAA;AAInE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAIlD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IACrE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACxB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA2L5C,CAAA"}
package/icon-B17Di3YL.js DELETED
@@ -1,56 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const classNames = require("classnames");
4
- const common_componentUtils_forwardRef = require("./common/component-utils/forwardRef/index.js");
5
- require("./array.polyfill.flat-DyxysTxZ.js");
6
- const common_randomId = require("./common/random-id/index.js");
7
- const EbayIcon = ({ name, className: extraClass, noSkinClasses = false, a11yText, a11yVariant, forwardedRef, ...rest }) => {
8
- const [rId, setRandomId] = React.useState("");
9
- React.useEffect(() => {
10
- setRandomId(common_randomId.randomId());
11
- }, []);
12
- const withAriaLabel = a11yVariant === "label";
13
- const a11yTextId = a11yText && `icon-title-${rId}`;
14
- const a11yProps = a11yText ? {
15
- "aria-labelledby": withAriaLabel ? void 0 : a11yTextId,
16
- "aria-label": withAriaLabel ? a11yText : void 0,
17
- role: "img"
18
- } : {
19
- "aria-hidden": true
20
- };
21
- const kebabName = kebabCased(name);
22
- const size = getIconSize(kebabName) || kebabName;
23
- const skinClassName = [`icon`, `icon--${size}`, getFilledIconName(kebabName)].filter(Boolean).join(" ");
24
- const className = classNames(extraClass, { [skinClassName]: !noSkinClasses });
25
- return React.createElement(
26
- "svg",
27
- { ...rest, className, xmlns: "http://www.w3.org/2000/svg", focusable: false, ref: forwardedRef, ...a11yProps },
28
- a11yText && !withAriaLabel && React.createElement("title", { id: a11yTextId }, a11yText),
29
- React.createElement("use", { xlinkHref: `#icon-${kebabName}` })
30
- );
31
- };
32
- function getIconSize(iconName) {
33
- const iconNameArray = iconName.split("-");
34
- const size = iconNameArray[iconNameArray.length - 1];
35
- if (size === "colored") {
36
- return iconNameArray[iconNameArray.length - 2];
37
- }
38
- if (isNaN(Number(size))) {
39
- return "";
40
- }
41
- return size;
42
- }
43
- function getFilledIconName(iconName) {
44
- const iconNameArray = iconName.split("-");
45
- const filledIndex = iconNameArray.indexOf("filled");
46
- if (filledIndex === -1) {
47
- return "";
48
- }
49
- return `icon--${iconNameArray.slice(0, filledIndex + 1).join("-")}`;
50
- }
51
- function kebabCased(str) {
52
- return str.replace(/([0-9]+)/g, (s, n) => `-${n}`).replace(/([A-Z])/g, (s, c) => `-${c.toLowerCase()}`);
53
- }
54
- const EbayIcon$1 = common_componentUtils_forwardRef.withForwardRef(EbayIcon);
55
- exports.EbayIcon = EbayIcon$1;
56
- exports.kebabCased = kebabCased;