bits-lab 0.0.0-stage → 0.1.2

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 (323) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -2
  3. package/dist/Accordion.d.ts +52 -0
  4. package/dist/Accordion.js +192 -0
  5. package/dist/AchievementToast.d.ts +36 -0
  6. package/dist/AchievementToast.js +162 -0
  7. package/dist/AgentCard.d.ts +41 -0
  8. package/dist/AgentCard.js +168 -0
  9. package/dist/ArcadeButtons.d.ts +23 -0
  10. package/dist/ArcadeButtons.js +169 -0
  11. package/dist/AuroraBands.d.ts +19 -0
  12. package/dist/AuroraBands.js +126 -0
  13. package/dist/AvatarTooltips.d.ts +32 -0
  14. package/dist/AvatarTooltips.js +121 -0
  15. package/dist/BarRace.d.ts +39 -0
  16. package/dist/BarRace.js +227 -0
  17. package/dist/BentoGrid.d.ts +50 -0
  18. package/dist/BentoGrid.js +145 -0
  19. package/dist/BootSequence.d.ts +48 -0
  20. package/dist/BootSequence.js +234 -0
  21. package/dist/BreadcrumbTrail.d.ts +31 -0
  22. package/dist/BreadcrumbTrail.js +181 -0
  23. package/dist/CRTPower.d.ts +30 -0
  24. package/dist/CRTPower.js +142 -0
  25. package/dist/CardDeck.d.ts +29 -0
  26. package/dist/CardDeck.js +154 -0
  27. package/dist/ChangelogTimeline.d.ts +35 -0
  28. package/dist/ChangelogTimeline.js +137 -0
  29. package/dist/ChapterProgress.d.ts +23 -0
  30. package/dist/ChapterProgress.js +211 -0
  31. package/dist/ChatBubbles.d.ts +42 -0
  32. package/dist/ChatBubbles.js +198 -0
  33. package/dist/ChiptuneKit.d.ts +158 -0
  34. package/dist/ChiptuneKit.js +207 -0
  35. package/dist/CipherCard.d.ts +22 -0
  36. package/dist/CipherCard.js +91 -0
  37. package/dist/CloudSky.d.ts +28 -0
  38. package/dist/CloudSky.js +222 -0
  39. package/dist/CodeRain.d.ts +24 -0
  40. package/dist/CodeRain.js +158 -0
  41. package/dist/CodeShowcase.d.ts +50 -0
  42. package/dist/CodeShowcase.js +307 -0
  43. package/dist/ColorDial.d.ts +42 -0
  44. package/dist/ColorDial.js +288 -0
  45. package/dist/CommandPalette.d.ts +59 -0
  46. package/dist/CommandPalette.js +349 -0
  47. package/dist/CompareSlider.d.ts +33 -0
  48. package/dist/CompareSlider.js +152 -0
  49. package/dist/Confetti.d.ts +61 -0
  50. package/dist/Confetti.js +176 -0
  51. package/dist/ConnectBeams.d.ts +39 -0
  52. package/dist/ConnectBeams.js +132 -0
  53. package/dist/ContextOrb.d.ts +34 -0
  54. package/dist/ContextOrb.js +269 -0
  55. package/dist/ContourLines.d.ts +20 -0
  56. package/dist/ContourLines.js +159 -0
  57. package/dist/Coverflow.d.ts +27 -0
  58. package/dist/Coverflow.js +167 -0
  59. package/dist/CursorAttractor.d.ts +21 -0
  60. package/dist/CursorAttractor.js +136 -0
  61. package/dist/CutReveal.d.ts +21 -0
  62. package/dist/CutReveal.js +116 -0
  63. package/dist/DateRange.d.ts +45 -0
  64. package/dist/DateRange.js +327 -0
  65. package/dist/DeviceFrame.d.ts +30 -0
  66. package/dist/DeviceFrame.js +145 -0
  67. package/dist/DiffReveal.d.ts +36 -0
  68. package/dist/DiffReveal.js +247 -0
  69. package/dist/DirectionHover.d.ts +15 -0
  70. package/dist/DirectionHover.js +90 -0
  71. package/dist/Discard.d.ts +18 -0
  72. package/dist/Discard.js +61 -0
  73. package/dist/DitherField.d.ts +15 -0
  74. package/dist/DitherField.js +157 -0
  75. package/dist/DotGlobe.d.ts +48 -0
  76. package/dist/DotGlobe.js +312 -0
  77. package/dist/DotMap.d.ts +47 -0
  78. package/dist/DotMap.js +172 -0
  79. package/dist/DropZone.d.ts +57 -0
  80. package/dist/DropZone.js +304 -0
  81. package/dist/DynamicIsland.d.ts +32 -0
  82. package/dist/DynamicIsland.js +92 -0
  83. package/dist/EdgeFX.d.ts +27 -0
  84. package/dist/EdgeFX.js +98 -0
  85. package/dist/ElasticString.d.ts +22 -0
  86. package/dist/ElasticString.js +127 -0
  87. package/dist/ExpandCard.d.ts +44 -0
  88. package/dist/ExpandCard.js +182 -0
  89. package/dist/FeatureTabs.d.ts +34 -0
  90. package/dist/FeatureTabs.js +169 -0
  91. package/dist/FeedList.d.ts +37 -0
  92. package/dist/FeedList.js +163 -0
  93. package/dist/FlickerGrid.d.ts +29 -0
  94. package/dist/FlickerGrid.js +156 -0
  95. package/dist/FocusGrid.d.ts +20 -0
  96. package/dist/FocusGrid.js +48 -0
  97. package/dist/FocusPull.d.ts +26 -0
  98. package/dist/FocusPull.js +106 -0
  99. package/dist/Footprints.d.ts +24 -0
  100. package/dist/Footprints.js +126 -0
  101. package/dist/FunnelFlow.d.ts +34 -0
  102. package/dist/FunnelFlow.js +267 -0
  103. package/dist/GameOver.d.ts +46 -0
  104. package/dist/GameOver.js +191 -0
  105. package/dist/GaugeMeter.d.ts +38 -0
  106. package/dist/GaugeMeter.js +195 -0
  107. package/dist/GlassPanel.d.ts +27 -0
  108. package/dist/GlassPanel.js +80 -0
  109. package/dist/GrainFX.d.ts +34 -0
  110. package/dist/GrainFX.js +122 -0
  111. package/dist/GravityBox.d.ts +30 -0
  112. package/dist/GravityBox.js +220 -0
  113. package/dist/HealthBar.d.ts +33 -0
  114. package/dist/HealthBar.js +140 -0
  115. package/dist/Heatmap.d.ts +42 -0
  116. package/dist/Heatmap.js +232 -0
  117. package/dist/HexField.d.ts +29 -0
  118. package/dist/HexField.js +188 -0
  119. package/dist/HoldToConfirm.d.ts +29 -0
  120. package/dist/HoldToConfirm.js +163 -0
  121. package/dist/HorizontalTrack.d.ts +28 -0
  122. package/dist/HorizontalTrack.js +195 -0
  123. package/dist/HotbarDock.d.ts +40 -0
  124. package/dist/HotbarDock.js +148 -0
  125. package/dist/InkText.d.ts +27 -0
  126. package/dist/InkText.js +65 -0
  127. package/dist/InlineEdit.d.ts +30 -0
  128. package/dist/InlineEdit.js +198 -0
  129. package/dist/InteractiveGrid.d.ts +25 -0
  130. package/dist/InteractiveGrid.js +194 -0
  131. package/dist/InventoryGrid.d.ts +45 -0
  132. package/dist/InventoryGrid.js +272 -0
  133. package/dist/JellyBlob.d.ts +30 -0
  134. package/dist/JellyBlob.js +209 -0
  135. package/dist/KineticHeadline.d.ts +30 -0
  136. package/dist/KineticHeadline.js +133 -0
  137. package/dist/LavaLamp.d.ts +21 -0
  138. package/dist/LavaLamp.js +133 -0
  139. package/dist/LetterSwap.d.ts +20 -0
  140. package/dist/LetterSwap.js +78 -0
  141. package/dist/LevelMap.d.ts +35 -0
  142. package/dist/LevelMap.js +189 -0
  143. package/dist/LightShafts.d.ts +22 -0
  144. package/dist/LightShafts.js +170 -0
  145. package/dist/LightboxGallery.d.ts +26 -0
  146. package/dist/LightboxGallery.js +327 -0
  147. package/dist/LinkPeek.d.ts +36 -0
  148. package/dist/LinkPeek.js +194 -0
  149. package/dist/LogoOrbit.d.ts +37 -0
  150. package/dist/LogoOrbit.js +117 -0
  151. package/dist/Marquee.d.ts +33 -0
  152. package/dist/Marquee.js +148 -0
  153. package/dist/MarqueeLine.d.ts +33 -0
  154. package/dist/MarqueeLine.js +167 -0
  155. package/dist/MasonryWall.d.ts +13 -0
  156. package/dist/MasonryWall.js +90 -0
  157. package/dist/MegaMenu.d.ts +32 -0
  158. package/dist/MegaMenu.js +280 -0
  159. package/dist/MeteorShower.d.ts +24 -0
  160. package/dist/MeteorShower.js +155 -0
  161. package/dist/Minimap.d.ts +21 -0
  162. package/dist/Minimap.js +236 -0
  163. package/dist/MobileTabBar.d.ts +38 -0
  164. package/dist/MobileTabBar.js +148 -0
  165. package/dist/MorphDialog.d.ts +34 -0
  166. package/dist/MorphDialog.js +199 -0
  167. package/dist/MorphPopover.d.ts +33 -0
  168. package/dist/MorphPopover.js +168 -0
  169. package/dist/MorphWords.d.ts +18 -0
  170. package/dist/MorphWords.js +136 -0
  171. package/dist/OTPInput.d.ts +43 -0
  172. package/dist/OTPInput.js +174 -0
  173. package/dist/OverlayKit.d.ts +97 -0
  174. package/dist/OverlayKit.js +466 -0
  175. package/dist/OverlayMenu.d.ts +32 -0
  176. package/dist/OverlayMenu.js +154 -0
  177. package/dist/ParallaxCollage.d.ts +41 -0
  178. package/dist/ParallaxCollage.js +143 -0
  179. package/dist/PasswordMeter.d.ts +44 -0
  180. package/dist/PasswordMeter.js +165 -0
  181. package/dist/PegBoard.d.ts +26 -0
  182. package/dist/PegBoard.js +184 -0
  183. package/dist/PinCard.d.ts +21 -0
  184. package/dist/PinCard.js +84 -0
  185. package/dist/PixelAvatar.d.ts +33 -0
  186. package/dist/PixelAvatar.js +144 -0
  187. package/dist/PixelButton.d.ts +20 -0
  188. package/dist/PixelButton.js +128 -0
  189. package/dist/PixelExplode.d.ts +31 -0
  190. package/dist/PixelExplode.js +164 -0
  191. package/dist/PixelLoader.d.ts +32 -0
  192. package/dist/PixelLoader.js +142 -0
  193. package/dist/PixelParallax.d.ts +41 -0
  194. package/dist/PixelParallax.js +151 -0
  195. package/dist/PixelSpinners.d.ts +21 -0
  196. package/dist/PixelSpinners.js +110 -0
  197. package/dist/PixelType.d.ts +26 -0
  198. package/dist/PixelType.js +220 -0
  199. package/dist/PointerKit.d.ts +23 -0
  200. package/dist/PointerKit.js +222 -0
  201. package/dist/Polaroids.d.ts +41 -0
  202. package/dist/Polaroids.js +293 -0
  203. package/dist/PressStart.d.ts +28 -0
  204. package/dist/PressStart.js +99 -0
  205. package/dist/PricingFlip.d.ts +52 -0
  206. package/dist/PricingFlip.js +190 -0
  207. package/dist/ProximityType.d.ts +26 -0
  208. package/dist/ProximityType.js +135 -0
  209. package/dist/QuestDialog.d.ts +50 -0
  210. package/dist/QuestDialog.js +204 -0
  211. package/dist/QuestLog.d.ts +39 -0
  212. package/dist/QuestLog.js +214 -0
  213. package/dist/RangeDual.d.ts +34 -0
  214. package/dist/RangeDual.js +238 -0
  215. package/dist/RatingPips.d.ts +25 -0
  216. package/dist/RatingPips.js +129 -0
  217. package/dist/RetroHorizon.d.ts +27 -0
  218. package/dist/RetroHorizon.js +169 -0
  219. package/dist/Reveal.d.ts +30 -0
  220. package/dist/Reveal.js +92 -0
  221. package/dist/RingProgress.d.ts +45 -0
  222. package/dist/RingProgress.js +180 -0
  223. package/dist/RollingNumber.d.ts +28 -0
  224. package/dist/RollingNumber.js +108 -0
  225. package/dist/ScanScope.d.ts +24 -0
  226. package/dist/ScanScope.js +164 -0
  227. package/dist/ScoreTicker.d.ts +32 -0
  228. package/dist/ScoreTicker.js +176 -0
  229. package/dist/ScreenScroller.d.ts +24 -0
  230. package/dist/ScreenScroller.js +138 -0
  231. package/dist/Screensaver.d.ts +31 -0
  232. package/dist/Screensaver.js +221 -0
  233. package/dist/ScrollTilt.d.ts +27 -0
  234. package/dist/ScrollTilt.js +100 -0
  235. package/dist/ScrollTypography.d.ts +26 -0
  236. package/dist/ScrollTypography.js +124 -0
  237. package/dist/ScrollZoom.d.ts +31 -0
  238. package/dist/ScrollZoom.js +123 -0
  239. package/dist/ScrubNumber.d.ts +29 -0
  240. package/dist/ScrubNumber.js +152 -0
  241. package/dist/ShadowStack.d.ts +28 -0
  242. package/dist/ShadowStack.js +116 -0
  243. package/dist/SideRail.d.ts +43 -0
  244. package/dist/SideRail.js +253 -0
  245. package/dist/SignalText.d.ts +25 -0
  246. package/dist/SignalText.js +178 -0
  247. package/dist/SkeletonShimmer.d.ts +18 -0
  248. package/dist/SkeletonShimmer.js +111 -0
  249. package/dist/SketchHighlight.d.ts +27 -0
  250. package/dist/SketchHighlight.js +180 -0
  251. package/dist/SlideTabs.d.ts +40 -0
  252. package/dist/SlideTabs.js +190 -0
  253. package/dist/SmartNavbar.d.ts +48 -0
  254. package/dist/SmartNavbar.js +188 -0
  255. package/dist/SparkChart.d.ts +41 -0
  256. package/dist/SparkChart.js +188 -0
  257. package/dist/Spoiler.d.ts +22 -0
  258. package/dist/Spoiler.js +97 -0
  259. package/dist/SpotlightTour.d.ts +38 -0
  260. package/dist/SpotlightTour.js +231 -0
  261. package/dist/SpringDrawer.d.ts +39 -0
  262. package/dist/SpringDrawer.js +360 -0
  263. package/dist/SpriteAnimator.d.ts +41 -0
  264. package/dist/SpriteAnimator.js +124 -0
  265. package/dist/StatCard.d.ts +43 -0
  266. package/dist/StatCard.js +168 -0
  267. package/dist/StepLoader.d.ts +41 -0
  268. package/dist/StepLoader.js +191 -0
  269. package/dist/StepperForm.d.ts +41 -0
  270. package/dist/StepperForm.js +206 -0
  271. package/dist/StickerBoard.d.ts +39 -0
  272. package/dist/StickerBoard.js +209 -0
  273. package/dist/StickyReveal.d.ts +42 -0
  274. package/dist/StickyReveal.js +181 -0
  275. package/dist/StoryViewer.d.ts +36 -0
  276. package/dist/StoryViewer.js +175 -0
  277. package/dist/StreamingText.d.ts +29 -0
  278. package/dist/StreamingText.js +271 -0
  279. package/dist/SuggestionChips.d.ts +32 -0
  280. package/dist/SuggestionChips.js +96 -0
  281. package/dist/SwipeActions.d.ts +30 -0
  282. package/dist/SwipeActions.js +141 -0
  283. package/dist/TagInput.d.ts +30 -0
  284. package/dist/TagInput.js +284 -0
  285. package/dist/TallyUp.d.ts +38 -0
  286. package/dist/TallyUp.js +157 -0
  287. package/dist/TerminalDemo.d.ts +63 -0
  288. package/dist/TerminalDemo.js +214 -0
  289. package/dist/TestimonialWall.d.ts +35 -0
  290. package/dist/TestimonialWall.js +131 -0
  291. package/dist/TextOnPath.d.ts +36 -0
  292. package/dist/TextOnPath.js +130 -0
  293. package/dist/ThinkingShimmer.d.ts +36 -0
  294. package/dist/ThinkingShimmer.js +132 -0
  295. package/dist/ToastStack.d.ts +62 -0
  296. package/dist/ToastStack.js +289 -0
  297. package/dist/ToggleGroup.d.ts +39 -0
  298. package/dist/ToggleGroup.js +190 -0
  299. package/dist/ToggleKit.d.ts +70 -0
  300. package/dist/ToggleKit.js +229 -0
  301. package/dist/TracingLine.d.ts +24 -0
  302. package/dist/TracingLine.js +139 -0
  303. package/dist/TradingCard.d.ts +30 -0
  304. package/dist/TradingCard.js +147 -0
  305. package/dist/VanishInput.d.ts +34 -0
  306. package/dist/VanishInput.js +190 -0
  307. package/dist/VideoHero.d.ts +32 -0
  308. package/dist/VideoHero.js +207 -0
  309. package/dist/VoiceOrb.d.ts +23 -0
  310. package/dist/VoiceOrb.js +182 -0
  311. package/dist/VoxelTiles.d.ts +38 -0
  312. package/dist/VoxelTiles.js +201 -0
  313. package/dist/WarpField.d.ts +18 -0
  314. package/dist/WarpField.js +160 -0
  315. package/dist/WebcamPixels.d.ts +38 -0
  316. package/dist/WebcamPixels.js +292 -0
  317. package/dist/WheelPicker.d.ts +29 -0
  318. package/dist/WheelPicker.js +199 -0
  319. package/dist/WobbleCard.d.ts +23 -0
  320. package/dist/WobbleCard.js +112 -0
  321. package/dist/index.d.ts +158 -0
  322. package/dist/index.js +159 -0
  323. package/package.json +58 -4
