@pmate/chat-sdk 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/ChatInput.stories-CSt4WoEv.js +1702 -0
- package/dist/assets/{Color-AVL7NMMY-CdXTB89n.js → Color-AVL7NMMY-BspvszXC.js} +1 -1
- package/dist/assets/{DocsRenderer-PQXLIZUC-CtoiPcLN.js → DocsRenderer-PQXLIZUC-BM8CapQZ.js} +4 -4
- package/dist/assets/{client-BG97-bzh.js → client-Bw6ZM57k.js} +1 -1
- package/dist/assets/{iframe-fcxekwVB.js → iframe-Dci6y3pc.js} +3 -3
- package/dist/assets/iframe-DnNTepBm.css +1 -0
- package/dist/assets/{index-u9_9PRd-.js → index-DQ_t8Ou6.js} +1 -1
- package/dist/assets/{react-18-DKDc3Hbl.js → react-18-3UzO1Bv7.js} +1 -1
- package/dist/iframe.html +2 -2
- package/dist/index.json +1 -1
- package/dist/project.json +1 -1
- package/lib/components/ChatInputDesktop.js +3 -3
- package/lib/components/ChatInputMobile.js +37 -24
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/tokens/chatInputThemes.d.ts +110 -0
- package/lib/tokens/chatInputThemes.js +93 -0
- package/package.json +1 -1
- package/dist/assets/ChatInput.stories-6Z6tmO-P.js +0 -922
- package/dist/assets/iframe-CWturJ6d.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--spacing:.25rem;--ease-out:cubic-bezier(0,0,.2,1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-flex{display:inline-flex}.w-full{width:100%}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.resize{resize:both}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.border{border-style:var(--tw-border-style);border-width:1px}.uppercase{text-transform:uppercase}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as e}from"./iframe-
|
|
1
|
+
import{R as e}from"./iframe-Dci6y3pc.js";import"./preload-helper-PPVm8Dsz.js";const o={},c=e.createContext(o);function u(n){const t=e.useContext(c);return e.useMemo(function(){return typeof n=="function"?n(t):{...t,...n}},[t,n])}function r(n){let t;return n.disableParentContext?t=typeof n.components=="function"?n.components(o):n.components||o:t=u(n.components),e.createElement(c.Provider,{value:t},n.children)}export{r as MDXProvider,u as useMDXComponents};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s}from"./iframe-
|
|
1
|
+
import{r as s}from"./iframe-Dci6y3pc.js";import{c as l}from"./client-Bw6ZM57k.js";import"./preload-helper-PPVm8Dsz.js";var n=new Map;function m(){return globalThis.IS_REACT_ACT_ENVIRONMENT}var a=({callback:e,children:r})=>{let t=s.useRef();return s.useLayoutEffect(()=>{t.current!==e&&(t.current=e,e())},[e]),r};typeof Promise.withResolvers>"u"&&(Promise.withResolvers=()=>{let e=null,r=null;return{promise:new Promise((t,o)=>{e=t,r=o}),resolve:e,reject:r}});var v=async(e,r,t)=>{let o=await c(r,t);if(m()){o.render(e);return}let{promise:i,resolve:u}=Promise.withResolvers();return o.render(s.createElement(a,{callback:u},e)),i},f=(e,r)=>{let t=n.get(e);t&&(t.unmount(),n.delete(e))},c=async(e,r)=>{let t=n.get(e);return t||(t=l.createRoot(e,r),n.set(e,t)),t};export{v as renderElement,f as unmountElement};
|
package/dist/iframe.html
CHANGED
|
@@ -529,9 +529,9 @@
|
|
|
529
529
|
}
|
|
530
530
|
</script>
|
|
531
531
|
|
|
532
|
-
<script type="module" crossorigin src="./assets/iframe-
|
|
532
|
+
<script type="module" crossorigin src="./assets/iframe-Dci6y3pc.js"></script>
|
|
533
533
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-PPVm8Dsz.js">
|
|
534
|
-
<link rel="stylesheet" crossorigin href="./assets/iframe-
|
|
534
|
+
<link rel="stylesheet" crossorigin href="./assets/iframe-DnNTepBm.css">
|
|
535
535
|
</head>
|
|
536
536
|
|
|
537
537
|
<body>
|
package/dist/index.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"v":5,"entries":{"pmate-chat-sdk-chatinput--mobile-idle":{"type":"story","id":"pmate-chat-sdk-chatinput--mobile-idle","name":"Mobile Idle","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--mobile-voice-ready":{"type":"story","id":"pmate-chat-sdk-chatinput--mobile-voice-ready","name":"Mobile Voice Ready","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--mobile-recording":{"type":"story","id":"pmate-chat-sdk-chatinput--mobile-recording","name":"Mobile Recording","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--desktop-typing":{"type":"story","id":"pmate-chat-sdk-chatinput--desktop-typing","name":"Desktop Typing","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--desktop-attachment":{"type":"story","id":"pmate-chat-sdk-chatinput--desktop-attachment","name":"Desktop Attachment","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--waveform-active":{"type":"story","id":"pmate-chat-sdk-chatinput--waveform-active","name":"Waveform Active","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]}}}
|
|
1
|
+
{"v":5,"entries":{"pmate-chat-sdk-chatinput--mobile-idle":{"type":"story","id":"pmate-chat-sdk-chatinput--mobile-idle","name":"Mobile Idle","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--theme-matrix":{"type":"story","id":"pmate-chat-sdk-chatinput--theme-matrix","name":"Theme Matrix","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--cli-mobile-typing":{"type":"story","id":"pmate-chat-sdk-chatinput--cli-mobile-typing","name":"Cli Mobile Typing","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--mobile-voice-ready":{"type":"story","id":"pmate-chat-sdk-chatinput--mobile-voice-ready","name":"Mobile Voice Ready","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--mobile-recording":{"type":"story","id":"pmate-chat-sdk-chatinput--mobile-recording","name":"Mobile Recording","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--desktop-typing":{"type":"story","id":"pmate-chat-sdk-chatinput--desktop-typing","name":"Desktop Typing","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--cli-desktop-typing":{"type":"story","id":"pmate-chat-sdk-chatinput--cli-desktop-typing","name":"Cli Desktop Typing","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--desktop-attachment":{"type":"story","id":"pmate-chat-sdk-chatinput--desktop-attachment","name":"Desktop Attachment","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]},"pmate-chat-sdk-chatinput--waveform-active":{"type":"story","id":"pmate-chat-sdk-chatinput--waveform-active","name":"Waveform Active","title":"@pmate/chat-sdk/ChatInput","importPath":"./src/stories/ChatInput.stories.tsx","tags":["dev","test"]}}}
|
package/dist/project.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"generatedAt":
|
|
1
|
+
{"generatedAt":1777452429859,"userSince":1774065191593,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":false,"refCount":0,"testPackages":{"vitest":"4.0.17"},"hasRouterPackage":false,"monorepo":"Turborepo","packageManager":{"type":"pnpm","version":"10.6.5","agent":"pnpm","nodeLinker":"undefined"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":0,"storybookVersion":"9.1.17","language":"typescript","storybookPackages":{"@storybook/addon-docs":{"version":"9.1.17"},"@storybook/react-vite":{"version":"9.0.17"},"storybook":{"version":"9.1.17"}},"addons":{"$SNIP/node_modules/.pnpm/@storybook+addon-docs@9.1.17_@types+react@19.2.8_storybook@9.1.17_@testing-library+dom@_6282815dfd5a1a048c68a92ca86a2d86/node_modules/@storybook/addon-docs":{}}}
|
|
@@ -123,7 +123,7 @@ function DesktopInner(props) {
|
|
|
123
123
|
state.setText(event.target.value);
|
|
124
124
|
state.setStatus(event.target.value.trim() ? "typing" : "idle");
|
|
125
125
|
props.onChange?.(event.target.value);
|
|
126
|
-
} }), _jsx(AttachmentPreview, { attachments: attachments.attachments, tokens: tokens }), voice.status === "recording" ? (_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(WaveformFeedback, { levels: voice.waveformLevels, tokens: tokens, compact: true }), _jsxs("span", { style: { color: tokens.color.textSecondary, fontSize: 12 }, children: [Math.max(1, Math.round(voice.durationMs / 1000)), "s"] })] })) : null, _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(EmojiTrigger, { ref: emojiAnchorRef, style: { color:
|
|
126
|
+
} }), _jsx(AttachmentPreview, { attachments: attachments.attachments, tokens: tokens }), voice.status === "recording" ? (_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(WaveformFeedback, { levels: voice.waveformLevels, tokens: tokens, compact: true }), _jsxs("span", { style: { color: tokens.color.textSecondary, fontSize: 12 }, children: [Math.max(1, Math.round(voice.durationMs / 1000)), "s"] })] })) : null, _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(EmojiTrigger, { ref: emojiAnchorRef, style: { color: tokens.color.iconDefault }, onClick: () => setIsEmojiOpen((prev) => !prev) }), _jsx("button", { type: "button", onClick: () => imageInputRef.current?.click(), style: {
|
|
127
127
|
display: "inline-flex",
|
|
128
128
|
alignItems: "center",
|
|
129
129
|
justifyContent: "center",
|
|
@@ -131,7 +131,7 @@ function DesktopInner(props) {
|
|
|
131
131
|
height: 32,
|
|
132
132
|
border: 0,
|
|
133
133
|
background: "transparent",
|
|
134
|
-
color:
|
|
134
|
+
color: tokens.color.iconDefault,
|
|
135
135
|
cursor: props.disabled || isUploadingImage ? "not-allowed" : "pointer",
|
|
136
136
|
opacity: props.disabled || isUploadingImage ? 0.4 : 1,
|
|
137
137
|
}, disabled: props.disabled || isUploadingImage, children: _jsx(ImageOutlineIcon, { size: 22 }) }), _jsx("button", { type: "button", onClick: () => {
|
|
@@ -154,7 +154,7 @@ function DesktopInner(props) {
|
|
|
154
154
|
background: "transparent",
|
|
155
155
|
color: voice.status === "recording" || voice.status === "transcribing"
|
|
156
156
|
? tokens.color.iconActive
|
|
157
|
-
:
|
|
157
|
+
: tokens.color.iconDefault,
|
|
158
158
|
cursor: props.disabled || props.enableVoice === false ? "not-allowed" : "pointer",
|
|
159
159
|
opacity: props.disabled || props.enableVoice === false ? 0.4 : 1,
|
|
160
160
|
}, "aria-label": voice.status === "recording"
|
|
@@ -140,8 +140,8 @@ function MobileInner(props) {
|
|
|
140
140
|
width: "100%",
|
|
141
141
|
maxWidth: 420,
|
|
142
142
|
padding: 0,
|
|
143
|
-
background: "
|
|
144
|
-
borderRadius:
|
|
143
|
+
background: "transparent",
|
|
144
|
+
borderRadius: tokens.radius.inputSurface,
|
|
145
145
|
border: 0,
|
|
146
146
|
boxShadow: "none",
|
|
147
147
|
overflow: "visible",
|
|
@@ -238,10 +238,10 @@ function MobileInner(props) {
|
|
|
238
238
|
} }), _jsxs("div", { style: {
|
|
239
239
|
position: "relative",
|
|
240
240
|
display: "grid",
|
|
241
|
-
gridTemplateColumns: "
|
|
242
|
-
gap:
|
|
241
|
+
gridTemplateColumns: "32px minmax(0, 1fr) 32px auto",
|
|
242
|
+
gap: tokens.spacing.actionGap,
|
|
243
243
|
alignItems: "end",
|
|
244
|
-
padding: "
|
|
244
|
+
padding: "0 0 env(safe-area-inset-bottom, 0px)",
|
|
245
245
|
}, children: [_jsx(EmojiPicker, { open: isEmojiOpen, isMobile: true, anchorRef: emojiAnchorRef, onSelect: insertEmoji, onClose: () => setIsEmojiOpen(false) }), _jsx("button", { type: "button", "aria-label": state.mode === "voice" ? "切换到文字输入" : "切换到语音输入", disabled: props.disabled || props.enableVoice === false, onClick: () => {
|
|
246
246
|
const next = state.mode === "voice" ? "text" : "voice";
|
|
247
247
|
state.setMode(next);
|
|
@@ -255,17 +255,29 @@ function MobileInner(props) {
|
|
|
255
255
|
border: 0,
|
|
256
256
|
borderRadius: 999,
|
|
257
257
|
background: "transparent",
|
|
258
|
-
color: "
|
|
258
|
+
color: state.mode === "voice"
|
|
259
|
+
? tokens.color.iconActive
|
|
260
|
+
: tokens.color.iconDefault,
|
|
259
261
|
cursor: "pointer",
|
|
260
262
|
alignSelf: "center",
|
|
261
263
|
opacity: props.disabled ? 0.45 : 1,
|
|
262
264
|
}, children: state.mode === "voice" ? _jsx(KeyboardOutlineIcon, { size: 24 }) : _jsx(MicOutlineIcon, { size: 24 }) }), _jsx(InputSurface, { tokens: tokens, status: state.status, styleOverride: {
|
|
263
|
-
borderRadius:
|
|
264
|
-
background: "
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
borderRadius: tokens.radius.inputSurface,
|
|
266
|
+
background: state.status === "error"
|
|
267
|
+
? tokens.color.surfaceInputError
|
|
268
|
+
: state.status === "recording"
|
|
269
|
+
? tokens.color.surfaceInputRecording
|
|
270
|
+
: tokens.color.surfaceInputDefault,
|
|
271
|
+
borderColor: state.status === "error"
|
|
272
|
+
? tokens.color.borderError
|
|
273
|
+
: state.status === "typing"
|
|
274
|
+
? tokens.color.borderFocus
|
|
275
|
+
: tokens.color.borderDefault,
|
|
276
|
+
boxShadow: state.status === "recording"
|
|
277
|
+
? tokens.shadow.recordingActive
|
|
278
|
+
: tokens.shadow.inputElevated,
|
|
279
|
+
minHeight: state.mode === "voice" ? 48 : 42,
|
|
280
|
+
padding: state.mode === "voice" ? "0" : "0 10px",
|
|
269
281
|
}, children: state.mode === "voice" ? (_jsx("div", { children: _jsx(HoldToTalkButton, { tokens: tokens, active: isRecordingOverlayVisible, disabled: props.disabled, text: "\u6309\u4F4F \u8BF4\u8BDD", activeText: "\u677E\u5F00 \u53D1\u9001", onPressStart: () => {
|
|
270
282
|
setRecordingChoice("send");
|
|
271
283
|
voice.startRecording();
|
|
@@ -285,31 +297,32 @@ function MobileInner(props) {
|
|
|
285
297
|
}, onPressCancel: () => {
|
|
286
298
|
setRecordingChoice("send");
|
|
287
299
|
voice.cancelRecording();
|
|
288
|
-
} }) })) : (_jsx(TextComposer, { ref: textComposerRef, tokens: tokens, value: state.text, rows: 1, placeholder: "
|
|
300
|
+
} }) })) : (_jsx(TextComposer, { ref: textComposerRef, tokens: tokens, value: state.text, rows: 1, placeholder: "Message", onChange: (event) => {
|
|
289
301
|
state.setText(event.target.value);
|
|
290
302
|
state.setStatus(event.target.value.trim() ? "typing" : "idle");
|
|
291
303
|
props.onChange?.(event.target.value);
|
|
292
304
|
}, style: {
|
|
293
305
|
minHeight: 18,
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
306
|
+
maxHeight: 92,
|
|
307
|
+
paddingTop: 9,
|
|
308
|
+
paddingBottom: 9,
|
|
309
|
+
color: tokens.color.textPrimary,
|
|
310
|
+
fontSize: tokens.typography.inputText.size,
|
|
311
|
+
lineHeight: `${tokens.typography.inputText.lineHeight}px`,
|
|
299
312
|
caretColor: tokens.color.brandPrimary,
|
|
300
313
|
} })) }), _jsx(EmojiTrigger, { ref: emojiAnchorRef, "data-icon-size": 24, onClick: () => setIsEmojiOpen((prev) => !prev), style: {
|
|
301
|
-
color:
|
|
314
|
+
color: tokens.color.iconDefault,
|
|
302
315
|
alignSelf: "center",
|
|
303
316
|
width: 28,
|
|
304
317
|
height: 28,
|
|
305
318
|
} }), state.mode === "text" && state.text.trim() ? (_jsx(SendAction, { tokens: tokens, disabled: props.disabled, onClick: () => void onSend(), style: {
|
|
306
319
|
minWidth: 64,
|
|
307
|
-
minHeight:
|
|
308
|
-
borderRadius:
|
|
320
|
+
minHeight: 32,
|
|
321
|
+
borderRadius: tokens.radius.actionButton,
|
|
309
322
|
alignSelf: "center",
|
|
310
|
-
padding: "0
|
|
311
|
-
}, children: "
|
|
312
|
-
color:
|
|
323
|
+
padding: "0 14px",
|
|
324
|
+
}, children: "Send" })) : (_jsx(ImageTrigger, { "data-icon-size": 24, onClick: () => imageInputRef.current?.click(), disabled: props.disabled || isUploadingImage, style: {
|
|
325
|
+
color: tokens.color.iconDefault,
|
|
313
326
|
alignSelf: "center",
|
|
314
327
|
width: 28,
|
|
315
328
|
height: 28,
|
package/lib/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./hooks/useVoiceInputController";
|
|
|
17
17
|
export * from "./services/agentSdkASRClient";
|
|
18
18
|
export * from "./services/authTokenResolver";
|
|
19
19
|
export * from "./tokens/defaultTokens";
|
|
20
|
+
export * from "./tokens/chatInputThemes";
|
|
20
21
|
export * from "./types/attachment";
|
|
21
22
|
export * from "./types/chatInput";
|
|
22
23
|
export * from "./types/voice";
|
package/lib/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./hooks/useVoiceInputController";
|
|
|
17
17
|
export * from "./services/agentSdkASRClient";
|
|
18
18
|
export * from "./services/authTokenResolver";
|
|
19
19
|
export * from "./tokens/defaultTokens";
|
|
20
|
+
export * from "./tokens/chatInputThemes";
|
|
20
21
|
export * from "./types/attachment";
|
|
21
22
|
export * from "./types/chatInput";
|
|
22
23
|
export * from "./types/voice";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export type ChatInputThemeName = "pmate" | "cli" | "compact";
|
|
2
|
+
export declare const chatInputThemes: {
|
|
3
|
+
pmate: {};
|
|
4
|
+
cli: {
|
|
5
|
+
color: {
|
|
6
|
+
brandPrimary: string;
|
|
7
|
+
surfaceInputDefault: string;
|
|
8
|
+
surfaceInputFocus: string;
|
|
9
|
+
surfaceInputRecording: string;
|
|
10
|
+
surfaceInputError: string;
|
|
11
|
+
textPrimary: string;
|
|
12
|
+
textSecondary: string;
|
|
13
|
+
iconDefault: string;
|
|
14
|
+
iconActive: string;
|
|
15
|
+
actionSendDefault: string;
|
|
16
|
+
actionSendDisabled: string;
|
|
17
|
+
actionSendTextOnPrimary: string;
|
|
18
|
+
borderDefault: string;
|
|
19
|
+
borderFocus: string;
|
|
20
|
+
borderError: string;
|
|
21
|
+
statusError: string;
|
|
22
|
+
statusWarning: string;
|
|
23
|
+
statusSuccess: string;
|
|
24
|
+
voiceWaveformActive: string;
|
|
25
|
+
voiceWaveformBackground: string;
|
|
26
|
+
};
|
|
27
|
+
spacing: {
|
|
28
|
+
inputOuter: number;
|
|
29
|
+
inputInner: number;
|
|
30
|
+
actionGap: number;
|
|
31
|
+
attachmentGap: number;
|
|
32
|
+
voiceWaveformGap: number;
|
|
33
|
+
mobileTouchInset: number;
|
|
34
|
+
desktopToolbarGap: number;
|
|
35
|
+
statusHintTop: number;
|
|
36
|
+
};
|
|
37
|
+
radius: {
|
|
38
|
+
inputSurface: number;
|
|
39
|
+
actionButton: number;
|
|
40
|
+
attachmentPreview: number;
|
|
41
|
+
waveformBar: number;
|
|
42
|
+
mobileHoldToTalk: number;
|
|
43
|
+
desktopInputSurface: number;
|
|
44
|
+
};
|
|
45
|
+
shadow: {
|
|
46
|
+
inputElevated: string;
|
|
47
|
+
recordingActive: string;
|
|
48
|
+
};
|
|
49
|
+
typography: {
|
|
50
|
+
familyBase: string;
|
|
51
|
+
familyMono: string;
|
|
52
|
+
inputText: {
|
|
53
|
+
size: number;
|
|
54
|
+
lineHeight: number;
|
|
55
|
+
weight: number;
|
|
56
|
+
};
|
|
57
|
+
statusHint: {
|
|
58
|
+
size: number;
|
|
59
|
+
lineHeight: number;
|
|
60
|
+
weight: number;
|
|
61
|
+
};
|
|
62
|
+
actionLabel: {
|
|
63
|
+
size: number;
|
|
64
|
+
lineHeight: number;
|
|
65
|
+
weight: number;
|
|
66
|
+
};
|
|
67
|
+
voiceHoldToTalk: {
|
|
68
|
+
size: number;
|
|
69
|
+
lineHeight: number;
|
|
70
|
+
weight: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
compact: {
|
|
75
|
+
color: {
|
|
76
|
+
brandPrimary: string;
|
|
77
|
+
surfaceInputDefault: string;
|
|
78
|
+
surfaceInputFocus: string;
|
|
79
|
+
surfaceInputRecording: string;
|
|
80
|
+
surfaceInputError: string;
|
|
81
|
+
textPrimary: string;
|
|
82
|
+
textSecondary: string;
|
|
83
|
+
iconDefault: string;
|
|
84
|
+
iconActive: string;
|
|
85
|
+
actionSendDefault: string;
|
|
86
|
+
actionSendDisabled: string;
|
|
87
|
+
actionSendTextOnPrimary: string;
|
|
88
|
+
borderDefault: string;
|
|
89
|
+
borderFocus: string;
|
|
90
|
+
borderError: string;
|
|
91
|
+
statusError: string;
|
|
92
|
+
statusWarning: string;
|
|
93
|
+
statusSuccess: string;
|
|
94
|
+
voiceWaveformActive: string;
|
|
95
|
+
voiceWaveformBackground: string;
|
|
96
|
+
};
|
|
97
|
+
radius: {
|
|
98
|
+
inputSurface: number;
|
|
99
|
+
actionButton: number;
|
|
100
|
+
attachmentPreview: number;
|
|
101
|
+
waveformBar: number;
|
|
102
|
+
mobileHoldToTalk: number;
|
|
103
|
+
desktopInputSurface: number;
|
|
104
|
+
};
|
|
105
|
+
shadow: {
|
|
106
|
+
inputElevated: string;
|
|
107
|
+
recordingActive: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export const chatInputThemes = {
|
|
2
|
+
pmate: {},
|
|
3
|
+
cli: {
|
|
4
|
+
color: {
|
|
5
|
+
brandPrimary: "#15D49A",
|
|
6
|
+
surfaceInputDefault: "#07110E",
|
|
7
|
+
surfaceInputFocus: "#0C1B16",
|
|
8
|
+
surfaceInputRecording: "#0F251E",
|
|
9
|
+
surfaceInputError: "#251111",
|
|
10
|
+
textPrimary: "#E8FFF5",
|
|
11
|
+
textSecondary: "#79A996",
|
|
12
|
+
iconDefault: "#8DB7A7",
|
|
13
|
+
iconActive: "#15D49A",
|
|
14
|
+
actionSendDefault: "#15D49A",
|
|
15
|
+
actionSendDisabled: "#23483B",
|
|
16
|
+
actionSendTextOnPrimary: "#06100D",
|
|
17
|
+
borderDefault: "#1A3A30",
|
|
18
|
+
borderFocus: "#15D49A",
|
|
19
|
+
borderError: "#D66B6B",
|
|
20
|
+
statusError: "#FF8A8A",
|
|
21
|
+
statusWarning: "#E0B256",
|
|
22
|
+
statusSuccess: "#15D49A",
|
|
23
|
+
voiceWaveformActive: "#15D49A",
|
|
24
|
+
voiceWaveformBackground: "#214A3C",
|
|
25
|
+
},
|
|
26
|
+
spacing: {
|
|
27
|
+
inputOuter: 10,
|
|
28
|
+
inputInner: 10,
|
|
29
|
+
actionGap: 8,
|
|
30
|
+
attachmentGap: 8,
|
|
31
|
+
voiceWaveformGap: 4,
|
|
32
|
+
mobileTouchInset: 10,
|
|
33
|
+
desktopToolbarGap: 10,
|
|
34
|
+
statusHintTop: 6,
|
|
35
|
+
},
|
|
36
|
+
radius: {
|
|
37
|
+
inputSurface: 8,
|
|
38
|
+
actionButton: 6,
|
|
39
|
+
attachmentPreview: 6,
|
|
40
|
+
waveformBar: 2,
|
|
41
|
+
mobileHoldToTalk: 6,
|
|
42
|
+
desktopInputSurface: 8,
|
|
43
|
+
},
|
|
44
|
+
shadow: {
|
|
45
|
+
inputElevated: "0 0 0 1px rgba(21, 212, 154, 0.10)",
|
|
46
|
+
recordingActive: "0 0 0 2px rgba(21, 212, 154, 0.28)",
|
|
47
|
+
},
|
|
48
|
+
typography: {
|
|
49
|
+
familyBase: '"SF Mono", "JetBrains Mono", monospace',
|
|
50
|
+
familyMono: '"SF Mono", "JetBrains Mono", monospace',
|
|
51
|
+
inputText: { size: 14, lineHeight: 20, weight: 500 },
|
|
52
|
+
statusHint: { size: 11, lineHeight: 16, weight: 500 },
|
|
53
|
+
actionLabel: { size: 12, lineHeight: 16, weight: 700 },
|
|
54
|
+
voiceHoldToTalk: { size: 13, lineHeight: 18, weight: 700 },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
compact: {
|
|
58
|
+
color: {
|
|
59
|
+
brandPrimary: "#0EA5E9",
|
|
60
|
+
surfaceInputDefault: "#F8FAFC",
|
|
61
|
+
surfaceInputFocus: "#F0F9FF",
|
|
62
|
+
surfaceInputRecording: "#E0F2FE",
|
|
63
|
+
surfaceInputError: "#FFF1F2",
|
|
64
|
+
textPrimary: "#0F172A",
|
|
65
|
+
textSecondary: "#64748B",
|
|
66
|
+
iconDefault: "#475569",
|
|
67
|
+
iconActive: "#0284C7",
|
|
68
|
+
actionSendDefault: "#0F172A",
|
|
69
|
+
actionSendDisabled: "#CBD5E1",
|
|
70
|
+
actionSendTextOnPrimary: "#FFFFFF",
|
|
71
|
+
borderDefault: "#CBD5E1",
|
|
72
|
+
borderFocus: "#7DD3FC",
|
|
73
|
+
borderError: "#FDA4AF",
|
|
74
|
+
statusError: "#E11D48",
|
|
75
|
+
statusWarning: "#B45309",
|
|
76
|
+
statusSuccess: "#047857",
|
|
77
|
+
voiceWaveformActive: "#0284C7",
|
|
78
|
+
voiceWaveformBackground: "#BAE6FD",
|
|
79
|
+
},
|
|
80
|
+
radius: {
|
|
81
|
+
inputSurface: 10,
|
|
82
|
+
actionButton: 8,
|
|
83
|
+
attachmentPreview: 8,
|
|
84
|
+
waveformBar: 999,
|
|
85
|
+
mobileHoldToTalk: 10,
|
|
86
|
+
desktopInputSurface: 10,
|
|
87
|
+
},
|
|
88
|
+
shadow: {
|
|
89
|
+
inputElevated: "none",
|
|
90
|
+
recordingActive: "0 0 0 3px rgba(14, 165, 233, 0.16)",
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|