@gradio/tabs 0.0.6-beta.4 → 0.0.6-beta.5

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.0.6-beta.5
4
+
5
+ ### Features
6
+
7
+ - [#5590](https://github.com/gradio-app/gradio/pull/5590) [`d1ad1f671`](https://github.com/gradio-app/gradio/commit/d1ad1f671caef9f226eb3965f39164c256d8615c) - Attach `elem_classes` selectors to layout elements, and an id to the Tab button (for targeting via CSS/JS). Thanks [@abidlabs](https://github.com/abidlabs)!
8
+
3
9
  ## 0.0.6-beta.4
4
10
 
5
11
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/tabs",
3
- "version": "0.0.6-beta.4",
3
+ "version": "0.0.6-beta.5",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "main": "./static/index.ts",
@@ -10,6 +10,7 @@
10
10
  interface Tab {
11
11
  name: string;
12
12
  id: object;
13
+ elem_id: string | undefined;
13
14
  }
14
15
 
15
16
  export let visible = true;
@@ -28,7 +29,7 @@
28
29
 
29
30
  setContext(TABS, {
30
31
  register_tab: (tab: Tab) => {
31
- tabs.push({ name: tab.name, id: tab.id });
32
+ tabs.push({ name: tab.name, id: tab.id, elem_id: tab.elem_id });
32
33
  selected_tab.update((current) => current ?? tab.id);
33
34
  tabs = tabs;
34
35
  return tabs.length - 1;
@@ -58,11 +59,12 @@
58
59
  <div class="tab-nav scroll-hide">
59
60
  {#each tabs as t, i (t.id)}
60
61
  {#if t.id === $selected_tab}
61
- <button class="selected">
62
+ <button class="selected" id={t.elem_id ? t.elem_id + "-button" : null}>
62
63
  {t.name}
63
64
  </button>
64
65
  {:else}
65
66
  <button
67
+ id={t.elem_id ? t.elem_id + "-button" : null}
66
68
  on:click={() => {
67
69
  change_tab(t.id);
68
70
  dispatch("select", { value: t.name, index: i });