@visulima/tui-kit 0.0.0 → 1.0.0

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 (371) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE.md +2095 -0
  3. package/README.md +115 -29
  4. package/dist/accordion.d.ts +59 -0
  5. package/dist/accordion.js +1 -0
  6. package/dist/alert.d.ts +26 -0
  7. package/dist/alert.js +1 -0
  8. package/dist/animate-presence.d.ts +18 -0
  9. package/dist/animate-presence.js +1 -0
  10. package/dist/approval-prompt.d.ts +65 -0
  11. package/dist/approval-prompt.js +1 -0
  12. package/dist/area-chart.d.ts +66 -0
  13. package/dist/area-chart.js +1 -0
  14. package/dist/badge.d.ts +22 -0
  15. package/dist/badge.js +1 -0
  16. package/dist/bar-chart.d.ts +67 -0
  17. package/dist/bar-chart.js +1 -0
  18. package/dist/big-text.d.ts +81 -0
  19. package/dist/big-text.js +1 -0
  20. package/dist/blink-dot.d.ts +36 -0
  21. package/dist/blink-dot.js +1 -0
  22. package/dist/breadcrumb.d.ts +33 -0
  23. package/dist/breadcrumb.js +1 -0
  24. package/dist/button.d.ts +45 -0
  25. package/dist/button.js +1 -0
  26. package/dist/calendar.d.ts +72 -0
  27. package/dist/calendar.js +1 -0
  28. package/dist/card.d.ts +57 -0
  29. package/dist/card.js +1 -0
  30. package/dist/checkbox-group.d.ts +59 -0
  31. package/dist/checkbox-group.js +1 -0
  32. package/dist/checkbox.d.ts +48 -0
  33. package/dist/checkbox.js +1 -0
  34. package/dist/code.d.ts +48 -0
  35. package/dist/code.js +2 -0
  36. package/dist/collapsible.d.ts +53 -0
  37. package/dist/collapsible.js +1 -0
  38. package/dist/color-picker.d.ts +71 -0
  39. package/dist/color-picker.js +1 -0
  40. package/dist/command-block.d.ts +47 -0
  41. package/dist/command-block.js +4 -0
  42. package/dist/command-palette.d.ts +82 -0
  43. package/dist/command-palette.js +1 -0
  44. package/dist/confirm-dialog.d.ts +75 -0
  45. package/dist/confirm-dialog.js +1 -0
  46. package/dist/confirm-input.d.ts +38 -0
  47. package/dist/confirm-input.js +1 -0
  48. package/dist/console-overlay.d.ts +54 -0
  49. package/dist/console-overlay.js +1 -0
  50. package/dist/content-switcher.d.ts +57 -0
  51. package/dist/content-switcher.js +1 -0
  52. package/dist/controlled-scroll-view.d.ts +3 -0
  53. package/dist/controlled-scroll-view.js +1 -0
  54. package/dist/data-grid.d.ts +49 -0
  55. package/dist/data-grid.js +1 -0
  56. package/dist/date-picker.d.ts +65 -0
  57. package/dist/date-picker.js +1 -0
  58. package/dist/definition-list.d.ts +44 -0
  59. package/dist/definition-list.js +1 -0
  60. package/dist/dialog.d.ts +110 -0
  61. package/dist/dialog.js +1 -0
  62. package/dist/diff-view.d.ts +85 -0
  63. package/dist/diff-view.js +1 -0
  64. package/dist/digits.d.ts +30 -0
  65. package/dist/digits.js +1 -0
  66. package/dist/directory-tree.d.ts +51 -0
  67. package/dist/directory-tree.js +1 -0
  68. package/dist/divider.d.ts +49 -0
  69. package/dist/divider.js +1 -0
  70. package/dist/drawer.d.ts +53 -0
  71. package/dist/drawer.js +1 -0
  72. package/dist/file-change.d.ts +40 -0
  73. package/dist/file-change.js +1 -0
  74. package/dist/file-picker-entry.d.ts +2 -0
  75. package/dist/file-picker-entry.js +1 -0
  76. package/dist/form.d.ts +81 -0
  77. package/dist/form.js +1 -0
  78. package/dist/gauge.d.ts +87 -0
  79. package/dist/gauge.js +1 -0
  80. package/dist/gradient.d.ts +42 -0
  81. package/dist/gradient.js +1 -0
  82. package/dist/grid.d.ts +40 -0
  83. package/dist/grid.js +1 -0
  84. package/dist/heading.d.ts +33 -0
  85. package/dist/heading.js +1 -0
  86. package/dist/heatmap.d.ts +62 -0
  87. package/dist/heatmap.js +1 -0
  88. package/dist/help.d.ts +52 -0
  89. package/dist/help.js +1 -0
  90. package/dist/histogram.d.ts +62 -0
  91. package/dist/histogram.js +1 -0
  92. package/dist/image.d.ts +26 -0
  93. package/dist/image.js +1 -0
  94. package/dist/index.d.ts +125 -0
  95. package/dist/index.js +1 -0
  96. package/dist/json.d.ts +58 -0
  97. package/dist/json.js +1 -0
  98. package/dist/kbd.d.ts +31 -0
  99. package/dist/kbd.js +1 -0
  100. package/dist/line-chart.d.ts +109 -0
  101. package/dist/line-chart.js +1 -0
  102. package/dist/link.d.ts +38 -0
  103. package/dist/link.js +1 -0
  104. package/dist/loading-indicator.d.ts +29 -0
  105. package/dist/loading-indicator.js +1 -0
  106. package/dist/log.d.ts +38 -0
  107. package/dist/log.js +1 -0
  108. package/dist/markdown.d.ts +40 -0
  109. package/dist/markdown.js +1 -0
  110. package/dist/masked-input.d.ts +50 -0
  111. package/dist/masked-input.js +1 -0
  112. package/dist/menu.d.ts +78 -0
  113. package/dist/menu.js +1 -0
  114. package/dist/message-bubble.d.ts +43 -0
  115. package/dist/message-bubble.js +1 -0
  116. package/dist/model-badge.d.ts +39 -0
  117. package/dist/model-badge.js +1 -0
  118. package/dist/model-selector.d.ts +52 -0
  119. package/dist/model-selector.js +1 -0
  120. package/dist/multi-progress.d.ts +55 -0
  121. package/dist/multi-progress.js +1 -0
  122. package/dist/multi-select.d.ts +65 -0
  123. package/dist/multi-select.js +1 -0
  124. package/dist/notification-badge.d.ts +47 -0
  125. package/dist/notification-badge.js +1 -0
  126. package/dist/number-input.d.ts +85 -0
  127. package/dist/number-input.js +1 -0
  128. package/dist/operation-tree.d.ts +49 -0
  129. package/dist/operation-tree.js +1 -0
  130. package/dist/option-list.d.ts +47 -0
  131. package/dist/option-list.js +1 -0
  132. package/dist/ordered-list.d.ts +24 -0
  133. package/dist/ordered-list.js +1 -0
  134. package/dist/packem_shared/ControlledScrollView-BzlbIUph.js +1 -0
  135. package/dist/packem_shared/FilePicker-V5H2fb-v.js +1 -0
  136. package/dist/packem_shared/ScrollBar-C9i3z3Ft.js +1 -0
  137. package/dist/packem_shared/ScrollBarBox-DZEC8YnV.js +1 -0
  138. package/dist/packem_shared/ScrollList-Djtb2vVy.js +1 -0
  139. package/dist/packem_shared/ScrollView-ESxpl6Hy.js +1 -0
  140. package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +1 -0
  141. package/dist/packem_shared/TreeView-q0l446NV.js +1 -0
  142. package/dist/packem_shared/controlled-scroll-view-DerVKKv6.js +1 -0
  143. package/dist/packem_shared/controlled-scroll-view.d-vF4wevEJ.d.ts +54 -0
  144. package/dist/packem_shared/file-picker.d-Cie6aAMD.d.ts +104 -0
  145. package/dist/packem_shared/line-chart-BbhMhcZg.js +1 -0
  146. package/dist/packem_shared/scroll-bar-box.d-DSBbBsRc.d.ts +30 -0
  147. package/dist/packem_shared/scroll-bar.d-B4sD1hBR.d.ts +18 -0
  148. package/dist/packem_shared/scroll-list.d-BP0UZSY4.d.ts +12 -0
  149. package/dist/packem_shared/scroll-view.d-BqKpI-F-.d.ts +119 -0
  150. package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +1 -0
  151. package/dist/packem_shared/use-tree-view.d-dXTKoDPM.d.ts +350 -0
  152. package/dist/packem_shared/useTreeView-D0JEqT6W.js +1 -0
  153. package/dist/packem_shared/useTreeViewState-BiTJakkh.js +1 -0
  154. package/dist/packem_shared/variant-config-BJqpNo7H.js +1 -0
  155. package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +2 -0
  156. package/dist/paginator.d.ts +69 -0
  157. package/dist/paginator.js +1 -0
  158. package/dist/paragraph.d.ts +38 -0
  159. package/dist/paragraph.js +1 -0
  160. package/dist/path-input.d.ts +67 -0
  161. package/dist/path-input.js +1 -0
  162. package/dist/pie-chart.d.ts +50 -0
  163. package/dist/pie-chart.js +1 -0
  164. package/dist/placeholder.d.ts +55 -0
  165. package/dist/placeholder.js +1 -0
  166. package/dist/popover.d.ts +46 -0
  167. package/dist/popover.js +1 -0
  168. package/dist/progress-bar.d.ts +51 -0
  169. package/dist/progress-bar.js +1 -0
  170. package/dist/progress-circle.d.ts +59 -0
  171. package/dist/progress-circle.js +1 -0
  172. package/dist/qr-code.d.ts +45 -0
  173. package/dist/qr-code.js +1 -0
  174. package/dist/r/accordion.json +24 -0
  175. package/dist/r/alert.json +24 -0
  176. package/dist/r/animate-presence.json +22 -0
  177. package/dist/r/approval-prompt.json +24 -0
  178. package/dist/r/area-chart.json +27 -0
  179. package/dist/r/badge.json +24 -0
  180. package/dist/r/bar-chart.json +24 -0
  181. package/dist/r/big-text.json +23 -0
  182. package/dist/r/blink-dot.json +24 -0
  183. package/dist/r/breadcrumb.json +24 -0
  184. package/dist/r/button.json +24 -0
  185. package/dist/r/calendar.json +24 -0
  186. package/dist/r/card.json +26 -0
  187. package/dist/r/chart-utils.json +24 -0
  188. package/dist/r/checkbox-group.json +24 -0
  189. package/dist/r/checkbox.json +24 -0
  190. package/dist/r/code.json +23 -0
  191. package/dist/r/collapsible.json +24 -0
  192. package/dist/r/color-picker.json +24 -0
  193. package/dist/r/command-block.json +26 -0
  194. package/dist/r/command-palette.json +24 -0
  195. package/dist/r/confirm-dialog.json +24 -0
  196. package/dist/r/confirm-input.json +22 -0
  197. package/dist/r/console-overlay.json +22 -0
  198. package/dist/r/content-switcher.json +24 -0
  199. package/dist/r/controlled-scroll-view.json +24 -0
  200. package/dist/r/data-grid.json +24 -0
  201. package/dist/r/date-picker.json +26 -0
  202. package/dist/r/definition-list.json +24 -0
  203. package/dist/r/dialog.json +24 -0
  204. package/dist/r/diff-view.json +24 -0
  205. package/dist/r/digits.json +24 -0
  206. package/dist/r/directory-tree.json +24 -0
  207. package/dist/r/divider.json +24 -0
  208. package/dist/r/drawer.json +24 -0
  209. package/dist/r/file-change.json +24 -0
  210. package/dist/r/file-picker.json +44 -0
  211. package/dist/r/form.json +24 -0
  212. package/dist/r/gauge.json +24 -0
  213. package/dist/r/gradient.json +24 -0
  214. package/dist/r/grid.json +22 -0
  215. package/dist/r/heading.json +24 -0
  216. package/dist/r/heatmap.json +24 -0
  217. package/dist/r/help.json +22 -0
  218. package/dist/r/histogram.json +26 -0
  219. package/dist/r/image.json +24 -0
  220. package/dist/r/json.json +24 -0
  221. package/dist/r/kbd.json +24 -0
  222. package/dist/r/line-chart.json +26 -0
  223. package/dist/r/link.json +23 -0
  224. package/dist/r/loading-indicator.json +27 -0
  225. package/dist/r/log.json +24 -0
  226. package/dist/r/markdown.json +29 -0
  227. package/dist/r/masked-input.json +22 -0
  228. package/dist/r/menu.json +24 -0
  229. package/dist/r/message-bubble.json +24 -0
  230. package/dist/r/model-badge.json +24 -0
  231. package/dist/r/model-selector.json +24 -0
  232. package/dist/r/multi-progress.json +24 -0
  233. package/dist/r/multi-select.json +24 -0
  234. package/dist/r/notification-badge.json +24 -0
  235. package/dist/r/number-input.json +24 -0
  236. package/dist/r/operation-tree.json +26 -0
  237. package/dist/r/option-list.json +24 -0
  238. package/dist/r/ordered-list.json +22 -0
  239. package/dist/r/paginator.json +22 -0
  240. package/dist/r/paragraph.json +24 -0
  241. package/dist/r/path-input.json +26 -0
  242. package/dist/r/pie-chart.json +24 -0
  243. package/dist/r/placeholder.json +24 -0
  244. package/dist/r/popover.json +24 -0
  245. package/dist/r/progress-bar.json +22 -0
  246. package/dist/r/progress-circle.json +24 -0
  247. package/dist/r/qr-code.json +24 -0
  248. package/dist/r/radio-group.json +24 -0
  249. package/dist/r/registry.json +1051 -0
  250. package/dist/r/scatter-plot.json +27 -0
  251. package/dist/r/scroll-bar-box.json +24 -0
  252. package/dist/r/scroll-bar.json +24 -0
  253. package/dist/r/scroll-list.json +24 -0
  254. package/dist/r/scroll-view.json +24 -0
  255. package/dist/r/scroll.json +58 -0
  256. package/dist/r/search-input.json +26 -0
  257. package/dist/r/select-input-indicator.json +24 -0
  258. package/dist/r/select-input-item.json +24 -0
  259. package/dist/r/select-input.json +28 -0
  260. package/dist/r/shimmer-text.json +24 -0
  261. package/dist/r/sidebar.json +24 -0
  262. package/dist/r/slider.json +24 -0
  263. package/dist/r/sparkline.json +24 -0
  264. package/dist/r/spinner.json +23 -0
  265. package/dist/r/status-line.json +24 -0
  266. package/dist/r/status-message.json +24 -0
  267. package/dist/r/stepper.json +24 -0
  268. package/dist/r/stopwatch.json +22 -0
  269. package/dist/r/streaming-text.json +24 -0
  270. package/dist/r/switch.json +24 -0
  271. package/dist/r/tab.json +22 -0
  272. package/dist/r/table.json +23 -0
  273. package/dist/r/tabs.json +26 -0
  274. package/dist/r/tag-input.json +24 -0
  275. package/dist/r/tag.json +24 -0
  276. package/dist/r/text-input.json +22 -0
  277. package/dist/r/textarea.json +22 -0
  278. package/dist/r/thinking-block.json +24 -0
  279. package/dist/r/time-picker.json +24 -0
  280. package/dist/r/timer.json +22 -0
  281. package/dist/r/toast.json +24 -0
  282. package/dist/r/token-usage.json +24 -0
  283. package/dist/r/tool-call.json +24 -0
  284. package/dist/r/tooltip.json +24 -0
  285. package/dist/r/transition.json +22 -0
  286. package/dist/r/tree-select.json +24 -0
  287. package/dist/r/tree-view.json +64 -0
  288. package/dist/r/unordered-list.json +22 -0
  289. package/dist/r/use-linked-scroll.json +24 -0
  290. package/dist/r/variant-config.json +22 -0
  291. package/dist/radio-group.d.ts +74 -0
  292. package/dist/radio-group.js +1 -0
  293. package/dist/scatter-plot.d.ts +35 -0
  294. package/dist/scatter-plot.js +1 -0
  295. package/dist/scroll-bar-box.d.ts +3 -0
  296. package/dist/scroll-bar-box.js +1 -0
  297. package/dist/scroll-bar.d.ts +3 -0
  298. package/dist/scroll-bar.js +1 -0
  299. package/dist/scroll-list.d.ts +4 -0
  300. package/dist/scroll-list.js +1 -0
  301. package/dist/scroll-view.d.ts +3 -0
  302. package/dist/scroll-view.js +1 -0
  303. package/dist/search-input.d.ts +55 -0
  304. package/dist/search-input.js +1 -0
  305. package/dist/select-input-indicator.d.ts +32 -0
  306. package/dist/select-input-indicator.js +1 -0
  307. package/dist/select-input-item.d.ts +41 -0
  308. package/dist/select-input-item.js +1 -0
  309. package/dist/select-input.d.ts +110 -0
  310. package/dist/select-input.js +1 -0
  311. package/dist/shimmer-text.d.ts +47 -0
  312. package/dist/shimmer-text.js +1 -0
  313. package/dist/sidebar.d.ts +47 -0
  314. package/dist/sidebar.js +1 -0
  315. package/dist/slider.d.ts +103 -0
  316. package/dist/slider.js +1 -0
  317. package/dist/sparkline.d.ts +42 -0
  318. package/dist/sparkline.js +1 -0
  319. package/dist/spinner.d.ts +17 -0
  320. package/dist/spinner.js +1 -0
  321. package/dist/status-line.d.ts +37 -0
  322. package/dist/status-line.js +1 -0
  323. package/dist/status-message.d.ts +21 -0
  324. package/dist/status-message.js +1 -0
  325. package/dist/stepper.d.ts +48 -0
  326. package/dist/stepper.js +1 -0
  327. package/dist/stopwatch.d.ts +49 -0
  328. package/dist/stopwatch.js +1 -0
  329. package/dist/streaming-text.d.ts +46 -0
  330. package/dist/streaming-text.js +1 -0
  331. package/dist/switch.d.ts +55 -0
  332. package/dist/switch.js +1 -0
  333. package/dist/tab.d.ts +19 -0
  334. package/dist/tab.js +1 -0
  335. package/dist/table.d.ts +119 -0
  336. package/dist/table.js +1 -0
  337. package/dist/tabs.d.ts +107 -0
  338. package/dist/tabs.js +1 -0
  339. package/dist/tag-input.d.ts +71 -0
  340. package/dist/tag-input.js +1 -0
  341. package/dist/tag.d.ts +35 -0
  342. package/dist/tag.js +1 -0
  343. package/dist/text-input.d.ts +48 -0
  344. package/dist/text-input.js +1 -0
  345. package/dist/textarea.d.ts +68 -0
  346. package/dist/textarea.js +2 -0
  347. package/dist/thinking-block.d.ts +57 -0
  348. package/dist/thinking-block.js +1 -0
  349. package/dist/time-picker.d.ts +67 -0
  350. package/dist/time-picker.js +1 -0
  351. package/dist/timer.d.ts +59 -0
  352. package/dist/timer.js +1 -0
  353. package/dist/toast.d.ts +49 -0
  354. package/dist/toast.js +1 -0
  355. package/dist/token-usage.d.ts +50 -0
  356. package/dist/token-usage.js +1 -0
  357. package/dist/tool-call.d.ts +33 -0
  358. package/dist/tool-call.js +1 -0
  359. package/dist/tooltip.d.ts +43 -0
  360. package/dist/tooltip.js +1 -0
  361. package/dist/transition.d.ts +74 -0
  362. package/dist/transition.js +1 -0
  363. package/dist/tree-select.d.ts +65 -0
  364. package/dist/tree-select.js +1 -0
  365. package/dist/tree-view-entry.d.ts +4 -0
  366. package/dist/tree-view-entry.js +1 -0
  367. package/dist/unordered-list.d.ts +30 -0
  368. package/dist/unordered-list.js +1 -0
  369. package/dist/use-linked-scroll.d.ts +42 -0
  370. package/dist/use-linked-scroll.js +1 -0
  371. package/package.json +553 -7
