@vaadin/confirm-dialog 25.0.0-alpha2 → 25.0.0-alpha4

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": "25.0.0-alpha2",
3
+ "version": "25.0.0-alpha4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,18 +35,18 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@vaadin/button": "25.0.0-alpha2",
39
- "@vaadin/component-base": "25.0.0-alpha2",
40
- "@vaadin/dialog": "25.0.0-alpha2",
41
- "@vaadin/overlay": "25.0.0-alpha2",
42
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
43
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
38
+ "@vaadin/button": "25.0.0-alpha4",
39
+ "@vaadin/component-base": "25.0.0-alpha4",
40
+ "@vaadin/dialog": "25.0.0-alpha4",
41
+ "@vaadin/overlay": "25.0.0-alpha4",
42
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha4",
43
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha4",
44
44
  "lit": "^3.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@vaadin/a11y-base": "25.0.0-alpha2",
48
- "@vaadin/chai-plugins": "25.0.0-alpha2",
49
- "@vaadin/test-runner-commands": "25.0.0-alpha2",
47
+ "@vaadin/a11y-base": "25.0.0-alpha4",
48
+ "@vaadin/chai-plugins": "25.0.0-alpha4",
49
+ "@vaadin/test-runner-commands": "25.0.0-alpha4",
50
50
  "@vaadin/testing-helpers": "^2.0.0",
51
51
  "sinon": "^18.0.0"
52
52
  },
@@ -54,5 +54,5 @@
54
54
  "web-types.json",
55
55
  "web-types.lit.json"
56
56
  ],
57
- "gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
57
+ "gitHead": "ce4421f0daf26027b863b91787a474e4cc264344"
58
58
  }
@@ -5,4 +5,4 @@
5
5
  */
6
6
  import type { CSSResult } from 'lit';
7
7
 
8
- export const confirmDialogOverlay: CSSResult;
8
+ export const confirmDialogOverlayStyles: CSSResult;
@@ -4,18 +4,10 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { css } from 'lit';
7
+ import { dialogOverlayBase } from '@vaadin/dialog/src/styles/vaadin-dialog-overlay-styles.js';
8
+ import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-core-styles.js';
7
9
 
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
-
10
+ const confirmDialogOverlay = css`
19
11
  #resizerContainer {
20
12
  height: 100%;
21
13
  }
@@ -29,3 +21,5 @@ export const confirmDialogOverlay = css`
29
21
  pointer-events: all;
30
22
  }
31
23
  `;
24
+
25
+ export const confirmDialogOverlayStyles = [overlayStyles, dialogOverlayBase, confirmDialogOverlay];
@@ -129,4 +129,16 @@ export declare class ConfirmDialogMixinClass {
129
129
  * @attr {string} overlay-class
130
130
  */
131
131
  overlayClass: string;
132
+
133
+ /**
134
+ * Set the width of the overlay.
135
+ * If a unitless number is provided, pixels are assumed.
136
+ */
137
+ width: string;
138
+
139
+ /**
140
+ * Set the height of the overlay.
141
+ * If a unitless number is provided, pixels are assumed.
142
+ */
143
+ height: string;
132
144
  }
@@ -164,6 +164,22 @@ export const ConfirmDialogMixin = (superClass) =>
164
164
  type: String,
165
165
  },
166
166
 
167
+ /**
168
+ * Set the height of the overlay.
169
+ * If a unitless number is provided, pixels are assumed.
170
+ */
171
+ height: {
172
+ type: String,
173
+ },
174
+
175
+ /**
176
+ * Set the width of the overlay.
177
+ * If a unitless number is provided, pixels are assumed.
178
+ */
179
+ width: {
180
+ type: String,
181
+ },
182
+
167
183
  /**
168
184
  * A reference to the "Cancel" button which will be teleported to the overlay.
169
185
  * @private
@@ -213,22 +229,6 @@ export const ConfirmDialogMixin = (superClass) =>
213
229
  _rejectButton: {
214
230
  type: Object,
215
231
  },
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
232
  };
233
233
  }
234
234
 
@@ -10,13 +10,11 @@ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
10
10
  import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
11
11
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
12
12
  import { DialogBaseMixin } from '@vaadin/dialog/src/vaadin-dialog-base-mixin.js';
13
- import { dialogOverlay } from '@vaadin/dialog/src/vaadin-dialog-styles.js';
14
13
  import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
15
- import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
14
+ import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
16
15
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
17
16
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
18
- import { ConfirmDialogBaseMixin } from './vaadin-confirm-dialog-base-mixin.js';
19
- import { confirmDialogOverlay } from './vaadin-confirm-dialog-overlay-styles.js';
17
+ import { confirmDialogOverlayStyles } from './styles/vaadin-confirm-dialog-overlay-styles.js';
20
18
 
21
19
  /**
22
20
  * An element used internally by `<vaadin-confirm-dialog>`. Not intended to be used separately.
@@ -28,13 +26,13 @@ import { confirmDialogOverlay } from './vaadin-confirm-dialog-overlay-styles.js'
28
26
  * @mixes ThemableMixin
29
27
  * @private
30
28
  */
31
- class ConfirmDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
29
+ class ConfirmDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(CSSInjectionMixin(PolylitMixin(LitElement))))) {
32
30
  static get is() {
33
31
  return 'vaadin-confirm-dialog-overlay';
34
32
  }
35
33
 
36
34
  static get styles() {
37
- return [overlayStyles, dialogOverlay, confirmDialogOverlay];
35
+ return confirmDialogOverlayStyles;
38
36
  }
39
37
 
40
38
  /** @protected */
@@ -74,6 +72,23 @@ class ConfirmDialogOverlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMi
74
72
  this.setAttribute('has-header', '');
75
73
  this.setAttribute('has-footer', '');
76
74
  }
75
+
76
+ /**
77
+ * Updates the coordinates of the overlay.
78
+ */
79
+ setBounds(bounds) {
80
+ const overlay = this.$.overlay;
81
+ const parsedBounds = { ...bounds };
82
+
83
+ Object.keys(parsedBounds).forEach((arg) => {
84
+ // Allow setting width or height to `null`
85
+ if (parsedBounds[arg] !== null && !isNaN(parsedBounds[arg])) {
86
+ parsedBounds[arg] = `${parsedBounds[arg]}px`;
87
+ }
88
+ });
89
+
90
+ Object.assign(overlay.style, parsedBounds);
91
+ }
77
92
  }
78
93
 
79
94
  defineCustomElement(ConfirmDialogOverlay);
@@ -82,9 +97,7 @@ defineCustomElement(ConfirmDialogOverlay);
82
97
  * An element used internally by `<vaadin-confirm-dialog>`. Not intended to be used separately.
83
98
  * @private
84
99
  */
85
- class ConfirmDialogDialog extends ConfirmDialogBaseMixin(
86
- DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(PolylitMixin(LitElement)))),
87
- ) {
100
+ class ConfirmDialogDialog extends DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(PolylitMixin(LitElement)))) {
88
101
  static get is() {
89
102
  return 'vaadin-confirm-dialog-dialog';
90
103
  }
@@ -97,6 +110,20 @@ class ConfirmDialogDialog extends ConfirmDialogBaseMixin(
97
110
  `;
