@questpie/admin 3.0.3 → 3.0.5

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 (253) 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-editor-layout.mjs +2 -2
  16. package/dist/client/components/blocks/block-fields-renderer.mjs +64 -28
  17. package/dist/client/components/blocks/block-insert-button.mjs +4 -4
  18. package/dist/client/components/blocks/block-item.mjs +2 -2
  19. package/dist/client/components/blocks/block-library-sidebar.mjs +91 -63
  20. package/dist/client/components/component-renderer.mjs +1 -1
  21. package/dist/client/components/fields/array-field.mjs +14 -14
  22. package/dist/client/components/fields/asset-preview-field.mjs +1 -1
  23. package/dist/client/components/fields/blocks-field/blocks-field.mjs +84 -104
  24. package/dist/client/components/fields/json-field.mjs +2 -2
  25. package/dist/client/components/fields/object-array-field.mjs +22 -22
  26. package/dist/client/components/fields/object-field.mjs +5 -5
  27. package/dist/client/components/fields/relation/displays/cards-display.mjs +16 -9
  28. package/dist/client/components/fields/relation/displays/chips-display.mjs +15 -12
  29. package/dist/client/components/fields/relation/displays/grid-display.mjs +15 -11
  30. package/dist/client/components/fields/relation/displays/list-display.mjs +33 -20
  31. package/dist/client/components/fields/relation/displays/table-display.mjs +62 -93
  32. package/dist/client/components/fields/relation/relation-items-display.mjs +1 -1
  33. package/dist/client/components/fields/relation-picker.mjs +7 -6
  34. package/dist/client/components/fields/relation-select.mjs +71 -47
  35. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +392 -82
  36. package/dist/client/components/fields/rich-text-editor/extensions.mjs +54 -23
  37. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +24 -50
  38. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +66 -0
  39. package/dist/client/components/fields/rich-text-editor/index.d.mts +38 -0
  40. package/dist/client/components/fields/rich-text-editor/index.mjs +637 -376
  41. package/dist/client/components/fields/rich-text-editor/link-utils.mjs +26 -0
  42. package/dist/client/components/fields/rich-text-editor/presets.d.mts +10 -0
  43. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +27 -6
  44. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +464 -346
  45. package/dist/client/components/fields/rich-text-editor/types.d.mts +77 -0
  46. package/dist/client/components/fields/upload-field.mjs +45 -49
  47. package/dist/client/components/filter-builder/columns-tab.mjs +69 -62
  48. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +473 -308
  49. package/dist/client/components/filter-builder/filters-tab.mjs +109 -82
  50. package/dist/client/components/filter-builder/saved-views-tab.mjs +300 -198
  51. package/dist/client/components/history-sidebar.mjs +850 -340
  52. package/dist/client/components/layout/field-layout-renderer.mjs +6 -5
  53. package/dist/client/components/locale-switcher.mjs +8 -8
  54. package/dist/client/components/media/media-grid.mjs +106 -86
  55. package/dist/client/components/media/media-picker-dialog.mjs +242 -230
  56. package/dist/client/components/preview/live-preview-mode.mjs +1 -1
  57. package/dist/client/components/primitives/asset-preview.mjs +37 -22
  58. package/dist/client/components/primitives/date-input.mjs +212 -249
  59. package/dist/client/components/primitives/dropzone.mjs +192 -159
  60. package/dist/client/components/primitives/field-select-control.mjs +93 -0
  61. package/dist/client/components/primitives/select-multi.mjs +406 -365
  62. package/dist/client/components/primitives/select-single.mjs +391 -323
  63. package/dist/client/components/primitives/time-input.mjs +2 -2
  64. package/dist/client/components/sheets/resource-sheet.mjs +2 -0
  65. package/dist/client/components/ui/accordion.mjs +4 -4
  66. package/dist/client/components/ui/alert.mjs +3 -3
  67. package/dist/client/components/ui/badge.mjs +4 -4
  68. package/dist/client/components/ui/button.mjs +47 -37
  69. package/dist/client/components/ui/card.mjs +2 -2
  70. package/dist/client/components/ui/checkbox.mjs +1 -1
  71. package/dist/client/components/ui/command.mjs +5 -5
  72. package/dist/client/components/ui/dialog.mjs +3 -3
  73. package/dist/client/components/ui/drawer.mjs +1 -1
  74. package/dist/client/components/ui/dropdown-menu.mjs +157 -15
  75. package/dist/client/components/ui/empty-state.mjs +88 -59
  76. package/dist/client/components/ui/field.mjs +2 -2
  77. package/dist/client/components/ui/input-group.mjs +3 -3
  78. package/dist/client/components/ui/input.mjs +1 -1
  79. package/dist/client/components/ui/kbd.mjs +1 -1
  80. package/dist/client/components/ui/label.mjs +1 -1
  81. package/dist/client/components/ui/popover.mjs +19 -11
  82. package/dist/client/components/ui/scroll-fade.mjs +170 -0
  83. package/dist/client/components/ui/search-input.mjs +1 -1
  84. package/dist/client/components/ui/select.mjs +129 -27
  85. package/dist/client/components/ui/sheet.mjs +54 -34
  86. package/dist/client/components/ui/sidebar.mjs +15 -14
  87. package/dist/client/components/ui/skeleton.mjs +28 -12
  88. package/dist/client/components/ui/switch.mjs +2 -2
  89. package/dist/client/components/ui/table.mjs +82 -74
  90. package/dist/client/components/ui/tabs.mjs +26 -31
  91. package/dist/client/components/ui/textarea.mjs +1 -1
  92. package/dist/client/components/ui/tooltip.mjs +1 -1
  93. package/dist/client/components/widgets/chart-widget.mjs +154 -100
  94. package/dist/client/components/widgets/progress-widget.mjs +63 -36
  95. package/dist/client/components/widgets/quick-actions-widget.mjs +207 -115
  96. package/dist/client/components/widgets/recent-items-widget.mjs +147 -103
  97. package/dist/client/components/widgets/stats-widget.mjs +91 -72
  98. package/dist/client/components/widgets/table-widget.mjs +161 -247
  99. package/dist/client/components/widgets/timeline-widget.mjs +119 -78
  100. package/dist/client/components/widgets/value-widget.mjs +286 -157
  101. package/dist/client/components/widgets/widget-empty-state.mjs +88 -0
  102. package/dist/client/components/widgets/widget-skeletons.mjs +53 -20
  103. package/dist/client/contexts/focus-context.d.mts +2 -2
  104. package/dist/client/hooks/use-action.mjs +63 -55
  105. package/dist/client/hooks/use-audit-history.mjs +1 -65
  106. package/dist/client/hooks/use-collection-validation.mjs +36 -23
  107. package/dist/client/hooks/use-collection.mjs +96 -1
  108. package/dist/client/hooks/use-saved-views.mjs +70 -49
  109. package/dist/client/hooks/use-server-actions.mjs +70 -46
  110. package/dist/client/hooks/use-server-validation.mjs +156 -41
  111. package/dist/client/hooks/use-server-widget-data.mjs +1 -1
  112. package/dist/client/hooks/use-setup-status.d.mts +3 -3
  113. package/dist/client/hooks/use-setup-status.mjs +2 -2
  114. package/dist/client/hooks/use-transition-stage.mjs +2 -10
  115. package/dist/client/hooks/use-validation-error-map.mjs +31 -13
  116. package/dist/client/hooks/use-view-state.mjs +238 -174
  117. package/dist/client/i18n/date-locale.mjs +33 -0
  118. package/dist/client/i18n/hooks.mjs +17 -1
  119. package/dist/client/lib/utils.mjs +3 -2
  120. package/dist/client/preview/block-scope-context.d.mts +2 -2
  121. package/dist/client/preview/preview-banner.d.mts +2 -2
  122. package/dist/client/preview/preview-banner.mjs +75 -46
  123. package/dist/client/preview/preview-field.d.mts +4 -4
  124. package/dist/client/preview/preview-field.mjs +2 -2
  125. package/dist/client/runtime/provider.mjs +8 -1
  126. package/dist/client/runtime/translations-provider.mjs +1 -1
  127. package/dist/client/scope/picker.d.mts +2 -2
  128. package/dist/client/scope/provider.d.mts +2 -2
  129. package/dist/client/styles/base.css +1022 -0
  130. package/dist/client/styles/index.css +3 -589
  131. package/dist/client/utils/auto-expand-fields.mjs +4 -2
  132. package/dist/client/utils/keyboard-shortcuts.mjs +26 -0
  133. package/dist/client/utils/use-lazy-component.mjs +80 -0
  134. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  135. package/dist/client/views/auth/auth-layout.d.mts +17 -10
  136. package/dist/client/views/auth/auth-layout.mjs +291 -80
  137. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  138. package/dist/client/views/auth/forgot-password-form.mjs +2 -2
  139. package/dist/client/views/auth/login-form.d.mts +2 -2
  140. package/dist/client/views/auth/login-form.mjs +1 -1
  141. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  142. package/dist/client/views/auth/reset-password-form.mjs +2 -2
  143. package/dist/client/views/auth/setup-form.d.mts +2 -2
  144. package/dist/client/views/collection/auto-form-fields.mjs +11 -9
  145. package/dist/client/views/collection/bulk-action-toolbar.mjs +173 -138
  146. package/dist/client/views/collection/cells/complex-cells.mjs +22 -22
  147. package/dist/client/views/collection/cells/primitive-cells.mjs +1 -1
  148. package/dist/client/views/collection/cells/relation-cells.mjs +147 -129
  149. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +224 -278
  150. package/dist/client/views/collection/cells/shared/relation-chip.mjs +64 -36
  151. package/dist/client/views/collection/cells/upload-cells.mjs +199 -9
  152. package/dist/client/views/collection/columns/build-columns.mjs +29 -9
  153. package/dist/client/views/collection/columns/column-defaults.mjs +2 -2
  154. package/dist/client/views/collection/field-renderer.mjs +50 -89
  155. package/dist/client/views/collection/form-view.mjs +237 -227
  156. package/dist/client/views/collection/table-view.mjs +1167 -234
  157. package/dist/client/views/collection/view-skeletons.mjs +222 -79
  158. package/dist/client/views/common/global-search.mjs +29 -18
  159. package/dist/client/views/dashboard/dashboard-grid.mjs +678 -501
  160. package/dist/client/views/dashboard/dashboard-widget.mjs +6 -3
  161. package/dist/client/views/dashboard/widget-card.mjs +23 -14
  162. package/dist/client/views/globals/global-form-view.mjs +634 -589
  163. package/dist/client/views/layout/admin-layout-provider.mjs +67 -70
  164. package/dist/client/views/layout/admin-layout.d.mts +3 -6
  165. package/dist/client/views/layout/admin-layout.mjs +152 -155
  166. package/dist/client/views/layout/admin-router.mjs +936 -616
  167. package/dist/client/views/layout/admin-sidebar.d.mts +38 -1
  168. package/dist/client/views/layout/admin-sidebar.mjs +762 -592
  169. package/dist/client/views/layout/admin-theme.d.mts +10 -0
  170. package/dist/client/views/layout/admin-theme.mjs +84 -0
  171. package/dist/client/views/layout/admin-view-layout.mjs +161 -0
  172. package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
  173. package/dist/client/views/pages/accept-invite-page.mjs +49 -26
  174. package/dist/client/views/pages/dashboard-page.d.mts +2 -2
  175. package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
  176. package/dist/client/views/pages/forgot-password-page.mjs +2 -19
  177. package/dist/client/views/pages/invite-page.d.mts +2 -2
  178. package/dist/client/views/pages/invite-page.mjs +2 -19
  179. package/dist/client/views/pages/login-page.d.mts +3 -3
  180. package/dist/client/views/pages/login-page.mjs +4 -21
  181. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  182. package/dist/client/views/pages/reset-password-page.mjs +3 -20
  183. package/dist/client/views/pages/setup-page.d.mts +2 -2
  184. package/dist/client/views/pages/setup-page.mjs +70 -71
  185. package/dist/client.d.mts +6 -2
  186. package/dist/client.mjs +2 -1
  187. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  188. package/dist/index.d.mts +6 -2
  189. package/dist/index.mjs +2 -1
  190. package/dist/server/augmentation/dashboard.d.mts +67 -3
  191. package/dist/server/augmentation/form-layout.d.mts +21 -0
  192. package/dist/server/augmentation/index.d.mts +1 -1
  193. package/dist/server/codegen/admin-client-template.mjs +4 -0
  194. package/dist/server/fields/blocks.d.mts +1 -1
  195. package/dist/server/fields/blocks.mjs +12 -0
  196. package/dist/server/fields/rich-text.d.mts +1 -1
  197. package/dist/server/fields/rich-text.mjs +8 -0
  198. package/dist/server/i18n/index.mjs +29 -7
  199. package/dist/server/i18n/messages/cs.mjs +414 -1
  200. package/dist/server/i18n/messages/de.mjs +412 -1
  201. package/dist/server/i18n/messages/en.mjs +166 -1
  202. package/dist/server/i18n/messages/es.mjs +412 -1
  203. package/dist/server/i18n/messages/fr.mjs +412 -1
  204. package/dist/server/i18n/messages/pl.mjs +416 -1
  205. package/dist/server/i18n/messages/pt.mjs +409 -1
  206. package/dist/server/i18n/messages/sk.mjs +216 -2
  207. package/dist/server/modules/admin/block/introspection.mjs +4 -1
  208. package/dist/server/modules/admin/block/prefetch.mjs +12 -2
  209. package/dist/server/modules/admin/collections/account.d.mts +2 -2
  210. package/dist/server/modules/admin/collections/admin-locks.d.mts +2 -2
  211. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  212. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  213. package/dist/server/modules/admin/collections/apikey.d.mts +42 -42
  214. package/dist/server/modules/admin/collections/assets.d.mts +20 -20
  215. package/dist/server/modules/admin/collections/assets.mjs +0 -1
  216. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  217. package/dist/server/modules/admin/collections/user.d.mts +40 -28
  218. package/dist/server/modules/admin/collections/user.mjs +40 -9
  219. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  220. package/dist/server/modules/admin/dto/admin-config.dto.mjs +2 -0
  221. package/dist/server/modules/admin/factories.mjs +7 -18
  222. package/dist/server/modules/admin/index.d.mts +1 -1
  223. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  224. package/dist/server/modules/admin/routes/admin-config.mjs +34 -16
  225. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  226. package/dist/server/modules/admin/routes/execute-action.mjs +67 -28
  227. package/dist/server/modules/admin/routes/i18n-helpers.mjs +34 -0
  228. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  229. package/dist/server/modules/admin/routes/preview.mjs +25 -17
  230. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  231. package/dist/server/modules/admin/routes/route-helpers.mjs +1 -1
  232. package/dist/server/modules/admin/routes/setup.d.mts +10 -10
  233. package/dist/server/modules/admin/routes/setup.mjs +16 -13
  234. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  235. package/dist/server/modules/admin/routes/translations.mjs +5 -1
  236. package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +1 -1
  237. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +2 -2
  238. package/dist/server/modules/audit/.generated/module.d.mts +1 -1
  239. package/dist/server/modules/audit/.generated/module.mjs +1 -1
  240. package/dist/server/modules/audit/collections/audit-log.d.mts +2 -2
  241. package/dist/server/modules/audit/collections/audit-log.mjs +1 -1
  242. package/dist/server/modules/audit/config/app.mjs +99 -42
  243. package/dist/server/modules/audit/jobs/audit-cleanup.mjs +1 -1
  244. package/dist/server/plugin.mjs +4 -2
  245. package/dist/server/proxy-factories.d.mts +4 -3
  246. package/dist/server/proxy-factories.mjs +34 -8
  247. package/dist/shared/types/saved-views.types.d.mts +2 -0
  248. package/package.json +6 -4
  249. package/dist/client/components/fields/rich-text-editor/link-popover.mjs +0 -85
  250. package/dist/client/components/ui/spinner.mjs +0 -52
  251. package/dist/client/components/ui/toolbar.mjs +0 -136
  252. package/dist/client/contexts/breadcrumb-context.mjs +0 -60
  253. package/dist/client/views/layout/admin-topbar.mjs +0 -236
