@vaadin/radio-group 24.2.0-dev.f254716fe → 24.3.0-alpha1

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/radio-group",
3
- "version": "24.2.0-dev.f254716fe",
3
+ "version": "24.3.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,21 +38,21 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@polymer/polymer": "^3.0.0",
41
- "@vaadin/a11y-base": "24.2.0-dev.f254716fe",
42
- "@vaadin/component-base": "24.2.0-dev.f254716fe",
43
- "@vaadin/field-base": "24.2.0-dev.f254716fe",
44
- "@vaadin/vaadin-lumo-styles": "24.2.0-dev.f254716fe",
45
- "@vaadin/vaadin-material-styles": "24.2.0-dev.f254716fe",
46
- "@vaadin/vaadin-themable-mixin": "24.2.0-dev.f254716fe"
41
+ "@vaadin/a11y-base": "24.3.0-alpha1",
42
+ "@vaadin/component-base": "24.3.0-alpha1",
43
+ "@vaadin/field-base": "24.3.0-alpha1",
44
+ "@vaadin/vaadin-lumo-styles": "24.3.0-alpha1",
45
+ "@vaadin/vaadin-material-styles": "24.3.0-alpha1",
46
+ "@vaadin/vaadin-themable-mixin": "24.3.0-alpha1"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@esm-bundle/chai": "^4.3.4",
50
- "@vaadin/testing-helpers": "^0.4.3",
50
+ "@vaadin/testing-helpers": "^0.5.0",
51
51
  "sinon": "^13.0.2"
52
52
  },
53
53
  "web-types": [
54
54
  "web-types.json",
55
55
  "web-types.lit.json"
56
56
  ],
57
- "gitHead": "da54950b9f8c14c6451ede0d426e16a489c7fb9b"
57
+ "gitHead": "9ca6f3ca220a777e8eea181a1f5717e39a732240"
58
58
  }
@@ -16,8 +16,15 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
16
16
  */
17
17
  export type RadioButtonCheckedChangedEvent = CustomEvent<{ value: boolean }>;
18
18
 
19
+ /**
20
+ * Fired when the `dirty` property changes.
21
+ */
22
+ export type RadioButtonDirtyChangedEvent = CustomEvent<{ value: boolean }>;
23
+
19
24
  export interface RadioButtonCustomEventMap {
20
25
  'checked-changed': RadioButtonCheckedChangedEvent;
26
+
27
+ 'dirty-changed': RadioButtonDirtyChangedEvent;
21
28
  }
22
29
 
23
30
  export interface RadioButtonEventMap extends HTMLElementEventMap, RadioButtonCustomEventMap {}
@@ -56,6 +63,7 @@ export interface RadioButtonEventMap extends HTMLElementEventMap, RadioButtonCus
56
63
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
57
64
  *
58
65
  * @fires {CustomEvent} checked-changed - Fired when the `checked` property changes.
66
+ * @fires {CustomEvent} dirty-changed - Fired when the `dirty` property changes.
59
67
  */
60
68
  declare class RadioButton extends LabelMixin(
61
69
  CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement)))))),
@@ -7,6 +7,7 @@ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
7
  import { ActiveMixin } from '@vaadin/a11y-base/src/active-mixin.js';
8
8
  import { DelegateFocusMixin } from '@vaadin/a11y-base/src/delegate-focus-mixin.js';
9
9
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
10
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
10
11
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
11
12
  import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
12
13
  import { InputController } from '@vaadin/field-base/src/input-controller.js';
@@ -48,7 +49,9 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
48
49
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
49
50
  *
50
51
  * @fires {CustomEvent} checked-changed - Fired when the `checked` property changes.
52
+ * @fires {CustomEvent} dirty-changed - Fired when the `dirty` property changes.
51
53
  *
54
+ * @customElement
52
55
  * @extends HTMLElement
53
56
  * @mixes ControllerMixin
54
57
  * @mixes ThemableMixin
@@ -186,6 +189,6 @@ class RadioButton extends LabelMixin(
186
189
  }
187
190
  }
188
191
 
189
- customElements.define(RadioButton.is, RadioButton);
192
+ defineCustomElement(RadioButton);
190
193
 
191
194
  export { RadioButton };
@@ -15,6 +15,11 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
15
15
  */
16
16
  export type RadioGroupInvalidChangedEvent = CustomEvent<{ value: boolean }>;
17
17
 
