Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zestia/ember-modal-dialog

Package Overview
Dependencies
Maintainers
3
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zestia/ember-modal-dialog

A simple modal dialog component for Ember apps

  • 2.2.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
increased by12.88%
Maintainers
3
Weekly downloads
 
Created
Source

@zestia/ember-modal-dialog

This addon provides a simple Modal Dialog component.

Installation

ember install @zestia/ember-modal-dialog

Demo

https://zestia.github.io/ember-modal-dialog/

Features

  • Focus Trap ✔︎
  • Body Scroll Lock ✔︎
  • Class names for animating ✔︎
  • Loading state handling ✔︎
  • Optionally escapable ✔︎
  • Root element notification ✔︎
  • Simple API ✔︎

Notes

  • This addon intentionally does not come with any styles.

Example

The modal dialog component isn't designed to be used on its own, but rather used to compose a new modal dialog component... in this example it's called "my-modal"

// my-modal.js
export default class MyModal extends Component {
  @tracked person;
  @tracked loadingError;

  @action
  loaded(person) {
    this.person = person;
  }

  @action
  failedToLoad(error) {
    this.loadingError = error.message;
  }
}
{{! my-modal.hbs }}
<ModalDialog
  @onClose={{@onClose}}
  @onLoad={{@onFetchPerson}}
  @onLoaded={{this.loaded}}
  @onLoadError={{this.failedToLoad}} as |modal|
>
  <modal.Header>
    Welcome
  </modal.Header>

  <modal.Content>
    {{#if modal.isLoading}}
      Loading person…
    {{else if this.loadingError}}
      Unable to load person because {{this.loadingError}}
    {{else}}
      Hello {{this.person.name}}
    {{/if}}
  </modal.Content>

  <modal.Footer>
    <button {{on "click" modal.close}}>
      Close
    </button>
  </modal.Footer>
</ModalDialog>
// application/route.js
export default class ApplicationRoute extends Route {
  @action
  loadPerson() {
    // Fetch remote data
  }
}
{{! application/route.hbs }}
{{#if this.showMyModal}}
  <MyModal
    @onClose={{this.hideMyModal}}
    @onFetchPerson={{fn this.loadPerson 123}}
  />
{{/if}}

Keywords

FAQs

Package last updated on 01 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc