@contractspec/example.learning-journey-ui-shared 1.57.0 → 1.58.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/.turbo/turbo-build.log +52 -53
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +15 -0
- package/dist/browser/components/BadgeDisplay.js +54 -0
- package/dist/browser/components/StreakCounter.js +50 -0
- package/dist/browser/components/ViewTabs.js +46 -0
- package/dist/browser/components/XpBar.js +62 -0
- package/dist/browser/components/index.js +209 -0
- package/dist/browser/docs/index.js +21 -0
- package/dist/browser/docs/learning-journey-ui-shared.docblock.js +21 -0
- package/dist/browser/example.js +32 -0
- package/dist/browser/hooks/index.js +71 -0
- package/dist/browser/hooks/useLearningProgress.js +71 -0
- package/dist/browser/index.js +330 -0
- package/dist/browser/types.js +0 -0
- package/dist/components/BadgeDisplay.d.ts +2 -11
- package/dist/components/BadgeDisplay.d.ts.map +1 -1
- package/dist/components/BadgeDisplay.js +51 -41
- package/dist/components/StreakCounter.d.ts +2 -11
- package/dist/components/StreakCounter.d.ts.map +1 -1
- package/dist/components/StreakCounter.js +48 -43
- package/dist/components/ViewTabs.d.ts +2 -11
- package/dist/components/ViewTabs.d.ts.map +1 -1
- package/dist/components/ViewTabs.js +43 -45
- package/dist/components/XpBar.d.ts +2 -13
- package/dist/components/XpBar.d.ts.map +1 -1
- package/dist/components/XpBar.js +58 -42
- package/dist/components/index.d.ts +5 -5
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +209 -5
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +22 -1
- package/dist/docs/learning-journey-ui-shared.docblock.d.ts +2 -1
- package/dist/docs/learning-journey-ui-shared.docblock.d.ts.map +1 -0
- package/dist/docs/learning-journey-ui-shared.docblock.js +20 -18
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +31 -39
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +72 -3
- package/dist/hooks/useLearningProgress.d.ts +15 -19
- package/dist/hooks/useLearningProgress.d.ts.map +1 -1
- package/dist/hooks/useLearningProgress.js +68 -70
- package/dist/index.d.ts +6 -9
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +331 -11
- package/dist/node/components/BadgeDisplay.js +54 -0
- package/dist/node/components/StreakCounter.js +50 -0
- package/dist/node/components/ViewTabs.js +46 -0
- package/dist/node/components/XpBar.js +62 -0
- package/dist/node/components/index.js +209 -0
- package/dist/node/docs/index.js +21 -0
- package/dist/node/docs/learning-journey-ui-shared.docblock.js +21 -0
- package/dist/node/example.js +32 -0
- package/dist/node/hooks/index.js +71 -0
- package/dist/node/hooks/useLearningProgress.js +71 -0
- package/dist/node/index.js +330 -0
- package/dist/node/types.js +0 -0
- package/dist/types.d.ts +38 -42
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/package.json +135 -34
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -53
- package/dist/components/BadgeDisplay.js.map +0 -1
- package/dist/components/StreakCounter.js.map +0 -1
- package/dist/components/ViewTabs.js.map +0 -1
- package/dist/components/XpBar.js.map +0 -1
- package/dist/docs/learning-journey-ui-shared.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/hooks/useLearningProgress.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,46 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/components/StreakCounter.tsx
|
|
3
3
|
import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
4
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
5
|
+
"use client";
|
|
6
|
+
var sizeStyles = {
|
|
7
|
+
sm: {
|
|
8
|
+
container: "gap-1 px-2 py-1",
|
|
9
|
+
icon: "text-base",
|
|
10
|
+
text: "text-xs"
|
|
11
|
+
},
|
|
12
|
+
md: {
|
|
13
|
+
container: "gap-1.5 px-3 py-1.5",
|
|
14
|
+
icon: "text-lg",
|
|
15
|
+
text: "text-sm"
|
|
16
|
+
},
|
|
17
|
+
lg: {
|
|
18
|
+
container: "gap-2 px-4 py-2",
|
|
19
|
+
icon: "text-xl",
|
|
20
|
+
text: "text-base"
|
|
21
|
+
}
|
|
23
22
|
};
|
|
24
|
-
function StreakCounter({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
function StreakCounter({
|
|
24
|
+
days,
|
|
25
|
+
isActive = true,
|
|
26
|
+
size = "md"
|
|
27
|
+
}) {
|
|
28
|
+
const styles = sizeStyles[size];
|
|
29
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
30
|
+
className: cn("inline-flex items-center rounded-full font-semibold", styles.container, isActive ? "bg-orange-500/10 text-orange-500" : "bg-muted text-muted-foreground"),
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
33
|
+
className: styles.icon,
|
|
34
|
+
role: "img",
|
|
35
|
+
"aria-label": "streak",
|
|
36
|
+
children: "\uD83D\uDD25"
|
|
37
|
+
}, undefined, false, undefined, this),
|
|
38
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
39
|
+
className: styles.text,
|
|
40
|
+
children: [
|
|
41
|
+
days,
|
|
42
|
+
" ",
|
|
43
|
+
days === 1 ? "day" : "days"
|
|
44
|
+
]
|
|
45
|
+
}, undefined, true, undefined, this)
|
|
46
|
+
]
|
|
47
|
+
}, undefined, true, undefined, this);
|
|
42
48
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=StreakCounter.js.map
|
|
49
|
+
export {
|
|
50
|
+
StreakCounter
|
|
51
|
+
};
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import { ViewTabsProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region src/components/ViewTabs.d.ts
|
|
5
|
-
declare function ViewTabs({
|
|
6
|
-
currentView,
|
|
7
|
-
onViewChange,
|
|
8
|
-
availableViews
|
|
9
|
-
}: ViewTabsProps): react_jsx_runtime0.JSX.Element;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { ViewTabs };
|
|
1
|
+
import type { ViewTabsProps } from '../types';
|
|
2
|
+
export declare function ViewTabs({ currentView, onViewChange, availableViews, }: ViewTabsProps): import("react/jsx-runtime").JSX.Element;
|
|
12
3
|
//# sourceMappingURL=ViewTabs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewTabs.d.ts","
|
|
1
|
+
{"version":3,"file":"ViewTabs.d.ts","sourceRoot":"","sources":["../../src/components/ViewTabs.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,UAAU,CAAC;AAgB5D,wBAAgB,QAAQ,CAAC,EACvB,WAAW,EACX,YAAY,EACZ,cAA8B,GAC/B,EAAE,aAAa,2CAsBf"}
|
|
@@ -1,49 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
// @bun
|
|
2
|
+
// src/components/ViewTabs.tsx
|
|
4
3
|
import { Button } from "@contractspec/lib.design-system";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
steps: {
|
|
13
|
-
label: "Steps",
|
|
14
|
-
icon: "📝"
|
|
15
|
-
},
|
|
16
|
-
progress: {
|
|
17
|
-
label: "Progress",
|
|
18
|
-
icon: "📈"
|
|
19
|
-
},
|
|
20
|
-
timeline: {
|
|
21
|
-
label: "Timeline",
|
|
22
|
-
icon: "📅"
|
|
23
|
-
}
|
|
4
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
5
|
+
"use client";
|
|
6
|
+
var VIEW_LABELS = {
|
|
7
|
+
overview: { label: "Overview", icon: "\uD83D\uDCCA" },
|
|
8
|
+
steps: { label: "Steps", icon: "\uD83D\uDCDD" },
|
|
9
|
+
progress: { label: "Progress", icon: "\uD83D\uDCC8" },
|
|
10
|
+
timeline: { label: "Timeline", icon: "\uD83D\uDCC5" }
|
|
24
11
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
var DEFAULT_VIEWS = [
|
|
13
|
+
"overview",
|
|
14
|
+
"steps",
|
|
15
|
+
"progress",
|
|
16
|
+
"timeline"
|
|
30
17
|
];
|
|
31
|
-
function ViewTabs({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
18
|
+
function ViewTabs({
|
|
19
|
+
currentView,
|
|
20
|
+
onViewChange,
|
|
21
|
+
availableViews = DEFAULT_VIEWS
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
24
|
+
className: "flex flex-wrap gap-2",
|
|
25
|
+
children: availableViews.map((view) => {
|
|
26
|
+
const { label, icon } = VIEW_LABELS[view];
|
|
27
|
+
const isActive = currentView === view;
|
|
28
|
+
return /* @__PURE__ */ jsxDEV(Button, {
|
|
29
|
+
variant: isActive ? "default" : "outline",
|
|
30
|
+
size: "sm",
|
|
31
|
+
onClick: () => onViewChange(view),
|
|
32
|
+
className: "gap-1.5",
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
35
|
+
children: icon
|
|
36
|
+
}, undefined, false, undefined, this),
|
|
37
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
38
|
+
children: label
|
|
39
|
+
}, undefined, false, undefined, this)
|
|
40
|
+
]
|
|
41
|
+
}, view, true, undefined, this);
|
|
42
|
+
})
|
|
43
|
+
}, undefined, false, undefined, this);
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
//# sourceMappingURL=ViewTabs.js.map
|
|
45
|
+
export {
|
|
46
|
+
ViewTabs
|
|
47
|
+
};
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import { XpBarProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region src/components/XpBar.d.ts
|
|
5
|
-
declare function XpBar({
|
|
6
|
-
current,
|
|
7
|
-
max,
|
|
8
|
-
level,
|
|
9
|
-
showLabel,
|
|
10
|
-
size
|
|
11
|
-
}: XpBarProps): react_jsx_runtime0.JSX.Element;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { XpBar };
|
|
1
|
+
import type { XpBarProps } from '../types';
|
|
2
|
+
export declare function XpBar({ current, max, level, showLabel, size, }: XpBarProps): import("react/jsx-runtime").JSX.Element;
|
|
14
3
|
//# sourceMappingURL=XpBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XpBar.d.ts","
|
|
1
|
+
{"version":3,"file":"XpBar.d.ts","sourceRoot":"","sources":["../../src/components/XpBar.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAc3C,wBAAgB,KAAK,CAAC,EACpB,OAAO,EACP,GAAG,EACH,KAAK,EACL,SAAgB,EAChB,IAAW,GACZ,EAAE,UAAU,2CA6BZ"}
|
package/dist/components/XpBar.js
CHANGED
|
@@ -1,47 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/components/XpBar.tsx
|
|
3
3
|
import { Progress } from "@contractspec/lib.ui-kit-web/ui/progress";
|
|
4
4
|
import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
lg: "h-4"
|
|
5
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
6
|
+
"use client";
|
|
7
|
+
var sizeStyles = {
|
|
8
|
+
sm: "h-2",
|
|
9
|
+
md: "h-3",
|
|
10
|
+
lg: "h-4"
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
var labelSizeStyles = {
|
|
13
|
+
sm: "text-xs",
|
|
14
|
+
md: "text-sm",
|
|
15
|
+
lg: "text-base"
|
|
17
16
|
};
|
|
18
|
-
function XpBar({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
17
|
+
function XpBar({
|
|
18
|
+
current,
|
|
19
|
+
max,
|
|
20
|
+
level,
|
|
21
|
+
showLabel = true,
|
|
22
|
+
size = "md"
|
|
23
|
+
}) {
|
|
24
|
+
const percentage = max > 0 ? Math.min(current / max * 100, 100) : 0;
|
|
25
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
26
|
+
className: "w-full space-y-1",
|
|
27
|
+
children: [
|
|
28
|
+
showLabel && /* @__PURE__ */ jsxDEV("div", {
|
|
29
|
+
className: cn("flex items-center justify-between", labelSizeStyles[size]),
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
32
|
+
className: "text-muted-foreground font-medium",
|
|
33
|
+
children: [
|
|
34
|
+
level !== undefined && /* @__PURE__ */ jsxDEV("span", {
|
|
35
|
+
className: "text-primary mr-1",
|
|
36
|
+
children: [
|
|
37
|
+
"Lvl ",
|
|
38
|
+
level
|
|
39
|
+
]
|
|
40
|
+
}, undefined, true, undefined, this),
|
|
41
|
+
"XP"
|
|
42
|
+
]
|
|
43
|
+
}, undefined, true, undefined, this),
|
|
44
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
45
|
+
className: "font-semibold",
|
|
46
|
+
children: [
|
|
47
|
+
current.toLocaleString(),
|
|
48
|
+
" / ",
|
|
49
|
+
max.toLocaleString()
|
|
50
|
+
]
|
|
51
|
+
}, undefined, true, undefined, this)
|
|
52
|
+
]
|
|
53
|
+
}, undefined, true, undefined, this),
|
|
54
|
+
/* @__PURE__ */ jsxDEV(Progress, {
|
|
55
|
+
value: percentage,
|
|
56
|
+
className: cn("bg-muted", sizeStyles[size])
|
|
57
|
+
}, undefined, false, undefined, this)
|
|
58
|
+
]
|
|
59
|
+
}, undefined, true, undefined, this);
|
|
43
60
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=XpBar.js.map
|
|
61
|
+
export {
|
|
62
|
+
XpBar
|
|
63
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export { XpBar } from './XpBar';
|
|
2
|
+
export { StreakCounter } from './StreakCounter';
|
|
3
|
+
export { BadgeDisplay } from './BadgeDisplay';
|
|
4
|
+
export { ViewTabs } from './ViewTabs';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,6 +1,210 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
// @bun
|
|
2
|
+
// src/components/BadgeDisplay.tsx
|
|
3
|
+
import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
|
|
4
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
5
|
+
"use client";
|
|
6
|
+
var BADGE_ICONS = {
|
|
7
|
+
studio_first_30m: "\uD83C\uDFAF",
|
|
8
|
+
platform_tour: "\uD83D\uDDFA\uFE0F",
|
|
9
|
+
crm_first_win: "\uD83C\uDFC6",
|
|
10
|
+
drill_master: "\uD83E\uDDE0",
|
|
11
|
+
coach_listener: "\uD83D\uDC42",
|
|
12
|
+
quest_complete: "\u2B50",
|
|
13
|
+
streak_7: "\uD83D\uDD25",
|
|
14
|
+
streak_30: "\uD83D\uDC8E",
|
|
15
|
+
default: "\uD83C\uDFC5"
|
|
16
|
+
};
|
|
17
|
+
var sizeStyles = {
|
|
18
|
+
sm: "h-6 w-6 text-sm",
|
|
19
|
+
md: "h-8 w-8 text-base",
|
|
20
|
+
lg: "h-10 w-10 text-lg"
|
|
21
|
+
};
|
|
22
|
+
function BadgeDisplay({
|
|
23
|
+
badges,
|
|
24
|
+
maxVisible = 5,
|
|
25
|
+
size = "md"
|
|
26
|
+
}) {
|
|
27
|
+
const visibleBadges = badges.slice(0, maxVisible);
|
|
28
|
+
const hiddenCount = badges.length - maxVisible;
|
|
29
|
+
if (badges.length === 0) {
|
|
30
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
31
|
+
className: "text-muted-foreground text-sm",
|
|
32
|
+
children: "No badges earned yet"
|
|
33
|
+
}, undefined, false, undefined, this);
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
36
|
+
className: "flex items-center gap-1",
|
|
37
|
+
children: [
|
|
38
|
+
visibleBadges.map((badge) => /* @__PURE__ */ jsxDEV("div", {
|
|
39
|
+
className: cn("flex items-center justify-center rounded-full bg-gradient-to-br from-amber-400/20 to-amber-600/20", sizeStyles[size]),
|
|
40
|
+
title: badge.replace(/_/g, " "),
|
|
41
|
+
children: BADGE_ICONS[badge] ?? BADGE_ICONS.default
|
|
42
|
+
}, badge, false, undefined, this)),
|
|
43
|
+
hiddenCount > 0 && /* @__PURE__ */ jsxDEV("div", {
|
|
44
|
+
className: cn("text-muted-foreground bg-muted flex items-center justify-center rounded-full", sizeStyles[size], "text-xs font-medium"),
|
|
45
|
+
children: [
|
|
46
|
+
"+",
|
|
47
|
+
hiddenCount
|
|
48
|
+
]
|
|
49
|
+
}, undefined, true, undefined, this)
|
|
50
|
+
]
|
|
51
|
+
}, undefined, true, undefined, this);
|
|
52
|
+
}
|
|
5
53
|
|
|
6
|
-
|
|
54
|
+
// src/components/StreakCounter.tsx
|
|
55
|
+
import { cn as cn2 } from "@contractspec/lib.ui-kit-web/ui/utils";
|
|
56
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
57
|
+
"use client";
|
|
58
|
+
var sizeStyles2 = {
|
|
59
|
+
sm: {
|
|
60
|
+
container: "gap-1 px-2 py-1",
|
|
61
|
+
icon: "text-base",
|
|
62
|
+
text: "text-xs"
|
|
63
|
+
},
|
|
64
|
+
md: {
|
|
65
|
+
container: "gap-1.5 px-3 py-1.5",
|
|
66
|
+
icon: "text-lg",
|
|
67
|
+
text: "text-sm"
|
|
68
|
+
},
|
|
69
|
+
lg: {
|
|
70
|
+
container: "gap-2 px-4 py-2",
|
|
71
|
+
icon: "text-xl",
|
|
72
|
+
text: "text-base"
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function StreakCounter({
|
|
76
|
+
days,
|
|
77
|
+
isActive = true,
|
|
78
|
+
size = "md"
|
|
79
|
+
}) {
|
|
80
|
+
const styles = sizeStyles2[size];
|
|
81
|
+
return /* @__PURE__ */ jsxDEV2("div", {
|
|
82
|
+
className: cn2("inline-flex items-center rounded-full font-semibold", styles.container, isActive ? "bg-orange-500/10 text-orange-500" : "bg-muted text-muted-foreground"),
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
85
|
+
className: styles.icon,
|
|
86
|
+
role: "img",
|
|
87
|
+
"aria-label": "streak",
|
|
88
|
+
children: "\uD83D\uDD25"
|
|
89
|
+
}, undefined, false, undefined, this),
|
|
90
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
91
|
+
className: styles.text,
|
|
92
|
+
children: [
|
|
93
|
+
days,
|
|
94
|
+
" ",
|
|
95
|
+
days === 1 ? "day" : "days"
|
|
96
|
+
]
|
|
97
|
+
}, undefined, true, undefined, this)
|
|
98
|
+
]
|
|
99
|
+
}, undefined, true, undefined, this);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/components/ViewTabs.tsx
|
|
103
|
+
import { Button } from "@contractspec/lib.design-system";
|
|
104
|
+
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
105
|
+
"use client";
|
|
106
|
+
var VIEW_LABELS = {
|
|
107
|
+
overview: { label: "Overview", icon: "\uD83D\uDCCA" },
|
|
108
|
+
steps: { label: "Steps", icon: "\uD83D\uDCDD" },
|
|
109
|
+
progress: { label: "Progress", icon: "\uD83D\uDCC8" },
|
|
110
|
+
timeline: { label: "Timeline", icon: "\uD83D\uDCC5" }
|
|
111
|
+
};
|
|
112
|
+
var DEFAULT_VIEWS = [
|
|
113
|
+
"overview",
|
|
114
|
+
"steps",
|
|
115
|
+
"progress",
|
|
116
|
+
"timeline"
|
|
117
|
+
];
|
|
118
|
+
function ViewTabs({
|
|
119
|
+
currentView,
|
|
120
|
+
onViewChange,
|
|
121
|
+
availableViews = DEFAULT_VIEWS
|
|
122
|
+
}) {
|
|
123
|
+
return /* @__PURE__ */ jsxDEV3("div", {
|
|
124
|
+
className: "flex flex-wrap gap-2",
|
|
125
|
+
children: availableViews.map((view) => {
|
|
126
|
+
const { label, icon } = VIEW_LABELS[view];
|
|
127
|
+
const isActive = currentView === view;
|
|
128
|
+
return /* @__PURE__ */ jsxDEV3(Button, {
|
|
129
|
+
variant: isActive ? "default" : "outline",
|
|
130
|
+
size: "sm",
|
|
131
|
+
onClick: () => onViewChange(view),
|
|
132
|
+
className: "gap-1.5",
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
135
|
+
children: icon
|
|
136
|
+
}, undefined, false, undefined, this),
|
|
137
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
138
|
+
children: label
|
|
139
|
+
}, undefined, false, undefined, this)
|
|
140
|
+
]
|
|
141
|
+
}, view, true, undefined, this);
|
|
142
|
+
})
|
|
143
|
+
}, undefined, false, undefined, this);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/components/XpBar.tsx
|
|
147
|
+
import { Progress } from "@contractspec/lib.ui-kit-web/ui/progress";
|
|
148
|
+
import { cn as cn3 } from "@contractspec/lib.ui-kit-web/ui/utils";
|
|
149
|
+
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
150
|
+
"use client";
|
|
151
|
+
var sizeStyles3 = {
|
|
152
|
+
sm: "h-2",
|
|
153
|
+
md: "h-3",
|
|
154
|
+
lg: "h-4"
|
|
155
|
+
};
|
|
156
|
+
var labelSizeStyles = {
|
|
157
|
+
sm: "text-xs",
|
|
158
|
+
md: "text-sm",
|
|
159
|
+
lg: "text-base"
|
|
160
|
+
};
|
|
161
|
+
function XpBar({
|
|
162
|
+
current,
|
|
163
|
+
max,
|
|
164
|
+
level,
|
|
165
|
+
showLabel = true,
|
|
166
|
+
size = "md"
|
|
167
|
+
}) {
|
|
168
|
+
const percentage = max > 0 ? Math.min(current / max * 100, 100) : 0;
|
|
169
|
+
return /* @__PURE__ */ jsxDEV4("div", {
|
|
170
|
+
className: "w-full space-y-1",
|
|
171
|
+
children: [
|
|
172
|
+
showLabel && /* @__PURE__ */ jsxDEV4("div", {
|
|
173
|
+
className: cn3("flex items-center justify-between", labelSizeStyles[size]),
|
|
174
|
+
children: [
|
|
175
|
+
/* @__PURE__ */ jsxDEV4("span", {
|
|
176
|
+
className: "text-muted-foreground font-medium",
|
|
177
|
+
children: [
|
|
178
|
+
level !== undefined && /* @__PURE__ */ jsxDEV4("span", {
|
|
179
|
+
className: "text-primary mr-1",
|
|
180
|
+
children: [
|
|
181
|
+
"Lvl ",
|
|
182
|
+
level
|
|
183
|
+
]
|
|
184
|
+
}, undefined, true, undefined, this),
|
|
185
|
+
"XP"
|
|
186
|
+
]
|
|
187
|
+
}, undefined, true, undefined, this),
|
|
188
|
+
/* @__PURE__ */ jsxDEV4("span", {
|
|
189
|
+
className: "font-semibold",
|
|
190
|
+
children: [
|
|
191
|
+
current.toLocaleString(),
|
|
192
|
+
" / ",
|
|
193
|
+
max.toLocaleString()
|
|
194
|
+
]
|
|
195
|
+
}, undefined, true, undefined, this)
|
|
196
|
+
]
|
|
197
|
+
}, undefined, true, undefined, this),
|
|
198
|
+
/* @__PURE__ */ jsxDEV4(Progress, {
|
|
199
|
+
value: percentage,
|
|
200
|
+
className: cn3("bg-muted", sizeStyles3[size])
|
|
201
|
+
}, undefined, false, undefined, this)
|
|
202
|
+
]
|
|
203
|
+
}, undefined, true, undefined, this);
|
|
204
|
+
}
|
|
205
|
+
export {
|
|
206
|
+
XpBar,
|
|
207
|
+
ViewTabs,
|
|
208
|
+
StreakCounter,
|
|
209
|
+
BadgeDisplay
|
|
210
|
+
};
|
package/dist/docs/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import './learning-journey-ui-shared.docblock';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/docs/index.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAC"}
|
package/dist/docs/index.js
CHANGED
|
@@ -1 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/docs/learning-journey-ui-shared.docblock.ts
|
|
3
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
4
|
+
var blocks = [
|
|
5
|
+
{
|
|
6
|
+
id: "docs.examples.learning-journey-ui-shared",
|
|
7
|
+
title: "Learning Journey UI \u2014 Shared",
|
|
8
|
+
summary: "Shared UI components and hooks for learning journey mini-apps.",
|
|
9
|
+
kind: "reference",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
route: "/docs/examples/learning-journey-ui-shared",
|
|
12
|
+
tags: ["learning", "ui", "shared"],
|
|
13
|
+
body: `## Includes
|
|
14
|
+
- Hooks: useLearningProgress
|
|
15
|
+
- Components: XpBar, StreakCounter, BadgeDisplay, ViewTabs
|
|
16
|
+
|
|
17
|
+
## Notes
|
|
18
|
+
- Keep components accessible (labels, focus, contrast).
|
|
19
|
+
- Prefer design-system tokens and components.`
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
registerDocBlocks(blocks);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=learning-journey-ui-shared.docblock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learning-journey-ui-shared.docblock.d.ts","sourceRoot":"","sources":["../../src/docs/learning-journey-ui-shared.docblock.ts"],"names":[],"mappings":""}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/docs/learning-journey-ui-shared.docblock.ts
|
|
1
3
|
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
4
|
+
var blocks = [
|
|
5
|
+
{
|
|
6
|
+
id: "docs.examples.learning-journey-ui-shared",
|
|
7
|
+
title: "Learning Journey UI \u2014 Shared",
|
|
8
|
+
summary: "Shared UI components and hooks for learning journey mini-apps.",
|
|
9
|
+
kind: "reference",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
route: "/docs/examples/learning-journey-ui-shared",
|
|
12
|
+
tags: ["learning", "ui", "shared"],
|
|
13
|
+
body: `## Includes
|
|
14
|
+
- Hooks: useLearningProgress
|
|
15
|
+
- Components: XpBar, StreakCounter, BadgeDisplay, ViewTabs
|
|
2
16
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/learning-journey-ui-shared",
|
|
11
|
-
tags: [
|
|
12
|
-
"learning",
|
|
13
|
-
"ui",
|
|
14
|
-
"shared"
|
|
15
|
-
],
|
|
16
|
-
body: `## Includes\n- Hooks: useLearningProgress\n- Components: XpBar, StreakCounter, BadgeDisplay, ViewTabs\n\n## Notes\n- Keep components accessible (labels, focus, contrast).\n- Prefer design-system tokens and components.`
|
|
17
|
-
}]);
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
//# sourceMappingURL=learning-journey-ui-shared.docblock.js.map
|
|
17
|
+
## Notes
|
|
18
|
+
- Keep components accessible (labels, focus, contrast).
|
|
19
|
+
- Prefer design-system tokens and components.`
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
registerDocBlocks(blocks);
|