@spectrum-web-components/dialog 0.10.7 → 0.10.9-devmode.7
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 +36 -17
- package/sp-dialog-wrapper.dev.js +3 -0
- package/sp-dialog-wrapper.dev.js.map +7 -0
- package/sp-dialog-wrapper.js +3 -14
- package/sp-dialog-wrapper.js.map +7 -1
- package/sp-dialog.dev.js +3 -0
- package/sp-dialog.dev.js.map +7 -0
- package/sp-dialog.js +3 -14
- package/sp-dialog.js.map +7 -1
- package/src/Dialog.dev.js +208 -0
- package/src/Dialog.dev.js.map +7 -0
- package/src/Dialog.js +170 -182
- package/src/Dialog.js.map +7 -1
- package/src/DialogWrapper.dev.js +262 -0
- package/src/DialogWrapper.dev.js.map +7 -0
- package/src/DialogWrapper.js +205 -239
- package/src/DialogWrapper.js.map +7 -1
- package/src/dialog.css.dev.js +99 -0
- package/src/dialog.css.dev.js.map +7 -0
- package/src/dialog.css.js +3 -14
- package/src/dialog.css.js.map +7 -1
- package/src/index.dev.js +3 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +3 -14
- package/src/index.js.map +7 -1
- package/src/spectrum-dialog.css.dev.js +97 -0
- package/src/spectrum-dialog.css.dev.js.map +7 -0
- package/src/spectrum-dialog.css.js +3 -14
- package/src/spectrum-dialog.css.js.map +7 -1
- package/stories/dialog-wrapper.stories.js +76 -87
- package/stories/dialog-wrapper.stories.js.map +7 -1
- package/stories/dialog.stories.js +20 -31
- package/stories/dialog.stories.js.map +7 -1
- package/stories/images.js +3 -14
- package/stories/images.js.map +7 -1
- package/test/benchmark/basic-test.js +5 -16
- package/test/benchmark/basic-test.js.map +7 -1
- package/test/dialog-wrapper.test-vrt.js +4 -15
- package/test/dialog-wrapper.test-vrt.js.map +7 -1
- package/test/dialog-wrapper.test.js +158 -156
- package/test/dialog-wrapper.test.js.map +7 -1
- package/test/dialog.test-vrt.js +4 -15
- package/test/dialog.test-vrt.js.map +7 -1
- package/test/dialog.test.js +46 -54
- package/test/dialog.test.js.map +7 -1
package/src/DialogWrapper.js
CHANGED
|
@@ -1,150 +1,139 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* @fires cancel - Announces that the "cancel" button has been clicked.
|
|
29
|
-
* @fires confirm - Announces that the "confirm" button has been clicked.
|
|
30
|
-
* @fires close - Announces that the dialog has been closed.
|
|
31
|
-
*/
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
html,
|
|
14
|
+
SpectrumElement
|
|
15
|
+
} from "@spectrum-web-components/base";
|
|
16
|
+
import {
|
|
17
|
+
property,
|
|
18
|
+
query
|
|
19
|
+
} from "@spectrum-web-components/base/src/decorators.js";
|
|
20
|
+
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
21
|
+
import "@spectrum-web-components/underlay/sp-underlay.js";
|
|
22
|
+
import "@spectrum-web-components/button/sp-button.js";
|
|
23
|
+
import "../sp-dialog.js";
|
|
24
|
+
import modalWrapperStyles from "@spectrum-web-components/modal/src/modal-wrapper.css.js";
|
|
25
|
+
import modalStyles from "@spectrum-web-components/modal/src/modal.css.js";
|
|
26
|
+
import { FocusVisiblePolyfillMixin } from "@spectrum-web-components/shared";
|
|
27
|
+
import { firstFocusableIn } from "@spectrum-web-components/shared/src/first-focusable-in.js";
|
|
32
28
|
export class DialogWrapper extends FocusVisiblePolyfillMixin(SpectrumElement) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
else {
|
|
65
|
-
firstFocusable.focus();
|
|
66
|
-
}
|
|
67
|
-
this.removeAttribute('tabindex');
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
this.dialog.focus();
|
|
71
|
-
}
|
|
72
|
-
/* c8 ignore next 3 */
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
super.focus();
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.error = false;
|
|
32
|
+
this.cancelLabel = "";
|
|
33
|
+
this.confirmLabel = "";
|
|
34
|
+
this.dismissable = false;
|
|
35
|
+
this.footer = "";
|
|
36
|
+
this.hero = "";
|
|
37
|
+
this.heroLabel = "";
|
|
38
|
+
this.noDivider = false;
|
|
39
|
+
this.open = false;
|
|
40
|
+
this.secondaryLabel = "";
|
|
41
|
+
this.headline = "";
|
|
42
|
+
this.responsive = false;
|
|
43
|
+
this.transitionPromise = Promise.resolve();
|
|
44
|
+
this.resolveTransitionPromise = () => {
|
|
45
|
+
return;
|
|
46
|
+
};
|
|
47
|
+
this.underlay = false;
|
|
48
|
+
}
|
|
49
|
+
static get styles() {
|
|
50
|
+
return [modalWrapperStyles, modalStyles];
|
|
51
|
+
}
|
|
52
|
+
focus() {
|
|
53
|
+
if (this.shadowRoot) {
|
|
54
|
+
const firstFocusable = firstFocusableIn(this.dialog);
|
|
55
|
+
if (firstFocusable) {
|
|
56
|
+
if (firstFocusable.updateComplete) {
|
|
57
|
+
firstFocusable.updateComplete.then(() => firstFocusable.focus());
|
|
58
|
+
} else {
|
|
59
|
+
firstFocusable.focus();
|
|
76
60
|
}
|
|
61
|
+
this.removeAttribute("tabindex");
|
|
62
|
+
} else {
|
|
63
|
+
this.dialog.focus();
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
super.focus();
|
|
77
67
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.close();
|
|
68
|
+
}
|
|
69
|
+
overlayWillCloseCallback() {
|
|
70
|
+
if (!this.open)
|
|
71
|
+
return false;
|
|
72
|
+
this.close();
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
dismiss() {
|
|
76
|
+
if (!this.dismissable) {
|
|
77
|
+
return;
|
|
89
78
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
this.close();
|
|
80
|
+
}
|
|
81
|
+
clickSecondary() {
|
|
82
|
+
this.dispatchEvent(new Event("secondary", {
|
|
83
|
+
bubbles: true
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
clickCancel() {
|
|
87
|
+
this.dispatchEvent(new Event("cancel", {
|
|
88
|
+
bubbles: true
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
clickConfirm() {
|
|
92
|
+
this.dispatchEvent(new Event("confirm", {
|
|
93
|
+
bubbles: true
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
handleClose(event) {
|
|
97
|
+
event.stopPropagation();
|
|
98
|
+
this.close();
|
|
99
|
+
}
|
|
100
|
+
close() {
|
|
101
|
+
this.open = false;
|
|
102
|
+
}
|
|
103
|
+
dispatchClosed() {
|
|
104
|
+
this.dispatchEvent(new Event("close", {
|
|
105
|
+
bubbles: true
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
handleUnderlayTransitionend(event) {
|
|
109
|
+
if (!this.open && event.propertyName === "visibility") {
|
|
110
|
+
this.dispatchClosed();
|
|
111
|
+
this.resolveTransitionPromise();
|
|
94
112
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
113
|
+
}
|
|
114
|
+
handleModalTransitionend() {
|
|
115
|
+
if (this.open || !this.underlay) {
|
|
116
|
+
this.resolveTransitionPromise();
|
|
117
|
+
if (!this.open) {
|
|
118
|
+
this.dispatchClosed();
|
|
119
|
+
}
|
|
99
120
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
121
|
+
}
|
|
122
|
+
update(changes) {
|
|
123
|
+
if (changes.has("open") && changes.get("open") !== void 0) {
|
|
124
|
+
this.transitionPromise = new Promise((res) => this.resolveTransitionPromise = res);
|
|
104
125
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this.open = false;
|
|
111
|
-
}
|
|
112
|
-
dispatchClosed() {
|
|
113
|
-
this.dispatchEvent(new Event('close', {
|
|
114
|
-
bubbles: true,
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
handleUnderlayTransitionend(event) {
|
|
118
|
-
if (!this.open && event.propertyName === 'visibility') {
|
|
119
|
-
this.dispatchClosed();
|
|
120
|
-
this.resolveTransitionPromise();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
handleModalTransitionend() {
|
|
124
|
-
if (this.open || !this.underlay) {
|
|
125
|
-
this.resolveTransitionPromise();
|
|
126
|
-
if (!this.open) {
|
|
127
|
-
this.dispatchClosed();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
update(changes) {
|
|
132
|
-
if (changes.has('open') && changes.get('open') !== undefined) {
|
|
133
|
-
this.transitionPromise = new Promise((res) => (this.resolveTransitionPromise = res));
|
|
134
|
-
}
|
|
135
|
-
super.update(changes);
|
|
136
|
-
}
|
|
137
|
-
render() {
|
|
138
|
-
return html `
|
|
139
|
-
${this.underlay
|
|
140
|
-
? html `
|
|
126
|
+
super.update(changes);
|
|
127
|
+
}
|
|
128
|
+
render() {
|
|
129
|
+
return html`
|
|
130
|
+
${this.underlay ? html`
|
|
141
131
|
<sp-underlay
|
|
142
132
|
?open=${this.open}
|
|
143
133
|
@click=${this.dismiss}
|
|
144
134
|
@transitionend=${this.handleUnderlayTransitionend}
|
|
145
135
|
></sp-underlay>
|
|
146
|
-
`
|
|
147
|
-
: html ``}
|
|
136
|
+
` : html``}
|
|
148
137
|
<div
|
|
149
138
|
class="modal ${this.mode}"
|
|
150
139
|
@transitionend=${this.handleModalTransitionend}
|
|
@@ -153,35 +142,26 @@ export class DialogWrapper extends FocusVisiblePolyfillMixin(SpectrumElement) {
|
|
|
153
142
|
?dismissable=${this.dismissable}
|
|
154
143
|
?no-divider=${this.noDivider}
|
|
155
144
|
?error=${this.error}
|
|
156
|
-
mode=${ifDefined(this.mode ? this.mode :
|
|
157
|
-
size=${ifDefined(this.size ? this.size :
|
|
145
|
+
mode=${ifDefined(this.mode ? this.mode : void 0)}
|
|
146
|
+
size=${ifDefined(this.size ? this.size : void 0)}
|
|
158
147
|
@close=${this.handleClose}
|
|
159
148
|
>
|
|
160
|
-
${this.hero
|
|
161
|
-
? html `
|
|
149
|
+
${this.hero ? html`
|
|
162
150
|
<img
|
|
163
151
|
src="${this.hero}"
|
|
164
152
|
slot="hero"
|
|
165
|
-
aria-hidden=${ifDefined(this.heroLabel ?
|
|
166
|
-
alt=${ifDefined(this.heroLabel
|
|
167
|
-
? this.heroLabel
|
|
168
|
-
: undefined)}
|
|
153
|
+
aria-hidden=${ifDefined(this.heroLabel ? void 0 : "true")}
|
|
154
|
+
alt=${ifDefined(this.heroLabel ? this.heroLabel : void 0)}
|
|
169
155
|
/>
|
|
170
|
-
`
|
|
171
|
-
|
|
172
|
-
${this.headline
|
|
173
|
-
? html `
|
|
156
|
+
` : html``}
|
|
157
|
+
${this.headline ? html`
|
|
174
158
|
<h2 slot="heading">${this.headline}</h2>
|
|
175
|
-
`
|
|
176
|
-
: html ``}
|
|
159
|
+
` : html``}
|
|
177
160
|
<slot></slot>
|
|
178
|
-
${this.footer
|
|
179
|
-
? html `
|
|
161
|
+
${this.footer ? html`
|
|
180
162
|
<div slot="footer">${this.footer}</div>
|
|
181
|
-
`
|
|
182
|
-
|
|
183
|
-
${this.secondaryLabel
|
|
184
|
-
? html `
|
|
163
|
+
` : html``}
|
|
164
|
+
${this.secondaryLabel ? html`
|
|
185
165
|
<sp-button
|
|
186
166
|
variant="primary"
|
|
187
167
|
treatment="outline"
|
|
@@ -190,10 +170,8 @@ export class DialogWrapper extends FocusVisiblePolyfillMixin(SpectrumElement) {
|
|
|
190
170
|
>
|
|
191
171
|
${this.secondaryLabel}
|
|
192
172
|
</sp-button>
|
|
193
|
-
`
|
|
194
|
-
|
|
195
|
-
${this.cancelLabel
|
|
196
|
-
? html `
|
|
173
|
+
` : html``}
|
|
174
|
+
${this.cancelLabel ? html`
|
|
197
175
|
<sp-button
|
|
198
176
|
variant="secondary"
|
|
199
177
|
treatment="outline"
|
|
@@ -202,10 +180,8 @@ export class DialogWrapper extends FocusVisiblePolyfillMixin(SpectrumElement) {
|
|
|
202
180
|
>
|
|
203
181
|
${this.cancelLabel}
|
|
204
182
|
</sp-button>
|
|
205
|
-
`
|
|
206
|
-
|
|
207
|
-
${this.confirmLabel
|
|
208
|
-
? html `
|
|
183
|
+
` : html``}
|
|
184
|
+
${this.confirmLabel ? html`
|
|
209
185
|
<sp-button
|
|
210
186
|
variant="accent"
|
|
211
187
|
slot="button"
|
|
@@ -213,84 +189,74 @@ export class DialogWrapper extends FocusVisiblePolyfillMixin(SpectrumElement) {
|
|
|
213
189
|
>
|
|
214
190
|
${this.confirmLabel}
|
|
215
191
|
</sp-button>
|
|
216
|
-
`
|
|
217
|
-
: html ``}
|
|
192
|
+
` : html``}
|
|
218
193
|
</sp-dialog>
|
|
219
194
|
</div>
|
|
220
195
|
`;
|
|
196
|
+
}
|
|
197
|
+
updated(changes) {
|
|
198
|
+
if (changes.has("open")) {
|
|
199
|
+
if (this.open) {
|
|
200
|
+
this.dialog.updateComplete.then(() => {
|
|
201
|
+
this.dialog.shouldManageTabOrderForScrolling();
|
|
202
|
+
});
|
|
203
|
+
} else {
|
|
204
|
+
this.tabIndex = 0;
|
|
205
|
+
}
|
|
221
206
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
this.tabIndex = 0;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Bind the open/close transition into the update complete lifecycle so
|
|
236
|
-
* that the overlay system can wait for it to be "visibly ready" before
|
|
237
|
-
* attempting to throw focus into the content contained herein. Not
|
|
238
|
-
* waiting for this can cause small amounts of page scroll to happen
|
|
239
|
-
* while opening the Tray when focusable content is included: e.g. Menu
|
|
240
|
-
* elements whose selected Menu Item is not the first Menu Item.
|
|
241
|
-
*/
|
|
242
|
-
async getUpdateComplete() {
|
|
243
|
-
const complete = (await super.getUpdateComplete());
|
|
244
|
-
await this.transitionPromise;
|
|
245
|
-
return complete;
|
|
246
|
-
}
|
|
207
|
+
}
|
|
208
|
+
async getUpdateComplete() {
|
|
209
|
+
const complete = await super.getUpdateComplete();
|
|
210
|
+
await this.transitionPromise;
|
|
211
|
+
return complete;
|
|
212
|
+
}
|
|
247
213
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
], DialogWrapper.prototype, "error",
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
], DialogWrapper.prototype, "cancelLabel",
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
], DialogWrapper.prototype, "confirmLabel",
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
], DialogWrapper.prototype, "dismissable",
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
], DialogWrapper.prototype, "footer",
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
], DialogWrapper.prototype, "hero",
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
], DialogWrapper.prototype, "heroLabel",
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
], DialogWrapper.prototype, "noDivider",
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
], DialogWrapper.prototype, "open",
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
], DialogWrapper.prototype, "mode",
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
], DialogWrapper.prototype, "size",
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
], DialogWrapper.prototype, "secondaryLabel",
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
], DialogWrapper.prototype, "headline",
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
], DialogWrapper.prototype, "responsive",
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
], DialogWrapper.prototype, "underlay",
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
], DialogWrapper.prototype, "dialog",
|
|
296
|
-
//# sourceMappingURL=DialogWrapper.js.map
|
|
214
|
+
__decorateClass([
|
|
215
|
+
property({ type: Boolean, reflect: true })
|
|
216
|
+
], DialogWrapper.prototype, "error", 2);
|
|
217
|
+
__decorateClass([
|
|
218
|
+
property({ attribute: "cancel-label" })
|
|
219
|
+
], DialogWrapper.prototype, "cancelLabel", 2);
|
|
220
|
+
__decorateClass([
|
|
221
|
+
property({ attribute: "confirm-label" })
|
|
222
|
+
], DialogWrapper.prototype, "confirmLabel", 2);
|
|
223
|
+
__decorateClass([
|
|
224
|
+
property({ type: Boolean, reflect: true })
|
|
225
|
+
], DialogWrapper.prototype, "dismissable", 2);
|
|
226
|
+
__decorateClass([
|
|
227
|
+
property()
|
|
228
|
+
], DialogWrapper.prototype, "footer", 2);
|
|
229
|
+
__decorateClass([
|
|
230
|
+
property()
|
|
231
|
+
], DialogWrapper.prototype, "hero", 2);
|
|
232
|
+
__decorateClass([
|
|
233
|
+
property({ attribute: "hero-label" })
|
|
234
|
+
], DialogWrapper.prototype, "heroLabel", 2);
|
|
235
|
+
__decorateClass([
|
|
236
|
+
property({ type: Boolean, reflect: true, attribute: "no-divider" })
|
|
237
|
+
], DialogWrapper.prototype, "noDivider", 2);
|
|
238
|
+
__decorateClass([
|
|
239
|
+
property({ type: Boolean, reflect: true })
|
|
240
|
+
], DialogWrapper.prototype, "open", 2);
|
|
241
|
+
__decorateClass([
|
|
242
|
+
property({ type: String, reflect: true })
|
|
243
|
+
], DialogWrapper.prototype, "mode", 2);
|
|
244
|
+
__decorateClass([
|
|
245
|
+
property({ type: String, reflect: true })
|
|
246
|
+
], DialogWrapper.prototype, "size", 2);
|
|
247
|
+
__decorateClass([
|
|
248
|
+
property({ attribute: "secondary-label" })
|
|
249
|
+
], DialogWrapper.prototype, "secondaryLabel", 2);
|
|
250
|
+
__decorateClass([
|
|
251
|
+
property()
|
|
252
|
+
], DialogWrapper.prototype, "headline", 2);
|
|
253
|
+
__decorateClass([
|
|
254
|
+
property({ type: Boolean })
|
|
255
|
+
], DialogWrapper.prototype, "responsive", 2);
|
|
256
|
+
__decorateClass([
|
|
257
|
+
property({ type: Boolean })
|
|
258
|
+
], DialogWrapper.prototype, "underlay", 2);
|
|
259
|
+
__decorateClass([
|
|
260
|
+
query("sp-dialog")
|
|
261
|
+
], DialogWrapper.prototype, "dialog", 2);
|
|
262
|
+
//# sourceMappingURL=DialogWrapper.js.map
|
package/src/DialogWrapper.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{"version":3,"file":"DialogWrapper.js","sourceRoot":"","sources":["DialogWrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EAEJ,eAAe,GAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,QAAQ,EACR,KAAK,GACR,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAE5E,OAAO,kDAAkD,CAAC;AAC1D,OAAO,8CAA8C,CAAC;AAEtD,OAAO,iBAAiB,CAAC;AACzB,OAAO,kBAAkB,MAAM,yDAAyD,CAAC;AACzF,OAAO,WAAW,MAAM,iDAAiD,CAAC;AAE1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAE7F;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAc,SAAQ,yBAAyB,CAAC,eAAe,CAAC;IAA7E;;QAMW,UAAK,GAAG,KAAK,CAAC;QAGd,gBAAW,GAAG,EAAE,CAAC;QAGjB,iBAAY,GAAG,EAAE,CAAC;QAGlB,gBAAW,GAAG,KAAK,CAAC;QAGpB,WAAM,GAAG,EAAE,CAAC;QAGZ,SAAI,GAAG,EAAE,CAAC;QAGV,cAAS,GAAG,EAAE,CAAC;QAGf,cAAS,GAAG,KAAK,CAAC;QAGlB,SAAI,GAAG,KAAK,CAAC;QASb,mBAAc,GAAG,EAAE,CAAC;QAGpB,aAAQ,GAAG,EAAE,CAAC;QAGd,eAAU,GAAG,KAAK,CAAC;QAElB,sBAAiB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;QAEtC,6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AE,CAAC;kDAChB;AAG3B;IADC,QAAQ,EAAE;6CACQ;AAGnB;IADC,QAAQ,EAAE;2CACM;AAGjB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;gDAChB;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;gDAC3C;AAGzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CACvB;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CACQ;AAGlD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CACZ;AAG9B;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;qDAChB;AAG3B;IADC,QAAQ,EAAE;+CACU;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDACF;AAS1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACJ;AAGxB;IADC,KAAK,CAAC,WAAW,CAAC;6CACK","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\nimport '../sp-dialog.js';\nimport modalWrapperStyles from '@spectrum-web-components/modal/src/modal-wrapper.css.js';\nimport modalStyles from '@spectrum-web-components/modal/src/modal.css.js';\nimport { Dialog } from './Dialog.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared';\nimport { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';\n\n/**\n * @element sp-dialog-wrapper\n *\n * @slot - content for the dialog\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @fires cancel - Announces that the \"cancel\" button has been clicked.\n * @fires confirm - Announces that the \"confirm\" button has been clicked.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogWrapper extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [modalWrapperStyles, modalStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ attribute: 'cancel-label' })\n public cancelLabel = '';\n\n @property({ attribute: 'confirm-label' })\n public confirmLabel = '';\n\n @property({ type: Boolean, reflect: true })\n public dismissable = false;\n\n @property()\n public footer = '';\n\n @property()\n public hero = '';\n\n @property({ attribute: 'hero-label' })\n public heroLabel = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n @property({ type: String, reflect: true })\n public mode?: 'fullscreen' | 'fullscreenTakeover';\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n @property({ attribute: 'secondary-label' })\n public secondaryLabel = '';\n\n @property()\n public headline = '';\n\n @property({ type: Boolean })\n public responsive = false;\n\n private transitionPromise = Promise.resolve();\n\n private resolveTransitionPromise = (): void => {\n return;\n };\n\n @property({ type: Boolean })\n public underlay = false;\n\n @query('sp-dialog')\n private dialog!: Dialog;\n\n public override focus(): void {\n if (this.shadowRoot) {\n const firstFocusable = firstFocusableIn(this.dialog);\n if (firstFocusable) {\n if (firstFocusable.updateComplete) {\n firstFocusable.updateComplete.then(() =>\n firstFocusable.focus()\n );\n /* c8 ignore next 3 */\n } else {\n firstFocusable.focus();\n }\n this.removeAttribute('tabindex');\n } else {\n this.dialog.focus();\n }\n /* c8 ignore next 3 */\n } else {\n super.focus();\n }\n }\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return false;\n this.close();\n return true;\n }\n\n private dismiss(): void {\n if (!this.dismissable) {\n return;\n }\n this.close();\n }\n\n private clickSecondary(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n })\n );\n }\n\n private clickCancel(): void {\n this.dispatchEvent(\n new Event('cancel', {\n bubbles: true,\n })\n );\n }\n\n private clickConfirm(): void {\n this.dispatchEvent(\n new Event('confirm', {\n bubbles: true,\n })\n );\n }\n\n protected handleClose(event: Event): void {\n event.stopPropagation();\n this.close();\n }\n\n public close(): void {\n this.open = false;\n }\n\n private dispatchClosed(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n protected handleUnderlayTransitionend(event: TransitionEvent): void {\n if (!this.open && event.propertyName === 'visibility') {\n this.dispatchClosed();\n this.resolveTransitionPromise();\n }\n }\n\n protected handleModalTransitionend(): void {\n if (this.open || !this.underlay) {\n this.resolveTransitionPromise();\n if (!this.open) {\n this.dispatchClosed();\n }\n }\n }\n\n protected override update(changes: PropertyValues<this>): void {\n if (changes.has('open') && changes.get('open') !== undefined) {\n this.transitionPromise = new Promise(\n (res) => (this.resolveTransitionPromise = res)\n );\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.underlay\n ? html`\n <sp-underlay\n ?open=${this.open}\n @click=${this.dismiss}\n @transitionend=${this.handleUnderlayTransitionend}\n ></sp-underlay>\n `\n : html``}\n <div\n class=\"modal ${this.mode}\"\n @transitionend=${this.handleModalTransitionend}\n >\n <sp-dialog\n ?dismissable=${this.dismissable}\n ?no-divider=${this.noDivider}\n ?error=${this.error}\n mode=${ifDefined(this.mode ? this.mode : undefined)}\n size=${ifDefined(this.size ? this.size : undefined)}\n @close=${this.handleClose}\n >\n ${this.hero\n ? html`\n <img\n src=\"${this.hero}\"\n slot=\"hero\"\n aria-hidden=${ifDefined(\n this.heroLabel ? undefined : 'true'\n )}\n alt=${ifDefined(\n this.heroLabel\n ? this.heroLabel\n : undefined\n )}\n />\n `\n : html``}\n ${this.headline\n ? html`\n <h2 slot=\"heading\">${this.headline}</h2>\n `\n : html``}\n <slot></slot>\n ${this.footer\n ? html`\n <div slot=\"footer\">${this.footer}</div>\n `\n : html``}\n ${this.secondaryLabel\n ? html`\n <sp-button\n variant=\"primary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickSecondary}\n >\n ${this.secondaryLabel}\n </sp-button>\n `\n : html``}\n ${this.cancelLabel\n ? html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickCancel}\n >\n ${this.cancelLabel}\n </sp-button>\n `\n : html``}\n ${this.confirmLabel\n ? html`\n <sp-button\n variant=\"accent\"\n slot=\"button\"\n @click=${this.clickConfirm}\n >\n ${this.confirmLabel}\n </sp-button>\n `\n : html``}\n </sp-dialog>\n </div>\n `;\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (changes.has('open')) {\n if (this.open) {\n this.dialog.updateComplete.then(() => {\n this.dialog.shouldManageTabOrderForScrolling();\n });\n } else {\n this.tabIndex = 0;\n }\n }\n }\n\n /**\n * Bind the open/close transition into the update complete lifecycle so\n * that the overlay system can wait for it to be \"visibly ready\" before\n * attempting to throw focus into the content contained herein. Not\n * waiting for this can cause small amounts of page scroll to happen\n * while opening the Tray when focusable content is included: e.g. Menu\n * elements whose selected Menu Item is not the first Menu Item.\n */\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.transitionPromise;\n return complete;\n }\n}\n"]}
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["DialogWrapper.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/underlay/sp-underlay.js';\nimport '@spectrum-web-components/button/sp-button.js';\n\nimport '../sp-dialog.js';\nimport modalWrapperStyles from '@spectrum-web-components/modal/src/modal-wrapper.css.js';\nimport modalStyles from '@spectrum-web-components/modal/src/modal.css.js';\nimport { Dialog } from './Dialog.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared';\nimport { firstFocusableIn } from '@spectrum-web-components/shared/src/first-focusable-in.js';\n\n/**\n * @element sp-dialog-wrapper\n *\n * @slot - content for the dialog\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @fires cancel - Announces that the \"cancel\" button has been clicked.\n * @fires confirm - Announces that the \"confirm\" button has been clicked.\n * @fires close - Announces that the dialog has been closed.\n */\nexport class DialogWrapper extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [modalWrapperStyles, modalStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public error = false;\n\n @property({ attribute: 'cancel-label' })\n public cancelLabel = '';\n\n @property({ attribute: 'confirm-label' })\n public confirmLabel = '';\n\n @property({ type: Boolean, reflect: true })\n public dismissable = false;\n\n @property()\n public footer = '';\n\n @property()\n public hero = '';\n\n @property({ attribute: 'hero-label' })\n public heroLabel = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'no-divider' })\n public noDivider = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n @property({ type: String, reflect: true })\n public mode?: 'fullscreen' | 'fullscreenTakeover';\n\n @property({ type: String, reflect: true })\n public size?: 's' | 'm' | 'l';\n\n @property({ attribute: 'secondary-label' })\n public secondaryLabel = '';\n\n @property()\n public headline = '';\n\n @property({ type: Boolean })\n public responsive = false;\n\n private transitionPromise = Promise.resolve();\n\n private resolveTransitionPromise = (): void => {\n return;\n };\n\n @property({ type: Boolean })\n public underlay = false;\n\n @query('sp-dialog')\n private dialog!: Dialog;\n\n public override focus(): void {\n if (this.shadowRoot) {\n const firstFocusable = firstFocusableIn(this.dialog);\n if (firstFocusable) {\n if (firstFocusable.updateComplete) {\n firstFocusable.updateComplete.then(() =>\n firstFocusable.focus()\n );\n /* c8 ignore next 3 */\n } else {\n firstFocusable.focus();\n }\n this.removeAttribute('tabindex');\n } else {\n this.dialog.focus();\n }\n /* c8 ignore next 3 */\n } else {\n super.focus();\n }\n }\n\n public overlayWillCloseCallback(): boolean {\n if (!this.open) return false;\n this.close();\n return true;\n }\n\n private dismiss(): void {\n if (!this.dismissable) {\n return;\n }\n this.close();\n }\n\n private clickSecondary(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n })\n );\n }\n\n private clickCancel(): void {\n this.dispatchEvent(\n new Event('cancel', {\n bubbles: true,\n })\n );\n }\n\n private clickConfirm(): void {\n this.dispatchEvent(\n new Event('confirm', {\n bubbles: true,\n })\n );\n }\n\n protected handleClose(event: Event): void {\n event.stopPropagation();\n this.close();\n }\n\n public close(): void {\n this.open = false;\n }\n\n private dispatchClosed(): void {\n this.dispatchEvent(\n new Event('close', {\n bubbles: true,\n })\n );\n }\n\n protected handleUnderlayTransitionend(event: TransitionEvent): void {\n if (!this.open && event.propertyName === 'visibility') {\n this.dispatchClosed();\n this.resolveTransitionPromise();\n }\n }\n\n protected handleModalTransitionend(): void {\n if (this.open || !this.underlay) {\n this.resolveTransitionPromise();\n if (!this.open) {\n this.dispatchClosed();\n }\n }\n }\n\n protected override update(changes: PropertyValues<this>): void {\n if (changes.has('open') && changes.get('open') !== undefined) {\n this.transitionPromise = new Promise(\n (res) => (this.resolveTransitionPromise = res)\n );\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.underlay\n ? html`\n <sp-underlay\n ?open=${this.open}\n @click=${this.dismiss}\n @transitionend=${this.handleUnderlayTransitionend}\n ></sp-underlay>\n `\n : html``}\n <div\n class=\"modal ${this.mode}\"\n @transitionend=${this.handleModalTransitionend}\n >\n <sp-dialog\n ?dismissable=${this.dismissable}\n ?no-divider=${this.noDivider}\n ?error=${this.error}\n mode=${ifDefined(this.mode ? this.mode : undefined)}\n size=${ifDefined(this.size ? this.size : undefined)}\n @close=${this.handleClose}\n >\n ${this.hero\n ? html`\n <img\n src=\"${this.hero}\"\n slot=\"hero\"\n aria-hidden=${ifDefined(\n this.heroLabel ? undefined : 'true'\n )}\n alt=${ifDefined(\n this.heroLabel\n ? this.heroLabel\n : undefined\n )}\n />\n `\n : html``}\n ${this.headline\n ? html`\n <h2 slot=\"heading\">${this.headline}</h2>\n `\n : html``}\n <slot></slot>\n ${this.footer\n ? html`\n <div slot=\"footer\">${this.footer}</div>\n `\n : html``}\n ${this.secondaryLabel\n ? html`\n <sp-button\n variant=\"primary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickSecondary}\n >\n ${this.secondaryLabel}\n </sp-button>\n `\n : html``}\n ${this.cancelLabel\n ? html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n slot=\"button\"\n @click=${this.clickCancel}\n >\n ${this.cancelLabel}\n </sp-button>\n `\n : html``}\n ${this.confirmLabel\n ? html`\n <sp-button\n variant=\"accent\"\n slot=\"button\"\n @click=${this.clickConfirm}\n >\n ${this.confirmLabel}\n </sp-button>\n `\n : html``}\n </sp-dialog>\n </div>\n `;\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (changes.has('open')) {\n if (this.open) {\n this.dialog.updateComplete.then(() => {\n this.dialog.shouldManageTabOrderForScrolling();\n });\n } else {\n this.tabIndex = 0;\n }\n }\n }\n\n /**\n * Bind the open/close transition into the update complete lifecycle so\n * that the overlay system can wait for it to be \"visibly ready\" before\n * attempting to throw focus into the content contained herein. Not\n * waiting for this can cause small amounts of page scroll to happen\n * while opening the Tray when focusable content is included: e.g. Menu\n * elements whose selected Menu Item is not the first Menu Item.\n */\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.transitionPromise;\n return complete;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAAA;AAIA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAWO,aAAM,sBAAsB,0BAA0B,eAAe,EAAE;AAAA,EAAvE;AAAA;AAMI,iBAAQ;AAGR,uBAAc;AAGd,wBAAe;AAGf,uBAAc;AAGd,kBAAS;AAGT,gBAAO;AAGP,qBAAY;AAGZ,qBAAY;AAGZ,gBAAO;AASP,0BAAiB;AAGjB,oBAAW;AAGX,sBAAa;AAEZ,6BAAoB,QAAQ,QAAQ;AAEpC,oCAA2B,MAAY;AAC3C;AAAA,IACJ;AAGO,oBAAW;AAAA;AAAA,aArDS,SAAyB;AAChD,WAAO,CAAC,oBAAoB,WAAW;AAAA,EAC3C;AAAA,EAwDgB,QAAc;AAC1B,QAAI,KAAK,YAAY;AACjB,YAAM,iBAAiB,iBAAiB,KAAK,MAAM;AACnD,UAAI,gBAAgB;AAChB,YAAI,eAAe,gBAAgB;AAC/B,yBAAe,eAAe,KAAK,MAC/B,eAAe,MAAM,CACzB;AAAA,QAEJ,OAAO;A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