@gradio/image 0.26.1 → 0.26.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,5 +1,17 @@
1
1
  # @gradio/image
2
2
 
3
+ ## 0.26.2
4
+
5
+ ### Fixes
6
+
7
+ - [#13181](https://github.com/gradio-app/gradio/pull/13181) [`755c3d3`](https://github.com/gradio-app/gradio/commit/755c3d32c388a36d2296f8d895c5c0e1144fb54f) - fix: show validation errors on StatusTracker-dependent components. Thanks @hysts!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/atoms@0.23.1
12
+ - @gradio/statustracker@0.14.0
13
+ - @gradio/client@2.2.0
14
+
3
15
  ## 0.26.1
4
16
 
5
17
  ### Fixes
package/Image.test.ts CHANGED
@@ -12,7 +12,6 @@ import {
12
12
  TEST_PNG
13
13
  } from "@self/tootils/render";
14
14
  import { run_shared_prop_tests } from "@self/tootils/shared-prop-tests";
15
- import { tick } from "svelte";
16
15
 
17
16
  import Image from "./Index.svelte";
18
17
  import { get_coordinates_of_clicked_image } from "./shared/utils";
@@ -26,19 +25,6 @@ const fake_value = {
26
25
  is_stream: false
27
26
  };
28
27
 
29
- const loading_status = {
30
- status: "complete" as const,
31
- eta: 0,
32
- queue_position: 1,
33
- queue_size: 1,
34
- scroll_to_output: false,
35
- visible: true,
36
- fn_index: 0,
37
- show_progress: "full" as const,
38
- type: "input" as const,
39
- stream_state: "closed" as const
40
- };
41
-
42
28
  const default_props = {
43
29
  sources: ["upload", "webcam", "clipboard"] as (
44
30
  | "upload"
@@ -59,8 +45,7 @@ const default_props = {
59
45
  placeholder: "",
60
46
  buttons: [] as (string | { value: string; id: number; icon: null })[],
61
47
  webcam_options: { mirror: false, constraints: {} },
62
- watermark: null,
63
- loading_status
48
+ watermark: null
64
49
  };
65
50
 
66
51
  run_shared_prop_tests({
@@ -70,7 +55,7 @@ run_shared_prop_tests({
70
55
  ...default_props
71
56
  },
72
57
  has_label: false,
73
- has_validation_error: false
58
+ has_validation_error: true
74
59
  });
75
60
 
76
61
  describe("Image", () => {
@@ -97,6 +82,40 @@ describe("Image", () => {
97
82
  });
98
83
  });
99
84
 
85
+ describe("Props: label", () => {
86
+ afterEach(() => cleanup());
87
+
88
+ test("label text is rendered", async () => {
89
+ const result = await render(Image, {
90
+ ...default_props,
91
+ label: "My Custom Label",
92
+ show_label: true
93
+ });
94
+ const el = result.getByText("My Custom Label");
95
+ expect(el).toBeTruthy();
96
+ });
97
+
98
+ test("show_label: true makes the label visible", async () => {
99
+ const result = await render(Image, {
100
+ ...default_props,
101
+ label: "Visible Label",
102
+ show_label: true
103
+ });
104
+ const el = result.getByText("Visible Label");
105
+ expect(el).toBeVisible();
106
+ });
107
+
108
+ test("show_label: false hides the label visually but keeps it in the DOM", async () => {
109
+ const result = await render(Image, {
110
+ ...default_props,
111
+ label: "Hidden Label",
112
+ show_label: false
113
+ });
114
+ const el = result.getByText("Hidden Label");
115
+ expect(el).not.toBeVisible();
116
+ });
117
+ });
118
+
100
119
  describe("Props: sources", () => {
101
120
  afterEach(() => cleanup());
102
121
 
package/Index.svelte CHANGED
@@ -150,7 +150,7 @@
150
150
  on:dragover={handle_drag_event}
151
151
  on:drop={handle_drop}
152
152
  >
153
- {#if gradio.shared.loading_status.type === "output"}
153
+ {#if gradio.shared.loading_status.type === "output" || gradio.shared.loading_status.validation_error}
154
154
  <StatusTracker
155
155
  autoscroll={gradio.shared.autoscroll}
156
156
  i18n={gradio.i18n}
package/dist/Index.svelte CHANGED
@@ -150,7 +150,7 @@
150
150
  on:dragover={handle_drag_event}
151
151
  on:drop={handle_drop}
152
152
  >
153
- {#if gradio.shared.loading_status.type === "output"}
153
+ {#if gradio.shared.loading_status.type === "output" || gradio.shared.loading_status.validation_error}
154
154
  <StatusTracker
155
155
  autoscroll={gradio.shared.autoscroll}
156
156
  i18n={gradio.i18n}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/image",
3
- "version": "0.26.1",
3
+ "version": "0.26.2",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -10,12 +10,12 @@
10
10
  "cropperjs": "^2.0.1",
11
11
  "lazy-brush": "^2.0.2",
12
12
  "resize-observer-polyfill": "^1.5.1",
13
- "@gradio/atoms": "^0.23.0",
14
- "@gradio/client": "^2.1.0",
15
13
  "@gradio/icons": "^0.15.1",
16
- "@gradio/statustracker": "^0.13.1",
14
+ "@gradio/statustracker": "^0.14.0",
15
+ "@gradio/upload": "^0.17.8",
16
+ "@gradio/client": "^2.2.0",
17
17
  "@gradio/utils": "^0.12.2",
18
- "@gradio/upload": "^0.17.8"
18
+ "@gradio/atoms": "^0.23.1"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@gradio/preview": "^0.16.2"