@react-aria/utils
Advanced tools
Comparing version 3.0.0-nightly.2840 to 3.0.0-nightly.2843
@@ -167,4 +167,5 @@ import React, { ForwardedRef, MutableRefObject, ReactNode, HTMLAttributes, EffectCallback, RefObject, Dispatch } from "react"; | ||
export function useSyncRef<T>(context?: ContextValue<T> | null, ref?: RefObject<T>): void; | ||
export function isScrollable(node: Element, checkForOverflow?: boolean): boolean; | ||
export function getScrollParent(node: Element, checkForOverflow?: boolean): Element; | ||
export function isScrollable(node: Element, checkForOverflow?: boolean): boolean; | ||
export function getScrollParents(node: Element, checkForOverflow?: boolean): Element[]; | ||
interface ViewportSize { | ||
@@ -171,0 +172,0 @@ width: number; |
{ | ||
"name": "@react-aria/utils", | ||
"version": "3.0.0-nightly.2840+64ed13090", | ||
"version": "3.0.0-nightly.2843+81162ea39", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,5 +25,5 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/ssr": "3.9.3-nightly.4552+64ed13090", | ||
"@react-stately/utils": "3.0.0-nightly.2840+64ed13090", | ||
"@react-types/shared": "3.0.0-nightly.2840+64ed13090", | ||
"@react-aria/ssr": "3.9.3-nightly.4555+81162ea39", | ||
"@react-stately/utils": "3.0.0-nightly.2843+81162ea39", | ||
"@react-types/shared": "3.0.0-nightly.2843+81162ea39", | ||
"@swc/helpers": "^0.5.0", | ||
@@ -38,3 +38,3 @@ "clsx": "^2.0.0" | ||
}, | ||
"gitHead": "64ed13090ce77cc0e4cb4cd5602e75f655bff6bb" | ||
"gitHead": "81162ea392926d06ec3d25c228e6f9b6b5479d59" | ||
} |
@@ -13,2 +13,4 @@ /* | ||
import {isScrollable} from './isScrollable'; | ||
export function getScrollParent(node: Element, checkForOverflow?: boolean): Element { | ||
@@ -27,11 +29,1 @@ let scrollableNode: Element | null = node; | ||
export function isScrollable(node: Element, checkForOverflow?: boolean): boolean { | ||
let style = window.getComputedStyle(node); | ||
let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY); | ||
if (isScrollable && checkForOverflow) { | ||
isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth; | ||
} | ||
return isScrollable; | ||
} |
@@ -30,3 +30,5 @@ /* | ||
export {useSyncRef} from './useSyncRef'; | ||
export {getScrollParent, isScrollable} from './getScrollParent'; | ||
export {getScrollParent} from './getScrollParent'; | ||
export {getScrollParents} from './getScrollParents'; | ||
export {isScrollable} from './isScrollable'; | ||
export {useViewportSize} from './useViewportSize'; | ||
@@ -33,0 +35,0 @@ export {useDescription} from './useDescription'; |
@@ -13,3 +13,3 @@ /* | ||
import {getScrollParent} from './'; | ||
import {getScrollParents} from './getScrollParents'; | ||
@@ -103,8 +103,6 @@ interface ScrollIntoViewportOpts { | ||
} else { | ||
let scrollParent = getScrollParent(targetElement); | ||
let scrollParents = getScrollParents(targetElement); | ||
// If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view. | ||
while (targetElement && scrollParent && targetElement !== root && scrollParent !== root) { | ||
for (let scrollParent of scrollParents) { | ||
scrollIntoView(scrollParent as HTMLElement, targetElement as HTMLElement); | ||
targetElement = scrollParent; | ||
scrollParent = getScrollParent(targetElement); | ||
} | ||
@@ -111,0 +109,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
488807
42
5646