@questpie/admin 3.0.2 → 3.0.4

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 (249) hide show
  1. package/README.md +34 -5
  2. package/dist/client/blocks/block-renderer.d.mts +2 -2
  3. package/dist/client/blocks/block-renderer.mjs +4 -1
  4. package/dist/client/builder/types/action-types.d.mts +31 -3
  5. package/dist/client/builder/types/collection-types.d.mts +140 -0
  6. package/dist/client/builder/types/ui-config.d.mts +16 -2
  7. package/dist/client/builder/types/views.d.mts +57 -0
  8. package/dist/client/builder/types/widget-types.d.mts +5 -0
  9. package/dist/client/components/actions/action-button.mjs +137 -199
  10. package/dist/client/components/actions/action-dialog.mjs +198 -156
  11. package/dist/client/components/actions/confirmation-dialog.mjs +2 -2
  12. package/dist/client/components/actions/header-actions.mjs +52 -53
  13. package/dist/client/components/admin-link.d.mts +2 -2
  14. package/dist/client/components/auth/auth-loading.mjs +41 -18
  15. package/dist/client/components/blocks/block-fields-renderer.mjs +64 -28
  16. package/dist/client/components/blocks/block-insert-button.mjs +4 -4
  17. package/dist/client/components/blocks/block-item.mjs +2 -2
  18. package/dist/client/components/blocks/block-library-sidebar.mjs +2 -2
  19. package/dist/client/components/component-renderer.mjs +1 -1
  20. package/dist/client/components/fields/array-field.mjs +14 -14
  21. package/dist/client/components/fields/asset-preview-field.mjs +1 -1
  22. package/dist/client/components/fields/blocks-field/blocks-field.mjs +84 -104
  23. package/dist/client/components/fields/json-field.mjs +2 -2
  24. package/dist/client/components/fields/object-array-field.mjs +22 -22
  25. package/dist/client/components/fields/object-field.mjs +5 -5
  26. package/dist/client/components/fields/relation/displays/cards-display.mjs +16 -9
  27. package/dist/client/components/fields/relation/displays/chips-display.mjs +15 -12
  28. package/dist/client/components/fields/relation/displays/grid-display.mjs +15 -11
  29. package/dist/client/components/fields/relation/displays/list-display.mjs +33 -20
  30. package/dist/client/components/fields/relation/displays/table-display.mjs +62 -93
  31. package/dist/client/components/fields/relation/relation-items-display.mjs +1 -1
  32. package/dist/client/components/fields/relation-picker.mjs +7 -6
  33. package/dist/client/components/fields/relation-select.mjs +71 -47
  34. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +392 -82
  35. package/dist/client/components/fields/rich-text-editor/extensions.mjs +54 -23
  36. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +24 -50
  37. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +66 -0
  38. package/dist/client/components/fields/rich-text-editor/index.d.mts +38 -0
  39. package/dist/client/components/fields/rich-text-editor/index.mjs +637 -376
  40. package/dist/client/components/fields/rich-text-editor/link-utils.mjs +26 -0
  41. package/dist/client/components/fields/rich-text-editor/presets.d.mts +10 -0
  42. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +27 -6
  43. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +464 -346
  44. package/dist/client/components/fields/rich-text-editor/types.d.mts +77 -0
  45. package/dist/client/components/fields/upload-field.mjs +45 -49
  46. package/dist/client/components/filter-builder/columns-tab.mjs +69 -62
  47. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +473 -308
  48. package/dist/client/components/filter-builder/filters-tab.mjs +109 -82
  49. package/dist/client/components/filter-builder/saved-views-tab.mjs +300 -198
  50. package/dist/client/components/history-sidebar.mjs +850 -340
  51. package/dist/client/components/layout/field-layout-renderer.mjs +6 -5
  52. package/dist/client/components/locale-switcher.mjs +8 -8
  53. package/dist/client/components/media/media-grid.mjs +12 -9
  54. package/dist/client/components/media/media-picker-dialog.mjs +242 -230
  55. package/dist/client/components/preview/live-preview-mode.mjs +1 -1
  56. package/dist/client/components/primitives/asset-preview.mjs +37 -22
  57. package/dist/client/components/primitives/date-input.mjs +212 -249
  58. package/dist/client/components/primitives/dropzone.mjs +192 -159
  59. package/dist/client/components/primitives/field-select-control.mjs +93 -0
  60. package/dist/client/components/primitives/select-multi.mjs +251 -230
  61. package/dist/client/components/primitives/select-single.mjs +345 -290
  62. package/dist/client/components/primitives/time-input.mjs +2 -2
  63. package/dist/client/components/sheets/resource-sheet.mjs +2 -0
  64. package/dist/client/components/ui/accordion.mjs +4 -4
  65. package/dist/client/components/ui/alert.mjs +3 -3
  66. package/dist/client/components/ui/badge.mjs +4 -4
  67. package/dist/client/components/ui/button.mjs +47 -37
  68. package/dist/client/components/ui/card.mjs +2 -2
  69. package/dist/client/components/ui/checkbox.mjs +1 -1
  70. package/dist/client/components/ui/command.mjs +5 -5
  71. package/dist/client/components/ui/dialog.mjs +3 -3
  72. package/dist/client/components/ui/drawer.mjs +1 -1
  73. package/dist/client/components/ui/dropdown-menu.mjs +157 -15
  74. package/dist/client/components/ui/empty-state.mjs +88 -59
  75. package/dist/client/components/ui/field.mjs +2 -2
  76. package/dist/client/components/ui/input-group.mjs +3 -3
  77. package/dist/client/components/ui/input.mjs +1 -1
  78. package/dist/client/components/ui/kbd.mjs +1 -1
  79. package/dist/client/components/ui/label.mjs +1 -1
  80. package/dist/client/components/ui/popover.mjs +19 -11
  81. package/dist/client/components/ui/scroll-fade.mjs +170 -0
  82. package/dist/client/components/ui/search-input.mjs +1 -1
  83. package/dist/client/components/ui/select.mjs +129 -27
  84. package/dist/client/components/ui/sheet.mjs +54 -34
  85. package/dist/client/components/ui/sidebar.mjs +15 -14
  86. package/dist/client/components/ui/skeleton.mjs +28 -12
  87. package/dist/client/components/ui/switch.mjs +2 -2
  88. package/dist/client/components/ui/table.mjs +82 -74
  89. package/dist/client/components/ui/tabs.mjs +26 -31
  90. package/dist/client/components/ui/textarea.mjs +1 -1
  91. package/dist/client/components/ui/tooltip.mjs +1 -1
  92. package/dist/client/components/widgets/chart-widget.mjs +134 -96
  93. package/dist/client/components/widgets/progress-widget.mjs +59 -34
  94. package/dist/client/components/widgets/quick-actions-widget.mjs +184 -113
  95. package/dist/client/components/widgets/recent-items-widget.mjs +144 -102
  96. package/dist/client/components/widgets/stats-widget.mjs +91 -72
  97. package/dist/client/components/widgets/table-widget.mjs +159 -246
  98. package/dist/client/components/widgets/timeline-widget.mjs +66 -43
  99. package/dist/client/components/widgets/value-widget.mjs +261 -152
  100. package/dist/client/components/widgets/widget-empty-state.mjs +88 -0
  101. package/dist/client/components/widgets/widget-skeletons.mjs +53 -20
  102. package/dist/client/contexts/focus-context.d.mts +2 -2
  103. package/dist/client/hooks/use-action.mjs +63 -55
  104. package/dist/client/hooks/use-audit-history.mjs +1 -65
  105. package/dist/client/hooks/use-collection-validation.mjs +36 -23
  106. package/dist/client/hooks/use-collection.mjs +96 -1
  107. package/dist/client/hooks/use-saved-views.mjs +70 -49
  108. package/dist/client/hooks/use-server-actions.mjs +59 -40
  109. package/dist/client/hooks/use-server-validation.mjs +156 -41
  110. package/dist/client/hooks/use-server-widget-data.mjs +1 -1
  111. package/dist/client/hooks/use-setup-status.d.mts +3 -3
  112. package/dist/client/hooks/use-setup-status.mjs +2 -2
  113. package/dist/client/hooks/use-transition-stage.mjs +2 -10
  114. package/dist/client/hooks/use-validation-error-map.mjs +31 -13
  115. package/dist/client/hooks/use-view-state.mjs +238 -174
  116. package/dist/client/i18n/date-locale.mjs +33 -0
  117. package/dist/client/i18n/hooks.mjs +17 -1
  118. package/dist/client/lib/utils.mjs +3 -2
  119. package/dist/client/preview/block-scope-context.d.mts +2 -2
  120. package/dist/client/preview/preview-banner.d.mts +2 -2
  121. package/dist/client/preview/preview-field.d.mts +4 -4
  122. package/dist/client/preview/preview-field.mjs +2 -2
  123. package/dist/client/runtime/provider.mjs +8 -1
  124. package/dist/client/runtime/translations-provider.mjs +1 -1
  125. package/dist/client/scope/picker.d.mts +2 -2
  126. package/dist/client/scope/provider.d.mts +2 -2
  127. package/dist/client/styles/base.css +1022 -0
  128. package/dist/client/styles/index.css +3 -589
  129. package/dist/client/utils/auto-expand-fields.mjs +4 -2
  130. package/dist/client/utils/keyboard-shortcuts.mjs +26 -0
  131. package/dist/client/utils/use-lazy-component.mjs +80 -0
  132. package/dist/client/views/auth/auth-layout.d.mts +18 -11
  133. package/dist/client/views/auth/auth-layout.mjs +291 -80
  134. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  135. package/dist/client/views/auth/forgot-password-form.mjs +2 -2
  136. package/dist/client/views/auth/login-form.d.mts +2 -2
  137. package/dist/client/views/auth/login-form.mjs +1 -1
  138. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  139. package/dist/client/views/auth/reset-password-form.mjs +2 -2
  140. package/dist/client/views/auth/setup-form.d.mts +2 -2
  141. package/dist/client/views/collection/auto-form-fields.mjs +11 -9
  142. package/dist/client/views/collection/bulk-action-toolbar.mjs +173 -138
  143. package/dist/client/views/collection/cells/complex-cells.mjs +22 -22
  144. package/dist/client/views/collection/cells/primitive-cells.mjs +1 -1
  145. package/dist/client/views/collection/cells/relation-cells.mjs +147 -129
  146. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +224 -278
  147. package/dist/client/views/collection/cells/shared/relation-chip.mjs +64 -36
  148. package/dist/client/views/collection/cells/upload-cells.mjs +199 -9
  149. package/dist/client/views/collection/columns/build-columns.mjs +29 -9
  150. package/dist/client/views/collection/columns/column-defaults.mjs +2 -2
  151. package/dist/client/views/collection/field-renderer.mjs +50 -89
  152. package/dist/client/views/collection/form-view.mjs +237 -227
  153. package/dist/client/views/collection/table-view.mjs +1162 -229
  154. package/dist/client/views/collection/view-skeletons.mjs +222 -79
  155. package/dist/client/views/common/global-search.mjs +29 -18
  156. package/dist/client/views/dashboard/dashboard-grid.mjs +678 -501
  157. package/dist/client/views/dashboard/dashboard-widget.mjs +6 -3
  158. package/dist/client/views/dashboard/widget-card.mjs +23 -14
  159. package/dist/client/views/globals/global-form-view.mjs +634 -589
  160. package/dist/client/views/layout/admin-layout-provider.mjs +67 -70
  161. package/dist/client/views/layout/admin-layout.d.mts +3 -6
  162. package/dist/client/views/layout/admin-layout.mjs +149 -172
  163. package/dist/client/views/layout/admin-router.mjs +747 -544
  164. package/dist/client/views/layout/admin-sidebar.d.mts +38 -1
  165. package/dist/client/views/layout/admin-sidebar.mjs +751 -591
  166. package/dist/client/views/layout/admin-theme.d.mts +10 -0
  167. package/dist/client/views/layout/admin-theme.mjs +84 -0
  168. package/dist/client/views/layout/admin-view-layout.mjs +161 -0
  169. package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
  170. package/dist/client/views/pages/accept-invite-page.mjs +49 -26
  171. package/dist/client/views/pages/dashboard-page.d.mts +2 -2
  172. package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
  173. package/dist/client/views/pages/forgot-password-page.mjs +2 -19
  174. package/dist/client/views/pages/invite-page.d.mts +2 -2
  175. package/dist/client/views/pages/invite-page.mjs +2 -19
  176. package/dist/client/views/pages/login-page.d.mts +3 -3
  177. package/dist/client/views/pages/login-page.mjs +4 -21
  178. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  179. package/dist/client/views/pages/reset-password-page.mjs +3 -20
  180. package/dist/client/views/pages/setup-page.d.mts +2 -2
  181. package/dist/client/views/pages/setup-page.mjs +3 -20
  182. package/dist/client.d.mts +6 -2
  183. package/dist/client.mjs +2 -1
  184. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  185. package/dist/index.d.mts +6 -2
  186. package/dist/index.mjs +2 -1
  187. package/dist/server/augmentation/dashboard.d.mts +67 -3
  188. package/dist/server/augmentation/form-layout.d.mts +21 -0
  189. package/dist/server/augmentation/index.d.mts +1 -1
  190. package/dist/server/codegen/admin-client-template.mjs +4 -0
  191. package/dist/server/fields/blocks.d.mts +1 -1
  192. package/dist/server/fields/blocks.mjs +12 -0
  193. package/dist/server/fields/rich-text.d.mts +1 -1
  194. package/dist/server/fields/rich-text.mjs +8 -0
  195. package/dist/server/i18n/index.mjs +17 -1
  196. package/dist/server/i18n/messages/cs.mjs +23 -0
  197. package/dist/server/i18n/messages/de.mjs +23 -0
  198. package/dist/server/i18n/messages/en.mjs +64 -1
  199. package/dist/server/i18n/messages/es.mjs +23 -0
  200. package/dist/server/i18n/messages/fr.mjs +23 -0
  201. package/dist/server/i18n/messages/pl.mjs +23 -0
  202. package/dist/server/i18n/messages/pt.mjs +23 -0
  203. package/dist/server/i18n/messages/sk.mjs +83 -1
  204. package/dist/server/modules/admin/block/introspection.mjs +4 -1
  205. package/dist/server/modules/admin/block/prefetch.mjs +12 -2
  206. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  207. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  208. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  209. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  210. package/dist/server/modules/admin/collections/apikey.d.mts +64 -64
  211. package/dist/server/modules/admin/collections/assets.d.mts +20 -20
  212. package/dist/server/modules/admin/collections/assets.mjs +0 -1
  213. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  214. package/dist/server/modules/admin/collections/user.d.mts +40 -28
  215. package/dist/server/modules/admin/collections/user.mjs +40 -9
  216. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  217. package/dist/server/modules/admin/dto/admin-config.dto.mjs +2 -0
  218. package/dist/server/modules/admin/factories.mjs +7 -18
  219. package/dist/server/modules/admin/index.d.mts +1 -1
  220. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  221. package/dist/server/modules/admin/routes/admin-config.mjs +34 -16
  222. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  223. package/dist/server/modules/admin/routes/execute-action.mjs +33 -0
  224. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  225. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  226. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  227. package/dist/server/modules/admin/routes/setup.d.mts +10 -10
  228. package/dist/server/modules/admin/routes/setup.mjs +7 -7
  229. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  230. package/dist/server/modules/admin/routes/translations.mjs +5 -1
  231. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  232. package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +1 -1
  233. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +25 -25
  234. package/dist/server/modules/audit/.generated/module.d.mts +7 -7
  235. package/dist/server/modules/audit/.generated/module.mjs +1 -1
  236. package/dist/server/modules/audit/collections/audit-log.d.mts +39 -39
  237. package/dist/server/modules/audit/collections/audit-log.mjs +1 -1
  238. package/dist/server/modules/audit/config/app.mjs +99 -42
  239. package/dist/server/modules/audit/jobs/audit-cleanup.mjs +1 -1
  240. package/dist/server/plugin.mjs +4 -2
  241. package/dist/server/proxy-factories.d.mts +4 -3
  242. package/dist/server/proxy-factories.mjs +34 -8
  243. package/dist/shared/types/saved-views.types.d.mts +2 -0
  244. package/package.json +6 -4
  245. package/dist/client/components/fields/rich-text-editor/link-popover.mjs +0 -85
  246. package/dist/client/components/ui/spinner.mjs +0 -52
  247. package/dist/client/components/ui/toolbar.mjs +0 -136
  248. package/dist/client/contexts/breadcrumb-context.mjs +0 -60
  249. package/dist/client/views/layout/admin-topbar.mjs +0 -236
