velvetkit 0.2.2 → 0.4.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 (458) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +80 -0
  3. data/README.md +30 -8
  4. data/lib/generators/velvetkit/add/add_generator.rb +77 -0
  5. data/lib/generators/velvetkit/helpers.rb +29 -2
  6. data/lib/generators/velvetkit/icons/icons_generator.rb +71 -0
  7. data/lib/generators/velvetkit/install/install_generator.rb +9 -12
  8. data/lib/velvetkit/icons.rb +148 -0
  9. data/lib/velvetkit/registry.rb +5 -2
  10. data/lib/velvetkit/version.rb +4 -1
  11. data/lib/velvetkit.rb +8 -0
  12. data/registry/app/assets/tailwind/velvetkit.css +90 -155
  13. data/registry/app/components/ui/alert.rb +1 -1
  14. data/registry/app/components/ui/chart.html.erb +47 -0
  15. data/registry/app/components/ui/chart.rb +177 -0
  16. data/registry/app/components/ui/command/group.rb +27 -0
  17. data/registry/app/components/ui/command/item.rb +64 -0
  18. data/registry/app/components/ui/command.html.erb +41 -0
  19. data/registry/app/components/ui/command.rb +122 -0
  20. data/registry/app/components/ui/confirm_dialog.html.erb +13 -0
  21. data/registry/app/components/ui/confirm_dialog.rb +55 -0
  22. data/registry/app/components/ui/date_picker.html.erb +58 -64
  23. data/registry/app/components/ui/date_picker.rb +199 -75
  24. data/registry/app/components/ui/empty_state.html.erb +20 -0
  25. data/registry/app/components/ui/empty_state.rb +46 -0
  26. data/registry/app/components/ui/file_field.html.erb +14 -4
  27. data/registry/app/components/ui/file_field.rb +179 -28
  28. data/registry/app/components/ui/gallery/image.rb +20 -0
  29. data/registry/app/components/ui/gallery.html.erb +52 -0
  30. data/registry/app/components/ui/gallery.rb +164 -0
  31. data/registry/app/components/ui/icon.html.erb +1 -1
  32. data/registry/app/components/ui/icon.rb +80 -8
  33. data/registry/app/components/ui/kbd.html.erb +27 -0
  34. data/registry/app/components/ui/kbd.rb +134 -0
  35. data/registry/app/components/ui/number_input.html.erb +11 -0
  36. data/registry/app/components/ui/number_input.rb +103 -0
  37. data/registry/app/components/ui/password_input.html.erb +1 -1
  38. data/registry/app/components/ui/progress/segment.rb +25 -0
  39. data/registry/app/components/ui/progress.html.erb +25 -0
  40. data/registry/app/components/ui/progress.rb +182 -0
  41. data/registry/app/components/ui/select.html.erb +24 -5
  42. data/registry/app/components/ui/select.rb +44 -5
  43. data/registry/app/components/ui/stepper/step.html.erb +27 -0
  44. data/registry/app/components/ui/stepper/step.rb +213 -0
  45. data/registry/app/components/ui/stepper.html.erb +19 -0
  46. data/registry/app/components/ui/stepper.rb +145 -0
  47. data/registry/app/components/ui/theme_toggle.rb +2 -4
  48. data/registry/app/components/ui/timeline/item.html.erb +21 -0
  49. data/registry/app/components/ui/timeline/item.rb +145 -0
  50. data/registry/app/components/ui/timeline.html.erb +1 -0
  51. data/registry/app/components/ui/timeline.rb +42 -0
  52. data/registry/app/components/ui/toast.rb +6 -6
  53. data/registry/app/components/ui/toggle_group/item.html.erb +1 -0
  54. data/registry/app/components/ui/toggle_group/item.rb +85 -0
  55. data/registry/app/components/ui/toggle_group.html.erb +1 -0
  56. data/registry/app/components/ui/toggle_group.rb +79 -0
  57. data/registry/app/javascript/chart_js.ts +37 -0
  58. data/registry/app/javascript/controllers/ui/_internal/date_format.ts +74 -0
  59. data/registry/app/javascript/controllers/ui/_internal/shortcut.ts +80 -0
  60. data/registry/app/javascript/controllers/ui/chart_controller.ts +585 -0
  61. data/registry/app/javascript/controllers/ui/command_controller.ts +454 -0
  62. data/registry/app/javascript/controllers/ui/confirm_dialog_controller.ts +110 -0
  63. data/registry/app/javascript/controllers/ui/date_picker_controller.ts +247 -82
  64. data/registry/app/javascript/controllers/ui/file_field_controller.ts +288 -16
  65. data/registry/app/javascript/controllers/ui/gallery_controller.ts +568 -0
  66. data/registry/app/javascript/controllers/ui/kbd_controller.ts +60 -0
  67. data/registry/app/javascript/controllers/ui/number_input_controller.ts +111 -0
  68. data/registry/app/javascript/controllers/ui/progress_controller.ts +87 -0
  69. data/registry/app/javascript/controllers/ui/select_controller.ts +198 -8
  70. data/registry/app/javascript/controllers/ui/stepper_controller.ts +187 -0
  71. data/registry/app/javascript/vanilla_calendar.ts +15 -0
  72. data/registry/components.yml +28 -5
  73. data/registry/config/locales/velvetkit.en.yml +84 -0
  74. data/registry/docs/agents.md +7 -4
  75. data/registry/icons/lucide/LICENSE +39 -0
  76. data/registry/icons/lucide/align-center.svg +17 -0
  77. data/registry/icons/lucide/align-left.svg +17 -0
  78. data/registry/icons/lucide/align-right.svg +17 -0
  79. data/registry/icons/lucide/arrow-left.svg +16 -0
  80. data/registry/icons/lucide/arrow-right.svg +16 -0
  81. data/registry/icons/lucide/badge-check.svg +16 -0
  82. data/registry/icons/lucide/bar-chart-3.svg +18 -0
  83. data/registry/icons/lucide/bell.svg +16 -0
  84. data/registry/icons/lucide/bold.svg +15 -0
  85. data/registry/icons/lucide/book-open.svg +16 -0
  86. data/registry/icons/lucide/calendar.svg +18 -0
  87. data/registry/icons/lucide/chart-column.svg +18 -0
  88. data/registry/icons/lucide/check.svg +15 -0
  89. data/registry/icons/lucide/chevron-down.svg +15 -0
  90. data/registry/icons/lucide/chevron-left.svg +15 -0
  91. data/registry/icons/lucide/chevron-right.svg +15 -0
  92. data/registry/icons/lucide/chevrons-up-down.svg +16 -0
  93. data/registry/icons/lucide/circle-alert.svg +17 -0
  94. data/registry/icons/lucide/circle-check.svg +16 -0
  95. data/registry/icons/lucide/cloud.svg +15 -0
  96. data/registry/icons/lucide/credit-card.svg +16 -0
  97. data/registry/icons/lucide/download.svg +17 -0
  98. data/registry/icons/lucide/ellipsis-vertical.svg +17 -0
  99. data/registry/icons/lucide/ellipsis.svg +17 -0
  100. data/registry/icons/lucide/eye-off.svg +18 -0
  101. data/registry/icons/lucide/eye.svg +16 -0
  102. data/registry/icons/lucide/file-plus.svg +18 -0
  103. data/registry/icons/lucide/file-text.svg +19 -0
  104. data/registry/icons/lucide/file.svg +16 -0
  105. data/registry/icons/lucide/folder-kanban.svg +18 -0
  106. data/registry/icons/lucide/folder.svg +15 -0
  107. data/registry/icons/lucide/git-branch.svg +18 -0
  108. data/registry/icons/lucide/globe.svg +17 -0
  109. data/registry/icons/lucide/graduation-cap.svg +17 -0
  110. data/registry/icons/lucide/grip-vertical.svg +20 -0
  111. data/registry/icons/lucide/home.svg +16 -0
  112. data/registry/icons/lucide/inbox.svg +16 -0
  113. data/registry/icons/lucide/info.svg +17 -0
  114. data/registry/icons/lucide/italic.svg +17 -0
  115. data/registry/icons/lucide/keyboard.svg +23 -0
  116. data/registry/icons/lucide/layout-dashboard.svg +18 -0
  117. data/registry/icons/lucide/layout-grid.svg +18 -0
  118. data/registry/icons/lucide/life-buoy.svg +20 -0
  119. data/registry/icons/lucide/list.svg +20 -0
  120. data/registry/icons/lucide/loader.svg +22 -0
  121. data/registry/icons/lucide/lock.svg +16 -0
  122. data/registry/icons/lucide/log-out.svg +17 -0
  123. data/registry/icons/lucide/mail.svg +16 -0
  124. data/registry/icons/lucide/menu.svg +17 -0
  125. data/registry/icons/lucide/message-circle.svg +15 -0
  126. data/registry/icons/lucide/minus.svg +15 -0
  127. data/registry/icons/lucide/monitor.svg +17 -0
  128. data/registry/icons/lucide/moon.svg +15 -0
  129. data/registry/icons/lucide/newspaper.svg +18 -0
  130. data/registry/icons/lucide/package.svg +18 -0
  131. data/registry/icons/lucide/panel-left.svg +16 -0
  132. data/registry/icons/lucide/pause.svg +16 -0
  133. data/registry/icons/lucide/percent.svg +17 -0
  134. data/registry/icons/lucide/plus.svg +16 -0
  135. data/registry/icons/lucide/printer.svg +17 -0
  136. data/registry/icons/lucide/qr-code.svg +26 -0
  137. data/registry/icons/lucide/receipt.svg +17 -0
  138. data/registry/icons/lucide/rocket.svg +18 -0
  139. data/registry/icons/lucide/rotate-cw.svg +16 -0
  140. data/registry/icons/lucide/search.svg +16 -0
  141. data/registry/icons/lucide/settings.svg +16 -0
  142. data/registry/icons/lucide/shield-check.svg +16 -0
  143. data/registry/icons/lucide/shield.svg +15 -0
  144. data/registry/icons/lucide/store.svg +17 -0
  145. data/registry/icons/lucide/sun-moon.svg +19 -0
  146. data/registry/icons/lucide/sun.svg +23 -0
  147. data/registry/icons/lucide/trash-2.svg +19 -0
  148. data/registry/icons/lucide/truck.svg +19 -0
  149. data/registry/icons/lucide/underline.svg +16 -0
  150. data/registry/icons/lucide/upload.svg +17 -0
  151. data/registry/icons/lucide/user-plus.svg +18 -0
  152. data/registry/icons/lucide/user.svg +16 -0
  153. data/registry/icons/lucide/users.svg +18 -0
  154. data/registry/icons/lucide/workflow.svg +17 -0
  155. data/registry/icons/lucide/x.svg +16 -0
  156. data/registry/icons/lucide/zoom-in.svg +18 -0
  157. data/registry/icons/lucide/zoom-out.svg +17 -0
  158. data/registry/icons/phosphor/LICENSE +21 -0
  159. data/registry/icons/phosphor/arrow-clockwise.svg +2 -0
  160. data/registry/icons/phosphor/arrow-left.svg +2 -0
  161. data/registry/icons/phosphor/arrow-right.svg +2 -0
  162. data/registry/icons/phosphor/bell.svg +2 -0
  163. data/registry/icons/phosphor/book-open.svg +2 -0
  164. data/registry/icons/phosphor/calendar-blank.svg +2 -0
  165. data/registry/icons/phosphor/caret-down.svg +2 -0
  166. data/registry/icons/phosphor/caret-left.svg +2 -0
  167. data/registry/icons/phosphor/caret-right.svg +2 -0
  168. data/registry/icons/phosphor/caret-up-down.svg +2 -0
  169. data/registry/icons/phosphor/chart-bar.svg +2 -0
  170. data/registry/icons/phosphor/chat-circle.svg +2 -0
  171. data/registry/icons/phosphor/check-circle.svg +2 -0
  172. data/registry/icons/phosphor/check.svg +2 -0
  173. data/registry/icons/phosphor/circle-half.svg +2 -0
  174. data/registry/icons/phosphor/cloud.svg +2 -0
  175. data/registry/icons/phosphor/credit-card.svg +2 -0
  176. data/registry/icons/phosphor/desktop.svg +2 -0
  177. data/registry/icons/phosphor/dots-six-vertical.svg +2 -0
  178. data/registry/icons/phosphor/dots-three-vertical.svg +2 -0
  179. data/registry/icons/phosphor/dots-three.svg +2 -0
  180. data/registry/icons/phosphor/download-simple.svg +2 -0
  181. data/registry/icons/phosphor/envelope.svg +2 -0
  182. data/registry/icons/phosphor/eye-slash.svg +2 -0
  183. data/registry/icons/phosphor/eye.svg +2 -0
  184. data/registry/icons/phosphor/file-plus.svg +2 -0
  185. data/registry/icons/phosphor/file-text.svg +2 -0
  186. data/registry/icons/phosphor/file.svg +2 -0
  187. data/registry/icons/phosphor/flow-arrow.svg +2 -0
  188. data/registry/icons/phosphor/folder.svg +2 -0
  189. data/registry/icons/phosphor/gear.svg +2 -0
  190. data/registry/icons/phosphor/git-branch.svg +2 -0
  191. data/registry/icons/phosphor/globe.svg +2 -0
  192. data/registry/icons/phosphor/graduation-cap.svg +2 -0
  193. data/registry/icons/phosphor/grid-four.svg +2 -0
  194. data/registry/icons/phosphor/house.svg +2 -0
  195. data/registry/icons/phosphor/info.svg +2 -0
  196. data/registry/icons/phosphor/kanban.svg +2 -0
  197. data/registry/icons/phosphor/keyboard.svg +2 -0
  198. data/registry/icons/phosphor/lifebuoy.svg +2 -0
  199. data/registry/icons/phosphor/list.svg +2 -0
  200. data/registry/icons/phosphor/lock.svg +2 -0
  201. data/registry/icons/phosphor/magnifying-glass-minus.svg +2 -0
  202. data/registry/icons/phosphor/magnifying-glass-plus.svg +2 -0
  203. data/registry/icons/phosphor/magnifying-glass.svg +2 -0
  204. data/registry/icons/phosphor/minus.svg +2 -0
  205. data/registry/icons/phosphor/moon.svg +2 -0
  206. data/registry/icons/phosphor/newspaper.svg +2 -0
  207. data/registry/icons/phosphor/package.svg +2 -0
  208. data/registry/icons/phosphor/pause.svg +2 -0
  209. data/registry/icons/phosphor/percent.svg +2 -0
  210. data/registry/icons/phosphor/plus.svg +2 -0
  211. data/registry/icons/phosphor/printer.svg +2 -0
  212. data/registry/icons/phosphor/qr-code.svg +2 -0
  213. data/registry/icons/phosphor/receipt.svg +2 -0
  214. data/registry/icons/phosphor/rocket.svg +2 -0
  215. data/registry/icons/phosphor/seal-check.svg +2 -0
  216. data/registry/icons/phosphor/shield-check.svg +2 -0
  217. data/registry/icons/phosphor/shield.svg +2 -0
  218. data/registry/icons/phosphor/sidebar.svg +2 -0
  219. data/registry/icons/phosphor/sign-out.svg +2 -0
  220. data/registry/icons/phosphor/spinner.svg +2 -0
  221. data/registry/icons/phosphor/squares-four.svg +2 -0
  222. data/registry/icons/phosphor/storefront.svg +2 -0
  223. data/registry/icons/phosphor/sun.svg +2 -0
  224. data/registry/icons/phosphor/text-align-center.svg +2 -0
  225. data/registry/icons/phosphor/text-align-left.svg +2 -0
  226. data/registry/icons/phosphor/text-align-right.svg +2 -0
  227. data/registry/icons/phosphor/text-b.svg +2 -0
  228. data/registry/icons/phosphor/text-italic.svg +2 -0
  229. data/registry/icons/phosphor/text-underline.svg +2 -0
  230. data/registry/icons/phosphor/trash.svg +2 -0
  231. data/registry/icons/phosphor/tray.svg +2 -0
  232. data/registry/icons/phosphor/truck.svg +2 -0
  233. data/registry/icons/phosphor/upload-simple.svg +2 -0
  234. data/registry/icons/phosphor/user-plus.svg +2 -0
  235. data/registry/icons/phosphor/user.svg +2 -0
  236. data/registry/icons/phosphor/users.svg +2 -0
  237. data/registry/icons/phosphor/warning-circle.svg +2 -0
  238. data/registry/icons/phosphor/x.svg +2 -0
  239. data/registry/icons/tabler/LICENSE +21 -0
  240. data/registry/icons/tabler/alert-circle.svg +18 -0
  241. data/registry/icons/tabler/align-center.svg +18 -0
  242. data/registry/icons/tabler/align-left.svg +18 -0
  243. data/registry/icons/tabler/align-right.svg +18 -0
  244. data/registry/icons/tabler/arrow-left.svg +18 -0
  245. data/registry/icons/tabler/arrow-right.svg +18 -0
  246. data/registry/icons/tabler/bell.svg +17 -0
  247. data/registry/icons/tabler/bold.svg +17 -0
  248. data/registry/icons/tabler/book.svg +20 -0
  249. data/registry/icons/tabler/building-store.svg +20 -0
  250. data/registry/icons/tabler/calendar.svg +21 -0
  251. data/registry/icons/tabler/chart-bar.svg +19 -0
  252. data/registry/icons/tabler/check.svg +16 -0
  253. data/registry/icons/tabler/chevron-down.svg +16 -0
  254. data/registry/icons/tabler/chevron-left.svg +16 -0
  255. data/registry/icons/tabler/chevron-right.svg +16 -0
  256. data/registry/icons/tabler/circle-check.svg +17 -0
  257. data/registry/icons/tabler/cloud.svg +16 -0
  258. data/registry/icons/tabler/credit-card.svg +19 -0
  259. data/registry/icons/tabler/device-desktop.svg +19 -0
  260. data/registry/icons/tabler/dots-vertical.svg +18 -0
  261. data/registry/icons/tabler/dots.svg +18 -0
  262. data/registry/icons/tabler/download.svg +18 -0
  263. data/registry/icons/tabler/eye-off.svg +18 -0
  264. data/registry/icons/tabler/eye.svg +17 -0
  265. data/registry/icons/tabler/file-plus.svg +19 -0
  266. data/registry/icons/tabler/file-text.svg +20 -0
  267. data/registry/icons/tabler/file.svg +17 -0
  268. data/registry/icons/tabler/folder.svg +16 -0
  269. data/registry/icons/tabler/git-branch.svg +21 -0
  270. data/registry/icons/tabler/grip-vertical.svg +21 -0
  271. data/registry/icons/tabler/home.svg +18 -0
  272. data/registry/icons/tabler/inbox.svg +17 -0
  273. data/registry/icons/tabler/info-circle.svg +18 -0
  274. data/registry/icons/tabler/italic.svg +18 -0
  275. data/registry/icons/tabler/keyboard.svg +23 -0
  276. data/registry/icons/tabler/layout-dashboard.svg +19 -0
  277. data/registry/icons/tabler/layout-grid.svg +19 -0
  278. data/registry/icons/tabler/layout-kanban.svg +19 -0
  279. data/registry/icons/tabler/layout-sidebar.svg +17 -0
  280. data/registry/icons/tabler/lifebuoy.svg +21 -0
  281. data/registry/icons/tabler/list.svg +21 -0
  282. data/registry/icons/tabler/loader.svg +23 -0
  283. data/registry/icons/tabler/lock.svg +18 -0
  284. data/registry/icons/tabler/logout.svg +18 -0
  285. data/registry/icons/tabler/mail.svg +17 -0
  286. data/registry/icons/tabler/menu-2.svg +18 -0
  287. data/registry/icons/tabler/message-circle.svg +16 -0
  288. data/registry/icons/tabler/minus.svg +16 -0
  289. data/registry/icons/tabler/moon.svg +16 -0
  290. data/registry/icons/tabler/news.svg +19 -0
  291. data/registry/icons/tabler/package.svg +20 -0
  292. data/registry/icons/tabler/percentage.svg +18 -0
  293. data/registry/icons/tabler/player-pause.svg +17 -0
  294. data/registry/icons/tabler/plus.svg +17 -0
  295. data/registry/icons/tabler/printer.svg +18 -0
  296. data/registry/icons/tabler/qrcode.svg +27 -0
  297. data/registry/icons/tabler/receipt.svg +16 -0
  298. data/registry/icons/tabler/rocket.svg +18 -0
  299. data/registry/icons/tabler/rosette-discount-check.svg +17 -0
  300. data/registry/icons/tabler/rotate-clockwise.svg +16 -0
  301. data/registry/icons/tabler/school.svg +17 -0
  302. data/registry/icons/tabler/search.svg +17 -0
  303. data/registry/icons/tabler/selector.svg +17 -0
  304. data/registry/icons/tabler/settings.svg +17 -0
  305. data/registry/icons/tabler/shield-check.svg +17 -0
  306. data/registry/icons/tabler/shield.svg +16 -0
  307. data/registry/icons/tabler/sitemap.svg +20 -0
  308. data/registry/icons/tabler/sun-moon.svg +21 -0
  309. data/registry/icons/tabler/sun.svg +17 -0
  310. data/registry/icons/tabler/trash.svg +20 -0
  311. data/registry/icons/tabler/truck.svg +18 -0
  312. data/registry/icons/tabler/underline.svg +17 -0
  313. data/registry/icons/tabler/upload.svg +18 -0
  314. data/registry/icons/tabler/user-plus.svg +19 -0
  315. data/registry/icons/tabler/user.svg +17 -0
  316. data/registry/icons/tabler/users.svg +19 -0
  317. data/registry/icons/tabler/world.svg +20 -0
  318. data/registry/icons/tabler/x.svg +17 -0
  319. data/registry/icons/tabler/zoom-in.svg +19 -0
  320. data/registry/icons/tabler/zoom-out.svg +18 -0
  321. data/registry/icons.yml +90 -0
  322. data/registry/test/components/previews/ui/chart_preview/cash_flow.html.erb +6 -0
  323. data/registry/test/components/previews/ui/chart_preview/donut.html.erb +6 -0
  324. data/registry/test/components/previews/ui/chart_preview/margin.html.erb +6 -0
  325. data/registry/test/components/previews/ui/chart_preview/pie.html.erb +6 -0
  326. data/registry/test/components/previews/ui/chart_preview/sales.html.erb +6 -0
  327. data/registry/test/components/previews/ui/chart_preview/stock.html.erb +6 -0
  328. data/registry/test/components/previews/ui/chart_preview/takings.html.erb +8 -0
  329. data/registry/test/components/previews/ui/chart_preview.rb +46 -0
  330. data/registry/test/components/previews/ui/command_preview/_picked.html.erb +14 -0
  331. data/registry/test/components/previews/ui/command_preview/dialog.html.erb +24 -0
  332. data/registry/test/components/previews/ui/command_preview/inline.html.erb +16 -0
  333. data/registry/test/components/previews/ui/command_preview/playground.html.erb +15 -0
  334. data/registry/test/components/previews/ui/command_preview/server_search.html.erb +24 -0
  335. data/registry/test/components/previews/ui/command_preview/shortcuts.html.erb +12 -0
  336. data/registry/test/components/previews/ui/command_preview/till.html.erb +17 -0
  337. data/registry/test/components/previews/ui/command_preview.rb +25 -0
  338. data/registry/test/components/previews/ui/confirm_dialog_preview/destructive.html.erb +7 -0
  339. data/registry/test/components/previews/ui/confirm_dialog_preview/in_form.html.erb +6 -0
  340. data/registry/test/components/previews/ui/confirm_dialog_preview/on_link.html.erb +5 -0
  341. data/registry/test/components/previews/ui/confirm_dialog_preview/plain.html.erb +3 -0
  342. data/registry/test/components/previews/ui/confirm_dialog_preview/with_description.html.erb +4 -0
  343. data/registry/test/components/previews/ui/confirm_dialog_preview.rb +20 -0
  344. data/registry/test/components/previews/ui/date_picker_preview/custom_presets.html.erb +6 -0
  345. data/registry/test/components/previews/ui/date_picker_preview/in_form.html.erb +11 -0
  346. data/registry/test/components/previews/ui/date_picker_preview/range.html.erb +5 -0
  347. data/registry/test/components/previews/ui/date_picker_preview/states.html.erb +4 -3
  348. data/registry/test/components/previews/ui/date_picker_preview.rb +26 -6
  349. data/registry/test/components/previews/ui/empty_state_preview/in_card.html.erb +7 -0
  350. data/registry/test/components/previews/ui/empty_state_preview/no_results.html.erb +3 -0
  351. data/registry/test/components/previews/ui/empty_state_preview/outline.html.erb +3 -0
  352. data/registry/test/components/previews/ui/empty_state_preview/with_actions.html.erb +4 -0
  353. data/registry/test/components/previews/ui/empty_state_preview/with_media.html.erb +8 -0
  354. data/registry/test/components/previews/ui/empty_state_preview.rb +26 -0
  355. data/registry/test/components/previews/ui/file_field_preview/multiple_files.html.erb +1 -1
  356. data/registry/test/components/previews/ui/file_field_preview/product_photos.html.erb +12 -0
  357. data/registry/test/components/previews/ui/file_field_preview/single_image.html.erb +4 -0
  358. data/registry/test/components/previews/ui/file_field_preview.rb +32 -5
  359. data/registry/test/components/previews/ui/gallery_preview/hover_zoom.html.erb +13 -0
  360. data/registry/test/components/previews/ui/gallery_preview/landscape.html.erb +5 -0
  361. data/registry/test/components/previews/ui/gallery_preview/product_page.html.erb +13 -0
  362. data/registry/test/components/previews/ui/gallery_preview/single.html.erb +3 -0
  363. data/registry/test/components/previews/ui/gallery_preview.rb +45 -0
  364. data/registry/test/components/previews/ui/icon_preview/common.html.erb +19 -3
  365. data/registry/test/components/previews/ui/icon_preview/labelled.html.erb +4 -0
  366. data/registry/test/components/previews/ui/icon_preview/missing.html.erb +3 -0
  367. data/registry/test/components/previews/ui/icon_preview.rb +18 -3
  368. data/registry/test/components/previews/ui/input_group_preview/playground.html.erb +2 -2
  369. data/registry/test/components/previews/ui/input_group_preview.rb +3 -3
  370. data/registry/test/components/previews/ui/kbd_preview/bound.html.erb +20 -0
  371. data/registry/test/components/previews/ui/kbd_preview/keys.html.erb +13 -0
  372. data/registry/test/components/previews/ui/kbd_preview/menu.html.erb +13 -0
  373. data/registry/test/components/previews/ui/kbd_preview/search_field.html.erb +8 -0
  374. data/registry/test/components/previews/ui/kbd_preview/shortcuts_list.html.erb +17 -0
  375. data/registry/test/components/previews/ui/kbd_preview/till.html.erb +23 -0
  376. data/registry/test/components/previews/ui/kbd_preview/tooltip_and_buttons.html.erb +14 -0
  377. data/registry/test/components/previews/ui/kbd_preview.rb +32 -0
  378. data/registry/test/components/previews/ui/number_input_preview/cart.html.erb +11 -0
  379. data/registry/test/components/previews/ui/number_input_preview/decimals.html.erb +4 -0
  380. data/registry/test/components/previews/ui/number_input_preview/sizes.html.erb +5 -0
  381. data/registry/test/components/previews/ui/number_input_preview/states.html.erb +7 -0
  382. data/registry/test/components/previews/ui/number_input_preview/stock_adjustment.html.erb +3 -0
  383. data/registry/test/components/previews/ui/number_input_preview.rb +36 -0
  384. data/registry/test/components/previews/ui/progress_preview/file_upload.html.erb +36 -0
  385. data/registry/test/components/previews/ui/progress_preview/free_shipping.html.erb +4 -0
  386. data/registry/test/components/previews/ui/progress_preview/indeterminate.html.erb +4 -0
  387. data/registry/test/components/previews/ui/progress_preview/sizes_and_tones.html.erb +8 -0
  388. data/registry/test/components/previews/ui/progress_preview/steps.html.erb +9 -0
  389. data/registry/test/components/previews/ui/progress_preview/storage.html.erb +8 -0
  390. data/registry/test/components/previews/ui/progress_preview/storage_by_category.html.erb +7 -0
  391. data/registry/test/components/previews/ui/progress_preview/tasks_by_status.html.erb +14 -0
  392. data/registry/test/components/previews/ui/progress_preview/traffic_by_source.html.erb +15 -0
  393. data/registry/test/components/previews/ui/progress_preview.rb +46 -0
  394. data/registry/test/components/previews/ui/select_preview/server_search.html.erb +22 -0
  395. data/registry/test/components/previews/ui/select_preview.rb +5 -0
  396. data/registry/test/components/previews/ui/stepper_preview/approvals.html.erb +9 -0
  397. data/registry/test/components/previews/ui/stepper_preview/checklist.html.erb +12 -0
  398. data/registry/test/components/previews/ui/stepper_preview/dot_wizard.html.erb +41 -0
  399. data/registry/test/components/previews/ui/stepper_preview/failed_deploy.html.erb +13 -0
  400. data/registry/test/components/previews/ui/stepper_preview/inline.html.erb +31 -0
  401. data/registry/test/components/previews/ui/stepper_preview/onboarding.html.erb +12 -0
  402. data/registry/test/components/previews/ui/stepper_preview/order_tracking.html.erb +10 -0
  403. data/registry/test/components/previews/ui/stepper_preview/price_calculator.html.erb +14 -0
  404. data/registry/test/components/previews/ui/stepper_preview/server_driven.html.erb +20 -0
  405. data/registry/test/components/previews/ui/stepper_preview/sidebar.html.erb +43 -0
  406. data/registry/test/components/previews/ui/stepper_preview/wizard.html.erb +55 -0
  407. data/registry/test/components/previews/ui/stepper_preview.rb +57 -0
  408. data/registry/test/components/previews/ui/timeline_preview/activity_log.html.erb +7 -0
  409. data/registry/test/components/previews/ui/timeline_preview/colored.html.erb +7 -0
  410. data/registry/test/components/previews/ui/timeline_preview/colored_by_meaning.html.erb +7 -0
  411. data/registry/test/components/previews/ui/timeline_preview/failed_delivery.html.erb +6 -0
  412. data/registry/test/components/previews/ui/timeline_preview/order_status.html.erb +9 -0
  413. data/registry/test/components/previews/ui/timeline_preview/real_dates.html.erb +5 -0
  414. data/registry/test/components/previews/ui/timeline_preview/stock_history.html.erb +6 -0
  415. data/registry/test/components/previews/ui/timeline_preview.rb +40 -0
  416. data/registry/test/components/previews/ui/toggle_group_preview/icon_only.html.erb +5 -0
  417. data/registry/test/components/previews/ui/toggle_group_preview/in_form.html.erb +11 -0
  418. data/registry/test/components/previews/ui/toggle_group_preview/multiple.html.erb +5 -0
  419. data/registry/test/components/previews/ui/toggle_group_preview/outline.html.erb +5 -0
  420. data/registry/test/components/previews/ui/toggle_group_preview/sizes.html.erb +9 -0
  421. data/registry/test/components/previews/ui/toggle_group_preview/with_icons.html.erb +5 -0
  422. data/registry/test/components/previews/ui/toggle_group_preview.rb +36 -0
  423. data/registry/test/components/ui/accordion/trigger_test.rb +1 -1
  424. data/registry/test/components/ui/alert_test.rb +10 -10
  425. data/registry/test/components/ui/badge_test.rb +3 -3
  426. data/registry/test/components/ui/banner_test.rb +3 -3
  427. data/registry/test/components/ui/breadcrumb/ellipsis_test.rb +2 -2
  428. data/registry/test/components/ui/button_test.rb +17 -14
  429. data/registry/test/components/ui/button_to_test.rb +2 -2
  430. data/registry/test/components/ui/chart_test.rb +187 -0
  431. data/registry/test/components/ui/checkbox_test.rb +2 -2
  432. data/registry/test/components/ui/command/group_test.rb +19 -0
  433. data/registry/test/components/ui/command/item_test.rb +47 -0
  434. data/registry/test/components/ui/command_test.rb +110 -0
  435. data/registry/test/components/ui/confirm_dialog_test.rb +68 -0
  436. data/registry/test/components/ui/date_picker_test.rb +129 -111
  437. data/registry/test/components/ui/empty_state_test.rb +87 -0
  438. data/registry/test/components/ui/file_field_test.rb +105 -9
  439. data/registry/test/components/ui/gallery_test.rb +192 -0
  440. data/registry/test/components/ui/icon_test.rb +60 -20
  441. data/registry/test/components/ui/input_group_test.rb +1 -1
  442. data/registry/test/components/ui/kbd_test.rb +150 -0
  443. data/registry/test/components/ui/link_test.rb +3 -3
  444. data/registry/test/components/ui/navigation_menu_test.rb +2 -2
  445. data/registry/test/components/ui/number_input_test.rb +155 -0
  446. data/registry/test/components/ui/progress_test.rb +188 -0
  447. data/registry/test/components/ui/select_test.rb +62 -0
  448. data/registry/test/components/ui/session_tabs_test.rb +3 -3
  449. data/registry/test/components/ui/spinner_test.rb +9 -9
  450. data/registry/test/components/ui/stepper_test.rb +239 -0
  451. data/registry/test/components/ui/tabs/trigger_test.rb +2 -2
  452. data/registry/test/components/ui/theme_toggle_test.rb +6 -8
  453. data/registry/test/components/ui/timeline_test.rb +175 -0
  454. data/registry/test/components/ui/toast_test.rb +11 -10
  455. data/registry/test/components/ui/toggle_group_test.rb +162 -0
  456. metadata +399 -3
  457. data/registry/app/javascript/cally.ts +0 -8
  458. data/registry/app/javascript/velvetkit_icons.ts +0 -78
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ class UI::ProgressPreview < ViewComponent::Preview
4
+ # @label Playground
5
+ # @param value number
6
+ # @param max number
7
+ # @param indeterminate toggle "No value: shows work going on, without an amount"
8
+ # @param label text
9
+ # @param show_value toggle
10
+ # @param value_text text "Can use %{value}, %{max} and %{percent}"
11
+ # @param size select { choices: [sm, default, lg] }
12
+ # @param tone select { choices: [default, success, warning, destructive] }
13
+ def playground(value: 40, max: 100, indeterminate: false, label: "Uploading report.pdf", show_value: true,
14
+ value_text: "", size: :default, tone: :default)
15
+ render(UI::Progress.new(value: (value unless indeterminate), max: max, label: label.presence,
16
+ show_value: show_value, value_text: value_text.presence, size: size.to_sym,
17
+ tone: tone.to_sym, class: "max-w-sm"))
18
+ end
19
+
20
+ # @label Sizes and Tones
21
+ def sizes_and_tones; render_with_template; end
22
+
23
+ # @label File Upload, Moving Live
24
+ def file_upload; render_with_template; end
25
+
26
+ # @label Storage Used
27
+ def storage; render_with_template; end
28
+
29
+ # @label Storage by Category
30
+ def storage_by_category; render_with_template; end
31
+
32
+ # @label Tasks by Status
33
+ def tasks_by_status; render_with_template; end
34
+
35
+ # @label Traffic by Source, Shares of a Whole
36
+ def traffic_by_source; render_with_template; end
37
+
38
+ # @label Steps Done
39
+ def steps; render_with_template; end
40
+
41
+ # @label Working, No Amount Yet
42
+ def indeterminate; render_with_template; end
43
+
44
+ # @label Free Shipping Threshold
45
+ def free_shipping; render_with_template; end
46
+ end
@@ -0,0 +1,22 @@
1
+ <%# For lists too long to send to the page. Opening it asks the url for a
2
+ starting list, and typing asks again with ?q=. In a slow search the
3
+ magnifying glass turns into a spinner. The docs site answers /demo/customers;
4
+ point url: at your own endpoint, which can look like this:
5
+
6
+ # config/routes.rb
7
+ get "customers/search", to: "customers#search"
8
+
9
+ # app/controllers/customers_controller.rb
10
+ def search
11
+ query = Customer.sanitize_sql_like(params[:q].to_s)
12
+ customers = Customer.where("name ILIKE ?", "%#{query}%").order(:name).limit(20)
13
+ render json: customers.map { |customer| { value: customer.id, label: customer.name } }
14
+ end
15
+
16
+ On an edit form, pass the current choice as options:, so it's named before
17
+ anything is fetched. %>
18
+ <div class="grid max-w-xl gap-6 sm:grid-cols-2">
19
+ <%= render(UI::Select.new(name: "customer_id", url: "/demo/customers", label: "Customer", prompt: "Find a customer")) %>
20
+ <%= render(UI::Select.new(name: "customer_ids", url: "/demo/customers", label: "Copy invoices to", multiple: true,
21
+ options: [ [ "Aditi Rao Traders", 2001 ] ], selected: [ 2001 ])) %>
22
+ </div>
@@ -38,6 +38,11 @@ class UI::SelectPreview < ViewComponent::Preview
38
38
  render_with_template
