@contractspec/example.learning-journey-ui-coaching 3.7.17 → 3.7.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.turbo/turbo-build.log +48 -48
  2. package/CHANGELOG.md +17 -0
  3. package/dist/CoachingMiniApp.js +1 -1059
  4. package/dist/browser/CoachingMiniApp.js +1 -1059
  5. package/dist/browser/components/EngagementMeter.js +1 -143
  6. package/dist/browser/components/TipCard.js +1 -89
  7. package/dist/browser/components/TipFeed.js +1 -90
  8. package/dist/browser/components/index.js +1 -320
  9. package/dist/browser/docs/index.js +2 -16
  10. package/dist/browser/docs/learning-journey-ui-coaching.docblock.js +2 -16
  11. package/dist/browser/example.js +1 -32
  12. package/dist/browser/index.js +2 -1129
  13. package/dist/browser/learning-journey-ui-coaching.feature.js +1 -18
  14. package/dist/browser/views/Overview.js +1 -303
  15. package/dist/browser/views/Progress.js +1 -344
  16. package/dist/browser/views/Steps.js +1 -159
  17. package/dist/browser/views/Timeline.js +1 -266
  18. package/dist/browser/views/index.js +1 -980
  19. package/dist/components/EngagementMeter.js +1 -143
  20. package/dist/components/TipCard.js +1 -89
  21. package/dist/components/TipFeed.js +1 -90
  22. package/dist/components/index.js +1 -320
  23. package/dist/docs/index.js +2 -16
  24. package/dist/docs/learning-journey-ui-coaching.docblock.js +2 -16
  25. package/dist/example.js +1 -32
  26. package/dist/index.js +2 -1129
  27. package/dist/learning-journey-ui-coaching.feature.js +1 -18
  28. package/dist/node/CoachingMiniApp.js +1 -1059
  29. package/dist/node/components/EngagementMeter.js +1 -143
  30. package/dist/node/components/TipCard.js +1 -89
  31. package/dist/node/components/TipFeed.js +1 -90
  32. package/dist/node/components/index.js +1 -320
  33. package/dist/node/docs/index.js +2 -16
  34. package/dist/node/docs/learning-journey-ui-coaching.docblock.js +2 -16
  35. package/dist/node/example.js +1 -32
  36. package/dist/node/index.js +2 -1129
  37. package/dist/node/learning-journey-ui-coaching.feature.js +1 -18
  38. package/dist/node/views/Overview.js +1 -303
  39. package/dist/node/views/Progress.js +1 -344
  40. package/dist/node/views/Steps.js +1 -159
  41. package/dist/node/views/Timeline.js +1 -266
  42. package/dist/node/views/index.js +1 -980
  43. package/dist/views/Overview.js +1 -303
  44. package/dist/views/Progress.js +1 -344
  45. package/dist/views/Steps.js +1 -159
  46. package/dist/views/Timeline.js +1 -266
  47. package/dist/views/index.js +1 -980
  48. package/package.json +11 -11
@@ -1,18 +1 @@
1
- // src/learning-journey-ui-coaching.feature.ts
2
- import { defineFeature } from "@contractspec/lib.contracts-spec";
3
- var LearningJourneyUiCoachingFeature = defineFeature({
4
- meta: {
5
- key: "learning-journey-ui-coaching",
6
- version: "1.0.0",
7
- title: "Learning Journey UI: Coaching",
8
- description: "Coaching UI with tip cards, engagement tracking, and multi-view navigation",
9
- domain: "learning-journey",
10
- owners: ["@examples"],
11
- tags: ["learning", "ui", "coaching", "tips"],
12
- stability: "experimental"
13
- },
14
- docs: ["docs.examples.learning-journey-ui-coaching"]
15
- });
16
- export {
17
- LearningJourneyUiCoachingFeature
18
- };
1
+ import{defineFeature as g}from"@contractspec/lib.contracts-spec";var j=g({meta:{key:"learning-journey-ui-coaching",version:"1.0.0",title:"Learning Journey UI: Coaching",description:"Coaching UI with tip cards, engagement tracking, and multi-view navigation",domain:"learning-journey",owners:["@examples"],tags:["learning","ui","coaching","tips"],stability:"experimental"},docs:["docs.examples.learning-journey-ui-coaching"]});export{j as LearningJourneyUiCoachingFeature};
@@ -1,303 +1 @@
1
- // src/components/TipCard.tsx
2
- import { Button } from "@contractspec/lib.design-system";
3
- import { Card, CardContent } from "@contractspec/lib.ui-kit-web/ui/card";
4
- import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
5
- import { jsxDEV } from "react/jsx-dev-runtime";
6
- "use client";
7
- var TIP_ICONS = {
8
- cash_buffer_too_high: "\uD83D\uDCB0",
9
- no_savings_goal: "\uD83C\uDFAF",
10
- irregular_savings: "\uD83D\uDCC5",
11
- noise_late_evening: "\uD83D\uDD07",
12
- guest_frequency_high: "\uD83D\uDC65",
13
- shared_space_conflicts: "\uD83C\uDFE0",
14
- default: "\uD83D\uDCA1"
15
- };
16
- function TipCard({
17
- step,
18
- isCompleted,
19
- isCurrent,
20
- onComplete,
21
- onDismiss
22
- }) {
23
- const tipId = step.metadata?.tipId ?? "default";
24
- const icon = TIP_ICONS[tipId] ?? TIP_ICONS.default;
25
- return /* @__PURE__ */ jsxDEV(Card, {
26
- className: cn("transition-all", isCompleted && "opacity-60", isCurrent && "ring-2 ring-amber-500"),
27
- children: /* @__PURE__ */ jsxDEV(CardContent, {
28
- className: "p-4",
29
- children: /* @__PURE__ */ jsxDEV("div", {
30
- className: "flex gap-4",
31
- children: [
32
- /* @__PURE__ */ jsxDEV("div", {
33
- className: cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-xl text-2xl", isCompleted ? "bg-green-500/10" : isCurrent ? "bg-amber-500/10" : "bg-muted"),
34
- children: isCompleted ? "✓" : icon
35
- }, undefined, false, undefined, this),
36
- /* @__PURE__ */ jsxDEV("div", {
37
- className: "min-w-0 flex-1",
38
- children: [
39
- /* @__PURE__ */ jsxDEV("div", {
40
- className: "flex items-start justify-between gap-2",
41
- children: [
42
- /* @__PURE__ */ jsxDEV("h4", {
43
- className: "font-semibold",
44
- children: step.title
45
- }, undefined, false, undefined, this),
46
- step.xpReward && /* @__PURE__ */ jsxDEV("span", {
47
- className: cn("shrink-0 rounded-full px-2 py-0.5 font-semibold text-xs", isCompleted ? "bg-green-500/10 text-green-500" : "bg-amber-500/10 text-amber-500"),
48
- children: [
49
- "+",
50
- step.xpReward,
51
- " XP"
52
- ]
53
- }, undefined, true, undefined, this)
54
- ]
55
- }, undefined, true, undefined, this),
56
- /* @__PURE__ */ jsxDEV("p", {
57
- className: "mt-1 text-muted-foreground text-sm",
58
- children: step.description
59
- }, undefined, false, undefined, this),
60
- !isCompleted && /* @__PURE__ */ jsxDEV("div", {
61
- className: "mt-3 flex flex-wrap gap-2",
62
- children: [
63
- /* @__PURE__ */ jsxDEV(Button, {
64
- size: "sm",
65
- onClick: onComplete,
66
- children: "Take Action"
67
- }, undefined, false, undefined, this),
68
- /* @__PURE__ */ jsxDEV(Button, {
69
- variant: "outline",
70
- size: "sm",
71
- onClick: onDismiss,
72
- children: "Dismiss"
73
- }, undefined, false, undefined, this)
74
- ]
75
- }, undefined, true, undefined, this),
76
- isCompleted && /* @__PURE__ */ jsxDEV("p", {
77
- className: "mt-2 text-green-500 text-sm",
78
- children: "✓ Tip acknowledged"
79
- }, undefined, false, undefined, this)
80
- ]
81
- }, undefined, true, undefined, this)
82
- ]
83
- }, undefined, true, undefined, this)
84
- }, undefined, false, undefined, this)
85
- }, undefined, false, undefined, this);
86
- }
87
-
88
- // src/views/Overview.tsx
89
- import {
90
- StreakCounter,
91
- XpBar
92
- } from "@contractspec/example.learning-journey-ui-shared";
93
- import { Button as Button2 } from "@contractspec/lib.design-system";
94
- import {
95
- Card as Card2,
96
- CardContent as CardContent2,
97
- CardHeader,
98
- CardTitle
99
- } from "@contractspec/lib.ui-kit-web/ui/card";
100
- import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
101
- "use client";
102
- function Overview({
103
- track,
104
- progress,
105
- onStepComplete,
106
- onStart
107
- }) {
108
- const totalXp = track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0);
109
- const completedSteps = progress.completedStepIds.length;
110
- const totalSteps = track.steps.length;
111
- const pendingSteps = totalSteps - completedSteps;
112
- const activeTips = track.steps.filter((s) => !progress.completedStepIds.includes(s.id)).slice(0, 3);
113
- return /* @__PURE__ */ jsxDEV2("div", {
114
- className: "space-y-6",
115
- children: [
116
- /* @__PURE__ */ jsxDEV2(Card2, {
117
- className: "overflow-hidden bg-gradient-to-br from-amber-500/10 via-orange-500/10 to-red-500/10",
118
- children: /* @__PURE__ */ jsxDEV2(CardContent2, {
119
- className: "p-6",
120
- children: /* @__PURE__ */ jsxDEV2("div", {
121
- className: "flex flex-col items-center gap-4 text-center md:flex-row md:text-left",
122
- children: [
123
- /* @__PURE__ */ jsxDEV2("div", {
124
- className: "flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-amber-500 to-orange-600 text-3xl shadow-lg",
125
- children: "\uD83D\uDCA1"
126
- }, undefined, false, undefined, this),
127
- /* @__PURE__ */ jsxDEV2("div", {
128
- className: "flex-1",
129
- children: [
130
- /* @__PURE__ */ jsxDEV2("h1", {
131
- className: "font-bold text-2xl",
132
- children: track.name
133
- }, undefined, false, undefined, this),
134
- /* @__PURE__ */ jsxDEV2("p", {
135
- className: "mt-1 text-muted-foreground",
136
- children: track.description
137
- }, undefined, false, undefined, this)
138
- ]
139
- }, undefined, true, undefined, this),
140
- /* @__PURE__ */ jsxDEV2("div", {
141
- className: "flex items-center gap-4",
142
- children: /* @__PURE__ */ jsxDEV2(StreakCounter, {
143
- days: progress.streakDays,
144
- size: "lg"
145
- }, undefined, false, undefined, this)
146
- }, undefined, false, undefined, this)
147
- ]
148
- }, undefined, true, undefined, this)
149
- }, undefined, false, undefined, this)
150
- }, undefined, false, undefined, this),
151
- /* @__PURE__ */ jsxDEV2("div", {
152
- className: "grid gap-4 md:grid-cols-3",
153
- children: [
154
- /* @__PURE__ */ jsxDEV2(Card2, {
155
- children: [
156
- /* @__PURE__ */ jsxDEV2(CardHeader, {
157
- className: "pb-2",
158
- children: /* @__PURE__ */ jsxDEV2(CardTitle, {
159
- className: "font-medium text-muted-foreground text-sm",
160
- children: "Active Tips"
161
- }, undefined, false, undefined, this)
162
- }, undefined, false, undefined, this),
163
- /* @__PURE__ */ jsxDEV2(CardContent2, {
164
- children: [
165
- /* @__PURE__ */ jsxDEV2("div", {
166
- className: "font-bold text-3xl text-amber-500",
167
- children: pendingSteps
168
- }, undefined, false, undefined, this),
169
- /* @__PURE__ */ jsxDEV2("p", {
170
- className: "text-muted-foreground text-sm",
171
- children: "tips for you today"
172
- }, undefined, false, undefined, this)
173
- ]
174
- }, undefined, true, undefined, this)
175
- ]
176
- }, undefined, true, undefined, this),
177
- /* @__PURE__ */ jsxDEV2(Card2, {
178
- children: [
179
- /* @__PURE__ */ jsxDEV2(CardHeader, {
180
- className: "pb-2",
181
- children: /* @__PURE__ */ jsxDEV2(CardTitle, {
182
- className: "font-medium text-muted-foreground text-sm",
183
- children: "Tips Actioned"
184
- }, undefined, false, undefined, this)
185
- }, undefined, false, undefined, this),
186
- /* @__PURE__ */ jsxDEV2(CardContent2, {
187
- children: [
188
- /* @__PURE__ */ jsxDEV2("div", {
189
- className: "font-bold text-3xl text-green-500",
190
- children: completedSteps
191
- }, undefined, false, undefined, this),
192
- /* @__PURE__ */ jsxDEV2("p", {
193
- className: "text-muted-foreground text-sm",
194
- children: [
195
- "out of ",
196
- totalSteps,
197
- " total"
198
- ]
199
- }, undefined, true, undefined, this)
200
- ]
201
- }, undefined, true, undefined, this)
202
- ]
203
- }, undefined, true, undefined, this),
204
- /* @__PURE__ */ jsxDEV2(Card2, {
205
- children: [
206
- /* @__PURE__ */ jsxDEV2(CardHeader, {
207
- className: "pb-2",
208
- children: /* @__PURE__ */ jsxDEV2(CardTitle, {
209
- className: "font-medium text-muted-foreground text-sm",
210
- children: "XP Earned"
211
- }, undefined, false, undefined, this)
212
- }, undefined, false, undefined, this),
213
- /* @__PURE__ */ jsxDEV2(CardContent2, {
214
- children: [
215
- /* @__PURE__ */ jsxDEV2("div", {
216
- className: "font-bold text-3xl text-orange-500",
217
- children: progress.xpEarned
218
- }, undefined, false, undefined, this),
219
- /* @__PURE__ */ jsxDEV2(XpBar, {
220
- current: progress.xpEarned,
221
- max: totalXp,
222
- showLabel: false,
223
- size: "sm"
224
- }, undefined, false, undefined, this)
225
- ]
226
- }, undefined, true, undefined, this)
227
- ]
228
- }, undefined, true, undefined, this)
229
- ]
230
- }, undefined, true, undefined, this),
231
- activeTips.length > 0 && /* @__PURE__ */ jsxDEV2(Card2, {
232
- children: [
233
- /* @__PURE__ */ jsxDEV2(CardHeader, {
234
- className: "flex flex-row items-center justify-between",
235
- children: [
236
- /* @__PURE__ */ jsxDEV2(CardTitle, {
237
- className: "flex items-center gap-2",
238
- children: [
239
- /* @__PURE__ */ jsxDEV2("span", {
240
- children: "\uD83D\uDCA1"
241
- }, undefined, false, undefined, this),
242
- /* @__PURE__ */ jsxDEV2("span", {
243
- children: "Tips for You"
244
- }, undefined, false, undefined, this)
245
- ]
246
- }, undefined, true, undefined, this),
247
- activeTips.length < pendingSteps && /* @__PURE__ */ jsxDEV2(Button2, {
248
- variant: "outline",
249
- size: "sm",
250
- onClick: onStart,
251
- children: [
252
- "View All (",
253
- pendingSteps,
254
- ")"
255
- ]
256
- }, undefined, true, undefined, this)
257
- ]
258
- }, undefined, true, undefined, this),
259
- /* @__PURE__ */ jsxDEV2(CardContent2, {
260
- className: "space-y-3",
261
- children: activeTips.map((step) => /* @__PURE__ */ jsxDEV2(TipCard, {
262
- step,
263
- isCompleted: false,
264
- isCurrent: step.id === activeTips[0]?.id,
265
- onComplete: () => onStepComplete?.(step.id)
266
- }, step.id, false, undefined, this))
267
- }, undefined, false, undefined, this)
268
- ]
269
- }, undefined, true, undefined, this),
270
- pendingSteps === 0 && /* @__PURE__ */ jsxDEV2(Card2, {
271
- className: "border-green-500/50 bg-green-500/5",
272
- children: /* @__PURE__ */ jsxDEV2(CardContent2, {
273
- className: "flex items-center gap-4 p-6",
274
- children: [
275
- /* @__PURE__ */ jsxDEV2("div", {
276
- className: "text-4xl",
277
- children: "\uD83C\uDF89"
278
- }, undefined, false, undefined, this),
279
- /* @__PURE__ */ jsxDEV2("div", {
280
- children: [
281
- /* @__PURE__ */ jsxDEV2("h3", {
282
- className: "font-semibold text-green-500 text-lg",
283
- children: "All Tips Actioned!"
284
- }, undefined, false, undefined, this),
285
- /* @__PURE__ */ jsxDEV2("p", {
286
- className: "text-muted-foreground",
287
- children: [
288
- "Great job! You've addressed all ",
289
- totalSteps,
290
- " coaching tips."
291
- ]
292
- }, undefined, true, undefined, this)
293
- ]
294
- }, undefined, true, undefined, this)
295
- ]
296
- }, undefined, true, undefined, this)
297
- }, undefined, false, undefined, this)
298
- ]
299
- }, undefined, true, undefined, this);
300
- }
301
- export {
302
- Overview
303
- };
1
+ import{Button as Z}from"@contractspec/lib.design-system";import{Card as N,CardContent as O}from"@contractspec/lib.ui-kit-web/ui/card";import{cn as Y}from"@contractspec/lib.ui-kit-web/ui/utils";import{jsx as A,jsxs as J}from"react/jsx-runtime";var $={cash_buffer_too_high:"\uD83D\uDCB0",no_savings_goal:"\uD83C\uDFAF",irregular_savings:"\uD83D\uDCC5",noise_late_evening:"\uD83D\uDD07",guest_frequency_high:"\uD83D\uDC65",shared_space_conflicts:"\uD83C\uDFE0",default:"\uD83D\uDCA1"};function w({step:q,isCompleted:y,isCurrent:K,onComplete:V,onDismiss:W}){let L=q.metadata?.tipId??"default",G=$[L]??$.default;return A(N,{className:Y("transition-all",y&&"opacity-60",K&&"ring-2 ring-amber-500"),children:A(O,{className:"p-4",children:J("div",{className:"flex gap-4",children:[A("div",{className:Y("flex h-12 w-12 shrink-0 items-center justify-center rounded-xl text-2xl",y?"bg-green-500/10":K?"bg-amber-500/10":"bg-muted"),children:y?"✓":G}),J("div",{className:"min-w-0 flex-1",children:[J("div",{className:"flex items-start justify-between gap-2",children:[A("h4",{className:"font-semibold",children:q.title}),q.xpReward&&J("span",{className:Y("shrink-0 rounded-full px-2 py-0.5 font-semibold text-xs",y?"bg-green-500/10 text-green-500":"bg-amber-500/10 text-amber-500"),children:["+",q.xpReward," XP"]})]}),A("p",{className:"mt-1 text-muted-foreground text-sm",children:q.description}),!y&&J("div",{className:"mt-3 flex flex-wrap gap-2",children:[A(Z,{size:"sm",onClick:V,children:"Take Action"}),A(Z,{variant:"outline",size:"sm",onClick:W,children:"Dismiss"})]}),y&&A("p",{className:"mt-2 text-green-500 text-sm",children:"✓ Tip acknowledged"})]})]})})})}import{StreakCounter as P,XpBar as X}from"@contractspec/example.learning-journey-ui-shared";import{Button as _}from"@contractspec/lib.design-system";import{Card as E,CardContent as F,CardHeader as R,CardTitle as U}from"@contractspec/lib.ui-kit-web/ui/card";import{jsx as f,jsxs as h}from"react/jsx-runtime";function u({track:q,progress:y,onStepComplete:K,onStart:V}){let W=q.totalXp??q.steps.reduce((z,D)=>z+(D.xpReward??0),0),L=y.completedStepIds.length,G=q.steps.length,M=G-L,Q=q.steps.filter((z)=>!y.completedStepIds.includes(z.id)).slice(0,3);return h("div",{className:"space-y-6",children:[f(E,{className:"overflow-hidden bg-gradient-to-br from-amber-500/10 via-orange-500/10 to-red-500/10",children:f(F,{className:"p-6",children:h("div",{className:"flex flex-col items-center gap-4 text-center md:flex-row md:text-left",children:[f("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-amber-500 to-orange-600 text-3xl shadow-lg",children:"\uD83D\uDCA1"}),h("div",{className:"flex-1",children:[f("h1",{className:"font-bold text-2xl",children:q.name}),f("p",{className:"mt-1 text-muted-foreground",children:q.description})]}),f("div",{className:"flex items-center gap-4",children:f(P,{days:y.streakDays,size:"lg"})})]})})}),h("div",{className:"grid gap-4 md:grid-cols-3",children:[h(E,{children:[f(R,{className:"pb-2",children:f(U,{className:"font-medium text-muted-foreground text-sm",children:"Active Tips"})}),h(F,{children:[f("div",{className:"font-bold text-3xl text-amber-500",children:M}),f("p",{className:"text-muted-foreground text-sm",children:"tips for you today"})]})]}),h(E,{children:[f(R,{className:"pb-2",children:f(U,{className:"font-medium text-muted-foreground text-sm",children:"Tips Actioned"})}),h(F,{children:[f("div",{className:"font-bold text-3xl text-green-500",children:L}),h("p",{className:"text-muted-foreground text-sm",children:["out of ",G," total"]})]})]}),h(E,{children:[f(R,{className:"pb-2",children:f(U,{className:"font-medium text-muted-foreground text-sm",children:"XP Earned"})}),h(F,{children:[f("div",{className:"font-bold text-3xl text-orange-500",children:y.xpEarned}),f(X,{current:y.xpEarned,max:W,showLabel:!1,size:"sm"})]})]})]}),Q.length>0&&h(E,{children:[h(R,{className:"flex flex-row items-center justify-between",children:[h(U,{className:"flex items-center gap-2",children:[f("span",{children:"\uD83D\uDCA1"}),f("span",{children:"Tips for You"})]}),Q.length<M&&h(_,{variant:"outline",size:"sm",onClick:V,children:["View All (",M,")"]})]}),f(F,{className:"space-y-3",children:Q.map((z)=>f(w,{step:z,isCompleted:!1,isCurrent:z.id===Q[0]?.id,onComplete:()=>K?.(z.id)},z.id))})]}),M===0&&f(E,{className:"border-green-500/50 bg-green-500/5",children:h(F,{className:"flex items-center gap-4 p-6",children:[f("div",{className:"text-4xl",children:"\uD83C\uDF89"}),h("div",{children:[f("h3",{className:"font-semibold text-green-500 text-lg",children:"All Tips Actioned!"}),h("p",{className:"text-muted-foreground",children:["Great job! You've addressed all ",G," coaching tips."]})]})]})})]})}export{u as Overview};