reactjs-multi-stepper 1.4.2 → 1.5.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.
Files changed (2) hide show
  1. package/dist/index.es.js +163 -164
  2. package/package.json +12 -5
package/dist/index.es.js CHANGED
@@ -1,26 +1,26 @@
1
- import z, { createContext as se, useContext as ce, useCallback as h, Fragment as $, useState as U, useEffect as le, useMemo as ie } from "react";
1
+ import z, { createContext as se, useContext as le, useCallback as _, Fragment as $, useState as U, useEffect as ce, useMemo as ie } from "react";
2
2
  var P = { exports: {} }, R = {};
3
3
  var V;
4
4
  function ue() {
5
5
  if (V) return R;
6
6
  V = 1;
7
7
  var n = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.fragment");
8
- function a(t, i, c) {
8
+ function s(r, i, o) {
9
9
  var m = null;
10
- if (c !== void 0 && (m = "" + c), i.key !== void 0 && (m = "" + i.key), "key" in i) {
11
- c = {};
10
+ if (o !== void 0 && (m = "" + o), i.key !== void 0 && (m = "" + i.key), "key" in i) {
11
+ o = {};
12
12
  for (var v in i)
13
- v !== "key" && (c[v] = i[v]);
14
- } else c = i;
15
- return i = c.ref, {
13
+ v !== "key" && (o[v] = i[v]);
14
+ } else o = i;
15
+ return i = o.ref, {
16
16
  $$typeof: n,
17
- type: t,
17
+ type: r,
18
18
  key: m,
19
19
  ref: i !== void 0 ? i : null,
20
- props: c
20
+ props: o
21
21
  };
22
22
  }
23
- return R.Fragment = u, R.jsx = a, R.jsxs = a, R;
23
+ return R.Fragment = u, R.jsx = s, R.jsxs = s, R;
24
24
  }
25
25
  var j = {};
26
26
  var q;
@@ -42,28 +42,28 @@ function fe() {
42
42
  return "Suspense";
43
43
  case ee:
44
44
  return "SuspenseList";
45
- case re:
45
+ case te:
46
46
  return "Activity";
47
47
  }
48
48
  if (typeof e == "object")
49
49
  switch (typeof e.tag == "number" && console.error(
50
50
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
51
51
  ), e.$$typeof) {
52
- case E:
52
+ case h:
53
53
  return "Portal";
54
54
  case Z:
55
55
  return e.displayName || "Context";
56
56
  case H:
57
57
  return (e._context.displayName || "Context") + ".Consumer";
58
58
  case Q:
59
- var r = e.render;
60
- return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
61
- case te:
62
- return r = e.displayName || null, r !== null ? r : n(e.type) || "Memo";
59
+ var t = e.render;
60
+ return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
61
+ case re:
62
+ return t = e.displayName || null, t !== null ? t : n(e.type) || "Memo";
63
63
  case A:
64
- r = e._payload, e = e._init;
64
+ t = e._payload, e = e._init;
65
65
  try {
66
- return n(e(r));
66
+ return n(e(t));
67
67
  } catch {
68
68
  }
69
69
  }
@@ -72,30 +72,30 @@ function fe() {
72
72
  function u(e) {
73
73
  return "" + e;
74
74
  }
75
- function a(e) {
75
+ function s(e) {
76
76
  try {
77
77
  u(e);
78
- var r = !1;
78
+ var t = !1;
79
79
  } catch {
80
- r = !0;
80
+ t = !0;
81
81
  }
82
- if (r) {
83
- r = console;
84
- var s = r.error, f = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
85
- return s.call(
86
- r,
82
+ if (t) {
83
+ t = console;
84
+ var l = t.error, d = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
85
+ return l.call(
86
+ t,
87
87
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
- f
88
+ d
89
89
  ), u(e);
90
90
  }
91
91
  }
92
- function t(e) {
92
+ function r(e) {
93
93
  if (e === O) return "<>";
94
94
  if (typeof e == "object" && e !== null && e.$$typeof === A)
95
95
  return "<...>";
96
96
  try {
97
- var r = n(e);
98
- return r ? "<" + r + ">" : "<...>";
97
+ var t = n(e);
98
+ return t ? "<" + t + ">" : "<...>";
99
99
  } catch {
100
100
  return "<...>";
101
101
  }
@@ -104,45 +104,45 @@ function fe() {
104
104
  var e = y.A;
105
105
  return e === null ? null : e.getOwner();
106
106
  }
107
- function c() {
107
+ function o() {
108
108
  return Error("react-stack-top-frame");
109
109
  }
110
110
  function m(e) {
111
111
  if (F.call(e, "key")) {
112
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
113
- if (r && r.isReactWarning) return !1;
112
+ var t = Object.getOwnPropertyDescriptor(e, "key").get;
113
+ if (t && t.isReactWarning) return !1;
114
114
  }
115
115
  return e.key !== void 0;
116
116
  }
117
- function v(e, r) {
118
- function s() {
117
+ function v(e, t) {
118
+ function l() {
119
119
  M || (M = !0, console.error(
120
120
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
121
- r
121
+ t
122
122
  ));
123
123
  }
124
- s.isReactWarning = !0, Object.defineProperty(e, "key", {
125
- get: s,
124
+ l.isReactWarning = !0, Object.defineProperty(e, "key", {
125
+ get: l,
126
126
  configurable: !0
127
127
  });
128
128
  }
129
- function S() {
129
+ function T() {
130
130
  var e = n(this.type);
131
131
  return I[e] || (I[e] = !0, console.error(
132
132
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
133
133
  )), e = this.props.ref, e !== void 0 ? e : null;
134
134
  }
135
- function T(e, r, s, f, N, C) {
136
- var d = s.ref;
135
+ function S(e, t, l, d, N, C) {
136
+ var p = l.ref;
137
137
  return e = {
138
- $$typeof: l,
138
+ $$typeof: c,
139
139
  type: e,
140
- key: r,
141
- props: s,
142
- _owner: f
143
- }, (d !== void 0 ? d : null) !== null ? Object.defineProperty(e, "ref", {
140
+ key: t,
141
+ props: l,
142
+ _owner: d
143
+ }, (p !== void 0 ? p : null) !== null ? Object.defineProperty(e, "ref", {
144
144
  enumerable: !1,
145
- get: S
145
+ get: T
146
146
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
147
147
  configurable: !1,
148
148
  enumerable: !1,
@@ -165,61 +165,61 @@ function fe() {
165
165
  value: C
166
166
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
167
167
  }
168
- function x(e, r, s, f, N, C) {
169
- var d = r.children;
170
- if (d !== void 0)
171
- if (f)
172
- if (oe(d)) {
173
- for (f = 0; f < d.length; f++)
174
- k(d[f]);
175
- Object.freeze && Object.freeze(d);
168
+ function x(e, t, l, d, N, C) {
169
+ var p = t.children;
170
+ if (p !== void 0)
171
+ if (d)
172
+ if (oe(p)) {
173
+ for (d = 0; d < p.length; d++)
174
+ k(p[d]);
175
+ Object.freeze && Object.freeze(p);
176
176
  } else
177
177
  console.error(
178
178
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
179
179
  );
180
- else k(d);
181
- if (F.call(r, "key")) {
182
- d = n(e);
183
- var _ = Object.keys(r).filter(function(ae) {
180
+ else k(p);
181
+ if (F.call(t, "key")) {
182
+ p = n(e);
183
+ var E = Object.keys(t).filter(function(ae) {
184
184
  return ae !== "key";
185
185
  });
186
- f = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", W[d + f] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
186
+ d = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", W[p + d] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
187
187
  `A props object containing a "key" prop is being spread into JSX:
188
188
  let props = %s;
189
189
  <%s {...props} />
190
190
  React keys must be passed directly to JSX without using spread:
191
191
  let props = %s;
192
192
  <%s key={someKey} {...props} />`,
193
- f,
194
193
  d,
195
- _,
196
- d
197
- ), W[d + f] = !0);
194
+ p,
195
+ E,
196
+ p
197
+ ), W[p + d] = !0);
198
198
  }
199
- if (d = null, s !== void 0 && (a(s), d = "" + s), m(r) && (a(r.key), d = "" + r.key), "key" in r) {
200
- s = {};
201
- for (var Y in r)
202
- Y !== "key" && (s[Y] = r[Y]);
203
- } else s = r;
204
- return d && v(
205
- s,
199
+ if (p = null, l !== void 0 && (s(l), p = "" + l), m(t) && (s(t.key), p = "" + t.key), "key" in t) {
200
+ l = {};
201
+ for (var Y in t)
202
+ Y !== "key" && (l[Y] = t[Y]);
203
+ } else l = t;
204
+ return p && v(
205
+ l,
206
206
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
207
- ), T(
207
+ ), S(
208
208
  e,
209
- d,
210
- s,
209
+ p,
210
+ l,
211
211
  i(),
212
212
  N,
213
213
  C
214
214
  );
215
215
  }
216
216
  function k(e) {
217
- p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === A && (e._payload.status === "fulfilled" ? p(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
217
+ f(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === A && (e._payload.status === "fulfilled" ? f(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
218
218
  }
219
- function p(e) {
220
- return typeof e == "object" && e !== null && e.$$typeof === l;
219
+ function f(e) {
220
+ return typeof e == "object" && e !== null && e.$$typeof === c;
221
221
  }
222
- var b = z, l = /* @__PURE__ */ Symbol.for("react.transitional.element"), E = /* @__PURE__ */ Symbol.for("react.portal"), O = /* @__PURE__ */ Symbol.for("react.fragment"), X = /* @__PURE__ */ Symbol.for("react.strict_mode"), B = /* @__PURE__ */ Symbol.for("react.profiler"), H = /* @__PURE__ */ Symbol.for("react.consumer"), Z = /* @__PURE__ */ Symbol.for("react.context"), Q = /* @__PURE__ */ Symbol.for("react.forward_ref"), K = /* @__PURE__ */ Symbol.for("react.suspense"), ee = /* @__PURE__ */ Symbol.for("react.suspense_list"), te = /* @__PURE__ */ Symbol.for("react.memo"), A = /* @__PURE__ */ Symbol.for("react.lazy"), re = /* @__PURE__ */ Symbol.for("react.activity"), ne = /* @__PURE__ */ Symbol.for("react.client.reference"), y = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, F = Object.prototype.hasOwnProperty, oe = Array.isArray, w = console.createTask ? console.createTask : function() {
222
+ var b = z, c = /* @__PURE__ */ Symbol.for("react.transitional.element"), h = /* @__PURE__ */ Symbol.for("react.portal"), O = /* @__PURE__ */ Symbol.for("react.fragment"), X = /* @__PURE__ */ Symbol.for("react.strict_mode"), B = /* @__PURE__ */ Symbol.for("react.profiler"), H = /* @__PURE__ */ Symbol.for("react.consumer"), Z = /* @__PURE__ */ Symbol.for("react.context"), Q = /* @__PURE__ */ Symbol.for("react.forward_ref"), K = /* @__PURE__ */ Symbol.for("react.suspense"), ee = /* @__PURE__ */ Symbol.for("react.suspense_list"), re = /* @__PURE__ */ Symbol.for("react.memo"), A = /* @__PURE__ */ Symbol.for("react.lazy"), te = /* @__PURE__ */ Symbol.for("react.activity"), ne = /* @__PURE__ */ Symbol.for("react.client.reference"), y = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, F = Object.prototype.hasOwnProperty, oe = Array.isArray, w = console.createTask ? console.createTask : function() {
223
223
  return null;
224
224
  };
225
225
  b = {
@@ -229,27 +229,27 @@ React keys must be passed directly to JSX without using spread:
229
229
  };
230
230
  var M, I = {}, D = b.react_stack_bottom_frame.bind(
231
231
  b,
232
- c
233
- )(), L = w(t(c)), W = {};
234
- j.Fragment = O, j.jsx = function(e, r, s) {
235
- var f = 1e4 > y.recentlyCreatedOwnerStacks++;
232
+ o
233
+ )(), L = w(r(o)), W = {};
234
+ j.Fragment = O, j.jsx = function(e, t, l) {
235
+ var d = 1e4 > y.recentlyCreatedOwnerStacks++;
236
236
  return x(
237
237
  e,
238
- r,
239
- s,
238
+ t,
239
+ l,
240
240
  !1,
241
- f ? Error("react-stack-top-frame") : D,
242
- f ? w(t(e)) : L
241
+ d ? Error("react-stack-top-frame") : D,
242
+ d ? w(r(e)) : L
243
243
  );
244
- }, j.jsxs = function(e, r, s) {
245
- var f = 1e4 > y.recentlyCreatedOwnerStacks++;
244
+ }, j.jsxs = function(e, t, l) {
245
+ var d = 1e4 > y.recentlyCreatedOwnerStacks++;
246
246
  return x(
247
247
  e,
248
- r,
249
- s,
248
+ t,
249
+ l,
250
250
  !0,
251
- f ? Error("react-stack-top-frame") : D,
252
- f ? w(t(e)) : L
251
+ d ? Error("react-stack-top-frame") : D,
252
+ d ? w(r(e)) : L
253
253
  );
254
254
  };
255
255
  })()), j;
@@ -258,38 +258,38 @@ var J;
258
258
  function de() {
259
259
  return J || (J = 1, process.env.NODE_ENV === "production" ? P.exports = ue() : P.exports = fe()), P.exports;
260
260
  }
261
- var o = de();
261
+ var a = de();
262
262
  const G = se(
263
263
  void 0
264
264
  ), g = () => {
265
- const n = ce(G);
265
+ const n = le(G);
266
266
  if (!n)
267
267
  throw new Error(
268
268
  "useMultiStepperForm must be used within a MultiStepperProvider"
269
269
  );
270
270
  return n;
271
271
  }, pe = () => {
272
- const { steps: n, currentStep: u } = g(), a = n?.[u];
273
- return !a || !a.children ? null : /* @__PURE__ */ o.jsx("div", { className: "stepper-content", children: a.children });
272
+ const { steps: n, currentStep: u } = g(), s = n?.[u];
273
+ return !s || !s.children ? null : /* @__PURE__ */ a.jsx("div", { className: "stepper-content", children: s.children });
274
274
  }, me = z.memo(({ onClickNext: n }) => {
275
- const { handlePrevStep: u, currentStep: a, steps: t } = g(), i = a === t.length - 1, c = a === 0, m = h(() => {
276
- t[a].completed || n();
277
- }, [t, a, n]), v = h(() => {
278
- c || u();
279
- }, [c, u]);
280
- return /* @__PURE__ */ o.jsxs("div", { className: "stepper-footer", children: [
281
- /* @__PURE__ */ o.jsx(
275
+ const { handlePrevStep: u, currentStep: s, steps: r } = g(), i = s === r.length - 1, o = s === 0, m = _(() => {
276
+ r[s].completed || n();
277
+ }, [r, s, n]), v = _(() => {
278
+ o || u();
279
+ }, [o, u]);
280
+ return /* @__PURE__ */ a.jsxs("div", { className: "stepper-footer", children: [
281
+ /* @__PURE__ */ a.jsx(
282
282
  "button",
283
283
  {
284
284
  type: "button",
285
285
  className: `stepper-button
286
- ${c ? "stepper-button-disbled" : ""}`,
286
+ ${o ? "stepper-button-disbled" : ""}`,
287
287
  onClick: v,
288
- disabled: a < 0,
288
+ disabled: s < 0,
289
289
  children: "Prev"
290
290
  }
291
291
  ),
292
- /* @__PURE__ */ o.jsx(
292
+ /* @__PURE__ */ a.jsx(
293
293
  "button",
294
294
  {
295
295
  type: "button",
@@ -303,89 +303,88 @@ const G = se(
303
303
  step: n,
304
304
  index: u
305
305
  }) => {
306
- const { steps: a, options: t } = g();
307
- return a.length ? n.completed ? /* @__PURE__ */ o.jsx("div", { className: "step step-complete", children: n.icon ? n.icon : t?.completedIcon ?? /* @__PURE__ */ o.jsx("span", { className: "text-white", children: "✓" }) }) : n.active ? /* @__PURE__ */ o.jsx("div", { className: "step step-active", children: n.icon ? n.icon : t?.activeIcon ?? /* @__PURE__ */ o.jsx("h2", { className: "text-white", children: u }) }) : /* @__PURE__ */ o.jsx("div", { className: "step step-default", children: n.icon ?? /* @__PURE__ */ o.jsx("h2", { children: u }) }) : /* @__PURE__ */ o.jsx($, {});
306
+ const { steps: s, options: r } = g();
307
+ return s.length ? n.completed ? /* @__PURE__ */ a.jsx("div", { className: "step step-complete", children: n.icon ? n.icon : r?.completedIcon ?? /* @__PURE__ */ a.jsx("span", { className: "text-white", children: "✓" }) }) : n.active ? /* @__PURE__ */ a.jsx("div", { className: "step step-active", children: n.icon ? n.icon : r?.activeIcon ?? /* @__PURE__ */ a.jsx("h2", { className: "text-white", children: u }) }) : /* @__PURE__ */ a.jsx("div", { className: "step step-default", children: n.icon ?? /* @__PURE__ */ a.jsx("h2", { children: u }) }) : /* @__PURE__ */ a.jsx($, {});
308
308
  }, be = () => {
309
- const { steps: n, updateSteps: u } = g(), a = (t) => u(t);
310
- return n.length ? /* @__PURE__ */ o.jsx("div", { className: "app-container", children: /* @__PURE__ */ o.jsx("ol", { className: "stepper-header", children: n.map((t, i) => {
311
- const c = !!t.active, m = !!t.completed;
312
- return /* @__PURE__ */ o.jsxs(
309
+ const { steps: n, updateSteps: u } = g(), s = (r) => u(r);
310
+ return n.length ? /* @__PURE__ */ a.jsx("div", { className: "app-container", children: /* @__PURE__ */ a.jsx("ol", { className: "stepper-header", children: n.map((r, i) => {
311
+ const o = !!r.active, m = !!r.completed;
312
+ return /* @__PURE__ */ a.jsxs(
313
313
  "div",
314
314
  {
315
- onClick: () => a(i),
316
- className: `step-item ${c ? "active" : ""} ${m ? "complete" : ""}`,
315
+ onClick: () => s(i),
316
+ className: `step-item ${o ? "active" : ""} ${m ? "complete" : ""}`,
317
317
  children: [
318
- /* @__PURE__ */ o.jsx(ve, { index: i + 1, step: t }),
319
- /* @__PURE__ */ o.jsxs("div", { className: "step-text", children: [
320
- t.title && /* @__PURE__ */ o.jsx("h3", { className: "step-title", children: t.title }),
321
- t.description && /* @__PURE__ */ o.jsx("h3", { className: "step-description", children: t.description })
318
+ /* @__PURE__ */ a.jsx(ve, { index: i + 1, step: r }),
319
+ /* @__PURE__ */ a.jsxs("div", { className: "step-text", children: [
320
+ r.title && /* @__PURE__ */ a.jsx("h3", { className: "step-title", children: r.title }),
321
+ r.description && /* @__PURE__ */ a.jsx("h3", { className: "step-description", children: r.description })
322
322
  ] })
323
323
  ]
324
324
  },
325
- t.id ?? i
325
+ r.id ?? i
326
326
  );
327
- }) }) }) : /* @__PURE__ */ o.jsx($, {});
328
- }, _e = ({
327
+ }) }) }) : /* @__PURE__ */ a.jsx($, {});
328
+ }, Ee = ({
329
329
  onClickNext: n
330
- }) => /* @__PURE__ */ o.jsxs($, { children: [
331
- /* @__PURE__ */ o.jsx(be, {}),
332
- /* @__PURE__ */ o.jsx(pe, {}),
333
- /* @__PURE__ */ o.jsx(me, { onClickNext: n })
334
- ] }), he = ({ children: n, steppers: u, options: a }) => {
335
- const [t, i] = U(0), [c, m] = U([]);
336
- le(() => {
330
+ }) => /* @__PURE__ */ a.jsxs($, { children: [
331
+ /* @__PURE__ */ a.jsx(be, {}),
332
+ /* @__PURE__ */ a.jsx(pe, {}),
333
+ /* @__PURE__ */ a.jsx(me, { onClickNext: n })
334
+ ] }), _e = ({ children: n, steppers: u, options: s }) => {
335
+ const [r, i] = U(0), [o, m] = U([]);
336
+ ce(() => {
337
337
  if (u.length) {
338
- const p = [...u];
339
- p[0].active = !0, m(p);
338
+ const f = [...u];
339
+ f[0].active = !0, m(f);
340
340
  }
341
341
  }, [u, u.length]);
342
- const v = h((p) => {
343
- m((b) => {
344
- const l = [...b];
345
- if (p > b.length - 1) return b;
346
- l[t] && (l[t] = { ...l[t], active: !1 }), l[p] && (l[p] = { ...l[p], active: !0 });
347
- for (let E = 0; E < p; E++)
348
- l[E] = { ...l[E], completed: !0 };
349
- for (let E = p; E < l.length; E++)
350
- l[E] = { ...l[E], completed: !1 };
351
- return l;
352
- }), i(p);
353
- }, [t]), S = h(() => {
354
- t < c.length - 1 ? v(t + 1) : m((p) => {
355
- const b = [...p];
356
- return b[t] = { ...b[t], completed: !0 }, b;
357
- });
358
- }, [t, c.length, v]), T = h(() => {
359
- t > 0 && v(t - 1);
360
- }, [t, v]), x = h(
361
- (p) => {
342
+ const v = _((f) => {
343
+ f < 0 || f > o.length - 1 || (m((b) => {
344
+ const c = [...b];
345
+ c[r] && (c[r] = { ...c[r], active: !1 }), c[f] && (c[f] = { ...c[f], active: !0 });
346
+ for (let h = 0; h < f; h++)
347
+ c[h] = { ...c[h], completed: !0 };
348
+ for (let h = f; h < c.length; h++)
349
+ c[h] = { ...c[h], completed: !1 };
350
+ return c;
351
+ }), i(f));
352
+ }, [r, o.length]), T = _(() => {
353
+ o.length && (r < o.length - 1 ? v(r + 1) : m((f) => {
354
+ const b = [...f];
355
+ return b[r] ? (b[r] = { ...b[r], completed: !0 }, b) : f;
356
+ }));
357
+ }, [r, o.length, v]), S = _(() => {
358
+ r > 0 && v(r - 1);
359
+ }, [r, v]), x = _(
360
+ (f) => {
362
361
  m((b) => {
363
- const l = [...b];
364
- return l[t] && (l[t] = {
365
- ...l[t],
362
+ const c = [...b];
363
+ return c[r] && (c[r] = {
364
+ ...c[r],
366
365
  active: !1,
367
366
  completed: !1
368
- }, l[t][p] = !0), l;
367
+ }, c[r][f] = !0), c;
369
368
  });
370
369
  },
371
- [t]
370
+ [r]
372
371
  ), k = ie(
373
372
  () => ({
374
- currentStep: t,
375
- steps: c,
376
- handleNextStep: S,
377
- handlePrevStep: T,
373
+ currentStep: r,
374
+ steps: o,
375
+ handleNextStep: T,
376
+ handlePrevStep: S,
378
377
  updateSteps: v,
379
378
  setStepStatus: x,
380
379
  // styles,
381
- options: a
380
+ options: s
382
381
  }),
383
- [t, c, S, T, v, x, a]
382
+ [r, o, T, S, v, x, s]
384
383
  );
385
- return /* @__PURE__ */ o.jsx(G.Provider, { value: k, children: n });
384
+ return /* @__PURE__ */ a.jsx(G.Provider, { value: k, children: n });
386
385
  };
387
386
  export {
388
- _e as MultiStepper,
389
- he as MultiStepperProvider,
387
+ Ee as MultiStepper,
388
+ _e as MultiStepperProvider,
390
389
  g as useMultiStepper
391
390
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactjs-multi-stepper",
3
- "version": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
5
  "main": "./dist/reactjs-multi-stepper.es.js",
6
6
  "module": "./dist/reactjs-multi-stepper.es.js",
@@ -29,22 +29,26 @@
29
29
  "test": "vitest",
30
30
  "test:coverage": "vitest run --coverage",
31
31
  "typecheck": "tsc --noEmit",
32
- "preview": "vite preview"
33
- },
34
- "dependencies": {
32
+ "preview": "vite preview",
33
+ "format": "prettier --write ."
35
34
  },
36
35
  "devDependencies": {
37
36
  "@eslint/js": "^9.39.1",
37
+ "@microsoft/api-extractor": "^7.48.0",
38
38
  "@testing-library/jest-dom": "^6.9.1",
39
39
  "@testing-library/react": "^16.3.2",
40
40
  "@types/node": "^25.1.0",
41
41
  "@types/react": "^19.2.5",
42
42
  "@types/react-dom": "^19.2.3",
43
43
  "@vitejs/plugin-react": "^5.1.2",
44
+ "@vitejs/plugin-react-swc": "^4.2.3",
45
+ "@vitest/coverage-v8": "^4.0.18",
44
46
  "eslint": "^9.39.1",
45
47
  "eslint-plugin-react-hooks": "^7.0.1",
46
48
  "eslint-plugin-react-refresh": "^0.4.24",
47
49
  "globals": "^16.5.0",
50
+ "jsdom": "^28.1.0",
51
+ "prettier": "^3.4.2",
48
52
  "react": "^18.0.0 || ^19.2.0",
49
53
  "react-dom": "^18.0.0 || ^19.2.0",
50
54
  "rollup-plugin-visualizer": "^6.0.5",
@@ -53,6 +57,9 @@
53
57
  "vite-plugin-dts": "^4.5.4",
54
58
  "vitest": "^4.0.18"
55
59
  },
60
+ "overrides": {
61
+ "minimatch": "^9.0.5"
62
+ },
56
63
  "repository": {
57
64
  "url": "https://github.com/UppiliSrinivas/react-stepper"
58
65
  },
@@ -61,4 +68,4 @@
61
68
  "react": "^18.0.0 || ^19.2.0",
62
69
  "react-dom": "^18.0.0 || ^19.2.0"
63
70
  }
64
- }
71
+ }