@vaadin/confirm-dialog 24.2.3 → 24.3.0-alpha10
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 +15 -11
- package/src/vaadin-confirm-dialog-base-mixin.d.ts +29 -0
- package/src/vaadin-confirm-dialog-base-mixin.js +71 -0
- package/src/vaadin-confirm-dialog-mixin.d.ts +125 -0
- package/src/vaadin-confirm-dialog-mixin.js +451 -0
- package/src/vaadin-confirm-dialog-overlay-styles.d.ts +8 -0
- package/src/vaadin-confirm-dialog-overlay-styles.js +27 -0
- package/src/vaadin-confirm-dialog-overlay.js +6 -83
- package/src/vaadin-confirm-dialog.d.ts +3 -113
- package/src/vaadin-confirm-dialog.js +4 -414
- package/theme/lumo/vaadin-confirm-dialog-styles.js +1 -0
- package/theme/material/vaadin-confirm-dialog-styles.js +1 -0
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2018 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { setAriaIDReference } from '@vaadin/a11y-base/src/aria-id-reference.js';
|
|
7
|
+
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
8
|
+
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @polymerMixin
|
|
12
|
+
*/
|
|
13
|
+
export const ConfirmDialogMixin = (superClass) =>
|
|
14
|
+
class ConfirmDialogMixinClass extends superClass {
|
|
15
|
+
static get properties() {
|
|
16
|
+
return {
|
|
17
|
+
/**
|
|
18
|
+
* Sets the `aria-describedby` attribute of the overlay element.
|
|
19
|
+
*
|
|
20
|
+
* By default, all elements inside the message area are linked
|
|
21
|
+
* through the `aria-describedby` attribute. However, there are
|
|
22
|
+
* cases where this can confuse screen reader users (e.g. the dialog
|
|
23
|
+
* may present a password confirmation form). For these cases,
|
|
24
|
+
* it's better to associate only the elements that will help describe
|
|
25
|
+
* the confirmation dialog through this API.
|
|
26
|
+
*/
|
|
27
|
+
accessibleDescriptionRef: {
|
|
28
|
+
type: String,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* True if the overlay is currently displayed.
|
|
33
|
+
* @type {boolean}
|
|
34
|
+
*/
|
|
35
|
+
opened: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
value: false,
|
|
38
|
+
notify: true,
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Set the confirmation dialog title.
|
|
43
|
+
* @type {string}
|
|
44
|
+
*/
|
|
45
|
+
header: {
|
|
46
|
+
type: String,
|
|
47
|
+
value: '',
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Set the message or confirmation question.
|
|
52
|
+
*/
|
|
53
|
+
message: {
|
|
54
|
+
type: String,
|
|
55
|
+
value: '',
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Text displayed on confirm-button.
|
|
60
|
+
* This only affects the default button, custom slotted buttons will not be altered.
|
|
61
|
+
* @attr {string} confirm-text
|
|
62
|
+
* @type {string}
|
|
63
|
+
*/
|
|
64
|
+
confirmText: {
|
|
65
|
+
type: String,
|
|
66
|
+
value: 'Confirm',
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Theme for a confirm-button.
|
|
71
|
+
* This only affects the default button, custom slotted buttons will not be altered.
|
|
72
|
+
* @attr {string} confirm-theme
|
|
73
|
+
* @type {string}
|
|
74
|
+
*/
|
|
75
|
+
confirmTheme: {
|
|
76
|
+
type: String,
|
|
77
|
+
value: 'primary',
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Set to true to disable closing dialog on Escape press
|
|
82
|
+
* @attr {boolean} no-close-on-esc
|
|
83
|
+
* @type {boolean}
|
|
84
|
+
*/
|
|
85
|
+
noCloseOnEsc: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
value: false,
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Whether to show reject button or not.
|
|
92
|
+
* @attr {boolean} reject-button-visible
|
|
93
|
+
* @type {boolean}
|
|
94
|
+
*/
|
|
95
|
+
rejectButtonVisible: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
reflectToAttribute: true,
|
|
98
|
+
value: false,
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Text displayed on reject-button.
|
|
103
|
+
* This only affects the default button, custom slotted buttons will not be altered.
|
|
104
|
+
* @attr {string} reject-text
|
|
105
|
+
* @type {string}
|
|
106
|
+
*/
|
|
107
|
+
rejectText: {
|
|
108
|
+
type: String,
|
|
109
|
+
value: 'Reject',
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Theme for a reject-button.
|
|
114
|
+
* This only affects the default button, custom slotted buttons will not be altered.
|
|
115
|
+
* @attr {string} reject-theme
|
|
116
|
+
* @type {string}
|
|
117
|
+
*/
|
|
118
|
+
rejectTheme: {
|
|
119
|
+
type: String,
|
|
120
|
+
value: 'error tertiary',
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Whether to show cancel button or not.
|
|
125
|
+
* @attr {boolean} cancel-button-visible
|
|
126
|
+
* @type {boolean}
|
|
127
|
+
*/
|
|
128
|
+
cancelButtonVisible: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
reflectToAttribute: true,
|
|
131
|
+
value: false,
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Text displayed on cancel-button.
|
|
136
|
+
* This only affects the default button, custom slotted buttons will not be altered.
|
|
137
|
+
* @attr {string} cancel-text
|
|
138
|
+
* @type {string}
|
|
139
|
+
*/
|
|
140
|
+
cancelText: {
|
|
141
|
+
type: String,
|
|
142
|
+
value: 'Cancel',
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Theme for a cancel-button.
|
|
147
|
+
* This only affects the default button, custom slotted buttons will not be altered.
|
|
148
|
+
* @attr {string} cancel-theme
|
|
149
|
+
* @type {string}
|
|
150
|
+
*/
|
|
151
|
+
cancelTheme: {
|
|
152
|
+
type: String,
|
|
153
|
+
value: 'tertiary',
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* A space-delimited list of CSS class names
|
|
158
|
+
* to set on the underlying overlay element.
|
|
159
|
+
*
|
|
160
|
+
* @attr {string} overlay-class
|
|
161
|
+
*/
|
|
162
|
+
overlayClass: {
|
|
163
|
+
type: String,
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* A reference to the "Cancel" button which will be teleported to the overlay.
|
|
168
|
+
* @private
|
|
169
|
+
*/
|
|
170
|
+
_cancelButton: {
|
|
171
|
+
type: Object,
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* A reference to the "Confirm" button which will be teleported to the overlay.
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
_confirmButton: {
|
|
179
|
+
type: Object,
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* A reference to the "header" node which will be teleported to the overlay.
|
|
184
|
+
* @private
|
|
185
|
+
*/
|
|
186
|
+
_headerNode: {
|
|
187
|
+
type: Object,
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* A list of message nodes which will be placed in the overlay default slot.
|
|
192
|
+
* @private
|
|
193
|
+
*/
|
|
194
|
+
_messageNodes: {
|
|
195
|
+
type: Array,
|
|
196
|
+
value: () => [],
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* A reference to the overlay element.
|
|
201
|
+
* @private
|
|
202
|
+
*/
|
|
203
|
+
_overlayElement: {
|
|
204
|
+
type: Object,
|
|
205
|
+
sync: true,
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* A reference to the "Reject" button which will be teleported to the overlay.
|
|
210
|
+
* @private
|
|
211
|
+
*/
|
|
212
|
+
_rejectButton: {
|
|
213
|
+
type: Object,
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Height to be set on the overlay content.
|
|
218
|
+
* @protected
|
|
219
|
+
*/
|
|
220
|
+
_contentHeight: {
|
|
221
|
+
type: String,
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Width to be set on the overlay content.
|
|
226
|
+
* @protected
|
|
227
|
+
*/
|
|
228
|
+
_contentWidth: {
|
|
229
|
+
type: String,
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
static get observers() {
|
|
235
|
+
return [
|
|
236
|
+
'__updateConfirmButton(_confirmButton, confirmText, confirmTheme)',
|
|
237
|
+
'__updateCancelButton(_cancelButton, cancelText, cancelTheme, cancelButtonVisible)',
|
|
238
|
+
'__updateHeaderNode(_headerNode, header)',
|
|
239
|
+
'__updateMessageNodes(_messageNodes, message)',
|
|
240
|
+
'__updateRejectButton(_rejectButton, rejectText, rejectTheme, rejectButtonVisible)',
|
|
241
|
+
'__accessibleDescriptionRefChanged(_overlayElement, _messageNodes, accessibleDescriptionRef)',
|
|
242
|
+
];
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
constructor() {
|
|
246
|
+
super();
|
|
247
|
+
|
|
248
|
+
this.__cancel = this.__cancel.bind(this);
|
|
249
|
+
this.__confirm = this.__confirm.bind(this);
|
|
250
|
+
this.__reject = this.__reject.bind(this);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
get __slottedNodes() {
|
|
254
|
+
return [this._headerNode, ...this._messageNodes, this._cancelButton, this._confirmButton, this._rejectButton];
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** @protected */
|
|
258
|
+
ready() {
|
|
259
|
+
super.ready();
|
|
260
|
+
|
|
261
|
+
this._headerController = new SlotController(this, 'header', 'h3', {
|
|
262
|
+
initializer: (node) => {
|
|
263
|
+
this._headerNode = node;
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
this.addController(this._headerController);
|
|
267
|
+
|
|
268
|
+
this._messageController = new SlotController(this, '', 'div', {
|
|
269
|
+
// Allow providing multiple custom nodes in the default slot
|
|
270
|
+
multiple: true,
|
|
271
|
+
observe: false,
|
|
272
|
+
initializer: (node) => {
|
|
273
|
+
const wrapper = document.createElement('div');
|
|
274
|
+
wrapper.style.display = 'contents';
|
|
275
|
+
const wrapperId = `confirm-dialog-message-${generateUniqueId()}`;
|
|
276
|
+
wrapper.id = wrapperId;
|
|
277
|
+
this.appendChild(wrapper);
|
|
278
|
+
wrapper.appendChild(node);
|
|
279
|
+
this._messageNodes = [...this._messageNodes, wrapper];
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
this.addController(this._messageController);
|
|
283
|
+
|
|
284
|
+
// NOTE: order in which buttons are added should match the order of slots in template
|
|
285
|
+
this._cancelController = new SlotController(this, 'cancel-button', 'vaadin-button', {
|
|
286
|
+
initializer: (button) => {
|
|
287
|
+
this.__setupSlottedButton('cancel', button);
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
this.addController(this._cancelController);
|
|
291
|
+
|
|
292
|
+
this._rejectController = new SlotController(this, 'reject-button', 'vaadin-button', {
|
|
293
|
+
initializer: (button) => {
|
|
294
|
+
this.__setupSlottedButton('reject', button);
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
this.addController(this._rejectController);
|
|
298
|
+
|
|
299
|
+
this._confirmController = new SlotController(this, 'confirm-button', 'vaadin-button', {
|
|
300
|
+
initializer: (button) => {
|
|
301
|
+
this.__setupSlottedButton('confirm', button);
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
this.addController(this._confirmController);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** @protected */
|
|
308
|
+
_initOverlay(overlay) {
|
|
309
|
+
overlay.addEventListener('vaadin-overlay-escape-press', this._escPressed.bind(this));
|
|
310
|
+
overlay.addEventListener('vaadin-overlay-open', () => this.__onDialogOpened());
|
|
311
|
+
overlay.addEventListener('vaadin-overlay-closed', () => this.__onDialogClosed());
|
|
312
|
+
overlay.setAttribute('role', 'alertdialog');
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** @private */
|
|
316
|
+
__onDialogOpened() {
|
|
317
|
+
const overlay = this._overlayElement;
|
|
318
|
+
|
|
319
|
+
// Teleport slotted nodes to the overlay element.
|
|
320
|
+
this.__slottedNodes.forEach((node) => {
|
|
321
|
+
overlay.appendChild(node);
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
const confirmButton = overlay.querySelector('[slot="confirm-button"]');
|
|
325
|
+
if (confirmButton) {
|
|
326
|
+
confirmButton.focus();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/** @private */
|
|
331
|
+
__onDialogClosed() {
|
|
332
|
+
// Move nodes from the overlay back to the host.
|
|
333
|
+
this.__slottedNodes.forEach((node) => {
|
|
334
|
+
this.appendChild(node);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** @private */
|
|
339
|
+
__accessibleDescriptionRefChanged(overlay, messageNodes, accessibleDescriptionRef) {
|
|
340
|
+
if (!overlay || !messageNodes) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (accessibleDescriptionRef !== undefined) {
|
|
345
|
+
setAriaIDReference(overlay, 'aria-describedby', {
|
|
346
|
+
newId: accessibleDescriptionRef,
|
|
347
|
+
oldId: this.__oldAccessibleDescriptionRef,
|
|
348
|
+
fromUser: true,
|
|
349
|
+
});
|
|
350
|
+
} else {
|
|
351
|
+
messageNodes.forEach((node) => {
|
|
352
|
+
setAriaIDReference(overlay, 'aria-describedby', { newId: node.id });
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
this.__oldAccessibleDescriptionRef = accessibleDescriptionRef;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/** @private */
|
|
360
|
+
__setupSlottedButton(type, button) {
|
|
361
|
+
const property = `_${type}Button`;
|
|
362
|
+
const listener = `__${type}`;
|
|
363
|
+
|
|
364
|
+
if (this[property] && this[property] !== button) {
|
|
365
|
+
this[property].remove();
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
button.addEventListener('click', this[listener]);
|
|
369
|
+
this[property] = button;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/** @private */
|
|
373
|
+
__updateCancelButton(button, cancelText, cancelTheme, showCancel) {
|
|
374
|
+
if (button) {
|
|
375
|
+
if (button === this._cancelController.defaultNode) {
|
|
376
|
+
button.textContent = cancelText;
|
|
377
|
+
button.setAttribute('theme', cancelTheme);
|
|
378
|
+
}
|
|
379
|
+
button.toggleAttribute('hidden', !showCancel);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** @private */
|
|
384
|
+
__updateConfirmButton(button, confirmText, confirmTheme) {
|
|
385
|
+
if (button && button === this._confirmController.defaultNode) {
|
|
386
|
+
button.textContent = confirmText;
|
|
387
|
+
button.setAttribute('theme', confirmTheme);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/** @private */
|
|
392
|
+
__updateHeaderNode(headerNode, header) {
|
|
393
|
+
// Only update text content for the default header node.
|
|
394
|
+
if (headerNode && headerNode === this._headerController.defaultNode) {
|
|
395
|
+
headerNode.textContent = header;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/** @private */
|
|
400
|
+
__updateMessageNodes(nodes, message) {
|
|
401
|
+
if (nodes && nodes.length > 0) {
|
|
402
|
+
const defaultWrapperNode = nodes.find(
|
|
403
|
+
(node) => this._messageController.defaultNode && node === this._messageController.defaultNode.parentElement,
|
|
404
|
+
);
|
|
405
|
+
if (defaultWrapperNode) {
|
|
406
|
+
defaultWrapperNode.firstChild.textContent = message;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/** @private */
|
|
412
|
+
__updateRejectButton(button, rejectText, rejectTheme, showReject) {
|
|
413
|
+
if (button) {
|
|
414
|
+
if (button === this._rejectController.defaultNode) {
|
|
415
|
+
button.textContent = rejectText;
|
|
416
|
+
button.setAttribute('theme', rejectTheme);
|
|
417
|
+
}
|
|
418
|
+
button.toggleAttribute('hidden', !showReject);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/** @private */
|
|
423
|
+
_escPressed(event) {
|
|
424
|
+
if (!event.defaultPrevented) {
|
|
425
|
+
this.__cancel();
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/** @private */
|
|
430
|
+
__confirm() {
|
|
431
|
+
this.dispatchEvent(new CustomEvent('confirm'));
|
|
432
|
+
this.opened = false;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/** @private */
|
|
436
|
+
__cancel() {
|
|
437
|
+
this.dispatchEvent(new CustomEvent('cancel'));
|
|
438
|
+
this.opened = false;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/** @private */
|
|
442
|
+
__reject() {
|
|
443
|
+
this.dispatchEvent(new CustomEvent('reject'));
|
|
444
|
+
this.opened = false;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/** @private */
|
|
448
|
+
_getAriaLabel(header) {
|
|
449
|
+
return header || 'confirmation';
|
|
450
|
+
}
|
|
451
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2018 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const confirmDialogOverlay = css`
|
|
9
|
+
:host {
|
|
10
|
+
--_vaadin-confirm-dialog-content-width: auto;
|
|
11
|
+
--_vaadin-confirm-dialog-content-height: auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[part='overlay'] {
|
|
15
|
+
width: var(--_vaadin-confirm-dialog-content-width);
|
|
16
|
+
height: var(--_vaadin-confirm-dialog-content-height);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
::slotted([slot='header']) {
|
|
20
|
+
pointer-events: auto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Make buttons clickable */
|
|
24
|
+
[part='footer'] > * {
|
|
25
|
+
pointer-events: all;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
@@ -11,29 +11,10 @@ import { DialogBaseMixin } from '@vaadin/dialog/src/vaadin-dialog-base-mixin.js'
|
|
|
11
11
|
import { dialogOverlay } from '@vaadin/dialog/src/vaadin-dialog-styles.js';
|
|
12
12
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
13
13
|
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
14
|
-
import {
|
|
14
|
+
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
15
15
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
:host {
|
|
19
|
-
--_vaadin-confirm-dialog-content-width: auto;
|
|
20
|
-
--_vaadin-confirm-dialog-content-height: auto;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
[part='overlay'] {
|
|
24
|
-
width: var(--_vaadin-confirm-dialog-content-width);
|
|
25
|
-
height: var(--_vaadin-confirm-dialog-content-height);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
::slotted([slot='header']) {
|
|
29
|
-
pointer-events: auto;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/* Make buttons clickable */
|
|
33
|
-
[part='footer'] > * {
|
|
34
|
-
pointer-events: all;
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
16
|
+
import { ConfirmDialogBaseMixin } from './vaadin-confirm-dialog-base-mixin.js';
|
|
17
|
+
import { confirmDialogOverlay } from './vaadin-confirm-dialog-overlay-styles.js';
|
|
37
18
|
|
|
38
19
|
registerStyles('vaadin-confirm-dialog-overlay', [overlayStyles, dialogOverlay, confirmDialogOverlay], {
|
|
39
20
|
moduleId: 'vaadin-confirm-dialog-overlay-styles',
|
|
@@ -98,7 +79,9 @@ defineCustomElement(ConfirmDialogOverlay);
|
|
|
98
79
|
* An element used internally by `<vaadin-confirm-dialog>`. Not intended to be used separately.
|
|
99
80
|
* @private
|
|
100
81
|
*/
|
|
101
|
-
class ConfirmDialogDialog extends
|
|
82
|
+
class ConfirmDialogDialog extends ConfirmDialogBaseMixin(
|
|
83
|
+
DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(PolymerElement))),
|
|
84
|
+
) {
|
|
102
85
|
static get is() {
|
|
103
86
|
return 'vaadin-confirm-dialog-dialog';
|
|
104
87
|
}
|
|
@@ -127,66 +110,6 @@ class ConfirmDialogDialog extends DialogBaseMixin(OverlayClassMixin(ThemePropert
|
|
|
127
110
|
></vaadin-confirm-dialog-overlay>
|
|
128
111
|
`;
|
|
129
112
|
}
|
|
130
|
-
|
|
131
|
-
static get properties() {
|
|
132
|
-
return {
|
|
133
|
-
/**
|
|
134
|
-
* Set the `aria-label` attribute for assistive technologies like
|
|
135
|
-
* screen readers. An empty string value for this property (the
|
|
136
|
-
* default) means that the `aria-label` attribute is not present.
|
|
137
|
-
*/
|
|
138
|
-
ariaLabel: {
|
|
139
|
-
type: String,
|
|
140
|
-
value: '',
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Height to be set on the overlay content.
|
|
145
|
-
*/
|
|
146
|
-
contentHeight: {
|
|
147
|
-
type: String,
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Width to be set on the overlay content.
|
|
152
|
-
*/
|
|
153
|
-
contentWidth: {
|
|
154
|
-
type: String,
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
static get observers() {
|
|
160
|
-
return [
|
|
161
|
-
'__updateContentHeight(contentHeight, _overlayElement)',
|
|
162
|
-
'__updateContentWidth(contentWidth, _overlayElement)',
|
|
163
|
-
];
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/** @private */
|
|
167
|
-
__updateDimension(overlay, dimension, value) {
|
|
168
|
-
const prop = `--_vaadin-confirm-dialog-content-${dimension}`;
|
|
169
|
-
|
|
170
|
-
if (value) {
|
|
171
|
-
overlay.style.setProperty(prop, value);
|
|
172
|
-
} else {
|
|
173
|
-
overlay.style.removeProperty(prop);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/** @private */
|
|
178
|
-
__updateContentHeight(height, overlay) {
|
|
179
|
-
if (overlay) {
|
|
180
|
-
this.__updateDimension(overlay, 'height', height);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/** @private */
|
|
185
|
-
__updateContentWidth(width, overlay) {
|
|
186
|
-
if (overlay) {
|
|
187
|
-
this.__updateDimension(overlay, 'width', width);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
113
|
}
|
|
191
114
|
|
|
192
115
|
defineCustomElement(ConfirmDialogDialog);
|