@questpie/admin 3.2.4 → 3.2.6

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 (255) 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 +103 -230
  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 +94 -296
  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 -180
  47. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
  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 +195 -513
  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 +61 -72
  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 +285 -605
  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 +176 -476
  68. package/dist/client/components/preview/live-preview-mode.mjs +233 -458
  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 +229 -572
  77. package/dist/client/components/primitives/select-single.mjs +179 -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.mjs +63 -146
  123. package/dist/client/hooks/typed-hooks.mjs +241 -701
  124. package/dist/client/hooks/use-action.mjs +62 -198
  125. package/dist/client/hooks/use-admin-config.mjs +5 -35
  126. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  127. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  128. package/dist/client/hooks/use-audit-history.mjs +21 -69
  129. package/dist/client/hooks/use-brand.mjs +1 -9
  130. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  131. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  132. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  133. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  134. package/dist/client/hooks/use-collection.mjs +194 -614
  135. package/dist/client/hooks/use-current-user.mjs +0 -1
  136. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  137. package/dist/client/hooks/use-field-options.mjs +61 -202
  138. package/dist/client/hooks/use-global-fields.mjs +14 -46
  139. package/dist/client/hooks/use-global-meta.mjs +9 -30
  140. package/dist/client/hooks/use-global-schema.mjs +9 -30
  141. package/dist/client/hooks/use-global.mjs +63 -219
  142. package/dist/client/hooks/use-locks.mjs +117 -325
  143. package/dist/client/hooks/use-media-query.mjs +16 -36
  144. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  145. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  146. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  147. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  148. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  149. package/dist/client/hooks/use-saved-views.mjs +22 -103
  150. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  151. package/dist/client/hooks/use-search.mjs +31 -143
  152. package/dist/client/hooks/use-server-actions.mjs +18 -50
  153. package/dist/client/hooks/use-server-validation.mjs +72 -166
  154. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  155. package/dist/client/hooks/use-setup-status.mjs +12 -25
  156. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  157. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  158. package/dist/client/hooks/use-upload.mjs +54 -152
  159. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  160. package/dist/client/hooks/use-view-state.mjs +187 -437
  161. package/dist/client/i18n/hooks.mjs +65 -197
  162. package/dist/client/lib/render-profiler.mjs +14 -41
  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.mjs +86 -321
  174. package/dist/client/scope/provider.mjs +8 -17
  175. package/dist/client/utils/build-field-definitions-from-schema.mjs +4 -2
  176. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  177. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  178. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  179. package/dist/client/views/auth/auth-layout.mjs +104 -284
  180. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  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 +116 -356
  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.d.mts +2 -2
  222. package/dist/client/views/pages/login-page.mjs +41 -121
  223. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  224. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  225. package/dist/client/views/pages/setup-page.d.mts +2 -2
  226. package/dist/client/views/pages/setup-page.mjs +33 -95
  227. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  228. package/dist/server/adapters/index.d.mts +2 -0
  229. package/dist/server/adapters/nextjs.d.mts +1 -0
  230. package/dist/server/auth-helpers.d.mts +1 -0
  231. package/dist/server/modules/admin/.generated/module.d.mts +1 -0
  232. package/dist/server/modules/admin/collections/account.d.mts +46 -46
  233. package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
  234. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  235. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  236. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  237. package/dist/server/modules/admin/collections/assets.d.mts +39 -39
  238. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  239. package/dist/server/modules/admin/collections/user.d.mts +62 -62
  240. package/dist/server/modules/admin/collections/verification.d.mts +23 -23
  241. package/dist/server/modules/admin/index.d.mts +20 -19
  242. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  243. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  244. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  245. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  246. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  247. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  248. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  249. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  250. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +45 -45
  251. package/dist/server/modules/audit/.generated/module.d.mts +6 -6
  252. package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
  253. package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
  254. package/dist/server.d.mts +2 -0
  255. package/package.json +3 -5
