@gradio/tabitem 0.8.2 → 0.9.0

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,34 @@
1
1
  # @gradio/tabitem
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Features
6
+
7
+ - [#13851](https://github.com/gradio-app/gradio/pull/13851) [`afffecc`](https://github.com/gradio-app/gradio/commit/afffeccf69262a8070a091b50206c1e33b8c06c4) - Add configurable tab overflow and alignment. Thanks @abidlabs!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/utils@0.14.2
12
+ - @gradio/tabs@0.11.0
13
+
14
+ ## 0.8.3
15
+
16
+ ### Dependency updates
17
+
18
+ - @gradio/utils@0.14.1
19
+
20
+ ## 0.8.3
21
+
22
+ ### Fixes
23
+
24
+ - [#13644](https://github.com/gradio-app/gradio/pull/13644) [`f0abb1e`](https://github.com/gradio-app/gradio/commit/f0abb1ea8e61f4b886296365639b9fe0492012a9) - restore shared props lost during frontend prop partitioning. Thanks @dawoodkhan82!
25
+
26
+ ### Dependency updates
27
+
28
+ - @gradio/utils@0.14.0
29
+ - @gradio/column@0.4.1
30
+ - @gradio/tabs@0.10.0
31
+
3
32
  ## 0.8.2
4
33
 
5
34
  ### Dependency updates
package/Index.svelte CHANGED
@@ -1,4 +1,4 @@
1
- <script context="module" lang="ts">
1
+ <script module lang="ts">
2
2
  export { default as BaseTabItem } from "./shared/TabItem.svelte";
3
3
  </script>
4
4
 
@@ -20,9 +20,10 @@
20
20
  interactive={gradio.shared.interactive}
21
21
  id={gradio.props.id}
22
22
  order={gradio.props.order}
23
- scale={gradio.props.scale}
23
+ alignment={gradio.props.alignment}
24
+ scale={gradio.shared.scale}
24
25
  component_id={gradio.props.component_id}
25
26
  onselect={(data) => gradio.dispatch("select", data)}
26
27
  >
27
- <slot />
28
+ {@render props.children?.()}
28
29
  </TabItem>
package/TabItem.test.ts CHANGED
@@ -87,6 +87,20 @@ describe("TabItem", () => {
87
87
  );
88
88
  });
89
89
  });
90
+
91
+ test("registers its alignment with the parent tabs", async () => {
92
+ const on_register = vi.fn();
93
+ await render(TabItemHarness, {
94
+ tab_alignment: "right",
95
+ on_register
96
+ });
97
+
98
+ await waitFor(() => {
99
+ expect(on_register).toHaveBeenCalledWith(
100
+ expect.objectContaining({ alignment: "right" })
101
+ );
102
+ });
103
+ });
90
104
  });
91
105
 
92
106
  describe("Events: select", () => {
@@ -29,6 +29,7 @@
29
29
  order={0}
30
30
  visible={cfg.tab_visible ?? true}
31
31
  interactive={true}
32
+ alignment={cfg.tab_alignment ?? "left"}
32
33
  scale={0}
33
34
  component_id={1}
34
35
  onselect={(data) => cfg.on_tab_select?.(data)}
package/dist/Index.svelte CHANGED
@@ -1,4 +1,4 @@
1
- <script context="module" lang="ts">
1
+ <script module lang="ts">
2
2
  export { default as BaseTabItem } from "./shared/TabItem.svelte";
3
3
  </script>
4
4
 
@@ -20,9 +20,10 @@
20
20
  interactive={gradio.shared.interactive}
21
21
  id={gradio.props.id}
22
22
  order={gradio.props.order}
23
- scale={gradio.props.scale}
23
+ alignment={gradio.props.alignment}
24
+ scale={gradio.shared.scale}
24
25
  component_id={gradio.props.component_id}
25
26
  onselect={(data) => gradio.dispatch("select", data)}
26
27
  >
27
- <slot />
28
+ {@render props.children?.()}
28
29
  </TabItem>
@@ -1,21 +1,4 @@
1
1
  export { default as BaseTabItem } from "./shared/TabItem.svelte";
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: Props & {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const Index: $$__sveltets_2_IsomorphicComponent<any, {
16
- [evt: string]: CustomEvent<any>;
17
- }, {
18
- default: {};
19
- }, {}, "">;
20
- type Index = InstanceType<typeof Index>;
2
+ declare const Index: import("svelte").Component<$$ComponentProps, {}, "">;
3
+ type Index = ReturnType<typeof Index>;
21
4
  export default Index;
@@ -29,6 +29,7 @@
29
29
  order={0}
30
30
  visible={cfg.tab_visible ?? true}
31
31
  interactive={true}
32
+ alignment={cfg.tab_alignment ?? "left"}
32
33
  scale={0}
33
34
  component_id={1}
34
35
  onselect={(data) => cfg.on_tab_select?.(data)}
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { getContext, tick, untrack } from "svelte";
2
+ import { getContext, tick, untrack, type Snippet } from "svelte";
3
3
  import { TABS } from "@gradio/tabs";
4
4
  import { BaseColumn } from "@gradio/column";
5
5
  import type { SelectData } from "@gradio/utils";
@@ -12,9 +12,11 @@
12
12
  visible,
13
13
  interactive,
14
14
  order,
15
+ alignment = "left",
15
16
  scale,
16
17
  component_id,
17
- onselect
18
+ onselect,
19
+ children
18
20
  }: {
19
21
  elem_id?: string;
20
22
  elem_classes?: string[];
@@ -23,9 +25,11 @@
23
25
  visible: boolean | "hidden";
24
26
  interactive: boolean;
25
27
  order: number;
28
+ alignment?: "left" | "right";
26
29
  scale: number;
27
30
  component_id: number;
28
31
  onselect?: (data: SelectData) => void;
32
+ children?: Snippet;
29
33
  } = $props();
30
34
 
31
35
  const { register_tab, unregister_tab, selected_tab, selected_tab_index } =
@@ -47,6 +51,7 @@
47
51
  elem_id,
48
52
  visible,
49
53
  interactive,
54
+ alignment,
50
55
  scale,
51
56
  component_id
52
57
  })
