3.0.0 • Published 1 year ago

ember-micro-modal v3.0.0

Weekly downloads
254
License
MIT
Repository
github
Last release
1 year ago

ember-micro-modal

Ember addon for MicroModal modal library.

Compatibility

  • Ember.js v3.28 or above
  • Ember CLI v3.28 or above
  • Node.js v14 or above

Installation

ember install ember-micro-modal

CSS is not included by default. If you want to apply default styles just include to your app.css like @import 'micro-modal.css' or in scss, less @import 'micro-modal'.

To see default modal html structure.

Usage

You can change all global configuration settings via config/environment.js file.

Please check MicroModal site for more configuration details.

ENV['ember-micro-modal'] = {
  onShow: (modal) => console.info(`${modal.id} is shown`),
  onClose: (modal) => console.info(`${modal.id} is hidden`),
  openTrigger: 'data-custom-open',
  closeTrigger: 'data-custom-close',
  openClass: 'is-open',
  disableScroll: true,
  disableFocus: false,
  awaitOpenAnimation: false,
  awaitCloseAnimation: false,
  debugMode: true,
};

There are also 2 parameters. @show and @clickToOverlay. @show parameter simply responsible to modal visibility. If value is true modal will be visible. @clickToOverlay parameter is responsible to whether modal overlay clickable or not. If value is true overlay click will close the modal.

<MicroModal
  @show={{this.show}}
  @onShow={{fn this.onShow}}
  @onClose={{fn this.onClose}}
  as |modal|
>
  <modal.container class='col-6' as |container|>
    <container.header class='col'>
      <h2 class='modal__title'>
        Micromodal
      </h2>
      <button
        type='button'
        class='modal__close'
        aria-label='Close modal'
        data-micromodal-close
      ></button>
    </container.header>
    <container.content class='col'>
      <p>
        Try hitting the
        <code>
          tab
        </code>
        key and notice how the focus stays within the modal itself. Also,
        <code>
          esc
        </code>
        to close modal.
      </p>
    </container.content>
    <container.footer class='col'>
      <button type='button' class='modal__btn modal__btn-primary'>
        Continue
      </button>
      <button
        type='button'
        class='modal__btn'
        aria-label='Close this dialog window'
        data-micromodal-close
      >
        Close
      </button>
    </container.footer>
  </modal.container>
</MicroModal>
<button type='button' {{on 'click' this.showModal}}>
  Show
</button>

`handlebars

<MicroModal @show={{this.show}} @onShow={{fn this.onShow}} @onClose={{fn this.onClose}} as |modal|> <modal.container class="col-6" as |container|> <container.header class="col">

Contributing

See the [Contributing](CONTRIBUTING.md) guide for details.
I'm sorry that i don't have time to write tests. Please report if you find any issue.

Thanks.


## License

This project is licensed under the [MIT License](LICENSE.md).
3.0.0

1 year ago

2.6.1

1 year ago

2.6.0

2 years ago

2.5.0

2 years ago

2.4.0

2 years ago

2.3.0

2 years ago

2.2.4

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.6

3 years ago

2.1.5

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.44

3 years ago

2.0.43

3 years ago

2.0.37

3 years ago

2.0.38

3 years ago

2.0.39

3 years ago

2.0.42

3 years ago

2.0.40

3 years ago

2.0.41

3 years ago

2.0.35

3 years ago

2.0.36

3 years ago

2.0.33

3 years ago

2.0.34

3 years ago

2.0.31

3 years ago

2.0.32

3 years ago

2.0.30

3 years ago

2.0.29

3 years ago

2.0.28

3 years ago

2.0.27

3 years ago

2.0.26

3 years ago

2.0.25

3 years ago

2.0.24

3 years ago

2.0.22

3 years ago

2.0.23

3 years ago

2.0.20

3 years ago

2.0.21

3 years ago

2.0.19

3 years ago

2.0.18

3 years ago

2.0.17

3 years ago

2.0.16

3 years ago

2.0.15

3 years ago

2.0.14

3 years ago

2.0.13

3 years ago

2.0.11

3 years ago

2.0.12

3 years ago

2.0.9

3 years ago

2.0.10

3 years ago

2.0.8

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

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