@questpie/admin 3.2.4 → 3.2.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 (248) hide show
  1. package/dist/client/blocks/block-renderer.d.mts +2 -2
  2. package/dist/client/blocks/block-renderer.mjs +164 -339
  3. package/dist/client/components/actions/action-button.mjs +9 -9
  4. package/dist/client/components/actions/action-dialog.mjs +195 -493
  5. package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
  6. package/dist/client/components/actions/header-actions.mjs +73 -165
  7. package/dist/client/components/admin-link.mjs +40 -126
  8. package/dist/client/components/auth/auth-loading.mjs +9 -44
  9. package/dist/client/components/blocks/block-canvas.mjs +31 -95
  10. package/dist/client/components/blocks/block-editor-context.mjs +13 -57
  11. package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
  12. package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
  13. package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
  14. package/dist/client/components/blocks/block-insert-button.mjs +49 -165
  15. package/dist/client/components/blocks/block-item-menu.mjs +102 -301
  16. package/dist/client/components/blocks/block-item.mjs +136 -370
  17. package/dist/client/components/blocks/block-library-sidebar.mjs +103 -230
  18. package/dist/client/components/blocks/block-tree.mjs +12 -68
  19. package/dist/client/components/blocks/block-type-icon.mjs +14 -56
  20. package/dist/client/components/brand-logo.mjs +35 -149
  21. package/dist/client/components/component-renderer.mjs +42 -118
  22. package/dist/client/components/error-boundary.mjs +14 -58
  23. package/dist/client/components/fields/array-field.mjs +209 -521
  24. package/dist/client/components/fields/asset-preview-field.mjs +41 -141
  25. package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
  26. package/dist/client/components/fields/boolean-field.mjs +29 -59
  27. package/dist/client/components/fields/date-field.mjs +7 -37
  28. package/dist/client/components/fields/datetime-field.mjs +7 -38
  29. package/dist/client/components/fields/email-field.mjs +25 -54
  30. package/dist/client/components/fields/field-wrapper.mjs +30 -105
  31. package/dist/client/components/fields/json-field.mjs +94 -296
  32. package/dist/client/components/fields/locale-badge.mjs +6 -15
  33. package/dist/client/components/fields/number-field.mjs +27 -60
  34. package/dist/client/components/fields/object-array-field.mjs +283 -659
  35. package/dist/client/components/fields/object-field.mjs +165 -633
  36. package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
  37. package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
  38. package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
  39. package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
  40. package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
  41. package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
  42. package/dist/client/components/fields/relation-field.mjs +10 -66
  43. package/dist/client/components/fields/relation-picker.mjs +18 -18
  44. package/dist/client/components/fields/relation-select.mjs +12 -12
  45. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -180
  46. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
  47. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
  48. package/dist/client/components/fields/rich-text-editor/index.mjs +195 -513
  49. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
  50. package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
  51. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
  52. package/dist/client/components/fields/rich-text-field.mjs +14 -53
  53. package/dist/client/components/fields/select-field.mjs +39 -74
  54. package/dist/client/components/fields/text-field.mjs +26 -59
  55. package/dist/client/components/fields/textarea-field.mjs +26 -58
  56. package/dist/client/components/fields/time-field.mjs +7 -35
  57. package/dist/client/components/fields/upload-field.mjs +47 -165
  58. package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
  59. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
  60. package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
  61. package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
  62. package/dist/client/components/history-sidebar.mjs +285 -605
  63. package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
  64. package/dist/client/components/locale-switcher.mjs +106 -228
  65. package/dist/client/components/media/media-grid.mjs +84 -273
  66. package/dist/client/components/media/media-picker-dialog.mjs +176 -476
  67. package/dist/client/components/preview/live-preview-mode.mjs +233 -458
  68. package/dist/client/components/preview/preview-pane.mjs +22 -22
  69. package/dist/client/components/primitives/asset-preview.mjs +290 -666
  70. package/dist/client/components/primitives/checkbox-input.mjs +9 -35
  71. package/dist/client/components/primitives/date-input.mjs +109 -327
  72. package/dist/client/components/primitives/dropzone.mjs +209 -336
  73. package/dist/client/components/primitives/field-select-control.mjs +12 -80
  74. package/dist/client/components/primitives/number-input.mjs +4 -4
  75. package/dist/client/components/primitives/select-multi.mjs +200 -559
  76. package/dist/client/components/primitives/select-single.mjs +165 -499
  77. package/dist/client/components/primitives/time-input.mjs +43 -117
  78. package/dist/client/components/primitives/toggle-input.mjs +9 -29
  79. package/dist/client/components/sheets/resource-sheet.mjs +61 -70
  80. package/dist/client/components/ui/accordion.mjs +35 -155
  81. package/dist/client/components/ui/alert.mjs +13 -68
  82. package/dist/client/components/ui/badge.mjs +9 -51
  83. package/dist/client/components/ui/button.mjs +8 -54
  84. package/dist/client/components/ui/card.mjs +37 -193
  85. package/dist/client/components/ui/checkbox.mjs +12 -68
  86. package/dist/client/components/ui/command.mjs +48 -219
  87. package/dist/client/components/ui/dialog.mjs +50 -262
  88. package/dist/client/components/ui/drawer.mjs +55 -259
  89. package/dist/client/components/ui/dropdown-menu.mjs +86 -427
  90. package/dist/client/components/ui/empty-state.mjs +28 -98
  91. package/dist/client/components/ui/field.mjs +73 -309
  92. package/dist/client/components/ui/input-group.mjs +42 -167
  93. package/dist/client/components/ui/input.mjs +7 -37
  94. package/dist/client/components/ui/kbd.mjs +6 -36
  95. package/dist/client/components/ui/label.mjs +7 -37
  96. package/dist/client/components/ui/popover.mjs +34 -169
  97. package/dist/client/components/ui/responsive-dialog.mjs +67 -273
  98. package/dist/client/components/ui/scroll-fade.mjs +63 -158
  99. package/dist/client/components/ui/search-input.mjs +33 -100
  100. package/dist/client/components/ui/select.mjs +72 -393
  101. package/dist/client/components/ui/separator.mjs +7 -38
  102. package/dist/client/components/ui/sheet.mjs +49 -269
  103. package/dist/client/components/ui/sidebar.mjs +171 -690
  104. package/dist/client/components/ui/skeleton.mjs +7 -38
  105. package/dist/client/components/ui/sonner.mjs +11 -42
  106. package/dist/client/components/ui/switch.mjs +9 -45
  107. package/dist/client/components/ui/table.mjs +48 -266
  108. package/dist/client/components/ui/tabs.mjs +26 -139
  109. package/dist/client/components/ui/textarea.mjs +6 -32
  110. package/dist/client/components/ui/tooltip.mjs +27 -129
  111. package/dist/client/components/widgets/chart-widget.mjs +174 -522
  112. package/dist/client/components/widgets/progress-widget.mjs +66 -172
  113. package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
  114. package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
  115. package/dist/client/components/widgets/stats-widget.mjs +41 -175
  116. package/dist/client/components/widgets/table-widget.mjs +9 -9
  117. package/dist/client/components/widgets/timeline-widget.mjs +86 -226
  118. package/dist/client/components/widgets/value-widget.mjs +74 -381
  119. package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
  120. package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
  121. package/dist/client/contexts/focus-context.mjs +63 -146
  122. package/dist/client/hooks/typed-hooks.mjs +241 -701
  123. package/dist/client/hooks/use-action.mjs +62 -198
  124. package/dist/client/hooks/use-admin-config.mjs +5 -35
  125. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  126. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  127. package/dist/client/hooks/use-audit-history.mjs +21 -69
  128. package/dist/client/hooks/use-brand.mjs +1 -9
  129. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  130. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  131. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  132. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  133. package/dist/client/hooks/use-collection.mjs +194 -614
  134. package/dist/client/hooks/use-current-user.mjs +0 -1
  135. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  136. package/dist/client/hooks/use-field-options.mjs +61 -202
  137. package/dist/client/hooks/use-global-fields.mjs +14 -46
  138. package/dist/client/hooks/use-global-meta.mjs +9 -30
  139. package/dist/client/hooks/use-global-schema.mjs +9 -30
  140. package/dist/client/hooks/use-global.mjs +63 -219
  141. package/dist/client/hooks/use-locks.mjs +117 -325
  142. package/dist/client/hooks/use-media-query.mjs +16 -36
  143. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  144. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  145. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  146. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  147. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  148. package/dist/client/hooks/use-saved-views.mjs +22 -103
  149. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  150. package/dist/client/hooks/use-search.mjs +31 -143
  151. package/dist/client/hooks/use-server-actions.mjs +18 -50
  152. package/dist/client/hooks/use-server-validation.mjs +72 -166
  153. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  154. package/dist/client/hooks/use-setup-status.mjs +12 -25
  155. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  156. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  157. package/dist/client/hooks/use-upload.mjs +54 -152
  158. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  159. package/dist/client/hooks/use-view-state.mjs +187 -437
  160. package/dist/client/i18n/hooks.mjs +65 -197
  161. package/dist/client/lib/render-profiler.mjs +14 -41
  162. package/dist/client/preview/block-scope-context.d.mts +2 -2
  163. package/dist/client/preview/block-scope-context.mjs +14 -36
  164. package/dist/client/preview/preview-banner.d.mts +2 -2
  165. package/dist/client/preview/preview-banner.mjs +42 -108
  166. package/dist/client/preview/preview-field.d.mts +4 -4
  167. package/dist/client/preview/preview-field.mjs +167 -348
  168. package/dist/client/preview/use-collection-preview.mjs +121 -215
  169. package/dist/client/runtime/content-locales-provider.mjs +31 -83
  170. package/dist/client/runtime/locale-scope.mjs +22 -63
  171. package/dist/client/runtime/provider.mjs +100 -255
  172. package/dist/client/runtime/translations-provider.mjs +41 -107
  173. package/dist/client/scope/picker.d.mts +2 -2
  174. package/dist/client/scope/picker.mjs +86 -321
  175. package/dist/client/scope/provider.d.mts +2 -2
  176. package/dist/client/scope/provider.mjs +8 -17
  177. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  178. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  179. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  180. package/dist/client/views/auth/auth-layout.mjs +104 -284
  181. package/dist/client/views/auth/forgot-password-form.mjs +94 -325
  182. package/dist/client/views/auth/invite-form.mjs +107 -442
  183. package/dist/client/views/auth/login-form.d.mts +2 -2
  184. package/dist/client/views/auth/login-form.mjs +116 -337
  185. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  186. package/dist/client/views/auth/reset-password-form.mjs +128 -453
  187. package/dist/client/views/auth/setup-form.d.mts +2 -2
  188. package/dist/client/views/auth/setup-form.mjs +140 -478
  189. package/dist/client/views/collection/auto-form-fields.mjs +243 -615
  190. package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -379
  191. package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
  192. package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
  193. package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
  194. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
  195. package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
  196. package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
  197. package/dist/client/views/collection/columns/build-columns.mjs +8 -48
  198. package/dist/client/views/collection/field-renderer.mjs +58 -182
  199. package/dist/client/views/collection/form-view.mjs +284 -518
  200. package/dist/client/views/collection/table-view.mjs +231 -463
  201. package/dist/client/views/collection/view-skeletons.mjs +112 -237
  202. package/dist/client/views/common/global-search.mjs +241 -560
  203. package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
  204. package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
  205. package/dist/client/views/dashboard/widget-card.mjs +61 -269
  206. package/dist/client/views/globals/global-form-view.mjs +477 -1301
  207. package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
  208. package/dist/client/views/layout/admin-layout.mjs +83 -246
  209. package/dist/client/views/layout/admin-router.mjs +458 -1274
  210. package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
  211. package/dist/client/views/layout/admin-theme.mjs +30 -64
  212. package/dist/client/views/layout/admin-view-layout.mjs +40 -144
  213. package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
  214. package/dist/client/views/pages/accept-invite-page.mjs +95 -290
  215. package/dist/client/views/pages/dashboard-page.d.mts +2 -2
  216. package/dist/client/views/pages/dashboard-page.mjs +11 -57
  217. package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
  218. package/dist/client/views/pages/forgot-password-page.mjs +31 -83
  219. package/dist/client/views/pages/invite-page.d.mts +2 -2
  220. package/dist/client/views/pages/invite-page.mjs +35 -90
  221. package/dist/client/views/pages/login-page.mjs +41 -121
  222. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  223. package/dist/client/views/pages/setup-page.mjs +33 -95
  224. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  225. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  226. package/dist/server/modules/admin/collections/account.d.mts +46 -46
  227. package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
  228. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  229. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  230. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  231. package/dist/server/modules/admin/collections/assets.d.mts +39 -39
  232. package/dist/server/modules/admin/collections/session.d.mts +41 -41
  233. package/dist/server/modules/admin/collections/user.d.mts +63 -63
  234. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  235. package/dist/server/modules/admin/index.d.mts +20 -19
  236. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  237. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  238. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  239. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  240. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  241. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  242. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  243. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  244. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +45 -45
  245. package/dist/server/modules/audit/.generated/module.d.mts +6 -6
  246. package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
  247. package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
  248. package/package.json +3 -5
