@momentum-design/components 0.118.0 → 0.118.1

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.
@@ -55,6 +55,8 @@ declare class List extends List_base {
55
55
  */
56
56
  private handleDestroyEvent;
57
57
  /** @internal */
58
+ private handleModifiedEvent;
59
+ /** @internal */
58
60
  private isValidItem;
59
61
  render(): import("lit-html").TemplateResult<1>;
60
62
  static styles: Array<CSSResult>;
@@ -83,7 +83,22 @@ class List extends ListNavigationMixin(CaptureDestroyEventForChildElement(Compon
83
83
  }
84
84
  this.resetTabIndexes(newIndex);
85
85
  };
86
+ /** @internal */
87
+ this.handleModifiedEvent = (event) => {
88
+ const item = event.target;
89
+ switch (event.detail.change) {
90
+ case 'enabled':
91
+ this.itemsStore.add(item);
92
+ break;
93
+ case 'disabled':
94
+ this.itemsStore.delete(item);
95
+ break;
96
+ default:
97
+ break;
98
+ }
99
+ };
86
100
  this.addEventListener(LIFE_CYCLE_EVENTS.CREATED, this.handleCreatedEvent);
101
+ this.addEventListener(LIFE_CYCLE_EVENTS.MODIFIED, this.handleModifiedEvent);
87
102
  this.addEventListener(LIFE_CYCLE_EVENTS.DESTROYED, this.handleDestroyEvent);
88
103
  // This must be initialized after the destroyed event listener
89
104
  // to keep the element in the itemStore in order to move the focus correctly
@@ -147,12 +147,10 @@ class ListItem extends DisabledMixin(TabIndexMixin(LifeCycleMixin(Component))) {
147
147
  [...this.leadingControlsSlot, ...this.trailingControlsSlot].forEach(element => {
148
148
  if (disabled) {
149
149
  element.setAttribute('disabled', '');
150
- this.dispatchModifiedEvent('disabled');
151
150
  ListItemEventManager.onDisableListItem(this);
152
151
  }
153
152
  else {
154
153
  element.removeAttribute('disabled');
155
- this.dispatchModifiedEvent('enabled');
156
154
  ListItemEventManager.onEnableListItem(this);
157
155
  }
158
156
  });
@@ -164,6 +162,7 @@ class ListItem extends DisabledMixin(TabIndexMixin(LifeCycleMixin(Component))) {
164
162
  if (changedProperties.has('disabled')) {
165
163
  this.tabIndex = this.disabled ? -1 : 0;
166
164
  this.disableSlottedChildren(this.disabled);
165
+ this.dispatchModifiedEvent(this.disabled ? 'disabled' : 'enabled');
167
166
  }
168
167
  if (changedProperties.has('softDisabled')) {
169
168
  this.disableSlottedChildren(this.softDisabled);
@@ -258,6 +258,14 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
258
258
  }
259
259
  break;
260
260
  }
261
+ case 'enabled': {
262
+ this.itemsStore.add(option);
263
+ break;
264
+ }
265
+ case 'disabled': {
266
+ this.itemsStore.delete(option);
267
+ break;
268
+ }
261
269
  default:
262
270
  break;
263
271
  }