@vaadin/confirm-dialog 25.0.0-alpha2 → 25.0.0-alpha21
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 +12 -13
- package/src/{vaadin-confirm-dialog-overlay-styles.d.ts → styles/vaadin-confirm-dialog-overlay-base-styles.d.ts} +1 -1
- package/src/styles/vaadin-confirm-dialog-overlay-base-styles.js +39 -0
- package/src/vaadin-confirm-dialog-mixin.d.ts +6 -13
- package/src/vaadin-confirm-dialog-mixin.js +67 -95
- package/src/vaadin-confirm-dialog-overlay.js +49 -68
- package/src/vaadin-confirm-dialog.d.ts +5 -8
- package/src/vaadin-confirm-dialog.js +37 -25
- package/vaadin-confirm-dialog.js +1 -1
- package/web-types.json +50 -28
- package/web-types.lit.json +18 -11
- package/src/vaadin-confirm-dialog-base-mixin.d.ts +0 -29
- package/src/vaadin-confirm-dialog-base-mixin.js +0 -71
- package/src/vaadin-confirm-dialog-overlay-styles.js +0 -31
- package/theme/lumo/vaadin-confirm-dialog-styles.d.ts +0 -2
- package/theme/lumo/vaadin-confirm-dialog-styles.js +0 -50
- package/theme/lumo/vaadin-confirm-dialog.d.ts +0 -3
- package/theme/lumo/vaadin-confirm-dialog.js +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/confirm-dialog",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha21",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
-
"theme",
|
|
25
24
|
"vaadin-*.d.ts",
|
|
26
25
|
"vaadin-*.js",
|
|
27
26
|
"web-types.json",
|
|
@@ -35,24 +34,24 @@
|
|
|
35
34
|
],
|
|
36
35
|
"dependencies": {
|
|
37
36
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/button": "25.0.0-
|
|
39
|
-
"@vaadin/component-base": "25.0.0-
|
|
40
|
-
"@vaadin/dialog": "25.0.0-
|
|
41
|
-
"@vaadin/overlay": "25.0.0-
|
|
42
|
-
"@vaadin/vaadin-
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
|
|
37
|
+
"@vaadin/button": "25.0.0-alpha21",
|
|
38
|
+
"@vaadin/component-base": "25.0.0-alpha21",
|
|
39
|
+
"@vaadin/dialog": "25.0.0-alpha21",
|
|
40
|
+
"@vaadin/overlay": "25.0.0-alpha21",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha21",
|
|
44
42
|
"lit": "^3.0.0"
|
|
45
43
|
},
|
|
46
44
|
"devDependencies": {
|
|
47
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
48
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
49
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
45
|
+
"@vaadin/a11y-base": "25.0.0-alpha21",
|
|
46
|
+
"@vaadin/chai-plugins": "25.0.0-alpha21",
|
|
47
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha21",
|
|
50
48
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
51
|
-
"
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha21",
|
|
50
|
+
"sinon": "^21.0.0"
|
|
52
51
|
},
|
|
53
52
|
"web-types": [
|
|
54
53
|
"web-types.json",
|
|
55
54
|
"web-types.lit.json"
|
|
56
55
|
],
|
|
57
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "8fb9e9710c01449edf623a1aaac4655cdc11a933"
|
|
58
57
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2018 - 2025 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
|
+
import { dialogOverlayBase } from '@vaadin/dialog/src/styles/vaadin-dialog-overlay-base-styles.js';
|
|
8
|
+
import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-base-styles.js';
|
|
9
|
+
|
|
10
|
+
const confirmDialogOverlay = css`
|
|
11
|
+
:host {
|
|
12
|
+
--vaadin-dialog-min-width: var(--vaadin-confirm-dialog-min-width, 15em);
|
|
13
|
+
--vaadin-dialog-max-width: var(--vaadin-confirm-dialog-max-width, 25em);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
::slotted([slot='header']) {
|
|
17
|
+
display: contents;
|
|
18
|
+
font: inherit !important;
|
|
19
|
+
color: inherit !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[part='header'] {
|
|
23
|
+
color: var(--vaadin-dialog-title-color, var(--vaadin-text-color));
|
|
24
|
+
font-weight: var(--vaadin-dialog-title-font-weight, 600);
|
|
25
|
+
font-size: var(--vaadin-dialog-title-font-size, 1em);
|
|
26
|
+
line-height: var(--vaadin-dialog-title-line-height, inherit);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[part='overlay'] {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[part='content'] {
|
|
35
|
+
flex: 1;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
export const confirmDialogOverlayStyles = [overlayStyles, dialogOverlayBase, confirmDialogOverlay];
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { DialogSizeMixinClass } from '@vaadin/dialog/src/vaadin-dialog-size-mixin.js';
|
|
7
8
|
|
|
8
9
|
/*
|
|
9
10
|
* Fired when the `opened` property changes.
|
|
@@ -31,14 +32,14 @@ export type ConfirmDialogEventMap = ConfirmDialogCustomEventMap & HTMLElementEve
|
|
|
31
32
|
|
|
32
33
|
export declare function ConfirmDialogMixin<T extends Constructor<HTMLElement>>(
|
|
33
34
|
base: T,
|
|
34
|
-
): Constructor<ConfirmDialogMixinClass> & T;
|
|
35
|
+
): Constructor<ConfirmDialogMixinClass> & Constructor<DialogSizeMixinClass> & T;
|
|
35
36
|
|
|
36
37
|
export declare class ConfirmDialogMixinClass {
|
|
37
38
|
/**
|
|
38
|
-
* Sets the `aria-describedby` attribute of the
|
|
39
|
+
* Sets the `aria-describedby` attribute of the dialog.
|
|
39
40
|
*
|
|
40
|
-
* By default, all elements inside the message area
|
|
41
|
-
*
|
|
41
|
+
* By default, the text contents of all elements inside the message area
|
|
42
|
+
* are combined into the `aria-description` attribute. However, there are
|
|
42
43
|
* cases where this can confuse screen reader users (e.g. the dialog
|
|
43
44
|
* may present a password confirmation form). For these cases,
|
|
44
45
|
* it's better to associate only the elements that will help describe
|
|
@@ -48,7 +49,7 @@ export declare class ConfirmDialogMixinClass {
|
|
|
48
49
|
accessibleDescriptionRef: string | null | undefined;
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
|
-
* True if the
|
|
52
|
+
* True if the dialog is visible and available for interaction.
|
|
52
53
|
*/
|
|
53
54
|
opened: boolean;
|
|
54
55
|
|
|
@@ -121,12 +122,4 @@ export declare class ConfirmDialogMixinClass {
|
|
|
121
122
|
* @attr {string} cancel-theme
|
|
122
123
|
*/
|
|
123
124
|
cancelTheme: string;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* A space-delimited list of CSS class names
|
|
127
|
-
* to set on the underlying overlay element.
|
|
128
|
-
*
|
|
129
|
-
* @attr {string} overlay-class
|
|
130
|
-
*/
|
|
131
|
-
overlayClass: string;
|
|
132
125
|
}
|
|
@@ -5,20 +5,21 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { setAriaIDReference } from '@vaadin/a11y-base/src/aria-id-reference.js';
|
|
7
7
|
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
8
|
-
import {
|
|
8
|
+
import { DialogSizeMixin } from '@vaadin/dialog/src/vaadin-dialog-size-mixin.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @polymerMixin
|
|
12
|
+
* @mixes DialogSizeMixin
|
|
12
13
|
*/
|
|
13
14
|
export const ConfirmDialogMixin = (superClass) =>
|
|
14
|
-
class ConfirmDialogMixinClass extends superClass {
|
|
15
|
+
class ConfirmDialogMixinClass extends DialogSizeMixin(superClass) {
|
|
15
16
|
static get properties() {
|
|
16
17
|
return {
|
|
17
18
|
/**
|
|
18
|
-
* Sets the `aria-describedby` attribute of the
|
|
19
|
+
* Sets the `aria-describedby` attribute of the dialog.
|
|
19
20
|
*
|
|
20
|
-
* By default, all elements inside the message area
|
|
21
|
-
*
|
|
21
|
+
* By default, the text contents of all elements inside the message area
|
|
22
|
+
* are combined into the `aria-description` attribute. However, there are
|
|
22
23
|
* cases where this can confuse screen reader users (e.g. the dialog
|
|
23
24
|
* may present a password confirmation form). For these cases,
|
|
24
25
|
* it's better to associate only the elements that will help describe
|
|
@@ -29,11 +30,12 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
29
30
|
},
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
|
-
* True if the
|
|
33
|
+
* True if the dialog is visible and available for interaction.
|
|
33
34
|
* @type {boolean}
|
|
34
35
|
*/
|
|
35
36
|
opened: {
|
|
36
37
|
type: Boolean,
|
|
38
|
+
reflectToAttribute: true,
|
|
37
39
|
value: false,
|
|
38
40
|
notify: true,
|
|
39
41
|
sync: true,
|
|
@@ -154,16 +156,6 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
154
156
|
value: 'tertiary',
|
|
155
157
|
},
|
|
156
158
|
|
|
157
|
-
/**
|
|
158
|
-
* A space-delimited list of CSS class names
|
|
159
|
-
* to set on the underlying overlay element.
|
|
160
|
-
*
|
|
161
|
-
* @attr {string} overlay-class
|
|
162
|
-
*/
|
|
163
|
-
overlayClass: {
|
|
164
|
-
type: String,
|
|
165
|
-
},
|
|
166
|
-
|
|
167
159
|
/**
|
|
168
160
|
* A reference to the "Cancel" button which will be teleported to the overlay.
|
|
169
161
|
* @private
|
|
@@ -197,15 +189,6 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
197
189
|
value: () => [],
|
|
198
190
|
},
|
|
199
191
|
|
|
200
|
-
/**
|
|
201
|
-
* A reference to the overlay element.
|
|
202
|
-
* @private
|
|
203
|
-
*/
|
|
204
|
-
_overlayElement: {
|
|
205
|
-
type: Object,
|
|
206
|
-
sync: true,
|
|
207
|
-
},
|
|
208
|
-
|
|
209
192
|
/**
|
|
210
193
|
* A reference to the "Reject" button which will be teleported to the overlay.
|
|
211
194
|
* @private
|
|
@@ -213,22 +196,6 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
213
196
|
_rejectButton: {
|
|
214
197
|
type: Object,
|
|
215
198
|
},
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Height to be set on the overlay content.
|
|
219
|
-
* @protected
|
|
220
|
-
*/
|
|
221
|
-
_contentHeight: {
|
|
222
|
-
type: String,
|
|
223
|
-
},
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Width to be set on the overlay content.
|
|
227
|
-
* @protected
|
|
228
|
-
*/
|
|
229
|
-
_contentWidth: {
|
|
230
|
-
type: String,
|
|
231
|
-
},
|
|
232
199
|
};
|
|
233
200
|
}
|
|
234
201
|
|
|
@@ -239,7 +206,7 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
239
206
|
'__updateHeaderNode(_headerNode, header)',
|
|
240
207
|
'__updateMessageNodes(_messageNodes, message)',
|
|
241
208
|
'__updateRejectButton(_rejectButton, rejectText, rejectTheme, rejectButtonVisible)',
|
|
242
|
-
'__accessibleDescriptionRefChanged(
|
|
209
|
+
'__accessibleDescriptionRefChanged(_messageNodes, accessibleDescriptionRef)',
|
|
243
210
|
];
|
|
244
211
|
}
|
|
245
212
|
|
|
@@ -251,14 +218,37 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
251
218
|
this.__reject = this.__reject.bind(this);
|
|
252
219
|
}
|
|
253
220
|
|
|
254
|
-
|
|
255
|
-
|
|
221
|
+
/** @protected */
|
|
222
|
+
connectedCallback() {
|
|
223
|
+
super.connectedCallback();
|
|
224
|
+
// Restore opened state if overlay was opened when disconnecting
|
|
225
|
+
if (this.__restoreOpened) {
|
|
226
|
+
this.opened = true;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** @protected */
|
|
231
|
+
disconnectedCallback() {
|
|
232
|
+
super.disconnectedCallback();
|
|
233
|
+
// Automatically close the overlay when dialog is removed from DOM
|
|
234
|
+
// Using a timeout to avoid toggling opened state, and dispatching change
|
|
235
|
+
// events, when just moving the dialog in the DOM
|
|
236
|
+
setTimeout(() => {
|
|
237
|
+
if (!this.isConnected) {
|
|
238
|
+
this.__restoreOpened = this.opened;
|
|
239
|
+
this.opened = false;
|
|
240
|
+
}
|
|
241
|
+
});
|
|
256
242
|
}
|
|
257
243
|
|
|
258
244
|
/** @protected */
|
|
259
245
|
ready() {
|
|
260
246
|
super.ready();
|
|
261
247
|
|
|
248
|
+
this.role = 'alertdialog';
|
|
249
|
+
this.setAttribute('aria-modal', 'true');
|
|
250
|
+
this.setAttribute('tabindex', '0');
|
|
251
|
+
|
|
262
252
|
this._headerController = new SlotController(this, 'header', 'h3', {
|
|
263
253
|
initializer: (node) => {
|
|
264
254
|
this._headerNode = node;
|
|
@@ -271,13 +261,7 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
271
261
|
multiple: true,
|
|
272
262
|
observe: false,
|
|
273
263
|
initializer: (node) => {
|
|
274
|
-
|
|
275
|
-
wrapper.style.display = 'contents';
|
|
276
|
-
const wrapperId = `confirm-dialog-message-${generateUniqueId()}`;
|
|
277
|
-
wrapper.id = wrapperId;
|
|
278
|
-
this.appendChild(wrapper);
|
|
279
|
-
wrapper.appendChild(node);
|
|
280
|
-
this._messageNodes = [...this._messageNodes, wrapper];
|
|
264
|
+
this._messageNodes = [...this._messageNodes, node];
|
|
281
265
|
},
|
|
282
266
|
});
|
|
283
267
|
this.addController(this._messageController);
|
|
@@ -304,59 +288,47 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
304
288
|
});
|
|
305
289
|
this.addController(this._confirmController);
|
|
306
290
|
|
|
307
|
-
this._overlayElement = this.$.
|
|
308
|
-
|
|
309
|
-
this._initOverlay(this._overlayElement);
|
|
291
|
+
this._overlayElement = this.$.overlay;
|
|
310
292
|
}
|
|
311
293
|
|
|
312
294
|
/** @protected */
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
295
|
+
updated(props) {
|
|
296
|
+
super.updated(props);
|
|
297
|
+
|
|
298
|
+
if (props.has('header')) {
|
|
299
|
+
this.ariaLabel = this.header || 'confirmation';
|
|
300
|
+
}
|
|
318
301
|
}
|
|
319
302
|
|
|
320
|
-
/** @
|
|
303
|
+
/** @protected */
|
|
321
304
|
__onDialogOpened() {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
// Teleport slotted nodes to the overlay element.
|
|
325
|
-
this.__slottedNodes.forEach((node) => {
|
|
326
|
-
overlay.appendChild(node);
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
const confirmButton = overlay.querySelector('[slot="confirm-button"]');
|
|
330
|
-
if (confirmButton) {
|
|
331
|
-
confirmButton.focus();
|
|
305
|
+
if (this._confirmButton) {
|
|
306
|
+
this._confirmButton.focus();
|
|
332
307
|
}
|
|
333
308
|
}
|
|
334
309
|
|
|
335
|
-
/** @
|
|
310
|
+
/** @protected */
|
|
336
311
|
__onDialogClosed() {
|
|
337
|
-
// Move nodes from the overlay back to the host.
|
|
338
|
-
this.__slottedNodes.forEach((node) => {
|
|
339
|
-
this.appendChild(node);
|
|
340
|
-
});
|
|
341
312
|
this.dispatchEvent(new CustomEvent('closed'));
|
|
342
313
|
}
|
|
343
314
|
|
|
344
315
|
/** @private */
|
|
345
|
-
__accessibleDescriptionRefChanged(
|
|
346
|
-
if (!
|
|
316
|
+
__accessibleDescriptionRefChanged(messageNodes, accessibleDescriptionRef) {
|
|
317
|
+
if (!messageNodes) {
|
|
347
318
|
return;
|
|
348
319
|
}
|
|
349
320
|
|
|
350
|
-
if (accessibleDescriptionRef
|
|
351
|
-
|
|
321
|
+
if (accessibleDescriptionRef) {
|
|
322
|
+
this.removeAttribute('aria-description');
|
|
323
|
+
setAriaIDReference(this, 'aria-describedby', {
|
|
352
324
|
newId: accessibleDescriptionRef,
|
|
353
325
|
oldId: this.__oldAccessibleDescriptionRef,
|
|
354
326
|
fromUser: true,
|
|
355
327
|
});
|
|
356
328
|
} else {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
329
|
+
this.removeAttribute('aria-describedby');
|
|
330
|
+
const ariaDescription = messageNodes.map((node) => node.textContent.trim()).join(' ');
|
|
331
|
+
this.setAttribute('aria-description', ariaDescription);
|
|
360
332
|
}
|
|
361
333
|
|
|
362
334
|
this.__oldAccessibleDescriptionRef = accessibleDescriptionRef;
|
|
@@ -405,11 +377,9 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
405
377
|
/** @private */
|
|
406
378
|
__updateMessageNodes(nodes, message) {
|
|
407
379
|
if (nodes && nodes.length > 0) {
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
if (defaultWrapperNode) {
|
|
412
|
-
defaultWrapperNode.firstChild.textContent = message;
|
|
380
|
+
const defaultNode = nodes.find((node) => node === this._messageController.defaultNode);
|
|
381
|
+
if (defaultNode) {
|
|
382
|
+
defaultNode.textContent = message;
|
|
413
383
|
}
|
|
414
384
|
}
|
|
415
385
|
}
|
|
@@ -425,13 +395,20 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
425
395
|
}
|
|
426
396
|
}
|
|
427
397
|
|
|
428
|
-
/** @
|
|
429
|
-
|
|
430
|
-
if (
|
|
398
|
+
/** @protected */
|
|
399
|
+
_onOverlayEscapePress(event) {
|
|
400
|
+
if (this.noCloseOnEsc) {
|
|
401
|
+
event.preventDefault();
|
|
402
|
+
} else {
|
|
431
403
|
this.__cancel();
|
|
432
404
|
}
|
|
433
405
|
}
|
|
434
406
|
|
|
407
|
+
/** @protected */
|
|
408
|
+
_onOverlayOutsideClick(event) {
|
|
409
|
+
event.preventDefault();
|
|
410
|
+
}
|
|
411
|
+
|
|
435
412
|
/** @private */
|
|
436
413
|
__confirm() {
|
|
437
414
|
this.dispatchEvent(new CustomEvent('confirm'));
|
|
@@ -450,11 +427,6 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
450
427
|
this.opened = false;
|
|
451
428
|
}
|
|
452
429
|
|
|
453
|
-
/** @private */
|
|
454
|
-
_getAriaLabel(header) {
|
|
455
|
-
return header || 'confirmation';
|
|
456
|
-
}
|
|
457
|
-
|
|
458
430
|
/**
|
|
459
431
|
* Fired when the confirm dialog is closed.
|
|
460
432
|
*
|
|
@@ -3,20 +3,14 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
8
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
10
|
-
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
11
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
|
-
import { DialogBaseMixin } from '@vaadin/dialog/src/vaadin-dialog-base-mixin.js';
|
|
13
|
-
import { dialogOverlay } from '@vaadin/dialog/src/vaadin-dialog-styles.js';
|
|
14
10
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
15
|
-
import {
|
|
11
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
16
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
17
|
-
import {
|
|
18
|
-
import { ConfirmDialogBaseMixin } from './vaadin-confirm-dialog-base-mixin.js';
|
|
19
|
-
import { confirmDialogOverlay } from './vaadin-confirm-dialog-overlay-styles.js';
|
|
13
|
+
import { confirmDialogOverlayStyles } from './styles/vaadin-confirm-dialog-overlay-base-styles.js';
|
|
20
14
|
|
|
21
15
|
/**
|
|
22
16
|
* An element used internally by `<vaadin-confirm-dialog>`. Not intended to be used separately.
|
|
@@ -28,37 +22,49 @@ import { confirmDialogOverlay } from './vaadin-confirm-dialog-overlay-styles.js'
|
|
|
28
22
|
* @mixes ThemableMixin
|
|
29
23
|
* @private
|
|
30
24
|
*/
|
|
31
|
-
class ConfirmDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
25
|
+
class ConfirmDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
32
26
|
static get is() {
|
|
33
27
|
return 'vaadin-confirm-dialog-overlay';
|
|
34
28
|
}
|
|
35
29
|
|
|
36
30
|
static get styles() {
|
|
37
|
-
return
|
|
31
|
+
return confirmDialogOverlayStyles;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static get properties() {
|
|
35
|
+
return {
|
|
36
|
+
cancelButtonVisible: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
value: false,
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
rejectButtonVisible: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
value: false,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
/** @protected */
|
|
41
49
|
render() {
|
|
42
50
|
return html`
|
|
43
51
|
<div part="backdrop" id="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
44
|
-
<div part="overlay" id="overlay"
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
<div part="
|
|
48
|
-
|
|
52
|
+
<div part="overlay" id="overlay">
|
|
53
|
+
<header part="header"><slot name="header"></slot></header>
|
|
54
|
+
<div part="content" id="content">
|
|
55
|
+
<div part="message"><slot></slot></div>
|
|
56
|
+
</div>
|
|
57
|
+
<footer part="footer" role="toolbar">
|
|
58
|
+
<div part="cancel-button" ?hidden="${!this.cancelButtonVisible}">
|
|
59
|
+
<slot name="cancel-button"></slot>
|
|
60
|
+
</div>
|
|
61
|
+
<div part="reject-button" ?hidden="${!this.rejectButtonVisible}">
|
|
62
|
+
<slot name="reject-button"></slot>
|
|
49
63
|
</div>
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<div part="reject-button">
|
|
55
|
-
<slot name="reject-button"></slot>
|
|
56
|
-
</div>
|
|
57
|
-
<div part="confirm-button">
|
|
58
|
-
<slot name="confirm-button"></slot>
|
|
59
|
-
</div>
|
|
60
|
-
</footer>
|
|
61
|
-
</section>
|
|
64
|
+
<div part="confirm-button">
|
|
65
|
+
<slot name="confirm-button"></slot>
|
|
66
|
+
</div>
|
|
67
|
+
</footer>
|
|
62
68
|
</div>
|
|
63
69
|
`;
|
|
64
70
|
}
|
|
@@ -74,49 +80,24 @@ class ConfirmDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMi
|
|
|
74
80
|
this.setAttribute('has-header', '');
|
|
75
81
|
this.setAttribute('has-footer', '');
|
|
76
82
|
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
defineCustomElement(ConfirmDialogOverlay);
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* An element used internally by `<vaadin-confirm-dialog>`. Not intended to be used separately.
|
|
83
|
-
* @private
|
|
84
|
-
*/
|
|
85
|
-
class ConfirmDialogDialog extends ConfirmDialogBaseMixin(
|
|
86
|
-
DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(PolylitMixin(LitElement)))),
|
|
87
|
-
) {
|
|
88
|
-
static get is() {
|
|
89
|
-
return 'vaadin-confirm-dialog-dialog';
|
|
90
|
-
}
|
|
91
83
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Override method from OverlayFocusMixin to use owner as content root
|
|
86
|
+
* @protected
|
|
87
|
+
* @override
|
|
88
|
+
*/
|
|
89
|
+
get _contentRoot() {
|
|
90
|
+
return this.owner;
|
|
98
91
|
}
|
|
99
92
|
|
|
100
|
-
/**
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
@opened-changed="${this._onOverlayOpened}"
|
|
108
|
-
@mousedown="${this._bringOverlayToFront}"
|
|
109
|
-
@touchstart="${this._bringOverlayToFront}"
|
|
110
|
-
theme="${ifDefined(this._theme)}"
|
|
111
|
-
.modeless="${this.modeless}"
|
|
112
|
-
.withBackdrop="${!this.modeless}"
|
|
113
|
-
?resizable="${this.resizable}"
|
|
114
|
-
aria-label="${this.ariaLabel}"
|
|
115
|
-
restore-focus-on-close
|
|
116
|
-
focus-trap
|
|
117
|
-
></vaadin-confirm-dialog-overlay>
|
|
118
|
-
`;
|
|
93
|
+
/**
|
|
94
|
+
* Override method from OverlayFocusMixin to use owner as focus trap root
|
|
95
|
+
* @protected
|
|
96
|
+
* @override
|
|
97
|
+
*/
|
|
98
|
+
get _focusTrapRoot() {
|
|
99
|
+
return this.owner;
|
|
119
100
|
}
|
|
120
101
|
}
|
|
121
102
|
|
|
122
|
-
defineCustomElement(
|
|
103
|
+
defineCustomElement(ConfirmDialogOverlay);
|
|
@@ -12,7 +12,7 @@ export * from './vaadin-confirm-dialog-mixin.js';
|
|
|
12
12
|
/**
|
|
13
13
|
* `<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.
|
|
14
14
|
*
|
|
15
|
-
* ```
|
|
15
|
+
* ```html
|
|
16
16
|
* <vaadin-confirm-dialog cancel-button-visible>
|
|
17
17
|
* There are unsaved changes. Do you really want to leave?
|
|
18
18
|
* </vaadin-confirm-dialog>
|
|
@@ -20,14 +20,13 @@ export * from './vaadin-confirm-dialog-mixin.js';
|
|
|
20
20
|
*
|
|
21
21
|
* ### Styling
|
|
22
22
|
*
|
|
23
|
-
* The
|
|
24
|
-
* component and use its shadow parts for styling.
|
|
25
|
-
* See [`<vaadin-overlay>`](#/elements/vaadin-overlay) for the overlay styling documentation.
|
|
26
|
-
*
|
|
27
|
-
* In addition to `<vaadin-overlay>` parts, the following parts are available for theming:
|
|
23
|
+
* The following shadow DOM parts are available for styling:
|
|
28
24
|
*
|
|
29
25
|
* Part name | Description
|
|
30
26
|
* -----------------|-------------------------------------------
|
|
27
|
+
* `backdrop` | Backdrop of the overlay
|
|
28
|
+
* `overlay` | The overlay container
|
|
29
|
+
* `content` | The overlay content
|
|
31
30
|
* `header` | The header element wrapper
|
|
32
31
|
* `message` | The message element wrapper
|
|
33
32
|
* `footer` | The footer element that wraps the buttons
|
|
@@ -36,8 +35,6 @@ export * from './vaadin-confirm-dialog-mixin.js';
|
|
|
36
35
|
* `reject-button` | The "Reject" button wrapper
|
|
37
36
|
*
|
|
38
37
|
* Use `confirmTheme`, `cancelTheme` and `rejectTheme` properties to customize buttons theme.
|
|
39
|
-
* Also, the `theme` attribute value set on `<vaadin-confirm-dialog>` is propagated to the
|
|
40
|
-
* `<vaadin-confirm-dialog-overlay>` component.
|
|
41
38
|
*
|
|
42
39
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
43
40
|
*
|
|
@@ -16,7 +16,7 @@ import { ConfirmDialogMixin } from './vaadin-confirm-dialog-mixin.js';
|
|
|
16
16
|
/**
|
|
17
17
|
* `<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.
|
|
18
18
|
*
|
|
19
|
-
* ```
|
|
19
|
+
* ```html
|
|
20
20
|
* <vaadin-confirm-dialog cancel-button-visible>
|
|
21
21
|
* There are unsaved changes. Do you really want to leave?
|
|
22
22
|
* </vaadin-confirm-dialog>
|
|
@@ -24,14 +24,13 @@ import { ConfirmDialogMixin } from './vaadin-confirm-dialog-mixin.js';
|
|
|
24
24
|
*
|
|
25
25
|
* ### Styling
|
|
26
26
|
*
|
|
27
|
-
* The
|
|
28
|
-
* component and use its shadow parts for styling.
|
|
29
|
-
* See [`<vaadin-overlay>`](#/elements/vaadin-overlay) for the overlay styling documentation.
|
|
30
|
-
*
|
|
31
|
-
* In addition to `<vaadin-overlay>` parts, the following parts are available for theming:
|
|
27
|
+
* The following shadow DOM parts are available for styling:
|
|
32
28
|
*
|
|
33
29
|
* Part name | Description
|
|
34
30
|
* -----------------|-------------------------------------------
|
|
31
|
+
* `backdrop` | Backdrop of the overlay
|
|
32
|
+
* `overlay` | The overlay container
|
|
33
|
+
* `content` | The overlay content
|
|
35
34
|
* `header` | The header element wrapper
|
|
36
35
|
* `message` | The message element wrapper
|
|
37
36
|
* `footer` | The footer element that wraps the buttons
|
|
@@ -40,8 +39,6 @@ import { ConfirmDialogMixin } from './vaadin-confirm-dialog-mixin.js';
|
|
|
40
39
|
* `reject-button` | The "Reject" button wrapper
|
|
41
40
|
*
|
|
42
41
|
* Use `confirmTheme`, `cancelTheme` and `rejectTheme` properties to customize buttons theme.
|
|
43
|
-
* Also, the `theme` attribute value set on `<vaadin-confirm-dialog>` is propagated to the
|
|
44
|
-
* `<vaadin-confirm-dialog-overlay>` component.
|
|
45
42
|
*
|
|
46
43
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
47
44
|
*
|
|
@@ -75,36 +72,51 @@ class ConfirmDialog extends ConfirmDialogMixin(ElementMixin(ThemePropertyMixin(P
|
|
|
75
72
|
|
|
76
73
|
static get styles() {
|
|
77
74
|
return css`
|
|
75
|
+
:host([opened]),
|
|
76
|
+
:host([opening]),
|
|
77
|
+
:host([closing]) {
|
|
78
|
+
display: block !important;
|
|
79
|
+
position: absolute;
|
|
80
|
+
outline: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
78
83
|
:host,
|
|
79
|
-
[hidden] {
|
|
84
|
+
:host([hidden]) {
|
|
80
85
|
display: none !important;
|
|
81
86
|
}
|
|
87
|
+
|
|
88
|
+
:host(:focus-visible) ::part(overlay) {
|
|
89
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
90
|
+
}
|
|
82
91
|
`;
|
|
83
92
|
}
|
|
84
93
|
|
|
85
94
|
/** @protected */
|
|
86
95
|
render() {
|
|
87
96
|
return html`
|
|
88
|
-
<vaadin-confirm-dialog-
|
|
89
|
-
id="
|
|
97
|
+
<vaadin-confirm-dialog-overlay
|
|
98
|
+
id="overlay"
|
|
99
|
+
.owner="${this}"
|
|
90
100
|
.opened="${this.opened}"
|
|
91
|
-
.overlayClass="${this.overlayClass}"
|
|
92
|
-
aria-label="${this.header || 'confirmation'}"
|
|
93
101
|
theme="${ifDefined(this._theme)}"
|
|
94
|
-
|
|
95
|
-
.
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
.cancelButtonVisible="${this.cancelButtonVisible}"
|
|
103
|
+
.rejectButtonVisible="${this.rejectButtonVisible}"
|
|
104
|
+
with-backdrop
|
|
105
|
+
restore-focus-on-close
|
|
106
|
+
focus-trap
|
|
107
|
+
exportparts="backdrop, overlay, header, content, message, footer, cancel-button, confirm-button, reject-button"
|
|
98
108
|
@opened-changed="${this._onOpenedChanged}"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
@vaadin-overlay-open="${this.__onDialogOpened}"
|
|
110
|
+
@vaadin-overlay-closed="${this.__onDialogClosed}"
|
|
111
|
+
@vaadin-overlay-outside-click="${this._onOverlayOutsideClick}"
|
|
112
|
+
@vaadin-overlay-escape-press="${this._onOverlayEscapePress}"
|
|
113
|
+
>
|
|
114
|
+
<slot name="header" slot="header"></slot>
|
|
103
115
|
<slot></slot>
|
|
104
|
-
<slot name="cancel-button"></slot>
|
|
105
|
-
<slot name="reject-button"></slot>
|
|
106
|
-
<slot name="confirm-button"></slot>
|
|
107
|
-
</
|
|
116
|
+
<slot name="cancel-button" slot="cancel-button"></slot>
|
|
117
|
+
<slot name="reject-button" slot="reject-button"></slot>
|
|
118
|
+
<slot name="confirm-button" slot="confirm-button"></slot>
|
|
119
|
+
</vaadin-confirm-dialog-overlay>
|
|
108
120
|
`;
|
|
109
121
|
}
|
|
110
122
|
|
package/vaadin-confirm-dialog.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-confirm-dialog.js';
|
|
2
2
|
export * from './src/vaadin-confirm-dialog.js';
|
package/web-types.json
CHANGED
|
@@ -1,18 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/confirm-dialog",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha21",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-confirm-dialog",
|
|
11
|
-
"description": "`<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.\n\n
|
|
11
|
+
"description": "`<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.\n\n```html\n<vaadin-confirm-dialog cancel-button-visible>\n There are unsaved changes. Do you really want to leave?\n</vaadin-confirm-dialog>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n`header` | The header element wrapper\n`message` | The message element wrapper\n`footer` | The footer element that wraps the buttons\n`cancel-button` | The \"Cancel\" button wrapper\n`confirm-button` | The \"Confirm\" button wrapper\n`reject-button` | The \"Reject\" button wrapper\n\nUse `confirmTheme`, `cancelTheme` and `rejectTheme` properties to customize buttons theme.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Custom content\n\nThe following slots are available for providing custom content:\n\nSlot name | Description\n------------------|---------------------------\n`header` | Slot for header element\n`cancel-button` | Slot for \"Cancel\" button\n`confirm-button` | Slot for \"Confirm\" button\n`reject-button` | Slot for \"Reject\" button",
|
|
12
12
|
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "width",
|
|
15
|
+
"description": "Set the width of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"string",
|
|
19
|
+
"null",
|
|
20
|
+
"undefined"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "height",
|
|
26
|
+
"description": "Set the height of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
27
|
+
"value": {
|
|
28
|
+
"type": [
|
|
29
|
+
"string",
|
|
30
|
+
"null",
|
|
31
|
+
"undefined"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
13
35
|
{
|
|
14
36
|
"name": "accessible-description-ref",
|
|
15
|
-
"description": "Sets the `aria-describedby` attribute of the
|
|
37
|
+
"description": "Sets the `aria-describedby` attribute of the dialog.\n\nBy default, the text contents of all elements inside the message area\nare combined into the `aria-description` attribute. However, there are\ncases where this can confuse screen reader users (e.g. the dialog\nmay present a password confirmation form). For these cases,\nit's better to associate only the elements that will help describe\nthe confirmation dialog through this API.",
|
|
16
38
|
"value": {
|
|
17
39
|
"type": [
|
|
18
40
|
"string",
|
|
@@ -23,7 +45,7 @@
|
|
|
23
45
|
},
|
|
24
46
|
{
|
|
25
47
|
"name": "opened",
|
|
26
|
-
"description": "True if the
|
|
48
|
+
"description": "True if the dialog is visible and available for interaction.",
|
|
27
49
|
"value": {
|
|
28
50
|
"type": [
|
|
29
51
|
"boolean"
|
|
@@ -131,17 +153,6 @@
|
|
|
131
153
|
]
|
|
132
154
|
}
|
|
133
155
|
},
|
|
134
|
-
{
|
|
135
|
-
"name": "overlay-class",
|
|
136
|
-
"description": "A space-delimited list of CSS class names\nto set on the underlying overlay element.",
|
|
137
|
-
"value": {
|
|
138
|
-
"type": [
|
|
139
|
-
"string",
|
|
140
|
-
"null",
|
|
141
|
-
"undefined"
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
156
|
{
|
|
146
157
|
"name": "theme",
|
|
147
158
|
"description": "The theme variants to apply to the component.",
|
|
@@ -156,9 +167,31 @@
|
|
|
156
167
|
],
|
|
157
168
|
"js": {
|
|
158
169
|
"properties": [
|
|
170
|
+
{
|
|
171
|
+
"name": "width",
|
|
172
|
+
"description": "Set the width of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
173
|
+
"value": {
|
|
174
|
+
"type": [
|
|
175
|
+
"string",
|
|
176
|
+
"null",
|
|
177
|
+
"undefined"
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "height",
|
|
183
|
+
"description": "Set the height of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
184
|
+
"value": {
|
|
185
|
+
"type": [
|
|
186
|
+
"string",
|
|
187
|
+
"null",
|
|
188
|
+
"undefined"
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
},
|
|
159
192
|
{
|
|
160
193
|
"name": "accessibleDescriptionRef",
|
|
161
|
-
"description": "Sets the `aria-describedby` attribute of the
|
|
194
|
+
"description": "Sets the `aria-describedby` attribute of the dialog.\n\nBy default, the text contents of all elements inside the message area\nare combined into the `aria-description` attribute. However, there are\ncases where this can confuse screen reader users (e.g. the dialog\nmay present a password confirmation form). For these cases,\nit's better to associate only the elements that will help describe\nthe confirmation dialog through this API.",
|
|
162
195
|
"value": {
|
|
163
196
|
"type": [
|
|
164
197
|
"string",
|
|
@@ -169,7 +202,7 @@
|
|
|
169
202
|
},
|
|
170
203
|
{
|
|
171
204
|
"name": "opened",
|
|
172
|
-
"description": "True if the
|
|
205
|
+
"description": "True if the dialog is visible and available for interaction.",
|
|
173
206
|
"value": {
|
|
174
207
|
"type": [
|
|
175
208
|
"boolean"
|
|
@@ -276,17 +309,6 @@
|
|
|
276
309
|
"string"
|
|
277
310
|
]
|
|
278
311
|
}
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
"name": "overlayClass",
|
|
282
|
-
"description": "A space-delimited list of CSS class names\nto set on the underlying overlay element.",
|
|
283
|
-
"value": {
|
|
284
|
-
"type": [
|
|
285
|
-
"string",
|
|
286
|
-
"null",
|
|
287
|
-
"undefined"
|
|
288
|
-
]
|
|
289
|
-
}
|
|
290
312
|
}
|
|
291
313
|
],
|
|
292
314
|
"events": [
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/confirm-dialog",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha21",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-confirm-dialog",
|
|
19
|
-
"description": "`<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.\n\n
|
|
19
|
+
"description": "`<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.\n\n```html\n<vaadin-confirm-dialog cancel-button-visible>\n There are unsaved changes. Do you really want to leave?\n</vaadin-confirm-dialog>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n`header` | The header element wrapper\n`message` | The message element wrapper\n`footer` | The footer element that wraps the buttons\n`cancel-button` | The \"Cancel\" button wrapper\n`confirm-button` | The \"Confirm\" button wrapper\n`reject-button` | The \"Reject\" button wrapper\n\nUse `confirmTheme`, `cancelTheme` and `rejectTheme` properties to customize buttons theme.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Custom content\n\nThe following slots are available for providing custom content:\n\nSlot name | Description\n------------------|---------------------------\n`header` | Slot for header element\n`cancel-button` | Slot for \"Cancel\" button\n`confirm-button` | Slot for \"Confirm\" button\n`reject-button` | Slot for \"Reject\" button",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
23
23
|
"name": "?opened",
|
|
24
|
-
"description": "True if the
|
|
24
|
+
"description": "True if the dialog is visible and available for interaction.",
|
|
25
25
|
"value": {
|
|
26
26
|
"kind": "expression"
|
|
27
27
|
}
|
|
@@ -47,9 +47,23 @@
|
|
|
47
47
|
"kind": "expression"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
"name": ".width",
|
|
52
|
+
"description": "Set the width of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": ".height",
|
|
59
|
+
"description": "Set the height of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
60
|
+
"value": {
|
|
61
|
+
"kind": "expression"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
50
64
|
{
|
|
51
65
|
"name": ".accessibleDescriptionRef",
|
|
52
|
-
"description": "Sets the `aria-describedby` attribute of the
|
|
66
|
+
"description": "Sets the `aria-describedby` attribute of the dialog.\n\nBy default, the text contents of all elements inside the message area\nare combined into the `aria-description` attribute. However, there are\ncases where this can confuse screen reader users (e.g. the dialog\nmay present a password confirmation form). For these cases,\nit's better to associate only the elements that will help describe\nthe confirmation dialog through this API.",
|
|
53
67
|
"value": {
|
|
54
68
|
"kind": "expression"
|
|
55
69
|
}
|
|
@@ -110,13 +124,6 @@
|
|
|
110
124
|
"kind": "expression"
|
|
111
125
|
}
|
|
112
126
|
},
|
|
113
|
-
{
|
|
114
|
-
"name": ".overlayClass",
|
|
115
|
-
"description": "A space-delimited list of CSS class names\nto set on the underlying overlay element.",
|
|
116
|
-
"value": {
|
|
117
|
-
"kind": "expression"
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
127
|
{
|
|
121
128
|
"name": "@closed",
|
|
122
129
|
"description": "Fired when the confirm dialog is closed.",
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
|
|
8
|
-
export declare function ConfirmDialogBaseMixin<T extends Constructor<HTMLElement>>(
|
|
9
|
-
base: T,
|
|
10
|
-
): Constructor<ConfirmDialogBaseMixinClass> & T;
|
|
11
|
-
|
|
12
|
-
export declare class ConfirmDialogBaseMixinClass {
|
|
13
|
-
/**
|
|
14
|
-
* Set the `aria-label` attribute for assistive technologies like
|
|
15
|
-
* screen readers. An empty string value for this property (the
|
|
16
|
-
* default) means that the `aria-label` attribute is not present.
|
|
17
|
-
*/
|
|
18
|
-
ariaLabel: string;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Height to be set on the overlay content.
|
|
22
|
-
*/
|
|
23
|
-
contentHeight: string;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Width to be set on the overlay content.
|
|
27
|
-
*/
|
|
28
|
-
contentWidth: string;
|
|
29
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2018 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @polymerMixin
|
|
9
|
-
*/
|
|
10
|
-
export const ConfirmDialogBaseMixin = (superClass) =>
|
|
11
|
-
class ConfirmDialogBaseMixinClass extends superClass {
|
|
12
|
-
static get properties() {
|
|
13
|
-
return {
|
|
14
|
-
/**
|
|
15
|
-
* Set the `aria-label` attribute for assistive technologies like
|
|
16
|
-
* screen readers. An empty string value for this property (the
|
|
17
|
-
* default) means that the `aria-label` attribute is not present.
|
|
18
|
-
*/
|
|
19
|
-
ariaLabel: {
|
|
20
|
-
type: String,
|
|
21
|
-
value: '',
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Height to be set on the overlay content.
|
|
26
|
-
*/
|
|
27
|
-
contentHeight: {
|
|
28
|
-
type: String,
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Width to be set on the overlay content.
|
|
33
|
-
*/
|
|
34
|
-
contentWidth: {
|
|
35
|
-
type: String,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static get observers() {
|
|
41
|
-
return [
|
|
42
|
-
'__updateContentHeight(contentHeight, _overlayElement)',
|
|
43
|
-
'__updateContentWidth(contentWidth, _overlayElement)',
|
|
44
|
-
];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** @private */
|
|
48
|
-
__updateDimension(overlay, dimension, value) {
|
|
49
|
-
const prop = `--_vaadin-confirm-dialog-content-${dimension}`;
|
|
50
|
-
|
|
51
|
-
if (value) {
|
|
52
|
-
overlay.style.setProperty(prop, value);
|
|
53
|
-
} else {
|
|
54
|
-
overlay.style.removeProperty(prop);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** @private */
|
|
59
|
-
__updateContentHeight(height, overlay) {
|
|
60
|
-
if (overlay) {
|
|
61
|
-
this.__updateDimension(overlay, 'height', height);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/** @private */
|
|
66
|
-
__updateContentWidth(width, overlay) {
|
|
67
|
-
if (overlay) {
|
|
68
|
-
this.__updateDimension(overlay, 'width', width);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2018 - 2025 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
|
-
#resizerContainer {
|
|
20
|
-
height: 100%;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
::slotted([slot='header']) {
|
|
24
|
-
pointer-events: auto;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* Make buttons clickable */
|
|
28
|
-
[part='footer'] > * {
|
|
29
|
-
pointer-events: all;
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
3
|
-
import { dialogOverlay } from '@vaadin/dialog/theme/lumo/vaadin-dialog-styles.js';
|
|
4
|
-
import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
|
|
5
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
6
|
-
|
|
7
|
-
registerStyles(
|
|
8
|
-
'vaadin-confirm-dialog-overlay',
|
|
9
|
-
[
|
|
10
|
-
overlay,
|
|
11
|
-
dialogOverlay,
|
|
12
|
-
css`
|
|
13
|
-
[part='header'] ::slotted(h3) {
|
|
14
|
-
margin-top: 0 !important;
|
|
15
|
-
margin-bottom: 0 !important;
|
|
16
|
-
margin-inline-start: calc(var(--lumo-space-l) - var(--lumo-space-m));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
[part='message'] {
|
|
20
|
-
width: 25em;
|
|
21
|
-
min-width: 100%;
|
|
22
|
-
max-width: 100%;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
::slotted([slot$='button'][theme~='tertiary']) {
|
|
26
|
-
padding-left: var(--lumo-space-s);
|
|
27
|
-
padding-right: var(--lumo-space-s);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
[part='cancel-button'] {
|
|
31
|
-
flex-grow: 1;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@media (max-width: 360px) {
|
|
35
|
-
[part='footer'] {
|
|
36
|
-
flex-direction: column-reverse;
|
|
37
|
-
align-items: stretch;
|
|
38
|
-
padding: var(--lumo-space-s) var(--lumo-space-l);
|
|
39
|
-
gap: var(--lumo-space-s);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
::slotted([slot$='button']) {
|
|
43
|
-
width: 100%;
|
|
44
|
-
margin: 0;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
`,
|
|
48
|
-
],
|
|
49
|
-
{ moduleId: 'lumo-confirm-dialog-overlay' },
|
|
50
|
-
);
|