@common-origin/design-system 2.6.1 → 2.7.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.
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
2
  import { type IconName } from '../Icon';
3
- export interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'> {
3
+ export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4
4
  variant: 'primary' | 'secondary' | 'naked';
5
5
  size?: 'small' | 'medium' | 'large';
6
6
  iconName: IconName;
7
7
  url?: string;
8
- onClick?: () => void;
9
8
  'aria-label': string;
10
9
  'aria-describedby'?: string;
11
10
  'aria-expanded'?: boolean;
@@ -0,0 +1,30 @@
1
+ import { AgentInputSubmitSource, AgentInputVoiceError } from './agentInputSpeech';
2
+ interface SubmitPayload {
3
+ text: string;
4
+ source: AgentInputSubmitSource;
5
+ timestamp: string;
6
+ }
7
+ export interface AgentInputProps {
8
+ value?: string;
9
+ defaultValue?: string;
10
+ onChange?: (value: string) => void;
11
+ onSubmit: (payload: SubmitPayload) => void | Promise<void>;
12
+ placeholder?: string;
13
+ disabled?: boolean;
14
+ isSubmitting?: boolean;
15
+ enableVoice?: boolean;
16
+ autoSubmitOnVoiceFinal?: boolean;
17
+ voiceLanguage?: string;
18
+ noSpeechTimeoutMs?: number;
19
+ onVoiceStart?: () => void;
20
+ onVoiceStop?: () => void;
21
+ onVoiceInterim?: (text: string) => void;
22
+ onVoiceFinal?: (text: string) => void;
23
+ onVoiceError?: (error: AgentInputVoiceError) => void;
24
+ statusMessage?: string;
25
+ errorMessage?: string;
26
+ label?: string;
27
+ 'data-testid'?: string;
28
+ }
29
+ export declare const AgentInput: ({ value, defaultValue, onChange, onSubmit, placeholder, disabled, isSubmitting, enableVoice, autoSubmitOnVoiceFinal, voiceLanguage, noSpeechTimeoutMs, onVoiceStart, onVoiceStop, onVoiceInterim, onVoiceFinal, onVoiceError, statusMessage, errorMessage, label, "data-testid": dataTestId, }: AgentInputProps) => import("react/jsx-runtime").JSX.Element;
30
+ export {};
@@ -0,0 +1,43 @@
1
+ export type AgentInputSubmitSource = 'text' | 'voice-final';
2
+ export type AgentInputVoiceErrorCode = 'not-supported' | 'not-allowed' | 'no-speech' | 'audio-capture' | 'aborted' | 'unknown';
3
+ export interface AgentInputVoiceError {
4
+ code: AgentInputVoiceErrorCode;
5
+ message: string;
6
+ }
7
+ export interface SpeechRecognitionAlternativeLike {
8
+ transcript: string;
9
+ confidence: number;
10
+ }
11
+ export interface SpeechRecognitionResultLike {
12
+ isFinal: boolean;
13
+ length: number;
14
+ [index: number]: SpeechRecognitionAlternativeLike;
15
+ }
16
+ export interface SpeechRecognitionResultListLike {
17
+ length: number;
18
+ [index: number]: SpeechRecognitionResultLike;
19
+ }
20
+ export interface SpeechRecognitionEventLike {
21
+ resultIndex: number;
22
+ results: SpeechRecognitionResultListLike;
23
+ }
24
+ export interface SpeechRecognitionErrorEventLike {
25
+ error?: string;
26
+ message?: string;
27
+ }
28
+ export interface SpeechRecognitionLike {
29
+ lang: string;
30
+ interimResults: boolean;
31
+ continuous: boolean;
32
+ onresult: ((event: SpeechRecognitionEventLike) => void) | null;
33
+ onerror: ((event: SpeechRecognitionErrorEventLike) => void) | null;
34
+ onend: (() => void) | null;
35
+ start: () => void;
36
+ stop: () => void;
37
+ abort: () => void;
38
+ }
39
+ export type SpeechRecognitionConstructorLike = new () => SpeechRecognitionLike;
40
+ export declare function detectSpeechRecognitionConstructor(targetWindow?: Window): SpeechRecognitionConstructorLike | null;
41
+ export declare function normalizeTranscript(input: string): string;
42
+ export declare function mapSpeechErrorCode(error?: string): AgentInputVoiceErrorCode;
43
+ export declare function defaultVoiceErrorMessage(code: AgentInputVoiceErrorCode): string;
@@ -0,0 +1,29 @@
1
+ export type AgentInputMachineState = 'idle' | 'typing' | 'listening' | 'processingFinalTranscript' | 'submitting' | 'error' | 'disabled';
2
+ export type AgentInputMachineEvent = {
3
+ type: 'INPUT_CHANGE';
4
+ hasText: boolean;
5
+ } | {
6
+ type: 'MIC_START';
7
+ } | {
8
+ type: 'MIC_STOP';
9
+ hasText: boolean;
10
+ } | {
11
+ type: 'VOICE_INTERIM';
12
+ } | {
13
+ type: 'VOICE_FINAL';
14
+ } | {
15
+ type: 'VOICE_ERROR';
16
+ } | {
17
+ type: 'TIMEOUT_NO_SPEECH';
18
+ } | {
19
+ type: 'SUBMIT';
20
+ } | {
21
+ type: 'SUBMIT_SUCCESS';
22
+ hasText?: boolean;
23
+ } | {
24
+ type: 'SUBMIT_ERROR';
25
+ } | {
26
+ type: 'RESET_ERROR';
27
+ hasText: boolean;
28
+ };
29
+ export declare function agentInputStateTransition(currentState: AgentInputMachineState, event: AgentInputMachineEvent): AgentInputMachineState;
@@ -0,0 +1,3 @@
1
+ export { AgentInput } from './AgentInput';
2
+ export type { AgentInputProps } from './AgentInput';
3
+ export type { AgentInputSubmitSource, AgentInputVoiceErrorCode } from './agentInputSpeech';
@@ -1,5 +1,6 @@
1
1
  export * from './AccountCard';
2
2
  export * from './ActionSheet';
3
+ export * from './AgentInput';
3
4
  export * from './Alert';
4
5
  export * from './Breadcrumbs';
5
6
  export * from './CardSmall';