@lumx/react 4.17.1-alpha.2 → 4.17.1-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (748) hide show
  1. package/_internal/_virtual/_rolldown/runtime.js +34 -0
  2. package/_internal/components/alert-dialog/AlertDialog.d.ts +30 -0
  3. package/_internal/components/alert-dialog/AlertDialog.js +49 -0
  4. package/_internal/components/alert-dialog/index.d.ts +1 -0
  5. package/_internal/components/autocomplete/Autocomplete.d.ts +181 -0
  6. package/_internal/components/autocomplete/Autocomplete.js +92 -0
  7. package/_internal/components/autocomplete/AutocompleteMultiple.d.ts +28 -0
  8. package/_internal/components/autocomplete/AutocompleteMultiple.js +95 -0
  9. package/_internal/components/autocomplete/index.d.ts +2 -0
  10. package/_internal/components/avatar/Avatar.d.ts +39 -0
  11. package/_internal/components/avatar/Avatar.js +46 -0
  12. package/_internal/components/avatar/index.d.ts +2 -0
  13. package/_internal/components/badge/Badge.d.ts +24 -0
  14. package/_internal/components/badge/Badge.js +21 -0
  15. package/_internal/components/badge/BadgeWrapper.d.ts +16 -0
  16. package/_internal/components/badge/BadgeWrapper.js +13 -0
  17. package/_internal/components/badge/index.d.ts +2 -0
  18. package/_internal/components/button/Button.d.ts +22 -0
  19. package/_internal/components/button/Button.js +49 -0
  20. package/_internal/components/button/ButtonGroup.d.ts +17 -0
  21. package/_internal/components/button/ButtonGroup.js +21 -0
  22. package/_internal/components/button/ButtonRoot.d.ts +1 -0
  23. package/_internal/components/button/IconButton.d.ts +30 -0
  24. package/_internal/components/button/IconButton.js +40 -0
  25. package/_internal/components/button/index.d.ts +5 -0
  26. package/_internal/components/checkbox/Checkbox.d.ts +24 -0
  27. package/_internal/components/checkbox/Checkbox.js +58 -0
  28. package/_internal/components/checkbox/index.d.ts +1 -0
  29. package/_internal/components/chip/Chip.d.ts +34 -0
  30. package/_internal/components/chip/Chip.js +43 -0
  31. package/_internal/components/chip/ChipGroup.d.ts +20 -0
  32. package/_internal/components/chip/ChipGroup.js +25 -0
  33. package/_internal/components/chip/SelectionChipGroup.d.ts +43 -0
  34. package/_internal/components/chip/SelectionChipGroup.js +78 -0
  35. package/_internal/components/chip/index.d.ts +3 -0
  36. package/_internal/components/combobox/ComboboxButton.d.ts +17 -0
  37. package/_internal/components/combobox/ComboboxButton.js +59 -0
  38. package/_internal/components/combobox/ComboboxInput.d.ts +19 -0
  39. package/_internal/components/combobox/ComboboxInput.js +79 -0
  40. package/_internal/components/combobox/ComboboxList.d.ts +8 -0
  41. package/_internal/components/combobox/ComboboxList.js +64 -0
  42. package/_internal/components/combobox/ComboboxOption.d.ts +36 -0
  43. package/_internal/components/combobox/ComboboxOption.js +76 -0
  44. package/_internal/components/combobox/ComboboxOptionAction.d.ts +18 -0
  45. package/_internal/components/combobox/ComboboxOptionAction.js +38 -0
  46. package/_internal/components/combobox/ComboboxOptionMoreInfo.d.ts +19 -0
  47. package/_internal/components/combobox/ComboboxOptionMoreInfo.js +49 -0
  48. package/_internal/components/combobox/ComboboxOptionSkeleton.d.ts +19 -0
  49. package/_internal/components/combobox/ComboboxOptionSkeleton.js +38 -0
  50. package/_internal/components/combobox/ComboboxPopover.d.ts +18 -0
  51. package/_internal/components/combobox/ComboboxPopover.js +32 -0
  52. package/_internal/components/combobox/ComboboxProvider.d.ts +27 -0
  53. package/_internal/components/combobox/ComboboxProvider.js +41 -0
  54. package/_internal/components/combobox/ComboboxSection.d.ts +15 -0
  55. package/_internal/components/combobox/ComboboxSection.js +47 -0
  56. package/_internal/components/combobox/ComboboxState.d.ts +14 -0
  57. package/_internal/components/combobox/ComboboxState.js +70 -0
  58. package/_internal/components/combobox/context/ComboboxContext.js +15 -0
  59. package/_internal/components/combobox/context/ComboboxListContext.js +12 -0
  60. package/_internal/components/combobox/context/ComboboxOptionContext.js +16 -0
  61. package/_internal/components/combobox/context/useComboboxEvent.d.ts +10 -0
  62. package/_internal/components/combobox/context/useComboboxEvent.js +17 -0
  63. package/_internal/components/combobox/context/useComboboxOpen.js +13 -0
  64. package/_internal/components/combobox/index.d.ts +73 -0
  65. package/_internal/components/combobox/index.js +47 -0
  66. package/_internal/components/combobox/wrapRenderOption.js +38 -0
  67. package/_internal/components/comment-block/CommentBlock.d.ts +68 -0
  68. package/_internal/components/comment-block/CommentBlock.js +109 -0
  69. package/_internal/components/comment-block/index.d.ts +1 -0
  70. package/_internal/components/date-picker/DatePicker.d.ts +14 -0
  71. package/_internal/components/date-picker/DatePicker.js +45 -0
  72. package/_internal/components/date-picker/DatePickerControlled.d.ts +26 -0
  73. package/_internal/components/date-picker/DatePickerControlled.js +177 -0
  74. package/_internal/components/date-picker/DatePickerField.d.ts +38 -0
  75. package/_internal/components/date-picker/DatePickerField.js +83 -0
  76. package/_internal/components/date-picker/constants.js +11 -0
  77. package/_internal/components/date-picker/index.d.ts +4 -0
  78. package/_internal/components/date-picker/types.d.ts +30 -0
  79. package/_internal/components/dialog/Dialog.d.ts +47 -0
  80. package/_internal/components/dialog/Dialog.js +110 -0
  81. package/_internal/components/dialog/index.d.ts +2 -0
  82. package/_internal/components/divider/Divider.d.ts +20 -0
  83. package/_internal/components/divider/Divider.js +30 -0
  84. package/_internal/components/divider/index.d.ts +1 -0
  85. package/_internal/components/drag-handle/DragHandle.d.ts +20 -0
  86. package/_internal/components/drag-handle/DragHandle.js +29 -0
  87. package/_internal/components/drag-handle/index.d.ts +1 -0
  88. package/_internal/components/dropdown/Dropdown.d.ts +89 -0
  89. package/_internal/components/dropdown/Dropdown.js +89 -0
  90. package/_internal/components/dropdown/index.d.ts +1 -0
  91. package/_internal/components/expansion-panel/ExpansionPanel.d.ts +31 -0
  92. package/_internal/components/expansion-panel/ExpansionPanel.js +80 -0
  93. package/_internal/components/expansion-panel/index.d.ts +1 -0
  94. package/_internal/components/flag/Flag.d.ts +20 -0
  95. package/_internal/components/flag/Flag.js +28 -0
  96. package/_internal/components/flag/index.d.ts +1 -0
  97. package/_internal/components/flex-box/FlexBox.d.ts +25 -0
  98. package/_internal/components/flex-box/FlexBox.js +24 -0
  99. package/_internal/components/flex-box/index.d.ts +2 -0
  100. package/_internal/components/generic-block/GenericBlock.d.ts +51 -0
  101. package/_internal/components/generic-block/GenericBlock.js +90 -0
  102. package/_internal/components/generic-block/index.d.ts +2 -0
  103. package/_internal/components/grid/Grid.d.ts +33 -0
  104. package/_internal/components/grid/Grid.js +48 -0
  105. package/_internal/components/grid/GridItem.d.ts +29 -0
  106. package/_internal/components/grid/GridItem.js +37 -0
  107. package/_internal/components/grid/index.d.ts +2 -0
  108. package/_internal/components/grid-column/GridColumn.d.ts +24 -0
  109. package/_internal/components/grid-column/GridColumn.js +27 -0
  110. package/_internal/components/grid-column/index.d.ts +2 -0
  111. package/_internal/components/heading/Heading.d.ts +14 -0
  112. package/_internal/components/heading/Heading.js +25 -0
  113. package/_internal/components/heading/HeadingLevelProvider.d.ts +15 -0
  114. package/_internal/components/heading/HeadingLevelProvider.js +22 -0
  115. package/_internal/components/heading/context.js +6 -0
  116. package/_internal/components/heading/index.d.ts +3 -0
  117. package/_internal/components/heading/useHeadingLevel.d.ts +7 -0
  118. package/_internal/components/heading/useHeadingLevel.js +12 -0
  119. package/_internal/components/icon/Icon.d.ts +17 -0
  120. package/_internal/components/icon/Icon.js +24 -0
  121. package/_internal/components/icon/index.d.ts +2 -0
  122. package/_internal/components/image-block/ImageBlock.d.ts +29 -0
  123. package/_internal/components/image-block/ImageBlock.js +30 -0
  124. package/_internal/components/image-block/ImageCaption.d.ts +13 -0
  125. package/_internal/components/image-block/ImageCaption.js +18 -0
  126. package/_internal/components/image-block/index.d.ts +2 -0
  127. package/_internal/components/image-lightbox/ImageLightbox.d.ts +17 -0
  128. package/_internal/components/image-lightbox/ImageLightbox.js +66 -0
  129. package/_internal/components/image-lightbox/constants.js +11 -0
  130. package/_internal/components/image-lightbox/index.d.ts +2 -0
  131. package/_internal/components/image-lightbox/internal/ImageSlide.js +81 -0
  132. package/_internal/components/image-lightbox/internal/ImageSlideshow.js +112 -0
  133. package/_internal/components/image-lightbox/internal/useAnimateScroll.js +40 -0
  134. package/_internal/components/image-lightbox/internal/usePointerZoom.js +98 -0
  135. package/_internal/components/image-lightbox/types.d.ts +33 -0
  136. package/_internal/components/image-lightbox/useImageLightbox.d.ts +29 -0
  137. package/_internal/components/image-lightbox/useImageLightbox.js +102 -0
  138. package/_internal/components/inline-list/InlineList.d.ts +25 -0
  139. package/_internal/components/inline-list/InlineList.js +24 -0
  140. package/_internal/components/inline-list/index.d.ts +1 -0
  141. package/_internal/components/input-helper/InputHelper.d.ts +17 -0
  142. package/_internal/components/input-helper/InputHelper.js +25 -0
  143. package/_internal/components/input-helper/index.d.ts +1 -0
  144. package/_internal/components/input-label/InputLabel.d.ts +17 -0
  145. package/_internal/components/input-label/InputLabel.js +25 -0
  146. package/_internal/components/input-label/index.d.ts +1 -0
  147. package/_internal/components/lightbox/Lightbox.d.ts +33 -0
  148. package/_internal/components/lightbox/Lightbox.js +69 -0
  149. package/_internal/components/lightbox/index.d.ts +1 -0
  150. package/_internal/components/link/Link.d.ts +35 -0
  151. package/_internal/components/link/Link.js +45 -0
  152. package/_internal/components/link/index.d.ts +1 -0
  153. package/_internal/components/link-preview/LinkPreview.d.ts +25 -0
  154. package/_internal/components/link-preview/LinkPreview.js +31 -0
  155. package/_internal/components/link-preview/index.d.ts +1 -0
  156. package/_internal/components/list/List.d.ts +27 -0
  157. package/_internal/components/list/List.js +28 -0
  158. package/_internal/components/list/ListDivider.d.ts +21 -0
  159. package/_internal/components/list/ListDivider.js +22 -0
  160. package/_internal/components/list/ListItem.d.ts +47 -0
  161. package/_internal/components/list/ListItem.js +39 -0
  162. package/_internal/components/list/ListItemAction.js +30 -0
  163. package/_internal/components/list/ListSection.d.ts +24 -0
  164. package/_internal/components/list/ListSection.js +26 -0
  165. package/_internal/components/list/ListSubheader.d.ts +23 -0
  166. package/_internal/components/list/ListSubheader.js +33 -0
  167. package/_internal/components/list/index.d.ts +6 -0
  168. package/_internal/components/menu-button/MenuButton.d.ts +34 -0
  169. package/_internal/components/menu-button/MenuButton.js +48 -0
  170. package/_internal/components/menu-button/MenuItem.d.ts +46 -0
  171. package/_internal/components/menu-button/MenuItem.js +62 -0
  172. package/_internal/components/menu-button/MenuList.js +39 -0
  173. package/_internal/components/menu-button/MenuPopover.d.ts +13 -0
  174. package/_internal/components/menu-button/MenuPopover.js +31 -0
  175. package/_internal/components/menu-button/MenuProvider.js +45 -0
  176. package/_internal/components/menu-button/MenuTrigger.js +40 -0
  177. package/_internal/components/menu-button/context/MenuContext.js +11 -0
  178. package/_internal/components/menu-button/context/useMenuEvent.js +21 -0
  179. package/_internal/components/menu-button/context/useMenuOpen.js +15 -0
  180. package/_internal/components/menu-button/index.d.ts +3 -0
  181. package/_internal/components/message/Message.d.ts +17 -0
  182. package/_internal/components/message/Message.js +20 -0
  183. package/_internal/components/message/index.d.ts +1 -0
  184. package/_internal/components/mosaic/Mosaic.d.ts +25 -0
  185. package/_internal/components/mosaic/Mosaic.js +29 -0
  186. package/_internal/components/mosaic/index.d.ts +1 -0
  187. package/_internal/components/navigation/Navigation.d.ts +18 -0
  188. package/_internal/components/navigation/Navigation.js +51 -0
  189. package/_internal/components/navigation/NavigationItem.d.ts +23 -0
  190. package/_internal/components/navigation/NavigationItem.js +52 -0
  191. package/_internal/components/navigation/NavigationSection.d.ts +15 -0
  192. package/_internal/components/navigation/NavigationSection.js +100 -0
  193. package/_internal/components/navigation/constants.js +11 -0
  194. package/_internal/components/navigation/context.js +6 -0
  195. package/_internal/components/navigation/index.d.ts +1 -0
  196. package/_internal/components/notification/Notification.d.ts +36 -0
  197. package/_internal/components/notification/Notification.js +97 -0
  198. package/_internal/components/notification/constants.js +28 -0
  199. package/_internal/components/notification/index.d.ts +1 -0
  200. package/_internal/components/popover/Popover.d.ts +43 -0
  201. package/_internal/components/popover/Popover.js +86 -0
  202. package/_internal/components/popover/index.d.ts +3 -0
  203. package/_internal/components/popover/usePopoverStyle.js +82 -0
  204. package/_internal/components/popover-dialog/PopoverDialog.d.ts +22 -0
  205. package/_internal/components/popover-dialog/PopoverDialog.js +42 -0
  206. package/_internal/components/popover-dialog/index.d.ts +1 -0
  207. package/_internal/components/post-block/PostBlock.d.ts +44 -0
  208. package/_internal/components/post-block/PostBlock.js +92 -0
  209. package/_internal/components/post-block/index.d.ts +1 -0
  210. package/_internal/components/progress/Progress.d.ts +30 -0
  211. package/_internal/components/progress/Progress.js +54 -0
  212. package/_internal/components/progress/ProgressCircular.d.ts +20 -0
  213. package/_internal/components/progress/ProgressCircular.js +31 -0
  214. package/_internal/components/progress/ProgressLinear.d.ts +20 -0
  215. package/_internal/components/progress/ProgressLinear.js +26 -0
  216. package/_internal/components/progress/index.d.ts +4 -0
  217. package/_internal/components/progress-tracker/ProgressTracker.d.ts +26 -0
  218. package/_internal/components/progress-tracker/ProgressTracker.js +75 -0
  219. package/_internal/components/progress-tracker/ProgressTrackerProvider.d.ts +29 -0
  220. package/_internal/components/progress-tracker/ProgressTrackerProvider.js +45 -0
  221. package/_internal/components/progress-tracker/ProgressTrackerStep.d.ts +37 -0
  222. package/_internal/components/progress-tracker/ProgressTrackerStep.js +107 -0
  223. package/_internal/components/progress-tracker/ProgressTrackerStepPanel.d.ts +27 -0
  224. package/_internal/components/progress-tracker/ProgressTrackerStepPanel.js +47 -0
  225. package/_internal/components/progress-tracker/index.d.ts +4 -0
  226. package/_internal/components/radio-button/RadioButton.d.ts +23 -0
  227. package/_internal/components/radio-button/RadioButton.js +50 -0
  228. package/_internal/components/radio-button/RadioGroup.d.ts +20 -0
  229. package/_internal/components/radio-button/RadioGroup.js +23 -0
  230. package/_internal/components/radio-button/index.d.ts +2 -0
  231. package/_internal/components/select/Select.d.ts +20 -0
  232. package/_internal/components/select/Select.js +130 -0
  233. package/_internal/components/select/SelectMultiple.d.ts +24 -0
  234. package/_internal/components/select/SelectMultiple.js +128 -0
  235. package/_internal/components/select/WithSelectContext.js +96 -0
  236. package/_internal/components/select/constants.d.ts +59 -0
  237. package/_internal/components/select/constants.js +10 -0
  238. package/_internal/components/select/index.d.ts +3 -0
  239. package/_internal/components/select-button/SelectButton.d.ts +93 -0
  240. package/_internal/components/select-button/SelectButton.js +73 -0
  241. package/_internal/components/select-button/index.d.ts +18 -0
  242. package/_internal/components/select-button/index.js +11 -0
  243. package/_internal/components/select-text-field/SelectTextField.d.ts +80 -0
  244. package/_internal/components/select-text-field/SelectTextField.js +167 -0
  245. package/_internal/components/select-text-field/index.d.ts +33 -0
  246. package/_internal/components/select-text-field/index.js +24 -0
  247. package/_internal/components/side-navigation/SideNavigation.d.ts +22 -0
  248. package/_internal/components/side-navigation/SideNavigation.js +39 -0
  249. package/_internal/components/side-navigation/SideNavigationItem.d.ts +44 -0
  250. package/_internal/components/side-navigation/SideNavigationItem.js +111 -0
  251. package/_internal/components/side-navigation/index.d.ts +2 -0
  252. package/_internal/components/skeleton/SkeletonCircle.d.ts +19 -0
  253. package/_internal/components/skeleton/SkeletonCircle.js +30 -0
  254. package/_internal/components/skeleton/SkeletonRectangle.d.ts +19 -0
  255. package/_internal/components/skeleton/SkeletonRectangle.js +33 -0
  256. package/_internal/components/skeleton/SkeletonTypography.d.ts +19 -0
  257. package/_internal/components/skeleton/SkeletonTypography.js +31 -0
  258. package/_internal/components/skeleton/index.d.ts +4 -0
  259. package/_internal/components/slider/Slider.d.ts +44 -0
  260. package/_internal/components/slider/Slider.js +232 -0
  261. package/_internal/components/slider/index.d.ts +2 -0
  262. package/_internal/components/slideshow/Slides.d.ts +49 -0
  263. package/_internal/components/slideshow/Slides.js +86 -0
  264. package/_internal/components/slideshow/Slideshow.d.ts +35 -0
  265. package/_internal/components/slideshow/Slideshow.js +104 -0
  266. package/_internal/components/slideshow/SlideshowControls.d.ts +65 -0
  267. package/_internal/components/slideshow/SlideshowControls.js +139 -0
  268. package/_internal/components/slideshow/SlideshowItem.d.ts +23 -0
  269. package/_internal/components/slideshow/SlideshowItem.js +32 -0
  270. package/_internal/components/slideshow/SlideshowItemGroup.js +44 -0
  271. package/_internal/components/slideshow/constants.d.ts +13 -0
  272. package/_internal/components/slideshow/constants.js +16 -0
  273. package/_internal/components/slideshow/index.d.ts +4 -0
  274. package/_internal/components/slideshow/usePaginationVisibleRange.js +41 -0
  275. package/_internal/components/slideshow/useSlideFocusManagement.js +64 -0
  276. package/_internal/components/slideshow/useSlideScroll.js +57 -0
  277. package/_internal/components/slideshow/useSwipeNavigate.js +21 -0
  278. package/_internal/components/switch/Switch.d.ts +24 -0
  279. package/_internal/components/switch/Switch.js +54 -0
  280. package/_internal/components/switch/index.d.ts +1 -0
  281. package/_internal/components/table/Table.d.ts +20 -0
  282. package/_internal/components/table/Table.js +28 -0
  283. package/_internal/components/table/TableBody.d.ts +20 -0
  284. package/_internal/components/table/TableBody.js +22 -0
  285. package/_internal/components/table/TableCell.d.ts +23 -0
  286. package/_internal/components/table/TableCell.js +23 -0
  287. package/_internal/components/table/TableHeader.d.ts +20 -0
  288. package/_internal/components/table/TableHeader.js +23 -0
  289. package/_internal/components/table/TableRow.d.ts +23 -0
  290. package/_internal/components/table/TableRow.js +28 -0
  291. package/_internal/components/table/index.d.ts +6 -0
  292. package/_internal/components/tabs/Tab.d.ts +39 -0
  293. package/_internal/components/tabs/Tab.js +39 -0
  294. package/_internal/components/tabs/TabList.d.ts +22 -0
  295. package/_internal/components/tabs/TabList.js +37 -0
  296. package/_internal/components/tabs/TabPanel.d.ts +25 -0
  297. package/_internal/components/tabs/TabPanel.js +30 -0
  298. package/_internal/components/tabs/TabProvider.d.ts +27 -0
  299. package/_internal/components/tabs/TabProvider.js +51 -0
  300. package/_internal/components/tabs/index.d.ts +5 -0
  301. package/_internal/components/tabs/state.js +55 -0
  302. package/_internal/components/text/Text.d.ts +17 -0
  303. package/_internal/components/text/Text.js +33 -0
  304. package/_internal/components/text/index.d.ts +1 -0
  305. package/_internal/components/text-field/RawInputText.d.ts +20 -0
  306. package/_internal/components/text-field/RawInputText.js +23 -0
  307. package/_internal/components/text-field/RawInputTextarea.d.ts +21 -0
  308. package/_internal/components/text-field/RawInputTextarea.js +34 -0
  309. package/_internal/components/text-field/TextField.d.ts +46 -0
  310. package/_internal/components/text-field/TextField.js +122 -0
  311. package/_internal/components/text-field/index.d.ts +3 -0
  312. package/_internal/components/text-field/useFitRowsToContent.js +27 -0
  313. package/_internal/components/thumbnail/Thumbnail.d.ts +31 -0
  314. package/_internal/components/thumbnail/Thumbnail.js +45 -0
  315. package/_internal/components/thumbnail/index.d.ts +3 -0
  316. package/_internal/components/thumbnail/types.d.ts +49 -0
  317. package/_internal/components/thumbnail/types.js +23 -0
  318. package/_internal/components/thumbnail/useFocusPointStyle.d.ts +15 -0
  319. package/_internal/components/thumbnail/useFocusPointStyle.js +53 -0
  320. package/_internal/components/thumbnail/useImageLoad.js +23 -0
  321. package/_internal/components/time-picker-field/TimePickerField.d.ts +38 -0
  322. package/_internal/components/time-picker-field/TimePickerField.js +103 -0
  323. package/_internal/components/time-picker-field/index.d.ts +2 -0
  324. package/_internal/components/toolbar/Toolbar.d.ts +28 -0
  325. package/_internal/components/toolbar/Toolbar.js +21 -0
  326. package/_internal/components/toolbar/index.d.ts +1 -0
  327. package/_internal/components/tooltip/Tooltip.d.ts +23 -0
  328. package/_internal/components/tooltip/Tooltip.js +69 -0
  329. package/_internal/components/tooltip/context.js +15 -0
  330. package/_internal/components/tooltip/index.d.ts +2 -0
  331. package/_internal/components/tooltip/useInjectTooltipRef.js +43 -0
  332. package/_internal/components/tooltip/useTooltipOpen.js +36 -0
  333. package/_internal/components/uploader/Uploader.d.ts +29 -0
  334. package/_internal/components/uploader/Uploader.js +71 -0
  335. package/_internal/components/uploader/index.d.ts +2 -0
  336. package/_internal/components/user-block/UserBlock.d.ts +33 -0
  337. package/_internal/components/user-block/UserBlock.js +88 -0
  338. package/_internal/components/user-block/index.d.ts +2 -0
  339. package/_internal/constants.js +2 -0
  340. package/_internal/hooks/useBooleanState.js +13 -0
  341. package/_internal/hooks/useCallbackOnEscape.js +30 -0
  342. package/_internal/hooks/useChipGroupNavigation.d.ts +12 -0
  343. package/_internal/hooks/useChipGroupNavigation.js +49 -0
  344. package/_internal/hooks/useClickAway.d.ts +16 -0
  345. package/_internal/hooks/useClickAway.js +20 -0
  346. package/_internal/hooks/useDisableBodyScroll.js +25 -0
  347. package/_internal/hooks/useEventCallback.js +21 -0
  348. package/_internal/hooks/useFocus.js +19 -0
  349. package/_internal/hooks/useFocusTrap.js +28 -0
  350. package/_internal/hooks/useFocusWithin.js +27 -0
  351. package/_internal/hooks/useId.js +16 -0
  352. package/_internal/hooks/useImageSize.js +19 -0
  353. package/_internal/hooks/useInfiniteScroll.js +36 -0
  354. package/_internal/hooks/useIntersectionObserver.js +24 -0
  355. package/_internal/hooks/useInterval.js +26 -0
  356. package/_internal/hooks/useIsomorphicLayoutEffect.js +9 -0
  357. package/_internal/hooks/useKeyboardListNavigation.d.ts +17 -0
  358. package/_internal/hooks/useKeyboardListNavigation.js +136 -0
  359. package/_internal/hooks/useListenFocus.js +23 -0
  360. package/_internal/hooks/useOverflowTooltipLabel.js +27 -0
  361. package/_internal/hooks/usePreviousValue.js +15 -0
  362. package/_internal/hooks/useRestoreFocusOnClose.js +47 -0
  363. package/_internal/hooks/useRovingTabIndexContainer.js +31 -0
  364. package/_internal/hooks/useSizeOnWindowResize.js +26 -0
  365. package/_internal/hooks/useSlideshowControls.d.ts +63 -0
  366. package/_internal/hooks/useSlideshowControls.js +105 -0
  367. package/_internal/hooks/useStopPropagation.js +18 -0
  368. package/_internal/hooks/useTransitionVisibility.js +41 -0
  369. package/_internal/node_modules/@floating-ui/core/dist/floating-ui.core.js +536 -0
  370. package/_internal/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +528 -0
  371. package/_internal/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +209 -0
  372. package/_internal/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +144 -0
  373. package/_internal/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +135 -0
  374. package/_internal/node_modules/body-scroll-lock/lib/bodyScrollLock.esm.js +114 -0
  375. package/_internal/node_modules/classnames/index.js +45 -0
  376. package/_internal/packages/lumx-core/src/js/components/AlertDialog/index.d.ts +15 -0
  377. package/_internal/packages/lumx-core/src/js/components/AlertDialog/index.js +116 -0
  378. package/_internal/packages/lumx-core/src/js/components/Avatar/index.d.ts +27 -0
  379. package/_internal/packages/lumx-core/src/js/components/Avatar/index.js +49 -0
  380. package/_internal/packages/lumx-core/src/js/components/Badge/BadgeWrapper.d.ts +14 -0
  381. package/_internal/packages/lumx-core/src/js/components/Badge/BadgeWrapper.js +21 -0
  382. package/_internal/packages/lumx-core/src/js/components/Badge/index.d.ts +18 -0
  383. package/_internal/packages/lumx-core/src/js/components/Badge/index.js +38 -0
  384. package/_internal/packages/lumx-core/src/js/components/Button/Button.d.ts +41 -0
  385. package/_internal/packages/lumx-core/src/js/components/Button/Button.js +46 -0
  386. package/_internal/packages/lumx-core/src/js/components/Button/ButtonGroup.d.ts +17 -0
  387. package/_internal/packages/lumx-core/src/js/components/Button/ButtonGroup.js +34 -0
  388. package/_internal/packages/lumx-core/src/js/components/Button/ButtonRoot.d.ts +46 -0
  389. package/_internal/packages/lumx-core/src/js/components/Button/ButtonRoot.js +75 -0
  390. package/_internal/packages/lumx-core/src/js/components/Button/IconButton.d.ts +24 -0
  391. package/_internal/packages/lumx-core/src/js/components/Button/IconButton.js +46 -0
  392. package/_internal/packages/lumx-core/src/js/components/Checkbox/index.d.ts +35 -0
  393. package/_internal/packages/lumx-core/src/js/components/Checkbox/index.js +83 -0
  394. package/_internal/packages/lumx-core/src/js/components/Chip/ChipGroup.d.ts +21 -0
  395. package/_internal/packages/lumx-core/src/js/components/Chip/ChipGroup.js +32 -0
  396. package/_internal/packages/lumx-core/src/js/components/Chip/SelectionChipGroup.d.ts +29 -0
  397. package/_internal/packages/lumx-core/src/js/components/Chip/SelectionChipGroup.js +66 -0
  398. package/_internal/packages/lumx-core/src/js/components/Chip/index.d.ts +63 -0
  399. package/_internal/packages/lumx-core/src/js/components/Chip/index.js +78 -0
  400. package/_internal/packages/lumx-core/src/js/components/Chip/setupSelectionChipGroupEvents.js +97 -0
  401. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxButton.d.ts +34 -0
  402. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxButton.js +51 -0
  403. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxInput.d.ts +34 -0
  404. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxInput.js +56 -0
  405. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxList.d.ts +36 -0
  406. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxList.js +34 -0
  407. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxOption.d.ts +53 -0
  408. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxOption.js +73 -0
  409. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxOptionAction.js +33 -0
  410. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxOptionMoreInfo.d.ts +29 -0
  411. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxOptionMoreInfo.js +53 -0
  412. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxOptionSkeleton.d.ts +32 -0
  413. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxOptionSkeleton.js +44 -0
  414. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxPopover.js +47 -0
  415. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxSection.d.ts +36 -0
  416. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxSection.js +36 -0
  417. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxState.d.ts +64 -0
  418. package/_internal/packages/lumx-core/src/js/components/Combobox/ComboboxState.js +86 -0
  419. package/_internal/packages/lumx-core/src/js/components/Combobox/constants.js +4 -0
  420. package/_internal/packages/lumx-core/src/js/components/Combobox/setupCombobox.js +350 -0
  421. package/_internal/packages/lumx-core/src/js/components/Combobox/setupComboboxButton.js +84 -0
  422. package/_internal/packages/lumx-core/src/js/components/Combobox/setupComboboxInput.js +95 -0
  423. package/_internal/packages/lumx-core/src/js/components/Combobox/setupListbox.js +84 -0
  424. package/_internal/packages/lumx-core/src/js/components/Combobox/subscribeComboboxState.js +43 -0
  425. package/_internal/packages/lumx-core/src/js/components/Combobox/types.d.ts +59 -0
  426. package/_internal/packages/lumx-core/src/js/components/Combobox/utils.js +63 -0
  427. package/_internal/packages/lumx-core/src/js/components/Dialog/index.d.ts +20 -0
  428. package/_internal/packages/lumx-core/src/js/components/Dialog/index.js +93 -0
  429. package/_internal/packages/lumx-core/src/js/components/Divider/index.d.ts +13 -0
  430. package/_internal/packages/lumx-core/src/js/components/Divider/index.js +29 -0
  431. package/_internal/packages/lumx-core/src/js/components/DragHandle/index.d.ts +13 -0
  432. package/_internal/packages/lumx-core/src/js/components/DragHandle/index.js +37 -0
  433. package/_internal/packages/lumx-core/src/js/components/ExpansionPanel/index.d.ts +51 -0
  434. package/_internal/packages/lumx-core/src/js/components/ExpansionPanel/index.js +92 -0
  435. package/_internal/packages/lumx-core/src/js/components/Flag/index.d.ts +24 -0
  436. package/_internal/packages/lumx-core/src/js/components/Flag/index.js +41 -0
  437. package/_internal/packages/lumx-core/src/js/components/FlexBox/index.d.ts +34 -0
  438. package/_internal/packages/lumx-core/src/js/components/FlexBox/index.js +39 -0
  439. package/_internal/packages/lumx-core/src/js/components/FlexBox/types.d.ts +9 -0
  440. package/_internal/packages/lumx-core/src/js/components/GenericBlock/constants.d.ts +22 -0
  441. package/_internal/packages/lumx-core/src/js/components/GenericBlock/constants.js +15 -0
  442. package/_internal/packages/lumx-core/src/js/components/GenericBlock/index.d.ts +66 -0
  443. package/_internal/packages/lumx-core/src/js/components/GenericBlock/index.js +63 -0
  444. package/_internal/packages/lumx-core/src/js/components/GridColumn/GridColumn.d.ts +27 -0
  445. package/_internal/packages/lumx-core/src/js/components/GridColumn/GridColumn.js +44 -0
  446. package/_internal/packages/lumx-core/src/js/components/GridColumn/index.d.ts +1 -0
  447. package/_internal/packages/lumx-core/src/js/components/Heading/constants.js +19 -0
  448. package/_internal/packages/lumx-core/src/js/components/Heading/index.d.ts +14 -0
  449. package/_internal/packages/lumx-core/src/js/components/Heading/index.js +34 -0
  450. package/_internal/packages/lumx-core/src/js/components/Heading/utils.js +14 -0
  451. package/_internal/packages/lumx-core/src/js/components/Icon/constants.d.ts +4 -0
  452. package/_internal/packages/lumx-core/src/js/components/Icon/index.d.ts +34 -0
  453. package/_internal/packages/lumx-core/src/js/components/Icon/index.js +66 -0
  454. package/_internal/packages/lumx-core/src/js/components/ImageBlock/ImageCaption.d.ts +19 -0
  455. package/_internal/packages/lumx-core/src/js/components/ImageBlock/ImageCaption.js +61 -0
  456. package/_internal/packages/lumx-core/src/js/components/ImageBlock/index.d.ts +52 -0
  457. package/_internal/packages/lumx-core/src/js/components/ImageBlock/index.js +80 -0
  458. package/_internal/packages/lumx-core/src/js/components/InlineList/index.d.ts +34 -0
  459. package/_internal/packages/lumx-core/src/js/components/InlineList/index.js +48 -0
  460. package/_internal/packages/lumx-core/src/js/components/InputHelper/constants.js +9 -0
  461. package/_internal/packages/lumx-core/src/js/components/InputHelper/index.d.ts +21 -0
  462. package/_internal/packages/lumx-core/src/js/components/InputHelper/index.js +34 -0
  463. package/_internal/packages/lumx-core/src/js/components/InputLabel/index.d.ts +24 -0
  464. package/_internal/packages/lumx-core/src/js/components/InputLabel/index.js +31 -0
  465. package/_internal/packages/lumx-core/src/js/components/Lightbox/index.d.ts +14 -0
  466. package/_internal/packages/lumx-core/src/js/components/Lightbox/index.js +70 -0
  467. package/_internal/packages/lumx-core/src/js/components/Link/index.d.ts +34 -0
  468. package/_internal/packages/lumx-core/src/js/components/Link/index.js +40 -0
  469. package/_internal/packages/lumx-core/src/js/components/LinkPreview/index.d.ts +36 -0
  470. package/_internal/packages/lumx-core/src/js/components/LinkPreview/index.js +94 -0
  471. package/_internal/packages/lumx-core/src/js/components/List/ListDivider.d.ts +12 -0
  472. package/_internal/packages/lumx-core/src/js/components/List/ListDivider.js +36 -0
  473. package/_internal/packages/lumx-core/src/js/components/List/ListItem.d.ts +41 -0
  474. package/_internal/packages/lumx-core/src/js/components/List/ListItem.js +66 -0
  475. package/_internal/packages/lumx-core/src/js/components/List/ListItemAction.d.ts +10 -0
  476. package/_internal/packages/lumx-core/src/js/components/List/ListItemAction.js +36 -0
  477. package/_internal/packages/lumx-core/src/js/components/List/ListSection.d.ts +27 -0
  478. package/_internal/packages/lumx-core/src/js/components/List/ListSection.js +51 -0
  479. package/_internal/packages/lumx-core/src/js/components/List/index.d.ts +20 -0
  480. package/_internal/packages/lumx-core/src/js/components/List/index.js +37 -0
  481. package/_internal/packages/lumx-core/src/js/components/Menu/MenuButton.d.ts +28 -0
  482. package/_internal/packages/lumx-core/src/js/components/Menu/MenuButton.js +29 -0
  483. package/_internal/packages/lumx-core/src/js/components/Menu/MenuItem.d.ts +30 -0
  484. package/_internal/packages/lumx-core/src/js/components/Menu/MenuItem.js +34 -0
  485. package/_internal/packages/lumx-core/src/js/components/Menu/MenuList.js +20 -0
  486. package/_internal/packages/lumx-core/src/js/components/Menu/MenuPopover.d.ts +12 -0
  487. package/_internal/packages/lumx-core/src/js/components/Menu/MenuPopover.js +32 -0
  488. package/_internal/packages/lumx-core/src/js/components/Menu/MenuTrigger.js +20 -0
  489. package/_internal/packages/lumx-core/src/js/components/Menu/setupMenu.js +256 -0
  490. package/_internal/packages/lumx-core/src/js/components/Menu/utils.js +16 -0
  491. package/_internal/packages/lumx-core/src/js/components/Message/index.d.ts +31 -0
  492. package/_internal/packages/lumx-core/src/js/components/Message/index.js +85 -0
  493. package/_internal/packages/lumx-core/src/js/components/Mosaic/index.d.ts +18 -0
  494. package/_internal/packages/lumx-core/src/js/components/Mosaic/index.js +70 -0
  495. package/_internal/packages/lumx-core/src/js/components/Popover/constants.d.ts +39 -0
  496. package/_internal/packages/lumx-core/src/js/components/Popover/constants.js +37 -0
  497. package/_internal/packages/lumx-core/src/js/components/Popover/index.d.ts +65 -0
  498. package/_internal/packages/lumx-core/src/js/components/Popover/index.js +74 -0
  499. package/_internal/packages/lumx-core/src/js/components/Popover/types.d.ts +39 -0
  500. package/_internal/packages/lumx-core/src/js/components/Popover/utils/buildPopoverMiddleware.js +53 -0
  501. package/_internal/packages/lumx-core/src/js/components/Popover/utils/computeArrowStyles.js +13 -0
  502. package/_internal/packages/lumx-core/src/js/components/Popover/utils/getFloatingPlacement.js +10 -0
  503. package/_internal/packages/lumx-core/src/js/components/Popover/utils/parseAutoPlacement.js +21 -0
  504. package/_internal/packages/lumx-core/src/js/components/Popover/utils/parseFitWidth.js +12 -0
  505. package/_internal/packages/lumx-core/src/js/components/PopoverDialog/index.d.ts +13 -0
  506. package/_internal/packages/lumx-core/src/js/components/PopoverDialog/index.js +15 -0
  507. package/_internal/packages/lumx-core/src/js/components/ProgressCircular/index.d.ts +32 -0
  508. package/_internal/packages/lumx-core/src/js/components/ProgressCircular/index.js +57 -0
  509. package/_internal/packages/lumx-core/src/js/components/ProgressLinear/index.d.ts +13 -0
  510. package/_internal/packages/lumx-core/src/js/components/ProgressLinear/index.js +34 -0
  511. package/_internal/packages/lumx-core/src/js/components/RadioButton/index.d.ts +35 -0
  512. package/_internal/packages/lumx-core/src/js/components/RadioButton/index.js +71 -0
  513. package/_internal/packages/lumx-core/src/js/components/RadioGroup/index.d.ts +15 -0
  514. package/_internal/packages/lumx-core/src/js/components/RadioGroup/index.js +35 -0
  515. package/_internal/packages/lumx-core/src/js/components/RawClickable/index.d.ts +17 -0
  516. package/_internal/packages/lumx-core/src/js/components/RawClickable/index.js +34 -0
  517. package/_internal/packages/lumx-core/src/js/components/SelectButton/index.d.ts +58 -0
  518. package/_internal/packages/lumx-core/src/js/components/SelectButton/index.js +85 -0
  519. package/_internal/packages/lumx-core/src/js/components/SelectTextField/index.js +78 -0
  520. package/_internal/packages/lumx-core/src/js/components/Skeleton/SkeletonCircle.d.ts +18 -0
  521. package/_internal/packages/lumx-core/src/js/components/Skeleton/SkeletonCircle.js +33 -0
  522. package/_internal/packages/lumx-core/src/js/components/Skeleton/SkeletonRectangle.d.ts +34 -0
  523. package/_internal/packages/lumx-core/src/js/components/Skeleton/SkeletonRectangle.js +49 -0
  524. package/_internal/packages/lumx-core/src/js/components/Skeleton/SkeletonTypography.d.ts +24 -0
  525. package/_internal/packages/lumx-core/src/js/components/Skeleton/SkeletonTypography.js +38 -0
  526. package/_internal/packages/lumx-core/src/js/components/Skeleton/index.d.ts +3 -0
  527. package/_internal/packages/lumx-core/src/js/components/Switch/index.d.ts +37 -0
  528. package/_internal/packages/lumx-core/src/js/components/Switch/index.js +78 -0
  529. package/_internal/packages/lumx-core/src/js/components/Table/TableBody.d.ts +15 -0
  530. package/_internal/packages/lumx-core/src/js/components/Table/TableBody.js +29 -0
  531. package/_internal/packages/lumx-core/src/js/components/Table/TableCell.d.ts +42 -0
  532. package/_internal/packages/lumx-core/src/js/components/Table/TableCell.js +101 -0
  533. package/_internal/packages/lumx-core/src/js/components/Table/TableHeader.d.ts +15 -0
  534. package/_internal/packages/lumx-core/src/js/components/Table/TableHeader.js +33 -0
  535. package/_internal/packages/lumx-core/src/js/components/Table/TableRow.d.ts +22 -0
  536. package/_internal/packages/lumx-core/src/js/components/Table/TableRow.js +42 -0
  537. package/_internal/packages/lumx-core/src/js/components/Table/constants.d.ts +1 -0
  538. package/_internal/packages/lumx-core/src/js/components/Table/constants.js +11 -0
  539. package/_internal/packages/lumx-core/src/js/components/Table/index.d.ts +20 -0
  540. package/_internal/packages/lumx-core/src/js/components/Table/index.js +31 -0
  541. package/_internal/packages/lumx-core/src/js/components/Tabs/Tab.d.ts +54 -0
  542. package/_internal/packages/lumx-core/src/js/components/Tabs/Tab.js +69 -0
  543. package/_internal/packages/lumx-core/src/js/components/Tabs/TabList.d.ts +27 -0
  544. package/_internal/packages/lumx-core/src/js/components/Tabs/TabList.js +52 -0
  545. package/_internal/packages/lumx-core/src/js/components/Tabs/TabPanel.d.ts +26 -0
  546. package/_internal/packages/lumx-core/src/js/components/Tabs/TabPanel.js +41 -0
  547. package/_internal/packages/lumx-core/src/js/components/Tabs/constants.js +7 -0
  548. package/_internal/packages/lumx-core/src/js/components/Tabs/state.js +53 -0
  549. package/_internal/packages/lumx-core/src/js/components/Text/index.d.ts +55 -0
  550. package/_internal/packages/lumx-core/src/js/components/Text/index.js +50 -0
  551. package/_internal/packages/lumx-core/src/js/components/TextField/RawInputText.d.ts +21 -0
  552. package/_internal/packages/lumx-core/src/js/components/TextField/RawInputText.js +40 -0
  553. package/_internal/packages/lumx-core/src/js/components/TextField/RawInputTextarea.d.ts +19 -0
  554. package/_internal/packages/lumx-core/src/js/components/TextField/RawInputTextarea.js +40 -0
  555. package/_internal/packages/lumx-core/src/js/components/TextField/TextField.d.ts +70 -0
  556. package/_internal/packages/lumx-core/src/js/components/TextField/TextField.js +143 -0
  557. package/_internal/packages/lumx-core/src/js/components/TextField/constants.js +15 -0
  558. package/_internal/packages/lumx-core/src/js/components/Thumbnail/index.d.ts +60 -0
  559. package/_internal/packages/lumx-core/src/js/components/Thumbnail/index.js +114 -0
  560. package/_internal/packages/lumx-core/src/js/components/Thumbnail/types.d.ts +39 -0
  561. package/_internal/packages/lumx-core/src/js/components/Thumbnail/utils.d.ts +1 -0
  562. package/_internal/packages/lumx-core/src/js/components/Thumbnail/utils.js +76 -0
  563. package/_internal/packages/lumx-core/src/js/components/TimePickerField/index.d.ts +70 -0
  564. package/_internal/packages/lumx-core/src/js/components/TimePickerField/index.js +53 -0
  565. package/_internal/packages/lumx-core/src/js/components/Toolbar/index.d.ts +19 -0
  566. package/_internal/packages/lumx-core/src/js/components/Toolbar/index.js +51 -0
  567. package/_internal/packages/lumx-core/src/js/components/Tooltip/constants.d.ts +4 -0
  568. package/_internal/packages/lumx-core/src/js/components/Tooltip/constants.js +8 -0
  569. package/_internal/packages/lumx-core/src/js/components/Tooltip/index.d.ts +25 -0
  570. package/_internal/packages/lumx-core/src/js/components/Tooltip/index.js +55 -0
  571. package/_internal/packages/lumx-core/src/js/components/Tooltip/tooltipOpenManager.js +93 -0
  572. package/_internal/packages/lumx-core/src/js/components/Uploader/index.d.ts +59 -0
  573. package/_internal/packages/lumx-core/src/js/components/Uploader/index.js +79 -0
  574. package/_internal/packages/lumx-core/src/js/components/UserBlock/index.d.ts +124 -0
  575. package/_internal/packages/lumx-core/src/js/components/UserBlock/index.js +101 -0
  576. package/_internal/packages/lumx-core/src/js/constants/browser/index.js +7 -0
  577. package/_internal/packages/lumx-core/src/js/constants/components/index.js +19 -0
  578. package/_internal/packages/lumx-core/src/js/constants/enums/index.d.ts +184 -0
  579. package/_internal/packages/lumx-core/src/js/constants/enums/index.js +140 -0
  580. package/_internal/packages/lumx-core/src/js/constants/index.d.ts +1 -0
  581. package/_internal/packages/lumx-core/src/js/types/AriaAttributes.d.ts +32 -0
  582. package/_internal/packages/lumx-core/src/js/types/Booleanish.d.ts +4 -0
  583. package/_internal/packages/lumx-core/src/js/types/CommonRef.d.ts +4 -0
  584. package/_internal/packages/lumx-core/src/js/types/GenericProps.d.ts +14 -0
  585. package/_internal/packages/lumx-core/src/js/types/HasAriaDisabled.d.ts +9 -0
  586. package/_internal/packages/lumx-core/src/js/types/HasAriaLabelOrLabelledBy.d.ts +19 -0
  587. package/_internal/packages/lumx-core/src/js/types/HasChecked.d.ts +9 -0
  588. package/_internal/packages/lumx-core/src/js/types/HasClassName.d.ts +9 -0
  589. package/_internal/packages/lumx-core/src/js/types/HasCloseMode.d.ts +10 -0
  590. package/_internal/packages/lumx-core/src/js/types/HasDisabled.d.ts +9 -0
  591. package/_internal/packages/lumx-core/src/js/types/HasPolymorphicAs.d.ts +12 -0
  592. package/_internal/packages/lumx-core/src/js/types/HasRequiredLinkHref.d.ts +6 -0
  593. package/_internal/packages/lumx-core/src/js/types/HasTheme.d.ts +10 -0
  594. package/_internal/packages/lumx-core/src/js/types/HeadingElement.d.ts +5 -0
  595. package/_internal/packages/lumx-core/src/js/types/JSXElement.d.ts +13 -0
  596. package/_internal/packages/lumx-core/src/js/types/KebabCase.d.ts +5 -0
  597. package/_internal/packages/lumx-core/src/js/types/LumxClassName.d.ts +7 -0
  598. package/_internal/packages/lumx-core/src/js/types/Selector.d.ts +11 -0
  599. package/_internal/packages/lumx-core/src/js/types/TextElement.d.ts +7 -0
  600. package/_internal/packages/lumx-core/src/js/types/ValueOf.d.ts +5 -0
  601. package/_internal/packages/lumx-core/src/js/types/index.d.ts +18 -0
  602. package/_internal/packages/lumx-core/src/js/utils/ClickAway/index.js +37 -0
  603. package/_internal/packages/lumx-core/src/js/utils/InfiniteScroll/index.d.ts +9 -0
  604. package/_internal/packages/lumx-core/src/js/utils/InfiniteScroll/index.js +21 -0
  605. package/_internal/packages/lumx-core/src/js/utils/InfiniteScroll/setupInfiniteScrollObserver.js +18 -0
  606. package/_internal/packages/lumx-core/src/js/utils/Portal/index.d.ts +28 -0
  607. package/_internal/packages/lumx-core/src/js/utils/_internal/color/resolveColorWithVariants.js +9 -0
  608. package/_internal/packages/lumx-core/src/js/utils/browser/createSelectorTreeWalker.js +20 -0
  609. package/_internal/packages/lumx-core/src/js/utils/browser/css/combineSize.js +14 -0
  610. package/_internal/packages/lumx-core/src/js/utils/browser/css/resolveCssSize.js +8 -0
  611. package/_internal/packages/lumx-core/src/js/utils/browser/css/types.d.ts +7 -0
  612. package/_internal/packages/lumx-core/src/js/utils/browser/isFocusVisible.js +11 -0
  613. package/_internal/packages/lumx-core/src/js/utils/browser/isHoverNotSupported.js +5 -0
  614. package/_internal/packages/lumx-core/src/js/utils/browser/isPrintableKey.js +12 -0
  615. package/_internal/packages/lumx-core/src/js/utils/browser/lastDescendant.js +9 -0
  616. package/_internal/packages/lumx-core/src/js/utils/browser/querySelectorInclusive.js +18 -0
  617. package/_internal/packages/lumx-core/src/js/utils/browser/trackContainerFocus.js +28 -0
  618. package/_internal/packages/lumx-core/src/js/utils/classNames/action-area/index.js +22 -0
  619. package/_internal/packages/lumx-core/src/js/utils/classNames/bem/block.js +18 -0
  620. package/_internal/packages/lumx-core/src/js/utils/classNames/bem/element.js +7 -0
  621. package/_internal/packages/lumx-core/src/js/utils/classNames/bem/index.js +22 -0
  622. package/_internal/packages/lumx-core/src/js/utils/classNames/bem/modifier.js +19 -0
  623. package/_internal/packages/lumx-core/src/js/utils/classNames/color/index.js +38 -0
  624. package/_internal/packages/lumx-core/src/js/utils/classNames/index.js +12 -0
  625. package/_internal/packages/lumx-core/src/js/utils/classNames/spacing/index.js +31 -0
  626. package/_internal/packages/lumx-core/src/js/utils/classNames/typography/index.js +10 -0
  627. package/_internal/packages/lumx-core/src/js/utils/classNames/visually-hidden/index.js +9 -0
  628. package/_internal/packages/lumx-core/src/js/utils/disabledState/index.js +13 -0
  629. package/_internal/packages/lumx-core/src/js/utils/events/keyboard.js +15 -0
  630. package/_internal/packages/lumx-core/src/js/utils/focus/constants.js +13 -0
  631. package/_internal/packages/lumx-core/src/js/utils/focus/getFirstAndLastFocusable.js +20 -0
  632. package/_internal/packages/lumx-core/src/js/utils/focus/getFocusableElements.js +8 -0
  633. package/_internal/packages/lumx-core/src/js/utils/focus/setupFocusTrap.js +83 -0
  634. package/_internal/packages/lumx-core/src/js/utils/focusNavigation/createActiveItemState.js +38 -0
  635. package/_internal/packages/lumx-core/src/js/utils/focusNavigation/createGridFocusNavigation.js +182 -0
  636. package/_internal/packages/lumx-core/src/js/utils/focusNavigation/createListFocusNavigation.js +151 -0
  637. package/_internal/packages/lumx-core/src/js/utils/focusNavigation/createPendingNavigation.js +23 -0
  638. package/_internal/packages/lumx-core/src/js/utils/focusNavigation/setupRovingTabIndex.js +167 -0
  639. package/_internal/packages/lumx-core/src/js/utils/function/listenerTower.js +25 -0
  640. package/_internal/packages/lumx-core/src/js/utils/iterable/first.js +8 -0
  641. package/_internal/packages/lumx-core/src/js/utils/locale/getCurrentLocale.js +10 -0
  642. package/_internal/packages/lumx-core/src/js/utils/select/findOptionById.js +19 -0
  643. package/_internal/packages/lumx-core/src/js/utils/select/getOptionDisplayName.js +19 -0
  644. package/_internal/packages/lumx-core/src/js/utils/select/renderSelectOptions.js +51 -0
  645. package/_internal/packages/lumx-core/src/js/utils/select/toggleSelection.js +39 -0
  646. package/_internal/packages/lumx-core/src/js/utils/select/types.d.ts +203 -0
  647. package/_internal/packages/lumx-core/src/js/utils/selectors/getWithSelector.js +9 -0
  648. package/_internal/packages/lumx-core/src/js/utils/selectors/groupBySelector.js +21 -0
  649. package/_internal/packages/lumx-core/src/js/utils/time/buildTimeList.d.ts +20 -0
  650. package/_internal/packages/lumx-core/src/js/utils/time/buildTimeList.js +36 -0
  651. package/_internal/packages/lumx-core/src/js/utils/time/formatTime.js +14 -0
  652. package/_internal/packages/lumx-core/src/js/utils/time/getDateAtTime.js +12 -0
  653. package/_internal/packages/lumx-core/src/js/utils/time/isDateOnTime.js +10 -0
  654. package/_internal/packages/lumx-core/src/js/utils/time/parseTimeInput.js +46 -0
  655. package/_internal/packages/lumx-core/src/js/utils/time/snapTimeToBounds.js +21 -0
  656. package/_internal/packages/lumx-core/src/js/utils/time/timeOfDayMinutes.js +9 -0
  657. package/_internal/packages/lumx-core/src/js/utils/typeahead/index.js +77 -0
  658. package/_internal/utils/A11YLiveMessage/index.d.ts +50 -0
  659. package/_internal/utils/A11YLiveMessage/index.js +28 -0
  660. package/_internal/utils/ClickAwayProvider/ClickAwayProvider.d.ts +23 -0
  661. package/_internal/utils/ClickAwayProvider/ClickAwayProvider.js +46 -0
  662. package/_internal/utils/ClickAwayProvider/index.d.ts +1 -0
  663. package/_internal/utils/InfiniteScroll/InfiniteScroll.d.ts +10 -0
  664. package/_internal/utils/InfiniteScroll/InfiniteScroll.js +18 -0
  665. package/_internal/utils/InfiniteScroll/index.d.ts +2 -0
  666. package/_internal/utils/Portal/Portal.d.ts +15 -0
  667. package/_internal/utils/Portal/Portal.js +23 -0
  668. package/_internal/utils/Portal/PortalProvider.d.ts +14 -0
  669. package/_internal/utils/Portal/PortalProvider.js +9 -0
  670. package/_internal/utils/Portal/index.d.ts +3 -0
  671. package/_internal/utils/browser/DOM/findImage.js +5 -0
  672. package/_internal/utils/browser/DOM/startViewTransition.js +47 -0
  673. package/_internal/utils/browser/isReducedMotion.js +8 -0
  674. package/_internal/utils/browser/isScrollSnapSupported.js +8 -0
  675. package/_internal/utils/browser/onScrollEnd.js +25 -0
  676. package/_internal/utils/date/addMonthResetDay.js +12 -0
  677. package/_internal/utils/date/formatDayNumber.js +8 -0
  678. package/_internal/utils/date/getFirstDayOfWeek.js +42 -0
  679. package/_internal/utils/date/getMonthCalendar.js +43 -0
  680. package/_internal/utils/date/getWeekDays.js +25 -0
  681. package/_internal/utils/date/getYearDisplayName.js +12 -0
  682. package/_internal/utils/date/isDateValid.js +7 -0
  683. package/_internal/utils/date/isSameDay.js +8 -0
  684. package/_internal/utils/disabled/DisabledStateContext.d.ts +21 -0
  685. package/_internal/utils/disabled/DisabledStateContext.js +22 -0
  686. package/_internal/utils/disabled/index.d.ts +1 -0
  687. package/_internal/utils/disabled/useDisableStateProps.d.ts +1 -0
  688. package/_internal/utils/disabled/useDisableStateProps.js +29 -0
  689. package/_internal/utils/locale/parseLocale.js +26 -0
  690. package/_internal/utils/moving-focus/components/MovingFocusProvider/context.d.ts +14 -0
  691. package/_internal/utils/moving-focus/components/MovingFocusProvider/context.js +10 -0
  692. package/_internal/utils/moving-focus/components/MovingFocusProvider/index.d.ts +21 -0
  693. package/_internal/utils/moving-focus/components/MovingFocusProvider/index.js +58 -0
  694. package/_internal/utils/moving-focus/constants.d.ts +19 -0
  695. package/_internal/utils/moving-focus/constants.js +25 -0
  696. package/_internal/utils/moving-focus/ducks/keyboard-navigation.js +453 -0
  697. package/_internal/utils/moving-focus/ducks/slice.js +50 -0
  698. package/_internal/utils/moving-focus/ducks/tab-stop.js +109 -0
  699. package/_internal/utils/moving-focus/hooks/useRovingTabIndex/index.d.ts +1 -0
  700. package/_internal/utils/moving-focus/hooks/useRovingTabIndex/useRovingTabIndex.d.ts +19 -0
  701. package/_internal/utils/moving-focus/hooks/useRovingTabIndex/useRovingTabIndex.js +81 -0
  702. package/_internal/utils/moving-focus/hooks/useVirtualFocus/index.d.ts +2 -0
  703. package/_internal/utils/moving-focus/hooks/useVirtualFocus/useVirtualFocus.d.ts +15 -0
  704. package/_internal/utils/moving-focus/hooks/useVirtualFocus/useVirtualFocus.js +83 -0
  705. package/_internal/utils/moving-focus/hooks/useVirtualFocus/useVirtualFocusParent.d.ts +10 -0
  706. package/_internal/utils/moving-focus/hooks/useVirtualFocus/useVirtualFocusParent.js +47 -0
  707. package/_internal/utils/moving-focus/index.d.ts +5 -0
  708. package/_internal/utils/moving-focus/types.d.ts +177 -0
  709. package/_internal/utils/moving-focus/utils/buildLoopAroundObject.js +22 -0
  710. package/_internal/utils/moving-focus/utils/createGridMap.js +17 -0
  711. package/_internal/utils/moving-focus/utils/getCell.js +94 -0
  712. package/_internal/utils/moving-focus/utils/getCellCoordinates.js +16 -0
  713. package/_internal/utils/moving-focus/utils/getPointerTypeFromEvent.js +11 -0
  714. package/_internal/utils/moving-focus/utils/shouldLoopListHorizontally.js +7 -0
  715. package/_internal/utils/moving-focus/utils/shouldLoopListVertically.js +7 -0
  716. package/_internal/utils/moving-focus/utils/tabStopIsEnabled.js +5 -0
  717. package/_internal/utils/number/clamp.d.ts +12 -0
  718. package/_internal/utils/number/clamp.js +16 -0
  719. package/_internal/utils/object/isEqual.js +14 -0
  720. package/_internal/utils/partitionMulti.js +24 -0
  721. package/_internal/utils/react/OnBeforeUnmount.js +17 -0
  722. package/_internal/utils/react/forwardRef.js +8 -0
  723. package/_internal/utils/react/forwardRefPolymorphic.js +6 -0
  724. package/_internal/utils/react/mergeRefs.js +22 -0
  725. package/_internal/utils/react/skipRender.js +19 -0
  726. package/_internal/utils/react/unref.js +8 -0
  727. package/_internal/utils/react/wrapChildrenIconWithSpaces.js +19 -0
  728. package/_internal/utils/theme/ThemeContext.d.ts +14 -0
  729. package/_internal/utils/theme/ThemeContext.js +11 -0
  730. package/_internal/utils/type/Comp.d.ts +15 -0
  731. package/_internal/utils/type/ComponentRef.d.ts +15 -0
  732. package/_internal/utils/type/HasPolymorphicAs.d.ts +9 -0
  733. package/_internal/utils/type/MaybeElementOrRef.d.ts +9 -0
  734. package/_internal/utils/type/ReactToJSX.d.ts +13 -0
  735. package/_internal/utils/type/index.d.ts +15 -0
  736. package/_internal/utils/type/isComponent.d.ts +13 -0
  737. package/_internal/utils/type/isComponent.js +27 -0
  738. package/_internal/utils/type/isComponentType.d.ts +9 -0
  739. package/_internal/utils/type/isComponentType.js +8 -0
  740. package/index.d.ts +150 -5788
  741. package/index.js +247 -22493
  742. package/package.json +8 -21
  743. package/utils/index.d.ts +14 -413
  744. package/utils/index.js +12 -1440
  745. package/_internal/BvaFEHZn.js +0 -262
  746. package/_internal/BvaFEHZn.js.map +0 -1
  747. package/index.js.map +0 -1
  748. package/utils/index.js.map +0 -1
