@vaadin/confirm-dialog 23.3.3 → 24.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/confirm-dialog",
3
- "version": "23.3.3",
3
+ "version": "24.0.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,13 +36,13 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/button": "~23.3.3",
40
- "@vaadin/component-base": "~23.3.3",
41
- "@vaadin/dialog": "~23.3.3",
42
- "@vaadin/overlay": "~23.3.3",
43
- "@vaadin/vaadin-lumo-styles": "~23.3.3",
44
- "@vaadin/vaadin-material-styles": "~23.3.3",
45
- "@vaadin/vaadin-themable-mixin": "~23.3.3"
39
+ "@vaadin/button": "24.0.0-alpha10",
40
+ "@vaadin/component-base": "24.0.0-alpha10",
41
+ "@vaadin/dialog": "24.0.0-alpha10",
42
+ "@vaadin/overlay": "24.0.0-alpha10",
43
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha10",
44
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha10",
45
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha10"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@esm-bundle/chai": "^4.3.4",
@@ -53,5 +53,5 @@
53
53
  "web-types.json",
54
54
  "web-types.lit.json"
55
55
  ],
56
- "gitHead": "1529ed623e053d28a3c1c66af55ebe402743ddd0"
56
+ "gitHead": "2e04534d8b47bcd216f89b5f849bafef1a73b174"
57
57
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2018 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2018 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html } from '@polymer/polymer/lib/utils/html-tag.js';
@@ -142,6 +142,68 @@ class ConfirmDialogDialog extends Dialog {
142
142
  ></vaadin-confirm-dialog-overlay>
143
143
  `;
144
144
  }
145
+
146
+ static get properties() {
147
+ return {
148
+ /**
149
+ * Height to be set on the overlay content.
150
+ */
151
+ contentHeight: {
152
+ type: String,
153
+ },
154
+
155
+ /**
156
+ * Width to be set on the overlay content.
157
+ */
158
+ contentWidth: {
159
+ type: String,
160
+ },
161
+
162
+ /** @private */
163
+ _overlayElement: {
164
+ type: Object,
165
+ },
166
+ };
167
+ }
168
+
169
+ static get observers() {
170
+ return [
171
+ '__updateContentHeight(contentHeight, _overlayElement)',
172
+ '__updateContentWidth(contentWidth, _overlayElement)',
173
+ ];
174
+ }
175
+
176
+ /** @protected */
177
+ ready() {
178
+ super.ready();
179
+
180
+ this._overlayElement = this.$.overlay;
181
+ }
182
+
183
+ /** @private */
184
+ __updateDimension(overlay, dimension, value) {
185
+ const prop = `--_vaadin-confirm-dialog-content-${dimension}`;
186
+
187
+ if (value) {
188
+ overlay.style.setProperty(prop, value);
189
+ } else {
190
+ overlay.style.removeProperty(prop);
191
+ }
192
+ }
193
+
194
+ /** @private */
195
+ __updateContentHeight(height, overlay) {
196
+ if (overlay) {
197
+ this.__updateDimension(overlay, 'height', height);
198
+ }
199
+ }
200
+
201
+ /** @private */
202
+ __updateContentWidth(width, overlay) {
203
+ if (overlay) {
204
+ this.__updateDimension(overlay, 'width', width);
205
+ }
206
+ }
145
207
  }
146
208
 
147
209
  customElements.define(ConfirmDialogDialog.is, ConfirmDialogDialog);
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2018 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2018 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
6
7
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
7
- import { SlotMixin } from '@vaadin/component-base/src/slot-mixin.js';
8
8
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
9
9
 
10
10
  /**
@@ -28,7 +28,7 @@ export type ConfirmDialogEventMap = ConfirmDialogCustomEventMap & HTMLElementEve
28
28
  * `<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.
29
29
  *
30
30
  * ```
31
- * <vaadin-confirm-dialog cancel>
31
+ * <vaadin-confirm-dialog cancel-button-visible>
32
32
  * There are unsaved changes. Do you really want to leave?
33
33
  * </vaadin-confirm-dialog>
34
34
  * ```
@@ -72,7 +72,7 @@ export type ConfirmDialogEventMap = ConfirmDialogCustomEventMap & HTMLElementEve
72
72
  * @fires {Event} reject - Fired when Reject button was pressed.
73
73
  * @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
74
74
  */
75
- declare class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(HTMLElement))) {
75
+ declare class ConfirmDialog extends ElementMixin(ThemePropertyMixin(ControllerMixin(HTMLElement))) {
76
76
  /**
77
77
  * True if the overlay is currently displayed.
78
78
  */
@@ -109,9 +109,10 @@ declare class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(HT
109
109
  noCloseOnEsc: boolean;
110
110
 
111
111
  /**
112
- * Whether to show cancel button or not.
112
+ * Whether to show reject button or not.
113
+ * @attr {boolean} reject-button-visible
113
114
  */
114
- reject: boolean;
115
+ rejectButtonVisible: boolean;
115
116
 
116
117
  /**
117
118
  * Text displayed on reject-button.
@@ -129,8 +130,9 @@ declare class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(HT
129
130
 
130
131
  /**
131
132
  * Whether to show cancel button or not.
133
+ * @attr {boolean} cancel-button-visible
132
134
  */
133
- cancel: boolean;
135
+ cancelButtonVisible: boolean;
134
136
 
135
137
  /**
136
138
  * Text displayed on cancel-button.
@@ -1,20 +1,20 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2018 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2018 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-confirm-dialog-overlay.js';
7
- import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
8
7
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
+ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
9
9
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
10
- import { SlotMixin } from '@vaadin/component-base/src/slot-mixin.js';
10
+ import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
11
11
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
12
12
 
13
13
  /**
14
14
  * `<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.
15
15
  *
16
16
  * ```
17
- * <vaadin-confirm-dialog cancel>
17
+ * <vaadin-confirm-dialog cancel-button-visible>
18
18
  * There are unsaved changes. Do you really want to leave?
19
19
  * </vaadin-confirm-dialog>
20
20
  * ```
@@ -59,11 +59,11 @@ import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-p
59
59
  * @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
60
60
  *
61
61
  * @extends HTMLElement
62
- * @mixes SlotMixin
62
+ * @mixes ControllerMixin
63
63
  * @mixes ElementMixin
64
64
  * @mixes ThemePropertyMixin
65
65
  */
66
- class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerElement))) {
66
+ class ConfirmDialog extends ElementMixin(ThemePropertyMixin(ControllerMixin(PolymerElement))) {
67
67
  static get template() {
68
68
  return html`
69
69
  <style>
@@ -80,6 +80,8 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
80
80
  theme$="[[_theme]]"
81
81
  no-close-on-outside-click
82
82
  no-close-on-esc="[[noCloseOnEsc]]"
83
+ content-height="[[_contentHeight]]"
84
+ content-width="[[_contentWidth]]"
83
85
  ></vaadin-confirm-dialog-dialog>
84
86
 
85
87
  <div hidden>
@@ -158,10 +160,11 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
158
160
  },
159
161
 
160
162
  /**
161
- * Whether to show cancel button or not.
163
+ * Whether to show reject button or not.
164
+ * @attr {boolean} reject-button-visible
162
165
  * @type {boolean}
163
166
  */
164
- reject: {
167
+ rejectButtonVisible: {
165
168
  type: Boolean,
166
169
  reflectToAttribute: true,
167
170
  value: false,
@@ -191,9 +194,10 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
191
194
 
192
195
  /**
193
196
  * Whether to show cancel button or not.
197
+ * @attr {boolean} cancel-button-visible
194
198
  * @type {boolean}
195
199
  */
196
- cancel: {
200
+ cancelButtonVisible: {
197
201
  type: Boolean,
198
202
  reflectToAttribute: true,
199
203
  value: false,
@@ -226,8 +230,7 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
226
230
  * @private
227
231
  */
228
232
  _cancelButton: {
229
- type: HTMLElement,
230
- observer: '_cancelButtonChanged',
233
+ type: Object,
231
234
  },
232
235
 
233
236
  /**
@@ -235,8 +238,7 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
235
238
  * @private
236
239
  */
237
240
  _confirmButton: {
238
- type: HTMLElement,
239
- observer: '_confirmButtonChanged',
241
+ type: Object,
240
242
  },
241
243
 
242
244
  /**
@@ -244,15 +246,16 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
244
246
  * @private
245
247
  */
246
248
  _headerNode: {
247
- type: HTMLElement,
249
+ type: Object,
248
250
  },
249
251
 
250
252
  /**
251
- * A reference to the message which will be placed in the overlay default slot.
253
+ * A list of message nodes which will be placed in the overlay default slot.
252
254
  * @private
253
255
  */
254
- _messageNode: {
255
- type: HTMLElement,
256
+ _messageNodes: {
257
+ type: Array,
258
+ value: () => [],
256
259
  },
257
260
 
258
261
  /**
@@ -260,8 +263,23 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
260
263
  * @private
261
264
  */
262
265
  _rejectButton: {
263
- type: HTMLElement,
264
- observer: '_rejectButtonChanged',
266
+ type: Object,
267
+ },
268
+
269
+ /**
270
+ * Height to be set on the overlay content.
271
+ * @protected
272
+ */
273
+ _contentHeight: {
274
+ type: String,
275
+ },
276
+
277
+ /**
278
+ * Width to be set on the overlay content.
279
+ * @protected
280
+ */
281
+ _contentWidth: {
282
+ type: String,
265
283
  },
266
284
  };
267
285
  }
@@ -269,76 +287,72 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
269
287
  static get observers() {
270
288
  return [
271
289
  '__updateConfirmButton(_confirmButton, confirmText, confirmTheme)',
272
- '__updateCancelButton(_cancelButton, cancelText, cancelTheme, cancel)',
290
+ '__updateCancelButton(_cancelButton, cancelText, cancelTheme, cancelButtonVisible)',
273
291
  '__updateHeaderNode(_headerNode, header)',
274
- '__updateMessageNode(_messageNode, message)',
275
- '__updateRejectButton(_rejectButton, rejectText, rejectTheme, reject)',
292
+ '__updateMessageNodes(_messageNodes, message)',
293
+ '__updateRejectButton(_rejectButton, rejectText, rejectTheme, rejectButtonVisible)',
276
294
  ];
277
295
  }
278
296
 
279
- /** @protected */
280
- get slots() {
281
- // NOTE: order in which slots are listed matches the template.
282
- return {
283
- ...super.slots,
284
- header: () => {
285
- const h3 = document.createElement('h3');
286
- this.__defaultHeader = h3;
287
- return h3;
288
- },
289
- '': () => {
290
- const div = document.createElement('div');
291
- this.__defaultMessage = div;
292
- return div;
293
- },
294
- 'cancel-button': () => {
295
- const button = document.createElement('vaadin-button');
296
- button.setAttribute('theme', this.cancelTheme);
297
- button.textContent = this.cancelText;
298
- button._isDefaultButton = true;
299
- return button;
300
- },
301
- 'reject-button': () => {
302
- const button = document.createElement('vaadin-button');
303
- button.setAttribute('theme', this.rejectTheme);
304
- button.textContent = this.rejectText;
305
- button._isDefaultButton = true;
306
- return button;
307
- },
308
- 'confirm-button': () => {
309
- const button = document.createElement('vaadin-button');
310
- button._isDefaultButton = true;
311
- return button;
312
- },
313
- };
314
- }
315
-
316
297
  constructor() {
317
298
  super();
318
- this.__slottedNodes = [];
319
- this._observer = new FlattenedNodesObserver(this, (info) => {
320
- this.__onDomChange(info.addedNodes);
321
- });
299
+
300
+ this.__cancel = this.__cancel.bind(this);
301
+ this.__confirm = this.__confirm.bind(this);
302
+ this.__reject = this.__reject.bind(this);
303
+ }
304
+
305
+ get __slottedNodes() {
306
+ return [this._headerNode, ...this._messageNodes, this._cancelButton, this._confirmButton, this._rejectButton];
322
307
  }
323
308
 
324
309
  /** @protected */
325
310
  ready() {
326
311
  super.ready();
327
312
 
328
- this.__boundCancel = this._cancel.bind(this);
329
- this.__boundConfirm = this._confirm.bind(this);
330
- this.__boundReject = this._reject.bind(this);
331
-
332
313
  this._overlayElement = this.$.dialog.$.overlay;
333
314
  this._overlayElement.addEventListener('vaadin-overlay-escape-press', this._escPressed.bind(this));
334
315
  this._overlayElement.addEventListener('vaadin-overlay-open', () => this.__onDialogOpened());
335
316
  this._overlayElement.addEventListener('vaadin-confirm-dialog-close', () => this.__onDialogClosed());
336
317
 
337
- if (this._dimensions) {
338
- Object.keys(this._dimensions).forEach((name) => {
339
- this._setDimension(name, this._dimensions[name]);
340
- });
341
- }
318
+ this._headerController = new SlotController(this, 'header', 'h3', {
319
+ initializer: (node) => {
320
+ this._headerNode = node;
321
+ },
322
+ });
323
+ this.addController(this._headerController);
324
+
325
+ this._messageController = new SlotController(this, '', 'div', {
326
+ // Allow providing multiple custom nodes in the default slot
327
+ multiple: true,
328
+ observe: false,
329
+ initializer: (node) => {
330
+ this._messageNodes = [...this._messageNodes, node];
331
+ },
332
+ });
333
+ this.addController(this._messageController);
334
+
335
+ // NOTE: order in which buttons are added should match the order of slots in template
336
+ this._cancelController = new SlotController(this, 'cancel-button', 'vaadin-button', {
337
+ initializer: (button) => {
338
+ this.__setupSlottedButton('cancel', button);
339
+ },
340
+ });
341
+ this.addController(this._cancelController);
342
+
343
+ this._rejectController = new SlotController(this, 'reject-button', 'vaadin-button', {
344
+ initializer: (button) => {
345
+ this.__setupSlottedButton('reject', button);
346
+ },
347
+ });
348
+ this.addController(this._rejectController);
349
+
350
+ this._confirmController = new SlotController(this, 'confirm-button', 'vaadin-button', {
351
+ initializer: (button) => {
352
+ this.__setupSlottedButton('confirm', button);
353
+ },
354
+ });
355
+ this.addController(this._confirmController);
342
356
  }
343
357
 
344
358
  /** @private */
@@ -358,73 +372,29 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
358
372
 
359
373
  /** @private */
360
374
  __onDialogClosed() {
361
- const nodes = this.__slottedNodes;
362
-
363
- // Reset the list of nodes, it will be re-created.
364
- this.__slottedNodes = [];
365
-
366
375
  // Move nodes from the overlay back to the host.
367
- nodes.forEach((node) => {
376
+ this.__slottedNodes.forEach((node) => {
368
377
  this.appendChild(node);
369
378
  });
370
379
  }
371
380
 
372
381
  /** @private */
373
- __onDomChange(addedNodes) {
374
- // TODO: restore default element when a corresponding slotted element is removed.
375
- // Consider creating a controller to reuse custom helper logic from FieldMixin.
376
- addedNodes.forEach((node) => {
377
- this.__slottedNodes.push(node);
378
-
379
- const isElementNode = node.nodeType === Node.ELEMENT_NODE;
380
- const slotName = isElementNode ? node.getAttribute('slot') : '';
381
-
382
- // Handle named slots (header and buttons).
383
- if (slotName) {
384
- if (slotName.indexOf('button') >= 0) {
385
- const [button] = slotName.split('-');
386
- this[`_${button}Button`] = node;
387
- } else if (slotName === 'header') {
388
- this._headerNode = node;
389
- }
390
- } else {
391
- const isNotEmptyText = node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== '';
392
- // Handle default slot (message element).
393
- if (isNotEmptyText || (isElementNode && node.slot === '')) {
394
- this._messageNode = node;
395
- }
396
- }
397
- });
398
- }
399
-
400
- /** @private */
401
- _cancelButtonChanged(button, oldButton) {
402
- this.__setupSlottedButton(button, oldButton, this.__boundCancel);
403
- }
404
-
405
- /** @private */
406
- _confirmButtonChanged(button, oldButton) {
407
- this.__setupSlottedButton(button, oldButton, this.__boundConfirm);
408
- }
409
-
410
- /** @private */
411
- _rejectButtonChanged(button, oldButton) {
412
- this.__setupSlottedButton(button, oldButton, this.__boundReject);
413
- }
382
+ __setupSlottedButton(type, button) {
383
+ const property = `_${type}Button`;
384
+ const listener = `__${type}`;
414
385
 
415
- /** @private */
416
- __setupSlottedButton(slottedButton, currentButton, clickListener) {
417
- if (currentButton && currentButton.parentElement) {
418
- currentButton.remove();
386
+ if (this[property] && this[property] !== button) {
387
+ this[property].remove();
419
388
  }
420
389
 
421
- slottedButton.addEventListener('click', clickListener);
390
+ button.addEventListener('click', this[listener]);
391
+ this[property] = button;
422
392
  }
423
393
 
424
394
  /** @private */
425
395
  __updateCancelButton(button, cancelText, cancelTheme, showCancel) {
426
396
  if (button) {
427
- if (button._isDefaultButton) {
397
+ if (button === this._cancelController.defaultNode) {
428
398
  button.textContent = cancelText;
429
399
  button.setAttribute('theme', cancelTheme);
430
400
  }
@@ -434,7 +404,7 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
434
404
 
435
405
  /** @private */
436
406
  __updateConfirmButton(button, confirmText, confirmTheme) {
437
- if (button && button._isDefaultButton) {
407
+ if (button && button === this._confirmController.defaultNode) {
438
408
  button.textContent = confirmText;
439
409
  button.setAttribute('theme', confirmTheme);
440
410
  }
@@ -443,23 +413,25 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
443
413
  /** @private */
444
414
  __updateHeaderNode(headerNode, header) {
445
415
  // Only update text content for the default header node.
446
- if (headerNode && headerNode === this.__defaultHeader) {
416
+ if (headerNode && headerNode === this._headerController.defaultNode) {
447
417
  headerNode.textContent = header;
448
418
  }
449
419
  }
450
420
 
451
421
  /** @private */
452
- __updateMessageNode(messageNode, message) {
453
- // Only update text content for the default message node.
454
- if (messageNode && messageNode === this.__defaultMessage) {
455
- messageNode.textContent = message;
422
+ __updateMessageNodes(nodes, message) {
423
+ if (nodes && nodes.length > 0) {
424
+ const defaultNode = nodes.find((node) => node === this._messageController.defaultNode);
425
+ if (defaultNode) {
426
+ defaultNode.textContent = message;
427
+ }
456
428
  }
457
429
  }
458
430
 
459
431
  /** @private */
460
432
  __updateRejectButton(button, rejectText, rejectTheme, showReject) {
461
433
  if (button) {
462
- if (button._isDefaultButton) {
434
+ if (button === this._rejectController.defaultNode) {
463
435
  button.textContent = rejectText;
464
436
  button.setAttribute('theme', rejectTheme);
465
437
  }
@@ -470,24 +442,24 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
470
442
  /** @private */
471
443
  _escPressed(event) {
472
444
  if (!event.defaultPrevented) {
473
- this._cancel();
445
+ this.__cancel();
474
446
  }
475
447
  }
476
448
 
477
449
  /** @private */
478
- _confirm() {
450
+ __confirm() {
479
451
  this.dispatchEvent(new CustomEvent('confirm'));
480
452
  this.opened = false;
481
453
  }
482
454
 
483
455
  /** @private */
484
- _cancel() {
456
+ __cancel() {
485
457
  this.dispatchEvent(new CustomEvent('cancel'));
486
458
  this.opened = false;
487
459
  }
488
460
 
489
461
  /** @private */
490
- _reject() {
462
+ __reject() {
491
463
  this.dispatchEvent(new CustomEvent('reject'));
492
464
  this.opened = false;
493
465
  }
@@ -497,31 +469,6 @@ class ConfirmDialog extends SlotMixin(ElementMixin(ThemePropertyMixin(PolymerEle
497
469
  return header || 'confirmation';
498
470
  }
499
471
 
500
- /** @private */
501
- _setWidth(width) {
502
- this._setDimensionIfAttached('width', width);
503
- }
504
-
505
- /** @private */
506
- _setHeight(height) {
507
- this._setDimensionIfAttached('height', height);
508
- }
509
-
510
- /** @private */
511
- _setDimensionIfAttached(name, value) {
512
- if (this._overlayElement) {
513
- this._setDimension(name, value);
514
- } else {
515
- this._dimensions = this._dimensions || {};
516
- this._dimensions[name] = value;
517
- }
518
- }
519
-
520
- /** @private */
521
- _setDimension(name, value) {
522
- this._overlayElement.style.setProperty(`--_vaadin-confirm-dialog-content-${name}`, value);
523
- }
524
-
525
472
  /**
526
473
  * @event confirm
527
474
  * fired when Confirm button was pressed.
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/confirm-dialog",
4
- "version": "23.3.3",
4
+ "version": "24.0.0-alpha10",
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```\n<vaadin-confirm-dialog cancel>\n There are unsaved changes. Do you really want to leave?\n</vaadin-confirm-dialog>\n```\n\n### Styling\n\nThe `<vaadin-confirm-dialog>` is not themable. Apply styles to `<vaadin-confirm-dialog-overlay>`\ncomponent and use its shadow parts for styling.\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.3.3/#/elements/vaadin-overlay) for the overlay styling documentation.\n\nIn addition to `<vaadin-overlay>` parts, the following parts are available for theming:\n\nPart name | Description\n-----------------|-------------------------------------------\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.\nAlso, the `theme` attribute value set on `<vaadin-confirm-dialog>` is propagated to the\n`<vaadin-confirm-dialog-overlay>` component.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/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",
11
+ "description": "`<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.\n\n```\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 `<vaadin-confirm-dialog>` is not themable. Apply styles to `<vaadin-confirm-dialog-overlay>`\ncomponent and use its shadow parts for styling.\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha10/#/elements/vaadin-overlay) for the overlay styling documentation.\n\nIn addition to `<vaadin-overlay>` parts, the following parts are available for theming:\n\nPart name | Description\n-----------------|-------------------------------------------\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.\nAlso, the `theme` attribute value set on `<vaadin-confirm-dialog>` is propagated to the\n`<vaadin-confirm-dialog-overlay>` component.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/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
13
  {
14
14
  "name": "opened",
@@ -67,8 +67,8 @@
67
67
  }
68
68
  },
69
69
  {
70
- "name": "reject",
71
- "description": "Whether to show cancel button or not.",
70
+ "name": "reject-button-visible",
71
+ "description": "Whether to show reject button or not.",
72
72
  "value": {
73
73
  "type": [
74
74
  "boolean"
@@ -94,7 +94,7 @@
94
94
  }
95
95
  },
96
96
  {
97
- "name": "cancel",
97
+ "name": "cancel-button-visible",
98
98
  "description": "Whether to show cancel button or not.",
99
99
  "value": {
100
100
  "type": [
@@ -191,8 +191,8 @@
191
191
  }
192
192
  },
193
193
  {
194
- "name": "reject",
195
- "description": "Whether to show cancel button or not.",
194
+ "name": "rejectButtonVisible",
195
+ "description": "Whether to show reject button or not.",
196
196
  "value": {
197
197
  "type": [
198
198
  "boolean"
@@ -218,7 +218,7 @@
218
218
  }
219
219
  },
220
220
  {
221
- "name": "cancel",
221
+ "name": "cancelButtonVisible",
222
222
  "description": "Whether to show cancel button or not.",
223
223
  "value": {
224
224
  "type": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/confirm-dialog",
4
- "version": "23.3.3",
4
+ "version": "24.0.0-alpha10",
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```\n<vaadin-confirm-dialog cancel>\n There are unsaved changes. Do you really want to leave?\n</vaadin-confirm-dialog>\n```\n\n### Styling\n\nThe `<vaadin-confirm-dialog>` is not themable. Apply styles to `<vaadin-confirm-dialog-overlay>`\ncomponent and use its shadow parts for styling.\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.3.3/#/elements/vaadin-overlay) for the overlay styling documentation.\n\nIn addition to `<vaadin-overlay>` parts, the following parts are available for theming:\n\nPart name | Description\n-----------------|-------------------------------------------\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.\nAlso, the `theme` attribute value set on `<vaadin-confirm-dialog>` is propagated to the\n`<vaadin-confirm-dialog-overlay>` component.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/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",
19
+ "description": "`<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.\n\n```\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 `<vaadin-confirm-dialog>` is not themable. Apply styles to `<vaadin-confirm-dialog-overlay>`\ncomponent and use its shadow parts for styling.\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha10/#/elements/vaadin-overlay) for the overlay styling documentation.\n\nIn addition to `<vaadin-overlay>` parts, the following parts are available for theming:\n\nPart name | Description\n-----------------|-------------------------------------------\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.\nAlso, the `theme` attribute value set on `<vaadin-confirm-dialog>` is propagated to the\n`<vaadin-confirm-dialog-overlay>` component.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/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
  {
@@ -34,14 +34,14 @@
34
34
  }
35
35
  },
36
36
  {
37
- "name": "?reject",
38
- "description": "Whether to show cancel button or not.",
37
+ "name": "?rejectButtonVisible",
38
+ "description": "Whether to show reject button or not.",
39
39
  "value": {
40
40
  "kind": "expression"
41
41
  }
42
42
  },
43
43
  {
44
- "name": "?cancel",
44
+ "name": "?cancelButtonVisible",
45
45
  "description": "Whether to show cancel button or not.",
46
46
  "value": {
47
47
  "kind": "expression"