@questpie/admin 3.2.3 → 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 (244) 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.d.mts +2 -2
  8. package/dist/client/components/admin-link.mjs +40 -126
  9. package/dist/client/components/auth/auth-loading.mjs +9 -44
  10. package/dist/client/components/blocks/block-canvas.mjs +31 -95
  11. package/dist/client/components/blocks/block-editor-context.mjs +13 -57
  12. package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
  13. package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
  14. package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
  15. package/dist/client/components/blocks/block-insert-button.mjs +49 -165
  16. package/dist/client/components/blocks/block-item-menu.mjs +102 -301
  17. package/dist/client/components/blocks/block-item.mjs +136 -370
  18. package/dist/client/components/blocks/block-library-sidebar.mjs +106 -220
  19. package/dist/client/components/blocks/block-tree.mjs +12 -68
  20. package/dist/client/components/blocks/block-type-icon.mjs +14 -56
  21. package/dist/client/components/brand-logo.mjs +35 -149
  22. package/dist/client/components/component-renderer.mjs +42 -118
  23. package/dist/client/components/error-boundary.mjs +14 -58
  24. package/dist/client/components/fields/array-field.mjs +209 -521
  25. package/dist/client/components/fields/asset-preview-field.mjs +41 -141
  26. package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
  27. package/dist/client/components/fields/boolean-field.mjs +29 -59
  28. package/dist/client/components/fields/date-field.mjs +7 -37
  29. package/dist/client/components/fields/datetime-field.mjs +7 -38
  30. package/dist/client/components/fields/email-field.mjs +25 -54
  31. package/dist/client/components/fields/field-wrapper.mjs +30 -105
  32. package/dist/client/components/fields/json-field.mjs +107 -313
  33. package/dist/client/components/fields/locale-badge.mjs +6 -15
  34. package/dist/client/components/fields/number-field.mjs +27 -60
  35. package/dist/client/components/fields/object-array-field.mjs +283 -659
  36. package/dist/client/components/fields/object-field.mjs +165 -633
  37. package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
  38. package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
  39. package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
  40. package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
  41. package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
  42. package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
  43. package/dist/client/components/fields/relation-field.mjs +10 -66
  44. package/dist/client/components/fields/relation-picker.mjs +18 -18
  45. package/dist/client/components/fields/relation-select.mjs +12 -12
  46. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -182
  47. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +8 -19
  48. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
  49. package/dist/client/components/fields/rich-text-editor/index.mjs +196 -530
  50. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
  51. package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
  52. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
  53. package/dist/client/components/fields/rich-text-field.mjs +14 -53
  54. package/dist/client/components/fields/select-field.mjs +39 -74
  55. package/dist/client/components/fields/text-field.mjs +26 -59
  56. package/dist/client/components/fields/textarea-field.mjs +26 -58
  57. package/dist/client/components/fields/time-field.mjs +7 -35
  58. package/dist/client/components/fields/upload-field.mjs +47 -165
  59. package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
  60. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
  61. package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
  62. package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
  63. package/dist/client/components/history-sidebar.mjs +306 -611
  64. package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
  65. package/dist/client/components/locale-switcher.mjs +106 -228
  66. package/dist/client/components/media/media-grid.mjs +84 -273
  67. package/dist/client/components/media/media-picker-dialog.mjs +177 -494
  68. package/dist/client/components/preview/live-preview-mode.mjs +240 -438
  69. package/dist/client/components/preview/preview-pane.mjs +22 -22
  70. package/dist/client/components/primitives/asset-preview.mjs +290 -666
  71. package/dist/client/components/primitives/checkbox-input.mjs +9 -35
  72. package/dist/client/components/primitives/date-input.mjs +109 -327
  73. package/dist/client/components/primitives/dropzone.mjs +209 -336
  74. package/dist/client/components/primitives/field-select-control.mjs +12 -80
  75. package/dist/client/components/primitives/number-input.mjs +4 -4
  76. package/dist/client/components/primitives/select-multi.mjs +200 -559
  77. package/dist/client/components/primitives/select-single.mjs +165 -499
  78. package/dist/client/components/primitives/time-input.mjs +43 -117
  79. package/dist/client/components/primitives/toggle-input.mjs +9 -29
  80. package/dist/client/components/sheets/resource-sheet.mjs +61 -70
  81. package/dist/client/components/ui/accordion.mjs +35 -155
  82. package/dist/client/components/ui/alert.mjs +13 -68
  83. package/dist/client/components/ui/badge.mjs +9 -51
  84. package/dist/client/components/ui/button.mjs +8 -54
  85. package/dist/client/components/ui/card.mjs +37 -193
  86. package/dist/client/components/ui/checkbox.mjs +12 -68
  87. package/dist/client/components/ui/command.mjs +48 -219
  88. package/dist/client/components/ui/dialog.mjs +50 -262
  89. package/dist/client/components/ui/drawer.mjs +55 -259
  90. package/dist/client/components/ui/dropdown-menu.mjs +86 -427
  91. package/dist/client/components/ui/empty-state.mjs +28 -98
  92. package/dist/client/components/ui/field.mjs +73 -309
  93. package/dist/client/components/ui/input-group.mjs +42 -167
  94. package/dist/client/components/ui/input.mjs +7 -37
  95. package/dist/client/components/ui/kbd.mjs +6 -36
  96. package/dist/client/components/ui/label.mjs +7 -37
  97. package/dist/client/components/ui/popover.mjs +34 -169
  98. package/dist/client/components/ui/responsive-dialog.mjs +67 -273
  99. package/dist/client/components/ui/scroll-fade.mjs +63 -158
  100. package/dist/client/components/ui/search-input.mjs +33 -100
  101. package/dist/client/components/ui/select.mjs +72 -393
  102. package/dist/client/components/ui/separator.mjs +7 -38
  103. package/dist/client/components/ui/sheet.mjs +49 -269
  104. package/dist/client/components/ui/sidebar.mjs +171 -690
  105. package/dist/client/components/ui/skeleton.mjs +7 -38
  106. package/dist/client/components/ui/sonner.mjs +11 -42
  107. package/dist/client/components/ui/switch.mjs +9 -45
  108. package/dist/client/components/ui/table.mjs +48 -266
  109. package/dist/client/components/ui/tabs.mjs +26 -139
  110. package/dist/client/components/ui/textarea.mjs +6 -32
  111. package/dist/client/components/ui/tooltip.mjs +27 -129
  112. package/dist/client/components/widgets/chart-widget.mjs +174 -522
  113. package/dist/client/components/widgets/progress-widget.mjs +66 -172
  114. package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
  115. package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
  116. package/dist/client/components/widgets/stats-widget.mjs +41 -175
  117. package/dist/client/components/widgets/table-widget.mjs +9 -9
  118. package/dist/client/components/widgets/timeline-widget.mjs +86 -226
  119. package/dist/client/components/widgets/value-widget.mjs +74 -381
  120. package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
  121. package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
  122. package/dist/client/contexts/focus-context.d.mts +4 -0
  123. package/dist/client/contexts/focus-context.mjs +87 -150
  124. package/dist/client/hooks/typed-hooks.mjs +241 -701
  125. package/dist/client/hooks/use-action.mjs +62 -198
  126. package/dist/client/hooks/use-admin-config.mjs +5 -35
  127. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  128. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  129. package/dist/client/hooks/use-audit-history.mjs +21 -69
  130. package/dist/client/hooks/use-brand.mjs +1 -9
  131. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  132. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  133. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  134. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  135. package/dist/client/hooks/use-collection.mjs +194 -614
  136. package/dist/client/hooks/use-current-user.mjs +0 -1
  137. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  138. package/dist/client/hooks/use-field-options.mjs +61 -202
  139. package/dist/client/hooks/use-global-fields.mjs +14 -46
  140. package/dist/client/hooks/use-global-meta.mjs +9 -30
  141. package/dist/client/hooks/use-global-schema.mjs +9 -30
  142. package/dist/client/hooks/use-global.mjs +63 -219
  143. package/dist/client/hooks/use-locks.mjs +117 -325
  144. package/dist/client/hooks/use-media-query.mjs +16 -36
  145. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  146. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  147. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  148. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  149. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  150. package/dist/client/hooks/use-saved-views.mjs +22 -103
  151. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  152. package/dist/client/hooks/use-search.mjs +31 -143
  153. package/dist/client/hooks/use-server-actions.mjs +18 -50
  154. package/dist/client/hooks/use-server-validation.mjs +72 -166
  155. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  156. package/dist/client/hooks/use-setup-status.mjs +12 -25
  157. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  158. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  159. package/dist/client/hooks/use-upload.mjs +54 -152
  160. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  161. package/dist/client/hooks/use-view-state.mjs +187 -437
  162. package/dist/client/i18n/hooks.mjs +65 -197
  163. package/dist/client/lib/render-profiler.mjs +14 -41
  164. package/dist/client/preview/block-scope-context.d.mts +2 -2
  165. package/dist/client/preview/block-scope-context.mjs +14 -36
  166. package/dist/client/preview/diff.mjs +110 -0
  167. package/dist/client/preview/preview-banner.mjs +42 -108
  168. package/dist/client/preview/preview-field.d.mts +4 -4
  169. package/dist/client/preview/preview-field.mjs +166 -409
  170. package/dist/client/preview/use-collection-preview.mjs +135 -201
  171. package/dist/client/runtime/content-locales-provider.mjs +31 -83
  172. package/dist/client/runtime/locale-scope.mjs +22 -63
  173. package/dist/client/runtime/provider.mjs +100 -255
  174. package/dist/client/runtime/translations-provider.mjs +41 -107
  175. package/dist/client/scope/picker.d.mts +2 -2
  176. package/dist/client/scope/picker.mjs +86 -321
  177. package/dist/client/scope/provider.d.mts +2 -2
  178. package/dist/client/scope/provider.mjs +8 -17
  179. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  180. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  181. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  182. package/dist/client/views/auth/auth-layout.mjs +104 -284
  183. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  184. package/dist/client/views/auth/forgot-password-form.mjs +94 -325
  185. package/dist/client/views/auth/invite-form.mjs +107 -442
  186. package/dist/client/views/auth/login-form.d.mts +2 -2
  187. package/dist/client/views/auth/login-form.mjs +116 -337
  188. package/dist/client/views/auth/reset-password-form.mjs +128 -453
  189. package/dist/client/views/auth/setup-form.mjs +140 -478
  190. package/dist/client/views/collection/auto-form-fields.mjs +243 -615
  191. package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -400
  192. package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
  193. package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
  194. package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
  195. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
  196. package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
  197. package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
  198. package/dist/client/views/collection/columns/build-columns.mjs +8 -48
  199. package/dist/client/views/collection/field-renderer.mjs +11 -24
  200. package/dist/client/views/collection/form-view.mjs +288 -560
  201. package/dist/client/views/collection/table-view.mjs +239 -469
  202. package/dist/client/views/collection/view-skeletons.mjs +112 -237
  203. package/dist/client/views/common/global-search.mjs +241 -543
  204. package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
  205. package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
  206. package/dist/client/views/dashboard/widget-card.mjs +61 -269
  207. package/dist/client/views/globals/global-form-view.mjs +478 -1298
  208. package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
  209. package/dist/client/views/layout/admin-layout.mjs +83 -246
  210. package/dist/client/views/layout/admin-router.mjs +457 -1289
  211. package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
  212. package/dist/client/views/layout/admin-theme.mjs +30 -64
  213. package/dist/client/views/layout/admin-view-layout.mjs +40 -144
  214. package/dist/client/views/pages/accept-invite-page.mjs +95 -290
  215. package/dist/client/views/pages/dashboard-page.mjs +11 -57
  216. package/dist/client/views/pages/forgot-password-page.mjs +31 -83
  217. package/dist/client/views/pages/invite-page.mjs +35 -90
  218. package/dist/client/views/pages/login-page.mjs +41 -121
  219. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  220. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  221. package/dist/client/views/pages/setup-page.d.mts +2 -2
  222. package/dist/client/views/pages/setup-page.mjs +33 -95
  223. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  224. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  225. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  226. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  227. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  228. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  229. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  230. package/dist/server/modules/admin/collections/assets.d.mts +34 -34
  231. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  232. package/dist/server/modules/admin/collections/user.d.mts +53 -53
  233. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  234. package/dist/server/modules/admin/index.d.mts +21 -20
  235. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  236. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  237. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  238. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  239. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  240. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  241. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  242. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  243. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
  244. package/package.json +3 -5