@@ -2,65 +2,36 @@ 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 { TextInput } from "../primitives/text-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/email-field.tsx
10
- function EmailField(t0) {
11
- const $ = c(14);
12
- const { name, label, description, placeholder, required, disabled, localized, locale, control, className } = t0;
13
- const resolvedControl = useResolvedControl(control);
14
- let t1;
15
- if ($[0] !== className || $[1] !== description || $[2] !== disabled || $[3] !== label || $[4] !== locale || $[5] !== localized || $[6] !== name || $[7] !== placeholder || $[8] !== required) {
16
- t1 = (t2$1) => {
17
- const { field, fieldState } = t2$1;
18
- return /* @__PURE__ */ jsx(FieldWrapper, {
19
- name,
20
- label,
21
- description,
22
- required,
23
- disabled,
24
- localized,
25
- locale,
26
- error: fieldState.error?.message,
27
- children: /* @__PURE__ */ jsx(TextInput, {
28
- id: name,
29
- value: field.value ?? "",
30
- onChange: field.onChange,
31
- type: "email",
32
- placeholder,
33
- disabled,
34
- autoComplete: "email",
35
- "aria-invalid": !!fieldState.error,
36
- className: cn("qa-email-field", className)
37
- })
38
- });
39
- };
40
- $[0] = className;
41
- $[1] = description;
42
- $[2] = disabled;
43
- $[3] = label;
44
- $[4] = locale;
45
- $[5] = localized;
46
- $[6] = name;
47
- $[7] = placeholder;
48
- $[8] = required;
49
- $[9] = t1;
50
- } else t1 = $[9];
51
- let t2;
52
- if ($[10] !== name || $[11] !== resolvedControl || $[12] !== t1) {
53
- t2 = /* @__PURE__ */ jsx(Controller, {
9
+ function EmailField({ name, label, description, placeholder, required, disabled, localized, locale, control, className }) {
10
+ return /* @__PURE__ */ jsx(Controller, {
11
+ name,
12
+ control: useResolvedControl(control),
13
+ render: ({ field, fieldState }) => /* @__PURE__ */ jsx(FieldWrapper, {
54
14
  name,
55
- control: resolvedControl,
56
- render: t1
57
- });
58
- $[10] = name;
59
- $[11] = resolvedControl;
60
- $[12] = t1;
61
- $[13] = t2;
62
- } else t2 = $[13];
63
- return t2;
15
+ label,
16
+ description,
17
+ required,
18
+ disabled,
19
+ localized,
20
+ locale,
21
+ error: fieldState.error?.message,
22
+ children: /* @__PURE__ */ jsx(TextInput, {
23
+ id: name,
24
+ value: field.value ?? "",
25
+ onChange: field.onChange,
26
+ type: "email",
27
+ placeholder,
28
+ disabled,
29
+ autoComplete: "email",
30
+ "aria-invalid": !!fieldState.error,
31
+ className: cn("qa-email-field", className)
32
+ })
33
+ })
34
+ });
64
35
  }
65
36
 
66
37
  //#endregion
@@ -3,121 +3,46 @@ import { useSafeContentLocales } from "../../runtime/content-locales-provider.mj
3
3
  import { useScopedLocale } from "../../runtime/locale-scope.mjs";
4
4
  import { LocaleSwitcher } from "../locale-switcher.mjs";
5
5
  import { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from "../ui/field.mjs";
6
- import { c } from "react/compiler-runtime";
7
6
  import { jsx, jsxs } from "react/jsx-runtime";
8
7
 
9
8
  //#region src/client/components/fields/field-wrapper.tsx
10
- function FieldWrapper(t0) {
11
- const $ = c(33);
12
- const { name, label, description, required, disabled, readOnly, error, localized, locale, children, fieldPath } = t0;
9
+ function FieldWrapper({ name, label, description, required, disabled, readOnly, error, localized, locale, children, fieldPath }) {
13
10
  const resolveText = useResolveText();
14
11
  const { locale: scopedLocale } = useScopedLocale();
15
12
  const contentLocales = useSafeContentLocales();
16
13
  const resolvedLocale = locale ?? scopedLocale;
17
- let t1;
18
- if ($[0] !== contentLocales || $[1] !== resolvedLocale) {
19
- t1 = contentLocales?.locales?.length ? contentLocales.locales : resolvedLocale ? [{ code: resolvedLocale }] : [];
20
- $[0] = contentLocales;
21
- $[1] = resolvedLocale;
22
- $[2] = t1;
23
- } else t1 = $[2];
24
- const localeOptions = t1;
25
- let t2;
26
- if ($[3] !== label || $[4] !== resolveText) {
27
- t2 = label ? resolveText(label) : void 0;
28
- $[3] = label;
29
- $[4] = resolveText;
30
- $[5] = t2;
31
- } else t2 = $[5];
32
- const resolvedLabel = t2;
33
- let t3;
34
- if ($[6] !== description || $[7] !== resolveText) {
35
- t3 = description ? resolveText(description) : void 0;
36
- $[6] = description;
37
- $[7] = resolveText;
38
- $[8] = t3;
39
- } else t3 = $[8];
40
- const resolvedDescription = t3;
41
- const t4 = !disabled && readOnly;
42
- const t5 = !!error;
43
- const t6 = fieldPath ?? name;
44
- let t7;
45
- if ($[9] !== localeOptions || $[10] !== localized || $[11] !== name || $[12] !== required || $[13] !== resolvedLabel || $[14] !== resolvedLocale) {
46
- t7 = resolvedLabel && /* @__PURE__ */ jsxs(FieldLabel, {
47
- htmlFor: name,
48
- className: "flex items-center gap-2",
49
- children: [/* @__PURE__ */ jsxs("span", {
50
- className: "flex items-center gap-1",
51
- children: [resolvedLabel, required && /* @__PURE__ */ jsx("span", {
52
- className: "text-destructive",
53
- children: "*"
54
- })]
55
- }), localized && /* @__PURE__ */ jsx(LocaleSwitcher, {
56
- locales: localeOptions,
57
- value: resolvedLocale,
58
- showFlag: false
59
- })]
60
- });
61
- $[9] = localeOptions;
62
- $[10] = localized;
63
- $[11] = name;
64
- $[12] = required;
65
- $[13] = resolvedLabel;
66
- $[14] = resolvedLocale;
67
- $[15] = t7;
68
- } else t7 = $[15];
69
- let t8;
70
- if ($[16] !== children) {
71
- t8 = /* @__PURE__ */ jsx(FieldContent, { children });
72
- $[16] = children;
73
- $[17] = t8;
74
- } else t8 = $[17];
75
- let t9;
76
- if ($[18] !== resolvedDescription) {
77
- t9 = resolvedDescription && /* @__PURE__ */ jsx(FieldDescription, { children: resolvedDescription });
78
- $[18] = resolvedDescription;
79
- $[19] = t9;
80
- } else t9 = $[19];
81
- let t10;
82
- if ($[20] !== error) {
83
- t10 = error && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: error }] });
84
- $[20] = error;
85
- $[21] = t10;
86
- } else t10 = $[21];
87
- let t11;
88
- if ($[22] !== t10 || $[23] !== t7 || $[24] !== t8 || $[25] !== t9) {
89
- t11 = /* @__PURE__ */ jsxs("div", {
14
+ const localeOptions = contentLocales?.locales?.length ? contentLocales.locales : resolvedLocale ? [{ code: resolvedLocale }] : [];
15
+ const resolvedLabel = label ? resolveText(label) : void 0;
16
+ const resolvedDescription = description ? resolveText(description) : void 0;
17
+ return /* @__PURE__ */ jsx(Field, {
18
+ "data-disabled": disabled,
19
+ "data-readonly": !disabled && readOnly,
20
+ "data-invalid": !!error,
21
+ "data-field-path": fieldPath ?? name,
22
+ children: /* @__PURE__ */ jsxs("div", {
90
23
  className: "qa-field-wrapper space-y-2",
91
24
  children: [
92
- t7,
93
- t8,
94
- t9,
95
- t10
25
+ resolvedLabel && /* @__PURE__ */ jsxs(FieldLabel, {
26
+ htmlFor: name,
27
+ className: "flex items-center gap-2",
28
+ children: [/* @__PURE__ */ jsxs("span", {
29
+ className: "flex items-center gap-1",
30
+ children: [resolvedLabel, required && /* @__PURE__ */ jsx("span", {
31
+ className: "text-destructive",
32
+ children: "*"
33
+ })]
34
+ }), localized && /* @__PURE__ */ jsx(LocaleSwitcher, {
35
+ locales: localeOptions,
36
+ value: resolvedLocale,
37
+ showFlag: false
38
+ })]
39
+ }),
40
+ /* @__PURE__ */ jsx(FieldContent, { children }),
41
+ resolvedDescription && /* @__PURE__ */ jsx(FieldDescription, { children: resolvedDescription }),
42
+ error && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: error }] })
96
43
  ]
97
- });
98
- $[22] = t10;
99
- $[23] = t7;
100
- $[24] = t8;
101
- $[25] = t9;
102
- $[26] = t11;
103
- } else t11 = $[26];
104
- let t12;
105
- if ($[27] !== disabled || $[28] !== t11 || $[29] !== t4 || $[30] !== t5 || $[31] !== t6) {
106
- t12 = /* @__PURE__ */ jsx(Field, {
107
- "data-disabled": disabled,
108
- "data-readonly": t4,
109
- "data-invalid": t5,
110
- "data-field-path": t6,
111
- children: t11
112
- });
113
- $[27] = disabled;
114
- $[28] = t11;
115
- $[29] = t4;
116
- $[30] = t5;
117
- $[31] = t6;
118
- $[32] = t12;
119
- } else t12 = $[32];
120
- return t12;
44
+ })
45
+ });
121
46
  }
