@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
@@ -3,7 +3,6 @@
3
3
  import { useResolveText, useTranslation } from "../../i18n/hooks.mjs";
4
4
  import { Button } from "../ui/button.mjs";
5
5
  import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../ui/dialog.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";
@@ -32,169 +31,55 @@ import { jsx, jsxs } from "react/jsx-runtime";
32
31
  * />
33
32
  * ```
34
33
  */
35
- function ConfirmationDialog(t0) {
36
- const $ = c(49);
37
- const { open, onOpenChange, config, onConfirm, loading: t1 } = t0;
38
- const loading = t1 === void 0 ? false : t1;
34
+ function ConfirmationDialog({ open, onOpenChange, config, onConfirm, loading = false }) {
39
35
  const { t } = useTranslation();
40
36
  const resolveText = useResolveText();
41
37
  const [isProcessing, setIsProcessing] = React.useState(false);
42
- let t2;
43
- if ($[0] !== onConfirm || $[1] !== onOpenChange) {
44
- t2 = async () => {
45
- setIsProcessing(true);
46
- try {
47
- await onConfirm();
48
- onOpenChange(false);
49
- setIsProcessing(false);
50
- } catch (t3$1) {
51
- const _err = t3$1;
52
- setIsProcessing(false);
53
- throw _err;
54
- }
55
- };
56
- $[0] = onConfirm;
57
- $[1] = onOpenChange;
58
- $[2] = t2;
59
- } else t2 = $[2];
60
- const handleConfirm = t2;
38
+ const handleConfirm = async () => {
39
+ setIsProcessing(true);
40
+ try {
41
+ await onConfirm();
42
+ onOpenChange(false);
43
+ setIsProcessing(false);
44
+ } catch (_err) {
45
+ setIsProcessing(false);
46
+ throw _err;
47
+ }
48
+ };
61
49
  const isLoading = loading || isProcessing;
62
- let t3;
63
- if ($[3] !== config.destructive) {
64
- t3 = config.destructive && /* @__PURE__ */ jsx("div", {
65
- className: "border-border-subtle bg-surface-low text-foreground-subtle flex size-10 shrink-0 items-center justify-center rounded-full border",
66
- children: /* @__PURE__ */ jsx(Icon, {
67
- icon: "ph:warning",
68
- className: "size-5"
69
- })
70
- });
71
- $[3] = config.destructive;
72
- $[4] = t3;
73
- } else t3 = $[4];
74
- let t4;
75
- if ($[5] !== config.title || $[6] !== resolveText) {
76
- t4 = resolveText(config.title);
77
- $[5] = config.title;
78
- $[6] = resolveText;
79
- $[7] = t4;
80
- } else t4 = $[7];
81
- let t5;
82
- if ($[8] !== t4) {
83
- t5 = /* @__PURE__ */ jsx(DialogTitle, { children: t4 });
84
- $[8] = t4;
85
- $[9] = t5;
86
- } else t5 = $[9];
87
- let t6;
88
- if ($[10] !== config.description || $[11] !== resolveText) {
89
- t6 = config.description && /* @__PURE__ */ jsx(DialogDescription, { children: resolveText(config.description) });
90
- $[10] = config.description;
91
- $[11] = resolveText;
92
- $[12] = t6;
93
- } else t6 = $[12];
94
- let t7;
95
- if ($[13] !== t5 || $[14] !== t6) {
96
- t7 = /* @__PURE__ */ jsxs("div", {
97
- className: "space-y-1",
98
- children: [t5, t6]
99
- });
100
- $[13] = t5;
101
- $[14] = t6;
102
- $[15] = t7;
103
- } else t7 = $[15];
104
- let t8;
105
- if ($[16] !== t3 || $[17] !== t7) {
106
- t8 = /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs("div", {
107
- className: "flex items-start gap-3",
108
- children: [t3, t7]
109
- }) });
110
- $[16] = t3;
111
- $[17] = t7;
112
- $[18] = t8;
113
- } else t8 = $[18];
114
- let t9;
115
- if ($[19] !== onOpenChange) {
116
- t9 = () => onOpenChange(false);
117
- $[19] = onOpenChange;
118
- $[20] = t9;
119
- } else t9 = $[20];
120
- let t10;
121
- if ($[21] !== config.cancelLabel || $[22] !== resolveText || $[23] !== t) {
122
- t10 = resolveText(config.cancelLabel) || t("common.cancel");
123
- $[21] = config.cancelLabel;
124
- $[22] = resolveText;
125
- $[23] = t;
126
- $[24] = t10;
127
- } else t10 = $[24];
128
- let t11;
129
- if ($[25] !== isLoading || $[26] !== t10 || $[27] !== t9) {
130
- t11 = /* @__PURE__ */ jsx(Button, {
131
- variant: "outline",
132
- onClick: t9,
133
- disabled: isLoading,
134
- children: t10
135
- });
136
- $[25] = isLoading;
137
- $[26] = t10;
138
- $[27] = t9;
139
- $[28] = t11;
140
- } else t11 = $[28];
141
- const t12 = config.destructive ? "destructive" : "default";
142
- let t13;
143
- if ($[29] !== config.confirmLabel || $[30] !== isLoading || $[31] !== resolveText || $[32] !== t) {
144
- t13 = isLoading ? t("ui.processing") : resolveText(config.confirmLabel) || t("common.confirm");
145
- $[29] = config.confirmLabel;
146
- $[30] = isLoading;
147
- $[31] = resolveText;
148
- $[32] = t;
149
- $[33] = t13;
150
- } else t13 = $[33];
151
- let t14;
152
- if ($[34] !== handleConfirm || $[35] !== isLoading || $[36] !== t12 || $[37] !== t13) {
153
- t14 = /* @__PURE__ */ jsx(Button, {
154
- variant: t12,
155
- onClick: handleConfirm,
156
- disabled: isLoading,
157
- children: t13
158
- });
159
- $[34] = handleConfirm;
160
- $[35] = isLoading;
161
- $[36] = t12;
162
- $[37] = t13;
163
- $[38] = t14;
164
- } else t14 = $[38];
165
- let t15;
166
- if ($[39] !== t11 || $[40] !== t14) {
167
- t15 = /* @__PURE__ */ jsxs(DialogFooter, {
168
- className: "mt-4",
169
- children: [t11, t14]
170
- });
171
- $[39] = t11;
172
- $[40] = t14;
173
- $[41] = t15;
174
- } else t15 = $[41];
175
- let t16;
176
- if ($[42] !== t15 || $[43] !== t8) {
177
- t16 = /* @__PURE__ */ jsxs(DialogContent, {
50
+ return /* @__PURE__ */ jsx(Dialog, {
51
+ open,
52
+ onOpenChange,
53
+ children: /* @__PURE__ */ jsxs(DialogContent, {
178
54
  className: "qa-confirmation-dialog sm:max-w-[425px]",
179
- children: [t8, t15]
180
- });
181
- $[42] = t15;
182
- $[43] = t8;
183
- $[44] = t16;
184
- } else t16 = $[44];
185
- let t17;
186
- if ($[45] !== onOpenChange || $[46] !== open || $[47] !== t16) {
187
- t17 = /* @__PURE__ */ jsx(Dialog, {
188
- open,
189
- onOpenChange,
190
- children: t16
191
- });
192
- $[45] = onOpenChange;
193
- $[46] = open;
194
- $[47] = t16;
195
- $[48] = t17;
196
- } else t17 = $[48];
197
- return t17;
55
+ children: [/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs("div", {
56
+ className: "flex items-start gap-3",
57
+ children: [config.destructive && /* @__PURE__ */ jsx("div", {
58
+ className: "border-border-subtle bg-surface-low text-foreground-subtle flex size-10 shrink-0 items-center justify-center rounded-full border",
59
+ children: /* @__PURE__ */ jsx(Icon, {
60
+ icon: "ph:warning",
61
+ className: "size-5"
62
+ })
63
+ }), /* @__PURE__ */ jsxs("div", {
64
+ className: "space-y-1",
65
+ children: [/* @__PURE__ */ jsx(DialogTitle, { children: resolveText(config.title) }), config.description && /* @__PURE__ */ jsx(DialogDescription, { children: resolveText(config.description) })]
66
+ })]
67
+ }) }), /* @__PURE__ */ jsxs(DialogFooter, {
68
+ className: "mt-4",
69
+ children: [/* @__PURE__ */ jsx(Button, {
70
+ variant: "outline",
71
+ onClick: () => onOpenChange(false),
72
+ disabled: isLoading,
73
+ children: resolveText(config.cancelLabel) || t("common.cancel")
74
+ }), /* @__PURE__ */ jsx(Button, {
75
+ variant: config.destructive ? "destructive" : "default",
76
+ onClick: handleConfirm,
77
+ disabled: isLoading,
78
+ children: isLoading ? t("ui.processing") : resolveText(config.confirmLabel) || t("common.confirm")
79
+ })]
80
+ })]
81
+ })
82
+ });
198
83
  }
199
84
 
200
85
  //#endregion
@@ -4,9 +4,8 @@ import { selectAuthClient, useAdminStore } from "../../runtime/provider.mjs";
4
4
  import { Button } from "../ui/button.mjs";
5
5
  import { DropdownMenu, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuTrigger } from "../ui/dropdown-menu.mjs";
6
6
  import { ActionButton } from "./action-button.mjs";
7
- import { c } from "react/compiler-runtime";
8
7
  import { Icon } from "@iconify/react";
9
- import "react";
8
+ import * as React from "react";
10
9
  import { useQueryClient } from "@tanstack/react-query";
11
10
  import { jsx, jsxs } from "react/jsx-runtime";
12
11
 
@@ -36,173 +35,82 @@ import { jsx, jsxs } from "react/jsx-runtime";
36
35
  * />
37
36
  * ```
