@progress/kendo-react-buttons 14.5.0-develop.14 → 14.5.0-develop.16

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,237 +7,236 @@
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";
13
- import { Popup as Te } from "@progress/kendo-react-popup";
14
- const Be = 2, Me = 100, ee = t.forwardRef(
15
- (P, te) => {
10
+ import { useZIndexContext as ve, useId as V, 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 Me, getAnchorAlign as Oe } from "./utils.mjs";
13
+ import { Popup as ze } from "@progress/kendo-react-popup";
14
+ const Te = 2, Be = 100, Y = t.forwardRef(
15
+ (g, ee) => {
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,
24
- id: W,
25
- items: s,
26
- item: oe,
27
- text: y,
28
- positionMode: A = C.positionMode,
29
- size: g = C.size,
17
+ align: d = v.align,
18
+ alignOffset: K,
19
+ className: S,
20
+ disabled: u,
21
+ icon: y,
22
+ svgIcon: I,
23
+ iconClass: F,
24
+ id: $,
25
+ items: n,
26
+ item: te,
27
+ text: x,
28
+ positionMode: oe = v.positionMode,
29
+ size: k = v.size,
30
30
  style: ae,
31
- rounded: I = C.rounded,
32
- themeColor: F = C.themeColor,
33
- overlayStyle: se,
34
- tabIndex: ne,
31
+ rounded: E = v.rounded,
32
+ themeColor: M = v.themeColor,
33
+ overlayStyle: ne,
34
+ tabIndex: se,
35
35
  accessKey: le,
36
- popupSettings: v = {},
36
+ popupSettings: D = {},
37
37
  modal: ie,
38
38
  onClick: O,
39
- onItemClick: Z,
39
+ onItemClick: W,
40
40
  onFocus: z,
41
- onBlur: q,
42
- onKeyDown: _,
43
- onOpen: H,
44
- onClose: j,
41
+ onBlur: Z,
42
+ onKeyDown: q,
43
+ onOpen: _,
44
+ onClose: H,
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
+ } = g, j = ve(), L = j ? j + Te : Be, X = t.useRef(null), l = t.useRef(null), ce = t.useRef(null), de = t.useRef(null), U = t.useCallback(() => {
47
47
  l.current && l.current.focus();
48
48
  }, []), f = t.useCallback(
49
49
  () => ({
50
50
  element: l.current,
51
- focus: G
51
+ focus: U
52
52
  }),
53
- [G]
53
+ [U]
54
54
  );
55
- t.useImperativeHandle(U, f), t.useImperativeHandle(
56
- te,
57
- () => U.current
55
+ t.useImperativeHandle(X, f), t.useImperativeHandle(
56
+ ee,
57
+ () => X.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, m] = t.useState(!1), [h, s] = t.useState(-1), ue = V() + "-button-id", T = ye(l, g.dir), C = T === "rtl", A = V() + "-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]);
65
- const m = t.useCallback(
61
+ we(l, d, K, C);
62
+ }, [l, d, K, C]), t.useEffect(() => {
63
+ N && l && l.current && l.current.focus();
64
+ }, [N, l]);
65
+ const p = t.useCallback(
66
66
  (e, a) => {
67
- s && b(a ? H : j, e, f(), void 0);
67
+ n && b(a ? _ : H, e, f(), void 0);
68
68
  },
69
- [H, j, s]
70
- ), J = t.useCallback(
69
+ [_, H, n]
70
+ ), G = t.useCallback(
71
71
  (e) => {
72
- !e.target || d || (!s && O ? b(
72
+ !e.target || u || (!n && O ? b(
73
73
  O,
74
74
  e,
75
75
  f(),
76
76
  void 0
77
- ) : (r(!i), p(!0), n(i ? -1 : 0), m(e, !i)));
77
+ ) : (r(!i), m(!0), s(i ? -1 : 0), p(e, !i)));
78
78
  },
79
- [r, p, n, O, m, i, s, d]
79
+ [r, m, s, O, p, i, n, u]
80
80
  ), fe = t.useCallback(
81
81
  (e) => {
82
- p(!0), n(i ? 0 : -1), z && b(
82
+ m(!0), s(i ? 0 : -1), z && b(
83
83
  z,
84
84
  e,
85
85
  f(),
86
86
  void 0
87
87
  );
88
88
  },
89
- [z, p, n]
90
- ), pe = t.useCallback(
89
+ [z, m, s]
90
+ ), me = t.useCallback(
91
91
  (e) => {
92
- p(!1), r(!1), n(-1), b(
93
- q,
92
+ m(!1), r(!1), s(-1), b(
93
+ Z,
94
94
  e,
95
95
  f(),
96
96
  void 0
97
- ), i && m(e, !1);
97
+ ), i && p(e, !1);
98
98
  },
99
- [q, p, r, n, m]
100
- ), me = t.useCallback((e) => {
99
+ [Z, m, r, s, p]
100
+ ), pe = t.useCallback((e) => {
101
101
  e.preventDefault();
102
102
  }, []), B = t.useCallback(
103
103
  (e, a) => {
104
- s && (s[a].disabled || b(Z, e, f(), {
105
- itemProps: s[a],
104
+ n && (n[a].disabled || b(W, e, f(), {
105
+ itemProps: n[a],
106
106
  itemIndex: a
107
107
  }));
108
108
  },
109
- [Z]
109
+ [W]
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 || !n || (s(a), r(!1), B(e, a), p(e, !1));
113
113
  },
114
- [n, r, B, m]
114
+ [s, r, B, p]
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 = h, P = n ? n.length : -1;
123
123
  if (e.altKey) {
124
- !i && e.keyCode === c.down && (e.preventDefault(), r(!0), n(0)), i && e.keyCode === c.up && (e.preventDefault(), r(!1), n(-1));
124
+ !i && e.keyCode === c.down && (e.preventDefault(), r(!0), s(0)), i && e.keyCode === c.up && (e.preventDefault(), r(!1), s(-1));
125
125
  return;
126
126
  }
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 && B(e, a), n || G(e), e.preventDefault(), r(!i), s(i ? -1 : 0);
131
131
  break;
132
132
  case c.esc:
133
- e.preventDefault(), r(!1), n(-1);
133
+ e.preventDefault(), r(!1), s(-1);
134
134
  break;
135
135
  case c.home:
136
- e.preventDefault(), n(0);
136
+ e.preventDefault(), s(0);
137
137
  break;
138
138
  case c.end:
139
- e.preventDefault(), n(M - 1);
139
+ e.preventDefault(), s(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(), s(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(), s(a - 1 < 0 ? P - 1 : a - 1);
148
148
  break;
149
149
  }
150
150
  b(
151
- _,
151
+ q,
152
152
  e,
153
153
  f(),
154
154
  void 0
155
155
  );
156
156
  },
157
- [_, k, n, h, r]
157
+ [q, h, s, C, r]
158
158
  ), he = t.useMemo(
159
- () => N(
159
+ () => w(
160
160
  "k-fab",
161
161
  {
162
- "k-fab-xs": g === "xsmall",
163
- "k-fab-sm": g === "small",
164
- "k-fab-md": g === "medium",
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
162
+ "k-fab-xs": k === "xsmall",
163
+ "k-fab-sm": k === "small",
164
+ "k-fab-md": k === "medium",
165
+ "k-fab-lg": k === "large",
166
+ "k-disabled": u,
167
+ "k-pos-absolute": g.positionMode === "absolute",
168
+ "k-pos-fixed": g.positionMode === "fixed",
169
+ "k-focus": N,
170
+ [`k-rounded-${xe.roundedMap[E] || E}`]: E,
171
+ [`k-fab-${M}`]: M
172
172
  },
173
- `k-${u.vertical}-${u.horizontal}`,
174
- K
173
+ g.positionMode && `k-${d.vertical}-${d.horizontal}`,
174
+ S
175
175
  ),
176
- [F, g, I, d, A, u, x, K]
177
- ), Ce = s && s.map((e, a) => /* @__PURE__ */ t.createElement(
178
- we,
176
+ [M, k, E, u, oe, d, N, S]
177
+ ), Ce = n && n.map((e, a) => /* @__PURE__ */ t.createElement(
178
+ Re,
179
179
  {
180
180
  ...e,
181
181
  key: a,
182
182
  index: a,
183
- id: `${E}-${a}`,
184
- disabled: d || e.disabled,
185
- focused: k === a,
183
+ id: `${A}-${a}`,
184
+ disabled: u || e.disabled,
185
+ focused: h === a,
186
186
  dataItem: e,
187
- item: oe,
188
- className: N(e.className, Fe(T || "ltr", u.horizontal)),
187
+ item: te,
188
+ className: w(e.className, Fe(T || "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
+ )), J = !!((y || I) && !x), Q = (l.current ? l.current.offsetWidth : 0) / 2 - 32 / 2;
193
+ let R;
194
+ return y || I ? R = /* @__PURE__ */ t.createElement(Ne, { className: "k-fab-icon", name: y, icon: I }) : F ? R = /* @__PURE__ */ t.createElement("span", { role: "presentation", className: F }) : R = null, /* @__PURE__ */ t.createElement(Ee.Provider, { value: L }, /* @__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: $ || ue,
200
199
  type: "button",
201
- "aria-disabled": d,
202
- "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),
200
+ "aria-disabled": u,
201
+ "aria-expanded": n ? i : void 0,
202
+ "aria-haspopup": n ? !0 : void 0,
203
+ "aria-label": !x && (y || I || F) ? "Action" : void 0,
204
+ "aria-owns": n ? A : void 0,
205
+ "aria-activedescendant": h >= 0 && n ? `${A}-${h}` : void 0,
206
+ tabIndex: De(se, u),
208
207
  accessKey: le,
209
208
  dir: T,
210
- disabled: d,
209
+ disabled: u,
211
210
  className: he,
212
211
  style: ae,
213
- onClick: J,
214
- onMouseDown: me,
212
+ onClick: G,
213
+ onMouseDown: pe,
215
214
  onFocus: fe,
216
- onBlur: pe,
215
+ onBlur: me,
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
+ x && /* @__PURE__ */ t.createElement("span", { className: "k-fab-text" }, x)
222
221
  ), ie && i && /* @__PURE__ */ t.createElement(
223
222
  "div",
224
223
  {
225
224
  className: "k-overlay",
226
225
  style: {
227
- zIndex: X,
228
- ...se
226
+ zIndex: L,
227
+ ...ne
229
228
  }
230
229
  }
231
230
  ), /* @__PURE__ */ t.createElement(
232
- Te,
231
+ ze,
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 || Oe(d, C),
239
+ popupAlign: D.popupAlign || Me(d, C),
241
240
  style: { boxShadow: "none" }
242
241
  },
243
242
  /* @__PURE__ */ t.createElement(
@@ -245,15 +244,15 @@ const Be = 2, Me = 100, ee = t.forwardRef(
245
244
  {
246
245
  ref: ce,
247
246
  role: "menu",
248
- "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"
247
+ "aria-labelledby": $,
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
- paddingLeft: Q ? V : void 0,
256
- paddingRight: Q ? V : void 0
254
+ paddingLeft: J ? Q : void 0,
255
+ paddingRight: J ? Q : void 0
257
256
  }
258
257
  },
259
258
  Ce
@@ -261,7 +260,7 @@ const Be = 2, Me = 100, ee = t.forwardRef(
261
260
  )));
262
261
  }
263
262
  );
264
- ee.propTypes = {
263
+ Y.propTypes = {
265
264
  className: o.string,
266
265
  style: o.object,
267
266
  id: o.string,
@@ -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({
@@ -288,14 +287,14 @@ ee.propTypes = {
288
287
  modal: o.bool,
289
288
  overlayStyle: o.object
290
289
  };
291
- const C = {
290
+ const v = {
292
291
  align: { vertical: "bottom", horizontal: "end" },
293
292
  size: void 0,
294
293
  rounded: void 0,
295
294
  themeColor: void 0,
296
295
  positionMode: "fixed"
297
296
  };
298
- ee.displayName = "KendoFloatingActionButton";
297
+ Y.displayName = "KendoFloatingActionButton";
299
298
  export {
300
- ee as FloatingActionButton
299
+ Y as FloatingActionButton
301
300
  };
@@ -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))