@progress/kendo-react-buttons 8.3.0-develop.3 → 8.3.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.js +1 -1
- package/Button.mjs +53 -49
- package/ListButton/ButtonItem.js +1 -1
- package/ListButton/ButtonItem.mjs +21 -24
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +90 -87
- package/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +3 -3
package/Button.js
CHANGED
|
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),l=require("prop-types"),t=require("@progress/kendo-react-common"),M=require("./package-metadata.js");function x(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const s in o)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(o,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:()=>o[s]})}}return e.default=o,Object.freeze(e)}const c=x(I);function B({imageUrl:o,name:e,iconClass:s,svgIcon:n,imageAlt:r,buttonClasses:a}){return o?c.createElement("img",{role:"presentation",className:t.classNames(t.uButton.icon({c:a})),alt:r,src:o}):e||n?c.createElement(t.IconWrap,{className:t.classNames(t.uButton.icon({c:a})),name:e,icon:n}):s?c.createElement("span",{role:"presentation",className:t.classNames(t.uButton.icon({c:a}),s)}):null}const i=class i extends c.Component{constructor(e){super(e),this._element=null,this.handleClick=s=>{this.toggleIfApplicable(),this.props.onClick&&this.props.onClick.call(void 0,s)},t.validatePackage(M.packageMetadata),this.state={selected:this.props.togglable===!0&&this.props.selected===!0}}get element(){return this._element}get selected(){return this._selectedTemp!==void 0?this._selectedTemp:this.state.selected}static getDerivedStateFromProps(e,s){return e.togglable&&e.selected!==void 0&&e.selected!==s.selected?{selected:e.selected}:null}render(){const{children:e,togglable:s,icon:n,iconClass:r,svgIcon:a,imageUrl:p,imageAlt:b,className:v,startIcon:g,endIcon:h,onClick:S,size:C=i.defaultProps.size,rounded:N=i.defaultProps.rounded,fillMode:k=i.defaultProps.fillMode,themeColor:y=i.defaultProps.themeColor,...P}=this.props,O=a!==void 0||n!==void 0||r!==void 0||p!==void 0,T=e!==void 0,d=this.context&&this.context.uButton,E=B({name:n,svgIcon:a,iconClass:r,imageUrl:p,imageAlt:b,buttonClasses:d}),f=m=>c.cloneElement(m,{className:t.classNames(t.uButton.icon({c:d}))});return c.createElement("button",{ref:m=>this._element=m,"aria-pressed":s?this.state.selected:void 0,...P,onClick:this.handleClick,className:t.classNames(t.uButton.wrapper({c:d,isRtl:this.props.dir==="rtl",selected:this.state.selected,disabled:this.props.disabled,size:C,fillMode:k,rounded:N,themeColor:y,iconButton:!T&&O}),v)},g&&f(g),E,e&&c.createElement("span",{className:t.classNames(t.uButton.text({c:d}))},e),h&&f(h))}toggleIfApplicable(){if(this.props.togglable&&this.props.selected===void 0){const e=!this.state.selected;this._selectedTemp=e,this.setState({selected:e},()=>this._selectedTemp=void 0)}}};i.propTypes={children:l.node,selected:l.bool,togglable:l.bool,icon:l.string,svgIcon:t.svgIconPropType,iconClass:l.string,imageUrl:l.string,imageAlt:l.string,size:l.oneOf([null,"small","medium","large"]),rounded:l.oneOf([null,"small","medium","large","full"]),fillMode:l.oneOf([null,"flat","link","outline","solid","clear"]),themeColor:l.oneOf([null,"base","primary","secondary","tertiary","info","success","warning","error","dark","light","inverse"])},i.defaultProps={togglable:!1,size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};let u=i;u.contextType=t.UnstyledContext;exports.Button=u;
|
package/Button.mjs
CHANGED
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as i from "react";
|
|
10
10
|
import t from "prop-types";
|
|
11
|
-
import { validatePackage as
|
|
12
|
-
import { packageMetadata as
|
|
13
|
-
function
|
|
14
|
-
return
|
|
11
|
+
import { validatePackage as A, svgIconPropType as M, classNames as n, uButton as r, UnstyledContext as z, IconWrap as O } from "@progress/kendo-react-common";
|
|
12
|
+
import { packageMetadata as w } from "./package-metadata.mjs";
|
|
13
|
+
function R({ imageUrl: h, name: e, iconClass: s, svgIcon: c, imageAlt: a, buttonClasses: o }) {
|
|
14
|
+
return h ? /* @__PURE__ */ i.createElement("img", { role: "presentation", className: n(r.icon({ c: o })), alt: a, src: h }) : e || c ? /* @__PURE__ */ i.createElement(O, { className: n(r.icon({ c: o })), name: e, icon: c }) : s ? /* @__PURE__ */ i.createElement("span", { role: "presentation", className: n(r.icon({ c: o }), s) }) : null;
|
|
15
15
|
}
|
|
16
|
-
const l = class l extends
|
|
16
|
+
const l = class l extends i.Component {
|
|
17
17
|
constructor(e) {
|
|
18
18
|
super(e), this._element = null, this.handleClick = (s) => {
|
|
19
19
|
this.toggleIfApplicable(), this.props.onClick && this.props.onClick.call(void 0, s);
|
|
20
|
-
},
|
|
20
|
+
}, A(w), this.state = { selected: this.props.togglable === !0 && this.props.selected === !0 };
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Gets the DOM element of the Button component.
|
|
@@ -45,53 +45,56 @@ const l = class l extends o.Component {
|
|
|
45
45
|
const {
|
|
46
46
|
children: e,
|
|
47
47
|
togglable: s,
|
|
48
|
-
icon:
|
|
49
|
-
iconClass:
|
|
50
|
-
svgIcon:
|
|
48
|
+
icon: c,
|
|
49
|
+
iconClass: a,
|
|
50
|
+
svgIcon: o,
|
|
51
51
|
imageUrl: u,
|
|
52
|
-
imageAlt:
|
|
53
|
-
className:
|
|
54
|
-
startIcon:
|
|
55
|
-
endIcon:
|
|
56
|
-
onClick:
|
|
57
|
-
size:
|
|
58
|
-
rounded:
|
|
59
|
-
fillMode:
|
|
60
|
-
themeColor:
|
|
61
|
-
...
|
|
62
|
-
} = this.props,
|
|
63
|
-
name:
|
|
64
|
-
svgIcon:
|
|
65
|
-
iconClass:
|
|
52
|
+
imageAlt: b,
|
|
53
|
+
className: C,
|
|
54
|
+
startIcon: g,
|
|
55
|
+
endIcon: f,
|
|
56
|
+
onClick: S,
|
|
57
|
+
size: k = l.defaultProps.size,
|
|
58
|
+
rounded: E = l.defaultProps.rounded,
|
|
59
|
+
fillMode: P = l.defaultProps.fillMode,
|
|
60
|
+
themeColor: y = l.defaultProps.themeColor,
|
|
61
|
+
...I
|
|
62
|
+
} = this.props, N = o !== void 0 || c !== void 0 || a !== void 0 || u !== void 0, T = e !== void 0, d = this.context && this.context.uButton, x = R({
|
|
63
|
+
name: c,
|
|
64
|
+
svgIcon: o,
|
|
65
|
+
iconClass: a,
|
|
66
66
|
imageUrl: u,
|
|
67
|
-
imageAlt:
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
imageAlt: b,
|
|
68
|
+
buttonClasses: d
|
|
69
|
+
}), v = (m) => i.cloneElement(
|
|
70
|
+
m,
|
|
71
|
+
{ className: n(r.icon({ c: d })) }
|
|
72
|
+
);
|
|
73
|
+
return /* @__PURE__ */ i.createElement(
|
|
70
74
|
"button",
|
|
71
75
|
{
|
|
72
|
-
ref: (
|
|
76
|
+
ref: (m) => this._element = m,
|
|
73
77
|
"aria-pressed": s ? this.state.selected : void 0,
|
|
74
|
-
...
|
|
78
|
+
...I,
|
|
75
79
|
onClick: this.handleClick,
|
|
76
|
-
className:
|
|
77
|
-
"k-button",
|
|
80
|
+
className: n(r.wrapper(
|
|
78
81
|
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
)
|
|
82
|
+
c: d,
|
|
83
|
+
isRtl: this.props.dir === "rtl",
|
|
84
|
+
selected: this.state.selected,
|
|
85
|
+
disabled: this.props.disabled,
|
|
86
|
+
size: k,
|
|
87
|
+
fillMode: P,
|
|
88
|
+
rounded: E,
|
|
89
|
+
themeColor: y,
|
|
90
|
+
iconButton: !T && N
|
|
91
|
+
}
|
|
92
|
+
), C)
|
|
90
93
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
e && /* @__PURE__ */
|
|
94
|
-
|
|
94
|
+
g && v(g),
|
|
95
|
+
x,
|
|
96
|
+
e && /* @__PURE__ */ i.createElement("span", { className: n(r.text({ c: d })) }, e),
|
|
97
|
+
f && v(f)
|
|
95
98
|
);
|
|
96
99
|
}
|
|
97
100
|
toggleIfApplicable() {
|
|
@@ -106,7 +109,7 @@ l.propTypes = {
|
|
|
106
109
|
selected: t.bool,
|
|
107
110
|
togglable: t.bool,
|
|
108
111
|
icon: t.string,
|
|
109
|
-
svgIcon:
|
|
112
|
+
svgIcon: M,
|
|
110
113
|
iconClass: t.string,
|
|
111
114
|
imageUrl: t.string,
|
|
112
115
|
imageAlt: t.string,
|
|
@@ -122,7 +125,8 @@ l.propTypes = {
|
|
|
122
125
|
fillMode: "solid",
|
|
123
126
|
themeColor: "base"
|
|
124
127
|
};
|
|
125
|
-
let
|
|
128
|
+
let p = l;
|
|
129
|
+
p.contextType = z;
|
|
126
130
|
export {
|
|
127
|
-
|
|
131
|
+
p as Button
|
|
128
132
|
};
|
package/ListButton/ButtonItem.js
CHANGED
|
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),c=require("@progress/kendo-react-common");function I(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,d.get?d:{enumerable:!0,get:()=>e[a]})}}return n.default=e,Object.freeze(n)}const t=I(s),o=e=>{const n=c.useUnstyled(),a=n&&n.uDropDownButton,d=t.useCallback(u=>{e.onClick(u,e.index)},[e]),l=e.dataItem.render||e.item||(e.item===void 0?e.render:null),i=e.dataItem.text!==void 0?e.dataItem.text:e.textField?e.dataItem[e.textField]:e.dataItem,m=t.createElement("li",{id:e.id,className:c.classNames(c.uDropDownButton.li({c:a,focused:e.focused}),e.className),tabIndex:-1,onClick:d,onMouseDown:e.onDown,onPointerDown:e.onDown,role:"menuitem","aria-disabled":e.dataItem.disabled||void 0},t.createElement("span",{tabIndex:-1,className:c.classNames(c.uDropDownButton.link({c:a,selected:e.dataItem.selected,disabled:e.dataItem.disabled})),key:"icon"},l?t.createElement(l,{item:e.dataItem,itemIndex:e.index}):t.createElement(t.Fragment,null,(e.dataItem.icon||e.dataItem.iconClass||e.dataItem.svgIcon)&&t.createElement(c.IconWrap,{className:e.dataItem.iconClass,name:e.dataItem.icon,icon:e.dataItem.svgIcon}),e.dataItem.imageUrl&&t.createElement("img",{role:"presentation",alt:"",src:e.dataItem.imageUrl,className:"k-icon"}),i&&t.createElement("span",{className:"k-menu-link-text"},i))));return e.item!==void 0&&e.render!==void 0?e.render.call(void 0,m,e):m};o.displayName="KendoReactButtonItem";exports.ButtonItem=o;
|
|
@@ -7,24 +7,23 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as t from "react";
|
|
10
|
-
import { classNames as
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
(
|
|
14
|
-
e.onClick(
|
|
10
|
+
import { useUnstyled as s, classNames as i, uDropDownButton as c, IconWrap as u } from "@progress/kendo-react-common";
|
|
11
|
+
const x = (e) => {
|
|
12
|
+
const a = s(), n = a && a.uDropDownButton, I = t.useCallback(
|
|
13
|
+
(o) => {
|
|
14
|
+
e.onClick(o, e.index);
|
|
15
15
|
},
|
|
16
16
|
[e]
|
|
17
|
-
),
|
|
17
|
+
), d = e.dataItem.render || e.item || (e.item === void 0 ? e.render : null), m = e.dataItem.text !== void 0 ? e.dataItem.text : e.textField ? e.dataItem[e.textField] : e.dataItem, l = /* @__PURE__ */ t.createElement(
|
|
18
18
|
"li",
|
|
19
19
|
{
|
|
20
20
|
id: e.id,
|
|
21
|
-
className:
|
|
22
|
-
|
|
23
|
-
e.
|
|
24
|
-
|
|
25
|
-
),
|
|
21
|
+
className: i(c.li({
|
|
22
|
+
c: n,
|
|
23
|
+
focused: e.focused
|
|
24
|
+
}), e.className),
|
|
26
25
|
tabIndex: -1,
|
|
27
|
-
onClick:
|
|
26
|
+
onClick: I,
|
|
28
27
|
onMouseDown: e.onDown,
|
|
29
28
|
onPointerDown: e.onDown,
|
|
30
29
|
role: "menuitem",
|
|
@@ -34,16 +33,14 @@ const I = (e) => {
|
|
|
34
33
|
"span",
|
|
35
34
|
{
|
|
36
35
|
tabIndex: -1,
|
|
37
|
-
className:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
),
|
|
36
|
+
className: i(c.link({
|
|
37
|
+
c: n,
|
|
38
|
+
selected: e.dataItem.selected,
|
|
39
|
+
disabled: e.dataItem.disabled
|
|
40
|
+
})),
|
|
44
41
|
key: "icon"
|
|
45
42
|
},
|
|
46
|
-
|
|
43
|
+
d ? /* @__PURE__ */ t.createElement(d, { item: e.dataItem, itemIndex: e.index }) : /* @__PURE__ */ t.createElement(t.Fragment, null, (e.dataItem.icon || e.dataItem.iconClass || e.dataItem.svgIcon) && /* @__PURE__ */ t.createElement(u, { className: e.dataItem.iconClass, name: e.dataItem.icon, icon: e.dataItem.svgIcon }), e.dataItem.imageUrl && /* @__PURE__ */ t.createElement(
|
|
47
44
|
"img",
|
|
48
45
|
{
|
|
49
46
|
role: "presentation",
|
|
@@ -51,13 +48,13 @@ const I = (e) => {
|
|
|
51
48
|
src: e.dataItem.imageUrl,
|
|
52
49
|
className: "k-icon"
|
|
53
50
|
}
|
|
54
|
-
),
|
|
51
|
+
), m && /* @__PURE__ */ t.createElement("span", { className: "k-menu-link-text" }, m))
|
|
55
52
|
)
|
|
56
53
|
);
|
|
57
54
|
return e.item !== void 0 && /* to be removed in 5.0.0 */
|
|
58
|
-
e.render !== void 0 ? e.render.call(void 0,
|
|
55
|
+
e.render !== void 0 ? e.render.call(void 0, l, e) : l;
|
|
59
56
|
};
|
|
60
|
-
|
|
57
|
+
x.displayName = "KendoReactButtonItem";
|
|
61
58
|
export {
|
|
62
|
-
|
|
59
|
+
x as ButtonItem
|
|
63
60
|
};
|
|
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("react"),i=require("prop-types"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("react"),i=require("prop-types"),F=require("../Button.js"),e=require("@progress/kendo-react-common"),P=require("./utils/navigation.js"),A=require("./DropDownButtonItem.js"),M=require("./ButtonItem.js"),R=require("@progress/kendo-react-popup"),f=require("./utils/popup.js"),q=require("../package-metadata.js");function N(c){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(o,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return o.default=c,Object.freeze(o)}const u=N(K),d=class d extends u.Component{constructor(o){super(o),this.state={opened:!1,focused:!1,focusedIndex:-1},this.mainButton=null,this.list=null,this.skipFocus=!1,this.buttonsData=[],this.onKeyDown=t=>{const{focusedIndex:s}=this.state;if(t.altKey){!this.opened&&t.keyCode===e.Keys.down?(t.preventDefault(),this.setOpen(!0,t),this.setState({focusedIndex:0})):this.opened&&t.keyCode===e.Keys.up&&(t.preventDefault(),this.setState({focusedIndex:-1}),this.setOpen(!1,t));return}const n={...this.state};if(t.keyCode===e.Keys.enter||t.keyCode===e.Keys.space){t.preventDefault(),s>=0&&this.dispatchClickEvent(t,s);const r=!this.opened;this.setState({focused:!0,focusedIndex:r?0:-1}),this.setOpen(r,t);return}if(this.opened&&t.keyCode===e.Keys.esc){this.setState({focusedIndex:-1}),this.setOpen(!1,t);return}if(this.opened){const r=P.navigate(s,t.keyCode,t.altKey,this.buttonsData.length);n.focusedIndex=r;const a=t.keyCode===e.Keys.up||t.keyCode===e.Keys.down||t.keyCode===e.Keys.left||t.keyCode===e.Keys.right;!t.altKey&&(a||t.keyCode===e.Keys.home||t.keyCode===e.Keys.end)&&t.preventDefault()}this.setState(n)},this.switchFocus=t=>{this.skipFocus=!0,t(),window.setTimeout(()=>this.skipFocus=!1,0)},this.handleFocus=t=>{this.skipFocus||(this.setState({focused:!0,focusedIndex:this.opened?0:-1}),e.dispatchEvent(this.props.onFocus,t,this,void 0))},this.handleButtonBlur=t=>{this.opened||(this.setState({focused:!1}),e.dispatchEvent(this.props.onBlur,t,this,void 0))},this.handleMenuBlur=t=>{this.skipFocus||(this.setState({focused:!1,focusedIndex:-1}),e.dispatchEvent(this.props.onBlur,t,this,void 0),setTimeout(()=>{this.setOpen(!1,t)},0))},this.setOpen=(t,s)=>{this.opened!==t&&(this.openedDuringOnChange=t,this.setState({opened:t}),s?this.dispatchPopupEvent(s,t):this.openedDuringOnChange=void 0)},this.onItemClick=(t,s)=>{this.setState({focusedIndex:-1}),this.dispatchClickEvent(t,s),this.setOpen(!1,t)},this.onItemDown=t=>{e.getActiveElement(document)===this.list&&t.preventDefault()},this.mouseDown=t=>{t.preventDefault();const s=e.getActiveElement(document);this.element&&s!==this.element&&s!==this.list&&this.element.focus()},this.onPopupClose=t=>{var n;const s=e.getActiveElement(document);this.element&&this.element.removeAttribute("tabindex"),(s===this.list||(n=this.list)!=null&&n.contains(s))&&this.switchFocus(()=>{this.element&&this.element.focus({preventScroll:!0})}),this.props.popupSettings&&this.props.popupSettings.onClose&&this.props.popupSettings.onClose.call(void 0,t)},this.listRef=t=>{this.list=t,t&&this.state.focused&&this.switchFocus(()=>{t.focus({preventScroll:!0}),this.element&&(this.element.tabIndex=-1)})},this.onClickMainButton=t=>{if(!this.buttonsData.length)return;const s=!this.opened;this.setState({focused:!0,focusedIndex:s?0:-1}),this.setOpen(s,t)},this.dispatchPopupEvent=(t,s)=>{e.dispatchEvent(s?this.props.onOpen:this.props.onClose,t,this,void 0),this.openedDuringOnChange=void 0},e.validatePackage(q.packageMetadata)}get guid(){return this.props.id+"-accessibility-id"}get opened(){return this.openedDuringOnChange!==void 0?this.openedDuringOnChange:this.props.opened===void 0?this.state.opened:this.props.opened}render(){const o=this.isRtl(),t=this.context&&this.context.uDropDownButton,s=o?"rtl":void 0,{id:n,style:r,tabIndex:a,disabled:l,size:m,rounded:g,fillMode:y,themeColor:C,ariaLabel:D,title:b,accessKey:I,icon:k,svgIcon:w,iconClass:B,buttonClass:x,className:O,imageUrl:S,startIcon:v,endIcon:E}=this.props;return this.buttonsData=this.props.items||u.Children.toArray(this.props.children).filter(p=>p&&p.type===A.DropDownButtonItem).map(p=>p.props),u.createElement(u.Fragment,null,u.createElement(F.Button,{id:n,size:m,style:r,rounded:g,fillMode:y,themeColor:C,onClick:this.onClickMainButton,onMouseDown:this.mouseDown,onKeyDown:this.onKeyDown,onFocus:this.handleFocus,onBlur:this.handleButtonBlur,"aria-disabled":l?"true":void 0,tabIndex:a,accessKey:I,icon:k,svgIcon:w,iconClass:B,className:e.classNames(x,O,e.uDropDownButton.wrapper({c:t,focused:this.state.focused,disabled:l})),imageUrl:S,dir:s,ref:p=>this.mainButton=p&&p.element,type:"button","aria-haspopup":"true","aria-expanded":this.opened?"true":"false","aria-label":D,"aria-controls":this.opened?this.guid:void 0,title:b,startIcon:v,endIcon:E},this.props.text),this.renderPopup(o))}componentDidMount(){(this.props.dir===void 0&&this.isRtl()||this.opened)&&this.forceUpdate()}get element(){return this.mainButton}dispatchClickEvent(o,t){this.isItemDisabled(t)||e.dispatchEvent(this.props.onItemClick,o,this,{item:this.buttonsData[t],itemIndex:t})}renderPopup(o){const{popupSettings:t={},id:s}=this.props,n=this.context&&this.context.uDropDownButton,{focusedIndex:r}=this.state;return u.createElement(R.Popup,{anchor:this.mainButton,show:this.opened,animate:t.animate,popupClass:e.classNames(e.uDropDownButton.popup({c:n}),t.popupClass),anchorAlign:t.anchorAlign||f.getAnchorAlign(o),popupAlign:t.popupAlign||f.getPopupAlign(o),style:o?{direction:"rtl"}:void 0,onClose:this.onPopupClose},u.createElement("ul",{role:"list",id:this.guid,tabIndex:-1,"aria-activedescendant":r>=0?`${this.guid}-${r}`:void 0,ref:this.listRef,onKeyDown:this.onKeyDown,onBlur:this.handleMenuBlur,className:e.classNames(e.uDropDownButton.ul({c:n,size:this.props.size}))},this.renderChildItems()))}renderChildItems(){const{item:o,itemRender:t,textField:s}=this.props,n=this.context&&this.context.uDropDownButton;return this.buttonsData.length>0?this.buttonsData.map((r,a)=>u.createElement(M.ButtonItem,{className:e.classNames(e.uDropDownButton.item({c:n})),dataItem:r,textField:s,focused:this.state.focusedIndex===a,onClick:this.onItemClick,onDown:this.onItemDown,render:t,item:o,index:a,key:a,id:`${this.guid}-${a}`})):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.mainButton&&getComputedStyle(this.mainButton).direction==="rtl"}};d.propTypes={accessKey:i.string,ariaLabel:i.string,title:i.string,onFocus:i.func,onBlur:i.func,onItemClick:i.func,onOpen:i.func,onClose:i.func,items:i.arrayOf(i.any),textField:i.string,tabIndex:i.number,disabled:i.bool,icon:i.string,svgIcon:e.svgIconPropType,iconClass:i.string,imageUrl:i.string,popupSettings:i.object,itemRender:i.func,item:i.func,className:i.string,buttonClass:i.string,dir:i.string},d.defaultProps={size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};let h=d;h.contextType=e.UnstyledContext;exports.DropDownButton=h;
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as p from "react";
|
|
10
10
|
import s from "prop-types";
|
|
11
|
-
import { Button as
|
|
12
|
-
import { Keys as r, dispatchEvent as
|
|
13
|
-
import { navigate as
|
|
14
|
-
import { DropDownButtonItem as
|
|
11
|
+
import { Button as P } from "../Button.mjs";
|
|
12
|
+
import { Keys as r, dispatchEvent as d, getActiveElement as m, validatePackage as A, svgIconPropType as M, classNames as u, uDropDownButton as l, UnstyledContext as R } from "@progress/kendo-react-common";
|
|
13
|
+
import { navigate as N } from "./utils/navigation.mjs";
|
|
14
|
+
import { DropDownButtonItem as T } from "./DropDownButtonItem.mjs";
|
|
15
15
|
import { ButtonItem as z } from "./ButtonItem.mjs";
|
|
16
|
-
import { Popup as
|
|
17
|
-
import { getAnchorAlign as
|
|
18
|
-
import { packageMetadata as
|
|
19
|
-
const
|
|
16
|
+
import { Popup as U } from "@progress/kendo-react-popup";
|
|
17
|
+
import { getAnchorAlign as $, getPopupAlign as L } from "./utils/popup.mjs";
|
|
18
|
+
import { packageMetadata as j } from "../package-metadata.mjs";
|
|
19
|
+
const c = class c extends p.Component {
|
|
20
20
|
constructor(i) {
|
|
21
21
|
super(i), this.state = {
|
|
22
22
|
opened: !1,
|
|
@@ -43,25 +43,25 @@ const u = class u extends p.Component {
|
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
if (this.opened) {
|
|
46
|
-
const n =
|
|
46
|
+
const n = N(
|
|
47
47
|
e,
|
|
48
48
|
t.keyCode,
|
|
49
49
|
t.altKey,
|
|
50
50
|
this.buttonsData.length
|
|
51
51
|
);
|
|
52
52
|
o.focusedIndex = n;
|
|
53
|
-
const
|
|
54
|
-
!t.altKey && (
|
|
53
|
+
const h = t.keyCode === r.up || t.keyCode === r.down || t.keyCode === r.left || t.keyCode === r.right;
|
|
54
|
+
!t.altKey && (h || t.keyCode === r.home || t.keyCode === r.end) && t.preventDefault();
|
|
55
55
|
}
|
|
56
56
|
this.setState(o);
|
|
57
57
|
}, this.switchFocus = (t) => {
|
|
58
58
|
this.skipFocus = !0, t(), window.setTimeout(() => this.skipFocus = !1, 0);
|
|
59
59
|
}, this.handleFocus = (t) => {
|
|
60
|
-
this.skipFocus || (this.setState({ focused: !0, focusedIndex: this.opened ? 0 : -1 }),
|
|
60
|
+
this.skipFocus || (this.setState({ focused: !0, focusedIndex: this.opened ? 0 : -1 }), d(this.props.onFocus, t, this, void 0));
|
|
61
61
|
}, this.handleButtonBlur = (t) => {
|
|
62
|
-
this.opened || (this.setState({ focused: !1 }),
|
|
62
|
+
this.opened || (this.setState({ focused: !1 }), d(this.props.onBlur, t, this, void 0));
|
|
63
63
|
}, this.handleMenuBlur = (t) => {
|
|
64
|
-
this.skipFocus || (this.setState({ focused: !1, focusedIndex: -1 }),
|
|
64
|
+
this.skipFocus || (this.setState({ focused: !1, focusedIndex: -1 }), d(this.props.onBlur, t, this, void 0), setTimeout(() => {
|
|
65
65
|
this.setOpen(!1, t);
|
|
66
66
|
}, 0));
|
|
67
67
|
}, this.setOpen = (t, e) => {
|
|
@@ -69,14 +69,14 @@ const u = class u extends p.Component {
|
|
|
69
69
|
}, this.onItemClick = (t, e) => {
|
|
70
70
|
this.setState({ focusedIndex: -1 }), this.dispatchClickEvent(t, e), this.setOpen(!1, t);
|
|
71
71
|
}, this.onItemDown = (t) => {
|
|
72
|
-
|
|
72
|
+
m(document) === this.list && t.preventDefault();
|
|
73
73
|
}, this.mouseDown = (t) => {
|
|
74
74
|
t.preventDefault();
|
|
75
|
-
const e =
|
|
75
|
+
const e = m(document);
|
|
76
76
|
this.element && e !== this.element && e !== this.list && this.element.focus();
|
|
77
77
|
}, this.onPopupClose = (t) => {
|
|
78
78
|
var o;
|
|
79
|
-
const e =
|
|
79
|
+
const e = m(document);
|
|
80
80
|
this.element && this.element.removeAttribute("tabindex"), (e === this.list || (o = this.list) != null && o.contains(e)) && this.switchFocus(() => {
|
|
81
81
|
this.element && this.element.focus({ preventScroll: !0 });
|
|
82
82
|
}), this.props.popupSettings && this.props.popupSettings.onClose && this.props.popupSettings.onClose.call(void 0, t);
|
|
@@ -93,8 +93,8 @@ const u = class u extends p.Component {
|
|
|
93
93
|
focusedIndex: e ? 0 : -1
|
|
94
94
|
}), this.setOpen(e, t);
|
|
95
95
|
}, this.dispatchPopupEvent = (t, e) => {
|
|
96
|
-
|
|
97
|
-
},
|
|
96
|
+
d(e ? this.props.onOpen : this.props.onClose, t, this, void 0), this.openedDuringOnChange = void 0;
|
|
97
|
+
}, A(j);
|
|
98
98
|
}
|
|
99
99
|
get guid() {
|
|
100
100
|
return this.props.id + "-accessibility-id";
|
|
@@ -106,66 +106,67 @@ const u = class u extends p.Component {
|
|
|
106
106
|
* @hidden
|
|
107
107
|
*/
|
|
108
108
|
render() {
|
|
109
|
-
const i = this.isRtl(), t = i ? "rtl" : void 0, {
|
|
110
|
-
id:
|
|
111
|
-
style:
|
|
112
|
-
tabIndex:
|
|
113
|
-
disabled:
|
|
114
|
-
size:
|
|
115
|
-
rounded:
|
|
116
|
-
fillMode:
|
|
117
|
-
themeColor:
|
|
118
|
-
ariaLabel:
|
|
119
|
-
title:
|
|
120
|
-
accessKey:
|
|
121
|
-
icon:
|
|
122
|
-
svgIcon:
|
|
109
|
+
const i = this.isRtl(), t = this.context && this.context.uDropDownButton, e = i ? "rtl" : void 0, {
|
|
110
|
+
id: o,
|
|
111
|
+
style: n,
|
|
112
|
+
tabIndex: h,
|
|
113
|
+
disabled: g,
|
|
114
|
+
size: C,
|
|
115
|
+
rounded: y,
|
|
116
|
+
fillMode: D,
|
|
117
|
+
themeColor: b,
|
|
118
|
+
ariaLabel: I,
|
|
119
|
+
title: k,
|
|
120
|
+
accessKey: x,
|
|
121
|
+
icon: w,
|
|
122
|
+
svgIcon: B,
|
|
123
123
|
iconClass: S,
|
|
124
|
-
buttonClass:
|
|
125
|
-
className:
|
|
126
|
-
imageUrl:
|
|
127
|
-
startIcon:
|
|
128
|
-
endIcon:
|
|
124
|
+
buttonClass: O,
|
|
125
|
+
className: F,
|
|
126
|
+
imageUrl: E,
|
|
127
|
+
startIcon: v,
|
|
128
|
+
endIcon: K
|
|
129
129
|
} = this.props;
|
|
130
|
-
return this.buttonsData = this.props.items || p.Children.toArray(this.props.children).filter((a) => a && a.type ===
|
|
131
|
-
|
|
130
|
+
return this.buttonsData = this.props.items || p.Children.toArray(this.props.children).filter((a) => a && a.type === T).map((a) => a.props), /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement(
|
|
131
|
+
P,
|
|
132
132
|
{
|
|
133
|
-
id:
|
|
134
|
-
size:
|
|
135
|
-
style:
|
|
136
|
-
rounded:
|
|
137
|
-
fillMode:
|
|
138
|
-
themeColor:
|
|
133
|
+
id: o,
|
|
134
|
+
size: C,
|
|
135
|
+
style: n,
|
|
136
|
+
rounded: y,
|
|
137
|
+
fillMode: D,
|
|
138
|
+
themeColor: b,
|
|
139
139
|
onClick: this.onClickMainButton,
|
|
140
140
|
onMouseDown: this.mouseDown,
|
|
141
141
|
onKeyDown: this.onKeyDown,
|
|
142
142
|
onFocus: this.handleFocus,
|
|
143
143
|
onBlur: this.handleButtonBlur,
|
|
144
|
-
"aria-disabled":
|
|
145
|
-
tabIndex:
|
|
146
|
-
accessKey:
|
|
147
|
-
icon:
|
|
148
|
-
svgIcon:
|
|
144
|
+
"aria-disabled": g ? "true" : void 0,
|
|
145
|
+
tabIndex: h,
|
|
146
|
+
accessKey: x,
|
|
147
|
+
icon: w,
|
|
148
|
+
svgIcon: B,
|
|
149
149
|
iconClass: S,
|
|
150
|
-
className:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
className: u(
|
|
151
|
+
O,
|
|
152
|
+
F,
|
|
153
|
+
l.wrapper({
|
|
154
|
+
c: t,
|
|
155
|
+
focused: this.state.focused,
|
|
156
|
+
disabled: g
|
|
157
|
+
})
|
|
157
158
|
),
|
|
158
|
-
imageUrl:
|
|
159
|
-
dir:
|
|
159
|
+
imageUrl: E,
|
|
160
|
+
dir: e,
|
|
160
161
|
ref: (a) => this.mainButton = a && a.element,
|
|
161
162
|
type: "button",
|
|
162
163
|
"aria-haspopup": "true",
|
|
163
164
|
"aria-expanded": this.opened ? "true" : "false",
|
|
164
|
-
"aria-label":
|
|
165
|
+
"aria-label": I,
|
|
165
166
|
"aria-controls": this.opened ? this.guid : void 0,
|
|
166
|
-
title:
|
|
167
|
-
startIcon:
|
|
168
|
-
endIcon:
|
|
167
|
+
title: k,
|
|
168
|
+
startIcon: v,
|
|
169
|
+
endIcon: K
|
|
169
170
|
},
|
|
170
171
|
this.props.text
|
|
171
172
|
), this.renderPopup(i));
|
|
@@ -183,7 +184,7 @@ const u = class u extends p.Component {
|
|
|
183
184
|
return this.mainButton;
|
|
184
185
|
}
|
|
185
186
|
dispatchClickEvent(i, t) {
|
|
186
|
-
this.isItemDisabled(t) ||
|
|
187
|
+
this.isItemDisabled(t) || d(
|
|
187
188
|
this.props.onItemClick,
|
|
188
189
|
i,
|
|
189
190
|
this,
|
|
@@ -194,16 +195,16 @@ const u = class u extends p.Component {
|
|
|
194
195
|
);
|
|
195
196
|
}
|
|
196
197
|
renderPopup(i) {
|
|
197
|
-
const { popupSettings: t = {}, id: e } = this.props, { focusedIndex:
|
|
198
|
+
const { popupSettings: t = {}, id: e } = this.props, o = this.context && this.context.uDropDownButton, { focusedIndex: n } = this.state;
|
|
198
199
|
return /* @__PURE__ */ p.createElement(
|
|
199
|
-
|
|
200
|
+
U,
|
|
200
201
|
{
|
|
201
202
|
anchor: this.mainButton,
|
|
202
203
|
show: this.opened,
|
|
203
204
|
animate: t.animate,
|
|
204
|
-
popupClass:
|
|
205
|
-
anchorAlign: t.anchorAlign ||
|
|
206
|
-
popupAlign: t.popupAlign ||
|
|
205
|
+
popupClass: u(l.popup({ c: o }), t.popupClass),
|
|
206
|
+
anchorAlign: t.anchorAlign || $(i),
|
|
207
|
+
popupAlign: t.popupAlign || L(i),
|
|
207
208
|
style: i ? { direction: "rtl" } : void 0,
|
|
208
209
|
onClose: this.onPopupClose
|
|
209
210
|
},
|
|
@@ -213,34 +214,35 @@ const u = class u extends p.Component {
|
|
|
213
214
|
role: "list",
|
|
214
215
|
id: this.guid,
|
|
215
216
|
tabIndex: -1,
|
|
216
|
-
"aria-activedescendant":
|
|
217
|
+
"aria-activedescendant": n >= 0 ? `${this.guid}-${n}` : void 0,
|
|
217
218
|
ref: this.listRef,
|
|
218
219
|
onKeyDown: this.onKeyDown,
|
|
219
220
|
onBlur: this.handleMenuBlur,
|
|
220
|
-
className:
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
className: u(l.ul({
|
|
222
|
+
c: o,
|
|
223
|
+
size: this.props.size
|
|
224
|
+
}))
|
|
223
225
|
},
|
|
224
226
|
this.renderChildItems()
|
|
225
227
|
)
|
|
226
228
|
);
|
|
227
229
|
}
|
|
228
230
|
renderChildItems() {
|
|
229
|
-
const { item: i, itemRender: t, textField: e } = this.props;
|
|
230
|
-
return this.buttonsData.length > 0 ? this.buttonsData.map((
|
|
231
|
+
const { item: i, itemRender: t, textField: e } = this.props, o = this.context && this.context.uDropDownButton;
|
|
232
|
+
return this.buttonsData.length > 0 ? this.buttonsData.map((n, h) => /* @__PURE__ */ p.createElement(
|
|
231
233
|
z,
|
|
232
234
|
{
|
|
233
|
-
className:
|
|
234
|
-
dataItem:
|
|
235
|
+
className: u(l.item({ c: o })),
|
|
236
|
+
dataItem: n,
|
|
235
237
|
textField: e,
|
|
236
|
-
focused: this.state.focusedIndex ===
|
|
238
|
+
focused: this.state.focusedIndex === h,
|
|
237
239
|
onClick: this.onItemClick,
|
|
238
240
|
onDown: this.onItemDown,
|
|
239
241
|
render: t,
|
|
240
242
|
item: i,
|
|
241
|
-
index:
|
|
242
|
-
key:
|
|
243
|
-
id: `${this.guid}-${
|
|
243
|
+
index: h,
|
|
244
|
+
key: h,
|
|
245
|
+
id: `${this.guid}-${h}`
|
|
244
246
|
}
|
|
245
247
|
)) : null;
|
|
246
248
|
}
|
|
@@ -251,7 +253,7 @@ const u = class u extends p.Component {
|
|
|
251
253
|
return this.props.dir !== void 0 ? this.props.dir === "rtl" : !!this.mainButton && getComputedStyle(this.mainButton).direction === "rtl";
|
|
252
254
|
}
|
|
253
255
|
};
|
|
254
|
-
|
|
256
|
+
c.propTypes = {
|
|
255
257
|
accessKey: s.string,
|
|
256
258
|
ariaLabel: s.string,
|
|
257
259
|
title: s.string,
|
|
@@ -265,7 +267,7 @@ u.propTypes = {
|
|
|
265
267
|
tabIndex: s.number,
|
|
266
268
|
disabled: s.bool,
|
|
267
269
|
icon: s.string,
|
|
268
|
-
svgIcon:
|
|
270
|
+
svgIcon: M,
|
|
269
271
|
iconClass: s.string,
|
|
270
272
|
imageUrl: s.string,
|
|
271
273
|
popupSettings: s.object,
|
|
@@ -274,13 +276,14 @@ u.propTypes = {
|
|
|
274
276
|
className: s.string,
|
|
275
277
|
buttonClass: s.string,
|
|
276
278
|
dir: s.string
|
|
277
|
-
},
|
|
279
|
+
}, c.defaultProps = {
|
|
278
280
|
size: "medium",
|
|
279
281
|
rounded: "medium",
|
|
280
282
|
fillMode: "solid",
|
|
281
283
|
themeColor: "base"
|
|
282
284
|
};
|
|
283
|
-
let
|
|
285
|
+
let f = c;
|
|
286
|
+
f.contextType = R;
|
|
284
287
|
export {
|
|
285
|
-
|
|
288
|
+
f as DropDownButton
|
|
286
289
|
};
|
|
@@ -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
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-popup"),require("@progress/kendo-svg-icons")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-popup","@progress/kendo-svg-icons"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactButtons={},e.React,e.PropTypes,e.KendoReactCommon,e.KendoReactPopup,e.KendoSvgIcons)}(this,(function(e,t,s,n,o,i){"use strict";function a(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var r=a(t);const l={name:"@progress/kendo-react-buttons",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};const d=class e extends r.Component{constructor(e){super(e),this._element=null,this.handleClick=e=>{this.toggleIfApplicable(),this.props.onClick&&this.props.onClick.call(void 0,e)},n.validatePackage(l),this.state={selected:!0===this.props.togglable&&!0===this.props.selected}}get element(){return this._element}get selected(){return void 0!==this._selectedTemp?this._selectedTemp:this.state.selected}static getDerivedStateFromProps(e,t){return e.togglable&&void 0!==e.selected&&e.selected!==t.selected?{selected:e.selected}:null}render(){const{children:t,togglable:s,icon:o,iconClass:i,svgIcon:a,imageUrl:l,imageAlt:d,className:c,startIcon:p,endIcon:u,onClick:h,size:m=e.defaultProps.size,rounded:f=e.defaultProps.rounded,fillMode:g=e.defaultProps.fillMode,themeColor:v=e.defaultProps.themeColor,...b}=this.props,y=void 0!==a||void 0!==o||void 0!==i||void 0!==l,k=void 0!==t,C=function({imageUrl:e,name:t,iconClass:s,svgIcon:o,imageAlt:i}){return e?r.createElement("img",{role:"presentation",className:"k-button-icon",alt:i,src:e}):t||o?r.createElement(n.IconWrap,{className:"k-button-icon",name:t,icon:o}):s?r.createElement("span",{role:"presentation",className:n.classNames("k-button-icon",s)}):null}({name:o,svgIcon:a,iconClass:i,imageUrl:l,imageAlt:d}),I=e=>r.cloneElement(e,{className:"k-button-icon"});return r.createElement("button",{ref:e=>this._element=e,"aria-pressed":s?this.state.selected:void 0,...b,onClick:this.handleClick,className:n.classNames("k-button",{[`k-button-${n.kendoThemeMaps.sizeMap[m]||m}`]:m,[`k-button-${g}`]:g,[`k-button-${g}-${v}`]:!(!g||!v),[`k-rounded-${n.kendoThemeMaps.roundedMap[f]||f}`]:f,"k-icon-button":!k&&y,"k-disabled":this.props.disabled,"k-selected":this.state.selected,"k-rtl":"rtl"===this.props.dir},this.props.className)},p&&I(p),C,t&&r.createElement("span",{className:"k-button-text"},t),u&&I(u))}toggleIfApplicable(){if(this.props.togglable&&void 0===this.props.selected){const e=!this.state.selected;this._selectedTemp=e,this.setState({selected:e},(()=>this._selectedTemp=void 0))}}};d.propTypes={children:s.node,selected:s.bool,togglable:s.bool,icon:s.string,svgIcon:n.svgIconPropType,iconClass:s.string,imageUrl:s.string,imageAlt:s.string,size:s.oneOf([null,"small","medium","large"]),rounded:s.oneOf([null,"small","medium","large","full"]),fillMode:s.oneOf([null,"flat","link","outline","solid","clear"]),themeColor:s.oneOf([null,"base","primary","secondary","tertiary","info","success","warning","error","dark","light","inverse"])},d.defaultProps={togglable:!1,size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};let c=d;const p="k-group-start",u="k-group-end",h="k-button-group",m="k-button-group-stretched",f=":not(.k-dropdownlist button):not(.k-colorpicker button):not(.k-split-button .k-split-button-arrow)",g=["button"+f,".k-button-group > button"+f,".k-colorpicker",".k-dropdownlist"],v=class extends r.Component{constructor(e){super(e),this._element=null,n.validatePackage(l)}render(){const e=this.mapButtons(this.props.children),t=n.classNames([h],{"k-disabled":this.props.disabled,[m]:!!this.props.width},this.props.className),s={className:t,style:{width:`${this.props.width}`},dir:this.props.dir,role:"group","aria-disabled":this.props.disabled};return r.createElement("div",{ref:e=>{this._element=e},...s,className:t},e)}mapButtons(e){const t=r.Children.count(e),s=void 0!==this.props.dir?"rtl"===this.props.dir:this._element&&"rtl"===getComputedStyle(this._element).direction||!1;return r.Children.map(e,((e,n)=>r.isValidElement(e)?this.renderButton(e,n,n===t-1,s):e))}renderButton(e,t,s,o){const i=n.classNames(e.props.className,{[p]:o?s:0===t,[u]:o?0===t:s}),a={...this.props.width?{width:this.props.width}:{},...e.props.style||{}},l=this.props.disabled||e.props.disabled,d={...e.props,...i?{className:i}:{},...Object.keys(a).length?{style:a}:{},...void 0!==l?{disabled:l}:{}};return r.Children.count(e.props.children)>0?r.cloneElement(e,d,e.props.children):r.cloneElement(e,d)}};v.propTypes={children:s.oneOfType([s.arrayOf(s.element),s.element]),className:s.string,disabled:s.bool,width:s.string,dir:s.string};let b=v;const y=e=>{const t=r.useCallback((t=>{e.onClick(t,e.index)}),[e]),s=e.dataItem.render||e.item||(void 0===e.item?e.render:null),o=void 0!==e.dataItem.text?e.dataItem.text:e.textField?e.dataItem[e.textField]:e.dataItem,i=r.createElement("li",{id:e.id,className:n.classNames("k-item",e.className,{"k-focus":e.focused}),tabIndex:-1,onClick:t,onMouseDown:e.onDown,onPointerDown:e.onDown,role:"menuitem","aria-disabled":e.dataItem.disabled||void 0},r.createElement("span",{tabIndex:-1,className:n.classNames("k-link k-menu-link",{"k-selected":e.dataItem.selected,"k-disabled":e.dataItem.disabled}),key:"icon"},s?r.createElement(s,{item:e.dataItem,itemIndex:e.index}):r.createElement(r.Fragment,null,(e.dataItem.icon||e.dataItem.iconClass||e.dataItem.svgIcon)&&r.createElement(n.IconWrap,{className:e.dataItem.iconClass,name:e.dataItem.icon,icon:e.dataItem.svgIcon}),e.dataItem.imageUrl&&r.createElement("img",{role:"presentation",alt:"",src:e.dataItem.imageUrl,className:"k-icon"}),o&&r.createElement("span",{className:"k-menu-link-text"},o))));return void 0!==e.item&&void 0!==e.render?e.render.call(void 0,i,e):i};y.displayName="KendoReactButtonItem";const k=class extends r.Component{render(){return null}};k.propTypes={text:s.string,icon:s.string,iconClass:s.string,imageUrl:s.string,disabled:s.bool,render:s.any};let C=k;const I=(e,t,s,o)=>{if(s)return e;const i=Math.min(o-1,Math.max(0,e));switch(t){case n.Keys.enter:case n.Keys.space:case n.Keys.esc:return-1;case n.Keys.up:case n.Keys.left:return i-1<0?o-1:i-1;case n.Keys.down:case n.Keys.right:return i+1>=o?0:i+1;case n.Keys.home:return 0;case n.Keys.end:return o-1;default:return e}};function x(e){let t={horizontal:"left",vertical:"bottom"};return e&&(t.horizontal="right"),t}function D(e){let t={horizontal:"left",vertical:"top"};return e&&(t.horizontal="right"),t}const E=class extends r.Component{constructor(e){super(e),this.state={focused:!1,focusedIndex:-1,opened:!1},this.wrapper=null,this.mainButton=null,this.list=null,this.skipFocus=!1,this.buttonsData=[],this.onKeyDown=e=>{const{focusedIndex:t}=this.state;if(e.altKey)return void(this.opened||e.keyCode!==n.Keys.down?this.opened&&e.keyCode===n.Keys.up&&(e.preventDefault(),this.setState({focusedIndex:-1}),this.setOpen(!1,e)):(e.preventDefault(),this.setState({focusedIndex:0}),this.setOpen(!0,e)));let s;if(e.keyCode===n.Keys.enter||e.keyCode===n.Keys.space){if(e.preventDefault(),this.dispatchClickEvent(e,t),t>=0){s={focusedIndex:this.opened?-1:0};const t=!this.opened;this.setOpen(t,e)}}else if(this.opened&&e.keyCode===n.Keys.esc)return this.setState({focusedIndex:-1}),void this.setOpen(!1,e);if(this.opened){const o=I(t,e.keyCode,e.altKey,this.buttonsData.length);o!==t&&(s=s||{},s.focusedIndex=o);const i=e.keyCode===n.Keys.up||e.keyCode===n.Keys.down||e.keyCode===n.Keys.left||e.keyCode===n.Keys.right;!e.altKey&&(i||e.keyCode===n.Keys.home||e.keyCode===n.Keys.end)&&e.preventDefault()}s&&this.setState(s)},this.switchFocus=e=>{this.skipFocus=!0,e(),window.setTimeout((()=>this.skipFocus=!1),0)},this.onFocus=e=>{this.skipFocus||(n.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}),n.dispatchEvent(this.props.onBlur,e,this,void 0),setTimeout((()=>{this.setOpen(!1,e)}),0))},this.onPopupClose=e=>{var t;const s=n.getActiveElement(document);this.element&&this.element.removeAttribute("tabindex"),(s===this.list||null!=(t=this.list)&&t.contains(s))&&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=n.getActiveElement(document);this.element&&t!==this.element&&t!==this.list&&this.element.focus()},this.onItemDown=e=>{n.getActiveElement(document)===this.list&&e.preventDefault()},this.dispatchPopupEvent=(e,t)=>{n.dispatchEvent(t?this.props.onOpen:this.props.onClose,e,this,void 0),this.openedDuringOnChange=void 0},n.validatePackage(l)}get guid(){return this.props.id?this.props.id+"-accessibility-id":this.props.id}get opened(){return void 0!==this.openedDuringOnChange?this.openedDuringOnChange:void 0===this.props.opened?this.state.opened:this.props.opened}render(){this.buttonsData=this.props.items||r.Children.toArray(this.props.children).filter((e=>e&&e.type===C)).map((e=>e.props));const e=this.isRtl(),t=e?"rtl":void 0,{id:s,style:o,tabIndex:a,disabled:l}=this.props;return r.createElement("div",{id:s,style:o,className:n.classNames("k-split-button","k-button-group",{"k-focus":this.state.focused},`k-rounded-${n.kendoThemeMaps.roundedMap[this.props.rounded||"medium"]}`,this.props.className),onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,dir:t,ref:e=>this.wrapper=e},r.createElement(c,{ref:e=>this.mainButton=e&&e.element,type:"button",size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,themeColor:this.props.themeColor,onClick:e=>this.onItemClick(e,-1),disabled:l||void 0,tabIndex:a,accessKey:this.props.accessKey,className:this.props.buttonClass,icon:this.props.icon,svgIcon:this.props.svgIcon,iconClass:this.props.iconClass,imageUrl:this.props.imageUrl,dir:t,"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),r.createElement(c,{type:"button",size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,themeColor:this.props.themeColor,icon:"caret-alt-down",svgIcon:i.caretAltDownIcon,className:"k-split-button-arrow",disabled:l||void 0,tabIndex:-1,onClick:this.onSplitPartClick,onMouseDown:this.onDownSplitPart,onPointerDown:this.onDownSplitPart,dir:t,"aria-label":"menu toggling button"}),this.renderPopup(e))}componentDidMount(){(void 0===this.props.dir&&this.isRtl()||this.opened)&&this.forceUpdate()}get element(){return this.mainButton}dispatchClickEvent(e,t){this.isItemDisabled(t)||(-1===t?n.dispatchEvent(this.props.onButtonClick,e,this,void 0):n.dispatchEvent(this.props.onItemClick,e,this,{item:this.buttonsData[t],itemIndex:t}))}renderPopup(e){const{popupSettings:t={}}=this.props,{focusedIndex:s}=this.state;return r.createElement(o.Popup,{anchor:this.wrapper,show:this.opened,animate:t.animate,popupClass:n.classNames("k-menu-popup",t.popupClass),anchorAlign:t.anchorAlign||x(e),popupAlign:t.popupAlign||D(e),style:e?{direction:"rtl"}:void 0,onClose:this.onPopupClose},r.createElement("ul",{role:"menu",id:this.guid,"aria-labelledby":"button-"+this.guid,tabIndex:-1,ref:this.listRef,"aria-activedescendant":s>=0?`${this.guid}-${s}`:void 0,className:n.classNames("k-menu-group",{[`k-menu-group-${n.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size})},this.renderChildItems()))}renderChildItems(){const{item:e,itemRender:t,textField:s}=this.props;return this.buttonsData.length>0?this.buttonsData.map(((n,o)=>r.createElement(y,{className:"k-menu-item",dataItem:n,textField:s,focused:this.state.focusedIndex===o,onClick:this.onItemClick,onDown:this.onItemDown,render:t,item:e,key:o,index:o,id:`${this.guid}-${o}`}))):null}isItemDisabled(e){return this.buttonsData[e]?this.buttonsData[e].disabled:this.props.disabled}isRtl(){return void 0!==this.props.dir?"rtl"===this.props.dir:!!this.wrapper&&"rtl"===getComputedStyle(this.wrapper).direction}};E.propTypes={accessKey:s.string,ariaLabel:s.string,title:s.string,onButtonClick:s.func,onFocus:s.func,onBlur:s.func,onItemClick:s.func,onOpen:s.func,onClose:s.func,text:s.string,items:s.arrayOf(s.any),textField:s.string,tabIndex:s.number,disabled:s.bool,icon:s.string,svgIcon:n.svgIconPropType,iconClass:s.string,imageUrl:s.string,popupSettings:s.object,itemRender:s.any,item:s.func,className:s.string,buttonClass:s.string,dir:s.string},E.defaultProps={size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};let w=E;const N=class extends r.Component{render(){return null}};N.propTypes={text:s.string,icon:s.string,iconClass:s.string,imageUrl:s.string,selected:s.bool,disabled:s.bool,render:s.any};let K=N;const O=class extends r.Component{constructor(e){super(e),this.state={opened:!1,focused:!1,focusedIndex:-1},this.mainButton=null,this.list=null,this.skipFocus=!1,this.buttonsData=[],this.onKeyDown=e=>{const{focusedIndex:t}=this.state;if(e.altKey)return void(this.opened||e.keyCode!==n.Keys.down?this.opened&&e.keyCode===n.Keys.up&&(e.preventDefault(),this.setState({focusedIndex:-1}),this.setOpen(!1,e)):(e.preventDefault(),this.setOpen(!0,e),this.setState({focusedIndex:0})));const s={...this.state};if(e.keyCode===n.Keys.enter||e.keyCode===n.Keys.space){e.preventDefault(),t>=0&&this.dispatchClickEvent(e,t);const s=!this.opened;return this.setState({focused:!0,focusedIndex:s?0:-1}),void this.setOpen(s,e)}if(this.opened&&e.keyCode===n.Keys.esc)return this.setState({focusedIndex:-1}),void this.setOpen(!1,e);if(this.opened){const o=I(t,e.keyCode,e.altKey,this.buttonsData.length);s.focusedIndex=o;const i=e.keyCode===n.Keys.up||e.keyCode===n.Keys.down||e.keyCode===n.Keys.left||e.keyCode===n.Keys.right;!e.altKey&&(i||e.keyCode===n.Keys.home||e.keyCode===n.Keys.end)&&e.preventDefault()}this.setState(s)},this.switchFocus=e=>{this.skipFocus=!0,e(),window.setTimeout((()=>this.skipFocus=!1),0)},this.handleFocus=e=>{this.skipFocus||(this.setState({focused:!0,focusedIndex:this.opened?0:-1}),n.dispatchEvent(this.props.onFocus,e,this,void 0))},this.handleButtonBlur=e=>{this.opened||(this.setState({focused:!1}),n.dispatchEvent(this.props.onBlur,e,this,void 0))},this.handleMenuBlur=e=>{this.skipFocus||(this.setState({focused:!1,focusedIndex:-1}),n.dispatchEvent(this.props.onBlur,e,this,void 0),setTimeout((()=>{this.setOpen(!1,e)}),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.setState({focusedIndex:-1}),this.dispatchClickEvent(e,t),this.setOpen(!1,e)},this.onItemDown=e=>{n.getActiveElement(document)===this.list&&e.preventDefault()},this.mouseDown=e=>{e.preventDefault();const t=n.getActiveElement(document);this.element&&t!==this.element&&t!==this.list&&this.element.focus()},this.onPopupClose=e=>{var t;const s=n.getActiveElement(document);this.element&&this.element.removeAttribute("tabindex"),(s===this.list||null!=(t=this.list)&&t.contains(s))&&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.onClickMainButton=e=>{if(!this.buttonsData.length)return;const t=!this.opened;this.setState({focused:!0,focusedIndex:t?0:-1}),this.setOpen(t,e)},this.dispatchPopupEvent=(e,t)=>{n.dispatchEvent(t?this.props.onOpen:this.props.onClose,e,this,void 0),this.openedDuringOnChange=void 0},n.validatePackage(l)}get guid(){return this.props.id+"-accessibility-id"}get opened(){return void 0!==this.openedDuringOnChange?this.openedDuringOnChange:void 0===this.props.opened?this.state.opened:this.props.opened}render(){const e=this.isRtl(),t=e?"rtl":void 0,{id:s,style:o,tabIndex:i,disabled:a,size:l,rounded:d,fillMode:p,themeColor:u,ariaLabel:h,title:m,accessKey:f,icon:g,svgIcon:v,iconClass:b,buttonClass:y,className:k,imageUrl:C,startIcon:I,endIcon:x}=this.props;return this.buttonsData=this.props.items||r.Children.toArray(this.props.children).filter((e=>e&&e.type===K)).map((e=>e.props)),r.createElement(r.Fragment,null,r.createElement(c,{id:s,size:l,style:o,rounded:d,fillMode:p,themeColor:u,onClick:this.onClickMainButton,onMouseDown:this.mouseDown,onKeyDown:this.onKeyDown,onFocus:this.handleFocus,onBlur:this.handleButtonBlur,"aria-disabled":a?"true":void 0,tabIndex:i,accessKey:f,icon:g,svgIcon:v,iconClass:b,className:n.classNames(y,k,"k-menu-button",{"k-focus":this.state.focused},{"k-disabled":a}),imageUrl:C,dir:t,ref:e=>this.mainButton=e&&e.element,type:"button","aria-haspopup":"true","aria-expanded":this.opened?"true":"false","aria-label":h,"aria-controls":this.opened?this.guid:void 0,title:m,startIcon:I,endIcon:x},this.props.text),this.renderPopup(e))}componentDidMount(){(void 0===this.props.dir&&this.isRtl()||this.opened)&&this.forceUpdate()}get element(){return this.mainButton}dispatchClickEvent(e,t){this.isItemDisabled(t)||n.dispatchEvent(this.props.onItemClick,e,this,{item:this.buttonsData[t],itemIndex:t})}renderPopup(e){const{popupSettings:t={},id:s}=this.props,{focusedIndex:i}=this.state;return r.createElement(o.Popup,{anchor:this.mainButton,show:this.opened,animate:t.animate,popupClass:n.classNames("k-menu-popup",t.popupClass),anchorAlign:t.anchorAlign||x(e),popupAlign:t.popupAlign||D(e),style:e?{direction:"rtl"}:void 0,onClose:this.onPopupClose},r.createElement("ul",{role:"list",id:this.guid,tabIndex:-1,"aria-activedescendant":i>=0?`${this.guid}-${i}`:void 0,ref:this.listRef,onKeyDown:this.onKeyDown,onBlur:this.handleMenuBlur,className:n.classNames("k-menu-group",{[`k-menu-group-${n.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size})},this.renderChildItems()))}renderChildItems(){const{item:e,itemRender:t,textField:s}=this.props;return this.buttonsData.length>0?this.buttonsData.map(((n,o)=>r.createElement(y,{className:"k-menu-item",dataItem:n,textField:s,focused:this.state.focusedIndex===o,onClick:this.onItemClick,onDown:this.onItemDown,render:t,item:e,index:o,key:o,id:`${this.guid}-${o}`}))):null}isItemDisabled(e){return this.buttonsData[e]?this.buttonsData[e].disabled:this.props.disabled}isRtl(){return void 0!==this.props.dir?"rtl"===this.props.dir:!!this.mainButton&&"rtl"===getComputedStyle(this.mainButton).direction}};O.propTypes={accessKey:s.string,ariaLabel:s.string,title:s.string,onFocus:s.func,onBlur:s.func,onItemClick:s.func,onOpen:s.func,onClose:s.func,items:s.arrayOf(s.any),textField:s.string,tabIndex:s.number,disabled:s.bool,icon:s.string,svgIcon:n.svgIconPropType,iconClass:s.string,imageUrl:s.string,popupSettings:s.object,itemRender:s.func,item:s.func,className:s.string,buttonClass:s.string,dir:s.string},O.defaultProps={size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};let S=O;const z=class e extends r.Component{constructor(t){super(t),this._element=null,this.offsetHeight=0,this.offsetWidth=0,this.buttons=[],this.focusedSelector=this.selectors.map((e=>e+":focus")).join(","),this.setTabIndex=t=>{const{tabIndex:s=e.defaultProps.tabIndex}=this.props;this.buttons.forEach(((e,n)=>{e.tabIndex=n===t?s:-1}))},this.onKeyDown=e=>{const t=e.target;if(e.keyCode!==n.Keys.left&&e.keyCode!==n.Keys.right&&e.keyCode!==n.Keys.home&&e.keyCode!==n.Keys.end||e.defaultPrevented||-1===this.buttons.findIndex((e=>e===t)))return;const s=this.focusedIndex;e.keyCode===n.Keys.left?this.focusButton(s,0===s?this.buttons.length-1:s-1):this.focusButton(s,s===this.buttons.length-1?0:s+1),e.keyCode===n.Keys.home&&this.focusButton(s,0),e.keyCode===n.Keys.end&&this.focusButton(s,this.buttons.length-1)},this.onWindowResize=e=>{const t=this.element;if(!t)return;const s=t.offsetWidth,n=t.offsetHeight;if(this.offsetWidth!==s||this.offsetHeight!==n){this.offsetWidth=s,this.offsetHeight=n;const t={offsetWidth:this.offsetWidth,offsetHeight:this.offsetHeight};this.props.onResize&&this.props.onResize.call(void 0,{target:this,...t,nativeEvent:e})}},n.validatePackage(l)}get selectors(){return this.props.buttons||g}get focusedIndex(){const e=this.element&&this.element.querySelector(this.focusedSelector);return Math.max(0,this.buttons.findIndex((t=>t===e)))}get element(){return this._element}componentDidMount(){window.addEventListener("resize",this.onWindowResize);const e=this.element;e&&(this.offsetWidth=e.offsetWidth,this.offsetHeight=e.offsetHeight,!1!==this.props.keyboardNavigation&&(this.buttons=Array.from(e.querySelectorAll(this.selectors.join(","))),this.setTabIndex(0)))}componentDidUpdate(){const e=this.element;!e||!1===this.props.keyboardNavigation||(this.buttons=Array.from(e.querySelectorAll(this.selectors.join(","))),this.setTabIndex(this.focusedIndex))}componentWillUnmount(){window.removeEventListener("resize",this.onWindowResize),this.buttons.length=0}render(){return r.createElement("div",{id:this.props.id,"aria-label":this.props.ariaLabel,className:n.classNames("k-toolbar",{[`k-toolbar-${n.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size},this.props.className),style:this.props.style,role:void 0!==this.props.role?this.props.role||void 0:"toolbar",dir:this.props.dir,ref:e=>this._element=e,onKeyDown:!1!==this.props.keyboardNavigation?this.onKeyDown:void 0},this.props.children)}focusButton(t,s){const{tabIndex:n=e.defaultProps.tabIndex}=this.props,o=this.buttons[s];if(o){o.tabIndex=n,o.focus();const e=this.buttons[t];e&&(e.tabIndex=-1)}}};z.propTypes={tabIndex:s.number,dir:s.string,keyboardNavigation:s.bool,style:s.object,className:s.string,role:s.string,onResize:s.func,buttons:s.arrayOf(s.string),size:s.oneOf([null,"small","medium","large"])},z.defaultProps={tabIndex:0,size:"medium"};let P=z;const B=class extends r.PureComponent{constructor(){super(...arguments),this._element=null}get element(){return this._element}render(){return r.createElement("div",{id:this.props.id,className:n.classNames("k-toolbar-item",this.props.className),style:this.props.style,ref:e=>this._element=e},this.props.children)}};B.propTypes={className:s.string};let M=B;class T extends r.PureComponent{render(){return r.createElement("div",{className:n.classNames("k-separator",this.props.className)})}}const F=r.forwardRef(((e,t)=>{const s=r.useRef(null),o=r.useRef(null);r.useImperativeHandle(o,(()=>({element:s.current}))),r.useImperativeHandle(t,(()=>({element:s.current})));const i=r.useMemo((()=>n.classNames("k-spacer",e.className)),[e.className]);return r.createElement("span",{ref:s,className:i})}));F.displayName="KendoReactToolbarSpacer",F.propTypes={className:s.string};const R=t.createContext([null,e=>{}]),A=t.createContext([null,e=>{}]),$=t.createContext([null,e=>{}]);var U=(e=>(e.next="next",e.prev="prev",e.current="current",e.reset="reset",e))(U||{});var W=(e=>(e.remove="remove",e.add="add",e.reorder="reorder",e))(W||{});var H=(e=>(e.toggle="toggle",e.remove="remove",e))(H||{});const j=r.forwardRef(((e,t)=>{n.validatePackage(l);const s=r.useRef(null),o=r.useRef(null),{disabled:a=_.disabled,fillMode:d=_.fillMode,themeColor:c=_.themeColor,size:p=_.size,rounded:u=_.rounded,dir:h=_.dir,removeIcon:m=_.removeIcon,removeSvgIcon:f=_.removeSvgIcon,removable:g=_.removable}=e,v=n.useDir(o,h);r.useImperativeHandle(s,(()=>({element:o.current,props:e}))),r.useImperativeHandle(t,(()=>s.current));const[b,y]=r.useContext(R),[k,C]=r.useContext(A),[,I]=r.useContext($),x=r.useMemo((()=>e.selected||(Array.isArray(b)?b.some((t=>t===e.value)):b===e.value)),[e.selected,e.value,b]),D=r.useMemo((()=>k===e.value),[e.value,k]);r.useEffect((()=>{D&&o.current&&o.current.focus()}),[D]);const E=r.useCallback((t=>{y({type:H.toggle,payload:e.value,event:t})}),[y,e.value]),w=r.useCallback((t=>{g&&(I({type:W.remove,payload:e.value,event:t}),C({type:U.reset,payload:e.value,event:t}),y({type:H.remove,payload:e.value,event:t}),e.onRemove&&e.onRemove.call(void 0,{target:s.current,syntheticEvent:t}))}),[e.onRemove,e.value,g,I,C,y]),N=r.useCallback((t=>{switch(t.keyCode){case n.Keys.left:C({type:U.prev,payload:e.value,event:t});break;case n.Keys.right:C({type:U.next,payload:e.value,event:t});break;case n.Keys.enter:y({type:H.toggle,payload:e.value,event:t});break;case n.Keys.delete:w(t)}e.onKeyDown&&e.onKeyDown.call(void 0,{target:s.current,syntheticEvent:t})}),[e.onKeyDown,e.value,C,y,w]),K=r.useCallback((t=>{C({payload:e.value,type:U.current,event:t}),e.onFocus&&e.onFocus.call(void 0,{target:s.current,syntheticEvent:t})}),[e.onFocus,e.value,C]),O=r.useCallback((t=>{e.onBlur&&e.onBlur.call(void 0,{target:s.current,syntheticEvent:t})}),[e.onBlur]),S=n.useMouse(e,s,{onClick:E});return r.createElement("div",{...S,role:e.role||"button",id:e.value,style:e.style,ref:o,dir:v,tabIndex:n.getTabIndex(e.tabIndex,a,void 0),className:n.classNames("k-chip",{"k-rtl":"rtl"===v,"k-disabled":a,"k-selected":x,"k-focus":D,[`k-chip-${n.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-rounded-${n.kendoThemeMaps.roundedMap[u]||u}`]:u,[`k-chip-${d}`]:d,[`k-chip-${d}-${c}`]:!(!d||!c)},e.className),"aria-pressed":e.role?void 0:x,"aria-disabled":a,"aria-describedby":e.ariaDescribedBy,"aria-keyshortcuts":g?"Enter Delete":void 0,onFocus:K,onBlur:O,onKeyDown:N},x&&(e.selectedIcon||e.selectedSvgIcon)&&r.createElement(n.IconWrap,{className:"k-chip-icon",name:e.selectedIcon?n.toIconName(e.selectedIcon):void 0,icon:e.selectedSvgIcon,size:"small"}),(e.icon||e.svgIcon)&&r.createElement(n.IconWrap,{className:"k-chip-icon",name:e.icon?n.toIconName(e.icon):void 0,icon:e.svgIcon,size:"small"}),e.avatar&&r.createElement("div",{className:`k-chip-avatar k-avatar k-rounded-${e.avatar.rounded} k-avatar-md k-avatar-solid k-avatar-solid-primary`,style:e.avatar.style},r.createElement("span",{className:"k-avatar-image"},r.createElement("img",{src:e.avatar.image,alt:e.avatar.imageAlt}))),r.createElement("span",{className:"k-chip-content"},void 0!==e.children?e.children:e.text&&r.createElement("span",{"aria-label":e.ariaLabel||e.text,className:"k-chip-label"},e.text)),g&&r.createElement("span",{className:"k-chip-actions"},r.createElement("span",{className:n.classNames("k-chip-action","k-chip-remove-action"),onClick:w},r.createElement(n.IconWrap,{name:m?n.toIconName(m):void 0,icon:f||i.xCircleIcon,size:"small"}))))})),L={id:s.string,text:s.string,value:s.any,dir:s.oneOf(["ltr","rtl"]),removable:s.bool,removeIcon:s.string,removeIconSvg:n.svgIconPropType,disabled:s.bool,icon:s.string,svgIcon:n.svgIconPropType,selectedIcon:s.string,selectedIconSvg:n.svgIconPropType,onRemove:s.func,dataItem:s.any,selected:s.bool,ariaDescribedBy:s.string,size:s.oneOf([null,"small","medium","large"]),rounded:s.oneOf([null,"small","medium","large","full"]),fillMode:s.oneOf([null,"outline","solid"]),themeColor:s.oneOf([null,"base","info","success","warning","error"])},_={disabled:!1,removable:!1,removeIcon:"k-i-x-circle",removeSvgIcon:i.xCircleIcon,dir:"ltr",size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};j.displayName="KendoReactChip",j.propTypes=L;const q=(e,t,s)=>{"multiple"===t.selection?Array.isArray(e)||(e=e?[e]:null):"single"===t.selection&&Array.isArray(e)&&(e=e?e.join(""):null);const[n,o]=r.useState(e);return[n,e=>{const i=((e,t)=>{switch(t.selection){case"single":switch(t.type){case"toggle":if(!Array.isArray(e)||null===e)return t.payload===e?null:t.payload;throw new Error("State cannot be an array in single selection");case"remove":return t.payload===e?null:e;default:return e}case"multiple":switch(t.type){case"toggle":if(Array.isArray(e))return e.some((e=>e===t.payload))?e.filter((e=>e!==t.payload)):[...e,t.payload];if(null===e)return[t.payload];throw new Error("State cannot be non-array in multiple selection");case"remove":return Array.isArray(e)?e.some((e=>e===t.payload))?e.filter((e=>e!==t.payload)):[...e,t.payload]:e;default:return e}case"none":return null;default:return e}})(t.state||n,{...e,...t});s&&s(i,e.event),"none"!==t.selection&&o(i)}]},V=(e,t,s)=>{const[n,o]=r.useState(e);return[n,e=>{const i=((e,t)=>{switch(t.type){case"add":case"reorder":break;case"remove":return e.filter((e=>e[t.valueField]!==t.payload));default:return e}})(t.state||n,{...e,...t});s&&s(i,e.event),o(i)}]},Z=r.forwardRef(((e,t)=>{n.validatePackage(l);const s=r.useRef(null),o=r.useRef(null),{id:i,style:a,tabIndex:d,className:c,ariaDescribedBy:p,ariaLabelledBy:u,ariaLabel:h,value:m,defaultData:f=J.defaultData,chip:g=J.chip,disabled:v=J.disabled,size:b=J.size,defaultValue:y=J.defaultValue,selection:k=J.selection,valueField:C=J.valueField,textField:I=J.textField,dir:x=J.dir,onChange:D,onDataChange:E}=e,w=n.useDir(o,x),N=r.useMemo((()=>g||j),[g,j]);r.useImperativeHandle(s,(()=>({element:o.current,props:e}))),r.useImperativeHandle(t,(()=>s.current));const K=r.useCallback(((e,t)=>{D&&s.current&&D.call(void 0,{value:e,target:s.current,syntheticEvent:t})}),[D]),[O,S]=q(m||y,{selection:k,state:m},K),z=r.useCallback(((e,t)=>{E&&s.current&&E.call(void 0,{value:e,target:s.current,syntheticEvent:t})}),[E]),[P,B]=V(e.data||f,{state:e.data,valueField:C},z),M=r.useCallback(((e,t)=>(e.push(t[C]),e)),[C]),T=r.useMemo((()=>e.data||P),[e.data,P]),F=r.useMemo((()=>m||O),[m,O]),U=r.useMemo((()=>T.reduce(M,[])),[T,M]),W=r.useCallback((e=>n.getter(C)(e)),[C]),H=r.useCallback((e=>n.getter(I)(e)),[I]),[L,_]=(e=>{const[t,s]=r.useState(null);return[t,t=>{const n=((e,t)=>{const s=t.items.findIndex((t=>t===e));switch(t.type){case"next":return s===t.items.length-1?e:t.items[s+1];case"prev":return 0===s?e:t.items[s-1];case"current":return t.payload;case"reset":return null;default:return e}})(t.payload,{...t,...e});s(n)}]})({items:U}),Z=n.useMouse(e,s);return r.createElement(R.Provider,{value:[F,S]},r.createElement(A.Provider,{value:[L,_]},r.createElement($.Provider,{value:[T,B]},r.createElement("div",{ref:o,...Z,role:v?void 0:"listbox",id:i,dir:w,style:a,tabIndex:n.getTabIndex(d,v,void 0),className:n.classNames("k-chip-list",{"k-rtl":"rtl"===w,"k-disabled":v,[`k-chip-list-${n.kendoThemeMaps.sizeMap[b]||b}`]:b},c),"aria-label":h,"aria-labelledby":u,"aria-describedby":p,"aria-orientation":"horizontal","aria-multiselectable":"multiple"===k},T.map(((e,t)=>r.createElement(N,{role:"option",dataItem:e,size:b,key:[W(e),t].join("-"),text:H(e),value:W(e),ariaLabel:e.ariaLabel,svgIcon:e.svgIcon||void 0})))))))})),G={id:s.string,className:s.string,tabIndex:s.number,data:s.any,defaultData:s.arrayOf(s.any),onDataChange:s.func,value:s.oneOfType([s.any,s.arrayOf(s.any)]),defaultValue:s.oneOfType([s.any,s.arrayOf(s.any)]),onChange:s.func,selection:s.oneOf(["single","none","multiple"]),textField:s.string,valueField:s.string,disabled:s.bool,dir:s.oneOf(["ltr","rtl"]),ariaLabelledBy:s.string,ariaDescribedBy:s.string,size:s.oneOf([null,"small","medium","large"])},J={chip:j,size:"medium",disabled:!1,defaultValue:null,defaultData:[],dir:"ltr",selection:"none",textField:"text",valueField:"value",removable:"removable"};Z.displayName="KendoReactChipList",Z.propTypes=G;const Q=r.forwardRef(((e,t)=>{const{className:s,disabled:o,text:i,icon:a,style:l,id:d,focused:c,tabIndex:p,index:u,dataItem:h,item:m,svgIcon:f,onDown:g,onClick:v,...b}=e,y=r.useRef(null),k=r.useCallback((()=>{y.current&&y.current.focus()}),[]),C=r.useCallback((()=>({element:y.current,focus:k})),[k]);r.useImperativeHandle(t,C);const I=r.useCallback((e=>{v&&void 0!==u&&!o&&v(e,u)}),[v,u]),x=r.useMemo((()=>n.classNames("k-fab-item",{"k-focus":c,"k-disabled":o},s)),[s,o,c]),D=m;return r.createElement("li",{ref:y,id:d,className:x,style:l,role:"menuitem",tabIndex:n.getTabIndex(p,o),"aria-disabled":o,"aria-label":`${i||""} floatingactionbutton item`,onClick:I,onMouseDown:g,onPointerDown:g,...b},D?r.createElement(D,{itemIndex:u,item:h}):r.createElement(r.Fragment,null,i&&r.createElement("span",{className:"k-fab-item-text"},i),a||f?r.createElement(n.IconWrap,{className:"k-fab-item-icon",name:a,icon:f}):null))}));Q.propTypes={className:s.string,style:s.object,children:s.any,disabled:s.bool,focused:s.bool,index:s.number,icon:s.string,svgIcon:n.svgIconPropType,text:s.string,tabIndex:s.number,customProp:s.any},Q.displayName="KendoFloatingActionButtonItem";const X="16px",Y=e=>"number"==typeof e?e+"px":e,ee=(e,t)=>{const s={horizontal:t?"right":"left",vertical:"bottom"};return"end"===e.horizontal&&(s.horizontal=t?"left":"right"),s},te=(e,t)=>{const s={horizontal:t?"right":"left",vertical:"top"};return"end"===e.horizontal&&(s.horizontal=t?"left":"right"),s},se=(e,t)=>({rtl:{end:"k-text-left",start:"k-text-right"},ltr:{start:"k-text-left",end:"k-text-right"}}[e]["end"===t?"end":"start"]),ne=(e,t,s,n)=>{const o=t.horizontal,i=t.vertical;if(e.current){const a=s&&void 0!==s.x?Y(s.x):X,r=s&&void 0!==s.x?`calc(50% + ${Y(s.x)})`:"50%",l=s&&void 0!==s.y?Y(s.y):X,d=s&&void 0!==s.y?`calc(50% + ${Y(s.y)})`:"50%";e.current.style.setProperty(oe(t,n),"center"===o?r:a),e.current.style.setProperty(ie(t),"middle"===i?d:l),n&&(("top"===i||"bottom"===i)&&"start"===o&&e.current.style.setProperty("left","unset"),"middle"===i&&"end"===o&&e.current.style.setProperty("right","unset"),"middle"===i&&"start"===o&&e.current.style.setProperty("left","unset"))}},oe=(e,t)=>{const{horizontal:s}=e;return{end:t?"left":"right",center:"left",start:t?"right":"left"}[s||"end"]},ie=e=>({top:"top",middle:"top",bottom:"bottom"}[e.vertical||"bottom"]),ae=r.forwardRef(((e,t)=>{n.validatePackage(l);const{align:s=re.align,alignOffset:i,className:a,disabled:d,icon:c,svgIcon:p,iconClass:u,id:h,items:m,item:f,text:g,positionMode:v=re.positionMode,size:b=re.size,style:y,rounded:k=re.rounded,themeColor:C=re.themeColor,overlayStyle:I,tabIndex:x,accessKey:D,popupSettings:E={},modal:w,onClick:N,onItemClick:K,onFocus:O,onBlur:S,onKeyDown:z,onOpen:P,onClose:B,...M}=e,T=n.useZIndexContext(),F=T?T+2:100,R=r.useRef(null),A=r.useRef(null),$=r.useRef(null),U=r.useRef(null),W=r.useCallback((()=>{A.current&&A.current.focus()}),[]),H=r.useCallback((()=>({element:A.current,focus:W})),[W]);r.useImperativeHandle(R,H),r.useImperativeHandle(t,(()=>R.current));const[j,L]=r.useState(!1),[_,q]=r.useState(!1),[V,Z]=r.useState(-1),G=n.useId()+"-button-id",J=n.useDir(A,e.dir),X="rtl"===J,Y=n.useId()+"-list-id";r.useEffect((()=>{ne(A,s,i,X)}),[A,s,i,X]),r.useEffect((()=>{_&&A&&A.current&&A.current.focus()}),[_,A]);const oe=r.useCallback(((e,t)=>{m&&n.dispatchEvent(t?P:B,e,H(),void 0)}),[P,B,m]),ie=r.useCallback((e=>{!e.target||d||(!m&&N?n.dispatchEvent(N,e,H(),void 0):(L(!j),q(!0),Z(j?-1:0),oe(e,!j)))}),[L,q,Z,N,oe,j,m,d]),ae=r.useCallback((e=>{q(!0),Z(j?0:-1),O&&n.dispatchEvent(O,e,H(),void 0)}),[O,q,Z]),le=r.useCallback((e=>{q(!1),L(!1),Z(-1),n.dispatchEvent(S,e,H(),void 0),j&&oe(e,!1)}),[S,q,L,Z,oe]),de=r.useCallback((e=>{e.preventDefault()}),[]),ce=r.useCallback(((e,t)=>{m&&(m[t].disabled||n.dispatchEvent(K,e,H(),{itemProps:m[t],itemIndex:t}))}),[K]),pe=r.useCallback(((e,t)=>{!e.target||!m||(Z(t),L(!1),ce(e,t),oe(e,!1))}),[Z,L,ce,oe]),ue=r.useCallback((e=>{n.getActiveElement(document)===A.current&&e.preventDefault()}),[A]),he=r.useCallback((e=>{const t=V,s=m?m.length:-1;if(e.altKey)return!j&&e.keyCode===n.Keys.down&&(e.preventDefault(),L(!0),Z(0)),void(j&&e.keyCode===n.Keys.up&&(e.preventDefault(),L(!1),Z(-1)));switch(e.keyCode){case n.Keys.enter:case n.Keys.space:t>=0&&ce(e,t),m||ie(e),e.preventDefault(),L(!j),Z(j?-1:0);break;case n.Keys.esc:e.preventDefault(),L(!1),Z(-1);break;case n.Keys.home:e.preventDefault(),Z(0);break;case n.Keys.end:e.preventDefault(),Z(s-1);break;case n.Keys.down:case n.Keys.right:e.preventDefault(),Z(t+1>=s?0:t+1);break;case n.Keys.up:case n.Keys.left:e.preventDefault(),Z(t-1<0?s-1:t-1)}n.dispatchEvent(z,e,H(),void 0)}),[z,V,Z,X,L]),me=r.useMemo((()=>n.classNames("k-fab k-fab-solid",{"k-fab-sm":"small"===b,"k-fab-md":"medium"===b,"k-fab-lg":"large"===b,"k-disabled":d,"k-pos-absolute":"absolute"===v,"k-pos-fixed":"fixed"===v,"k-focus":_,[`k-rounded-${n.kendoThemeMaps.roundedMap[k]||k}`]:k,[`k-fab-solid-${C}`]:C},`k-${s.vertical}-${s.horizontal}`,a)),[C,b,k,d,v,s,_,a]),fe=m&&m.map(((e,t)=>r.createElement(Q,{...e,key:t,index:t,id:`${Y}-${t}`,disabled:d||e.disabled,focused:V===t,dataItem:e,item:f,className:n.classNames(e.className,se(J||"ltr",s.horizontal)),onClick:pe,onDown:ue}))),ge=!(!c&&!p||g),ve=(A.current?A.current.offsetWidth:0)/2-16;return r.createElement(n.ZIndexContext.Provider,{value:F},r.createElement(r.Fragment,null,r.createElement("button",{ref:A,id:h||G,role:"button",type:"button","aria-disabled":d,"aria-expanded":m?j:void 0,"aria-haspopup":!!m,"aria-label":`${g||""} floatingactionbutton`,"aria-owns":m?Y:void 0,"aria-activedescendant":V>=0&&m?`${Y}-${V}`:void 0,tabIndex:n.getTabIndex(x,d),accessKey:D,dir:J,disabled:d,className:me,style:y,onClick:ie,onMouseDown:de,onFocus:ae,onBlur:le,onKeyDown:he,...M},c||p?r.createElement(n.IconWrap,{className:"k-fab-icon",name:c,icon:p}):u?r.createElement("span",{role:"presentation",className:u}):null,g&&r.createElement("span",{className:"k-fab-text"},g)),w&&j&&r.createElement("div",{className:"k-overlay",style:{zIndex:F,...I}}),r.createElement(o.Popup,{ref:U,anchor:A.current,show:j,animate:E.animate,popupClass:n.classNames("k-popup-transparent k-fab-popup",E.popupClass),anchorAlign:E.anchorAlign||ee(s,X),popupAlign:E.popupAlign||te(s,X),style:{boxShadow:"none"}},r.createElement("ul",{ref:$,role:"menu","aria-labelledby":h,id:Y,className:n.classNames("k-fab-items",{"k-fab-items-bottom":"bottom"!==s.vertical,"k-fab-items-top":"bottom"===s.vertical}),style:{paddingLeft:ge?ve:void 0,paddingRight:ge?ve:void 0}},fe))))}));ae.propTypes={className:s.string,style:s.object,id:s.string,dir:s.string,tabIndex:s.number,accessKey:s.string,disabled:s.bool,icon:s.string,svgIcon:n.svgIconPropType,iconClass:s.string,text:s.string,alignOffset:s.shape({x:s.oneOfType([s.number,s.string]),y:s.oneOfType([s.number,s.string])}),align:s.shape({vertical:s.oneOf(["top","middle","bottom"]),horizontal:s.oneOf(["start","center","end"])}),positionMode:s.oneOf(["absolute","fixed"]),size:s.oneOf([null,"small","medium","large"]),rounded:s.oneOf([null,"small","medium","large","full"]),themeColor:s.oneOf([null,"primary","secondary","tertiary","info","success","warning","error","dark","light","inverse"]),modal:s.bool,overlayStyle:s.object};const re={align:{vertical:"bottom",horizontal:"end"},size:"medium",rounded:"full",themeColor:"primary",positionMode:"fixed"};ae.displayName="KendoFloatingActionButton";const le=n.withIdHOC(S);le.displayName="KendoReactDropDownButton";const de=n.withIdHOC(w);de.displayName="KendoReactSplitButton",e.Button=c,e.ButtonGroup=b,e.Chip=j,e.ChipList=Z,e.DropDownButton=le,e.DropDownButtonClassComponent=S,e.DropDownButtonItem=K,e.FloatingActionButton=ae,e.FloatingActionButtonItem=Q,e.SplitButton=de,e.SplitButtonClassComponent=w,e.SplitButtonItem=C,e.Toolbar=P,e.ToolbarItem=M,e.ToolbarSeparator=T,e.ToolbarSpacer=F,e.toolbarButtons=g}));
|
|
8
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-popup"),require("@progress/kendo-svg-icons")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-popup","@progress/kendo-svg-icons"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactButtons={},e.React,e.PropTypes,e.KendoReactCommon,e.KendoReactPopup,e.KendoSvgIcons)}(this,(function(e,t,s,n,o,i){"use strict";function a(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var r=a(t);const l={name:"@progress/kendo-react-buttons",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};const d=class e extends r.Component{constructor(e){super(e),this._element=null,this.handleClick=e=>{this.toggleIfApplicable(),this.props.onClick&&this.props.onClick.call(void 0,e)},n.validatePackage(l),this.state={selected:!0===this.props.togglable&&!0===this.props.selected}}get element(){return this._element}get selected(){return void 0!==this._selectedTemp?this._selectedTemp:this.state.selected}static getDerivedStateFromProps(e,t){return e.togglable&&void 0!==e.selected&&e.selected!==t.selected?{selected:e.selected}:null}render(){const{children:t,togglable:s,icon:o,iconClass:i,svgIcon:a,imageUrl:l,imageAlt:d,className:c,startIcon:u,endIcon:p,onClick:h,size:m=e.defaultProps.size,rounded:f=e.defaultProps.rounded,fillMode:g=e.defaultProps.fillMode,themeColor:v=e.defaultProps.themeColor,...b}=this.props,y=void 0!==a||void 0!==o||void 0!==i||void 0!==l,k=void 0!==t,C=this.context&&this.context.uButton,I=function({imageUrl:e,name:t,iconClass:s,svgIcon:o,imageAlt:i,buttonClasses:a}){return e?r.createElement("img",{role:"presentation",className:n.classNames(n.uButton.icon({c:a})),alt:i,src:e}):t||o?r.createElement(n.IconWrap,{className:n.classNames(n.uButton.icon({c:a})),name:t,icon:o}):s?r.createElement("span",{role:"presentation",className:n.classNames(n.uButton.icon({c:a}),s)}):null}({name:o,svgIcon:a,iconClass:i,imageUrl:l,imageAlt:d,buttonClasses:C}),x=e=>r.cloneElement(e,{className:n.classNames(n.uButton.icon({c:C}))});return r.createElement("button",{ref:e=>this._element=e,"aria-pressed":s?this.state.selected:void 0,...b,onClick:this.handleClick,className:n.classNames(n.uButton.wrapper({c:C,isRtl:"rtl"===this.props.dir,selected:this.state.selected,disabled:this.props.disabled,size:m,fillMode:g,rounded:f,themeColor:v,iconButton:!k&&y}),c)},u&&x(u),I,t&&r.createElement("span",{className:n.classNames(n.uButton.text({c:C}))},t),p&&x(p))}toggleIfApplicable(){if(this.props.togglable&&void 0===this.props.selected){const e=!this.state.selected;this._selectedTemp=e,this.setState({selected:e},(()=>this._selectedTemp=void 0))}}};d.propTypes={children:s.node,selected:s.bool,togglable:s.bool,icon:s.string,svgIcon:n.svgIconPropType,iconClass:s.string,imageUrl:s.string,imageAlt:s.string,size:s.oneOf([null,"small","medium","large"]),rounded:s.oneOf([null,"small","medium","large","full"]),fillMode:s.oneOf([null,"flat","link","outline","solid","clear"]),themeColor:s.oneOf([null,"base","primary","secondary","tertiary","info","success","warning","error","dark","light","inverse"])},d.defaultProps={togglable:!1,size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};let c=d;c.contextType=n.UnstyledContext;const u="k-group-start",p="k-group-end",h="k-button-group",m="k-button-group-stretched",f=":not(.k-dropdownlist button):not(.k-colorpicker button):not(.k-split-button .k-split-button-arrow)",g=["button"+f,".k-button-group > button"+f,".k-colorpicker",".k-dropdownlist"],v=class extends r.Component{constructor(e){super(e),this._element=null,n.validatePackage(l)}render(){const e=this.mapButtons(this.props.children),t=n.classNames([h],{"k-disabled":this.props.disabled,[m]:!!this.props.width},this.props.className),s={className:t,style:{width:`${this.props.width}`},dir:this.props.dir,role:"group","aria-disabled":this.props.disabled};return r.createElement("div",{ref:e=>{this._element=e},...s,className:t},e)}mapButtons(e){const t=r.Children.count(e),s=void 0!==this.props.dir?"rtl"===this.props.dir:this._element&&"rtl"===getComputedStyle(this._element).direction||!1;return r.Children.map(e,((e,n)=>r.isValidElement(e)?this.renderButton(e,n,n===t-1,s):e))}renderButton(e,t,s,o){const i=n.classNames(e.props.className,{[u]:o?s:0===t,[p]:o?0===t:s}),a={...this.props.width?{width:this.props.width}:{},...e.props.style||{}},l=this.props.disabled||e.props.disabled,d={...e.props,...i?{className:i}:{},...Object.keys(a).length?{style:a}:{},...void 0!==l?{disabled:l}:{}};return r.Children.count(e.props.children)>0?r.cloneElement(e,d,e.props.children):r.cloneElement(e,d)}};v.propTypes={children:s.oneOfType([s.arrayOf(s.element),s.element]),className:s.string,disabled:s.bool,width:s.string,dir:s.string};let b=v;const y=e=>{const t=n.useUnstyled(),s=t&&t.uDropDownButton,o=r.useCallback((t=>{e.onClick(t,e.index)}),[e]),i=e.dataItem.render||e.item||(void 0===e.item?e.render:null),a=void 0!==e.dataItem.text?e.dataItem.text:e.textField?e.dataItem[e.textField]:e.dataItem,l=r.createElement("li",{id:e.id,className:n.classNames(n.uDropDownButton.li({c:s,focused:e.focused}),e.className),tabIndex:-1,onClick:o,onMouseDown:e.onDown,onPointerDown:e.onDown,role:"menuitem","aria-disabled":e.dataItem.disabled||void 0},r.createElement("span",{tabIndex:-1,className:n.classNames(n.uDropDownButton.link({c:s,selected:e.dataItem.selected,disabled:e.dataItem.disabled})),key:"icon"},i?r.createElement(i,{item:e.dataItem,itemIndex:e.index}):r.createElement(r.Fragment,null,(e.dataItem.icon||e.dataItem.iconClass||e.dataItem.svgIcon)&&r.createElement(n.IconWrap,{className:e.dataItem.iconClass,name:e.dataItem.icon,icon:e.dataItem.svgIcon}),e.dataItem.imageUrl&&r.createElement("img",{role:"presentation",alt:"",src:e.dataItem.imageUrl,className:"k-icon"}),a&&r.createElement("span",{className:"k-menu-link-text"},a))));return void 0!==e.item&&void 0!==e.render?e.render.call(void 0,l,e):l};y.displayName="KendoReactButtonItem";const k=class extends r.Component{render(){return null}};k.propTypes={text:s.string,icon:s.string,iconClass:s.string,imageUrl:s.string,disabled:s.bool,render:s.any};let C=k;const I=(e,t,s,o)=>{if(s)return e;const i=Math.min(o-1,Math.max(0,e));switch(t){case n.Keys.enter:case n.Keys.space:case n.Keys.esc:return-1;case n.Keys.up:case n.Keys.left:return i-1<0?o-1:i-1;case n.Keys.down:case n.Keys.right:return i+1>=o?0:i+1;case n.Keys.home:return 0;case n.Keys.end:return o-1;default:return e}};function x(e){let t={horizontal:"left",vertical:"bottom"};return e&&(t.horizontal="right"),t}function D(e){let t={horizontal:"left",vertical:"top"};return e&&(t.horizontal="right"),t}const w=class extends r.Component{constructor(e){super(e),this.state={focused:!1,focusedIndex:-1,opened:!1},this.wrapper=null,this.mainButton=null,this.list=null,this.skipFocus=!1,this.buttonsData=[],this.onKeyDown=e=>{const{focusedIndex:t}=this.state;if(e.altKey)return void(this.opened||e.keyCode!==n.Keys.down?this.opened&&e.keyCode===n.Keys.up&&(e.preventDefault(),this.setState({focusedIndex:-1}),this.setOpen(!1,e)):(e.preventDefault(),this.setState({focusedIndex:0}),this.setOpen(!0,e)));let s;if(e.keyCode===n.Keys.enter||e.keyCode===n.Keys.space){if(e.preventDefault(),this.dispatchClickEvent(e,t),t>=0){s={focusedIndex:this.opened?-1:0};const t=!this.opened;this.setOpen(t,e)}}else if(this.opened&&e.keyCode===n.Keys.esc)return this.setState({focusedIndex:-1}),void this.setOpen(!1,e);if(this.opened){const o=I(t,e.keyCode,e.altKey,this.buttonsData.length);o!==t&&(s=s||{},s.focusedIndex=o);const i=e.keyCode===n.Keys.up||e.keyCode===n.Keys.down||e.keyCode===n.Keys.left||e.keyCode===n.Keys.right;!e.altKey&&(i||e.keyCode===n.Keys.home||e.keyCode===n.Keys.end)&&e.preventDefault()}s&&this.setState(s)},this.switchFocus=e=>{this.skipFocus=!0,e(),window.setTimeout((()=>this.skipFocus=!1),0)},this.onFocus=e=>{this.skipFocus||(n.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}),n.dispatchEvent(this.props.onBlur,e,this,void 0),setTimeout((()=>{this.setOpen(!1,e)}),0))},this.onPopupClose=e=>{var t;const s=n.getActiveElement(document);this.element&&this.element.removeAttribute("tabindex"),(s===this.list||null!=(t=this.list)&&t.contains(s))&&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=n.getActiveElement(document);this.element&&t!==this.element&&t!==this.list&&this.element.focus()},this.onItemDown=e=>{n.getActiveElement(document)===this.list&&e.preventDefault()},this.dispatchPopupEvent=(e,t)=>{n.dispatchEvent(t?this.props.onOpen:this.props.onClose,e,this,void 0),this.openedDuringOnChange=void 0},n.validatePackage(l)}get guid(){return this.props.id?this.props.id+"-accessibility-id":this.props.id}get opened(){return void 0!==this.openedDuringOnChange?this.openedDuringOnChange:void 0===this.props.opened?this.state.opened:this.props.opened}render(){this.buttonsData=this.props.items||r.Children.toArray(this.props.children).filter((e=>e&&e.type===C)).map((e=>e.props));const e=this.isRtl(),t=e?"rtl":void 0,{id:s,style:o,tabIndex:a,disabled:l}=this.props;return r.createElement("div",{id:s,style:o,className:n.classNames("k-split-button","k-button-group",{"k-focus":this.state.focused},`k-rounded-${n.kendoThemeMaps.roundedMap[this.props.rounded||"medium"]}`,this.props.className),onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,dir:t,ref:e=>this.wrapper=e},r.createElement(c,{ref:e=>this.mainButton=e&&e.element,type:"button",size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,themeColor:this.props.themeColor,onClick:e=>this.onItemClick(e,-1),disabled:l||void 0,tabIndex:a,accessKey:this.props.accessKey,className:this.props.buttonClass,icon:this.props.icon,svgIcon:this.props.svgIcon,iconClass:this.props.iconClass,imageUrl:this.props.imageUrl,dir:t,"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),r.createElement(c,{type:"button",size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,themeColor:this.props.themeColor,icon:"caret-alt-down",svgIcon:i.caretAltDownIcon,className:"k-split-button-arrow",disabled:l||void 0,tabIndex:-1,onClick:this.onSplitPartClick,onMouseDown:this.onDownSplitPart,onPointerDown:this.onDownSplitPart,dir:t,"aria-label":"menu toggling button"}),this.renderPopup(e))}componentDidMount(){(void 0===this.props.dir&&this.isRtl()||this.opened)&&this.forceUpdate()}get element(){return this.mainButton}dispatchClickEvent(e,t){this.isItemDisabled(t)||(-1===t?n.dispatchEvent(this.props.onButtonClick,e,this,void 0):n.dispatchEvent(this.props.onItemClick,e,this,{item:this.buttonsData[t],itemIndex:t}))}renderPopup(e){const{popupSettings:t={}}=this.props,{focusedIndex:s}=this.state;return r.createElement(o.Popup,{anchor:this.wrapper,show:this.opened,animate:t.animate,popupClass:n.classNames("k-menu-popup",t.popupClass),anchorAlign:t.anchorAlign||x(e),popupAlign:t.popupAlign||D(e),style:e?{direction:"rtl"}:void 0,onClose:this.onPopupClose},r.createElement("ul",{role:"menu",id:this.guid,"aria-labelledby":"button-"+this.guid,tabIndex:-1,ref:this.listRef,"aria-activedescendant":s>=0?`${this.guid}-${s}`:void 0,className:n.classNames("k-menu-group",{[`k-menu-group-${n.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size})},this.renderChildItems()))}renderChildItems(){const{item:e,itemRender:t,textField:s}=this.props;return this.buttonsData.length>0?this.buttonsData.map(((n,o)=>r.createElement(y,{className:"k-menu-item",dataItem:n,textField:s,focused:this.state.focusedIndex===o,onClick:this.onItemClick,onDown:this.onItemDown,render:t,item:e,key:o,index:o,id:`${this.guid}-${o}`}))):null}isItemDisabled(e){return this.buttonsData[e]?this.buttonsData[e].disabled:this.props.disabled}isRtl(){return void 0!==this.props.dir?"rtl"===this.props.dir:!!this.wrapper&&"rtl"===getComputedStyle(this.wrapper).direction}};w.propTypes={accessKey:s.string,ariaLabel:s.string,title:s.string,onButtonClick:s.func,onFocus:s.func,onBlur:s.func,onItemClick:s.func,onOpen:s.func,onClose:s.func,text:s.string,items:s.arrayOf(s.any),textField:s.string,tabIndex:s.number,disabled:s.bool,icon:s.string,svgIcon:n.svgIconPropType,iconClass:s.string,imageUrl:s.string,popupSettings:s.object,itemRender:s.any,item:s.func,className:s.string,buttonClass:s.string,dir:s.string},w.defaultProps={size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};let E=w;const N=class extends r.Component{render(){return null}};N.propTypes={text:s.string,icon:s.string,iconClass:s.string,imageUrl:s.string,selected:s.bool,disabled:s.bool,render:s.any};let K=N;const B=class extends r.Component{constructor(e){super(e),this.state={opened:!1,focused:!1,focusedIndex:-1},this.mainButton=null,this.list=null,this.skipFocus=!1,this.buttonsData=[],this.onKeyDown=e=>{const{focusedIndex:t}=this.state;if(e.altKey)return void(this.opened||e.keyCode!==n.Keys.down?this.opened&&e.keyCode===n.Keys.up&&(e.preventDefault(),this.setState({focusedIndex:-1}),this.setOpen(!1,e)):(e.preventDefault(),this.setOpen(!0,e),this.setState({focusedIndex:0})));const s={...this.state};if(e.keyCode===n.Keys.enter||e.keyCode===n.Keys.space){e.preventDefault(),t>=0&&this.dispatchClickEvent(e,t);const s=!this.opened;return this.setState({focused:!0,focusedIndex:s?0:-1}),void this.setOpen(s,e)}if(this.opened&&e.keyCode===n.Keys.esc)return this.setState({focusedIndex:-1}),void this.setOpen(!1,e);if(this.opened){const o=I(t,e.keyCode,e.altKey,this.buttonsData.length);s.focusedIndex=o;const i=e.keyCode===n.Keys.up||e.keyCode===n.Keys.down||e.keyCode===n.Keys.left||e.keyCode===n.Keys.right;!e.altKey&&(i||e.keyCode===n.Keys.home||e.keyCode===n.Keys.end)&&e.preventDefault()}this.setState(s)},this.switchFocus=e=>{this.skipFocus=!0,e(),window.setTimeout((()=>this.skipFocus=!1),0)},this.handleFocus=e=>{this.skipFocus||(this.setState({focused:!0,focusedIndex:this.opened?0:-1}),n.dispatchEvent(this.props.onFocus,e,this,void 0))},this.handleButtonBlur=e=>{this.opened||(this.setState({focused:!1}),n.dispatchEvent(this.props.onBlur,e,this,void 0))},this.handleMenuBlur=e=>{this.skipFocus||(this.setState({focused:!1,focusedIndex:-1}),n.dispatchEvent(this.props.onBlur,e,this,void 0),setTimeout((()=>{this.setOpen(!1,e)}),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.setState({focusedIndex:-1}),this.dispatchClickEvent(e,t),this.setOpen(!1,e)},this.onItemDown=e=>{n.getActiveElement(document)===this.list&&e.preventDefault()},this.mouseDown=e=>{e.preventDefault();const t=n.getActiveElement(document);this.element&&t!==this.element&&t!==this.list&&this.element.focus()},this.onPopupClose=e=>{var t;const s=n.getActiveElement(document);this.element&&this.element.removeAttribute("tabindex"),(s===this.list||null!=(t=this.list)&&t.contains(s))&&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.onClickMainButton=e=>{if(!this.buttonsData.length)return;const t=!this.opened;this.setState({focused:!0,focusedIndex:t?0:-1}),this.setOpen(t,e)},this.dispatchPopupEvent=(e,t)=>{n.dispatchEvent(t?this.props.onOpen:this.props.onClose,e,this,void 0),this.openedDuringOnChange=void 0},n.validatePackage(l)}get guid(){return this.props.id+"-accessibility-id"}get opened(){return void 0!==this.openedDuringOnChange?this.openedDuringOnChange:void 0===this.props.opened?this.state.opened:this.props.opened}render(){const e=this.isRtl(),t=this.context&&this.context.uDropDownButton,s=e?"rtl":void 0,{id:o,style:i,tabIndex:a,disabled:l,size:d,rounded:u,fillMode:p,themeColor:h,ariaLabel:m,title:f,accessKey:g,icon:v,svgIcon:b,iconClass:y,buttonClass:k,className:C,imageUrl:I,startIcon:x,endIcon:D}=this.props;return this.buttonsData=this.props.items||r.Children.toArray(this.props.children).filter((e=>e&&e.type===K)).map((e=>e.props)),r.createElement(r.Fragment,null,r.createElement(c,{id:o,size:d,style:i,rounded:u,fillMode:p,themeColor:h,onClick:this.onClickMainButton,onMouseDown:this.mouseDown,onKeyDown:this.onKeyDown,onFocus:this.handleFocus,onBlur:this.handleButtonBlur,"aria-disabled":l?"true":void 0,tabIndex:a,accessKey:g,icon:v,svgIcon:b,iconClass:y,className:n.classNames(k,C,n.uDropDownButton.wrapper({c:t,focused:this.state.focused,disabled:l})),imageUrl:I,dir:s,ref:e=>this.mainButton=e&&e.element,type:"button","aria-haspopup":"true","aria-expanded":this.opened?"true":"false","aria-label":m,"aria-controls":this.opened?this.guid:void 0,title:f,startIcon:x,endIcon:D},this.props.text),this.renderPopup(e))}componentDidMount(){(void 0===this.props.dir&&this.isRtl()||this.opened)&&this.forceUpdate()}get element(){return this.mainButton}dispatchClickEvent(e,t){this.isItemDisabled(t)||n.dispatchEvent(this.props.onItemClick,e,this,{item:this.buttonsData[t],itemIndex:t})}renderPopup(e){const{popupSettings:t={},id:s}=this.props,i=this.context&&this.context.uDropDownButton,{focusedIndex:a}=this.state;return r.createElement(o.Popup,{anchor:this.mainButton,show:this.opened,animate:t.animate,popupClass:n.classNames(n.uDropDownButton.popup({c:i}),t.popupClass),anchorAlign:t.anchorAlign||x(e),popupAlign:t.popupAlign||D(e),style:e?{direction:"rtl"}:void 0,onClose:this.onPopupClose},r.createElement("ul",{role:"list",id:this.guid,tabIndex:-1,"aria-activedescendant":a>=0?`${this.guid}-${a}`:void 0,ref:this.listRef,onKeyDown:this.onKeyDown,onBlur:this.handleMenuBlur,className:n.classNames(n.uDropDownButton.ul({c:i,size:this.props.size}))},this.renderChildItems()))}renderChildItems(){const{item:e,itemRender:t,textField:s}=this.props,o=this.context&&this.context.uDropDownButton;return this.buttonsData.length>0?this.buttonsData.map(((i,a)=>r.createElement(y,{className:n.classNames(n.uDropDownButton.item({c:o})),dataItem:i,textField:s,focused:this.state.focusedIndex===a,onClick:this.onItemClick,onDown:this.onItemDown,render:t,item:e,index:a,key:a,id:`${this.guid}-${a}`}))):null}isItemDisabled(e){return this.buttonsData[e]?this.buttonsData[e].disabled:this.props.disabled}isRtl(){return void 0!==this.props.dir?"rtl"===this.props.dir:!!this.mainButton&&"rtl"===getComputedStyle(this.mainButton).direction}};B.propTypes={accessKey:s.string,ariaLabel:s.string,title:s.string,onFocus:s.func,onBlur:s.func,onItemClick:s.func,onOpen:s.func,onClose:s.func,items:s.arrayOf(s.any),textField:s.string,tabIndex:s.number,disabled:s.bool,icon:s.string,svgIcon:n.svgIconPropType,iconClass:s.string,imageUrl:s.string,popupSettings:s.object,itemRender:s.func,item:s.func,className:s.string,buttonClass:s.string,dir:s.string},B.defaultProps={size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};let O=B;O.contextType=n.UnstyledContext;const S=class e extends r.Component{constructor(t){super(t),this._element=null,this.offsetHeight=0,this.offsetWidth=0,this.buttons=[],this.focusedSelector=this.selectors.map((e=>e+":focus")).join(","),this.setTabIndex=t=>{const{tabIndex:s=e.defaultProps.tabIndex}=this.props;this.buttons.forEach(((e,n)=>{e.tabIndex=n===t?s:-1}))},this.onKeyDown=e=>{const t=e.target;if(e.keyCode!==n.Keys.left&&e.keyCode!==n.Keys.right&&e.keyCode!==n.Keys.home&&e.keyCode!==n.Keys.end||e.defaultPrevented||-1===this.buttons.findIndex((e=>e===t)))return;const s=this.focusedIndex;e.keyCode===n.Keys.left?this.focusButton(s,0===s?this.buttons.length-1:s-1):this.focusButton(s,s===this.buttons.length-1?0:s+1),e.keyCode===n.Keys.home&&this.focusButton(s,0),e.keyCode===n.Keys.end&&this.focusButton(s,this.buttons.length-1)},this.onWindowResize=e=>{const t=this.element;if(!t)return;const s=t.offsetWidth,n=t.offsetHeight;if(this.offsetWidth!==s||this.offsetHeight!==n){this.offsetWidth=s,this.offsetHeight=n;const t={offsetWidth:this.offsetWidth,offsetHeight:this.offsetHeight};this.props.onResize&&this.props.onResize.call(void 0,{target:this,...t,nativeEvent:e})}},n.validatePackage(l)}get selectors(){return this.props.buttons||g}get focusedIndex(){const e=this.element&&this.element.querySelector(this.focusedSelector);return Math.max(0,this.buttons.findIndex((t=>t===e)))}get element(){return this._element}componentDidMount(){window.addEventListener("resize",this.onWindowResize);const e=this.element;e&&(this.offsetWidth=e.offsetWidth,this.offsetHeight=e.offsetHeight,!1!==this.props.keyboardNavigation&&(this.buttons=Array.from(e.querySelectorAll(this.selectors.join(","))),this.setTabIndex(0)))}componentDidUpdate(){const e=this.element;!e||!1===this.props.keyboardNavigation||(this.buttons=Array.from(e.querySelectorAll(this.selectors.join(","))),this.setTabIndex(this.focusedIndex))}componentWillUnmount(){window.removeEventListener("resize",this.onWindowResize),this.buttons.length=0}render(){return r.createElement("div",{id:this.props.id,"aria-label":this.props.ariaLabel,className:n.classNames("k-toolbar",{[`k-toolbar-${n.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size},this.props.className),style:this.props.style,role:void 0!==this.props.role?this.props.role||void 0:"toolbar",dir:this.props.dir,ref:e=>this._element=e,onKeyDown:!1!==this.props.keyboardNavigation?this.onKeyDown:void 0},this.props.children)}focusButton(t,s){const{tabIndex:n=e.defaultProps.tabIndex}=this.props,o=this.buttons[s];if(o){o.tabIndex=n,o.focus();const e=this.buttons[t];e&&(e.tabIndex=-1)}}};S.propTypes={tabIndex:s.number,dir:s.string,keyboardNavigation:s.bool,style:s.object,className:s.string,role:s.string,onResize:s.func,buttons:s.arrayOf(s.string),size:s.oneOf([null,"small","medium","large"])},S.defaultProps={tabIndex:0,size:"medium"};let z=S;const P=class extends r.PureComponent{constructor(){super(...arguments),this._element=null}get element(){return this._element}render(){return r.createElement("div",{id:this.props.id,className:n.classNames("k-toolbar-item",this.props.className),style:this.props.style,ref:e=>this._element=e},this.props.children)}};P.propTypes={className:s.string};let M=P;class T extends r.PureComponent{render(){return r.createElement("div",{className:n.classNames("k-separator",this.props.className)})}}const F=r.forwardRef(((e,t)=>{const s=r.useRef(null),o=r.useRef(null);r.useImperativeHandle(o,(()=>({element:s.current}))),r.useImperativeHandle(t,(()=>({element:s.current})));const i=r.useMemo((()=>n.classNames("k-spacer",e.className)),[e.className]);return r.createElement("span",{ref:s,className:i})}));F.displayName="KendoReactToolbarSpacer",F.propTypes={className:s.string};const R=t.createContext([null,e=>{}]),A=t.createContext([null,e=>{}]),$=t.createContext([null,e=>{}]);var U=(e=>(e.next="next",e.prev="prev",e.current="current",e.reset="reset",e))(U||{});var W=(e=>(e.remove="remove",e.add="add",e.reorder="reorder",e))(W||{});var H=(e=>(e.toggle="toggle",e.remove="remove",e))(H||{});const j=r.forwardRef(((e,t)=>{n.validatePackage(l);const s=r.useRef(null),o=r.useRef(null),{disabled:a=_.disabled,fillMode:d=_.fillMode,themeColor:c=_.themeColor,size:u=_.size,rounded:p=_.rounded,dir:h=_.dir,removeIcon:m=_.removeIcon,removeSvgIcon:f=_.removeSvgIcon,removable:g=_.removable}=e,v=n.useDir(o,h);r.useImperativeHandle(s,(()=>({element:o.current,props:e}))),r.useImperativeHandle(t,(()=>s.current));const[b,y]=r.useContext(R),[k,C]=r.useContext(A),[,I]=r.useContext($),x=r.useMemo((()=>e.selected||(Array.isArray(b)?b.some((t=>t===e.value)):b===e.value)),[e.selected,e.value,b]),D=r.useMemo((()=>k===e.value),[e.value,k]);r.useEffect((()=>{D&&o.current&&o.current.focus()}),[D]);const w=r.useCallback((t=>{y({type:H.toggle,payload:e.value,event:t})}),[y,e.value]),E=r.useCallback((t=>{g&&(I({type:W.remove,payload:e.value,event:t}),C({type:U.reset,payload:e.value,event:t}),y({type:H.remove,payload:e.value,event:t}),e.onRemove&&e.onRemove.call(void 0,{target:s.current,syntheticEvent:t}))}),[e.onRemove,e.value,g,I,C,y]),N=r.useCallback((t=>{switch(t.keyCode){case n.Keys.left:C({type:U.prev,payload:e.value,event:t});break;case n.Keys.right:C({type:U.next,payload:e.value,event:t});break;case n.Keys.enter:y({type:H.toggle,payload:e.value,event:t});break;case n.Keys.delete:E(t)}e.onKeyDown&&e.onKeyDown.call(void 0,{target:s.current,syntheticEvent:t})}),[e.onKeyDown,e.value,C,y,E]),K=r.useCallback((t=>{C({payload:e.value,type:U.current,event:t}),e.onFocus&&e.onFocus.call(void 0,{target:s.current,syntheticEvent:t})}),[e.onFocus,e.value,C]),B=r.useCallback((t=>{e.onBlur&&e.onBlur.call(void 0,{target:s.current,syntheticEvent:t})}),[e.onBlur]),O=n.useMouse(e,s,{onClick:w});return r.createElement("div",{...O,role:e.role||"button",id:e.value,style:e.style,ref:o,dir:v,tabIndex:n.getTabIndex(e.tabIndex,a,void 0),className:n.classNames("k-chip",{"k-rtl":"rtl"===v,"k-disabled":a,"k-selected":x,"k-focus":D,[`k-chip-${n.kendoThemeMaps.sizeMap[u]||u}`]:u,[`k-rounded-${n.kendoThemeMaps.roundedMap[p]||p}`]:p,[`k-chip-${d}`]:d,[`k-chip-${d}-${c}`]:!(!d||!c)},e.className),"aria-pressed":e.role?void 0:x,"aria-disabled":a,"aria-describedby":e.ariaDescribedBy,"aria-keyshortcuts":g?"Enter Delete":void 0,onFocus:K,onBlur:B,onKeyDown:N},x&&(e.selectedIcon||e.selectedSvgIcon)&&r.createElement(n.IconWrap,{className:"k-chip-icon",name:e.selectedIcon?n.toIconName(e.selectedIcon):void 0,icon:e.selectedSvgIcon,size:"small"}),(e.icon||e.svgIcon)&&r.createElement(n.IconWrap,{className:"k-chip-icon",name:e.icon?n.toIconName(e.icon):void 0,icon:e.svgIcon,size:"small"}),e.avatar&&r.createElement("div",{className:`k-chip-avatar k-avatar k-rounded-${e.avatar.rounded} k-avatar-md k-avatar-solid k-avatar-solid-primary`,style:e.avatar.style},r.createElement("span",{className:"k-avatar-image"},r.createElement("img",{src:e.avatar.image,alt:e.avatar.imageAlt}))),r.createElement("span",{className:"k-chip-content"},void 0!==e.children?e.children:e.text&&r.createElement("span",{"aria-label":e.ariaLabel||e.text,className:"k-chip-label"},e.text)),g&&r.createElement("span",{className:"k-chip-actions"},r.createElement("span",{className:n.classNames("k-chip-action","k-chip-remove-action"),onClick:E},r.createElement(n.IconWrap,{name:m?n.toIconName(m):void 0,icon:f||i.xCircleIcon,size:"small"}))))})),L={id:s.string,text:s.string,value:s.any,dir:s.oneOf(["ltr","rtl"]),removable:s.bool,removeIcon:s.string,removeIconSvg:n.svgIconPropType,disabled:s.bool,icon:s.string,svgIcon:n.svgIconPropType,selectedIcon:s.string,selectedIconSvg:n.svgIconPropType,onRemove:s.func,dataItem:s.any,selected:s.bool,ariaDescribedBy:s.string,size:s.oneOf([null,"small","medium","large"]),rounded:s.oneOf([null,"small","medium","large","full"]),fillMode:s.oneOf([null,"outline","solid"]),themeColor:s.oneOf([null,"base","info","success","warning","error"])},_={disabled:!1,removable:!1,removeIcon:"k-i-x-circle",removeSvgIcon:i.xCircleIcon,dir:"ltr",size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};j.displayName="KendoReactChip",j.propTypes=L;const q=(e,t,s)=>{"multiple"===t.selection?Array.isArray(e)||(e=e?[e]:null):"single"===t.selection&&Array.isArray(e)&&(e=e?e.join(""):null);const[n,o]=r.useState(e);return[n,e=>{const i=((e,t)=>{switch(t.selection){case"single":switch(t.type){case"toggle":if(!Array.isArray(e)||null===e)return t.payload===e?null:t.payload;throw new Error("State cannot be an array in single selection");case"remove":return t.payload===e?null:e;default:return e}case"multiple":switch(t.type){case"toggle":if(Array.isArray(e))return e.some((e=>e===t.payload))?e.filter((e=>e!==t.payload)):[...e,t.payload];if(null===e)return[t.payload];throw new Error("State cannot be non-array in multiple selection");case"remove":return Array.isArray(e)?e.some((e=>e===t.payload))?e.filter((e=>e!==t.payload)):[...e,t.payload]:e;default:return e}case"none":return null;default:return e}})(t.state||n,{...e,...t});s&&s(i,e.event),"none"!==t.selection&&o(i)}]},V=(e,t,s)=>{const[n,o]=r.useState(e);return[n,e=>{const i=((e,t)=>{switch(t.type){case"add":case"reorder":break;case"remove":return e.filter((e=>e[t.valueField]!==t.payload));default:return e}})(t.state||n,{...e,...t});s&&s(i,e.event),o(i)}]},Z=r.forwardRef(((e,t)=>{n.validatePackage(l);const s=r.useRef(null),o=r.useRef(null),{id:i,style:a,tabIndex:d,className:c,ariaDescribedBy:u,ariaLabelledBy:p,ariaLabel:h,value:m,defaultData:f=J.defaultData,chip:g=J.chip,disabled:v=J.disabled,size:b=J.size,defaultValue:y=J.defaultValue,selection:k=J.selection,valueField:C=J.valueField,textField:I=J.textField,dir:x=J.dir,onChange:D,onDataChange:w}=e,E=n.useDir(o,x),N=r.useMemo((()=>g||j),[g,j]);r.useImperativeHandle(s,(()=>({element:o.current,props:e}))),r.useImperativeHandle(t,(()=>s.current));const K=r.useCallback(((e,t)=>{D&&s.current&&D.call(void 0,{value:e,target:s.current,syntheticEvent:t})}),[D]),[B,O]=q(m||y,{selection:k,state:m},K),S=r.useCallback(((e,t)=>{w&&s.current&&w.call(void 0,{value:e,target:s.current,syntheticEvent:t})}),[w]),[z,P]=V(e.data||f,{state:e.data,valueField:C},S),M=r.useCallback(((e,t)=>(e.push(t[C]),e)),[C]),T=r.useMemo((()=>e.data||z),[e.data,z]),F=r.useMemo((()=>m||B),[m,B]),U=r.useMemo((()=>T.reduce(M,[])),[T,M]),W=r.useCallback((e=>n.getter(C)(e)),[C]),H=r.useCallback((e=>n.getter(I)(e)),[I]),[L,_]=(e=>{const[t,s]=r.useState(null);return[t,t=>{const n=((e,t)=>{const s=t.items.findIndex((t=>t===e));switch(t.type){case"next":return s===t.items.length-1?e:t.items[s+1];case"prev":return 0===s?e:t.items[s-1];case"current":return t.payload;case"reset":return null;default:return e}})(t.payload,{...t,...e});s(n)}]})({items:U}),Z=n.useMouse(e,s);return r.createElement(R.Provider,{value:[F,O]},r.createElement(A.Provider,{value:[L,_]},r.createElement($.Provider,{value:[T,P]},r.createElement("div",{ref:o,...Z,role:v?void 0:"listbox",id:i,dir:E,style:a,tabIndex:n.getTabIndex(d,v,void 0),className:n.classNames("k-chip-list",{"k-rtl":"rtl"===E,"k-disabled":v,[`k-chip-list-${n.kendoThemeMaps.sizeMap[b]||b}`]:b},c),"aria-label":h,"aria-labelledby":p,"aria-describedby":u,"aria-orientation":"horizontal","aria-multiselectable":"multiple"===k},T.map(((e,t)=>r.createElement(N,{role:"option",dataItem:e,size:b,key:[W(e),t].join("-"),text:H(e),value:W(e),ariaLabel:e.ariaLabel,svgIcon:e.svgIcon||void 0})))))))})),G={id:s.string,className:s.string,tabIndex:s.number,data:s.any,defaultData:s.arrayOf(s.any),onDataChange:s.func,value:s.oneOfType([s.any,s.arrayOf(s.any)]),defaultValue:s.oneOfType([s.any,s.arrayOf(s.any)]),onChange:s.func,selection:s.oneOf(["single","none","multiple"]),textField:s.string,valueField:s.string,disabled:s.bool,dir:s.oneOf(["ltr","rtl"]),ariaLabelledBy:s.string,ariaDescribedBy:s.string,size:s.oneOf([null,"small","medium","large"])},J={chip:j,size:"medium",disabled:!1,defaultValue:null,defaultData:[],dir:"ltr",selection:"none",textField:"text",valueField:"value",removable:"removable"};Z.displayName="KendoReactChipList",Z.propTypes=G;const Q=r.forwardRef(((e,t)=>{const{className:s,disabled:o,text:i,icon:a,style:l,id:d,focused:c,tabIndex:u,index:p,dataItem:h,item:m,svgIcon:f,onDown:g,onClick:v,...b}=e,y=r.useRef(null),k=r.useCallback((()=>{y.current&&y.current.focus()}),[]),C=r.useCallback((()=>({element:y.current,focus:k})),[k]);r.useImperativeHandle(t,C);const I=r.useCallback((e=>{v&&void 0!==p&&!o&&v(e,p)}),[v,p]),x=r.useMemo((()=>n.classNames("k-fab-item",{"k-focus":c,"k-disabled":o},s)),[s,o,c]),D=m;return r.createElement("li",{ref:y,id:d,className:x,style:l,role:"menuitem",tabIndex:n.getTabIndex(u,o),"aria-disabled":o,"aria-label":`${i||""} floatingactionbutton item`,onClick:I,onMouseDown:g,onPointerDown:g,...b},D?r.createElement(D,{itemIndex:p,item:h}):r.createElement(r.Fragment,null,i&&r.createElement("span",{className:"k-fab-item-text"},i),a||f?r.createElement(n.IconWrap,{className:"k-fab-item-icon",name:a,icon:f}):null))}));Q.propTypes={className:s.string,style:s.object,children:s.any,disabled:s.bool,focused:s.bool,index:s.number,icon:s.string,svgIcon:n.svgIconPropType,text:s.string,tabIndex:s.number,customProp:s.any},Q.displayName="KendoFloatingActionButtonItem";const X="16px",Y=e=>"number"==typeof e?e+"px":e,ee=(e,t)=>{const s={horizontal:t?"right":"left",vertical:"bottom"};return"end"===e.horizontal&&(s.horizontal=t?"left":"right"),s},te=(e,t)=>{const s={horizontal:t?"right":"left",vertical:"top"};return"end"===e.horizontal&&(s.horizontal=t?"left":"right"),s},se=(e,t)=>({rtl:{end:"k-text-left",start:"k-text-right"},ltr:{start:"k-text-left",end:"k-text-right"}}[e]["end"===t?"end":"start"]),ne=(e,t,s,n)=>{const o=t.horizontal,i=t.vertical;if(e.current){const a=s&&void 0!==s.x?Y(s.x):X,r=s&&void 0!==s.x?`calc(50% + ${Y(s.x)})`:"50%",l=s&&void 0!==s.y?Y(s.y):X,d=s&&void 0!==s.y?`calc(50% + ${Y(s.y)})`:"50%";e.current.style.setProperty(oe(t,n),"center"===o?r:a),e.current.style.setProperty(ie(t),"middle"===i?d:l),n&&(("top"===i||"bottom"===i)&&"start"===o&&e.current.style.setProperty("left","unset"),"middle"===i&&"end"===o&&e.current.style.setProperty("right","unset"),"middle"===i&&"start"===o&&e.current.style.setProperty("left","unset"))}},oe=(e,t)=>{const{horizontal:s}=e;return{end:t?"left":"right",center:"left",start:t?"right":"left"}[s||"end"]},ie=e=>({top:"top",middle:"top",bottom:"bottom"}[e.vertical||"bottom"]),ae=r.forwardRef(((e,t)=>{n.validatePackage(l);const{align:s=re.align,alignOffset:i,className:a,disabled:d,icon:c,svgIcon:u,iconClass:p,id:h,items:m,item:f,text:g,positionMode:v=re.positionMode,size:b=re.size,style:y,rounded:k=re.rounded,themeColor:C=re.themeColor,overlayStyle:I,tabIndex:x,accessKey:D,popupSettings:w={},modal:E,onClick:N,onItemClick:K,onFocus:B,onBlur:O,onKeyDown:S,onOpen:z,onClose:P,...M}=e,T=n.useZIndexContext(),F=T?T+2:100,R=r.useRef(null),A=r.useRef(null),$=r.useRef(null),U=r.useRef(null),W=r.useCallback((()=>{A.current&&A.current.focus()}),[]),H=r.useCallback((()=>({element:A.current,focus:W})),[W]);r.useImperativeHandle(R,H),r.useImperativeHandle(t,(()=>R.current));const[j,L]=r.useState(!1),[_,q]=r.useState(!1),[V,Z]=r.useState(-1),G=n.useId()+"-button-id",J=n.useDir(A,e.dir),X="rtl"===J,Y=n.useId()+"-list-id";r.useEffect((()=>{ne(A,s,i,X)}),[A,s,i,X]),r.useEffect((()=>{_&&A&&A.current&&A.current.focus()}),[_,A]);const oe=r.useCallback(((e,t)=>{m&&n.dispatchEvent(t?z:P,e,H(),void 0)}),[z,P,m]),ie=r.useCallback((e=>{!e.target||d||(!m&&N?n.dispatchEvent(N,e,H(),void 0):(L(!j),q(!0),Z(j?-1:0),oe(e,!j)))}),[L,q,Z,N,oe,j,m,d]),ae=r.useCallback((e=>{q(!0),Z(j?0:-1),B&&n.dispatchEvent(B,e,H(),void 0)}),[B,q,Z]),le=r.useCallback((e=>{q(!1),L(!1),Z(-1),n.dispatchEvent(O,e,H(),void 0),j&&oe(e,!1)}),[O,q,L,Z,oe]),de=r.useCallback((e=>{e.preventDefault()}),[]),ce=r.useCallback(((e,t)=>{m&&(m[t].disabled||n.dispatchEvent(K,e,H(),{itemProps:m[t],itemIndex:t}))}),[K]),ue=r.useCallback(((e,t)=>{!e.target||!m||(Z(t),L(!1),ce(e,t),oe(e,!1))}),[Z,L,ce,oe]),pe=r.useCallback((e=>{n.getActiveElement(document)===A.current&&e.preventDefault()}),[A]),he=r.useCallback((e=>{const t=V,s=m?m.length:-1;if(e.altKey)return!j&&e.keyCode===n.Keys.down&&(e.preventDefault(),L(!0),Z(0)),void(j&&e.keyCode===n.Keys.up&&(e.preventDefault(),L(!1),Z(-1)));switch(e.keyCode){case n.Keys.enter:case n.Keys.space:t>=0&&ce(e,t),m||ie(e),e.preventDefault(),L(!j),Z(j?-1:0);break;case n.Keys.esc:e.preventDefault(),L(!1),Z(-1);break;case n.Keys.home:e.preventDefault(),Z(0);break;case n.Keys.end:e.preventDefault(),Z(s-1);break;case n.Keys.down:case n.Keys.right:e.preventDefault(),Z(t+1>=s?0:t+1);break;case n.Keys.up:case n.Keys.left:e.preventDefault(),Z(t-1<0?s-1:t-1)}n.dispatchEvent(S,e,H(),void 0)}),[S,V,Z,X,L]),me=r.useMemo((()=>n.classNames("k-fab k-fab-solid",{"k-fab-sm":"small"===b,"k-fab-md":"medium"===b,"k-fab-lg":"large"===b,"k-disabled":d,"k-pos-absolute":"absolute"===v,"k-pos-fixed":"fixed"===v,"k-focus":_,[`k-rounded-${n.kendoThemeMaps.roundedMap[k]||k}`]:k,[`k-fab-solid-${C}`]:C},`k-${s.vertical}-${s.horizontal}`,a)),[C,b,k,d,v,s,_,a]),fe=m&&m.map(((e,t)=>r.createElement(Q,{...e,key:t,index:t,id:`${Y}-${t}`,disabled:d||e.disabled,focused:V===t,dataItem:e,item:f,className:n.classNames(e.className,se(J||"ltr",s.horizontal)),onClick:ue,onDown:pe}))),ge=!(!c&&!u||g),ve=(A.current?A.current.offsetWidth:0)/2-16;return r.createElement(n.ZIndexContext.Provider,{value:F},r.createElement(r.Fragment,null,r.createElement("button",{ref:A,id:h||G,role:"button",type:"button","aria-disabled":d,"aria-expanded":m?j:void 0,"aria-haspopup":!!m,"aria-label":`${g||""} floatingactionbutton`,"aria-owns":m?Y:void 0,"aria-activedescendant":V>=0&&m?`${Y}-${V}`:void 0,tabIndex:n.getTabIndex(x,d),accessKey:D,dir:J,disabled:d,className:me,style:y,onClick:ie,onMouseDown:de,onFocus:ae,onBlur:le,onKeyDown:he,...M},c||u?r.createElement(n.IconWrap,{className:"k-fab-icon",name:c,icon:u}):p?r.createElement("span",{role:"presentation",className:p}):null,g&&r.createElement("span",{className:"k-fab-text"},g)),E&&j&&r.createElement("div",{className:"k-overlay",style:{zIndex:F,...I}}),r.createElement(o.Popup,{ref:U,anchor:A.current,show:j,animate:w.animate,popupClass:n.classNames("k-popup-transparent k-fab-popup",w.popupClass),anchorAlign:w.anchorAlign||ee(s,X),popupAlign:w.popupAlign||te(s,X),style:{boxShadow:"none"}},r.createElement("ul",{ref:$,role:"menu","aria-labelledby":h,id:Y,className:n.classNames("k-fab-items",{"k-fab-items-bottom":"bottom"!==s.vertical,"k-fab-items-top":"bottom"===s.vertical}),style:{paddingLeft:ge?ve:void 0,paddingRight:ge?ve:void 0}},fe))))}));ae.propTypes={className:s.string,style:s.object,id:s.string,dir:s.string,tabIndex:s.number,accessKey:s.string,disabled:s.bool,icon:s.string,svgIcon:n.svgIconPropType,iconClass:s.string,text:s.string,alignOffset:s.shape({x:s.oneOfType([s.number,s.string]),y:s.oneOfType([s.number,s.string])}),align:s.shape({vertical:s.oneOf(["top","middle","bottom"]),horizontal:s.oneOf(["start","center","end"])}),positionMode:s.oneOf(["absolute","fixed"]),size:s.oneOf([null,"small","medium","large"]),rounded:s.oneOf([null,"small","medium","large","full"]),themeColor:s.oneOf([null,"primary","secondary","tertiary","info","success","warning","error","dark","light","inverse"]),modal:s.bool,overlayStyle:s.object};const re={align:{vertical:"bottom",horizontal:"end"},size:"medium",rounded:"full",themeColor:"primary",positionMode:"fixed"};ae.displayName="KendoFloatingActionButton";const le=n.withIdHOC(O);le.displayName="KendoReactDropDownButton";const de=n.withIdHOC(E);de.displayName="KendoReactSplitButton",e.Button=c,e.ButtonGroup=b,e.Chip=j,e.ChipList=Z,e.DropDownButton=le,e.DropDownButtonClassComponent=O,e.DropDownButtonItem=K,e.FloatingActionButton=ae,e.FloatingActionButtonItem=Q,e.SplitButton=de,e.SplitButtonClassComponent=E,e.SplitButtonItem=C,e.Toolbar=z,e.ToolbarItem=M,e.ToolbarSeparator=T,e.ToolbarSpacer=F,e.toolbarButtons=g}));
|
package/package-metadata.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const e = {
|
|
|
10
10
|
name: "@progress/kendo-react-buttons",
|
|
11
11
|
productName: "KendoReact",
|
|
12
12
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
-
publishDate:
|
|
13
|
+
publishDate: 1723622240,
|
|
14
14
|
version: "",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-buttons",
|
|
3
|
-
"version": "8.3.0-develop.
|
|
3
|
+
"version": "8.3.0-develop.4",
|
|
4
4
|
"description": "All you need in React Button in one package: disabled/enabled states, built-in styles and more. KendoReact Buttons package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@progress/kendo-licensing": "^1.3.4",
|
|
26
|
-
"@progress/kendo-react-common": "8.3.0-develop.
|
|
27
|
-
"@progress/kendo-react-popup": "8.3.0-develop.
|
|
26
|
+
"@progress/kendo-react-common": "8.3.0-develop.4",
|
|
27
|
+
"@progress/kendo-react-popup": "8.3.0-develop.4",
|
|
28
28
|
"@progress/kendo-svg-icons": "^3.0.0",
|
|
29
29
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
30
30
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|