@react-md/core 1.0.0-next.14 → 1.0.0-next.15

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 (548) hide show
  1. package/.eslintrc.cjs +8 -0
  2. package/.turbo/turbo-build.log +22 -22
  3. package/.turbo/turbo-lint.log +3 -3
  4. package/.turbo/turbo-test.log +4000 -3982
  5. package/.turbo/turbo-typecheck.log +1 -23
  6. package/CHANGELOG.md +13 -0
  7. package/coverage/clover.xml +477 -410
  8. package/coverage/coverage-final.json +5 -4
  9. package/coverage/lcov-report/autocomplete/Autocomplete.tsx.html +81 -15
  10. package/coverage/lcov-report/autocomplete/AutocompleteClearButton.tsx.html +262 -0
  11. package/coverage/lcov-report/autocomplete/FilterAutocompleteOptions.tsx.html +364 -0
  12. package/coverage/lcov-report/autocomplete/index.html +48 -18
  13. package/coverage/lcov-report/card/Card.tsx.html +349 -0
  14. package/coverage/lcov-report/card/CardSubtitle.tsx.html +265 -0
  15. package/coverage/lcov-report/card/index.html +146 -0
  16. package/coverage/lcov-report/card/styles.ts.html +682 -0
  17. package/coverage/lcov-report/form/Option.tsx.html +727 -0
  18. package/coverage/lcov-report/form/index.html +131 -0
  19. package/coverage/lcov-report/form/useListboxProvider.ts.html +253 -0
  20. package/coverage/lcov-report/index.html +22 -37
  21. package/coverage/lcov-report/src/card/Card.tsx.html +349 -0
  22. package/coverage/lcov-report/src/card/CardSubtitle.tsx.html +277 -0
  23. package/coverage/lcov-report/src/card/index.html +146 -0
  24. package/coverage/lcov-report/src/card/styles.ts.html +682 -0
  25. package/coverage/lcov-report/src/cssUtils.ts.html +787 -0
  26. package/coverage/lcov-report/src/index.html +116 -0
  27. package/coverage/lcov-report/src/transition/index.html +116 -0
  28. package/coverage/lcov-report/src/transition/useCSSTransition.ts.html +766 -0
  29. package/coverage/lcov-report/transition/index.html +116 -0
  30. package/coverage/lcov-report/transition/useCSSTransition.ts.html +766 -0
  31. package/coverage/lcov.info +572 -456
  32. package/dist/CoreProviders.js.map +1 -1
  33. package/dist/NoSsr.js.map +1 -1
  34. package/dist/RootHtml.js.map +1 -1
  35. package/dist/SsrProvider.js.map +1 -1
  36. package/dist/app-bar/AppBar.js.map +1 -1
  37. package/dist/app-bar/AppBarTitle.d.ts +8 -4
  38. package/dist/app-bar/AppBarTitle.js +3 -2
  39. package/dist/app-bar/AppBarTitle.js.map +1 -1
  40. package/dist/autocomplete/Autocomplete.js.map +1 -1
  41. package/dist/autocomplete/AutocompleteCircularProgress.js.map +1 -1
  42. package/dist/autocomplete/AutocompleteDropdownButton.js.map +1 -1
  43. package/dist/autocomplete/FilterAutocompleteOptions.js.map +1 -1
  44. package/dist/autocomplete/autocompleteStyles.js.map +1 -1
  45. package/dist/autocomplete/defaults.d.ts +2 -2
  46. package/dist/autocomplete/defaults.js +3 -3
  47. package/dist/autocomplete/defaults.js.map +1 -1
  48. package/dist/autocomplete/types.js.map +1 -1
  49. package/dist/avatar/Avatar.d.ts +1 -2
  50. package/dist/avatar/Avatar.js +1 -2
  51. package/dist/avatar/Avatar.js.map +1 -1
  52. package/dist/avatar/styles.js.map +1 -1
  53. package/dist/badge/Badge.js.map +1 -1
  54. package/dist/box/Box.js.map +1 -1
  55. package/dist/box/styles.js.map +1 -1
  56. package/dist/button/AsyncButton.js.map +1 -1
  57. package/dist/button/Button.js.map +1 -1
  58. package/dist/button/ButtonUnstyled.js.map +1 -1
  59. package/dist/button/FloatingActionButton.js.map +1 -1
  60. package/dist/button/TooltippedButton.js.map +1 -1
  61. package/dist/button/buttonStyles.js.map +1 -1
  62. package/dist/button/buttonUnstyledStyles.js.map +1 -1
  63. package/dist/card/Card.d.ts +2 -1
  64. package/dist/card/Card.js.map +1 -1
  65. package/dist/card/CardContent.js.map +1 -1
  66. package/dist/card/CardFooter.js.map +1 -1
  67. package/dist/card/CardHeader.js.map +1 -1
  68. package/dist/card/CardSubtitle.d.ts +6 -0
  69. package/dist/card/CardSubtitle.js +2 -1
  70. package/dist/card/CardSubtitle.js.map +1 -1
  71. package/dist/card/CardTitle.js.map +1 -1
  72. package/dist/card/ClickableCard.js.map +1 -1
  73. package/dist/card/styles.js +2 -4
  74. package/dist/card/styles.js.map +1 -1
  75. package/dist/chip/Chip.js.map +1 -1
  76. package/dist/chip/styles.js.map +1 -1
  77. package/dist/cssUtils.d.ts +1 -1
  78. package/dist/cssUtils.js.map +1 -1
  79. package/dist/delegateEvent.js.map +1 -1
  80. package/dist/dialog/Dialog.js.map +1 -1
  81. package/dist/dialog/DialogContainer.js.map +1 -1
  82. package/dist/dialog/DialogContent.js.map +1 -1
  83. package/dist/dialog/DialogFooter.js.map +1 -1
  84. package/dist/dialog/DialogHeader.js.map +1 -1
  85. package/dist/dialog/DialogTitle.js.map +1 -1
  86. package/dist/dialog/FixedDialog.js.map +1 -1
  87. package/dist/dialog/NestedDialogProvider.js.map +1 -1
  88. package/dist/dialog/styles.js.map +1 -1
  89. package/dist/divider/Divider.js.map +1 -1
  90. package/dist/divider/styles.js.map +1 -1
  91. package/dist/draggable/useDraggable.js.map +1 -1
  92. package/dist/draggable/utils.js.map +1 -1
  93. package/dist/expansion-panel/ExpansionList.js.map +1 -1
  94. package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
  95. package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
  96. package/dist/expansion-panel/useExpansionList.js.map +1 -1
  97. package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
  98. package/dist/focus/useFocusContainer.js.map +1 -1
  99. package/dist/focus/utils.js.map +1 -1
  100. package/dist/form/Checkbox.js.map +1 -1
  101. package/dist/form/Fieldset.js.map +1 -1
  102. package/dist/form/FileInput.js.map +1 -1
  103. package/dist/form/Form.js.map +1 -1
  104. package/dist/form/FormMessage.js.map +1 -1
  105. package/dist/form/FormMessageContainer.js.map +1 -1
  106. package/dist/form/FormMessageCounter.js.map +1 -1
  107. package/dist/form/InputToggle.js.map +1 -1
  108. package/dist/form/InputToggleIcon.js.map +1 -1
  109. package/dist/form/Label.js.map +1 -1
  110. package/dist/form/Legend.js.map +1 -1
  111. package/dist/form/MenuItemCheckbox.js.map +1 -1
  112. package/dist/form/MenuItemFileInput.js.map +1 -1
  113. package/dist/form/MenuItemInputToggle.js.map +1 -1
  114. package/dist/form/MenuItemRadio.js.map +1 -1
  115. package/dist/form/MenuItemSwitch.js.map +1 -1
  116. package/dist/form/MenuItemTextField.js.map +1 -1
  117. package/dist/form/NativeSelect.js.map +1 -1
  118. package/dist/form/OptGroup.js.map +1 -1
  119. package/dist/form/Option.js.map +1 -1
  120. package/dist/form/Password.js.map +1 -1
  121. package/dist/form/Radio.js.map +1 -1
  122. package/dist/form/ResizingTextAreaWrapper.js.map +1 -1
  123. package/dist/form/Select.js.map +1 -1
  124. package/dist/form/SelectedOption.js.map +1 -1
  125. package/dist/form/Slider.js.map +1 -1
  126. package/dist/form/SliderContainer.js.map +1 -1
  127. package/dist/form/SliderMark.js.map +1 -1
  128. package/dist/form/SliderMarkLabel.js.map +1 -1
  129. package/dist/form/SliderThumb.js.map +1 -1
  130. package/dist/form/SliderTrack.js.map +1 -1
  131. package/dist/form/SliderValueMarks.js.map +1 -1
  132. package/dist/form/SliderValueTooltip.js.map +1 -1
  133. package/dist/form/Switch.js.map +1 -1
  134. package/dist/form/SwitchTrack.js.map +1 -1
  135. package/dist/form/TextArea.js.map +1 -1
  136. package/dist/form/TextField.js.map +1 -1
  137. package/dist/form/TextFieldAddon.js.map +1 -1
  138. package/dist/form/TextFieldContainer.js.map +1 -1
  139. package/dist/form/fileUtils.js.map +1 -1
  140. package/dist/form/formConfig.js.map +1 -1
  141. package/dist/form/formMessageStyles.js.map +1 -1
  142. package/dist/form/inputToggleStyles.js.map +1 -1
  143. package/dist/form/menuItemInputToggleStyles.js.map +1 -1
  144. package/dist/form/nativeSelectStyles.js.map +1 -1
  145. package/dist/form/optionStyles.js.map +1 -1
  146. package/dist/form/passwordStyles.js.map +1 -1
  147. package/dist/form/selectStyles.js.map +1 -1
  148. package/dist/form/selectUtils.js.map +1 -1
  149. package/dist/form/sliderUtils.js.map +1 -1
  150. package/dist/form/switchStyles.js.map +1 -1
  151. package/dist/form/textAreaStyles.js.map +1 -1
  152. package/dist/form/textFieldContainerStyles.js.map +1 -1
  153. package/dist/form/textFieldStyles.js.map +1 -1
  154. package/dist/form/types.js.map +1 -1
  155. package/dist/form/useCheckboxGroup.js.map +1 -1
  156. package/dist/form/useCombobox.js.map +1 -1
  157. package/dist/form/useEditableCombobox.js.map +1 -1
  158. package/dist/form/useFileUpload.js.map +1 -1
  159. package/dist/form/useFormReset.js.map +1 -1
  160. package/dist/form/useListboxProvider.js.map +1 -1
  161. package/dist/form/useNumberField.js.map +1 -1
  162. package/dist/form/useRadioGroup.js.map +1 -1
  163. package/dist/form/useRangeSlider.js.map +1 -1
  164. package/dist/form/useResizingTextArea.js.map +1 -1
  165. package/dist/form/useSelectCombobox.js.map +1 -1
  166. package/dist/form/useSlider.js.map +1 -1
  167. package/dist/form/useTextField.js.map +1 -1
  168. package/dist/form/useTextFieldContainerAddons.js.map +1 -1
  169. package/dist/form/utils.js.map +1 -1
  170. package/dist/form/validation.js.map +1 -1
  171. package/dist/hoverMode/useHoverMode.js.map +1 -1
  172. package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
  173. package/dist/icon/FontIcon.d.ts +10 -6
  174. package/dist/icon/FontIcon.js +1 -5
  175. package/dist/icon/FontIcon.js.map +1 -1
  176. package/dist/icon/IconRotator.js.map +1 -1
  177. package/dist/icon/MaterialIcon.d.ts +19 -2
  178. package/dist/icon/MaterialIcon.js +14 -2
  179. package/dist/icon/MaterialIcon.js.map +1 -1
  180. package/dist/icon/MaterialSymbol.js.map +1 -1
  181. package/dist/icon/SVGIcon.d.ts +3 -0
  182. package/dist/icon/SVGIcon.js.map +1 -1
  183. package/dist/icon/TextIconSpacing.js.map +1 -1
  184. package/dist/icon/iconConfig.d.ts +1 -0
  185. package/dist/icon/iconConfig.js +1 -0
  186. package/dist/icon/iconConfig.js.map +1 -1
  187. package/dist/icon/material.d.ts +1 -1
  188. package/dist/icon/material.js.map +1 -1
  189. package/dist/icon/materialConfig.js.map +1 -1
  190. package/dist/icon/styles.js.map +1 -1
  191. package/dist/interaction/Ripple.js.map +1 -1
  192. package/dist/interaction/RippleContainer.js.map +1 -1
  193. package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
  194. package/dist/interaction/config.js.map +1 -1
  195. package/dist/interaction/types.js.map +1 -1
  196. package/dist/interaction/useElementInteraction.js.map +1 -1
  197. package/dist/interaction/useHigherContrastChildren.js.map +1 -1
  198. package/dist/interaction/utils.js.map +1 -1
  199. package/dist/layout/LayoutAppBar.js.map +1 -1
  200. package/dist/layout/LayoutNav.js.map +1 -1
  201. package/dist/layout/LayoutWindowSplitter.js.map +1 -1
  202. package/dist/layout/Main.js.map +1 -1
  203. package/dist/layout/layoutNavStyles.js.map +1 -1
  204. package/dist/layout/layoutWindowSplitterStyles.js.map +1 -1
  205. package/dist/layout/mainStyles.js.map +1 -1
  206. package/dist/layout/useExpandableLayout.js.map +1 -1
  207. package/dist/layout/useHorizontalLayoutTransition.js.map +1 -1
  208. package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
  209. package/dist/layout/useLayoutTree.js.map +1 -1
  210. package/dist/layout/useLayoutWindowSplitter.js.map +1 -1
  211. package/dist/layout/useMainTabIndex.js.map +1 -1
  212. package/dist/layout/useResizableLayout.js.map +1 -1
  213. package/dist/layout/useTemporaryLayout.js.map +1 -1
  214. package/dist/link/Link.d.ts +2 -4
  215. package/dist/link/Link.js +1 -2
  216. package/dist/link/Link.js.map +1 -1
  217. package/dist/link/SkipToMainContent.d.ts +10 -3
  218. package/dist/link/SkipToMainContent.js +4 -1
  219. package/dist/link/SkipToMainContent.js.map +1 -1
  220. package/dist/link/styles.d.ts +2 -2
  221. package/dist/link/styles.js.map +1 -1
  222. package/dist/list/List.js.map +1 -1
  223. package/dist/list/ListItem.js.map +1 -1
  224. package/dist/list/ListItemAddon.js.map +1 -1
  225. package/dist/list/ListItemChildren.js.map +1 -1
  226. package/dist/list/ListItemLink.js.map +1 -1
  227. package/dist/list/ListItemText.js.map +1 -1
  228. package/dist/list/ListSubheader.js.map +1 -1
  229. package/dist/list/getListItemHeight.js.map +1 -1
  230. package/dist/list/listItemStyles.js.map +1 -1
  231. package/dist/list/types.js.map +1 -1
  232. package/dist/media-queries/AppSizeProvider.js.map +1 -1
  233. package/dist/media-queries/appSize.js.map +1 -1
  234. package/dist/media-queries/useMediaQuery.js.map +1 -1
  235. package/dist/menu/DropdownMenu.js.map +1 -1
  236. package/dist/menu/Menu.js.map +1 -1
  237. package/dist/menu/MenuBar.js.map +1 -1
  238. package/dist/menu/MenuButton.js.map +1 -1
  239. package/dist/menu/MenuConfigurationProvider.js.map +1 -1
  240. package/dist/menu/MenuItem.js.map +1 -1
  241. package/dist/menu/MenuItemButton.js.map +1 -1
  242. package/dist/menu/MenuItemCircularProgress.js.map +1 -1
  243. package/dist/menu/MenuItemGroup.js.map +1 -1
  244. package/dist/menu/MenuItemSeparator.js.map +1 -1
  245. package/dist/menu/MenuSheet.js.map +1 -1
  246. package/dist/menu/MenuVisibilityProvider.js.map +1 -1
  247. package/dist/menu/MenuWidget.js.map +1 -1
  248. package/dist/menu/MenuWidgetKeyboardProvider.js.map +1 -1
  249. package/dist/menu/useContextMenu.js.map +1 -1
  250. package/dist/menu/useMenuBarProvider.js.map +1 -1
  251. package/dist/menu/utils.js.map +1 -1
  252. package/dist/movement/constants.js.map +1 -1
  253. package/dist/movement/findMatchIndex.js.map +1 -1
  254. package/dist/movement/types.js.map +1 -1
  255. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  256. package/dist/movement/utils.js.map +1 -1
  257. package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
  258. package/dist/navigation/DefaultNavigationRenderer.js.map +1 -1
  259. package/dist/navigation/NavGroup.js.map +1 -1
  260. package/dist/navigation/NavItem.js.map +1 -1
  261. package/dist/navigation/NavItemButton.js.map +1 -1
  262. package/dist/navigation/NavItemLink.js.map +1 -1
  263. package/dist/navigation/NavSubheader.js.map +1 -1
  264. package/dist/navigation/Navigation.js.map +1 -1
  265. package/dist/navigation/getHrefFromParents.js.map +1 -1
  266. package/dist/navigation/navGroupStyles.js.map +1 -1
  267. package/dist/navigation/navItemStyles.js.map +1 -1
  268. package/dist/navigation/types.js.map +1 -1
  269. package/dist/navigation/useActiveHeadingId.js.map +1 -1
  270. package/dist/overlay/Overlay.d.ts +1 -0
  271. package/dist/overlay/Overlay.js.map +1 -1
  272. package/dist/overlay/overlayStyles.js.map +1 -1
  273. package/dist/portal/Portal.d.ts +4 -0
  274. package/dist/portal/Portal.js.map +1 -1
  275. package/dist/portal/PortalContainerProvider.d.ts +8 -3
  276. package/dist/portal/PortalContainerProvider.js +1 -0
  277. package/dist/portal/PortalContainerProvider.js.map +1 -1
  278. package/dist/positioning/constants.js.map +1 -1
  279. package/dist/positioning/createHorizontalPosition.js.map +1 -1
  280. package/dist/positioning/createVerticalPosition.js.map +1 -1
  281. package/dist/positioning/getFixedPosition.js.map +1 -1
  282. package/dist/positioning/types.js.map +1 -1
  283. package/dist/positioning/useFixedPositioning.js.map +1 -1
  284. package/dist/positioning/utils.js.map +1 -1
  285. package/dist/progress/CircularProgress.d.ts +5 -4
  286. package/dist/progress/CircularProgress.js.map +1 -1
  287. package/dist/progress/LinearProgress.js.map +1 -1
  288. package/dist/progress/getProgressA11y.js.map +1 -1
  289. package/dist/progress/types.js.map +1 -1
  290. package/dist/responsive-item/ResponsiveItemContainer.js.map +1 -1
  291. package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
  292. package/dist/responsive-item/styles.js.map +1 -1
  293. package/dist/scroll/ScrollLock.js.map +1 -1
  294. package/dist/scroll/getScrollbarWidth.js.map +1 -1
  295. package/dist/scroll/useScrollLock.js.map +1 -1
  296. package/dist/searching/caseInsensitive.js.map +1 -1
  297. package/dist/searching/fuzzy.js.map +1 -1
  298. package/dist/searching/toSearchQuery.js.map +1 -1
  299. package/dist/searching/types.js.map +1 -1
  300. package/dist/searching/useFuzzyMatch.js.map +1 -1
  301. package/dist/searching/utils.js.map +1 -1
  302. package/dist/segmented-button/SegmentedButton.js.map +1 -1
  303. package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
  304. package/dist/segmented-button/segmentedButtonContainerStyles.js.map +1 -1
  305. package/dist/segmented-button/segmentedButtonStyles.js.map +1 -1
  306. package/dist/sheet/Sheet.js.map +1 -1
  307. package/dist/sheet/styles.js.map +1 -1
  308. package/dist/snackbar/DefaultToastRenderer.js.map +1 -1
  309. package/dist/snackbar/Snackbar.js.map +1 -1
  310. package/dist/snackbar/Toast.js.map +1 -1
  311. package/dist/snackbar/ToastActionButton.js.map +1 -1
  312. package/dist/snackbar/ToastCloseButton.js.map +1 -1
  313. package/dist/snackbar/ToastContent.js.map +1 -1
  314. package/dist/snackbar/ToastManager.js.map +1 -1
  315. package/dist/snackbar/ToastManagerProvider.js.map +1 -1
  316. package/dist/snackbar/snackbarStyles.js.map +1 -1
  317. package/dist/snackbar/toastContentStyles.js.map +1 -1
  318. package/dist/snackbar/toastStyles.js.map +1 -1
  319. package/dist/snackbar/useCurrentToastActions.js.map +1 -1
  320. package/dist/suspense/CircularProgressSuspense.js.map +1 -1
  321. package/dist/suspense/NullSuspense.js.map +1 -1
  322. package/dist/table/StickyTableSection.d.ts +23 -0
  323. package/dist/table/StickyTableSection.js +56 -0
  324. package/dist/table/StickyTableSection.js.map +1 -0
  325. package/dist/table/Table.d.ts +1 -1
  326. package/dist/table/Table.js.map +1 -1
  327. package/dist/table/TableBody.d.ts +1 -1
  328. package/dist/table/TableBody.js.map +1 -1
  329. package/dist/table/TableCell.d.ts +3 -2
  330. package/dist/table/TableCell.js.map +1 -1
  331. package/dist/table/TableCellContent.d.ts +1 -2
  332. package/dist/table/TableCellContent.js.map +1 -1
  333. package/dist/table/TableCheckbox.js.map +1 -1
  334. package/dist/table/TableConfigurationProvider.d.ts +1 -73
  335. package/dist/table/TableConfigurationProvider.js.map +1 -1
  336. package/dist/table/TableContainer.js.map +1 -1
  337. package/dist/table/TableContainerProvider.js.map +1 -1
  338. package/dist/table/TableFooter.d.ts +8 -17
  339. package/dist/table/TableFooter.js +17 -80
  340. package/dist/table/TableFooter.js.map +1 -1
  341. package/dist/table/TableHeader.d.ts +8 -17
  342. package/dist/table/TableHeader.js +20 -87
  343. package/dist/table/TableHeader.js.map +1 -1
  344. package/dist/table/TableRadio.js.map +1 -1
  345. package/dist/table/TableRow.d.ts +1 -1
  346. package/dist/table/TableRow.js.map +1 -1
  347. package/dist/table/tableCellStyles.d.ts +1 -1
  348. package/dist/table/tableCellStyles.js.map +1 -1
  349. package/dist/table/tableContainerStyles.js.map +1 -1
  350. package/dist/table/tableFooterStyles.js.map +1 -1
  351. package/dist/table/tableHeaderStyles.js.map +1 -1
  352. package/dist/table/tableRowStyles.js.map +1 -1
  353. package/dist/table/tableStyles.js.map +1 -1
  354. package/dist/table/types.d.ts +89 -9
  355. package/dist/table/types.js.map +1 -1
  356. package/dist/table/useStickyTableSection.d.ts +27 -0
  357. package/dist/table/useStickyTableSection.js +84 -0
  358. package/dist/table/useStickyTableSection.js.map +1 -0
  359. package/dist/table/useTableSectionConfig.d.ts +13 -0
  360. package/dist/table/useTableSectionConfig.js +33 -0
  361. package/dist/table/useTableSectionConfig.js.map +1 -0
  362. package/dist/tabs/Tab.js.map +1 -1
  363. package/dist/tabs/TabList.js.map +1 -1
  364. package/dist/tabs/TabListScrollButton.js.map +1 -1
  365. package/dist/tabs/tabIndicatorStyles.js.map +1 -1
  366. package/dist/tabs/tabListScrollButtonStyles.js.map +1 -1
  367. package/dist/tabs/tabListStyles.js.map +1 -1
  368. package/dist/tabs/tabStyles.js.map +1 -1
  369. package/dist/tabs/useTabList.js.map +1 -1
  370. package/dist/tabs/useTabs.js.map +1 -1
  371. package/dist/tabs/utils.js.map +1 -1
  372. package/dist/test-utils/IntersectionObserver.js.map +1 -1
  373. package/dist/test-utils/ResizeObserver.js.map +1 -1
  374. package/dist/test-utils/data-testid.js.map +1 -1
  375. package/dist/test-utils/index.js.map +1 -1
  376. package/dist/test-utils/jest-setup.js.map +1 -1
  377. package/dist/test-utils/matchMedia.js.map +1 -1
  378. package/dist/test-utils/polyfills/IntersectionObserver.js.map +1 -1
  379. package/dist/test-utils/polyfills/ResizeObserver.js.map +1 -1
  380. package/dist/test-utils/polyfills/TextDecoder.js.map +1 -1
  381. package/dist/test-utils/polyfills/TextEncoder.js.map +1 -1
  382. package/dist/test-utils/polyfills/index.js.map +1 -1
  383. package/dist/test-utils/polyfills/matchMedia.js.map +1 -1
  384. package/dist/test-utils/polyfills/offsetParent.js.map +1 -1
  385. package/dist/test-utils/polyfills/scrollIntoView.js.map +1 -1
  386. package/dist/test-utils/render.js.map +1 -1
  387. package/dist/test-utils/timers.js.map +1 -1
  388. package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -1
  389. package/dist/theme/ThemeProvider.js.map +1 -1
  390. package/dist/theme/_theme.scss +2 -1
  391. package/dist/theme/colors.js.map +1 -1
  392. package/dist/theme/cssVars.js.map +1 -1
  393. package/dist/theme/types.js.map +1 -1
  394. package/dist/theme/useCSSVariables.js.map +1 -1
  395. package/dist/theme/useColorScheme.js.map +1 -1
  396. package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
  397. package/dist/theme/useColorSchemeProvider.js.map +1 -1
  398. package/dist/theme/usePrefersColorScheme.js.map +1 -1
  399. package/dist/theme/utils.js.map +1 -1
  400. package/dist/tooltip/Tooltip.d.ts +20 -9
  401. package/dist/tooltip/Tooltip.js.map +1 -1
  402. package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -1
  403. package/dist/tooltip/constants.js.map +1 -1
  404. package/dist/tooltip/tooltipStyles.js.map +1 -1
  405. package/dist/tooltip/useTooltip.d.ts +30 -16
  406. package/dist/tooltip/useTooltip.js.map +1 -1
  407. package/dist/tooltip/useTooltipPosition.d.ts +2 -4
  408. package/dist/tooltip/useTooltipPosition.js.map +1 -1
  409. package/dist/tooltip/utils.js.map +1 -1
  410. package/dist/transition/CSSTransition.js.map +1 -1
  411. package/dist/transition/Collapse.js.map +1 -1
  412. package/dist/transition/CrossFade.js.map +1 -1
  413. package/dist/transition/ScaleTransition.js.map +1 -1
  414. package/dist/transition/SkeletonPlaceholder.js.map +1 -1
  415. package/dist/transition/Slide.js.map +1 -1
  416. package/dist/transition/SlideContainer.js.map +1 -1
  417. package/dist/transition/collapseStyles.js.map +1 -1
  418. package/dist/transition/config.js.map +1 -1
  419. package/dist/transition/maxWidthTransition.js.map +1 -1
  420. package/dist/transition/skeletonPlaceholderUtils.js.map +1 -1
  421. package/dist/transition/types.d.ts +19 -24
  422. package/dist/transition/types.js.map +1 -1
  423. package/dist/transition/useCSSTransition.js.map +1 -1
  424. package/dist/transition/useCarousel.js.map +1 -1
  425. package/dist/transition/useCollapseTransition.js.map +1 -1
  426. package/dist/transition/useCrossFadeTransition.js.map +1 -1
  427. package/dist/transition/useMaxWidthTransition.js.map +1 -1
  428. package/dist/transition/useScaleTransition.js.map +1 -1
  429. package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
  430. package/dist/transition/useSlideTransition.js.map +1 -1
  431. package/dist/transition/useTransition.d.ts +1 -0
  432. package/dist/transition/useTransition.js +1 -0
  433. package/dist/transition/useTransition.js.map +1 -1
  434. package/dist/transition/utils.js.map +1 -1
  435. package/dist/tree/DefaultTreeItemRenderer.js.map +1 -1
  436. package/dist/tree/Tree.js.map +1 -1
  437. package/dist/tree/TreeGroup.js.map +1 -1
  438. package/dist/tree/TreeItem.js.map +1 -1
  439. package/dist/tree/TreeItemExpander.js.map +1 -1
  440. package/dist/tree/TreeProvider.js.map +1 -1
  441. package/dist/tree/styles.js.map +1 -1
  442. package/dist/tree/types.js.map +1 -1
  443. package/dist/tree/useTree.d.ts +3 -3
  444. package/dist/tree/useTree.js.map +1 -1
  445. package/dist/tree/useTreeExpansion.js.map +1 -1
  446. package/dist/tree/useTreeItems.js.map +1 -1
  447. package/dist/tree/useTreeMovement.js.map +1 -1
  448. package/dist/tree/useTreeSelection.js.map +1 -1
  449. package/dist/tree/utils.js.map +1 -1
  450. package/dist/types.js.map +1 -1
  451. package/dist/typography/SrOnly.js.map +1 -1
  452. package/dist/typography/TextContainer.d.ts +4 -0
  453. package/dist/typography/TextContainer.js +2 -0
  454. package/dist/typography/TextContainer.js.map +1 -1
  455. package/dist/typography/Typography.d.ts +10 -0
  456. package/dist/typography/Typography.js +3 -0
  457. package/dist/typography/Typography.js.map +1 -1
  458. package/dist/typography/WritingDirectionProvider.js.map +1 -1
  459. package/dist/typography/textContainerStyles.js.map +1 -1
  460. package/dist/typography/typographyStyles.js.map +1 -1
  461. package/dist/useAsyncFunction.js.map +1 -1
  462. package/dist/useDebouncedFunction.js.map +1 -1
  463. package/dist/useDropzone.js.map +1 -1
  464. package/dist/useElementSize.js.map +1 -1
  465. package/dist/useEnsuredId.js.map +1 -1
  466. package/dist/useEnsuredRef.js.map +1 -1
  467. package/dist/useEnsuredState.js.map +1 -1
  468. package/dist/useHtmlClassName.js.map +1 -1
  469. package/dist/useIntersectionObserver.js.map +1 -1
  470. package/dist/useIsomorphicLayoutEffect.js.map +1 -1
  471. package/dist/useLocalStorage.js.map +1 -1
  472. package/dist/useMutationObserver.js.map +1 -1
  473. package/dist/useOrientation.js.map +1 -1
  474. package/dist/usePageInactive.js.map +1 -1
  475. package/dist/useResizeListener.js.map +1 -1
  476. package/dist/useResizeObserver.js.map +1 -1
  477. package/dist/useThrottledFunction.js.map +1 -1
  478. package/dist/useToggle.js.map +1 -1
  479. package/dist/useUnmounted.js.map +1 -1
  480. package/dist/useWindowSize.js.map +1 -1
  481. package/dist/utils/RenderRecursively.js.map +1 -1
  482. package/dist/utils/alphaNumericSort.js.map +1 -1
  483. package/dist/utils/applyRef.js.map +1 -1
  484. package/dist/utils/bem.js.map +1 -1
  485. package/dist/utils/getClientPosition.js.map +1 -1
  486. package/dist/utils/getMiddleOfRange.js.map +1 -1
  487. package/dist/utils/getPercentage.js.map +1 -1
  488. package/dist/utils/getRangeDefaultValue.js.map +1 -1
  489. package/dist/utils/getRangeSteps.js.map +1 -1
  490. package/dist/utils/identity.js.map +1 -1
  491. package/dist/utils/isElementVisible.js.map +1 -1
  492. package/dist/utils/loop.js.map +1 -1
  493. package/dist/utils/nearest.js.map +1 -1
  494. package/dist/utils/parseCssLengthUnit.js.map +1 -1
  495. package/dist/utils/randomInt.js.map +1 -1
  496. package/dist/utils/wait.js.map +1 -1
  497. package/dist/utils/withinRange.js.map +1 -1
  498. package/dist/window-splitter/WindowSplitter.js.map +1 -1
  499. package/dist/window-splitter/useWindowSplitter.js.map +1 -1
  500. package/package.json +21 -20
  501. package/scripts/getExportMap.ts +66 -0
  502. package/scripts/tsconfig.json +1 -1
  503. package/src/app-bar/AppBarTitle.tsx +8 -4
  504. package/src/autocomplete/defaults.ts +3 -3
  505. package/src/avatar/Avatar.tsx +1 -2
  506. package/src/card/Card.tsx +2 -1
  507. package/src/card/CardSubtitle.tsx +9 -0
  508. package/src/card/__tests__/__snapshots__/CardHeader.tsx.snap +1 -1
  509. package/src/card/__tests__/__snapshots__/CardSubtitle.tsx.snap +2 -2
  510. package/src/card/__tests__/__snapshots__/styles.ts.snap +1 -1
  511. package/src/card/styles.ts +2 -6
  512. package/src/cssUtils.ts +1 -1
  513. package/src/icon/FontIcon.tsx +19 -9
  514. package/src/icon/MaterialIcon.tsx +23 -4
  515. package/src/icon/SVGIcon.tsx +3 -0
  516. package/src/icon/iconConfig.tsx +1 -0
  517. package/src/icon/material.ts +276 -19
  518. package/src/link/Link.tsx +2 -4
  519. package/src/link/SkipToMainContent.tsx +11 -4
  520. package/src/link/styles.ts +2 -2
  521. package/src/overlay/Overlay.tsx +1 -0
  522. package/src/portal/Portal.tsx +5 -0
  523. package/src/portal/PortalContainerProvider.tsx +16 -7
  524. package/src/progress/CircularProgress.tsx +5 -4
  525. package/src/table/StickyTableSection.tsx +91 -0
  526. package/src/table/Table.tsx +2 -5
  527. package/src/table/TableBody.tsx +1 -2
  528. package/src/table/TableCell.tsx +3 -5
  529. package/src/table/TableCellContent.tsx +1 -3
  530. package/src/table/TableConfigurationProvider.tsx +1 -86
  531. package/src/table/TableFooter.tsx +19 -116
  532. package/src/table/TableHeader.tsx +20 -118
  533. package/src/table/TableRow.tsx +2 -4
  534. package/src/table/__tests__/Table.tsx +9 -8
  535. package/src/table/tableCellStyles.ts +1 -1
  536. package/src/table/types.ts +105 -10
  537. package/src/table/useStickyTableSection.tsx +126 -0
  538. package/src/table/useTableSectionConfig.ts +45 -0
  539. package/src/theme/_theme.scss +2 -1
  540. package/src/tooltip/Tooltip.tsx +24 -8
  541. package/src/tooltip/useTooltip.ts +52 -27
  542. package/src/tooltip/useTooltipPosition.ts +2 -4
  543. package/src/transition/types.ts +23 -27
  544. package/src/transition/useTransition.ts +1 -0
  545. package/src/tree/useTree.ts +3 -5
  546. package/src/typography/TextContainer.tsx +4 -0
  547. package/src/typography/Typography.tsx +10 -0
  548. package/src/useResizeListener.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/navigation/Navigation.tsx"],"sourcesContent":["import { type ComponentType, type ReactElement } from \"react\";\nimport { type ListProps } from \"../list/List.js\";\nimport {\n RenderRecursively,\n getRecursiveItemKey,\n type RecursiveItem,\n type RecursiveItemKeyOptions,\n type RenderRecursiveItemsProps,\n} from \"../utils/RenderRecursively.js\";\nimport { DefaultNavigationRenderer } from \"./DefaultNavigationRenderer.js\";\nimport { NavGroup } from \"./NavGroup.js\";\nimport { type NavigationItem, type NavigationRenderData } from \"./types.js\";\n\n/**\n * The default implementation for the nav item keys. It will attempt to set the\n * key in the following order:\n * - `href` if it exists and has length\n * - `children` if it's a string and has length\n * - default {@link getRecursiveItemKey} behavior of `${depth}-${index}`\n *\n * @since 6.0.0\n */\nexport function getRecursiveNavItemKey<\n Item extends NavigationItem = NavigationItem,\n>(options: RecursiveItemKeyOptions<Item>): string {\n const { item } = options;\n // if it's a route, try setting the key to the href since they are generally\n // unique\n if (\"href\" in item && item.href) {\n return item.href;\n }\n\n // if children exist in the item (group, route, subheader), try to set that as\n // the key since they are usually unique\n if (\n \"children\" in item &&\n typeof item.children === \"string\" &&\n item.children\n ) {\n return item.children;\n }\n\n // use the default key behavior if all else fails\n return getRecursiveItemKey(options);\n}\n\n/**\n * @since 6.0.0\n */\nexport interface NavigationProps<\n Item extends NavigationItem = NavigationItem,\n Data extends NavigationRenderData = NavigationRenderData,\n> extends Omit<ListProps, \"children\"> {\n data: Data;\n items: readonly RecursiveItem<Item>[];\n\n /** @see {@link DefaultNavigationRenderer} */\n render?: ComponentType<RenderRecursiveItemsProps<Item, Data>>;\n\n /** @see {@link getRecursiveNavItemKey} */\n getItemKey?(options: RecursiveItemKeyOptions<Item>): string;\n}\n\n/**\n * **Client Component**\n *\n * @since 6.0.0\n */\nexport function Navigation<\n Item extends NavigationItem,\n Data extends NavigationRenderData,\n>(props: NavigationProps<Item, Data>): ReactElement {\n const {\n data,\n items,\n render = DefaultNavigationRenderer,\n getItemKey = getRecursiveNavItemKey,\n ...remaining\n } = props;\n\n return (\n <NavGroup depth={0} {...remaining}>\n <RenderRecursively\n data={data}\n items={items}\n render={render}\n getItemKey={getItemKey}\n />\n </NavGroup>\n );\n}\n"],"names":["RenderRecursively","getRecursiveItemKey","DefaultNavigationRenderer","NavGroup","getRecursiveNavItemKey","options","item","href","children","Navigation","props","data","items","render","getItemKey","remaining","depth"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAEA,SACEA,iBAAiB,EACjBC,mBAAmB,QAId,gCAAgC;AACvC,SAASC,yBAAyB,QAAQ,iCAAiC;AAC3E,SAASC,QAAQ,QAAQ,gBAAgB;AAGzC;;;;;;;;CAQC,GACD,OAAO,SAASC,uBAEdC,OAAsC;IACtC,MAAM,EAAEC,IAAI,EAAE,GAAGD;IACjB,4EAA4E;IAC5E,SAAS;IACT,IAAI,UAAUC,QAAQA,KAAKC,IAAI,EAAE;QAC/B,OAAOD,KAAKC,IAAI;IAClB;IAEA,8EAA8E;IAC9E,wCAAwC;IACxC,IACE,cAAcD,QACd,OAAOA,KAAKE,QAAQ,KAAK,YACzBF,KAAKE,QAAQ,EACb;QACA,OAAOF,KAAKE,QAAQ;IACtB;IAEA,iDAAiD;IACjD,OAAOP,oBAAoBI;AAC7B;AAmBA;;;;CAIC,GACD,OAAO,SAASI,WAGdC,KAAkC;IAClC,MAAM,EACJC,IAAI,EACJC,KAAK,EACLC,SAASX,yBAAyB,EAClCY,aAAaV,sBAAsB,EACnC,GAAGW,WACJ,GAAGL;IAEJ,qBACE,KAACP;QAASa,OAAO;QAAI,GAAGD,SAAS;kBAC/B,cAAA,KAACf;YACCW,MAAMA;YACNC,OAAOA;YACPC,QAAQA;YACRC,YAAYA;;;AAIpB"}
1
+ {"version":3,"sources":["../../src/navigation/Navigation.tsx"],"sourcesContent":["import { type ComponentType, type ReactElement } from \"react\";\nimport { type ListProps } from \"../list/List.js\";\nimport {\n RenderRecursively,\n getRecursiveItemKey,\n type RecursiveItem,\n type RecursiveItemKeyOptions,\n type RenderRecursiveItemsProps,\n} from \"../utils/RenderRecursively.js\";\nimport { DefaultNavigationRenderer } from \"./DefaultNavigationRenderer.js\";\nimport { NavGroup } from \"./NavGroup.js\";\nimport { type NavigationItem, type NavigationRenderData } from \"./types.js\";\n\n/**\n * The default implementation for the nav item keys. It will attempt to set the\n * key in the following order:\n * - `href` if it exists and has length\n * - `children` if it's a string and has length\n * - default {@link getRecursiveItemKey} behavior of `${depth}-${index}`\n *\n * @since 6.0.0\n */\nexport function getRecursiveNavItemKey<\n Item extends NavigationItem = NavigationItem,\n>(options: RecursiveItemKeyOptions<Item>): string {\n const { item } = options;\n // if it's a route, try setting the key to the href since they are generally\n // unique\n if (\"href\" in item && item.href) {\n return item.href;\n }\n\n // if children exist in the item (group, route, subheader), try to set that as\n // the key since they are usually unique\n if (\n \"children\" in item &&\n typeof item.children === \"string\" &&\n item.children\n ) {\n return item.children;\n }\n\n // use the default key behavior if all else fails\n return getRecursiveItemKey(options);\n}\n\n/**\n * @since 6.0.0\n */\nexport interface NavigationProps<\n Item extends NavigationItem = NavigationItem,\n Data extends NavigationRenderData = NavigationRenderData,\n> extends Omit<ListProps, \"children\"> {\n data: Data;\n items: readonly RecursiveItem<Item>[];\n\n /** @see {@link DefaultNavigationRenderer} */\n render?: ComponentType<RenderRecursiveItemsProps<Item, Data>>;\n\n /** @see {@link getRecursiveNavItemKey} */\n getItemKey?(options: RecursiveItemKeyOptions<Item>): string;\n}\n\n/**\n * **Client Component**\n *\n * @since 6.0.0\n */\nexport function Navigation<\n Item extends NavigationItem,\n Data extends NavigationRenderData,\n>(props: NavigationProps<Item, Data>): ReactElement {\n const {\n data,\n items,\n render = DefaultNavigationRenderer,\n getItemKey = getRecursiveNavItemKey,\n ...remaining\n } = props;\n\n return (\n <NavGroup depth={0} {...remaining}>\n <RenderRecursively\n data={data}\n items={items}\n render={render}\n getItemKey={getItemKey}\n />\n </NavGroup>\n );\n}\n"],"names":["RenderRecursively","getRecursiveItemKey","DefaultNavigationRenderer","NavGroup","getRecursiveNavItemKey","options","item","href","children","Navigation","props","data","items","render","getItemKey","remaining","depth"],"mappings":";AAEA,SACEA,iBAAiB,EACjBC,mBAAmB,QAId,gCAAgC;AACvC,SAASC,yBAAyB,QAAQ,iCAAiC;AAC3E,SAASC,QAAQ,QAAQ,gBAAgB;AAGzC;;;;;;;;CAQC,GACD,OAAO,SAASC,uBAEdC,OAAsC;IACtC,MAAM,EAAEC,IAAI,EAAE,GAAGD;IACjB,4EAA4E;IAC5E,SAAS;IACT,IAAI,UAAUC,QAAQA,KAAKC,IAAI,EAAE;QAC/B,OAAOD,KAAKC,IAAI;IAClB;IAEA,8EAA8E;IAC9E,wCAAwC;IACxC,IACE,cAAcD,QACd,OAAOA,KAAKE,QAAQ,KAAK,YACzBF,KAAKE,QAAQ,EACb;QACA,OAAOF,KAAKE,QAAQ;IACtB;IAEA,iDAAiD;IACjD,OAAOP,oBAAoBI;AAC7B;AAmBA;;;;CAIC,GACD,OAAO,SAASI,WAGdC,KAAkC;IAClC,MAAM,EACJC,IAAI,EACJC,KAAK,EACLC,SAASX,yBAAyB,EAClCY,aAAaV,sBAAsB,EACnC,GAAGW,WACJ,GAAGL;IAEJ,qBACE,KAACP;QAASa,OAAO;QAAI,GAAGD,SAAS;kBAC/B,cAAA,KAACf;YACCW,MAAMA;YACNC,OAAOA;YACPC,QAAQA;YACRC,YAAYA;;;AAIpB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/navigation/getHrefFromParents.ts"],"sourcesContent":["import { type NavigationItem } from \"./types.js\";\n\n/**\n * @since 6.0.0\n */\nexport function getHrefFromParents(parents: readonly NavigationItem[]): string {\n return parents.reduce<string>((result, parent) => {\n if (\"href\" in parent && parent.href) {\n const { href } = parent;\n return result + href;\n }\n\n return result;\n }, \"\");\n}\n"],"names":["getHrefFromParents","parents","reduce","result","parent","href"],"rangeMappings":";;;;;;;;;;","mappings":"AAEA;;CAEC,GACD,OAAO,SAASA,mBAAmBC,OAAkC;IACnE,OAAOA,QAAQC,MAAM,CAAS,CAACC,QAAQC;QACrC,IAAI,UAAUA,UAAUA,OAAOC,IAAI,EAAE;YACnC,MAAM,EAAEA,IAAI,EAAE,GAAGD;YACjB,OAAOD,SAASE;QAClB;QAEA,OAAOF;IACT,GAAG;AACL"}
1
+ {"version":3,"sources":["../../src/navigation/getHrefFromParents.ts"],"sourcesContent":["import { type NavigationItem } from \"./types.js\";\n\n/**\n * @since 6.0.0\n */\nexport function getHrefFromParents(parents: readonly NavigationItem[]): string {\n return parents.reduce<string>((result, parent) => {\n if (\"href\" in parent && parent.href) {\n const { href } = parent;\n return result + href;\n }\n\n return result;\n }, \"\");\n}\n"],"names":["getHrefFromParents","parents","reduce","result","parent","href"],"mappings":"AAEA;;CAEC,GACD,OAAO,SAASA,mBAAmBC,OAAkC;IACnE,OAAOA,QAAQC,MAAM,CAAS,CAACC,QAAQC;QACrC,IAAI,UAAUA,UAAUA,OAAOC,IAAI,EAAE;YACnC,MAAM,EAAEA,IAAI,EAAE,GAAGD;YACjB,OAAOD,SAASE;QAClB;QAEA,OAAOF;IACT,GAAG;AACL"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/navigation/navGroupStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-nav-group\");\n\n/**\n * @since 6.0.0\n */\nexport interface NavGroupClassNameOptions {\n className?: string;\n disablePadding?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function navGroup(options: NavGroupClassNameOptions = {}): string {\n const { className, disablePadding } = options;\n\n return cnb(styles({ np: disablePadding }), className);\n}\n"],"names":["cnb","bem","styles","navGroup","options","className","disablePadding","np"],"rangeMappings":";;;;;;;;;;","mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAUnB;;CAEC,GACD,OAAO,SAASE,SAASC,UAAoC,CAAC,CAAC;IAC7D,MAAM,EAAEC,SAAS,EAAEC,cAAc,EAAE,GAAGF;IAEtC,OAAOJ,IAAIE,OAAO;QAAEK,IAAID;IAAe,IAAID;AAC7C"}
1
+ {"version":3,"sources":["../../src/navigation/navGroupStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-nav-group\");\n\n/**\n * @since 6.0.0\n */\nexport interface NavGroupClassNameOptions {\n className?: string;\n disablePadding?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function navGroup(options: NavGroupClassNameOptions = {}): string {\n const { className, disablePadding } = options;\n\n return cnb(styles({ np: disablePadding }), className);\n}\n"],"names":["cnb","bem","styles","navGroup","options","className","disablePadding","np"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAUnB;;CAEC,GACD,OAAO,SAASE,SAASC,UAAoC,CAAC,CAAC;IAC7D,MAAM,EAAEC,SAAS,EAAEC,cAAc,EAAE,GAAGF;IAEtC,OAAOJ,IAAIE,OAAO;QAAEK,IAAID;IAAe,IAAID;AAC7C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/navigation/navItemStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { button } from \"../button/buttonStyles.js\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-nav-item\");\n\n/**\n * @since 6.0.0\n */\nexport interface NavItemClassNameOptions {\n className?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function navItem(options: NavItemClassNameOptions = {}): string {\n const { className } = options;\n\n return cnb(styles(), className);\n}\n\n/**\n * @since 6.0.0\n */\nexport interface NavItemContentClassNameOptions {\n className?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function navItemContent(\n options: NavItemContentClassNameOptions = {}\n): string {\n const { className } = options;\n\n return cnb(styles(\"content\"), className);\n}\n\n/**\n * @since 6.0.0\n */\nexport interface NavItemLinkClassNameOptions {\n className?: string;\n active?: boolean;\n\n /** @defaultValue `cssUtils({ fontWeight: \"bold\" })` */\n activeClassName?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function navItemLink(options: NavItemLinkClassNameOptions = {}): string {\n const {\n active,\n activeClassName = cssUtils({ fontWeight: \"bold\" }),\n className,\n } = options;\n\n return cnb(\n navItemContent(),\n styles(\"link\", { active }),\n button(),\n cssUtils({ textDecoration: \"none\" }),\n active && activeClassName,\n className\n );\n}\n"],"names":["cnb","button","cssUtils","bem","styles","navItem","options","className","navItemContent","navItemLink","active","activeClassName","fontWeight","textDecoration"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,MAAM,QAAQ,4BAA4B;AACnD,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AASnB;;CAEC,GACD,OAAO,SAASE,QAAQC,UAAmC,CAAC,CAAC;IAC3D,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAON,IAAII,UAAUG;AACvB;AASA;;CAEC,GACD,OAAO,SAASC,eACdF,UAA0C,CAAC,CAAC;IAE5C,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAON,IAAII,OAAO,YAAYG;AAChC;AAaA;;CAEC,GACD,OAAO,SAASE,YAAYH,UAAuC,CAAC,CAAC;IACnE,MAAM,EACJI,MAAM,EACNC,kBAAkBT,SAAS;QAAEU,YAAY;IAAO,EAAE,EAClDL,SAAS,EACV,GAAGD;IAEJ,OAAON,IACLQ,kBACAJ,OAAO,QAAQ;QAAEM;IAAO,IACxBT,UACAC,SAAS;QAAEW,gBAAgB;IAAO,IAClCH,UAAUC,iBACVJ;AAEJ"}
1
+ {"version":3,"sources":["../../src/navigation/navItemStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { button } from \"../button/buttonStyles.js\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-nav-item\");\n\n/**\n * @since 6.0.0\n */\nexport interface NavItemClassNameOptions {\n className?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function navItem(options: NavItemClassNameOptions = {}): string {\n const { className } = options;\n\n return cnb(styles(), className);\n}\n\n/**\n * @since 6.0.0\n */\nexport interface NavItemContentClassNameOptions {\n className?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function navItemContent(\n options: NavItemContentClassNameOptions = {}\n): string {\n const { className } = options;\n\n return cnb(styles(\"content\"), className);\n}\n\n/**\n * @since 6.0.0\n */\nexport interface NavItemLinkClassNameOptions {\n className?: string;\n active?: boolean;\n\n /** @defaultValue `cssUtils({ fontWeight: \"bold\" })` */\n activeClassName?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function navItemLink(options: NavItemLinkClassNameOptions = {}): string {\n const {\n active,\n activeClassName = cssUtils({ fontWeight: \"bold\" }),\n className,\n } = options;\n\n return cnb(\n navItemContent(),\n styles(\"link\", { active }),\n button(),\n cssUtils({ textDecoration: \"none\" }),\n active && activeClassName,\n className\n );\n}\n"],"names":["cnb","button","cssUtils","bem","styles","navItem","options","className","navItemContent","navItemLink","active","activeClassName","fontWeight","textDecoration"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,MAAM,QAAQ,4BAA4B;AACnD,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AASnB;;CAEC,GACD,OAAO,SAASE,QAAQC,UAAmC,CAAC,CAAC;IAC3D,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAON,IAAII,UAAUG;AACvB;AASA;;CAEC,GACD,OAAO,SAASC,eACdF,UAA0C,CAAC,CAAC;IAE5C,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAON,IAAII,OAAO,YAAYG;AAChC;AAaA;;CAEC,GACD,OAAO,SAASE,YAAYH,UAAuC,CAAC,CAAC;IACnE,MAAM,EACJI,MAAM,EACNC,kBAAkBT,SAAS;QAAEU,YAAY;IAAO,EAAE,EAClDL,SAAS,EACV,GAAGD;IAEJ,OAAON,IACLQ,kBACAJ,OAAO,QAAQ;QAAEM;IAAO,IACxBT,UACAC,SAAS;QAAEW,gBAAgB;IAAO,IAClCH,UAAUC,iBACVJ;AAEJ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/navigation/types.ts"],"sourcesContent":["import {\n type AnchorHTMLAttributes,\n type ForwardRefExoticComponent,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { type DividerProps } from \"../divider/Divider.js\";\nimport { type ListSubheaderProps } from \"../list/ListSubheader.js\";\nimport {\n type TooltipOptions,\n type TooltippedElementEventHandlers,\n} from \"../tooltip/useTooltip.js\";\n\n/**\n * Used to add a `Divider` to the navigation list.\n * @example Output\n * ```tsx\n * const { type, ...props } = item;\n * return <Divider {...props} />;\n * ```\n *\n * @since 6.0.0\n */\nexport interface NavigationItemDivider extends DividerProps {\n type: \"divider\";\n}\n\n/**\n * Used to add a `ListSubheader` to the navigation list.\n * @example Output\n * ```tsx\n * const { type, ...props } = item;\n * return <ListSubheader {...props} />;\n * ```\n *\n * @since 6.0.0\n */\nexport interface NavigationItemSubheader extends ListSubheaderProps {\n type: \"subheader\";\n children: ReactNode;\n}\n\n/**\n * This is used to either create a route group which update all child routes to\n * be prefixed with the optional `href`.\n *\n * @example Route Group Output\n * ```tsx\n * const nextParents = [item, ...parents];\n * return (\n * <CollapsibleNavGroup\n * depth={nextParents.length})\n * defaultCollapsed={() =>\n * !data.pathname.includes(getHrefFromParents(nextParents))\n * }\n * buttonChildren={item.children}\n * >\n * {children}\n * </CollapsibleNavGroup>\n * );\n * ```\n *\n * Note: `children` are any child `items` that have been rendered.\n *\n * @since 6.0.0\n */\nexport interface NavigationItemGroup {\n type: \"group\";\n href?: string;\n children: ReactNode;\n items: readonly NavigationItem[];\n}\n\n/**\n * @since 6.0.0\n */\nexport interface NavigationItemRoute {\n type: \"route\";\n href: string;\n children: ReactNode;\n active?: boolean;\n beforeAddon?: ReactNode;\n afterAddon?: ReactNode;\n}\n\n/**\n * @since 6.0.0\n */\nexport type NavigationItem =\n | NavigationItemDivider\n | NavigationItemSubheader\n | NavigationItemGroup\n | NavigationItemRoute;\n\n/**\n * @since 6.0.0\n */\nexport type NavigationLinkComponent =\n | \"a\"\n | ForwardRefExoticComponent<\n AnchorHTMLAttributes<HTMLAnchorElement> & { href: string }\n >;\n\n/**\n * @since 6.0.0\n */\nexport interface NavigationRenderData {\n /**\n * This is used to set the `active` state on a `NavItemLink`\n */\n pathname: string;\n linkComponent: NavigationLinkComponent;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface NavItemContentProps {\n /**\n * Any additional props to provide the `<span>` element that wraps the\n * children such as `style`, `className`, and `ref`.\n */\n spanProps?: HTMLAttributes<HTMLSpanElement>;\n\n /**\n * An optional addon to render before the `children` and will not be wrapped\n * in the `span` that adds ellipsis overflow.\n */\n beforeAddon?: ReactNode;\n\n /**\n * An optional addon to render after the `children` and will not be wrapped\n * in the `span` that adds ellipsis overflow.\n */\n afterAddon?: ReactNode;\n\n /**\n * This should contain accessible text for the page that this will link to and\n * will automatically be truncated with ellipsis if it is too large. A tooltip\n * will also appear only when it has been truncated.\n */\n children: ReactNode;\n\n /**\n * This most likely will never need to be used, but it's a way to override any\n * tooltip options. The default behavior will position the tooltip to the\n * right and only appear if the `children` are overflown.\n *\n * @example Customize\n * ```tsx\n * <NavItemLink\n * {...props}\n * tooltipOptions={{\n * overflowOnly: false,\n * defaultPosition: \"above\",\n * vhMargin: \"1rem\",\n * vwMargin: \"1rem\",\n * }}\n * >\n * ```\n */\n tooltipOptions?: Omit<\n TooltipOptions<HTMLAnchorElement>,\n keyof TooltippedElementEventHandlers<HTMLAnchorElement>\n >;\n}\n"],"names":[],"rangeMappings":";;","mappings":"AAkHA;;CAEC,GACD,WAgDC"}
1
+ {"version":3,"sources":["../../src/navigation/types.ts"],"sourcesContent":["import {\n type AnchorHTMLAttributes,\n type ForwardRefExoticComponent,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { type DividerProps } from \"../divider/Divider.js\";\nimport { type ListSubheaderProps } from \"../list/ListSubheader.js\";\nimport {\n type TooltipOptions,\n type TooltippedElementEventHandlers,\n} from \"../tooltip/useTooltip.js\";\n\n/**\n * Used to add a `Divider` to the navigation list.\n * @example Output\n * ```tsx\n * const { type, ...props } = item;\n * return <Divider {...props} />;\n * ```\n *\n * @since 6.0.0\n */\nexport interface NavigationItemDivider extends DividerProps {\n type: \"divider\";\n}\n\n/**\n * Used to add a `ListSubheader` to the navigation list.\n * @example Output\n * ```tsx\n * const { type, ...props } = item;\n * return <ListSubheader {...props} />;\n * ```\n *\n * @since 6.0.0\n */\nexport interface NavigationItemSubheader extends ListSubheaderProps {\n type: \"subheader\";\n children: ReactNode;\n}\n\n/**\n * This is used to either create a route group which update all child routes to\n * be prefixed with the optional `href`.\n *\n * @example Route Group Output\n * ```tsx\n * const nextParents = [item, ...parents];\n * return (\n * <CollapsibleNavGroup\n * depth={nextParents.length})\n * defaultCollapsed={() =>\n * !data.pathname.includes(getHrefFromParents(nextParents))\n * }\n * buttonChildren={item.children}\n * >\n * {children}\n * </CollapsibleNavGroup>\n * );\n * ```\n *\n * Note: `children` are any child `items` that have been rendered.\n *\n * @since 6.0.0\n */\nexport interface NavigationItemGroup {\n type: \"group\";\n href?: string;\n children: ReactNode;\n items: readonly NavigationItem[];\n}\n\n/**\n * @since 6.0.0\n */\nexport interface NavigationItemRoute {\n type: \"route\";\n href: string;\n children: ReactNode;\n active?: boolean;\n beforeAddon?: ReactNode;\n afterAddon?: ReactNode;\n}\n\n/**\n * @since 6.0.0\n */\nexport type NavigationItem =\n | NavigationItemDivider\n | NavigationItemSubheader\n | NavigationItemGroup\n | NavigationItemRoute;\n\n/**\n * @since 6.0.0\n */\nexport type NavigationLinkComponent =\n | \"a\"\n | ForwardRefExoticComponent<\n AnchorHTMLAttributes<HTMLAnchorElement> & { href: string }\n >;\n\n/**\n * @since 6.0.0\n */\nexport interface NavigationRenderData {\n /**\n * This is used to set the `active` state on a `NavItemLink`\n */\n pathname: string;\n linkComponent: NavigationLinkComponent;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface NavItemContentProps {\n /**\n * Any additional props to provide the `<span>` element that wraps the\n * children such as `style`, `className`, and `ref`.\n */\n spanProps?: HTMLAttributes<HTMLSpanElement>;\n\n /**\n * An optional addon to render before the `children` and will not be wrapped\n * in the `span` that adds ellipsis overflow.\n */\n beforeAddon?: ReactNode;\n\n /**\n * An optional addon to render after the `children` and will not be wrapped\n * in the `span` that adds ellipsis overflow.\n */\n afterAddon?: ReactNode;\n\n /**\n * This should contain accessible text for the page that this will link to and\n * will automatically be truncated with ellipsis if it is too large. A tooltip\n * will also appear only when it has been truncated.\n */\n children: ReactNode;\n\n /**\n * This most likely will never need to be used, but it's a way to override any\n * tooltip options. The default behavior will position the tooltip to the\n * right and only appear if the `children` are overflown.\n *\n * @example Customize\n * ```tsx\n * <NavItemLink\n * {...props}\n * tooltipOptions={{\n * overflowOnly: false,\n * defaultPosition: \"above\",\n * vhMargin: \"1rem\",\n * vwMargin: \"1rem\",\n * }}\n * >\n * ```\n */\n tooltipOptions?: Omit<\n TooltipOptions<HTMLAnchorElement>,\n keyof TooltippedElementEventHandlers<HTMLAnchorElement>\n >;\n}\n"],"names":[],"mappings":"AAkHA;;CAEC,GACD,WAgDC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/navigation/useActiveHeadingId.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { type UseStateInitializer } from \"../types.js\";\nimport {\n useIntersectionObserver,\n type IntersectionObserverRootMargin,\n type IntersectionObserverThreshold,\n} from \"../useIntersectionObserver.js\";\nimport { parseCssLengthUnit } from \"../utils/parseCssLengthUnit.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface HeadingReference {\n id: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface HeadingReferenceWithChildren extends HeadingReference {\n children?: readonly HeadingReferenceWithChildren[];\n}\n\n/**\n * @defaultValue `[0.0, 1.0]`\n * @since 6.0.0\n */\nexport const DEFAULT_ACTIVE_HEADING_THRESHOLD: IntersectionObserverThreshold = [\n 0.0, 1.0,\n];\n\n/**\n * ```tsx\n * const headerHeightVar = window\n * .getComputedStyle(document.documentElement)\n * .getPropertyValue(\"--rmd-layout-header-height\");\n * const headerHeight = parseCssLengthUnit({\n * value: headerHeightVar || \"3.5rem\",\n * });\n\n * return `-${headerHeight}px 0px 0px 0px`;\n * ```\n * @since 6.0.0\n */\nexport const DEFAULT_ACTIVE_HEADING_GET_ROOT_MARGIN = (): string => {\n const headerHeightVar = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(\"--rmd-layout-header-height\");\n const headerHeight = parseCssLengthUnit({\n value: headerHeightVar || \"3.5rem\",\n });\n\n return `-${headerHeight}px 0px 0px 0px`;\n};\n\n/**\n * @internal\n * @since 6.0.0\n */\nfunction getHeadingElements(\n items: readonly HeadingReferenceWithChildren[]\n): HTMLElement[] {\n const headings: HTMLElement[] = [];\n items.forEach((item) => {\n const heading = document.getElementById(item.id);\n if (heading) {\n headings.push(heading);\n }\n\n if (item.children) {\n headings.push(...getHeadingElements(item.children));\n }\n });\n\n return headings;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nfunction getLastHeadingId(\n items: readonly HeadingReferenceWithChildren[]\n): string {\n const last = items.at(-1);\n if (!last) {\n return \"\";\n }\n\n if (last.children) {\n return getLastHeadingId(last.children);\n }\n\n return last.id;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nconst isScrolledNearPageBottom = (threshold: number): boolean =>\n window.scrollY >= document.documentElement.scrollHeight * threshold;\n\n/**\n * @since 6.0.0\n */\nexport interface ActiveHeadingIdOptions {\n headings: readonly HeadingReferenceWithChildren[];\n\n /** @see {@link DEFAULT_ACTIVE_HEADING_THRESHOLD} */\n threshold?: IntersectionObserverThreshold;\n\n /** @see {@link DEFAULT_ACTIVE_HEADING_GET_ROOT_MARGIN} */\n getRootMargin?(): IntersectionObserverRootMargin;\n\n /** @defaultValue `headings[0]?.id ?? \"\"` */\n defaultActiveId?: UseStateInitializer<string>;\n\n /** @defaultValue `0.8` */\n scrollBottomThreshold?: number;\n}\n\n/**\n * This is heavily inspired by:\n * @see https://github.com/mdn/yari/blob/231d6aab8f1c8efe159d268c261446c5b7ae12d9/client/src/document/hooks.ts#L171\n *\n * @since 6.0.0\n */\nexport function useActiveHeadingId(options: ActiveHeadingIdOptions): string {\n const {\n headings,\n threshold = DEFAULT_ACTIVE_HEADING_THRESHOLD,\n getRootMargin = DEFAULT_ACTIVE_HEADING_GET_ROOT_MARGIN,\n defaultActiveId = headings[0]?.id ?? \"\",\n scrollBottomThreshold = 0.8,\n } = options;\n const elements = useRef<Map<string, boolean>>();\n const isFirstRender = useRef(true);\n const [activeHeadingId, setActiveHeadingId] = useState(defaultActiveId);\n useIntersectionObserver({\n threshold,\n getRootMargin,\n getTargets: useCallback(() => {\n const headingElements = getHeadingElements(headings);\n const lookup = new Map<string, boolean>();\n headingElements.forEach((heading) => {\n lookup.set(heading.id, false);\n });\n elements.current = lookup;\n\n return headingElements;\n }, [headings]),\n onUpdate: useCallback(\n (entries) => {\n const lookup = elements.current;\n if (!lookup) {\n return;\n }\n\n entries.forEach((entry) => {\n lookup.set(entry.target.id, entry.isIntersecting);\n });\n\n // get the first visible/intersecting item and set it\n let foundId = [...lookup.entries()].find(\n ([_id, isIntersecting]) => isIntersecting\n )?.[0];\n if (\n !foundId &&\n isFirstRender.current &&\n isScrolledNearPageBottom(scrollBottomThreshold)\n ) {\n foundId = getLastHeadingId(headings);\n }\n\n isFirstRender.current = false;\n\n // if there isn't a found id, it might be a really large section where\n // another heading isn't visible, so maintain the previous one\n if (foundId) {\n setActiveHeadingId(foundId);\n }\n },\n [headings, scrollBottomThreshold]\n ),\n });\n\n return activeHeadingId;\n}\n"],"names":["useCallback","useRef","useState","useIntersectionObserver","parseCssLengthUnit","DEFAULT_ACTIVE_HEADING_THRESHOLD","DEFAULT_ACTIVE_HEADING_GET_ROOT_MARGIN","headerHeightVar","window","getComputedStyle","document","documentElement","getPropertyValue","headerHeight","value","getHeadingElements","items","headings","forEach","item","heading","getElementById","id","push","children","getLastHeadingId","last","at","isScrolledNearPageBottom","threshold","scrollY","scrollHeight","useActiveHeadingId","options","getRootMargin","defaultActiveId","scrollBottomThreshold","elements","isFirstRender","activeHeadingId","setActiveHeadingId","getTargets","headingElements","lookup","Map","set","current","onUpdate","entries","entry","target","isIntersecting","foundId","find","_id"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAEtD,SACEC,uBAAuB,QAGlB,gCAAgC;AACvC,SAASC,kBAAkB,QAAQ,iCAAiC;AAgBpE;;;CAGC,GACD,OAAO,MAAMC,mCAAkE;IAC7E;IAAK;CACN,CAAC;AAEF;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMC,yCAAyC;IACpD,MAAMC,kBAAkBC,OACrBC,gBAAgB,CAACC,SAASC,eAAe,EACzCC,gBAAgB,CAAC;IACpB,MAAMC,eAAeT,mBAAmB;QACtCU,OAAOP,mBAAmB;IAC5B;IAEA,OAAO,CAAC,CAAC,EAAEM,aAAa,cAAc,CAAC;AACzC,EAAE;AAEF;;;CAGC,GACD,SAASE,mBACPC,KAA8C;IAE9C,MAAMC,WAA0B,EAAE;IAClCD,MAAME,OAAO,CAAC,CAACC;QACb,MAAMC,UAAUV,SAASW,cAAc,CAACF,KAAKG,EAAE;QAC/C,IAAIF,SAAS;YACXH,SAASM,IAAI,CAACH;QAChB;QAEA,IAAID,KAAKK,QAAQ,EAAE;YACjBP,SAASM,IAAI,IAAIR,mBAAmBI,KAAKK,QAAQ;QACnD;IACF;IAEA,OAAOP;AACT;AAEA;;;CAGC,GACD,SAASQ,iBACPT,KAA8C;IAE9C,MAAMU,OAAOV,MAAMW,EAAE,CAAC,CAAC;IACvB,IAAI,CAACD,MAAM;QACT,OAAO;IACT;IAEA,IAAIA,KAAKF,QAAQ,EAAE;QACjB,OAAOC,iBAAiBC,KAAKF,QAAQ;IACvC;IAEA,OAAOE,KAAKJ,EAAE;AAChB;AAEA;;;CAGC,G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B;QACF,GACA;YAACnC;YAAUmB;SAAsB;IAErC;IAEA,OAAOG;AACT"}
1
+ {"version":3,"sources":["../../src/navigation/useActiveHeadingId.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { type UseStateInitializer } from \"../types.js\";\nimport {\n useIntersectionObserver,\n type IntersectionObserverRootMargin,\n type IntersectionObserverThreshold,\n} from \"../useIntersectionObserver.js\";\nimport { parseCssLengthUnit } from \"../utils/parseCssLengthUnit.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface HeadingReference {\n id: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface HeadingReferenceWithChildren extends HeadingReference {\n children?: readonly HeadingReferenceWithChildren[];\n}\n\n/**\n * @defaultValue `[0.0, 1.0]`\n * @since 6.0.0\n */\nexport const DEFAULT_ACTIVE_HEADING_THRESHOLD: IntersectionObserverThreshold = [\n 0.0, 1.0,\n];\n\n/**\n * ```tsx\n * const headerHeightVar = window\n * .getComputedStyle(document.documentElement)\n * .getPropertyValue(\"--rmd-layout-header-height\");\n * const headerHeight = parseCssLengthUnit({\n * value: headerHeightVar || \"3.5rem\",\n * });\n\n * return `-${headerHeight}px 0px 0px 0px`;\n * ```\n * @since 6.0.0\n */\nexport const DEFAULT_ACTIVE_HEADING_GET_ROOT_MARGIN = (): string => {\n const headerHeightVar = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(\"--rmd-layout-header-height\");\n const headerHeight = parseCssLengthUnit({\n value: headerHeightVar || \"3.5rem\",\n });\n\n return `-${headerHeight}px 0px 0px 0px`;\n};\n\n/**\n * @internal\n * @since 6.0.0\n */\nfunction getHeadingElements(\n items: readonly HeadingReferenceWithChildren[]\n): HTMLElement[] {\n const headings: HTMLElement[] = [];\n items.forEach((item) => {\n const heading = document.getElementById(item.id);\n if (heading) {\n headings.push(heading);\n }\n\n if (item.children) {\n headings.push(...getHeadingElements(item.children));\n }\n });\n\n return headings;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nfunction getLastHeadingId(\n items: readonly HeadingReferenceWithChildren[]\n): string {\n const last = items.at(-1);\n if (!last) {\n return \"\";\n }\n\n if (last.children) {\n return getLastHeadingId(last.children);\n }\n\n return last.id;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nconst isScrolledNearPageBottom = (threshold: number): boolean =>\n window.scrollY >= document.documentElement.scrollHeight * threshold;\n\n/**\n * @since 6.0.0\n */\nexport interface ActiveHeadingIdOptions {\n headings: readonly HeadingReferenceWithChildren[];\n\n /** @see {@link DEFAULT_ACTIVE_HEADING_THRESHOLD} */\n threshold?: IntersectionObserverThreshold;\n\n /** @see {@link DEFAULT_ACTIVE_HEADING_GET_ROOT_MARGIN} */\n getRootMargin?(): IntersectionObserverRootMargin;\n\n /** @defaultValue `headings[0]?.id ?? \"\"` */\n defaultActiveId?: UseStateInitializer<string>;\n\n /** @defaultValue `0.8` */\n scrollBottomThreshold?: number;\n}\n\n/**\n * This is heavily inspired by:\n * @see https://github.com/mdn/yari/blob/231d6aab8f1c8efe159d268c261446c5b7ae12d9/client/src/document/hooks.ts#L171\n *\n * @since 6.0.0\n */\nexport function useActiveHeadingId(options: ActiveHeadingIdOptions): string {\n const {\n headings,\n threshold = DEFAULT_ACTIVE_HEADING_THRESHOLD,\n getRootMargin = DEFAULT_ACTIVE_HEADING_GET_ROOT_MARGIN,\n defaultActiveId = headings[0]?.id ?? \"\",\n scrollBottomThreshold = 0.8,\n } = options;\n const elements = useRef<Map<string, boolean>>();\n const isFirstRender = useRef(true);\n const [activeHeadingId, setActiveHeadingId] = useState(defaultActiveId);\n useIntersectionObserver({\n threshold,\n getRootMargin,\n getTargets: useCallback(() => {\n const headingElements = getHeadingElements(headings);\n const lookup = new Map<string, boolean>();\n headingElements.forEach((heading) => {\n lookup.set(heading.id, false);\n });\n elements.current = lookup;\n\n return headingElements;\n }, [headings]),\n onUpdate: useCallback(\n (entries) => {\n const lookup = elements.current;\n if (!lookup) {\n return;\n }\n\n entries.forEach((entry) => {\n lookup.set(entry.target.id, entry.isIntersecting);\n });\n\n // get the first visible/intersecting item and set it\n let foundId = [...lookup.entries()].find(\n ([_id, isIntersecting]) => isIntersecting\n )?.[0];\n if (\n !foundId &&\n isFirstRender.current &&\n isScrolledNearPageBottom(scrollBottomThreshold)\n ) {\n foundId = getLastHeadingId(headings);\n }\n\n isFirstRender.current = false;\n\n // if there isn't a found id, it might be a really large section where\n // another heading isn't visible, so maintain the previous one\n if (foundId) {\n setActiveHeadingId(foundId);\n }\n },\n [headings, scrollBottomThreshold]\n ),\n });\n\n return activeHeadingId;\n}\n"],"names":["useCallback","useRef","useState","useIntersectionObserver","parseCssLengthUnit","DEFAULT_ACTIVE_HEADING_THRESHOLD","DEFAULT_ACTIVE_HEADING_GET_ROOT_MARGIN","headerHeightVar","window","getComputedStyle","document","documentElement","getPropertyValue","headerHeight","value","getHeadingElements","items","headings","forEach","item","heading","getElementById","id","push","children","getLastHeadingId","last","at","isScrolledNearPageBottom","threshold","scrollY","scrollHeight","useActiveHeadingId","options","getRootMargin","defaultActiveId","scrollBottomThreshold","elements","isFirstRender","activeHeadingId","setActiveHeadingId","getTargets","headingElements","lookup","Map","set","current","onUpdate","entries","entry","target","isIntersecting","foundId","find","_id"],"mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAEtD,SACEC,uBAAuB,QAGlB,gCAAgC;AACvC,SAASC,kBAAkB,QAAQ,iCAAiC;AAgBpE;;;CAGC,GACD,OAAO,MAAMC,mCAAkE;IAC7E;IAAK;CACN,CAAC;AAEF;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMC,yCAAyC;IACpD,MAAMC,kBAAkBC,OACrBC,gBAAgB,CAACC,SAASC,eAAe,EACzCC,gBAAgB,CAAC;IACpB,MAAMC,eAAeT,mBAAmB;QACtCU,OAAOP,mBAAmB;IAC5B;IAEA,OAAO,CAAC,CAAC,EAAEM,aAAa,cAAc,CAAC;AACzC,EAAE;A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QACT,GAAG;YAACzB;SAAS;QACb8B,UAAU/C,YACR,CAACgD;YACC,MAAML,SAASN,SAASS,OAAO;YAC/B,IAAI,CAACH,QAAQ;gBACX;YACF;YAEAK,QAAQ9B,OAAO,CAAC,CAAC+B;gBACfN,OAAOE,GAAG,CAACI,MAAMC,MAAM,CAAC5B,EAAE,EAAE2B,MAAME,cAAc;YAClD;YAEA,qDAAqD;YACrD,IAAIC,UAAU;mBAAIT,OAAOK,OAAO;aAAG,CAACK,IAAI,CACtC,CAAC,CAACC,KAAKH,eAAe,GAAKA,iBAC1B,CAAC,EAAE;YACN,IACE,CAACC,WACDd,cAAcQ,OAAO,IACrBlB,yBAAyBQ,wBACzB;gBACAgB,UAAU3B,iBAAiBR;YAC7B;YAEAqB,cAAcQ,OAAO,GAAG;YAExB,sEAAsE;YACtE,8DAA8D;YAC9D,IAAIM,SAAS;gBACXZ,mBAAmBY;YACrB;QACF,GACA;YAACnC;YAAUmB;SAAsB;IAErC;IAEA,OAAOG;AACT"}
@@ -3,6 +3,7 @@ import { type BoxAlignItems, type BoxJustifyContent } from "../box/styles.js";
3
3
  import { type CSSTransitionComponentProps, type TransitionActions } from "../transition/types.js";
4
4
  /**
5
5
  * @since 6.0.0 Added `align` and `justify` props.
6
+ * @since 6.0.0 Renamed `hidden` to `noOpacity`.
6
7
  */
7
8
  export interface OverlayProps extends HTMLAttributes<HTMLSpanElement>, CSSTransitionComponentProps, TransitionActions {
8
9
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/overlay/Overlay.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { type BoxAlignItems, type BoxJustifyContent } from \"../box/styles.js\";\nimport { Portal } from \"../portal/Portal.js\";\nimport { useSsr } from \"../SsrProvider.js\";\nimport {\n type CSSTransitionComponentProps,\n type TransitionActions,\n} from \"../transition/types.js\";\nimport { useCSSTransition } from \"../transition/useCSSTransition.js\";\nimport {\n DEFAULT_OVERLAY_CLASSNAMES,\n DEFAULT_OVERLAY_TIMEOUT,\n overlay,\n} from \"./overlayStyles.js\";\n\n/**\n * @since 6.0.0 Added `align` and `justify` props.\n */\nexport interface OverlayProps\n extends HTMLAttributes<HTMLSpanElement>,\n CSSTransitionComponentProps,\n TransitionActions {\n /**\n * @defaultValue `\"center\"`\n * @since 6.0.0\n */\n align?: BoxAlignItems;\n\n /**\n * @defaultValue `\"center\"`\n * @since 6.0.0\n */\n justify?: BoxJustifyContent;\n\n /**\n * Set this to `true` for when the overlay should be visible. Toggling this\n * value will trigger the enter/exit animation.\n */\n visible: boolean;\n\n /**\n * Set this to `true` if the overlay should be rendered with an `opacity: 0`\n * and disabling the animation. This is useful if you'd like a \"close on\n * outside click\" behavior.\n *\n * @defaultValue `false`\n */\n noOpacity?: boolean;\n\n /**\n * @see {@link OverlayClassNameOptions.clickable}\n * @defaultValue `!noOpacity`\n */\n clickable?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { Button, Overlay, useToggle } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { toggle, disable, toggled: visible } = useToggle(false);\n *\n * return (\n * <>\n * <Button onClick={toggle}>Toggle</Button>\n * <Overlay visible={visible} onClick={disable} />\n * </>\n * );\n * }\n * ```\n *\n * @since 6.0.0 Removed the `onRequestClose` prop in favor of using\n * the `onClick` prop instead.\n */\nexport const Overlay = forwardRef<HTMLSpanElement, OverlayProps>(\n function Overlay(props, nodeRef) {\n const {\n children,\n className,\n visible,\n noOpacity = false,\n clickable = !noOpacity,\n temporary = true,\n timeout = DEFAULT_OVERLAY_TIMEOUT,\n classNames = DEFAULT_OVERLAY_CLASSNAMES,\n disableTransition = false,\n align = \"center\",\n justify = \"center\",\n appear,\n enter,\n exit,\n onEnter,\n onEntering,\n onEntered,\n onExit,\n onExiting,\n onExited,\n exitedHidden = true,\n disablePortal: propDisablePortal = false,\n ...remaining\n } = props;\n\n const ssr = useSsr();\n const { elementProps, rendered, disablePortal } = useCSSTransition({\n nodeRef,\n transitionIn: visible,\n timeout: noOpacity ? 0 : timeout,\n classNames: noOpacity ? \"\" : classNames,\n className: overlay({\n visible,\n clickable,\n align,\n justify,\n className,\n }),\n appear: appear && !disableTransition && !ssr,\n enter: enter && !disableTransition,\n exit: exit && !disableTransition,\n onEnter,\n onEntering,\n onEntered,\n onExit,\n onExiting,\n onExited,\n temporary,\n exitedHidden,\n disablePortal: propDisablePortal,\n });\n\n return (\n <Portal disabled={disablePortal}>\n {rendered && (\n <span {...remaining} {...elementProps}>\n {children}\n </span>\n )}\n </Portal>\n );\n }\n);\n"],"names":["forwardRef","Portal","useSsr","useCSSTransition","DEFAULT_OVERLAY_CLASSNAMES","DEFAULT_OVERLAY_TIMEOUT","overlay","Overlay","props","nodeRef","children","className","visible","noOpacity","clickable","temporary","timeout","classNames","disableTransition","align","justify","appear","enter","exit","onEnter","onEntering","onEntered","onExit","onExiting","onExited","exitedHidden","disablePortal","propDisablePortal","remaining","ssr","elementProps","rendered","transitionIn","disabled","span"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,UAAU,QAA6B,QAAQ;AAExD,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,MAAM,QAAQ,oBAAoB;AAK3C,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SACEC,0BAA0B,EAC1BC,uBAAuB,EACvBC,OAAO,QACF,qBAAqB;AAqD5B;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,MAAMC,wBAAUP,WACrB,SAASO,QAAQC,KAAK,EAAEC,OAAO;IAC7B,MAAM,EACJC,QAAQ,EACRC,SAAS,EACTC,OAAO,EACPC,YAAY,KAAK,EACjBC,YAAY,CAACD,SAAS,EACtBE,YAAY,IAAI,EAChBC,UAAUX,uBAAuB,EACjCY,aAAab,0BAA0B,EACvCc,oBAAoB,KAAK,EACzBC,QAAQ,QAAQ,EAChBC,UAAU,QAAQ,EAClBC,MAAM,EACNC,KAAK,EACLC,IAAI,EACJC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,QAAQ,EACRC,eAAe,IAAI,EACnBC,eAAeC,oBAAoB,KAAK,EACxC,GAAGC,WACJ,GAAGzB;IAEJ,MAAM0B,MAAMhC;IACZ,MAAM,EAAEiC,YAAY,EAAEC,QAAQ,EAAEL,aAAa,EAAE,GAAG5B,iBAAiB;QACjEM;QACA4B,cAAczB;QACdI,SAASH,YAAY,IAAIG;QACzBC,YAAYJ,YAAY,KAAKI;QAC7BN,WAAWL,QAAQ;YACjBM;YACAE;YACAK;YACAC;YACAT;QACF;QACAU,QAAQA,UAAU,CAACH,qBAAqB,CAACgB;QACzCZ,OAAOA,SAAS,CAACJ;QACjBK,MAAMA,QAAQ,CAACL;QACfM;QACAC;QACAC;QACAC;QACAC;QACAC;QACAd;QACAe;QACAC,eAAeC;IACjB;IAEA,qBACE,KAAC/B;QAAOqC,UAAUP;kBACfK,0BACC,KAACG;YAAM,GAAGN,SAAS;YAAG,GAAGE,YAAY;sBAClCzB;;;AAKX,GACA"}
1
+ {"version":3,"sources":["../../src/overlay/Overlay.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { type BoxAlignItems, type BoxJustifyContent } from \"../box/styles.js\";\nimport { Portal } from \"../portal/Portal.js\";\nimport { useSsr } from \"../SsrProvider.js\";\nimport {\n type CSSTransitionComponentProps,\n type TransitionActions,\n} from \"../transition/types.js\";\nimport { useCSSTransition } from \"../transition/useCSSTransition.js\";\nimport {\n DEFAULT_OVERLAY_CLASSNAMES,\n DEFAULT_OVERLAY_TIMEOUT,\n overlay,\n} from \"./overlayStyles.js\";\n\n/**\n * @since 6.0.0 Added `align` and `justify` props.\n * @since 6.0.0 Renamed `hidden` to `noOpacity`.\n */\nexport interface OverlayProps\n extends HTMLAttributes<HTMLSpanElement>,\n CSSTransitionComponentProps,\n TransitionActions {\n /**\n * @defaultValue `\"center\"`\n * @since 6.0.0\n */\n align?: BoxAlignItems;\n\n /**\n * @defaultValue `\"center\"`\n * @since 6.0.0\n */\n justify?: BoxJustifyContent;\n\n /**\n * Set this to `true` for when the overlay should be visible. Toggling this\n * value will trigger the enter/exit animation.\n */\n visible: boolean;\n\n /**\n * Set this to `true` if the overlay should be rendered with an `opacity: 0`\n * and disabling the animation. This is useful if you'd like a \"close on\n * outside click\" behavior.\n *\n * @defaultValue `false`\n */\n noOpacity?: boolean;\n\n /**\n * @see {@link OverlayClassNameOptions.clickable}\n * @defaultValue `!noOpacity`\n */\n clickable?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { Button, Overlay, useToggle } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { toggle, disable, toggled: visible } = useToggle(false);\n *\n * return (\n * <>\n * <Button onClick={toggle}>Toggle</Button>\n * <Overlay visible={visible} onClick={disable} />\n * </>\n * );\n * }\n * ```\n *\n * @since 6.0.0 Removed the `onRequestClose` prop in favor of using\n * the `onClick` prop instead.\n */\nexport const Overlay = forwardRef<HTMLSpanElement, OverlayProps>(\n function Overlay(props, nodeRef) {\n const {\n children,\n className,\n visible,\n noOpacity = false,\n clickable = !noOpacity,\n temporary = true,\n timeout = DEFAULT_OVERLAY_TIMEOUT,\n classNames = DEFAULT_OVERLAY_CLASSNAMES,\n disableTransition = false,\n align = \"center\",\n justify = \"center\",\n appear,\n enter,\n exit,\n onEnter,\n onEntering,\n onEntered,\n onExit,\n onExiting,\n onExited,\n exitedHidden = true,\n disablePortal: propDisablePortal = false,\n ...remaining\n } = props;\n\n const ssr = useSsr();\n const { elementProps, rendered, disablePortal } = useCSSTransition({\n nodeRef,\n transitionIn: visible,\n timeout: noOpacity ? 0 : timeout,\n classNames: noOpacity ? \"\" : classNames,\n className: overlay({\n visible,\n clickable,\n align,\n justify,\n className,\n }),\n appear: appear && !disableTransition && !ssr,\n enter: enter && !disableTransition,\n exit: exit && !disableTransition,\n onEnter,\n onEntering,\n onEntered,\n onExit,\n onExiting,\n onExited,\n temporary,\n exitedHidden,\n disablePortal: propDisablePortal,\n });\n\n return (\n <Portal disabled={disablePortal}>\n {rendered && (\n <span {...remaining} {...elementProps}>\n {children}\n </span>\n )}\n </Portal>\n );\n }\n);\n"],"names":["forwardRef","Portal","useSsr","useCSSTransition","DEFAULT_OVERLAY_CLASSNAMES","DEFAULT_OVERLAY_TIMEOUT","overlay","Overlay","props","nodeRef","children","className","visible","noOpacity","clickable","temporary","timeout","classNames","disableTransition","align","justify","appear","enter","exit","onEnter","onEntering","onEntered","onExit","onExiting","onExited","exitedHidden","disablePortal","propDisablePortal","remaining","ssr","elementProps","rendered","transitionIn","disabled","span"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAA6B,QAAQ;AAExD,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,MAAM,QAAQ,oBAAoB;AAK3C,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SACEC,0BAA0B,EAC1BC,uBAAuB,EACvBC,OAAO,QACF,qBAAqB;AAsD5B;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,MAAMC,wBAAUP,WACrB,SAASO,QAAQC,KAAK,EAAEC,OAAO;IAC7B,MAAM,EACJC,QAAQ,EACRC,SAAS,EACTC,OAAO,EACPC,YAAY,KAAK,EACjBC,YAAY,CAACD,SAAS,EACtBE,YAAY,IAAI,EAChBC,UAAUX,uBAAuB,EACjCY,aAAab,0BAA0B,EACvCc,oBAAoB,KAAK,EACzBC,QAAQ,QAAQ,EAChBC,UAAU,QAAQ,EAClBC,MAAM,EACNC,KAAK,EACLC,IAAI,EACJC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,QAAQ,EACRC,eAAe,IAAI,EACnBC,eAAeC,oBAAoB,KAAK,EACxC,GAAGC,WACJ,GAAGzB;IAEJ,MAAM0B,MAAMhC;IACZ,MAAM,EAAEiC,YAAY,EAAEC,QAAQ,EAAEL,aAAa,EAAE,GAAG5B,iBAAiB;QACjEM;QACA4B,cAAczB;QACdI,SAASH,YAAY,IAAIG;QACzBC,YAAYJ,YAAY,KAAKI;QAC7BN,WAAWL,QAAQ;YACjBM;YACAE;YACAK;YACAC;YACAT;QACF;QACAU,QAAQA,UAAU,CAACH,qBAAqB,CAACgB;QACzCZ,OAAOA,SAAS,CAACJ;QACjBK,MAAMA,QAAQ,CAACL;QACfM;QACAC;QACAC;QACAC;QACAC;QACAC;QACAd;QACAe;QACAC,eAAeC;IACjB;IAEA,qBACE,KAAC/B;QAAOqC,UAAUP;kBACfK,0BACC,KAACG;YAAM,GAAGN,SAAS;YAAG,GAAGE,YAAY;sBAClCzB;;;AAKX,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/overlay/overlayStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n box,\n type BoxAlignItems,\n type BoxJustifyContent,\n} from \"../box/styles.js\";\nimport {\n type CSSTransitionClassNamesObject,\n type TransitionTimeout,\n} from \"../transition/types.js\";\nimport { bem } from \"../utils/bem.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-overlay-background-color\"?: string;\n \"--rmd-overlay-z-index\"?: number;\n }\n}\n\nconst styles = bem(\"rmd-overlay\");\n\n/** @since 6.0.0 */\nexport interface OverlayClassNameOptions {\n className?: string;\n\n visible: boolean;\n\n /** @defaultValue `false` */\n active?: boolean;\n\n /** @defaultValue `false` */\n clickable?: boolean;\n\n /** @defaultValue `false` */\n absolute?: boolean;\n /** @defaultValue `\"center\"` */\n align?: BoxAlignItems;\n\n /** @defaultValue `\"center\"` */\n justify?: BoxJustifyContent;\n}\n\n/**\n * @since 6.0.0\n */\nexport function overlay(\n options: OverlayClassNameOptions & { active?: boolean }\n): string {\n const {\n visible,\n active,\n absolute = false,\n clickable = false,\n align = \"center\",\n justify = \"center\",\n className,\n } = options;\n\n return cnb(\n styles({\n active,\n visible,\n clickable,\n absolute,\n }),\n box({\n align,\n justify,\n disablePadding: true,\n }),\n className\n );\n}\n\n/** @since 2.4.0 */\nexport const DEFAULT_OVERLAY_TIMEOUT: TransitionTimeout = 150;\n\n/** @since 2.4.0 */\nexport const DEFAULT_OVERLAY_CLASSNAMES: Readonly<CSSTransitionClassNamesObject> =\n {\n appearActive: \"rmd-overlay--active\",\n appearDone: \"rmd-overlay--active\",\n enterActive: \"rmd-overlay--active\",\n enterDone: \"rmd-overlay--active\",\n };\n"],"names":["cnb","box","bem","styles","overlay","options","visible","active","absolute","clickable","align","justify","className","disablePadding","DEFAULT_OVERLAY_TIMEOUT","DEFAULT_OVERLAY_CLASSNAMES","appearActive","appearDone","enterActive","enterDone"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,GAAG,QAGE,mBAAmB;AAK1B,SAASC,GAAG,QAAQ,kBAAkB;AAStC,MAAMC,SAASD,IAAI;AAuBnB;;CAEC,GACD,OAAO,SAASE,QACdC,OAAuD;IAEvD,MAAM,EACJC,OAAO,EACPC,MAAM,EACNC,WAAW,KAAK,EAChBC,YAAY,KAAK,EACjBC,QAAQ,QAAQ,EAChBC,UAAU,QAAQ,EAClBC,SAAS,EACV,GAAGP;IAEJ,OAAOL,IACLG,OAAO;QACLI;QACAD;QACAG;QACAD;IACF,IACAP,IAAI;QACFS;QACAC;QACAE,gBAAgB;IAClB,IACAD;AAEJ;AAEA,iBAAiB,GACjB,OAAO,MAAME,0BAA6C,IAAI;AAE9D,iBAAiB,GACjB,OAAO,MAAMC,6BACX;IACEC,cAAc;IACdC,YAAY;IACZC,aAAa;IACbC,WAAW;AACb,EAAE"}
1
+ {"version":3,"sources":["../../src/overlay/overlayStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n box,\n type BoxAlignItems,\n type BoxJustifyContent,\n} from \"../box/styles.js\";\nimport {\n type CSSTransitionClassNamesObject,\n type TransitionTimeout,\n} from \"../transition/types.js\";\nimport { bem } from \"../utils/bem.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-overlay-background-color\"?: string;\n \"--rmd-overlay-z-index\"?: number;\n }\n}\n\nconst styles = bem(\"rmd-overlay\");\n\n/** @since 6.0.0 */\nexport interface OverlayClassNameOptions {\n className?: string;\n\n visible: boolean;\n\n /** @defaultValue `false` */\n active?: boolean;\n\n /** @defaultValue `false` */\n clickable?: boolean;\n\n /** @defaultValue `false` */\n absolute?: boolean;\n /** @defaultValue `\"center\"` */\n align?: BoxAlignItems;\n\n /** @defaultValue `\"center\"` */\n justify?: BoxJustifyContent;\n}\n\n/**\n * @since 6.0.0\n */\nexport function overlay(\n options: OverlayClassNameOptions & { active?: boolean }\n): string {\n const {\n visible,\n active,\n absolute = false,\n clickable = false,\n align = \"center\",\n justify = \"center\",\n className,\n } = options;\n\n return cnb(\n styles({\n active,\n visible,\n clickable,\n absolute,\n }),\n box({\n align,\n justify,\n disablePadding: true,\n }),\n className\n );\n}\n\n/** @since 2.4.0 */\nexport const DEFAULT_OVERLAY_TIMEOUT: TransitionTimeout = 150;\n\n/** @since 2.4.0 */\nexport const DEFAULT_OVERLAY_CLASSNAMES: Readonly<CSSTransitionClassNamesObject> =\n {\n appearActive: \"rmd-overlay--active\",\n appearDone: \"rmd-overlay--active\",\n enterActive: \"rmd-overlay--active\",\n enterDone: \"rmd-overlay--active\",\n };\n"],"names":["cnb","box","bem","styles","overlay","options","visible","active","absolute","clickable","align","justify","className","disablePadding","DEFAULT_OVERLAY_TIMEOUT","DEFAULT_OVERLAY_CLASSNAMES","appearActive","appearDone","enterActive","enterDone"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,GAAG,QAGE,mBAAmB;AAK1B,SAASC,GAAG,QAAQ,kBAAkB;AAStC,MAAMC,SAASD,IAAI;AAuBnB;;CAEC,GACD,OAAO,SAASE,QACdC,OAAuD;IAEvD,MAAM,EACJC,OAAO,EACPC,MAAM,EACNC,WAAW,KAAK,EAChBC,YAAY,KAAK,EACjBC,QAAQ,QAAQ,EAChBC,UAAU,QAAQ,EAClBC,SAAS,EACV,GAAGP;IAEJ,OAAOL,IACLG,OAAO;QACLI;QACAD;QACAG;QACAD;IACF,IACAP,IAAI;QACFS;QACAC;QACAE,gBAAgB;IAClB,IACAD;AAEJ;AAEA,iBAAiB,GACjB,OAAO,MAAME,0BAA6C,IAAI;AAE9D,iBAAiB,GACjB,OAAO,MAAMC,6BACX;IACEC,cAAc;IACdC,YAAY;IACZC,aAAa;IACbC,WAAW;AACb,EAAE"}
@@ -1,4 +1,8 @@
1
1
  import { type ReactElement, type ReactNode } from "react";
2
+ /**
3
+ * @since 6.0.0 Removed the `into` and `intoId` props. Use the
4
+ * `PortalContainerProvider` instead.
5
+ */
2
6
  export interface PortalProps {
3
7
  children: ReactNode;
4
8
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/portal/Portal.tsx"],"sourcesContent":["\"use client\";\nimport { type ReactElement, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { usePortalContainer } from \"./PortalContainerProvider.js\";\n\nexport interface PortalProps {\n children: ReactNode;\n /**\n * Setting this to `true` will disable the portal behavior and just render\n * the `children` in the normal DOM tree.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * Portals are a great way to render temporary elements like dialogs, tooltips,\n * and menus at a different port of the DOM. This implementation will render\n * the `children` in the current {@link PortalContainer} element.\n *\n * @example Simple Example\n * ```tsx\n * import { Portal } from \"@react-md/portal\";\n *\n * function Example() {\n * return <Portal><div>Some Content</div></Portal>;\n * }\n * ```\n *\n * @see {@link PortalContainerProvider}\n * @see {@link usePortalContainer}\n */\nexport function Portal(props: PortalProps): ReactElement {\n const { children, disabled = false } = props;\n const container = usePortalContainer();\n if (!container || disabled) {\n return <>{disabled && children}</>;\n }\n\n return createPortal(children, container);\n}\n"],"names":["createPortal","usePortalContainer","Portal","props","children","disabled","container"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAEA,SAASA,YAAY,QAAQ,YAAY;AAEzC,SAASC,kBAAkB,QAAQ,+BAA+B;AAalE;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,OAAOC,KAAkB;IACvC,MAAM,EAAEC,QAAQ,EAAEC,WAAW,KAAK,EAAE,GAAGF;IACvC,MAAMG,YAAYL;IAClB,IAAI,CAACK,aAAaD,UAAU;QAC1B,qBAAO;sBAAGA,YAAYD;;IACxB;IAEA,qBAAOJ,aAAaI,UAAUE;AAChC"}
1
+ {"version":3,"sources":["../../src/portal/Portal.tsx"],"sourcesContent":["\"use client\";\nimport { type ReactElement, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { usePortalContainer } from \"./PortalContainerProvider.js\";\n\n/**\n * @since 6.0.0 Removed the `into` and `intoId` props. Use the\n * `PortalContainerProvider` instead.\n */\nexport interface PortalProps {\n children: ReactNode;\n\n /**\n * Setting this to `true` will disable the portal behavior and just render\n * the `children` in the normal DOM tree.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * Portals are a great way to render temporary elements like dialogs, tooltips,\n * and menus at a different port of the DOM. This implementation will render\n * the `children` in the current {@link PortalContainer} element.\n *\n * @example Simple Example\n * ```tsx\n * import { Portal } from \"@react-md/portal\";\n *\n * function Example() {\n * return <Portal><div>Some Content</div></Portal>;\n * }\n * ```\n *\n * @see {@link PortalContainerProvider}\n * @see {@link usePortalContainer}\n */\nexport function Portal(props: PortalProps): ReactElement {\n const { children, disabled = false } = props;\n const container = usePortalContainer();\n if (!container || disabled) {\n return <>{disabled && children}</>;\n }\n\n return createPortal(children, container);\n}\n"],"names":["createPortal","usePortalContainer","Portal","props","children","disabled","container"],"mappings":"AAAA;;AAEA,SAASA,YAAY,QAAQ,YAAY;AAEzC,SAASC,kBAAkB,QAAQ,+BAA+B;AAkBlE;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,OAAOC,KAAkB;IACvC,MAAM,EAAEC,QAAQ,EAAEC,WAAW,KAAK,EAAE,GAAGF;IACvC,MAAMG,YAAYL;IAClB,IAAI,CAACK,aAAaD,UAAU;QAC1B,qBAAO;sBAAGA,YAAYD;;IACxB;IAEA,qBAAOJ,aAAaI,UAAUE;AAChC"}
@@ -3,13 +3,18 @@ import { type ReactElement, type ReactNode, type RefObject } from "react";
3
3
  * @internal
4
4
  * @since 6.0.0
5
5
  */
6
- export type PortalContainer = Element | DocumentFragment | null;
6
+ export type PortalContainerNode = Element | DocumentFragment | null;
7
+ /**
8
+ * @internal
9
+ * @since 6.0.0
10
+ */
11
+ export type PortalContainer = PortalContainerNode | RefObject<PortalContainerNode>;
7
12
  export declare const PORTAL_CONTAINER_ID = "rmd-portal-container";
8
13
  /**
9
14
  * @internal
10
15
  * @since 6.0.0
11
16
  */
12
- export declare function usePortalContainer(): PortalContainer;
17
+ export declare function usePortalContainer(): PortalContainerNode;
13
18
  /** @since 6.0.0 */
14
19
  export interface PortalContainerProviderProps {
15
20
  /**
@@ -17,7 +22,7 @@ export interface PortalContainerProviderProps {
17
22
  * `<div id="rmd-portal-container"></div>` will be added as the last child to
18
23
  * the `document.body` and be used as the container element.
19
24
  */
20
- container?: PortalContainer | RefObject<PortalContainer>;
25
+ container?: PortalContainer;
21
26
  children: ReactNode;
22
27
  }
23
28
  /**
@@ -32,6 +32,7 @@ const { Provider } = context;
32
32
  return;
33
33
  }
34
34
  if (typeof container !== "undefined") {
35
+ setValue(container);
35
36
  return;
36
37
  }
37
38
  if (!portalContainer) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/portal/PortalContainerProvider.tsx"],"sourcesContent":["\"use client\";\nimport {\n createContext,\n useContext,\n useEffect,\n useState,\n type ReactElement,\n type ReactNode,\n type RefObject,\n} from \"react\";\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport type PortalContainer = Element | DocumentFragment | null;\n\nexport const PORTAL_CONTAINER_ID = \"rmd-portal-container\";\n\nlet portalContainer: PortalContainer = null;\n\nconst getPortalContainer = (): PortalContainer =>\n typeof window === \"undefined\" ? null : document.body;\n\nconst context = createContext<PortalContainer>(getPortalContainer());\ncontext.displayName = \"PortalContainer\";\nconst { Provider } = context;\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport function usePortalContainer(): PortalContainer {\n return useContext(context);\n}\n\n/** @since 6.0.0 */\nexport interface PortalContainerProviderProps {\n /**\n * An optional container element to use. When this is `undefined`, a\n * `<div id=\"rmd-portal-container\"></div>` will be added as the last child to\n * the `document.body` and be used as the container element.\n */\n container?: PortalContainer | RefObject<PortalContainer>;\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component allows for all child `Portal` components to render within the\n * same container element. If a custom `container` element is not provided, a\n * `<div id=\"rmd-portal-container\"></div>` will be added as the last child to\n * the `document.body` and be used as the container element.\n *\n * @see {@link Portal}\n * @since 6.0.0\n */\nexport function PortalContainerProvider(\n props: PortalContainerProviderProps\n): ReactElement {\n const { container, children } = props;\n const [value, setValue] = useState<PortalContainer>(portalContainer);\n useEffect(() => {\n if (container && \"current\" in container) {\n setValue(container.current);\n return;\n }\n\n if (typeof container !== \"undefined\") {\n return;\n }\n\n if (!portalContainer) {\n portalContainer = document.createElement(\"div\");\n portalContainer.id = PORTAL_CONTAINER_ID;\n }\n if (!document.body.contains(portalContainer)) {\n document.body.appendChild(portalContainer);\n }\n\n setValue(portalContainer);\n\n return () => {\n if (portalContainer && document.body.contains(portalContainer)) {\n document.body.removeChild(portalContainer);\n }\n };\n }, [container]);\n\n const containerValue =\n (container && \"current\" in container) || !container ? value : container;\n return <Provider value={containerValue}>{children}</Provider>;\n}\n"],"names":["createContext","useContext","useEffect","useState","PORTAL_CONTAINER_ID","portalContainer","getPortalContainer","window","document","body","context","displayName","Provider","usePortalContainer","PortalContainerProvider","props","container","children","value","setValue","current","createElement","id","contains","appendChild","removeChild","containerValue"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SACEA,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,QAAQ,QAIH,QAAQ;AAQf,OAAO,MAAMC,sBAAsB,uBAAuB;AAE1D,IAAIC,kBAAmC;AAEvC,MAAMC,qBAAqB,IACzB,OAAOC,WAAW,cAAc,OAAOC,SAASC,IAAI;AAEtD,MAAMC,wBAAUV,cAA+BM;AAC/CI,QAAQC,WAAW,GAAG;AACtB,MAAM,EAAEC,QAAQ,EAAE,GAAGF;AAErB;;;CAGC,GACD,OAAO,SAASG;IACd,OAAOZ,WAAWS;AACpB;AAaA;;;;;;;;;;CAUC,GACD,OAAO,SAASI,wBACdC,KAAmC;IAEnC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGF;IAChC,MAAM,CAACG,OAAOC,SAAS,GAAGhB,SAA0BE;IACpDH,UAAU;QACR,IAAIc,aAAa,aAAaA,WAAW;YACvCG,SAASH,UAAUI,OAAO;YAC1B;QACF;QAEA,IAAI,OAAOJ,cAAc,aAAa;YACpC;QACF;QAEA,IAAI,CAACX,iBAAiB;YACpBA,kBAAkBG,SAASa,aAAa,CAAC;YACzChB,gBAAgBiB,EAAE,GAAGlB;QACvB;QACA,IAAI,CAACI,SAASC,IAAI,CAACc,QAAQ,CAAClB,kBAAkB;YAC5CG,SAASC,IAAI,CAACe,WAAW,CAACnB;QAC5B;QAEAc,SAASd;QAET,OAAO;YACL,IAAIA,mBAAmBG,SAASC,IAAI,CAACc,QAAQ,CAAClB,kBAAkB;gBAC9DG,SAASC,IAAI,CAACgB,WAAW,CAACpB;YAC5B;QACF;IACF,GAAG;QAACW;KAAU;IAEd,MAAMU,iBACJ,AAACV,aAAa,aAAaA,aAAc,CAACA,YAAYE,QAAQF;IAChE,qBAAO,KAACJ;QAASM,OAAOQ;kBAAiBT;;AAC3C"}
1
+ {"version":3,"sources":["../../src/portal/PortalContainerProvider.tsx"],"sourcesContent":["\"use client\";\nimport {\n createContext,\n useContext,\n useEffect,\n useState,\n type ReactElement,\n type ReactNode,\n type RefObject,\n} from \"react\";\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport type PortalContainerNode = Element | DocumentFragment | null;\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport type PortalContainer =\n | PortalContainerNode\n | RefObject<PortalContainerNode>;\n\nexport const PORTAL_CONTAINER_ID = \"rmd-portal-container\";\n\nlet portalContainer: PortalContainerNode = null;\n\nconst getPortalContainer = (): PortalContainerNode =>\n typeof window === \"undefined\" ? null : document.body;\n\nconst context = createContext<PortalContainerNode>(getPortalContainer());\ncontext.displayName = \"PortalContainer\";\nconst { Provider } = context;\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport function usePortalContainer(): PortalContainerNode {\n return useContext(context);\n}\n\n/** @since 6.0.0 */\nexport interface PortalContainerProviderProps {\n /**\n * An optional container element to use. When this is `undefined`, a\n * `<div id=\"rmd-portal-container\"></div>` will be added as the last child to\n * the `document.body` and be used as the container element.\n */\n container?: PortalContainer;\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component allows for all child `Portal` components to render within the\n * same container element. If a custom `container` element is not provided, a\n * `<div id=\"rmd-portal-container\"></div>` will be added as the last child to\n * the `document.body` and be used as the container element.\n *\n * @see {@link Portal}\n * @since 6.0.0\n */\nexport function PortalContainerProvider(\n props: PortalContainerProviderProps\n): ReactElement {\n const { container, children } = props;\n const [value, setValue] = useState<PortalContainerNode>(portalContainer);\n useEffect(() => {\n if (container && \"current\" in container) {\n setValue(container.current);\n return;\n }\n\n if (typeof container !== \"undefined\") {\n setValue(container);\n return;\n }\n\n if (!portalContainer) {\n portalContainer = document.createElement(\"div\");\n portalContainer.id = PORTAL_CONTAINER_ID;\n }\n if (!document.body.contains(portalContainer)) {\n document.body.appendChild(portalContainer);\n }\n\n setValue(portalContainer);\n\n return () => {\n if (portalContainer && document.body.contains(portalContainer)) {\n document.body.removeChild(portalContainer);\n }\n };\n }, [container]);\n\n const containerValue =\n (container && \"current\" in container) || !container ? value : container;\n return <Provider value={containerValue}>{children}</Provider>;\n}\n"],"names":["createContext","useContext","useEffect","useState","PORTAL_CONTAINER_ID","portalContainer","getPortalContainer","window","document","body","context","displayName","Provider","usePortalContainer","PortalContainerProvider","props","container","children","value","setValue","current","createElement","id","contains","appendChild","removeChild","containerValue"],"mappings":"AAAA;;AACA,SACEA,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,QAAQ,QAIH,QAAQ;AAgBf,OAAO,MAAMC,sBAAsB,uBAAuB;AAE1D,IAAIC,kBAAuC;AAE3C,MAAMC,qBAAqB,IACzB,OAAOC,WAAW,cAAc,OAAOC,SAASC,IAAI;AAEtD,MAAMC,wBAAUV,cAAmCM;AACnDI,QAAQC,WAAW,GAAG;AACtB,MAAM,EAAEC,QAAQ,EAAE,GAAGF;AAErB;;;CAGC,GACD,OAAO,SAASG;IACd,OAAOZ,WAAWS;AACpB;AAaA;;;;;;;;;;CAUC,GACD,OAAO,SAASI,wBACdC,KAAmC;IAEnC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGF;IAChC,MAAM,CAACG,OAAOC,SAAS,GAAGhB,SAA8BE;IACxDH,UAAU;QACR,IAAIc,aAAa,aAAaA,WAAW;YACvCG,SAASH,UAAUI,OAAO;YAC1B;QACF;QAEA,IAAI,OAAOJ,cAAc,aAAa;YACpCG,SAASH;YACT;QACF;QAEA,IAAI,CAACX,iBAAiB;YACpBA,kBAAkBG,SAASa,aAAa,CAAC;YACzChB,gBAAgBiB,EAAE,GAAGlB;QACvB;QACA,IAAI,CAACI,SAASC,IAAI,CAACc,QAAQ,CAAClB,kBAAkB;YAC5CG,SAASC,IAAI,CAACe,WAAW,CAACnB;QAC5B;QAEAc,SAASd;QAET,OAAO;YACL,IAAIA,mBAAmBG,SAASC,IAAI,CAACc,QAAQ,CAAClB,kBAAkB;gBAC9DG,SAASC,IAAI,CAACgB,WAAW,CAACpB;YAC5B;QACF;IACF,GAAG;QAACW;KAAU;IAEd,MAAMU,iBACJ,AAACV,aAAa,aAAaA,aAAc,CAACA,YAAYE,QAAQF;IAChE,qBAAO,KAACJ;QAASM,OAAOQ;kBAAiBT;;AAC3C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/positioning/constants.ts"],"sourcesContent":["import { type PositionAnchor } from \"./types.js\";\n\nexport const ABOVE_LEFT_ANCHOR: PositionAnchor = {\n x: \"left\",\n y: \"above\",\n};\n\nexport const ABOVE_INNER_LEFT_ANCHOR: PositionAnchor = {\n x: \"inner-left\",\n y: \"above\",\n};\n\nexport const ABOVE_CENTER_ANCHOR: PositionAnchor = {\n x: \"center\",\n y: \"above\",\n};\n\nexport const ABOVE_INNER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"inner-right\",\n y: \"above\",\n};\n\nexport const ABOVE_RIGHT_ANCHOR: PositionAnchor = {\n x: \"right\",\n y: \"above\",\n};\n\nexport const TOP_LEFT_ANCHOR: PositionAnchor = {\n x: \"left\",\n y: \"top\",\n};\n\nexport const TOP_INNER_LEFT_ANCHOR: PositionAnchor = {\n x: \"inner-left\",\n y: \"top\",\n};\n\nexport const TOP_CENTER_ANCHOR: PositionAnchor = {\n x: \"center\",\n y: \"top\",\n};\n\nexport const TOP_INNER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"inner-right\",\n y: \"top\",\n};\n\nexport const TOP_RIGHT_ANCHOR: PositionAnchor = {\n x: \"right\",\n y: \"top\",\n};\n\nexport const CENTER_LEFT_ANCHOR: PositionAnchor = {\n x: \"left\",\n y: \"center\",\n};\n\nexport const CENTER_INNER_LEFT_ANCHOR: PositionAnchor = {\n x: \"inner-left\",\n y: \"center\",\n};\n\nexport const CENTER_CENTER_ANCHOR: PositionAnchor = {\n x: \"center\",\n y: \"center\",\n};\n\nexport const CENTER_INNER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"inner-right\",\n y: \"center\",\n};\n\nexport const CENTER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"right\",\n y: \"center\",\n};\n\nexport const BOTTOM_LEFT_ANCHOR: PositionAnchor = {\n x: \"left\",\n y: \"bottom\",\n};\n\nexport const BOTTOM_INNER_LEFT_ANCHOR: PositionAnchor = {\n x: \"inner-left\",\n y: \"bottom\",\n};\n\nexport const BOTTOM_CENTER_ANCHOR: PositionAnchor = {\n x: \"center\",\n y: \"bottom\",\n};\n\nexport const BOTTOM_INNER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"inner-right\",\n y: \"bottom\",\n};\n\nexport const BOTTOM_RIGHT_ANCHOR: PositionAnchor = {\n x: \"right\",\n y: \"bottom\",\n};\n\nexport const BELOW_LEFT_ANCHOR: PositionAnchor = {\n x: \"left\",\n y: \"below\",\n};\n\nexport const BELOW_INNER_LEFT_ANCHOR: PositionAnchor = {\n x: \"inner-left\",\n y: \"below\",\n};\n\nexport const BELOW_CENTER_ANCHOR: PositionAnchor = {\n x: \"center\",\n y: \"below\",\n};\n\nexport const BELOW_INNER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"inner-right\",\n y: \"below\",\n};\n\nexport const BELOW_RIGHT_ANCHOR: PositionAnchor = {\n x: \"right\",\n y: \"below\",\n};\n"],"names":["ABOVE_LEFT_ANCHOR","x","y","ABOVE_INNER_LEFT_ANCHOR","ABOVE_CENTER_ANCHOR","ABOVE_INNER_RIGHT_ANCHOR","ABOVE_RIGHT_ANCHOR","TOP_LEFT_ANCHOR","TOP_INNER_LEFT_ANCHOR","TOP_CENTER_ANCHOR","TOP_INNER_RIGHT_ANCHOR","TOP_RIGHT_ANCHOR","CENTER_LEFT_ANCHOR","CENTER_INNER_LEFT_ANCHOR","CENTER_CENTER_ANCHOR","CENTER_INNER_RIGHT_ANCHOR","CENTER_RIGHT_ANCHOR","BOTTOM_LEFT_ANCHOR","BOTTOM_INNER_LEFT_ANCHOR","BOTTOM_CENTER_ANCHOR","BOTTOM_INNER_RIGHT_ANCHOR","BOTTOM_RIGHT_ANCHOR","BELOW_LEFT_ANCHOR","BELOW_INNER_LEFT_ANCHOR","BELOW_CENTER_ANCHOR","BELOW_INNER_RIGHT_ANCHOR","BELOW_RIGHT_ANCHOR"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,MAAMA,oBAAoC;IAC/CC,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMC,0BAA0C;IACrDF,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAME,sBAAsC;IACjDH,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMG,2BAA2C;IACtDJ,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMI,qBAAqC;IAChDL,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMK,kBAAkC;IAC7CN,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMM,wBAAwC;IACnDP,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMO,oBAAoC;IAC/CR,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMQ,yBAAyC;IACpDT,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMS,mBAAmC;IAC9CV,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMU,qBAAqC;IAChDX,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMW,2BAA2C;IACtDZ,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMY,uBAAuC;IAClDb,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMa,4BAA4C;IACvDd,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMc,sBAAsC;IACjDf,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMe,qBAAqC;IAChDhB,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMgB,2BAA2C;IACtDjB,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMiB,uBAAuC;IAClDlB,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMkB,4BAA4C;IACvDnB,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMmB,sBAAsC;IACjDpB,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMoB,oBAAoC;IAC/CrB,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMqB,0BAA0C;IACrDtB,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMsB,sBAAsC;IACjDvB,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMuB,2BAA2C;IACtDxB,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMwB,qBAAqC;IAChDzB,GAAG;IACHC,GAAG;AACL,EAAE"}
1
+ {"version":3,"sources":["../../src/positioning/constants.ts"],"sourcesContent":["import { type PositionAnchor } from \"./types.js\";\n\nexport const ABOVE_LEFT_ANCHOR: PositionAnchor = {\n x: \"left\",\n y: \"above\",\n};\n\nexport const ABOVE_INNER_LEFT_ANCHOR: PositionAnchor = {\n x: \"inner-left\",\n y: \"above\",\n};\n\nexport const ABOVE_CENTER_ANCHOR: PositionAnchor = {\n x: \"center\",\n y: \"above\",\n};\n\nexport const ABOVE_INNER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"inner-right\",\n y: \"above\",\n};\n\nexport const ABOVE_RIGHT_ANCHOR: PositionAnchor = {\n x: \"right\",\n y: \"above\",\n};\n\nexport const TOP_LEFT_ANCHOR: PositionAnchor = {\n x: \"left\",\n y: \"top\",\n};\n\nexport const TOP_INNER_LEFT_ANCHOR: PositionAnchor = {\n x: \"inner-left\",\n y: \"top\",\n};\n\nexport const TOP_CENTER_ANCHOR: PositionAnchor = {\n x: \"center\",\n y: \"top\",\n};\n\nexport const TOP_INNER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"inner-right\",\n y: \"top\",\n};\n\nexport const TOP_RIGHT_ANCHOR: PositionAnchor = {\n x: \"right\",\n y: \"top\",\n};\n\nexport const CENTER_LEFT_ANCHOR: PositionAnchor = {\n x: \"left\",\n y: \"center\",\n};\n\nexport const CENTER_INNER_LEFT_ANCHOR: PositionAnchor = {\n x: \"inner-left\",\n y: \"center\",\n};\n\nexport const CENTER_CENTER_ANCHOR: PositionAnchor = {\n x: \"center\",\n y: \"center\",\n};\n\nexport const CENTER_INNER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"inner-right\",\n y: \"center\",\n};\n\nexport const CENTER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"right\",\n y: \"center\",\n};\n\nexport const BOTTOM_LEFT_ANCHOR: PositionAnchor = {\n x: \"left\",\n y: \"bottom\",\n};\n\nexport const BOTTOM_INNER_LEFT_ANCHOR: PositionAnchor = {\n x: \"inner-left\",\n y: \"bottom\",\n};\n\nexport const BOTTOM_CENTER_ANCHOR: PositionAnchor = {\n x: \"center\",\n y: \"bottom\",\n};\n\nexport const BOTTOM_INNER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"inner-right\",\n y: \"bottom\",\n};\n\nexport const BOTTOM_RIGHT_ANCHOR: PositionAnchor = {\n x: \"right\",\n y: \"bottom\",\n};\n\nexport const BELOW_LEFT_ANCHOR: PositionAnchor = {\n x: \"left\",\n y: \"below\",\n};\n\nexport const BELOW_INNER_LEFT_ANCHOR: PositionAnchor = {\n x: \"inner-left\",\n y: \"below\",\n};\n\nexport const BELOW_CENTER_ANCHOR: PositionAnchor = {\n x: \"center\",\n y: \"below\",\n};\n\nexport const BELOW_INNER_RIGHT_ANCHOR: PositionAnchor = {\n x: \"inner-right\",\n y: \"below\",\n};\n\nexport const BELOW_RIGHT_ANCHOR: PositionAnchor = {\n x: \"right\",\n y: \"below\",\n};\n"],"names":["ABOVE_LEFT_ANCHOR","x","y","ABOVE_INNER_LEFT_ANCHOR","ABOVE_CENTER_ANCHOR","ABOVE_INNER_RIGHT_ANCHOR","ABOVE_RIGHT_ANCHOR","TOP_LEFT_ANCHOR","TOP_INNER_LEFT_ANCHOR","TOP_CENTER_ANCHOR","TOP_INNER_RIGHT_ANCHOR","TOP_RIGHT_ANCHOR","CENTER_LEFT_ANCHOR","CENTER_INNER_LEFT_ANCHOR","CENTER_CENTER_ANCHOR","CENTER_INNER_RIGHT_ANCHOR","CENTER_RIGHT_ANCHOR","BOTTOM_LEFT_ANCHOR","BOTTOM_INNER_LEFT_ANCHOR","BOTTOM_CENTER_ANCHOR","BOTTOM_INNER_RIGHT_ANCHOR","BOTTOM_RIGHT_ANCHOR","BELOW_LEFT_ANCHOR","BELOW_INNER_LEFT_ANCHOR","BELOW_CENTER_ANCHOR","BELOW_INNER_RIGHT_ANCHOR","BELOW_RIGHT_ANCHOR"],"mappings":"AAEA,OAAO,MAAMA,oBAAoC;IAC/CC,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMC,0BAA0C;IACrDF,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAME,sBAAsC;IACjDH,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMG,2BAA2C;IACtDJ,GAAG;IACHC,GAAG;AACL,EAAE;AAEF,OAAO,MAAMI,qBAAqC;IAChDL,GAAG;IACHC,GAAG;AACL,E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;AACL,EAAE;AAEF,OAAO,MAAMwB,qBAAqC;IAChDzB,GAAG;IACHC,GAAG;AACL,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/positioning/createHorizontalPosition.ts"],"sourcesContent":["import { type FixedPositionOptions, type HorizontalPosition } from \"./types.js\";\nimport {\n getCenterXCoord,\n getInnerLeftCoord,\n getInnerRightCoord,\n getLeftCoord,\n getRightCoord,\n type XCoordConfig,\n} from \"./utils.js\";\n\n/**\n * @internal\n */\ninterface XPosition {\n left: number;\n right?: number;\n width?: number;\n minWidth?: number;\n actualX: HorizontalPosition;\n}\n\n/**\n * @internal\n */\nexport interface FixConfig extends XCoordConfig {\n vwMargin: number;\n screenRight: number;\n disableSwapping: boolean;\n}\n\n/**\n * @internal\n */\nexport interface CreateHorizontalPositionOptions\n extends Required<\n Pick<\n FixedPositionOptions,\n \"vwMargin\" | \"xMargin\" | \"width\" | \"disableSwapping\"\n >\n > {\n x: HorizontalPosition;\n vw: number;\n elWidth: number;\n initialX?: number;\n containerRect: DOMRect;\n}\n\n/**\n * Attempts to position the fixed element so that it will appear to the left of\n * the container element but also within the viewport boundaries. When swapping\n * is enabled, it will attempt to swap to the right position if it can't fit\n * within the viewport to the left. If it can't fit in the viewport even after\n * being swapped to the right or swapping is disabled, it will be positioned to\n * the viewport left boundary.\n *\n * @internal\n */\nexport function createAnchoredLeft(config: FixConfig): XPosition {\n const { vwMargin, screenRight, elWidth, disableSwapping } = config;\n\n let left = getLeftCoord(config);\n let actualX: HorizontalPosition = \"left\";\n if (left >= vwMargin) {\n return { actualX, left };\n }\n\n const swappedLeft = getRightCoord(config);\n if (disableSwapping || swappedLeft + elWidth > screenRight) {\n left = vwMargin;\n } else {\n left = swappedLeft;\n actualX = \"right\";\n }\n\n return { actualX, left };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear to the\n * inner-left of the container element but also within the viewport boundaries.\n * When swapping is enabled, it will attempt to swap to the right position if it\n * can't fit within the viewport to the left. If it can't fit in the viewport\n * even after being swapped to the right or swapping is disabled, it will be\n * positioned to the viewport left boundary.\n *\n * @internal\n */\nexport function createAnchoredInnerLeft(config: FixConfig): XPosition {\n const { vwMargin, screenRight, elWidth, disableSwapping } = config;\n\n let left = getInnerLeftCoord(config);\n let actualX: HorizontalPosition = \"inner-left\";\n if (left + elWidth <= screenRight && left >= vwMargin) {\n return { actualX, left };\n }\n\n if (disableSwapping) {\n if (left + elWidth > screenRight) {\n left = screenRight - elWidth;\n } else {\n left = vwMargin;\n }\n\n return { actualX, left };\n }\n\n const swappedLeft = getInnerRightCoord(config);\n if (swappedLeft < vwMargin) {\n left = vwMargin;\n } else if (swappedLeft + elWidth > screenRight) {\n left = screenRight - elWidth;\n actualX = \"inner-right\";\n } else {\n left = swappedLeft;\n actualX = \"inner-right\";\n }\n\n return { actualX, left };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear at the center\n * of the container element but also within the viewport boundaries. If the\n * centered element can't fit within the viewport, it will use the vwMargin\n * value if it overflowed to the left, it'll position to the screen right\n * boundary.\n *\n * @internal\n */\nexport function createAnchoredCenter(config: FixConfig): XPosition {\n const { vwMargin, screenRight, elWidth } = config;\n let left = getCenterXCoord(config);\n if (left < vwMargin) {\n left = vwMargin;\n } else if (left + elWidth > screenRight || left < vwMargin) {\n left = screenRight - elWidth;\n }\n\n return { actualX: \"center\", left };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear to the\n * inner-right of the container element but also within the viewport boundaries.\n * When swapping is enabled, it will attempt to swap to the inner-left position\n * if it can't fit within the viewport to the right. If it can't fit in the\n * viewport even after being swapped to the left or swapping is disabled, it\n * will be positioned to the viewport right boundary.\n *\n * @internal\n */\nexport function createAnchoredInnerRight(config: FixConfig): XPosition {\n const { screenRight, vwMargin, elWidth, disableSwapping } = config;\n\n let left = getInnerRightCoord(config);\n let actualX: HorizontalPosition = \"inner-right\";\n if (left >= vwMargin) {\n return { actualX, left: Math.min(left, screenRight - elWidth) };\n }\n\n const swappedLeft = getInnerLeftCoord(config);\n if (disableSwapping || swappedLeft + elWidth > screenRight) {\n left = vwMargin;\n } else {\n left = Math.max(swappedLeft, vwMargin);\n actualX = \"inner-left\";\n }\n\n return { actualX, left };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear to the right of\n * the container element but also within the viewport boundaries. When swapping\n * is enabled, it will attempt to swap to the left position if it can't fit\n * within the viewport to the right. If it can't fit in the viewport even after\n * being swapped to the left or swapping is disabled, it will be positioned to\n * the viewport right boundary.\n *\n * @internal\n */\nexport function createAnchoredRight(config: FixConfig): XPosition {\n const { screenRight, vwMargin, elWidth, disableSwapping } = config;\n\n let left = getRightCoord(config);\n let actualX: HorizontalPosition = \"right\";\n if (left + elWidth <= screenRight) {\n return { actualX, left };\n }\n\n const swappedLeft = getLeftCoord(config);\n if (disableSwapping || swappedLeft < vwMargin) {\n left = screenRight - elWidth;\n } else {\n left = swappedLeft;\n actualX = \"left\";\n }\n\n return { actualX, left };\n}\n\nexport interface EqualWidthOptions\n extends Pick<\n CreateHorizontalPositionOptions,\n \"x\" | \"elWidth\" | \"xMargin\" | \"vwMargin\" | \"containerRect\" | \"initialX\"\n > {\n screenRight: number;\n isMinWidth: boolean;\n}\n\n/**\n * @internal\n */\nexport function createEqualWidth(options: EqualWidthOptions): XPosition {\n const {\n x,\n elWidth,\n xMargin,\n vwMargin,\n initialX,\n containerRect,\n screenRight,\n isMinWidth,\n } = options;\n\n let left = initialX ?? containerRect.left + xMargin;\n\n let width: number | undefined = containerRect.width - xMargin * 2;\n let minWidth: number | undefined;\n let right: number | undefined;\n if (isMinWidth) {\n minWidth = width;\n // if the fixed element has a width greater than the element it is fixed to,\n // update the width to be the fixed element's width. since the \"min-width\"\n // option is only possible for horizontally centered elements, need to then\n // update the `left` position again.\n if (elWidth > width) {\n left -= (elWidth - width) / 2;\n minWidth = elWidth;\n }\n\n width = undefined;\n const elRight = left + elWidth;\n if (elRight > screenRight) {\n left -= elRight - screenRight;\n right = vwMargin;\n }\n\n left = Math.max(vwMargin, left);\n }\n\n // going to assume that the container element is visible in the DOM and just\n // make the fixed element have the same left and right corners\n return {\n left,\n right,\n width,\n minWidth,\n actualX: x,\n };\n}\n\n/**\n * Creates the horizontal position for a fixed element with the provided\n * options.\n * @internal\n */\nexport function createHorizontalPosition(\n options: CreateHorizontalPositionOptions\n): XPosition {\n const {\n x,\n vw,\n vwMargin,\n xMargin,\n width,\n elWidth,\n initialX,\n containerRect,\n disableSwapping,\n } = options;\n\n const screenRight = vw - vwMargin;\n if (width === \"min\" || width === \"equal\") {\n return createEqualWidth({\n x,\n vwMargin,\n xMargin,\n elWidth,\n initialX,\n containerRect,\n screenRight,\n isMinWidth: width === \"min\",\n });\n }\n\n if (elWidth > vw - vwMargin * 2) {\n // if the element's width is greater than the viewport's width minus the\n // margin on both sides, just make the element span the entire viewport with\n // the margin\n return {\n left: vwMargin,\n right: vwMargin,\n actualX: x,\n };\n }\n\n const config: FixConfig = {\n vwMargin,\n xMargin,\n elWidth,\n initialX,\n screenRight,\n containerRect,\n disableSwapping,\n };\n\n switch (x) {\n case \"left\":\n return createAnchoredLeft(config);\n case \"inner-left\":\n return createAnchoredInnerLeft(config);\n case \"center\":\n return createAnchoredCenter(config);\n case \"inner-right\":\n return createAnchoredInnerRight(config);\n case \"right\":\n return createAnchoredRight(config);\n }\n}\n"],"names":["getCenterXCoord","getInnerLeftCoord","getInnerRightCoord","getLeftCoord","getRightCoord","createAnchoredLeft","config","vwMargin","screenRight","elWidth","disableSwapping","left","actualX","swappedLeft","createAnchoredInnerLeft","createAnchoredCenter","createAnchoredInnerRight","Math","min","max","createAnchoredRight","createEqualWidth","options","x","xMargin","initialX","containerRect","isMinWidth","width","minWidth","right","undefined","elRight","createHorizontalPosition","vw"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;QACxE,4EAA4E;QAC5E,aAAa;QACb,OAAO;YACLI,MAAMJ;YACNuB,OAAOvB;YACPK,SAASW;QACX;IACF;IAEA,MAAMjB,SAAoB;QACxBC;QACAiB;QACAf;QACAgB;QACAjB;QACAkB;QACAhB;IACF;IAEA,OAAQa;QACN,KAAK;YACH,OAAOlB,mBAAmBC;QAC5B,KAAK;YACH,OAAOQ,wBAAwBR;QACjC,KAAK;YACH,OAAOS,qBAAqBT;QAC9B,KAAK;YACH,OAAOU,yBAAyBV;QAClC,KAAK;YACH,OAAOc,oBAAoBd;IAC/B;AACF"}
1
+ {"version":3,"sources":["../../src/positioning/createHorizontalPosition.ts"],"sourcesContent":["import { type FixedPositionOptions, type HorizontalPosition } from \"./types.js\";\nimport {\n getCenterXCoord,\n getInnerLeftCoord,\n getInnerRightCoord,\n getLeftCoord,\n getRightCoord,\n type XCoordConfig,\n} from \"./utils.js\";\n\n/**\n * @internal\n */\ninterface XPosition {\n left: number;\n right?: number;\n width?: number;\n minWidth?: number;\n actualX: HorizontalPosition;\n}\n\n/**\n * @internal\n */\nexport interface FixConfig extends XCoordConfig {\n vwMargin: number;\n screenRight: number;\n disableSwapping: boolean;\n}\n\n/**\n * @internal\n */\nexport interface CreateHorizontalPositionOptions\n extends Required<\n Pick<\n FixedPositionOptions,\n \"vwMargin\" | \"xMargin\" | \"width\" | \"disableSwapping\"\n >\n > {\n x: HorizontalPosition;\n vw: number;\n elWidth: number;\n initialX?: number;\n containerRect: DOMRect;\n}\n\n/**\n * Attempts to position the fixed element so that it will appear to the left of\n * the container element but also within the viewport boundaries. When swapping\n * is enabled, it will attempt to swap to the right position if it can't fit\n * within the viewport to the left. If it can't fit in the viewport even after\n * being swapped to the right or swapping is disabled, it will be positioned to\n * the viewport left boundary.\n *\n * @internal\n */\nexport function createAnchoredLeft(config: FixConfig): XPosition {\n const { vwMargin, screenRight, elWidth, disableSwapping } = config;\n\n let left = getLeftCoord(config);\n let actualX: HorizontalPosition = \"left\";\n if (left >= vwMargin) {\n return { actualX, left };\n }\n\n const swappedLeft = getRightCoord(config);\n if (disableSwapping || swappedLeft + elWidth > screenRight) {\n left = vwMargin;\n } else {\n left = swappedLeft;\n actualX = \"right\";\n }\n\n return { actualX, left };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear to the\n * inner-left of the container element but also within the viewport boundaries.\n * When swapping is enabled, it will attempt to swap to the right position if it\n * can't fit within the viewport to the left. If it can't fit in the viewport\n * even after being swapped to the right or swapping is disabled, it will be\n * positioned to the viewport left boundary.\n *\n * @internal\n */\nexport function createAnchoredInnerLeft(config: FixConfig): XPosition {\n const { vwMargin, screenRight, elWidth, disableSwapping } = config;\n\n let left = getInnerLeftCoord(config);\n let actualX: HorizontalPosition = \"inner-left\";\n if (left + elWidth <= screenRight && left >= vwMargin) {\n return { actualX, left };\n }\n\n if (disableSwapping) {\n if (left + elWidth > screenRight) {\n left = screenRight - elWidth;\n } else {\n left = vwMargin;\n }\n\n return { actualX, left };\n }\n\n const swappedLeft = getInnerRightCoord(config);\n if (swappedLeft < vwMargin) {\n left = vwMargin;\n } else if (swappedLeft + elWidth > screenRight) {\n left = screenRight - elWidth;\n actualX = \"inner-right\";\n } else {\n left = swappedLeft;\n actualX = \"inner-right\";\n }\n\n return { actualX, left };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear at the center\n * of the container element but also within the viewport boundaries. If the\n * centered element can't fit within the viewport, it will use the vwMargin\n * value if it overflowed to the left, it'll position to the screen right\n * boundary.\n *\n * @internal\n */\nexport function createAnchoredCenter(config: FixConfig): XPosition {\n const { vwMargin, screenRight, elWidth } = config;\n let left = getCenterXCoord(config);\n if (left < vwMargin) {\n left = vwMargin;\n } else if (left + elWidth > screenRight || left < vwMargin) {\n left = screenRight - elWidth;\n }\n\n return { actualX: \"center\", left };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear to the\n * inner-right of the container element but also within the viewport boundaries.\n * When swapping is enabled, it will attempt to swap to the inner-left position\n * if it can't fit within the viewport to the right. If it can't fit in the\n * viewport even after being swapped to the left or swapping is disabled, it\n * will be positioned to the viewport right boundary.\n *\n * @internal\n */\nexport function createAnchoredInnerRight(config: FixConfig): XPosition {\n const { screenRight, vwMargin, elWidth, disableSwapping } = config;\n\n let left = getInnerRightCoord(config);\n let actualX: HorizontalPosition = \"inner-right\";\n if (left >= vwMargin) {\n return { actualX, left: Math.min(left, screenRight - elWidth) };\n }\n\n const swappedLeft = getInnerLeftCoord(config);\n if (disableSwapping || swappedLeft + elWidth > screenRight) {\n left = vwMargin;\n } else {\n left = Math.max(swappedLeft, vwMargin);\n actualX = \"inner-left\";\n }\n\n return { actualX, left };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear to the right of\n * the container element but also within the viewport boundaries. When swapping\n * is enabled, it will attempt to swap to the left position if it can't fit\n * within the viewport to the right. If it can't fit in the viewport even after\n * being swapped to the left or swapping is disabled, it will be positioned to\n * the viewport right boundary.\n *\n * @internal\n */\nexport function createAnchoredRight(config: FixConfig): XPosition {\n const { screenRight, vwMargin, elWidth, disableSwapping } = config;\n\n let left = getRightCoord(config);\n let actualX: HorizontalPosition = \"right\";\n if (left + elWidth <= screenRight) {\n return { actualX, left };\n }\n\n const swappedLeft = getLeftCoord(config);\n if (disableSwapping || swappedLeft < vwMargin) {\n left = screenRight - elWidth;\n } else {\n left = swappedLeft;\n actualX = \"left\";\n }\n\n return { actualX, left };\n}\n\nexport interface EqualWidthOptions\n extends Pick<\n CreateHorizontalPositionOptions,\n \"x\" | \"elWidth\" | \"xMargin\" | \"vwMargin\" | \"containerRect\" | \"initialX\"\n > {\n screenRight: number;\n isMinWidth: boolean;\n}\n\n/**\n * @internal\n */\nexport function createEqualWidth(options: EqualWidthOptions): XPosition {\n const {\n x,\n elWidth,\n xMargin,\n vwMargin,\n initialX,\n containerRect,\n screenRight,\n isMinWidth,\n } = options;\n\n let left = initialX ?? containerRect.left + xMargin;\n\n let width: number | undefined = containerRect.width - xMargin * 2;\n let minWidth: number | undefined;\n let right: number | undefined;\n if (isMinWidth) {\n minWidth = width;\n // if the fixed element has a width greater than the element it is fixed to,\n // update the width to be the fixed element's width. since the \"min-width\"\n // option is only possible for horizontally centered elements, need to then\n // update the `left` position again.\n if (elWidth > width) {\n left -= (elWidth - width) / 2;\n minWidth = elWidth;\n }\n\n width = undefined;\n const elRight = left + elWidth;\n if (elRight > screenRight) {\n left -= elRight - screenRight;\n right = vwMargin;\n }\n\n left = Math.max(vwMargin, left);\n }\n\n // going to assume that the container element is visible in the DOM and just\n // make the fixed element have the same left and right corners\n return {\n left,\n right,\n width,\n minWidth,\n actualX: x,\n };\n}\n\n/**\n * Creates the horizontal position for a fixed element with the provided\n * options.\n * @internal\n */\nexport function createHorizontalPosition(\n options: CreateHorizontalPositionOptions\n): XPosition {\n const {\n x,\n vw,\n vwMargin,\n xMargin,\n width,\n elWidth,\n initialX,\n containerRect,\n disableSwapping,\n } = options;\n\n const screenRight = vw - vwMargin;\n if (width === \"min\" || width === \"equal\") {\n return createEqualWidth({\n x,\n vwMargin,\n xMargin,\n elWidth,\n initialX,\n containerRect,\n screenRight,\n isMinWidth: width === \"min\",\n });\n }\n\n if (elWidth > vw - vwMargin * 2) {\n // if the element's width is greater than the viewport's width minus the\n // margin on both sides, just make the element span the entire viewport with\n // the margin\n return {\n left: vwMargin,\n right: vwMargin,\n actualX: x,\n };\n }\n\n const config: FixConfig = {\n vwMargin,\n xMargin,\n elWidth,\n initialX,\n screenRight,\n containerRect,\n disableSwapping,\n };\n\n switch (x) {\n case \"left\":\n return createAnchoredLeft(config);\n case \"inner-left\":\n return createAnchoredInnerLeft(config);\n case \"center\":\n return createAnchoredCenter(config);\n case \"inner-right\":\n return createAnchoredInnerRight(config);\n case \"right\":\n return createAnchoredRight(config);\n }\n}\n"],"names":["getCenterXCoord","getInnerLeftCoord","getInnerRightCoord","getLeftCoord","getRightCoord","createAnchoredLeft","config","vwMargin","screenRight","elWidth","disableSwapping","left","actualX","swappedLeft","createAnchoredInnerLeft","createAnchoredCenter","createAnchoredInnerRight","Math","min","max","createAnchoredRight","createEqualWidth","options","x","xMargin","initialX","containerRect","isMinWidth","width","minWidth","right","undefined","elRight","createHorizontalPosition","vw"],"mappings":"AACA,SACEA,eAAe,EACfC,iBAAiB,EACjBC,kBAAkB,EAClBC,YAAY,EACZC,aAAa,QAER,aAAa;AAuCpB;;;;;;;;;CASC,GACD,OAAO,SAASC,mBAAmBC,MAAiB;IAClD,MAAM,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,OAAO,EAAEC,eAAe,EAAE,GAAGJ;IAE5D,IAAIK,OAAOR,aAAaG;IACxB,IAAIM,UAA8B;IAClC,IAAID,QAAQJ,UAAU;QACpB,OAAO;YAAEK;YAASD;QAAK;IACzB;IAEA,MAAME,cAAcT,cAAcE;IAClC,IAAII,mBAAmBG,cAAcJ,UAAUD,aAAa;QAC1DG,OAAOJ;IACT,OAAO;QACLI,OAAOE;QACPD,UAAU;IACZ;IAEA,OAAO;QAAEA;QAASD;IAAK;AACzB;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASG,wBAAwBR,MAAiB;IACvD,MAAM,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,OAAO,EAAEC,eAAe,EAAE,GAAGJ;IAE5D,IAAIK,OAAOV,kBAAkBK;IAC7B,IAAIM,UAA8B;IAClC,IAAID,OAAOF,WAAWD,eAAeG,QAAQJ,UAAU;QACrD,OAAO;YAAEK;YAASD;QAAK;IACzB;IAEA,IAAID,iBAAiB;QACnB,IAAIC,OAAOF,UAAUD,aAAa;YAChCG,OAAOH,cAAcC;QACvB,OAAO;YACLE,OAAOJ;QACT;QAEA,OAAO;YAAEK;YAASD;QAAK;IACzB;IAEA,MAAME,cAAcX,mBAAmBI;IACvC,IAAIO,cAAcN,UAAU;QAC1BI,OAAOJ;IACT,OAAO,IAAIM,cAAcJ,UAAUD,aAAa;QAC9CG,OAAOH,cAAcC;QACrBG,UAAU;IACZ,OAAO;QACLD,OAAOE;QACPD,UAAU;IACZ;I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,OAAO;YACLI,MAAMJ;YACNuB,OAAOvB;YACPK,SAASW;QACX;IACF;IAEA,MAAMjB,SAAoB;QACxBC;QACAiB;QACAf;QACAgB;QACAjB;QACAkB;QACAhB;IACF;IAEA,OAAQa;QACN,KAAK;YACH,OAAOlB,mBAAmBC;QAC5B,KAAK;YACH,OAAOQ,wBAAwBR;QACjC,KAAK;YACH,OAAOS,qBAAqBT;QAC9B,KAAK;YACH,OAAOU,yBAAyBV;QAClC,KAAK;YACH,OAAOc,oBAAoBd;IAC/B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/positioning/createVerticalPosition.ts"],"sourcesContent":["import { type FixedPositionOptions, type VerticalPosition } from \"./types.js\";\nimport {\n getAboveCoord,\n getBelowCoord,\n getBottomCoord,\n getCenterYCoord,\n getTopCoord,\n type YCoordConfig,\n} from \"./utils.js\";\n\n/** @internal */\ninterface YPosition {\n top: number;\n bottom?: number;\n actualY: VerticalPosition;\n /** @since 5.1.6 */\n transformOriginY?: number;\n}\n\n/** @internal */\nexport interface FixConfig extends YCoordConfig {\n vhMargin: number;\n screenBottom: number;\n preventOverlap: boolean;\n disableSwapping: boolean;\n disableVHBounds: boolean;\n}\n\n/** @internal */\nexport interface CreateVerticalPositionOptions\n extends Required<\n Pick<\n FixedPositionOptions,\n | \"yMargin\"\n | \"vhMargin\"\n | \"preventOverlap\"\n | \"disableSwapping\"\n | \"disableVHBounds\"\n >\n > {\n y: VerticalPosition;\n vh: number;\n initialY?: number;\n elHeight: number;\n containerRect: DOMRect;\n}\n\n/**\n * Attempts to position the fixed element so that it will appear completely\n * above the container element but also within the viewport boundaries. When\n * swapping is enabled, it will attempt to swap to the below position if it\n * can't fit within the viewport above the container element. If it can't fit in\n * the viewport even after being swapped below or swapping is disabled, it will\n * be positioned to the top viewport boundary.\n *\n * @internal\n */\nexport function createAnchoredAbove(config: FixConfig): YPosition {\n const {\n yMargin,\n vhMargin,\n screenBottom,\n elHeight,\n containerRect,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n } = config;\n let top = getAboveCoord(config);\n let actualY: VerticalPosition = \"above\";\n\n if (disableVHBounds) {\n // can't actually allow a top value as a negative number since browsers\n // won't scroll upwards past the normal page top\n return { actualY, top: Math.max(0, top) };\n }\n\n if (top > vhMargin) {\n // don't need to do anything else since the top is still in the viewport and\n // since it's positioned above, we already know it can't overlap the\n // container element\n return { actualY, top };\n }\n\n const swappedTop = getBelowCoord(config);\n if (disableSwapping || swappedTop + elHeight > screenBottom) {\n top = Math.min(top, vhMargin);\n } else {\n actualY = \"below\";\n top = swappedTop;\n }\n\n let bottom: number | undefined;\n if (\n preventOverlap &&\n // can't overlap if it's positioned below\n actualY === \"above\" &&\n top + elHeight > containerRect.top\n ) {\n bottom = screenBottom - containerRect.top + yMargin;\n }\n\n return { actualY, top, bottom };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear fixed to the\n * top of the container element but also within the viewport boundaries. When\n * swapping is enabled, it will attempt to swap to the bottom position if it\n * can't fit within the viewport. If it can't fit in the viewport even after\n * being swapped to the bottom position or swapping is disabled, it will be\n * positioned to the top viewport boundary.\n *\n * @internal\n */\nexport function createAnchoredTop(config: FixConfig): YPosition {\n const { vhMargin, screenBottom, elHeight, disableSwapping, disableVHBounds } =\n config;\n let top = getTopCoord(config);\n let actualY: VerticalPosition = \"top\";\n\n if (disableVHBounds || top + elHeight <= screenBottom) {\n return { actualY, top };\n }\n\n const swappedTop = getBottomCoord(config);\n if (disableSwapping || swappedTop < vhMargin) {\n top = Math.max(top, vhMargin);\n } else {\n actualY = \"bottom\";\n top = swappedTop;\n }\n\n return { actualY, top };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear at the center\n * of the container element but also within the viewport boundaries. If the\n * entered element can't fit within the viewport, it'll update the top value\n * to either be the vhMargin or position to the screen bottom boundary\n *\n * @internal\n */\nexport function createAnchoredCenter(config: FixConfig): YPosition {\n const { vhMargin, screenBottom, elHeight, disableVHBounds } = config;\n let top = getCenterYCoord(config);\n const actualY: VerticalPosition = \"center\";\n if (disableVHBounds) {\n return { actualY, top: Math.max(0, top) };\n }\n\n top = Math.max(vhMargin, top);\n if (top + elHeight > screenBottom) {\n top = screenBottom - elHeight;\n }\n\n return { actualY, top };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear fixed to the\n * bottom of the container element but also within the viewport boundaries. When\n * swapping is enabled, it will attempt to swap to the top position if it can't\n * fit within the viewport. If it can't fit in the viewport even after being\n * swapped to the top position or swapping is disabled, it will be positioned to\n * the bottom viewport boundary.\n *\n * @internal\n */\nexport function createAnchoredBottom(config: FixConfig): YPosition {\n const { vhMargin, screenBottom, elHeight, disableSwapping, disableVHBounds } =\n config;\n let top = getBottomCoord(config);\n let actualY: VerticalPosition = \"bottom\";\n if (disableVHBounds || top > vhMargin) {\n return { actualY, top };\n }\n\n const swappedTop = getTopCoord(config);\n if (disableSwapping || swappedTop + elHeight > screenBottom) {\n top = Math.min(top, screenBottom - elHeight);\n } else {\n actualY = \"top\";\n top = swappedTop;\n }\n\n return { actualY, top };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear completely\n * below the container element but also within the viewport boundaries. When\n * swapping is enabled, it will attempt to swap to the above position if it\n * can't fit within the viewport below the container element. If it can't fit in\n * the viewport even after being swapped above or swapping is disabled, it will\n * be positioned to the bottom viewport boundary.\n *\n * @internal\n */\nexport function createAnchoredBelow(config: FixConfig): YPosition {\n const {\n yMargin,\n vhMargin,\n elHeight,\n screenBottom,\n containerRect,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n } = config;\n let top = getBelowCoord(config);\n let actualY: VerticalPosition = \"below\";\n if (disableVHBounds || top + elHeight <= screenBottom) {\n return { actualY, top };\n }\n\n if (preventOverlap) {\n const availableTop = containerRect.top - yMargin;\n if (disableSwapping || availableTop < screenBottom - top) {\n return {\n actualY,\n top,\n bottom: vhMargin,\n };\n }\n\n return {\n actualY: \"above\",\n top: Math.max(vhMargin, availableTop - elHeight),\n // this makes it so that the bottom of the fixed element is the top of the container\n // element. this ensures that it won't ever overlap the container element\n bottom: window.innerHeight - availableTop,\n };\n }\n\n const swappedTop = getAboveCoord(config);\n if (disableSwapping || swappedTop < vhMargin) {\n top = Math.min(top, screenBottom - elHeight);\n } else {\n actualY = \"above\";\n top = swappedTop;\n }\n\n return { actualY, top };\n}\n\n/**\n * Creates the vertical position for a fixed element with the provided options.\n *\n * @internal\n */\nexport function createVerticalPosition(\n options: CreateVerticalPositionOptions\n): YPosition {\n const {\n y,\n vh,\n vhMargin,\n yMargin,\n elHeight,\n initialY,\n containerRect,\n disableSwapping,\n preventOverlap,\n disableVHBounds,\n } = options;\n\n if (!disableVHBounds && !preventOverlap && elHeight > vh - vhMargin * 2) {\n // the element is too big to be displayed in the viewport, so just span the\n // full viewport excluding margins\n return {\n top: vhMargin,\n bottom: vhMargin,\n actualY: \"center\",\n transformOriginY: containerRect.top,\n };\n }\n\n const config: FixConfig = {\n vhMargin,\n yMargin,\n elHeight,\n initialY,\n containerRect,\n screenBottom: vh - vhMargin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n };\n\n switch (y) {\n case \"above\":\n return createAnchoredAbove(config);\n case \"top\":\n return createAnchoredTop(config);\n case \"center\":\n return createAnchoredCenter(config);\n case \"bottom\":\n return createAnchoredBottom(config);\n case \"below\":\n return createAnchoredBelow(config);\n }\n}\n"],"names":["getAboveCoord","getBelowCoord","getBottomCoord","getCenterYCoord","getTopCoord","createAnchoredAbove","config","yMargin","vhMargin","screenBottom","elHeight","containerRect","preventOverlap","disableSwapping","disableVHBounds","top","actualY","Math","max","swappedTop","min","bottom","createAnchoredTop","createAnchoredCenter","createAnchoredBottom","createAnchoredBelow","availableTop","window","innerHeight","createVerticalPosition","options","y","vh","initialY","transformOriginY"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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YACH,OAAO1B,oBAAoBC;QAC7B,KAAK;YACH,OAAOgB,kBAAkBhB;QAC3B,KAAK;YACH,OAAOiB,qBAAqBjB;QAC9B,KAAK;YACH,OAAOkB,qBAAqBlB;QAC9B,KAAK;YACH,OAAOmB,oBAAoBnB;IAC/B;AACF"}
1
+ {"version":3,"sources":["../../src/positioning/createVerticalPosition.ts"],"sourcesContent":["import { type FixedPositionOptions, type VerticalPosition } from \"./types.js\";\nimport {\n getAboveCoord,\n getBelowCoord,\n getBottomCoord,\n getCenterYCoord,\n getTopCoord,\n type YCoordConfig,\n} from \"./utils.js\";\n\n/** @internal */\ninterface YPosition {\n top: number;\n bottom?: number;\n actualY: VerticalPosition;\n /** @since 5.1.6 */\n transformOriginY?: number;\n}\n\n/** @internal */\nexport interface FixConfig extends YCoordConfig {\n vhMargin: number;\n screenBottom: number;\n preventOverlap: boolean;\n disableSwapping: boolean;\n disableVHBounds: boolean;\n}\n\n/** @internal */\nexport interface CreateVerticalPositionOptions\n extends Required<\n Pick<\n FixedPositionOptions,\n | \"yMargin\"\n | \"vhMargin\"\n | \"preventOverlap\"\n | \"disableSwapping\"\n | \"disableVHBounds\"\n >\n > {\n y: VerticalPosition;\n vh: number;\n initialY?: number;\n elHeight: number;\n containerRect: DOMRect;\n}\n\n/**\n * Attempts to position the fixed element so that it will appear completely\n * above the container element but also within the viewport boundaries. When\n * swapping is enabled, it will attempt to swap to the below position if it\n * can't fit within the viewport above the container element. If it can't fit in\n * the viewport even after being swapped below or swapping is disabled, it will\n * be positioned to the top viewport boundary.\n *\n * @internal\n */\nexport function createAnchoredAbove(config: FixConfig): YPosition {\n const {\n yMargin,\n vhMargin,\n screenBottom,\n elHeight,\n containerRect,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n } = config;\n let top = getAboveCoord(config);\n let actualY: VerticalPosition = \"above\";\n\n if (disableVHBounds) {\n // can't actually allow a top value as a negative number since browsers\n // won't scroll upwards past the normal page top\n return { actualY, top: Math.max(0, top) };\n }\n\n if (top > vhMargin) {\n // don't need to do anything else since the top is still in the viewport and\n // since it's positioned above, we already know it can't overlap the\n // container element\n return { actualY, top };\n }\n\n const swappedTop = getBelowCoord(config);\n if (disableSwapping || swappedTop + elHeight > screenBottom) {\n top = Math.min(top, vhMargin);\n } else {\n actualY = \"below\";\n top = swappedTop;\n }\n\n let bottom: number | undefined;\n if (\n preventOverlap &&\n // can't overlap if it's positioned below\n actualY === \"above\" &&\n top + elHeight > containerRect.top\n ) {\n bottom = screenBottom - containerRect.top + yMargin;\n }\n\n return { actualY, top, bottom };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear fixed to the\n * top of the container element but also within the viewport boundaries. When\n * swapping is enabled, it will attempt to swap to the bottom position if it\n * can't fit within the viewport. If it can't fit in the viewport even after\n * being swapped to the bottom position or swapping is disabled, it will be\n * positioned to the top viewport boundary.\n *\n * @internal\n */\nexport function createAnchoredTop(config: FixConfig): YPosition {\n const { vhMargin, screenBottom, elHeight, disableSwapping, disableVHBounds } =\n config;\n let top = getTopCoord(config);\n let actualY: VerticalPosition = \"top\";\n\n if (disableVHBounds || top + elHeight <= screenBottom) {\n return { actualY, top };\n }\n\n const swappedTop = getBottomCoord(config);\n if (disableSwapping || swappedTop < vhMargin) {\n top = Math.max(top, vhMargin);\n } else {\n actualY = \"bottom\";\n top = swappedTop;\n }\n\n return { actualY, top };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear at the center\n * of the container element but also within the viewport boundaries. If the\n * entered element can't fit within the viewport, it'll update the top value\n * to either be the vhMargin or position to the screen bottom boundary\n *\n * @internal\n */\nexport function createAnchoredCenter(config: FixConfig): YPosition {\n const { vhMargin, screenBottom, elHeight, disableVHBounds } = config;\n let top = getCenterYCoord(config);\n const actualY: VerticalPosition = \"center\";\n if (disableVHBounds) {\n return { actualY, top: Math.max(0, top) };\n }\n\n top = Math.max(vhMargin, top);\n if (top + elHeight > screenBottom) {\n top = screenBottom - elHeight;\n }\n\n return { actualY, top };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear fixed to the\n * bottom of the container element but also within the viewport boundaries. When\n * swapping is enabled, it will attempt to swap to the top position if it can't\n * fit within the viewport. If it can't fit in the viewport even after being\n * swapped to the top position or swapping is disabled, it will be positioned to\n * the bottom viewport boundary.\n *\n * @internal\n */\nexport function createAnchoredBottom(config: FixConfig): YPosition {\n const { vhMargin, screenBottom, elHeight, disableSwapping, disableVHBounds } =\n config;\n let top = getBottomCoord(config);\n let actualY: VerticalPosition = \"bottom\";\n if (disableVHBounds || top > vhMargin) {\n return { actualY, top };\n }\n\n const swappedTop = getTopCoord(config);\n if (disableSwapping || swappedTop + elHeight > screenBottom) {\n top = Math.min(top, screenBottom - elHeight);\n } else {\n actualY = \"top\";\n top = swappedTop;\n }\n\n return { actualY, top };\n}\n\n/**\n * Attempts to position the fixed element so that it will appear completely\n * below the container element but also within the viewport boundaries. When\n * swapping is enabled, it will attempt to swap to the above position if it\n * can't fit within the viewport below the container element. If it can't fit in\n * the viewport even after being swapped above or swapping is disabled, it will\n * be positioned to the bottom viewport boundary.\n *\n * @internal\n */\nexport function createAnchoredBelow(config: FixConfig): YPosition {\n const {\n yMargin,\n vhMargin,\n elHeight,\n screenBottom,\n containerRect,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n } = config;\n let top = getBelowCoord(config);\n let actualY: VerticalPosition = \"below\";\n if (disableVHBounds || top + elHeight <= screenBottom) {\n return { actualY, top };\n }\n\n if (preventOverlap) {\n const availableTop = containerRect.top - yMargin;\n if (disableSwapping || availableTop < screenBottom - top) {\n return {\n actualY,\n top,\n bottom: vhMargin,\n };\n }\n\n return {\n actualY: \"above\",\n top: Math.max(vhMargin, availableTop - elHeight),\n // this makes it so that the bottom of the fixed element is the top of the container\n // element. this ensures that it won't ever overlap the container element\n bottom: window.innerHeight - availableTop,\n };\n }\n\n const swappedTop = getAboveCoord(config);\n if (disableSwapping || swappedTop < vhMargin) {\n top = Math.min(top, screenBottom - elHeight);\n } else {\n actualY = \"above\";\n top = swappedTop;\n }\n\n return { actualY, top };\n}\n\n/**\n * Creates the vertical position for a fixed element with the provided options.\n *\n * @internal\n */\nexport function createVerticalPosition(\n options: CreateVerticalPositionOptions\n): YPosition {\n const {\n y,\n vh,\n vhMargin,\n yMargin,\n elHeight,\n initialY,\n containerRect,\n disableSwapping,\n preventOverlap,\n disableVHBounds,\n } = options;\n\n if (!disableVHBounds && !preventOverlap && elHeight > vh - vhMargin * 2) {\n // the element is too big to be displayed in the viewport, so just span the\n // full viewport excluding margins\n return {\n top: vhMargin,\n bottom: vhMargin,\n actualY: \"center\",\n transformOriginY: containerRect.top,\n };\n }\n\n const config: FixConfig = {\n vhMargin,\n yMargin,\n elHeight,\n initialY,\n containerRect,\n screenBottom: vh - vhMargin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n };\n\n switch (y) {\n case \"above\":\n return createAnchoredAbove(config);\n case \"top\":\n return createAnchoredTop(config);\n case \"center\":\n return createAnchoredCenter(config);\n case \"bottom\":\n return createAnchoredBottom(config);\n case \"below\":\n return createAnchoredBelow(config);\n }\n}\n"],"names":["getAboveCoord","getBelowCoord","getBottomCoord","getCenterYCoord","getTopCoord","createAnchoredAbove","config","yMargin","vhMargin","screenBottom","elHeight","containerRect","preventOverlap","disableSwapping","disableVHBounds","top","actualY","Math","max","swappedTop","min","bottom","createAnchoredTop","createAnchoredCenter","createAnchoredBottom","createAnchoredBelow","availableTop","window","innerHeight","createVerticalPosition","options","y","vh","initialY","transformOriginY"],"mappings":"AACA,SACEA,aAAa,EACbC,aAAa,EACbC,cAAc,EACdC,eAAe,EACfC,WAAW,QAEN,aAAa;AAuCpB;;;;;;;;;CASC,GACD,OAAO,SAASC,oBAAoBC,MAAiB;IACnD,MAAM,EACJC,OAAO,EACPC,QAAQ,EACRC,YAAY,EACZC,QAAQ,EACRC,aAAa,EACbC,cAAc,EACdC,eAAe,EACfC,eAAe,EAChB,GAAGR;IACJ,IAAIS,MAAMf,cAAcM;IACxB,IAAIU,UAA4B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ACvC,oFAAoF;YACpF,yEAAyE;YACzEW,QAAQM,OAAOC,WAAW,GAAGF;QAC/B;IACF;IAEA,MAAMP,aAAanB,cAAcM;IACjC,IAAIO,mBAAmBM,aAAaX,UAAU;QAC5CO,MAAME,KAAKG,GAAG,CAACL,KAAKN,eAAeC;IACrC,OAAO;QACLM,UAAU;QACVD,MAAMI;IACR;IAEA,OAAO;QAAEH;QAASD;IAAI;AACxB;AAEA;;;;CAIC,GACD,OAAO,SAASc,uBACdC,OAAsC;IAEtC,MAAM,EACJC,CAAC,EACDC,EAAE,EACFxB,QAAQ,EACRD,OAAO,EACPG,QAAQ,EACRuB,QAAQ,EACRtB,aAAa,EACbE,eAAe,EACfD,cAAc,EACdE,eAAe,EAChB,GAAGgB;IAEJ,IAAI,CAAChB,mBAAmB,CAACF,kBAAkBF,WAAWsB,KAAKxB,WAAW,GAAG;QACvE,2EAA2E;QAC3E,kCAAkC;QAClC,OAAO;YACLO,KAAKP;YACLa,QAAQb;YACRQ,SAAS;YACTkB,kBAAkBvB,cAAcI,GAAG;QACrC;IACF;IAEA,MAAMT,SAAoB;QACxBE;QACAD;QACAG;QACAuB;QACAtB;QACAF,cAAcuB,KAAKxB;QACnBI;QACAC;QACAC;IACF;IAEA,OAAQiB;QACN,KAAK;YACH,OAAO1B,oBAAoBC;QAC7B,KAAK;YACH,OAAOgB,kBAAkBhB;QAC3B,KAAK;YACH,OAAOiB,qBAAqBjB;QAC9B,KAAK;YACH,OAAOkB,qBAAqBlB;QAC9B,KAAK;YACH,OAAOmB,oBAAoBnB;IAC/B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/positioning/getFixedPosition.ts"],"sourcesContent":["import { getScrollbarWidth } from \"../scroll/getScrollbarWidth.js\";\nimport { BELOW_CENTER_ANCHOR } from \"./constants.js\";\nimport { createHorizontalPosition } from \"./createHorizontalPosition.js\";\nimport { createVerticalPosition } from \"./createVerticalPosition.js\";\nimport { type FixedPosition, type FixedPositionOptions } from \"./types.js\";\nimport {\n findSizingContainer,\n getElementRect,\n getTransformOrigin,\n} from \"./utils.js\";\n\n/**\n * This is used when there is no `container` element so that some styles can\n * still be created. The main use-case for this is context menus and when the\n * `initialX` and `initialY` options have been provided.\n *\n * @internal\n * @since 5.0.0\n */\nconst FALLBACK_DOM_RECT: DOMRect = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n toJSON() {\n // do nothing\n },\n};\n\n/**\n * One of the most complicated functions in this project that will attempt to\n * position an element relative to another container element while still being\n * visible within the viewport. Below is the logical flow for attempting to fix\n * the element to the container:\n *\n * No Container: If there is no container element, return the provided x and y\n * positions and no styles since there's nothing we can use to calculate the\n * position.\n *\n * No Element: If the container was provided but the element to position does\n * not exist, return an style object containing the `left` and `top` values for\n * the container and apply as many of the positioning options as possible so\n * that the styles are \"as close as possible\" before the fixed element is added\n * to the DOM. This will also return the provided x and y positions since\n * nothing could be swapped around yet.\n *\n * Container and Element: If both the container and fixed element were provided,\n * apply all the positioning options to the `left` and `top` values of the\n * container based on the sizes of both elements.\n *\n * Now that the `left` and `top` values were applied, check to see if the\n * element is fully visible within the viewport with the provided positioning\n * options. If it is fully visible, do nothing else. If it isn't... follow the\n * next flow:\n *\n * First, check the horizontal sizes and make sure that the element is still\n * within the viewport with the provided view width margin. If it isn't, first\n * try to swap only to a `right` style instead of left to see if that fixes it,\n * otherwise keep both the `left` and `right` styles.\n */\nexport function getFixedPosition(options: FixedPositionOptions): FixedPosition {\n const {\n element,\n anchor = BELOW_CENTER_ANCHOR,\n initialX,\n vwMargin = 16,\n vhMargin = 16,\n xMargin = 0,\n yMargin = 0,\n width: widthType = \"auto\",\n preventOverlap = false,\n transformOrigin = false,\n disableSwapping = false,\n disableVHBounds = false,\n } = options;\n let { initialY } = options;\n const container = findSizingContainer(options.container);\n\n if (process.env.NODE_ENV !== \"production\") {\n if (preventOverlap && anchor.y !== \"above\" && anchor.y !== \"below\") {\n throw new Error(\n 'Unable to prevent overlap when the vertical anchor is not `\"above\"` or `\"below\"`'\n );\n }\n }\n\n if (!element) {\n return {\n actualX: anchor.x,\n actualY: anchor.y,\n style: {\n left: initialX,\n top: initialY,\n position: disableVHBounds ? \"absolute\" : \"fixed\",\n transformOrigin: transformOrigin\n ? getTransformOrigin({ x: anchor.x, y: anchor.y })\n : undefined,\n },\n };\n }\n\n const containerRect = container?.getBoundingClientRect() ?? FALLBACK_DOM_RECT;\n const vh = window.innerHeight;\n const vw = window.innerWidth;\n\n const { minWidth: elMinWidth } = element.style;\n // Note: This makes it \"min-content\" or \"min-container-width\"\n if (widthType === \"min\") {\n element.style.overflow = \"visible\";\n element.style.minWidth = \"\";\n }\n const elementRect = getElementRect(element);\n const { height } = elementRect;\n let elWidth = elementRect.width;\n if (widthType === \"min\") {\n elWidth += getScrollbarWidth();\n element.style.overflow = \"\";\n element.style.minWidth = elMinWidth;\n }\n if (disableVHBounds) {\n const dialog = element.closest(\"[role='dialog']\");\n if (!dialog) {\n initialY = (initialY ?? 0) + window.scrollY;\n }\n }\n\n const { left, right, width, minWidth, actualX } = createHorizontalPosition({\n x: anchor.x,\n vw,\n vwMargin,\n xMargin,\n width: widthType,\n elWidth,\n initialX,\n containerRect,\n disableSwapping,\n });\n const { top, bottom, actualY, transformOriginY } = createVerticalPosition({\n y: anchor.y,\n vh,\n vhMargin,\n yMargin,\n initialY,\n elHeight: height,\n containerRect,\n disableSwapping,\n preventOverlap,\n disableVHBounds,\n });\n\n return {\n actualX,\n actualY,\n style: {\n left,\n top,\n right,\n bottom,\n width,\n minWidth,\n position: disableVHBounds ? \"absolute\" : \"fixed\",\n transformOrigin: transformOrigin\n ? getTransformOrigin({\n x: actualX,\n y: actualY,\n transformOriginY,\n })\n : undefined,\n },\n };\n}\n"],"names":["getScrollbarWidth","BELOW_CENTER_ANCHOR","createHorizontalPosition","createVerticalPosition","findSizingContainer","getElementRect","getTransformOrigin","FALLBACK_DOM_RECT","x","y","height","width","left","right","top","bottom","toJSON","getFixedPosition","options","element","anchor","initialX","vwMargin","vhMargin","xMargin","yMargin","widthType","preventOverlap","transformOrigin","disableSwapping","disableVHBounds","initialY","container","process","env","NODE_ENV","Error","actualX","actualY","style","position","undefined","containerRect","getBoundingClientRect","vh","window","innerHeight","vw","innerWidth","minWidth","elMinWidth","overflow","elementRect","elWidth","dialog","closest","scrollY","transformOriginY","elHeight"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,iBAAiB,QAAQ,iCAAiC;AACnE,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SAASC,wBAAwB,QAAQ,gCAAgC;AACzE,SAASC,sBAAsB,QAAQ,8BAA8B;AAErE,SACEC,mBAAmB,EACnBC,cAAc,EACdC,kBAAkB,QACb,aAAa;AAEpB;;;;;;;CAOC,GACD,MAAMC,oBAA6B;IACjCC,GAAG;IACHC,GAAG;IACHC,QAAQ;IACRC,OAAO;IACPC,MAAM;IACNC,OAAO;IACPC,KAAK;IACLC,QAAQ;IACRC;IACE,aAAa;IACf;AACF;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BC,GACD,OAAO,SAASC,iBAAiBC,OAA6B;IAC5D,MAAM,EACJC,OAAO,EACPC,SAASnB,mBAAmB,EAC5BoB,QAAQ,EACRC,WAAW,EAAE,EACbC,WAAW,EAAE,EACbC,UAAU,CAAC,EACXC,UAAU,CAAC,EACXd,OAAOe,YAAY,MAAM,EACzBC,iBAAiB,KAAK,EACtBC,kBAAkB,KAAK,EACvBC,kBAAkB,KAAK,EACvBC,kBAAkB,KAAK,EACxB,GAAGZ;IACJ,IAAI,EAAEa,QAAQ,EAAE,GAAGb;IACnB,MAAMc,YAAY5B,oBAAoBc,QAAQc,SAA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,EAAEZ,OAAO,EAAE,GAAGnC,yBAAyB;QACzEM,GAAGY,OAAOZ,CAAC;QACXuC;QACAzB;QACAE;QACAb,OAAOe;QACP2B;QACAhC;QACAqB;QACAb;IACF;IACA,MAAM,EAAEf,GAAG,EAAEC,MAAM,EAAEuB,OAAO,EAAEmB,gBAAgB,EAAE,GAAGtD,uBAAuB;QACxEM,GAAGW,OAAOX,CAAC;QACXmC;QACArB;QACAE;QACAM;QACA2B,UAAUhD;QACVgC;QACAb;QACAF;QACAG;IACF;IAEA,OAAO;QACLO;QACAC;QACAC,OAAO;YACL3B;YACAE;YACAD;YACAE;YACAJ;YACAsC;YACAT,UAAUV,kBAAkB,aAAa;YACzCF,iBAAiBA,kBACbtB,mBAAmB;gBACjBE,GAAG6B;gBACH5B,GAAG6B;gBACHmB;YACF,KACAhB;QACN;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/positioning/getFixedPosition.ts"],"sourcesContent":["import { getScrollbarWidth } from \"../scroll/getScrollbarWidth.js\";\nimport { BELOW_CENTER_ANCHOR } from \"./constants.js\";\nimport { createHorizontalPosition } from \"./createHorizontalPosition.js\";\nimport { createVerticalPosition } from \"./createVerticalPosition.js\";\nimport { type FixedPosition, type FixedPositionOptions } from \"./types.js\";\nimport {\n findSizingContainer,\n getElementRect,\n getTransformOrigin,\n} from \"./utils.js\";\n\n/**\n * This is used when there is no `container` element so that some styles can\n * still be created. The main use-case for this is context menus and when the\n * `initialX` and `initialY` options have been provided.\n *\n * @internal\n * @since 5.0.0\n */\nconst FALLBACK_DOM_RECT: DOMRect = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n toJSON() {\n // do nothing\n },\n};\n\n/**\n * One of the most complicated functions in this project that will attempt to\n * position an element relative to another container element while still being\n * visible within the viewport. Below is the logical flow for attempting to fix\n * the element to the container:\n *\n * No Container: If there is no container element, return the provided x and y\n * positions and no styles since there's nothing we can use to calculate the\n * position.\n *\n * No Element: If the container was provided but the element to position does\n * not exist, return an style object containing the `left` and `top` values for\n * the container and apply as many of the positioning options as possible so\n * that the styles are \"as close as possible\" before the fixed element is added\n * to the DOM. This will also return the provided x and y positions since\n * nothing could be swapped around yet.\n *\n * Container and Element: If both the container and fixed element were provided,\n * apply all the positioning options to the `left` and `top` values of the\n * container based on the sizes of both elements.\n *\n * Now that the `left` and `top` values were applied, check to see if the\n * element is fully visible within the viewport with the provided positioning\n * options. If it is fully visible, do nothing else. If it isn't... follow the\n * next flow:\n *\n * First, check the horizontal sizes and make sure that the element is still\n * within the viewport with the provided view width margin. If it isn't, first\n * try to swap only to a `right` style instead of left to see if that fixes it,\n * otherwise keep both the `left` and `right` styles.\n */\nexport function getFixedPosition(options: FixedPositionOptions): FixedPosition {\n const {\n element,\n anchor = BELOW_CENTER_ANCHOR,\n initialX,\n vwMargin = 16,\n vhMargin = 16,\n xMargin = 0,\n yMargin = 0,\n width: widthType = \"auto\",\n preventOverlap = false,\n transformOrigin = false,\n disableSwapping = false,\n disableVHBounds = false,\n } = options;\n let { initialY } = options;\n const container = findSizingContainer(options.container);\n\n if (process.env.NODE_ENV !== \"production\") {\n if (preventOverlap && anchor.y !== \"above\" && anchor.y !== \"below\") {\n throw new Error(\n 'Unable to prevent overlap when the vertical anchor is not `\"above\"` or `\"below\"`'\n );\n }\n }\n\n if (!element) {\n return {\n actualX: anchor.x,\n actualY: anchor.y,\n style: {\n left: initialX,\n top: initialY,\n position: disableVHBounds ? \"absolute\" : \"fixed\",\n transformOrigin: transformOrigin\n ? getTransformOrigin({ x: anchor.x, y: anchor.y })\n : undefined,\n },\n };\n }\n\n const containerRect = container?.getBoundingClientRect() ?? FALLBACK_DOM_RECT;\n const vh = window.innerHeight;\n const vw = window.innerWidth;\n\n const { minWidth: elMinWidth } = element.style;\n // Note: This makes it \"min-content\" or \"min-container-width\"\n if (widthType === \"min\") {\n element.style.overflow = \"visible\";\n element.style.minWidth = \"\";\n }\n const elementRect = getElementRect(element);\n const { height } = elementRect;\n let elWidth = elementRect.width;\n if (widthType === \"min\") {\n elWidth += getScrollbarWidth();\n element.style.overflow = \"\";\n element.style.minWidth = elMinWidth;\n }\n if (disableVHBounds) {\n const dialog = element.closest(\"[role='dialog']\");\n if (!dialog) {\n initialY = (initialY ?? 0) + window.scrollY;\n }\n }\n\n const { left, right, width, minWidth, actualX } = createHorizontalPosition({\n x: anchor.x,\n vw,\n vwMargin,\n xMargin,\n width: widthType,\n elWidth,\n initialX,\n containerRect,\n disableSwapping,\n });\n const { top, bottom, actualY, transformOriginY } = createVerticalPosition({\n y: anchor.y,\n vh,\n vhMargin,\n yMargin,\n initialY,\n elHeight: height,\n containerRect,\n disableSwapping,\n preventOverlap,\n disableVHBounds,\n });\n\n return {\n actualX,\n actualY,\n style: {\n left,\n top,\n right,\n bottom,\n width,\n minWidth,\n position: disableVHBounds ? \"absolute\" : \"fixed\",\n transformOrigin: transformOrigin\n ? getTransformOrigin({\n x: actualX,\n y: actualY,\n transformOriginY,\n })\n : undefined,\n },\n };\n}\n"],"names":["getScrollbarWidth","BELOW_CENTER_ANCHOR","createHorizontalPosition","createVerticalPosition","findSizingContainer","getElementRect","getTransformOrigin","FALLBACK_DOM_RECT","x","y","height","width","left","right","top","bottom","toJSON","getFixedPosition","options","element","anchor","initialX","vwMargin","vhMargin","xMargin","yMargin","widthType","preventOverlap","transformOrigin","disableSwapping","disableVHBounds","initialY","container","process","env","NODE_ENV","Error","actualX","actualY","style","position","undefined","containerRect","getBoundingClientRect","vh","window","innerHeight","vw","innerWidth","minWidth","elMinWidth","overflow","elementRect","elWidth","dialog","closest","scrollY","transformOriginY","elHeight"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,iCAAiC;AACnE,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SAASC,wBAAwB,QAAQ,gCAAgC;AACzE,SAASC,sBAAsB,QAAQ,8BAA8B;AAErE,SACEC,mBAAmB,EACnBC,cAAc,EACdC,kBAAkB,QACb,aAAa;AA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C,6DAA6D;IAC7D,IAAIb,cAAc,OAAO;QACvBP,QAAQoB,KAAK,CAACY,QAAQ,GAAG;QACzBhC,QAAQoB,KAAK,CAACU,QAAQ,GAAG;IAC3B;IACA,MAAMG,cAAc/C,eAAec;IACnC,MAAM,EAAET,MAAM,EAAE,GAAG0C;IACnB,IAAIC,UAAUD,YAAYzC,KAAK;IAC/B,IAAIe,cAAc,OAAO;QACvB2B,WAAWrD;QACXmB,QAAQoB,KAAK,CAACY,QAAQ,GAAG;QACzBhC,QAAQoB,KAAK,CAACU,QAAQ,GAAGC;IAC3B;IACA,IAAIpB,iBAAiB;QACnB,MAAMwB,SAASnC,QAAQoC,OAAO,CAAC;QAC/B,IAAI,CAACD,QAAQ;YACXvB,WAAW,AAACA,CAAAA,YAAY,CAAA,IAAKc,OAAOW,OAAO;QAC7C;IACF;IAEA,MAAM,EAAE5C,IAAI,EAAEC,KAAK,EAAEF,KAAK,EAAEsC,QAAQ,EAAEZ,OAAO,EAAE,GAAGnC,yBAAyB;QACzEM,GAAGY,OAAOZ,CAAC;QACXuC;QACAzB;QACAE;QACAb,OAAOe;QACP2B;QACAhC;QACAqB;QACAb;IACF;IACA,MAAM,EAAEf,GAAG,EAAEC,MAAM,EAAEuB,OAAO,EAAEmB,gBAAgB,EAAE,GAAGtD,uBAAuB;QACxEM,GAAGW,OAAOX,CAAC;QACXmC;QACArB;QACAE;QACAM;QACA2B,UAAUhD;QACVgC;QACAb;QACAF;QACAG;IACF;IAEA,OAAO;QACLO;QACAC;QACAC,OAAO;YACL3B;YACAE;YACAD;YACAE;YACAJ;YACAsC;YACAT,UAAUV,kBAAkB,aAAa;YACzCF,iBAAiBA,kBACbtB,mBAAmB;gBACjBE,GAAG6B;gBACH5B,GAAG6B;gBACHmB;YACF,KACAhB;QACN;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/positioning/types.ts"],"sourcesContent":["/**\n * Above:\n * - the container top is in-line with the bottom of the element.\n *\n * Below:\n * - the container bottom is in-line with the top of the element\n *\n * Center:\n * - the container center is in-line with the top of the element\n *\n * Top:\n * - the container top is in-line with the top of the element\n *\n * Bottom:\n * - the container bottom is in-line with the bottom of the element\n */\nexport type VerticalPosition = \"above\" | \"below\" | \"center\" | \"top\" | \"bottom\";\n\n/**\n * Left:\n * - the container left is in-line with the right of the element\n *\n * Right:\n * - the container right is in-line with the left of the element\n *\n * Center:\n * - the container's horizontal center point will be aligned with the element's\n * horizontal center point\n *\n * Inner Left:\n * - the container's left is in-line with the left of the element\n *\n * Inner Right:\n * - the container's right is in-line with the right of the element\n */\nexport type HorizontalPosition =\n | \"left\"\n | \"right\"\n | \"center\"\n | \"inner-left\"\n | \"inner-right\";\n\n/**\n * An object containing the x and y positions to anchor a fixed element to\n * another container element.\n */\nexport interface PositionAnchor {\n x: HorizontalPosition;\n y: VerticalPosition;\n}\n\n/**\n * A \"simple\" version of all the positioning options. These are generally used\n * across all of react-md as it'll use the \"center\" version of the opposite type\n * when creating a fixed position.\n */\nexport type SimplePosition = \"above\" | \"below\" | \"left\" | \"right\";\n\n/**\n * An optional configuration for calculating and setting the width of the\n * element relative to the width of the container. When this value is set to\n * `\"auto\"` (default), the width will be based on content width but still\n * ensuring it can fit within the viewport. Setting this to `\"equal\"` will just\n * apply the container's width to the fixed element. Finally, setting this to\n * `\"min\"` will set the container's width as the `minWidth` for the fixed\n * element so that it is at least the same width as the container.\n *\n * If this is set to `\"equal\"` or `\"min\"` and the horizontal anchor is not set\n * to `\"center\"`, an error will be thrown.\n *\n * @defaultValue `\"auto\"`\n */\nexport type PositionWidth = \"auto\" | \"equal\" | \"min\";\n\nexport interface InitialCoords {\n /**\n * The initial x value to use when calculating the position instead of\n * finding the container element to determine the the correct position. All\n * the other positioning logic will still be in effect to ensure the element\n * will be visible within the viewport.\n */\n initialX?: number;\n\n /**\n * The initial y value to use when calculating the position instead of\n * finding the container element to determine the the correct position. All\n * the other positioning logic will still be in effect to ensure the element\n * will be visible within the viewport.\n */\n initialY?: number;\n}\n\n/** @since 4.0.0 */\nexport interface CalculateFixedPositionOptions extends InitialCoords {\n /**\n * The configuration to anchor the fixed element to the container element.\n *\n * @defaultValue `BELOW_CENTER_ANCHOR`\n */\n anchor?: PositionAnchor;\n\n /**\n * The viewwidth margin to apply so that the element doesn't need to be\n * directly on the screen edge.\n *\n * @defaultValue `16`\n */\n vwMargin?: number;\n\n /**\n * The viewwidth margin to apply so that the element doesn't need to be\n * directly on the screen edge.\n *\n * @defaultValue `16`\n */\n vhMargin?: number;\n\n /**\n * The container width margin to apply so that the element doesn't need to be\n * directly on the container's edge.\n *\n * @defaultValue `0`\n */\n xMargin?: number;\n\n /**\n * The container height margin to apply so that the element doesn't need to be\n * directly on the container's edge\n *\n * @defaultValue `0`\n */\n yMargin?: number;\n\n /** {@inheritDoc PositionWidth} */\n width?: PositionWidth;\n\n /**\n * Boolean if the style object should include the `transformOrigin` value\n * based on the x and y positions.\n *\n * @defaultValue `false`\n */\n transformOrigin?: boolean;\n\n /**\n * Boolean if the fixed element should no longer be able to overlap the\n * container element. This is useful for autocomplete menus or other\n * components that retain focus on the container element while the fixed\n * element becomes visible.\n *\n * @defaultValue `false`\n */\n preventOverlap?: boolean;\n\n /**\n * Boolean if the auto-swapping behavior should be disabled. It's normally\n * recommended to not disable this since it'll allow elements to appear off\n * screen.\n *\n * @defaultValue `false`\n * @since 5.0.0 This will always be `true` if the\n * {@link FixedPositionOptions.container} is `null`.\n * @since 5.1.6 Allow this to be `false` while the `container` is\n * null. I can't figure out why I prevented that.\n */\n disableSwapping?: boolean;\n\n /**\n * Boolean if the fixed positioning should no longer prevent the fixed element\n * to be positioned within the viewport. This is nice if you want to allow for\n * full page scrolling instead and manually set a max-height on your element.\n *\n * @defaultValue `false`\n */\n disableVHBounds?: boolean;\n}\n\nexport interface FixedPositionOptions extends CalculateFixedPositionOptions {\n /**\n * The container element that the `element` should be fixed to.\n */\n container: HTMLElement | null;\n\n /**\n * The element that is fixed to a `container` element.\n */\n element: HTMLElement | null;\n}\n\n/**\n * This is more of a private interface that is used to help show how fixed\n * elements are placed within the viewport. Most of the time the `top` and\n * `left` values will be provided, but there are a few flows where the `right`\n * and `bottom` could be added or the `top` and `left` are removed.\n *\n * The `width` values will only be used when the `equalWidth` or `minEqualWidth`\n * options are enabled.\n *\n * @internal\n */\nexport interface Coords {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n width?: number;\n minWidth?: number;\n}\n\n/**\n * The style object that should be applied to the fixed element so it will be\n * fixed to the container element. This will be `undefined` if the container\n * element doesn't exist within the DOM.\n *\n * Note: The fixed element styles **will not** contain styles for `z-index` or\n * `background-color` so you'll need to add that manually.\n *\n * @since 4.0.0\n */\nexport interface FixedPositionStyle extends Coords {\n /**\n * This will be `\"fixed\"` unless\n * {@link CalculateFixedPositionOptions.disableVHBounds} is set to `true`.\n */\n position: \"fixed\" | \"absolute\";\n\n /**\n * This will be `undefined` unless\n * {@link CalculateFixedPositionOptions.transformOrigin} is set to `true`\n */\n transformOrigin?: string;\n}\n\n/**\n * Since the position can be \"swapped\" to help fit the fixed element within the\n * viewport, this interface is used to contain the calculated positions as well\n * as an optional style object to apply.\n */\nexport interface FixedPosition {\n /**\n * The calculated horizontal position that can be used to compare to the\n * provided horizontal position anchor if additional manual updates should be\n * applied.\n */\n actualX: HorizontalPosition;\n\n /**\n * The calculated vertical position that can be used to compare to the\n * provided horizontal position anchor if additional manual updates should be\n * applied.\n */\n actualY: VerticalPosition;\n /** {@inheritDoc FixedPositionStyle} */\n style?: FixedPositionStyle;\n}\n"],"names":[],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GA0ND;;;;CAIC,GACD,WAgBC"}
1
+ {"version":3,"sources":["../../src/positioning/types.ts"],"sourcesContent":["/**\n * Above:\n * - the container top is in-line with the bottom of the element.\n *\n * Below:\n * - the container bottom is in-line with the top of the element\n *\n * Center:\n * - the container center is in-line with the top of the element\n *\n * Top:\n * - the container top is in-line with the top of the element\n *\n * Bottom:\n * - the container bottom is in-line with the bottom of the element\n */\nexport type VerticalPosition = \"above\" | \"below\" | \"center\" | \"top\" | \"bottom\";\n\n/**\n * Left:\n * - the container left is in-line with the right of the element\n *\n * Right:\n * - the container right is in-line with the left of the element\n *\n * Center:\n * - the container's horizontal center point will be aligned with the element's\n * horizontal center point\n *\n * Inner Left:\n * - the container's left is in-line with the left of the element\n *\n * Inner Right:\n * - the container's right is in-line with the right of the element\n */\nexport type HorizontalPosition =\n | \"left\"\n | \"right\"\n | \"center\"\n | \"inner-left\"\n | \"inner-right\";\n\n/**\n * An object containing the x and y positions to anchor a fixed element to\n * another container element.\n */\nexport interface PositionAnchor {\n x: HorizontalPosition;\n y: VerticalPosition;\n}\n\n/**\n * A \"simple\" version of all the positioning options. These are generally used\n * across all of react-md as it'll use the \"center\" version of the opposite type\n * when creating a fixed position.\n */\nexport type SimplePosition = \"above\" | \"below\" | \"left\" | \"right\";\n\n/**\n * An optional configuration for calculating and setting the width of the\n * element relative to the width of the container. When this value is set to\n * `\"auto\"` (default), the width will be based on content width but still\n * ensuring it can fit within the viewport. Setting this to `\"equal\"` will just\n * apply the container's width to the fixed element. Finally, setting this to\n * `\"min\"` will set the container's width as the `minWidth` for the fixed\n * element so that it is at least the same width as the container.\n *\n * If this is set to `\"equal\"` or `\"min\"` and the horizontal anchor is not set\n * to `\"center\"`, an error will be thrown.\n *\n * @defaultValue `\"auto\"`\n */\nexport type PositionWidth = \"auto\" | \"equal\" | \"min\";\n\nexport interface InitialCoords {\n /**\n * The initial x value to use when calculating the position instead of\n * finding the container element to determine the the correct position. All\n * the other positioning logic will still be in effect to ensure the element\n * will be visible within the viewport.\n */\n initialX?: number;\n\n /**\n * The initial y value to use when calculating the position instead of\n * finding the container element to determine the the correct position. All\n * the other positioning logic will still be in effect to ensure the element\n * will be visible within the viewport.\n */\n initialY?: number;\n}\n\n/** @since 4.0.0 */\nexport interface CalculateFixedPositionOptions extends InitialCoords {\n /**\n * The configuration to anchor the fixed element to the container element.\n *\n * @defaultValue `BELOW_CENTER_ANCHOR`\n */\n anchor?: PositionAnchor;\n\n /**\n * The viewwidth margin to apply so that the element doesn't need to be\n * directly on the screen edge.\n *\n * @defaultValue `16`\n */\n vwMargin?: number;\n\n /**\n * The viewwidth margin to apply so that the element doesn't need to be\n * directly on the screen edge.\n *\n * @defaultValue `16`\n */\n vhMargin?: number;\n\n /**\n * The container width margin to apply so that the element doesn't need to be\n * directly on the container's edge.\n *\n * @defaultValue `0`\n */\n xMargin?: number;\n\n /**\n * The container height margin to apply so that the element doesn't need to be\n * directly on the container's edge\n *\n * @defaultValue `0`\n */\n yMargin?: number;\n\n /** {@inheritDoc PositionWidth} */\n width?: PositionWidth;\n\n /**\n * Boolean if the style object should include the `transformOrigin` value\n * based on the x and y positions.\n *\n * @defaultValue `false`\n */\n transformOrigin?: boolean;\n\n /**\n * Boolean if the fixed element should no longer be able to overlap the\n * container element. This is useful for autocomplete menus or other\n * components that retain focus on the container element while the fixed\n * element becomes visible.\n *\n * @defaultValue `false`\n */\n preventOverlap?: boolean;\n\n /**\n * Boolean if the auto-swapping behavior should be disabled. It's normally\n * recommended to not disable this since it'll allow elements to appear off\n * screen.\n *\n * @defaultValue `false`\n * @since 5.0.0 This will always be `true` if the\n * {@link FixedPositionOptions.container} is `null`.\n * @since 5.1.6 Allow this to be `false` while the `container` is\n * null. I can't figure out why I prevented that.\n */\n disableSwapping?: boolean;\n\n /**\n * Boolean if the fixed positioning should no longer prevent the fixed element\n * to be positioned within the viewport. This is nice if you want to allow for\n * full page scrolling instead and manually set a max-height on your element.\n *\n * @defaultValue `false`\n */\n disableVHBounds?: boolean;\n}\n\nexport interface FixedPositionOptions extends CalculateFixedPositionOptions {\n /**\n * The container element that the `element` should be fixed to.\n */\n container: HTMLElement | null;\n\n /**\n * The element that is fixed to a `container` element.\n */\n element: HTMLElement | null;\n}\n\n/**\n * This is more of a private interface that is used to help show how fixed\n * elements are placed within the viewport. Most of the time the `top` and\n * `left` values will be provided, but there are a few flows where the `right`\n * and `bottom` could be added or the `top` and `left` are removed.\n *\n * The `width` values will only be used when the `equalWidth` or `minEqualWidth`\n * options are enabled.\n *\n * @internal\n */\nexport interface Coords {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n width?: number;\n minWidth?: number;\n}\n\n/**\n * The style object that should be applied to the fixed element so it will be\n * fixed to the container element. This will be `undefined` if the container\n * element doesn't exist within the DOM.\n *\n * Note: The fixed element styles **will not** contain styles for `z-index` or\n * `background-color` so you'll need to add that manually.\n *\n * @since 4.0.0\n */\nexport interface FixedPositionStyle extends Coords {\n /**\n * This will be `\"fixed\"` unless\n * {@link CalculateFixedPositionOptions.disableVHBounds} is set to `true`.\n */\n position: \"fixed\" | \"absolute\";\n\n /**\n * This will be `undefined` unless\n * {@link CalculateFixedPositionOptions.transformOrigin} is set to `true`\n */\n transformOrigin?: string;\n}\n\n/**\n * Since the position can be \"swapped\" to help fit the fixed element within the\n * viewport, this interface is used to contain the calculated positions as well\n * as an optional style object to apply.\n */\nexport interface FixedPosition {\n /**\n * The calculated horizontal position that can be used to compare to the\n * provided horizontal position anchor if additional manual updates should be\n * applied.\n */\n actualX: HorizontalPosition;\n\n /**\n * The calculated vertical position that can be used to compare to the\n * provided horizontal position anchor if additional manual updates should be\n * applied.\n */\n actualY: VerticalPosition;\n /** {@inheritDoc FixedPositionStyle} */\n style?: FixedPositionStyle;\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GA0ND;;;;CAIC,GACD,WAgBC"}