@progress/kendo-react-buttons 14.5.0-develop.14 → 14.5.0-develop.16
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.
- package/Chip/Chip.d.ts +6 -0
- package/Chip/Chip.js +1 -1
- package/Chip/Chip.mjs +67 -63
- package/Chip/ChipList.js +1 -1
- package/Chip/ChipList.mjs +1 -1
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +129 -130
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +44 -44
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +57 -53
- package/SpeechToTextButton/SpeechToTextButton.js +1 -1
- package/SpeechToTextButton/SpeechToTextButton.mjs +18 -18
- package/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/messages/index.d.ts +5 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +8 -6
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +5 -5
- package/toolbar/tools/ToolbarScrollButton.js +1 -1
- package/toolbar/tools/ToolbarScrollButton.mjs +14 -16
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react"),i=require("prop-types"),f=require("../Button.js"),s=require("@progress/kendo-react-common"),D=require("./ButtonItem.js"),I=require("./SplitButtonItem.js"),w=require("./utils/navigation.js"),v=require("@progress/kendo-react-popup"),y=require("@progress/kendo-react-intl"),g=require("./utils/popup.js"),k=require("../package-metadata.js"),m=require("../messages/index.js"),S=require("@progress/kendo-svg-icons");function O(l){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const e in l)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(l,e);Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:()=>l[e]})}}return o.default=l,Object.freeze(o)}const p=O(b),d=class d extends p.Component{constructor(o){super(o),this.state={focused:!1,focusedIndex:-1,opened:!1},this.wrapper=null,this.mainButton=null,this.list=null,this.skipFocus=!1,this.buttonsData=[],this.showLicenseWatermark=!1,this.onKeyDown=e=>{const{focusedIndex:t}=this.state;if(e.altKey){!this.opened&&e.keyCode===s.Keys.down?(e.preventDefault(),this.setState({focusedIndex:0}),this.setOpen(!0,e)):this.opened&&e.keyCode===s.Keys.up&&(e.preventDefault(),this.setState({focusedIndex:-1}),this.setOpen(!1,e));return}let n;if(e.keyCode===s.Keys.enter||e.keyCode===s.Keys.space){if(e.preventDefault(),this.dispatchClickEvent(e,t),t>=0){n={focusedIndex:this.opened?-1:0};const r=!this.opened;this.setOpen(r,e)}}else if(this.opened&&e.keyCode===s.Keys.esc){this.setState({focusedIndex:-1}),this.setOpen(!1,e);return}if(this.opened){const r=w.navigate(t,e.keyCode,e.altKey,this.buttonsData.length);r!==t&&(n=n||{},n.focusedIndex=r);const c=e.keyCode===s.Keys.up||e.keyCode===s.Keys.down||e.keyCode===s.Keys.left||e.keyCode===s.Keys.right;!e.altKey&&(c||e.keyCode===s.Keys.home||e.keyCode===s.Keys.end)&&e.preventDefault()}n&&this.setState(n)},this.switchFocus=e=>{this.skipFocus=!0,e(),window.setTimeout(()=>this.skipFocus=!1,0)},this.onFocus=e=>{this.skipFocus||(s.dispatchEvent(this.props.onFocus,e,this,void 0),this.setState({focused:!0}))},this.setOpen=(e,t)=>{this.opened!==e&&(this.openedDuringOnChange=e,this.setState({opened:e}),t?this.dispatchPopupEvent(t,e):this.openedDuringOnChange=void 0)},this.onItemClick=(e,t)=>{this.opened&&this.setState({focusedIndex:0}),this.dispatchClickEvent(e,t),this.setOpen(!1,e)},this.onBlur=e=>{this.skipFocus||(this.setState({focused:!1,focusedIndex:-1}),s.dispatchEvent(this.props.onBlur,e,this,void 0),setTimeout(()=>{this.setOpen(!1,e)},0))},this.onPopupClose=e=>{var n;const t=s.getActiveElement(document);this.element&&this.element.removeAttribute("tabindex"),(t===this.list||(n=this.list)!=null&&n.contains(t))&&this.switchFocus(()=>{this.element&&this.element.focus({preventScroll:!0})}),this.props.popupSettings&&this.props.popupSettings.onClose&&this.props.popupSettings.onClose.call(void 0,e)},this.listRef=e=>{this.list=e,e&&this.state.focused&&this.switchFocus(()=>{e.focus({preventScroll:!0}),this.element&&(this.element.tabIndex=-1)})},this.onSplitPartClick=e=>{if(this.buttonsData.length){const t=!this.opened;this.setState({focusedIndex:t?0:-1,focused:!0}),this.setOpen(t,e)}},this.onDownSplitPart=e=>{e.preventDefault();const t=s.getActiveElement(document);this.element&&t!==this.element&&t!==this.list&&this.element.focus()},this.onItemDown=e=>{s.getActiveElement(document)===this.list&&e.preventDefault()},this.dispatchPopupEvent=(e,t)=>{s.dispatchEvent(t?this.props.onOpen:this.props.onClose,e,this,void 0),this.openedDuringOnChange=void 0},this.showLicenseWatermark=!s.validatePackage(k.packageMetadata,{component:"SplitButton"}),this.licenseMessage=s.getLicenseMessage(k.packageMetadata)}get guid(){return this.props.id?this.props.id+"-accessibility-id":this.props.id}get opened(){return this.openedDuringOnChange!==void 0?this.openedDuringOnChange:this.props.opened===void 0?this.state.opened:this.props.opened}render(){this.buttonsData=this.props.items||p.Children.toArray(this.props.children).filter(a=>a&&a.type===I.SplitButtonItem).map(a=>a.props);const o=this.isRtl(),e=o?"rtl":void 0,n=y.provideLocalizationService(this).toLanguageString(m.splitButtonToggleDropdown,m.messages[m.splitButtonToggleDropdown]),{id:r,style:c,tabIndex:C,disabled:u}=this.props;return p.createElement(p.Fragment,null,p.createElement("div",{id:r,style:c,className:s.classNames("k-split-button","k-button-group",{"k-focus":this.state.focused},this.props.rounded&&`k-rounded-${s.kendoThemeMaps.roundedMap[this.props.rounded]}`,this.props.className),onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,dir:e,ref:a=>{this.wrapper=a}},p.createElement(f.Button,{ref:a=>{this.mainButton=a&&a.element},type:"button",size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,themeColor:this.props.themeColor,onClick:a=>this.onItemClick(a,-1),disabled:u||void 0,tabIndex:C,accessKey:this.props.accessKey,className:this.props.buttonClass,icon:this.props.icon,svgIcon:this.props.svgIcon,iconClass:this.props.iconClass,startIcon:this.props.startIcon,endIcon:this.props.endIcon,imageUrl:this.props.imageUrl,dir:e,"aria-disabled":u,"aria-label":this.props.ariaLabel,id:"button-"+this.guid,title:this.props.title},this.props.text),p.createElement(f.Button,{type:"button",size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,themeColor:this.props.themeColor,icon:"chevron-down",svgIcon:S.chevronDownIcon,className:"k-split-button-arrow",disabled:u||void 0,tabIndex:-1,onClick:this.onSplitPartClick,onMouseDown:this.onDownSplitPart,onPointerDown:this.onDownSplitPart,dir:e,"aria-label":n,"aria-expanded":this.opened?"true":"false","aria-controls":this.opened?this.guid:void 0}),this.renderPopup(o)),this.showLicenseWatermark&&p.createElement(s.WatermarkOverlay,{message:this.licenseMessage}))}componentDidMount(){(this.props.dir===void 0&&this.isRtl()||this.opened)&&this.forceUpdate()}get element(){return this.mainButton}dispatchClickEvent(o,e){this.isItemDisabled(e)||(e===-1?s.dispatchEvent(this.props.onButtonClick,o,this,void 0):s.dispatchEvent(this.props.onItemClick,o,this,{item:this.buttonsData[e],itemIndex:e}))}renderPopup(o){const{popupSettings:e={}}=this.props,{focusedIndex:t}=this.state;return p.createElement(v.Popup,{anchor:this.wrapper,show:this.opened,animate:e.animate,popupClass:s.classNames("k-menu-popup",e.popupClass),anchorAlign:e.anchorAlign||g.getAnchorAlign(o),popupAlign:e.popupAlign||g.getPopupAlign(o),style:o?{direction:"rtl"}:void 0,onClose:this.onPopupClose},p.createElement("ul",{role:"menu",id:this.guid,tabIndex:-1,ref:this.listRef,"aria-activedescendant":t>=0?`${this.guid}-${t}`:void 0,className:s.classNames("k-menu-group",{[`k-menu-group-${s.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size})},this.renderChildItems()))}renderChildItems(){const{item:o,itemRender:e,textField:t}=this.props;return this.buttonsData.length>0?this.buttonsData.map((n,r)=>p.createElement(D.ButtonItem,{className:s.classNames("k-menu-item",{"k-first":r===0},{"k-last":r===this.buttonsData.length-1}),dataItem:n,textField:t,focused:this.state.focusedIndex===r,onClick:this.onItemClick,onDown:this.onItemDown,render:e,item:o,key:r,index:r,id:`${this.guid}-${r}`})):null}isItemDisabled(o){return this.buttonsData[o]?this.buttonsData[o].disabled:this.props.disabled}isRtl(){return this.props.dir!==void 0?this.props.dir==="rtl":!!this.wrapper&&getComputedStyle(this.wrapper).direction==="rtl"}};d.propTypes={accessKey:i.string,ariaLabel:i.string,title:i.string,onButtonClick:i.func,onFocus:i.func,onBlur:i.func,onItemClick:i.func,onOpen:i.func,onClose:i.func,text:i.string,items:i.arrayOf(i.any),textField:i.string,tabIndex:i.number,disabled:i.bool,icon:i.string,svgIcon:s.svgIconPropType,imageUrl:i.string,popupSettings:i.object,itemRender:i.any,item:i.func,className:i.string,buttonClass:i.string,dir:i.string,size:i.oneOf(["small","medium","large"]),rounded:i.oneOf(["small","medium","large","full","none"]),fillMode:i.oneOf(["flat","link","outline","solid","clear"]),themeColor:i.oneOf(["base","primary","secondary","tertiary","info","success","warning","error","inverse"])},d.defaultProps={size:void 0,rounded:void 0,fillMode:void 0,themeColor:void 0};let h=d;y.registerForLocalization(h);exports.SplitButton=h;
|
|
@@ -7,16 +7,18 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as p from "react";
|
|
9
9
|
import s from "prop-types";
|
|
10
|
-
import { Button as
|
|
11
|
-
import { Keys as a, dispatchEvent as
|
|
12
|
-
import { ButtonItem as
|
|
13
|
-
import { SplitButtonItem as
|
|
14
|
-
import { navigate as
|
|
15
|
-
import { Popup as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
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 =
|
|
47
|
+
const n = E(e, t.keyCode, t.altKey, this.buttonsData.length);
|
|
46
48
|
n !== e && (o = o || {}, o.focusedIndex = n);
|
|
47
|
-
const
|
|
48
|
-
!t.altKey && (
|
|
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 || (
|
|
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
|
-
}),
|
|
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 =
|
|
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 =
|
|
88
|
+
const e = m(document);
|
|
87
89
|
this.element && e !== this.element && e !== this.list && this.element.focus();
|
|
88
90
|
}, this.onItemDown = (t) => {
|
|
89
|
-
|
|
91
|
+
m(document) === this.list && t.preventDefault();
|
|
90
92
|
}, this.dispatchPopupEvent = (t, e) => {
|
|
91
|
-
|
|
92
|
-
}, this.showLicenseWatermark = !k
|
|
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 ===
|
|
105
|
-
const i = this.isRtl(), t = i ? "rtl" : void 0,
|
|
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:
|
|
110
|
-
style:
|
|
111
|
-
className:
|
|
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-${
|
|
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
|
-
|
|
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:
|
|
141
|
-
tabIndex:
|
|
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":
|
|
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
|
-
|
|
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:
|
|
172
|
+
svgIcon: A,
|
|
171
173
|
className: "k-split-button-arrow",
|
|
172
|
-
disabled:
|
|
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":
|
|
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(
|
|
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 ?
|
|
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
|
-
|
|
209
|
+
F,
|
|
206
210
|
{
|
|
207
211
|
anchor: this.wrapper,
|
|
208
212
|
show: this.opened,
|
|
209
213
|
animate: t.animate,
|
|
210
|
-
popupClass:
|
|
211
|
-
anchorAlign: t.anchorAlign ||
|
|
212
|
-
popupAlign: t.popupAlign ||
|
|
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:
|
|
226
|
-
[`k-menu-group-${
|
|
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
|
-
|
|
239
|
+
S,
|
|
237
240
|
{
|
|
238
|
-
className:
|
|
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
|
-
|
|
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:
|
|
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
|
-
},
|
|
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
|
|
310
|
+
let f = d;
|
|
311
|
+
x(f);
|
|
308
312
|
export {
|
|
309
|
-
|
|
313
|
+
f as SplitButton
|
|
310
314
|
};
|
|
@@ -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
|
|
12
|
-
import { stopIcon as
|
|
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:
|
|
37
|
+
onEnd: d,
|
|
38
38
|
onError: r,
|
|
39
39
|
...U
|
|
40
|
-
} = a,
|
|
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),
|
|
44
|
-
}, [
|
|
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 =
|
|
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 =
|
|
84
|
-
}, []),
|
|
83
|
+
n.current || (t = o.current) == null || t.start();
|
|
84
|
+
}, []), m = e.useCallback(() => {
|
|
85
85
|
var t;
|
|
86
|
-
n.current && ((t =
|
|
86
|
+
n.current && ((t = o.current) == null || t.stop());
|
|
87
87
|
}, []), Q = e.useCallback(() => {
|
|
88
88
|
var t;
|
|
89
|
-
n.current && ((t =
|
|
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:
|
|
93
|
+
stop: m,
|
|
94
94
|
abort: Q,
|
|
95
95
|
isActive: V
|
|
96
96
|
})), e.useEffect(() => (J(), () => {
|
|
97
|
-
n.current &&
|
|
97
|
+
n.current && m();
|
|
98
98
|
}), [h, v, S, k, W]);
|
|
99
99
|
const X = () => {
|
|
100
|
-
|
|
101
|
-
}, Y = a.icon !== void 0 || a.iconClass !== void 0, Z = e.useMemo(() =>
|
|
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":
|
|
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":
|
|
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(
|
|
128
|
+
), y && /* @__PURE__ */ e.createElement(oe, { message: E }));
|
|
129
129
|
});
|
|
130
130
|
ie.displayName = "KendoSpeechToTextButton";
|
|
131
131
|
export {
|