@vaadin/checkbox-group 24.4.0-alpha19 → 24.4.0-alpha20

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.4.0-alpha19",
3
+ "version": "24.4.0-alpha20",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,13 +37,13 @@
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/a11y-base": "24.4.0-alpha19",
41
- "@vaadin/checkbox": "24.4.0-alpha19",
42
- "@vaadin/component-base": "24.4.0-alpha19",
43
- "@vaadin/field-base": "24.4.0-alpha19",
44
- "@vaadin/vaadin-lumo-styles": "24.4.0-alpha19",
45
- "@vaadin/vaadin-material-styles": "24.4.0-alpha19",
46
- "@vaadin/vaadin-themable-mixin": "24.4.0-alpha19"
40
+ "@vaadin/a11y-base": "24.4.0-alpha20",
41
+ "@vaadin/checkbox": "24.4.0-alpha20",
42
+ "@vaadin/component-base": "24.4.0-alpha20",
43
+ "@vaadin/field-base": "24.4.0-alpha20",
44
+ "@vaadin/vaadin-lumo-styles": "24.4.0-alpha20",
45
+ "@vaadin/vaadin-material-styles": "24.4.0-alpha20",
46
+ "@vaadin/vaadin-themable-mixin": "24.4.0-alpha20"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@esm-bundle/chai": "^4.3.4",
@@ -54,5 +54,5 @@
54
54
  "web-types.json",
55
55
  "web-types.lit.json"
56
56
  ],
57
- "gitHead": "5fad5eb53de7da69c1a19776a11ba74ceba27ea0"
57
+ "gitHead": "9d2eacc494eb27658ba9298be6656815912637be"
58
58
  }
@@ -33,4 +33,12 @@ export declare class CheckboxGroupMixinClass {
33
33
  * creating a new array.
34
34
  */
35
35
  value: string[];
36
+
37
+ /**
38
+ * When true, the user cannot modify the value of the checkbox group.
39
+ * The difference between `disabled` and `readonly` is that in the
40
+ * read-only checkbox group, all the checkboxes are also read-only,
41
+ * and therefore remain focusable and announced by screen readers.
42
+ */
43
+ readonly: boolean;
36
44
  }
@@ -36,6 +36,19 @@ export const CheckboxGroupMixin = (superclass) =>
36
36
  notify: true,
37
37
  observer: '__valueChanged',
38
38
  },
39
+
40
+ /**
41
+ * When true, the user cannot modify the value of the checkbox group.
42
+ * The difference between `disabled` and `readonly` is that in the
43
+ * read-only checkbox group, all the checkboxes are also read-only,
44
+ * and therefore remain focusable and announced by screen readers.
45
+ */
46
+ readonly: {
47
+ type: Boolean,
48
+ value: false,
49
+ reflectToAttribute: true,
50
+ observer: '__readonlyChanged',
51
+ },
39
52
  };
40
53
  }
41
54
 
@@ -145,6 +158,10 @@ export const CheckboxGroupMixin = (superclass) =>
145
158
  checkbox.disabled = true;
146
159
  }
147
160
 
161
+ if (this.readonly) {
162
+ checkbox.readonly = true;
163
+ }
164
+
148
165
  if (checkbox.checked) {
149
166
  this.__addCheckboxToValue(checkbox.value);
150
167
  } else if (this.value.includes(checkbox.value)) {
@@ -248,6 +265,15 @@ export const CheckboxGroupMixin = (superclass) =>
248
265
  }
249
266
  }
250
267
 
