@vaadin/radio-group 23.0.0-alpha2 → 23.0.0-beta1

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": "23.0.0-alpha2",
3
+ "version": "23.0.0-beta1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -18,6 +18,7 @@
18
18
  },
19
19
  "main": "vaadin-radio-group.js",
20
20
  "module": "vaadin-radio-group.js",
21
+ "type": "module",
21
22
  "files": [
22
23
  "src",
23
24
  "theme",
@@ -35,16 +36,16 @@
35
36
  ],
36
37
  "dependencies": {
37
38
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/component-base": "23.0.0-alpha2",
39
- "@vaadin/field-base": "23.0.0-alpha2",
40
- "@vaadin/vaadin-lumo-styles": "23.0.0-alpha2",
41
- "@vaadin/vaadin-material-styles": "23.0.0-alpha2",
42
- "@vaadin/vaadin-themable-mixin": "23.0.0-alpha2"
39
+ "@vaadin/component-base": "23.0.0-beta1",
40
+ "@vaadin/field-base": "23.0.0-beta1",
41
+ "@vaadin/vaadin-lumo-styles": "23.0.0-beta1",
42
+ "@vaadin/vaadin-material-styles": "23.0.0-beta1",
43
+ "@vaadin/vaadin-themable-mixin": "23.0.0-beta1"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@esm-bundle/chai": "^4.3.4",
46
47
  "@vaadin/testing-helpers": "^0.3.2",
47
48
  "sinon": "^9.2.1"
48
49
  },
49
- "gitHead": "070f586dead02ca41b66717820c647f48bf1665f"
50
+ "gitHead": "467244b76021176c109df675799b07029b293e58"
50
51
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2022 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';
@@ -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
  /**
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2022 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';
@@ -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,45 +148,35 @@ 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
- ready() {
177
- super.ready();
152
+ connectedCallback() {
153
+ super.connectedCallback();
178
154
 
179
- this.addController(
180
- new InputController(this, (input) => {
155
+ if (!this._inputController) {
156
+ this._inputController = new InputController(this, (input) => {
181
157
  this._setInputElement(input);
182
158
  this._setFocusElement(input);
183
159
  this.stateTarget = input;
184
160
  this.ariaTarget = input;
185
- })
161
+ });
162
+ this.addController(this._inputController);
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
+ );
171
+ }
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.`
186
179
  );
187
- this.addController(new LabelledInputController(this.inputElement, this._labelNode));
188
180
  }
189
181
  }
190
182
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2022 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) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2022 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';
@@ -295,7 +295,7 @@ class RadioGroup extends FieldMixin(
295
295
  radioButton.name = this._fieldName;
296
296
  radioButton.addEventListener('checked-changed', this.__onRadioButtonCheckedChange);
297
297
 
298
- if (this.disabled) {
298
+ if (this.disabled || this.readonly) {
299
299
  radioButton.disabled = true;
300
300
  }
301
301