@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
@@ -6,7 +6,6 @@ import { WidgetCard } from "../../views/dashboard/widget-card.mjs";
6
6
  import { useServerWidgetData } from "../../hooks/use-server-widget-data.mjs";
7
7
  import { WidgetEmptyState } from "./widget-empty-state.mjs";
8
8
  import { ValueWidgetSkeleton } from "./widget-skeletons.mjs";
9
- import { c } from "react/compiler-runtime";
10
9
  import { useQuery } from "@tanstack/react-query";
11
10
  import { jsx, jsxs } from "react/jsx-runtime";
12
11
 
@@ -44,397 +43,91 @@ function formatValue(value) {
44
43
  * />
45
44
  * ```
46
45
  */
47
- function ValueWidget(t0) {
48
- const $ = c(137);
49
- const { config } = t0;
46
+ function ValueWidget({ config }) {
50
47
  const client = useAdminStore(selectClient);
51
48
  const resolveText = useResolveText();
52
49
  const { t } = useTranslation();
53
50
  const useServerData = !!config.hasLoader;
54
- let t1;
55
- if ($[0] !== config.refreshInterval || $[1] !== useServerData) {
56
- t1 = {
57
- enabled: useServerData,
58
- refreshInterval: config.refreshInterval
59
- };
60
- $[0] = config.refreshInterval;
61
- $[1] = useServerData;
62
- $[2] = t1;
63
- } else t1 = $[2];
64
- const serverQuery = useServerWidgetData(config.id, t1);
65
- let t2;
66
- if ($[3] !== config.id) {
67
- t2 = [
51
+ const serverQuery = useServerWidgetData(config.id, {
52
+ enabled: useServerData,
53
+ refreshInterval: config.refreshInterval
54
+ });
55
+ const clientQuery = useQuery({
56
+ queryKey: [
68
57
  "widget",
69
58
  "value",
70
59
  config.id
71
- ];
72
- $[3] = config.id;
73
- $[4] = t2;
74
- } else t2 = $[4];
75
- let t3;
76
- if ($[5] !== client || $[6] !== config.loader) {
77
- t3 = () => config.loader(client);
78
- $[5] = client;
79
- $[6] = config.loader;
80
- $[7] = t3;
81
- } else t3 = $[7];
82
- const t4 = !useServerData && !!config.loader;
83
- let t5;
84
- if ($[8] !== config.refreshInterval || $[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
85
- t5 = {
86
- queryKey: t2,
87
- queryFn: t3,
88
- enabled: t4,
89
- refetchInterval: config.refreshInterval
90
- };
91
- $[8] = config.refreshInterval;
92
- $[9] = t2;
93
- $[10] = t3;
94
- $[11] = t4;
95
- $[12] = t5;
96
- } else t5 = $[12];
97
- const clientQuery = useQuery(t5);
60
+ ],
61
+ queryFn: () => config.loader(client),
62
+ enabled: !useServerData && !!config.loader,
63
+ refetchInterval: config.refreshInterval
64
+ });
98
65
  const { data, isLoading, error, refetch, isFetching } = useServerData ? serverQuery : clientQuery;
99
66
  const isFeatured = config.cardVariant === "featured";
100
- if (isLoading || error) {
101
- let t6$1;
102
- if ($[13] !== config.title || $[14] !== resolveText) {
103
- t6$1 = config.title ? resolveText(config.title) : void 0;
104
- $[13] = config.title;
105
- $[14] = resolveText;
106
- $[15] = t6$1;
107
- } else t6$1 = $[15];
108
- let t7$1;
109
- if ($[16] !== config.description || $[17] !== resolveText) {
110
- t7$1 = config.description ? resolveText(config.description) : void 0;
111
- $[16] = config.description;
112
- $[17] = resolveText;
113
- $[18] = t7$1;
114
- } else t7$1 = $[18];
115
- const t8$1 = config.icon;
116
- const t9$1 = config.cardVariant;
117
- let t10$1;
118
- if ($[19] !== isFeatured) {
119
- t10$1 = /* @__PURE__ */ jsx(ValueWidgetSkeleton, { featured: isFeatured });
120
- $[19] = isFeatured;
121
- $[20] = t10$1;
122
- } else t10$1 = $[20];
123
- let t11$1;
124
- if ($[21] !== error) {
125
- t11$1 = error instanceof Error ? error : error ? new Error(String(error)) : null;
126
- $[21] = error;
127
- $[22] = t11$1;
128
- } else t11$1 = $[22];
129
- let t12$1;
130
- if ($[23] !== refetch) {
131
- t12$1 = () => refetch();
132
- $[23] = refetch;
133
- $[24] = t12$1;
134
- } else t12$1 = $[24];
135
- const t13$1 = config.actions;
136
- const t14$1 = data?.classNames?.root;
137
- let t15$1;
138
- if ($[25] !== config.className || $[26] !== t14$1) {
139
- t15$1 = cn(config.className, t14$1);
140
- $[25] = config.className;
141
- $[26] = t14$1;
142
- $[27] = t15$1;
143
- } else t15$1 = $[27];
144
- let t16$1;
145
- if ($[28] !== config.actions || $[29] !== config.cardVariant || $[30] !== config.icon || $[31] !== isLoading || $[32] !== t10$1 || $[33] !== t11$1 || $[34] !== t12$1 || $[35] !== t15$1 || $[36] !== t6$1 || $[37] !== t7$1) {
146
- t16$1 = /* @__PURE__ */ jsx(WidgetCard, {
147
- title: t6$1,
148
- description: t7$1,
149
- icon: t8$1,
150
- variant: t9$1,
151
- isLoading,
152
- loadingSkeleton: t10$1,
153
- error: t11$1,
154
- onRefresh: t12$1,
155
- actions: t13$1,
156
- className: t15$1
157
- });
158
- $[28] = config.actions;
159
- $[29] = config.cardVariant;
160
- $[30] = config.icon;
161
- $[31] = isLoading;
162
- $[32] = t10$1;
163
- $[33] = t11$1;
164
- $[34] = t12$1;
165
- $[35] = t15$1;
166
- $[36] = t6$1;
167
- $[37] = t7$1;
168
- $[38] = t16$1;
169
- } else t16$1 = $[38];
170
- return t16$1;
171
- }
172
- if (!data) {
173
- let t6$1;
174
- if ($[39] !== config.title || $[40] !== resolveText) {
175
- t6$1 = config.title ? resolveText(config.title) : void 0;
176
- $[39] = config.title;
177
- $[40] = resolveText;
178
- $[41] = t6$1;
179
- } else t6$1 = $[41];
180
- let t7$1;
181
- if ($[42] !== config.description || $[43] !== resolveText) {
182
- t7$1 = config.description ? resolveText(config.description) : void 0;
183
- $[42] = config.description;
184
- $[43] = resolveText;
185
- $[44] = t7$1;
186
- } else t7$1 = $[44];
187
- const t8$1 = config.icon;
188
- const t9$1 = config.cardVariant;
189
- const t10$1 = isFetching && !isLoading;
190
- let t11$1;
191
- if ($[45] !== refetch) {
192
- t11$1 = () => refetch();
193
- $[45] = refetch;
194
- $[46] = t11$1;
195
- } else t11$1 = $[46];
196
- const t12$1 = config.actions;
197
- const t13$1 = config.className;
198
- let t14$1;
199
- if ($[47] !== t) {
200
- t14$1 = t("widget.value.emptyTitle");
201
- $[47] = t;
202
- $[48] = t14$1;
203
- } else t14$1 = $[48];
204
- let t15$1;
205
- if ($[49] !== t) {
206
- t15$1 = t("widget.value.emptyDescription");
207
- $[49] = t;
208
- $[50] = t15$1;
209
- } else t15$1 = $[50];
210
- let t16$1;
211
- if ($[51] !== t14$1 || $[52] !== t15$1) {
212
- t16$1 = /* @__PURE__ */ jsx(WidgetEmptyState, {
213
- iconName: "ph:gauge",
214
- title: t14$1,
215
- description: t15$1
216
- });
217
- $[51] = t14$1;
218
- $[52] = t15$1;
219
- $[53] = t16$1;
220
- } else t16$1 = $[53];
221
- let t17$1;
222
- if ($[54] !== config.actions || $[55] !== config.cardVariant || $[56] !== config.className || $[57] !== config.icon || $[58] !== t10$1 || $[59] !== t11$1 || $[60] !== t16$1 || $[61] !== t6$1 || $[62] !== t7$1) {
223
- t17$1 = /* @__PURE__ */ jsx(WidgetCard, {
224
- title: t6$1,
225
- description: t7$1,
226
- icon: t8$1,
227
- variant: t9$1,
228
- isRefreshing: t10$1,
229
- onRefresh: t11$1,
230
- actions: t12$1,
231
- className: t13$1,
232
- children: t16$1
233
- });
234
- $[54] = config.actions;
235
- $[55] = config.cardVariant;
236
- $[56] = config.className;
237
- $[57] = config.icon;
238
- $[58] = t10$1;
239
- $[59] = t11$1;
240
- $[60] = t16$1;
241
- $[61] = t6$1;
242
- $[62] = t7$1;
243
- $[63] = t17$1;
244
- } else t17$1 = $[63];
245
- return t17$1;
246
- }
247
- let T0;
248
- let cls;
249
- let footer;
250
- let subtitle;
251
- let t10;
252
- let t11;
253
- let t12;
254
- let t13;
255
- let t14;
256
- let t15;
257
- let t16;
258
- let t6;
259
- let t7;
260
- let t8;
261
- let t9;
262
- if ($[64] !== config.actions || $[65] !== config.cardVariant || $[66] !== config.className || $[67] !== config.description || $[68] !== config.title || $[69] !== data.classNames || $[70] !== data.footer || $[71] !== data.formatted || $[72] !== data.icon || $[73] !== data.label || $[74] !== data.subtitle || $[75] !== data.trend || $[76] !== data.value || $[77] !== isFetching || $[78] !== isLoading || $[79] !== refetch || $[80] !== resolveText) {
263
- cls = data.classNames ?? {};
264
- const Icon = data.icon;
265
- const TrendIcon = data.trend?.icon;
266
- let t17$1;
267
- if ($[96] !== config.title || $[97] !== data.label || $[98] !== resolveText) {
268
- t17$1 = data.label ? resolveText(data.label) : config.title ? resolveText(config.title) : void 0;
269
- $[96] = config.title;
270
- $[97] = data.label;
271
- $[98] = resolveText;
272
- $[99] = t17$1;
273
- } else t17$1 = $[99];
274
- const label = t17$1;
275
- let t18$1;
276
- if ($[100] !== data.subtitle || $[101] !== resolveText) {
277
- t18$1 = data.subtitle ? resolveText(data.subtitle) : void 0;
278
- $[100] = data.subtitle;
279
- $[101] = resolveText;
280
- $[102] = t18$1;
281
- } else t18$1 = $[102];
282
- subtitle = t18$1;
283
- let t19$1;
284
- if ($[103] !== data.footer || $[104] !== resolveText) {
285
- t19$1 = data.footer ? resolveText(data.footer) : void 0;
286
- $[103] = data.footer;
287
- $[104] = resolveText;
288
- $[105] = t19$1;
289
- } else t19$1 = $[105];
290
- footer = t19$1;
291
- T0 = WidgetCard;
292
- t9 = label;
293
- t10 = Icon;
294
- if ($[106] !== config.description || $[107] !== resolveText) {
295
- t11 = config.description ? resolveText(config.description) : void 0;
296
- $[106] = config.description;
297
- $[107] = resolveText;
298
- $[108] = t11;
299
- } else t11 = $[108];
300
- t12 = config.cardVariant;
301
- if ($[109] !== refetch) {
302
- t13 = () => refetch();
303
- $[109] = refetch;
304
- $[110] = t13;
305
- } else t13 = $[110];
306
- t14 = isFetching && !isLoading;
307
- t15 = config.actions;
308
- t16 = cn(config.className, cls.root);
309
- t6 = cn("space-y-1", cls.content);
310
- let t20$1;
311
- if ($[111] !== data.formatted || $[112] !== data.value) {
312
- t20$1 = data.formatted ?? formatValue(data.value);
313
- $[111] = data.formatted;
314
- $[112] = data.value;
315
- $[113] = t20$1;
316
- } else t20$1 = $[113];
317
- t7 = /* @__PURE__ */ jsx("div", {
318
- className: cn("text-2xl font-bold", cls.value),
319
- children: t20$1
320
- });
321
- t8 = data.trend && /* @__PURE__ */ jsxs("div", {
322
- className: cn("flex items-center gap-1 text-sm", cls.trend),
323
- children: [resolveIconElement(TrendIcon, { className: cn("h-3 w-3", cls.trendIcon) }), /* @__PURE__ */ jsx("span", { children: data.trend.value })]
324
- });
325
- $[64] = config.actions;
326
- $[65] = config.cardVariant;
327
- $[66] = config.className;
328
- $[67] = config.description;
329
- $[68] = config.title;
330
- $[69] = data.classNames;
331
- $[70] = data.footer;
332
- $[71] = data.formatted;
333
- $[72] = data.icon;
334
- $[73] = data.label;
335
- $[74] = data.subtitle;
336
- $[75] = data.trend;
337
- $[76] = data.value;
338
- $[77] = isFetching;
339
- $[78] = isLoading;
340
- $[79] = refetch;
341
- $[80] = resolveText;
342
- $[81] = T0;
343
- $[82] = cls;
344
- $[83] = footer;
345
- $[84] = subtitle;
346
- $[85] = t10;
347
- $[86] = t11;
348
- $[87] = t12;
349
- $[88] = t13;
350
- $[89] = t14;
351
- $[90] = t15;
352
- $[91] = t16;
353
- $[92] = t6;
354
- $[93] = t7;
355
- $[94] = t8;
356
- $[95] = t9;
357
- } else {
358
- T0 = $[81];
359
- cls = $[82];
360
- footer = $[83];
361
- subtitle = $[84];
362
- t10 = $[85];
363
- t11 = $[86];
364
- t12 = $[87];
365
- t13 = $[88];
366
- t14 = $[89];
367
- t15 = $[90];
368
- t16 = $[91];
369
- t6 = $[92];
370
- t7 = $[93];
371
- t8 = $[94];
372
- t9 = $[95];
373
- }
374
- let t17;
375
- if ($[114] !== cls || $[115] !== subtitle) {
376
- t17 = subtitle && /* @__PURE__ */ jsx("p", {
377
- className: cn("text-muted-foreground text-xs", cls.subtitle),
378
- children: subtitle
379
- });
380
- $[114] = cls;
381
- $[115] = subtitle;
382
- $[116] = t17;
383
- } else t17 = $[116];
384
- let t18;
385
- if ($[117] !== cls || $[118] !== footer) {
386
- t18 = footer && /* @__PURE__ */ jsx("p", {
387
- className: cn("text-muted-foreground pt-2 text-xs", cls.footer),
388
- children: footer
389
- });
390
- $[117] = cls;
391
- $[118] = footer;
392
- $[119] = t18;
393
- } else t18 = $[119];
394
- let t19;
395
- if ($[120] !== t17 || $[121] !== t18 || $[122] !== t6 || $[123] !== t7 || $[124] !== t8) {
396
- t19 = /* @__PURE__ */ jsxs("div", {
397
- className: t6,
67
+ if (isLoading || error) return /* @__PURE__ */ jsx(WidgetCard, {
68
+ title: config.title ? resolveText(config.title) : void 0,
69
+ description: config.description ? resolveText(config.description) : void 0,
70
+ icon: config.icon,
71
+ variant: config.cardVariant,
72
+ isLoading,
73
+ loadingSkeleton: /* @__PURE__ */ jsx(ValueWidgetSkeleton, { featured: isFeatured }),
74
+ error: error instanceof Error ? error : error ? new Error(String(error)) : null,
75
+ onRefresh: () => refetch(),
76
+ actions: config.actions,
77
+ className: cn(config.className, data?.classNames?.root)
78
+ });
79
+ if (!data) return /* @__PURE__ */ jsx(WidgetCard, {
80
+ title: config.title ? resolveText(config.title) : void 0,
81
+ description: config.description ? resolveText(config.description) : void 0,
82
+ icon: config.icon,
83
+ variant: config.cardVariant,
84
+ isRefreshing: isFetching && !isLoading,
85
+ onRefresh: () => refetch(),
86
+ actions: config.actions,
87
+ className: config.className,
88
+ children: /* @__PURE__ */ jsx(WidgetEmptyState, {
89
+ iconName: "ph:gauge",
90
+ title: t("widget.value.emptyTitle"),
91
+ description: t("widget.value.emptyDescription")
92
+ })
93
+ });
94
+ const cls = data.classNames ?? {};
95
+ const Icon = data.icon;
96
+ const TrendIcon = data.trend?.icon;
97
+ const label = data.label ? resolveText(data.label) : config.title ? resolveText(config.title) : void 0;
98
+ const subtitle = data.subtitle ? resolveText(data.subtitle) : void 0;
99
+ const footer = data.footer ? resolveText(data.footer) : void 0;
100
+ return /* @__PURE__ */ jsx(WidgetCard, {
101
+ title: label,
102
+ icon: Icon,
103
+ description: config.description ? resolveText(config.description) : void 0,
104
+ variant: config.cardVariant,
105
+ onRefresh: () => refetch(),
106
+ isRefreshing: isFetching && !isLoading,
107
+ actions: config.actions,
108
+ className: cn(config.className, cls.root),
109
+ children: /* @__PURE__ */ jsxs("div", {
110
+ className: cn("space-y-1", cls.content),
398
111
  children: [
399
- t7,
400
- t8,
401
- t17,
402
- t18
112
+ /* @__PURE__ */ jsx("div", {
113
+ className: cn("text-2xl font-bold", cls.value),
114
+ children: data.formatted ?? formatValue(data.value)
115
+ }),
116
+ data.trend && /* @__PURE__ */ jsxs("div", {
117
+ className: cn("flex items-center gap-1 text-sm", cls.trend),
118
+ children: [resolveIconElement(TrendIcon, { className: cn("h-3 w-3", cls.trendIcon) }), /* @__PURE__ */ jsx("span", { children: data.trend.value })]
119
+ }),
120
+ subtitle && /* @__PURE__ */ jsx("p", {
121
+ className: cn("text-muted-foreground text-xs", cls.subtitle),
122
+ children: subtitle
123
+ }),
124
+ footer && /* @__PURE__ */ jsx("p", {
125
+ className: cn("text-muted-foreground pt-2 text-xs", cls.footer),
126
+ children: footer
127
+ })
403
128
  ]
404
- });
405
- $[120] = t17;
406
- $[121] = t18;
407
- $[122] = t6;
408
- $[123] = t7;
409
- $[124] = t8;
410
- $[125] = t19;
411
- } else t19 = $[125];
412
- let t20;
413
- if ($[126] !== T0 || $[127] !== t10 || $[128] !== t11 || $[129] !== t12 || $[130] !== t13 || $[131] !== t14 || $[132] !== t15 || $[133] !== t16 || $[134] !== t19 || $[135] !== t9) {
414
- t20 = /* @__PURE__ */ jsx(T0, {
415
- title: t9,
416
- icon: t10,
417
- description: t11,
418
- variant: t12,
419
- onRefresh: t13,
420
- isRefreshing: t14,
421
- actions: t15,
422
- className: t16,
423
- children: t19
424
- });
425
- $[126] = T0;
426
- $[127] = t10;
427
- $[128] = t11;
428
- $[129] = t12;
429
- $[130] = t13;
430
- $[131] = t14;
431
- $[132] = t15;
432
- $[133] = t16;
433
- $[134] = t19;
434
- $[135] = t9;
435
- $[136] = t20;
436
- } else t20 = $[136];
437
- return t20;
129
+ })
130
+ });
438
131
  }
439
132
 
440
133
  //#endregion
@@ -1,87 +1,37 @@
1
1
  import { cn } from "../../lib/utils.mjs";
2
- import { c } from "react/compiler-runtime";
3
2
  import { Icon } from "@iconify/react";
4
3
  import { jsx, jsxs } from "react/jsx-runtime";
5
4
 
6
5
  //#region src/client/components/widgets/widget-empty-state.tsx
7
- function WidgetEmptyState(t0) {
8
- const $ = c(18);
9
- const { title, description, iconName: t1, action, className } = t0;
10
- const iconName = t1 === void 0 ? "ph:tray" : t1;
11
- let t2;
12
- if ($[0] !== className) {
13
- t2 = cn("qa-widget-empty-state flex min-h-28 flex-col items-center justify-center px-4 py-6 text-center", className);
14
- $[0] = className;
15
- $[1] = t2;
16
- } else t2 = $[1];
17
- let t3;
18
- if ($[2] !== iconName) {
19
- t3 = /* @__PURE__ */ jsx("div", {
20
- className: "border-border-subtle bg-surface-low text-muted-foreground mb-3 flex size-9 items-center justify-center rounded-md border",
21
- children: /* @__PURE__ */ jsx(Icon, {
22
- icon: iconName,
23
- className: "size-4"
24
- })
25
- });
26
- $[2] = iconName;
27
- $[3] = t3;
28
- } else t3 = $[3];
29
- let t4;
30
- if ($[4] !== title) {
31
- t4 = /* @__PURE__ */ jsx("p", {
32
- className: "text-foreground text-sm leading-5 font-medium text-balance",
33
- children: title
34
- });
35
- $[4] = title;
36
- $[5] = t4;
37
- } else t4 = $[5];
38
- let t5;
39
- if ($[6] !== description) {
40
- t5 = description && /* @__PURE__ */ jsx("p", {
41
- className: "text-muted-foreground mt-1 max-w-60 text-xs/5 text-pretty",
42
- children: description
43
- });
44
- $[6] = description;
45
- $[7] = t5;
46
- } else t5 = $[7];
47
- let t6;
48
- if ($[8] !== action) {
49
- t6 = action && /* @__PURE__ */ jsx("div", {
50
- className: "mt-4",
51
- children: action
52
- });
53
- $[8] = action;
54
- $[9] = t6;
55
- } else t6 = $[9];
56
- let t7;
57
- if ($[10] !== t3 || $[11] !== t4 || $[12] !== t5 || $[13] !== t6) {
58
- t7 = /* @__PURE__ */ jsxs("div", {
6
+ function WidgetEmptyState({ title, description, iconName = "ph:tray", action, className }) {
7
+ return /* @__PURE__ */ jsx("div", {
8
+ "data-slot": "widget-empty-state",
9
+ className: cn("qa-widget-empty-state flex min-h-28 flex-col items-center justify-center px-4 py-6 text-center", className),
10
+ children: /* @__PURE__ */ jsxs("div", {
59
11
  className: "flex max-w-64 flex-col items-center",
60
12
  children: [
61
- t3,
62
- t4,
63
- t5,
64
- t6
13
+ /* @__PURE__ */ jsx("div", {
14
+ className: "border-border-subtle bg-surface-low text-muted-foreground mb-3 flex size-9 items-center justify-center rounded-md border",
15
+ children: /* @__PURE__ */ jsx(Icon, {
16
+ icon: iconName,
17
+ className: "size-4"
18
+ })
19
+ }),
20
+ /* @__PURE__ */ jsx("p", {
21
+ className: "text-foreground text-sm leading-5 font-medium text-balance",
22
+ children: title
23
+ }),
24
+ description && /* @__PURE__ */ jsx("p", {
25
+ className: "text-muted-foreground mt-1 max-w-60 text-xs/5 text-pretty",
26
+ children: description
27
+ }),
28
+ action && /* @__PURE__ */ jsx("div", {
29
+ className: "mt-4",
30
+ children: action
31
+ })
65
32
  ]
66
- });
67
- $[10] = t3;
68
- $[11] = t4;
69
- $[12] = t5;
70
- $[13] = t6;
71
- $[14] = t7;
72
- } else t7 = $[14];
73
- let t8;
74
- if ($[15] !== t2 || $[16] !== t7) {
75
- t8 = /* @__PURE__ */ jsx("div", {
76
- "data-slot": "widget-empty-state",
77
- className: t2,
78
- children: t7
79
- });
80
- $[15] = t2;
81
- $[16] = t7;
82
- $[17] = t8;
83
- } else t8 = $[17];
84
- return t8;
33
+ })
34
+ });
85
35
  }
86
36
 
87
37
  //#endregion