@vaadin/radio-group 22.0.3 → 22.0.6

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": "22.0.3",
3
+ "version": "22.0.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,16 +35,16 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/component-base": "^22.0.3",
39
- "@vaadin/field-base": "^22.0.3",
40
- "@vaadin/vaadin-lumo-styles": "^22.0.3",
41
- "@vaadin/vaadin-material-styles": "^22.0.3",
42
- "@vaadin/vaadin-themable-mixin": "^22.0.3"
38
+ "@vaadin/component-base": "^22.0.6",
39
+ "@vaadin/field-base": "^22.0.6",
40
+ "@vaadin/vaadin-lumo-styles": "^22.0.6",
41
+ "@vaadin/vaadin-material-styles": "^22.0.6",
42
+ "@vaadin/vaadin-themable-mixin": "^22.0.6"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@esm-bundle/chai": "^4.3.4",
46
46
  "@vaadin/testing-helpers": "^0.3.2",
47
47
  "sinon": "^9.2.1"
48
48
  },
49
- "gitHead": "935ad1ea65a79b0f9ecb10d767689479b36c4e07"
49
+ "gitHead": "18c55872d764e338e0f98e65826cbe895156251a"
50
50
  }
@@ -8,7 +8,7 @@ import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js'
8
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
9
  import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
10
10
  import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
11
- import { SlotLabelMixin } from '@vaadin/field-base/src/slot-label-mixin.js';
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
 
14
14
  /**
@@ -57,7 +57,7 @@ export interface RadioButtonEventMap extends HTMLElementEventMap, RadioButtonCus
57
57
  *
58
58
  * @fires {CustomEvent} checked-changed - Fired when the `checked` property changes.
59
59
  */
60
- declare class RadioButton extends SlotLabelMixin(
60
+ declare class RadioButton extends LabelMixin(
61
61
  CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement))))))
62
62
  ) {
63
63
  /**
@@ -10,8 +10,9 @@ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
10
10
  import { CheckedMixin } from '@vaadin/field-base/src/checked-mixin.js';
11
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
+ import { LabelMixin } from '@vaadin/field-base/src/label-mixin.js';
13
14
  import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
14
- import { SlotLabelMixin } from '@vaadin/field-base/src/slot-label-mixin.js';
15
+ import { SlotTargetController } from '@vaadin/field-base/src/slot-target-controller.js';
15
16
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
16
17
 
17
18
  /**
@@ -55,9 +56,9 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
55
56
  * @mixes ElementMixin
56
57
  * @mixes ActiveMixin
57
58
  * @mixes CheckedMixin
58
- * @mixes SlotLabelMixin
59
+ * @mixes LabelMixin
59
60
  */
60
- class RadioButton extends SlotLabelMixin(
61
+ class RadioButton extends LabelMixin(
61
62
  CheckedMixin(DelegateFocusMixin(ActiveMixin(ElementMixin(ThemableMixin(ControllerMixin(PolymerElement))))))
62
63
  ) {
63
64
  static get is() {
@@ -80,13 +81,14 @@ class RadioButton extends SlotLabelMixin(
80
81
  }
81
82
 
82
83
  .vaadin-radio-button-container {
83
- display: inline-flex;
84
+ display: grid;
85
+ grid-template-columns: auto 1fr;
84
86
  align-items: baseline;
85
87
  }
86
88
 
87
89
  .vaadin-radio-button-wrapper {
88
90
  position: relative;
89
- flex: none;
91
+ height: 100%;
90
92
  }
91
93
 
92
94
  /* visually hidden */
@@ -146,32 +148,6 @@ class RadioButton extends SlotLabelMixin(
146
148
  this.value = 'on';
147
149
  }
148
150
 
149
- /**
150
- * A reference to the default slot from which nodes are copied to the label node.
151
- *
152
- * @override
153
- * @protected
154
- * @type {HTMLSlotElement}
155
- */
156
- get _sourceSlot() {
157
- return this.$.noop;
158
- }
159
-
160
- /**
161
- * Override __copyNodesToSlotTarget from SlotTargetMixin to show a warning.
162
- * @override
163
- * @protected
164
- * @param {!Array<!Node>} nodes
165
- **/
166
- __copyNodesToSlotTarget(nodes) {
167
- super.__copyNodesToSlotTarget(nodes);
168
-
169
- console.warn(
170
- `WARNING: Since Vaadin 22, placing the label as a direct child of a <vaadin-radio-button> is deprecated.
171
- Please use <label slot="label"> wrapper or the label property instead.`
172
- );
173
- }
174
-
175
151
  /** @protected */
176
152
  connectedCallback() {
177
153
  super.connectedCallback();
@@ -185,8 +161,23 @@ class RadioButton extends SlotLabelMixin(
185
161
  });
186
162
  this.addController(this._inputController);
187
163
  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
+ );
188
171
  }
189
172
  }
173
+
174
+ /** @private */
175
+ __warnDeprecated() {
176
+ console.warn(
177
+ `WARNING: Since Vaadin 22, placing the label as a direct child of a <vaadin-radio-button> is deprecated.
178
+ Please use <label slot="label"> wrapper or the label property instead.`
179
+ );
180
+ }
190
181
  }
191
182
 
192
183
  customElements.define(RadioButton.is, RadioButton);
@@ -293,7 +293,7 @@ class RadioGroup extends FieldMixin(FocusMixin(DisabledMixin(KeyboardMixin(DirMi
293
293
  radioButton.name = this._fieldName;
294
294
  radioButton.addEventListener('checked-changed', this.__onRadioButtonCheckedChange);
295
295
 
296
- if (this.disabled) {
296
+ if (this.disabled || this.readonly) {
297
297
  radioButton.disabled = true;
298
298
  }
299
299