38
37
  */
39
- function HeaderActions(t0) {
40
- const $ = c(37);
41
- const { actions, collection, helpers, onOpenDialog } = t0;
38
+ function HeaderActions({ actions, collection, helpers, onOpenDialog }) {
42
39
  const authClient = useAdminStore(selectAuthClient);
43
40
  const queryClient = useQueryClient();
44
- let t1;
45
- if ($[0] !== queryClient) {
46
- t1 = {
47
- invalidateQueries: (filters) => queryClient.invalidateQueries(filters),
48
- refetchQueries: (filters_0) => queryClient.refetchQueries(filters_0),
49
- resetQueries: (filters_1) => queryClient.resetQueries(filters_1)
50
- };
51
- $[0] = queryClient;
52
- $[1] = t1;
53
- } else t1 = $[1];
54
- const actionQueryClient = t1;
55
- let t2;
56
- if ($[2] !== actionQueryClient || $[3] !== authClient || $[4] !== collection || $[5] !== helpers) {
57
- t2 = {
41
+ const actionQueryClient = React.useMemo(() => ({
42
+ invalidateQueries: (filters) => queryClient.invalidateQueries(filters),
43
+ refetchQueries: (filters) => queryClient.refetchQueries(filters),
44
+ resetQueries: (filters) => queryClient.resetQueries(filters)
45
+ }), [queryClient]);
46
+ const ctx = React.useMemo(() => ({
47
+ collection,
48
+ helpers,
49
+ queryClient: actionQueryClient,
50
+ authClient
51
+ }), [
52
+ collection,
53
+ helpers,
54
+ actionQueryClient,
55
+ authClient
56
+ ]);
57
+ const filterVisible = React.useCallback((actionList) => {
58
+ if (!actionList) return [];
59
+ return actionList.filter((action) => {
60
+ if (action.visible === void 0) return true;
61
+ if (typeof action.visible === "function") return action.visible(ctx);
62
+ return action.visible;
63
+ });
64
+ }, [ctx]);
65
+ const visiblePrimary = React.useMemo(() => filterVisible(actions.primary), [actions.primary, filterVisible]);
66
+ const visibleSecondary = React.useMemo(() => filterVisible(actions.secondary), [actions.secondary, filterVisible]);
67
+ const regularSecondary = visibleSecondary.filter((a) => a.variant !== "destructive");
68
+ const destructiveSecondary = visibleSecondary.filter((a) => a.variant === "destructive");
69
+ if (visiblePrimary.length === 0 && visibleSecondary.length === 0) return null;
70
+ return /* @__PURE__ */ jsxs("div", {
71
+ className: "qa-header-actions flex items-center gap-1.5",
72
+ children: [visiblePrimary.map((action) => /* @__PURE__ */ jsx(ActionButton, {
73
+ action,
58
74
  collection,
59
75
  helpers,
60
- queryClient: actionQueryClient,
61
- authClient
62
- };
63
- $[2] = actionQueryClient;
64
- $[3] = authClient;
65
- $[4] = collection;
66
- $[5] = helpers;
67
- $[6] = t2;
68
- } else t2 = $[6];
69
- const ctx = t2;
70
- let t3;
71
- if ($[7] !== ctx) {
72
- t3 = (actionList) => {
73
- if (!actionList) return [];
74
- return actionList.filter((action) => {
75
- if (action.visible === void 0) return true;
76
- if (typeof action.visible === "function") return action.visible(ctx);
77
- return action.visible;
78
- });
79
- };
80
- $[7] = ctx;
81
- $[8] = t3;
82
- } else t3 = $[8];
83
- const filterVisible = t3;
84
- let t4;
85
- if ($[9] !== actions.primary || $[10] !== filterVisible) {
86
- t4 = filterVisible(actions.primary);
87
- $[9] = actions.primary;
88
- $[10] = filterVisible;
89
- $[11] = t4;
90
- } else t4 = $[11];
91
- const visiblePrimary = t4;
92
- let t5;
93
- if ($[12] !== actions.secondary || $[13] !== filterVisible) {
94
- t5 = filterVisible(actions.secondary);
95
- $[12] = actions.secondary;
96
- $[13] = filterVisible;
97
- $[14] = t5;
98
- } else t5 = $[14];
99
- const visibleSecondary = t5;
100
- let t6;
101
- let t7;
102
- let t8;
103
- let t9;
104
- if ($[15] !== collection || $[16] !== helpers || $[17] !== onOpenDialog || $[18] !== visiblePrimary || $[19] !== visibleSecondary) {
105
- t9 = Symbol.for("react.early_return_sentinel");
106
- bb0: {
107
- const regularSecondary = visibleSecondary.filter(_temp);
108
- const destructiveSecondary = visibleSecondary.filter(_temp2);
109
- if (visiblePrimary.length === 0 && visibleSecondary.length === 0) {
110
- t9 = null;
111
- break bb0;
112
- }
113
- t6 = "qa-header-actions flex items-center gap-1.5";
114
- if ($[24] !== collection || $[25] !== helpers || $[26] !== onOpenDialog || $[27] !== visiblePrimary) {
115
- let t10$1;
116
- if ($[29] !== collection || $[30] !== helpers || $[31] !== onOpenDialog) {
117
- t10$1 = (action_0) => /* @__PURE__ */ jsx(ActionButton, {
118
- action: action_0,
119
- collection,
120
- helpers,
121
- size: "sm",
122
- onOpenDialog
123
- }, action_0.id);
124
- $[29] = collection;
125
- $[30] = helpers;
126
- $[31] = onOpenDialog;
127
- $[32] = t10$1;
128
- } else t10$1 = $[32];
129
- t7 = visiblePrimary.map(t10$1);
130
- $[24] = collection;
131
- $[25] = helpers;
132
- $[26] = onOpenDialog;
133
- $[27] = visiblePrimary;
134
- $[28] = t7;
135
- } else t7 = $[28];
136
- t8 = visibleSecondary.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
137
- nativeButton: false,
138
- render: /* @__PURE__ */ jsx(Button, {
139
- variant: "outline",
140
- size: "icon-sm"
141
- }),
142
- children: [/* @__PURE__ */ jsx(Icon, {
143
- icon: "ph:dots-three-vertical",
144
- className: "size-3.5"
145
- }), /* @__PURE__ */ jsx("span", {
146
- className: "sr-only",
147
- children: "More actions"
148
- })]
149
- }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
150
- align: "end",
151
- children: [
152
- regularSecondary.map((action_1) => /* @__PURE__ */ jsx(ActionButton, {
153
- action: action_1,
154
- collection,
155
- helpers,
156
- size: "sm",
157
- presentation: "menu",
158
- onOpenDialog
159
- }, action_1.id)),
160
- regularSecondary.length > 0 && destructiveSecondary.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
161
- destructiveSecondary.map((action_2) => /* @__PURE__ */ jsx(ActionButton, {
162
- action: action_2,
163
- collection,
164
- helpers,
165
- size: "sm",
166
- presentation: "menu",
167
- onOpenDialog
168
- }, action_2.id))
169
- ]
170
- })] });
171
- }
172
- $[15] = collection;
173
- $[16] = helpers;
174
- $[17] = onOpenDialog;
175
- $[18] = visiblePrimary;
176
- $[19] = visibleSecondary;
177
- $[20] = t6;
178
- $[21] = t7;
179
- $[22] = t8;
180
- $[23] = t9;
181
- } else {
182
- t6 = $[20];
183
- t7 = $[21];
184
- t8 = $[22];
185
- t9 = $[23];
186
- }
187
- if (t9 !== Symbol.for("react.early_return_sentinel")) return t9;
188
- let t10;
189
- if ($[33] !== t6 || $[34] !== t7 || $[35] !== t8) {
190
- t10 = /* @__PURE__ */ jsxs("div", {
191
- className: t6,
192
- children: [t7, t8]
193
- });
194
- $[33] = t6;
195
- $[34] = t7;
196
- $[35] = t8;
197
- $[36] = t10;
198
- } else t10 = $[36];
199
- return t10;
200
- }
201
- function _temp2(a_0) {
202
- return a_0.variant === "destructive";
203
- }
204
- function _temp(a) {
205
- return a.variant !== "destructive";
76
+ size: "sm",
77
+ onOpenDialog
78
+ }, action.id)), visibleSecondary.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
79
+ nativeButton: false,
80
+ render: /* @__PURE__ */ jsx(Button, {
81
+ variant: "outline",
82
+ size: "icon-sm"
83
+ }),
84
+ children: [/* @__PURE__ */ jsx(Icon, {
85
+ icon: "ph:dots-three-vertical",
86
+ className: "size-3.5"
87
+ }), /* @__PURE__ */ jsx("span", {
88
+ className: "sr-only",
89
+ children: "More actions"
90
+ })]
91
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
92
+ align: "end",
93
+ children: [
94
+ regularSecondary.map((action) => /* @__PURE__ */ jsx(ActionButton, {
95
+ action,
96
+ collection,
97
+ helpers,
98
+ size: "sm",
99
+ presentation: "menu",
100
+ onOpenDialog
101
+ }, action.id)),
102
+ regularSecondary.length > 0 && destructiveSecondary.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
103
+ destructiveSecondary.map((action) => /* @__PURE__ */ jsx(ActionButton, {
104
+ action,
105
+ collection,
106
+ helpers,
107
+ size: "sm",
108
+ presentation: "menu",
109
+ onOpenDialog
110
+ }, action.id))
111
+ ]
112
+ })] })]
113
+ });
206
114
  }