@@ -2,6 +2,7 @@ import { Admin } from "../../builder/admin.mjs";
2
2
  import { getAdminLocalesQueryOptions, getAdminTranslationsQueryOptions, getUiLocaleFromCookie } from "../../runtime/translations-provider.mjs";
3
3
  import { AdminProvider } from "../../runtime/provider.mjs";
4
4
  import { getAdminConfigQueryOptions } from "../../hooks/use-admin-config.mjs";
5
+ import { AdminThemeAppliedContext, useManagedAdminTheme } from "./admin-theme.mjs";
5
6
  import { AdminLayout } from "./admin-layout.mjs";
6
7
  import { AuthGuard } from "../../components/auth/auth-guard.mjs";
7
8
  import { c } from "react/compiler-runtime";
@@ -71,34 +72,27 @@ function isPublicPath(currentPath, basePath, publicPaths) {
71
72
  * Handles all the provider setup and renders children inside the layout.
72
73
  */
73
74
  function AdminLayoutProvider(t0) {
74
- const $ = c(38);
75
+ const $ = c(33);
75
76
  const { admin: adminInput, client, authClient, queryClient, LinkComponent, activeRoute, basePath: t1, header, footer, sidebarProps, theme, setTheme, showThemeToggle, toasterProps, className, enableAuthGuard, publicPaths: t2, requiredRole: t3, authLoadingFallback, authUnauthorizedFallback, useServerTranslations, translationsFallback, initialUiLocale, children } = t0;
76
77
  const basePath = t1 === void 0 ? "/admin" : t1;
77
78
  const publicPaths = t2 === void 0 ? DEFAULT_PUBLIC_PATHS : t2;
78
79
  const requiredRole = t3 === void 0 ? "admin" : t3;
79
- let qc;
80
- if ($[0] !== client || $[1] !== initialUiLocale || $[2] !== queryClient || $[3] !== useServerTranslations) {
81
- qc = queryClient ?? getDefaultQueryClient();
82
- if (client?.routes) {
83
- qc.prefetchQuery(getAdminConfigQueryOptions(client));
84
- if (useServerTranslations) {
85
- const locale = initialUiLocale ?? getUiLocaleFromCookie() ?? "en";
86
- qc.prefetchQuery(getAdminLocalesQueryOptions(client));
87
- qc.prefetchQuery(getAdminTranslationsQueryOptions(client, locale));
88
- }
80
+ const qc = queryClient ?? getDefaultQueryClient();
81
+ const { theme: managedTheme, setTheme: setManagedTheme } = useManagedAdminTheme(theme, setTheme);
82
+ if (client?.routes) {
83
+ qc.prefetchQuery(getAdminConfigQueryOptions(client));
84
+ if (useServerTranslations) {
85
+ const locale = initialUiLocale ?? getUiLocaleFromCookie() ?? "en";
86
+ qc.prefetchQuery(getAdminLocalesQueryOptions(client));
87
+ qc.prefetchQuery(getAdminTranslationsQueryOptions(client, locale));
89
88
  }
90
- $[0] = client;
91
- $[1] = initialUiLocale;
92
- $[2] = queryClient;
93
- $[3] = useServerTranslations;
94
- $[4] = qc;
95
- } else qc = $[4];
89
+ }
96
90
  let t4;
97
- if ($[5] !== adminInput) {
91
+ if ($[0] !== adminInput) {
98
92
  t4 = Admin.normalize(adminInput);
99
- $[5] = adminInput;
100
- $[6] = t4;
101
- } else t4 = $[6];
93
+ $[0] = adminInput;
94
+ $[1] = t4;
95
+ } else t4 = $[1];
102
96
  const admin = t4;
103
97
  const shouldUseAuthGuard = enableAuthGuard ?? authClient != null;
104
98
  const isCurrentPathPublic = isPublicPath(activeRoute ?? (typeof window !== "undefined" ? window.location.pathname : void 0), basePath, publicPaths);
@@ -106,7 +100,7 @@ function AdminLayoutProvider(t0) {
106
100
  if (isCurrentPathPublic) innerContent = children;
107
101
  else {
108
102
  let t5$1;
109
- if ($[7] !== LinkComponent || $[8] !== activeRoute || $[9] !== basePath || $[10] !== children || $[11] !== className || $[12] !== footer || $[13] !== header || $[14] !== setTheme || $[15] !== showThemeToggle || $[16] !== sidebarProps || $[17] !== theme || $[18] !== toasterProps) {
103
+ if ($[2] !== LinkComponent || $[3] !== activeRoute || $[4] !== basePath || $[5] !== children || $[6] !== className || $[7] !== footer || $[8] !== header || $[9] !== managedTheme || $[10] !== setManagedTheme || $[11] !== showThemeToggle || $[12] !== sidebarProps || $[13] !== toasterProps) {
110
104
  t5$1 = /* @__PURE__ */ jsx(AdminLayout, {
111
105
  LinkComponent,
112
106
  activeRoute,
@@ -114,30 +108,30 @@ function AdminLayoutProvider(t0) {
114
108
  header,
115
109
  footer,
116
110
  sidebarProps,
117
- theme,
118
- setTheme,
111
+ theme: managedTheme,
112
+ setTheme: setManagedTheme,
119
113
  showThemeToggle,
120
114
  toasterProps,
121
115
  className,
122
116
  children
123
117
  });
124
- $[7] = LinkComponent;
125
- $[8] = activeRoute;
126
- $[9] = basePath;
127
- $[10] = children;
128
- $[11] = className;
129
- $[12] = footer;
130
- $[13] = header;
131
- $[14] = setTheme;
132
- $[15] = showThemeToggle;
133
- $[16] = sidebarProps;
134
- $[17] = theme;
135
- $[18] = toasterProps;
136
- $[19] = t5$1;
137
- } else t5$1 = $[19];
118
+ $[2] = LinkComponent;
119
+ $[3] = activeRoute;
120
+ $[4] = basePath;
121
+ $[5] = children;
122
+ $[6] = className;
123
+ $[7] = footer;
124
+ $[8] = header;
125
+ $[9] = managedTheme;
126
+ $[10] = setManagedTheme;
127
+ $[11] = showThemeToggle;
128
+ $[12] = sidebarProps;
129
+ $[13] = toasterProps;
130
+ $[14] = t5$1;
131
+ } else t5$1 = $[14];
138
132
  const layoutContent = t5$1;
139
133
  let t6$1;
140
- if ($[20] !== authLoadingFallback || $[21] !== authUnauthorizedFallback || $[22] !== basePath || $[23] !== layoutContent || $[24] !== requiredRole || $[25] !== shouldUseAuthGuard) {
134
+ if ($[15] !== authLoadingFallback || $[16] !== authUnauthorizedFallback || $[17] !== basePath || $[18] !== layoutContent || $[19] !== requiredRole || $[20] !== shouldUseAuthGuard) {
141
135
  t6$1 = shouldUseAuthGuard ? /* @__PURE__ */ jsx(AuthGuard, {
142
136
  loginPath: `${basePath}/login`,
143
137
  requiredRole,
@@ -145,47 +139,50 @@ function AdminLayoutProvider(t0) {
145
139
  unauthorizedFallback: authUnauthorizedFallback,
146
140
  children: layoutContent
147
141
  }) : layoutContent;
148
- $[20] = authLoadingFallback;
149
- $[21] = authUnauthorizedFallback;
150
- $[22] = basePath;
151
- $[23] = layoutContent;
152
- $[24] = requiredRole;
153
- $[25] = shouldUseAuthGuard;
154
- $[26] = t6$1;
155
- } else t6$1 = $[26];
142
+ $[15] = authLoadingFallback;
143
+ $[16] = authUnauthorizedFallback;
144
+ $[17] = basePath;
145
+ $[18] = layoutContent;
146
+ $[19] = requiredRole;
147
+ $[20] = shouldUseAuthGuard;
148
+ $[21] = t6$1;
149
+ } else t6$1 = $[21];
156
150
  innerContent = t6$1;
157
151
  }
158
152
  let t5;
159
- if ($[27] !== admin || $[28] !== authClient || $[29] !== client || $[30] !== initialUiLocale || $[31] !== innerContent || $[32] !== translationsFallback || $[33] !== useServerTranslations) {
160
- t5 = /* @__PURE__ */ jsx(AdminProvider, {
161
- admin,
162
- client,
163
- authClient,
164
- useServerTranslations,
165
- translationsFallback,
166
- initialUiLocale,
167
- children: innerContent
153
+ if ($[22] !== admin || $[23] !== authClient || $[24] !== client || $[25] !== initialUiLocale || $[26] !== innerContent || $[27] !== translationsFallback || $[28] !== useServerTranslations) {
154
+ t5 = /* @__PURE__ */ jsx(AdminThemeAppliedContext.Provider, {
155
+ value: true,
156
+ children: /* @__PURE__ */ jsx(AdminProvider, {
157
+ admin,
158
+ client,
159
+ authClient,
160
+ useServerTranslations,
161
+ translationsFallback,
162
+ initialUiLocale,
163
+ children: innerContent
164
+ })
168
165
  });
169
- $[27] = admin;
170
- $[28] = authClient;
171
- $[29] = client;
172
- $[30] = initialUiLocale;
173
- $[31] = innerContent;
174
- $[32] = translationsFallback;
175
- $[33] = useServerTranslations;
176
- $[34] = t5;
177
- } else t5 = $[34];
166
+ $[22] = admin;
167
+ $[23] = authClient;
168
+ $[24] = client;
169
+ $[25] = initialUiLocale;
170
+ $[26] = innerContent;
171
+ $[27] = translationsFallback;
172
+ $[28] = useServerTranslations;
173
+ $[29] = t5;
174
+ } else t5 = $[29];
178
175
  const content = t5;
179
176
  let t6;
180
- if ($[35] !== content || $[36] !== qc) {
177
+ if ($[30] !== content || $[31] !== qc) {
181
178
  t6 = /* @__PURE__ */ jsx(QueryClientProvider, {
182
179
  client: qc,
183
180
  children: content
184
181
  });
185
- $[35] = content;
186
- $[36] = qc;
187
- $[37] = t6;
188
- } else t6 = $[37];
182
+ $[30] = content;
183
+ $[31] = qc;
184
+ $[32] = t6;
185
+ } else t6 = $[32];
189
186
  return t6;
190
187
  }
191
188
 
@@ -1,13 +1,10 @@
1
1
  import { AdminToasterProps } from "../../components/ui/sonner.mjs";
2
2
  import { AdminSidebarProps } from "./admin-sidebar.mjs";
3
+ import { AdminTheme } from "./admin-theme.mjs";
3
4
  import * as React from "react";
4
5
 
5
6
  //#region src/client/views/layout/admin-layout.d.ts
6
7
 
7
- /**
8
- * Theme mode for the admin interface
9
- */
10
- type AdminTheme = "light" | "dark" | "system";
11
8
  /**
12
9
  * Layout mode for content area width
13
10
  * - default: max-w-5xl centered (settings, narrow forms)
@@ -123,8 +120,8 @@ declare function AdminLayout({
123
120
  header,
124
121
  footer,
125
122
  navigate: navigateProp,
126
- theme,
127
- setTheme,
123
+ theme: themeProp,
124
+ setTheme: setThemeProp,
128
125
  showThemeToggle,
129
126
  toasterProps,
130
127
  layoutMode
@@ -1,11 +1,11 @@
1
1
  import { cn } from "../../lib/utils.mjs";
2
2
  import { useAdminStore } from "../../runtime/provider.mjs";
3
+ import { shouldHandleAdminShortcut } from "../../utils/keyboard-shortcuts.mjs";
3
4
  import { SidebarInset, SidebarProvider } from "../../components/ui/sidebar.mjs";
4
5
  import { Toaster } from "../../components/ui/sonner.mjs";
5
- import { BreadcrumbProvider, useCurrentBreadcrumbs } from "../../contexts/breadcrumb-context.mjs";
6
6
  import { GlobalSearch } from "../common/global-search.mjs";
7
7
  import { AdminSidebar } from "./admin-sidebar.mjs";
8
- import { AdminTopbar } from "./admin-topbar.mjs";
8
+ import { AdminThemeAppliedContext, useManagedAdminTheme } from "./admin-theme.mjs";
9
9
  import { c } from "react/compiler-runtime";
10
10
  import * as React from "react";
11
11
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -40,30 +40,6 @@ function useLayoutProps(props) {
40
40
  return t2;
41
41
  }
42
42
  /**
43
- * Topbar wrapper that reads breadcrumbs from context
44
- */
45
- function _temp2(s_0) {
46
- return s_0.navigate;
47
- }
48
- function _temp(s) {
49
- return s.brandName;
50
- }
51
- const AdminTopbarWithBreadcrumbs = React.memo(function AdminTopbarWithBreadcrumbs$1(props) {
52
- const $ = c(3);
53
- const breadcrumbs = useCurrentBreadcrumbs();
54
- let t0;
55
- if ($[0] !== breadcrumbs || $[1] !== props) {
56
- t0 = /* @__PURE__ */ jsx(AdminTopbar, {
57
- ...props,
58
- breadcrumbs
59
- });
60
- $[0] = breadcrumbs;
61
- $[1] = props;
62
- $[2] = t0;
63
- } else t0 = $[2];
64
- return t0;
65
- });
66
- /**
67
43
  * AdminLayout Component
68
44
  *
69
45
  * When used inside AdminProvider, brandName is automatically
@@ -79,45 +55,51 @@ const AdminTopbarWithBreadcrumbs = React.memo(function AdminTopbarWithBreadcrumb
79
55
  * </AdminProvider>
80
56
  * ```
81
57
  */
58
+ function _temp2(s_0) {
59
+ return s_0.navigate;
60
+ }
61
+ function _temp(s) {
62
+ return s.brandName;
63
+ }
82
64
  function AdminLayout(t0) {
83
- const $ = c(55);
84
- const { LinkComponent, activeRoute, basePath: t1, brandName: brandNameProp, sidebarCollapsed: t2, children, className, sidebarProps, header, footer, navigate: navigateProp, theme: t3, setTheme, showThemeToggle, toasterProps, layoutMode: t4 } = t0;
65
+ const $ = c(53);
66
+ const { LinkComponent, activeRoute, basePath: t1, brandName: brandNameProp, sidebarCollapsed: t2, children, className, sidebarProps, header, footer, navigate: navigateProp, theme: themeProp, setTheme: setThemeProp, showThemeToggle, toasterProps, layoutMode: t3 } = t0;
85
67
  const basePath = t1 === void 0 ? "/admin" : t1;
86
68
  const sidebarCollapsedProp = t2 === void 0 ? false : t2;
87
- const theme = t3 === void 0 ? "system" : t3;
88
- const layoutMode = t4 === void 0 ? "wide" : t4;
69
+ const layoutMode = t3 === void 0 ? "wide" : t3;
70
+ const { theme, setTheme } = useManagedAdminTheme(themeProp, setThemeProp);
89
71
  const shouldShowHeader = !!header;
90
72
  const shouldShowFooter = !!footer;
91
- let t5;
73
+ let t4;
92
74
  if ($[0] !== brandNameProp || $[1] !== navigateProp) {
93
- t5 = {
75
+ t4 = {
94
76
  brandName: brandNameProp,
95
77
  navigate: navigateProp
96
78
  };
97
79
  $[0] = brandNameProp;
98
80
  $[1] = navigateProp;
99
- $[2] = t5;
100
- } else t5 = $[2];
101
- const { brandName, navigate } = useLayoutProps(t5);
81
+ $[2] = t4;
82
+ } else t4 = $[2];
83
+ const { brandName, navigate } = useLayoutProps(t4);
102
84
  const [isSearchOpen, setIsSearchOpen] = React.useState(false);
103
- let t6;
85
+ let t5;
104
86
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
105
- t6 = () => setIsSearchOpen(true);
106
- $[3] = t6;
107
- } else t6 = $[3];
108
- const openSearch = t6;
109
- let t7;
87
+ t5 = () => setIsSearchOpen(true);
88
+ $[3] = t5;
89
+ } else t5 = $[3];
90
+ const openSearch = t5;
91
+ let t6;
110
92
  if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
111
- t7 = () => setIsSearchOpen(false);
112
- $[4] = t7;
113
- } else t7 = $[4];
114
- const closeSearch = t7;
93
+ t6 = () => setIsSearchOpen(false);
94
+ $[4] = t6;
95
+ } else t6 = $[4];
96
+ const closeSearch = t6;
97
+ let t7;
115
98
  let t8;
116
- let t9;
117
99
  if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
118
- t8 = () => {
100
+ t7 = () => {
119
101
  const down = (e) => {
120
- if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
102
+ if (shouldHandleAdminShortcut(e, { key: "k" })) {
121
103
  e.preventDefault();
122
104
  setIsSearchOpen(true);
123
105
  }
@@ -125,32 +107,32 @@ function AdminLayout(t0) {
125
107
  document.addEventListener("keydown", down);
126
108
  return () => document.removeEventListener("keydown", down);
127
109
  };
128
- t9 = [];
129
- $[5] = t8;
130
- $[6] = t9;
110
+ t8 = [];
111
+ $[5] = t7;
112
+ $[6] = t8;
131
113
  } else {
132
- t8 = $[5];
133
- t9 = $[6];
114
+ t7 = $[5];
115
+ t8 = $[6];
134
116
  }
135
- React.useEffect(t8, t9);
136
- let t10;
117
+ React.useEffect(t7, t8);
118
+ let t9;
137
119
  if ($[7] !== className) {
138
- t10 = cn("qa-admin-layout bg-background min-h-screen", className);
120
+ t9 = cn("qa-admin-layout bg-sidebar text-foreground min-h-screen", className);
139
121
  $[7] = className;
140
- $[8] = t10;
141
- } else t10 = $[8];
142
- let t11;
122
+ $[8] = t9;
123
+ } else t9 = $[8];
124
+ let t10;
143
125
  if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
144
- t11 = /* @__PURE__ */ jsx("a", {
126
+ t10 = /* @__PURE__ */ jsx("a", {
145
127
  href: "#main-content",
146
- className: "qa-admin-layout__skip-link focus:bg-primary focus:text-primary-foreground sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-50 focus:px-4 focus:py-2 focus:text-sm focus:font-medium",
128
+ className: "qa-admin-layout__skip-link focus:bg-surface-high focus:text-foreground sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-50 focus:rounded-sm focus:px-4 focus:py-2 focus:text-sm focus:font-medium",
147
129
  children: "Skip to main content"
148
130
  });
149
- $[9] = t11;
150
- } else t11 = $[9];
151
- let t12;
131
+ $[9] = t10;
132
+ } else t10 = $[9];
133
+ let t11;
152
134
  if ($[10] !== basePath || $[11] !== isSearchOpen || $[12] !== navigate) {
153
- t12 = isSearchOpen && /* @__PURE__ */ jsx(GlobalSearch, {
135
+ t11 = isSearchOpen && /* @__PURE__ */ jsx(GlobalSearch, {
154
136
  isOpen: isSearchOpen,
155
137
  onClose: closeSearch,
156
138
  navigate,
@@ -159,143 +141,138 @@ function AdminLayout(t0) {
159
141
  $[10] = basePath;
160
142
  $[11] = isSearchOpen;
161
143
  $[12] = navigate;
162
- $[13] = t12;
163
- } else t12 = $[13];
164
- const t13 = !sidebarCollapsedProp;
165
- let t14;
166
- if ($[14] !== LinkComponent || $[15] !== activeRoute || $[16] !== basePath || $[17] !== brandName || $[18] !== sidebarProps) {
167
- t14 = /* @__PURE__ */ jsx(AdminSidebar, {
144
+ $[13] = t11;
145
+ } else t11 = $[13];
146
+ const t12 = !sidebarCollapsedProp;
147
+ let t13;
148
+ if ($[14] !== LinkComponent || $[15] !== activeRoute || $[16] !== basePath || $[17] !== brandName || $[18] !== setTheme || $[19] !== showThemeToggle || $[20] !== sidebarProps || $[21] !== theme) {
149
+ t13 = /* @__PURE__ */ jsx(AdminSidebar, {
168
150
  LinkComponent,
169
151
  activeRoute,
170
152
  basePath,
171
153
  brandName,
154
+ theme,
155
+ setTheme,
156
+ showThemeToggle,
157
+ onSearchOpen: openSearch,
172
158
  ...sidebarProps
173
159
  });
174
160
  $[14] = LinkComponent;
175
161
  $[15] = activeRoute;
176
162
  $[16] = basePath;
177
163
  $[17] = brandName;
178
- $[18] = sidebarProps;
179
- $[19] = t14;
180
- } else t14 = $[19];
181
- let t15;
182
- if ($[20] !== setTheme || $[21] !== showThemeToggle || $[22] !== theme) {
183
- t15 = /* @__PURE__ */ jsx(AdminTopbarWithBreadcrumbs, {
184
- onSearchOpen: openSearch,
185
- theme,
186
- setTheme,
187
- showThemeToggle
188
- });
189
- $[20] = setTheme;
190
- $[21] = showThemeToggle;
191
- $[22] = theme;
192
- $[23] = t15;
193
- } else t15 = $[23];
194
- let t16;
195
- if ($[24] !== header || $[25] !== shouldShowHeader) {
196
- t16 = shouldShowHeader && header && /* @__PURE__ */ jsx("header", {
197
- className: "qa-admin-layout__header border-b",
164
+ $[18] = setTheme;
165
+ $[19] = showThemeToggle;
166
+ $[20] = sidebarProps;
167
+ $[21] = theme;
168
+ $[22] = t13;
169
+ } else t13 = $[22];
170
+ let t14;
171
+ if ($[23] !== header || $[24] !== shouldShowHeader) {
172
+ t14 = shouldShowHeader && header && /* @__PURE__ */ jsx("header", {
173
+ className: "qa-admin-layout__header border-border-subtle border-b",
198
174
  children: header
199
175
  });
200
- $[24] = header;
201
- $[25] = shouldShowHeader;
202
- $[26] = t16;
203
- } else t16 = $[26];
204
- const t17 = layoutMode === "default" && "mx-auto max-w-5xl p-3 md:p-4 lg:p-6";
205
- const t18 = layoutMode === "wide" && "p-3 md:p-4 lg:p-6";
206
- const t19 = layoutMode === "full" && "p-2 md:p-3";
207
- const t20 = layoutMode === "immersive" && "p-0";
208
- let t21;
209
- if ($[27] !== t17 || $[28] !== t18 || $[29] !== t19 || $[30] !== t20) {
210
- t21 = cn("qa-admin-layout__main-content min-w-0", t17, t18, t19, t20);
211
- $[27] = t17;
212
- $[28] = t18;
213
- $[29] = t19;
214
- $[30] = t20;
215
- $[31] = t21;
216
- } else t21 = $[31];
217
- let t22;
218
- if ($[32] !== children || $[33] !== t21) {
219
- t22 = /* @__PURE__ */ jsx("main", {
176
+ $[23] = header;
177
+ $[24] = shouldShowHeader;
178
+ $[25] = t14;
179
+ } else t14 = $[25];
180
+ const t15 = layoutMode === "default" && "mx-auto max-w-5xl px-3 pt-1 pb-6 md:px-4 md:pt-2 md:pb-8";
181
+ const t16 = layoutMode === "wide" && "px-3 pt-1 pb-6 md:px-4 md:pt-2 md:pb-8";
182
+ const t17 = layoutMode === "full" && "px-2 pt-1 pb-6 md:px-3 md:pb-8";
183
+ const t18 = layoutMode === "immersive" && "p-0";
184
+ let t19;
185
+ if ($[26] !== t15 || $[27] !== t16 || $[28] !== t17 || $[29] !== t18) {
186
+ t19 = cn("qa-admin-layout__main-content min-w-0", t15, t16, t17, t18);
187
+ $[26] = t15;
188
+ $[27] = t16;
189
+ $[28] = t17;
190
+ $[29] = t18;
191
+ $[30] = t19;
192
+ } else t19 = $[30];
193
+ let t20;
194
+ if ($[31] !== children || $[32] !== t19) {
195
+ t20 = /* @__PURE__ */ jsx("main", {
220
196
  id: "main-content",
221
197
  className: "qa-admin-layout__main min-w-0 flex-1 overflow-y-auto",
222
198
  tabIndex: -1,
223
199
  children: /* @__PURE__ */ jsx("div", {
224
- className: t21,
200
+ className: t19,
225
201
  children
226
202
  })
227
203
  });
228
- $[32] = children;
229
- $[33] = t21;
230
- $[34] = t22;
231
- } else t22 = $[34];
232
- let t23;
233
- if ($[35] !== footer || $[36] !== shouldShowFooter) {
234
- t23 = shouldShowFooter && footer && /* @__PURE__ */ jsx("footer", {
235
- className: "qa-admin-layout__footer border-t",
204
+ $[31] = children;
205
+ $[32] = t19;
206
+ $[33] = t20;
207
+ } else t20 = $[33];
208
+ let t21;
209
+ if ($[34] !== footer || $[35] !== shouldShowFooter) {
210
+ t21 = shouldShowFooter && footer && /* @__PURE__ */ jsx("footer", {
211
+ className: "qa-admin-layout__footer border-border-subtle border-t",
236
212
  children: footer
237
213
  });
238
- $[35] = footer;
239
- $[36] = shouldShowFooter;
240
- $[37] = t23;
241
- } else t23 = $[37];
242
- let t24;
243
- if ($[38] !== t15 || $[39] !== t16 || $[40] !== t22 || $[41] !== t23) {
244
- t24 = /* @__PURE__ */ jsxs(SidebarInset, {
245
- className: "qa-admin-layout__content flex h-svh flex-col",
214
+ $[34] = footer;
215
+ $[35] = shouldShowFooter;
216
+ $[36] = t21;
217
+ } else t21 = $[36];
218
+ let t22;
219
+ if ($[37] !== t14 || $[38] !== t20 || $[39] !== t21) {
220
+ t22 = /* @__PURE__ */ jsxs(SidebarInset, {
221
+ className: "qa-admin-layout__content bg-background flex h-svh flex-col overflow-hidden md:rounded-tl-2xl",
246
222
  children: [
247
- t15,
248
- t16,
249
- t22,
250
- t23
223
+ t14,
224
+ t20,
225
+ t21
251
226
  ]
252
227
  });
253
- $[38] = t15;
254
- $[39] = t16;
228
+ $[37] = t14;
229
+ $[38] = t20;
230
+ $[39] = t21;
255
231
  $[40] = t22;
256
- $[41] = t23;
257
- $[42] = t24;
258
- } else t24 = $[42];
259
- let t25;
260
- if ($[43] !== t13 || $[44] !== t14 || $[45] !== t24) {
261
- t25 = /* @__PURE__ */ jsxs(SidebarProvider, {
262
- defaultOpen: t13,
263
- className: "qa-admin-layout__sidebar-wrapper border-border mx-auto h-svh max-w-[1920px] overflow-hidden border-x",
264
- children: [t14, t24]
232
+ } else t22 = $[40];
233
+ let t23;
234
+ if ($[41] !== t12 || $[42] !== t13 || $[43] !== t22) {
235
+ t23 = /* @__PURE__ */ jsxs(SidebarProvider, {
236
+ defaultOpen: t12,
237
+ className: "qa-admin-layout__sidebar-wrapper bg-sidebar mx-auto h-svh max-w-[1920px] overflow-hidden",
238
+ children: [t13, t22]
265
239
  });
266
- $[43] = t13;
267
- $[44] = t14;
268
- $[45] = t24;
269
- $[46] = t25;
270
- } else t25 = $[46];
271
- let t26;
272
- if ($[47] !== theme || $[48] !== toasterProps) {
273
- t26 = /* @__PURE__ */ jsx(Toaster, {
240
+ $[41] = t12;
241
+ $[42] = t13;
242
+ $[43] = t22;
243
+ $[44] = t23;
244
+ } else t23 = $[44];
245
+ let t24;
246
+ if ($[45] !== theme || $[46] !== toasterProps) {
247
+ t24 = /* @__PURE__ */ jsx(Toaster, {
274
248
  theme,
275
249
  ...toasterProps
276
250
  });
277
- $[47] = theme;
278
- $[48] = toasterProps;
279
- $[49] = t26;
280
- } else t26 = $[49];
281
- let t27;
282
- if ($[50] !== t10 || $[51] !== t12 || $[52] !== t25 || $[53] !== t26) {
283
- t27 = /* @__PURE__ */ jsx(BreadcrumbProvider, { children: /* @__PURE__ */ jsxs("div", {
284
- className: t10,
285
- children: [
286
- t11,
287
- t12,
288
- t25,
289
- t26
290
- ]
291
- }) });
292
- $[50] = t10;
293
- $[51] = t12;
251
+ $[45] = theme;
252
+ $[46] = toasterProps;
253
+ $[47] = t24;
254
+ } else t24 = $[47];
255
+ let t25;
256
+ if ($[48] !== t11 || $[49] !== t23 || $[50] !== t24 || $[51] !== t9) {
257
+ t25 = /* @__PURE__ */ jsx(AdminThemeAppliedContext.Provider, {
258
+ value: true,
259
+ children: /* @__PURE__ */ jsxs("div", {
260
+ className: t9,
261
+ children: [
262
+ t10,
263
+ t11,
264
+ t23,
265
+ t24
266
+ ]
267
+ })
268
+ });
269
+ $[48] = t11;
270
+ $[49] = t23;
271
+ $[50] = t24;
272
+ $[51] = t9;
294
273
  $[52] = t25;
295
- $[53] = t26;
296
- $[54] = t27;
297
- } else t27 = $[54];
298
- return t27;
274
+ } else t25 = $[52];
275
+ return t25;
299
276
  }
300
277
 
301
278
  //#endregion