@progress/kendo-react-buttons 14.5.0-develop.8 → 14.5.0-develop.9
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/Button.d.ts +2 -2
- package/Button.js +1 -1
- package/Button.mjs +31 -33
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +72 -82
- package/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +1 -7
- package/FloatingActionButton/models/size.d.ts +2 -1
- package/FloatingActionButton/models/theme-color.d.ts +2 -8
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +0 -2
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +2 -4
- package/ListButton/models/ListButtonProps.d.ts +2 -2
- package/SegmentedControl/SegmentedControl.js +1 -1
- package/SegmentedControl/SegmentedControl.mjs +28 -27
- package/SpeechToTextButton/SpeechToTextButton.js +1 -1
- package/SpeechToTextButton/SpeechToTextButton.mjs +10 -10
- package/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +11 -6
- package/toolbar/tools/ToolbarScrollButton.js +1 -1
- package/toolbar/tools/ToolbarScrollButton.mjs +9 -9
|
@@ -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 g=require("react"),i=require("prop-types"),c=require("../Button.js"),s=require("@progress/kendo-react-common"),y=require("./ButtonItem.js"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),i=require("prop-types"),c=require("../Button.js"),s=require("@progress/kendo-react-common"),y=require("./ButtonItem.js"),C=require("./SplitButtonItem.js"),k=require("./utils/navigation.js"),b=require("@progress/kendo-react-popup"),m=require("./utils/popup.js"),f=require("../package-metadata.js"),D=require("@progress/kendo-svg-icons");function I(h){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const e in h)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(h,e);Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:()=>h[e]})}}return o.default=h,Object.freeze(o)}const a=I(g),d=class d extends a.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=k.navigate(t,e.keyCode,e.altKey,this.buttonsData.length);r!==t&&(n=n||{},n.focusedIndex=r);const l=e.keyCode===s.Keys.up||e.keyCode===s.Keys.down||e.keyCode===s.Keys.left||e.keyCode===s.Keys.right;!e.altKey&&(l||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(f.packageMetadata,{component:"SplitButton"}),this.licenseMessage=s.getLicenseMessage(f.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||a.Children.toArray(this.props.children).filter(p=>p&&p.type===C.SplitButtonItem).map(p=>p.props);const o=this.isRtl(),e=o?"rtl":void 0,{id:t,style:n,tabIndex:r,disabled:l}=this.props;return a.createElement(a.Fragment,null,a.createElement("div",{id:t,style:n,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:p=>{this.wrapper=p}},a.createElement(c.Button,{ref:p=>{this.mainButton=p&&p.element},type:"button",size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,themeColor:this.props.themeColor,onClick:p=>this.onItemClick(p,-1),disabled:l||void 0,tabIndex:r,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":l,"aria-haspopup":!0,"aria-expanded":this.opened||void 0,"aria-label":this.props.ariaLabel,"aria-controls":this.opened?this.guid:void 0,id:"button-"+this.guid,title:this.props.title},this.props.text),a.createElement(c.Button,{type:"button",size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,themeColor:this.props.themeColor,icon:"chevron-down",svgIcon:D.chevronDownIcon,className:"k-split-button-arrow",disabled:l||void 0,tabIndex:-1,onClick:this.onSplitPartClick,onMouseDown:this.onDownSplitPart,onPointerDown:this.onDownSplitPart,dir:e,"aria-label":"menu toggling button"}),this.renderPopup(o)),this.showLicenseWatermark&&a.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 a.createElement(b.Popup,{anchor:this.wrapper,show:this.opened,animate:e.animate,popupClass:s.classNames("k-menu-popup",e.popupClass),anchorAlign:e.anchorAlign||m.getAnchorAlign(o),popupAlign:e.popupAlign||m.getPopupAlign(o),style:o?{direction:"rtl"}:void 0,onClose:this.onPopupClose},a.createElement("ul",{role:"menu",id:this.guid,"aria-labelledby":"button-"+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)=>a.createElement(y.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 u=d;exports.SplitButton=u;
|
|
@@ -15,7 +15,7 @@ import { navigate as v } from "./utils/navigation.mjs";
|
|
|
15
15
|
import { Popup as O } from "@progress/kendo-react-popup";
|
|
16
16
|
import { getPopupAlign as S, getAnchorAlign as E } from "./utils/popup.mjs";
|
|
17
17
|
import { packageMetadata as g } from "../package-metadata.mjs";
|
|
18
|
-
import {
|
|
18
|
+
import { chevronDownIcon as P } from "@progress/kendo-svg-icons";
|
|
19
19
|
const u = class u extends p.Component {
|
|
20
20
|
constructor(i) {
|
|
21
21
|
super(i), this.state = {
|
|
@@ -166,7 +166,7 @@ const u = class u extends p.Component {
|
|
|
166
166
|
rounded: this.props.rounded,
|
|
167
167
|
fillMode: this.props.fillMode,
|
|
168
168
|
themeColor: this.props.themeColor,
|
|
169
|
-
icon: "
|
|
169
|
+
icon: "chevron-down",
|
|
170
170
|
svgIcon: P,
|
|
171
171
|
className: "k-split-button-arrow",
|
|
172
172
|
disabled: h || void 0,
|
|
@@ -296,8 +296,6 @@ u.propTypes = {
|
|
|
296
296
|
"success",
|
|
297
297
|
"warning",
|
|
298
298
|
"error",
|
|
299
|
-
"dark",
|
|
300
|
-
"light",
|
|
301
299
|
"inverse"
|
|
302
300
|
])
|
|
303
301
|
}, u.defaultProps = {
|
|
@@ -212,7 +212,7 @@ export interface DropDownButtonProps extends KendoReactComponentBaseProps {
|
|
|
212
212
|
* <DropDownButton themeColor="primary" text="Actions" />
|
|
213
213
|
* ```
|
|
214
214
|
*/
|
|
215
|
-
themeColor?: 'base' | 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | 'error' | '
|
|
215
|
+
themeColor?: 'base' | 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | 'error' | 'inverse';
|
|
216
216
|
/**
|
|
217
217
|
* Sets an SVG icon or custom element before the content of the DropDownButton. For the custom component, we recommend using [Phrasing content](https://developer.mozilla.org/en-US/docs/Web/HTML/Content_categories#phrasing_content)
|
|
218
218
|
* but there must be no [Interactive content](https://developer.mozilla.org/en-US/docs/Web/HTML/Content_categories#interactive_content).
|
|
@@ -427,5 +427,5 @@ export interface SplitButtonProps extends KendoReactComponentBaseProps {
|
|
|
427
427
|
* <SplitButton themeColor="primary" text="Actions" />
|
|
428
428
|
* ```
|
|
429
429
|
*/
|
|
430
|
-
themeColor?: 'base' | 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | 'error' | '
|
|
430
|
+
themeColor?: 'base' | 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | 'error' | 'inverse';
|
|
431
431
|
}
|
|
@@ -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 F=require("react"),m=require("@progress/kendo-react-common");function H(c){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const l in c)if(l!=="default"){const a=Object.getOwnPropertyDescriptor(c,l);Object.defineProperty(u,l,a.get?a:{enumerable:!0,get:()=>c[l]})}}return u.default=c,Object.freeze(u)}const n=H(F),R=n.forwardRef((c,u)=>{const{items:l=[],size:a,layoutMode:O="compact",value:d,onChange:b,itemTemplate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react"),m=require("@progress/kendo-react-common");function H(c){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const l in c)if(l!=="default"){const a=Object.getOwnPropertyDescriptor(c,l);Object.defineProperty(u,l,a.get?a:{enumerable:!0,get:()=>c[l]})}}return u.default=c,Object.freeze(u)}const n=H(F),R=n.forwardRef((c,u)=>{const{items:l=[],size:a,layoutMode:O="compact",value:d,onChange:b,itemTemplate:V,defaultValue:z,className:E,...I}=c,S=a?m.kendoThemeMaps.sizeMap[a]:void 0,k=n.useRef(null),N=n.useRef(null),[v,j]=n.useState({selectedValue:z,focusedValue:void 0}),h=d!=null?d:v.selectedValue,w=v.focusedValue,o=n.useCallback(()=>{const e=k.current,t=N.current;if(!e||!t)return;const s=e.querySelector(".k-segmented-control-button.k-selected");if(!s)return;const r=e.offsetWidth,{offsetWidth:p,offsetLeft:f}=s,g=`${f}px`,y=`${r-f-p}px`;t.style.left!==g&&(t.style.left=g),t.style.right!==y&&(t.style.right=y)},[]),i=e=>{j(t=>({...t,...e}))},T=n.useCallback(e=>t=>{var s,r;if(h===e.value){(s=e.onClick)==null||s.call(e,t);return}d===void 0&&e&&i({selectedValue:e.value}),b==null||b(e.value),(r=e.onClick)==null||r.call(e,t),o()},[d,b,o,h]),W=n.useCallback((e,t)=>s=>{i({hoveredValue:e}),t==null||t(s)},[]),x=n.useCallback(e=>t=>{i({hoveredValue:void 0}),e==null||e(t)},[]),P=n.useCallback((e,t)=>s=>{i({focusedValue:e}),t==null||t(s)},[]),q=n.useCallback(e=>t=>{i({focusedValue:void 0}),e==null||e(t)},[]);return n.useLayoutEffect(()=>{o()},[h,o]),n.useEffect(()=>{const e=k.current;if(!e||typeof ResizeObserver=="undefined")return;const t=new ResizeObserver(()=>{o()});return t.observe(e),()=>{t.disconnect()}},[o]),n.useImperativeHandle(u,()=>({element:k.current}),[]),n.createElement("div",{ref:k,className:m.classNames("k-segmented-control",S&&`k-segmented-control-${S}`,{"k-segmented-control-stretched":O==="stretch"},E),...I},n.createElement("div",{className:"k-segmented-control-thumb",ref:N,"aria-hidden":"true"}),l.map(e=>{const{value:t,disabled:s,text:r,svgIcon:p,iconClassName:f,type:g="button",onClick:y,onMouseEnter:L,onMouseLeave:M,onFocus:_,onBlur:$,...A}=e,C=h===t;return n.createElement("button",{key:t,type:g,className:m.classNames("k-segmented-control-button",{"k-selected":C,"k-hover":v.hoveredValue===t&&!s,"k-focus":w===t&&!s,"k-disabled":s}),"aria-pressed":C,disabled:s,onClick:T(e),onMouseEnter:W(t,L),onMouseLeave:x(M),onFocus:P(t,_),onBlur:q($),...A},V?V(e):n.createElement(n.Fragment,null,p&&n.createElement(m.IconWrap,{className:m.classNames("k-segmented-control-button-icon",{...f&&{[f]:C}}),icon:p}),n.createElement("span",{className:"k-segmented-control-button-text"},r)))}))});R.displayName="KendoReactSegmentedControl";exports.SegmentedControl=R;
|
|
@@ -6,23 +6,23 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as s from "react";
|
|
9
|
-
import { kendoThemeMaps as M, classNames as
|
|
10
|
-
const j = s.forwardRef((y,
|
|
9
|
+
import { kendoThemeMaps as M, classNames as p, IconWrap as P } from "@progress/kendo-react-common";
|
|
10
|
+
const j = s.forwardRef((y, R) => {
|
|
11
11
|
const {
|
|
12
|
-
items:
|
|
12
|
+
items: N = [],
|
|
13
13
|
size: v,
|
|
14
14
|
layoutMode: S = "compact",
|
|
15
15
|
value: o,
|
|
16
16
|
onChange: d,
|
|
17
|
-
itemTemplate:
|
|
17
|
+
itemTemplate: g,
|
|
18
18
|
defaultValue: E,
|
|
19
19
|
className: I,
|
|
20
|
-
...
|
|
21
|
-
} = y,
|
|
20
|
+
...z
|
|
21
|
+
} = y, C = v ? M.sizeMap[v] : void 0, a = s.useRef(null), V = s.useRef(null), [k, x] = s.useState({
|
|
22
22
|
selectedValue: E,
|
|
23
23
|
focusedValue: void 0
|
|
24
24
|
}), i = o != null ? o : k.selectedValue, W = k.focusedValue, l = s.useCallback(() => {
|
|
25
|
-
const e = a.current, t =
|
|
25
|
+
const e = a.current, t = V.current;
|
|
26
26
|
if (!e || !t)
|
|
27
27
|
return;
|
|
28
28
|
const n = e.querySelector(".k-segmented-control-button.k-selected");
|
|
@@ -31,7 +31,7 @@ const j = s.forwardRef((y, N) => {
|
|
|
31
31
|
const c = e.offsetWidth, { offsetWidth: f, offsetLeft: u } = n, m = `${u}px`, h = `${c - u - f}px`;
|
|
32
32
|
t.style.left !== m && (t.style.left = m), t.style.right !== h && (t.style.right = h);
|
|
33
33
|
}, []), r = (e) => {
|
|
34
|
-
|
|
34
|
+
x((t) => ({ ...t, ...e }));
|
|
35
35
|
}, w = s.useCallback(
|
|
36
36
|
(e) => (t) => {
|
|
37
37
|
var n, c;
|
|
@@ -47,18 +47,18 @@ const j = s.forwardRef((y, N) => {
|
|
|
47
47
|
r({ hoveredValue: e }), t == null || t(n);
|
|
48
48
|
},
|
|
49
49
|
[]
|
|
50
|
-
),
|
|
50
|
+
), O = s.useCallback((e) => (t) => {
|
|
51
51
|
r({ hoveredValue: void 0 }), e == null || e(t);
|
|
52
|
-
}, []),
|
|
52
|
+
}, []), T = s.useCallback((e, t) => (n) => {
|
|
53
53
|
r({ focusedValue: e }), t == null || t(n);
|
|
54
|
-
}, []),
|
|
54
|
+
}, []), $ = s.useCallback((e) => (t) => {
|
|
55
55
|
r({ focusedValue: void 0 }), e == null || e(t);
|
|
56
56
|
}, []);
|
|
57
57
|
return s.useLayoutEffect(() => {
|
|
58
58
|
l();
|
|
59
59
|
}, [i, l]), s.useEffect(() => {
|
|
60
60
|
const e = a.current;
|
|
61
|
-
if (!e)
|
|
61
|
+
if (!e || typeof ResizeObserver == "undefined")
|
|
62
62
|
return;
|
|
63
63
|
const t = new ResizeObserver(() => {
|
|
64
64
|
l();
|
|
@@ -67,7 +67,7 @@ const j = s.forwardRef((y, N) => {
|
|
|
67
67
|
t.disconnect();
|
|
68
68
|
};
|
|
69
69
|
}, [l]), s.useImperativeHandle(
|
|
70
|
-
|
|
70
|
+
R,
|
|
71
71
|
() => ({
|
|
72
72
|
element: a.current
|
|
73
73
|
}),
|
|
@@ -76,18 +76,18 @@ const j = s.forwardRef((y, N) => {
|
|
|
76
76
|
"div",
|
|
77
77
|
{
|
|
78
78
|
ref: a,
|
|
79
|
-
className:
|
|
79
|
+
className: p(
|
|
80
80
|
"k-segmented-control",
|
|
81
|
-
|
|
81
|
+
C && `k-segmented-control-${C}`,
|
|
82
82
|
{
|
|
83
83
|
"k-segmented-control-stretched": S === "stretch"
|
|
84
84
|
},
|
|
85
85
|
I
|
|
86
86
|
),
|
|
87
|
-
...
|
|
87
|
+
...z
|
|
88
88
|
},
|
|
89
|
-
/* @__PURE__ */ s.createElement("div", { className: "k-segmented-control-thumb", ref:
|
|
90
|
-
|
|
89
|
+
/* @__PURE__ */ s.createElement("div", { className: "k-segmented-control-thumb", ref: V, "aria-hidden": "true" }),
|
|
90
|
+
N.map((e) => {
|
|
91
91
|
const {
|
|
92
92
|
value: t,
|
|
93
93
|
disabled: n,
|
|
@@ -101,31 +101,32 @@ const j = s.forwardRef((y, N) => {
|
|
|
101
101
|
onFocus: F,
|
|
102
102
|
onBlur: H,
|
|
103
103
|
...K
|
|
104
|
-
} = e,
|
|
104
|
+
} = e, b = i === t;
|
|
105
105
|
return /* @__PURE__ */ s.createElement(
|
|
106
106
|
"button",
|
|
107
107
|
{
|
|
108
108
|
key: t,
|
|
109
109
|
type: m,
|
|
110
|
-
className:
|
|
111
|
-
"k-selected":
|
|
110
|
+
className: p("k-segmented-control-button", {
|
|
111
|
+
"k-selected": b,
|
|
112
112
|
"k-hover": k.hoveredValue === t && !n,
|
|
113
113
|
"k-focus": W === t && !n,
|
|
114
114
|
"k-disabled": n
|
|
115
115
|
}),
|
|
116
|
+
"aria-pressed": b,
|
|
116
117
|
disabled: n,
|
|
117
118
|
onClick: w(e),
|
|
118
119
|
onMouseEnter: L(t, q),
|
|
119
|
-
onMouseLeave:
|
|
120
|
-
onFocus:
|
|
121
|
-
onBlur:
|
|
120
|
+
onMouseLeave: O(A),
|
|
121
|
+
onFocus: T(t, F),
|
|
122
|
+
onBlur: $(H),
|
|
122
123
|
...K
|
|
123
124
|
},
|
|
124
|
-
|
|
125
|
+
g ? g(e) : /* @__PURE__ */ s.createElement(s.Fragment, null, f && /* @__PURE__ */ s.createElement(
|
|
125
126
|
P,
|
|
126
127
|
{
|
|
127
|
-
className:
|
|
128
|
-
...u && { [u]:
|
|
128
|
+
className: p("k-segmented-control-button-icon", {
|
|
129
|
+
...u && { [u]: b }
|
|
129
130
|
}),
|
|
130
131
|
icon: f
|
|
131
132
|
}
|
|
@@ -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"),
|
|
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;
|
|
@@ -9,7 +9,7 @@ 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
11
|
import { validatePackage as te, getLicenseMessage as ne, classNames as re, WatermarkOverlay as se } from "@progress/kendo-react-common";
|
|
12
|
-
import {
|
|
12
|
+
import { stopIcon as oe, 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";
|
|
@@ -24,12 +24,12 @@ const ie = e.forwardRef((a, M) => {
|
|
|
24
24
|
disabled: N,
|
|
25
25
|
iconSize: F,
|
|
26
26
|
title: u,
|
|
27
|
-
className:
|
|
28
|
-
id:
|
|
27
|
+
className: K,
|
|
28
|
+
id: O,
|
|
29
29
|
style: P,
|
|
30
30
|
lang: h = "en-US",
|
|
31
|
-
continuous:
|
|
32
|
-
interimResults:
|
|
31
|
+
continuous: v = !1,
|
|
32
|
+
interimResults: S = !1,
|
|
33
33
|
maxAlternatives: k = 1,
|
|
34
34
|
integrationMode: W = "webSpeech",
|
|
35
35
|
onStart: f,
|
|
@@ -68,8 +68,8 @@ const ie = e.forwardRef((a, M) => {
|
|
|
68
68
|
}
|
|
69
69
|
(t = s.current) != null && t.isActive() && s.current.stop(), s.current = new $({
|
|
70
70
|
lang: h,
|
|
71
|
-
continuous:
|
|
72
|
-
interimResults:
|
|
71
|
+
continuous: v,
|
|
72
|
+
interimResults: S,
|
|
73
73
|
maxAlternatives: k,
|
|
74
74
|
events: {
|
|
75
75
|
start: j,
|
|
@@ -95,20 +95,20 @@ const ie = e.forwardRef((a, M) => {
|
|
|
95
95
|
isActive: V
|
|
96
96
|
})), e.useEffect(() => (J(), () => {
|
|
97
97
|
n.current && d();
|
|
98
|
-
}), [h,
|
|
98
|
+
}), [h, v, S, k, W]);
|
|
99
99
|
const X = () => {
|
|
100
100
|
o ? d() : b();
|
|
101
101
|
}, Y = a.icon !== void 0 || a.iconClass !== void 0, Z = e.useMemo(() => o ? oe : g || ae, [o, g]);
|
|
102
102
|
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
103
103
|
ee,
|
|
104
104
|
{
|
|
105
|
-
id:
|
|
105
|
+
id: O,
|
|
106
106
|
className: re(
|
|
107
107
|
{
|
|
108
108
|
"k-speech-to-text-button": !0,
|
|
109
109
|
"k-listening": o
|
|
110
110
|
},
|
|
111
|
-
|
|
111
|
+
K
|
|
112
112
|
),
|
|
113
113
|
style: P,
|
|
114
114
|
svgIcon: Y ? void 0 : Z,
|