hyper-admin 1.0.0__py3-none-any.whl

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 (442) hide show
  1. hyper_admin-1.0.0.dist-info/METADATA +366 -0
  2. hyper_admin-1.0.0.dist-info/RECORD +442 -0
  3. hyper_admin-1.0.0.dist-info/WHEEL +4 -0
  4. hyper_admin-1.0.0.dist-info/entry_points.txt +2 -0
  5. hyper_admin-1.0.0.dist-info/licenses/LICENSE +21 -0
  6. hyperadmin/__init__.py +52 -0
  7. hyperadmin/__main__.py +21 -0
  8. hyperadmin/adapters/__init__.py +28 -0
  9. hyperadmin/adapters/_estimate.py +33 -0
  10. hyperadmin/adapters/_filter_clause.py +9 -0
  11. hyperadmin/adapters/_occ.py +44 -0
  12. hyperadmin/adapters/_relation_loading.py +23 -0
  13. hyperadmin/adapters/_search.py +84 -0
  14. hyperadmin/adapters/filtering.py +86 -0
  15. hyperadmin/adapters/introspection.py +239 -0
  16. hyperadmin/adapters/registry.py +37 -0
  17. hyperadmin/adapters/schema.py +239 -0
  18. hyperadmin/adapters/sqlalchemy.py +423 -0
  19. hyperadmin/adapters/sqlmodel.py +650 -0
  20. hyperadmin/auth/__init__.py +156 -0
  21. hyperadmin/auth/_types.py +52 -0
  22. hyperadmin/auth/backend.py +37 -0
  23. hyperadmin/auth/bridge.py +351 -0
  24. hyperadmin/auth/exceptions.py +124 -0
  25. hyperadmin/auth/middleware.py +287 -0
  26. hyperadmin/auth/models.py +245 -0
  27. hyperadmin/auth/oauth/__init__.py +81 -0
  28. hyperadmin/auth/oauth/backend.py +611 -0
  29. hyperadmin/auth/oauth/providers.py +214 -0
  30. hyperadmin/auth/oauth/refresh.py +126 -0
  31. hyperadmin/auth/oauth/session.py +96 -0
  32. hyperadmin/auth/oauth/tokens.py +114 -0
  33. hyperadmin/auth/oauth/views.py +306 -0
  34. hyperadmin/auth/oauth/wiring.py +131 -0
  35. hyperadmin/auth/otp.py +189 -0
  36. hyperadmin/auth/permissions.py +232 -0
  37. hyperadmin/auth/session.py +81 -0
  38. hyperadmin/auth/session_middleware.py +164 -0
  39. hyperadmin/auth/token_handoff.py +452 -0
  40. hyperadmin/auth/user_cache.py +222 -0
  41. hyperadmin/auth/views.py +581 -0
  42. hyperadmin/core/__init__.py +76 -0
  43. hyperadmin/core/actions.py +151 -0
  44. hyperadmin/core/adapters.py +883 -0
  45. hyperadmin/core/app.py +1437 -0
  46. hyperadmin/core/auth.py +97 -0
  47. hyperadmin/core/bulk_results.py +28 -0
  48. hyperadmin/core/cache.py +68 -0
  49. hyperadmin/core/choices.py +38 -0
  50. hyperadmin/core/concurrency.py +107 -0
  51. hyperadmin/core/csrf.py +108 -0
  52. hyperadmin/core/discovery.py +161 -0
  53. hyperadmin/core/display.py +172 -0
  54. hyperadmin/core/fields.py +158 -0
  55. hyperadmin/core/fieldsets.py +22 -0
  56. hyperadmin/core/filtering.py +403 -0
  57. hyperadmin/core/filters_compat.py +78 -0
  58. hyperadmin/core/inlines.py +64 -0
  59. hyperadmin/core/introspection.py +280 -0
  60. hyperadmin/core/layouts.py +17 -0
  61. hyperadmin/core/lifecycle.py +278 -0
  62. hyperadmin/core/model.py +189 -0
  63. hyperadmin/core/navigation.py +354 -0
  64. hyperadmin/core/options.py +391 -0
  65. hyperadmin/core/palette.py +94 -0
  66. hyperadmin/core/panels.py +227 -0
  67. hyperadmin/core/plugin_wiring.py +205 -0
  68. hyperadmin/core/plugins.py +588 -0
  69. hyperadmin/core/primary_key.py +118 -0
  70. hyperadmin/core/rate_limit.py +90 -0
  71. hyperadmin/core/registry.py +129 -0
  72. hyperadmin/core/relation_loading.py +25 -0
  73. hyperadmin/core/schema.py +83 -0
  74. hyperadmin/core/sensitive.py +134 -0
  75. hyperadmin/core/settings.py +377 -0
  76. hyperadmin/core/storage_paths.py +54 -0
  77. hyperadmin/core/timezones.py +137 -0
  78. hyperadmin/core/uploads.py +16 -0
  79. hyperadmin/db.py +160 -0
  80. hyperadmin/discover.py +54 -0
  81. hyperadmin/filters/__init__.py +39 -0
  82. hyperadmin/filters/base.py +246 -0
  83. hyperadmin/filters/boolean.py +105 -0
  84. hyperadmin/filters/choice.py +74 -0
  85. hyperadmin/filters/date.py +265 -0
  86. hyperadmin/filters/relation.py +69 -0
  87. hyperadmin/filters/saved_views.py +203 -0
  88. hyperadmin/i18n/__init__.py +50 -0
  89. hyperadmin/i18n/loader.py +150 -0
  90. hyperadmin/i18n/middleware.py +159 -0
  91. hyperadmin/i18n/validation_messages.py +264 -0
  92. hyperadmin/loadtest/__init__.py +28 -0
  93. hyperadmin/loadtest/batch.py +263 -0
  94. hyperadmin/loadtest/checkpoint.py +168 -0
  95. hyperadmin/loadtest/generators/__init__.py +29 -0
  96. hyperadmin/loadtest/generators/auth.py +86 -0
  97. hyperadmin/loadtest/generators/erp.py +177 -0
  98. hyperadmin/loadtest/plan.py +189 -0
  99. hyperadmin/loadtest/pool.py +113 -0
  100. hyperadmin/loadtest/progress.py +150 -0
  101. hyperadmin/locale/ar/LC_MESSAGES/messages.mo +0 -0
  102. hyperadmin/locale/ar/LC_MESSAGES/messages.po +2139 -0
  103. hyperadmin/locale/de/LC_MESSAGES/messages.mo +0 -0
  104. hyperadmin/locale/de/LC_MESSAGES/messages.po +2114 -0
  105. hyperadmin/locale/en/LC_MESSAGES/messages.mo +0 -0
  106. hyperadmin/locale/en/LC_MESSAGES/messages.po +1780 -0
  107. hyperadmin/locale/es/LC_MESSAGES/messages.mo +0 -0
  108. hyperadmin/locale/es/LC_MESSAGES/messages.po +2094 -0
  109. hyperadmin/locale/fr/LC_MESSAGES/messages.mo +0 -0
  110. hyperadmin/locale/fr/LC_MESSAGES/messages.po +2100 -0
  111. hyperadmin/locale/he/LC_MESSAGES/messages.mo +0 -0
  112. hyperadmin/locale/he/LC_MESSAGES/messages.po +2076 -0
  113. hyperadmin/locale/hi/LC_MESSAGES/messages.mo +0 -0
  114. hyperadmin/locale/hi/LC_MESSAGES/messages.po +2084 -0
  115. hyperadmin/locale/id/LC_MESSAGES/messages.mo +0 -0
  116. hyperadmin/locale/id/LC_MESSAGES/messages.po +2071 -0
  117. hyperadmin/locale/it/LC_MESSAGES/messages.mo +0 -0
  118. hyperadmin/locale/it/LC_MESSAGES/messages.po +2098 -0
  119. hyperadmin/locale/ja/LC_MESSAGES/messages.mo +0 -0
  120. hyperadmin/locale/ja/LC_MESSAGES/messages.po +2049 -0
  121. hyperadmin/locale/ko/LC_MESSAGES/messages.mo +0 -0
  122. hyperadmin/locale/ko/LC_MESSAGES/messages.po +2049 -0
  123. hyperadmin/locale/nl/LC_MESSAGES/messages.mo +0 -0
  124. hyperadmin/locale/nl/LC_MESSAGES/messages.po +2100 -0
  125. hyperadmin/locale/pl/LC_MESSAGES/messages.mo +0 -0
  126. hyperadmin/locale/pl/LC_MESSAGES/messages.po +2112 -0
  127. hyperadmin/locale/pt_BR/LC_MESSAGES/messages.mo +0 -0
  128. hyperadmin/locale/pt_BR/LC_MESSAGES/messages.po +2098 -0
  129. hyperadmin/locale/ru/LC_MESSAGES/messages.mo +0 -0
  130. hyperadmin/locale/ru/LC_MESSAGES/messages.po +2112 -0
  131. hyperadmin/locale/th/LC_MESSAGES/messages.mo +0 -0
  132. hyperadmin/locale/th/LC_MESSAGES/messages.po +2065 -0
  133. hyperadmin/locale/tr/LC_MESSAGES/messages.mo +0 -0
  134. hyperadmin/locale/tr/LC_MESSAGES/messages.po +2084 -0
  135. hyperadmin/locale/uk/LC_MESSAGES/messages.mo +0 -0
  136. hyperadmin/locale/uk/LC_MESSAGES/messages.po +1889 -0
  137. hyperadmin/locale/vi/LC_MESSAGES/messages.mo +0 -0
  138. hyperadmin/locale/vi/LC_MESSAGES/messages.po +2063 -0
  139. hyperadmin/locale/zh_CN/LC_MESSAGES/messages.mo +0 -0
  140. hyperadmin/locale/zh_CN/LC_MESSAGES/messages.po +2049 -0
  141. hyperadmin/main.py +3 -0
  142. hyperadmin/management/__init__.py +0 -0
  143. hyperadmin/management/commands/__init__.py +0 -0
  144. hyperadmin/management/commands/createsuperuser.py +114 -0
  145. hyperadmin/management/commands/initdb.py +76 -0
  146. hyperadmin/management/commands/plugins.py +31 -0
  147. hyperadmin/management/commands/seed.py +125 -0
  148. hyperadmin/navigation/__init__.py +9 -0
  149. hyperadmin/navigation/pins.py +153 -0
  150. hyperadmin/panels/__init__.py +10 -0
  151. hyperadmin/panels/pdf.py +151 -0
  152. hyperadmin/permissions/__init__.py +59 -0
  153. hyperadmin/permissions/audit.py +109 -0
  154. hyperadmin/permissions/matrix.py +343 -0
  155. hyperadmin/permissions/object_rules.py +143 -0
  156. hyperadmin/realtime/__init__.py +51 -0
  157. hyperadmin/realtime/_debug.py +77 -0
  158. hyperadmin/realtime/config.py +124 -0
  159. hyperadmin/realtime/emitting.py +143 -0
  160. hyperadmin/realtime/events.py +107 -0
  161. hyperadmin/realtime/presence.py +193 -0
  162. hyperadmin/realtime/presence_redis.py +142 -0
  163. hyperadmin/realtime/pubsub.py +129 -0
  164. hyperadmin/realtime/pubsub_redis.py +159 -0
  165. hyperadmin/realtime/registry.py +102 -0
  166. hyperadmin/realtime/sse.py +82 -0
  167. hyperadmin/realtime/ws.py +477 -0
  168. hyperadmin/routing.py +680 -0
  169. hyperadmin/static/css/_accessibility.css +149 -0
  170. hyperadmin/static/css/_alerts.css +147 -0
  171. hyperadmin/static/css/_autocomplete.css +39 -0
  172. hyperadmin/static/css/_banner.css +118 -0
  173. hyperadmin/static/css/_buttons.css +241 -0
  174. hyperadmin/static/css/_card.css +86 -0
  175. hyperadmin/static/css/_dark-mode.css +232 -0
  176. hyperadmin/static/css/_fieldsets.css +71 -0
  177. hyperadmin/static/css/_filter.css +203 -0
  178. hyperadmin/static/css/_fonts.css +25 -0
  179. hyperadmin/static/css/_forms.css +862 -0
  180. hyperadmin/static/css/_inline-cell.css +222 -0
  181. hyperadmin/static/css/_inlines.css +160 -0
  182. hyperadmin/static/css/_layout.css +62 -0
  183. hyperadmin/static/css/_login.css +112 -0
  184. hyperadmin/static/css/_menu.css +156 -0
  185. hyperadmin/static/css/_navbar.css +299 -0
  186. hyperadmin/static/css/_page-header.css +139 -0
  187. hyperadmin/static/css/_pagination.css +125 -0
  188. hyperadmin/static/css/_palette.css +304 -0
  189. hyperadmin/static/css/_panels.css +174 -0
  190. hyperadmin/static/css/_permissions.css +547 -0
  191. hyperadmin/static/css/_pill.css +123 -0
  192. hyperadmin/static/css/_popover.css +170 -0
  193. hyperadmin/static/css/_popup.css +65 -0
  194. hyperadmin/static/css/_progress.css +161 -0
  195. hyperadmin/static/css/_realtime.css +78 -0
  196. hyperadmin/static/css/_reset.css +48 -0
  197. hyperadmin/static/css/_responsive.css +51 -0
  198. hyperadmin/static/css/_rtl.css +23 -0
  199. hyperadmin/static/css/_search.css +67 -0
  200. hyperadmin/static/css/_seg.css +95 -0
  201. hyperadmin/static/css/_sidebar.css +446 -0
  202. hyperadmin/static/css/_sticky.css +54 -0
  203. hyperadmin/static/css/_table.css +776 -0
  204. hyperadmin/static/css/_theme-terminal-type.css +92 -0
  205. hyperadmin/static/css/_theme-terminal.css +330 -0
  206. hyperadmin/static/css/_theme-toggle.css +46 -0
  207. hyperadmin/static/css/_tokens.css +232 -0
  208. hyperadmin/static/css/_utilities.css +133 -0
  209. hyperadmin/static/css/hyperadmin.css +58 -0
  210. hyperadmin/static/fonts/Inter-OFL.txt +93 -0
  211. hyperadmin/static/fonts/InterVariable.woff2 +0 -0
  212. hyperadmin/static/fonts/JetBrainsMono-OFL.txt +93 -0
  213. hyperadmin/static/fonts/JetBrainsMonoVariable.woff2 +0 -0
  214. hyperadmin/static/icons/arrow-down.svg +1 -0
  215. hyperadmin/static/icons/arrow-up.svg +1 -0
  216. hyperadmin/static/icons/bar-chart-3.svg +1 -0
  217. hyperadmin/static/icons/bell.svg +1 -0
  218. hyperadmin/static/icons/bookmark.svg +1 -0
  219. hyperadmin/static/icons/briefcase.svg +1 -0
  220. hyperadmin/static/icons/building-2.svg +1 -0
  221. hyperadmin/static/icons/calendar.svg +1 -0
  222. hyperadmin/static/icons/check.svg +1 -0
  223. hyperadmin/static/icons/chevron-down.svg +1 -0
  224. hyperadmin/static/icons/chevron-left.svg +1 -0
  225. hyperadmin/static/icons/chevron-right.svg +1 -0
  226. hyperadmin/static/icons/circle-check.svg +1 -0
  227. hyperadmin/static/icons/circle-help.svg +1 -0
  228. hyperadmin/static/icons/circle-x.svg +1 -0
  229. hyperadmin/static/icons/clock.svg +1 -0
  230. hyperadmin/static/icons/columns-3.svg +1 -0
  231. hyperadmin/static/icons/command.svg +1 -0
  232. hyperadmin/static/icons/copy.svg +1 -0
  233. hyperadmin/static/icons/credit-card.svg +1 -0
  234. hyperadmin/static/icons/database.svg +1 -0
  235. hyperadmin/static/icons/download.svg +1 -0
  236. hyperadmin/static/icons/ellipsis.svg +1 -0
  237. hyperadmin/static/icons/external-link.svg +1 -0
  238. hyperadmin/static/icons/eye.svg +1 -0
  239. hyperadmin/static/icons/file-text.svg +1 -0
  240. hyperadmin/static/icons/filter.svg +1 -0
  241. hyperadmin/static/icons/folder.svg +1 -0
  242. hyperadmin/static/icons/globe.svg +1 -0
  243. hyperadmin/static/icons/history.svg +1 -0
  244. hyperadmin/static/icons/home.svg +1 -0
  245. hyperadmin/static/icons/image.svg +1 -0
  246. hyperadmin/static/icons/info.svg +1 -0
  247. hyperadmin/static/icons/key-round.svg +1 -0
  248. hyperadmin/static/icons/layers.svg +1 -0
  249. hyperadmin/static/icons/layout-grid.svg +1 -0
  250. hyperadmin/static/icons/list-checks.svg +1 -0
  251. hyperadmin/static/icons/lock.svg +1 -0
  252. hyperadmin/static/icons/log-out.svg +1 -0
  253. hyperadmin/static/icons/mail.svg +1 -0
  254. hyperadmin/static/icons/map-pin.svg +1 -0
  255. hyperadmin/static/icons/menu.svg +1 -0
  256. hyperadmin/static/icons/moon.svg +1 -0
  257. hyperadmin/static/icons/package.svg +1 -0
  258. hyperadmin/static/icons/panel-left-close.svg +1 -0
  259. hyperadmin/static/icons/panel-left-open.svg +1 -0
  260. hyperadmin/static/icons/pencil.svg +1 -0
  261. hyperadmin/static/icons/pin-off.svg +1 -0
  262. hyperadmin/static/icons/pin.svg +1 -0
  263. hyperadmin/static/icons/plus.svg +1 -0
  264. hyperadmin/static/icons/receipt.svg +1 -0
  265. hyperadmin/static/icons/refresh-cw.svg +1 -0
  266. hyperadmin/static/icons/rotate-ccw.svg +1 -0
  267. hyperadmin/static/icons/search.svg +1 -0
  268. hyperadmin/static/icons/settings.svg +1 -0
  269. hyperadmin/static/icons/shield-check.svg +1 -0
  270. hyperadmin/static/icons/shopping-cart.svg +1 -0
  271. hyperadmin/static/icons/sliders-horizontal.svg +1 -0
  272. hyperadmin/static/icons/sparkles.svg +1 -0
  273. hyperadmin/static/icons/store.svg +1 -0
  274. hyperadmin/static/icons/sun.svg +1 -0
  275. hyperadmin/static/icons/tag.svg +1 -0
  276. hyperadmin/static/icons/trash-2.svg +1 -0
  277. hyperadmin/static/icons/triangle-alert.svg +1 -0
  278. hyperadmin/static/icons/truck.svg +1 -0
  279. hyperadmin/static/icons/upload.svg +1 -0
  280. hyperadmin/static/icons/user.svg +1 -0
  281. hyperadmin/static/icons/users.svg +1 -0
  282. hyperadmin/static/icons/wallet.svg +1 -0
  283. hyperadmin/static/icons/x.svg +1 -0
  284. hyperadmin/static/img/hyperadmin-favicon.svg +1 -0
  285. hyperadmin/static/img/hyperadmin-mark-mono.svg +1 -0
  286. hyperadmin/static/img/hyperadmin-mark.svg +1 -0
  287. hyperadmin/static/img/hyperadmin-wordmark-dark.svg +1 -0
  288. hyperadmin/static/img/hyperadmin-wordmark.svg +1 -0
  289. hyperadmin/static/img/terminal/hyperadmin-favicon-16.svg +1 -0
  290. hyperadmin/static/img/terminal/hyperadmin-favicon.svg +1 -0
  291. hyperadmin/static/img/terminal/hyperadmin-mark.svg +1 -0
  292. hyperadmin/static/img/terminal/hyperadmin-wordmark-dark.svg +1 -0
  293. hyperadmin/static/img/terminal/hyperadmin-wordmark.svg +1 -0
  294. hyperadmin/static/js/autocomplete.js +475 -0
  295. hyperadmin/static/js/confirm_delete.js +113 -0
  296. hyperadmin/static/js/error_summary.js +37 -0
  297. hyperadmin/static/js/form_guard.js +77 -0
  298. hyperadmin/static/js/inline_edit.js +97 -0
  299. hyperadmin/static/js/palette.js +292 -0
  300. hyperadmin/static/js/primitives.js +205 -0
  301. hyperadmin/static/js/realtime-status.js +515 -0
  302. hyperadmin/static/js/request_errors.js +85 -0
  303. hyperadmin/static/js/shortcuts.js +175 -0
  304. hyperadmin/static/js/sidebar.js +83 -0
  305. hyperadmin/static/js/vendor/LICENSE-alpinejs.txt +21 -0
  306. hyperadmin/static/js/vendor/LICENSE-htmx.txt +25 -0
  307. hyperadmin/static/js/vendor/alpinejs-3.17.4.min.js +21 -0
  308. hyperadmin/static/js/vendor/alpinejs-focus-3.17.4.min.js +18 -0
  309. hyperadmin/static/js/vendor/htmx-1.9.10.min.js +1 -0
  310. hyperadmin/templates/_base.html +161 -0
  311. hyperadmin/templates/_messages.html +11 -0
  312. hyperadmin/templates/_navbar.html +126 -0
  313. hyperadmin/templates/_sidebar.html +80 -0
  314. hyperadmin/templates/auth/mfa_challenge.html +75 -0
  315. hyperadmin/templates/auth/mfa_settings.html +110 -0
  316. hyperadmin/templates/auth/oauth_link_required.html +24 -0
  317. hyperadmin/templates/auth/oauth_settings.html +55 -0
  318. hyperadmin/templates/base.html +16 -0
  319. hyperadmin/templates/bulk_form.html +18 -0
  320. hyperadmin/templates/bulk_result.html +20 -0
  321. hyperadmin/templates/components/_icons.html +86 -0
  322. hyperadmin/templates/components/_macros.html +27 -0
  323. hyperadmin/templates/components/_nav.html +55 -0
  324. hyperadmin/templates/components/_row_access.html +26 -0
  325. hyperadmin/templates/components/banner.html +77 -0
  326. hyperadmin/templates/components/bulk_form.html +81 -0
  327. hyperadmin/templates/components/bulk_result.html +133 -0
  328. hyperadmin/templates/components/bulk_toolbar.html +63 -0
  329. hyperadmin/templates/components/command_palette.html +59 -0
  330. hyperadmin/templates/components/confirm_delete_dialog.html +26 -0
  331. hyperadmin/templates/components/conflict_dialog.html +42 -0
  332. hyperadmin/templates/components/csrf_reload_banner.html +20 -0
  333. hyperadmin/templates/components/error_summary.html +39 -0
  334. hyperadmin/templates/components/error_toast.html +18 -0
  335. hyperadmin/templates/components/fieldset.html +38 -0
  336. hyperadmin/templates/components/filter_bar.html +50 -0
  337. hyperadmin/templates/components/filter_sidebar.html +31 -0
  338. hyperadmin/templates/components/filters/boolean.html +10 -0
  339. hyperadmin/templates/components/filters/current_period.html +8 -0
  340. hyperadmin/templates/components/filters/date_range.html +26 -0
  341. hyperadmin/templates/components/filters/is_owner.html +8 -0
  342. hyperadmin/templates/components/filters/multi_choice.html +10 -0
  343. hyperadmin/templates/components/filters/multi_relation.html +20 -0
  344. hyperadmin/templates/components/filters/select.html +11 -0
  345. hyperadmin/templates/components/inline_cell.html +23 -0
  346. hyperadmin/templates/components/inline_cell_error.html +51 -0
  347. hyperadmin/templates/components/inline_cell_stale.html +20 -0
  348. hyperadmin/templates/components/inline_editor.html +85 -0
  349. hyperadmin/templates/components/inline_formset.html +34 -0
  350. hyperadmin/templates/components/inline_row.html +49 -0
  351. hyperadmin/templates/components/list_error.html +12 -0
  352. hyperadmin/templates/components/menu.html +74 -0
  353. hyperadmin/templates/components/nav_pinned.html +24 -0
  354. hyperadmin/templates/components/pagination.html +87 -0
  355. hyperadmin/templates/components/panel_document.html +19 -0
  356. hyperadmin/templates/components/panel_states.html +35 -0
  357. hyperadmin/templates/components/panel_tab_strip.html +31 -0
  358. hyperadmin/templates/components/pill.html +15 -0
  359. hyperadmin/templates/components/popover.html +59 -0
  360. hyperadmin/templates/components/presence_banner.html +28 -0
  361. hyperadmin/templates/components/progress.html +72 -0
  362. hyperadmin/templates/components/saved_views.html +61 -0
  363. hyperadmin/templates/components/search_input.html +19 -0
  364. hyperadmin/templates/components/seg.html +38 -0
  365. hyperadmin/templates/components/shortcuts_overlay.html +45 -0
  366. hyperadmin/templates/components/sortable_header.html +23 -0
  367. hyperadmin/templates/components/table.html +45 -0
  368. hyperadmin/templates/components/table_body.html +86 -0
  369. hyperadmin/templates/components/thumbnail.html +8 -0
  370. hyperadmin/templates/components/toast.html +36 -0
  371. hyperadmin/templates/components/tooltip.html +20 -0
  372. hyperadmin/templates/create.html +43 -0
  373. hyperadmin/templates/dashboard.html +8 -0
  374. hyperadmin/templates/detail.html +120 -0
  375. hyperadmin/templates/detail_layout.html +15 -0
  376. hyperadmin/templates/error.html +24 -0
  377. hyperadmin/templates/form_layout.html +26 -0
  378. hyperadmin/templates/list.html +5 -0
  379. hyperadmin/templates/list_layout.html +105 -0
  380. hyperadmin/templates/login.html +79 -0
  381. hyperadmin/templates/permissions/_banner.html +55 -0
  382. hyperadmin/templates/permissions/_diff_row.html +6 -0
  383. hyperadmin/templates/permissions/_group_gone.html +16 -0
  384. hyperadmin/templates/permissions/_macros.html +22 -0
  385. hyperadmin/templates/permissions/matrix.html +408 -0
  386. hyperadmin/templates/permissions/object_popover.html +95 -0
  387. hyperadmin/templates/update.html +69 -0
  388. hyperadmin/templates/widgets/autocomplete.html +100 -0
  389. hyperadmin/templates/widgets/checkbox_input.html +20 -0
  390. hyperadmin/templates/widgets/choices_options.html +3 -0
  391. hyperadmin/templates/widgets/date_input.html +13 -0
  392. hyperadmin/templates/widgets/datetime_input.html +18 -0
  393. hyperadmin/templates/widgets/encoded_textarea.html +4 -0
  394. hyperadmin/templates/widgets/file_input.html +15 -0
  395. hyperadmin/templates/widgets/float_input.html +12 -0
  396. hyperadmin/templates/widgets/image_input.html +108 -0
  397. hyperadmin/templates/widgets/multiselect_input.html +13 -0
  398. hyperadmin/templates/widgets/number_input.html +11 -0
  399. hyperadmin/templates/widgets/popup_form.html +64 -0
  400. hyperadmin/templates/widgets/relation_multiselect_input.html +36 -0
  401. hyperadmin/templates/widgets/relation_select_input.html +38 -0
  402. hyperadmin/templates/widgets/select_input.html +17 -0
  403. hyperadmin/templates/widgets/text_input.html +13 -0
  404. hyperadmin/templates/widgets/textarea.html +4 -0
  405. hyperadmin/uploads/__init__.py +44 -0
  406. hyperadmin/uploads/images.py +272 -0
  407. hyperadmin/uploads/storage.py +265 -0
  408. hyperadmin/uploads/validation.py +37 -0
  409. hyperadmin/views/__init__.py +3 -0
  410. hyperadmin/views/csrf.py +316 -0
  411. hyperadmin/views/dynamic/__init__.py +35 -0
  412. hyperadmin/views/dynamic/actions.py +264 -0
  413. hyperadmin/views/dynamic/base.py +576 -0
  414. hyperadmin/views/dynamic/concurrency.py +138 -0
  415. hyperadmin/views/dynamic/core.py +33 -0
  416. hyperadmin/views/dynamic/create.py +189 -0
  417. hyperadmin/views/dynamic/detail.py +231 -0
  418. hyperadmin/views/dynamic/files.py +233 -0
  419. hyperadmin/views/dynamic/form_data.py +162 -0
  420. hyperadmin/views/dynamic/helpers.py +151 -0
  421. hyperadmin/views/dynamic/inline.py +348 -0
  422. hyperadmin/views/dynamic/list_view.py +612 -0
  423. hyperadmin/views/dynamic/model_view.py +17 -0
  424. hyperadmin/views/dynamic/palette_search.py +78 -0
  425. hyperadmin/views/dynamic/relations.py +544 -0
  426. hyperadmin/views/dynamic/saved_views.py +159 -0
  427. hyperadmin/views/dynamic/update.py +313 -0
  428. hyperadmin/views/error_pages.py +46 -0
  429. hyperadmin/views/forms.py +1294 -0
  430. hyperadmin/views/htmx.py +53 -0
  431. hyperadmin/views/locale.py +113 -0
  432. hyperadmin/views/nav_pins.py +149 -0
  433. hyperadmin/views/navigation.py +143 -0
  434. hyperadmin/views/palette_context.py +91 -0
  435. hyperadmin/views/palette_search.py +103 -0
  436. hyperadmin/views/permissions_matrix.py +490 -0
  437. hyperadmin/views/rate_limit.py +87 -0
  438. hyperadmin/views/route.py +316 -0
  439. hyperadmin/views/static.py +138 -0
  440. hyperadmin/views/template_filters.py +305 -0
  441. hyperadmin/views/uploads.py +92 -0
  442. hyperadmin/views/urls.py +180 -0
