@momentum-design/components 0.133.37 → 0.133.38

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.
@@ -121,6 +121,12 @@ declare class TabList extends TabList_base {
121
121
  */
122
122
  protected firstUpdated(): Promise<void>;
123
123
  disconnectedCallback(): void;
124
+ /**
125
+ * Override focus to delegate to the active tab.
126
+ * When a dialog focus-trap or any other caller invokes `.focus()` on the tablist host,
127
+ * focus is forwarded directly to the active tab instead of landing on the shadow host.
128
+ */
129
+ focus(options?: FocusOptions): void;
124
130
  /**
125
131
  * When the tablist receives focus, then focus the active tab.
126
132
  *
@@ -160,5 +166,13 @@ declare class TabList extends TabList_base {
160
166
  private scrollTabs;
161
167
  render(): import("lit-html").TemplateResult<1>;
162
168
  static styles: Array<CSSResult>;
169
+ static shadowRootOptions: {
170
+ delegatesFocus: boolean;
171
+ clonable?: boolean;
172
+ customElementRegistry?: CustomElementRegistry;
173
+ mode: ShadowRootMode;
174
+ serializable?: boolean;
175
+ slotAssignment?: SlotAssignmentMode;
176
+ };
163
177
  }
164
178
  export default TabList;
@@ -199,6 +199,20 @@ class TabList extends ListNavigationMixin(CaptureDestroyEventForChildElement(Key
199
199
  super.disconnectedCallback();
200
200
  (_a = this.tabsContainer) === null || _a === void 0 ? void 0 : _a.removeEventListener('focusin', this.handleFocus);
201
201
  }
202
+ /**
203
+ * Override focus to delegate to the active tab.
204
+ * When a dialog focus-trap or any other caller invokes `.focus()` on the tablist host,
205
+ * focus is forwarded directly to the active tab instead of landing on the shadow host.
206
+ */
207
+ focus(options) {
208
+ const activeTab = getActiveTab(this.navItems);
209
+ if (activeTab) {
210
+ activeTab.focus(options);
211
+ }
212
+ else {
213
+ super.focus(options);
214
+ }
215
+ }
202
216
  /**
203
217
  * When the tablist receives focus, then focus the active tab.
204
218
  *
@@ -208,7 +222,8 @@ class TabList extends ListNavigationMixin(CaptureDestroyEventForChildElement(Key
208
222
  async handleFocus(event) {
209
223
  /**
210
224
  * If the element losing focus is a tab, do nothing.
211
- * If the element gaining focus is not a tab, do nothing.
225
+ * If the element gaining focus is not a tab or the container itself (e.g., via delegatesFocus
226
+ * or a click on the container), do nothing — the focus() override handles the programmatic case.
212
227
  * This also covers the case when previous focus was on a tab that belongs to another tablist.
213
228
  */
214
229
  if (event.relatedTarget instanceof Tab || !(event.target instanceof Tab)) {
@@ -354,6 +369,7 @@ class TabList extends ListNavigationMixin(CaptureDestroyEventForChildElement(Key
354
369
  }
355
370
  }
356
371
  TabList.styles = [...Component.styles, ...styles];
372
+ TabList.shadowRootOptions = { ...Component.shadowRootOptions, delegatesFocus: true };
357
373
  __decorate([
358
374
  property({ type: String, attribute: 'data-aria-label' }),
359
375
  __metadata("design:type", String)
@@ -46644,6 +46644,26 @@
46644
46644
  "description": "Label for the tablist.\nThis is used when the tablist does not have a visible label.",
46645
46645
  "attribute": "data-aria-label"
46646
46646
  },
46647
+ {
46648
+ "kind": "method",
46649
+ "name": "focus",
46650
+ "privacy": "public",
46651
+ "return": {
46652
+ "type": {
46653
+ "text": "void"
46654
+ }
46655
+ },
46656
+ "parameters": [
46657
+ {
46658
+ "name": "options",
46659
+ "optional": true,
46660
+ "type": {
46661
+ "text": "FocusOptions"
46662
+ }
46663
+ }
46664
+ ],
46665
+ "description": "Override focus to delegate to the active tab.\nWhen a dialog focus-trap or any other caller invokes `.focus()` on the tablist host,\nfocus is forwarded directly to the active tab instead of landing on the shadow host."
46666
+ },
46647
46667
  {
46648
46668
  "kind": "method",
46649
46669
  "name": "getCurrentIndex",
@@ -46748,6 +46768,15 @@
46748
46768
  "module": "utils/mixins/ListNavigationMixin.js"
46749
46769
  }
46750
46770
  },
46771
+ {
46772
+ "kind": "field",
46773
+ "name": "shadowRootOptions",
46774
+ "type": {
46775
+ "text": "object"
46776
+ },
46777
+ "static": true,
46778
+ "default": "{ ...Component.shadowRootOptions, delegatesFocus: true }"
46779
+ },
46751
46780
  {
46752
46781
  "kind": "method",
46753
46782
  "name": "shouldLoop",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.133.37",
4
+ "version": "0.133.38",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"