@vaadin/checkbox-group 24.2.0-alpha6 → 24.2.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/checkbox-group",
3
- "version": "24.2.0-alpha6",
3
+ "version": "24.2.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/a11y-base": "24.2.0-alpha6",
40
- "@vaadin/checkbox": "24.2.0-alpha6",
41
- "@vaadin/component-base": "24.2.0-alpha6",
42
- "@vaadin/field-base": "24.2.0-alpha6",
43
- "@vaadin/vaadin-lumo-styles": "24.2.0-alpha6",
44
- "@vaadin/vaadin-material-styles": "24.2.0-alpha6",
45
- "@vaadin/vaadin-themable-mixin": "24.2.0-alpha6"
39
+ "@vaadin/a11y-base": "24.2.0-alpha8",
40
+ "@vaadin/checkbox": "24.2.0-alpha8",
41
+ "@vaadin/component-base": "24.2.0-alpha8",
42
+ "@vaadin/field-base": "24.2.0-alpha8",
43
+ "@vaadin/vaadin-lumo-styles": "24.2.0-alpha8",
44
+ "@vaadin/vaadin-material-styles": "24.2.0-alpha8",
45
+ "@vaadin/vaadin-themable-mixin": "24.2.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": "3ef6e6cd66919b3ef7637e42916e4c54656beb51"
56
+ "gitHead": "2c024e8fd462d178430418f76a61f498fb549998"
57
57
  }
@@ -14,6 +14,11 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
14
14
  */
15
15
  export type CheckboxGroupInvalidChangedEvent = CustomEvent<{ value: boolean }>;
16
16
 
17
+ /**
18
+ * Fired when the `dirty` property changes.
19
+ */
20
+ export type CheckboxGroupDirtyChangedEvent = CustomEvent<{ value: boolean }>;
21
+
17
22
  /**
18
23
  * Fired when the `value` property changes.
19
24
  */
