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,271 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Fragment, useEffect, useInsertionEffect, useRef, useState } from "react";
4
+ const STYLE_ID = "bl-streaming-text";
5
+ const CSS = `
6
+ .bl-stream { color: var(--bl-ink); font-family: var(--bl-font); font-size: var(--bl-size); line-height: 1.65; overflow-wrap: anywhere; }
7
+ .bl-stream > :first-child { margin-top: 0; }
8
+ .bl-stream > :last-child { margin-bottom: 0; }
9
+ .bl-stream p { margin: 0 0 0.8em; }
10
+ .bl-stream h1, .bl-stream h2, .bl-stream h3 { margin: 1em 0 0.45em; font-weight: 700; line-height: 1.3; }
11
+ .bl-stream h1 { font-size: 1.45em; } .bl-stream h2 { font-size: 1.25em; } .bl-stream h3 { font-size: 1.08em; }
12
+ .bl-stream ul, .bl-stream ol { margin: 0 0 0.8em; padding-left: 1.4em; }
13
+ .bl-stream ul { list-style: disc; } .bl-stream ol { list-style: decimal; }
14
+ .bl-stream li { margin: 0.2em 0; }
15
+ .bl-stream blockquote { margin: 0 0 0.8em; padding-left: 0.9em; border-left: 3px solid var(--bl-line); color: var(--bl-muted); }
16
+ .bl-stream code { padding: 0.1em 0.35em; border-radius: 5px; background: var(--bl-code-bg); font-family: var(--bl-mono); font-size: 0.9em; }
17
+ .bl-stream pre { margin: 0 0 0.8em; padding: 12px 14px; overflow-x: auto; border-radius: 10px; background: var(--bl-code-bg); }
18
+ .bl-stream pre code { padding: 0; background: none; font-size: 0.86em; line-height: 1.55; white-space: pre; }
19
+ .bl-stream a { color: var(--bl-accent); text-decoration: underline; text-underline-offset: 2px; }
20
+ .bl-stream__fresh { animation: bl-stream-in var(--bl-fade) ease both; }
21
+ .bl-stream__cursor { display: inline-block; width: 0.55em; height: 1.1em; margin-left: 2px; vertical-align: text-bottom; border-radius: 2px; background: var(--bl-cursor); animation: bl-stream-blink 1s steps(1) infinite; }
22
+ .bl-stream__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
23
+ @keyframes bl-stream-in { from { opacity: 0; filter: blur(3px); } }
24
+ @keyframes bl-stream-blink { 50% { opacity: 0; } }
25
+ @media (prefers-reduced-motion: reduce) { .bl-stream__fresh { animation: none; } .bl-stream__cursor { animation: none; } }
26
+ `;
27
+ function useStyles() {
28
+ useInsertionEffect(() => {
29
+ if (typeof document === "undefined") return;
30
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
31
+ style.textContent = CSS;
32
+ if (!style.isConnected) document.head.appendChild(style);
33
+ }, []);
34
+ }
35
+ function parseInline(src, base) {
36
+ const nodes = [];
37
+ let i = 0;
38
+ let textStart = 0;
39
+ const flush = (end) => {
40
+ if (end > textStart) nodes.push({ type: "text", text: src.slice(textStart, end), start: base + textStart });
41
+ };
42
+ while (i < src.length) {
43
+ const rest = src.slice(i);
44
+ let match = null;
45
+ if (rest.startsWith("**")) {
46
+ const close = src.indexOf("**", i + 2);
47
+ match = { type: "strong", open: 2, inner: close < 0 ? src.slice(i + 2) : src.slice(i + 2, close), end: close < 0 ? src.length : close + 2 };
48
+ } else if (rest[0] === "`") {
49
+ const close = src.indexOf("`", i + 1);
50
+ match = { type: "code", open: 1, inner: close < 0 ? src.slice(i + 1) : src.slice(i + 1, close), end: close < 0 ? src.length : close + 1 };
51
+ } else if (rest[0] === "*" && rest[1] !== " " && rest[1] !== void 0) {
52
+ const close = src.indexOf("*", i + 1);
53
+ match = { type: "em", open: 1, inner: close < 0 ? src.slice(i + 1) : src.slice(i + 1, close), end: close < 0 ? src.length : close + 1 };
54
+ } else if (rest[0] === "[") {
55
+ const link = /^\[([^\]]*)\]\(([^)\s]*)\)/.exec(rest);
56
+ if (link) match = { type: "link", open: 1, inner: link[1], href: link[2], end: i + link[0].length };
57
+ }
58
+ if (!match) {
59
+ i++;
60
+ continue;
61
+ }
62
+ flush(i);
63
+ const innerBase = base + i + match.open;
64
+ nodes.push(
65
+ match.type === "code" ? { type: "code", children: [{ type: "text", text: match.inner, start: innerBase }] } : { type: match.type, href: match.href, children: parseInline(match.inner, innerBase) }
66
+ );
67
+ i = match.end;
68
+ textStart = i;
69
+ }
70
+ flush(src.length);
71
+ return nodes;
72
+ }
73
+ function parseBlocks(src) {
74
+ const blocks = [];
75
+ const lines = src.split("\n");
76
+ let offset = 0;
77
+ let i = 0;
78
+ const lineStart = [];
79
+ for (const line of lines) {
80
+ lineStart.push(offset);
81
+ offset += line.length + 1;
82
+ }
83
+ while (i < lines.length) {
84
+ const line = lines[i];
85
+ const start = lineStart[i];
86
+ if (!line.trim()) {
87
+ i++;
88
+ continue;
89
+ }
90
+ if (line.startsWith("```")) {
91
+ const body = [];
92
+ const bodyStart = start + line.length + 1;
93
+ i++;
94
+ while (i < lines.length && !lines[i].startsWith("```")) body.push(lines[i++]);
95
+ i++;
96
+ blocks.push({ type: "pre", children: [{ type: "text", text: body.join("\n"), start: bodyStart }] });
97
+ continue;
98
+ }
99
+ const heading = /^(#{1,3})\s+/.exec(line);
100
+ if (heading) {
101
+ blocks.push({ type: `h${heading[1].length}`, children: parseInline(line.slice(heading[0].length), start + heading[0].length) });
102
+ i++;
103
+ continue;
104
+ }
105
+ const listItem = /^(\s*)([-*]|\d+\.)\s+/;
106
+ if (listItem.test(line)) {
107
+ const ordered = /\d/.test(listItem.exec(line)[2]);
108
+ const items = [];
109
+ while (i < lines.length && listItem.test(lines[i])) {
110
+ const m = listItem.exec(lines[i]);
111
+ items.push({ type: "li", children: parseInline(lines[i].slice(m[0].length), lineStart[i] + m[0].length) });
112
+ i++;
113
+ }
114
+ blocks.push({ type: ordered ? "ol" : "ul", children: items });
115
+ continue;
116
+ }
117
+ if (line.startsWith(">")) {
118
+ const marker = /^>\s?/.exec(line)[0];
119
+ blocks.push({ type: "blockquote", children: parseInline(line.slice(marker.length), start + marker.length) });
120
+ i++;
121
+ continue;
122
+ }
123
+ const parts = [];
124
+ while (i < lines.length && lines[i].trim() && !/^(```|#{1,3}\s|>|\s*([-*]|\d+\.)\s)/.test(lines[i])) {
125
+ parts.push(...parts.length ? [{ type: "text", text: " ", start: lineStart[i] - 1 }] : [], ...parseInline(lines[i], lineStart[i]));
126
+ i++;
127
+ }
128
+ blocks.push({ type: "p", children: parts });
129
+ }
130
+ return blocks;
131
+ }
132
+ const SAFE_HREF = /^(https?:|mailto:|\/|#)/i;
133
+ function StreamingText({
134
+ text = "",
135
+ stream,
136
+ speed = 60,
137
+ markdown = true,
138
+ showCursor = true,
139
+ fadeDuration = 420,
140
+ tail = 6,
141
+ onDone,
142
+ fontSize = 16,
143
+ textColor = "#f4f4f4",
144
+ mutedColor = "#94b0c2",
145
+ lineColor = "rgba(255,255,255,0.2)",
146
+ codeBackground = "rgba(255,255,255,0.07)",
147
+ accentColor = "#73eff7",
148
+ cursorColor = "#73eff7",
149
+ fontFamily = "ui-sans-serif, system-ui, sans-serif",
150
+ monoFontFamily = "ui-monospace, SFMono-Regular, Menlo, monospace",
151
+ className = "",
152
+ style
153
+ }) {
154
+ useStyles();
155
+ const [full, setFull] = useState(stream ? "" : text);
156
+ const [shown, setShown] = useState(0);
157
+ const [chunks, setChunks] = useState([]);
158
+ const [sourceDone, setSourceDone] = useState(!stream);
159
+ const onDoneRef = useRef(onDone);
160
+ onDoneRef.current = onDone;
161
+ useEffect(() => {
162
+ if (!stream) {
163
+ setFull(text);
164
+ setShown(0);
165
+ setChunks([]);
166
+ setSourceDone(true);
167
+ return void 0;
168
+ }
169
+ let cancelled = false;
170
+ setFull("");
171
+ setShown(0);
172
+ setChunks([]);
173
+ setSourceDone(false);
174
+ (async () => {
175
+ for await (const piece of stream) {
176
+ if (cancelled) return;
177
+ setFull((prev) => prev + piece);
178
+ }
179
+ if (!cancelled) setSourceDone(true);
180
+ })();
181
+ return () => {
182
+ cancelled = true;
183
+ };
184
+ }, [stream, text]);
185
+ useEffect(() => {
186
+ if (shown >= full.length) return void 0;
187
+ const reduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
188
+ const nextBreak = full.slice(shown).search(/\s\S/);
189
+ const end = stream || reduced ? full.length : nextBreak < 0 ? full.length : shown + nextBreak + 1;
190
+ const delay = stream ? 16 : Math.max(8, (end - shown) / Math.max(1, speed) * 1e3);
191
+ const timer = setTimeout(() => {
192
+ setChunks((prev) => [...prev.slice(-(tail - 1)), shown]);
193
+ setShown(end);
194
+ }, delay);
195
+ return () => clearTimeout(timer);
196
+ }, [shown, full, speed, stream, tail]);
197
+ const done = sourceDone && shown >= full.length;
198
+ useEffect(() => {
199
+ if (done && full) onDoneRef.current?.();
200
+ }, [done, full]);
201
+ const visible = full.slice(0, shown);
202
+ const fadeFrom = chunks[0] ?? Infinity;
203
+ const renderText = (node, key) => {
204
+ const end = node.start + node.text.length;
205
+ if (end <= fadeFrom) return /* @__PURE__ */ jsx(Fragment, { children: node.text }, key);
206
+ const cuts = [node.start, ...chunks.filter((c) => c > node.start && c < end), end];
207
+ return cuts.slice(0, -1).map((from, j) => {
208
+ const piece = node.text.slice(from - node.start, cuts[j + 1] - node.start);
209
+ return from >= fadeFrom ? /* @__PURE__ */ jsx("span", { className: "bl-stream__fresh", children: piece }, `${key}-${from}`) : /* @__PURE__ */ jsx(Fragment, { children: piece }, `${key}-${from}`);
210
+ });
211
+ };
212
+ const renderNodes = (nodes) => nodes.map((node, i) => {
213
+ if (node.type === "text") return renderText(node, `t${node.start}-${i}`);
214
+ const children = renderNodes(node.children);
215
+ if (node.type === "strong") return /* @__PURE__ */ jsx("strong", { children }, i);
216
+ if (node.type === "em") return /* @__PURE__ */ jsx("em", { children }, i);
217
+ if (node.type === "code") return /* @__PURE__ */ jsx("code", { children }, i);
218
+ if (node.type === "link") return SAFE_HREF.test(node.href ?? "") ? /* @__PURE__ */ jsx("a", { href: node.href, children }, i) : /* @__PURE__ */ jsx("span", { children }, i);
219
+ return /* @__PURE__ */ jsx(Fragment, { children }, i);
220
+ });
221
+ const cursor = showCursor && !done ? /* @__PURE__ */ jsx("span", { className: "bl-stream__cursor", "aria-hidden": "true" }) : null;
222
+ const blocks = markdown ? parseBlocks(visible) : [{ type: "p", children: [{ type: "text", text: visible, start: 0 }] }];
223
+ return /* @__PURE__ */ jsxs(
224
+ "div",
225
+ {
226
+ className: `bl-stream ${className}`,
227
+ "aria-busy": !done,
228
+ style: {
229
+ "--bl-size": `${fontSize}px`,
230
+ "--bl-ink": textColor,
231
+ "--bl-muted": mutedColor,
232
+ "--bl-line": lineColor,
233
+ "--bl-code-bg": codeBackground,
234
+ "--bl-accent": accentColor,
235
+ "--bl-cursor": cursorColor,
236
+ "--bl-fade": `${fadeDuration}ms`,
237
+ "--bl-font": fontFamily,
238
+ "--bl-mono": monoFontFamily,
239
+ ...style
240
+ },
241
+ children: [
242
+ blocks.map((block, i) => {
243
+ const last = i === blocks.length - 1;
244
+ const inner = renderNodes(block.children);
245
+ if (block.type === "pre")
246
+ return /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsxs("code", { children: [
247
+ inner,
248
+ last && cursor
249
+ ] }) }, i);
250
+ if (block.type === "ul" || block.type === "ol") {
251
+ const List = block.type;
252
+ return /* @__PURE__ */ jsx(List, { children: block.children.map((item, j) => /* @__PURE__ */ jsxs("li", { children: [
253
+ renderNodes(item.children),
254
+ last && j === block.children.length - 1 && cursor
255
+ ] }, j)) }, i);
256
+ }
257
+ const Tag = block.type;
258
+ return /* @__PURE__ */ jsxs(Tag, { children: [
259
+ inner,
260
+ last && cursor
261
+ ] }, i);
262
+ }),
263
+ !blocks.length && cursor,
264
+ /* @__PURE__ */ jsx("span", { className: "bl-stream__sr", role: "status", children: done && full ? "Response complete." : "" })
265
+ ]
266
+ }
267
+ );
268
+ }
269
+ export {
270
+ StreamingText as default
271
+ };
@@ -0,0 +1,32 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ export interface Suggestion {
3
+ /** Text handed to onPick. */
4
+ text: string;
5
+ /** What the chip shows (defaults to text). */
6
+ label?: ReactNode;
7
+ icon?: ReactNode;
8
+ }
9
+ export interface SuggestionChipsProps {
10
+ /** The pool to deal from. */
11
+ suggestions?: (string | Suggestion)[];
12
+ /** How many show at once. */
13
+ count?: number;
14
+ onPick?: (text: string, item: Suggestion) => void;
15
+ moreLabel?: string;
16
+ align?: 'center' | 'start';
17
+ /** Entrance delay per chip in ms. */
18
+ stagger?: number;
19
+ /** Accessible name of the list. */
20
+ label?: string;
21
+ chipColor?: string;
22
+ hoverColor?: string;
23
+ textColor?: string;
24
+ mutedColor?: string;
25
+ lineColor?: string;
26
+ accentColor?: string;
27
+ radius?: number;
28
+ fontFamily?: string;
29
+ className?: string;
30
+ style?: CSSProperties;
31
+ }
32
+ export default function SuggestionChips({ suggestions, count, onPick, moreLabel, align, stagger, label, chipColor, hoverColor, textColor, mutedColor, lineColor, accentColor, radius, fontFamily, className, style }: SuggestionChipsProps): import("react").JSX.Element;
@@ -0,0 +1,96 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useInsertionEffect, useState } from "react";
4
+ const STYLE_ID = "bl-suggestion-chips";
5
+ const CSS = `
6
+ .bl-chips { display: grid; justify-items: var(--bl-align); gap: 12px; width: 100%; font-family: var(--bl-font); }
7
+ .bl-chips__list { display: flex; flex-wrap: wrap; justify-content: var(--bl-justify); gap: 8px; margin: 0; padding: 0; list-style: none; }
8
+ .bl-chips__chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 9px 14px; border: 0; border-radius: var(--bl-radius); background: var(--bl-chip); color: var(--bl-ink); font: inherit; font-size: 14px; line-height: 1.35; text-align: left; cursor: pointer; box-shadow: 0 0 0 1px var(--bl-line); animation: bl-chips-in 420ms cubic-bezier(.3,1.4,.5,1) both; animation-delay: calc(var(--i) * var(--bl-stagger)); transition: background-color 150ms, box-shadow 150ms, transform 150ms; }
9
+ .bl-chips__chip:hover { background: var(--bl-hover); box-shadow: 0 0 0 1px var(--bl-accent); transform: translateY(-1px); }
10
+ .bl-chips__chip:focus-visible { outline: 2px solid var(--bl-accent); outline-offset: 2px; }
11
+ .bl-chips__list[data-leaving] .bl-chips__chip { animation: bl-chips-out 180ms ease-in both; animation-delay: calc(var(--i) * 30ms); pointer-events: none; }
12
+ .bl-chips__icon { flex: 0 0 auto; display: grid; place-items: center; }
13
+ .bl-chips__more { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--bl-muted); font: inherit; font-size: 13px; cursor: pointer; }
14
+ .bl-chips__more:hover { color: var(--bl-ink); }
15
+ .bl-chips__more:focus-visible { outline: 2px solid var(--bl-accent); }
16
+ .bl-chips__more svg { transition: transform 400ms cubic-bezier(.3,1.4,.5,1); }
17
+ .bl-chips__more:active svg { transform: rotate(-180deg); }
18
+ .bl-chips__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
19
+ @keyframes bl-chips-in { from { opacity: 0; transform: translateY(10px) scale(0.92); } }
20
+ @keyframes bl-chips-out { to { opacity: 0; transform: translateY(-6px) scale(0.95); } }
21
+ @media (prefers-reduced-motion: reduce) { .bl-chips__chip, .bl-chips__list[data-leaving] .bl-chips__chip { animation: none; } }
22
+ `;
23
+ function useStyles() {
24
+ useInsertionEffect(() => {
25
+ if (typeof document === "undefined") return;
26
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
27
+ style.textContent = CSS;
28
+ if (!style.isConnected) document.head.appendChild(style);
29
+ }, []);
30
+ }
31
+ const asItem = (s) => typeof s === "string" ? { text: s } : s;
32
+ function deal(pool, count, avoid = []) {
33
+ const fresh = pool.filter((item) => !avoid.includes(asItem(item).text));
34
+ const source = fresh.length >= count ? fresh : pool;
35
+ const shuffled = [...source];
36
+ for (let i = shuffled.length - 1; i > 0; i--) {
37
+ const j = Math.floor(Math.random() * (i + 1));
38
+ [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
39
+ }
40
+ return shuffled.slice(0, count).map(asItem);
41
+ }
42
+ function SuggestionChips({
43
+ suggestions = [],
44
+ count = 4,
45
+ onPick,
46
+ moreLabel = "More ideas",
47
+ align = "center",
48
+ stagger = 60,
49
+ label = "Suggestions",
50
+ chipColor = "#262b44",
51
+ hoverColor = "#2e3552",
52
+ textColor = "#f4f4f4",
53
+ mutedColor = "#94b0c2",
54
+ lineColor = "#333c57",
55
+ accentColor = "#73eff7",
56
+ radius = 999,
57
+ fontFamily = "ui-sans-serif, system-ui, sans-serif",
58
+ className = "",
59
+ style
60
+ }) {
61
+ useStyles();
62
+ const [shown, setShown] = useState(() => suggestions.slice(0, count).map(asItem));
63
+ const [round, setRound] = useState(0);
64
+ const [leaving, setLeaving] = useState(false);
65
+ const [announce, setAnnounce] = useState("");
66
+ const shuffle = () => {
67
+ if (leaving) return;
68
+ const reduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
69
+ const next = deal(suggestions, count, shown.map((s) => s.text));
70
+ const swap = () => {
71
+ setShown(next);
72
+ setRound((r) => r + 1);
73
+ setLeaving(false);
74
+ setAnnounce(`New suggestions: ${next.map((s) => s.text).join("; ")}`);
75
+ };
76
+ if (reduced) swap();
77
+ else {
78
+ setLeaving(true);
79
+ setTimeout(swap, 180 + shown.length * 30);
80
+ }
81
+ };
82
+ return /* @__PURE__ */ jsxs("div", { className: `bl-chips ${className}`, style: { "--bl-align": align === "start" ? "start" : "center", "--bl-justify": align === "start" ? "flex-start" : "center", "--bl-stagger": `${stagger}ms`, "--bl-chip": chipColor, "--bl-hover": hoverColor, "--bl-ink": textColor, "--bl-muted": mutedColor, "--bl-line": lineColor, "--bl-accent": accentColor, "--bl-radius": `${radius}px`, "--bl-font": fontFamily, ...style }, children: [
83
+ /* @__PURE__ */ jsx("ul", { className: "bl-chips__list", "aria-label": label, "data-leaving": leaving || void 0, children: shown.map((item, i) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", { type: "button", className: "bl-chips__chip", style: { "--i": i }, onClick: () => onPick?.(item.text, item), children: [
84
+ item.icon && /* @__PURE__ */ jsx("span", { className: "bl-chips__icon", "aria-hidden": "true", children: item.icon }),
85
+ item.label ?? item.text
86
+ ] }) }, `${round}-${item.text}`)) }),
87
+ suggestions.length > count && /* @__PURE__ */ jsxs("button", { type: "button", className: "bl-chips__more", onClick: shuffle, children: [
88
+ /* @__PURE__ */ jsx("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M11.5 5.5A5 5 0 0 0 2.6 4.4M2.5 8.5a5 5 0 0 0 8.9 1.1M2.5 2v2.5H5M11.5 12V9.5H9" }) }),
89
+ moreLabel
90
+ ] }),
91
+ /* @__PURE__ */ jsx("span", { className: "bl-chips__sr", "aria-live": "polite", children: announce })
92
+ ] });
93
+ }
94
+ export {
95
+ SuggestionChips as default
96
+ };
@@ -0,0 +1,30 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ export interface SwipeAction {
3
+ label: string;
4
+ icon?: ReactNode;
5
+ /** Background colour of the action. */
6
+ color?: string;
7
+ onSelect?: () => void;
8
+ }
9
+ export interface SwipeActionsProps {
10
+ children?: ReactNode;
11
+ /** Revealed by swiping right; the first fires on a full swipe. */
12
+ leftActions?: SwipeAction[];
13
+ /** Revealed by swiping left; the first fires on a full swipe. */
14
+ rightActions?: SwipeAction[];
15
+ /** Swiping past 60% fires the first action and slides the row away. */
16
+ fullSwipe?: boolean;
17
+ actionWidth?: number;
18
+ /** Name of the keyboard actions menu. */
19
+ label?: string;
20
+ radius?: number;
21
+ backgroundColor?: string;
22
+ underColor?: string;
23
+ textColor?: string;
24
+ mutedColor?: string;
25
+ accentColor?: string;
26
+ fontFamily?: string;
27
+ className?: string;
28
+ style?: CSSProperties;
29
+ }
30
+ export default function SwipeActions({ children, leftActions, rightActions, fullSwipe, actionWidth, label, radius, backgroundColor, underColor, textColor, mutedColor, accentColor, fontFamily, className, style }: SwipeActionsProps): import("react").JSX.Element;
@@ -0,0 +1,141 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useInsertionEffect, useRef, useState } from "react";
4
+ const STYLE_ID = "bl-swipe-actions";
5
+ const CSS = `
6
+ .bl-swipe { position: relative; overflow: hidden; border-radius: var(--bl-radius); background: var(--bl-under); font-family: var(--bl-font); color: var(--bl-ink); touch-action: pan-y; }
7
+ .bl-swipe[data-gone] { animation: bl-swipe-collapse 260ms 200ms ease forwards; }
8
+ .bl-swipe__side { position: absolute; top: 0; bottom: 0; display: flex; }
9
+ .bl-swipe__side[data-side="left"] { left: 0; }
10
+ .bl-swipe__side[data-side="right"] { right: 0; flex-direction: row-reverse; }
11
+ .bl-swipe__action { display: grid; place-items: center; align-content: center; gap: 4px; width: var(--bl-action); padding: 0 6px; border: 0; background: var(--tone, #333c57); color: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
12
+ .bl-swipe__action:focus-visible { outline: 2px solid var(--bl-accent); outline-offset: -4px; }
13
+ .bl-swipe__row { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; background: var(--bl-bg); transform: translateX(var(--x)); transition: transform 320ms cubic-bezier(.3,1.2,.5,1); cursor: grab; user-select: none; }
14
+ .bl-swipe[data-dragging] .bl-swipe__row { transition: none; cursor: grabbing; }
15
+ .bl-swipe[data-gone] .bl-swipe__row { transition: transform 240ms ease-in; }
16
+ .bl-swipe__content { flex: 1; min-width: 0; }
17
+ .bl-swipe__menu { flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin-right: 8px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--bl-muted); cursor: pointer; opacity: 0; }
18
+ .bl-swipe:hover .bl-swipe__menu { opacity: 0.7; }
19
+ .bl-swipe__menu:focus-visible, .bl-swipe__menu[aria-expanded="true"] { opacity: 1; outline: 2px solid var(--bl-accent); }
20
+ .bl-swipe__list { position: absolute; z-index: 2; top: 50%; right: 48px; display: flex; gap: 6px; transform: translateY(-50%); }
21
+ .bl-swipe__list .bl-swipe__action { width: auto; height: 32px; padding: 0 12px; border-radius: 8px; }
22
+ @keyframes bl-swipe-collapse { to { height: 0; opacity: 0; } }
23
+ @media (prefers-reduced-motion: reduce) { .bl-swipe__row, .bl-swipe[data-gone] .bl-swipe__row { transition: none; } .bl-swipe[data-gone] { animation: none; display: none; } }
24
+ `;
25
+ function useStyles() {
26
+ useInsertionEffect(() => {
27
+ if (typeof document === "undefined") return;
28
+ const style = document.getElementById(STYLE_ID) ?? Object.assign(document.createElement("style"), { id: STYLE_ID });
29
+ style.textContent = CSS;
30
+ if (!style.isConnected) document.head.appendChild(style);
31
+ }, []);
32
+ }
33
+ function SwipeActions({
34
+ children,
35
+ leftActions = [],
36
+ rightActions = [],
37
+ fullSwipe = true,
38
+ actionWidth = 76,
39
+ label = "Actions",
40
+ radius = 12,
41
+ backgroundColor = "#262b44",
42
+ underColor = "#1a1c2c",
43
+ textColor = "#f4f4f4",
44
+ mutedColor = "#94b0c2",
45
+ accentColor = "#73eff7",
46
+ fontFamily = "inherit",
47
+ className = "",
48
+ style
49
+ }) {
50
+ useStyles();
51
+ const rootRef = useRef(null);
52
+ const [x, setX] = useState(0);
53
+ const [dragging, setDragging] = useState(false);
54
+ const [gone, setGone] = useState(false);
55
+ const [menu, setMenu] = useState(false);
56
+ const drag = useRef(null);
57
+ const leftW = leftActions.length * actionWidth;
58
+ const rightW = rightActions.length * actionWidth;
59
+ const fire = (action, slideOff) => {
60
+ if (slideOff) {
61
+ const w = rootRef.current?.offsetWidth ?? 400;
62
+ setX(Math.sign(x || (action === leftActions[0] ? 1 : -1)) * w);
63
+ setGone(true);
64
+ } else setX(0);
65
+ setMenu(false);
66
+ action.onSelect?.();
67
+ };
68
+ useEffect(() => {
69
+ if (!menu) return void 0;
70
+ const close = (event) => {
71
+ if (!rootRef.current?.contains(event.target)) setMenu(false);
72
+ };
73
+ document.addEventListener("pointerdown", close);
74
+ return () => document.removeEventListener("pointerdown", close);
75
+ }, [menu]);
76
+ const onPointerDown = (event) => {
77
+ if (event.button > 0 || gone || event.target.closest("button")) return;
78
+ drag.current = { start: event.clientX, from: x, moved: false };
79
+ };
80
+ const onPointerMove = (event) => {
81
+ const d = drag.current;
82
+ if (!d) return;
83
+ const dx = event.clientX - d.start;
84
+ if (!d.moved && Math.abs(dx) > 6) {
85
+ d.moved = true;
86
+ setDragging(true);
87
+ event.currentTarget.setPointerCapture?.(event.pointerId);
88
+ }
89
+ if (!d.moved) return;
90
+ const w = rootRef.current.offsetWidth;
91
+ const max = leftActions.length ? fullSwipe ? w : leftW : 0;
92
+ const min = rightActions.length ? -(fullSwipe ? w : rightW) : 0;
93
+ let next = d.from + dx;
94
+ if (next > leftW && !fullSwipe) next = leftW + (next - leftW) * 0.25;
95
+ if (next < -rightW && !fullSwipe) next = -rightW + (next + rightW) * 0.25;
96
+ setX(Math.max(min, Math.min(max, next)));
97
+ };
98
+ const onPointerUp = () => {
99
+ const d = drag.current;
100
+ drag.current = null;
101
+ if (!d?.moved) return;
102
+ setDragging(false);
103
+ const w = rootRef.current.offsetWidth;
104
+ if (fullSwipe && x > w * 0.6 && leftActions[0]) fire(leftActions[0], true);
105
+ else if (fullSwipe && x < -w * 0.6 && rightActions[0]) fire(rightActions[0], true);
106
+ else if (x > leftW / 2 && leftW) setX(leftW);
107
+ else if (x < -rightW / 2 && rightW) setX(-rightW);
108
+ else setX(0);
109
+ };
110
+ const all = [...leftActions, ...rightActions];
111
+ const actionButton = (action, i, tab) => /* @__PURE__ */ jsxs("button", { type: "button", className: "bl-swipe__action", tabIndex: tab, style: { "--tone": action.color }, onClick: () => fire(action, false), children: [
112
+ action.icon && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: action.icon }),
113
+ action.label
114
+ ] }, `${action.label}-${i}`);
115
+ return /* @__PURE__ */ jsxs(
116
+ "div",
117
+ {
118
+ ref: rootRef,
119
+ className: `bl-swipe ${className}`,
120
+ "data-dragging": dragging || void 0,
121
+ "data-gone": gone || void 0,
122
+ style: { "--x": `${x}px`, "--bl-action": `${actionWidth}px`, "--bl-radius": `${radius}px`, "--bl-bg": backgroundColor, "--bl-under": underColor, "--bl-ink": textColor, "--bl-muted": mutedColor, "--bl-accent": accentColor, "--bl-font": fontFamily, ...style },
123
+ children: [
124
+ /* @__PURE__ */ jsx("div", { className: "bl-swipe__side", "data-side": "left", "aria-hidden": "true", children: leftActions.map((a, i) => actionButton(a, i, -1)) }),
125
+ /* @__PURE__ */ jsx("div", { className: "bl-swipe__side", "data-side": "right", "aria-hidden": "true", children: rightActions.map((a, i) => actionButton(a, i, -1)) }),
126
+ /* @__PURE__ */ jsxs("div", { className: "bl-swipe__row", onPointerDown, onPointerMove, onPointerUp, onPointerCancel: onPointerUp, children: [
127
+ /* @__PURE__ */ jsx("div", { className: "bl-swipe__content", children }),
128
+ all.length > 0 && /* @__PURE__ */ jsx("button", { type: "button", className: "bl-swipe__menu", "aria-expanded": menu, "aria-label": label, onClick: () => setMenu((m) => !m), children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: [
129
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "7", width: "3", height: "3" }),
130
+ /* @__PURE__ */ jsx("rect", { x: "7", y: "7", width: "3", height: "3" }),
131
+ /* @__PURE__ */ jsx("rect", { x: "12", y: "7", width: "3", height: "3" })
132
+ ] }) })
133
+ ] }),
134
+ menu && /* @__PURE__ */ jsx("div", { className: "bl-swipe__list", role: "group", "aria-label": label, children: all.map((a, i) => actionButton(a, i, 0)) })
135
+ ]
136
+ }
137
+ );
138
+ }
139
+ export {
140
+ SwipeActions as default
141
+ };
@@ -0,0 +1,30 @@
1
+ import { type CSSProperties } from 'react';
2
+ export interface TagInputProps {
3
+ value?: string[];
4
+ defaultValue?: string[];
5
+ onValueChange?: (tags: string[]) => void;
6
+ /** Autocomplete options. */
7
+ suggestions?: string[];
8
+ /** Allow tags that aren't in suggestions. */
9
+ allowCustom?: boolean;
10
+ max?: number;
11
+ /** Return false or a message to reject a tag. */
12
+ validate?: (tag: string) => boolean | string | void;
13
+ label?: string;
14
+ placeholder?: string;
15
+ hint?: string;
16
+ width?: number;
17
+ backgroundColor?: string;
18
+ chipColor?: string;
19
+ textColor?: string;
20
+ mutedColor?: string;
21
+ dimColor?: string;
22
+ lineColor?: string;
23
+ accentColor?: string;
24
+ errorColor?: string;
25
+ radius?: number;
26
+ fontFamily?: string;
27
+ className?: string;
28
+ style?: CSSProperties;
29
+ }
30
+ export default function TagInput({ value, defaultValue, onValueChange, suggestions, allowCustom, max, validate, label, placeholder, hint, width, backgroundColor, chipColor, textColor, mutedColor, dimColor, lineColor, accentColor, errorColor, radius, fontFamily, className, style }: TagInputProps): import("react").JSX.Element;