avalynx-alert 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
2
|
+
* AvalynxAlert
|
|
3
|
+
*
|
|
4
|
+
* A simple alert system for web applications.
|
|
5
|
+
*
|
|
6
|
+
* @version 0.0.3
|
|
7
|
+
* @license MIT
|
|
8
|
+
* @author https://github.com/avalynx/avalynx-alert/graphs/contributors
|
|
9
|
+
* @website https://github.com/avalynx/
|
|
10
|
+
* @repository https://github.com/avalynx/avalynx-alert.git
|
|
11
|
+
* @bugs https://github.com/avalynx/avalynx-alert/issues
|
|
3
12
|
*/
|
|
4
13
|
|
|
5
14
|
.avalynx-alert .alert-content {
|
package/dist/js/avalynx-alert.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A simple alert system for web applications.
|
|
5
5
|
*
|
|
6
|
-
* @version 0.0.
|
|
6
|
+
* @version 0.0.3
|
|
7
7
|
* @license MIT
|
|
8
8
|
* @author https://github.com/avalynx/avalynx-alert/graphs/contributors
|
|
9
9
|
* @website https://github.com/avalynx/
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
* @param {boolean} options.closeable - Whether the alert can be closed by the user. Default is true.
|
|
19
19
|
* @param {boolean} options.autoClose - Whether the alert will close automatically after the duration. Default is true.
|
|
20
20
|
* @param {string} options.width - The width of the alert. Default is '400px'.
|
|
21
|
-
*
|
|
22
21
|
*/
|
|
23
22
|
|
|
24
23
|
export class AvalynxAlert {
|
|
@@ -36,10 +35,10 @@ export class AvalynxAlert {
|
|
|
36
35
|
if (!['top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'].includes(this.position)) {
|
|
37
36
|
this.position = 'top-center';
|
|
38
37
|
}
|
|
39
|
-
if (this.autoClose!==false && this.autoClose!==true) {
|
|
38
|
+
if (this.autoClose !== false && this.autoClose !== true) {
|
|
40
39
|
this.autoClose = true;
|
|
41
40
|
}
|
|
42
|
-
if ((this.closeable!==false && this.closeable!==true) || (this.autoClose===true)) {
|
|
41
|
+
if ((this.closeable !== false && this.closeable !== true) || (this.autoClose === true)) {
|
|
43
42
|
this.closeable = true;
|
|
44
43
|
}
|
|
45
44
|
|
|
@@ -101,14 +100,13 @@ export class AvalynxAlert {
|
|
|
101
100
|
alert.classList.add('overflow-hidden');
|
|
102
101
|
alert.classList.add('avalynx-alert');
|
|
103
102
|
alert.role = 'alert';
|
|
104
|
-
alert.innerHTML =
|
|
105
|
-
console.log(this.closeable);
|
|
103
|
+
alert.innerHTML = `<div class="alert-content">${this.message}`;
|
|
106
104
|
if (this.closeable) {
|
|
107
|
-
alert.innerHTML +=
|
|
105
|
+
alert.innerHTML += `<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>`;
|
|
108
106
|
}
|
|
109
|
-
alert.innerHTML +=
|
|
107
|
+
alert.innerHTML += `</div>`;
|
|
110
108
|
if (this.autoClose) {
|
|
111
|
-
alert.innerHTML +=
|
|
109
|
+
alert.innerHTML += `<div class="alert-timer" style="height: 5px; width: 0;"></div>`;
|
|
112
110
|
}
|
|
113
111
|
|
|
114
112
|
document.getElementById('avalynx-alert-container-' + this.position).appendChild(alert);
|
package/package.json
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
"name": "avalynx-alert",
|
|
3
3
|
"title": "AvalynxAlert",
|
|
4
4
|
"description": "AvalynxAlert is a simple, lightweight, and customizable alert component for Bootstrap.",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.3",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"main": "dist/js/avalynx-alert.js",
|
|
8
|
+
"module": "dist/js/avalynx-alert.js",
|
|
9
|
+
"style": "dist/css/avalynx-alert.css",
|
|
7
10
|
"files": [
|
|
8
11
|
"dist/css/avalynx-alert.css",
|
|
9
12
|
"dist/js/avalynx-alert.js"
|