wimui 0.65.2 → 0.67.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/ai.cjs +1 -1
- package/dist/ai.js +3 -3
- package/dist/components/_internal/ChoiceLabel.cjs +2 -0
- package/dist/components/_internal/ChoiceLabel.d.ts +31 -0
- package/dist/components/_internal/ChoiceLabel.js +22 -0
- package/dist/components/_internal/choice-label.module.cjs +2 -0
- package/dist/components/_internal/choice-label.module.js +11 -0
- package/dist/components/_internal/rovingIndex.cjs +2 -0
- package/dist/components/_internal/rovingIndex.d.ts +38 -0
- package/dist/components/_internal/rovingIndex.js +16 -0
- package/dist/components/ai/ChatUI/ChatUI.cjs +1 -1
- package/dist/components/ai/ChatUI/ChatUI.d.ts +83 -1
- package/dist/components/ai/ChatUI/ChatUI.js +184 -81
- package/dist/components/ai/ChatUI/chat-ui.module.cjs +1 -1
- package/dist/components/ai/ChatUI/chat-ui.module.js +46 -26
- package/dist/components/data-display/Card/Card.cjs +1 -1
- package/dist/components/data-display/Card/Card.d.ts +21 -0
- package/dist/components/data-display/Card/Card.js +7 -3
- package/dist/components/data-display/Card/card.module.cjs +1 -1
- package/dist/components/data-display/Card/card.module.js +17 -16
- package/dist/components/form/CheckboxGroup/CheckboxGroup.cjs +1 -1
- package/dist/components/form/CheckboxGroup/CheckboxGroup.d.ts +9 -0
- package/dist/components/form/CheckboxGroup/CheckboxGroup.js +42 -30
- package/dist/components/form/CheckboxGroup/checkbox-group.module.cjs +1 -1
- package/dist/components/form/CheckboxGroup/checkbox-group.module.js +4 -3
- package/dist/components/form/RadioGroup/RadioGroup.cjs +1 -1
- package/dist/components/form/RadioGroup/RadioGroup.d.ts +9 -0
- package/dist/components/form/RadioGroup/RadioGroup.js +46 -34
- package/dist/components/form/RadioGroup/radio-group.module.cjs +1 -1
- package/dist/components/form/RadioGroup/radio-group.module.js +4 -3
- package/dist/components/form/SegmentedControl/SegmentedControl.cjs +1 -1
- package/dist/components/form/SegmentedControl/SegmentedControl.js +56 -68
- package/dist/components/form/ToggleGroup/ToggleGroup.cjs +1 -1
- package/dist/components/form/ToggleGroup/ToggleGroup.js +80 -88
- package/dist/components/layout/Toolbar/Toolbar.cjs +1 -1
- package/dist/components/layout/Toolbar/Toolbar.js +52 -51
- package/dist/components/navigation/Stepper/Stepper.cjs +1 -1
- package/dist/components/navigation/Stepper/Stepper.js +51 -53
- package/dist/components/navigation/TabNavigation/TabNavigation.cjs +1 -1
- package/dist/components/navigation/TabNavigation/TabNavigation.js +47 -49
- package/dist/components/navigation/Tabs/Tabs.cjs +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +80 -73
- package/dist/data-display.cjs +1 -1
- package/dist/data-display.js +40 -40
- package/dist/i18n/generated/common.cjs +1 -1
- package/dist/i18n/generated/common.d.ts +1 -1
- package/dist/i18n/generated/common.js +9 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +174 -174
- package/dist/llms-full.txt +9 -1
- package/dist/llms.txt +1 -1
- package/dist/locales/en/common.json +3 -1
- package/dist/locales/ja/common.json +3 -1
- package/dist/locales/pt/common.json +3 -1
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +3 -3
package/dist/ai.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./components/ai/PromptInput/PromptInput.cjs"),t=require("./components/ai/ThoughtProcess/ThoughtProcess.cjs"),n=require("./components/ai/AIResponseFeedback/AIResponseFeedback.cjs"),r=require("./components/ai/SourceCitation/SourceCitation.cjs"),i=require("./components/ai/CodeBlock/CodeBlock.cjs"),a=require("./components/ai/Terminal/Terminal.cjs"),o=require("./components/ai/AgentStatus/AgentStatus.cjs"),s=require("./components/ai/VoiceVisualizer/VoiceVisualizer.cjs"),c=require("./components/ai/ModelSelector/ModelSelector.cjs"),l=require("./components/ai/ThreadList/ThreadList.cjs"),u=require("./components/ai/UsageMeter/UsageMeter.cjs"),d=require("./components/ai/ChatUI/ChatUI.cjs"),f=require("./components/ai/ArtifactsOverlay/ArtifactsOverlay.cjs");exports.AIResponseFeedback=n.AIResponseFeedback,exports.AgentStatus=o.AgentStatus,exports.ArtifactsOverlay=f.ArtifactsOverlay,exports.ChatAvatar=d.ChatAvatar,exports.ChatContainer=d.ChatContainer,exports.ChatInput=d.ChatInput,exports.ChatInputArea=d.ChatInputArea,exports.ChatMessage=d.ChatMessage,exports.ChatMessageList=d.ChatMessageList,exports.CodeBlock=i.CodeBlock,exports.ConversationList=l.ConversationList,exports.ModelSelector=c.ModelSelector,exports.PromptInput=e.PromptInput,exports.SourceCitation=r.SourceCitation,exports.SourceCitationList=r.SourceCitationList,exports.Terminal=a.Terminal,exports.ThoughtProcess=t.ThoughtProcess,exports.ThoughtStep=t.ThoughtStep,exports.ThreadList=l.ThreadList,exports.TokenCounter=u.TokenCounter,exports.UsageMeter=u.UsageMeter,exports.VoiceVisualizer=s.VoiceVisualizer;
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./components/ai/PromptInput/PromptInput.cjs"),t=require("./components/ai/ThoughtProcess/ThoughtProcess.cjs"),n=require("./components/ai/AIResponseFeedback/AIResponseFeedback.cjs"),r=require("./components/ai/SourceCitation/SourceCitation.cjs"),i=require("./components/ai/CodeBlock/CodeBlock.cjs"),a=require("./components/ai/Terminal/Terminal.cjs"),o=require("./components/ai/AgentStatus/AgentStatus.cjs"),s=require("./components/ai/VoiceVisualizer/VoiceVisualizer.cjs"),c=require("./components/ai/ModelSelector/ModelSelector.cjs"),l=require("./components/ai/ThreadList/ThreadList.cjs"),u=require("./components/ai/UsageMeter/UsageMeter.cjs"),d=require("./components/ai/ChatUI/ChatUI.cjs"),f=require("./components/ai/ArtifactsOverlay/ArtifactsOverlay.cjs");exports.AIResponseFeedback=n.AIResponseFeedback,exports.AgentStatus=o.AgentStatus,exports.ArtifactsOverlay=f.ArtifactsOverlay,exports.ChatAvatar=d.ChatAvatar,exports.ChatContainer=d.ChatContainer,exports.ChatInput=d.ChatInput,exports.ChatInputArea=d.ChatInputArea,exports.ChatMessage=d.ChatMessage,exports.ChatMessageList=d.ChatMessageList,exports.ChatSystemMessage=d.ChatSystemMessage,exports.ChatToolCall=d.ChatToolCall,exports.CodeBlock=i.CodeBlock,exports.ConversationList=l.ConversationList,exports.ModelSelector=c.ModelSelector,exports.PromptInput=e.PromptInput,exports.SourceCitation=r.SourceCitation,exports.SourceCitationList=r.SourceCitationList,exports.Terminal=a.Terminal,exports.ThoughtProcess=t.ThoughtProcess,exports.ThoughtStep=t.ThoughtStep,exports.ThreadList=l.ThreadList,exports.TokenCounter=u.TokenCounter,exports.UsageMeter=u.UsageMeter,exports.VoiceVisualizer=s.VoiceVisualizer;
|
package/dist/ai.js
CHANGED
|
@@ -10,6 +10,6 @@ import { VoiceVisualizer as l } from "./components/ai/VoiceVisualizer/VoiceVisua
|
|
|
10
10
|
import { ModelSelector as u } from "./components/ai/ModelSelector/ModelSelector.js";
|
|
11
11
|
import { ConversationList as d, ThreadList as f } from "./components/ai/ThreadList/ThreadList.js";
|
|
12
12
|
import { TokenCounter as p, UsageMeter as m } from "./components/ai/UsageMeter/UsageMeter.js";
|
|
13
|
-
import { ChatAvatar as h, ChatContainer as g, ChatInput as _, ChatInputArea as v, ChatMessage as y, ChatMessageList as b } from "./components/ai/ChatUI/ChatUI.js";
|
|
14
|
-
import { ArtifactsOverlay as
|
|
15
|
-
export { r as AIResponseFeedback, c as AgentStatus,
|
|
13
|
+
import { ChatAvatar as h, ChatContainer as g, ChatInput as _, ChatInputArea as v, ChatMessage as y, ChatMessageList as b, ChatSystemMessage as x, ChatToolCall as S } from "./components/ai/ChatUI/ChatUI.js";
|
|
14
|
+
import { ArtifactsOverlay as C } from "./components/ai/ArtifactsOverlay/ArtifactsOverlay.js";
|
|
15
|
+
export { r as AIResponseFeedback, c as AgentStatus, C as ArtifactsOverlay, h as ChatAvatar, g as ChatContainer, _ as ChatInput, v as ChatInputArea, y as ChatMessage, b as ChatMessageList, x as ChatSystemMessage, S as ChatToolCall, o as CodeBlock, d as ConversationList, u as ModelSelector, e as PromptInput, i as SourceCitation, a as SourceCitationList, s as Terminal, t as ThoughtProcess, n as ThoughtStep, f as ThreadList, p as TokenCounter, m as UsageMeter, l as VoiceVisualizer };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("./choice-label.module.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("react/jsx-runtime");var i={card:t.default.card,top:t.default.top},a=({label:e,description:n,descriptionId:i,labelId:a})=>n?(0,r.jsxs)(`span`,{className:t.default.content,children:[(0,r.jsx)(`span`,{id:a,className:t.default.label,children:e}),(0,r.jsx)(`span`,{id:i,className:t.default.description,children:n})]}):(0,r.jsx)(r.Fragment,{children:e});exports.ChoiceLabel=a,exports.choiceLabelClasses=i;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 選択肢の根(`Radio` / `Checkbox` の `<label>`)に付けるクラス。
|
|
4
|
+
* `card` はカードの見た目、`top` は説明文があるときに入力を 1 行目へ揃える。
|
|
5
|
+
*/
|
|
6
|
+
export declare const choiceLabelClasses: {
|
|
7
|
+
card: string;
|
|
8
|
+
top: string;
|
|
9
|
+
};
|
|
10
|
+
export interface ChoiceLabelProps {
|
|
11
|
+
/** The option's name */
|
|
12
|
+
label: string;
|
|
13
|
+
/** A second line that explains the option */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Id for the description, so the input can point at it with `aria-describedby` */
|
|
16
|
+
descriptionId?: string;
|
|
17
|
+
/** Id for the label text, so the input can take only the label as its name with `aria-labelledby` */
|
|
18
|
+
labelId?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* RadioGroup / CheckboxGroup の選択肢の文字(名前と、あれば説明文)。T365。
|
|
22
|
+
*
|
|
23
|
+
* 説明文は `<label>` の中に置く(カードのどこを押しても選べるように)。そのままでは説明文が
|
|
24
|
+
* 名前にも入り、`aria-describedby` と合わせて 2 回読まれる(Chrome の計算で確かめた)ので、
|
|
25
|
+
* 入力の名前は `aria-labelledby` で名前の文字だけを指し、説明文は `aria-describedby` で指す。
|
|
26
|
+
*
|
|
27
|
+
* Composition Contract:
|
|
28
|
+
* - Managed by: RadioGroup / CheckboxGroup(`options[].description` と `variant`)
|
|
29
|
+
* - Scroll lock: No
|
|
30
|
+
*/
|
|
31
|
+
export declare const ChoiceLabel: ({ label, description, descriptionId, labelId }: ChoiceLabelProps) => React.ReactElement;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "./choice-label.module.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/_internal/ChoiceLabel.tsx
|
|
6
|
+
var i = {
|
|
7
|
+
card: e.card,
|
|
8
|
+
top: e.top
|
|
9
|
+
}, a = ({ label: i, description: a, descriptionId: o, labelId: s }) => a ? /* @__PURE__ */ r("span", {
|
|
10
|
+
className: e.content,
|
|
11
|
+
children: [/* @__PURE__ */ n("span", {
|
|
12
|
+
id: s,
|
|
13
|
+
className: e.label,
|
|
14
|
+
children: i
|
|
15
|
+
}), /* @__PURE__ */ n("span", {
|
|
16
|
+
id: o,
|
|
17
|
+
className: e.description,
|
|
18
|
+
children: a
|
|
19
|
+
})]
|
|
20
|
+
}) : /* @__PURE__ */ n(t, { children: i });
|
|
21
|
+
//#endregion
|
|
22
|
+
export { a as ChoiceLabel, i as choiceLabelClasses };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/_internal/choice-label.module.scss
|
|
3
|
+
var e = "_content_gpfhr_3", t = "_label_gpfhr_9", n = "_description_gpfhr_12", r = "_top_gpfhr_17", i = "_card_gpfhr_22", a = {
|
|
4
|
+
content: e,
|
|
5
|
+
label: t,
|
|
6
|
+
description: n,
|
|
7
|
+
top: r,
|
|
8
|
+
card: i
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { i as card, e as content, a as default, n as description, t as label, r as top };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var e=e=>e===`ArrowRight`||e===`ArrowDown`,t=(e,t=`both`)=>e===`Home`||e===`End`||t!==`vertical`&&(e===`ArrowRight`||e===`ArrowLeft`)||t!==`horizontal`&&(e===`ArrowDown`||e===`ArrowUp`),n=({key:n,current:r,count:i,orientation:a=`both`,wrap:o=!0,isDisabled:s=()=>!1})=>{if(i<=0||!t(n,a))return null;let c=n===`Home`||n===`End`,l=n===`Home`||!c&&e(n)?1:-1,u=r>=0&&r<i,d=c||!u?l===1?-1:i:r;for(let e=0;e<i;e++){if(d+=l,d<0||d>=i){if(c||!o)return u&&!c?r:null;d=(d+i)%i}if(!s(d))return d}return null};exports.getRovingIndex=n,exports.isRovingKey=t;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 並んだ項目の上で、矢印キーと Home / End が「次にどこへ行くか」を決める(T366)。
|
|
3
|
+
*
|
|
4
|
+
* Tabs / TabNavigation / Toolbar / Stepper / SegmentedControl / ToggleGroup が、それぞれ
|
|
5
|
+
* 同じ計算を書いていた。ずれていたのは 3 点だけ ── 効く矢印の向き・無効の項目を飛ばすか・
|
|
6
|
+
* 端で折り返すか。ここでは計算だけを持ち、フォーカスを動かす・選択を変える、は各部品に残す
|
|
7
|
+
* (部品ごとに、項目の持ち方も、動いたあとにすることも違うため)。
|
|
8
|
+
*
|
|
9
|
+
* 無効の項目は飛ばす。飛ばさないと、Tabs では矢印で無効のタブが選ばれ、フォーカスだけが
|
|
10
|
+
* 元のタブに残っていた(無効のボタンにはフォーカスが乗らない。T366 で見つけた)。
|
|
11
|
+
*
|
|
12
|
+
* Composition Contract:
|
|
13
|
+
* - Managed by: 呼び出す部品(キーの処理・preventDefault・フォーカス・選択)
|
|
14
|
+
* - Scroll lock: No
|
|
15
|
+
*/
|
|
16
|
+
/** どの矢印で動くか。`both` は上下左右のどれでも(向きを持たない並び)。 */
|
|
17
|
+
export type RovingOrientation = "horizontal" | "vertical" | "both";
|
|
18
|
+
export interface RovingIndexOptions {
|
|
19
|
+
/** `KeyboardEvent.key` */
|
|
20
|
+
key: string;
|
|
21
|
+
/** 今の位置。並びの外(-1)なら、次へは先頭・前へは末尾 */
|
|
22
|
+
current: number;
|
|
23
|
+
/** 項目の数 */
|
|
24
|
+
count: number;
|
|
25
|
+
/** @default "both" */
|
|
26
|
+
orientation?: RovingOrientation;
|
|
27
|
+
/** 端で反対の端へ折り返すか。@default true */
|
|
28
|
+
wrap?: boolean;
|
|
29
|
+
/** その位置の項目が無効か。無効の項目には止まらない */
|
|
30
|
+
isDisabled?: (index: number) => boolean;
|
|
31
|
+
}
|
|
32
|
+
/** この並びで扱うキーか(扱うなら、呼び出し側は `preventDefault` してよい) */
|
|
33
|
+
export declare const isRovingKey: (key: string, orientation?: RovingOrientation) => boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 次の位置を返す。扱わないキー、または止まれる項目が 1 つも無いときは `null`。
|
|
36
|
+
* 折り返さない並びで端にいるときは、今の位置をそのまま返す。
|
|
37
|
+
*/
|
|
38
|
+
export declare const getRovingIndex: ({ key, current, count, orientation, wrap, isDisabled, }: RovingIndexOptions) => number | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/_internal/rovingIndex.ts
|
|
3
|
+
var e = (e) => e === "ArrowRight" || e === "ArrowDown", t = (e, t = "both") => e === "Home" || e === "End" || t !== "vertical" && (e === "ArrowRight" || e === "ArrowLeft") || t !== "horizontal" && (e === "ArrowDown" || e === "ArrowUp"), n = ({ key: n, current: r, count: i, orientation: a = "both", wrap: o = !0, isDisabled: s = () => !1 }) => {
|
|
4
|
+
if (i <= 0 || !t(n, a)) return null;
|
|
5
|
+
let c = n === "Home" || n === "End", l = n === "Home" || !c && e(n) ? 1 : -1, u = r >= 0 && r < i, d = c || !u ? l === 1 ? -1 : i : r;
|
|
6
|
+
for (let e = 0; e < i; e++) {
|
|
7
|
+
if (d += l, d < 0 || d >= i) {
|
|
8
|
+
if (c || !o) return u && !c ? r : null;
|
|
9
|
+
d = (d + i) % i;
|
|
10
|
+
}
|
|
11
|
+
if (!s(d)) return d;
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { n as getRovingIndex, t as isRovingKey };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../_internal/composeEventHandlers.cjs"),i=require("../../../icon/
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../_internal/composeEventHandlers.cjs"),i=require("../../../icon/alert-circle.cjs"),a=require("../../../icon/alert-triangle.cjs"),o=require("../../../icon/check.cjs"),s=require("../../../icon/chevron-right.cjs"),c=require("../../../icon/hourglass.cjs"),l=require("../../../icon/paperclip.cjs"),u=require("../../../icon/send.cjs"),d=require("../../media/Icon/Icon.cjs"),f=require("../../../i18n/generated/form.cjs"),p=require("../../../hooks/useAutoResize.cjs"),m=require("./chat-ui.module.cjs");let h=require("react");h=e.__toESM(h,1);let g=require("classnames");g=e.__toESM(g,1);let _=require("react/jsx-runtime");var v=({children:e,className:t,...n})=>(0,_.jsx)(`div`,{className:(0,g.default)(`wim-chat-ui`,m.default.container,t),...n,children:e}),y=(0,h.forwardRef)(({children:e,className:t,...n},r)=>(0,_.jsx)(`div`,{ref:r,className:(0,g.default)(m.default.messageList,t),...n,children:e}));y.displayName=`ChatMessageList`;var b=({children:e,position:t=`left`,variant:n=`default`,showAvatar:r=!0,avatar:i,timestamp:a,metadata:o,senderName:s,isTyping:c=!1,actions:l,actionsVisible:u=!0,className:d,...f})=>(0,_.jsxs)(`div`,{className:(0,g.default)(m.default.message,m.default[t],m.default[n],{[m.default.hasAvatar]:r},d),...f,children:[r&&t===`left`&&(0,_.jsx)(`div`,{className:m.default.messageAvatar,children:i}),(0,_.jsxs)(`div`,{className:m.default.contentWrapper,children:[s&&(0,_.jsx)(`div`,{className:m.default.sender,children:s}),(0,_.jsx)(`div`,{className:(0,g.default)(m.default.bubble,{[m.default.typing]:c}),children:c?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{className:m.default.typingDot}),(0,_.jsx)(`span`,{className:m.default.typingDot}),(0,_.jsx)(`span`,{className:m.default.typingDot})]}):e}),l&&(0,_.jsx)(`div`,{className:(0,g.default)(m.default.actions,{[m.default.hoverOnly]:!u}),children:l}),(a||o)&&(0,_.jsxs)(`div`,{className:m.default.timestamp,children:[a,a&&o&&` · `,o]})]}),r&&t===`right`&&(0,_.jsx)(`div`,{className:m.default.messageAvatar,children:i})]}),x={waiting:c.default,done:o.default,error:i.default},S=({name:e,status:r=`done`,summary:i,input:a,output:o,defaultExpanded:c=!1,className:l,...u})=>{let{t:p}=t.useWimTranslation([n.commonNs,f.formNs]),[v,y]=h.default.useState(c),b=(0,h.useId)(),S=a!=null||o!=null,C=r===`running`?null:x[r],w=(0,_.jsxs)(_.Fragment,{children:[S&&(0,_.jsx)(d.Icon,{component:s.default,size:`sm`,className:(0,g.default)(m.default.toolChevron,v&&m.default.expanded),"aria-hidden":`true`}),(0,_.jsx)(`code`,{className:m.default.toolName,children:e}),i&&(0,_.jsx)(`span`,{className:m.default.toolSummary,children:i}),(0,_.jsxs)(`span`,{className:(0,g.default)(m.default.toolStatus,m.default[r]),children:[C?(0,_.jsx)(d.Icon,{component:C,size:`xs`,"aria-hidden":`true`}):(0,_.jsx)(`span`,{className:m.default.toolSpinner,"aria-hidden":`true`}),p(`agent_status.${r}`)]})]});return(0,_.jsxs)(`div`,{className:(0,g.default)(m.default.toolCall,l),"aria-busy":r===`running`||void 0,...u,children:[S?(0,_.jsx)(`button`,{type:`button`,className:m.default.toolHeader,"aria-expanded":v,"aria-controls":b,onClick:()=>y(e=>!e),children:w}):(0,_.jsx)(`div`,{className:m.default.toolHeader,children:w}),S&&(0,_.jsxs)(`div`,{id:b,className:m.default.toolBody,hidden:!v,children:[a!=null&&(0,_.jsxs)(`div`,{className:m.default.toolSection,children:[(0,_.jsx)(`div`,{className:m.default.toolLabel,children:p(`chat.tool_input`)}),typeof a==`string`?(0,_.jsx)(`pre`,{className:m.default.toolCode,tabIndex:0,children:a}):a]}),o!=null&&(0,_.jsxs)(`div`,{className:m.default.toolSection,children:[(0,_.jsx)(`div`,{className:m.default.toolLabel,children:p(`chat.tool_output`)}),typeof o==`string`?(0,_.jsx)(`pre`,{className:m.default.toolCode,tabIndex:0,children:o}):o]})]})]})},C={warning:a.default,danger:i.default},w=({children:e,intent:t=`default`,action:n,className:r,...i})=>{let a=C[t];return(0,_.jsxs)(`div`,{className:(0,g.default)(m.default.system,m.default[t],r),...i,children:[(0,_.jsxs)(`span`,{className:m.default.systemText,children:[a&&(0,_.jsx)(d.Icon,{component:a,size:`xs`,"aria-hidden":`true`}),(0,_.jsx)(`span`,{children:e})]}),n&&(0,_.jsx)(`span`,{className:m.default.systemAction,children:n})]})},T=({children:e,className:t,...n})=>(0,_.jsx)(`div`,{className:(0,g.default)(m.default.inputArea,t),...n,children:e}),E=(0,h.forwardRef)(({onSend:e,onAttach:i,sendButtonLabel:a,sendButtonIcon:o=u.default,showSendButton:s=!0,showAttach:c=!1,maxRows:f=8,className:g,...v},y)=>{let{t:b}=t.useWimTranslation(n.commonNs),[x,S]=h.default.useState(``),C=v.value!==void 0,w=C?v.value:x,E=p.useAutoResize(w,f);h.default.useImperativeHandle(y,()=>E.current);let D=!!a,O=()=>{e&&(e(w),C||S(``))},k=e=>{C||S(e.target.value),v.onChange?.(e)},A=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),O())};return(0,_.jsx)(T,{className:g,children:(0,_.jsxs)(`div`,{className:m.default.fieldContainer,children:[c&&(0,_.jsx)(`button`,{type:`button`,className:m.default.attachButton,onClick:i,"aria-label":b(`a11y.attach_file`),children:(0,_.jsx)(d.Icon,{component:l.default,size:`sm`})}),(0,_.jsx)(`textarea`,{ref:E,className:m.default.field,value:w,placeholder:v.placeholder||`Type a message...`,rows:1,...v,onChange:k,onKeyDown:r.composeEventHandlers(v.onKeyDown,A)}),s&&(0,_.jsx)(`button`,{className:m.default.sendButton,onClick:O,disabled:!w.trim(),type:`button`,"aria-label":a||b(`chat.send`),children:D?a:(0,_.jsx)(d.Icon,{component:o,size:`sm`})})]})})});E.displayName=`ChatInput`;var D=({src:e,alt:r,fallback:i,size:a=`md`,tone:o=`s18`,className:s,...c})=>{let[l,u]=h.default.useState(!1),{t:d}=t.useWimTranslation(n.commonNs),f=r||d(`chat.user_avatar`);return(0,_.jsx)(`div`,{className:(0,g.default)(m.default.avatar,m.default[a],m.default[o],s),...c,children:e&&!l?(0,_.jsx)(`img`,{src:e,alt:f,className:m.default.image,onError:()=>u(!0)}):(0,_.jsx)(`div`,{className:m.default.fallback,children:i||f.charAt(0).toUpperCase()})})};exports.ChatAvatar=D,exports.ChatContainer=v,exports.ChatInput=E,exports.ChatInputArea=T,exports.ChatMessage=b,exports.ChatMessageList=y,exports.ChatSystemMessage=w,exports.ChatToolCall=S;
|
|
@@ -33,6 +33,11 @@ export interface ChatMessageProps extends React.ComponentPropsWithoutRef<"div">
|
|
|
33
33
|
avatar?: React.ReactNode;
|
|
34
34
|
/** Timestamp text shown below the message */
|
|
35
35
|
timestamp?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Details about how the message was produced (model, token count, latency),
|
|
38
|
+
* shown on the same line as `timestamp` in the same small, secondary text.
|
|
39
|
+
*/
|
|
40
|
+
metadata?: React.ReactNode;
|
|
36
41
|
/** Sender name shown above the message */
|
|
37
42
|
senderName?: string;
|
|
38
43
|
/** Whether to show the typing indicator instead of content */
|
|
@@ -56,7 +61,84 @@ export interface ChatMessageProps extends React.ComponentPropsWithoutRef<"div">
|
|
|
56
61
|
/** Additional class names */
|
|
57
62
|
className?: string;
|
|
58
63
|
}
|
|
59
|
-
export declare const ChatMessage: ({ children, position, variant, showAvatar, avatar, timestamp, senderName, isTyping, actions, actionsVisible, className, ...props }: ChatMessageProps) => React.ReactElement;
|
|
64
|
+
export declare const ChatMessage: ({ children, position, variant, showAvatar, avatar, timestamp, metadata, senderName, isTyping, actions, actionsVisible, className, ...props }: ChatMessageProps) => React.ReactElement;
|
|
65
|
+
/**
|
|
66
|
+
* 状態の語は `AgentStatus` と同じ(T363)。ツールの呼び出しに「考え中」「待機」は無いので外す。
|
|
67
|
+
* `Extract<AgentStatusValue, …>` と書くと、docgen と prop の API スナップショットが型の式を
|
|
68
|
+
* そのまま記録して、値の一覧が出ない。同じファイルに値を書き、部分集合であることは下の型で保つ。
|
|
69
|
+
*/
|
|
70
|
+
export type ChatToolCallStatus = "waiting" | "running" | "done" | "error";
|
|
71
|
+
export interface ChatToolCallProps extends Omit<React.ComponentPropsWithoutRef<"div">, "children"> {
|
|
72
|
+
/** Name of the tool that was called, shown in a monospace face (e.g. `search_incidents`) */
|
|
73
|
+
name: string;
|
|
74
|
+
/**
|
|
75
|
+
* State of the call. Uses the same words as `AgentStatus`; `waiting` is a call
|
|
76
|
+
* that is waiting on something before it runs, such as the user's approval.
|
|
77
|
+
* @default "done"
|
|
78
|
+
*/
|
|
79
|
+
status?: ChatToolCallStatus;
|
|
80
|
+
/** One-line summary shown next to the name (e.g. "6 incidents found") */
|
|
81
|
+
summary?: React.ReactNode;
|
|
82
|
+
/**
|
|
83
|
+
* Arguments the tool was called with. Shown when expanded. A string is shown
|
|
84
|
+
* as preformatted monospace text; pass a `CodeBlock` for highlighting or a copy
|
|
85
|
+
* button (it brings its own frame inside this one).
|
|
86
|
+
*/
|
|
87
|
+
input?: React.ReactNode;
|
|
88
|
+
/** What the tool returned, or the error it failed with. Shown when expanded. Strings are shown as for `input`. */
|
|
89
|
+
output?: React.ReactNode;
|
|
90
|
+
/** Whether `input` and `output` are shown on first render. */
|
|
91
|
+
defaultExpanded?: boolean;
|
|
92
|
+
/** Additional class names */
|
|
93
|
+
className?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* One call the assistant made to a tool, with its arguments and result.
|
|
97
|
+
*
|
|
98
|
+
* Where it sits next to its neighbours: `ThoughtProcess` is the model's own
|
|
99
|
+
* reasoning written as steps, `AgentStatus` is the whole agent's state on one
|
|
100
|
+
* line, and `ChatToolCall` is one action against the outside world and what
|
|
101
|
+
* came back. Place it inside a `ChatMessage` or directly in `ChatMessageList`.
|
|
102
|
+
*
|
|
103
|
+
* The status is part of the toggle's name ("search_incidents … Done"). A change
|
|
104
|
+
* of status is not announced: it is not something the user did, and a run of
|
|
105
|
+
* tool calls would keep talking over the conversation.
|
|
106
|
+
*
|
|
107
|
+
* Composition Contract:
|
|
108
|
+
* - Managed by: App consumption
|
|
109
|
+
* - Scroll lock: No
|
|
110
|
+
*/
|
|
111
|
+
export declare const ChatToolCall: ({ name, status, summary, input, output, defaultExpanded, className, ...props }: ChatToolCallProps) => React.ReactElement;
|
|
112
|
+
/** `FeedbackIntent` の部分集合(上の `ChatToolCallStatus` と同じ理由で、値を書いて型で保つ)。 */
|
|
113
|
+
export type ChatSystemMessageIntent = "default" | "warning" | "danger";
|
|
114
|
+
export interface ChatSystemMessageProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
115
|
+
/** The notice (e.g. "Switched to a faster model", "No answer arrived") */
|
|
116
|
+
children: React.ReactNode;
|
|
117
|
+
/**
|
|
118
|
+
* `warning` and `danger` add an icon as well as colour, so the difference does
|
|
119
|
+
* not rest on colour alone.
|
|
120
|
+
* @default "default"
|
|
121
|
+
*/
|
|
122
|
+
intent?: ChatSystemMessageIntent;
|
|
123
|
+
/** An action that belongs next to the notice, such as a retry button */
|
|
124
|
+
action?: React.ReactNode;
|
|
125
|
+
/** Additional class names */
|
|
126
|
+
className?: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* A notice in the transcript that nobody said: the conversation started, the
|
|
130
|
+
* model changed, an answer never arrived. A `ChatMessage` would put it in a
|
|
131
|
+
* speech bubble with a sender, which is wrong for something nobody said.
|
|
132
|
+
*
|
|
133
|
+
* Place it in `ChatMessageList` between messages so it shares the list's
|
|
134
|
+
* spacing. It does not announce itself; when the notice is the result of
|
|
135
|
+
* something the user did, announce it from the app.
|
|
136
|
+
*
|
|
137
|
+
* Composition Contract:
|
|
138
|
+
* - Managed by: App consumption
|
|
139
|
+
* - Scroll lock: No
|
|
140
|
+
*/
|
|
141
|
+
export declare const ChatSystemMessage: ({ children, intent, action, className, ...props }: ChatSystemMessageProps) => React.ReactElement;
|
|
60
142
|
export interface ChatInputAreaProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
61
143
|
children: React.ReactNode;
|
|
62
144
|
className?: string;
|
|
@@ -2,111 +2,214 @@
|
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
3
|
import { commonNs as t } from "../../../i18n/generated/common.js";
|
|
4
4
|
import { composeEventHandlers as n } from "../../_internal/composeEventHandlers.js";
|
|
5
|
-
import r from "../../../icon/
|
|
6
|
-
import i from "../../../icon/
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import s from "
|
|
10
|
-
import c
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
5
|
+
import r from "../../../icon/alert-circle.js";
|
|
6
|
+
import i from "../../../icon/alert-triangle.js";
|
|
7
|
+
import a from "../../../icon/check.js";
|
|
8
|
+
import o from "../../../icon/chevron-right.js";
|
|
9
|
+
import s from "../../../icon/hourglass.js";
|
|
10
|
+
import c from "../../../icon/paperclip.js";
|
|
11
|
+
import l from "../../../icon/send.js";
|
|
12
|
+
import { Icon as u } from "../../media/Icon/Icon.js";
|
|
13
|
+
import { formNs as d } from "../../../i18n/generated/form.js";
|
|
14
|
+
import { useAutoResize as f } from "../../../hooks/useAutoResize.js";
|
|
15
|
+
import p from "./chat-ui.module.js";
|
|
16
|
+
import m, { forwardRef as h, useId as g } from "react";
|
|
17
|
+
import _ from "classnames";
|
|
18
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
13
19
|
//#region src/components/ai/ChatUI/ChatUI.tsx
|
|
14
|
-
var
|
|
15
|
-
className:
|
|
20
|
+
var x = ({ children: e, className: t, ...n }) => /* @__PURE__ */ y("div", {
|
|
21
|
+
className: _("wim-chat-ui", p.container, t),
|
|
16
22
|
...n,
|
|
17
23
|
children: e
|
|
18
|
-
}),
|
|
24
|
+
}), S = h(({ children: e, className: t, ...n }, r) => /* @__PURE__ */ y("div", {
|
|
19
25
|
ref: r,
|
|
20
|
-
className:
|
|
26
|
+
className: _(p.messageList, t),
|
|
21
27
|
...n,
|
|
22
28
|
children: e
|
|
23
29
|
}));
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
className:
|
|
27
|
-
...
|
|
30
|
+
S.displayName = "ChatMessageList";
|
|
31
|
+
var C = ({ children: e, position: t = "left", variant: n = "default", showAvatar: r = !0, avatar: i, timestamp: a, metadata: o, senderName: s, isTyping: c = !1, actions: l, actionsVisible: u = !0, className: d, ...f }) => /* @__PURE__ */ b("div", {
|
|
32
|
+
className: _(p.message, p[t], p[n], { [p.hasAvatar]: r }, d),
|
|
33
|
+
...f,
|
|
28
34
|
children: [
|
|
29
|
-
r && t === "left" && /* @__PURE__ */
|
|
30
|
-
className:
|
|
35
|
+
r && t === "left" && /* @__PURE__ */ y("div", {
|
|
36
|
+
className: p.messageAvatar,
|
|
31
37
|
children: i
|
|
32
38
|
}),
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
className:
|
|
39
|
+
/* @__PURE__ */ b("div", {
|
|
40
|
+
className: p.contentWrapper,
|
|
35
41
|
children: [
|
|
36
|
-
|
|
37
|
-
className:
|
|
38
|
-
children:
|
|
42
|
+
s && /* @__PURE__ */ y("div", {
|
|
43
|
+
className: p.sender,
|
|
44
|
+
children: s
|
|
39
45
|
}),
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
className:
|
|
42
|
-
children: c ? /* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ y("div", {
|
|
47
|
+
className: _(p.bubble, { [p.typing]: c }),
|
|
48
|
+
children: c ? /* @__PURE__ */ b(v, { children: [
|
|
49
|
+
/* @__PURE__ */ y("span", { className: p.typingDot }),
|
|
50
|
+
/* @__PURE__ */ y("span", { className: p.typingDot }),
|
|
51
|
+
/* @__PURE__ */ y("span", { className: p.typingDot })
|
|
46
52
|
] }) : e
|
|
47
53
|
}),
|
|
48
|
-
l && /* @__PURE__ */
|
|
49
|
-
className:
|
|
54
|
+
l && /* @__PURE__ */ y("div", {
|
|
55
|
+
className: _(p.actions, { [p.hoverOnly]: !u }),
|
|
50
56
|
children: l
|
|
51
57
|
}),
|
|
52
|
-
a && /* @__PURE__ */
|
|
53
|
-
className:
|
|
54
|
-
children:
|
|
58
|
+
(a || o) && /* @__PURE__ */ b("div", {
|
|
59
|
+
className: p.timestamp,
|
|
60
|
+
children: [
|
|
61
|
+
a,
|
|
62
|
+
a && o && " · ",
|
|
63
|
+
o
|
|
64
|
+
]
|
|
55
65
|
})
|
|
56
66
|
]
|
|
57
67
|
}),
|
|
58
|
-
r && t === "right" && /* @__PURE__ */
|
|
59
|
-
className:
|
|
68
|
+
r && t === "right" && /* @__PURE__ */ y("div", {
|
|
69
|
+
className: p.messageAvatar,
|
|
60
70
|
children: i
|
|
61
71
|
})
|
|
62
72
|
]
|
|
63
|
-
}),
|
|
64
|
-
|
|
73
|
+
}), w = {
|
|
74
|
+
waiting: s,
|
|
75
|
+
done: a,
|
|
76
|
+
error: r
|
|
77
|
+
}, T = ({ name: n, status: r = "done", summary: i, input: a, output: s, defaultExpanded: c = !1, className: l, ...f }) => {
|
|
78
|
+
let { t: h } = e([t, d]), [x, S] = m.useState(c), C = g(), T = a != null || s != null, E = r === "running" ? null : w[r], D = /* @__PURE__ */ b(v, { children: [
|
|
79
|
+
T && /* @__PURE__ */ y(u, {
|
|
80
|
+
component: o,
|
|
81
|
+
size: "sm",
|
|
82
|
+
className: _(p.toolChevron, x && p.expanded),
|
|
83
|
+
"aria-hidden": "true"
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ y("code", {
|
|
86
|
+
className: p.toolName,
|
|
87
|
+
children: n
|
|
88
|
+
}),
|
|
89
|
+
i && /* @__PURE__ */ y("span", {
|
|
90
|
+
className: p.toolSummary,
|
|
91
|
+
children: i
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ b("span", {
|
|
94
|
+
className: _(p.toolStatus, p[r]),
|
|
95
|
+
children: [E ? /* @__PURE__ */ y(u, {
|
|
96
|
+
component: E,
|
|
97
|
+
size: "xs",
|
|
98
|
+
"aria-hidden": "true"
|
|
99
|
+
}) : /* @__PURE__ */ y("span", {
|
|
100
|
+
className: p.toolSpinner,
|
|
101
|
+
"aria-hidden": "true"
|
|
102
|
+
}), h(`agent_status.${r}`)]
|
|
103
|
+
})
|
|
104
|
+
] });
|
|
105
|
+
return /* @__PURE__ */ b("div", {
|
|
106
|
+
className: _(p.toolCall, l),
|
|
107
|
+
"aria-busy": r === "running" || void 0,
|
|
108
|
+
...f,
|
|
109
|
+
children: [T ? /* @__PURE__ */ y("button", {
|
|
110
|
+
type: "button",
|
|
111
|
+
className: p.toolHeader,
|
|
112
|
+
"aria-expanded": x,
|
|
113
|
+
"aria-controls": C,
|
|
114
|
+
onClick: () => S((e) => !e),
|
|
115
|
+
children: D
|
|
116
|
+
}) : /* @__PURE__ */ y("div", {
|
|
117
|
+
className: p.toolHeader,
|
|
118
|
+
children: D
|
|
119
|
+
}), T && /* @__PURE__ */ b("div", {
|
|
120
|
+
id: C,
|
|
121
|
+
className: p.toolBody,
|
|
122
|
+
hidden: !x,
|
|
123
|
+
children: [a != null && /* @__PURE__ */ b("div", {
|
|
124
|
+
className: p.toolSection,
|
|
125
|
+
children: [/* @__PURE__ */ y("div", {
|
|
126
|
+
className: p.toolLabel,
|
|
127
|
+
children: h("chat.tool_input")
|
|
128
|
+
}), typeof a == "string" ? /* @__PURE__ */ y("pre", {
|
|
129
|
+
className: p.toolCode,
|
|
130
|
+
tabIndex: 0,
|
|
131
|
+
children: a
|
|
132
|
+
}) : a]
|
|
133
|
+
}), s != null && /* @__PURE__ */ b("div", {
|
|
134
|
+
className: p.toolSection,
|
|
135
|
+
children: [/* @__PURE__ */ y("div", {
|
|
136
|
+
className: p.toolLabel,
|
|
137
|
+
children: h("chat.tool_output")
|
|
138
|
+
}), typeof s == "string" ? /* @__PURE__ */ y("pre", {
|
|
139
|
+
className: p.toolCode,
|
|
140
|
+
tabIndex: 0,
|
|
141
|
+
children: s
|
|
142
|
+
}) : s]
|
|
143
|
+
})]
|
|
144
|
+
})]
|
|
145
|
+
});
|
|
146
|
+
}, E = {
|
|
147
|
+
warning: i,
|
|
148
|
+
danger: r
|
|
149
|
+
}, D = ({ children: e, intent: t = "default", action: n, className: r, ...i }) => {
|
|
150
|
+
let a = E[t];
|
|
151
|
+
return /* @__PURE__ */ b("div", {
|
|
152
|
+
className: _(p.system, p[t], r),
|
|
153
|
+
...i,
|
|
154
|
+
children: [/* @__PURE__ */ b("span", {
|
|
155
|
+
className: p.systemText,
|
|
156
|
+
children: [a && /* @__PURE__ */ y(u, {
|
|
157
|
+
component: a,
|
|
158
|
+
size: "xs",
|
|
159
|
+
"aria-hidden": "true"
|
|
160
|
+
}), /* @__PURE__ */ y("span", { children: e })]
|
|
161
|
+
}), n && /* @__PURE__ */ y("span", {
|
|
162
|
+
className: p.systemAction,
|
|
163
|
+
children: n
|
|
164
|
+
})]
|
|
165
|
+
});
|
|
166
|
+
}, O = ({ children: e, className: t, ...n }) => /* @__PURE__ */ y("div", {
|
|
167
|
+
className: _(p.inputArea, t),
|
|
65
168
|
...n,
|
|
66
169
|
children: e
|
|
67
|
-
}),
|
|
68
|
-
let { t:
|
|
69
|
-
|
|
70
|
-
let
|
|
71
|
-
|
|
170
|
+
}), k = h(({ onSend: r, onAttach: i, sendButtonLabel: a, sendButtonIcon: o = l, showSendButton: s = !0, showAttach: d = !1, maxRows: h = 8, className: g, ..._ }, v) => {
|
|
171
|
+
let { t: x } = e(t), [S, C] = m.useState(""), w = _.value !== void 0, T = w ? _.value : S, E = f(T, h);
|
|
172
|
+
m.useImperativeHandle(v, () => E.current);
|
|
173
|
+
let D = !!a, k = () => {
|
|
174
|
+
r && (r(T), w || C(""));
|
|
72
175
|
}, A = (e) => {
|
|
73
|
-
|
|
176
|
+
w || C(e.target.value), _.onChange?.(e);
|
|
74
177
|
}, j = (e) => {
|
|
75
178
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), k());
|
|
76
179
|
};
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
-
className:
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
-
className:
|
|
180
|
+
return /* @__PURE__ */ y(O, {
|
|
181
|
+
className: g,
|
|
182
|
+
children: /* @__PURE__ */ b("div", {
|
|
183
|
+
className: p.fieldContainer,
|
|
81
184
|
children: [
|
|
82
|
-
|
|
185
|
+
d && /* @__PURE__ */ y("button", {
|
|
83
186
|
type: "button",
|
|
84
|
-
className:
|
|
85
|
-
onClick:
|
|
86
|
-
"aria-label":
|
|
87
|
-
children: /* @__PURE__ */
|
|
88
|
-
component:
|
|
187
|
+
className: p.attachButton,
|
|
188
|
+
onClick: i,
|
|
189
|
+
"aria-label": x("a11y.attach_file"),
|
|
190
|
+
children: /* @__PURE__ */ y(u, {
|
|
191
|
+
component: c,
|
|
89
192
|
size: "sm"
|
|
90
193
|
})
|
|
91
194
|
}),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
ref:
|
|
94
|
-
className:
|
|
95
|
-
value:
|
|
96
|
-
placeholder:
|
|
195
|
+
/* @__PURE__ */ y("textarea", {
|
|
196
|
+
ref: E,
|
|
197
|
+
className: p.field,
|
|
198
|
+
value: T,
|
|
199
|
+
placeholder: _.placeholder || "Type a message...",
|
|
97
200
|
rows: 1,
|
|
98
|
-
...
|
|
201
|
+
..._,
|
|
99
202
|
onChange: A,
|
|
100
|
-
onKeyDown: n(
|
|
203
|
+
onKeyDown: n(_.onKeyDown, j)
|
|
101
204
|
}),
|
|
102
|
-
|
|
103
|
-
className:
|
|
205
|
+
s && /* @__PURE__ */ y("button", {
|
|
206
|
+
className: p.sendButton,
|
|
104
207
|
onClick: k,
|
|
105
|
-
disabled: !
|
|
208
|
+
disabled: !T.trim(),
|
|
106
209
|
type: "button",
|
|
107
|
-
"aria-label":
|
|
108
|
-
children:
|
|
109
|
-
component:
|
|
210
|
+
"aria-label": a || x("chat.send"),
|
|
211
|
+
children: D ? a : /* @__PURE__ */ y(u, {
|
|
212
|
+
component: o,
|
|
110
213
|
size: "sm"
|
|
111
214
|
})
|
|
112
215
|
})
|
|
@@ -114,22 +217,22 @@ var g = ({ children: e, position: t = "left", variant: n = "default", showAvatar
|
|
|
114
217
|
})
|
|
115
218
|
});
|
|
116
219
|
});
|
|
117
|
-
|
|
118
|
-
var
|
|
119
|
-
let [
|
|
120
|
-
return /* @__PURE__ */
|
|
121
|
-
className:
|
|
122
|
-
...
|
|
123
|
-
children: n && !
|
|
220
|
+
k.displayName = "ChatInput";
|
|
221
|
+
var A = ({ src: n, alt: r, fallback: i, size: a = "md", tone: o = "s18", className: s, ...c }) => {
|
|
222
|
+
let [l, u] = m.useState(!1), { t: d } = e(t), f = r || d("chat.user_avatar");
|
|
223
|
+
return /* @__PURE__ */ y("div", {
|
|
224
|
+
className: _(p.avatar, p[a], p[o], s),
|
|
225
|
+
...c,
|
|
226
|
+
children: n && !l ? /* @__PURE__ */ y("img", {
|
|
124
227
|
src: n,
|
|
125
|
-
alt:
|
|
126
|
-
className:
|
|
127
|
-
onError: () =>
|
|
128
|
-
}) : /* @__PURE__ */
|
|
129
|
-
className:
|
|
130
|
-
children: i ||
|
|
228
|
+
alt: f,
|
|
229
|
+
className: p.image,
|
|
230
|
+
onError: () => u(!0)
|
|
231
|
+
}) : /* @__PURE__ */ y("div", {
|
|
232
|
+
className: p.fallback,
|
|
233
|
+
children: i || f.charAt(0).toUpperCase()
|
|
131
234
|
})
|
|
132
235
|
});
|
|
133
236
|
};
|
|
134
237
|
//#endregion
|
|
135
|
-
export {
|
|
238
|
+
export { A as ChatAvatar, x as ChatContainer, k as ChatInput, O as ChatInputArea, C as ChatMessage, S as ChatMessageList, D as ChatSystemMessage, T as ChatToolCall };
|