18
+ /**
19
+ * Fired when the `dirty` property changes.
20
+ */
21
+ export type RadioGroupDirtyChangedEvent = CustomEvent<{ value: boolean }>;
22
+
18
23
  /**
19
24
  * Fired when the `value` property changes.
20
25
  */
@@ -28,6 +33,8 @@ export type RadioGroupValidatedEvent = CustomEvent<{ valid: boolean }>;
28
33
  export interface RadioGroupCustomEventMap {
29
34
  'invalid-changed': RadioGroupInvalidChangedEvent;
30
35
 
36
+ 'dirty-changed': RadioGroupDirtyChangedEvent;
37
+
31
38
  'value-changed': RadioGroupValueChangedEvent;
32
39
 
33
40
  validated: RadioGroupValidatedEvent;
@@ -74,6 +81,7 @@ export interface RadioGroupEventMap extends HTMLElementEventMap, RadioGroupCusto
74
81
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
75
82
  *
76
83
  * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
84
+ * @fires {CustomEvent} dirty-changed - Fired when the `dirty` property changes.
77
85
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
78
86
  * @fires {CustomEvent} validated - Fired whenever the field is validated.
79
87
  */
@@ -93,6 +101,15 @@ declare class RadioGroup extends FieldMixin(
93
101
  */
94
102
  readonly: boolean;
95
103
 
104
+ /**
105
+ * Whether the field is dirty.
106
+ *
107
+ * The field is automatically marked as dirty once the user triggers
108
+ * a `change` event. Additionally, the field can be manually marked
109
+ * as dirty by setting the property to `true`.
110
+ */
111
+ dirty: boolean;
112
+
96
113
  addEventListener<K extends keyof RadioGroupEventMap>(
97
114
  type: K,
98
115
  listener: (this: RadioGroup, ev: RadioGroupEventMap[K]) => void,
@@ -3,12 +3,13 @@
3
3
  * Copyright (c) 2017 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
7
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
7
  import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
9
8
  import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
10
9
  import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
10
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
11
11
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
12
+ import { SlotObserver } from '@vaadin/component-base/src/slot-observer.js';
12
13
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
13
14
  import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
14
15
  import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
@@ -57,6 +58,7 @@ import { RadioButton } from './vaadin-radio-button.js';
57
58
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
58
59
  * @fires {CustomEvent} validated - Fired whenever the field is validated.
59
60
  *
61
+ * @customElement
60
62
  * @extends HTMLElement
61
63
  * @mixes ThemableMixin
62
64
  * @mixes DisabledMixin
@@ -163,6 +165,19 @@ class RadioGroup extends FieldMixin(
163
165
  _fieldName: {
164
166
  type: String,
165
167
  },
168
+
169
+ /**
170
+ * Whether the field is dirty.
171
+ *
172
+ * The field is automatically marked as dirty once the user triggers
173
+ * a `change` event. Additionally, the field can be manually marked
174
+ * as dirty by setting the property to `true`.
175
+ */
176
+ dirty: {
177
+ type: Boolean,
178
+ value: false,
179
+ notify: true,
180
+ },
166
181
  };
167
182
  }
168
183
 
@@ -171,7 +186,21 @@ class RadioGroup extends FieldMixin(
171
186
 
172
187
  this.__registerRadioButton = this.__registerRadioButton.bind(this);
173
188
  this.__unregisterRadioButton = this.__unregisterRadioButton.bind(this);
189
+ this.__onRadioButtonChange = this.__onRadioButtonChange.bind(this);
174
190
  this.__onRadioButtonCheckedChange = this.__onRadioButtonCheckedChange.bind(this);
191
+
192
+ this._tooltipController = new TooltipController(this);
193
+ this._tooltipController.addEventListener('tooltip-changed', (event) => {
194
+ const tooltip = event.detail.node;
195
+ if (tooltip && tooltip.isConnected) {
196
+ // Tooltip element has been added to the DOM
197
+ const inputs = this.__radioButtons.map((radio) => radio.inputElement);
198
+ this._tooltipController.setAriaTarget(inputs);
199
+ } else {
200
+ // Tooltip element is no longer connected
201
+ this._tooltipController.setAriaTarget([]);
202
+ }
203
+ });
175
204
  }
176
205
 
177
206
  /**
@@ -213,16 +242,19 @@ class RadioGroup extends FieldMixin(
213
242
 
214
243
  this._fieldName = `${this.localName}-${generateUniqueId()}`;
215
244
 
216
- this._observer = new FlattenedNodesObserver(this, ({ addedNodes, removedNodes }) => {
245
+ const slot = this.shadowRoot.querySelector('slot:not([name])');
246
+ this._observer = new SlotObserver(slot, ({ addedNodes, removedNodes }) => {
217
247
  // Registers the added radio buttons in the reverse order
218
248
  // in order for the group to take the value of the most recent button.
219
249
  this.__filterRadioButtons(addedNodes).reverse().forEach(this.__registerRadioButton);
220
250
 
221
251
  // Unregisters the removed radio buttons.
222
252
  this.__filterRadioButtons(removedNodes).forEach(this.__unregisterRadioButton);
253
+
254
+ const inputs = this.__radioButtons.map((radio) => radio.inputElement);
255
+ this._tooltipController.setAriaTarget(inputs);
223
256
  });
224
257
 
225
- this._tooltipController = new TooltipController(this);
226
258
  this.addController(this._tooltipController);
227
259
  }
228
260
 
@@ -322,6 +354,7 @@ class RadioGroup extends FieldMixin(
322
354
  */
323
355
  __registerRadioButton(radioButton) {
324
356
  radioButton.name = this._fieldName;
357
+ radioButton.addEventListener('change', this.__onRadioButtonChange);
325
358
  radioButton.addEventListener('checked-changed', this.__onRadioButtonCheckedChange);
326
359
 
327
360
  if (this.disabled || this.readonly) {
@@ -340,6 +373,7 @@ class RadioGroup extends FieldMixin(
340
373
  * @private
341
374
  */
342
375
  __unregisterRadioButton(radioButton) {
376
+ radioButton.removeEventListener('change', this.__onRadioButtonChange);
343
377
  radioButton.removeEventListener('checked-changed', this.__onRadioButtonCheckedChange);
344
378
 
345
379
  if (radioButton.value === this.value) {
@@ -347,6 +381,11 @@ class RadioGroup extends FieldMixin(
347
381
  }
348
382
  }
349
383
 
384
+ /** @private */
385
+ __onRadioButtonChange() {
386
+ this.dirty = true;
387
+ }
388
+
350
389
  /**
351
390
  * @param {!CustomEvent} event
352
391
  * @private
@@ -510,6 +549,6 @@ class RadioGroup extends FieldMixin(
510
549
  }
511
550
  }
512
551
 
513
- customElements.define(RadioGroup.is, RadioGroup);
552
+ defineCustomElement(RadioGroup);
514
553
 
515
554
  export { RadioGroup };
package/web-types.json ADDED
@@ -0,0 +1,444 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/web-types",
3
+ "name": "@vaadin/radio-group",
4
+ "version": "24.3.0-alpha1",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "vaadin-radio-button",
11
+ "description": "`<vaadin-radio-button>` is a web component representing a choice in a radio group.\nOnly one radio button in the group can be selected at the same time.\n\n```html\n<vaadin-radio-group label=\"Travel class\">\n <vaadin-radio-button value=\"economy\" label=\"Economy\"></vaadin-radio-button>\n <vaadin-radio-button value=\"business\" label=\"Business\"></vaadin-radio-button>\n <vaadin-radio-button value=\"firstClass\" label=\"First Class\"></vaadin-radio-button>\n</vaadin-radio-group>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n------------|----------------\n`radio` | The wrapper element that contains slotted `<input type=\"radio\">`.\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n-------------|-------------|------------\n`active` | Set when the radio button is pressed down, either with a pointer or the keyboard. | `:host`\n`disabled` | Set when the radio button is disabled. | `:host`\n`focus-ring` | Set when the radio button is focused using the keyboard. | `:host`\n`focused` | Set when the radio button is focused. | `:host`\n`checked` | Set when the radio button is checked. | `:host`\n`has-label` | Set when the radio button has a label. | `:host`\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
+ "attributes": [
13
+ {
14
+ "name": "disabled",
15
+ "description": "If true, the user cannot interact with this element.",
16
+ "value": {
17
+ "type": [
18
+ "boolean",
19
+ "null",
20
+ "undefined"
21
+ ]
22
+ }
23
+ },
24
+ {
25
+ "name": "value",
26
+ "description": "The value of the field.",
27
+ "value": {
28
+ "type": [
29
+ "string",
30
+ "null",
31
+ "undefined"
32
+ ]
33
+ }
34
+ },
35
+ {
36
+ "name": "dirty",
37
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
38
+ "value": {
39
+ "type": [
40
+ "boolean",
41
+ "null",
42
+ "undefined"
43
+ ]
44
+ }
45
+ },
46
+ {
47
+ "name": "checked",
48
+ "description": "True if the element is checked.",
49
+ "value": {
50
+ "type": [
51
+ "boolean"
52
+ ]
53
+ }
54
+ },
55
+ {
56
+ "name": "label",
57
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
58
+ "value": {
59
+ "type": [
60
+ "string",
61
+ "null",
62
+ "undefined"
63
+ ]
64
+ }
65
+ },
66
+ {
67
+ "name": "name",
68
+ "description": "The name of the radio button.",
69
+ "value": {
70
+ "type": [
71
+ "string"
72
+ ]
73
+ }
74
+ },
75
+ {
76
+ "name": "theme",
77
+ "description": "The theme variants to apply to the component.",
78
+ "value": {
79
+ "type": [
80
+ "string",
81
+ "null",
82
+ "undefined"
83
+ ]
84
+ }
85
+ }
86
+ ],
87
+ "js": {
88
+ "properties": [
89
+ {
90
+ "name": "disabled",
91
+ "description": "If true, the user cannot interact with this element.",
92
+ "value": {
93
+ "type": [
94
+ "boolean",
95
+ "null",
96
+ "undefined"
97
+ ]
98
+ }
99
+ },
100
+ {
101
+ "name": "value",
102
+ "description": "The value of the field.",
103
+ "value": {
104
+ "type": [
105
+ "string",
106
+ "null",
107
+ "undefined"
108
+ ]
109
+ }
110
+ },
111
+ {
112
+ "name": "dirty",
113
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
114
+ "value": {
115
+ "type": [
116
+ "boolean",
117
+ "null",
118
+ "undefined"
119
+ ]
120
+ }
121
+ },
122
+ {
123
+ "name": "checked",
124
+ "description": "True if the element is checked.",
125
+ "value": {
126
+ "type": [
127
+ "boolean"
128
+ ]
129
+ }
130
+ },
131
+ {
132
+ "name": "label",
133
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
134
+ "value": {
135
+ "type": [
136
+ "string",
137
+ "null",
138
+ "undefined"
139
+ ]
140
+ }
141
+ },
142
+ {
143
+ "name": "name",
144
+ "description": "The name of the radio button.",
145
+ "value": {
146
+ "type": [
147
+ "string"
148
+ ]
149
+ }
150
+ }
151
+ ],
152
+ "events": [
153
+ {
154
+ "name": "value-changed",
155
+ "description": "Fired when the `value` property changes."
156
+ },
157
+ {
158
+ "name": "dirty-changed",
159
+ "description": "Fired when the `dirty` property changes."
160
+ },
161
+ {
162
+ "name": "checked-changed",
163
+ "description": "Fired when the `checked` property changes."
164
+ }
165
+ ]
166
+ }
167
+ },
168
+ {
169
+ "name": "vaadin-radio-group",
170
+ "description": "`<vaadin-radio-group>` is a web component that allows the user to choose one item from a group of choices.\n\n```html\n<vaadin-radio-group label=\"Travel class\">\n <vaadin-radio-button value=\"economy\" label=\"Economy\"></vaadin-radio-button>\n <vaadin-radio-button value=\"business\" label=\"Business\"></vaadin-radio-button>\n <vaadin-radio-button value=\"firstClass\" label=\"First Class\"></vaadin-radio-button>\n</vaadin-radio-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 radio button 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.",
171
+ "attributes": [
172
+ {
173
+ "name": "disabled",
174
+ "description": "If true, the user cannot interact with this element.",
175
+ "value": {
176
+ "type": [
177
+ "boolean",
178
+ "null",
179
+ "undefined"
180
+ ]
181
+ }
182
+ },
183
+ {
184
+ "name": "label",
185
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
186
+ "value": {
187
+ "type": [
188
+ "string",
189
+ "null",
190
+ "undefined"
191
+ ]
192
+ }
193
+ },
194
+ {
195
+ "name": "invalid",
196
+ "description": "Set to true when the field is invalid.",
197
+ "value": {
198
+ "type": [
199
+ "boolean",
200
+ "null",
201
+ "undefined"
202
+ ]
203
+ }
204
+ },
205
+ {
206
+ "name": "required",
207
+ "description": "Specifies that the user must fill in a value.",
208
+ "value": {
209
+ "type": [
210
+ "boolean",
211
+ "null",
212
+ "undefined"
213
+ ]
214
+ }
215
+ },
216
+ {
217
+ "name": "error-message",
218
+ "description": "Error to show when the field is invalid.",
219
+ "value": {
220
+ "type": [
221
+ "string",
222
+ "null",
223
+ "undefined"
224
+ ]
225
+ }
226
+ },
227
+ {
228
+ "name": "helper-text",
229
+ "description": "String used for the helper text.",
230
+ "value": {
231
+ "type": [
232
+ "string",
233
+ "null",
234
+ "undefined"
235
+ ]
236
+ }
237
+ },
238
+ {
239
+ "name": "accessible-name",
240
+ "description": "String used to label the component to screen reader users.",
241
+ "value": {
242
+ "type": [
243
+ "string",
244
+ "null",
245
+ "undefined"
246
+ ]
247
+ }
248
+ },
249
+ {
250
+ "name": "accessible-name-ref",
251
+ "description": "Id of the element used as label of the component to screen reader users.",
252
+ "value": {
253
+ "type": [
254
+ "string",
255
+ "null",
256
+ "undefined"
257
+ ]
258
+ }
259
+ },
260
+ {
261
+ "name": "value",
262
+ "description": "The value of the radio group.",
263
+ "value": {
264
+ "type": [
265
+ "string"
266
+ ]
267
+ }
268
+ },
269
+ {
270
+ "name": "readonly",
271
+ "description": "When present, the user cannot modify the value of the radio group.\nThe property works similarly to the `disabled` property.\nWhile the `disabled` property disables all radio buttons inside the group,\nthe `readonly` property disables only unchecked ones.",
272
+ "value": {
273
+ "type": [
274
+ "boolean"
275
+ ]
276
+ }
277
+ },
278
+ {
279
+ "name": "dirty",
280
+ "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`.",
281
+ "value": {
282
+ "type": [
283
+ "boolean",
284
+ "null",
285
+ "undefined"
286
+ ]
287
+ }
288
+ },
289
+ {
290
+ "name": "theme",
291
+ "description": "The theme variants to apply to the component.",
292
+ "value": {
293
+ "type": [
294
+ "string",
295
+ "null",
296
+ "undefined"
297
+ ]
298
+ }
299
+ }
300
+ ],
301
+ "js": {
302
+ "properties": [
303
+ {
304
+ "name": "disabled",
305
+ "description": "If true, the user cannot interact with this element.",
306
+ "value": {
307
+ "type": [
308
+ "boolean",
309
+ "null",
310
+ "undefined"
311
+ ]
312
+ }
313
+ },
314
+ {
315
+ "name": "label",
316
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
317
+ "value": {
318
+ "type": [
319
+ "string",
320
+ "null",
321
+ "undefined"
322
+ ]
323
+ }
324
+ },
325
+ {
326
+ "name": "invalid",
327
+ "description": "Set to true when the field is invalid.",
328
+ "value": {
329
+ "type": [
330
+ "boolean",
331
+ "null",
332
+ "undefined"
333
+ ]
334
+ }
335
+ },
336
+ {
337
+ "name": "required",
338
+ "description": "Specifies that the user must fill in a value.",
339
+ "value": {
340
+ "type": [
341
+ "boolean",
342
+ "null",
343
+ "undefined"
344
+ ]
345
+ }
346
+ },
347
+ {
348
+ "name": "errorMessage",
349
+ "description": "Error to show when the field is invalid.",
350
+ "value": {
351
+ "type": [
352
+ "string",
353
+ "null",
354
+ "undefined"
355
+ ]
356
+ }
357
+ },
358
+ {
359
+ "name": "helperText",
360
+ "description": "String used for the helper text.",
361
+ "value": {
362
+ "type": [
363
+ "string",
364
+ "null",
365
+ "undefined"
366
+ ]
367
+ }
368
+ },
369
+ {
370
+ "name": "accessibleName",
371
+ "description": "String used to label the component to screen reader users.",
372
+ "value": {
373
+ "type": [
374
+ "string",
375
+ "null",
376
+ "undefined"
377
+ ]
378
+ }
379
+ },
380
+ {
381
+ "name": "accessibleNameRef",
382
+ "description": "Id of the element used as label of the component to screen reader users.",
383
+ "value": {
384
+ "type": [
385
+ "string",
386
+ "null",
387
+ "undefined"
388
+ ]
389
+ }
390
+ },
391
+ {
392
+ "name": "value",
393
+ "description": "The value of the radio group.",
394
+ "value": {
395
+ "type": [
396
+ "string"
397
+ ]
398
+ }
399
+ },
400
+ {
401
+ "name": "readonly",
402
+ "description": "When present, the user cannot modify the value of the radio group.\nThe property works similarly to the `disabled` property.\nWhile the `disabled` property disables all radio buttons inside the group,\nthe `readonly` property disables only unchecked ones.",
403
+ "value": {
404
+ "type": [
405
+ "boolean"
406
+ ]
407
+ }
408
+ },
409
+ {
410
+ "name": "dirty",
411
+ "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`.",
412
+ "value": {
413
+ "type": [
414
+ "boolean",
415
+ "null",
416
+ "undefined"
417
+ ]
418
+ }
419
+ }
420
+ ],
421
+ "events": [
422
+ {
423
+ "name": "validated",
424
+ "description": "Fired whenever the field is validated."
425
+ },
426
+ {
427
+ "name": "value-changed",
428
+ "description": "Fired when the `value` property changes."
429
+ },
430
+ {
431
+ "name": "dirty-changed",
432
+ "description": "Fired when the `dirty` property changes."
433
+ },
434
+ {
435
+ "name": "invalid-changed",
436
+ "description": "Fired when the `invalid` property changes."
437
+ }
438
+ ]
439
+ }
440
+ }
441
+ ]
442
+ }
443
+ }
444
+ }
@@ -0,0 +1,202 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/web-types",
3
+ "name": "@vaadin/radio-group",
4
+ "version": "24.3.0-alpha1",
5
+ "description-markup": "markdown",
6
+ "framework": "lit",
7
+ "framework-config": {
8
+ "enable-when": {
9
+ "node-packages": [
10
+ "lit"
11
+ ]
12
+ }
13
+ },
14
+ "contributions": {
15
+ "html": {
16
+ "elements": [
17
+ {
18
+ "name": "vaadin-radio-button",
19
+ "description": "`<vaadin-radio-button>` is a web component representing a choice in a radio group.\nOnly one radio button in the group can be selected at the same time.\n\n```html\n<vaadin-radio-group label=\"Travel class\">\n <vaadin-radio-button value=\"economy\" label=\"Economy\"></vaadin-radio-button>\n <vaadin-radio-button value=\"business\" label=\"Business\"></vaadin-radio-button>\n <vaadin-radio-button value=\"firstClass\" label=\"First Class\"></vaadin-radio-button>\n</vaadin-radio-group>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n------------|----------------\n`radio` | The wrapper element that contains slotted `<input type=\"radio\">`.\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n-------------|-------------|------------\n`active` | Set when the radio button is pressed down, either with a pointer or the keyboard. | `:host`\n`disabled` | Set when the radio button is disabled. | `:host`\n`focus-ring` | Set when the radio button is focused using the keyboard. | `:host`\n`focused` | Set when the radio button is focused. | `:host`\n`checked` | Set when the radio button is checked. | `:host`\n`has-label` | Set when the radio button has a label. | `:host`\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
+ "extension": true,
21
+ "attributes": [
22
+ {
23
+ "name": "?disabled",
24
+ "description": "If true, the user cannot interact with this element.",
25
+ "value": {
26
+ "kind": "expression"
27
+ }
28
+ },
29
+ {
30
+ "name": "?dirty",
31
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
32
+ "value": {
33
+ "kind": "expression"
34
+ }
35
+ },
36
+ {
37
+ "name": "?checked",
38
+ "description": "True if the element is checked.",
39
+ "value": {
40
+ "kind": "expression"
41
+ }
42
+ },
43
+ {
44
+ "name": ".value",
45
+ "description": "The value of the field.",
46
+ "value": {
47
+ "kind": "expression"
48
+ }
49
+ },
50
+ {
51
+ "name": ".label",
52
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
53
+ "value": {
54
+ "kind": "expression"
55
+ }
56
+ },
57
+ {
58
+ "name": ".name",
59
+ "description": "The name of the radio button.",
60
+ "value": {
61
+ "kind": "expression"
62
+ }
63
+ },
64
+ {
65
+ "name": "@value-changed",
66
+ "description": "Fired when the `value` property changes.",
67
+ "value": {
68
+ "kind": "expression"
69
+ }
70
+ },
71
+ {
72
+ "name": "@dirty-changed",
73
+ "description": "Fired when the `dirty` property changes.",
74
+ "value": {
75
+ "kind": "expression"
76
+ }
77
+ },
78
+ {
79
+ "name": "@checked-changed",
80
+ "description": "Fired when the `checked` property changes.",
81
+ "value": {
82
+ "kind": "expression"
83
+ }
84
+ }
85
+ ]
86
+ },
87
+ {
88
+ "name": "vaadin-radio-group",
89
+ "description": "`<vaadin-radio-group>` is a web component that allows the user to choose one item from a group of choices.\n\n```html\n<vaadin-radio-group label=\"Travel class\">\n <vaadin-radio-button value=\"economy\" label=\"Economy\"></vaadin-radio-button>\n <vaadin-radio-button value=\"business\" label=\"Business\"></vaadin-radio-button>\n <vaadin-radio-button value=\"firstClass\" label=\"First Class\"></vaadin-radio-button>\n</vaadin-radio-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 radio button 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.",
90
+ "extension": true,
91
+ "attributes": [
92
+ {
93
+ "name": "?disabled",
94
+ "description": "If true, the user cannot interact with this element.",
95
+ "value": {
96
+ "kind": "expression"
97
+ }
98
+ },
99
+ {
100
+ "name": "?invalid",
101
+ "description": "Set to true when the field is invalid.",
102
+ "value": {
103
+ "kind": "expression"
104
+ }
105
+ },
106
+ {
107
+ "name": "?required",
108
+ "description": "Specifies that the user must fill in a value.",
109
+ "value": {
110
+ "kind": "expression"
111
+ }
112
+ },
113
+ {
114
+ "name": "?readonly",
115
+ "description": "When present, the user cannot modify the value of the radio group.\nThe property works similarly to the `disabled` property.\nWhile the `disabled` property disables all radio buttons inside the group,\nthe `readonly` property disables only unchecked ones.",
116
+ "value": {
117
+ "kind": "expression"
118
+ }
119
+ },
120
+ {
121
+ "name": "?dirty",
122
+ "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`.",
123
+ "value": {
124
+ "kind": "expression"
125
+ }
126
+ },
127
+ {
128
+ "name": ".label",
129
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
130
+ "value": {
131
+ "kind": "expression"
132
+ }
133
+ },
134
+ {
135
+ "name": ".errorMessage",
136
+ "description": "Error to show when the field is invalid.",
137
+ "value": {
138
+ "kind": "expression"
139
+ }
140
+ },
141
+ {
142
+ "name": ".helperText",
143
+ "description": "String used for the helper text.",
144
+ "value": {
145
+ "kind": "expression"
146
+ }
147
+ },
148
+ {
149
+ "name": ".accessibleName",
150
+ "description": "String used to label the component to screen reader users.",
151
+ "value": {
152
+ "kind": "expression"
153
+ }
154
+ },
155
+ {
156
+ "name": ".accessibleNameRef",
157
+ "description": "Id of the element used as label of the component to screen reader users.",
158
+ "value": {
159
+ "kind": "expression"
160
+ }
161
+ },
162
+ {
163
+ "name": ".value",
164
+ "description": "The value of the radio group.",
165
+ "value": {
166
+ "kind": "expression"
167
+ }
168
+ },
169
+ {
170
+ "name": "@validated",
171
+ "description": "Fired whenever the field is validated.",
172
+ "value": {
173
+ "kind": "expression"
174
+ }
175
+ },
176
+ {
177
+ "name": "@value-changed",
178
+ "description": "Fired when the `value` property changes.",
179
+ "value": {
180
+ "kind": "expression"
181
+ }
182
+ },
183
+ {
184
+ "name": "@dirty-changed",
185
+ "description": "Fired when the `dirty` property changes.",
186
+ "value": {
187
+ "kind": "expression"
188
+ }
189
+ },
190
+ {
191
+ "name": "@invalid-changed",
192
+ "description": "Fired when the `invalid` property changes.",
193
+ "value": {
194
+ "kind": "expression"
195
+ }
196
+ }
197
+ ]
198
+ }
199
+ ]
200
+ }
201
+ }
202
+ }