package/utils/index.js CHANGED
@@ -1,1440 +1,12 @@
1
- import React__default, { useEffect } from 'react';
2
- import { join, visuallyHidden } from '@lumx/core/js/utils/classNames';
3
- import { jsx } from 'react/jsx-runtime';
4
- export { C as ClickAwayProvider, D as DisabledStateProvider, I as InfiniteScroll, P as Portal, a as PortalProvider, u as useDisabledStateContext } from '../_internal/BvaFEHZn.js';
5
- import noop from 'lodash/noop.js';
6
- import findLast from 'lodash/findLast.js';
7
- import find from 'lodash/find.js';
8
- import findLastIndex from 'lodash/findLastIndex.js';
9
- import isNil from 'lodash/isNil.js';
10
- import groupBy from 'lodash/groupBy.js';
11
- import uniqueId from 'lodash/uniqueId.js';
12
-
13
- /**
14
- * Live region to read a message to screen readers.
15
- * Messages can be "polite" and be read when possible or
16
- * "assertive" and interrupt any message currently be read. (To be used sparingly)
17
- *
18
- * More information here: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions
19
- *
20
- * @family A11Y
21
- * @param A11YLiveMessageProps
22
- * @returns A11YLiveMessage
23
- */
24
- const A11YLiveMessage = ({
25
- type = 'polite',
26
- atomic,
27
- role,
28
- hidden,
29
- relevant,
30
- children,
31
- className,
32
- ...forwardedProps
33
- }) => {
34
- return /*#__PURE__*/jsx("div", {
35
- ...forwardedProps,
36
- className: join(hidden ? visuallyHidden() : undefined, className),
37
- role: role,
38
- "aria-live": type,
39
- "aria-atomic": atomic,
40
- "aria-relevant": relevant,
41
- children: children
42
- });
43
- };
44
-
45
- /**
46
- * Create a map from the given tab stop to sort them by rowKey;
47
- */
48
- function createGridMap(tabStops) {
49
- /** Group all tabStop by rows to easily access them by their row keys */
50
- const tabStopsByRowKey = groupBy(tabStops, 'rowKey');
51
- /**
52
- * An array with each row key in the order set in the tabStops array.
53
- * Each rowKey will only appear once.
54
- */
55
- const rowKeys = tabStops.reduce((acc, {
56
- rowKey
57
- }) => {
58
- if (!isNil(rowKey) && !acc.includes(rowKey)) {
59
- return [...acc, rowKey];
60
- }
61
- return acc;
62
- }, []);
63
- return {
64
- tabStopsByRowKey,
65
- rowKeys
66
- };
67
- }
68
-
69
- /** Check if the given tab stop is enabled */
70
- const tabStopIsEnabled = tabStop => !tabStop.disabled;
71
-
72
- const LOOP_AROUND_TYPES = {
73
- /**
74
- * Will continue navigation to the next row or column and loop back to the start
75
- * when the last tab stop is reached
76
- */
77
- nextLoop: 'next-loop',
78
- /**
79
- * Will continue navigation to the next row or column until
80
- * the last tab stop is reached
81
- */
82
- nextEnd: 'next-end',
83
- /**
84
- * Will loop within the current row or column
85
- */
86
- inside: 'inside'
87
- };
88
- const CELL_SEARCH_DIRECTION = {
89
- /** Look ahead of the given position */
90
- asc: 'asc',
91
- /** Look before the given position */
92
- desc: 'desc'
93
- };
94
-
95
- /**
96
- * Build a loopAround configuration to ensure both row and col behavior are set.
97
- *
98
- * Setting a boolean will set the following behaviors:
99
- *
100
- * * true => { row: 'next-loop', col: 'next-loop' }
101
- * * false => { row: 'next-end', col: 'next-end' }
102
- */
103
- function buildLoopAroundObject(loopAround) {
104
- if (typeof loopAround === 'boolean' || loopAround === undefined) {
105
- const newLoopAround = loopAround ? {
106
- row: LOOP_AROUND_TYPES.nextLoop,
107
- col: LOOP_AROUND_TYPES.nextLoop
108
- } : {
109
- row: LOOP_AROUND_TYPES.nextEnd,
110
- col: LOOP_AROUND_TYPES.nextEnd
111
- };
112
- return newLoopAround;
113
- }
114
- return loopAround;
115
- }
116
-
117
- /**
118
- * Check that the given coordinate is a simple number
119
- */
120
- const isNumberCoords = coords => typeof coords === 'number';
121
-
122
- /**
123
- * Check that the given coordinate is a direction
124
- */
125
- function isDirectionCoords(coords) {
126
- return Boolean(typeof coords !== 'number' && typeof coords?.from === 'number');
127
- }
128
-
129
- /**
130
- * Search the given column of a grid map for a cell.
131
- */
132
- function findCellInCol(gridMap, col, rowCoords, cellSelector = tabStopIsEnabled) {
133
- /** The rowIndex might not be strictly successive, so we need to use the actual row index keys. */
134
- const {
135
- rowKeys,
136
- tabStopsByRowKey
137
- } = gridMap;
138
- const lastIndex = rowKeys.length - 1;
139
- /**
140
- * If the rowCoords.from is set at -1, it means we should search from the start/end.
141
- */
142
- let searchIndex = rowCoords.from;
143
- if (searchIndex === -1) {
144
- searchIndex = rowCoords.direction === CELL_SEARCH_DIRECTION.desc ? lastIndex : 0;
145
- }
146
- const searchCellFunc = rowCoords.direction === CELL_SEARCH_DIRECTION.desc ? findLast : find;
147
- const rowKeyWithEnabledCell = searchCellFunc(rowKeys, (rowKey, index) => {
148
- const row = tabStopsByRowKey[rowKey];
149
- const cell = row[col];
150
- const hasCell = Boolean(cell);
151
- const cellRowIndex = index;
152
-
153
- /** Check that the target row index is in the right direction of the search */
154
- const correctRowIndex = rowCoords.direction === CELL_SEARCH_DIRECTION.desc ? cellRowIndex <= searchIndex : cellRowIndex >= searchIndex;
155
- if (cell && correctRowIndex) {
156
- return cellSelector ? hasCell && cellSelector(cell) : hasCell;
157
- }
158
- return false;
159
- });
160
- const row = rowKeyWithEnabledCell !== undefined ? tabStopsByRowKey[rowKeyWithEnabledCell] : undefined;
161
- return row?.[col];
162
- }
163
-
164
- /**
165
- * Search the given column of a grid map for a cell.
166
- */
167
- function findCellInRow(gridMap, row, colCoords, cellSelector = tabStopIsEnabled) {
168
- const {
169
- direction,
170
- from
171
- } = colCoords || {};
172
- const {
173
- rowKeys,
174
- tabStopsByRowKey
175
- } = gridMap;
176
- const rowKey = rowKeys[row];
177
- const currentRow = tabStopsByRowKey[rowKey];
178
- if (!currentRow) {
179
- return undefined;
180
- }
181
- const searchCellFunc = direction === CELL_SEARCH_DIRECTION.desc ? findLast : find;
182
- const cell = searchCellFunc(currentRow, cellSelector, from);
183
- return cell;
184
- }
185
-
186
- /**
187
- * Parse each column of the given gridMap to find the first cell matching the selector.
188
- * The direction and starting point of the search can be set using the coordinates attribute.
189
- */
190
- function parseColsForCell(/** The gridMap to search */
191
- gridMap, /** The coordinate to search */
192
- {
193
- direction = CELL_SEARCH_DIRECTION.asc,
194
- from
195
- }, cellSelector = tabStopIsEnabled) {
196
- if (from === undefined) {
197
- return undefined;
198
- }
199
- const {
200
- rowKeys,
201
- tabStopsByRowKey
202
- } = gridMap;
203
-
204
- /** As we cannot know for certain when to stop, we need to know which column is the last column */
205
- const maxColIndex = rowKeys.reduce((maxLength, rowIndex) => {
206
- const rowLength = tabStopsByRowKey[rowIndex].length;
207
- return rowLength > maxLength ? rowLength - 1 : maxLength;
208
- }, 0);
209
-
210
- /** If "from" is set as -1, start from the end. */
211
- const fromIndex = from === -1 ? maxColIndex : from || 0;
212
- for (let index = fromIndex; direction === CELL_SEARCH_DIRECTION.desc ? index > -1 : index <= maxColIndex; direction === CELL_SEARCH_DIRECTION.desc ? index -= 1 : index += 1) {
213
- const rowWithEnabledCed = findCellInCol(gridMap, index, {
214
- direction,
215
- from: direction === CELL_SEARCH_DIRECTION.desc ? -1 : 0
216
- }, cellSelector);
217
- if (rowWithEnabledCed) {
218
- return rowWithEnabledCed;
219
- }
220
- }
221
- return undefined;
222
- }
223
-
224
- /**
225
- * Search for a cell in a gridMap
226
- *
227
- * This allows you to
228
- * * Select a cell at a specific coordinate
229
- * * Search for a cell from a specific column in any direction
230
- * * Search for a cell from a specific row in any direction
231
- *
232
- * If no cell is found, returns undefined
233
- */
234
- function getCell(/** The gridMap object to search in. */
235
- gridMap, /** The coordinates of the cell to select */
236
- coords,
237
- /**
238
- * A selector function to select the cell.
239
- * Selects enabled cells by default.
240
- */
241
- cellSelector = tabStopIsEnabled) {
242
- const {
243
- row,
244
- col
245
- } = coords || {};
246
- const {
247
- rowKeys,
248
- tabStopsByRowKey
249
- } = gridMap || {};
250
-
251
- /** Defined row and col */
252
- if (isNumberCoords(row) && isNumberCoords(col)) {
253
- const rowKey = rowKeys[row];
254
- return tabStopsByRowKey[rowKey][col];
255
- }
256
-
257
- /** Defined row but variable col */
258
- if (isDirectionCoords(col) && isNumberCoords(row)) {
259
- return findCellInRow(gridMap, row, col, cellSelector);
260
- }
261
- if (isDirectionCoords(row)) {
262
- if (isDirectionCoords(col)) {
263
- return parseColsForCell(gridMap, col, cellSelector);
264
- }
265
- return findCellInCol(gridMap, col, row, cellSelector);
266
- }
267
- return undefined;
268
- }
269
-
270
- function getCellCoordinates(gridMap, tabStop) {
271
- const currentRowKey = tabStop.rowKey;
272
- if (isNil(currentRowKey)) {
273
- return undefined;
274
- }
275
- const {
276
- rowKeys,
277
- tabStopsByRowKey
278
- } = gridMap;
279
- const rowIndex = rowKeys.findIndex(rowKey => rowKey === currentRowKey);
280
- const row = tabStopsByRowKey[currentRowKey];
281
- const columnOffset = row.findIndex(ts => ts.id === tabStop.id);
282
- return {
283
- rowIndex,
284
- row,
285
- columnOffset
286
- };
287
- }
288
-
289
- /** Check whether the list should vertically loop with the given configuration */
290
- function shouldLoopListVertically(direction, loopAround) {
291
- return direction === 'vertical' && loopAround?.col !== 'next-end' || direction === 'both' && loopAround?.col !== 'next-end';
292
- }
293
-
294
- /** Check whether the list should horizontally loop with the given configuration */
295
- function shouldLoopListHorizontally(direction, loopAround) {
296
- return direction === 'horizontal' && loopAround?.row !== 'next-end' || direction === 'both' && loopAround?.row !== 'next-end';
297
- }
298
-
299
- /**
300
- * Get the correct pointer type from the given event.
301
- * This is used when a tab stop is selected, to check if is has been selected using a keyboard or a pointer
302
- * (pen / mouse / touch)
303
- */
304
- function getPointerTypeFromEvent(event) {
305
- return event && 'pointerType' in event && Boolean(event.pointerType) ? 'pointer' : 'keyboard';
306
- }
307
-
308
- // Event keys used for keyboard navigation.
309
- const VERTICAL_NAV_KEYS = ['ArrowUp', 'ArrowDown', 'Home', 'End'];
310
- const HORIZONTAL_NAV_KEYS = ['ArrowLeft', 'ArrowRight', 'Home', 'End'];
311
- const KEY_NAV_KEYS = [...HORIZONTAL_NAV_KEYS, ...VERTICAL_NAV_KEYS];
312
- const NAV_KEYS = {
313
- both: KEY_NAV_KEYS,
314
- vertical: VERTICAL_NAV_KEYS,
315
- horizontal: HORIZONTAL_NAV_KEYS
316
- };
317
-
318
- // Event keys union type
319
-
320
- // Handle all navigation moves resulting in a new state.
321
- const MOVES = {
322
- // Move to the next item.
323
- // The grid is flatten so the item after the last of a row will be the
324
- // first item of the next row.
325
- NEXT(state, _, index) {
326
- for (let i = index + 1; i < state.tabStops.length; ++i) {
327
- const tabStop = state.tabStops[i];
328
- if (!tabStop.disabled) {
329
- return {
330
- ...state,
331
- allowFocusing: true,
332
- selectedId: tabStop.id
333
- };
334
- }
335
- }
336
- return state;
337
- },
338
- // Move to the previous item.
339
- // The grid is flatten so the item before the first of a row will be the
340
- // last item of the previous row.
341
- PREVIOUS(state, _, index) {
342
- for (let i = index - 1; i >= 0; --i) {
343
- const tabStop = state.tabStops[i];
344
- if (!tabStop.disabled) {
345
- return {
346
- ...state,
347
- allowFocusing: true,
348
- selectedId: tabStop.id
349
- };
350
- }
351
- }
352
- return state;
353
- },
354
- // Moving to the next row
355
- // We move to the next row, and we stay in the same column.
356
- // If we are in the last row, then we move to the first not disabled item of the next column.
357
- NEXT_ROW(state, currentTabStop) {
358
- const currentRowKey = currentTabStop.rowKey;
359
- if (isNil(currentRowKey)) {
360
- return state;
361
- }
362
- const gridMap = state.gridMap || createGridMap(state.tabStops);
363
- const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);
364
- if (!cellCoordinates) {
365
- return state;
366
- }
367
- const {
368
- rowIndex,
369
- columnOffset
370
- } = cellCoordinates;
371
- const nextRow = rowIndex + 1;
372
-
373
- /** First try to get the next cell in the current column */
374
- let tabStop = getCell(gridMap, {
375
- row: {
376
- from: nextRow,
377
- direction: 'asc'
378
- },
379
- col: columnOffset
380
- });
381
-
382
- // If none were found, search for the next cell depending on the loop around parameter
383
- if (!tabStop) {
384
- switch (state.loopAround.col) {
385
- /**
386
- * If columns are configured to be looped inside,
387
- * get the first enabled cell of the current column
388
- */
389
- case LOOP_AROUND_TYPES.inside:
390
- tabStop = getCell(gridMap, {
391
- col: columnOffset,
392
- row: {
393
- from: 0,
394
- direction: 'asc'
395
- }
396
- });
397
- break;
398
- /**
399
- * If columns are configured to be go to the next,
400
- * search for the next enabled cell from the next column
401
- */
402
- case LOOP_AROUND_TYPES.nextEnd:
403
- case LOOP_AROUND_TYPES.nextLoop:
404
- default:
405
- tabStop = getCell(gridMap, {
406
- row: {
407
- from: 0,
408
- direction: 'asc'
409
- },
410
- col: {
411
- from: columnOffset + 1,
412
- direction: 'asc'
413
- }
414
- });
415
- break;
416
- }
417
- }
418
-
419
- /**
420
- * If still none is found and the columns are configured to loop
421
- * search starting from the start
422
- */
423
- if (!tabStop && state.loopAround.col === LOOP_AROUND_TYPES.nextLoop) {
424
- tabStop = getCell(gridMap, {
425
- row: {
426
- from: 0,
427
- direction: 'asc'
428
- },
429
- col: {
430
- from: 0,
431
- direction: 'asc'
432
- }
433
- });
434
- }
435
- if (tabStop) {
436
- return {
437
- ...state,
438
- allowFocusing: true,
439
- selectedId: tabStop.id,
440
- gridMap
441
- };
442
- }
443
- return {
444
- ...state,
445
- allowFocusing: true,
446
- gridMap
447
- };
448
- },
449
- // Moving to the previous row
450
- // We move to the previous row, and we stay in the same column.
451
- // If we are in the first row, then we move to the last not disabled item of the previous column.
452
- PREVIOUS_ROW(state, currentTabStop) {
453
- const currentRowKey = currentTabStop.rowKey;
454
- if (isNil(currentRowKey)) {
455
- return state;
456
- }
457
- const gridMap = state.gridMap || createGridMap(state.tabStops);
458
- const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);
459
- if (!cellCoordinates) {
460
- return state;
461
- }
462
- const {
463
- rowIndex,
464
- columnOffset
465
- } = cellCoordinates;
466
- const previousRow = rowIndex - 1;
467
- let tabStop;
468
- /** Search for the previous enabled cell in the current column */
469
- if (previousRow >= 0) {
470
- tabStop = getCell(gridMap, {
471
- row: {
472
- from: previousRow,
473
- direction: 'desc'
474
- },
475
- col: columnOffset
476
- });
477
- }
478
-
479
- // If none were found, search for the previous cell depending on the loop around parameter
480
- if (!tabStop) {
481
- switch (state.loopAround.col) {
482
- /**
483
- * If columns are configured to be looped inside,
484
- * get the last enabled cell of the current column
485
- */
486
- case LOOP_AROUND_TYPES.inside:
487
- tabStop = getCell(gridMap, {
488
- col: columnOffset,
489
- row: {
490
- from: -1,
491
- direction: 'desc'
492
- }
493
- });
494
- break;
495
- /**
496
- * If columns are configured to be go to the previous,
497
- * search for the last enabled cell from the previous column
498
- */
499
- case LOOP_AROUND_TYPES.nextEnd:
500
- case LOOP_AROUND_TYPES.nextLoop:
501
- default:
502
- if (columnOffset - 1 >= 0) {
503
- tabStop = getCell(gridMap, {
504
- row: {
505
- from: -1,
506
- direction: 'desc'
507
- },
508
- col: {
509
- from: columnOffset - 1,
510
- direction: 'desc'
511
- }
512
- });
513
- break;
514
- }
515
- }
516
- }
517
- /**
518
- * If still none is found and the columns are configured to loop
519
- * search starting from the end
520
- */
521
- if (!tabStop && state.loopAround.col === LOOP_AROUND_TYPES.nextLoop) {
522
- tabStop = getCell(gridMap, {
523
- row: {
524
- from: -1,
525
- direction: 'desc'
526
- },
527
- col: {
528
- from: -1,
529
- direction: 'desc'
530
- }
531
- });
532
- }
533
- if (tabStop) {
534
- return {
535
- ...state,
536
- allowFocusing: true,
537
- selectedId: tabStop.id,
538
- gridMap
539
- };
540
- }
541
- return {
542
- ...state,
543
- allowFocusing: true,
544
- gridMap
545
- };
546
- },
547
- // Moving to the very first not disabled item of the list
548
- VERY_FIRST(state) {
549
- // The very first not disabled item' index.
550
- const tabStop = state.tabStops.find(tabStopIsEnabled);
551
- if (tabStop) {
552
- return {
553
- ...state,
554
- allowFocusing: true,
555
- selectedId: tabStop.id
556
- };
557
- }
558
- return state;
559
- },
560
- // Moving to the very last not disabled item of the list
561
- VERY_LAST(state) {
562
- // The very last not disabled item' index.
563
- const tabStop = findLast(state.tabStops, tabStopIsEnabled);
564
- if (tabStop) {
565
- return {
566
- ...state,
567
- allowFocusing: true,
568
- selectedId: tabStop.id
569
- };
570
- }
571
- return state;
572
- },
573
- NEXT_COLUMN(state, currentTabStop, index) {
574
- const currentRowKey = currentTabStop.rowKey;
575
- if (isNil(currentRowKey)) {
576
- return state;
577
- }
578
- const gridMap = state.gridMap || createGridMap(state.tabStops);
579
- const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);
580
- if (!cellCoordinates) {
581
- return state;
582
- }
583
- const {
584
- rowIndex,
585
- columnOffset
586
- } = cellCoordinates;
587
- // Parse the current row and look for the next enabled cell
588
- let tabStop = getCell(gridMap, {
589
- row: rowIndex,
590
- col: {
591
- from: columnOffset + 1,
592
- direction: 'asc'
593
- }
594
- });
595
-
596
- // If none were found, search for the next cell depending on the loop around parameter
597
- if (!tabStop) {
598
- switch (state.loopAround.row) {
599
- /**
600
- * If rows are configured to be looped inside,
601
- * get the first enabled cell of the current rows
602
- */
603
- case LOOP_AROUND_TYPES.inside:
604
- tabStop = getCell(gridMap, {
605
- row: rowIndex,
606
- col: {
607
- from: 0,
608
- direction: 'asc'
609
- }
610
- });
611
- break;
612
- /**
613
- * If rows are configured to be go to the next,
614
- * search for the next enabled cell from the next row
615
- */
616
- case LOOP_AROUND_TYPES.nextEnd:
617
- case LOOP_AROUND_TYPES.nextLoop:
618
- default:
619
- tabStop = find(state.tabStops, tabStopIsEnabled, index + 1);
620
- break;
621
- }
622
- }
623
- /**
624
- * If still none is found and the row are configured to loop
625
- * search starting from the start
626
- */
627
- if (!tabStop && state.loopAround.row === LOOP_AROUND_TYPES.nextLoop) {
628
- tabStop = find(state.tabStops, tabStopIsEnabled);
629
- }
630
- return {
631
- ...state,
632
- allowFocusing: true,
633
- selectedId: tabStop?.id || state.selectedId,
634
- gridMap
635
- };
636
- },
637
- PREVIOUS_COLUMN(state, currentTabStop, index) {
638
- const currentRowKey = currentTabStop.rowKey;
639
- if (isNil(currentRowKey)) {
640
- return state;
641
- }
642
- const gridMap = state.gridMap || createGridMap(state.tabStops);
643
- const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);
644
- if (!cellCoordinates) {
645
- return state;
646
- }
647
- const {
648
- rowIndex,
649
- columnOffset
650
- } = cellCoordinates;
651
- const previousColumn = columnOffset - 1;
652
- let tabStop;
653
- if (previousColumn >= 0) {
654
- // Parse the current row and look for the next enable cell
655
- tabStop = getCell(gridMap, {
656
- row: rowIndex,
657
- col: {
658
- from: previousColumn,
659
- direction: 'desc'
660
- }
661
- });
662
- }
663
- if (!tabStop) {
664
- switch (state.loopAround.row) {
665
- /**
666
- * If rows are configured to be looped inside,
667
- * get the last enabled cell of the current row
668
- */
669
- case LOOP_AROUND_TYPES.inside:
670
- tabStop = getCell(gridMap, {
671
- row: rowIndex,
672
- col: {
673
- from: -1,
674
- direction: 'desc'
675
- }
676
- });
677
- break;
678
- /**
679
- * If rows are configured to be go to the next,
680
- * search for the previous enabled cell from the previous row
681
- */
682
- case LOOP_AROUND_TYPES.nextEnd:
683
- case LOOP_AROUND_TYPES.nextLoop:
684
- default:
685
- if (index - 1 >= 0) {
686
- tabStop = findLast(state.tabStops, tabStopIsEnabled, index - 1);
687
- }
688
- break;
689
- }
690
- }
691
- /**
692
- * If still none is found and the rows are configured to loop
693
- * search starting from the end
694
- */
695
- if (!tabStop && state.loopAround.row === LOOP_AROUND_TYPES.nextLoop) {
696
- tabStop = findLast(state.tabStops, tabStopIsEnabled);
697
- }
698
- return {
699
- ...state,
700
- allowFocusing: true,
701
- selectedId: tabStop?.id || state.selectedId,
702
- gridMap
703
- };
704
- },
705
- FIRST_IN_COLUMN(state, currentTabStop) {
706
- const currentRowKey = currentTabStop.rowKey;
707
- if (isNil(currentRowKey)) {
708
- return state;
709
- }
710
- const gridMap = state.gridMap || createGridMap(state.tabStops);
711
- const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);
712
- if (!cellCoordinates) {
713
- return state;
714
- }
715
- const {
716
- columnOffset
717
- } = cellCoordinates;
718
- const tabStop = getCell(gridMap, {
719
- col: columnOffset,
720
- row: {
721
- from: 0,
722
- direction: 'asc'
723
- }
724
- });
725
- return {
726
- ...state,
727
- allowFocusing: true,
728
- selectedId: tabStop?.id || state.selectedId,
729
- gridMap
730
- };
731
- },
732
- LAST_IN_COLUMN(state, currentTabStop) {
733
- const currentRowKey = currentTabStop.rowKey;
734
- if (isNil(currentRowKey)) {
735
- return state;
736
- }
737
- const gridMap = state.gridMap || createGridMap(state.tabStops);
738
- const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);
739
- if (!cellCoordinates) {
740
- return state;
741
- }
742
- const {
743
- columnOffset
744
- } = cellCoordinates;
745
- const tabStop = getCell(gridMap, {
746
- col: columnOffset,
747
- row: {
748
- from: -1,
749
- direction: 'desc'
750
- }
751
- });
752
- return {
753
- ...state,
754
- allowFocusing: true,
755
- selectedId: tabStop?.id || state.selectedId,
756
- gridMap
757
- };
758
- },
759
- // Moving to the first item in row
760
- FIRST_IN_ROW(state, currentTabStop) {
761
- const currentRowKey = currentTabStop.rowKey;
762
- if (isNil(currentRowKey)) {
763
- return state;
764
- }
765
- const gridMap = state.gridMap || createGridMap(state.tabStops);
766
- const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);
767
- if (!cellCoordinates) {
768
- return state;
769
- }
770
- const {
771
- rowIndex
772
- } = cellCoordinates;
773
- const tabStop = getCell(gridMap, {
774
- row: rowIndex,
775
- col: {
776
- from: 0,
777
- direction: 'asc'
778
- }
779
- });
780
- return {
781
- ...state,
782
- allowFocusing: true,
783
- selectedId: tabStop?.id || state.selectedId,
784
- gridMap
785
- };
786
- },
787
- // Moving to the last item in row
788
- LAST_IN_ROW(state, currentTabStop) {
789
- const currentRowKey = currentTabStop.rowKey;
790
- if (isNil(currentRowKey)) {
791
- return state;
792
- }
793
- const gridMap = state.gridMap || createGridMap(state.tabStops);
794
- const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);
795
- if (!cellCoordinates) {
796
- return state;
797
- }
798
- const {
799
- rowIndex
800
- } = cellCoordinates;
801
- const tabStop = getCell(gridMap, {
802
- row: rowIndex,
803
- col: {
804
- from: -1,
805
- direction: 'desc'
806
- }
807
- });
808
- return {
809
- ...state,
810
- allowFocusing: true,
811
- selectedId: tabStop?.id || state.selectedId,
812
- gridMap
813
- };
814
- }
815
- };
816
-
817
- /** Handle `KEY_NAV` action to update */
818
- const KEY_NAV = (state, action) => {
819
- const {
820
- id = state.selectedId || state.tabStops[0]?.id,
821
- key,
822
- ctrlKey
823
- } = action.payload;
824
- const index = state.tabStops.findIndex(tabStop => tabStop.id === id);
825
- if (index === -1) {
826
- // tab stop not registered
827
- return state;
828
- }
829
- const currentTabStop = state.tabStops[index];
830
- if (currentTabStop.disabled) {
831
- return state;
832
- }
833
- const isGrid = currentTabStop.rowKey !== null;
834
- const isFirst = index === state.tabStops.findIndex(tabStopIsEnabled);
835
- const isLast = index === findLastIndex(state.tabStops, tabStopIsEnabled);
836
- // Translates the user key down event info into a navigation instruction.
837
- let navigation = null;
838
- // eslint-disable-next-line default-case
839
- switch (key) {
840
- case 'ArrowLeft':
841
- if (isGrid) {
842
- navigation = 'PREVIOUS_COLUMN';
843
- } else if (state.direction === 'horizontal' || state.direction === 'both') {
844
- navigation = shouldLoopListHorizontally(state.direction, state.loopAround) && isFirst ? 'VERY_LAST' : 'PREVIOUS';
845
- }
846
- break;
847
- case 'ArrowRight':
848
- if (isGrid) {
849
- navigation = 'NEXT_COLUMN';
850
- } else if (state.direction === 'horizontal' || state.direction === 'both') {
851
- navigation = shouldLoopListHorizontally(state.direction, state.loopAround) && isLast ? 'VERY_FIRST' : 'NEXT';
852
- }
853
- break;
854
- case 'ArrowUp':
855
- if (isGrid) {
856
- navigation = 'PREVIOUS_ROW';
857
- } else if (state.direction === 'vertical' || state.direction === 'both') {
858
- navigation = shouldLoopListVertically(state.direction, state.loopAround) && isFirst ? 'VERY_LAST' : 'PREVIOUS';
859
- }
860
- break;
861
- case 'ArrowDown':
862
- if (isGrid) {
863
- navigation = 'NEXT_ROW';
864
- } else if (state.direction === 'vertical' || state.direction === 'both') {
865
- navigation = shouldLoopListVertically(state.direction, state.loopAround) && isLast ? 'VERY_FIRST' : 'NEXT';
866
- }
867
- break;
868
- case 'Home':
869
- if (isGrid && !ctrlKey) {
870
- navigation = state.gridJumpToShortcutDirection === 'vertical' ? 'FIRST_IN_COLUMN' : 'FIRST_IN_ROW';
871
- } else {
872
- navigation = 'VERY_FIRST';
873
- }
874
- break;
875
- case 'End':
876
- if (isGrid && !ctrlKey) {
877
- navigation = state.gridJumpToShortcutDirection === 'vertical' ? 'LAST_IN_COLUMN' : 'LAST_IN_ROW';
878
- } else {
879
- navigation = 'VERY_LAST';
880
- }
881
- break;
882
- }
883
- if (!navigation) {
884
- return state;
885
- }
886
- const newState = MOVES[navigation](state, currentTabStop, index);
887
- return {
888
- ...newState,
889
- isUsingKeyboard: true
890
- };
891
- };
892
-
893
- /** Determine the updated value for selectedId: */
894
- const getUpdatedSelectedId = (tabStops, currentSelectedId, defaultSelectedId = null) => {
895
- // Get tab stop by id
896
- const tabStop = currentSelectedId && tabStops.find(ts => ts.id === currentSelectedId && !ts.disabled);
897
- if (!tabStop) {
898
- // Fallback to default selected id if available, or first enabled tab stop if not
899
- return tabStops.find(ts => ts.id === defaultSelectedId)?.id || tabStops.find(tabStopIsEnabled)?.id || null;
900
- }
901
- return tabStop?.id || defaultSelectedId;
902
- };
903
-
904
- /** Handle `REGISTER_TAB_STOP` action registering a new tab stop. */
905
- const REGISTER_TAB_STOP = (state, action) => {
906
- const newTabStop = action.payload;
907
- const newTabStopElement = newTabStop.domElementRef.current;
908
- if (!newTabStopElement) {
909
- return state;
910
- }
911
-
912
- // Find index of tab stop that
913
- const indexToInsertAt = findLastIndex(state.tabStops, tabStop => {
914
- if (tabStop.id === newTabStop.id) {
915
- // tab stop already registered
916
- return false;
917
- }
918
- const domTabStop = tabStop.domElementRef.current;
919
-
920
- // New tab stop is following the current tab stop
921
- return domTabStop?.compareDocumentPosition(newTabStopElement) === Node.DOCUMENT_POSITION_FOLLOWING;
922
- });
923
- const insertIndex = indexToInsertAt + 1;
924
-
925
- // Insert new tab stop at position `indexToInsertAt`.
926
- const newTabStops = [...state.tabStops];
927
- newTabStops.splice(insertIndex, 0, newTabStop);
928
-
929
- // Handle autofocus if needed
930
- let {
931
- selectedId,
932
- allowFocusing
933
- } = state;
934
- if (state.autofocus === 'first' && insertIndex === 0 || state.autofocus === 'last' && insertIndex === newTabStops.length - 1 || newTabStop.autofocus) {
935
- allowFocusing = true;
936
- selectedId = newTabStop.id;
937
- }
938
- const newSelectedId = newTabStop.id === state.defaultSelectedId && !newTabStop.disabled ? newTabStop.id : getUpdatedSelectedId(newTabStops, selectedId, state.defaultSelectedId);
939
- return {
940
- ...state,
941
- /**
942
- * If the tab currently being registered is enabled and set as default selected,
943
- * set as selected.
944
- *
945
- */
946
- selectedId: newSelectedId,
947
- tabStops: newTabStops,
948
- gridMap: null,
949
- allowFocusing
950
- };
951
- };
952
-
953
- /** Handle `UNREGISTER_TAB_STOP` action un-registering a new tab stop. */
954
- const UNREGISTER_TAB_STOP = (state, action) => {
955
- const {
956
- id
957
- } = action.payload;
958
- const newTabStops = state.tabStops.filter(tabStop => tabStop.id !== id);
959
- if (newTabStops.length === state.tabStops.length) {
960
- // tab stop already unregistered
961
- return state;
962
- }
963
-
964
- /** Get the previous enabled tab stop */
965
- const previousTabStopIndex = state.tabStops.findIndex(tabStop => tabStop.id === state.selectedId && tabStopIsEnabled(tabStop));
966
- const newLocal = previousTabStopIndex - 1 > -1;
967
- const previousTabStop = newLocal ? findLast(newTabStops, tabStopIsEnabled, previousTabStopIndex - 1) : undefined;
968
- return {
969
- ...state,
970
- /** Set the focus on either the previous tab stop if found or the one set as default */
971
- selectedId: getUpdatedSelectedId(newTabStops, state.selectedId, previousTabStop?.id || state.defaultSelectedId),
972
- tabStops: newTabStops,
973
- gridMap: null
974
- };
975
- };
976
-
977
- /** Handle `UPDATE_TAB_STOP` action updating properties of a tab stop. */
978
- const UPDATE_TAB_STOP = (state, action) => {
979
- const {
980
- id,
981
- rowKey,
982
- disabled
983
- } = action.payload;
984
- const index = state.tabStops.findIndex(tabStop => tabStop.id === id);
985
- if (index === -1) {
986
- // tab stop not registered
987
- return state;
988
- }
989
- const tabStop = state.tabStops[index];
990
- if (tabStop.disabled === disabled && tabStop.rowKey === rowKey) {
991
- // Nothing to do so short-circuit.
992
- return state;
993
- }
994
- const newTabStop = {
995
- ...tabStop,
996
- rowKey,
997
- disabled
998
- };
999
- const newTabStops = [...state.tabStops];
1000
- newTabStops.splice(index, 1, newTabStop);
1001
- return {
1002
- ...state,
1003
- selectedId: getUpdatedSelectedId(newTabStops, state.selectedId, state.defaultSelectedId),
1004
- tabStops: newTabStops,
1005
- gridMap: null
1006
- };
1007
- };
1008
-
1009
- /** Handle `SELECT_TAB_STOP` action selecting a tab stop. */
1010
- const SELECT_TAB_STOP = (state, action) => {
1011
- const {
1012
- id,
1013
- type
1014
- } = action.payload;
1015
- const tabStop = state.tabStops.find(ts => ts.id === id);
1016
- if (!tabStop || tabStop.disabled) {
1017
- return state;
1018
- }
1019
- return {
1020
- ...state,
1021
- allowFocusing: true,
1022
- selectedId: tabStop.id,
1023
- isUsingKeyboard: type === 'keyboard'
1024
- };
1025
- };
1026
- const SET_ALLOW_FOCUSING = (state, action) => {
1027
- return {
1028
- ...state,
1029
- selectedId: getUpdatedSelectedId(state.tabStops, null, state.defaultSelectedId),
1030
- allowFocusing: action.payload.allow,
1031
- isUsingKeyboard: Boolean(action.payload.isKeyboardNavigation)
1032
- };
1033
- };
1034
-
1035
- /** Handle `RESET_SELECTED_TAB_STOP` action reseting the selected tab stop. */
1036
- const RESET_SELECTED_TAB_STOP = state => {
1037
- return {
1038
- ...state,
1039
- allowFocusing: false,
1040
- selectedId: getUpdatedSelectedId(state.tabStops, null, state.defaultSelectedId),
1041
- defaultSelectedId: getUpdatedSelectedId(state.tabStops, null, state.defaultSelectedId),
1042
- isUsingKeyboard: false
1043
- };
1044
- };
1045
-
1046
- const INITIAL_STATE = {
1047
- selectedId: null,
1048
- allowFocusing: false,
1049
- tabStops: [],
1050
- direction: 'horizontal',
1051
- loopAround: buildLoopAroundObject(false),
1052
- gridMap: null,
1053
- defaultSelectedId: null,
1054
- autofocus: undefined,
1055
- isUsingKeyboard: false
1056
- };
1057
- const OPTIONS_UPDATED = (state, action) => {
1058
- const {
1059
- autofocus
1060
- } = action.payload;
1061
- let {
1062
- selectedId,
1063
- allowFocusing
1064
- } = state;
1065
-
1066
- // Update selectedId when updating the `autofocus` option.
1067
- if (!state.autofocus && autofocus) {
1068
- if (autofocus === 'first') {
1069
- selectedId = state.tabStops.find(tabStopIsEnabled)?.id || null;
1070
- } else if (autofocus === 'last') {
1071
- selectedId = findLast(state.tabStops, tabStopIsEnabled)?.id || null;
1072
- }
1073
- allowFocusing = true;
1074
- }
1075
- return {
1076
- ...state,
1077
- ...action.payload,
1078
- selectedId,
1079
- allowFocusing: action.payload.allowFocusing || allowFocusing,
1080
- loopAround: buildLoopAroundObject(action.payload.loopAround)
1081
- };
1082
- };
1083
-
1084
- /** Reducers for each action type: */
1085
- const REDUCERS = {
1086
- REGISTER_TAB_STOP,
1087
- UNREGISTER_TAB_STOP,
1088
- UPDATE_TAB_STOP,
1089
- SELECT_TAB_STOP,
1090
- OPTIONS_UPDATED,
1091
- KEY_NAV,
1092
- SET_ALLOW_FOCUSING,
1093
- RESET_SELECTED_TAB_STOP
1094
- };
1095
-
1096
- /** Main reducer */
1097
- const reducer = (state, action) => {
1098
- return REDUCERS[action.type]?.(state, action) || state;
1099
- };
1100
-
1101
- const MovingFocusContext = /*#__PURE__*/React__default.createContext({
1102
- state: INITIAL_STATE,
1103
- dispatch: noop
1104
- });
1105
-
1106
- /**
1107
- * Creates a roving tabindex context.
1108
- */
1109
- const MovingFocusProvider = ({
1110
- children,
1111
- options
1112
- }) => {
1113
- const [state, dispatch] = React__default.useReducer(reducer, INITIAL_STATE, st => ({
1114
- ...st,
1115
- ...options,
1116
- direction: options?.direction || st.direction,
1117
- loopAround: buildLoopAroundObject(options?.loopAround),
1118
- selectedId: options?.defaultSelectedId || INITIAL_STATE.selectedId
1119
- }));
1120
- const isMounted = React__default.useRef(false);
1121
-
1122
- // Update the options whenever they change:
1123
- React__default.useEffect(() => {
1124
- // Skip update on mount (already up to date)
1125
- if (!isMounted.current) {
1126
- isMounted.current = true;
1127
- return;
1128
- }
1129
- dispatch({
1130
- type: 'OPTIONS_UPDATED',
1131
- payload: {
1132
- direction: options?.direction || INITIAL_STATE.direction,
1133
- loopAround: buildLoopAroundObject(options?.loopAround || INITIAL_STATE.loopAround),
1134
- defaultSelectedId: options?.defaultSelectedId || INITIAL_STATE.defaultSelectedId,
1135
- autofocus: options?.autofocus || INITIAL_STATE.autofocus,
1136
- allowFocusing: options?.allowFocusing || INITIAL_STATE.allowFocusing,
1137
- listKey: options?.listKey || INITIAL_STATE.listKey,
1138
- firstFocusDirection: options?.firstFocusDirection || INITIAL_STATE.firstFocusDirection,
1139
- gridJumpToShortcutDirection: options?.gridJumpToShortcutDirection || INITIAL_STATE.gridJumpToShortcutDirection
1140
- }
1141
- });
1142
- }, [isMounted, options?.allowFocusing, options?.autofocus, options?.defaultSelectedId, options?.direction, options?.loopAround, options?.listKey, options?.firstFocusDirection, options?.gridJumpToShortcutDirection]);
1143
-
1144
- // Create a cached object to use as the context value:
1145
- const context = React__default.useMemo(() => ({
1146
- state,
1147
- dispatch
1148
- }), [state]);
1149
- return /*#__PURE__*/jsx(MovingFocusContext.Provider, {
1150
- value: context,
1151
- children: children
1152
- });
1153
- };
1154
-
1155
- /**
1156
- * Hook options
1157
- */
1158
-
1159
- /**
1160
- * Hook to use in tab stop element of a virtual focus (ex: options of a listbox in a combobox).
1161
- *
1162
- * @returns true if the current tab stop has virtual focus
1163
- */
1164
- const useVirtualFocus = (id, domElementRef, disabled = false, rowKey = null, autofocus = false) => {
1165
- const isMounted = React__default.useRef(false);
1166
- const {
1167
- state,
1168
- dispatch
1169
- } = React__default.useContext(MovingFocusContext);
1170
-
1171
- // Register the tab stop on mount and unregister it on unmount:
1172
- React__default.useEffect(() => {
1173
- const {
1174
- current: domElement
1175
- } = domElementRef;
1176
- if (!domElement) {
1177
- return undefined;
1178
- }
1179
- // Select tab stop on click
1180
- const onClick = event => {
1181
- dispatch({
1182
- type: 'SELECT_TAB_STOP',
1183
- payload: {
1184
- id,
1185
- type: getPointerTypeFromEvent(event)
1186
- }
1187
- });
1188
- };
1189
- domElement.addEventListener('click', onClick);
1190
-
1191
- // Register tab stop in context
1192
- dispatch({
1193
- type: 'REGISTER_TAB_STOP',
1194
- payload: {
1195
- id,
1196
- domElementRef,
1197
- rowKey,
1198
- disabled,
1199
- autofocus
1200
- }
1201
- });
1202
- return () => {
1203
- domElement.removeEventListener('click', onClick);
1204
- dispatch({
1205
- type: 'UNREGISTER_TAB_STOP',
1206
- payload: {
1207
- id
1208
- }
1209
- });
1210
- };
1211
- },
1212
- /**
1213
- * Pass the list key as dependency to make tab stops
1214
- * re-register when it changes.
1215
- */
1216
- // eslint-disable-next-line react-hooks/exhaustive-deps
1217
- [state.listKey]);
1218
-
1219
- /*
1220
- * Update the tab stop data if `rowKey` or `disabled` change.
1221
- * The isMounted flag is used to prevent this effect running on mount, which is benign but redundant (as the
1222
- * REGISTER_TAB_STOP action would have just been dispatched).
1223
- */
1224
- React__default.useEffect(() => {
1225
- if (isMounted.current) {
1226
- dispatch({
1227
- type: 'UPDATE_TAB_STOP',
1228
- payload: {
1229
- id,
1230
- rowKey,
1231
- disabled
1232
- }
1233
- });
1234
- } else {
1235
- isMounted.current = true;
1236
- }
1237
- },
1238
- // eslint-disable-next-line react-hooks/exhaustive-deps
1239
- [disabled, rowKey]);
1240
- const isActive = id === state.selectedId;
1241
-
1242
- // Scroll element into view when highlighted
1243
- useEffect(() => {
1244
- const {
1245
- current
1246
- } = domElementRef;
1247
- if (isActive && current && current.scrollIntoView) {
1248
- /**
1249
- * In some cases, the selected item is contained in a popover
1250
- * that won't be immediately set in the correct position.
1251
- * Setting a small timeout before scroll the item into view
1252
- * leaves it time to settle at the correct position.
1253
- */
1254
- const timeout = setTimeout(() => {
1255
- current.scrollIntoView({
1256
- block: 'nearest'
1257
- });
1258
- }, 10);
1259
- return () => {
1260
- clearTimeout(timeout);
1261
- };
1262
- }
1263
- return undefined;
1264
- }, [domElementRef, isActive]);
1265
- const focused = isActive && state.allowFocusing;
1266
-
1267
- // Determine if the current tab stop is the currently active one:
1268
- return focused;
1269
- };
1270
-
1271
- /**
1272
- * Hook to use in a virtual focus parent (ex: `aria-activedescendant` on the input of a combobox).
1273
- * * @returns the id of the currently active tab stop (virtual focus)
1274
- */
1275
- const useVirtualFocusParent = ref => {
1276
- const {
1277
- state,
1278
- dispatch
1279
- } = React__default.useContext(MovingFocusContext);
1280
- React__default.useEffect(() => {
1281
- const {
1282
- current: element
1283
- } = ref;
1284
- if (!element) {
1285
- return undefined;
1286
- }
1287
- function handleKeyDown(evt) {
1288
- const eventKey = evt.key;
1289
- if (
1290
- // Don't move if the current direction doesn't allow key
1291
- !NAV_KEYS[state.direction].includes(eventKey) ||
1292
- // Don't move if alt key is pressed
1293
- evt.altKey ||
1294
- // Don't move the focus if it hasn't been set yet and `firstFocusDirection` doesn't allow key
1295
- !state.allowFocusing && state.firstFocusDirection && !NAV_KEYS[state.firstFocusDirection].includes(eventKey)) {
1296
- return;
1297
- }
1298
- // If focus isn't allowed yet, simply enable it to stay on first item
1299
- if (!state.allowFocusing && eventKey === 'ArrowDown') {
1300
- dispatch({
1301
- type: 'SET_ALLOW_FOCUSING',
1302
- payload: {
1303
- allow: true,
1304
- isKeyboardNavigation: true
1305
- }
1306
- });
1307
- } else {
1308
- dispatch({
1309
- type: 'KEY_NAV',
1310
- payload: {
1311
- key: eventKey,
1312
- ctrlKey: evt.ctrlKey
1313
- }
1314
- });
1315
- }
1316
- evt.preventDefault();
1317
- }
1318
- element.addEventListener('keydown', handleKeyDown);
1319
- return () => {
1320
- element.removeEventListener('keydown', handleKeyDown);
1321
- };
1322
- }, [dispatch, ref, state.allowFocusing, state.direction, state.firstFocusDirection]);
1323
- const focused = state.allowFocusing && state.selectedId || undefined;
1324
- return focused;
1325
- };
1326
-
1327
- /**
1328
- * A tuple of values to be applied by the containing component for the roving tabindex to work correctly.
1329
- */
1330
-
1331
- /**
1332
- * Includes the given DOM element in the current roving tabindex.
1333
- */
1334
- const useRovingTabIndex = (ref, disabled = false, rowKey = null, autofocus = false) => {
1335
- // Create a stable ID for the lifetime of the component:
1336
- const idRef = React__default.useRef(null);
1337
- function getId() {
1338
- if (!idRef.current) {
1339
- idRef.current = uniqueId('rti_');
1340
- }
1341
- return idRef.current;
1342
- }
1343
- const isMounted = React__default.useRef(false);
1344
- const {
1345
- dispatch,
1346
- state
1347
- } = React__default.useContext(MovingFocusContext);
1348
- const {
1349
- direction
1350
- } = state;
1351
-
1352
- // Register the tab stop on mount and unregister it on unmount:
1353
- React__default.useEffect(() => {
1354
- const id = getId();
1355
- dispatch({
1356
- type: 'REGISTER_TAB_STOP',
1357
- payload: {
1358
- id,
1359
- domElementRef: ref,
1360
- rowKey,
1361
- disabled,
1362
- autofocus
1363
- }
1364
- });
1365
- return () => {
1366
- dispatch({
1367
- type: 'UNREGISTER_TAB_STOP',
1368
- payload: {
1369
- id
1370
- }
1371
- });
1372
- };
1373
- },
1374
- // eslint-disable-next-line react-hooks/exhaustive-deps
1375
- [state.listKey]);
1376
-
1377
- /*
1378
- * Update the tab stop data if `rowIndex` or `disabled` change.
1379
- * The isMounted flag is used to prevent this effect running on mount, which is benign but redundant (as the
1380
- * REGISTER_TAB_STOP action would have just been dispatched).
1381
- */
1382
- React__default.useEffect(() => {
1383
- if (isMounted.current) {
1384
- dispatch({
1385
- type: 'UPDATE_TAB_STOP',
1386
- payload: {
1387
- id: getId(),
1388
- rowKey,
1389
- disabled
1390
- }
1391
- });
1392
- } else {
1393
- isMounted.current = true;
1394
- }
1395
- },
1396
- // eslint-disable-next-line react-hooks/exhaustive-deps
1397
- [rowKey, disabled]);
1398
-
1399
- // Create a stable callback function for handling key down events:
1400
- const handleKeyDown = React__default.useCallback(evt => {
1401
- const trueDirection = !isNil(rowKey) ? 'both' : direction;
1402
- if (!NAV_KEYS[trueDirection].includes(evt.key)) {
1403
- return;
1404
- }
1405
- dispatch({
1406
- type: 'KEY_NAV',
1407
- payload: {
1408
- id: getId(),
1409
- key: evt.key,
1410
- ctrlKey: evt.ctrlKey
1411
- }
1412
- });
1413
- evt.preventDefault();
1414
- evt.stopPropagation();
1415
- },
1416
- // eslint-disable-next-line react-hooks/exhaustive-deps
1417
- []);
1418
-
1419
- // Create a stable callback function for handling click events:
1420
- const handleClick = React__default.useCallback(event => {
1421
- dispatch({
1422
- type: 'SELECT_TAB_STOP',
1423
- payload: {
1424
- id: getId(),
1425
- type: getPointerTypeFromEvent(event)
1426
- }
1427
- });
1428
- },
1429
- // eslint-disable-next-line react-hooks/exhaustive-deps
1430
- []);
1431
-
1432
- // Determine if the current tab stop is the currently active one:
1433
- const selected = getId() === state.selectedId;
1434
- const tabIndex = selected ? 0 : -1;
1435
- const focused = selected && state.allowFocusing;
1436
- return [tabIndex, focused, handleKeyDown, handleClick];
1437
- };
1438
-
1439
- export { A11YLiveMessage, MovingFocusContext, MovingFocusProvider, useRovingTabIndex, useVirtualFocus, useVirtualFocusParent };
1440
- //# sourceMappingURL=index.js.map
1
+ import { DisabledStateProvider, useDisabledStateContext } from "../_internal/utils/disabled/DisabledStateContext.js";
2
+ import { ClickAwayProvider } from "../_internal/utils/ClickAwayProvider/ClickAwayProvider.js";
3
+ import { InfiniteScroll } from "../_internal/utils/InfiniteScroll/InfiniteScroll.js";
4
+ import { A11YLiveMessage } from "../_internal/utils/A11YLiveMessage/index.js";
5
+ import { PortalProvider } from "../_internal/utils/Portal/PortalProvider.js";
6
+ import { Portal } from "../_internal/utils/Portal/Portal.js";
7
+ import { MovingFocusContext } from "../_internal/utils/moving-focus/components/MovingFocusProvider/context.js";
8
+ import { MovingFocusProvider } from "../_internal/utils/moving-focus/components/MovingFocusProvider/index.js";
9
+ import { useVirtualFocus } from "../_internal/utils/moving-focus/hooks/useVirtualFocus/useVirtualFocus.js";
10
+ import { useVirtualFocusParent } from "../_internal/utils/moving-focus/hooks/useVirtualFocus/useVirtualFocusParent.js";
11
+ import { useRovingTabIndex } from "../_internal/utils/moving-focus/hooks/useRovingTabIndex/useRovingTabIndex.js";
12
+ export { A11YLiveMessage, ClickAwayProvider, DisabledStateProvider, InfiniteScroll, MovingFocusContext, MovingFocusProvider, Portal, PortalProvider, useDisabledStateContext, useRovingTabIndex, useVirtualFocus, useVirtualFocusParent };