@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,8 +1,9 @@
1
- import { useResolveText } from "../../i18n/hooks.mjs";
1
+ import { useResolveText, useTranslation } from "../../i18n/hooks.mjs";
2
2
  import { formatLabel } from "../../lib/utils.mjs";
3
3
  import { useCollectionList } from "../../hooks/use-collection.mjs";
4
4
  import { WidgetCard } from "../../views/dashboard/widget-card.mjs";
5
5
  import { useServerWidgetData } from "../../hooks/use-server-widget-data.mjs";
6
+ import { WidgetEmptyState } from "./widget-empty-state.mjs";
6
7
  import { ChartWidgetSkeleton } from "./widget-skeletons.mjs";
7
8
  import { c } from "react/compiler-runtime";
8
9
  import "react";
@@ -74,9 +75,10 @@ function _temp(entry) {
74
75
  }, String(entry.name));
75
76
  }
76
77
  function ChartWidget(t0) {
77
- const $ = c(38);
78
+ const $ = c(56);
78
79
  const { config } = t0;
79
80
  const resolveText = useResolveText();
81
+ const { t } = useTranslation();
80
82
  const { collection, field, chartType: t1, timeRange: t2, label, color: t3, showGrid: t4, realtime, hasLoader, refreshInterval } = config;
81
83
  const chartType = t1 === void 0 ? "area" : t1;
82
84
  const timeRange = t2 === void 0 ? "30d" : t2;
@@ -99,55 +101,75 @@ function ChartWidget(t0) {
99
101
  t7 = { limit: 1e3 };
100
102
  $[3] = t7;
101
103
  } else t7 = $[3];
102
- let t8;
103
- if ($[4] !== realtime) {
104
- t8 = { realtime };
105
- $[4] = realtime;
106
- $[5] = t8;
107
- } else t8 = $[5];
108
- const collectionQuery = useCollectionList(collection, t7, void 0, t8);
109
- const { isLoading, error, refetch } = hasLoader ? serverQuery : collectionQuery;
104
+ const t8 = !hasLoader;
110
105
  let t9;
111
- if ($[6] !== collectionQuery || $[7] !== hasLoader) {
112
- t9 = hasLoader ? [] : Array.isArray(collectionQuery.data?.docs) ? collectionQuery.data.docs : [];
113
- $[6] = collectionQuery;
114
- $[7] = hasLoader;
115
- $[8] = t9;
116
- } else t9 = $[8];
117
- const collectionItems = t9;
106
+ if ($[4] !== t8) {
107
+ t9 = { enabled: t8 };
108
+ $[4] = t8;
109
+ $[5] = t9;
110
+ } else t9 = $[5];
118
111
  let t10;
119
- if ($[9] !== collection || $[10] !== field || $[11] !== label || $[12] !== resolveText) {
120
- t10 = label ? resolveText(label) : `${formatLabel(collection)} by ${field}`;
121
- $[9] = collection;
122
- $[10] = field;
123
- $[11] = label;
124
- $[12] = resolveText;
125
- $[13] = t10;
126
- } else t10 = $[13];
127
- const displayLabel = t10;
112
+ if ($[6] !== realtime) {
113
+ t10 = { realtime };
114
+ $[6] = realtime;
115
+ $[7] = t10;
116
+ } else t10 = $[7];
117
+ const collectionQuery = useCollectionList(collection, t7, t9, t10);
118
+ const { isLoading, error, refetch, isFetching } = hasLoader ? serverQuery : collectionQuery;
128
119
  let t11;
129
120
  bb0: {
130
121
  if (hasLoader) {
131
122
  let t12$2;
132
- if ($[14] !== serverQuery.data) {
133
- t12$2 = serverQuery.data ?? [];
134
- $[14] = serverQuery.data;
135
- $[15] = t12$2;
136
- } else t12$2 = $[15];
137
- t11 = t12$2;
138
- break bb0;
139
- }
140
- if (!collectionItems.length) {
141
- let t12$2;
142
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
123
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
143
124
  t12$2 = [];
144
- $[16] = t12$2;
145
- } else t12$2 = $[16];
125
+ $[8] = t12$2;
126
+ } else t12$2 = $[8];
146
127
  t11 = t12$2;
147
128
  break bb0;
148
129
  }
