@ebay/ui-core-react 7.4.0-alpha.9 → 8.0.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 (215) hide show
  1. package/README.md +2 -5
  2. package/array.polyfill.flat-5BAolFdk.js +1 -0
  3. package/badge-CoHKfiPt.js +1 -0
  4. package/button-6S4U-4HH.js +1 -0
  5. package/calendar-hBaLhOjI.js +1 -0
  6. package/common/dropdown.d.ts +20 -0
  7. package/common/dropdown.d.ts.map +1 -0
  8. package/common/floating-label-utils/hooks.d.ts.map +1 -1
  9. package/debounce-BQsYxxOL.js +1 -0
  10. package/dialog-previous-button-B-fysL3O.js +1 -0
  11. package/dropdown-pp-aluo7.js +1 -0
  12. package/ebay-accordion/README.md +61 -0
  13. package/ebay-accordion/accordion.d.ts +16 -0
  14. package/ebay-accordion/accordion.d.ts.map +1 -0
  15. package/ebay-accordion/index.d.ts +3 -0
  16. package/ebay-accordion/index.d.ts.map +1 -0
  17. package/ebay-accordion/index.js +2 -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/README.md +1 -1
  22. package/ebay-button/button.d.ts.map +1 -1
  23. package/ebay-button/index.js +1 -5
  24. package/ebay-button/types.d.ts +1 -1
  25. package/ebay-button/types.d.ts.map +1 -1
  26. package/ebay-calendar/index.js +1 -4
  27. package/ebay-carousel/index.js +1 -345
  28. package/ebay-checkbox/index.js +1 -52
  29. package/ebay-confirm-dialog/index.js +1 -28
  30. package/ebay-cta-button/index.js +1 -22
  31. package/ebay-date-textbox/date-textbox.d.ts.map +1 -1
  32. package/ebay-date-textbox/index.js +1 -140
  33. package/ebay-details/README.md +51 -0
  34. package/ebay-details/ebay-details.d.ts +17 -0
  35. package/ebay-details/ebay-details.d.ts.map +1 -0
  36. package/ebay-details/index.d.ts +2 -0
  37. package/ebay-details/index.d.ts.map +1 -0
  38. package/ebay-details/index.js +1 -0
  39. package/ebay-details-q_d7qlcN.js +1 -0
  40. package/ebay-dialog-base/index.js +1 -13
  41. package/{ebay-drawer-dialog → ebay-drawer-dialog-deprecated}/README.md +9 -8
  42. package/{ebay-drawer-dialog → ebay-drawer-dialog-deprecated}/components/drawer.d.ts +2 -6
  43. package/ebay-drawer-dialog-deprecated/components/drawer.d.ts.map +1 -0
  44. package/ebay-drawer-dialog-deprecated/index.d.ts +2 -0
  45. package/ebay-drawer-dialog-deprecated/index.d.ts.map +1 -0
  46. package/ebay-drawer-dialog-deprecated/index.js +1 -0
  47. package/ebay-eek/index.js +1 -54
  48. package/ebay-fake-menu/index.js +1 -10
  49. package/ebay-fake-menu/menu.d.ts +4 -3
  50. package/ebay-fake-menu/menu.d.ts.map +1 -1
  51. package/ebay-fake-menu-button/README.md +1 -1
  52. package/ebay-fake-menu-button/index.js +1 -7
  53. package/ebay-fake-menu-button/menu-button.d.ts.map +1 -1
  54. package/ebay-fake-tabs/index.js +1 -30
  55. package/ebay-field/index.js +1 -21
  56. package/{ebay-fullscreen-dialog → ebay-fullscreen-dialog-deprecated}/README.md +6 -4
  57. package/{ebay-fullscreen-dialog → ebay-fullscreen-dialog-deprecated}/fullscreen-dialog.d.ts +2 -2
  58. package/ebay-fullscreen-dialog-deprecated/fullscreen-dialog.d.ts.map +1 -0
  59. package/ebay-fullscreen-dialog-deprecated/index.d.ts +2 -0
  60. package/ebay-fullscreen-dialog-deprecated/index.d.ts.map +1 -0
  61. package/ebay-fullscreen-dialog-deprecated/index.js +1 -0
  62. package/ebay-icon/README.md +1 -1
  63. package/ebay-icon/index.js +1 -4
  64. package/ebay-icon/types.d.ts +1 -1
  65. package/ebay-icon/types.d.ts.map +1 -1
  66. package/ebay-icon-button/index.js +1 -4
  67. package/ebay-infotip/README.md +0 -2
  68. package/ebay-infotip/ebay-infotip.d.ts +0 -2
  69. package/ebay-infotip/ebay-infotip.d.ts.map +1 -1
  70. package/ebay-infotip/index.js +1 -76
  71. package/ebay-inline-notice/index.js +1 -36
  72. package/ebay-lightbox-dialog/README.md +2 -0
  73. package/ebay-lightbox-dialog/index.js +1 -12
  74. package/ebay-lightbox-dialog/lightbox-dialog.d.ts +3 -1
  75. package/ebay-lightbox-dialog/lightbox-dialog.d.ts.map +1 -1
  76. package/ebay-listbox/README.md +1 -1
  77. package/ebay-listbox/index.js +1 -6
  78. package/ebay-listbox/listbox.d.ts +0 -1
  79. package/ebay-listbox/listbox.d.ts.map +1 -1
  80. package/ebay-listbox-button/index.d.ts +2 -1
  81. package/ebay-listbox-button/index.d.ts.map +1 -1
  82. package/ebay-listbox-button/index.js +2 -151
  83. package/ebay-listbox-button/listbox-button-option.d.ts +10 -0
  84. package/ebay-listbox-button/listbox-button-option.d.ts.map +1 -0
  85. package/ebay-listbox-button/listbox-button.d.ts +5 -15
  86. package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
  87. package/ebay-menu/index.js +1 -9
  88. package/ebay-menu/menu.d.ts.map +1 -1
  89. package/ebay-menu/types.d.ts +2 -1
  90. package/ebay-menu/types.d.ts.map +1 -1
  91. package/ebay-menu-button/README.md +1 -1
  92. package/ebay-menu-button/index.js +1 -113
  93. package/ebay-menu-button/menu-button.d.ts.map +1 -1
  94. package/ebay-notice-base/index.js +1 -7
  95. package/ebay-page-notice/index.js +1 -50
  96. package/ebay-pagination/index.js +1 -244
  97. package/ebay-panel-dialog/index.js +1 -12
  98. package/ebay-progress-bar/index.js +1 -6
  99. package/ebay-progress-spinner/index.js +1 -4
  100. package/ebay-progress-stepper/index.js +1 -72
  101. package/ebay-radio/index.js +1 -4
  102. package/ebay-section-notice/index.js +1 -69
  103. package/ebay-section-title/index.js +1 -38
  104. package/ebay-segmented-buttons/index.js +1 -46
  105. package/ebay-select/index.js +1 -98
  106. package/ebay-signal/index.js +1 -9
  107. package/ebay-snackbar-dialog/index.js +1 -81
  108. package/ebay-split-button/README.md +1 -1
  109. package/ebay-split-button/index.js +1 -22
  110. package/ebay-star-rating/index.js +1 -9
  111. package/ebay-star-rating-select/index.js +1 -55
  112. package/ebay-svg/index.js +1 -5189
  113. package/ebay-svg/symbols.d.ts.map +1 -1
  114. package/ebay-switch/index.js +1 -27
  115. package/ebay-tabs/README.md +1 -3
  116. package/ebay-tabs/index.js +1 -88
  117. package/ebay-tabs/tabs.d.ts.map +1 -1
  118. package/ebay-tabs/types.d.ts +2 -6
  119. package/ebay-tabs/types.d.ts.map +1 -1
  120. package/ebay-textbox/index.js +1 -10
  121. package/ebay-toast-dialog/README.md +3 -3
  122. package/ebay-toast-dialog/index.js +1 -9
  123. package/ebay-toggle-button/README.md +39 -0
  124. package/ebay-toggle-button/index.d.ts +3 -0
  125. package/ebay-toggle-button/index.d.ts.map +1 -0
  126. package/ebay-toggle-button/index.js +1 -0
  127. package/ebay-toggle-button/toggle-button.d.ts +5 -0
  128. package/ebay-toggle-button/toggle-button.d.ts.map +1 -0
  129. package/ebay-toggle-button/types.d.ts +23 -0
  130. package/ebay-toggle-button/types.d.ts.map +1 -0
  131. package/ebay-toggle-button-group/README.md +56 -0
  132. package/ebay-toggle-button-group/index.d.ts +3 -0
  133. package/ebay-toggle-button-group/index.d.ts.map +1 -0
  134. package/ebay-toggle-button-group/index.js +1 -0
  135. package/ebay-toggle-button-group/toggle-button-group.d.ts +5 -0
  136. package/ebay-toggle-button-group/toggle-button-group.d.ts.map +1 -0
  137. package/ebay-toggle-button-group/types.d.ts +20 -0
  138. package/ebay-toggle-button-group/types.d.ts.map +1 -0
  139. package/ebay-tooltip/index.js +1 -64
  140. package/ebay-tourtip/index.js +1 -54
  141. package/ebay-video/index.js +1 -229
  142. package/events/index.js +1 -18
  143. package/forwardRef-fPwzYd82.js +1 -0
  144. package/hooks-5qES90Sx.js +1 -0
  145. package/icon-D4RDqpD4.js +1 -0
  146. package/icon-button-Bjjvld0a.js +1 -0
  147. package/index-Bsb1LHpi.js +1 -0
  148. package/label-CnrpYJ-g.js +1 -0
  149. package/lightbox-dialog-Il3dBNcR.js +1 -0
  150. package/menu-DAOhKkcI.js +1 -0
  151. package/menu-button-label-DJq794te.js +1 -0
  152. package/menu-button-label-D_04ZC3p.js +1 -0
  153. package/menu-item-Cf-tQ72X.js +1 -0
  154. package/notice-content-9iF4T8uB.js +1 -0
  155. package/notice-content-C0ZStfuX.js +1 -0
  156. package/notice-cta-FAd6zCdx.js +1 -0
  157. package/package.json +19 -84
  158. package/progress-spinner-CF3qoWE3.js +1 -0
  159. package/range-DOsPN0h5.js +1 -0
  160. package/scroll-OgAngNzq.js +1 -0
  161. package/textbox-DZRVQetR.js +1 -0
  162. package/toggle-button-CFPnYlex.js +1 -0
  163. package/use-roving-index-DoAVBgsp.js +1 -0
  164. package/use-tooltip-BEiQpMDa.js +1 -0
  165. package/utils/index.d.ts +1 -0
  166. package/utils/index.d.ts.map +1 -1
  167. package/utils/index.js +1 -13
  168. package/utils-C9NL3q0j.js +1 -0
  169. package/array.polyfill.flat-DyxysTxZ.js +0 -21
  170. package/badge-CR5t7-2L.js +0 -8
  171. package/button-B4bZIgwB.js +0 -83
  172. package/calendar-D-DWjrMU.js +0 -333
  173. package/common/component-utils/forwardRef/index.js +0 -10
  174. package/common/component-utils/index.js +0 -9
  175. package/common/component-utils/utils/index.js +0 -25
  176. package/common/event-utils/index.js +0 -113
  177. package/common/floating-label-utils/hooks/index.js +0 -106
  178. package/common/notice-utils/notice-cta/index.js +0 -5
  179. package/common/random-id/index.js +0 -13
  180. package/common/tooltip-utils/constants/index.js +0 -97
  181. package/common/tooltip-utils/index.js +0 -11
  182. package/debounce-v8bWAUnY.js +0 -9
  183. package/dialog-previous-button-EC_Y6KaT.js +0 -370
  184. package/drawer-DBDktEBZ.js +0 -69
  185. package/ebay-dialog-base/components/animation/index.js +0 -92
  186. package/ebay-dialog-base/components/dialog-footer/index.js +0 -4
  187. package/ebay-dialog-base/components/dialog-header/index.js +0 -4
  188. package/ebay-drawer-dialog/components/drawer.d.ts.map +0 -1
  189. package/ebay-drawer-dialog/index.d.ts +0 -2
  190. package/ebay-drawer-dialog/index.d.ts.map +0 -1
  191. package/ebay-drawer-dialog/index.js +0 -4
  192. package/ebay-fake-menu/menu-item/index.js +0 -49
  193. package/ebay-fake-menu-button/menu-button/index.js +0 -12
  194. package/ebay-fullscreen-dialog/fullscreen-dialog.d.ts.map +0 -1
  195. package/ebay-fullscreen-dialog/index.d.ts +0 -2
  196. package/ebay-fullscreen-dialog/index.d.ts.map +0 -1
  197. package/ebay-fullscreen-dialog/index.js +0 -10
  198. package/ebay-radio/radio/index.js +0 -48
  199. package/icon-B17Di3YL.js +0 -56
  200. package/icon-button-BQWoMgX1.js +0 -31
  201. package/index-BXizW4ue.js +0 -89
  202. package/index-DcH7Tjjd.js +0 -272
  203. package/label-C0AS4fnO.js +0 -19
  204. package/listbox-DfOw_fJc.js +0 -662
  205. package/menu-Bsy48CE1.js +0 -163
  206. package/menu-button-CKGsgg6G.js +0 -89
  207. package/menu-fCOy6wBS.js +0 -29
  208. package/notice-content-BTXVxttv.js +0 -8
  209. package/notice-content-BhUeK1pd.js +0 -3
  210. package/notice-footer-CIQ8SM6N.js +0 -10
  211. package/progress-spinner-DOFKRtuu.js +0 -20
  212. package/range-C5qzyhg4.js +0 -3
  213. package/textbox-J291yCpJ.js +0 -136
  214. package/use-roving-index-CEM_UsCH.js +0 -58
  215. package/use-tooltip-7JxcZHJn.js +0 -92
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const drawer = require("../drawer-DBDktEBZ.js");
4
- exports.EbayDrawerDialog = drawer.EbayDrawerDialog;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const classNames = require("classnames");
4
- const icon = require("../../icon-B17Di3YL.js");
5
- const badge = require("../../badge-CR5t7-2L.js");
6
- const EbayMenuItem = ({ className, current, disabled, autoFocus, type, badgeNumber, badgeAriaLabel, children, ...rest }) => {
7
- const ref = React.useRef();
8
- const hasBadge = badgeNumber !== void 0;
9
- React.useEffect(() => {
10
- var _a;
11
- if (autoFocus) {
12
- (_a = ref.current) == null ? void 0 : _a.focus();
13
- }
14
- });
15
- const itemProps = {
16
- ...rest,
17
- ref,
18
- className: classNames(className, "fake-menu__item", hasBadge && "menu__item--badged"),
19
- "aria-label": badgeAriaLabel
20
- };
21
- const tick = React.createElement(icon.EbayIcon, { name: "tick16" });
22
- const badgeStyleFix = {
23
- marginLeft: "var(--spacing-100)",
24
- marginRight: "var(--spacing-100)"
25
- };
26
- const badge$1 = hasBadge && React.createElement(badge.EbayBadge, { type: "menu", number: badgeNumber, style: badgeStyleFix });
27
- return type === "button" ? React.createElement(
28
- "button",
29
- { ...itemProps, type: "button", disabled },
30
- React.createElement(
31
- "span",
32
- null,
33
- children,
34
- badge$1
35
- ),
36
- tick
37
- ) : React.createElement(
38
- "a",
39
- { ...itemProps, "aria-disabled": disabled ? "true" : void 0 },
40
- React.createElement(
41
- "span",
42
- null,
43
- children,
44
- badge$1
45
- ),
46
- tick
47
- );
48
- };
49
- module.exports = EbayMenuItem;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- require("react");
3
- require("classnames");
4
- require("../../common/component-utils/utils/index.js");
5
- require("../../common/event-utils/index.js");
6
- require("../../common/random-id/index.js");
7
- require("../../button-B4bZIgwB.js");
8
- require("../../icon-B17Di3YL.js");
9
- require("../../icon-button-BQWoMgX1.js");
10
- require("../../menu-fCOy6wBS.js");
11
- const ebayFakeMenuButton_menuButton = require("../../menu-button-CKGsgg6G.js");
12
- module.exports = ebayFakeMenuButton_menuButton.EbayMenuButton;
@@ -1 +0,0 @@
1
- {"version":3,"file":"fullscreen-dialog.d.ts","sourceRoot":"","sources":["../../src/ebay-fullscreen-dialog/fullscreen-dialog.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,eAAe,EAAuB,MAAM,qBAAqB,CAAA;AAI1E,MAAM,WAAW,KAAK,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,eAAe,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,oBAAoB,EAAE,EAAE,CAAC,KAAK,CAkBnC,CAAA;AAED,eAAe,oBAAoB,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default as EbayFullscreenDialog } from './fullscreen-dialog';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-fullscreen-dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,qBAAqB,CAAA"}
@@ -1,10 +0,0 @@
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 = "fullscreen-dialog";
8
- const EbayFullscreenDialog = ({ open, onClose = () => {
9
- }, className, animated, ...rest }) => React.createElement(dialogPreviousButton.DialogBaseWithState, { ...rest, classPrefix, buttonPosition: "right", onCloseBtnClick: onClose, transitionElement: "window", animated, className: classNames(className, `${classPrefix}--mask-fade-slow`), windowClass: classNames(`${classPrefix}__window`, `${classPrefix}__window--slide`), open });
10
- exports.EbayFullscreenDialog = EbayFullscreenDialog;
@@ -1,48 +0,0 @@
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;
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;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const classNames = require("classnames");
4
- const icon = require("./icon-B17Di3YL.js");
5
- const badge = require("./badge-CR5t7-2L.js");
6
- const common_componentUtils_forwardRef = require("./common/component-utils/forwardRef/index.js");
7
- require("./array.polyfill.flat-DyxysTxZ.js");
8
- const EbayIconButton = ({ href, icon: icon$1, badgeNumber, badgeAriaLabel, transparent, className: extraClasses, forwardedRef, size, onEscape = () => {
9
- }, onKeyDown = () => {
10
- }, ...rest }) => {
11
- const classPrefix = href ? "icon-link" : "icon-btn";
12
- const className = classNames(extraClasses, classPrefix, size && `${classPrefix}--${size}`, {
13
- [`${classPrefix}--badged`]: badgeNumber,
14
- [`${classPrefix}--transparent`]: transparent
15
- });
16
- const children = React.createElement(
17
- React.Fragment,
18
- null,
19
- React.createElement(icon.EbayIcon, { name: icon$1 }),
20
- badgeNumber && React.createElement(badge.EbayBadge, { type: "icon", number: badgeNumber, "aria-label": badgeAriaLabel })
21
- );
22
- const keyDownHandler = (e) => {
23
- if (e.key === "Escape" || e.key === "Esc") {
24
- onEscape(e);
25
- }
26
- onKeyDown(e);
27
- };
28
- return href ? React.createElement("a", { ref: forwardedRef, className, href, onKeyDown: keyDownHandler, ...rest }, children) : React.createElement("button", { ref: forwardedRef, type: "button", className, onKeyDown: keyDownHandler, ...rest }, children);
29
- };
30
- const EbayIconButton$1 = common_componentUtils_forwardRef.withForwardRef(EbayIconButton);
31
- exports.EbayIconButton = EbayIconButton$1;
package/index-BXizW4ue.js DELETED
@@ -1,89 +0,0 @@
1
- "use strict";
2
- const sequenceMap = {};
3
- const defaultPrefix = "nid";
4
- const randomPortion = createRandomPortion(3);
5
- function randomNumber(max) {
6
- return Math.floor(Math.random() * max);
7
- }
8
- function createRandomPortion(size) {
9
- const letters = "abcdefghijklmnopqrstuvwxyz";
10
- const digits = "0123456789";
11
- const allChars = letters + digits;
12
- let portion = letters[randomNumber(25)];
13
- for (let i = 1; i < size; i++) {
14
- portion += allChars[randomNumber(35)];
15
- }
16
- return portion;
17
- }
18
- function src_default$1(el, prefix = defaultPrefix) {
19
- const separator = prefix === "" ? "" : "-";
20
- const key = `${prefix}${separator}${randomPortion}`;
21
- sequenceMap[key] = sequenceMap[key] || 0;
22
- if (!el.id) {
23
- el.setAttribute("id", `${key}-${sequenceMap[key]++}`);
24
- }
25
- return el.id;
26
- }
27
- const focusExitEmitters = {};
28
- function doFocusExit(el, fromElement, toElement) {
29
- el.dispatchEvent(
30
- new CustomEvent("focusExit", {
31
- detail: { fromElement, toElement },
32
- bubbles: false
33
- // mirror the native mouseleave event
34
- })
35
- );
36
- }
37
- function onDocumentFocusIn(e) {
38
- const newFocusElement = e.target;
39
- const targetIsDescendant = this.el.contains(newFocusElement);
40
- if (targetIsDescendant === true) {
41
- this.currentFocusElement = newFocusElement;
42
- } else {
43
- window.removeEventListener("blur", this.onWindowBlurListener);
44
- document.removeEventListener("focusin", this.onDocumentFocusInListener);
45
- doFocusExit(this.el, this.currentFocusElement, newFocusElement);
46
- this.currentFocusElement = null;
47
- }
48
- }
49
- function onWindowBlur() {
50
- doFocusExit(this.el, this.currentFocusElement, void 0);
51
- }
52
- function onWidgetFocusIn() {
53
- document.addEventListener("focusin", this.onDocumentFocusInListener);
54
- window.addEventListener("blur", this.onWindowBlurListener);
55
- }
56
- class FocusExitEmitter {
57
- constructor(el) {
58
- this.el = el;
59
- this.currentFocusElement = null;
60
- this.onWidgetFocusInListener = onWidgetFocusIn.bind(this);
61
- this.onDocumentFocusInListener = onDocumentFocusIn.bind(this);
62
- this.onWindowBlurListener = onWindowBlur.bind(this);
63
- this.el.addEventListener("focusin", this.onWidgetFocusInListener);
64
- }
65
- removeEventListeners() {
66
- window.removeEventListener("blur", this.onWindowBlurListener);
67
- document.removeEventListener("focusin", this.onDocumentFocusInListener);
68
- this.el.removeEventListener("focusin", this.onWidgetFocusInListener);
69
- }
70
- }
71
- function addFocusExit(el) {
72
- let exitEmitter = null;
73
- src_default$1(el);
74
- if (!focusExitEmitters[el.id]) {
75
- exitEmitter = new FocusExitEmitter(el);
76
- focusExitEmitters[el.id] = exitEmitter;
77
- }
78
- return exitEmitter;
79
- }
80
- function removeFocusExit(el) {
81
- const exitEmitter = focusExitEmitters[el.id];
82
- if (exitEmitter) {
83
- exitEmitter.removeEventListeners();
84
- delete focusExitEmitters[el.id];
85
- }
86
- }
87
- exports.addFocusExit = addFocusExit;
88
- exports.removeFocusExit = removeFocusExit;
89
- exports.src_default = src_default$1;
package/index-DcH7Tjjd.js DELETED
@@ -1,272 +0,0 @@
1
- "use strict";
2
- const index = require("./index-BXizW4ue.js");
3
- const focusableElList = [
4
- "a[href]",
5
- "area[href]",
6
- "button:not([disabled])",
7
- "embed",
8
- "iframe",
9
- "input:not([disabled])",
10
- "object",
11
- "select:not([disabled])",
12
- "textarea:not([disabled])",
13
- "*[tabindex]",
14
- "*[contenteditable]"
15
- ];
16
- const focusableElSelector = focusableElList.join();
17
- function src_default$1(el, keyboardOnly = false, callback) {
18
- return getFocusables(el, keyboardOnly);
19
- }
20
- function getFocusables(el, keyboardOnly = false) {
21
- let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));
22
- focusableEls = focusableEls.filter(function(focusableEl) {
23
- return !!(focusableEl.offsetWidth || focusableEl.offsetHeight || focusableEl.getClientRects().length);
24
- });
25
- if (keyboardOnly === true) {
26
- focusableEls = focusableEls.filter(function(focusableEl) {
27
- return focusableEl.getAttribute("tabindex") !== "-1";
28
- });
29
- }
30
- return focusableEls;
31
- }
32
- const defaultOptions = {
33
- alwaysDoFocusManagement: false,
34
- ariaControls: true,
35
- autoCollapse: false,
36
- collapseOnFocusOut: false,
37
- collapseOnMouseOut: false,
38
- collapseOnClickOut: false,
39
- contentSelector: ".expander__content",
40
- expandedClass: null,
41
- expandOnClick: false,
42
- expandOnFocus: false,
43
- expandOnHover: false,
44
- focusManagement: null,
45
- hostSelector: ".expander__host",
46
- simulateSpacebarClick: false
47
- };
48
- function onHostKeyDown(e) {
49
- if (e.keyCode === 13 || e.keyCode === 32) {
50
- this._keyboardClickFlag = true;
51
- }
52
- if (e.keyCode === 32 && this.options.simulateSpacebarClick === true) {
53
- this.hostEl.click();
54
- }
55
- }
56
- function onHostMouseDown() {
57
- this._mouseClickFlag = true;
58
- }
59
- function onHostClick() {
60
- this._expandWasKeyboardClickActivated = this._keyboardClickFlag;
61
- this._expandWasMouseClickActivated = this._mouseClickFlag;
62
- this.expanded = !this.expanded;
63
- }
64
- function onHostFocus() {
65
- this._expandWasFocusActivated = true;
66
- this.expanded = true;
67
- }
68
- function onHostHover() {
69
- clearTimeout(this._mouseLeft);
70
- this._expandWasHoverActivated = true;
71
- this.expanded = true;
72
- }
73
- function onFocusExit() {
74
- this.expanded = false;
75
- }
76
- function onMouseLeave() {
77
- clearTimeout(this._mouseLeft);
78
- this._mouseLeft = setTimeout(() => {
79
- this.expanded = false;
80
- }, 300);
81
- }
82
- function _onDocumentClick(e) {
83
- if (this.el.contains(e.target) === false) {
84
- this.expanded = false;
85
- }
86
- }
87
- function _onDocumentTouchStart() {
88
- this.documentClick = true;
89
- }
90
- function _onDocumentTouchMove() {
91
- this.documentClick = false;
92
- }
93
- function _onDocumentTouchEnd(e) {
94
- if (this.documentClick === true) {
95
- this.documentClick = false;
96
- if (this.el.contains(e.target) === false) {
97
- this.expanded = false;
98
- }
99
- }
100
- }
101
- function manageFocus(focusManagement, contentEl) {
102
- if (focusManagement === "content") {
103
- contentEl.setAttribute("tabindex", "-1");
104
- contentEl.focus();
105
- } else if (focusManagement === "focusable") {
106
- src_default$1(contentEl)[0].focus();
107
- } else if (focusManagement === "interactive") {
108
- src_default$1(contentEl, true)[0].focus();
109
- } else if (focusManagement !== null) {
110
- const el = contentEl.querySelector(`#${focusManagement}`);
111
- if (el) {
112
- el.focus();
113
- }
114
- }
115
- }
116
- class src_default {
117
- constructor(el, selectedOptions) {
118
- this.options = Object.assign({}, defaultOptions, selectedOptions);
119
- this.el = el;
120
- this.hostEl = el.querySelector(this.options.hostSelector);
121
- this.contentEl = el.querySelector(this.options.contentSelector);
122
- index.addFocusExit(this.el);
123
- this._hostKeyDownListener = onHostKeyDown.bind(this);
124
- this._hostMouseDownListener = onHostMouseDown.bind(this);
125
- this._documentClickListener = _onDocumentClick.bind(this);
126
- this._documentTouchStartListener = _onDocumentTouchStart.bind(this);
127
- this._documentTouchMoveListener = _onDocumentTouchMove.bind(this);
128
- this._documentTouchEndListener = _onDocumentTouchEnd.bind(this);
129
- this._hostClickListener = onHostClick.bind(this);
130
- this._hostFocusListener = onHostFocus.bind(this);
131
- this._hostHoverListener = onHostHover.bind(this);
132
- this._focusExitListener = onFocusExit.bind(this);
133
- this._mouseLeaveListener = onMouseLeave.bind(this);
134
- if (this.hostEl.getAttribute("aria-expanded") === null) {
135
- this.hostEl.setAttribute("aria-expanded", "false");
136
- }
137
- if (this.options.ariaControls === true) {
138
- index.src_default(this.el, "expander");
139
- this.contentEl.id = this.contentEl.id || `${this.el.id}-content`;
140
- this.hostEl.setAttribute("aria-controls", this.contentEl.id);
141
- }
142
- this.expandOnClick = this.options.expandOnClick;
143
- this.expandOnFocus = this.options.expandOnFocus;
144
- this.expandOnHover = this.options.expandOnHover;
145
- if (this.options.autoCollapse === false) {
146
- this.collapseOnClickOut = this.options.collapseOnClickOut;
147
- this.collapseOnFocusOut = this.options.collapseOnFocusOut;
148
- this.collapseOnMouseOut = this.options.collapseOnMouseOut;
149
- }
150
- }
151
- set expandOnClick(bool) {
152
- if (bool === true) {
153
- this.hostEl.addEventListener("keydown", this._hostKeyDownListener);
154
- this.hostEl.addEventListener("mousedown", this._hostMouseDownListener);
155
- this.hostEl.addEventListener("click", this._hostClickListener);
156
- if (this.options.autoCollapse === true) {
157
- this.collapseOnClickOut = true;
158
- this.collapseOnFocusOut = true;
159
- }
160
- } else {
161
- this.hostEl.removeEventListener("click", this._hostClickListener);
162
- this.hostEl.removeEventListener("mousedown", this._hostMouseDownListener);
163
- this.hostEl.removeEventListener("keydown", this._hostKeyDownListener);
164
- }
165
- }
166
- set expandOnFocus(bool) {
167
- if (bool === true) {
168
- this.hostEl.addEventListener("focus", this._hostFocusListener);
169
- if (this.options.autoCollapse === true) {
170
- this.collapseOnClickOut = true;
171
- this.collapseOnFocusOut = true;
172
- }
173
- } else {
174
- this.hostEl.removeEventListener("focus", this._hostFocusListener);
175
- }
176
- }
177
- set expandOnHover(bool) {
178
- if (bool === true) {
179
- this.hostEl.addEventListener("mouseenter", this._hostHoverListener);
180
- this.contentEl.addEventListener("mouseenter", this._hostHoverListener);
181
- if (this.options.autoCollapse === true) {
182
- this.collapseOnMouseOut = true;
183
- }
184
- } else {
185
- this.hostEl.removeEventListener("mouseenter", this._hostHoverListener);
186
- this.contentEl.removeEventListener("mouseenter", this._hostHoverListener);
187
- }
188
- }
189
- set collapseOnClickOut(bool) {
190
- if (bool === true) {
191
- document.addEventListener("click", this._documentClickListener);
192
- document.addEventListener("touchstart", this._documentTouchStartListener);
193
- document.addEventListener("touchmove", this._documentTouchMoveListener);
194
- document.addEventListener("touchend", this._documentTouchEndListener);
195
- } else {
196
- document.removeEventListener("click", this._documentClickListener);
197
- document.removeEventListener("touchstart", this._documentTouchStartListener);
198
- document.removeEventListener("touchmove", this._documentTouchMoveListener);
199
- document.removeEventListener("touchend", this._documentTouchEndListener);
200
- }
201
- }
202
- set collapseOnFocusOut(bool) {
203
- if (bool === true) {
204
- this.el.addEventListener("focusExit", this._focusExitListener);
205
- } else {
206
- this.el.removeEventListener("focusExit", this._focusExitListener);
207
- }
208
- }
209
- set collapseOnMouseOut(bool) {
210
- if (bool === true) {
211
- this.el.addEventListener("mouseleave", this._mouseLeaveListener);
212
- this.contentEl.addEventListener("mouseleave", this._mouseLeaveListener);
213
- } else {
214
- this.el.removeEventListener("mouseleave", this._mouseLeaveListener);
215
- this.contentEl.removeEventListener("mouseleave", this._mouseLeaveListener);
216
- }
217
- }
218
- get expanded() {
219
- return this.hostEl.getAttribute("aria-expanded") === "true";
220
- }
221
- set expanded(bool) {
222
- if (bool === true && this.expanded === false) {
223
- this.hostEl.setAttribute("aria-expanded", "true");
224
- if (this.options.expandedClass) {
225
- this.el.classList.add(this.options.expandedClass);
226
- }
227
- if (this._expandWasKeyboardClickActivated || this._expandWasMouseClickActivated && this.options.alwaysDoFocusManagement) {
228
- manageFocus(this.options.focusManagement, this.contentEl);
229
- }
230
- this.el.dispatchEvent(new CustomEvent("expander-expand", { bubbles: true, detail: this.contentEl }));
231
- }
232
- if (bool === false && this.expanded === true) {
233
- this.hostEl.setAttribute("aria-expanded", "false");
234
- if (this.options.expandedClass) {
235
- this.el.classList.remove(this.options.expandedClass);
236
- }
237
- this.el.dispatchEvent(new CustomEvent("expander-collapse", { bubbles: true, detail: this.contentEl }));
238
- }
239
- this._expandWasKeyboardClickActivated = false;
240
- this._expandWasMouseClickActivated = false;
241
- this._expandWasFocusActivated = false;
242
- this._expandWasHoverActivated = false;
243
- this._keyboardClickFlag = false;
244
- this._mouseClickFlag = false;
245
- }
246
- sleep() {
247
- if (this._destroyed !== true) {
248
- this.expandOnClick = false;
249
- this.expandOnFocus = false;
250
- this.expandOnHover = false;
251
- this.collapseOnClickOut = false;
252
- this.collapseOnFocusOut = false;
253
- this.collapseOnMouseOut = false;
254
- }
255
- }
256
- destroy() {
257
- this.sleep();
258
- this._destroyed = true;
259
- this._hostKeyDownListener = null;
260
- this._hostMouseDownListener = null;
261
- this._documentClickListener = null;
262
- this._documentTouchStartListener = null;
263
- this._documentTouchMoveListener = null;
264
- this._documentTouchEndListener = null;
265
- this._hostClickListener = null;
266
- this._hostFocusListener = null;
267
- this._hostHoverListener = null;
268
- this._focusExitListener = null;
269
- this._mouseLeaveListener = null;
270
- }
271
- }
272
- exports.src_default = src_default;
package/label-C0AS4fnO.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const classNames = require("classnames");
4
- const Label = ({ className, children, stacked = false, required = false, position = "start", ...rest }) => {
5
- const wrapperClassName = classNames(`field__label`, className, { "field__label--stacked": stacked }, { "field__label--end": position === "end" });
6
- const requiredMark = required ? React.createElement(
7
- React.Fragment,
8
- null,
9
- " ",
10
- React.createElement("sup", null, "*")
11
- ) : null;
12
- return React.createElement(
13
- "label",
14
- { className: wrapperClassName, ...rest },
15
- children,
16
- requiredMark
17
- );
18
- };
19
- exports.Label = Label;