39
39
  end
40
40
 
41
+ # @label Searching the Server
42
+ def server_search
43
+ render_with_template
44
+ end
45
+
41
46
  # @label Multiple
42
47
  def multiple
43
48
  render_with_template
@@ -0,0 +1,9 @@
1
+ <%# `status: :loading` for a step that's waiting on someone else. %>
2
+ <div class="w-full max-w-sm">
3
+ <%= render(UI::Stepper.new(orientation: :vertical, current: 3, label: "Leave request approvals")) do |stepper| %>
4
+ <% stepper.with_step(title: "Team lead", description: "Approved by Aditi Rao · 15 Jun 2026") %>
5
+ <% stepper.with_step(title: "Head of department", description: "Approved by Farhan Shah · 15 Jun 2026") %>
6
+ <% stepper.with_step(title: "VP, People", description: "Waiting since 16 Jun 2026", status: :loading) %>
7
+ <% stepper.with_step(title: "Payroll", description: "Updates your leave balance") %>
8
+ <% end %>
9
+ </div>
@@ -0,0 +1,12 @@
1
+ <%# `connector: false` for steps that can be done in any order. Done ones link
2
+ back, so people can change what they set. %>
3
+ <div class="w-full max-w-md rounded-xl border bg-card p-6">
4
+ <h3 class="font-semibold">Set up your store</h3>
5
+ <p class="mb-6 text-sm text-muted-foreground">2 of 4 done</p>
6
+ <%= render(UI::Stepper.new(orientation: :vertical, connector: false, label: "Store setup")) do |stepper| %>
7
+ <% stepper.with_step(title: "Add your first product", description: "Linen shirt, ₹2,400", status: :complete, href: "#") %>
8
+ <% stepper.with_step(title: "Choose a theme", description: "Using Coast", status: :complete, href: "#") %>
9
+ <% stepper.with_step(title: "Set up payments", description: "Connect UPI or a card processor", status: :current, icon: "credit-card") %>
10
+ <% stepper.with_step(title: "Pick a domain", description: "Or keep yourstore.example.com", status: :upcoming, icon: "globe") %>
11
+ <% end %>
12
+ </div>
@@ -0,0 +1,41 @@
1
+ <%# Dots, and `labels: false`: the heading on each panel says where you are. %>
2
+ <div class="w-full max-w-xl rounded-2xl border bg-card p-6 sm:p-8">
3
+ <%= render(UI::Stepper.new(variant: :dot, labels: false, label: "Form your LLC")) do |stepper| %>
4
+ <% stepper.with_step(title: "State") do %>
5
+ <h3 class="text-2xl font-semibold tracking-tight">Choose the state to incorporate your LLC</h3>
6
+ <p class="mt-6 mb-3 text-xs font-medium tracking-wide text-muted-foreground uppercase">Recommended</p>
7
+ <fieldset class="grid gap-3">
8
+ <legend class="sr-only">State</legend>
9
+ <% [["wyoming", "Wyoming", true, "Lower annual costs. No corporate income tax or franchise tax."],
10
+ ["delaware", "Delaware", false, "Strong legal protection for shareholders. Popular with C-corps."]].each do |value, name, recommended, detail| %>
11
+ <label class="flex cursor-pointer flex-col gap-1.5 rounded-lg border p-4 transition-colors hover:bg-accent/50 has-[:checked]:border-primary has-[:checked]:bg-primary/5 has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/40">
12
+ <input type="radio" name="llc[state]" value="<%= value %>" required class="sr-only">
13
+ <span class="flex items-center gap-2 font-medium"><%= name %><% if recommended %><%= render(UI::Badge.new(variant: :outline, size: :sm, class: "border-emerald-300 text-emerald-700 dark:border-emerald-800 dark:text-emerald-300")) { "Recommended" } %><% end %></span>
14
+ <span class="text-sm text-muted-foreground"><%= detail %></span>
15
+ </label>
16
+ <% end %>
17
+ </fieldset>
18
+ <% end %>
19
+ <% stepper.with_step(title: "Name") do %>
20
+ <h3 class="mb-6 text-2xl font-semibold tracking-tight">What's your company called?</h3>
21
+ <%= render(UI::Input.new(label: "Company name", name: "llc[name]", required: true, placeholder: "Northwind Studio", hint: "We'll add “LLC” to the end.")) %>
22
+ <% end %>
23
+ <% stepper.with_step(title: "Members") do %>
24
+ <h3 class="mb-6 text-2xl font-semibold tracking-tight">How many owners?</h3>
25
+ <%= render(UI::Input.new(type: :number, label: "Members", name: "llc[members]", required: true, min: 1, max: 50, value: 1, class: "w-28")) %>
26
+ <% end %>
27
+ <% stepper.with_step(title: "Review") do %>
28
+ <h3 class="mb-2 text-2xl font-semibold tracking-tight">Ready to file</h3>
29
+ <p class="text-sm text-muted-foreground">We'll file with the state today. Most states approve in 3 to 5 business days.</p>
30
+ <% end %>
31
+ <% stepper.with_completion do %>
32
+ <%= render(UI::EmptyState.new(icon: "circle-check", title: "Filed", description: "We'll email you when the state approves it.", class: "md:p-6")) do %>
33
+ <%= render(UI::Button.new(variant: :outline, data: { action: "ui--stepper#reset" })) { "Start over" } %>
34
+ <% end %>
35
+ <% end %>
36
+ <div class="mt-8 flex flex-col gap-2">
37
+ <%= render(UI::Button.new(size: :lg, full_width: true, data: { action: "ui--stepper#next", "ui--stepper-target": "next" })) { "Continue" } %>
38
+ <%= render(UI::Button.new(variant: :ghost, full_width: true, hidden: true, data: { action: "ui--stepper#previous", "ui--stepper-target": "previous" })) { "Back" } %>
39
+ </div>
40
+ <% end %>
41
+ </div>
@@ -0,0 +1,13 @@
1
+ <%# `status: :error` marks the step that failed; the description says why. %>
2
+ <div class="w-full max-w-md">
3
+ <%= render(UI::Stepper.new(orientation: :vertical, current: 2, label: "Deploy a1f9c3e")) do |stepper| %>
4
+ <% stepper.with_step(title: "Build", description: "Finished in 42s") %>
5
+ <% stepper.with_step(title: "Test", description: "3 of 214 tests failed in spec/billing", status: :error) %>
6
+ <% stepper.with_step(title: "Migrate database") %>
7
+ <% stepper.with_step(title: "Release", description: "To production") %>
8
+ <div class="flex gap-2 pl-11">
9
+ <%= render(UI::Button.new(size: :sm)) do |button| %><% button.with_leading_icon(name: "rotate-cw") %>Retry tests<% end %>
10
+ <%= render(UI::Button.new(variant: :outline, size: :sm)) { "View logs" } %>
11
+ </div>
12
+ <% end %>
13
+ </div>
@@ -0,0 +1,31 @@
1
+ <%# `layout: :inline`: each panel opens under its own step, with its own
2
+ button, like a checklist that walks you through. %>
3
+ <div class="w-full max-w-lg">
4
+ <%= render(UI::Stepper.new(orientation: :vertical, layout: :inline, label: "Turn on two-factor")) do |stepper| %>
5
+ <% stepper.with_step(title: "Install an authenticator app", description: "1Password, Authy or Google Authenticator") do %>
6
+ <p class="mb-3 text-sm text-muted-foreground">Any app that makes six-digit codes works.</p>
7
+ <%= render(UI::Button.new(size: :sm, data: { action: "ui--stepper#next" })) { "I have one" } %>
8
+ <% end %>
9
+ <% stepper.with_step(title: "Scan the code", description: "Or type the key by hand") do %>
10
+ <div class="mb-3 flex items-center gap-4">
11
+ <div class="grid size-24 shrink-0 place-items-center rounded-md border bg-muted text-muted-foreground"><%= render(UI::Icon.new(name: "qr-code", size: :xl)) %></div>
12
+ <code class="font-mono text-sm break-all">JBSW Y3DP EHPK 3PXP</code>
13
+ </div>
14
+ <%= render(UI::Button.new(size: :sm, data: { action: "ui--stepper#next" })) { "Next" } %>
15
+ <% end %>
16
+ <% stepper.with_step(title: "Enter a code", description: "To check it's set up") do %>
17
+ <div class="flex items-end gap-2">
18
+ <%= render(UI::Input.new(label: "Six-digit code", name: "otp", required: true, pattern: "[0-9]{6}", inputmode: "numeric",
19
+ autocomplete: "one-time-code", maxlength: 6, placeholder: "123456", class: "w-36 font-mono")) %>
20
+ <%= render(UI::Button.new(data: { action: "ui--stepper#next" })) { "Verify" } %>
21
+ </div>
22
+ <% end %>
23
+ <% stepper.with_completion do %>
24
+ <%= render(UI::Alert.new(variant: :success)) do |alert| %>
25
+ <% alert.with_icon(name: "shield-check") %>
26
+ <% alert.with_title { "Two-factor is on" } %>
27
+ <% alert.with_description { "You'll be asked for a code when you sign in on a new device." } %>
28
+ <% end %>
29
+ <% end %>
30
+ <% end %>
31
+ </div>
@@ -0,0 +1,12 @@
1
+ <div class="w-full max-w-4xl space-y-10">
2
+ <%= render(UI::Stepper.new(current: 3, variant: :dot, align: :center, label: "Contractor onboarding")) do |stepper| %>
3
+ <% ["General info", "Payment info", "Benefits and compliance", "Review and sign", "Contractor signs", "Activated"].each do |title| %>
4
+ <% stepper.with_step(title: title) %>
5
+ <% end %>
6
+ <% end %>
7
+ <%= render(UI::Stepper.new(current: 2, variant: :dot, label: "Checkout")) do |stepper| %>
8
+ <% stepper.with_step(title: "Cart") %>
9
+ <% stepper.with_step(title: "Shipping") %>
10
+ <% stepper.with_step(title: "Payment") %>
11
+ <% end %>
12
+ </div>
@@ -0,0 +1,10 @@
1
+ <%# A status the server knows: no panels, no buttons, just where the order is. %>
2
+ <div class="w-full max-w-3xl">
3
+ <%= render(UI::Stepper.new(current: 3, align: :center, label: "Order #4021")) do |stepper| %>
4
+ <% stepper.with_step(title: "Ordered", description: "Mon, 2 Nov") %>
5
+ <% stepper.with_step(title: "Packed", description: "Tue, 3 Nov") %>
6
+ <% stepper.with_step(title: "Shipped", description: "Left Mumbai hub") %>
7
+ <% stepper.with_step(title: "Out for delivery") %>
8
+ <% stepper.with_step(title: "Delivered", description: "By Fri, 6 Nov") %>
9
+ <% end %>
10
+ </div>
@@ -0,0 +1,14 @@
1
+ <%= render(UI::Card.new(class: "w-full max-w-3xl")) do |card| %>
2
+ <% card.with_header do |header| %>
3
+ <%= render(UI::Card::Title.new) { "Price calculator" } %>
4
+ <%= render(UI::Card::Description.new) { "All printing includes full colour on both sides." } %>
5
+ <% end %>
6
+ <% card.with_content do %>
7
+ <%= render(UI::Stepper.new(current: 3, label: "Price calculator")) do |stepper| %>
8
+ <% stepper.with_step(title: "Size and style") %>
9
+ <% stepper.with_step(title: "Paper type") %>
10
+ <% stepper.with_step(title: "Quantity") %>
11
+ <% stepper.with_step(title: "Packs") %>
12
+ <% end %>
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <%# The server decides the step. Each panel is a form that posts to it: valid,
2
+ it redirects to the next step; invalid, it renders this again with
3
+ `status: :error` and the field's error, with a 422. Done steps link back.
4
+ While the form is sending, the step shows a spinner. %>
5
+ <div class="w-full max-w-2xl">
6
+ <%= render(UI::Stepper.new(current: 2, label: "Sign up")) do |stepper| %>
7
+ <% stepper.with_step(title: "Account", description: "ada@example.com", href: "#account") %>
8
+ <% stepper.with_step(title: "Workspace", description: "That address is taken", status: :error) do %>
9
+ <%= form_with url: "/demo/signup/workspace", method: :patch, class: "grid gap-4" do %>
10
+ <%= render(UI::Input.new(label: "Workspace URL", name: "workspace[slug]", value: "acme", required: true,
11
+ error: "acme.example.com is taken. Try acme-hq or acme-labs.")) %>
12
+ <div class="flex justify-end gap-2">
13
+ <%= render(UI::Button.new(type: :submit)) { "Continue" } %>
14
+ </div>
15
+ <% end %>
16
+ <% end %>
17
+ <% stepper.with_step(title: "Plan") %>
18
+ <% stepper.with_step(title: "Invite") %>
19
+ <% end %>
20
+ </div>
@@ -0,0 +1,43 @@
1
+ <%# `layout: :side`: the steps in a column beside the panels, for a longer
2
+ flow. The last button moves on to the completion instead of posting. %>
3
+ <div class="w-full max-w-4xl rounded-xl border bg-card p-6 sm:p-8">
4
+ <%= render(UI::Stepper.new(orientation: :vertical, layout: :side, label: "Book a speaker")) do |stepper| %>
5
+ <% stepper.with_step(title: "Format", description: "In person or remote") do %>
6
+ <h3 class="text-lg font-semibold">How will the speaker join?</h3>
7
+ <p class="mb-5 text-sm text-muted-foreground">Remote talks can still be watched together in the office.</p>
8
+ <%= render(UI::RadioGroup.new(name: "booking[format]", value: "remote")) do |group| %>
9
+ <% group.with_item(value: "in_person", label: "In person, at our office") %>
10
+ <% group.with_item(value: "remote", label: "Remote, with the team in the office") %>
11
+ <% group.with_item(value: "all_remote", label: "Remote, everyone from home") %>
12
+ <% end %>
13
+ <% end %>
14
+ <% stepper.with_step(title: "Talk", description: "Title and audience") do %>
15
+ <div class="grid gap-4">
16
+ <%= render(UI::Input.new(label: "Title", name: "booking[title]", required: true, placeholder: "Scaling Postgres without sharding")) %>
17
+ <%= render(UI::NativeSelect.new(label: "Audience", name: "booking[audience]", required: true, prompt: "Choose one",
18
+ options: [["Engineering", "engineering"], ["Whole company", "company"], ["Leadership", "leadership"]])) %>
19
+ </div>
20
+ <% end %>
21
+ <% stepper.with_step(title: "Date and time", description: "When it happens") do %>
22
+ <div class="grid gap-4 sm:grid-cols-2">
23
+ <%= render(UI::Input.new(type: :date, label: "Date", name: "booking[date]", required: true)) %>
24
+ <%= render(UI::Input.new(type: :time, label: "Start", name: "booking[time]", required: true, value: "16:00")) %>
25
+ </div>
26
+ <% end %>
27
+ <% stepper.with_step(title: "Speaker", description: "Who to invite") do %>
28
+ <div class="grid gap-4 sm:grid-cols-2">
29
+ <%= render(UI::Input.new(label: "Name", name: "booking[speaker]", required: true)) %>
30
+ <%= render(UI::Input.new(type: :email, label: "Email", name: "booking[email]", required: true)) %>
31
+ </div>
32
+ <% end %>
33
+ <% stepper.with_completion do %>
34
+ <%= render(UI::EmptyState.new(icon: "circle-check", title: "Request sent", description: "We've emailed the speaker. You'll hear back when they accept.", class: "md:p-6")) do %>
35
+ <%= render(UI::Button.new(variant: :outline, data: { action: "ui--stepper#reset" })) { "Book another" } %>
36
+ <% end %>
37
+ <% end %>
38
+ <div class="mt-8 flex items-center gap-2">
39
+ <%= render(UI::Button.new(variant: :ghost, hidden: true, data: { action: "ui--stepper#previous", "ui--stepper-target": "previous" })) { "Back" } %>
40
+ <%= render(UI::Button.new(class: "ml-auto", data: { action: "ui--stepper#next", "ui--stepper-target": "next" })) { "Continue" } %>
41
+ </div>
42
+ <% end %>
43
+ </div>
@@ -0,0 +1,55 @@
1
+ <%# One form, split into steps. Continue checks the fields on the current step
2
+ in the browser (required, pattern, type) and stays put, marking the step,
3
+ if one is wrong. Nothing is sent until "Create project". %>
4
+ <%= form_with url: "/demo/projects", class: "w-full max-w-3xl" do %>
5
+ <%= render(UI::Card.new) do |card| %>
6
+ <% card.with_content(class: "pt-6") do %>
7
+ <%= render(UI::Stepper.new(label: "Create a project")) do |stepper| %>
8
+ <% stepper.with_step(title: "Details", description: "Name and address") do %>
9
+ <div class="grid gap-4 sm:grid-cols-2">
10
+ <%= render(UI::Input.new(label: "Project name", name: "project[name]", required: true, placeholder: "Acme dashboard")) %>
11
+ <%# The address is the part after the slash, so the box shows the rest. %>
12
+ <%= render(UI::FormField.new(label: "Address", required: true, hint: "Lowercase letters, numbers and dashes")) do |field| %>
13
+ <%= render(UI::InputGroup.new) do |group| %>
14
+ <% group.with_addon(align: "inline-start") { "acme.app/" } %>
15
+ <% group.with_field(name: "project[slug]", required: true, pattern: "[a-z0-9]+(-[a-z0-9]+)*", placeholder: "dashboard",
16
+ title: "Lowercase letters, numbers and dashes, like sales-dashboard", autocapitalize: "none",
17
+ spellcheck: false, **field.control_attributes) %>
18
+ <% end %>
19
+ <% end %>
20
+ </div>
21
+ <% end %>
22
+ <% stepper.with_step(title: "Plan", description: "Pick what fits") do %>
23
+ <fieldset class="grid gap-3 sm:grid-cols-3">
24
+ <legend class="sr-only">Plan</legend>
25
+ <% [["hobby", "Hobby", "Free", "One member, 3 projects"],
26
+ ["team", "Team", "$20 a month", "Up to 10 members"],
27
+ ["business", "Business", "$80 a month", "Unlimited members, SSO"]].each do |value, name, price, detail| %>
28
+ <label class="relative flex cursor-pointer flex-col gap-1 rounded-lg border p-4 transition-colors hover:bg-accent/50 has-[:checked]:border-primary has-[:checked]:bg-primary/5 has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/40">
29
+ <input type="radio" name="project[plan]" value="<%= value %>" required class="peer sr-only">
30
+ <span class="text-sm font-medium"><%= name %></span>
31
+ <span class="text-lg font-semibold"><%= price %></span>
32
+ <span class="text-sm text-muted-foreground"><%= detail %></span>
33
+ </label>
34
+ <% end %>
35
+ </fieldset>
36
+ <% end %>
37
+ <% stepper.with_step(title: "Team", description: "Invite people") do %>
38
+ <%= render(UI::Input.new(type: :email, label: "Email addresses", name: "project[invites]", multiple: true,
39
+ placeholder: "dev@acme.com, ops@acme.com", hint: "Optional. Separate them with commas.")) %>
40
+ <% end %>
41
+ <% stepper.with_step(title: "Review", description: "Check and create") do %>
42
+ <%= render(UI::Alert.new(variant: :info)) do |alert| %>
43
+ <% alert.with_title { "Almost there" } %>
44
+ <% alert.with_description { "You can rename the project, change its URL or plan, and invite more people later, from Settings." } %>
45
+ <% end %>
46
+ <% end %>
47
+ <div class="mt-8 flex items-center gap-2 border-t pt-6">
48
+ <%= render(UI::Button.new(variant: :outline, hidden: true, data: { action: "ui--stepper#previous", "ui--stepper-target": "previous" })) do |button| %><% button.with_leading_icon(name: "arrow-left") %>Back<% end %>
49
+ <%= render(UI::Button.new(class: "ml-auto", data: { action: "ui--stepper#next", "ui--stepper-target": "next" })) do |button| %>Continue<% button.with_trailing_icon(name: "arrow-right") %><% end %>
50
+ <%= render(UI::Button.new(type: :submit, class: "ml-auto", hidden: true, data: { "ui--stepper-target": "submit" })) { "Create project" } %>
51
+ </div>
52
+ <% end %>
53
+ <% end %>
54
+ <% end %>
55
+ <% end %>
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The wizards below post to /demo/ paths; the docs site stops those requests
4
+ # and shows a toast instead. The live demo further up the page checks each
5
+ # step on the server.
6
+ class UI::StepperPreview < ViewComponent::Preview
7
+ # @label Playground
8
+ # @param current number { min: 1, max: 5 }
9
+ # @param orientation select { choices: [horizontal, vertical] }
10
+ # @param variant select { choices: [default, dot] }
11
+ # @param align select { choices: [start, center] }
12
+ # @param connector toggle
13
+ # @param descriptions toggle
14
+ def playground(current: 2, orientation: :horizontal, variant: :default, align: :start, connector: true,
15
+ descriptions: true)
16
+ render(UI::Stepper.new(current: current.to_i, orientation: orientation.to_sym, variant: variant.to_sym,
17
+ align: align.to_sym, connector: connector)) do |stepper|
18
+ [ [ "Account", "Name and email" ], [ "Plan", "Pick what fits" ], [ "Payment", "Card details" ],
19
+ [ "Review", "Check and confirm" ] ].each do |title, description|
20
+ stepper.with_step(title: title, description: (description if descriptions))
21
+ end
22
+ end
23
+ end
24
+
25
+ # @label Horizontal
26
+ def price_calculator; render_with_template; end
27
+
28
+ # @label Centered, with Descriptions
29
+ def order_tracking; render_with_template; end
30
+
31
+ # @label Dots
32
+ def onboarding; render_with_template; end
33
+
34
+ # @label Vertical
35
+ def approvals; render_with_template; end
36
+
37
+ # @label With an Error
38
+ def failed_deploy; render_with_template; end
39
+
40
+ # @label Without Lines
41
+ def checklist; render_with_template; end
42
+
43
+ # @label Wizard, Checked in the Browser
44
+ def wizard; render_with_template; end
45
+
46
+ # @label Beside the Form
47
+ def sidebar; render_with_template; end
48
+
49
+ # @label Steps Inline
50
+ def inline; render_with_template; end
51
+
52
+ # @label Dots in a Card
53
+ def dot_wizard; render_with_template; end
54
+
55
+ # @label Server-Driven, with Links Back
56
+ def server_driven; render_with_template; end
57
+ end
@@ -0,0 +1,7 @@
1
+ <%= render(UI::Timeline.new(variant: :dot, label: "Activity", class: "max-w-md")) do |timeline| %>
2
+ <% timeline.with_item(title: "Sam changed the price to $24.00", time: "2 minutes ago") %>
3
+ <% timeline.with_item(title: "Priya added a photo", time: "1 hour ago") %>
4
+ <% timeline.with_item(title: "Import failed", status: :error, time: "Yesterday", description: "Row 12 has no SKU.") %>
5
+ <% timeline.with_item(title: "Sam edited the description", time: "Nov 2") %>
6
+ <% timeline.with_item(title: "Priya created this product", time: "Oct 28") %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%= render(UI::Timeline.new(variant: :colored, label: "Order status", class: "max-w-md")) do |timeline| %>
2
+ <% timeline.with_item(title: "Order placed", icon: "file-text", time: "Nov 3, 9:12 am") %>
3
+ <% timeline.with_item(title: "Payment received", icon: "credit-card", time: "Nov 3, 9:13 am", description: "Card ending 4242") %>
4
+ <% timeline.with_item(title: "Packed", icon: "package", time: "Nov 4, 2:40 pm") %>
5
+ <% timeline.with_item(title: "Out for delivery", icon: "truck", status: :current, time: "Nov 5, 8:05 am") %>
6
+ <% timeline.with_item(title: "Delivered", icon: "home", status: :upcoming, time: "Expected today") %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%= render(UI::Timeline.new(variant: :colored, label: "Stock history", class: "max-w-md")) do |timeline| %>
2
+ <% timeline.with_item(title: "Sold 2", icon: "store", color: :blue, time: "Today, 11:02 am", description: "Bill #1042. 46 left.") %>
3
+ <% timeline.with_item(title: "Written off 1", icon: "trash-2", color: :rose, time: "Yesterday, 6:30 pm", description: "Damaged in storage. 48 left.") %>
4
+ <% timeline.with_item(title: "Received 24", icon: "truck", color: :emerald, time: "Nov 2, 10:15 am", description: "From Northwind Traders. 49 left.") %>
5
+ <% timeline.with_item(title: "Sold 1", icon: "store", color: :blue, time: "Nov 1, 3:45 pm", description: "Bill #1017. 25 left.") %>
6
+ <% timeline.with_item(title: "Opening stock 26", icon: "package", color: :violet, time: "Oct 28, 9:00 am") %>
7
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <%= render(UI::Timeline.new(label: "Order status", class: "max-w-md")) do |timeline| %>
2
+ <% timeline.with_item(title: "Packed", time: "Nov 4, 2:40 pm") %>
3
+ <% timeline.with_item(title: "Out for delivery", time: "Nov 5, 8:05 am") %>
4
+ <% timeline.with_item(title: "Delivery failed", status: :error, time: "Nov 5, 4:18 pm", description: "No one was home to sign for it.") %>
5
+ <% timeline.with_item(title: "Second attempt", status: :upcoming, time: "Expected tomorrow") %>
6
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%= render(UI::Timeline.new(label: "Order status", class: "max-w-md")) do |timeline| %>
2
+ <% timeline.with_item(title: "Order placed", icon: "file-text", time: "Nov 3, 9:12 am") %>
3
+ <% timeline.with_item(title: "Payment received", icon: "credit-card", time: "Nov 3, 9:13 am", description: "Card ending 4242") %>
4
+ <% timeline.with_item(title: "Packed", icon: "package", time: "Nov 4, 2:40 pm") %>
5
+ <% timeline.with_item(title: "Out for delivery", icon: "truck", status: :current, time: "Nov 5, 8:05 am") do %>
6
+ <%= render(UI::Link.new(href: "#")) { "Track parcel" } %>
7
+ <% end %>
8
+ <% timeline.with_item(title: "Delivered", icon: "home", status: :upcoming, time: "Expected today") %>
9
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%= render(UI::Timeline.new(label: "Invoice", class: "max-w-md")) do |timeline| %>
2
+ <% timeline.with_item(title: "Sent", time: Time.utc(2026, 11, 3, 9, 30)) %>
3
+ <% timeline.with_item(title: "Viewed", time: Time.utc(2026, 11, 4, 16, 5), time_label: "Yesterday") %>
4
+ <% timeline.with_item(title: "Paid", status: :current, time: Date.new(2026, 11, 5)) %>
5
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <%= render(UI::Timeline.new(label: "Stock history", class: "max-w-md")) do |timeline| %>
2
+ <% timeline.with_item(title: "Sold 2", icon: "store", time: "Today, 11:02 am", description: "Bill #1042. 46 left.") %>
3
+ <% timeline.with_item(title: "Written off 1", icon: "trash-2", time: "Yesterday, 6:30 pm", description: "Damaged in storage. 48 left.") %>
4
+ <% timeline.with_item(title: "Received 24", icon: "truck", time: "Nov 2, 10:15 am", description: "From Northwind Traders. 49 left.") %>
5
+ <% timeline.with_item(title: "Opening stock 25", icon: "package", time: "Oct 28, 9:00 am") %>
6
+ <% end %>
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ class UI::TimelinePreview < ViewComponent::Preview
4
+ # @label Playground
5
+ # @param variant select { choices: [default, dot, colored] }
6
+ # @param status select { choices: [complete, current, upcoming, error] }
7
+ # @param descriptions toggle
8
+ def playground(variant: :default, status: :current, descriptions: true)
9
+ render(UI::Timeline.new(variant: variant.to_sym, label: "Order history", class: "max-w-md")) do |timeline|
10
+ timeline.with_item(title: "Order placed", time: "Nov 3, 9:12 am",
11
+ description: ("Paid by card ending 4242" if descriptions))
12
+ timeline.with_item(title: "Packed", time: "Nov 4, 2:40 pm",
13
+ description: ("Two boxes, 3.2 kg" if descriptions))
14
+ timeline.with_item(title: "Out for delivery", status: status.to_sym, time: "Nov 5, 8:05 am",
15
+ description: ("With the courier" if descriptions))
16
+ timeline.with_item(title: "Delivered", status: :upcoming, time: "Expected today")
17
+ end
18
+ end
19
+
20
+ # @label Order Status
21
+ def order_status; render_with_template; end
22
+
23
+ # @label With a Failed Step
24
+ def failed_delivery; render_with_template; end
25
+
26
+ # @label Stock History
27
+ def stock_history; render_with_template; end
28
+
29
+ # @label Activity Log, with Dots
30
+ def activity_log; render_with_template; end
31
+
32
+ # @label Colored
33
+ def colored; render_with_template; end
34
+
35
+ # @label Colors That Mean Something
36
+ def colored_by_meaning; render_with_template; end
37
+
38
+ # @label Real Dates
39
+ def real_dates; render_with_template; end
40
+ end
@@ -0,0 +1,5 @@
1
+ <%= render(UI::ToggleGroup.new(name: "align", value: "left", variant: :outline, label: "Text alignment")) do |group| %>
2
+ <% group.with_item(value: "left", label: "Align left", icon: "align-left", icon_only: true) %>
3
+ <% group.with_item(value: "center", label: "Align center", icon: "align-center", icon_only: true) %>
4
+ <% group.with_item(value: "right", label: "Align right", icon: "align-right", icon_only: true) %>
5
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <form class="flex max-w-sm flex-col gap-4" action="#" onsubmit="event.preventDefault()">
2
+ <div class="flex flex-col gap-2">
3
+ <span id="visibility-label" class="text-sm font-medium">Visibility</span>
4
+ <%= render(UI::ToggleGroup.new(name: "project[visibility]", value: "team", required: true, variant: :outline, class: "w-full", aria: { labelledby: "visibility-label" })) do |group| %>
5
+ <% group.with_item(value: "private", label: "Private", class: "flex-1") %>
6
+ <% group.with_item(value: "team", label: "Team", class: "flex-1") %>
7
+ <% group.with_item(value: "public", label: "Public", class: "flex-1") %>
8
+ <% end %>
9
+ </div>
10
+ <%= render(UI::Button.new(type: :submit, class: "self-start")) { "Save" } %>
11
+ </form>
@@ -0,0 +1,5 @@
1
+ <%= render(UI::ToggleGroup.new(name: "styles", value: %w[bold], multiple: true, variant: :outline, label: "Text style")) do |group| %>
2
+ <% group.with_item(value: "bold", label: "Bold", icon: "bold", icon_only: true) %>
3
+ <% group.with_item(value: "italic", label: "Italic", icon: "italic", icon_only: true) %>
4
+ <% group.with_item(value: "underline", label: "Underline", icon: "underline", icon_only: true) %>
5
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%= render(UI::ToggleGroup.new(name: "billing", value: "monthly", variant: :outline, label: "Billing period")) do |group| %>
2
+ <% group.with_item(value: "monthly", label: "Monthly") %>
3
+ <% group.with_item(value: "yearly", label: "Yearly") %>
4
+ <% group.with_item(value: "lifetime", label: "Lifetime", disabled: true) %>
5
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <div class="flex flex-col items-start gap-4">
2
+ <% %i[sm default lg].each do |size| %>
3
+ <%= render(UI::ToggleGroup.new(name: "size-#{size}", value: "b", size: size, label: "#{size} size")) do |group| %>
4
+ <% group.with_item(value: "a", label: "Draft") %>
5
+ <% group.with_item(value: "b", label: "Published") %>
6
+ <% group.with_item(value: "c", label: "Archived") %>
7
+ <% end %>
8
+ <% end %>
9
+ </div>
@@ -0,0 +1,5 @@
1
+ <%= render(UI::ToggleGroup.new(name: "layout", value: "grid", label: "Layout")) do |group| %>
2
+ <% group.with_item(value: "list", label: "List", icon: "list") %>
3
+ <% group.with_item(value: "grid", label: "Grid", icon: "layout-grid") %>
4
+ <% group.with_item(value: "board", label: "Board", icon: "folder-kanban") %>
5
+ <% end %>
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ class UI::ToggleGroupPreview < ViewComponent::Preview
4
+ # @label Playground
5
+ # @param variant select { choices: [default, outline] }
6
+ # @param size select { choices: [sm, default, lg] }
7
+ # @param multiple toggle
8
+ # @param disabled toggle
9
+ def playground(variant: :default, size: :default, multiple: false, disabled: false)
10
+ render(UI::ToggleGroup.new(name: "period", value: "month", label: "Period", variant: variant.to_sym,
11
+ size: size.to_sym, multiple: multiple, disabled: disabled)) do |group|
12
+ group.with_item(value: "day", label: "Day")
13
+ group.with_item(value: "week", label: "Week")
14
+ group.with_item(value: "month", label: "Month")
15
+ group.with_item(value: "year", label: "Year")
16
+ end
17
+ end
18
+
19
+ # @label Outline
20
+ def outline; render_with_template; end
21
+
22
+ # @label With Icons
23
+ def with_icons; render_with_template; end
24
+
25
+ # @label Icon Only
26
+ def icon_only; render_with_template; end
27
+
28
+ # @label Multiple
29
+ def multiple; render_with_template; end
30
+
31
+ # @label Sizes
32
+ def sizes; render_with_template; end
33
+
34
+ # @label In a Form
35
+ def in_form; render_with_template; end
36
+ end