@vaadin/confirm-dialog 24.2.0-beta3 → 24.2.0-beta4

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.
@@ -6,11 +6,13 @@
6
6
  import '@vaadin/button/src/vaadin-button.js';
7
7
  import './vaadin-confirm-dialog-overlay.js';
8
8
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
9
+ import { setAriaIDReference } from '@vaadin/a11y-base/src/aria-id-reference.js';
9
10
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
10
11
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
11
12
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
13
+ import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
14
+ import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
12
15
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
13
- import { ConfirmDialogMixin } from './vaadin-confirm-dialog-mixin.js';
14
16
 
15
17
  /**
16
18
  * `<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.
@@ -62,12 +64,11 @@ import { ConfirmDialogMixin } from './vaadin-confirm-dialog-mixin.js';
62
64
  *
63
65
  * @customElement
64
66
  * @extends HTMLElement
65
- * @mixes ConfirmDialogMixin
66
67
  * @mixes ControllerMixin
67
68
  * @mixes ElementMixin
68
69
  * @mixes ThemePropertyMixin
69
70
  */
70
- class ConfirmDialog extends ConfirmDialogMixin(ElementMixin(ThemePropertyMixin(ControllerMixin(PolymerElement)))) {
71
+ class ConfirmDialog extends ElementMixin(ThemePropertyMixin(ControllerMixin(PolymerElement))) {
71
72
  static get template() {
72
73
  return html`
73
74
  <style>
@@ -103,13 +104,422 @@ class ConfirmDialog extends ConfirmDialogMixin(ElementMixin(ThemePropertyMixin(C
103
104
  return 'vaadin-confirm-dialog';
104
105
  }
105
106
 
107
+ static get properties() {
108
+ return {
109
+ /**
110
+ * Sets the `aria-describedby` attribute of the overlay element.
111
+ *
112
+ * By default, all elements inside the message area are linked
113
+ * through the `aria-describedby` attribute. However, there are
114
+ * cases where this can confuse screen reader users (e.g. the dialog
115
+ * may present a password confirmation form). For these cases,
116
+ * it's better to associate only the elements that will help describe
117
+ * the confirmation dialog through this API.
118
+ */
119
+ accessibleDescriptionRef: {
120
+ type: String,
121
+ },
122
+ /**
123
+ * True if the overlay is currently displayed.
124
+ * @type {boolean}
125
+ */
126
+ opened: {
127
+ type: Boolean,
128
+ value: false,
129
+ notify: true,
130
+ },
131
+
132
+ /**
133
+ * Set the confirmation dialog title.
134
+ * @type {string}
135
+ */
136
+ header: {
137
+ type: String,
138
+ value: '',
139
+ },
140
+
141
+ /**
142
+ * Set the message or confirmation question.
143
+ */
144
+ message: {
145
+ type: String,
146
+ value: '',
147
+ },
148
+
149
+ /**
150
+ * Text displayed on confirm-button.
151
+ * This only affects the default button, custom slotted buttons will not be altered.
152
+ * @attr {string} confirm-text
153
+ * @type {string}
154
+ */
155
+ confirmText: {
156
+ type: String,
157
+ value: 'Confirm',
158
+ },
159
+
160
+ /**
161
+ * Theme for a confirm-button.
162
+ * This only affects the default button, custom slotted buttons will not be altered.
163
+ * @attr {string} confirm-theme
164
+ * @type {string}
165
+ */
166
+ confirmTheme: {
167
+ type: String,
168
+ value: 'primary',
169
+ },
170
+
171
+ /**
172
+ * Set to true to disable closing dialog on Escape press
173
+ * @attr {boolean} no-close-on-esc
174
+ * @type {boolean}
175
+ */
176
+ noCloseOnEsc: {
177
+ type: Boolean,
178
+ value: false,
179
+ },
180
+
181
+ /**
182
+ * Whether to show reject button or not.
183
+ * @attr {boolean} reject-button-visible
184
+ * @type {boolean}
185
+ */
186
+ rejectButtonVisible: {
187
+ type: Boolean,
188
+ reflectToAttribute: true,
189
+ value: false,
190
+ },
191
+
192
+ /**
193
+ * Text displayed on reject-button.
194
+ * This only affects the default button, custom slotted buttons will not be altered.
195
+ * @attr {string} reject-text
196
+ * @type {string}
197
+ */
198
+ rejectText: {
199
+ type: String,
200
+ value: 'Reject',
201
+ },
202
+
203
+ /**
204
+ * Theme for a reject-button.
205
+ * This only affects the default button, custom slotted buttons will not be altered.
206
+ * @attr {string} reject-theme
207
+ * @type {string}
208
+ */
209
+ rejectTheme: {
210
+ type: String,
211
+ value: 'error tertiary',
212
+ },
213
+
214
+ /**
215
+ * Whether to show cancel button or not.
216
+ * @attr {boolean} cancel-button-visible
217
+ * @type {boolean}
218
+ */
219
+ cancelButtonVisible: {
220
+ type: Boolean,
221
+ reflectToAttribute: true,
222
+ value: false,
223
+ },
224
+
225
+ /**
226
+ * Text displayed on cancel-button.
227
+ * This only affects the default button, custom slotted buttons will not be altered.
228
+ * @attr {string} cancel-text
229
+ * @type {string}
230
+ */
231
+ cancelText: {
232
+ type: String,
233
+ value: 'Cancel',
234
+ },
235
+
236
+ /**
237
+ * Theme for a cancel-button.
238
+ * This only affects the default button, custom slotted buttons will not be altered.
239
+ * @attr {string} cancel-theme
240
+ * @type {string}
241
+ */
242
+ cancelTheme: {
243
+ type: String,
244
+ value: 'tertiary',
245
+ },
246
+
247
+ /**
248
+ * A space-delimited list of CSS class names
249
+ * to set on the underlying overlay element.
250
+ *
251
+ * @attr {string} overlay-class
252
+ */
253
+ overlayClass: {
254
+ type: String,
255
+ },
256
+
257
+ /**
258
+ * A reference to the "Cancel" button which will be teleported to the overlay.
259
+ * @private
260
+ */
261
+ _cancelButton: {
262
+ type: Object,
263
+ },
264
+
265
+ /**
266
+ * A reference to the "Confirm" button which will be teleported to the overlay.
267
+ * @private
268
+ */
269
+ _confirmButton: {
270
+ type: Object,
271
+ },
272
+
273
+ /**
274
+ * A reference to the "header" node which will be teleported to the overlay.
275
+ * @private
276
+ */
277
+ _headerNode: {
278
+ type: Object,
279
+ },
280
+
281
+ /**
282
+ * A list of message nodes which will be placed in the overlay default slot.
283
+ * @private
284
+ */
285
+ _messageNodes: {
286
+ type: Array,
287
+ value: () => [],
288
+ },
289
+
290
+ /**
291
+ * A reference to the "Reject" button which will be teleported to the overlay.
292
+ * @private
293
+ */
294
+ _rejectButton: {
295
+ type: Object,
296
+ },
297
+
298
+ /**
299
+ * Height to be set on the overlay content.
300
+ * @protected
301
+ */
302
+ _contentHeight: {
303
+ type: String,
304
+ },
305
+
306
+ /**
307
+ * Width to be set on the overlay content.
308
+ * @protected
309
+ */
310
+ _contentWidth: {
311
+ type: String,
312
+ },
313
+ };
314
+ }
315
+
316
+ static get observers() {
317
+ return [
318
+ '__updateConfirmButton(_confirmButton, confirmText, confirmTheme)',
319
+ '__updateCancelButton(_cancelButton, cancelText, cancelTheme, cancelButtonVisible)',
320
+ '__updateHeaderNode(_headerNode, header)',
321
+ '__updateMessageNodes(_messageNodes, message)',
322
+ '__updateRejectButton(_rejectButton, rejectText, rejectTheme, rejectButtonVisible)',
323
+ '__accessibleDescriptionRefChanged(_overlayElement, accessibleDescriptionRef)',
324
+ ];
325
+ }
326
+
327
+ constructor() {
328
+ super();
329
+
330
+ this.__cancel = this.__cancel.bind(this);
331
+ this.__confirm = this.__confirm.bind(this);
332
+ this.__reject = this.__reject.bind(this);
333
+ }
334
+
335
+ get __slottedNodes() {
336
+ return [this._headerNode, ...this._messageNodes, this._cancelButton, this._confirmButton, this._rejectButton];
337
+ }
338
+
106
339
  /** @protected */
107
340
  ready() {
108
341
  super.ready();
109
342
 
110
343
  this._overlayElement = this.$.dialog.$.overlay;
344
+ this._overlayElement.addEventListener('vaadin-overlay-escape-press', this._escPressed.bind(this));
345
+ this._overlayElement.addEventListener('vaadin-overlay-open', () => this.__onDialogOpened());
346
+ this._overlayElement.addEventListener('vaadin-overlay-closed', () => this.__onDialogClosed());
347
+ this._overlayElement.setAttribute('role', 'alertdialog');
348
+
349
+ this._headerController = new SlotController(this, 'header', 'h3', {
350
+ initializer: (node) => {
351
+ this._headerNode = node;
352
+ },
353
+ });
354
+ this.addController(this._headerController);
355
+
356
+ this._messageController = new SlotController(this, '', 'div', {
357
+ // Allow providing multiple custom nodes in the default slot
358
+ multiple: true,
359
+ observe: false,
360
+ initializer: (node) => {
361
+ const wrapper = document.createElement('div');
362
+ wrapper.style.display = 'contents';
363
+ const wrapperId = `confirm-dialog-message-${generateUniqueId()}`;
364
+ wrapper.id = wrapperId;
365
+ this.appendChild(wrapper);
366
+ wrapper.appendChild(node);
367
+ setAriaIDReference(this._overlayElement, 'aria-describedby', { newId: wrapperId });
368
+ this._messageNodes = [...this._messageNodes, wrapper];
369
+ },
370
+ });
371
+ this.addController(this._messageController);
372
+
373
+ // NOTE: order in which buttons are added should match the order of slots in template
374
+ this._cancelController = new SlotController(this, 'cancel-button', 'vaadin-button', {
375
+ initializer: (button) => {
376
+ this.__setupSlottedButton('cancel', button);
377
+ },
378
+ });
379
+ this.addController(this._cancelController);
380
+
381
+ this._rejectController = new SlotController(this, 'reject-button', 'vaadin-button', {
382
+ initializer: (button) => {
383
+ this.__setupSlottedButton('reject', button);
384
+ },
385
+ });
386
+ this.addController(this._rejectController);
387
+
388
+ this._confirmController = new SlotController(this, 'confirm-button', 'vaadin-button', {
389
+ initializer: (button) => {
390
+ this.__setupSlottedButton('confirm', button);
391
+ },
392
+ });
393
+ this.addController(this._confirmController);
394
+ }
395
+
396
+ /** @private */
397
+ __accessibleDescriptionRefChanged(_overlayElement, accessibleDescriptionRef) {
398
+ if (!_overlayElement || (!accessibleDescriptionRef && !this.__oldAccessibleDescriptionRef)) {
399
+ return;
400
+ }
401
+ setAriaIDReference(this._overlayElement, 'aria-describedby', {
402
+ newId: accessibleDescriptionRef,
403
+ oldId: this.__oldAccessibleDescriptionRef,
404
+ fromUser: true,
405
+ });
406
+ this.__oldAccessibleDescriptionRef = accessibleDescriptionRef;
407
+ }
408
+
409
+ /** @private */
410
+ __onDialogOpened() {
411
+ const overlay = this._overlayElement;
412
+
413
+ // Teleport slotted nodes to the overlay element.
414
+ this.__slottedNodes.forEach((node) => {
415
+ overlay.appendChild(node);
416
+ });
417
+
418
+ const confirmButton = overlay.querySelector('[slot="confirm-button"]');
419
+ if (confirmButton) {
420
+ confirmButton.focus();
421
+ }
422
+ }
423
+
424
+ /** @private */
425
+ __onDialogClosed() {
426
+ // Move nodes from the overlay back to the host.
427
+ this.__slottedNodes.forEach((node) => {
428
+ this.appendChild(node);
429
+ });
430
+ }
431
+
432
+ /** @private */
433
+ __setupSlottedButton(type, button) {
434
+ const property = `_${type}Button`;
435
+ const listener = `__${type}`;
436
+
437
+ if (this[property] && this[property] !== button) {
438
+ this[property].remove();
439
+ }
440
+
441
+ button.addEventListener('click', this[listener]);
442
+ this[property] = button;
443
+ }
444
+
445
+ /** @private */
446
+ __updateCancelButton(button, cancelText, cancelTheme, showCancel) {
447
+ if (button) {
448
+ if (button === this._cancelController.defaultNode) {
449
+ button.textContent = cancelText;
450
+ button.setAttribute('theme', cancelTheme);
451
+ }
452
+ button.toggleAttribute('hidden', !showCancel);
453
+ }
454
+ }
455
+
456
+ /** @private */
457
+ __updateConfirmButton(button, confirmText, confirmTheme) {
458
+ if (button && button === this._confirmController.defaultNode) {
459
+ button.textContent = confirmText;
460
+ button.setAttribute('theme', confirmTheme);
461
+ }
462
+ }
463
+
464
+ /** @private */
465
+ __updateHeaderNode(headerNode, header) {
466
+ // Only update text content for the default header node.
467
+ if (headerNode && headerNode === this._headerController.defaultNode) {
468
+ headerNode.textContent = header;
469
+ }
470
+ }
471
+
472
+ /** @private */
473
+ __updateMessageNodes(nodes, message) {
474
+ if (nodes && nodes.length > 0) {
475
+ const defaultWrapperNode = nodes.find(
476
+ (node) => this._messageController.defaultNode && node === this._messageController.defaultNode.parentElement,
477
+ );
478
+ if (defaultWrapperNode) {
479
+ defaultWrapperNode.firstChild.textContent = message;
480
+ }
481
+ }
482
+ }
483
+
484
+ /** @private */
485
+ __updateRejectButton(button, rejectText, rejectTheme, showReject) {
486
+ if (button) {
487
+ if (button === this._rejectController.defaultNode) {
488
+ button.textContent = rejectText;
489
+ button.setAttribute('theme', rejectTheme);
490
+ }
491
+ button.toggleAttribute('hidden', !showReject);
492
+ }
493
+ }
494
+
495
+ /** @private */
496
+ _escPressed(event) {
497
+ if (!event.defaultPrevented) {
498
+ this.__cancel();
499
+ }
500
+ }
501
+
502
+ /** @private */
503
+ __confirm() {
504
+ this.dispatchEvent(new CustomEvent('confirm'));
505
+ this.opened = false;
506
+ }
507
+
508
+ /** @private */
509
+ __cancel() {
510
+ this.dispatchEvent(new CustomEvent('cancel'));
511
+ this.opened = false;
512
+ }
513
+
514
+ /** @private */
515
+ __reject() {
516
+ this.dispatchEvent(new CustomEvent('reject'));
517
+ this.opened = false;
518
+ }
111
519
 
112
- this._initOverlay(this._overlayElement);
520
+ /** @private */
521
+ _getAriaLabel(header) {
522
+ return header || 'confirmation';
113
523
  }
114
524
 
115
525
  /**
@@ -1,4 +1,3 @@
1
- import '@vaadin/button/theme/lumo/vaadin-button-styles.js';
2
1
  import '@vaadin/vaadin-lumo-styles/color.js';
3
2
  import '@vaadin/vaadin-lumo-styles/spacing.js';
4
3
  import { dialogOverlay } from '@vaadin/dialog/theme/lumo/vaadin-dialog-styles.js';
@@ -1,4 +1,3 @@
1
- import '@vaadin/button/theme/material/vaadin-button-styles.js';
2
1
  import { dialogOverlay } from '@vaadin/dialog/theme/material/vaadin-dialog-styles.js';
3
2
  import { overlay } from '@vaadin/vaadin-material-styles/mixins/overlay.js';
4
3
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
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": "24.2.0-beta3",
4
+ "version": "24.2.0-beta4",
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-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.2.0-beta3/#/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/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.2.0-beta4/#/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/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": "accessible-description-ref",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/confirm-dialog",
4
- "version": "24.2.0-beta3",
4
+ "version": "24.2.0-beta4",
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-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.2.0-beta3/#/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/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.2.0-beta4/#/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/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
  {
@@ -1,29 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2023 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 ConfirmDialogBaseMixin {
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 - 2023 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
- };