@lumx/react 3.10.1-alpha.2 → 3.10.1-alpha.4

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 (334) hide show
  1. package/_internal/{8d67e1e3.d.ts → index.d.ts} +1 -1
  2. package/_internal/index.js +99 -0
  3. package/_internal/index.js.map +1 -0
  4. package/index.d.ts +3000 -66
  5. package/index.js +14561 -64
  6. package/index.js.map +1 -1
  7. package/package.json +3 -3
  8. package/src/components/button/Button.tsx +4 -5
  9. package/src/components/button/ButtonRoot.tsx +1 -3
  10. package/src/components/chip/Chip.tsx +7 -11
  11. package/src/components/date-picker/DatePickerControlled.tsx +1 -1
  12. package/src/components/dialog/Dialog.tsx +1 -1
  13. package/src/components/expansion-panel/ExpansionPanel.test.tsx +2 -2
  14. package/src/components/expansion-panel/ExpansionPanel.tsx +14 -18
  15. package/src/components/flex-box/FlexBox.tsx +1 -1
  16. package/src/components/generic-block/GenericBlock.tsx +6 -7
  17. package/src/components/generic-block/constants.ts +9 -4
  18. package/src/components/grid-column/GridColumn.tsx +1 -2
  19. package/src/components/image-lightbox/internal/ImageSlide.tsx +2 -2
  20. package/src/components/image-lightbox/internal/ImageSlideshow.tsx +4 -8
  21. package/src/components/image-lightbox/useImageLightbox.tsx +3 -4
  22. package/src/components/link/Link.tsx +3 -5
  23. package/src/components/list/ListItem.tsx +2 -3
  24. package/src/components/list/useInteractiveList.tsx +1 -2
  25. package/src/components/mosaic/Mosaic.test.tsx +3 -3
  26. package/src/components/mosaic/Mosaic.tsx +2 -3
  27. package/src/components/navigation/Navigation.tsx +42 -37
  28. package/src/components/navigation/NavigationSection.tsx +76 -79
  29. package/src/components/notification/Notification.tsx +1 -5
  30. package/src/components/popover/usePopoverStyle.tsx +3 -1
  31. package/src/components/popover/useRestoreFocusOnClose.tsx +1 -1
  32. package/src/components/popover-dialog/PopoverDialog.test.tsx +1 -1
  33. package/src/components/post-block/PostBlock.tsx +4 -8
  34. package/src/components/progress-tracker/ProgressTracker.stories.tsx +11 -11
  35. package/src/components/select/Select.stories.tsx +14 -5
  36. package/src/components/select/Select.test.tsx +2 -2
  37. package/src/components/select/Select.tsx +1 -2
  38. package/src/components/select/SelectMultiple.stories.tsx +12 -10
  39. package/src/components/side-navigation/SideNavigationItem.tsx +1 -1
  40. package/src/components/slideshow/Slides.tsx +1 -1
  41. package/src/components/slideshow/SlideshowControls.tsx +1 -1
  42. package/src/components/slideshow/useSlideFocusManagement.tsx +1 -1
  43. package/src/components/switch/Switch.tsx +1 -2
  44. package/src/components/tabs/Tabs.stories.tsx +3 -4
  45. package/src/components/text-field/TextField.test.tsx +4 -4
  46. package/src/components/text-field/TextField.tsx +2 -3
  47. package/src/components/tooltip/Tooltip.test.tsx +2 -2
  48. package/src/components/tooltip/useTooltipOpen.tsx +3 -3
  49. package/src/components/user-block/UserBlock.tsx +7 -9
  50. package/src/hooks/useCallbackOnEscape.ts +1 -1
  51. package/src/hooks/useClickAway.tsx +1 -2
  52. package/src/hooks/useFocusTrap.ts +1 -1
  53. package/src/hooks/useInterval.tsx +1 -4
  54. package/src/hooks/useKeyboardListNavigation.tsx +2 -4
  55. package/src/hooks/useSizeOnWindowResize.ts +14 -10
  56. package/src/hooks/useStopPropagation.ts +1 -2
  57. package/src/hooks/useTransitionVisibility.ts +2 -2
  58. package/src/stories/decorators/withCombinations.tsx +1 -1
  59. package/src/testing/utils/commonTestsSuiteRTL.tsx +2 -2
  60. package/src/utils/{DOM → browser/DOM}/startViewTransition.ts +3 -3
  61. package/src/utils/{focus → browser/focus}/getFirstAndLastFocusable.test.ts +1 -1
  62. package/src/utils/{focus → browser/focus}/getFocusableElements.test.ts +1 -1
  63. package/src/utils/{browserDoesNotSupportHover.test.js → browser/isHoverNotSupported.test.js} +5 -5
  64. package/src/utils/browser/isHoverNotSupported.ts +2 -0
  65. package/src/utils/browser/{getPrefersReducedMotion.ts → isReducedMotion.ts} +1 -1
  66. package/src/utils/className/getFontColorClassName.ts +9 -0
  67. package/src/utils/{className.ts → className/getRootClassName.ts} +1 -21
  68. package/src/utils/className/getTypographyClassName.ts +9 -0
  69. package/src/utils/className/index.ts +4 -0
  70. package/src/utils/collection/castArray.test.ts +15 -0
  71. package/src/utils/collection/castArray.ts +3 -0
  72. package/src/utils/collection/chunk.test.ts +15 -0
  73. package/src/utils/collection/chunk.ts +6 -0
  74. package/src/utils/collection/isEmpty.test.js +20 -0
  75. package/src/utils/collection/isEmpty.ts +4 -0
  76. package/src/utils/collection/last.ts +2 -0
  77. package/src/utils/collection/partitionMulti.test.ts +35 -0
  78. package/src/utils/{partitionMulti.ts → collection/partitionMulti.ts} +13 -12
  79. package/src/utils/collection/pull.test.ts +17 -0
  80. package/src/utils/collection/pull.ts +7 -0
  81. package/src/utils/collection/range.test.js +9 -0
  82. package/src/utils/collection/range.ts +2 -0
  83. package/src/utils/date/getMonthCalendar.ts +3 -4
  84. package/src/utils/flattenChildren.ts +2 -3
  85. package/src/utils/function/memoize.test.ts +36 -0
  86. package/src/utils/function/memoize.ts +13 -0
  87. package/src/utils/makeListenerTowerContext.ts +2 -2
  88. package/src/utils/partitionMulti.test.ts +27 -0
  89. package/src/utils/react/forwardRef.ts +3 -2
  90. package/src/utils/react/forwardRefPolymorphic.ts +1 -2
  91. package/utils/index.d.ts +1 -1
  92. package/utils/index.js +1 -96
  93. package/utils/index.js.map +1 -1
  94. package/_internal/17c3ea1d.js +0 -137
  95. package/_internal/17c3ea1d.js.map +0 -1
  96. package/_internal/1da25128.js +0 -411
  97. package/_internal/1da25128.js.map +0 -1
  98. package/_internal/230173a8.js +0 -13
  99. package/_internal/230173a8.js.map +0 -1
  100. package/_internal/23bdba2d.js +0 -71
  101. package/_internal/23bdba2d.js.map +0 -1
  102. package/_internal/26926e5c.d.ts +0 -36
  103. package/_internal/2a3d237c.js +0 -12
  104. package/_internal/2a3d237c.js.map +0 -1
  105. package/_internal/2c5dbb03.js +0 -26
  106. package/_internal/2c5dbb03.js.map +0 -1
  107. package/_internal/2e2abe51.js +0 -2154
  108. package/_internal/2e2abe51.js.map +0 -1
  109. package/_internal/31490c59.d.ts +0 -167
  110. package/_internal/3181f000.js +0 -14
  111. package/_internal/3181f000.js.map +0 -1
  112. package/_internal/35f100be.d.ts +0 -104
  113. package/_internal/36bd7352.js +0 -219
  114. package/_internal/36bd7352.js.map +0 -1
  115. package/_internal/3a1facc0.js +0 -18
  116. package/_internal/3a1facc0.js.map +0 -1
  117. package/_internal/4c20d932.js +0 -89
  118. package/_internal/4c20d932.js.map +0 -1
  119. package/_internal/4c28d012.js +0 -305
  120. package/_internal/4c28d012.js.map +0 -1
  121. package/_internal/4cd0bf32.js +0 -160
  122. package/_internal/4cd0bf32.js.map +0 -1
  123. package/_internal/4daccdd5.js +0 -25
  124. package/_internal/4daccdd5.js.map +0 -1
  125. package/_internal/524b1d04.js +0 -64
  126. package/_internal/524b1d04.js.map +0 -1
  127. package/_internal/53c94227.js +0 -123
  128. package/_internal/53c94227.js.map +0 -1
  129. package/_internal/54d9ded5.js +0 -418
  130. package/_internal/54d9ded5.js.map +0 -1
  131. package/_internal/56aec41b.js +0 -652
  132. package/_internal/56aec41b.js.map +0 -1
  133. package/_internal/5720caf5.js +0 -124
  134. package/_internal/5720caf5.js.map +0 -1
  135. package/_internal/646f0db6.js +0 -113
  136. package/_internal/646f0db6.js.map +0 -1
  137. package/_internal/6cc8dca8.d.ts +0 -22
  138. package/_internal/7f022f8c.d.ts +0 -34
  139. package/_internal/b8f2948d.js +0 -691
  140. package/_internal/b8f2948d.js.map +0 -1
  141. package/_internal/bc28d510.js +0 -784
  142. package/_internal/bc28d510.js.map +0 -1
  143. package/_internal/c68d24e4.js +0 -145
  144. package/_internal/c68d24e4.js.map +0 -1
  145. package/_internal/c6c99f76.js +0 -105
  146. package/_internal/c6c99f76.js.map +0 -1
  147. package/_internal/cae46566.js +0 -65
  148. package/_internal/cae46566.js.map +0 -1
  149. package/_internal/components/alert-dialog/index.ts-623b1ed3.d.ts +0 -37
  150. package/_internal/components/alert-dialog/index.ts-f83bd6ef.js +0 -148
  151. package/_internal/components/alert-dialog/index.ts-f83bd6ef.js.map +0 -1
  152. package/_internal/components/autocomplete/index.ts-3f8f125c.js +0 -264
  153. package/_internal/components/autocomplete/index.ts-3f8f125c.js.map +0 -1
  154. package/_internal/components/autocomplete/index.ts-8d6b123f.d.ts +0 -201
  155. package/_internal/components/avatar/index.ts-93ee0ea9.js +0 -89
  156. package/_internal/components/avatar/index.ts-93ee0ea9.js.map +0 -1
  157. package/_internal/components/avatar/index.ts-f92852b4.d.ts +0 -43
  158. package/_internal/components/badge/index.ts-2d7700ef.d.ts +0 -30
  159. package/_internal/components/badge/index.ts-6753d67f.js +0 -88
  160. package/_internal/components/badge/index.ts-6753d67f.js.map +0 -1
  161. package/_internal/components/button/index.ts-031307ce.js +0 -51
  162. package/_internal/components/button/index.ts-031307ce.js.map +0 -1
  163. package/_internal/components/button/index.ts-b29e26a4.d.ts +0 -22
  164. package/_internal/components/checkbox/index.ts-a33166d7.js +0 -127
  165. package/_internal/components/checkbox/index.ts-a33166d7.js.map +0 -1
  166. package/_internal/components/checkbox/index.ts-f82358ff.d.ts +0 -38
  167. package/_internal/components/chip/index.ts-4a91f1a7.d.ts +0 -68
  168. package/_internal/components/chip/index.ts-a2b5b771.js +0 -110
  169. package/_internal/components/chip/index.ts-a2b5b771.js.map +0 -1
  170. package/_internal/components/comment-block/index.ts-58fa051a.js +0 -121
  171. package/_internal/components/comment-block/index.ts-58fa051a.js.map +0 -1
  172. package/_internal/components/comment-block/index.ts-8cfa5af0.d.ts +0 -67
  173. package/_internal/components/date-picker/index.ts-145262d5.js +0 -2
  174. package/_internal/components/date-picker/index.ts-145262d5.js.map +0 -1
  175. package/_internal/components/date-picker/index.ts-70a34fa7.d.ts +0 -95
  176. package/_internal/components/dialog/index.ts-ea044db2.js +0 -224
  177. package/_internal/components/dialog/index.ts-ea044db2.js.map +0 -1
  178. package/_internal/components/dialog/index.ts-eca28654.d.ts +0 -55
  179. package/_internal/components/divider/index.ts-4a56db75.js +0 -55
  180. package/_internal/components/divider/index.ts-4a56db75.js.map +0 -1
  181. package/_internal/components/divider/index.ts-b011d8ca.d.ts +0 -18
  182. package/_internal/components/drag-handle/index.ts-0aebf92f.js +0 -54
  183. package/_internal/components/drag-handle/index.ts-0aebf92f.js.map +0 -1
  184. package/_internal/components/drag-handle/index.ts-3ab31dd1.d.ts +0 -18
  185. package/_internal/components/dropdown/index.ts-2a17db51.js +0 -154
  186. package/_internal/components/dropdown/index.ts-2a17db51.js.map +0 -1
  187. package/_internal/components/dropdown/index.ts-b648a15c.d.ts +0 -87
  188. package/_internal/components/expansion-panel/index.ts-69f09f5b.d.ts +0 -38
  189. package/_internal/components/expansion-panel/index.ts-fae3762e.js +0 -143
  190. package/_internal/components/expansion-panel/index.ts-fae3762e.js.map +0 -1
  191. package/_internal/components/flag/index.ts-8dcd685b.js +0 -56
  192. package/_internal/components/flag/index.ts-8dcd685b.js.map +0 -1
  193. package/_internal/components/flag/index.ts-fda89adb.d.ts +0 -23
  194. package/_internal/components/flex-box/index.ts-87f2b58d.d.ts +0 -43
  195. package/_internal/components/flex-box/index.ts-c216e957.js +0 -60
  196. package/_internal/components/flex-box/index.ts-c216e957.js.map +0 -1
  197. package/_internal/components/generic-block/index.ts-999a62a4.js +0 -115
  198. package/_internal/components/generic-block/index.ts-999a62a4.js.map +0 -1
  199. package/_internal/components/generic-block/index.ts-cd3b0e21.d.ts +0 -106
  200. package/_internal/components/grid/index.ts-67e0694f.d.ts +0 -50
  201. package/_internal/components/grid/index.ts-fdf1b306.js +0 -113
  202. package/_internal/components/grid/index.ts-fdf1b306.js.map +0 -1
  203. package/_internal/components/grid-column/index.ts-97c61cbe.js +0 -64
  204. package/_internal/components/grid-column/index.ts-97c61cbe.js.map +0 -1
  205. package/_internal/components/grid-column/index.ts-c89e1c18.d.ts +0 -31
  206. package/_internal/components/heading/index.ts-0179e9a9.js +0 -112
  207. package/_internal/components/heading/index.ts-0179e9a9.js.map +0 -1
  208. package/_internal/components/heading/index.ts-587579e8.d.ts +0 -37
  209. package/_internal/components/icon/index.ts-740ca1de.js +0 -2
  210. package/_internal/components/icon/index.ts-740ca1de.js.map +0 -1
  211. package/_internal/components/icon/index.ts-b3fa5e15.d.ts +0 -34
  212. package/_internal/components/image-block/index.ts-36b3828f.d.ts +0 -49
  213. package/_internal/components/image-block/index.ts-ef5e2e7d.js +0 -111
  214. package/_internal/components/image-block/index.ts-ef5e2e7d.js.map +0 -1
  215. package/_internal/components/image-lightbox/index.ts-137f85a8.js +0 -765
  216. package/_internal/components/image-lightbox/index.ts-137f85a8.js.map +0 -1
  217. package/_internal/components/image-lightbox/index.ts-2cb92d18.d.ts +0 -75
  218. package/_internal/components/inline-list/index.ts-033dd358.js +0 -76
  219. package/_internal/components/inline-list/index.ts-033dd358.js.map +0 -1
  220. package/_internal/components/inline-list/index.ts-e1c8a3ff.d.ts +0 -34
  221. package/_internal/components/input-helper/index.ts-32a9ca90.d.ts +0 -22
  222. package/_internal/components/input-helper/index.ts-ab3a1ef5.js +0 -75
  223. package/_internal/components/input-helper/index.ts-ab3a1ef5.js.map +0 -1
  224. package/_internal/components/input-label/index.ts-86f2ea41.d.ts +0 -24
  225. package/_internal/components/input-label/index.ts-d6ca5569.js +0 -60
  226. package/_internal/components/input-label/index.ts-d6ca5569.js.map +0 -1
  227. package/_internal/components/lightbox/index.ts-5370e8e6.d.ts +0 -36
  228. package/_internal/components/lightbox/index.ts-7a16cdc7.js +0 -149
  229. package/_internal/components/lightbox/index.ts-7a16cdc7.js.map +0 -1
  230. package/_internal/components/link/index.ts-26435006.d.ts +0 -37
  231. package/_internal/components/link/index.ts-d04f4e53.js +0 -120
  232. package/_internal/components/link/index.ts-d04f4e53.js.map +0 -1
  233. package/_internal/components/link-preview/index.ts-e560a274.d.ts +0 -36
  234. package/_internal/components/link-preview/index.ts-fee89f66.js +0 -109
  235. package/_internal/components/link-preview/index.ts-fee89f66.js.map +0 -1
  236. package/_internal/components/list/index.ts-ab57902e.d.ts +0 -118
  237. package/_internal/components/list/index.ts-f3101625.js +0 -86
  238. package/_internal/components/list/index.ts-f3101625.js.map +0 -1
  239. package/_internal/components/message/index.ts-041cf0cb.js +0 -97
  240. package/_internal/components/message/index.ts-041cf0cb.js.map +0 -1
  241. package/_internal/components/message/index.ts-2d38e0ea.d.ts +0 -37
  242. package/_internal/components/mosaic/index.ts-232d5aed.d.ts +0 -23
  243. package/_internal/components/mosaic/index.ts-d2128cd3.js +0 -94
  244. package/_internal/components/mosaic/index.ts-d2128cd3.js.map +0 -1
  245. package/_internal/components/navigation/index.ts-6d8bea53.d.ts +0 -58
  246. package/_internal/components/navigation/index.ts-e8dc0a7f.js +0 -222
  247. package/_internal/components/navigation/index.ts-e8dc0a7f.js.map +0 -1
  248. package/_internal/components/notification/index.ts-235fd340.js +0 -140
  249. package/_internal/components/notification/index.ts-235fd340.js.map +0 -1
  250. package/_internal/components/notification/index.ts-bb3f03f6.d.ts +0 -34
  251. package/_internal/components/popover/index.ts-2f17a9b6.js +0 -3
  252. package/_internal/components/popover/index.ts-2f17a9b6.js.map +0 -1
  253. package/_internal/components/popover/index.ts-e3b4ff19.d.ts +0 -66
  254. package/_internal/components/post-block/index.ts-0acb9bb4.js +0 -101
  255. package/_internal/components/post-block/index.ts-0acb9bb4.js.map +0 -1
  256. package/_internal/components/post-block/index.ts-9b8ff90b.d.ts +0 -41
  257. package/_internal/components/progress/index.ts-2a713859.js +0 -189
  258. package/_internal/components/progress/index.ts-2a713859.js.map +0 -1
  259. package/_internal/components/progress/index.ts-dfdfa5fb.d.ts +0 -60
  260. package/_internal/components/progress-tracker/index.ts-2649f756.js +0 -312
  261. package/_internal/components/progress-tracker/index.ts-2649f756.js.map +0 -1
  262. package/_internal/components/progress-tracker/index.ts-95320f32.d.ts +0 -101
  263. package/_internal/components/radio-button/index.ts-5eaab4cf.d.ts +0 -54
  264. package/_internal/components/radio-button/index.ts-b4dfb2a0.js +0 -150
  265. package/_internal/components/radio-button/index.ts-b4dfb2a0.js.map +0 -1
  266. package/_internal/components/select/index.ts-a65e3507.d.ts +0 -91
  267. package/_internal/components/select/index.ts-e8fad28b.js +0 -257
  268. package/_internal/components/select/index.ts-e8fad28b.js.map +0 -1
  269. package/_internal/components/side-navigation/index.ts-3f5f3785.d.ts +0 -60
  270. package/_internal/components/side-navigation/index.ts-c9a5fc3e.js +0 -184
  271. package/_internal/components/side-navigation/index.ts-c9a5fc3e.js.map +0 -1
  272. package/_internal/components/skeleton/index.ts-a7daefac.d.ts +0 -75
  273. package/_internal/components/skeleton/index.ts-ffc995af.js +0 -179
  274. package/_internal/components/skeleton/index.ts-ffc995af.js.map +0 -1
  275. package/_internal/components/slider/index.ts-24a0d598.d.ts +0 -52
  276. package/_internal/components/slider/index.ts-72aadf4c.js +0 -308
  277. package/_internal/components/slider/index.ts-72aadf4c.js.map +0 -1
  278. package/_internal/components/slideshow/index.ts-c99f2892.js +0 -151
  279. package/_internal/components/slideshow/index.ts-c99f2892.js.map +0 -1
  280. package/_internal/components/slideshow/index.ts-e49462c6.d.ts +0 -25
  281. package/_internal/components/switch/index.ts-207ba52b.d.ts +0 -34
  282. package/_internal/components/switch/index.ts-542e6eaf.js +0 -115
  283. package/_internal/components/switch/index.ts-542e6eaf.js.map +0 -1
  284. package/_internal/components/table/index.ts-905ce390.js +0 -310
  285. package/_internal/components/table/index.ts-905ce390.js.map +0 -1
  286. package/_internal/components/table/index.ts-c4f39b2d.d.ts +0 -108
  287. package/_internal/components/tabs/index.ts-713119f4.js +0 -289
  288. package/_internal/components/tabs/index.ts-713119f4.js.map +0 -1
  289. package/_internal/components/tabs/index.ts-dbfc48d9.d.ts +0 -106
  290. package/_internal/components/text/index.ts-6afbe8cd.js +0 -2
  291. package/_internal/components/text/index.ts-6afbe8cd.js.map +0 -1
  292. package/_internal/components/text/index.ts-8a812048.d.ts +0 -53
  293. package/_internal/components/text-field/index.ts-92e6b3b3.d.ts +0 -77
  294. package/_internal/components/text-field/index.ts-c3be8563.js +0 -341
  295. package/_internal/components/text-field/index.ts-c3be8563.js.map +0 -1
  296. package/_internal/components/thumbnail/index.ts-16d7b403.js +0 -40
  297. package/_internal/components/thumbnail/index.ts-16d7b403.js.map +0 -1
  298. package/_internal/components/thumbnail/index.ts-1b6c0b48.d.ts +0 -8
  299. package/_internal/components/toolbar/index.ts-813b902e.js +0 -63
  300. package/_internal/components/toolbar/index.ts-813b902e.js.map +0 -1
  301. package/_internal/components/toolbar/index.ts-9f5129d1.d.ts +0 -24
  302. package/_internal/components/tooltip/index.ts-905c847c.js +0 -322
  303. package/_internal/components/tooltip/index.ts-905c847c.js.map +0 -1
  304. package/_internal/components/tooltip/index.ts-c6931e9e.d.ts +0 -35
  305. package/_internal/components/uploader/index.ts-31f21c2a.js +0 -132
  306. package/_internal/components/uploader/index.ts-31f21c2a.js.map +0 -1
  307. package/_internal/components/uploader/index.ts-c3ccba98.d.ts +0 -51
  308. package/_internal/components/user-block/index.ts-18c58e19.d.ts +0 -50
  309. package/_internal/components/user-block/index.ts-d43e5f3c.js +0 -136
  310. package/_internal/components/user-block/index.ts-d43e5f3c.js.map +0 -1
  311. package/_internal/dc3e28c8.d.ts +0 -38
  312. package/_internal/f39a1ba4.js +0 -73
  313. package/_internal/f39a1ba4.js.map +0 -1
  314. package/_internal/f3e77e3e.js +0 -22
  315. package/_internal/f3e77e3e.js.map +0 -1
  316. package/_internal/f502ab30.js +0 -78
  317. package/_internal/f502ab30.js.map +0 -1
  318. package/_internal/f52adbae.js +0 -36
  319. package/_internal/f52adbae.js.map +0 -1
  320. package/_internal/f57e1239.js +0 -205
  321. package/_internal/f57e1239.js.map +0 -1
  322. package/_internal/f5ff1aa4.d.ts +0 -47
  323. package/_internal/fb975afe.js +0 -52
  324. package/_internal/fb975afe.js.map +0 -1
  325. package/src/utils/browserDoesNotSupportHover.ts +0 -2
  326. package/src/utils/isInternetExplorer.ts +0 -15
  327. package/src/utils/userHasReducedMotion.ts +0 -7
  328. package/src/utils/utils.test.ts +0 -48
  329. /package/src/utils/{DOM → browser/DOM}/findImage.tsx +0 -0
  330. /package/src/utils/{event.ts → browser/event.ts} +0 -0
  331. /package/src/utils/{focus → browser/focus}/constants.ts +0 -0
  332. /package/src/utils/{focus → browser/focus}/getFirstAndLastFocusable.ts +0 -0
  333. /package/src/utils/{focus → browser/focus}/getFocusableElements.ts +0 -0
  334. /package/src/utils/{isFocusVisible.ts → browser/isFocusVisible.ts} +0 -0
