@questpie/admin 3.0.2 → 3.0.4

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 (249) hide show
  1. package/README.md +34 -5
  2. package/dist/client/blocks/block-renderer.d.mts +2 -2
  3. package/dist/client/blocks/block-renderer.mjs +4 -1
  4. package/dist/client/builder/types/action-types.d.mts +31 -3
  5. package/dist/client/builder/types/collection-types.d.mts +140 -0
  6. package/dist/client/builder/types/ui-config.d.mts +16 -2
  7. package/dist/client/builder/types/views.d.mts +57 -0
  8. package/dist/client/builder/types/widget-types.d.mts +5 -0
  9. package/dist/client/components/actions/action-button.mjs +137 -199
  10. package/dist/client/components/actions/action-dialog.mjs +198 -156
  11. package/dist/client/components/actions/confirmation-dialog.mjs +2 -2
  12. package/dist/client/components/actions/header-actions.mjs +52 -53
  13. package/dist/client/components/admin-link.d.mts +2 -2
  14. package/dist/client/components/auth/auth-loading.mjs +41 -18
  15. package/dist/client/components/blocks/block-fields-renderer.mjs +64 -28
  16. package/dist/client/components/blocks/block-insert-button.mjs +4 -4
  17. package/dist/client/components/blocks/block-item.mjs +2 -2
  18. package/dist/client/components/blocks/block-library-sidebar.mjs +2 -2
  19. package/dist/client/components/component-renderer.mjs +1 -1
  20. package/dist/client/components/fields/array-field.mjs +14 -14
  21. package/dist/client/components/fields/asset-preview-field.mjs +1 -1
  22. package/dist/client/components/fields/blocks-field/blocks-field.mjs +84 -104
  23. package/dist/client/components/fields/json-field.mjs +2 -2
  24. package/dist/client/components/fields/object-array-field.mjs +22 -22
  25. package/dist/client/components/fields/object-field.mjs +5 -5
  26. package/dist/client/components/fields/relation/displays/cards-display.mjs +16 -9
  27. package/dist/client/components/fields/relation/displays/chips-display.mjs +15 -12
  28. package/dist/client/components/fields/relation/displays/grid-display.mjs +15 -11
  29. package/dist/client/components/fields/relation/displays/list-display.mjs +33 -20
  30. package/dist/client/components/fields/relation/displays/table-display.mjs +62 -93
  31. package/dist/client/components/fields/relation/relation-items-display.mjs +1 -1
  32. package/dist/client/components/fields/relation-picker.mjs +7 -6
  33. package/dist/client/components/fields/relation-select.mjs +71 -47
  34. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +392 -82
  35. package/dist/client/components/fields/rich-text-editor/extensions.mjs +54 -23
  36. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +24 -50
  37. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +66 -0
  38. package/dist/client/components/fields/rich-text-editor/index.d.mts +38 -0
  39. package/dist/client/components/fields/rich-text-editor/index.mjs +637 -376
  40. package/dist/client/components/fields/rich-text-editor/link-utils.mjs +26 -0
  41. package/dist/client/components/fields/rich-text-editor/presets.d.mts +10 -0
  42. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +27 -6
  43. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +464 -346
  44. package/dist/client/components/fields/rich-text-editor/types.d.mts +77 -0
  45. package/dist/client/components/fields/upload-field.mjs +45 -49
  46. package/dist/client/components/filter-builder/columns-tab.mjs +69 -62
  47. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +473 -308
  48. package/dist/client/components/filter-builder/filters-tab.mjs +109 -82
  49. package/dist/client/components/filter-builder/saved-views-tab.mjs +300 -198
  50. package/dist/client/components/history-sidebar.mjs +850 -340
  51. package/dist/client/components/layout/field-layout-renderer.mjs +6 -5
  52. package/dist/client/components/locale-switcher.mjs +8 -8
  53. package/dist/client/components/media/media-grid.mjs +12 -9
  54. package/dist/client/components/media/media-picker-dialog.mjs +242 -230
  55. package/dist/client/components/preview/live-preview-mode.mjs +1 -1
  56. package/dist/client/components/primitives/asset-preview.mjs +37 -22
  57. package/dist/client/components/primitives/date-input.mjs +212 -249
  58. package/dist/client/components/primitives/dropzone.mjs +192 -159
  59. package/dist/client/components/primitives/field-select-control.mjs +93 -0
  60. package/dist/client/components/primitives/select-multi.mjs +251 -230
  61. package/dist/client/components/primitives/select-single.mjs +345 -290
  62. package/dist/client/components/primitives/time-input.mjs +2 -2
  63. package/dist/client/components/sheets/resource-sheet.mjs +2 -0
  64. package/dist/client/components/ui/accordion.mjs +4 -4
  65. package/dist/client/components/ui/alert.mjs +3 -3
  66. package/dist/client/components/ui/badge.mjs +4 -4
  67. package/dist/client/components/ui/button.mjs +47 -37
  68. package/dist/client/components/ui/card.mjs +2 -2
  69. package/dist/client/components/ui/checkbox.mjs +1 -1
  70. package/dist/client/components/ui/command.mjs +5 -5
  71. package/dist/client/components/ui/dialog.mjs +3 -3
  72. package/dist/client/components/ui/drawer.mjs +1 -1
  73. package/dist/client/components/ui/dropdown-menu.mjs +157 -15
  74. package/dist/client/components/ui/empty-state.mjs +88 -59
  75. package/dist/client/components/ui/field.mjs +2 -2
  76. package/dist/client/components/ui/input-group.mjs +3 -3
  77. package/dist/client/components/ui/input.mjs +1 -1
  78. package/dist/client/components/ui/kbd.mjs +1 -1
  79. package/dist/client/components/ui/label.mjs +1 -1
  80. package/dist/client/components/ui/popover.mjs +19 -11
  81. package/dist/client/components/ui/scroll-fade.mjs +170 -0
  82. package/dist/client/components/ui/search-input.mjs +1 -1
  83. package/dist/client/components/ui/select.mjs +129 -27
  84. package/dist/client/components/ui/sheet.mjs +54 -34
  85. package/dist/client/components/ui/sidebar.mjs +15 -14
  86. package/dist/client/components/ui/skeleton.mjs +28 -12
  87. package/dist/client/components/ui/switch.mjs +2 -2
  88. package/dist/client/components/ui/table.mjs +82 -74
  89. package/dist/client/components/ui/tabs.mjs +26 -31
  90. package/dist/client/components/ui/textarea.mjs +1 -1
  91. package/dist/client/components/ui/tooltip.mjs +1 -1
  92. package/dist/client/components/widgets/chart-widget.mjs +134 -96
  93. package/dist/client/components/widgets/progress-widget.mjs +59 -34
  94. package/dist/client/components/widgets/quick-actions-widget.mjs +184 -113
  95. package/dist/client/components/widgets/recent-items-widget.mjs +144 -102
  96. package/dist/client/components/widgets/stats-widget.mjs +91 -72
  97. package/dist/client/components/widgets/table-widget.mjs +159 -246
  98. package/dist/client/components/widgets/timeline-widget.mjs +66 -43
  99. package/dist/client/components/widgets/value-widget.mjs +261 -152
  100. package/dist/client/components/widgets/widget-empty-state.mjs +88 -0
  101. package/dist/client/components/widgets/widget-skeletons.mjs +53 -20
  102. package/dist/client/contexts/focus-context.d.mts +2 -2
  103. package/dist/client/hooks/use-action.mjs +63 -55
  104. package/dist/client/hooks/use-audit-history.mjs +1 -65
  105. package/dist/client/hooks/use-collection-validation.mjs +36 -23
  106. package/dist/client/hooks/use-collection.mjs +96 -1
  107. package/dist/client/hooks/use-saved-views.mjs +70 -49
  108. package/dist/client/hooks/use-server-actions.mjs +59 -40
  109. package/dist/client/hooks/use-server-validation.mjs +156 -41
  110. package/dist/client/hooks/use-server-widget-data.mjs +1 -1
  111. package/dist/client/hooks/use-setup-status.d.mts +3 -3
  112. package/dist/client/hooks/use-setup-status.mjs +2 -2
  113. package/dist/client/hooks/use-transition-stage.mjs +2 -10
  114. package/dist/client/hooks/use-validation-error-map.mjs +31 -13
  115. package/dist/client/hooks/use-view-state.mjs +238 -174
  116. package/dist/client/i18n/date-locale.mjs +33 -0
  117. package/dist/client/i18n/hooks.mjs +17 -1
  118. package/dist/client/lib/utils.mjs +3 -2
  119. package/dist/client/preview/block-scope-context.d.mts +2 -2
  120. package/dist/client/preview/preview-banner.d.mts +2 -2
  121. package/dist/client/preview/preview-field.d.mts +4 -4
  122. package/dist/client/preview/preview-field.mjs +2 -2
  123. package/dist/client/runtime/provider.mjs +8 -1
  124. package/dist/client/runtime/translations-provider.mjs +1 -1
  125. package/dist/client/scope/picker.d.mts +2 -2
  126. package/dist/client/scope/provider.d.mts +2 -2
  127. package/dist/client/styles/base.css +1022 -0
  128. package/dist/client/styles/index.css +3 -589
  129. package/dist/client/utils/auto-expand-fields.mjs +4 -2
  130. package/dist/client/utils/keyboard-shortcuts.mjs +26 -0
  131. package/dist/client/utils/use-lazy-component.mjs +80 -0
  132. package/dist/client/views/auth/auth-layout.d.mts +18 -11
  133. package/dist/client/views/auth/auth-layout.mjs +291 -80
  134. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  135. package/dist/client/views/auth/forgot-password-form.mjs +2 -2
  136. package/dist/client/views/auth/login-form.d.mts +2 -2
  137. package/dist/client/views/auth/login-form.mjs +1 -1
  138. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  139. package/dist/client/views/auth/reset-password-form.mjs +2 -2
  140. package/dist/client/views/auth/setup-form.d.mts +2 -2
  141. package/dist/client/views/collection/auto-form-fields.mjs +11 -9
  142. package/dist/client/views/collection/bulk-action-toolbar.mjs +173 -138
  143. package/dist/client/views/collection/cells/complex-cells.mjs +22 -22
  144. package/dist/client/views/collection/cells/primitive-cells.mjs +1 -1
  145. package/dist/client/views/collection/cells/relation-cells.mjs +147 -129
  146. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +224 -278
  147. package/dist/client/views/collection/cells/shared/relation-chip.mjs +64 -36
  148. package/dist/client/views/collection/cells/upload-cells.mjs +199 -9
  149. package/dist/client/views/collection/columns/build-columns.mjs +29 -9
  150. package/dist/client/views/collection/columns/column-defaults.mjs +2 -2
  151. package/dist/client/views/collection/field-renderer.mjs +50 -89
  152. package/dist/client/views/collection/form-view.mjs +237 -227
  153. package/dist/client/views/collection/table-view.mjs +1162 -229
  154. package/dist/client/views/collection/view-skeletons.mjs +222 -79
  155. package/dist/client/views/common/global-search.mjs +29 -18
  156. package/dist/client/views/dashboard/dashboard-grid.mjs +678 -501
  157. package/dist/client/views/dashboard/dashboard-widget.mjs +6 -3
  158. package/dist/client/views/dashboard/widget-card.mjs +23 -14
  159. package/dist/client/views/globals/global-form-view.mjs +634 -589
  160. package/dist/client/views/layout/admin-layout-provider.mjs +67 -70
  161. package/dist/client/views/layout/admin-layout.d.mts +3 -6
  162. package/dist/client/views/layout/admin-layout.mjs +149 -172
  163. package/dist/client/views/layout/admin-router.mjs +747 -544
  164. package/dist/client/views/layout/admin-sidebar.d.mts +38 -1
  165. package/dist/client/views/layout/admin-sidebar.mjs +751 -591
  166. package/dist/client/views/layout/admin-theme.d.mts +10 -0
  167. package/dist/client/views/layout/admin-theme.mjs +84 -0
  168. package/dist/client/views/layout/admin-view-layout.mjs +161 -0
  169. package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
  170. package/dist/client/views/pages/accept-invite-page.mjs +49 -26
  171. package/dist/client/views/pages/dashboard-page.d.mts +2 -2
  172. package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
  173. package/dist/client/views/pages/forgot-password-page.mjs +2 -19
  174. package/dist/client/views/pages/invite-page.d.mts +2 -2
  175. package/dist/client/views/pages/invite-page.mjs +2 -19
  176. package/dist/client/views/pages/login-page.d.mts +3 -3
  177. package/dist/client/views/pages/login-page.mjs +4 -21
  178. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  179. package/dist/client/views/pages/reset-password-page.mjs +3 -20
  180. package/dist/client/views/pages/setup-page.d.mts +2 -2
  181. package/dist/client/views/pages/setup-page.mjs +3 -20
  182. package/dist/client.d.mts +6 -2
  183. package/dist/client.mjs +2 -1
  184. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  185. package/dist/index.d.mts +6 -2
  186. package/dist/index.mjs +2 -1
  187. package/dist/server/augmentation/dashboard.d.mts +67 -3
  188. package/dist/server/augmentation/form-layout.d.mts +21 -0
  189. package/dist/server/augmentation/index.d.mts +1 -1
  190. package/dist/server/codegen/admin-client-template.mjs +4 -0
  191. package/dist/server/fields/blocks.d.mts +1 -1
  192. package/dist/server/fields/blocks.mjs +12 -0
  193. package/dist/server/fields/rich-text.d.mts +1 -1
  194. package/dist/server/fields/rich-text.mjs +8 -0
  195. package/dist/server/i18n/index.mjs +17 -1
  196. package/dist/server/i18n/messages/cs.mjs +23 -0
  197. package/dist/server/i18n/messages/de.mjs +23 -0
  198. package/dist/server/i18n/messages/en.mjs +64 -1
  199. package/dist/server/i18n/messages/es.mjs +23 -0
  200. package/dist/server/i18n/messages/fr.mjs +23 -0
  201. package/dist/server/i18n/messages/pl.mjs +23 -0
  202. package/dist/server/i18n/messages/pt.mjs +23 -0
  203. package/dist/server/i18n/messages/sk.mjs +83 -1
  204. package/dist/server/modules/admin/block/introspection.mjs +4 -1
  205. package/dist/server/modules/admin/block/prefetch.mjs +12 -2
  206. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  207. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  208. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  209. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  210. package/dist/server/modules/admin/collections/apikey.d.mts +64 -64
  211. package/dist/server/modules/admin/collections/assets.d.mts +20 -20
  212. package/dist/server/modules/admin/collections/assets.mjs +0 -1
  213. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  214. package/dist/server/modules/admin/collections/user.d.mts +40 -28
  215. package/dist/server/modules/admin/collections/user.mjs +40 -9
  216. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  217. package/dist/server/modules/admin/dto/admin-config.dto.mjs +2 -0
  218. package/dist/server/modules/admin/factories.mjs +7 -18
  219. package/dist/server/modules/admin/index.d.mts +1 -1
  220. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  221. package/dist/server/modules/admin/routes/admin-config.mjs +34 -16
  222. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  223. package/dist/server/modules/admin/routes/execute-action.mjs +33 -0
  224. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  225. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  226. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  227. package/dist/server/modules/admin/routes/setup.d.mts +10 -10
  228. package/dist/server/modules/admin/routes/setup.mjs +7 -7
  229. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  230. package/dist/server/modules/admin/routes/translations.mjs +5 -1
  231. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  232. package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +1 -1
  233. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +25 -25
  234. package/dist/server/modules/audit/.generated/module.d.mts +7 -7
  235. package/dist/server/modules/audit/.generated/module.mjs +1 -1
  236. package/dist/server/modules/audit/collections/audit-log.d.mts +39 -39
  237. package/dist/server/modules/audit/collections/audit-log.mjs +1 -1
  238. package/dist/server/modules/audit/config/app.mjs +99 -42
  239. package/dist/server/modules/audit/jobs/audit-cleanup.mjs +1 -1
  240. package/dist/server/plugin.mjs +4 -2
  241. package/dist/server/proxy-factories.d.mts +4 -3
  242. package/dist/server/proxy-factories.mjs +34 -8
  243. package/dist/shared/types/saved-views.types.d.mts +2 -0
  244. package/package.json +6 -4
  245. package/dist/client/components/fields/rich-text-editor/link-popover.mjs +0 -85
  246. package/dist/client/components/ui/spinner.mjs +0 -52
  247. package/dist/client/components/ui/toolbar.mjs +0 -136
  248. package/dist/client/contexts/breadcrumb-context.mjs +0 -60
  249. package/dist/client/views/layout/admin-topbar.mjs +0 -236
