@aurodesignsystem/auro-dialog 1.0.7 → 1.0.8
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/.vscode/settings.json +2 -0
- package/CHANGELOG.md +13 -0
- package/README.md +5 -5
- package/apiExamples/accessibility.js +12 -0
- package/apiExamples/basic.js +14 -0
- package/apiExamples/custom.js +14 -0
- package/apiExamples/decoupled.js +27 -0
- package/apiExamples/editCloseButton.js +12 -0
- package/apiExamples/modal.js +40 -0
- package/apiExamples/popoverAndDropdown.js +14 -0
- package/apiExamples/sizeOptions.js +40 -0
- package/demo/api.js +17 -5
- package/demo/api.md +52 -52
- package/demo/api.min.js +174 -11
- package/demo/index.js +7 -5
- package/demo/index.md +8 -8
- package/demo/index.min.js +33 -11
- package/dist/accessibility.js +12 -0
- package/dist/auro-dialog__bundled.js +9 -7
- package/dist/basic.js +14 -0
- package/dist/componentBase.d.ts.map +1 -1
- package/dist/componentBase.js +9 -7
- package/dist/custom.js +14 -0
- package/dist/decoupled.js +27 -0
- package/dist/editCloseButton.js +12 -0
- package/dist/modal.js +40 -0
- package/dist/popoverAndDropdown.js +14 -0
- package/dist/sizeOptions.js +40 -0
- package/package.json +6 -7
- package/src/componentBase.js +9 -7
- package/apiExamples/toggleDialog.js +0 -9
- package/dist/toggleDialog.js +0 -9
package/demo/api.min.js
CHANGED
|
@@ -1,25 +1,188 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
1
|
+
function initBasicExample() {
|
|
2
|
+
const buttons = [document.querySelector('#openBasic'), document.querySelector('#closeBasic')];
|
|
3
|
+
const dialog = document.querySelector('#defaultDialog');
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
buttons.forEach((button) => {
|
|
6
|
+
button.addEventListener('click', () => {
|
|
7
|
+
if (dialog.hasAttribute('open')) {
|
|
8
|
+
dialog.removeAttribute('open');
|
|
9
|
+
} else {
|
|
10
|
+
dialog.setAttribute('open', true);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function initAccessibilityExample() {
|
|
17
|
+
const button = document.querySelector('#openAccessibility');
|
|
18
|
+
const dialog = document.querySelector('#unformattedMdDialog');
|
|
19
|
+
|
|
20
|
+
button.addEventListener('click', () => {
|
|
21
|
+
if (dialog.hasAttribute('open')) {
|
|
22
|
+
dialog.removeAttribute('open');
|
|
23
|
+
} else {
|
|
24
|
+
dialog.setAttribute('open', true);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function initDecoupledExample() {
|
|
30
|
+
const smLgButtons = [document.querySelector('#openSmLg'), document.querySelector('#closeSmLg')];
|
|
31
|
+
const smLgDialog = document.querySelector('#smLgDialog');
|
|
32
|
+
|
|
33
|
+
const mdLgButtons = [document.querySelector('#openMdLg'), document.querySelector('#closeMdLg')];
|
|
34
|
+
const mdLgDialog = document.querySelector('#mdLgDialog');
|
|
35
|
+
|
|
36
|
+
smLgButtons.forEach((button) => {
|
|
37
|
+
button.addEventListener('click', () => {
|
|
38
|
+
if (smLgDialog.hasAttribute('open')) {
|
|
39
|
+
smLgDialog.removeAttribute('open');
|
|
40
|
+
} else {
|
|
41
|
+
smLgDialog.setAttribute('open', true);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
mdLgButtons.forEach((button) => {
|
|
47
|
+
button.addEventListener('click', () => {
|
|
48
|
+
if (mdLgDialog.hasAttribute('open')) {
|
|
49
|
+
mdLgDialog.removeAttribute('open');
|
|
50
|
+
} else {
|
|
51
|
+
mdLgDialog.setAttribute('open', true);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function initEditCloseButtonExample() {
|
|
58
|
+
const button = document.querySelector('#openEditDialog');
|
|
59
|
+
const dialog = document.querySelector('#unformattedCustomMdDialog');
|
|
60
|
+
|
|
61
|
+
button.addEventListener('click', () => {
|
|
62
|
+
if (dialog.hasAttribute('open')) {
|
|
63
|
+
dialog.removeAttribute('open');
|
|
64
|
+
} else {
|
|
65
|
+
dialog.setAttribute('open', true);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function initModalExample() {
|
|
71
|
+
const defaultButtons = [document.querySelector('#openDefaultModal'), document.querySelector('#closeDefaultModal')];
|
|
72
|
+
const defaultDialog = document.querySelector('#defaultModalDialog');
|
|
73
|
+
|
|
74
|
+
const mediumButtons = [document.querySelector('#openMediumModal'), document.querySelector('#closeMediumModal')];
|
|
75
|
+
const mediumDialog = document.querySelector('#mediumModalDialog');
|
|
76
|
+
|
|
77
|
+
const smallButtons = [document.querySelector('#openSmallModal'), document.querySelector('#closeSmallModal')];
|
|
78
|
+
const smallDialog = document.querySelector('#smallModalDialog');
|
|
79
|
+
|
|
80
|
+
defaultButtons.forEach((button) => {
|
|
81
|
+
button.addEventListener('click', () => {
|
|
82
|
+
if (defaultDialog.hasAttribute('open')) {
|
|
83
|
+
defaultDialog.removeAttribute('open');
|
|
84
|
+
} else {
|
|
85
|
+
defaultDialog.setAttribute('open', true);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
mediumButtons.forEach((button) => {
|
|
91
|
+
button.addEventListener('click', () => {
|
|
92
|
+
if (mediumDialog.hasAttribute('open')) {
|
|
93
|
+
mediumDialog.removeAttribute('open');
|
|
94
|
+
} else {
|
|
95
|
+
mediumDialog.setAttribute('open', true);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
smallButtons.forEach((button) => {
|
|
101
|
+
button.addEventListener('click', () => {
|
|
102
|
+
if (smallDialog.hasAttribute('open')) {
|
|
103
|
+
smallDialog.removeAttribute('open');
|
|
104
|
+
} else {
|
|
105
|
+
smallDialog.setAttribute('open', true);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function initPopoverAndDropdownExample() {
|
|
112
|
+
const buttons = [document.querySelector('#openPopAndDrop'), document.querySelector('#closePopAndDrop')];
|
|
113
|
+
const dialog = document.querySelector('#popover-dialog');
|
|
114
|
+
|
|
115
|
+
buttons.forEach((button) => {
|
|
116
|
+
button.addEventListener('click', () => {
|
|
117
|
+
if (dialog.hasAttribute('open')) {
|
|
118
|
+
dialog.removeAttribute('open');
|
|
119
|
+
} else {
|
|
120
|
+
dialog.setAttribute('open', true);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function initSizeOptionsExample() {
|
|
127
|
+
const defaultButtons = [document.querySelector('#openDefaultSize'), document.querySelector('#closeDefaultSize')];
|
|
128
|
+
const defaultDialog = document.querySelector('#defaultSizeDialog');
|
|
129
|
+
|
|
130
|
+
const mediumButtons = [document.querySelector('#openMediumSize'), document.querySelector('#closeMediumSize')];
|
|
131
|
+
const mediumDialog = document.querySelector('#mediumSizeDialog');
|
|
132
|
+
|
|
133
|
+
const smallButtons = [document.querySelector('#openSmallSize'), document.querySelector('#closeSmallSize')];
|
|
134
|
+
const smallDialog = document.querySelector('#smallSizeDialog');
|
|
135
|
+
|
|
136
|
+
defaultButtons.forEach((button) => {
|
|
137
|
+
button.addEventListener('click', () => {
|
|
138
|
+
if (defaultDialog.hasAttribute('open')) {
|
|
139
|
+
defaultDialog.removeAttribute('open');
|
|
140
|
+
} else {
|
|
141
|
+
defaultDialog.setAttribute('open', true);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
mediumButtons.forEach((button) => {
|
|
147
|
+
button.addEventListener('click', () => {
|
|
148
|
+
if (mediumDialog.hasAttribute('open')) {
|
|
149
|
+
mediumDialog.removeAttribute('open');
|
|
150
|
+
} else {
|
|
151
|
+
mediumDialog.setAttribute('open', true);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
smallButtons.forEach((button) => {
|
|
157
|
+
button.addEventListener('click', () => {
|
|
158
|
+
if (smallDialog.hasAttribute('open')) {
|
|
159
|
+
smallDialog.removeAttribute('open');
|
|
160
|
+
} else {
|
|
161
|
+
smallDialog.setAttribute('open', true);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
});
|
|
9
165
|
}
|
|
10
166
|
|
|
11
|
-
function
|
|
167
|
+
function initExamples(initCount) {
|
|
12
168
|
initCount = initCount || 0;
|
|
13
169
|
|
|
14
170
|
try {
|
|
15
|
-
|
|
16
|
-
|
|
171
|
+
initBasicExample();
|
|
172
|
+
initAccessibilityExample();
|
|
173
|
+
initDecoupledExample();
|
|
174
|
+
initEditCloseButtonExample();
|
|
175
|
+
initModalExample();
|
|
176
|
+
initPopoverAndDropdownExample();
|
|
177
|
+
initSizeOptionsExample();
|
|
178
|
+
} catch (err) {
|
|
17
179
|
if (initCount <= 20) {
|
|
18
180
|
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
19
181
|
setTimeout(() => {
|
|
20
|
-
|
|
182
|
+
initExamples(initCount + 1);
|
|
21
183
|
}, 100);
|
|
22
184
|
}
|
|
23
185
|
}
|
|
24
186
|
}
|
|
25
187
|
|
|
188
|
+
export { initExamples };
|
package/demo/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { initBasicExample } from "../apiExamples/basic";
|
|
2
|
+
import { initCustomExample } from "../apiExamples/custom";
|
|
2
3
|
|
|
3
|
-
export function
|
|
4
|
+
export function initExamples(initCount) {
|
|
4
5
|
initCount = initCount || 0;
|
|
5
6
|
|
|
6
7
|
try {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
initBasicExample();
|
|
9
|
+
initCustomExample();
|
|
10
|
+
} catch (err) {
|
|
9
11
|
if (initCount <= 20) {
|
|
10
12
|
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
11
13
|
setTimeout(() => {
|
|
12
|
-
|
|
14
|
+
initExamples(initCount + 1);
|
|
13
15
|
}, 100);
|
|
14
16
|
}
|
|
15
17
|
}
|
package/demo/index.md
CHANGED
|
@@ -78,7 +78,7 @@ It should be noted that the `footer` slot is reserved for the placement of actio
|
|
|
78
78
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/basic.html) -->
|
|
79
79
|
<!-- The below content is automatically added from ./../../apiExamples/basic.html -->
|
|
80
80
|
<div>
|
|
81
|
-
<auro-button
|
|
81
|
+
<auro-button id="openBasic">Open default dialog</auro-button>
|
|
82
82
|
</div>
|
|
83
83
|
<auro-dialog id="defaultDialog">
|
|
84
84
|
<span slot="header">Default Dialog</span>
|
|
@@ -94,7 +94,7 @@ It should be noted that the `footer` slot is reserved for the placement of actio
|
|
|
94
94
|
</ul>
|
|
95
95
|
</div>
|
|
96
96
|
<div slot="footer">
|
|
97
|
-
<auro-button secondary
|
|
97
|
+
<auro-button secondary id="closeBasic">Close</auro-button>
|
|
98
98
|
</div>
|
|
99
99
|
</auro-dialog>
|
|
100
100
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
@@ -106,7 +106,7 @@ It should be noted that the `footer` slot is reserved for the placement of actio
|
|
|
106
106
|
|
|
107
107
|
```html
|
|
108
108
|
<div>
|
|
109
|
-
<auro-button
|
|
109
|
+
<auro-button id="openBasic">Open default dialog</auro-button>
|
|
110
110
|
</div>
|
|
111
111
|
<auro-dialog id="defaultDialog">
|
|
112
112
|
<span slot="header">Default Dialog</span>
|
|
@@ -122,7 +122,7 @@ It should be noted that the `footer` slot is reserved for the placement of actio
|
|
|
122
122
|
</ul>
|
|
123
123
|
</div>
|
|
124
124
|
<div slot="footer">
|
|
125
|
-
<auro-button secondary
|
|
125
|
+
<auro-button secondary id="closeBasic">Close</auro-button>
|
|
126
126
|
</div>
|
|
127
127
|
</auro-dialog>
|
|
128
128
|
```
|
|
@@ -147,7 +147,7 @@ This will create a new custom element that you can use in your HTML that will fu
|
|
|
147
147
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/custom.html) -->
|
|
148
148
|
<!-- The below content is automatically added from ./../../apiExamples/custom.html -->
|
|
149
149
|
<div>
|
|
150
|
-
<auro-button
|
|
150
|
+
<auro-button id="openCustom">Open default dialog</auro-button>
|
|
151
151
|
</div>
|
|
152
152
|
<custom-dialog id="customDialog">
|
|
153
153
|
<span slot="header">Default Dialog</span>
|
|
@@ -163,7 +163,7 @@ This will create a new custom element that you can use in your HTML that will fu
|
|
|
163
163
|
</ul>
|
|
164
164
|
</div>
|
|
165
165
|
<div slot="footer">
|
|
166
|
-
<auro-button secondary
|
|
166
|
+
<auro-button secondary id="closeCustom">Close</auro-button>
|
|
167
167
|
</div>
|
|
168
168
|
</custom-dialog>
|
|
169
169
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
@@ -175,7 +175,7 @@ This will create a new custom element that you can use in your HTML that will fu
|
|
|
175
175
|
|
|
176
176
|
```html
|
|
177
177
|
<div>
|
|
178
|
-
<auro-button
|
|
178
|
+
<auro-button id="openCustom">Open default dialog</auro-button>
|
|
179
179
|
</div>
|
|
180
180
|
<custom-dialog id="customDialog">
|
|
181
181
|
<span slot="header">Default Dialog</span>
|
|
@@ -191,7 +191,7 @@ This will create a new custom element that you can use in your HTML that will fu
|
|
|
191
191
|
</ul>
|
|
192
192
|
</div>
|
|
193
193
|
<div slot="footer">
|
|
194
|
-
<auro-button secondary
|
|
194
|
+
<auro-button secondary id="closeCustom">Close</auro-button>
|
|
195
195
|
</div>
|
|
196
196
|
</custom-dialog>
|
|
197
197
|
```
|
package/demo/index.min.js
CHANGED
|
@@ -1,25 +1,47 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
1
|
+
function initBasicExample() {
|
|
2
|
+
const buttons = [document.querySelector('#openBasic'), document.querySelector('#closeBasic')];
|
|
3
|
+
const dialog = document.querySelector('#defaultDialog');
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
buttons.forEach((button) => {
|
|
6
|
+
button.addEventListener('click', () => {
|
|
7
|
+
if (dialog.hasAttribute('open')) {
|
|
8
|
+
dialog.removeAttribute('open');
|
|
9
|
+
} else {
|
|
10
|
+
dialog.setAttribute('open', true);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function initCustomExample() {
|
|
17
|
+
const buttons = [document.querySelector('#openCustom'), document.querySelector('#closeCustom')];
|
|
18
|
+
const dialog = document.querySelector('#defaultDialog');
|
|
19
|
+
|
|
20
|
+
buttons.forEach((button) => {
|
|
21
|
+
button.addEventListener('click', () => {
|
|
22
|
+
if (dialog.hasAttribute('open')) {
|
|
23
|
+
dialog.removeAttribute('open');
|
|
24
|
+
} else {
|
|
25
|
+
dialog.setAttribute('open', true);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
9
29
|
}
|
|
10
30
|
|
|
11
|
-
function
|
|
31
|
+
function initExamples(initCount) {
|
|
12
32
|
initCount = initCount || 0;
|
|
13
33
|
|
|
14
34
|
try {
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
initBasicExample();
|
|
36
|
+
initCustomExample();
|
|
37
|
+
} catch (err) {
|
|
17
38
|
if (initCount <= 20) {
|
|
18
39
|
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
19
40
|
setTimeout(() => {
|
|
20
|
-
|
|
41
|
+
initExamples(initCount + 1);
|
|
21
42
|
}, 100);
|
|
22
43
|
}
|
|
23
44
|
}
|
|
24
45
|
}
|
|
25
46
|
|
|
47
|
+
export { initExamples };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function initAccessibilityExample() {
|
|
2
|
+
const button = document.querySelector('#openAccessibility');
|
|
3
|
+
const dialog = document.querySelector('#unformattedMdDialog');
|
|
4
|
+
|
|
5
|
+
button.addEventListener('click', () => {
|
|
6
|
+
if (dialog.hasAttribute('open')) {
|
|
7
|
+
dialog.removeAttribute('open');
|
|
8
|
+
} else {
|
|
9
|
+
dialog.setAttribute('open', true);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -194,13 +194,15 @@ class ComponentBase extends s {
|
|
|
194
194
|
|
|
195
195
|
const closeButton = this.shadowRoot.getElementById('dialog-close');
|
|
196
196
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
closeButton
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
197
|
+
if (lastFocusableElement) {
|
|
198
|
+
lastFocusableElement.addEventListener('focusout', () => {
|
|
199
|
+
if (closeButton !== null) { // eslint-disable-line no-negated-condition
|
|
200
|
+
closeButton.focus();
|
|
201
|
+
} else {
|
|
202
|
+
firstFocusableElement.focus();
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
204
206
|
}
|
|
205
207
|
|
|
206
208
|
/**
|
package/dist/basic.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function initBasicExample() {
|
|
2
|
+
const buttons = [document.querySelector('#openBasic'), document.querySelector('#closeBasic')];
|
|
3
|
+
const dialog = document.querySelector('#defaultDialog');
|
|
4
|
+
|
|
5
|
+
buttons.forEach((button) => {
|
|
6
|
+
button.addEventListener('click', () => {
|
|
7
|
+
if (dialog.hasAttribute('open')) {
|
|
8
|
+
dialog.removeAttribute('open');
|
|
9
|
+
} else {
|
|
10
|
+
dialog.setAttribute('open', true);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentBase.d.ts","sourceRoot":"","sources":["../src/componentBase.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;IAkBE;;;;;;;;;;;;;;;MAeC;
|
|
1
|
+
{"version":3,"file":"componentBase.d.ts","sourceRoot":"","sources":["../src/componentBase.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;IAkBE;;;;;;;;;;;;;;;MAeC;IAwID,+CAKC;IA1KC;;OAEG;IACH,YAAsE;IAEtE;;OAEG;IACH,YAAmC;IAEnC,eAAkB;IAClB,qBAAwB;IAoB1B,qBASC;IALC,oBAAsD;IAOxD;;;;OAIG;IACH,2BAHW,IAAI,MAAM,EAAE,GAAG,CAAC,GACd,IAAI,CAUhB;IAIC,yBAAwD;IAS1D;;;OAGG;IACH,mBAQC;IAPC,wBAA4C;IAS9C;;;OAGG;IACH,oBAEC;IAED;;;OAGG;IACH,4BAMC;IAED;;;OAGG;IACH,wBAiBC;IAED;;;OAGG;IACH,2BAIC;IAED;;;OAGG;IACH,+BAEC;IADC,cAAiB;IAGnB;;;;OAIG;IACH,sBAIC;IAED;;;;OAIG;IACH,cAIC;IASD;;;OAGG;IACH,uBASC;IAED,+CAuCC;CACF;2BA3QgC,KAAK"}
|
package/dist/componentBase.js
CHANGED
|
@@ -159,13 +159,15 @@ export default class ComponentBase extends LitElement {
|
|
|
159
159
|
|
|
160
160
|
const closeButton = this.shadowRoot.getElementById('dialog-close');
|
|
161
161
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
closeButton
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
162
|
+
if (lastFocusableElement) {
|
|
163
|
+
lastFocusableElement.addEventListener('focusout', () => {
|
|
164
|
+
if (closeButton !== null) { // eslint-disable-line no-negated-condition
|
|
165
|
+
closeButton.focus();
|
|
166
|
+
} else {
|
|
167
|
+
firstFocusableElement.focus();
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
/**
|
package/dist/custom.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function initCustomExample() {
|
|
2
|
+
const buttons = [document.querySelector('#openCustom'), document.querySelector('#closeCustom')];
|
|
3
|
+
const dialog = document.querySelector('#defaultDialog');
|
|
4
|
+
|
|
5
|
+
buttons.forEach((button) => {
|
|
6
|
+
button.addEventListener('click', () => {
|
|
7
|
+
if (dialog.hasAttribute('open')) {
|
|
8
|
+
dialog.removeAttribute('open');
|
|
9
|
+
} else {
|
|
10
|
+
dialog.setAttribute('open', true);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function initDecoupledExample() {
|
|
2
|
+
const smLgButtons = [document.querySelector('#openSmLg'), document.querySelector('#closeSmLg')];
|
|
3
|
+
const smLgDialog = document.querySelector('#smLgDialog');
|
|
4
|
+
|
|
5
|
+
const mdLgButtons = [document.querySelector('#openMdLg'), document.querySelector('#closeMdLg')];
|
|
6
|
+
const mdLgDialog = document.querySelector('#mdLgDialog');
|
|
7
|
+
|
|
8
|
+
smLgButtons.forEach((button) => {
|
|
9
|
+
button.addEventListener('click', () => {
|
|
10
|
+
if (smLgDialog.hasAttribute('open')) {
|
|
11
|
+
smLgDialog.removeAttribute('open');
|
|
12
|
+
} else {
|
|
13
|
+
smLgDialog.setAttribute('open', true);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
mdLgButtons.forEach((button) => {
|
|
19
|
+
button.addEventListener('click', () => {
|
|
20
|
+
if (mdLgDialog.hasAttribute('open')) {
|
|
21
|
+
mdLgDialog.removeAttribute('open');
|
|
22
|
+
} else {
|
|
23
|
+
mdLgDialog.setAttribute('open', true);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function initEditCloseButtonExample() {
|
|
2
|
+
const button = document.querySelector('#openEditDialog');
|
|
3
|
+
const dialog = document.querySelector('#unformattedCustomMdDialog');
|
|
4
|
+
|
|
5
|
+
button.addEventListener('click', () => {
|
|
6
|
+
if (dialog.hasAttribute('open')) {
|
|
7
|
+
dialog.removeAttribute('open');
|
|
8
|
+
} else {
|
|
9
|
+
dialog.setAttribute('open', true);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
package/dist/modal.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export function initModalExample() {
|
|
2
|
+
const defaultButtons = [document.querySelector('#openDefaultModal'), document.querySelector('#closeDefaultModal')];
|
|
3
|
+
const defaultDialog = document.querySelector('#defaultModalDialog');
|
|
4
|
+
|
|
5
|
+
const mediumButtons = [document.querySelector('#openMediumModal'), document.querySelector('#closeMediumModal')];
|
|
6
|
+
const mediumDialog = document.querySelector('#mediumModalDialog');
|
|
7
|
+
|
|
8
|
+
const smallButtons = [document.querySelector('#openSmallModal'), document.querySelector('#closeSmallModal')];
|
|
9
|
+
const smallDialog = document.querySelector('#smallModalDialog');
|
|
10
|
+
|
|
11
|
+
defaultButtons.forEach((button) => {
|
|
12
|
+
button.addEventListener('click', () => {
|
|
13
|
+
if (defaultDialog.hasAttribute('open')) {
|
|
14
|
+
defaultDialog.removeAttribute('open');
|
|
15
|
+
} else {
|
|
16
|
+
defaultDialog.setAttribute('open', true);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
mediumButtons.forEach((button) => {
|
|
22
|
+
button.addEventListener('click', () => {
|
|
23
|
+
if (mediumDialog.hasAttribute('open')) {
|
|
24
|
+
mediumDialog.removeAttribute('open');
|
|
25
|
+
} else {
|
|
26
|
+
mediumDialog.setAttribute('open', true);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
smallButtons.forEach((button) => {
|
|
32
|
+
button.addEventListener('click', () => {
|
|
33
|
+
if (smallDialog.hasAttribute('open')) {
|
|
34
|
+
smallDialog.removeAttribute('open');
|
|
35
|
+
} else {
|
|
36
|
+
smallDialog.setAttribute('open', true);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function initPopoverAndDropdownExample() {
|
|
2
|
+
const buttons = [document.querySelector('#openPopAndDrop'), document.querySelector('#closePopAndDrop')];
|
|
3
|
+
const dialog = document.querySelector('#popover-dialog');
|
|
4
|
+
|
|
5
|
+
buttons.forEach((button) => {
|
|
6
|
+
button.addEventListener('click', () => {
|
|
7
|
+
if (dialog.hasAttribute('open')) {
|
|
8
|
+
dialog.removeAttribute('open');
|
|
9
|
+
} else {
|
|
10
|
+
dialog.setAttribute('open', true);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export function initSizeOptionsExample() {
|
|
2
|
+
const defaultButtons = [document.querySelector('#openDefaultSize'), document.querySelector('#closeDefaultSize')];
|
|
3
|
+
const defaultDialog = document.querySelector('#defaultSizeDialog');
|
|
4
|
+
|
|
5
|
+
const mediumButtons = [document.querySelector('#openMediumSize'), document.querySelector('#closeMediumSize')];
|
|
6
|
+
const mediumDialog = document.querySelector('#mediumSizeDialog');
|
|
7
|
+
|
|
8
|
+
const smallButtons = [document.querySelector('#openSmallSize'), document.querySelector('#closeSmallSize')];
|
|
9
|
+
const smallDialog = document.querySelector('#smallSizeDialog');
|
|
10
|
+
|
|
11
|
+
defaultButtons.forEach((button) => {
|
|
12
|
+
button.addEventListener('click', () => {
|
|
13
|
+
if (defaultDialog.hasAttribute('open')) {
|
|
14
|
+
defaultDialog.removeAttribute('open');
|
|
15
|
+
} else {
|
|
16
|
+
defaultDialog.setAttribute('open', true);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
mediumButtons.forEach((button) => {
|
|
22
|
+
button.addEventListener('click', () => {
|
|
23
|
+
if (mediumDialog.hasAttribute('open')) {
|
|
24
|
+
mediumDialog.removeAttribute('open');
|
|
25
|
+
} else {
|
|
26
|
+
mediumDialog.setAttribute('open', true);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
smallButtons.forEach((button) => {
|
|
32
|
+
button.addEventListener('click', () => {
|
|
33
|
+
if (smallDialog.hasAttribute('open')) {
|
|
34
|
+
smallDialog.removeAttribute('open');
|
|
35
|
+
} else {
|
|
36
|
+
smallDialog.setAttribute('open', true);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"================================================================================"
|
|
8
8
|
],
|
|
9
9
|
"name": "@aurodesignsystem/auro-dialog",
|
|
10
|
-
"version": "1.0.
|
|
10
|
+
"version": "1.0.8",
|
|
11
11
|
"description": "auro-dialog HTML custom element",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@semantic-release/changelog": "^6.0.3",
|
|
42
42
|
"@semantic-release/git": "^10.0.1",
|
|
43
43
|
"@semantic-release/npm": "^11.0.2",
|
|
44
|
-
"@web/dev-server": "^0.4.
|
|
44
|
+
"@web/dev-server": "^0.4.3",
|
|
45
45
|
"@web/test-runner": "^0.18.0",
|
|
46
46
|
"autoprefixer": "^10.4.17",
|
|
47
47
|
"compression": "^1.7.4",
|
|
@@ -50,18 +50,18 @@
|
|
|
50
50
|
"copyfiles": "^2.4.1",
|
|
51
51
|
"core-js": "^3.36.0",
|
|
52
52
|
"eslint": "^8.56.0",
|
|
53
|
-
"eslint-plugin-jsdoc": "^48.
|
|
53
|
+
"eslint-plugin-jsdoc": "^48.2.0",
|
|
54
54
|
"husky": "^9.0.11",
|
|
55
55
|
"lodash": "^4.17.21",
|
|
56
56
|
"markdown-magic": "^2.6.1",
|
|
57
|
-
"nodemon": "^3.0
|
|
57
|
+
"nodemon": "^3.1.0",
|
|
58
58
|
"npm-run-all": "^4.1.5",
|
|
59
59
|
"postcss": "^8.4.35",
|
|
60
60
|
"postcss-discard-comments": "^6.0.1",
|
|
61
61
|
"postcss-selector-replace": "^1.0.2",
|
|
62
62
|
"rollup": "^4.12.0",
|
|
63
63
|
"rollup-plugin-serve": "^1.1.1",
|
|
64
|
-
"sass": "^1.71.
|
|
64
|
+
"sass": "^1.71.1",
|
|
65
65
|
"semantic-release": "^23.0.2",
|
|
66
66
|
"stylelint": "^16.2.1",
|
|
67
67
|
"stylelint-config-idiomatic-order": "^10.0.0",
|
|
@@ -134,12 +134,11 @@
|
|
|
134
134
|
"web components"
|
|
135
135
|
],
|
|
136
136
|
"scripts": {
|
|
137
|
-
"build": "npm-run-all build:sass sass:render scssLint dist:js bundler build:api build:docs postinstall
|
|
137
|
+
"build": "npm-run-all build:sass sass:render scssLint dist:js bundler build:api build:docs postinstall types",
|
|
138
138
|
"build:ci": "npm-run-all sweep build",
|
|
139
139
|
"build:api": "wca analyze 'src/auro-dialog.js' --outFiles docs/api.md",
|
|
140
140
|
"build:dev:assets": "npm-run-all build:sass:component postCss:component sass:render build:docs",
|
|
141
141
|
"build:docs": "node scripts/generateDocs.mjs",
|
|
142
|
-
"build:demoScripts": "node scripts/prepExampleFiles.mjs",
|
|
143
142
|
"build:sass": "npm-run-all build:sass:component postCss:component sass:render",
|
|
144
143
|
"build:sass:component": "sass --no-source-map src:src",
|
|
145
144
|
"build:watch": "nodemon -e scss,js,html --watch src --watch apiExamples/**/* --exec npm run build:dev:assets",
|
package/src/componentBase.js
CHANGED
|
@@ -159,13 +159,15 @@ export default class ComponentBase extends LitElement {
|
|
|
159
159
|
|
|
160
160
|
const closeButton = this.shadowRoot.getElementById('dialog-close');
|
|
161
161
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
closeButton
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
162
|
+
if (lastFocusableElement) {
|
|
163
|
+
lastFocusableElement.addEventListener('focusout', () => {
|
|
164
|
+
if (closeButton !== null) { // eslint-disable-line no-negated-condition
|
|
165
|
+
closeButton.focus();
|
|
166
|
+
} else {
|
|
167
|
+
firstFocusableElement.focus();
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
/**
|