@vaadin/radio-group 24.0.0-alpha9 → 24.0.0-beta2

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.0.0-alpha9",
3
+ "version": "24.0.0-beta2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,20 +38,20 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@polymer/polymer": "^3.0.0",
41
- "@vaadin/component-base": "24.0.0-alpha9",
42
- "@vaadin/field-base": "24.0.0-alpha9",
43
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha9",
44
- "@vaadin/vaadin-material-styles": "24.0.0-alpha9",
45
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha9"
41
+ "@vaadin/component-base": "24.0.0-beta2",
42
+ "@vaadin/field-base": "24.0.0-beta2",
43
+ "@vaadin/vaadin-lumo-styles": "24.0.0-beta2",
44
+ "@vaadin/vaadin-material-styles": "24.0.0-beta2",
45
+ "@vaadin/vaadin-themable-mixin": "24.0.0-beta2"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@esm-bundle/chai": "^4.3.4",
49
- "@vaadin/testing-helpers": "^0.3.2",
49
+ "@vaadin/testing-helpers": "^0.4.0",
50
50
  "sinon": "^13.0.2"
51
51
  },
52
52
  "web-types": [
53
53
  "web-types.json",
54
54
  "web-types.lit.json"
55
55
  ],
56
- "gitHead": "cc3f747164041566b300bde4b105d2475649e93f"
56
+ "gitHead": "00086f1f6d487f042f189c9b9ecd7ba736960888"
57
57
  }
@@ -85,30 +85,41 @@ class RadioButton extends LabelMixin(
85
85
  align-items: baseline;
86
86
  }
87
87
 
88
- .vaadin-radio-button-wrapper {
89
- position: relative;
90
- height: 100%;
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;
91
109
  }
92
110
 
93
111
  /* visually hidden */
94
112
  ::slotted(input) {
95
- position: absolute;
96
- top: 0;
97
- left: 0;
98
- right: 0;
99
- width: 100%;
100
- height: 100%;
101
113
  opacity: 0;
102
114
  cursor: inherit;
103
115
  margin: 0;
116
+ align-self: stretch;
117
+ -webkit-appearance: none;
104
118
  }
105
119
  </style>
106
120
  <div class="vaadin-radio-button-container">
107
- <div class="vaadin-radio-button-wrapper">
108
- <div part="radio"></div>
109
- <slot name="input"></slot>
110
- </div>
111
-
121
+ <div part="radio" aria-hidden="true"></div>
122
+ <slot name="input"></slot>
112
123
  <slot name="label"></slot>
113
124
  </div>
114
125
  `;
@@ -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.__isRTL && 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) var(--lumo-space-s) var(--lumo-space-xs) 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: calc(var(--lumo-size-m) / 2);
32
- height: calc(var(--lumo-size-m) / 2);
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
- display: inline-block;
22
- width: 16px;
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/radio-group",
4
- "version": "24.0.0-alpha9",
4
+ "version": "24.0.0-beta2",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/radio-group",
4
- "version": "24.0.0-alpha9",
4
+ "version": "24.0.0-beta2",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {