@gradio/tabs 0.2.0 → 0.2.2

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,16 +1,29 @@
1
1
  # @gradio/tabs
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`fdd1521`](https://github.com/gradio-app/gradio/commit/fdd15213c24b9cbc58bbc1b6beb4af7c18f48557)]:
8
+ - @gradio/utils@0.2.2
9
+
10
+ ## 0.2.1
11
+
12
+ ### Fixes
13
+
14
+ - [#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)!
15
+
3
16
  ## 0.2.0
4
17
 
5
18
  ### Features
6
19
 
7
- - [#7018](https://github.com/gradio-app/gradio/pull/7018) [`ec28b4e`](https://github.com/gradio-app/gradio/commit/ec28b4e7c47a9233d9e3a725cc9fe8f9044dfa94) - Add `visible` and `interactive` params to `gr.Tab()`. Thanks [@hannahblair](https://github.com/hannahblair)!
20
+ - [#7018](https://github.com/gradio-app/gradio/pull/7018) [`ec28b4e`](https://github.com/gradio-app/gradio/commit/ec28b4e7c47a9233d9e3a725cc9fe8f9044dfa94) - Add `visible` and `interactive` params to `gr.Tab()`. Thanks [@hannahblair](https://github.com/hannahblair)!
8
21
 
9
22
  ## 0.1.0
10
23
 
11
24
  ### Features
12
25
 
13
- - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Publish all components to npm. Thanks [@pngwn](https://github.com/pngwn)!
26
+ - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Publish all components to npm. Thanks [@pngwn](https://github.com/pngwn)!
14
27
 
15
28
  ## 0.1.0-beta.8
16
29
 
@@ -89,4 +102,4 @@ Thanks [@pngwn](https://github.com/pngwn)!
89
102
  ### Patch Changes
90
103
 
91
104
  - Updated dependencies []:
92
- - @gradio/utils@0.0.2
105
+ - @gradio/utils@0.0.2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/tabs",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
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.2"
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}>