@@ -1,784 +0,0 @@
1
- import { h as getRootClassName, S as Size, i as forwardRef, j as _objectWithoutProperties, _ as _extends, g as classNames, k as _objectSpread2 } from './1da25128.js';
2
- import React__default, { useState, useEffect, useMemo, Children, isValidElement, cloneElement, useRef } from 'react';
3
- import get from 'lodash/get';
4
- import { m as mergeRefs } from './f52adbae.js';
5
- import isEmpty from 'lodash/isEmpty';
6
- import { o as onEnterPressed, b as onButtonPressed, h as handleBasicClasses } from './f57e1239.js';
7
- import { r as renderLink } from './2c5dbb03.js';
8
- import { i as isComponent } from './f39a1ba4.js';
9
-
10
- const INITIAL_INDEX$1 = -1;
11
-
12
- /**
13
- * This custom hook provides the necessary set of functions and values to properly navigate
14
- * a list using the keyboard.
15
- *
16
- * @param items the list of items that will be navigated using the keyboard.
17
- * @param ref A reference to the element that is controlling the navigation.
18
- * @param onListItemSelected callback to be executed when the ENTER key is pressed on an item.
19
- * @param onListItemNavigated callback to be executed when the Arrow keys are pressed.
20
- * @param onEnterPressed callback to be executed when the ENTER key is pressed.
21
- * @param onBackspacePressed callback to be executed when the BACKSPACE key is pressed.
22
- * @param keepFocusAfterSelection determines whether after selecting an item, the focus should be maintained on the current target or not.
23
- * @param initialIndex where should the navigation start from. it defaults to `-1`, so the first item navigated is the item on position `0`.
24
- * @param preventTabOnEnteredValue determines whether upon TAB, if there is a value entered, the event is prevented or not.
25
- * @return useKeyboardListNavigation helpers.
26
- */
27
- const useKeyboardListNavigation = function (items, ref, onListItemSelected, onListItemNavigated, onEnterPressed, onBackspacePressed) {
28
- let keepFocusAfterSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
29
- let initialIndex = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : INITIAL_INDEX$1;
30
- let preventTabOnEnteredValue = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
31
- const [activeItemIndex, setActiveItemIndex] = useState(initialIndex);
32
-
33
- /**
34
- * This function calculates the next index in the list to be highlighted
35
- * @param key - key code pressed
36
- * @return next active index
37
- */
38
- const calculateActiveIndex = key => {
39
- switch (key) {
40
- case 'ArrowDown':
41
- return activeItemIndex + 1 < items.length ? activeItemIndex + 1 : 0;
42
- case 'ArrowUp':
43
- return activeItemIndex - 1 >= 0 ? activeItemIndex - 1 : items.length - 1;
44
- default:
45
- return initialIndex;
46
- }
47
- };
48
-
49
- /**
50
- * Resets the active index to the initial state
51
- */
52
- const resetActiveIndex = () => {
53
- setActiveItemIndex(initialIndex);
54
- };
55
-
56
- /**
57
- * Prevents the default event and stops the propagation of said event
58
- * @param evt - key pressed event
59
- */
60
- const preventDefaultAndStopPropagation = evt => {
61
- evt.preventDefault();
62
- evt.stopPropagation();
63
- };
64
-
65
- /**
66
- * Handles navigation with the arrows using the keyboard
67
- * @param evt - key pressed event
68
- */
69
- const onArrowPressed = evt => {
70
- const {
71
- key
72
- } = evt;
73
- const nextActiveIndex = calculateActiveIndex(key);
74
- setActiveItemIndex(nextActiveIndex);
75
- preventDefaultAndStopPropagation(evt);
76
- if (onListItemNavigated) {
77
- const selectedItem = items[nextActiveIndex];
78
- onListItemNavigated(selectedItem);
79
- }
80
- };
81
-
82
- /**
83
- * Handles the event when the backspace key is pressed
84
- * @param evt - key pressed event
85
- */
86
- const onBackspaceKeyPressed = evt => {
87
- if (onBackspacePressed) {
88
- onBackspacePressed(evt);
89
- }
90
- };
91
-
92
- /**
93
- * Handles when the ENTER key is pressed
94
- * @param evt - key pressed event
95
- */
96
- const onEnterKeyPressed = evt => {
97
- if (!onListItemSelected) {
98
- return;
99
- }
100
- preventDefaultAndStopPropagation(evt);
101
- if (!keepFocusAfterSelection) {
102
- evt.currentTarget.blur();
103
- }
104
- const selectedItem = items[activeItemIndex];
105
- if (selectedItem) {
106
- onListItemSelected(selectedItem);
107
- resetActiveIndex();
108
- } else if (activeItemIndex === initialIndex && onEnterPressed) {
109
- const value = get(evt, 'target.value');
110
- onEnterPressed(value);
111
- resetActiveIndex();
112
- }
113
- };
114
-
115
- /**
116
- * Handles when the TAB key is pressed
117
- * @param evt - key pressed event
118
- */
119
- const onTabKeyPressed = evt => {
120
- const value = get(evt, 'target.value');
121
- if (preventTabOnEnteredValue && value && value.length > 0) {
122
- preventDefaultAndStopPropagation(evt);
123
- }
124
- };
125
-
126
- /**
127
- * In order to make it easier in the future to add new events depending on the key
128
- * a map was created to add these handlers. In the future, if there is another event
129
- * that we need to manage depending on a specific key, we just need to add the key code
130
- * here, and as a value, the handler for said key.
131
- */
132
- const eventsForKeyPressed = {
133
- ArrowDown: onArrowPressed,
134
- Tab: onTabKeyPressed,
135
- ArrowUp: onArrowPressed,
136
- Enter: onEnterKeyPressed,
137
- Backspace: onBackspaceKeyPressed
138
- };
139
-
140
- /**
141
- * Calculates the next active item index depending on the key pressed.
142
- * If the key pressed was ENTER, the function executes the callback `onListItemSelected`
143
- * and resets the active index, since an item was selected.
144
- * @param evt - key pressed or key down event
145
- */
146
- const onKeyboardNavigation = evt => {
147
- const {
148
- key
149
- } = evt;
150
- const handler = eventsForKeyPressed[key];
151
- if (handler) {
152
- handler(evt);
153
- }
154
- };
155
- useEffect(() => {
156
- const {
157
- current: currentElement
158
- } = ref;
159
- if (!currentElement) {
160
- return undefined;
161
- }
162
- currentElement.addEventListener('focus', resetActiveIndex);
163
- currentElement.addEventListener('keydown', onKeyboardNavigation);
164
- return () => {
165
- currentElement.removeEventListener('focus', resetActiveIndex);
166
- currentElement.removeEventListener('keydown', onKeyboardNavigation);
167
- };
168
- });
169
- return {
170
- activeItemIndex,
171
- onKeyboardNavigation,
172
- resetActiveIndex,
173
- setActiveItemIndex
174
- };
175
- };
176
-
177
- const _excluded$1 = ["after", "before", "children", "className", "isHighlighted", "isSelected", "isDisabled", "linkAs", "linkProps", "linkRef", "onItemSelected", "size"];
178
-
179
- /**
180
- * Defines the props of the component.
181
- */
182
-
183
- /**
184
- * Component display name.
185
- */
186
- const COMPONENT_NAME$1 = 'ListItem';
187
-
188
- /**
189
- * Component default class name and class prefix.
190
- */
191
- const CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
192
-
193
- /**
194
- * Component default props.
195
- */
196
- const DEFAULT_PROPS$1 = {
197
- size: Size.regular
198
- };
199
-
200
- /**
201
- * Check if the list item is clickable.
202
- * @return `true` if the list item is clickable; `false` otherwise.
203
- */
204
- function isClickable(_ref) {
205
- let {
206
- linkProps,
207
- onItemSelected
208
- } = _ref;
209
- return !isEmpty(linkProps === null || linkProps === void 0 ? void 0 : linkProps.href) || !!onItemSelected;
210
- }
211
-
212
- /**
213
- * ListItem component.
214
- *
215
- * @param props Component props.
216
- * @param ref Component ref.
217
- * @return React element.
218
- */
219
- const ListItem = forwardRef((props, ref) => {
220
- const {
221
- after,
222
- before,
223
- children,
224
- className,
225
- isHighlighted,
226
- isSelected,
227
- isDisabled,
228
- linkAs,
229
- linkProps = {},
230
- linkRef,
231
- onItemSelected,
232
- size
233
- } = props,
234
- forwardedProps = _objectWithoutProperties(props, _excluded$1);
235
- const role = linkAs || linkProps.href ? 'link' : 'button';
236
- const onKeyDown = useMemo(() => {
237
- if (onItemSelected && role === 'link') return onEnterPressed(onItemSelected);
238
- if (onItemSelected && role === 'button') return onButtonPressed(onItemSelected);
239
- return undefined;
240
- }, [role, onItemSelected]);
241
- const content = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, before && /*#__PURE__*/React__default.createElement("div", {
242
- className: `${CLASSNAME$1}__before`
243
- }, before), /*#__PURE__*/React__default.createElement("div", {
244
- className: `${CLASSNAME$1}__content`
245
- }, children), after && /*#__PURE__*/React__default.createElement("div", {
246
- className: `${CLASSNAME$1}__after`
247
- }, after));
248
- return /*#__PURE__*/React__default.createElement("li", _extends({
249
- ref: ref
250
- }, forwardedProps, {
251
- className: classNames(className, handleBasicClasses({
252
- prefix: CLASSNAME$1,
253
- size
254
- }))
255
- }), isClickable({
256
- linkProps,
257
- onItemSelected
258
- }) ? ( /* Clickable list item */
259
- renderLink(_objectSpread2(_objectSpread2({
260
- linkAs,
261
- tabIndex: !isDisabled && role === 'button' ? 0 : undefined,
262
- role,
263
- 'aria-disabled': isDisabled
264
- }, linkProps), {}, {
265
- href: isDisabled ? undefined : linkProps.href,
266
- className: classNames(handleBasicClasses({
267
- prefix: `${CLASSNAME$1}__link`,
268
- isHighlighted,
269
- isSelected,
270
- isDisabled
271
- })),
272
- onClick: isDisabled ? undefined : onItemSelected,
273
- onKeyDown,
274
- ref: linkRef
275
- }), content)) :
276
- /*#__PURE__*/
277
- /* Non clickable list item */
278
- React__default.createElement("div", {
279
- className: `${CLASSNAME$1}__wrapper`
280
- }, content));
281
- });
282
- ListItem.displayName = COMPONENT_NAME$1;
283
- ListItem.className = CLASSNAME$1;
284
- ListItem.defaultProps = DEFAULT_PROPS$1;
285
-
286
- var reactIs = {exports: {}};
287
-
288
- var reactIs_production_min = {};
289
-
290
- /**
291
- * @license React
292
- * react-is.production.min.js
293
- *
294
- * Copyright (c) Facebook, Inc. and its affiliates.
295
- *
296
- * This source code is licensed under the MIT license found in the
297
- * LICENSE file in the root directory of this source tree.
298
- */
299
- var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
300
- function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;
301
- reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return !1};reactIs_production_min.isConcurrentMode=function(){return !1};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};
302
- reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};
303
- reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};reactIs_production_min.typeOf=v;
304
-
305
- var reactIs_development = {};
306
-
307
- /**
308
- * @license React
309
- * react-is.development.js
310
- *
311
- * Copyright (c) Facebook, Inc. and its affiliates.
312
- *
313
- * This source code is licensed under the MIT license found in the
314
- * LICENSE file in the root directory of this source tree.
315
- */
316
-
317
- if (process.env.NODE_ENV !== "production") {
318
- (function() {
319
-
320
- // ATTENTION
321
- // When adding new symbols to this file,
322
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
323
- // The Symbol used to tag the ReactElement-like types.
324
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
325
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
326
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
327
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
328
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
329
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
330
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
331
- var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
332
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
333
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
334
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
335
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
336
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
337
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
338
-
339
- // -----------------------------------------------------------------------------
340
-
341
- var enableScopeAPI = false; // Experimental Create Event Handle API.
342
- var enableCacheElement = false;
343
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
344
-
345
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
346
- // stuff. Intended to enable React core members to more easily debug scheduling
347
- // issues in DEV builds.
348
-
349
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
350
-
351
- var REACT_MODULE_REFERENCE;
352
-
353
- {
354
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
355
- }
356
-
357
- function isValidElementType(type) {
358
- if (typeof type === 'string' || typeof type === 'function') {
359
- return true;
360
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
361
-
362
-
363
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
364
- return true;
365
- }
366
-
367
- if (typeof type === 'object' && type !== null) {
368
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
369
- // types supported by any Flight configuration anywhere since
370
- // we don't know which Flight build this will end up being used
371
- // with.
372
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
373
- return true;
374
- }
375
- }
376
-
377
- return false;
378
- }
379
-
380
- function typeOf(object) {
381
- if (typeof object === 'object' && object !== null) {
382
- var $$typeof = object.$$typeof;
383
-
384
- switch ($$typeof) {
385
- case REACT_ELEMENT_TYPE:
386
- var type = object.type;
387
-
388
- switch (type) {
389
- case REACT_FRAGMENT_TYPE:
390
- case REACT_PROFILER_TYPE:
391
- case REACT_STRICT_MODE_TYPE:
392
- case REACT_SUSPENSE_TYPE:
393
- case REACT_SUSPENSE_LIST_TYPE:
394
- return type;
395
-
396
- default:
397
- var $$typeofType = type && type.$$typeof;
398
-
399
- switch ($$typeofType) {
400
- case REACT_SERVER_CONTEXT_TYPE:
401
- case REACT_CONTEXT_TYPE:
402
- case REACT_FORWARD_REF_TYPE:
403
- case REACT_LAZY_TYPE:
404
- case REACT_MEMO_TYPE:
405
- case REACT_PROVIDER_TYPE:
406
- return $$typeofType;
407
-
408
- default:
409
- return $$typeof;
410
- }
411
-
412
- }
413
-
414
- case REACT_PORTAL_TYPE:
415
- return $$typeof;
416
- }
417
- }
418
-
419
- return undefined;
420
- }
421
- var ContextConsumer = REACT_CONTEXT_TYPE;
422
- var ContextProvider = REACT_PROVIDER_TYPE;
423
- var Element = REACT_ELEMENT_TYPE;
424
- var ForwardRef = REACT_FORWARD_REF_TYPE;
425
- var Fragment = REACT_FRAGMENT_TYPE;
426
- var Lazy = REACT_LAZY_TYPE;
427
- var Memo = REACT_MEMO_TYPE;
428
- var Portal = REACT_PORTAL_TYPE;
429
- var Profiler = REACT_PROFILER_TYPE;
430
- var StrictMode = REACT_STRICT_MODE_TYPE;
431
- var Suspense = REACT_SUSPENSE_TYPE;
432
- var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
433
- var hasWarnedAboutDeprecatedIsAsyncMode = false;
434
- var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
435
-
436
- function isAsyncMode(object) {
437
- {
438
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
439
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
440
-
441
- console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
442
- }
443
- }
444
-
445
- return false;
446
- }
447
- function isConcurrentMode(object) {
448
- {
449
- if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
450
- hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
451
-
452
- console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
453
- }
454
- }
455
-
456
- return false;
457
- }
458
- function isContextConsumer(object) {
459
- return typeOf(object) === REACT_CONTEXT_TYPE;
460
- }
461
- function isContextProvider(object) {
462
- return typeOf(object) === REACT_PROVIDER_TYPE;
463
- }
464
- function isElement(object) {
465
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
466
- }
467
- function isForwardRef(object) {
468
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
469
- }
470
- function isFragment(object) {
471
- return typeOf(object) === REACT_FRAGMENT_TYPE;
472
- }
473
- function isLazy(object) {
474
- return typeOf(object) === REACT_LAZY_TYPE;
475
- }
476
- function isMemo(object) {
477
- return typeOf(object) === REACT_MEMO_TYPE;
478
- }
479
- function isPortal(object) {
480
- return typeOf(object) === REACT_PORTAL_TYPE;
481
- }
482
- function isProfiler(object) {
483
- return typeOf(object) === REACT_PROFILER_TYPE;
484
- }
485
- function isStrictMode(object) {
486
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
487
- }
488
- function isSuspense(object) {
489
- return typeOf(object) === REACT_SUSPENSE_TYPE;
490
- }
491
- function isSuspenseList(object) {
492
- return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
493
- }
494
-
495
- reactIs_development.ContextConsumer = ContextConsumer;
496
- reactIs_development.ContextProvider = ContextProvider;
497
- reactIs_development.Element = Element;
498
- reactIs_development.ForwardRef = ForwardRef;
499
- reactIs_development.Fragment = Fragment;
500
- reactIs_development.Lazy = Lazy;
501
- reactIs_development.Memo = Memo;
502
- reactIs_development.Portal = Portal;
503
- reactIs_development.Profiler = Profiler;
504
- reactIs_development.StrictMode = StrictMode;
505
- reactIs_development.Suspense = Suspense;
506
- reactIs_development.SuspenseList = SuspenseList;
507
- reactIs_development.isAsyncMode = isAsyncMode;
508
- reactIs_development.isConcurrentMode = isConcurrentMode;
509
- reactIs_development.isContextConsumer = isContextConsumer;
510
- reactIs_development.isContextProvider = isContextProvider;
511
- reactIs_development.isElement = isElement;
512
- reactIs_development.isForwardRef = isForwardRef;
513
- reactIs_development.isFragment = isFragment;
514
- reactIs_development.isLazy = isLazy;
515
- reactIs_development.isMemo = isMemo;
516
- reactIs_development.isPortal = isPortal;
517
- reactIs_development.isProfiler = isProfiler;
518
- reactIs_development.isStrictMode = isStrictMode;
519
- reactIs_development.isSuspense = isSuspense;
520
- reactIs_development.isSuspenseList = isSuspenseList;
521
- reactIs_development.isValidElementType = isValidElementType;
522
- reactIs_development.typeOf = typeOf;
523
- })();
524
- }
525
-
526
- if (process.env.NODE_ENV === 'production') {
527
- reactIs.exports = reactIs_production_min;
528
- } else {
529
- reactIs.exports = reactIs_development;
530
- }
531
-
532
- /**
533
- * Flatten list of react nodes removing fragments and adding keys.
534
- * based on: https://github.com/grrowl/react-keyed-flatten-children/blob/5d421644a449765ddd62b659946196b4b5d7b135/index.ts
535
- *
536
- * @param children React nodes to flatten.
537
- * @return Flattened react nodes.
538
- * @deprecated This function was used to develop keyboard navigation in the List component,
539
- * but we will replace this with a better method that does not require to hack the children inspection
540
- *
541
- * TODO: remove List keyboard navigation once we have provided alternative component (Menu, Combobox, etc.),
542
- * remove this function and then remove react-is from the dependencies
543
- */
544
- function flattenChildren(children) {
545
- function recur(nodes) {
546
- let keys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
547
- return Children.toArray(nodes).reduce((acc, node, index) => {
548
- var _get;
549
- const nodeKeys = keys.concat((_get = get(node, 'key')) !== null && _get !== void 0 ? _get : index);
550
- if (reactIs.exports.isFragment(node)) {
551
- acc.push(...recur(node.props.children, nodeKeys));
552
- } else if ( /*#__PURE__*/isValidElement(node)) {
553
- acc.push( /*#__PURE__*/cloneElement(node, {
554
- key: nodeKeys.join('.')
555
- }));
556
- } else if (typeof node === 'string' || typeof node === 'number') {
557
- acc.push(node);
558
- }
559
- return acc;
560
- }, []);
561
- }
562
- return recur(children);
563
- }
564
-
565
- const INITIAL_INDEX = -1;
566
- function onKeyboardFocus(props, handler) {
567
- let isMouseDown = false;
568
- return {
569
- onFocus(evt) {
570
- var _props$onFocus;
571
- (_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props, evt);
572
- if (!isMouseDown) {
573
- handler(evt);
574
- }
575
- },
576
- onMouseDown(evt) {
577
- var _props$onMouseDown;
578
- (_props$onMouseDown = props.onMouseDown) === null || _props$onMouseDown === void 0 ? void 0 : _props$onMouseDown.call(props, evt);
579
- isMouseDown = true;
580
- },
581
- onMouseUp(evt) {
582
- var _props$onMouseUp;
583
- (_props$onMouseUp = props.onMouseUp) === null || _props$onMouseUp === void 0 ? void 0 : _props$onMouseUp.call(props, evt);
584
- isMouseDown = false;
585
- }
586
- };
587
- }
588
- const isNavigableItem = node => {
589
- return isComponent('ListItem')(node) && isClickable(node.props) && !node.props.isDisabled;
590
- };
591
-
592
- /**
593
- * This custom hook detects clickable list item in a list and make them navigable with the keyboard.
594
- *
595
- * @param options See {@link Options}
596
- * @return See {@link Output}
597
- */
598
- const useInteractiveList = options => {
599
- const {
600
- ref,
601
- onListItemSelected,
602
- onListItemNavigated
603
- } = options;
604
- const items = useMemo(() => flattenChildren(options.items), [options.items]);
605
- const [activeItemIndex, setActiveItemIndex] = useState(INITIAL_INDEX);
606
-
607
- // Attach listeners to the list.
608
- useEffect(() => {
609
- const {
610
- current: listElement
611
- } = ref;
612
- if (!listElement) {
613
- return undefined;
614
- }
615
-
616
- /**
617
- * This function calculates the next index in the list to be active
618
- * @param index current index
619
- * @param code key code pressed
620
- * @return next index
621
- */
622
- const getNextIndex = (index, key) => {
623
- switch (key) {
624
- case 'ArrowDown':
625
- return index + 1 < items.length ? index + 1 : 0;
626
- case 'ArrowUp':
627
- return index - 1 >= 0 ? index - 1 : items.length - 1;
628
- default:
629
- return INITIAL_INDEX;
630
- }
631
- };
632
-
633
- /**
634
- * Resets the active index to the initial state
635
- */
636
- const resetActiveIndex = () => {
637
- setActiveItemIndex(INITIAL_INDEX);
638
- };
639
-
640
- /**
641
- * Handles navigation with the arrows using the keyboard
642
- * @param evt Key event
643
- */
644
- const onArrowPressed = evt => {
645
- const {
646
- key
647
- } = evt;
648
- if (key !== 'ArrowUp' && key !== 'ArrowDown') {
649
- return;
650
- }
651
- let nextIndex = activeItemIndex;
652
- let iterations = 0;
653
-
654
- // Move to next navigable item.
655
- do {
656
- nextIndex = getNextIndex(nextIndex, key);
657
- iterations += 1;
658
- } while (nextIndex !== INITIAL_INDEX && nextIndex !== activeItemIndex && !isNavigableItem(items[nextIndex]) && iterations < items.length);
659
- setActiveItemIndex(nextIndex);
660
- evt.preventDefault();
661
- evt.stopPropagation();
662
- onListItemNavigated === null || onListItemNavigated === void 0 ? void 0 : onListItemNavigated(nextIndex, get(items, [nextIndex, 'key']));
663
- };
664
-
665
- /**
666
- * Reset active list item index when focusing outside the list.
667
- * @param evt Focus out event
668
- */
669
- const onFocusOut = evt => {
670
- if (!evt.relatedTarget || !listElement.contains(evt.relatedTarget)) {
671
- resetActiveIndex();
672
- }
673
- };
674
- listElement.addEventListener('focusout', onFocusOut);
675
- listElement.addEventListener('keydown', onArrowPressed);
676
- return () => {
677
- listElement.removeEventListener('focusout', onFocusOut);
678
- listElement.removeEventListener('keydown', onArrowPressed);
679
- };
680
- }, [ref, activeItemIndex, items, onListItemNavigated]);
681
- return useMemo(() => {
682
- let hasClickableItem = false;
683
- const transformedItems = items.map((item, index) => {
684
- var _item$props$isHighlig;
685
- // Ignore if list not clickable or item is not a simple list item.
686
- if (!isNavigableItem(item)) {
687
- return item;
688
- }
689
- hasClickableItem = true;
690
- const isHighlighted = index === activeItemIndex;
691
-
692
- // Clone list item: inject ref, add tab index and active state.
693
- return /*#__PURE__*/cloneElement(item, _objectSpread2(_objectSpread2({}, item.props), {}, {
694
- isHighlighted: (_item$props$isHighlig = item.props.isHighlighted) !== null && _item$props$isHighlig !== void 0 ? _item$props$isHighlig : isHighlighted,
695
- linkRef: mergeRefs(item.props.linkRef, element => {
696
- if (isHighlighted) {
697
- element === null || element === void 0 ? void 0 : element.focus();
698
- }
699
- }),
700
- onItemSelected(evt) {
701
- var _item$props$onItemSel, _item$props;
702
- (_item$props$onItemSel = (_item$props = item.props).onItemSelected) === null || _item$props$onItemSel === void 0 ? void 0 : _item$props$onItemSel.call(_item$props);
703
- onListItemSelected === null || onListItemSelected === void 0 ? void 0 : onListItemSelected(index, item.key, evt);
704
- }
705
- }, onKeyboardFocus(item.props, () => {
706
- setActiveItemIndex(index);
707
- })));
708
- });
709
- return {
710
- items: transformedItems,
711
- hasClickableItem
712
- };
713
- }, [items, activeItemIndex, onListItemSelected]);
714
- };
715
-
716
- const _excluded = ["children", "className", "isClickable", "itemPadding", "onListItemSelected", "tabIndex"];
717
-
718
- /**
719
- * Defines the props of the component.
720
- */
721
-
722
- /**
723
- * Component display name.
724
- */
725
- const COMPONENT_NAME = 'List';
726
-
727
- /**
728
- * Component default class name and class prefix.
729
- */
730
- const CLASSNAME = getRootClassName(COMPONENT_NAME);
731
-
732
- /**
733
- * Component default props.
734
- */
735
- const DEFAULT_PROPS = {
736
- tabIndex: -1
737
- };
738
-
739
- /* eslint-disable jsx-a11y/no-noninteractive-tabindex */
740
- /**
741
- * List component.
742
- *
743
- * @param props Component props.
744
- * @param ref Component ref.
745
- * @return React element.
746
- */
747
- const InternalList = forwardRef((props, ref) => {
748
- const {
749
- children,
750
- className,
751
- isClickable,
752
- itemPadding,
753
- onListItemSelected,
754
- tabIndex
755
- } = props,
756
- forwardedProps = _objectWithoutProperties(props, _excluded);
757
- const listElementRef = useRef(null);
758
- const {
759
- items,
760
- hasClickableItem
761
- } = useInteractiveList({
762
- items: children,
763
- ref: listElementRef,
764
- onListItemSelected
765
- });
766
- const clickable = hasClickableItem || isClickable;
767
- return /*#__PURE__*/React__default.createElement("ul", _extends({}, forwardedProps, {
768
- className: classNames(className, handleBasicClasses({
769
- prefix: CLASSNAME,
770
- itemPadding: itemPadding !== null && itemPadding !== void 0 ? itemPadding : clickable ? Size.big : undefined
771
- })),
772
- tabIndex: tabIndex,
773
- ref: mergeRefs(ref, listElementRef)
774
- }), items);
775
- });
776
- InternalList.displayName = COMPONENT_NAME;
777
- InternalList.className = CLASSNAME;
778
- InternalList.defaultProps = DEFAULT_PROPS;
779
- const List = Object.assign(InternalList, {
780
- useKeyboardListNavigation
781
- });
782
-
783
- export { List as L, ListItem as a, isClickable as i };
784
- //# sourceMappingURL=bc28d510.js.map