@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/confirm-dialog",
3
- "version": "24.2.0-beta3",
3
+ "version": "24.2.0-beta4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,9 +21,6 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "!src/vaadin-lit-confirm-dialog-overlay.js",
25
- "!src/vaadin-lit-confirm-dialog.d.ts",
26
- "!src/vaadin-lit-confirm-dialog.js",
27
24
  "theme",
28
25
  "vaadin-*.d.ts",
29
26
  "vaadin-*.js",
@@ -38,19 +35,18 @@
38
35
  "polymer"
39
36
  ],
40
37
  "dependencies": {
41
- "@open-wc/dedupe-mixin": "^1.3.0",
42
38
  "@polymer/polymer": "^3.0.0",
43
- "@vaadin/button": "24.2.0-beta3",
44
- "@vaadin/component-base": "24.2.0-beta3",
45
- "@vaadin/dialog": "24.2.0-beta3",
46
- "@vaadin/overlay": "24.2.0-beta3",
47
- "@vaadin/vaadin-lumo-styles": "24.2.0-beta3",
48
- "@vaadin/vaadin-material-styles": "24.2.0-beta3",
49
- "@vaadin/vaadin-themable-mixin": "24.2.0-beta3"
39
+ "@vaadin/button": "24.2.0-beta4",
40
+ "@vaadin/component-base": "24.2.0-beta4",
41
+ "@vaadin/dialog": "24.2.0-beta4",
42
+ "@vaadin/overlay": "24.2.0-beta4",
43
+ "@vaadin/vaadin-lumo-styles": "24.2.0-beta4",
44
+ "@vaadin/vaadin-material-styles": "24.2.0-beta4",
45
+ "@vaadin/vaadin-themable-mixin": "24.2.0-beta4"
50
46
  },
51
47
  "devDependencies": {
52
48
  "@esm-bundle/chai": "^4.3.4",
53
- "@vaadin/a11y-base": "24.2.0-beta3",
49
+ "@vaadin/a11y-base": "24.2.0-beta4",
54
50
  "@vaadin/testing-helpers": "^0.5.0",
55
51
  "sinon": "^13.0.2"
56
52
  },
@@ -58,5 +54,5 @@
58
54
  "web-types.json",
59
55
  "web-types.lit.json"
60
56
  ],
61
- "gitHead": "91ea11e7ad706065340acdb93b92316919ce5e69"
57
+ "gitHead": "04da1e1e5c5713ea45e4b7d659dc6ac6b4604f4c"
62
58
  }
@@ -11,10 +11,29 @@ import { DialogBaseMixin } from '@vaadin/dialog/src/vaadin-dialog-base-mixin.js'
11
11
  import { dialogOverlay } from '@vaadin/dialog/src/vaadin-dialog-styles.js';
12
12
  import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
13
13
  import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
