nitro_kit 2.0.0.beta.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -0
  3. data/LICENSE +21 -28
  4. data/README.md +10 -9
  5. data/app/assets/stylesheets/nitro_kit.css +1660 -1401
  6. data/app/components/nitro_kit/accordion.rb +1 -13
  7. data/app/components/nitro_kit/app_navigation.rb +0 -12
  8. data/app/components/nitro_kit/app_shell.rb +5 -11
  9. data/app/components/nitro_kit/appearance_picker.rb +1 -7
  10. data/app/components/nitro_kit/combobox.rb +366 -21
  11. data/app/components/nitro_kit/command_palette.rb +7 -20
  12. data/app/components/nitro_kit/details_table.rb +5 -11
  13. data/app/components/nitro_kit/dropzone.rb +3 -15
  14. data/app/components/nitro_kit/field.rb +20 -2
  15. data/app/components/nitro_kit/pagination.rb +2 -8
  16. data/app/components/nitro_kit/settings_layout.rb +3 -9
  17. data/app/javascript/controllers/nk/app_shell_controller.js +2 -2
  18. data/app/javascript/controllers/nk/combobox_controller.js +308 -22
  19. data/app/javascript/controllers/nk/combobox_remote.js +70 -0
  20. data/app/javascript/controllers/nk/dropzone_controller.js +2 -2
  21. data/app/javascript/controllers/nk/tabs_controller.js +2 -2
  22. data/config/locales/en.yml +3 -0
  23. data/docs/agent_guide.md +43 -13
  24. data/docs/component_contracts.md +90 -61
  25. data/docs/customization.md +173 -35
  26. data/docs/initialization_prompt.md +4 -5
  27. data/docs/migration_1_to_2.md +10 -8
  28. data/docs/patterns/application_foundation.md +5 -0
  29. data/docs/patterns/composition.md +61 -0
  30. data/docs/patterns/crud_resource.md +5 -0
  31. data/docs/patterns/inset_workspace.md +21 -22
  32. data/docs/patterns/resource_form.md +65 -0
  33. data/docs/rails_integration.md +214 -2
  34. data/lib/generators/nitro_kit/install_generator.rb +5 -4
  35. data/lib/nitro_kit/installation.rb +327 -68
  36. data/lib/nitro_kit/migration_inventory.rb +18 -3
  37. data/lib/nitro_kit/version.rb +1 -1
  38. data/lib/rails/commands/nitro_kit/nitro_kit_command.rb +2 -2
  39. data/patterns/README.md +21 -0
  40. data/patterns/account-settings/files/app/components/ui/account_settings/account_deletion.rb +72 -0
  41. data/patterns/account-settings/files/app/components/ui/account_settings/base.rb +44 -0
  42. data/patterns/account-settings/files/app/components/ui/account_settings/page.rb +57 -0
  43. data/patterns/account-settings/files/app/components/ui/account_settings/preferences.rb +68 -0
  44. data/patterns/account-settings/files/app/components/ui/account_settings/profile.rb +86 -0
  45. data/patterns/account-settings/files/app/components/ui/account_settings/security.rb +69 -0
  46. data/patterns/account-settings/files/app/components/ui/account_settings/sessions.rb +86 -0
  47. data/patterns/account-settings/files/app/controllers/settings/account_deletions_controller.rb +35 -0
  48. data/patterns/account-settings/files/app/controllers/settings/base_controller.rb +12 -0
  49. data/patterns/account-settings/files/app/controllers/settings/other_sessions_controller.rb +8 -0
  50. data/patterns/account-settings/files/app/controllers/settings/preferences_controller.rb +27 -0
  51. data/patterns/account-settings/files/app/controllers/settings/profiles_controller.rb +20 -0
  52. data/patterns/account-settings/files/app/controllers/settings/securities_controller.rb +37 -0
  53. data/patterns/account-settings/files/app/controllers/settings/sessions_controller.rb +31 -0
  54. data/patterns/account-settings/files/app/models/account_settings/account_closure.rb +33 -0
  55. data/patterns/account-settings/files/app/models/account_settings/password_change.rb +42 -0
  56. data/patterns/account-settings/files/app/models/account_settings/session_summary.rb +45 -0
  57. data/patterns/account-settings/files/app/models/concerns/user/account_configurable.rb +18 -0
  58. data/patterns/account-settings/files/config/routes/account_settings.rb +10 -0
  59. data/patterns/account-settings/files/db/migrate/20260731020000_add_account_settings.rb +27 -0
  60. data/patterns/account-settings/files/test/controllers/settings/account_settings_flow_test.rb +84 -0
  61. data/patterns/account-settings/files/test/models/account_settings/password_change_test.rb +40 -0
  62. data/patterns/account-settings/files/test/system/account_settings_test.rb +52 -0
  63. data/patterns/account-settings/item.yml +4 -0
  64. data/patterns/account-settings/pattern.md +44 -0
  65. data/patterns/application-shell/files/app/assets/stylesheets/ui/application_shell.css +267 -0
  66. data/patterns/application-shell/files/app/components/ui/application_shell.rb +184 -0
  67. data/patterns/application-shell/item.yml +4 -0
  68. data/patterns/application-shell/pattern.md +110 -0
  69. data/patterns/authentication/files/app/components/ui/authentication/base.rb +11 -0
  70. data/patterns/authentication/files/app/components/ui/authentication/page.rb +53 -0
  71. data/patterns/authentication/files/app/components/ui/email_verifications/show.rb +62 -0
  72. data/patterns/authentication/files/app/components/ui/password_resets/new.rb +65 -0
  73. data/patterns/authentication/files/app/components/ui/passwords/edit.rb +72 -0
  74. data/patterns/authentication/files/app/components/ui/sessions/new.rb +58 -0
  75. data/patterns/authentication/files/app/components/ui/verification_emails/new.rb +59 -0
  76. data/patterns/authentication/files/app/controllers/concerns/authentication.rb +66 -0
  77. data/patterns/authentication/files/app/controllers/concerns/safe_return_navigation.rb +37 -0
  78. data/patterns/authentication/files/app/controllers/email_verifications_controller.rb +39 -0
  79. data/patterns/authentication/files/app/controllers/password_resets_controller.rb +33 -0
  80. data/patterns/authentication/files/app/controllers/passwords_controller.rb +51 -0
  81. data/patterns/authentication/files/app/controllers/sessions_controller.rb +42 -0
  82. data/patterns/authentication/files/app/controllers/verification_emails_controller.rb +33 -0
  83. data/patterns/authentication/files/app/jobs/authentication_delivery_job.rb +17 -0
  84. data/patterns/authentication/files/app/mailers/authentication_mailer.rb +15 -0
  85. data/patterns/authentication/files/app/models/authentication/credentials.rb +16 -0
  86. data/patterns/authentication/files/app/models/authentication/email_request.rb +17 -0
  87. data/patterns/authentication/files/app/models/concerns/user/email_verifiable.rb +40 -0
  88. data/patterns/authentication/files/app/models/session.rb +5 -0
  89. data/patterns/authentication/files/app/views/authentication_mailer/email_verification.html.erb +3 -0
  90. data/patterns/authentication/files/app/views/authentication_mailer/email_verification.text.erb +5 -0
  91. data/patterns/authentication/files/app/views/authentication_mailer/password_reset.html.erb +3 -0
  92. data/patterns/authentication/files/app/views/authentication_mailer/password_reset.text.erb +5 -0
  93. data/patterns/authentication/files/config/routes/authentication.rb +11 -0
  94. data/patterns/authentication/files/db/migrate/20260731000000_add_authentication_and_recovery.rb +13 -0
  95. data/patterns/authentication/files/test/controllers/authentication_flow_test.rb +103 -0
  96. data/patterns/authentication/files/test/controllers/safe_return_navigation_test.rb +18 -0
  97. data/patterns/authentication/files/test/mailers/authentication_mailer_test.rb +21 -0
  98. data/patterns/authentication/files/test/models/user_email_verifiable_test.rb +36 -0
  99. data/patterns/authentication/files/test/system/authentication_flow_test.rb +23 -0
  100. data/patterns/authentication/item.yml +12 -0
  101. data/patterns/authentication/pattern.md +54 -0
  102. data/patterns/crud-resource/files/app/assets/stylesheets/ui/projects.css +4 -0
  103. data/patterns/crud-resource/files/app/components/ui/projects/form.rb +89 -0
  104. data/patterns/crud-resource/files/app/components/ui/projects/index.rb +161 -0
  105. data/patterns/crud-resource/files/app/components/ui/projects/show.rb +84 -0
  106. data/patterns/crud-resource/files/app/controllers/projects/archivals_controller.rb +23 -0
  107. data/patterns/crud-resource/files/app/controllers/projects_controller.rb +70 -0
  108. data/patterns/crud-resource/files/app/models/project/archival.rb +8 -0
  109. data/patterns/crud-resource/files/app/models/project/event.rb +12 -0
  110. data/patterns/crud-resource/files/app/models/project/filter.rb +41 -0
  111. data/patterns/crud-resource/files/app/models/project.rb +41 -0
  112. data/patterns/crud-resource/files/app/views/projects/edit.html.erb +19 -0
  113. data/patterns/crud-resource/files/app/views/projects/index.html.erb +18 -0
  114. data/patterns/crud-resource/files/app/views/projects/new.html.erb +16 -0
  115. data/patterns/crud-resource/files/app/views/projects/show.html.erb +28 -0
  116. data/patterns/crud-resource/files/config/routes/crud_resource.rb +7 -0
  117. data/patterns/crud-resource/files/db/migrate/20260720000000_create_crud_resource.rb +37 -0
  118. data/patterns/crud-resource/files/test/controllers/projects_controller_test.rb +64 -0
  119. data/patterns/crud-resource/files/test/models/project_test.rb +34 -0
  120. data/patterns/crud-resource/files/test/support/crud_resource_test_helpers.rb +25 -0
  121. data/patterns/crud-resource/files/test/system/projects_crud_test.rb +87 -0
  122. data/patterns/crud-resource/item.yml +6 -0
  123. data/patterns/crud-resource/pattern.md +48 -0
  124. data/patterns/file-uploads/files/app/assets/stylesheets/ui/uploads.css +133 -0
  125. data/patterns/file-uploads/files/app/components/ui/uploads/base.rb +30 -0
  126. data/patterns/file-uploads/files/app/components/ui/uploads/index.rb +188 -0
  127. data/patterns/file-uploads/files/app/components/ui/uploads/page.rb +33 -0
  128. data/patterns/file-uploads/files/app/controllers/uploads/base_controller.rb +29 -0
  129. data/patterns/file-uploads/files/app/controllers/uploads/direct_uploads_controller.rb +55 -0
  130. data/patterns/file-uploads/files/app/controllers/uploads/retries_controller.rb +14 -0
  131. data/patterns/file-uploads/files/app/controllers/uploads_controller.rb +40 -0
  132. data/patterns/file-uploads/files/app/jobs/upload_blob_cleanup_job.rb +9 -0
  133. data/patterns/file-uploads/files/app/jobs/upload_processing_job.rb +10 -0
  134. data/patterns/file-uploads/files/app/jobs/upload_repair_job.rb +17 -0
  135. data/patterns/file-uploads/files/app/models/concerns/team/uploadable.rb +9 -0
  136. data/patterns/file-uploads/files/app/models/upload.rb +295 -0
  137. data/patterns/file-uploads/files/config/recurring/uploads.yml +7 -0
  138. data/patterns/file-uploads/files/config/routes/uploads.rb +5 -0
  139. data/patterns/file-uploads/files/db/migrate/20260802000000_add_file_uploads.rb +30 -0
  140. data/patterns/file-uploads/files/test/controllers/uploads_flow_test.rb +77 -0
  141. data/patterns/file-uploads/files/test/fixtures/files/workspace.png.base64 +1 -0
  142. data/patterns/file-uploads/files/test/fixtures/uploads.yml +17 -0
  143. data/patterns/file-uploads/files/test/models/upload_test.rb +55 -0
  144. data/patterns/file-uploads/files/test/system/file_uploads_test.rb +30 -0
  145. data/patterns/file-uploads/item.yml +4 -0
  146. data/patterns/file-uploads/pattern.md +71 -0
  147. data/patterns/nitro-kit-1-upgrade/files/docs/nitro_kit_1_upgrade.md +57 -0
  148. data/patterns/nitro-kit-1-upgrade/item.yml +4 -0
  149. data/patterns/nitro-kit-1-upgrade/pattern.md +30 -0
  150. data/patterns/onboarding/files/app/assets/stylesheets/ui/onboarding.css +55 -0
  151. data/patterns/onboarding/files/app/components/ui/onboarding/base.rb +11 -0
  152. data/patterns/onboarding/files/app/components/ui/onboarding/branch_form.rb +36 -0
  153. data/patterns/onboarding/files/app/components/ui/onboarding/details_form.rb +67 -0
  154. data/patterns/onboarding/files/app/components/ui/onboarding/invitation_plan_form.rb +48 -0
  155. data/patterns/onboarding/files/app/components/ui/onboarding/page.rb +75 -0
  156. data/patterns/onboarding/files/app/components/ui/onboarding/review.rb +51 -0
  157. data/patterns/onboarding/files/app/components/ui/onboarding/show.rb +32 -0
  158. data/patterns/onboarding/files/app/controllers/concerns/requires_finished_onboarding.rb +14 -0
  159. data/patterns/onboarding/files/app/controllers/onboarding/base_controller.rb +30 -0
  160. data/patterns/onboarding/files/app/controllers/onboarding/branches_controller.rb +16 -0
  161. data/patterns/onboarding/files/app/controllers/onboarding/completions_controller.rb +13 -0
  162. data/patterns/onboarding/files/app/controllers/onboarding/details_controller.rb +16 -0
  163. data/patterns/onboarding/files/app/controllers/onboarding/invitation_plans_controller.rb +20 -0
  164. data/patterns/onboarding/files/app/controllers/onboardings_controller.rb +7 -0
  165. data/patterns/onboarding/files/app/jobs/onboarding_invitation_delivery_job.rb +15 -0
  166. data/patterns/onboarding/files/app/models/concerns/team/onboardable.rb +23 -0
  167. data/patterns/onboarding/files/app/models/onboarding/completion.rb +17 -0
  168. data/patterns/onboarding/files/app/models/onboarding/invitation_delivery.rb +14 -0
  169. data/patterns/onboarding/files/app/models/onboarding.rb +174 -0
  170. data/patterns/onboarding/files/config/routes/onboarding.rb +11 -0
  171. data/patterns/onboarding/files/db/migrate/20260731010000_create_onboarding.rb +60 -0
  172. data/patterns/onboarding/files/test/controllers/onboarding_flow_test.rb +62 -0
  173. data/patterns/onboarding/files/test/fixtures/onboarding_completions.yml +3 -0
  174. data/patterns/onboarding/files/test/fixtures/onboardings.yml +25 -0
  175. data/patterns/onboarding/files/test/jobs/onboarding_invitation_delivery_job_test.rb +18 -0
  176. data/patterns/onboarding/files/test/models/onboarding_test.rb +60 -0
  177. data/patterns/onboarding/files/test/system/onboarding_flow_test.rb +39 -0
  178. data/patterns/onboarding/item.yml +4 -0
  179. data/patterns/onboarding/pattern.md +53 -0
  180. data/patterns/subscription-billing/files/app/components/ui/billing/base.rb +39 -0
  181. data/patterns/subscription-billing/files/app/components/ui/billing/checkout_result.rb +64 -0
  182. data/patterns/subscription-billing/files/app/components/ui/billing/page.rb +33 -0
  183. data/patterns/subscription-billing/files/app/components/ui/billing/show.rb +149 -0
  184. data/patterns/subscription-billing/files/app/controllers/billing/base_controller.rb +16 -0
  185. data/patterns/subscription-billing/files/app/controllers/billing/checkouts_controller.rb +65 -0
  186. data/patterns/subscription-billing/files/app/controllers/billing/portals_controller.rb +18 -0
  187. data/patterns/subscription-billing/files/app/controllers/billing_controller.rb +17 -0
  188. data/patterns/subscription-billing/files/app/controllers/webhooks/stripe_events_controller.rb +21 -0
  189. data/patterns/subscription-billing/files/app/jobs/billing/stripe_event_job.rb +16 -0
  190. data/patterns/subscription-billing/files/app/jobs/billing/subscription_reconciliation_job.rb +16 -0
  191. data/patterns/subscription-billing/files/app/jobs/billing/subscription_reconciliation_sweep_job.rb +9 -0
  192. data/patterns/subscription-billing/files/app/models/billing/checkout.rb +58 -0
  193. data/patterns/subscription-billing/files/app/models/billing/plan.rb +19 -0
  194. data/patterns/subscription-billing/files/app/models/billing/stripe_event.rb +73 -0
  195. data/patterns/subscription-billing/files/app/models/billing/subscription.rb +106 -0
  196. data/patterns/subscription-billing/files/app/models/concerns/team/billable.rb +36 -0
  197. data/patterns/subscription-billing/files/config/initializers/stripe.rb +29 -0
  198. data/patterns/subscription-billing/files/config/routes/subscription_billing.rb +10 -0
  199. data/patterns/subscription-billing/files/db/migrate/20260801000000_add_subscription_billing.rb +61 -0
  200. data/patterns/subscription-billing/files/test/controllers/billing_flow_test.rb +60 -0
  201. data/patterns/subscription-billing/files/test/models/billing/subscription_test.rb +40 -0
  202. data/patterns/subscription-billing/files/test/system/subscription_billing_test.rb +28 -0
  203. data/patterns/subscription-billing/item.yml +4 -0
  204. data/patterns/subscription-billing/pattern.md +59 -0
  205. data/patterns/team-management/files/app/components/ui/invitations/acceptance.rb +33 -0
  206. data/patterns/team-management/files/app/components/ui/teams/index.rb +87 -0
  207. data/patterns/team-management/files/app/components/ui/teams/invitation_form.rb +51 -0
  208. data/patterns/team-management/files/app/components/ui/teams/member_form.rb +78 -0
  209. data/patterns/team-management/files/app/components/ui/teams/members.rb +125 -0
  210. data/patterns/team-management/files/app/controllers/invitations/acceptances_controller.rb +29 -0
  211. data/patterns/team-management/files/app/controllers/teams/base_controller.rb +18 -0
  212. data/patterns/team-management/files/app/controllers/teams/invitations_controller.rb +42 -0
  213. data/patterns/team-management/files/app/controllers/teams/memberships_controller.rb +53 -0
  214. data/patterns/team-management/files/app/controllers/teams_controller.rb +30 -0
  215. data/patterns/team-management/files/app/mailers/team_invitation_mailer.rb +10 -0
  216. data/patterns/team-management/files/app/models/concerns/current_team.rb +13 -0
  217. data/patterns/team-management/files/app/models/concerns/user_teams.rb +37 -0
  218. data/patterns/team-management/files/app/models/invitation.rb +41 -0
  219. data/patterns/team-management/files/app/models/membership.rb +45 -0
  220. data/patterns/team-management/files/app/models/team.rb +25 -0
  221. data/patterns/team-management/files/app/views/invitations/acceptances/show.html.erb +1 -0
  222. data/patterns/team-management/files/app/views/team_invitation_mailer/invite.html.erb +10 -0
  223. data/patterns/team-management/files/app/views/team_invitation_mailer/invite.text.erb +7 -0
  224. data/patterns/team-management/files/app/views/teams/index.html.erb +15 -0
  225. data/patterns/team-management/files/app/views/teams/invitations/new.html.erb +22 -0
  226. data/patterns/team-management/files/app/views/teams/memberships/edit.html.erb +22 -0
  227. data/patterns/team-management/files/app/views/teams/memberships/index.html.erb +20 -0
  228. data/patterns/team-management/files/config/routes/team_management.rb +11 -0
  229. data/patterns/team-management/files/db/migrate/20260717000000_create_team_management.rb +31 -0
  230. data/patterns/team-management/files/test/models/invitation_test.rb +28 -0
  231. data/patterns/team-management/files/test/models/membership_test.rb +29 -0
  232. data/patterns/team-management/files/test/models/team_test.rb +31 -0
  233. data/patterns/team-management/files/test/support/team_management_test_helpers.rb +22 -0
  234. data/patterns/team-management/item.yml +4 -0
  235. data/patterns/team-management/pattern.md +47 -0
  236. data/patterns/webhook-deliveries/files/app/assets/stylesheets/ui/webhooks.css +179 -0
  237. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/base.rb +38 -0
  238. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/delivery.rb +160 -0
  239. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/endpoint.rb +149 -0
  240. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/form.rb +75 -0
  241. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/index.rb +142 -0
  242. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/page.rb +33 -0
  243. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/secret.rb +38 -0
  244. data/patterns/webhook-deliveries/files/app/controllers/webhook_deliveries/replays_controller.rb +13 -0
  245. data/patterns/webhook-deliveries/files/app/controllers/webhook_deliveries_controller.rb +7 -0
  246. data/patterns/webhook-deliveries/files/app/controllers/webhook_endpoints/secrets_controller.rb +41 -0
  247. data/patterns/webhook-deliveries/files/app/controllers/webhook_endpoints_controller.rb +67 -0
  248. data/patterns/webhook-deliveries/files/app/controllers/webhooks/base_controller.rb +15 -0
  249. data/patterns/webhook-deliveries/files/app/jobs/webhook_delivery_job.rb +9 -0
  250. data/patterns/webhook-deliveries/files/app/jobs/webhook_delivery_repair_job.rb +11 -0
  251. data/patterns/webhook-deliveries/files/app/models/concerns/team/webhookable.rb +11 -0
  252. data/patterns/webhook-deliveries/files/app/models/webhook/attempt.rb +30 -0
  253. data/patterns/webhook-deliveries/files/app/models/webhook/delivery.rb +268 -0
  254. data/patterns/webhook-deliveries/files/app/models/webhook/endpoint.rb +58 -0
  255. data/patterns/webhook-deliveries/files/app/models/webhook/event.rb +98 -0
  256. data/patterns/webhook-deliveries/files/app/models/webhook/secret_reveal.rb +53 -0
  257. data/patterns/webhook-deliveries/files/app/models/webhook/signature.rb +22 -0
  258. data/patterns/webhook-deliveries/files/app/models/webhook/transport.rb +176 -0
  259. data/patterns/webhook-deliveries/files/app/views/webhook_deliveries/show.html.erb +5 -0
  260. data/patterns/webhook-deliveries/files/app/views/webhook_endpoints/edit.html.erb +1 -0
  261. data/patterns/webhook-deliveries/files/app/views/webhook_endpoints/index.html.erb +6 -0
  262. data/patterns/webhook-deliveries/files/app/views/webhook_endpoints/new.html.erb +1 -0
  263. data/patterns/webhook-deliveries/files/app/views/webhook_endpoints/secrets/new.html.erb +1 -0
  264. data/patterns/webhook-deliveries/files/app/views/webhook_endpoints/show.html.erb +7 -0
  265. data/patterns/webhook-deliveries/files/config/recurring/webhooks.yml +4 -0
  266. data/patterns/webhook-deliveries/files/config/routes/webhook_deliveries.rb +10 -0
  267. data/patterns/webhook-deliveries/files/db/migrate/20260803000000_add_webhook_deliveries.rb +126 -0
  268. data/patterns/webhook-deliveries/files/test/controllers/webhook_endpoints_flow_test.rb +48 -0
  269. data/patterns/webhook-deliveries/files/test/models/webhook/delivery_test.rb +70 -0
  270. data/patterns/webhook-deliveries/files/test/system/webhook_deliveries_test.rb +29 -0
  271. data/patterns/webhook-deliveries/item.yml +4 -0
  272. data/patterns/webhook-deliveries/pattern.md +120 -0
  273. data/plugins/nitro-kit/.codex-plugin/plugin.json +4 -4
  274. data/plugins/nitro-kit/skills/nitro-kit-hotwire/SKILL.md +7 -9
  275. data/plugins/nitro-kit/skills/nitro-kit-hotwire/agents/openai.yaml +1 -1
  276. data/plugins/nitro-kit/skills/nitro-kit-rails/SKILL.md +10 -9
  277. data/plugins/nitro-kit/skills/nitro-kit-rails/agents/openai.yaml +1 -1
  278. data/plugins/nitro-kit/skills/nitro-kit-ui/SKILL.md +27 -16
  279. data/plugins/nitro-kit/skills/nitro-kit-ui/agents/openai.yaml +1 -1
  280. data/src/stylesheets/nitro_kit/components/accordion.css +40 -40
  281. data/src/stylesheets/nitro_kit/components/alert.css +7 -6
  282. data/src/stylesheets/nitro_kit/components/app_navigation.css +50 -41
  283. data/src/stylesheets/nitro_kit/components/app_shell.css +371 -280
  284. data/src/stylesheets/nitro_kit/components/appearance_picker.css +38 -38
  285. data/src/stylesheets/nitro_kit/components/avatar.css +3 -3
  286. data/src/stylesheets/nitro_kit/components/avatar_stack.css +18 -18
  287. data/src/stylesheets/nitro_kit/components/badge.css +5 -2
  288. data/src/stylesheets/nitro_kit/components/button.css +57 -49
  289. data/src/stylesheets/nitro_kit/components/button_group.css +14 -14
  290. data/src/stylesheets/nitro_kit/components/checkbox.css +24 -24
  291. data/src/stylesheets/nitro_kit/components/checkbox_group.css +13 -13
  292. data/src/stylesheets/nitro_kit/components/combobox.css +152 -25
  293. data/src/stylesheets/nitro_kit/components/command_palette.css +59 -59
  294. data/src/stylesheets/nitro_kit/components/control_group.css +71 -54
  295. data/src/stylesheets/nitro_kit/components/details_table.css +9 -9
  296. data/src/stylesheets/nitro_kit/components/dialog.css +8 -12
  297. data/src/stylesheets/nitro_kit/components/dropdown.css +22 -26
  298. data/src/stylesheets/nitro_kit/components/dropzone.css +97 -100
  299. data/src/stylesheets/nitro_kit/components/empty_state.css +1 -0
  300. data/src/stylesheets/nitro_kit/components/field.css +26 -30
  301. data/src/stylesheets/nitro_kit/components/fieldset.css +2 -2
  302. data/src/stylesheets/nitro_kit/components/input.css +6 -14
  303. data/src/stylesheets/nitro_kit/components/layout.css +165 -165
  304. data/src/stylesheets/nitro_kit/components/page_header.css +3 -3
  305. data/src/stylesheets/nitro_kit/components/pagination.css +66 -49
  306. data/src/stylesheets/nitro_kit/components/pagination_bar.css +6 -6
  307. data/src/stylesheets/nitro_kit/components/palette.css +24 -22
  308. data/src/stylesheets/nitro_kit/components/progressive_image.css +38 -41
  309. data/src/stylesheets/nitro_kit/components/radio_button.css +19 -19
  310. data/src/stylesheets/nitro_kit/components/radio_button_group.css +43 -43
  311. data/src/stylesheets/nitro_kit/components/rich_text_area.css +4 -4
  312. data/src/stylesheets/nitro_kit/components/select.css +2 -2
  313. data/src/stylesheets/nitro_kit/components/settings_layout.css +17 -18
  314. data/src/stylesheets/nitro_kit/components/settings_section.css +12 -12
  315. data/src/stylesheets/nitro_kit/components/sheet.css +10 -10
  316. data/src/stylesheets/nitro_kit/components/stat_grid.css +9 -9
  317. data/src/stylesheets/nitro_kit/components/switch.css +23 -23
  318. data/src/stylesheets/nitro_kit/components/table.css +27 -27
  319. data/src/stylesheets/nitro_kit/components/tabs.css +32 -34
  320. data/src/stylesheets/nitro_kit/components/toolbar.css +6 -6
  321. data/src/stylesheets/nitro_kit/components/tooltip.css +26 -28
  322. data/src/stylesheets/nitro_kit/layers.css +2 -1
  323. data/src/stylesheets/nitro_kit/reset.css +9 -9
  324. data/src/stylesheets/nitro_kit/tailwind.css +6 -2
  325. data/src/stylesheets/nitro_kit/tokens.css +18 -9
  326. metadata +238 -2
