2020-07-09 13:30:17 +00:00
|
|
|
import Component from '@ember/component';
|
2020-06-17 13:26:50 +00:00
|
|
|
import Slotted from 'block-slots';
|
2021-03-09 09:30:01 +00:00
|
|
|
import A11yDialog from 'a11y-dialog';
|
2020-07-09 13:30:17 +00:00
|
|
|
|
|
|
|
export default Component.extend(Slotted, {
|
|
|
|
tagName: '',
|
2018-10-19 15:17:02 +00:00
|
|
|
onclose: function() {},
|
|
|
|
onopen: function() {},
|
2020-06-17 13:26:50 +00:00
|
|
|
actions: {
|
2021-03-09 09:30:01 +00:00
|
|
|
connect: function($el) {
|
|
|
|
this.dialog = new A11yDialog($el);
|
|
|
|
this.dialog.on('hide', () => this.onclose({ target: $el }));
|
|
|
|
this.dialog.on('show', () => this.onopen({ target: $el }));
|
2021-12-21 06:40:55 +00:00
|
|
|
if (this.open) {
|
|
|
|
this.dialog.show();
|
|
|
|
}
|
2020-06-17 13:26:50 +00:00
|
|
|
},
|
2021-03-09 09:30:01 +00:00
|
|
|
disconnect: function($el) {
|
|
|
|
this.dialog.destroy();
|
|
|
|
},
|
|
|
|
open: function() {
|
|
|
|
this.dialog.show();
|
2018-10-19 15:17:02 +00:00
|
|
|
},
|
|
|
|
close: function() {
|
2021-03-09 09:30:01 +00:00
|
|
|
this.dialog.hide();
|
|
|
|
},
|
2018-10-19 15:17:02 +00:00
|
|
|
},
|
|
|
|
});
|