astro-component-kit 0.3.1 → 0.4.1
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/README.md +133 -36
- package/package.json +17 -4
- package/src/components/index.ts +18 -202
- package/src/components/lib/Galaxy3D.astro +249 -137
- package/src/components/lib/app/AppSidebar.astro +249 -0
- package/src/components/lib/app/AppTopbar.astro +284 -0
- package/src/components/lib/app/ArrivalsBoard.astro +176 -0
- package/src/components/lib/app/AuthCard.astro +213 -0
- package/src/components/lib/app/DataTable.astro +346 -0
- package/src/components/lib/app/GuestProfileCard.astro +133 -0
- package/src/components/lib/app/HousekeepingBoard.astro +189 -0
- package/src/components/lib/app/PageHeader.astro +157 -0
- package/src/components/lib/app/PlanUsageCard.astro +112 -0
- package/src/components/lib/app/RoomRack.astro +207 -0
- package/src/components/lib/app/SettingsSection.astro +96 -0
- package/src/components/lib/app/SwitchRow.astro +71 -0
- package/src/components/lib/app/TeamMembers.astro +190 -0
- package/src/components/lib/app/app-icons.ts +52 -0
- package/src/components/lib/app/index.ts +19 -0
- package/src/components/lib/buttons/NeonBorderButton.astro +162 -0
- package/src/components/lib/buttons/RippleButton.astro +199 -0
- package/src/components/lib/buttons/SlideRevealButton.astro +159 -0
- package/src/components/lib/buttons/index.ts +4 -0
- package/src/components/lib/cards/GithubRepoCard.astro +176 -0
- package/src/components/lib/cards/PricingCompareMiniCard.astro +196 -0
- package/src/components/lib/cards/StatsTrendCard.astro +149 -0
- package/src/components/lib/cards/index.ts +3 -0
- package/src/components/lib/charts/ActivityRings.astro +105 -0
- package/src/components/lib/charts/AreaChart.astro +4 -4
- package/src/components/lib/charts/BarChart.astro +3 -3
- package/src/components/lib/charts/BoxPlotChart.astro +109 -0
- package/src/components/lib/charts/BubbleChart.astro +101 -0
- package/src/components/lib/charts/BulletChart.astro +160 -0
- package/src/components/lib/charts/BumpChart.astro +92 -0
- package/src/components/lib/charts/CandlestickChart.astro +105 -0
- package/src/components/lib/charts/ChartFrame.astro +373 -0
- package/src/components/lib/charts/DivergingBarChart.astro +98 -0
- package/src/components/lib/charts/DonutChart.astro +2 -2
- package/src/components/lib/charts/DumbbellChart.astro +92 -0
- package/src/components/lib/charts/ForecastLineChart.astro +125 -0
- package/src/components/lib/charts/FunnelChart.astro +122 -0
- package/src/components/lib/charts/GaugeChart.astro +111 -0
- package/src/components/lib/charts/GoalProgressChart.astro +97 -0
- package/src/components/lib/charts/GroupedBarChart.astro +125 -0
- package/src/components/lib/charts/HeatmapChart.astro +131 -0
- package/src/components/lib/charts/HistogramChart.astro +111 -0
- package/src/components/lib/charts/HorizontalBarChart.astro +155 -0
- package/src/components/lib/charts/KpiStatTile.astro +116 -0
- package/src/components/lib/charts/KpiTrendGrid.astro +60 -0
- package/src/components/lib/charts/LineChart.astro +160 -0
- package/src/components/lib/charts/LinearProgressGauge.astro +136 -0
- package/src/components/lib/charts/LollipopChart.astro +100 -0
- package/src/components/lib/charts/MeterGauge.astro +122 -0
- package/src/components/lib/charts/MetricDeltaTable.astro +125 -0
- package/src/components/lib/charts/PieChart.astro +135 -0
- package/src/components/lib/charts/PolarAreaChart.astro +85 -0
- package/src/components/lib/charts/PopulationPyramid.astro +122 -0
- package/src/components/lib/charts/PunchCardChart.astro +89 -0
- package/src/components/lib/charts/RadarChart.astro +94 -0
- package/src/components/lib/charts/RadarMetricChart.astro +168 -0
- package/src/components/lib/charts/RadialBarChart.astro +124 -0
- package/src/components/lib/charts/RangeAreaChart.astro +113 -0
- package/src/components/lib/charts/RetentionCohortTable.astro +126 -0
- package/src/components/lib/charts/SankeyChart.astro +128 -0
- package/src/components/lib/charts/ScatterPlot.astro +139 -0
- package/src/components/lib/charts/SegmentedBarChart.astro +119 -0
- package/src/components/lib/charts/SlopeChart.astro +105 -0
- package/src/components/lib/charts/SparklineChart.astro +87 -0
- package/src/components/lib/charts/StackedAreaChart.astro +130 -0
- package/src/components/lib/charts/StackedBarChart.astro +136 -0
- package/src/components/lib/charts/SunburstChart.astro +103 -0
- package/src/components/lib/charts/TreemapChart.astro +94 -0
- package/src/components/lib/charts/WaffleChart.astro +121 -0
- package/src/components/lib/charts/WaterfallChart.astro +118 -0
- package/src/components/lib/charts/chart-tooltip.ts +75 -0
- package/src/components/lib/charts/chart-utils.ts +271 -0
- package/src/components/lib/charts/index.ts +46 -0
- package/src/components/lib/data/ActivityHeatmapGrid.astro +157 -0
- package/src/components/lib/data/MetricComparisonRow.astro +109 -0
- package/src/components/lib/data/StatusTimelineFeed.astro +168 -0
- package/src/components/lib/data/index.ts +3 -0
- package/src/components/lib/ecommerce/CartDrawer.astro +483 -0
- package/src/components/lib/ecommerce/CartPageList.astro +290 -0
- package/src/components/lib/ecommerce/CartToast.astro +276 -0
- package/src/components/lib/ecommerce/CategoryTiles.astro +143 -0
- package/src/components/lib/ecommerce/CheckoutForm.astro +423 -0
- package/src/components/lib/ecommerce/CountdownBanner.astro +230 -0
- package/src/components/lib/ecommerce/FilterBar.astro +278 -0
- package/src/components/lib/ecommerce/FilterSidebar.astro +405 -0
- package/src/components/lib/ecommerce/LiveActivityToast.astro +213 -0
- package/src/components/lib/ecommerce/OrderSummary.astro +295 -0
- package/src/components/lib/ecommerce/ProductBuyBox.astro +247 -0
- package/src/components/lib/ecommerce/ProductCardMinimal.astro +229 -0
- package/src/components/lib/ecommerce/ProductGallery.astro +145 -0
- package/src/components/lib/ecommerce/ProductGrid.astro +118 -0
- package/src/components/lib/ecommerce/ProductMedia.astro +113 -0
- package/src/components/lib/ecommerce/ProductRating.astro +78 -0
- package/src/components/lib/ecommerce/ProductToolbar.astro +93 -0
- package/src/components/lib/ecommerce/PromoBar.astro +145 -0
- package/src/components/lib/ecommerce/StockIndicator.astro +127 -0
- package/src/components/lib/ecommerce/StoreHeader.astro +446 -0
- package/src/components/lib/ecommerce/StoreHero.astro +260 -0
- package/src/components/lib/ecommerce/StoreProductCard.astro +307 -0
- package/src/components/lib/ecommerce/TrustBadges.astro +101 -0
- package/src/components/lib/ecommerce/VariantPicker.astro +145 -0
- package/src/components/lib/ecommerce/cart-store.ts +151 -0
- package/src/components/lib/ecommerce/catalog-filter.ts +62 -0
- package/src/components/lib/ecommerce/index.ts +34 -0
- package/src/components/lib/ecommerce/product-icons.ts +28 -0
- package/src/components/lib/ecommerce/types.ts +70 -0
- package/src/components/lib/feedback/ProgressRingCounter.astro +118 -0
- package/src/components/lib/feedback/ToastNotificationGroup.astro +173 -0
- package/src/components/lib/feedback/index.ts +2 -0
- package/src/components/lib/forms/AnimatedInput.astro +4 -2
- package/src/components/lib/forms/CustomRadioGroup.astro +3 -1
- package/src/components/lib/forms/GlassInlineToggleGroup.astro +161 -0
- package/src/components/lib/forms/PasswordStrengthInput.astro +242 -0
- package/src/components/lib/forms/PhoneCountryInput.astro +145 -0
- package/src/components/lib/forms/TagsAutocompleteInput.astro +249 -0
- package/src/components/lib/forms/index.ts +5 -0
- package/src/components/lib/index.ts +2 -0
- package/src/components/lib/layout/BentoGrid3.astro +6 -4
- package/src/components/lib/layout/CenterFixedBox.astro +2 -2
- package/src/components/lib/layout/CenteredContainer.astro +4 -2
- package/src/components/lib/layout/ClusterHorizontal.astro +2 -2
- package/src/components/lib/layout/DiagonalSectionDivider.astro +69 -0
- package/src/components/lib/layout/FeatureHero.astro +4 -2
- package/src/components/lib/layout/FooterCenteredMinimal.astro +4 -2
- package/src/components/lib/layout/FullBleedSection.astro +2 -2
- package/src/components/lib/layout/GalleryGrid4.astro +2 -2
- package/src/components/lib/layout/HolyGrailGrid.astro +127 -0
- package/src/components/lib/layout/LandingSectionSplit.astro +5 -3
- package/src/components/lib/layout/MasonryGrid.astro +2 -2
- package/src/components/lib/layout/MinimalFooterGrid.astro +1 -1
- package/src/components/lib/layout/ScrollSnapSection.astro +1 -1
- package/src/components/lib/layout/SidebarLayoutWrapper.astro +4 -2
- package/src/components/lib/layout/SplitScreenLayout.astro +3 -3
- package/src/components/lib/layout/StepLayoutVertical.astro +1 -1
- package/src/components/lib/layout/StickySidebarWrapper.astro +4 -2
- package/src/components/lib/layout/index.ts +3 -1
- package/src/components/lib/navigation/QuickJumpDock.astro +125 -0
- package/src/components/lib/navigation/StepBreadcrumbBar.astro +151 -0
- package/src/components/lib/navigation/SubNavbarPills.astro +102 -0
- package/src/components/lib/navigation/index.ts +3 -0
- package/src/components/lib/overlays/CookiePreferencesDrawer.astro +226 -0
- package/src/components/lib/overlays/FloatingFeedbackWidget.astro +203 -0
- package/src/components/lib/overlays/ImageCompareSlider.astro +172 -0
- package/src/components/lib/overlays/index.ts +3 -0
- package/src/components/lib/sections/AgencyContactBrief.astro +194 -0
- package/src/components/lib/sections/AgencyFooterCta.astro +94 -0
- package/src/components/lib/sections/AgencyHeader.astro +161 -0
- package/src/components/lib/sections/AgencyHeroKinetic.astro +172 -0
- package/src/components/lib/sections/AgencyServicesList.astro +113 -0
- package/src/components/lib/sections/AgencyTeamGrid.astro +111 -0
- package/src/components/lib/sections/AgencyWorkGrid.astro +147 -0
- package/src/components/lib/sections/BlogGridSection.astro +133 -0
- package/src/components/lib/sections/ButtonsShowcase.astro +20 -18
- package/src/components/lib/sections/CardsShowcase.astro +28 -26
- package/src/components/lib/sections/CareersOpenings.astro +141 -0
- package/src/components/lib/sections/ChangelogSection.astro +151 -0
- package/src/components/lib/sections/ContactGlassForm.astro +10 -8
- package/src/components/lib/sections/ContactSplitMap.astro +141 -0
- package/src/components/lib/sections/CtaAppDownload.astro +13 -11
- package/src/components/lib/sections/CtaGlowBanner.astro +12 -10
- package/src/components/lib/sections/CtaNewsletterSection.astro +165 -0
- package/src/components/lib/sections/CtaSplitImage.astro +149 -0
- package/src/components/lib/sections/DataShowcase.astro +23 -21
- package/src/components/lib/sections/FaqAccordionSection.astro +8 -8
- package/src/components/lib/sections/FaqTwoColumn.astro +121 -0
- package/src/components/lib/sections/FeatureAlternatingRows.astro +192 -0
- package/src/components/lib/sections/FeatureBentoGrid.astro +13 -11
- package/src/components/lib/sections/FeatureIconGrid.astro +155 -0
- package/src/components/lib/sections/FeatureTabsShowcase.astro +182 -0
- package/src/components/lib/sections/FeatureTimelineFlow.astro +8 -6
- package/src/components/lib/sections/FeedbackShowcase.astro +15 -13
- package/src/components/lib/sections/FooterMegaSection.astro +157 -0
- package/src/components/lib/sections/FormsShowcase.astro +22 -20
- package/src/components/lib/sections/HeroDashboardPreview.astro +182 -0
- package/src/components/lib/sections/HeroGlass.astro +22 -20
- package/src/components/lib/sections/HeroGradient.astro +15 -13
- package/src/components/lib/sections/HeroMinimalCentered.astro +175 -0
- package/src/components/lib/sections/HeroShowcaseSplit.astro +306 -0
- package/src/components/lib/sections/HeroSplit.astro +13 -11
- package/src/components/lib/sections/HeroTerminal.astro +253 -0
- package/src/components/lib/sections/HeroWaitlist.astro +231 -0
- package/src/components/lib/sections/HowItWorksSteps.astro +180 -0
- package/src/components/lib/sections/IntegrationsGrid.astro +167 -0
- package/src/components/lib/sections/LayoutShowcase.astro +21 -19
- package/src/components/lib/sections/LogoCloudSection.astro +96 -0
- package/src/components/lib/sections/LogoWallGrid.astro +93 -0
- package/src/components/lib/sections/NavigationShowcase.astro +15 -13
- package/src/components/lib/sections/OverlaysShowcase.astro +21 -19
- package/src/components/lib/sections/PricingComparisonMatrix.astro +15 -13
- package/src/components/lib/sections/PricingSinglePlan.astro +159 -0
- package/src/components/lib/sections/PricingTierCards.astro +11 -9
- package/src/components/lib/sections/PricingToggleCards.astro +171 -0
- package/src/components/lib/sections/ShopCategoryHero.astro +103 -0
- package/src/components/lib/sections/ShopCollectionMosaic.astro +131 -0
- package/src/components/lib/sections/ShopFooterWordmark.astro +100 -0
- package/src/components/lib/sections/ShopHeaderEditorial.astro +396 -0
- package/src/components/lib/sections/ShopHeroEditorial.astro +151 -0
- package/src/components/lib/sections/ShopLookbook.astro +250 -0
- package/src/components/lib/sections/ShopNewsletterEditorial.astro +128 -0
- package/src/components/lib/sections/ShopProductRail.astro +150 -0
- package/src/components/lib/sections/ShopReviewsEditorial.astro +133 -0
- package/src/components/lib/sections/ShopValuesMarquee.astro +91 -0
- package/src/components/lib/sections/StatsCounterBand.astro +124 -0
- package/src/components/lib/sections/StatsDashboardSection.astro +85 -0
- package/src/components/lib/sections/StatsMetricShowcase.astro +9 -7
- package/src/components/lib/sections/TeamGridSection.astro +12 -10
- package/src/components/lib/sections/TestimonialCarousel.astro +167 -0
- package/src/components/lib/sections/TestimonialFeatured.astro +122 -0
- package/src/components/lib/sections/TestimonialGridSection.astro +188 -0
- package/src/components/lib/sections/TestimonialWallGlass.astro +11 -9
- package/src/components/lib/sections/TypographyShowcase.astro +10 -8
- package/src/components/lib/sections/index.ts +39 -0
- package/src/components/lib/templates/ecommerce/StoreCategoryPage.astro +160 -0
- package/src/components/lib/templates/ecommerce/StoreCheckoutPage.astro +98 -0
- package/src/components/lib/templates/ecommerce/StoreHomePage.astro +191 -0
- package/src/components/lib/templates/ecommerce/StoreLayout.astro +169 -0
- package/src/components/lib/templates/ecommerce/StoreProductPage.astro +165 -0
- package/src/components/lib/templates/ecommerce/data.ts +187 -0
- package/src/components/lib/templates/ecommerce/index.ts +14 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialBagPage.astro +52 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialCheckoutPage.astro +123 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialHomePage.astro +102 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialLayout.astro +216 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialProductPage.astro +205 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialShopPage.astro +112 -0
- package/src/components/lib/templates/ecommerce-editorial/data.ts +125 -0
- package/src/components/lib/templates/ecommerce-editorial/index.ts +16 -0
- package/src/components/lib/templates/saas-hotel/AppLayout.astro +83 -0
- package/src/components/lib/templates/saas-hotel/DashboardPage.astro +66 -0
- package/src/components/lib/templates/saas-hotel/GuestsPage.astro +65 -0
- package/src/components/lib/templates/saas-hotel/LandingPage.astro +213 -0
- package/src/components/lib/templates/saas-hotel/ReportsPage.astro +63 -0
- package/src/components/lib/templates/saas-hotel/ReservationsPage.astro +49 -0
- package/src/components/lib/templates/saas-hotel/RoomsPage.astro +48 -0
- package/src/components/lib/templates/saas-hotel/SettingsPage.astro +115 -0
- package/src/components/lib/templates/saas-hotel/SignInPage.astro +50 -0
- package/src/components/lib/templates/saas-hotel/data.ts +229 -0
- package/src/components/lib/templates/saas-hotel/index.ts +19 -0
- package/src/components/lib/templates/saas-hotel/lobby-theme.css +90 -0
- package/src/components/lib/typography/AnimatedCounterText.astro +102 -0
- package/src/components/lib/typography/CurvedPathHeading.astro +86 -0
- package/src/components/lib/typography/GradientTextMarquee.astro +105 -0
- package/src/components/lib/typography/HackerDecodeText.astro +85 -0
- package/src/components/lib/typography/index.ts +4 -0
- package/src/styles/global.css +113 -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>
|
|
@@ -48,9 +48,9 @@ const chartConfig = {
|
|
|
48
48
|
|
|
49
49
|
<style>
|
|
50
50
|
.premium-chart-card {
|
|
51
|
-
background:
|
|
51
|
+
background: rgb(var(--ink-rgb, 255 255 255) / 0.03);
|
|
52
52
|
backdrop-filter: blur(12px);
|
|
53
|
-
border: 1px solid
|
|
53
|
+
border: 1px solid rgb(var(--ink-rgb, 255 255 255) / 0.08);
|
|
54
54
|
border-radius: var(--r-xl, 24px);
|
|
55
55
|
padding: var(--sp-6, 24px);
|
|
56
56
|
overflow: hidden;
|
|
@@ -102,7 +102,7 @@ const chartConfig = {
|
|
|
102
102
|
:global(.apexcharts-tooltip) {
|
|
103
103
|
background: rgba(15, 23, 42, 0.9) !important;
|
|
104
104
|
backdrop-filter: blur(8px) !important;
|
|
105
|
-
border: 1px solid
|
|
105
|
+
border: 1px solid rgb(var(--ink-rgb, 255 255 255) / 0.1) !important;
|
|
106
106
|
border-radius: 12px !important;
|
|
107
107
|
color: #fff !important;
|
|
108
108
|
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3) !important;
|
|
@@ -175,7 +175,7 @@ const chartConfig = {
|
|
|
175
175
|
},
|
|
176
176
|
grid: {
|
|
177
177
|
show: config.showGrid,
|
|
178
|
-
borderColor: '
|
|
178
|
+
borderColor: 'rgb(var(--ink-rgb, 255 255 255) / 0.05)',
|
|
179
179
|
strokeDashArray: 4,
|
|
180
180
|
},
|
|
181
181
|
legend: {
|
|
@@ -51,9 +51,9 @@ const chartConfig = {
|
|
|
51
51
|
|
|
52
52
|
<style>
|
|
53
53
|
.premium-chart-card {
|
|
54
|
-
background:
|
|
54
|
+
background: rgb(var(--ink-rgb, 255 255 255) / 0.03);
|
|
55
55
|
backdrop-filter: blur(12px);
|
|
56
|
-
border: 1px solid
|
|
56
|
+
border: 1px solid rgb(var(--ink-rgb, 255 255 255) / 0.08);
|
|
57
57
|
border-radius: var(--r-xl, 24px);
|
|
58
58
|
padding: var(--sp-6, 24px);
|
|
59
59
|
width: 100%;
|
|
@@ -158,7 +158,7 @@ const chartConfig = {
|
|
|
158
158
|
labels: { style: { colors: '#64748b', fontSize: '12px' } },
|
|
159
159
|
},
|
|
160
160
|
grid: {
|
|
161
|
-
borderColor: '
|
|
161
|
+
borderColor: 'rgb(var(--ink-rgb, 255 255 255) / 0.05)',
|
|
162
162
|
strokeDashArray: 4,
|
|
163
163
|
},
|
|
164
164
|
legend: {
|
|
@@ -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>
|