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

raven-dialog

v0.2.0

Published

An Angular dialog box component that makes use of the HTML DIALOG element for improved accessibility.

Downloads

1

Readme

Raven Dialog for Angular

An Angular dialog box component that makes use of the HTML <dialog> element for improved accessibility.

Demo

Features

  • Keyboard/touch accessible
  • Easily styled with CSS variables
  • Use CSS transforms to customize open/close transitions

Installation

Install into your Angular project using NPM.

npm install raven-dialog --save

Import the DialogModule into your module.

import { DialogModule } from 'raven-dialog';

@NgModule({
  imports: [
    DialogModule,
    // ...
  ],
  // ...
})
export class AppModule { }

Usage

Add a <raven-dialog> element to your template, and open or close it by binding a variable to the open attribute.

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `
    <raven-dialog heading="Sample Title"
      [(open)]="isOpen"
      [modal]="true">
      <p>Dialog box content here.</p>
    </raven-dialog>
  `,
  styles: []
})
export class AppComponent {
  isOpen = false;
}

Options

| Option | Type | Description | Default Value | :------ | :------ | :----------------------------------------------------- | :------------ | heading | string | An optional heading to place at the top of the dialog. | "" | open | boolean | Whether the dialog is open or not. | false | modal | boolean | Whether the dialog should be modal or not. | false

Styling

CSS variables are used for styling. Example:

raven-dialog {
  --dialog-border: 2px solid #ccc;
  --dialog-border-radius: 5px;
}

Available CSS Variables

| Variable | Description | Default Value | :---------------------------- | :------------------------------------------- | :------------ | --dialog-margin | Minimum left/right margin of the dialog box. | 2rem | --dialog-padding | Padding around the dialog box content. | 2rem; | --dialog-min-width | Minimum width of the dialog box. | 20rem | --dialog-max-width | Maximum width of the dialog box. | 40rem | --dialog-border | Border around the dialog box. | 0 | --dialog-border-radius | Border radius of dialog box. | .25rem | --dialog-transition-in | Transition when opening dialog box. | transform .2s ease-out, opacity .1s ease-out, box-shadow .2s |ase-out | --dialog-transition-out | Transition when closing dialog box. | transform .2s ease-in, opacity .2s ease-in, box-shadow .2s ease-in | --dialog-transform | Transform property of dialog box. | scale(1) | --dialog-transform-in | Transform property when transitioning in. | scale(.9) | --dialog-transform-out | Transform property when transitioning out. | scale(.9) | --dialog-opacity | Opacity of dialog box. | 1 | --dialog-opacity-in | Dialog opacity when transitioning in. | 0 | --dialog-opacity-out | Dialog opacity when transitioning out. | 0 | --dialog-box-shadow | Box shadow around dialog box. | 0 0 7rem rgba(0, 0, 0, .4) | --dialog-box-shadow-in | Box shadow when transitioning in. | 0 0 0 rgba(0, 0, 0, 0.6) | --dialog-box-shadow-out | Box shadow when transitioning out. | 0 0 0 rgba(0, 0, 0, 0.6) | --dialog-header-padding | Amount of padding in the header. | 1rem 2rem | --dialog-header-color | Text color of the header. | #000 | --dialog-header-background | Background of the header. | #f7f7f7 | --dialog-header-border-bottom | Border under the header. | 1px solid #eee | --dialog-backdrop-background | Background of the modal backdrop. | rgba(0, 0, 0, .2)

Browser Compatibility

Many browsers do not have native support for the <dialog> element and will require a polyfill. Check the Can I Use database for current compatibility.

The dialog-polyfill polyfill is recommended and is supported by raven-dialog. Follow these steps to install it.

  1. cd to your project's root directory.
  2. Run: npm install dialog-polyfill --save
  3. Update your angular.json file to include the style sheet and JavaScript file from the polyfill.
    "styles": [
      "node_modules/dialog-polyfill/dialog-polyfill.css"
    ],
    "scripts": [
      "node_modules/dialog-polyfill/dialog-polyfill.js"
    ],

Development

To contribute to the development of this component, clone this repository and run npm install. Then run ng serve -o to start a development server and to open a sample page in your browser.

License

MIT license.