@@ -1,158 +1,58 @@
1
1
  import { cn } from "../../lib/utils.mjs";
2
2
  import { AssetThumbnail } from "../../views/collection/cells/shared/asset-thumbnail.mjs";
3
3
  import { FieldWrapper } from "./field-wrapper.mjs";
4
- import { c } from "react/compiler-runtime";
5
4
  import "react";
6
5
  import { jsx } from "react/jsx-runtime";
7
6
  import { useFormContext, useWatch } from "react-hook-form";
8
7
 
9
8
  //#region src/client/components/fields/asset-preview-field.tsx
10
- function AssetPreviewField(t0) {
11
- const $ = c(37);
12
- const { name: t1, label: t2, description, className, urlField: t3, mimeTypeField: t4, filenameField: t5, altField: t6 } = t0;
13
- const name = t1 === void 0 ? "preview" : t1;
14
- const label = t2 === void 0 ? "Preview" : t2;
15
- const urlField = t3 === void 0 ? "url" : t3;
16
- const mimeTypeField = t4 === void 0 ? "mimeType" : t4;
17
- const filenameField = t5 === void 0 ? "filename" : t5;
18
- const altField = t6 === void 0 ? "alt" : t6;
9
+ function AssetPreviewField({ name = "preview", label = "Preview", description, className, urlField = "url", mimeTypeField = "mimeType", filenameField = "filename", altField = "alt" }) {
19
10
  const form = useFormContext();
20
- const t7 = form?.control;
21
- let t8;
22
- if ($[0] !== t7 || $[1] !== urlField) {
23
- t8 = {
24
- control: t7,
25
- name: urlField
26
- };
27
- $[0] = t7;
28
- $[1] = urlField;
29
- $[2] = t8;
30
- } else t8 = $[2];
31
- const url = useWatch(t8);
32
- const t9 = form?.control;
33
- let t10;
34
- if ($[3] !== mimeTypeField || $[4] !== t9) {
35
- t10 = {
36
- control: t9,
37
- name: mimeTypeField
38
- };
39
- $[3] = mimeTypeField;
40
- $[4] = t9;
41
- $[5] = t10;
42
- } else t10 = $[5];
43
- const mimeType = useWatch(t10);
44
- const t11 = form?.control;
45
- let t12;
46
- if ($[6] !== filenameField || $[7] !== t11) {
47
- t12 = {
48
- control: t11,
49
- name: filenameField
50
- };
51
- $[6] = filenameField;
52
- $[7] = t11;
53
- $[8] = t12;
54
- } else t12 = $[8];
55
- const filename = useWatch(t12);
56
- const t13 = form?.control;
57
- let t14;
58
- if ($[9] !== altField || $[10] !== t13) {
59
- t14 = {
60
- control: t13,
61
- name: altField
62
- };
63
- $[9] = altField;
64
- $[10] = t13;
65
- $[11] = t14;
66
- } else t14 = $[11];
67
- const alt = useWatch(t14);
68
- let t15;
69
- if ($[12] !== alt || $[13] !== filename || $[14] !== mimeType || $[15] !== url) {
70
- t15 = url ? {
71
- url,
72
- mimeType,
73
- filename,
74
- alt
75
- } : null;
76
- $[12] = alt;
77
- $[13] = filename;
78
- $[14] = mimeType;
79
- $[15] = url;
80
- $[16] = t15;
81
- } else t15 = $[16];
82
- const asset = t15;
83
- if (!asset) {
84
- let t16$1;
85
- if ($[17] !== className) {
86
- t16$1 = cn("qa-asset-preview-field flex items-center justify-center py-4", "text-muted-foreground", className);
87
- $[17] = className;
88
- $[18] = t16$1;
89
- } else t16$1 = $[18];
90
- let t17$1;
91
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
92
- t17$1 = /* @__PURE__ */ jsx("p", {
11
+ const url = useWatch({
12
+ control: form?.control,
13
+ name: urlField
14
+ });
15
+ const mimeType = useWatch({
16
+ control: form?.control,
17
+ name: mimeTypeField
18
+ });
19
+ const filename = useWatch({
20
+ control: form?.control,
21
+ name: filenameField
22
+ });
23
+ const alt = useWatch({
24
+ control: form?.control,
25
+ name: altField
26
+ });
27
+ const asset = url ? {
28
+ url,
29
+ mimeType,
30
+ filename,
31
+ alt
32
+ } : null;
33
+ if (!asset) return /* @__PURE__ */ jsx(FieldWrapper, {
34
+ name,
35
+ label,
36
+ description,
37
+ children: /* @__PURE__ */ jsx("div", {
38
+ className: cn("qa-asset-preview-field flex items-center justify-center py-4", "text-muted-foreground", className),
39
+ children: /* @__PURE__ */ jsx("p", {
93
40
  className: "text-sm",
94
41
  children: "No preview available"
95
- });
96
- $[19] = t17$1;
97
- } else t17$1 = $[19];
98
- let t18$1;
99
- if ($[20] !== t16$1) {
100
- t18$1 = /* @__PURE__ */ jsx("div", {
101
- className: t16$1,
102
- children: t17$1
103
- });
104
- $[20] = t16$1;
105
- $[21] = t18$1;
106
- } else t18$1 = $[21];
107
- let t19;
108
- if ($[22] !== description || $[23] !== label || $[24] !== name || $[25] !== t18$1) {
109
- t19 = /* @__PURE__ */ jsx(FieldWrapper, {
110
- name,
111
- label,
112
- description,
113
- children: t18$1
114
- });
115
- $[22] = description;
116
- $[23] = label;
117
- $[24] = name;
118
- $[25] = t18$1;
119
- $[26] = t19;
120
- } else t19 = $[26];
121
- return t19;
122
- }
123
- let t16;
124
- if ($[27] !== className) {
125
- t16 = cn("qa-asset-preview-field", className);
126
- $[27] = className;
127
- $[28] = t16;
128
- } else t16 = $[28];
129
- let t17;
130
- if ($[29] !== asset || $[30] !== t16) {
131
- t17 = /* @__PURE__ */ jsx(AssetThumbnail, {
42
+ })
43
+ })
44
+ });
45
+ return /* @__PURE__ */ jsx(FieldWrapper, {
46
+ name,
47
+ label,
48
+ description,
49
+ children: /* @__PURE__ */ jsx(AssetThumbnail, {
132
50
  asset,
133
51
  size: "lg",
134
52
  showControls: true,
135
- className: t16
136
- });
137
- $[29] = asset;
138
- $[30] = t16;
139
- $[31] = t17;
140
- } else t17 = $[31];
141
- let t18;
142
- if ($[32] !== description || $[33] !== label || $[34] !== name || $[35] !== t17) {
143
- t18 = /* @__PURE__ */ jsx(FieldWrapper, {
144
- name,
145
- label,
146
- description,
147
- children: t17
148
- });
149
- $[32] = description;
150
- $[33] = label;
151
- $[34] = name;
152
- $[35] = t17;
153
- $[36] = t18;
154
- } else t18 = $[36];
155
- return t18;
53
+ className: cn("qa-asset-preview-field", className)
54
+ })
55
+ });
156
56
  }
