@progress/kendo-react-buttons 9.5.0 → 10.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.
- package/Button.js +1 -1
- package/Button.mjs +35 -37
- package/ButtonGroup.js +1 -1
- package/ButtonGroup.mjs +21 -23
- package/Chip/Chip.js +1 -1
- package/Chip/Chip.mjs +31 -33
- package/Chip/ChipList.js +1 -1
- package/Chip/ChipList.mjs +35 -37
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +29 -31
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +48 -48
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +45 -45
- package/dist/cdn/js/kendo-react-buttons.js +1 -1
- package/index.d.mts +2 -0
- package/index.d.ts +2 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +4 -4
- package/toolbar/Toolbar.js +1 -1
- package/toolbar/Toolbar.mjs +40 -42
package/toolbar/Toolbar.mjs
CHANGED
|
@@ -7,32 +7,30 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
9
|
import n from "prop-types";
|
|
10
|
-
import {
|
|
11
|
-
import { toolbarButtons as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
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:
|
|
20
|
+
keyboardNavigation: w,
|
|
23
21
|
role: x,
|
|
24
22
|
onResize: E,
|
|
25
23
|
style: D,
|
|
26
|
-
tabIndex: B =
|
|
27
|
-
size: b =
|
|
28
|
-
fillMode:
|
|
24
|
+
tabIndex: B = a.tabIndex,
|
|
25
|
+
size: b = a.size,
|
|
26
|
+
fillMode: I = a.fillMode,
|
|
29
27
|
overflow: c,
|
|
30
|
-
scrollButtons: d =
|
|
31
|
-
scrollButtonsPosition: $ =
|
|
32
|
-
buttonScrollSpeed: F =
|
|
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([]),
|
|
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
|
-
|
|
41
|
+
R,
|
|
44
42
|
() => ({
|
|
45
43
|
element: r.current,
|
|
46
44
|
props: i
|
|
47
45
|
})
|
|
48
|
-
), t.useImperativeHandle(A, () =>
|
|
49
|
-
r.current.querySelectorAll(
|
|
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 ||
|
|
52
|
+
if (!r.current || w === !1)
|
|
55
53
|
return;
|
|
56
54
|
s.current = Array.from(
|
|
57
|
-
r.current.querySelectorAll(
|
|
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((
|
|
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
|
|
80
|
-
|
|
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
|
|
89
|
-
E && E.call(void 0, { target:
|
|
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
|
-
}, []),
|
|
95
|
+
}, []), p = t.useCallback(() => {
|
|
98
96
|
const e = m.current;
|
|
99
97
|
if (e) {
|
|
100
|
-
const l = e.scrollLeft === 0, o =
|
|
101
|
-
l &&
|
|
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
|
-
}, [
|
|
101
|
+
}, [y]);
|
|
104
102
|
return t.useEffect(() => {
|
|
105
103
|
const e = m.current;
|
|
106
104
|
if (e)
|
|
107
|
-
return e.addEventListener("scroll",
|
|
108
|
-
e.removeEventListener("scroll",
|
|
105
|
+
return e.addEventListener("scroll", p), () => {
|
|
106
|
+
e.removeEventListener("scroll", p);
|
|
109
107
|
};
|
|
110
|
-
}, [
|
|
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-${
|
|
119
|
-
[`k-toolbar-${
|
|
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" &&
|
|
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:
|
|
128
|
+
dir: y,
|
|
131
129
|
ref: r,
|
|
132
|
-
onKeyDown:
|
|
130
|
+
onKeyDown: w !== !1 ? X : void 0
|
|
133
131
|
},
|
|
134
132
|
c === "scroll" && /* @__PURE__ */ t.createElement(
|
|
135
|
-
|
|
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:
|
|
142
|
+
dir: y,
|
|
145
143
|
isScrollStartPosition: O,
|
|
146
|
-
isScrollEndPosition:
|
|
144
|
+
isScrollEndPosition: z,
|
|
147
145
|
children: k
|
|
148
146
|
}
|
|
149
147
|
),
|
|
150
|
-
c === "section" && /* @__PURE__ */ t.createElement(
|
|
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
|
-
}),
|
|
151
|
+
}), a = {
|
|
154
152
|
tabIndex: 0,
|
|
155
153
|
size: "medium",
|
|
156
154
|
fillMode: "solid",
|