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,17 @@
1
+ <!-- @license @tabler/icons v3.50.0 - MIT -->
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ width="24"
5
+ height="24"
6
+ viewBox="0 0 24 24"
7
+ fill="none"
8
+ stroke="currentColor"
9
+ stroke-width="2"
10
+ stroke-linecap="round"
11
+ stroke-linejoin="round"
12
+ class="icon icon-tabler icons-tabler-outline icon-tabler-x"
13
+ >
14
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
15
+ <path d="M18 6l-12 12" />
16
+ <path d="M6 6l12 12" />
17
+ </svg>
@@ -0,0 +1,19 @@
1
+ <!-- @license @tabler/icons v3.50.0 - MIT -->
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ width="24"
5
+ height="24"
6
+ viewBox="0 0 24 24"
7
+ fill="none"
8
+ stroke="currentColor"
9
+ stroke-width="2"
10
+ stroke-linecap="round"
11
+ stroke-linejoin="round"
12
+ class="icon icon-tabler icons-tabler-outline icon-tabler-zoom-in"
13
+ >
14
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
15
+ <path d="M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" />
16
+ <path d="M7 10l6 0" />
17
+ <path d="M10 7l0 6" />
18
+ <path d="M21 21l-6 -6" />
19
+ </svg>
@@ -0,0 +1,18 @@
1
+ <!-- @license @tabler/icons v3.50.0 - MIT -->
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ width="24"
5
+ height="24"
6
+ viewBox="0 0 24 24"
7
+ fill="none"
8
+ stroke="currentColor"
9
+ stroke-width="2"
10
+ stroke-linecap="round"
11
+ stroke-linejoin="round"
12
+ class="icon icon-tabler icons-tabler-outline icon-tabler-zoom-out"
13
+ >
14
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
15
+ <path d="M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" />
16
+ <path d="M7 10l6 0" />
17
+ <path d="M21 21l-6 -6" />
18
+ </svg>
@@ -0,0 +1,90 @@
1
+ # Every icon the components and their previews draw, by its Lucide name,
2
+ # with its name in each other library. `velvetkit:add` renames the icons in
3
+ # what it copies for the library in config/velvetkit.yml, and copies the
4
+ # SVGs from icons/<library>/. After changing this file run `rake icons:sync`.
5
+ #
6
+ # test/velvetkit/icons_test.rb fails when a component draws an icon that
7
+ # isn't listed here, or a listed icon has no SVG.
8
+
9
+ align-center: { tabler: align-center, phosphor: text-align-center }
10
+ align-left: { tabler: align-left, phosphor: text-align-left }
11
+ align-right: { tabler: align-right, phosphor: text-align-right }
12
+ arrow-left: { tabler: arrow-left, phosphor: arrow-left }
13
+ arrow-right: { tabler: arrow-right, phosphor: arrow-right }
14
+ badge-check: { tabler: rosette-discount-check, phosphor: seal-check }
15
+ bar-chart-3: { tabler: chart-bar, phosphor: chart-bar }
16
+ bell: { tabler: bell, phosphor: bell }
17
+ bold: { tabler: bold, phosphor: text-b }
18
+ book-open: { tabler: book, phosphor: book-open }
19
+ calendar: { tabler: calendar, phosphor: calendar-blank }
20
+ chart-column: { tabler: chart-bar, phosphor: chart-bar }
21
+ check: { tabler: check, phosphor: check }
22
+ chevron-down: { tabler: chevron-down, phosphor: caret-down }
23
+ chevron-left: { tabler: chevron-left, phosphor: caret-left }
24
+ chevron-right: { tabler: chevron-right, phosphor: caret-right }
25
+ chevrons-up-down: { tabler: selector, phosphor: caret-up-down }
26
+ circle-alert: { tabler: alert-circle, phosphor: warning-circle }
27
+ circle-check: { tabler: circle-check, phosphor: check-circle }
28
+ cloud: { tabler: cloud, phosphor: cloud }
29
+ credit-card: { tabler: credit-card, phosphor: credit-card }
30
+ download: { tabler: download, phosphor: download-simple }
31
+ ellipsis: { tabler: dots, phosphor: dots-three }
32
+ ellipsis-vertical: { tabler: dots-vertical, phosphor: dots-three-vertical }
33
+ eye: { tabler: eye, phosphor: eye }
34
+ eye-off: { tabler: eye-off, phosphor: eye-slash }
35
+ file: { tabler: file, phosphor: file }
36
+ file-plus: { tabler: file-plus, phosphor: file-plus }
37
+ file-text: { tabler: file-text, phosphor: file-text }
38
+ folder: { tabler: folder, phosphor: folder }
39
+ folder-kanban: { tabler: layout-kanban, phosphor: kanban }
40
+ git-branch: { tabler: git-branch, phosphor: git-branch }
41
+ globe: { tabler: world, phosphor: globe }
42
+ graduation-cap: { tabler: school, phosphor: graduation-cap }
43
+ grip-vertical: { tabler: grip-vertical, phosphor: dots-six-vertical }
44
+ home: { tabler: home, phosphor: house }
45
+ inbox: { tabler: inbox, phosphor: tray }
46
+ info: { tabler: info-circle, phosphor: info }
47
+ italic: { tabler: italic, phosphor: text-italic }
48
+ keyboard: { tabler: keyboard, phosphor: keyboard }
49
+ layout-dashboard: { tabler: layout-dashboard, phosphor: squares-four }
50
+ layout-grid: { tabler: layout-grid, phosphor: grid-four }
51
+ life-buoy: { tabler: lifebuoy, phosphor: lifebuoy }
52
+ list: { tabler: list, phosphor: list }
53
+ loader: { tabler: loader, phosphor: spinner }
54
+ lock: { tabler: lock, phosphor: lock }
55
+ log-out: { tabler: logout, phosphor: sign-out }
56
+ mail: { tabler: mail, phosphor: envelope }
57
+ menu: { tabler: menu-2, phosphor: list }
58
+ message-circle: { tabler: message-circle, phosphor: chat-circle }
59
+ minus: { tabler: minus, phosphor: minus }
60
+ monitor: { tabler: device-desktop, phosphor: desktop }
61
+ moon: { tabler: moon, phosphor: moon }
62
+ newspaper: { tabler: news, phosphor: newspaper }
63
+ package: { tabler: package, phosphor: package }
64
+ panel-left: { tabler: layout-sidebar, phosphor: sidebar }
65
+ pause: { tabler: player-pause, phosphor: pause }
66
+ percent: { tabler: percentage, phosphor: percent }
67
+ plus: { tabler: plus, phosphor: plus }
68
+ printer: { tabler: printer, phosphor: printer }
69
+ qr-code: { tabler: qrcode, phosphor: qr-code }
70
+ receipt: { tabler: receipt, phosphor: receipt }
71
+ rocket: { tabler: rocket, phosphor: rocket }
72
+ rotate-cw: { tabler: rotate-clockwise, phosphor: arrow-clockwise }
73
+ search: { tabler: search, phosphor: magnifying-glass }
74
+ settings: { tabler: settings, phosphor: gear }
75
+ shield: { tabler: shield, phosphor: shield }
76
+ shield-check: { tabler: shield-check, phosphor: shield-check }
77
+ store: { tabler: building-store, phosphor: storefront }
78
+ sun: { tabler: sun, phosphor: sun }
79
+ sun-moon: { tabler: sun-moon, phosphor: circle-half }
80
+ trash-2: { tabler: trash, phosphor: trash }
81
+ truck: { tabler: truck, phosphor: truck }
82
+ underline: { tabler: underline, phosphor: text-underline }
83
+ upload: { tabler: upload, phosphor: upload-simple }
84
+ user: { tabler: user, phosphor: user }
85
+ user-plus: { tabler: user-plus, phosphor: user-plus }
86
+ users: { tabler: users, phosphor: users }
87
+ workflow: { tabler: sitemap, phosphor: flow-arrow }
88
+ x: { tabler: x, phosphor: x }
89
+ zoom-in: { tabler: zoom-in, phosphor: magnifying-glass-plus }
90
+ zoom-out: { tabler: zoom-out, phosphor: magnifying-glass-minus }
@@ -0,0 +1,6 @@
1
+ <div class="max-w-2xl space-y-1">
2
+ <h3 class="font-semibold">Net cash flow</h3>
3
+ <%= render(UI::Chart.new(type: :bar, format: :currency, label: "Net cash flow by month",
4
+ labels: UI::ChartPreview::MONTHS.first(8),
5
+ series: [ { name: "Net cash flow", data: [ 4200, -1800, 2600, 3900, -2400, 1500, 5100, -600 ] } ])) %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <div class="max-w-2xl space-y-1">
2
+ <h3 class="font-semibold">Stock by warehouse</h3>
3
+ <%= render(UI::Chart.new(type: :donut, label: "Units in stock by warehouse", height: 240,
4
+ labels: [ "Bengaluru", "Mumbai", "Delhi", "Chennai", "Other" ],
5
+ series: [ { name: "Units", data: [ 1840, 1320, 960, 610, 270 ] } ])) %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <div class="max-w-2xl space-y-1">
2
+ <h3 class="font-semibold">Gross margin</h3>
3
+ <%= render(UI::Chart.new(type: :line, format: :percent, label: "Gross margin by month", height: 220,
4
+ labels: UI::ChartPreview::MONTHS.first(9),
5
+ series: [ { name: "Gross margin", data: [ 38.2, 39.5, 37.1, 40.8, 41.6, nil, 42.3, 43.9, 44.1 ] } ])) %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <div class="max-w-2xl space-y-1">
2
+ <h3 class="font-semibold">Today's takings, by payment</h3>
3
+ <%= render(UI::Chart.new(type: :pie, format: :currency, label: "Today's takings, by payment", height: 240,
4
+ labels: [ "Card", "Cash", "UPI", "Store credit" ],
5
+ series: [ { name: "Takings", data: [ 4260, 1310, 980, 240 ] } ])) %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <div class="max-w-2xl space-y-1">
2
+ <h3 class="font-semibold">Sales, this year and last</h3>
3
+ <%= render(UI::Chart.new(type: :line, format: :currency, label: "Sales, this year and last",
4
+ labels: UI::ChartPreview::MONTHS,
5
+ series: [ { name: "This year", data: UI::ChartPreview::THIS_YEAR }, { name: "Last year", data: UI::ChartPreview::LAST_YEAR } ])) %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <div class="max-w-2xl space-y-1">
2
+ <h3 class="font-semibold">Units in stock</h3>
3
+ <%= render(UI::Chart.new(type: :bar, label: "Units in stock by category",
4
+ labels: [ "Mugs", "Plates", "Bowls", "Glasses", "Cutlery", "Linen" ],
5
+ series: [ { name: "In stock", data: [ 148, 96, 121, 64, 212, 38 ] } ])) %>
6
+ </div>
@@ -0,0 +1,8 @@
1
+ <div class="max-w-2xl space-y-1">
2
+ <h3 class="font-semibold">Takings this week, by payment</h3>
3
+ <%= render(UI::Chart.new(type: :bar, stacked: true, format: :currency, label: "Takings this week, by payment",
4
+ labels: %w[Mon Tue Wed Thu Fri Sat Sun],
5
+ series: [ { name: "Card", data: [ 1840, 2210, 1960, 2480, 3120, 4260, 3380 ] },
6
+ { name: "Cash", data: [ 620, 540, 710, 680, 940, 1310, 1020 ] },
7
+ { name: "UPI", data: [ 410, 520, 480, 610, 760, 980, 830 ] } ])) %>
8
+ </div>
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ class UI::ChartPreview < ViewComponent::Preview
4
+ MONTHS = %w[Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec].freeze
5
+ THIS_YEAR = [ 42_800, 39_100, 47_600, 51_200, 49_800, 56_300, 61_900, 58_400, 63_700, 66_100, 71_800, 84_500 ].freeze
6
+ LAST_YEAR = [ 38_200, 36_900, 41_300, 44_800, 46_100, 48_700, 52_300, 51_900, 55_400, 57_800, 62_100, 73_200 ].freeze
7
+
8
+ # @label Playground
9
+ # @param type select { choices: [line, bar, pie, donut] }
10
+ # @param stacked toggle
11
+ # @param series_count number { min: 1, max: 5 }
12
+ # @param format select { choices: [number, currency, percent] }
13
+ def playground(type: :bar, stacked: false, series_count: 2, format: :number)
14
+ names = %w[North South East West Online]
15
+ # A pie or donut is one series, a slice per label, five at most.
16
+ circular = %w[pie donut].include?(type.to_s)
17
+ series_count = 1 if circular
18
+ points = circular ? 5 : 6
19
+ series = names.first(series_count.to_i).each_with_index.map do |name, i|
20
+ { name: name, data: [ 120, 140, 135, 160, 172, 158 ].first(points).map { |v| v - (i * 18) + ((i * 7) % 11) } }
21
+ end
22
+ render(UI::Chart.new(type: type.to_sym, stacked: stacked, format: format.to_sym, label: "Orders by region",
23
+ labels: MONTHS.first(points), series: series, class: "max-w-2xl"))
24
+ end
25
+
26
+ # @label Sales, This Year and Last
27
+ def sales; render_with_template; end
28
+
29
+ # @label Stock by Category
30
+ def stock; render_with_template; end
31
+
32
+ # @label Takings by Payment, Stacked
33
+ def takings; render_with_template; end
34
+
35
+ # @label Cash Flow, Below Zero
36
+ def cash_flow; render_with_template; end
37
+
38
+ # @label Percentages
39
+ def margin; render_with_template; end
40
+
41
+ # @label Pie
42
+ def pie; render_with_template; end
43
+
44
+ # @label Donut, with Its Total
45
+ def donut; render_with_template; end
46
+ end
@@ -0,0 +1,14 @@
1
+ <%# Shows what was picked, instead of going there, so the demo stays on this page. %>
2
+ <p class="mt-4 text-sm text-muted-foreground" data-demo="picked" role="status">Nothing picked yet.</p>
3
+ <script>
4
+ (() => {
5
+ const out = document.currentScript.previousElementSibling;
6
+ const root = out.parentElement;
7
+ root.addEventListener("ui--command:select", (event) => {
8
+ event.preventDefault();
9
+ event.target.closest("dialog")?.close();
10
+ const { label, value, href } = event.detail;
11
+ out.textContent = `Picked "${label}"${href ? `, going to ${href}` : `, value ${value}`}`;
12
+ });
13
+ })();
14
+ </script>
@@ -0,0 +1,24 @@
1
+ <%# Press ⌘K (Ctrl+K off a Mac) anywhere on the page, or click the button. %>
2
+ <div>
3
+ <%= render(UI::Command.new(dialog: true)) do |command| %>
4
+ <% command.with_trigger(class: "w-72") %>
5
+ <% command.with_group(heading: "Pages") do |group| %>
6
+ <% group.with_item(label: "Dashboard", href: "/dashboard", icon: "layout-dashboard", shortcut: %w[g d]) %>
7
+ <% group.with_item(label: "Projects", href: "/projects", icon: "folder", shortcut: %w[g p]) %>
8
+ <% group.with_item(label: "Calendar", href: "/calendar", icon: "calendar") %>
9
+ <% group.with_item(label: "Reports", href: "/reports", icon: "chart-column", description: "Revenue, usage and growth") %>
10
+ <% group.with_item(label: "Settings", href: "/settings", icon: "settings", shortcut: "mod+,") %>
11
+ <% end %>
12
+ <% command.with_group(heading: "Actions") do |group| %>
13
+ <% group.with_item(label: "New project", value: "new-project", icon: "plus", keywords: "create add") %>
14
+ <% group.with_item(label: "Invite people", value: "invite", icon: "user-plus", keywords: "team member colleague") %>
15
+ <% group.with_item(label: "Switch theme", value: "theme", icon: "sun-moon", keywords: "dark light mode") %>
16
+ <% group.with_item(label: "Export data", value: "export", icon: "download", disabled: true, description: "Available on the Team plan") %>
17
+ <% end %>
18
+ <% command.with_group(heading: "Help") do |group| %>
19
+ <% group.with_item(label: "Keyboard shortcuts", value: "shortcuts", icon: "keyboard", shortcut: "?") %>
20
+ <% group.with_item(label: "Contact support", value: "support", icon: "life-buoy", keywords: "help chat email") %>
21
+ <% end %>
22
+ <% end %>
23
+ <%= render "ui/command_preview/picked" %>
24
+ </div>
@@ -0,0 +1,16 @@
1
+ <%# Not in a dialog: a search box with its list, on the page, like a help centre's. %>
2
+ <div class="max-w-md">
3
+ <%= render(UI::Command.new(placeholder: "Search help articles…", label: "Help articles")) do |command| %>
4
+ <% command.with_group(heading: "Getting started") do |group| %>
5
+ <% group.with_item(label: "Create your account", href: "#account", icon: "file-text") %>
6
+ <% group.with_item(label: "Invite your team", href: "#team", icon: "file-text", keywords: "colleagues members") %>
7
+ <% group.with_item(label: "Import from a spreadsheet", href: "#import", icon: "file-text", keywords: "csv excel upload") %>
8
+ <% end %>
9
+ <% command.with_group(heading: "Billing") do |group| %>
10
+ <% group.with_item(label: "Change your plan", href: "#plan", icon: "file-text", keywords: "upgrade downgrade") %>
11
+ <% group.with_item(label: "Download invoices", href: "#invoices", icon: "file-text", keywords: "receipt pdf") %>
12
+ <% group.with_item(label: "Cancel your subscription", href: "#cancel", icon: "file-text") %>
13
+ <% end %>
14
+ <% end %>
15
+ <%= render "ui/command_preview/picked" %>
16
+ </div>
@@ -0,0 +1,15 @@
1
+ <div>
2
+ <%= render(UI::Command.new(dialog: dialog, placeholder: placeholder, class: ("max-w-md" unless dialog))) do |command| %>
3
+ <% command.with_trigger(class: "w-64") if dialog %>
4
+ <% command.with_group(heading: "Pages") do |group| %>
5
+ <% group.with_item(label: "Dashboard", href: "/dashboard", icon: "layout-dashboard") %>
6
+ <% group.with_item(label: "Projects", href: "/projects", icon: "folder") %>
7
+ <% group.with_item(label: "Calendar", href: "/calendar", icon: "calendar") %>
8
+ <% end %>
9
+ <% command.with_group(heading: "Actions") do |group| %>
10
+ <% group.with_item(label: "New project", value: "new-project", icon: "plus", keywords: "create add") %>
11
+ <% group.with_item(label: "Invite people", value: "invite", icon: "user-plus", keywords: "team member") %>
12
+ <% end %>
13
+ <% end %>
14
+ <%= render "ui/command_preview/picked" %>
15
+ </div>
@@ -0,0 +1,24 @@
1
+ <%#
2
+ Pages and actions are on the page; customers come from the server as you
3
+ type. Try "rao" or "kapoor". The endpoint answers GET /search?q=… like this:
4
+
5
+ def search
6
+ customers = Customer.where("name ILIKE ?", "%#{params[:q]}%").limit(6)
7
+ render json: customers.map { |c|
8
+ { label: c.name, href: customer_path(c), description: c.email, group: "Customers" }
9
+ }
10
+ end
11
+ %>
12
+ <div>
13
+ <%= render(UI::Command.new(dialog: true, url: "/demo/search", placeholder: "Search customers, pages and actions…")) do |command| %>
14
+ <% command.with_trigger(label: "Search customers…", class: "w-72") %>
15
+ <% command.with_group(heading: "Pages") do |group| %>
16
+ <% group.with_item(label: "Customers", href: "/customers", icon: "users") %>
17
+ <% group.with_item(label: "Invoices", href: "/invoices", icon: "receipt", keywords: "bills") %>
18
+ <% end %>
19
+ <% command.with_group(heading: "Actions") do |group| %>
20
+ <% group.with_item(label: "New customer", value: "new-customer", icon: "user-plus", keywords: "add create") %>
21
+ <% end %>
22
+ <% end %>
23
+ <%= render "ui/command_preview/picked" %>
24
+ </div>
@@ -0,0 +1,12 @@
1
+ <%# bind: true makes an item's shortcut pick it from anywhere, with the palette closed. Try ⌥N or ⌥I (Alt off a Mac). %>
2
+ <div>
3
+ <%= render(UI::Command.new(dialog: true)) do |command| %>
4
+ <% command.with_trigger(class: "w-72") %>
5
+ <% command.with_group(heading: "Actions") do |group| %>
6
+ <% group.with_item(label: "New document", value: "new-document", icon: "file-plus", shortcut: "alt+n", bind: true) %>
7
+ <% group.with_item(label: "Invite people", value: "invite", icon: "user-plus", shortcut: "alt+i", bind: true) %>
8
+ <% group.with_item(label: "Print", value: "print", icon: "printer", shortcut: "alt+p", bind: true, disabled: true, description: "Nothing to print yet") %>
9
+ <% end %>
10
+ <% end %>
11
+ <%= render "ui/command_preview/picked" %>
12
+ </div>
@@ -0,0 +1,17 @@
1
+ <%# A point-of-sale till: F3 opens it, type part of a product's name or code, Enter adds it. %>
2
+ <div>
3
+ <%= render(UI::Command.new(dialog: true, shortcut: "F3", placeholder: "Product name or code…", label: "Add to sale")) do |command| %>
4
+ <% command.with_trigger(label: "Add a product", class: "w-64") %>
5
+ <% command.with_group(heading: "Products") do |group| %>
6
+ <% [["Basmati rice, 5 kg", "RIC-005", "$12.40"], ["Toor dal, 1 kg", "DAL-001", "$3.10"], ["Sunflower oil, 1 L", "OIL-101", "$2.85"],
7
+ ["Ghee, 500 g", "GHE-500", "$7.20"], ["Masala chai, 250 g", "TEA-250", "$4.50"], ["Wheat flour, 10 kg", "ATA-010", "$9.90"]].each do |name, code, price| %>
8
+ <% group.with_item(label: name, value: code, keywords: code, description: "#{code} · #{price}") %>
9
+ <% end %>
10
+ <% end %>
11
+ <% command.with_group(heading: "Sale") do |group| %>
12
+ <% group.with_item(label: "Hold this sale", value: "hold", icon: "pause") %>
13
+ <% group.with_item(label: "Apply a discount", value: "discount", icon: "percent", shortcut: "F6") %>
14
+ <% end %>
15
+ <% end %>
16
+ <%= render "ui/command_preview/picked" %>
17
+ </div>
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ class UI::CommandPreview < ViewComponent::Preview
4
+ # @label Playground
5
+ # @param dialog toggle "Opened with ⌘K, over the page"
6
+ # @param placeholder text
7
+ def playground(dialog: false, placeholder: "Type a command or search…")
8
+ render_with_template(locals: { dialog: dialog, placeholder: placeholder.presence })
9
+ end
10
+
11
+ # @label ⌘K, Over the Page
12
+ def dialog; render_with_template; end
13
+
14
+ # @label Searching the Server
15
+ def server_search; render_with_template; end
16
+
17
+ # @label On the Page
18
+ def inline; render_with_template; end
19
+
20
+ # @label Shortcuts That Work, Palette Closed or Open
21
+ def shortcuts; render_with_template; end
22
+
23
+ # @label Finding a Product at a Till
24
+ def till; render_with_template; end
25
+ end
@@ -0,0 +1,7 @@
1
+ <%# In your layout, once: render(UI::ConfirmDialog.new) %>
2
+ <%= render(UI::ButtonTo.new("/demo/projects/1", method: :delete, variant: :destructive,
3
+ data: { turbo_confirm: "Delete this project?",
4
+ confirm_description: "Its pages, files and history go too. This can't be undone.",
5
+ confirm_button: "Delete project", confirm_variant: "destructive" })) do |button| %>
6
+ <% button.with_leading_icon(name: "trash-2") %>Delete project
7
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <%# On a form, Turbo asks before submitting it. %>
2
+ <%= form_with url: "/demo/invoices", class: "flex w-full max-w-md flex-col gap-4",
3
+ data: { turbo_confirm: "Send this invoice to Acme Inc.?", confirm_button: "Send invoice" } do %>
4
+ <%= render(UI::Input.new(label: "Amount", name: "invoice[amount]", value: "1,200.00")) %>
5
+ <%= render(UI::Button.new(type: :submit, class: "self-start")) { "Send" } %>
6
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%# Turbo turns a data-turbo-method link into a form; the options still apply. %>
2
+ <%= link_to "Sign out of every device", "/demo/sessions", class: "text-sm font-medium text-primary underline-offset-4 hover:underline",
3
+ data: { turbo_method: :delete, turbo_confirm: "Sign out everywhere?",
4
+ confirm_description: "You'll need to sign in again on your phone and laptop.",
5
+ confirm_button: "Sign out" } %>
@@ -0,0 +1,3 @@
1
+ <%# Only data-turbo-confirm: the message is the title, with the default buttons. %>
2
+ <%= render(UI::ButtonTo.new("/demo/notifications/read", method: :patch, variant: :outline,
3
+ data: { turbo_confirm: "Mark every notification as read?" })) { "Mark all as read" } %>
@@ -0,0 +1,4 @@
1
+ <%= render(UI::ButtonTo.new("/demo/posts/1/publish", method: :patch,
2
+ data: { turbo_confirm: "Publish this post?",
3
+ confirm_description: "Subscribers get an email straight away.",
4
+ confirm_button: "Publish", confirm_cancel: "Not yet" })) { "Publish" } %>
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # These examples post to /demo/ paths; the docs site stops those requests and
4
+ # shows a toast instead, so confirming here changes nothing.
5
+ class UI::ConfirmDialogPreview < ViewComponent::Preview
6
+ # @label Destructive
7
+ def destructive; render_with_template; end
8
+
9
+ # @label With a Description
10
+ def with_description; render_with_template; end
11
+
12
+ # @label On a Link
13
+ def on_link; render_with_template; end
14
+
15
+ # @label In a Form
16
+ def in_form; render_with_template; end
17
+
18
+ # @label Plain
19
+ def plain; render_with_template; end
20
+ end
@@ -0,0 +1,6 @@
1
+ <% today = Date.current %>
2
+ <%= render(UI::DatePicker.new(range: true, label: "Financial year", class: "max-w-sm", presets: [
3
+ [ "This quarter", today.beginning_of_quarter, today ],
4
+ [ "Last quarter", today.prev_quarter.beginning_of_quarter, today.prev_quarter.end_of_quarter ],
5
+ [ "This financial year", Date.new(today.month >= 4 ? today.year : today.year - 1, 4, 1), today ]
6
+ ])) %>
@@ -0,0 +1,11 @@
1
+ <%# With a form builder, the fields take their names and values from the model. %>
2
+ <% promotion = Struct.new(:starts_on, :ends_on, :announced_on) do
3
+ def self.model_name = ActiveModel::Name.new(self, nil, "Promotion")
4
+ def model_name = self.class.model_name
5
+ def to_model = self
6
+ def persisted? = false
7
+ end.new(Date.current + 7, Date.current + 21, Date.current) %>
8
+ <%= form_with model: promotion, url: "/demo/promotions", class: "flex max-w-sm flex-col gap-6" do |f| %>
9
+ <%= render(UI::DatePicker.new(form: f, field: :announced_on, label: "Announced on")) %>
10
+ <%= render(UI::DatePicker.new(range: true, form: f, from_field: :starts_on, to_field: :ends_on, label: "Runs", presets: false)) %>
11
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%# Picking a range or a preset fires change on the field, so a filter form can send itself. %>
2
+ <form class="flex max-w-xl flex-wrap items-end gap-3" action="/demo/report" method="get">
3
+ <%= render(UI::DatePicker.new(range: true, label: "Period", hint: false, from: Date.current - 6, to: Date.current, class: "w-auto")) %>
4
+ <%= render(UI::Button.new(type: :submit, variant: :outline)) { "Show sales" } %>
5
+ </form>
@@ -1,7 +1,8 @@
1
- <div class="flex max-w-xs flex-col gap-6">
1
+ <div class="flex max-w-sm flex-col gap-6">
2
2
  <%= render(UI::DatePicker.new(name: "a", label: "Empty")) %>
