@syncfusion/ej2-inputs 28.2.11 → 29.1.34

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 (252) hide show
  1. package/README.md +26 -2
  2. package/aceconfig.js +17 -0
  3. package/dist/ej2-inputs.min.js +2 -2
  4. package/dist/ej2-inputs.umd.min.js +2 -2
  5. package/dist/ej2-inputs.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-inputs.es2015.js +652 -25
  7. package/dist/es6/ej2-inputs.es2015.js.map +1 -1
  8. package/dist/es6/ej2-inputs.es5.js +681 -25
  9. package/dist/es6/ej2-inputs.es5.js.map +1 -1
  10. package/dist/global/ej2-inputs.min.js +2 -2
  11. package/dist/global/ej2-inputs.min.js.map +1 -1
  12. package/dist/global/index.d.ts +1 -1
  13. package/package.json +18 -26
  14. package/speech-to-text.d.ts +4 -0
  15. package/speech-to-text.js +4 -0
  16. package/src/index.d.ts +1 -0
  17. package/src/index.js +1 -0
  18. package/src/rating/rating.js +3 -0
  19. package/src/slider/slider.d.ts +0 -2
  20. package/src/slider/slider.js +14 -19
  21. package/src/speech-to-text/index.d.ts +5 -0
  22. package/src/speech-to-text/index.js +4 -0
  23. package/src/speech-to-text/speech-to-text-model.d.ts +270 -0
  24. package/src/speech-to-text/speech-to-text.d.ts +487 -0
  25. package/src/speech-to-text/speech-to-text.js +660 -0
  26. package/src/uploader/uploader.js +7 -5
  27. package/styles/bds-lite.css +81 -0
  28. package/styles/bds-lite.scss +3 -0
  29. package/styles/bds.css +111 -0
  30. package/styles/bds.scss +4 -0
  31. package/styles/bootstrap-dark-lite.css +98 -17
  32. package/styles/bootstrap-dark-lite.scss +3 -0
  33. package/styles/bootstrap-dark.css +128 -17
  34. package/styles/bootstrap-dark.scss +4 -0
  35. package/styles/bootstrap-lite.css +81 -0
  36. package/styles/bootstrap-lite.scss +3 -0
  37. package/styles/bootstrap.css +111 -0
  38. package/styles/bootstrap.scss +4 -0
  39. package/styles/bootstrap4-lite.css +102 -25
  40. package/styles/bootstrap4-lite.scss +3 -0
  41. package/styles/bootstrap4.css +132 -25
  42. package/styles/bootstrap4.scss +4 -0
  43. package/styles/bootstrap5-dark-lite.css +151 -73
  44. package/styles/bootstrap5-dark-lite.scss +3 -0
  45. package/styles/bootstrap5-dark.css +192 -83
  46. package/styles/bootstrap5-dark.scss +4 -0
  47. package/styles/bootstrap5-lite.css +106 -28
  48. package/styles/bootstrap5-lite.scss +3 -0
  49. package/styles/bootstrap5.3-lite.css +78 -0
  50. package/styles/bootstrap5.3-lite.scss +3 -0
  51. package/styles/bootstrap5.3.css +109 -0
  52. package/styles/bootstrap5.3.scss +4 -0
  53. package/styles/bootstrap5.css +137 -28
  54. package/styles/bootstrap5.scss +4 -0
  55. package/styles/color-picker/_theme.scss +4 -2
  56. package/styles/color-picker/bootstrap4.css +4 -4
  57. package/styles/color-picker/bootstrap5-dark.css +12 -12
  58. package/styles/color-picker/bootstrap5.css +7 -7
  59. package/styles/data-form/_bootstrap-dark-definition.scss +4 -2
  60. package/styles/data-form/_bootstrap4-definition.scss +4 -2
  61. package/styles/data-form/_fabric-dark-definition.scss +4 -2
  62. package/styles/data-form/_material-dark-definition.scss +4 -2
  63. package/styles/data-form/_material-definition.scss +4 -2
  64. package/styles/data-form/bootstrap-dark.css +6 -6
  65. package/styles/data-form/bootstrap4.css +6 -6
  66. package/styles/data-form/bootstrap5-dark.css +6 -6
  67. package/styles/data-form/bootstrap5.css +4 -4
  68. package/styles/data-form/fabric-dark.css +6 -6
  69. package/styles/data-form/material-dark.css +6 -6
  70. package/styles/data-form/material.css +6 -6
  71. package/styles/fabric-dark-lite.css +104 -22
  72. package/styles/fabric-dark-lite.scss +3 -0
  73. package/styles/fabric-dark.css +135 -22
  74. package/styles/fabric-dark.scss +4 -0
  75. package/styles/fabric-lite.css +100 -18
  76. package/styles/fabric-lite.scss +3 -0
  77. package/styles/fabric.css +131 -18
  78. package/styles/fabric.scss +4 -0
  79. package/styles/fluent-dark-lite.css +96 -14
  80. package/styles/fluent-dark-lite.scss +3 -0
  81. package/styles/fluent-dark.css +127 -14
  82. package/styles/fluent-dark.scss +4 -0
  83. package/styles/fluent-lite.css +96 -14
  84. package/styles/fluent-lite.scss +3 -0
  85. package/styles/fluent.css +127 -14
  86. package/styles/fluent.scss +4 -0
  87. package/styles/fluent2-lite.css +82 -0
  88. package/styles/fluent2-lite.scss +3 -0
  89. package/styles/fluent2.css +115 -2
  90. package/styles/fluent2.scss +4 -0
  91. package/styles/highcontrast-light-lite.css +81 -0
  92. package/styles/highcontrast-light-lite.scss +3 -0
  93. package/styles/highcontrast-light.css +111 -0
  94. package/styles/highcontrast-light.scss +4 -0
  95. package/styles/highcontrast-lite.css +81 -0
  96. package/styles/highcontrast-lite.scss +3 -0
  97. package/styles/highcontrast.css +111 -0
  98. package/styles/highcontrast.scss +4 -0
  99. package/styles/input/_bootstrap4-definition.scss +8 -6
  100. package/styles/input/_layout.scss +8 -1
  101. package/styles/input/_theme.scss +5 -1
  102. package/styles/input/bootstrap4.css +9 -9
  103. package/styles/input/bootstrap5-dark.css +25 -25
  104. package/styles/input/bootstrap5.css +7 -7
  105. package/styles/input/fabric-dark.css +6 -6
  106. package/styles/input/tailwind-dark.css +2 -2
  107. package/styles/input/tailwind3.css +2 -2
  108. package/styles/maskedtextbox/bootstrap5-dark.css +1 -1
  109. package/styles/material-dark-lite.css +89 -6
  110. package/styles/material-dark-lite.scss +3 -0
  111. package/styles/material-dark.css +121 -6
  112. package/styles/material-dark.scss +4 -0
  113. package/styles/material-lite.css +89 -6
  114. package/styles/material-lite.scss +3 -0
  115. package/styles/material.css +121 -6
  116. package/styles/material.scss +4 -0
  117. package/styles/material3-dark-lite.css +81 -0
  118. package/styles/material3-dark-lite.scss +3 -0
  119. package/styles/material3-dark.css +111 -0
  120. package/styles/material3-dark.scss +4 -0
  121. package/styles/material3-lite.css +81 -0
  122. package/styles/material3-lite.scss +3 -0
  123. package/styles/material3.css +111 -0
  124. package/styles/material3.scss +4 -0
  125. package/styles/otp-input/bootstrap5-dark.css +3 -3
  126. package/styles/rating/bootstrap-dark.css +11 -11
  127. package/styles/rating/bootstrap5-dark.css +5 -5
  128. package/styles/rating/bootstrap5.css +5 -5
  129. package/styles/rating/fabric-dark.css +5 -5
  130. package/styles/rating/fabric.css +12 -12
  131. package/styles/rating/fluent-dark.css +11 -11
  132. package/styles/rating/fluent.css +11 -11
  133. package/styles/rating/tailwind-dark.css +5 -5
  134. package/styles/rating/tailwind.css +5 -5
  135. package/styles/signature/bootstrap5-dark.css +1 -1
  136. package/styles/slider/_bootstrap4-definition.scss +4 -2
  137. package/styles/slider/_fluent2-definition.scss +2 -2
  138. package/styles/slider/_fusionnew-definition.scss +3 -0
  139. package/styles/slider/_layout.scss +4 -2
  140. package/styles/slider/bootstrap4.css +6 -6
  141. package/styles/slider/bootstrap5-dark.css +5 -5
  142. package/styles/slider/bootstrap5.css +5 -5
  143. package/styles/slider/fabric-dark.css +5 -5
  144. package/styles/slider/fabric.css +6 -6
  145. package/styles/slider/fluent-dark.css +3 -3
  146. package/styles/slider/fluent.css +3 -3
  147. package/styles/slider/fluent2.css +2 -2
  148. package/styles/smart-textarea/tailwind-dark.css +1 -1
  149. package/styles/speech-to-text/_all.scss +2 -0
  150. package/styles/speech-to-text/_bds-definition.scss +25 -0
  151. package/styles/speech-to-text/_bigger.scss +45 -0
  152. package/styles/speech-to-text/_bootstrap-dark-definition.scss +24 -0
  153. package/styles/speech-to-text/_bootstrap-definition.scss +24 -0
  154. package/styles/speech-to-text/_bootstrap4-definition.scss +24 -0
  155. package/styles/speech-to-text/_bootstrap5-dark-definition.scss +1 -0
  156. package/styles/speech-to-text/_bootstrap5-definition.scss +24 -0
  157. package/styles/speech-to-text/_bootstrap5.3-definition.scss +24 -0
  158. package/styles/speech-to-text/_fabric-dark-definition.scss +24 -0
  159. package/styles/speech-to-text/_fabric-definition.scss +24 -0
  160. package/styles/speech-to-text/_fluent-dark-definition.scss +1 -0
  161. package/styles/speech-to-text/_fluent-definition.scss +24 -0
  162. package/styles/speech-to-text/_fluent2-definition.scss +25 -0
  163. package/styles/speech-to-text/_fusionnew-definition.scss +24 -0
  164. package/styles/speech-to-text/_highcontrast-definition.scss +24 -0
  165. package/styles/speech-to-text/_highcontrast-light-definition.scss +24 -0
  166. package/styles/speech-to-text/_layout.scss +59 -0
  167. package/styles/speech-to-text/_material-dark-definition.scss +24 -0
  168. package/styles/speech-to-text/_material-definition.scss +24 -0
  169. package/styles/speech-to-text/_material3-dark-definition.scss +1 -0
  170. package/styles/speech-to-text/_material3-definition.scss +24 -0
  171. package/styles/speech-to-text/_tailwind-dark-definition.scss +1 -0
  172. package/styles/speech-to-text/_tailwind-definition.scss +25 -0
  173. package/styles/speech-to-text/_tailwind3-definition.scss +25 -0
  174. package/styles/speech-to-text/_theme.scss +30 -0
  175. package/styles/speech-to-text/bds.css +173 -0
  176. package/styles/speech-to-text/bds.scss +7 -0
  177. package/styles/speech-to-text/bootstrap-dark.css +110 -0
  178. package/styles/speech-to-text/bootstrap-dark.scss +7 -0
  179. package/styles/speech-to-text/bootstrap.css +110 -0
  180. package/styles/speech-to-text/bootstrap.scss +7 -0
  181. package/styles/speech-to-text/bootstrap4.css +106 -0
  182. package/styles/speech-to-text/bootstrap4.scss +7 -0
  183. package/styles/speech-to-text/bootstrap5-dark.css +108 -0
  184. package/styles/speech-to-text/bootstrap5-dark.scss +7 -0
  185. package/styles/speech-to-text/bootstrap5.3.css +112 -0
  186. package/styles/speech-to-text/bootstrap5.3.scss +7 -0
  187. package/styles/speech-to-text/bootstrap5.css +108 -0
  188. package/styles/speech-to-text/bootstrap5.scss +7 -0
  189. package/styles/speech-to-text/fabric-dark.css +112 -0
  190. package/styles/speech-to-text/fabric-dark.scss +7 -0
  191. package/styles/speech-to-text/fabric.css +112 -0
  192. package/styles/speech-to-text/fabric.scss +7 -0
  193. package/styles/speech-to-text/fluent-dark.css +112 -0
  194. package/styles/speech-to-text/fluent-dark.scss +7 -0
  195. package/styles/speech-to-text/fluent.css +112 -0
  196. package/styles/speech-to-text/fluent.scss +7 -0
  197. package/styles/speech-to-text/fluent2.css +118 -0
  198. package/styles/speech-to-text/fluent2.scss +7 -0
  199. package/styles/speech-to-text/highcontrast-light.css +110 -0
  200. package/styles/speech-to-text/highcontrast-light.scss +7 -0
  201. package/styles/speech-to-text/highcontrast.css +110 -0
  202. package/styles/speech-to-text/highcontrast.scss +7 -0
  203. package/styles/speech-to-text/icons/_bds.scss +8 -0
  204. package/styles/speech-to-text/icons/_bootstrap-dark.scss +8 -0
  205. package/styles/speech-to-text/icons/_bootstrap.scss +8 -0
  206. package/styles/speech-to-text/icons/_bootstrap4.scss +8 -0
  207. package/styles/speech-to-text/icons/_bootstrap5-dark.scss +1 -0
  208. package/styles/speech-to-text/icons/_bootstrap5.3.scss +8 -0
  209. package/styles/speech-to-text/icons/_bootstrap5.scss +8 -0
  210. package/styles/speech-to-text/icons/_fabric-dark.scss +8 -0
  211. package/styles/speech-to-text/icons/_fabric.scss +8 -0
  212. package/styles/speech-to-text/icons/_fluent-dark.scss +1 -0
  213. package/styles/speech-to-text/icons/_fluent.scss +8 -0
  214. package/styles/speech-to-text/icons/_fluent2.scss +8 -0
  215. package/styles/speech-to-text/icons/_fusionnew.scss +8 -0
  216. package/styles/speech-to-text/icons/_highcontrast-light.scss +8 -0
  217. package/styles/speech-to-text/icons/_highcontrast.scss +8 -0
  218. package/styles/speech-to-text/icons/_material-dark.scss +8 -0
  219. package/styles/speech-to-text/icons/_material.scss +8 -0
  220. package/styles/speech-to-text/icons/_material3-dark.scss +1 -0
  221. package/styles/speech-to-text/icons/_material3.scss +8 -0
  222. package/styles/speech-to-text/icons/_tailwind-dark.scss +1 -0
  223. package/styles/speech-to-text/icons/_tailwind.scss +8 -0
  224. package/styles/speech-to-text/icons/_tailwind3.scss +8 -0
  225. package/styles/speech-to-text/material-dark.css +114 -0
  226. package/styles/speech-to-text/material-dark.scss +7 -0
  227. package/styles/speech-to-text/material.css +114 -0
  228. package/styles/speech-to-text/material.scss +7 -0
  229. package/styles/speech-to-text/material3-dark.css +112 -0
  230. package/styles/speech-to-text/material3-dark.scss +8 -0
  231. package/styles/speech-to-text/material3.css +114 -0
  232. package/styles/speech-to-text/material3.scss +8 -0
  233. package/styles/speech-to-text/tailwind-dark.css +110 -0
  234. package/styles/speech-to-text/tailwind-dark.scss +7 -0
  235. package/styles/speech-to-text/tailwind.css +110 -0
  236. package/styles/speech-to-text/tailwind.scss +7 -0
  237. package/styles/speech-to-text/tailwind3.css +114 -0
  238. package/styles/speech-to-text/tailwind3.scss +7 -0
  239. package/styles/tailwind-dark-lite.css +93 -12
  240. package/styles/tailwind-dark-lite.scss +3 -0
  241. package/styles/tailwind-dark.css +126 -15
  242. package/styles/tailwind-dark.scss +4 -0
  243. package/styles/tailwind-lite.css +86 -5
  244. package/styles/tailwind-lite.scss +3 -0
  245. package/styles/tailwind.css +116 -5
  246. package/styles/tailwind.scss +4 -0
  247. package/styles/tailwind3-lite.css +83 -2
  248. package/styles/tailwind3-lite.scss +3 -0
  249. package/styles/tailwind3.css +113 -2
  250. package/styles/tailwind3.scss +4 -0
  251. package/styles/uploader/bootstrap5-dark.css +25 -25
  252. package/styles/uploader/tailwind-dark.css +7 -7