207
115
 
208
116
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { CollectionNames, GlobalNames } from "../builder/index.mjs";
2
2
  import * as React from "react";
3
- import * as react_jsx_runtime12 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime14 from "react/jsx-runtime";
4
4
  import { QuestpieApp } from "questpie/client";
5
5
 
6
6
  //#region src/client/components/admin-link.d.ts
@@ -61,6 +61,6 @@ declare function AdminLink<TApp extends QuestpieApp>({
61
61
  children,
62
62
  onClick,
63
63
  ...rest
64
- }: AdminLinkProps<TApp>): react_jsx_runtime12.JSX.Element;
64
+ }: AdminLinkProps<TApp>): react_jsx_runtime14.JSX.Element;
65
65
  //#endregion
66
66
  export { AdminLink };
@@ -1,6 +1,5 @@
1
1
  import { getAdminLinkHref, useAdminRoutes } from "../hooks/use-admin-routes.mjs";
2
- import { c } from "react/compiler-runtime";
3
- import "react";
2
+ import * as React from "react";
4
3
  import { jsx } from "react/jsx-runtime";
5
4
 
6
5
  //#region src/client/components/admin-link.tsx
@@ -28,79 +27,31 @@ import { jsx } from "react/jsx-runtime";
28
27
  * <AdminLink pageId="analytics">Analytics</AdminLink>
