@progress/kendo-react-buttons 9.5.0 → 10.0.0-develop.1
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 +35 -37
- package/ButtonGroup.js +1 -1
- package/ButtonGroup.mjs +21 -23
- package/Chip/Chip.js +1 -1
- package/Chip/Chip.mjs +31 -33
- package/Chip/ChipList.js +1 -1
- package/Chip/ChipList.mjs +35 -37
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +29 -31
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +48 -48
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +45 -45
- package/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/index.d.mts +2 -0
- package/index.d.ts +2 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +4 -4
- package/toolbar/Toolbar.js +1 -1
- package/toolbar/Toolbar.mjs +40 -42
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ke=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ke=require("react"),n=require("prop-types"),o=require("@progress/kendo-react-common"),ye=require("./FloatingActionButtonItem.js"),K=require("./utils.js"),he=require("@progress/kendo-react-popup");function Ce(d){const g=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const r in d)if(r!=="default"){const k=Object.getOwnPropertyDescriptor(d,r);Object.defineProperty(g,r,k.get?k:{enumerable:!0,get:()=>d[r]})}}return g.default=d,Object.freeze(g)}const t=Ce(ke),ve=2,Ie=100,B=t.forwardRef((d,g)=>{const{align:r=C.align,alignOffset:k,className:M,disabled:f,icon:O,svgIcon:R,iconClass:q,id:$,items:a,item:Y,text:v,positionMode:w=C.positionMode,size:I=C.size,style:ee,rounded:E=C.rounded,themeColor:A=C.themeColor,overlayStyle:te,tabIndex:oe,accessKey:ne,popupSettings:D={},modal:se,onClick:F,onItemClick:j,onFocus:P,onBlur:_,onKeyDown:W,onOpen:Z,onClose:H,...ae}=d,L=o.useZIndexContext(),X=L?L+ve:Ie,U=t.useRef(null),i=t.useRef(null),le=t.useRef(null),ie=t.useRef(null),G=t.useCallback(()=>{i.current&&i.current.focus()},[]),p=t.useCallback(()=>({element:i.current,focus:G}),[G]);t.useImperativeHandle(U,p),t.useImperativeHandle(g,()=>U.current);const[c,u]=t.useState(!1),[x,m]=t.useState(!1),[y,l]=t.useState(-1),re=o.useId()+"-button-id",S=o.useDir(i,d.dir),h=S==="rtl",N=o.useId()+"-list-id";t.useEffect(()=>{K.position(i,r,k,h)},[i,r,k,h]),t.useEffect(()=>{x&&i&&i.current&&i.current.focus()},[x,i]);const b=t.useCallback((e,s)=>{a&&o.dispatchEvent(s?Z:H,e,p(),void 0)},[Z,H,a]),J=t.useCallback(e=>{!e.target||f||(!a&&F?o.dispatchEvent(F,e,p(),void 0):(u(!c),m(!0),l(c?-1:0),b(e,!c)))},[u,m,l,F,b,c,a,f]),ce=t.useCallback(e=>{m(!0),l(c?0:-1),P&&o.dispatchEvent(P,e,p(),void 0)},[P,m,l]),ue=t.useCallback(e=>{m(!1),u(!1),l(-1),o.dispatchEvent(_,e,p(),void 0),c&&b(e,!1)},[_,m,u,l,b]),de=t.useCallback(e=>{e.preventDefault()},[]),T=t.useCallback((e,s)=>{a&&(a[s].disabled||o.dispatchEvent(j,e,p(),{itemProps:a[s],itemIndex:s}))},[j]),fe=t.useCallback((e,s)=>{!e.target||!a||(l(s),u(!1),T(e,s),b(e,!1))},[l,u,T,b]),pe=t.useCallback(e=>{o.getActiveElement(document)===i.current&&e.preventDefault()},[i]),me=t.useCallback(e=>{const s=y,z=a?a.length:-1;if(e.altKey){!c&&e.keyCode===o.Keys.down&&(e.preventDefault(),u(!0),l(0)),c&&e.keyCode===o.Keys.up&&(e.preventDefault(),u(!1),l(-1));return}switch(e.keyCode){case o.Keys.enter:case o.Keys.space:s>=0&&T(e,s),a||J(e),e.preventDefault(),u(!c),l(c?-1:0);break;case o.Keys.esc:e.preventDefault(),u(!1),l(-1);break;case o.Keys.home:e.preventDefault(),l(0);break;case o.Keys.end:e.preventDefault(),l(z-1);break;case o.Keys.down:case o.Keys.right:e.preventDefault(),l(s+1>=z?0:s+1);break;case o.Keys.up:case o.Keys.left:e.preventDefault(),l(s-1<0?z-1:s-1);break}o.dispatchEvent(W,e,p(),void 0)},[W,y,l,h,u]),be=t.useMemo(()=>o.classNames("k-fab k-fab-solid",{"k-fab-sm":I==="small","k-fab-md":I==="medium","k-fab-lg":I==="large","k-disabled":f,"k-pos-absolute":w==="absolute","k-pos-fixed":w==="fixed","k-focus":x,[`k-rounded-${o.kendoThemeMaps.roundedMap[E]||E}`]:E,[`k-fab-solid-${A}`]:A},`k-${r.vertical}-${r.horizontal}`,M),[A,I,E,f,w,r,x,M]),ge=a&&a.map((e,s)=>t.createElement(ye.FloatingActionButtonItem,{...e,key:s,index:s,id:`${N}-${s}`,disabled:f||e.disabled,focused:y===s,dataItem:e,item:Y,className:o.classNames(e.className,K.getTextDirectionClass(S||"ltr",r.horizontal)),onClick:fe,onDown:pe})),Q=!!((O||R)&&!v),V=(i.current?i.current.offsetWidth:0)/2-32/2;return t.createElement(o.ZIndexContext.Provider,{value:X},t.createElement(t.Fragment,null,t.createElement("button",{ref:i,id:$||re,role:"button",type:"button","aria-disabled":f,"aria-expanded":a?c:void 0,"aria-haspopup":!!a,"aria-label":`${v||""} floatingactionbutton`,"aria-owns":a?N:void 0,"aria-activedescendant":y>=0&&a?`${N}-${y}`:void 0,tabIndex:o.getTabIndex(oe,f),accessKey:ne,dir:S,disabled:f,className:be,style:ee,onClick:J,onMouseDown:de,onFocus:ce,onBlur:ue,onKeyDown:me,...ae},O||R?t.createElement(o.IconWrap,{className:"k-fab-icon",name:O,icon:R}):q?t.createElement("span",{role:"presentation",className:q}):null,v&&t.createElement("span",{className:"k-fab-text"},v)),se&&c&&t.createElement("div",{className:"k-overlay",style:{zIndex:X,...te}}),t.createElement(he.Popup,{ref:ie,anchor:i.current,show:c,animate:D.animate,popupClass:o.classNames("k-popup-transparent k-fab-popup",D.popupClass),anchorAlign:D.anchorAlign||K.getAnchorAlign(r,h),popupAlign:D.popupAlign||K.getPopupAlign(r,h),style:{boxShadow:"none"}},t.createElement("ul",{ref:le,role:"menu","aria-labelledby":$,id:N,className:o.classNames("k-fab-items",{"k-fab-items-bottom":r.vertical!=="bottom","k-fab-items-top":r.vertical==="bottom"}),style:{paddingLeft:Q?V:void 0,paddingRight:Q?V:void 0}},ge))))});B.propTypes={className:n.string,style:n.object,id:n.string,dir:n.string,tabIndex:n.number,accessKey:n.string,disabled:n.bool,icon:n.string,svgIcon:o.svgIconPropType,iconClass:n.string,text:n.string,alignOffset:n.shape({x:n.oneOfType([n.number,n.string]).isRequired,y:n.oneOfType([n.number,n.string]).isRequired}),align:n.shape({vertical:n.oneOf(["top","middle","bottom"]).isRequired,horizontal:n.oneOf(["start","center","end"]).isRequired}),positionMode:n.oneOf(["absolute","fixed"]),size:n.oneOf([null,"small","medium","large"]),rounded:n.oneOf([null,"small","medium","large","full"]),themeColor:n.oneOf([null,"primary","secondary","tertiary","info","success","warning","error","dark","light","inverse"]),modal:n.bool,overlayStyle:n.object};const C={align:{vertical:"bottom",horizontal:"end"},size:"medium",rounded:"full",themeColor:"primary",positionMode:"fixed"};B.displayName="KendoFloatingActionButton";exports.FloatingActionButton=B;
|
|
@@ -7,17 +7,15 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
9
|
import o from "prop-types";
|
|
10
|
-
import {
|
|
11
|
-
import { FloatingActionButtonItem as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { Popup as Pe } from "@progress/kendo-react-popup";
|
|
10
|
+
import { useZIndexContext as Ce, useId as V, useDir as ye, dispatchEvent as b, getActiveElement as Ie, Keys as c, classNames as D, kendoThemeMaps as ve, ZIndexContext as Ee, getTabIndex as xe, IconWrap as De, svgIconPropType as Ne } from "@progress/kendo-react-common";
|
|
11
|
+
import { FloatingActionButtonItem as we } from "./FloatingActionButtonItem.mjs";
|
|
12
|
+
import { position as Re, getTextDirectionClass as Ae, getAnchorAlign as Fe, getPopupAlign as Oe } from "./utils.mjs";
|
|
13
|
+
import { Popup as ze } from "@progress/kendo-react-popup";
|
|
15
14
|
const Te = 2, Be = 100, Y = t.forwardRef(
|
|
16
|
-
(
|
|
17
|
-
Ce(Ae);
|
|
15
|
+
(M, ee) => {
|
|
18
16
|
const {
|
|
19
17
|
align: u = h.align,
|
|
20
|
-
alignOffset:
|
|
18
|
+
alignOffset: P,
|
|
21
19
|
className: $,
|
|
22
20
|
disabled: d,
|
|
23
21
|
icon: N,
|
|
@@ -45,7 +43,7 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
45
43
|
onOpen: _,
|
|
46
44
|
onClose: H,
|
|
47
45
|
...ie
|
|
48
|
-
} =
|
|
46
|
+
} = M, j = Ce(), L = j ? j + Te : Be, X = t.useRef(null), l = t.useRef(null), re = t.useRef(null), ce = t.useRef(null), U = t.useCallback(() => {
|
|
49
47
|
l.current && l.current.focus();
|
|
50
48
|
}, []), f = t.useCallback(
|
|
51
49
|
() => ({
|
|
@@ -58,10 +56,10 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
58
56
|
ee,
|
|
59
57
|
() => X.current
|
|
60
58
|
);
|
|
61
|
-
const [i, r] = t.useState(!1), [E, p] = t.useState(!1), [g, s] = t.useState(-1), ue = V() + "-button-id", z =
|
|
59
|
+
const [i, r] = t.useState(!1), [E, p] = t.useState(!1), [g, s] = t.useState(-1), ue = V() + "-button-id", z = ye(l, M.dir), k = z === "rtl", x = V() + "-list-id";
|
|
62
60
|
t.useEffect(() => {
|
|
63
|
-
|
|
64
|
-
}, [l, u,
|
|
61
|
+
Re(l, u, P, k);
|
|
62
|
+
}, [l, u, P, k]), t.useEffect(() => {
|
|
65
63
|
E && l && l.current && l.current.focus();
|
|
66
64
|
}, [E, l]);
|
|
67
65
|
const m = t.useCallback(
|
|
@@ -101,7 +99,7 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
101
99
|
[Z, p, r, s, m]
|
|
102
100
|
), pe = t.useCallback((e) => {
|
|
103
101
|
e.preventDefault();
|
|
104
|
-
}, []),
|
|
102
|
+
}, []), T = t.useCallback(
|
|
105
103
|
(e, a) => {
|
|
106
104
|
n && (n[a].disabled || b(W, e, f(), {
|
|
107
105
|
itemProps: n[a],
|
|
@@ -111,17 +109,17 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
111
109
|
[W]
|
|
112
110
|
), me = t.useCallback(
|
|
113
111
|
(e, a) => {
|
|
114
|
-
!e.target || !n || (s(a), r(!1),
|
|
112
|
+
!e.target || !n || (s(a), r(!1), T(e, a), m(e, !1));
|
|
115
113
|
},
|
|
116
|
-
[s, r,
|
|
114
|
+
[s, r, T, m]
|
|
117
115
|
), be = t.useCallback(
|
|
118
116
|
(e) => {
|
|
119
|
-
|
|
117
|
+
Ie(document) === l.current && e.preventDefault();
|
|
120
118
|
},
|
|
121
119
|
[l]
|
|
122
120
|
), ge = t.useCallback(
|
|
123
121
|
(e) => {
|
|
124
|
-
const a = g,
|
|
122
|
+
const a = g, B = n ? n.length : -1;
|
|
125
123
|
if (e.altKey) {
|
|
126
124
|
!i && e.keyCode === c.down && (e.preventDefault(), r(!0), s(0)), i && e.keyCode === c.up && (e.preventDefault(), r(!1), s(-1));
|
|
127
125
|
return;
|
|
@@ -129,7 +127,7 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
129
127
|
switch (e.keyCode) {
|
|
130
128
|
case c.enter:
|
|
131
129
|
case c.space:
|
|
132
|
-
a >= 0 &&
|
|
130
|
+
a >= 0 && T(e, a), n || G(e), e.preventDefault(), r(!i), s(i ? -1 : 0);
|
|
133
131
|
break;
|
|
134
132
|
case c.esc:
|
|
135
133
|
e.preventDefault(), r(!1), s(-1);
|
|
@@ -138,15 +136,15 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
138
136
|
e.preventDefault(), s(0);
|
|
139
137
|
break;
|
|
140
138
|
case c.end:
|
|
141
|
-
e.preventDefault(), s(
|
|
139
|
+
e.preventDefault(), s(B - 1);
|
|
142
140
|
break;
|
|
143
141
|
case c.down:
|
|
144
142
|
case c.right:
|
|
145
|
-
e.preventDefault(), s(a + 1 >=
|
|
143
|
+
e.preventDefault(), s(a + 1 >= B ? 0 : a + 1);
|
|
146
144
|
break;
|
|
147
145
|
case c.up:
|
|
148
146
|
case c.left:
|
|
149
|
-
e.preventDefault(), s(a - 1 < 0 ?
|
|
147
|
+
e.preventDefault(), s(a - 1 < 0 ? B - 1 : a - 1);
|
|
150
148
|
break;
|
|
151
149
|
}
|
|
152
150
|
b(
|
|
@@ -168,7 +166,7 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
168
166
|
"k-pos-absolute": R === "absolute",
|
|
169
167
|
"k-pos-fixed": R === "fixed",
|
|
170
168
|
"k-focus": E,
|
|
171
|
-
[`k-rounded-${
|
|
169
|
+
[`k-rounded-${ve.roundedMap[I] || I}`]: I,
|
|
172
170
|
[`k-fab-solid-${A}`]: A
|
|
173
171
|
},
|
|
174
172
|
`k-${u.vertical}-${u.horizontal}`,
|
|
@@ -176,7 +174,7 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
176
174
|
),
|
|
177
175
|
[A, y, I, d, R, u, E, $]
|
|
178
176
|
), he = n && n.map((e, a) => /* @__PURE__ */ t.createElement(
|
|
179
|
-
|
|
177
|
+
we,
|
|
180
178
|
{
|
|
181
179
|
...e,
|
|
182
180
|
key: a,
|
|
@@ -186,12 +184,12 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
186
184
|
focused: g === a,
|
|
187
185
|
dataItem: e,
|
|
188
186
|
item: te,
|
|
189
|
-
className: D(e.className,
|
|
187
|
+
className: D(e.className, Ae(z || "ltr", u.horizontal)),
|
|
190
188
|
onClick: me,
|
|
191
189
|
onDown: be
|
|
192
190
|
}
|
|
193
191
|
)), J = !!((N || w) && !C), Q = (l.current ? l.current.offsetWidth : 0) / 2 - 32 / 2;
|
|
194
|
-
return /* @__PURE__ */ t.createElement(
|
|
192
|
+
return /* @__PURE__ */ t.createElement(Ee.Provider, { value: L }, /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
195
193
|
"button",
|
|
196
194
|
{
|
|
197
195
|
ref: l,
|
|
@@ -204,7 +202,7 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
204
202
|
"aria-label": `${C || ""} floatingactionbutton`,
|
|
205
203
|
"aria-owns": n ? x : void 0,
|
|
206
204
|
"aria-activedescendant": g >= 0 && n ? `${x}-${g}` : void 0,
|
|
207
|
-
tabIndex:
|
|
205
|
+
tabIndex: xe(ne, d),
|
|
208
206
|
accessKey: se,
|
|
209
207
|
dir: z,
|
|
210
208
|
disabled: d,
|
|
@@ -217,7 +215,7 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
217
215
|
onKeyDown: ge,
|
|
218
216
|
...ie
|
|
219
217
|
},
|
|
220
|
-
N || w ? /* @__PURE__ */ t.createElement(
|
|
218
|
+
N || w ? /* @__PURE__ */ t.createElement(De, { className: "k-fab-icon", name: N, icon: w }) : K ? /* @__PURE__ */ t.createElement("span", { role: "presentation", className: K }) : null,
|
|
221
219
|
C && /* @__PURE__ */ t.createElement("span", { className: "k-fab-text" }, C)
|
|
222
220
|
), le && i && /* @__PURE__ */ t.createElement(
|
|
223
221
|
"div",
|
|
@@ -229,15 +227,15 @@ const Te = 2, Be = 100, Y = t.forwardRef(
|
|
|
229
227
|
}
|
|
230
228
|
}
|
|
231
229
|
), /* @__PURE__ */ t.createElement(
|
|
232
|
-
|
|
230
|
+
ze,
|
|
233
231
|
{
|
|
234
232
|
ref: ce,
|
|
235
233
|
anchor: l.current,
|
|
236
234
|
show: i,
|
|
237
235
|
animate: v.animate,
|
|
238
236
|
popupClass: D("k-popup-transparent k-fab-popup", v.popupClass),
|
|
239
|
-
anchorAlign: v.anchorAlign ||
|
|
240
|
-
popupAlign: v.popupAlign ||
|
|
237
|
+
anchorAlign: v.anchorAlign || Fe(u, k),
|
|
238
|
+
popupAlign: v.popupAlign || Oe(u, k),
|
|
241
239
|
style: { boxShadow: "none" }
|
|
242
240
|
},
|
|
243
241
|
/* @__PURE__ */ t.createElement(
|
|
@@ -270,7 +268,7 @@ Y.propTypes = {
|
|
|
270
268
|
accessKey: o.string,
|
|
271
269
|
disabled: o.bool,
|
|
272
270
|
icon: o.string,
|
|
273
|
-
svgIcon:
|
|
271
|
+
svgIcon: Ne,
|
|
274
272
|
iconClass: o.string,
|
|
275
273
|
text: o.string,
|
|
276
274
|
alignOffset: o.shape({
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const 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"),N=require("@progress/kendo-react-popup"),
|
|
8
|
+
"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"),N=require("@progress/kendo-react-popup"),m=require("./utils/popup.js"),R=require("../package-metadata.js");function q(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=q(K),l=class l 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.showLicenseWatermark=!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},this.showLicenseWatermark=!e.validatePackage(R.packageMetadata,{component:"DropDownButton"})}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:d,size:f,rounded:g,fillMode:y,themeColor:C,ariaLabel:D,title:b,accessKey:k,icon:I,svgIcon:w,iconClass:B,buttonClass:O,className:x,imageUrl:S,startIcon:v,endIcon:E}=this.props;return this.buttonsData=this.props.items||u.Children.toArray(this.props.children).filter(h=>h&&h.type===A.DropDownButtonItem).map(h=>h.props),u.createElement(u.Fragment,null,u.createElement(F.Button,{id:n,size:f,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":d?"true":void 0,tabIndex:a,accessKey:k,icon:I,svgIcon:w,iconClass:B,className:e.classNames(O,x,e.uDropDownButton.wrapper({c:t,focused:this.state.focused,disabled:d})),imageUrl:S,dir:s,ref:h=>this.mainButton=h&&h.element,type:"button","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.showLicenseWatermark&&u.createElement(e.WatermarkOverlay,null),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(N.Popup,{anchor:this.mainButton,show:this.opened,animate:t.animate,popupClass:e.classNames(e.uDropDownButton.popup({c:n}),t.popupClass),anchorAlign:t.anchorAlign||m.getAnchorAlign(o),popupAlign:t.popupAlign||m.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}),r.className,{"k-first":a===0},{"k-last":a===this.buttonsData.length-1}),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"}};l.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},l.defaultProps={size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};let p=l;p.contextType=e.UnstyledContext;exports.DropDownButton=p;
|
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
8
|
+
import * as h from "react";
|
|
9
9
|
import s from "prop-types";
|
|
10
10
|
import { Button as P } from "../Button.mjs";
|
|
11
|
-
import { Keys as r, dispatchEvent as d, getActiveElement as m, validatePackage as A, svgIconPropType as M, classNames as
|
|
12
|
-
import { navigate as
|
|
13
|
-
import { DropDownButtonItem as
|
|
11
|
+
import { Keys as r, dispatchEvent as d, getActiveElement as m, validatePackage as A, svgIconPropType as M, classNames as l, uDropDownButton as u, WatermarkOverlay as R, UnstyledContext as N } from "@progress/kendo-react-common";
|
|
12
|
+
import { navigate as T } from "./utils/navigation.mjs";
|
|
13
|
+
import { DropDownButtonItem as L } from "./DropDownButtonItem.mjs";
|
|
14
14
|
import { ButtonItem as z } from "./ButtonItem.mjs";
|
|
15
15
|
import { Popup as U } from "@progress/kendo-react-popup";
|
|
16
|
-
import { getAnchorAlign as
|
|
16
|
+
import { getAnchorAlign as W, getPopupAlign as $ } from "./utils/popup.mjs";
|
|
17
17
|
import { packageMetadata as j } from "../package-metadata.mjs";
|
|
18
|
-
const c = class c extends
|
|
18
|
+
const c = class c extends h.Component {
|
|
19
19
|
constructor(i) {
|
|
20
20
|
super(i), this.state = {
|
|
21
21
|
opened: !1,
|
|
22
22
|
focused: !1,
|
|
23
23
|
focusedIndex: -1
|
|
24
|
-
}, this.mainButton = null, this.list = null, this.skipFocus = !1, this.buttonsData = [], this.onKeyDown = (t) => {
|
|
24
|
+
}, this.mainButton = null, this.list = null, this.skipFocus = !1, this.showLicenseWatermark = !1, this.buttonsData = [], this.onKeyDown = (t) => {
|
|
25
25
|
const { focusedIndex: e } = this.state;
|
|
26
26
|
if (t.altKey) {
|
|
27
27
|
!this.opened && t.keyCode === r.down ? (t.preventDefault(), this.setOpen(!0, t), this.setState({ focusedIndex: 0 })) : this.opened && t.keyCode === r.up && (t.preventDefault(), this.setState({ focusedIndex: -1 }), this.setOpen(!1, t));
|
|
@@ -42,10 +42,10 @@ const c = class c extends a.Component {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
if (this.opened) {
|
|
45
|
-
const n =
|
|
45
|
+
const n = T(e, t.keyCode, t.altKey, this.buttonsData.length);
|
|
46
46
|
o.focusedIndex = n;
|
|
47
|
-
const
|
|
48
|
-
!t.altKey && (
|
|
47
|
+
const a = t.keyCode === r.up || t.keyCode === r.down || t.keyCode === r.left || t.keyCode === r.right;
|
|
48
|
+
!t.altKey && (a || t.keyCode === r.home || t.keyCode === r.end) && t.preventDefault();
|
|
49
49
|
}
|
|
50
50
|
this.setState(o);
|
|
51
51
|
}, this.switchFocus = (t) => {
|
|
@@ -88,7 +88,7 @@ const c = class c extends a.Component {
|
|
|
88
88
|
}), this.setOpen(e, t);
|
|
89
89
|
}, this.dispatchPopupEvent = (t, e) => {
|
|
90
90
|
d(e ? this.props.onOpen : this.props.onClose, t, this, void 0), this.openedDuringOnChange = void 0;
|
|
91
|
-
}, A(j);
|
|
91
|
+
}, this.showLicenseWatermark = !A(j, { component: "DropDownButton" });
|
|
92
92
|
}
|
|
93
93
|
get guid() {
|
|
94
94
|
return this.props.id + "-accessibility-id";
|
|
@@ -103,66 +103,66 @@ const c = class c extends a.Component {
|
|
|
103
103
|
const i = this.isRtl(), t = this.context && this.context.uDropDownButton, e = i ? "rtl" : void 0, {
|
|
104
104
|
id: o,
|
|
105
105
|
style: n,
|
|
106
|
-
tabIndex:
|
|
106
|
+
tabIndex: a,
|
|
107
107
|
disabled: g,
|
|
108
108
|
size: C,
|
|
109
|
-
rounded:
|
|
110
|
-
fillMode:
|
|
111
|
-
themeColor:
|
|
112
|
-
ariaLabel:
|
|
113
|
-
title:
|
|
109
|
+
rounded: D,
|
|
110
|
+
fillMode: y,
|
|
111
|
+
themeColor: k,
|
|
112
|
+
ariaLabel: b,
|
|
113
|
+
title: I,
|
|
114
114
|
accessKey: w,
|
|
115
115
|
icon: x,
|
|
116
116
|
svgIcon: B,
|
|
117
117
|
iconClass: S,
|
|
118
118
|
buttonClass: O,
|
|
119
|
-
className:
|
|
120
|
-
imageUrl:
|
|
119
|
+
className: E,
|
|
120
|
+
imageUrl: F,
|
|
121
121
|
startIcon: v,
|
|
122
122
|
endIcon: K
|
|
123
123
|
} = this.props;
|
|
124
|
-
return this.buttonsData = this.props.items ||
|
|
124
|
+
return this.buttonsData = this.props.items || h.Children.toArray(this.props.children).filter((p) => p && p.type === L).map((p) => p.props), /* @__PURE__ */ h.createElement(h.Fragment, null, /* @__PURE__ */ h.createElement(
|
|
125
125
|
P,
|
|
126
126
|
{
|
|
127
127
|
id: o,
|
|
128
128
|
size: C,
|
|
129
129
|
style: n,
|
|
130
|
-
rounded:
|
|
131
|
-
fillMode:
|
|
132
|
-
themeColor:
|
|
130
|
+
rounded: D,
|
|
131
|
+
fillMode: y,
|
|
132
|
+
themeColor: k,
|
|
133
133
|
onClick: this.onClickMainButton,
|
|
134
134
|
onMouseDown: this.mouseDown,
|
|
135
135
|
onKeyDown: this.onKeyDown,
|
|
136
136
|
onFocus: this.handleFocus,
|
|
137
137
|
onBlur: this.handleButtonBlur,
|
|
138
138
|
"aria-disabled": g ? "true" : void 0,
|
|
139
|
-
tabIndex:
|
|
139
|
+
tabIndex: a,
|
|
140
140
|
accessKey: w,
|
|
141
141
|
icon: x,
|
|
142
142
|
svgIcon: B,
|
|
143
143
|
iconClass: S,
|
|
144
|
-
className:
|
|
144
|
+
className: l(
|
|
145
145
|
O,
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
E,
|
|
147
|
+
u.wrapper({
|
|
148
148
|
c: t,
|
|
149
149
|
focused: this.state.focused,
|
|
150
150
|
disabled: g
|
|
151
151
|
})
|
|
152
152
|
),
|
|
153
|
-
imageUrl:
|
|
153
|
+
imageUrl: F,
|
|
154
154
|
dir: e,
|
|
155
155
|
ref: (p) => this.mainButton = p && p.element,
|
|
156
156
|
type: "button",
|
|
157
157
|
"aria-expanded": this.opened ? "true" : "false",
|
|
158
|
-
"aria-label":
|
|
158
|
+
"aria-label": b,
|
|
159
159
|
"aria-controls": this.opened ? this.guid : void 0,
|
|
160
|
-
title:
|
|
160
|
+
title: I,
|
|
161
161
|
startIcon: v,
|
|
162
162
|
endIcon: K
|
|
163
163
|
},
|
|
164
164
|
this.props.text
|
|
165
|
-
), this.renderPopup(i));
|
|
165
|
+
), this.showLicenseWatermark && /* @__PURE__ */ h.createElement(R, null), this.renderPopup(i));
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
168
|
* @hidden
|
|
@@ -184,19 +184,19 @@ const c = class c extends a.Component {
|
|
|
184
184
|
}
|
|
185
185
|
renderPopup(i) {
|
|
186
186
|
const { popupSettings: t = {}, id: e } = this.props, o = this.context && this.context.uDropDownButton, { focusedIndex: n } = this.state;
|
|
187
|
-
return /* @__PURE__ */
|
|
187
|
+
return /* @__PURE__ */ h.createElement(
|
|
188
188
|
U,
|
|
189
189
|
{
|
|
190
190
|
anchor: this.mainButton,
|
|
191
191
|
show: this.opened,
|
|
192
192
|
animate: t.animate,
|
|
193
|
-
popupClass: u
|
|
194
|
-
anchorAlign: t.anchorAlign ||
|
|
195
|
-
popupAlign: t.popupAlign ||
|
|
193
|
+
popupClass: l(u.popup({ c: o }), t.popupClass),
|
|
194
|
+
anchorAlign: t.anchorAlign || W(i),
|
|
195
|
+
popupAlign: t.popupAlign || $(i),
|
|
196
196
|
style: i ? { direction: "rtl" } : void 0,
|
|
197
197
|
onClose: this.onPopupClose
|
|
198
198
|
},
|
|
199
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ h.createElement(
|
|
200
200
|
"ul",
|
|
201
201
|
{
|
|
202
202
|
role: "list",
|
|
@@ -206,8 +206,8 @@ const c = class c extends a.Component {
|
|
|
206
206
|
ref: this.listRef,
|
|
207
207
|
onKeyDown: this.onKeyDown,
|
|
208
208
|
onBlur: this.handleMenuBlur,
|
|
209
|
-
className:
|
|
210
|
-
|
|
209
|
+
className: l(
|
|
210
|
+
u.ul({
|
|
211
211
|
c: o,
|
|
212
212
|
size: this.props.size
|
|
213
213
|
})
|
|
@@ -219,27 +219,27 @@ const c = class c extends a.Component {
|
|
|
219
219
|
}
|
|
220
220
|
renderChildItems() {
|
|
221
221
|
const { item: i, itemRender: t, textField: e } = this.props, o = this.context && this.context.uDropDownButton;
|
|
222
|
-
return this.buttonsData.length > 0 ? this.buttonsData.map((n,
|
|
222
|
+
return this.buttonsData.length > 0 ? this.buttonsData.map((n, a) => /* @__PURE__ */ h.createElement(
|
|
223
223
|
z,
|
|
224
224
|
{
|
|
225
|
-
className:
|
|
226
|
-
|
|
225
|
+
className: l(
|
|
226
|
+
u.item({
|
|
227
227
|
c: o
|
|
228
228
|
}),
|
|
229
229
|
n.className,
|
|
230
|
-
{ "k-first":
|
|
231
|
-
{ "k-last":
|
|
230
|
+
{ "k-first": a === 0 },
|
|
231
|
+
{ "k-last": a === this.buttonsData.length - 1 }
|
|
232
232
|
),
|
|
233
233
|
dataItem: n,
|
|
234
234
|
textField: e,
|
|
235
|
-
focused: this.state.focusedIndex ===
|
|
235
|
+
focused: this.state.focusedIndex === a,
|
|
236
236
|
onClick: this.onItemClick,
|
|
237
237
|
onDown: this.onItemDown,
|
|
238
238
|
render: t,
|
|
239
239
|
item: i,
|
|
240
|
-
index:
|
|
241
|
-
key:
|
|
242
|
-
id: `${this.guid}-${
|
|
240
|
+
index: a,
|
|
241
|
+
key: a,
|
|
242
|
+
id: `${this.guid}-${a}`
|
|
243
243
|
}
|
|
244
244
|
)) : null;
|
|
245
245
|
}
|
|
@@ -280,7 +280,7 @@ c.propTypes = {
|
|
|
280
280
|
themeColor: "base"
|
|
281
281
|
};
|
|
282
282
|
let f = c;
|
|
283
|
-
f.contextType =
|
|
283
|
+
f.contextType = N;
|
|
284
284
|
export {
|
|
285
285
|
f as DropDownButton
|
|
286
286
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),i=require("prop-types"),c=require("../Button.js"),s=require("@progress/kendo-react-common"),g=require("./ButtonItem.js"),C=require("./SplitButtonItem.js"),b=require("./utils/navigation.js"),y=require("@progress/kendo-react-popup"),m=require("./utils/popup.js"),k=require("../package-metadata.js"),D=require("@progress/kendo-svg-icons");function
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),i=require("prop-types"),c=require("../Button.js"),s=require("@progress/kendo-react-common"),g=require("./ButtonItem.js"),C=require("./SplitButtonItem.js"),b=require("./utils/navigation.js"),y=require("@progress/kendo-react-popup"),m=require("./utils/popup.js"),k=require("../package-metadata.js"),D=require("@progress/kendo-svg-icons");function w(h){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(o,t,e.get?e:{enumerable:!0,get:()=>h[t]})}}return o.default=h,Object.freeze(o)}const a=w(f),d=class d extends a.Component{constructor(o){super(o),this.state={focused:!1,focusedIndex:-1,opened:!1},this.wrapper=null,this.mainButton=null,this.list=null,this.skipFocus=!1,this.buttonsData=[],this.showLicenseWatermark=!1,this.onKeyDown=t=>{const{focusedIndex:e}=this.state;if(t.altKey){!this.opened&&t.keyCode===s.Keys.down?(t.preventDefault(),this.setState({focusedIndex:0}),this.setOpen(!0,t)):this.opened&&t.keyCode===s.Keys.up&&(t.preventDefault(),this.setState({focusedIndex:-1}),this.setOpen(!1,t));return}let n;if(t.keyCode===s.Keys.enter||t.keyCode===s.Keys.space){if(t.preventDefault(),this.dispatchClickEvent(t,e),e>=0){n={focusedIndex:this.opened?-1:0};const r=!this.opened;this.setOpen(r,t)}}else if(this.opened&&t.keyCode===s.Keys.esc){this.setState({focusedIndex:-1}),this.setOpen(!1,t);return}if(this.opened){const r=b.navigate(e,t.keyCode,t.altKey,this.buttonsData.length);r!==e&&(n=n||{},n.focusedIndex=r);const l=t.keyCode===s.Keys.up||t.keyCode===s.Keys.down||t.keyCode===s.Keys.left||t.keyCode===s.Keys.right;!t.altKey&&(l||t.keyCode===s.Keys.home||t.keyCode===s.Keys.end)&&t.preventDefault()}n&&this.setState(n)},this.switchFocus=t=>{this.skipFocus=!0,t(),window.setTimeout(()=>this.skipFocus=!1,0)},this.onFocus=t=>{this.skipFocus||(s.dispatchEvent(this.props.onFocus,t,this,void 0),this.setState({focused:!0}))},this.setOpen=(t,e)=>{this.opened!==t&&(this.openedDuringOnChange=t,this.setState({opened:t}),e?this.dispatchPopupEvent(e,t):this.openedDuringOnChange=void 0)},this.onItemClick=(t,e)=>{this.opened&&this.setState({focusedIndex:0}),this.dispatchClickEvent(t,e),this.setOpen(!1,t)},this.onBlur=t=>{this.skipFocus||(this.setState({focused:!1,focusedIndex:-1}),s.dispatchEvent(this.props.onBlur,t,this,void 0),setTimeout(()=>{this.setOpen(!1,t)},0))},this.onPopupClose=t=>{var n;const e=s.getActiveElement(document);this.element&&this.element.removeAttribute("tabindex"),(e===this.list||(n=this.list)!=null&&n.contains(e))&&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.onSplitPartClick=t=>{if(this.buttonsData.length){const e=!this.opened;this.setState({focusedIndex:e?0:-1,focused:!0}),this.setOpen(e,t)}},this.onDownSplitPart=t=>{t.preventDefault();const e=s.getActiveElement(document);this.element&&e!==this.element&&e!==this.list&&this.element.focus()},this.onItemDown=t=>{s.getActiveElement(document)===this.list&&t.preventDefault()},this.dispatchPopupEvent=(t,e)=>{s.dispatchEvent(e?this.props.onOpen:this.props.onClose,t,this,void 0),this.openedDuringOnChange=void 0},this.showLicenseWatermark=!s.validatePackage(k.packageMetadata,{component:"SplitButton"})}get guid(){return this.props.id?this.props.id+"-accessibility-id":this.props.id}get opened(){return this.openedDuringOnChange!==void 0?this.openedDuringOnChange:this.props.opened===void 0?this.state.opened:this.props.opened}render(){this.buttonsData=this.props.items||a.Children.toArray(this.props.children).filter(p=>p&&p.type===C.SplitButtonItem).map(p=>p.props);const o=this.isRtl(),t=o?"rtl":void 0,{id:e,style:n,tabIndex:r,disabled:l}=this.props;return a.createElement(a.Fragment,null,a.createElement("div",{id:e,style:n,className:s.classNames("k-split-button","k-button-group",{"k-focus":this.state.focused},`k-rounded-${s.kendoThemeMaps.roundedMap[this.props.rounded||"medium"]}`,this.props.className),onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,dir:t,ref:p=>this.wrapper=p},a.createElement(c.Button,{ref:p=>this.mainButton=p&&p.element,type:"button",size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,themeColor:this.props.themeColor,onClick:p=>this.onItemClick(p,-1),disabled:l||void 0,tabIndex:r,accessKey:this.props.accessKey,className:this.props.buttonClass,icon:this.props.icon,svgIcon:this.props.svgIcon,iconClass:this.props.iconClass,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),a.createElement(c.Button,{type:"button",size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,themeColor:this.props.themeColor,icon:"caret-alt-down",svgIcon:D.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(o)),this.showLicenseWatermark&&a.createElement(s.WatermarkOverlay,null))}componentDidMount(){(this.props.dir===void 0&&this.isRtl()||this.opened)&&this.forceUpdate()}get element(){return this.mainButton}dispatchClickEvent(o,t){this.isItemDisabled(t)||(t===-1?s.dispatchEvent(this.props.onButtonClick,o,this,void 0):s.dispatchEvent(this.props.onItemClick,o,this,{item:this.buttonsData[t],itemIndex:t}))}renderPopup(o){const{popupSettings:t={}}=this.props,{focusedIndex:e}=this.state;return a.createElement(y.Popup,{anchor:this.wrapper,show:this.opened,animate:t.animate,popupClass:s.classNames("k-menu-popup",t.popupClass),anchorAlign:t.anchorAlign||m.getAnchorAlign(o),popupAlign:t.popupAlign||m.getPopupAlign(o),style:o?{direction:"rtl"}:void 0,onClose:this.onPopupClose},a.createElement("ul",{role:"menu",id:this.guid,"aria-labelledby":"button-"+this.guid,tabIndex:-1,ref:this.listRef,"aria-activedescendant":e>=0?`${this.guid}-${e}`:void 0,className:s.classNames("k-menu-group",{[`k-menu-group-${s.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size})},this.renderChildItems()))}renderChildItems(){const{item:o,itemRender:t,textField:e}=this.props;return this.buttonsData.length>0?this.buttonsData.map((n,r)=>a.createElement(g.ButtonItem,{className:s.classNames("k-menu-item",{"k-first":r===0},{"k-last":r===this.buttonsData.length-1}),dataItem:n,textField:e,focused:this.state.focusedIndex===r,onClick:this.onItemClick,onDown:this.onItemDown,render:t,item:o,key:r,index:r,id:`${this.guid}-${r}`})):null}isItemDisabled(o){return this.buttonsData[o]?this.buttonsData[o].disabled:this.props.disabled}isRtl(){return this.props.dir!==void 0?this.props.dir==="rtl":!!this.wrapper&&getComputedStyle(this.wrapper).direction==="rtl"}};d.propTypes={accessKey:i.string,ariaLabel:i.string,title:i.string,onButtonClick:i.func,onFocus:i.func,onBlur:i.func,onItemClick:i.func,onOpen:i.func,onClose:i.func,text:i.string,items:i.arrayOf(i.any),textField:i.string,tabIndex:i.number,disabled:i.bool,icon:i.string,svgIcon:s.svgIconPropType,iconClass:i.string,imageUrl:i.string,popupSettings:i.object,itemRender:i.any,item:i.func,className:i.string,buttonClass:i.string,dir:i.string},d.defaultProps={size:"medium",rounded:"medium",fillMode:"solid",themeColor:"base"};let u=d;exports.SplitButton=u;
|