npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@volvo-cars/react-overlay

v2.2.5

Published

A collection of composable primitives used to build design compliant Overlays

Downloads

6,625

Readme

React Overlay

Questions? Ask in Slack #vcc-ui

@volvo-cars/react-overlay

Installation

💡 This package includes Typescript definitions


TitledOverlay

Renders an accessible modal box with a titled header, integrated close button and a scrollable content area. Can be displayed fullscreen or constrained to a grid colSpan. When displayed constrained, a dark semi-opaque background covers the background content.

The TitledOverlay will trap focus on mount and release it on unmount.

<TitledOverlay title="Demo" close={() => null}>
  <>Content</>
</TitledOverlay>

The ref is forwarded to the root element.

| Name | Description | Type | Default Value | | ------------------ | -------------------------------------------------------------------------------------------------- | ----------------- | ------------- | | children | Content to be wrapped | React.ReactNode | undefined | | close | Function to be invoked on click of the close icon in the header | () => void | undefined | | title | Title to be rendered in the modal header | string | undefined | | colSpan | Optional. If empty, modal will render fullscreen | number | undefined | | elementId | Optional. If empty, a unique identifier will be generated for you | string | undefined | | minimisableTitle | Optional. If true, Title will render large and decrease in size on scroll | boolean | false | | navPreviousPane | Optional. If provided, a back arrow will be rendered in the header block | () => void) | undefined | | collapse | Optional. If true, the modal will collapse to content height rather than filling the viewport | boolean | undefined | | zIndex | Optional. Custom zIndex for use in cases of conflict with other absolutely positioned elements | number | undefined |

Overlay

Renders an accessible modal box with a integrated close button and a scrollable content area. Can be displayed fullscreen or constrained to a grid colSpan. When displayed constrained, a dark semi-opaque background covers the background content.

The Overlay will trap focus on mount and release it on unmount.

<Overlay close={() => null}>
  <>Content</>
</Overlay>

The ref is forwarded to the root element.

| Name | Description | Type | Default Value | | ---------- | -------------------------------------------------------------------------------------------------- | ----------------- | ------------- | | children | Content to be wrapped | React.ReactNode | undefined | | close | Function to be invoked on click of the close icon in the header | () => void | undefined | | colSpan | Optional. If empty, modal will render fullscreen | number | undefined | | collapse | Optional. If true, the modal will fit to content height | boolean | undefined | | zIndex | Optional. Custom zIndex for use in cases of conflict with other absolutely positioned elements | number | undefined |

ContentBlock

The TitledOverlay makes no assumptions about the content you wish to render within the modal box. However, we do export a ContentBlock component to wrap your content which will maintain DLS compliance for responsive content width and paddings and this should almost always be used.

<TitledOverlay>
  <ContentBlock>...Your content</ContentBlock>
</TitledOverlay>

| Name | Description | Type | Default Value | | ---------- | --------------------- | ----------------- | ------------- | | children | Content to be wrapped | React.ReactNode | undefined |

Appear

The Appear will render Overlay server side with a prop isOpen for showing or hiding the wrapped Overlay.

<Appear isOpen={false}>
  <Overlay>
    <>Content</>
  </Overlay>
</Appear>

| Name | Description | Type | Default Value | | -------- | -------------------------------------------------------------------------------------------------- | --------- | ------------- | | isOpen | Show or hide the wrapped Overlay | boolean | false | | zIndex | Optional. Custom zIndex for use in cases of conflict with other absolutely positioned elements | number | undefined |

OverlayStacker

The OverlayStacker will automatically put the latest open overlay above all current open overlays.

<OverlayStacker>
  <Overlay>
    <>Overlay content 1</>
  </Overlay>
  <Overlay>
    <>Overlay content 2</>
  </Overlay>
</OverlayStacker>

Examples

Demo implementations can be found in the Storybook