0.2.6 • Published 22 days ago

@rent_avail/dialog v0.2.6

Weekly downloads
288
License
MIT
Repository
-
Last release
22 days ago
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

nametypedescription
openbooleanControls whether the dialog is visible.
togglefunctionHandler that is called when the user clicks the close button on the dialog.
idstringIdentifier 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

nametypedescription
titlestringIf 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>
  )
}
0.2.6

22 days ago

0.2.5

29 days ago

0.2.3

8 months ago

0.2.4

6 months ago

0.2.2

1 year ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.23

3 years ago

0.1.22

3 years ago

0.1.20

3 years ago

0.1.21

3 years ago

0.1.19

3 years ago

0.1.18

4 years ago

0.1.17

4 years ago

0.1.16

4 years ago

0.1.15

4 years ago

0.1.14

4 years ago

0.1.13

4 years ago

0.1.11

4 years ago

0.1.12

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.4-alpha.0

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago