astro-component-kit 0.3.1 → 0.4.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.
Files changed (115) hide show
  1. package/README.md +33 -14
  2. package/package.json +2 -2
  3. package/src/components/index.ts +16 -202
  4. package/src/components/lib/buttons/NeonBorderButton.astro +162 -0
  5. package/src/components/lib/buttons/RippleButton.astro +199 -0
  6. package/src/components/lib/buttons/SlideRevealButton.astro +159 -0
  7. package/src/components/lib/buttons/index.ts +4 -0
  8. package/src/components/lib/cards/GithubRepoCard.astro +176 -0
  9. package/src/components/lib/cards/PricingCompareMiniCard.astro +196 -0
  10. package/src/components/lib/cards/StatsTrendCard.astro +149 -0
  11. package/src/components/lib/cards/index.ts +3 -0
  12. package/src/components/lib/charts/ActivityRings.astro +105 -0
  13. package/src/components/lib/charts/BoxPlotChart.astro +109 -0
  14. package/src/components/lib/charts/BubbleChart.astro +101 -0
  15. package/src/components/lib/charts/BulletChart.astro +160 -0
  16. package/src/components/lib/charts/BumpChart.astro +92 -0
  17. package/src/components/lib/charts/CandlestickChart.astro +105 -0
  18. package/src/components/lib/charts/ChartFrame.astro +373 -0
  19. package/src/components/lib/charts/DivergingBarChart.astro +98 -0
  20. package/src/components/lib/charts/DumbbellChart.astro +92 -0
  21. package/src/components/lib/charts/ForecastLineChart.astro +125 -0
  22. package/src/components/lib/charts/FunnelChart.astro +122 -0
  23. package/src/components/lib/charts/GaugeChart.astro +111 -0
  24. package/src/components/lib/charts/GoalProgressChart.astro +97 -0
  25. package/src/components/lib/charts/GroupedBarChart.astro +125 -0
  26. package/src/components/lib/charts/HeatmapChart.astro +131 -0
  27. package/src/components/lib/charts/HistogramChart.astro +111 -0
  28. package/src/components/lib/charts/HorizontalBarChart.astro +155 -0
  29. package/src/components/lib/charts/KpiStatTile.astro +116 -0
  30. package/src/components/lib/charts/KpiTrendGrid.astro +60 -0
  31. package/src/components/lib/charts/LineChart.astro +160 -0
  32. package/src/components/lib/charts/LinearProgressGauge.astro +136 -0
  33. package/src/components/lib/charts/LollipopChart.astro +100 -0
  34. package/src/components/lib/charts/MeterGauge.astro +122 -0
  35. package/src/components/lib/charts/MetricDeltaTable.astro +125 -0
  36. package/src/components/lib/charts/PieChart.astro +135 -0
  37. package/src/components/lib/charts/PolarAreaChart.astro +85 -0
  38. package/src/components/lib/charts/PopulationPyramid.astro +122 -0
  39. package/src/components/lib/charts/PunchCardChart.astro +89 -0
  40. package/src/components/lib/charts/RadarChart.astro +94 -0
  41. package/src/components/lib/charts/RadarMetricChart.astro +168 -0
  42. package/src/components/lib/charts/RadialBarChart.astro +124 -0
  43. package/src/components/lib/charts/RangeAreaChart.astro +113 -0
  44. package/src/components/lib/charts/RetentionCohortTable.astro +126 -0
  45. package/src/components/lib/charts/SankeyChart.astro +128 -0
  46. package/src/components/lib/charts/ScatterPlot.astro +139 -0
  47. package/src/components/lib/charts/SegmentedBarChart.astro +119 -0
  48. package/src/components/lib/charts/SlopeChart.astro +105 -0
  49. package/src/components/lib/charts/SparklineChart.astro +87 -0
  50. package/src/components/lib/charts/StackedAreaChart.astro +130 -0
  51. package/src/components/lib/charts/StackedBarChart.astro +136 -0
  52. package/src/components/lib/charts/SunburstChart.astro +103 -0
  53. package/src/components/lib/charts/TreemapChart.astro +94 -0
  54. package/src/components/lib/charts/WaffleChart.astro +121 -0
  55. package/src/components/lib/charts/WaterfallChart.astro +118 -0
  56. package/src/components/lib/charts/chart-tooltip.ts +75 -0
  57. package/src/components/lib/charts/chart-utils.ts +271 -0
  58. package/src/components/lib/charts/index.ts +46 -0
  59. package/src/components/lib/data/ActivityHeatmapGrid.astro +157 -0
  60. package/src/components/lib/data/MetricComparisonRow.astro +109 -0
  61. package/src/components/lib/data/StatusTimelineFeed.astro +168 -0
  62. package/src/components/lib/data/index.ts +3 -0
  63. package/src/components/lib/feedback/ProgressRingCounter.astro +118 -0
  64. package/src/components/lib/feedback/ToastNotificationGroup.astro +173 -0
  65. package/src/components/lib/feedback/index.ts +2 -0
  66. package/src/components/lib/forms/GlassInlineToggleGroup.astro +161 -0
  67. package/src/components/lib/forms/PasswordStrengthInput.astro +242 -0
  68. package/src/components/lib/forms/PhoneCountryInput.astro +145 -0
  69. package/src/components/lib/forms/TagsAutocompleteInput.astro +249 -0
  70. package/src/components/lib/forms/index.ts +5 -0
  71. package/src/components/lib/layout/DiagonalSectionDivider.astro +69 -0
  72. package/src/components/lib/layout/HolyGrailGrid.astro +125 -0
  73. package/src/components/lib/layout/index.ts +3 -1
  74. package/src/components/lib/navigation/QuickJumpDock.astro +125 -0
  75. package/src/components/lib/navigation/StepBreadcrumbBar.astro +151 -0
  76. package/src/components/lib/navigation/SubNavbarPills.astro +102 -0
  77. package/src/components/lib/navigation/index.ts +3 -0
  78. package/src/components/lib/overlays/CookiePreferencesDrawer.astro +226 -0
  79. package/src/components/lib/overlays/FloatingFeedbackWidget.astro +203 -0
  80. package/src/components/lib/overlays/ImageCompareSlider.astro +172 -0
  81. package/src/components/lib/overlays/index.ts +3 -0
  82. package/src/components/lib/sections/BlogGridSection.astro +131 -0
  83. package/src/components/lib/sections/CareersOpenings.astro +139 -0
  84. package/src/components/lib/sections/ChangelogSection.astro +144 -0
  85. package/src/components/lib/sections/ContactSplitMap.astro +139 -0
  86. package/src/components/lib/sections/CtaNewsletterSection.astro +163 -0
  87. package/src/components/lib/sections/CtaSplitImage.astro +147 -0
  88. package/src/components/lib/sections/FaqTwoColumn.astro +119 -0
  89. package/src/components/lib/sections/FeatureAlternatingRows.astro +190 -0
  90. package/src/components/lib/sections/FeatureIconGrid.astro +155 -0
  91. package/src/components/lib/sections/FeatureTabsShowcase.astro +180 -0
  92. package/src/components/lib/sections/FooterMegaSection.astro +155 -0
  93. package/src/components/lib/sections/HeroDashboardPreview.astro +180 -0
  94. package/src/components/lib/sections/HeroMinimalCentered.astro +175 -0
  95. package/src/components/lib/sections/HeroShowcaseSplit.astro +304 -0
  96. package/src/components/lib/sections/HeroTerminal.astro +251 -0
  97. package/src/components/lib/sections/HeroWaitlist.astro +229 -0
  98. package/src/components/lib/sections/HowItWorksSteps.astro +178 -0
  99. package/src/components/lib/sections/IntegrationsGrid.astro +167 -0
  100. package/src/components/lib/sections/LogoCloudSection.astro +96 -0
  101. package/src/components/lib/sections/LogoWallGrid.astro +91 -0
  102. package/src/components/lib/sections/PricingSinglePlan.astro +157 -0
  103. package/src/components/lib/sections/PricingToggleCards.astro +171 -0
  104. package/src/components/lib/sections/StatsCounterBand.astro +122 -0
  105. package/src/components/lib/sections/StatsDashboardSection.astro +83 -0
  106. package/src/components/lib/sections/TestimonialCarousel.astro +165 -0
  107. package/src/components/lib/sections/TestimonialFeatured.astro +120 -0
  108. package/src/components/lib/sections/TestimonialGridSection.astro +188 -0
  109. package/src/components/lib/sections/index.ts +29 -0
  110. package/src/components/lib/typography/AnimatedCounterText.astro +102 -0
  111. package/src/components/lib/typography/CurvedPathHeading.astro +86 -0
  112. package/src/components/lib/typography/GradientTextMarquee.astro +105 -0
  113. package/src/components/lib/typography/HackerDecodeText.astro +85 -0
  114. package/src/components/lib/typography/index.ts +4 -0
  115. package/src/styles/global.css +18 -1
@@ -0,0 +1,196 @@
1
+ ---
2
+ /**
3
+ * PricingCompareMiniCard — High-conversion mini pricing card with plan perks, price tier, and action button.
4
+ *
5
+ * @param {string} planName - Plan name (e.g. 'Pro Developer').
6
+ * @param {string} price - Price figure (e.g. '$29').
7
+ * @param {string} period - Frequency string (e.g. '/month').
8
+ * @param {string} description - Plan highlight subtitle.
9
+ * @param {string[]} features - List of plan feature bullet points.
10
+ * @param {boolean} featured - Whether the card is visually emphasized.
11
+ * @param {string} ctaText - Label for the call to action button. Default is 'Get Started'.
12
+ * @param {string} ctaHref - Link URL for the button.
13
+ */
14
+ interface Props {
15
+ planName: string;
16
+ price: string;
17
+ period?: string;
18
+ description?: string;
19
+ features?: string[];
20
+ featured?: boolean;
21
+ ctaText?: string;
22
+ ctaHref?: string;
23
+ }
24
+
25
+ const {
26
+ planName = 'Pro Developer',
27
+ price = '$29',
28
+ period = '/month',
29
+ description = 'For growing teams and fast production workflows.',
30
+ features = [
31
+ 'Unlimited UI components',
32
+ 'Full source code access',
33
+ 'Commercial license',
34
+ 'Community Discord support',
35
+ ],
36
+ featured = false,
37
+ ctaText = 'Get Started',
38
+ ctaHref = '#',
39
+ } = Astro.props;
40
+ ---
41
+
42
+ <div class:list={['mini-price-card', { 'mini-price-card--featured': featured }]}>
43
+ {featured && <span class="mini-price-card__badge">Most Popular</span>}
44
+
45
+ <div class="mini-price-card__header">
46
+ <h3 class="mini-price-card__plan">{planName}</h3>
47
+ <p class="mini-price-card__desc">{description}</p>
48
+ <div class="mini-price-card__amount">
49
+ <span class="val">{price}</span>
50
+ <span class="period">{period}</span>
51
+ </div>
52
+ </div>
53
+
54
+ <ul class="mini-price-card__features">
55
+ {features.map((feat) => (
56
+ <li class="mini-price-card__feature">
57
+ <svg class="check-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
58
+ <polyline points="20 6 9 17 4 12" />
59
+ </svg>
60
+ <span>{feat}</span>
61
+ </li>
62
+ ))}
63
+ </ul>
64
+
65
+ <a href={ctaHref} class="mini-price-card__btn">
66
+ {ctaText}
67
+ <span aria-hidden="true">→</span>
68
+ </a>
69
+ </div>
70
+
71
+ <style>
72
+ .mini-price-card {
73
+ position: relative;
74
+ display: flex;
75
+ flex-direction: column;
76
+ padding: var(--sp-6, 1.5rem);
77
+ background: rgba(255, 255, 255, 0.02);
78
+ backdrop-filter: blur(20px);
79
+ border: 1px solid rgba(255, 255, 255, 0.08);
80
+ border-radius: var(--r-xl, 24px);
81
+ width: 100%;
82
+ max-width: 320px;
83
+ font-family: var(--font-sans, system-ui, sans-serif);
84
+ transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
85
+ }
86
+
87
+ .mini-price-card:hover {
88
+ transform: translateY(-4px);
89
+ border-color: rgba(184, 134, 11, 0.3);
90
+ box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
91
+ }
92
+
93
+ .mini-price-card--featured {
94
+ border-color: rgba(184, 134, 11, 0.5);
95
+ background: radial-gradient(circle at top, rgba(184, 134, 11, 0.12), rgba(255, 255, 255, 0.02) 60%);
96
+ box-shadow: 0 12px 36px rgba(184, 134, 11, 0.15);
97
+ }
98
+
99
+ .mini-price-card__badge {
100
+ position: absolute;
101
+ top: -12px;
102
+ right: 20px;
103
+ background: linear-gradient(135deg, #d4a017, #b8860b);
104
+ color: #050505;
105
+ font-size: 0.72rem;
106
+ font-weight: 800;
107
+ text-transform: uppercase;
108
+ letter-spacing: 0.06em;
109
+ padding: 0.25rem 0.75rem;
110
+ border-radius: var(--r-full, 9999px);
111
+ box-shadow: 0 4px 12px rgba(184, 134, 11, 0.4);
112
+ }
113
+
114
+ .mini-price-card__plan {
115
+ font-size: 1.15rem;
116
+ font-weight: 800;
117
+ color: var(--c-text-1, #ffffff);
118
+ margin: 0;
119
+ }
120
+
121
+ .mini-price-card__desc {
122
+ font-size: 0.8rem;
123
+ color: var(--c-text-2, #a3a3a3);
124
+ margin: 4px 0 16px 0;
125
+ line-height: 1.45;
126
+ }
127
+
128
+ .mini-price-card__amount {
129
+ display: flex;
130
+ align-items: baseline;
131
+ gap: 4px;
132
+ margin-bottom: var(--sp-4, 1rem);
133
+ padding-bottom: var(--sp-4, 1rem);
134
+ border-bottom: 1px solid rgba(255, 255, 255, 0.06);
135
+ }
136
+
137
+ .mini-price-card__amount .val {
138
+ font-size: 2.2rem;
139
+ font-weight: 900;
140
+ color: var(--c-text-1, #ffffff);
141
+ letter-spacing: -0.03em;
142
+ }
143
+
144
+ .mini-price-card__amount .period {
145
+ font-size: 0.82rem;
146
+ color: var(--c-text-3, #737373);
147
+ }
148
+
149
+ .mini-price-card__features {
150
+ list-style: none;
151
+ display: flex;
152
+ flex-direction: column;
153
+ gap: 10px;
154
+ margin: 0 0 24px 0;
155
+ padding: 0;
156
+ flex: 1;
157
+ }
158
+
159
+ .mini-price-card__feature {
160
+ display: flex;
161
+ align-items: center;
162
+ gap: 10px;
163
+ font-size: 0.82rem;
164
+ color: var(--c-text-2, #a3a3a3);
165
+ }
166
+
167
+ .check-icon {
168
+ color: var(--c-primary-light, #d4a017);
169
+ flex-shrink: 0;
170
+ }
171
+
172
+ .mini-price-card__btn {
173
+ display: inline-flex;
174
+ align-items: center;
175
+ justify-content: center;
176
+ gap: 8px;
177
+ width: 100%;
178
+ padding: 0.75rem;
179
+ background: rgba(255, 255, 255, 0.06);
180
+ color: var(--c-text-1, #ffffff);
181
+ font-size: 0.88rem;
182
+ font-weight: 700;
183
+ text-decoration: none;
184
+ border-radius: var(--r-md, 12px);
185
+ border: 1px solid rgba(255, 255, 255, 0.1);
186
+ transition: all 0.25s ease;
187
+ }
188
+
189
+ .mini-price-card--featured .mini-price-card__btn,
190
+ .mini-price-card__btn:hover {
191
+ background: linear-gradient(135deg, #d4a017, #b8860b);
192
+ color: #050505;
193
+ border-color: transparent;
194
+ box-shadow: 0 6px 20px rgba(184, 134, 11, 0.35);
195
+ }
196
+ </style>
@@ -0,0 +1,149 @@
1
+ ---
2
+ /**
3
+ * StatsTrendCard — Compact KPI metric card featuring delta percentages, trend directions, and mini activity bars.
4
+ *
5
+ * @param {string} label - Metric name (e.g. 'Active Users').
6
+ * @param {string} value - Formatted value figure (e.g. '42,850').
7
+ * @param {string} change - Delta percentage string (e.g. '+18.4%').
8
+ * @param {'up' | 'down' | 'neutral'} trend - Direction of the trend. Default is 'up'.
9
+ * @param {string} timeframe - Timeframe subtitle (e.g. 'vs last month').
10
+ */
11
+ interface Props {
12
+ label: string;
13
+ value: string;
14
+ change: string;
15
+ trend?: 'up' | 'down' | 'neutral';
16
+ timeframe?: string;
17
+ }
18
+
19
+ const {
20
+ label = 'Monthly Active Builders',
21
+ value = '14,290',
22
+ change = '+18.4%',
23
+ trend = 'up',
24
+ timeframe = 'vs last 30 days',
25
+ } = Astro.props;
26
+
27
+ const bars = [35, 55, 40, 75, 60, 90, 80, 100];
28
+ ---
29
+
30
+ <div class="trend-card">
31
+ <div class="trend-card__top">
32
+ <span class="trend-card__label">{label}</span>
33
+ <span class:list={['trend-card__badge', `trend-card__badge--${trend}`]}>
34
+ {trend === 'up' && '↑'}
35
+ {trend === 'down' && '↓'}
36
+ {change}
37
+ </span>
38
+ </div>
39
+
40
+ <div class="trend-card__value">{value}</div>
41
+
42
+ <div class="trend-card__bottom">
43
+ <span class="trend-card__timeframe">{timeframe}</span>
44
+ <div class="trend-card__chart" aria-hidden="true">
45
+ {bars.map((h) => (
46
+ <span class="bar" style={`height: ${h}%;`}></span>
47
+ ))}
48
+ </div>
49
+ </div>
50
+ </div>
51
+
52
+ <style>
53
+ .trend-card {
54
+ display: flex;
55
+ flex-direction: column;
56
+ padding: var(--sp-6, 1.5rem);
57
+ background: rgba(255, 255, 255, 0.02);
58
+ backdrop-filter: blur(16px);
59
+ border: 1px solid rgba(255, 255, 255, 0.08);
60
+ border-radius: var(--r-xl, 20px);
61
+ width: 100%;
62
+ max-width: 280px;
63
+ font-family: var(--font-sans, system-ui, sans-serif);
64
+ transition: transform 0.25s ease, border-color 0.25s ease;
65
+ }
66
+
67
+ .trend-card:hover {
68
+ transform: translateY(-2px);
69
+ border-color: rgba(184, 134, 11, 0.3);
70
+ }
71
+
72
+ .trend-card__top {
73
+ display: flex;
74
+ justify-content: space-between;
75
+ align-items: center;
76
+ margin-bottom: 8px;
77
+ }
78
+
79
+ .trend-card__label {
80
+ font-size: 0.8rem;
81
+ font-weight: 600;
82
+ color: var(--c-text-2, #a3a3a3);
83
+ }
84
+
85
+ .trend-card__badge {
86
+ font-size: 0.72rem;
87
+ font-weight: 700;
88
+ padding: 2px 8px;
89
+ border-radius: var(--r-full, 9999px);
90
+ display: inline-flex;
91
+ align-items: center;
92
+ gap: 2px;
93
+ }
94
+
95
+ .trend-card__badge--up {
96
+ background: rgba(16, 185, 129, 0.15);
97
+ color: #34d399;
98
+ border: 1px solid rgba(16, 185, 129, 0.3);
99
+ }
100
+
101
+ .trend-card__badge--down {
102
+ background: rgba(239, 68, 68, 0.15);
103
+ color: #f87171;
104
+ border: 1px solid rgba(239, 68, 68, 0.3);
105
+ }
106
+
107
+ .trend-card__badge--neutral {
108
+ background: rgba(255, 255, 255, 0.08);
109
+ color: var(--c-text-2, #a3a3a3);
110
+ }
111
+
112
+ .trend-card__value {
113
+ font-size: 1.85rem;
114
+ font-weight: 900;
115
+ color: var(--c-text-1, #ffffff);
116
+ letter-spacing: -0.02em;
117
+ margin-bottom: 12px;
118
+ }
119
+
120
+ .trend-card__bottom {
121
+ display: flex;
122
+ justify-content: space-between;
123
+ align-items: flex-end;
124
+ }
125
+
126
+ .trend-card__timeframe {
127
+ font-size: 0.74rem;
128
+ color: var(--c-text-3, #737373);
129
+ }
130
+
131
+ .trend-card__chart {
132
+ display: flex;
133
+ align-items: flex-end;
134
+ gap: 3px;
135
+ height: 24px;
136
+ width: 60px;
137
+ }
138
+
139
+ .bar {
140
+ flex: 1;
141
+ background: rgba(184, 134, 11, 0.35);
142
+ border-radius: 2px;
143
+ transition: background 0.2s;
144
+ }
145
+
146
+ .trend-card:hover .bar {
147
+ background: var(--c-primary-light, #d4a017);
148
+ }
149
+ </style>
@@ -20,3 +20,6 @@ export { default as StatCard } from './StatCard.astro';
20
20
  export { default as TaskKanbanCard } from './TaskKanbanCard.astro';
21
21
  export { default as TestimonialCardClean } from './TestimonialCardClean.astro';
22
22
  export { default as WeatherWidgetCard } from './WeatherWidgetCard.astro';
23
+ export { default as PricingCompareMiniCard } from './PricingCompareMiniCard.astro';
24
+ export { default as GithubRepoCard } from './GithubRepoCard.astro';
25
+ export { default as StatsTrendCard } from './StatsTrendCard.astro';
@@ -0,0 +1,105 @@
1
+ ---
2
+ /**
3
+ * ActivityRings — Concentric closed rings tracking daily goals (move, exercise,
4
+ * stand style). Values over 100% wrap with a stronger overlap stroke.
5
+ *
6
+ * @param {Array<{label: string, value: number, goal: number, unit?: string}>} rings - Up to 4 goals.
7
+ * @param {string[]} colors - Optional per-ring colors.
8
+ * @param {string} variant - Card style (glass|solid|ghost).
9
+ * @param {string} size - Density (sm|md|lg).
10
+ */
11
+ import ChartFrame from './ChartFrame.astro';
12
+ import { arcStroke, colorAt } from './chart-utils';
13
+
14
+ interface Props {
15
+ title?: string;
16
+ subtitle?: string;
17
+ rings?: Array<{ label: string; value: number; goal: number; unit?: string }>;
18
+ colors?: string[];
19
+ variant?: 'glass' | 'solid' | 'ghost';
20
+ size?: 'sm' | 'md' | 'lg';
21
+ className?: string;
22
+ }
23
+
24
+ const {
25
+ title = 'Today',
26
+ subtitle = 'Daily goals',
27
+ rings = [
28
+ { label: 'Focus time', value: 5.2, goal: 6, unit: 'h' },
29
+ { label: 'Tasks done', value: 11, goal: 8 },
30
+ { label: 'Reviews', value: 3, goal: 5 },
31
+ ],
32
+ colors = ['var(--chart-5, #d55181)', 'var(--chart-3, #199e70)', 'var(--chart-1, #3987e5)'],
33
+ variant = 'glass',
34
+ size = 'md',
35
+ className = '',
36
+ } = Astro.props;
37
+
38
+ const S = 220;
39
+ const c = S / 2;
40
+ const stroke = 20;
41
+ const items = rings.slice(0, 4).map((r, i) => {
42
+ const radius = c - stroke / 2 - 4 - i * (stroke + 4);
43
+ const pct = r.value / (r.goal || 1);
44
+ return { ...r, radius, pct, color: colorAt(i, colors) };
45
+ });
46
+ ---
47
+
48
+ <ChartFrame
49
+ title={title}
50
+ subtitle={subtitle}
51
+ variant={variant}
52
+ size={size}
53
+ className={className}
54
+ table={{ headers: ['Goal', 'Value', 'Target', 'Progress'], rows: items.map((r) => [r.label, `${r.value}${r.unit ?? ''}`, `${r.goal}${r.unit ?? ''}`, `${Math.round(r.pct * 100)}%`]) }}
55
+ >
56
+ <div class="ar">
57
+ <svg viewBox={`0 0 ${S} ${S}`} role="img" aria-label={`${title}: ${items.map((r) => `${r.label} ${Math.round(r.pct * 100)}%`).join(', ')}`}>
58
+ {items.map((r) => {
59
+ const main = Math.min(r.pct, 0.9999);
60
+ const extra = r.pct > 1 ? Math.min(r.pct - 1, 0.9999) : 0;
61
+ return (
62
+ <g>
63
+ <circle cx={c} cy={c} r={r.radius} fill="none" stroke={r.color} stroke-opacity="0.16" stroke-width={stroke} />
64
+ {main > 0 && <path class="ar__arc" d={arcStroke(c, c, r.radius, 0, Math.PI * 2 * main)} fill="none" stroke={r.color} stroke-width={stroke} stroke-linecap="round" />}
65
+ {extra > 0 && <path d={arcStroke(c, c, r.radius, 0, Math.PI * 2 * extra)} fill="none" stroke={r.color} stroke-width={stroke} stroke-linecap="round" style="filter: drop-shadow(0 0 3px rgba(0,0,0,0.6)) brightness(1.15)" />}
66
+ </g>
67
+ );
68
+ })}
69
+ </svg>
70
+ <ul class="ar__list">
71
+ {items.map((r) => (
72
+ <li>
73
+ <span class="ar__label"><i style={`background:${r.color}`} aria-hidden="true"></i>{r.label}</span>
74
+ <span class="ar__value">{r.value}{r.unit ?? ''}<small>/{r.goal}{r.unit ?? ''}</small></span>
75
+ <span class="ar__pct">{Math.round(r.pct * 100)}%{r.pct >= 1 && <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" aria-label="goal met"><path d="M20 6 9 17l-5-5" /></svg>}</span>
76
+ </li>
77
+ ))}
78
+ </ul>
79
+ </div>
80
+ </ChartFrame>
81
+
82
+ <style>
83
+ .ar {
84
+ display: grid;
85
+ grid-template-columns: minmax(0, 220px) 1fr;
86
+ gap: 2rem;
87
+ align-items: center;
88
+ }
89
+ .ar__arc {
90
+ stroke-dasharray: 800;
91
+ stroke-dashoffset: 800;
92
+ animation: ar-draw 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
93
+ }
94
+ @keyframes ar-draw { to { stroke-dashoffset: 0; } }
95
+ .ar__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
96
+ .ar__list li { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 1rem; }
97
+ .ar__label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.8125rem; color: var(--c-text-2, #a3a3a3); grid-column: 1 / -1; }
98
+ .ar__label i { width: 10px; height: 10px; border-radius: 50%; }
99
+ .ar__value { font-size: 1.25rem; font-weight: 700; color: var(--c-text-1, #fff); font-variant-numeric: tabular-nums; }
100
+ .ar__value small { font-size: 0.8rem; color: var(--c-text-3, #8a8a8a); font-weight: 500; }
101
+ .ar__pct { display: inline-flex; align-items: center; gap: 0.3rem; align-self: end; font-size: 0.8125rem; color: var(--c-text-2, #a3a3a3); font-variant-numeric: tabular-nums; }
102
+ .ar__pct svg { color: var(--chart-pos, #34c38f); }
103
+ @media (max-width: 520px) { .ar { grid-template-columns: 1fr; justify-items: center; } .ar__list { width: 100%; } .ar svg { max-width: 200px; } }
104
+ @media (prefers-reduced-motion: reduce) { .ar__arc { animation: none; stroke-dashoffset: 0; } }
105
+ </style>
@@ -0,0 +1,109 @@
1
+ ---
2
+ /**
3
+ * BoxPlotChart — Distribution summary per group: median, interquartile box,
4
+ * 1.5×IQR whiskers and outlier dots. Computes stats from raw values.
5
+ *
6
+ * @param {Array<{label: string, values: number[]}>} groups - Raw observations per group.
7
+ * @param {string} suffix - Value suffix.
8
+ * @param {string} color - Box color.
9
+ * @param {string} variant - Card style (glass|solid|ghost).
10
+ * @param {string} size - Density (sm|md|lg).
11
+ */
12
+ import ChartFrame from './ChartFrame.astro';
13
+ import { scaleLinear, niceTicks, quantile } from './chart-utils';
14
+
15
+ interface Props {
16
+ title?: string;
17
+ subtitle?: string;
18
+ groups?: Array<{ label: string; values: number[] }>;
19
+ suffix?: string;
20
+ height?: number;
21
+ color?: string;
22
+ variant?: 'glass' | 'solid' | 'ghost';
23
+ size?: 'sm' | 'md' | 'lg';
24
+ className?: string;
25
+ }
26
+
27
+ const rand = (seed: number, n: number, mean: number, spread: number) =>
28
+ Array.from({ length: n }, (_, i) => {
29
+ const a = Math.sin((i + 1) * seed) * 9999;
30
+ const b = Math.sin((i + 3) * seed * 1.7) * 9999;
31
+ return Math.round(mean + ((a - Math.floor(a)) + (b - Math.floor(b)) - 1) * spread);
32
+ });
33
+
34
+ const {
35
+ title = 'Response time by region',
36
+ subtitle = 'Distribution of p50 latency, ms',
37
+ groups = [
38
+ { label: 'us-east', values: [...rand(1.3, 40, 82, 40), 190] },
39
+ { label: 'us-west', values: rand(2.7, 40, 95, 45) },
40
+ { label: 'eu-central', values: [...rand(4.1, 40, 70, 30), 160, 172] },
41
+ { label: 'ap-south', values: rand(5.9, 40, 140, 70) },
42
+ { label: 'sa-east', values: rand(8.3, 40, 160, 55) },
43
+ ],
44
+ suffix = 'ms',
45
+ height = 290,
46
+ color = 'var(--chart-1, #3987e5)',
47
+ variant = 'glass',
48
+ size = 'md',
49
+ className = '',
50
+ } = Astro.props;
51
+
52
+ const stats = groups.map((g) => {
53
+ const s = [...g.values].sort((a, b) => a - b);
54
+ const q1 = quantile(s, 0.25);
55
+ const med = quantile(s, 0.5);
56
+ const q3 = quantile(s, 0.75);
57
+ const iqr = q3 - q1;
58
+ const lo = s.find((v) => v >= q1 - 1.5 * iqr) ?? s[0];
59
+ const hi = [...s].reverse().find((v) => v <= q3 + 1.5 * iqr) ?? s[s.length - 1];
60
+ const outliers = s.filter((v) => v < lo || v > hi);
61
+ return { label: g.label, q1, med, q3, lo, hi, outliers, n: s.length };
62
+ });
63
+
64
+ const W = 640;
65
+ const H = height;
66
+ const m = { t: 14, r: 12, b: 30, l: 48 };
67
+ const allV = groups.flatMap((g) => g.values);
68
+ const ticks = niceTicks(Math.min(...allV), Math.max(...allV), 4);
69
+ const y = scaleLinear(ticks[0], ticks[ticks.length - 1], H - m.b, m.t);
70
+ const band = (W - m.l - m.r) / groups.length;
71
+ const bw = Math.min(56, band * 0.45);
72
+ const f = (v: number) => `${Math.round(v)}${suffix}`;
73
+ ---
74
+
75
+ <ChartFrame
76
+ title={title}
77
+ subtitle={subtitle}
78
+ variant={variant}
79
+ size={size}
80
+ className={className}
81
+ table={{ headers: ['Group', 'Min', 'Q1', 'Median', 'Q3', 'Max', 'Outliers'], rows: stats.map((s) => [s.label, f(s.lo), f(s.q1), f(s.med), f(s.q3), f(s.hi), s.outliers.length]) }}
82
+ >
83
+ <svg viewBox={`0 0 ${W} ${H}`} role="img" aria-label={`${title}: box plot of ${groups.length} groups`}>
84
+ {ticks.map((t) => (
85
+ <g>
86
+ <line class="cf-grid" x1={m.l} x2={W - m.r} y1={y(t)} y2={y(t)} />
87
+ <text class="cf-label" x={m.l - 8} y={y(t) + 4} text-anchor="end">{f(t)}</text>
88
+ </g>
89
+ ))}
90
+ {stats.map((s, i) => {
91
+ const cx = m.l + i * band + band / 2;
92
+ return (
93
+ <g class="cf-mark cf-dim" tabindex="0" role="img"
94
+ aria-label={`${s.label}: median ${f(s.med)}, IQR ${f(s.q1)}–${f(s.q3)}, range ${f(s.lo)}–${f(s.hi)}, ${s.outliers.length} outliers`}
95
+ data-tip-title={s.label} data-tip={`Max: ${f(s.hi)}|Q3: ${f(s.q3)}|${color}::Median: ${f(s.med)}|Q1: ${f(s.q1)}|Min: ${f(s.lo)}${s.outliers.length ? `|Outliers: ${s.outliers.length}` : ''}`}>
96
+ <rect x={cx - band / 2} y={m.t} width={band} height={H - m.t - m.b} fill="transparent" />
97
+ <line x1={cx} x2={cx} y1={y(s.hi)} y2={y(s.q3)} stroke="var(--c-text-2, #a3a3a3)" stroke-width="1.5" />
98
+ <line x1={cx} x2={cx} y1={y(s.q1)} y2={y(s.lo)} stroke="var(--c-text-2, #a3a3a3)" stroke-width="1.5" />
99
+ <line x1={cx - bw / 4} x2={cx + bw / 4} y1={y(s.hi)} y2={y(s.hi)} stroke="var(--c-text-2, #a3a3a3)" stroke-width="1.5" />
100
+ <line x1={cx - bw / 4} x2={cx + bw / 4} y1={y(s.lo)} y2={y(s.lo)} stroke="var(--c-text-2, #a3a3a3)" stroke-width="1.5" />
101
+ <rect x={cx - bw / 2} y={y(s.q3)} width={bw} height={Math.max(1, y(s.q1) - y(s.q3))} rx="4" fill={color} fill-opacity="0.3" stroke={color} stroke-width="1.5" />
102
+ <line x1={cx - bw / 2} x2={cx + bw / 2} y1={y(s.med)} y2={y(s.med)} stroke="var(--c-text-1, #fff)" stroke-width="2.5" />
103
+ {s.outliers.map((o) => <circle cx={cx} cy={y(o)} r="3.5" fill="none" stroke={color} stroke-width="1.5" />)}
104
+ <text class="cf-label" x={cx} y={H - 10} text-anchor="middle">{s.label}</text>
105
+ </g>
106
+ );
107
+ })}
108
+ </svg>
109
+ </ChartFrame>
@@ -0,0 +1,101 @@
1
+ ---
2
+ /**
3
+ * BubbleChart — Three-variable scatter: x, y and bubble area (z). Larger
4
+ * bubbles are drawn first so small ones stay visible on top.
5
+ *
6
+ * @param {Array<{label: string, x: number, y: number, z: number, group?: number}>} items - Bubbles.
7
+ * @param {string[]} groups - Group names (max 3) mapped to color slots.
8
+ * @param {string} xLabel - X-axis title.
9
+ * @param {string} yLabel - Y-axis title.
10
+ * @param {string} zLabel - Bubble size meaning.
11
+ * @param {string[]} colors - Optional per-group colors.
12
+ * @param {string} variant - Card style (glass|solid|ghost).
13
+ * @param {string} size - Density (sm|md|lg).
14
+ */
15
+ import ChartFrame from './ChartFrame.astro';
16
+ import { scaleLinear, niceTicks, colorAt, formatCompact } from './chart-utils';
17
+
18
+ interface Props {
19
+ title?: string;
20
+ subtitle?: string;
21
+ items?: Array<{ label: string; x: number; y: number; z: number; group?: number }>;
22
+ groups?: string[];
23
+ xLabel?: string;
24
+ yLabel?: string;
25
+ zLabel?: string;
26
+ height?: number;
27
+ colors?: string[];
28
+ variant?: 'glass' | 'solid' | 'ghost';
29
+ size?: 'sm' | 'md' | 'lg';
30
+ className?: string;
31
+ }
32
+
33
+ const {
34
+ title = 'Market opportunity',
35
+ subtitle = 'Growth vs margin, bubble = revenue',
36
+ items = [
37
+ { label: 'Analytics', x: 34, y: 62, z: 120, group: 0 },
38
+ { label: 'Payments', x: 18, y: 41, z: 260, group: 0 },
39
+ { label: 'CRM', x: 9, y: 55, z: 180, group: 1 },
40
+ { label: 'Hosting', x: 22, y: 28, z: 90, group: 1 },
41
+ { label: 'AI tools', x: 71, y: 48, z: 70, group: 2 },
42
+ { label: 'Security', x: 27, y: 72, z: 140, group: 2 },
43
+ { label: 'Email', x: 6, y: 66, z: 60, group: 1 },
44
+ { label: 'Design', x: 41, y: 58, z: 85, group: 0 },
45
+ ],
46
+ groups = ['Core', 'Mature', 'Emerging'],
47
+ xLabel = 'YoY growth (%)',
48
+ yLabel = 'Gross margin (%)',
49
+ zLabel = 'Revenue ($M)',
50
+ height = 320,
51
+ colors,
52
+ variant = 'glass',
53
+ size = 'md',
54
+ className = '',
55
+ } = Astro.props;
56
+
57
+ const W = 640;
58
+ const H = height;
59
+ const m = { t: 20, r: 24, b: 40, l: 48 };
60
+ const xt = niceTicks(0, Math.max(...items.map((i) => i.x)), 5);
61
+ const yt = niceTicks(0, Math.max(...items.map((i) => i.y)), 4);
62
+ const x = scaleLinear(xt[0], xt[xt.length - 1], m.l, W - m.r);
63
+ const y = scaleLinear(yt[0], yt[yt.length - 1], H - m.b, m.t);
64
+ const zMax = Math.max(...items.map((i) => i.z)) || 1;
65
+ const r = (z: number) => 6 + Math.sqrt(z / zMax) * 30; // area-proportional radius
66
+ const sorted = [...items].sort((a, b) => b.z - a.z);
67
+ ---
68
+
69
+ <ChartFrame
70
+ title={title}
71
+ subtitle={subtitle}
72
+ variant={variant}
73
+ size={size}
74
+ className={className}
75
+ legend={groups.slice(0, 3).map((g, i) => ({ label: g, color: colorAt(i, colors) }))}
76
+ table={{ headers: ['Item', 'Group', xLabel, yLabel, zLabel], rows: items.map((i) => [i.label, groups[i.group ?? 0] ?? '—', i.x, i.y, i.z]) }}
77
+ >
78
+ <svg viewBox={`0 0 ${W} ${H}`} role="img" aria-label={`${title}: bubble chart of ${items.length} items`}>
79
+ {yt.map((t) => (
80
+ <g>
81
+ <line class="cf-grid" x1={m.l} x2={W - m.r} y1={y(t)} y2={y(t)} />
82
+ <text class="cf-label" x={m.l - 8} y={y(t) + 4} text-anchor="end">{formatCompact(t)}</text>
83
+ </g>
84
+ ))}
85
+ {xt.map((t) => <text class="cf-label" x={x(t)} y={H - m.b + 16} text-anchor="middle">{formatCompact(t)}</text>)}
86
+ <text class="cf-label" x={(m.l + W - m.r) / 2} y={H - 4} text-anchor="middle">{xLabel}</text>
87
+ <text class="cf-label" transform={`translate(12 ${(m.t + H - m.b) / 2}) rotate(-90)`} text-anchor="middle">{yLabel}</text>
88
+
89
+ {sorted.map((it) => {
90
+ const col = colorAt(it.group ?? 0, colors);
91
+ const rad = r(it.z);
92
+ return (
93
+ <g class="cf-mark cf-dim" tabindex="0" role="img" aria-label={`${it.label}: ${xLabel} ${it.x}, ${yLabel} ${it.y}, ${zLabel} ${it.z}`}
94
+ data-tip-title={it.label} data-tip={`${col}::${groups[it.group ?? 0] ?? ''}|${xLabel}: ${it.x}|${yLabel}: ${it.y}|${zLabel}: ${it.z}`}>
95
+ <circle cx={x(it.x)} cy={y(it.y)} r={rad} fill={col} fill-opacity="0.55" stroke={col} stroke-width="1.5" />
96
+ {rad > 18 && <text x={x(it.x)} y={y(it.y) + 4} text-anchor="middle" fill="#fff" font-size="11" font-weight="600">{it.label}</text>}
97
+ </g>
98
+ );
99
+ })}
100
+ </svg>
101
+ </ChartFrame>