@vaadin/radio-group 24.0.0-alpha1 → 24.0.0-alpha11
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 +7 -7
- package/src/vaadin-radio-button.d.ts +2 -2
- package/src/vaadin-radio-button.js +27 -36
- package/src/vaadin-radio-group.d.ts +1 -1
- package/src/vaadin-radio-group.js +29 -29
- package/theme/lumo/vaadin-radio-button-styles.js +6 -7
- package/theme/material/vaadin-radio-button-styles.js +4 -7
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/radio-group",
|
|
3
|
-
"version": "24.0.0-
|
|
3
|
+
"version": "24.0.0-alpha11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@polymer/polymer": "^3.0.0",
|
|
41
|
-
"@vaadin/component-base": "24.0.0-
|
|
42
|
-
"@vaadin/field-base": "24.0.0-
|
|
43
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
44
|
-
"@vaadin/vaadin-material-styles": "24.0.0-
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
41
|
+
"@vaadin/component-base": "24.0.0-alpha11",
|
|
42
|
+
"@vaadin/field-base": "24.0.0-alpha11",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha11",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha11",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha11"
|
|
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": "
|
|
56
|
+
"gitHead": "641b3d96ceeb3e503a093682ebe686afdd8c3a68"
|
|
57
57
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2017 -
|
|
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
6
|
import { ActiveMixin } from '@vaadin/component-base/src/active-mixin.js';
|
|
7
7
|
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
8
|
+
import { DelegateFocusMixin } from '@vaadin/component-base/src/delegate-focus-mixin.js';
|
|
8
9
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
10
|
import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
|
|
10
|
-
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
11
11
|
import { LabelMixin } from '@vaadin/field-base/src/label-mixin.js';
|
|
12
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
13
|
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2017 -
|
|
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
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
7
|
import { ActiveMixin } from '@vaadin/component-base/src/active-mixin.js';
|
|
8
8
|
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
9
|
+
import { DelegateFocusMixin } from '@vaadin/component-base/src/delegate-focus-mixin.js';
|
|
9
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
11
|
import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
|
|
11
|
-
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
12
12
|
import { InputController } from '@vaadin/field-base/src/input-controller.js';
|
|
13
13
|
import { LabelMixin } from '@vaadin/field-base/src/label-mixin.js';
|
|
14
14
|
import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
|
|
15
|
-
import { SlotTargetController } from '@vaadin/field-base/src/slot-target-controller.js';
|
|
16
15
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
17
16
|
|
|
18
17
|
/**
|
|
@@ -86,35 +85,42 @@ class RadioButton extends LabelMixin(
|
|
|
86
85
|
align-items: baseline;
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
[part='radio'],
|
|
89
|
+
::slotted(input),
|
|
90
|
+
::slotted(label) {
|
|
91
|
+
grid-row: 1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[part='radio'],
|
|
95
|
+
::slotted(input) {
|
|
96
|
+
grid-column: 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
[part='radio'] {
|
|
100
|
+
width: var(--vaadin-radio-button-size, 1em);
|
|
101
|
+
height: var(--vaadin-radio-button-size, 1em);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
[part='radio']::before {
|
|
105
|
+
display: block;
|
|
106
|
+
content: '\\202F';
|
|
107
|
+
line-height: var(--vaadin-radio-button-size, 1em);
|
|
108
|
+
contain: paint;
|
|
92
109
|
}
|
|
93
110
|
|
|
94
111
|
/* visually hidden */
|
|
95
112
|
::slotted(input) {
|
|
96
|
-
position: absolute;
|
|
97
|
-
top: 0;
|
|
98
|
-
left: 0;
|
|
99
|
-
right: 0;
|
|
100
|
-
width: 100%;
|
|
101
|
-
height: 100%;
|
|
102
113
|
opacity: 0;
|
|
103
114
|
cursor: inherit;
|
|
104
115
|
margin: 0;
|
|
116
|
+
align-self: stretch;
|
|
117
|
+
-webkit-appearance: none;
|
|
105
118
|
}
|
|
106
119
|
</style>
|
|
107
120
|
<div class="vaadin-radio-button-container">
|
|
108
|
-
<div
|
|
109
|
-
|
|
110
|
-
<slot name="input"></slot>
|
|
111
|
-
</div>
|
|
112
|
-
|
|
121
|
+
<div part="radio"></div>
|
|
122
|
+
<slot name="input"></slot>
|
|
113
123
|
<slot name="label"></slot>
|
|
114
|
-
|
|
115
|
-
<div style="display: none !important">
|
|
116
|
-
<slot id="noop"></slot>
|
|
117
|
-
</div>
|
|
118
124
|
</div>
|
|
119
125
|
`;
|
|
120
126
|
}
|
|
@@ -161,21 +167,6 @@ class RadioButton extends LabelMixin(
|
|
|
161
167
|
}),
|
|
162
168
|
);
|
|
163
169
|
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
164
|
-
this.addController(
|
|
165
|
-
new SlotTargetController(
|
|
166
|
-
this.$.noop,
|
|
167
|
-
() => this._labelController.node,
|
|
168
|
-
() => this.__warnDeprecated(),
|
|
169
|
-
),
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/** @private */
|
|
174
|
-
__warnDeprecated() {
|
|
175
|
-
console.warn(
|
|
176
|
-
`WARNING: Since Vaadin 22, placing the label as a direct child of a <vaadin-radio-button> is deprecated.
|
|
177
|
-
Please use <label slot="label"> wrapper or the label property instead.`,
|
|
178
|
-
);
|
|
179
170
|
}
|
|
180
171
|
}
|
|
181
172
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2017 -
|
|
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
6
|
import { DisabledMixin } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2017 -
|
|
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
6
|
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
@@ -169,6 +169,34 @@ class RadioGroup extends FieldMixin(
|
|
|
169
169
|
this.__onRadioButtonCheckedChange = this.__onRadioButtonCheckedChange.bind(this);
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
/**
|
|
173
|
+
* A collection of the group's radio buttons.
|
|
174
|
+
*
|
|
175
|
+
* @return {!Array<!RadioButton>}
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
get __radioButtons() {
|
|
179
|
+
return this.__filterRadioButtons([...this.children]);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* A currently selected radio button.
|
|
184
|
+
*
|
|
185
|
+
* @return {!RadioButton | undefined}
|
|
186
|
+
* @private
|
|
187
|
+
*/
|
|
188
|
+
get __selectedRadioButton() {
|
|
189
|
+
return this.__radioButtons.find((radioButton) => radioButton.checked);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @return {boolean}
|
|
194
|
+
* @private
|
|
195
|
+
*/
|
|
196
|
+
get isHorizontalRTL() {
|
|
197
|
+
return this.__isRTL && this._theme !== 'vertical';
|
|
198
|
+
}
|
|
199
|
+
|
|
172
200
|
/** @protected */
|
|
173
201
|
ready() {
|
|
174
202
|
super.ready();
|
|
@@ -202,34 +230,6 @@ class RadioGroup extends FieldMixin(
|
|
|
202
230
|
return nodes.filter((child) => child instanceof RadioButton);
|
|
203
231
|
}
|
|
204
232
|
|
|
205
|
-
/**
|
|
206
|
-
* A collection of the group's radio buttons.
|
|
207
|
-
*
|
|
208
|
-
* @return {!Array<!RadioButton>}
|
|
209
|
-
* @private
|
|
210
|
-
*/
|
|
211
|
-
get __radioButtons() {
|
|
212
|
-
return this.__filterRadioButtons([...this.children]);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* A currently selected radio button.
|
|
217
|
-
*
|
|
218
|
-
* @return {!RadioButton | undefined}
|
|
219
|
-
* @private
|
|
220
|
-
*/
|
|
221
|
-
get __selectedRadioButton() {
|
|
222
|
-
return this.__radioButtons.find((radioButton) => radioButton.checked);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* @return {boolean}
|
|
227
|
-
* @private
|
|
228
|
-
*/
|
|
229
|
-
get isHorizontalRTL() {
|
|
230
|
-
return this.getAttribute('dir') === 'rtl' && this._theme !== 'vertical';
|
|
231
|
-
}
|
|
232
|
-
|
|
233
233
|
/**
|
|
234
234
|
* Override method inherited from `KeyboardMixin`
|
|
235
235
|
* to implement the custom keyboard navigation as a replacement for the native one
|
|
@@ -21,34 +21,33 @@ registerStyles(
|
|
|
21
21
|
user-select: none;
|
|
22
22
|
cursor: default;
|
|
23
23
|
outline: none;
|
|
24
|
+
--_radio-button-size: var(--vaadin-radio-button-size, calc(var(--lumo-size-m) / 2));
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
:host([has-label]) ::slotted(label) {
|
|
27
|
-
padding: var(--lumo-space-xs)
|
|
28
|
+
padding-block: var(--lumo-space-xs);
|
|
29
|
+
padding-inline: var(--lumo-space-xs) var(--lumo-space-s);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
[part='radio'] {
|
|
31
|
-
width:
|
|
32
|
-
height:
|
|
33
|
+
width: var(--_radio-button-size);
|
|
34
|
+
height: var(--_radio-button-size);
|
|
33
35
|
margin: var(--lumo-space-xs);
|
|
34
36
|
position: relative;
|
|
35
37
|
border-radius: 50%;
|
|
36
38
|
background-color: var(--lumo-contrast-20pct);
|
|
37
39
|
transition: transform 0.2s cubic-bezier(0.12, 0.32, 0.54, 2), background-color 0.15s;
|
|
38
40
|
will-change: transform;
|
|
39
|
-
line-height: 1.2;
|
|
40
41
|
cursor: var(--lumo-clickable-cursor);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/* Used for activation "halo" */
|
|
44
45
|
[part='radio']::before {
|
|
45
|
-
/* Needed to align the radio-button nicely on the baseline */
|
|
46
|
-
content: '\\2003';
|
|
47
46
|
pointer-events: none;
|
|
48
47
|
color: transparent;
|
|
49
|
-
display: inline-block;
|
|
50
48
|
width: 100%;
|
|
51
49
|
height: 100%;
|
|
50
|
+
line-height: var(--_radio-button-size);
|
|
52
51
|
border-radius: inherit;
|
|
53
52
|
background-color: inherit;
|
|
54
53
|
transform: scale(1.4);
|
|
@@ -11,6 +11,7 @@ registerStyles(
|
|
|
11
11
|
user-select: none;
|
|
12
12
|
outline: none;
|
|
13
13
|
-webkit-tap-highlight-color: transparent;
|
|
14
|
+
--_radio-button-size: var(--vaadin-radio-button-size, 16px);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
:host([has-label]) ::slotted(label) {
|
|
@@ -18,9 +19,8 @@ registerStyles(
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
[part='radio'] {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
height: 16px;
|
|
22
|
+
width: var(--_radio-button-size);
|
|
23
|
+
height: var(--_radio-button-size);
|
|
24
24
|
margin: 4px;
|
|
25
25
|
position: relative;
|
|
26
26
|
border: 2px solid;
|
|
@@ -28,18 +28,15 @@ registerStyles(
|
|
|
28
28
|
background-color: transparent;
|
|
29
29
|
transition: transform 0.2s cubic-bezier(0.12, 0.32, 0.54, 2), background-color 0.15s;
|
|
30
30
|
will-change: transform;
|
|
31
|
-
line-height: 1.2;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
/* Used for activation "halo" */
|
|
35
34
|
[part='radio']::before {
|
|
36
|
-
/* Needed to align the radio-button nicely on the baseline */
|
|
37
|
-
content: '\\2003';
|
|
38
35
|
pointer-events: none;
|
|
39
36
|
color: transparent;
|
|
40
|
-
display: inline-block;
|
|
41
37
|
width: 100%;
|
|
42
38
|
height: 100%;
|
|
39
|
+
line-height: var(--_radio-button-size);
|
|
43
40
|
border-radius: inherit;
|
|
44
41
|
background-color: var(--material-primary-color);
|
|
45
42
|
transform: scale(2.5);
|
package/web-types.json
CHANGED
package/web-types.lit.json
CHANGED