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,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* ToastNotificationGroup — Stackable notification banner with auto-timed progress bar, icon, and dismiss action.
|
|
4
|
+
*
|
|
5
|
+
* @param {'success' | 'warning' | 'error' | 'info'} type - Alert status variant. Default is 'success'.
|
|
6
|
+
* @param {string} title - Notification title headline. Default is 'Changes Saved'.
|
|
7
|
+
* @param {string} message - Explanatory message text.
|
|
8
|
+
* @param {string} actionText - Optional action link text (e.g. 'Undo').
|
|
9
|
+
*/
|
|
10
|
+
interface Props {
|
|
11
|
+
type?: 'success' | 'warning' | 'error' | 'info';
|
|
12
|
+
title?: string;
|
|
13
|
+
message?: string;
|
|
14
|
+
actionText?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
type = 'success',
|
|
19
|
+
title = 'Changes Saved',
|
|
20
|
+
message = 'Your project settings were synchronized with production.',
|
|
21
|
+
actionText = 'Undo',
|
|
22
|
+
} = Astro.props;
|
|
23
|
+
|
|
24
|
+
const icons = {
|
|
25
|
+
success: '✓',
|
|
26
|
+
warning: '!',
|
|
27
|
+
error: '✕',
|
|
28
|
+
info: 'ℹ',
|
|
29
|
+
};
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
<div class:list={['toast-item', `toast-item--${type}`]} role="alert" data-toast-item>
|
|
33
|
+
<div class="toast-item__body">
|
|
34
|
+
<span class="toast-item__icon" aria-hidden="true">{icons[type]}</span>
|
|
35
|
+
<div class="toast-item__content">
|
|
36
|
+
<h5 class="toast-item__title">{title}</h5>
|
|
37
|
+
<p class="toast-item__msg">{message}</p>
|
|
38
|
+
</div>
|
|
39
|
+
{actionText && (
|
|
40
|
+
<button type="button" class="toast-item__action">
|
|
41
|
+
{actionText}
|
|
42
|
+
</button>
|
|
43
|
+
)}
|
|
44
|
+
<button type="button" class="toast-item__close" aria-label="Dismiss alert" data-toast-close>
|
|
45
|
+
✕
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="toast-item__progress" aria-hidden="true"></div>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
.toast-item {
|
|
53
|
+
position: relative;
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
width: 100%;
|
|
57
|
+
max-width: 380px;
|
|
58
|
+
background: rgba(14, 14, 18, 0.95);
|
|
59
|
+
backdrop-filter: blur(20px);
|
|
60
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
61
|
+
border-radius: var(--r-md, 14px);
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
|
64
|
+
font-family: var(--font-sans, system-ui, sans-serif);
|
|
65
|
+
transition: transform 0.25s ease, opacity 0.25s ease;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.toast-item--success { --toast-accent: #10b981; }
|
|
69
|
+
.toast-item--warning { --toast-accent: #f59e0b; }
|
|
70
|
+
.toast-item--error { --toast-accent: #ef4444; }
|
|
71
|
+
.toast-item--info { --toast-accent: #38bdf8; }
|
|
72
|
+
|
|
73
|
+
.toast-item__body {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: flex-start;
|
|
76
|
+
gap: 12px;
|
|
77
|
+
padding: 1rem 1.15rem;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.toast-item__icon {
|
|
81
|
+
width: 24px;
|
|
82
|
+
height: 24px;
|
|
83
|
+
border-radius: 50%;
|
|
84
|
+
background: rgba(255, 255, 255, 0.06);
|
|
85
|
+
border: 1px solid var(--toast-accent);
|
|
86
|
+
color: var(--toast-accent);
|
|
87
|
+
display: grid;
|
|
88
|
+
place-items: center;
|
|
89
|
+
font-size: 0.75rem;
|
|
90
|
+
font-weight: 900;
|
|
91
|
+
flex-shrink: 0;
|
|
92
|
+
margin-top: 2px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.toast-item__content {
|
|
96
|
+
flex: 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.toast-item__title {
|
|
100
|
+
font-size: 0.88rem;
|
|
101
|
+
font-weight: 700;
|
|
102
|
+
color: var(--c-text-1, #ffffff);
|
|
103
|
+
margin: 0 0 2px 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.toast-item__msg {
|
|
107
|
+
font-size: 0.78rem;
|
|
108
|
+
color: var(--c-text-2, #a3a3a3);
|
|
109
|
+
margin: 0;
|
|
110
|
+
line-height: 1.4;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.toast-item__action {
|
|
114
|
+
background: transparent;
|
|
115
|
+
border: none;
|
|
116
|
+
color: var(--toast-accent);
|
|
117
|
+
font-size: 0.78rem;
|
|
118
|
+
font-weight: 700;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
padding: 0.2rem 0.4rem;
|
|
121
|
+
border-radius: 4px;
|
|
122
|
+
transition: background 0.2s;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.toast-item__action:hover {
|
|
126
|
+
background: rgba(255, 255, 255, 0.08);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.toast-item__close {
|
|
130
|
+
background: transparent;
|
|
131
|
+
border: none;
|
|
132
|
+
color: var(--c-text-3, #737373);
|
|
133
|
+
font-size: 0.85rem;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
padding: 0.2rem;
|
|
136
|
+
line-height: 1;
|
|
137
|
+
transition: color 0.2s;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.toast-item__close:hover {
|
|
141
|
+
color: var(--c-text-1, #ffffff);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.toast-item__progress {
|
|
145
|
+
height: 3px;
|
|
146
|
+
background: var(--toast-accent);
|
|
147
|
+
width: 100%;
|
|
148
|
+
animation: toast-timer 5s linear forwards;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@keyframes toast-timer {
|
|
152
|
+
from { width: 100%; }
|
|
153
|
+
to { width: 0%; }
|
|
154
|
+
}
|
|
155
|
+
</style>
|
|
156
|
+
|
|
157
|
+
<script>
|
|
158
|
+
function setupToasts() {
|
|
159
|
+
document.querySelectorAll('[data-toast-item]').forEach((toast) => {
|
|
160
|
+
const closeBtn = toast.querySelector('[data-toast-close]');
|
|
161
|
+
if (closeBtn) {
|
|
162
|
+
closeBtn.addEventListener('click', () => {
|
|
163
|
+
(toast as HTMLElement).style.opacity = '0';
|
|
164
|
+
(toast as HTMLElement).style.transform = 'translateY(10px) scale(0.95)';
|
|
165
|
+
setTimeout(() => toast.remove(), 250);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
setupToasts();
|
|
172
|
+
document.addEventListener('astro:page-load', setupToasts);
|
|
173
|
+
</script>
|
|
@@ -21,3 +21,5 @@ export { default as Spotlight } from './Spotlight.astro';
|
|
|
21
21
|
export { default as StepProgress } from './StepProgress.astro';
|
|
22
22
|
export { default as ToastNotif } from './ToastNotif.astro';
|
|
23
23
|
export { default as TypingIndicator } from './TypingIndicator.astro';
|
|
24
|
+
export { default as ProgressRingCounter } from './ProgressRingCounter.astro';
|
|
25
|
+
export { default as ToastNotificationGroup } from './ToastNotificationGroup.astro';
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @param {string} placeholder - Passed placeholder. Default is ' '. (Space is needed for CSS :placeholder-shown to work).
|
|
9
9
|
* @param {boolean} required - HTML required attribute parameter. Default is false.
|
|
10
10
|
* @param {string} name - HTML input name binding.
|
|
11
|
+
* @param {string} autocomplete - HTML autocomplete hint (e.g. 'email', 'given-name'). Default is 'off'.
|
|
11
12
|
*/
|
|
12
13
|
interface Props {
|
|
13
14
|
label: string;
|
|
@@ -16,13 +17,14 @@ interface Props {
|
|
|
16
17
|
placeholder?: string;
|
|
17
18
|
required?: boolean;
|
|
18
19
|
name?: string;
|
|
20
|
+
autocomplete?: string;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
const { label, id, type = 'text', placeholder = ' ', required = false, name } = Astro.props;
|
|
23
|
+
const { label, id, type = 'text', placeholder = ' ', required = false, name, autocomplete = 'off' } = Astro.props;
|
|
22
24
|
---
|
|
23
25
|
|
|
24
26
|
<div class="anim-input-wrap">
|
|
25
|
-
<input {id} {name} {type} {placeholder} {required} class="anim-input" autocomplete=
|
|
27
|
+
<input {id} {name} {type} {placeholder} {required} class="anim-input" autocomplete={autocomplete} />
|
|
26
28
|
<label for={id} class="anim-input-label">{label}</label>
|
|
27
29
|
</div>
|
|
28
30
|
|
|
@@ -39,7 +39,9 @@ const { label, name, options = [], horizontal = false } = Astro.props;
|
|
|
39
39
|
|
|
40
40
|
.radio-item { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; color: var(--c-text-2, #94a3b8); transition: 0.2s; user-select: none; }
|
|
41
41
|
|
|
42
|
-
.radio-item input {
|
|
42
|
+
.radio-item input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
|
|
43
|
+
.radio-item { position: relative; }
|
|
44
|
+
.radio-item input:focus-visible + .radio-circle { outline: 2px solid var(--c-primary-light, #818cf8); outline-offset: 2px; }
|
|
43
45
|
|
|
44
46
|
.radio-circle {
|
|
45
47
|
width: 20px; height: 20px;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* GlassInlineToggleGroup — Segmented glassmorphism pill toggle for multi-option selection.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} name - HTML radio group name.
|
|
6
|
+
* @param {Array<{label: string, value: string, icon?: string}>} options - Selectable options list.
|
|
7
|
+
* @param {string} defaultValue - Value of the active option.
|
|
8
|
+
* @param {'sm' | 'md' | 'lg'} size - Pill size scale. Default is 'md'.
|
|
9
|
+
*/
|
|
10
|
+
interface Props {
|
|
11
|
+
name: string;
|
|
12
|
+
options?: Array<{ label: string; value: string; icon?: string }>;
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
size?: 'sm' | 'md' | 'lg';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
name = 'toggle-options',
|
|
19
|
+
options = [
|
|
20
|
+
{ label: 'Weekly', value: 'week' },
|
|
21
|
+
{ label: 'Monthly', value: 'month' },
|
|
22
|
+
{ label: 'Yearly', value: 'year' },
|
|
23
|
+
],
|
|
24
|
+
defaultValue = 'month',
|
|
25
|
+
size = 'md',
|
|
26
|
+
} = Astro.props;
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<div class:list={['glass-toggle-group', `glass-toggle-group--${size}`]} role="radiogroup" data-toggle-group>
|
|
30
|
+
<div class="glass-toggle-group__slider" data-toggle-slider aria-hidden="true"></div>
|
|
31
|
+
{options.map((opt) => {
|
|
32
|
+
const isChecked = opt.value === defaultValue;
|
|
33
|
+
return (
|
|
34
|
+
<label class="glass-toggle-group__item">
|
|
35
|
+
<input
|
|
36
|
+
type="radio"
|
|
37
|
+
name={name}
|
|
38
|
+
value={opt.value}
|
|
39
|
+
checked={isChecked}
|
|
40
|
+
class="glass-toggle-group__radio"
|
|
41
|
+
data-toggle-radio
|
|
42
|
+
/>
|
|
43
|
+
<span class="glass-toggle-group__label">
|
|
44
|
+
{opt.icon && <span class="glass-toggle-group__icon" set:html={opt.icon} />}
|
|
45
|
+
{opt.label}
|
|
46
|
+
</span>
|
|
47
|
+
</label>
|
|
48
|
+
);
|
|
49
|
+
})}
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
.glass-toggle-group {
|
|
54
|
+
position: relative;
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
background: rgba(255, 255, 255, 0.03);
|
|
58
|
+
backdrop-filter: blur(16px);
|
|
59
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
60
|
+
border-radius: var(--r-full, 9999px);
|
|
61
|
+
padding: 4px;
|
|
62
|
+
user-select: none;
|
|
63
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.glass-toggle-group--sm {
|
|
67
|
+
padding: 3px;
|
|
68
|
+
}
|
|
69
|
+
.glass-toggle-group--sm .glass-toggle-group__label {
|
|
70
|
+
padding: 0.35rem 0.8rem;
|
|
71
|
+
font-size: 0.78rem;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.glass-toggle-group--md .glass-toggle-group__label {
|
|
75
|
+
padding: 0.5rem 1.15rem;
|
|
76
|
+
font-size: 0.88rem;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.glass-toggle-group--lg .glass-toggle-group__label {
|
|
80
|
+
padding: 0.7rem 1.6rem;
|
|
81
|
+
font-size: 1rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.glass-toggle-group__item {
|
|
85
|
+
position: relative;
|
|
86
|
+
z-index: 2;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.glass-toggle-group__radio {
|
|
93
|
+
position: absolute;
|
|
94
|
+
opacity: 0;
|
|
95
|
+
pointer-events: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.glass-toggle-group__label {
|
|
99
|
+
display: inline-flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
gap: 6px;
|
|
102
|
+
font-family: var(--font-sans, system-ui, sans-serif);
|
|
103
|
+
font-weight: 600;
|
|
104
|
+
color: var(--c-text-2, #a3a3a3);
|
|
105
|
+
border-radius: var(--r-full, 9999px);
|
|
106
|
+
transition: color 0.25s ease;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.glass-toggle-group__item:hover .glass-toggle-group__label {
|
|
110
|
+
color: var(--c-text-1, #ffffff);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.glass-toggle-group__radio:checked + .glass-toggle-group__label {
|
|
114
|
+
color: #050505;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Sliding backdrop element */
|
|
118
|
+
.glass-toggle-group__slider {
|
|
119
|
+
position: absolute;
|
|
120
|
+
top: 4px;
|
|
121
|
+
bottom: 4px;
|
|
122
|
+
left: 4px;
|
|
123
|
+
border-radius: var(--r-full, 9999px);
|
|
124
|
+
background: linear-gradient(135deg, #d4a017, #b8860b);
|
|
125
|
+
box-shadow: 0 4px 16px rgba(184, 134, 11, 0.4);
|
|
126
|
+
z-index: 1;
|
|
127
|
+
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
128
|
+
pointer-events: none;
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
131
|
+
|
|
132
|
+
<script>
|
|
133
|
+
function setupGlassToggleGroups() {
|
|
134
|
+
document.querySelectorAll('[data-toggle-group]').forEach((group) => {
|
|
135
|
+
const slider = group.querySelector('[data-toggle-slider]') as HTMLElement;
|
|
136
|
+
const radios = group.querySelectorAll('[data-toggle-radio]') as NodeListOf<HTMLInputElement>;
|
|
137
|
+
if (!slider || radios.length === 0) return;
|
|
138
|
+
|
|
139
|
+
function updateSlider() {
|
|
140
|
+
const checked = group.querySelector('[data-toggle-radio]:checked') as HTMLInputElement;
|
|
141
|
+
if (!checked) return;
|
|
142
|
+
const label = checked.closest('.glass-toggle-group__item') as HTMLElement;
|
|
143
|
+
if (!label) return;
|
|
144
|
+
|
|
145
|
+
const groupRect = group.getBoundingClientRect();
|
|
146
|
+
const labelRect = label.getBoundingClientRect();
|
|
147
|
+
|
|
148
|
+
const offsetLeft = labelRect.left - groupRect.left;
|
|
149
|
+
slider.style.width = `${labelRect.width}px`;
|
|
150
|
+
slider.style.transform = `translateX(${offsetLeft - 4}px)`;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
radios.forEach((r) => r.addEventListener('change', updateSlider));
|
|
154
|
+
updateSlider();
|
|
155
|
+
window.addEventListener('resize', updateSlider);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
setupGlassToggleGroups();
|
|
160
|
+
document.addEventListener('astro:page-load', setupGlassToggleGroups);
|
|
161
|
+
</script>
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* PasswordStrengthInput — Secure password input field with visual strength estimator bar and eye toggle.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} id - HTML ID for the password input.
|
|
6
|
+
* @param {string} label - Input label text. Default is 'Password'.
|
|
7
|
+
* @param {string} name - Form field name. Default is 'password'.
|
|
8
|
+
* @param {string} placeholder - Placeholder text. Default is 'Enter secure password'.
|
|
9
|
+
* @param {boolean} required - HTML required field attribute.
|
|
10
|
+
*/
|
|
11
|
+
interface Props {
|
|
12
|
+
id: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
id = 'password-input',
|
|
21
|
+
label = 'Password',
|
|
22
|
+
name = 'password',
|
|
23
|
+
placeholder = 'Enter secure password',
|
|
24
|
+
required = false,
|
|
25
|
+
} = Astro.props;
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
<div class="pwd-group" data-pwd-group>
|
|
29
|
+
<div class="pwd-group__header">
|
|
30
|
+
<label for={id} class="pwd-group__label">{label}</label>
|
|
31
|
+
<span class="pwd-group__status" data-pwd-status>Too weak</span>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<div class="pwd-group__field">
|
|
35
|
+
<input
|
|
36
|
+
type="password"
|
|
37
|
+
id={id}
|
|
38
|
+
name={name}
|
|
39
|
+
placeholder={placeholder}
|
|
40
|
+
required={required}
|
|
41
|
+
class="pwd-group__input"
|
|
42
|
+
data-pwd-input
|
|
43
|
+
autocomplete="new-password"
|
|
44
|
+
/>
|
|
45
|
+
<button
|
|
46
|
+
type="button"
|
|
47
|
+
class="pwd-group__toggle"
|
|
48
|
+
aria-label="Toggle password visibility"
|
|
49
|
+
data-pwd-toggle
|
|
50
|
+
>
|
|
51
|
+
<svg class="eye-open" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
52
|
+
<path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" />
|
|
53
|
+
<circle cx="12" cy="12" r="3" />
|
|
54
|
+
</svg>
|
|
55
|
+
<svg class="eye-closed" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:none;">
|
|
56
|
+
<path d="M9.88 9.88a3 3 0 1 0 4.24 4.24" />
|
|
57
|
+
<path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" />
|
|
58
|
+
<path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" />
|
|
59
|
+
<line x1="2" x2="22" y1="2" y2="22" />
|
|
60
|
+
</svg>
|
|
61
|
+
</button>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<!-- 4-segment strength meter -->
|
|
65
|
+
<div class="pwd-group__meter" aria-hidden="true">
|
|
66
|
+
<div class="pwd-group__segment" data-seg="1"></div>
|
|
67
|
+
<div class="pwd-group__segment" data-seg="2"></div>
|
|
68
|
+
<div class="pwd-group__segment" data-seg="3"></div>
|
|
69
|
+
<div class="pwd-group__segment" data-seg="4"></div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<style>
|
|
74
|
+
.pwd-group {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
gap: var(--sp-2, 0.5rem);
|
|
78
|
+
width: 100%;
|
|
79
|
+
max-width: 360px;
|
|
80
|
+
font-family: var(--font-sans, system-ui, sans-serif);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.pwd-group__header {
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-content: space-between;
|
|
86
|
+
align-items: center;
|
|
87
|
+
padding: 0 0.2rem;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.pwd-group__label {
|
|
91
|
+
font-size: 0.85rem;
|
|
92
|
+
font-weight: 600;
|
|
93
|
+
color: var(--c-text-1, #ffffff);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.pwd-group__status {
|
|
97
|
+
font-size: 0.72rem;
|
|
98
|
+
font-weight: 700;
|
|
99
|
+
text-transform: uppercase;
|
|
100
|
+
letter-spacing: 0.05em;
|
|
101
|
+
color: #ef4444;
|
|
102
|
+
transition: color 0.3s ease;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.pwd-group__field {
|
|
106
|
+
position: relative;
|
|
107
|
+
width: 100%;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.pwd-group__input {
|
|
111
|
+
width: 100%;
|
|
112
|
+
padding: 0.75rem 2.8rem 0.75rem 1rem;
|
|
113
|
+
background: rgba(255, 255, 255, 0.03);
|
|
114
|
+
backdrop-filter: blur(12px);
|
|
115
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
116
|
+
border-radius: var(--r-md, 12px);
|
|
117
|
+
color: var(--c-text-1, #ffffff);
|
|
118
|
+
font-size: 0.92rem;
|
|
119
|
+
outline: none;
|
|
120
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.pwd-group__input:focus {
|
|
124
|
+
border-color: rgba(184, 134, 11, 0.5);
|
|
125
|
+
box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.15);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.pwd-group__input::placeholder {
|
|
129
|
+
color: rgba(255, 255, 255, 0.3);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.pwd-group__toggle {
|
|
133
|
+
position: absolute;
|
|
134
|
+
right: 0.75rem;
|
|
135
|
+
top: 50%;
|
|
136
|
+
transform: translateY(-50%);
|
|
137
|
+
background: transparent;
|
|
138
|
+
border: none;
|
|
139
|
+
color: var(--c-text-3, #737373);
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
padding: 0.3rem;
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
border-radius: var(--r-sm, 6px);
|
|
146
|
+
transition: color 0.2s ease;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.pwd-group__toggle:hover {
|
|
150
|
+
color: var(--c-text-1, #ffffff);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.pwd-group__meter {
|
|
154
|
+
display: grid;
|
|
155
|
+
grid-template-columns: repeat(4, 1fr);
|
|
156
|
+
gap: 6px;
|
|
157
|
+
height: 4px;
|
|
158
|
+
margin-top: 4px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.pwd-group__segment {
|
|
162
|
+
height: 100%;
|
|
163
|
+
border-radius: 4px;
|
|
164
|
+
background: rgba(255, 255, 255, 0.08);
|
|
165
|
+
transition: background 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Dynamic levels */
|
|
169
|
+
.pwd-group[data-level="1"] .pwd-group__segment[data-seg="1"] {
|
|
170
|
+
background: #ef4444;
|
|
171
|
+
}
|
|
172
|
+
.pwd-group[data-level="1"] .pwd-group__status {
|
|
173
|
+
color: #ef4444;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.pwd-group[data-level="2"] .pwd-group__segment[data-seg="1"],
|
|
177
|
+
.pwd-group[data-level="2"] .pwd-group__segment[data-seg="2"] {
|
|
178
|
+
background: #f59e0b;
|
|
179
|
+
}
|
|
180
|
+
.pwd-group[data-level="2"] .pwd-group__status {
|
|
181
|
+
color: #f59e0b;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.pwd-group[data-level="3"] .pwd-group__segment[data-seg="1"],
|
|
185
|
+
.pwd-group[data-level="3"] .pwd-group__segment[data-seg="2"],
|
|
186
|
+
.pwd-group[data-level="3"] .pwd-group__segment[data-seg="3"] {
|
|
187
|
+
background: #3b82f6;
|
|
188
|
+
}
|
|
189
|
+
.pwd-group[data-level="3"] .pwd-group__status {
|
|
190
|
+
color: #3b82f6;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.pwd-group[data-level="4"] .pwd-group__segment {
|
|
194
|
+
background: #10b981;
|
|
195
|
+
box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
|
|
196
|
+
}
|
|
197
|
+
.pwd-group[data-level="4"] .pwd-group__status {
|
|
198
|
+
color: #10b981;
|
|
199
|
+
}
|
|
200
|
+
</style>
|
|
201
|
+
|
|
202
|
+
<script>
|
|
203
|
+
function initPasswordGroups() {
|
|
204
|
+
document.querySelectorAll('[data-pwd-group]').forEach((group) => {
|
|
205
|
+
const input = group.querySelector('[data-pwd-input]') as HTMLInputElement;
|
|
206
|
+
const toggle = group.querySelector('[data-pwd-toggle]') as HTMLButtonElement;
|
|
207
|
+
const status = group.querySelector('[data-pwd-status]') as HTMLElement;
|
|
208
|
+
if (!input || !toggle) return;
|
|
209
|
+
|
|
210
|
+
const eyeOpen = toggle.querySelector('.eye-open') as HTMLElement;
|
|
211
|
+
const eyeClosed = toggle.querySelector('.eye-closed') as HTMLElement;
|
|
212
|
+
|
|
213
|
+
toggle.addEventListener('click', () => {
|
|
214
|
+
const isPassword = input.type === 'password';
|
|
215
|
+
input.type = isPassword ? 'text' : 'password';
|
|
216
|
+
if (eyeOpen && eyeClosed) {
|
|
217
|
+
eyeOpen.style.display = isPassword ? 'none' : 'block';
|
|
218
|
+
eyeClosed.style.display = isPassword ? 'block' : 'none';
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
input.addEventListener('input', () => {
|
|
223
|
+
const val = input.value;
|
|
224
|
+
let score = 0;
|
|
225
|
+
if (val.length >= 6) score++;
|
|
226
|
+
if (val.length >= 10) score++;
|
|
227
|
+
if (/[A-Z]/.test(val) && /[0-9]/.test(val)) score++;
|
|
228
|
+
if (/[^A-Za-z0-9]/.test(val)) score++;
|
|
229
|
+
|
|
230
|
+
group.setAttribute('data-level', String(score));
|
|
231
|
+
|
|
232
|
+
const labels = ['Too weak', 'Weak', 'Fair', 'Strong', 'Secure & Robust'];
|
|
233
|
+
if (status) {
|
|
234
|
+
status.textContent = labels[score] || 'Too weak';
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
initPasswordGroups();
|
|
241
|
+
document.addEventListener('astro:page-load', initPasswordGroups);
|
|
242
|
+
</script>
|