@progress/kendo-react-layout 9.0.0-develop.8 → 9.0.0

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,207 +6,187 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as n from "react";
10
- import a from "prop-types";
9
+ import * as e from "react";
10
+ import n from "prop-types";
11
11
  import { StepperContext as oe } from "./context/StepperContext.mjs";
12
- import { validatePackage as se, focusFirstFocusableChild as ne, useDir as re, dispatchEvent as T, Navigation as ie, classNames as F, svgIconPropType as L } from "@progress/kendo-react-common";
13
- import { Step as le } from "./Step.mjs";
14
- import { ProgressBar as ce } from "@progress/kendo-react-progressbars";
15
- import { DEFAULT_ANIMATION_DURATION as ae, NO_ANIMATION as ue } from "./contants.mjs";
12
+ import { validatePackage as se, focusFirstFocusableChild as ne, useDir as re, dispatchEvent as L, Navigation as ie, classNames as M, svgIconPropType as P } from "@progress/kendo-react-common";
13
+ import { Step as ae } from "./Step.mjs";
14
+ import { ProgressBar as le } from "@progress/kendo-react-progressbars";
15
+ import { DEFAULT_ANIMATION_DURATION as ce, NO_ANIMATION as ue } from "./contants.mjs";
16
16
  import { packageMetadata as de } from "../package-metadata.mjs";