@@ -4,7 +4,7 @@
4
4
  API. This table is also parsed by the gallery; keep every row to four cells and
5
5
  escape literal pipe characters.
6
6
 
7
- This is the shipped public catalog for `2.0.0.beta.3`. It records current Ruby
7
+ This is the shipped public catalog for `2.0.0`. It records current Ruby
8
8
  construction, rendered roots, closed vocabularies, compound cardinalities, and
9
9
  integration boundaries. For task guidance, start with the
10
10
  [agent guide](agent_guide.md) or [Rails integration](rails_integration.md).
@@ -91,6 +91,8 @@ NitroKit::Field.new(
91
91
  errors: nil,
92
92
  options: nil,
93
93
  option_tags: nil,
94
+ src: nil,
95
+ selected: nil,
94
96
  include_blank: nil,
95
97
  prompt: nil,
96
98
  id: nil,
@@ -128,27 +130,54 @@ NitroKit::Field.new(
128
130
  )
129
131
  ```
130
132
 
131
- `rows:`, `cols:`, and `wrap:` require `as: :textarea`. Every control keyword is owned by the composed atom; passing one through `control_html:` raises and names the keyword.
133
+ `rows:`, `cols:`, and `wrap:` require `as: :textarea`. `src:` and `selected:` require `as: :combobox`. Every control keyword is owned by the composed atom; passing one through `control_html:` raises and names the keyword.
132
134
 
133
135
  Field types are `button color date datetime datetime_local email file hidden month number password range rich_text search string tel text time url week select combobox textarea checkbox radio radio_button radio_group switch`. `string` becomes a text input; `datetime` and `datetime_local` become `datetime-local`. `month` and `week` preserve those native input types but add no cross-browser normalization or picker; their ISO format, range, and step rules remain server responsibilities. Use `as: :select` with explicit application-owned options when exact selection matters. `rich_text` captures the host application's installed `rich_text_area` helper and wraps it in `RichTextArea`.
134
136
 
135
137
  ### Structured content and interaction
136
138
 
137
- | Component | Constructor-specific options | Root and closed vocabulary | Compound contract |
138
- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
139
- | `Accordion` | required `id:`; `mode: :multiple` | `div[data-nk=accordion]`; modes `multiple single` | Requires one or more uniquely keyed `item(key, title:, expanded: false)` declarations. Each item renders native `details` and `summary`, so find-in-page and fragment navigation reveal matching closed content without a controller. Single mode gives every disclosure the same `name` and accepts at most one initially expanded item; multiple mode omits `name`. There is no disabled item or controller. |
140
- | `Card` | `size: :md`, `variant: :default`, `id: nil` | `article[data-nk=card][data-size][data-variant]`; sizes `sm md lg`; variants `default muted outline`; title levels `1..6` | Requires a content block. `header`, `title`, `description`, `actions`, `body`, `footer`, `divider`, and `full` render immediately; their count and order are not constrained. `title`, `description`, `body`, and `footer` require non-blank text or a block; `header`, `actions`, and `full` require a block. `header` lays out a title and description beside trailing `actions`; `actions` inside a footer push to its end. The shadowed Phlex elements remain available as `html_title`, `html_body`, `html_header`, and `html_footer`. Sizes coordinate padding, gaps, corners, and title size. See Card sizing and surfaces below. |
141
- | `Combobox` | required `id:`, `name:`, `label:`, `options:`; `value: nil`, `placeholder: nil`, `include_blank: true`, `placement: :bottom_start`, `required: false`, `disabled: false`, `autocomplete: "off"`, `control_aria: {}` | `div[data-nk=combobox]`; placements `bottom_start bottom_end top_start top_end` | Options are a non-empty set of unique typed choices; `Choice#description` renders as a described secondary line in the listbox. A non-nil value must match a declared option. `label:` renders a real `Label` bound to `#{id}-input`; `label: false` requires `control_aria: { label: }` or `{ labelledby: }` and names the input, listbox, and native select from it. `placeholder:` is the input hint and `include_blank:` is the native blank option. The named native Select is the truthful no-JavaScript control and submission source; Stimulus reveals and synchronizes the searchable combobox enhancement. |
142
- | `Dialog` | required `id:`; `dismissible: true` | `div[data-nk=dialog]` owning exactly one native dialog | Requires a declaration block with exactly one `panel(title:, description: nil, nonmodal: false)` and at most one `trigger`, which forwards Button treatment options including `icon:`, `icon_end:`, and `label:`, matching Sheet and Dropdown. Nitro renders trigger then panel, and inside the panel it owns close button, title, description, then the captured application content, so a sticky close control survives long scrolling content. At most one `close_button(label:)` may be declared inside the panel block, whose label defaults to `I18n.t("nitro_kit.dialog.close")`; `dismissible: false` renders none and declaring one raises. `nonmodal: true` is the explicit server-open state and cannot be combined with a trigger, whose `command="show-modal"` would open the same panel modally. Trigger and close controls use native `command`/`commandfor`. Turbo confirmations are deliberately not a Dialog runtime: applications own inline confirmation dialogs, see [destructive action](patterns/destructive_action.md). |
143
- | `DetailsTable` | `record`, `caption: nil`, `label: nil`, `empty_text: nil`, `boolean_labels: nil`, `route_base: nil`, `id: nil` | `div[data-nk=details-table]` containing a slotted `Table` | Requires one or more fields with unique keys, declared inside the render block. `field(attribute, label: nil, value:)` distinguishes omitted and explicit nil values; a block receives the resolved value. `fields(*attributes)` adds ordinary resolved fields. `caption:` names the table visibly and `label:` names it through `aria-label`; empty and boolean copy remain caller-owned keywords; when omitted they come from `nitro_kit.details_table.empty`, `.boolean_true`, and `.boolean_false`. |
144
- | `Dropdown` | `id: nil`, `placement: :bottom_start` | `div[data-nk=dropdown]`; placements `bottom_start bottom_end top_start top_end`; item variants `default destructive`; item types `button submit reset` | Requires a declaration block, exactly one `trigger`, and at least one `item`. `id:` defaults to a generated `nk-dropdown-*` identifier and otherwise follows the shared fragment-safe identifier contract. `trigger(text = nil, variant:, size:, icon:, icon_end:, label:, disabled:)` forwards to Button, so an icon-only trigger keeps square icon-only geometry; `variant:` and `size:` are validated against Button vocabularies when the trigger is declared. `item(text = nil, href:, icon:, variant:, type:, disabled:)` renders an optional `dropdown-item-icon` slot and emits the owned `data-variant` on the item slot, matching the `Toast::Item` precedent; caller `data-variant` stays reserved. The native `popover=auto` owns open state and implicit invoker relationships. Optional visual titles are presentational to the menu accessibility tree; separators remain native. A small controller adds menu focus navigation, native outside-pointer dismissal fallback for capable Popover engines, and focus restoration without mirroring state. The fallback ignores composed-path interactions inside the trigger or menu and releases its listener on every close and disconnect. |
145
- | `ProgressiveImage` | required `attachment:`; `alt: nil`, `size: :md`, `decorative: false`, `id: nil` | `div[data-nk=progressive-image]`; sizes `sm md lg`; states `empty loading loaded error` | Owns placeholder, image, and fallback slots. The placeholder is decorative and the full image is the only image in the accessibility tree. `alt:` is required unless `decorative: true`, and non-decorative attached images require non-blank alt text. The fallback surfaces that alt text, falling back to `I18n.t("nitro_kit.progressive_image.unavailable")` when there is none. Only an attached image can change after render, so only that fallback is a `role="status"` live region; the never-attached empty state is ordinary static content. `data-enhanced` on the root is the controller-connected flag shared with `AppShell`; it is deliberately not `data-state`, which already carries the closed load-state vocabulary. |
146
- | `Sheet` | required `id:`; `side: :right`, `size: :md`, `close_label:` | layout-transparent `div[data-nk=sheet][data-side][data-size]` owning one native dialog; sides `left right`; sizes `sm md lg` | Requires exactly one Button-backed `trigger` and one `panel(title:, description: nil)`; both carry the shared `html:`, `aria:`, `data:`, and `desperately_need_a_class:` boundary, panel attributes landing on the dialog element as in Dialog. The native modal panel fills the block axis and enters from the selected inline edge. Nitro owns close, title, description, body order, backdrop dismissal, and native focus containment. Use Sheet for contextual narrow navigation or details; use AppShell for whole-application navigation and Dialog for centered decisions. |
147
- | `Table` | `sort: nil`, `direction: nil`, `id: nil`, `table_html: {}`, `table_aria: {}`, `table_data: {}` | `div[data-nk=table]` wrapping a native table; cell alignments `left center right`; header scopes `col row`; directions `asc desc` or nil | Every table uses its horizontal scroll wrapper and non-wrapping cells at all viewport widths; columns and controls retain their natural size. Two phases: `caption`, `thead`, and `tbody` collect declarations so the component owns caption → head → body order, while `tr`, `th`, and `td` render immediately inside a collected block and validate before emitting their own markup. Rows must be declared inside a head/body and cells inside a row; text and block content are mutually exclusive. `align: :left` is the default and emits no attribute. Sorting lives on `Table` itself; there is no separate `SortableTable`. `th(text = nil, align: :left, scope: :col, sort: nil, href: nil, sort_data: {})` renders a caller-owned sort link with a unique key, falling back to the humanized sort key when no header text is given; `href:` without `sort:` raises and `sort:` requires a non-blank String `href:`. The active header owns `aria-sort="ascending"`/`"descending"` and a direction Icon, other sortable headers own `aria-sort="none"` and a neutral Icon. `sort:` must be declared inside `thead`. `sort:` and `direction:` are both set or both nil and mirror onto the root as `data-sort` and `data-direction`; `direction:` must be a Symbol or String. A declared caption receives a deterministic id (`<root id>-caption`, generated when the table has no id) and turns the scroll wrapper into a focusable `role="region"` labelled by it; without a caption the wrapper stays a plain div. `table_html:`, `table_aria:`, and `table_data:` address the inner `table` element. |
148
- | `Tabs` | required `id:`; `default: nil`, `label:` defaulting to `I18n.t("nitro_kit.tabs.label")`, `orientation: :horizontal`, `activation: :automatic` | `div[data-nk=tabs]`; orientations `horizontal vertical`; activations `automatic manual` | Requires one or more uniquely keyed tabs with content and at least one enabled tab. An explicit default must be declared and enabled. Every panel remains available in the no-JavaScript baseline; Stimulus adds APG selection, `hidden="until-found"` inactive panels, find-in-page activation, roving focus, and keyboard activation after enhancement. |
149
- | `Toast` | `duration: 5000`, `label:` defaulting to `I18n.t("nitro_kit.toast.label")`, `id: "nk-toast"` | `section[data-nk=toast][role=region]` wrapping `ol[data-slot=toast-list]`; item variants `default info success warning error` | Accepts zero or more `item(title:, description:, variant:, dismissible:, id:)` declarations inside its render block. Each item requires a title, description, or block. Items carry `role="status"`, or `role="alert"` for the error variant, plus `aria-atomic`, so server-rendered flash items are announced without waiting for a DOM mutation; caller `aria:` colliding with the owned region label or item atomic raises. Every item is `data-turbo-temporary`, so a cached page never replays stale feedback; the region and list survive. The list id is the toast id plus `-list`, so a Turbo Stream can append to it: `turbo_stream.append("nk-toast-list") { render NitroKit::Toast::Item.new(title: "Saved", variant: :success) }`. Items with `dismissible: false` render no dismiss button and are never auto-dismissed; the application owns their removal. `Toast::FlashMessages` maps an enumerable Rails flash into items through explicit keywords. The dismiss control is named from `nitro_kit.toast.dismiss`. |
150
- | `Tooltip` | required `id:`, `content:`; `placement: :top` | `span[data-nk=tooltip]`; placements `top right bottom left` | Requires exactly one trigger. The default `as: NitroKit::Button` path supports native buttons and links; Button options on any other trigger raise. `as: :div` and `:span` create explicit focusable HTML descriptions. `as: :custom` yields `TriggerAttributes(html:, aria:, data:)`; applications must forward all three boundaries to the actual focusable control, including ButtonTo's nested Button or a Dialog trigger. Nitro appends the tooltip ID to existing `aria-describedby`. CSS owns hover/focus visibility; the controller's document-level Escape listener dismisses only while the tooltip is shown, so a wrapping dialog's cancel is not swallowed. |
151
- | `Typeset` | `id: nil` | `div[data-nk=typeset]` | Requires direct content. Styles semantic rich content without constraining its width. Nested Nitro component roots and `data-typeset="off"` regions establish styling boundaries. The shipped stylesheet retains the `@scope` path and includes a low-specificity fallback for engines that do not parse `@scope`, including Firefox through 145. That fallback covers root typography plus explicitly anchored direct-child headings, flow elements, lists, code/pre, tables, and links within those supported elements; it is a documented semantic subset rather than full descendant parity. |
139
+ | Component | Constructor-specific options | Root and closed vocabulary | Compound contract |
140
+ | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
141
+ | `Accordion` | required `id:`; `mode: :multiple` | `div[data-nk=accordion]`; modes `multiple single` | Requires one or more uniquely keyed `item(key, title:, expanded: false)` declarations. Each item renders native `details` and `summary`, so find-in-page and fragment navigation reveal matching closed content without a controller. Single mode gives every disclosure the same `name` and accepts at most one initially expanded item; multiple mode omits `name`. There is no disabled item or controller. |
142
+ | `Card` | `size: :md`, `variant: :default`, `id: nil` | `article[data-nk=card][data-size][data-variant]`; sizes `sm md lg`; variants `default muted outline`; title levels `1..6` | Requires a content block. `header`, `title`, `description`, `actions`, `body`, `footer`, `divider`, and `full` render immediately; their count and order are not constrained. `title`, `description`, `body`, and `footer` require non-blank text or a block; `header`, `actions`, and `full` require a block. `header` lays out a title and description beside trailing `actions`; `actions` inside a footer push to its end. The shadowed Phlex elements remain available as `html_title`, `html_body`, `html_header`, and `html_footer`. Sizes coordinate padding, gaps, corners, and title size. See Card sizing and surfaces below. |
143
+ | `Combobox` | required `id:`, `name:`, `label:`, and either `options:` (local) or `src:` (remote); `value: nil`, `selected: []`, `multiple: false`, `placeholder: nil`, `include_blank: true`, `placement: :bottom_start`, `required: false`, `disabled: false`, `autocomplete: "off"`, `control_aria: {}` | `div[data-nk=combobox]`; placements `bottom_start bottom_end top_start top_end`; remote results `ul[data-nk=combobox-results]` | Local options are a non-empty set of unique typed choices; `Choice#description` renders as a described secondary line in the listbox. A non-nil `value:` must match a declared option, otherwise construction raises; recover a stale or deleted id as shown under [Stale combobox values](#stale-combobox-values). `label:` renders a real `Label` bound to `#{id}-input`; `label: false` requires `control_aria: { label: }` or `{ labelledby: }` and names the input, listbox, and native select from it. `placeholder:` is the input hint and `include_blank:` is the native blank option. The named native Select is the truthful no-JavaScript control and submission source; Stimulus reveals and synchronizes the searchable combobox enhancement. `src:` switches to remote mode: `options:`, `value:`, and a non-default `include_blank:` raise, and `selected:` holds the current `Choice`s (labels included, at most one unless `multiple: true`). The endpoint answers `GET src?query=…` with `NitroKit::Combobox::Results.new(id:)` rendered without a layout, declaring `results.option(label, value:, description: nil, disabled: false)` and `results.action(label, url:, params: {}, method: :post, description: nil)` (methods `post patch put`) inside its block. Choosing an action submits `params` as form fields with the CSRF token; the endpoint answers with Results whose first option is then selected. Single remote mode submits one hidden `name` field; `multiple: true` (remote only) appends `[]` to `name:` unless present, always submits Rails' blank `name[]` entry, and renders `combobox-selections` chips, each with a `combobox-remove` button and its own hidden `name[]` field. |
144
+ | `Dialog` | required `id:`; `dismissible: true` | `div[data-nk=dialog]` owning exactly one native dialog | Requires a declaration block with exactly one `panel(title:, description: nil, nonmodal: false)` and at most one `trigger`, which forwards Button treatment options including `icon:`, `icon_end:`, and `label:`, matching Sheet and Dropdown. Nitro renders trigger then panel, and inside the panel it owns close button, title, description, then the captured application content, so a sticky close control survives long scrolling content. At most one `close_button(label:)` may be declared inside the panel block, whose label defaults to `I18n.t("nitro_kit.dialog.close")`; `dismissible: false` renders none and declaring one raises. `nonmodal: true` is the explicit server-open state and cannot be combined with a trigger, whose `command="show-modal"` would open the same panel modally. Trigger and close controls use native `command`/`commandfor`. Turbo confirmations are deliberately not a Dialog runtime: applications own inline confirmation dialogs, see [destructive action](patterns/destructive_action.md). |
145
+ | `DetailsTable` | `record`, `caption: nil`, `label: nil`, `empty_text: nil`, `boolean_labels: nil`, `route_base: nil`, `id: nil` | `div[data-nk=details-table]` containing a slotted `Table` | Requires one or more fields with unique keys, declared inside the render block. `field(attribute, label: nil, value:)` distinguishes omitted and explicit nil values; a block receives the resolved value. `fields(*attributes)` adds ordinary resolved fields. `caption:` names the table visibly and `label:` names it through `aria-label`; empty and boolean copy remain caller-owned keywords; when omitted they come from `nitro_kit.details_table.empty`, `.boolean_true`, and `.boolean_false`. |
146
+ | `Dropdown` | `id: nil`, `placement: :bottom_start` | `div[data-nk=dropdown]`; placements `bottom_start bottom_end top_start top_end`; item variants `default destructive`; item types `button submit reset` | Requires a declaration block, exactly one `trigger`, and at least one `item`. `id:` defaults to a generated `nk-dropdown-*` identifier and otherwise follows the shared fragment-safe identifier contract. `trigger(text = nil, variant:, size:, icon:, icon_end:, label:, disabled:)` forwards to Button, so an icon-only trigger keeps square icon-only geometry; `variant:` and `size:` are validated against Button vocabularies when the trigger is declared. `item(text = nil, href:, icon:, variant:, type:, disabled:)` renders an optional `dropdown-item-icon` slot and emits the owned `data-variant` on the item slot, matching the `Toast::Item` precedent; caller `data-variant` stays reserved. The native `popover=auto` owns open state and implicit invoker relationships. Optional visual titles are presentational to the menu accessibility tree; separators remain native. A small controller adds menu focus navigation, native outside-pointer dismissal fallback for capable Popover engines, and focus restoration without mirroring state. The fallback ignores composed-path interactions inside the trigger or menu and releases its listener on every close and disconnect. |
147
+ | `ProgressiveImage` | required `attachment:`; `alt: nil`, `size: :md`, `decorative: false`, `id: nil` | `div[data-nk=progressive-image]`; sizes `sm md lg`; states `empty loading loaded error` | Owns placeholder, image, and fallback slots. The placeholder is decorative and the full image is the only image in the accessibility tree. `alt:` is required unless `decorative: true`, and non-decorative attached images require non-blank alt text. The fallback surfaces that alt text, falling back to `I18n.t("nitro_kit.progressive_image.unavailable")` when there is none. Only an attached image can change after render, so only that fallback is a `role="status"` live region; the never-attached empty state is ordinary static content. `data-enhanced` on the root is the controller-connected flag shared with `AppShell`; it is deliberately not `data-state`, which already carries the closed load-state vocabulary. |
148
+ | `Sheet` | required `id:`; `side: :right`, `size: :md`, `close_label:` | layout-transparent `div[data-nk=sheet][data-side][data-size]` owning one native dialog; sides `left right`; sizes `sm md lg` | Requires exactly one Button-backed `trigger` and one `panel(title:, description: nil)`; both carry the shared `html:`, `aria:`, `data:`, and `desperately_need_a_class:` boundary, panel attributes landing on the dialog element as in Dialog. The native modal panel fills the block axis and enters from the selected inline edge. Nitro owns close, title, description, body order, backdrop dismissal, and native focus containment. Use Sheet for contextual narrow navigation or details; use AppShell for whole-application navigation and Dialog for centered decisions. |
149
+ | `Table` | `sort: nil`, `direction: nil`, `id: nil`, `table_html: {}`, `table_aria: {}`, `table_data: {}` | `div[data-nk=table]` wrapping a native table; cell alignments `left center right`; header scopes `col row`; directions `asc desc` or nil | Every table uses its horizontal scroll wrapper and non-wrapping cells at all viewport widths; columns and controls retain their natural size. Two phases: `caption`, `thead`, and `tbody` collect declarations so the component owns caption → head → body order, while `tr`, `th`, and `td` render immediately inside a collected block and validate before emitting their own markup. Rows must be declared inside a head/body and cells inside a row; text and block content are mutually exclusive. `align: :left` is the default and emits no attribute. Sorting lives on `Table` itself; there is no separate `SortableTable`. `th(text = nil, align: :left, scope: :col, sort: nil, href: nil, sort_data: {})` renders a caller-owned sort link with a unique key, falling back to the humanized sort key when no header text is given; `href:` without `sort:` raises and `sort:` requires a non-blank String `href:`. The active header owns `aria-sort="ascending"`/`"descending"` and a direction Icon, other sortable headers own `aria-sort="none"` and a neutral Icon. `sort:` must be declared inside `thead`. `sort:` and `direction:` are both set or both nil and mirror onto the root as `data-sort` and `data-direction`; `direction:` must be a Symbol or String. A declared caption receives a deterministic id (`<root id>-caption`, generated when the table has no id) and turns the scroll wrapper into a focusable `role="region"` labelled by it; without a caption the wrapper stays a plain div. `table_html:`, `table_aria:`, and `table_data:` address the inner `table` element. |
150
+ | `Tabs` | required `id:`; `default: nil`, `label:` defaulting to `I18n.t("nitro_kit.tabs.label")`, `orientation: :horizontal`, `activation: :automatic` | `div[data-nk=tabs]`; orientations `horizontal vertical`; activations `automatic manual` | Requires one or more uniquely keyed tabs with content and at least one enabled tab. An explicit default must be declared and enabled. Every panel remains available in the no-JavaScript baseline; Stimulus adds APG selection, `hidden="until-found"` inactive panels, find-in-page activation, roving focus, and keyboard activation after enhancement. |
151
+ | `Toast` | `duration: 5000`, `label:` defaulting to `I18n.t("nitro_kit.toast.label")`, `id: "nk-toast"` | `section[data-nk=toast][role=region]` wrapping `ol[data-slot=toast-list]`; item variants `default info success warning error` | Accepts zero or more `item(title:, description:, variant:, dismissible:, id:)` declarations inside its render block. Each item requires a title, description, or block. Items carry `role="status"`, or `role="alert"` for the error variant, plus `aria-atomic`, so server-rendered flash items are announced without waiting for a DOM mutation; caller `aria:` colliding with the owned region label or item atomic raises. Every item is `data-turbo-temporary`, so a cached page never replays stale feedback; the region and list survive. The list id is the toast id plus `-list`, so a Turbo Stream can append to it: `turbo_stream.append("nk-toast-list") { render NitroKit::Toast::Item.new(title: "Saved", variant: :success) }`. Items with `dismissible: false` render no dismiss button and are never auto-dismissed; the application owns their removal. `Toast::FlashMessages` maps an enumerable Rails flash into items through explicit keywords. The dismiss control is named from `nitro_kit.toast.dismiss`. |
152
+ | `Tooltip` | required `id:`, `content:`; `placement: :top` | `span[data-nk=tooltip]`; placements `top right bottom left` | Requires exactly one trigger. The default `as: NitroKit::Button` path supports native buttons and links; Button options on any other trigger raise. `as: :div` and `:span` create explicit focusable HTML descriptions. `as: :custom` yields `TriggerAttributes(html:, aria:, data:)`; applications must forward all three boundaries to the actual focusable control, including ButtonTo's nested Button or a Dialog trigger. Nitro appends the tooltip ID to existing `aria-describedby`. CSS owns hover/focus visibility; the controller's document-level Escape listener dismisses only while the tooltip is shown, so a wrapping dialog's cancel is not swallowed. |
153
+ | `Typeset` | `id: nil` | `div[data-nk=typeset]` | Requires direct content. Styles semantic rich content without constraining its width. Nested Nitro component roots and `data-typeset="off"` regions establish styling boundaries. The shipped stylesheet retains the `@scope` path and includes a low-specificity fallback for engines that do not parse `@scope`, including Firefox through 145. That fallback covers root typography plus explicitly anchored direct-child headings, flow elements, lists, code/pre, tables, and links within those supported elements; it is a documented semantic subset rather than full descendant parity. |
154
+
155
+ ### Stale combobox values
156
+
157
+ A local Combobox `value:` must match a declared option, so re-rendering an
158
+ invalid form whose submitted id was deleted (or filtered out of `options:`)
159
+ raises `ArgumentError`. Resolve the value against the options you render:
160
+
161
+ ```ruby
162
+ categories = Category.order(:name).to_a
163
+ category_id = categories.find { |category| category.id == @post.category_id }&.id
164
+
165
+ render NitroKit::Combobox.new(
166
+ id: "post-category",
167
+ name: "post[category_id]",
168
+ label: "Category",
169
+ options: categories.map { |category| { label: category.name, value: category.id } },
170
+ value: category_id
171
+ )
172
+ ```
173
+
174
+ Pass `value: nil` to clear a deleted selection and let model validation report
175
+ it, or append the stale record to `options:` (for example as
176
+ `{ label: "#{record.name} (archived)", value: record.id, disabled: true }`) when
177
+ the person should see what they had chosen. Remote comboboxes take `selected:`
178
+ choices built from the records that still exist, so deleted ids drop out
179
+ without raising. See [Resource form](patterns/resource_form.md#relation-pickers)
180
+ for a remote relation picker.
152
181
 
153
182
  ### Card sizing and surfaces
154
183
 
@@ -164,11 +193,11 @@ footer text stay `--nk-text-sm`, and action gaps do not scale. The card's
164
193
  `full` regions and dividers follow its padding, and bleeding corners follow
165
194
  its radius.
166
195
 
167
- | Size | Padding | Part gap | Radius | Title |
168
- | ---- | ------- | -------- | ------ | ----- |
169
- | `sm` | 4 space steps | 3 space steps | `--nk-radius-lg` | `--nk-text-sm` |
170
- | `md` | 6 space steps | 4 space steps | `--nk-radius-xl` | `--nk-text-base` |
171
- | `lg` | 8 space steps | 6 space steps | `--nk-radius-xl` + 1 space step | `--nk-text-lg` |
196
+ | Size | Padding | Part gap | Radius | Title |
197
+ | ---- | ------------- | ------------- | ------------------------------- | ---------------- |
198
+ | `sm` | 4 space steps | 3 space steps | `--nk-radius-lg` | `--nk-text-sm` |
199
+ | `md` | 6 space steps | 4 space steps | `--nk-radius-xl` | `--nk-text-base` |
200
+ | `lg` | 8 space steps | 6 space steps | `--nk-radius-xl` + 1 space step | `--nk-text-lg` |
172
201
 
173
202
  `default` is `--nk-color-surface` with the shared border and `--nk-shadow-xs`.
174
203
  `muted` tints the parent's surface with 4% foreground and drops the shadow;
@@ -205,13 +234,13 @@ Choose density for the content's job, surface for its emphasis, and a parent
205
234
  layout for its width. Neither card axis changes heading level, button state,
206
235
  form semantics, or table scrolling.
207
236
 
208
- | Configuration | Use |
209
- | ------------- | --- |
210
- | `size: :sm` | Dense widgets, link grids, and compact summaries |
211
- | `size: :md` | Ordinary records; the default |
212
- | `size: :lg` | Roomy forms and settings |
213
- | `variant: :muted` | Secondary panels beside a primary card |
214
- | `variant: :outline` | A quiet edge over the parent's surface |
237
+ | Configuration | Use |
238
+ | ------------------- | ------------------------------------------------ |
239
+ | `size: :sm` | Dense widgets, link grids, and compact summaries |
240
+ | `size: :md` | Ordinary records; the default |
241
+ | `size: :lg` | Roomy forms and settings |
242
+ | `variant: :muted` | Secondary panels beside a primary card |
243
+ | `variant: :outline` | A quiet edge over the parent's surface |
215
244
 
216
245
  The [card gallery](https://gallery.nitrokit.dev/gallery/components/card) covers
217
246
  a simple confirmation, a header/body/footer profile form, every size and
@@ -295,19 +324,19 @@ Unknown values or prefixes, duplicate base/prefix tokens, missing base values, b
295
324
 
296
325
  ## Application layout and page sections
297
326
 
298
- | Component | Constructor | Root | Compound contract |
299
- | ----------------- | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
300
- | `AuthShell` | `id: nil` | `main[data-nk=auth-shell]` | Requires direct content. Owns `main` → medium Container → `Flex(dir: :col, gap: 6, align: :stretch)`; branding, Cards, and Turbo boundaries remain caller-owned. |
327
+ | Component | Constructor | Root | Compound contract |
328
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
329
+ | `AuthShell` | `id: nil` | `main[data-nk=auth-shell]` | Requires direct content. Owns `main` → medium Container → `Flex(dir: :col, gap: 6, align: :stretch)`; branding, Cards, and Turbo boundaries remain caller-owned. |
301
330
  | `AppShell` | required `id:`; `layout: :sidebar`; `collapsible: false`; `sidebar: :expanded` (`expanded collapsed`); configurable skip/open/close/dialog/sidebar-toggle labels defaulting to `nitro_kit.app_shell.*` | `div[data-nk=app-shell][data-layout]`; layouts `sidebar topbar`; drawer states `open closed`; `data-enhanced` is written by the Stimulus controller and reserved | Requires exactly one `navigation` and one `main`; optional `brand(icon: nil)` and `topbar` are unique. Regions are declared inside the render block only. The default sidebar stays expanded with no toggle or peek. `collapsible: true` opts into a Button-backed pin toggle with `aria-pressed` and fine-pointer hover/focus overlay peek without changing the rail's layout width. Brand's optional validated Lucide icon stays visible on the rail; full brand content peeks instead of being cropped. Labels retain accessible names and vertical positions; supply item icons for the rail. `sidebar:` sets initial pin state; `sidebar: :collapsed` requires `collapsible: true`. These options do not affect topbar or the narrow native drawer. Pin state is not persisted across page loads. One navigation tree moves between its neutral desktop wrapper and a native modal dialog at narrow widths. IDs are fragment-safe; product policy remains caller-owned. |
302
- | `SettingsLayout` | `id: nil` | `div[data-nk=settings-layout]` | Exactly one `navigation(label:)` and one `content` region, both block-only and declared inside the render block. The navigation requires at least one `item(text, href:, icon: nil, current: false, html:, aria:, data:, desperately_need_a_class:)` and renders `nav > ul > li > a`, where `icon:` names a Lucide icon and the item attribute bags land on the link; a current item uses `aria-current="page"` and at most one item is current. Routes remain caller-owned. |
303
- | `Toolbar` | `id: nil` | `div[data-nk=toolbar]` | At most one `leading` and one `trailing`; at least one region total. Each region requires a content block. It deliberately has no toolbar role, sticky mode, or action registry. |
304
- | `PaginationBar` | `id: nil` | `div[data-nk=pagination-bar]` | Exactly one typed `pagination(NitroKit::Pagination)` and at most one non-blank `summary`. The summary announces politely unless the caller supplies its own `aria-live`; the shadowed Phlex element remains available as `html_summary`. Counts, routes, and page math remain caller-owned. |
305
- | `PageHeader` | `title: nil`, `eyebrow: nil`, `description: nil`, `level: 1`, `id: nil` | `header[data-nk=page-header]`; title levels `1..6` | Requires `title` through constructor text or its matching compound method. `eyebrow`, `title`, and `description` each accept text or a rich-content block exactly once and retain fixed eyebrow → heading → description order; at most one `ButtonGroup` through `actions`. |
306
- | `StatGrid` | `cols: "1 sm:2 lg:3"`, `gap: 4`, `id: nil` | `div[data-nk=stat-grid]` wrapping a slotted `Grid` and one `dl` | One or more `stat(key:, label:, value:, detail:)` declarations with unique normalized keys. Values accept any object and render `to_s`; blank copy raises. `cols:` and `gap:` use the `Grid` responsive vocabulary. Stats are declared inside the render block; the root spans the full inline size. |
307
- | `DataSection` | `title: nil`, `description: nil`, `level: 2`, `id: nil` | `section[data-nk=data-section][aria-labelledby]` naming the title heading; title levels `1..6` | Requires `title`, declared inside the render block; `title` and `description` each accept constructor text or one matching text/rich-content compound declaration. Exactly one `table(Table or DetailsTable)` or level-3 `empty_state(EmptyState)`; at most one `Button` or `ButtonGroup` through `actions`. The shadowed Phlex element remains available as `html_table`. |
308
- | `SettingsSection` | `title: nil`, `description: nil`, `level: 2`, `id: nil` | `section[data-nk=settings-section][aria-labelledby]` naming the title heading; title levels `1..6` | Requires `title`; `title` and `description` each accept constructor text or one matching text/rich-content compound declaration, and `title` also accepts `level:`. Exactly one `form` block; at most one `Alert` through `status`. |
309
- | `DangerZone` | `title: nil`, `description: nil`, `level: 2`, `id: nil` | `section[data-nk=danger-zone]`; title levels `1..6` | Requires `title` and `description`, each through constructor text or one matching text/rich-content compound declaration. Exactly one `confirmation` block and at most one non-destructive Button through `escape`; the description renders in the `danger-zone-description` slot. |
310
- | `EmptyState` | `title: nil`, `description: nil`, `variant: :default`, `level: 2`, `id: nil` | `section[data-nk=empty-state][data-variant]`; variants `default borderless` | Requires `title`; `title` and `description` each accept constructor text or one matching text/rich-content compound declaration. Heading levels `2..6`; at most one `Icon` and two distinct Button actions. `default` draws the dashed frame for a standalone region; `borderless` drops frame and fill for a region a Card, DataSection, or table already encloses, where the dashed frame would read as a Dropzone. Declaring a compound method outside the render block raises. |
331
+ | `SettingsLayout` | `id: nil` | `div[data-nk=settings-layout]` | Exactly one `navigation(label:)` and one `content` region, both block-only and declared inside the render block. The navigation requires at least one `item(text, href:, icon: nil, current: false, html:, aria:, data:, desperately_need_a_class:)` and renders `nav > ul > li > a`, where `icon:` names a Lucide icon and the item attribute bags land on the link; a current item uses `aria-current="page"` and at most one item is current. Routes remain caller-owned. |
332
+ | `Toolbar` | `id: nil` | `div[data-nk=toolbar]` | At most one `leading` and one `trailing`; at least one region total. Each region requires a content block. It deliberately has no toolbar role, sticky mode, or action registry. |
333
+ | `PaginationBar` | `id: nil` | `div[data-nk=pagination-bar]` | Exactly one typed `pagination(NitroKit::Pagination)` and at most one non-blank `summary`. The summary announces politely unless the caller supplies its own `aria-live`; the shadowed Phlex element remains available as `html_summary`. Counts, routes, and page math remain caller-owned. |
334
+ | `PageHeader` | `title: nil`, `eyebrow: nil`, `description: nil`, `level: 1`, `id: nil` | `header[data-nk=page-header]`; title levels `1..6` | Requires `title` through constructor text or its matching compound method. `eyebrow`, `title`, and `description` each accept text or a rich-content block exactly once and retain fixed eyebrow → heading → description order; at most one `ButtonGroup` through `actions`. |
335
+ | `StatGrid` | `cols: "1 sm:2 lg:3"`, `gap: 4`, `id: nil` | `div[data-nk=stat-grid]` wrapping a slotted `Grid` and one `dl` | One or more `stat(key:, label:, value:, detail:)` declarations with unique normalized keys. Values accept any object and render `to_s`; blank copy raises. `cols:` and `gap:` use the `Grid` responsive vocabulary. Stats are declared inside the render block; the root spans the full inline size. |
336
+ | `DataSection` | `title: nil`, `description: nil`, `level: 2`, `id: nil` | `section[data-nk=data-section][aria-labelledby]` naming the title heading; title levels `1..6` | Requires `title`, declared inside the render block; `title` and `description` each accept constructor text or one matching text/rich-content compound declaration. Exactly one `table(Table or DetailsTable)` or level-3 `empty_state(EmptyState)`; at most one `Button` or `ButtonGroup` through `actions`. The shadowed Phlex element remains available as `html_table`. |
337
+ | `SettingsSection` | `title: nil`, `description: nil`, `level: 2`, `id: nil` | `section[data-nk=settings-section][aria-labelledby]` naming the title heading; title levels `1..6` | Requires `title`; `title` and `description` each accept constructor text or one matching text/rich-content compound declaration, and `title` also accepts `level:`. Exactly one `form` block; at most one `Alert` through `status`. |
338
+ | `DangerZone` | `title: nil`, `description: nil`, `level: 2`, `id: nil` | `section[data-nk=danger-zone]`; title levels `1..6` | Requires `title` and `description`, each through constructor text or one matching text/rich-content compound declaration. Exactly one `confirmation` block and at most one non-destructive Button through `escape`; the description renders in the `danger-zone-description` slot. |
339
+ | `EmptyState` | `title: nil`, `description: nil`, `variant: :default`, `level: 2`, `id: nil` | `section[data-nk=empty-state][data-variant]`; variants `default borderless` | Requires `title`; `title` and `description` each accept constructor text or one matching text/rich-content compound declaration. Heading levels `2..6`; at most one `Icon` and two distinct Button actions. `default` draws the dashed frame for a standalone region; `borderless` drops frame and fill for a region a Card, DataSection, or table already encloses, where the dashed frame would read as a Dropzone. Declaring a compound method outside the render block raises. |
311
340
 
312
341
  ## Non-visual Rails integration
313
342
 
@@ -320,7 +349,7 @@ Unknown values or prefixes, duplicate base/prefix tokens, missing base values, b
320
349
  - `field`, `fieldset`, and `group`.
321
350
  - `dropzone` for native file selection with optional Active Storage direct uploads.
322
351
  - `select`, `radio_button`, `check_box`/`checkbox`, and `hidden_field`.
323
- - `field(:attribute, as: :combobox, options: ...)` for the searchable control inside an ordinary Field.
352
+ - `field(:attribute, as: :combobox, options: ...)` for a local searchable control, or `field(:attribute_ids, as: :combobox, src: ..., selected: ..., multiple: true)` for a remote relation picker inside an ordinary Field.
324
353
  - `submit` and `button`.
325
354
  - Rails-shaped color, date, datetime, email, file, month, number, password, phone/telephone, range, search, text, textarea, time, URL, and week field methods. `month_field` and `week_field` emit the corresponding native types as progressive enhancement and do not replace server-side ISO format, range, or step validation.
326
355
 
@@ -352,25 +381,25 @@ matrix and full/reduced/unavailable no-JavaScript classifications live in
352
381
  [`browser_support.md`](browser_support.md); do not infer a JavaScript-free
353
382
  interaction merely from server-rendered markup in this table.
354
383
 
355
- | Surface | Nitro behavior | Host dependency |
356
- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
357
- | Appearance | The bootstrap singleton restores and persists preference, resolves theme, owns media/storage listeners, and broadcasts updates even without a picker. Pickers only request and synchronize changes and release their subscriptions. | Browser storage and `matchMedia`; Stimulus for pickers. Storage failure falls back without raising |
358
- | App shell | A native dialog owns narrow-modal focus containment, background inertness, Escape, and the top layer. `nk--app-shell` moves one navigation subtree between desktop and dialog, coordinates breakpoints/trigger state, restores focus, handles backdrop/Turbo closes, and restores the no-JavaScript tree on teardown. | Stimulus and Turbo events; no navigation library |
359
- | Avatar | `nk--avatar` marks the root `data-state="error"` when the image fails to load so CSS reveals the initials fallback instead of a broken-image glyph | Stimulus only for the image error hook |
360
- | Button | `nk--button` mounts for `submission_indicator:` or `data-turbo-submits-with`, marks the submitting button `data-state="submitting"` with `aria-busy`, reveals the `button-submission-spinner` slot one second into a Turbo submission, and resets on submit end and before Turbo caches the page. | Stimulus and Turbo submission events |
361
- | Combobox | A native select remains the named no-JavaScript control. `nk--combobox` progressively adds searchable listbox filtering, APG focus/keyboard state, validation, announcements, and restores the native control on disconnect. Every submitted-value change, including clearing it while filtering, dispatches one bubbling `change` event. A filter with no matches shows a presentational `combobox-empty` item from `nitro_kit.combobox.no_results`; outside dismissal is a capture-phase document pointerdown listener held only while open. Its announcement strings come from the `nitro_kit.combobox.*` locale scope and reach the controller as Stimulus values. | Stimulus; no combobox or positioning package |
362
- | Command palette | `nk--command-palette` adds the optional Command-K/Control-K shortcut, reveals and filters the search input, announces result counts, preserves native link navigation, resets on close, and closes without stale state before Turbo visits or caching. It shares Dialog's capability-detected Invoker Commands fallback. Without JavaScript, its dialog trigger and destination links are available only where Invoker Commands are supported. | Stimulus for search, the global shortcut, and the compatibility bridge; no command-menu package |
363
- | Checkbox | Checked state is native. `nk--checkable` mounts only for `indeterminate: true`, because that DOM property has no markup form; it applies the property and owns `data-state="indeterminate"`. Switch and RadioButton mount nothing at all. | Stimulus only for the indeterminate property |
364
- | Accordion | Native `details`/`summary` owns disclosure. The no-JavaScript baseline is full for each item opening and closing; in `single` mode a shared `name` provides full exclusive grouping where named details are supported, and a reduced independently-open baseline where they are not. Nitro adds neither a controller nor browser detection for that gap. | No JavaScript |
365
- | Dialog | Native declarative commands are the preferred open/close path and the browser owns modal focus and Escape. `nk--dialog` delegates command controls, checks their reflected `commandForElement` relationship, and calls only `showModal()` or `close()` when that relationship cannot run; it does not mirror open state or polyfill commands generally. It also adds backdrop light dismissal, blocks Escape for `dismissible: false` panels where `closedby` is ignored, and closes ephemeral panels before Turbo caches the page. | Stimulus for dismissal policy and the focused compatibility bridge |
366
- | Dropdown | Native Popover owns visibility and implicit invoker state; `nk--dropdown` adds APG-style initial focus, arrow/Home/End navigation, selection closing, focus restoration, collision-aware JavaScript positioning, and an outside-pointer fallback for Popover engines whose light dismissal fails. Without Nitro JavaScript, native Popover visibility remains available but placement is a bounded top-left baseline rather than trigger-relative collision-aware placement. | Stimulus for keyboard, positioning, and compatibility behavior; no menu package |
367
- | Tooltip | CSS owns hover and focus visibility; `nk--tooltip` suppresses the visible tooltip on Escape until hover/focus interest ends, acting only while the tooltip is shown | Stimulus only for Escape dismissal |
368
- | Tabs | Server markup exposes every panel. `nk--tabs` adds the APG single-panel view, roving focus, automatic/manual activation, and restores every panel on disconnect. | Stimulus; no tabs package |
369
- | Toast | `nk--toast` owns dismiss/pause/resume timers, keeps overlapping hover/focus interest paused, removes closed items before caching, and clears every timer on disconnect. Every item is Turbo-temporary; the addressable region and list are not. | Stimulus timers; application owns adding server-rendered items |
370
- | Details table | No Nitro JavaScript | Rails localization/routes; Active Record and Active Storage values when the caller supplies them |
371
- | Progressive image | `nk--progressive-image` reflects decode/load/error state without class mutation, rebinds replaced targets, invalidates pending decodes, and removes exact image listeners. | Active Storage variants and the host's configured image processor |
372
- | Dropzone | `nk--dropzone` owns drag/selection preview and state while focused modules own file policy, shared form locks, and abortable Active Storage requests. Disconnect preserves selected native files; Turbo cache teardown clears transient state. | Native file submission fallback plus optional Active Storage direct uploads; no Dropzone.js |
373
- | Sortable table | No Nitro JavaScript; application owns query and sorting policy | None. Ransack appears only in an optional gallery recipe and is not a runtime dependency |
384
+ | Surface | Nitro behavior | Host dependency |
385
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
386
+ | Appearance | The bootstrap singleton restores and persists preference, resolves theme, owns media/storage listeners, and broadcasts updates even without a picker. Pickers only request and synchronize changes and release their subscriptions. | Browser storage and `matchMedia`; Stimulus for pickers. Storage failure falls back without raising |
387
+ | App shell | A native dialog owns narrow-modal focus containment, background inertness, Escape, and the top layer. `nk--app-shell` moves one navigation subtree between desktop and dialog, coordinates breakpoints/trigger state, restores focus, handles backdrop/Turbo closes, and restores the no-JavaScript tree on teardown. | Stimulus and Turbo events; no navigation library |
388
+ | Avatar | `nk--avatar` marks the root `data-state="error"` when the image fails to load so CSS reveals the initials fallback instead of a broken-image glyph | Stimulus only for the image error hook |
389
+ | Button | `nk--button` mounts for `submission_indicator:` or `data-turbo-submits-with`, marks the submitting button `data-state="submitting"` with `aria-busy`, reveals the `button-submission-spinner` slot one second into a Turbo submission, and resets on submit end and before Turbo caches the page. | Stimulus and Turbo submission events |
390
+ | Combobox | A native select remains the named no-JavaScript control. `nk--combobox` progressively adds searchable listbox filtering, APG focus/keyboard state, validation, announcements, and restores the native control on disconnect. Every submitted-value change, including clearing it while filtering, dispatches one bubbling `change` event. A filter with no matches shows a presentational `combobox-empty` item from `nitro_kit.combobox.no_results`; outside dismissal is a capture-phase document pointerdown listener held only while open. Its announcement strings come from the `nitro_kit.combobox.*` locale scope and reach the controller as Stimulus values. Remote mode (`src:`) debounces searches, aborts the previous request and discards any response that is not the newest, marks the listbox `aria-busy` while loading, and shows a presentational `combobox-message` with `data-state` `loading`, `error`, or `empty`. Enter never submits the surrounding form while remote results are open. Chips dispatch one bubbling `change` from `combobox-selections`; Backspace in an empty input removes the last chip. Without JavaScript a remote combobox still submits its current selection through its hidden fields. | Stimulus and `fetch`; no combobox or positioning package |
391
+ | Command palette | `nk--command-palette` adds the optional Command-K/Control-K shortcut, reveals and filters the search input, announces result counts, preserves native link navigation, resets on close, and closes without stale state before Turbo visits or caching. It shares Dialog's capability-detected Invoker Commands fallback. Without JavaScript, its dialog trigger and destination links are available only where Invoker Commands are supported. | Stimulus for search, the global shortcut, and the compatibility bridge; no command-menu package |
392
+ | Checkbox | Checked state is native. `nk--checkable` mounts only for `indeterminate: true`, because that DOM property has no markup form; it applies the property and owns `data-state="indeterminate"`. Switch and RadioButton mount nothing at all. | Stimulus only for the indeterminate property |
393
+ | Accordion | Native `details`/`summary` owns disclosure. The no-JavaScript baseline is full for each item opening and closing; in `single` mode a shared `name` provides full exclusive grouping where named details are supported, and a reduced independently-open baseline where they are not. Nitro adds neither a controller nor browser detection for that gap. | No JavaScript |
394
+ | Dialog | Native declarative commands are the preferred open/close path and the browser owns modal focus and Escape. `nk--dialog` delegates command controls, checks their reflected `commandForElement` relationship, and calls only `showModal()` or `close()` when that relationship cannot run; it does not mirror open state or polyfill commands generally. It also adds backdrop light dismissal, blocks Escape for `dismissible: false` panels where `closedby` is ignored, and closes ephemeral panels before Turbo caches the page. | Stimulus for dismissal policy and the focused compatibility bridge |
395
+ | Dropdown | Native Popover owns visibility and implicit invoker state; `nk--dropdown` adds APG-style initial focus, arrow/Home/End navigation, selection closing, focus restoration, collision-aware JavaScript positioning, and an outside-pointer fallback for Popover engines whose light dismissal fails. Without Nitro JavaScript, native Popover visibility remains available but placement is a bounded top-left baseline rather than trigger-relative collision-aware placement. | Stimulus for keyboard, positioning, and compatibility behavior; no menu package |
396
+ | Tooltip | CSS owns hover and focus visibility; `nk--tooltip` suppresses the visible tooltip on Escape until hover/focus interest ends, acting only while the tooltip is shown | Stimulus only for Escape dismissal |
397
+ | Tabs | Server markup exposes every panel. `nk--tabs` adds the APG single-panel view, roving focus, automatic/manual activation, and restores every panel on disconnect. | Stimulus; no tabs package |
398
+ | Toast | `nk--toast` owns dismiss/pause/resume timers, keeps overlapping hover/focus interest paused, removes closed items before caching, and clears every timer on disconnect. Every item is Turbo-temporary; the addressable region and list are not. | Stimulus timers; application owns adding server-rendered items |
399
+ | Details table | No Nitro JavaScript | Rails localization/routes; Active Record and Active Storage values when the caller supplies them |
400
+ | Progressive image | `nk--progressive-image` reflects decode/load/error state without class mutation, rebinds replaced targets, invalidates pending decodes, and removes exact image listeners. | Active Storage variants and the host's configured image processor |
401
+ | Dropzone | `nk--dropzone` owns drag/selection preview and state while focused modules own file policy, shared form locks, and abortable Active Storage requests. Disconnect preserves selected native files; Turbo cache teardown clears transient state. | Native file submission fallback plus optional Active Storage direct uploads; no Dropzone.js |
402
+ | Sortable table | No Nitro JavaScript; application owns query and sorting policy | None. Ransack appears only in an optional gallery recipe and is not a runtime dependency |
374
403
 
375
404
  The interactive theme customizer is documentation-site software rather than a component contract. The gallery instead verifies the theming contract itself: the documented token set, the set declared in `src/stylesheets/nitro_kit/tokens.css`, and the set the bundled stylesheet serves are the same set, component CSS consumes only declared public tokens, and scoped `--nk-*` overrides on an application-owned wrapper reach Nitro descendants through inheritance.
376
405