astro-component-kit 0.4.0 → 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.
Files changed (180) hide show
  1. package/README.md +105 -27
  2. package/package.json +16 -3
  3. package/src/components/index.ts +2 -0
  4. package/src/components/lib/Galaxy3D.astro +249 -137
  5. package/src/components/lib/app/AppSidebar.astro +249 -0
  6. package/src/components/lib/app/AppTopbar.astro +284 -0
  7. package/src/components/lib/app/ArrivalsBoard.astro +176 -0
  8. package/src/components/lib/app/AuthCard.astro +213 -0
  9. package/src/components/lib/app/DataTable.astro +346 -0
  10. package/src/components/lib/app/GuestProfileCard.astro +133 -0
  11. package/src/components/lib/app/HousekeepingBoard.astro +189 -0
  12. package/src/components/lib/app/PageHeader.astro +157 -0
  13. package/src/components/lib/app/PlanUsageCard.astro +112 -0
  14. package/src/components/lib/app/RoomRack.astro +207 -0
  15. package/src/components/lib/app/SettingsSection.astro +96 -0
  16. package/src/components/lib/app/SwitchRow.astro +71 -0
  17. package/src/components/lib/app/TeamMembers.astro +190 -0
  18. package/src/components/lib/app/app-icons.ts +52 -0
  19. package/src/components/lib/app/index.ts +19 -0
  20. package/src/components/lib/charts/AreaChart.astro +4 -4
  21. package/src/components/lib/charts/BarChart.astro +3 -3
  22. package/src/components/lib/charts/ChartFrame.astro +10 -10
  23. package/src/components/lib/charts/DonutChart.astro +2 -2
  24. package/src/components/lib/charts/DumbbellChart.astro +1 -1
  25. package/src/components/lib/charts/ForecastLineChart.astro +1 -1
  26. package/src/components/lib/charts/GaugeChart.astro +1 -1
  27. package/src/components/lib/charts/HeatmapChart.astro +1 -1
  28. package/src/components/lib/charts/HorizontalBarChart.astro +2 -2
  29. package/src/components/lib/charts/KpiStatTile.astro +4 -4
  30. package/src/components/lib/charts/LinearProgressGauge.astro +4 -4
  31. package/src/components/lib/charts/MetricDeltaTable.astro +3 -3
  32. package/src/components/lib/charts/RadarMetricChart.astro +4 -4
  33. package/src/components/lib/charts/RadialBarChart.astro +1 -1
  34. package/src/components/lib/charts/RetentionCohortTable.astro +2 -2
  35. package/src/components/lib/charts/TreemapChart.astro +1 -1
  36. package/src/components/lib/ecommerce/CartDrawer.astro +483 -0
  37. package/src/components/lib/ecommerce/CartPageList.astro +290 -0
  38. package/src/components/lib/ecommerce/CartToast.astro +276 -0
  39. package/src/components/lib/ecommerce/CategoryTiles.astro +143 -0
  40. package/src/components/lib/ecommerce/CheckoutForm.astro +423 -0
  41. package/src/components/lib/ecommerce/CountdownBanner.astro +230 -0
  42. package/src/components/lib/ecommerce/FilterBar.astro +278 -0
  43. package/src/components/lib/ecommerce/FilterSidebar.astro +405 -0
  44. package/src/components/lib/ecommerce/LiveActivityToast.astro +213 -0
  45. package/src/components/lib/ecommerce/OrderSummary.astro +295 -0
  46. package/src/components/lib/ecommerce/ProductBuyBox.astro +247 -0
  47. package/src/components/lib/ecommerce/ProductCardMinimal.astro +229 -0
  48. package/src/components/lib/ecommerce/ProductGallery.astro +145 -0
  49. package/src/components/lib/ecommerce/ProductGrid.astro +118 -0
  50. package/src/components/lib/ecommerce/ProductMedia.astro +113 -0
  51. package/src/components/lib/ecommerce/ProductRating.astro +78 -0
  52. package/src/components/lib/ecommerce/ProductToolbar.astro +93 -0
  53. package/src/components/lib/ecommerce/PromoBar.astro +145 -0
  54. package/src/components/lib/ecommerce/StockIndicator.astro +127 -0
  55. package/src/components/lib/ecommerce/StoreHeader.astro +446 -0
  56. package/src/components/lib/ecommerce/StoreHero.astro +260 -0
  57. package/src/components/lib/ecommerce/StoreProductCard.astro +307 -0
  58. package/src/components/lib/ecommerce/TrustBadges.astro +101 -0
  59. package/src/components/lib/ecommerce/VariantPicker.astro +145 -0
  60. package/src/components/lib/ecommerce/cart-store.ts +151 -0
  61. package/src/components/lib/ecommerce/catalog-filter.ts +62 -0
  62. package/src/components/lib/ecommerce/index.ts +34 -0
  63. package/src/components/lib/ecommerce/product-icons.ts +28 -0
  64. package/src/components/lib/ecommerce/types.ts +70 -0
  65. package/src/components/lib/forms/AnimatedInput.astro +4 -2
  66. package/src/components/lib/forms/CustomRadioGroup.astro +3 -1
  67. package/src/components/lib/index.ts +2 -0
  68. package/src/components/lib/layout/BentoGrid3.astro +6 -4
  69. package/src/components/lib/layout/CenterFixedBox.astro +2 -2
  70. package/src/components/lib/layout/CenteredContainer.astro +4 -2
  71. package/src/components/lib/layout/ClusterHorizontal.astro +2 -2
  72. package/src/components/lib/layout/FeatureHero.astro +4 -2
  73. package/src/components/lib/layout/FooterCenteredMinimal.astro +4 -2
  74. package/src/components/lib/layout/FullBleedSection.astro +2 -2
  75. package/src/components/lib/layout/GalleryGrid4.astro +2 -2
  76. package/src/components/lib/layout/HolyGrailGrid.astro +11 -9
  77. package/src/components/lib/layout/LandingSectionSplit.astro +5 -3
  78. package/src/components/lib/layout/MasonryGrid.astro +2 -2
  79. package/src/components/lib/layout/MinimalFooterGrid.astro +1 -1
  80. package/src/components/lib/layout/ScrollSnapSection.astro +1 -1
  81. package/src/components/lib/layout/SidebarLayoutWrapper.astro +4 -2
  82. package/src/components/lib/layout/SplitScreenLayout.astro +3 -3
  83. package/src/components/lib/layout/StepLayoutVertical.astro +1 -1
  84. package/src/components/lib/layout/StickySidebarWrapper.astro +4 -2
  85. package/src/components/lib/sections/AgencyContactBrief.astro +194 -0
  86. package/src/components/lib/sections/AgencyFooterCta.astro +94 -0
  87. package/src/components/lib/sections/AgencyHeader.astro +161 -0
  88. package/src/components/lib/sections/AgencyHeroKinetic.astro +172 -0
  89. package/src/components/lib/sections/AgencyServicesList.astro +113 -0
  90. package/src/components/lib/sections/AgencyTeamGrid.astro +111 -0
  91. package/src/components/lib/sections/AgencyWorkGrid.astro +147 -0
  92. package/src/components/lib/sections/BlogGridSection.astro +9 -7
  93. package/src/components/lib/sections/ButtonsShowcase.astro +20 -18
  94. package/src/components/lib/sections/CardsShowcase.astro +28 -26
  95. package/src/components/lib/sections/CareersOpenings.astro +10 -8
  96. package/src/components/lib/sections/ChangelogSection.astro +14 -7
  97. package/src/components/lib/sections/ContactGlassForm.astro +10 -8
  98. package/src/components/lib/sections/ContactSplitMap.astro +11 -9
  99. package/src/components/lib/sections/CtaAppDownload.astro +13 -11
  100. package/src/components/lib/sections/CtaGlowBanner.astro +12 -10
  101. package/src/components/lib/sections/CtaNewsletterSection.astro +13 -11
  102. package/src/components/lib/sections/CtaSplitImage.astro +13 -11
  103. package/src/components/lib/sections/DataShowcase.astro +23 -21
  104. package/src/components/lib/sections/FaqAccordionSection.astro +8 -8
  105. package/src/components/lib/sections/FaqTwoColumn.astro +9 -7
  106. package/src/components/lib/sections/FeatureAlternatingRows.astro +10 -8
  107. package/src/components/lib/sections/FeatureBentoGrid.astro +13 -11
  108. package/src/components/lib/sections/FeatureIconGrid.astro +6 -6
  109. package/src/components/lib/sections/FeatureTabsShowcase.astro +13 -11
  110. package/src/components/lib/sections/FeatureTimelineFlow.astro +8 -6
  111. package/src/components/lib/sections/FeedbackShowcase.astro +15 -13
  112. package/src/components/lib/sections/FooterMegaSection.astro +13 -11
  113. package/src/components/lib/sections/FormsShowcase.astro +22 -20
  114. package/src/components/lib/sections/HeroDashboardPreview.astro +11 -9
  115. package/src/components/lib/sections/HeroGlass.astro +22 -20
  116. package/src/components/lib/sections/HeroGradient.astro +15 -13
  117. package/src/components/lib/sections/HeroMinimalCentered.astro +10 -10
  118. package/src/components/lib/sections/HeroShowcaseSplit.astro +18 -16
  119. package/src/components/lib/sections/HeroSplit.astro +13 -11
  120. package/src/components/lib/sections/HeroTerminal.astro +14 -12
  121. package/src/components/lib/sections/HeroWaitlist.astro +10 -8
  122. package/src/components/lib/sections/HowItWorksSteps.astro +12 -10
  123. package/src/components/lib/sections/IntegrationsGrid.astro +7 -7
  124. package/src/components/lib/sections/LayoutShowcase.astro +21 -19
  125. package/src/components/lib/sections/LogoCloudSection.astro +4 -4
  126. package/src/components/lib/sections/LogoWallGrid.astro +6 -4
  127. package/src/components/lib/sections/NavigationShowcase.astro +15 -13
  128. package/src/components/lib/sections/OverlaysShowcase.astro +21 -19
  129. package/src/components/lib/sections/PricingComparisonMatrix.astro +15 -13
  130. package/src/components/lib/sections/PricingSinglePlan.astro +13 -11
  131. package/src/components/lib/sections/PricingTierCards.astro +11 -9
  132. package/src/components/lib/sections/PricingToggleCards.astro +13 -13
  133. package/src/components/lib/sections/ShopCategoryHero.astro +103 -0
  134. package/src/components/lib/sections/ShopCollectionMosaic.astro +131 -0
  135. package/src/components/lib/sections/ShopFooterWordmark.astro +100 -0
  136. package/src/components/lib/sections/ShopHeaderEditorial.astro +396 -0
  137. package/src/components/lib/sections/ShopHeroEditorial.astro +151 -0
  138. package/src/components/lib/sections/ShopLookbook.astro +250 -0
  139. package/src/components/lib/sections/ShopNewsletterEditorial.astro +128 -0
  140. package/src/components/lib/sections/ShopProductRail.astro +150 -0
  141. package/src/components/lib/sections/ShopReviewsEditorial.astro +133 -0
  142. package/src/components/lib/sections/ShopValuesMarquee.astro +91 -0
  143. package/src/components/lib/sections/StatsCounterBand.astro +9 -7
  144. package/src/components/lib/sections/StatsDashboardSection.astro +4 -2
  145. package/src/components/lib/sections/StatsMetricShowcase.astro +9 -7
  146. package/src/components/lib/sections/TeamGridSection.astro +12 -10
  147. package/src/components/lib/sections/TestimonialCarousel.astro +10 -8
  148. package/src/components/lib/sections/TestimonialFeatured.astro +7 -5
  149. package/src/components/lib/sections/TestimonialGridSection.astro +7 -7
  150. package/src/components/lib/sections/TestimonialWallGlass.astro +11 -9
  151. package/src/components/lib/sections/TypographyShowcase.astro +10 -8
  152. package/src/components/lib/sections/index.ts +10 -0
  153. package/src/components/lib/templates/ecommerce/StoreCategoryPage.astro +160 -0
  154. package/src/components/lib/templates/ecommerce/StoreCheckoutPage.astro +98 -0
  155. package/src/components/lib/templates/ecommerce/StoreHomePage.astro +191 -0
  156. package/src/components/lib/templates/ecommerce/StoreLayout.astro +169 -0
  157. package/src/components/lib/templates/ecommerce/StoreProductPage.astro +165 -0
  158. package/src/components/lib/templates/ecommerce/data.ts +187 -0
  159. package/src/components/lib/templates/ecommerce/index.ts +14 -0
  160. package/src/components/lib/templates/ecommerce-editorial/EditorialBagPage.astro +52 -0
  161. package/src/components/lib/templates/ecommerce-editorial/EditorialCheckoutPage.astro +123 -0
  162. package/src/components/lib/templates/ecommerce-editorial/EditorialHomePage.astro +102 -0
  163. package/src/components/lib/templates/ecommerce-editorial/EditorialLayout.astro +216 -0
  164. package/src/components/lib/templates/ecommerce-editorial/EditorialProductPage.astro +205 -0
  165. package/src/components/lib/templates/ecommerce-editorial/EditorialShopPage.astro +112 -0
  166. package/src/components/lib/templates/ecommerce-editorial/data.ts +125 -0
  167. package/src/components/lib/templates/ecommerce-editorial/index.ts +16 -0
  168. package/src/components/lib/templates/saas-hotel/AppLayout.astro +83 -0
  169. package/src/components/lib/templates/saas-hotel/DashboardPage.astro +66 -0
  170. package/src/components/lib/templates/saas-hotel/GuestsPage.astro +65 -0
  171. package/src/components/lib/templates/saas-hotel/LandingPage.astro +213 -0
  172. package/src/components/lib/templates/saas-hotel/ReportsPage.astro +63 -0
  173. package/src/components/lib/templates/saas-hotel/ReservationsPage.astro +49 -0
  174. package/src/components/lib/templates/saas-hotel/RoomsPage.astro +48 -0
  175. package/src/components/lib/templates/saas-hotel/SettingsPage.astro +115 -0
  176. package/src/components/lib/templates/saas-hotel/SignInPage.astro +50 -0
  177. package/src/components/lib/templates/saas-hotel/data.ts +229 -0
  178. package/src/components/lib/templates/saas-hotel/index.ts +19 -0
  179. package/src/components/lib/templates/saas-hotel/lobby-theme.css +90 -0
  180. package/src/styles/global.css +95 -0