@@ -1,136 +0,0 @@
1
- import { cn } from "../../lib/utils.mjs";
2
- import { c } from "react/compiler-runtime";
3
- import { jsx } from "react/jsx-runtime";
4
-
5
- //#region src/client/components/ui/toolbar.tsx
6
- /**
7
- * Toolbar - Container for toolbar elements with glass effect
8
- *
9
- * @example
10
- * ```tsx
11
- * <Toolbar>
12
- * <ToolbarSection className="flex-1">
13
- * <SearchInput value={search} onChange={setSearch} />
14
- * </ToolbarSection>
15
- * <ToolbarSeparator />
16
- * <ToolbarSection>
17
- * <Button variant="outline" size="sm">Options</Button>
18
- * </ToolbarSection>
19
- * </Toolbar>
20
- * ```
21
- */
22
- function Toolbar(t0) {
23
- const $ = c(10);
24
- let children;
25
- let className;
26
- let props;
27
- if ($[0] !== t0) {
28
- ({children, className, ...props} = t0);
29
- $[0] = t0;
30
- $[1] = children;
31
- $[2] = className;
32
- $[3] = props;
33
- } else {
34
- children = $[1];
35
- className = $[2];
36
- props = $[3];
37
- }
38
- let t1;
39
- if ($[4] !== className) {
40
- t1 = cn("qa-toolbar bg-card border-border border", "flex items-center gap-2 p-1", className);
41
- $[4] = className;
42
- $[5] = t1;
43
- } else t1 = $[5];
44
- let t2;
45
- if ($[6] !== children || $[7] !== props || $[8] !== t1) {
46
- t2 = /* @__PURE__ */ jsx("div", {
47
- "data-slot": "toolbar",
48
- className: t1,
49
- ...props,
50
- children
51
- });
52
- $[6] = children;
53
- $[7] = props;
54
- $[8] = t1;
55
- $[9] = t2;
56
- } else t2 = $[9];
57
- return t2;
58
- }
59
- /**
60
- * ToolbarSection - Group of related toolbar elements
61
- */
62
- function ToolbarSection(t0) {
63
- const $ = c(10);
64
- let children;
65
- let className;
66
- let props;
67
- if ($[0] !== t0) {
68
- ({children, className, ...props} = t0);
69
- $[0] = t0;
70
- $[1] = children;
71
- $[2] = className;
72
- $[3] = props;
73
- } else {
74
- children = $[1];
75
- className = $[2];
76
- props = $[3];
77
- }
78
- let t1;
79
- if ($[4] !== className) {
80
- t1 = cn("qa-toolbar__section flex items-center gap-1", className);
81
- $[4] = className;
82
- $[5] = t1;
83
- } else t1 = $[5];
84
- let t2;
85
- if ($[6] !== children || $[7] !== props || $[8] !== t1) {
86
- t2 = /* @__PURE__ */ jsx("div", {
87
- "data-slot": "toolbar-section",
88
- className: t1,
89
- ...props,
90
- children
91
- });
92
- $[6] = children;
93
- $[7] = props;
94
- $[8] = t1;
95
- $[9] = t2;
96
- } else t2 = $[9];
97
- return t2;
98
- }
99
- /**
100
- * ToolbarSeparator - Vertical separator between toolbar sections
101
- */
102
- function ToolbarSeparator(t0) {
103
- const $ = c(8);
104
- let className;
105
- let props;
106
- if ($[0] !== t0) {
107
- ({className, ...props} = t0);
108
- $[0] = t0;
109
- $[1] = className;
110
- $[2] = props;
111
- } else {
112
- className = $[1];
113
- props = $[2];
114
- }
115
- let t1;
116
- if ($[3] !== className) {
117
- t1 = cn("qa-toolbar__separator bg-border h-4 w-px", className);
118
- $[3] = className;
119
- $[4] = t1;
120
- } else t1 = $[4];
121
- let t2;
122
- if ($[5] !== props || $[6] !== t1) {
123
- t2 = /* @__PURE__ */ jsx("div", {
124
- "data-slot": "toolbar-separator",
125
- className: t1,
126
- ...props
127
- });
128
- $[5] = props;
129
- $[6] = t1;
130
- $[7] = t2;
131
- } else t2 = $[7];
132
- return t2;
133
- }
134
-
135
- //#endregion
136
- export { Toolbar, ToolbarSection, ToolbarSeparator };
@@ -1,60 +0,0 @@
1
- import { c } from "react/compiler-runtime";
2
- import * as React from "react";
3
- import { jsx } from "react/jsx-runtime";
4
-
5
- //#region src/client/contexts/breadcrumb-context.tsx
6
- const BreadcrumbContext = React.createContext(null);
7
- function BreadcrumbProvider(t0) {
8
- const $ = c(6);
9
- const { children } = t0;
10
- let t1;
11
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
12
- t1 = [];
13
- $[0] = t1;
14
- } else t1 = $[0];
15
- const [breadcrumbs, setBreadcrumbs] = React.useState(t1);
16
- let t2;
17
- if ($[1] !== breadcrumbs) {
18
- t2 = {
19
- breadcrumbs,
20
- setBreadcrumbs
21
- };
22
- $[1] = breadcrumbs;
23
- $[2] = t2;
24
- } else t2 = $[2];
25
- const value = t2;
26
- let t3;
27
- if ($[3] !== children || $[4] !== value) {
28
- t3 = /* @__PURE__ */ jsx(BreadcrumbContext.Provider, {
29
- value,
30
- children
31
- });
32
- $[3] = children;
33
- $[4] = value;
34
- $[5] = t3;
35
- } else t3 = $[5];
36
- return t3;
37
- }
38
- /**
39
- * Get breadcrumb context (optional - returns null if not in provider)
40
- */
41
- function useBreadcrumbContextOptional() {
42
- return React.useContext(BreadcrumbContext);
43
- }
44
- /**
45
- * Get current breadcrumbs (read-only)
46
- */
47
- function useCurrentBreadcrumbs() {
48
- const $ = c(2);
49
- const context = useBreadcrumbContextOptional();
50
- let t0;
51
- if ($[0] !== context?.breadcrumbs) {
52
- t0 = context?.breadcrumbs ?? [];
53
- $[0] = context?.breadcrumbs;
54
- $[1] = t0;
55
- } else t0 = $[1];
56
- return t0;
57
- }
58
-
59
- //#endregion
60
- export { BreadcrumbProvider, useCurrentBreadcrumbs };
@@ -1,236 +0,0 @@
1
- import { useResolveText, useTranslation } from "../../i18n/hooks.mjs";
2
- import { cn } from "../../lib/utils.mjs";
3
- import { Button } from "../../components/ui/button.mjs";
4
- import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../../components/ui/dropdown-menu.mjs";
5
- import { SidebarTrigger } from "../../components/ui/sidebar.mjs";
6
- import { Kbd } from "../../components/ui/kbd.mjs";
7
- import { c } from "react/compiler-runtime";
8
- import { Icon } from "@iconify/react";
9
- import * as React from "react";
10
- import { jsx, jsxs } from "react/jsx-runtime";
11
-
12
- //#region src/client/views/layout/admin-topbar.tsx
13
- const EMPTY_BREADCRUMBS = [];
14
- const AdminTopbar = React.memo(function AdminTopbar$1(t0) {
15
- const $ = c(34);
16
- const { onSearchOpen, breadcrumbs, theme: t1, setTheme, showThemeToggle } = t0;
17
- const resolvedBreadcrumbs = breadcrumbs ?? EMPTY_BREADCRUMBS;
18
- const resolveText = useResolveText();
19
- const { t } = useTranslation();
20
- const shouldShowThemeToggle = setTheme && showThemeToggle !== false;
21
- let t2;
22
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23
- t2 = /* @__PURE__ */ jsx(SidebarTrigger, {});
24
- $[0] = t2;
25
- } else t2 = $[0];
26
- let t3;
27
- if ($[1] !== resolveText || $[2] !== resolvedBreadcrumbs) {
28
- t3 = resolvedBreadcrumbs.length > 0 && /* @__PURE__ */ jsx("span", {
29
- className: "qa-topbar__mobile-title text-foreground max-w-[140px] truncate font-mono text-xs font-medium md:hidden",
30
- children: resolveText(resolvedBreadcrumbs[resolvedBreadcrumbs.length - 1].label)
31
- });
32
- $[1] = resolveText;
33
- $[2] = resolvedBreadcrumbs;
34
- $[3] = t3;
35
- } else t3 = $[3];
36
- let t4;
37
- if ($[4] !== resolveText || $[5] !== resolvedBreadcrumbs) {
38
- t4 = resolvedBreadcrumbs.map((crumb) => {
39
- const CrumbIcon = crumb.icon;
40
- const crumbLabel = resolveText(crumb.label);
41
- const crumbKey = crumb.href ?? crumbLabel;
42
- return /* @__PURE__ */ jsxs(React.Fragment, { children: [resolvedBreadcrumbs[0] !== crumb && /* @__PURE__ */ jsx("span", {
43
- className: "qa-topbar__breadcrumb-separator text-muted-foreground/40 mx-1",
44
- children: "/"
45
- }), crumb.menu ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, { render: /* @__PURE__ */ jsxs("button", {
46
- type: "button",
47
- className: cn("qa-topbar__breadcrumb-item hover:text-foreground flex items-center gap-1 transition-colors", resolvedBreadcrumbs[resolvedBreadcrumbs.length - 1] === crumb && "text-foreground font-medium"),
48
- children: [
49
- CrumbIcon && /* @__PURE__ */ jsx(CrumbIcon, { className: "size-3.5" }),
50
- crumbLabel,
51
- /* @__PURE__ */ jsx(Icon, {
52
- icon: "ph:caret-down",
53
- className: "size-3 opacity-50"
54
- })
55
- ]
56
- }) }), /* @__PURE__ */ jsx(DropdownMenuContent, {
57
- align: "start",
58
- children: crumb.menu.items.map((item) => {
59
- const ItemIcon = item.icon;
60
- return /* @__PURE__ */ jsxs(DropdownMenuItem, {
61
- onClick: () => {
62
- window.location.href = item.href;
63
- },
64
- children: [ItemIcon && /* @__PURE__ */ jsx(ItemIcon, { className: "size-3.5" }), resolveText(item.label)]
65
- }, item.href);
66
- })
67
- })] }) : crumb.href ? /* @__PURE__ */ jsxs("a", {
68
- href: crumb.href,
69
- className: "qa-topbar__breadcrumb-item hover:text-foreground flex items-center gap-1.5 transition-colors",
70
- children: [CrumbIcon && /* @__PURE__ */ jsx(CrumbIcon, { className: "size-3.5" }), crumbLabel]
71
- }) : /* @__PURE__ */ jsxs("span", {
72
- className: cn("qa-topbar__breadcrumb-item flex items-center gap-1.5", resolvedBreadcrumbs[resolvedBreadcrumbs.length - 1] === crumb ? "text-foreground font-medium" : ""),
73
- "aria-current": resolvedBreadcrumbs[resolvedBreadcrumbs.length - 1] === crumb ? "page" : void 0,
74
- children: [CrumbIcon && /* @__PURE__ */ jsx(CrumbIcon, { className: "size-3.5" }), crumbLabel]
75
- })] }, crumbKey);
76
- });
77
- $[4] = resolveText;
78
- $[5] = resolvedBreadcrumbs;
79
- $[6] = t4;
80
- } else t4 = $[6];
81
- let t5;
82
- if ($[7] !== t4) {
83
- t5 = /* @__PURE__ */ jsx("nav", {
84
- "aria-label": "Breadcrumb",
85
- className: "qa-topbar__breadcrumbs text-muted-foreground hidden items-center gap-1.5 font-mono text-xs md:flex",
86
- children: t4
87
- });
88
- $[7] = t4;
89
- $[8] = t5;
90
- } else t5 = $[8];
91
- let t6;
92
- if ($[9] !== t3 || $[10] !== t5) {
93
- t6 = /* @__PURE__ */ jsxs("div", {
94
- className: "qa-topbar__left flex items-center gap-2",
95
- children: [
96
- t2,
97
- t3,
98
- t5
99
- ]
100
- });
101
- $[9] = t3;
102
- $[10] = t5;
103
- $[11] = t6;
104
- } else t6 = $[11];
105
- let t7;
106
- if ($[12] !== t) {
107
- t7 = t("ui.searchPlaceholder");
108
- $[12] = t;
109
- $[13] = t7;
110
- } else t7 = $[13];
111
- let t8;
112
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
113
- t8 = /* @__PURE__ */ jsx(Icon, { icon: "ph:magnifying-glass" });
114
- $[14] = t8;
115
- } else t8 = $[14];
116
- let t9;
117
- if ($[15] !== t) {
118
- t9 = t("ui.searchPlaceholder");
119
- $[15] = t;
120
- $[16] = t9;
121
- } else t9 = $[16];
122
- let t10;
123
- if ($[17] !== t9) {
124
- t10 = /* @__PURE__ */ jsxs("span", {
125
- className: "flex items-center gap-2",
126
- children: [t8, /* @__PURE__ */ jsx("span", {
127
- className: "hidden md:inline",
128
- children: t9
129
- })]
130
- });
131
- $[17] = t9;
132
- $[18] = t10;
133
- } else t10 = $[18];
134
- let t11;
135
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
136
- t11 = /* @__PURE__ */ jsxs(Kbd, {
137
- className: "hidden md:inline-flex",
138
- children: [/* @__PURE__ */ jsx("span", {
139
- className: "text-xs",
140
- children: "⌘"
141
- }), "K"]
142
- });
143
- $[19] = t11;
144
- } else t11 = $[19];
145
- let t12;
146
- if ($[20] !== onSearchOpen || $[21] !== t10 || $[22] !== t7) {
147
- t12 = /* @__PURE__ */ jsxs(Button, {
148
- variant: "outline",
149
- onClick: onSearchOpen,
150
- size: "icon-sm",
151
- className: "qa-topbar__search-btn text-muted-foreground gap-2 md:size-auto md:h-9 md:w-64 md:justify-between md:px-3",
152
- "aria-label": t7,
153
- children: [t10, t11]
154
- });
155
- $[20] = onSearchOpen;
156
- $[21] = t10;
157
- $[22] = t7;
158
- $[23] = t12;
159
- } else t12 = $[23];
160
- let t13;
161
- if ($[24] !== setTheme || $[25] !== shouldShowThemeToggle || $[26] !== t) {
162
- t13 = shouldShowThemeToggle && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, { render: /* @__PURE__ */ jsxs(Button, {
163
- variant: "ghost",
164
- size: "icon",
165
- className: "qa-topbar__theme-toggle",
166
- children: [
167
- /* @__PURE__ */ jsx(Icon, {
168
- icon: "ph:sun",
169
- className: "size-4 scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90"
170
- }),
171
- /* @__PURE__ */ jsx(Icon, {
172
- icon: "ph:moon",
173
- className: "absolute size-4 scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0"
174
- }),
175
- /* @__PURE__ */ jsx("span", {
176
- className: "sr-only",
177
- children: t("ui.toggleTheme")
178
- })
179
- ]
180
- }) }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
181
- align: "end",
182
- children: [
183
- /* @__PURE__ */ jsxs(DropdownMenuItem, {
184
- onClick: () => setTheme("light"),
185
- children: [/* @__PURE__ */ jsx(Icon, {
186
- icon: "ph:sun",
187
- className: "mr-2 size-4"
188
- }), t("ui.themeLight")]
189
- }),
190
- /* @__PURE__ */ jsxs(DropdownMenuItem, {
191
- onClick: () => setTheme("dark"),
192
- children: [/* @__PURE__ */ jsx(Icon, {
193
- icon: "ph:moon",
194
- className: "mr-2 size-4"
195
- }), t("ui.themeDark")]
196
- }),
197
- /* @__PURE__ */ jsxs(DropdownMenuItem, {
198
- onClick: () => setTheme("system"),
199
- children: [/* @__PURE__ */ jsx(Icon, {
200
- icon: "ph:monitor",
201
- className: "mr-2 size-4"
202
- }), t("ui.themeSystem")]
203
- })
204
- ]
205
- })] });
206
- $[24] = setTheme;
207
- $[25] = shouldShowThemeToggle;
208
- $[26] = t;
209
- $[27] = t13;
210
- } else t13 = $[27];
211
- let t14;
212
- if ($[28] !== t12 || $[29] !== t13) {
213
- t14 = /* @__PURE__ */ jsxs("div", {
214
- className: "qa-topbar__right flex items-center gap-2",
215
- children: [t12, t13]
216
- });
217
- $[28] = t12;
218
- $[29] = t13;
219
- $[30] = t14;
220
- } else t14 = $[30];
221
- let t15;
222
- if ($[31] !== t14 || $[32] !== t6) {
223
- t15 = /* @__PURE__ */ jsxs("header", {
224
- role: "banner",
225
- className: "qa-topbar border-border bg-background/92 backdrop-blur-sm relative sticky top-0 z-50 flex h-14 w-full items-center justify-between border-b px-4 md:px-6",
226
- children: [t6, t14]
227
- });
228
- $[31] = t14;
229
- $[32] = t6;
230
- $[33] = t15;
231
- } else t15 = $[33];
232
- return t15;
233
- });
234
-
235
- //#endregion
236
- export { AdminTopbar };