98
111
  }
99
112
 
113
+ static get properties() {
114
+ return {
115
+ /**
116
+ * Set the `aria-label` attribute for assistive technologies like
117
+ * screen readers. An empty string value for this property (the
118
+ * default) means that the `aria-label` attribute is not present.
119
+ */
120
+ ariaLabel: {
121
+ type: String,
122
+ value: '',
123
+ },
124
+ };
125
+ }
126
+
100
127
  /** @protected */
101
128
  render() {
102
129
  return html`
@@ -93,8 +93,8 @@ class ConfirmDialog extends ConfirmDialogMixin(ElementMixin(ThemePropertyMixin(P
93
93
  theme="${ifDefined(this._theme)}"
94
94
  no-close-on-outside-click
95
95
  .noCloseOnEsc="${this.noCloseOnEsc}"
96
- .contentHeight="${this._contentHeight}"
97
- .contentWidth="${this._contentWidth}"
96
+ .height="${this.height}"
97
+ .width="${this.width}"
98
98
  @opened-changed="${this._onOpenedChanged}"
99
99
  ></vaadin-confirm-dialog-dialog>
100
100
 
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": "25.0.0-alpha2",
4
+ "version": "25.0.0-alpha4",
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/25.0.0-alpha2/#/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/25.0.0-alpha4/#/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",
@@ -142,6 +142,28 @@
142
142
  ]
143
143
  }
144
144
  },
145
+ {
146
+ "name": "height",
147
+ "description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
148
+ "value": {
149
+ "type": [
150
+ "string",
151
+ "null",
152
+ "undefined"
153
+ ]
154
+ }
155
+ },
156
+ {
157
+ "name": "width",
158
+ "description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
159
+ "value": {
160
+ "type": [
161
+ "string",
162
+ "null",
163
+ "undefined"
164
+ ]
165
+ }
166
+ },
145
167
  {
146
168
  "name": "theme",
147
169
  "description": "The theme variants to apply to the component.",
@@ -287,6 +309,28 @@
287
309
  "undefined"
288
310
  ]
289
311
  }
312
+ },
313
+ {
314
+ "name": "height",
315
+ "description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
316
+ "value": {
317
+ "type": [
318
+ "string",
319
+ "null",
320
+ "undefined"
321
+ ]
322
+ }
323
+ },
324
+ {
325
+ "name": "width",
326
+ "description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
327
+ "value": {
328
+ "type": [
329
+ "string",
330
+ "null",
331
+ "undefined"
332
+ ]
333
+ }
290
334
  }
291
335
  ],
292
336
  "events": [
@@ -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-alpha2",
4
+ "version": "25.0.0-alpha4",
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/25.0.0-alpha2/#/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/25.0.0-alpha4/#/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
  {
@@ -117,6 +117,20 @@
117
117
  "kind": "expression"
118
118
  }
119
119
  },
120
+ {
121
+ "name": ".height",
122
+ "description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
123
+ "value": {
124
+ "kind": "expression"
125
+ }
126
+ },
127
+ {
128
+ "name": ".width",
129
+ "description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
130
+ "value": {
131
+ "kind": "expression"
132
+ }
133
+ },
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
- };