@gradio/tabs 0.2.0 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @gradio/tabs
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Fixes
6
+
7
+ - [#7107](https://github.com/gradio-app/gradio/pull/7107) [`80f8fbf`](https://github.com/gradio-app/gradio/commit/80f8fbf0e8900627b9c2575bbd7c68fad8108544) - Add logic to handle non-interactive or hidden tabs. Thanks [@hannahblair](https://github.com/hannahblair)!
8
+
3
9
  ## 0.2.0
4
10
 
5
11
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/tabs",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -13,6 +13,6 @@
13
13
  "./package.json": "./package.json"
14
14
  },
15
15
  "dependencies": {
16
- "@gradio/utils": "^0.2.0"
16
+ "@gradio/utils": "^0.2.1"
17
17
  }
18
18
  }
@@ -68,13 +68,22 @@
68
68
  });
69
69
 
70
70
  function change_tab(id: object | string | number): void {
71
- selected = id;
72
- $selected_tab = id;
73
- $selected_tab_index = tabs.findIndex((t) => t.id === id);
74
- dispatch("change");
71
+ const tab_to_activate = tabs.find((t) => t.id === id);
72
+ if (
73
+ tab_to_activate &&
74
+ tab_to_activate.interactive &&
75
+ tab_to_activate.visible
76
+ ) {
77
+ selected = id;
78
+ $selected_tab = id;
79
+ $selected_tab_index = tabs.findIndex((t) => t.id === id);
80
+ dispatch("change");
81
+ } else {
82
+ console.warn("Attempted to select a non-interactive or hidden tab.");
83
+ }
75
84
  }
76
85
 
77
- $: selected !== null && change_tab(selected);
86
+ $: tabs, selected !== null && change_tab(selected);
78
87
  </script>
79
88
 
80
89
  <div class="tabs {elem_classes.join(' ')}" class:hide={!visible} id={elem_id}>