reactjs-multi-stepper 1.1.8 โ†’ 1.2.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.
package/README.md CHANGED
@@ -3,12 +3,16 @@
3
3
  A lightweight, customizable, and reusable multi-stepper component for React.
4
4
  It allows you to create step-based workflows such as onboarding, multi-step forms, or guided processes with ease.
5
5
 
6
+ ## ๐ŸŽฌ Demo
7
+
8
+ ![React Multi Stepper Demo](./src/assets/react-multi-stepper-demo.gif)
9
+
6
10
  ---
7
11
 
8
12
  ## ๐Ÿš€ Features
9
13
 
10
14
  - โœ… Easy to use and integrate into any React project
11
- - ๐ŸŽจ Fully customizable step styles (active, completed, upcoming)
15
+ - ๐ŸŽจ Fully customizable step styles (active, completed)
12
16
  - โšก Built with **TypeScript** for type safety
13
17
  - ๐Ÿงฉ Includes context + hooks for flexible state management
14
18
  - ๐Ÿงช Tested with **Vitest** + **React Testing Library**
@@ -38,8 +42,8 @@ const steps = [
38
42
  ];
39
43
 
40
44
  export default function App() {
41
- const handleNext = () => {
42
- console.log("Next step clicked");
45
+ const handleNext = (currentStep:number) => {
46
+ console.log("Next step clicked",currentStep);
43
47
  };
44
48
 
45
49
  return (
@@ -57,4 +61,4 @@ export default function App() {
57
61
  | Prop | Type | Required | Description |
58
62
  | ------------- | ------------ | -------- | -------------------------------------------------------------- |
59
63
  | `steps` | `StepType[]` | โœ… | Array of steps (`title`, `description`, `active`, `completed`) |
60
- | `onClickNext` | `() => void` | โœ… | Callback triggered when the "Next" button is clicked |
64
+ | `onClickNext` | `(currentStep:number) => void` | โœ… | Callback triggered when the "Next" button is clicked |
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- :root{--color-primary: #0284c7;--color-primary-light: #38bdf8;--color-success: #16a34a;--color-error: #ef4444;--color-text: #111827;--color-text-light: #4b5563;--color-black: #000;--color-white: #fff;--color-border: #d1d5db;--color-border-light: #e2e8f0;--spacing-xs: .375rem;--spacing-sm: .5rem;--spacing-md: 1rem;--spacing-lg: 1.5rem;--spacing-xl: 2rem;--step-size: 2.5rem;--step-font-weight: 600;--step-radius: 50%;--spinner-size: 1.5rem;--spinner-thickness: 3px;--spinner-color: #3b82f6;--spinner-track: #e5e7eb;--spinner-speed: .8s}body{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}h1,h2,h3,h4,h5,h6,p{margin:0;padding:0}.app-container{padding:var(--spacing-lg)}.stepper-header{display:flex;justify-content:space-between}.step-item{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}.step-item:not(:first-child):before{content:"";background-color:var(--color-border-light);position:absolute;width:calc(100% - var(--step-size));height:3px;right:calc(50% + (var(--step-size) / 2));top:calc(var(--step-size) / 2 - .125rem);transition:all .2s}.step{width:var(--step-size);height:var(--step-size);display:flex;align-items:center;justify-content:center;z-index:10;position:relative;border-radius:var(--step-radius);font-weight:var(--step-font-weight);color:var(--color-black);transition:all .2s;border:1px solid var(--color-border)}.step-active{border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-white)}.step-complete{border-color:var(--color-success);background-color:var(--color-success);color:var(--color-white)}.step-error{background-color:var(--color-error);color:var(--color-white)}.step-finished{background-color:var(--color-success);color:var(--color-white)}.complete:not(:first-child):before,.active:not(:first-child):before{background-color:var(--color-success)}.step-title{font-size:1rem;color:var(--color-text);font-weight:500;margin-top:var(--spacing-md)}.step-description{font-size:.85rem;color:var(--color-text-light);font-weight:300;margin-top:var(--spacing-sm)}.stepper-content{display:flex;justify-content:center;align-items:center}.stepper-footer{display:flex;justify-content:space-around;align-items:center;padding:var(--spacing-lg) var(--spacing-xl)}.stepper-button{padding:var(--spacing-xs) var(--spacing-xl);font-size:1rem;border-radius:.375rem;border:1px solid #9ca3af;background-color:transparent;color:inherit;cursor:pointer}.stepper-button-fill{border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-white)}.spinner{width:var(--spinner-size);height:var(--spinner-size);border-radius:50%;border:var(--spinner-thickness) solid var(--spinner-track);border-top-color:var(--spinner-color);animation:spin var(--spinner-speed) linear infinite}@media (prefers-reduced-motion: reduce){.spinner{animation:none;border-top-color:var(--spinner-track)}}@keyframes spin{to{transform:rotate(360deg)}}.test-step{padding:10vh;display:flex;justify-content:center;align-items:center}.test-step h3{color:#fff}.step-text{text-align:center}
1
+ :root{--color-primary: #0284c7;--color-primary-light: #38bdf8;--color-success: #16a34a;--color-error: #ef4444;--color-text: #111827;--color-text-light: #4b5563;--color-black: #000;--color-white: #fff;--color-border: #d1d5db;--color-border-light: #e2e8f0;--spacing-xs: .375rem;--spacing-sm: .5rem;--spacing-md: 1rem;--spacing-lg: 1.5rem;--spacing-xl: 2rem;--step-size: 2.5rem;--step-font-weight: 600;--step-radius: 50%;--spinner-size: 1.5rem;--spinner-thickness: 3px;--spinner-color: #3b82f6;--spinner-track: #e5e7eb;--spinner-speed: .8s}body{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}h1,h2,h3,h4,h5,h6,p{margin:0;padding:0}.app-container{padding:var(--spacing-lg)}.stepper-header{display:flex;justify-content:space-between}.step-item{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}.step-item:not(:first-child):before{content:"";background-color:var(--color-border-light);position:absolute;width:calc(100% - var(--step-size));height:3px;right:calc(50% + (var(--step-size) / 2));top:calc(var(--step-size) / 2 - .125rem);transition:all .2s}.step{width:var(--step-size);height:var(--step-size);display:flex;align-items:center;justify-content:center;z-index:10;position:relative;border-radius:var(--step-radius);font-weight:var(--step-font-weight);color:var(--color-black);transition:all .2s;border:1px solid var(--color-border)}.step-active{border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-white)}.step-complete{border-color:var(--color-success);background-color:var(--color-success);color:var(--color-white)}.step-error{background-color:var(--color-error);color:var(--color-white)}.step-finished{background-color:var(--color-success);color:var(--color-white)}.complete:not(:first-child):before,.active:not(:first-child):before{background-color:var(--color-success)}.step-title{font-size:1rem;color:var(--color-text);font-weight:500;margin-top:var(--spacing-md)}.step-description{font-size:.85rem;color:var(--color-text-light);font-weight:300;margin-top:var(--spacing-sm)}.stepper-content{display:flex;justify-content:center;align-items:center}.stepper-footer{display:flex;justify-content:space-around;align-items:center;padding:var(--spacing-lg) var(--spacing-xl)}.stepper-button{padding:var(--spacing-xs) var(--spacing-xl);font-size:1rem;border-radius:.375rem;border:1px solid #9ca3af;background-color:transparent;color:inherit;cursor:pointer}.stepper-button-fill{border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-white)}.spinner{width:var(--spinner-size);height:var(--spinner-size);border-radius:50%;border:var(--spinner-thickness) solid var(--spinner-track);border-top-color:var(--spinner-color);animation:spin var(--spinner-speed) linear infinite}@media (prefers-reduced-motion: reduce){.spinner{animation:none;border-top-color:var(--spinner-track)}}@keyframes spin{to{transform:rotate(360deg)}}.test-step{padding:10vh;display:flex;justify-content:center;align-items:center;border-radius:1rem;width:50%;margin-block:2rem}.test-step h3{color:#fff}.step-text{text-align:center}
@@ -14,7 +14,7 @@ function fe() {
14
14
  if (U) return R;
15
15
  U = 1;
16
16
  var t = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
17
- function o(h, c, l) {
17
+ function o(v, c, l) {
18
18
  var m = null;
19
19
  if (l !== void 0 && (m = "" + l), c.key !== void 0 && (m = "" + c.key), "key" in c) {
20
20
  l = {};
@@ -23,7 +23,7 @@ function fe() {
23
23
  } else l = c;
24
24
  return c = l.ref, {
25
25
  $$typeof: t,
26
- type: h,
26
+ type: v,
27
27
  key: m,
28
28
  ref: c !== void 0 ? c : null,
29
29
  props: l
@@ -107,7 +107,7 @@ function de() {
107
107
  ), s(e);
108
108
  }
109
109
  }
110
- function h(e) {
110
+ function v(e) {
111
111
  if (e === g) return "<>";
112
112
  if (typeof e == "object" && e !== null && e.$$typeof === F)
113
113
  return "<...>";
@@ -152,7 +152,7 @@ function de() {
152
152
  }
153
153
  function k(e, r, a, u, E, x, A, w) {
154
154
  return a = x.ref, e = {
155
- $$typeof: v,
155
+ $$typeof: h,
156
156
  type: e,
157
157
  key: r,
158
158
  props: x,
@@ -233,9 +233,9 @@ React keys must be passed directly to JSX without using spread:
233
233
  );
234
234
  }
235
235
  function b(e) {
236
- typeof e == "object" && e !== null && e.$$typeof === v && e._store && (e._store.validated = 1);
236
+ typeof e == "object" && e !== null && e.$$typeof === h && e._store && (e._store.validated = 1);
237
237
  }
238
- var i = ce, v = Symbol.for("react.transitional.element"), X = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), H = Symbol.for("react.strict_mode"), B = Symbol.for("react.profiler"), Z = Symbol.for("react.consumer"), Q = Symbol.for("react.context"), K = Symbol.for("react.forward_ref"), ee = Symbol.for("react.suspense"), re = Symbol.for("react.suspense_list"), te = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), ne = Symbol.for("react.activity"), se = Symbol.for("react.client.reference"), P = i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, oe = Array.isArray, O = console.createTask ? console.createTask : function() {
238
+ var i = ce, h = Symbol.for("react.transitional.element"), X = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), H = Symbol.for("react.strict_mode"), B = Symbol.for("react.profiler"), Z = Symbol.for("react.consumer"), Q = Symbol.for("react.context"), K = Symbol.for("react.forward_ref"), ee = Symbol.for("react.suspense"), re = Symbol.for("react.suspense_list"), te = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), ne = Symbol.for("react.activity"), se = Symbol.for("react.client.reference"), P = i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, oe = Array.isArray, O = console.createTask ? console.createTask : function() {
239
239
  return null;
240
240
  };
241
241
  i = {
@@ -246,7 +246,7 @@ React keys must be passed directly to JSX without using spread:
246
246
  var $, M = {}, I = i.react_stack_bottom_frame.bind(
247
247
  i,
248
248
  l
249
- )(), D = O(h(l)), L = {};
249
+ )(), D = O(v(l)), L = {};
250
250
  j.Fragment = g, j.jsx = function(e, r, a, u, E) {
251
251
  var x = 1e4 > P.recentlyCreatedOwnerStacks++;
252
252
  return d(
@@ -257,7 +257,7 @@ React keys must be passed directly to JSX without using spread:
257
257
  u,
258
258
  E,
259
259
  x ? Error("react-stack-top-frame") : I,
260
- x ? O(h(e)) : D
260
+ x ? O(v(e)) : D
261
261
  );
262
262
  }, j.jsxs = function(e, r, a, u, E) {
263
263
  var x = 1e4 > P.recentlyCreatedOwnerStacks++;
@@ -269,7 +269,7 @@ React keys must be passed directly to JSX without using spread:
269
269
  u,
270
270
  E,
271
271
  x ? Error("react-stack-top-frame") : I,
272
- x ? O(h(e)) : D
272
+ x ? O(v(e)) : D
273
273
  );
274
274
  };
275
275
  }()), j;
@@ -289,7 +289,7 @@ const G = le(
289
289
  );
290
290
  return t;
291
291
  }, pe = ({ children: t, steppers: s }) => {
292
- const [o, h] = W(0), [c, l] = W([]);
292
+ const [o, v] = W(0), [c, l] = W([]);
293
293
  ue(() => {
294
294
  if (s.length) {
295
295
  const d = [...s];
@@ -301,12 +301,12 @@ const G = le(
301
301
  const i = [...b];
302
302
  if (d > b.length - 1) return b;
303
303
  i[o] && (i[o] = { ...i[o], active: !1 }), i[d] && (i[d] = { ...i[d], active: !0 });
304
- for (let v = 0; v < d; v++)
305
- i[v] = { ...i[v], completed: !0 };
306
- for (let v = d; v < i.length; v++)
307
- i[v] = { ...i[v], completed: !1 };
304
+ for (let h = 0; h < d; h++)
305
+ i[h] = { ...i[h], completed: !0 };
306
+ for (let h = d; h < i.length; h++)
307
+ i[h] = { ...i[h], completed: !1 };
308
308
  return i;
309
- }), h(d);
309
+ }), v(d);
310
310
  }, [o]), p = C(() => {
311
311
  o < c.length - 1 ? m(o + 1) : l((d) => {
312
312
  const b = [...d];
@@ -348,8 +348,8 @@ const G = le(
348
348
  o
349
349
  )) }) }) : /* @__PURE__ */ n.jsx(z, {});
350
350
  }, be = ({ onClickNext: t }) => {
351
- const { handleNextStep: s, handlePrevStep: o, currentStep: h, steps: c } = N(), l = h === c.length - 1, m = () => {
352
- c[h].completed || (s(), t());
351
+ const { handleNextStep: s, handlePrevStep: o, currentStep: v, steps: c } = N(), l = v === c.length - 1, m = () => {
352
+ c[v].completed || (s(), t(v + 1));
353
353
  }, p = V(() => ({
354
354
  button: "stepper-button",
355
355
  fill: "stepper-button-fill"
@@ -361,7 +361,7 @@ const G = le(
361
361
  type: "button",
362
362
  className: p.button,
363
363
  onClick: o,
364
- disabled: h < 0,
364
+ disabled: v < 0,
365
365
  children: "Prev"
366
366
  }
367
367
  ),
@@ -1,5 +1,5 @@
1
- (function(j,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],c):(j=typeof globalThis<"u"?globalThis:j||self,c(j["multi-stepper"]={},j.React))})(this,function(j,c){"use strict";var M=document.createElement("style");M.textContent=`:root{--color-primary: #0284c7;--color-primary-light: #38bdf8;--color-success: #16a34a;--color-error: #ef4444;--color-text: #111827;--color-text-light: #4b5563;--color-black: #000;--color-white: #fff;--color-border: #d1d5db;--color-border-light: #e2e8f0;--spacing-xs: .375rem;--spacing-sm: .5rem;--spacing-md: 1rem;--spacing-lg: 1.5rem;--spacing-xl: 2rem;--step-size: 2.5rem;--step-font-weight: 600;--step-radius: 50%;--spinner-size: 1.5rem;--spinner-thickness: 3px;--spinner-color: #3b82f6;--spinner-track: #e5e7eb;--spinner-speed: .8s}body{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}h1,h2,h3,h4,h5,h6,p{margin:0;padding:0}.app-container{padding:var(--spacing-lg)}.stepper-header{display:flex;justify-content:space-between}.step-item{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}.step-item:not(:first-child):before{content:"";background-color:var(--color-border-light);position:absolute;width:calc(100% - var(--step-size));height:3px;right:calc(50% + (var(--step-size) / 2));top:calc(var(--step-size) / 2 - .125rem);transition:all .2s}.step{width:var(--step-size);height:var(--step-size);display:flex;align-items:center;justify-content:center;z-index:10;position:relative;border-radius:var(--step-radius);font-weight:var(--step-font-weight);color:var(--color-black);transition:all .2s;border:1px solid var(--color-border)}.step-active{border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-white)}.step-complete{border-color:var(--color-success);background-color:var(--color-success);color:var(--color-white)}.step-error{background-color:var(--color-error);color:var(--color-white)}.step-finished{background-color:var(--color-success);color:var(--color-white)}.complete:not(:first-child):before,.active:not(:first-child):before{background-color:var(--color-success)}.step-title{font-size:1rem;color:var(--color-text);font-weight:500;margin-top:var(--spacing-md)}.step-description{font-size:.85rem;color:var(--color-text-light);font-weight:300;margin-top:var(--spacing-sm)}.stepper-content{display:flex;justify-content:center;align-items:center}.stepper-footer{display:flex;justify-content:space-around;align-items:center;padding:var(--spacing-lg) var(--spacing-xl)}.stepper-button{padding:var(--spacing-xs) var(--spacing-xl);font-size:1rem;border-radius:.375rem;border:1px solid #9ca3af;background-color:transparent;color:inherit;cursor:pointer}.stepper-button-fill{border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-white)}.spinner{width:var(--spinner-size);height:var(--spinner-size);border-radius:50%;border:var(--spinner-thickness) solid var(--spinner-track);border-top-color:var(--spinner-color);animation:spin var(--spinner-speed) linear infinite}@media (prefers-reduced-motion: reduce){.spinner{animation:none;border-top-color:var(--spinner-track)}}@keyframes spin{to{transform:rotate(360deg)}}.test-step{padding:10vh;display:flex;justify-content:center;align-items:center}.test-step h3{color:#fff}.step-text{text-align:center}
2
- /*$vite$:1*/`,document.head.appendChild(M);var y={exports:{}},R={};/**
1
+ (function(j,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],c):(j=typeof globalThis<"u"?globalThis:j||self,c(j["multi-stepper"]={},j.React))})(this,function(j,c){"use strict";var M=document.createElement("style");M.textContent=`:root{--color-primary: #0284c7;--color-primary-light: #38bdf8;--color-success: #16a34a;--color-error: #ef4444;--color-text: #111827;--color-text-light: #4b5563;--color-black: #000;--color-white: #fff;--color-border: #d1d5db;--color-border-light: #e2e8f0;--spacing-xs: .375rem;--spacing-sm: .5rem;--spacing-md: 1rem;--spacing-lg: 1.5rem;--spacing-xl: 2rem;--step-size: 2.5rem;--step-font-weight: 600;--step-radius: 50%;--spinner-size: 1.5rem;--spinner-thickness: 3px;--spinner-color: #3b82f6;--spinner-track: #e5e7eb;--spinner-speed: .8s}body{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}h1,h2,h3,h4,h5,h6,p{margin:0;padding:0}.app-container{padding:var(--spacing-lg)}.stepper-header{display:flex;justify-content:space-between}.step-item{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}.step-item:not(:first-child):before{content:"";background-color:var(--color-border-light);position:absolute;width:calc(100% - var(--step-size));height:3px;right:calc(50% + (var(--step-size) / 2));top:calc(var(--step-size) / 2 - .125rem);transition:all .2s}.step{width:var(--step-size);height:var(--step-size);display:flex;align-items:center;justify-content:center;z-index:10;position:relative;border-radius:var(--step-radius);font-weight:var(--step-font-weight);color:var(--color-black);transition:all .2s;border:1px solid var(--color-border)}.step-active{border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-white)}.step-complete{border-color:var(--color-success);background-color:var(--color-success);color:var(--color-white)}.step-error{background-color:var(--color-error);color:var(--color-white)}.step-finished{background-color:var(--color-success);color:var(--color-white)}.complete:not(:first-child):before,.active:not(:first-child):before{background-color:var(--color-success)}.step-title{font-size:1rem;color:var(--color-text);font-weight:500;margin-top:var(--spacing-md)}.step-description{font-size:.85rem;color:var(--color-text-light);font-weight:300;margin-top:var(--spacing-sm)}.stepper-content{display:flex;justify-content:center;align-items:center}.stepper-footer{display:flex;justify-content:space-around;align-items:center;padding:var(--spacing-lg) var(--spacing-xl)}.stepper-button{padding:var(--spacing-xs) var(--spacing-xl);font-size:1rem;border-radius:.375rem;border:1px solid #9ca3af;background-color:transparent;color:inherit;cursor:pointer}.stepper-button-fill{border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-white)}.spinner{width:var(--spinner-size);height:var(--spinner-size);border-radius:50%;border:var(--spinner-thickness) solid var(--spinner-track);border-top-color:var(--spinner-color);animation:spin var(--spinner-speed) linear infinite}@media (prefers-reduced-motion: reduce){.spinner{animation:none;border-top-color:var(--spinner-track)}}@keyframes spin{to{transform:rotate(360deg)}}.test-step{padding:10vh;display:flex;justify-content:center;align-items:center;border-radius:1rem;width:50%;margin-block:2rem}.test-step h3{color:#fff}.step-text{text-align:center}
2
+ /*$vite$:1*/`,document.head.appendChild(M);var y={exports:{}},k={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
5
5
  *
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var z;function H(){if(z)return R;z=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function s(b,i,l){var m=null;if(l!==void 0&&(m=""+l),i.key!==void 0&&(m=""+i.key),"key"in i){l={};for(var v in i)v!=="key"&&(l[v]=i[v])}else l=i;return i=l.ref,{$$typeof:t,type:b,key:m,ref:i!==void 0?i:null,props:l}}return R.Fragment=o,R.jsx=s,R.jsxs=s,R}var k={};/**
10
+ */var z;function H(){if(z)return k;z=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function s(h,i,l){var m=null;if(l!==void 0&&(m=""+l),i.key!==void 0&&(m=""+i.key),"key"in i){l={};for(var v in i)v!=="key"&&(l[v]=i[v])}else l=i;return i=l.ref,{$$typeof:t,type:h,key:m,ref:i!==void 0?i:null,props:l}}return k.Fragment=o,k.jsx=s,k.jsxs=s,k}var R={};/**
11
11
  * @license React
12
12
  * react-jsx-runtime.development.js
13
13
  *
@@ -15,9 +15,9 @@
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var Y;function B(){return Y||(Y=1,process.env.NODE_ENV!=="production"&&function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===pe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case oe:return"Profiler";case ne:return"StrictMode";case ce:return"Suspense";case le:return"SuspenseList";case de:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case te:return"Portal";case ae:return(e.displayName||"Context")+".Provider";case se:return(e._context.displayName||"Context")+".Consumer";case ie:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ue:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case L:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function o(e){return""+e}function s(e){try{o(e);var r=!1}catch{r=!0}if(r){r=console;var a=r.error,d=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",d),o(e)}}function b(e){if(e===w)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===L)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function i(){var e=O.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function m(e){if(U.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function v(e,r){function a(){W||(W=!0,console.error("%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)",r))}a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}function T(){var e=t(this.type);return J[e]||(J[e]=!0,console.error("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.")),e=this.props.ref,e!==void 0?e:null}function N(e,r,a,d,E,g,A,C){return a=g.ref,e={$$typeof:h,type:e,key:r,props:g,_owner:E},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:T}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function f(e,r,a,d,E,g,A,C){var p=r.children;if(p!==void 0)if(d)if(fe(p)){for(d=0;d<p.length;d++)x(p[d]);Object.freeze&&Object.freeze(p)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else x(p);if(U.call(r,"key")){p=t(e);var _=Object.keys(r).filter(function(me){return me!=="key"});d=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",X[p+d]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ */var Y;function B(){return Y||(Y=1,process.env.NODE_ENV!=="production"&&function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===pe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case oe:return"Profiler";case ne:return"StrictMode";case ce:return"Suspense";case le:return"SuspenseList";case de:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case te:return"Portal";case ae:return(e.displayName||"Context")+".Provider";case se:return(e._context.displayName||"Context")+".Consumer";case ie:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ue:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case L:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function o(e){return""+e}function s(e){try{o(e);var r=!1}catch{r=!0}if(r){r=console;var a=r.error,d=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",d),o(e)}}function h(e){if(e===w)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===L)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function i(){var e=O.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function m(e){if(U.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function v(e,r){function a(){W||(W=!0,console.error("%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)",r))}a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}function T(){var e=t(this.type);return J[e]||(J[e]=!0,console.error("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.")),e=this.props.ref,e!==void 0?e:null}function N(e,r,a,d,E,x,A,C){return a=x.ref,e={$$typeof:b,type:e,key:r,props:x,_owner:E},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:T}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function f(e,r,a,d,E,x,A,C){var p=r.children;if(p!==void 0)if(d)if(fe(p)){for(d=0;d<p.length;d++)g(p[d]);Object.freeze&&Object.freeze(p)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else g(p);if(U.call(r,"key")){p=t(e);var _=Object.keys(r).filter(function(me){return me!=="key"});d=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",X[p+d]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
19
19
  let props = %s;
20
20
  <%s {...props} />
21
21
  React keys must be passed directly to JSX without using spread:
22
22
  let props = %s;
23
- <%s key={someKey} {...props} />`,d,p,_,p),X[p+d]=!0)}if(p=null,a!==void 0&&(s(a),p=""+a),m(r)&&(s(r.key),p=""+r.key),"key"in r){a={};for(var F in r)F!=="key"&&(a[F]=r[F])}else a=r;return p&&v(a,typeof e=="function"?e.displayName||e.name||"Unknown":e),N(e,p,g,E,i(),a,A,C)}function x(e){typeof e=="object"&&e!==null&&e.$$typeof===h&&e._store&&(e._store.validated=1)}var u=c,h=Symbol.for("react.transitional.element"),te=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),ne=Symbol.for("react.strict_mode"),oe=Symbol.for("react.profiler"),se=Symbol.for("react.consumer"),ae=Symbol.for("react.context"),ie=Symbol.for("react.forward_ref"),ce=Symbol.for("react.suspense"),le=Symbol.for("react.suspense_list"),ue=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),pe=Symbol.for("react.client.reference"),O=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,fe=Array.isArray,P=console.createTask?console.createTask:function(){return null};u={react_stack_bottom_frame:function(e){return e()}};var W,J={},V=u.react_stack_bottom_frame.bind(u,l)(),G=P(b(l)),X={};k.Fragment=w,k.jsx=function(e,r,a,d,E){var g=1e4>O.recentlyCreatedOwnerStacks++;return f(e,r,a,!1,d,E,g?Error("react-stack-top-frame"):V,g?P(b(e)):G)},k.jsxs=function(e,r,a,d,E){var g=1e4>O.recentlyCreatedOwnerStacks++;return f(e,r,a,!0,d,E,g?Error("react-stack-top-frame"):V,g?P(b(e)):G)}}()),k}var I;function Z(){return I||(I=1,process.env.NODE_ENV==="production"?y.exports=H():y.exports=B()),y.exports}var n=Z();const D=c.createContext(void 0),S=()=>{const t=c.useContext(D);if(!t)throw new Error("useMultiStepperForm must be used within a MultiStepperProvider");return t},Q=({children:t,steppers:o})=>{const[s,b]=c.useState(0),[i,l]=c.useState([]);c.useEffect(()=>{if(o.length){const f=[...o];f[0].active=!0,l(f)}},[o.length]);const m=c.useCallback(f=>{l(x=>{const u=[...x];if(f>x.length-1)return x;u[s]&&(u[s]={...u[s],active:!1}),u[f]&&(u[f]={...u[f],active:!0});for(let h=0;h<f;h++)u[h]={...u[h],completed:!0};for(let h=f;h<u.length;h++)u[h]={...u[h],completed:!1};return u}),b(f)},[s]),v=c.useCallback(()=>{s<i.length-1?m(s+1):l(f=>{const x=[...f];return x[s]={...x[s],completed:!0},x})},[s,i.length,m]),T=c.useCallback(()=>{s>0&&m(s-1)},[s,m]),N=c.useMemo(()=>({currentStep:s,steps:i,handleNextStep:v,handlePrevStep:T,updateSteps:m}),[s,i,v,T,m]);return n.jsx(D.Provider,{value:N,children:t})},K=({step:t,index:o})=>{const{steps:s}=S();return s.length?t.loading?n.jsx("div",{className:"step step-loading",children:n.jsx("div",{className:"spinner",role:"status","aria-label":"Loading"})}):t.error?n.jsx("div",{className:"step step-error",children:t.icon??n.jsx("span",{className:"text-white",children:"โœ—"})}):t.completed?n.jsx("div",{className:"step step-complete",children:t.icon??n.jsx("span",{className:"text-white",children:"โœ“"})}):t.finshed?n.jsx("div",{className:"step step-complete",children:t.icon}):t.active?n.jsx("div",{className:"step step-active",children:t.icon??n.jsx("h2",{className:"text-white",children:o})}):n.jsx("div",{className:"step step-default",children:t.icon??n.jsx("h2",{children:o})}):n.jsx(c.Fragment,{})},q=()=>{const{steps:t}=S();return t.length?n.jsx("div",{className:"app-container",children:n.jsx("ol",{className:"stepper-header",children:t.map((o,s)=>n.jsxs("div",{className:`step-item ${o.active&&"active"} ${o.completed&&"complete"} `,children:[n.jsx(K,{index:s+1,step:o}),n.jsxs("div",{className:"step-text",children:[o.title&&n.jsx("h3",{className:"step-title",children:o.title}),o.description&&n.jsx("h3",{className:"step-description",children:o.description})]})]},s))})}):n.jsx(c.Fragment,{})},$=({onClickNext:t})=>{const{handleNextStep:o,handlePrevStep:s,currentStep:b,steps:i}=S(),l=b===i.length-1,m=()=>{i[b].completed||(o(),t())},v=c.useMemo(()=>({button:"stepper-button",fill:"stepper-button-fill"}),[]);return n.jsxs("div",{className:"stepper-footer",children:[n.jsx("button",{type:"button",className:v.button,onClick:s,disabled:b<0,children:"Prev"}),n.jsx("button",{type:"button",className:`${l?`${v.button} ${v.fill}`:v.button}`,onClick:m,children:l?"Finish":"Next"})]})},ee=()=>{const{steps:t,currentStep:o}=S();return n.jsx("div",{className:"stepper-content",children:t[o]&&t[o].children&&t[o].children})},re=({steps:t,onClickNext:o})=>t?n.jsxs(Q,{steppers:t,children:[n.jsx(q,{}),n.jsx(ee,{}),n.jsx($,{onClickNext:o})]}):n.jsx(n.Fragment,{});j.MultiStepper=re,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
23
+ <%s key={someKey} {...props} />`,d,p,_,p),X[p+d]=!0)}if(p=null,a!==void 0&&(s(a),p=""+a),m(r)&&(s(r.key),p=""+r.key),"key"in r){a={};for(var F in r)F!=="key"&&(a[F]=r[F])}else a=r;return p&&v(a,typeof e=="function"?e.displayName||e.name||"Unknown":e),N(e,p,x,E,i(),a,A,C)}function g(e){typeof e=="object"&&e!==null&&e.$$typeof===b&&e._store&&(e._store.validated=1)}var u=c,b=Symbol.for("react.transitional.element"),te=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),ne=Symbol.for("react.strict_mode"),oe=Symbol.for("react.profiler"),se=Symbol.for("react.consumer"),ae=Symbol.for("react.context"),ie=Symbol.for("react.forward_ref"),ce=Symbol.for("react.suspense"),le=Symbol.for("react.suspense_list"),ue=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),pe=Symbol.for("react.client.reference"),O=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,fe=Array.isArray,P=console.createTask?console.createTask:function(){return null};u={react_stack_bottom_frame:function(e){return e()}};var W,J={},V=u.react_stack_bottom_frame.bind(u,l)(),G=P(h(l)),X={};R.Fragment=w,R.jsx=function(e,r,a,d,E){var x=1e4>O.recentlyCreatedOwnerStacks++;return f(e,r,a,!1,d,E,x?Error("react-stack-top-frame"):V,x?P(h(e)):G)},R.jsxs=function(e,r,a,d,E){var x=1e4>O.recentlyCreatedOwnerStacks++;return f(e,r,a,!0,d,E,x?Error("react-stack-top-frame"):V,x?P(h(e)):G)}}()),R}var I;function Z(){return I||(I=1,process.env.NODE_ENV==="production"?y.exports=H():y.exports=B()),y.exports}var n=Z();const D=c.createContext(void 0),S=()=>{const t=c.useContext(D);if(!t)throw new Error("useMultiStepperForm must be used within a MultiStepperProvider");return t},Q=({children:t,steppers:o})=>{const[s,h]=c.useState(0),[i,l]=c.useState([]);c.useEffect(()=>{if(o.length){const f=[...o];f[0].active=!0,l(f)}},[o.length]);const m=c.useCallback(f=>{l(g=>{const u=[...g];if(f>g.length-1)return g;u[s]&&(u[s]={...u[s],active:!1}),u[f]&&(u[f]={...u[f],active:!0});for(let b=0;b<f;b++)u[b]={...u[b],completed:!0};for(let b=f;b<u.length;b++)u[b]={...u[b],completed:!1};return u}),h(f)},[s]),v=c.useCallback(()=>{s<i.length-1?m(s+1):l(f=>{const g=[...f];return g[s]={...g[s],completed:!0},g})},[s,i.length,m]),T=c.useCallback(()=>{s>0&&m(s-1)},[s,m]),N=c.useMemo(()=>({currentStep:s,steps:i,handleNextStep:v,handlePrevStep:T,updateSteps:m}),[s,i,v,T,m]);return n.jsx(D.Provider,{value:N,children:t})},K=({step:t,index:o})=>{const{steps:s}=S();return s.length?t.loading?n.jsx("div",{className:"step step-loading",children:n.jsx("div",{className:"spinner",role:"status","aria-label":"Loading"})}):t.error?n.jsx("div",{className:"step step-error",children:t.icon??n.jsx("span",{className:"text-white",children:"โœ—"})}):t.completed?n.jsx("div",{className:"step step-complete",children:t.icon??n.jsx("span",{className:"text-white",children:"โœ“"})}):t.finshed?n.jsx("div",{className:"step step-complete",children:t.icon}):t.active?n.jsx("div",{className:"step step-active",children:t.icon??n.jsx("h2",{className:"text-white",children:o})}):n.jsx("div",{className:"step step-default",children:t.icon??n.jsx("h2",{children:o})}):n.jsx(c.Fragment,{})},q=()=>{const{steps:t}=S();return t.length?n.jsx("div",{className:"app-container",children:n.jsx("ol",{className:"stepper-header",children:t.map((o,s)=>n.jsxs("div",{className:`step-item ${o.active&&"active"} ${o.completed&&"complete"} `,children:[n.jsx(K,{index:s+1,step:o}),n.jsxs("div",{className:"step-text",children:[o.title&&n.jsx("h3",{className:"step-title",children:o.title}),o.description&&n.jsx("h3",{className:"step-description",children:o.description})]})]},s))})}):n.jsx(c.Fragment,{})},$=({onClickNext:t})=>{const{handleNextStep:o,handlePrevStep:s,currentStep:h,steps:i}=S(),l=h===i.length-1,m=()=>{i[h].completed||(o(),t(h+1))},v=c.useMemo(()=>({button:"stepper-button",fill:"stepper-button-fill"}),[]);return n.jsxs("div",{className:"stepper-footer",children:[n.jsx("button",{type:"button",className:v.button,onClick:s,disabled:h<0,children:"Prev"}),n.jsx("button",{type:"button",className:`${l?`${v.button} ${v.fill}`:v.button}`,onClick:m,children:l?"Finish":"Next"})]})},ee=()=>{const{steps:t,currentStep:o}=S();return n.jsx("div",{className:"stepper-content",children:t[o]&&t[o].children&&t[o].children})},re=({steps:t,onClickNext:o})=>t?n.jsxs(Q,{steppers:t,children:[n.jsx(q,{}),n.jsx(ee,{}),n.jsx($,{onClickNext:o})]}):n.jsx(n.Fragment,{});j.MultiStepper=re,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -3,8 +3,11 @@
3
3
  "main": "./dist/multi-stepper.umd.js",
4
4
  "module": "./dist/multi-stepper.es.js",
5
5
  "types": "./dist/index.d.ts",
6
- "version": "1.1.8",
6
+ "version": "1.2.0",
7
7
  "type": "module",
8
+ "repository": {
9
+ "url": "https://github.com/UppiliSrinivas/react-stepper/tree/multi-stepper"
10
+ },
8
11
  "files": [
9
12
  "dist"
10
13
  ],