@aurodesignsystem/auro-dialog 1.0.6 → 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 +21 -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 +28 -0
- package/demo/api.md +52 -52
- package/demo/api.min.js +188 -0
- package/demo/index.js +18 -0
- package/demo/index.md +16 -17
- package/demo/index.min.js +47 -0
- 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 +11 -11
- package/src/componentBase.js +9 -7
- package/apiExamples/toggleDialog.js +0 -8
- package/dist/toggleDialog.js +0 -8
package/demo/api.min.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
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
|
+
}
|
|
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
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function initExamples(initCount) {
|
|
168
|
+
initCount = initCount || 0;
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
initBasicExample();
|
|
172
|
+
initAccessibilityExample();
|
|
173
|
+
initDecoupledExample();
|
|
174
|
+
initEditCloseButtonExample();
|
|
175
|
+
initModalExample();
|
|
176
|
+
initPopoverAndDropdownExample();
|
|
177
|
+
initSizeOptionsExample();
|
|
178
|
+
} catch (err) {
|
|
179
|
+
if (initCount <= 20) {
|
|
180
|
+
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
181
|
+
setTimeout(() => {
|
|
182
|
+
initExamples(initCount + 1);
|
|
183
|
+
}, 100);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export { initExamples };
|
package/demo/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { initBasicExample } from "../apiExamples/basic";
|
|
2
|
+
import { initCustomExample } from "../apiExamples/custom";
|
|
3
|
+
|
|
4
|
+
export function initExamples(initCount) {
|
|
5
|
+
initCount = initCount || 0;
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
initBasicExample();
|
|
9
|
+
initCustomExample();
|
|
10
|
+
} catch (err) {
|
|
11
|
+
if (initCount <= 20) {
|
|
12
|
+
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
13
|
+
setTimeout(() => {
|
|
14
|
+
initExamples(initCount + 1);
|
|
15
|
+
}, 100);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
package/demo/index.md
CHANGED
|
@@ -37,16 +37,15 @@ The `<auro-dialog>` component should be used in situations where users may:
|
|
|
37
37
|
Triggering the dialog relies on functions being installed. See the following example code that is installed into this demo.
|
|
38
38
|
|
|
39
39
|
```javascript
|
|
40
|
-
function toggleDialog(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
dialog.hasAttribute('open')
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
dialog.setAttribute(
|
|
40
|
+
function toggleDialog(dialogID) {
|
|
41
|
+
const dialog = document.querySelector(dialogID);
|
|
42
|
+
|
|
43
|
+
if (dialog.hasAttribute('open')) {
|
|
44
|
+
dialog.removeAttribute('open');
|
|
45
|
+
} else {
|
|
46
|
+
dialog.setAttribute('open', true);
|
|
47
|
+
}
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
-
// This function can be retrieved from https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-dialog@latest/dist/toggleDialog.js
|
|
50
49
|
```
|
|
51
50
|
|
|
52
51
|
Once the JavaScript is added to the scope of the experience, the next part is adding a trigger. In this example, the button component will toggle a dialog with the ID of `#demo1`.
|
|
@@ -79,7 +78,7 @@ It should be noted that the `footer` slot is reserved for the placement of actio
|
|
|
79
78
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/basic.html) -->
|
|
80
79
|
<!-- The below content is automatically added from ./../../apiExamples/basic.html -->
|
|
81
80
|
<div>
|
|
82
|
-
<auro-button
|
|
81
|
+
<auro-button id="openBasic">Open default dialog</auro-button>
|
|
83
82
|
</div>
|
|
84
83
|
<auro-dialog id="defaultDialog">
|
|
85
84
|
<span slot="header">Default Dialog</span>
|
|
@@ -95,7 +94,7 @@ It should be noted that the `footer` slot is reserved for the placement of actio
|
|
|
95
94
|
</ul>
|
|
96
95
|
</div>
|
|
97
96
|
<div slot="footer">
|
|
98
|
-
<auro-button secondary
|
|
97
|
+
<auro-button secondary id="closeBasic">Close</auro-button>
|
|
99
98
|
</div>
|
|
100
99
|
</auro-dialog>
|
|
101
100
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
@@ -107,7 +106,7 @@ It should be noted that the `footer` slot is reserved for the placement of actio
|
|
|
107
106
|
|
|
108
107
|
```html
|
|
109
108
|
<div>
|
|
110
|
-
<auro-button
|
|
109
|
+
<auro-button id="openBasic">Open default dialog</auro-button>
|
|
111
110
|
</div>
|
|
112
111
|
<auro-dialog id="defaultDialog">
|
|
113
112
|
<span slot="header">Default Dialog</span>
|
|
@@ -123,7 +122,7 @@ It should be noted that the `footer` slot is reserved for the placement of actio
|
|
|
123
122
|
</ul>
|
|
124
123
|
</div>
|
|
125
124
|
<div slot="footer">
|
|
126
|
-
<auro-button secondary
|
|
125
|
+
<auro-button secondary id="closeBasic">Close</auro-button>
|
|
127
126
|
</div>
|
|
128
127
|
</auro-dialog>
|
|
129
128
|
```
|
|
@@ -148,7 +147,7 @@ This will create a new custom element that you can use in your HTML that will fu
|
|
|
148
147
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/custom.html) -->
|
|
149
148
|
<!-- The below content is automatically added from ./../../apiExamples/custom.html -->
|
|
150
149
|
<div>
|
|
151
|
-
<auro-button
|
|
150
|
+
<auro-button id="openCustom">Open default dialog</auro-button>
|
|
152
151
|
</div>
|
|
153
152
|
<custom-dialog id="customDialog">
|
|
154
153
|
<span slot="header">Default Dialog</span>
|
|
@@ -164,7 +163,7 @@ This will create a new custom element that you can use in your HTML that will fu
|
|
|
164
163
|
</ul>
|
|
165
164
|
</div>
|
|
166
165
|
<div slot="footer">
|
|
167
|
-
<auro-button secondary
|
|
166
|
+
<auro-button secondary id="closeCustom">Close</auro-button>
|
|
168
167
|
</div>
|
|
169
168
|
</custom-dialog>
|
|
170
169
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
@@ -176,7 +175,7 @@ This will create a new custom element that you can use in your HTML that will fu
|
|
|
176
175
|
|
|
177
176
|
```html
|
|
178
177
|
<div>
|
|
179
|
-
<auro-button
|
|
178
|
+
<auro-button id="openCustom">Open default dialog</auro-button>
|
|
180
179
|
</div>
|
|
181
180
|
<custom-dialog id="customDialog">
|
|
182
181
|
<span slot="header">Default Dialog</span>
|
|
@@ -192,7 +191,7 @@ This will create a new custom element that you can use in your HTML that will fu
|
|
|
192
191
|
</ul>
|
|
193
192
|
</div>
|
|
194
193
|
<div slot="footer">
|
|
195
|
-
<auro-button secondary
|
|
194
|
+
<auro-button secondary id="closeCustom">Close</auro-button>
|
|
196
195
|
</div>
|
|
197
196
|
</custom-dialog>
|
|
198
197
|
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
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
|
+
}
|
|
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
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function initExamples(initCount) {
|
|
32
|
+
initCount = initCount || 0;
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
initBasicExample();
|
|
36
|
+
initCustomExample();
|
|
37
|
+
} catch (err) {
|
|
38
|
+
if (initCount <= 20) {
|
|
39
|
+
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
initExamples(initCount + 1);
|
|
42
|
+
}, 100);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
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",
|
|
@@ -29,39 +29,39 @@
|
|
|
29
29
|
"@aurodesignsystem/webcorestylesheets": "^5.0.8"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@alaskaairux/icons": "^4.
|
|
32
|
+
"@alaskaairux/icons": "^4.37.0",
|
|
33
33
|
"@aurodesignsystem/auro-library": "^2.5.1",
|
|
34
34
|
"@aurodesignsystem/design-tokens": "^4.3.0",
|
|
35
35
|
"@aurodesignsystem/eslint-config": "^1.3.0",
|
|
36
36
|
"@aurodesignsystem/webcorestylesheets": "^5.0.8",
|
|
37
|
-
"@commitlint/cli": "^18.
|
|
38
|
-
"@commitlint/config-conventional": "^18.
|
|
37
|
+
"@commitlint/cli": "^18.6.1",
|
|
38
|
+
"@commitlint/config-conventional": "^18.6.2",
|
|
39
39
|
"@open-wc/testing": "^4.0.0",
|
|
40
40
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
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",
|
|
48
48
|
"concat": "^1.0.3",
|
|
49
49
|
"concurrently": "^8.2.2",
|
|
50
50
|
"copyfiles": "^2.4.1",
|
|
51
|
-
"core-js": "^3.
|
|
51
|
+
"core-js": "^3.36.0",
|
|
52
52
|
"eslint": "^8.56.0",
|
|
53
|
-
"eslint-plugin-jsdoc": "^48.0
|
|
54
|
-
"husky": "^9.0.
|
|
53
|
+
"eslint-plugin-jsdoc": "^48.2.0",
|
|
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
|
-
"rollup": "^4.
|
|
62
|
+
"rollup": "^4.12.0",
|
|
63
63
|
"rollup-plugin-serve": "^1.1.1",
|
|
64
|
-
"sass": "^1.
|
|
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",
|
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
|
/**
|