@progress/kendo-react-buttons 14.5.0-develop.9 → 15.0.0-develop.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.
@@ -7,16 +7,18 @@
7
7
  */
8
8
  import * as p from "react";
9
9
  import s from "prop-types";
10
- import { Button as m } from "../Button.mjs";
11
- import { Keys as a, dispatchEvent as l, getActiveElement as c, validatePackage as k, getLicenseMessage as b, svgIconPropType as y, classNames as d, kendoThemeMaps as f, WatermarkOverlay as D } from "@progress/kendo-react-common";
12
- import { ButtonItem as I } from "./ButtonItem.mjs";
13
- import { SplitButtonItem as w } from "./SplitButtonItem.mjs";
14
- import { navigate as v } from "./utils/navigation.mjs";
15
- import { Popup as O } from "@progress/kendo-react-popup";
16
- import { getPopupAlign as S, getAnchorAlign as E } from "./utils/popup.mjs";
17
- import { packageMetadata as g } from "../package-metadata.mjs";
18
- import { chevronDownIcon as P } from "@progress/kendo-svg-icons";
19
- const u = class u extends p.Component {
10
+ import { Button as g } from "../Button.mjs";
11
+ import { Keys as a, dispatchEvent as h, getActiveElement as m, validatePackage as D, getLicenseMessage as w, svgIconPropType as I, classNames as l, kendoThemeMaps as C, WatermarkOverlay as v } from "@progress/kendo-react-common";
12
+ import { ButtonItem as S } from "./ButtonItem.mjs";
13
+ import { SplitButtonItem as O } from "./SplitButtonItem.mjs";
14
+ import { navigate as E } from "./utils/navigation.mjs";
15
+ import { Popup as F } from "@progress/kendo-react-popup";
16
+ import { provideLocalizationService as P, registerForLocalization as x } from "@progress/kendo-react-intl";
17
+ import { getPopupAlign as M, getAnchorAlign as z } from "./utils/popup.mjs";
18
+ import { packageMetadata as k } from "../package-metadata.mjs";
19
+ import { splitButtonToggleDropdown as b, messages as B } from "../messages/index.mjs";
20
+ import { chevronDownIcon as A } from "@progress/kendo-svg-icons";
21
+ const d = class d extends p.Component {
20
22
  constructor(i) {
21
23
  super(i), this.state = {
22
24
  focused: !1,
@@ -42,16 +44,16 @@ const u = class u extends p.Component {
42
44
  return;
43
45
  }
44
46
  if (this.opened) {
45
- const n = v(e, t.keyCode, t.altKey, this.buttonsData.length);
47
+ const n = E(e, t.keyCode, t.altKey, this.buttonsData.length);
46
48
  n !== e && (o = o || {}, o.focusedIndex = n);
47
- const h = t.keyCode === a.up || t.keyCode === a.down || t.keyCode === a.left || t.keyCode === a.right;
48
- !t.altKey && (h || t.keyCode === a.home || t.keyCode === a.end) && t.preventDefault();
49
+ const u = t.keyCode === a.up || t.keyCode === a.down || t.keyCode === a.left || t.keyCode === a.right;
50
+ !t.altKey && (u || t.keyCode === a.home || t.keyCode === a.end) && t.preventDefault();
49
51
  }
50
52
  o && this.setState(o);
51
53
  }, this.switchFocus = (t) => {
52
54
  this.skipFocus = !0, t(), window.setTimeout(() => this.skipFocus = !1, 0);
53
55
  }, this.onFocus = (t) => {
54
- this.skipFocus || (l(this.props.onFocus, t, this, void 0), this.setState({ focused: !0 }));
56
+ this.skipFocus || (h(this.props.onFocus, t, this, void 0), this.setState({ focused: !0 }));
55
57
  }, this.setOpen = (t, e) => {
56
58
  this.opened !== t && (this.openedDuringOnChange = t, this.setState({ opened: t }), e ? this.dispatchPopupEvent(e, t) : this.openedDuringOnChange = void 0);
57
59
  }, this.onItemClick = (t, e) => {
@@ -60,12 +62,12 @@ const u = class u extends p.Component {
60
62
  this.skipFocus || (this.setState({
61
63
  focused: !1,
62
64
  focusedIndex: -1
63
- }), l(this.props.onBlur, t, this, void 0), setTimeout(() => {
65
+ }), h(this.props.onBlur, t, this, void 0), setTimeout(() => {
64
66
  this.setOpen(!1, t);
65
67
  }, 0));
66
68
  }, this.onPopupClose = (t) => {
67
69
  var o;
68
- const e = c(document);
70
+ const e = m(document);
69
71
  this.element && this.element.removeAttribute("tabindex"), (e === this.list || (o = this.list) != null && o.contains(e)) && this.switchFocus(() => {
70
72
  this.element && this.element.focus({ preventScroll: !0 });
71
73
  }), this.props.popupSettings && this.props.popupSettings.onClose && this.props.popupSettings.onClose.call(void 0, t);
@@ -83,13 +85,13 @@ const u = class u extends p.Component {
83
85
  }
84
86
  }, this.onDownSplitPart = (t) => {
85
87
  t.preventDefault();
86
- const e = c(document);
88
+ const e = m(document);
87
89
  this.element && e !== this.element && e !== this.list && this.element.focus();
88
90
  }, this.onItemDown = (t) => {
89
- c(document) === this.list && t.preventDefault();
91
+ m(document) === this.list && t.preventDefault();
90
92
  }, this.dispatchPopupEvent = (t, e) => {
91
- l(e ? this.props.onOpen : this.props.onClose, t, this, void 0), this.openedDuringOnChange = void 0;
92
- }, this.showLicenseWatermark = !k(g, { component: "SplitButton" }), this.licenseMessage = b(g);
93
+ h(e ? this.props.onOpen : this.props.onClose, t, this, void 0), this.openedDuringOnChange = void 0;
94
+ }, this.showLicenseWatermark = !D(k, { component: "SplitButton" }), this.licenseMessage = w(k);
93
95
  }
94
96
  get guid() {
95
97
  return this.props.id ? this.props.id + "-accessibility-id" : this.props.id;
@@ -101,20 +103,23 @@ const u = class u extends p.Component {
101
103
  * @hidden
102
104
  */
103
105
  render() {
104
- this.buttonsData = this.props.items || p.Children.toArray(this.props.children).filter((r) => r && r.type === w).map((r) => r.props);
105
- const i = this.isRtl(), t = i ? "rtl" : void 0, { id: e, style: o, tabIndex: n, disabled: h } = this.props;
106
+ this.buttonsData = this.props.items || p.Children.toArray(this.props.children).filter((r) => r && r.type === O).map((r) => r.props);
107
+ const i = this.isRtl(), t = i ? "rtl" : void 0, o = P(this).toLanguageString(
108
+ b,
109
+ B[b]
110
+ ), { id: n, style: u, tabIndex: y, disabled: c } = this.props;
106
111
  return /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement(
107
112
  "div",
108
113
  {
109
- id: e,
110
- style: o,
111
- className: d(
114
+ id: n,
115
+ style: u,
116
+ className: l(
112
117
  "k-split-button",
113
118
  "k-button-group",
114
119
  {
115
120
  "k-focus": this.state.focused
116
121
  },
117
- this.props.rounded && `k-rounded-${f.roundedMap[this.props.rounded]}`,
122
+ this.props.rounded && `k-rounded-${C.roundedMap[this.props.rounded]}`,
118
123
  this.props.className
119
124
  ),
120
125
  onKeyDown: this.onKeyDown,
@@ -126,7 +131,7 @@ const u = class u extends p.Component {
126
131
  }
127
132
  },
128
133
  /* @__PURE__ */ p.createElement(
129
- m,
134
+ g,
130
135
  {
131
136
  ref: (r) => {
132
137
  this.mainButton = r && r.element;
@@ -137,8 +142,8 @@ const u = class u extends p.Component {
137
142
  fillMode: this.props.fillMode,
138
143
  themeColor: this.props.themeColor,
139
144
  onClick: (r) => this.onItemClick(r, -1),
140
- disabled: h || void 0,
141
- tabIndex: n,
145
+ disabled: c || void 0,
146
+ tabIndex: y,
142
147
  accessKey: this.props.accessKey,
143
148
  className: this.props.buttonClass,
144
149
  icon: this.props.icon,
@@ -148,18 +153,15 @@ const u = class u extends p.Component {
148
153
  endIcon: this.props.endIcon,
149
154
  imageUrl: this.props.imageUrl,
150
155
  dir: t,
151
- "aria-disabled": h,
152
- "aria-haspopup": !0,
153
- "aria-expanded": this.opened || void 0,
156
+ "aria-disabled": c,
154
157
  "aria-label": this.props.ariaLabel,
155
- "aria-controls": this.opened ? this.guid : void 0,
156
158
  id: "button-" + this.guid,
157
159
  title: this.props.title
158
160
  },
159
161
  this.props.text
160
162
  ),
161
163
  /* @__PURE__ */ p.createElement(
162
- m,
164
+ g,
163
165
  {
164
166
  type: "button",
165
167
  size: this.props.size,
@@ -167,19 +169,21 @@ const u = class u extends p.Component {
167
169
  fillMode: this.props.fillMode,
168
170
  themeColor: this.props.themeColor,
169
171
  icon: "chevron-down",
170
- svgIcon: P,
172
+ svgIcon: A,
171
173
  className: "k-split-button-arrow",
172
- disabled: h || void 0,
174
+ disabled: c || void 0,
173
175
  tabIndex: -1,
174
176
  onClick: this.onSplitPartClick,
175
177
  onMouseDown: this.onDownSplitPart,
176
178
  onPointerDown: this.onDownSplitPart,
177
179
  dir: t,
178
- "aria-label": "menu toggling button"
180
+ "aria-label": o,
181
+ "aria-expanded": this.opened ? "true" : "false",
182
+ "aria-controls": this.opened ? this.guid : void 0
179
183
  }
180
184
  ),
181
185
  this.renderPopup(i)
182
- ), this.showLicenseWatermark && /* @__PURE__ */ p.createElement(D, { message: this.licenseMessage }));
186
+ ), this.showLicenseWatermark && /* @__PURE__ */ p.createElement(v, { message: this.licenseMessage }));
183
187
  }
184
188
  /**
185
189
  * @hidden
@@ -194,7 +198,7 @@ const u = class u extends p.Component {
194
198
  return this.mainButton;
195
199
  }
196
200
  dispatchClickEvent(i, t) {
197
- this.isItemDisabled(t) || (t === -1 ? l(this.props.onButtonClick, i, this, void 0) : l(this.props.onItemClick, i, this, {
201
+ this.isItemDisabled(t) || (t === -1 ? h(this.props.onButtonClick, i, this, void 0) : h(this.props.onItemClick, i, this, {
198
202
  item: this.buttonsData[t],
199
203
  itemIndex: t
200
204
  }));
@@ -202,14 +206,14 @@ const u = class u extends p.Component {
202
206
  renderPopup(i) {
203
207
  const { popupSettings: t = {} } = this.props, { focusedIndex: e } = this.state;
204
208
  return /* @__PURE__ */ p.createElement(
205
- O,
209
+ F,
206
210
  {
207
211
  anchor: this.wrapper,
208
212
  show: this.opened,
209
213
  animate: t.animate,
210
- popupClass: d("k-menu-popup", t.popupClass),
211
- anchorAlign: t.anchorAlign || E(i),
212
- popupAlign: t.popupAlign || S(i),
214
+ popupClass: l("k-menu-popup", t.popupClass),
215
+ anchorAlign: t.anchorAlign || z(i),
216
+ popupAlign: t.popupAlign || M(i),
213
217
  style: i ? { direction: "rtl" } : void 0,
214
218
  onClose: this.onPopupClose
215
219
  },
@@ -218,12 +222,11 @@ const u = class u extends p.Component {
218
222
  {
219
223
  role: "menu",
220
224
  id: this.guid,
221
- "aria-labelledby": "button-" + this.guid,
222
225
  tabIndex: -1,
223
226
  ref: this.listRef,
224
227
  "aria-activedescendant": e >= 0 ? `${this.guid}-${e}` : void 0,
225
- className: d("k-menu-group", {
226
- [`k-menu-group-${f.sizeMap[this.props.size] || this.props.size}`]: this.props.size
228
+ className: l("k-menu-group", {
229
+ [`k-menu-group-${C.sizeMap[this.props.size] || this.props.size}`]: this.props.size
227
230
  })
228
231
  },
229
232
  this.renderChildItems()
@@ -233,9 +236,9 @@ const u = class u extends p.Component {
233
236
  renderChildItems() {
234
237
  const { item: i, itemRender: t, textField: e } = this.props;
235
238
  return this.buttonsData.length > 0 ? this.buttonsData.map((o, n) => /* @__PURE__ */ p.createElement(
236
- I,
239
+ S,
237
240
  {
238
- className: d(
241
+ className: l(
239
242
  "k-menu-item",
240
243
  { "k-first": n === 0 },
241
244
  { "k-last": n === this.buttonsData.length - 1 }
@@ -260,7 +263,7 @@ const u = class u extends p.Component {
260
263
  return this.props.dir !== void 0 ? this.props.dir === "rtl" : !!this.wrapper && getComputedStyle(this.wrapper).direction === "rtl";
261
264
  }
262
265
  };
263
- u.propTypes = {
266
+ d.propTypes = {
264
267
  accessKey: s.string,
265
268
  ariaLabel: s.string,
266
269
  title: s.string,
@@ -276,7 +279,7 @@ u.propTypes = {
276
279
  tabIndex: s.number,
277
280
  disabled: s.bool,
278
281
  icon: s.string,
279
- svgIcon: y,
282
+ svgIcon: I,
280
283
  imageUrl: s.string,
281
284
  popupSettings: s.object,
282
285
  itemRender: s.any,
@@ -298,13 +301,14 @@ u.propTypes = {
298
301
  "error",
299
302
  "inverse"
300
303
  ])
301
- }, u.defaultProps = {
304
+ }, d.defaultProps = {
302
305
  size: void 0,
303
306
  rounded: void 0,
304
307
  fillMode: void 0,
305
308
  themeColor: void 0
306
309
  };
307
- let C = u;
310
+ let f = d;
311
+ x(f);
308
312
  export {
309
- C as SplitButton
313
+ f as SplitButton
310
314
  };
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![KendoReact NPM Banner](https://raw.githubusercontent.com/telerik/kendo-react/master/images/kendoreact-github-banner.png)](https://www.telerik.com/kendo-react-ui/components/free?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-buttons&utm_content=banner)
1
+ [![KendoReact NPM Banner](https://raw.githubusercontent.com/telerik/kendo-react/master/images/kendoreact-github-banner.png)](https://www.telerik.com/kendo-react-ui/components/getting-started/free-vs-premium?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-buttons&utm_content=banner)
2
2
 
3
3
  # KendoReact Buttons Library for React
4
4
 
@@ -6,7 +6,7 @@
6
6
  >
7
7
  > - This package is а part of [KendoReact](https://www.telerik.com/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-buttons)—an enterprise-grade UI library with 120+ free and premium components.
8
8
  > - It contains both free and premium KendoReact components and tools. To use the premium components, you must install a license key file, whether you are on a paid license or a 30-day free trial. To receive a license key, either [purchase a license](https://www.telerik.com/kendo-react-ui/pricing) or start a [free trial](https://www.telerik.com/download-login-v2-kendo-react-ui). You can use the free components without having to sign up or get a license key.
9
- > - If you're looking for free React components, check out [Get Started with KendoReact Free](https://www.telerik.com/kendo-react-ui/components/free).
9
+ > - If you're looking for free React components, check out [Get Started with KendoReact Free](https://www.telerik.com/kendo-react-ui/components/getting-started).
10
10
  > - If you have an active license, visit the [KendoReact My License page](https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-buttons) to learn how to configure your KendoReact licensing.
11
11
  > - Installing and working with this package indicates that you [accept the KendoReact License Agreement](https://www.telerik.com/purchase/license-agreement/progress-kendoreact?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-buttons).
12
12
  > - The 30-day free trial gives you access to all KendoReact components and their full functionality. Additionally, for the period of your trial, you can use our legendary technical support provided directly by the KendoReact dev team!
@@ -279,7 +279,7 @@ import { Toolbar, Button, ButtonGroup } from '@progress/kendo-react-buttons'; //
279
279
 
280
280
  The following table outlines the key resources available with KendoReact and KendoReact Free.
281
281
 
282
- | | [KendoReact Free](https://www.telerik.com/kendo-react-ui/components/free) | [KendoReact](https://www.telerik.com/kendo-react-ui) |
282
+ | | [KendoReact Free](https://www.telerik.com/kendo-react-ui/components/getting-started/free-vs-premium) | [KendoReact](https://www.telerik.com/kendo-react-ui) |
283
283
  | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
284
284
  | React components | 50+ | 120+ |
285
285
  | Four professional themes | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" stroke="white" stroke-width="2"/></svg> |
@@ -302,7 +302,7 @@ For any issues you might encounter while working with the KendoReact Buttons, us
302
302
  ## Resources
303
303
 
304
304
  - [Getting Started with KendoReact](https://www.telerik.com/kendo-react-ui/components/getting-started/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-buttons)
305
- - [Get Started with KendoReact Free](https://www.telerik.com/kendo-react-ui/components/free)
305
+ - [Get Started with KendoReact Free](https://www.telerik.com/kendo-react-ui/components/getting-started)
306
306
  - [Getting Started with the KendoReact Buttons](https://www.telerik.com/kendo-react-ui/components/buttons/get-started/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-buttons)
307
307
  - [API Reference of the KendoReact Buttons](https://www.telerik.com/kendo-react-ui/components/buttons/api/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-buttons)
308
308
  - [KendoReact Roadmap](https://www.telerik.com/support/whats-new/kendo-react-ui/roadmap?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-buttons)
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=require("react"),te=require("@progress/kendo-webspeech-common"),ne=require("../Button.js"),g=require("@progress/kendo-react-common"),A=require("@progress/kendo-svg-icons"),a=require("../messages/index.js"),se=require("@progress/kendo-react-intl"),q=require("../package-metadata.js");function oe(n){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const o in n)if(o!=="default"){const u=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(i,o,u.get?u:{enumerable:!0,get:()=>n[o]})}}return i.default=n,Object.freeze(i)}const e=oe(ee),O=e.forwardRef((n,i)=>{const o=!g.validatePackage(q.packageMetadata,{component:"SpeechToTextButton"}),u=g.getLicenseMessage(q.packageMetadata),k=se.useLocalization(),{fillMode:z,rounded:B,size:E,themeColor:L,ariaLabel:p,svgIcon:v,disabled:j,iconSize:H,title:m,className:N,id:P,style:F,lang:T="en-US",continuous:R=!1,interimResults:w=!1,maxAlternatives:C=1,integrationMode:W="webSpeech",onStart:h,onResult:d,onEnd:b,onError:r,..._}=n,c=e.useRef(null),s=e.useRef(!1),[l,f]=e.useState(!1),D=e.useCallback(async()=>{s.current=!0,f(!0),h&&await h()},[h]),K=e.useCallback(async()=>{s.current=!1,f(!1),b&&await b()},[b]),U=e.useCallback(t=>{const M=t.results,x=M[M.length-1],$=Array.from(x).map(I=>({transcript:I.transcript,confidence:I.confidence}));d==null||d({isFinal:x.isFinal,alternatives:$})},[d]),G=e.useCallback(t=>{f(!1),s.current=!1,r==null||r({errorMessage:t.error})},[r]),J=()=>{var t;if(typeof window!="undefined"&&!("webkitSpeechRecognition"in window||"SpeechRecognition"in window)){r&&r({errorMessage:"Speech Recognition API is not supported in this browser."});return}(t=c.current)!=null&&t.isActive()&&c.current.stop(),c.current=new te.KendoSpeechRecognition({lang:T,continuous:R,interimResults:w,maxAlternatives:C,events:{start:D,end:K,result:U,error:G}})},y=e.useCallback(()=>{var t;s.current||(t=c.current)==null||t.start()},[]),S=e.useCallback(()=>{var t;s.current&&((t=c.current)==null||t.stop())},[]),Q=e.useCallback(()=>{var t;s.current&&((t=c.current)==null||t.abort(),s.current=!1,f(!1))},[]),V=()=>s.current;e.useImperativeHandle(i,()=>({start:y,stop:S,abort:Q,isActive:V})),e.useEffect(()=>(J(),()=>{s.current&&S()}),[T,R,w,C,W]);const X=()=>{l?S():y()},Y=n.icon!==void 0||n.iconClass!==void 0,Z=e.useMemo(()=>l?A.stopIcon:v||A.microphoneIcon,[l,v]);return e.createElement(e.Fragment,null,e.createElement(ne.Button,{id:P,className:g.classNames({"k-speech-to-text-button":!0,"k-listening":l},N),style:F,svgIcon:Y?void 0:Z,iconSize:H,fillMode:z,rounded:B,size:E,themeColor:L,"aria-label":p!=null?p:k.toLanguageString(a.speechToTextAriaLabel,a.messages[a.speechToTextAriaLabel]),"aria-pressed":l,disabled:j,title:m!=null?m:k.toLanguageString(a.speechToTextTitle,a.messages[a.speechToTextTitle]),onClick:X,..._},n.children),o&&e.createElement(g.WatermarkOverlay,{message:u}))});O.displayName="KendoSpeechToTextButton";exports.SpeechToTextButton=O;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=require("react"),te=require("@progress/kendo-webspeech-common"),ne=require("../Button.js"),g=require("@progress/kendo-react-common"),A=require("@progress/kendo-svg-icons"),a=require("../messages/index.js"),se=require("@progress/kendo-react-intl"),q=require("../package-metadata.js");function oe(n){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const o in n)if(o!=="default"){const u=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(i,o,u.get?u:{enumerable:!0,get:()=>n[o]})}}return i.default=n,Object.freeze(i)}const e=oe(ee),O=e.forwardRef((n,i)=>{const o=!g.validatePackage(q.packageMetadata,{component:"SpeechToTextButton"}),u=g.getLicenseMessage(q.packageMetadata),k=se.useLocalization(),{fillMode:z,rounded:B,size:E,themeColor:L,ariaLabel:p,svgIcon:v,disabled:j,iconSize:H,title:m,className:N,id:P,style:F,lang:T="en-US",continuous:R=!1,interimResults:w=!1,maxAlternatives:C=1,integrationMode:W="webSpeech",onStart:h,onResult:d,onEnd:b,onError:r,..._}=n,c=e.useRef(null),s=e.useRef(!1),[l,f]=e.useState(!1),D=e.useCallback(async()=>{s.current=!0,f(!0),h&&await h()},[h]),K=e.useCallback(async()=>{s.current=!1,f(!1),b&&await b()},[b]),U=e.useCallback(t=>{const M=t.results,x=M[M.length-1],$=Array.from(x).map(I=>({transcript:I.transcript,confidence:I.confidence}));d==null||d({isFinal:x.isFinal,alternatives:$})},[d]),G=e.useCallback(t=>{f(!1),s.current=!1,r==null||r({errorMessage:t.error})},[r]),J=()=>{var t;if(typeof window!="undefined"&&!("webkitSpeechRecognition"in window||"SpeechRecognition"in window)){r&&r({errorMessage:"Speech Recognition API is not supported in this browser."});return}(t=c.current)!=null&&t.isActive()&&c.current.stop(),c.current=new te.KendoSpeechRecognition({lang:T,continuous:R,interimResults:w,maxAlternatives:C,events:{start:D,end:K,result:U,error:G}})},y=e.useCallback(()=>{var t;s.current||(t=c.current)==null||t.start()},[]),S=e.useCallback(()=>{var t;s.current&&((t=c.current)==null||t.stop())},[]),Q=e.useCallback(()=>{var t;s.current&&((t=c.current)==null||t.abort(),s.current=!1,f(!1))},[]),V=()=>s.current;e.useImperativeHandle(i,()=>({start:y,stop:S,abort:Q,isActive:V})),e.useEffect(()=>(J(),()=>{s.current&&S()}),[T,R,w,C,W]);const X=()=>{l?S():y()},Y=n.icon!==void 0||n.iconClass!==void 0,Z=e.useMemo(()=>l?A.stopIcon:v||A.microphoneIcon,[l,v]);return e.createElement(e.Fragment,null,e.createElement(ne.Button,{id:P,className:g.classNames({"k-speech-to-text-button":!0,"k-listening":l},N),style:F,svgIcon:Y?void 0:Z,iconSize:H,fillMode:z,rounded:B,size:E,themeColor:L,"aria-label":p!=null?p:k.toLanguageString(a.speechToTextAriaLabel,a.messages[a.speechToTextAriaLabel]),"aria-pressed":l||void 0,disabled:j,title:m!=null?m:k.toLanguageString(a.speechToTextTitle,a.messages[a.speechToTextTitle]),onClick:X,..._},n.children),o&&e.createElement(g.WatermarkOverlay,{message:u}))});O.displayName="KendoSpeechToTextButton";exports.SpeechToTextButton=O;
@@ -8,8 +8,8 @@
8
8
  import * as e from "react";
9
9
  import { KendoSpeechRecognition as $ } from "@progress/kendo-webspeech-common";
10
10
  import { Button as ee } from "../Button.mjs";
11
- import { validatePackage as te, getLicenseMessage as ne, classNames as re, WatermarkOverlay as se } from "@progress/kendo-react-common";
12
- import { stopIcon as oe, microphoneIcon as ae } from "@progress/kendo-svg-icons";
11
+ import { validatePackage as te, getLicenseMessage as ne, classNames as re, WatermarkOverlay as oe } from "@progress/kendo-react-common";
12
+ import { stopIcon as se, microphoneIcon as ae } from "@progress/kendo-svg-icons";
13
13
  import { speechToTextTitle as T, messages as x, speechToTextAriaLabel as A } from "../messages/index.mjs";
14
14
  import { useLocalization as ce } from "@progress/kendo-react-intl";
15
15
  import { packageMetadata as I } from "../package-metadata.mjs";
@@ -34,14 +34,14 @@ const ie = e.forwardRef((a, M) => {
34
34
  integrationMode: W = "webSpeech",
35
35
  onStart: f,
36
36
  onResult: c,
37
- onEnd: m,
37
+ onEnd: d,
38
38
  onError: r,
39
39
  ...U
40
- } = a, s = e.useRef(null), n = e.useRef(!1), [o, i] = e.useState(!1), j = e.useCallback(async () => {
40
+ } = a, o = e.useRef(null), n = e.useRef(!1), [s, i] = e.useState(!1), j = e.useCallback(async () => {
41
41
  n.current = !0, i(!0), f && await f();
42
42
  }, [f]), q = e.useCallback(async () => {
43
- n.current = !1, i(!1), m && await m();
44
- }, [m]), D = e.useCallback(
43
+ n.current = !1, i(!1), d && await d();
44
+ }, [d]), D = e.useCallback(
45
45
  (t) => {
46
46
  const w = t.results, R = w[w.length - 1], _ = Array.from(R).map((C) => ({
47
47
  transcript: C.transcript,
@@ -66,7 +66,7 @@ const ie = e.forwardRef((a, M) => {
66
66
  r && r({ errorMessage: "Speech Recognition API is not supported in this browser." });
67
67
  return;
68
68
  }
69
- (t = s.current) != null && t.isActive() && s.current.stop(), s.current = new $({
69
+ (t = o.current) != null && t.isActive() && o.current.stop(), o.current = new $({
70
70
  lang: h,
71
71
  continuous: v,
72
72
  interimResults: S,
@@ -80,25 +80,25 @@ const ie = e.forwardRef((a, M) => {
80
80
  });
81
81
  }, b = e.useCallback(() => {
82
82
  var t;
83
- n.current || (t = s.current) == null || t.start();
84
- }, []), d = e.useCallback(() => {
83
+ n.current || (t = o.current) == null || t.start();
84
+ }, []), m = e.useCallback(() => {
85
85
  var t;
86
- n.current && ((t = s.current) == null || t.stop());
86
+ n.current && ((t = o.current) == null || t.stop());
87
87
  }, []), Q = e.useCallback(() => {
88
88
  var t;
89
- n.current && ((t = s.current) == null || t.abort(), n.current = !1, i(!1));
89
+ n.current && ((t = o.current) == null || t.abort(), n.current = !1, i(!1));
90
90
  }, []), V = () => n.current;
91
91
  e.useImperativeHandle(M, () => ({
92
92
  start: b,
93
- stop: d,
93
+ stop: m,
94
94
  abort: Q,
95
95
  isActive: V
96
96
  })), e.useEffect(() => (J(), () => {
97
- n.current && d();
97
+ n.current && m();
98
98
  }), [h, v, S, k, W]);
99
99
  const X = () => {
100
- o ? d() : b();
101
- }, Y = a.icon !== void 0 || a.iconClass !== void 0, Z = e.useMemo(() => o ? oe : g || ae, [o, g]);
100
+ s ? m() : b();
101
+ }, Y = a.icon !== void 0 || a.iconClass !== void 0, Z = e.useMemo(() => s ? se : g || ae, [s, g]);
102
102
  return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
103
103
  ee,
104
104
  {
@@ -106,7 +106,7 @@ const ie = e.forwardRef((a, M) => {
106
106
  className: re(
107
107
  {
108
108
  "k-speech-to-text-button": !0,
109
- "k-listening": o
109
+ "k-listening": s
110
110
  },
111
111
  K
112
112
  ),
@@ -118,14 +118,14 @@ const ie = e.forwardRef((a, M) => {
118
118
  size: L,
119
119
  themeColor: B,
120
120
  "aria-label": l != null ? l : p.toLanguageString(A, x[A]),
121
- "aria-pressed": o,
121
+ "aria-pressed": s || void 0,
122
122
  disabled: N,
123
123
  title: u != null ? u : p.toLanguageString(T, x[T]),
124
124
  onClick: X,
125
125
  ...U
126
126
  },
127
127
  a.children
128
- ), y && /* @__PURE__ */ e.createElement(se, { message: E }));
128
+ ), y && /* @__PURE__ */ e.createElement(oe, { message: E }));
129
129
  });
130
130
  ie.displayName = "KendoSpeechToTextButton";
131
131
  export {