@lumx/react 3.0.2 → 3.0.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 (391) hide show
  1. package/{esm/_internal/_rollupPluginBabelHelpers.js → _internal/ClickAwayProvider.js} +107 -2
  2. package/_internal/ClickAwayProvider.js.map +1 -0
  3. package/_internal/types.d.ts +271 -0
  4. package/index.d.ts +2686 -0
  5. package/index.js +12533 -0
  6. package/index.js.map +1 -0
  7. package/package.json +7 -6
  8. package/src/components/alert-dialog/AlertDialog.tsx +2 -1
  9. package/src/components/autocomplete/Autocomplete.tsx +2 -2
  10. package/src/components/autocomplete/AutocompleteMultiple.tsx +2 -1
  11. package/src/components/avatar/Avatar.tsx +2 -1
  12. package/src/components/badge/Badge.test.tsx +1 -1
  13. package/src/components/badge/Badge.tsx +2 -1
  14. package/src/components/button/Button.test.tsx +1 -1
  15. package/src/components/button/Button.tsx +2 -1
  16. package/src/components/button/ButtonGroup.tsx +2 -1
  17. package/src/components/button/ButtonRoot.test.tsx +1 -1
  18. package/src/components/button/ButtonRoot.tsx +2 -1
  19. package/src/components/button/IconButton.tsx +2 -1
  20. package/src/components/checkbox/Checkbox.test.tsx +1 -1
  21. package/src/components/checkbox/Checkbox.tsx +2 -1
  22. package/src/components/chip/Chip.test.tsx +1 -1
  23. package/src/components/chip/Chip.tsx +3 -1
  24. package/src/components/chip/ChipGroup.tsx +2 -1
  25. package/src/components/comment-block/CommentBlock.tsx +2 -1
  26. package/src/components/date-picker/DatePicker.tsx +1 -1
  27. package/src/components/date-picker/DatePickerControlled.tsx +1 -1
  28. package/src/components/date-picker/DatePickerField.tsx +1 -1
  29. package/src/components/date-picker/constants.ts +1 -1
  30. package/src/components/date-picker/types.ts +1 -1
  31. package/src/components/dialog/Dialog.tsx +4 -8
  32. package/src/components/divider/Divider.test.tsx +1 -1
  33. package/src/components/divider/Divider.tsx +3 -2
  34. package/src/components/drag-handle/DragHandle.tsx +2 -1
  35. package/src/components/dropdown/Dropdown.tsx +2 -1
  36. package/src/components/expansion-panel/ExpansionPanel.test.tsx +1 -1
  37. package/src/components/expansion-panel/ExpansionPanel.tsx +3 -10
  38. package/src/components/flag/Flag.test.tsx +1 -1
  39. package/src/components/flag/Flag.tsx +2 -1
  40. package/src/components/flex-box/FlexBox.stories.tsx +8 -0
  41. package/src/components/flex-box/FlexBox.tsx +7 -3
  42. package/src/components/flex-box/__snapshots__/FlexBox.test.tsx.snap +16 -0
  43. package/src/components/generic-block/GenericBlock.stories.jsx +23 -1
  44. package/src/components/generic-block/GenericBlock.tsx +18 -4
  45. package/src/components/generic-block/constants.ts +9 -0
  46. package/src/components/generic-block/index.ts +1 -0
  47. package/src/components/grid/Grid.tsx +2 -1
  48. package/src/components/grid/GridItem.tsx +2 -1
  49. package/src/components/heading/Heading.tsx +2 -1
  50. package/src/components/heading/HeadingLevelProvider.tsx +1 -1
  51. package/src/components/heading/context.tsx +1 -1
  52. package/src/components/icon/Icon.test.tsx +1 -1
  53. package/src/components/icon/Icon.tsx +2 -1
  54. package/src/components/image-block/ImageBlock.tsx +2 -1
  55. package/src/components/index.ts +1 -1
  56. package/src/components/inline-list/InlineList.stories.tsx +40 -0
  57. package/src/components/inline-list/InlineList.test.tsx +41 -0
  58. package/src/components/inline-list/InlineList.tsx +80 -0
  59. package/src/components/inline-list/index.ts +1 -0
  60. package/src/components/input-helper/InputHelper.tsx +2 -1
  61. package/src/components/input-label/InputLabel.tsx +2 -1
  62. package/src/components/lightbox/Lightbox.tsx +2 -1
  63. package/src/components/link/Link.tsx +2 -1
  64. package/src/components/link-preview/LinkPreview.test.tsx +1 -1
  65. package/src/components/link-preview/LinkPreview.tsx +2 -1
  66. package/src/components/list/List.tsx +2 -1
  67. package/src/components/list/ListDivider.tsx +2 -1
  68. package/src/components/list/ListItem.tsx +3 -8
  69. package/src/components/list/ListSubheader.tsx +2 -1
  70. package/src/components/list/useInteractiveList.tsx +1 -1
  71. package/src/components/message/Message.test.tsx +1 -1
  72. package/src/components/message/Message.tsx +2 -1
  73. package/src/components/mosaic/Mosaic.tsx +2 -1
  74. package/src/components/notification/Notification.tsx +2 -1
  75. package/src/components/popover/Popover.tsx +2 -1
  76. package/src/components/post-block/PostBlock.tsx +2 -1
  77. package/src/components/progress/Progress.tsx +2 -1
  78. package/src/components/progress-tracker/ProgressTracker.tsx +2 -1
  79. package/src/components/progress-tracker/ProgressTrackerStep.test.tsx +1 -1
  80. package/src/components/progress-tracker/ProgressTrackerStep.tsx +2 -1
  81. package/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +2 -1
  82. package/src/components/radio-button/RadioButton.test.tsx +1 -1
  83. package/src/components/radio-button/RadioButton.tsx +2 -1
  84. package/src/components/radio-button/RadioGroup.tsx +2 -1
  85. package/src/components/select/Select.test.tsx +1 -1
  86. package/src/components/select/Select.tsx +2 -1
  87. package/src/components/select/SelectMultiple.test.tsx +1 -1
  88. package/src/components/select/SelectMultiple.tsx +2 -1
  89. package/src/components/select/WithSelectContext.tsx +1 -1
  90. package/src/components/select/constants.ts +1 -1
  91. package/src/components/side-navigation/SideNavigation.tsx +2 -1
  92. package/src/components/side-navigation/SideNavigationItem.test.tsx +1 -1
  93. package/src/components/side-navigation/SideNavigationItem.tsx +3 -9
  94. package/src/components/skeleton/SkeletonCircle.tsx +2 -1
  95. package/src/components/skeleton/SkeletonRectangle.tsx +2 -1
  96. package/src/components/skeleton/SkeletonTypography.tsx +2 -1
  97. package/src/components/slider/Slider.tsx +2 -1
  98. package/src/components/slideshow/Slides.tsx +2 -1
  99. package/src/components/slideshow/Slideshow.tsx +1 -1
  100. package/src/components/slideshow/SlideshowControls.tsx +2 -1
  101. package/src/components/slideshow/SlideshowItem.tsx +2 -1
  102. package/src/components/slideshow/SlideshowItemGroup.tsx +2 -1
  103. package/src/components/switch/Switch.test.tsx +1 -1
  104. package/src/components/switch/Switch.tsx +2 -1
  105. package/src/components/table/Table.tsx +2 -1
  106. package/src/components/table/TableBody.tsx +2 -1
  107. package/src/components/table/TableCell.tsx +3 -1
  108. package/src/components/table/TableHeader.tsx +2 -1
  109. package/src/components/table/TableRow.tsx +2 -1
  110. package/src/components/tabs/Tab.test.tsx +1 -1
  111. package/src/components/tabs/Tab.tsx +2 -1
  112. package/src/components/tabs/TabList.test.tsx +1 -1
  113. package/src/components/tabs/TabList.tsx +2 -1
  114. package/src/components/tabs/TabPanel.tsx +2 -1
  115. package/src/components/text/{Text.stories.tsx → Text.stories.jsx} +23 -28
  116. package/src/components/text/Text.test.tsx +15 -1
  117. package/src/components/text/Text.tsx +38 -12
  118. package/src/components/text-field/TextField.test.tsx +1 -1
  119. package/src/components/text-field/TextField.tsx +2 -1
  120. package/src/components/thumbnail/Thumbnail.tsx +2 -1
  121. package/src/components/thumbnail/types.ts +1 -1
  122. package/src/components/toolbar/Toolbar.tsx +2 -1
  123. package/src/components/tooltip/Tooltip.tsx +2 -1
  124. package/src/components/tooltip/useTooltipOpen.tsx +1 -1
  125. package/src/components/uploader/Uploader.test.tsx +1 -1
  126. package/src/components/uploader/Uploader.tsx +2 -1
  127. package/src/components/user-block/UserBlock.tsx +2 -1
  128. package/src/hooks/useCallbackOnEscape.ts +2 -1
  129. package/src/hooks/useClickAway.tsx +1 -1
  130. package/src/hooks/useDisableBodyScroll.ts +1 -1
  131. package/src/hooks/useFocusTrap.ts +1 -1
  132. package/src/hooks/useInterval.tsx +1 -1
  133. package/src/hooks/useOnResize.ts +1 -1
  134. package/src/index.ts +5 -0
  135. package/src/stories/generated/GenericBlock/Demos.stories.tsx +3 -1
  136. package/src/stories/generated/Heading/Demos.stories.tsx +6 -0
  137. package/src/stories/withResizableBox.tsx +18 -0
  138. package/src/testing/utils/commonTestsSuite.ts +1 -1
  139. package/src/utils/{getRootClassName.ts → className.ts} +19 -0
  140. package/src/utils/event.ts +1 -0
  141. package/src/utils/index.ts +5 -0
  142. package/src/utils/type.ts +3 -0
  143. package/src/utils/utils.test.ts +1 -1
  144. package/types.d.ts +68 -11
  145. package/utils/index.d.ts +29 -0
  146. package/utils/index.js +2 -0
  147. package/utils/index.js.map +1 -0
  148. package/esm/_internal/AlertDialog.js +0 -141
  149. package/esm/_internal/AlertDialog.js.map +0 -1
  150. package/esm/_internal/AutocompleteMultiple.js +0 -257
  151. package/esm/_internal/AutocompleteMultiple.js.map +0 -1
  152. package/esm/_internal/Avatar2.js +0 -82
  153. package/esm/_internal/Avatar2.js.map +0 -1
  154. package/esm/_internal/Badge2.js +0 -54
  155. package/esm/_internal/Badge2.js.map +0 -1
  156. package/esm/_internal/Button2.js +0 -84
  157. package/esm/_internal/Button2.js.map +0 -1
  158. package/esm/_internal/ButtonGroup.js +0 -51
  159. package/esm/_internal/ButtonGroup.js.map +0 -1
  160. package/esm/_internal/ButtonRoot.js +0 -135
  161. package/esm/_internal/ButtonRoot.js.map +0 -1
  162. package/esm/_internal/Checkbox2.js +0 -116
  163. package/esm/_internal/Checkbox2.js.map +0 -1
  164. package/esm/_internal/Chip2.js +0 -118
  165. package/esm/_internal/Chip2.js.map +0 -1
  166. package/esm/_internal/ChipGroup.js +0 -122
  167. package/esm/_internal/ChipGroup.js.map +0 -1
  168. package/esm/_internal/ClickAwayProvider.js +0 -217
  169. package/esm/_internal/ClickAwayProvider.js.map +0 -1
  170. package/esm/_internal/CommentBlock.js +0 -124
  171. package/esm/_internal/CommentBlock.js.map +0 -1
  172. package/esm/_internal/DatePickerField.js +0 -347
  173. package/esm/_internal/DatePickerField.js.map +0 -1
  174. package/esm/_internal/Dialog2.js +0 -274
  175. package/esm/_internal/Dialog2.js.map +0 -1
  176. package/esm/_internal/Divider2.js +0 -53
  177. package/esm/_internal/Divider2.js.map +0 -1
  178. package/esm/_internal/DragHandle.js +0 -50
  179. package/esm/_internal/DragHandle.js.map +0 -1
  180. package/esm/_internal/Dropdown2.js +0 -157
  181. package/esm/_internal/Dropdown2.js.map +0 -1
  182. package/esm/_internal/ExpansionPanel.js +0 -156
  183. package/esm/_internal/ExpansionPanel.js.map +0 -1
  184. package/esm/_internal/Flag2.js +0 -48
  185. package/esm/_internal/Flag2.js.map +0 -1
  186. package/esm/_internal/FlexBox.js +0 -55
  187. package/esm/_internal/FlexBox.js.map +0 -1
  188. package/esm/_internal/GenericBlock.js +0 -125
  189. package/esm/_internal/GenericBlock.js.map +0 -1
  190. package/esm/_internal/GridItem.js +0 -96
  191. package/esm/_internal/GridItem.js.map +0 -1
  192. package/esm/_internal/HeadingLevelProvider.js +0 -112
  193. package/esm/_internal/HeadingLevelProvider.js.map +0 -1
  194. package/esm/_internal/Icon2.js +0 -120
  195. package/esm/_internal/Icon2.js.map +0 -1
  196. package/esm/_internal/IconButton.js +0 -74
  197. package/esm/_internal/IconButton.js.map +0 -1
  198. package/esm/_internal/ImageBlock.js +0 -101
  199. package/esm/_internal/ImageBlock.js.map +0 -1
  200. package/esm/_internal/InputHelper.js +0 -72
  201. package/esm/_internal/InputHelper.js.map +0 -1
  202. package/esm/_internal/InputLabel.js +0 -58
  203. package/esm/_internal/InputLabel.js.map +0 -1
  204. package/esm/_internal/Lightbox2.js +0 -123
  205. package/esm/_internal/Lightbox2.js.map +0 -1
  206. package/esm/_internal/Link2.js +0 -122
  207. package/esm/_internal/Link2.js.map +0 -1
  208. package/esm/_internal/LinkPreview.js +0 -105
  209. package/esm/_internal/LinkPreview.js.map +0 -1
  210. package/esm/_internal/List2.js +0 -799
  211. package/esm/_internal/List2.js.map +0 -1
  212. package/esm/_internal/ListSubheader.js +0 -79
  213. package/esm/_internal/ListSubheader.js.map +0 -1
  214. package/esm/_internal/Message2.js +0 -78
  215. package/esm/_internal/Message2.js.map +0 -1
  216. package/esm/_internal/Mosaic2.js +0 -89
  217. package/esm/_internal/Mosaic2.js.map +0 -1
  218. package/esm/_internal/Notification2.js +0 -133
  219. package/esm/_internal/Notification2.js.map +0 -1
  220. package/esm/_internal/Popover2.js +0 -2473
  221. package/esm/_internal/Popover2.js.map +0 -1
  222. package/esm/_internal/PostBlock.js +0 -96
  223. package/esm/_internal/PostBlock.js.map +0 -1
  224. package/esm/_internal/Progress2.js +0 -81
  225. package/esm/_internal/Progress2.js.map +0 -1
  226. package/esm/_internal/ProgressTrackerStepPanel.js +0 -313
  227. package/esm/_internal/ProgressTrackerStepPanel.js.map +0 -1
  228. package/esm/_internal/RadioGroup.js +0 -147
  229. package/esm/_internal/RadioGroup.js.map +0 -1
  230. package/esm/_internal/SelectMultiple.js +0 -424
  231. package/esm/_internal/SelectMultiple.js.map +0 -1
  232. package/esm/_internal/SideNavigationItem.js +0 -151
  233. package/esm/_internal/SideNavigationItem.js.map +0 -1
  234. package/esm/_internal/SkeletonTypography.js +0 -168
  235. package/esm/_internal/SkeletonTypography.js.map +0 -1
  236. package/esm/_internal/Slider2.js +0 -327
  237. package/esm/_internal/Slider2.js.map +0 -1
  238. package/esm/_internal/Slides.js +0 -864
  239. package/esm/_internal/Slides.js.map +0 -1
  240. package/esm/_internal/Switch2.js +0 -116
  241. package/esm/_internal/Switch2.js.map +0 -1
  242. package/esm/_internal/TabPanel.js +0 -280
  243. package/esm/_internal/TabPanel.js.map +0 -1
  244. package/esm/_internal/TableRow.js +0 -291
  245. package/esm/_internal/TableRow.js.map +0 -1
  246. package/esm/_internal/Text2.js +0 -63
  247. package/esm/_internal/Text2.js.map +0 -1
  248. package/esm/_internal/TextField.js +0 -322
  249. package/esm/_internal/TextField.js.map +0 -1
  250. package/esm/_internal/Thumbnail2.js +0 -301
  251. package/esm/_internal/Thumbnail2.js.map +0 -1
  252. package/esm/_internal/Toolbar2.js +0 -60
  253. package/esm/_internal/Toolbar2.js.map +0 -1
  254. package/esm/_internal/Tooltip2.js +0 -282
  255. package/esm/_internal/Tooltip2.js.map +0 -1
  256. package/esm/_internal/Uploader2.js +0 -84
  257. package/esm/_internal/Uploader2.js.map +0 -1
  258. package/esm/_internal/UserBlock.js +0 -132
  259. package/esm/_internal/UserBlock.js.map +0 -1
  260. package/esm/_internal/_rollupPluginBabelHelpers.js.map +0 -1
  261. package/esm/_internal/alert-dialog.js +0 -34
  262. package/esm/_internal/alert-dialog.js.map +0 -1
  263. package/esm/_internal/autocomplete.js +0 -32
  264. package/esm/_internal/autocomplete.js.map +0 -1
  265. package/esm/_internal/avatar.js +0 -13
  266. package/esm/_internal/avatar.js.map +0 -1
  267. package/esm/_internal/badge.js +0 -10
  268. package/esm/_internal/badge.js.map +0 -1
  269. package/esm/_internal/button.js +0 -25
  270. package/esm/_internal/button.js.map +0 -1
  271. package/esm/_internal/checkbox.js +0 -14
  272. package/esm/_internal/checkbox.js.map +0 -1
  273. package/esm/_internal/chip.js +0 -12
  274. package/esm/_internal/chip.js.map +0 -1
  275. package/esm/_internal/comment-block.js +0 -24
  276. package/esm/_internal/comment-block.js.map +0 -1
  277. package/esm/_internal/components.js +0 -156
  278. package/esm/_internal/components.js.map +0 -1
  279. package/esm/_internal/constants.js +0 -13
  280. package/esm/_internal/constants.js.map +0 -1
  281. package/esm/_internal/date-picker.js +0 -32
  282. package/esm/_internal/date-picker.js.map +0 -1
  283. package/esm/_internal/dialog.js +0 -27
  284. package/esm/_internal/dialog.js.map +0 -1
  285. package/esm/_internal/divider.js +0 -10
  286. package/esm/_internal/divider.js.map +0 -1
  287. package/esm/_internal/drag-handle.js +0 -11
  288. package/esm/_internal/drag-handle.js.map +0 -1
  289. package/esm/_internal/dropdown.js +0 -21
  290. package/esm/_internal/dropdown.js.map +0 -1
  291. package/esm/_internal/expansion-panel.js +0 -32
  292. package/esm/_internal/expansion-panel.js.map +0 -1
  293. package/esm/_internal/flag.js +0 -11
  294. package/esm/_internal/flag.js.map +0 -1
  295. package/esm/_internal/flex-box.js +0 -11
  296. package/esm/_internal/flex-box.js.map +0 -1
  297. package/esm/_internal/generic-block.js +0 -20
  298. package/esm/_internal/generic-block.js.map +0 -1
  299. package/esm/_internal/getRootClassName.js +0 -346
  300. package/esm/_internal/getRootClassName.js.map +0 -1
  301. package/esm/_internal/grid.js +0 -10
  302. package/esm/_internal/grid.js.map +0 -1
  303. package/esm/_internal/heading.js +0 -11
  304. package/esm/_internal/heading.js.map +0 -1
  305. package/esm/_internal/icon.js +0 -10
  306. package/esm/_internal/icon.js.map +0 -1
  307. package/esm/_internal/image-block.js +0 -14
  308. package/esm/_internal/image-block.js.map +0 -1
  309. package/esm/_internal/input-helper.js +0 -10
  310. package/esm/_internal/input-helper.js.map +0 -1
  311. package/esm/_internal/input-label.js +0 -10
  312. package/esm/_internal/input-label.js.map +0 -1
  313. package/esm/_internal/lightbox.js +0 -27
  314. package/esm/_internal/lightbox.js.map +0 -1
  315. package/esm/_internal/link-preview.js +0 -15
  316. package/esm/_internal/link-preview.js.map +0 -1
  317. package/esm/_internal/link.js +0 -12
  318. package/esm/_internal/link.js.map +0 -1
  319. package/esm/_internal/list.js +0 -15
  320. package/esm/_internal/list.js.map +0 -1
  321. package/esm/_internal/mergeRefs.js +0 -25
  322. package/esm/_internal/mergeRefs.js.map +0 -1
  323. package/esm/_internal/message.js +0 -11
  324. package/esm/_internal/message.js.map +0 -1
  325. package/esm/_internal/mosaic.js +0 -14
  326. package/esm/_internal/mosaic.js.map +0 -1
  327. package/esm/_internal/notification.js +0 -18
  328. package/esm/_internal/notification.js.map +0 -1
  329. package/esm/_internal/partitionMulti.js +0 -27
  330. package/esm/_internal/partitionMulti.js.map +0 -1
  331. package/esm/_internal/popover.js +0 -15
  332. package/esm/_internal/popover.js.map +0 -1
  333. package/esm/_internal/post-block.js +0 -15
  334. package/esm/_internal/post-block.js.map +0 -1
  335. package/esm/_internal/progress-tracker.js +0 -17
  336. package/esm/_internal/progress-tracker.js.map +0 -1
  337. package/esm/_internal/progress.js +0 -10
  338. package/esm/_internal/progress.js.map +0 -1
  339. package/esm/_internal/radio-button.js +0 -13
  340. package/esm/_internal/radio-button.js.map +0 -1
  341. package/esm/_internal/renderLink.js +0 -25
  342. package/esm/_internal/renderLink.js.map +0 -1
  343. package/esm/_internal/select.js +0 -31
  344. package/esm/_internal/select.js.map +0 -1
  345. package/esm/_internal/side-navigation.js +0 -25
  346. package/esm/_internal/side-navigation.js.map +0 -1
  347. package/esm/_internal/skeleton.js +0 -10
  348. package/esm/_internal/skeleton.js.map +0 -1
  349. package/esm/_internal/slider.js +0 -13
  350. package/esm/_internal/slider.js.map +0 -1
  351. package/esm/_internal/slideshow.js +0 -29
  352. package/esm/_internal/slideshow.js.map +0 -1
  353. package/esm/_internal/state.js +0 -145
  354. package/esm/_internal/state.js.map +0 -1
  355. package/esm/_internal/switch.js +0 -13
  356. package/esm/_internal/switch.js.map +0 -1
  357. package/esm/_internal/table.js +0 -12
  358. package/esm/_internal/table.js.map +0 -1
  359. package/esm/_internal/tabs.js +0 -15
  360. package/esm/_internal/tabs.js.map +0 -1
  361. package/esm/_internal/text-field.js +0 -26
  362. package/esm/_internal/text-field.js.map +0 -1
  363. package/esm/_internal/text.js +0 -10
  364. package/esm/_internal/text.js.map +0 -1
  365. package/esm/_internal/thumbnail.js +0 -13
  366. package/esm/_internal/thumbnail.js.map +0 -1
  367. package/esm/_internal/toolbar.js +0 -9
  368. package/esm/_internal/toolbar.js.map +0 -1
  369. package/esm/_internal/tooltip.js +0 -18
  370. package/esm/_internal/tooltip.js.map +0 -1
  371. package/esm/_internal/type.js +0 -40
  372. package/esm/_internal/type.js.map +0 -1
  373. package/esm/_internal/types.js +0 -23
  374. package/esm/_internal/types.js.map +0 -1
  375. package/esm/_internal/uploader.js +0 -11
  376. package/esm/_internal/uploader.js.map +0 -1
  377. package/esm/_internal/useDelayedVisibility.js +0 -47
  378. package/esm/_internal/useDelayedVisibility.js.map +0 -1
  379. package/esm/_internal/useDisableBodyScroll.js +0 -220
  380. package/esm/_internal/useDisableBodyScroll.js.map +0 -1
  381. package/esm/_internal/useFocusTrap.js +0 -86
  382. package/esm/_internal/useFocusTrap.js.map +0 -1
  383. package/esm/_internal/useRovingTabIndex.js +0 -87
  384. package/esm/_internal/useRovingTabIndex.js.map +0 -1
  385. package/esm/_internal/user-block.js +0 -17
  386. package/esm/_internal/user-block.js.map +0 -1
  387. package/esm/index.js +0 -95
  388. package/esm/index.js.map +0 -1
  389. package/esm/index2.js +0 -16
  390. package/esm/index2.js.map +0 -1
  391. package/src/utils/index.tsx +0 -7
