@progress/kendo-vue-buttons 8.4.0-develop.3 → 8.4.0-develop.4
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 +8 -9
- package/Chip/Chip.d.ts +0 -6
- package/Chip/Chip.js +1 -1
- package/Chip/Chip.mjs +16 -18
- package/FloatingActionButton/FloatingActionButton.d.ts +3 -5
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +60 -56
- package/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +2 -8
- package/FloatingActionButton/models/theme-color.d.ts +3 -9
- package/ListButton/ButtonItem.d.ts +0 -6
- package/ListButton/ButtonItem.js +1 -1
- package/ListButton/ButtonItem.mjs +9 -14
- package/ListButton/DropDownButton.d.ts +8 -5
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +105 -101
- package/ListButton/SplitButton.d.ts +4 -4
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +47 -49
- package/ListButton/models/ListButtonProps.d.ts +8 -8
- package/SegmentedControl/SegmentedControl.d.ts +2 -2
- package/SegmentedControl/interfaces/SegmentedControlTypes.d.ts +1 -0
- package/SmartPasteButton/SmartPasteButton.d.ts +6 -6
- package/SpeechToText/SpeechToTextButton.d.ts +4 -4
- package/SpeechToText/SpeechToTextButton.js +1 -1
- package/SpeechToText/SpeechToTextButton.mjs +16 -16
- package/dist/cdn/js/kendo-vue-buttons.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +11 -6
- package/toolbar/Toolbar.d.ts +2 -2
- package/toolbar/Toolbar.js +1 -1
- package/toolbar/Toolbar.mjs +2 -2
- package/ListButton/messages/index.d.ts +0 -17
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { canUseDOM as
|
|
8
|
+
import { defineComponent as k, createVNode as o, ref as y } from "vue";
|
|
9
|
+
import { Button as l } from "../Button.mjs";
|
|
10
|
+
import { canUseDOM as O, Keys as s, getDefaultSlots as I, guid as a, validatePackage as S, classNames as D, templateRendering as h, getListeners as f } from "@progress/kendo-vue-common";
|
|
11
11
|
import { ButtonItem as x } from "./ButtonItem.mjs";
|
|
12
|
-
import
|
|
13
|
-
import { Popup as
|
|
14
|
-
import { getPopupAlign as
|
|
15
|
-
import { chevronDownIcon as
|
|
16
|
-
import { packageMetadata as
|
|
17
|
-
const L = /* @__PURE__ */
|
|
12
|
+
import w from "./utils/navigation.mjs";
|
|
13
|
+
import { Popup as v } from "@progress/kendo-vue-popup";
|
|
14
|
+
import { getPopupAlign as P, getAnchorAlign as B } from "./utils/popup.mjs";
|
|
15
|
+
import { chevronDownIcon as E } from "@progress/kendo-svg-icons";
|
|
16
|
+
import { packageMetadata as K } from "../package-metadata.mjs";
|
|
17
|
+
const L = /* @__PURE__ */ k({
|
|
18
18
|
name: "KendoSplitButton",
|
|
19
19
|
emits: {
|
|
20
20
|
focus: (t) => !0,
|
|
@@ -50,7 +50,7 @@ const L = /* @__PURE__ */ y({
|
|
|
50
50
|
themeColor: {
|
|
51
51
|
type: String,
|
|
52
52
|
validator: function(t) {
|
|
53
|
-
return ["base", "
|
|
53
|
+
return ["base", "error", "info", "inverse", "primary", "secondary", "success", "tertiary", "warning"].includes(t);
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
opened: {
|
|
@@ -74,7 +74,7 @@ const L = /* @__PURE__ */ y({
|
|
|
74
74
|
};
|
|
75
75
|
},
|
|
76
76
|
created() {
|
|
77
|
-
this._blurTimeout = null, this._anchor =
|
|
77
|
+
this._blurTimeout = null, this._anchor = a(), this.mainButton = null, this.guid = a(), this.buttonsData = [], S(K);
|
|
78
78
|
},
|
|
79
79
|
mounted() {
|
|
80
80
|
this.mainButton = this.$refs[this._anchor], (this.$props.dir === void 0 && this.isRtl() || this.computedOpened) && this.$forceUpdate();
|
|
@@ -96,79 +96,77 @@ const L = /* @__PURE__ */ y({
|
|
|
96
96
|
},
|
|
97
97
|
setup() {
|
|
98
98
|
return {
|
|
99
|
-
kendoAnchorRef:
|
|
99
|
+
kendoAnchorRef: y(null)
|
|
100
100
|
};
|
|
101
101
|
},
|
|
102
102
|
render() {
|
|
103
103
|
this.buttonsData = this.$props.items;
|
|
104
104
|
const t = this.isRtl(), e = t ? "rtl" : void 0, {
|
|
105
105
|
tabIndex: i,
|
|
106
|
-
disabled:
|
|
107
|
-
} = this.$props, p =
|
|
106
|
+
disabled: r
|
|
107
|
+
} = this.$props, p = I(this), m = function() {
|
|
108
108
|
const {
|
|
109
109
|
item: n,
|
|
110
110
|
itemRender: c,
|
|
111
111
|
textField: C
|
|
112
|
-
} = this.$props
|
|
113
|
-
return
|
|
114
|
-
const
|
|
115
|
-
...
|
|
116
|
-
render:
|
|
117
|
-
} :
|
|
118
|
-
return
|
|
112
|
+
} = this.$props;
|
|
113
|
+
return this.buttonsData.length > 0 ? this.buttonsData.map(function(d, u) {
|
|
114
|
+
const $ = typeof d != "string" ? {
|
|
115
|
+
...d,
|
|
116
|
+
render: h.call(this, d.render, f.call(this))
|
|
117
|
+
} : d;
|
|
118
|
+
return o(x, {
|
|
119
119
|
role: "menuitem",
|
|
120
|
-
dataItem:
|
|
120
|
+
dataItem: $,
|
|
121
121
|
textField: C,
|
|
122
|
-
focused: this.focusedIndex ===
|
|
122
|
+
focused: this.focusedIndex === u,
|
|
123
123
|
onClick: this.onItemClick,
|
|
124
124
|
onDown: this.onItemDown,
|
|
125
|
-
render:
|
|
125
|
+
render: h.call(this, c, f.call(this)),
|
|
126
126
|
item: n,
|
|
127
|
-
key:
|
|
128
|
-
index:
|
|
129
|
-
id: `${this.guid}-${
|
|
130
|
-
first: o === 0,
|
|
131
|
-
last: o === l - 1
|
|
127
|
+
key: u,
|
|
128
|
+
index: u,
|
|
129
|
+
id: `${this.guid}-${u}`
|
|
132
130
|
}, null);
|
|
133
131
|
}, this) : null;
|
|
134
|
-
},
|
|
132
|
+
}, g = function() {
|
|
135
133
|
const {
|
|
136
134
|
popupSettings: n = {},
|
|
137
135
|
size: c
|
|
138
136
|
} = this.$props;
|
|
139
|
-
return
|
|
137
|
+
return o(v, {
|
|
140
138
|
anchor: this._anchor,
|
|
141
139
|
show: this.computedOpened,
|
|
142
140
|
animate: n.animate,
|
|
143
|
-
popupClass:
|
|
144
|
-
anchorAlign: n.anchorAlign ||
|
|
145
|
-
popupAlign: n.popupAlign ||
|
|
141
|
+
popupClass: D("k-menu-popup", n.popupClass),
|
|
142
|
+
anchorAlign: n.anchorAlign || B(t),
|
|
143
|
+
popupAlign: n.popupAlign || P(t),
|
|
146
144
|
style: t ? {
|
|
147
145
|
direction: "rtl"
|
|
148
146
|
} : void 0
|
|
149
147
|
}, {
|
|
150
|
-
default: () => [
|
|
148
|
+
default: () => [o("ul", {
|
|
151
149
|
class: "k-menu-group",
|
|
152
150
|
role: "menu",
|
|
153
151
|
id: this.guid
|
|
154
|
-
}, [
|
|
152
|
+
}, [m.call(this)])]
|
|
155
153
|
});
|
|
156
|
-
},
|
|
154
|
+
}, b = this.$props.text || p ? {
|
|
157
155
|
default: () => [this.$props.text, p]
|
|
158
156
|
} : {};
|
|
159
|
-
return
|
|
157
|
+
return o("div", {
|
|
160
158
|
class: this.wrapperClass,
|
|
161
159
|
onKeydown: this.onKeyDown,
|
|
162
160
|
onFocusin: this.onFocus,
|
|
163
161
|
onFocusout: this.onBlur,
|
|
164
162
|
dir: e
|
|
165
|
-
}, [
|
|
163
|
+
}, [o(l, {
|
|
166
164
|
size: this.$props.size,
|
|
167
165
|
rounded: this.$props.rounded,
|
|
168
166
|
fillMode: this.$props.fillMode,
|
|
169
167
|
themeColor: this.$props.themeColor,
|
|
170
168
|
onClick: (n) => this.onItemClick(n, -1),
|
|
171
|
-
disabled:
|
|
169
|
+
disabled: r || void 0,
|
|
172
170
|
tabIndex: i,
|
|
173
171
|
accessKey: this.$props.accessKey,
|
|
174
172
|
class: this.$props.buttonClass,
|
|
@@ -180,17 +178,17 @@ const L = /* @__PURE__ */ y({
|
|
|
180
178
|
id: this._anchor,
|
|
181
179
|
ref: this._anchor,
|
|
182
180
|
type: "button",
|
|
183
|
-
"aria-disabled":
|
|
181
|
+
"aria-disabled": r || void 0,
|
|
184
182
|
"aria-label": this.$props.ariaLabel || (!this.$props.text && !p && (this.$props.svgIcon || this.$props.icon || this.$props.iconClass) ? "Action" : void 0)
|
|
185
|
-
},
|
|
186
|
-
svgIcon:
|
|
183
|
+
}, b), o(l, {
|
|
184
|
+
svgIcon: E,
|
|
187
185
|
size: this.$props.size,
|
|
188
186
|
rounded: this.$props.rounded,
|
|
189
187
|
fillMode: this.$props.fillMode,
|
|
190
188
|
themeColor: this.$props.themeColor,
|
|
191
189
|
icon: "chevron-down",
|
|
192
190
|
class: "k-split-button-arrow",
|
|
193
|
-
disabled:
|
|
191
|
+
disabled: r || void 0,
|
|
194
192
|
tabIndex: -1,
|
|
195
193
|
onClick: this.onSplitPartClick,
|
|
196
194
|
onMousedown: this.onDownSplitPart,
|
|
@@ -199,7 +197,7 @@ const L = /* @__PURE__ */ y({
|
|
|
199
197
|
"aria-label": "Toggle dropdown",
|
|
200
198
|
"aria-expanded": this.computedOpened,
|
|
201
199
|
"aria-controls": this.computedOpened ? this.guid : void 0
|
|
202
|
-
}, null),
|
|
200
|
+
}, null), g.call(this)]);
|
|
203
201
|
},
|
|
204
202
|
methods: {
|
|
205
203
|
element() {
|
|
@@ -218,10 +216,10 @@ const L = /* @__PURE__ */ y({
|
|
|
218
216
|
focusedIndex: -1,
|
|
219
217
|
currentOpened: !1
|
|
220
218
|
}, this.dispatchPopupEvent(t, e.currentOpened)), this.computedOpened) {
|
|
221
|
-
const i =
|
|
219
|
+
const i = w(this.focusedIndex, t.keyCode, t.altKey, this.buttonsData.length);
|
|
222
220
|
i !== this.focusedIndex && (e = e || {}, e.focusedIndex = i);
|
|
223
|
-
const
|
|
224
|
-
!t.altKey &&
|
|
221
|
+
const r = t.keyCode === s.up || t.keyCode === s.down || t.keyCode === s.left || t.keyCode === s.right;
|
|
222
|
+
!t.altKey && r && t.preventDefault();
|
|
225
223
|
}
|
|
226
224
|
e && (this.focusedIndex = e.focusedIndex, this.focused = e.focused, e.currentOpened !== void 0 && (this.currentOpened = e.currentOpened));
|
|
227
225
|
},
|
|
@@ -240,7 +238,7 @@ const L = /* @__PURE__ */ y({
|
|
|
240
238
|
createBlurTimeout(t) {
|
|
241
239
|
const e = this;
|
|
242
240
|
this._blurTimeout = setTimeout(() => {
|
|
243
|
-
|
|
241
|
+
O && document.activeElement !== e.mainButton && (e.focused = !1, e.focusedIndex = -1, e.$emit("blur", {
|
|
244
242
|
event: t
|
|
245
243
|
}), e.computedOpened && (e.currentOpened = !1, e.dispatchPopupEvent(t, !1)));
|
|
246
244
|
}, 200);
|
|
@@ -83,13 +83,14 @@ export interface DropDownButtonProps {
|
|
|
83
83
|
* Configures the `size` of the Button.
|
|
84
84
|
*
|
|
85
85
|
* The available options are:
|
|
86
|
+
* - xs
|
|
86
87
|
* - small
|
|
87
88
|
* - medium
|
|
88
89
|
* - large
|
|
89
90
|
*
|
|
90
91
|
* @default `undefined`
|
|
91
92
|
*/
|
|
92
|
-
size?: 'small' | 'medium' | 'large';
|
|
93
|
+
size?: 'xs' | 'small' | 'medium' | 'large';
|
|
93
94
|
/**
|
|
94
95
|
* Configures the `roundness` of the Button.
|
|
95
96
|
*
|
|
@@ -127,13 +128,12 @@ export interface DropDownButtonProps {
|
|
|
127
128
|
* - info
|
|
128
129
|
* - success
|
|
129
130
|
* - warning
|
|
130
|
-
* -
|
|
131
|
-
* - light
|
|
131
|
+
* - error
|
|
132
132
|
* - inverse
|
|
133
133
|
*
|
|
134
134
|
* @default `undefined`
|
|
135
135
|
*/
|
|
136
|
-
themeColor?: 'base' | 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | '
|
|
136
|
+
themeColor?: 'base' | 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | 'error' | 'inverse';
|
|
137
137
|
/**
|
|
138
138
|
* Fires when the component is focused ([see example]({% slug events_dropdownbutton %})).
|
|
139
139
|
*/
|
|
@@ -233,13 +233,14 @@ export interface SplitButtonProps {
|
|
|
233
233
|
* Configures the `size` of the Button.
|
|
234
234
|
*
|
|
235
235
|
* The available options are:
|
|
236
|
+
* - xs
|
|
236
237
|
* - small
|
|
237
238
|
* - medium
|
|
238
239
|
* - large
|
|
239
240
|
*
|
|
240
241
|
* @default `undefined`
|
|
241
242
|
*/
|
|
242
|
-
size?: 'small' | 'medium' | 'large';
|
|
243
|
+
size?: 'xs' | 'small' | 'medium' | 'large';
|
|
243
244
|
/**
|
|
244
245
|
* Configures the `roundness` of the Button.
|
|
245
246
|
*
|
|
@@ -277,13 +278,12 @@ export interface SplitButtonProps {
|
|
|
277
278
|
* - info
|
|
278
279
|
* - success
|
|
279
280
|
* - warning
|
|
280
|
-
* -
|
|
281
|
-
* - light
|
|
281
|
+
* - error
|
|
282
282
|
* - inverse
|
|
283
283
|
*
|
|
284
284
|
* @default `undefined`
|
|
285
285
|
*/
|
|
286
|
-
themeColor?: 'base' | 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | '
|
|
286
|
+
themeColor?: 'base' | 'primary' | 'secondary' | 'tertiary' | 'info' | 'success' | 'warning' | 'error' | 'inverse';
|
|
287
287
|
/**
|
|
288
288
|
* Fires when the main button is clicked ([see example]({% slug events_splitbutton %})).
|
|
289
289
|
*/
|
|
@@ -19,7 +19,7 @@ declare const SegmentedControl: import('vue').DefineComponent<import('vue').Extr
|
|
|
19
19
|
type: PropType<SegmentedItemProps[]>;
|
|
20
20
|
default: () => any[];
|
|
21
21
|
};
|
|
22
|
-
size: PropType<"small" | "medium" | "
|
|
22
|
+
size: PropType<"small" | "medium" | "xs" | "large">;
|
|
23
23
|
layoutMode: {
|
|
24
24
|
type: PropType<"stretch" | "compact">;
|
|
25
25
|
default: string;
|
|
@@ -49,7 +49,7 @@ declare const SegmentedControl: import('vue').DefineComponent<import('vue').Extr
|
|
|
49
49
|
type: PropType<SegmentedItemProps[]>;
|
|
50
50
|
default: () => any[];
|
|
51
51
|
};
|
|
52
|
-
size: PropType<"small" | "medium" | "
|
|
52
|
+
size: PropType<"small" | "medium" | "xs" | "large">;
|
|
53
53
|
layoutMode: {
|
|
54
54
|
type: PropType<"stretch" | "compact">;
|
|
55
55
|
default: string;
|
|
@@ -25,14 +25,14 @@ declare const SmartPasteButton: import('vue').DefineComponent<import('vue').Extr
|
|
|
25
25
|
default: string;
|
|
26
26
|
};
|
|
27
27
|
size: {
|
|
28
|
-
type: PropType<"small" | "medium" | "
|
|
28
|
+
type: PropType<"small" | "medium" | "xs" | "large">;
|
|
29
29
|
default: string;
|
|
30
30
|
};
|
|
31
31
|
svgIcon: {
|
|
32
32
|
type: PropType<import('@progress/kendo-vue-common').SVGIcon>;
|
|
33
33
|
default: () => import('@progress/kendo-svg-icons').SVGIcon;
|
|
34
34
|
};
|
|
35
|
-
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "
|
|
35
|
+
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "error" | "inverse">;
|
|
36
36
|
formFields: PropType<SmartPasteFormField[]>;
|
|
37
37
|
togglable: {
|
|
38
38
|
type: PropType<boolean>;
|
|
@@ -81,14 +81,14 @@ declare const SmartPasteButton: import('vue').DefineComponent<import('vue').Extr
|
|
|
81
81
|
default: string;
|
|
82
82
|
};
|
|
83
83
|
size: {
|
|
84
|
-
type: PropType<"small" | "medium" | "
|
|
84
|
+
type: PropType<"small" | "medium" | "xs" | "large">;
|
|
85
85
|
default: string;
|
|
86
86
|
};
|
|
87
87
|
svgIcon: {
|
|
88
88
|
type: PropType<import('@progress/kendo-vue-common').SVGIcon>;
|
|
89
89
|
default: () => import('@progress/kendo-svg-icons').SVGIcon;
|
|
90
90
|
};
|
|
91
|
-
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "
|
|
91
|
+
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "error" | "inverse">;
|
|
92
92
|
formFields: PropType<SmartPasteFormField[]>;
|
|
93
93
|
togglable: {
|
|
94
94
|
type: PropType<boolean>;
|
|
@@ -118,11 +118,11 @@ declare const SmartPasteButton: import('vue').DefineComponent<import('vue').Extr
|
|
|
118
118
|
onClick?: (event: SmartPasteClickEvent) => any;
|
|
119
119
|
}>, {
|
|
120
120
|
type: string;
|
|
121
|
-
size: "small" | "medium" | "
|
|
121
|
+
size: "small" | "medium" | "xs" | "large";
|
|
122
|
+
fillMode: "flat" | "link" | "solid" | "outline";
|
|
122
123
|
rounded: "small" | "medium" | "large" | "full" | "none";
|
|
123
124
|
selected: boolean;
|
|
124
125
|
disabled: boolean;
|
|
125
|
-
fillMode: "flat" | "link" | "solid" | "outline";
|
|
126
126
|
togglable: boolean;
|
|
127
127
|
svgIcon: import('@progress/kendo-vue-common').SVGIcon;
|
|
128
128
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -157,10 +157,10 @@ declare const SpeechToTextButton: import('vue').DefineComponent<import('vue').Ex
|
|
|
157
157
|
type: PropType<boolean>;
|
|
158
158
|
default: any;
|
|
159
159
|
};
|
|
160
|
-
size: PropType<"small" | "medium" | "
|
|
160
|
+
size: PropType<"small" | "medium" | "xs" | "large">;
|
|
161
161
|
rounded: PropType<"small" | "medium" | "large" | "full" | "none">;
|
|
162
162
|
fillMode: PropType<"flat" | "link" | "solid" | "outline">;
|
|
163
|
-
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "
|
|
163
|
+
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "error" | "inverse">;
|
|
164
164
|
title: {
|
|
165
165
|
type: PropType<string>;
|
|
166
166
|
default: string;
|
|
@@ -216,10 +216,10 @@ declare const SpeechToTextButton: import('vue').DefineComponent<import('vue').Ex
|
|
|
216
216
|
type: PropType<boolean>;
|
|
217
217
|
default: any;
|
|
218
218
|
};
|
|
219
|
-
size: PropType<"small" | "medium" | "
|
|
219
|
+
size: PropType<"small" | "medium" | "xs" | "large">;
|
|
220
220
|
rounded: PropType<"small" | "medium" | "large" | "full" | "none">;
|
|
221
221
|
fillMode: PropType<"flat" | "link" | "solid" | "outline">;
|
|
222
|
-
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "
|
|
222
|
+
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "error" | "inverse">;
|
|
223
223
|
title: {
|
|
224
224
|
type: PropType<string>;
|
|
225
225
|
default: string;
|
|
@@ -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 i=require("vue"),E=require("@progress/kendo-webspeech-common"),k=require("../Button.js"),m=require("@progress/kendo-svg-icons");function T(e){return new E.KendoSpeechRecognition(e)}let f=(function(e){return e.WebSpeech="WebSpeech",e.None="None",e})({});const z=i.defineComponent({name:"KendoSpeechToTextButton",props:{lang:{type:String,default:"en-US"},continuous:{type:Boolean,default:!1},interimResults:{type:Boolean,default:!1},maxAlternatives:{type:Number,default:1},integrationMode:{type:String,default:f.WebSpeech},onStart:{type:Function},onResult:{type:Function},onEnd:{type:Function},onError:{type:Function},svgIcon:{type:Object,default:m.
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),E=require("@progress/kendo-webspeech-common"),k=require("../Button.js"),m=require("@progress/kendo-svg-icons");function T(e){return new E.KendoSpeechRecognition(e)}let f=(function(e){return e.WebSpeech="WebSpeech",e.None="None",e})({});const z=i.defineComponent({name:"KendoSpeechToTextButton",props:{lang:{type:String,default:"en-US"},continuous:{type:Boolean,default:!1},interimResults:{type:Boolean,default:!1},maxAlternatives:{type:Number,default:1},integrationMode:{type:String,default:f.WebSpeech},onStart:{type:Function},onResult:{type:Function},onEnd:{type:Function},onError:{type:Function},svgIcon:{type:Object,default:m.microphoneIcon},iconSize:{type:String},disabled:{type:Boolean,default:void 0},size:String,rounded:String,fillMode:String,themeColor:String,title:{type:String,default:"Speech to Text Button"},ariaLabel:{type:String,default:"Start speech recognition"}},setup(e,{emit:c,expose:S}){const o=i.ref(null),n=i.ref(!1),g=()=>{var t;return(t=o.value)==null?void 0:t.isActive()},a=()=>e.integrationMode!==f.None,l=typeof window!="undefined"&&!("webkitSpeechRecognition"in window||"SpeechRecognition"in window)?(e.onError&&e.onError({errorMessage:"Speech Recognition API is not supported in this browser."}),!1):!0,u=()=>{var t;n.value||(a()&&((t=o.value)==null||t.start()),n.value=!0)},r=()=>{var t;n.value&&(a()&&((t=o.value)==null||t.stop()),n.value=!1)},v=()=>{var t;n.value&&a()&&((t=o.value)==null||t.abort(),n.value=!1)},h=()=>{l&&(n.value?b():d())},d=async()=>{n.value||(e.onStart&&await e.onStart(),u())},M=t=>{const s=t.results,B=s.length-1,R=s[B],x=Array.from(R).map(I=>({transcript:I.transcript,confidence:I.confidence})),w={isFinal:R.isFinal,alternatives:x};e.onResult&&e.onResult(w),c("result",w)},b=async()=>{n.value&&(e.onEnd&&await e.onEnd(),r())},A=t=>{n.value=!1;const s={errorMessage:t.error||t.errorMessage||"Unknown error"};e.onError&&e.onError(s),c("error",s)},p=()=>{var t;l&&e.integrationMode===f.WebSpeech&&((t=o.value)!=null&&t.isActive()&&r(),o.value=T({lang:e.lang,continuous:e.continuous,interimResults:e.interimResults,integrationMode:e.integrationMode,maxAlternatives:e.maxAlternatives,events:{start:d,result:M,end:b,error:A}}))};return i.watch(()=>({lang:e.lang,continuous:e.continuous,interimResults:e.interimResults,integrationMode:e.integrationMode,maxAlternatives:e.maxAlternatives}),()=>{p()},{deep:!0}),i.onMounted(()=>{p()}),i.onUnmounted(()=>{var t;(t=o.value)!=null&&t.isInActiveState&&r()}),S({start:u,stop:r,abort:v,isActive:g}),{clickHandler:h,isInActiveState:n}},render(){const{ariaLabel:e,svgIcon:c,fillMode:S,rounded:o,size:n,disabled:g,themeColor:a,iconSize:y,title:l}=this.$props,{className:u,style:r,id:v}=this.$attrs,h=i.computed(()=>["k-speech-to-text-button",u,{"k-listening":this.isInActiveState}]),d=i.computed(()=>this.isInActiveState?m.stopIcon:c||m.microphoneIcon);return i.createVNode(k.Button,{id:v,style:r,class:h.value,onClick:this.clickHandler,svgIcon:d.value,iconSize:y,fillMode:S,rounded:o,size:n,themeColor:a,"aria-label":e,disabled:g,title:l},null)}});exports.SpeechToTextButton=z;exports.SpeechToTextButtonMode=f;
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
import { defineComponent as k, computed as w, createVNode as z, ref as A, watch as C, onMounted as F, onUnmounted as H } from "vue";
|
|
9
9
|
import { KendoSpeechRecognition as N } from "@progress/kendo-webspeech-common";
|
|
10
10
|
import { Button as T } from "../Button.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { microphoneIcon as I, stopIcon as W } from "@progress/kendo-svg-icons";
|
|
12
12
|
function U(e) {
|
|
13
13
|
return new N(e);
|
|
14
14
|
}
|
|
15
|
-
let
|
|
15
|
+
let S = /* @__PURE__ */ (function(e) {
|
|
16
16
|
return e.WebSpeech = "WebSpeech", e.None = "None", e;
|
|
17
17
|
})({});
|
|
18
|
-
const
|
|
18
|
+
const O = /* @__PURE__ */ k({
|
|
19
19
|
name: "KendoSpeechToTextButton",
|
|
20
20
|
props: {
|
|
21
21
|
lang: {
|
|
@@ -36,7 +36,7 @@ const j = /* @__PURE__ */ k({
|
|
|
36
36
|
},
|
|
37
37
|
integrationMode: {
|
|
38
38
|
type: String,
|
|
39
|
-
default:
|
|
39
|
+
default: S.WebSpeech
|
|
40
40
|
},
|
|
41
41
|
onStart: {
|
|
42
42
|
type: Function
|
|
@@ -81,7 +81,7 @@ const j = /* @__PURE__ */ k({
|
|
|
81
81
|
const o = A(null), n = A(!1), f = () => {
|
|
82
82
|
var t;
|
|
83
83
|
return (t = o.value) == null ? void 0 : t.isActive();
|
|
84
|
-
}, r = () => e.integrationMode !==
|
|
84
|
+
}, r = () => e.integrationMode !== S.None, l = typeof window != "undefined" && !("webkitSpeechRecognition" in window || "SpeechRecognition" in window) ? (e.onError && e.onError({
|
|
85
85
|
errorMessage: "Speech Recognition API is not supported in this browser."
|
|
86
86
|
}), !1) : !0, c = () => {
|
|
87
87
|
var t;
|
|
@@ -89,10 +89,10 @@ const j = /* @__PURE__ */ k({
|
|
|
89
89
|
}, i = () => {
|
|
90
90
|
var t;
|
|
91
91
|
n.value && (r() && ((t = o.value) == null || t.stop()), n.value = !1);
|
|
92
|
-
},
|
|
92
|
+
}, g = () => {
|
|
93
93
|
var t;
|
|
94
94
|
n.value && r() && ((t = o.value) == null || t.abort(), n.value = !1);
|
|
95
|
-
},
|
|
95
|
+
}, v = () => {
|
|
96
96
|
l && (n.value ? h() : u());
|
|
97
97
|
}, u = async () => {
|
|
98
98
|
n.value || (e.onStart && await e.onStart(), c());
|
|
@@ -115,7 +115,7 @@ const j = /* @__PURE__ */ k({
|
|
|
115
115
|
e.onError && e.onError(a), s("error", a);
|
|
116
116
|
}, y = () => {
|
|
117
117
|
var t;
|
|
118
|
-
l && e.integrationMode ===
|
|
118
|
+
l && e.integrationMode === S.WebSpeech && ((t = o.value) != null && t.isActive() && i(), o.value = U({
|
|
119
119
|
lang: e.lang,
|
|
120
120
|
continuous: e.continuous,
|
|
121
121
|
interimResults: e.interimResults,
|
|
@@ -147,10 +147,10 @@ const j = /* @__PURE__ */ k({
|
|
|
147
147
|
}), d({
|
|
148
148
|
start: c,
|
|
149
149
|
stop: i,
|
|
150
|
-
abort:
|
|
150
|
+
abort: g,
|
|
151
151
|
isActive: f
|
|
152
152
|
}), {
|
|
153
|
-
clickHandler:
|
|
153
|
+
clickHandler: v,
|
|
154
154
|
isInActiveState: n
|
|
155
155
|
};
|
|
156
156
|
},
|
|
@@ -168,14 +168,14 @@ const j = /* @__PURE__ */ k({
|
|
|
168
168
|
} = this.$props, {
|
|
169
169
|
className: c,
|
|
170
170
|
style: i,
|
|
171
|
-
id:
|
|
172
|
-
} = this.$attrs,
|
|
171
|
+
id: g
|
|
172
|
+
} = this.$attrs, v = w(() => ["k-speech-to-text-button", c, {
|
|
173
173
|
"k-listening": this.isInActiveState
|
|
174
174
|
}]), u = w(() => this.isInActiveState ? W : s || I);
|
|
175
175
|
return z(T, {
|
|
176
|
-
id:
|
|
176
|
+
id: g,
|
|
177
177
|
style: i,
|
|
178
|
-
class:
|
|
178
|
+
class: v.value,
|
|
179
179
|
onClick: this.clickHandler,
|
|
180
180
|
svgIcon: u.value,
|
|
181
181
|
iconSize: m,
|
|
@@ -190,6 +190,6 @@ const j = /* @__PURE__ */ k({
|
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
192
|
export {
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
O as SpeechToTextButton,
|
|
194
|
+
S as SpeechToTextButtonMode
|
|
195
195
|
};
|