Skip to content

Commit 3cbb96d

Browse files
committed
Build deps
1 parent 4fb1994 commit 3cbb96d

File tree

8 files changed

+74
-12
lines changed

8 files changed

+74
-12
lines changed

dist/js/joomla-alert-es5.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,15 @@ function _getPrototypeOf(o) {
171171

172172
/* Lifecycle, element appended to the DOM */
173173
value: function connectedCallback() {
174-
this.setAttribute('role', 'alertdialog');
175174
this.classList.add('joomla-alert--show'); // Default to info
176175

177176
if (!this.type || ['info', 'warning', 'danger', 'success'].indexOf(this.type) === -1) {
178177
this.setAttribute('type', 'info');
178+
} // Default to alert
179+
180+
181+
if (!this.role || ['alert', 'alertdialog'].indexOf(this.role) === -1) {
182+
this.setAttribute('role', 'alert');
179183
} // Append button
180184

181185

@@ -211,6 +215,13 @@ function _getPrototypeOf(o) {
211215

212216
break;
213217

218+
case 'role':
219+
if (!newValue || newValue && ['alert', 'alertdialog'].indexOf(newValue) === -1) {
220+
this.role = 'alert';
221+
}
222+
223+
break;
224+
214225
case 'dismiss':
215226
case 'acknowledge':
216227
if (!newValue || newValue === 'true') {
@@ -356,6 +367,14 @@ function _getPrototypeOf(o) {
356367
set: function set(value) {
357368
return this.setAttribute('type', value);
358369
}
370+
}, {
371+
key: "role",
372+
get: function get() {
373+
return this.getAttribute('role');
374+
},
375+
set: function set(value) {
376+
return this.setAttribute('role', value);
377+
}
359378
}, {
360379
key: "dismiss",
361380
get: function get() {
@@ -376,7 +395,7 @@ function _getPrototypeOf(o) {
376395

377396
/* Attributes to monitor */
378397
get: function get() {
379-
return ['type', 'dismiss', 'acknowledge', 'href'];
398+
return ['type', 'role', 'dismiss', 'acknowledge', 'href'];
380399
}
381400
}]);
382401

dist/js/joomla-alert-es5.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/joomla-alert.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
(() => {
22
class JoomlaAlertElement extends HTMLElement {
33
/* Attributes to monitor */
4-
static get observedAttributes() { return ['type', 'dismiss', 'acknowledge', 'href']; }
4+
static get observedAttributes() { return ['type', 'role', 'dismiss', 'acknowledge', 'href']; }
55

66
get type() { return this.getAttribute('type'); }
77

88
set type(value) { return this.setAttribute('type', value); }
99

10+
get role() { return this.getAttribute('role'); }
11+
12+
set role(value) { return this.setAttribute('role', value); }
13+
1014
get dismiss() { return this.getAttribute('dismiss'); }
1115

1216
get acknowledge() { return this.getAttribute('acknowledge'); }
@@ -15,13 +19,16 @@
1519

1620
/* Lifecycle, element appended to the DOM */
1721
connectedCallback() {
18-
this.setAttribute('role', 'alertdialog');
1922
this.classList.add('joomla-alert--show');
2023

2124
// Default to info
2225
if (!this.type || ['info', 'warning', 'danger', 'success'].indexOf(this.type) === -1) {
2326
this.setAttribute('type', 'info');
2427
}
28+
// Default to alert
29+
if (!this.role || ['alert', 'alertdialog'].indexOf(this.role) === -1) {
30+
this.setAttribute('role', 'alert');
31+
}
2532
// Append button
2633
if ((this.hasAttribute('dismiss') || this.hasAttribute('acknowledge')) || ((this.hasAttribute('href') && this.getAttribute('href') !== '')
2734
&& !this.querySelector('button.joomla-alert--close') && !this.querySelector('button.joomla-alert-button--close'))) {
@@ -50,6 +57,11 @@
5057
this.type = 'info';
5158
}
5259
break;
60+
case 'role':
61+
if (!newValue || (newValue && ['alert', 'alertdialog'].indexOf(newValue) === -1)) {
62+
this.role = 'alert';
63+
}
64+
break;
5365
case 'dismiss':
5466
case 'acknowledge':
5567
if (!newValue || newValue === 'true') {

0 commit comments

Comments
 (0)