@@ -80,7 +85,7 @@
80
85
  role="tabpanel"
81
86
  >
82
87
  <BaseColumn scale={scale >= 1 ? scale : null}>
83
- <slot />
88
+ {@render children?.()}
84
89
  </BaseColumn>
85
90
  </div>
86
91
 
@@ -1,3 +1,4 @@
1
+ import { type Snippet } from "svelte";
1
2
  import type { SelectData } from "@gradio/utils";
2
3
  type $$ComponentProps = {
3
4
  elem_id?: string;
@@ -7,34 +8,12 @@ type $$ComponentProps = {
7
8
  visible: boolean | "hidden";
8
9
  interactive: boolean;
9
10
  order: number;
11
+ alignment?: "left" | "right";
10
12
  scale: number;
11
13
  component_id: number;
12
14
  onselect?: (data: SelectData) => void;
15
+ children?: Snippet;
13
16
  };
14
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
16
- $$bindings?: Bindings;
17
- } & Exports;
18
- (internal: unknown, props: Props & {
19
- $$events?: Events;
20
- $$slots?: Slots;
21
- }): Exports & {
22
- $set?: any;
23
- $on?: any;
24
- };
25
- z_$$bindings?: Bindings;
26
- }
27
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
28
- default: any;
29
- } ? Props extends Record<string, never> ? any : {
30
- children?: any;
31
- } : {});
32
- declare const TabItem: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<$$ComponentProps, {
33
- default: {};
34
- }>, {
35
- [evt: string]: CustomEvent<any>;
36
- }, {
37
- default: {};
38
- }, {}, "">;
39
- type TabItem = InstanceType<typeof TabItem>;
17
+ declare const TabItem: import("svelte").Component<$$ComponentProps, {}, "">;
18
+ type TabItem = ReturnType<typeof TabItem>;
40
19
  export default TabItem;
package/dist/types.d.ts CHANGED
@@ -7,7 +7,7 @@ export interface TabItemProps {
7
7
  visible: boolean | "hidden";
8
8
  interactive: boolean;
9
9
  order: number;
10
- scale: number;
10
+ alignment?: "left" | "right";
11
11
  component_id: number;
12
12
  }
13
13
  export interface TabItemEvents {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/tabitem",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -16,12 +16,12 @@
16
16
  "./package.json": "./package.json"
17
17
  },
18
18
  "dependencies": {
19
- "@gradio/column": "^0.4.0",
20
- "@gradio/tabs": "^0.9.0",
21
- "@gradio/utils": "^0.13.0"
19
+ "@gradio/column": "^0.4.1",
20
+ "@gradio/tabs": "^0.11.0",
21
+ "@gradio/utils": "^0.14.2"
22
22
  },
23
23
  "devDependencies": {
24
- "@gradio/preview": "^0.16.2"
24
+ "@gradio/preview": "^0.17.1"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "svelte": "^5.48.0"
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { getContext, tick, untrack } from "svelte";
2
+ import { getContext, tick, untrack, type Snippet } from "svelte";
3
3
  import { TABS } from "@gradio/tabs";
4
4
  import { BaseColumn } from "@gradio/column";
5
5
  import type { SelectData } from "@gradio/utils";
@@ -12,9 +12,11 @@
12
12
  visible,
13
13
  interactive,
14
14
  order,
15
+ alignment = "left",
15
16
  scale,
16
17
  component_id,
17
- onselect
18
+ onselect,
19
+ children
18
20
  }: {
19
21
  elem_id?: string;
20
22
  elem_classes?: string[];
@@ -23,9 +25,11 @@
23
25
  visible: boolean | "hidden";
24
26
  interactive: boolean;
25
27
  order: number;
28
+ alignment?: "left" | "right";
26
29
  scale: number;
27
30
  component_id: number;
28
31
  onselect?: (data: SelectData) => void;
32
+ children?: Snippet;
29
33
  } = $props();
30
34
 
31
35
  const { register_tab, unregister_tab, selected_tab, selected_tab_index } =
@@ -47,6 +51,7 @@
47
51
  elem_id,
48
52
  visible,
49
53
  interactive,
54
+ alignment,
50
55
  scale,
51
56
  component_id
52
57
  })
@@ -80,7 +85,7 @@
80
85
  role="tabpanel"
81
86
  >
82
87
  <BaseColumn scale={scale >= 1 ? scale : null}>
83
- <slot />
88
+ {@render children?.()}
84
89
  </BaseColumn>
85
90
  </div>
86
91
 
package/types.ts CHANGED
@@ -8,7 +8,7 @@ export interface TabItemProps {
8
8
  visible: boolean | "hidden";
9
9
  interactive: boolean;
10
10
  order: number;
11
- scale: number;
11
+ alignment?: "left" | "right";
12
12
  component_id: number;
13
13
  }
14
14