@progress/kendo-react-buttons 14.5.0-develop.9 → 15.0.0-develop.2

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