@apia/components 4.0.29 → 4.0.30

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/dist/index.d.ts CHANGED
@@ -423,6 +423,12 @@ type TTabLabelRenderer = (props: {
423
423
  }) => React__default.ReactElement;
424
424
  type TTabsListState<TabType extends TTab> = {
425
425
  isMultiple: boolean;
426
+ /**
427
+ * By default, any customEvents.focus occurred inside the tab render will cause the tab to be opened.
428
+ *
429
+ * If listenFocusEvents=false, the customEvents.focus events will be ignored.
430
+ */
431
+ listenFocusEvents?: boolean;
426
432
  openTabsHistory: Set<Tab<TabType>>;
427
433
  /**
428
434
  * If this property is true, then it could never happen that all tabs are closed.
package/dist/index.js CHANGED
@@ -2022,7 +2022,8 @@ class TabsController {
2022
2022
  openTabsHistory: /* @__PURE__ */ new Set(),
2023
2023
  tabs: /* @__PURE__ */ new Map(),
2024
2024
  timestamp: 0,
2025
- showAtLeastOneTab: false
2025
+ showAtLeastOneTab: false,
2026
+ listenFocusEvents: true
2026
2027
  });
2027
2028
  Object.assign(this.state, props.initialState ?? {});
2028
2029
  props.initialTabs?.forEach((tab) => this.append(tab));
@@ -2338,7 +2339,9 @@ const InnerRenderer = observer(({ tab }) => {
2338
2339
  uns.current();
2339
2340
  if (el instanceof HTMLElement) {
2340
2341
  const handleFocus = () => {
2341
- tab.open();
2342
+ if (tab.controller.state.listenFocusEvents !== false) {
2343
+ tab.open();
2344
+ }
2342
2345
  };
2343
2346
  el.addEventListener(customEvents.focus, handleFocus);
2344
2347
  uns.current = () => {