157
57
 
158
58
  //#endregion
@@ -7,8 +7,7 @@ import { FieldWrapper } from "../field-wrapper.mjs";
7
7
  import { countBlocks } from "../../blocks/utils/tree-utils.mjs";
8
8
  import { BlockEditorLayout } from "../../blocks/block-editor-layout.mjs";
9
9
  import { BlockEditorProvider } from "../../blocks/block-editor-provider.mjs";
10
- import { c } from "react/compiler-runtime";
11
- import "react";
10
+ import * as React from "react";
12
11
  import { jsx, jsxs } from "react/jsx-runtime";
13
12
  import { useFormContext, useWatch } from "react-hook-form";
14
13
 
@@ -25,164 +24,69 @@ const EMPTY_BLOCKS = {};
25
24
  *
26
25
  * Renders the visual block editor for editing block content.
27
26
  */
28
- function BlocksField(t0) {
29
- const $ = c(39);
30
- const { name, value, onChange, label, description, error, required, disabled, allowedBlocks, minBlocks, maxBlocks } = t0;
27
+ function BlocksField({ name, value, onChange, label, description, error, required, disabled, allowedBlocks, minBlocks, maxBlocks }) {
31
28
  const { t } = useTranslation();
32
- const form = useFormContext();
33
- let t1;
34
- if ($[0] !== form.control || $[1] !== name) {
35
- t1 = {
36
- control: form.control,
37
- name
38
- };
39
- $[0] = form.control;
40
- $[1] = name;
41
- $[2] = t1;
42
- } else t1 = $[2];
43
- const watchedContent = useWatch(t1);
29
+ const watchedContent = useWatch({
30
+ control: useFormContext().control,
31
+ name
32
+ });
44
33
  const { data: adminConfig } = useAdminConfig();
45
- let t2;
46
- if ($[3] !== value || $[4] !== watchedContent) {
47
- t2 = isBlockContent(watchedContent) ? watchedContent : isBlockContent(value) ? value : EMPTY_BLOCK_CONTENT;
48
- $[3] = value;
49
- $[4] = watchedContent;
50
- $[5] = t2;
51
- } else t2 = $[5];
52
- const content = t2;
34
+ const content = isBlockContent(watchedContent) ? watchedContent : isBlockContent(value) ? value : EMPTY_BLOCK_CONTENT;
53
35
  const blocks = adminConfig?.blocks ?? EMPTY_BLOCKS;
54
- let t3;
55
- bb0: {
56
- if (!allowedBlocks || allowedBlocks.length === 0) {
57
- t3 = blocks;
58
- break bb0;
59
- }
60
- let t4$1;
61
- if ($[6] !== allowedBlocks) {
62
- t4$1 = new Set(allowedBlocks);
63
- $[6] = allowedBlocks;
64
- $[7] = t4$1;
65
- } else t4$1 = $[7];
66
- const allowed = t4$1;
67
- let t5$1;
68
- if ($[8] !== allowed || $[9] !== blocks) {
69
- t5$1 = Object.fromEntries(Object.entries(blocks).filter((t6$1) => {
70
- const [name_0] = t6$1;
71
- return allowed.has(name_0);
72
- }));
73
- $[8] = allowed;
74
- $[9] = blocks;
75
- $[10] = t5$1;
76
- } else t5$1 = $[10];
77
- t3 = t5$1;
78
- }
79
- const filteredBlocks = t3;
80
- let t4;
81
- if ($[11] !== onChange) {
82
- t4 = (newContent) => {
83
- onChange?.(newContent);
84
- };
85
- $[11] = onChange;
86
- $[12] = t4;
87
- } else t4 = $[12];
88
- const handleChange = t4;
89
- let t5;
90
- if ($[13] !== content._tree) {
91
- t5 = countBlocks(content._tree);
92
- $[13] = content._tree;
93
- $[14] = t5;
94
- } else t5 = $[14];
95
- const blockCount = t5;
96
- let t6;
97
- if ($[15] !== filteredBlocks) {
98
- t6 = Object.keys(filteredBlocks);
99
- $[15] = filteredBlocks;
100
- $[16] = t6;
101
- } else t6 = $[16];
102
- const hasBlocks = t6.length > 0;
103
- let t7;
104
- if ($[17] !== allowedBlocks || $[18] !== content || $[19] !== filteredBlocks || $[20] !== handleChange || $[21] !== hasBlocks || $[22] !== t) {
105
- t7 = hasBlocks ? /* @__PURE__ */ jsx(BlockEditorProvider, {
106
- value: content,
107
- onChange: handleChange,
108
- blocks: filteredBlocks,
109
- allowedBlocks,
110
- children: /* @__PURE__ */ jsx(BlockEditorLayout, {})
111
- }) : /* @__PURE__ */ jsxs("div", {
112
- className: "text-muted-foreground py-4",
113
- children: [/* @__PURE__ */ jsx("p", {
114
- className: "text-sm",
115
- children: t("blocks.noDefinitions")
116
- }), /* @__PURE__ */ jsx("p", {
117
- className: "mt-1 text-xs",
118
- children: t("blocks.noDefinitionsHint")
119
- })]
120
- });
121
- $[17] = allowedBlocks;
122
- $[18] = content;
123
- $[19] = filteredBlocks;
124
- $[20] = handleChange;
125
- $[21] = hasBlocks;
126
- $[22] = t;
127
- $[23] = t7;
128
- } else t7 = $[23];
129
- let t8;
130
- if ($[24] !== blockCount || $[25] !== maxBlocks || $[26] !== minBlocks) {
131
- t8 = (minBlocks || maxBlocks) && /* @__PURE__ */ jsxs("div", {
132
- className: "text-muted-foreground mt-2 text-xs",
133
- children: [
134
- minBlocks && /* @__PURE__ */ jsxs("span", { children: [
135
- "Min: ",
136
- minBlocks,
137
- " blocks "
138
- ] }),
139
- maxBlocks && /* @__PURE__ */ jsxs("span", { children: [
140
- "Max: ",
141
- maxBlocks,
142
- " blocks"
143
- ] }),
144
- /* @__PURE__ */ jsxs("span", {
145
- className: "ml-2",
146
- children: ["Current: ", blockCount]
147
- })
148
- ]
149
- });
150
- $[24] = blockCount;
151
- $[25] = maxBlocks;
152
- $[26] = minBlocks;
153
- $[27] = t8;
154
- } else t8 = $[27];
155
- let t9;
156
- if ($[28] !== t7 || $[29] !== t8) {
157
- t9 = /* @__PURE__ */ jsxs("div", {
36
+ const filteredBlocks = React.useMemo(() => {
37
+ if (!allowedBlocks || allowedBlocks.length === 0) return blocks;
38
+ const allowed = new Set(allowedBlocks);
39
+ return Object.fromEntries(Object.entries(blocks).filter(([name$1]) => allowed.has(name$1)));
40
+ }, [blocks, allowedBlocks]);
41
+ const handleChange = React.useCallback((newContent) => {
42
+ onChange?.(newContent);
43
+ }, [onChange]);
44
+ const blockCount = countBlocks(content._tree);
45
+ return /* @__PURE__ */ jsx(FieldWrapper, {
46
+ name,
47
+ label,
48
+ description,
49
+ error,
50
+ required,
51
+ disabled,
52
+ children: /* @__PURE__ */ jsxs("div", {
158
53
  className: "qa-blocks-field",
159
- children: [t7, t8]
160
- });
161
- $[28] = t7;
162
- $[29] = t8;
163
- $[30] = t9;
164
- } else t9 = $[30];
165
- let t10;
166
- if ($[31] !== description || $[32] !== disabled || $[33] !== error || $[34] !== label || $[35] !== name || $[36] !== required || $[37] !== t9) {
167
- t10 = /* @__PURE__ */ jsx(FieldWrapper, {
168
- name,
169
- label,
170
- description,
171
- error,
172
- required,
173
- disabled,
174
- children: t9
175
- });
176
- $[31] = description;
177
- $[32] = disabled;
178
- $[33] = error;
179
- $[34] = label;
180
- $[35] = name;
181
- $[36] = required;
182
- $[37] = t9;
183
- $[38] = t10;
184
- } else t10 = $[38];
185
- return t10;
54
+ children: [Object.keys(filteredBlocks).length > 0 ? /* @__PURE__ */ jsx(BlockEditorProvider, {
55
+ value: content,
56
+ onChange: handleChange,
57
+ blocks: filteredBlocks,
58
+ allowedBlocks,
59
+ children: /* @__PURE__ */ jsx(BlockEditorLayout, {})
60
+ }) : /* @__PURE__ */ jsxs("div", {
61
+ className: "text-muted-foreground py-4",
62
+ children: [/* @__PURE__ */ jsx("p", {
63
+ className: "text-sm",
64
+ children: t("blocks.noDefinitions")
65
+ }), /* @__PURE__ */ jsx("p", {
66
+ className: "mt-1 text-xs",
67
+ children: t("blocks.noDefinitionsHint")
68
+ })]
69
+ }), (minBlocks || maxBlocks) && /* @__PURE__ */ jsxs("div", {
70
+ className: "text-muted-foreground mt-2 text-xs",
71
+ children: [
72
+ minBlocks && /* @__PURE__ */ jsxs("span", { children: [
73
+ "Min: ",
74
+ minBlocks,
75
+ " blocks "
76
+ ] }),
77
+ maxBlocks && /* @__PURE__ */ jsxs("span", { children: [
78
+ "Max: ",
79
+ maxBlocks,
80
+ " blocks"
81
+ ] }),
82
+ /* @__PURE__ */ jsxs("span", {
83
+ className: "ml-2",
84
+ children: ["Current: ", blockCount]
85
+ })
86
+ ]
87
+ })]
88
+ })
89
+ });
186
90
  }
187
91
 
188
92
  //#endregion
@@ -3,7 +3,6 @@ import { useResolvedControl } from "./field-utils.mjs";
3
3
  import { FieldWrapper } from "./field-wrapper.mjs";
4
4
  import { CheckboxInput } from "../primitives/checkbox-input.mjs";
5
5
  import { ToggleInput } from "../primitives/toggle-input.mjs";
6
- import { c } from "react/compiler-runtime";
7
6
  import { jsx } from "react/jsx-runtime";
8
7
  import { Controller } from "react-hook-form";
9
8
 
@@ -12,65 +11,36 @@ import { Controller } from "react-hook-form";
12
11
  * Unified boolean field component.
13
12
  * Renders as checkbox (default) or switch based on `displayAs` prop.
14
13
  */
15
- function BooleanField(t0) {
16
- const $ = c(14);
17
- const { name, label, description, required, disabled, localized, locale, control, className, displayAs: t1 } = t0;
18
- const displayAs = t1 === void 0 ? "checkbox" : t1;
19
- const resolvedControl = useResolvedControl(control);
20
- let t2;
21
- if ($[0] !== className || $[1] !== description || $[2] !== disabled || $[3] !== displayAs || $[4] !== label || $[5] !== locale || $[6] !== localized || $[7] !== name || $[8] !== required) {
22
- t2 = (t3$1) => {
23
- const { field, fieldState } = t3$1;
24
- return /* @__PURE__ */ jsx(FieldWrapper, {
25
- name,
26
- label,
27
- description,
28
- required,
29
- disabled,
30
- localized,
31
- locale,
32
- error: fieldState.error?.message,
33
- children: displayAs === "switch" ? /* @__PURE__ */ jsx(ToggleInput, {
34
- id: name,
35
- value: !!field.value,
36
- onChange: field.onChange,
37
- disabled,
38
- "aria-invalid": !!fieldState.error,
39
- className: cn("qa-boolean-field", className)
40
- }) : /* @__PURE__ */ jsx(CheckboxInput, {
41
- id: name,
42
- value: !!field.value,
43
- onChange: field.onChange,
44
- disabled,
45
- "aria-invalid": !!fieldState.error,
46
- className: cn("qa-boolean-field", className)
47
- })
48
- });
49
- };
50
- $[0] = className;
51
- $[1] = description;
52
- $[2] = disabled;
53
- $[3] = displayAs;
54
- $[4] = label;
55
- $[5] = locale;
56
- $[6] = localized;
57
- $[7] = name;
58
- $[8] = required;
59
- $[9] = t2;
60
- } else t2 = $[9];
61
- let t3;
62
- if ($[10] !== name || $[11] !== resolvedControl || $[12] !== t2) {
63
- t3 = /* @__PURE__ */ jsx(Controller, {
14
+ function BooleanField({ name, label, description, required, disabled, localized, locale, control, className, displayAs = "checkbox" }) {
15
+ return /* @__PURE__ */ jsx(Controller, {
16
+ name,
17
+ control: useResolvedControl(control),
18
+ render: ({ field, fieldState }) => /* @__PURE__ */ jsx(FieldWrapper, {
64
19
  name,
65
- control: resolvedControl,
66
- render: t2
67
- });
68
- $[10] = name;
69
- $[11] = resolvedControl;
70
- $[12] = t2;
71
- $[13] = t3;
72
- } else t3 = $[13];
73
- return t3;
20
+ label,
21
+ description,
22
+ required,
23
+ disabled,
24
+ localized,
25
+ locale,
26
+ error: fieldState.error?.message,
27
+ children: displayAs === "switch" ? /* @__PURE__ */ jsx(ToggleInput, {
28
+ id: name,
29
+ value: !!field.value,
30
+ onChange: field.onChange,
31
+ disabled,
32
+ "aria-invalid": !!fieldState.error,
33
+ className: cn("qa-boolean-field", className)
34
+ }) : /* @__PURE__ */ jsx(CheckboxInput, {
35
+ id: name,
36
+ value: !!field.value,
37
+ onChange: field.onChange,
38
+ disabled,
39
+ "aria-invalid": !!fieldState.error,
40
+ className: cn("qa-boolean-field", className)
41
+ })
42
+ })
43
+ });
74
44
  }
75
45
 
76
46
  //#endregion
@@ -2,19 +2,15 @@ import { cn } from "../../lib/utils.mjs";
2
2
  import { useResolvedControl } from "./field-utils.mjs";
3
3
  import { FieldWrapper } from "./field-wrapper.mjs";
4
4
  import { DateInput } from "../primitives/date-input.mjs";
5
- import { c } from "react/compiler-runtime";
6
5
  import { jsx } from "react/jsx-runtime";
7
6
  import { Controller } from "react-hook-form";
8
7
 
9
8
  //#region src/client/components/fields/date-field.tsx
10
- function DateField(t0) {
11
- const $ = c(17);
12
- const { name, label, description, placeholder, required, disabled, localized, locale, control, className, minDate, maxDate, format } = t0;
13
- const resolvedControl = useResolvedControl(control);
14
- let t1;
15
- if ($[0] !== className || $[1] !== description || $[2] !== disabled || $[3] !== format || $[4] !== label || $[5] !== locale || $[6] !== localized || $[7] !== maxDate || $[8] !== minDate || $[9] !== name || $[10] !== placeholder || $[11] !== required) {
16
- t1 = (t2$1) => {
17
- const { field, fieldState } = t2$1;
9
+ function DateField({ name, label, description, placeholder, required, disabled, localized, locale, control, className, minDate, maxDate, format }) {
10
+ return /* @__PURE__ */ jsx(Controller, {
11
+ name,
12
+ control: useResolvedControl(control),
13
+ render: ({ field, fieldState }) => {
18
14
  const dateValue = (() => {
19
15
  if (!field.value) return null;
20
16
  const d = field.value instanceof Date ? field.value : new Date(field.value);
@@ -42,34 +38,8 @@ function DateField(t0) {
42
38
  className: cn("qa-date-field", className)
43
39
  })
44
40
  });
45
- };
46
- $[0] = className;
47
- $[1] = description;
48
- $[2] = disabled;
49
- $[3] = format;
50
- $[4] = label;
51
- $[5] = locale;
52
- $[6] = localized;
53
- $[7] = maxDate;
54
- $[8] = minDate;
55
- $[9] = name;
56
- $[10] = placeholder;
57
- $[11] = required;
58
- $[12] = t1;
59
- } else t1 = $[12];
60
- let t2;
61
- if ($[13] !== name || $[14] !== resolvedControl || $[15] !== t1) {
62
- t2 = /* @__PURE__ */ jsx(Controller, {
63
- name,
64
- control: resolvedControl,
65
- render: t1
66
- });
67
- $[13] = name;
68
- $[14] = resolvedControl;
69
- $[15] = t1;
70
- $[16] = t2;
71
- } else t2 = $[16];
72
- return t2;
41
+ }
42
+ });
73
43
  }
74
44
 
75
45
  //#endregion
@@ -2,19 +2,15 @@ import { cn } from "../../lib/utils.mjs";
2
2
  import { useResolvedControl } from "./field-utils.mjs";
3
3
  import { FieldWrapper } from "./field-wrapper.mjs";
4
4
  import { DateTimeInput } from "../primitives/date-input.mjs";
5
- import { c } from "react/compiler-runtime";
6
5
  import { jsx } from "react/jsx-runtime";
7
6
  import { Controller } from "react-hook-form";
8
7
 
9
8
  //#region src/client/components/fields/datetime-field.tsx
10
- function DatetimeField(t0) {
11
- const $ = c(18);
12
- const { name, label, description, placeholder, required, disabled, localized, locale, control, className, minDate, maxDate, format, precision } = t0;
13
- const resolvedControl = useResolvedControl(control);
14
- let t1;
15
- if ($[0] !== className || $[1] !== description || $[2] !== disabled || $[3] !== format || $[4] !== label || $[5] !== locale || $[6] !== localized || $[7] !== maxDate || $[8] !== minDate || $[9] !== name || $[10] !== placeholder || $[11] !== precision || $[12] !== required) {
16
- t1 = (t2$1) => {
17
- const { field, fieldState } = t2$1;
9
+ function DatetimeField({ name, label, description, placeholder, required, disabled, localized, locale, control, className, minDate, maxDate, format, precision }) {
10
+ return /* @__PURE__ */ jsx(Controller, {
11
+ name,
12
+ control: useResolvedControl(control),
13
+ render: ({ field, fieldState }) => {
18
14
  const dateValue = field.value instanceof Date ? field.value : field.value ? new Date(field.value) : null;
19
15
  return /* @__PURE__ */ jsx(FieldWrapper, {
20
16
  name,
@@ -39,35 +35,8 @@ function DatetimeField(t0) {
39
35
  className: cn("qa-datetime-field", className)
40
36
  })
41
37
  });
42
- };
43
- $[0] = className;
44
- $[1] = description;
45
- $[2] = disabled;
46
- $[3] = format;
47
- $[4] = label;
48
- $[5] = locale;
49
- $[6] = localized;
50
- $[7] = maxDate;
51
- $[8] = minDate;
52
- $[9] = name;
53
- $[10] = placeholder;
54
- $[11] = precision;
55
- $[12] = required;
56
- $[13] = t1;
57
- } else t1 = $[13];
58
- let t2;
59
- if ($[14] !== name || $[15] !== resolvedControl || $[16] !== t1) {
60
- t2 = /* @__PURE__ */ jsx(Controller, {
61
- name,
62
- control: resolvedControl,
63
- render: t1
64
- });
65
- $[14] = name;
66
- $[15] = resolvedControl;
67
- $[16] = t1;
68
- $[17] = t2;
69
- } else t2 = $[17];
70
- return t2;
38
+ }
39
+ });
71
40
  }
72
41
 
73
42
  //#endregion