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

@rent_avail/dialog

v0.2.7

Published

Dialog components

Downloads

807

Readme

import {
  Dialog,
  DialogTarget,
  DialogHeader,
  FullscreenDialog,
  ConfirmationDialog,
} from "@rent_avail/dialog"

This package contains the different types of dialogs used at Avail. All variants need to be wrapped in the <Dialog /> for accessability and performance. Components that open and close the dialog need to be wrapped by the <DialogTarget /> element.

Dialog

Dialog Props

| name | type | description | | ------ | ---------- | -------------------------------------------------------------------------------------------------- | | open | boolean | Controls whether the dialog is visible. | | toggle | function | Handler that is called when the user clicks the close button on the dialog. | | id | string | Identifier for the target node. This will set the proper aria controls and handle keyboard events. |


DialogHeader

This element can be placed in all dialogs to give a consistent header text and close button. You can also implement this functionality yourself.

Props

| name | type | description | | ----- | ------ | ------------------------------------------------------------------------------ | | title | string | If present, adds a title to the fullscreen dialog inline with the close button |

FullscreenDialog

Fullscreen dialogs should be used for complex forms, and whenever we ask the user to create an object that we'll save for them. Common use cases would be requesting an application, adding an addendum to a lease, and editing a rent payment.

Style Props

space, color

Usage

function OpenDialog() {
  const [open, set] = useState(false)
  function handleClick() {
    set((o) => !o)
  }
  return (
    <Dialog open={open} toggle={handleClick} id="confirmation-id">
      <DialogTarget>
        <Button onClick={handleClick}>Open Modal</Button>
      </DialogTarget>
      <FullscreenDialog>
        <Container>
          <DialogHeader title="Application Settings" />
          <Heading as="h4" mb="2rem">
            Updating these settings will not effect in progress applications.
          </Heading>
          <Input label="Hello World" />
        </Container>
      </FullscreenDialog>
    </Dialog>
  )
}

ConfirmationDialog

Confirmation dialogs should be used to confirm the action that the user or the system has just taken.

Style Props

space, color

Usage

function OpenDialog() {
  const [open, set] = useState(false)
  function handleClick() {
    set((o) => !o)
  }
  return (
    <Dialog open={open} toggle={handleClick} id="confirmation-id">
      <DialogTarget>
        <Button onClick={handleClick}>Open Modal</Button>
      </DialogTarget>
      <ConfirmationDialog>
        <DialogHeader title="Are you sure?" />
        <Text>
          This action will delete 43 files. Are you sure you want to continue?
        </Text>
      </ConfirmationDialog>
    </Dialog>
  )
}