17
- import { useLocalization as fe } from "@progress/kendo-react-intl";
18
- import { progBarAriaLabel as M, messages as me } from "./messages/index.mjs";
19
- const V = n.forwardRef((C, z) => {
17
+ import { useLocalization as me } from "@progress/kendo-react-intl";
18
+ import { progBarAriaLabel as A, messages as pe } from "./messages/index.mjs";
19
+ const V = e.forwardRef((S, z) => {
20
20
  se(de);
21
21
  const {
22
- animationDuration: v,
22
+ animationDuration: b,
23
23
  children: K,
24
- className: S,
25
- disabled: f,
24
+ className: x,
25
+ disabled: m,
26
26
  errorIcon: G,
27
27
  errorSVGIcon: H,
28
28
  item: N,
29
- items: m,
29
+ items: p,
30
30
  linear: g,
31
- mode: U,
31
+ mode: _,
32
32
  orientation: E,
33
- selectOnFocus: b,
34
- style: w,
35
- successIcon: _,
36
- successSVGIcon: B,
37
- value: u = 0,
38
- onChange: I,
33
+ selectOnFocus: v,
34
+ style: R,
35
+ successIcon: B,
36
+ successSVGIcon: U,
37
+ value: a = 0,
38
+ onChange: y,
39
39
  onFocus: h
40
- } = C, j = fe().toLanguageString(M, me[M]), p = n.useRef(null), D = n.useCallback(() => {
41
- p.current && ne(p.current);
42
- }, []), x = n.useCallback(
40
+ } = S, j = me().toLanguageString(A, pe[A]), f = e.useRef(null), w = e.useCallback(() => {
41
+ f.current && ne(f.current);
42
+ }, []), I = e.useCallback(
43
43
  () => ({
44
- element: p.current,
45
- focus: D
44
+ element: f.current,
45
+ focus: w
46
46
  }),
47
- [D]
47
+ [w]
48
48
  );
49
- n.useImperativeHandle(z, x);
50
- const [q, c] = n.useState(u), d = m ? m.length : 0, o = E === "vertical", y = re(p, C.dir), J = typeof v == "number" ? v : v !== !1 ? ae : ue;
51
- n.useEffect(() => {
52
- c(u);
53
- }, [u]);
54
- const O = n.useCallback(
55
- (r, i) => {
56
- const e = i === u - 1, t = i === u, l = i === u + 1;
57
- u !== i && I && !f && (!g || e || t || l) && (T(I, r, x(), {
58
- value: i
59
- }), c(i));
49
+ e.useImperativeHandle(z, I);
50
+ const [q, u] = e.useState(a), d = p ? p.length : 0, s = E === "vertical", C = re(f, S.dir), J = typeof b == "number" ? b : b !== !1 ? ce : ue;
51
+ e.useEffect(() => {
52
+ u(a);
53
+ }, [a]);
54
+ const D = e.useCallback(
55
+ (i, r) => {
56
+ const t = r === a - 1, o = r === a, l = r === a + 1;
57
+ a !== r && y && !m && (!g || t || o || l) && (L(y, i, I(), {
58
+ value: r
59
+ }), u(r));
60
60
  },
61
- [u, g, I, f, c]
62
- ), Q = n.useCallback(
63
- (r) => {
64
- const i = r.value, e = r.syntheticEvent;
65
- O(e, i);
61
+ [a, g, y, m, u]
62
+ ), Q = e.useCallback(
63
+ (i) => {
64
+ const r = i.value, t = i.syntheticEvent;
65
+ D(t, r);
66
66
  },
67
- [O]
68
- ), W = n.useCallback(
69
- (r) => {
70
- h && !f && T(
67
+ [D]
68
+ ), W = e.useCallback(
69
+ (i) => {
70
+ h && !m && L(
71
71
  h,
72
- r.syntheticEvent,
73
- x(),
72
+ i.syntheticEvent,
73
+ I(),
74
74
  void 0
75
75
  );
76
76
  },
77
- [h, f]
78
- ), k = n.useMemo(() => {
79
- const r = y === "rtl", i = m.length - 1;
77
+ [h, m]
78
+ ), k = e.useMemo(() => {
79
+ const i = C === "rtl", r = p.length - 1;
80
80
  return new ie({
81
- root: p,
81
+ root: f,
82
82
  selectors: ["ol.k-step-list li.k-step a.k-step-link"],
83
83
  tabIndex: 0,
84
84
  keyboardEvents: {
85
85
  keydown: {
86
- ArrowLeft: (e, t, l) => {
87
- l.preventDefault();
88
- const s = t.elements.indexOf(e);
89
- !o && !r && s > 0 ? (t.focusPrevious(e), c(s - 1)) : !o && r && s < i && (t.focusNext(e), c(s + 1));
90
- },
91
- ArrowRight: (e, t, l) => {
92
- l.preventDefault();
93
- const s = t.elements.indexOf(e);
94
- !o && !r && s < i ? (t.focusNext(e), c(s + 1)) : !o && r && s > 0 && (t.focusPrevious(e), c(s - 1));
95
- },
96
- ArrowUp: (e, t, l) => {
97
- l.preventDefault();
98
- const s = t.elements.indexOf(e);
99
- o && !r && s > 0 ? (t.focusPrevious(e), c(s - 1)) : o && r && s > 0 && (t.focusPrevious(e), c(s + 1));
100
- },
101
- ArrowDown: (e, t, l) => {
102
- l.preventDefault();
103
- const s = t.elements.indexOf(e);
104
- o && !r && s < i ? (t.focusNext(e), c(s + 1)) : o && r && s < i && (t.focusNext(e), c(s - 1));
105
- },
106
- Tab: (e, t, l) => {
86
+ Tab: (t, o, l) => {
107
87
  l.preventDefault();
108
- const s = t.elements.indexOf(e), P = t.previous(e).children[0], A = t.next(e).children[0];
109
- l.shiftKey ? !o && !r && s > 0 ? (t.focusPrevious(e), c(s - 1), b && P.click()) : !o && r && s < i && (t.focusNext(e), c(s + 1), b && A.click()) : !o && !r && s < i ? (t.focusNext(e), c(s + 1), b && A.click()) : !o && r && s > 0 && (t.focusPrevious(e), c(s - 1), b && P.click());
88
+ const c = o.elements.indexOf(t), F = o.previous(t).children[0], O = o.next(t).children[0];
89
+ l.shiftKey ? !i && c > 0 ? (o.focusPrevious(t), u(c - 1), v && F.click()) : i && c < r && (o.focusNext(t), u(c + 1), v && O.click()) : !i && c < r ? (o.focusNext(t), u(c + 1), v && O.click()) : i && c > 0 && (o.focusPrevious(t), u(c - 1), v && F.click());
110
90
  },
111
- Home: (e, t, l) => {
112
- l.preventDefault(), t.focusElement(t.first, e), c(0);
91
+ Home: (t, o, l) => {
92
+ l.preventDefault(), o.focusElement(o.first, t), u(0);
113
93
  },
114
- End: (e, t, l) => {
115
- l.preventDefault(), t.focusElement(t.last, e), c(i);
94
+ End: (t, o, l) => {
95
+ l.preventDefault(), o.focusElement(o.last, t), u(r);
116
96
  },
117
- Space: (e, t, l) => {
118
- l.preventDefault(), e.children[0].click();
97
+ Space: (t, o, l) => {
98
+ l.preventDefault(), t.children[0].click();
119
99
  },
120
- Enter: (e, t, l) => {
121
- l.preventDefault(), e.children[0].click();
100
+ Enter: (t, o, l) => {
101
+ l.preventDefault(), t.children[0].click();
122
102
  }
123
103
  }
124
104
  }
125
105
  });
126
- }, [y, m.length, o, c]);
127
- n.useEffect(() => (k.initializeRovingTab(u), () => k.removeFocusListener()), []);
128
- const X = n.useCallback(k.triggerKeyboardEvent.bind(k), []), Y = n.useMemo(
129
- () => F(
106
+ }, [C, p.length, u, v]);
107
+ e.useEffect(() => (k.initializeRovingTab(a), () => k.removeFocusListener()), []);
108
+ const X = e.useCallback(k.triggerKeyboardEvent.bind(k), []), Y = e.useMemo(
109
+ () => M(
130
110
  "k-stepper",
131
111
  {
132
112
  "k-stepper-linear": g
133
113
  },
134
- S
114
+ x
135
115
  ),
136
- [g, S]
137
- ), Z = n.useMemo(
116
+ [g, x]
117
+ ), Z = e.useMemo(
138
118
  () => ({
139
119
  display: "grid",
140
- gridTemplateColumns: o ? void 0 : "repeat(" + d * 2 + ", 1fr)",
141
- gridTemplateRows: o ? "repeat(" + d + ", 1fr)" : void 0,
142
- ...w
120
+ gridTemplateColumns: s ? void 0 : "repeat(" + d * 2 + ", 1fr)",
121
+ gridTemplateRows: s ? "repeat(" + d + ", 1fr)" : void 0,
122
+ ...R
143
123
  }),
144
- [o, d, w]
145
- ), $ = n.useMemo(
146
- () => F("k-step-list", {
147
- "k-step-list-horizontal": !o,
148
- "k-step-list-vertical": o
124
+ [s, d, R]
125
+ ), $ = e.useMemo(
126
+ () => M("k-step-list", {
127
+ "k-step-list-horizontal": !s,
128
+ "k-step-list-vertical": s
149
129
  }),
150
- [o]
151
- ), ee = n.useMemo(
130
+ [s]
131
+ ), ee = e.useMemo(
152
132
  () => ({
153
- gridColumnStart: o ? void 0 : 1,
154
- gridColumnEnd: o ? void 0 : -1,
155
- gridRowStart: o ? 1 : void 0,
156
- gridRowEnd: o ? -1 : void 0
133
+ gridColumnStart: s ? void 0 : 1,
134
+ gridColumnEnd: s ? void 0 : -1,
135
+ gridRowStart: s ? 1 : void 0,
136
+ gridRowEnd: s ? -1 : void 0
157
137
  }),
158
- [o]
159
- ), te = n.useMemo(
138
+ [s]
139
+ ), te = e.useMemo(
160
140
  () => ({
161
- gridColumnStart: o ? void 0 : 2,
162
- gridColumnEnd: o ? void 0 : d * 2,
163
- gridRowStart: o ? 1 : void 0,
164
- gridRowEnd: o ? d : void 0,
165
- top: o ? 17 : void 0
141
+ gridColumnStart: s ? void 0 : 2,
142
+ gridColumnEnd: s ? void 0 : d * 2,
143
+ gridRowStart: s ? 1 : void 0,
144
+ gridRowEnd: s ? d : void 0,
145
+ top: s ? 17 : void 0
166
146
  }),
167
- [o, d]
168
- ), R = m && m.map((r, i) => {
169
- const e = {
170
- index: i,
171
- disabled: f || r.disabled,
172
- focused: i === q,
173
- current: i === u,
174
- ...r
175
- }, t = N || le;
176
- return /* @__PURE__ */ n.createElement(t, { key: i, ...e });
147
+ [s, d]
148
+ ), T = p && p.map((i, r) => {
149
+ const t = {
150
+ index: r,
151
+ disabled: m || i.disabled,
152
+ focused: r === q,
153
+ current: r === a,
154
+ ...i
155
+ }, o = N || ae;
156
+ return /* @__PURE__ */ e.createElement(o, { key: r, ...t });
177
157
  });
178
- return /* @__PURE__ */ n.createElement(
158
+ return /* @__PURE__ */ e.createElement(
179
159
  oe.Provider,
180
160
  {
181
161
  value: {
182
- animationDuration: v,
183
- isVertical: o,
162
+ animationDuration: b,
163
+ isVertical: s,
184
164
  item: N,
185
165
  linear: g,
186
- mode: U,
166
+ mode: _,
187
167
  numOfSteps: d,
188
- value: u,
189
- successIcon: _,
190
- successSVGIcon: B,
168
+ value: a,
169
+ successIcon: B,
170
+ successSVGIcon: U,
191
171
  errorIcon: G,
192
172
  errorSVGIcon: H,
193
173
  onChange: Q,
194
174
  onFocus: W
195
175
  }
196
176
  },
197
- /* @__PURE__ */ n.createElement(
177
+ /* @__PURE__ */ e.createElement(
198
178
  "nav",
199
179
  {
200
180
  className: Y,
201
181
  style: Z,
202
- dir: y,
182
+ dir: C,
203
183
  role: "navigation",
204
- ref: p,
184
+ ref: f,
205
185
  onKeyDown: X
206
186
  },
207
- /* @__PURE__ */ n.createElement("ol", { className: $, style: ee }, R || K),
208
- /* @__PURE__ */ n.createElement(
209
- ce,
187
+ /* @__PURE__ */ e.createElement("ol", { className: $, style: ee }, T || K),
188
+ /* @__PURE__ */ e.createElement(
189
+ le,
210
190
  {
211
191
  style: te,
212
192
  labelPlacement: "start",
@@ -217,8 +197,8 @@ const V = n.forwardRef((C, z) => {
217
197
  labelVisible: !1,
218
198
  orientation: E,
219
199
  reverse: E === "vertical",
220
- value: u,
221
- disabled: f,
200
+ value: a,
201
+ disabled: m,
222
202
  tabIndex: -1
223
203
  }
224
204
  )
@@ -226,24 +206,24 @@ const V = n.forwardRef((C, z) => {
226
206
  );
227
207
  });
228
208
  V.propTypes = {
229
- animationDuration: a.oneOfType([a.bool, a.number]),
230
- children: a.any,
231
- className: a.string,
232
- dir: a.string,
233
- disabled: a.bool,
234
- errorIcon: a.string,
235
- errorSVGIcon: L,
236
- item: a.any,
237
- items: a.any,
238
- linear: a.bool,
239
- mode: a.oneOf(["steps", "labels"]),
240
- orientation: a.oneOf(["horizontal", "vertical"]),
241
- style: a.object,
242
- successIcon: a.string,
243
- successSVGIcon: L,
244
- value: a.number.isRequired,
245
- onChange: a.func,
246
- onFocus: a.func
209
+ animationDuration: n.oneOfType([n.bool, n.number]),
210
+ children: n.any,
211
+ className: n.string,
212
+ dir: n.string,
213
+ disabled: n.bool,
214
+ errorIcon: n.string,
215
+ errorSVGIcon: P,
216
+ item: n.any,
217
+ items: n.any,
218
+ linear: n.bool,
219
+ mode: n.oneOf(["steps", "labels"]),
220
+ orientation: n.oneOf(["horizontal", "vertical"]),
221
+ style: n.object,
222
+ successIcon: n.string,
223
+ successSVGIcon: P,
224
+ value: n.number.isRequired,
225
+ onChange: n.func,
226
+ onFocus: n.func
247
227
  };
248
228
  V.displayName = "KendoStepper";
249
229
  export {