bonkers-ui 2.0.12 → 2.0.13

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.
@@ -0,0 +1,139 @@
1
+ import { jsx as v, jsxs as O } from "react/jsx-runtime";
2
+ import d, { createContext as j, useRef as g, useState as m, useEffect as b, useCallback as U, useContext as D } from "react";
3
+ import V from "classnames";
4
+ import './assets/UiNavigationSteps.css';const F = "_navbar_10z8q_1", T = "_navbarProgress_10z8q_17", C = {
5
+ navbar: F,
6
+ navbarProgress: T
7
+ }, x = j(null), J = ({ initialStepId: o, children: E, className: P, complete: p = !1 }) => {
8
+ const h = g(0), a = g(null), [z, N] = m(0), [l, u] = m(/* @__PURE__ */ new Set()), [R, S] = m(0), n = g({
9
+ steps: /* @__PURE__ */ new Map(),
10
+ parentMap: /* @__PURE__ */ new Map()
11
+ }), y = (e, s) => {
12
+ n.current.steps.has(e) || (h.current += 1, n.current.steps.set(e, {
13
+ order: h.current,
14
+ hasSubsteps: s,
15
+ progress: s ? {
16
+ current: 0,
17
+ total: 0
18
+ } : void 0
19
+ }));
20
+ }, w = (e) => {
21
+ const { steps: s, parentMap: t } = n.current;
22
+ let r = null;
23
+ if (s.has(e))
24
+ r = s.get(e).order;
25
+ else if (t.has(e)) {
26
+ const c = t.get(e);
27
+ s.has(c) && (r = s.get(c).order);
28
+ }
29
+ r !== null && (r < z && q(r), A(r), N(r));
30
+ }, M = (e, s, t = []) => {
31
+ if (t.length > 0) {
32
+ t.forEach((i) => {
33
+ n.current.parentMap.set(i.id, e);
34
+ });
35
+ const r = t.findIndex((i) => i.id === s) + 1, c = t.length;
36
+ if (r > 0) {
37
+ const i = n.current.steps.get(e);
38
+ i && n.current.steps.set(e, {
39
+ ...i,
40
+ progress: {
41
+ current: r,
42
+ total: c
43
+ }
44
+ });
45
+ }
46
+ }
47
+ }, q = (e) => {
48
+ u((s) => {
49
+ const t = new Set(s);
50
+ return n.current.steps.forEach((r, c) => {
51
+ r.order > e && t.delete(c);
52
+ }), t;
53
+ });
54
+ }, A = (e) => {
55
+ u(p ? new Set(n.current.steps.keys()) : (s) => {
56
+ const t = new Set(s);
57
+ return n.current.steps.forEach((r, c) => {
58
+ r.order < e ? t.add(c) : r.order === e && t.delete(c);
59
+ }), t;
60
+ });
61
+ };
62
+ b(() => {
63
+ const { steps: e, parentMap: s } = n.current;
64
+ if (e.size > 0) {
65
+ let t = o;
66
+ if (s.has(o)) {
67
+ const r = s.get(o);
68
+ r && e.has(r) && (t = r);
69
+ }
70
+ u(p ? new Set(e.keys()) : /* @__PURE__ */ new Set()), e.has(t) && w(t);
71
+ }
72
+ }, [o, p]);
73
+ const _ = {
74
+ currentStepId: o,
75
+ registerStep: y,
76
+ navigateToStep: w,
77
+ updateSubstepProgress: M,
78
+ completedSteps: l
79
+ }, k = (e) => e === o || n.current.parentMap.get(o) === e, B = (e) => l.has(e), W = d.Children.map(E, (e, s) => {
80
+ if (d.isValidElement(e)) {
81
+ const t = n.current.steps.get(e.props.id), r = n.current.steps.size;
82
+ return d.cloneElement(e, {
83
+ order: t?.order || s + 1,
84
+ totalSteps: r,
85
+ isActive: k(e.props.id),
86
+ isComplete: B(e.props.id)
87
+ });
88
+ }
89
+ return e;
90
+ }), f = U(() => {
91
+ if (!a.current) return;
92
+ const e = a.current.querySelector('[aria-current="step"]');
93
+ if (!e) return S(0);
94
+ const s = e.getBoundingClientRect(), t = a.current.getBoundingClientRect(), r = s.left - t.left + s.width / 2;
95
+ S(r);
96
+ }, []);
97
+ return b(() => {
98
+ if (!a.current) return;
99
+ const e = new ResizeObserver(() => {
100
+ requestAnimationFrame(f);
101
+ });
102
+ return e.observe(a.current), a.current.querySelectorAll('[role="listitem"]').forEach((t) => {
103
+ e.observe(t);
104
+ }), f(), () => {
105
+ e.disconnect();
106
+ };
107
+ }, [f, o]), /* @__PURE__ */ v(x.Provider, { value: _, children: /* @__PURE__ */ O(
108
+ "nav",
109
+ {
110
+ "aria-label": "Progress",
111
+ className: V("relative grid grid-cols-1 grid-rows-1 items-center", C.navbar, P),
112
+ "data-status": l.size === n.current.steps.size ? "complete" : void 0,
113
+ ref: a,
114
+ children: [
115
+ /* @__PURE__ */ v("div", { className: C.navbarProgress, style: {
116
+ width: `${R}px`
117
+ } }),
118
+ /* @__PURE__ */ v(
119
+ "div",
120
+ {
121
+ className: "z-10 flex items-center justify-between",
122
+ children: W
123
+ }
124
+ )
125
+ ]
126
+ }
127
+ ) });
128
+ }, K = () => {
129
+ const o = D(x);
130
+ if (!o)
131
+ throw new Error("useStepNav must be used within a UiNavigationStepsProvider");
132
+ return o;
133
+ };
134
+ export {
135
+ J as U,
136
+ C as s,
137
+ K as u
138
+ };
139
+ //# sourceMappingURL=UiNavigationSteps-Daqd0O2G.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UiNavigationSteps-Daqd0O2G.js","sources":["../src/components/UiNavigationSteps/UiNavigationSteps.tsx"],"sourcesContent":["import React, {\n\tcreateContext,\n\tuseContext,\n\tuseState,\n\tuseRef,\n\tuseEffect, useCallback,\n} from \"react\";\nimport { type INavStepProps, type INavigationStepContext, type INavSubStep } from \"./_types\";\nimport cx from \"classnames\";\nimport styles from \"./UiNavigationSteps.module.css\";\n\nconst NavigationStepContext = createContext<INavigationStepContext | null>(null);\n\ninterface INavigationStepData {\n\torder: number;\n\thasSubsteps: boolean;\n\tprogress?: {\n\t\tcurrent: number;\n\t\ttotal: number;\n\t};\n}\n\ninterface INavigationProviderState {\n\tsteps: Map<string, INavigationStepData>;\n\tparentMap: Map<string, string>;\n}\n\nexport const UiNavigationSteps: React.FC<{\n\tinitialStepId: string;\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\tcomplete?: boolean\n}> = ({ initialStepId, children, className, complete = false }) => {\n\tconst orderCounter = useRef(0);\n\tconst navRef = useRef<HTMLDivElement>(null);\n\tconst [currentStepOrder, setCurrentStepOrder] = useState<number>(0);\n\tconst [completedSteps, setCompletedSteps] = useState<Set<string>>(new Set());\n\tconst [activeBarWidth, setActiveBarWidth] = useState<number>(0);\n\n\tconst navigationState = useRef<INavigationProviderState>({\n\t\tsteps: new Map(),\n\t\tparentMap: new Map(),\n\t});\n\n\tconst registerStep = (id: string, hasSubsteps: boolean) => {\n\t\tif (!navigationState.current.steps.has(id)) {\n\t\t\torderCounter.current += 1;\n\t\t\tnavigationState.current.steps.set(id, {\n\t\t\t\torder: orderCounter.current,\n\t\t\t\thasSubsteps,\n\t\t\t\tprogress: hasSubsteps\n\t\t\t\t\t? {\n\t\t\t\t\t\tcurrent: 0,\n\t\t\t\t\t\ttotal: 0\n\t\t\t\t\t}\n\t\t\t\t\t: undefined\n\t\t\t});\n\t\t}\n\t};\n\n\tconst navigateToStep = (id: string) => {\n\t\tconst { steps, parentMap } = navigationState.current;\n\t\tlet targetOrder: number | null = null;\n\n\t\tif (steps.has(id)) {\n\t\t\ttargetOrder = steps.get(id)!.order;\n\t\t} else if (parentMap.has(id)) {\n\t\t\tconst parentId = parentMap.get(id)!;\n\t\t\tif (steps.has(parentId)) {\n\t\t\t\ttargetOrder = steps.get(parentId)!.order;\n\t\t\t}\n\t\t}\n\n\t\tif (targetOrder !== null) {\n\t\t\tif (targetOrder < currentStepOrder) {\n\t\t\t\tmarkSubsequentStepsIncomplete(targetOrder);\n\t\t\t}\n\t\t\tmarkPreviousStepsComplete(targetOrder);\n\t\t\tsetCurrentStepOrder(targetOrder);\n\t\t}\n\t};\n\n\tconst updateSubstepProgress = (stepId: string, substepId: string, subSteps: INavSubStep[] = []) => {\n\t\tif (subSteps.length > 0) {\n\t\t\tsubSteps.forEach(sub => {\n\t\t\t\tnavigationState.current.parentMap.set(sub.id, stepId);\n\t\t\t});\n\n\t\t\tconst current = subSteps.findIndex(sub => sub.id === substepId) + 1;\n\t\t\tconst total = subSteps.length;\n\n\t\t\tif (current > 0) {\n\t\t\t\tconst stepData = navigationState.current.steps.get(stepId);\n\t\t\t\tif (stepData) {\n\t\t\t\t\tnavigationState.current.steps.set(stepId, {\n\t\t\t\t\t\t...stepData,\n\t\t\t\t\t\tprogress: {\n\t\t\t\t\t\t\tcurrent,\n\t\t\t\t\t\t\ttotal\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tconst markSubsequentStepsIncomplete = (targetOrder: number) => {\n\t\tsetCompletedSteps(prev => {\n\t\t\tconst newSet = new Set(prev);\n\t\t\tnavigationState.current.steps.forEach((data, id) => {\n\t\t\t\tif (data.order > targetOrder) {\n\t\t\t\t\tnewSet.delete(id);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn newSet;\n\t\t});\n\t};\n\n\tconst markPreviousStepsComplete = (targetOrder: number) => {\n\t\tif (!complete) {\n\t\t\tsetCompletedSteps(prev => {\n\t\t\t\tconst newSet = new Set(prev);\n\t\t\t\tnavigationState.current.steps.forEach((data, id) => {\n\t\t\t\t\tif (data.order < targetOrder) {\n\t\t\t\t\t\tnewSet.add(id);\n\t\t\t\t\t} else if (data.order === targetOrder) {\n\t\t\t\t\t\tnewSet.delete(id);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn newSet;\n\t\t\t});\n\t\t} else {\n\t\t\tsetCompletedSteps(new Set(navigationState.current.steps.keys()));\n\t\t}\n\t};\n\n\tuseEffect(() => {\n\t\tconst { steps, parentMap } = navigationState.current;\n\n\t\tif (steps.size > 0) {\n\t\t\tlet targetStepId = initialStepId;\n\n\t\t\tif (parentMap.has(initialStepId)) {\n\t\t\t\tconst parentId = parentMap.get(initialStepId);\n\t\t\t\tif (parentId && steps.has(parentId)) {\n\t\t\t\t\ttargetStepId = parentId;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (complete) {\n\t\t\t\tsetCompletedSteps(new Set(steps.keys()));\n\t\t\t} else {\n\t\t\t\tsetCompletedSteps(new Set());\n\t\t\t}\n\n\t\t\tif (steps.has(targetStepId)) {\n\t\t\t\tnavigateToStep(targetStepId);\n\t\t\t}\n\t\t}\n\t}, [initialStepId, complete]);\n\n\tconst contextValue: INavigationStepContext = {\n\t\tcurrentStepId: initialStepId,\n\t\tregisterStep,\n\t\tnavigateToStep,\n\t\tupdateSubstepProgress,\n\t\tcompletedSteps,\n\t};\n\n\tconst isStepActive = (id: string) => {\n\t\treturn id === initialStepId\n\t\t\t|| navigationState.current.parentMap.get(initialStepId) === id;\n\t};\n\n\tconst isStepComplete = (id: string) => {\n\t\treturn completedSteps.has(id);\n\t};\n\n\tconst childWithProps = React.Children.map(children, (child, index) => {\n\t\tif (React.isValidElement<INavStepProps>(child)) {\n\t\t\tconst stepData = navigationState.current.steps.get(child.props.id);\n\t\t\tconst totalSteps = navigationState.current.steps.size;\n\n\t\t\treturn React.cloneElement(child, {\n\t\t\t\torder: stepData?.order || index + 1,\n\t\t\t\ttotalSteps,\n\t\t\t\tisActive: isStepActive(child.props.id),\n\t\t\t\tisComplete: isStepComplete(child.props.id)\n\t\t\t});\n\t\t}\n\t\treturn child;\n\t});\n\n\tconst updateActiveBarWidth = useCallback(() => {\n\t\tif (!navRef.current) return;\n\n\t\tconst activeStep = navRef.current.querySelector(`[aria-current=\"step\"]`);\n\t\tif (!activeStep) return setActiveBarWidth(0);\n\n\t\tconst stepRect = activeStep.getBoundingClientRect();\n\t\tconst containerRect = navRef.current.getBoundingClientRect();\n\t\tconst newWidth = (stepRect.left - containerRect.left) + (stepRect.width / 2);\n\n\t\tsetActiveBarWidth(newWidth);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!navRef.current) return;\n\n\t\tconst resizeObserver = new ResizeObserver(() => {\n\t\t\trequestAnimationFrame(updateActiveBarWidth);\n\t\t});\n\n\t\tresizeObserver.observe(navRef.current);\n\t\tconst stepElements = navRef.current.querySelectorAll('[role=\"listitem\"]');\n\t\tstepElements.forEach(step => {\n\t\t\tresizeObserver.observe(step);\n\t\t});\n\n\t\tupdateActiveBarWidth();\n\n\t\treturn () => {\n\t\t\tresizeObserver.disconnect();\n\t\t};\n\t}, [updateActiveBarWidth, initialStepId]);\n\n\treturn (\n\t\t<NavigationStepContext.Provider value={ contextValue }>\n\t\t\t<nav\n\t\t\t\taria-label=\"Progress\"\n\t\t\t\tclassName={ cx(\"relative grid grid-cols-1 grid-rows-1 items-center\", styles.navbar, className) }\n\t\t\t\tdata-status={\n\t\t\t\t\tcompletedSteps.size === navigationState.current.steps.size\n\t\t\t\t\t\t? \"complete\"\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tref={ navRef }\n\t\t\t>\n\t\t\t\t<div className={ styles.navbarProgress } style={ {\n\t\t\t\t\twidth: `${activeBarWidth}px`,\n\t\t\t\t} } />\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"z-10 flex items-center justify-between\"\n\t\t\t\t>\n\t\t\t\t\t{ childWithProps }\n\t\t\t\t</div>\n\t\t\t</nav>\n\t\t</NavigationStepContext.Provider>\n\t);\n};\n\nexport const useStepNav = () => {\n\tconst context = useContext(NavigationStepContext);\n\tif (!context) {\n\t\tthrow new Error(\"useStepNav must be used within a UiNavigationStepsProvider\");\n\t}\n\treturn context;\n};\n"],"names":["NavigationStepContext","createContext","UiNavigationSteps","initialStepId","children","className","complete","orderCounter","useRef","navRef","currentStepOrder","setCurrentStepOrder","useState","completedSteps","setCompletedSteps","activeBarWidth","setActiveBarWidth","navigationState","registerStep","id","hasSubsteps","navigateToStep","steps","parentMap","targetOrder","parentId","markSubsequentStepsIncomplete","markPreviousStepsComplete","updateSubstepProgress","stepId","substepId","subSteps","sub","current","total","stepData","prev","newSet","data","useEffect","targetStepId","contextValue","isStepActive","isStepComplete","childWithProps","React","child","index","totalSteps","updateActiveBarWidth","useCallback","activeStep","stepRect","containerRect","newWidth","resizeObserver","step","jsx","jsxs","cx","styles","useStepNav","context","useContext"],"mappings":";;;;;;GAWMA,IAAwBC,EAA6C,IAAI,GAgBlEC,IAKR,CAAC,EAAE,eAAAC,GAAe,UAAAC,GAAU,WAAAC,GAAW,UAAAC,IAAW,SAAY;AAClE,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ioi_1{--step-width: 0%}._navbar_1aioi_5:before{content:"";position:absolute;left:0;right:0;height:1px;top:16px;background-color:var(--color-secondary-alt-500);width:98%}nav[data-status=complete]:before{top:13px;background-color:var(--color-secondary-400)}@media (min-width: 768px){._navbar_1aioi_5:before,nav[data-status=complete]:before{top:20px}}._active_1aioi_1:before{content:"";position:absolute;left:0;right:0;height:1px;top:16px;background-color:var(--color-secondary-400);width:var(--step-width, 0%);z-index:-1}@media screen and (min-width: 768px){._active_1aioi_1:before{top:20px}}
1
+ ._navbar_10z8q_1:before{content:"";position:absolute;left:0;right:0;height:1px;top:16px;background-color:var(--color-secondary-alt-500);width:98%}nav[data-status=complete]:before{top:13px;background-color:var(--color-secondary-400)}nav[data-status=complete] ._navbarProgress_10z8q_17{display:none}@media (min-width: 768px){._navbar_10z8q_1:before,nav[data-status=complete]:before{top:20px}}._navbarProgress_10z8q_17{position:absolute;left:0;right:0;height:1px;top:16px;background-color:var(--color-secondary-400);z-index:1}@media screen and (min-width: 768px){._navbarProgress_10z8q_17{top:20px}}
@@ -1,12 +1,12 @@
1
- import { jsx as m, jsxs as g } from "react/jsx-runtime";
2
- import { useEffect as S, useRef as W } from "react";
3
- import i from "classnames";
1
+ import { jsx as x, jsxs as g } from "react/jsx-runtime";
2
+ import { useEffect as b } from "react";
3
+ import n from "classnames";
4
4
  import { ENavStepStatus as e } from "./_types.js";
