gradio-pr-bot commited on
Commit
bc0ca7f
·
verified ·
1 Parent(s): 2510922

Upload folder using huggingface_hub

Browse files
6.7.1/accordion/Index.svelte ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import Accordion from "./shared/Accordion.svelte";
3
+ import { Block } from "@gradio/atoms";
4
+ import { StatusTracker } from "@gradio/statustracker";
5
+
6
+ import { BaseColumn } from "@gradio/column";
7
+ import { Gradio } from "@gradio/utils";
8
+ import type { SharedProps } from "@gradio/utils";
9
+
10
+ import type { AccordionProps, AccordionEvents } from "./types";
11
+
12
+ let props = $props();
13
+ class AccordionGradio extends Gradio<AccordionEvents, AccordionProps> {
14
+ set_data(data: Partial<object & SharedProps>): void {
15
+ if ("open" in data && data.open) {
16
+ this.dispatch("gradio_expand");
17
+ }
18
+ super.set_data(data);
19
+ this.shared.loading_status.status = "complete";
20
+ }
21
+ }
22
+ const gradio = new AccordionGradio(props);
23
+
24
+ let label = $derived(gradio.shared.label || "");
25
+ </script>
26
+
27
+ <Block
28
+ elem_id={gradio.shared.elem_id}
29
+ elem_classes={gradio.shared.elem_classes}
30
+ visible={gradio.shared.visible}
31
+ >
32
+ {#if gradio.shared.loading_status}
33
+ <StatusTracker
34
+ autoscroll={gradio.shared.autoscroll}
35
+ i18n={gradio.i18n}
36
+ {...gradio.shared.loading_status}
37
+ />
38
+ {/if}
39
+
40
+ <Accordion
41
+ {label}
42
+ open={gradio.props.open}
43
+ onexpand={() => {
44
+ gradio.dispatch("expand");
45
+ gradio.dispatch("gradio_expand");
46
+ }}
47
+ oncollapse={() => gradio.dispatch("collapse")}
48
+ >
49
+ <BaseColumn>
50
+ <slot />
51
+ </BaseColumn>
52
+ </Accordion>
53
+ </Block>
6.7.1/accordion/package.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@gradio/accordion",
3
+ "version": "0.5.31",
4
+ "description": "Gradio UI packages",
5
+ "type": "module",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "main_changeset": true,
9
+ "dependencies": {
10
+ "@gradio/atoms": "workspace:^",
11
+ "@gradio/column": "workspace:^",
12
+ "@gradio/statustracker": "workspace:^",
13
+ "@gradio/utils": "workspace:^"
14
+ },
15
+ "peerDependencies": {
16
+ "svelte": "^5.48.0"
17
+ },
18
+ "devDependencies": {
19
+ "@gradio/preview": "workspace:^"
20
+ },
21
+ "exports": {
22
+ ".": {
23
+ "gradio": "./Index.svelte",
24
+ "svelte": "./dist/Index.svelte",
25
+ "types": "./dist/Index.svelte.d.ts"
26
+ },
27
+ "./package.json": "./package.json"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/gradio-app/gradio.git",
32
+ "directory": "js/accordion"
33
+ }
34
+ }
6.7.1/accordion/shared/Accordion.svelte ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ let {
3
+ open = $bindable(true),
4
+ label = "",
5
+ onexpand,
6
+ oncollapse
7
+ }: {
8
+ open: boolean;
9
+ label: string;
10
+ onexpand?: () => void;
11
+ oncollapse?: () => void;
12
+ } = $props();
13
+ </script>
14
+
15
+ <button
16
+ onclick={() => {
17
+ open = !open;
18
+ if (open) {
19
+ onexpand?.();
20
+ } else {
21
+ oncollapse?.();
22
+ }
23
+ }}
24
+ class="label-wrap"
25
+ class:open
26
+ >
27
+ <span>{label}</span>
28
+ <span style:transform={open ? "rotate(0)" : "rotate(90deg)"} class="icon">
29
+
30
+ </span>
31
+ </button>
32
+ <div style:display={open ? "block" : "none"}>
33
+ <slot />
34
+ </div>
35
+
36
+ <style>
37
+ span {
38
+ font-weight: var(--section-header-text-weight);
39
+ font-size: var(--section-header-text-size);
40
+ }
41
+ .label-wrap {
42
+ display: flex;
43
+ justify-content: space-between;
44
+ cursor: pointer;
45
+ width: var(--size-full);
46
+ color: var(--accordion-text-color);
47
+ }
48
+ .label-wrap.open {
49
+ margin-bottom: var(--size-2);
50
+ }
51
+
52
+ .icon {
53
+ transition: 150ms;
54
+ }
55
+ </style>
6.7.1/accordion/types.ts ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ export interface AccordionProps {
2
+ open: boolean;
3
+ }
4
+
5
+ export interface AccordionEvents {
6
+ expand: never;
7
+ collapse: never;
8
+ gradio_expand: never;
9
+ }