@gradio/multimodaltextbox 0.11.10 → 0.12.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/multimodaltextbox
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Features
6
+
7
+ - [#13509](https://github.com/gradio-app/gradio/pull/13509) [`dcd072c`](https://github.com/gradio-app/gradio/commit/dcd072cd57f09ffd2dc5f97ae6afc505894824a6) - Migrate Chatbot, Tabs, TabItem to Svelte 5. Thanks @dawoodkhan82!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/client@2.2.2
12
+ - @gradio/audio@0.23.4
13
+
14
+ ## 0.11.11
15
+
16
+ ### Dependency updates
17
+
18
+ - @gradio/client@2.2.1
19
+ - @gradio/upload@0.17.10
20
+
21
+ ## 0.11.11
22
+
23
+ ### Dependency updates
24
+
25
+ - @gradio/atoms@0.24.0
26
+ - @gradio/statustracker@0.14.1
27
+ - @gradio/upload@0.17.9
28
+ - @gradio/image@0.26.3
29
+ - @gradio/video@0.20.8
30
+ - @gradio/audio@0.23.3
31
+
3
32
  ## 0.11.10
4
33
 
5
34
  ### Dependency updates
@@ -173,6 +173,7 @@
173
173
  });
174
174
 
175
175
  $effect(() => {
176
+ value?.text;
176
177
  if (el && lines !== max_lines) {
177
178
  resize(el, lines, max_lines);
178
179
  }
@@ -23,11 +23,23 @@ export async function resize(target, lines, max_lines) {
23
23
  scroll_height = target.scrollHeight;
24
24
  }
25
25
  target.style.height = `${scroll_height}px`;
26
+ update_scrollbar_visibility(target);
27
+ }
28
+ function update_scrollbar_visibility(textarea) {
29
+ const content_height = textarea.scrollHeight;
30
+ const visible_height = textarea.clientHeight;
31
+ const line_height = parseFloat(window.getComputedStyle(textarea).lineHeight);
32
+ if (content_height > visible_height + line_height) {
33
+ textarea.style.overflowY = "scroll";
34
+ }
35
+ else {
36
+ textarea.style.overflowY = "hidden";
37
+ }
26
38
  }
27
39
  export function text_area_resize(_el, _value) {
28
40
  if (_value.lines === _value.max_lines)
29
41
  return;
30
- _el.style.overflowY = "scroll";
42
+ update_scrollbar_visibility(_el);
31
43
  function handle_input(event) {
32
44
  resize(event.target, _value.lines, _value.max_lines);
33
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/multimodaltextbox",
3
- "version": "0.11.10",
3
+ "version": "0.12.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -22,15 +22,15 @@
22
22
  "./package.json": "./package.json"
23
23
  },
24
24
  "dependencies": {
25
- "@gradio/atoms": "^0.23.1",
26
- "@gradio/utils": "^0.12.2",
27
25
  "@gradio/icons": "^0.15.1",
28
- "@gradio/statustracker": "^0.14.0",
29
- "@gradio/upload": "^0.17.8",
30
- "@gradio/image": "^0.26.2",
31
- "@gradio/video": "^0.20.7",
32
- "@gradio/client": "^2.2.0",
33
- "@gradio/audio": "^0.23.2"
26
+ "@gradio/atoms": "^0.24.0",
27
+ "@gradio/utils": "^0.12.2",
28
+ "@gradio/statustracker": "^0.14.1",
29
+ "@gradio/upload": "^0.17.10",
30
+ "@gradio/client": "^2.2.2",
31
+ "@gradio/video": "^0.20.9",
32
+ "@gradio/image": "^0.26.3",
33
+ "@gradio/audio": "^0.23.4"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@gradio/preview": "^0.16.2"
@@ -173,6 +173,7 @@
173
173
  });
174
174
 
175
175
  $effect(() => {
176
+ value?.text;
176
177
  if (el && lines !== max_lines) {
177
178
  resize(el, lines, max_lines);
178
179
  }
package/shared/utils.ts CHANGED
@@ -37,6 +37,20 @@ export async function resize(
37
37
  }
38
38
 
39
39
  target.style.height = `${scroll_height}px`;
40
+ update_scrollbar_visibility(target);
41
+ }
42
+
43
+ function update_scrollbar_visibility(
44
+ textarea: HTMLTextAreaElement | HTMLInputElement
45
+ ): void {
46
+ const content_height = textarea.scrollHeight;
47
+ const visible_height = textarea.clientHeight;
48
+ const line_height = parseFloat(window.getComputedStyle(textarea).lineHeight);
49
+ if (content_height > visible_height + line_height) {
50
+ textarea.style.overflowY = "scroll";
51
+ } else {
52
+ textarea.style.overflowY = "hidden";
53
+ }
40
54
  }
41
55
 
42
56
  export function text_area_resize(
@@ -44,7 +58,7 @@ export function text_area_resize(
44
58
  _value: Value
45
59
  ): any | undefined {
46
60
  if (_value.lines === _value.max_lines) return;
47
- _el.style.overflowY = "scroll";
61
+ update_scrollbar_visibility(_el);
48
62
 
49
63
  function handle_input(event: Event): void {
50
64
  resize(event.target as HTMLTextAreaElement, _value.lines, _value.max_lines);