@lumx/react 3.0.2 → 3.0.3-alpha.1

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,2473 +0,0 @@
1
- import { d as _slicedToArray, b as _objectWithoutProperties, _ as _objectSpread2, c as _extends } from './_rollupPluginBabelHelpers.js';
2
- import React, { useState, useEffect, useLayoutEffect, useRef, useMemo, forwardRef, useCallback } from 'react';
3
- import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
4
- import { D as DOCUMENT, W as WINDOW } from './constants.js';
5
- import { m as mergeRefs } from './mergeRefs.js';
6
- import { g as getFirstAndLastFocusable, u as useCallbackOnEscape, C as ClickAwayProvider } from './ClickAwayProvider.js';
7
- import { createPortal } from 'react-dom';
8
-
9
- /**
10
- * Hook focusing an element when defined and `focus` boolean `true`.
11
- *
12
- * @param element Element to focus.
13
- * @param shouldFocus Boolean flag to trigger the focus
14
- */
15
-
16
- function useFocus(element) {
17
- var shouldFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
18
-
19
- var _useState = useState(false),
20
- _useState2 = _slicedToArray(_useState, 2),
21
- wasFocus = _useState2[0],
22
- setWasFocus = _useState2[1];
23
-
24
- useEffect(function () {
25
- if (shouldFocus && wasFocus !== shouldFocus && element) {
26
- element.focus();
27
- setWasFocus(shouldFocus);
28
- }
29
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
30
- [element, shouldFocus]);
31
- }
32
-
33
- var top = 'top';
34
- var bottom = 'bottom';
35
- var right = 'right';
36
- var left = 'left';
37
- var auto = 'auto';
38
- var basePlacements = [top, bottom, right, left];
39
- var start = 'start';
40
- var end = 'end';
41
- var clippingParents = 'clippingParents';
42
- var viewport = 'viewport';
43
- var popper = 'popper';
44
- var reference = 'reference';
45
- var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
46
- return acc.concat([placement + "-" + start, placement + "-" + end]);
47
- }, []);
48
- var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
49
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
50
- }, []); // modifiers that need to read the DOM
51
-
52
- var beforeRead = 'beforeRead';
53
- var read = 'read';
54
- var afterRead = 'afterRead'; // pure-logic modifiers
55
-
56
- var beforeMain = 'beforeMain';
57
- var main = 'main';
58
- var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
59
-
60
- var beforeWrite = 'beforeWrite';
61
- var write = 'write';
62
- var afterWrite = 'afterWrite';
63
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
64
-
65
- function getNodeName(element) {
66
- return element ? (element.nodeName || '').toLowerCase() : null;
67
- }
68
-
69
- /*:: import type { Window } from '../types'; */
70
-
71
- /*:: declare function getWindow(node: Node | Window): Window; */
72
- function getWindow(node) {
73
- if (node.toString() !== '[object Window]') {
74
- var ownerDocument = node.ownerDocument;
75
- return ownerDocument ? ownerDocument.defaultView || window : window;
76
- }
77
-
78
- return node;
79
- }
80
-
81
- /*:: declare function isElement(node: mixed): boolean %checks(node instanceof
82
- Element); */
83
-
84
- function isElement(node) {
85
- var OwnElement = getWindow(node).Element;
86
- return node instanceof OwnElement || node instanceof Element;
87
- }
88
- /*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
89
- HTMLElement); */
90
-
91
-
92
- function isHTMLElement(node) {
93
- var OwnElement = getWindow(node).HTMLElement;
94
- return node instanceof OwnElement || node instanceof HTMLElement;
95
- }
96
- /*:: declare function isShadowRoot(node: mixed): boolean %checks(node instanceof
97
- ShadowRoot); */
98
-
99
-
100
- function isShadowRoot(node) {
101
- var OwnElement = getWindow(node).ShadowRoot;
102
- return node instanceof OwnElement || node instanceof ShadowRoot;
103
- }
104
-
105
- // and applies them to the HTMLElements such as popper and arrow
106
-
107
- function applyStyles(_ref) {
108
- var state = _ref.state;
109
- Object.keys(state.elements).forEach(function (name) {
110
- var style = state.styles[name] || {};
111
- var attributes = state.attributes[name] || {};
112
- var element = state.elements[name]; // arrow is optional + virtual elements
113
-
114
- if (!isHTMLElement(element) || !getNodeName(element)) {
115
- return;
116
- } // Flow doesn't support to extend this property, but it's the most
117
- // effective way to apply styles to an HTMLElement
118
- // $FlowFixMe
119
-
120
-
121
- Object.assign(element.style, style);
122
- Object.keys(attributes).forEach(function (name) {
123
- var value = attributes[name];
124
-
125
- if (value === false) {
126
- element.removeAttribute(name);
127
- } else {
128
- element.setAttribute(name, value === true ? '' : value);
129
- }
130
- });
131
- });
132
- }
133
-
134
- function effect(_ref2) {
135
- var state = _ref2.state;
136
- var initialStyles = {
137
- popper: {
138
- position: state.options.strategy,
139
- left: '0',
140
- top: '0',
141
- margin: '0'
142
- },
143
- arrow: {
144
- position: 'absolute'
145
- },
146
- reference: {}
147
- };
148
- Object.assign(state.elements.popper.style, initialStyles.popper);
149
-
150
- if (state.elements.arrow) {
151
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
152
- }
153
-
154
- return function () {
155
- Object.keys(state.elements).forEach(function (name) {
156
- var element = state.elements[name];
157
- var attributes = state.attributes[name] || {};
158
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
159
-
160
- var style = styleProperties.reduce(function (style, property) {
161
- style[property] = '';
162
- return style;
163
- }, {}); // arrow is optional + virtual elements
164
-
165
- if (!isHTMLElement(element) || !getNodeName(element)) {
166
- return;
167
- } // Flow doesn't support to extend this property, but it's the most
168
- // effective way to apply styles to an HTMLElement
169
- // $FlowFixMe
170
-
171
-
172
- Object.assign(element.style, style);
173
- Object.keys(attributes).forEach(function (attribute) {
174
- element.removeAttribute(attribute);
175
- });
176
- });
177
- };
178
- } // eslint-disable-next-line import/no-unused-modules
179
-
180
-
181
- var applyStyles$1 = {
182
- name: 'applyStyles',
183
- enabled: true,
184
- phase: 'write',
185
- fn: applyStyles,
186
- effect: effect,
187
- requires: ['computeStyles']
188
- };
189
-
190
- function getBasePlacement(placement) {
191
- return placement.split('-')[0];
192
- }
193
-
194
- // Returns the layout rect of an element relative to its offsetParent. Layout
195
- // means it doesn't take into account transforms.
196
- function getLayoutRect(element) {
197
- return {
198
- x: element.offsetLeft,
199
- y: element.offsetTop,
200
- width: element.offsetWidth,
201
- height: element.offsetHeight
202
- };
203
- }
204
-
205
- function contains(parent, child) {
206
- var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
207
-
208
- if (parent.contains(child)) {
209
- return true;
210
- } // then fallback to custom implementation with Shadow DOM support
211
- else if (rootNode && isShadowRoot(rootNode)) {
212
- var next = child;
213
-
214
- do {
215
- if (next && parent.isSameNode(next)) {
216
- return true;
217
- } // $FlowFixMe: need a better way to handle this...
218
-
219
-
220
- next = next.parentNode || next.host;
221
- } while (next);
222
- } // Give up, the result is false
223
-
224
-
225
- return false;
226
- }
227
-
228
- function getComputedStyle(element) {
229
- return getWindow(element).getComputedStyle(element);
230
- }
231
-
232
- function isTableElement(element) {
233
- return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
234
- }
235
-
236
- function getDocumentElement(element) {
237
- // $FlowFixMe: assume body is always available
238
- return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
239
- }
240
-
241
- function getParentNode(element) {
242
- if (getNodeName(element) === 'html') {
243
- return element;
244
- }
245
-
246
- return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
247
- element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
248
- element.parentNode || // DOM Element detected
249
- // $FlowFixMe: need a better way to handle this...
250
- element.host || // ShadowRoot detected
251
- // $FlowFixMe: HTMLElement is a Node
252
- getDocumentElement(element) // fallback
253
-
254
- );
255
- }
256
-
257
- function getTrueOffsetParent(element) {
258
- if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
259
- getComputedStyle(element).position === 'fixed') {
260
- return null;
261
- }
262
-
263
- var offsetParent = element.offsetParent;
264
-
265
- if (offsetParent) {
266
- var html = getDocumentElement(offsetParent);
267
-
268
- if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
269
- return html;
270
- }
271
- }
272
-
273
- return offsetParent;
274
- } // `.offsetParent` reports `null` for fixed elements, while absolute elements
275
- // return the containing block
276
-
277
-
278
- function getContainingBlock(element) {
279
- var currentNode = getParentNode(element);
280
-
281
- while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
282
- var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
283
- // create a containing block.
284
-
285
- if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
286
- return currentNode;
287
- } else {
288
- currentNode = currentNode.parentNode;
289
- }
290
- }
291
-
292
- return null;
293
- } // Gets the closest ancestor positioned element. Handles some edge cases,
294
- // such as table ancestors and cross browser bugs.
295
-
296
-
297
- function getOffsetParent(element) {
298
- var window = getWindow(element);
299
- var offsetParent = getTrueOffsetParent(element);
300
-
301
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
302
- offsetParent = getTrueOffsetParent(offsetParent);
303
- }
304
-
305
- if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
306
- return window;
307
- }
308
-
309
- return offsetParent || getContainingBlock(element) || window;
310
- }
311
-
312
- function getMainAxisFromPlacement(placement) {
313
- return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
314
- }
315
-
316
- function within(min, value, max) {
317
- return Math.max(min, Math.min(value, max));
318
- }
319
-
320
- function getFreshSideObject() {
321
- return {
322
- top: 0,
323
- right: 0,
324
- bottom: 0,
325
- left: 0
326
- };
327
- }
328
-
329
- function mergePaddingObject(paddingObject) {
330
- return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
331
- }
332
-
333
- function expandToHashMap(value, keys) {
334
- return keys.reduce(function (hashMap, key) {
335
- hashMap[key] = value;
336
- return hashMap;
337
- }, {});
338
- }
339
-
340
- function arrow(_ref) {
341
- var _state$modifiersData$;
342
-
343
- var state = _ref.state,
344
- name = _ref.name;
345
- var arrowElement = state.elements.arrow;
346
- var popperOffsets = state.modifiersData.popperOffsets;
347
- var basePlacement = getBasePlacement(state.placement);
348
- var axis = getMainAxisFromPlacement(basePlacement);
349
- var isVertical = [left, right].indexOf(basePlacement) >= 0;
350
- var len = isVertical ? 'height' : 'width';
351
-
352
- if (!arrowElement || !popperOffsets) {
353
- return;
354
- }
355
-
356
- var paddingObject = state.modifiersData[name + "#persistent"].padding;
357
- var arrowRect = getLayoutRect(arrowElement);
358
- var minProp = axis === 'y' ? top : left;
359
- var maxProp = axis === 'y' ? bottom : right;
360
- var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
361
- var startDiff = popperOffsets[axis] - state.rects.reference[axis];
362
- var arrowOffsetParent = getOffsetParent(arrowElement);
363
- var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
364
- var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
365
- // outside of the popper bounds
366
-
367
- var min = paddingObject[minProp];
368
- var max = clientSize - arrowRect[len] - paddingObject[maxProp];
369
- var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
370
- var offset = within(min, center, max); // Prevents breaking syntax highlighting...
371
-
372
- var axisProp = axis;
373
- state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
374
- }
375
-
376
- function effect$1(_ref2) {
377
- var state = _ref2.state,
378
- options = _ref2.options,
379
- name = _ref2.name;
380
- var _options$element = options.element,
381
- arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element,
382
- _options$padding = options.padding,
383
- padding = _options$padding === void 0 ? 0 : _options$padding;
384
-
385
- if (arrowElement == null) {
386
- return;
387
- } // CSS selector
388
-
389
-
390
- if (typeof arrowElement === 'string') {
391
- arrowElement = state.elements.popper.querySelector(arrowElement);
392
-
393
- if (!arrowElement) {
394
- return;
395
- }
396
- }
397
-
398
- if (process.env.NODE_ENV !== "production") {
399
- if (!isHTMLElement(arrowElement)) {
400
- console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));
401
- }
402
- }
403
-
404
- if (!contains(state.elements.popper, arrowElement)) {
405
- if (process.env.NODE_ENV !== "production") {
406
- console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
407
- }
408
-
409
- return;
410
- }
411
-
412
- state.elements.arrow = arrowElement;
413
- state.modifiersData[name + "#persistent"] = {
414
- padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
415
- };
416
- } // eslint-disable-next-line import/no-unused-modules
417
-
418
-
419
- var arrow$1 = {
420
- name: 'arrow',
421
- enabled: true,
422
- phase: 'main',
423
- fn: arrow,
424
- effect: effect$1,
425
- requires: ['popperOffsets'],
426
- requiresIfExists: ['preventOverflow']
427
- };
428
-
429
- var unsetSides = {
430
- top: 'auto',
431
- right: 'auto',
432
- bottom: 'auto',
433
- left: 'auto'
434
- }; // Round the offsets to the nearest suitable subpixel based on the DPR.
435
- // Zooming can change the DPR, but it seems to report a value that will
436
- // cleanly divide the values into the appropriate subpixels.
437
-
438
- function roundOffsets(_ref) {
439
- var x = _ref.x,
440
- y = _ref.y;
441
- var win = window;
442
- var dpr = win.devicePixelRatio || 1;
443
- return {
444
- x: Math.round(x * dpr) / dpr || 0,
445
- y: Math.round(y * dpr) / dpr || 0
446
- };
447
- }
448
-
449
- function mapToStyles(_ref2) {
450
- var _Object$assign2;
451
-
452
- var popper = _ref2.popper,
453
- popperRect = _ref2.popperRect,
454
- placement = _ref2.placement,
455
- offsets = _ref2.offsets,
456
- position = _ref2.position,
457
- gpuAcceleration = _ref2.gpuAcceleration,
458
- adaptive = _ref2.adaptive;
459
-
460
- var _roundOffsets = roundOffsets(offsets),
461
- x = _roundOffsets.x,
462
- y = _roundOffsets.y;
463
-
464
- var hasX = offsets.hasOwnProperty('x');
465
- var hasY = offsets.hasOwnProperty('y');
466
- var sideX = left;
467
- var sideY = top;
468
- var win = window;
469
-
470
- if (adaptive) {
471
- var offsetParent = getOffsetParent(popper);
472
-
473
- if (offsetParent === getWindow(popper)) {
474
- offsetParent = getDocumentElement(popper);
475
- } // $FlowFixMe: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
476
-
477
- /*:: offsetParent = (offsetParent: Element); */
478
-
479
-
480
- if (placement === top) {
481
- sideY = bottom;
482
- y -= offsetParent.clientHeight - popperRect.height;
483
- y *= gpuAcceleration ? 1 : -1;
484
- }
485
-
486
- if (placement === left) {
487
- sideX = right;
488
- x -= offsetParent.clientWidth - popperRect.width;
489
- x *= gpuAcceleration ? 1 : -1;
490
- }
491
- }
492
-
493
- var commonStyles = Object.assign({
494
- position: position
495
- }, adaptive && unsetSides);
496
-
497
- if (gpuAcceleration) {
498
- var _Object$assign;
499
-
500
- return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
501
- }
502
-
503
- return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
504
- }
505
-
506
- function computeStyles(_ref3) {
507
- var state = _ref3.state,
508
- options = _ref3.options;
509
- var _options$gpuAccelerat = options.gpuAcceleration,
510
- gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
511
- _options$adaptive = options.adaptive,
512
- adaptive = _options$adaptive === void 0 ? true : _options$adaptive;
513
-
514
- if (process.env.NODE_ENV !== "production") {
515
- var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
516
-
517
- if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
518
- return transitionProperty.indexOf(property) >= 0;
519
- })) {
520
- console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
521
- }
522
- }
523
-
524
- var commonStyles = {
525
- placement: getBasePlacement(state.placement),
526
- popper: state.elements.popper,
527
- popperRect: state.rects.popper,
528
- gpuAcceleration: gpuAcceleration
529
- };
530
-
531
- if (state.modifiersData.popperOffsets != null) {
532
- state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
533
- offsets: state.modifiersData.popperOffsets,
534
- position: state.options.strategy,
535
- adaptive: adaptive
536
- })));
537
- }
538
-
539
- if (state.modifiersData.arrow != null) {
540
- state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
541
- offsets: state.modifiersData.arrow,
542
- position: 'absolute',
543
- adaptive: false
544
- })));
545
- }
546
-
547
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
548
- 'data-popper-placement': state.placement
549
- });
550
- } // eslint-disable-next-line import/no-unused-modules
551
-
552
-
553
- var computeStyles$1 = {
554
- name: 'computeStyles',
555
- enabled: true,
556
- phase: 'beforeWrite',
557
- fn: computeStyles,
558
- data: {}
559
- };
560
-
561
- var passive = {
562
- passive: true
563
- };
564
-
565
- function effect$2(_ref) {
566
- var state = _ref.state,
567
- instance = _ref.instance,
568
- options = _ref.options;
569
- var _options$scroll = options.scroll,
570
- scroll = _options$scroll === void 0 ? true : _options$scroll,
571
- _options$resize = options.resize,
572
- resize = _options$resize === void 0 ? true : _options$resize;
573
- var window = getWindow(state.elements.popper);
574
- var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
575
-
576
- if (scroll) {
577
- scrollParents.forEach(function (scrollParent) {
578
- scrollParent.addEventListener('scroll', instance.update, passive);
579
- });
580
- }
581
-
582
- if (resize) {
583
- window.addEventListener('resize', instance.update, passive);
584
- }
585
-
586
- return function () {
587
- if (scroll) {
588
- scrollParents.forEach(function (scrollParent) {
589
- scrollParent.removeEventListener('scroll', instance.update, passive);
590
- });
591
- }
592
-
593
- if (resize) {
594
- window.removeEventListener('resize', instance.update, passive);
595
- }
596
- };
597
- } // eslint-disable-next-line import/no-unused-modules
598
-
599
-
600
- var eventListeners = {
601
- name: 'eventListeners',
602
- enabled: true,
603
- phase: 'write',
604
- fn: function fn() {},
605
- effect: effect$2,
606
- data: {}
607
- };
608
-
609
- var hash = {
610
- left: 'right',
611
- right: 'left',
612
- bottom: 'top',
613
- top: 'bottom'
614
- };
615
- function getOppositePlacement(placement) {
616
- return placement.replace(/left|right|bottom|top/g, function (matched) {
617
- return hash[matched];
618
- });
619
- }
620
-
621
- var hash$1 = {
622
- start: 'end',
623
- end: 'start'
624
- };
625
- function getOppositeVariationPlacement(placement) {
626
- return placement.replace(/start|end/g, function (matched) {
627
- return hash$1[matched];
628
- });
629
- }
630
-
631
- function getBoundingClientRect(element) {
632
- var rect = element.getBoundingClientRect();
633
- return {
634
- width: rect.width,
635
- height: rect.height,
636
- top: rect.top,
637
- right: rect.right,
638
- bottom: rect.bottom,
639
- left: rect.left,
640
- x: rect.left,
641
- y: rect.top
642
- };
643
- }
644
-
645
- function getWindowScroll(node) {
646
- var win = getWindow(node);
647
- var scrollLeft = win.pageXOffset;
648
- var scrollTop = win.pageYOffset;
649
- return {
650
- scrollLeft: scrollLeft,
651
- scrollTop: scrollTop
652
- };
653
- }
654
-
655
- function getWindowScrollBarX(element) {
656
- // If <html> has a CSS width greater than the viewport, then this will be
657
- // incorrect for RTL.
658
- // Popper 1 is broken in this case and never had a bug report so let's assume
659
- // it's not an issue. I don't think anyone ever specifies width on <html>
660
- // anyway.
661
- // Browsers where the left scrollbar doesn't cause an issue report `0` for
662
- // this (e.g. Edge 2019, IE11, Safari)
663
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
664
- }
665
-
666
- function getViewportRect(element) {
667
- var win = getWindow(element);
668
- var html = getDocumentElement(element);
669
- var visualViewport = win.visualViewport;
670
- var width = html.clientWidth;
671
- var height = html.clientHeight;
672
- var x = 0;
673
- var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
674
- // can be obscured underneath it.
675
- // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
676
- // if it isn't open, so if this isn't available, the popper will be detected
677
- // to overflow the bottom of the screen too early.
678
-
679
- if (visualViewport) {
680
- width = visualViewport.width;
681
- height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
682
- // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
683
- // errors due to floating point numbers, so we need to check precision.
684
- // Safari returns a number <= 0, usually < -1 when pinch-zoomed
685
- // Feature detection fails in mobile emulation mode in Chrome.
686
- // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
687
- // 0.001
688
- // Fallback here: "Not Safari" userAgent
689
-
690
- if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
691
- x = visualViewport.offsetLeft;
692
- y = visualViewport.offsetTop;
693
- }
694
- }
695
-
696
- return {
697
- width: width,
698
- height: height,
699
- x: x + getWindowScrollBarX(element),
700
- y: y
701
- };
702
- }
703
-
704
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
705
-
706
- function getDocumentRect(element) {
707
- var html = getDocumentElement(element);
708
- var winScroll = getWindowScroll(element);
709
- var body = element.ownerDocument.body;
710
- var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
711
- var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
712
- var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
713
- var y = -winScroll.scrollTop;
714
-
715
- if (getComputedStyle(body || html).direction === 'rtl') {
716
- x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
717
- }
718
-
719
- return {
720
- width: width,
721
- height: height,
722
- x: x,
723
- y: y
724
- };
725
- }
726
-
727
- function isScrollParent(element) {
728
- // Firefox wants us to check `-x` and `-y` variations as well
729
- var _getComputedStyle = getComputedStyle(element),
730
- overflow = _getComputedStyle.overflow,
731
- overflowX = _getComputedStyle.overflowX,
732
- overflowY = _getComputedStyle.overflowY;
733
-
734
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
735
- }
736
-
737
- function getScrollParent(node) {
738
- if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
739
- // $FlowFixMe: assume body is always available
740
- return node.ownerDocument.body;
741
- }
742
-
743
- if (isHTMLElement(node) && isScrollParent(node)) {
744
- return node;
745
- }
746
-
747
- return getScrollParent(getParentNode(node));
748
- }
749
-
750
- /*
751
- given a DOM element, return the list of all scroll parents, up the list of ancesors
752
- until we get to the top window object. This list is what we attach scroll listeners
753
- to, because if any of these parent elements scroll, we'll need to re-calculate the
754
- reference element's position.
755
- */
756
-
757
- function listScrollParents(element, list) {
758
- if (list === void 0) {
759
- list = [];
760
- }
761
-
762
- var scrollParent = getScrollParent(element);
763
- var isBody = getNodeName(scrollParent) === 'body';
764
- var win = getWindow(scrollParent);
765
- var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
766
- var updatedList = list.concat(target);
767
- return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here
768
- updatedList.concat(listScrollParents(getParentNode(target)));
769
- }
770
-
771
- function rectToClientRect(rect) {
772
- return Object.assign(Object.assign({}, rect), {}, {
773
- left: rect.x,
774
- top: rect.y,
775
- right: rect.x + rect.width,
776
- bottom: rect.y + rect.height
777
- });
778
- }
779
-
780
- function getInnerBoundingClientRect(element) {
781
- var rect = getBoundingClientRect(element);
782
- rect.top = rect.top + element.clientTop;
783
- rect.left = rect.left + element.clientLeft;
784
- rect.bottom = rect.top + element.clientHeight;
785
- rect.right = rect.left + element.clientWidth;
786
- rect.width = element.clientWidth;
787
- rect.height = element.clientHeight;
788
- rect.x = rect.left;
789
- rect.y = rect.top;
790
- return rect;
791
- }
792
-
793
- function getClientRectFromMixedType(element, clippingParent) {
794
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
795
- } // A "clipping parent" is an overflowable container with the characteristic of
796
- // clipping (or hiding) overflowing elements with a position different from
797
- // `initial`
798
-
799
-
800
- function getClippingParents(element) {
801
- var clippingParents = listScrollParents(getParentNode(element));
802
- var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
803
- var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
804
-
805
- if (!isElement(clipperElement)) {
806
- return [];
807
- } // $FlowFixMe: https://github.com/facebook/flow/issues/1414
808
-
809
-
810
- return clippingParents.filter(function (clippingParent) {
811
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
812
- });
813
- } // Gets the maximum area that the element is visible in due to any number of
814
- // clipping parents
815
-
816
-
817
- function getClippingRect(element, boundary, rootBoundary) {
818
- var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
819
- var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
820
- var firstClippingParent = clippingParents[0];
821
- var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
822
- var rect = getClientRectFromMixedType(element, clippingParent);
823
- accRect.top = Math.max(rect.top, accRect.top);
824
- accRect.right = Math.min(rect.right, accRect.right);
825
- accRect.bottom = Math.min(rect.bottom, accRect.bottom);
826
- accRect.left = Math.max(rect.left, accRect.left);
827
- return accRect;
828
- }, getClientRectFromMixedType(element, firstClippingParent));
829
- clippingRect.width = clippingRect.right - clippingRect.left;
830
- clippingRect.height = clippingRect.bottom - clippingRect.top;
831
- clippingRect.x = clippingRect.left;
832
- clippingRect.y = clippingRect.top;
833
- return clippingRect;
834
- }
835
-
836
- function getVariation(placement) {
837
- return placement.split('-')[1];
838
- }
839
-
840
- function computeOffsets(_ref) {
841
- var reference = _ref.reference,
842
- element = _ref.element,
843
- placement = _ref.placement;
844
- var basePlacement = placement ? getBasePlacement(placement) : null;
845
- var variation = placement ? getVariation(placement) : null;
846
- var commonX = reference.x + reference.width / 2 - element.width / 2;
847
- var commonY = reference.y + reference.height / 2 - element.height / 2;
848
- var offsets;
849
-
850
- switch (basePlacement) {
851
- case top:
852
- offsets = {
853
- x: commonX,
854
- y: reference.y - element.height
855
- };
856
- break;
857
-
858
- case bottom:
859
- offsets = {
860
- x: commonX,
861
- y: reference.y + reference.height
862
- };
863
- break;
864
-
865
- case right:
866
- offsets = {
867
- x: reference.x + reference.width,
868
- y: commonY
869
- };
870
- break;
871
-
872
- case left:
873
- offsets = {
874
- x: reference.x - element.width,
875
- y: commonY
876
- };
877
- break;
878
-
879
- default:
880
- offsets = {
881
- x: reference.x,
882
- y: reference.y
883
- };
884
- }
885
-
886
- var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
887
-
888
- if (mainAxis != null) {
889
- var len = mainAxis === 'y' ? 'height' : 'width';
890
-
891
- switch (variation) {
892
- case start:
893
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
894
- break;
895
-
896
- case end:
897
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
898
- break;
899
- }
900
- }
901
-
902
- return offsets;
903
- }
904
-
905
- function detectOverflow(state, options) {
906
- if (options === void 0) {
907
- options = {};
908
- }
909
-
910
- var _options = options,
911
- _options$placement = _options.placement,
912
- placement = _options$placement === void 0 ? state.placement : _options$placement,
913
- _options$boundary = _options.boundary,
914
- boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
915
- _options$rootBoundary = _options.rootBoundary,
916
- rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
917
- _options$elementConte = _options.elementContext,
918
- elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
919
- _options$altBoundary = _options.altBoundary,
920
- altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
921
- _options$padding = _options.padding,
922
- padding = _options$padding === void 0 ? 0 : _options$padding;
923
- var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
924
- var altContext = elementContext === popper ? reference : popper;
925
- var referenceElement = state.elements.reference;
926
- var popperRect = state.rects.popper;
927
- var element = state.elements[altBoundary ? altContext : elementContext];
928
- var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
929
- var referenceClientRect = getBoundingClientRect(referenceElement);
930
- var popperOffsets = computeOffsets({
931
- reference: referenceClientRect,
932
- element: popperRect,
933
- strategy: 'absolute',
934
- placement: placement
935
- });
936
- var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
937
- var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
938
- // 0 or negative = within the clipping rect
939
-
940
- var overflowOffsets = {
941
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
942
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
943
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
944
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
945
- };
946
- var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
947
-
948
- if (elementContext === popper && offsetData) {
949
- var offset = offsetData[placement];
950
- Object.keys(overflowOffsets).forEach(function (key) {
951
- var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
952
- var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
953
- overflowOffsets[key] += offset[axis] * multiply;
954
- });
955
- }
956
-
957
- return overflowOffsets;
958
- }
959
-
960
- /*:: type OverflowsMap = { [ComputedPlacement]: number }; */
961
-
962
- /*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */
963
- function computeAutoPlacement(state, options) {
964
- if (options === void 0) {
965
- options = {};
966
- }
967
-
968
- var _options = options,
969
- placement = _options.placement,
970
- boundary = _options.boundary,
971
- rootBoundary = _options.rootBoundary,
972
- padding = _options.padding,
973
- flipVariations = _options.flipVariations,
974
- _options$allowedAutoP = _options.allowedAutoPlacements,
975
- allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
976
- var variation = getVariation(placement);
977
- var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
978
- return getVariation(placement) === variation;
979
- }) : basePlacements; // $FlowFixMe
980
-
981
- var allowedPlacements = placements$1.filter(function (placement) {
982
- return allowedAutoPlacements.indexOf(placement) >= 0;
983
- });
984
-
985
- if (allowedPlacements.length === 0) {
986
- allowedPlacements = placements$1;
987
-
988
- if (process.env.NODE_ENV !== "production") {
989
- console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
990
- }
991
- } // $FlowFixMe: Flow seems to have problems with two array unions...
992
-
993
-
994
- var overflows = allowedPlacements.reduce(function (acc, placement) {
995
- acc[placement] = detectOverflow(state, {
996
- placement: placement,
997
- boundary: boundary,
998
- rootBoundary: rootBoundary,
999
- padding: padding
1000
- })[getBasePlacement(placement)];
1001
- return acc;
1002
- }, {});
1003
- return Object.keys(overflows).sort(function (a, b) {
1004
- return overflows[a] - overflows[b];
1005
- });
1006
- }
1007
-
1008
- function getExpandedFallbackPlacements(placement) {
1009
- if (getBasePlacement(placement) === auto) {
1010
- return [];
1011
- }
1012
-
1013
- var oppositePlacement = getOppositePlacement(placement);
1014
- return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1015
- }
1016
-
1017
- function flip(_ref) {
1018
- var state = _ref.state,
1019
- options = _ref.options,
1020
- name = _ref.name;
1021
-
1022
- if (state.modifiersData[name]._skip) {
1023
- return;
1024
- }
1025
-
1026
- var _options$mainAxis = options.mainAxis,
1027
- checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1028
- _options$altAxis = options.altAxis,
1029
- checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1030
- specifiedFallbackPlacements = options.fallbackPlacements,
1031
- padding = options.padding,
1032
- boundary = options.boundary,
1033
- rootBoundary = options.rootBoundary,
1034
- altBoundary = options.altBoundary,
1035
- _options$flipVariatio = options.flipVariations,
1036
- flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1037
- allowedAutoPlacements = options.allowedAutoPlacements;
1038
- var preferredPlacement = state.options.placement;
1039
- var basePlacement = getBasePlacement(preferredPlacement);
1040
- var isBasePlacement = basePlacement === preferredPlacement;
1041
- var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1042
- var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1043
- return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
1044
- placement: placement,
1045
- boundary: boundary,
1046
- rootBoundary: rootBoundary,
1047
- padding: padding,
1048
- flipVariations: flipVariations,
1049
- allowedAutoPlacements: allowedAutoPlacements
1050
- }) : placement);
1051
- }, []);
1052
- var referenceRect = state.rects.reference;
1053
- var popperRect = state.rects.popper;
1054
- var checksMap = new Map();
1055
- var makeFallbackChecks = true;
1056
- var firstFittingPlacement = placements[0];
1057
-
1058
- for (var i = 0; i < placements.length; i++) {
1059
- var placement = placements[i];
1060
-
1061
- var _basePlacement = getBasePlacement(placement);
1062
-
1063
- var isStartVariation = getVariation(placement) === start;
1064
- var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1065
- var len = isVertical ? 'width' : 'height';
1066
- var overflow = detectOverflow(state, {
1067
- placement: placement,
1068
- boundary: boundary,
1069
- rootBoundary: rootBoundary,
1070
- altBoundary: altBoundary,
1071
- padding: padding
1072
- });
1073
- var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1074
-
1075
- if (referenceRect[len] > popperRect[len]) {
1076
- mainVariationSide = getOppositePlacement(mainVariationSide);
1077
- }
1078
-
1079
- var altVariationSide = getOppositePlacement(mainVariationSide);
1080
- var checks = [];
1081
-
1082
- if (checkMainAxis) {
1083
- checks.push(overflow[_basePlacement] <= 0);
1084
- }
1085
-
1086
- if (checkAltAxis) {
1087
- checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1088
- }
1089
-
1090
- if (checks.every(function (check) {
1091
- return check;
1092
- })) {
1093
- firstFittingPlacement = placement;
1094
- makeFallbackChecks = false;
1095
- break;
1096
- }
1097
-
1098
- checksMap.set(placement, checks);
1099
- }
1100
-
1101
- if (makeFallbackChecks) {
1102
- // `2` may be desired in some cases – research later
1103
- var numberOfChecks = flipVariations ? 3 : 1;
1104
-
1105
- var _loop = function _loop(_i) {
1106
- var fittingPlacement = placements.find(function (placement) {
1107
- var checks = checksMap.get(placement);
1108
-
1109
- if (checks) {
1110
- return checks.slice(0, _i).every(function (check) {
1111
- return check;
1112
- });
1113
- }
1114
- });
1115
-
1116
- if (fittingPlacement) {
1117
- firstFittingPlacement = fittingPlacement;
1118
- return "break";
1119
- }
1120
- };
1121
-
1122
- for (var _i = numberOfChecks; _i > 0; _i--) {
1123
- var _ret = _loop(_i);
1124
-
1125
- if (_ret === "break") break;
1126
- }
1127
- }
1128
-
1129
- if (state.placement !== firstFittingPlacement) {
1130
- state.modifiersData[name]._skip = true;
1131
- state.placement = firstFittingPlacement;
1132
- state.reset = true;
1133
- }
1134
- } // eslint-disable-next-line import/no-unused-modules
1135
-
1136
-
1137
- var flip$1 = {
1138
- name: 'flip',
1139
- enabled: true,
1140
- phase: 'main',
1141
- fn: flip,
1142
- requiresIfExists: ['offset'],
1143
- data: {
1144
- _skip: false
1145
- }
1146
- };
1147
-
1148
- function getSideOffsets(overflow, rect, preventedOffsets) {
1149
- if (preventedOffsets === void 0) {
1150
- preventedOffsets = {
1151
- x: 0,
1152
- y: 0
1153
- };
1154
- }
1155
-
1156
- return {
1157
- top: overflow.top - rect.height - preventedOffsets.y,
1158
- right: overflow.right - rect.width + preventedOffsets.x,
1159
- bottom: overflow.bottom - rect.height + preventedOffsets.y,
1160
- left: overflow.left - rect.width - preventedOffsets.x
1161
- };
1162
- }
1163
-
1164
- function isAnySideFullyClipped(overflow) {
1165
- return [top, right, bottom, left].some(function (side) {
1166
- return overflow[side] >= 0;
1167
- });
1168
- }
1169
-
1170
- function hide(_ref) {
1171
- var state = _ref.state,
1172
- name = _ref.name;
1173
- var referenceRect = state.rects.reference;
1174
- var popperRect = state.rects.popper;
1175
- var preventedOffsets = state.modifiersData.preventOverflow;
1176
- var referenceOverflow = detectOverflow(state, {
1177
- elementContext: 'reference'
1178
- });
1179
- var popperAltOverflow = detectOverflow(state, {
1180
- altBoundary: true
1181
- });
1182
- var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1183
- var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1184
- var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1185
- var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1186
- state.modifiersData[name] = {
1187
- referenceClippingOffsets: referenceClippingOffsets,
1188
- popperEscapeOffsets: popperEscapeOffsets,
1189
- isReferenceHidden: isReferenceHidden,
1190
- hasPopperEscaped: hasPopperEscaped
1191
- };
1192
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
1193
- 'data-popper-reference-hidden': isReferenceHidden,
1194
- 'data-popper-escaped': hasPopperEscaped
1195
- });
1196
- } // eslint-disable-next-line import/no-unused-modules
1197
-
1198
-
1199
- var hide$1 = {
1200
- name: 'hide',
1201
- enabled: true,
1202
- phase: 'main',
1203
- requiresIfExists: ['preventOverflow'],
1204
- fn: hide
1205
- };
1206
-
1207
- function distanceAndSkiddingToXY(placement, rects, offset) {
1208
- var basePlacement = getBasePlacement(placement);
1209
- var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1210
-
1211
- var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
1212
- placement: placement
1213
- })) : offset,
1214
- skidding = _ref[0],
1215
- distance = _ref[1];
1216
-
1217
- skidding = skidding || 0;
1218
- distance = (distance || 0) * invertDistance;
1219
- return [left, right].indexOf(basePlacement) >= 0 ? {
1220
- x: distance,
1221
- y: skidding
1222
- } : {
1223
- x: skidding,
1224
- y: distance
1225
- };
1226
- }
1227
-
1228
- function offset(_ref2) {
1229
- var state = _ref2.state,
1230
- options = _ref2.options,
1231
- name = _ref2.name;
1232
- var _options$offset = options.offset,
1233
- offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1234
- var data = placements.reduce(function (acc, placement) {
1235
- acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1236
- return acc;
1237
- }, {});
1238
- var _data$state$placement = data[state.placement],
1239
- x = _data$state$placement.x,
1240
- y = _data$state$placement.y;
1241
-
1242
- if (state.modifiersData.popperOffsets != null) {
1243
- state.modifiersData.popperOffsets.x += x;
1244
- state.modifiersData.popperOffsets.y += y;
1245
- }
1246
-
1247
- state.modifiersData[name] = data;
1248
- } // eslint-disable-next-line import/no-unused-modules
1249
-
1250
-
1251
- var offset$1 = {
1252
- name: 'offset',
1253
- enabled: true,
1254
- phase: 'main',
1255
- requires: ['popperOffsets'],
1256
- fn: offset
1257
- };
1258
-
1259
- function popperOffsets(_ref) {
1260
- var state = _ref.state,
1261
- name = _ref.name;
1262
- // Offsets are the actual position the popper needs to have to be
1263
- // properly positioned near its reference element
1264
- // This is the most basic placement, and will be adjusted by
1265
- // the modifiers in the next step
1266
- state.modifiersData[name] = computeOffsets({
1267
- reference: state.rects.reference,
1268
- element: state.rects.popper,
1269
- strategy: 'absolute',
1270
- placement: state.placement
1271
- });
1272
- } // eslint-disable-next-line import/no-unused-modules
1273
-
1274
-
1275
- var popperOffsets$1 = {
1276
- name: 'popperOffsets',
1277
- enabled: true,
1278
- phase: 'read',
1279
- fn: popperOffsets,
1280
- data: {}
1281
- };
1282
-
1283
- function getAltAxis(axis) {
1284
- return axis === 'x' ? 'y' : 'x';
1285
- }
1286
-
1287
- function preventOverflow(_ref) {
1288
- var state = _ref.state,
1289
- options = _ref.options,
1290
- name = _ref.name;
1291
- var _options$mainAxis = options.mainAxis,
1292
- checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1293
- _options$altAxis = options.altAxis,
1294
- checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1295
- boundary = options.boundary,
1296
- rootBoundary = options.rootBoundary,
1297
- altBoundary = options.altBoundary,
1298
- padding = options.padding,
1299
- _options$tether = options.tether,
1300
- tether = _options$tether === void 0 ? true : _options$tether,
1301
- _options$tetherOffset = options.tetherOffset,
1302
- tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1303
- var overflow = detectOverflow(state, {
1304
- boundary: boundary,
1305
- rootBoundary: rootBoundary,
1306
- padding: padding,
1307
- altBoundary: altBoundary
1308
- });
1309
- var basePlacement = getBasePlacement(state.placement);
1310
- var variation = getVariation(state.placement);
1311
- var isBasePlacement = !variation;
1312
- var mainAxis = getMainAxisFromPlacement(basePlacement);
1313
- var altAxis = getAltAxis(mainAxis);
1314
- var popperOffsets = state.modifiersData.popperOffsets;
1315
- var referenceRect = state.rects.reference;
1316
- var popperRect = state.rects.popper;
1317
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
1318
- placement: state.placement
1319
- })) : tetherOffset;
1320
- var data = {
1321
- x: 0,
1322
- y: 0
1323
- };
1324
-
1325
- if (!popperOffsets) {
1326
- return;
1327
- }
1328
-
1329
- if (checkMainAxis) {
1330
- var mainSide = mainAxis === 'y' ? top : left;
1331
- var altSide = mainAxis === 'y' ? bottom : right;
1332
- var len = mainAxis === 'y' ? 'height' : 'width';
1333
- var offset = popperOffsets[mainAxis];
1334
- var min = popperOffsets[mainAxis] + overflow[mainSide];
1335
- var max = popperOffsets[mainAxis] - overflow[altSide];
1336
- var additive = tether ? -popperRect[len] / 2 : 0;
1337
- var minLen = variation === start ? referenceRect[len] : popperRect[len];
1338
- var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1339
- // outside the reference bounds
1340
-
1341
- var arrowElement = state.elements.arrow;
1342
- var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1343
- width: 0,
1344
- height: 0
1345
- };
1346
- var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1347
- var arrowPaddingMin = arrowPaddingObject[mainSide];
1348
- var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1349
- // to include its full size in the calculation. If the reference is small
1350
- // and near the edge of a boundary, the popper can overflow even if the
1351
- // reference is not overflowing as well (e.g. virtual elements with no
1352
- // width or height)
1353
-
1354
- var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1355
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
1356
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
1357
- var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1358
- var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1359
- var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
1360
- var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
1361
- var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
1362
- var preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);
1363
- popperOffsets[mainAxis] = preventedOffset;
1364
- data[mainAxis] = preventedOffset - offset;
1365
- }
1366
-
1367
- if (checkAltAxis) {
1368
- var _mainSide = mainAxis === 'x' ? top : left;
1369
-
1370
- var _altSide = mainAxis === 'x' ? bottom : right;
1371
-
1372
- var _offset = popperOffsets[altAxis];
1373
-
1374
- var _min = _offset + overflow[_mainSide];
1375
-
1376
- var _max = _offset - overflow[_altSide];
1377
-
1378
- var _preventedOffset = within(_min, _offset, _max);
1379
-
1380
- popperOffsets[altAxis] = _preventedOffset;
1381
- data[altAxis] = _preventedOffset - _offset;
1382
- }
1383
-
1384
- state.modifiersData[name] = data;
1385
- } // eslint-disable-next-line import/no-unused-modules
1386
-
1387
-
1388
- var preventOverflow$1 = {
1389
- name: 'preventOverflow',
1390
- enabled: true,
1391
- phase: 'main',
1392
- fn: preventOverflow,
1393
- requiresIfExists: ['offset']
1394
- };
1395
-
1396
- function getHTMLElementScroll(element) {
1397
- return {
1398
- scrollLeft: element.scrollLeft,
1399
- scrollTop: element.scrollTop
1400
- };
1401
- }
1402
-
1403
- function getNodeScroll(node) {
1404
- if (node === getWindow(node) || !isHTMLElement(node)) {
1405
- return getWindowScroll(node);
1406
- } else {
1407
- return getHTMLElementScroll(node);
1408
- }
1409
- }
1410
-
1411
- // Composite means it takes into account transforms as well as layout.
1412
-
1413
- function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1414
- if (isFixed === void 0) {
1415
- isFixed = false;
1416
- }
1417
-
1418
- var documentElement = getDocumentElement(offsetParent);
1419
- var rect = getBoundingClientRect(elementOrVirtualElement);
1420
- var isOffsetParentAnElement = isHTMLElement(offsetParent);
1421
- var scroll = {
1422
- scrollLeft: 0,
1423
- scrollTop: 0
1424
- };
1425
- var offsets = {
1426
- x: 0,
1427
- y: 0
1428
- };
1429
-
1430
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1431
- if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1432
- isScrollParent(documentElement)) {
1433
- scroll = getNodeScroll(offsetParent);
1434
- }
1435
-
1436
- if (isHTMLElement(offsetParent)) {
1437
- offsets = getBoundingClientRect(offsetParent);
1438
- offsets.x += offsetParent.clientLeft;
1439
- offsets.y += offsetParent.clientTop;
1440
- } else if (documentElement) {
1441
- offsets.x = getWindowScrollBarX(documentElement);
1442
- }
1443
- }
1444
-
1445
- return {
1446
- x: rect.left + scroll.scrollLeft - offsets.x,
1447
- y: rect.top + scroll.scrollTop - offsets.y,
1448
- width: rect.width,
1449
- height: rect.height
1450
- };
1451
- }
1452
-
1453
- function order(modifiers) {
1454
- var map = new Map();
1455
- var visited = new Set();
1456
- var result = [];
1457
- modifiers.forEach(function (modifier) {
1458
- map.set(modifier.name, modifier);
1459
- }); // On visiting object, check for its dependencies and visit them recursively
1460
-
1461
- function sort(modifier) {
1462
- visited.add(modifier.name);
1463
- var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1464
- requires.forEach(function (dep) {
1465
- if (!visited.has(dep)) {
1466
- var depModifier = map.get(dep);
1467
-
1468
- if (depModifier) {
1469
- sort(depModifier);
1470
- }
1471
- }
1472
- });
1473
- result.push(modifier);
1474
- }
1475
-
1476
- modifiers.forEach(function (modifier) {
1477
- if (!visited.has(modifier.name)) {
1478
- // check for visited object
1479
- sort(modifier);
1480
- }
1481
- });
1482
- return result;
1483
- }
1484
-
1485
- function orderModifiers(modifiers) {
1486
- // order based on dependencies
1487
- var orderedModifiers = order(modifiers); // order based on phase
1488
-
1489
- return modifierPhases.reduce(function (acc, phase) {
1490
- return acc.concat(orderedModifiers.filter(function (modifier) {
1491
- return modifier.phase === phase;
1492
- }));
1493
- }, []);
1494
- }
1495
-
1496
- function debounce(fn) {
1497
- var pending;
1498
- return function () {
1499
- if (!pending) {
1500
- pending = new Promise(function (resolve) {
1501
- Promise.resolve().then(function () {
1502
- pending = undefined;
1503
- resolve(fn());
1504
- });
1505
- });
1506
- }
1507
-
1508
- return pending;
1509
- };
1510
- }
1511
-
1512
- function format(str) {
1513
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1514
- args[_key - 1] = arguments[_key];
1515
- }
1516
-
1517
- return [].concat(args).reduce(function (p, c) {
1518
- return p.replace(/%s/, c);
1519
- }, str);
1520
- }
1521
-
1522
- var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
1523
- var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
1524
- var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
1525
- function validateModifiers(modifiers) {
1526
- modifiers.forEach(function (modifier) {
1527
- Object.keys(modifier).forEach(function (key) {
1528
- switch (key) {
1529
- case 'name':
1530
- if (typeof modifier.name !== 'string') {
1531
- console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
1532
- }
1533
-
1534
- break;
1535
-
1536
- case 'enabled':
1537
- if (typeof modifier.enabled !== 'boolean') {
1538
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
1539
- }
1540
-
1541
- case 'phase':
1542
- if (modifierPhases.indexOf(modifier.phase) < 0) {
1543
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
1544
- }
1545
-
1546
- break;
1547
-
1548
- case 'fn':
1549
- if (typeof modifier.fn !== 'function') {
1550
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
1551
- }
1552
-
1553
- break;
1554
-
1555
- case 'effect':
1556
- if (typeof modifier.effect !== 'function') {
1557
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
1558
- }
1559
-
1560
- break;
1561
-
1562
- case 'requires':
1563
- if (!Array.isArray(modifier.requires)) {
1564
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
1565
- }
1566
-
1567
- break;
1568
-
1569
- case 'requiresIfExists':
1570
- if (!Array.isArray(modifier.requiresIfExists)) {
1571
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
1572
- }
1573
-
1574
- break;
1575
-
1576
- case 'options':
1577
- case 'data':
1578
- break;
1579
-
1580
- default:
1581
- console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
1582
- return "\"" + s + "\"";
1583
- }).join(', ') + "; but \"" + key + "\" was provided.");
1584
- }
1585
-
1586
- modifier.requires && modifier.requires.forEach(function (requirement) {
1587
- if (modifiers.find(function (mod) {
1588
- return mod.name === requirement;
1589
- }) == null) {
1590
- console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
1591
- }
1592
- });
1593
- });
1594
- });
1595
- }
1596
-
1597
- function uniqueBy(arr, fn) {
1598
- var identifiers = new Set();
1599
- return arr.filter(function (item) {
1600
- var identifier = fn(item);
1601
-
1602
- if (!identifiers.has(identifier)) {
1603
- identifiers.add(identifier);
1604
- return true;
1605
- }
1606
- });
1607
- }
1608
-
1609
- function mergeByName(modifiers) {
1610
- var merged = modifiers.reduce(function (merged, current) {
1611
- var existing = merged[current.name];
1612
- merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
1613
- options: Object.assign(Object.assign({}, existing.options), current.options),
1614
- data: Object.assign(Object.assign({}, existing.data), current.data)
1615
- }) : current;
1616
- return merged;
1617
- }, {}); // IE11 does not support Object.values
1618
-
1619
- return Object.keys(merged).map(function (key) {
1620
- return merged[key];
1621
- });
1622
- }
1623
-
1624
- var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
1625
- var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
1626
- var DEFAULT_OPTIONS = {
1627
- placement: 'bottom',
1628
- modifiers: [],
1629
- strategy: 'absolute'
1630
- };
1631
-
1632
- function areValidElements() {
1633
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1634
- args[_key] = arguments[_key];
1635
- }
1636
-
1637
- return !args.some(function (element) {
1638
- return !(element && typeof element.getBoundingClientRect === 'function');
1639
- });
1640
- }
1641
-
1642
- function popperGenerator(generatorOptions) {
1643
- if (generatorOptions === void 0) {
1644
- generatorOptions = {};
1645
- }
1646
-
1647
- var _generatorOptions = generatorOptions,
1648
- _generatorOptions$def = _generatorOptions.defaultModifiers,
1649
- defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
1650
- _generatorOptions$def2 = _generatorOptions.defaultOptions,
1651
- defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1652
- return function createPopper(reference, popper, options) {
1653
- if (options === void 0) {
1654
- options = defaultOptions;
1655
- }
1656
-
1657
- var state = {
1658
- placement: 'bottom',
1659
- orderedModifiers: [],
1660
- options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
1661
- modifiersData: {},
1662
- elements: {
1663
- reference: reference,
1664
- popper: popper
1665
- },
1666
- attributes: {},
1667
- styles: {}
1668
- };
1669
- var effectCleanupFns = [];
1670
- var isDestroyed = false;
1671
- var instance = {
1672
- state: state,
1673
- setOptions: function setOptions(options) {
1674
- cleanupModifierEffects();
1675
- state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
1676
- state.scrollParents = {
1677
- reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1678
- popper: listScrollParents(popper)
1679
- }; // Orders the modifiers based on their dependencies and `phase`
1680
- // properties
1681
-
1682
- var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
1683
-
1684
- state.orderedModifiers = orderedModifiers.filter(function (m) {
1685
- return m.enabled;
1686
- }); // Validate the provided modifiers so that the consumer will get warned
1687
- // if one of the modifiers is invalid for any reason
1688
-
1689
- if (process.env.NODE_ENV !== "production") {
1690
- var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
1691
- var name = _ref.name;
1692
- return name;
1693
- });
1694
- validateModifiers(modifiers);
1695
-
1696
- if (getBasePlacement(state.options.placement) === auto) {
1697
- var flipModifier = state.orderedModifiers.find(function (_ref2) {
1698
- var name = _ref2.name;
1699
- return name === 'flip';
1700
- });
1701
-
1702
- if (!flipModifier) {
1703
- console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
1704
- }
1705
- }
1706
-
1707
- var _getComputedStyle = getComputedStyle(popper),
1708
- marginTop = _getComputedStyle.marginTop,
1709
- marginRight = _getComputedStyle.marginRight,
1710
- marginBottom = _getComputedStyle.marginBottom,
1711
- marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
1712
- // cause bugs with positioning, so we'll warn the consumer
1713
-
1714
-
1715
- if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
1716
- return parseFloat(margin);
1717
- })) {
1718
- console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
1719
- }
1720
- }
1721
-
1722
- runModifierEffects();
1723
- return instance.update();
1724
- },
1725
- // Sync update – it will always be executed, even if not necessary. This
1726
- // is useful for low frequency updates where sync behavior simplifies the
1727
- // logic.
1728
- // For high frequency updates (e.g. `resize` and `scroll` events), always
1729
- // prefer the async Popper#update method
1730
- forceUpdate: function forceUpdate() {
1731
- if (isDestroyed) {
1732
- return;
1733
- }
1734
-
1735
- var _state$elements = state.elements,
1736
- reference = _state$elements.reference,
1737
- popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
1738
- // anymore
1739
-
1740
- if (!areValidElements(reference, popper)) {
1741
- if (process.env.NODE_ENV !== "production") {
1742
- console.error(INVALID_ELEMENT_ERROR);
1743
- }
1744
-
1745
- return;
1746
- } // Store the reference and popper rects to be read by modifiers
1747
-
1748
-
1749
- state.rects = {
1750
- reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
1751
- popper: getLayoutRect(popper)
1752
- }; // Modifiers have the ability to reset the current update cycle. The
1753
- // most common use case for this is the `flip` modifier changing the
1754
- // placement, which then needs to re-run all the modifiers, because the
1755
- // logic was previously ran for the previous placement and is therefore
1756
- // stale/incorrect
1757
-
1758
- state.reset = false;
1759
- state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
1760
- // is filled with the initial data specified by the modifier. This means
1761
- // it doesn't persist and is fresh on each update.
1762
- // To ensure persistent data, use `${name}#persistent`
1763
-
1764
- state.orderedModifiers.forEach(function (modifier) {
1765
- return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1766
- });
1767
- var __debug_loops__ = 0;
1768
-
1769
- for (var index = 0; index < state.orderedModifiers.length; index++) {
1770
- if (process.env.NODE_ENV !== "production") {
1771
- __debug_loops__ += 1;
1772
-
1773
- if (__debug_loops__ > 100) {
1774
- console.error(INFINITE_LOOP_ERROR);
1775
- break;
1776
- }
1777
- }
1778
-
1779
- if (state.reset === true) {
1780
- state.reset = false;
1781
- index = -1;
1782
- continue;
1783
- }
1784
-
1785
- var _state$orderedModifie = state.orderedModifiers[index],
1786
- fn = _state$orderedModifie.fn,
1787
- _state$orderedModifie2 = _state$orderedModifie.options,
1788
- _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1789
- name = _state$orderedModifie.name;
1790
-
1791
- if (typeof fn === 'function') {
1792
- state = fn({
1793
- state: state,
1794
- options: _options,
1795
- name: name,
1796
- instance: instance
1797
- }) || state;
1798
- }
1799
- }
1800
- },
1801
- // Async and optimistically optimized update – it will not be executed if
1802
- // not necessary (debounced to run at most once-per-tick)
1803
- update: debounce(function () {
1804
- return new Promise(function (resolve) {
1805
- instance.forceUpdate();
1806
- resolve(state);
1807
- });
1808
- }),
1809
- destroy: function destroy() {
1810
- cleanupModifierEffects();
1811
- isDestroyed = true;
1812
- }
1813
- };
1814
-
1815
- if (!areValidElements(reference, popper)) {
1816
- if (process.env.NODE_ENV !== "production") {
1817
- console.error(INVALID_ELEMENT_ERROR);
1818
- }
1819
-
1820
- return instance;
1821
- }
1822
-
1823
- instance.setOptions(options).then(function (state) {
1824
- if (!isDestroyed && options.onFirstUpdate) {
1825
- options.onFirstUpdate(state);
1826
- }
1827
- }); // Modifiers have the ability to execute arbitrary code before the first
1828
- // update cycle runs. They will be executed in the same order as the update
1829
- // cycle. This is useful when a modifier adds some persistent data that
1830
- // other modifiers need to use, but the modifier is run after the dependent
1831
- // one.
1832
-
1833
- function runModifierEffects() {
1834
- state.orderedModifiers.forEach(function (_ref3) {
1835
- var name = _ref3.name,
1836
- _ref3$options = _ref3.options,
1837
- options = _ref3$options === void 0 ? {} : _ref3$options,
1838
- effect = _ref3.effect;
1839
-
1840
- if (typeof effect === 'function') {
1841
- var cleanupFn = effect({
1842
- state: state,
1843
- name: name,
1844
- instance: instance,
1845
- options: options
1846
- });
1847
-
1848
- var noopFn = function noopFn() {};
1849
-
1850
- effectCleanupFns.push(cleanupFn || noopFn);
1851
- }
1852
- });
1853
- }
1854
-
1855
- function cleanupModifierEffects() {
1856
- effectCleanupFns.forEach(function (fn) {
1857
- return fn();
1858
- });
1859
- effectCleanupFns = [];
1860
- }
1861
-
1862
- return instance;
1863
- };
1864
- }
1865
-
1866
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1867
- var createPopper = /*#__PURE__*/popperGenerator({
1868
- defaultModifiers: defaultModifiers
1869
- }); // eslint-disable-next-line import/no-unused-modules
1870
-
1871
- /**
1872
- * Simple ponyfill for Object.fromEntries
1873
- */
1874
-
1875
- var fromEntries = function fromEntries(entries) {
1876
- return entries.reduce(function (acc, _ref) {
1877
- var key = _ref[0],
1878
- value = _ref[1];
1879
- acc[key] = value;
1880
- return acc;
1881
- }, {});
1882
- };
1883
- /**
1884
- * Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs
1885
- */
1886
-
1887
- var useIsomorphicLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? useLayoutEffect : useEffect;
1888
-
1889
- /* global Map:readonly, Set:readonly, ArrayBuffer:readonly */
1890
-
1891
- var hasElementType = typeof Element !== 'undefined';
1892
- var hasMap = typeof Map === 'function';
1893
- var hasSet = typeof Set === 'function';
1894
- var hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView;
1895
-
1896
- // Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js
1897
-
1898
- function equal(a, b) {
1899
- // START: fast-deep-equal es6/index.js 3.1.1
1900
- if (a === b) return true;
1901
-
1902
- if (a && b && typeof a == 'object' && typeof b == 'object') {
1903
- if (a.constructor !== b.constructor) return false;
1904
-
1905
- var length, i, keys;
1906
- if (Array.isArray(a)) {
1907
- length = a.length;
1908
- if (length != b.length) return false;
1909
- for (i = length; i-- !== 0;)
1910
- if (!equal(a[i], b[i])) return false;
1911
- return true;
1912
- }
1913
-
1914
- // START: Modifications:
1915
- // 1. Extra `has<Type> &&` helpers in initial condition allow es6 code
1916
- // to co-exist with es5.
1917
- // 2. Replace `for of` with es5 compliant iteration using `for`.
1918
- // Basically, take:
1919
- //
1920
- // ```js
1921
- // for (i of a.entries())
1922
- // if (!b.has(i[0])) return false;
1923
- // ```
1924
- //
1925
- // ... and convert to:
1926
- //
1927
- // ```js
1928
- // it = a.entries();
1929
- // while (!(i = it.next()).done)
1930
- // if (!b.has(i.value[0])) return false;
1931
- // ```
1932
- //
1933
- // **Note**: `i` access switches to `i.value`.
1934
- var it;
1935
- if (hasMap && (a instanceof Map) && (b instanceof Map)) {
1936
- if (a.size !== b.size) return false;
1937
- it = a.entries();
1938
- while (!(i = it.next()).done)
1939
- if (!b.has(i.value[0])) return false;
1940
- it = a.entries();
1941
- while (!(i = it.next()).done)
1942
- if (!equal(i.value[1], b.get(i.value[0]))) return false;
1943
- return true;
1944
- }
1945
-
1946
- if (hasSet && (a instanceof Set) && (b instanceof Set)) {
1947
- if (a.size !== b.size) return false;
1948
- it = a.entries();
1949
- while (!(i = it.next()).done)
1950
- if (!b.has(i.value[0])) return false;
1951
- return true;
1952
- }
1953
- // END: Modifications
1954
-
1955
- if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
1956
- length = a.length;
1957
- if (length != b.length) return false;
1958
- for (i = length; i-- !== 0;)
1959
- if (a[i] !== b[i]) return false;
1960
- return true;
1961
- }
1962
-
1963
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
1964
- if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
1965
- if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
1966
-
1967
- keys = Object.keys(a);
1968
- length = keys.length;
1969
- if (length !== Object.keys(b).length) return false;
1970
-
1971
- for (i = length; i-- !== 0;)
1972
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
1973
- // END: fast-deep-equal
1974
-
1975
- // START: react-fast-compare
1976
- // custom handling for DOM elements
1977
- if (hasElementType && a instanceof Element) return false;
1978
-
1979
- // custom handling for React/Preact
1980
- for (i = length; i-- !== 0;) {
1981
- if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {
1982
- // React-specific: avoid traversing React elements' _owner
1983
- // Preact-specific: avoid traversing Preact elements' __v and __o
1984
- // __v = $_original / $_vnode
1985
- // __o = $_owner
1986
- // These properties contain circular references and are not needed when
1987
- // comparing the actual elements (and not their owners)
1988
- // .$$typeof and ._store on just reasonable markers of elements
1989
-
1990
- continue;
1991
- }
1992
-
1993
- // all other properties should be traversed as usual
1994
- if (!equal(a[keys[i]], b[keys[i]])) return false;
1995
- }
1996
- // END: react-fast-compare
1997
-
1998
- // START: fast-deep-equal
1999
- return true;
2000
- }
2001
-
2002
- return a !== a && b !== b;
2003
- }
2004
- // end fast-deep-equal
2005
-
2006
- var reactFastCompare = function isEqual(a, b) {
2007
- try {
2008
- return equal(a, b);
2009
- } catch (error) {
2010
- if (((error.message || '').match(/stack|recursion/i))) {
2011
- // warn on circular references, don't crash
2012
- // browsers give this different errors name and messages:
2013
- // chrome/safari: "RangeError", "Maximum call stack size exceeded"
2014
- // firefox: "InternalError", too much recursion"
2015
- // edge: "Error", "Out of stack space"
2016
- console.warn('react-fast-compare cannot handle circular refs');
2017
- return false;
2018
- }
2019
- // some other error. we should definitely know about these
2020
- throw error;
2021
- }
2022
- };
2023
-
2024
- var EMPTY_MODIFIERS = [];
2025
- var usePopper = function usePopper(referenceElement, popperElement, options) {
2026
- if (options === void 0) {
2027
- options = {};
2028
- }
2029
-
2030
- var prevOptions = useRef(null);
2031
- var optionsWithDefaults = {
2032
- onFirstUpdate: options.onFirstUpdate,
2033
- placement: options.placement || 'bottom',
2034
- strategy: options.strategy || 'absolute',
2035
- modifiers: options.modifiers || EMPTY_MODIFIERS
2036
- };
2037
-
2038
- var _React$useState = useState({
2039
- styles: {
2040
- popper: {
2041
- position: optionsWithDefaults.strategy,
2042
- left: '0',
2043
- top: '0'
2044
- }
2045
- },
2046
- attributes: {}
2047
- }),
2048
- state = _React$useState[0],
2049
- setState = _React$useState[1];
2050
-
2051
- var updateStateModifier = useMemo(function () {
2052
- return {
2053
- name: 'updateState',
2054
- enabled: true,
2055
- phase: 'write',
2056
- fn: function fn(_ref) {
2057
- var state = _ref.state;
2058
- var elements = Object.keys(state.elements);
2059
- setState({
2060
- styles: fromEntries(elements.map(function (element) {
2061
- return [element, state.styles[element] || {}];
2062
- })),
2063
- attributes: fromEntries(elements.map(function (element) {
2064
- return [element, state.attributes[element]];
2065
- }))
2066
- });
2067
- },
2068
- requires: ['computeStyles']
2069
- };
2070
- }, []);
2071
- var popperOptions = useMemo(function () {
2072
- var newOptions = {
2073
- onFirstUpdate: optionsWithDefaults.onFirstUpdate,
2074
- placement: optionsWithDefaults.placement,
2075
- strategy: optionsWithDefaults.strategy,
2076
- modifiers: [].concat(optionsWithDefaults.modifiers, [updateStateModifier, {
2077
- name: 'applyStyles',
2078
- enabled: false
2079
- }])
2080
- };
2081
-
2082
- if (reactFastCompare(prevOptions.current, newOptions)) {
2083
- return prevOptions.current || newOptions;
2084
- } else {
2085
- prevOptions.current = newOptions;
2086
- return newOptions;
2087
- }
2088
- }, [optionsWithDefaults.onFirstUpdate, optionsWithDefaults.placement, optionsWithDefaults.strategy, optionsWithDefaults.modifiers, updateStateModifier]);
2089
- var popperInstanceRef = useRef();
2090
- useIsomorphicLayoutEffect(function () {
2091
- if (popperInstanceRef.current) {
2092
- popperInstanceRef.current.setOptions(popperOptions);
2093
- }
2094
- }, [popperOptions]);
2095
- useIsomorphicLayoutEffect(function () {
2096
- if (referenceElement == null || popperElement == null) {
2097
- return;
2098
- }
2099
-
2100
- var createPopper$1 = options.createPopper || createPopper;
2101
- var popperInstance = createPopper$1(referenceElement, popperElement, popperOptions);
2102
- popperInstanceRef.current = popperInstance;
2103
- return function () {
2104
- popperInstance.destroy();
2105
- popperInstanceRef.current = null;
2106
- };
2107
- }, [referenceElement, popperElement, options.createPopper]);
2108
- return {
2109
- state: popperInstanceRef.current ? popperInstanceRef.current.state : null,
2110
- styles: state.styles,
2111
- attributes: state.attributes,
2112
- update: popperInstanceRef.current ? popperInstanceRef.current.update : null,
2113
- forceUpdate: popperInstanceRef.current ? popperInstanceRef.current.forceUpdate : null
2114
- };
2115
- };
2116
-
2117
- /**
2118
- * Hook that allows to control when there is a focus event within a given element, meaning
2119
- * that any element within the given target will trigger the focus in and focus out events.
2120
- * @param options - UseFocusWithinOptions
2121
- */
2122
- var useFocusWithin = function useFocusWithin(_ref) {
2123
- var element = _ref.element,
2124
- onFocusIn = _ref.onFocusIn,
2125
- onFocusOut = _ref.onFocusOut;
2126
- useEffect(function () {
2127
- if (element) {
2128
- element.addEventListener('focusin', onFocusIn);
2129
- element.addEventListener('focusout', onFocusOut);
2130
- }
2131
-
2132
- return function () {
2133
- if (element) {
2134
- element.removeEventListener('focusin', onFocusIn);
2135
- element.removeEventListener('focusout', onFocusOut);
2136
- }
2137
- };
2138
- }, [onFocusIn, element, onFocusOut]);
2139
- };
2140
-
2141
- /**
2142
- * Different possible placements for the popover.
2143
- */
2144
-
2145
- var Placement = {
2146
- AUTO: 'auto',
2147
- AUTO_END: 'auto-end',
2148
- AUTO_START: 'auto-start',
2149
- TOP: 'top',
2150
- TOP_END: 'top-end',
2151
- TOP_START: 'top-start',
2152
- RIGHT: 'right',
2153
- RIGHT_END: 'right-end',
2154
- RIGHT_START: 'right-start',
2155
- BOTTOM: 'bottom',
2156
- BOTTOM_END: 'bottom-end',
2157
- BOTTOM_START: 'bottom-start',
2158
- LEFT: 'left',
2159
- LEFT_END: 'left-end',
2160
- LEFT_START: 'left-start'
2161
- };
2162
-
2163
- /**
2164
- * Arrow size (in pixel).
2165
- */
2166
- var ARROW_SIZE = 8;
2167
- /**
2168
- * Defines the props of the component.
2169
- */
2170
-
2171
- /**
2172
- * Component display name.
2173
- */
2174
- var COMPONENT_NAME = 'Popover';
2175
- /**
2176
- * Component default class name and class prefix.
2177
- */
2178
-
2179
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
2180
- /**
2181
- * Component default props.
2182
- */
2183
-
2184
- var DEFAULT_PROPS = {
2185
- elevation: 3,
2186
- placement: Placement.AUTO,
2187
- usePortal: true,
2188
- zIndex: 9999
2189
- };
2190
- /**
2191
- * Popper js modifier to fit popover min width to the anchor width.
2192
- */
2193
-
2194
- var sameWidth = {
2195
- name: 'sameWidth',
2196
- enabled: true,
2197
- phase: 'beforeWrite',
2198
- requires: ['computeStyles'],
2199
- fn: function fn(_ref) {
2200
- var state = _ref.state;
2201
- // eslint-disable-next-line no-param-reassign
2202
- state.styles.popper.minWidth = "".concat(state.rects.reference.width, "px");
2203
- },
2204
- effect: function effect(_ref2) {
2205
- var state = _ref2.state;
2206
- // eslint-disable-next-line no-param-reassign
2207
- state.elements.popper.style.minWidth = "".concat(state.elements.reference.offsetWidth, "px");
2208
- }
2209
- };
2210
- /**
2211
- * Popper js modifier to compute max size of the popover.
2212
- */
2213
-
2214
- var maxSize = {
2215
- name: 'maxSize',
2216
- enabled: true,
2217
- phase: 'main',
2218
- requiresIfExists: ['offset', 'preventOverflow', 'flip'],
2219
- fn: function fn(_ref3) {
2220
- var state = _ref3.state,
2221
- name = _ref3.name,
2222
- options = _ref3.options;
2223
- var overflow = detectOverflow(state, options);
2224
- var _state$modifiersData$ = state.modifiersData.preventOverflow,
2225
- _state$modifiersData$2 = _state$modifiersData$.y,
2226
- y = _state$modifiersData$2 === void 0 ? 0 : _state$modifiersData$2,
2227
- _state$modifiersData$3 = _state$modifiersData$.x,
2228
- x = _state$modifiersData$3 === void 0 ? 0 : _state$modifiersData$3;
2229
- var _state$rects$popper = state.rects.popper,
2230
- width = _state$rects$popper.width,
2231
- height = _state$rects$popper.height;
2232
-
2233
- var _state$placement$spli = state.placement.split('-'),
2234
- _state$placement$spli2 = _slicedToArray(_state$placement$spli, 1),
2235
- basePlacement = _state$placement$spli2[0];
2236
-
2237
- var widthProp = basePlacement === 'left' ? 'left' : 'right';
2238
- var heightProp = basePlacement === 'top' ? 'top' : 'bottom'; // eslint-disable-next-line no-param-reassign
2239
-
2240
- state.modifiersData[name] = {
2241
- width: width - overflow[widthProp] - x,
2242
- height: height - overflow[heightProp] - y
2243
- };
2244
- }
2245
- };
2246
- /**
2247
- * Popper js modifier to apply the max height.
2248
- */
2249
-
2250
- var applyMaxHeight = {
2251
- name: 'applyMaxHeight',
2252
- enabled: true,
2253
- phase: 'beforeWrite',
2254
- requires: ['maxSize'],
2255
- fn: function fn(_ref4) {
2256
- var state = _ref4.state;
2257
- var height = state.modifiersData.maxSize.height; // eslint-disable-next-line no-param-reassign
2258
-
2259
- state.elements.popper.style.maxHeight = "".concat(height - ARROW_SIZE, "px");
2260
- }
2261
- };
2262
- /** Method to render the popover inside a portal if usePortal is true */
2263
-
2264
- var renderPopover = function renderPopover(children, usePortal) {
2265
- return usePortal ? createPortal(children, document.body) : children;
2266
- };
2267
- /**
2268
- * Popover component.
2269
- *
2270
- * @param props Component props.
2271
- * @param ref Component ref.
2272
- * @return React element.
2273
- */
2274
-
2275
-
2276
- var Popover = forwardRef(function (props, ref) {
2277
- var _ref5, _ref6, _ref7, _ref8, _state$rects, _state$rects$popper2;
2278
-
2279
- if (!DOCUMENT) {
2280
- // Can't render in SSR.
2281
- return null;
2282
- }
2283
-
2284
- var anchorRef = props.anchorRef,
2285
- boundaryRef = props.boundaryRef,
2286
- children = props.children,
2287
- className = props.className,
2288
- closeOnClickAway = props.closeOnClickAway,
2289
- closeOnEscape = props.closeOnEscape,
2290
- elevation = props.elevation,
2291
- fitToAnchorWidth = props.fitToAnchorWidth,
2292
- fitWithinViewportHeight = props.fitWithinViewportHeight,
2293
- focusElement = props.focusElement,
2294
- hasArrow = props.hasArrow,
2295
- isOpen = props.isOpen,
2296
- offset = props.offset,
2297
- onClose = props.onClose,
2298
- parentElement = props.parentElement,
2299
- placement = props.placement,
2300
- style = props.style,
2301
- usePortal = props.usePortal,
2302
- zIndex = props.zIndex,
2303
- _props$focusAnchorOnC = props.focusAnchorOnClose,
2304
- focusAnchorOnClose = _props$focusAnchorOnC === void 0 ? true : _props$focusAnchorOnC,
2305
- forwardedProps = _objectWithoutProperties(props, ["anchorRef", "boundaryRef", "children", "className", "closeOnClickAway", "closeOnEscape", "elevation", "fitToAnchorWidth", "fitWithinViewportHeight", "focusElement", "hasArrow", "isOpen", "offset", "onClose", "parentElement", "placement", "style", "usePortal", "zIndex", "focusAnchorOnClose"]); // eslint-disable-next-line react-hooks/rules-of-hooks
2306
-
2307
-
2308
- var _useState = useState(),
2309
- _useState2 = _slicedToArray(_useState, 2),
2310
- popperElement = _useState2[0],
2311
- setPopperElement = _useState2[1]; // eslint-disable-next-line react-hooks/rules-of-hooks
2312
-
2313
-
2314
- var _useState3 = useState(null),
2315
- _useState4 = _slicedToArray(_useState3, 2),
2316
- arrowElement = _useState4[0],
2317
- setArrowElement = _useState4[1]; // eslint-disable-next-line react-hooks/rules-of-hooks
2318
-
2319
-
2320
- var clickAwayRef = useRef(null);
2321
- /**
2322
- * Track whether the focus is currently set in the
2323
- * popover.
2324
- * */
2325
- // eslint-disable-next-line react-hooks/rules-of-hooks
2326
-
2327
- var isFocusedWithin = useRef(false); // eslint-disable-next-line react-hooks/rules-of-hooks
2328
-
2329
- useFocusWithin({
2330
- element: popperElement || null,
2331
- onFocusIn: function onFocusIn() {
2332
- isFocusedWithin.current = true;
2333
- },
2334
- onFocusOut: function onFocusOut() {
2335
- isFocusedWithin.current = false;
2336
- }
2337
- });
2338
- /** Action on close */
2339
- // eslint-disable-next-line react-hooks/rules-of-hooks
2340
-
2341
- var handleClose = useCallback(function () {
2342
- if (!onClose) {
2343
- return;
2344
- }
2345
- /**
2346
- * If the focus is currently within the popover
2347
- * when the popover closes, reset the focus back to the anchor element
2348
- * unless specifically requested not to.
2349
- */
2350
-
2351
-
2352
- if (isFocusedWithin.current && focusAnchorOnClose) {
2353
- if (parentElement === null || parentElement === void 0 ? void 0 : parentElement.current) {
2354
- parentElement === null || parentElement === void 0 ? void 0 : parentElement.current.focus();
2355
- }
2356
-
2357
- var firstFocusable = (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) && getFirstAndLastFocusable(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current).first;
2358
-
2359
- if (firstFocusable) {
2360
- // Focus the first focusable element in anchor.
2361
- firstFocusable.focus();
2362
- } else {
2363
- var _anchorRef$current;
2364
-
2365
- // Fallback on the anchor element.
2366
- anchorRef === null || anchorRef === void 0 ? void 0 : (_anchorRef$current = anchorRef.current) === null || _anchorRef$current === void 0 ? void 0 : _anchorRef$current.focus();
2367
- }
2368
- }
2369
-
2370
- onClose();
2371
- }, [anchorRef, focusAnchorOnClose, onClose, parentElement]);
2372
- var modifiers = [];
2373
- var actualOffset = [(_ref5 = offset === null || offset === void 0 ? void 0 : offset.along) !== null && _ref5 !== void 0 ? _ref5 : 0, ((_ref6 = offset === null || offset === void 0 ? void 0 : offset.away) !== null && _ref6 !== void 0 ? _ref6 : 0) + (hasArrow ? ARROW_SIZE : 0)];
2374
- modifiers.push({
2375
- name: 'offset',
2376
- options: {
2377
- offset: actualOffset
2378
- }
2379
- });
2380
-
2381
- if (hasArrow && arrowElement) {
2382
- modifiers.push({
2383
- name: 'arrow',
2384
- options: {
2385
- element: arrowElement,
2386
- padding: ARROW_SIZE
2387
- }
2388
- });
2389
- }
2390
-
2391
- if (fitToAnchorWidth) {
2392
- modifiers.push(sameWidth);
2393
- }
2394
-
2395
- if (fitWithinViewportHeight) {
2396
- modifiers.push(_objectSpread2({}, maxSize, {
2397
- options: {
2398
- boundary: boundaryRef === null || boundaryRef === void 0 ? void 0 : boundaryRef.current
2399
- }
2400
- }), applyMaxHeight);
2401
- }
2402
-
2403
- if (boundaryRef) {
2404
- modifiers.push({
2405
- name: 'flip',
2406
- options: {
2407
- boundary: boundaryRef.current
2408
- }
2409
- });
2410
- modifiers.push({
2411
- name: 'preventOverflow',
2412
- options: {
2413
- boundary: boundaryRef.current
2414
- }
2415
- });
2416
- } // eslint-disable-next-line react-hooks/rules-of-hooks
2417
-
2418
-
2419
- var _usePopper = usePopper(anchorRef.current, popperElement, {
2420
- placement: placement,
2421
- modifiers: modifiers
2422
- }),
2423
- styles = _usePopper.styles,
2424
- attributes = _usePopper.attributes,
2425
- state = _usePopper.state,
2426
- update = _usePopper.update; // eslint-disable-next-line react-hooks/rules-of-hooks
2427
-
2428
-
2429
- useEffect(function () {
2430
- update === null || update === void 0 ? void 0 : update();
2431
- }, [children, update]);
2432
- var position = (_ref7 = state === null || state === void 0 ? void 0 : state.placement) !== null && _ref7 !== void 0 ? _ref7 : placement; // eslint-disable-next-line react-hooks/rules-of-hooks
2433
-
2434
- var popoverStyle = useMemo(function () {
2435
- var newStyles = _objectSpread2({}, style, {}, styles.popper, {
2436
- zIndex: zIndex
2437
- });
2438
-
2439
- if (fitWithinViewportHeight && !newStyles.maxHeight) {
2440
- newStyles.maxHeight = (WINDOW === null || WINDOW === void 0 ? void 0 : WINDOW.innerHeight) || (DOCUMENT === null || DOCUMENT === void 0 ? void 0 : DOCUMENT.documentElement.clientHeight);
2441
- }
2442
-
2443
- return newStyles;
2444
- }, [style, styles.popper, zIndex, fitWithinViewportHeight]); // eslint-disable-next-line react-hooks/rules-of-hooks
2445
-
2446
- useCallbackOnEscape(handleClose, isOpen && closeOnEscape); // eslint-disable-next-line react-hooks/rules-of-hooks
2447
-
2448
- useFocus(focusElement === null || focusElement === void 0 ? void 0 : focusElement.current, isOpen && ((_ref8 = state === null || state === void 0 ? void 0 : (_state$rects = state.rects) === null || _state$rects === void 0 ? void 0 : (_state$rects$popper2 = _state$rects.popper) === null || _state$rects$popper2 === void 0 ? void 0 : _state$rects$popper2.y) !== null && _ref8 !== void 0 ? _ref8 : -1) >= 0); // eslint-disable-next-line react-hooks/rules-of-hooks
2449
-
2450
- var clickAwayRefs = useRef([clickAwayRef, anchorRef]);
2451
- return isOpen ? renderPopover(React.createElement("div", _extends({}, forwardedProps, {
2452
- ref: mergeRefs(setPopperElement, ref, clickAwayRef),
2453
- className: classnames(className, handleBasicClasses({
2454
- prefix: CLASSNAME,
2455
- elevation: Math.min(elevation || 0, 5),
2456
- position: position
2457
- })),
2458
- style: popoverStyle
2459
- }, attributes.popper), React.createElement(ClickAwayProvider, {
2460
- callback: closeOnClickAway && handleClose,
2461
- childrenRefs: clickAwayRefs
2462
- }, hasArrow && React.createElement("div", {
2463
- ref: setArrowElement,
2464
- className: "".concat(CLASSNAME, "__arrow"),
2465
- style: styles.arrow
2466
- }), children)), usePortal) : null;
2467
- });
2468
- Popover.displayName = COMPONENT_NAME;
2469
- Popover.className = CLASSNAME;
2470
- Popover.defaultProps = DEFAULT_PROPS;
2471
-
2472
- export { Placement as P, Popover as a, useFocusWithin as b, usePopper as c, useFocus as u };
2473
- //# sourceMappingURL=Popover2.js.map