@@ -1,864 +0,0 @@
1
- import { d as _slicedToArray, b as _objectWithoutProperties, c as _extends, _ as _objectSpread2, a as _defineProperty } from './_rollupPluginBabelHelpers.js';
2
- import { Theme, Emphasis } from './components.js';
3
- import React, { useRef, useEffect, useState, useCallback, useMemo, forwardRef, Children } from 'react';
4
- import { g as getRootClassName, c as classnames, h as handleBasicClasses, e as detectHorizontalSwipe } from './getRootClassName.js';
5
- import { g as mdiChevronLeft, p as mdiPauseCircleOutline, q as mdiPlayCircleOutline, f as mdiChevronRight } from './Icon2.js';
6
- import { W as WINDOW } from './constants.js';
7
- import { b as useFocusWithin } from './Popover2.js';
8
- import { m as mergeRefs } from './mergeRefs.js';
9
- import { I as IconButton } from './IconButton.js';
10
- import isFunction from 'lodash/isFunction';
11
- import range from 'lodash/range';
12
- import { a as getFocusableElements } from './ClickAwayProvider.js';
13
- import { u as useRovingTabIndex } from './useRovingTabIndex.js';
14
- import uniqueId from 'lodash/uniqueId';
15
- import chunk from 'lodash/chunk';
16
-
17
- /**
18
- * Making setInterval Declarative with React Hooks.
19
- * Credits: https://overreacted.io/making-setinterval-declarative-with-react-hooks/
20
- *
21
- * @param callback Function called by setInterval.
22
- * @param delay Delay for setInterval.
23
- */
24
- function useInterval(callback, delay) {
25
- var savedCallback = useRef();
26
- useEffect(function () {
27
- savedCallback.current = callback;
28
- });
29
- useEffect(function () {
30
- if (delay === null) return undefined;
31
-
32
- function tick() {
33
- if (isFunction(savedCallback.current)) {
34
- savedCallback.current();
35
- }
36
- }
37
-
38
- var id = setInterval(tick, delay);
39
- return function () {
40
- return clearInterval(id);
41
- };
42
- }, [delay]);
43
- }
44
-
45
- /**
46
- * Autoplay default interval in ms.
47
- */
48
- var AUTOPLAY_DEFAULT_INTERVAL = 5000;
49
- /**
50
- * Full width size in percent.
51
- */
52
-
53
- var FULL_WIDTH_PERCENT = 100;
54
- /**
55
- * Edge from the active index.
56
- */
57
-
58
- var EDGE_FROM_ACTIVE_INDEX = 2;
59
- /**
60
- * Max number of pagination items.
61
- */
62
-
63
- var PAGINATION_ITEMS_MAX = 5;
64
- /**
65
- * Size of a pagination item. Used to translate wrapper.
66
- */
67
-
68
- var PAGINATION_ITEM_SIZE = 12;
69
-
70
- var DEFAULT_OPTIONS = {
71
- activeIndex: 0,
72
- groupBy: 1,
73
- interval: AUTOPLAY_DEFAULT_INTERVAL
74
- };
75
- var useSlideshowControls = function useSlideshowControls(_ref) {
76
- var _ref$activeIndex = _ref.activeIndex,
77
- activeIndex = _ref$activeIndex === void 0 ? DEFAULT_OPTIONS.activeIndex : _ref$activeIndex,
78
- _ref$groupBy = _ref.groupBy,
79
- groupBy = _ref$groupBy === void 0 ? DEFAULT_OPTIONS.groupBy : _ref$groupBy,
80
- _ref$interval = _ref.interval,
81
- interval = _ref$interval === void 0 ? DEFAULT_OPTIONS.interval : _ref$interval,
82
- autoPlay = _ref.autoPlay,
83
- defaultActiveIndex = _ref.defaultActiveIndex,
84
- onChange = _ref.onChange,
85
- itemsCount = _ref.itemsCount,
86
- id = _ref.id,
87
- slidesId = _ref.slidesId;
88
-
89
- var _useState = useState(activeIndex),
90
- _useState2 = _slicedToArray(_useState, 2),
91
- currentIndex = _useState2[0],
92
- setCurrentIndex = _useState2[1]; // Use state instead of a ref to make the slideshow controls update directly when the element is set.
93
-
94
-
95
- var _useState3 = useState(null),
96
- _useState4 = _slicedToArray(_useState3, 2),
97
- element = _useState4[0],
98
- setElement = _useState4[1]; // Number of slides when using groupBy prop.
99
-
100
-
101
- var slidesCount = Math.ceil(itemsCount / Math.min(groupBy, itemsCount)); // Change current index to display next slide.
102
-
103
- var goToNextSlide = useCallback(function () {
104
- var loopback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
105
- setCurrentIndex(function (index) {
106
- if (loopback && index === slidesCount - 1) {
107
- // Loopback to the start.
108
- return 0;
109
- }
110
-
111
- if (index < slidesCount - 1) {
112
- // Next slide.
113
- return index + 1;
114
- }
115
-
116
- return index;
117
- });
118
- }, [slidesCount, setCurrentIndex]); // Change current index to display previous slide.
119
-
120
- var goToPreviousSlide = useCallback(function () {
121
- var loopback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
122
- setCurrentIndex(function (index) {
123
- if (loopback && index === 0) {
124
- // Loopback to the end.
125
- return slidesCount - 1;
126
- }
127
-
128
- if (index > 0) {
129
- // Previous slide.
130
- return index - 1;
131
- }
132
-
133
- return index;
134
- });
135
- }, [slidesCount, setCurrentIndex]); // Auto play
136
-
137
- var _useState5 = useState(Boolean(autoPlay)),
138
- _useState6 = _slicedToArray(_useState5, 2),
139
- isAutoPlaying = _useState6[0],
140
- setIsAutoPlaying = _useState6[1];
141
-
142
- var _useState7 = useState(false),
143
- _useState8 = _slicedToArray(_useState7, 2),
144
- isForcePaused = _useState8[0],
145
- setIsForcePaused = _useState8[1];
146
-
147
- var isSlideshowAutoPlaying = isForcePaused ? false : isAutoPlaying; // Start
148
-
149
- useInterval(goToNextSlide, isSlideshowAutoPlaying && slidesCount > 1 ? interval : null); // Reset current index if it become invalid.
150
-
151
- useEffect(function () {
152
- if (currentIndex > slidesCount - 1) {
153
- setCurrentIndex(defaultActiveIndex);
154
- }
155
- }, [currentIndex, slidesCount, defaultActiveIndex]);
156
-
157
- var startAutoPlay = function startAutoPlay() {
158
- setIsAutoPlaying(Boolean(autoPlay));
159
- };
160
-
161
- var stopAutoPlay = function stopAutoPlay() {
162
- setIsAutoPlaying(false);
163
- }; // Handle click on a bullet to go to a specific slide.
164
-
165
-
166
- var onPaginationClick = useCallback(function (index) {
167
- stopAutoPlay();
168
- setIsForcePaused(true);
169
-
170
- if (index >= 0 && index < slidesCount) {
171
- setCurrentIndex(index);
172
- }
173
- }, [slidesCount, setCurrentIndex]); // Handle click or keyboard event to go to next slide.
174
-
175
- var onNextClick = useCallback(function () {
176
- var loopback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
177
- stopAutoPlay();
178
- setIsForcePaused(true);
179
- goToNextSlide(loopback);
180
- }, [goToNextSlide]); // Handle click or keyboard event to go to previous slide.
181
-
182
- var onPreviousClick = useCallback(function () {
183
- var loopback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
184
- stopAutoPlay();
185
- setIsForcePaused(true);
186
- goToPreviousSlide(loopback);
187
- }, [goToPreviousSlide]); // If the activeIndex props changes, update the current slide
188
-
189
- useEffect(function () {
190
- setCurrentIndex(activeIndex);
191
- }, [activeIndex]); // If the slide changes, with autoplay for example, trigger "onChange"
192
-
193
- useEffect(function () {
194
- if (!onChange) return;
195
- onChange(currentIndex);
196
- }, [currentIndex, onChange]);
197
- var slideshowId = useMemo(function () {
198
- return id || uniqueId('slideshow');
199
- }, [id]);
200
- var slideshowSlidesId = useMemo(function () {
201
- return slidesId || uniqueId('slideshow-slides');
202
- }, [slidesId]);
203
-
204
- var toggleAutoPlay = function toggleAutoPlay() {
205
- if (isSlideshowAutoPlaying) {
206
- stopAutoPlay();
207
- } else {
208
- startAutoPlay();
209
- }
210
- };
211
-
212
- var toggleForcePause = function toggleForcePause() {
213
- var shouldBePaused = !isForcePaused;
214
- setIsForcePaused(shouldBePaused);
215
-
216
- if (!shouldBePaused) {
217
- startAutoPlay();
218
- } else {
219
- stopAutoPlay();
220
- }
221
- }; // Start index and end index of visible slides.
222
-
223
-
224
- var startIndexVisible = currentIndex * groupBy;
225
- var endIndexVisible = startIndexVisible + groupBy;
226
- return {
227
- startIndexVisible: startIndexVisible,
228
- endIndexVisible: endIndexVisible,
229
- setSlideshow: setElement,
230
- slideshow: element,
231
- slideshowId: slideshowId,
232
- slideshowSlidesId: slideshowSlidesId,
233
- onPreviousClick: onPreviousClick,
234
- onNextClick: onNextClick,
235
- onPaginationClick: onPaginationClick,
236
- isAutoPlaying: isSlideshowAutoPlaying,
237
- toggleAutoPlay: toggleAutoPlay,
238
- activeIndex: currentIndex,
239
- slidesCount: slidesCount,
240
- setActiveIndex: setCurrentIndex,
241
- startAutoPlay: startAutoPlay,
242
- stopAutoPlay: stopAutoPlay,
243
- isForcePaused: isForcePaused,
244
- toggleForcePause: toggleForcePause
245
- };
246
- };
247
-
248
- /**
249
- * Classname set on elements whose focus was blocked.
250
- * This is to easily find elements that have been tempered with,
251
- * and not elements whose focus was already initially blocked.
252
- * */
253
- var BLOCKED_FOCUS_CLASSNAME = "focus-blocked";
254
- /**
255
- * Manage how slides must behave when visible or not.
256
- * When not visible, they should be hidden from screen readers and not focusable.
257
- */
258
-
259
- var useSlideFocusManagement = function useSlideFocusManagement(_ref) {
260
- var isSlideDisplayed = _ref.isSlideDisplayed,
261
- slideRef = _ref.slideRef;
262
- useEffect(function () {
263
- var element = slideRef === null || slideRef === void 0 ? void 0 : slideRef.current;
264
-
265
- if (!element) {
266
- return undefined;
267
- }
268
- /**
269
- * Display given slide to screen readers and, if focus was blocked, restore focus on elements.
270
- */
271
-
272
-
273
- var enableSlide = function enableSlide() {
274
- // Hide from screen readers
275
- element.setAttribute('aria-hidden', 'false'); // Find elements we have blocked focus on
276
-
277
- element.querySelectorAll(".".concat(BLOCKED_FOCUS_CLASSNAME)).forEach(function (focusableElement) {
278
- focusableElement.removeAttribute('tabindex');
279
- focusableElement.classList.remove(BLOCKED_FOCUS_CLASSNAME);
280
- });
281
- };
282
- /**
283
- * Hide given slide from screen readers and block focus on all focusable elements within.
284
- */
285
-
286
-
287
- var blockSlide = function blockSlide() {
288
- element.setAttribute('aria-hidden', 'true');
289
- getFocusableElements(element).forEach(function (focusableElement) {
290
- focusableElement.setAttribute('tabindex', '-1');
291
- focusableElement.classList.add(BLOCKED_FOCUS_CLASSNAME);
292
- });
293
- };
294
-
295
- var handleDisplay = function handleDisplay() {
296
- if (!element) {
297
- return;
298
- }
299
-
300
- if (isSlideDisplayed) {
301
- enableSlide();
302
- } else {
303
- blockSlide();
304
- }
305
- }; // Callback function to execute when mutations are observed
306
-
307
-
308
- var callback = function callback(mutationsList) {
309
- if (element) {
310
- var _iteratorNormalCompletion = true;
311
- var _didIteratorError = false;
312
- var _iteratorError = undefined;
313
-
314
- try {
315
- for (var _iterator = mutationsList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
316
- var mutation = _step.value;
317
-
318
- if (mutation.type === 'childList') {
319
- handleDisplay();
320
- }
321
- }
322
- } catch (err) {
323
- _didIteratorError = true;
324
- _iteratorError = err;
325
- } finally {
326
- try {
327
- if (!_iteratorNormalCompletion && _iterator.return != null) {
328
- _iterator.return();
329
- }
330
- } finally {
331
- if (_didIteratorError) {
332
- throw _iteratorError;
333
- }
334
- }
335
- }
336
- }
337
- }; // Create an observer instance linked to the callback function
338
-
339
-
340
- var observer = new MutationObserver(callback);
341
-
342
- if (element) {
343
- handleDisplay();
344
- /** If slide is hidden, start observing for elements to block focus */
345
-
346
- if (!isSlideDisplayed) {
347
- observer.observe(element, {
348
- attributes: true,
349
- childList: true,
350
- subtree: true
351
- });
352
- }
353
- }
354
-
355
- return function () {
356
- if (!isSlideDisplayed) {
357
- observer.disconnect();
358
- }
359
- };
360
- }, [isSlideDisplayed, slideRef]);
361
- };
362
-
363
- /**
364
- * Defines the props of the component.
365
- */
366
-
367
- /**
368
- * Component display name.
369
- */
370
- var COMPONENT_NAME = 'SlideshowItemGroup';
371
- /**
372
- * Component default class name and class prefix.
373
- */
374
-
375
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
376
- var buildSlideShowGroupId = function buildSlideShowGroupId(slidesId, index) {
377
- return "".concat(slidesId, "-slide-").concat(index);
378
- };
379
- /**
380
- * SlideshowItemGroup component.
381
- *
382
- * @param props Component props.
383
- * @param ref Component ref.
384
- * @return React element.
385
- */
386
-
387
- var SlideshowItemGroup = forwardRef(function (props, ref) {
388
- var className = props.className,
389
- children = props.children,
390
- _props$role = props.role,
391
- role = _props$role === void 0 ? 'group' : _props$role,
392
- label = props.label,
393
- isDisplayed = props.isDisplayed,
394
- forwardedProps = _objectWithoutProperties(props, ["className", "children", "role", "label", "isDisplayed"]);
395
-
396
- var groupRef = React.useRef(null);
397
- useSlideFocusManagement({
398
- isSlideDisplayed: isDisplayed,
399
- slideRef: groupRef
400
- });
401
- return React.createElement("div", _extends({
402
- ref: mergeRefs(groupRef, ref),
403
- role: role,
404
- className: classnames(className, handleBasicClasses({
405
- prefix: CLASSNAME
406
- })),
407
- "aria-roledescription": "slide",
408
- "aria-label": label
409
- }, forwardedProps), children);
410
- });
411
- SlideshowItemGroup.displayName = COMPONENT_NAME;
412
- SlideshowItemGroup.className = CLASSNAME;
413
-
414
- /**
415
- * Defines the props of the component.
416
- */
417
-
418
- /**
419
- * Component default props.
420
- */
421
- var DEFAULT_PROPS = _objectSpread2({}, DEFAULT_OPTIONS, {
422
- theme: Theme.light
423
- });
424
- /**
425
- * Slideshow component.
426
- *
427
- * @param props Component props.
428
- * @param ref Component ref.
429
- * @return React element.
430
- */
431
-
432
-
433
- var Slideshow = forwardRef(function (props, ref) {
434
- var activeIndex = props.activeIndex,
435
- autoPlay = props.autoPlay,
436
- children = props.children,
437
- className = props.className,
438
- fillHeight = props.fillHeight,
439
- groupBy = props.groupBy,
440
- interval = props.interval,
441
- onChange = props.onChange,
442
- slideshowControlsProps = props.slideshowControlsProps,
443
- theme = props.theme,
444
- id = props.id,
445
- slidesId = props.slidesId,
446
- slideGroupLabel = props.slideGroupLabel,
447
- forwardedProps = _objectWithoutProperties(props, ["activeIndex", "autoPlay", "children", "className", "fillHeight", "groupBy", "interval", "onChange", "slideshowControlsProps", "theme", "id", "slidesId", "slideGroupLabel"]); // Number of slideshow items.
448
-
449
-
450
- var itemsCount = React.Children.count(children);
451
-
452
- var _SlideshowControls$us = SlideshowControls.useSlideshowControls({
453
- activeIndex: activeIndex,
454
- defaultActiveIndex: DEFAULT_PROPS.activeIndex,
455
- autoPlay: Boolean(autoPlay),
456
- itemsCount: itemsCount,
457
- groupBy: groupBy,
458
- id: id,
459
- interval: interval,
460
- onChange: onChange,
461
- slidesId: slidesId
462
- }),
463
- currentIndex = _SlideshowControls$us.activeIndex,
464
- slideshowId = _SlideshowControls$us.slideshowId,
465
- setSlideshow = _SlideshowControls$us.setSlideshow,
466
- isAutoPlaying = _SlideshowControls$us.isAutoPlaying,
467
- slideshowSlidesId = _SlideshowControls$us.slideshowSlidesId,
468
- slidesCount = _SlideshowControls$us.slidesCount,
469
- onNextClick = _SlideshowControls$us.onNextClick,
470
- onPaginationClick = _SlideshowControls$us.onPaginationClick,
471
- onPreviousClick = _SlideshowControls$us.onPreviousClick,
472
- slideshow = _SlideshowControls$us.slideshow,
473
- stopAutoPlay = _SlideshowControls$us.stopAutoPlay,
474
- startAutoPlay = _SlideshowControls$us.startAutoPlay,
475
- toggleAutoPlay = _SlideshowControls$us.toggleAutoPlay,
476
- toggleForcePause = _SlideshowControls$us.toggleForcePause;
477
-
478
- useFocusWithin({
479
- element: slideshow,
480
- onFocusIn: stopAutoPlay,
481
- onFocusOut: startAutoPlay
482
- });
483
- var showControls = slideshowControlsProps && slidesCount > 1;
484
- return React.createElement(Slides, _extends({
485
- activeIndex: currentIndex,
486
- id: slideshowId,
487
- className: className,
488
- theme: theme,
489
- fillHeight: fillHeight,
490
- groupBy: groupBy,
491
- isAutoPlaying: isAutoPlaying,
492
- autoPlay: autoPlay,
493
- slidesId: slideshowSlidesId,
494
- toggleAutoPlay: toggleAutoPlay,
495
- ref: mergeRefs(ref, setSlideshow),
496
- hasControls: showControls,
497
- slideGroupLabel: slideGroupLabel,
498
- afterSlides: slideshowControlsProps && slidesCount > 1 ? React.createElement("div", {
499
- className: "".concat(Slides.className, "__controls")
500
- }, React.createElement(SlideshowControls, _extends({}, slideshowControlsProps, {
501
- activeIndex: currentIndex,
502
- onPaginationClick: onPaginationClick,
503
- onNextClick: onNextClick,
504
- onPreviousClick: onPreviousClick,
505
- slidesCount: slidesCount,
506
- parentRef: slideshow,
507
- theme: theme,
508
- isAutoPlaying: isAutoPlaying,
509
- nextButtonProps: _objectSpread2({
510
- 'aria-controls': slideshowSlidesId
511
- }, slideshowControlsProps.nextButtonProps),
512
- previousButtonProps: _objectSpread2({
513
- 'aria-controls': slideshowSlidesId
514
- }, slideshowControlsProps.previousButtonProps),
515
- playButtonProps: autoPlay ? _objectSpread2({
516
- 'aria-controls': slideshowSlidesId,
517
- onClick: toggleForcePause
518
- }, slideshowControlsProps.playButtonProps) : undefined,
519
- paginationItemProps: function paginationItemProps(index) {
520
- var _slideshowControlsPro;
521
-
522
- return _objectSpread2({
523
- 'aria-controls': buildSlideShowGroupId(slideshowSlidesId, index)
524
- }, (_slideshowControlsPro = slideshowControlsProps.paginationItemProps) === null || _slideshowControlsPro === void 0 ? void 0 : _slideshowControlsPro.call(slideshowControlsProps, index));
525
- }
526
- }))) : undefined
527
- }, forwardedProps), children);
528
- });
529
- Slideshow.displayName = 'Slideshow';
530
- Slideshow.defaultProps = DEFAULT_PROPS;
531
-
532
- /**
533
- * Defines the props of the component.
534
- */
535
-
536
- /**
537
- * Component display name.
538
- */
539
- var COMPONENT_NAME$1 = 'SlideshowItem';
540
- /**
541
- * Component default class name and class prefix.
542
- */
543
-
544
- var CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
545
- /**
546
- * SlideshowItem component.
547
- *
548
- * @param props Component props.
549
- * @param ref Component ref.
550
- * @return React element.
551
- */
552
-
553
- var SlideshowItem = forwardRef(function (props, ref) {
554
- var className = props.className,
555
- children = props.children,
556
- forwardedProps = _objectWithoutProperties(props, ["className", "children"]);
557
-
558
- return React.createElement("div", _extends({
559
- ref: ref,
560
- className: classnames(className, handleBasicClasses({
561
- prefix: CLASSNAME$1
562
- }))
563
- }, forwardedProps), children);
564
- });
565
- SlideshowItem.displayName = COMPONENT_NAME$1;
566
- SlideshowItem.className = CLASSNAME$1;
567
-
568
- var isTouchDevice = function isTouchDevice() {
569
- return 'ontouchstart' in window;
570
- };
571
- /**
572
- * Listen swipe to navigate left and right.
573
- */
574
-
575
-
576
- function useSwipeNavigate(element, onNext, onPrevious) {
577
- useEffect(function () {
578
- if (!element || !isTouchDevice()) return undefined;
579
- return detectHorizontalSwipe(element, function (swipe) {
580
- var callback = swipe === 'right' ? onPrevious : onNext;
581
- callback === null || callback === void 0 ? void 0 : callback();
582
- });
583
- }, [onPrevious, onNext, element]);
584
- }
585
-
586
- /**
587
- * Calculate the currently visible pagination "bullet" range.
588
- */
589
- function usePaginationVisibleRange(activeIndex, slideCount) {
590
- var previousVisibleRangeRef = useRef();
591
- return useMemo(function () {
592
- var lastSlide = slideCount - 1;
593
- var previousVisibleRange = previousVisibleRangeRef.current;
594
- var newVisibleRange;
595
-
596
- if (activeIndex === (previousVisibleRange === null || previousVisibleRange === void 0 ? void 0 : previousVisibleRange.max) && activeIndex < lastSlide) {
597
- newVisibleRange = {
598
- min: previousVisibleRange.min + 1,
599
- max: previousVisibleRange.max + 1
600
- };
601
- } else if (activeIndex === (previousVisibleRange === null || previousVisibleRange === void 0 ? void 0 : previousVisibleRange.min) && activeIndex > 0) {
602
- newVisibleRange = {
603
- min: previousVisibleRange.min - 1,
604
- max: previousVisibleRange.max - 1
605
- };
606
- } else {
607
- var deltaItems = PAGINATION_ITEMS_MAX - 1;
608
- var min = activeIndex - EDGE_FROM_ACTIVE_INDEX;
609
- var max = activeIndex + EDGE_FROM_ACTIVE_INDEX;
610
-
611
- if (activeIndex > lastSlide - EDGE_FROM_ACTIVE_INDEX) {
612
- min = lastSlide - deltaItems;
613
- max = lastSlide;
614
- } else if (activeIndex < deltaItems) {
615
- min = 0;
616
- max = deltaItems;
617
- }
618
-
619
- newVisibleRange = {
620
- min: min,
621
- max: max
622
- };
623
- }
624
-
625
- previousVisibleRangeRef.current = newVisibleRange;
626
- return newVisibleRange;
627
- }, [activeIndex, slideCount]);
628
- }
629
-
630
- /**
631
- * Defines the props of the component.
632
- */
633
-
634
- /**
635
- * Component display name.
636
- */
637
- var COMPONENT_NAME$2 = 'SlideshowControls';
638
- /**
639
- * Component default class name and class prefix.
640
- */
641
-
642
- var CLASSNAME$2 = getRootClassName(COMPONENT_NAME$2);
643
- /**
644
- * Component default props.
645
- */
646
-
647
- var DEFAULT_PROPS$1 = {
648
- activeIndex: 0,
649
- theme: Theme.light
650
- };
651
- /**
652
- * SlideshowControls component.
653
- *
654
- * @param props Component props.
655
- * @param ref Component ref.
656
- * @return React element.
657
- */
658
-
659
- var InternalSlideshowControls = forwardRef(function (props, ref) {
660
- var activeIndex = props.activeIndex,
661
- className = props.className,
662
- nextButtonProps = props.nextButtonProps,
663
- onNextClick = props.onNextClick,
664
- onPaginationClick = props.onPaginationClick,
665
- onPreviousClick = props.onPreviousClick,
666
- parentRef = props.parentRef,
667
- previousButtonProps = props.previousButtonProps,
668
- paginationProps = props.paginationProps,
669
- slidesCount = props.slidesCount,
670
- theme = props.theme,
671
- _props$isAutoPlaying = props.isAutoPlaying,
672
- isAutoPlaying = _props$isAutoPlaying === void 0 ? false : _props$isAutoPlaying,
673
- playButtonProps = props.playButtonProps,
674
- paginationItemLabel = props.paginationItemLabel,
675
- paginationItemProps = props.paginationItemProps,
676
- forwardedProps = _objectWithoutProperties(props, ["activeIndex", "className", "nextButtonProps", "onNextClick", "onPaginationClick", "onPreviousClick", "parentRef", "previousButtonProps", "paginationProps", "slidesCount", "theme", "isAutoPlaying", "playButtonProps", "paginationItemLabel", "paginationItemProps"]);
677
-
678
- var parent;
679
-
680
- if (WINDOW) {
681
- // Checking window object to avoid errors in SSR.
682
- parent = parentRef instanceof HTMLElement ? parentRef : parentRef === null || parentRef === void 0 ? void 0 : parentRef.current;
683
- }
684
-
685
- var paginationRef = React.useRef(null); // Listen to touch swipe navigate left & right.
686
-
687
- useSwipeNavigate(parent, // Go next without loopback.
688
- useCallback(function () {
689
- return onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(false);
690
- }, [onNextClick]), // Go previous without loopback.
691
- useCallback(function () {
692
- return onPreviousClick === null || onPreviousClick === void 0 ? void 0 : onPreviousClick(false);
693
- }, [onPreviousClick]));
694
- /**
695
- * Add roving tab index pattern to pagination items and activate slide on focus.
696
- */
697
-
698
- useRovingTabIndex({
699
- parentRef: paginationRef,
700
- elementSelector: 'button',
701
- keepTabIndex: true,
702
- onElementFocus: function onElementFocus(element) {
703
- element.click();
704
- }
705
- }); // Pagination "bullet" range.
706
-
707
- var visibleRange = usePaginationVisibleRange(activeIndex, slidesCount); // Inline style of wrapper element.
708
-
709
- var wrapperStyle = {
710
- transform: "translateX(-".concat(PAGINATION_ITEM_SIZE * visibleRange.min, "px)")
711
- };
712
- return React.createElement("div", _extends({
713
- ref: ref
714
- }, forwardedProps, {
715
- className: classnames(className, handleBasicClasses({
716
- prefix: CLASSNAME$2,
717
- theme: theme
718
- }), _defineProperty({}, "".concat(CLASSNAME$2, "--has-infinite-pagination"), slidesCount > PAGINATION_ITEMS_MAX))
719
- }), React.createElement(IconButton, _extends({}, previousButtonProps, {
720
- icon: mdiChevronLeft,
721
- className: "".concat(CLASSNAME$2, "__navigation"),
722
- color: theme === Theme.dark ? 'light' : 'dark',
723
- emphasis: Emphasis.low,
724
- onClick: onPreviousClick
725
- })), React.createElement("div", {
726
- ref: paginationRef,
727
- className: "".concat(CLASSNAME$2, "__pagination")
728
- }, React.createElement("div", _extends({
729
- className: "".concat(CLASSNAME$2, "__pagination-items"),
730
- style: wrapperStyle,
731
- role: "tablist"
732
- }, paginationProps), useMemo(function () {
733
- return range(slidesCount).map(function (index) {
734
- var isOnEdge = index !== 0 && index !== slidesCount - 1 && (index === visibleRange.min || index === visibleRange.max);
735
- var isActive = activeIndex === index;
736
- var isOutRange = index < visibleRange.min || index > visibleRange.max;
737
-
738
- var _ref = paginationItemProps ? paginationItemProps(index) : {},
739
- _ref$className = _ref.className,
740
- itemClassName = _ref$className === void 0 ? undefined : _ref$className,
741
- _ref$label = _ref.label,
742
- label = _ref$label === void 0 ? undefined : _ref$label,
743
- itemProps = _objectWithoutProperties(_ref, ["className", "label"]);
744
-
745
- var ariaLabel = label || (paginationItemLabel === null || paginationItemLabel === void 0 ? void 0 : paginationItemLabel(index)) || "".concat(index + 1, " / ").concat(slidesCount);
746
- return React.createElement("button", _extends({
747
- className: classnames(handleBasicClasses({
748
- prefix: "".concat(CLASSNAME$2, "__pagination-item"),
749
- isActive: isActive,
750
- isOnEdge: isOnEdge,
751
- isOutRange: isOutRange
752
- }), itemClassName),
753
- key: index,
754
- type: "button",
755
- tabIndex: isActive ? undefined : -1,
756
- role: "tab",
757
- "aria-selected": isActive,
758
- onClick: function onClick() {
759
- return onPaginationClick === null || onPaginationClick === void 0 ? void 0 : onPaginationClick(index);
760
- },
761
- "aria-label": ariaLabel
762
- }, itemProps));
763
- });
764
- }, [slidesCount, visibleRange.min, visibleRange.max, activeIndex, paginationItemProps, paginationItemLabel, onPaginationClick]))), playButtonProps ? React.createElement(IconButton, _extends({}, playButtonProps, {
765
- icon: isAutoPlaying ? mdiPauseCircleOutline : mdiPlayCircleOutline,
766
- className: "".concat(CLASSNAME$2, "__play"),
767
- color: theme === Theme.dark ? 'light' : 'dark',
768
- emphasis: Emphasis.low
769
- })) : null, React.createElement(IconButton, _extends({}, nextButtonProps, {
770
- icon: mdiChevronRight,
771
- className: "".concat(CLASSNAME$2, "__navigation"),
772
- color: theme === Theme.dark ? 'light' : 'dark',
773
- emphasis: Emphasis.low,
774
- onClick: onNextClick
775
- })));
776
- });
777
- InternalSlideshowControls.displayName = COMPONENT_NAME$2;
778
- InternalSlideshowControls.className = CLASSNAME$2;
779
- InternalSlideshowControls.defaultProps = DEFAULT_PROPS$1;
780
- var SlideshowControls = Object.assign(InternalSlideshowControls, {
781
- useSlideshowControls: useSlideshowControls,
782
- useSlideshowControlsDefaultOptions: DEFAULT_OPTIONS
783
- });
784
-
785
- /**
786
- * Component display name.
787
- */
788
- var COMPONENT_NAME$3 = 'Slideshow';
789
- /**
790
- * Component default class name and class prefix.
791
- */
792
-
793
- var CLASSNAME$3 = getRootClassName(COMPONENT_NAME$3);
794
- /**
795
- * Slides component.
796
- *
797
- * @param props Component props.
798
- * @param ref Component ref.
799
- * @return React element.
800
- */
801
-
802
- var Slides = forwardRef(function (props, ref) {
803
- var _classNames;
804
-
805
- var activeIndex = props.activeIndex,
806
- id = props.id,
807
- className = props.className,
808
- theme = props.theme,
809
- fillHeight = props.fillHeight,
810
- groupBy = props.groupBy,
811
- isAutoPlaying = props.isAutoPlaying,
812
- toggleAutoPlay = props.toggleAutoPlay,
813
- slidesId = props.slidesId,
814
- children = props.children,
815
- afterSlides = props.afterSlides,
816
- hasControls = props.hasControls,
817
- slideGroupLabel = props.slideGroupLabel,
818
- forwardedProps = _objectWithoutProperties(props, ["activeIndex", "id", "className", "theme", "fillHeight", "groupBy", "isAutoPlaying", "toggleAutoPlay", "slidesId", "children", "afterSlides", "hasControls", "slideGroupLabel"]);
819
-
820
- var wrapperRef = React.useRef(null);
821
- var startIndexVisible = activeIndex;
822
- var endIndexVisible = startIndexVisible + 1; // Inline style of wrapper element.
823
-
824
- var wrapperStyle = {
825
- transform: "translateX(-".concat(FULL_WIDTH_PERCENT * activeIndex, "%)")
826
- };
827
- var groups = React.useMemo(function () {
828
- var childrenArray = Children.toArray(children);
829
- return groupBy && groupBy > 1 ? chunk(childrenArray, groupBy) : childrenArray;
830
- }, [children, groupBy]);
831
- return React.createElement("section", _extends({
832
- id: id,
833
- ref: ref
834
- }, forwardedProps, {
835
- className: classnames(className, handleBasicClasses({
836
- prefix: CLASSNAME$3,
837
- theme: theme
838
- }), (_classNames = {}, _defineProperty(_classNames, "".concat(CLASSNAME$3, "--fill-height"), fillHeight), _defineProperty(_classNames, "".concat(CLASSNAME$3, "--group-by-").concat(groupBy), Boolean(groupBy)), _classNames)),
839
- "aria-roledescription": "carousel"
840
- }), React.createElement("div", {
841
- id: slidesId,
842
- className: "".concat(CLASSNAME$3, "__slides"),
843
- onMouseEnter: toggleAutoPlay,
844
- onMouseLeave: toggleAutoPlay,
845
- "aria-live": isAutoPlaying ? 'off' : 'polite'
846
- }, React.createElement("div", {
847
- ref: wrapperRef,
848
- className: "".concat(CLASSNAME$3, "__wrapper"),
849
- style: wrapperStyle
850
- }, groups.map(function (group, index) {
851
- return React.createElement(SlideshowItemGroup, {
852
- key: index,
853
- id: slidesId && buildSlideShowGroupId(slidesId, index),
854
- role: hasControls ? 'tabpanel' : 'group',
855
- label: slideGroupLabel ? slideGroupLabel(index + 1, groups.length) : undefined,
856
- isDisplayed: index >= startIndexVisible && index < endIndexVisible
857
- }, group);
858
- }))), afterSlides);
859
- });
860
- Slides.displayName = COMPONENT_NAME$3;
861
- Slides.className = CLASSNAME$3;
862
-
863
- export { Slideshow as S, SlideshowItem as a, SlideshowControls as b, Slides as c };
864
- //# sourceMappingURL=Slides.js.map