@vaadin/radio-group 23.1.2 → 23.2.0-alpha3

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.1.2",
3
+ "version": "23.2.0-alpha3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,16 +36,16 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/component-base": "^23.1.2",
40
- "@vaadin/field-base": "^23.1.2",
41
- "@vaadin/vaadin-lumo-styles": "^23.1.2",
42
- "@vaadin/vaadin-material-styles": "^23.1.2",
43
- "@vaadin/vaadin-themable-mixin": "^23.1.2"
39
+ "@vaadin/component-base": "23.2.0-alpha3",
40
+ "@vaadin/field-base": "23.2.0-alpha3",
41
+ "@vaadin/vaadin-lumo-styles": "23.2.0-alpha3",
42
+ "@vaadin/vaadin-material-styles": "23.2.0-alpha3",
43
+ "@vaadin/vaadin-themable-mixin": "23.2.0-alpha3"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@esm-bundle/chai": "^4.3.4",
47
47
  "@vaadin/testing-helpers": "^0.3.2",
48
48
  "sinon": "^13.0.2"
49
49
  },
50
- "gitHead": "6fb205c6e9a761feadfb779dd5d7af96d3102e56"
50
+ "gitHead": "06e5875be93ca50da2846dafc65a8531010c0576"
51
51
  }
@@ -149,26 +149,25 @@ class RadioButton extends LabelMixin(
149
149
  }
150
150
 
151
151
  /** @protected */
152
- connectedCallback() {
153
- super.connectedCallback();
152
+ ready() {
153
+ super.ready();
154
154
 
155
- if (!this._inputController) {
156
- this._inputController = new InputController(this, (input) => {
155
+ this.addController(
156
+ new InputController(this, (input) => {
157
157
  this._setInputElement(input);
158
158
  this._setFocusElement(input);
159
159
  this.stateTarget = input;
160
160
  this.ariaTarget = input;
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
- }
161
+ }),
162
+ );
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
+ );
172
171
  }
173
172
 
174
173
  /** @private */
@@ -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 {}
@@ -68,6 +75,7 @@ export interface RadioGroupEventMap extends HTMLElementEventMap, RadioGroupCusto
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))))),
@@ -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 { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
12
13
  import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
13
14
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
15
  import { RadioButton } from './vaadin-radio-button.js';
@@ -53,6 +54,7 @@ import { RadioButton } from './vaadin-radio-button.js';
53
54
  *
54
55
  * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
55
56
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
57
+ * @fires {CustomEvent} validated - Fired whenever the field is validated.
56
58
  *
57
59
  * @extends HTMLElement
58
60
  * @mixes ThemableMixin
@@ -172,9 +174,7 @@ class RadioGroup extends FieldMixin(
172
174
  // See https://github.com/vaadin/vaadin-web-components/issues/94
173
175
  this.setAttribute('role', 'radiogroup');
174
176
 
175
- // Ensure every instance has unique id
176
- const uniqueId = (RadioGroup._uniqueRadioGroupId = 1 + RadioGroup._uniqueRadioGroupId || 0);
177
- this._fieldName = `${this.localName}-${uniqueId}`;
177
+ this._fieldName = `${this.localName}-${generateUniqueId()}`;
178
178
 
179
179
  this._observer = new FlattenedNodesObserver(this, ({ addedNodes, removedNodes }) => {
180
180
  // Registers the added radio buttons in the reverse order