@anvia/react-ui 1.0.0-rc.6 → 1.0.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/README.md +48 -38
- package/dist/attachment/index.d.ts +2 -2
- package/dist/attachment/index.js +4 -4
- package/dist/chat/index.d.ts +8 -8
- package/dist/chat/index.js +10 -9
- package/dist/{chat-BRVgYE68.d.ts → chat-tfA570mg.d.ts} +2 -2
- package/dist/{chunk-ZDSFYPAG.js → chunk-647LAYRV.js} +90 -65
- package/dist/chunk-647LAYRV.js.map +1 -0
- package/dist/chunk-6XOJFLX4.js +22 -0
- package/dist/chunk-6XOJFLX4.js.map +1 -0
- package/dist/{chunk-CI7E67HQ.js → chunk-CRXNFZRW.js} +119 -90
- package/dist/chunk-CRXNFZRW.js.map +1 -0
- package/dist/{chunk-WIV5S327.js → chunk-CVXLQCDI.js} +13 -21
- package/dist/chunk-CVXLQCDI.js.map +1 -0
- package/dist/{chunk-ULGJLLZE.js → chunk-F6AKBUO3.js} +12 -12
- package/dist/chunk-F6AKBUO3.js.map +1 -0
- package/dist/{chunk-CBUEQW2Y.js → chunk-HWJIMLHC.js} +83 -77
- package/dist/chunk-HWJIMLHC.js.map +1 -0
- package/dist/{chunk-LAME27US.js → chunk-MISX4WUT.js} +10 -15
- package/dist/chunk-MISX4WUT.js.map +1 -0
- package/dist/{chunk-AFIEM7PA.js → chunk-OQE6SHZE.js} +16 -30
- package/dist/chunk-OQE6SHZE.js.map +1 -0
- package/dist/{chunk-7WKUHKCF.js → chunk-S4XLE2RN.js} +6 -12
- package/dist/chunk-S4XLE2RN.js.map +1 -0
- package/dist/{chunk-OAQBMWJ5.js → chunk-SOG2GVE4.js} +45 -15
- package/dist/chunk-SOG2GVE4.js.map +1 -0
- package/dist/{chunk-W6Q5UFKR.js → chunk-UCBAG42A.js} +9 -21
- package/dist/chunk-UCBAG42A.js.map +1 -0
- package/dist/completion/index.d.ts +2 -2
- package/dist/completion/index.js +4 -4
- package/dist/{composer-BTT2vzYF.d.ts → composer-CigccTLT.d.ts} +19 -7
- package/dist/human-input/index.d.ts +6 -6
- package/dist/human-input/index.js +4 -4
- package/dist/{human-input-DOBCZgqw.d.ts → human-input-D7jgYsfM.d.ts} +1 -1
- package/dist/image/index.d.ts +2 -2
- package/dist/image/index.js +4 -4
- package/dist/index.d.ts +14 -14
- package/dist/index.js +58 -63
- package/dist/index.js.map +1 -1
- package/dist/message/index.d.ts +4 -4
- package/dist/message/index.js +7 -6
- package/dist/selection-toolbar/index.d.ts +2 -2
- package/dist/selection-toolbar/index.js +5 -4
- package/dist/shared.d.ts +4 -4
- package/dist/shared.js +1 -1
- package/dist/stream/index.d.ts +2 -0
- package/dist/stream/index.js +1 -1
- package/dist/{thread-uEm8hH0s.d.ts → thread-Bz6-1zaJ.d.ts} +1 -0
- package/dist/thread-list/index.d.ts +3 -3
- package/dist/thread-list/index.js +6 -6
- package/package.json +7 -9
- package/dist/chunk-7WKUHKCF.js.map +0 -1
- package/dist/chunk-AFIEM7PA.js.map +0 -1
- package/dist/chunk-CBUEQW2Y.js.map +0 -1
- package/dist/chunk-CI7E67HQ.js.map +0 -1
- package/dist/chunk-LAME27US.js.map +0 -1
- package/dist/chunk-OAQBMWJ5.js.map +0 -1
- package/dist/chunk-ULGJLLZE.js.map +0 -1
- package/dist/chunk-W6Q5UFKR.js.map +0 -1
- package/dist/chunk-WIV5S327.js.map +0 -1
- package/dist/chunk-ZDSFYPAG.js.map +0 -1
- package/dist/stream/styles.css +0 -17
- package/dist/styles.css +0 -130
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { AttachmentPrimitive } from './attachment/index.js';
|
|
2
2
|
export { A as AttachmentContextValue, u as useAttachment } from './attachment-mbjsroli.js';
|
|
3
|
-
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-
|
|
3
|
+
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-tfA570mg.js';
|
|
4
4
|
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-DHlwrhxB.js';
|
|
5
|
-
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-
|
|
6
|
-
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-
|
|
5
|
+
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-CigccTLT.js';
|
|
6
|
+
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-D7jgYsfM.js';
|
|
7
7
|
export { I as ImageContextValue, u as useImage } from './image-VZv6Ddsn.js';
|
|
8
8
|
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-CNRnZQwU.js';
|
|
9
9
|
export { S as SelectionToolbarContextValue, a as SelectionToolbarSelection, u as useSelectionToolbar } from './selection-toolbar-Cwjbuv5S.js';
|
|
10
|
-
export { T as ThreadContextValue, u as useThread } from './thread-
|
|
10
|
+
export { T as ThreadContextValue, u as useThread } from './thread-Bz6-1zaJ.js';
|
|
11
11
|
export { T as ThreadListController, a as ThreadListItemContextValue, b as ThreadListProvider, c as ThreadListProviderProps, d as ThreadListRecord, u as useThreadList, e as useThreadListItem } from './thread-list-On8db4XL.js';
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
12
|
+
export { ComposerPrimitive, ComposerSubmitMessage, ComposerSubmitMessageArgs, ThreadPrimitive } from './chat/index.js';
|
|
13
|
+
export { CompletionPrimitive } from './completion/index.js';
|
|
14
14
|
import * as react from 'react';
|
|
15
15
|
import { ReactNode } from 'react';
|
|
16
16
|
import { UseChatResult } from '@anvia/react';
|
|
17
17
|
import { P as PrimitiveProps } from './render-CRKWam2v.js';
|
|
18
18
|
export { a as PrimitiveRef } from './render-CRKWam2v.js';
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
19
|
+
export { HumanInputPrimitive } from './human-input/index.js';
|
|
20
|
+
export { ImagePrimitive } from './image/index.js';
|
|
21
|
+
export { MessageAttachmentPart, MessageEntityProps, MessagePartsFilter, MessagePrimitive, MessageStreamOptions, MessageToolPart, MessageToolRenderWhen } from './message/index.js';
|
|
22
|
+
export { SelectionToolbarPrimitive } from './selection-toolbar/index.js';
|
|
23
23
|
export { StreamMarkdown, StreamMarkdownProps } from './stream/index.js';
|
|
24
|
-
export {
|
|
24
|
+
export { ThreadListItemPrimitive, ThreadListPrimitive } from './thread-list/index.js';
|
|
25
25
|
import '@anvia/client';
|
|
26
26
|
import 'react-markdown';
|
|
27
27
|
|
|
@@ -31,10 +31,10 @@ type ContextMeterProps = Omit<PrimitiveProps<"div">, "children"> & {
|
|
|
31
31
|
display?: "remaining" | "used";
|
|
32
32
|
children?: ReactNode | ((usage: ContextUsage) => ReactNode);
|
|
33
33
|
};
|
|
34
|
-
declare const
|
|
34
|
+
declare const ContextMeterPrimitive: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
35
35
|
usage?: ContextUsage;
|
|
36
36
|
display?: "remaining" | "used";
|
|
37
37
|
children?: ReactNode | ((usage: ContextUsage) => ReactNode);
|
|
38
38
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
39
39
|
|
|
40
|
-
export {
|
|
40
|
+
export { ContextMeterPrimitive, type ContextMeterProps, PrimitiveProps };
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
SelectionToolbarPrimitive
|
|
3
|
+
} from "./chunk-UCBAG42A.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
5
|
+
ThreadListItemPrimitive,
|
|
6
|
+
ThreadListPrimitive
|
|
7
|
+
} from "./chunk-647LAYRV.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./chunk-
|
|
9
|
+
ComposerPrimitive,
|
|
10
|
+
ThreadPrimitive
|
|
11
|
+
} from "./chunk-HWJIMLHC.js";
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
} from "./chunk-
|
|
13
|
+
CompletionPrimitive
|
|
14
|
+
} from "./chunk-S4XLE2RN.js";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
HumanInputPrimitive
|
|
17
|
+
} from "./chunk-OQE6SHZE.js";
|
|
18
18
|
import {
|
|
19
|
-
|
|
20
|
-
} from "./chunk-
|
|
19
|
+
ImagePrimitive
|
|
20
|
+
} from "./chunk-CVXLQCDI.js";
|
|
21
21
|
import {
|
|
22
|
-
|
|
23
|
-
} from "./chunk-
|
|
22
|
+
MessagePrimitive
|
|
23
|
+
} from "./chunk-CRXNFZRW.js";
|
|
24
|
+
import "./chunk-6XOJFLX4.js";
|
|
24
25
|
import {
|
|
25
26
|
StreamMarkdown
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-F6AKBUO3.js";
|
|
27
28
|
import {
|
|
28
|
-
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
AttachmentPrimitive
|
|
30
|
+
} from "./chunk-MISX4WUT.js";
|
|
30
31
|
import "./chunk-CKA4CE26.js";
|
|
31
32
|
import {
|
|
32
33
|
renderPrimitive
|
|
@@ -51,60 +52,54 @@ import {
|
|
|
51
52
|
useThread,
|
|
52
53
|
useThreadList,
|
|
53
54
|
useThreadListItem
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-SOG2GVE4.js";
|
|
55
56
|
|
|
56
57
|
// src/context-meter.tsx
|
|
57
58
|
import { forwardRef } from "react";
|
|
58
59
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
69
|
-
"span",
|
|
60
|
+
var ContextMeterPrimitive = forwardRef(
|
|
61
|
+
function ContextMeter({ usage, display = "remaining", children, ...props }, ref) {
|
|
62
|
+
if (usage === void 0) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const percent = display === "remaining" ? usage.remainingPercent : usage.usedPercent;
|
|
66
|
+
const roundedPercent = Math.round(percent);
|
|
67
|
+
const label = `${roundedPercent}% context ${display === "remaining" ? "left" : "used"}`;
|
|
68
|
+
const content = typeof children === "function" ? children(usage) : children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
70
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { style: { width: `${Math.min(100, Math.max(0, percent))}%` } }) })
|
|
71
|
+
] });
|
|
72
|
+
return renderPrimitive(
|
|
73
|
+
"div",
|
|
70
74
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"aria-valuemin": 0,
|
|
84
|
-
"aria-valuenow": roundedPercent,
|
|
85
|
-
"data-anvia-context-meter": "",
|
|
86
|
-
"data-display": display,
|
|
87
|
-
role: props.role ?? "progressbar"
|
|
88
|
-
},
|
|
89
|
-
ref
|
|
90
|
-
);
|
|
91
|
-
});
|
|
75
|
+
...props,
|
|
76
|
+
children: content,
|
|
77
|
+
"aria-label": props["aria-label"] ?? label,
|
|
78
|
+
"aria-valuemax": 100,
|
|
79
|
+
"aria-valuemin": 0,
|
|
80
|
+
"aria-valuenow": roundedPercent,
|
|
81
|
+
role: props.role ?? "progressbar"
|
|
82
|
+
},
|
|
83
|
+
ref
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
);
|
|
92
87
|
export {
|
|
93
|
-
|
|
88
|
+
AttachmentPrimitive,
|
|
94
89
|
ChatProvider,
|
|
95
|
-
|
|
90
|
+
CompletionPrimitive,
|
|
96
91
|
CompletionProvider,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
ComposerPrimitive,
|
|
93
|
+
ContextMeterPrimitive,
|
|
94
|
+
HumanInputPrimitive,
|
|
95
|
+
ImagePrimitive,
|
|
96
|
+
MessagePrimitive,
|
|
97
|
+
SelectionToolbarPrimitive,
|
|
103
98
|
StreamMarkdown,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
ThreadListItem,
|
|
99
|
+
ThreadListItemPrimitive,
|
|
100
|
+
ThreadListPrimitive,
|
|
107
101
|
ThreadListProvider,
|
|
102
|
+
ThreadPrimitive,
|
|
108
103
|
useApproval,
|
|
109
104
|
useAttachment,
|
|
110
105
|
useChatContext,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/context-meter.tsx"],"sourcesContent":["import type { UseChatResult } from \"@anvia/react\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { type PrimitiveProps, renderPrimitive } from \"./primitives\";\n\ntype ContextUsage = NonNullable<UseChatResult[\"contextUsage\"]>;\n\nexport type ContextMeterProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n usage?: ContextUsage;\n display?: \"remaining\" | \"used\";\n children?: ReactNode | ((usage: ContextUsage) => ReactNode);\n};\n\nexport const
|
|
1
|
+
{"version":3,"sources":["../src/context-meter.tsx"],"sourcesContent":["import type { UseChatResult } from \"@anvia/react\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { type PrimitiveProps, renderPrimitive } from \"./primitives\";\n\ntype ContextUsage = NonNullable<UseChatResult[\"contextUsage\"]>;\n\nexport type ContextMeterProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n usage?: ContextUsage;\n display?: \"remaining\" | \"used\";\n children?: ReactNode | ((usage: ContextUsage) => ReactNode);\n};\n\nexport const ContextMeterPrimitive = forwardRef<HTMLDivElement, ContextMeterProps>(\n function ContextMeter({ usage, display = \"remaining\", children, ...props }, ref) {\n if (usage === undefined) {\n return null;\n }\n\n const percent = display === \"remaining\" ? usage.remainingPercent : usage.usedPercent;\n const roundedPercent = Math.round(percent);\n const label = `${roundedPercent}% context ${display === \"remaining\" ? \"left\" : \"used\"}`;\n const content =\n typeof children === \"function\"\n ? children(usage)\n : (children ?? (\n <>\n <span>{label}</span>\n <span aria-hidden=\"true\">\n <span style={{ width: `${Math.min(100, Math.max(0, percent))}%` }} />\n </span>\n </>\n ));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: content,\n \"aria-label\": props[\"aria-label\"] ?? label,\n \"aria-valuemax\": 100,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": roundedPercent,\n role: props.role ?? \"progressbar\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,kBAAkC;AAyB/B,mBACE,KADF;AAbL,IAAM,wBAAwB;AAAA,EACnC,SAAS,aAAa,EAAE,OAAO,UAAU,aAAa,UAAU,GAAG,MAAM,GAAG,KAAK;AAC/E,QAAI,UAAU,QAAW;AACvB,aAAO;AAAA,IACT;AAEA,UAAM,UAAU,YAAY,cAAc,MAAM,mBAAmB,MAAM;AACzE,UAAM,iBAAiB,KAAK,MAAM,OAAO;AACzC,UAAM,QAAQ,GAAG,cAAc,aAAa,YAAY,cAAc,SAAS,MAAM;AACrF,UAAM,UACJ,OAAO,aAAa,aAChB,SAAS,KAAK,IACb,YACC,iCACE;AAAA,0BAAC,UAAM,iBAAM;AAAA,MACb,oBAAC,UAAK,eAAY,QAChB,8BAAC,UAAK,OAAO,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC,IAAI,GAAG,GACrE;AAAA,OACF;AAGR,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,UAAU;AAAA,QACV,cAAc,MAAM,YAAY,KAAK;AAAA,QACrC,iBAAiB;AAAA,QACjB,iBAAiB;AAAA,QACjB,iBAAiB;AAAA,QACjB,MAAM,MAAM,QAAQ;AAAA,MACtB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
package/dist/message/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { UIMessagePart } from '@anvia/client';
|
|
|
4
4
|
import { StreamSmoothingLifecycle } from '@anvia/react';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { HTMLAttributes } from 'react';
|
|
7
|
-
export { u as useChatContext } from '../chat-
|
|
8
|
-
import { d as ComposerEntity } from '../composer-
|
|
7
|
+
export { u as useChatContext } from '../chat-tfA570mg.js';
|
|
8
|
+
import { d as ComposerEntity } from '../composer-CigccTLT.js';
|
|
9
9
|
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from '../message-CNRnZQwU.js';
|
|
10
10
|
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
11
11
|
|
|
@@ -23,7 +23,7 @@ type MessageEntityProps = HTMLAttributes<HTMLSpanElement> & {
|
|
|
23
23
|
entity: ComposerEntity;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
declare const
|
|
26
|
+
declare const MessagePrimitive: {
|
|
27
27
|
readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"article">, "children"> & {
|
|
28
28
|
children?: react.ReactNode | ((message: _anvia_client.UIMessage) => react.ReactNode);
|
|
29
29
|
} & react.RefAttributes<HTMLElement>>;
|
|
@@ -102,4 +102,4 @@ declare const Message: {
|
|
|
102
102
|
} & react.RefAttributes<HTMLButtonElement>>;
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
export {
|
|
105
|
+
export { type MessageAttachmentPart, type MessageEntityProps, type MessagePartsFilter, MessagePrimitive, type MessageStreamOptions, type MessageToolPart, type MessageToolRenderWhen };
|
package/dist/message/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
2
|
+
MessagePrimitive
|
|
3
|
+
} from "../chunk-CRXNFZRW.js";
|
|
4
|
+
import "../chunk-6XOJFLX4.js";
|
|
5
|
+
import "../chunk-F6AKBUO3.js";
|
|
6
|
+
import "../chunk-MISX4WUT.js";
|
|
6
7
|
import "../chunk-CKA4CE26.js";
|
|
7
8
|
import "../chunk-T3ZFZ3NP.js";
|
|
8
9
|
import {
|
|
9
10
|
useChatContext,
|
|
10
11
|
useMessage,
|
|
11
12
|
useMessagePart
|
|
12
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-SOG2GVE4.js";
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
+
MessagePrimitive,
|
|
15
16
|
useChatContext,
|
|
16
17
|
useMessage,
|
|
17
18
|
useMessagePart
|
|
@@ -3,7 +3,7 @@ import { a as SelectionToolbarSelection } from '../selection-toolbar-Cwjbuv5S.js
|
|
|
3
3
|
export { S as SelectionToolbarContextValue, u as useSelectionToolbar } from '../selection-toolbar-Cwjbuv5S.js';
|
|
4
4
|
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
5
5
|
|
|
6
|
-
declare const
|
|
6
|
+
declare const SelectionToolbarPrimitive: {
|
|
7
7
|
readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
8
8
|
children?: react.ReactNode;
|
|
9
9
|
container?: Element | DocumentFragment;
|
|
@@ -18,4 +18,4 @@ declare const SelectionToolbar: {
|
|
|
18
18
|
} & react.RefAttributes<HTMLButtonElement>>;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export {
|
|
21
|
+
export { SelectionToolbarPrimitive, SelectionToolbarSelection };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
2
|
+
SelectionToolbarPrimitive
|
|
3
|
+
} from "../chunk-UCBAG42A.js";
|
|
4
|
+
import "../chunk-6XOJFLX4.js";
|
|
4
5
|
import "../chunk-T3ZFZ3NP.js";
|
|
5
6
|
import {
|
|
6
7
|
useSelectionToolbar
|
|
7
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-SOG2GVE4.js";
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
+
SelectionToolbarPrimitive,
|
|
10
11
|
useSelectionToolbar
|
|
11
12
|
};
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { A as AttachmentContextValue, u as useAttachment } from './attachment-mbjsroli.js';
|
|
2
|
-
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-
|
|
2
|
+
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-tfA570mg.js';
|
|
3
3
|
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-DHlwrhxB.js';
|
|
4
|
-
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-
|
|
5
|
-
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-
|
|
4
|
+
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-CigccTLT.js';
|
|
5
|
+
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-D7jgYsfM.js';
|
|
6
6
|
export { I as ImageContextValue, u as useImage } from './image-VZv6Ddsn.js';
|
|
7
7
|
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-CNRnZQwU.js';
|
|
8
8
|
export { S as SelectionToolbarContextValue, a as SelectionToolbarSelection, u as useSelectionToolbar } from './selection-toolbar-Cwjbuv5S.js';
|
|
9
|
-
export { T as ThreadContextValue, u as useThread } from './thread-
|
|
9
|
+
export { T as ThreadContextValue, u as useThread } from './thread-Bz6-1zaJ.js';
|
|
10
10
|
export { T as ThreadListController, a as ThreadListItemContextValue, b as ThreadListProvider, c as ThreadListProviderProps, d as ThreadListRecord, u as useThreadList, e as useThreadListItem } from './thread-list-On8db4XL.js';
|
|
11
11
|
export { P as PrimitiveProps, a as PrimitiveRef } from './render-CRKWam2v.js';
|
|
12
12
|
import '@anvia/client';
|
package/dist/shared.js
CHANGED
package/dist/stream/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Components, Options } from 'react-markdown';
|
|
|
3
3
|
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
4
4
|
|
|
5
5
|
type StreamMarkdownProps = Omit<PrimitiveProps<"div">, "children"> & {
|
|
6
|
+
"data-state"?: string | undefined;
|
|
6
7
|
components?: Components;
|
|
7
8
|
content: string;
|
|
8
9
|
live?: boolean;
|
|
@@ -10,6 +11,7 @@ type StreamMarkdownProps = Omit<PrimitiveProps<"div">, "children"> & {
|
|
|
10
11
|
remarkRehypeOptions?: Options["remarkRehypeOptions"];
|
|
11
12
|
};
|
|
12
13
|
declare const StreamMarkdown: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
14
|
+
"data-state"?: string | undefined;
|
|
13
15
|
components?: Components;
|
|
14
16
|
content: string;
|
|
15
17
|
live?: boolean;
|
package/dist/stream/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { MutableRefObject } from 'react';
|
|
|
2
2
|
|
|
3
3
|
type ThreadContextValue = {
|
|
4
4
|
viewportRef: MutableRefObject<HTMLElement | null>;
|
|
5
|
+
messagesRef: MutableRefObject<HTMLElement | null>;
|
|
5
6
|
atBottom: boolean;
|
|
6
7
|
setAtBottom(atBottom: boolean): void;
|
|
7
8
|
scrollToBottom(behavior?: ScrollBehavior): void;
|
|
@@ -3,7 +3,7 @@ import { d as ThreadListRecord } from '../thread-list-On8db4XL.js';
|
|
|
3
3
|
export { T as ThreadListController, a as ThreadListItemContextValue, b as ThreadListProvider, c as ThreadListProviderProps, u as useThreadList, e as useThreadListItem } from '../thread-list-On8db4XL.js';
|
|
4
4
|
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
5
5
|
|
|
6
|
-
declare const
|
|
6
|
+
declare const ThreadListPrimitive: {
|
|
7
7
|
readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
8
8
|
asChild?: boolean;
|
|
9
9
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
@@ -21,7 +21,7 @@ declare const ThreadList: {
|
|
|
21
21
|
archived?: boolean;
|
|
22
22
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
23
23
|
};
|
|
24
|
-
declare const
|
|
24
|
+
declare const ThreadListItemPrimitive: {
|
|
25
25
|
readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
26
26
|
asChild?: boolean;
|
|
27
27
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
@@ -44,4 +44,4 @@ declare const ThreadListItem: {
|
|
|
44
44
|
} & react.RefAttributes<HTMLButtonElement>>;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
export {
|
|
47
|
+
export { ThreadListItemPrimitive, ThreadListPrimitive, ThreadListRecord };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "../chunk-
|
|
2
|
+
ThreadListItemPrimitive,
|
|
3
|
+
ThreadListPrimitive
|
|
4
|
+
} from "../chunk-647LAYRV.js";
|
|
5
5
|
import "../chunk-T3ZFZ3NP.js";
|
|
6
6
|
import {
|
|
7
7
|
ThreadListProvider,
|
|
8
8
|
useThreadList,
|
|
9
9
|
useThreadListItem
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-SOG2GVE4.js";
|
|
11
11
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
ThreadListItemPrimitive,
|
|
13
|
+
ThreadListPrimitive,
|
|
14
14
|
ThreadListProvider,
|
|
15
15
|
useThreadList,
|
|
16
16
|
useThreadListItem
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvia/react-ui",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Composable React UI primitives for Anvia chat and completion experiences.",
|
|
5
5
|
"author": "anvia",
|
|
6
6
|
"maintainer": "Indra Zulfi",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"types": "./dist/stream/index.d.ts",
|
|
57
57
|
"import": "./dist/stream/index.js"
|
|
58
58
|
},
|
|
59
|
-
"./stream/styles.css": "./dist/stream/styles.css",
|
|
60
59
|
"./shared": {
|
|
61
60
|
"types": "./dist/shared.d.ts",
|
|
62
61
|
"import": "./dist/shared.js"
|
|
@@ -64,8 +63,7 @@
|
|
|
64
63
|
"./thread-list": {
|
|
65
64
|
"types": "./dist/thread-list/index.d.ts",
|
|
66
65
|
"import": "./dist/thread-list/index.js"
|
|
67
|
-
}
|
|
68
|
-
"./styles.css": "./dist/styles.css"
|
|
66
|
+
}
|
|
69
67
|
},
|
|
70
68
|
"dependencies": {
|
|
71
69
|
"@radix-ui/react-slot": "^1.3.3",
|
|
@@ -86,8 +84,8 @@
|
|
|
86
84
|
"peerDependencies": {
|
|
87
85
|
"react": ">=18",
|
|
88
86
|
"react-dom": ">=18",
|
|
89
|
-
"@anvia/client": "1.0.0
|
|
90
|
-
"@anvia/react": "1.0.0
|
|
87
|
+
"@anvia/client": "1.0.0",
|
|
88
|
+
"@anvia/react": "1.0.0"
|
|
91
89
|
},
|
|
92
90
|
"devDependencies": {
|
|
93
91
|
"@testing-library/react": "^16.3.2",
|
|
@@ -101,11 +99,11 @@
|
|
|
101
99
|
"tsup": "^8.5.0",
|
|
102
100
|
"typescript": "^5.9.3",
|
|
103
101
|
"vitest": "^4.0.8",
|
|
104
|
-
"@anvia/client": "1.0.0
|
|
105
|
-
"@anvia/react": "1.0.0
|
|
102
|
+
"@anvia/client": "1.0.0",
|
|
103
|
+
"@anvia/react": "1.0.0"
|
|
106
104
|
},
|
|
107
105
|
"scripts": {
|
|
108
|
-
"build": "tsup src/index.ts src/attachment/index.ts src/chat/index.ts src/completion/index.ts src/human-input/index.ts src/image/index.ts src/message/index.ts src/selection-toolbar/index.ts src/shared.ts src/stream/index.ts src/thread-list/index.ts --format esm --dts --sourcemap --clean --external react --external react-dom
|
|
106
|
+
"build": "tsup src/index.ts src/attachment/index.ts src/chat/index.ts src/completion/index.ts src/human-input/index.ts src/image/index.ts src/message/index.ts src/selection-toolbar/index.ts src/shared.ts src/stream/index.ts src/thread-list/index.ts --format esm --dts --sourcemap --clean --external react --external react-dom",
|
|
109
107
|
"coverage": "vitest run --coverage",
|
|
110
108
|
"test": "vitest run",
|
|
111
109
|
"typecheck": "tsc --noEmit"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/completion/form.tsx","../src/completion/root.tsx","../src/completion/index.ts"],"sourcesContent":["import {\n type ChangeEvent,\n type FormEvent,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n useCallback,\n useMemo,\n} from \"react\";\n\nimport {\n type CompletionInputContextValue,\n InternalCompletionInputProvider,\n useCompletionContext,\n useCompletionInput,\n} from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\nconst CompletionForm = forwardRef<HTMLFormElement, PrimitiveProps<\"form\">>(function CompletionForm(\n { onSubmit, ...props },\n ref,\n) {\n const completion = useCompletionContext();\n const active = completion.status === \"submitted\" || completion.status === \"streaming\";\n const canSubmit = completion.input.trim().length > 0 && !active;\n const canStop = active;\n\n const submit = useCallback(async () => {\n if (!canSubmit) {\n return;\n }\n await completion.submit();\n }, [canSubmit, completion]);\n\n const value = useMemo<CompletionInputContextValue>(\n () => ({\n input: completion.input,\n setInput: completion.setInput,\n submit,\n stop: completion.stop,\n status: completion.status,\n canSubmit,\n canStop,\n }),\n [\n canStop,\n canSubmit,\n completion.input,\n completion.setInput,\n completion.status,\n completion.stop,\n submit,\n ],\n );\n\n const handleSubmit = useCallback(\n (event: FormEvent<HTMLFormElement>) => {\n (onSubmit as ((event: FormEvent<HTMLFormElement>) => void) | undefined)?.(event);\n if (event.defaultPrevented) {\n return;\n }\n event.preventDefault();\n void submit();\n },\n [onSubmit, submit],\n );\n\n return (\n <InternalCompletionInputProvider value={value}>\n {renderPrimitive(\n \"form\",\n {\n ...props,\n onSubmit: handleSubmit,\n \"data-anvia-completion-form\": \"\",\n \"data-state\": completion.status,\n } as PrimitiveProps<\"form\">,\n ref,\n )}\n </InternalCompletionInputProvider>\n );\n});\n\nconst CompletionInput = forwardRef<HTMLTextAreaElement, PrimitiveProps<\"textarea\">>(\n function CompletionInput({ onChange, onKeyDown, ...props }, ref) {\n const input = useCompletionInput();\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n if (!event.defaultPrevented) {\n input.setInput(event.currentTarget.value);\n }\n },\n [input, onChange],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLTextAreaElement>) => {\n onKeyDown?.(event);\n if (\n event.defaultPrevented ||\n event.key !== \"Enter\" ||\n event.shiftKey ||\n event.nativeEvent.isComposing\n ) {\n return;\n }\n event.preventDefault();\n void input.submit();\n },\n [input, onKeyDown],\n );\n\n return renderPrimitive(\n \"textarea\",\n {\n ...props,\n \"aria-label\": props[\"aria-label\"] ?? \"Prompt\",\n disabled: props.disabled ?? (input.status === \"submitted\" || input.status === \"streaming\"),\n onChange: handleChange,\n onKeyDown: handleKeyDown,\n value: input.input,\n \"data-anvia-completion-input\": \"\",\n } as PrimitiveProps<\"textarea\">,\n ref,\n );\n },\n);\n\nconst CompletionSubmit = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function CompletionSubmit(props, ref) {\n const input = useCompletionInput();\n const disabled = props.disabled ?? !input.canSubmit;\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Complete\",\n disabled,\n type: props.type ?? \"submit\",\n \"data-anvia-completion-submit\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nconst CompletionStop = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function CompletionStop({ onClick, ...props }, ref) {\n const input = useCompletionInput();\n const disabled = props.disabled ?? !input.canStop;\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n input.stop();\n },\n [disabled, input, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Stop\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-completion-stop\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nexport { CompletionForm, CompletionInput, CompletionStop, CompletionSubmit };\n","import { forwardRef, type ReactNode } from \"react\";\n\nimport { useCompletionContext } from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype CompletionOutputChildren = ReactNode | ((completion: string) => ReactNode);\n\nconst CompletionRoot = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function CompletionRoot(props, ref) {\n const completion = useCompletionContext();\n return renderPrimitive(\n \"div\",\n {\n ...props,\n \"data-anvia-completion\": \"\",\n \"data-state\": completion.status,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype CompletionOutputProps = PrimitiveProps<\"div\"> & {\n children?: CompletionOutputChildren;\n};\n\nconst CompletionOutput = forwardRef<HTMLDivElement, CompletionOutputProps>(\n function CompletionOutput({ children, ...props }, ref) {\n const completion = useCompletionContext();\n const renderedChildren =\n typeof children === \"function\" ? children(completion.completion) : children;\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren ?? completion.completion,\n \"data-anvia-completion-output\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nexport { CompletionOutput, CompletionRoot };\n","import { CompletionForm, CompletionInput, CompletionStop, CompletionSubmit } from \"./form\";\nimport { CompletionOutput, CompletionRoot } from \"./root\";\n\nexport const Completion = {\n Root: CompletionRoot,\n Output: CompletionOutput,\n Form: CompletionForm,\n Input: CompletionInput,\n Submit: CompletionSubmit,\n Stop: CompletionStop,\n} as const;\n\nexport type {\n CompletionController,\n CompletionInputContextValue,\n CompletionProviderProps,\n} from \"../contexts\";\nexport { CompletionProvider, useCompletionContext, useCompletionInput } from \"../contexts\";\n"],"mappings":";;;;;;;;;;AAAA;AAAA,EAGE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AA4DH;AAlDJ,IAAM,iBAAiB,WAAoD,SAASA,gBAClF,EAAE,UAAU,GAAG,MAAM,GACrB,KACA;AACA,QAAM,aAAa,qBAAqB;AACxC,QAAM,SAAS,WAAW,WAAW,eAAe,WAAW,WAAW;AAC1E,QAAM,YAAY,WAAW,MAAM,KAAK,EAAE,SAAS,KAAK,CAAC;AACzD,QAAM,UAAU;AAEhB,QAAM,SAAS,YAAY,YAAY;AACrC,QAAI,CAAC,WAAW;AACd;AAAA,IACF;AACA,UAAM,WAAW,OAAO;AAAA,EAC1B,GAAG,CAAC,WAAW,UAAU,CAAC;AAE1B,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,OAAO,WAAW;AAAA,MAClB,UAAU,WAAW;AAAA,MACrB;AAAA,MACA,MAAM,WAAW;AAAA,MACjB,QAAQ,WAAW;AAAA,MACnB;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;A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BAAmBD;AAAA,EACvB,SAASE,kBAAiB,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK;AACrD,UAAM,aAAa,qBAAqB;AACxC,UAAM,mBACJ,OAAO,aAAa,aAAa,SAAS,WAAW,UAAU,IAAI;AAErE,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,UAAU,oBAAoB,WAAW;AAAA,QACzC,gCAAgC;AAAA,MAClC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;;;ACvCO,IAAM,aAAa;AAAA,EACxB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACR;","names":["CompletionForm","CompletionInput","CompletionSubmit","CompletionStop","forwardRef","forwardRef","CompletionRoot","CompletionOutput"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/human-input/approvals.tsx","../src/human-input/panel.tsx","../src/human-input/questions.tsx","../src/human-input/index.ts"],"sourcesContent":["import { type ChangeEvent, forwardRef, type MouseEvent, type ReactNode, useCallback } from \"react\";\n\nimport {\n type ApprovalInteraction,\n InternalApprovalProvider,\n useApproval,\n useChatContext,\n useHumanInput,\n} from \"../contexts\";\nimport { stringifyValue } from \"../format\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype ApprovalChildren = ReactNode | ((approval: ApprovalInteraction) => ReactNode);\ntype HumanInputFilter = \"pending\" | \"all\";\n\ntype HumanInputStatusProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: ReactNode | ((state: ReturnType<typeof useHumanInput>) => ReactNode);\n};\n\nconst HumanInputStatus = forwardRef<HTMLDivElement, HumanInputStatusProps>(\n function HumanInputStatus({ children, ...props }, ref) {\n const humanInput = useHumanInput();\n const renderedChildren = typeof children === \"function\" ? children(humanInput) : children;\n const pendingCount = humanInput.approvals.pending.length + humanInput.questions.pending.length;\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren ?? `${pendingCount} pending`,\n \"data-anvia-human-input-status\": \"\",\n \"data-pending\": String(pendingCount),\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype HumanInputApprovalsProps = PrimitiveProps<\"div\"> & {\n filter?: HumanInputFilter;\n keepMounted?: boolean;\n children?: ApprovalChildren;\n};\n\nconst HumanInputApprovals = forwardRef<HTMLDivElement, HumanInputApprovalsProps>(\n function HumanInputApprovals(\n { children, filter = \"pending\", keepMounted = false, ...props },\n ref,\n ) {\n const humanInput = useHumanInput();\n const approvals = filter === \"all\" ? humanInput.approvals.all : humanInput.approvals.pending;\n const empty = approvals.length === 0;\n if (empty && !keepMounted) {\n return null;\n }\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: approvals.map((approval) => (\n <InternalApprovalProvider key={approval.request.id} approval={approval}>\n {typeof children === \"function\"\n ? children(approval)\n : (children ?? <HumanInputApproval />)}\n </InternalApprovalProvider>\n )),\n \"data-anvia-approvals\": \"\",\n \"data-empty\": empty ? \"\" : undefined,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype HumanInputApprovalProps = PrimitiveProps<\"div\"> & {\n children?: ApprovalChildren;\n};\n\nconst HumanInputApproval = forwardRef<HTMLDivElement, HumanInputApprovalProps>(\n function HumanInputApproval({ children, ...props }, ref) {\n const { approval } = useApproval();\n const renderedChildren =\n typeof children === \"function\"\n ? children(approval)\n : (children ?? defaultApprovalContent(approval));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n \"data-anvia-approval\": \"\",\n \"data-state\": approval.status,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nconst HumanInputApprove = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function HumanInputApprove({ onClick, ...props }, ref) {\n const chat = useChatContext();\n const { approval, reason } = useApproval();\n const disabled =\n props.disabled ??\n (approval.status !== \"pending\" || chat.respondingInteractions.has(approval.request.id));\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n const decisionReason = reason.trim().length > 0 ? reason : undefined;\n const response = { type: \"tool-approval\" as const, approved: true };\n if (decisionReason !== undefined) Object.assign(response, { reason: decisionReason });\n void chat.respondToInteraction({\n interactionId: approval.request.id,\n response,\n });\n },\n [approval.request.id, chat, disabled, onClick, reason],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Approve\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-approve\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nconst HumanInputReject = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function HumanInputReject({ onClick, ...props }, ref) {\n const chat = useChatContext();\n const { approval, reason } = useApproval();\n const disabled =\n props.disabled ??\n (approval.status !== \"pending\" || chat.respondingInteractions.has(approval.request.id));\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n const decisionReason = reason.trim().length > 0 ? reason : undefined;\n const response = { type: \"tool-approval\" as const, approved: false };\n if (decisionReason !== undefined) Object.assign(response, { reason: decisionReason });\n void chat.respondToInteraction({\n interactionId: approval.request.id,\n response,\n });\n },\n [approval.request.id, chat, disabled, onClick, reason],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Reject\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-reject\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nconst HumanInputApprovalReason = forwardRef<HTMLTextAreaElement, PrimitiveProps<\"textarea\">>(\n function HumanInputApprovalReason({ onChange, ...props }, ref) {\n const approval = useApproval();\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n if (!event.defaultPrevented) {\n approval.setReason(event.currentTarget.value);\n }\n },\n [approval, onChange],\n );\n\n return renderPrimitive(\n \"textarea\",\n {\n ...props,\n \"aria-label\": props[\"aria-label\"] ?? \"Approval reason\",\n onChange: handleChange,\n value: approval.reason,\n \"data-anvia-approval-reason\": \"\",\n } as PrimitiveProps<\"textarea\">,\n ref,\n );\n },\n);\n\nfunction defaultApprovalContent(approval: ApprovalInteraction): ReactNode {\n return (\n <>\n <div data-anvia-approval-tool=\"\">{approval.request.toolName}</div>\n {approval.request.input !== undefined ? (\n <pre data-anvia-approval-args=\"\">{stringifyValue(approval.request.input)}</pre>\n ) : null}\n <HumanInputApprovalReason />\n <HumanInputApprove />\n <HumanInputReject />\n </>\n );\n}\n\nexport type { ApprovalChildren, HumanInputFilter };\nexport {\n HumanInputApproval,\n HumanInputApprovalReason,\n HumanInputApprovals,\n HumanInputApprove,\n HumanInputReject,\n HumanInputStatus,\n};\n","import { forwardRef } from \"react\";\n\nimport { useHumanInput } from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\nimport { HumanInputApprovals, type HumanInputFilter } from \"./approvals\";\nimport { HumanInputQuestions } from \"./questions\";\n\ntype HumanInputPanelProps = PrimitiveProps<\"div\"> & {\n filter?: HumanInputFilter;\n};\n\nconst HumanInputPanel = forwardRef<HTMLDivElement, HumanInputPanelProps>(function HumanInputPanel(\n { children, filter = \"pending\", ...props },\n ref,\n) {\n const humanInput = useHumanInput();\n const approvals = filter === \"all\" ? humanInput.approvals.all : humanInput.approvals.pending;\n const questions = filter === \"all\" ? humanInput.questions.all : humanInput.questions.pending;\n if (approvals.length === 0 && questions.length === 0) {\n return null;\n }\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: children ?? (\n <>\n <HumanInputApprovals filter={filter} />\n <HumanInputQuestions filter={filter} />\n </>\n ),\n \"data-anvia-human-input-panel\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\nexport { HumanInputPanel };\n","import type { AgentQuestionAnswer, AgentQuestionPrompt } from \"@anvia/core/agent/interactions\";\nimport {\n type ChangeEvent,\n forwardRef,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\n\nimport {\n InternalQuestionPromptProvider,\n InternalQuestionProvider,\n type QuestionContextValue,\n type QuestionInteraction,\n useChatContext,\n useHumanInput,\n useQuestion,\n useQuestionPrompt,\n} from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\nimport type { HumanInputFilter } from \"./approvals\";\n\ntype QuestionChildren = ReactNode | ((question: QuestionInteraction) => ReactNode);\n\ntype HumanInputQuestionsProps = PrimitiveProps<\"div\"> & {\n filter?: HumanInputFilter;\n keepMounted?: boolean;\n children?: QuestionChildren;\n};\n\nconst HumanInputQuestions = forwardRef<HTMLDivElement, HumanInputQuestionsProps>(\n function HumanInputQuestions(\n { children, filter = \"pending\", keepMounted = false, ...props },\n ref,\n ) {\n const humanInput = useHumanInput();\n const questions = filter === \"all\" ? humanInput.questions.all : humanInput.questions.pending;\n const empty = questions.length === 0;\n if (empty && !keepMounted) {\n return null;\n }\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: questions.map((question) => (\n <QuestionProvider key={question.request.id} question={question}>\n {typeof children === \"function\"\n ? children(question)\n : (children ?? <HumanInputQuestion />)}\n </QuestionProvider>\n )),\n \"data-anvia-questions\": \"\",\n \"data-empty\": empty ? \"\" : undefined,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype HumanInputQuestionProps = PrimitiveProps<\"div\"> & {\n children?: QuestionChildren;\n};\n\nconst HumanInputQuestion = forwardRef<HTMLDivElement, HumanInputQuestionProps>(\n function HumanInputQuestion({ children, ...props }, ref) {\n const { question } = useQuestion();\n const renderedChildren =\n typeof children === \"function\"\n ? children(question)\n : (children ?? defaultQuestionContent(question));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n \"data-anvia-question\": \"\",\n \"data-state\": question.status,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype HumanInputQuestionPromptProps = PrimitiveProps<\"div\"> & {\n promptId?: string;\n};\n\nconst HumanInputQuestionPrompt = forwardRef<HTMLDivElement, HumanInputQuestionPromptProps>(\n function HumanInputQuestionPrompt({ promptId, ...props }, ref) {\n const { question } = useQuestion();\n const prompt =\n question.request.questions.find((item) => item.id === promptId) ??\n question.request.questions[0];\n if (prompt === undefined) {\n return null;\n }\n\n return (\n <InternalQuestionPromptProvider prompt={prompt}>\n {renderPrimitive(\n \"div\",\n {\n ...props,\n children: props.children ?? defaultQuestionPrompt(prompt),\n \"data-anvia-question-prompt\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n )}\n </InternalQuestionPromptProvider>\n );\n },\n);\n\ntype HumanInputQuestionChoiceProps = PrimitiveProps<\"button\"> & {\n value?: string;\n answer?: string;\n custom?: boolean;\n};\n\nconst HumanInputQuestionChoice = forwardRef<HTMLButtonElement, HumanInputQuestionChoiceProps>(\n function HumanInputQuestionChoice({ answer, custom = false, onClick, value, ...props }, ref) {\n const { prompt } = useQuestionPrompt();\n const question = useQuestion();\n const choiceValue = value ?? prompt.choices?.[0]?.value ?? \"\";\n const choice = prompt.choices?.find((item) => item.value === choiceValue);\n const selected = question.answers[prompt.id]?.value === choiceValue;\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || choiceValue.length === 0) {\n return;\n }\n const nextAnswer: AgentQuestionAnswer = {\n questionId: prompt.id,\n value: custom ? (answer ?? choice?.label ?? choiceValue) : choiceValue,\n };\n question.setAnswer(prompt, nextAnswer);\n },\n [answer, choice?.label, choiceValue, custom, onClick, prompt, question],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? choice?.label ?? choiceValue,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-question-choice\": \"\",\n \"data-state\": selected ? \"selected\" : \"idle\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nconst HumanInputQuestionTextAnswer = forwardRef<HTMLTextAreaElement, PrimitiveProps<\"textarea\">>(\n function HumanInputQuestionTextAnswer({ onChange, ...props }, ref) {\n const { prompt } = useQuestionPrompt();\n const question = useQuestion();\n const value = question.answers[prompt.id]?.value ?? \"\";\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n if (event.defaultPrevented) {\n return;\n }\n const answer = event.currentTarget.value;\n question.setAnswer(prompt, {\n questionId: prompt.id,\n value: answer,\n });\n },\n [onChange, prompt, question],\n );\n\n return renderPrimitive(\n \"textarea\",\n {\n ...props,\n \"aria-label\": props[\"aria-label\"] ?? prompt.text,\n onChange: handleChange,\n value,\n \"data-anvia-question-text-answer\": \"\",\n } as PrimitiveProps<\"textarea\">,\n ref,\n );\n },\n);\n\nconst HumanInputQuestionSubmit = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function HumanInputQuestionSubmit({ onClick, ...props }, ref) {\n const chat = useChatContext();\n const question = useQuestion();\n const answers = useMemo(\n () =>\n question.question.request.questions.flatMap((prompt) => {\n const answer = question.answers[prompt.id];\n return answer === undefined || answer.value.trim().length === 0 ? [] : [answer];\n }),\n [question],\n );\n const disabled =\n props.disabled ??\n (question.question.status !== \"pending\" ||\n chat.respondingInteractions.has(question.question.request.id) ||\n answers.length !== question.question.request.questions.length);\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n void chat.respondToInteraction({\n interactionId: question.question.request.id,\n response: { type: \"tool-question\", answers },\n });\n },\n [answers, chat, disabled, onClick, question.question.request.id],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Submit\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-question-submit\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nfunction QuestionProvider({\n question,\n children,\n}: {\n question: QuestionInteraction;\n children?: ReactNode;\n}) {\n const [answers, setAnswers] = useState<Record<string, AgentQuestionAnswer>>({});\n const setAnswer = useCallback((prompt: AgentQuestionPrompt, answer: AgentQuestionAnswer) => {\n setAnswers((current) => ({ ...current, [prompt.id]: answer }));\n }, []);\n const value = useMemo<QuestionContextValue>(\n () => ({ question, answers, setAnswer }),\n [answers, question, setAnswer],\n );\n\n return <InternalQuestionProvider value={value}>{children}</InternalQuestionProvider>;\n}\n\nfunction defaultQuestionContent(question: QuestionInteraction): ReactNode {\n return (\n <>\n <div data-anvia-question-tool=\"\">{question.request.toolName}</div>\n {question.request.questions.map((prompt) => (\n <HumanInputQuestionPrompt key={prompt.id} promptId={prompt.id} />\n ))}\n <HumanInputQuestionSubmit />\n </>\n );\n}\n\nfunction defaultQuestionPrompt(prompt: AgentQuestionPrompt): ReactNode {\n return (\n <>\n <div data-anvia-question-text=\"\">{prompt.text}</div>\n {(prompt.choices?.length ?? 0) > 0 ? (\n <div data-anvia-question-choices=\"\">\n {prompt.choices?.map((choice) => (\n <HumanInputQuestionChoice key={choice.value} value={choice.value}>\n {choice.label}\n </HumanInputQuestionChoice>\n ))}\n </div>\n ) : (\n <HumanInputQuestionTextAnswer />\n )}\n </>\n );\n}\n\nexport type { QuestionChildren };\nexport {\n HumanInputQuestion,\n HumanInputQuestionChoice,\n HumanInputQuestionPrompt,\n HumanInputQuestionSubmit,\n HumanInputQuestions,\n HumanInputQuestionTextAnswer,\n};\n","import {\n HumanInputApproval,\n HumanInputApprovalReason,\n HumanInputApprovals,\n HumanInputApprove,\n HumanInputReject,\n HumanInputStatus,\n} from \"./approvals\";\nimport { HumanInputPanel } from \"./panel\";\nimport {\n HumanInputQuestion,\n HumanInputQuestionChoice,\n HumanInputQuestionPrompt,\n HumanInputQuestionSubmit,\n HumanInputQuestions,\n HumanInputQuestionTextAnswer,\n} from \"./questions\";\n\nexport const HumanInput = {\n Panel: HumanInputPanel,\n Status: HumanInputStatus,\n Approvals: HumanInputApprovals,\n Approval: HumanInputApproval,\n ApprovalReason: HumanInputApprovalReason,\n Approve: HumanInputApprove,\n Reject: HumanInputReject,\n Questions: HumanInputQuestions,\n Question: HumanInputQuestion,\n QuestionPrompt: HumanInputQuestionPrompt,\n QuestionChoice: HumanInputQuestionChoice,\n QuestionTextAnswer: HumanInputQuestionTextAnswer,\n QuestionSubmit: HumanInputQuestionSubmit,\n} as const;\n\nexport type {\n ApprovalContextValue,\n QuestionContextValue,\n QuestionPromptContextValue,\n} from \"../contexts\";\nexport {\n useApproval,\n useChatContext,\n useHumanInput,\n useQuestion,\n useQuestionPrompt,\n} from \"../contexts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAA2B,YAA6C,mBAAmB;AAgE9D,SAoJzB,UApJyB,KAoJzB,YApJyB;AA7C7B,IAAM,mBAAmB;AAAA,EACvB,SAASA,kBAAiB,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK;AACrD,UAAM,aAAa,cAAc;AACjC,UAAM,mBAAmB,OAAO,aAAa,aAAa,SAAS,UAAU,IAAI;AACjF,UAAM,eAAe,WAAW,UAAU,QAAQ,SAAS,WAAW,UAAU,QAAQ;AAExF,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,UAAU,oBAAoB,GAAG,YAAY;AAAA,QAC7C,iCAAiC;AAAA,QACjC,gBAAgB,OAAO,YAAY;AAAA,MACrC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAQA,IAAM,sBAAsB;AAAA,EAC1B,SAASC,qBACP,EAAE,UAAU,SAAS,WAAW,cAAc,OAAO,GAAG,MAAM,GAC9D,KACA;AACA,UAAM,aAAa,cAAc;AACjC,UAAM,YAAY,WAAW,QAAQ,WAAW,UAAU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AAyB,IAAI,iBAAO,MAAK;AAAA,KAC5C,OAAO,SAAS,UAAU,KAAK,IAC/B,gBAAAA,KAAC,SAAI,+BAA4B,IAC9B,iBAAO,SAAS,IAAI,CAAC,WACpB,gBAAAA,KAAC,4BAA4C,OAAO,OAAO,OACxD,iBAAO,SADqB,OAAO,KAEtC,CACD,GACH,IAEA,gBAAAA,KAAC,gCAA6B;AAAA,KAElC;AAEJ;;;AD1QQ,qBAAAU,WACE,OAAAC,MADF,QAAAC,aAAA;AAhBR,IAAM,kBAAkBC,YAAiD,SAASC,iBAChF,EAAE,UAAU,SAAS,WAAW,GAAG,MAAM,GACzC,KACA;AACA,QAAM,aAAa,cAAc;AACjC,QAAM,YAAY,WAAW,QAAQ,WAAW,UAAU,MAAM,WAAW,UAAU;AACrF,QAAM,YAAY,WAAW,QAAQ,WAAW,UAAU,MAAM,WAAW,UAAU;AACrF,MAAI,UAAU,WAAW,KAAK,UAAU,WAAW,GAAG;AACpD,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,UAAU,YACR,gBAAAF,MAAAF,WAAA,EACE;AAAA,wBAAAC,KAAC,uBAAoB,QAAgB;AAAA,QACrC,gBAAAA,KAAC,uBAAoB,QAAgB;AAAA,SACvC;AAAA,MAEF,gCAAgC;AAAA,IAClC;AAAA,IACA;AAAA,EACF;AACF,CAAC;;;AElBM,IAAM,aAAa;AAAA,EACxB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,gBAAgB;AAClB;","names":["HumanInputStatus","HumanInputApprovals","HumanInputApproval","HumanInputApprove","HumanInputReject","HumanInputApprovalReason","forwardRef","forwardRef","useCallback","Fragment","jsx","jsxs","forwardRef","HumanInputQuestions","HumanInputQuestion","HumanInputQuestionPrompt","HumanInputQuestionChoice","useCallback","HumanInputQuestionTextAnswer","HumanInputQuestionSubmit","Fragment","jsx","jsxs","forwardRef","HumanInputPanel"]}
|