@pega/cosmos-react-core 9.0.0-build.13.0 → 9.0.0-build.13.2

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.
Files changed (72) hide show
  1. package/lib/components/Actions/Actions.d.ts +1 -0
  2. package/lib/components/Actions/Actions.d.ts.map +1 -1
  3. package/lib/components/Actions/Actions.js +28 -4
  4. package/lib/components/Actions/Actions.js.map +1 -1
  5. package/lib/components/AppShell/AppShell.types.d.ts +2 -0
  6. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  7. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  8. package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
  9. package/lib/components/AppShell/NavigationListItemWrapper.js +30 -5
  10. package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
  11. package/lib/components/Menu/Menu.d.ts.map +1 -1
  12. package/lib/components/Menu/Menu.js +13 -3
  13. package/lib/components/Menu/Menu.js.map +1 -1
  14. package/lib/components/Menu/Menu.styles.d.ts +2 -0
  15. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  16. package/lib/components/Menu/Menu.styles.js +58 -1
  17. package/lib/components/Menu/Menu.styles.js.map +1 -1
  18. package/lib/components/Menu/Menu.types.d.ts +3 -0
  19. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  20. package/lib/components/Menu/Menu.types.js.map +1 -1
  21. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  22. package/lib/components/MenuButton/MenuButton.js +12 -2
  23. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  24. package/lib/components/MultiStepForm/MultiStepForm.js +1 -1
  25. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
  26. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  27. package/lib/components/PageTemplates/PageTemplates.js +11 -6
  28. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  29. package/lib/components/SpeechToTextButton/SpeechToTextButton.d.ts +13 -0
  30. package/lib/components/SpeechToTextButton/SpeechToTextButton.d.ts.map +1 -0
  31. package/lib/components/SpeechToTextButton/SpeechToTextButton.js +29 -0
  32. package/lib/components/SpeechToTextButton/SpeechToTextButton.js.map +1 -0
  33. package/lib/components/SpeechToTextButton/SpeechToTextButton.test-ids.d.ts +2 -0
  34. package/lib/components/SpeechToTextButton/SpeechToTextButton.test-ids.d.ts.map +1 -0
  35. package/lib/components/SpeechToTextButton/SpeechToTextButton.test-ids.js +3 -0
  36. package/lib/components/SpeechToTextButton/SpeechToTextButton.test-ids.js.map +1 -0
  37. package/lib/components/SpeechToTextButton/index.d.ts +3 -0
  38. package/lib/components/SpeechToTextButton/index.d.ts.map +1 -0
  39. package/lib/components/SpeechToTextButton/index.js +2 -0
  40. package/lib/components/SpeechToTextButton/index.js.map +1 -0
  41. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  42. package/lib/components/TextArea/TextArea.js +2 -12
  43. package/lib/components/TextArea/TextArea.js.map +1 -1
  44. package/lib/hooks/index.d.ts +1 -0
  45. package/lib/hooks/index.d.ts.map +1 -1
  46. package/lib/hooks/index.js +1 -0
  47. package/lib/hooks/index.js.map +1 -1
  48. package/lib/hooks/useI18n.d.ts +11 -0
  49. package/lib/hooks/useI18n.d.ts.map +1 -1
  50. package/lib/hooks/useSpeechRecognition.d.ts +21 -0
  51. package/lib/hooks/useSpeechRecognition.d.ts.map +1 -0
  52. package/lib/hooks/useSpeechRecognition.js +121 -0
  53. package/lib/hooks/useSpeechRecognition.js.map +1 -0
  54. package/lib/i18n/default.d.ts +11 -0
  55. package/lib/i18n/default.d.ts.map +1 -1
  56. package/lib/i18n/default.js +13 -0
  57. package/lib/i18n/default.js.map +1 -1
  58. package/lib/i18n/i18n.d.ts +11 -0
  59. package/lib/i18n/i18n.d.ts.map +1 -1
  60. package/lib/index.d.ts +2 -0
  61. package/lib/index.d.ts.map +1 -1
  62. package/lib/index.js +2 -0
  63. package/lib/index.js.map +1 -1
  64. package/lib/styles/utils.d.ts.map +1 -1
  65. package/lib/styles/utils.js +8 -2
  66. package/lib/styles/utils.js.map +1 -1
  67. package/lib/theme/theme.d.ts +24 -0
  68. package/lib/theme/theme.d.ts.map +1 -1
  69. package/lib/theme/themeDefinition.json +14 -0
  70. package/lib/theme/themeOverrides.schema.json +15 -0
  71. package/lib/theme/themes/virgoTheme.json +5 -0
  72. package/package.json +2 -1