14
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
+ import { css, registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
15
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
16
- import { ConfirmDialogBaseMixin } from './vaadin-confirm-dialog-base-mixin.js';
17
- import { confirmDialogOverlay } from './vaadin-confirm-dialog-overlay-styles.js';
16
+
17
+ const confirmDialogOverlay = css`
18
+ :host {
19
+ --_vaadin-confirm-dialog-content-width: auto;
20
+ --_vaadin-confirm-dialog-content-height: auto;
21
+ }
22
+
23
+ [part='overlay'] {
24
+ width: var(--_vaadin-confirm-dialog-content-width);
25
+ height: var(--_vaadin-confirm-dialog-content-height);
26
+ }
27
+
28
+ ::slotted([slot='header']) {
29
+ pointer-events: auto;
30
+ }
31
+
32
+ /* Make buttons clickable */
33
+ [part='footer'] > * {
34
+ pointer-events: all;
35
+ }
36
+ `;
18
37
 
19
38
  registerStyles('vaadin-confirm-dialog-overlay', [overlayStyles, dialogOverlay, confirmDialogOverlay], {
20
39
  moduleId: 'vaadin-confirm-dialog-overlay-styles',
@@ -79,9 +98,7 @@ defineCustomElement(ConfirmDialogOverlay);
79
98
  * An element used internally by `<vaadin-confirm-dialog>`. Not intended to be used separately.
80
99
  * @private
81
100
  */
82
- class ConfirmDialogDialog extends ConfirmDialogBaseMixin(
83
- DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(PolymerElement))),
84
- ) {
101
+ class ConfirmDialogDialog extends DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(PolymerElement))) {
85
102
  static get is() {
86
103
  return 'vaadin-confirm-dialog-dialog';
87
104
  }
@@ -110,6 +127,66 @@ class ConfirmDialogDialog extends ConfirmDialogBaseMixin(
110
127
  ></vaadin-confirm-dialog-overlay>
111
128
  `;
112
129
  }
130
+
131
+ static get properties() {
132
+ return {
133
+ /**
134
+ * Set the `aria-label` attribute for assistive technologies like
135
+ * screen readers. An empty string value for this property (the
136
+ * default) means that the `aria-label` attribute is not present.
137
+ */
138
+ ariaLabel: {
139
+ type: String,
140
+ value: '',
141
+ },
142
+
143
+ /**
144
+ * Height to be set on the overlay content.
145
+ */
146
+ contentHeight: {
147
+ type: String,
148
+ },
149
+
150
+ /**
151
+ * Width to be set on the overlay content.
152
+ */
153
+ contentWidth: {
154
+ type: String,
155
+ },
156
+ };
157
+ }
158
+
159
+ static get observers() {
160
+ return [
161
+ '__updateContentHeight(contentHeight, _overlayElement)',
162
+ '__updateContentWidth(contentWidth, _overlayElement)',
163
+ ];
164
+ }
165
+
166
+ /** @private */
167
+ __updateDimension(overlay, dimension, value) {
168
+ const prop = `--_vaadin-confirm-dialog-content-${dimension}`;
169
+
170
+ if (value) {
171
+ overlay.style.setProperty(prop, value);
172
+ } else {
173
+ overlay.style.removeProperty(prop);
174
+ }
175
+ }
176
+
177
+ /** @private */
178
+ __updateContentHeight(height, overlay) {
179
+ if (overlay) {
180
+ this.__updateDimension(overlay, 'height', height);
181
+ }
182
+ }
183
+
184
+ /** @private */
185
+ __updateContentWidth(width, overlay) {
186
+ if (overlay) {
187
+ this.__updateDimension(overlay, 'width', width);
188
+ }
189
+ }
113
190
  }
114
191
 
115
192
  defineCustomElement(ConfirmDialogDialog);
@@ -6,9 +6,23 @@
6
6
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
7
7
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
8
8
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
9
- import { type ConfirmDialogEventMap, ConfirmDialogMixin } from './vaadin-confirm-dialog-mixin.js';
10
9
 
11
- export * from './vaadin-confirm-dialog-mixin.js';
10
+ /**
11
+ * Fired when the `opened` property changes.
12
+ */
13
+ export type ConfirmDialogOpenedChangedEvent = CustomEvent<{ value: boolean }>;
14
+
15
+ export interface ConfirmDialogCustomEventMap {
16
+ 'opened-changed': ConfirmDialogOpenedChangedEvent;
17
+
18
+ confirm: Event;
19
+
20
+ cancel: Event;
21
+
22
+ reject: Event;
23
+ }
24
+
25
+ export type ConfirmDialogEventMap = ConfirmDialogCustomEventMap & HTMLElementEventMap;
12
26
 
13
27
  /**
14
28
  * `<vaadin-confirm-dialog>` is a Web Component for showing alerts and asking for user confirmation.
@@ -58,7 +72,103 @@ export * from './vaadin-confirm-dialog-mixin.js';
58
72
  * @fires {Event} reject - Fired when Reject button was pressed.
59
73
  * @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
60
74
  */
61
- declare class ConfirmDialog extends ConfirmDialogMixin(ElementMixin(ThemePropertyMixin(ControllerMixin(HTMLElement)))) {
75
+ declare class ConfirmDialog extends ElementMixin(ThemePropertyMixin(ControllerMixin(HTMLElement))) {
76
+ /**
77
+ * Sets the `aria-describedby` attribute of the overlay element.
78
+ *
79
+ * By default, all elements inside the message area are linked
80
+ * through the `aria-describedby` attribute. However, there are
81
+ * cases where this can confuse screen reader users (e.g. the dialog
82
+ * may present a password confirmation form). For these cases,
83
+ * it's better to associate only the elements that will help describe
84
+ * the confirmation dialog through this API.
85
+ * @attr {string} accessible-description-ref
86
+ */
87
+ accessibleDescriptionRef: string | null | undefined;
88
+
89
+ /**
90
+ * True if the overlay is currently displayed.
91
+ */
92
+ opened: boolean;
93
+
94
+ /**
95
+ * Set the confirmation dialog title.
96
+ */
97
+ header: string;
98
+
99
+ /**
100
+ * Set the message or confirmation question.
101
+ */
102
+ message: string | null | undefined;
103
+
104
+ /**
105
+ * Text displayed on confirm-button.
106
+ * This only affects the default button, custom slotted buttons will not be altered.
107
+ * @attr {string} confirm-text
108
+ */
109
+ confirmText: string;
110
+
111
+ /**
112
+ * Theme for a confirm-button.
113
+ * This only affects the default button, custom slotted buttons will not be altered.
114
+ * @attr {string} confirm-theme
115
+ */
116
+ confirmTheme: string;
117
+
118
+ /**
119
+ * Set to true to disable closing dialog on Escape press
120
+ * @attr {boolean} no-close-on-esc
121
+ */
122
+ noCloseOnEsc: boolean;
123
+
124
+ /**
125
+ * Whether to show reject button or not.
126
+ * @attr {boolean} reject-button-visible
127
+ */
128
+ rejectButtonVisible: boolean;
129
+
130
+ /**
131
+ * Text displayed on reject-button.
132
+ * This only affects the default button, custom slotted buttons will not be altered.
133
+ * @attr {string} reject-text
134
+ */
135
+ rejectText: string;
136
+
137
+ /**
138
+ * Theme for a reject-button.
139
+ * This only affects the default button, custom slotted buttons will not be altered.
140
+ * @attr {string} reject-theme
141
+ */
142
+ rejectTheme: string;
143
+
144
+ /**
145
+ * Whether to show cancel button or not.
146
+ * @attr {boolean} cancel-button-visible
147
+ */
148
+ cancelButtonVisible: boolean;
149
+
150
+ /**
151
+ * Text displayed on cancel-button.
152
+ * This only affects the default button, custom slotted buttons will not be altered.
153
+ * @attr {string} cancel-text
154
+ */
155
+ cancelText: string;
156
+
157
+ /**
158
+ * Theme for a cancel-button.
159
+ * This only affects the default button, custom slotted buttons will not be altered.
160
+ * @attr {string} cancel-theme
161
+ */
162
+ cancelTheme: string;
163
+
164
+ /**
165
+ * A space-delimited list of CSS class names
166
+ * to set on the underlying overlay element.
167
+ *
168
+ * @attr {string} overlay-class
169
+ */
170
+ overlayClass: string;
171
+
62
172
  addEventListener<K extends keyof ConfirmDialogEventMap>(
63
173
  type: K,
64
174
  listener: (this: ConfirmDialog, ev: ConfirmDialogEventMap[K]) => void,