@titan-design/react-ui 0.2.6 → 0.3.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/dist/bodymap-BhG55xHM.d.mts +318 -0
- package/dist/bodymap-BhG55xHM.d.ts +318 -0
- package/dist/bodymap.d.mts +3 -0
- package/dist/bodymap.d.ts +3 -0
- package/dist/bodymap.js +2670 -0
- package/dist/bodymap.js.map +1 -0
- package/dist/bodymap.mjs +1101 -0
- package/dist/bodymap.mjs.map +1 -0
- package/dist/{chunk-UXVRPOME.mjs → chunk-7XPB4NAO.mjs} +125 -785
- package/dist/chunk-7XPB4NAO.mjs.map +1 -0
- package/dist/chunk-P7TSQUN6.mjs +846 -0
- package/dist/chunk-P7TSQUN6.mjs.map +1 -0
- package/dist/chunk-TOD2WQBG.mjs +1048 -0
- package/dist/chunk-TOD2WQBG.mjs.map +1 -0
- package/dist/index.d.mts +1131 -4
- package/dist/index.d.ts +1131 -4
- package/dist/index.js +6396 -225
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5572 -641
- package/dist/index.mjs.map +1 -1
- package/dist/theme/index.d.mts +317 -1
- package/dist/theme/index.d.ts +317 -1
- package/dist/theme/index.js +185 -2
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/index.mjs +2 -1
- package/dist/theme/tokens-css.d.mts +20 -0
- package/dist/theme/tokens-css.d.ts +20 -0
- package/dist/theme/tokens-css.js +598 -0
- package/dist/theme/tokens-css.js.map +1 -0
- package/dist/theme/tokens-css.mjs +24 -0
- package/dist/theme/tokens-css.mjs.map +1 -0
- package/package.json +25 -5
- package/src/bodymap.ts +37 -0
- package/src/components/custom/DateTime/DateTime.stories.tsx +1 -1
- package/src/components/custom/Gauge/Gauge.stories.tsx +45 -0
- package/src/components/custom/Gauge/Gauge.test.tsx +71 -0
- package/src/components/custom/Gauge/Gauge.tsx +167 -0
- package/src/components/custom/Gauge/index.ts +2 -0
- package/src/components/custom/Scatter/Scatter.stories.tsx +85 -0
- package/src/components/custom/Scatter/Scatter.test.tsx +96 -0
- package/src/components/custom/Scatter/Scatter.tsx +260 -0
- package/src/components/custom/Scatter/index.ts +2 -0
- package/src/components/custom/Sidebar/Sidebar.tsx +1 -1
- package/src/components/custom/Table/Table.test.tsx +27 -0
- package/src/components/custom/Table/Table.tsx +33 -17
- package/src/components/custom/Treemap/Treemap.stories.tsx +60 -0
- package/src/components/custom/Treemap/Treemap.test.tsx +67 -0
- package/src/components/custom/Treemap/Treemap.tsx +192 -0
- package/src/components/custom/Treemap/index.ts +2 -0
- package/src/components/custom/Workout/ActiveWorkoutPage.stories.tsx +118 -0
- package/src/components/custom/Workout/ActiveWorkoutPage.test.tsx +171 -0
- package/src/components/custom/Workout/ActiveWorkoutPage.tsx +447 -0
- package/src/components/custom/Workout/BaseBadge.stories.tsx +75 -0
- package/src/components/custom/Workout/BaseBadge.test.tsx +102 -0
- package/src/components/custom/Workout/BaseBadge.tsx +113 -0
- package/src/components/custom/Workout/BodyMap.stories.tsx +121 -0
- package/src/components/custom/Workout/BodyMap.test.tsx +124 -0
- package/src/components/custom/Workout/BodyMap.tsx +347 -0
- package/src/components/custom/Workout/BodyMapDetailPanel.stories.tsx +171 -0
- package/src/components/custom/Workout/BodyMapDetailPanel.test.tsx +225 -0
- package/src/components/custom/Workout/BodyMapDetailPanel.tsx +477 -0
- package/src/components/custom/Workout/CapacityBandChart.stories.tsx +125 -0
- package/src/components/custom/Workout/CapacityBandChart.test.tsx +193 -0
- package/src/components/custom/Workout/CapacityBandChart.tsx +493 -0
- package/src/components/custom/Workout/DeviationBar.stories.tsx +58 -0
- package/src/components/custom/Workout/DeviationBar.test.tsx +86 -0
- package/src/components/custom/Workout/DeviationBar.tsx +78 -0
- package/src/components/custom/Workout/ExerciseCard.stories.tsx +186 -0
- package/src/components/custom/Workout/ExerciseCard.test.tsx +343 -0
- package/src/components/custom/Workout/ExerciseCard.tsx +442 -0
- package/src/components/custom/Workout/ExerciseDetailPage.stories.tsx +225 -0
- package/src/components/custom/Workout/ExerciseDetailPage.test.tsx +128 -0
- package/src/components/custom/Workout/ExerciseDetailPage.tsx +630 -0
- package/src/components/custom/Workout/InputBar.stories.tsx +75 -0
- package/src/components/custom/Workout/InputBar.test.tsx +116 -0
- package/src/components/custom/Workout/InputBar.tsx +162 -0
- package/src/components/custom/Workout/IntensityBar.stories.tsx +60 -0
- package/src/components/custom/Workout/IntensityBar.test.tsx +113 -0
- package/src/components/custom/Workout/IntensityBar.tsx +166 -0
- package/src/components/custom/Workout/MesoCard.stories.tsx +152 -0
- package/src/components/custom/Workout/MesoCard.test.tsx +170 -0
- package/src/components/custom/Workout/MesoCard.tsx +237 -0
- package/src/components/custom/Workout/MesoProgressBar.stories.tsx +85 -0
- package/src/components/custom/Workout/MesoProgressBar.test.tsx +153 -0
- package/src/components/custom/Workout/MesoProgressBar.tsx +165 -0
- package/src/components/custom/Workout/MesoStatusCard.stories.tsx +126 -0
- package/src/components/custom/Workout/MesoStatusCard.test.tsx +209 -0
- package/src/components/custom/Workout/MesoStatusCard.tsx +456 -0
- package/src/components/custom/Workout/MuscleGroupChip.stories.tsx +118 -0
- package/src/components/custom/Workout/MuscleGroupChip.test.tsx +91 -0
- package/src/components/custom/Workout/MuscleGroupChip.tsx +92 -0
- package/src/components/custom/Workout/PlaceholderStrip.stories.tsx +94 -0
- package/src/components/custom/Workout/PlaceholderStrip.test.tsx +83 -0
- package/src/components/custom/Workout/PlaceholderStrip.tsx +90 -0
- package/src/components/custom/Workout/PrBadge.stories.tsx +105 -0
- package/src/components/custom/Workout/PrBadge.test.tsx +111 -0
- package/src/components/custom/Workout/PrBadge.tsx +103 -0
- package/src/components/custom/Workout/PrHistoryModal.stories.tsx +116 -0
- package/src/components/custom/Workout/PrHistoryModal.test.tsx +161 -0
- package/src/components/custom/Workout/PrHistoryModal.tsx +244 -0
- package/src/components/custom/Workout/ProgramPlanningPage.stories.tsx +257 -0
- package/src/components/custom/Workout/ProgramPlanningPage.test.tsx +142 -0
- package/src/components/custom/Workout/ProgramPlanningPage.tsx +422 -0
- package/src/components/custom/Workout/ReadinessCheck.stories.tsx +126 -0
- package/src/components/custom/Workout/ReadinessCheck.test.tsx +181 -0
- package/src/components/custom/Workout/ReadinessCheck.tsx +265 -0
- package/src/components/custom/Workout/RestTimer.test.tsx +10 -0
- package/src/components/custom/Workout/RestTimer.tsx +15 -11
- package/src/components/custom/Workout/SetRow.stories.tsx +165 -0
- package/src/components/custom/Workout/SetRow.test.tsx +222 -0
- package/src/components/custom/Workout/SetRow.tsx +247 -0
- package/src/components/custom/Workout/Sparkline.stories.tsx +125 -0
- package/src/components/custom/Workout/Sparkline.test.tsx +113 -0
- package/src/components/custom/Workout/Sparkline.tsx +188 -0
- package/src/components/custom/Workout/StatusDot.stories.tsx +150 -0
- package/src/components/custom/Workout/StatusDot.test.tsx +165 -0
- package/src/components/custom/Workout/StatusDot.tsx +160 -0
- package/src/components/custom/Workout/StrengthTrendChart.stories.tsx +130 -0
- package/src/components/custom/Workout/StrengthTrendChart.test.tsx +217 -0
- package/src/components/custom/Workout/StrengthTrendChart.tsx +628 -0
- package/src/components/custom/Workout/SupersetWrapper.tsx +1 -2
- package/src/components/custom/Workout/TempoDisplay.stories.tsx +66 -0
- package/src/components/custom/Workout/TempoDisplay.test.tsx +90 -0
- package/src/components/custom/Workout/TempoDisplay.tsx +209 -0
- package/src/components/custom/Workout/TrainingStatusPage.stories.tsx +212 -0
- package/src/components/custom/Workout/TrainingStatusPage.test.tsx +131 -0
- package/src/components/custom/Workout/TrainingStatusPage.tsx +321 -0
- package/src/components/custom/Workout/VelocityStrip.stories.tsx +125 -0
- package/src/components/custom/Workout/VelocityStrip.test.tsx +244 -0
- package/src/components/custom/Workout/VelocityStrip.tsx +288 -0
- package/src/components/custom/Workout/WeekRow.stories.tsx +121 -0
- package/src/components/custom/Workout/WeekRow.test.tsx +117 -0
- package/src/components/custom/Workout/WeekRow.tsx +140 -0
- package/src/components/custom/Workout/WeightBadge.stories.tsx +87 -0
- package/src/components/custom/Workout/WeightBadge.test.tsx +164 -0
- package/src/components/custom/Workout/WeightBadge.tsx +113 -0
- package/src/components/custom/Workout/WorkoutCard.stories.tsx +135 -0
- package/src/components/custom/Workout/WorkoutCard.test.tsx +172 -0
- package/src/components/custom/Workout/WorkoutCard.tsx +228 -0
- package/src/components/custom/Workout/WorkoutPill.stories.tsx +63 -0
- package/src/components/custom/Workout/WorkoutPill.test.tsx +153 -0
- package/src/components/custom/Workout/WorkoutPill.tsx +177 -0
- package/src/components/custom/Workout/index.ts +152 -0
- package/src/components/custom/Workout/muscleTaxonomy.ts +252 -0
- package/src/components/custom/index.ts +3 -0
- package/src/components/custom/stepper/Stepper.stories.tsx +1 -1
- package/src/components/custom/stepper/Stepper.tsx +2 -2
- package/src/components/ui/autocomplete/Autocomplete.stories.tsx +1 -1
- package/src/components/ui/autocomplete/Autocomplete.tsx +1 -1
- package/src/components/ui/card/Card.tsx +1 -1
- package/src/components/ui/checkbox/Checkbox.tsx +1 -1
- package/src/components/ui/collapse/Collapse.tsx +1 -1
- package/src/components/ui/data-row/DataRow.stories.tsx +1 -1
- package/src/components/ui/drawer/Drawer.tsx +3 -3
- package/src/components/ui/form-field/FormField.tsx +1 -1
- package/src/components/ui/help-tip/HelpTip.tsx +1 -1
- package/src/components/ui/menu/Menu.tsx +2 -2
- package/src/components/ui/pill/Pill.tsx +1 -1
- package/src/components/ui/popover/Popover.stories.tsx +2 -2
- package/src/components/ui/popover/Popover.tsx +1 -1
- package/src/components/ui/radio/Radio.stories.tsx +1 -1
- package/src/components/ui/section/Section.stories.tsx +4 -4
- package/src/components/ui/select/Select.tsx +1 -1
- package/src/components/ui/stack/Stack.stories.tsx +4 -4
- package/src/components/ui/tabs/Tabs.tsx +2 -2
- package/src/components/ui/toolbar-button/ToolbarButton.stories.tsx +1 -1
- package/src/components/ui/toolbar-button/ToolbarButton.tsx +1 -1
- package/src/examples/react-hook-form/ControlledFields.tsx +171 -0
- package/src/examples/react-hook-form/ReactHookForm.stories.tsx +51 -0
- package/src/examples/react-hook-form/ReactHookForm.test.tsx +61 -0
- package/src/examples/react-hook-form/RhfContactForm.tsx +99 -0
- package/src/stories/PresetShowcase.stories.tsx +15 -15
- package/src/theme/config.completeness.test.ts +77 -0
- package/src/theme/config.ts +151 -0
- package/src/theme/index.ts +2 -1
- package/src/theme/manifest/css-property-manifest.example.json +79 -0
- package/src/theme/manifest/css-property-manifest.schema.json +93 -0
- package/src/theme/manifest/css-property-manifest.test.ts +81 -0
- package/src/theme/manifest/css-property-manifest.types.ts +49 -0
- package/src/theme/manifest/css-property-manifest.validate.ts +84 -0
- package/src/theme/manifest/design-freeze.test.ts +155 -0
- package/src/theme/manifest/extract-css-properties.fixture.html +29 -0
- package/src/theme/manifest/extract-css-properties.test.ts +112 -0
- package/src/theme/manifest/index.ts +11 -0
- package/src/theme/tokens-css.test.ts +28 -0
- package/src/theme/tokens-css.ts +36 -0
- package/src/theme/workout-tokens.ts +59 -0
- package/src/utils/index.ts +10 -0
- package/src/utils/workout-format.test.ts +81 -0
- package/src/utils/workout-format.ts +83 -0
- package/dist/chunk-UXVRPOME.mjs.map +0 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/react'
|
|
3
|
+
import {
|
|
4
|
+
ExerciseDetailPage,
|
|
5
|
+
deriveExerciseStats,
|
|
6
|
+
toExerciseCardProps,
|
|
7
|
+
summarizeVbt,
|
|
8
|
+
type ExerciseDetailEntry,
|
|
9
|
+
type ExerciseDetailPageProps,
|
|
10
|
+
} from './ExerciseDetailPage'
|
|
11
|
+
|
|
12
|
+
const entry = (id: string, weight: number, e1rm: number, isPR = false): ExerciseDetailEntry => ({
|
|
13
|
+
id,
|
|
14
|
+
title: `Session ${id}`,
|
|
15
|
+
summary: { sets: 3, reps: 8, weight, unit: 'lbs' },
|
|
16
|
+
e1rm: { value: e1rm, unit: 'lbs' },
|
|
17
|
+
isPR,
|
|
18
|
+
sets: [
|
|
19
|
+
{ mode: 'history', setNumber: 1, reps: 8, weight, rpe: 8, unit: 'lbs' },
|
|
20
|
+
{ mode: 'history', setNumber: 2, reps: 8, weight, rpe: 8.5, unit: 'lbs' },
|
|
21
|
+
],
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const history: ExerciseDetailEntry[] = [
|
|
25
|
+
entry('a', 195, 248, true),
|
|
26
|
+
entry('b', 185, 235),
|
|
27
|
+
entry('c', 175, 222),
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
const baseProps: ExerciseDetailPageProps = {
|
|
31
|
+
exercise: { name: 'Bench Press', subtitle: 'Chest · Barbell', unit: 'lbs', currentE1rm: 248 },
|
|
32
|
+
meso: {
|
|
33
|
+
mesoName: 'Hypertrophy',
|
|
34
|
+
mesoSubtitle: 'Week 6 of 8',
|
|
35
|
+
statusBadge: { label: 'On Track', variant: 'success' },
|
|
36
|
+
metrics: [{ label: 'Actual', value: '4×8' }],
|
|
37
|
+
gauges: [{ label: 'Intensity', level: 0.7 }],
|
|
38
|
+
},
|
|
39
|
+
trend: {
|
|
40
|
+
data: [
|
|
41
|
+
{ date: '2026-05-12', e1rm: 222 },
|
|
42
|
+
{ date: '2026-06-16', e1rm: 248, isPR: true },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
progression: [entry('w1', 175, 222), entry('w2', 195, 248, true)],
|
|
46
|
+
history,
|
|
47
|
+
vbt: {
|
|
48
|
+
band: [{ date: '2026-05-12', bandLow: 40, bandHigh: 70 }],
|
|
49
|
+
workouts: [{ date: '2026-05-12', load: 52, status: 'within' }],
|
|
50
|
+
sets: [
|
|
51
|
+
{ label: 'Set 1', velocities: [0.7, 0.6, 0.5] },
|
|
52
|
+
{ label: 'Set 2', velocities: [0.68, 0.5, 0.34] },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
describe('deriveExerciseStats', () => {
|
|
58
|
+
it('counts sessions, tracks the best e1RM, and tallies PRs', () => {
|
|
59
|
+
expect(deriveExerciseStats(history)).toEqual({ sessions: 3, bestE1rm: 248, prCount: 1 })
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('returns a null best e1RM for an empty history', () => {
|
|
63
|
+
expect(deriveExerciseStats([])).toEqual({ sessions: 0, bestE1rm: null, prCount: 0 })
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
describe('toExerciseCardProps', () => {
|
|
68
|
+
it('collapses without sets and expands with them', () => {
|
|
69
|
+
const collapsed = toExerciseCardProps(history[0], false, () => {})
|
|
70
|
+
expect(collapsed.state).toBe('collapsed')
|
|
71
|
+
expect(collapsed.sets).toBeUndefined()
|
|
72
|
+
|
|
73
|
+
const expanded = toExerciseCardProps(history[0], true, () => {})
|
|
74
|
+
expect(expanded.state).toBe('expanded')
|
|
75
|
+
expect(expanded.sets).toHaveLength(2)
|
|
76
|
+
expect(expanded.name).toBe('Session a')
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
describe('summarizeVbt', () => {
|
|
81
|
+
it('averages every rep and reports the worst within-set loss', () => {
|
|
82
|
+
const summary = summarizeVbt([
|
|
83
|
+
{ label: 'Set 1', velocities: [1, 0.5] },
|
|
84
|
+
{ label: 'Set 2', velocities: [1, 0.25] },
|
|
85
|
+
])
|
|
86
|
+
expect(summary.meanVelocity).toBeCloseTo(0.6875)
|
|
87
|
+
expect(summary.velocityLoss).toBe(75)
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it('is zeroed for no sets', () => {
|
|
91
|
+
expect(summarizeVbt([])).toEqual({ meanVelocity: 0, velocityLoss: 0 })
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
describe('ExerciseDetailPage', () => {
|
|
96
|
+
it('renders the header and opens on the Progress tab', () => {
|
|
97
|
+
render(<ExerciseDetailPage {...baseProps} />)
|
|
98
|
+
expect(screen.getByTestId('exercise-detail-page')).toBeInTheDocument()
|
|
99
|
+
expect(screen.getByTestId('exercise-detail-page-title')).toHaveTextContent('Bench Press')
|
|
100
|
+
expect(screen.getByTestId('exercise-detail-page-panel-progress')).toBeInTheDocument()
|
|
101
|
+
expect(screen.getByTestId('meso-status-card')).toBeInTheDocument()
|
|
102
|
+
expect(screen.getByTestId('exercise-detail-page-stat-sessions')).toHaveTextContent('3')
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
it('switches tabs to reveal history and advanced panels', () => {
|
|
106
|
+
render(<ExerciseDetailPage {...baseProps} />)
|
|
107
|
+
|
|
108
|
+
fireEvent.click(screen.getByTestId('exercise-detail-page-tab-history'))
|
|
109
|
+
expect(screen.getByTestId('exercise-detail-page-panel-history')).toBeInTheDocument()
|
|
110
|
+
expect(screen.queryByTestId('exercise-detail-page-panel-progress')).not.toBeInTheDocument()
|
|
111
|
+
|
|
112
|
+
fireEvent.click(screen.getByTestId('exercise-detail-page-tab-advanced'))
|
|
113
|
+
expect(screen.getByTestId('exercise-detail-page-panel-advanced')).toBeInTheDocument()
|
|
114
|
+
expect(screen.getByTestId('exercise-detail-page-vbt-summary')).toBeInTheDocument()
|
|
115
|
+
expect(screen.getAllByTestId('exercise-detail-page-vbt-set')).toHaveLength(2)
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it('inline-expands a progression entry to reveal its sets', () => {
|
|
119
|
+
render(<ExerciseDetailPage {...baseProps} />)
|
|
120
|
+
expect(screen.queryByTestId('exercise-card-sets')).not.toBeInTheDocument()
|
|
121
|
+
|
|
122
|
+
fireEvent.click(screen.getAllByTestId('exercise-card')[0])
|
|
123
|
+
expect(screen.getByTestId('exercise-card-sets')).toBeInTheDocument()
|
|
124
|
+
|
|
125
|
+
fireEvent.click(screen.getAllByTestId('exercise-card-header')[0])
|
|
126
|
+
expect(screen.queryByTestId('exercise-card-sets')).not.toBeInTheDocument()
|
|
127
|
+
})
|
|
128
|
+
})
|