@progress/kendo-react-layout 13.4.0-develop.5 → 14.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/dist/cdn/js/kendo-react-layout.js +1 -1
- package/index.d.mts +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -1
- package/index.mjs +105 -104
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
- package/panelbar/PanelBar.d.ts +4 -65
- package/panelbar/PanelBar.js +1 -1
- package/panelbar/PanelBar.mjs +182 -161
- package/panelbar/PanelBarItem.d.ts +8 -46
- package/panelbar/PanelBarItem.js +1 -1
- package/panelbar/PanelBarItem.mjs +125 -119
- package/panelbar/interfaces/PanelBarItemClickEventArguments.d.ts +2 -2
- package/panelbar/interfaces/PanelBarItemHandle.d.ts +17 -0
- package/tabstrip/TabStrip.d.ts +13 -79
- package/tabstrip/TabStrip.js +1 -1
- package/tabstrip/TabStrip.mjs +179 -132
- package/tabstrip/TabStripContent.d.ts +1 -21
- package/tabstrip/TabStripContent.js +1 -1
- package/tabstrip/TabStripContent.mjs +75 -83
- package/tabstrip/TabStripNavigation.d.ts +1 -41
- package/tabstrip/TabStripNavigation.js +1 -1
- package/tabstrip/TabStripNavigation.mjs +159 -146
- package/tabstrip/TabStripNavigationItem.d.ts +5 -27
- package/tabstrip/TabStripNavigationItem.js +1 -1
- package/tabstrip/TabStripNavigationItem.mjs +56 -46
- package/tabstrip/TabStripTab.d.ts +1 -16
- package/tabstrip/TabStripTab.js +1 -1
- package/tabstrip/TabStripTab.mjs +3 -11
package/tabstrip/TabStrip.mjs
CHANGED
|
@@ -5,144 +5,202 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
8
|
+
import * as n from "react";
|
|
9
9
|
import r from "prop-types";
|
|
10
|
-
import { TabStripNavigation as
|
|
11
|
-
import { TabStripContent as
|
|
12
|
-
import { Navigation as
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
import { TabStripNavigation as Y } from "./TabStripNavigation.mjs";
|
|
11
|
+
import { TabStripContent as ie } from "./TabStripContent.mjs";
|
|
12
|
+
import { Navigation as ce, classNames as ae, kendoThemeMaps as ue } from "@progress/kendo-react-common";
|
|
13
|
+
const de = {
|
|
14
|
+
animation: !0,
|
|
15
|
+
tabPosition: "top",
|
|
16
|
+
tabAlignment: "start",
|
|
17
|
+
keepTabsMounted: !1,
|
|
18
|
+
buttonScrollSpeed: 100,
|
|
19
|
+
mouseScrollSpeed: 10,
|
|
20
|
+
scrollButtons: "auto",
|
|
21
|
+
scrollButtonsPosition: "split",
|
|
22
|
+
renderAllContent: !1
|
|
23
|
+
}, E = n.forwardRef((Z, _) => {
|
|
24
|
+
const R = { ...de, ...Z }, {
|
|
25
|
+
id: m,
|
|
26
|
+
animation: H,
|
|
27
|
+
children: M,
|
|
28
|
+
selected: u,
|
|
29
|
+
onSelect: A,
|
|
30
|
+
style: ee,
|
|
31
|
+
tabContentStyle: O,
|
|
32
|
+
tabPosition: p,
|
|
33
|
+
tabAlignment: z,
|
|
34
|
+
tabIndex: L,
|
|
35
|
+
className: W,
|
|
36
|
+
dir: v,
|
|
37
|
+
renderAllContent: P,
|
|
38
|
+
keepTabsMounted: K,
|
|
39
|
+
size: h,
|
|
40
|
+
scrollable: g,
|
|
41
|
+
scrollButtons: x,
|
|
42
|
+
scrollButtonsPosition: j,
|
|
43
|
+
buttonScrollSpeed: F,
|
|
44
|
+
mouseScrollSpeed: te,
|
|
45
|
+
prevButton: U,
|
|
46
|
+
nextButton: $
|
|
47
|
+
} = R, [f, ne] = n.useState(null), oe = n.useRef({ props: R }), C = n.useRef(null), D = n.useRef(null), T = n.useRef(void 0), I = n.useRef(void 0), q = n.useCallback(() => ({ props: R }), [R]);
|
|
48
|
+
n.useImperativeHandle(oe, q), n.useImperativeHandle(_, q);
|
|
49
|
+
const y = n.useMemo(() => m ? m + "-content-panel-id" : void 0, [m]), w = n.useMemo(() => m ? m + "-nav-item-id" : void 0, [m]), S = n.useMemo(() => n.Children.toArray(M).filter(Boolean), [M]), G = n.useCallback(() => /top|bottom/.test(p || "top"), [p]), k = n.useCallback(() => {
|
|
50
|
+
const s = G(), i = D.current;
|
|
51
|
+
if (!i)
|
|
52
|
+
return;
|
|
53
|
+
const a = i.scrollLeft, t = i.clientWidth, e = i.scrollWidth, l = i.scrollTop, o = i.scrollHeight, d = i.clientHeight;
|
|
54
|
+
let c = null;
|
|
55
|
+
const re = s ? e > t : o > d, X = v === "rtl";
|
|
56
|
+
re ? s ? a + t === e || (X && t - a) === e ? c = "end" : a === 0 || X && -a === 0 ? c = "start" : a > 0 && a + t < e || -a > 0 && t - a < e ? c = "middle" : c = null : o - (l + d) === 0 ? c = "bottom" : l === 0 ? c = "top" : l > 0 && o - (l + d) > 0 ? c = "middle" : c = null : c = null, ne(c);
|
|
57
|
+
}, [G, v]), B = n.useCallback(
|
|
58
|
+
(s) => {
|
|
59
|
+
u !== s && A && A({
|
|
60
|
+
selected: s
|
|
26
61
|
});
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return this.props.id + "-nav-item-id";
|
|
44
|
-
}
|
|
45
|
-
/** @hidden */
|
|
46
|
-
componentDidMount() {
|
|
47
|
-
var o;
|
|
48
|
-
const l = this.tabStripRef.current, i = l && getComputedStyle(l).direction === "rtl" || !1;
|
|
49
|
-
l && (this.navigation = new g({
|
|
62
|
+
},
|
|
63
|
+
[u, A]
|
|
64
|
+
), b = n.useCallback(
|
|
65
|
+
(s) => {
|
|
66
|
+
var t, e;
|
|
67
|
+
const i = S;
|
|
68
|
+
((e = (t = i == null ? void 0 : i[s]) == null ? void 0 : t.props) == null ? void 0 : e.disabled) || B(s);
|
|
69
|
+
},
|
|
70
|
+
[S, B]
|
|
71
|
+
), J = n.useCallback((s) => {
|
|
72
|
+
I.current && I.current.triggerKeyboardEvent(s);
|
|
73
|
+
}, []);
|
|
74
|
+
n.useEffect(() => {
|
|
75
|
+
var a;
|
|
76
|
+
const s = C.current, i = s && getComputedStyle(s).direction === "rtl" || !1;
|
|
77
|
+
return s && (I.current = new ce({
|
|
50
78
|
tabIndex: 0,
|
|
51
|
-
root:
|
|
79
|
+
root: C,
|
|
52
80
|
rovingTabIndex: !0,
|
|
53
81
|
focusClass: "k-focus",
|
|
54
82
|
selectors: [".k-tabstrip .k-tabstrip-item"],
|
|
55
83
|
keyboardEvents: {
|
|
56
84
|
keydown: {
|
|
57
|
-
ArrowLeft: (
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
i ? (
|
|
85
|
+
ArrowLeft: (t, e, l) => {
|
|
86
|
+
l.preventDefault();
|
|
87
|
+
const o = e.elements.indexOf(t), d = o !== 0 ? o - 1 : e.elements.length - 1, c = o !== e.elements.length - 1 ? o + 1 : 0;
|
|
88
|
+
i ? (e.focusNext(t), b(c)) : (e.focusPrevious(t), b(d));
|
|
61
89
|
},
|
|
62
|
-
ArrowRight: (
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
i ? (
|
|
90
|
+
ArrowRight: (t, e, l) => {
|
|
91
|
+
l.preventDefault();
|
|
92
|
+
const o = e.elements.indexOf(t), d = o !== 0 ? o - 1 : e.elements.length - 1, c = o !== e.elements.length - 1 ? o + 1 : 0;
|
|
93
|
+
i ? (e.focusPrevious(t), b(d)) : (e.focusNext(t), b(c));
|
|
66
94
|
},
|
|
67
|
-
ArrowDown: (
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
95
|
+
ArrowDown: (t, e, l) => {
|
|
96
|
+
l.preventDefault();
|
|
97
|
+
const o = e.elements.indexOf(t), d = o !== e.elements.length - 1 ? o + 1 : 0;
|
|
98
|
+
e.focusNext(t), b(d);
|
|
71
99
|
},
|
|
72
|
-
ArrowUp: (
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
100
|
+
ArrowUp: (t, e, l) => {
|
|
101
|
+
l.preventDefault();
|
|
102
|
+
const o = e.elements.indexOf(t), d = o !== 0 ? o - 1 : e.elements.length - 1;
|
|
103
|
+
e.focusPrevious(t), b(d);
|
|
76
104
|
},
|
|
77
|
-
Home: (
|
|
78
|
-
|
|
105
|
+
Home: (t, e, l) => {
|
|
106
|
+
l.preventDefault(), e.focusElement(e.first, t), b(0);
|
|
79
107
|
},
|
|
80
|
-
End: (
|
|
81
|
-
|
|
108
|
+
End: (t, e, l) => {
|
|
109
|
+
l.preventDefault(), e.focusElement(e.last, t), b(e.elements.length - 1);
|
|
82
110
|
}
|
|
83
111
|
}
|
|
84
112
|
}
|
|
85
|
-
}), (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* @hidden
|
|
97
|
-
*/
|
|
98
|
-
render() {
|
|
99
|
-
const l = {
|
|
100
|
-
itemsNavRef: this.itemsNavRef,
|
|
101
|
-
...this.props,
|
|
102
|
-
children: this.children(),
|
|
103
|
-
contentPanelId: this.contentPanelId,
|
|
104
|
-
renderAllContent: this.props.renderAllContent,
|
|
105
|
-
navItemId: this.navItemId,
|
|
106
|
-
onKeyDown: this.onKeyDown,
|
|
107
|
-
onSelect: this.onSelect,
|
|
108
|
-
onScroll: this.onScroll,
|
|
109
|
-
containerScrollPosition: this.state.containerScrollPosition,
|
|
110
|
-
scrollButtons: this.props.scrollButtons === "hidden" || this.state.containerScrollPosition === null && this.props.scrollButtons === "auto" ? "hidden" : "visible"
|
|
111
|
-
}, { scrollable: i, scrollButtons: o, size: e, tabPosition: t, tabIndex: n } = l, s = t === "bottom", c = v(
|
|
112
|
-
"k-tabstrip k-pos-relative",
|
|
113
|
+
}), (a = I.current) == null || a.initializeRovingTab(u), k(), T.current = window.ResizeObserver && new ResizeObserver(() => k()), C.current && T.current && T.current.observe(C.current)), () => {
|
|
114
|
+
var t;
|
|
115
|
+
(t = I.current) == null || t.removeFocusListener(), T.current && T.current.disconnect();
|
|
116
|
+
};
|
|
117
|
+
}, [u, b, k]);
|
|
118
|
+
const se = n.useMemo(() => {
|
|
119
|
+
const s = n.Children.count(S);
|
|
120
|
+
return u < s && u > -1 ? /* @__PURE__ */ n.createElement(
|
|
121
|
+
ie,
|
|
113
122
|
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"k-tabstrip-scrollable-end": i && o === "auto" && (this.state.containerScrollPosition === "start" || this.state.containerScrollPosition === "middle")
|
|
123
|
+
index: u,
|
|
124
|
+
selected: u,
|
|
125
|
+
contentPanelId: y,
|
|
126
|
+
navItemId: w,
|
|
127
|
+
animation: H,
|
|
128
|
+
keepTabsMounted: K,
|
|
129
|
+
renderAllContent: P,
|
|
130
|
+
style: O
|
|
123
131
|
},
|
|
124
|
-
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
S
|
|
133
|
+
) : null;
|
|
134
|
+
}, [u, S, y, w, H, K, P, O]), N = x === "hidden" || f === null && x === "auto" ? "hidden" : "visible", Q = n.useMemo(
|
|
135
|
+
() => ({
|
|
136
|
+
itemsNavRef: D,
|
|
137
|
+
children: S,
|
|
138
|
+
selected: u,
|
|
139
|
+
tabIndex: L,
|
|
140
|
+
tabPosition: p,
|
|
141
|
+
tabAlignment: z,
|
|
142
|
+
size: h,
|
|
143
|
+
scrollable: g,
|
|
144
|
+
scrollButtons: N,
|
|
145
|
+
scrollButtonsPosition: j,
|
|
146
|
+
buttonScrollSpeed: F,
|
|
147
|
+
mouseScrollSpeed: te,
|
|
148
|
+
prevButton: U,
|
|
149
|
+
nextButton: $,
|
|
150
|
+
dir: v,
|
|
151
|
+
contentPanelId: y,
|
|
152
|
+
renderAllContent: P,
|
|
153
|
+
navItemId: w,
|
|
154
|
+
onKeyDown: J,
|
|
155
|
+
onSelect: B,
|
|
156
|
+
onScroll: k,
|
|
157
|
+
containerScrollPosition: f
|
|
158
|
+
}),
|
|
159
|
+
[
|
|
160
|
+
D,
|
|
161
|
+
S,
|
|
162
|
+
u,
|
|
163
|
+
L,
|
|
164
|
+
p,
|
|
165
|
+
z,
|
|
166
|
+
h,
|
|
167
|
+
g,
|
|
168
|
+
N,
|
|
169
|
+
j,
|
|
170
|
+
F,
|
|
171
|
+
U,
|
|
172
|
+
$,
|
|
173
|
+
v,
|
|
174
|
+
y,
|
|
175
|
+
P,
|
|
176
|
+
w,
|
|
177
|
+
J,
|
|
178
|
+
B,
|
|
179
|
+
k,
|
|
180
|
+
f
|
|
181
|
+
]
|
|
182
|
+
), V = p === "bottom", le = n.useMemo(
|
|
183
|
+
() => ae(
|
|
184
|
+
"k-tabstrip k-pos-relative",
|
|
128
185
|
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
186
|
+
[`k-tabstrip-${ue.sizeMap[h || "medium"] || h}`]: h,
|
|
187
|
+
"k-tabstrip-left": p === "left",
|
|
188
|
+
"k-tabstrip-right": p === "right",
|
|
189
|
+
"k-tabstrip-bottom": p === "bottom",
|
|
190
|
+
"k-tabstrip-top": p === "top",
|
|
191
|
+
"k-tabstrip-scrollable": g,
|
|
192
|
+
"k-tabstrip-scrollable-start k-tabstrip-scrollable-end": g && N === "visible",
|
|
193
|
+
"k-tabstrip-scrollable-start": g && x === "auto" && (f === "end" || f === "middle"),
|
|
194
|
+
"k-tabstrip-scrollable-end": g && x === "auto" && (f === "start" || f === "middle")
|
|
135
195
|
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
};
|
|
145
|
-
p.propTypes = {
|
|
196
|
+
W
|
|
197
|
+
),
|
|
198
|
+
[h, p, g, x, N, f, W]
|
|
199
|
+
);
|
|
200
|
+
return /* @__PURE__ */ n.createElement("div", { id: m, ref: C, dir: v, className: le, style: ee, onScroll: k }, !V && /* @__PURE__ */ n.createElement(Y, { ...Q }), se, V && /* @__PURE__ */ n.createElement(Y, { ...Q }));
|
|
201
|
+
});
|
|
202
|
+
E.displayName = "TabStrip";
|
|
203
|
+
E.propTypes = {
|
|
146
204
|
id: r.string,
|
|
147
205
|
animation: r.bool,
|
|
148
206
|
children: r.node,
|
|
@@ -156,22 +214,11 @@ p.propTypes = {
|
|
|
156
214
|
className: r.string,
|
|
157
215
|
dir: r.string,
|
|
158
216
|
renderAllContent: r.bool,
|
|
159
|
-
size: r.oneOf(["small", "medium", "large"
|
|
217
|
+
size: r.oneOf(["small", "medium", "large"]),
|
|
160
218
|
scrollButtons: r.oneOf(["auto", "visible", "hidden"]),
|
|
161
219
|
scrollButtonsPosition: r.oneOf(["split", "start", "end", "around", "before", "after"])
|
|
162
|
-
}, p.defaultProps = {
|
|
163
|
-
animation: !0,
|
|
164
|
-
tabPosition: "top",
|
|
165
|
-
tabAlignment: "start",
|
|
166
|
-
keepTabsMounted: !1,
|
|
167
|
-
buttonScrollSpeed: 100,
|
|
168
|
-
mouseScrollSpeed: 10,
|
|
169
|
-
scrollButtons: "auto",
|
|
170
|
-
scrollButtonsPosition: "split",
|
|
171
|
-
size: void 0,
|
|
172
|
-
renderAllContent: !1
|
|
173
220
|
};
|
|
174
|
-
|
|
221
|
+
const ge = E;
|
|
175
222
|
export {
|
|
176
|
-
|
|
223
|
+
ge as TabStrip
|
|
177
224
|
};
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { default as PropTypes } from 'prop-types';
|
|
9
8
|
import * as React from 'react';
|
|
10
9
|
/**
|
|
11
10
|
* The props that are passed to the TabStripContent by the TabStrip.
|
|
@@ -48,23 +47,4 @@ export interface TabStripContentProps {
|
|
|
48
47
|
*/
|
|
49
48
|
navItemId?: string;
|
|
50
49
|
}
|
|
51
|
-
export declare
|
|
52
|
-
/**
|
|
53
|
-
* @hidden
|
|
54
|
-
*/
|
|
55
|
-
static propTypes: {
|
|
56
|
-
animation: PropTypes.Requireable<boolean>;
|
|
57
|
-
children: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | (PropTypes.ReactElementLike | null | undefined)[] | null | undefined>>;
|
|
58
|
-
selected: PropTypes.Requireable<number>;
|
|
59
|
-
style: PropTypes.Requireable<object>;
|
|
60
|
-
};
|
|
61
|
-
private contentId;
|
|
62
|
-
/**
|
|
63
|
-
* @hidden
|
|
64
|
-
*/
|
|
65
|
-
render(): React.JSX.Element | React.JSX.Element[] | null | undefined;
|
|
66
|
-
private renderContent;
|
|
67
|
-
private renderAllContent;
|
|
68
|
-
private renderChild;
|
|
69
|
-
private childFactory;
|
|
70
|
-
}
|
|
50
|
+
export declare const TabStripContent: React.FC<TabStripContentProps>;
|
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react"),c=require("prop-types"),v=require("@progress/kendo-react-animation"),S=require("@progress/kendo-react-common");function N(s){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const e in s)if(e!=="default"){const l=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(o,e,l.get?l:{enumerable:!0,get:()=>s[e]})}}return o.default=s,Object.freeze(o)}const t=N(M),h=s=>{const{children:o,selected:e,contentPanelId:l,keepTabsMounted:p,navItemId:b,renderAllContent:g,animation:d,style:y}=s,u=l,k=t.useCallback(n=>t.cloneElement(n,{...n.props,in:n.props.children.props.id===String(u+e)}),[u,e]),C=t.useCallback((n,r)=>{const a=r===e,i={style:{display:a?void 0:"none"}},f={display:a?void 0:"none"};return n.props.disabled?null:d?t.createElement(v.Fade,{appear:!0,exit:p,style:f,childFactory:p?k:void 0},t.createElement("div",{...i,id:String(u+r),key:r},n.props.children)):t.createElement("div",{...i,key:r},n.props.children)},[e,d,p,k,u]),O=t.useCallback(n=>p?t.Children.map(n,(r,a)=>C(r,a)):C(t.Children.toArray(n)[e],e),[p,C,e]),T=t.useMemo(()=>t.Children.map(o,(n,r)=>{const a=n,i=r===e,f=S.classNames("k-tabstrip-content",{"k-active":i},a.props.contentClassName),E=d?t.createElement(v.Fade,{key:`${r}-${i}`,appear:!0,enter:!0,exit:!1},a.props.children):a.props.children;return t.createElement("div",{className:f,style:y,id:`${l}-${r}`,role:"tabpanel","aria-hidden":!i,hidden:!i,"aria-labelledby":`${b}-${r}`},E)}),[o,e,l,b,y,d]),m=t.useMemo(()=>!o||typeof e!="number"?null:t.Children.toArray(o)[e],[o,e]),$=t.useMemo(()=>S.classNames("k-tabstrip-content","k-active",m==null?void 0:m.props.contentClassName),[m]);return g?T:t.createElement("div",{className:$,style:y,id:l,role:"tabpanel","aria-hidden":p,"aria-labelledby":`${b}-${(e==null?void 0:e.toString())||""}`,tabIndex:0},O(o))};h.propTypes={animation:c.bool,children:c.oneOfType([c.element,c.arrayOf(c.element)]),selected:c.number,style:c.object};h.displayName="TabStripContent";exports.TabStripContent=h;
|
|
@@ -5,96 +5,88 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
10
|
-
import { Fade as
|
|
11
|
-
import { classNames as
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
...
|
|
16
|
-
in:
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
import * as e from "react";
|
|
9
|
+
import l from "prop-types";
|
|
10
|
+
import { Fade as f } from "@progress/kendo-react-animation";
|
|
11
|
+
import { classNames as v } from "@progress/kendo-react-common";
|
|
12
|
+
const k = ($) => {
|
|
13
|
+
const { children: s, selected: t, contentPanelId: p, keepTabsMounted: i, navItemId: u, renderAllContent: E, animation: c, style: y } = $, d = p, h = e.useCallback(
|
|
14
|
+
(n) => e.cloneElement(n, {
|
|
15
|
+
...n.props,
|
|
16
|
+
in: n.props.children.props.id === String(d + t)
|
|
17
|
+
}),
|
|
18
|
+
[d, t]
|
|
19
|
+
), b = e.useCallback(
|
|
20
|
+
(n, r) => {
|
|
21
|
+
const o = r === t, a = {
|
|
22
|
+
style: {
|
|
23
|
+
display: o ? void 0 : "none"
|
|
24
|
+
}
|
|
25
|
+
}, C = {
|
|
26
|
+
display: o ? void 0 : "none"
|
|
27
|
+
};
|
|
28
|
+
return n.props.disabled ? null : c ? /* @__PURE__ */ e.createElement(
|
|
29
|
+
f,
|
|
30
|
+
{
|
|
31
|
+
appear: !0,
|
|
32
|
+
exit: i,
|
|
33
|
+
style: C,
|
|
34
|
+
childFactory: i ? h : void 0
|
|
35
|
+
},
|
|
36
|
+
/* @__PURE__ */ e.createElement("div", { ...a, id: String(d + r), key: r }, n.props.children)
|
|
37
|
+
) : /* @__PURE__ */ e.createElement("div", { ...a, key: r }, n.props.children);
|
|
38
|
+
},
|
|
39
|
+
[t, c, i, h, d]
|
|
40
|
+
), S = e.useCallback(
|
|
41
|
+
(n) => i ? e.Children.map(n, (r, o) => b(r, o)) : b(
|
|
42
|
+
e.Children.toArray(n)[t],
|
|
43
|
+
t
|
|
44
|
+
),
|
|
45
|
+
[i, b, t]
|
|
46
|
+
), I = e.useMemo(() => e.Children.map(s, (n, r) => {
|
|
47
|
+
const o = n, a = r === t, C = v(
|
|
24
48
|
"k-tabstrip-content",
|
|
25
|
-
"k-active",
|
|
26
|
-
|
|
27
|
-
);
|
|
28
|
-
return
|
|
49
|
+
{ "k-active": a },
|
|
50
|
+
o.props.contentClassName
|
|
51
|
+
), N = c ? /* @__PURE__ */ e.createElement(f, { key: `${r}-${a}`, appear: !0, enter: !0, exit: !1 }, o.props.children) : o.props.children;
|
|
52
|
+
return /* @__PURE__ */ e.createElement(
|
|
29
53
|
"div",
|
|
30
54
|
{
|
|
31
|
-
className:
|
|
32
|
-
style:
|
|
33
|
-
id: r
|
|
55
|
+
className: C,
|
|
56
|
+
style: y,
|
|
57
|
+
id: `${p}-${r}`,
|
|
34
58
|
role: "tabpanel",
|
|
35
|
-
"aria-hidden":
|
|
36
|
-
|
|
37
|
-
|
|
59
|
+
"aria-hidden": !a,
|
|
60
|
+
hidden: !a,
|
|
61
|
+
"aria-labelledby": `${u}-${r}`
|
|
38
62
|
},
|
|
39
|
-
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
renderContent(e) {
|
|
43
|
-
return this.props.keepTabsMounted ? n.Children.map(this.props.children, (t, r) => this.renderChild(t, r)) : this.renderChild(
|
|
44
|
-
n.Children.toArray(e)[this.props.selected],
|
|
45
|
-
this.props.selected
|
|
63
|
+
N
|
|
46
64
|
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"aria-labelledby": `${this.props.navItemId}-${r}`
|
|
65
|
-
},
|
|
66
|
-
this.props.animation ? /* @__PURE__ */ n.createElement(d, { key: `${r}-${o}`, appear: !0, enter: !0, exit: !1 }, s.props.children) : s.props.children
|
|
67
|
-
);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
renderChild(e, t) {
|
|
71
|
-
const r = t === this.props.selected, s = {
|
|
72
|
-
style: {
|
|
73
|
-
display: r ? void 0 : "none"
|
|
74
|
-
}
|
|
75
|
-
}, o = {
|
|
76
|
-
position: "initial",
|
|
77
|
-
display: r ? void 0 : "none"
|
|
78
|
-
};
|
|
79
|
-
return e.props.disabled ? null : this.props.animation ? /* @__PURE__ */ n.createElement(
|
|
80
|
-
d,
|
|
81
|
-
{
|
|
82
|
-
appear: !0,
|
|
83
|
-
exit: this.props.keepTabsMounted,
|
|
84
|
-
style: o,
|
|
85
|
-
childFactory: this.props.keepTabsMounted ? this.childFactory : void 0
|
|
86
|
-
},
|
|
87
|
-
/* @__PURE__ */ n.createElement("div", { ...s, id: String(this.contentId + t), key: t }, e.props.children)
|
|
88
|
-
) : /* @__PURE__ */ n.createElement("div", { ...s, key: t }, e.props.children);
|
|
89
|
-
}
|
|
65
|
+
}), [s, t, p, u, y, c]), m = e.useMemo(() => !s || typeof t != "number" ? null : e.Children.toArray(s)[t], [s, t]), M = e.useMemo(
|
|
66
|
+
() => v("k-tabstrip-content", "k-active", m == null ? void 0 : m.props.contentClassName),
|
|
67
|
+
[m]
|
|
68
|
+
);
|
|
69
|
+
return E ? I : /* @__PURE__ */ e.createElement(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
className: M,
|
|
73
|
+
style: y,
|
|
74
|
+
id: p,
|
|
75
|
+
role: "tabpanel",
|
|
76
|
+
"aria-hidden": i,
|
|
77
|
+
"aria-labelledby": `${u}-${(t == null ? void 0 : t.toString()) || ""}`,
|
|
78
|
+
tabIndex: 0
|
|
79
|
+
},
|
|
80
|
+
S(s)
|
|
81
|
+
);
|
|
90
82
|
};
|
|
91
|
-
|
|
92
|
-
animation:
|
|
93
|
-
children:
|
|
94
|
-
selected:
|
|
95
|
-
style:
|
|
83
|
+
k.propTypes = {
|
|
84
|
+
animation: l.bool,
|
|
85
|
+
children: l.oneOfType([l.element, l.arrayOf(l.element)]),
|
|
86
|
+
selected: l.number,
|
|
87
|
+
style: l.object
|
|
96
88
|
};
|
|
97
|
-
|
|
89
|
+
k.displayName = "TabStripContent";
|
|
98
90
|
export {
|
|
99
|
-
|
|
91
|
+
k as TabStripContent
|
|
100
92
|
};
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { default as PropTypes } from 'prop-types';
|
|
9
8
|
import { TabStripSize, ScrollButtons, ScrollButtonsPosition } from './TabStrip.js';
|
|
10
9
|
import { ButtonProps } from '@progress/kendo-react-buttons';
|
|
11
10
|
import * as React from 'react';
|
|
@@ -102,43 +101,4 @@ export interface TabStripNavigationProps {
|
|
|
102
101
|
*/
|
|
103
102
|
itemsNavRef?: React.RefObject<HTMLUListElement | null>;
|
|
104
103
|
}
|
|
105
|
-
export declare
|
|
106
|
-
/**
|
|
107
|
-
* @hidden
|
|
108
|
-
*/
|
|
109
|
-
static propTypes: {
|
|
110
|
-
children: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | (PropTypes.ReactElementLike | null | undefined)[] | null | undefined>>;
|
|
111
|
-
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
112
|
-
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
113
|
-
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
114
|
-
selected: PropTypes.Requireable<number>;
|
|
115
|
-
tabIndex: PropTypes.Requireable<number>;
|
|
116
|
-
scrollable: PropTypes.Requireable<boolean>;
|
|
117
|
-
size: PropTypes.Requireable<string>;
|
|
118
|
-
scrollButtons: PropTypes.Requireable<string>;
|
|
119
|
-
scrollButtonsPosition: PropTypes.Requireable<string>;
|
|
120
|
-
containerScrollPosition: PropTypes.Requireable<string | null>;
|
|
121
|
-
};
|
|
122
|
-
private itemsNavRef;
|
|
123
|
-
/**
|
|
124
|
-
* @hidden
|
|
125
|
-
*/
|
|
126
|
-
componentDidMount(): void;
|
|
127
|
-
/**
|
|
128
|
-
* @hidden
|
|
129
|
-
*/
|
|
130
|
-
componentDidUpdate(prevProps: Readonly<TabStripNavigationProps>): void;
|
|
131
|
-
private onScroll;
|
|
132
|
-
/**
|
|
133
|
-
* @hidden
|
|
134
|
-
*/
|
|
135
|
-
render(): React.JSX.Element;
|
|
136
|
-
private scrollToSelected;
|
|
137
|
-
private horizontalScroll;
|
|
138
|
-
private isRtl;
|
|
139
|
-
private arrowClickPrev;
|
|
140
|
-
private arrowClickNext;
|
|
141
|
-
private handleArrowClick;
|
|
142
|
-
private setNewScrollPosition;
|
|
143
|
-
private renderArrow;
|
|
144
|
-
}
|
|
104
|
+
export declare const TabStripNavigation: React.FC<TabStripNavigationProps>;
|