@gpustack/core-ui 1.0.24 → 1.0.25

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.
@@ -25,6 +25,8 @@ interface SystemMessageProps {
25
25
  onChange: (e: any) => void;
26
26
  onPaste?: (e: any) => void;
27
27
  onDelete?: () => void;
28
+ actions?: React.ReactNode;
29
+ showUpload?: boolean;
28
30
  onSelect?: (data: {
29
31
  start: number;
30
32
  end: number;
@@ -0,0 +1,12 @@
1
+ export interface ImageURLInputProps {
2
+ /** Whether the invalid-url tooltip / error state is shown */
3
+ open?: boolean;
4
+ inputProps?: Record<string, any>;
5
+ /** Commit the typed url (fired on blur and on Enter) */
6
+ onSubmit: (e: any) => void;
7
+ /** Discard the url input */
8
+ onClose: (e?: any) => void;
9
+ onEscape: (e: any) => void;
10
+ }
11
+ declare const ImageURLInput: import('react').ForwardRefExoticComponent<ImageURLInputProps & import('react').RefAttributes<any>>;
12
+ export default ImageURLInput;
@@ -68,6 +68,7 @@ export { default as IconFont } from './icon-font';
68
68
  export { default as icons } from './icon-font/icons';
69
69
  export { default as ImageEditor } from './image-editor';
70
70
  export { processImage } from './image-editor/extract-image-colors';
71
+ export { default as ImageURLInput, type ImageURLInputProps } from './image-url-input';
71
72
  export { default as InfiniteScroller } from './infinite-scroller';
72
73
  export { default as InfiniteScrollerProvider } from './infinite-scroller/infinite-scroller-provider';
73
74
  export { useScrollerContext } from './infinite-scroller/use-scroller-context';
@@ -125,5 +126,6 @@ export { default as Transfer } from './transfer';
125
126
  export { default as TransitionWrapper } from './transition';
126
127
  export { default as UploadAudio } from './upload-audio';
127
128
  export { default as UploadImage } from './upload-image';
129
+ export { default as UploadImageButton, type UploadImageButtonProps } from './upload-image-button';
128
130
  export { default as ViewerEditor } from './viewer-editor';
129
131
  export { default as XTerminal } from './x-terminal';
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ export interface UploadImageButtonProps {
3
+ size?: 'small' | 'middle' | 'large';
4
+ onOpenChange?: (open: boolean) => void;
5
+ /** Receives images selected through the file picker */
6
+ onUpdateImgList: (list: {
7
+ uid: number | string;
8
+ dataUrl: string;
9
+ }[]) => void;
10
+ /** Switch the consumer into "add image from url" mode */
11
+ onAddFromUrl: () => void;
12
+ }
13
+ declare const UploadImageButton: React.FC<UploadImageButtonProps>;
14
+ export default UploadImageButton;
@@ -1,15 +1,27 @@
1
- declare const useAddImage: (options: {
2
- size?: "small" | "middle" | "large";
3
- inputProps?: Record<string, any>;
4
- handleUpdateImgList: (list: {
5
- uid: number | string;
6
- dataUrl: string;
7
- }[]) => void;
1
+ interface ImageItem {
2
+ uid: number | string;
3
+ dataUrl: string;
4
+ }
5
+ interface UseAddImageOptions {
6
+ handleUpdateImgList: (list: ImageItem[]) => void;
8
7
  updateUidCount: () => number | string;
9
- }) => {
8
+ }
9
+ /**
10
+ * Owns the interaction state for the "add image" flow (file picker dropdown +
11
+ * add-by-url input). It returns only state and handlers — render the UI with
12
+ * the `UploadImageButton` and `ImageURLInput` components, wiring these handlers
13
+ * to them. This keeps the logic reusable and lets the UI be memoized/composed
14
+ * by the consumer.
15
+ */
16
+ declare const useAddImage: (options: UseAddImageOptions) => {
10
17
  isFromUrl: boolean;
11
- ImageURLInput: import("react/jsx-runtime").JSX.Element | null;
12
18
  dropDownOpen: boolean;
13
- UploadImageButton: import("react/jsx-runtime").JSX.Element;
19
+ openImgTips: boolean;
20
+ inputImgRef: import('react').MutableRefObject<any>;
21
+ handleAddImgFromUrl: () => void;
22
+ handleInputImageUrl: (e: any) => Promise<void>;
23
+ handleClose: (e?: any) => void;
24
+ handleOnEscape: (e: any) => void;
25
+ handleOnOpenChange: (open: boolean) => void;
14
26
  };
15
27
  export default useAddImage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpustack/core-ui",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "**/*.css",