@@ -0,0 +1,230 @@
1
+ ---
2
+ /**
3
+ * CountdownBanner — Live sale countdown (days · hours · minutes · seconds) with title,
4
+ * copy and CTA; switches to an "ended" message when the time runs out.
5
+ *
6
+ * @param {string} endsAt - ISO date the offer ends. When omitted, `hours` is used.
7
+ * @param {number} hours - Rolling offer length in hours, counted from the visitor's first view (stored in localStorage). Default 48.
8
+ * @param {string} eyebrow - Small label. Default 'Flash sale'.
9
+ * @param {string} title - Headline. Default 'Up to 30% off the Storm collection'.
10
+ * @param {string} text - Supporting copy.
11
+ * @param {{label: string, href: string}} cta - Call to action.
12
+ * @param {string} endedText - Message shown after the deadline. Default 'This offer has ended — new deals every Friday.'
13
+ * @param {string} storageKey - localStorage key for the rolling deadline. Default 'ack-countdown'.
14
+ * @param {string} variant - Style (glow|bar|card). Default 'glow'.
15
+ * @param {string} size - Density (sm|md|lg). Default 'md'.
16
+ * @param {string} className - Extra class.
17
+ *
18
+ * Accessibility: the ticking digits are aria-hidden; a visually hidden sentence with the remaining
19
+ * time updates once a minute in a polite live region (no per-second announcements).
20
+ */
21
+ interface Props {
22
+ endsAt?: string;
23
+ hours?: number;
24
+ eyebrow?: string;
25
+ title?: string;
26
+ text?: string;
27
+ cta?: { label: string; href: string };
28
+ endedText?: string;
29
+ storageKey?: string;
30
+ variant?: 'glow' | 'bar' | 'card';
31
+ size?: 'sm' | 'md' | 'lg';
32
+ className?: string;
33
+ }
34
+
35
+ const {
36
+ endsAt,
37
+ hours = 48,
38
+ eyebrow = 'Flash sale',
39
+ title = 'Up to 30% off the Storm collection',
40
+ text = 'Waterproof shells, insulated layers and accessories. While stock lasts.',
41
+ cta = { label: 'Shop the sale', href: '#' },
42
+ endedText = 'This offer has ended — new deals every Friday.',
43
+ storageKey = 'ack-countdown',
44
+ variant = 'glow',
45
+ size = 'md',
46
+ className = '',
47
+ } = Astro.props;
48
+
49
+ const units = [
50
+ { key: 'd', label: 'Days' },
51
+ { key: 'h', label: 'Hours' },
52
+ { key: 'm', label: 'Minutes' },
53
+ { key: 's', label: 'Seconds' },
54
+ ];
55
+ ---
56
+
57
+ <section
58
+ class:list={['countdown', `countdown--${variant}`, `countdown--${size}`, className]}
59
+ data-countdown
60
+ data-ends={endsAt}
61
+ data-hours={hours}
62
+ data-key={storageKey}
63
+ aria-label={title}
64
+ >
65
+ <div class="countdown__inner">
66
+ <div class="countdown__copy">
67
+ {eyebrow && <p class="countdown__eyebrow"><span aria-hidden="true"></span>{eyebrow}</p>}
68
+ <h2 class="countdown__title">{title}</h2>
69
+ {text && <p class="countdown__text" data-live-text>{text}</p>}
70
+ <p class="countdown__ended" data-ended hidden>{endedText}</p>
71
+ </div>
72
+ <div class="countdown__side">
73
+ <div class="countdown__clock" aria-hidden="true" data-clock>
74
+ {units.map((u) => (
75
+ <div class="countdown__unit">
76
+ <span class="countdown__num" data-unit={u.key}>00</span>
77
+ <span class="countdown__label">{u.label}</span>
78
+ </div>
79
+ ))}
80
+ </div>
81
+ <p class="sr-only" aria-live="polite" data-sr></p>
82
+ {cta && <a class="countdown__cta" href={cta.href}>{cta.label}</a>}
83
+ </div>
84
+ </div>
85
+ </section>
86
+
87
+ <script>
88
+ document.querySelectorAll<HTMLElement>('[data-countdown]:not([data-bound])').forEach((el) => {
89
+ el.dataset.bound = '';
90
+ let end = el.dataset.ends ? Date.parse(el.dataset.ends) : NaN;
91
+ if (Number.isNaN(end)) {
92
+ const key = el.dataset.key || 'ack-countdown';
93
+ const ms = (Number(el.dataset.hours) || 48) * 3600_000;
94
+ try {
95
+ const saved = Number(window.localStorage.getItem(key));
96
+ end = saved && saved > Date.now() ? saved : Date.now() + ms;
97
+ window.localStorage.setItem(key, String(end));
98
+ } catch {
99
+ end = Date.now() + ms;
100
+ }
101
+ }
102
+ const nums = Object.fromEntries(Array.from(el.querySelectorAll<HTMLElement>('[data-unit]')).map((n) => [n.dataset.unit, n]));
103
+ const sr = el.querySelector<HTMLElement>('[data-sr]');
104
+ const ended = el.querySelector<HTMLElement>('[data-ended]');
105
+ const clock = el.querySelector<HTMLElement>('[data-clock]');
106
+ let lastMinute = -1;
107
+ let timer = 0;
108
+
109
+ const pad = (n: number) => String(n).padStart(2, '0');
110
+ function tick() {
111
+ const left = Math.max(0, end - Date.now());
112
+ const s = Math.floor(left / 1000);
113
+ const parts = { d: Math.floor(s / 86400), h: Math.floor((s % 86400) / 3600), m: Math.floor((s % 3600) / 60), s: s % 60 };
114
+ (Object.keys(parts) as Array<keyof typeof parts>).forEach((k) => {
115
+ const node = nums[k];
116
+ const value = pad(parts[k]);
117
+ if (node && node.textContent !== value) {
118
+ node.textContent = value;
119
+ node.classList.remove('is-tick');
120
+ void node.offsetWidth;
121
+ node.classList.add('is-tick');
122
+ }
123
+ });
124
+ const minute = Math.floor(s / 60);
125
+ if (sr && minute !== lastMinute) {
126
+ lastMinute = minute;
127
+ sr.textContent = `Offer ends in ${parts.d} days, ${parts.h} hours and ${parts.m} minutes.`;
128
+ }
129
+ if (left === 0) {
130
+ window.clearInterval(timer);
131
+ el.classList.add('is-ended');
132
+ if (ended) ended.hidden = false;
133
+ if (clock) clock.hidden = true;
134
+ if (sr) sr.textContent = ended?.textContent || 'Offer ended.';
135
+ }
136
+ }
137
+ tick();
138
+ timer = window.setInterval(tick, 1000);
139
+ });
140
+ </script>
141
+
142
+ <style>
143
+ .countdown {
144
+ container-type: inline-size;
145
+ position: relative;
146
+ padding: clamp(1.5rem, 4vw, 2.75rem);
147
+ border-radius: var(--r-xl, 28px);
148
+ border: 1px solid rgb(var(--ink-rgb, 255 255 255) / 0.08);
149
+ overflow: hidden;
150
+ isolation: isolate;
151
+ }
152
+ .countdown--glow {
153
+ background:
154
+ radial-gradient(circle at 100% 0%, rgba(248, 113, 113, 0.16), transparent 45%),
155
+ radial-gradient(circle at 0% 100%, rgba(212, 160, 23, 0.16), transparent 45%),
156
+ var(--c-surface, rgb(var(--ink-rgb, 255 255 255) / 0.02));
157
+ }
158
+ .countdown__inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--sp-8, 2rem); }
159
+ .countdown--card { background: var(--c-bg-1, #0a0a0a); }
160
+ .countdown--bar { border-radius: var(--r-md, 12px); padding: var(--sp-3, 0.75rem) var(--sp-5, 1.25rem); }
161
+ .countdown--bar .countdown__inner { grid-template-columns: auto 1fr auto; gap: var(--sp-5, 1.25rem); }
162
+ .countdown--bar .countdown__copy { display: flex; align-items: center; gap: var(--sp-4, 1rem); }
163
+ .countdown--bar .countdown__title { font-size: 1rem; }
164
+ .countdown--bar .countdown__text, .countdown--bar .countdown__eyebrow { display: none; }
165
+ .countdown--bar .countdown__side { display: contents; }
166
+ .countdown--sm { padding: var(--sp-5, 1.25rem); }
167
+
168
+ .countdown__eyebrow {
169
+ display: inline-flex;
170
+ align-items: center;
171
+ gap: var(--sp-2, 0.5rem);
172
+ margin: 0 0 var(--sp-3, 0.75rem);
173
+ font-size: 0.75rem;
174
+ font-weight: 800;
175
+ letter-spacing: 0.12em;
176
+ text-transform: uppercase;
177
+ color: var(--c-danger, #f87171);
178
+ }
179
+ .countdown__eyebrow span { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: cd-pulse 1.6s ease-in-out infinite; }
180
+ .countdown__title { margin: 0; font-size: clamp(1.4rem, 3vw, 2.1rem); font-weight: 900; letter-spacing: -0.03em; line-height: 1.15; color: var(--c-text-1, #fff); }
181
+ .countdown__text, .countdown__ended { margin: var(--sp-3, 0.75rem) 0 0; max-width: 34rem; color: var(--c-text-2, #a3a3a3); }
182
+ .countdown__ended[hidden] { display: none; }
183
+
184
+ .countdown__side { display: grid; justify-items: end; gap: var(--sp-4, 1rem); }
185
+ .countdown__clock { display: flex; gap: var(--sp-2, 0.5rem); }
186
+ .countdown__clock[hidden] { display: none; }
187
+ .countdown__unit {
188
+ display: grid;
189
+ justify-items: center;
190
+ min-width: 72px;
191
+ padding: var(--sp-3, 0.75rem) var(--sp-2, 0.5rem);
192
+ border-radius: var(--r-md, 12px);
193
+ border: 1px solid rgb(var(--ink-rgb, 255 255 255) / 0.1);
194
+ background: rgb(var(--paper-rgb, 5 5 5) / 0.5);
195
+ }
196
+ .countdown--bar .countdown__unit { min-width: 52px; padding: 4px 6px; }
197
+ .countdown__num { font-size: 1.9rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--c-text-1, #fff); line-height: 1.1; }
198
+ .countdown--bar .countdown__num { font-size: 1.1rem; }
199
+ .countdown__num.is-tick { animation: cd-tick 0.35s ease-out; }
200
+ .countdown__label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-text-2, #a3a3a3); }
201
+ .countdown__cta {
202
+ display: inline-flex;
203
+ align-items: center;
204
+ min-height: 48px;
205
+ padding: 0 var(--sp-6, 1.5rem);
206
+ border-radius: var(--r-full, 9999px);
207
+ background: var(--c-primary-light, #d4a017);
208
+ color: var(--c-on-primary, #050505);
209
+ font-weight: 800;
210
+ text-decoration: none;
211
+ }
212
+ .countdown__cta:hover { filter: brightness(1.08); color: var(--c-on-primary, #050505); }
213
+ .countdown__cta:focus-visible { outline: 2px solid var(--c-text-1, #fff); outline-offset: 3px; }
214
+ .countdown.is-ended .countdown__cta { display: none; }
215
+
216
+ @keyframes cd-tick { from { transform: translateY(-4px); opacity: 0.5; } }
217
+ @keyframes cd-pulse { 50% { opacity: 0.35; } }
218
+ .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
219
+
220
+ @container (max-width: 760px) {
221
+ .countdown__inner, .countdown--bar .countdown__inner { grid-template-columns: 1fr; }
222
+ .countdown__side { justify-items: stretch; }
223
+ .countdown__clock { justify-content: space-between; }
224
+ .countdown__unit { flex: 1; min-width: 0; }
225
+ .countdown__cta { justify-content: center; }
226
+ }
227
+ @media (prefers-reduced-motion: reduce) {
228
+ .countdown__num.is-tick, .countdown__eyebrow span { animation: none; }
229
+ }
230
+ </style>
@@ -0,0 +1,278 @@
1
+ ---
2
+ /**
3
+ * FilterBar — Horizontal catalogue toolbar: category chips, a "Refine" panel (price, colour,
4
+ * availability), sort select and a live count. Filters any grid of product cards instantly.
5
+ *
6
+ * @param {string} target - id of the product grid. Default 'product-grid'.
7
+ * @param {Array<{id: string, name: string, count?: number}>} categories - Category chips.
8
+ * @param {string[]} selected - Pre-selected category ids (also read from `?category=`).
9
+ * @param {number} maxPrice - Upper bound of the price slider. Default 400.
10
+ * @param {Array<{name: string, hex: string}>} colors - Colour options.
11
+ * @param {number} total - Initial product count. Default 0.
12
+ * @param {string} allLabel - Label of the "all" chip. Default 'All'.
13
+ * @param {string} countLabel - Text after the count. Default 'products'.
14
+ * @param {string} currency - ISO currency. Default 'EUR'.
15
+ * @param {string} locale - Number format locale. Default 'en-GB'.
16
+ * @param {boolean} sticky - Stick under the header while scrolling. Default true.
17
+ * @param {string} variant - Style (line|filled). Default 'line'.
18
+ * @param {string} id - Base id. Default 'filter-bar'.
19
+ * @param {string} className - Extra class.
20
+ *
21
+ * Accessibility: chips are toggle buttons (aria-pressed); "Refine" is a disclosure that closes
22
+ * with Escape; the count is a polite live region; all controls are native inputs.
23
+ */
24
+ import { formatMoney } from './cart-store';
25
+
26
+ interface Props {
27
+ target?: string;
28
+ categories?: Array<{ id: string; name: string; count?: number }>;
29
+ selected?: string[];
30
+ maxPrice?: number;
31
+ colors?: Array<{ name: string; hex: string }>;
32
+ total?: number;
33
+ allLabel?: string;
34
+ countLabel?: string;
35
+ currency?: string;
36
+ locale?: string;
37
+ sticky?: boolean;
38
+ variant?: 'line' | 'filled';
39
+ id?: string;
40
+ className?: string;
41
+ }
42
+
43
+ const {
44
+ target = 'product-grid',
45
+ categories = [
46
+ { id: 'clothing', name: 'Clothing', count: 5 },
47
+ { id: 'shoes', name: 'Shoes', count: 2 },
48
+ { id: 'bags', name: 'Bags', count: 2 },
49
+ { id: 'objects', name: 'Objects', count: 3 },
50
+ ],
51
+ selected = [],
52
+ maxPrice = 400,
53
+ colors = [
54
+ { name: 'Oat', hex: '#d9cbb3' },
55
+ { name: 'Ink', hex: '#22252b' },
56
+ { name: 'Rust', hex: '#9c3d1c' },
57
+ { name: 'Sage', hex: '#8a9a7b' },
58
+ ],
59
+ total = 0,
60
+ allLabel = 'All',
61
+ countLabel = 'products',
62
+ currency = 'EUR',
63
+ locale = 'en-GB',
64
+ sticky = true,
65
+ variant = 'line',
66
+ id = 'filter-bar',
67
+ className = '',
68
+ } = Astro.props;
69
+
70
+ const money = { currency, locale };
71
+ ---
72
+
73
+ <div class:list={['fbar', `fbar--${variant}`, { 'fbar--sticky': sticky }, className]} data-filter-bar data-target={target} data-currency={currency} data-locale={locale}>
74
+ <div class="fbar__row">
75
+ <div class="fbar__chips" role="group" aria-label="Categories">
76
+ <button type="button" class="fbar__chip" data-chip="" aria-pressed={selected.length === 0 ? 'true' : 'false'}>{allLabel}</button>
77
+ {categories.map((c) => (
78
+ <button type="button" class="fbar__chip" data-chip={c.id} aria-pressed={selected.includes(c.id) ? 'true' : 'false'}>
79
+ {c.name}{c.count !== undefined && <sup>{c.count}</sup>}
80
+ </button>
81
+ ))}
82
+ </div>
83
+
84
+ <div class="fbar__tools">
85
+ <p class="fbar__count" aria-live="polite"><span data-result-count={target}>{total}</span> {countLabel}</p>
86
+ <button type="button" class="fbar__refine" aria-expanded="false" aria-controls={`${id}-panel`} data-refine>
87
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M4 7h10M18 7h2M4 17h4M12 17h8"/><circle cx="16" cy="7" r="2"/><circle cx="10" cy="17" r="2"/></svg>
88
+ Refine <span class="fbar__badge" data-active hidden></span>
89
+ </button>
90
+ <label class="fbar__sort">
91
+ <span class="sr-only">Sort by</span>
92
+ <select data-sort>
93
+ <option value="featured">Featured</option>
94
+ <option value="price-asc">Price, low to high</option>
95
+ <option value="price-desc">Price, high to low</option>
96
+ <option value="name">Alphabetical</option>
97
+ </select>
98
+ </label>
99
+ </div>
100
+ </div>
101
+
102
+ <form class="fbar__panel" id={`${id}-panel`} hidden data-panel aria-label="Refine products">
103
+ <fieldset>
104
+ <legend>Price</legend>
105
+ <label class="fbar__range">
106
+ <span>Up to <output data-price-out>{formatMoney(maxPrice, money)}</output></span>
107
+ <input type="range" name="max" min="0" max={maxPrice} step="5" value={maxPrice} aria-label="Maximum price" />
108
+ </label>
109
+ </fieldset>
110
+ {colors.length > 0 && (
111
+ <fieldset>
112
+ <legend>Colour</legend>
113
+ <div class="fbar__colors">
114
+ {colors.map((c) => (
115
+ <label class="fbar__color" style={`--sw: ${c.hex}`}>
116
+ <input type="checkbox" name="color" value={c.name.toLowerCase()} />
117
+ <span aria-hidden="true"></span>{c.name}
118
+ </label>
119
+ ))}
120
+ </div>
121
+ </fieldset>
122
+ )}
123
+ <fieldset>
124
+ <legend>Availability</legend>
125
+ <label class="fbar__check"><input type="checkbox" name="stock" value="in" /> <span>In stock only</span></label>
126
+ </fieldset>
127
+ <div class="fbar__panel-actions">
128
+ <button type="reset" class="fbar__link">Clear filters</button>
129
+ <button type="button" class="fbar__done" data-close>Show results</button>
130
+ </div>
131
+ </form>
132
+ </div>
133
+
134
+ <script>
135
+ import { applyCatalogFilter, syncCatalogUrl } from './catalog-filter';
136
+ import { formatMoney } from './cart-store';
137
+
138
+ document.querySelectorAll<HTMLElement>('[data-filter-bar]:not([data-bound])').forEach((bar) => {
139
+ bar.dataset.bound = '';
140
+ const grid = document.getElementById(bar.dataset.target || '');
141
+ if (!grid) return;
142
+ const target: HTMLElement = grid;
143
+ const chips = Array.from(bar.querySelectorAll<HTMLButtonElement>('[data-chip]'));
144
+ const panel = bar.querySelector<HTMLFormElement>('[data-panel]')!;
145
+ const refine = bar.querySelector<HTMLButtonElement>('[data-refine]')!;
146
+ const sort = bar.querySelector<HTMLSelectElement>('[data-sort]')!;
147
+ const active = bar.querySelector<HTMLElement>('[data-active]')!;
148
+ const priceOut = bar.querySelector<HTMLOutputElement>('[data-price-out]');
149
+ const priceInput = panel.elements.namedItem('max') as HTMLInputElement;
150
+ const money = { currency: bar.dataset.currency, locale: bar.dataset.locale };
151
+
152
+ const params = new URLSearchParams(window.location.search);
153
+ let categories = (params.get('category') || '').split(',').filter(Boolean);
154
+ if (!categories.length) categories = chips.filter((c) => c.dataset.chip && c.getAttribute('aria-pressed') === 'true').map((c) => c.dataset.chip!);
155
+ if (params.get('sort')) sort.value = params.get('sort')!;
156
+
157
+ function run() {
158
+ const data = new FormData(panel);
159
+ const max = Number(data.get('max'));
160
+ const colors = data.getAll('color') as string[];
161
+ const inStockOnly = data.get('stock') === 'in';
162
+ chips.forEach((c) => {
163
+ const id = c.dataset.chip;
164
+ c.setAttribute('aria-pressed', String(id ? categories.includes(id) : categories.length === 0));
165
+ });
166
+ applyCatalogFilter(target, { categories, colors, maxPrice: max, minRating: 0, inStockOnly, sort: sort.value });
167
+ syncCatalogUrl({ categories, sort: sort.value });
168
+ if (priceOut) priceOut.textContent = formatMoney(max, money);
169
+ const n = colors.length + (inStockOnly ? 1 : 0) + (max < Number(priceInput.max) ? 1 : 0);
170
+ active.hidden = n === 0;
171
+ active.textContent = String(n);
172
+ }
173
+
174
+ chips.forEach((chip) => chip.addEventListener('click', () => {
175
+ const id = chip.dataset.chip;
176
+ if (!id) categories = [];
177
+ else categories = categories.includes(id) ? categories.filter((c) => c !== id) : [...categories, id];
178
+ run();
179
+ }));
180
+ const setOpen = (open: boolean) => {
181
+ panel.hidden = !open;
182
+ refine.setAttribute('aria-expanded', String(open));
183
+ };
184
+ refine.addEventListener('click', () => setOpen(panel.hidden));
185
+ bar.querySelector('[data-close]')?.addEventListener('click', () => { setOpen(false); refine.focus(); });
186
+ bar.addEventListener('keydown', (e) => { if (e.key === 'Escape' && !panel.hidden) { setOpen(false); refine.focus(); } });
187
+ panel.addEventListener('input', run);
188
+ panel.addEventListener('reset', () => window.setTimeout(run, 0));
189
+ sort.addEventListener('change', run);
190
+ run();
191
+ });
192
+ </script>
193
+
194
+ <style>
195
+ .fbar { container-type: inline-size; position: relative; z-index: 5; border-block: 1px solid var(--c-border, rgba(255, 255, 255, 0.1)); background: var(--c-bg, #050505); }
196
+ .fbar--sticky { position: sticky; top: var(--shop-header-h, 0px); }
197
+ .fbar--filled { background: var(--c-bg-1, #0a0a0a); }
198
+ .fbar__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4, 1rem); min-height: 60px; }
199
+ .fbar__chips { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-block: 8px; }
200
+ .fbar__chips::-webkit-scrollbar { display: none; }
201
+ .fbar__chip {
202
+ display: inline-flex;
203
+ align-items: flex-start;
204
+ gap: 3px;
205
+ min-height: 40px;
206
+ padding: 0.55rem 0.9rem;
207
+ border: 1px solid transparent;
208
+ border-radius: var(--r-full, 999px);
209
+ background: transparent;
210
+ color: var(--c-text-2, #a3a3a3);
211
+ font: inherit;
212
+ font-size: 0.88rem;
213
+ font-weight: 500;
214
+ white-space: nowrap;
215
+ cursor: pointer;
216
+ transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
217
+ }
218
+ .fbar__chip sup { font-size: 0.62rem; opacity: 0.8; }
219
+ .fbar__chip:hover { color: var(--c-text-1, #fff); border-color: var(--c-border, rgba(255, 255, 255, 0.15)); }
220
+ .fbar__chip[aria-pressed='true'] { color: var(--c-bg, #050505); background: var(--c-text-1, #fff); }
221
+
222
+ .fbar__tools { display: flex; align-items: center; gap: var(--sp-3, 0.75rem); flex-shrink: 0; }
223
+ .fbar__count { margin: 0; font-size: 0.8rem; color: var(--c-text-2, #a3a3a3); white-space: nowrap; }
224
+ .fbar__count span { color: var(--c-text-1, #fff); font-weight: 700; }
225
+ .fbar__refine, .fbar__sort select {
226
+ display: inline-flex;
227
+ align-items: center;
228
+ gap: 6px;
229
+ min-height: 40px;
230
+ padding: 0 0.9rem;
231
+ border: 1px solid var(--c-border, rgba(255, 255, 255, 0.15));
232
+ border-radius: var(--r-sm, 2px);
233
+ background: transparent;
234
+ color: var(--c-text-1, #fff);
235
+ font: inherit;
236
+ font-size: 0.85rem;
237
+ cursor: pointer;
238
+ }
239
+ .fbar__sort select { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
240
+ .fbar__sort select option { background: var(--c-bg-1, #0a0a0a); color: var(--c-text-1, #fff); }
241
+ .fbar__refine[aria-expanded='true'] { background: var(--c-text-1, #fff); color: var(--c-bg, #050505); }
242
+ .fbar__badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--shop-accent, var(--c-primary-light, #d4a017)); color: var(--c-on-primary, #050505); font-size: 0.68rem; font-weight: 800; line-height: 18px; text-align: center; }
243
+ .fbar__badge[hidden] { display: none; }
244
+ .fbar :is(button, select, input):focus-visible { outline: 2px solid var(--shop-accent, var(--c-primary-light, #d4a017)); outline-offset: 2px; }
245
+
246
+ .fbar__panel {
247
+ display: grid;
248
+ grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
249
+ gap: var(--sp-6, 1.5rem);
250
+ padding: var(--sp-5, 1.25rem) 0 var(--sp-6, 1.5rem);
251
+ border-top: 1px solid var(--c-border, rgba(255, 255, 255, 0.1));
252
+ }
253
+ .fbar__panel[hidden] { display: none; }
254
+ .fbar__panel fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
255
+ .fbar__panel legend { margin-bottom: var(--sp-3, 0.75rem); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-text-2, #a3a3a3); }
256
+ .fbar__range { display: grid; gap: var(--sp-2, 0.5rem); font-size: 0.88rem; color: var(--c-text-1, #fff); }
257
+ .fbar__range input { width: 100%; accent-color: var(--shop-accent, var(--c-primary-light, #d4a017)); }
258
+ .fbar__colors { display: flex; flex-wrap: wrap; gap: var(--sp-2, 0.5rem); }
259
+ .fbar__color { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 0.7rem 0 0.4rem; border: 1px solid var(--c-border, rgba(255, 255, 255, 0.15)); border-radius: 999px; font-size: 0.82rem; color: var(--c-text-1, #fff); cursor: pointer; }
260
+ .fbar__color input { position: absolute; opacity: 0; width: 1px; height: 1px; }
261
+ .fbar__color span { width: 18px; height: 18px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgb(var(--ink-rgb, 255 255 255) / 0.2); }
262
+ .fbar__color:has(input:checked) { border-color: var(--c-text-1, #fff); background: rgb(var(--ink-rgb, 255 255 255) / 0.06); }
263
+ .fbar__color:has(input:focus-visible) { outline: 2px solid var(--shop-accent, var(--c-primary-light, #d4a017)); outline-offset: 2px; }
264
+ .fbar__check { display: inline-flex; align-items: center; gap: var(--sp-2, 0.5rem); min-height: 36px; font-size: 0.88rem; color: var(--c-text-1, #fff); cursor: pointer; }
265
+ .fbar__check input { width: 18px; height: 18px; accent-color: var(--shop-accent, var(--c-primary-light, #d4a017)); }
266
+ .fbar__panel-actions { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; gap: var(--sp-2, 0.5rem); }
267
+ .fbar__link { min-height: 36px; border: 0; background: none; color: var(--c-text-2, #a3a3a3); font: inherit; font-size: 0.85rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
268
+ .fbar__done { min-height: 44px; padding: 0 1.25rem; border: 0; border-radius: var(--r-sm, 2px); background: var(--c-text-1, #fff); color: var(--c-bg, #050505); font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer; }
269
+
270
+ .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
271
+
272
+ @container (max-width: 860px) {
273
+ .fbar__row { flex-direction: column; align-items: stretch; gap: 0; }
274
+ .fbar__tools { justify-content: space-between; padding-bottom: 10px; }
275
+ .fbar__panel { grid-template-columns: 1fr; }
276
+ .fbar__panel-actions { flex-direction: row; justify-content: space-between; }
277
+ }
278
+ </style>