149
130
  let t12$1;
150
- if ($[17] !== collectionItems || $[18] !== field || $[19] !== timeRange) {
131
+ if ($[9] !== collectionQuery.data) {
132
+ t12$1 = Array.isArray(collectionQuery.data?.docs) ? collectionQuery.data.docs : [];
133
+ $[9] = collectionQuery.data;
134
+ $[10] = t12$1;
135
+ } else t12$1 = $[10];
136
+ t11 = t12$1;
137
+ }
138
+ const collectionItems = t11;
139
+ let t12;
140
+ if ($[11] !== collection || $[12] !== config.title || $[13] !== field || $[14] !== label || $[15] !== resolveText) {
141
+ t12 = config.title ? resolveText(config.title) : label ? resolveText(label) : `${formatLabel(collection)} by ${field}`;
142
+ $[11] = collection;
143
+ $[12] = config.title;
144
+ $[13] = field;
145
+ $[14] = label;
146
+ $[15] = resolveText;
147
+ $[16] = t12;
148
+ } else t12 = $[16];
149
+ const displayLabel = t12;
150
+ let t13;
151
+ bb1: {
152
+ if (hasLoader) {
153
+ let t14$2;
154
+ if ($[17] !== serverQuery.data) {
155
+ t14$2 = serverQuery.data ?? [];
156
+ $[17] = serverQuery.data;
157
+ $[18] = t14$2;
158
+ } else t14$2 = $[18];
159
+ t13 = t14$2;
160
+ break bb1;
161
+ }
162
+ if (!collectionItems.length) {
163
+ let t14$2;
164
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
165
+ t14$2 = [];
166
+ $[19] = t14$2;
167
+ } else t14$2 = $[19];
168
+ t13 = t14$2;
169
+ break bb1;
170
+ }
171
+ let t14$1;
172
+ if ($[20] !== collectionItems || $[21] !== field || $[22] !== timeRange) {
151
173
  const grouped = collectionItems.reduce((acc, item) => {
152
174
  const value = item[field];
153
175
  if (value === void 0 || value === null) return acc;
@@ -157,30 +179,43 @@ function ChartWidget(t0) {
157
179
  acc[key] = (acc[key] || 0) + 1;
158
180
  return acc;
159
181
  }, {});
160
- t12$1 = Object.entries(grouped).map(_temp2).sort(_temp3);
161
- $[17] = collectionItems;
162
- $[18] = field;
163
- $[19] = timeRange;
164
- $[20] = t12$1;
165
- } else t12$1 = $[20];
166
- t11 = t12$1;
182
+ t14$1 = Object.entries(grouped).map(_temp2).sort(_temp3);
183
+ $[20] = collectionItems;
184
+ $[21] = field;
185
+ $[22] = timeRange;
186
+ $[23] = t14$1;
187
+ } else t14$1 = $[23];
188
+ t13 = t14$1;
167
189
  }
