devextreme-react
Version:
DevExtreme React UI and Visualization Components
64 lines (62 loc) • 2.33 kB
JavaScript
/*!
* devextreme-react
* Version: 25.2.3
* Build date: Fri Dec 12 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file in the root of the project for details.
*
* https://github.com/DevExpress/devextreme-react
*/
"use client";
import * as React from "react";
import { memo, forwardRef, useImperativeHandle, useRef, useMemo } from "react";
import dxSpeechToText from "devextreme/ui/speech_to_text";
import { Component as BaseComponent } from "./core/component";
import NestedOption from "./core/nested-option";
const SpeechToText = memo(forwardRef((props, ref) => {
const baseRef = useRef(null);
useImperativeHandle(ref, () => ({
instance() {
return baseRef.current?.getInstance();
}
}), []);
const independentEvents = useMemo(() => (["onContentReady", "onDisposing", "onEnd", "onError", "onInitialized", "onResult", "onStartClick", "onStopClick"]), []);
const expectedChildren = useMemo(() => ({
customSpeechRecognizer: { optionName: "customSpeechRecognizer", isCollectionItem: false },
speechRecognitionConfig: { optionName: "speechRecognitionConfig", isCollectionItem: false }
}), []);
return (React.createElement((BaseComponent), {
WidgetClass: dxSpeechToText,
ref: baseRef,
independentEvents,
expectedChildren,
...props,
}));
}));
const _componentCustomSpeechRecognizer = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "customSpeechRecognizer",
},
});
};
const CustomSpeechRecognizer = Object.assign(_componentCustomSpeechRecognizer, {
componentType: "option",
});
const _componentSpeechRecognitionConfig = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "speechRecognitionConfig",
},
});
};
const SpeechRecognitionConfig = Object.assign(_componentSpeechRecognitionConfig, {
componentType: "option",
});
export default SpeechToText;
export { SpeechToText, CustomSpeechRecognizer, SpeechRecognitionConfig };