5
5
  import { UiTypography as E } from "../UiTypography/UiTypography.js";
6
- import { ETypographySizes as I, ETextWeight as u } from "../UiTypography/_types.js";
7
- import { u as z, s as L } from "../../UiNavigationSteps-D4QC-7s-.js";
8
- function M(r, o) {
9
- return i(
6
+ import { ETypographySizes as h, ETextWeight as I } from "../UiTypography/_types.js";
7
+ import { u as v, s as w } from "../../UiNavigationSteps-Daqd0O2G.js";
8
+ function S(s, o) {
9
+ return n(
10
10
  `
11
11
  flex
12
12
  transform
@@ -23,82 +23,74 @@ function M(r, o) {
23
23
  `,
24
24
  !o && "bg-secondary-400",
25
25
  o && "cursor-pointer",
26
- r === e.COMPLETE && "size-sm border-secondary-400 bg-secondary-400 p-xs text-white",
27
- r === e.ACTIVE && "border-secondary-400 bg-secondary-alt-200 px-xs py-xxs text-secondary-400",
28
- r === e.INACTIVE && "size-sm border-secondary-alt-500 bg-white p-xs text-secondary-alt-500"
26
+ s === e.COMPLETE && "size-sm border-secondary-400 bg-secondary-400 p-xs text-white",
27
+ s === e.ACTIVE && "border-secondary-400 bg-secondary-alt-200 px-xs py-xxs text-secondary-400",
28
+ s === e.INACTIVE && "size-sm border-secondary-alt-500 bg-white p-xs text-secondary-alt-500"
29
29
  );
30
30
  }
31
- const G = ({
32
- id: r,
31
+ const U = ({
32
+ id: s,
33
33
  name: o,
34
- subSteps: s = [],
34
+ subSteps: t = [],
35
35
  className: T = "",
36
36
  onClick: y,
37
- order: d = 1,
38
- totalSteps: C = 1,
39
- isActive: A = !1,
40
- isComplete: l = !1,
41
- icon: N
37
+ order: m = 1,
38
+ isActive: C = !1,
39
+ isComplete: c = !1,
40
+ icon: u
42
41
  }) => {
43
- const { currentStepId: a, updateSubstepProgress: p, registerStep: V } = z(), f = s.some((n) => n.id === a), c = s.length > 0;
44
- S(() => {
45
- V(r, c), c && p(r, a, s);
46
- }, [r, c, s, a, p]);
47
- const t = !l && (A || f) ? e.ACTIVE : l ? e.COMPLETE : e.INACTIVE, w = () => {
48
- t !== e.INACTIVE && y?.();
49
- }, h = W(null), $ = (n) => {
50
- const v = n / window.innerWidth * 100;
51
- return `${d / C * 100 - v / 2}%`;
52
- }, x = t !== e.INACTIVE, b = c ? l ? ` ${s.length}/${s.length}` : f ? ` ${s.findIndex((n) => n.id === a) + 1}/${s.length}` : ` ${d}/${s.length}` : null;
53
- return /* @__PURE__ */ m(
42
+ const { currentStepId: a, updateSubstepProgress: p, registerStep: A } = v(), f = t.some((l) => l.id === a), i = t.length > 0;
43
+ b(() => {
44
+ A(s, i), i && p(s, a, t);
45
+ }, [s, i, t, a, p]);
46
+ const r = !c && (C || f) ? e.ACTIVE : c ? e.COMPLETE : e.INACTIVE, N = () => {
47
+ r !== e.INACTIVE && y?.();
48
+ }, d = r !== e.INACTIVE, V = i ? c ? ` ${t.length}/${t.length}` : f ? ` ${t.findIndex((l) => l.id === a) + 1}/${t.length}` : ` ${m}/${t.length}` : null;
49
+ return /* @__PURE__ */ x(
54
50
  "div",
55
51
  {
56
- style: t === e.ACTIVE ? {
57
- "--step-width": `${$(h.current?.clientWidth ?? 0)}`
58
- } : {},
59
- className: i(
52
+ className: n(
60
53
  "flex flex-col gap-xxs md:flex-row md:items-center",
61
54
  {
62
- [L.active]: t === e.ACTIVE
55
+ [w.active]: r === e.ACTIVE
63
56
  }
64
57
  ),
65
- ref: h,
66
- children: /* @__PURE__ */ m(
58
+ children: /* @__PURE__ */ x(
67
59
  "button",
68
60
  {
69
- onClick: w,
70
- "aria-current": t === e.ACTIVE ? "step" : void 0,
71
- "aria-disabled": !x,
72
- disabled: !x,
73
- className: i(M(t, x), T),
61
+ onClick: N,
62
+ "aria-current": r === e.ACTIVE ? "step" : void 0,
63
+ "aria-disabled": !d,
64
+ disabled: !d,
65
+ className: n(S(r, d), T),
74
66
  children: /* @__PURE__ */ g(
75
67
  E,
76
68
  {
77
69
  className: "flex place-items-center gap-xxs",
78
- weight: t === e.ACTIVE ? u.SEMI_BOLD : u.REGULAR,
70
+ weight: r === e.ACTIVE ? I.SEMI_BOLD : I.REGULAR,
79
71
  lineHeight: !0,
80
- size: I.XS,
72
+ size: h.XS,
81
73
  children: [
82
- t === e.COMPLETE ? N : /* @__PURE__ */ m(
74
+ r === e.COMPLETE ? u : /* @__PURE__ */ x(
83
75
  E,
84
76
  {
85
- className: i({
86
- "font-semibold md:font-medium": t === e.INACTIVE
77
+ className: n({
78
+ "font-semibold md:font-medium": r === e.INACTIVE
87
79
  }),
88
80
  tag: "span",
89
- size: I.SM,
90
- children: d
81
+ size: h.SM,
82
+ children: m
91
83
  }
92
84
  ),
93
85
  /* @__PURE__ */ g(
94
86
  "span",
95
87
  {
96
- className: i("text-xxs text-nowrap md:text-xs", {
97
- "hidden md:inline": t !== e.ACTIVE
88
+ className: n("text-xxs text-nowrap md:text-xs", {
89
+ "hidden md:inline": r !== e.ACTIVE
98
90
  }),
99
91
  children: [
100
92
  o,
101
- b
93
+ V
102
94
  ]
103
95
  }
104
96
  )
@@ -111,6 +103,6 @@ const G = ({
111
103
  );
112
104
  };
113
105
  export {
114
- G as UiNavigationStep
106
+ U as UiNavigationStep
115
107
  };
116
108
  //# sourceMappingURL=UiNavigationStep.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UiNavigationStep.js","sources":["../../../src/components/UiNavigationSteps/UiNavigationStep.tsx"],"sourcesContent":["import React, { useEffect, useRef } from \"react\";\nimport cx from \"classnames\";\nimport { ENavStepStatus, type INavStepProps } from \"./_types\";\nimport { ETextWeight, ETypographySizes, UiTypography } from \"../UiTypography\";\nimport { useStepNav } from \"./UiNavigationSteps\";\nimport styles from \"./UiNavigationSteps.module.css\";\n\nfunction getStepClasses(status: ENavStepStatus, isClickable: boolean) {\n\treturn cx(\n\t\t`\n\t\t\tflex\n\t\t\ttransform\n\t\t\titems-center\n\t\t\tjustify-center\n\t\t\trounded-full\n\t\t\tborder\n\t\t\ttext-secondary-400\n\t\t\tmd:h-xl\n\t\t\tmd:w-full\n\t\t\tmd:px-xs\n\t\t\tmd:py-xxs\n\t\t\tlg:px-sm\n\t\t`,\n\t\t!isClickable && \"bg-secondary-400\",\n\t\tisClickable && \"cursor-pointer\",\n\t\tstatus === ENavStepStatus.COMPLETE\n\t\t&& \"size-sm border-secondary-400 bg-secondary-400 p-xs text-white\",\n\t\tstatus === ENavStepStatus.ACTIVE\n\t\t&& \"border-secondary-400 bg-secondary-alt-200 px-xs py-xxs text-secondary-400\",\n\t\tstatus === ENavStepStatus.INACTIVE\n\t\t&& \"size-sm border-secondary-alt-500 bg-white p-xs text-secondary-alt-500\",\n\t);\n}\n\nexport const UiNavigationStep: React.FC<INavStepProps> = ({\n\tid,\n\tname,\n\tsubSteps = [],\n\tclassName = \"\",\n\tonClick,\n\torder = 1,\n\ttotalSteps = 1,\n\tisActive = false,\n\tisComplete = false,\n\ticon\n}) => {\n\tconst { currentStepId, updateSubstepProgress, registerStep } = useStepNav();\n\tconst isSubstepActive = subSteps.some((subStep) => subStep.id === currentStepId);\n\tconst hasSubsteps = subSteps.length > 0;\n\n\tuseEffect(() => {\n\t\tregisterStep(id, hasSubsteps);\n\n\t\tif (hasSubsteps) {\n\t\t\tupdateSubstepProgress(id, currentStepId, subSteps);\n\t\t}\n\t}, [id, hasSubsteps, subSteps, currentStepId, updateSubstepProgress]);\n\n\tconst status = !isComplete && (isActive || isSubstepActive)\n\t\t? ENavStepStatus.ACTIVE\n\t\t: isComplete\n\t\t\t? ENavStepStatus.COMPLETE\n\t\t\t: ENavStepStatus.INACTIVE;\n\n\tconst handleClick = () => {\n\t\tif (status !== ENavStepStatus.INACTIVE) {\n\t\t\tonClick?.();\n\t\t}\n\t};\n\n\tconst currentStepWidthRef = useRef<HTMLDivElement>(null);\n\n\tconst calculateWidth = (currentStepWidth: number) => {\n\t\tconst stepWidthPercentage = (currentStepWidth / window.innerWidth) * 100;\n\t\tconst position = (order / totalSteps) * 100;\n\n\t\treturn `${position - stepWidthPercentage / 2}%`;\n\t};\n\n\tconst isClickable = status !== ENavStepStatus.INACTIVE;\n\n\tconst progressText = hasSubsteps\n\t\t? isComplete\n\t\t\t? ` ${subSteps.length}/${subSteps.length}`\n\t\t\t: isSubstepActive\n\t\t\t\t? ` ${subSteps.findIndex((step) => step.id === currentStepId) + 1}/${subSteps.length}`\n\t\t\t\t: ` ${order}/${subSteps.length}`\n\t\t: null;\n\n\treturn (\n\t\t<div\n\t\t\tstyle={ status === ENavStepStatus.ACTIVE\n\t\t\t\t? ({\n\t\t\t\t\t\"--step-width\": `${calculateWidth(currentStepWidthRef.current?.clientWidth ?? 0)}`\n\t\t\t\t} as React.CSSProperties)\n\t\t\t\t: {} }\n\t\t\tclassName={ cx(\"flex flex-col gap-xxs md:flex-row md:items-center\", {\n\t\t\t\t[styles.active]: status === ENavStepStatus.ACTIVE,\n\t\t\t},\n\t\t\t) }\n\t\t\tref={ currentStepWidthRef }\n\t\t>\n\t\t\t<button\n\t\t\t\tonClick={ handleClick }\n\t\t\t\taria-current={ status === ENavStepStatus.ACTIVE\n\t\t\t\t\t? \"step\"\n\t\t\t\t\t: undefined }\n\t\t\t\taria-disabled={ !isClickable }\n\t\t\t\tdisabled={ !isClickable }\n\t\t\t\tclassName={ cx(getStepClasses(status, isClickable), className) }\n\t\t\t>\n\t\t\t\t<UiTypography\n\t\t\t\t\tclassName=\"flex place-items-center gap-xxs\"\n\t\t\t\t\tweight={ status === ENavStepStatus.ACTIVE\n\t\t\t\t\t\t? ETextWeight.SEMI_BOLD\n\t\t\t\t\t\t: ETextWeight.REGULAR }\n\t\t\t\t\tlineHeight\n\t\t\t\t\tsize={ ETypographySizes.XS }\n\t\t\t\t>\n\t\t\t\t\t{ status === ENavStepStatus.COMPLETE\n\t\t\t\t\t\t? icon\n\t\t\t\t\t\t: (\n\t\t\t\t\t\t\t<UiTypography\n\t\t\t\t\t\t\t\tclassName={ cx({\n\t\t\t\t\t\t\t\t\t\"font-semibold md:font-medium\": status === ENavStepStatus.INACTIVE,\n\t\t\t\t\t\t\t\t}) }\n\t\t\t\t\t\t\t\ttag=\"span\"\n\t\t\t\t\t\t\t\tsize={ ETypographySizes.SM }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ order }\n\t\t\t\t\t\t\t</UiTypography>\n\t\t\t\t\t\t) }\n\t\t\t\t\t{\n\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={ cx(\"text-xxs text-nowrap md:text-xs\", {\n\t\t\t\t\t\t\t\t\"hidden md:inline\": status !== ENavStepStatus.ACTIVE,\n\t\t\t\t\t\t\t}) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ name }\n\t\t\t\t\t\t\t{ progressText }\n\t\t\t\t\t\t</span>\n\n\t\t\t\t\t}\n\t\t\t\t</UiTypography>\n\n\t\t\t</button>\n\t\t</div>\n\t);\n};\n"],"names":["getStepClasses","status","isClickable","cx","ENavStepStatus","UiNavigationStep","id","name","subSteps","className","onClick","order","totalSteps","isActive","isComplete","icon","currentStepId","updateSubstepProgress","registerStep","useStepNav","isSubstepActive","subStep","hasSubsteps","useEffect","handleClick","currentStepWidthRef","useRef","calculateWidth","currentStepWidth","stepWidthPercentage","progressText","step","jsx","styles","jsxs","UiTypography","ETextWeight","ETypographySizes"],"mappings":";;;;;;;AAOA,SAASA,EAAeC,GAAwBC,GAAsB;AACrE,SAAOC;AAAA,IACN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAcA,CAACD,KAAe;AAAA,IAChBA,KAAe;AAAA,IACfD,MAAWG,EAAe,YACvB;AAAA,IACHH,MAAWG,EAAe,UACvB;AAAA,IACHH,MAAWG,EAAe,YACvB;AAAA,EAAA;AAEL;AAEO,MAAMC,IAA4C,CAAC;AAAA,EACzD,IAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC,IAAW,CAAA;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,SAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,YAAAC,IAAa;AAAA,EACb,MAAAC;AACD,MAAM;AACL,QAAM,EAAE,eAAAC,GAAe,uBAAAC,GAAuB,cAAAC,EAAA,IAAiBC,EAAA,GACzDC,IAAkBZ,EAAS,KAAK,CAACa,MAAYA,EAAQ,OAAOL,CAAa,GACzEM,IAAcd,EAAS,SAAS;AAEtC,EAAAe,EAAU,MAAM;AACf,IAAAL,EAAaZ,GAAIgB,CAAW,GAExBA,KACHL,EAAsBX,GAAIU,GAAeR,CAAQ;AAAA,EAEnD,GAAG,CAACF,GAAIgB,GAAad,G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AAe,SAChCgC,EAAY,YACZA,EAAY;AAAA,cACf,YAAU;AAAA,cACV,MAAOC,EAAiB;AAAA,cAEtB,UAAA;AAAA,gBAAApC,MAAWG,EAAe,WACzBW,IAED,gBAAAiB;AAAA,kBAACG;AAAA,kBAAA;AAAA,oBACA,WAAYhC,EAAG;AAAA,sBACd,gCAAgCF,MAAWG,EAAe;AAAA,oBAAA,CAC1D;AAAA,oBACD,KAAI;AAAA,oBACJ,MAAOiC,EAAiB;AAAA,oBAErB,UAAA1B;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAKL,gBAAAuB;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACA,WAAY/B,EAAG,mCAAmC;AAAA,sBACjD,oBAAoBF,MAAWG,EAAe;AAAA,oBAAA,CAC9C;AAAA,oBAEC,UAAA;AAAA,sBAAAG;AAAA,sBACAuB;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACH;AAAA,YAAA;AAAA,UAAA;AAAA,QAGF;AAAA,MAAA;AAAA,IAED;AAAA,EAAA;AAGH;"}
1
+ {"version":3,"file":"UiNavigationStep.js","sources":["../../../src/components/UiNavigationSteps/UiNavigationStep.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport cx from \"classnames\";\nimport { ENavStepStatus, type INavStepProps } from \"./_types\";\nimport { ETextWeight, ETypographySizes, UiTypography } from \"../UiTypography\";\nimport { useStepNav } from \"./UiNavigationSteps\";\nimport styles from \"./UiNavigationSteps.module.css\";\n\nfunction getStepClasses(status: ENavStepStatus, isClickable: boolean) {\n\treturn cx(\n\t\t`\n\t\t\tflex\n\t\t\ttransform\n\t\t\titems-center\n\t\t\tjustify-center\n\t\t\trounded-full\n\t\t\tborder\n\t\t\ttext-secondary-400\n\t\t\tmd:h-xl\n\t\t\tmd:w-full\n\t\t\tmd:px-xs\n\t\t\tmd:py-xxs\n\t\t\tlg:px-sm\n\t\t`,\n\t\t!isClickable && \"bg-secondary-400\",\n\t\tisClickable && \"cursor-pointer\",\n\t\tstatus === ENavStepStatus.COMPLETE\n\t\t&& \"size-sm border-secondary-400 bg-secondary-400 p-xs text-white\",\n\t\tstatus === ENavStepStatus.ACTIVE\n\t\t&& \"border-secondary-400 bg-secondary-alt-200 px-xs py-xxs text-secondary-400\",\n\t\tstatus === ENavStepStatus.INACTIVE\n\t\t&& \"size-sm border-secondary-alt-500 bg-white p-xs text-secondary-alt-500\",\n\t);\n}\n\nexport const UiNavigationStep: React.FC<INavStepProps> = ({\n\tid,\n\tname,\n\tsubSteps = [],\n\tclassName = \"\",\n\tonClick,\n\torder = 1,\n\tisActive = false,\n\tisComplete = false,\n\ticon\n}) => {\n\tconst { currentStepId, updateSubstepProgress, registerStep } = useStepNav();\n\tconst isSubstepActive = subSteps.some((subStep) => subStep.id === currentStepId);\n\tconst hasSubsteps = subSteps.length > 0;\n\n\tuseEffect(() => {\n\t\tregisterStep(id, hasSubsteps);\n\n\t\tif (hasSubsteps) {\n\t\t\tupdateSubstepProgress(id, currentStepId, subSteps);\n\t\t}\n\t}, [id, hasSubsteps, subSteps, currentStepId, updateSubstepProgress]);\n\n\tconst status = !isComplete && (isActive || isSubstepActive)\n\t\t? ENavStepStatus.ACTIVE\n\t\t: isComplete\n\t\t\t? ENavStepStatus.COMPLETE\n\t\t\t: ENavStepStatus.INACTIVE;\n\n\tconst handleClick = () => {\n\t\tif (status !== ENavStepStatus.INACTIVE) {\n\t\t\tonClick?.();\n\t\t}\n\t};\n\n\tconst isClickable = status !== ENavStepStatus.INACTIVE;\n\n\tconst progressText = hasSubsteps\n\t\t? isComplete\n\t\t\t? ` ${subSteps.length}/${subSteps.length}`\n\t\t\t: isSubstepActive\n\t\t\t\t? ` ${subSteps.findIndex((step) => step.id === currentStepId) + 1}/${subSteps.length}`\n\t\t\t\t: ` ${order}/${subSteps.length}`\n\t\t: null;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ cx(\"flex flex-col gap-xxs md:flex-row md:items-center\", {\n\t\t\t\t[styles.active]: status === ENavStepStatus.ACTIVE,\n\t\t\t},\n\t\t\t) }\n\t\t>\n\t\t\t<button\n\t\t\t\tonClick={ handleClick }\n\t\t\t\taria-current={ status === ENavStepStatus.ACTIVE\n\t\t\t\t\t? \"step\"\n\t\t\t\t\t: undefined }\n\t\t\t\taria-disabled={ !isClickable }\n\t\t\t\tdisabled={ !isClickable }\n\t\t\t\tclassName={ cx(getStepClasses(status, isClickable), className) }\n\t\t\t>\n\t\t\t\t<UiTypography\n\t\t\t\t\tclassName=\"flex place-items-center gap-xxs\"\n\t\t\t\t\tweight={ status === ENavStepStatus.ACTIVE\n\t\t\t\t\t\t? ETextWeight.SEMI_BOLD\n\t\t\t\t\t\t: ETextWeight.REGULAR }\n\t\t\t\t\tlineHeight\n\t\t\t\t\tsize={ ETypographySizes.XS }\n\t\t\t\t>\n\t\t\t\t\t{ status === ENavStepStatus.COMPLETE\n\t\t\t\t\t\t? icon\n\t\t\t\t\t\t: (\n\t\t\t\t\t\t\t<UiTypography\n\t\t\t\t\t\t\t\tclassName={ cx({\n\t\t\t\t\t\t\t\t\t\"font-semibold md:font-medium\": status === ENavStepStatus.INACTIVE,\n\t\t\t\t\t\t\t\t}) }\n\t\t\t\t\t\t\t\ttag=\"span\"\n\t\t\t\t\t\t\t\tsize={ ETypographySizes.SM }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ order }\n\t\t\t\t\t\t\t</UiTypography>\n\t\t\t\t\t\t) }\n\t\t\t\t\t{\n\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={ cx(\"text-xxs text-nowrap md:text-xs\", {\n\t\t\t\t\t\t\t\t\"hidden md:inline\": status !== ENavStepStatus.ACTIVE,\n\t\t\t\t\t\t\t}) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ name }\n\t\t\t\t\t\t\t{ progressText }\n\t\t\t\t\t\t</span>\n\n\t\t\t\t\t}\n\t\t\t\t</UiTypography>\n\n\t\t\t</button>\n\t\t</div>\n\t);\n};\n"],"names":["getStepClasses","status","isClickable","cx","ENavStepStatus","UiNavigationStep","id","name","subSteps","className","onClick","order","isActive","isComplete","icon","currentStepId","updateSubstepProgress","registerStep","useStepNav","isSubstepActive","subStep","hasSubsteps","useEffect","handleClick","progressText","step","jsx","styles","jsxs","UiTypography","ETextWeight","ETypographySizes"],"mappings":";;;;;;;AAOA,SAASA,EAAeC,GAAwBC,GAAsB;AACrE,SAAOC;AAAA,IACN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAcA,CAACD,KAAe;AAAA,IAChBA,KAAe;AAAA,IACfD,MAAWG,EAAe,YACvB;AAAA,IACHH,MAAWG,EAAe,UACvB;AAAA,IACHH,MAAWG,EAAe,YACvB;AAAA,EAAA;AAEL;AAEO,MAAMC,IAA4C,CAAC;AAAA,EACzD,IAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC,IAAW,CAAA;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,SAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC,IAAW;AAAA,EACX,YAAAC,IAAa;AAAA,EACb,MAAAC;AACD,MAAM;AACL,QAAM,EAAE,eAAAC,GAAe,uBAAAC,GAAuB,cAAAC,EAAA,IAAiBC,EAAA,GACzDC,IAAkBX,EAAS,KAAK,CAACY,MAAYA,EAAQ,OAAOL,CAAa,GACzEM,IAAcb,EAAS,SAAS;AAEtC,EAAAc,EAAU,MAAM;AACf,IAAAL,EAAaX,GAAIe,CAAW,GAExBA,KACHL,EAAsBV,GAAIS,GAAeP,CAAQ;AAAA,EAEnD,GAAG,CAACF,GAAIe,GAAab,GAAUO,GAAeC,CAAqB,CAAC;AAEpE,QAAMf,IAAS,CAACY,MAAeD,KAAYO,KACxCf,EAAe,SACfS,IACCT,EAAe,WACfA,EAAe,UAEbmB,IAAc,MAAM;AACzB,IAAItB,MAAWG,EAAe,YAC7BM,IAA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C,UAAA;AAAA,sBAAAG;AAAA,sBACAiB;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACH;AAAA,YAAA;AAAA,UAAA;AAAA,QAGF;AAAA,MAAA;AAAA,IAED;AAAA,EAAA;AAGH;"}
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "classnames";
4
- import { U as r, u as e } from "../../UiNavigationSteps-D4QC-7s-.js";
4
+ import { U as r, u as e } from "../../UiNavigationSteps-Daqd0O2G.js";
5
5
  export {
6
6
  r as UiNavigationSteps,
7
7
  e as useStepNav
@@ -1,4 +1,4 @@
1
- import { U as a } from "../../UiNavigationSteps-D4QC-7s-.js";
1
+ import { U as a } from "../../UiNavigationSteps-Daqd0O2G.js";
2
2
  import { UiNavigationStep as i } from "./UiNavigationStep.js";
3
3
  import { ENavStepStatus as r } from "./_types.js";
4
4
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bonkers-ui",
3
- "version": "v2.0.12",
3
+ "version": "v2.0.13",
4
4
  "type": "module",
5
5
  "description": "Bonkers ui library",
6
6
  "author": "cc6.magister@gmail.com",
@@ -1,117 +0,0 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import l, { createContext as y, useRef as g, useState as m, useEffect as U, useContext as j } from "react";
3
- import A from "classnames";
4
- import './assets/UiNavigationSteps.css';const D = "_active_1aioi_1", O = "_navbar_1aioi_5", R = {
5
- active: D,
6
- navbar: O
7
- }, S = y(null), W = ({ initialStepId: o, children: h, className: w, complete: i = !1 }) => {
8
- const d = g(0), [x, C] = m(0), [u, p] = m(/* @__PURE__ */ new Set()), n = g({
9
- steps: /* @__PURE__ */ new Map(),
10
- parentMap: /* @__PURE__ */ new Map()
11
- }), E = (e, s) => {
12
- n.current.steps.has(e) || (d.current += 1, n.current.steps.set(e, {
13
- order: d.current,
14
- hasSubsteps: s,
15
- progress: s ? {
16
- current: 0,
17
- total: 0
18
- } : void 0
19
- }));
20
- }, v = (e) => {
21
- const { steps: s, parentMap: r } = n.current;
22
- let t = null;
23
- if (s.has(e))
24
- t = s.get(e).order;
25
- else if (r.has(e)) {
26
- const a = r.get(e);
27
- s.has(a) && (t = s.get(a).order);
28
- }
29
- t !== null && (t < x && N(t), P(t), C(t));
30
- }, M = (e, s, r = []) => {
31
- if (r.length > 0) {
32
- r.forEach((c) => {
33
- n.current.parentMap.set(c.id, e);
34
- });
35
- const t = r.findIndex((c) => c.id === s) + 1, a = r.length;
36
- if (t > 0) {
37
- const c = n.current.steps.get(e);
38
- c && n.current.steps.set(e, {
39
- ...c,
40
- progress: {
41
- current: t,
42
- total: a
43
- }
44
- });
45
- }
46
- }
47
- }, N = (e) => {
48
- p((s) => {
49
- const r = new Set(s);
50
- return n.current.steps.forEach((t, a) => {
51
- t.order > e && r.delete(a);
52
- }), r;
53
- });
54
- }, P = (e) => {
55
- p(i ? new Set(n.current.steps.keys()) : (s) => {
56
- const r = new Set(s);
57
- return n.current.steps.forEach((t, a) => {
58
- t.order < e ? r.add(a) : t.order === e && r.delete(a);
59
- }), r;
60
- });
61
- };
62
- U(() => {
63
- const { steps: e, parentMap: s } = n.current;
64
- if (e.size > 0) {
65
- let r = o;
66
- if (s.has(o)) {
67
- const t = s.get(o);
68
- t && e.has(t) && (r = t);
69
- }
70
- p(i ? new Set(e.keys()) : /* @__PURE__ */ new Set()), e.has(r) && v(r);
71
- }
72
- }, [o, i]);
73
- const _ = {
74
- currentStepId: o,
75
- registerStep: E,
76
- navigateToStep: v,
77
- updateSubstepProgress: M,
78
- completedSteps: u
79
- }, b = (e) => e === o || n.current.parentMap.get(o) === e, z = (e) => u.has(e), k = l.Children.map(h, (e, s) => {
80
- if (l.isValidElement(e)) {
81
- const r = n.current.steps.get(e.props.id), t = n.current.steps.size;
82
- return l.cloneElement(e, {
83
- order: r?.order || s + 1,
84
- totalSteps: t,
85
- isActive: b(e.props.id),
86
- isComplete: z(e.props.id)
87
- });
88
- }
89
- return e;
90
- });
91
- return /* @__PURE__ */ f(S.Provider, { value: _, children: /* @__PURE__ */ f(
92
- "nav",
93
- {
94
- "aria-label": "Progress",
95
- className: A("relative grid grid-cols-1 grid-rows-1 items-center", R.navbar, w),
96
- "data-status": u.size === n.current.steps.size ? "complete" : void 0,
97
- children: /* @__PURE__ */ f(
98
- "div",
99
- {
100
- className: "z-10 flex items-center justify-between",
101
- children: k
102
- }
103
- )
104
- }
105
- ) });
106
- }, B = () => {
107
- const o = j(S);
108
- if (!o)
109
- throw new Error("useStepNav must be used within a UiNavigationStepsProvider");
110
- return o;
111
- };
112
- export {
113
- W as U,
114
- R as s,
115
- B as u
116
- };
117
- //# sourceMappingURL=UiNavigationSteps-D4QC-7s-.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UiNavigationSteps-D4QC-7s-.js","sources":["../src/components/UiNavigationSteps/UiNavigationSteps.tsx"],"sourcesContent":["import React, {\n\tcreateContext,\n\tuseContext,\n\tuseState,\n\tuseRef,\n\tuseEffect,\n} from \"react\";\nimport { type INavStepProps, type INavigationStepContext, type INavSubStep } from \"./_types\";\nimport cx from \"classnames\";\nimport styles from \"./UiNavigationSteps.module.css\";\n\nconst NavigationStepContext = createContext<INavigationStepContext | null>(null);\n\ninterface INavigationStepData {\n\torder: number;\n\thasSubsteps: boolean;\n\tprogress?: {\n\t\tcurrent: number;\n\t\ttotal: number;\n\t};\n}\n\ninterface INavigationProviderState {\n\tsteps: Map<string, INavigationStepData>;\n\tparentMap: Map<string, string>;\n}\n\nexport const UiNavigationSteps: React.FC<{\n\tinitialStepId: string;\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\tcomplete?: boolean\n}> = ({ initialStepId, children, className, complete = false }) => {\n\tconst orderCounter = useRef(0);\n\tconst [currentStepOrder, setCurrentStepOrder] = useState<number>(0);\n\tconst [completedSteps, setCompletedSteps] = useState<Set<string>>(new Set());\n\n\tconst navigationState = useRef<INavigationProviderState>({\n\t\tsteps: new Map(),\n\t\tparentMap: new Map(),\n\t});\n\n\tconst registerStep = (id: string, hasSubsteps: boolean) => {\n\t\tif (!navigationState.current.steps.has(id)) {\n\t\t\torderCounter.current += 1;\n\t\t\tnavigationState.current.steps.set(id, {\n\t\t\t\torder: orderCounter.current,\n\t\t\t\thasSubsteps,\n\t\t\t\tprogress: hasSubsteps\n\t\t\t\t\t? {\n\t\t\t\t\t\tcurrent: 0,\n\t\t\t\t\t\ttotal: 0\n\t\t\t\t\t}\n\t\t\t\t\t: undefined\n\t\t\t});\n\t\t}\n\t};\n\n\tconst navigateToStep = (id: string) => {\n\t\tconst { steps, parentMap } = navigationState.current;\n\t\tlet targetOrder: number | null = null;\n\n\t\tif (steps.has(id)) {\n\t\t\ttargetOrder = steps.get(id)!.order;\n\t\t} else if (parentMap.has(id)) {\n\t\t\tconst parentId = parentMap.get(id)!;\n\t\t\tif (steps.has(parentId)) {\n\t\t\t\ttargetOrder = steps.get(parentId)!.order;\n\t\t\t}\n\t\t}\n\n\t\tif (targetOrder !== null) {\n\t\t\tif (targetOrder < currentStepOrder) {\n\t\t\t\tmarkSubsequentStepsIncomplete(targetOrder);\n\t\t\t}\n\t\t\tmarkPreviousStepsComplete(targetOrder);\n\t\t\tsetCurrentStepOrder(targetOrder);\n\t\t}\n\t};\n\n\tconst updateSubstepProgress = (stepId: string, substepId: string, subSteps: INavSubStep[] = []) => {\n\t\tif (subSteps.length > 0) {\n\t\t\tsubSteps.forEach(sub => {\n\t\t\t\tnavigationState.current.parentMap.set(sub.id, stepId);\n\t\t\t});\n\n\t\t\tconst current = subSteps.findIndex(sub => sub.id === substepId) + 1;\n\t\t\tconst total = subSteps.length;\n\n\t\t\tif (current > 0) {\n\t\t\t\tconst stepData = navigationState.current.steps.get(stepId);\n\t\t\t\tif (stepData) {\n\t\t\t\t\tnavigationState.current.steps.set(stepId, {\n\t\t\t\t\t\t...stepData,\n\t\t\t\t\t\tprogress: {\n\t\t\t\t\t\t\tcurrent,\n\t\t\t\t\t\t\ttotal\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tconst markSubsequentStepsIncomplete = (targetOrder: number) => {\n\t\tsetCompletedSteps(prev => {\n\t\t\tconst newSet = new Set(prev);\n\t\t\tnavigationState.current.steps.forEach((data, id) => {\n\t\t\t\tif (data.order > targetOrder) {\n\t\t\t\t\tnewSet.delete(id);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn newSet;\n\t\t});\n\t};\n\n\tconst markPreviousStepsComplete = (targetOrder: number) => {\n\t\tif (!complete) {\n\t\t\tsetCompletedSteps(prev => {\n\t\t\t\tconst newSet = new Set(prev);\n\t\t\t\tnavigationState.current.steps.forEach((data, id) => {\n\t\t\t\t\tif (data.order < targetOrder) {\n\t\t\t\t\t\tnewSet.add(id);\n\t\t\t\t\t} else if (data.order === targetOrder) {\n\t\t\t\t\t\tnewSet.delete(id);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn newSet;\n\t\t\t});\n\t\t} else {\n\t\t\tsetCompletedSteps(new Set(navigationState.current.steps.keys()));\n\t\t}\n\t};\n\n\tuseEffect(() => {\n\t\tconst { steps, parentMap } = navigationState.current;\n\n\t\tif (steps.size > 0) {\n\t\t\tlet targetStepId = initialStepId;\n\n\t\t\tif (parentMap.has(initialStepId)) {\n\t\t\t\tconst parentId = parentMap.get(initialStepId);\n\t\t\t\tif (parentId && steps.has(parentId)) {\n\t\t\t\t\ttargetStepId = parentId;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (complete) {\n\t\t\t\tsetCompletedSteps(new Set(steps.keys()));\n\t\t\t} else {\n\t\t\t\tsetCompletedSteps(new Set());\n\t\t\t}\n\n\t\t\tif (steps.has(targetStepId)) {\n\t\t\t\tnavigateToStep(targetStepId);\n\t\t\t}\n\t\t}\n\t}, [initialStepId, complete]);\n\n\tconst contextValue: INavigationStepContext = {\n\t\tcurrentStepId: initialStepId,\n\t\tregisterStep,\n\t\tnavigateToStep,\n\t\tupdateSubstepProgress,\n\t\tcompletedSteps,\n\t};\n\n\tconst isStepActive = (id: string) => {\n\t\treturn id === initialStepId\n\t\t\t|| navigationState.current.parentMap.get(initialStepId) === id;\n\t};\n\n\tconst isStepComplete = (id: string) => {\n\t\treturn completedSteps.has(id);\n\t};\n\n\tconst childWithProps = React.Children.map(children, (child, index) => {\n\t\tif (React.isValidElement<INavStepProps>(child)) {\n\t\t\tconst stepData = navigationState.current.steps.get(child.props.id);\n\t\t\tconst totalSteps = navigationState.current.steps.size;\n\n\t\t\treturn React.cloneElement(child, {\n\t\t\t\torder: stepData?.order || index + 1,\n\t\t\t\ttotalSteps,\n\t\t\t\tisActive: isStepActive(child.props.id),\n\t\t\t\tisComplete: isStepComplete(child.props.id)\n\t\t\t});\n\t\t}\n\t\treturn child;\n\t});\n\n\treturn (\n\t\t<NavigationStepContext.Provider value={ contextValue }>\n\t\t\t<nav\n\t\t\t\taria-label=\"Progress\"\n\t\t\t\tclassName={ cx(\"relative grid grid-cols-1 grid-rows-1 items-center\", styles.navbar, className) }\n\t\t\t\tdata-status={\n\t\t\t\t\tcompletedSteps.size === navigationState.current.steps.size\n\t\t\t\t\t\t? \"complete\"\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"z-10 flex items-center justify-between\"\n\t\t\t\t>\n\t\t\t\t\t{ childWithProps }\n\t\t\t\t</div>\n\t\t\t</nav>\n\t\t</NavigationStepContext.Provider>\n\t);\n};\n\nexport const useStepNav = () => {\n\tconst context = useContext(NavigationStepContext);\n\tif (!context) {\n\t\tthrow new Error(\"useStepNav must be used within a UiNavigationStepsProvider\");\n\t}\n\treturn context;\n};\n"],"names":["NavigationStepContext","createContext","UiNavigationSteps","initialStepId","children","className","complete","orderCounter","useRef","currentStepOrder","setCurrentStepOrder","useState","completedSteps","setCompletedSteps","navigationState","registerStep","id","hasSubsteps","navigateToStep","steps","parentMap","targetOrder","parentId","markSubsequentStepsIncomplete","markPreviousStepsComplete","updateSubstepProgress","stepId","substepId","subSteps","sub","current","total","stepData","prev","newSet","data","useEffect","targetStepId","contextValue","isStepActive","isStepComplete","childWithProps","React","child","index","totalSteps","jsx","cx","styles","useStepNav","context","useContext"],"mappings":";;;;;;GAWMA,IAAwBC,EAA6C,IAAI,GAgBlEC,IAKR,CAAC,EAAE,eAAAC,GAAe,UAAAC,GAAU,WAAAC,GAAW,UAAAC,IAAW,SAAY;AAClE,QAAMC,IAAeC,EAAO,CAAC,GACvB,CAACC,GAAkBC,CAAmB,IAAIC,EAAiB,CAAC,GAC5D,CAACC,GAAgBC,CAAiB,IAAIF,EAAsB,oBAAI,KAAK,GAErEG,IAAkBN,EAAiC;AAAA,IACxD,2BAAW,IAAA;AAAA,IACX,+BAAe,IAAA;AAAA,EAAI,CACnB,GAEKO,IAAe,CAACC,GAAYC,MAAyB;AAC1D,IAAKH,EAAgB,QAAQ,MAAM,IAAIE,CAAE,MACxCT,EAAa,WAAW,GACxBO,EAAgB,QAAQ,MAAM,IAAIE,GAAI;AAAA,MACrC,OAAOT,EAAa;AAAA,MACpB,aAAAU;AAAA,MACA,UAAUA,IACP;AAAA,QACD,SAAS;AAAA,QACT,OAAO;AAAA,MAAA,IAEN;AAAA,IAAA,CACH;AAAA,EAEH,GAEMC,IAAiB,CAACF,MAAe;AACtC,UAAM,EAAE,OAAAG,GAAO,WAAAC,EAAA,IAAcN,EAAgB;AAC7C,QAAIO,IAA6B;AAEjC,QAAIF,EAAM,IAAIH,CAAE;AACf,MAAAK,IAAcF,EAAM,IAAIH,CAAE,EAAG;AAAA,aACnBI,EAAU,IAAIJ,CAAE,GAAG;AAC7B,YAAMM,IAAWF,EAAU,IAAIJ,CAAE;AACjC,MAAIG,EAAM,IAAIG,CAAQ,MACrBD,IAAcF,EAAM,IAAIG,CAAQ,EAAG;AAAA,IAErC;AAEA,IAAID,MAAgB,SACfA,IAAcZ,KACjBc,EAA8BF,CAAW,GAE1CG,EAA0BH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