@progress/kendo-vue-buttons
Version:
243 lines (242 loc) • 7.82 kB
TypeScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import { ButtonProps } from '../Button';
import { PropType } from 'vue';
export declare enum SpeechToTextButtonMode {
WebSpeech = "WebSpeech",
None = "None"
}
/**
* Represents a single recognition alternative from the speech engine.
*/
export interface SpeechRecognitionAlternative {
/**
* The transcript of the recognized speech.
*/
transcript: string;
/**
* A confidence score for the transcript, where 0 indicates no confidence and 1 indicates complete confidence.
*/
confidence: number;
}
/**
* The event argument for the `result` event of the SpeechToTextButton.
*/
export interface SpeechToTextResultEvent {
/**
* Indicates whether the speech recognition result is final (`true`) or interim (`false`).
*/
isFinal: boolean;
/**
* An array of possible recognition alternatives returned by the speech engine.
*/
alternatives: SpeechRecognitionAlternative[];
}
/**
* The event argument for the `error` event of the SpeechToTextButton.
*/
export interface SpeechToTextErrorEvent {
/**
* Message detailing the cause of the speech recognition error. Use this message for debugging or user feedback.
*/
errorMessage: string;
}
export interface SpeechToTextButtonProps extends ButtonProps {
/**
* The valid BCP 47 language tag to use for speech recognition. Defaults to `en-US`.
*/
lang?: string;
/**
* Specifies whether the speech recognition should continue until explicitly stopped. Defaults to `true`.
*/
continuous?: boolean;
/**
* Specifies whether to return interim results. Defaults to `false`.
*/
interimResults?: boolean;
/**
* Specifies the maximum number of alternative transcriptions to return. Defaults to `1`.
*/
maxAlternatives?: number;
/**
* Specifies which speech recognition engine or integration the component should use.
* This allows the component to operate in different environments or use alternative implementations.
*/
integrationMode?: 'WebSpeech' | 'None';
/**
* Callback function that is called when speech recognition starts.
*/
onStart?: () => void;
/**
* Callback function that is called when a speech recognition result is available.
* The event contains the `isFinal` flag and an array of alternatives.
*/
onResult?: (event: SpeechToTextResultEvent) => void;
/**
* Callback function that is called when speech recognition ends.
*/
onEnd?: () => void;
/**
* Callback function that is called when an error occurs during speech recognition.
*/
onError?: (event: SpeechToTextErrorEvent) => void;
/**
* The `start` event callback that starts the speech recognition service listening to incoming audio with intent to recognize grammars.
*
* @memberof SpeechToTextButtonProps
*/
start(): void;
/**
* The `stop` event callback that stops the speech recognition service from listening to incoming audio, and attempts to return a result using the audio captured so far.
*
* @memberof SpeechToTextButtonProps
*/
stop(): void;
/**
* The `abort` event callback that stops the speech recognition service from listening to incoming audio, and doesn't attempt to return a result.
*
* @memberof SpeechToTextButtonProps
*/
abort(): void;
/**
* The `isActive` event callback that returns a boolean value if the SpeechToTextButton is in an active state.
*
* @returns `true` if the speech recognition is active, otherwise `false`.
*/
isActive(): boolean;
}
/**
* @hidden
*/
declare const SpeechToTextButton: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
lang: {
type: PropType<string>;
default: string;
};
continuous: {
type: PropType<boolean>;
default: boolean;
};
interimResults: {
type: PropType<boolean>;
default: boolean;
};
maxAlternatives: {
type: PropType<number>;
default: number;
};
integrationMode: {
type: PropType<"WebSpeech" | "None">;
default: SpeechToTextButtonMode;
};
onStart: {
type: PropType<() => void>;
};
onResult: {
type: PropType<(event: SpeechToTextResultEvent) => void>;
};
onEnd: {
type: PropType<() => void>;
};
onError: {
type: PropType<(event: SpeechToTextErrorEvent) => void>;
};
svgIcon: {
type: PropType<import('@progress/kendo-vue-common').SVGIcon>;
default: import('@progress/kendo-svg-icons').SVGIcon;
};
iconSize: {
type: PropType<string>;
};
disabled: {
type: PropType<boolean>;
default: any;
};
size: PropType<"small" | "medium" | "xs" | "large">;
rounded: PropType<"small" | "medium" | "large" | "full" | "none">;
fillMode: PropType<"flat" | "link" | "solid" | "outline">;
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "error" | "inverse">;
title: {
type: PropType<string>;
default: string;
};
ariaLabel: {
type: PropType<string>;
default: string;
};
}>, {
clickHandler: () => void;
isInActiveState: import('vue').Ref<boolean, boolean>;
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
lang: {
type: PropType<string>;
default: string;
};
continuous: {
type: PropType<boolean>;
default: boolean;
};
interimResults: {
type: PropType<boolean>;
default: boolean;
};
maxAlternatives: {
type: PropType<number>;
default: number;
};
integrationMode: {
type: PropType<"WebSpeech" | "None">;
default: SpeechToTextButtonMode;
};
onStart: {
type: PropType<() => void>;
};
onResult: {
type: PropType<(event: SpeechToTextResultEvent) => void>;
};
onEnd: {
type: PropType<() => void>;
};
onError: {
type: PropType<(event: SpeechToTextErrorEvent) => void>;
};
svgIcon: {
type: PropType<import('@progress/kendo-vue-common').SVGIcon>;
default: import('@progress/kendo-svg-icons').SVGIcon;
};
iconSize: {
type: PropType<string>;
};
disabled: {
type: PropType<boolean>;
default: any;
};
size: PropType<"small" | "medium" | "xs" | "large">;
rounded: PropType<"small" | "medium" | "large" | "full" | "none">;
fillMode: PropType<"flat" | "link" | "solid" | "outline">;
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "error" | "inverse">;
title: {
type: PropType<string>;
default: string;
};
ariaLabel: {
type: PropType<string>;
default: string;
};
}>> & Readonly<{}>, {
title: string;
ariaLabel: string;
disabled: boolean;
svgIcon: import('@progress/kendo-vue-common').SVGIcon;
lang: string;
continuous: boolean;
interimResults: boolean;
maxAlternatives: number;
integrationMode: "WebSpeech" | "None";
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
export { SpeechToTextButton };