@gradio/tabs 0.2.2 → 0.2.4

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,18 @@
1
1
  # @gradio/tabs
2
2
 
3
+ ## 0.2.4
4
+
5
+ ### Fixes
6
+
7
+ - [#7470](https://github.com/gradio-app/gradio/pull/7470) [`ba3ec13`](https://github.com/gradio-app/gradio/commit/ba3ec1300e81e64be7389d759b89284c66473158) - Tab select fix. Thanks [@aliabid94](https://github.com/aliabid94)!
8
+
9
+ ## 0.2.3
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`065c5b1`](https://github.com/gradio-app/gradio/commit/065c5b163c4badb9d9cbd06d627fb4ba086003e7)]:
14
+ - @gradio/utils@0.3.0
15
+
3
16
  ## 0.2.2
4
17
 
5
18
  ### Patch Changes
@@ -102,4 +115,4 @@ Thanks [@pngwn](https://github.com/pngwn)!
102
115
  ### Patch Changes
103
116
 
104
117
  - Updated dependencies []:
105
- - @gradio/utils@0.0.2
118
+ - @gradio/utils@0.0.2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/tabs",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
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.2"
16
+ "@gradio/utils": "^0.3.0"
17
17
  }
18
18
  }
@@ -31,11 +31,12 @@
31
31
 
32
32
  setContext(TABS, {
33
33
  register_tab: (tab: Tab) => {
34
+ let index: number;
34
35
  let existingTab = tabs.find((t) => t.id === tab.id);
35
36
  if (existingTab) {
36
37
  // update existing tab with newer values
37
- let i = tabs.findIndex((t) => t.id === tab.id);
38
- tabs[i] = { ...tabs[i], ...tab };
38
+ index = tabs.findIndex((t) => t.id === tab.id);
39
+ tabs[index] = { ...tabs[index], ...tab };
39
40
  } else {
40
41
  tabs.push({
41
42
  name: tab.name,
@@ -44,6 +45,7 @@
44
45
  visible: tab.visible,
45
46
  interactive: tab.interactive
46
47
  });
48
+ index = tabs.length - 1;
47
49
  }
48
50
  selected_tab.update((current) => {
49
51
  if (current === false && tab.visible && tab.interactive) {
@@ -54,7 +56,7 @@
54
56
  return nextTab ? nextTab.id : current;
55
57
  });
56
58
  tabs = tabs;
57
- return tabs.length - 1;
59
+ return index;
58
60
  },
59
61
  unregister_tab: (tab: Tab) => {
60
62
  const i = tabs.findIndex((t) => t.id === tab.id);