@@ -1,5 +1,6 @@
1
1
  import { useTranslation } from "../../i18n/hooks.mjs";
2
2
  import { cn } from "../../lib/utils.mjs";
3
+ import { Button } from "../ui/button.mjs";
3
4
  import { c } from "react/compiler-runtime";
4
5
  import { Icon } from "@iconify/react";
5
6
  import * as React from "react";
@@ -47,18 +48,19 @@ function formatFileSize(bytes) {
47
48
  return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
48
49
  }
49
50
  function Dropzone(t0) {
50
- const $ = c(66);
51
- const { onDrop, accept, maxSize, multiple: t1, disabled: t2, loading: t3, progress, label, hint, error, className, children, onValidationError } = t0;
51
+ const $ = c(70);
52
+ const { onDrop, accept, maxSize, multiple: t1, disabled: t2, loading: t3, progress, variant: t4, label, hint, error, className, children, action, onValidationError } = t0;
52
53
  const multiple = t1 === void 0 ? false : t1;
53
54
  const disabled = t2 === void 0 ? false : t2;
54
55
  const loading = t3 === void 0 ? false : t3;
56
+ const variant = t4 === void 0 ? "panel" : t4;
55
57
  const { t } = useTranslation();
56
58
  const [isDragging, setIsDragging] = React.useState(false);
57
59
  const inputRef = React.useRef(null);
58
60
  const dragCounterRef = React.useRef(0);
59
- let t4;
61
+ let t5;
60
62
  if ($[0] !== accept || $[1] !== maxSize || $[2] !== t) {
61
- t4 = (files) => {
63
+ t5 = (files) => {
62
64
  const valid = [];
63
65
  const errors = [];
64
66
  for (const file of files) {
@@ -91,12 +93,12 @@ function Dropzone(t0) {
91
93
  $[0] = accept;
92
94
  $[1] = maxSize;
93
95
  $[2] = t;
94
- $[3] = t4;
95
- } else t4 = $[3];
96
- const validateFiles = t4;
97
- let t5;
96
+ $[3] = t5;
97
+ } else t5 = $[3];
98
+ const validateFiles = t5;
99
+ let t6;
98
100
  if ($[4] !== disabled || $[5] !== loading || $[6] !== multiple || $[7] !== onDrop || $[8] !== onValidationError || $[9] !== validateFiles) {
99
- t5 = (files_0) => {
101
+ t6 = (files_0) => {
100
102
  if (disabled || loading) return;
101
103
  const fileArray = Array.from(files_0);
102
104
  const { valid: valid_0, errors: errors_0 } = validateFiles(multiple ? fileArray : fileArray.slice(0, 1));
@@ -109,12 +111,12 @@ function Dropzone(t0) {
109
111
  $[7] = onDrop;
110
112
  $[8] = onValidationError;
111
113
  $[9] = validateFiles;
112
- $[10] = t5;
113
- } else t5 = $[10];
114
- const handleFiles = t5;
115
- let t6;
114
+ $[10] = t6;
115
+ } else t6 = $[10];
116
+ const handleFiles = t6;
117
+ let t7;
116
118
  if ($[11] !== disabled || $[12] !== loading) {
117
- t6 = (e) => {
119
+ t7 = (e) => {
118
120
  e.preventDefault();
119
121
  e.stopPropagation();
120
122
  dragCounterRef.current = dragCounterRef.current + 1;
@@ -122,24 +124,24 @@ function Dropzone(t0) {
122
124
  };
123
125
  $[11] = disabled;
124
126
  $[12] = loading;
125
- $[13] = t6;
126
- } else t6 = $[13];
127
- const handleDragEnter = t6;
128
- let t7;
127
+ $[13] = t7;
128
+ } else t7 = $[13];
129
+ const handleDragEnter = t7;
130
+ let t8;
129
131
  if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
130
- t7 = (e_0) => {
132
+ t8 = (e_0) => {
131
133
  e_0.preventDefault();
132
134
  e_0.stopPropagation();
133
135
  dragCounterRef.current = dragCounterRef.current - 1;
134
136
  if (dragCounterRef.current === 0) setIsDragging(false);
135
137
  };
136
- $[14] = t7;
137
- } else t7 = $[14];
138
- const handleDragLeave = t7;
138
+ $[14] = t8;
139
+ } else t8 = $[14];
140
+ const handleDragLeave = t8;
139
141
  const handleDragOver = _temp;
140
- let t8;
142
+ let t9;
141
143
  if ($[15] !== handleFiles) {
142
- t8 = (e_2) => {
144
+ t9 = (e_2) => {
143
145
  e_2.preventDefault();
144
146
  e_2.stopPropagation();
145
147
  dragCounterRef.current = 0;
@@ -147,50 +149,51 @@ function Dropzone(t0) {
147
149
  if (e_2.dataTransfer.files.length > 0) handleFiles(e_2.dataTransfer.files);
148
150
  };
149
151
  $[15] = handleFiles;
150
- $[16] = t8;
151
- } else t8 = $[16];
152
- const handleDrop = t8;
153
- let t9;
152
+ $[16] = t9;
153
+ } else t9 = $[16];
154
+ const handleDrop = t9;
155
+ let t10;
154
156
  if ($[17] !== disabled || $[18] !== loading) {
155
- t9 = () => {
157
+ t10 = () => {
156
158
  if (disabled || loading) return;
157
159
  inputRef.current?.click();
158
160
  };
159
161
  $[17] = disabled;
160
162
  $[18] = loading;
161
- $[19] = t9;
162
- } else t9 = $[19];
163
- const handleClick = t9;
164
- let t10;
163
+ $[19] = t10;
164
+ } else t10 = $[19];
165
+ const handleClick = t10;
166
+ let t11;
165
167
  if ($[20] !== handleFiles) {
166
- t10 = (e_3) => {
168
+ t11 = (e_3) => {
167
169
  if (e_3.target.files && e_3.target.files.length > 0) handleFiles(e_3.target.files);
168
170
  e_3.target.value = "";
169
171
  };
170
172
  $[20] = handleFiles;
171
- $[21] = t10;
172
- } else t10 = $[21];
173
- const handleInputChange = t10;
174
- let t11;
173
+ $[21] = t11;
174
+ } else t11 = $[21];
175
+ const handleInputChange = t11;
176
+ let t12;
175
177
  if ($[22] !== accept) {
176
- t11 = accept?.join(",") || void 0;
178
+ t12 = accept?.join(",") || void 0;
177
179
  $[22] = accept;
178
- $[23] = t11;
179
- } else t11 = $[23];
180
- const acceptString = t11;
181
- let t12;
180
+ $[23] = t12;
181
+ } else t12 = $[23];
182
+ const acceptString = t12;
183
+ const isCompact = variant === "compact";
184
+ let t13;
182
185
  bb0: {
183
186
  if (hint) {
184
- t12 = hint;
187
+ t13 = hint;
185
188
  break bb0;
186
189
  }
187
190
  let parts;
188
191
  if ($[24] !== accept || $[25] !== maxSize || $[26] !== t) {
189
192
  parts = [];
190
193
  if (accept && accept.length > 0) {
191
- let t13$1;
194
+ let t14$1;
192
195
  if ($[28] !== t) {
193
- t13$1 = (mimeType) => {
196
+ t14$1 = (mimeType) => {
194
197
  if (mimeType.startsWith("image/")) return t("dropzone.typeImages");
195
198
  if (mimeType.startsWith("video/")) return t("dropzone.typeVideos");
196
199
  if (mimeType.startsWith("audio/")) return t("dropzone.typeAudio");
@@ -199,162 +202,192 @@ function Dropzone(t0) {
199
202
  return mimeType;
200
203
  };
201
204
  $[28] = t;
202
- $[29] = t13$1;
203
- } else t13$1 = $[29];
204
- const types = accept.map(t13$1).filter(_temp2);
205
+ $[29] = t14$1;
206
+ } else t14$1 = $[29];
207
+ const types = accept.map(t14$1).filter(_temp2);
205
208
  parts.push(types.join(", "));
206
209
  }
207
210
  if (maxSize) {
208
- let t13$1;
211
+ let t14$1;
209
212
  if ($[30] !== maxSize) {
210
- t13$1 = formatFileSize(maxSize);
213
+ t14$1 = formatFileSize(maxSize);
211
214
  $[30] = maxSize;
212
- $[31] = t13$1;
213
- } else t13$1 = $[31];
214
- parts.push(`Max ${t13$1}`);
215
+ $[31] = t14$1;
216
+ } else t14$1 = $[31];
217
+ parts.push(`Max ${t14$1}`);
215
218
  }
216
219
  $[24] = accept;
217
220
  $[25] = maxSize;
218
221
  $[26] = t;
219
222
  $[27] = parts;
220
223
  } else parts = $[27];
221
- t12 = parts.length > 0 ? parts.join(" • ") : void 0;
224
+ t13 = parts.length > 0 ? parts.join(" • ") : void 0;
222
225
  }
223
- const hintText = t12;
224
- const t13 = disabled || loading ? -1 : 0;
225
- let t14;
226
+ const hintText = t13;
227
+ const t14 = disabled || loading ? -1 : 0;
228
+ let t15;
226
229
  if ($[32] !== handleClick) {
227
- t14 = (e_4) => {
230
+ t15 = (e_4) => {
228
231
  if (e_4.key === "Enter" || e_4.key === " ") {
229
232
  e_4.preventDefault();
230
233
  handleClick();
231
234
  }
232
235
  };
233
236
  $[32] = handleClick;
234
- $[33] = t14;
235
- } else t14 = $[33];
236
- const t15 = isDragging && "border-primary bg-primary/5";
237
- const t16 = error && "border-destructive/50 bg-destructive/5";
238
- const t17 = (disabled || loading) && "pointer-events-none opacity-60";
239
- let t18;
240
- if ($[34] !== className || $[35] !== t15 || $[36] !== t16 || $[37] !== t17) {
241
- t18 = cn("qa-dropzone relative flex min-h-[120px] cursor-pointer flex-col items-center justify-center gap-2 border-2 border-dashed p-6 text-center transition-colors", "border-border bg-muted hover:border-border hover:bg-muted", t15, t16, t17, className);
237
+ $[33] = t15;
238
+ } else t15 = $[33];
239
+ const t16 = isCompact ? "min-h-16 flex-row items-center justify-start gap-3 border border-dashed p-3 text-left" : "min-h-[120px] flex-col items-center justify-center gap-2 border-2 p-6 text-center";
240
+ const t17 = isDragging && "border-border-strong bg-surface-high";
241
+ const t18 = error && "border-destructive/50 bg-destructive/5";
242
+ const t19 = (disabled || loading) && "pointer-events-none opacity-60";
243
+ let t20;
244
+ if ($[34] !== className || $[35] !== t16 || $[36] !== t17 || $[37] !== t18 || $[38] !== t19) {
245
+ t20 = cn("qa-dropzone control-surface relative flex cursor-pointer hover:bg-muted/40 rounded-lg border transition-colors", t16, t17, t18, t19, className);
242
246
  $[34] = className;
243
- $[35] = t15;
244
- $[36] = t16;
245
- $[37] = t17;
246
- $[38] = t18;
247
- } else t18 = $[38];
248
- const t19 = disabled || loading;
249
- const t20 = isDragging || void 0;
247
+ $[35] = t16;
248
+ $[36] = t17;
249
+ $[37] = t18;
250
+ $[38] = t19;
251
+ $[39] = t20;
252
+ } else t20 = $[39];
250
253
  const t21 = disabled || loading;
251
- let t22;
252
- if ($[39] !== acceptString || $[40] !== handleInputChange || $[41] !== multiple || $[42] !== t21) {
253
- t22 = /* @__PURE__ */ jsx("input", {
254
+ const t22 = isDragging || void 0;
255
+ const t23 = disabled || loading;
256
+ let t24;
257
+ if ($[40] !== acceptString || $[41] !== handleInputChange || $[42] !== multiple || $[43] !== t23) {
258
+ t24 = /* @__PURE__ */ jsx("input", {
254
259
  ref: inputRef,
255
260
  type: "file",
256
261
  accept: acceptString,
257
262
  multiple,
258
263
  onChange: handleInputChange,
259
264
  className: "sr-only",
260
- disabled: t21,
265
+ disabled: t23,
261
266
  tabIndex: -1
262
267
  });
263
- $[39] = acceptString;
264
- $[40] = handleInputChange;
265
- $[41] = multiple;
266
- $[42] = t21;
267
- $[43] = t22;
268
- } else t22 = $[43];
269
- let t23;
270
- if ($[44] !== children || $[45] !== hintText || $[46] !== isDragging || $[47] !== label || $[48] !== loading || $[49] !== progress || $[50] !== t) {
271
- t23 = children || /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
272
- className: "flex items-center justify-center",
273
- children: loading ? /* @__PURE__ */ jsxs("div", {
274
- className: "relative",
275
- children: [/* @__PURE__ */ jsx(Icon, {
276
- icon: "ph:spinner-gap",
277
- className: "text-muted-foreground size-10 animate-spin"
278
- }), typeof progress === "number" && /* @__PURE__ */ jsxs("span", {
279
- className: "text-muted-foreground absolute inset-0 flex items-center justify-center text-xs font-medium",
280
- children: [progress, "%"]
268
+ $[40] = acceptString;
269
+ $[41] = handleInputChange;
270
+ $[42] = multiple;
271
+ $[43] = t23;
272
+ $[44] = t24;
273
+ } else t24 = $[44];
274
+ let t25;
275
+ if ($[45] !== action || $[46] !== children || $[47] !== disabled || $[48] !== hintText || $[49] !== isCompact || $[50] !== isDragging || $[51] !== label || $[52] !== loading || $[53] !== progress || $[54] !== t) {
276
+ t25 = children || /* @__PURE__ */ jsxs(Fragment, { children: [
277
+ /* @__PURE__ */ jsx("div", {
278
+ className: cn("flex shrink-0 items-center justify-center", isCompact && "bg-background/70 border-border-subtle size-9 rounded border"),
279
+ children: loading ? /* @__PURE__ */ jsxs("div", {
280
+ className: "relative",
281
+ children: [/* @__PURE__ */ jsx(Icon, {
282
+ icon: "ph:spinner-gap",
283
+ className: cn("text-muted-foreground animate-spin", isCompact ? "size-5" : "size-10")
284
+ }), typeof progress === "number" && /* @__PURE__ */ jsxs("span", {
285
+ className: cn("text-muted-foreground absolute inset-0 flex items-center justify-center font-medium tabular-nums", isCompact ? "text-[9px]" : "text-xs"),
286
+ children: [progress, "%"]
287
+ })]
288
+ }) : /* @__PURE__ */ jsx(Icon, {
289
+ icon: "ph:cloud-arrow-up",
290
+ className: cn("transition-colors", isCompact ? "size-5" : "size-10", isDragging ? "text-foreground" : "text-muted-foreground")
291
+ })
292
+ }),
293
+ /* @__PURE__ */ jsxs("div", {
294
+ className: cn("min-w-0 space-y-1", isCompact && "flex-1"),
295
+ children: [
296
+ /* @__PURE__ */ jsx("p", {
297
+ className: cn("text-foreground text-sm font-medium", isCompact && "truncate"),
298
+ children: loading ? t("dropzone.uploading") : label || t("dropzone.label")
299
+ }),
300
+ hintText && !loading && /* @__PURE__ */ jsx("p", {
301
+ className: cn("text-muted-foreground text-xs", isCompact && "truncate"),
302
+ children: hintText
303
+ }),
304
+ loading && typeof progress === "number" && /* @__PURE__ */ jsx("div", {
305
+ className: cn("bg-muted mt-2 h-1.5 overflow-hidden rounded-full", isCompact ? "w-full" : "mx-auto w-32"),
306
+ children: /* @__PURE__ */ jsx("div", {
307
+ className: "bg-primary h-full rounded-full transition-[width] duration-300",
308
+ style: { width: `${progress}%` }
309
+ })
310
+ })
311
+ ]
312
+ }),
313
+ action && !loading && !disabled && /* @__PURE__ */ jsxs(Button, {
314
+ type: "button",
315
+ variant: "outline",
316
+ size: "sm",
317
+ disabled: action.disabled,
318
+ onClick: (e_5) => {
319
+ e_5.stopPropagation();
320
+ action.onClick();
321
+ },
322
+ onKeyDown: _temp3,
323
+ className: cn("shrink-0", isCompact && "max-w-[45%] px-2.5"),
324
+ children: [action.icon && /* @__PURE__ */ jsx(Icon, {
325
+ icon: action.icon,
326
+ className: "size-4 shrink-0"
327
+ }), /* @__PURE__ */ jsx("span", {
328
+ className: "truncate",
329
+ children: action.label
281
330
  })]
282
- }) : /* @__PURE__ */ jsx(Icon, {
283
- icon: "ph:cloud-arrow-up",
284
- className: cn("size-10 transition-colors", isDragging ? "text-primary" : "text-muted-foreground")
285
331
  })
286
- }), /* @__PURE__ */ jsxs("div", {
287
- className: "space-y-1",
288
- children: [
289
- /* @__PURE__ */ jsx("p", {
290
- className: cn("text-sm font-medium", isDragging ? "text-primary" : "text-foreground"),
291
- children: loading ? t("dropzone.uploading") : label || t("dropzone.label")
292
- }),
293
- hintText && !loading && /* @__PURE__ */ jsx("p", {
294
- className: "text-muted-foreground text-xs",
295
- children: hintText
296
- }),
297
- loading && typeof progress === "number" && /* @__PURE__ */ jsx("div", {
298
- className: "bg-muted mx-auto mt-2 h-1.5 w-32 overflow-hidden rounded-full",
299
- children: /* @__PURE__ */ jsx("div", {
300
- className: "bg-primary h-full rounded-full transition-all duration-300",
301
- style: { width: `${progress}%` }
302
- })
303
- })
304
- ]
305
- })] });
306
- $[44] = children;
307
- $[45] = hintText;
308
- $[46] = isDragging;
309
- $[47] = label;
310
- $[48] = loading;
311
- $[49] = progress;
312
- $[50] = t;
313
- $[51] = t23;
314
- } else t23 = $[51];
315
- let t24;
316
- if ($[52] !== error) {
317
- t24 = error && /* @__PURE__ */ jsx("p", {
332
+ ] });
333
+ $[45] = action;
334
+ $[46] = children;
335
+ $[47] = disabled;
336
+ $[48] = hintText;
337
+ $[49] = isCompact;
338
+ $[50] = isDragging;
339
+ $[51] = label;
340
+ $[52] = loading;
341
+ $[53] = progress;
342
+ $[54] = t;
343
+ $[55] = t25;
344
+ } else t25 = $[55];
345
+ let t26;
346
+ if ($[56] !== error) {
347
+ t26 = error && /* @__PURE__ */ jsx("p", {
318
348
  className: "text-destructive absolute right-0 bottom-2 left-0 text-center text-xs",
319
349
  children: error
320
350
  });
321
- $[52] = error;
322
- $[53] = t24;
323
- } else t24 = $[53];
324
- let t25;
325
- if ($[54] !== handleClick || $[55] !== handleDragEnter || $[56] !== handleDrop || $[57] !== t13 || $[58] !== t14 || $[59] !== t18 || $[60] !== t19 || $[61] !== t20 || $[62] !== t22 || $[63] !== t23 || $[64] !== t24) {
326
- t25 = /* @__PURE__ */ jsxs("div", {
351
+ $[56] = error;
352
+ $[57] = t26;
353
+ } else t26 = $[57];
354
+ let t27;
355
+ if ($[58] !== handleClick || $[59] !== handleDragEnter || $[60] !== handleDrop || $[61] !== t14 || $[62] !== t15 || $[63] !== t20 || $[64] !== t21 || $[65] !== t22 || $[66] !== t24 || $[67] !== t25 || $[68] !== t26) {
356
+ t27 = /* @__PURE__ */ jsxs("div", {
327
357
  role: "button",
328
- tabIndex: t13,
358
+ tabIndex: t14,
329
359
  onClick: handleClick,
330
- onKeyDown: t14,
360
+ onKeyDown: t15,
331
361
  onDragEnter: handleDragEnter,
332
362
  onDragLeave: handleDragLeave,
333
363
  onDragOver: handleDragOver,
334
364
  onDrop: handleDrop,
335
- className: t18,
336
- "aria-disabled": t19,
337
- "data-dragging": t20,
365
+ className: t20,
366
+ "aria-disabled": t21,
367
+ "data-dragging": t22,
338
368
  children: [
339
- t22,
340
- t23,
341
- t24
369
+ t24,
370
+ t25,
371
+ t26
342
372
  ]
343
373
  });
344
- $[54] = handleClick;
345
- $[55] = handleDragEnter;
346
- $[56] = handleDrop;
347
- $[57] = t13;
348
- $[58] = t14;
349
- $[59] = t18;
350
- $[60] = t19;
351
- $[61] = t20;
352
- $[62] = t22;
353
- $[63] = t23;
354
- $[64] = t24;
355
- $[65] = t25;
356
- } else t25 = $[65];
357
- return t25;
374
+ $[58] = handleClick;
375
+ $[59] = handleDragEnter;
376
+ $[60] = handleDrop;
377
+ $[61] = t14;
378
+ $[62] = t15;
379
+ $[63] = t20;
380
+ $[64] = t21;
381
+ $[65] = t22;
382
+ $[66] = t24;
383
+ $[67] = t25;
384
+ $[68] = t26;
385
+ $[69] = t27;
386
+ } else t27 = $[69];
387
+ return t27;
388
+ }
389
+ function _temp3(e_6) {
390
+ e_6.stopPropagation();
358
391
  }
359
392
  function _temp2(v, i, a) {
360
393
  return a.indexOf(v) === i;
@@ -0,0 +1,93 @@
1
+ "use client";
2
+
3
+ import { cn } from "../../lib/utils.mjs";
4
+ import { Button } from "../ui/button.mjs";
5
+ import { InputGroup } from "../ui/input-group.mjs";
6
+ import { c } from "react/compiler-runtime";
7
+ import { jsx } from "react/jsx-runtime";
8
+
9
+ //#region src/client/components/primitives/field-select-control.tsx
10
+ function FieldSelectTrigger(t0) {
11
+ const $ = c(13);
12
+ let asInputGroupControl;
13
+ let className;
14
+ let hasValue;
15
+ let props;
16
+ if ($[0] !== t0) {
17
+ ({className, hasValue, asInputGroupControl, ...props} = t0);
18
+ $[0] = t0;
19
+ $[1] = asInputGroupControl;
20
+ $[2] = className;
21
+ $[3] = hasValue;
22
+ $[4] = props;
23
+ } else {
24
+ asInputGroupControl = $[1];
25
+ className = $[2];
26
+ hasValue = $[3];
27
+ props = $[4];
28
+ }
29
+ const t1 = asInputGroupControl ? "input-group-control" : void 0;
30
+ const t2 = !hasValue && "text-muted-foreground";
31
+ const t3 = asInputGroupControl && "h-full min-w-0 flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0";
32
+ let t4;
33
+ if ($[5] !== className || $[6] !== t2 || $[7] !== t3) {
34
+ t4 = cn("qa-field-select-control qa-select-single control-surface w-full justify-between px-3 py-2 font-normal", "hover:bg-surface-low focus-visible:border-border-strong focus-visible:ring-ring/20 aria-expanded:border-border-strong aria-expanded:ring-ring/20 focus-visible:ring-[3px] aria-expanded:ring-[3px]", t2, t3, className);
35
+ $[5] = className;
36
+ $[6] = t2;
37
+ $[7] = t3;
38
+ $[8] = t4;
39
+ } else t4 = $[8];
40
+ let t5;
41
+ if ($[9] !== props || $[10] !== t1 || $[11] !== t4) {
42
+ t5 = /* @__PURE__ */ jsx(Button, {
43
+ variant: "outline",
44
+ "data-slot": t1,
45
+ className: t4,
46
+ ...props
47
+ });
48
+ $[9] = props;
49
+ $[10] = t1;
50
+ $[11] = t4;
51
+ $[12] = t5;
52
+ } else t5 = $[12];
53
+ return t5;
54
+ }
55
+ function FieldSelectActionGroup(t0) {
56
+ const $ = c(10);
57
+ let className;
58
+ let error;
59
+ let props;
60
+ if ($[0] !== t0) {
61
+ ({className, error, ...props} = t0);
62
+ $[0] = t0;
63
+ $[1] = className;
64
+ $[2] = error;
65
+ $[3] = props;
66
+ } else {
67
+ className = $[1];
68
+ error = $[2];
69
+ props = $[3];
70
+ }
71
+ const t1 = error && "border-destructive ring-destructive/20 ring-[2px]";
72
+ let t2;
73
+ if ($[4] !== className || $[5] !== t1) {
74
+ t2 = cn("qa-field-select-action-group control-surface overflow-hidden p-0", t1, className);
75
+ $[4] = className;
76
+ $[5] = t1;
77
+ $[6] = t2;
78
+ } else t2 = $[6];
79
+ let t3;
80
+ if ($[7] !== props || $[8] !== t2) {
81
+ t3 = /* @__PURE__ */ jsx(InputGroup, {
82
+ className: t2,
83
+ ...props
84
+ });
85
+ $[7] = props;
86
+ $[8] = t2;
87
+ $[9] = t3;
88
+ } else t3 = $[9];
89
+ return t3;
90
+ }
91
+
92
+ //#endregion
93
+ export { FieldSelectActionGroup, FieldSelectTrigger };