29
28
  * ```
30
29
  */
31
- function AdminLink(t0) {
32
- const $ = c(29);
33
- let action;
34
- let children;
35
- let collection;
36
- let customHref;
37
- let global;
38
- let id;
39
- let onClick;
40
- let pageId;
41
- let rest;
42
- let t1;
43
- let to;
44
- if ($[0] !== t0) {
45
- ({to, collection, action, id, global, pageId, href: customHref, useNavigate: t1, children, onClick, ...rest} = t0);
46
- $[0] = t0;
47
- $[1] = action;
48
- $[2] = children;
49
- $[3] = collection;
50
- $[4] = customHref;
51
- $[5] = global;
52
- $[6] = id;
53
- $[7] = onClick;
54
- $[8] = pageId;
55
- $[9] = rest;
56
- $[10] = t1;
57
- $[11] = to;
58
- } else {
59
- action = $[1];
60
- children = $[2];
61
- collection = $[3];
62
- customHref = $[4];
63
- global = $[5];
64
- id = $[6];
65
- onClick = $[7];
66
- pageId = $[8];
67
- rest = $[9];
68
- t1 = $[10];
69
- to = $[11];
70
- }
71
- const useNavigate = t1 === void 0 ? false : t1;
30
+ function AdminLink({ to, collection, action, id, global, pageId, href: customHref, useNavigate = false, children, onClick, ...rest }) {
72
31
  const { routes } = useAdminRoutes();
73
- let t2;
74
- bb0: {
75
- if (customHref) {
76
- t2 = customHref;
77
- break bb0;
78
- }
79
- let t3$1;
80
- if ($[12] !== action || $[13] !== collection || $[14] !== global || $[15] !== id || $[16] !== pageId || $[17] !== routes || $[18] !== to) {
81
- t3$1 = getAdminLinkHref(routes, {
82
- to,
83
- collection,
84
- action,
85
- id,
86
- global,
87
- pageId
88
- });
89
- $[12] = action;
90
- $[13] = collection;
91
- $[14] = global;
92
- $[15] = id;
93
- $[16] = pageId;
94
- $[17] = routes;
95
- $[18] = to;
96
- $[19] = t3$1;
97
- } else t3$1 = $[19];
98
- t2 = t3$1;
99
- }
100
- const href = t2;
101
- let t3;
102
- if ($[20] !== href || $[21] !== onClick || $[22] !== useNavigate) {
103
- t3 = (e) => {
32
+ const href = React.useMemo(() => {
33
+ if (customHref) return customHref;
34
+ return getAdminLinkHref(routes, {
35
+ to,
36
+ collection,
37
+ action,
38
+ id,
39
+ global,
40
+ pageId
41
+ });
42
+ }, [
43
+ customHref,
44
+ to,
45
+ collection,
46
+ action,
47
+ id,
48
+ global,
49
+ pageId,
50
+ routes
51
+ ]);
52
+ return /* @__PURE__ */ jsx("a", {
53
+ href,
54
+ onClick: React.useCallback((e) => {
104
55
  if (onClick) onClick(e);
105
56
  if (useNavigate && !e.defaultPrevented) {
106
57
  e.preventDefault();
@@ -109,62 +60,25 @@ function AdminLink(t0) {
109
60
  window.dispatchEvent(new PopStateEvent("popstate"));
110
61
  }
111
62
  }
112
- };
113
- $[20] = href;
114
- $[21] = onClick;
115
- $[22] = useNavigate;
116
- $[23] = t3;
117
- } else t3 = $[23];
118
- const handleClick = t3;
119
- let t4;
120
- if ($[24] !== children || $[25] !== handleClick || $[26] !== href || $[27] !== rest) {
121
- t4 = /* @__PURE__ */ jsx("a", {
122
- href,
123
- onClick: handleClick,
124
- ...rest,
125
- children
126
- });
127
- $[24] = children;
128
- $[25] = handleClick;
129
- $[26] = href;
130
- $[27] = rest;
131
- $[28] = t4;
132
- } else t4 = $[28];
133
- return t4;
63
+ }, [
64
+ onClick,
65
+ useNavigate,
66
+ href
67
+ ]),
68
+ ...rest,
69
+ children
70
+ });
134
71
  }
135
72
  /**
136
73
  * Link to edit an item in a collection
137
74
  */
138
- function CollectionEditLink(t0) {
139
- const $ = c(8);
140
- let collection;
141
- let id;
142
- let rest;
143
- if ($[0] !== t0) {
144
- ({collection, id, ...rest} = t0);
145
- $[0] = t0;
146
- $[1] = collection;
147
- $[2] = id;
148
- $[3] = rest;
149
- } else {
150
- collection = $[1];
151
- id = $[2];
152
- rest = $[3];
153
- }
154
- let t1;
155
- if ($[4] !== collection || $[5] !== id || $[6] !== rest) {
156
- t1 = /* @__PURE__ */ jsx(AdminLink, {
157
- collection,
158
- action: "edit",
159
- id,
160
- ...rest
161
- });
162
- $[4] = collection;
163
- $[5] = id;
164
- $[6] = rest;
165
- $[7] = t1;
166
- } else t1 = $[7];
167
- return t1;
75
+ function CollectionEditLink({ collection, id, ...rest }) {
76
+ return /* @__PURE__ */ jsx(AdminLink, {
77
+ collection,
78
+ action: "edit",
79
+ id,
80
+ ...rest
81
+ });
168
82
  }
169
83
 
170
84
  //#endregion