@progress/kendo-react-layout 14.0.0-develop.1 → 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.
@@ -5,212 +5,233 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as c from "react";
9
- import o from "prop-types";
10
- import { PanelBarItem as m } from "./PanelBarItem.mjs";
11
- import { flatChildren as g, isArrayEqual as k, flatVisibleChildren as b, getFocusedChild as P, getInitialState as I, getFirstId as K, renderChildren as S } from "./util.mjs";
12
- import { Keys as l, classNames as F } from "@progress/kendo-react-common";
13
- import { NavigationAction as r } from "./interfaces/NavigationAction.mjs";
14
- const h = class h extends c.Component {
15
- constructor(a) {
16
- super(a), this._element = null, this.handleSelect = (t) => {
17
- this.onSelect(t), this.onFocus(t);
18
- }, this.onSelect = (t) => {
19
- const n = g(c.Children.toArray(this.children));
20
- let s, i;
21
- switch (n.forEach((e) => {
22
- e.props.uniquePrivateKey === (t.uniquePrivateKey || this.state.focused) && (s = e);
23
- }), this.expandMode) {
8
+ import * as a from "react";
9
+ import b from "prop-types";
10
+ import { PanelBarItem as L } from "./PanelBarItem.mjs";
11
+ import { getInitialState as J, getFirstId as Q, flatChildren as X, isArrayEqual as Y, flatVisibleChildren as Z, getFocusedChild as _, renderChildren as ee } from "./util.mjs";
12
+ import { Keys as m, classNames as re } from "@progress/kendo-react-common";
13
+ import { NavigationAction as n } from "./interfaces/NavigationAction.mjs";
14
+ const U = (p) => {
15
+ const {
16
+ animation: d = !0,
17
+ children: o,
18
+ dir: N,
19
+ selected: w,
20
+ expanded: O,
21
+ expandMode: I = "multiple",
22
+ className: A,
23
+ keepItemsMounted: T = !1,
24
+ onSelect: C,
25
+ style: D,
26
+ isControlled: W
27
+ } = p, v = a.useRef(null), E = a.useRef(void 0), x = a.useRef(null), [c, f] = a.useState(() => {
28
+ const l = J(p, I || "multiple");
29
+ return l.focused || (l.focused = Q(p)), l;
30
+ }), F = I || "multiple", R = w !== void 0 ? w : c.selected, h = W ? O || [] : c.expanded, S = a.useCallback((r) => {
31
+ x.current = window.setTimeout(() => r());
32
+ }, []), g = a.useCallback(
33
+ (r) => {
34
+ const l = K, s = X(a.Children.toArray(l));
35
+ let t, i;
36
+ switch (s.forEach((e) => {
37
+ e.props.uniquePrivateKey === (r.uniquePrivateKey || c.focused) && (t = e);
38
+ }), F) {
24
39
  case "single":
25
- i = [...s.props.parentUniquePrivateKey, s.props.uniquePrivateKey], k(this.expandedItems, i) && (s.props.parentUniquePrivateKey ? i = [...s.props.parentUniquePrivateKey] : i = []);
40
+ i = [...t.props.parentUniquePrivateKey, t.props.uniquePrivateKey], Y(h, i) && (t.props.parentUniquePrivateKey ? i = [...t.props.parentUniquePrivateKey] : i = []);
26
41
  break;
27
42
  case "multiple": {
28
- i = this.expandedItems.slice();
29
- const e = i.indexOf(s.props.uniquePrivateKey);
30
- e === -1 ? i.push(s.props.uniquePrivateKey) : i.splice(e, 1);
43
+ i = h.slice();
44
+ const e = i.indexOf(t.props.uniquePrivateKey);
45
+ e === -1 ? i.push(t.props.uniquePrivateKey) : i.splice(e, 1);
31
46
  break;
32
47
  }
33
48
  default:
34
- i = this.expandedItems.slice();
49
+ i = h.slice();
35
50
  break;
36
51
  }
37
- this.setState({ selected: s.props.uniquePrivateKey, expanded: i }), this.props.onSelect && this.props.onSelect.call(void 0, {
38
- target: s,
52
+ f((e) => ({ ...e, selected: t.props.uniquePrivateKey, expanded: i })), C && C({
53
+ target: t,
39
54
  expandedItems: i
40
55
  });
41
- }, this.onFocus = (t, n = 0, s) => {
42
- const i = b(c.Children.toArray(this.children)), e = P(i, n, t, this.state.focused, s);
56
+ },
57
+ [o, c.focused, F, h, C]
58
+ ), u = a.useCallback(
59
+ (r, l = 0, s) => {
60
+ const t = K, i = Z(a.Children.toArray(t)), e = _(i, l, r, c.focused, s);
43
61
  if (e) {
44
- const d = this.expandedItems.slice();
45
- if (s === r.Right && e && e.props && e.props.children && e.props.children.length > 0) {
46
- if (d.push(e.props.uniquePrivateKey), this.setState({ expanded: [...new Set(d)] }), e.props.expanded) {
47
- const u = e.props.children[0].props.uniquePrivateKey;
48
- this.setState({ focused: u });
62
+ const k = h.slice();
63
+ if (s === n.Right && e && e.props && e.props.children && e.props.children.length > 0) {
64
+ if (k.push(e.props.uniquePrivateKey), f((y) => ({ ...y, expanded: [...new Set(k)] })), e.props.expanded) {
65
+ const y = e.props.children[0].props.uniquePrivateKey;
66
+ f((P) => ({ ...P, focused: y }));
49
67
  }
50
- } else if (s === r.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)) {
51
- const u = e.props.parentUniquePrivateKey;
68
+ } 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 y = e.props.parentUniquePrivateKey;
52
70
  if (e.props.expanded) {
53
- const f = e.props.uniquePrivateKey, x = d.indexOf(f);
54
- d.splice(x, 1), this.setState({ expanded: d });
71
+ const P = e.props.uniquePrivateKey, q = k.indexOf(P);
72
+ k.splice(q, 1), f((H) => ({ ...H, expanded: k }));
55
73
  } else if (e.props.level > 0) {
56
- const f = e.props.parentUniquePrivateKey[u.length - 1];
57
- this.setState({ focused: f });
74
+ const P = e.props.parentUniquePrivateKey[y.length - 1];
75
+ f((q) => ({ ...q, focused: P }));
58
76
  }
59
77
  } else
60
- this.activeDescendant = e.props.id, this.setState({ focused: e.props.uniquePrivateKey });
78
+ E.current = e.props.id, f((y) => ({ ...y, focused: e.props.uniquePrivateKey }));
61
79
  }
62
- }, this.onNavigate = (t, n) => {
80
+ },
81
+ [o, c.focused, h]
82
+ ), B = a.useCallback(
83
+ (r) => {
84
+ g(r), u(r);
85
+ },
86
+ [g, u]
87
+ ), K = a.useMemo(() => ee({
88
+ animation: d,
89
+ keepItemsMounted: T,
90
+ state: { ...c, selected: R },
91
+ expanded: h,
92
+ handleSelect: B,
93
+ children: o
94
+ }), [d, T, c, R, h, o, B]), M = a.useCallback(
95
+ (r, l) => {
63
96
  let s;
64
- switch (n) {
65
- case r.First:
66
- this.onFocus(t, s, r.First);
97
+ switch (l) {
98
+ case n.First:
99
+ u(r, s, n.First);
67
100
  break;
68
- case r.Last:
69
- this.onFocus(t, s, r.Last);
101
+ case n.Last:
102
+ u(r, s, n.Last);
70
103
  break;
71
- case r.Left:
72
- this.onFocus(t, s, r.Left);
104
+ case n.Left:
105
+ u(r, s, n.Left);
73
106
  break;
74
- case r.Right:
75
- this.onFocus(t, s, r.Right);
107
+ case n.Right:
108
+ u(r, s, n.Right);
76
109
  break;
77
- case r.Previous:
78
- s = -1, this.onFocus(t, s);
110
+ case n.Previous:
111
+ s = -1, u(r, s);
79
112
  break;
80
- case r.Next:
81
- s = 1, this.onFocus(t, s);
113
+ case n.Next:
114
+ s = 1, u(r, s);
82
115
  break;
83
- case r.Toggle:
84
- this.onSelect(t);
116
+ case n.Toggle:
117
+ g(r);
85
118
  break;
86
119
  }
87
- }, this.handleWrapperFocus = () => {
88
- clearTimeout(this.nextTickId), this.state.wrapperFocused || this.setState({ wrapperFocused: !0 });
89
- }, this.handleWrapperBlur = () => {
90
- this.nextTick(() => {
91
- this.setState({ wrapperFocused: !1 });
92
- });
93
- }, this.handleKeyDown = (t) => {
94
- const n = this._element && getComputedStyle(this._element).direction === "rtl" || !1;
95
- if (t.target === t.currentTarget) {
96
- const s = t.keyCode;
97
- let i;
120
+ },
121
+ [u, g]
122
+ ), $ = a.useCallback(() => {
123
+ clearTimeout(x.current), c.wrapperFocused || f((r) => ({ ...r, wrapperFocused: !0 }));
124
+ }, [c.wrapperFocused]), V = a.useCallback(() => {
125
+ S(() => {
126
+ f((r) => ({ ...r, wrapperFocused: !1 }));
127
+ });
128
+ }, [S]), j = a.useCallback(
129
+ (r) => {
130
+ const l = v.current && getComputedStyle(v.current).direction === "rtl" || !1;
131
+ if (r.target === r.currentTarget) {
132
+ const s = r.keyCode;
133
+ let t;
98
134
  switch (s) {
99
- case l.left:
100
- i = n ? r.Right : r.Left;
135
+ case m.left:
136
+ t = l ? n.Right : n.Left;
101
137
  break;
102
- case l.up:
103
- i = r.Previous;
138
+ case m.up:
139
+ t = n.Previous;
104
140
  break;
105
- case l.right:
106
- i = n ? r.Left : r.Right;
141
+ case m.right:
142
+ t = l ? n.Left : n.Right;
107
143
  break;
108
- case l.down:
109
- i = r.Next;
144
+ case m.down:
145
+ t = n.Next;
110
146
  break;
111
- case l.home:
112
- i = r.First;
147
+ case m.home:
148
+ t = n.First;
113
149
  break;
114
- case l.end:
115
- i = r.Last;
150
+ case m.end:
151
+ t = n.Last;
116
152
  break;
117
- case l.space:
118
- case l.enter:
119
- i = r.Toggle;
153
+ case m.space:
154
+ case m.enter:
155
+ t = n.Toggle;
120
156
  break;
121
157
  default:
122
- i = null;
158
+ t = null;
123
159
  break;
124
160
  }
125
- i !== null && (t.preventDefault(), this.onNavigate(t, i));
161
+ t !== null && (r.preventDefault(), M(r, t));
126
162
  }
127
- };
128
- const p = I(a, this.expandMode);
129
- p.focused || (p.focused = K(a)), this.state = p;
130
- }
131
- get expandMode() {
132
- return this.props.expandMode || "multiple";
133
- }
134
- get selectedItem() {
135
- const { selected: a = this.state.selected } = this.props;
136
- return a;
137
- }
138
- get expandedItems() {
139
- return this.props.isControlled ? this.props.expanded || [] : this.state.expanded;
140
- }
141
- get children() {
142
- const a = { ...this.state, selected: this.selectedItem }, p = {
143
- animation: this.props.animation,
144
- keepItemsMounted: this.props.keepItemsMounted,
145
- state: a,
146
- expanded: this.expandedItems,
147
- handleSelect: this.handleSelect,
148
- children: this.props.children
149
- };
150
- return S(p);
151
- }
163
+ },
164
+ [M]
165
+ );
166
+ a.useEffect(() => () => {
167
+ x.current && clearTimeout(x.current);
168
+ }, []);
169
+ const z = {
170
+ "aria-activedescendant": E.current
171
+ }, G = re("k-panelbar", A);
172
+ return /* @__PURE__ */ a.createElement(
173
+ "ul",
174
+ {
175
+ ref: v,
176
+ dir: N,
177
+ role: "tree",
178
+ tabIndex: 0,
179
+ onKeyDown: j,
180
+ onFocus: $,
181
+ onBlur: V,
182
+ className: G,
183
+ style: D,
184
+ ...z
185
+ },
186
+ K
187
+ );
188
+ };
189
+ U.propTypes = {
152
190
  /**
153
- * @hidden
191
+ * A collection of `PanelBarItem` components.
154
192
  */
155
- render() {
156
- const a = {
157
- "aria-activedescendant": this.activeDescendant
158
- }, p = F("k-panelbar", this.props.className);
159
- return /* @__PURE__ */ c.createElement(
160
- "ul",
161
- {
162
- ref: (t) => {
163
- this._element = t;
164
- },
165
- dir: this.props.dir,
166
- role: "tree",
167
- tabIndex: 0,
168
- onKeyDown: this.handleKeyDown,
169
- onFocus: this.handleWrapperFocus,
170
- onBlur: this.handleWrapperBlur,
171
- className: p,
172
- style: this.props.style,
173
- ...a
174
- },
175
- this.children
176
- );
177
- }
178
- nextTick(a) {
179
- this.nextTickId = window.setTimeout(() => a());
180
- }
181
- };
182
- h.propTypes = {
183
- animation: o.bool,
184
- children: function(a, p) {
185
- const t = a[p];
186
- if (t) {
187
- if (Array.isArray(t)) {
188
- for (const n of t)
189
- if (!n.type || n.type !== m)
190
- return new Error(
191
- "PanelBar children should be either PanelBarItem or Array of PanelBarItem."
192
- );
193
- } else if (t.type !== m)
194
- return new Error("PanelBar child should be either PanelBarItem or Array of PanelBarItem.");
195
- return null;
193
+ children: b.oneOfType([
194
+ b.arrayOf(function(p, d) {
195
+ return p[d].type !== L ? new Error("PanelBar children should be either PanelBarItem or an array of PanelBarItem.") : null;
196
+ }),
197
+ function(p, d) {
198
+ const o = p[d];
199
+ return o && o.type !== L ? new Error("PanelBar children should be either PanelBarItem or an array of PanelBarItem.") : null;
196
200
  }
197
- return null;
201
+ ]),
202
+ /**
203
+ * Expands the item or items that match the `selected` property while respecting the `expandMode` property (see [example]({% slug expandModes_panelbar %}#toc-single-expandMode)).
204
+ * To expand the item on the initial load of the PanelBar, define the `expanded` property of each PanelBarItem.
205
+ */
206
+ selected: b.string,
207
+ /**
208
+ * Sets the expand mode of the PanelBar through the `single`, `multiple`, or `default` keywords (see [example]({% slug expandModes_panelbar %})).
209
+ */
210
+ expandMode(p, d) {
211
+ const o = p[d];
212
+ return o !== "single" && o !== "multiple" && o !== "default" ? new Error(
213
+ `Invalid value '${o}' given to '${d}'. It must be either 'single', 'multiple' or 'default'.`
214
+ ) : null;
198
215
  },
199
- dir: o.string,
200
- selected: o.string,
201
- expanded: o.arrayOf(o.string),
202
- focused: o.string,
203
- expandMode: o.oneOf(["single", "multiple"]),
204
- className: o.string,
205
- keepItemsMounted: o.bool,
206
- onSelect: o.func,
207
- style: o.object
208
- }, h.defaultProps = {
216
+ /**
217
+ * Enables or disables the animation of the PanelBar items.
218
+ */
219
+ animation: b.bool,
220
+ /**
221
+ * When enabled, keeps PanelBarItem content mounted in the DOM even when collapsed.
222
+ */
223
+ keepItemsMounted: b.bool,
224
+ /**
225
+ * Fires when the expand mode of the PanelBar is set to `single` or `multiple`
226
+ * and an item is toggled (see [example]({% slug overview_panelbar %}#toc-expanded-state-management)).
227
+ */
228
+ onSelect: b.func
229
+ };
230
+ U.defaultProps = {
209
231
  expandMode: "multiple",
210
232
  animation: !0,
211
233
  keepItemsMounted: !1
212
234
  };
213
- let y = h;
214
235
  export {
215
- y as PanelBar
236
+ U as PanelBar
216
237
  };
@@ -5,57 +5,19 @@
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 { PanelBarItemProps } from '../index.js';
9
+ import { PanelBarItemHandle } from './interfaces/PanelBarItemHandle.js';
10
10
  import * as React from 'react';
11
- /** @hidden */
12
- interface PanelBarItemState {
13
- show: boolean;
14
- }
15
11
  /**
16
12
  * Represents the PanelBarItem component.
17
13
  *
18
14
  * @remarks
19
15
  * Supported children components are: {@link PanelBarItem}.
20
16
  */
21
- export declare class PanelBarItem extends React.PureComponent<PanelBarItemProps, PanelBarItemState> {
22
- /**
23
- * @hidden
24
- */
25
- static propTypes: {
26
- animation: PropTypes.Requireable<boolean>;
27
- children: PropTypes.Requireable<any>;
28
- className: PropTypes.Requireable<string>;
29
- icon: PropTypes.Requireable<string>;
30
- iconClass: PropTypes.Requireable<string>;
31
- imageUrl: PropTypes.Requireable<string>;
32
- svgIcon: PropTypes.Requireable<PropTypes.InferProps<{
33
- name: PropTypes.Validator<string>;
34
- content: PropTypes.Validator<string>;
35
- viewBox: PropTypes.Validator<string>;
36
- }>>;
37
- expanded: PropTypes.Requireable<boolean>;
38
- disabled: PropTypes.Requireable<boolean>;
39
- onSelect: PropTypes.Requireable<(...args: any[]) => any>;
40
- selected: PropTypes.Requireable<boolean>;
41
- level: PropTypes.Requireable<number>;
42
- title: PropTypes.Requireable<NonNullable<string | PropTypes.ReactElementLike | null | undefined>>;
43
- id: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
44
- focused: PropTypes.Requireable<boolean>;
45
- keepItemsMounted: PropTypes.Requireable<boolean>;
46
- };
47
- /**
48
- * @hidden
49
- */
50
- static defaultProps: {
51
- title: string;
52
- };
53
- constructor(props: PanelBarItemProps);
54
- /**
55
- * @hidden
56
- */
57
- render(): React.JSX.Element;
58
- private handleItemClick;
59
- private childFactory;
60
- }
61
- export {};
17
+ export declare const PanelBarItem: React.ForwardRefExoticComponent<Omit<PanelBarItemProps, "ref"> & React.RefAttributes<PanelBarItemHandle | null>>;
18
+ /**
19
+ * The default props of the PanelBarItem component.
20
+ *
21
+ * @hidden
22
+ */
23
+ export declare const panelBarItemDefaultProps: Partial<PanelBarItemProps>;
@@ -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 P=require("react"),t=require("prop-types"),c=require("@progress/kendo-react-common"),y=require("@progress/kendo-svg-icons"),T=require("@progress/kendo-react-animation");function A(i){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(n,e,s.get?s:{enumerable:!0,get:()=>i[e]})}}return n.default=i,Object.freeze(n)}const a=A(P);function j({imageUrl:i,icon:n,svgIcon:e,iconClass:s}){return i?a.createElement("img",{role:"presentation",className:"k-panelbar-item-icon k-image",src:i}):n||e?a.createElement(c.IconWrap,{className:"k-panelbar-item-icon",name:n,icon:e}):s?a.createElement("span",{role:"presentation",className:"k-panelbar-item-icon "+s}):null}const d=class d extends a.PureComponent{constructor(n){super(n),this.handleItemClick=()=>{const{onSelect:e,disabled:s,id:p}=this.props;e&&!s&&e.call(void 0,{uniquePrivateKey:this.props.uniquePrivateKey,id:p,target:this})},this.childFactory=e=>this.props.keepItemsMounted?a.cloneElement(e,{...e.props,in:this.props.expanded}):e,this.state={show:n.expanded||!1}}render(){const{id:n,children:e,title:s,uniquePrivateKey:p,disabled:r,selected:m,focused:g,expanded:o,className:v,level:h,headerClassName:N,animation:b,keepItemsMounted:l}=this.props,E={role:"treeitem","aria-disabled":r,"aria-hidden":!r&&!o,"aria-selected":!r&&m,"aria-expanded":!r&&o&&!!e},x=c.classNames("k-panelbar-item",{"k-panelbar-header":h===0,"k-expanded":o&&!!e,"k-disabled":r},`k-level-${h}`,v),I=c.classNames("k-link",{"k-selected":!r&&m,"k-focus":g},N),S={display:"block"},C=j(this.props),O=!r&&e?a.createElement(c.IconWrap,{name:o?"chevron-up":"chevron-down",icon:o?y.chevronUpIcon:y.chevronDownIcon,className:c.classNames("k-panelbar-toggle",o?"k-panelbar-collapse":"k-panelbar-expand")}):null;let k=!1;e&&e[0]&&Array.isArray(e)&&(k=e[0].type===d);const q=k?a.createElement("ul",{role:"group","aria-expanded":o,"aria-hidden":!o,className:"k-panelbar-group",style:{display:l?this.state.show?"block":"none":"block"}},e):e,f=!r&&o||l?q:null,w=(b===void 0||b)&&!r&&e?a.createElement(T.Reveal,{transitionEnterDuration:200,transitionExitDuration:200,key:p+"_animation",style:S,children:f,childFactory:l&&this.childFactory,unmountOnExit:!l,onBeforeEnter:()=>l&&this.setState({show:!0}),onAfterExited:()=>l&&this.setState({show:!1})}):f;return a.createElement("li",{id:n,className:x,...E},a.createElement("span",{className:I,onClick:this.handleItemClick},C,a.createElement("span",{className:"k-panelbar-item-text"},s),O),w)}};d.propTypes={animation:t.bool,children:t.any,className:t.string,icon:t.string,iconClass:t.string,imageUrl:t.string,svgIcon:c.svgIconPropType,expanded:t.bool,disabled:t.bool,onSelect:t.func,selected:t.bool,level:t.number,title:t.oneOfType([t.string,t.element]),id:t.oneOfType([t.string,t.number]),focused:t.bool,keepItemsMounted:t.bool},d.defaultProps={title:"Untitled"};let u=d;exports.PanelBarItem=u;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react"),n=require("prop-types"),i=require("@progress/kendo-react-common"),N=require("@progress/kendo-svg-icons"),G=require("@progress/kendo-react-animation");function $(a){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const r in a)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(a,r);Object.defineProperty(c,r,t.get?t:{enumerable:!0,get:()=>a[r]})}}return c.default=a,Object.freeze(c)}const e=$(z);function J({imageUrl:a,icon:c,svgIcon:r,iconClass:t}){return a?e.createElement("img",{role:"presentation",className:"k-panelbar-item-icon k-image",src:a}):c||r?e.createElement(i.IconWrap,{className:"k-panelbar-item-icon",name:c,icon:r}):t?e.createElement("span",{role:"presentation",className:"k-panelbar-item-icon "+t}):null}const d=e.forwardRef((a,c)=>{const{id:r,children:t,title:E=h.title,uniquePrivateKey:u,disabled:l,selected:b,focused:C,expanded:o,className:P,level:k,headerClassName:R,animation:y,keepItemsMounted:s,onSelect:m,imageUrl:S,icon:B,svgIcon:x,iconClass:O}=a,p=e.useRef({props:a}),D=e.useRef(null);e.useImperativeHandle(p,()=>({props:a})),e.useImperativeHandle(c,()=>p.current);const[w,g]=e.useState(o||!1),T=e.useCallback(()=>{m&&!l&&m({uniquePrivateKey:u,id:r,target:p.current})},[m,l,u,r]),q=e.useCallback(f=>s?e.cloneElement(f,{...f.props,in:o}):f,[s,o]),A=e.useCallback(()=>{s&&g(!0)},[s]),j=e.useCallback(()=>{s&&g(!1)},[s]),U={role:"treeitem","aria-disabled":l,"aria-hidden":!l&&!o?"true":"false","aria-selected":!l&&b,"aria-expanded":!l&&o&&!!t},M=i.classNames("k-panelbar-item",{"k-panelbar-header":k===0,"k-expanded":o&&!!t,"k-disabled":l},`k-level-${k}`,P),_=i.classNames("k-link",{"k-selected":!l&&b,"k-focus":C},R),H={display:"block"},L=J({imageUrl:S,icon:B,svgIcon:x,iconClass:O}),F=!l&&t?e.createElement(i.IconWrap,{name:o?"chevron-up":"chevron-down",icon:o?N.chevronUpIcon:N.chevronDownIcon,className:i.classNames("k-panelbar-toggle",o?"k-panelbar-collapse":"k-panelbar-expand")}):null;let I=!1;t&&t[0]&&Array.isArray(t)&&(I=t[0].type===d);const K=s&&!w?"none":"block",v=!l&&o||s?I?e.createElement("ul",{role:"group","aria-hidden":o?"false":"true",className:"k-panelbar-group",style:{display:K}},t):t:null,W=(y===void 0||y)&&!l&&t?e.createElement(G.Reveal,{transitionEnterDuration:200,transitionExitDuration:200,key:u+"_animation",style:H,children:v,childFactory:s?q:void 0,unmountOnExit:!s,onBeforeEnter:A,onAfterExited:j}):v;return e.createElement("li",{ref:D,id:r,className:M,...U},e.createElement("span",{className:_,onClick:T},L,e.createElement("span",{className:"k-panelbar-item-text"},E),F),W)}),h={title:"Untitled"};d.propTypes={animation:n.bool,children:n.any,className:n.string,icon:n.string,iconClass:n.string,imageUrl:n.string,svgIcon:i.svgIconPropType,expanded:n.bool,disabled:n.bool,onSelect:n.func,selected:n.bool,level:n.number,title:n.oneOfType([n.string,n.element]),id:n.oneOfType([n.string,n.number]),focused:n.bool,keepItemsMounted:n.bool};d.displayName="KendoReactPanelBarItem";exports.PanelBarItem=d;exports.panelBarItemDefaultProps=h;