@ebay/ui-core-react 7.0.2 → 7.1.0-alpha.3

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 (289) hide show
  1. package/array.polyfill.flat-5BAolFdk.js +1 -0
  2. package/badge-CoHKfiPt.js +1 -0
  3. package/button-o4ao46WM.js +1 -0
  4. package/calendar-CPKqwJVQ.js +1 -0
  5. package/debounce-BQsYxxOL.js +1 -0
  6. package/dialog-previous-button-7ePoYWyj.js +1 -0
  7. package/drawer-BxxlJwkZ.js +1 -0
  8. package/ebay-alert-dialog.js +1 -0
  9. package/ebay-badge.js +1 -0
  10. package/ebay-breadcrumbs.js +1 -0
  11. package/ebay-button.js +1 -0
  12. package/ebay-calendar.js +1 -0
  13. package/ebay-carousel.js +1 -0
  14. package/ebay-checkbox.js +1 -0
  15. package/ebay-confirm-dialog.js +1 -0
  16. package/ebay-cta-button.js +1 -0
  17. package/ebay-date-textbox.js +1 -0
  18. package/ebay-dialog-base.js +1 -0
  19. package/ebay-drawer-dialog.js +1 -0
  20. package/ebay-eek.js +1 -0
  21. package/ebay-fake-menu-button.js +1 -0
  22. package/ebay-fake-menu.js +1 -0
  23. package/ebay-fake-tabs.js +1 -0
  24. package/ebay-field.js +1 -0
  25. package/ebay-fullscreen-dialog.js +1 -0
  26. package/ebay-icon-button.js +1 -0
  27. package/ebay-icon.js +1 -0
  28. package/ebay-infotip.js +1 -0
  29. package/ebay-inline-notice.js +1 -0
  30. package/ebay-lightbox-dialog.js +1 -0
  31. package/ebay-listbox-button.js +2 -0
  32. package/ebay-menu/menu.d.ts +1 -1
  33. package/ebay-menu/menu.d.ts.map +1 -1
  34. package/ebay-menu-button.js +1 -0
  35. package/ebay-menu.js +1 -0
  36. package/ebay-notice-base.js +1 -0
  37. package/ebay-page-notice.js +1 -0
  38. package/ebay-pagination.js +1 -0
  39. package/ebay-panel-dialog.js +1 -0
  40. package/ebay-progress-bar.js +1 -0
  41. package/ebay-progress-spinner.js +1 -0
  42. package/ebay-progress-stepper.js +1 -0
  43. package/ebay-radio.js +1 -0
  44. package/ebay-section-notice.js +1 -0
  45. package/ebay-section-title/index.d.ts.map +1 -1
  46. package/ebay-section-title.js +1 -0
  47. package/ebay-select.js +1 -0
  48. package/ebay-signal.js +1 -0
  49. package/ebay-snackbar-dialog.js +1 -0
  50. package/ebay-split-button.js +1 -0
  51. package/ebay-star-rating-select.js +1 -0
  52. package/ebay-star-rating.js +1 -0
  53. package/ebay-svg.js +1 -0
  54. package/ebay-switch.js +1 -0
  55. package/ebay-tabs.js +1 -0
  56. package/ebay-textbox.js +1 -0
  57. package/ebay-toast-dialog.js +1 -0
  58. package/ebay-tooltip.js +1 -0
  59. package/ebay-tourtip.js +1 -0
  60. package/ebay-video.js +1 -0
  61. package/hooks-Ctier7Yv.js +1 -0
  62. package/icon-DK6eEQD8.js +1 -0
  63. package/icon-button-BB6GFLm7.js +1 -0
  64. package/index-DbjwTbDP.js +1 -0
  65. package/label-CnrpYJ-g.js +1 -0
  66. package/menu-DZU8jEPV.js +1 -0
  67. package/menu-button-label-BcgasGA4.js +1 -0
  68. package/menu-item-DBi1NcrM.js +1 -0
  69. package/notice-content-9iF4T8uB.js +1 -0
  70. package/notice-content-C0ZStfuX.js +1 -0
  71. package/notice-footer-Cw1DMzoB.js +1 -0
  72. package/package.json +19 -8
  73. package/progress-spinner-CDgxI8R_.js +1 -0
  74. package/range-DOsPN0h5.js +1 -0
  75. package/textbox-WnB-9F4y.js +1 -0
  76. package/use-tooltip-BavqG36Z.js +1 -0
  77. package/utils-C9NL3q0j.js +1 -0
  78. package/common/component-utils/array.polyfill.flat.js +0 -32
  79. package/common/component-utils/forwardRef.js +0 -37
  80. package/common/component-utils/index.js +0 -18
  81. package/common/component-utils/usePrevious.js +0 -12
  82. package/common/component-utils/utils.js +0 -26
  83. package/common/debounce.js +0 -11
  84. package/common/event-utils/index.js +0 -123
  85. package/common/event-utils/types.js +0 -14
  86. package/common/event-utils/use-key-press.js +0 -33
  87. package/common/event-utils/use-roving-index.js +0 -35
  88. package/common/floating-label-utils/hooks.js +0 -133
  89. package/common/notice-utils/notice-content.js +0 -12
  90. package/common/notice-utils/notice-cta.js +0 -23
  91. package/common/notice-utils/notice-footer.js +0 -23
  92. package/common/notice-utils/notice-title.js +0 -24
  93. package/common/random-id.js +0 -5
  94. package/common/range.js +0 -5
  95. package/common/tooltip-utils/constants.js +0 -95
  96. package/common/tooltip-utils/index.js +0 -19
  97. package/common/tooltip-utils/tooltip-close-button.js +0 -8
  98. package/common/tooltip-utils/tooltip-content.js +0 -25
  99. package/common/tooltip-utils/tooltip-footer.js +0 -9
  100. package/common/tooltip-utils/tooltip-host.js +0 -24
  101. package/common/tooltip-utils/tooltip.js +0 -60
  102. package/common/tooltip-utils/types.js +0 -2
  103. package/common/tooltip-utils/use-tooltip.js +0 -27
  104. package/ebay-alert-dialog/alert-dialog.js +0 -55
  105. package/ebay-alert-dialog/index.js +0 -8
  106. package/ebay-badge/badge.js +0 -25
  107. package/ebay-badge/index.js +0 -8
  108. package/ebay-breadcrumbs/breadcrumb-item.js +0 -27
  109. package/ebay-breadcrumbs/breadcrumbs.js +0 -64
  110. package/ebay-breadcrumbs/index.js +0 -10
  111. package/ebay-button/button-cell.js +0 -29
  112. package/ebay-button/button-expand.js +0 -13
  113. package/ebay-button/button-loading.js +0 -11
  114. package/ebay-button/button-text.js +0 -9
  115. package/ebay-button/button.js +0 -95
  116. package/ebay-button/index.js +0 -10
  117. package/ebay-button/types.js +0 -2
  118. package/ebay-calendar/calendar.js +0 -306
  119. package/ebay-calendar/date-utils.js +0 -58
  120. package/ebay-calendar/index.js +0 -8
  121. package/ebay-carousel/carousel-control-button.js +0 -24
  122. package/ebay-carousel/carousel-item.js +0 -59
  123. package/ebay-carousel/carousel-list.js +0 -81
  124. package/ebay-carousel/carousel.js +0 -109
  125. package/ebay-carousel/helpers.js +0 -123
  126. package/ebay-carousel/index.js +0 -10
  127. package/ebay-carousel/scroll-to-transition.js +0 -102
  128. package/ebay-carousel/types.js +0 -2
  129. package/ebay-checkbox/checkbox.js +0 -77
  130. package/ebay-checkbox/index.js +0 -8
  131. package/ebay-confirm-dialog/confirm-dialog.js +0 -56
  132. package/ebay-confirm-dialog/index.js +0 -8
  133. package/ebay-cta-button/cta-button.js +0 -30
  134. package/ebay-cta-button/index.js +0 -8
  135. package/ebay-date-textbox/date-textbox.js +0 -179
  136. package/ebay-date-textbox/index.js +0 -8
  137. package/ebay-dialog-base/components/animation.js +0 -96
  138. package/ebay-dialog-base/components/dialog-actions.js +0 -8
  139. package/ebay-dialog-base/components/dialog-close-button.js +0 -8
  140. package/ebay-dialog-base/components/dialog-footer.js +0 -8
  141. package/ebay-dialog-base/components/dialog-header.js +0 -22
  142. package/ebay-dialog-base/components/dialog-previous-button.js +0 -24
  143. package/ebay-dialog-base/components/dialogBase.js +0 -152
  144. package/ebay-dialog-base/dialog-base-with-state.js +0 -63
  145. package/ebay-dialog-base/index.js +0 -18
  146. package/ebay-drawer-dialog/components/drawer.js +0 -104
  147. package/ebay-drawer-dialog/index.js +0 -8
  148. package/ebay-eek/eek-rating.js +0 -23
  149. package/ebay-eek/eek-util.js +0 -34
  150. package/ebay-eek/index.js +0 -8
  151. package/ebay-fake-menu/index.js +0 -12
  152. package/ebay-fake-menu/menu-item-separator.js +0 -23
  153. package/ebay-fake-menu/menu-item.js +0 -72
  154. package/ebay-fake-menu/menu.js +0 -57
  155. package/ebay-fake-menu-button/index.js +0 -14
  156. package/ebay-fake-menu-button/menu-button-item.js +0 -5
  157. package/ebay-fake-menu-button/menu-button-label.js +0 -8
  158. package/ebay-fake-menu-button/menu-button-separator.js +0 -23
  159. package/ebay-fake-menu-button/menu-button.js +0 -105
  160. package/ebay-fake-tabs/fake-tabs.js +0 -54
  161. package/ebay-fake-tabs/index.js +0 -10
  162. package/ebay-fake-tabs/tab.js +0 -24
  163. package/ebay-field/description.js +0 -26
  164. package/ebay-field/field.js +0 -12
  165. package/ebay-field/index.js +0 -12
  166. package/ebay-field/label.js +0 -29
  167. package/ebay-field/types.js +0 -2
  168. package/ebay-fullscreen-dialog/fullscreen-dialog.js +0 -25
  169. package/ebay-fullscreen-dialog/index.js +0 -8
  170. package/ebay-icon/icon.js +0 -98
  171. package/ebay-icon/index.js +0 -8
  172. package/ebay-icon/types.js +0 -3
  173. package/ebay-icon-button/icon-button.js +0 -40
  174. package/ebay-icon-button/index.js +0 -8
  175. package/ebay-infotip/ebay-infotip-content.js +0 -12
  176. package/ebay-infotip/ebay-infotip-heading.js +0 -23
  177. package/ebay-infotip/ebay-infotip-host.js +0 -28
  178. package/ebay-infotip/ebay-infotip.js +0 -79
  179. package/ebay-infotip/index.js +0 -14
  180. package/ebay-infotip/types.js +0 -2
  181. package/ebay-inline-notice/index.js +0 -10
  182. package/ebay-inline-notice/inline-notice.js +0 -66
  183. package/ebay-inline-notice/types.js +0 -2
  184. package/ebay-lightbox-dialog/index.js +0 -8
  185. package/ebay-lightbox-dialog/lightbox-dialog.js +0 -27
  186. package/ebay-listbox-button/index.js +0 -10
  187. package/ebay-listbox-button/listbox-button-option.js +0 -27
  188. package/ebay-listbox-button/listbox-button.js +0 -252
  189. package/ebay-menu/index.js +0 -27
  190. package/ebay-menu/menu-item-separator.js +0 -23
  191. package/ebay-menu/menu-item.js +0 -67
  192. package/ebay-menu/menu.js +0 -149
  193. package/ebay-menu/types.js +0 -2
  194. package/ebay-menu-button/index.js +0 -29
  195. package/ebay-menu-button/menu-button-item.js +0 -5
  196. package/ebay-menu-button/menu-button-label.js +0 -8
  197. package/ebay-menu-button/menu-button-separator.js +0 -23
  198. package/ebay-menu-button/menu-button.js +0 -132
  199. package/ebay-menu-button/types.js +0 -2
  200. package/ebay-notice-base/components/ebay-notice-content/index.js +0 -8
  201. package/ebay-notice-base/components/ebay-notice-content/notice-content.js +0 -4
  202. package/ebay-notice-base/components/ebay-notice-title/index.js +0 -8
  203. package/ebay-notice-base/components/ebay-notice-title/notice-title.js +0 -8
  204. package/ebay-notice-base/index.js +0 -7
  205. package/ebay-page-notice/index.js +0 -16
  206. package/ebay-page-notice/page-notice-cta.js +0 -9
  207. package/ebay-page-notice/page-notice-footer.js +0 -9
  208. package/ebay-page-notice/page-notice-title.js +0 -23
  209. package/ebay-page-notice/page-notice.js +0 -66
  210. package/ebay-pagination/const.js +0 -8
  211. package/ebay-pagination/helpers.js +0 -92
  212. package/ebay-pagination/index.js +0 -10
  213. package/ebay-pagination/pagination-item.js +0 -55
  214. package/ebay-pagination/pagination.js +0 -146
  215. package/ebay-pagination/types.js +0 -2
  216. package/ebay-panel-dialog/index.js +0 -8
  217. package/ebay-panel-dialog/panel-dialog.js +0 -27
  218. package/ebay-progress-bar/index.js +0 -8
  219. package/ebay-progress-bar/progress-bar.js +0 -23
  220. package/ebay-progress-spinner/index.js +0 -8
  221. package/ebay-progress-spinner/progress-spinner.js +0 -35
  222. package/ebay-progress-stepper/ebay-progress-step.js +0 -64
  223. package/ebay-progress-stepper/ebay-progress-stepper.js +0 -70
  224. package/ebay-progress-stepper/ebay-progress-title.js +0 -5
  225. package/ebay-progress-stepper/index.js +0 -12
  226. package/ebay-progress-stepper/types.js +0 -2
  227. package/ebay-radio/index.js +0 -8
  228. package/ebay-radio/radio.js +0 -71
  229. package/ebay-section-notice/index.js +0 -14
  230. package/ebay-section-notice/section-notice-footer.js +0 -9
  231. package/ebay-section-notice/section-notice-title.js +0 -23
  232. package/ebay-section-notice/section-notice.js +0 -82
  233. package/ebay-section-title/cta.js +0 -26
  234. package/ebay-section-title/index.js +0 -16
  235. package/ebay-section-title/info.js +0 -23
  236. package/ebay-section-title/overflow.js +0 -23
  237. package/ebay-section-title/section-title.js +0 -35
  238. package/ebay-section-title/subtitle.js +0 -23
  239. package/ebay-section-title/title.js +0 -23
  240. package/ebay-select/ebay-select-option.js +0 -22
  241. package/ebay-select/ebay-select.js +0 -129
  242. package/ebay-select/index.js +0 -10
  243. package/ebay-signal/index.js +0 -8
  244. package/ebay-signal/signal.js +0 -24
  245. package/ebay-snackbar-dialog/components/ebay-snackbar-dialog-action.js +0 -24
  246. package/ebay-snackbar-dialog/components/ebay-snackbar-dialog.js +0 -122
  247. package/ebay-snackbar-dialog/index.js +0 -7
  248. package/ebay-split-button/index.js +0 -23
  249. package/ebay-split-button/split-button.js +0 -30
  250. package/ebay-split-button/types.js +0 -2
  251. package/ebay-star-rating/index.js +0 -23
  252. package/ebay-star-rating/star-rating.js +0 -26
  253. package/ebay-star-rating-select/index.js +0 -23
  254. package/ebay-star-rating-select/star-rating-select.js +0 -82
  255. package/ebay-svg/index.js +0 -8
  256. package/ebay-svg/svg.js +0 -2548
  257. package/ebay-switch/ebay-switch.js +0 -61
  258. package/ebay-switch/index.js +0 -8
  259. package/ebay-tabs/index.js +0 -12
  260. package/ebay-tabs/tab-panel.js +0 -24
  261. package/ebay-tabs/tab.js +0 -24
  262. package/ebay-tabs/tabs.js +0 -90
  263. package/ebay-tabs/types.js +0 -2
  264. package/ebay-textbox/index.js +0 -16
  265. package/ebay-textbox/postfix-icon.js +0 -26
  266. package/ebay-textbox/postfix-text.js +0 -8
  267. package/ebay-textbox/prefix-icon.js +0 -23
  268. package/ebay-textbox/prefix-text.js +0 -8
  269. package/ebay-textbox/textbox.js +0 -147
  270. package/ebay-textbox/types.js +0 -2
  271. package/ebay-toast-dialog/components/toast.js +0 -26
  272. package/ebay-toast-dialog/index.js +0 -8
  273. package/ebay-tooltip/ebay-tooltip-content.js +0 -8
  274. package/ebay-tooltip/ebay-tooltip-host.js +0 -8
  275. package/ebay-tooltip/ebay-tooltip.js +0 -85
  276. package/ebay-tooltip/index.js +0 -14
  277. package/ebay-tourtip/ebay-tourtip-content.js +0 -8
  278. package/ebay-tourtip/ebay-tourtip-footer.js +0 -10
  279. package/ebay-tourtip/ebay-tourtip-heading.js +0 -24
  280. package/ebay-tourtip/ebay-tourtip-host.js +0 -8
  281. package/ebay-tourtip/ebay-tourtip.js +0 -70
  282. package/ebay-tourtip/index.js +0 -18
  283. package/ebay-video/const.js +0 -19
  284. package/ebay-video/controls.js +0 -40
  285. package/ebay-video/index.js +0 -25
  286. package/ebay-video/reportButton.js +0 -12
  287. package/ebay-video/source.js +0 -22
  288. package/ebay-video/types.js +0 -2
  289. package/ebay-video/video.js +0 -210
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const react_1 = __importDefault(require("react"));
18
- const classnames_1 = __importDefault(require("classnames"));
19
- const Title = (_a) => {
20
- var { children, className } = _a, rest = __rest(_a, ["children", "className"]);
21
- return (react_1.default.createElement("h2", Object.assign({}, rest, { className: (0, classnames_1.default)(className, 'section-title__title') }), children));
22
- };
23
- exports.default = Title;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const react_1 = __importDefault(require("react"));
18
- const EbaySelectOption = (_a) => {
19
- var { children } = _a, rest = __rest(_a, ["children"]);
20
- return react_1.default.createElement("option", Object.assign({}, rest), children);
21
- };
22
- exports.default = EbaySelectOption;
@@ -1,129 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- const react_1 = __importStar(require("react"));
41
- const classnames_1 = __importDefault(require("classnames"));
42
- const ebay_select_option_1 = __importDefault(require("./ebay-select-option"));
43
- const ebay_icon_1 = require("../ebay-icon");
44
- const component_utils_1 = require("../common/component-utils");
45
- const hooks_1 = require("../common/floating-label-utils/hooks");
46
- const isControlled = value => typeof value !== 'undefined';
47
- const EbaySelect = (_a) => {
48
- var { value: controlledValue, defaultValue, className, borderless, name, disabled, onChange = () => { }, onBlur = () => { }, onFocus = () => { }, floatingLabel, forwardedRef, children, inputSize, invalid } = _a, rest = __rest(_a, ["value", "defaultValue", "className", "borderless", "name", "disabled", "onChange", "onBlur", "onFocus", "floatingLabel", "forwardedRef", "children", "inputSize", "invalid"]);
49
- const isFieldInvalid = invalid || rest['aria-invalid'] === 'true';
50
- const [value, setValue] = (0, react_1.useState)(defaultValue);
51
- const { label, Container, onBlur: onFloatingLabelBlur, onFocus: onFloatingLabelFocus, ref } = (0, hooks_1.useFloatingLabel)({
52
- ref: forwardedRef,
53
- inputId: rest.id,
54
- className: className,
55
- disabled: disabled,
56
- label: floatingLabel,
57
- inputValue: controlledValue,
58
- inputSize: inputSize,
59
- invalid: isFieldInvalid
60
- });
61
- const handleSelectChange = (e) => {
62
- const { value: newValue, selectedIndex } = e.target;
63
- if (!isControlled(controlledValue)) {
64
- setValue(newValue);
65
- }
66
- onChange(e, { index: selectedIndex, selected: [newValue] });
67
- };
68
- const handleBlur = (event) => {
69
- onBlur(event);
70
- onFloatingLabelBlur();
71
- };
72
- const handleFocus = (event) => {
73
- onFocus(event);
74
- onFloatingLabelFocus();
75
- };
76
- const selectClassName = (0, classnames_1.default)('select', className, {
77
- 'select--borderless': borderless,
78
- 'select--large': inputSize === `large`
79
- });
80
- return (react_1.default.createElement(Container, null,
81
- label,
82
- react_1.default.createElement("span", { className: selectClassName },
83
- react_1.default.createElement("select", Object.assign({}, rest, { name: name, value: isControlled(controlledValue) ? controlledValue : value, disabled: disabled, onChange: handleSelectChange, onBlur: handleBlur, onFocus: handleFocus, ref: ref }), options(children)),
84
- react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "chevronDown12", height: "8", width: "8" }))));
85
- };
86
- exports.default = (0, component_utils_1.withForwardRef)(EbaySelect);
87
- function optionGroups(data) {
88
- const optGroups = {};
89
- data.forEach(opt => {
90
- const option = opt.props;
91
- if (option.optgroup) {
92
- if (!Object.prototype.hasOwnProperty.call(optGroups, option.optgroup)) {
93
- optGroups[option.optgroup] = [];
94
- }
95
- optGroups[option.optgroup].push(option);
96
- }
97
- });
98
- return optGroups;
99
- }
100
- function options(children) {
101
- const renderedGroups = [];
102
- const allOptions = [];
103
- let optGroups = {};
104
- let withinGroup = false;
105
- const childrenOpts = (0, component_utils_1.filterByType)(children, ebay_select_option_1.default).map(c => (0, react_1.cloneElement)(c, {}));
106
- if (childrenOpts) {
107
- optGroups = optionGroups(childrenOpts);
108
- let currentGroupName;
109
- childrenOpts.forEach((option, idx) => {
110
- const { value, optionClassName, children: optionChildren, optgroup } = option.props;
111
- withinGroup = optgroup && renderedGroups.indexOf(optgroup) === -1;
112
- if (withinGroup) { // This will always be true when the very first group is encountered.
113
- currentGroupName = optgroup;
114
- const currentGroupOptions = optGroups[currentGroupName];
115
- const opts = currentGroupOptions.map((groupOption) => (react_1.default.createElement(ebay_select_option_1.default, { key: `opt-${groupOption.value}`, value: groupOption.value, className: groupOption.optionClassName }, groupOption.children)));
116
- allOptions.push(react_1.default.createElement("optgroup", { key: idx, label: optgroup }, opts));
117
- renderedGroups.push(optgroup);
118
- }
119
- else if (!optgroup) {
120
- /**
121
- * The check below is necessary because we could still be in a group which has already
122
- * been added to the renderedGroups array. In that case it will be skipped.
123
- */
124
- allOptions.push(react_1.default.createElement(ebay_select_option_1.default, { key: idx, value: value, className: optionClassName }, optionChildren));
125
- }
126
- });
127
- return allOptions;
128
- }
129
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EbaySelectOption = exports.EbaySelect = void 0;
7
- var ebay_select_1 = require("./ebay-select");
8
- Object.defineProperty(exports, "EbaySelect", { enumerable: true, get: function () { return __importDefault(ebay_select_1).default; } });
9
- var ebay_select_option_1 = require("./ebay-select-option");
10
- Object.defineProperty(exports, "EbaySelectOption", { enumerable: true, get: function () { return __importDefault(ebay_select_option_1).default; } });
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EbaySignal = void 0;
7
- var signal_1 = require("./signal");
8
- Object.defineProperty(exports, "EbaySignal", { enumerable: true, get: function () { return __importDefault(signal_1).default; } });
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const react_1 = __importDefault(require("react"));
18
- const classnames_1 = __importDefault(require("classnames"));
19
- const EbaySignal = (_a) => {
20
- var { status = 'neutral' } = _a, rest = __rest(_a, ["status"]);
21
- const className = (0, classnames_1.default)(`signal signal--${status}`, rest.className);
22
- return react_1.default.createElement("span", Object.assign({}, rest, { className: className }));
23
- };
24
- exports.default = EbaySignal;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.EbaySnackbarDialogAction = void 0;
18
- const classnames_1 = __importDefault(require("classnames"));
19
- const react_1 = __importDefault(require("react"));
20
- const EbaySnackbarDialogAction = (_a) => {
21
- var { className, children } = _a, rest = __rest(_a, ["className", "children"]);
22
- return (react_1.default.createElement("button", Object.assign({ className: (0, classnames_1.default)(className, 'fake-link') }, rest), children));
23
- };
24
- exports.EbaySnackbarDialogAction = EbaySnackbarDialogAction;
@@ -1,122 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.EbaySnackbarDialog = void 0;
41
- const classnames_1 = __importDefault(require("classnames"));
42
- const react_1 = __importStar(require("react"));
43
- const ebay_dialog_base_1 = require("../../ebay-dialog-base");
44
- const ebay_snackbar_dialog_action_1 = require("./ebay-snackbar-dialog-action");
45
- const DEFAULT_TIMEOUT_LENGTH = 6000; // 6 seconds
46
- const EbaySnackbarDialog = (_a) => {
47
- var { className, onOpen = () => { }, onClose = () => { }, layout, open, children, onAction } = _a, rest = __rest(_a, ["className", "onOpen", "onClose", "layout", "open", "children", "onAction"]);
48
- // We use this eventSet to track which event opened the snackbar and we make sure that
49
- // we don't close the snackbar in an undesired moment.
50
- // For example, the snackbar should stay open on focus even if the mouseLeave event happened.
51
- const eventSet = (0, react_1.useRef)(new Set());
52
- const timeoutRef = (0, react_1.useRef)();
53
- const [isOpen, setIsOpen] = (0, react_1.useState)(open);
54
- const childrenArray = react_1.default.Children.toArray(children);
55
- const action = childrenArray.find((child) => child.type === ebay_snackbar_dialog_action_1.EbaySnackbarDialogAction);
56
- const content = childrenArray.filter((child) => child.type !== ebay_snackbar_dialog_action_1.EbaySnackbarDialogAction);
57
- const cancelCurrentCloseRequest = () => {
58
- clearTimeout(timeoutRef.current);
59
- };
60
- const closeDialog = () => {
61
- setIsOpen(false);
62
- onClose();
63
- };
64
- const requestToCloseDialog = () => {
65
- // We will make a request to close the snackbar only
66
- // when there is no pending opening event.
67
- if (eventSet.current.size === 0) {
68
- cancelCurrentCloseRequest();
69
- timeoutRef.current = setTimeout(() => {
70
- closeDialog();
71
- }, DEFAULT_TIMEOUT_LENGTH);
72
- }
73
- };
74
- const openDialog = () => {
75
- setIsOpen(true);
76
- onOpen();
77
- requestToCloseDialog();
78
- };
79
- const handleFocus = () => {
80
- cancelCurrentCloseRequest();
81
- eventSet.current.add('focus');
82
- };
83
- const handleBlur = () => {
84
- eventSet.current.delete('focus');
85
- requestToCloseDialog();
86
- };
87
- const handleMouseEnter = () => {
88
- cancelCurrentCloseRequest();
89
- eventSet.current.add('mouseEnter');
90
- };
91
- const handleMouseLeave = () => {
92
- eventSet.current.delete('mouseEnter');
93
- requestToCloseDialog();
94
- };
95
- const handleAction = (event) => {
96
- var _a, _b;
97
- cancelCurrentCloseRequest();
98
- onAction === null || onAction === void 0 ? void 0 : onAction(event);
99
- (_b = (_a = action === null || action === void 0 ? void 0 : action.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
100
- closeDialog();
101
- };
102
- (0, react_1.useEffect)(() => () => {
103
- // On unmount of the component we
104
- // cancel the close request
105
- cancelCurrentCloseRequest();
106
- }, []);
107
- // This useEffect is to make sure that the internal state is in sync with the "open" property.
108
- (0, react_1.useEffect)(() => {
109
- if (open) {
110
- openDialog();
111
- }
112
- else {
113
- closeDialog();
114
- }
115
- }, [open]);
116
- return (react_1.default.createElement(ebay_dialog_base_1.DialogBaseWithState, Object.assign({}, rest, { open: isOpen, isModal: false, baseEl: "aside", classPrefix: "snackbar-dialog", transitionElement: "root", a11yCloseText: "", buttonPosition: "hidden", className: (0, classnames_1.default)(className, 'snackbar-dialog--transition'), windowClass: layout === 'column' && 'snackbar-dialog__window--column', onFocus: handleFocus, onBlur: handleBlur, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }),
117
- content,
118
- action ? (react_1.default.createElement(ebay_dialog_base_1.EbayDialogActions, null, react_1.default.cloneElement(action, {
119
- onClick: handleAction
120
- }))) : null));
121
- };
122
- exports.EbaySnackbarDialog = EbaySnackbarDialog;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EbaySnackbarDialogAction = exports.EbaySnackbarDialog = void 0;
4
- var ebay_snackbar_dialog_1 = require("./components/ebay-snackbar-dialog");
5
- Object.defineProperty(exports, "EbaySnackbarDialog", { enumerable: true, get: function () { return ebay_snackbar_dialog_1.EbaySnackbarDialog; } });
6
- var ebay_snackbar_dialog_action_1 = require("./components/ebay-snackbar-dialog-action");
7
- Object.defineProperty(exports, "EbaySnackbarDialogAction", { enumerable: true, get: function () { return ebay_snackbar_dialog_action_1.EbaySnackbarDialogAction; } });
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.EbaySplitButton = void 0;
21
- var split_button_1 = require("./split-button");
22
- Object.defineProperty(exports, "EbaySplitButton", { enumerable: true, get: function () { return __importDefault(split_button_1).default; } });
23
- __exportStar(require("./types"), exports);
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const react_1 = __importDefault(require("react"));
18
- const component_utils_1 = require("../common/component-utils");
19
- const ebay_button_1 = require("../ebay-button");
20
- const ebay_menu_button_1 = require("../ebay-menu-button");
21
- const EbaySplitButton = (_a) => {
22
- var { a11yMenuText, children, type, bodyState, a11yButtonLoadingText, onCollapse, onExpand, onSelect = () => { }, onChange = () => { }, ref } = _a, rest = __rest(_a, ["a11yMenuText", "children", "type", "bodyState", "a11yButtonLoadingText", "onCollapse", "onExpand", "onSelect", "onChange", "ref"]);
23
- const menuItemComponents = [ebay_menu_button_1.EbayMenuButtonItem, ebay_menu_button_1.EbayMenuButtonSeparator];
24
- const buttonLabel = (0, component_utils_1.filterBy)(children, el => !menuItemComponents.includes(el.type));
25
- const menuItems = (0, component_utils_1.filterByType)(children, menuItemComponents);
26
- return (react_1.default.createElement("span", { className: "split-button" },
27
- react_1.default.createElement(ebay_button_1.EbayButton, Object.assign({ "aria-label": bodyState === 'loading' ? a11yButtonLoadingText : undefined }, rest, { split: "start", bodyState: bodyState === 'expand' ? undefined : bodyState }), buttonLabel),
28
- react_1.default.createElement(ebay_menu_button_1.EbayMenuButton, { priority: rest.priority, disabled: rest.disabled, transparent: rest.transparent, size: rest.size, type: type, split: "end", reverse: true, a11yText: a11yMenuText, onCollapse: onCollapse, onExpand: onExpand, onSelect: onSelect, onChange: onChange }, menuItems)));
29
- };
30
- exports.default = EbaySplitButton;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.EbayStarRating = void 0;
21
- var star_rating_1 = require("./star-rating");
22
- Object.defineProperty(exports, "EbayStarRating", { enumerable: true, get: function () { return __importDefault(star_rating_1).default; } });
23
- __exportStar(require("./star-rating"), exports);
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const react_1 = __importDefault(require("react"));
18
- const classnames_1 = __importDefault(require("classnames"));
19
- const ebay_icon_1 = require("../ebay-icon");
20
- const range_1 = require("../common/range");
21
- const stars = (0, range_1.range)(1, 5);
22
- const EbayStarRating = (_a) => {
23
- var { value, a11yText, className } = _a, rest = __rest(_a, ["value", "a11yText", "className"]);
24
- return (react_1.default.createElement("div", Object.assign({ role: "img", "aria-label": a11yText, className: (0, classnames_1.default)('star-rating', className), "data-stars": value }, rest), stars.map((i) => (react_1.default.createElement(ebay_icon_1.EbayIcon, { key: i, className: "star-rating__icon", name: "starDynamic" })))));
25
- };
26
- exports.default = EbayStarRating;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.EbayStarRatingSelect = void 0;
21
- var star_rating_select_1 = require("./star-rating-select");
22
- Object.defineProperty(exports, "EbayStarRatingSelect", { enumerable: true, get: function () { return __importDefault(star_rating_select_1).default; } });
23
- __exportStar(require("./star-rating-select"), exports);
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- const react_1 = __importStar(require("react"));
41
- const classnames_1 = __importDefault(require("classnames"));
42
- const ebay_icon_1 = require("../ebay-icon");
43
- const range_1 = require("../common/range");
44
- const random_id_1 = require("../common/random-id");
45
- const stars = (0, range_1.range)(1, 5);
46
- const getValue = (val) => {
47
- let value = parseInt(val, 0) || 0;
48
- if (value > 5) {
49
- value = 0;
50
- }
51
- return value;
52
- };
53
- const EbayStarRatingSelect = (_a) => {
54
- var { value = 0, a11yText, className, a11yStarText = [], disabled, onChange = () => { }, onFocus = () => { }, onKeyDown = () => { }, name = `star-rating-${(0, random_id_1.randomId)()}` } = _a, rest = __rest(_a, ["value", "a11yText", "className", "a11yStarText", "disabled", "onChange", "onFocus", "onKeyDown", "name"]);
55
- const [checkedValue, setChecked] = (0, react_1.useState)(getValue(value));
56
- (0, react_1.useEffect)(() => {
57
- setChecked(getValue(value));
58
- }, [value]);
59
- const handleKeyDown = (i) => (e) => {
60
- if (!disabled) {
61
- setChecked(getValue(i));
62
- onKeyDown(e, { value: i });
63
- }
64
- };
65
- const handleClick = (i) => (e) => {
66
- if (!disabled) {
67
- setChecked(getValue(i));
68
- onChange(e, { value: i });
69
- }
70
- };
71
- const handleFocus = (i) => (e) => {
72
- if (!disabled) {
73
- setChecked(getValue(i));
74
- onFocus(e, { value: i });
75
- }
76
- };
77
- return (react_1.default.createElement("div", Object.assign({ role: a11yText && 'radiogroup', "aria-label": a11yText, className: (0, classnames_1.default)('star-rating-select', className) }, rest), stars.map((i) => (react_1.default.createElement("span", { className: "star-rating-select__radio", key: i },
78
- react_1.default.createElement("input", { "aria-label": a11yStarText === null || a11yStarText === void 0 ? void 0 : a11yStarText[i - 1], className: (0, classnames_1.default)('star-rating-select__control', { 'star-rating-select__control--filled': i <= checkedValue }), type: "radio", name: name, value: i, disabled: disabled, defaultChecked: checkedValue === i, onClick: handleClick(i), onFocus: handleFocus(i), onKeyDown: handleKeyDown(i) }),
79
- react_1.default.createElement("span", { className: "star-rating-select__radio-icon" },
80
- react_1.default.createElement(ebay_icon_1.EbayIcon, { className: "star-rating__icon", name: "starDynamic" })))))));
81
- };
82
- exports.default = EbayStarRatingSelect;
package/ebay-svg/index.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EbaySvg = void 0;
7
- var svg_1 = require("./svg");
8
- Object.defineProperty(exports, "EbaySvg", { enumerable: true, get: function () { return __importDefault(svg_1).default; } });