168
- const chartData = t11;
169
- let t12;
170
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
171
- t12 = /* @__PURE__ */ jsx("div", {
172
- className: "text-muted-foreground flex h-24 items-center justify-center",
173
- children: /* @__PURE__ */ jsx("p", {
174
- className: "text-sm",
175
- children: "No data available"
176
- })
190
+ const chartData = t13;
191
+ let t14;
192
+ if ($[24] !== t) {
193
+ t14 = t("widget.chart.emptyTitle");
194
+ $[24] = t;
195
+ $[25] = t14;
196
+ } else t14 = $[25];
197
+ let t15;
198
+ if ($[26] !== t) {
199
+ t15 = t("widget.chart.emptyDescription");
200
+ $[26] = t;
201
+ $[27] = t15;
202
+ } else t15 = $[27];
203
+ let t16;
204
+ if ($[28] !== t14 || $[29] !== t15) {
205
+ t16 = /* @__PURE__ */ jsx(WidgetEmptyState, {
206
+ iconName: "ph:chart-line",
207
+ title: t14,
208
+ description: t15,
209
+ className: "min-h-48"
177
210
  });
178
- $[21] = t12;
179
- } else t12 = $[21];
180
- const emptyContent = t12;
181
- let t13;
182
- if ($[22] !== chartData || $[23] !== chartType || $[24] !== color || $[25] !== showGrid) {
183
- t13 = chartData.length === 0 ? emptyContent : /* @__PURE__ */ jsx("div", {
211
+ $[28] = t14;
212
+ $[29] = t15;
213
+ $[30] = t16;
214
+ } else t16 = $[30];
215
+ const emptyContent = t16;
216
+ let t17;
217
+ if ($[31] !== chartData || $[32] !== chartType || $[33] !== color || $[34] !== emptyContent || $[35] !== showGrid) {
218
+ t17 = chartData.length === 0 ? emptyContent : /* @__PURE__ */ jsx("div", {
184
219
  className: "h-48 w-full",
185
220
  children: /* @__PURE__ */ jsx(ResponsiveContainer, {
186
221
  width: "100%",
@@ -193,48 +228,67 @@ function ChartWidget(t0) {
193
228
  })
194
229
  })
195
230
  });
196
- $[22] = chartData;
197
- $[23] = chartType;
198
- $[24] = color;
199
- $[25] = showGrid;
200
- $[26] = t13;
201
- } else t13 = $[26];
202
- const chartContent = t13;
203
- let t14;
204
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
205
- t14 = /* @__PURE__ */ jsx(ChartWidgetSkeleton, {});
206
- $[27] = t14;
207
- } else t14 = $[27];
208
- let t15;
209
- if ($[28] !== error) {
210
- t15 = error instanceof Error ? error : error ? new Error(String(error)) : null;
211
- $[28] = error;
212
- $[29] = t15;
213
- } else t15 = $[29];
214
- let t16;
215
- if ($[30] !== refetch) {
216
- t16 = () => refetch();
217
- $[30] = refetch;
218
- $[31] = t16;
219
- } else t16 = $[31];
220
- let t17;
221
- if ($[32] !== chartContent || $[33] !== displayLabel || $[34] !== isLoading || $[35] !== t15 || $[36] !== t16) {
222
- t17 = /* @__PURE__ */ jsx(WidgetCard, {
231
+ $[31] = chartData;
232
+ $[32] = chartType;
233
+ $[33] = color;
234
+ $[34] = emptyContent;
235
+ $[35] = showGrid;
236
+ $[36] = t17;
237
+ } else t17 = $[36];
238
+ const chartContent = t17;
239
+ let t18;
240
+ if ($[37] !== config.description || $[38] !== resolveText) {
241
+ t18 = config.description ? resolveText(config.description) : void 0;
242
+ $[37] = config.description;
243
+ $[38] = resolveText;
244
+ $[39] = t18;
245
+ } else t18 = $[39];
246
+ const t19 = isFetching && !isLoading;
247
+ let t20;
248
+ if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
249
+ t20 = /* @__PURE__ */ jsx(ChartWidgetSkeleton, {});
250
+ $[40] = t20;
251
+ } else t20 = $[40];
252
+ let t21;
253
+ if ($[41] !== error) {
254
+ t21 = error instanceof Error ? error : error ? new Error(String(error)) : null;
255
+ $[41] = error;
256
+ $[42] = t21;
257
+ } else t21 = $[42];
258
+ let t22;
259
+ if ($[43] !== refetch) {
260
+ t22 = () => refetch();
261
+ $[43] = refetch;
262
+ $[44] = t22;
263
+ } else t22 = $[44];
264
+ let t23;
265
+ if ($[45] !== chartContent || $[46] !== config.actions || $[47] !== config.cardVariant || $[48] !== config.className || $[49] !== displayLabel || $[50] !== isLoading || $[51] !== t18 || $[52] !== t19 || $[53] !== t21 || $[54] !== t22) {
266
+ t23 = /* @__PURE__ */ jsx(WidgetCard, {
223
267
  title: displayLabel,
268
+ description: t18,
269
+ variant: config.cardVariant,
224
270
  isLoading,
225
- loadingSkeleton: t14,
226
- error: t15,
227
- onRefresh: t16,
271
+ isRefreshing: t19,
272
+ loadingSkeleton: t20,
273
+ error: t21,
274
+ onRefresh: t22,
275
+ actions: config.actions,
276
+ className: config.className,
228
277
  children: chartContent
229
278
  });
230
- $[32] = chartContent;
231
- $[33] = displayLabel;
232
- $[34] = isLoading;
233
- $[35] = t15;
234
- $[36] = t16;
235
- $[37] = t17;
236
- } else t17 = $[37];
237
- return t17;
279
+ $[45] = chartContent;
280
+ $[46] = config.actions;
281
+ $[47] = config.cardVariant;
282
+ $[48] = config.className;
283
+ $[49] = displayLabel;
284
+ $[50] = isLoading;
285
+ $[51] = t18;
286
+ $[52] = t19;
287
+ $[53] = t21;
288
+ $[54] = t22;
289
+ $[55] = t23;
290
+ } else t23 = $[55];
291
+ return t23;
238
292
  }
239
293
  /**
240
294
  * Renders the appropriate chart type as a proper component
@@ -1,8 +1,9 @@
1
- import { useResolveText } from "../../i18n/hooks.mjs";
1
+ import { useResolveText, useTranslation } from "../../i18n/hooks.mjs";
2
2
  import { cn } from "../../lib/utils.mjs";
3
3
  import { selectClient, useAdminStore } from "../../runtime/provider.mjs";
4
4
  import { WidgetCard } from "../../views/dashboard/widget-card.mjs";
5
5
  import { useServerWidgetData } from "../../hooks/use-server-widget-data.mjs";
6
+ import { WidgetEmptyState } from "./widget-empty-state.mjs";
6
7
  import { ProgressWidgetSkeleton } from "./widget-skeletons.mjs";
7
8
  import { c } from "react/compiler-runtime";
8
9
  import { useQuery } from "@tanstack/react-query";
@@ -38,10 +39,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
38
39
  * ```
39
40
  */
40
41
  function ProgressWidget(t0) {
41
- const $ = c(38);
42
+ const $ = c(48);
42
43
  const { config } = t0;
43
44
  const client = useAdminStore(selectClient);
44
45
  const resolveText = useResolveText();
46
+ const { t } = useTranslation();
45
47
  const { color, showPercentage: t1 } = config;
46
48
  const showPercentage = t1 === void 0 ? true : t1;
47
49
  const useServerData = !!config.hasLoader;
@@ -89,7 +91,7 @@ function ProgressWidget(t0) {
89
91
  $[12] = t6;
90
92
  } else t6 = $[12];
91
93
  const clientQuery = useQuery(t6);
92
- const { data, isLoading, error, refetch } = useServerData ? serverQuery : clientQuery;
94
+ const { data, isLoading, error, refetch, isFetching } = useServerData ? serverQuery : clientQuery;
93
95
  let t7;
94
96
  if ($[13] !== config.title || $[14] !== resolveText) {
95
97
  t7 = config.title ? resolveText(config.title) : void 0;
@@ -121,7 +123,7 @@ function ProgressWidget(t0) {
121
123
  } else t9 = $[20];
122
124
  const getProgressColor = t9;
123
125
  let t10;
124
- if ($[21] !== data || $[22] !== getProgressColor || $[23] !== percentage || $[24] !== percentageFormatted || $[25] !== showPercentage) {
126
+ if ($[21] !== data || $[22] !== getProgressColor || $[23] !== percentage || $[24] !== percentageFormatted || $[25] !== showPercentage || $[26] !== t) {
125
127
  t10 = data ? /* @__PURE__ */ jsxs("div", {
126
128
  className: "space-y-3",
127
129
  children: [
@@ -130,7 +132,7 @@ function ProgressWidget(t0) {
130
132
  children: /* @__PURE__ */ jsx("div", {
131
133
  className: "bg-muted h-2 w-full overflow-hidden rounded-full",
132
134
  children: /* @__PURE__ */ jsx("div", {
133
- className: cn("h-full rounded-full transition-all duration-500", getProgressColor()),
135
+ className: cn("h-full rounded-full transition-[width] duration-500", getProgressColor()),
134
136
  style: { width: `${percentage}%` }
135
137
  })
136
138
  })
@@ -138,10 +140,10 @@ function ProgressWidget(t0) {
138
140
  /* @__PURE__ */ jsxs("div", {
139
141
  className: "flex items-center justify-between text-sm",
140
142
  children: [/* @__PURE__ */ jsx("span", {
141
- className: "text-muted-foreground",
143
+ className: "text-muted-foreground tabular-nums",
142
144
  children: data.label || `${data.current.toLocaleString()} / ${data.target.toLocaleString()}`
143
145
  }), showPercentage && /* @__PURE__ */ jsxs("span", {
144
- className: "font-medium",
146
+ className: "font-medium tabular-nums",
145
147
  children: [percentageFormatted, "%"]
146
148
  })]
147
149
  }),
@@ -150,50 +152,75 @@ function ProgressWidget(t0) {
150
152
  children: data.subtitle
151
153
  })
152
154
  ]
153
- }) : null;
155
+ }) : /* @__PURE__ */ jsx(WidgetEmptyState, {
156
+ iconName: "ph:target",
157
+ title: t("widget.progress.emptyTitle"),
158
+ description: t("widget.progress.emptyDescription")
159
+ });
154
160
  $[21] = data;
155
161
  $[22] = getProgressColor;
156
162
  $[23] = percentage;
157
163
  $[24] = percentageFormatted;
158
164
  $[25] = showPercentage;
159
- $[26] = t10;
160
- } else t10 = $[26];
165
+ $[26] = t;
166
+ $[27] = t10;
167
+ } else t10 = $[27];
161
168
  const progressContent = t10;
162
169
  let t11;
163
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
164
- t11 = /* @__PURE__ */ jsx(ProgressWidgetSkeleton, {});
165
- $[27] = t11;
166
- } else t11 = $[27];
167
- let t12;
168
- if ($[28] !== error) {
169
- t12 = error instanceof Error ? error : error ? new Error(String(error)) : null;
170
- $[28] = error;
171
- $[29] = t12;
172
- } else t12 = $[29];
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;
173
177
  let t13;
174
- if ($[30] !== refetch) {
175
- t13 = () => refetch();
176
- $[30] = refetch;
178
+ if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
179
+ t13 = /* @__PURE__ */ jsx(ProgressWidgetSkeleton, {});
177
180
  $[31] = t13;
178
181
  } else t13 = $[31];
179
182
  let t14;
180
- if ($[32] !== isLoading || $[33] !== progressContent || $[34] !== t12 || $[35] !== t13 || $[36] !== title) {
181
- t14 = /* @__PURE__ */ jsx(WidgetCard, {
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, {
182
197
  title,
198
+ description: t11,
199
+ icon: config.icon,
200
+ variant: config.cardVariant,
183
201
  isLoading,
184
- loadingSkeleton: t11,
185
- error: t12,
186
- onRefresh: t13,
202
+ isRefreshing: t12,
203
+ loadingSkeleton: t13,
204
+ error: t14,
205
+ onRefresh: t15,
206
+ actions: config.actions,
207
+ className: config.className,
187
208
  children: progressContent
188
209
  });
189
- $[32] = isLoading;
190
- $[33] = progressContent;
191
- $[34] = t12;
192
- $[35] = t13;
193
- $[36] = title;
194
- $[37] = t14;
195
- } else t14 = $[37];
196
- return t14;
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;
197
224
  }
198
225
 
199
226
  //#endregion