reactjs-multi-stepper 1.0.1 → 1.0.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.
@@ -279,14 +279,10 @@ function Cg() {
279
279
  return ag || (ag = 1, process.env.NODE_ENV === "production" ? g0.exports = bg() : g0.exports = Ng()), g0.exports;
280
280
  }
281
281
  var d = Cg();
282
- const hg = wg(
283
- void 0
284
- ), j_ = () => {
282
+ const hg = wg(void 0), j_ = () => {
285
283
  const c = fg(hg);
286
284
  if (!c)
287
- throw new Error(
288
- "useMultiStepperForm must be used within a MultiStepperProvider"
289
- );
285
+ throw new Error("useMultiStepperForm must be used within a MultiStepperProvider");
290
286
  return c;
291
287
  }, $g = ({ children: c, steppers: t }) => {
292
288
  const [o, r] = Q_(0), [h, i] = Q_([]);
@@ -299,7 +295,8 @@ const hg = wg(
299
295
  const u = T_((k) => {
300
296
  i((_) => {
301
297
  const p = [..._];
302
- if (k > _.length - 1) return _;
298
+ if (k > _.length - 1)
299
+ return _;
303
300
  p[o] && (p[o] = { ...p[o], active: !1 }), p[k] && (p[k] = { ...p[k], active: !0 });
304
301
  for (let v = 0; v < k; v++)
305
302
  p[v] = { ...p[v], completed: !0 };
@@ -314,17 +311,14 @@ const hg = wg(
314
311
  });
315
312
  }, [o, h.length, u]), l0 = T_(() => {
316
313
  o > 0 && u(o - 1);
317
- }, [o, u]), v0 = O_(
318
- () => ({
319
- currentStep: o,
320
- steps: h,
321
- handleNextStep: m,
322
- handlePrevStep: l0,
323
- updateSteps: u
324
- }),
325
- [o, h, m, l0, u]
326
- );
327
- return /* @__PURE__ */ d.jsx(hg.Provider, { value: v0, children: c });
314
+ }, [o, u]), v0 = O_(() => ({
315
+ currentStep: o,
316
+ steps: h,
317
+ handleNextStep: m,
318
+ handlePrevStep: l0,
319
+ updateSteps: u
320
+ }), [o, h, m, l0, u]);
321
+ return d.jsx(hg.Provider, { value: v0, children: c });
328
322
  };
329
323
  /**
330
324
  * @license lucide-react v0.535.0 - ISC
@@ -31160,14 +31154,9 @@ const RK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
31160
31154
  ZoomOutIcon: A_,
31161
31155
  createLucideIcon: e,
31162
31156
  icons: DK
31163
- }, Symbol.toStringTag, { value: "Module" })), M0 = ({
31164
- name: c,
31165
- size: t = 20,
31166
- color: o = "currentColor",
31167
- ...r
31168
- }) => {
31157
+ }, Symbol.toStringTag, { value: "Module" })), M0 = ({ name: c, size: t = 20, color: o = "currentColor", ...r }) => {
31169
31158
  const h = RK[c];
31170
- return typeof h == "function" || h && typeof h == "object" ? /* @__PURE__ */ d.jsx(h, { size: t, color: o, ...r }) : null;
31159
+ return typeof h == "function" || h && typeof h == "object" ? d.jsx(h, { size: t, color: o, ...r }) : null;
31171
31160
  }, tg = {
31172
31161
  xs: "w-2 h-2",
31173
31162
  sm: "w-4 h-4",
@@ -31176,72 +31165,29 @@ const RK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
31176
31165
  xl: "w-10 h-10"
31177
31166
  }, TK = ({ size: c = "md", className: t }) => {
31178
31167
  const o = O_(() => typeof c == "number" ? `w-[${c}px] h-[${c}px]` : tg[c] || tg.md, [c]);
31179
- return /* @__PURE__ */ d.jsx(
31180
- M0,
31181
- {
31182
- name: "Loader2Icon",
31183
- "aria-label": "Loading",
31184
- role: "status",
31185
- className: o + t
31186
- }
31187
- );
31188
- }, UK = og.memo(TK), OK = ({
31189
- step: c,
31190
- index: t
31191
- }) => {
31168
+ return d.jsx(M0, {
31169
+ name: "Loader2Icon",
31170
+ "aria-label": "Loading",
31171
+ role: "status",
31172
+ // className={cn("animate-spin text-muted", sizeClass, className)}
31173
+ className: o + t
31174
+ });
31175
+ }, UK = og.memo(TK), OK = ({ step: c, index: t }) => {
31192
31176
  const { steps: o } = j_();
31193
- return o.length ? c.loading ? /* @__PURE__ */ d.jsx("div", { className: "step step-active", children: /* @__PURE__ */ d.jsx(UK, {}) }) : c.error ? /* @__PURE__ */ d.jsx("div", { className: "step bg-red-500", children: /* @__PURE__ */ d.jsx(M0, { name: "X", className: "text-white" }) }) : c.completed ? /* @__PURE__ */ d.jsx("div", { className: "step bg-green-500", children: /* @__PURE__ */ d.jsx(M0, { name: "Check", className: "text-white" }) }) : c.finshed ? /* @__PURE__ */ d.jsx("div", { className: "step bg-green-500", children: /* @__PURE__ */ d.jsx(M0, { name: "Check", className: "text-white" }) }) : c.active ? /* @__PURE__ */ d.jsx("div", { className: "step bg-blue-500", children: c.icon ? /* @__PURE__ */ d.jsx(M0, { name: c.icon, className: "text-white" }) : /* @__PURE__ */ d.jsx("h2", { className: "text-white", children: t }) }) : /* @__PURE__ */ d.jsx("div", { className: "step border border-gray-300", children: c.icon ? /* @__PURE__ */ d.jsx(M0, { name: c.icon, className: "step-icon" }) : /* @__PURE__ */ d.jsx("h2", { children: t }) }) : /* @__PURE__ */ d.jsx(dg, {});
31177
+ return o.length ? c.loading ? d.jsx("div", { className: "step step-active", children: d.jsx(UK, {}) }) : c.error ? d.jsx("div", { className: "step bg-red-500", children: d.jsx(M0, { name: "X", className: "text-white" }) }) : c.completed ? d.jsx("div", { className: "step bg-green-500", children: d.jsx(M0, { name: "Check", className: "text-white" }) }) : c.finshed ? d.jsx("div", { className: "step bg-green-500", children: d.jsx(M0, { name: "Check", className: "text-white" }) }) : c.active ? d.jsx("div", { className: "step bg-blue-500", children: c.icon ? d.jsx(M0, { name: c.icon, className: "text-white" }) : d.jsx("h2", { className: "text-white", children: t }) }) : d.jsx("div", { className: "step border border-gray-300", children: c.icon ? d.jsx(M0, { name: c.icon, className: "step-icon" }) : d.jsx("h2", { children: t }) }) : d.jsx(dg, {});
31194
31178
  }, ZK = () => {
31195
31179
  const { steps: c } = j_();
31196
- return c.length ? /* @__PURE__ */ d.jsx("div", { className: "app-container w-full", children: /* @__PURE__ */ d.jsx("ol", { className: "flex w-full justify-between", children: c.map((t, o) => /* @__PURE__ */ d.jsxs(
31197
- "div",
31198
- {
31199
- className: `step-item ${t.active && "active"} ${t.completed && "complete"} `,
31200
- children: [
31201
- /* @__PURE__ */ d.jsx(OK, { index: o + 1, step: t }),
31202
- /* @__PURE__ */ d.jsxs("div", { className: "text-center mt-4", children: [
31203
- t.title && /* @__PURE__ */ d.jsx("h3", { className: "text-md text-gray-900 font-medium mb-1", children: t.title }),
31204
- t.description && /* @__PURE__ */ d.jsx("h3", { className: "text-sm text-gray-600 font-light", children: t.description })
31205
- ] })
31206
- ]
31207
- },
31208
- o
31209
- )) }) }) : /* @__PURE__ */ d.jsx(dg, {});
31180
+ return c.length ? d.jsx("div", { className: "app-container w-full", children: d.jsx("ol", { className: "flex w-full justify-between", children: c.map((t, o) => d.jsxs("div", { className: `step-item ${t.active && "active"} ${t.completed && "complete"} `, children: [d.jsx(OK, { index: o + 1, step: t }), d.jsxs("div", { className: "text-center mt-4", children: [t.title && d.jsx("h3", { className: "text-md text-gray-900 font-medium mb-1", children: t.title }), t.description && d.jsx("h3", { className: "text-sm text-gray-600 font-light", children: t.description })] })] }, o)) }) }) : d.jsx(dg, {});
31210
31181
  }, EK = () => {
31211
31182
  const { handleNextStep: c, handlePrevStep: t, currentStep: o, steps: r } = j_(), h = o === r.length - 1, i = O_(() => ({
31212
31183
  button: " px-8 py-1.5 text-md rounded-md border border-gray-400",
31213
31184
  fill: " border-blue-500 bg-blue-500 text-white"
31214
31185
  }), []);
31215
- return /* @__PURE__ */ d.jsxs("div", { className: "w-full flex justify-around items-center p-6", children: [
31216
- o > 0 ? /* @__PURE__ */ d.jsx(
31217
- "button",
31218
- {
31219
- type: "button",
31220
- className: i.button,
31221
- onClick: t,
31222
- children: "Prev"
31223
- }
31224
- ) : /* @__PURE__ */ d.jsx("div", {}),
31225
- /* @__PURE__ */ d.jsx(
31226
- "button",
31227
- {
31228
- type: "button",
31229
- className: `${h ? i.button + i.fill : i.button} cursor-pointer`,
31230
- onClick: c,
31231
- children: h ? "Finish" : "Next"
31232
- }
31233
- )
31234
- ] });
31186
+ return d.jsxs("div", { className: "w-full flex justify-around items-center p-6", children: [o > 0 ? d.jsx("button", { type: "button", className: i.button, onClick: t, children: "Prev" }) : d.jsx("div", {}), d.jsx("button", { type: "button", className: `${h ? i.button + i.fill : i.button} cursor-pointer`, onClick: c, children: h ? "Finish" : "Next" })] });
31235
31187
  }, GK = () => {
31236
31188
  const { steps: c, currentStep: t } = j_();
31237
- return /* @__PURE__ */ d.jsx("div", { className: "w-full p-6 flex justify-center items-center", children: c[t] && c[t].children && c[t].children });
31238
- }, XK = ({
31239
- steps: c
31240
- }) => c ? /* @__PURE__ */ d.jsxs($g, { steppers: c, children: [
31241
- /* @__PURE__ */ d.jsx(ZK, {}),
31242
- /* @__PURE__ */ d.jsx(GK, {}),
31243
- /* @__PURE__ */ d.jsx(EK, {})
31244
- ] }) : /* @__PURE__ */ d.jsx(d.Fragment, {});
31189
+ return d.jsx("div", { className: "w-full p-6 flex justify-center items-center", children: c[t] && c[t].children && c[t].children });
31190
+ }, XK = ({ steps: c }) => c ? d.jsxs($g, { steppers: c, children: [d.jsx(ZK, {}), d.jsx(GK, {}), d.jsx(EK, {})] }) : d.jsx(d.Fragment, {});
31245
31191
  export {
31246
31192
  XK as MultiStepper
31247
31193
  };
