@ebay/ui-core-react 7.0.0 → 7.1.0-alpha.2

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 (366) hide show
  1. package/array.polyfill.flat-5BAolFdk.js +1 -0
  2. package/array.polyfill.flat-Bj5UhY_-.mjs +10 -0
  3. package/badge-BX5HuO-3.mjs +9 -0
  4. package/badge-CoHKfiPt.js +1 -0
  5. package/button-B06HeRsZ.mjs +63 -0
  6. package/button-o4ao46WM.js +1 -0
  7. package/calendar-CPKqwJVQ.js +1 -0
  8. package/calendar-Dq0eM9VC.mjs +216 -0
  9. package/debounce-BQsYxxOL.js +1 -0
  10. package/debounce-u81vJ6wg.mjs +9 -0
  11. package/dialog-previous-button-7ePoYWyj.js +1 -0
  12. package/dialog-previous-button-gmkm4c8J.mjs +146 -0
  13. package/drawer-BxxlJwkZ.js +1 -0
  14. package/drawer-Dcg135Bb.mjs +40 -0
  15. package/ebay-alert-dialog.js +1 -0
  16. package/ebay-alert-dialog.mjs +22 -0
  17. package/ebay-badge.js +1 -0
  18. package/ebay-badge.mjs +4 -0
  19. package/ebay-breadcrumbs.js +1 -0
  20. package/ebay-breadcrumbs.mjs +39 -0
  21. package/ebay-button.js +1 -0
  22. package/ebay-button.mjs +5 -0
  23. package/ebay-calendar.js +1 -0
  24. package/ebay-calendar.mjs +4 -0
  25. package/ebay-carousel.js +1 -0
  26. package/ebay-carousel.mjs +229 -0
  27. package/ebay-checkbox/README.md +12 -0
  28. package/ebay-checkbox.js +1 -0
  29. package/ebay-checkbox.mjs +43 -0
  30. package/ebay-confirm-dialog.js +1 -0
  31. package/ebay-confirm-dialog.mjs +24 -0
  32. package/ebay-cta-button.js +1 -0
  33. package/ebay-cta-button.mjs +20 -0
  34. package/ebay-date-textbox.js +1 -0
  35. package/ebay-date-textbox.mjs +74 -0
  36. package/ebay-dialog-base.js +1 -0
  37. package/ebay-dialog-base.mjs +9 -0
  38. package/ebay-drawer-dialog.js +1 -0
  39. package/ebay-drawer-dialog.mjs +4 -0
  40. package/ebay-eek.js +1 -0
  41. package/ebay-eek.mjs +42 -0
  42. package/ebay-fake-menu-button.js +1 -0
  43. package/ebay-fake-menu-button.mjs +7 -0
  44. package/ebay-fake-menu.js +1 -0
  45. package/ebay-fake-menu.mjs +9 -0
  46. package/ebay-fake-tabs.js +1 -0
  47. package/ebay-fake-tabs.mjs +27 -0
  48. package/ebay-field.js +1 -0
  49. package/ebay-field.mjs +19 -0
  50. package/ebay-fullscreen-dialog.js +1 -0
  51. package/ebay-fullscreen-dialog.mjs +9 -0
  52. package/ebay-icon/icon.d.ts.map +1 -1
  53. package/ebay-icon-button/README.md +2 -0
  54. package/ebay-icon-button.js +1 -0
  55. package/ebay-icon-button.mjs +4 -0
  56. package/ebay-icon.js +1 -0
  57. package/ebay-icon.mjs +4 -0
  58. package/ebay-infotip.js +1 -0
  59. package/ebay-infotip.mjs +59 -0
  60. package/ebay-inline-notice.js +1 -0
  61. package/ebay-inline-notice.mjs +31 -0
  62. package/ebay-lightbox-dialog.js +1 -0
  63. package/ebay-lightbox-dialog.mjs +11 -0
  64. package/ebay-listbox-button.js +2 -0
  65. package/ebay-listbox-button.mjs +170 -0
  66. package/ebay-menu/menu.d.ts +1 -1
  67. package/ebay-menu/menu.d.ts.map +1 -1
  68. package/ebay-menu-button.js +1 -0
  69. package/ebay-menu-button.mjs +82 -0
  70. package/ebay-menu.js +1 -0
  71. package/ebay-menu.mjs +9 -0
  72. package/ebay-notice-base.js +1 -0
  73. package/ebay-notice-base.mjs +7 -0
  74. package/ebay-page-notice.js +1 -0
  75. package/ebay-page-notice.mjs +42 -0
  76. package/ebay-pagination.js +1 -0
  77. package/ebay-pagination.mjs +159 -0
  78. package/ebay-panel-dialog.js +1 -0
  79. package/ebay-panel-dialog.mjs +11 -0
  80. package/ebay-progress-bar.js +1 -0
  81. package/ebay-progress-bar.mjs +6 -0
  82. package/ebay-progress-spinner/progress-spinner.d.ts.map +1 -1
  83. package/ebay-progress-spinner.js +1 -0
  84. package/ebay-progress-spinner.mjs +4 -0
  85. package/ebay-progress-stepper.js +1 -0
  86. package/ebay-progress-stepper.mjs +63 -0
  87. package/ebay-radio.js +1 -0
  88. package/ebay-radio.mjs +42 -0
  89. package/ebay-section-notice.js +1 -0
  90. package/ebay-section-notice.mjs +46 -0
  91. package/ebay-section-title/index.d.ts.map +1 -1
  92. package/ebay-section-title.js +1 -0
  93. package/ebay-section-title.mjs +24 -0
  94. package/ebay-select.js +1 -0
  95. package/ebay-select.mjs +69 -0
  96. package/ebay-signal.js +1 -0
  97. package/ebay-signal.mjs +9 -0
  98. package/ebay-snackbar-dialog.js +1 -0
  99. package/ebay-snackbar-dialog.mjs +46 -0
  100. package/ebay-split-button.js +1 -0
  101. package/ebay-split-button.mjs +20 -0
  102. package/ebay-star-rating-select.js +1 -0
  103. package/ebay-star-rating-select.mjs +36 -0
  104. package/ebay-star-rating.js +1 -0
  105. package/ebay-star-rating.mjs +8 -0
  106. package/ebay-svg.js +1 -0
  107. package/ebay-svg.mjs +4753 -0
  108. package/ebay-switch.js +1 -0
  109. package/ebay-switch.mjs +25 -0
  110. package/ebay-tabs.js +1 -0
  111. package/ebay-tabs.mjs +66 -0
  112. package/ebay-textbox.js +1 -0
  113. package/ebay-textbox.mjs +8 -0
  114. package/ebay-toast-dialog.js +1 -0
  115. package/ebay-toast-dialog.mjs +9 -0
  116. package/ebay-tooltip.js +1 -0
  117. package/ebay-tooltip.mjs +39 -0
  118. package/ebay-tourtip.js +1 -0
  119. package/ebay-tourtip.mjs +43 -0
  120. package/ebay-video.js +1 -0
  121. package/ebay-video.mjs +173 -0
  122. package/hooks-Ctier7Yv.js +1 -0
  123. package/hooks-r29zhPsY.mjs +63 -0
  124. package/icon-B_a65KUD.mjs +42 -0
  125. package/icon-DK6eEQD8.js +1 -0
  126. package/icon-button-BB6GFLm7.js +1 -0
  127. package/icon-button-Dy8rjzH7.mjs +24 -0
  128. package/index-B5oC9Rl1.mjs +22 -0
  129. package/index-DbjwTbDP.js +1 -0
  130. package/label-CnrpYJ-g.js +1 -0
  131. package/label-DgOo6Mql.mjs +19 -0
  132. package/menu-CR1Dxl2m.mjs +154 -0
  133. package/menu-DZU8jEPV.js +1 -0
  134. package/menu-button-label-BcgasGA4.js +1 -0
  135. package/menu-button-label-vVnRKJRU.mjs +68 -0
  136. package/menu-item-DBi1NcrM.js +1 -0
  137. package/menu-item-jlKZ3uT4.mjs +67 -0
  138. package/notice-content-9iF4T8uB.js +1 -0
  139. package/notice-content-BVZMfcMH.mjs +4 -0
  140. package/notice-content-C0ZStfuX.js +1 -0
  141. package/notice-content-CdXVjKzD.mjs +9 -0
  142. package/notice-footer-BFa2IeY9.mjs +10 -0
  143. package/notice-footer-Cw1DMzoB.js +1 -0
  144. package/package.json +19 -8
  145. package/progress-spinner-BugUcF5c.mjs +19 -0
  146. package/progress-spinner-CDgxI8R_.js +1 -0
  147. package/range-DC7seOVT.mjs +4 -0
  148. package/range-DOsPN0h5.js +1 -0
  149. package/textbox-BxYjEAZK.mjs +100 -0
  150. package/textbox-WnB-9F4y.js +1 -0
  151. package/use-tooltip-BavqG36Z.js +1 -0
  152. package/use-tooltip-Bibsm2rU.mjs +158 -0
  153. package/utils-BipBqkOS.mjs +21 -0
  154. package/utils-C9NL3q0j.js +1 -0
  155. package/common/component-utils/array.polyfill.flat.js +0 -32
  156. package/common/component-utils/forwardRef.js +0 -37
  157. package/common/component-utils/index.js +0 -18
  158. package/common/component-utils/usePrevious.js +0 -12
  159. package/common/component-utils/utils.js +0 -26
  160. package/common/debounce.js +0 -11
  161. package/common/event-utils/index.js +0 -123
  162. package/common/event-utils/types.js +0 -14
  163. package/common/event-utils/use-key-press.js +0 -33
  164. package/common/event-utils/use-roving-index.js +0 -35
  165. package/common/floating-label-utils/hooks.js +0 -133
  166. package/common/notice-utils/notice-content.js +0 -12
  167. package/common/notice-utils/notice-cta.js +0 -23
  168. package/common/notice-utils/notice-footer.js +0 -23
  169. package/common/notice-utils/notice-title.js +0 -24
  170. package/common/random-id.js +0 -5
  171. package/common/range.js +0 -5
  172. package/common/tooltip-utils/constants.js +0 -95
  173. package/common/tooltip-utils/index.js +0 -19
  174. package/common/tooltip-utils/tooltip-close-button.js +0 -8
  175. package/common/tooltip-utils/tooltip-content.js +0 -25
  176. package/common/tooltip-utils/tooltip-footer.js +0 -9
  177. package/common/tooltip-utils/tooltip-host.js +0 -24
  178. package/common/tooltip-utils/tooltip.js +0 -60
  179. package/common/tooltip-utils/types.js +0 -2
  180. package/common/tooltip-utils/use-tooltip.js +0 -27
  181. package/ebay-alert-dialog/alert-dialog.js +0 -55
  182. package/ebay-alert-dialog/index.js +0 -8
  183. package/ebay-badge/badge.js +0 -25
  184. package/ebay-badge/index.js +0 -8
  185. package/ebay-breadcrumbs/breadcrumb-item.js +0 -27
  186. package/ebay-breadcrumbs/breadcrumbs.js +0 -64
  187. package/ebay-breadcrumbs/index.js +0 -10
  188. package/ebay-button/button-cell.js +0 -29
  189. package/ebay-button/button-expand.js +0 -13
  190. package/ebay-button/button-loading.js +0 -11
  191. package/ebay-button/button-text.js +0 -9
  192. package/ebay-button/button.js +0 -95
  193. package/ebay-button/index.js +0 -10
  194. package/ebay-button/types.js +0 -2
  195. package/ebay-calendar/calendar.js +0 -306
  196. package/ebay-calendar/date-utils.js +0 -58
  197. package/ebay-calendar/index.js +0 -8
  198. package/ebay-carousel/carousel-control-button.js +0 -24
  199. package/ebay-carousel/carousel-item.js +0 -59
  200. package/ebay-carousel/carousel-list.js +0 -81
  201. package/ebay-carousel/carousel.js +0 -109
  202. package/ebay-carousel/helpers.js +0 -123
  203. package/ebay-carousel/index.js +0 -10
  204. package/ebay-carousel/scroll-to-transition.js +0 -102
  205. package/ebay-carousel/types.js +0 -2
  206. package/ebay-checkbox/checkbox.js +0 -77
  207. package/ebay-checkbox/index.js +0 -8
  208. package/ebay-confirm-dialog/confirm-dialog.js +0 -56
  209. package/ebay-confirm-dialog/index.js +0 -8
  210. package/ebay-cta-button/cta-button.js +0 -30
  211. package/ebay-cta-button/index.js +0 -8
  212. package/ebay-date-textbox/date-textbox.js +0 -179
  213. package/ebay-date-textbox/index.js +0 -8
  214. package/ebay-dialog-base/components/animation.js +0 -96
  215. package/ebay-dialog-base/components/dialog-actions.js +0 -8
  216. package/ebay-dialog-base/components/dialog-close-button.js +0 -8
  217. package/ebay-dialog-base/components/dialog-footer.js +0 -8
  218. package/ebay-dialog-base/components/dialog-header.js +0 -22
  219. package/ebay-dialog-base/components/dialog-previous-button.js +0 -24
  220. package/ebay-dialog-base/components/dialogBase.js +0 -152
  221. package/ebay-dialog-base/dialog-base-with-state.js +0 -63
  222. package/ebay-dialog-base/index.js +0 -18
  223. package/ebay-drawer-dialog/components/drawer.js +0 -104
  224. package/ebay-drawer-dialog/index.js +0 -8
  225. package/ebay-eek/eek-rating.js +0 -23
  226. package/ebay-eek/eek-util.js +0 -34
  227. package/ebay-eek/index.js +0 -8
  228. package/ebay-fake-menu/index.js +0 -12
  229. package/ebay-fake-menu/menu-item-separator.js +0 -23
  230. package/ebay-fake-menu/menu-item.js +0 -72
  231. package/ebay-fake-menu/menu.js +0 -57
  232. package/ebay-fake-menu-button/index.js +0 -14
  233. package/ebay-fake-menu-button/menu-button-item.js +0 -5
  234. package/ebay-fake-menu-button/menu-button-label.js +0 -8
  235. package/ebay-fake-menu-button/menu-button-separator.js +0 -23
  236. package/ebay-fake-menu-button/menu-button.js +0 -105
  237. package/ebay-fake-tabs/fake-tabs.js +0 -54
  238. package/ebay-fake-tabs/index.js +0 -10
  239. package/ebay-fake-tabs/tab.js +0 -24
  240. package/ebay-field/description.js +0 -26
  241. package/ebay-field/field.js +0 -12
  242. package/ebay-field/index.js +0 -12
  243. package/ebay-field/label.js +0 -29
  244. package/ebay-field/types.js +0 -2
  245. package/ebay-fullscreen-dialog/fullscreen-dialog.js +0 -25
  246. package/ebay-fullscreen-dialog/index.js +0 -8
  247. package/ebay-icon/icon.js +0 -89
  248. package/ebay-icon/index.js +0 -8
  249. package/ebay-icon/types.js +0 -3
  250. package/ebay-icon-button/icon-button.js +0 -40
  251. package/ebay-icon-button/index.js +0 -8
  252. package/ebay-infotip/ebay-infotip-content.js +0 -12
  253. package/ebay-infotip/ebay-infotip-heading.js +0 -23
  254. package/ebay-infotip/ebay-infotip-host.js +0 -28
  255. package/ebay-infotip/ebay-infotip.js +0 -79
  256. package/ebay-infotip/index.js +0 -14
  257. package/ebay-infotip/types.js +0 -2
  258. package/ebay-inline-notice/index.js +0 -10
  259. package/ebay-inline-notice/inline-notice.js +0 -66
  260. package/ebay-inline-notice/types.js +0 -2
  261. package/ebay-lightbox-dialog/index.js +0 -8
  262. package/ebay-lightbox-dialog/lightbox-dialog.js +0 -27
  263. package/ebay-listbox-button/index.js +0 -10
  264. package/ebay-listbox-button/listbox-button-option.js +0 -27
  265. package/ebay-listbox-button/listbox-button.js +0 -252
  266. package/ebay-menu/index.js +0 -27
  267. package/ebay-menu/menu-item-separator.js +0 -23
  268. package/ebay-menu/menu-item.js +0 -67
  269. package/ebay-menu/menu.js +0 -149
  270. package/ebay-menu/types.js +0 -2
  271. package/ebay-menu-button/index.js +0 -29
  272. package/ebay-menu-button/menu-button-item.js +0 -5
  273. package/ebay-menu-button/menu-button-label.js +0 -8
  274. package/ebay-menu-button/menu-button-separator.js +0 -23
  275. package/ebay-menu-button/menu-button.js +0 -132
  276. package/ebay-menu-button/types.js +0 -2
  277. package/ebay-notice-base/components/ebay-notice-content/index.js +0 -8
  278. package/ebay-notice-base/components/ebay-notice-content/notice-content.js +0 -4
  279. package/ebay-notice-base/components/ebay-notice-title/index.js +0 -8
  280. package/ebay-notice-base/components/ebay-notice-title/notice-title.js +0 -8
  281. package/ebay-notice-base/index.js +0 -7
  282. package/ebay-page-notice/index.js +0 -16
  283. package/ebay-page-notice/page-notice-cta.js +0 -9
  284. package/ebay-page-notice/page-notice-footer.js +0 -9
  285. package/ebay-page-notice/page-notice-title.js +0 -23
  286. package/ebay-page-notice/page-notice.js +0 -66
  287. package/ebay-pagination/const.js +0 -8
  288. package/ebay-pagination/helpers.js +0 -92
  289. package/ebay-pagination/index.js +0 -10
  290. package/ebay-pagination/pagination-item.js +0 -55
  291. package/ebay-pagination/pagination.js +0 -146
  292. package/ebay-pagination/types.js +0 -2
  293. package/ebay-panel-dialog/index.js +0 -8
  294. package/ebay-panel-dialog/panel-dialog.js +0 -27
  295. package/ebay-progress-bar/index.js +0 -8
  296. package/ebay-progress-bar/progress-bar.js +0 -23
  297. package/ebay-progress-spinner/index.js +0 -8
  298. package/ebay-progress-spinner/progress-spinner.js +0 -30
  299. package/ebay-progress-stepper/ebay-progress-step.js +0 -64
  300. package/ebay-progress-stepper/ebay-progress-stepper.js +0 -70
  301. package/ebay-progress-stepper/ebay-progress-title.js +0 -5
  302. package/ebay-progress-stepper/index.js +0 -12
  303. package/ebay-progress-stepper/types.js +0 -2
  304. package/ebay-radio/index.js +0 -8
  305. package/ebay-radio/radio.js +0 -71
  306. package/ebay-section-notice/index.js +0 -14
  307. package/ebay-section-notice/section-notice-footer.js +0 -9
  308. package/ebay-section-notice/section-notice-title.js +0 -23
  309. package/ebay-section-notice/section-notice.js +0 -82
  310. package/ebay-section-title/cta.js +0 -26
  311. package/ebay-section-title/index.js +0 -16
  312. package/ebay-section-title/info.js +0 -23
  313. package/ebay-section-title/overflow.js +0 -23
  314. package/ebay-section-title/section-title.js +0 -35
  315. package/ebay-section-title/subtitle.js +0 -23
  316. package/ebay-section-title/title.js +0 -23
  317. package/ebay-select/ebay-select-option.js +0 -22
  318. package/ebay-select/ebay-select.js +0 -129
  319. package/ebay-select/index.js +0 -10
  320. package/ebay-signal/index.js +0 -8
  321. package/ebay-signal/signal.js +0 -24
  322. package/ebay-snackbar-dialog/components/ebay-snackbar-dialog-action.js +0 -24
  323. package/ebay-snackbar-dialog/components/ebay-snackbar-dialog.js +0 -122
  324. package/ebay-snackbar-dialog/index.js +0 -7
  325. package/ebay-split-button/index.js +0 -23
  326. package/ebay-split-button/split-button.js +0 -30
  327. package/ebay-split-button/types.js +0 -2
  328. package/ebay-star-rating/index.js +0 -23
  329. package/ebay-star-rating/star-rating.js +0 -26
  330. package/ebay-star-rating-select/index.js +0 -23
  331. package/ebay-star-rating-select/star-rating-select.js +0 -82
  332. package/ebay-svg/index.js +0 -8
  333. package/ebay-svg/svg.js +0 -2548
  334. package/ebay-switch/ebay-switch.js +0 -61
  335. package/ebay-switch/index.js +0 -8
  336. package/ebay-tabs/index.js +0 -12
  337. package/ebay-tabs/tab-panel.js +0 -24
  338. package/ebay-tabs/tab.js +0 -24
  339. package/ebay-tabs/tabs.js +0 -90
  340. package/ebay-tabs/types.js +0 -2
  341. package/ebay-textbox/index.js +0 -16
  342. package/ebay-textbox/postfix-icon.js +0 -26
  343. package/ebay-textbox/postfix-text.js +0 -8
  344. package/ebay-textbox/prefix-icon.js +0 -23
  345. package/ebay-textbox/prefix-text.js +0 -8
  346. package/ebay-textbox/textbox.js +0 -147
  347. package/ebay-textbox/types.js +0 -2
  348. package/ebay-toast-dialog/components/toast.js +0 -26
  349. package/ebay-toast-dialog/index.js +0 -8
  350. package/ebay-tooltip/ebay-tooltip-content.js +0 -8
  351. package/ebay-tooltip/ebay-tooltip-host.js +0 -8
  352. package/ebay-tooltip/ebay-tooltip.js +0 -85
  353. package/ebay-tooltip/index.js +0 -14
  354. package/ebay-tourtip/ebay-tourtip-content.js +0 -8
  355. package/ebay-tourtip/ebay-tourtip-footer.js +0 -10
  356. package/ebay-tourtip/ebay-tourtip-heading.js +0 -24
  357. package/ebay-tourtip/ebay-tourtip-host.js +0 -8
  358. package/ebay-tourtip/ebay-tourtip.js +0 -70
  359. package/ebay-tourtip/index.js +0 -18
  360. package/ebay-video/const.js +0 -19
  361. package/ebay-video/controls.js +0 -40
  362. package/ebay-video/index.js +0 -25
  363. package/ebay-video/reportButton.js +0 -12
  364. package/ebay-video/source.js +0 -22
  365. package/ebay-video/types.js +0 -2
  366. package/ebay-video/video.js +0 -210
