@pictogrammers/components 0.5.4 → 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pictogrammers/components",
3
3
  "type": "module",
4
- "version": "0.5.4",
4
+ "version": "0.5.5",
5
5
  "license": "MIT",
6
6
  "author": "Austin Andrews",
7
7
  "scripts": {
@@ -0,0 +1,3 @@
1
+ import PgModalConfirm from './modalConfirm';
2
+
3
+ export default PgModalConfirm;
@@ -1,40 +0,0 @@
1
- .backdrop {
2
- display: flex;
3
- position: fixed;
4
- top: 0;
5
- left: 0;
6
- right: 0;
7
- bottom: 0;
8
- background: rgba(0, 0, 0, 0.6);
9
- justify-content: center;
10
- align-items: center;
11
- }
12
- .dialog {
13
- background: #fff;
14
- border-radius: 0.5rem;
15
- box-shadow: 0 1px 1rem rgba(0, 0, 0, 0.5);
16
- overflow: hidden;
17
- min-width: 15rem;
18
- }
19
- header {
20
- border-bottom: 1px solid #ccc;
21
- background: #f1f1f1;
22
- padding: 0.75rem 1rem;
23
- }
24
- header h2 {
25
- font-size: 1.25rem;
26
- margin: 0;
27
- font-weight: normal;
28
- }
29
- main {
30
- padding: 0.5rem 1rem;
31
- }
32
- footer {
33
- display: flex;
34
- flex-direction: row;
35
- padding: 0.75rem 1rem;
36
- border-top: 1px solid #ccc;
37
- background: #f1f1f1;
38
- justify-content: flex-end;
39
- gap: 0.5rem;
40
- }
@@ -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
- }