@@ -27,6 +32,8 @@ export type CheckboxGroupValidatedEvent = CustomEvent<{ valid: boolean }>;
27
32
  export interface CheckboxGroupCustomEventMap {
28
33
  'invalid-changed': CheckboxGroupInvalidChangedEvent;
29
34
 
35
+ 'dirty-changed': CheckboxGroupDirtyChangedEvent;
36
+
30
37
  'value-changed': CheckboxGroupValueChangedEvent;
31
38
 
32
39
  validated: CheckboxGroupValidatedEvent;
@@ -73,6 +80,7 @@ export interface CheckboxGroupEventMap extends HTMLElementEventMap, CheckboxGrou
73
80
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
74
81
  *
75
82
  * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
83
+ * @fires {CustomEvent} dirty-changed - Fired when the `dirty` property changes.
76
84
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
77
85
  * @fires {CustomEvent} validated - Fired whenever the field is validated.
78
86
  */
@@ -85,6 +93,15 @@ declare class CheckboxGroup extends FieldMixin(FocusMixin(DisabledMixin(ElementM
85
93
  */
86
94
  value: string[];
87
95
 
96
+ /**
97
+ * Whether the field is dirty.
98
+ *
99
+ * The field is automatically marked as dirty once the user triggers
100
+ * a `change` event. Additionally, the field can be manually marked
101
+ * as dirty by setting the property to `true`.
102
+ */
103
+ dirty: boolean;
104
+
88
105
  addEventListener<K extends keyof CheckboxGroupEventMap>(
89
106
  type: K,
90
107
  listener: (this: CheckboxGroup, ev: CheckboxGroupEventMap[K]) => void,
@@ -139,6 +139,19 @@ class CheckboxGroup extends FieldMixin(FocusMixin(DisabledMixin(ElementMixin(The
139
139
  notify: true,
140
140
  observer: '__valueChanged',
141
141
  },
142
+
143
+ /**
144
+ * Whether the field is dirty.
145
+ *
146
+ * The field is automatically marked as dirty once the user triggers
147
+ * a `change` event. Additionally, the field can be manually marked
148
+ * as dirty by setting the property to `true`.
149
+ */
150
+ dirty: {
151
+ type: Boolean,
152
+ value: false,
153
+ notify: true,
154
+ },
142
155
  };
143
156
  }
144
157
 
@@ -147,6 +160,7 @@ class CheckboxGroup extends FieldMixin(FocusMixin(DisabledMixin(ElementMixin(The
147
160
 
148
161
  this.__registerCheckbox = this.__registerCheckbox.bind(this);
149
162
  this.__unregisterCheckbox = this.__unregisterCheckbox.bind(this);
163
+ this.__onCheckboxChange = this.__onCheckboxChange.bind(this);
150
164
  this.__onCheckboxCheckedChanged = this.__onCheckboxCheckedChanged.bind(this);
151
165
  }
152
166
 
@@ -227,6 +241,7 @@ class CheckboxGroup extends FieldMixin(FocusMixin(DisabledMixin(ElementMixin(The
227
241
  * @private
228
242
  */
229
243
  __registerCheckbox(checkbox) {
244
+ checkbox.addEventListener('change', this.__onCheckboxChange);
230
245
  checkbox.addEventListener('checked-changed', this.__onCheckboxCheckedChanged);
231
246
 
232
247
  if (this.disabled) {
@@ -247,6 +262,7 @@ class CheckboxGroup extends FieldMixin(FocusMixin(DisabledMixin(ElementMixin(The
247
262
  * @private
248
263
  */
249
264
  __unregisterCheckbox(checkbox) {
265
+ checkbox.removeEventListener('change', this.__onCheckboxChange);
250
266
  checkbox.removeEventListener('checked-changed', this.__onCheckboxCheckedChanged);
251
267
 
252
268
  if (checkbox.checked) {
@@ -300,6 +316,11 @@ class CheckboxGroup extends FieldMixin(FocusMixin(DisabledMixin(ElementMixin(The
300
316
  }
301
317
  }
302
318
 
319
+ /** @private */
320
+ __onCheckboxChange() {
321
+ this.dirty = true;
322
+ }
323
+
303
324
  /**
304
325
  * @param {!CustomEvent} event
305
326
  * @private
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/checkbox-group",
4
- "version": "24.2.0-alpha6",
4
+ "version": "24.2.0-alpha8",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -98,6 +98,17 @@
98
98
  ]
99
99
  }
100
100
  },
101
+ {
102
+ "name": "dirty",
103
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\na `change` event. Additionally, the field can be manually marked\nas dirty by setting the property to `true`.",
104
+ "value": {
105
+ "type": [
106
+ "boolean",
107
+ "null",
108
+ "undefined"
109
+ ]
110
+ }
111
+ },
101
112
  {
102
113
  "name": "theme",
103
114
  "description": "The theme variants to apply to the component.",
@@ -208,6 +219,17 @@
208
219
  "Array.<string>"
209
220
  ]
210
221
  }
222
+ },
223
+ {
224
+ "name": "dirty",
225
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\na `change` event. Additionally, the field can be manually marked\nas dirty by setting the property to `true`.",
226
+ "value": {
227
+ "type": [
228
+ "boolean",
229
+ "null",
230
+ "undefined"
231
+ ]
232
+ }
211
233
  }
212
234
  ],
213
235
  "events": [
@@ -219,6 +241,10 @@
219
241
  "name": "value-changed",
220
242
  "description": "Fired when the `value` property changes."
221
243
  },
244
+ {
245
+ "name": "dirty-changed",
246
+ "description": "Fired when the `dirty` property changes."
247
+ },
222
248
  {
223
249
  "name": "invalid-changed",
224
250
  "description": "Fired when the `invalid` property changes."
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/checkbox-group",
4
- "version": "24.2.0-alpha6",
4
+ "version": "24.2.0-alpha8",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -40,6 +40,13 @@
40
40
  "kind": "expression"
41
41
  }
42
42
  },
43
+ {
44
+ "name": "?dirty",
45
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\na `change` event. Additionally, the field can be manually marked\nas dirty by setting the property to `true`.",
46
+ "value": {
47
+ "kind": "expression"
48
+ }
49
+ },
43
50
  {
44
51
  "name": ".label",
45
52
  "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
@@ -96,6 +103,13 @@
96
103
  "kind": "expression"
97
104
  }
98
105
  },
106
+ {
107
+ "name": "@dirty-changed",
108
+ "description": "Fired when the `dirty` property changes.",
109
+ "value": {
110
+ "kind": "expression"
111
+ }
112
+ },
99
113
  {
100
114
  "name": "@invalid-changed",
101
115
  "description": "Fired when the `invalid` property changes.",