@vaadin/confirm-dialog 25.0.0-alpha1 → 25.0.0-alpha11
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 +44 -0
- package/src/vaadin-confirm-dialog-mixin.d.ts +5 -11
- package/src/vaadin-confirm-dialog-mixin.js +65 -93
- package/src/vaadin-confirm-dialog-overlay.js +36 -53
- package/src/vaadin-confirm-dialog.d.ts +5 -8
- package/src/vaadin-confirm-dialog.js +31 -25
- package/vaadin-confirm-dialog.js +1 -1
- package/web-types.json +70 -26
- package/web-types.lit.json +24 -10
- 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-alpha11",
|
|
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-alpha1",
|
|
37
|
+
"@vaadin/button": "25.0.0-alpha11",
|
|
38
|
+
"@vaadin/component-base": "25.0.0-alpha11",
|
|
39
|
+
"@vaadin/dialog": "25.0.0-alpha11",
|
|
40
|
+
"@vaadin/overlay": "25.0.0-alpha11",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha11",
|
|
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-
|
|
50
|
-
"@vaadin/testing-helpers": "^
|
|
45
|
+
"@vaadin/a11y-base": "25.0.0-alpha11",
|
|
46
|
+
"@vaadin/chai-plugins": "25.0.0-alpha11",
|
|
47
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha11",
|
|
48
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha11",
|
|
51
50
|
"sinon": "^18.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": "abfd315ba5a7484a613e0768635a4e8fe945a44b"
|
|
58
57
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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-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
|
+
/* TODO remove this wrapper element */
|
|
39
|
+
#resizerContainer {
|
|
40
|
+
display: contents;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
export const confirmDialogOverlayStyles = [overlayStyles, dialogOverlayBase, confirmDialogOverlay];
|
|
@@ -4,6 +4,8 @@
|
|
|
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 { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
8
|
+
import type { DialogSizeMixinClass } from '@vaadin/dialog/src/vaadin-dialog-size-mixin.js';
|
|
7
9
|
|
|
8
10
|
/*
|
|
9
11
|
* Fired when the `opened` property changes.
|
|
@@ -31,14 +33,14 @@ export type ConfirmDialogEventMap = ConfirmDialogCustomEventMap & HTMLElementEve
|
|
|
31
33
|
|
|
32
34
|
export declare function ConfirmDialogMixin<T extends Constructor<HTMLElement>>(
|
|
33
35
|
base: T,
|
|
34
|
-
): Constructor<ConfirmDialogMixinClass> & T;
|
|
36
|
+
): Constructor<ConfirmDialogMixinClass> & Constructor<DialogSizeMixinClass> & Constructor<OverlayClassMixinClass> & T;
|
|
35
37
|
|
|
36
38
|
export declare class ConfirmDialogMixinClass {
|
|
37
39
|
/**
|
|
38
40
|
* Sets the `aria-describedby` attribute of the overlay element.
|
|
39
41
|
*
|
|
40
|
-
* By default, all elements inside the message area
|
|
41
|
-
*
|
|
42
|
+
* By default, the text contents of all elements inside the message area
|
|
43
|
+
* are combined into the `aria-description` attribute. However, there are
|
|
42
44
|
* cases where this can confuse screen reader users (e.g. the dialog
|
|
43
45
|
* may present a password confirmation form). For these cases,
|
|
44
46
|
* it's better to associate only the elements that will help describe
|
|
@@ -121,12 +123,4 @@ export declare class ConfirmDialogMixinClass {
|
|
|
121
123
|
* @attr {string} cancel-theme
|
|
122
124
|
*/
|
|
123
125
|
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
126
|
}
|
|
@@ -4,21 +4,24 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { setAriaIDReference } from '@vaadin/a11y-base/src/aria-id-reference.js';
|
|
7
|
+
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
7
8
|
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
8
|
-
import {
|
|
9
|
+
import { DialogSizeMixin } from '@vaadin/dialog/src/vaadin-dialog-size-mixin.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @polymerMixin
|
|
13
|
+
* @mixes DialogSizeMixin
|
|
14
|
+
* @mixes OverlayClassMixin
|
|
12
15
|
*/
|
|
13
16
|
export const ConfirmDialogMixin = (superClass) =>
|
|
14
|
-
class ConfirmDialogMixinClass extends superClass {
|
|
17
|
+
class ConfirmDialogMixinClass extends OverlayClassMixin(DialogSizeMixin(superClass)) {
|
|
15
18
|
static get properties() {
|
|
16
19
|
return {
|
|
17
20
|
/**
|
|
18
21
|
* Sets the `aria-describedby` attribute of the overlay element.
|
|
19
22
|
*
|
|
20
|
-
* By default, all elements inside the message area
|
|
21
|
-
*
|
|
23
|
+
* By default, the text contents of all elements inside the message area
|
|
24
|
+
* are combined into the `aria-description` attribute. However, there are
|
|
22
25
|
* cases where this can confuse screen reader users (e.g. the dialog
|
|
23
26
|
* may present a password confirmation form). For these cases,
|
|
24
27
|
* it's better to associate only the elements that will help describe
|
|
@@ -34,6 +37,7 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
34
37
|
*/
|
|
35
38
|
opened: {
|
|
36
39
|
type: Boolean,
|
|
40
|
+
reflectToAttribute: true,
|
|
37
41
|
value: false,
|
|
38
42
|
notify: true,
|
|
39
43
|
sync: true,
|
|
@@ -154,16 +158,6 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
154
158
|
value: 'tertiary',
|
|
155
159
|
},
|
|
156
160
|
|
|
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
161
|
/**
|
|
168
162
|
* A reference to the "Cancel" button which will be teleported to the overlay.
|
|
169
163
|
* @private
|
|
@@ -197,15 +191,6 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
197
191
|
value: () => [],
|
|
198
192
|
},
|
|
199
193
|
|
|
200
|
-
/**
|
|
201
|
-
* A reference to the overlay element.
|
|
202
|
-
* @private
|
|
203
|
-
*/
|
|
204
|
-
_overlayElement: {
|
|
205
|
-
type: Object,
|
|
206
|
-
sync: true,
|
|
207
|
-
},
|
|
208
|
-
|
|
209
194
|
/**
|
|
210
195
|
* A reference to the "Reject" button which will be teleported to the overlay.
|
|
211
196
|
* @private
|
|
@@ -213,22 +198,6 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
213
198
|
_rejectButton: {
|
|
214
199
|
type: Object,
|
|
215
200
|
},
|
|
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
201
|
};
|
|
233
202
|
}
|
|
234
203
|
|
|
@@ -239,7 +208,7 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
239
208
|
'__updateHeaderNode(_headerNode, header)',
|
|
240
209
|
'__updateMessageNodes(_messageNodes, message)',
|
|
241
210
|
'__updateRejectButton(_rejectButton, rejectText, rejectTheme, rejectButtonVisible)',
|
|
242
|
-
'__accessibleDescriptionRefChanged(
|
|
211
|
+
'__accessibleDescriptionRefChanged(_messageNodes, accessibleDescriptionRef)',
|
|
243
212
|
];
|
|
244
213
|
}
|
|
245
214
|
|
|
@@ -251,14 +220,35 @@ export const ConfirmDialogMixin = (superClass) =>
|
|
|
251
220
|
this.__reject = this.__reject.bind(this);
|
|
252
221
|
}
|
|
253
222
|
|
|
254
|
-
|
|
255
|
-
|
|
223
|
+
/** @protected */
|
|
224
|
+
connectedCallback() {
|
|
225
|
+
super.connectedCallback();
|
|
226
|
+
// Restore opened state if overlay was opened when disconnecting
|
|
227
|
+
if (this.__restoreOpened) {
|
|
228
|
+
this.opened = true;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** @protected */
|
|
233
|
+
disconnectedCallback() {
|
|
234
|
+
super.disconnectedCallback();
|
|
235
|
+
// Automatically close the overlay when dialog is removed from DOM
|
|
236
|
+
// Using a timeout to avoid toggling opened state, and dispatching change
|
|
237
|
+
// events, when just moving the dialog in the DOM
|
|
238
|
+
setTimeout(() => {
|
|
239
|
+
if (!this.isConnected) {
|
|
240
|
+
this.__restoreOpened = this.opened;
|
|
241
|
+
this.opened = false;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
256
244
|
}
|
|
257
245
|
|
|
258
246
|
/** @protected */
|
|
259
247
|
ready() {
|
|
260
248
|
super.ready();
|
|
261
249
|
|
|
250
|
+
this.role = 'alertdialog';
|
|
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,13 +22,27 @@ 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 */
|
|
@@ -48,10 +56,10 @@ class ConfirmDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMi
|
|
|
48
56
|
<div part="message"><slot></slot></div>
|
|
49
57
|
</div>
|
|
50
58
|
<footer part="footer" role="toolbar">
|
|
51
|
-
<div part="cancel-button">
|
|
59
|
+
<div part="cancel-button" ?hidden="${!this.cancelButtonVisible}">
|
|
52
60
|
<slot name="cancel-button"></slot>
|
|
53
61
|
</div>
|
|
54
|
-
<div part="reject-button">
|
|
62
|
+
<div part="reject-button" ?hidden="${!this.rejectButtonVisible}">
|
|
55
63
|
<slot name="reject-button"></slot>
|
|
56
64
|
</div>
|
|
57
65
|
<div part="confirm-button">
|
|
@@ -74,49 +82,24 @@ class ConfirmDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMi
|
|
|
74
82
|
this.setAttribute('has-header', '');
|
|
75
83
|
this.setAttribute('has-footer', '');
|
|
76
84
|
}
|
|
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
85
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Override method from OverlayFocusMixin to use owner as content root
|
|
88
|
+
* @protected
|
|
89
|
+
* @override
|
|
90
|
+
*/
|
|
91
|
+
get _contentRoot() {
|
|
92
|
+
return this.owner;
|
|
98
93
|
}
|
|
99
94
|
|
|
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
|
-
`;
|
|
95
|
+
/**
|
|
96
|
+
* Override method from OverlayFocusMixin to use owner as modal root
|
|
97
|
+
* @protected
|
|
98
|
+
* @override
|
|
99
|
+
*/
|
|
100
|
+
get _modalRoot() {
|
|
101
|
+
return this.owner;
|
|
119
102
|
}
|
|
120
103
|
}
|
|
121
104
|
|
|
122
|
-
defineCustomElement(
|
|
105
|
+
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,8 +72,14 @@ 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: contents !important;
|
|
79
|
+
}
|
|
80
|
+
|
|
78
81
|
:host,
|
|
79
|
-
[hidden] {
|
|
82
|
+
:host([hidden]) {
|
|
80
83
|
display: none !important;
|
|
81
84
|
}
|
|
82
85
|
`;
|
|
@@ -85,26 +88,29 @@ class ConfirmDialog extends ConfirmDialogMixin(ElementMixin(ThemePropertyMixin(P
|
|
|
85
88
|
/** @protected */
|
|
86
89
|
render() {
|
|
87
90
|
return html`
|
|
88
|
-
<vaadin-confirm-dialog-
|
|
89
|
-
id="
|
|
91
|
+
<vaadin-confirm-dialog-overlay
|
|
92
|
+
id="overlay"
|
|
93
|
+
.owner="${this}"
|
|
90
94
|
.opened="${this.opened}"
|
|
91
|
-
.overlayClass="${this.overlayClass}"
|
|
92
|
-
aria-label="${this.header || 'confirmation'}"
|
|
93
95
|
theme="${ifDefined(this._theme)}"
|
|
94
|
-
|
|
95
|
-
.
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
.cancelButtonVisible="${this.cancelButtonVisible}"
|
|
97
|
+
.rejectButtonVisible="${this.rejectButtonVisible}"
|
|
98
|
+
with-backdrop
|
|
99
|
+
restore-focus-on-close
|
|
100
|
+
focus-trap
|
|
101
|
+
exportparts="backdrop, overlay, header, content, message, footer, cancel-button, confirm-button, reject-button"
|
|
98
102
|
@opened-changed="${this._onOpenedChanged}"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
@vaadin-overlay-open="${this.__onDialogOpened}"
|
|
104
|
+
@vaadin-overlay-closed="${this.__onDialogClosed}"
|
|
105
|
+
@vaadin-overlay-outside-click="${this._onOverlayOutsideClick}"
|
|
106
|
+
@vaadin-overlay-escape-press="${this._onOverlayEscapePress}"
|
|
107
|
+
>
|
|
108
|
+
<slot name="header" slot="header"></slot>
|
|
103
109
|
<slot></slot>
|
|
104
|
-
<slot name="cancel-button"></slot>
|
|
105
|
-
<slot name="reject-button"></slot>
|
|
106
|
-
<slot name="confirm-button"></slot>
|
|
107
|
-
</
|
|
110
|
+
<slot name="cancel-button" slot="cancel-button"></slot>
|
|
111
|
+
<slot name="reject-button" slot="reject-button"></slot>
|
|
112
|
+
<slot name="confirm-button" slot="confirm-button"></slot>
|
|
113
|
+
</vaadin-confirm-dialog-overlay>
|
|
108
114
|
`;
|
|
109
115
|
}
|
|
110
116
|
|
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,51 @@
|
|
|
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-alpha11",
|
|
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 overlay.\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 overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
27
|
+
"value": {
|
|
28
|
+
"type": [
|
|
29
|
+
"string",
|
|
30
|
+
"null",
|
|
31
|
+
"undefined"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "overlay-class",
|
|
37
|
+
"description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
|
|
38
|
+
"value": {
|
|
39
|
+
"type": [
|
|
40
|
+
"string",
|
|
41
|
+
"null",
|
|
42
|
+
"undefined"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
13
46
|
{
|
|
14
47
|
"name": "accessible-description-ref",
|
|
15
|
-
"description": "Sets the `aria-describedby` attribute of the overlay element.\n\nBy default, all elements inside the message area
|
|
48
|
+
"description": "Sets the `aria-describedby` attribute of the overlay element.\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
49
|
"value": {
|
|
17
50
|
"type": [
|
|
18
51
|
"string",
|
|
@@ -131,17 +164,6 @@
|
|
|
131
164
|
]
|
|
132
165
|
}
|
|
133
166
|
},
|
|
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
167
|
{
|
|
146
168
|
"name": "theme",
|
|
147
169
|
"description": "The theme variants to apply to the component.",
|
|
@@ -156,9 +178,42 @@
|
|
|
156
178
|
],
|
|
157
179
|
"js": {
|
|
158
180
|
"properties": [
|
|
181
|
+
{
|
|
182
|
+
"name": "width",
|
|
183
|
+
"description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
184
|
+
"value": {
|
|
185
|
+
"type": [
|
|
186
|
+
"string",
|
|
187
|
+
"null",
|
|
188
|
+
"undefined"
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "height",
|
|
194
|
+
"description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
195
|
+
"value": {
|
|
196
|
+
"type": [
|
|
197
|
+
"string",
|
|
198
|
+
"null",
|
|
199
|
+
"undefined"
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"name": "overlayClass",
|
|
205
|
+
"description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
|
|
206
|
+
"value": {
|
|
207
|
+
"type": [
|
|
208
|
+
"string",
|
|
209
|
+
"null",
|
|
210
|
+
"undefined"
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
},
|
|
159
214
|
{
|
|
160
215
|
"name": "accessibleDescriptionRef",
|
|
161
|
-
"description": "Sets the `aria-describedby` attribute of the overlay element.\n\nBy default, all elements inside the message area
|
|
216
|
+
"description": "Sets the `aria-describedby` attribute of the overlay element.\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
217
|
"value": {
|
|
163
218
|
"type": [
|
|
164
219
|
"string",
|
|
@@ -276,17 +331,6 @@
|
|
|
276
331
|
"string"
|
|
277
332
|
]
|
|
278
333
|
}
|
|
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
334
|
}
|
|
291
335
|
],
|
|
292
336
|
"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-alpha11",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
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
|
{
|
|
@@ -47,9 +47,30 @@
|
|
|
47
47
|
"kind": "expression"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
"name": ".width",
|
|
52
|
+
"description": "Set the width of the overlay.\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 overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
60
|
+
"value": {
|
|
61
|
+
"kind": "expression"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": ".overlayClass",
|
|
66
|
+
"description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
|
|
67
|
+
"value": {
|
|
68
|
+
"kind": "expression"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
50
71
|
{
|
|
51
72
|
"name": ".accessibleDescriptionRef",
|
|
52
|
-
"description": "Sets the `aria-describedby` attribute of the overlay element.\n\nBy default, all elements inside the message area
|
|
73
|
+
"description": "Sets the `aria-describedby` attribute of the overlay element.\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
74
|
"value": {
|
|
54
75
|
"kind": "expression"
|
|
55
76
|
}
|
|
@@ -110,13 +131,6 @@
|
|
|
110
131
|
"kind": "expression"
|
|
111
132
|
}
|
|
112
133
|
},
|
|
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
134
|
{
|
|
121
135
|
"name": "@closed",
|
|
122
136
|
"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
|
-
);
|