@@ -0,0 +1,39 @@
1
+ import { type CSSProperties } from 'react';
2
+ export interface RaceSeries {
3
+ name: string;
4
+ /** One value per step. */
5
+ values: number[];
6
+ /** Override the slot color. */
7
+ color?: string;
8
+ }
9
+ export interface BarRaceProps {
10
+ series?: RaceSeries[];
11
+ /** Labels for the time steps. */
12
+ steps?: string[];
13
+ title?: string;
14
+ subtitle?: string;
15
+ /** Bars shown. */
16
+ top?: number;
17
+ /** Time per step in ms. */
18
+ stepDuration?: number;
19
+ autoPlay?: boolean;
20
+ loop?: boolean;
21
+ format?: (value: number) => string;
22
+ rowHeight?: number;
23
+ nameWidth?: number;
24
+ colors?: string[];
25
+ width?: number;
26
+ textColor?: string;
27
+ mutedColor?: string;
28
+ dimColor?: string;
29
+ gridColor?: string;
30
+ periodColor?: string;
31
+ accentColor?: string;
32
+ onAccentColor?: string;
33
+ fontFamily?: string;
34
+ label?: string;
35
+ className?: string;
36
+ style?: CSSProperties;
37
+ }
38
+ export declare const RACE_COLORS: string[];
39
+ export default function BarRace({ series, steps, title, subtitle, top, stepDuration, autoPlay, loop, format, rowHeight, nameWidth, colors, width, textColor, mutedColor, dimColor, gridColor, periodColor, accentColor, onAccentColor, fontFamily, label, className, style }: BarRaceProps): import("react").JSX.Element;
@@ -0,0 +1,227 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useInsertionEffect, useMemo, useRef, useState } from "react";
4
+ const STYLE_ID = "bl-bar-race";
5
+ const CSS = `
6
+ .bl-race { position: relative; width: 100%; max-width: var(--bl-w); color: var(--bl-ink); font-family: var(--bl-font); }
7
+ .bl-race__title { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
8
+ .bl-race__sub { margin: 0 0 12px; color: var(--bl-muted); font-size: 13px; }
9
+ .bl-race__plot { position: relative; height: calc(var(--bl-rows) * var(--bl-row)); margin-top: 22px; }
10
+ .bl-race__grid { position: absolute; top: -20px; bottom: 0; left: var(--bl-name-w); right: var(--bl-value-w); pointer-events: none; }
11
+ .bl-race__tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--bl-grid); transition: left 300ms linear; }
12
+ .bl-race__tick span { position: absolute; top: 0; left: 4px; color: var(--bl-dim); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
13
+ .bl-race__bar { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; height: var(--bl-row); transform: translateY(calc(var(--rank) * var(--bl-row))); transition: transform var(--bl-swap) cubic-bezier(.3,1,.4,1), opacity 300ms; }
14
+ .bl-race__bar[data-out] { opacity: 0; }
15
+ .bl-race__name { flex: 0 0 var(--bl-name-w); box-sizing: border-box; padding-right: 10px; overflow: hidden; color: var(--bl-ink); font-size: 13px; font-weight: 600; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
16
+ .bl-race__track { position: relative; flex: 1; min-width: 0; height: calc(var(--bl-row) - 8px); margin-right: var(--bl-value-w); }
17
+ .bl-race__fill { display: block; height: 100%; width: calc(var(--frac) * 100%); min-width: 2px; border-radius: 0 4px 4px 0; background: var(--c); }
18
+ .bl-race__value { position: absolute; top: 50%; left: calc(var(--frac) * 100% + 6px); transform: translateY(-50%); color: var(--bl-muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
19
+ .bl-race__period { position: absolute; right: var(--bl-value-w); bottom: 4px; color: var(--bl-period); font-size: clamp(28px, 7vw, 56px); font-weight: 800; line-height: 1; letter-spacing: -0.02em; pointer-events: none; }
20
+ .bl-race__controls { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
21
+ .bl-race__play { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--bl-accent); color: var(--bl-on-accent); cursor: pointer; }
22
+ .bl-race__play:focus-visible, .bl-race__scrub:focus-visible { outline: 2px solid var(--bl-ink); outline-offset: 2px; }
23
+ .bl-race__scrub { flex: 1; min-width: 0; accent-color: var(--bl-accent); }
24
+ .bl-race__now { flex: 0 0 auto; min-width: 4ch; color: var(--bl-muted); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
25
+ .bl-race__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
26
+ @media (prefers-reduced-motion: reduce) { .bl-race__bar, .bl-race__tick { transition: none; } }
27
+ `;
28
+ function useStyles() {
29
+ useInsertionEffect(() => {
30
+ if (typeof document === "undefined") return;
31
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
32
+ style.textContent = CSS;
33
+ if (!style.isConnected) document.head.appendChild(style);
34
+ }, []);
35
+ }
36
+ const RACE_COLORS = ["#3987e5", "#d95926", "#199e70", "#c98500", "#d55181", "#008300", "#9085e9", "#e66767"];
37
+ const OVERFLOW_COLOR = "#566c86";
38
+ const niceStep = (max) => {
39
+ const raw = max / 4;
40
+ const mag = 10 ** Math.floor(Math.log10(raw || 1));
41
+ const n = raw / mag;
42
+ return (n < 1.5 ? 1 : n < 3 ? 2 : n < 7 ? 5 : 10) * mag;
43
+ };
44
+ function BarRace({
45
+ series = [],
46
+ steps = [],
47
+ title,
48
+ subtitle,
49
+ top = 8,
50
+ stepDuration = 1200,
51
+ autoPlay = true,
52
+ loop = false,
53
+ format = (v) => Math.round(v).toLocaleString(),
54
+ rowHeight = 34,
55
+ nameWidth = 110,
56
+ colors = RACE_COLORS,
57
+ width = 720,
58
+ textColor = "#f4f4f4",
59
+ mutedColor = "#94b0c2",
60
+ dimColor = "#566c86",
61
+ gridColor = "rgba(148,176,194,0.14)",
62
+ periodColor = "rgba(148,176,194,0.28)",
63
+ accentColor = "#73eff7",
64
+ onAccentColor = "#0b0b14",
65
+ fontFamily = "ui-sans-serif, system-ui, sans-serif",
66
+ label = "Bar chart race",
67
+ className = "",
68
+ style
69
+ }) {
70
+ useStyles();
71
+ const uid = useId().replace(/[^a-zA-Z0-9_-]/g, "");
72
+ const last = Math.max(0, steps.length - 1);
73
+ const [t, setT] = useState(0);
74
+ const tRef = useRef(0);
75
+ tRef.current = t;
76
+ const [playing, setPlaying] = useState(false);
77
+ const rootRef = useRef(null);
78
+ const visible = useRef(true);
79
+ const reduced = useRef(false);
80
+ const colorOf = useMemo(() => {
81
+ const map = {};
82
+ series.forEach((s, i) => {
83
+ map[s.name] = s.color ?? colors[i] ?? OVERFLOW_COLOR;
84
+ });
85
+ return map;
86
+ }, [series, colors]);
87
+ useEffect(() => {
88
+ reduced.current = !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
89
+ if (autoPlay && !reduced.current) setPlaying(true);
90
+ const io = new IntersectionObserver(([entry]) => {
91
+ visible.current = entry.isIntersecting;
92
+ });
93
+ io.observe(rootRef.current);
94
+ return () => io.disconnect();
95
+ }, [autoPlay]);
96
+ useEffect(() => {
97
+ if (!playing) return void 0;
98
+ let frame = 0;
99
+ let prev = performance.now();
100
+ const tick = (now) => {
101
+ const dt = Math.min(100, now - prev);
102
+ prev = now;
103
+ if (visible.current) {
104
+ let next = tRef.current + dt / stepDuration;
105
+ if (next >= last) {
106
+ if (!loop) {
107
+ setT(last);
108
+ setPlaying(false);
109
+ return;
110
+ }
111
+ next = 0;
112
+ }
113
+ tRef.current = next;
114
+ setT(next);
115
+ }
116
+ frame = requestAnimationFrame(tick);
117
+ };
118
+ frame = requestAnimationFrame(tick);
119
+ return () => cancelAnimationFrame(frame);
120
+ }, [playing, stepDuration, last, loop]);
121
+ const i0 = Math.floor(t);
122
+ const i1 = Math.min(last, i0 + 1);
123
+ const f = t - i0;
124
+ const rows = series.map((s) => ({ name: s.name, value: (s.values[i0] ?? 0) * (1 - f) + (s.values[i1] ?? 0) * f })).sort((a, b) => b.value - a.value);
125
+ const ranked = Object.fromEntries(rows.map((row, i) => [row.name, i]));
126
+ const shown = rows.slice(0, top);
127
+ const max = Math.max(1e-9, shown[0]?.value ?? 1) * 1.04;
128
+ const step = niceStep(max);
129
+ const ticks = Array.from({ length: Math.floor(max / step) + 1 }, (_, i) => i * step).filter((v) => v <= max);
130
+ const period = steps[Math.round(t)] ?? "";
131
+ const settled = steps[Math.min(last, Math.round(t))];
132
+ const togglePlay = () => {
133
+ if (!playing && t >= last) setT(0);
134
+ setPlaying((p) => !p);
135
+ };
136
+ return /* @__PURE__ */ jsxs(
137
+ "figure",
138
+ {
139
+ ref: rootRef,
140
+ className: `bl-race ${className}`,
141
+ "aria-labelledby": title ? `${uid}-title` : void 0,
142
+ "aria-label": title ? void 0 : label,
143
+ style: {
144
+ "--bl-w": `${width}px`,
145
+ "--bl-row": `${rowHeight}px`,
146
+ "--bl-rows": Math.min(top, series.length),
147
+ "--bl-name-w": `${nameWidth}px`,
148
+ "--bl-value-w": "64px",
149
+ "--bl-swap": `${Math.min(600, stepDuration * 0.5)}ms`,
150
+ "--bl-ink": textColor,
151
+ "--bl-muted": mutedColor,
152
+ "--bl-dim": dimColor,
153
+ "--bl-grid": gridColor,
154
+ "--bl-period": periodColor,
155
+ "--bl-accent": accentColor,
156
+ "--bl-on-accent": onAccentColor,
157
+ "--bl-font": fontFamily,
158
+ margin: 0,
159
+ ...style
160
+ },
161
+ children: [
162
+ title && /* @__PURE__ */ jsxs("figcaption", { children: [
163
+ /* @__PURE__ */ jsx("p", { id: `${uid}-title`, className: "bl-race__title", children: title }),
164
+ subtitle && /* @__PURE__ */ jsx("p", { className: "bl-race__sub", children: subtitle })
165
+ ] }),
166
+ /* @__PURE__ */ jsxs("div", { className: "bl-race__plot", "aria-hidden": "true", children: [
167
+ /* @__PURE__ */ jsx("div", { className: "bl-race__grid", children: ticks.map((v) => /* @__PURE__ */ jsx("div", { className: "bl-race__tick", style: { left: `${v / max * 100}%` }, children: /* @__PURE__ */ jsx("span", { children: format(v) }) }, v)) }),
168
+ series.map((s) => {
169
+ const rank = ranked[s.name];
170
+ const row = rows[rank];
171
+ const out = rank >= top;
172
+ return /* @__PURE__ */ jsxs("div", { className: "bl-race__bar", "data-out": out || void 0, style: { "--rank": Math.min(rank, top), "--c": colorOf[s.name], "--frac": out ? 0 : row.value / max }, children: [
173
+ /* @__PURE__ */ jsx("span", { className: "bl-race__name", children: s.name }),
174
+ /* @__PURE__ */ jsxs("span", { className: "bl-race__track", children: [
175
+ /* @__PURE__ */ jsx("span", { className: "bl-race__fill" }),
176
+ /* @__PURE__ */ jsx("span", { className: "bl-race__value", children: format(row.value) })
177
+ ] })
178
+ ] }, s.name);
179
+ }),
180
+ /* @__PURE__ */ jsx("span", { className: "bl-race__period", children: period })
181
+ ] }),
182
+ /* @__PURE__ */ jsxs("div", { className: "bl-race__controls", children: [
183
+ /* @__PURE__ */ jsx("button", { type: "button", className: "bl-race__play", "aria-label": playing ? "Pause" : t >= last ? "Replay" : "Play", onClick: togglePlay, children: /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "currentColor", "aria-hidden": "true", children: playing ? /* @__PURE__ */ jsx("path", { d: "M3 2h3v10H3zM8 2h3v10H8z" }) : /* @__PURE__ */ jsx("path", { d: "M3.5 1.8v10.4L12 7z" }) }) }),
184
+ /* @__PURE__ */ jsx(
185
+ "input",
186
+ {
187
+ className: "bl-race__scrub",
188
+ type: "range",
189
+ min: 0,
190
+ max: last,
191
+ step: 0.01,
192
+ value: t,
193
+ "aria-label": "Time",
194
+ "aria-valuetext": String(settled ?? ""),
195
+ onChange: (event) => {
196
+ setPlaying(false);
197
+ setT(Number(event.target.value));
198
+ }
199
+ }
200
+ ),
201
+ /* @__PURE__ */ jsx("span", { className: "bl-race__now", "aria-hidden": "true", children: period })
202
+ ] }),
203
+ /* @__PURE__ */ jsxs("table", { className: "bl-race__sr", children: [
204
+ /* @__PURE__ */ jsxs("caption", { children: [
205
+ title ?? label,
206
+ ", ",
207
+ settled
208
+ ] }),
209
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
210
+ /* @__PURE__ */ jsx("th", { scope: "col", children: "Rank" }),
211
+ /* @__PURE__ */ jsx("th", { scope: "col", children: "Name" }),
212
+ /* @__PURE__ */ jsx("th", { scope: "col", children: "Value" })
213
+ ] }) }),
214
+ /* @__PURE__ */ jsx("tbody", { children: series.map((s) => ({ name: s.name, value: s.values[Math.min(last, Math.round(t))] ?? 0 })).sort((a, b) => b.value - a.value).slice(0, top).map((row, i) => /* @__PURE__ */ jsxs("tr", { children: [
215
+ /* @__PURE__ */ jsx("td", { children: i + 1 }),
216
+ /* @__PURE__ */ jsx("th", { scope: "row", children: row.name }),
217
+ /* @__PURE__ */ jsx("td", { children: format(row.value) })
218
+ ] }, row.name)) })
219
+ ] })
220
+ ]
221
+ }
222
+ );
223
+ }
224
+ export {
225
+ RACE_COLORS,
226
+ BarRace as default
227
+ };
@@ -0,0 +1,50 @@
1
+ import { type CSSProperties, type ReactNode, type MouseEvent } from 'react';
2
+ export interface BentoCardProps {
3
+ /** Columns the card covers. */
4
+ colSpan?: number;
5
+ /** Rows the card covers. */
6
+ rowSpan?: number;
7
+ title?: ReactNode;
8
+ description?: ReactNode;
9
+ icon?: ReactNode;
10
+ /** Image or video behind the content; it fades into the card color. */
11
+ background?: ReactNode;
12
+ /** Call-to-action text revealed on hover or focus (links and buttons only). */
13
+ cta?: string;
14
+ /** Makes the card a link. */
15
+ href?: string;
16
+ /** Makes the card a button. */
17
+ onClick?: (event: MouseEvent<HTMLElement>) => void;
18
+ children?: ReactNode;
19
+ className?: string;
20
+ style?: CSSProperties;
21
+ }
22
+ export declare function BentoCard({ colSpan, rowSpan, title, description, icon, background, cta, href, onClick, children, className, style }: BentoCardProps): import("react").JSX.Element;
23
+ export interface BentoGridProps {
24
+ /** BentoCard elements, in reading order. */
25
+ children?: ReactNode;
26
+ /** Columns at full width (collapses to 2 under 860px and 1 under 560px of container width). */
27
+ columns?: number;
28
+ /** Row height, in px. */
29
+ rowHeight?: number;
30
+ gap?: number;
31
+ radius?: number;
32
+ cardColor?: string;
33
+ lineColor?: string;
34
+ textColor?: string;
35
+ mutedColor?: string;
36
+ accentColor?: string;
37
+ chipColor?: string;
38
+ /** Cursor-following border light. */
39
+ spotlightColor?: string;
40
+ /** Soft fill behind the spotlight. */
41
+ washColor?: string;
42
+ /** Spotlight radius, in px. */
43
+ spotlightSize?: number;
44
+ titleSize?: number;
45
+ fontFamily?: string;
46
+ bodyFontFamily?: string;
47
+ className?: string;
48
+ style?: CSSProperties;
49
+ }
50
+ export default function BentoGrid({ children, columns, rowHeight, gap, radius, cardColor, lineColor, textColor, mutedColor, accentColor, chipColor, spotlightColor, washColor, spotlightSize, titleSize, fontFamily, bodyFontFamily, className, style }: BentoGridProps): import("react").JSX.Element;
@@ -0,0 +1,145 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useInsertionEffect, useRef } from "react";
4
+ const STYLE_ID = "bl-bento";
5
+ const CSS = `
6
+ .bl-bento-wrap { container-type: inline-size; width: 100%; }
7
+ .bl-bento { display: grid; grid-template-columns: repeat(var(--bl-cols), minmax(0, 1fr)); grid-auto-rows: var(--bl-row); gap: var(--bl-gap); }
8
+ .bl-bento__card { --bl-mx: -999px; --bl-my: -999px; position: relative; grid-column: span var(--bl-cs, 1); grid-row: span var(--bl-rs, 1); display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; overflow: hidden; padding: 22px; border-radius: var(--bl-radius); background: var(--bl-card); color: var(--bl-ink); isolation: isolate; text-decoration: none; outline: none; box-shadow: inset 0 0 0 1px var(--bl-line); transition: transform 240ms cubic-bezier(.2,.8,.2,1); }
9
+ .bl-bento__card::before { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; padding: 1.5px; pointer-events: none; background: radial-gradient(var(--bl-spot-size) circle at var(--bl-mx) var(--bl-my), var(--bl-spot), transparent 60%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
10
+ .bl-bento__card::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(calc(var(--bl-spot-size) * 1.4) circle at var(--bl-mx) var(--bl-my), var(--bl-wash), transparent 55%); }
11
+ .bl-bento__bg { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
12
+ .bl-bento__bg > img, .bl-bento__bg > video { width: 100%; height: 100%; object-fit: cover; }
13
+ .bl-bento__bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bl-card) 8%, transparent 70%); }
14
+ .bl-bento__body { position: relative; transform: translateY(var(--bl-lift)); transition: transform 300ms cubic-bezier(.2,.8,.2,1); }
15
+ .bl-bento__icon { display: inline-grid; place-items: center; width: 40px; height: 40px; margin-bottom: 14px; border-radius: 10px; background: var(--bl-chip); color: var(--bl-accent); }
16
+ .bl-bento__title { margin: 0 0 6px; font: 700 var(--bl-title-size)/1.2 var(--bl-font); }
17
+ .bl-bento__desc { margin: 0; color: var(--bl-muted); font: 400 14px/1.5 var(--bl-font-body); }
18
+ .bl-bento__cta { position: absolute; left: 0; top: 100%; display: inline-flex; align-items: center; gap: 6px; padding-top: 12px; color: var(--bl-accent); font: 600 13px/1 var(--bl-font-body); opacity: 0; transition: opacity 220ms; }
19
+ .bl-bento__card[data-cta] { --bl-lift: 0px; }
20
+ .bl-bento__card[data-cta]:hover, .bl-bento__card[data-cta]:focus-within, .bl-bento__card[data-cta]:focus-visible { --bl-lift: -30px; }
21
+ .bl-bento__card[data-cta]:hover .bl-bento__cta, .bl-bento__card[data-cta]:focus-within .bl-bento__cta, .bl-bento__card[data-cta]:focus-visible .bl-bento__cta { opacity: 1; }
22
+ .bl-bento__card:focus-visible { box-shadow: inset 0 0 0 2px var(--bl-accent); }
23
+ a.bl-bento__card:hover { transform: translateY(-2px); }
24
+ @container (max-width: 860px) {
25
+ .bl-bento { grid-template-columns: repeat(min(var(--bl-cols), 2), minmax(0, 1fr)); }
26
+ .bl-bento__card { grid-column: span min(var(--bl-cs, 1), 2); }
27
+ }
28
+ @container (max-width: 560px) {
29
+ .bl-bento { grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(var(--bl-row), auto); }
30
+ .bl-bento__card { grid-column: span 1; grid-row: span 1; }
31
+ .bl-bento__card[data-cta] { --bl-lift: -30px; }
32
+ .bl-bento__card[data-cta] .bl-bento__cta { opacity: 1; }
33
+ }
34
+ @media (hover: none) {
35
+ .bl-bento__card[data-cta] { --bl-lift: -30px; }
36
+ .bl-bento__card[data-cta] .bl-bento__cta { opacity: 1; }
37
+ }
38
+ @media (prefers-reduced-motion: reduce) { .bl-bento__card, .bl-bento__body { transition: none; } }
39
+ `;
40
+ function useStyles() {
41
+ useInsertionEffect(() => {
42
+ if (typeof document === "undefined") return;
43
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
44
+ style.textContent = CSS;
45
+ if (!style.isConnected) document.head.appendChild(style);
46
+ }, []);
47
+ }
48
+ function BentoCard({ colSpan = 1, rowSpan = 1, title, description, icon, background, cta = "Learn more", href, onClick, children, className = "", style }) {
49
+ const Tag = href ? "a" : onClick ? "button" : "div";
50
+ const interactive = Boolean(href || onClick);
51
+ return /* @__PURE__ */ jsxs(
52
+ Tag,
53
+ {
54
+ className: `bl-bento__card ${className}`,
55
+ "data-cta": interactive && cta ? "" : void 0,
56
+ href,
57
+ onClick,
58
+ type: Tag === "button" ? "button" : void 0,
59
+ tabIndex: Tag === "div" ? void 0 : 0,
60
+ style: { "--bl-cs": colSpan, "--bl-rs": rowSpan, textAlign: "left", border: 0, cursor: interactive ? "pointer" : void 0, ...style },
61
+ children: [
62
+ background && /* @__PURE__ */ jsx("div", { className: "bl-bento__bg", "aria-hidden": "true", children: background }),
63
+ /* @__PURE__ */ jsxs("div", { className: "bl-bento__body", children: [
64
+ icon && /* @__PURE__ */ jsx("span", { className: "bl-bento__icon", "aria-hidden": "true", children: icon }),
65
+ title && /* @__PURE__ */ jsx("h3", { className: "bl-bento__title", children: title }),
66
+ description && /* @__PURE__ */ jsx("p", { className: "bl-bento__desc", children: description }),
67
+ children,
68
+ interactive && cta && /* @__PURE__ */ jsxs("span", { className: "bl-bento__cta", "aria-hidden": "true", children: [
69
+ cta,
70
+ " \u2192"
71
+ ] })
72
+ ] })
73
+ ]
74
+ }
75
+ );
76
+ }
77
+ function BentoGrid({
78
+ children,
79
+ columns = 3,
80
+ rowHeight = 200,
81
+ gap = 14,
82
+ radius = 18,
83
+ cardColor = "#1a1c2c",
84
+ lineColor = "rgba(255,255,255,0.08)",
85
+ textColor = "#f4f4f4",
86
+ mutedColor = "#94b0c2",
87
+ accentColor = "#73eff7",
88
+ chipColor = "rgba(115,239,247,0.12)",
89
+ spotlightColor = "rgba(115,239,247,0.85)",
90
+ washColor = "rgba(115,239,247,0.08)",
91
+ spotlightSize = 320,
92
+ titleSize = 18,
93
+ fontFamily = "ui-sans-serif, system-ui, sans-serif",
94
+ bodyFontFamily,
95
+ className = "",
96
+ style
97
+ }) {
98
+ useStyles();
99
+ const ref = useRef(null);
100
+ const onPointerMove = (event) => {
101
+ for (const card of ref.current.children) {
102
+ const rect = card.getBoundingClientRect();
103
+ card.style.setProperty("--bl-mx", `${event.clientX - rect.left}px`);
104
+ card.style.setProperty("--bl-my", `${event.clientY - rect.top}px`);
105
+ }
106
+ };
107
+ const onPointerLeave = () => {
108
+ for (const card of ref.current.children) {
109
+ card.style.setProperty("--bl-mx", "-999px");
110
+ card.style.setProperty("--bl-my", "-999px");
111
+ }
112
+ };
113
+ return /* @__PURE__ */ jsx("div", { className: `bl-bento-wrap ${className}`, style, children: /* @__PURE__ */ jsx(
114
+ "div",
115
+ {
116
+ ref,
117
+ className: "bl-bento",
118
+ onPointerMove,
119
+ onPointerLeave,
120
+ style: {
121
+ "--bl-cols": columns,
122
+ "--bl-row": `${rowHeight}px`,
123
+ "--bl-gap": `${gap}px`,
124
+ "--bl-radius": `${radius}px`,
125
+ "--bl-card": cardColor,
126
+ "--bl-line": lineColor,
127
+ "--bl-ink": textColor,
128
+ "--bl-muted": mutedColor,
129
+ "--bl-accent": accentColor,
130
+ "--bl-chip": chipColor,
131
+ "--bl-spot": spotlightColor,
132
+ "--bl-wash": washColor,
133
+ "--bl-spot-size": `${spotlightSize}px`,
134
+ "--bl-title-size": `${titleSize}px`,
135
+ "--bl-font": fontFamily,
136
+ "--bl-font-body": bodyFontFamily ?? fontFamily
137
+ },
138
+ children
139
+ }
140
+ ) });
141
+ }
142
+ export {
143
+ BentoCard,
144
+ BentoGrid as default
145
+ };
@@ -0,0 +1,48 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ export type BootStatus = 'ok' | 'warn' | 'fail';
3
+ export interface BootLineObject {
4
+ text: string;
5
+ /** Tag shown at the end of the line. */
6
+ status?: BootStatus;
7
+ /** A number that ticks up after the text (e.g. memory). */
8
+ count?: number;
9
+ unit?: string;
10
+ /** Pause after this line in ms (overrides lineDelay). */
11
+ delay?: number;
12
+ }
13
+ export type BootLine = string | BootLineObject;
14
+ export interface BootSequenceProps {
15
+ /** Lines shown immediately at the top. */
16
+ header?: string[];
17
+ lines?: BootLine[];
18
+ /** Characters per second. */
19
+ speed?: number;
20
+ lineDelay?: number;
21
+ countDuration?: number;
22
+ /** Pause on the finished screen before the reveal, in ms. */
23
+ holdAfter?: number;
24
+ /** Click or any key (outside text fields) skips. */
25
+ skippable?: boolean;
26
+ beep?: boolean;
27
+ /** Change to boot again. */
28
+ replayKey?: string | number;
29
+ onComplete?: () => void;
30
+ /** Revealed with a CRT power-on when the boot finishes. */
31
+ children?: ReactNode;
32
+ minHeight?: number;
33
+ fontSize?: number;
34
+ backgroundColor?: string;
35
+ textColor?: string;
36
+ accentColor?: string;
37
+ okColor?: string;
38
+ warnColor?: string;
39
+ failColor?: string;
40
+ mutedColor?: string;
41
+ scanlines?: boolean;
42
+ hint?: string;
43
+ label?: string;
44
+ fontFamily?: string;
45
+ className?: string;
46
+ style?: CSSProperties;
47
+ }
48
+ export default function BootSequence({ header, lines, speed, lineDelay, countDuration, holdAfter, skippable, beep, replayKey, onComplete, children, minHeight, fontSize, backgroundColor, textColor, accentColor, okColor, warnColor, failColor, mutedColor, scanlines, hint, label, fontFamily, className, style }: BootSequenceProps): import("react").JSX.Element;