@swisper.ai/web-chat-ui 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chat-prompt-box/chat-prompt-box-context.d.ts +10 -1
- package/dist/components/chat-prompt-box/chat-prompt-box-context.d.ts.map +1 -1
- package/dist/components/chat-prompt-box/chat-prompt-box-voice-motion.d.ts +85 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-voice-motion.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-voice.d.ts +20 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-voice.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-voice.stories.d.ts +45 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-voice.stories.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts +24 -1
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts.map +1 -1
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts.map +1 -1
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/chat-prompt-box-voice-bar-icon.d.ts +31 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/chat-prompt-box-voice-bar-icon.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/chat-prompt-box-voice-bar-icon.stories.d.ts +17 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/chat-prompt-box-voice-bar-icon.stories.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/index.d.ts +3 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/index.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-button/chat-prompt-box-voice-button.d.ts +29 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-button/chat-prompt-box-voice-button.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-button/chat-prompt-box-voice-button.stories.d.ts +12 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-button/chat-prompt-box-voice-button.stories.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-button/index.d.ts +3 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-button/index.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-light/chat-prompt-box-voice-light.d.ts +44 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-light/chat-prompt-box-voice-light.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-light/chat-prompt-box-voice-light.stories.d.ts +17 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-light/chat-prompt-box-voice-light.stories.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-light/index.d.ts +3 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-light/index.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/chat-prompt-box-voice-mic-button.d.ts +14 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/chat-prompt-box-voice-mic-button.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/chat-prompt-box-voice-mic-button.stories.d.ts +11 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/chat-prompt-box-voice-mic-button.stories.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/index.d.ts +3 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/index.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-panel/chat-prompt-box-voice-panel.d.ts +18 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-panel/chat-prompt-box-voice-panel.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-panel/chat-prompt-box-voice-panel.stories.d.ts +18 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-panel/chat-prompt-box-voice-panel.stories.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-panel/index.d.ts +3 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-panel/index.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-sound-button/chat-prompt-box-voice-sound-button.d.ts +14 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-sound-button/chat-prompt-box-voice-sound-button.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-sound-button/chat-prompt-box-voice-sound-button.stories.d.ts +11 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-sound-button/chat-prompt-box-voice-sound-button.stories.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-sound-button/index.d.ts +3 -0
- package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-sound-button/index.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/components/index.d.ts +7 -0
- package/dist/components/chat-prompt-box/components/index.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/index.d.ts +5 -1
- package/dist/components/chat-prompt-box/index.d.ts.map +1 -1
- package/dist/components/chat-prompt-box/use-voice-motion.d.ts +22 -0
- package/dist/components/chat-prompt-box/use-voice-motion.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.es.js +2285 -1443
- package/dist/index.es.js.map +1 -1
- package/package.json +2 -2
- package/src/components/chat-prompt-box/chat-prompt-box-context.tsx +35 -1
- package/src/components/chat-prompt-box/chat-prompt-box-voice-motion.ts +436 -0
- package/src/components/chat-prompt-box/chat-prompt-box-voice.stories.tsx +243 -0
- package/src/components/chat-prompt-box/chat-prompt-box-voice.tsx +191 -0
- package/src/components/chat-prompt-box/chat-prompt-box.json +66 -7
- package/src/components/chat-prompt-box/chat-prompt-box.stories.tsx +16 -0
- package/src/components/chat-prompt-box/chat-prompt-box.tsx +131 -77
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/chat-prompt-box-voice-bar-icon.stories.tsx +155 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/chat-prompt-box-voice-bar-icon.tsx +80 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/index.ts +5 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-button/chat-prompt-box-voice-button.stories.tsx +107 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-button/chat-prompt-box-voice-button.tsx +101 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-button/index.ts +5 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-light/chat-prompt-box-voice-light.stories.tsx +177 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-light/chat-prompt-box-voice-light.tsx +283 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-light/index.ts +5 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/chat-prompt-box-voice-mic-button.stories.tsx +50 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/chat-prompt-box-voice-mic-button.tsx +46 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/index.ts +2 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-panel/chat-prompt-box-voice-panel.stories.tsx +149 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-panel/chat-prompt-box-voice-panel.tsx +55 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-panel/index.ts +5 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-sound-button/chat-prompt-box-voice-sound-button.stories.tsx +50 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-sound-button/chat-prompt-box-voice-sound-button.tsx +46 -0
- package/src/components/chat-prompt-box/components/chat-prompt-box-voice-sound-button/index.ts +2 -0
- package/src/components/chat-prompt-box/components/index.ts +6 -0
- package/src/components/chat-prompt-box/index.ts +23 -0
- package/src/components/chat-prompt-box/use-voice-motion.ts +184 -0
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { VoiceMotionRegistry } from './use-voice-motion';
|
|
3
|
+
export type ChatPromptBoxMode = 'text' | 'connecting' | 'listening' | 'user-speaking' | 'thinking' | 'answering' | 'mic-muted' | 'reconnecting';
|
|
2
4
|
interface ChatPromptBoxContextValue {
|
|
5
|
+
mode: ChatPromptBoxMode;
|
|
6
|
+
/** The box's voice clock; the voice parts register with it to move with the box. */
|
|
7
|
+
voiceMotion: VoiceMotionRegistry;
|
|
3
8
|
reportInputHeight: (height: number) => void;
|
|
4
9
|
resetCompact: () => void;
|
|
5
10
|
registerFocusInput: (focus: () => void) => void;
|
|
@@ -7,11 +12,15 @@ interface ChatPromptBoxContextValue {
|
|
|
7
12
|
focusInput: () => void;
|
|
8
13
|
}
|
|
9
14
|
export declare function useChatPromptBoxContext(): ChatPromptBoxContextValue;
|
|
15
|
+
/** The box's context, or `null` outside a `ChatPromptBox`. For parts that also work on their own. */
|
|
16
|
+
export declare function useOptionalChatPromptBoxContext(): ChatPromptBoxContextValue | null;
|
|
10
17
|
interface ChatPromptBoxContextProviderProps {
|
|
11
18
|
children: ReactNode;
|
|
19
|
+
mode: ChatPromptBoxMode;
|
|
20
|
+
voiceMotion: VoiceMotionRegistry;
|
|
12
21
|
reportInputHeight: (height: number) => void;
|
|
13
22
|
resetCompact: () => void;
|
|
14
23
|
}
|
|
15
|
-
export declare function ChatPromptBoxContextProvider({ children, reportInputHeight, resetCompact, }: ChatPromptBoxContextProviderProps): import('react').JSX.Element;
|
|
24
|
+
export declare function ChatPromptBoxContextProvider({ children, mode, voiceMotion, reportInputHeight, resetCompact, }: ChatPromptBoxContextProviderProps): import('react').JSX.Element;
|
|
16
25
|
export {};
|
|
17
26
|
//# sourceMappingURL=chat-prompt-box-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-prompt-box-context.d.ts","sourceRoot":"","sources":["../../../src/components/chat-prompt-box/chat-prompt-box-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhG,UAAU,yBAAyB;IACjC,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAChD,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAID,wBAAgB,uBAAuB,8BAQtC;AAED,UAAU,iCAAiC;IACzC,QAAQ,EAAE,SAAS,CAAC;IACpB,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,QAAQ,EACR,iBAAiB,EACjB,YAAY,GACb,EAAE,iCAAiC,+
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-context.d.ts","sourceRoot":"","sources":["../../../src/components/chat-prompt-box/chat-prompt-box-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,YAAY,GACZ,WAAW,GACX,eAAe,GACf,UAAU,GACV,WAAW,GACX,WAAW,GACX,cAAc,CAAC;AAEnB,UAAU,yBAAyB;IACjC,IAAI,EAAE,iBAAiB,CAAC;IACxB,oFAAoF;IACpF,WAAW,EAAE,mBAAmB,CAAC;IACjC,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAChD,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAID,wBAAgB,uBAAuB,8BAQtC;AAED,qGAAqG;AACrG,wBAAgB,+BAA+B,qCAE9C;AAED,UAAU,iCAAiC;IACzC,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,EAAE,iBAAiB,CAAC;IACxB,WAAW,EAAE,mBAAmB,CAAC;IACjC,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,iBAAiB,EACjB,YAAY,GACb,EAAE,iCAAiC,+BAuCnC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ChatPromptBoxMode } from './chat-prompt-box-context';
|
|
2
|
+
/** `pulse`: the grey breath. `travel`: two lights round the outline. `beat`: the Thinking surge. */
|
|
3
|
+
export type VoiceBorderKind = 'pulse' | 'travel' | 'beat';
|
|
4
|
+
/** The light behind the box, or `none`. */
|
|
5
|
+
export type VoiceLightKind = 'none' | 'listening' | 'user-speaking' | 'thinking' | 'speaking';
|
|
6
|
+
/** The voice button's bars. `voice-starts` is `listening` with the two kicks of the sound on entry. */
|
|
7
|
+
export type VoiceBarsKind = 'still' | 'listening' | 'voice-starts' | 'thinking' | 'voice' | 'muted';
|
|
8
|
+
export interface VoiceMotionKinds {
|
|
9
|
+
border: VoiceBorderKind;
|
|
10
|
+
light: VoiceLightKind;
|
|
11
|
+
bars: VoiceBarsKind;
|
|
12
|
+
}
|
|
13
|
+
type VoiceMode = Exclude<ChatPromptBoxMode, 'text'>;
|
|
14
|
+
/** What each part does in each mode. */
|
|
15
|
+
export declare const VOICE_MOTION_BY_MODE: Record<VoiceMode, VoiceMotionKinds>;
|
|
16
|
+
/**
|
|
17
|
+
* The parts for `mode`, or `null` with voice off. Reaching Listening from Connecting plays the
|
|
18
|
+
* "Voice starts" kicks on the bars.
|
|
19
|
+
*/
|
|
20
|
+
export declare function voiceMotionKindsFor(mode: ChatPromptBoxMode, previous: ChatPromptBoxMode): VoiceMotionKinds | null;
|
|
21
|
+
/** The light's height at level 1. */
|
|
22
|
+
export declare const VOICE_LIGHT_MAX_RISE = 72;
|
|
23
|
+
export type VoiceLightState = Exclude<VoiceLightKind, 'none'>;
|
|
24
|
+
/** Haze, body and rim: how far each rises (share of the haze) and its cream peak. */
|
|
25
|
+
export declare const VOICE_LIGHT_LAYERS: readonly [{
|
|
26
|
+
readonly name: "haze";
|
|
27
|
+
readonly riseScale: 1;
|
|
28
|
+
readonly creamScale: 1;
|
|
29
|
+
readonly creamCap: 1;
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "body";
|
|
32
|
+
readonly riseScale: 0.7;
|
|
33
|
+
readonly creamScale: 2;
|
|
34
|
+
readonly creamCap: 1;
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "rim";
|
|
37
|
+
readonly riseScale: 0.3;
|
|
38
|
+
readonly creamScale: 2.9;
|
|
39
|
+
readonly creamCap: 0.98;
|
|
40
|
+
}];
|
|
41
|
+
/** The haze's rise at an intensity of the state (0 = Min frame, 0.5 = Base, 1 = Max). */
|
|
42
|
+
export declare function voiceLightRiseAt(state: VoiceLightState, intensity: number): number;
|
|
43
|
+
/**
|
|
44
|
+
* The light's CSS variables for a rise: `--voice-light-rise`, and per layer
|
|
45
|
+
* `--voice-light-opacity-{layer}` and, in Speaking, `--voice-light-cream-{layer}`. `presence`
|
|
46
|
+
* fades the whole light, 0 to 1.
|
|
47
|
+
*/
|
|
48
|
+
export declare function voiceLightVars(state: VoiceLightState, rise: number, presence?: number): Record<string, string>;
|
|
49
|
+
export interface VoiceMotionFrame {
|
|
50
|
+
/** The two border lights along the outline, 0 to 1. */
|
|
51
|
+
spotA: number;
|
|
52
|
+
spotB: number;
|
|
53
|
+
spotStrength: number;
|
|
54
|
+
/** The faint line, relative to its token (1 at the Listening strength). */
|
|
55
|
+
lineStrength: number;
|
|
56
|
+
/** How much the grey pulse covers the lights, 0 to 1. */
|
|
57
|
+
pulseMix: number;
|
|
58
|
+
/** The grey pulse's opacity. */
|
|
59
|
+
pulse: number;
|
|
60
|
+
/** The light's look (the last live state while it fades out). */
|
|
61
|
+
lightState: VoiceLightState;
|
|
62
|
+
lightRise: number;
|
|
63
|
+
lightPresence: number;
|
|
64
|
+
/** Bar heights in px, left to right. */
|
|
65
|
+
bars: number[];
|
|
66
|
+
}
|
|
67
|
+
export interface VoiceMotion {
|
|
68
|
+
setKinds: (kinds: VoiceMotionKinds) => void;
|
|
69
|
+
/** Advance by `dt` seconds; `voice` is the speaker's loudness, 0 to 1. */
|
|
70
|
+
step: (dt: number, voice: number) => void;
|
|
71
|
+
frame: () => VoiceMotionFrame;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* One clock for the border, the light and the bars. Each state's motion is its formula of the time
|
|
75
|
+
* since the state began; on a change, the difference to the new formula decays (0.45s for the
|
|
76
|
+
* border's pace and the crossfade, 0.08s up / 0.6s down for the light), so nothing jumps.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createVoiceMotion(initial: VoiceMotionKinds): VoiceMotion;
|
|
79
|
+
/**
|
|
80
|
+
* The resting look of each state, for reduced motion: the lights where the Echo DS frames draw
|
|
81
|
+
* them, the light and the bars at Base. The voice states still follow `voice`, without easing.
|
|
82
|
+
*/
|
|
83
|
+
export declare function restVoiceMotion(kinds: VoiceMotionKinds, voice: number, lightState?: VoiceLightState): VoiceMotionFrame;
|
|
84
|
+
export {};
|
|
85
|
+
//# sourceMappingURL=chat-prompt-box-voice-motion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice-motion.d.ts","sourceRoot":"","sources":["../../../src/components/chat-prompt-box/chat-prompt-box-voice-motion.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,oGAAoG;AACpG,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1D,2CAA2C;AAC3C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,UAAU,GAAG,UAAU,CAAC;AAE9F,uGAAuG;AACvG,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,WAAW,GAAG,cAAc,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpG,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,KAAK,SAAS,GAAG,OAAO,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAEpD,wCAAwC;AACxC,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,SAAS,EAAE,gBAAgB,CAQpE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,iBAAiB,GAC1B,gBAAgB,GAAG,IAAI,CAOzB;AAsBD,qCAAqC;AACrC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AA8HvC,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AA8B9D,qFAAqF;AACrF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAIrB,CAAC;AASX,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,UAGzE;AAQD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAI,0BAqBhF;AAMD,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,YAAY,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,UAAU,EAAE,eAAe,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5C,0EAA0E;IAC1E,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,KAAK,EAAE,MAAM,gBAAgB,CAAC;CAC/B;AAcD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,WAAW,CAwDxE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,eAAwD,GACnE,gBAAgB,CAsClB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
import { ChatPromptBoxMode } from './chat-prompt-box-context';
|
|
3
|
+
type VoiceMode = Exclude<ChatPromptBoxMode, 'text'>;
|
|
4
|
+
/** The voice ring behind the box and the light above it, moved by the box's voice clock. */
|
|
5
|
+
export declare function ChatPromptBoxVoiceDecor({ mode, bands, }: {
|
|
6
|
+
mode: VoiceMode;
|
|
7
|
+
bands?: readonly number[];
|
|
8
|
+
}): import('react').JSX.Element;
|
|
9
|
+
export interface ChatPromptBoxVoiceStateWordProps extends ComponentPropsWithoutRef<'span'> {
|
|
10
|
+
/** Overrides the word for the box's mode, e.g. a translation. */
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The word for the voice state (`Listening`, `Thinking`, `Mic muted`, …), announced politely when it changes.
|
|
15
|
+
* Outside a `ChatPromptBox` it shows only its children. 104px wide on desktop; fills the panel on
|
|
16
|
+
* mobile.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ChatPromptBoxVoiceStateWord({ className, children, ...rest }: ChatPromptBoxVoiceStateWordProps): import('react').JSX.Element | null;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=chat-prompt-box-voice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice.d.ts","sourceRoot":"","sources":["../../../src/components/chat-prompt-box/chat-prompt-box-voice.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAQhF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAKnE,KAAK,SAAS,GAAG,OAAO,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAsGpD,4FAA4F;AAC5F,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,KAAK,GACN,EAAE;IACD,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,+BAiBA;AAaD,MAAM,WAAW,gCAAiC,SAAQ,wBAAwB,CAAC,MAAM,CAAC;IACxF,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,gCAAgC,sCAwBlC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ChatPromptBoxMode } from './chat-prompt-box';
|
|
3
|
+
interface VoiceComposerProps {
|
|
4
|
+
mode: ChatPromptBoxMode;
|
|
5
|
+
/** What the user has said so far. With text, the voice button becomes Send. */
|
|
6
|
+
transcript?: string;
|
|
7
|
+
onEndVoice: () => void;
|
|
8
|
+
onSend: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A voice composer as the app would build it. The mic and sound switches follow the spec: muting
|
|
12
|
+
* while Listening shows Mic muted, turning the sound off while Answering goes back to Listening.
|
|
13
|
+
*/
|
|
14
|
+
declare function VoiceComposer({ mode, transcript, onEndVoice, onSend }: VoiceComposerProps): import('react').JSX.Element;
|
|
15
|
+
declare const meta: Meta<typeof VoiceComposer>;
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof VoiceComposer>;
|
|
18
|
+
/** Until the connection is up and while the browser asks for the mic: a grey pulse, still bars, no light. */
|
|
19
|
+
export declare const Connecting: Story;
|
|
20
|
+
/** The connection dropped. Looks like Connecting; once back, the box returns to its previous state. */
|
|
21
|
+
export declare const Reconnecting: Story;
|
|
22
|
+
/** Nobody speaks: the border lights travel slowly, the light breathes and the bars barely move. Mute the mic to see Mic muted. */
|
|
23
|
+
export declare const Listening: Story;
|
|
24
|
+
/** The user speaks: the border stays as in Listening; the light and the bars follow the voice. */
|
|
25
|
+
export declare const UserSpeaking: Story;
|
|
26
|
+
/** Listening with the mic off: a grey pulse as in Connecting, no light, low and slow bars. */
|
|
27
|
+
export declare const MicMuted: Story;
|
|
28
|
+
/** What the user said fills the field and the voice button becomes Send. */
|
|
29
|
+
export declare const ListeningWithText: Story;
|
|
30
|
+
/** A long transcript expands the box, as in text mode. */
|
|
31
|
+
export declare const ListeningMultiline: Story;
|
|
32
|
+
/** Swisper is working out the answer: the lights turn on the 1.1 s beat and the bars wave with it. */
|
|
33
|
+
export declare const Thinking: Story;
|
|
34
|
+
export declare const ThinkingWithText: Story;
|
|
35
|
+
export declare const ThinkingMultiline: Story;
|
|
36
|
+
/** Swisper speaks: the light follows the voice with a cream centre where it is loud, and the bars follow it. Turn the sound off to go back to Listening. */
|
|
37
|
+
export declare const Answering: Story;
|
|
38
|
+
export declare const AnsweringWithText: Story;
|
|
39
|
+
export declare const AnsweringMultiline: Story;
|
|
40
|
+
/**
|
|
41
|
+
* Connecting, then Listening (the bars jump with "Voice starts"), User speaking, Thinking and
|
|
42
|
+
* Answering, round and round. The border's pace, the light and the grey pulse ease between states.
|
|
43
|
+
*/
|
|
44
|
+
export declare const MainLoop: Story;
|
|
45
|
+
//# sourceMappingURL=chat-prompt-box-voice.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-prompt-box/chat-prompt-box-voice.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAe5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAuD3D,UAAU,kBAAkB;IAC1B,IAAI,EAAE,iBAAiB,CAAC;IACxB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;GAGG;AACH,iBAAS,aAAa,CAAC,EAAE,IAAI,EAAE,UAAe,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,kBAAkB,+BAsCvF;AAyBD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAuCpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C,6GAA6G;AAC7G,eAAO,MAAM,UAAU,EAAE,KAAwC,CAAC;AAElE,uGAAuG;AACvG,eAAO,MAAM,YAAY,EAAE,KAA0C,CAAC;AAEtE,kIAAkI;AAClI,eAAO,MAAM,SAAS,EAAE,KAAuC,CAAC;AAEhE,kGAAkG;AAClG,eAAO,MAAM,YAAY,EAAE,KAA2C,CAAC;AAEvE,8FAA8F;AAC9F,eAAO,MAAM,QAAQ,EAAE,KAAuC,CAAC;AAE/D,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,EAAE,KAE/B,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,kBAAkB,EAAE,KAEhC,CAAC;AAEF,sGAAsG;AACtG,eAAO,MAAM,QAAQ,EAAE,KAAsC,CAAC;AAE9D,eAAO,MAAM,gBAAgB,EAAE,KAE9B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAE/B,CAAC;AAEF,4JAA4J;AAC5J,eAAO,MAAM,SAAS,EAAE,KAAuC,CAAC;AAEhE,eAAO,MAAM,iBAAiB,EAAE,KAE/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAEhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAEtB,CAAC"}
|
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
2
|
import { ChatInputProps, ChatInputTextareaProps } from '../chat-input';
|
|
3
|
+
import { ChatPromptBoxMode } from './chat-prompt-box-context';
|
|
4
|
+
export type { ChatPromptBoxMode } from './chat-prompt-box-context';
|
|
3
5
|
export interface ChatPromptBoxProps extends ChatInputProps {
|
|
4
6
|
/** Classes merged last onto the inner surface, the element that carries the box's background and padding. */
|
|
5
7
|
innerClassName?: string;
|
|
8
|
+
/**
|
|
9
|
+
* `text` (default) is the regular composer. The voice modes restyle the box for a voice
|
|
10
|
+
* conversation (Echo DS voice motion): `connecting`, `reconnecting` and `mic-muted` pulse the
|
|
11
|
+
* border grey with no light; `listening`, `user-speaking` and `answering` run two lights round
|
|
12
|
+
* the border once every 30s; `thinking` surges them with the 1.1s beat. The light above the box
|
|
13
|
+
* breathes while `listening`, beats while `thinking` and follows `voiceLevel` while
|
|
14
|
+
* `user-speaking` and `answering`. Moving from one mode to the next eases, nothing jumps.
|
|
15
|
+
*/
|
|
16
|
+
mode?: ChatPromptBoxMode;
|
|
17
|
+
/**
|
|
18
|
+
* How loud the speaker is, 0 to 1: the user in `user-speaking`, Swisper in `answering`. Update
|
|
19
|
+
* it every frame from the audio; the light rises in 0.08s and falls in 0.6s. Also drives the
|
|
20
|
+
* voice button's bars inside the box.
|
|
21
|
+
*/
|
|
22
|
+
voiceLevel?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Swisper's voice by frequency while `answering`, 0 to 1 each, low to high (e.g. 16 bands from
|
|
25
|
+
* an `AnalyserNode`, 90Hz to 9kHz): low bands lift the middle of the light, high bands the sides.
|
|
26
|
+
*/
|
|
27
|
+
voiceBands?: readonly number[];
|
|
6
28
|
}
|
|
7
29
|
/**
|
|
8
30
|
* The styled chat composer: a `ChatInput` with the box's border, background and focus glow. Sets
|
|
9
|
-
* `data-compact` on the root, which the parts read to move the actions under the text
|
|
31
|
+
* `data-compact` on the root, which the parts read to move the actions under the text, and
|
|
32
|
+
* `data-mode`, which switches the box between text and its voice states.
|
|
10
33
|
*/
|
|
11
34
|
export declare const ChatPromptBox: import('react').ForwardRefExoticComponent<ChatPromptBoxProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
12
35
|
export interface ChatPromptBoxToolbarProps extends ComponentPropsWithoutRef<'div'> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-prompt-box.d.ts","sourceRoot":"","sources":["../../../src/components/chat-prompt-box/chat-prompt-box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAM7E,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-prompt-box.d.ts","sourceRoot":"","sources":["../../../src/components/chat-prompt-box/chat-prompt-box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAM7E,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAG5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAMnE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,6GAA6G;IAC7G,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAChC;AAcD;;;;GAIG;AACH,eAAO,MAAM,aAAa,+GAiCxB,CAAC;AA2HH,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IAChF,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wFAAwF;AACxF,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,yBAAyB,+BAW/F;AAED,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IAChF,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,2GAA2G;AAC3G,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,yBAAyB,+BAiB/F;AAED,MAAM,WAAW,uBAAwB,SAAQ,sBAAsB;IACrE,2HAA2H;IAC3H,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,oHAkE9B,CAAC;AAIF,MAAM,WAAW,6BAA8B,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACpF,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,6BAA6B,+BAoB/B;AAED,MAAM,WAAW,8BAA+B,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACrF,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,8BAA8B,+BAqBhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-prompt-box.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-prompt-box/chat-prompt-box.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AAiBtE,OAAO,EACL,aAAa,EAMd,MAAM,mBAAmB,CAAC;AAE3B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CA+
|
|
1
|
+
{"version":3,"file":"chat-prompt-box.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-prompt-box/chat-prompt-box.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AAiBtE,OAAO,EACL,aAAa,EAMd,MAAM,mBAAmB,CAAC;AAE3B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CA+DpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C,wGAAwG;AACxG,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC;AAEF,UAAU,iBAAiB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,iBAAS,YAAY,CAAC,EACpB,WAAW,EACX,cAAmB,EACnB,SAAgB,EAChB,UAAkB,EAClB,WAAmB,EACnB,MAAM,EACN,MAAM,GACP,EAAE,iBAAiB,+BAoDnB;AAED,KAAK,aAAa,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC;AA4BnD,sHAAsH;AACtH,eAAO,MAAM,SAAS,EAAE,aAWvB,CAAC;AAEF,wHAAwH;AACxH,eAAO,MAAM,eAAe,EAAE,KAqB7B,CAAC;AAEF,kJAAkJ;AAClJ,eAAO,MAAM,WAAW,EAAE,aAUzB,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,SAAS,EAAE,aAGvB,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,QAAQ,EAAE,aAGtB,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,oBAAoB,EAAE,aA+BlC,CAAC;AAEF,mHAAmH;AACnH,eAAO,MAAM,yBAAyB,EAAE,aA4BvC,CAAC;AAEF,oHAAoH;AACpH,eAAO,MAAM,2BAA2B,EAAE,KAqBzC,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,mBAAmB,EAAE,aAejC,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,aAAa,EAAE,aAU3B,CAAC;AAEF,gIAAgI;AAChI,eAAO,MAAM,QAAQ,EAAE,KA4EtB,CAAC;AAEF,UAAU,4BAA4B;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC1D,WAAW,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IACzD,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,iBAAS,uBAAuB,CAAC,EAC/B,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,GACb,EAAE,4BAA4B,+BAwD9B;AAED,6GAA6G;AAC7G,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,uBAAuB,CA4D/D,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { VoiceBarsKind } from '../../chat-prompt-box-voice-motion';
|
|
3
|
+
/**
|
|
4
|
+
* What the voice session is doing. `still`: connecting or reconnecting, five 2px dots.
|
|
5
|
+
* `listening`: low and gentle, one sway every 3.9s. `voice-starts`: Listening with the two kicks
|
|
6
|
+
* of the "Voice starts" sound, then Listening. `thinking`: one wave per 1.1s beat, entering on the
|
|
7
|
+
* left. `voice`: follows `level`. `muted`: the mic is off, low, one sway every 5.7s.
|
|
8
|
+
*/
|
|
9
|
+
export type ChatPromptBoxVoiceBarIconState = VoiceBarsKind;
|
|
10
|
+
export interface ChatPromptBoxVoiceBarIconProps extends Omit<ComponentProps<'span'>, 'children'> {
|
|
11
|
+
/**
|
|
12
|
+
* What the voice session is doing; each state has its own motion. Unset inside a voice-mode
|
|
13
|
+
* `ChatPromptBox`, the bars follow the box's mode and `voiceLevel` on the box's clock (so in
|
|
14
|
+
* Thinking they beat with the border); elsewhere it defaults to `still`.
|
|
15
|
+
*/
|
|
16
|
+
state?: ChatPromptBoxVoiceBarIconState;
|
|
17
|
+
/**
|
|
18
|
+
* How loud the speaker is, 0 (silence) to 1 (a loud voice, 16px bars). Only read when `state` is
|
|
19
|
+
* `voice`; update it every frame from the audio.
|
|
20
|
+
*/
|
|
21
|
+
level?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The five live bars inside the voice button (Echo DS `_Voice-bars`), moved by the voice clock in
|
|
25
|
+
* 0.5px steps. Decorative (`aria-hidden`): the button around it carries the label. Sets
|
|
26
|
+
* `data-state`. `voice-starts` settles back into Listening by itself (about 1.5s); remount it
|
|
27
|
+
* (`key`) to replay. With reduced motion the bars rest on each state's Base heights; `voice` still
|
|
28
|
+
* follows `level`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const ChatPromptBoxVoiceBarIcon: import('react').ForwardRefExoticComponent<Omit<ChatPromptBoxVoiceBarIconProps, "ref"> & import('react').RefAttributes<HTMLSpanElement>>;
|
|
31
|
+
//# sourceMappingURL=chat-prompt-box-voice-bar-icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice-bar-icon.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/chat-prompt-box-voice-bar-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAKxD,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAG9F;;;;;GAKG;AACH,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC;AAI3D,MAAM,WAAW,8BAA+B,SAAQ,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC9F;;;;OAIG;IACH,KAAK,CAAC,EAAE,8BAA8B,CAAC;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,yIAsCpC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ChatPromptBoxVoiceBarIcon } from './chat-prompt-box-voice-bar-icon';
|
|
3
|
+
declare const meta: Meta<typeof ChatPromptBoxVoiceBarIcon>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ChatPromptBoxVoiceBarIcon>;
|
|
6
|
+
/** Try each state and, for `voice`, drag `level`. Switch `state` back to `voice-starts` to replay it. */
|
|
7
|
+
export declare const Playground: Story;
|
|
8
|
+
/**
|
|
9
|
+
* Every state in the voice button. Voice follows a simulated level; Voice starts plays once (reload
|
|
10
|
+
* the story to replay it). With reduced motion the bars rest on each state's Base heights.
|
|
11
|
+
*/
|
|
12
|
+
export declare const AllStates: Story;
|
|
13
|
+
/** Voice: the bars follow whoever speaks, from 3.5px (silence) to 16px (loud), each flickering on its own. */
|
|
14
|
+
export declare const VoiceFollowsLevel: Story;
|
|
15
|
+
/** Listening begins: the bars jump with the "Voice starts" sound's two notes, then settle into Listening. */
|
|
16
|
+
export declare const VoiceStartsToListening: Story;
|
|
17
|
+
//# sourceMappingURL=chat-prompt-box-voice-bar-icon.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice-bar-icon.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/chat-prompt-box-voice-bar-icon.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,EACL,yBAAyB,EAE1B,MAAM,kCAAkC,CAAC;AAoB1C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,yBAAyB,CAuBhD,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAoBxD,yGAAyG;AACzG,eAAO,MAAM,UAAU,EAAE,KAMxB,CAAC;AAuBF;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,KAGvB,CAAC;AAiBF,8GAA8G;AAC9G,eAAO,MAAM,iBAAiB,EAAE,KAG/B,CAAC;AAkBF,6GAA6G;AAC7G,eAAO,MAAM,sBAAsB,EAAE,KAGpC,CAAC"}
|
package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-bar-icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,YAAY,EACV,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IconButtonProps } from '@swisper.ai/ui';
|
|
2
|
+
import { ChatPromptBoxVoiceBarIconState } from '../chat-prompt-box-voice-bar-icon';
|
|
3
|
+
/**
|
|
4
|
+
* What the button shows. `bars`: the live voice bars on a pressed Prominent button; hover or
|
|
5
|
+
* keyboard focus swaps them for Close, and a click ends voice mode. `send`: a Primary button with
|
|
6
|
+
* the enter icon, for when the field has text.
|
|
7
|
+
*/
|
|
8
|
+
export type ChatPromptBoxVoiceButtonShow = 'bars' | 'send';
|
|
9
|
+
export interface ChatPromptBoxVoiceButtonProps extends Omit<IconButtonProps, 'variant' | 'size' | 'children' | 'isActive'> {
|
|
10
|
+
/** What the button shows. Defaults to `bars`. */
|
|
11
|
+
show?: ChatPromptBoxVoiceButtonShow;
|
|
12
|
+
/**
|
|
13
|
+
* What the voice session is doing; passed to `ChatPromptBoxVoiceBarIcon`. Only read when `show`
|
|
14
|
+
* is `bars`. Leave it unset inside a voice-mode `ChatPromptBox`: the bars then follow the box.
|
|
15
|
+
*/
|
|
16
|
+
state?: ChatPromptBoxVoiceBarIconState;
|
|
17
|
+
/** How loud the speaker is, 0 to 1; passed to `ChatPromptBoxVoiceBarIcon`. Only read when `state` is `voice`. */
|
|
18
|
+
level?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The last button of the voice panel (Echo DS `_Voice-button`). With `show="bars"` it holds the
|
|
22
|
+
* `ChatPromptBoxVoiceBarIcon` for `state` and turns into Close on hover or keyboard focus (touch keeps the
|
|
23
|
+
* bars); wire `onClick` to end voice mode. With `show="send"` it is the send button; wire
|
|
24
|
+
* `onClick` to send. `aria-label` defaults to "End voice mode" or "Send message". Inside a
|
|
25
|
+
* voice-mode `ChatPromptBox`, leave `state` and `level` unset: the bars follow the box's mode and
|
|
26
|
+
* `voiceLevel`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const ChatPromptBoxVoiceButton: import('react').ForwardRefExoticComponent<Omit<ChatPromptBoxVoiceButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement | HTMLSpanElement>>;
|
|
29
|
+
//# sourceMappingURL=chat-prompt-box-voice-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice-button.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-button/chat-prompt-box-voice-button.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGlE,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,mCAAmC,CAAC;AAE3C;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3D,MAAM,WAAW,6BAA8B,SAAQ,IAAI,CACzD,eAAe,EACf,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAC7C;IACC,iDAAiD;IACjD,IAAI,CAAC,EAAE,4BAA4B,CAAC;IACpC;;;OAGG;IACH,KAAK,CAAC,EAAE,8BAA8B,CAAC;IACvC,iHAAiH;IACjH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAiBD;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,4JA0CnC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ChatPromptBoxVoiceButton } from './chat-prompt-box-voice-button';
|
|
3
|
+
declare const meta: Meta<typeof ChatPromptBoxVoiceButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ChatPromptBoxVoiceButton>;
|
|
6
|
+
/** Hover the bars button (or Tab to it) to see Close. */
|
|
7
|
+
export declare const Playground: Story;
|
|
8
|
+
/** The Echo DS `_Voice-button` row: the six bar states, then Send. Hover any bars button for Close. */
|
|
9
|
+
export declare const AllShows: Story;
|
|
10
|
+
/** Voice: the bars follow whoever speaks, frame by frame. */
|
|
11
|
+
export declare const VoiceFollowsLevel: Story;
|
|
12
|
+
//# sourceMappingURL=chat-prompt-box-voice-button.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice-button.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-button/chat-prompt-box-voice-button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQ5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAW1E,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,wBAAwB,CA6B/C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEvD,yDAAyD;AACzD,eAAO,MAAM,UAAU,EAAE,KAExB,CAAC;AAEF,uGAAuG;AACvG,eAAO,MAAM,QAAQ,EAAE,KAUtB,CAAC;AAiCF,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,EAAE,KAG/B,CAAC"}
|
package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-button/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,YAAY,EACV,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { VoiceLightState } from '../../chat-prompt-box-voice-motion';
|
|
3
|
+
/**
|
|
4
|
+
* What the voice session is doing. `listening`: nobody speaks, a slow breath. `user-speaking`: the
|
|
5
|
+
* user's voice. `thinking`: the shield beat. `speaking`: Swisper's voice, a wave with a cream middle
|
|
6
|
+
* where it is loud.
|
|
7
|
+
*/
|
|
8
|
+
export type ChatPromptBoxVoiceLightState = VoiceLightState;
|
|
9
|
+
export interface ChatPromptBoxVoiceLightLayersProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
10
|
+
state: ChatPromptBoxVoiceLightState;
|
|
11
|
+
bands?: readonly number[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The light's three layers, drawn from CSS variables: `--voice-light-rise` (the haze's rise in px),
|
|
15
|
+
* `--voice-light-opacity-{haze|body|rim}` and, in Speaking, `--voice-light-cream-{haze|body|rim}`.
|
|
16
|
+
* The voice clock sets them (see `voiceLightVars`); `ChatPromptBox` draws its light with this.
|
|
17
|
+
*/
|
|
18
|
+
export declare const ChatPromptBoxVoiceLightLayers: import('react').ForwardRefExoticComponent<Omit<ChatPromptBoxVoiceLightLayersProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export interface ChatPromptBoxVoiceLightProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
20
|
+
/** What the voice session is doing; sets the shape, the colours and the motion. Defaults to `listening`. */
|
|
21
|
+
state?: ChatPromptBoxVoiceLightState;
|
|
22
|
+
/**
|
|
23
|
+
* Holds the light at one moment of the state, 0 to 1: 0 is the Echo DS Min frame, 0.5 Base, 1
|
|
24
|
+
* Max. Unset, Listening breathes (5.5s) and Thinking beats (1.1s) on their own; User speaking
|
|
25
|
+
* and Speaking rest on Base. Inside a `ChatPromptBox` use its `voiceLevel` instead: the box
|
|
26
|
+
* follows the voice with the spec's easing.
|
|
27
|
+
*/
|
|
28
|
+
level?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Swisper's voice by frequency, 0 to 1 each, low to high (e.g. from an `AnalyserNode`). Low bands lift
|
|
31
|
+
* the middle, high bands the sides. Only read when `state` is `speaking`; without it the wave is the
|
|
32
|
+
* Echo DS one.
|
|
33
|
+
*/
|
|
34
|
+
bands?: readonly number[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The voice light (Echo DS `_Voice-light`): the aurora that rises from the top edge of the prompt
|
|
38
|
+
* box, full width and 103px tall, the light across the middle 80%. Three blurred layers (haze, body,
|
|
39
|
+
* rim) fade out towards the top; blue, with a cream middle in `speaking` where the voice is loud.
|
|
40
|
+
* Decorative (`aria-hidden`). `ChatPromptBox` draws its own in voice mode; use this one on its own,
|
|
41
|
+
* positioned above a box. It sets `data-state`. With reduced motion it rests on Base, or on `level`.
|
|
42
|
+
*/
|
|
43
|
+
export declare const ChatPromptBoxVoiceLight: import('react').ForwardRefExoticComponent<Omit<ChatPromptBoxVoiceLightProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
44
|
+
//# sourceMappingURL=chat-prompt-box-voice-light.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice-light.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-light/chat-prompt-box-voice-light.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,cAAc,EAAsB,MAAM,OAAO,CAAC;AAIrF,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,oCAAoC,CAAC;AAG5C;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG,eAAe,CAAC;AA4I3D,MAAM,WAAW,kCAAmC,SAAQ,IAAI,CAC9D,cAAc,CAAC,KAAK,CAAC,EACrB,UAAU,CACX;IACC,KAAK,EAAE,4BAA4B,CAAC;IACpC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;AAED;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,4IA6DxC,CAAC;AAIH,MAAM,WAAW,4BAA6B,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC3F,4GAA4G;IAC5G,KAAK,CAAC,EAAE,4BAA4B,CAAC;IACrC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,sIAoBnC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ChatPromptBoxVoiceLight } from './chat-prompt-box-voice-light';
|
|
3
|
+
declare const meta: Meta<typeof ChatPromptBoxVoiceLight>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ChatPromptBoxVoiceLight>;
|
|
6
|
+
/** Try each state, drag `level`, and give `bands` to shape the Speaking wave. */
|
|
7
|
+
export declare const Playground: Story;
|
|
8
|
+
/** The Echo DS frames: each state at Min, Base and Max (`level` 0, 0.5 and 1). */
|
|
9
|
+
export declare const AllStates: Story;
|
|
10
|
+
/**
|
|
11
|
+
* Without `level`: Listening breathes (5.5s), Thinking beats (1.1s); User speaking and Speaking
|
|
12
|
+
* rest on Base (in `ChatPromptBox` they follow `voiceLevel`). With reduced motion all rest on Base.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SelfAnimated: Story;
|
|
15
|
+
/** Speaking follows the voice frame by frame: `level` sets the height, `bands` the wave. */
|
|
16
|
+
export declare const FollowsAudio: Story;
|
|
17
|
+
//# sourceMappingURL=chat-prompt-box-voice-light.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice-light.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-light/chat-prompt-box-voice-light.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,EACL,uBAAuB,EAExB,MAAM,+BAA+B,CAAC;AAgCvC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,uBAAuB,CA+B9C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEtD,iFAAiF;AACjF,eAAO,MAAM,UAAU,EAAE,KAAU,CAAC;AAEpC,kFAAkF;AAClF,eAAO,MAAM,SAAS,EAAE,KAqBvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAc1B,CAAC;AAmDF,4FAA4F;AAC5F,eAAO,MAAM,YAAY,EAAE,KAG1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-light/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,YAAY,EACV,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IconButtonProps } from '@swisper.ai/ui';
|
|
2
|
+
export interface ChatPromptBoxVoiceMicButtonProps extends Omit<IconButtonProps, 'variant' | 'size' | 'children' | 'aria-pressed'> {
|
|
3
|
+
/** The mic is off: shows the mic-off icon and presses the button. Defaults to `false`. */
|
|
4
|
+
muted?: boolean;
|
|
5
|
+
/** Called with the new value when the button is clicked. */
|
|
6
|
+
onMutedChange?: (muted: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The mic toggle of the voice panel (Echo DS `_Voice-panel`): a Tertiary `aria-pressed` button
|
|
10
|
+
* that swaps to the mic-off icon while `muted`. Put it in `ChatPromptBoxVoicePanel`.
|
|
11
|
+
* `aria-label` defaults to "Mute microphone".
|
|
12
|
+
*/
|
|
13
|
+
export declare const ChatPromptBoxVoiceMicButton: import('react').ForwardRefExoticComponent<Omit<ChatPromptBoxVoiceMicButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement | HTMLSpanElement>>;
|
|
14
|
+
//# sourceMappingURL=chat-prompt-box-voice-mic-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice-mic-button.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/chat-prompt-box-voice-mic-button.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAElE,MAAM,WAAW,gCAAiC,SAAQ,IAAI,CAC5D,eAAe,EACf,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,cAAc,CACjD;IACC,0FAA0F;IAC1F,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,+JAuBtC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ChatPromptBoxVoiceMicButton } from './chat-prompt-box-voice-mic-button';
|
|
3
|
+
declare const meta: Meta<typeof ChatPromptBoxVoiceMicButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ChatPromptBoxVoiceMicButton>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
/** On, then off. */
|
|
8
|
+
export declare const AllStates: Story;
|
|
9
|
+
/** Click it: the icon swaps and `aria-pressed` flips. */
|
|
10
|
+
export declare const Toggle: Story;
|
|
11
|
+
//# sourceMappingURL=chat-prompt-box-voice-mic-button.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice-mic-button.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/chat-prompt-box-voice-mic-button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEjF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,2BAA2B,CAelD,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAE1D,eAAO,MAAM,UAAU,EAAE,KAAU,CAAC;AAEpC,oBAAoB;AACpB,eAAO,MAAM,SAAS,EAAE,KAQvB,CAAC;AAQF,yDAAyD;AACzD,eAAO,MAAM,MAAM,EAAE,KAGpB,CAAC"}
|
package/dist/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-mic-button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,YAAY,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
/** `desktop`: 8px padding and gaps, flush in the box's corner. `mobile`: 4px, fills its width. */
|
|
3
|
+
export type ChatPromptBoxVoicePanelDevice = 'desktop' | 'mobile';
|
|
4
|
+
export interface ChatPromptBoxVoicePanelProps extends ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/** The controls: `ChatPromptBoxVoiceMicButton`, `ChatPromptBoxVoiceSoundButton`, `ChatPromptBoxVoiceStateWord`, `ChatPromptBoxVoiceButton`. */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Sets the padding, gaps, height and the state word's width. Defaults to `desktop`. */
|
|
8
|
+
device?: ChatPromptBoxVoicePanelDevice;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The voice controls inside the prompt box while voice is on (Echo DS `_Voice-panel`): a
|
|
12
|
+
* `role="group"` for `ChatPromptBoxVoiceMicButton`, `ChatPromptBoxVoiceSoundButton`,
|
|
13
|
+
* `ChatPromptBoxVoiceStateWord` and `ChatPromptBoxVoiceButton`, in that order. Put it in
|
|
14
|
+
* `ChatPromptBoxActionsRight`; on desktop it sits flush in the box's corner. The background is the
|
|
15
|
+
* same in every state. `aria-label` defaults to "Voice".
|
|
16
|
+
*/
|
|
17
|
+
export declare const ChatPromptBoxVoicePanel: import('react').ForwardRefExoticComponent<ChatPromptBoxVoicePanelProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
18
|
+
//# sourceMappingURL=chat-prompt-box-voice-panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice-panel.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-panel/chat-prompt-box-voice-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlF,kGAAkG;AAClG,MAAM,MAAM,6BAA6B,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEjE,MAAM,WAAW,4BAA6B,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACnF,+IAA+I;IAC/I,QAAQ,EAAE,SAAS,CAAC;IACpB,wFAAwF;IACxF,MAAM,CAAC,EAAE,6BAA6B,CAAC;CACxC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,yHA+BnC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ChatPromptBoxVoiceBarIconState } from '../chat-prompt-box-voice-bar-icon';
|
|
3
|
+
import { ChatPromptBoxVoicePanelProps } from './chat-prompt-box-voice-panel';
|
|
4
|
+
type PlaygroundArgs = ChatPromptBoxVoicePanelProps & {
|
|
5
|
+
micMuted: boolean;
|
|
6
|
+
soundMuted: boolean;
|
|
7
|
+
stateWord: string;
|
|
8
|
+
bars: ChatPromptBoxVoiceBarIconState;
|
|
9
|
+
};
|
|
10
|
+
declare const meta: Meta<PlaygroundArgs>;
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<PlaygroundArgs>;
|
|
13
|
+
export declare const Playground: Story;
|
|
14
|
+
/** The Echo DS `_Voice-panel` frame: desktop on top, mobile below; mic and sound on and off. */
|
|
15
|
+
export declare const AllVariants: Story;
|
|
16
|
+
/** Click mic and sound: the icons swap and the bars go to Muted with the mic. */
|
|
17
|
+
export declare const Toggles: Story;
|
|
18
|
+
//# sourceMappingURL=chat-prompt-box-voice-panel.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-prompt-box-voice-panel.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-panel/chat-prompt-box-voice-panel.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAKxF,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,+BAA+B,CAAC;AAWvC,KAAK,cAAc,GAAG,4BAA4B,GAAG;IACnD,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,8BAA8B,CAAC;CACtC,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,cAAc,CAkD9B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;AAEtC,eAAO,MAAM,UAAU,EAAE,KASxB,CAAC;AASF,gGAAgG;AAChG,eAAO,MAAM,WAAW,EAAE,KAuBzB,CAAC;AAgBF,iFAAiF;AACjF,eAAO,MAAM,OAAO,EAAE,KAGrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/chat-prompt-box/components/chat-prompt-box-voice-panel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,YAAY,EACV,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IconButtonProps } from '@swisper.ai/ui';
|
|
2
|
+
export interface ChatPromptBoxVoiceSoundButtonProps extends Omit<IconButtonProps, 'variant' | 'size' | 'children' | 'aria-pressed'> {
|
|
3
|
+
/** The sound is off: shows the sound-off icon and presses the button. Defaults to `false`. */
|
|
4
|
+
muted?: boolean;
|
|
5
|
+
/** Called with the new value when the button is clicked. */
|
|
6
|
+
onMutedChange?: (muted: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The sound toggle of the voice panel (Echo DS `_Voice-panel`): a Tertiary `aria-pressed` button
|
|
10
|
+
* that swaps to the sound-off icon while `muted`. Put it in `ChatPromptBoxVoicePanel`.
|
|
11
|
+
* `aria-label` defaults to "Mute sound".
|
|
12
|
+
*/
|
|
13
|
+
export declare const ChatPromptBoxVoiceSoundButton: import('react').ForwardRefExoticComponent<Omit<ChatPromptBoxVoiceSoundButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement | HTMLSpanElement>>;
|
|
14
|
+
//# sourceMappingURL=chat-prompt-box-voice-sound-button.d.ts.map
|