package/package.json CHANGED
@@ -3,7 +3,8 @@
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.0.1",
6
+ "files": ["dist"],
7
+ "version": "1.0.2",
7
8
  "type": "module",
8
9
  "exports": {
9
10
  ".": {
package/eslint.config.js DELETED
@@ -1,23 +0,0 @@
1
- import js from '@eslint/js'
2
- import globals from 'globals'
3
- import reactHooks from 'eslint-plugin-react-hooks'
4
- import reactRefresh from 'eslint-plugin-react-refresh'
5
- import tseslint from 'typescript-eslint'
6
- import { globalIgnores } from 'eslint/config'
7
-
8
- export default tseslint.config([
9
- globalIgnores(['dist']),
10
- {
11
- files: ['**/*.{ts,tsx}'],
12
- extends: [
13
- js.configs.recommended,
14
- tseslint.configs.recommended,
15
- reactHooks.configs['recommended-latest'],
16
- reactRefresh.configs.vite,
17
- ],
18
- languageOptions: {
19
- ecmaVersion: 2020,
20
- globals: globals.browser,
21
- },
22
- },
23
- ])
package/index.html DELETED
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite + React + TS</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
12
- </body>
13
- </html>
package/tsconfig.app.json DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
- "target": "ES2022",
5
- "useDefineForClassFields": true,
6
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
- "module": "ESNext",
8
- "skipLibCheck": true,
9
-
10
- /* Bundler mode */
11
- "moduleResolution": "bundler",
12
- "allowImportingTsExtensions": true,
13
- "verbatimModuleSyntax": true,
14
- "moduleDetection": "force",
15
- "noEmit": true,
16
- "jsx": "react-jsx",
17
-
18
- /* Linting */
19
- "strict": true,
20
- "noUnusedLocals": true,
21
- "noUnusedParameters": true,
22
- "erasableSyntaxOnly": true,
23
- "noFallthroughCasesInSwitch": true,
24
- "noUncheckedSideEffectImports": true
25
- },
26
- "include": ["src"]
27
- }
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
- "target": "ES2023",
5
- "lib": ["ES2023"],
6
- "module": "ESNext",
7
- "skipLibCheck": true,
8
-
9
- /* Bundler mode */
10
- "moduleResolution": "bundler",
11
- "allowImportingTsExtensions": true,
12
- "verbatimModuleSyntax": true,
13
- "moduleDetection": "force",
14
- "noEmit": true,
15
-
16
- /* Linting */
17
- "strict": true,
18
- "noUnusedLocals": true,
19
- "noUnusedParameters": true,
20
- "erasableSyntaxOnly": true,
21
- "noFallthroughCasesInSwitch": true,
22
- "noUncheckedSideEffectImports": true
23
- },
24
- "include": ["vite.config.ts"]
25
- }
package/vite.config.ts DELETED
@@ -1,32 +0,0 @@
1
- import { defineConfig } from 'vite'
2
- import react from '@vitejs/plugin-react-swc'
3
- import tailwindcss from '@tailwindcss/vite'
4
- import dts from 'vite-plugin-dts';
5
- import * as path from "path";
6
- // https://vite.dev/config/
7
- export default defineConfig({
8
- plugins: [react(),tailwindcss(),dts({
9
- insertTypesEntry: true,
10
- }),],
11
- resolve: {
12
- alias: [
13
- { find: "@", replacement: path.resolve(__dirname, "./src") },
14
- ],
15
- },
16
- build: {
17
- lib: {
18
- entry: path.resolve(__dirname, 'src/index.tsx'),
19
- name: 'MultiStepper',
20
- fileName: (format) => `multi-stepper.${format}.js`,
21
- },
22
- rollupOptions: {
23
- external: ['react', 'react-dom'],
24
- output: {
25
- globals: {
26
- react: 'React',
27
- 'react-dom': 'ReactDOM',
28
- },
29
- },
30
- },
31
- },
32
- })