@progress/kendo-react-layout 14.5.0-develop.12 → 14.5.0-develop.14
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/MenuMcpWrapper.d.ts +17 -0
- package/MenuMcpWrapper.js +8 -0
- package/MenuMcpWrapper.mjs +18 -0
- package/dist/cdn/js/kendo-react-layout.js +1 -1
- package/drawer/Drawer.js +1 -1
- package/drawer/Drawer.mjs +63 -63
- package/drawer/interfaces/DrawerProps.d.ts +8 -0
- package/index.d.mts +1 -2
- package/index.d.ts +1 -2
- package/index.js +1 -1
- package/index.mjs +128 -130
- package/menu/MenuProps.d.ts +6 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/panelbar/PanelBar.js +1 -1
- package/panelbar/PanelBar.mjs +92 -90
- package/panelbar/interfaces/PanelBarProps.d.ts +8 -0
- package/stepper/Stepper.js +1 -1
- package/stepper/Stepper.mjs +109 -107
- package/stepper/interfaces/StepperProps.d.ts +8 -1
- package/tabstrip/TabStrip.d.ts +8 -1
- package/tabstrip/TabStrip.js +1 -1
- package/tabstrip/TabStrip.mjs +126 -125
package/panelbar/PanelBar.js
CHANGED
|
@@ -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 Q=require("react"),m=require("prop-types"),L=require("./PanelBarItem.js"),b=require("./util.js"),d=require("@progress/kendo-react-common"),a=require("./interfaces/NavigationAction.js");function X(o){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const r in o)if(r!=="default"){const k=Object.getOwnPropertyDescriptor(o,r);Object.defineProperty(c,r,k.get?k:{enumerable:!0,get:()=>o[r]})}}return c.default=o,Object.freeze(c)}const i=X(Q),w=o=>{const{animation:c=!0,children:r,dir:k,selected:I,expanded:U,expandMode:R="multiple",className:D,keepItemsMounted:S=!1,onSelect:x,style:j,isControlled:W}=o,K=i.useRef(null),_=i.useRef(null),T=i.useRef(void 0),N=i.useRef(null);d.useWebMcpRegister("panelbar",_,o,o.webMcp);const[p,g]=i.useState(()=>{const t=R||"multiple",u=b.getInitialState(o,t);return u.focused||(u.focused=b.getFirstId(o)),u}),B=R||"multiple",M=I!==void 0?I:p.selected,h=W?U||[]:p.expanded,F=i.useCallback(t=>{N.current=window.setTimeout(()=>t())},[]),C=i.useCallback(t=>{const u=A,s=b.flatChildren(i.Children.toArray(u));let n,l;switch(s.forEach(e=>{e.props.uniquePrivateKey===(t.uniquePrivateKey||p.focused)&&(n=e)}),B){case"single":l=[...n.props.parentUniquePrivateKey,n.props.uniquePrivateKey],b.isArrayEqual(h,l)&&(n.props.parentUniquePrivateKey?l=[...n.props.parentUniquePrivateKey]:l=[]);break;case"multiple":{l=h.slice();const e=l.indexOf(n.props.uniquePrivateKey);e===-1?l.push(n.props.uniquePrivateKey):l.splice(e,1);break}default:l=h.slice();break}g(e=>({...e,selected:n.props.uniquePrivateKey,expanded:l})),x&&x({target:n,expandedItems:l})},[r,p.focused,B,h,x]),f=i.useCallback((t,u=0,s)=>{const n=A,l=b.flatVisibleChildren(i.Children.toArray(n)),e=b.getFocusedChild(l,u,t,p.focused,s);if(e){const v=h.slice();if(s===a.NavigationAction.Right&&e&&e.props&&e.props.children&&e.props.children.length>0){if(v.push(e.props.uniquePrivateKey),g(y=>({...y,expanded:[...new Set(v)]})),e.props.expanded){const y=e.props.children[0].props.uniquePrivateKey;g(P=>({...P,focused:y}))}}else if(s===a.NavigationAction.Left&&(e&&e.props&&e.props.parentUniquePrivateKey&&e.props.parentUniquePrivateKey.length>0||e&&e.props&&!e.props.disabled&&e.props.children&&e.props.children.length>0)){const y=e.props.parentUniquePrivateKey;if(e.props.expanded){const P=e.props.uniquePrivateKey,q=v.indexOf(P);v.splice(q,1),g(J=>({...J,expanded:v}))}else if(e.props.level>0){const P=e.props.parentUniquePrivateKey[y.length-1];g(q=>({...q,focused:P}))}}else T.current=e.props.id,g(y=>({...y,focused:e.props.uniquePrivateKey}))}},[r,p.focused,h]),E=i.useCallback(t=>{C(t),f(t)},[C,f]),A=i.useMemo(()=>b.renderChildren({animation:c,keepItemsMounted:S,state:{...p,selected:M},expanded:h,handleSelect:E,children:r}),[c,S,p,M,h,r,E]),O=i.useCallback((t,u)=>{let s;switch(u){case a.NavigationAction.First:f(t,s,a.NavigationAction.First);break;case a.NavigationAction.Last:f(t,s,a.NavigationAction.Last);break;case a.NavigationAction.Left:f(t,s,a.NavigationAction.Left);break;case a.NavigationAction.Right:f(t,s,a.NavigationAction.Right);break;case a.NavigationAction.Previous:s=-1,f(t,s);break;case a.NavigationAction.Next:s=1,f(t,s);break;case a.NavigationAction.Toggle:C(t);break}},[f,C]),$=i.useCallback(()=>{clearTimeout(N.current),p.wrapperFocused||g(t=>({...t,wrapperFocused:!0}))},[p.wrapperFocused]),z=i.useCallback(()=>{F(()=>{g(t=>({...t,wrapperFocused:!1}))})},[F]),H=i.useCallback(t=>{const u=K.current&&getComputedStyle(K.current).direction==="rtl"||!1;if(t.target===t.currentTarget){const s=t.keyCode;let n;switch(s){case d.Keys.left:n=u?a.NavigationAction.Right:a.NavigationAction.Left;break;case d.Keys.up:n=a.NavigationAction.Previous;break;case d.Keys.right:n=u?a.NavigationAction.Left:a.NavigationAction.Right;break;case d.Keys.down:n=a.NavigationAction.Next;break;case d.Keys.home:n=a.NavigationAction.First;break;case d.Keys.end:n=a.NavigationAction.Last;break;case d.Keys.space:case d.Keys.enter:n=a.NavigationAction.Toggle;break;default:n=null;break}n!==null&&(t.preventDefault(),O(t,n))}},[O]);i.useEffect(()=>()=>{N.current&&clearTimeout(N.current)},[]);const V={"aria-activedescendant":T.current},G=d.classNames("k-panelbar",D);return i.createElement("ul",{ref:K,dir:k,role:"tree",tabIndex:0,onKeyDown:H,onFocus:$,onBlur:z,className:G,style:j,...V},A)};w.propTypes={children:m.oneOfType([m.arrayOf(function(o,c){return o[c].type!==L.PanelBarItem?new Error("PanelBar children should be either PanelBarItem or an array of PanelBarItem."):null}),function(o,c){const r=o[c];return r&&r.type!==L.PanelBarItem?new Error("PanelBar children should be either PanelBarItem or an array of PanelBarItem."):null}]),selected:m.string,expandMode(o,c){const r=o[c];return r!=="single"&&r!=="multiple"&&r!=="default"?new Error(`Invalid value '${r}' given to '${c}'. It must be either 'single', 'multiple' or 'default'.`):null},animation:m.bool,keepItemsMounted:m.bool,onSelect:m.func};w.defaultProps={expandMode:"multiple",animation:!0,keepItemsMounted:!1};exports.PanelBar=w;
|
package/panelbar/PanelBar.mjs
CHANGED
|
@@ -6,169 +6,171 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as a from "react";
|
|
9
|
-
import
|
|
9
|
+
import y from "prop-types";
|
|
10
10
|
import { PanelBarItem as L } from "./PanelBarItem.mjs";
|
|
11
|
-
import { getInitialState as
|
|
12
|
-
import { Keys as m, classNames as
|
|
11
|
+
import { getInitialState as Q, getFirstId as X, flatChildren as Y, isArrayEqual as Z, flatVisibleChildren as _, getFocusedChild as ee, renderChildren as te } from "./util.mjs";
|
|
12
|
+
import { useWebMcpRegister as re, Keys as m, classNames as ne } from "@progress/kendo-react-common";
|
|
13
13
|
import { NavigationAction as n } from "./interfaces/NavigationAction.mjs";
|
|
14
|
-
const U = (
|
|
14
|
+
const U = (c) => {
|
|
15
15
|
const {
|
|
16
|
-
animation:
|
|
16
|
+
animation: u = !0,
|
|
17
17
|
children: o,
|
|
18
18
|
dir: N,
|
|
19
19
|
selected: w,
|
|
20
20
|
expanded: O,
|
|
21
21
|
expandMode: I = "multiple",
|
|
22
22
|
className: A,
|
|
23
|
-
keepItemsMounted:
|
|
23
|
+
keepItemsMounted: R = !1,
|
|
24
24
|
onSelect: C,
|
|
25
25
|
style: D,
|
|
26
26
|
isControlled: W
|
|
27
|
-
} =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
} = c, v = a.useRef(null), $ = a.useRef(null), T = a.useRef(void 0), x = a.useRef(null);
|
|
28
|
+
re("panelbar", $, c, c.webMcp);
|
|
29
|
+
const [p, f] = a.useState(() => {
|
|
30
|
+
const i = Q(c, I || "multiple");
|
|
31
|
+
return i.focused || (i.focused = X(c)), i;
|
|
32
|
+
}), E = I || "multiple", F = w !== void 0 ? w : p.selected, h = W ? O || [] : p.expanded, M = a.useCallback((t) => {
|
|
33
|
+
x.current = window.setTimeout(() => t());
|
|
32
34
|
}, []), g = a.useCallback(
|
|
33
|
-
(
|
|
34
|
-
const
|
|
35
|
-
let
|
|
35
|
+
(t) => {
|
|
36
|
+
const i = K, s = Y(a.Children.toArray(i));
|
|
37
|
+
let r, l;
|
|
36
38
|
switch (s.forEach((e) => {
|
|
37
|
-
e.props.uniquePrivateKey === (
|
|
38
|
-
}),
|
|
39
|
+
e.props.uniquePrivateKey === (t.uniquePrivateKey || p.focused) && (r = e);
|
|
40
|
+
}), E) {
|
|
39
41
|
case "single":
|
|
40
|
-
|
|
42
|
+
l = [...r.props.parentUniquePrivateKey, r.props.uniquePrivateKey], Z(h, l) && (r.props.parentUniquePrivateKey ? l = [...r.props.parentUniquePrivateKey] : l = []);
|
|
41
43
|
break;
|
|
42
44
|
case "multiple": {
|
|
43
|
-
|
|
44
|
-
const e =
|
|
45
|
-
e === -1 ?
|
|
45
|
+
l = h.slice();
|
|
46
|
+
const e = l.indexOf(r.props.uniquePrivateKey);
|
|
47
|
+
e === -1 ? l.push(r.props.uniquePrivateKey) : l.splice(e, 1);
|
|
46
48
|
break;
|
|
47
49
|
}
|
|
48
50
|
default:
|
|
49
|
-
|
|
51
|
+
l = h.slice();
|
|
50
52
|
break;
|
|
51
53
|
}
|
|
52
|
-
f((e) => ({ ...e, selected:
|
|
53
|
-
target:
|
|
54
|
-
expandedItems:
|
|
54
|
+
f((e) => ({ ...e, selected: r.props.uniquePrivateKey, expanded: l })), C && C({
|
|
55
|
+
target: r,
|
|
56
|
+
expandedItems: l
|
|
55
57
|
});
|
|
56
58
|
},
|
|
57
|
-
[o,
|
|
58
|
-
),
|
|
59
|
-
(
|
|
60
|
-
const
|
|
59
|
+
[o, p.focused, E, h, C]
|
|
60
|
+
), d = a.useCallback(
|
|
61
|
+
(t, i = 0, s) => {
|
|
62
|
+
const r = K, l = _(a.Children.toArray(r)), e = ee(l, i, t, p.focused, s);
|
|
61
63
|
if (e) {
|
|
62
64
|
const k = h.slice();
|
|
63
65
|
if (s === n.Right && e && e.props && e.props.children && e.props.children.length > 0) {
|
|
64
|
-
if (k.push(e.props.uniquePrivateKey), f((
|
|
65
|
-
const
|
|
66
|
-
f((P) => ({ ...P, focused:
|
|
66
|
+
if (k.push(e.props.uniquePrivateKey), f((b) => ({ ...b, expanded: [...new Set(k)] })), e.props.expanded) {
|
|
67
|
+
const b = e.props.children[0].props.uniquePrivateKey;
|
|
68
|
+
f((P) => ({ ...P, focused: b }));
|
|
67
69
|
}
|
|
68
70
|
} else if (s === n.Left && (e && e.props && e.props.parentUniquePrivateKey && e.props.parentUniquePrivateKey.length > 0 || e && e.props && !e.props.disabled && e.props.children && e.props.children.length > 0)) {
|
|
69
|
-
const
|
|
71
|
+
const b = e.props.parentUniquePrivateKey;
|
|
70
72
|
if (e.props.expanded) {
|
|
71
73
|
const P = e.props.uniquePrivateKey, q = k.indexOf(P);
|
|
72
|
-
k.splice(q, 1), f((
|
|
74
|
+
k.splice(q, 1), f((J) => ({ ...J, expanded: k }));
|
|
73
75
|
} else if (e.props.level > 0) {
|
|
74
|
-
const P = e.props.parentUniquePrivateKey[
|
|
76
|
+
const P = e.props.parentUniquePrivateKey[b.length - 1];
|
|
75
77
|
f((q) => ({ ...q, focused: P }));
|
|
76
78
|
}
|
|
77
79
|
} else
|
|
78
|
-
|
|
80
|
+
T.current = e.props.id, f((b) => ({ ...b, focused: e.props.uniquePrivateKey }));
|
|
79
81
|
}
|
|
80
82
|
},
|
|
81
|
-
[o,
|
|
83
|
+
[o, p.focused, h]
|
|
82
84
|
), B = a.useCallback(
|
|
83
|
-
(
|
|
84
|
-
g(
|
|
85
|
+
(t) => {
|
|
86
|
+
g(t), d(t);
|
|
85
87
|
},
|
|
86
|
-
[g,
|
|
87
|
-
), K = a.useMemo(() =>
|
|
88
|
-
animation:
|
|
89
|
-
keepItemsMounted:
|
|
90
|
-
state: { ...
|
|
88
|
+
[g, d]
|
|
89
|
+
), K = a.useMemo(() => te({
|
|
90
|
+
animation: u,
|
|
91
|
+
keepItemsMounted: R,
|
|
92
|
+
state: { ...p, selected: F },
|
|
91
93
|
expanded: h,
|
|
92
94
|
handleSelect: B,
|
|
93
95
|
children: o
|
|
94
|
-
}), [
|
|
95
|
-
(
|
|
96
|
+
}), [u, R, p, F, h, o, B]), S = a.useCallback(
|
|
97
|
+
(t, i) => {
|
|
96
98
|
let s;
|
|
97
|
-
switch (
|
|
99
|
+
switch (i) {
|
|
98
100
|
case n.First:
|
|
99
|
-
|
|
101
|
+
d(t, s, n.First);
|
|
100
102
|
break;
|
|
101
103
|
case n.Last:
|
|
102
|
-
|
|
104
|
+
d(t, s, n.Last);
|
|
103
105
|
break;
|
|
104
106
|
case n.Left:
|
|
105
|
-
|
|
107
|
+
d(t, s, n.Left);
|
|
106
108
|
break;
|
|
107
109
|
case n.Right:
|
|
108
|
-
|
|
110
|
+
d(t, s, n.Right);
|
|
109
111
|
break;
|
|
110
112
|
case n.Previous:
|
|
111
|
-
s = -1,
|
|
113
|
+
s = -1, d(t, s);
|
|
112
114
|
break;
|
|
113
115
|
case n.Next:
|
|
114
|
-
s = 1,
|
|
116
|
+
s = 1, d(t, s);
|
|
115
117
|
break;
|
|
116
118
|
case n.Toggle:
|
|
117
|
-
g(
|
|
119
|
+
g(t);
|
|
118
120
|
break;
|
|
119
121
|
}
|
|
120
122
|
},
|
|
121
|
-
[
|
|
122
|
-
),
|
|
123
|
-
clearTimeout(x.current),
|
|
124
|
-
}, [
|
|
125
|
-
|
|
126
|
-
f((
|
|
123
|
+
[d, g]
|
|
124
|
+
), H = a.useCallback(() => {
|
|
125
|
+
clearTimeout(x.current), p.wrapperFocused || f((t) => ({ ...t, wrapperFocused: !0 }));
|
|
126
|
+
}, [p.wrapperFocused]), V = a.useCallback(() => {
|
|
127
|
+
M(() => {
|
|
128
|
+
f((t) => ({ ...t, wrapperFocused: !1 }));
|
|
127
129
|
});
|
|
128
|
-
}, [
|
|
129
|
-
(
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
const s =
|
|
133
|
-
let
|
|
130
|
+
}, [M]), j = a.useCallback(
|
|
131
|
+
(t) => {
|
|
132
|
+
const i = v.current && getComputedStyle(v.current).direction === "rtl" || !1;
|
|
133
|
+
if (t.target === t.currentTarget) {
|
|
134
|
+
const s = t.keyCode;
|
|
135
|
+
let r;
|
|
134
136
|
switch (s) {
|
|
135
137
|
case m.left:
|
|
136
|
-
|
|
138
|
+
r = i ? n.Right : n.Left;
|
|
137
139
|
break;
|
|
138
140
|
case m.up:
|
|
139
|
-
|
|
141
|
+
r = n.Previous;
|
|
140
142
|
break;
|
|
141
143
|
case m.right:
|
|
142
|
-
|
|
144
|
+
r = i ? n.Left : n.Right;
|
|
143
145
|
break;
|
|
144
146
|
case m.down:
|
|
145
|
-
|
|
147
|
+
r = n.Next;
|
|
146
148
|
break;
|
|
147
149
|
case m.home:
|
|
148
|
-
|
|
150
|
+
r = n.First;
|
|
149
151
|
break;
|
|
150
152
|
case m.end:
|
|
151
|
-
|
|
153
|
+
r = n.Last;
|
|
152
154
|
break;
|
|
153
155
|
case m.space:
|
|
154
156
|
case m.enter:
|
|
155
|
-
|
|
157
|
+
r = n.Toggle;
|
|
156
158
|
break;
|
|
157
159
|
default:
|
|
158
|
-
|
|
160
|
+
r = null;
|
|
159
161
|
break;
|
|
160
162
|
}
|
|
161
|
-
|
|
163
|
+
r !== null && (t.preventDefault(), S(t, r));
|
|
162
164
|
}
|
|
163
165
|
},
|
|
164
|
-
[
|
|
166
|
+
[S]
|
|
165
167
|
);
|
|
166
168
|
a.useEffect(() => () => {
|
|
167
169
|
x.current && clearTimeout(x.current);
|
|
168
170
|
}, []);
|
|
169
171
|
const z = {
|
|
170
|
-
"aria-activedescendant":
|
|
171
|
-
}, G =
|
|
172
|
+
"aria-activedescendant": T.current
|
|
173
|
+
}, G = ne("k-panelbar", A);
|
|
172
174
|
return /* @__PURE__ */ a.createElement(
|
|
173
175
|
"ul",
|
|
174
176
|
{
|
|
@@ -177,7 +179,7 @@ const U = (p) => {
|
|
|
177
179
|
role: "tree",
|
|
178
180
|
tabIndex: 0,
|
|
179
181
|
onKeyDown: j,
|
|
180
|
-
onFocus:
|
|
182
|
+
onFocus: H,
|
|
181
183
|
onBlur: V,
|
|
182
184
|
className: G,
|
|
183
185
|
style: D,
|
|
@@ -190,12 +192,12 @@ U.propTypes = {
|
|
|
190
192
|
/**
|
|
191
193
|
* A collection of `PanelBarItem` components.
|
|
192
194
|
*/
|
|
193
|
-
children:
|
|
194
|
-
|
|
195
|
-
return
|
|
195
|
+
children: y.oneOfType([
|
|
196
|
+
y.arrayOf(function(c, u) {
|
|
197
|
+
return c[u].type !== L ? new Error("PanelBar children should be either PanelBarItem or an array of PanelBarItem.") : null;
|
|
196
198
|
}),
|
|
197
|
-
function(
|
|
198
|
-
const o =
|
|
199
|
+
function(c, u) {
|
|
200
|
+
const o = c[u];
|
|
199
201
|
return o && o.type !== L ? new Error("PanelBar children should be either PanelBarItem or an array of PanelBarItem.") : null;
|
|
200
202
|
}
|
|
201
203
|
]),
|
|
@@ -203,29 +205,29 @@ U.propTypes = {
|
|
|
203
205
|
* Expands the item or items that match the `selected` property while respecting the `expandMode` property (see [example]({% slug expandModes_panelbar %}#toc-single-expandMode)).
|
|
204
206
|
* To expand the item on the initial load of the PanelBar, define the `expanded` property of each PanelBarItem.
|
|
205
207
|
*/
|
|
206
|
-
selected:
|
|
208
|
+
selected: y.string,
|
|
207
209
|
/**
|
|
208
210
|
* Sets the expand mode of the PanelBar through the `single`, `multiple`, or `default` keywords (see [example]({% slug expandModes_panelbar %})).
|
|
209
211
|
*/
|
|
210
|
-
expandMode(
|
|
211
|
-
const o =
|
|
212
|
+
expandMode(c, u) {
|
|
213
|
+
const o = c[u];
|
|
212
214
|
return o !== "single" && o !== "multiple" && o !== "default" ? new Error(
|
|
213
|
-
`Invalid value '${o}' given to '${
|
|
215
|
+
`Invalid value '${o}' given to '${u}'. It must be either 'single', 'multiple' or 'default'.`
|
|
214
216
|
) : null;
|
|
215
217
|
},
|
|
216
218
|
/**
|
|
217
219
|
* Enables or disables the animation of the PanelBar items.
|
|
218
220
|
*/
|
|
219
|
-
animation:
|
|
221
|
+
animation: y.bool,
|
|
220
222
|
/**
|
|
221
223
|
* When enabled, keeps PanelBarItem content mounted in the DOM even when collapsed.
|
|
222
224
|
*/
|
|
223
|
-
keepItemsMounted:
|
|
225
|
+
keepItemsMounted: y.bool,
|
|
224
226
|
/**
|
|
225
227
|
* Fires when the expand mode of the PanelBar is set to `single` or `multiple`
|
|
226
228
|
* and an item is toggled (see [example]({% slug overview_panelbar %}#toc-expanded-state-management)).
|
|
227
229
|
*/
|
|
228
|
-
onSelect:
|
|
230
|
+
onSelect: y.func
|
|
229
231
|
};
|
|
230
232
|
U.defaultProps = {
|
|
231
233
|
expandMode: "multiple",
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import { PanelBarSelectEventArguments } from '../../index.js';
|
|
9
|
+
import { WebMcpProps } from '@progress/kendo-react-common';
|
|
9
10
|
/**
|
|
10
11
|
* Represents the expand modes of the KendoReact PanelBar. Defaults to `multiple`.
|
|
11
12
|
*/
|
|
@@ -137,4 +138,11 @@ export interface PanelBarProps {
|
|
|
137
138
|
* ```
|
|
138
139
|
*/
|
|
139
140
|
style?: React.CSSProperties;
|
|
141
|
+
/**
|
|
142
|
+
* Enables Web MCP tool registration so AI agents can interact with this PanelBar.
|
|
143
|
+
* Set to `true` to use the provider-level `dataName`, or pass a config object to override.
|
|
144
|
+
*
|
|
145
|
+
* Requires a `WebMcpProvider` ancestor from `@progress/kendo-react-webmcp`.
|
|
146
|
+
*/
|
|
147
|
+
webMcp?: boolean | WebMcpProps;
|
|
140
148
|
}
|
package/stepper/Stepper.js
CHANGED
|
@@ -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 ne=require("react"),o=require("prop-types"),se=require("./context/StepperContext.js"),p=require("@progress/kendo-react-common"),oe=require("./Step.js"),re=require("@progress/kendo-react-progressbars"),V=require("./contants.js"),ie=require("@progress/kendo-react-intl"),D=require("./messages/index.js");function ce(u){const k=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const m in u)if(m!=="default"){const I=Object.getOwnPropertyDescriptor(u,m);Object.defineProperty(k,m,I.get?I:{enumerable:!0,get:()=>u[m]})}}return k.default=u,Object.freeze(k)}const e=ce(ne),O=e.forwardRef((u,k)=>{const{animationDuration:m,children:I,className:T,disabled:g,errorIcon:j,errorSVGIcon:_,item:w,items:b,linear:y,mode:H,orientation:C,selectOnFocus:E,style:P,successIcon:K,successSVGIcon:G,value:a=0,onChange:R,onFocus:N}=u,B=ie.useLocalization().toLanguageString(D.progBarAriaLabel,D.messages[D.progBarAriaLabel]),v=e.useRef(null),M=e.useRef(null);p.useWebMcpRegister("stepper",M,u,u.webMcp);const q=e.useCallback(()=>{v.current&&p.focusFirstFocusableChild(v.current)},[]),h=e.useCallback(()=>({element:v.current,focus:q}),[q]);e.useImperativeHandle(k,h),e.useImperativeHandle(M,h);const[U,d]=e.useState(a),f=b?b.length:0,s=C==="vertical",x=p.useDir(v,u.dir),W=typeof m=="number"?m:m!==!1?V.DEFAULT_ANIMATION_DURATION:V.NO_ANIMATION;e.useEffect(()=>{d(a)},[a]);const F=e.useCallback((c,r)=>{const t=r===a-1,n=r===a,i=r===a+1;a!==r&&R&&!g&&(!y||t||n||i)&&(p.dispatchEvent(R,c,h(),{value:r}),d(r))},[a,y,R,g,d]),J=e.useCallback(c=>{const r=c.value,t=c.syntheticEvent;F(t,r)},[F]),Q=e.useCallback(c=>{N&&!g&&p.dispatchEvent(N,c.syntheticEvent,h(),void 0)},[N,g]),S=e.useMemo(()=>{const c=x==="rtl",r=b.length-1;return new p.Navigation({root:v,selectors:["ol.k-step-list li.k-step a.k-step-link"],tabIndex:0,keyboardEvents:{keydown:{Tab:(t,n,i)=>{const l=n.elements.indexOf(t),A=n.previous(t).children[0],z=n.next(t).children[0];i.shiftKey?!c&&l>0?(i.preventDefault(),n.focusPrevious(t),d(l-1),E&&A.click()):c&&l<r&&(i.preventDefault(),n.focusNext(t),d(l+1),E&&z.click()):!c&&l<r?(i.preventDefault(),n.focusNext(t),d(l+1),E&&z.click()):c&&l>0&&(i.preventDefault(),n.focusPrevious(t),d(l-1),E&&A.click())},Home:(t,n,i)=>{i.preventDefault(),n.focusElement(n.first,t),d(0)},End:(t,n,i)=>{i.preventDefault(),n.focusElement(n.last,t),d(r)},Space:(t,n,i)=>{i.preventDefault(),t.children[0].click()},Enter:(t,n,i)=>{i.preventDefault(),t.children[0].click()}}}})},[x,b.length,d,E]);e.useEffect(()=>(S.initializeRovingTab(a),()=>S.removeFocusListener()),[]);const X=e.useCallback(S.triggerKeyboardEvent.bind(S),[]),Y=e.useMemo(()=>p.classNames("k-stepper",{"k-stepper-linear":y},T),[y,T]),Z=e.useMemo(()=>({display:"grid",gridTemplateColumns:s?void 0:"repeat("+f*2+", 1fr)",gridTemplateRows:s?"repeat("+f+", 1fr)":void 0,...P}),[s,f,P]),$=e.useMemo(()=>p.classNames("k-step-list",{"k-step-list-horizontal":!s,"k-step-list-vertical":s}),[s]),ee=e.useMemo(()=>({gridColumnStart:s?void 0:1,gridColumnEnd:s?void 0:-1,gridRowStart:s?1:void 0,gridRowEnd:s?-1:void 0}),[s]),te=e.useMemo(()=>({gridColumnStart:s?void 0:2,gridColumnEnd:s?void 0:f*2,gridRowStart:s?1:void 0,gridRowEnd:s?f:void 0,top:s?17:void 0}),[s,f]),L=b&&b.map((c,r)=>{const t={index:r,disabled:g||c.disabled,focused:r===U,current:r===a,...c},n=w||oe.Step;return e.createElement(n,{key:r,...t})});return e.createElement(se.StepperContext.Provider,{value:{animationDuration:m,isVertical:s,item:w,linear:y,mode:H,numOfSteps:f,value:a,successIcon:K,successSVGIcon:G,errorIcon:j,errorSVGIcon:_,onChange:J,onFocus:Q}},e.createElement("nav",{className:Y,style:Z,dir:x,role:"navigation",ref:v,onKeyDown:X},e.createElement("ol",{className:$,style:ee},L||I),e.createElement(re.ProgressBar,{style:te,labelPlacement:"start",animation:{duration:W},ariaLabel:B,"aria-hidden":!0,max:f-1,labelVisible:!1,orientation:C,reverse:C==="vertical",value:a,disabled:g,tabIndex:-1})))});O.propTypes={animationDuration:o.oneOfType([o.bool,o.number]),children:o.any,className:o.string,dir:o.string,disabled:o.bool,errorIcon:o.string,errorSVGIcon:p.svgIconPropType,item:o.any,items:o.any,linear:o.bool,mode:o.oneOf(["steps","labels"]),orientation:o.oneOf(["horizontal","vertical"]),style:o.object,successIcon:o.string,successSVGIcon:p.svgIconPropType,value:o.number.isRequired,onChange:o.func,onFocus:o.func};O.displayName="KendoStepper";exports.Stepper=O;
|