@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.
@@ -7,32 +7,30 @@
7
7
  */
8
8
  import * as t from "react";
9
9
  import n from "prop-types";
10
- import { validatePackage as Y, useDir as Z, classNames as _, kendoThemeMaps as ee, Keys as u } from "@progress/kendo-react-common";
11
- import { toolbarButtons as te } from "../util.mjs";
12
- import { packageMetadata as oe } from "../package-metadata.mjs";
13
- import { ToolbarScrollable as re } from "./tools/ToolbarScrollable.mjs";
14
- import { ToolbarOverflowSection as ne } from "./tools/ToolbarOverflowSection.mjs";
10
+ import { useDir as Y, classNames as Z, kendoThemeMaps as _, Keys as u } from "@progress/kendo-react-common";
11
+ import { toolbarButtons as ee } from "../util.mjs";
12
+ import { ToolbarScrollable as te } from "./tools/ToolbarScrollable.mjs";
13
+ import { ToolbarOverflowSection as oe } from "./tools/ToolbarOverflowSection.mjs";
15
14
  const N = t.forwardRef((i, A) => {
16
- Y(oe);
17
15
  const {
18
16
  children: k,
19
17
  className: K,
20
18
  id: j,
21
19
  ariaLabel: q,
22
- keyboardNavigation: p,
20
+ keyboardNavigation: w,
23
21
  role: x,
24
22
  onResize: E,
25
23
  style: D,
26
- tabIndex: B = f.tabIndex,
27
- size: b = f.size,
28
- fillMode: w = f.fillMode,
24
+ tabIndex: B = a.tabIndex,
25
+ size: b = a.size,
26
+ fillMode: I = a.fillMode,
29
27
  overflow: c,
30
- scrollButtons: d = f.scrollButtons,
31
- scrollButtonsPosition: $ = f.scrollButtonsPosition,
32
- buttonScrollSpeed: F = f.buttonScrollSpeed,
28
+ scrollButtons: d = a.scrollButtons,
29
+ scrollButtonsPosition: $ = a.scrollButtonsPosition,
30
+ buttonScrollSpeed: F = a.buttonScrollSpeed,
33
31
  prevButton: G,
34
32
  nextButton: J
35
- } = i, C = t.useRef(!1), r = t.useRef(null), m = t.useRef(null), h = t.useRef(0), S = t.useRef(0), s = t.useRef([]), I = t.useRef({ element: null, props: i }), [Q, U] = t.useState(!1), [O, P] = t.useState(!0), [W, z] = t.useState(!1), g = Z(r, i.dir), y = t.useMemo(() => i.buttons || te, [i.buttons]), V = t.useMemo(() => y.map((e) => e + ":focus").join(","), [y]), M = () => {
33
+ } = i, C = t.useRef(!1), r = t.useRef(null), m = t.useRef(null), h = t.useRef(0), S = t.useRef(0), s = t.useRef([]), R = t.useRef({ element: null, props: i }), [Q, U] = t.useState(!1), [O, W] = t.useState(!0), [z, P] = t.useState(!1), y = Y(r, i.dir), g = t.useMemo(() => i.buttons || ee, [i.buttons]), V = t.useMemo(() => g.map((e) => e + ":focus").join(","), [g]), M = () => {
36
34
  const e = r.current && r.current.querySelector(V);
37
35
  return Math.max(
38
36
  0,
@@ -40,21 +38,21 @@ const N = t.forwardRef((i, A) => {
40
38
  );
41
39
  };
42
40
  t.useImperativeHandle(
43
- I,
41
+ R,
44
42
  () => ({
45
43
  element: r.current,
46
44
  props: i
47
45
  })
48
- ), t.useImperativeHandle(A, () => I.current), t.useEffect(() => (window.addEventListener("resize", L), r.current && (S.current = r.current.offsetWidth, h.current = r.current.offsetHeight, p !== !1 && (s.current = Array.from(
49
- r.current.querySelectorAll(y.join(","))
46
+ ), t.useImperativeHandle(A, () => R.current), t.useEffect(() => (window.addEventListener("resize", L), r.current && (S.current = r.current.offsetWidth, h.current = r.current.offsetHeight, w !== !1 && (s.current = Array.from(
47
+ r.current.querySelectorAll(g.join(","))
50
48
  ), H(0))), () => {
51
49
  window.removeEventListener("resize", L), s.current.length = 0;
52
50
  }), []), t.useEffect(() => {
53
51
  if (C.current) {
54
- if (!r.current || p === !1)
52
+ if (!r.current || w === !1)
55
53
  return;
56
54
  s.current = Array.from(
57
- r.current.querySelectorAll(y.join(","))
55
+ r.current.querySelectorAll(g.join(","))
58
56
  ), H(M()), T();
59
57
  } else
60
58
  C.current = !0;
@@ -65,7 +63,7 @@ const N = t.forwardRef((i, A) => {
65
63
  });
66
64
  }, X = (e) => {
67
65
  const l = e.keyCode === u.left || e.keyCode === u.right || e.keyCode === u.home || e.keyCode === u.end, o = M();
68
- !l || e.defaultPrevented || s.current.findIndex((a) => a === e.target) === -1 || (e.keyCode === u.left ? v(
66
+ !l || e.defaultPrevented || s.current.findIndex((f) => f === e.target) === -1 || (e.keyCode === u.left ? v(
69
67
  o,
70
68
  o === 0 ? s.current.length - 1 : o - 1
71
69
  ) : v(
@@ -76,8 +74,8 @@ const N = t.forwardRef((i, A) => {
76
74
  const o = s.current[l];
77
75
  if (o) {
78
76
  o.tabIndex = B, o.focus();
79
- const a = s.current[e];
80
- a && (a.tabIndex = -1);
77
+ const f = s.current[e];
78
+ f && (f.tabIndex = -1);
81
79
  }
82
80
  }, L = (e) => {
83
81
  if (!r.current)
@@ -85,8 +83,8 @@ const N = t.forwardRef((i, A) => {
85
83
  const l = r.current.offsetWidth, o = r.current.offsetHeight;
86
84
  if (S.current !== l || h.current !== o) {
87
85
  S.current = l, h.current = o;
88
- const a = { offsetWidth: S.current, offsetHeight: h.current };
89
- E && E.call(void 0, { target: I.current, ...a, nativeEvent: e });
86
+ const f = { offsetWidth: S.current, offsetHeight: h.current };
87
+ E && E.call(void 0, { target: R.current, ...f, nativeEvent: e });
90
88
  }
91
89
  T();
92
90
  }, T = t.useCallback(() => {
@@ -94,45 +92,45 @@ const N = t.forwardRef((i, A) => {
94
92
  e && U(
95
93
  e.scrollWidth > e.clientWidth || e.scrollHeight > e.clientHeight
96
94
  );
97
- }, []), R = t.useCallback(() => {
95
+ }, []), p = t.useCallback(() => {
98
96
  const e = m.current;
99
97
  if (e) {
100
- const l = e.scrollLeft === 0, o = g !== "rtl" ? e.scrollLeft + e.clientWidth === e.scrollWidth : e.clientWidth - e.scrollLeft === e.scrollWidth;
101
- l && P(!0), o && z(!0), !l && !o && (P(!1), z(!1));
98
+ const l = e.scrollLeft === 0, o = y !== "rtl" ? e.scrollLeft + e.clientWidth === e.scrollWidth : e.clientWidth - e.scrollLeft === e.scrollWidth;
99
+ l && W(!0), o && P(!0), !l && !o && (W(!1), P(!1));
102
100
  }
103
- }, [g]);
101
+ }, [y]);
104
102
  return t.useEffect(() => {
105
103
  const e = m.current;
106
104
  if (e)
107
- return e.addEventListener("scroll", R), () => {
108
- e.removeEventListener("scroll", R);
105
+ return e.addEventListener("scroll", p), () => {
106
+ e.removeEventListener("scroll", p);
109
107
  };
110
- }, [R]), /* @__PURE__ */ t.createElement(
108
+ }, [p]), /* @__PURE__ */ t.createElement(
111
109
  "div",
112
110
  {
113
111
  id: j,
114
112
  "aria-label": q,
115
- className: _(
113
+ className: Z(
116
114
  "k-toolbar",
117
115
  {
118
- [`k-toolbar-${ee.sizeMap[b] || b}`]: b,
119
- [`k-toolbar-${w}`]: w,
116
+ [`k-toolbar-${_.sizeMap[b] || b}`]: b,
117
+ [`k-toolbar-${I}`]: I,
120
118
  "k-toolbar-scrollable": c === "scroll",
121
119
  "k-toolbar-scrollable-overlay": c === "scroll" && (d === "hidden" || d === void 0),
122
120
  "k-toolbar-scrollable-start": c === "scroll" && d === "hidden" && O,
123
- "k-toolbar-scrollable-end": c === "scroll" && d === "hidden" && W,
121
+ "k-toolbar-scrollable-end": c === "scroll" && d === "hidden" && z,
124
122
  "k-toolbar-section": i.overflow && c === "section"
125
123
  },
126
124
  K
127
125
  ),
128
126
  style: D,
129
127
  role: x !== void 0 ? x || void 0 : "toolbar",
130
- dir: g,
128
+ dir: y,
131
129
  ref: r,
132
- onKeyDown: p !== !1 ? X : void 0
130
+ onKeyDown: w !== !1 ? X : void 0
133
131
  },
134
132
  c === "scroll" && /* @__PURE__ */ t.createElement(
135
- re,
133
+ te,
136
134
  {
137
135
  scrollButtons: d,
138
136
  scrollButtonsPosition: $,
@@ -141,16 +139,16 @@ const N = t.forwardRef((i, A) => {
141
139
  isOverflowing: Q,
142
140
  scrollContentRef: m,
143
141
  buttonScrollSpeed: F,
144
- dir: g,
142
+ dir: y,
145
143
  isScrollStartPosition: O,
146
- isScrollEndPosition: W,
144
+ isScrollEndPosition: z,
147
145
  children: k
148
146
  }
149
147
  ),
150
- c === "section" && /* @__PURE__ */ t.createElement(ne, { toolbarRef: r, fillMode: w, size: b }, k),
148
+ c === "section" && /* @__PURE__ */ t.createElement(oe, { toolbarRef: r, fillMode: I, size: b }, k),
151
149
  (c === "none" || c === void 0) && k
152
150
  );
153
- }), f = {
151
+ }), a = {
154
152
  tabIndex: 0,
155
153
  size: "medium",
156
154
  fillMode: "solid",