@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
@@ -1,6 +1,5 @@
1
1
  import { cn } from "../../../../lib/utils.mjs";
2
2
  import { Button } from "../../../../components/ui/button.mjs";
3
- import { c } from "react/compiler-runtime";
4
3
  import { Icon } from "@iconify/react";
5
4
  import { jsx, jsxs } from "react/jsx-runtime";
6
5
 
@@ -35,125 +34,49 @@ function isVideo(mimeType) {
35
34
  function isAudio(mimeType) {
36
35
  return !!mimeType?.toLowerCase().startsWith("audio/");
37
36
  }
38
- function AssetThumbnail(t0) {
39
- const $ = c(97);
40
- const { asset, size: t1, showFilename: t2, showControls: t3, onClick, className } = t0;
41
- const size = t1 === void 0 ? "sm" : t1;
42
- const showFilename = t2 === void 0 ? false : t2;
43
- const showControls = t3 === void 0 ? false : t3;
44
- if (asset === null || asset === void 0) {
45
- let t4$1;
46
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
47
- t4$1 = /* @__PURE__ */ jsx("span", {
48
- className: "text-muted-foreground",
49
- children: "-"
50
- });
51
- $[0] = t4$1;
52
- } else t4$1 = $[0];
53
- return t4$1;
54
- }
55
- if (typeof asset === "string") {
56
- let t4$1;
57
- if ($[1] !== className) {
58
- t4$1 = cn("qa-asset-thumbnail text-muted-foreground inline-flex items-center gap-2", className);
59
- $[1] = className;
60
- $[2] = t4$1;
61
- } else t4$1 = $[2];
62
- let t5$1;
63
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
64
- t5$1 = /* @__PURE__ */ jsx("span", {
65
- className: "bg-muted border-border-subtle flex size-8 shrink-0 items-center justify-center rounded border",
66
- children: /* @__PURE__ */ jsx(Icon, {
67
- icon: "ph:file",
68
- className: "size-4"
69
- })
70
- });
71
- $[3] = t5$1;
72
- } else t5$1 = $[3];
73
- let t6$1;
74
- if ($[4] !== asset || $[5] !== t4$1) {
75
- t6$1 = /* @__PURE__ */ jsx("span", {
76
- className: t4$1,
77
- title: asset,
78
- children: t5$1
79
- });
80
- $[4] = asset;
81
- $[5] = t4$1;
82
- $[6] = t6$1;
83
- } else t6$1 = $[6];
84
- return t6$1;
85
- }
37
+ function AssetThumbnail({ asset, size = "sm", showFilename = false, showControls = false, onClick, className }) {
38
+ if (asset === null || asset === void 0) return /* @__PURE__ */ jsx("span", {
39
+ className: "text-muted-foreground",
40
+ children: "-"
41
+ });
42
+ if (typeof asset === "string") return /* @__PURE__ */ jsx("span", {
43
+ className: cn("qa-asset-thumbnail text-muted-foreground inline-flex items-center gap-2", className),
44
+ title: asset,
45
+ children: /* @__PURE__ */ jsx("span", {
46
+ className: "bg-muted border-border-subtle flex size-8 shrink-0 items-center justify-center rounded border",
47
+ children: /* @__PURE__ */ jsx(Icon, {
48
+ icon: "ph:file",
49
+ className: "size-4"
50
+ })
51
+ })
52
+ });
86
53
  const assetObj = asset;
87
54
  const url = assetObj.url;
88
55
  const filename = assetObj.filename;
89
56
  const mimeType = assetObj.mimeType;
90
57
  const alt = assetObj.alt;
91
- let t4;
92
- if ($[7] !== mimeType) {
93
- t4 = isImage(mimeType);
94
- $[7] = mimeType;
95
- $[8] = t4;
96
- } else t4 = $[8];
97
- const isImageType = t4;
98
- let t5;
99
- if ($[9] !== mimeType) {
100
- t5 = isVideo(mimeType);
101
- $[9] = mimeType;
102
- $[10] = t5;
103
- } else t5 = $[10];
104
- const isVideoType = t5;
105
- let t6;
106
- if ($[11] !== mimeType) {
107
- t6 = isAudio(mimeType);
108
- $[11] = mimeType;
109
- $[12] = t6;
110
- } else t6 = $[12];
111
- const isAudioType = t6;
112
- let t7;
113
- if ($[13] !== mimeType) {
114
- t7 = getFileIcon(mimeType);
115
- $[13] = mimeType;
116
- $[14] = t7;
117
- } else t7 = $[14];
118
- const fileIcon = t7;
58
+ const isImageType = isImage(mimeType);
59
+ const isVideoType = isVideo(mimeType);
60
+ const isAudioType = isAudio(mimeType);
61
+ const fileIcon = getFileIcon(mimeType);
119
62
  if (size === "sm") {
120
63
  const assetId = assetObj.id;
121
- let t8$1;
122
- if ($[15] !== assetId || $[16] !== onClick) {
123
- t8$1 = onClick && assetId ? () => onClick(assetId) : void 0;
124
- $[15] = assetId;
125
- $[16] = onClick;
126
- $[17] = t8$1;
127
- } else t8$1 = $[17];
128
- const handleClick = t8$1;
129
- let t9$1;
130
- if ($[18] !== handleClick) {
131
- t9$1 = handleClick ? {
132
- role: "button",
133
- tabIndex: 0,
134
- onClick: handleClick,
135
- onKeyDown: (e) => {
136
- if (e.key === "Enter" || e.key === " ") {
137
- e.preventDefault();
138
- handleClick();
139
- }
64
+ const handleClick = onClick && assetId ? () => onClick(assetId) : void 0;
65
+ const containerProps = handleClick ? {
66
+ role: "button",
67
+ tabIndex: 0,
68
+ onClick: handleClick,
69
+ onKeyDown: (e) => {
70
+ if (e.key === "Enter" || e.key === " ") {
71
+ e.preventDefault();
72
+ handleClick();
140
73
  }
141
- } : {};
142
- $[18] = handleClick;
143
- $[19] = t9$1;
144
- } else t9$1 = $[19];
145
- const containerProps = t9$1;
146
- const t10$1 = onClick && "cursor-pointer hover:opacity-80";
147
- let t11$1;
148
- if ($[20] !== className || $[21] !== t10$1) {
149
- t11$1 = cn("qa-asset-thumbnail flex items-center gap-2", t10$1, className);
150
- $[20] = className;
151
- $[21] = t10$1;
152
- $[22] = t11$1;
153
- } else t11$1 = $[22];
154
- let t12$1;
155
- if ($[23] !== fileIcon || $[24] !== filename || $[25] !== isImageType || $[26] !== url) {
156
- t12$1 = isImageType && url ? /* @__PURE__ */ jsx("img", {
74
+ }
75
+ } : {};
76
+ return /* @__PURE__ */ jsxs("div", {
77
+ className: cn("qa-asset-thumbnail flex items-center gap-2", onClick && "cursor-pointer hover:opacity-80", className),
78
+ ...containerProps,
79
+ children: [isImageType && url ? /* @__PURE__ */ jsx("img", {
157
80
  src: url,
158
81
  alt: filename || "Asset",
159
82
  className: "image-outline size-8 rounded object-cover"
@@ -163,292 +86,140 @@ function AssetThumbnail(t0) {
163
86
  icon: fileIcon,
164
87
  className: "text-muted-foreground size-4"
165
88
  })
166
- });
167
- $[23] = fileIcon;
168
- $[24] = filename;
169
- $[25] = isImageType;
170
- $[26] = url;
171
- $[27] = t12$1;
172
- } else t12$1 = $[27];
173
- let t13$1;
174
- if ($[28] !== filename || $[29] !== showFilename) {
175
- t13$1 = showFilename && filename && /* @__PURE__ */ jsx("span", {
89
+ }), showFilename && filename && /* @__PURE__ */ jsx("span", {
176
90
  className: "max-w-[120px] truncate text-xs",
177
91
  title: filename,
178
92
  children: filename
179
- });
180
- $[28] = filename;
181
- $[29] = showFilename;
182
- $[30] = t13$1;
183
- } else t13$1 = $[30];
184
- let t14$1;
185
- if ($[31] !== containerProps || $[32] !== t11$1 || $[33] !== t12$1 || $[34] !== t13$1) {
186
- t14$1 = /* @__PURE__ */ jsxs("div", {
187
- className: t11$1,
188
- ...containerProps,
189
- children: [t12$1, t13$1]
190
- });
191
- $[31] = containerProps;
192
- $[32] = t11$1;
193
- $[33] = t12$1;
194
- $[34] = t13$1;
195
- $[35] = t14$1;
196
- } else t14$1 = $[35];
197
- return t14$1;
93
+ })]
94
+ });
198
95
  }
199
96
  if (size === "md") {
200
- const assetId_0 = assetObj.id;
201
- let t8$1;
202
- if ($[36] !== assetId_0 || $[37] !== onClick) {
203
- t8$1 = onClick && assetId_0 ? () => onClick(assetId_0) : void 0;
204
- $[36] = assetId_0;
205
- $[37] = onClick;
206
- $[38] = t8$1;
207
- } else t8$1 = $[38];
208
- const handleClick_0 = t8$1;
97
+ const assetId = assetObj.id;
98
+ const handleClick = onClick && assetId ? () => onClick(assetId) : void 0;
209
99
  if (isImageType && url) {
210
- let t9$2;
211
- if ($[39] !== handleClick_0) {
212
- t9$2 = handleClick_0 ? {
213
- role: "button",
214
- tabIndex: 0,
215
- onClick: handleClick_0,
216
- onKeyDown: (e_0) => {
217
- if (e_0.key === "Enter" || e_0.key === " ") {
218
- e_0.preventDefault();
219
- handleClick_0();
220
- }
100
+ const interactiveProps = handleClick ? {
101
+ role: "button",
102
+ tabIndex: 0,
103
+ onClick: handleClick,
104
+ onKeyDown: (e) => {
105
+ if (e.key === "Enter" || e.key === " ") {
106
+ e.preventDefault();
107
+ handleClick();
221
108
  }
222
- } : {};
223
- $[39] = handleClick_0;
224
- $[40] = t9$2;
225
- } else t9$2 = $[40];
226
- const interactiveProps = t9$2;
227
- const t10$2 = onClick && "cursor-pointer hover:opacity-80";
228
- let t11$2;
229
- if ($[41] !== className || $[42] !== t10$2) {
230
- t11$2 = cn("qa-asset-thumbnail flex items-center justify-center", t10$2, className);
231
- $[41] = className;
232
- $[42] = t10$2;
233
- $[43] = t11$2;
234
- } else t11$2 = $[43];
235
- const t12$2 = filename || "Asset";
236
- let t13$2;
237
- if ($[44] !== t12$2 || $[45] !== url) {
238
- t13$2 = /* @__PURE__ */ jsx("img", {
109
+ }
110
+ } : {};
111
+ return /* @__PURE__ */ jsx("div", {
112
+ className: cn("qa-asset-thumbnail flex items-center justify-center", onClick && "cursor-pointer hover:opacity-80", className),
113
+ ...interactiveProps,
114
+ children: /* @__PURE__ */ jsx("img", {
239
115
  src: url,
240
- alt: t12$2,
116
+ alt: filename || "Asset",
241
117
  className: "image-outline size-10 rounded object-cover"
242
- });
243
- $[44] = t12$2;
244
- $[45] = url;
245
- $[46] = t13$2;
246
- } else t13$2 = $[46];
247
- let t14$1;
248
- if ($[47] !== interactiveProps || $[48] !== t11$2 || $[49] !== t13$2) {
249
- t14$1 = /* @__PURE__ */ jsx("div", {
250
- className: t11$2,
251
- ...interactiveProps,
252
- children: t13$2
253
- });
254
- $[47] = interactiveProps;
255
- $[48] = t11$2;
256
- $[49] = t13$2;
257
- $[50] = t14$1;
258
- } else t14$1 = $[50];
259
- return t14$1;
118
+ })
119
+ });
260
120
  }
261
- let t9$1;
262
- if ($[51] !== handleClick_0) {
263
- t9$1 = handleClick_0 ? {
121
+ {
122
+ const interactiveProps = handleClick ? {
264
123
  role: "button",
265
124
  tabIndex: 0,
266
- onClick: handleClick_0,
267
- onKeyDown: (e_1) => {
268
- if (e_1.key === "Enter" || e_1.key === " ") {
269
- e_1.preventDefault();
270
- handleClick_0();
125
+ onClick: handleClick,
126
+ onKeyDown: (e) => {
127
+ if (e.key === "Enter" || e.key === " ") {
128
+ e.preventDefault();
129
+ handleClick();
271
130
  }
272
131
  }
273
132
  } : {};
274
- $[51] = handleClick_0;
275
- $[52] = t9$1;
276
- } else t9$1 = $[52];
277
- const interactiveProps_0 = t9$1;
278
- const t10$1 = onClick && "cursor-pointer hover:opacity-80";
279
- let t11$1;
280
- if ($[53] !== className || $[54] !== t10$1) {
281
- t11$1 = cn("qa-asset-thumbnail flex items-center justify-center", t10$1, className);
282
- $[53] = className;
283
- $[54] = t10$1;
284
- $[55] = t11$1;
285
- } else t11$1 = $[55];
286
- let t12$1;
287
- if ($[56] !== fileIcon) {
288
- t12$1 = /* @__PURE__ */ jsx("div", {
289
- className: "bg-muted flex size-10 items-center justify-center rounded border",
290
- children: /* @__PURE__ */ jsx(Icon, {
291
- icon: fileIcon,
292
- className: "text-muted-foreground size-5"
133
+ return /* @__PURE__ */ jsx("div", {
134
+ className: cn("qa-asset-thumbnail flex items-center justify-center", onClick && "cursor-pointer hover:opacity-80", className),
135
+ ...interactiveProps,
136
+ children: /* @__PURE__ */ jsx("div", {
137
+ className: "bg-muted flex size-10 items-center justify-center rounded border",
138
+ children: /* @__PURE__ */ jsx(Icon, {
139
+ icon: fileIcon,
140
+ className: "text-muted-foreground size-5"
141
+ })
293
142
  })
294
143
  });
295
- $[56] = fileIcon;
296
- $[57] = t12$1;
297
- } else t12$1 = $[57];
298
- let t13$1;
299
- if ($[58] !== interactiveProps_0 || $[59] !== t11$1 || $[60] !== t12$1) {
300
- t13$1 = /* @__PURE__ */ jsx("div", {
301
- className: t11$1,
302
- ...interactiveProps_0,
303
- children: t12$1
304
- });
305
- $[58] = interactiveProps_0;
306
- $[59] = t11$1;
307
- $[60] = t12$1;
308
- $[61] = t13$1;
309
- } else t13$1 = $[61];
310
- return t13$1;
144
+ }
311
145
  }
312
- let t8;
313
- if ($[62] !== className) {
314
- t8 = cn("qa-asset-thumbnail bg-muted relative overflow-hidden border", className);
315
- $[62] = className;
316
- $[63] = t8;
317
- } else t8 = $[63];
318
- let t9;
319
- if ($[64] !== alt || $[65] !== filename || $[66] !== isImageType || $[67] !== url) {
320
- t9 = isImageType && url && /* @__PURE__ */ jsx("div", {
321
- className: "relative",
322
- children: /* @__PURE__ */ jsx("img", {
323
- src: url,
324
- alt: alt || filename || "Asset preview",
325
- className: "image-outline max-h-[400px] w-full object-contain"
326
- })
327
- });
328
- $[64] = alt;
329
- $[65] = filename;
330
- $[66] = isImageType;
331
- $[67] = url;
332
- $[68] = t9;
333
- } else t9 = $[68];
334
- let t10;
335
- if ($[69] !== fileIcon || $[70] !== filename || $[71] !== isVideoType || $[72] !== showControls || $[73] !== url) {
336
- t10 = isVideoType && url && /* @__PURE__ */ jsx("div", {
337
- className: "relative",
338
- children: showControls ? /* @__PURE__ */ jsxs("video", {
339
- src: url,
340
- controls: true,
341
- className: "max-h-[400px] w-full",
342
- preload: "metadata",
343
- children: [/* @__PURE__ */ jsx("track", { kind: "captions" }), "Your browser does not support the video tag."]
344
- }) : /* @__PURE__ */ jsxs("div", {
146
+ return /* @__PURE__ */ jsxs("div", {
147
+ className: cn("qa-asset-thumbnail bg-muted relative overflow-hidden border", className),
148
+ children: [
149
+ isImageType && url && /* @__PURE__ */ jsx("div", {
150
+ className: "relative",
151
+ children: /* @__PURE__ */ jsx("img", {
152
+ src: url,
153
+ alt: alt || filename || "Asset preview",
154
+ className: "image-outline max-h-[400px] w-full object-contain"
155
+ })
156
+ }),
157
+ isVideoType && url && /* @__PURE__ */ jsx("div", {
158
+ className: "relative",
159
+ children: showControls ? /* @__PURE__ */ jsxs("video", {
160
+ src: url,
161
+ controls: true,
162
+ className: "max-h-[400px] w-full",
163
+ preload: "metadata",
164
+ children: [/* @__PURE__ */ jsx("track", { kind: "captions" }), "Your browser does not support the video tag."]
165
+ }) : /* @__PURE__ */ jsxs("div", {
166
+ className: "flex flex-col items-center justify-center gap-4 p-12",
167
+ children: [/* @__PURE__ */ jsx(Icon, {
168
+ icon: fileIcon,
169
+ className: "text-muted-foreground size-20"
170
+ }), /* @__PURE__ */ jsx("p", {
171
+ className: "text-muted-foreground text-sm",
172
+ children: filename || "Video"
173
+ })]
174
+ })
175
+ }),
176
+ isAudioType && url && /* @__PURE__ */ jsxs("div", {
177
+ className: "flex flex-col items-center justify-center gap-4 p-8",
178
+ children: [
179
+ /* @__PURE__ */ jsx(Icon, {
180
+ icon: fileIcon,
181
+ className: "text-muted-foreground size-16"
182
+ }),
183
+ showControls && /* @__PURE__ */ jsxs("audio", {
184
+ src: url,
185
+ controls: true,
186
+ className: "w-full max-w-md",
187
+ preload: "metadata",
188
+ children: [/* @__PURE__ */ jsx("track", { kind: "captions" }), "Your browser does not support the audio tag."]
189
+ }),
190
+ !showControls && /* @__PURE__ */ jsx("p", {
191
+ className: "text-muted-foreground text-sm",
192
+ children: filename || "Audio"
193
+ })
194
+ ]
195
+ }),
196
+ (!url || !isImageType && !isVideoType && !isAudioType) && /* @__PURE__ */ jsxs("div", {
345
197
  className: "flex flex-col items-center justify-center gap-4 p-12",
346
198
  children: [/* @__PURE__ */ jsx(Icon, {
347
199
  icon: fileIcon,
348
200
  className: "text-muted-foreground size-20"
349
201
  }), /* @__PURE__ */ jsx("p", {
350
202
  className: "text-muted-foreground text-sm",
351
- children: filename || "Video"
203
+ children: filename || "File"
352
204
  })]
353
- })
354
- });
355
- $[69] = fileIcon;
356
- $[70] = filename;
357
- $[71] = isVideoType;
358
- $[72] = showControls;
359
- $[73] = url;
360
- $[74] = t10;
361
- } else t10 = $[74];
362
- let t11;
363
- if ($[75] !== fileIcon || $[76] !== filename || $[77] !== isAudioType || $[78] !== showControls || $[79] !== url) {
364
- t11 = isAudioType && url && /* @__PURE__ */ jsxs("div", {
365
- className: "flex flex-col items-center justify-center gap-4 p-8",
366
- children: [
367
- /* @__PURE__ */ jsx(Icon, {
368
- icon: fileIcon,
369
- className: "text-muted-foreground size-16"
370
- }),
371
- showControls && /* @__PURE__ */ jsxs("audio", {
372
- src: url,
373
- controls: true,
374
- className: "w-full max-w-md",
375
- preload: "metadata",
376
- children: [/* @__PURE__ */ jsx("track", { kind: "captions" }), "Your browser does not support the audio tag."]
377
- }),
378
- !showControls && /* @__PURE__ */ jsx("p", {
379
- className: "text-muted-foreground text-sm",
380
- children: filename || "Audio"
205
+ }),
206
+ url && /* @__PURE__ */ jsx("div", {
207
+ className: "absolute top-2 right-2",
208
+ children: /* @__PURE__ */ jsx(Button, {
209
+ type: "button",
210
+ variant: "secondary",
211
+ size: "icon-sm",
212
+ nativeButton: false,
213
+ render: /* @__PURE__ */ jsx("a", {
214
+ href: url,
215
+ target: "_blank",
216
+ rel: "noopener noreferrer"
217
+ }),
218
+ children: /* @__PURE__ */ jsx(Icon, { icon: "ph:arrow-square-out-bold" })
381
219
  })
382
- ]
383
- });
384
- $[75] = fileIcon;
385
- $[76] = filename;
386
- $[77] = isAudioType;
387
- $[78] = showControls;
388
- $[79] = url;
389
- $[80] = t11;
390
- } else t11 = $[80];
391
- let t12;
392
- if ($[81] !== fileIcon || $[82] !== filename || $[83] !== isAudioType || $[84] !== isImageType || $[85] !== isVideoType || $[86] !== url) {
393
- t12 = (!url || !isImageType && !isVideoType && !isAudioType) && /* @__PURE__ */ jsxs("div", {
394
- className: "flex flex-col items-center justify-center gap-4 p-12",
395
- children: [/* @__PURE__ */ jsx(Icon, {
396
- icon: fileIcon,
397
- className: "text-muted-foreground size-20"
398
- }), /* @__PURE__ */ jsx("p", {
399
- className: "text-muted-foreground text-sm",
400
- children: filename || "File"
401
- })]
402
- });
403
- $[81] = fileIcon;
404
- $[82] = filename;
405
- $[83] = isAudioType;
406
- $[84] = isImageType;
407
- $[85] = isVideoType;
408
- $[86] = url;
409
- $[87] = t12;
410
- } else t12 = $[87];
411
- let t13;
412
- if ($[88] !== url) {
413
- t13 = url && /* @__PURE__ */ jsx("div", {
414
- className: "absolute top-2 right-2",
415
- children: /* @__PURE__ */ jsx(Button, {
416
- type: "button",
417
- variant: "secondary",
418
- size: "icon-sm",
419
- nativeButton: false,
420
- render: /* @__PURE__ */ jsx("a", {
421
- href: url,
422
- target: "_blank",
423
- rel: "noopener noreferrer"
424
- }),
425
- children: /* @__PURE__ */ jsx(Icon, { icon: "ph:arrow-square-out-bold" })
426
220
  })
427
- });
428
- $[88] = url;
429
- $[89] = t13;
430
- } else t13 = $[89];
431
- let t14;
432
- if ($[90] !== t10 || $[91] !== t11 || $[92] !== t12 || $[93] !== t13 || $[94] !== t8 || $[95] !== t9) {
433
- t14 = /* @__PURE__ */ jsxs("div", {
434
- className: t8,
435
- children: [
436
- t9,
437
- t10,
438
- t11,
439
- t12,
440
- t13
441
- ]
442
- });
443
- $[90] = t10;
444
- $[91] = t11;
445
- $[92] = t12;
446
- $[93] = t13;
447
- $[94] = t8;
448
- $[95] = t9;
449
- $[96] = t14;
450
- } else t14 = $[96];
451
- return t14;
221
+ ]
222
+ });
452
223
  }
453
224
 
454
225
  //#endregion