@usefragments/ui 1.3.3 → 1.4.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/dist/assets/ui.css +1176 -766
- package/dist/chart.cjs +60 -24
- package/dist/chart.js +38 -24
- package/dist/colorpicker.cjs +56 -9
- package/dist/colorpicker.js +34 -9
- package/dist/components/Badge/Badge.module.scss.cjs +23 -16
- package/dist/components/Badge/Badge.module.scss.js +23 -16
- package/dist/components/Badge/index.cjs +8 -1
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js +8 -1
- package/dist/components/Button/Button.module.scss.cjs +16 -13
- package/dist/components/Button/Button.module.scss.js +16 -13
- package/dist/components/Button/index.d.ts +2 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Chart/index.d.ts +3 -0
- package/dist/components/Chart/index.d.ts.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.module.scss.cjs +21 -21
- package/dist/components/CodeBlock/CodeBlock.module.scss.js +21 -21
- package/dist/components/ColorPicker/index.d.ts +4 -0
- package/dist/components/ColorPicker/index.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.module.scss.cjs +23 -23
- package/dist/components/Combobox/Combobox.module.scss.js +23 -23
- package/dist/components/Command/Command.module.scss.cjs +11 -11
- package/dist/components/Command/Command.module.scss.js +11 -11
- package/dist/components/ConversationList/ConversationList.module.scss.cjs +13 -10
- package/dist/components/ConversationList/ConversationList.module.scss.js +14 -11
- package/dist/components/ConversationList/index.cjs +26 -22
- package/dist/components/ConversationList/index.d.ts +5 -1
- package/dist/components/ConversationList/index.d.ts.map +1 -1
- package/dist/components/ConversationList/index.js +27 -23
- package/dist/components/DataTable/index.d.ts +4 -1
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.d.ts +3 -0
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/Editor/index.d.ts +4 -1
- package/dist/components/Editor/index.d.ts.map +1 -1
- package/dist/components/Listbox/Listbox.module.scss.cjs +8 -8
- package/dist/components/Listbox/Listbox.module.scss.js +8 -8
- package/dist/components/Markdown/Markdown.module.scss.cjs +1 -1
- package/dist/components/Markdown/Markdown.module.scss.js +1 -1
- package/dist/components/Markdown/index.d.ts +16 -0
- package/dist/components/Markdown/index.d.ts.map +1 -1
- package/dist/components/Menu/Menu.module.scss.cjs +14 -14
- package/dist/components/Menu/Menu.module.scss.js +14 -14
- package/dist/components/Message/Message.module.scss.cjs +23 -20
- package/dist/components/Message/Message.module.scss.js +24 -21
- package/dist/components/Message/index.cjs +5 -1
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +5 -1
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.cjs +28 -28
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.js +28 -28
- package/dist/components/Pagination/Pagination.module.scss.cjs +7 -7
- package/dist/components/Pagination/Pagination.module.scss.js +7 -7
- package/dist/components/Prompt/Prompt.module.scss.cjs +52 -22
- package/dist/components/Prompt/Prompt.module.scss.js +52 -22
- package/dist/components/Prompt/index.cjs +197 -2
- package/dist/components/Prompt/index.d.ts +98 -3
- package/dist/components/Prompt/index.d.ts.map +1 -1
- package/dist/components/Prompt/index.js +198 -3
- package/dist/components/Select/Select.module.scss.cjs +29 -17
- package/dist/components/Select/Select.module.scss.js +30 -18
- package/dist/components/Select/index.cjs +45 -8
- package/dist/components/Select/index.d.ts +17 -2
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +45 -8
- package/dist/components/Sidebar/Sidebar.module.scss.cjs +45 -42
- package/dist/components/Sidebar/Sidebar.module.scss.js +45 -42
- package/dist/components/Sidebar/index.cjs +2 -0
- package/dist/components/Sidebar/index.d.ts +6 -1
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +2 -0
- package/dist/components/Text/Text.module.scss.cjs +63 -51
- package/dist/components/Text/Text.module.scss.js +63 -51
- package/dist/components/Text/index.d.ts +4 -2
- package/dist/components/Text/index.d.ts.map +1 -1
- package/dist/data-table.cjs +210 -28
- package/dist/data-table.js +189 -29
- package/dist/datepicker.cjs +63 -14
- package/dist/datepicker.js +41 -14
- package/dist/editor.cjs +67 -16
- package/dist/editor.js +45 -16
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/markdown.cjs +63 -19
- package/dist/markdown.js +41 -19
- package/fragments.json +1 -1
- package/package.json +2 -2
- package/src/components/Badge/Badge.contract.json +28 -5
- package/src/components/Badge/Badge.module.scss +21 -0
- package/src/components/Badge/index.tsx +10 -1
- package/src/components/Button/Button.contract.json +9 -3
- package/src/components/Button/Button.module.scss +34 -0
- package/src/components/Button/index.tsx +11 -1
- package/src/components/Chart/Chart.contract.json +7 -0
- package/src/components/Chart/index.tsx +44 -27
- package/src/components/CodeBlock/CodeBlock.contract.json +7 -0
- package/src/components/CodeBlock/CodeBlock.module.scss +7 -2
- package/src/components/ColorPicker/ColorPicker.contract.json +9 -1
- package/src/components/ColorPicker/index.tsx +42 -12
- package/src/components/Combobox/Combobox.module.scss +4 -13
- package/src/components/ConversationList/ConversationList.contract.json +16 -1
- package/src/components/ConversationList/ConversationList.module.scss +12 -0
- package/src/components/ConversationList/index.tsx +40 -26
- package/src/components/DataTable/DataTable.contract.json +8 -1
- package/src/components/DataTable/index.tsx +282 -51
- package/src/components/DatePicker/DatePicker.contract.json +8 -1
- package/src/components/DatePicker/index.tsx +51 -22
- package/src/components/Editor/Editor.contract.json +19 -1
- package/src/components/Editor/index.tsx +67 -23
- package/src/components/Listbox/Listbox.module.scss +3 -11
- package/src/components/Markdown/Markdown.contract.json +15 -1
- package/src/components/Markdown/Markdown.module.scss +18 -1
- package/src/components/Markdown/index.tsx +58 -24
- package/src/components/Menu/Menu.module.scss +12 -2
- package/src/components/Message/Message.contract.json +3 -0
- package/src/components/Message/Message.module.scss +33 -4
- package/src/components/Message/index.tsx +7 -1
- package/src/components/Pagination/Pagination.contract.json +1 -0
- package/src/components/Pagination/Pagination.module.scss +5 -4
- package/src/components/Prompt/Prompt.contract.json +40 -1
- package/src/components/Prompt/Prompt.module.scss +351 -4
- package/src/components/Prompt/index.tsx +324 -0
- package/src/components/Select/Select.contract.json +11 -1
- package/src/components/Select/Select.module.scss +80 -13
- package/src/components/Select/index.tsx +73 -7
- package/src/components/Sidebar/Sidebar.contract.json +1 -0
- package/src/components/Sidebar/Sidebar.module.scss +10 -0
- package/src/components/Sidebar/index.tsx +7 -0
- package/src/components/Text/Text.contract.json +7 -4
- package/src/components/Text/Text.module.scss +18 -0
- package/src/components/Text/index.tsx +4 -2
- package/src/index.ts +1 -0
- package/src/tokens/_mixins.scss +39 -4
- package/src/tokens/_variables.scss +30 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type SelectOption, type SelectValue } from '../Select';
|
|
2
3
|
export type PromptVariant = 'default' | 'fixed' | 'sticky';
|
|
4
|
+
export type PromptAppearance = 'panel' | 'seamless';
|
|
3
5
|
export interface PromptProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'onSubmit' | 'defaultValue'> {
|
|
4
6
|
children: React.ReactNode;
|
|
5
7
|
/** Controlled input value */
|
|
@@ -24,8 +26,19 @@ export interface PromptProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
24
26
|
autoResize?: boolean;
|
|
25
27
|
/** Submit on Enter key (Shift+Enter for newline) */
|
|
26
28
|
submitOnEnter?: boolean;
|
|
29
|
+
/** Files added to the prompt, by any of the three routes people actually
|
|
30
|
+
* use: the attach button, a paste, or a drop anywhere on the card. Providing
|
|
31
|
+
* it is what turns all three on. */
|
|
32
|
+
onFiles?: (files: File[]) => void;
|
|
33
|
+
/** `accept` for the attach button's picker, e.g. `"image/*"`. */
|
|
34
|
+
accept?: string;
|
|
27
35
|
/** Visual variant - "fixed" for bottom-fixed elevated prompt */
|
|
28
36
|
variant?: PromptVariant;
|
|
37
|
+
/** How the card is divided up. `panel` keeps the toolbar as a filled footer
|
|
38
|
+
* under a rule; `seamless` makes the whole card one writing surface with the
|
|
39
|
+
* controls floating on it — the shape most agent composers use.
|
|
40
|
+
* @default "panel" */
|
|
41
|
+
appearance?: PromptAppearance;
|
|
29
42
|
}
|
|
30
43
|
export interface PromptTextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue' | 'onChange' | 'rows' | 'disabled' | 'children'> {
|
|
31
44
|
/** Override placeholder from context */
|
|
@@ -34,6 +47,8 @@ export interface PromptTextareaProps extends Omit<React.TextareaHTMLAttributes<H
|
|
|
34
47
|
onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;
|
|
35
48
|
/** Composed with internal submit-on-enter logic */
|
|
36
49
|
onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;
|
|
50
|
+
/** Composed with the prompt's paste-to-attach behaviour */
|
|
51
|
+
onPaste?: React.ClipboardEventHandler<HTMLTextAreaElement>;
|
|
37
52
|
}
|
|
38
53
|
export interface PromptToolbarProps {
|
|
39
54
|
children: React.ReactNode;
|
|
@@ -79,6 +94,55 @@ export interface PromptModeButtonProps {
|
|
|
79
94
|
disabled?: boolean;
|
|
80
95
|
className?: string;
|
|
81
96
|
}
|
|
97
|
+
/** One thing attached to the prompt, as the strip needs to render it. */
|
|
98
|
+
export interface PromptAttachment {
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
/** Size in bytes. Shown beside the name when known. */
|
|
102
|
+
size?: number;
|
|
103
|
+
/** Object URL or data URI. An image gets a thumbnail instead of an icon. */
|
|
104
|
+
previewUrl?: string;
|
|
105
|
+
}
|
|
106
|
+
export interface PromptAttachmentsProps {
|
|
107
|
+
items: PromptAttachment[];
|
|
108
|
+
/** Omit to render the strip read-only. */
|
|
109
|
+
onRemove?: (id: string) => void;
|
|
110
|
+
className?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface PromptAttachProps {
|
|
113
|
+
/** Accessible name.
|
|
114
|
+
* @default "Attach files" */
|
|
115
|
+
'aria-label'?: string;
|
|
116
|
+
/** Custom glyph. Defaults to a plus. */
|
|
117
|
+
children?: React.ReactNode;
|
|
118
|
+
/** Overrides the prompt's own `accept` for this control. */
|
|
119
|
+
accept?: string;
|
|
120
|
+
/** @default true */
|
|
121
|
+
multiple?: boolean;
|
|
122
|
+
disabled?: boolean;
|
|
123
|
+
className?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface PromptSelectProps {
|
|
126
|
+
/** Leading glyph — says what the choice is about, so the visible text can be
|
|
127
|
+
* the choice itself. */
|
|
128
|
+
icon?: React.ReactNode;
|
|
129
|
+
/** Accessible name. The trigger shows the current choice, not this. */
|
|
130
|
+
'aria-label': string;
|
|
131
|
+
/** Controlled value */
|
|
132
|
+
value?: SelectValue | null;
|
|
133
|
+
/** Default value for uncontrolled usage */
|
|
134
|
+
defaultValue?: SelectValue;
|
|
135
|
+
/** Called when the choice changes */
|
|
136
|
+
onValueChange?: (value: SelectValue | null) => void;
|
|
137
|
+
/** The choices. Omit and pass `Select.Item` children for richer options. */
|
|
138
|
+
options?: SelectOption[];
|
|
139
|
+
children?: React.ReactNode;
|
|
140
|
+
/** Shown before anything is chosen */
|
|
141
|
+
placeholder?: string;
|
|
142
|
+
/** Disabled independently of the prompt's own disabled state */
|
|
143
|
+
disabled?: boolean;
|
|
144
|
+
className?: string;
|
|
145
|
+
}
|
|
82
146
|
export interface PromptUsageProps {
|
|
83
147
|
children: React.ReactNode;
|
|
84
148
|
className?: string;
|
|
@@ -102,10 +166,14 @@ interface PromptContextValue {
|
|
|
102
166
|
submitOnEnter: boolean;
|
|
103
167
|
handleSubmit: () => void;
|
|
104
168
|
textareaRef: React.RefObject<HTMLTextAreaElement | null>;
|
|
169
|
+
accept?: string;
|
|
170
|
+
/** Undefined when the consumer has not opted into files at all, which is how
|
|
171
|
+
* Attach knows to disable itself and the root knows not to accept drops. */
|
|
172
|
+
onFiles?: (files: File[]) => void;
|
|
105
173
|
}
|
|
106
174
|
declare function usePromptContext(): PromptContextValue;
|
|
107
|
-
declare function PromptRoot({ children, value: controlledValue, defaultValue, onChange, onSubmit, placeholder, disabled, loading, minRows, maxRows, autoResize, submitOnEnter, variant, className, ...htmlProps }: PromptProps): import("react/jsx-runtime").JSX.Element;
|
|
108
|
-
declare function PromptTextarea({ placeholder: overridePlaceholder, className, onChange, onKeyDown, 'aria-label': ariaLabel, ...htmlProps }: PromptTextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
175
|
+
declare function PromptRoot({ children, value: controlledValue, defaultValue, onChange, onSubmit, placeholder, disabled, loading, minRows, maxRows, autoResize, submitOnEnter, variant, appearance, onFiles, accept, className, ...htmlProps }: PromptProps): import("react/jsx-runtime").JSX.Element;
|
|
176
|
+
declare function PromptTextarea({ placeholder: overridePlaceholder, className, onChange, onKeyDown, onPaste, 'aria-label': ariaLabel, ...htmlProps }: PromptTextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
109
177
|
declare function PromptToolbar({ children, className }: PromptToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
110
178
|
declare function PromptTabs({ children, className }: PromptTabsProps): import("react/jsx-runtime").JSX.Element;
|
|
111
179
|
declare function PromptTab({ children, active, onClick, className }: PromptTabProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -113,6 +181,30 @@ declare function PromptActions({ children, className }: PromptActionsProps): imp
|
|
|
113
181
|
declare function PromptInfo({ children, className }: PromptInfoProps): import("react/jsx-runtime").JSX.Element;
|
|
114
182
|
declare function PromptActionButton({ children, 'aria-label': ariaLabel, onClick, disabled: buttonDisabled, className, }: PromptActionButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
115
183
|
declare function PromptModeButton({ children, onClick, active, disabled: buttonDisabled, className, }: PromptModeButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
184
|
+
/**
|
|
185
|
+
* What is going with the message. Renders above the textarea rather than under
|
|
186
|
+
* the toolbar, because these are part of what you are sending and not a
|
|
187
|
+
* setting on the sending.
|
|
188
|
+
*/
|
|
189
|
+
declare function PromptAttachments({ items, onRemove, className }: PromptAttachmentsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
190
|
+
/**
|
|
191
|
+
* The attach control. Does nothing on its own — it opens a picker and hands
|
|
192
|
+
* the result to the prompt's `onFiles`, the same callback that paste and drop
|
|
193
|
+
* go through, so a consumer writes one handler for all three.
|
|
194
|
+
*/
|
|
195
|
+
declare function PromptAttach({ 'aria-label': ariaLabel, children, accept: acceptOverride, multiple, disabled: buttonDisabled, className, }: PromptAttachProps): import("react/jsx-runtime").JSX.Element;
|
|
196
|
+
/**
|
|
197
|
+
* A choice that scopes the submission — model, agent, tone, which project this
|
|
198
|
+
* runs against. `ModeButton` covers a setting you toggle; this covers one you
|
|
199
|
+
* pick from a list, which every non-trivial composer ends up needing.
|
|
200
|
+
*
|
|
201
|
+
* It is a `Select` throughout, in its ghost variant, so the popup, keyboard
|
|
202
|
+
* handling and selection state are the same ones the rest of the library uses.
|
|
203
|
+
* The trigger shows the current choice rather than a field label, because in a
|
|
204
|
+
* toolbar the choice is the only part worth the width — what kind of choice it
|
|
205
|
+
* is comes from the icon and the accessible name.
|
|
206
|
+
*/
|
|
207
|
+
declare function PromptSelect({ icon, 'aria-label': ariaLabel, options, children, placeholder, disabled: selectDisabled, className, ...selectProps }: PromptSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
116
208
|
declare function PromptUsage({ children, className }: PromptUsageProps): import("react/jsx-runtime").JSX.Element;
|
|
117
209
|
declare function PromptSubmit({ children, 'aria-label': ariaLabel, className, }: PromptSubmitProps): import("react/jsx-runtime").JSX.Element;
|
|
118
210
|
export declare const Prompt: typeof PromptRoot & {
|
|
@@ -124,9 +216,12 @@ export declare const Prompt: typeof PromptRoot & {
|
|
|
124
216
|
Info: typeof PromptInfo;
|
|
125
217
|
ActionButton: typeof PromptActionButton;
|
|
126
218
|
ModeButton: typeof PromptModeButton;
|
|
219
|
+
Select: typeof PromptSelect;
|
|
220
|
+
Attach: typeof PromptAttach;
|
|
221
|
+
Attachments: typeof PromptAttachments;
|
|
127
222
|
Usage: typeof PromptUsage;
|
|
128
223
|
Submit: typeof PromptSubmit;
|
|
129
224
|
};
|
|
130
|
-
export { PromptRoot, PromptTextarea, PromptToolbar, PromptTabs, PromptTab, PromptActions, PromptInfo, PromptActionButton, PromptModeButton, PromptUsage, PromptSubmit, };
|
|
225
|
+
export { PromptRoot, PromptTextarea, PromptToolbar, PromptTabs, PromptTab, PromptActions, PromptInfo, PromptActionButton, PromptModeButton, PromptSelect, PromptAttach, PromptAttachments, PromptUsage, PromptSubmit, };
|
|
131
226
|
export { usePromptContext };
|
|
132
227
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Prompt/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Prompt/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAU,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAMxE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,UAAU,CAAC;AAEpD,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,cAAc,CAAC;IACvH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,C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ACf,QAAQ,EAAE,cAAc,EACxB,SAAS,GACV,EAAE,iBAAiB,2CAqCnB;AAED;;;;;;;;;;GAUG;AACH,iBAAS,YAAY,CAAC,EACpB,IAAI,EACJ,YAAY,EAAE,SAAS,EACvB,OAAO,EACP,QAAQ,EACR,WAAW,EACX,QAAQ,EAAE,cAAc,EACxB,SAAS,EACT,GAAG,WAAW,EACf,EAAE,iBAAiB,2CAoBnB;AAED,iBAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,gBAAgB,2CAG7D;AAED,iBAAS,YAAY,CAAC,EACpB,QAAQ,EACR,YAAY,EAAE,SAAoB,EAClC,SAAS,GACV,EAAE,iBAAiB,2CA+BnB;AAMD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;CAcjB,CAAC;AAEH,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,UAAU,EACV,SAAS,EACT,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,YAAY,GACb,CAAC;AAGF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,8 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import styles from "./Prompt.module.scss.js";
|
|
5
5
|
import { Loading } from "../Loading/index.js";
|
|
6
|
+
import { Select } from "../Select/index.js";
|
|
7
|
+
function PlusIcon() {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
"svg",
|
|
10
|
+
{
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
width: "16",
|
|
13
|
+
height: "16",
|
|
14
|
+
viewBox: "0 0 256 256",
|
|
15
|
+
fill: "currentColor",
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
children: /* @__PURE__ */ jsx("path", { d: "M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z" })
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function CloseIcon() {
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
"svg",
|
|
24
|
+
{
|
|
25
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
26
|
+
width: "16",
|
|
27
|
+
height: "16",
|
|
28
|
+
viewBox: "0 0 256 256",
|
|
29
|
+
fill: "currentColor",
|
|
30
|
+
"aria-hidden": "true",
|
|
31
|
+
children: /* @__PURE__ */ jsx("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" })
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
6
35
|
function ArrowUpIcon() {
|
|
7
36
|
return /* @__PURE__ */ jsx(
|
|
8
37
|
"svg",
|
|
@@ -54,10 +83,15 @@ function PromptRoot({
|
|
|
54
83
|
autoResize = true,
|
|
55
84
|
submitOnEnter = true,
|
|
56
85
|
variant = "default",
|
|
86
|
+
appearance = "panel",
|
|
87
|
+
onFiles,
|
|
88
|
+
accept,
|
|
57
89
|
className,
|
|
58
90
|
...htmlProps
|
|
59
91
|
}) {
|
|
60
92
|
const textareaRef = React.useRef(null);
|
|
93
|
+
const [dragging, setDragging] = React.useState(false);
|
|
94
|
+
const dragDepth = React.useRef(0);
|
|
61
95
|
const [value, setValue] = useControllableState(
|
|
62
96
|
controlledValue,
|
|
63
97
|
defaultValue,
|
|
@@ -67,6 +101,13 @@ function PromptRoot({
|
|
|
67
101
|
if (disabled || loading || !value.trim()) return;
|
|
68
102
|
onSubmit == null ? void 0 : onSubmit(value);
|
|
69
103
|
}, [disabled, loading, value, onSubmit]);
|
|
104
|
+
const acceptFiles = React.useCallback(
|
|
105
|
+
(files) => {
|
|
106
|
+
if (!onFiles || disabled || loading || files.length === 0) return;
|
|
107
|
+
onFiles(files);
|
|
108
|
+
},
|
|
109
|
+
[onFiles, disabled, loading]
|
|
110
|
+
);
|
|
70
111
|
const contextValue = {
|
|
71
112
|
value,
|
|
72
113
|
setValue,
|
|
@@ -78,12 +119,39 @@ function PromptRoot({
|
|
|
78
119
|
autoResize,
|
|
79
120
|
submitOnEnter,
|
|
80
121
|
handleSubmit,
|
|
81
|
-
textareaRef
|
|
122
|
+
textareaRef,
|
|
123
|
+
accept,
|
|
124
|
+
onFiles: onFiles ? acceptFiles : void 0
|
|
82
125
|
};
|
|
126
|
+
const dropHandlers = onFiles ? {
|
|
127
|
+
onDragEnter: (event) => {
|
|
128
|
+
if (!event.dataTransfer.types.includes("Files")) return;
|
|
129
|
+
dragDepth.current += 1;
|
|
130
|
+
setDragging(true);
|
|
131
|
+
},
|
|
132
|
+
onDragOver: (event) => {
|
|
133
|
+
if (!event.dataTransfer.types.includes("Files")) return;
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
event.dataTransfer.dropEffect = "copy";
|
|
136
|
+
},
|
|
137
|
+
onDragLeave: () => {
|
|
138
|
+
dragDepth.current = Math.max(0, dragDepth.current - 1);
|
|
139
|
+
if (dragDepth.current === 0) setDragging(false);
|
|
140
|
+
},
|
|
141
|
+
onDrop: (event) => {
|
|
142
|
+
if (!event.dataTransfer.types.includes("Files")) return;
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
dragDepth.current = 0;
|
|
145
|
+
setDragging(false);
|
|
146
|
+
acceptFiles(Array.from(event.dataTransfer.files));
|
|
147
|
+
}
|
|
148
|
+
} : null;
|
|
83
149
|
const classes = [
|
|
84
150
|
styles.prompt,
|
|
85
151
|
variant === "fixed" && styles.fixed,
|
|
86
152
|
variant === "sticky" && styles.sticky,
|
|
153
|
+
appearance === "seamless" && styles.seamless,
|
|
154
|
+
dragging && styles.dragging,
|
|
87
155
|
disabled && styles.disabled,
|
|
88
156
|
loading && styles.loading,
|
|
89
157
|
className
|
|
@@ -92,10 +160,13 @@ function PromptRoot({
|
|
|
92
160
|
"div",
|
|
93
161
|
{
|
|
94
162
|
...htmlProps,
|
|
163
|
+
...dropHandlers,
|
|
95
164
|
className: classes,
|
|
96
165
|
"data-disabled": disabled || void 0,
|
|
97
166
|
"data-loading": loading || void 0,
|
|
98
167
|
"data-variant": variant,
|
|
168
|
+
"data-appearance": appearance,
|
|
169
|
+
"data-dragging": dragging || void 0,
|
|
99
170
|
children
|
|
100
171
|
}
|
|
101
172
|
) });
|
|
@@ -105,6 +176,7 @@ function PromptTextarea({
|
|
|
105
176
|
className,
|
|
106
177
|
onChange,
|
|
107
178
|
onKeyDown,
|
|
179
|
+
onPaste,
|
|
108
180
|
"aria-label": ariaLabel,
|
|
109
181
|
...htmlProps
|
|
110
182
|
}) {
|
|
@@ -119,7 +191,8 @@ function PromptTextarea({
|
|
|
119
191
|
autoResize,
|
|
120
192
|
submitOnEnter,
|
|
121
193
|
handleSubmit,
|
|
122
|
-
textareaRef
|
|
194
|
+
textareaRef,
|
|
195
|
+
onFiles
|
|
123
196
|
} = usePromptContext();
|
|
124
197
|
const lineHeight = 1.5;
|
|
125
198
|
const padding = 12;
|
|
@@ -150,6 +223,20 @@ function PromptTextarea({
|
|
|
150
223
|
handleSubmit();
|
|
151
224
|
}
|
|
152
225
|
};
|
|
226
|
+
const handlePaste = (e) => {
|
|
227
|
+
onPaste == null ? void 0 : onPaste(e);
|
|
228
|
+
if (e.defaultPrevented || !onFiles) return;
|
|
229
|
+
const files = Array.from(e.clipboardData.files);
|
|
230
|
+
if (files.length === 0) return;
|
|
231
|
+
e.preventDefault();
|
|
232
|
+
onFiles(
|
|
233
|
+
files.map(
|
|
234
|
+
(file, index) => file.name && file.name !== "image.png" ? file : new File([file], `pasted-${index + 1}.${file.type.split("/")[1] || "png"}`, {
|
|
235
|
+
type: file.type
|
|
236
|
+
})
|
|
237
|
+
)
|
|
238
|
+
);
|
|
239
|
+
};
|
|
153
240
|
const classes = [styles.textarea, className].filter(Boolean).join(" ");
|
|
154
241
|
return /* @__PURE__ */ jsx(
|
|
155
242
|
"textarea",
|
|
@@ -160,6 +247,7 @@ function PromptTextarea({
|
|
|
160
247
|
value,
|
|
161
248
|
onChange: handleChange,
|
|
162
249
|
onKeyDown: handleKeyDown,
|
|
250
|
+
onPaste: handlePaste,
|
|
163
251
|
placeholder: overridePlaceholder ?? placeholder,
|
|
164
252
|
disabled: disabled || loading,
|
|
165
253
|
rows: minRows,
|
|
@@ -240,6 +328,107 @@ function PromptModeButton({
|
|
|
240
328
|
}
|
|
241
329
|
);
|
|
242
330
|
}
|
|
331
|
+
function formatSize(bytes) {
|
|
332
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
333
|
+
const kb = bytes / 1024;
|
|
334
|
+
if (kb < 1024) return `${Math.round(kb)} KB`;
|
|
335
|
+
return `${(kb / 1024).toFixed(kb / 1024 < 10 ? 1 : 0)} MB`;
|
|
336
|
+
}
|
|
337
|
+
function PromptAttachments({ items, onRemove, className }) {
|
|
338
|
+
if (items.length === 0) return null;
|
|
339
|
+
const classes = [styles.attachments, className].filter(Boolean).join(" ");
|
|
340
|
+
return /* @__PURE__ */ jsx("ul", { className: classes, "aria-label": "Attachments", children: items.map((item) => /* @__PURE__ */ jsxs("li", { className: styles.attachment, children: [
|
|
341
|
+
item.previewUrl ? (
|
|
342
|
+
// Decorative: the filename beside it is the accessible name, and a
|
|
343
|
+
// thumbnail of a screenshot has no description worth inventing.
|
|
344
|
+
/* @__PURE__ */ jsx("img", { src: item.previewUrl, alt: "", className: styles.attachmentThumb })
|
|
345
|
+
) : null,
|
|
346
|
+
/* @__PURE__ */ jsx("span", { className: styles.attachmentName, title: item.name, children: item.name }),
|
|
347
|
+
item.size != null && /* @__PURE__ */ jsx("span", { className: styles.attachmentSize, children: formatSize(item.size) }),
|
|
348
|
+
onRemove && /* @__PURE__ */ jsx(
|
|
349
|
+
"button",
|
|
350
|
+
{
|
|
351
|
+
type: "button",
|
|
352
|
+
className: styles.attachmentRemove,
|
|
353
|
+
onClick: () => onRemove(item.id),
|
|
354
|
+
"aria-label": `Remove ${item.name}`,
|
|
355
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
356
|
+
}
|
|
357
|
+
)
|
|
358
|
+
] }, item.id)) });
|
|
359
|
+
}
|
|
360
|
+
function PromptAttach({
|
|
361
|
+
"aria-label": ariaLabel = "Attach files",
|
|
362
|
+
children,
|
|
363
|
+
accept: acceptOverride,
|
|
364
|
+
multiple = true,
|
|
365
|
+
disabled: buttonDisabled,
|
|
366
|
+
className
|
|
367
|
+
}) {
|
|
368
|
+
const { disabled, loading, accept, onFiles } = usePromptContext();
|
|
369
|
+
const inputRef = React.useRef(null);
|
|
370
|
+
const isDisabled = disabled || loading || buttonDisabled || !onFiles;
|
|
371
|
+
const classes = [styles.attach, className].filter(Boolean).join(" ");
|
|
372
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
373
|
+
/* @__PURE__ */ jsx(
|
|
374
|
+
"button",
|
|
375
|
+
{
|
|
376
|
+
type: "button",
|
|
377
|
+
className: classes,
|
|
378
|
+
onClick: () => {
|
|
379
|
+
var _a;
|
|
380
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
381
|
+
},
|
|
382
|
+
disabled: isDisabled,
|
|
383
|
+
"aria-label": ariaLabel,
|
|
384
|
+
children: children ?? /* @__PURE__ */ jsx(PlusIcon, {})
|
|
385
|
+
}
|
|
386
|
+
),
|
|
387
|
+
/* @__PURE__ */ jsx(
|
|
388
|
+
"input",
|
|
389
|
+
{
|
|
390
|
+
ref: inputRef,
|
|
391
|
+
type: "file",
|
|
392
|
+
hidden: true,
|
|
393
|
+
accept: acceptOverride ?? accept,
|
|
394
|
+
multiple,
|
|
395
|
+
onChange: (event) => {
|
|
396
|
+
const files = Array.from(event.target.files ?? []);
|
|
397
|
+
event.target.value = "";
|
|
398
|
+
onFiles == null ? void 0 : onFiles(files);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
] });
|
|
403
|
+
}
|
|
404
|
+
function PromptSelect({
|
|
405
|
+
icon,
|
|
406
|
+
"aria-label": ariaLabel,
|
|
407
|
+
options,
|
|
408
|
+
children,
|
|
409
|
+
placeholder,
|
|
410
|
+
disabled: selectDisabled,
|
|
411
|
+
className,
|
|
412
|
+
...selectProps
|
|
413
|
+
}) {
|
|
414
|
+
const { disabled, loading } = usePromptContext();
|
|
415
|
+
const classes = [styles.select, className].filter(Boolean).join(" ");
|
|
416
|
+
return /* @__PURE__ */ jsxs(
|
|
417
|
+
Select,
|
|
418
|
+
{
|
|
419
|
+
...selectProps,
|
|
420
|
+
size: "sm",
|
|
421
|
+
variant: "ghost",
|
|
422
|
+
options,
|
|
423
|
+
placeholder,
|
|
424
|
+
disabled: disabled || loading || selectDisabled,
|
|
425
|
+
children: [
|
|
426
|
+
/* @__PURE__ */ jsx(Select.Trigger, { className: classes, icon, "aria-label": ariaLabel }),
|
|
427
|
+
/* @__PURE__ */ jsx(Select.Content, { children })
|
|
428
|
+
]
|
|
429
|
+
}
|
|
430
|
+
);
|
|
431
|
+
}
|
|
243
432
|
function PromptUsage({ children, className }) {
|
|
244
433
|
const classes = [styles.usage, className].filter(Boolean).join(" ");
|
|
245
434
|
return /* @__PURE__ */ jsx("span", { className: classes, children });
|
|
@@ -286,6 +475,9 @@ const Prompt = Object.assign(PromptRoot, {
|
|
|
286
475
|
Info: PromptInfo,
|
|
287
476
|
ActionButton: PromptActionButton,
|
|
288
477
|
ModeButton: PromptModeButton,
|
|
478
|
+
Select: PromptSelect,
|
|
479
|
+
Attach: PromptAttach,
|
|
480
|
+
Attachments: PromptAttachments,
|
|
289
481
|
Usage: PromptUsage,
|
|
290
482
|
Submit: PromptSubmit
|
|
291
483
|
});
|
|
@@ -293,9 +485,12 @@ export {
|
|
|
293
485
|
Prompt,
|
|
294
486
|
PromptActionButton,
|
|
295
487
|
PromptActions,
|
|
488
|
+
PromptAttach,
|
|
489
|
+
PromptAttachments,
|
|
296
490
|
PromptInfo,
|
|
297
491
|
PromptModeButton,
|
|
298
492
|
PromptRoot,
|
|
493
|
+
PromptSelect,
|
|
299
494
|
PromptSubmit,
|
|
300
495
|
PromptTab,
|
|
301
496
|
PromptTabs,
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const wrapper = "
|
|
4
|
-
const label = "
|
|
5
|
-
const helper = "
|
|
6
|
-
const helperError = "
|
|
7
|
-
const errorMessage = "
|
|
8
|
-
const trigger = "
|
|
9
|
-
const triggerSm = "
|
|
10
|
-
const triggerLg = "
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
3
|
+
const wrapper = "_wrapper_9zaqb_1";
|
|
4
|
+
const label = "_label_9zaqb_6";
|
|
5
|
+
const helper = "_helper_9zaqb_19";
|
|
6
|
+
const helperError = "_helperError_9zaqb_26";
|
|
7
|
+
const errorMessage = "_errorMessage_9zaqb_30";
|
|
8
|
+
const trigger = "_trigger_9zaqb_36";
|
|
9
|
+
const triggerSm = "_triggerSm_9zaqb_99";
|
|
10
|
+
const triggerLg = "_triggerLg_9zaqb_106";
|
|
11
|
+
const triggerGhost = "_triggerGhost_9zaqb_113";
|
|
12
|
+
const wrapperGhost = "_wrapperGhost_9zaqb_144";
|
|
13
|
+
const triggerIcon = "_triggerIcon_9zaqb_149";
|
|
14
|
+
const value = "_value_9zaqb_157";
|
|
15
|
+
const placeholder = "_placeholder_9zaqb_170";
|
|
16
|
+
const hint = "_hint_9zaqb_174";
|
|
17
|
+
const icon = "_icon_9zaqb_180";
|
|
18
|
+
const positioner = "_positioner_9zaqb_195";
|
|
19
|
+
const popup = "_popup_9zaqb_200";
|
|
20
|
+
const item = "_item_9zaqb_238";
|
|
21
|
+
const itemIndicator = "_itemIndicator_9zaqb_287";
|
|
22
|
+
const group = "_group_9zaqb_301";
|
|
23
|
+
const groupLabel = "_groupLabel_9zaqb_307";
|
|
20
24
|
const styles = {
|
|
21
25
|
wrapper,
|
|
22
26
|
label,
|
|
@@ -26,8 +30,12 @@ const styles = {
|
|
|
26
30
|
trigger,
|
|
27
31
|
triggerSm,
|
|
28
32
|
triggerLg,
|
|
33
|
+
triggerGhost,
|
|
34
|
+
wrapperGhost,
|
|
35
|
+
triggerIcon,
|
|
29
36
|
value,
|
|
30
37
|
placeholder,
|
|
38
|
+
hint,
|
|
31
39
|
icon,
|
|
32
40
|
positioner,
|
|
33
41
|
popup,
|
|
@@ -42,6 +50,7 @@ exports.group = group;
|
|
|
42
50
|
exports.groupLabel = groupLabel;
|
|
43
51
|
exports.helper = helper;
|
|
44
52
|
exports.helperError = helperError;
|
|
53
|
+
exports.hint = hint;
|
|
45
54
|
exports.icon = icon;
|
|
46
55
|
exports.item = item;
|
|
47
56
|
exports.itemIndicator = itemIndicator;
|
|
@@ -50,7 +59,10 @@ exports.placeholder = placeholder;
|
|
|
50
59
|
exports.popup = popup;
|
|
51
60
|
exports.positioner = positioner;
|
|
52
61
|
exports.trigger = trigger;
|
|
62
|
+
exports.triggerGhost = triggerGhost;
|
|
63
|
+
exports.triggerIcon = triggerIcon;
|
|
53
64
|
exports.triggerLg = triggerLg;
|
|
54
65
|
exports.triggerSm = triggerSm;
|
|
55
66
|
exports.value = value;
|
|
56
67
|
exports.wrapper = wrapper;
|
|
68
|
+
exports.wrapperGhost = wrapperGhost;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
const wrapper = "
|
|
2
|
-
const label = "
|
|
3
|
-
const helper = "
|
|
4
|
-
const helperError = "
|
|
5
|
-
const errorMessage = "
|
|
6
|
-
const trigger = "
|
|
7
|
-
const triggerSm = "
|
|
8
|
-
const triggerLg = "
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
1
|
+
const wrapper = "_wrapper_9zaqb_1";
|
|
2
|
+
const label = "_label_9zaqb_6";
|
|
3
|
+
const helper = "_helper_9zaqb_19";
|
|
4
|
+
const helperError = "_helperError_9zaqb_26";
|
|
5
|
+
const errorMessage = "_errorMessage_9zaqb_30";
|
|
6
|
+
const trigger = "_trigger_9zaqb_36";
|
|
7
|
+
const triggerSm = "_triggerSm_9zaqb_99";
|
|
8
|
+
const triggerLg = "_triggerLg_9zaqb_106";
|
|
9
|
+
const triggerGhost = "_triggerGhost_9zaqb_113";
|
|
10
|
+
const wrapperGhost = "_wrapperGhost_9zaqb_144";
|
|
11
|
+
const triggerIcon = "_triggerIcon_9zaqb_149";
|
|
12
|
+
const value = "_value_9zaqb_157";
|
|
13
|
+
const placeholder = "_placeholder_9zaqb_170";
|
|
14
|
+
const hint = "_hint_9zaqb_174";
|
|
15
|
+
const icon = "_icon_9zaqb_180";
|
|
16
|
+
const positioner = "_positioner_9zaqb_195";
|
|
17
|
+
const popup = "_popup_9zaqb_200";
|
|
18
|
+
const item = "_item_9zaqb_238";
|
|
19
|
+
const itemIndicator = "_itemIndicator_9zaqb_287";
|
|
20
|
+
const group = "_group_9zaqb_301";
|
|
21
|
+
const groupLabel = "_groupLabel_9zaqb_307";
|
|
18
22
|
const styles = {
|
|
19
23
|
wrapper,
|
|
20
24
|
label,
|
|
@@ -24,8 +28,12 @@ const styles = {
|
|
|
24
28
|
trigger,
|
|
25
29
|
triggerSm,
|
|
26
30
|
triggerLg,
|
|
31
|
+
triggerGhost,
|
|
32
|
+
wrapperGhost,
|
|
33
|
+
triggerIcon,
|
|
27
34
|
value,
|
|
28
35
|
placeholder,
|
|
36
|
+
hint,
|
|
29
37
|
icon,
|
|
30
38
|
positioner,
|
|
31
39
|
popup,
|
|
@@ -41,6 +49,7 @@ export {
|
|
|
41
49
|
groupLabel,
|
|
42
50
|
helper,
|
|
43
51
|
helperError,
|
|
52
|
+
hint,
|
|
44
53
|
icon,
|
|
45
54
|
item,
|
|
46
55
|
itemIndicator,
|
|
@@ -49,8 +58,11 @@ export {
|
|
|
49
58
|
popup,
|
|
50
59
|
positioner,
|
|
51
60
|
trigger,
|
|
61
|
+
triggerGhost,
|
|
62
|
+
triggerIcon,
|
|
52
63
|
triggerLg,
|
|
53
64
|
triggerSm,
|
|
54
65
|
value,
|
|
55
|
-
wrapper
|
|
66
|
+
wrapper,
|
|
67
|
+
wrapperGhost
|
|
56
68
|
};
|