@@ -0,0 +1,110 @@
1
+ {%- extends "_base.html" -%}
2
+
3
+ {%- block title -%}{{ _("Two-factor authentication") }} — HyperAdmin{%- endblock -%}
4
+
5
+ {%- block content -%}
6
+ <div class="ha-login-container">
7
+ <div id="mfa-settings-card" class="ha-login-card">
8
+ <h1 id="mfa-settings-title" class="ha-login-title">
9
+ {{ _("Two-factor authentication") }}
10
+ </h1>
11
+
12
+ <p class="ha-text-muted">
13
+ {{ _("Status:") }}
14
+ {%- if user.mfa_enabled %}
15
+ <strong data-testid="mfa-status-indicator" data-mfa-enabled="true">
16
+ {{ _("Enabled") }}
17
+ </strong>
18
+ {%- else %}
19
+ <strong data-testid="mfa-status-indicator" data-mfa-enabled="false">
20
+ {{ _("Disabled") }}
21
+ </strong>
22
+ {%- endif %}
23
+ </p>
24
+
25
+ <div id="mfa-settings-flash" aria-live="polite">
26
+ {%- if error -%}
27
+ <div class="ha-alert ha-alert-error" data-testid="mfa-settings-error" role="alert">
28
+ {{ error }}
29
+ </div>
30
+ {%- endif -%}
31
+ {%- if flash -%}
32
+ <div class="ha-alert ha-alert-info" data-testid="mfa-settings-flash" role="status">
33
+ {{ flash }}
34
+ </div>
35
+ {%- endif -%}
36
+ </div>
37
+
38
+ {%- if flow in ("enable", "disable") %}
39
+ {#- Inline OTP confirm form, used in both enable and disable flows. #}
40
+ <form method="post"
41
+ action="{{ admin_prefix }}/mfa/{{ flow }}"
42
+ data-testid="mfa-settings-confirm-form"
43
+ aria-labelledby="mfa-settings-title"
44
+ hx-post="{{ admin_prefix }}/mfa/{{ flow }}"
45
+ hx-target="#mfa-settings-card"
46
+ hx-swap="outerHTML">
47
+ {{ csrf_input() if csrf_input is defined }}
48
+ <p class="ha-text-muted">
49
+ {{ _("Enter the 6-digit code we sent to your email to confirm.") }}
50
+ </p>
51
+ <div class="ha-form-group">
52
+ <label for="mfa-confirm-code" class="ha-label">
53
+ {{ _("Verification code") }}
54
+ </label>
55
+ <input
56
+ type="text"
57
+ id="mfa-confirm-code"
58
+ name="code"
59
+ class="ha-input"
60
+ data-testid="mfa-confirm-input"
61
+ inputmode="numeric"
62
+ pattern="[0-9]{6}"
63
+ maxlength="6"
64
+ autocomplete="one-time-code"
65
+ required
66
+ autofocus
67
+ >
68
+ </div>
69
+ <button type="submit"
70
+ class="ha-btn ha-btn-primary ha-btn-block"
71
+ data-testid="mfa-confirm-btn">
72
+ {%- if flow == "enable" -%}
73
+ {{ _("Confirm and enable") }}
74
+ {%- else -%}
75
+ {{ _("Confirm and disable") }}
76
+ {%- endif -%}
77
+ </button>
78
+ </form>
79
+ {%- elif user.mfa_enabled %}
80
+ <form method="post"
81
+ action="{{ admin_prefix }}/mfa/disable"
82
+ data-testid="mfa-disable-form"
83
+ hx-post="{{ admin_prefix }}/mfa/disable"
84
+ hx-target="#mfa-settings-card"
85
+ hx-swap="outerHTML">
86
+ {{ csrf_input() if csrf_input is defined }}
87
+ <button type="submit"
88
+ class="ha-btn ha-btn-danger ha-btn-block"
89
+ data-testid="mfa-disable-btn">
90
+ {{ _("Disable two-factor authentication") }}
91
+ </button>
92
+ </form>
93
+ {%- else %}
94
+ <form method="post"
95
+ action="{{ admin_prefix }}/mfa/enable"
96
+ data-testid="mfa-enable-form"
97
+ hx-post="{{ admin_prefix }}/mfa/enable"
98
+ hx-target="#mfa-settings-card"
99
+ hx-swap="outerHTML">
100
+ {{ csrf_input() if csrf_input is defined }}
101
+ <button type="submit"
102
+ class="ha-btn ha-btn-primary ha-btn-block"
103
+ data-testid="mfa-enable-btn">
104
+ {{ _("Enable two-factor authentication") }}
105
+ </button>
106
+ </form>
107
+ {%- endif %}
108
+ </div>
109
+ </div>
110
+ {%- endblock -%}
@@ -0,0 +1,24 @@
1
+ {%- extends "_base.html" -%}
2
+
3
+ {%- block title -%}{{ _("Account exists") }} — {{ site_title | default("HyperAdmin") }}{%- endblock -%}
4
+
5
+ {%- block messages -%}{%- endblock -%}
6
+ {%- block navbar -%}{%- endblock -%}
7
+ {%- block sidebar -%}{%- endblock -%}
8
+
9
+ {%- block content -%}
10
+ <div class="ha-login-container">
11
+ <div class="ha-login-card" data-testid="oauth-link-required">
12
+ <h1 id="oauth-link-required-title" class="ha-login-title">{{ _("Account exists") }}</h1>
13
+ <div class="ha-alert ha-alert-error" role="alert">
14
+ {{ error }}
15
+ </div>
16
+ <p class="ha-text-muted">
17
+ {{ _("An account with this email address already exists, so it was not linked automatically.") }}
18
+ </p>
19
+ <a href="{{ admin_prefix }}/login" class="ha-btn ha-btn-primary ha-btn-block" data-testid="oauth-back-to-login">
20
+ {{ _("Back to sign in") }}
21
+ </a>
22
+ </div>
23
+ </div>
24
+ {%- endblock -%}
@@ -0,0 +1,55 @@
1
+ {%- extends "_base.html" -%}
2
+
3
+ {%- block title -%}{{ _("Sign-in methods") }} — {{ site_title | default("HyperAdmin") }}{%- endblock -%}
4
+
5
+ {%- block content -%}
6
+ <div class="ha-login-container">
7
+ <div id="oauth-settings-card" class="ha-login-card">
8
+ <h1 id="oauth-settings-title" class="ha-login-title">{{ _("Sign-in methods") }}</h1>
9
+ <p class="ha-text-muted">
10
+ {{ _("Link an account to sign in with it next time.") }}
11
+ </p>
12
+
13
+ <div id="oauth-settings-messages" aria-live="polite">
14
+ {%- if error -%}
15
+ <div class="ha-alert ha-alert-error" data-testid="oauth-settings-error" role="alert">
16
+ {{ error }}
17
+ </div>
18
+ {%- endif -%}
19
+ {%- if flash -%}
20
+ <div class="ha-alert ha-alert-info" data-testid="oauth-settings-flash" role="status">
21
+ {{ flash }}
22
+ </div>
23
+ {%- endif -%}
24
+ </div>
25
+
26
+ <ul class="ha-oauth-identities" data-testid="oauth-identities" aria-labelledby="oauth-settings-title">
27
+ {%- for identity in identities %}
28
+ <li class="ha-oauth-identity" data-testid="oauth-identity-{{ identity.name }}" data-linked="{{ 'true' if identity.linked else 'false' }}">
29
+ <span class="ha-oauth-identity-name">
30
+ <strong>{{ identity.label }}</strong>
31
+ <span class="ha-text-muted">
32
+ {%- if identity.linked %}{{ _("Linked") }}{% else %}{{ _("Not linked") }}{% endif -%}
33
+ </span>
34
+ </span>
35
+ {%- if identity.linked %}
36
+ <form method="post" action="{{ admin_prefix }}/oauth/unlink/{{ identity.name }}">
37
+ {{ csrf_input() if csrf_input is defined }}
38
+ <button type="submit" class="ha-btn ha-btn-danger" data-testid="oauth-unlink-{{ identity.name }}"
39
+ aria-label="{{ _('Unlink %(provider)s', provider=identity.label) }}">
40
+ {{ _("Unlink") }}
41
+ </button>
42
+ </form>
43
+ {%- else %}
44
+ <a href="{{ admin_prefix }}/oauth/link/{{ identity.name }}" class="ha-btn ha-btn-secondary"
45
+ data-testid="oauth-link-{{ identity.name }}"
46
+ aria-label="{{ _('Link %(provider)s', provider=identity.label) }}">
47
+ {{ _("Link") }}
48
+ </a>
49
+ {%- endif %}
50
+ </li>
51
+ {%- endfor %}
52
+ </ul>
53
+ </div>
54
+ </div>
55
+ {%- endblock -%}
@@ -0,0 +1,16 @@
1
+ {% extends "_base.html" %}
2
+
3
+ {#- The single inline-create popup slot (H6, v0.5.5): the autocomplete "+"
4
+ button swaps the popup form in here; autocomplete.js empties it on
5
+ `hyperadminPopupCreated`, Escape or a backdrop click. -#}
6
+ {% block messages %}
7
+ {{- super() }}
8
+ <link rel="stylesheet" href="{{ url_for('static', path='/css/_autocomplete.css') }}">
9
+ <script src="{{ url_for('static', path='/js/autocomplete.js') }}" defer></script>
10
+ <script src="{{ url_for('static', path='/js/primitives.js') }}" defer></script>
11
+ <div id="ha-popup-root" class="ha-popup-root" role="dialog" aria-modal="true"
12
+ aria-label="{{ _('Create') }}" data-testid="popup-root"></div>
13
+ {#- The shared delete confirmation (st-v059-list-03) for the list, detail and edit pages. #}
14
+ <script src="{{ url_for('static', path='/js/confirm_delete.js') }}" defer></script>
15
+ {%- include "components/confirm_delete_dialog.html" %}
16
+ {%- endblock %}
@@ -0,0 +1,18 @@
1
+ {#- Parameter step of a bulk action as a full page (no JavaScript / direct POST).
2
+ With HTMX the view renders components/bulk_form.html into the dialog instead. -#}
3
+ {%- extends "base.html" -%}
4
+ {%- from "components/_icons.html" import icon -%}
5
+
6
+ {%- block title -%}{{ action.label }} | HyperAdmin{%- endblock -%}
7
+
8
+ {%- block content -%}
9
+ <nav class="ha-crumbs" aria-label="{{ _('Breadcrumb') }}" data-testid="bulk-breadcrumb">
10
+ <ol>
11
+ <li><a href="{{ url_for(model_name|lower ~ '-list') }}">{{ verbose_name_plural|default(model_name|capitalize) }}</a>{{ icon('chevron-right', 'ha-icon--sm ha-icon--mirror') }}</li>
12
+ <li aria-current="page">{{ action.label }}</li>
13
+ </ol>
14
+ </nav>
15
+ <div class="ha-card" data-testid="bulk-form-page">
16
+ {%- include "components/bulk_form.html" -%}
17
+ </div>
18
+ {%- endblock -%}
@@ -0,0 +1,20 @@
1
+ {#- Per-row result of a bulk action as a full page (no JavaScript / direct POST).
2
+ With HTMX the view renders components/bulk_result.html into the list's
3
+ result region instead. The wrapper keeps the region id so a "Retry
4
+ failures" submit from this page lands in place. -#}
5
+ {%- extends "base.html" -%}
6
+ {%- from "components/_icons.html" import icon -%}
7
+
8
+ {%- block title -%}{{ action.label }} | HyperAdmin{%- endblock -%}
9
+
10
+ {%- block content -%}
11
+ <nav class="ha-crumbs" aria-label="{{ _('Breadcrumb') }}" data-testid="bulk-breadcrumb">
12
+ <ol>
13
+ <li><a href="{{ url_for(model_name|lower ~ '-list') }}">{{ verbose_name_plural|default(model_name|capitalize) }}</a>{{ icon('chevron-right', 'ha-icon--sm ha-icon--mirror') }}</li>
14
+ <li aria-current="page">{{ action.label }}</li>
15
+ </ol>
16
+ </nav>
17
+ <div id="bulk-result-region" class="ha-card" data-testid="bulk-result-page">
18
+ {%- include "components/bulk_result.html" -%}
19
+ </div>
20
+ {%- endblock -%}
@@ -0,0 +1,86 @@
1
+ {#-
2
+ Lucide icons (ISC licence) inlined as SVG, so they take the text colour and cost
3
+ no request. Generated by scripts/generate_icon_macro.py from static/icons/*.svg:
4
+ add the .svg there and rerun the script; do not edit this file by hand.
5
+
6
+ Usage:
7
+ {%- from "components/_icons.html" import icon -%}
8
+ {{ icon('pencil') }} decorative, aria-hidden
9
+ {{ icon('chevron-right', 'ha-icon--sm ha-icon--mirror') }}
10
+ -#}
11
+ {%- set icon_paths = {
12
+ 'arrow-down': '<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>',
13
+ 'arrow-up': '<path d="m5 12 7-7 7 7"/><path d="M12 19V5"/>',
14
+ 'bar-chart-3': '<path d="M3 3v18h18"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/>',
15
+ 'bell': '<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>',
16
+ 'bookmark': '<path d="m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"/>',
17
+ 'briefcase': '<path d="M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/><rect width="20" height="14" x="2" y="6" rx="2"/>',
18
+ 'building-2': '<path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z"/><path d="M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2"/><path d="M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2"/><path d="M10 6h4"/><path d="M10 10h4"/><path d="M10 14h4"/><path d="M10 18h4"/>',
19
+ 'calendar': '<rect width="18" height="18" x="3" y="4" rx="2" ry="2"/><line x1="16" x2="16" y1="2" y2="6"/><line x1="8" x2="8" y1="2" y2="6"/><line x1="3" x2="21" y1="10" y2="10"/>',
20
+ 'check': '<path d="M20 6 9 17l-5-5"/>',
21
+ 'chevron-down': '<path d="m6 9 6 6 6-6"/>',
22
+ 'chevron-left': '<path d="m15 18-6-6 6-6"/>',
23
+ 'chevron-right': '<path d="m9 18 6-6-6-6"/>',
24
+ 'circle-check': '<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',
25
+ 'circle-help': '<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',
26
+ 'circle-x': '<circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/>',
27
+ 'clock': '<circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/>',
28
+ 'columns-3': '<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="M15 3v18"/>',
29
+ 'command': '<path d="M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"/>',
30
+ 'copy': '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
31
+ 'credit-card': '<rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/>',
32
+ 'database': '<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/>',
33
+ 'download': '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/>',
34
+ 'ellipsis': '<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>',
35
+ 'external-link': '<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',
36
+ 'eye': '<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',
37
+ 'file-text': '<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',
38
+ 'filter': '<polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/>',
39
+ 'folder': '<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',
40
+ 'globe': '<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',
41
+ 'history': '<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',
42
+ 'home': '<path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/>',
43
+ 'image': '<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',
44
+ 'info': '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',
45
+ 'key-round': '<path d="M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z"/><circle cx="16.5" cy="7.5" r=".5" fill="currentColor"/>',
46
+ 'layers': '<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>',
47
+ 'layout-grid': '<rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/>',
48
+ 'list-checks': '<path d="m3 17 2 2 4-4"/><path d="m3 7 2 2 4-4"/><path d="M13 6h8"/><path d="M13 12h8"/><path d="M13 18h8"/>',
49
+ 'lock': '<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',
50
+ 'log-out': '<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" x2="9" y1="12" y2="12"/>',
51
+ 'mail': '<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>',
52
+ 'map-pin': '<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>',
53
+ 'menu': '<line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/>',
54
+ 'moon': '<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>',
55
+ 'package': '<path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"/><path d="M12 22V12"/><path d="m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7"/><path d="m7.5 4.27 9 5.15"/>',
56
+ 'panel-left-close': '<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',
57
+ 'panel-left-open': '<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',
58
+ 'pencil': '<path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/>',
59
+ 'pin-off': '<path d="M12 17v5"/><path d="M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89"/><path d="m2 2 20 20"/><path d="M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11"/>',
60
+ 'pin': '<path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/>',
61
+ 'plus': '<path d="M5 12h14"/><path d="M12 5v14"/>',
62
+ 'receipt': '<path d="M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z"/><path d="M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"/><path d="M12 17.5v-11"/>',
63
+ 'refresh-cw': '<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',
64
+ 'rotate-ccw': '<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/>',
65
+ 'search': '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',
66
+ 'settings': '<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>',
67
+ 'shield-check': '<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>',
68
+ 'shopping-cart': '<circle cx="8" cy="21" r="1"/><circle cx="19" cy="21" r="1"/><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/>',
69
+ 'sliders-horizontal': '<line x1="21" x2="14" y1="4" y2="4"/><line x1="10" x2="3" y1="4" y2="4"/><line x1="21" x2="12" y1="12" y2="12"/><line x1="8" x2="3" y1="12" y2="12"/><line x1="21" x2="16" y1="20" y2="20"/><line x1="12" x2="3" y1="20" y2="20"/><line x1="14" x2="14" y1="2" y2="6"/><line x1="8" x2="8" y1="10" y2="14"/><line x1="16" x2="16" y1="18" y2="22"/>',
70
+ 'sparkles': '<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/><path d="M20 3v4"/><path d="M22 5h-4"/><path d="M4 17v2"/><path d="M5 18H3"/>',
71
+ 'store': '<path d="m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7"/><path d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"/><path d="M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4"/><path d="M2 7h20"/><path d="M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7"/>',
72
+ 'sun': '<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',
73
+ 'tag': '<path d="M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"/>',
74
+ 'trash-2': '<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',
75
+ 'triangle-alert': '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
76
+ 'truck': '<path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2"/><path d="M15 18H9"/><path d="M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14"/><circle cx="17" cy="18" r="2"/><circle cx="7" cy="18" r="2"/>',
77
+ 'upload': '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/>',
78
+ 'user': '<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',
79
+ 'users': '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
80
+ 'wallet': '<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"/><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"/>',
81
+ 'x': '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
82
+ } -%}
83
+
84
+ {%- macro icon(name, class='') -%}
85
+ <svg class="ha-icon{{ ' ' ~ class if class }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">{{ icon_paths.get(name, '') | safe }}</svg>
86
+ {%- endmacro -%}
@@ -0,0 +1,27 @@
1
+ {#-
2
+ Central macro library for HyperAdmin reusable template components.
3
+
4
+ Usage:
5
+ {%- from "components/_macros.html" import field_wrapper -%}
6
+ {%- call field_wrapper(field) -%}
7
+ <input ... />
8
+ {%- endcall -%}
9
+
10
+ The `call` block renders between the label and the help/error section.
11
+ Checkbox widgets use a different label pattern and should NOT use this macro.
12
+ -#}
13
+
14
+ {%- macro field_wrapper(field) -%}
15
+ <div class="ha-form-group">
16
+ <label for="{{- field.name -}}" class="ha-label">
17
+ {{- field.label -}}{%- if field.required -%}<span class="ha-required">*</span>{%- endif -%}
18
+ </label>
19
+ {{- caller() -}}
20
+ {%- if field.help_text -%}<p class="ha-help-text">{{- field.help_text -}}</p>{%- endif -%}
21
+ {%- if field.errors -%}
22
+ <ul class="ha-field-errors" aria-live="polite" data-testid="{{ field.name }}-errors">
23
+ {%- for e in field.errors -%}<li>{{- e -}}</li>{%- endfor -%}
24
+ </ul>
25
+ {%- endif -%}
26
+ </div>
27
+ {%- endmacro -%}
@@ -0,0 +1,55 @@
1
+ {#-
2
+ Sidebar nav item macros (AppShell, docs/design/system/components/AppShell/README.md).
3
+ Import with context, they read admin_prefix and the nav_* globals:
4
+
5
+ {%- from "components/_nav.html" import nav_link with context -%}
6
+ -#}
7
+ {%- from "components/_icons.html" import icon, icon_paths -%}
8
+
9
+ {#- item.icon is a Lucide name from static/icons, or any icon-font class (legacy). -#}
10
+ {%- macro nav_icon(item) -%}
11
+ {%- if item.icon in icon_paths -%}
12
+ {{ icon(item.icon) }}
13
+ {%- elif item.icon -%}
14
+ <i class="{{ item.icon }}" aria-hidden="true"></i>
15
+ {%- endif -%}
16
+ {%- endmacro -%}
17
+
18
+ {#- testid=false for a second copy of the link (the Pinned group), so test ids stay unique. -#}
19
+ {%- macro nav_link(item, testid=true) -%}
20
+ <a href="{{ admin_prefix }}{{ item.url }}"
21
+ class="ha-nav-item ha-sidebar-link"
22
+ {%- if testid %} data-testid="{{ item.testid }}"{% endif %}
23
+ title="{{ item.label }}"
24
+ @click="sidebarOpen = false"{% if nav_is_active(item) %}
25
+ aria-current="page"{% endif %}>
26
+ {{- nav_icon(item) -}}
27
+ <span class="ha-nav-item__label">{{ item.label }}</span>
28
+ </a>
29
+ {%- endmacro -%}
30
+
31
+ {#- Pin toggle of a sidebar item (st-v059-nav-03); oob=true when a pin endpoint returns it. -#}
32
+ {%- macro nav_pin_toggle(item, pinned, oob=false) -%}
33
+ {%- set label = _('Unpin %(label)s', label=item.label) if pinned else _('Pin %(label)s', label=item.label) -%}
34
+ <button type="button"
35
+ class="ha-nav-pin"
36
+ id="ha-nav-pin-{{ item.key | replace(':', '-') | replace('.', '-') }}"
37
+ data-ha-nav-pin
38
+ data-testid="nav-pin-{{ item.key }}"
39
+ aria-pressed="{{ 'true' if pinned else 'false' }}"
40
+ aria-label="{{ label }}"
41
+ title="{{ label }}"
42
+ {%- if pinned %}
43
+ hx-delete="{{ admin_prefix }}/nav/pins/{{ item.key | urlencode }}"
44
+ {%- else %}
45
+ hx-post="{{ admin_prefix }}/nav/pins"
46
+ hx-vals='{{ {"target": item.key} | tojson }}'
47
+ {%- endif %}
48
+ hx-target="#ha-nav-pinned"
49
+ hx-swap="outerHTML"
50
+ {%- if oob %}
51
+ hx-swap-oob="true"
52
+ {%- endif %}>
53
+ {{- icon('pin-off' if pinned else 'pin', 'ha-icon--sm') -}}
54
+ </button>
55
+ {%- endmacro -%}
@@ -0,0 +1,26 @@
1
+ {#- What a list row offers this user (st-v059-list-02), shared by the header in
2
+ components/table.html and the rows in components/table_body.html:
3
+
4
+ {%- import "components/_row_access.html" as rows with context -%}
5
+
6
+ - rows.target: "update", "detail" or none, from the view's row_target. A host
7
+ that renders the table without it gets the old defaults from can_edit /
8
+ can_detail.
9
+ - rows.may_delete: user_can_delete (or can_delete without it).
10
+ - rows.title_field: the first column that is not inline-editable; it becomes
11
+ the row's <th scope="row"> and holds the row link. None when every column
12
+ is editable.
13
+ - rows.open_cell: the end cell holds a chevron link (every column editable).
14
+ - rows.end_cell: whether the row has an end cell at all. -#}
15
+ {%- set target = row_target if row_target is defined else ('update' if can_edit is not defined or can_edit else ('detail' if can_detail is not defined or can_detail else none)) -%}
16
+ {%- set may_delete = user_can_delete if user_can_delete is defined else (can_delete is not defined or can_delete) -%}
17
+ {%- set _ns = namespace(title=none) -%}
18
+ {%- for field in fields if _ns.title is none -%}
19
+ {%- if not (list_editable and field in list_editable and field != pk_attr|default('id')) -%}
20
+ {%- set _ns.title = field -%}
21
+ {%- endif -%}
22
+ {%- endfor -%}
23
+ {%- set title_field = _ns.title -%}
24
+ {%- set url_name = (model_name|lower) ~ ('-update-form' if target == 'update' else '-detail') -%}
25
+ {%- set open_cell = target is not none and title_field is none -%}
26
+ {%- set end_cell = may_delete or open_cell -%}
@@ -0,0 +1,77 @@
1
+ {#-
2
+ Banner (design system: components/Banner): a full-width notice under the
3
+ navbar for session- or app-level state. An Alert is for the page's own
4
+ content; a Toast for something that just happened.
5
+
6
+ Usage:
7
+ {%- from "components/banner.html" import banner, banners -%}
8
+ {{ banner(_('Connection lost.'), kind='warning', detail=_('Changes by others will not appear until reconnected.'),
9
+ actions=[{'label': _('Retry now'), 'attrs': {'hx-post': url}}], testid='connection-lost') }}
10
+ {{ banners(request.state.banners) }} (the sticky region: most severe first, at most two + "more")
11
+
12
+ kind: danger | warning | context | info | success. danger and warning get
13
+ role="alert", the rest role="status"; pass live=False to announce neither
14
+ (a banner already on the page at load). dismissible adds the ✕ button
15
+ (static/js/primitives.js removes the banner); a context banner is never
16
+ dismissible. actions: {label, href, primary, disabled, testid, attrs}.
17
+ -#}
18
+ {%- from "components/_icons.html" import icon -%}
19
+
20
+ {%- set banner_icons = {'danger': 'circle-x', 'warning': 'triangle-alert', 'info': 'info', 'success': 'circle-check'} -%}
21
+ {%- set banner_rank = {'danger': 0, 'warning': 1, 'context': 2, 'info': 3, 'success': 4} -%}
22
+
23
+ {%- macro banner(message, kind='info', detail='', actions=[], dismissible=False, live=True, id=None, testid=None, icon_name=None, prefix='') -%}
24
+ {%- set role = 'alert' if (live and kind in ('danger', 'warning')) else ('status' if live else none) -%}
25
+ {%- set icon_to_show = icon_name if icon_name is not none else banner_icons.get(kind) -%}
26
+ <div class="ha-banner ha-banner--{{ kind }}"{% if role %} role="{{ role }}"{% endif %}
27
+ {%- if id %} id="{{ id }}"{% endif %}
28
+ {%- if testid %} data-testid="{{ testid }}"{% endif %}>
29
+ {%- if icon_to_show %}{{ icon(icon_to_show) }}{% endif %}
30
+ <p class="ha-banner__text">{{ prefix }}{{ message }}{% if detail %} <span>{{ detail }}</span>{% endif %}</p>
31
+ {%- if actions or (dismissible and kind != 'context') %}
32
+ <div class="ha-banner__actions">
33
+ {%- for action in actions %}
34
+ {%- set attrs = action.attrs | default({}) -%}
35
+ {%- set action_class = 'ha-btn ha-btn--sm' ~ (' ha-btn--primary' if action.primary) -%}
36
+ {%- if action.href %}
37
+ <a class="{{ action_class }}" href="{{ action.href }}"
38
+ {%- if action.testid %} data-testid="{{ action.testid }}"{% endif %}
39
+ {%- for k, v in attrs.items() %} {{ k }}="{{ v }}"{% endfor %}>{{ action.label }}</a>
40
+ {%- else %}
41
+ <button type="button" class="{{ action_class }}"
42
+ {%- if action.disabled %} disabled{% endif %}
43
+ {%- if action.testid %} data-testid="{{ action.testid }}"{% endif %}
44
+ {%- for k, v in attrs.items() %} {{ k }}="{{ v }}"{% endfor %}>{{ action.label }}</button>
45
+ {%- endif %}
46
+ {%- endfor %}
47
+ {%- if dismissible and kind != 'context' %}
48
+ <button type="button" class="ha-btn ha-btn--icon" aria-label="{{ _('Dismiss') }}" data-ha-dismiss>{{ icon('x', 'ha-icon--sm') }}</button>
49
+ {%- endif %}
50
+ </div>
51
+ {%- endif %}
52
+ </div>
53
+ {%- endmacro -%}
54
+
55
+ {%- macro banners(items, limit=2, more_href=None, testid='banners') -%}
56
+ {%- set ns = namespace(count=0) -%}
57
+ <div class="ha-banners" role="region" aria-label="{{ _('Notices') }}"{% if testid %} data-testid="{{ testid }}"{% endif %}>
58
+ {#- most severe first: danger, warning, context, info, success -#}
59
+ {%- for rank in range(5) %}
60
+ {%- for item in items if banner_rank.get(item.kind | default('info'), 3) == rank %}
61
+ {%- if ns.count < limit %}
62
+ {{ banner(item.message, kind=item.kind | default('info'), detail=item.detail | default(''), actions=item.actions | default([]),
63
+ dismissible=item.dismissible | default(false), live=item.live | default(true), id=item.id | default(none), testid=item.testid | default(none)) }}
64
+ {%- endif %}
65
+ {%- set ns.count = ns.count + 1 %}
66
+ {%- endfor %}
67
+ {%- endfor %}
68
+ {%- if ns.count > limit %}
69
+ {%- set extra = ns.count - limit %}
70
+ <div class="ha-banner">
71
+ {%- if more_href %}<a class="ha-banner__more" href="{{ more_href }}">{% else %}<span class="ha-banner__more">{% endif -%}
72
+ {%- trans count=extra %}+{{ count }} more notice{% pluralize %}+{{ count }} more notices{% endtrans -%}
73
+ {%- if more_href %}</a>{% else %}</span>{% endif %}
74
+ </div>
75
+ {%- endif %}
76
+ </div>
77
+ {%- endmacro -%}
@@ -0,0 +1,81 @@
1
+ {#- Parameter step of a bulk action (H3, v0.5.5) — design: BulkActionFlow.
2
+
3
+ The same partial is a dialog with HTMX (swapped into ``#ha-popup-root``)
4
+ and a page without it (``bulk_form.html`` wraps it with breadcrumbs).
5
+
6
+ Context:
7
+ - action: ActionDef (has .name, .label, .form; .handler's docstring's
8
+ first line is the lede when present)
9
+ - ids: list[str] — selected keys stringified with the model's pk codec
10
+ (``pk.to_str``), shown as tags and preserved as hidden inputs
11
+ - fields: list[dict(name,label,required,input_type,errors)] — built from action.form
12
+ - confirm_url: URL of the /bulk/confirm endpoint
13
+ - is_htmx: bool — dialog (Cancel closes it) or page (Cancel links back)
14
+ - model_name: lowercase model name, for the page's Cancel link
15
+ -#}
16
+ {%- from "components/_icons.html" import icon -%}
17
+ {%- set error_count = fields|selectattr('errors')|list|length -%}
18
+ {%- set doc = (action.handler.__doc__ if action.handler is defined and action.handler.__doc__ else '')|trim -%}
19
+ {%- set lede = doc.split('\n')[0]|trim -%}
20
+ {%- if ids|length == 1 -%}
21
+ {%- set title -%}{% trans label=action.label %}{{ label }} 1 row{% endtrans %}{%- endset -%}
22
+ {%- else -%}
23
+ {%- set title -%}{% trans label=action.label, count=ids|length %}{{ label }} {{ count }} rows{% endtrans %}{%- endset -%}
24
+ {%- endif -%}
25
+ <form method="post" action="{{ confirm_url }}" data-testid="bulk-form"
26
+ hx-post="{{ confirm_url }}" hx-target="#bulk-result-region" hx-swap="innerHTML"
27
+ class="ha-bulk-form" aria-labelledby="bulk-form-title">
28
+ {{ csrf_input() if csrf_input is defined }}
29
+ <h2 class="ha-bulk-form__title" id="bulk-form-title">{{ title }}</h2>
30
+ {% if error_count %}
31
+ <div class="ha-alert ha-alert-error" role="alert" tabindex="-1" data-testid="bulk-form-alert">
32
+ {{ icon('circle-x') }}
33
+ <div class="ha-alert-body">
34
+ <strong class="ha-alert-title">
35
+ {%- if error_count == 1 -%}{{ _("1 field needs fixing.") }}{%- else -%}{% trans count=error_count %}{{ count }} fields need fixing.{% endtrans %}{%- endif -%}
36
+ </strong>
37
+ <span>{% trans count=ids|length %}Your {{ count }} selected rows are kept.{% endtrans %}</span>
38
+ </div>
39
+ </div>
40
+ {% endif %}
41
+ <p class="ha-bulk-form__lede">
42
+ {%- if lede -%}{{ lede }}{%- else -%}{% trans count=ids|length %}This runs on the {{ count }} selected rows.{% endtrans %}{%- endif -%}
43
+ </p>
44
+
45
+ <ul class="ha-bulk-form__ids" aria-label="{{ _('Selected rows') }}">
46
+ {%- for pk in ids %}<li class="ha-mono">{{ pk }}</li>{% endfor -%}
47
+ </ul>
48
+ {% for pk in ids -%}
49
+ <input type="hidden" name="ids" value="{{ pk }}" />
50
+ {%- endfor %}
51
+
52
+ {% for field in fields %}
53
+ <div class="ha-field" data-testid="bulk-form-field-{{ field.name }}">
54
+ <label class="ha-label" for="bulk-{{ field.name }}">
55
+ {{- field.label -}}
56
+ {%- if field.required %}<span class="ha-req" aria-hidden="true">*</span>{% else %}<span class="ha-opt">({{ _("optional") }})</span>{% endif -%}
57
+ </label>
58
+ <input id="bulk-{{ field.name }}"
59
+ name="{{ field.name }}"
60
+ type="{{ field.input_type }}"
61
+ {% if field.input_type == 'number' %}step="any"{% endif %}
62
+ class="ha-input"
63
+ aria-invalid="{{ 'true' if field.errors else 'false' }}"
64
+ {% if field.errors %}aria-describedby="bulk-{{ field.name }}-errors"{% endif %} />
65
+ {% if field.errors %}
66
+ <p class="ha-errmsg" id="bulk-{{ field.name }}-errors" aria-live="polite"
67
+ data-testid="bulk-form-{{ field.name }}-errors">{{ icon('circle-x', 'ha-icon--sm') }}<span>{{ field.errors|join(' ') }}</span></p>
68
+ {% endif %}
69
+ </div>
70
+ {% endfor %}
71
+
72
+ <div class="ha-bulk-form__actions">
73
+ {% if is_htmx is defined and is_htmx -%}
74
+ <button type="button" class="ha-btn" data-ha-popup-close data-testid="bulk-cancel-btn">{{ _("Cancel") }}</button>
75
+ {%- elif model_name is defined -%}
76
+ <a class="ha-btn" href="{{ url_for(model_name|lower ~ '-list') }}" data-testid="bulk-cancel-btn">{{ _("Cancel") }}</a>
77
+ {%- endif %}
78
+ <button type="submit" class="ha-btn ha-btn--primary"
79
+ data-testid="bulk-confirm-btn">{{ title }}</button>
80
+ </div>
81
+ </form>