@@ -0,0 +1,660 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
15
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
19
+ };
20
+ import { NotifyPropertyChanges, Component, getUniqueID, Property, isNullOrUndefined as isNOU, Event, EventHandler, ChildProperty, Complex, removeClass, addClass, L10n } from '@syncfusion/ej2-base';
21
+ import { Button } from '@syncfusion/ej2-buttons';
22
+ import { Tooltip } from '@syncfusion/ej2-popups';
23
+ /**
24
+ * Configuration settings for the toggle button used in the SpeechToText component.
25
+ */
26
+ var ButtonSettings = /** @class */ (function (_super) {
27
+ __extends(ButtonSettings, _super);
28
+ function ButtonSettings() {
29
+ return _super !== null && _super.apply(this, arguments) || this;
30
+ }
31
+ __decorate([
32
+ Property('')
33
+ ], ButtonSettings.prototype, "content", void 0);
34
+ __decorate([
35
+ Property('')
36
+ ], ButtonSettings.prototype, "stopContent", void 0);
37
+ __decorate([
38
+ Property('')
39
+ ], ButtonSettings.prototype, "iconCss", void 0);
40
+ __decorate([
41
+ Property('')
42
+ ], ButtonSettings.prototype, "stopIconCss", void 0);
43
+ __decorate([
44
+ Property('Left')
45
+ ], ButtonSettings.prototype, "iconPosition", void 0);
46
+ __decorate([
47
+ Property(false)
48
+ ], ButtonSettings.prototype, "isPrimary", void 0);
49
+ return ButtonSettings;
50
+ }(ChildProperty));
51
+ export { ButtonSettings };
52
+ /**
53
+ * Configuration settings for tooltips in the SpeechToText component.
54
+ * This allows customization of the tooltip content and its positioning.
55
+ */
56
+ var TooltipSettings = /** @class */ (function (_super) {
57
+ __extends(TooltipSettings, _super);
58
+ function TooltipSettings() {
59
+ return _super !== null && _super.apply(this, arguments) || this;
60
+ }
61
+ __decorate([
62
+ Property('Start listening')
63
+ ], TooltipSettings.prototype, "content", void 0);
64
+ __decorate([
65
+ Property('Stop listening')
66
+ ], TooltipSettings.prototype, "stopContent", void 0);
67
+ __decorate([
68
+ Property('TopCenter')
69
+ ], TooltipSettings.prototype, "position", void 0);
70
+ return TooltipSettings;
71
+ }(ChildProperty));
72
+ export { TooltipSettings };
73
+ /**
74
+ * Enum representing the operational states of the SpeechToText component.
75
+ */
76
+ export var SpeechToTextState;
77
+ (function (SpeechToTextState) {
78
+ /**
79
+ * Specifies the state where the SpeechToText component is inactive and not processing spoken input.
80
+ */
81
+ SpeechToTextState["Inactive"] = "Inactive";
82
+ /**
83
+ * Specifies the state where the SpeechToText component is actively listening to spoken input.
84
+ */
85
+ SpeechToTextState["Listening"] = "Listening";
86
+ /**
87
+ * Specifies the state where the SpeechToText component has stopped processing spoken input.
88
+ */
89
+ SpeechToTextState["Stopped"] = "Stopped";
90
+ })(SpeechToTextState || (SpeechToTextState = {}));
91
+ //#endregion
92
+ var SpeechToText = /** @class */ (function (_super) {
93
+ __extends(SpeechToText, _super);
94
+ //#endregion
95
+ //#region Inherited methods
96
+ /**
97
+ * Constructor for creating the component
98
+ *
99
+ * @param {SpeechToTextModel} options - Specifies the SpeechToTextModel model.
100
+ * @param {string | HTMLElement} element - Specifies the element to render as component.
101
+ * @private
102
+ */
103
+ function SpeechToText(options, element) {
104
+ var _this = _super.call(this, options, element) || this;
105
+ _this.fullTranscript = '';
106
+ _this.isClicked = false;
107
+ _this.isUserInteracted = false;
108
+ _this.hasStarted = false;
109
+ return _this;
110
+ }
111
+ /**
112
+ * Initialize the event handler
113
+ *
114
+ * @private
115
+ * @returns {void}
116
+ */
117
+ SpeechToText.prototype.preRender = function () {
118
+ if (!this.element.id) {
119
+ this.element.id = getUniqueID('e-' + this.getModuleName());
120
+ }
121
+ };
122
+ SpeechToText.prototype.getDirective = function () {
123
+ return 'EJS-SPEECHTOTEXT';
124
+ };
125
+ /**
126
+ * To get component name.
127
+ *
128
+ * @returns {string} - It returns the current module name.
129
+ * @private
130
+ */
131
+ SpeechToText.prototype.getModuleName = function () {
132
+ return 'speech-to-text';
133
+ };
134
+ /**
135
+ * Get the properties to be maintained in the persisted state.
136
+ *
137
+ * @private
138
+ * @returns {string} - It returns the persisted data.
139
+ */
140
+ SpeechToText.prototype.getPersistData = function () {
141
+ return this.addOnPersist([]);
142
+ };
143
+ SpeechToText.prototype.render = function () {
144
+ this.renderSpeechToText();
145
+ this.initializeSpeechRecognition();
146
+ if (!isNOU(this.listeningState)) {
147
+ this.handleStateChange();
148
+ }
149
+ this.wireEvents();
150
+ };
151
+ //#endregion
152
+ //#region Private Methods
153
+ SpeechToText.prototype.initializeLocale = function () {
154
+ this.l10n = new L10n(this.getModuleName(), {
155
+ abortedError: 'Speech recognition was aborted.',
156
+ audioCaptureError: 'No microphone detected. Ensure your microphone is connected.',
157
+ defaultError: 'An unknown error occurred.',
158
+ networkError: 'Network error occurred. Check your internet connection.',
159
+ noSpeechError: 'No speech detected. Please speak into the microphone.',
160
+ notAllowedError: 'Microphone access denied. Allow microphone permissions.',
161
+ serviceNotAllowedError: 'Speech recognition service is not allowed in this context.',
162
+ unsupportedBrowserError: 'The browser does not support the SpeechRecognition API.',
163
+ startAriaLabel: 'Press to start speaking and transcribe your words',
164
+ stopAriaLabel: 'Press to stop speaking and end transcription',
165
+ startTooltipText: 'Start listening',
166
+ stopTooltipText: 'Stop listening'
167
+ }, this.locale);
168
+ };
169
+ SpeechToText.prototype.renderSpeechToText = function () {
170
+ this.initializeLocale();
171
+ var iconCss = !isNOU(this.buttonSettings.iconCss) && this.buttonSettings.iconCss !== '' ? this.buttonSettings.iconCss : 'e-icons e-listen-icon';
172
+ this.buttonInst = new Button({
173
+ iconCss: iconCss,
174
+ isPrimary: this.buttonSettings.isPrimary,
175
+ cssClass: this.updateButtonCssClass(),
176
+ disabled: this.disabled,
177
+ content: this.buttonSettings.content,
178
+ iconPosition: this.buttonSettings.iconPosition,
179
+ enableRtl: this.enableRtl
180
+ });
181
+ this.buttonInst.appendTo(this.element);
182
+ this.updateTooltip();
183
+ this.updateCssClass(this.cssClass, '');
184
+ this.updateAriaLabel();
185
+ if (!isNOU(this.htmlAttributes)) {
186
+ this.addHtmlAttributes(this.htmlAttributes);
187
+ }
188
+ };
189
+ SpeechToText.prototype.updateAriaLabel = function () {
190
+ var ariaLabel;
191
+ if (this.htmlAttributes && this.htmlAttributes['aria-label']) {
192
+ ariaLabel = this.htmlAttributes['aria-label'];
193
+ }
194
+ else {
195
+ ariaLabel = this.micOn ? this.l10n.getConstant('stopAriaLabel') : this.l10n.getConstant('startAriaLabel');
196
+ }
197
+ this.element.setAttribute('aria-label', ariaLabel);
198
+ };
199
+ SpeechToText.prototype.updateCssClass = function (newClass, oldClass) {
200
+ if (oldClass) {
201
+ removeClass([this.element], oldClass.trim().split(' '));
202
+ }
203
+ if (newClass) {
204
+ addClass([this.element], newClass.trim().split(' '));
205
+ }
206
+ };
207
+ SpeechToText.prototype.updateButtonCssClass = function () {
208
+ var content = this.isClicked ? this.buttonSettings.stopContent : this.buttonSettings.content;
209
+ var cssClass;
210
+ if (content === '') {
211
+ cssClass = 'e-round';
212
+ }
213
+ if (this.micOn) {
214
+ cssClass += ' e-listening-state';
215
+ }
216
+ return cssClass;
217
+ };
218
+ SpeechToText.prototype.updateTooltip = function () {
219
+ if (this.showTooltip) {
220
+ if (this.tooltipSettings) {
221
+ if (this.tooltipSettings.content === 'Start listening') {
222
+ this.tooltipSettings.content = this.l10n.getConstant('startTooltipText');
223
+ }
224
+ if (this.tooltipSettings.stopContent === 'Stop listening') {
225
+ this.tooltipSettings.stopContent = this.l10n.getConstant('stopTooltipText');
226
+ }
227
+ }
228
+ this.tooltipInst = new Tooltip({
229
+ content: this.hasStarted ? this.tooltipSettings.stopContent : this.tooltipSettings.content,
230
+ position: this.tooltipSettings.position,
231
+ windowCollision: true,
232
+ cssClass: this.cssClass ? ('e-speech-to-text-tooltip ' + this.cssClass) : 'e-speech-to-text-tooltip',
233
+ opensOn: 'Hover',
234
+ enableRtl: this.enableRtl
235
+ });
236
+ this.tooltipInst.appendTo(this.element);
237
+ }
238
+ else {
239
+ if (!isNOU(this.tooltipInst)) {
240
+ this.tooltipInst.destroy();
241
+ this.tooltipInst = null;
242
+ }
243
+ }
244
+ };
245
+ SpeechToText.prototype.handleStateChange = function () {
246
+ if (this.disabled) {
247
+ return;
248
+ }
249
+ if (this.listeningState === SpeechToTextState.Listening) {
250
+ this.micOn = true;
251
+ this.startSpeechRecognition();
252
+ }
253
+ else if (this.listeningState === SpeechToTextState.Inactive || this.listeningState === SpeechToTextState.Stopped) {
254
+ if (this.micOn) {
255
+ this.micOn = false;
256
+ this.stopSpeechRecognition();
257
+ }
258
+ else {
259
+ var prevOnChange = this.isProtectedOnChange;
260
+ this.isProtectedOnChange = true;
261
+ this.listeningState = SpeechToTextState.Inactive;
262
+ this.isProtectedOnChange = prevOnChange;
263
+ }
264
+ }
265
+ };
266
+ SpeechToText.prototype.addHtmlAttributes = function (attrs) {
267
+ if (attrs) {
268
+ for (var attr in attrs) {
269
+ if (Object.prototype.hasOwnProperty.call(attrs, attr)) {
270
+ this.element.setAttribute(attr, attrs[attr]);
271
+ }
272
+ }
273
+ }
274
+ };
275
+ SpeechToText.prototype.removeHtmlAttributes = function (attrs) {
276
+ if (attrs) {
277
+ for (var attr in attrs) {
278
+ if (Object.prototype.hasOwnProperty.call(attrs, attr)) {
279
+ this.element.removeAttribute(attr);
280
+ }
281
+ }
282
+ }
283
+ };
284
+ SpeechToText.prototype.wireEvents = function () {
285
+ EventHandler.add(this.element, 'click', this.handleButtonClick, this);
286
+ };
287
+ SpeechToText.prototype.unWireEvents = function () {
288
+ EventHandler.remove(this.element, 'click', this.handleButtonClick);
289
+ };
290
+ SpeechToText.prototype.handleButtonClick = function (event) {
291
+ this.isUserInteracted = true;
292
+ this.micOn = !this.micOn;
293
+ if (this.micOn) {
294
+ this.startSpeechRecognition(event);
295
+ }
296
+ else {
297
+ this.stopSpeechRecognition(event);
298
+ }
299
+ };
300
+ SpeechToText.prototype.triggerUnSupportedError = function () {
301
+ var eventArgs = {
302
+ error: 'unsupported-browser',
303
+ errorMessage: this.l10n.getConstant('unsupportedBrowserError')
304
+ };
305
+ this.trigger('onError', eventArgs);
306
+ };
307
+ SpeechToText.prototype.initializeSpeechRecognition = function () {
308
+ var _this = this;
309
+ var windowInst = window;
310
+ var SpeechRecognition = windowInst.SpeechRecognition || windowInst.webkitSpeechRecognition;
311
+ if (!SpeechRecognition) {
312
+ this.triggerUnSupportedError();
313
+ return;
314
+ }
315
+ this.recognition = new SpeechRecognition();
316
+ this.recognition.continuous = true;
317
+ this.recognition.lang = this.lang;
318
+ this.recognition.interimResults = this.allowInterimResults;
319
+ this.recognition.onstart = function (event) {
320
+ var prevOnChange = _this.isProtectedOnChange;
321
+ _this.isProtectedOnChange = true;
322
+ _this.transcript = _this.fullTranscript = '';
323
+ _this.isProtectedOnChange = prevOnChange;
324
+ var eventArgs = {
325
+ cancel: false,
326
+ listeningState: SpeechToTextState.Listening,
327
+ event: event,
328
+ isInteracted: _this.isUserInteracted
329
+ };
330
+ _this.trigger('onStart', eventArgs, function () {
331
+ if (!eventArgs.cancel) {
332
+ _this.handleStartRecognition();
333
+ }
334
+ else {
335
+ _this.recognition.abort();
336
+ _this.micOn = false;
337
+ }
338
+ });
339
+ };
340
+ this.recognition.onend = function (event) {
341
+ if (_this.hasStarted) {
342
+ _this.micOn = false;
343
+ _this.handleStopRecognition(event);
344
+ }
345
+ };
346
+ this.recognition.onerror = function (event) {
347
+ var errorMessage = '';
348
+ switch (event.error) {
349
+ case 'not-allowed':
350
+ errorMessage = _this.l10n.getConstant('notAllowedError');
351
+ break;
352
+ case 'audio-capture':
353
+ errorMessage = _this.l10n.getConstant('audioCaptureError');
354
+ break;
355
+ case 'network':
356
+ errorMessage = _this.l10n.getConstant('networkError');
357
+ break;
358
+ case 'no-speech':
359
+ errorMessage = _this.l10n.getConstant('noSpeechError');
360
+ break;
361
+ case 'aborted':
362
+ errorMessage = _this.l10n.getConstant('abortedError');
363
+ break;
364
+ case 'service-not-allowed':
365
+ errorMessage = _this.l10n.getConstant('serviceNotAllowedError');
366
+ break;
367
+ default:
368
+ errorMessage = _this.l10n.getConstant('defaultError');
369
+ }
370
+ var eventArgs = {
371
+ event: event,
372
+ error: event.error,
373
+ errorMessage: errorMessage
374
+ };
375
+ _this.trigger('onError', eventArgs);
376
+ _this.isUserInteracted = false;
377
+ };
378
+ this.recognition.onresult = function (event) {
379
+ var result = event.results[event.resultIndex];
380
+ var interimTranscript = '';
381
+ var prevOnChange = _this.isProtectedOnChange;
382
+ _this.isProtectedOnChange = true;
383
+ if (result.isFinal) {
384
+ _this.fullTranscript += result[0].transcript;
385
+ _this.transcript = _this.fullTranscript;
386
+ }
387
+ else {
388
+ interimTranscript += result[0].transcript;
389
+ _this.transcript = _this.fullTranscript + interimTranscript;
390
+ }
391
+ var eventArgs = {
392
+ event: event,
393
+ transcript: _this.transcript,
394
+ isInterimResult: !result.isFinal
395
+ };
396
+ _this.trigger('transcriptChanged', eventArgs, function () {
397
+ if (eventArgs.transcript !== _this.transcript) {
398
+ var prevOnChange_1 = _this.isProtectedOnChange;
399
+ _this.isProtectedOnChange = true;
400
+ _this.transcript = _this.fullTranscript = eventArgs.transcript;
401
+ _this.isProtectedOnChange = prevOnChange_1;
402
+ }
403
+ });
404
+ _this.isProtectedOnChange = prevOnChange;
405
+ };
406
+ };
407
+ SpeechToText.prototype.handleStartRecognition = function () {
408
+ var prevOnChange = this.isProtectedOnChange;
409
+ this.isProtectedOnChange = true;
410
+ this.hasStarted = true;
411
+ this.listeningState = SpeechToTextState.Listening;
412
+ if (!isNOU(this.tooltipInst)) {
413
+ this.tooltipInst.content = this.tooltipSettings.stopContent;
414
+ }
415
+ this.updateAriaLabel();
416
+ this.isClicked = true;
417
+ this.buttonInst.cssClass = this.updateButtonCssClass();
418
+ this.buttonInst.content = this.buttonSettings.stopContent;
419
+ var iconCss = !isNOU(this.buttonSettings.stopIconCss) && this.buttonSettings.stopIconCss !== '' ? this.buttonSettings.stopIconCss : 'e-icons e-listen-stop';
420
+ this.buttonInst.iconCss = iconCss;
421
+ this.isProtectedOnChange = prevOnChange;
422
+ };
423
+ SpeechToText.prototype.triggerUnSupportedStart = function (event) {
424
+ var _this = this;
425
+ var prevOnChange = this.isProtectedOnChange;
426
+ this.isProtectedOnChange = true;
427
+ this.transcript = '';
428
+ this.isProtectedOnChange = prevOnChange;
429
+ var eventArgs = {
430
+ cancel: false,
431
+ listeningState: SpeechToTextState.Listening,
432
+ event: event,
433
+ isInteracted: this.isUserInteracted
434
+ };
435
+ this.trigger('onStart', eventArgs, function () {
436
+ if (!eventArgs.cancel) {
437
+ _this.handleStartRecognition();
438
+ }
439
+ });
440
+ };
441
+ SpeechToText.prototype.startSpeechRecognition = function (event) {
442
+ if (this.hasStarted) {
443
+ return;
444
+ }
445
+ if (this.recognition) {
446
+ this.recognition.start();
447
+ }
448
+ else {
449
+ this.triggerUnSupportedStart(event);
450
+ }
451
+ };
452
+ SpeechToText.prototype.stopSpeechRecognition = function (event) {
453
+ if (this.recognition) {
454
+ this.recognition.stop();
455
+ }
456
+ else {
457
+ this.handleStopRecognition(event);
458
+ }
459
+ };
460
+ SpeechToText.prototype.handleStopRecognition = function (event) {
461
+ if (!this.hasStarted) {
462
+ return;
463
+ } // Ensure onStop is only processed if needed
464
+ var prevOnChange = this.isProtectedOnChange;
465
+ this.isProtectedOnChange = true;
466
+ this.listeningState = SpeechToTextState.Stopped;
467
+ if (!isNOU(this.tooltipInst)) {
468
+ this.tooltipInst.content = this.tooltipSettings.content;
469
+ }
470
+ this.updateAriaLabel();
471
+ this.isClicked = false;
472
+ this.buttonInst.cssClass = this.updateButtonCssClass();
473
+ this.buttonInst.content = this.buttonSettings.content;
474
+ var eventArgs = {
475
+ listeningState: SpeechToTextState.Stopped,
476
+ event: event,
477
+ isInteracted: this.isUserInteracted
478
+ };
479
+ this.trigger('onStop', eventArgs);
480
+ this.listeningState = SpeechToTextState.Inactive;
481
+ var iconCss = !isNOU(this.buttonSettings.iconCss) && this.buttonSettings.iconCss !== '' ? this.buttonSettings.iconCss : 'e-icons e-listen-icon';
482
+ this.buttonInst.iconCss = iconCss;
483
+ this.hasStarted = false;
484
+ this.isProtectedOnChange = prevOnChange;
485
+ };
486
+ SpeechToText.prototype.buttonSettingsChanges = function (oldModel, newModel) {
487
+ if (oldModel.content !== newModel.content || oldModel.stopContent !== newModel.stopContent) {
488
+ this.buttonInst.content = this.hasStarted ? this.buttonSettings.stopContent : this.buttonSettings.content;
489
+ this.buttonInst.cssClass = this.updateButtonCssClass();
490
+ }
491
+ if (oldModel.iconCss !== newModel.iconCss || oldModel.stopIconCss !== newModel.stopIconCss) {
492
+ var iconCss = !isNOU(this.buttonSettings.iconCss) && this.buttonSettings.iconCss !== '' ? this.buttonSettings.iconCss : 'e-icons e-listen-icon';
493
+ var stopIconCss = !isNOU(this.buttonSettings.stopIconCss) && this.buttonSettings.stopIconCss !== '' ? this.buttonSettings.stopIconCss : 'e-icons e-listen-stop';
494
+ this.buttonInst.iconCss = this.hasStarted ? stopIconCss : iconCss;
495
+ }
496
+ if (oldModel.iconPosition !== newModel.iconPosition) {
497
+ this.buttonInst.iconPosition = this.buttonSettings.iconPosition;
498
+ }
499
+ if (oldModel.isPrimary !== newModel.isPrimary) {
500
+ this.buttonInst.isPrimary = this.buttonSettings.isPrimary;
501
+ }
502
+ };
503
+ SpeechToText.prototype.destroyAndNullify = function (obj) {
504
+ if (obj) {
505
+ obj.destroy();
506
+ obj = null;
507
+ }
508
+ };
509
+ //#endregion
510
+ //#region Public Methods
511
+ /**
512
+ * Destroy the SpeechToText.
513
+ *
514
+ * @returns {void}
515
+ */
516
+ SpeechToText.prototype.destroy = function () {
517
+ _super.prototype.destroy.call(this);
518
+ this.unWireEvents();
519
+ this.destroyAndNullify(this.buttonInst);
520
+ this.destroyAndNullify(this.tooltipInst);
521
+ this.recognition = null;
522
+ this.micOn = null;
523
+ this.htmlAttributes = this.tooltipSettings = this.buttonSettings = null;
524
+ this.element.classList.remove('e-rtl');
525
+ };
526
+ /**
527
+ * Begins the audio capture process by listening to the user's microphone input.
528
+ * This method initiates the speech-to-text process and continuously updates the `transcript` property with interim and final recognition results.
529
+ *
530
+ * @returns {void} No return value.
531
+ */
532
+ SpeechToText.prototype.startListening = function () {
533
+ if (!this.disabled && !this.isClicked) {
534
+ this.isUserInteracted = false;
535
+ this.micOn = true;
536
+ this.startSpeechRecognition();
537
+ }
538
+ };
539
+ /**
540
+ * Stops the audio capture process and finalizes the speech recognition.
541
+ * This method ends the ongoing speech-to-text operation and completes the recognition process, storing the final transcription.
542
+ * It is typically called to stop listening when the user is finished speaking.
543
+ *
544
+ * @returns {void} No return value.
545
+ */
546
+ SpeechToText.prototype.stopListening = function () {
547
+ if (!this.disabled && this.isClicked) {
548
+ this.isUserInteracted = false;
549
+ this.micOn = false;
550
+ this.stopSpeechRecognition();
551
+ }
552
+ };
553
+ /**
554
+ * Called if any of the property value is changed.
555
+ *
556
+ * @param {SpeechToTextModel} newProp - Specifies new properties
557
+ * @param {SpeechToTextModel} oldProp - Specifies old properties
558
+ * @returns {void}
559
+ * @private
560
+ */
561
+ SpeechToText.prototype.onPropertyChanged = function (newProp, oldProp) {
562
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
563
+ var prop = _a[_i];
564
+ switch (prop) {
565
+ case 'lang':
566
+ if (this.recognition) {
567
+ this.recognition.lang = this.lang;
568
+ }
569
+ break;
570
+ case 'allowInterimResults':
571
+ if (this.recognition) {
572
+ this.recognition.interimResults = this.allowInterimResults;
573
+ }
574
+ break;
575
+ case 'buttonSettings':
576
+ this.buttonSettingsChanges(oldProp.buttonSettings, newProp.buttonSettings);
577
+ break;
578
+ case 'cssClass':
579
+ this.updateCssClass(newProp.cssClass, oldProp.cssClass);
580
+ break;
581
+ case 'disabled':
582
+ this.buttonInst.disabled = this.disabled;
583
+ this.handleStateChange();
584
+ break;
585
+ case 'htmlAttributes':
586
+ this.removeHtmlAttributes(oldProp.htmlAttributes);
587
+ this.addHtmlAttributes(newProp.htmlAttributes);
588
+ break;
589
+ case 'listeningState':
590
+ this.handleStateChange();
591
+ break;
592
+ case 'tooltipSettings':
593
+ case 'showTooltip':
594
+ this.updateTooltip();
595
+ break;
596
+ case 'transcript':
597
+ this.transcript = this.fullTranscript = newProp.transcript;
598
+ break;
599
+ case 'enableRtl':
600
+ this.buttonInst.enableRtl = this.tooltipInst.enableRtl = this.enableRtl;
601
+ break;
602
+ case 'locale':
603
+ this.l10n.setLocale(this.locale);
604
+ this.updateAriaLabel();
605
+ this.updateTooltip();
606
+ break;
607
+ }
608
+ }
609
+ };
610
+ __decorate([
611
+ Property('')
612
+ ], SpeechToText.prototype, "transcript", void 0);
613
+ __decorate([
614
+ Property('')
615
+ ], SpeechToText.prototype, "lang", void 0);
616
+ __decorate([
617
+ Property(true)
618
+ ], SpeechToText.prototype, "allowInterimResults", void 0);
619
+ __decorate([
620
+ Property(true)
621
+ ], SpeechToText.prototype, "showTooltip", void 0);
622
+ __decorate([
623
+ Property('Inactive')
624
+ ], SpeechToText.prototype, "listeningState", void 0);
625
+ __decorate([
626
+ Complex({}, ButtonSettings)
627
+ ], SpeechToText.prototype, "buttonSettings", void 0);
628
+ __decorate([
629
+ Complex({}, TooltipSettings)
630
+ ], SpeechToText.prototype, "tooltipSettings", void 0);
631
+ __decorate([
632
+ Property(false)
633
+ ], SpeechToText.prototype, "disabled", void 0);
634
+ __decorate([
635
+ Property('')
636
+ ], SpeechToText.prototype, "cssClass", void 0);
637
+ __decorate([
638
+ Property({})
639
+ ], SpeechToText.prototype, "htmlAttributes", void 0);
640
+ __decorate([
641
+ Event()
642
+ ], SpeechToText.prototype, "created", void 0);
643
+ __decorate([
644
+ Event()
645
+ ], SpeechToText.prototype, "onStart", void 0);
646
+ __decorate([
647
+ Event()
648
+ ], SpeechToText.prototype, "onStop", void 0);
649
+ __decorate([
650
+ Event()
651
+ ], SpeechToText.prototype, "onError", void 0);
652
+ __decorate([
653
+ Event()
654
+ ], SpeechToText.prototype, "transcriptChanged", void 0);
655
+ SpeechToText = __decorate([
656
+ NotifyPropertyChanges
657
+ ], SpeechToText);
658
+ return SpeechToText;
659
+ }(Component));
660
+ export { SpeechToText };
@@ -3037,11 +3037,13 @@ var Uploader = /** @class */ (function (_super) {
3037
3037
  };
3038
3038
  Uploader.prototype.getFilesInArray = function (files) {
3039
3039
  var uploadFiles = [];
3040
- if (files instanceof Array) {
3041
- uploadFiles = files;
3042
- }
3043
- else {
3044
- uploadFiles.push(files);
3040
+ if (files) {
3041
+ if (files instanceof Array) {
3042
+ uploadFiles = files;
3043
+ }
3044
+ else {
3045
+ uploadFiles.push(files);
3046
+ }
3045
3047
  }
3046
3048
  return uploadFiles;
3047
3049
  };