268
+ /** @private */
269
+ __readonlyChanged(readonly, oldReadonly) {
270
+ if (readonly || oldReadonly) {
271
+ this.__checkboxes.forEach((checkbox) => {
272
+ checkbox.readonly = readonly;
273
+ });
274
+ }
275
+ }
276
+
251
277
  /**
252
278
  * Override method inherited from `FocusMixin`
253
279
  * to prevent removing the `focused` attribute
@@ -61,6 +61,7 @@ export interface CheckboxGroupEventMap extends HTMLElementEventMap, CheckboxGrou
61
61
  * Attribute | Description | Part name
62
62
  * --------------------|-------------------------------------------|------------
63
63
  * `disabled` | Set when the element is disabled | :host
64
+ * `readonly` | Set when the element is readonly | :host
64
65
  * `invalid` | Set when the element is invalid | :host
65
66
  * `focused` | Set when the element is focused | :host
66
67
  * `has-label` | Set when the element has a label | :host
@@ -42,6 +42,7 @@ registerStyles('vaadin-checkbox-group', checkboxGroupStyles, { moduleId: 'vaadin
42
42
  * Attribute | Description | Part name
43
43
  * --------------------|-------------------------------------------|------------
44
44
  * `disabled` | Set when the element is disabled | :host
45
+ * `readonly` | Set when the element is readonly | :host
45
46
  * `invalid` | Set when the element is invalid | :host
46
47
  * `focused` | Set when the element is focused | :host
47
48
  * `has-label` | Set when the element has a label | :host
@@ -0,0 +1,5 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/sizing.js';
3
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
4
+ import '@vaadin/vaadin-lumo-styles/style.js';
5
+ import '@vaadin/vaadin-lumo-styles/typography.js';
@@ -0,0 +1,3 @@
1
+ import '@vaadin/checkbox/theme/lumo/vaadin-checkbox.js';
2
+ import './vaadin-checkbox-group-styles.js';
3
+ import '../../src/vaadin-checkbox-group.js';
@@ -0,0 +1 @@
1
+ import '@vaadin/vaadin-material-styles/color.js';
@@ -0,0 +1,3 @@
1
+ import '@vaadin/checkbox/theme/material/vaadin-checkbox.js';
2
+ import './vaadin-checkbox-group-styles.js';
3
+ import '../../src/vaadin-checkbox-group.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/checkbox-group",
4
- "version": "24.4.0-alpha17",
4
+ "version": "24.4.0-alpha20",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-checkbox-group",
11
- "description": "`<vaadin-checkbox-group>` is a web component that allows the user to choose several items from a group of binary choices.\n\n```html\n<vaadin-checkbox-group label=\"Export data\">\n <vaadin-checkbox value=\"0\" label=\"Order ID\"></vaadin-checkbox>\n <vaadin-checkbox value=\"1\" label=\"Product name\"></vaadin-checkbox>\n <vaadin-checkbox value=\"2\" label=\"Customer\"></vaadin-checkbox>\n <vaadin-checkbox value=\"3\" label=\"Status\"></vaadin-checkbox>\n</vaadin-checkbox-group>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`group-field` | The checkbox elements wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`disabled` | Set when the element is disabled | :host\n`invalid` | Set when the element is invalid | :host\n`focused` | Set when the element is focused | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
11
+ "description": "`<vaadin-checkbox-group>` is a web component that allows the user to choose several items from a group of binary choices.\n\n```html\n<vaadin-checkbox-group label=\"Export data\">\n <vaadin-checkbox value=\"0\" label=\"Order ID\"></vaadin-checkbox>\n <vaadin-checkbox value=\"1\" label=\"Product name\"></vaadin-checkbox>\n <vaadin-checkbox value=\"2\" label=\"Customer\"></vaadin-checkbox>\n <vaadin-checkbox value=\"3\" label=\"Status\"></vaadin-checkbox>\n</vaadin-checkbox-group>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`group-field` | The checkbox elements wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`disabled` | Set when the element is disabled | :host\n`readonly` | Set when the element is readonly | :host\n`invalid` | Set when the element is invalid | :host\n`focused` | Set when the element is focused | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -98,6 +98,17 @@
98
98
  ]
99
99
  }
100
100
  },
101
+ {
102
+ "name": "readonly",
103
+ "description": "When true, the user cannot modify the value of the checkbox group.\nThe difference between `disabled` and `readonly` is that in the\nread-only checkbox group, all the checkboxes are also read-only,\nand therefore remain focusable and announced by screen readers.",
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": "readonly",
225
+ "description": "When true, the user cannot modify the value of the checkbox group.\nThe difference between `disabled` and `readonly` is that in the\nread-only checkbox group, all the checkboxes are also read-only,\nand therefore remain focusable and announced by screen readers.",
226
+ "value": {
227
+ "type": [
228
+ "boolean",
229
+ "null",
230
+ "undefined"
231
+ ]
232
+ }
211
233
  }
212
234
  ],
213
235
  "events": [
@@ -215,13 +237,13 @@
215
237
  "name": "validated",
216
238
  "description": "Fired whenever the field is validated."
217
239
  },
218
- {
219
- "name": "value-changed",
220
- "description": "Fired when the `value` property changes."
221
- },
222
240
  {
223
241
  "name": "invalid-changed",
224
242
  "description": "Fired when the `invalid` property changes."
243
+ },
244
+ {
245
+ "name": "value-changed",
246
+ "description": "Fired when the `value` property changes."
225
247
  }
226
248
  ]
227
249
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/checkbox-group",
4
- "version": "24.4.0-alpha17",
4
+ "version": "24.4.0-alpha20",
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-checkbox-group",
19
- "description": "`<vaadin-checkbox-group>` is a web component that allows the user to choose several items from a group of binary choices.\n\n```html\n<vaadin-checkbox-group label=\"Export data\">\n <vaadin-checkbox value=\"0\" label=\"Order ID\"></vaadin-checkbox>\n <vaadin-checkbox value=\"1\" label=\"Product name\"></vaadin-checkbox>\n <vaadin-checkbox value=\"2\" label=\"Customer\"></vaadin-checkbox>\n <vaadin-checkbox value=\"3\" label=\"Status\"></vaadin-checkbox>\n</vaadin-checkbox-group>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`group-field` | The checkbox elements wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`disabled` | Set when the element is disabled | :host\n`invalid` | Set when the element is invalid | :host\n`focused` | Set when the element is focused | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
19
+ "description": "`<vaadin-checkbox-group>` is a web component that allows the user to choose several items from a group of binary choices.\n\n```html\n<vaadin-checkbox-group label=\"Export data\">\n <vaadin-checkbox value=\"0\" label=\"Order ID\"></vaadin-checkbox>\n <vaadin-checkbox value=\"1\" label=\"Product name\"></vaadin-checkbox>\n <vaadin-checkbox value=\"2\" label=\"Customer\"></vaadin-checkbox>\n <vaadin-checkbox value=\"3\" label=\"Status\"></vaadin-checkbox>\n</vaadin-checkbox-group>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The slotted label element wrapper\n`group-field` | The checkbox elements wrapper\n`helper-text` | The slotted helper text element wrapper\n`error-message` | The slotted error message element wrapper\n`required-indicator` | The `required` state indicator element\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n--------------------|-------------------------------------------|------------\n`disabled` | Set when the element is disabled | :host\n`readonly` | Set when the element is readonly | :host\n`invalid` | Set when the element is invalid | :host\n`focused` | Set when the element is focused | :host\n`has-label` | Set when the element has a label | :host\n`has-value` | Set when the element has a value | :host\n`has-helper` | Set when the element has helper text | :host\n`has-error-message` | Set when the element has an error message | :host\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -40,6 +40,13 @@
40
40
  "kind": "expression"
41
41
  }
42
42
  },
43
+ {
44
+ "name": "?readonly",
45
+ "description": "When true, the user cannot modify the value of the checkbox group.\nThe difference between `disabled` and `readonly` is that in the\nread-only checkbox group, all the checkboxes are also read-only,\nand therefore remain focusable and announced by screen readers.",
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.",
@@ -90,15 +97,15 @@
90
97
  }
91
98
  },
92
99
  {
93
- "name": "@value-changed",
94
- "description": "Fired when the `value` property changes.",
100
+ "name": "@invalid-changed",
101
+ "description": "Fired when the `invalid` property changes.",
95
102
  "value": {
96
103
  "kind": "expression"
97
104
  }
98
105
  },
99
106
  {
100
- "name": "@invalid-changed",
101
- "description": "Fired when the `invalid` property changes.",
107
+ "name": "@value-changed",
108
+ "description": "Fired when the `value` property changes.",
102
109
  "value": {
103
110
  "kind": "expression"
104
111
  }