@pictogrammers/components 0.5.3 → 0.5.5
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.
package/package.json
CHANGED
|
@@ -8,15 +8,14 @@
|
|
|
8
8
|
<h2 id="dialog_label"
|
|
9
9
|
class="dialog_label"
|
|
10
10
|
part="headerText">
|
|
11
|
-
|
|
11
|
+
Alert
|
|
12
12
|
</h2>
|
|
13
13
|
</header>
|
|
14
14
|
<main>
|
|
15
15
|
<p part="message"></p>
|
|
16
16
|
</main>
|
|
17
17
|
<footer>
|
|
18
|
-
<pg-button part="
|
|
19
|
-
<pg-button part="yes" variant="brand">Yes</pg-button>
|
|
18
|
+
<pg-button part="okay" variant="brand">Okay</pg-button>
|
|
20
19
|
</footer>
|
|
21
20
|
</div>
|
|
22
21
|
</div>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<div class="backdrop">
|
|
2
|
-
<div class="dialog"
|
|
3
|
-
role="dialog"
|
|
4
|
-
id="dialog1"
|
|
5
|
-
aria-labelledby="dialog_label"
|
|
6
|
-
aria-modal="true">
|
|
7
|
-
<header part="header">
|
|
8
|
-
<h2 id="dialog_label"
|
|
9
|
-
class="dialog_label"
|
|
10
|
-
part="headerText">
|
|
11
|
-
Add Delivery Address
|
|
12
|
-
</h2>
|
|
13
|
-
</header>
|
|
14
|
-
<main>
|
|
15
|
-
<p part="message"></p>
|
|
16
|
-
</main>
|
|
17
|
-
<footer>
|
|
18
|
-
<pg-button part="no">No</pg-button>
|
|
19
|
-
<pg-button part="yes" variant="brand">Yes</pg-button>
|
|
20
|
-
</footer>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Component, Prop, Part } from '@pictogrammers/element';
|
|
2
|
-
|
|
3
|
-
import template from './modalAlert.html';
|
|
4
|
-
import style from './modalAlert.css';
|
|
5
|
-
|
|
6
|
-
import PgOverlay from '../overlay/overlay';
|
|
7
|
-
import PgButton from '../button/button';
|
|
8
|
-
|
|
9
|
-
@Component({
|
|
10
|
-
selector: 'pg-modal-alert',
|
|
11
|
-
template,
|
|
12
|
-
style
|
|
13
|
-
})
|
|
14
|
-
export default class PgModalAlert extends PgOverlay {
|
|
15
|
-
@Prop() header: string = 'Are you sure?';
|
|
16
|
-
@Prop() message: string = 'Are you sure?';
|
|
17
|
-
|
|
18
|
-
@Part() $header: HTMLDivElement;
|
|
19
|
-
@Part() $headerText: HTMLHeadingElement;
|
|
20
|
-
@Part() $message: HTMLDivElement;
|
|
21
|
-
@Part() $yes: PgButton;
|
|
22
|
-
@Part() $no: PgButton;
|
|
23
|
-
|
|
24
|
-
#cacheKeydownHandler: any;
|
|
25
|
-
|
|
26
|
-
connectedCallback() {
|
|
27
|
-
this.$yes.addEventListener('click', this.#handleYes.bind(this));
|
|
28
|
-
this.$no.addEventListener('click', this.#handleNo.bind(this));
|
|
29
|
-
this.#cacheKeydownHandler ??= this.#handleKeyDown.bind(this);
|
|
30
|
-
document.addEventListener('keydown', this.#cacheKeydownHandler);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
disconnectedCallback() {
|
|
34
|
-
document.removeEventListener('keydown', this.#cacheKeydownHandler);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
#handleKeyDown(e: KeyboardEvent) {
|
|
38
|
-
if (e.key === 'Escape') {
|
|
39
|
-
this.close(null);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
#handleYes() {
|
|
44
|
-
this.close(true);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
#handleNo() {
|
|
48
|
-
this.close(false);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
render(changes) {
|
|
52
|
-
if (changes.header) {
|
|
53
|
-
this.$headerText.innerText = this.header;
|
|
54
|
-
}
|
|
55
|
-
if (changes.message) {
|
|
56
|
-
this.$message.innerText = this.message;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
File without changes
|