@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,83 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const classNames$1 = require("classnames");
4
- const common_componentUtils_forwardRef = require("./common/component-utils/forwardRef/index.js");
5
- require("./array.polyfill.flat-DyxysTxZ.js");
6
- const icon = require("./icon-B17Di3YL.js");
7
- const progressSpinner = require("./progress-spinner-DOFKRtuu.js");
8
- const classNames = {
9
- cta: "cta-",
10
- fake: "fake-",
11
- expand: "expand-",
12
- default: ""
13
- };
14
- const EbayButtonCell = ({ type = "default", children, ...rest }) => React.createElement(
15
- "span",
16
- { className: `${classNames[type]}btn__cell`, ...rest },
17
- React.createElement(React.Fragment, null, children)
18
- );
19
- const EbayButtonLoading = () => React.createElement(
20
- EbayButtonCell,
21
- null,
22
- React.createElement(progressSpinner.EbayProgressSpinner, null)
23
- );
24
- const EbayButtonText = ({ className, children }) => React.createElement("span", { className: classNames$1(className, "btn__text") }, children);
25
- const EbayButtonExpand = ({ children }) => children ? React.createElement(
26
- EbayButtonCell,
27
- null,
28
- React.createElement(EbayButtonText, null, children),
29
- React.createElement(icon.EbayIcon, { name: "chevronDown12" })
30
- ) : React.createElement(icon.EbayIcon, { name: "chevronDown12" });
31
- const EbayButton = ({ priority = "secondary", variant = "standard", size = "regular", bodyState, split, transparent = false, fluid = false, disabled, partiallyDisabled, children, onKeyDown = () => {
32
- }, onEscape = () => {
33
- }, truncate = false, href, className: extraClasses, forwardedRef, borderless, fixedHeight, ...rest }) => {
34
- const classPrefix = href ? "fake-btn" : "btn";
35
- const priorityStyles = {
36
- primary: `${classPrefix}--primary`,
37
- secondary: `${classPrefix}--secondary`,
38
- tertiary: `${classPrefix}--tertiary`,
39
- none: ""
40
- };
41
- const sizeStyles = {
42
- large: `${classPrefix}--large`,
43
- small: `${classPrefix}--small`,
44
- regular: "",
45
- default: ""
46
- };
47
- const splitStyles = {
48
- start: `${classPrefix}--split-start`,
49
- end: `${classPrefix}--split-end`
50
- };
51
- const isDestructive = variant === "destructive";
52
- const isForm = variant === "form";
53
- const isLoading = bodyState === "loading";
54
- const isExpand = bodyState === "expand";
55
- const isSlim = isForm && (isIconOnly(children) || isExpand && !children);
56
- const className = classNames$1(classPrefix, extraClasses, priorityStyles[isForm || borderless ? "none" : priority], sizeStyles[size], splitStyles[split], isDestructive && `${classPrefix}--destructive`, isForm && `${classPrefix}--form`, isSlim && `${classPrefix}--slim`, transparent && `${classPrefix}--transparent`, fluid && `${classPrefix}--fluid`, truncate && `${classPrefix}--truncated`, borderless && `${classPrefix}--borderless`, fixedHeight && (sizeStyles[size] ? `${sizeStyles[size]}-${fixedHeight}` : `${classPrefix}--fixed-height`));
57
- const keyDownHandler = (e) => {
58
- onKeyDown(e);
59
- if (e.key === "Escape" || e.key === "Esc") {
60
- onEscape(e);
61
- }
62
- };
63
- const bodyContent = getBodyContent(children, { isLoading, isExpand });
64
- const ariaLive = isLoading ? `polite` : null;
65
- return href ? React.createElement("a", { className, href: disabled ? void 0 : href, ref: forwardedRef, onKeyDown: keyDownHandler, "aria-live": ariaLive, ...rest }, bodyContent) : React.createElement("button", { disabled, "aria-disabled": partiallyDisabled, "aria-live": ariaLive, className, ref: forwardedRef, onKeyDown: keyDownHandler, ...rest }, bodyContent);
66
- };
67
- function getBodyContent(children, { isLoading, isExpand }) {
68
- switch (true) {
69
- case isLoading:
70
- return React.createElement(EbayButtonLoading, null);
71
- case isExpand:
72
- return React.createElement(EbayButtonExpand, null, children);
73
- default:
74
- return children;
75
- }
76
- }
77
- function isIconOnly(children) {
78
- const childrenArray = React.Children.toArray(children);
79
- return childrenArray.length === 1 && childrenArray[0].type === icon.EbayIcon;
80
- }
81
- const EbayButton$1 = common_componentUtils_forwardRef.withForwardRef(EbayButton);
82
- exports.EbayButton = EbayButton$1;
83
- exports.EbayButtonCell = EbayButtonCell;
@@ -1,333 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const iconButton = require("./icon-button-BQWoMgX1.js");
4
- const classNames = require("classnames");
5
- function findFirstDayOfWeek(localeName) {
6
- const locale = new Intl.Locale(localeName);
7
- if (locale.weekInfo) {
8
- return locale.weekInfo.firstDay;
9
- }
10
- return 0;
11
- }
12
- function getWeekdayInfo(localeName) {
13
- const firstDayOfWeek = findFirstDayOfWeek(localeName);
14
- const weekdayLabelFormatter = new Intl.DateTimeFormat(localeName, {
15
- weekday: "short"
16
- });
17
- const weekday = new Date(2022, 9, 2 + firstDayOfWeek);
18
- const weekdayLabels = [...Array(7)].map(() => {
19
- const dayLabel = weekdayLabelFormatter.format(weekday);
20
- weekday.setDate(weekday.getDate() + 1);
21
- return dayLabel;
22
- });
23
- return {
24
- firstDayOfWeek,
25
- weekdayLabels
26
- };
27
- }
28
- function dateArgToISO(arg) {
29
- if (!arg)
30
- return void 0;
31
- if (/^\d\d\d\d-\d\d-\d\d$/g.test(arg))
32
- return arg;
33
- return toISO(new Date(arg));
34
- }
35
- function toISO(date) {
36
- if (isNaN(date.getTime()))
37
- return;
38
- return date.toISOString().slice(0, 10);
39
- }
40
- function fromISO(iso) {
41
- return new Date(iso);
42
- }
43
- function offsetISO(iso, days) {
44
- const date = fromISO(iso);
45
- date.setUTCDate(date.getUTCDate() + days);
46
- return toISO(date);
47
- }
48
- function localeOverride(locale) {
49
- return locale || navigator.language;
50
- }
51
- const DAY_UPDATE_KEYMAP = {
52
- ArrowRight: 1,
53
- ArrowLeft: -1,
54
- ArrowDown: 7,
55
- ArrowUp: -7
56
- };
57
- const EbayCalendar = ({ selected, numMonths = 1, navigable, interactive, range, locale, disableBefore, disableAfter, disableWeekdays, disableList, a11ySelectedText = "selected", a11yRangeStartText = "start of range", a11yInRangeText = "in range", a11yRangeEndText = "end of range", a11ySeparator = "-", a11yTodayText = "today", a11yDisabledText = "inactive", getA11yShowMonthText = (monthTitle) => `Show ${monthTitle}`, linkBuilder, onMonthChange = () => {
58
- }, onFocus = () => {
59
- }, onSelect = () => {
60
- } }) => {
61
- const todayISO = toISO(/* @__PURE__ */ new Date());
62
- const { firstDayOfWeek, weekdayLabels } = getWeekdayInfo(localeOverride(locale));
63
- const containerRef = React.useRef(null);
64
- const [offset, setOffset] = React.useState(0);
65
- const [focusISO, setFocusISO] = React.useState(null);
66
- const [tabIndexISO, setTabIndexISO] = React.useState(todayISO);
67
- const baseISO = React.useRef(todayISO);
68
- const getMonthDate = (monthOffset) => {
69
- const baseDate = fromISO(baseISO.current);
70
- const date = new Date(Date.UTC(baseDate.getUTCFullYear(), baseDate.getUTCMonth() + monthOffset));
71
- return date;
72
- };
73
- const getFirstVisibleISO = () => toISO(getMonthDate(offset));
74
- const getLastVisibleISO = () => {
75
- const baseDate = fromISO(baseISO.current);
76
- return toISO(new Date(Date.UTC(baseDate.getUTCFullYear(), baseDate.getUTCMonth() + offset + (numMonths || 1), 0)));
77
- };
78
- React.useEffect(() => {
79
- if (selected) {
80
- const selectedISOs = Array.isArray(selected) ? selected : [selected];
81
- const currFirstISO = getFirstVisibleISO();
82
- const currLastISO = getLastVisibleISO();
83
- const selectedTimeInView = selectedISOs.find((iso) => iso >= currFirstISO && iso <= currLastISO);
84
- if (selectedTimeInView === void 0) {
85
- baseISO.current = selectedISOs[0];
86
- setOffset(0);
87
- }
88
- }
89
- }, [selected]);
90
- const calculateRangeDisplay = () => {
91
- if (selected && range) {
92
- let iso1;
93
- let iso2;
94
- if (Array.isArray(selected)) {
95
- [iso1, iso2] = selected;
96
- } else if (focusISO) {
97
- iso1 = selected;
98
- iso2 = focusISO;
99
- }
100
- if (iso1 && iso2) {
101
- const [start, end] = [iso1, iso2].sort();
102
- return {
103
- rangeStart: start,
104
- rangeEnd: end
105
- };
106
- }
107
- }
108
- return {
109
- rangeStart: null,
110
- rangeEnd: null
111
- };
112
- };
113
- const monthTitle = (date) => {
114
- const formatter = new Intl.DateTimeFormat(localeOverride(locale), {
115
- month: "long",
116
- year: "numeric"
117
- });
118
- return formatter.format(new Date(date.getUTCFullYear(), date.getUTCMonth()));
119
- };
120
- const isDayDisabled = (iso) => disableBefore && iso < disableBefore || disableAfter && iso > disableAfter || disableWeekdays && disableWeekdays.includes(fromISO(iso).getUTCDay()) || disableList && disableList.includes(iso);
121
- const getFirstActiveISO = () => {
122
- let iso = getFirstVisibleISO();
123
- const lastVisible = getLastVisibleISO();
124
- while (iso <= lastVisible && isDayDisabled(iso)) {
125
- iso = offsetISO(iso, 1);
126
- }
127
- return iso > lastVisible ? null : iso;
128
- };
129
- const getLastActiveISO = () => {
130
- let iso = getLastVisibleISO();
131
- const firstVisible = getFirstVisibleISO();
132
- while (iso >= firstVisible && isDayDisabled(iso)) {
133
- iso = offsetISO(iso, -1);
134
- }
135
- return iso < firstVisible ? null : iso;
136
- };
137
- const setTabindexAndFocus = (iso) => {
138
- setTabIndexISO(iso);
139
- setTimeout(() => {
140
- var _a;
141
- const elementToFocus = (_a = containerRef.current) == null ? void 0 : _a.querySelector(`[data-iso="${iso}"]`);
142
- elementToFocus == null ? void 0 : elementToFocus.focus();
143
- });
144
- };
145
- const prevMonth = (focus) => {
146
- if (disableBefore && getFirstVisibleISO() <= disableBefore) {
147
- return false;
148
- }
149
- setOffset((currentOffset) => currentOffset - 1);
150
- let newTabIndexISO = tabIndexISO;
151
- const lastActiveISO = getLastActiveISO();
152
- if (lastActiveISO && lastActiveISO < tabIndexISO) {
153
- newTabIndexISO = lastActiveISO;
154
- setTabIndexISO(lastActiveISO);
155
- }
156
- if (focus) {
157
- setTabindexAndFocus(newTabIndexISO);
158
- }
159
- onMonthChange({
160
- iso: toISO(getMonthDate(offset))
161
- });
162
- return true;
163
- };
164
- const nextMonth = (focus) => {
165
- if (disableAfter && getLastVisibleISO() >= disableAfter) {
166
- return false;
167
- }
168
- setOffset((currentOffset) => currentOffset + 1);
169
- let newTabIndexISO = tabIndexISO;
170
- const firstActiveISO = getFirstActiveISO();
171
- if (firstActiveISO && firstActiveISO > tabIndexISO) {
172
- newTabIndexISO = firstActiveISO;
173
- setTabIndexISO(firstActiveISO);
174
- }
175
- if (focus) {
176
- setTabindexAndFocus(newTabIndexISO);
177
- }
178
- onMonthChange({
179
- iso: toISO(getMonthDate(offset + (numMonths || 1)))
180
- });
181
- };
182
- const onKeyDown = (event) => {
183
- const dayChange = DAY_UPDATE_KEYMAP[event.key];
184
- if (dayChange) {
185
- event.preventDefault();
186
- let tries = 7;
187
- let iso = tabIndexISO;
188
- do {
189
- iso = offsetISO(iso, dayChange);
190
- } while (tries-- > 0 && isDayDisabled(iso));
191
- if (tries > 0) {
192
- const firstVisible = getFirstVisibleISO();
193
- const lastVisible = getLastVisibleISO();
194
- if (iso < firstVisible) {
195
- if (navigable) {
196
- prevMonth();
197
- } else {
198
- iso = firstVisible;
199
- }
200
- } else if (iso > lastVisible) {
201
- if (navigable) {
202
- nextMonth();
203
- } else {
204
- iso = lastVisible;
205
- }
206
- }
207
- setTabindexAndFocus(iso);
208
- }
209
- } else {
210
- switch (event.key) {
211
- case "PageUp":
212
- prevMonth(true);
213
- break;
214
- case "PageDown":
215
- nextMonth(true);
216
- break;
217
- case "Home":
218
- setTabindexAndFocus(getFirstActiveISO());
219
- break;
220
- case "End":
221
- setTabindexAndFocus(getLastActiveISO());
222
- break;
223
- }
224
- }
225
- };
226
- const onDaySelect = (event, iso) => {
227
- onSelect(event, { iso });
228
- };
229
- const onDayFocus = (event, day) => {
230
- setFocusISO(day);
231
- setTabIndexISO(day);
232
- onFocus(event, { iso: day });
233
- };
234
- const onDayBlur = () => {
235
- setFocusISO(null);
236
- };
237
- const { rangeStart, rangeEnd } = calculateRangeDisplay();
238
- const isDayInRange = (iso) => {
239
- if (!rangeStart || !rangeEnd) {
240
- return false;
241
- }
242
- if (iso < rangeStart || iso > rangeEnd) {
243
- return false;
244
- }
245
- return true;
246
- };
247
- const monthDates = [...Array(numMonths)].map((_, i) => getMonthDate(offset + i));
248
- return React.createElement(
249
- "div",
250
- { className: "calendar", ref: containerRef },
251
- navigable && React.createElement(
252
- "div",
253
- { className: "calendar__header" },
254
- React.createElement(
255
- "div",
256
- { className: "calendar__header--inner" },
257
- React.createElement(iconButton.EbayIconButton, { transparent: true, size: "small", icon: "chevronLeft24", disabled: disableBefore && getFirstVisibleISO() <= disableBefore, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset - 1))), onClick: () => prevMonth() }),
258
- monthDates.map((monthDate, i) => React.createElement("h3", { key: i }, monthTitle(monthDate))),
259
- React.createElement(iconButton.EbayIconButton, { transparent: true, size: "small", icon: "chevronRight24", disabled: disableAfter && getLastVisibleISO() >= disableAfter, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset + numMonths))), onClick: () => nextMonth() })
260
- )
261
- ),
262
- React.createElement("div", { className: "calendar__body" }, monthDates.map((monthDate, i) => {
263
- const numBlankDays = (monthDate.getUTCDay() - firstDayOfWeek + 7) % 7;
264
- const year = monthDate.getUTCFullYear();
265
- const month = monthDate.getUTCMonth();
266
- const daysInMont = new Date(year, month + 1, 0).getDate();
267
- const calendarRows = [...Array(Math.ceil((numBlankDays + daysInMont) / 7))];
268
- return React.createElement(
269
- "div",
270
- { key: i, className: "calendar__month" },
271
- React.createElement(
272
- "table",
273
- { onKeyDown },
274
- React.createElement("caption", null, monthTitle(monthDate)),
275
- React.createElement(
276
- "thead",
277
- null,
278
- React.createElement("tr", null, weekdayLabels.map((dayName) => React.createElement("th", { key: dayName, scope: "col" }, dayName)))
279
- ),
280
- React.createElement("tbody", null, calendarRows.map((_, row) => {
281
- let startDate = row * 7 - numBlankDays + 1;
282
- let endDate = startDate + 6;
283
- const columns = [];
284
- if (row === 0 && numBlankDays !== 0) {
285
- startDate = 1;
286
- columns.push(React.createElement("td", { key: "pre-column", colSpan: numBlankDays }));
287
- } else if (endDate > daysInMont) {
288
- endDate = daysInMont;
289
- }
290
- for (let day = startDate; day <= endDate; day++) {
291
- const dayISO = toISO(new Date(Date.UTC(year, month, day)));
292
- const isToday = dayISO === todayISO;
293
- const isSelected = Array.isArray(selected) ? selected.some((iso) => iso === dayISO) : selected === dayISO;
294
- const isRangeStart = dayISO === rangeStart;
295
- const isInRange = isDayInRange(dayISO);
296
- const isRangeEnd = dayISO === rangeEnd;
297
- const isDisabled = isDayDisabled(dayISO);
298
- const a11yTexts = [
299
- "",
300
- isSelected && a11ySelectedText,
301
- isRangeStart && a11yRangeStartText,
302
- !isRangeStart && !isRangeEnd && isInRange && a11yInRangeText,
303
- isRangeEnd && a11yRangeEndText,
304
- !interactive && isToday && a11yTodayText,
305
- !interactive && isDisabled && a11yDisabledText
306
- ].filter((value) => typeof value !== "boolean" || value !== false);
307
- const link = !interactive && !isDisabled && linkBuilder && linkBuilder(dayISO);
308
- const NonInteractiveTag = link ? "a" : "span";
309
- columns.push(React.createElement("td", { key: day, className: classNames({
310
- "calendar__cell--selected": isSelected,
311
- "calendar__range--start": isRangeStart,
312
- "calendar__range": isInRange,
313
- "calendar__range--end": isRangeEnd
314
- }) }, interactive ? React.createElement("button", { disabled: isDisabled, "aria-label": a11yTexts.length > 1 ? `${day}${a11yTexts.join(a11ySeparator)}` : void 0, tabIndex: tabIndexISO !== dayISO ? -1 : void 0, "aria-current": isToday ? "date" : void 0, "aria-pressed": isSelected ? "true" : void 0, onClick: (event) => onDaySelect(event, dayISO), onFocus: (event) => onDayFocus(event, dayISO), onMouseOver: (event) => onDayFocus(event, dayISO), onMouseOut: (event) => onDayBlur(), onBlur: () => onDayBlur(), "data-iso": dayISO }, day) : React.createElement(
315
- NonInteractiveTag,
316
- { className: classNames({
317
- "calendar__cell--disabled": isDisabled,
318
- "calendar__cell--current": isToday
319
- }), href: link },
320
- day,
321
- a11yTexts.length > 1 && React.createElement("span", { className: "clipped" }, a11yTexts.join(a11ySeparator))
322
- )));
323
- }
324
- return React.createElement("tr", { key: row }, columns);
325
- }))
326
- )
327
- );
328
- }))
329
- );
330
- };
331
- exports.EbayCalendar = EbayCalendar;
332
- exports.dateArgToISO = dateArgToISO;
333
- exports.toISO = toISO;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const getDisplayName = (Component) => Component.displayName || Component.name || "Component";
5
- const withForwardRef = (Component) => {
6
- const ForwardRef = React.forwardRef((props, ref) => React.createElement(Component, { ...props, forwardedRef: ref }));
7
- ForwardRef.displayName = getDisplayName(Component);
8
- return ForwardRef;
9
- };
10
- exports.withForwardRef = withForwardRef;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const common_componentUtils_forwardRef = require("./forwardRef/index.js");
4
- const common_componentUtils_utils = require("./utils/index.js");
5
- exports.withForwardRef = common_componentUtils_forwardRef.withForwardRef;
6
- exports.excludeComponent = common_componentUtils_utils.excludeComponent;
7
- exports.filterBy = common_componentUtils_utils.filterBy;
8
- exports.filterByType = common_componentUtils_utils.filterByType;
9
- exports.findComponent = common_componentUtils_utils.findComponent;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- require("../../../array.polyfill.flat-DyxysTxZ.js");
5
- function findComponent(nodes = [], componentType) {
6
- const elements = React.Children.toArray(nodes);
7
- return elements.find(({ type }) => type === componentType) || null;
8
- }
9
- function excludeComponent(nodes = [], componentType) {
10
- const elements = React.Children.toArray(nodes);
11
- return elements.filter(({ type }) => type !== componentType);
12
- }
13
- function filterByType(nodes = [], componentType) {
14
- const elements = React.Children.toArray(nodes);
15
- const types = [componentType].flat();
16
- return elements.filter(({ type }) => types.includes(type));
17
- }
18
- function filterBy(nodes = [], predicate) {
19
- const elements = React.Children.toArray(nodes);
20
- return elements.filter(predicate);
21
- }
22
- exports.excludeComponent = excludeComponent;
23
- exports.filterBy = filterBy;
24
- exports.filterByType = filterByType;
25
- exports.findComponent = findComponent;
@@ -1,113 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function handleKeydown(keyList, e, callback = () => {
4
- }) {
5
- if (keyList.includes(e.key)) {
6
- callback();
7
- }
8
- }
9
- function handleNotKeydown(keyList, e, callback = () => {
10
- }) {
11
- if (!keyList.includes(e.key)) {
12
- callback();
13
- }
14
- }
15
- function handleEnterKeydown(e, callback) {
16
- if (e.key === "Enter") {
17
- callback();
18
- }
19
- }
20
- function handleActionKeydown(e, callback) {
21
- if (isActionKey(e.key)) {
22
- callback();
23
- }
24
- }
25
- function isActionKey(key) {
26
- return [" ", "Enter"].includes(key);
27
- }
28
- function handleEscapeKeydown(e, callback) {
29
- handleKeydown(["Esc", "Escape"], e, callback);
30
- }
31
- function handleUpDownArrowsKeydown(e, callback) {
32
- handleKeydown(["Up", "ArrowUp", "Down", "ArrowDown"], e, callback);
33
- }
34
- function handleLeftRightArrowsKeydown(e, callback) {
35
- handleKeydown(["Left", "ArrowLeft", "Right", "ArrowRight"], e, callback);
36
- }
37
- function handleTextInput(e, callback) {
38
- const keyList = [
39
- // Edge
40
- "Esc",
41
- "Left",
42
- "Up",
43
- "Right",
44
- "Down",
45
- // Browsers
46
- "Tab",
47
- "Enter",
48
- "Shift",
49
- "Control",
50
- "Alt",
51
- "CapsLock",
52
- "Escape",
53
- "ArrowLeft",
54
- "ArrowUp",
55
- "ArrowRight",
56
- "ArrowDown",
57
- "Meta"
58
- ];
59
- handleNotKeydown(keyList, e, callback);
60
- }
61
- function preventDefaultIfHijax(e, hijax) {
62
- if (hijax) {
63
- e.preventDefault();
64
- }
65
- }
66
- const handlers = [];
67
- function addEventListener(_, handler) {
68
- if (handlers.length === 0) {
69
- window.addEventListener("resize", handleResize);
70
- }
71
- handlers.push(handler);
72
- }
73
- function removeEventListener(_, handler) {
74
- if (handlers.length === 1) {
75
- window.removeEventListener("resize", handleResize);
76
- }
77
- handlers.splice(handlers.indexOf(handler), 1);
78
- }
79
- function handleResize(e) {
80
- window.removeEventListener("resize", handleResize);
81
- const callback = () => {
82
- if (handlers.length) {
83
- handlers.forEach((handler) => handler(e));
84
- window.addEventListener("resize", handleResize);
85
- }
86
- };
87
- if (window.requestAnimationFrame) {
88
- window.requestAnimationFrame(callback);
89
- } else {
90
- window.setTimeout(callback, 16);
91
- }
92
- }
93
- function wrapEvent(parentEventHandler = () => {
94
- }, localEventHandler) {
95
- return (e) => {
96
- parentEventHandler(e);
97
- if (!e.defaultPrevented) {
98
- return localEventHandler(e);
99
- }
100
- };
101
- }
102
- exports.addEventListener = addEventListener;
103
- exports.handleActionKeydown = handleActionKeydown;
104
- exports.handleEnterKeydown = handleEnterKeydown;
105
- exports.handleEscapeKeydown = handleEscapeKeydown;
106
- exports.handleLeftRightArrowsKeydown = handleLeftRightArrowsKeydown;
107
- exports.handleResize = handleResize;
108
- exports.handleTextInput = handleTextInput;
109
- exports.handleUpDownArrowsKeydown = handleUpDownArrowsKeydown;
110
- exports.isActionKey = isActionKey;
111
- exports.preventDefaultIfHijax = preventDefaultIfHijax;
112
- exports.removeEventListener = removeEventListener;
113
- exports.wrapEvent = wrapEvent;
@@ -1,106 +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 classPrefix = "floating-label__label";
6
- const textboxElementBackgroundRGB = [
7
- "rgb(245, 245, 245)",
8
- "rgb(247, 247, 247)"
9
- // From skin version 12.6.0
10
- ];
11
- const isAutofilled = (input) => input && !textboxElementBackgroundRGB.includes(getComputedStyle(input).backgroundColor);
12
- const hasValue = (input) => {
13
- var _a;
14
- return ((_a = input == null ? void 0 : input.value) == null ? void 0 : _a.length) > 0;
15
- };
16
- const isSelect = (element) => (element == null ? void 0 : element.tagName) === `SELECT`;
17
- const setPlaceholder = (element, value) => {
18
- if (isSelect(element) && !hasValue(element.querySelector(`option`))) {
19
- element.style["min-width"] = "";
20
- const beforeWidth = element.offsetWidth;
21
- element.querySelector(`option`).text = value;
22
- if (!value && beforeWidth > element.offsetWidth) {
23
- element.style["min-width"] = `${beforeWidth}px`;
24
- }
25
- }
26
- };
27
- const getPlaceholder = (element) => {
28
- if (isSelect(element)) {
29
- return element.querySelector(`option`).text;
30
- }
31
- return element == null ? void 0 : element.placeholder;
32
- };
33
- function useFloatingLabel({ ref, inputId, className, disabled, label, inputSize, inputValue, placeholder, invalid, opaqueLabel, type, onMount = () => {
34
- } }) {
35
- const _internalInputRef = React.useRef(null);
36
- const inputRef = () => ref || _internalInputRef;
37
- const [isFloating, setFloating] = React.useState(Boolean(inputValue));
38
- const [shouldAnimate, setAnimate] = React.useState(false);
39
- const [isFocused, setFocused] = React.useState(false);
40
- const selectFirstOptionText = React.useRef(``);
41
- const onBlur = () => {
42
- var _a;
43
- setAnimate(true);
44
- setFloating(hasValue((_a = inputRef()) == null ? void 0 : _a.current));
45
- setFocused(false);
46
- setPlaceholder(inputRef().current, ``);
47
- };
48
- const onFocus = () => {
49
- var _a;
50
- setAnimate(true);
51
- setFloating(true);
52
- setFocused(true);
53
- setPlaceholder((_a = inputRef()) == null ? void 0 : _a.current, selectFirstOptionText.current);
54
- };
55
- React.useEffect(() => {
56
- var _a, _b;
57
- if (!label) {
58
- return;
59
- }
60
- selectFirstOptionText.current = getPlaceholder((_a = inputRef()) == null ? void 0 : _a.current);
61
- setPlaceholder((_b = inputRef()) == null ? void 0 : _b.current, ``);
62
- onMount();
63
- }, []);
64
- React.useEffect(() => {
65
- var _a, _b, _c;
66
- if (!label) {
67
- return;
68
- }
69
- setFloating(isFocused || hasValue((_a = inputRef()) == null ? void 0 : _a.current) || isAutofilled((_c = (_b = inputRef()) == null ? void 0 : _b.current) == null ? void 0 : _c.parentNode));
70
- }, [isFocused, inputValue]);
71
- const labelClassName = classNames(className, classPrefix, {
72
- [`${classPrefix}--disabled`]: disabled,
73
- [`${classPrefix}--animate`]: shouldAnimate,
74
- [`${classPrefix}--inline`]: !isFloating && type !== "date",
75
- [`${classPrefix}--focus`]: isFocused,
76
- [`${classPrefix}--invalid`]: invalid
77
- });
78
- const floatingLabelClassName = classNames(`floating-label`, {
79
- "floating-label--large": inputSize === `large`,
80
- "floating-label--opaque": opaqueLabel
81
- });
82
- const FragmentContainer = React.useCallback(({ children }) => React.createElement(React.Fragment, null, children), []);
83
- const FloatingLabelContainer = React.useCallback(({ children }) => React.createElement("span", { className: floatingLabelClassName }, children), [floatingLabelClassName]);
84
- if (!label) {
85
- return {
86
- label: null,
87
- Container: FragmentContainer,
88
- onBlur: () => {
89
- },
90
- onFocus: () => {
91
- },
92
- ref: inputRef(),
93
- placeholder
94
- };
95
- }
96
- const labelElement = React.createElement("label", { htmlFor: inputId, className: labelClassName }, label);
97
- return {
98
- label: labelElement,
99
- Container: FloatingLabelContainer,
100
- onBlur,
101
- onFocus,
102
- ref: inputRef(),
103
- placeholder: !isFloating ? null : placeholder
104
- };
105
- }
106
- exports.useFloatingLabel = useFloatingLabel;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const classNames = require("classnames");
4
- const NoticeCTA = ({ className, type, children, ...rest }) => React.createElement("p", { className: classNames(className, `${type}-notice__cta`), ...rest }, children);
5
- module.exports = NoticeCTA;