@@ -0,0 +1,121 @@
1
+ /// <reference types="dom-speech-recognition" preserve="true" />
2
+ import { useCallback, useEffect, useRef, useState } from 'react';
3
+ import useI18n from './useI18n';
4
+ export default function useSpeechRecognition({ onResult, onInterimResult, langCode = navigator.language ?? 'en-US' }) {
5
+ const SpeechRecognitionAPI = window.SpeechRecognition ?? window.webkitSpeechRecognition;
6
+ const supported = !!SpeechRecognitionAPI;
7
+ const t = useI18n();
8
+ const [active, setActive] = useState(false);
9
+ const [error, setError] = useState(null);
10
+ const speechRecognitionRef = useRef(null);
11
+ const speechRecognitionACRef = useRef(new AbortController());
12
+ const onResultACRef = useRef(new AbortController());
13
+ const keepListeningRef = useRef(false);
14
+ const handleResult = useCallback((event) => {
15
+ let nextValue = '';
16
+ for (let i = event.resultIndex; i < event.results.length; i += 1) {
17
+ const result = event.results[i];
18
+ const processed = result[0].transcript;
19
+ nextValue += processed;
20
+ if (result.isFinal) {
21
+ onResult(nextValue);
22
+ }
23
+ else {
24
+ onInterimResult?.(nextValue);
25
+ }
26
+ }
27
+ }, [onResult, onInterimResult]);
28
+ useEffect(() => {
29
+ if (!speechRecognitionRef.current)
30
+ return;
31
+ onResultACRef.current.abort();
32
+ onResultACRef.current = new AbortController();
33
+ speechRecognitionRef.current.addEventListener('result', handleResult, {
34
+ signal: AbortSignal.any([speechRecognitionACRef.current.signal, onResultACRef.current.signal])
35
+ });
36
+ }, [handleResult]);
37
+ const startRecognition = useCallback(() => {
38
+ if (!supported)
39
+ return;
40
+ const recognition = new SpeechRecognitionAPI();
41
+ recognition.lang = langCode;
42
+ recognition.interimResults = true;
43
+ recognition.maxAlternatives = 1;
44
+ recognition.continuous = true;
45
+ recognition.addEventListener('start', () => {
46
+ setActive(true);
47
+ setError(null);
48
+ }, { signal: speechRecognitionACRef.current.signal });
49
+ recognition.addEventListener('result', handleResult, {
50
+ signal: AbortSignal.any([speechRecognitionACRef.current.signal, onResultACRef.current.signal])
51
+ });
52
+ recognition.addEventListener('error', event => {
53
+ if (event.error === 'no-speech') {
54
+ setError(t('no_speech_detected'));
55
+ }
56
+ else if (event.error === 'audio-capture') {
57
+ setError(t('no_microphone_found'));
58
+ }
59
+ else if (event.error === 'not-allowed') {
60
+ setError(t('microphone_access_denied'));
61
+ }
62
+ else {
63
+ setError(t('speech_recognition_error', [event.error]));
64
+ }
65
+ setActive(false);
66
+ }, { signal: speechRecognitionACRef.current.signal });
67
+ recognition.addEventListener('end', () => {
68
+ if (keepListeningRef.current) {
69
+ startRecognition();
70
+ }
71
+ else {
72
+ setActive(false);
73
+ }
74
+ }, { signal: speechRecognitionACRef.current.signal });
75
+ speechRecognitionRef.current = recognition;
76
+ recognition.start();
77
+ }, [SpeechRecognitionAPI, langCode, t, handleResult]);
78
+ const stop = useCallback(() => {
79
+ keepListeningRef.current = false;
80
+ speechRecognitionACRef.current.abort();
81
+ speechRecognitionACRef.current = new AbortController();
82
+ if (speechRecognitionRef.current) {
83
+ speechRecognitionRef.current.stop();
84
+ speechRecognitionRef.current.abort?.();
85
+ speechRecognitionRef.current = null;
86
+ }
87
+ setActive(false);
88
+ }, []);
89
+ const start = useCallback(() => {
90
+ setError(null);
91
+ if (!supported) {
92
+ setError(t('speech_recognition_not_supported'));
93
+ return;
94
+ }
95
+ keepListeningRef.current = true;
96
+ startRecognition();
97
+ }, [startRecognition]);
98
+ // Stop recognition on page hide or visibility change
99
+ useEffect(() => {
100
+ const ac = new AbortController();
101
+ const handleVisibilityChange = () => {
102
+ if (document.visibilityState !== 'visible') {
103
+ stop();
104
+ }
105
+ };
106
+ window.addEventListener('pagehide', stop, { signal: ac.signal });
107
+ window.addEventListener('blur', stop, { signal: ac.signal });
108
+ document.addEventListener('visibilitychange', handleVisibilityChange, { signal: ac.signal });
109
+ return () => {
110
+ ac.abort();
111
+ };
112
+ }, []);
113
+ return {
114
+ supported,
115
+ active,
116
+ error,
117
+ start,
118
+ stop
119
+ };
120
+ }
121
+ //# sourceMappingURL=useSpeechRecognition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSpeechRecognition.js","sourceRoot":"","sources":["../../src/hooks/useSpeechRecognition.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,OAAO,MAAM,WAAW,CAAC;AAgBhC,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,QAAQ,EACR,eAAe,EACf,QAAQ,GAAG,SAAS,CAAC,QAAQ,IAAI,OAAO,EACd;IAO1B,MAAM,oBAAoB,GACxB,MAAM,CAAC,iBAAiB,IAAI,MAAM,CAAC,uBAAuB,CAAC;IAE7D,MAAM,SAAS,GAAG,CAAC,CAAC,oBAAoB,CAAC;IAEzC,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAExD,MAAM,oBAAoB,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IACpE,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC;IAC7D,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC;IACpD,MAAM,gBAAgB,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;IAEhD,MAAM,YAAY,GAAG,WAAW,CAC9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BAAgB,CAAC,CAAC,CAAC;IAEvB,qDAAqD;IACrD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,EAAE,GAAG,IAAI,eAAe,EAAE,CAAC;QAEjC,MAAM,sBAAsB,GAAG,GAAG,EAAE;YAClC,IAAI,QAAQ,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;gBAC3C,IAAI,EAAE,CAAC;YACT,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;QACjE,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7D,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,sBAAsB,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;QAE7F,OAAO,GAAG,EAAE;YACV,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,SAAS;QACT,MAAM;QACN,KAAK;QACL,KAAK;QACL,IAAI;KACL,CAAC;AACJ,CAAC","sourcesContent":["/// <reference types=\"dom-speech-recognition\" preserve=\"true\" />\n\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport useI18n from './useI18n';\n\n/**\n * Hook for speech-to-text conversion using the Web Speech API.\n * Provides real-time voice recognition with support for interim results and automatic error handling.\n */\n\nexport interface UseSpeechRecognitionProps {\n /** onResult handler */\n onResult: (text: string) => void;\n /** onInterimResult handler */\n onInterimResult?: (text: string) => void;\n /** BCP 47 language tag */\n langCode?: string;\n}\n\nexport default function useSpeechRecognition({\n onResult,\n onInterimResult,\n langCode = navigator.language ?? 'en-US'\n}: UseSpeechRecognitionProps): {\n supported: boolean;\n active: boolean;\n error: string | null;\n start: () => void;\n stop: () => void;\n} {\n const SpeechRecognitionAPI: typeof SpeechRecognition | undefined =\n window.SpeechRecognition ?? window.webkitSpeechRecognition;\n\n const supported = !!SpeechRecognitionAPI;\n\n const t = useI18n();\n const [active, setActive] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const speechRecognitionRef = useRef<SpeechRecognition | null>(null);\n const speechRecognitionACRef = useRef(new AbortController());\n const onResultACRef = useRef(new AbortController());\n const keepListeningRef = useRef<boolean>(false);\n\n const handleResult = useCallback(\n (event: SpeechRecognitionEvent) => {\n let nextValue = '';\n\n for (let i = event.resultIndex; i < event.results.length; i += 1) {\n const result = event.results[i];\n const processed = result[0].transcript;\n nextValue += processed;\n\n if (result.isFinal) {\n onResult(nextValue);\n } else {\n onInterimResult?.(nextValue);\n }\n }\n },\n [onResult, onInterimResult]\n );\n\n useEffect(() => {\n if (!speechRecognitionRef.current) return;\n\n onResultACRef.current.abort();\n onResultACRef.current = new AbortController();\n\n speechRecognitionRef.current.addEventListener('result', handleResult, {\n signal: AbortSignal.any([speechRecognitionACRef.current.signal, onResultACRef.current.signal])\n });\n }, [handleResult]);\n\n const startRecognition = useCallback(() => {\n if (!supported) return;\n\n const recognition = new SpeechRecognitionAPI();\n recognition.lang = langCode;\n recognition.interimResults = true;\n recognition.maxAlternatives = 1;\n recognition.continuous = true;\n\n recognition.addEventListener(\n 'start',\n () => {\n setActive(true);\n setError(null);\n },\n { signal: speechRecognitionACRef.current.signal }\n );\n\n recognition.addEventListener('result', handleResult, {\n signal: AbortSignal.any([speechRecognitionACRef.current.signal, onResultACRef.current.signal])\n });\n\n recognition.addEventListener(\n 'error',\n event => {\n if (event.error === 'no-speech') {\n setError(t('no_speech_detected'));\n } else if (event.error === 'audio-capture') {\n setError(t('no_microphone_found'));\n } else if (event.error === 'not-allowed') {\n setError(t('microphone_access_denied'));\n } else {\n setError(t('speech_recognition_error', [event.error]));\n }\n setActive(false);\n },\n { signal: speechRecognitionACRef.current.signal }\n );\n\n recognition.addEventListener(\n 'end',\n () => {\n if (keepListeningRef.current) {\n startRecognition();\n } else {\n setActive(false);\n }\n },\n { signal: speechRecognitionACRef.current.signal }\n );\n\n speechRecognitionRef.current = recognition;\n recognition.start();\n }, [SpeechRecognitionAPI, langCode, t, handleResult]);\n\n const stop = useCallback(() => {\n keepListeningRef.current = false;\n\n speechRecognitionACRef.current.abort();\n speechRecognitionACRef.current = new AbortController();\n\n if (speechRecognitionRef.current) {\n speechRecognitionRef.current.stop();\n speechRecognitionRef.current.abort?.();\n speechRecognitionRef.current = null;\n }\n\n setActive(false);\n }, []);\n\n const start = useCallback(() => {\n setError(null);\n\n if (!supported) {\n setError(t('speech_recognition_not_supported'));\n return;\n }\n\n keepListeningRef.current = true;\n startRecognition();\n }, [startRecognition]);\n\n // Stop recognition on page hide or visibility change\n useEffect(() => {\n const ac = new AbortController();\n\n const handleVisibilityChange = () => {\n if (document.visibilityState !== 'visible') {\n stop();\n }\n };\n\n window.addEventListener('pagehide', stop, { signal: ac.signal });\n window.addEventListener('blur', stop, { signal: ac.signal });\n document.addEventListener('visibilitychange', handleVisibilityChange, { signal: ac.signal });\n\n return () => {\n ac.abort();\n };\n }, []);\n\n return {\n supported,\n active,\n error,\n start,\n stop\n };\n}\n"]}
@@ -102,6 +102,8 @@ declare const _default: {
102
102
  generate: string;
103
103
  reject: string;
104
104
  modify: string;
105
+ start: string;
106
+ stop: string;
105
107
  view_all: string;
106
108
  view_less: string;
107
109
  show_more: string;
@@ -280,6 +282,7 @@ declare const _default: {
280
282
  composite_input_open_button_a11y: string;
281
283
  composite_input_close_button_a11y: string;
282
284
  menu_selection_instructions: string;
285
+ menu_filter_instructions: string;
283
286
  menu_item_expand_arrow: string;
284
287
  menu_item_collapse_arrow: string;
285
288
  menu_item_collapse_shift_space: string;
@@ -413,6 +416,7 @@ declare const _default: {
413
416
  finalizing_response: string;
414
417
  preparing_content: string;
415
418
  response_generated: string;
419
+ processing_speech: string;
416
420
  good_response: string;
417
421
  bad_response: string;
418
422
  share_feedback: string;
@@ -453,6 +457,13 @@ declare const _default: {
453
457
  shortcut_DismissToast: string;
454
458
  configurable_layout_instructions: string;
455
459
  page_number: string;
460
+ dictate: string;
461
+ stop_dictation: string;
462
+ no_speech_detected: string;
463
+ no_microphone_found: string;
464
+ microphone_access_denied: string;
465
+ speech_recognition_error: string;
466
+ speech_recognition_not_supported: string;
456
467
  drag_handle_activate_description: string;
457
468
  drag_handle_drop_description: string;
458
469
  drag_handle_cancel_description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/i18n/default.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+iDE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqMxB,6CAA6C;;;;IAK7C,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2F5C,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2C/B,uCAAuC;;;;;;;;;;;IAavC,6CAA6C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA54D/C,wBAi8DE"}
@@ -107,6 +107,8 @@ export default {
107
107
  generate: 'Generate',
108
108
  reject: 'Reject',
109
109
  modify: 'Modify',
110
+ start: 'Start',
111
+ stop: 'Stop',
110
112
  /* Static verb noun */
111
113
  view_all: 'View all',
112
114
  view_less: 'View less',
@@ -305,6 +307,7 @@ export default {
305
307
  composite_input_close_button_a11y: 'Close configuration dialog',
306
308
  /* core:Menu */
307
309
  menu_selection_instructions: 'Press enter to select items.',
310
+ menu_filter_instructions: 'Start typing to filter.',
308
311
  menu_item_expand_arrow: '{0}. Arrow right to expand.',
309
312
  menu_item_collapse_arrow: 'Arrow left to collapse.',
310
313
  menu_item_collapse_shift_space: 'Press shift space to collapse.',
@@ -453,6 +456,7 @@ export default {
453
456
  finalizing_response: 'Finalizing response',
454
457
  preparing_content: 'Preparing content',
455
458
  response_generated: 'Response generated',
459
+ processing_speech: 'Processing speech',
456
460
  good_response: 'Good response',
457
461
  bad_response: 'Bad response',
458
462
  share_feedback: 'Share feedback',
@@ -500,6 +504,15 @@ export default {
500
504
  /* core: PageTemplates */
501
505
  configurable_layout_instructions: 'Configurable layout. Use tab key to select an item. Use arrow keys to move it to a new position. Use arrow keys with shift to resize the item in the given direction.',
502
506
  page_number: 'Page {0}',
507
+ /* core:SpeechToTextButton */
508
+ dictate: 'Dictate',
509
+ stop_dictation: 'Stop dictation',
510
+ /* core:SpeechRecognition */
511
+ no_speech_detected: 'No speech was detected. Please try speaking again.',
512
+ no_microphone_found: 'No microphone was found. Please check your audio input.',
513
+ microphone_access_denied: 'Microphone access was denied. Please allow access and try again.',
514
+ speech_recognition_error: 'Speech recognition error: {0}',
515
+ speech_recognition_not_supported: 'Speech recognition is not supported in this browser.',
503
516
  /* dnd:DragHandle */
504
517
  drag_handle_activate_description: 'Press Space to activate dragging.',
505
518
  drag_handle_drop_description: 'Press Space again to drop.',