122
47
 
123
48
  //#endregion
@@ -3,7 +3,6 @@ import { cn } from "../../lib/utils.mjs";
3
3
  import { Button } from "../ui/button.mjs";
4
4
  import { Textarea } from "../ui/textarea.mjs";
5
5
  import { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from "../ui/field.mjs";
6
- import { c } from "react/compiler-runtime";
7
6
  import { Icon } from "@iconify/react";
8
7
  import * as React from "react";
9
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -41,32 +40,11 @@ import { Controller, useFormContext } from "react-hook-form";
41
40
  * />
42
41
  * ```
43
42
  */
44
- function JsonField(t0) {
45
- const $ = c(31);
46
- const { name, label, description, required, disabled, readOnly, placeholder: t1, defaultMode: t2, allowModeSwitch: t3, minHeight: t4, maxHeight: t5, renderForm, control: controlProp, className } = t0;
47
- const placeholder = t1 === void 0 ? "{\n \"key\": \"value\"\n}" : t1;
48
- const defaultMode = t2 === void 0 ? "code" : t2;
49
- const allowModeSwitch = t3 === void 0 ? true : t3;
50
- const minHeight = t4 === void 0 ? 200 : t4;
51
- const maxHeight = t5 === void 0 ? 400 : t5;
43
+ function JsonField({ name, label, description, required, disabled, readOnly, placeholder = "{\n \"key\": \"value\"\n}", defaultMode = "code", allowModeSwitch = true, minHeight = 200, maxHeight = 400, renderForm, control: controlProp, className }) {
52
44
  const { t } = useTranslation();
53
45
  const resolveText = useResolveText();
54
- let t6;
55
- if ($[0] !== label || $[1] !== resolveText) {
56
- t6 = label ? resolveText(label) : void 0;
57
- $[0] = label;
58
- $[1] = resolveText;
59
- $[2] = t6;
60
- } else t6 = $[2];
61
- const resolvedLabel = t6;
62
- let t7;
63
- if ($[3] !== description || $[4] !== resolveText) {
64
- t7 = description ? resolveText(description) : void 0;
65
- $[3] = description;
66
- $[4] = resolveText;
67
- $[5] = t7;
68
- } else t7 = $[5];
69
- const resolvedDescription = t7;
46
+ const resolvedLabel = label ? resolveText(label) : void 0;
47
+ const resolvedDescription = description ? resolveText(description) : void 0;
70
48
  const formContext = useFormContext();
71
49
  const control = controlProp ?? formContext?.control;
72
50
  const [mode, setMode] = React.useState(defaultMode);
@@ -75,36 +53,23 @@ function JsonField(t0) {
75
53
  return null;
76
54
  }
77
55
  const showModeSwitch = allowModeSwitch && renderForm;
78
- const t8 = required ? `${resolvedLabel || name} is required` : void 0;
79
- let t9;
80
- if ($[6] !== mode) {
81
- t9 = (value) => {
82
- if (!value) return true;
83
- if (mode === "code" && typeof value === "string") try {
84
- JSON.parse(value);
56
+ return /* @__PURE__ */ jsx(Controller, {
57
+ name,
58
+ control,
59
+ rules: {
60
+ required: required ? `${resolvedLabel || name} is required` : void 0,
61
+ validate: (value) => {
62
+ if (!value) return true;
63
+ if (mode === "code" && typeof value === "string") try {
64
+ JSON.parse(value);
65
+ return true;
66
+ } catch {
67
+ return "Invalid JSON format";
68
+ }
85
69
  return true;
86
- } catch {
87
- return "Invalid JSON format";
88
70
  }
89
- return true;
90
- };
91
- $[6] = mode;
92
- $[7] = t9;
93
- } else t9 = $[7];
94
- let t10;
95
- if ($[8] !== t8 || $[9] !== t9) {
96
- t10 = {
97
- required: t8,
98
- validate: t9
99
- };
100
- $[8] = t8;
101
- $[9] = t9;
102
- $[10] = t10;
103
- } else t10 = $[10];
104
- let t11;
105
- if ($[11] !== className || $[12] !== disabled || $[13] !== maxHeight || $[14] !== minHeight || $[15] !== mode || $[16] !== name || $[17] !== placeholder || $[18] !== readOnly || $[19] !== renderForm || $[20] !== required || $[21] !== resolvedDescription || $[22] !== resolvedLabel || $[23] !== showModeSwitch || $[24] !== t) {
106
- t11 = (t12$1) => {
107
- const { field, fieldState } = t12$1;
71
+ },
72
+ render: ({ field, fieldState }) => {
108
73
  const error = fieldState.error?.message;
109
74
  return /* @__PURE__ */ jsxs(Field, {
110
75
  "data-invalid": !!error,
@@ -167,38 +132,8 @@ function JsonField(t0) {
167
132
  /* @__PURE__ */ jsx(FieldError, { children: error })
168
133
  ] })]
169
134
  });
170
- };
171
- $[11] = className;
172
- $[12] = disabled;
173
- $[13] = maxHeight;
174
- $[14] = minHeight;
175
- $[15] = mode;
176
- $[16] = name;
177
- $[17] = placeholder;
178
- $[18] = readOnly;
179
- $[19] = renderForm;
180
- $[20] = required;
181
- $[21] = resolvedDescription;
182
- $[22] = resolvedLabel;
183
- $[23] = showModeSwitch;
184
- $[24] = t;
185
- $[25] = t11;
186
- } else t11 = $[25];
187
- let t12;
188
- if ($[26] !== control || $[27] !== name || $[28] !== t10 || $[29] !== t11) {
189
- t12 = /* @__PURE__ */ jsx(Controller, {
190
- name,
191
- control,
192
- rules: t10,
193
- render: t11
194
- });
195
- $[26] = control;
196
- $[27] = name;
197
- $[28] = t10;
198
- $[29] = t11;
199
- $[30] = t12;
200
- } else t12 = $[30];
201
- return t12;
135
+ }
136
+ });
202
137
  }
203
138
  /**
204
139
  * Code editor for JSON (using Textarea for simplicity)
@@ -213,150 +148,72 @@ function formatJsonEditorValue(value) {
213
148
  return "";
214
149
  }
215
150
  }
216
- function JsonCodeEditor(t0) {
217
- const $ = c(40);
218
- const { value, onChange, disabled, readOnly, placeholder, minHeight, maxHeight, error } = t0;
219
- let t1;
220
- if ($[0] !== value) {
221
- t1 = formatJsonEditorValue(value);
222
- $[0] = value;
223
- $[1] = t1;
224
- } else t1 = $[1];
225
- const externalValue = t1;
151
+ function JsonCodeEditor({ value, onChange, disabled, readOnly, placeholder, minHeight, maxHeight, error }) {
152
+ const externalValue = React.useMemo(() => formatJsonEditorValue(value), [value]);
226
153
  const [localValue, setLocalValue] = React.useState(externalValue);
227
154
  const [parseError, setParseError] = React.useState(null);
228
155
  const [isEditing, setIsEditing] = React.useState(false);
229
156
  const displayedValue = isEditing ? localValue : externalValue;
230
- let t2;
231
- if ($[2] !== onChange) {
232
- t2 = (e) => {
233
- const newValue = e.target.value;
234
- setIsEditing(true);
235
- setLocalValue(newValue);
236
- if (!newValue.trim()) {
237
- setParseError(null);
238
- onChange(null);
239
- return;
240
- }
241
- try {
242
- const parsed = JSON.parse(newValue);
243
- setParseError(null);
244
- onChange(parsed);
245
- } catch (t3$1) {
246
- setParseError("Invalid JSON");
247
- onChange(newValue);
248
- }
249
- };
250
- $[2] = onChange;
251
- $[3] = t2;
252
- } else t2 = $[3];
253
- const handleChange = t2;
254
- let t3;
255
- if ($[4] !== displayedValue || $[5] !== onChange) {
256
- t3 = () => {
257
- try {
258
- const parsed_0 = JSON.parse(displayedValue);
259
- const formatted = JSON.stringify(parsed_0, null, 2);
260
- setIsEditing(true);
261
- setLocalValue(formatted);
262
- setParseError(null);
263
- onChange(parsed_0);
264
- } catch {}
265
- };
266
- $[4] = displayedValue;
267
- $[5] = onChange;
268
- $[6] = t3;
269
- } else t3 = $[6];
270
- const handleFormat = t3;
271
- let t4;
272
- if ($[7] !== externalValue) {
273
- t4 = () => {
274
- setLocalValue(externalValue);
157
+ const handleChange = (e) => {
158
+ const newValue = e.target.value;
159
+ setIsEditing(true);
160
+ setLocalValue(newValue);
161
+ if (!newValue.trim()) {
162
+ setParseError(null);
163
+ onChange(null);
164
+ return;
165
+ }
166
+ try {
167
+ const parsed = JSON.parse(newValue);
168
+ setParseError(null);
169
+ onChange(parsed);
170
+ } catch (err) {
171
+ setParseError("Invalid JSON");
172
+ onChange(newValue);
173
+ }
174
+ };
175
+ const handleFormat = () => {
176
+ try {
177
+ const parsed = JSON.parse(displayedValue);
178
+ const formatted = JSON.stringify(parsed, null, 2);
275
179
  setIsEditing(true);
276
- };
277
- $[7] = externalValue;
278
- $[8] = t4;
279
- } else t4 = $[8];
280
- let t5;
281
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
282
- t5 = () => {
283
- setIsEditing(false);
284
- };
285
- $[9] = t5;
286
- } else t5 = $[9];
287
- const t6 = error || parseError ? "border-destructive" : "";
288
- let t7;
289
- if ($[10] !== t6) {
290
- t7 = cn("font-mono text-xs", t6);
291
- $[10] = t6;
292
- $[11] = t7;
293
- } else t7 = $[11];
294
- const t8 = `${minHeight}px`;
295
- const t9 = maxHeight ? `${maxHeight}px` : void 0;
296
- const t10 = maxHeight ? "none" : "vertical";
297
- let t11;
298
- if ($[12] !== t10 || $[13] !== t8 || $[14] !== t9) {
299
- t11 = {
300
- minHeight: t8,
301
- maxHeight: t9,
302
- resize: t10
303
- };
304
- $[12] = t10;
305
- $[13] = t8;
306
- $[14] = t9;
307
- $[15] = t11;
308
- } else t11 = $[15];
309
- const t12 = !!error || !!parseError;
310
- let t13;
311
- if ($[16] !== disabled || $[17] !== displayedValue || $[18] !== handleChange || $[19] !== placeholder || $[20] !== readOnly || $[21] !== t11 || $[22] !== t12 || $[23] !== t4 || $[24] !== t7) {
312
- t13 = /* @__PURE__ */ jsx(Textarea, {
313
- value: displayedValue,
314
- onChange: handleChange,
315
- onFocus: t4,
316
- onBlur: t5,
317
- disabled,
318
- readOnly,
319
- placeholder,
320
- className: t7,
321
- style: t11,
322
- "aria-invalid": t12
323
- });
324
- $[16] = disabled;
325
- $[17] = displayedValue;
326
- $[18] = handleChange;
327
- $[19] = placeholder;
328
- $[20] = readOnly;
329
- $[21] = t11;
330
- $[22] = t12;
331
- $[23] = t4;
332
- $[24] = t7;
333
- $[25] = t13;
334
- } else t13 = $[25];
335
- let t14;
336
- if ($[26] !== parseError) {
337
- t14 = parseError && /* @__PURE__ */ jsxs("div", {
338
- className: "text-destructive bg-background/80 absolute top-2 right-2 flex items-center gap-1 px-1 text-xs text-pretty backdrop-blur-sm",
339
- children: [/* @__PURE__ */ jsx(Icon, {
340
- icon: "ph:warning-circle-fill",
341
- className: "size-3"
342
- }), parseError]
343
- });
344
- $[26] = parseError;
345
- $[27] = t14;
346
- } else t14 = $[27];
347
- let t15;
348
- if ($[28] !== t13 || $[29] !== t14) {
349
- t15 = /* @__PURE__ */ jsxs("div", {
180
+ setLocalValue(formatted);
181
+ setParseError(null);
182
+ onChange(parsed);
183
+ } catch {}
184
+ };
185
+ return /* @__PURE__ */ jsxs("div", {
186
+ className: "space-y-2",
187
+ children: [/* @__PURE__ */ jsxs("div", {
350
188
  className: "relative",
351
- children: [t13, t14]
352
- });
353
- $[28] = t13;
354
- $[29] = t14;
355
- $[30] = t15;
356
- } else t15 = $[30];
357
- let t16;
358
- if ($[31] !== disabled || $[32] !== displayedValue || $[33] !== handleFormat || $[34] !== parseError || $[35] !== readOnly) {
359
- t16 = !readOnly && !disabled && displayedValue && /* @__PURE__ */ jsx("div", {
189
+ children: [/* @__PURE__ */ jsx(Textarea, {
190
+ value: displayedValue,
191
+ onChange: handleChange,
192
+ onFocus: () => {
193
+ setLocalValue(externalValue);
194
+ setIsEditing(true);
195
+ },
196
+ onBlur: () => {
197
+ setIsEditing(false);
198
+ },
199
+ disabled,
200
+ readOnly,
201
+ placeholder,
202
+ className: cn("font-mono text-xs", error || parseError ? "border-destructive" : ""),
203
+ style: {
204
+ minHeight: `${minHeight}px`,
205
+ maxHeight: maxHeight ? `${maxHeight}px` : void 0,
206
+ resize: maxHeight ? "none" : "vertical"
207
+ },
208
+ "aria-invalid": !!error || !!parseError
209
+ }), parseError && /* @__PURE__ */ jsxs("div", {
210
+ className: "text-destructive bg-background/80 absolute top-2 right-2 flex items-center gap-1 px-1 text-xs text-pretty backdrop-blur-sm",
211
+ children: [/* @__PURE__ */ jsx(Icon, {
212
+ icon: "ph:warning-circle-fill",
213
+ className: "size-3"
214
+ }), parseError]
215
+ })]
216
+ }), !readOnly && !disabled && displayedValue && /* @__PURE__ */ jsx("div", {
360
217
  className: "flex justify-end",
361
218
  children: /* @__PURE__ */ jsx(Button, {
362
219
  type: "button",
@@ -366,91 +223,32 @@ function JsonCodeEditor(t0) {
366
223
  disabled: !!parseError,
367
224
  children: "Format JSON"
368
225
  })
369
- });
370
- $[31] = disabled;
371
- $[32] = displayedValue;
372
- $[33] = handleFormat;
373
- $[34] = parseError;
374
- $[35] = readOnly;
375
- $[36] = t16;
376
- } else t16 = $[36];
377
- let t17;
378
- if ($[37] !== t15 || $[38] !== t16) {
379
- t17 = /* @__PURE__ */ jsxs("div", {
380
- className: "space-y-2",
381
- children: [t15, t16]
382
- });
383
- $[37] = t15;
384
- $[38] = t16;
385
- $[39] = t17;
386
- } else t17 = $[39];
387
- return t17;
226
+ })]
227
+ });
388
228
  }
389
229
  /**
390
230
  * Form-based editor wrapper
391
231
  */
392
- function JsonFormEditor(t0) {
393
- const $ = c(12);
394
- const { value, onChange, disabled, readOnly, renderForm } = t0;
395
- let t1;
396
- bb0: {
397
- if (typeof value === "object" && value !== null) {
398
- t1 = value;
399
- break bb0;
400
- }
232
+ function JsonFormEditor({ value, onChange, disabled, readOnly, renderForm }) {
233
+ const safeValue = React.useMemo(() => {
234
+ if (typeof value === "object" && value !== null) return value;
401
235
  if (typeof value === "string") try {
402
- let t2$2;
403
- if ($[0] !== value) {
404
- t2$2 = JSON.parse(value);
405
- $[0] = value;
406
- $[1] = t2$2;
407
- } else t2$2 = $[1];
408
- t1 = t2$2;
409
- break bb0;
236
+ return JSON.parse(value);
410
237
  } catch {
411
- let t2$2;
412
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
413
- t2$2 = {};
414
- $[2] = t2$2;
415
- } else t2$2 = $[2];
416
- t1 = t2$2;
417
- break bb0;
238
+ return {};
418
239
  }
419
- let t2$1;
420
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
421
- t2$1 = {};
422
- $[3] = t2$1;
423
- } else t2$1 = $[3];
424
- t1 = t2$1;
425
- }
426
- const safeValue = t1;
240
+ return {};
241
+ }, [value]);
427
242
  if (!renderForm) return null;
428
- let t2;
429
- if ($[4] !== disabled || $[5] !== onChange || $[6] !== readOnly || $[7] !== renderForm || $[8] !== safeValue) {
430
- t2 = renderForm({
243
+ return /* @__PURE__ */ jsx("div", {
244
+ className: "panel-surface p-4",
245
+ children: renderForm({
431
246
  value: safeValue,
432
247
  onChange,
433
248
  disabled,
434
249
  readOnly
435
- });
436
- $[4] = disabled;
437
- $[5] = onChange;
438
- $[6] = readOnly;
439
- $[7] = renderForm;
440
- $[8] = safeValue;
441
- $[9] = t2;
442
- } else t2 = $[9];
443
- const formContent = t2;
444
- let t3;
445
- if ($[10] !== formContent) {
446
- t3 = /* @__PURE__ */ jsx("div", {
447
- className: "panel-surface p-4",
448
- children: formContent
449
- });
450
- $[10] = formContent;
451
- $[11] = t3;
452
- } else t3 = $[11];
453
- return t3;
250
+ })
251
+ });
454
252
  }
455
253
 
456
254
  //#endregion