@progress/kendo-react-layout 7.4.0-develop.9 → 7.5.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.
@@ -6,24 +6,25 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as n from "react";
9
+ import * as s from "react";
10
10
  import ft from "prop-types";
11
11
  import { TimelineCard as ut } from "./TimelineCard.mjs";
12
12
  import { addYearsFlags as mt } from "./utils.mjs";
13
- import { caretAltLeftIcon as dt, caretAltRightIcon as kt } from "@progress/kendo-svg-icons";
14
- import { useInternationalization as bt } from "@progress/kendo-react-intl";
15
- import { Navigation as Et, canUseDOM as Tt, classNames as _, SvgIcon as z } from "@progress/kendo-react-common";
16
- const vt = (v) => {
17
- const M = bt(), [y, j] = n.useState(!1), [R, K] = n.useState(!0), [X, Y] = n.useState(), [f, S] = n.useState(0), [g, q] = n.useState(), [l, B] = n.useState(0), [d, G] = n.useState(0), [a, O] = n.useState(1), [u, w] = n.useState(), [c, J] = n.useState(), [N, L] = n.useState([0, 0, 0]), [I, W] = n.useState(0), [Q, Z] = n.useState(1), m = n.useRef(null), i = n.useRef(null), D = n.useRef(null), { eventsData: tt, dateFormat: et, navigatable: nt, onActionClick: st } = v, U = g ? `${g}%` : "150px", k = n.useRef(new Et({
13
+ import { caretAltLeftIcon as dt, caretAltRightIcon as Tt } from "@progress/kendo-svg-icons";
14
+ import { useInternationalization as ht } from "@progress/kendo-react-intl";
15
+ import { Navigation as Et, canUseDOM as vt, classNames as R } from "@progress/kendo-react-common";
16
+ import { Button as z } from "@progress/kendo-react-buttons";
17
+ const gt = (g) => {
18
+ const M = ht(), [_, j] = s.useState(!1), [y, K] = s.useState(!0), [X, Y] = s.useState(), [f, S] = s.useState(0), [b, B] = s.useState(), [l, q] = s.useState(0), [d, G] = s.useState(0), [a, L] = s.useState(1), [u, I] = s.useState(), [c, J] = s.useState(), [w, O] = s.useState([0, 0, 0]), [N, F] = s.useState(0), [Q, Z] = s.useState(1), m = s.useRef(null), i = s.useRef(null), W = s.useRef(null), { eventsData: tt, dateFormat: et, navigatable: nt, onActionClick: st } = g, D = b ? `${b}%` : "150px", T = s.useRef(new Et({
18
19
  tabIndex: 0,
19
20
  root: m,
20
21
  selectors: [".k-timeline-scrollable-wrap"]
21
22
  }));
22
- n.useEffect(() => {
23
- m.current && v.navigatable && (setTimeout(() => {
24
- const t = k.current.first;
23
+ s.useEffect(() => {
24
+ m.current && g.navigatable && (setTimeout(() => {
25
+ const t = T.current.first;
25
26
  t && t.setAttribute("tabindex", String(0));
26
- }, 0), k.current.keyboardEvents = {
27
+ }, 0), T.current.keyboardEvents = {
27
28
  keydown: {
28
29
  ArrowRight: at,
29
30
  ArrowLeft: ot,
@@ -31,104 +32,104 @@ const vt = (v) => {
31
32
  Home: it
32
33
  }
33
34
  });
34
- }, [v.navigatable, a, l]), n.useEffect(() => {
35
- k.current.update();
35
+ }, [g.navigatable, a, l]), s.useEffect(() => {
36
+ T.current.update();
36
37
  });
37
38
  const rt = (t) => {
38
- nt && k.current && k.current.triggerKeyboardEvent(t);
39
+ nt && T.current && T.current.triggerKeyboardEvent(t);
39
40
  };
40
- n.useEffect(() => {
41
+ s.useEffect(() => {
41
42
  var r;
42
- const t = Tt && window.ResizeObserver && new window.ResizeObserver(p), e = i.current, s = ((r = m == null ? void 0 : m.current) == null ? void 0 : r.offsetWidth) || 0;
43
- return t && e && t.observe(e), x(), p(), L([s, 0, -s]), () => {
43
+ const t = vt && window.ResizeObserver && new window.ResizeObserver(p), e = i.current, n = ((r = m == null ? void 0 : m.current) == null ? void 0 : r.offsetWidth) || 0;
44
+ return t && e && t.observe(e), U(), p(), O([n, 0, -n]), () => {
44
45
  t && t.disconnect();
45
46
  };
46
- }, []), n.useEffect(() => {
47
+ }, []), s.useEffect(() => {
47
48
  const t = i.current, e = t && t.children[a];
48
49
  if (e) {
49
- const s = e.offsetWidth, r = !(f >= 0);
50
+ const n = e.offsetWidth, r = !(f >= 0);
50
51
  if (j(r), c) {
51
- const o = c.length * s > l * s * ((f * -1 + 100) / 100);
52
+ const o = c.length * n > l * n * ((f * -1 + 100) / 100);
52
53
  K(o);
53
54
  }
54
- (t == null ? void 0 : t.offsetWidth) * -f / 100 >= t.children.length * s && (x(), p(), S((e.offsetLeft - e.offsetWidth) / (l * e.offsetWidth) * 100 * -1)), V(e);
55
+ (t == null ? void 0 : t.offsetWidth) * -f / 100 >= t.children.length * n && (U(), p(), S((e.offsetLeft - e.offsetWidth) / (l * e.offsetWidth) * 100 * -1)), V(e);
55
56
  }
56
- }, [l, g, a]);
57
- const at = (t, e, s) => {
57
+ }, [l, b, a]);
58
+ const at = (t, e, n) => {
58
59
  if (i.current) {
59
60
  const r = i.current.children[a + 1], o = r && r.classList.contains("k-timeline-flag-wrap") ? a + 2 : a + 1;
60
61
  if (c && c.length <= o)
61
62
  return;
62
- l + d <= o && P(), E(o, s);
63
+ l + d <= o && P(), E(o, n);
63
64
  }
64
- }, ot = (t, e, s) => {
65
+ }, ot = (t, e, n) => {
65
66
  if (i.current) {
66
67
  const r = i.current && i.current.children[a - 1], o = r && r.classList.contains("k-timeline-flag-wrap") ? a - 2 : a - 1;
67
68
  if (o <= 0)
68
69
  return;
69
- o < d && F(), E(o, s);
70
+ o < d && x(), E(o, n);
70
71
  }
71
- }, it = (t, e, s) => {
72
+ }, it = (t, e, n) => {
72
73
  if (i.current) {
73
74
  if (a <= 1)
74
75
  return;
75
76
  const r = 1;
76
- h(!0, r, 0, 0), E(r, s);
77
+ k(!0, r, 0, 0), E(r, n);
77
78
  }
78
- }, ct = (t, e, s) => {
79
+ }, ct = (t, e, n) => {
79
80
  if (i.current) {
80
81
  const r = i.current && i.current.children.length - 1;
81
82
  if (r <= a)
82
83
  return;
83
- const o = Math.floor(r / l), T = o * -100, C = o * l;
84
- h(!0, r, C, T), E(r, s);
84
+ const o = Math.floor(r / l), v = o * -100, C = o * l;
85
+ k(!0, r, C, v), E(r, n);
85
86
  }
86
- }, x = () => {
87
+ }, U = () => {
87
88
  const t = mt(tt);
88
- J(t), w([t[a - 1], t[a], t[a + 1]]);
89
- }, F = () => {
89
+ J(t), I([t[a - 1], t[a], t[a + 1]]);
90
+ }, x = () => {
90
91
  var e;
91
92
  if (i.current && c) {
92
- const s = d - l, r = d - 1, o = c[r] && ((e = c[r]) != null && e.yearFlag) ? r - 1 : r, T = f + 100 > 0 ? 0 : f + 100;
93
- h(!1, o, s, T);
93
+ const n = d - l, r = d - 1, o = c[r] && ((e = c[r]) != null && e.yearFlag) ? r - 1 : r, v = f + 100 > 0 ? 0 : f + 100;
94
+ k(!1, o, n, v);
94
95
  }
95
96
  }, P = () => {
96
97
  if (i.current && c) {
97
- const e = d + l, s = c[e] && c[e].yearFlag ? e + 1 : e, r = f - 100;
98
- h(!0, s, e, r);
98
+ const e = d + l, n = c[e] && c[e].yearFlag ? e + 1 : e, r = f - 100;
99
+ k(!0, n, e, r);
99
100
  }
100
- }, h = (t, e, s, r) => {
101
- A(t, e), p(), G(s), S(r), O(e);
101
+ }, k = (t, e, n, r) => {
102
+ A(t, e), p(), G(n), S(r), L(e);
102
103
  }, A = (t, e) => {
103
104
  if (u && c) {
104
- const s = b(t, Q), r = Object.assign([], u, { [s]: c[e] });
105
- w(r), Z(s), W(t ? -100 : 100), setTimeout(() => {
105
+ const n = h(t, Q), r = Object.assign([], u, { [n]: c[e] });
106
+ I(r), Z(n), F(t ? -100 : 100), setTimeout(() => {
106
107
  var H;
107
- const o = (H = m.current) == null ? void 0 : H.offsetWidth, T = Object.assign([], N, {
108
- [s]: 0,
109
- [b(!0, s)]: o,
110
- [b(!1, s)]: o && -o
108
+ const o = (H = m.current) == null ? void 0 : H.offsetWidth, v = Object.assign([], w, {
109
+ [n]: 0,
110
+ [h(!0, n)]: o,
111
+ [h(!1, n)]: o && -o
111
112
  }), C = Object.assign([], r, {
112
- [b(!0, s)]: {},
113
- [b(!1, s)]: {}
113
+ [h(!0, n)]: {},
114
+ [h(!1, n)]: {}
114
115
  });
115
- w(C), L(T), W(0);
116
- }, v.transitionDuration || 300);
116
+ I(C), O(v), F(0);
117
+ }, g.transitionDuration || 300);
117
118
  }
118
- }, b = (t, e) => {
119
- const s = t ? e + 1 : e - 1;
120
- return u ? s < 0 ? u.length - 1 : s % u.length : 0;
119
+ }, h = (t, e) => {
120
+ const n = t ? e + 1 : e - 1;
121
+ return u ? n < 0 ? u.length - 1 : n % u.length : 0;
121
122
  }, V = (t) => {
122
- var s;
123
- const e = (a - d) * t.offsetWidth + t.offsetWidth / 2 + (((s = D.current) == null ? void 0 : s.offsetWidth) || 0);
123
+ var n;
124
+ const e = (a - d) * t.offsetWidth + t.offsetWidth / 2 + (((n = W.current) == null ? void 0 : n.offsetWidth) || 0);
124
125
  Y(e);
125
126
  }, E = (t, e) => {
126
- e.preventDefault(), t > a ? A(!0, t) : t < a && A(!1, t), O(t);
127
- }, p = n.useCallback(() => {
127
+ e.preventDefault(), t > a ? A(!0, t) : t < a && A(!1, t), L(t);
128
+ }, p = s.useCallback(() => {
128
129
  const t = i.current, e = t && t.children[a];
129
130
  if (t instanceof HTMLElement && e) {
130
- const s = Math.round(t.offsetWidth / 150);
131
- V(e), q(100 / s), B(s);
131
+ const n = Math.round(t.offsetWidth / 150);
132
+ V(e), B(100 / n), q(n);
132
133
  }
133
134
  }, []), lt = () => ({
134
135
  transitionDuration: "300ms"
@@ -136,34 +137,38 @@ const vt = (v) => {
136
137
  transform: `translateX(${t}%)`,
137
138
  transformOrigin: "left top"
138
139
  });
139
- return /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("div", { className: "k-timeline-track-wrap", ref: m, onKeyDown: rt }, /* @__PURE__ */ n.createElement(
140
- "button",
140
+ return /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("div", { className: "k-timeline-track-wrap", ref: m, onKeyDown: rt }, /* @__PURE__ */ s.createElement(
141
+ z,
141
142
  {
142
- ref: D,
143
+ ref: W,
143
144
  "aria-hidden": "true",
144
- onClick: () => y && F(),
145
- className: _(
145
+ fillMode: "solid",
146
+ rounded: "full",
147
+ svgIcon: dt,
148
+ icon: "caret-alt-left",
149
+ onClick: () => _ && x(),
150
+ className: R(
146
151
  "k-timeline-arrow",
147
152
  "k-timeline-arrow-left",
148
- "k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-icon-button",
149
- { "k-disabled": !y }
153
+ { "k-disabled": !_ }
150
154
  )
151
- },
152
- /* @__PURE__ */ n.createElement(z, { icon: dt })
153
- ), /* @__PURE__ */ n.createElement(
154
- "button",
155
+ }
156
+ ), /* @__PURE__ */ s.createElement(
157
+ z,
155
158
  {
156
159
  "aria-hidden": "true",
157
- onClick: () => R && P(),
158
- className: _(
160
+ fillMode: "solid",
161
+ rounded: "full",
162
+ svgIcon: Tt,
163
+ icon: "caret-alt-right",
164
+ onClick: () => y && P(),
165
+ className: R(
159
166
  "k-timeline-arrow",
160
167
  "k-timeline-arrow-right",
161
- "k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-icon-button",
162
- { "k-disabled": !R }
168
+ { "k-disabled": !y }
163
169
  )
164
- },
165
- /* @__PURE__ */ n.createElement(z, { icon: kt })
166
- ), /* @__PURE__ */ n.createElement("div", { className: "k-timeline-track" }, /* @__PURE__ */ n.createElement(
170
+ }
171
+ ), /* @__PURE__ */ s.createElement("div", { className: "k-timeline-track" }, /* @__PURE__ */ s.createElement(
167
172
  "ul",
168
173
  {
169
174
  ref: i,
@@ -172,54 +177,54 @@ const vt = (v) => {
172
177
  tabIndex: 0,
173
178
  style: { transform: `translateX(${f}%)` }
174
179
  },
175
- c && c.map((t, e) => t.yearFlag ? /* @__PURE__ */ n.createElement(
180
+ c && c.map((t, e) => t.yearFlag ? /* @__PURE__ */ s.createElement(
176
181
  "li",
177
182
  {
178
183
  role: "none",
179
184
  className: "k-timeline-track-item k-timeline-flag-wrap",
180
- style: { flex: `1 0 ${U}` },
185
+ style: { flex: `1 0 ${D}` },
181
186
  key: e
182
187
  },
183
- /* @__PURE__ */ n.createElement("span", { className: "k-timeline-flag" }, t.yearFlag)
184
- ) : /* @__PURE__ */ n.createElement(
188
+ /* @__PURE__ */ s.createElement("span", { className: "k-timeline-flag" }, t.yearFlag)
189
+ ) : /* @__PURE__ */ s.createElement(
185
190
  "li",
186
191
  {
187
192
  role: "tab",
188
- className: _(
193
+ className: R(
189
194
  "k-timeline-track-item",
190
195
  { "k-focus": e === a }
191
196
  ),
192
197
  "aria-selected": e === a,
193
- style: { flex: `1 0 ${U}` },
198
+ style: { flex: `1 0 ${D}` },
194
199
  key: e
195
200
  },
196
- /* @__PURE__ */ n.createElement("div", { className: "k-timeline-date-wrap" }, /* @__PURE__ */ n.createElement("span", { className: "k-timeline-date" }, M.formatDate(t.date, et))),
197
- /* @__PURE__ */ n.createElement(
201
+ /* @__PURE__ */ s.createElement("div", { className: "k-timeline-date-wrap" }, /* @__PURE__ */ s.createElement("span", { className: "k-timeline-date" }, M.formatDate(t.date, et))),
202
+ /* @__PURE__ */ s.createElement(
198
203
  "span",
199
204
  {
200
- onClick: (s) => E(e, s),
205
+ onClick: (n) => E(e, n),
201
206
  className: "k-timeline-circle"
202
207
  }
203
208
  )
204
209
  ))
205
- ))), /* @__PURE__ */ n.createElement("div", { className: "k-timeline-events-list" }, /* @__PURE__ */ n.createElement(
210
+ ))), /* @__PURE__ */ s.createElement("div", { className: "k-timeline-events-list" }, /* @__PURE__ */ s.createElement(
206
211
  "ul",
207
212
  {
208
213
  className: "k-timeline-scrollable-wrap",
209
- style: I === 0 ? { ...$(I) } : { ...$(I), ...lt() }
214
+ style: N === 0 ? { ...$(N) } : { ...$(N), ...lt() }
210
215
  },
211
216
  u && u.map(
212
- (t, e) => /* @__PURE__ */ n.createElement(
217
+ (t, e) => /* @__PURE__ */ s.createElement(
213
218
  "li",
214
219
  {
215
220
  key: e,
216
221
  className: "k-timeline-event",
217
- style: { transform: `translate3d(${N[e]}px, 0px, 0px)` }
222
+ style: { transform: `translate3d(${w[e]}px, 0px, 0px)` }
218
223
  },
219
- t && /* @__PURE__ */ n.createElement(
224
+ t && /* @__PURE__ */ s.createElement(
220
225
  ut,
221
226
  {
222
- tabindex: N[e] === 0 ? 0 : -1,
227
+ tabindex: w[e] === 0 ? 0 : -1,
223
228
  eventData: t,
224
229
  onActionClick: st,
225
230
  horizontal: !0,
@@ -231,9 +236,9 @@ const vt = (v) => {
231
236
  )
232
237
  )));
233
238
  };
234
- vt.propTypes = {
239
+ gt.propTypes = {
235
240
  onActionClick: ft.func
236
241
  };
237
242
  export {
238
- vt as TimelineHorizontal
243
+ gt as TimelineHorizontal
239
244
  };