@@ -0,0 +1,158 @@
1
+ import l, { Children as E, cloneElement as x, useState as T } from "react";
2
+ import f from "classnames";
3
+ import { w as g, E as h } from "./icon-B_a65KUD.mjs";
4
+ import { f as i, e as d } from "./utils-BipBqkOS.mjs";
5
+ const u = ({ children: t, className: o, forwardedRef: s, ...a }) => (E.only(t), x(t, {
6
+ ref: s,
7
+ ...a,
8
+ className: f(o, t.props.className)
9
+ })), N = ({ className: t, type: o, isExpanded: s, children: a, forwardedRef: e, ...p }) => {
10
+ var m;
11
+ const c = i(a, u), n = d(a, u)[0];
12
+ if (!c)
13
+ throw new Error("Tooltip: Please use a TooltipHost that defines the host of the tooltip");
14
+ const r = x(c, {
15
+ className: `${o}__host`,
16
+ "aria-expanded": s,
17
+ "aria-describedby": (m = n == null ? void 0 : n.props) == null ? void 0 : m.id,
18
+ ...c.props
19
+ });
20
+ return l.createElement(
21
+ "span",
22
+ { ...p, ref: e, className: f(t, o, {
23
+ [`${o}--expanded`]: s
24
+ }) },
25
+ r,
26
+ n
27
+ );
28
+ }, S = g(N), $ = "bottom", C = {
29
+ tooltip: "tooltip",
30
+ tourtip: "region",
31
+ infotip: ""
32
+ }, X = {
33
+ left: {
34
+ transform: "translateX(16px) translateY(-50%) scale3d(1,1,1)",
35
+ left: "100%",
36
+ right: "auto",
37
+ top: "-6px",
38
+ bottom: "auto"
39
+ },
40
+ "left-top": {
41
+ transform: "translateX(16px) scale3d(1,1,1)",
42
+ left: "100%",
43
+ right: "auto",
44
+ top: "-100%",
45
+ bottom: "auto"
46
+ },
47
+ "left-bottom": {
48
+ transform: "translateX(16px) scale3d(1,1,1)",
49
+ left: "100%",
50
+ right: "auto",
51
+ top: "auto",
52
+ bottom: "-10px"
53
+ },
54
+ right: {
55
+ transform: "translateX(-16px) translateY(-50%) scale3d(1,1,1)",
56
+ left: "auto",
57
+ right: "100%",
58
+ top: "-6px",
59
+ bottom: "auto"
60
+ },
61
+ "right-top": {
62
+ transform: "translateX(-16px) scale3d(1,1,1)",
63
+ left: "auto",
64
+ right: "100%",
65
+ top: "-100%",
66
+ bottom: "auto"
67
+ },
68
+ "right-bottom": {
69
+ transform: "translateX(-16px) scale3d(1,1,1)",
70
+ left: "auto",
71
+ right: "100%",
72
+ top: "auto",
73
+ bottom: "-50%"
74
+ },
75
+ top: {
76
+ transform: "translateX(-50%) scale3d(1,1,1)",
77
+ left: "50%",
78
+ right: "auto",
79
+ top: "calc(100% + 2px)",
80
+ bottom: "auto"
81
+ },
82
+ "top-left": {
83
+ transform: "scale3d(1,1,1)",
84
+ left: "-10px",
85
+ right: "auto",
86
+ top: "calc(100% + 2px)",
87
+ bottom: "auto"
88
+ },
89
+ "top-right": {
90
+ transform: "scale3d(1,1,1)",
91
+ left: "auto",
92
+ right: "-10px",
93
+ top: "calc(100% + 2px)",
94
+ bottom: "auto"
95
+ },
96
+ "bottom-right": {
97
+ transform: "scale3d(1,1,1)",
98
+ left: "auto",
99
+ right: "-10px",
100
+ top: "auto",
101
+ bottom: "calc(100% + 12px)"
102
+ },
103
+ "bottom-left": {
104
+ transform: "scale3d(1,1,1)",
105
+ left: "-10px",
106
+ right: "auto",
107
+ top: "auto",
108
+ bottom: "calc(100% + 12px)"
109
+ },
110
+ bottom: {
111
+ transform: "translateX(-50%) scale3d(1,1,1)",
112
+ left: "50%",
113
+ right: "auto",
114
+ top: "auto",
115
+ bottom: "calc(100% + 12px)"
116
+ }
117
+ }, I = () => null, b = ({ children: t, className: o, type: s = "tourtip" }) => l.createElement("div", { className: f(`${s}__footer`, o) }, t), Y = ({ id: t, style: o, pointer: s = $, children: a, type: e = "tooltip", showCloseButton: p, a11yCloseText: c, onClose: n }) => {
118
+ const r = i(a, I), m = i(a, b), _ = d(a, b);
119
+ return l.createElement(
120
+ "span",
121
+ { className: `${e}__overlay`, id: t, role: C[e] || null, style: { ...X[s], ...o } },
122
+ l.createElement("span", { className: `${e}__pointer ${e}__pointer--${s}` }),
123
+ l.createElement(
124
+ "span",
125
+ { className: `${e}__mask` },
126
+ l.createElement(
127
+ "span",
128
+ { className: `${e}__cell` },
129
+ l.createElement("span", { className: `${e}__content` }, _),
130
+ p ? l.createElement(
131
+ "button",
132
+ { ...r == null ? void 0 : r.props, className: `icon-btn icon-btn--transparent ${e}__close`, type: "button", "aria-label": c, onClick: n },
133
+ l.createElement(h, { name: "close16" })
134
+ ) : null,
135
+ m
136
+ )
137
+ )
138
+ );
139
+ }, H = ({ onExpand: t, onCollapse: o, initialExpanded: s = !1, hostRef: a }) => {
140
+ const [e, p] = T(s);
141
+ return {
142
+ isExpanded: e,
143
+ expandTooltip: () => {
144
+ p(!0), t && t();
145
+ },
146
+ collapseTooltip: () => {
147
+ var r;
148
+ p(!1), o && o(), (r = a == null ? void 0 : a.current) == null || r.focus();
149
+ }
150
+ };
151
+ };
152
+ export {
153
+ S as T,
154
+ u as a,
155
+ Y as b,
156
+ b as c,
157
+ H as u
158
+ };
@@ -0,0 +1,21 @@
1
+ import { Children as o } from "react";
2
+ import "./array.polyfill.flat-Bj5UhY_-.mjs";
3
+ function f(e = [], t) {
4
+ return o.toArray(e).find(({ type: n }) => n === t) || null;
5
+ }
6
+ function m(e = [], t) {
7
+ return o.toArray(e).filter(({ type: n }) => n !== t);
8
+ }
9
+ function c(e = [], t) {
10
+ const r = o.toArray(e), n = [t].flat();
11
+ return r.filter(({ type: l }) => n.includes(l));
12
+ }
13
+ function u(e = [], t) {
14
+ return o.toArray(e).filter(t);
15
+ }
16
+ export {
17
+ u as a,
18
+ c as b,
19
+ m as e,
20
+ f
21
+ };
@@ -0,0 +1 @@
1
+ "use strict";const l=require("react");require("./array.polyfill.flat-5BAolFdk.js");function o(e=[],n){return l.Children.toArray(e).find(({type:t})=>t===n)||null}function s(e=[],n){return l.Children.toArray(e).filter(({type:t})=>t!==n)}function c(e=[],n){const r=l.Children.toArray(e),t=[n].flat();return r.filter(({type:i})=>t.includes(i))}function f(e=[],n){return l.Children.toArray(e).filter(n)}exports.excludeComponent=s;exports.filterBy=f;exports.filterByType=c;exports.findComponent=o;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /**
3
- * adapted from:
4
- * https://github.com/behnammodi/polyfill/blob/master/array.polyfill.js
5
- * Array.prototype.flat()
6
- * version 0.0.0
7
- * Feature Chrome Firefox Internet Explorer Opera Safari Edge
8
- * Basic support 69 62 (No) 56 12 (No)
9
- * -------------------------------------------------------------------------------
10
- */
11
- if (!Array.prototype.flat) {
12
- // eslint-disable-next-line no-extend-native
13
- Object.defineProperty(Array.prototype, 'flat', {
14
- configurable: true,
15
- writable: true,
16
- value: function (d) {
17
- const depthArg = typeof d === 'undefined' ? 1 : Number(d) || 0;
18
- const result = [];
19
- const forEach = result.forEach;
20
- const flatDeep = (arr, depth) => forEach.call(arr, val => {
21
- if (depth > 0 && Array.isArray(val)) {
22
- flatDeep(val, depth - 1);
23
- }
24
- else {
25
- result.push(val);
26
- }
27
- });
28
- flatDeep(this, depthArg);
29
- return result;
30
- }
31
- });
32
- }
@@ -1,37 +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
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.withForwardRef = void 0;
27
- const react_1 = __importStar(require("react"));
28
- const getDisplayName = (Component) => Component.displayName || Component.name || 'Component';
29
- // Typescript will automatically find the return type crom forwardRef() function
30
- // Disabling eslint for this use case
31
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
32
- const withForwardRef = (Component) => {
33
- const ForwardRef = (0, react_1.forwardRef)((props, ref) => react_1.default.createElement(Component, Object.assign({}, props, { forwardedRef: ref })));
34
- ForwardRef.displayName = getDisplayName(Component);
35
- return ForwardRef;
36
- };
37
- exports.withForwardRef = withForwardRef;
@@ -1,18 +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
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./forwardRef"), exports);
18
- __exportStar(require("./utils"), exports);
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePrevious = void 0;
4
- const react_1 = require("react");
5
- function usePrevious(value) {
6
- const ref = (0, react_1.useRef)();
7
- (0, react_1.useEffect)(() => {
8
- ref.current = value;
9
- }, [value]);
10
- return ref.current;
11
- }
12
- exports.usePrevious = usePrevious;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.filterBy = exports.filterByType = exports.excludeComponent = exports.findComponent = void 0;
4
- const react_1 = require("react");
5
- require("./array.polyfill.flat"); // for Mobile Safari 11
6
- function findComponent(nodes = [], componentType) {
7
- const elements = react_1.Children.toArray(nodes);
8
- return elements.find(({ type }) => type === componentType) || null;
9
- }
10
- exports.findComponent = findComponent;
11
- function excludeComponent(nodes = [], componentType) {
12
- const elements = react_1.Children.toArray(nodes);
13
- return elements.filter(({ type }) => type !== componentType);
14
- }
15
- exports.excludeComponent = excludeComponent;
16
- function filterByType(nodes = [], componentType) {
17
- const elements = react_1.Children.toArray(nodes);
18
- const types = [componentType].flat();
19
- return elements.filter(({ type }) => types.includes(type));
20
- }
21
- exports.filterByType = filterByType;
22
- function filterBy(nodes = [], predicate) {
23
- const elements = react_1.Children.toArray(nodes);
24
- return elements.filter(predicate);
25
- }
26
- exports.filterBy = filterBy;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debounce = void 0;
4
- function debounce(fn, ms) {
5
- let timer;
6
- return (...args) => {
7
- clearTimeout(timer);
8
- timer = setTimeout(() => fn(...args), ms);
9
- };
10
- }
11
- exports.debounce = debounce;
@@ -1,123 +0,0 @@
1
- "use strict";
2
- /*
3
- * Based on https://github.com/eBay/ebayui-core/edit/master/src/common/event-utils/index.js
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.wrapEvent = exports.handleResize = exports.removeEventListener = exports.addEventListener = exports.preventDefaultIfHijax = exports.handleTextInput = exports.handleLeftRightArrowsKeydown = exports.handleUpDownArrowsKeydown = exports.handleEscapeKeydown = exports.isActionKey = exports.handleActionKeydown = exports.handleEnterKeydown = void 0;
7
- /**
8
- * Generic keydown handler used by more specific cases
9
- * @param {Array} keyList: List of acceptable keys
10
- * @param {KeyboardEvent} e
11
- * @param {Function} callback
12
- */
13
- function handleKeydown(keyList, e, callback = () => { }) {
14
- if (keyList.includes(e.key)) {
15
- callback();
16
- }
17
- }
18
- // inverse of found keys
19
- function handleNotKeydown(keyList, e, callback = () => { }) {
20
- if (!keyList.includes(e.key)) {
21
- callback();
22
- }
23
- }
24
- function handleEnterKeydown(e, callback) {
25
- if (e.key === 'Enter') {
26
- callback();
27
- }
28
- }
29
- exports.handleEnterKeydown = handleEnterKeydown;
30
- function handleActionKeydown(e, callback) {
31
- if (isActionKey(e.key)) {
32
- callback();
33
- }
34
- }
35
- exports.handleActionKeydown = handleActionKeydown;
36
- function isActionKey(key) {
37
- return [' ', 'Enter'].includes(key);
38
- }
39
- exports.isActionKey = isActionKey;
40
- function handleEscapeKeydown(e, callback) {
41
- handleKeydown(['Esc', 'Escape'], e, callback);
42
- }
43
- exports.handleEscapeKeydown = handleEscapeKeydown;
44
- function handleUpDownArrowsKeydown(e, callback) {
45
- handleKeydown(['Up', 'ArrowUp', 'Down', 'ArrowDown'], e, callback);
46
- }
47
- exports.handleUpDownArrowsKeydown = handleUpDownArrowsKeydown;
48
- function handleLeftRightArrowsKeydown(e, callback) {
49
- handleKeydown(['Left', 'ArrowLeft', 'Right', 'ArrowRight'], e, callback);
50
- }
51
- exports.handleLeftRightArrowsKeydown = handleLeftRightArrowsKeydown;
52
- // only fire for character input, not modifier/meta keys (enter, escape, backspace, tab, etc.)
53
- function handleTextInput(e, callback) {
54
- const keyList = [
55
- // Edge
56
- 'Esc',
57
- 'Left',
58
- 'Up',
59
- 'Right',
60
- 'Down',
61
- // Browsers
62
- 'Tab',
63
- 'Enter',
64
- 'Shift',
65
- 'Control',
66
- 'Alt',
67
- 'CapsLock',
68
- 'Escape',
69
- 'ArrowLeft',
70
- 'ArrowUp',
71
- 'ArrowRight',
72
- 'ArrowDown',
73
- 'Meta'
74
- ];
75
- handleNotKeydown(keyList, e, callback);
76
- }
77
- exports.handleTextInput = handleTextInput;
78
- function preventDefaultIfHijax(e, hijax) {
79
- if (hijax) {
80
- e.preventDefault();
81
- }
82
- }
83
- exports.preventDefaultIfHijax = preventDefaultIfHijax;
84
- const handlers = [];
85
- function addEventListener(_, handler) {
86
- if (handlers.length === 0) {
87
- window.addEventListener('resize', handleResize);
88
- }
89
- handlers.push(handler);
90
- }
91
- exports.addEventListener = addEventListener;
92
- function removeEventListener(_, handler) {
93
- if (handlers.length === 1) {
94
- window.removeEventListener('resize', handleResize);
95
- }
96
- handlers.splice(handlers.indexOf(handler), 1);
97
- }
98
- exports.removeEventListener = removeEventListener;
99
- function handleResize(e) {
100
- window.removeEventListener('resize', handleResize);
101
- const callback = () => {
102
- if (handlers.length) {
103
- handlers.forEach(handler => handler(e));
104
- window.addEventListener('resize', handleResize);
105
- }
106
- };
107
- if (window.requestAnimationFrame) {
108
- window.requestAnimationFrame(callback);
109
- }
110
- else {
111
- window.setTimeout(callback, 16);
112
- }
113
- }
114
- exports.handleResize = handleResize;
115
- function wrapEvent(parentEventHandler = () => { }, localEventHandler) {
116
- return (e) => {
117
- parentEventHandler(e);
118
- if (!e.defaultPrevented) {
119
- return localEventHandler(e);
120
- }
121
- };
122
- }
123
- exports.wrapEvent = wrapEvent;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- type ClipboardEventHandler<T = Element> = EventHandler<ClipboardEvent<T>>;
5
- type CompositionEventHandler<T = Element> = EventHandler<CompositionEvent<T>>;
6
- type DragEventHandler<T = Element> = EventHandler<DragEvent<T>>;
7
- type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
8
- type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
9
- type PointerEventHandler<T = Element> = EventHandler<PointerEvent<T>>;
10
- type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>;
11
- type WheelEventHandler<T = Element> = EventHandler<WheelEvent<T>>;
12
- type AnimationEventHandler<T = Element> = EventHandler<AnimationEvent<T>>;
13
- type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent<T>>;
14
- */
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_1 = require("react");
4
- const useKeyPress = () => {
5
- const [arrowUpPressed, setArrowUpPressed] = (0, react_1.useState)(false);
6
- const [arrowDownPressed, setArrowDownPressed] = (0, react_1.useState)(false);
7
- const upHandler = ({ key }) => {
8
- const fn = {
9
- ArrowUp: setArrowUpPressed,
10
- ArrowDown: setArrowDownPressed
11
- }[key];
12
- if (fn)
13
- fn(false);
14
- };
15
- const downHandler = ({ key }) => {
16
- const fn = {
17
- ArrowUp: setArrowUpPressed,
18
- ArrowDown: setArrowDownPressed
19
- }[key];
20
- if (fn)
21
- fn(true);
22
- };
23
- (0, react_1.useEffect)(() => {
24
- window.addEventListener('keydown', downHandler);
25
- window.addEventListener('keyup', upHandler);
26
- return () => {
27
- window.removeEventListener('keydown', downHandler);
28
- window.removeEventListener('keyup', upHandler);
29
- };
30
- }, []);
31
- return [arrowUpPressed, arrowDownPressed];
32
- };
33
- exports.default = useKeyPress;
@@ -1,35 +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
- const react_1 = require("react");
7
- const use_key_press_1 = __importDefault(require("./use-key-press"));
8
- const useRovingIndex = (children, FocusableType, defaultValue) => {
9
- const [rovingIndex, setRovingIndex] = (0, react_1.useState)(defaultValue);
10
- const [arrowUpPressed, arrowDownPressed] = (0, use_key_press_1.default)();
11
- const rovingIndexArray = react_1.Children
12
- .toArray(children)
13
- .reduce((focusables, child, i) => child.type === FocusableType ? [...focusables, i] : focusables, []);
14
- const currentIndex = rovingIndexArray.indexOf(rovingIndex);
15
- const previousOrCurrent = () => {
16
- if (currentIndex === -1)
17
- return rovingIndex;
18
- const previousRovingIndex = rovingIndexArray[currentIndex - 1];
19
- return previousRovingIndex === undefined ? rovingIndex : previousRovingIndex;
20
- };
21
- const nextOrCurrent = () => {
22
- if (currentIndex === -1)
23
- return rovingIndex;
24
- const nextRovingIndex = rovingIndexArray[currentIndex + 1];
25
- return nextRovingIndex === undefined ? rovingIndex : nextRovingIndex;
26
- };
27
- (0, react_1.useEffect)(() => {
28
- if (arrowUpPressed)
29
- setRovingIndex(previousOrCurrent());
30
- if (arrowDownPressed)
31
- setRovingIndex(nextOrCurrent());
32
- }, [arrowUpPressed, arrowDownPressed]);
33
- return [rovingIndex, setRovingIndex];
34
- };
35
- exports.default = useRovingIndex;
@@ -1,133 +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 __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.useFloatingLabel = void 0;
30
- const react_1 = __importStar(require("react"));
31
- const classnames_1 = __importDefault(require("classnames"));
32
- const classPrefix = 'floating-label__label';
33
- // input background in Skin 12, used for autofill detection
34
- const textboxElementBackgroundRGB = [
35
- 'rgb(245, 245, 245)',
36
- 'rgb(247, 247, 247)' // From skin version 12.6.0
37
- ];
38
- // check for computed background color because of Chrome autofill bug
39
- // https://stackoverflow.com/questions/35049555/chrome-autofill-autocomplete-no-value-for-password/35783761#35783761
40
- const isAutofilled = (input) => input && !textboxElementBackgroundRGB.includes(getComputedStyle(input).backgroundColor);
41
- const hasValue = (input) => { var _a; return ((_a = input === null || input === void 0 ? void 0 : input.value) === null || _a === void 0 ? void 0 : _a.length) > 0; };
42
- const isSelect = (element) => (element === null || element === void 0 ? void 0 : element.tagName) === `SELECT`;
43
- const setPlaceholder = (element, value) => {
44
- // For select elements we need to temporary remove the text of the first option
45
- // when the element is not focused, so only the label is shown. We still need to
46
- // maintain the width of the input so we manually change the "min-width"
47
- // Inspired by the marko implementation: https://github.com/makeup/makeup-js/blob/master/packages/makeup-floating-label/src/index.js
48
- if (isSelect(element) && !hasValue(element.querySelector(`option`))) {
49
- element.style['min-width'] = '';
50
- const beforeWidth = element.offsetWidth;
51
- element.querySelector(`option`).text = value;
52
- if (!value && beforeWidth > element.offsetWidth) {
53
- element.style['min-width'] = `${beforeWidth}px`;
54
- }
55
- }
56
- };
57
- const getPlaceholder = (element) => {
58
- if (isSelect(element)) {
59
- return element.querySelector(`option`).text;
60
- }
61
- return element === null || element === void 0 ? void 0 : element.placeholder;
62
- };
63
- function useFloatingLabel({ ref, inputId, className, disabled, label, inputSize, inputValue, placeholder, invalid, opaqueLabel, type, onMount = () => { } }) {
64
- const _internalInputRef = (0, react_1.useRef)(null);
65
- const inputRef = () => ref || _internalInputRef;
66
- const [isFloating, setFloating] = (0, react_1.useState)(Boolean(inputValue));
67
- const [shouldAnimate, setAnimate] = (0, react_1.useState)(false);
68
- const [isFocused, setFocused] = (0, react_1.useState)(false);
69
- const selectFirstOptionText = (0, react_1.useRef)(``);
70
- const onBlur = () => {
71
- var _a;
72
- setAnimate(true);
73
- setFloating(hasValue((_a = inputRef()) === null || _a === void 0 ? void 0 : _a.current));
74
- setFocused(false);
75
- setPlaceholder(inputRef().current, ``);
76
- };
77
- const onFocus = () => {
78
- var _a;
79
- setAnimate(true);
80
- setFloating(true);
81
- setFocused(true);
82
- setPlaceholder((_a = inputRef()) === null || _a === void 0 ? void 0 : _a.current, selectFirstOptionText.current);
83
- };
84
- (0, react_1.useEffect)(() => {
85
- var _a, _b;
86
- if (!label) {
87
- return;
88
- }
89
- selectFirstOptionText.current = getPlaceholder((_a = inputRef()) === null || _a === void 0 ? void 0 : _a.current);
90
- setPlaceholder((_b = inputRef()) === null || _b === void 0 ? void 0 : _b.current, ``);
91
- onMount();
92
- }, []);
93
- (0, react_1.useEffect)(() => {
94
- var _a, _b, _c;
95
- if (!label) {
96
- return;
97
- }
98
- setFloating(isFocused || hasValue((_a = inputRef()) === null || _a === void 0 ? void 0 : _a.current) || isAutofilled((_c = (_b = inputRef()) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.parentNode));
99
- }, [isFocused, inputValue]);
100
- const labelClassName = (0, classnames_1.default)(className, classPrefix, {
101
- [`${classPrefix}--disabled`]: disabled,
102
- [`${classPrefix}--animate`]: shouldAnimate,
103
- [`${classPrefix}--inline`]: !isFloating && type !== 'date',
104
- [`${classPrefix}--focus`]: isFocused,
105
- [`${classPrefix}--invalid`]: invalid
106
- });
107
- const floatingLabelClassName = (0, classnames_1.default)(`floating-label`, {
108
- 'floating-label--large': inputSize === `large`,
109
- 'floating-label--opaque': opaqueLabel
110
- });
111
- const FragmentContainer = (0, react_1.useCallback)(({ children }) => react_1.default.createElement(react_1.default.Fragment, null, children), []);
112
- const FloatingLabelContainer = (0, react_1.useCallback)(({ children }) => react_1.default.createElement("span", { className: floatingLabelClassName }, children), [floatingLabelClassName]);
113
- if (!label) {
114
- return {
115
- label: null,
116
- Container: FragmentContainer,
117
- onBlur: () => { },
118
- onFocus: () => { },
119
- ref: inputRef(),
120
- placeholder
121
- };
122
- }
123
- const labelElement = react_1.default.createElement("label", { htmlFor: inputId, className: labelClassName }, label);
124
- return {
125
- label: labelElement,
126
- Container: FloatingLabelContainer,
127
- onBlur,
128
- onFocus,
129
- ref: inputRef(),
130
- placeholder: !isFloating ? null : placeholder
131
- };
132
- }
133
- exports.useFloatingLabel = useFloatingLabel;