@particle-academy/react-fancy 5.8.0 → 5.10.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/index.cjs +27 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +27 -8
- package/dist/index.js.map +1 -1
- package/dist/styles.css +269 -255
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3672,6 +3672,16 @@ type PromptAttachment = {
|
|
|
3672
3672
|
id: string;
|
|
3673
3673
|
name: string;
|
|
3674
3674
|
bytes: number;
|
|
3675
|
+
/**
|
|
3676
|
+
* The file the user actually attached.
|
|
3677
|
+
*
|
|
3678
|
+
* Optional because an attachment restored from a server has no File — but for
|
|
3679
|
+
* anything the user dropped or picked it is always present. Without it a host
|
|
3680
|
+
* can render a chip and nothing else: no POST, no FormData, no send-to-model.
|
|
3681
|
+
*/
|
|
3682
|
+
file?: File;
|
|
3683
|
+
/** MIME type. Hosts branch on this to decide whether a file can be sent as-is. */
|
|
3684
|
+
type?: string;
|
|
3675
3685
|
};
|
|
3676
3686
|
interface PromptInputProps {
|
|
3677
3687
|
/** Token budget for the meter. */
|
package/dist/index.d.ts
CHANGED
|
@@ -3672,6 +3672,16 @@ type PromptAttachment = {
|
|
|
3672
3672
|
id: string;
|
|
3673
3673
|
name: string;
|
|
3674
3674
|
bytes: number;
|
|
3675
|
+
/**
|
|
3676
|
+
* The file the user actually attached.
|
|
3677
|
+
*
|
|
3678
|
+
* Optional because an attachment restored from a server has no File — but for
|
|
3679
|
+
* anything the user dropped or picked it is always present. Without it a host
|
|
3680
|
+
* can render a chip and nothing else: no POST, no FormData, no send-to-model.
|
|
3681
|
+
*/
|
|
3682
|
+
file?: File;
|
|
3683
|
+
/** MIME type. Hosts branch on this to decide whether a file can be sent as-is. */
|
|
3684
|
+
type?: string;
|
|
3675
3685
|
};
|
|
3676
3686
|
interface PromptInputProps {
|
|
3677
3687
|
/** Token budget for the meter. */
|
package/dist/index.js
CHANGED
|
@@ -15271,6 +15271,7 @@ function PromptInput({
|
|
|
15271
15271
|
const [attachments, setAttachments] = useState([]);
|
|
15272
15272
|
const [picker, setPicker] = useState(null);
|
|
15273
15273
|
const taRef = useRef(null);
|
|
15274
|
+
const fileRef = useRef(null);
|
|
15274
15275
|
const [dragOver, setDragOver] = useState(false);
|
|
15275
15276
|
const colors = mentionColor ?? DEFAULT_MENTION_COLOR;
|
|
15276
15277
|
const tokens = useMemo(
|
|
@@ -15377,19 +15378,25 @@ function PromptInput({
|
|
|
15377
15378
|
submit();
|
|
15378
15379
|
}
|
|
15379
15380
|
};
|
|
15380
|
-
const
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
const files = Array.from(e.dataTransfer.files);
|
|
15381
|
+
const attach = (list) => {
|
|
15382
|
+
const files = Array.from(list ?? []);
|
|
15383
|
+
if (files.length === 0) return;
|
|
15384
15384
|
setAttachments((cur) => [
|
|
15385
15385
|
...cur,
|
|
15386
15386
|
...files.map((f) => ({
|
|
15387
|
-
id:
|
|
15387
|
+
id: crypto.randomUUID(),
|
|
15388
15388
|
name: f.name,
|
|
15389
|
-
bytes: f.size
|
|
15389
|
+
bytes: f.size,
|
|
15390
|
+
file: f,
|
|
15391
|
+
type: f.type
|
|
15390
15392
|
}))
|
|
15391
15393
|
]);
|
|
15392
15394
|
};
|
|
15395
|
+
const onDrop = (e) => {
|
|
15396
|
+
e.preventDefault();
|
|
15397
|
+
setDragOver(false);
|
|
15398
|
+
attach(e.dataTransfer.files);
|
|
15399
|
+
};
|
|
15393
15400
|
return /* @__PURE__ */ jsxs(
|
|
15394
15401
|
"div",
|
|
15395
15402
|
{
|
|
@@ -15498,11 +15505,23 @@ function PromptInput({
|
|
|
15498
15505
|
variant: "ghost",
|
|
15499
15506
|
size: "sm",
|
|
15500
15507
|
className: "shrink-0",
|
|
15501
|
-
onClick: () =>
|
|
15502
|
-
},
|
|
15508
|
+
onClick: () => fileRef.current?.click(),
|
|
15503
15509
|
children: "\u{1F4CE} attach"
|
|
15504
15510
|
}
|
|
15505
15511
|
) }),
|
|
15512
|
+
/* @__PURE__ */ jsx(
|
|
15513
|
+
"input",
|
|
15514
|
+
{
|
|
15515
|
+
ref: fileRef,
|
|
15516
|
+
type: "file",
|
|
15517
|
+
multiple: true,
|
|
15518
|
+
className: "hidden",
|
|
15519
|
+
onChange: (e) => {
|
|
15520
|
+
attach(e.target.files);
|
|
15521
|
+
e.target.value = "";
|
|
15522
|
+
}
|
|
15523
|
+
}
|
|
15524
|
+
),
|
|
15506
15525
|
/* @__PURE__ */ jsxs("div", { className: "ml-2 flex min-w-0 items-center gap-1.5 overflow-hidden", children: [
|
|
15507
15526
|
/* @__PURE__ */ jsx("div", { className: "h-1.5 w-24 shrink overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-700", children: /* @__PURE__ */ jsx(
|
|
15508
15527
|
"div",
|