3
3
  <%= render(UI::DatePicker.new(name: "b", label: "Required", required: true)) %>
4
- <%= render(UI::DatePicker.new(name: "c", label: "With an error", error: true, value: Date.new(2026, 10, 21))) %>
4
+ <%= render(UI::DatePicker.new(name: "c", label: "With an error", error: "Pick a date this year", value: Date.new(2025, 10, 21))) %>
5
5
  <%= render(UI::DatePicker.new(name: "d", label: "Disabled", disabled: true, value: Date.new(2026, 10, 21))) %>
6
- <%= render(UI::DatePicker.new(name: "e", label: "Without the hint", hint: false)) %>
6
+ <%= render(UI::DatePicker.new(range: true, label: "A range without presets", presets: false)) %>
7
+ <%= render(UI::DatePicker.new(range: true, label: "A range with an error", error: "A year at most", from: "2025-01-01", to: "2026-06-30")) %>
7
8
  </div>
@@ -1,13 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class UI::DatePickerPreview < ViewComponent::Preview
4
- # @label Default
5
- def default
6
- render_with_template
4
+ # @label Playground
5
+ # @param range toggle
6
+ # @param presets toggle
7
+ # @param hint toggle
8
+ # @param required toggle
9
+ # @param disabled toggle
10
+ def playground(range: false, presets: true, hint: true, required: false, disabled: false)
11
+ if range
12
+ render(UI::DatePicker.new(range: true, label: "Period", presets: presets, hint: hint, required: required, disabled: disabled,
13
+ from: Date.current.beginning_of_month, to: Date.current, class: "max-w-sm"))
14
+ else
15
+ render(UI::DatePicker.new(name: "date", label: "Date", hint: hint, required: required, disabled: disabled, class: "max-w-xs"))
16
+ end
7
17
  end