@@ -0,0 +1 @@
1
+ import{ScrollBar as l}from"./packem_shared/ScrollBar-C9i3z3Ft.js";export{l as ScrollBar};
@@ -0,0 +1,4 @@
1
+ export { type S as ScrollAlignment, a as ScrollList, type b as ScrollListProps, type c as ScrollListRef } from "./packem_shared/scroll-list.d-BP0UZSY4.js";
2
+ import 'react';
3
+ import "./packem_shared/scroll-view.d-BqKpI-F-.js";
4
+ import '@visulima/tui/components/box';
@@ -0,0 +1 @@
1
+ import{ScrollList as l}from"./packem_shared/ScrollList-Djtb2vVy.js";export{l as ScrollList};
@@ -0,0 +1,3 @@
1
+ export { S as ScrollView, type a as ScrollViewProps, type b as ScrollViewRef } from "./packem_shared/scroll-view.d-BqKpI-F-.js";
2
+ import '@visulima/tui/components/box';
3
+ import 'react';
@@ -0,0 +1 @@
1
+ import{ScrollView as e}from"./packem_shared/ScrollView-ESxpl6Hy.js";export{e as ScrollView};
@@ -0,0 +1,55 @@
1
+ import { AnsiColors } from '@visulima/colorize';
2
+ import { ReactNode, ReactElement } from 'react';
3
+ import { LiteralUnion } from 'type-fest';
4
+ type Props = {
5
+ /**
6
+ * Color of the accent elements (border, icon).
7
+ * @default "blue"
8
+ */
9
+ readonly accentColor?: LiteralUnion<AnsiColors, string>;
10
+ /**
11
+ * Initial value.
12
+ */
13
+ readonly defaultValue?: string;
14
+ /**
15
+ * Node rendered before the input as a search affordance.
16
+ * @default "⌕" (telephone recorder)
17
+ */
18
+ readonly icon?: ReactNode;
19
+ /**
20
+ * Disable the input.
21
+ */
22
+ readonly isDisabled?: boolean;
23
+ /**
24
+ * Fired whenever the value changes.
25
+ */
26
+ readonly onChange?: (value: string) => void;
27
+ /**
28
+ * Fired when the user presses Enter.
29
+ */
30
+ readonly onSubmit?: (value: string) => void;
31
+ /**
32
+ * Placeholder text shown when the input is empty.
33
+ * @default "Search..."
34
+ */
35
+ readonly placeholder?: string;
36
+ /**
37
+ * Autocomplete suggestions.
38
+ */
39
+ readonly suggestions?: ReadonlyArray<string>;
40
+ };
41
+ /**
42
+ * Search-styled text input with an icon and bordered container.
43
+ * @returns A `ReactElement` wrapping `TextInput` with an icon column.
44
+ */
45
+ declare function SearchInput({
46
+ accentColor,
47
+ defaultValue,
48
+ icon,
49
+ isDisabled,
50
+ onChange,
51
+ onSubmit,
52
+ placeholder,
53
+ suggestions
54
+ }: Props): ReactElement;
55
+ export { Props, SearchInput, type Props as SearchInputProps, SearchInput as default };
@@ -0,0 +1 @@
1
+ import{jsxs as u,jsx as o}from"react/jsx-runtime";import r from"@visulima/tui/components/box";import c from"@visulima/tui/components/text";import{TextInput as p}from"./text-input.js";function b({accentColor:e="blue",defaultValue:l="",icon:a="⌕",isDisabled:n=!1,onChange:t,onSubmit:i,placeholder:s="Search...",suggestions:d}){return u(r,{borderColor:e,borderStyle:"round",gap:1,paddingX:1,children:[o(c,{color:e,children:a}),o(r,{flexGrow:1,children:o(p,{defaultValue:l,isDisabled:n,onChange:t,onSubmit:i,placeholder:s,suggestions:d})})]})}export{b as SearchInput,b as default};
@@ -0,0 +1,32 @@
1
+ import { AnsiColors } from '@visulima/colorize';
2
+ import { ReactElement } from 'react';
3
+ import { LiteralUnion } from 'type-fest';
4
+ type Props = {
5
+ /**
6
+ * Color of the indicator when selected.
7
+ * @default "blue"
8
+ */
9
+ readonly accentColor?: LiteralUnion<AnsiColors, string>;
10
+ /**
11
+ * Whether the parent SelectInput has focus.
12
+ * When `false`, the indicator is dimmed even if the item is selected.
13
+ * @default true
14
+ */
15
+ readonly isFocused?: boolean;
16
+ /**
17
+ * Whether this indicator's item is currently selected.
18
+ * @default false
19
+ */
20
+ readonly isSelected?: boolean;
21
+ };
22
+ /**
23
+ * Renders a pointer indicator next to the selected item, or a blank space otherwise.
24
+ * When unfocused, the indicator is rendered with `dimColor` to visually distinguish
25
+ * the active select input from inactive ones.
26
+ */
27
+ declare function SelectInputIndicator({
28
+ accentColor,
29
+ isFocused,
30
+ isSelected
31
+ }: Props): ReactElement;
32
+ export { Props, SelectInputIndicator, type Props as SelectInputIndicatorProps, SelectInputIndicator as default };
@@ -0,0 +1 @@
1
+ import{jsx as r}from"react/jsx-runtime";import c from"@visulima/tui/components/box";import o from"@visulima/tui/components/text";function m({accentColor:e="blue",isFocused:t=!0,isSelected:i=!1}){return r(c,{marginRight:1,children:i?r(o,{color:e,dimColor:!t,children:"❯"}):r(o,{children:" "})})}export{m as SelectInputIndicator,m as default};
@@ -0,0 +1,41 @@
1
+ import { AnsiColors } from '@visulima/colorize';
2
+ import { ReactElement } from 'react';
3
+ import { LiteralUnion } from 'type-fest';
4
+ type Props = {
5
+ /**
6
+ * Color of the label when selected.
7
+ * @default "blue"
8
+ */
9
+ readonly accentColor?: LiteralUnion<AnsiColors, string>;
10
+ /**
11
+ * Color of the label when not selected.
12
+ */
13
+ readonly defaultColor?: LiteralUnion<AnsiColors, string>;
14
+ /**
15
+ * Whether the parent SelectInput has focus.
16
+ * When `false`, the selected item is dimmed.
17
+ * @default true
18
+ */
19
+ readonly isFocused?: boolean;
20
+ /**
21
+ * Whether this item is currently selected.
22
+ * @default false
23
+ */
24
+ readonly isSelected?: boolean;
25
+ /**
26
+ * Text label to display for this item.
27
+ */
28
+ readonly label: string;
29
+ };
30
+ /**
31
+ * Renders an item label, using `accentColor` when selected and `defaultColor` otherwise.
32
+ * When unfocused, selected items are rendered with `dimColor`.
33
+ */
34
+ declare function SelectInputItem({
35
+ accentColor,
36
+ defaultColor,
37
+ isFocused,
38
+ isSelected,
39
+ label
40
+ }: Props): ReactElement;
41
+ export { Props, SelectInputItem, type Props as SelectInputItemProps, SelectInputItem as default };
@@ -0,0 +1 @@
1
+ import{jsx as c}from"react/jsx-runtime";import i from"@visulima/tui/components/text";function s({accentColor:o="blue",defaultColor:l,isFocused:r=!0,isSelected:e=!1,label:t}){return c(i,{color:e?o:l,dimColor:e&&!r,children:t})}export{s as SelectInputItem,s as default};
@@ -0,0 +1,110 @@
1
+ import { AnsiColors } from '@visulima/colorize';
2
+ import { FC, ReactElement } from 'react';
3
+ import { LiteralUnion } from 'type-fest';
4
+ import { Props as Props$1 } from "./select-input-indicator.js";
5
+ import { Props as Props$2 } from "./select-input-item.js";
6
+ type Item<V> = {
7
+ /**
8
+ * Called automatically when this item is selected (via Enter or number key).
9
+ * Fires after `onSelect`. Useful for defining per-item behavior inline.
10
+ */
11
+ readonly action?: () => void;
12
+ readonly key?: string;
13
+ readonly label: string;
14
+ readonly value: V;
15
+ };
16
+ type SeparatorItem = {
17
+ /**
18
+ * Marks this entry as a non-focusable separator line.
19
+ */
20
+ readonly isSeparator: true;
21
+ readonly key?: string;
22
+ /**
23
+ * Custom separator text. Defaults to `"───"`.
24
+ */
25
+ readonly label?: string;
26
+ };
27
+ type SelectInputEntry<V> = Item<V> | SeparatorItem;
28
+ type Props<V> = {
29
+ /**
30
+ * Color used for the selected item and indicator.
31
+ * @default "blue"
32
+ */
33
+ readonly accentColor?: LiteralUnion<AnsiColors, string>;
34
+ /**
35
+ * Color used for unselected items.
36
+ */
37
+ readonly defaultColor?: LiteralUnion<AnsiColors, string>;
38
+ /**
39
+ * Controlled selected index. When provided, the component becomes controlled
40
+ * and `initialIndex` is ignored. Update this value in the `onHighlight` callback
41
+ * to track selection externally. If the index points to a separator, the nearest
42
+ * selectable item is highlighted instead.
43
+ */
44
+ readonly index?: number;
45
+ /**
46
+ * Custom component to override the default indicator component.
47
+ */
48
+ readonly indicatorComponent?: FC<Props$1>;
49
+ /**
50
+ * Index of initially-selected item in `items` array.
51
+ * Ignored when `index` is provided.
52
+ * When omitted (`undefined`), no item is highlighted until the user presses a key.
53
+ * If the index points to a separator, the nearest selectable item is used.
54
+ */
55
+ readonly initialIndex?: number;
56
+ /**
57
+ * Whether the input is focused. Useful for when there are multiple
58
+ * inputs on the screen and you need to control which one captures input.
59
+ * @default true
60
+ */
61
+ readonly isFocused?: boolean;
62
+ /**
63
+ * Custom component to override the default item component.
64
+ */
65
+ readonly itemComponent?: FC<Props$2>;
66
+ /** @default [] */
67
+ readonly items?: ReadonlyArray<SelectInputEntry<V>>;
68
+ /**
69
+ * Number of visible items. Useful if the list is long and you want
70
+ * to limit the display with a scrolling window.
71
+ */
72
+ readonly limit?: number;
73
+ /**
74
+ * Called when the user highlights a new item via arrow keys or `j`/`k`.
75
+ * The second argument is the index of the highlighted item in the visible list.
76
+ */
77
+ readonly onHighlight?: (item: Item<V>, index: number) => void;
78
+ /**
79
+ * Called when the user selects an item via Enter or a number key (1-9).
80
+ */
81
+ readonly onSelect?: (item: Item<V>) => void;
82
+ /**
83
+ * Whether to reset the selection when items change.
84
+ * Set to `false` to preserve the current selection across item updates.
85
+ * @default true
86
+ */
87
+ readonly resetOnItemsChange?: boolean;
88
+ };
89
+ /**
90
+ * A select input component for terminal UIs.
91
+ *
92
+ * Renders a list of items with an indicator showing the currently highlighted item.
93
+ * Users can navigate with arrow keys or `j`/`k`, select with Enter, or jump to an
94
+ * item by pressing a number key (1-9).
95
+ */
96
+ declare function SelectInput<V>({
97
+ accentColor,
98
+ defaultColor,
99
+ index,
100
+ indicatorComponent,
101
+ initialIndex,
102
+ isFocused,
103
+ itemComponent,
104
+ items,
105
+ limit: customLimit,
106
+ onHighlight,
107
+ onSelect,
108
+ resetOnItemsChange
109
+ }: Props<V>): ReactElement;
110
+ export { Item, Props, SelectInput, SelectInputEntry, type Item as SelectInputItemType, type Props as SelectInputProps, type SeparatorItem as SelectInputSeparator, SeparatorItem, SelectInput as default };
@@ -0,0 +1 @@
1
+ import{jsx as k,jsxs as $}from"react/jsx-runtime";import{isDeepStrictEqual as ee}from"node:util";import q from"@visulima/tui/components/box";import te from"@visulima/tui/components/text";import ne from"@visulima/tui/hooks/use-input";import re from"@visulima/tui/hooks/use-window-size";import{useReducer as oe,useRef as w,useMemo as ce,useEffect as X,useCallback as H,createElement as Y}from"react";import{SelectInputIndicator as ie}from"./select-input-indicator.js";import{SelectInputItem as se}from"./select-input-item.js";const y=n=>"isSeparator"in n&&n.isSeparator,ae=[],de=/^[1-9]$/,d=-1,le="───",ue=Symbol("separator"),fe=(n,r)=>{switch(r.type){case"navigate":return{rotateIndex:r.rotateIndex,selectedIndex:r.selectedIndex};case"reset":return{rotateIndex:0,selectedIndex:r.hasInitialSelection?r.initialIndex:d};case"set":return{rotateIndex:r.selectedIndex,selectedIndex:r.selectedIndex};default:return n}},me=(n,r)=>{const{length:o}=n;if(o===0)return[];const u=(r%o+o)%o;return[...n.slice(u),...n.slice(0,u)]},S=(n,r,o,u)=>r?me(n,o).slice(0,u):n,E=(n,r,o)=>{const{length:u}=n;for(let b=0;b<u;b+=1){const C=((r+(b+1)*o)%u+u)%u;if(!y(n[C]))return C}return d},Z=(n,r)=>{if(r<0||r>=n.length)return d;const o=n[r];return o&&!y(o)?r:E(n,r-1,1)};function ve({accentColor:n="blue",defaultColor:r,index:o,indicatorComponent:u=ie,initialIndex:b,isFocused:C=!0,itemComponent:Q=se,items:t=ae,limit:N,onHighlight:f,onSelect:O,resetOnItemsChange:R=!0}){const{rows:W}=re(),z=typeof N=="number"?N:W,c=t.length>z,l=c?Math.min(z,t.length):t.length,A=l-1,G=typeof o=="number"||typeof b=="number",J=typeof o=="number"?o:b??d,D=J===d?d:Z(t,Math.min(J,A)),[F,v]=oe(fe,{rotateIndex:D>A?A-D:0,selectedIndex:D}),K=w(G),L=w(D),P=w(F);P.current=F;const j=w(O);j.current=O;const B=w(t),M=ce(()=>t.map(e=>y(e)?ue:e.value),[t]),T=w(M);K.current=G,L.current=D,X(()=>{R&&!ee(T.current,M)&&v({hasInitialSelection:K.current,initialIndex:L.current,type:"reset"}),T.current=M,B.current=t},[t,M,R]),X(()=>{if(typeof o=="number"){const e=Z(t,Math.min(o,A));v({selectedIndex:e===d?0:e,type:"set"})}},[o,t,A]);const U=H((e,i)=>{const s=S(t,c,e,l);if(i===d){const x=E(s,0,-1);if(x===d)return;v({rotateIndex:e,selectedIndex:x,type:"navigate"}),typeof f=="function"&&f(s[x],x);return}const h=(c?l:t.length)-1,a=i===0,m=a?h:i-1,p=a&&c?e+1:e,g=S(t,c,p,l),I=y(g[m])?E(g,m,-1):m;I!==d&&(v({rotateIndex:p,selectedIndex:I,type:"navigate"}),typeof f=="function"&&f(g[I],I))},[c,l,t,f]),V=H((e,i)=>{const s=S(t,c,e,l);if(i===d){const x=E(s,s.length-1,1);if(x===d)return;v({rotateIndex:e,selectedIndex:x,type:"navigate"}),typeof f=="function"&&f(s[x],x);return}const h=(c?l:t.length)-1,a=i===h,m=a?0:i+1,p=a&&c?e-1:e,g=S(t,c,p,l),I=y(g[m])?E(g,m,1):m;I!==d&&(v({rotateIndex:p,selectedIndex:I,type:"navigate"}),typeof f=="function"&&f(g[I],I))},[c,l,t,f]);ne(H((e,i)=>{const{rotateIndex:s,selectedIndex:h}=P.current;if((e==="k"||i.upArrow)&&U(s,h),(e==="j"||i.downArrow)&&V(s,h),de.test(e)){const a=Number.parseInt(e,10)-1,m=S(t,c,s,l);if(a>=0&&a<m.length){const p=m[a];p&&!y(p)&&(j.current?.(p),p.action?.())}}if(i.return&&h!==d){const a=S(t,c,s,l)[h];a&&!y(a)&&(j.current?.(a),a.action?.())}},[U,V,c,l,t]),{isActive:C});const _=S(t,c,F.rotateIndex,l);return k(q,{flexDirection:"column",children:_.map((e,i)=>{if(y(e))return k(q,{children:k(te,{dimColor:!0,children:e.label??le})},e.key??`separator-${String(i)}`);const s=i===F.selectedIndex;return $(q,{children:[Y(u,{accentColor:n,isFocused:C,isSelected:s}),Y(Q,{...e,accentColor:n,defaultColor:r,isFocused:C,isSelected:s})]},e.key??String(e.value))})})}export{ve as SelectInput,ve as default};
@@ -0,0 +1,47 @@
1
+ import { AnsiColors } from '@visulima/colorize';
2
+ import { ReactElement } from 'react';
3
+ import { LiteralUnion } from 'type-fest';
4
+ type Props = {
5
+ /**
6
+ * Width of the highlighted band in characters.
7
+ * @default 3
8
+ */
9
+ readonly bandWidth?: number;
10
+ /**
11
+ * Base color of the non-highlighted text.
12
+ */
13
+ readonly color?: LiteralUnion<AnsiColors, string>;
14
+ /**
15
+ * Highlight color of the sweeping band.
16
+ * @default "white"
17
+ */
18
+ readonly highlightColor?: LiteralUnion<AnsiColors, string>;
19
+ /**
20
+ * Milliseconds between frames of the shimmer.
21
+ * @default 60
22
+ */
23
+ readonly interval?: number;
24
+ /**
25
+ * Text to render with a shimmer sweep.
26
+ */
27
+ readonly text: string;
28
+ };
29
+ /**
30
+ * Text with an animated highlight band that sweeps across the characters.
31
+ * Perfect for "generating…" states.
32
+ * @param props Component props.
33
+ * @param props.bandWidth Number of characters in the bright band.
34
+ * @param props.color Color applied to characters outside the band.
35
+ * @param props.highlightColor Color applied to characters inside the band.
36
+ * @param props.interval Milliseconds between frames.
37
+ * @param props.text Content to shimmer.
38
+ * @returns A single `Text` element composed of per-character `Text` children.
39
+ */
40
+ declare function ShimmerText({
41
+ bandWidth,
42
+ color,
43
+ highlightColor,
44
+ interval,
45
+ text
46
+ }: Props): ReactElement;
47
+ export { Props, ShimmerText, type Props as ShimmerTextProps, ShimmerText as default };
@@ -0,0 +1 @@
1
+ import{jsx as i}from"react/jsx-runtime";import n from"@visulima/tui/components/text";import g from"@visulima/tui/hooks/use-animation";import{useMemo as s}from"react";function w({bandWidth:m=3,color:r,highlightColor:d="white",interval:a=60,text:e}){const{frame:p}=g({interval:a}),t=s(()=>[...e],[e]),l=t.length,u=l+m,x=l===0?0:p%u,b=s(()=>t.map((o,h)=>i(n,{color:r,dimColor:r===void 0,children:o},h)),[t,r]);if(l===0)return i(n,{color:r,children:e});const c=[];for(const[o,h]of t.entries()){const f=x-o;if(!(f>=0&&f<m)){c.push(b[o]);continue}c.push(i(n,{bold:!0,color:d,children:h},`band-${o}`))}return i(n,{children:c})}export{w as ShimmerText,w as default};
@@ -0,0 +1,47 @@
1
+ import { AnsiColors } from '@visulima/colorize';
2
+ import { ReactNode, ReactElement } from 'react';
3
+ import { LiteralUnion } from 'type-fest';
4
+ type Props = {
5
+ /**
6
+ * Main content, filling the remaining width.
7
+ */
8
+ readonly children: ReactNode;
9
+ /**
10
+ * Draw a border/rule between the sidebar and the content.
11
+ * @default true
12
+ */
13
+ readonly divider?: boolean;
14
+ /**
15
+ * Color of the divider rule.
16
+ * @default "gray"
17
+ */
18
+ readonly dividerColor?: LiteralUnion<AnsiColors, string>;
19
+ /**
20
+ * Which side the sidebar sits on.
21
+ * @default "left"
22
+ */
23
+ readonly side?: "left" | "right";
24
+ /**
25
+ * Sidebar content.
26
+ */
27
+ readonly sidebar: ReactNode;
28
+ /**
29
+ * Fixed sidebar width in cells.
30
+ * @default 24
31
+ */
32
+ readonly width?: number;
33
+ };
34
+ /**
35
+ * A two-pane layout: a fixed-width sidebar and a flexible content area, with an
36
+ * optional vertical divider rule between them. The sidebar can sit on either
37
+ * side.
38
+ */
39
+ declare function Sidebar({
40
+ children,
41
+ divider,
42
+ dividerColor,
43
+ side,
44
+ sidebar,
45
+ width
46
+ }: Props): ReactElement;
47
+ export { Props, Sidebar, type Props as SidebarProps, Sidebar as default };
@@ -0,0 +1 @@
1
+ import{jsx as t,jsxs as a}from"react/jsx-runtime";import e from"@visulima/tui/components/box";function c({children:l,divider:i=!0,dividerColor:f="gray",side:r="left",sidebar:n,width:s=24}){const d=t(e,{borderBottom:!1,borderColor:f,borderLeft:i&&r==="right",borderRight:i&&r==="left",borderStyle:"single",borderTop:!1,flexShrink:0,paddingX:1,width:s,children:n}),o=t(e,{flexGrow:1,paddingX:1,children:l});return a(e,{flexDirection:"row",children:[r==="left"?d:o,r==="left"?o:d]})}export{c as Sidebar,c as default};
@@ -0,0 +1,103 @@
1
+ import { AnsiColors } from '@visulima/colorize';
2
+ import { ReactElement } from 'react';
3
+ import { LiteralUnion } from 'type-fest';
4
+ type Props = {
5
+ /**
6
+ * Accent color for the filled portion of the track and thumb.
7
+ * @default "green"
8
+ */
9
+ readonly accentColor?: LiteralUnion<AnsiColors, string>;
10
+ /**
11
+ * Color for the empty portion of the track.
12
+ * @default "gray"
13
+ */
14
+ readonly defaultColor?: LiteralUnion<AnsiColors, string>;
15
+ /**
16
+ * Initial value when uncontrolled.
17
+ * @default 0
18
+ */
19
+ readonly defaultValue?: number;
20
+ /**
21
+ * Character used for the empty portion of the track.
22
+ * @default "░"
23
+ */
24
+ readonly emptyCharacter?: string;
25
+ /**
26
+ * Character used for the filled portion of the track.
27
+ * @default "█"
28
+ */
29
+ readonly filledCharacter?: string;
30
+ /**
31
+ * When true, all input is ignored and the slider is dimmed.
32
+ * @default false
33
+ */
34
+ readonly isDisabled?: boolean;
35
+ /**
36
+ * When true, the component responds to keyboard input.
37
+ * @default true
38
+ */
39
+ readonly isFocused?: boolean;
40
+ /**
41
+ * Maximum value.
42
+ * @default 100
43
+ */
44
+ readonly max?: number;
45
+ /**
46
+ * Minimum value.
47
+ * @default 0
48
+ */
49
+ readonly min?: number;
50
+ /**
51
+ * Fires whenever the value changes.
52
+ */
53
+ readonly onChange?: (value: number) => void;
54
+ /**
55
+ * Layout direction of the slider.
56
+ * @default "horizontal"
57
+ */
58
+ readonly orientation?: "horizontal" | "vertical";
59
+ /**
60
+ * Increment size for arrow key presses.
61
+ * @default 1
62
+ */
63
+ readonly step?: number;
64
+ /**
65
+ * Character used to indicate the current position.
66
+ * @default "●"
67
+ */
68
+ readonly thumbCharacter?: string;
69
+ /**
70
+ * Controlled value. When provided, `defaultValue` is ignored.
71
+ */
72
+ readonly value?: number;
73
+ /**
74
+ * Width of the slider track in columns (horizontal) or rows (vertical).
75
+ * @default 20
76
+ */
77
+ readonly width?: number;
78
+ };
79
+ /**
80
+ * A keyboard-driven slider / range input.
81
+ *
82
+ * ```tsx
83
+ * &lt;Slider defaultValue={50} min={0} max={100} onChange={setValue} />
84
+ * ```
85
+ */
86
+ declare function Slider({
87
+ accentColor,
88
+ defaultColor,
89
+ defaultValue,
90
+ emptyCharacter,
91
+ filledCharacter,
92
+ isDisabled,
93
+ isFocused,
94
+ max,
95
+ min,
96
+ onChange,
97
+ orientation,
98
+ step,
99
+ thumbCharacter,
100
+ value: controlledValue,
101
+ width
102
+ }: Props): ReactElement;
103
+ export { Props, Slider, type Props as SliderProps, Slider as default };
package/dist/slider.js ADDED
@@ -0,0 +1 @@
1
+ import{jsx as a,jsxs as U}from"react/jsx-runtime";import A from"@visulima/tui/components/box";import C from"@visulima/tui/components/text";import X from"@visulima/tui/hooks/use-input";import{useState as Y,useRef as I,useCallback as J}from"react";const D=(u,d,v)=>Math.min(v,Math.max(d,u));function $({accentColor:u="green",defaultColor:d="gray",defaultValue:v=0,emptyCharacter:y="░",filledCharacter:j="█",isDisabled:e=!1,isFocused:K=!0,max:z=100,min:F=0,onChange:N,orientation:h="horizontal",step:m=1,thumbCharacter:k="●",value:q,width:L=20}){const o=Math.min(F,z),i=Math.max(F,z),w=q!==void 0,[O,Q]=Y(D(v,o,i)),x=w?D(q,o,i):O,G=I(N);G.current=N;const s=I(x);s.current=x;const n=J(t=>{const r=D(t,o,i);w||Q(r),G.current?.(r)},[o,i,w]),b=m*10,f=i-o,S=J((t,r)=>{const M=h==="horizontal"?r.rightArrow:r.upArrow,p=h==="horizontal"?r.leftArrow:r.downArrow;if(M){n(s.current+m);return}if(p){n(s.current-m);return}if(r.pageUp){n(s.current+b);return}if(r.pageDown){n(s.current-b);return}if(r.home){n(o);return}if(r.end){n(i);return}if(t>="0"&&t<="9"){const R=Number.parseInt(t,10)/10;n(o+f*R)}},[m,b,o,i,f,h,n]);X(S,{isActive:K&&!e});const g=Math.max(1,L),V=f===0?0:(x-o)/f,l=Math.round(V*(g-1));if(h==="vertical"){const t=[];for(let r=g-1;r>=0;r--){const M=r===l,p=r<=l;t.push(a(A,{children:a(C,{color:e?void 0:p?u:d,dimColor:e,children:M?k:p?j:y})},r))}return a(A,{flexDirection:"column",children:t})}let c="";for(let t=0;t<g;t++)t===l?c+=k:t<l?c+=j:c+=y;const W=c.slice(0,l),E=c[l]??"",H=c.slice(l+1);return U(A,{children:[a(C,{color:e?void 0:u,dimColor:e,children:W}),a(C,{bold:!0,color:e?void 0:u,dimColor:e,children:E}),a(C,{color:e?void 0:d,dimColor:e,children:H})]})}export{$ as Slider,$ as default};
@@ -0,0 +1,42 @@
1
+ import { AnsiColors } from '@visulima/colorize';
2
+ import { ReactElement } from 'react';
3
+ import { LiteralUnion } from 'type-fest';
4
+ type Props = {
5
+ /**
6
+ * Color applied to the chart glyphs.
7
+ */
8
+ readonly color?: LiteralUnion<AnsiColors, string>;
9
+ /**
10
+ * Data points to plot. Values may be any real numbers.
11
+ */
12
+ readonly data: ReadonlyArray<number>;
13
+ /**
14
+ * Render with shade glyphs (`░▒▓█`) instead of vertical bars, for a
15
+ * textured, monochrome-friendly look.
16
+ * @default false
17
+ */
18
+ readonly dither?: boolean;
19
+ /**
20
+ * Optional fixed maximum for the vertical scale.
21
+ * When omitted the maximum data value is used.
22
+ */
23
+ readonly max?: number;
24
+ /**
25
+ * Optional fixed minimum for the vertical scale.
26
+ * When omitted the minimum data value is used.
27
+ */
28
+ readonly min?: number;
29
+ };
30
+ /**
31
+ * Inline bar chart using Unicode block glyphs.
32
+ * @returns A `ReactElement` containing the glyph string, or `null` when
33
+ * `data` is empty.
34
+ */
35
+ declare function Sparkline({
36
+ color,
37
+ data,
38
+ dither,
39
+ max,
40
+ min
41
+ }: Props): ReactElement | null;
42
+ export { Props, Sparkline, type Props as SparklineProps, Sparkline as default };
@@ -0,0 +1 @@
1
+ import{jsx as s}from"react/jsx-runtime";import c from"@visulima/tui/components/text";import{useMemo as d}from"react";const h="▁▂▃▄▅▆▇█",I="░▒▓█",x=(m,o,r,t)=>{if(r===0)return t[0];const i=(m-o)/r,n=Math.max(0,Math.min(t.length-1,Math.floor(i*t.length)));return t[n]},N=(m,o,r)=>{let t=o??Number.POSITIVE_INFINITY,i=r??Number.NEGATIVE_INFINITY;if(o===void 0||r===void 0)for(const n of m)o===void 0&&n<t&&(t=n),r===void 0&&n>i&&(i=n);return{max:i,min:t}};function M({color:m,data:o,dither:r=!1,max:t,min:i}){const n=d(()=>{if(o.length===0)return"";const{max:e,min:a}=N(o,i,t),l=e-a,u=r?I:h;return o.map(f=>x(f,a,l,u)).join("")},[o,r,i,t]);return n.length===0?null:s(c,{color:m,children:n})}export{M as Sparkline,M as default};
@@ -0,0 +1,17 @@
1
+ import { SpinnerName } from '@visulima/spinner';
2
+ import { ReactElement } from 'react';
3
+ type Props = {
4
+ /**
5
+ * Type of a spinner.
6
+ * Accepts any preset from `@visulima/spinner` (cli-spinners + custom frame sets).
7
+ * @default "dots"
8
+ */
9
+ readonly type?: SpinnerName;
10
+ };
11
+ /**
12
+ * Spinner component that renders an animated loading indicator.
13
+ */
14
+ declare function Spinner({
15
+ type
16
+ }: Props): ReactElement;
17
+ export { Props, Spinner, type Props as SpinnerProps, Spinner as default };
@@ -0,0 +1 @@
1
+ import{jsx as i}from"react/jsx-runtime";import{getSpinner as e}from"@visulima/spinner";import m from"@visulima/tui/components/text";import p from"@visulima/tui/hooks/use-animation";function d({type:n="dots"}){const r=e(n)??e("dots"),t=r?.frames??[" "],{frame:o}=p({interval:r?.interval??80});return i(m,{children:t[o%t.length]})}export{d as Spinner,d as default};
@@ -0,0 +1,37 @@
1
+ import { AnsiColors } from '@visulima/colorize';
2
+ import { ReactNode, ReactElement } from 'react';
3
+ import { LiteralUnion } from 'type-fest';
4
+ type Props = {
5
+ /**
6
+ * Background color spanning the whole row.
7
+ */
8
+ readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
9
+ /**
10
+ * Content rendered in the center. Optional.
11
+ */
12
+ readonly center?: ReactNode;
13
+ /**
14
+ * Default foreground for text rendered inside the row.
15
+ */
16
+ readonly color?: LiteralUnion<AnsiColors, string>;
17
+ /**
18
+ * Content rendered flush-left.
19
+ */
20
+ readonly left?: ReactNode;
21
+ /**
22
+ * Content rendered flush-right.
23
+ */
24
+ readonly right?: ReactNode;
25
+ };
26
+ /**
27
+ * Full-width status bar with left / center / right slots. Typically pinned to
28
+ * the bottom of the UI.
29
+ */
30
+ declare function StatusLine({
31
+ backgroundColor,
32
+ center,
33
+ color,
34
+ left,
35
+ right
36
+ }: Props): ReactElement;
37
+ export { Props, StatusLine, type Props as StatusLineProps, StatusLine as default };
@@ -0,0 +1 @@
1
+ import{jsxs as l,jsx as t}from"react/jsx-runtime";import o from"@visulima/tui/components/box";import c from"@visulima/tui/components/text";const e=(r,i)=>{if(r!==void 0)return typeof r=="string"||typeof r=="number"?t(c,{color:i,children:r}):r};function x({backgroundColor:r,center:i,color:n,left:d,right:f}){return l(o,{backgroundColor:r,paddingX:1,width:"100%",children:[t(o,{flexGrow:1,flexShrink:1,minWidth:0,children:e(d,n)}),i===void 0?void 0:t(o,{flexGrow:0,flexShrink:0,justifyContent:"center",children:e(i,n)}),t(o,{flexGrow:1,flexShrink:1,justifyContent:"flex-end",minWidth:0,children:e(f,n)})]})}export{x as StatusLine,x as default};
@@ -0,0 +1,21 @@
1
+ import { ReactNode, ReactElement } from 'react';
2
+ import { V as Variant } from "./packem_shared/variant-config.d-D5NnrrQK.js";
3
+ type StatusMessageVariant = Variant;
4
+ type Props = {
5
+ /**
6
+ * Message content.
7
+ */
8
+ readonly children: ReactNode;
9
+ /**
10
+ * Determines the icon and color of the status message.
11
+ */
12
+ readonly variant: StatusMessageVariant;
13
+ };
14
+ /**
15
+ * Renders a status notification with a colored icon and message text.
16
+ */
17
+ declare function StatusMessage({
18
+ children,
19
+ variant
20
+ }: Props): ReactElement;
21
+ export { Props, StatusMessage, type Props as StatusMessageProps, StatusMessageVariant, StatusMessage as default };
@@ -0,0 +1 @@
1
+ import{jsxs as a,jsx as o}from"react/jsx-runtime";import c from"@visulima/tui/components/box";import r from"@visulima/tui/components/text";import{o as e}from"./packem_shared/variant-config-BJqpNo7H.js";function d({children:i,variant:t}){const{color:s,icon:n}=e[t];return a(c,{gap:1,children:[o(r,{color:s,children:n}),o(r,{children:i})]})}export{d as StatusMessage,d as default};