@@ -5,7 +5,6 @@ import { WidgetCard } from "../../views/dashboard/widget-card.mjs";
5
5
  import { useServerWidgetData } from "../../hooks/use-server-widget-data.mjs";
6
6
  import { WidgetEmptyState } from "./widget-empty-state.mjs";
7
7
  import { ProgressWidgetSkeleton } from "./widget-skeletons.mjs";
8
- import { c } from "react/compiler-runtime";
9
8
  import { useQuery } from "@tanstack/react-query";
10
9
  import { jsx, jsxs } from "react/jsx-runtime";
11
10
 
@@ -38,189 +37,84 @@ import { jsx, jsxs } from "react/jsx-runtime";
38
37
  * />
39
38
  * ```
40
39
  */
41
- function ProgressWidget(t0) {
42
- const $ = c(48);
43
- const { config } = t0;
40
+ function ProgressWidget({ config }) {
44
41
  const client = useAdminStore(selectClient);
45
42
  const resolveText = useResolveText();
46
43
  const { t } = useTranslation();
47
- const { color, showPercentage: t1 } = config;
48
- const showPercentage = t1 === void 0 ? true : t1;
44
+ const { color, showPercentage = true } = config;
49
45
  const useServerData = !!config.hasLoader;
50
- let t2;
51
- if ($[0] !== config.refreshInterval || $[1] !== useServerData) {
52
- t2 = {
53
- enabled: useServerData,
54
- refreshInterval: config.refreshInterval
55
- };
56
- $[0] = config.refreshInterval;
57
- $[1] = useServerData;
58
- $[2] = t2;
59
- } else t2 = $[2];
60
- const serverQuery = useServerWidgetData(config.id, t2);
61
- let t3;
62
- if ($[3] !== config.id) {
63
- t3 = [
46
+ const serverQuery = useServerWidgetData(config.id, {
47
+ enabled: useServerData,
48
+ refreshInterval: config.refreshInterval
49
+ });
50
+ const clientQuery = useQuery({
51
+ queryKey: [
64
52
  "widget",
65
53
  "progress",
66
54
  config.id
67
- ];
68
- $[3] = config.id;
69
- $[4] = t3;
70
- } else t3 = $[4];
71
- let t4;
72
- if ($[5] !== client || $[6] !== config.loader) {
73
- t4 = () => config.loader(client);
74
- $[5] = client;
75
- $[6] = config.loader;
76
- $[7] = t4;
77
- } else t4 = $[7];
78
- const t5 = !useServerData && !!config.loader;
79
- let t6;
80
- if ($[8] !== config.refreshInterval || $[9] !== t3 || $[10] !== t4 || $[11] !== t5) {
81
- t6 = {
82
- queryKey: t3,
83
- queryFn: t4,
84
- enabled: t5,
85
- refetchInterval: config.refreshInterval
86
- };
87
- $[8] = config.refreshInterval;
88
- $[9] = t3;
89
- $[10] = t4;
90
- $[11] = t5;
91
- $[12] = t6;
92
- } else t6 = $[12];
93
- const clientQuery = useQuery(t6);
55
+ ],
56
+ queryFn: () => config.loader(client),
57
+ enabled: !useServerData && !!config.loader,
58
+ refetchInterval: config.refreshInterval
59
+ });
94
60
  const { data, isLoading, error, refetch, isFetching } = useServerData ? serverQuery : clientQuery;
95
- let t7;
96
- if ($[13] !== config.title || $[14] !== resolveText) {
97
- t7 = config.title ? resolveText(config.title) : void 0;
98
- $[13] = config.title;
99
- $[14] = resolveText;
100
- $[15] = t7;
101
- } else t7 = $[15];
102
- const title = t7;
61
+ const title = config.title ? resolveText(config.title) : void 0;
103
62
  const percentage = data ? Math.min(data.current / data.target * 100, 100) : 0;
104
- let t8;
105
- if ($[16] !== percentage) {
106
- t8 = percentage.toFixed(0);
107
- $[16] = percentage;
108
- $[17] = t8;
109
- } else t8 = $[17];
110
- const percentageFormatted = t8;
111
- let t9;
112
- if ($[18] !== color || $[19] !== percentage) {
113
- t9 = () => {
114
- if (color) return color;
115
- if (percentage >= 100) return "bg-success";
116
- if (percentage >= 75) return "bg-primary";
117
- if (percentage >= 50) return "bg-warning";
118
- return "bg-muted-foreground";
119
- };
120
- $[18] = color;
121
- $[19] = percentage;
122
- $[20] = t9;
123
- } else t9 = $[20];
124
- const getProgressColor = t9;
125
- let t10;
126
- if ($[21] !== data || $[22] !== getProgressColor || $[23] !== percentage || $[24] !== percentageFormatted || $[25] !== showPercentage || $[26] !== t) {
127
- t10 = data ? /* @__PURE__ */ jsxs("div", {
128
- className: "space-y-3",
129
- children: [
130
- /* @__PURE__ */ jsx("div", {
131
- className: "relative",
63
+ const percentageFormatted = percentage.toFixed(0);
64
+ const getProgressColor = () => {
65
+ if (color) return color;
66
+ if (percentage >= 100) return "bg-success";
67
+ if (percentage >= 75) return "bg-primary";
68
+ if (percentage >= 50) return "bg-warning";
69
+ return "bg-muted-foreground";
70
+ };
71
+ const progressContent = data ? /* @__PURE__ */ jsxs("div", {
72
+ className: "space-y-3",
73
+ children: [
74
+ /* @__PURE__ */ jsx("div", {
75
+ className: "relative",
76
+ children: /* @__PURE__ */ jsx("div", {
77
+ className: "bg-muted h-2 w-full overflow-hidden rounded-full",
132
78
  children: /* @__PURE__ */ jsx("div", {
133
- className: "bg-muted h-2 w-full overflow-hidden rounded-full",
134
- children: /* @__PURE__ */ jsx("div", {
135
- className: cn("h-full rounded-full transition-[width] duration-500", getProgressColor()),
136
- style: { width: `${percentage}%` }
137
- })
79
+ className: cn("h-full rounded-full transition-[width] duration-500", getProgressColor()),
80
+ style: { width: `${percentage}%` }
138
81
  })
139
- }),
140
- /* @__PURE__ */ jsxs("div", {
141
- className: "flex items-center justify-between text-sm",
142
- children: [/* @__PURE__ */ jsx("span", {
143
- className: "text-muted-foreground tabular-nums",
144
- children: data.label || `${data.current.toLocaleString()} / ${data.target.toLocaleString()}`
145
- }), showPercentage && /* @__PURE__ */ jsxs("span", {
146
- className: "font-medium tabular-nums",
147
- children: [percentageFormatted, "%"]
148
- })]
149
- }),
150
- data.subtitle && /* @__PURE__ */ jsx("p", {
151
- className: "text-muted-foreground text-xs",
152
- children: data.subtitle
153
82
  })
154
- ]
155
- }) : /* @__PURE__ */ jsx(WidgetEmptyState, {
156
- iconName: "ph:target",
157
- title: t("widget.progress.emptyTitle"),
158
- description: t("widget.progress.emptyDescription")
159
- });
160
- $[21] = data;
161
- $[22] = getProgressColor;
162
- $[23] = percentage;
163
- $[24] = percentageFormatted;
164
- $[25] = showPercentage;
165
- $[26] = t;
166
- $[27] = t10;
167
- } else t10 = $[27];
168
- const progressContent = t10;
169
- let t11;
170
- if ($[28] !== config.description || $[29] !== resolveText) {
171
- t11 = config.description ? resolveText(config.description) : void 0;
172
- $[28] = config.description;
173
- $[29] = resolveText;
174
- $[30] = t11;
175
- } else t11 = $[30];
176
- const t12 = isFetching && !isLoading;
177
- let t13;
178
- if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
179
- t13 = /* @__PURE__ */ jsx(ProgressWidgetSkeleton, {});
180
- $[31] = t13;
181
- } else t13 = $[31];
182
- let t14;
183
- if ($[32] !== error) {
184
- t14 = error instanceof Error ? error : error ? new Error(String(error)) : null;
185
- $[32] = error;
186
- $[33] = t14;
187
- } else t14 = $[33];
188
- let t15;
189
- if ($[34] !== refetch) {
190
- t15 = () => refetch();
191
- $[34] = refetch;
192
- $[35] = t15;
193
- } else t15 = $[35];
194
- let t16;
195
- if ($[36] !== config.actions || $[37] !== config.cardVariant || $[38] !== config.className || $[39] !== config.icon || $[40] !== isLoading || $[41] !== progressContent || $[42] !== t11 || $[43] !== t12 || $[44] !== t14 || $[45] !== t15 || $[46] !== title) {
196
- t16 = /* @__PURE__ */ jsx(WidgetCard, {
197
- title,
198
- description: t11,
199
- icon: config.icon,
200
- variant: config.cardVariant,
201
- isLoading,
202
- isRefreshing: t12,
203
- loadingSkeleton: t13,
204
- error: t14,
205
- onRefresh: t15,
206
- actions: config.actions,
207
- className: config.className,
208
- children: progressContent
209
- });
210
- $[36] = config.actions;
211
- $[37] = config.cardVariant;
212
- $[38] = config.className;
213
- $[39] = config.icon;
214
- $[40] = isLoading;
215
- $[41] = progressContent;
216
- $[42] = t11;
217
- $[43] = t12;
218
- $[44] = t14;
219
- $[45] = t15;
220
- $[46] = title;
221
- $[47] = t16;
222
- } else t16 = $[47];
223
- return t16;
83
+ }),
84
+ /* @__PURE__ */ jsxs("div", {
85
+ className: "flex items-center justify-between text-sm",
86
+ children: [/* @__PURE__ */ jsx("span", {
87
+ className: "text-muted-foreground tabular-nums",
88
+ children: data.label || `${data.current.toLocaleString()} / ${data.target.toLocaleString()}`
89
+ }), showPercentage && /* @__PURE__ */ jsxs("span", {
90
+ className: "font-medium tabular-nums",
91
+ children: [percentageFormatted, "%"]
92
+ })]
93
+ }),
94
+ data.subtitle && /* @__PURE__ */ jsx("p", {
95
+ className: "text-muted-foreground text-xs",
96
+ children: data.subtitle
97
+ })
98
+ ]
99
+ }) : /* @__PURE__ */ jsx(WidgetEmptyState, {
100
+ iconName: "ph:target",
101
+ title: t("widget.progress.emptyTitle"),
102
+ description: t("widget.progress.emptyDescription")
103
+ });
104
+ return /* @__PURE__ */ jsx(WidgetCard, {
105
+ title,
106
+ description: config.description ? resolveText(config.description) : void 0,
107
+ icon: config.icon,
108
+ variant: config.cardVariant,
109
+ isLoading,
110
+ isRefreshing: isFetching && !isLoading,
111
+ loadingSkeleton: /* @__PURE__ */ jsx(ProgressWidgetSkeleton, {}),
112
+ error: error instanceof Error ? error : error ? new Error(String(error)) : null,
113
+ onRefresh: () => refetch(),
114
+ actions: config.actions,
115
+ className: config.className,
116
+ children: progressContent
117
+ });
224
118
  }
225
119
 
226
120
  //#endregion
@@ -3,7 +3,6 @@ import { cn, formatLabel } from "../../lib/utils.mjs";
3
3
  import { resolveIconElement } from "../component-renderer.mjs";
4
4
  import { WidgetCard } from "../../views/dashboard/widget-card.mjs";
5
5
  import { WidgetEmptyState } from "./widget-empty-state.mjs";
6
- import { c } from "react/compiler-runtime";
7
6
  import { Icon } from "@iconify/react";
8
7
  import { jsx, jsxs } from "react/jsx-runtime";
9
8
 
@@ -20,281 +19,123 @@ import { jsx, jsxs } from "react/jsx-runtime";
20
19
  * Displays a list of action items with icons, matching the style
21
20
  * of other dashboard widgets like recent-items.
22
21
  */
23
- function QuickActionsWidget(t0) {
24
- const $ = c(66);
25
- const { config, basePath: t1, navigate } = t0;
26
- const basePath = t1 === void 0 ? "/admin" : t1;
22
+ function QuickActionsWidget({ config, basePath = "/admin", navigate }) {
27
23
  const resolveText = useResolveText();
28
24
  const { t } = useTranslation();
29
- const { layout: t2 } = config;
30
- const layout = t2 === void 0 ? "list" : t2;
31
- let T0;
32
- let t3;
33
- let t4;
34
- let t5;
35
- let t6;
36
- let t7;
37
- let t8;
38
- let t9;
39
- if ($[0] !== basePath || $[1] !== config.actions || $[2] !== config.cardVariant || $[3] !== config.className || $[4] !== config.description || $[5] !== config.label || $[6] !== config.quickActions || $[7] !== config.title || $[8] !== layout || $[9] !== navigate || $[10] !== resolveText || $[11] !== t) {
40
- t9 = Symbol.for("react.early_return_sentinel");
41
- bb0: {
42
- const quickActions = config.quickActions ?? config.actions ?? [];
43
- let t10$1;
44
- if ($[20] !== config.label || $[21] !== config.title || $[22] !== resolveText || $[23] !== t) {
45
- t10$1 = config.title ? resolveText(config.title) : config.label ? resolveText(config.label) : t("dashboard.quickActions");
46
- $[20] = config.label;
47
- $[21] = config.title;
48
- $[22] = resolveText;
49
- $[23] = t;
50
- $[24] = t10$1;
51
- } else t10$1 = $[24];
52
- const title = t10$1;
53
- let t11$1;
54
- if ($[25] !== basePath) {
55
- t11$1 = (action, fallback) => {
56
- if (!action) return fallback;
57
- if (action.type === "create") return `${basePath}/collections/${action.collection}/create`;
58
- if (action.type === "page") return `${basePath}/${action.pageId}`;
59
- return action.href;
60
- };
61
- $[25] = basePath;
62
- $[26] = t11$1;
63
- } else t11$1 = $[26];
64
- const resolveActionHref = t11$1;
65
- let t12;
66
- if ($[27] !== basePath || $[28] !== resolveActionHref || $[29] !== resolveText || $[30] !== t) {
67
- t12 = (action_0, index) => {
68
- if (typeof action_0 === "string") {
69
- const [collection, actionType] = action_0.split(".");
70
- return {
71
- id: `${action_0}-${index}`,
72
- label: actionType === "create" ? t("collection.new", { name: formatLabel(collection) }) : `${actionType} ${formatLabel(collection)}`,
73
- href: `${basePath}/collections/${collection}/${actionType === "create" ? "create" : ""}`,
74
- icon: void 0,
75
- variant: "default"
76
- };
77
- }
78
- const serverAction = "action" in action_0 ? action_0.action : void 0;
79
- return {
80
- id: `action-${index}`,
81
- label: resolveText(action_0.label),
82
- href: resolveActionHref(serverAction, action_0.href),
83
- external: serverAction?.type === "link" ? serverAction.external : false,
84
- onClick: action_0.onClick,
85
- icon: action_0.icon,
86
- variant: action_0.variant || "default"
87
- };
88
- };
89
- $[27] = basePath;
90
- $[28] = resolveActionHref;
91
- $[29] = resolveText;
92
- $[30] = t;
93
- $[31] = t12;
94
- } else t12 = $[31];
95
- const parsedActions = quickActions.map(t12);
96
- let t13;
97
- if ($[32] !== navigate) {
98
- t13 = (action_1) => {
99
- if (action_1.onClick) action_1.onClick();
100
- else if (action_1.href && action_1.external) window.open(action_1.href, "_blank", "noopener,noreferrer");
101
- else if (action_1.href && navigate) navigate(action_1.href);
102
- };
103
- $[32] = navigate;
104
- $[33] = t13;
105
- } else t13 = $[33];
106
- const handleClick = t13;
107
- const variantStyles = {
108
- default: "border-border-subtle bg-surface-low/60 hover:border-border hover:bg-surface-high cursor-pointer",
109
- primary: "border-primary/30 bg-primary/10 text-foreground hover:border-primary/45 hover:bg-primary/15 [&_svg]:text-primary cursor-pointer",
110
- secondary: "border-border-subtle bg-secondary/60 hover:bg-secondary cursor-pointer",
111
- outline: "border-border bg-background hover:bg-muted cursor-pointer"
25
+ const { layout = "list" } = config;
26
+ const quickActions = config.quickActions ?? config.actions ?? [];
27
+ const title = config.title ? resolveText(config.title) : config.label ? resolveText(config.label) : t("dashboard.quickActions");
28
+ const resolveActionHref = (action, fallback) => {
29
+ if (!action) return fallback;
30
+ if (action.type === "create") return `${basePath}/collections/${action.collection}/create`;
31
+ if (action.type === "page") return `${basePath}/${action.pageId}`;
32
+ return action.href;
33
+ };
34
+ const parsedActions = quickActions.map((action, index) => {
35
+ if (typeof action === "string") {
36
+ const [collection, actionType] = action.split(".");
37
+ return {
38
+ id: `${action}-${index}`,
39
+ label: actionType === "create" ? t("collection.new", { name: formatLabel(collection) }) : `${actionType} ${formatLabel(collection)}`,
40
+ href: `${basePath}/collections/${collection}/${actionType === "create" ? "create" : ""}`,
41
+ icon: void 0,
42
+ variant: "default"
112
43
  };
113
- const iconVariantStyles = {
114
- default: "bg-muted text-muted-foreground",
115
- primary: "bg-primary/15 text-primary",
116
- secondary: "bg-secondary text-secondary-foreground",
117
- outline: "bg-background text-muted-foreground"
118
- };
119
- if (parsedActions.length === 0) {
120
- let t14;
121
- if ($[34] !== config.description || $[35] !== resolveText) {
122
- t14 = config.description ? resolveText(config.description) : void 0;
123
- $[34] = config.description;
124
- $[35] = resolveText;
125
- $[36] = t14;
126
- } else t14 = $[36];
127
- const t15 = config.cardVariant;
128
- const t16 = config.className;
129
- let t17;
130
- if ($[37] !== t) {
131
- t17 = t("widget.quickActions.emptyTitle");
132
- $[37] = t;
133
- $[38] = t17;
134
- } else t17 = $[38];
135
- let t18;
136
- if ($[39] !== t) {
137
- t18 = t("widget.quickActions.emptyDescription");
138
- $[39] = t;
139
- $[40] = t18;
140
- } else t18 = $[40];
141
- let t19;
142
- if ($[41] !== t17 || $[42] !== t18) {
143
- t19 = /* @__PURE__ */ jsx(WidgetEmptyState, {
144
- iconName: "ph:lightning",
145
- title: t17,
146
- description: t18
147
- });
148
- $[41] = t17;
149
- $[42] = t18;
150
- $[43] = t19;
151
- } else t19 = $[43];
152
- let t20;
153
- if ($[44] !== config.cardVariant || $[45] !== config.className || $[46] !== t14 || $[47] !== t19 || $[48] !== title) {
154
- t20 = /* @__PURE__ */ jsx(WidgetCard, {
155
- title,
156
- description: t14,
157
- variant: t15,
158
- className: t16,
159
- children: t19
160
- });
161
- $[44] = config.cardVariant;
162
- $[45] = config.className;
163
- $[46] = t14;
164
- $[47] = t19;
165
- $[48] = title;
166
- $[49] = t20;
167
- } else t20 = $[49];
168
- t9 = t20;
169
- break bb0;
170
- }
171
- if (layout === "grid") {
172
- let t14;
173
- if ($[50] !== config.description || $[51] !== resolveText) {
174
- t14 = config.description ? resolveText(config.description) : void 0;
175
- $[50] = config.description;
176
- $[51] = resolveText;
177
- $[52] = t14;
178
- } else t14 = $[52];
179
- t9 = /* @__PURE__ */ jsx(WidgetCard, {
180
- title,
181
- description: t14,
182
- variant: config.cardVariant,
183
- className: config.className,
184
- children: /* @__PURE__ */ jsx("div", {
185
- className: "grid h-full grid-cols-2 gap-3",
186
- children: parsedActions.map((action_2) => {
187
- const iconElement = resolveIconElement(action_2.icon, { className: "h-4 w-4" });
188
- return /* @__PURE__ */ jsxs("button", {
189
- type: "button",
190
- onClick: () => handleClick(action_2),
191
- className: cn("flex min-h-24 flex-col items-center justify-center gap-2 rounded-md border p-3 text-center", "transition-[background-color,border-color,transform] active:scale-[0.96]", variantStyles[action_2.variant]),
192
- children: [iconElement && /* @__PURE__ */ jsx("div", {
193
- className: cn("flex h-9 w-9 items-center justify-center rounded-md", iconVariantStyles[action_2.variant]),
194
- children: iconElement
195
- }), /* @__PURE__ */ jsx("span", {
196
- className: "text-xs leading-tight font-medium text-balance",
197
- children: action_2.label
198
- })]
199
- }, action_2.id);
200
- })
201
- })
202
- });
203
- break bb0;
204
- }
205
- T0 = WidgetCard;
206
- t5 = title;
207
- if ($[53] !== config.description || $[54] !== resolveText) {
208
- t6 = config.description ? resolveText(config.description) : void 0;
209
- $[53] = config.description;
210
- $[54] = resolveText;
211
- $[55] = t6;
212
- } else t6 = $[55];
213
- t7 = config.cardVariant;
214
- t8 = config.className;
215
- t3 = "-mx-1 space-y-1";
216
- t4 = parsedActions.map((action_3) => {
217
- const iconElement_0 = resolveIconElement(action_3.icon, { className: "h-4 w-4" });
44
+ }
45
+ const serverAction = "action" in action ? action.action : void 0;
46
+ return {
47
+ id: `action-${index}`,
48
+ label: resolveText(action.label),
49
+ href: resolveActionHref(serverAction, action.href),
50
+ external: serverAction?.type === "link" ? serverAction.external : false,
51
+ onClick: action.onClick,
52
+ icon: action.icon,
53
+ variant: action.variant || "default"
54
+ };
55
+ });
56
+ const handleClick = (action) => {
57
+ if (action.onClick) action.onClick();
58
+ else if (action.href && action.external) window.open(action.href, "_blank", "noopener,noreferrer");
59
+ else if (action.href && navigate) navigate(action.href);
60
+ };
61
+ const variantStyles = {
62
+ default: "border-border-subtle bg-surface-low/60 hover:border-border hover:bg-surface-high cursor-pointer",
63
+ primary: "border-primary/30 bg-primary/10 text-foreground hover:border-primary/45 hover:bg-primary/15 [&_svg]:text-primary cursor-pointer",
64
+ secondary: "border-border-subtle bg-secondary/60 hover:bg-secondary cursor-pointer",
65
+ outline: "border-border bg-background hover:bg-muted cursor-pointer"
66
+ };
67
+ const iconVariantStyles = {
68
+ default: "bg-muted text-muted-foreground",
69
+ primary: "bg-primary/15 text-primary",
70
+ secondary: "bg-secondary text-secondary-foreground",
71
+ outline: "bg-background text-muted-foreground"
72
+ };
73
+ if (parsedActions.length === 0) return /* @__PURE__ */ jsx(WidgetCard, {
74
+ title,
75
+ description: config.description ? resolveText(config.description) : void 0,
76
+ variant: config.cardVariant,
77
+ className: config.className,
78
+ children: /* @__PURE__ */ jsx(WidgetEmptyState, {
79
+ iconName: "ph:lightning",
80
+ title: t("widget.quickActions.emptyTitle"),
81
+ description: t("widget.quickActions.emptyDescription")
82
+ })
83
+ });
84
+ if (layout === "grid") return /* @__PURE__ */ jsx(WidgetCard, {
85
+ title,
86
+ description: config.description ? resolveText(config.description) : void 0,
87
+ variant: config.cardVariant,
88
+ className: config.className,
89
+ children: /* @__PURE__ */ jsx("div", {
90
+ className: "grid h-full grid-cols-2 gap-3",
91
+ children: parsedActions.map((action) => {
92
+ const iconElement = resolveIconElement(action.icon, { className: "h-4 w-4" });
218
93
  return /* @__PURE__ */ jsxs("button", {
219
94
  type: "button",
220
- onClick: () => handleClick(action_3),
221
- className: cn("group flex min-h-10 w-full items-center gap-3 rounded-md px-2 py-2 text-left transition-[background-color,transform] active:scale-[0.96]", variantStyles[action_3.variant]),
95
+ onClick: () => handleClick(action),
96
+ className: cn("flex min-h-24 flex-col items-center justify-center gap-2 rounded-md border p-3 text-center", "transition-[background-color,border-color,transform] active:scale-[0.96]", variantStyles[action.variant]),
97
+ children: [iconElement && /* @__PURE__ */ jsx("div", {
98
+ className: cn("flex h-9 w-9 items-center justify-center rounded-md", iconVariantStyles[action.variant]),
99
+ children: iconElement
100
+ }), /* @__PURE__ */ jsx("span", {
101
+ className: "text-xs leading-tight font-medium text-balance",
102
+ children: action.label
103
+ })]
104
+ }, action.id);
105
+ })
106
+ })
107
+ });
108
+ return /* @__PURE__ */ jsx(WidgetCard, {
109
+ title,
110
+ description: config.description ? resolveText(config.description) : void 0,
111
+ variant: config.cardVariant,
112
+ className: config.className,
113
+ children: /* @__PURE__ */ jsx("div", {
114
+ className: "-mx-1 space-y-1",
115
+ children: parsedActions.map((action) => {
116
+ const iconElement = resolveIconElement(action.icon, { className: "h-4 w-4" });
117
+ return /* @__PURE__ */ jsxs("button", {
118
+ type: "button",
119
+ onClick: () => handleClick(action),
120
+ className: cn("group flex min-h-10 w-full items-center gap-3 rounded-md px-2 py-2 text-left transition-[background-color,transform] active:scale-[0.96]", variantStyles[action.variant]),
222
121
  children: [
223
- iconElement_0 && /* @__PURE__ */ jsx("div", {
224
- className: cn("flex h-8 w-8 shrink-0 items-center justify-center rounded-md", iconVariantStyles[action_3.variant]),
225
- children: iconElement_0
122
+ iconElement && /* @__PURE__ */ jsx("div", {
123
+ className: cn("flex h-8 w-8 shrink-0 items-center justify-center rounded-md", iconVariantStyles[action.variant]),
124
+ children: iconElement
226
125
  }),
227
126
  /* @__PURE__ */ jsx("span", {
228
127
  className: "flex-1 truncate text-sm font-medium",
229
- children: action_3.label
128
+ children: action.label
230
129
  }),
231
130
  /* @__PURE__ */ jsx(Icon, {
232
131
  icon: "ph:arrow-right",
233
132
  className: "text-muted-foreground h-4 w-4 opacity-0 transition-opacity group-hover:opacity-100"
234
133
  })
235
134
  ]
236
- }, action_3.id);
237
- });
238
- }
239
- $[0] = basePath;
240
- $[1] = config.actions;
241
- $[2] = config.cardVariant;
242
- $[3] = config.className;
243
- $[4] = config.description;
244
- $[5] = config.label;
245
- $[6] = config.quickActions;
246
- $[7] = config.title;
247
- $[8] = layout;
248
- $[9] = navigate;
249
- $[10] = resolveText;
250
- $[11] = t;
251
- $[12] = T0;
252
- $[13] = t3;
253
- $[14] = t4;
254
- $[15] = t5;
255
- $[16] = t6;
256
- $[17] = t7;
257
- $[18] = t8;
258
- $[19] = t9;
259
- } else {
260
- T0 = $[12];
261
- t3 = $[13];
262
- t4 = $[14];
263
- t5 = $[15];
264
- t6 = $[16];
265
- t7 = $[17];
266
- t8 = $[18];
267
- t9 = $[19];
268
- }
269
- if (t9 !== Symbol.for("react.early_return_sentinel")) return t9;
270
- let t10;
271
- if ($[56] !== t3 || $[57] !== t4) {
272
- t10 = /* @__PURE__ */ jsx("div", {
273
- className: t3,
274
- children: t4
275
- });
276
- $[56] = t3;
277
- $[57] = t4;
278
- $[58] = t10;
279
- } else t10 = $[58];
280
- let t11;
281
- if ($[59] !== T0 || $[60] !== t10 || $[61] !== t5 || $[62] !== t6 || $[63] !== t7 || $[64] !== t8) {
282
- t11 = /* @__PURE__ */ jsx(T0, {
283
- title: t5,
284
- description: t6,
285
- variant: t7,
286
- className: t8,
287
- children: t10
288
- });
289
- $[59] = T0;
290
- $[60] = t10;
291
- $[61] = t5;
292
- $[62] = t6;
293
- $[63] = t7;
294
- $[64] = t8;
295
- $[65] = t11;
296
- } else t11 = $[65];
297
- return t11;
135
+ }, action.id);
136
+ })
137
+ })
138
+ });
298
139
  }
299
140
 
300
141
  //#endregion