8
18
 
19
+ # @label A Date
20
+ def default; render_with_template; end
21
+
22
+ # @label A Range, for Report Filters
23
+ def range; render_with_template; end
24
+
25
+ # @label Your Own Presets
26
+ def custom_presets; render_with_template; end
27
+
28
+ # @label In a Form
29
+ def in_form; render_with_template; end
30
+
9
31
  # @label States
10
- def states
11
- render_with_template
12
- end
32
+ def states; render_with_template; end
13
33
  end
@@ -0,0 +1,7 @@
1
+ <div class="max-w-md">
2
+ <%= render(UI::Card.new) do |card| %>
3
+ <% card.with_content do %>
4
+ <%= render(UI::EmptyState.new(icon: "bell", heading_level: 4, class: "md:p-8", title: "No notifications", description: "We'll let you know when a build fails or someone mentions you.")) %>
5
+ <% end %>
6
+ <% end %>
7
+ </div>
@@ -0,0 +1,3 @@
1
+ <%= render(UI::EmptyState.new(icon: "search", title: "No results for “invoce”", description: "Check the spelling, or try a shorter search.")) do %>
2
+ <%= render(UI::Button.new(variant: :ghost, size: :sm)) { "Clear search" } %>
3
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <%= render(UI::EmptyState.new(icon: "upload", variant: :outline, title: "No files", description: "Upload a contract, invoice or receipt to keep it with this client.")) do %>
2
+ <%= render(UI::Button.new(variant: :outline, size: :sm)) { "Upload a file" } %>
3
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <%= render(UI::EmptyState.new(icon: "folder-kanban", title: "No projects yet", description: "You haven't created any projects. Start one from scratch or import an existing repository.")) do %>
2
+ <%= render(UI::Button.new) do |btn| %><% btn.with_leading_icon(name: "plus") %>Create project<% end %>
3
+ <%= render(UI::Button.new(variant: :outline)) { "Import" } %>
4
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <%= render(UI::EmptyState.new(title: "Nobody else is here", description: "Invite your team to share projects and reply to customers together.")) do |empty| %>
2
+ <% empty.with_media do %>
3
+ <%= render(UI::AvatarGroup.new(size: :lg)) do |group| %>
4
+ <% %w[JD AS RM].each { |initials| group.with_avatar { initials } } %>
5
+ <% end %>
6
+ <% end %>
7
+ <%= render(UI::Button.new(size: :sm)) do |btn| %><% btn.with_leading_icon(name: "users") %>Invite people<% end %>
8
+ <% end %>
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ class UI::EmptyStatePreview < ViewComponent::Preview
4
+ # @label Playground
5
+ # @param title text
6
+ # @param description text
7
+ # @param variant select { choices: [default, outline] }
8
+ def playground(title: "No messages", description: "When someone writes to you, it will show up here.", variant: :default)
9
+ render(UI::EmptyState.new(icon: "inbox", title: title, description: description, variant: variant.to_sym))
10
+ end
11
+
12
+ # @label With Actions
13
+ def with_actions; render_with_template; end
14
+
15
+ # @label Outline
16
+ def outline; render_with_template; end
17
+
18
+ # @label No Search Results
19
+ def no_results; render_with_template; end
20
+
21
+ # @label With an Avatar
22
+ def with_media; render_with_template; end
23
+
24
+ # @label In a Card
25
+ def in_card; render_with_template; end
26
+ end
@@ -1,3 +1,3 @@
1
1
  <div class="max-w-sm">
2
- <%= render(UI::FileField.new(label: "Attachments", hint: "Drop as many as you like", multiple: true)) %>
2
+ <%= render(UI::FileField.new(label: "Attachments", hint: "Drop as many as you like", multiple: true, preview: false)) %>
3
3
  </div>