@vaadin/radio-group 23.2.0-dev.8a7678b70 → 23.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/README.md +4 -4
- package/package.json +14 -8
- package/src/vaadin-radio-button.d.ts +3 -3
- package/src/vaadin-radio-button.js +1 -1
- package/src/vaadin-radio-group.d.ts +11 -3
- package/src/vaadin-radio-group.js +41 -15
- package/web-types.json +348 -0
- package/web-types.lit.json +160 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A web component that allows the user to choose one item from a group of choices.
|
|
4
4
|
|
|
5
|
-
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/
|
|
5
|
+
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/radio-button)
|
|
6
6
|
|
|
7
7
|
```html
|
|
8
8
|
<vaadin-radio-group label="Travel class">
|
|
@@ -12,7 +12,7 @@ A web component that allows the user to choose one item from a group of choices.
|
|
|
12
12
|
</vaadin-radio-group>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/radio-group/screenshot.png" width="370" alt="Screenshot of vaadin-radio-group">](https://vaadin.com/docs/latest/
|
|
15
|
+
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/radio-group/screenshot.png" width="370" alt="Screenshot of vaadin-radio-group">](https://vaadin.com/docs/latest/components/radio-button)
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
@@ -30,7 +30,7 @@ import '@vaadin/radio-group';
|
|
|
30
30
|
|
|
31
31
|
## Themes
|
|
32
32
|
|
|
33
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/
|
|
33
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
34
34
|
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/radio-group/vaadin-radio-group.js) of the package uses the Lumo theme.
|
|
35
35
|
|
|
36
36
|
To use the Material theme, import the component from the `theme/material` folder:
|
|
@@ -53,7 +53,7 @@ import '@vaadin/radio-group/src/vaadin-radio-group.js';
|
|
|
53
53
|
|
|
54
54
|
## Contributing
|
|
55
55
|
|
|
56
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/
|
|
56
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
57
57
|
|
|
58
58
|
## License
|
|
59
59
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/radio-group",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.3.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
"src",
|
|
24
24
|
"theme",
|
|
25
25
|
"vaadin-*.d.ts",
|
|
26
|
-
"vaadin-*.js"
|
|
26
|
+
"vaadin-*.js",
|
|
27
|
+
"web-types.json",
|
|
28
|
+
"web-types.lit.json"
|
|
27
29
|
],
|
|
28
30
|
"keywords": [
|
|
29
31
|
"Vaadin",
|
|
@@ -36,16 +38,20 @@
|
|
|
36
38
|
],
|
|
37
39
|
"dependencies": {
|
|
38
40
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/component-base": "23.
|
|
40
|
-
"@vaadin/field-base": "23.
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "23.
|
|
42
|
-
"@vaadin/vaadin-material-styles": "23.
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "23.
|
|
41
|
+
"@vaadin/component-base": "23.3.0-alpha1",
|
|
42
|
+
"@vaadin/field-base": "23.3.0-alpha1",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "23.3.0-alpha1",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "23.3.0-alpha1",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "23.3.0-alpha1"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@esm-bundle/chai": "^4.3.4",
|
|
47
49
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
48
50
|
"sinon": "^13.0.2"
|
|
49
51
|
},
|
|
50
|
-
"
|
|
52
|
+
"web-types": [
|
|
53
|
+
"web-types.json",
|
|
54
|
+
"web-types.lit.json"
|
|
55
|
+
],
|
|
56
|
+
"gitHead": "beabc527d4b1274eb798ff701d406fed45cfe638"
|
|
51
57
|
}
|
|
@@ -53,7 +53,7 @@ export interface RadioButtonEventMap extends HTMLElementEventMap, RadioButtonCus
|
|
|
53
53
|
* `checked` | Set when the radio button is checked. | `:host`
|
|
54
54
|
* `has-label` | Set when the radio button has a label. | `:host`
|
|
55
55
|
*
|
|
56
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
56
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
57
57
|
*
|
|
58
58
|
* @fires {CustomEvent} checked-changed - Fired when the `checked` property changes.
|
|
59
59
|
*/
|
|
@@ -68,13 +68,13 @@ declare class RadioButton extends LabelMixin(
|
|
|
68
68
|
addEventListener<K extends keyof RadioButtonEventMap>(
|
|
69
69
|
type: K,
|
|
70
70
|
listener: (this: RadioButton, ev: RadioButtonEventMap[K]) => void,
|
|
71
|
-
options?:
|
|
71
|
+
options?: AddEventListenerOptions | boolean,
|
|
72
72
|
): void;
|
|
73
73
|
|
|
74
74
|
removeEventListener<K extends keyof RadioButtonEventMap>(
|
|
75
75
|
type: K,
|
|
76
76
|
listener: (this: RadioButton, ev: RadioButtonEventMap[K]) => void,
|
|
77
|
-
options?:
|
|
77
|
+
options?: EventListenerOptions | boolean,
|
|
78
78
|
): void;
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -46,7 +46,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
46
46
|
* `checked` | Set when the radio button is checked. | `:host`
|
|
47
47
|
* `has-label` | Set when the radio button has a label. | `:host`
|
|
48
48
|
*
|
|
49
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
49
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
50
50
|
*
|
|
51
51
|
* @fires {CustomEvent} checked-changed - Fired when the `checked` property changes.
|
|
52
52
|
*
|
|
@@ -20,10 +20,17 @@ export type RadioGroupInvalidChangedEvent = CustomEvent<{ value: boolean }>;
|
|
|
20
20
|
*/
|
|
21
21
|
export type RadioGroupValueChangedEvent = CustomEvent<{ value: string }>;
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Fired whenever the field is validated.
|
|
25
|
+
*/
|
|
26
|
+
export type RadioGroupValidatedEvent = CustomEvent<{ valid: boolean }>;
|
|
27
|
+
|
|
23
28
|
export interface RadioGroupCustomEventMap {
|
|
24
29
|
'invalid-changed': RadioGroupInvalidChangedEvent;
|
|
25
30
|
|
|
26
31
|
'value-changed': RadioGroupValueChangedEvent;
|
|
32
|
+
|
|
33
|
+
validated: RadioGroupValidatedEvent;
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
export interface RadioGroupEventMap extends HTMLElementEventMap, RadioGroupCustomEventMap {}
|
|
@@ -64,10 +71,11 @@ export interface RadioGroupEventMap extends HTMLElementEventMap, RadioGroupCusto
|
|
|
64
71
|
* `has-helper` | Set when the element has helper text | :host
|
|
65
72
|
* `has-error-message` | Set when the element has an error message | :host
|
|
66
73
|
*
|
|
67
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
74
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
68
75
|
*
|
|
69
76
|
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
70
77
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
78
|
+
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
71
79
|
*/
|
|
72
80
|
declare class RadioGroup extends FieldMixin(
|
|
73
81
|
FocusMixin(DisabledMixin(KeyboardMixin(ElementMixin(ThemableMixin(HTMLElement))))),
|
|
@@ -88,13 +96,13 @@ declare class RadioGroup extends FieldMixin(
|
|
|
88
96
|
addEventListener<K extends keyof RadioGroupEventMap>(
|
|
89
97
|
type: K,
|
|
90
98
|
listener: (this: RadioGroup, ev: RadioGroupEventMap[K]) => void,
|
|
91
|
-
options?:
|
|
99
|
+
options?: AddEventListenerOptions | boolean,
|
|
92
100
|
): void;
|
|
93
101
|
|
|
94
102
|
removeEventListener<K extends keyof RadioGroupEventMap>(
|
|
95
103
|
type: K,
|
|
96
104
|
listener: (this: RadioGroup, ev: RadioGroupEventMap[K]) => void,
|
|
97
|
-
options?:
|
|
105
|
+
options?: EventListenerOptions | boolean,
|
|
98
106
|
): void;
|
|
99
107
|
}
|
|
100
108
|
|
|
@@ -9,6 +9,7 @@ import { DisabledMixin } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
|
9
9
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
10
|
import { FocusMixin } from '@vaadin/component-base/src/focus-mixin.js';
|
|
11
11
|
import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js';
|
|
12
|
+
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
12
13
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
13
14
|
import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
|
|
14
15
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -50,10 +51,11 @@ import { RadioButton } from './vaadin-radio-button.js';
|
|
|
50
51
|
* `has-helper` | Set when the element has helper text | :host
|
|
51
52
|
* `has-error-message` | Set when the element has an error message | :host
|
|
52
53
|
*
|
|
53
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
54
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
54
55
|
*
|
|
55
56
|
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
56
57
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
58
|
+
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
57
59
|
*
|
|
58
60
|
* @extends HTMLElement
|
|
59
61
|
* @mixes ThemableMixin
|
|
@@ -115,6 +117,8 @@ class RadioGroup extends FieldMixin(
|
|
|
115
117
|
<slot name="error-message"></slot>
|
|
116
118
|
</div>
|
|
117
119
|
</div>
|
|
120
|
+
|
|
121
|
+
<slot name="tooltip"></slot>
|
|
118
122
|
`;
|
|
119
123
|
}
|
|
120
124
|
|
|
@@ -128,6 +132,7 @@ class RadioGroup extends FieldMixin(
|
|
|
128
132
|
value: {
|
|
129
133
|
type: String,
|
|
130
134
|
notify: true,
|
|
135
|
+
value: '',
|
|
131
136
|
observer: '__valueChanged',
|
|
132
137
|
},
|
|
133
138
|
|
|
@@ -183,6 +188,9 @@ class RadioGroup extends FieldMixin(
|
|
|
183
188
|
// Unregisters the removed radio buttons.
|
|
184
189
|
this.__filterRadioButtons(removedNodes).forEach(this.__unregisterRadioButton);
|
|
185
190
|
});
|
|
191
|
+
|
|
192
|
+
this._tooltipController = new TooltipController(this);
|
|
193
|
+
this.addController(this._tooltipController);
|
|
186
194
|
}
|
|
187
195
|
|
|
188
196
|
/**
|
|
@@ -247,6 +255,23 @@ class RadioGroup extends FieldMixin(
|
|
|
247
255
|
}
|
|
248
256
|
}
|
|
249
257
|
|
|
258
|
+
/**
|
|
259
|
+
* Override an observer from `FieldMixin`.
|
|
260
|
+
*
|
|
261
|
+
* @param {boolean} invalid
|
|
262
|
+
* @protected
|
|
263
|
+
* @override
|
|
264
|
+
*/
|
|
265
|
+
_invalidChanged(invalid) {
|
|
266
|
+
super._invalidChanged(invalid);
|
|
267
|
+
|
|
268
|
+
if (invalid) {
|
|
269
|
+
this.setAttribute('aria-invalid', 'true');
|
|
270
|
+
} else {
|
|
271
|
+
this.removeAttribute('aria-invalid');
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
250
275
|
/**
|
|
251
276
|
* @param {number} index
|
|
252
277
|
* @private
|
|
@@ -339,25 +364,28 @@ class RadioGroup extends FieldMixin(
|
|
|
339
364
|
* @private
|
|
340
365
|
*/
|
|
341
366
|
__valueChanged(newValue, oldValue) {
|
|
342
|
-
if (
|
|
367
|
+
if (oldValue === undefined && newValue === '') {
|
|
343
368
|
return;
|
|
344
369
|
}
|
|
345
370
|
|
|
346
|
-
if (
|
|
371
|
+
if (newValue) {
|
|
372
|
+
const newSelectedRadioButton = this.__radioButtons.find((radioButton) => {
|
|
373
|
+
return radioButton.value === newValue;
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
if (newSelectedRadioButton) {
|
|
377
|
+
this.__selectRadioButton(newSelectedRadioButton);
|
|
378
|
+
this.toggleAttribute('has-value', true);
|
|
379
|
+
} else {
|
|
380
|
+
console.warn(`The radio button with the value "${newValue}" was not found.`);
|
|
381
|
+
}
|
|
382
|
+
} else {
|
|
347
383
|
this.__selectRadioButton(null);
|
|
348
384
|
this.removeAttribute('has-value');
|
|
349
|
-
return;
|
|
350
385
|
}
|
|
351
386
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
if (newSelectedRadioButton) {
|
|
357
|
-
this.__selectRadioButton(newSelectedRadioButton);
|
|
358
|
-
this.toggleAttribute('has-value', true);
|
|
359
|
-
} else {
|
|
360
|
-
console.warn(`The radio button with the value "${newValue}" was not found.`);
|
|
387
|
+
if (oldValue !== undefined) {
|
|
388
|
+
this.validate();
|
|
361
389
|
}
|
|
362
390
|
}
|
|
363
391
|
|
|
@@ -451,8 +479,6 @@ class RadioGroup extends FieldMixin(
|
|
|
451
479
|
button.checked = button === radioButton;
|
|
452
480
|
});
|
|
453
481
|
|
|
454
|
-
this.validate();
|
|
455
|
-
|
|
456
482
|
if (this.readonly) {
|
|
457
483
|
this.__updateRadioButtonsDisabledProperty();
|
|
458
484
|
}
|
package/web-types.json
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/radio-group",
|
|
4
|
+
"version": "23.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/custom-theme/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": "checked",
|
|
37
|
+
"description": "True if the element is checked.",
|
|
38
|
+
"value": {
|
|
39
|
+
"type": [
|
|
40
|
+
"boolean"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "label",
|
|
46
|
+
"description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
|
|
47
|
+
"value": {
|
|
48
|
+
"type": [
|
|
49
|
+
"string",
|
|
50
|
+
"null",
|
|
51
|
+
"undefined"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "name",
|
|
57
|
+
"description": "The name of the radio button.",
|
|
58
|
+
"value": {
|
|
59
|
+
"type": [
|
|
60
|
+
"string"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "theme",
|
|
66
|
+
"description": "The theme variants to apply to the component.",
|
|
67
|
+
"value": {
|
|
68
|
+
"type": [
|
|
69
|
+
"string",
|
|
70
|
+
"null",
|
|
71
|
+
"undefined"
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"js": {
|
|
77
|
+
"properties": [
|
|
78
|
+
{
|
|
79
|
+
"name": "disabled",
|
|
80
|
+
"description": "If true, the user cannot interact with this element.",
|
|
81
|
+
"value": {
|
|
82
|
+
"type": [
|
|
83
|
+
"boolean",
|
|
84
|
+
"null",
|
|
85
|
+
"undefined"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "value",
|
|
91
|
+
"description": "The value of the field.",
|
|
92
|
+
"value": {
|
|
93
|
+
"type": [
|
|
94
|
+
"string",
|
|
95
|
+
"null",
|
|
96
|
+
"undefined"
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "checked",
|
|
102
|
+
"description": "True if the element is checked.",
|
|
103
|
+
"value": {
|
|
104
|
+
"type": [
|
|
105
|
+
"boolean"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "label",
|
|
111
|
+
"description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
|
|
112
|
+
"value": {
|
|
113
|
+
"type": [
|
|
114
|
+
"string",
|
|
115
|
+
"null",
|
|
116
|
+
"undefined"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"name": "name",
|
|
122
|
+
"description": "The name of the radio button.",
|
|
123
|
+
"value": {
|
|
124
|
+
"type": [
|
|
125
|
+
"string"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"events": [
|
|
131
|
+
{
|
|
132
|
+
"name": "value-changed",
|
|
133
|
+
"description": "Fired when the `value` property changes."
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "checked-changed",
|
|
137
|
+
"description": "Fired when the `checked` property changes."
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "vaadin-radio-group",
|
|
144
|
+
"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/custom-theme/styling-components) documentation.",
|
|
145
|
+
"attributes": [
|
|
146
|
+
{
|
|
147
|
+
"name": "disabled",
|
|
148
|
+
"description": "If true, the user cannot interact with this element.",
|
|
149
|
+
"value": {
|
|
150
|
+
"type": [
|
|
151
|
+
"boolean",
|
|
152
|
+
"null",
|
|
153
|
+
"undefined"
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"name": "label",
|
|
159
|
+
"description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
|
|
160
|
+
"value": {
|
|
161
|
+
"type": [
|
|
162
|
+
"string",
|
|
163
|
+
"null",
|
|
164
|
+
"undefined"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "invalid",
|
|
170
|
+
"description": "Set to true when the field is invalid.",
|
|
171
|
+
"value": {
|
|
172
|
+
"type": [
|
|
173
|
+
"boolean",
|
|
174
|
+
"null",
|
|
175
|
+
"undefined"
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "required",
|
|
181
|
+
"description": "Specifies that the user must fill in a value.",
|
|
182
|
+
"value": {
|
|
183
|
+
"type": [
|
|
184
|
+
"boolean",
|
|
185
|
+
"null",
|
|
186
|
+
"undefined"
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"name": "error-message",
|
|
192
|
+
"description": "Error to show when the field is invalid.",
|
|
193
|
+
"value": {
|
|
194
|
+
"type": [
|
|
195
|
+
"string",
|
|
196
|
+
"null",
|
|
197
|
+
"undefined"
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "helper-text",
|
|
203
|
+
"description": "String used for the helper text.",
|
|
204
|
+
"value": {
|
|
205
|
+
"type": [
|
|
206
|
+
"string",
|
|
207
|
+
"null",
|
|
208
|
+
"undefined"
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"name": "value",
|
|
214
|
+
"description": "The value of the radio group.",
|
|
215
|
+
"value": {
|
|
216
|
+
"type": [
|
|
217
|
+
"string"
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"name": "readonly",
|
|
223
|
+
"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.",
|
|
224
|
+
"value": {
|
|
225
|
+
"type": [
|
|
226
|
+
"boolean"
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"name": "theme",
|
|
232
|
+
"description": "The theme variants to apply to the component.",
|
|
233
|
+
"value": {
|
|
234
|
+
"type": [
|
|
235
|
+
"string",
|
|
236
|
+
"null",
|
|
237
|
+
"undefined"
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
"js": {
|
|
243
|
+
"properties": [
|
|
244
|
+
{
|
|
245
|
+
"name": "disabled",
|
|
246
|
+
"description": "If true, the user cannot interact with this element.",
|
|
247
|
+
"value": {
|
|
248
|
+
"type": [
|
|
249
|
+
"boolean",
|
|
250
|
+
"null",
|
|
251
|
+
"undefined"
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"name": "label",
|
|
257
|
+
"description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
|
|
258
|
+
"value": {
|
|
259
|
+
"type": [
|
|
260
|
+
"string",
|
|
261
|
+
"null",
|
|
262
|
+
"undefined"
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"name": "invalid",
|
|
268
|
+
"description": "Set to true when the field is invalid.",
|
|
269
|
+
"value": {
|
|
270
|
+
"type": [
|
|
271
|
+
"boolean",
|
|
272
|
+
"null",
|
|
273
|
+
"undefined"
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"name": "required",
|
|
279
|
+
"description": "Specifies that the user must fill in a value.",
|
|
280
|
+
"value": {
|
|
281
|
+
"type": [
|
|
282
|
+
"boolean",
|
|
283
|
+
"null",
|
|
284
|
+
"undefined"
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"name": "errorMessage",
|
|
290
|
+
"description": "Error to show when the field is invalid.",
|
|
291
|
+
"value": {
|
|
292
|
+
"type": [
|
|
293
|
+
"string",
|
|
294
|
+
"null",
|
|
295
|
+
"undefined"
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"name": "helperText",
|
|
301
|
+
"description": "String used for the helper text.",
|
|
302
|
+
"value": {
|
|
303
|
+
"type": [
|
|
304
|
+
"string",
|
|
305
|
+
"null",
|
|
306
|
+
"undefined"
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"name": "value",
|
|
312
|
+
"description": "The value of the radio group.",
|
|
313
|
+
"value": {
|
|
314
|
+
"type": [
|
|
315
|
+
"string"
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"name": "readonly",
|
|
321
|
+
"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.",
|
|
322
|
+
"value": {
|
|
323
|
+
"type": [
|
|
324
|
+
"boolean"
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
],
|
|
329
|
+
"events": [
|
|
330
|
+
{
|
|
331
|
+
"name": "validated",
|
|
332
|
+
"description": "Fired whenever the field is validated."
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"name": "value-changed",
|
|
336
|
+
"description": "Fired when the `value` property changes."
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"name": "invalid-changed",
|
|
340
|
+
"description": "Fired when the `invalid` property changes."
|
|
341
|
+
}
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
]
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/radio-group",
|
|
4
|
+
"version": "23.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/custom-theme/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": "?checked",
|
|
31
|
+
"description": "True if the element is checked.",
|
|
32
|
+
"value": {
|
|
33
|
+
"kind": "expression"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": ".value",
|
|
38
|
+
"description": "The value of the field.",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": ".label",
|
|
45
|
+
"description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
|
|
46
|
+
"value": {
|
|
47
|
+
"kind": "expression"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": ".name",
|
|
52
|
+
"description": "The name of the radio button.",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "@value-changed",
|
|
59
|
+
"description": "Fired when the `value` property changes.",
|
|
60
|
+
"value": {
|
|
61
|
+
"kind": "expression"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "@checked-changed",
|
|
66
|
+
"description": "Fired when the `checked` property changes.",
|
|
67
|
+
"value": {
|
|
68
|
+
"kind": "expression"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "vaadin-radio-group",
|
|
75
|
+
"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/custom-theme/styling-components) documentation.",
|
|
76
|
+
"extension": true,
|
|
77
|
+
"attributes": [
|
|
78
|
+
{
|
|
79
|
+
"name": "?disabled",
|
|
80
|
+
"description": "If true, the user cannot interact with this element.",
|
|
81
|
+
"value": {
|
|
82
|
+
"kind": "expression"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "?invalid",
|
|
87
|
+
"description": "Set to true when the field is invalid.",
|
|
88
|
+
"value": {
|
|
89
|
+
"kind": "expression"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "?required",
|
|
94
|
+
"description": "Specifies that the user must fill in a value.",
|
|
95
|
+
"value": {
|
|
96
|
+
"kind": "expression"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "?readonly",
|
|
101
|
+
"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.",
|
|
102
|
+
"value": {
|
|
103
|
+
"kind": "expression"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": ".label",
|
|
108
|
+
"description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
|
|
109
|
+
"value": {
|
|
110
|
+
"kind": "expression"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": ".errorMessage",
|
|
115
|
+
"description": "Error to show when the field is invalid.",
|
|
116
|
+
"value": {
|
|
117
|
+
"kind": "expression"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"name": ".helperText",
|
|
122
|
+
"description": "String used for the helper text.",
|
|
123
|
+
"value": {
|
|
124
|
+
"kind": "expression"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": ".value",
|
|
129
|
+
"description": "The value of the radio group.",
|
|
130
|
+
"value": {
|
|
131
|
+
"kind": "expression"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "@validated",
|
|
136
|
+
"description": "Fired whenever the field is validated.",
|
|
137
|
+
"value": {
|
|
138
|
+
"kind": "expression"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "@value-changed",
|
|
143
|
+
"description": "Fired when the `value` property changes.",
|
|
144
|
+
"value": {
|
|
145
|
+
"kind": "expression"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "@invalid-changed",
|
|
150
|
+
"description": "Fired when the `invalid` property changes.",
|
|
151
|
+
"value": {
|
|
152
|
+
"kind": "expression"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|