@vaadin/confirm-dialog 24.0.0-alpha6 → 24.0.0-alpha8

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": "24.0.0-alpha6",
3
+ "version": "24.0.0-alpha8",
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": "24.0.0-alpha6",
40
- "@vaadin/component-base": "24.0.0-alpha6",
41
- "@vaadin/dialog": "24.0.0-alpha6",
42
- "@vaadin/overlay": "24.0.0-alpha6",
43
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha6",
44
- "@vaadin/vaadin-material-styles": "24.0.0-alpha6",
45
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha6"
39
+ "@vaadin/button": "24.0.0-alpha8",
40
+ "@vaadin/component-base": "24.0.0-alpha8",
41
+ "@vaadin/dialog": "24.0.0-alpha8",
42
+ "@vaadin/overlay": "24.0.0-alpha8",
43
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha8",
44
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha8",
45
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha8"
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": "0004ac92b6e5f415b5fa949e0582d1d11e527b1f"
56
+ "gitHead": "476752249bb12295c500980d98a3256ad3b22b73"
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,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 { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
@@ -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
  * ```
@@ -109,9 +109,10 @@ declare class ConfirmDialog extends ElementMixin(ThemePropertyMixin(ControllerMi
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 ElementMixin(ThemePropertyMixin(ControllerMi
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,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 './vaadin-confirm-dialog-overlay.js';
@@ -14,7 +14,7 @@ import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-p
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
  * ```
@@ -80,6 +80,8 @@ class ConfirmDialog extends ElementMixin(ThemePropertyMixin(ControllerMixin(Poly
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 ElementMixin(ThemePropertyMixin(ControllerMixin(Poly
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 ElementMixin(ThemePropertyMixin(ControllerMixin(Poly
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,
@@ -261,16 +265,32 @@ class ConfirmDialog extends ElementMixin(ThemePropertyMixin(ControllerMixin(Poly
261
265
  _rejectButton: {
262
266
  type: Object,
263
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,
283
+ },
264
284
  };
265
285
  }
266
286
 
267
287
  static get observers() {
268
288
  return [
269
289
  '__updateConfirmButton(_confirmButton, confirmText, confirmTheme)',
270
- '__updateCancelButton(_cancelButton, cancelText, cancelTheme, cancel)',
290
+ '__updateCancelButton(_cancelButton, cancelText, cancelTheme, cancelButtonVisible)',
271
291
  '__updateHeaderNode(_headerNode, header)',
272
292
  '__updateMessageNodes(_messageNodes, message)',
273
- '__updateRejectButton(_rejectButton, rejectText, rejectTheme, reject)',
293
+ '__updateRejectButton(_rejectButton, rejectText, rejectTheme, rejectButtonVisible)',
274
294
  ];
275
295
  }
276
296
 
@@ -295,12 +315,6 @@ class ConfirmDialog extends ElementMixin(ThemePropertyMixin(ControllerMixin(Poly
295
315
  this._overlayElement.addEventListener('vaadin-overlay-open', () => this.__onDialogOpened());
296
316
  this._overlayElement.addEventListener('vaadin-confirm-dialog-close', () => this.__onDialogClosed());
297
317
 
298
- if (this._dimensions) {
299
- Object.keys(this._dimensions).forEach((name) => {
300
- this._setDimension(name, this._dimensions[name]);
301
- });
302
- }
303
-
304
318
  this._headerController = new SlotController(this, 'header', 'h3', {
305
319
  initializer: (node) => {
306
320
  this._headerNode = node;
@@ -455,31 +469,6 @@ class ConfirmDialog extends ElementMixin(ThemePropertyMixin(ControllerMixin(Poly
455
469
  return header || 'confirmation';
456
470
  }
457
471
 
458
- /** @private */
459
- _setWidth(width) {
460
- this._setDimensionIfAttached('width', width);
461
- }
462
-
463
- /** @private */
464
- _setHeight(height) {
465
- this._setDimensionIfAttached('height', height);
466
- }
467
-
468
- /** @private */
469
- _setDimensionIfAttached(name, value) {
470
- if (this._overlayElement) {
471
- this._setDimension(name, value);
472
- } else {
473
- this._dimensions = this._dimensions || {};
474
- this._dimensions[name] = value;
475
- }
476
- }
477
-
478
- /** @private */
479
- _setDimension(name, value) {
480
- this._overlayElement.style.setProperty(`--_vaadin-confirm-dialog-content-${name}`, value);
481
- }
482
-
483
472
  /**
484
473
  * @event confirm
485
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": "24.0.0-alpha6",
4
+ "version": "24.0.0-alpha8",
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/24.0.0-alpha6/#/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-alpha8/#/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": "24.0.0-alpha6",
4
+ "version": "24.0.0-alpha8",
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/24.0.0-alpha6/#/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-alpha8/#/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"