UNPKG

@awsui/components-react

Version:

On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en

15 lines 748 B
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { useCallback, useState } from 'react'; import { useResizeObserver } from '@awsui/component-toolkit/internal'; /** * Conditional resize observer for border box height used in charts. */ export function useHeightMeasure(getMeasure, skip = false, deps = []) { const [measuredHeight, setHeight] = useState(0); // eslint-disable-next-line react-hooks/exhaustive-deps const stableGetMeasure = useCallback(getMeasure, [...deps, skip]); useResizeObserver(stableGetMeasure, entry => !skip && setHeight(entry.borderBoxHeight)); return !skip ? measuredHeight : undefined; } //# sourceMappingURL=use-height-measure.js.map