@momentum-design/components 0.102.5 → 0.102.7

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.
@@ -54,12 +54,6 @@ declare class Radio extends Radio_base implements AssociatedFormControl {
54
54
  * Returns all radios within the same group (name).
55
55
  */
56
56
  private getAllRadiosWithinSameGroup;
57
- /**
58
- * The 'change' event does not bubble up through the shadow DOM as it was not composed.
59
- * Therefore, we need to re-dispatch the same event to ensure it is propagated correctly.
60
- * Read more: https://developer.mozilla.org/en-US/docs/Web/API/Event/composed
61
- */
62
- private dispatchChangeEvent;
63
57
  /** @internal */
64
58
  formResetCallback(): void;
65
59
  /** @internal */
@@ -92,7 +86,6 @@ declare class Radio extends Radio_base implements AssociatedFormControl {
92
86
  *
93
87
  * @param enabledRadios - An array of enabled radio buttons within the same group.
94
88
  * @param index - The index of the radio button to be updated within the enabled radios array.
95
- * @param event - The event that triggered the update.
96
89
  */
97
90
  private updateRadio;
98
91
  /**
@@ -86,15 +86,6 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
86
86
  getAllRadiosWithinSameGroup() {
87
87
  return Array.from(document.querySelectorAll(`mdc-radio[name="${this.name}"]`));
88
88
  }
89
- /**
90
- * The 'change' event does not bubble up through the shadow DOM as it was not composed.
91
- * Therefore, we need to re-dispatch the same event to ensure it is propagated correctly.
92
- * Read more: https://developer.mozilla.org/en-US/docs/Web/API/Event/composed
93
- */
94
- dispatchChangeEvent(event) {
95
- const EventConstructor = event.constructor;
96
- this.dispatchEvent(new EventConstructor(event.type, event));
97
- }
98
89
  /** @internal */
99
90
  formResetCallback() {
100
91
  const radios = this.getAllRadiosWithinSameGroup();
@@ -183,7 +174,7 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
183
174
  * This will toggle the state of the radio element.
184
175
  * Dispatches the change event.
185
176
  */
186
- handleChange(event) {
177
+ handleChange() {
187
178
  var _a;
188
179
  if (this.disabled || this.readonly)
189
180
  return;
@@ -204,7 +195,7 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
204
195
  if (inputElement) {
205
196
  inputElement.checked = true;
206
197
  }
207
- this.dispatchChangeEvent(event);
198
+ this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
208
199
  }
209
200
  /**
210
201
  * Updates the state of the radio button at the specified index within the enabled radios.
@@ -212,12 +203,11 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
212
203
  *
213
204
  * @param enabledRadios - An array of enabled radio buttons within the same group.
214
205
  * @param index - The index of the radio button to be updated within the enabled radios array.
215
- * @param event - The event that triggered the update.
216
206
  */
217
- updateRadio(enabledRadios, index, event) {
207
+ updateRadio(enabledRadios, index) {
218
208
  var _a, _b;
219
209
  (_b = (_a = enabledRadios[index].shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === null || _b === void 0 ? void 0 : _b.focus();
220
- enabledRadios[index].handleChange(event);
210
+ enabledRadios[index].handleChange();
221
211
  }
222
212
  /**
223
213
  * Handles the keydown event (Arrow Up/Down/Left/Right) on the radio element.
@@ -232,15 +222,15 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
232
222
  if (['ArrowDown', 'ArrowRight'].includes(event.key)) {
233
223
  // Move focus to the next radio
234
224
  const nextIndex = (currentIndex + 1) % enabledRadios.length;
235
- this.updateRadio(enabledRadios, nextIndex, event);
225
+ this.updateRadio(enabledRadios, nextIndex);
236
226
  }
237
227
  else if (['ArrowUp', 'ArrowLeft'].includes(event.key)) {
238
228
  // Move focus to the previous radio
239
229
  const prevIndex = (currentIndex - 1 + enabledRadios.length) % enabledRadios.length;
240
- this.updateRadio(enabledRadios, prevIndex, event);
230
+ this.updateRadio(enabledRadios, prevIndex);
241
231
  }
242
232
  else if (event.key === KEYS.SPACE) {
243
- this.updateRadio(enabledRadios, currentIndex, event);
233
+ this.updateRadio(enabledRadios, currentIndex);
244
234
  }
245
235
  this.updateTabIndex();
246
236
  if (event.key === KEYS.ENTER) {