Socket
Socket
Sign inDemoInstall

@zestia/ember-modal-dialog

Package Overview
Dependencies
543
Maintainers
3
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @zestia/ember-modal-dialog

A simple modal dialog component for Ember apps


Version published
Weekly downloads
2.1K
decreased by-12.76%
Maintainers
3
Install size
53.7 MB
Created
Weekly downloads
 

Changelog

Source

4.5.0

  • Run ember-cli-update

Readme

Source

@zestia/ember-modal-dialog

Latest npm release Ember Observer

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 ✔︎
  • Loading state handling ✔︎
  • Optionally escapable ✔︎
  • Exceeds viewport detection ✔︎
  • Animatable (includes test waiters) ✔︎
  • Simple API ✔︎

Notes

  • This addon intentionally does not come with any styles.
  • It is configured with ember-test-waiters so awaiting in your test suite will just work.
  • Does not use native dialog yet, because:
    • Can't animate ::backdrop
    • Can't use ::backdrop with CSS variables
    • Does not provide a focus trap
    • Does not provide a scroll lock

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.hbs }}
<ModalDialog @onClose={{@onClose}} as |modal|>
  Content

  <button {{on 'click' modal.close}}>
    Close
  </button>
</ModalDialog>
{{! application/template.hbs }}
{{#if this.showMyModal}}
  <MyModal @onClose={{this.hideMyModal}} />
{{/if}}

ModalDialog

Arguments

@onReady

Optional. This action receives the API as a parameter, for full control over a modal dialog.

@onLoad

Optional. Fired when a modal is constructed and allows you to return a promise for any data that is required before the modal can display.

@onLoaded

Optional. Fired after the request to load data was successful. Receives the result as a parameter.

@onLoadError

Optional. Fired when the request to load data fails. Receives the error as a parameter.

@onClose

Required. This action fires when close has been called, and any animations have run to hide the modal dialog.

@onEscape

Optional. Fired when escape is pressed or the user clicks outside the dialog box. You can use the API to call close for example.

API

close

Call this when you want to close the modal. It will first wait for any animations on the DOM element, and then @onClose will be fired. Allowing you to physically remove the modal from the DOM.

isLoading

Whether the data required for the modal dialog to display is loading.

element

The DOM element of the modal dialog component.

boxElement

The inner DOM element of the modal dialog component, that contains the content.

Keywords

FAQs

Last updated on 04 Jul 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc