@questpie/admin 3.2.4 → 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 (248) 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.mjs +40 -126
  8. package/dist/client/components/auth/auth-loading.mjs +9 -44
  9. package/dist/client/components/blocks/block-canvas.mjs +31 -95
  10. package/dist/client/components/blocks/block-editor-context.mjs +13 -57
  11. package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
  12. package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
  13. package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
  14. package/dist/client/components/blocks/block-insert-button.mjs +49 -165
  15. package/dist/client/components/blocks/block-item-menu.mjs +102 -301
  16. package/dist/client/components/blocks/block-item.mjs +136 -370
  17. package/dist/client/components/blocks/block-library-sidebar.mjs +103 -230
  18. package/dist/client/components/blocks/block-tree.mjs +12 -68
  19. package/dist/client/components/blocks/block-type-icon.mjs +14 -56
  20. package/dist/client/components/brand-logo.mjs +35 -149
  21. package/dist/client/components/component-renderer.mjs +42 -118
  22. package/dist/client/components/error-boundary.mjs +14 -58
  23. package/dist/client/components/fields/array-field.mjs +209 -521
  24. package/dist/client/components/fields/asset-preview-field.mjs +41 -141
  25. package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
  26. package/dist/client/components/fields/boolean-field.mjs +29 -59
  27. package/dist/client/components/fields/date-field.mjs +7 -37
  28. package/dist/client/components/fields/datetime-field.mjs +7 -38
  29. package/dist/client/components/fields/email-field.mjs +25 -54
  30. package/dist/client/components/fields/field-wrapper.mjs +30 -105
  31. package/dist/client/components/fields/json-field.mjs +94 -296
  32. package/dist/client/components/fields/locale-badge.mjs +6 -15
  33. package/dist/client/components/fields/number-field.mjs +27 -60
  34. package/dist/client/components/fields/object-array-field.mjs +283 -659
  35. package/dist/client/components/fields/object-field.mjs +165 -633
  36. package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
  37. package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
  38. package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
  39. package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
  40. package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
  41. package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
  42. package/dist/client/components/fields/relation-field.mjs +10 -66
  43. package/dist/client/components/fields/relation-picker.mjs +18 -18
  44. package/dist/client/components/fields/relation-select.mjs +12 -12
  45. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -180
  46. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
  47. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
  48. package/dist/client/components/fields/rich-text-editor/index.mjs +195 -513
  49. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
  50. package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
  51. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
  52. package/dist/client/components/fields/rich-text-field.mjs +14 -53
  53. package/dist/client/components/fields/select-field.mjs +39 -74
  54. package/dist/client/components/fields/text-field.mjs +26 -59
  55. package/dist/client/components/fields/textarea-field.mjs +26 -58
  56. package/dist/client/components/fields/time-field.mjs +7 -35
  57. package/dist/client/components/fields/upload-field.mjs +47 -165
  58. package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
  59. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
  60. package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
  61. package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
  62. package/dist/client/components/history-sidebar.mjs +285 -605
  63. package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
  64. package/dist/client/components/locale-switcher.mjs +106 -228
  65. package/dist/client/components/media/media-grid.mjs +84 -273
  66. package/dist/client/components/media/media-picker-dialog.mjs +176 -476
  67. package/dist/client/components/preview/live-preview-mode.mjs +233 -458
  68. package/dist/client/components/preview/preview-pane.mjs +22 -22
  69. package/dist/client/components/primitives/asset-preview.mjs +290 -666
  70. package/dist/client/components/primitives/checkbox-input.mjs +9 -35
  71. package/dist/client/components/primitives/date-input.mjs +109 -327
  72. package/dist/client/components/primitives/dropzone.mjs +209 -336
  73. package/dist/client/components/primitives/field-select-control.mjs +12 -80
  74. package/dist/client/components/primitives/number-input.mjs +4 -4
  75. package/dist/client/components/primitives/select-multi.mjs +200 -559
  76. package/dist/client/components/primitives/select-single.mjs +165 -499
  77. package/dist/client/components/primitives/time-input.mjs +43 -117
  78. package/dist/client/components/primitives/toggle-input.mjs +9 -29
  79. package/dist/client/components/sheets/resource-sheet.mjs +61 -70
  80. package/dist/client/components/ui/accordion.mjs +35 -155
  81. package/dist/client/components/ui/alert.mjs +13 -68
  82. package/dist/client/components/ui/badge.mjs +9 -51
  83. package/dist/client/components/ui/button.mjs +8 -54
  84. package/dist/client/components/ui/card.mjs +37 -193
  85. package/dist/client/components/ui/checkbox.mjs +12 -68
  86. package/dist/client/components/ui/command.mjs +48 -219
  87. package/dist/client/components/ui/dialog.mjs +50 -262
  88. package/dist/client/components/ui/drawer.mjs +55 -259
  89. package/dist/client/components/ui/dropdown-menu.mjs +86 -427
  90. package/dist/client/components/ui/empty-state.mjs +28 -98
  91. package/dist/client/components/ui/field.mjs +73 -309
  92. package/dist/client/components/ui/input-group.mjs +42 -167
  93. package/dist/client/components/ui/input.mjs +7 -37
  94. package/dist/client/components/ui/kbd.mjs +6 -36
  95. package/dist/client/components/ui/label.mjs +7 -37
  96. package/dist/client/components/ui/popover.mjs +34 -169
  97. package/dist/client/components/ui/responsive-dialog.mjs +67 -273
  98. package/dist/client/components/ui/scroll-fade.mjs +63 -158
  99. package/dist/client/components/ui/search-input.mjs +33 -100
  100. package/dist/client/components/ui/select.mjs +72 -393
  101. package/dist/client/components/ui/separator.mjs +7 -38
  102. package/dist/client/components/ui/sheet.mjs +49 -269
  103. package/dist/client/components/ui/sidebar.mjs +171 -690
  104. package/dist/client/components/ui/skeleton.mjs +7 -38
  105. package/dist/client/components/ui/sonner.mjs +11 -42
  106. package/dist/client/components/ui/switch.mjs +9 -45
  107. package/dist/client/components/ui/table.mjs +48 -266
  108. package/dist/client/components/ui/tabs.mjs +26 -139
  109. package/dist/client/components/ui/textarea.mjs +6 -32
  110. package/dist/client/components/ui/tooltip.mjs +27 -129
  111. package/dist/client/components/widgets/chart-widget.mjs +174 -522
  112. package/dist/client/components/widgets/progress-widget.mjs +66 -172
  113. package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
  114. package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
  115. package/dist/client/components/widgets/stats-widget.mjs +41 -175
  116. package/dist/client/components/widgets/table-widget.mjs +9 -9
  117. package/dist/client/components/widgets/timeline-widget.mjs +86 -226
  118. package/dist/client/components/widgets/value-widget.mjs +74 -381
  119. package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
  120. package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
  121. package/dist/client/contexts/focus-context.mjs +63 -146
  122. package/dist/client/hooks/typed-hooks.mjs +241 -701
  123. package/dist/client/hooks/use-action.mjs +62 -198
  124. package/dist/client/hooks/use-admin-config.mjs +5 -35
  125. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  126. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  127. package/dist/client/hooks/use-audit-history.mjs +21 -69
  128. package/dist/client/hooks/use-brand.mjs +1 -9
  129. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  130. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  131. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  132. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  133. package/dist/client/hooks/use-collection.mjs +194 -614
  134. package/dist/client/hooks/use-current-user.mjs +0 -1
  135. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  136. package/dist/client/hooks/use-field-options.mjs +61 -202
  137. package/dist/client/hooks/use-global-fields.mjs +14 -46
  138. package/dist/client/hooks/use-global-meta.mjs +9 -30
  139. package/dist/client/hooks/use-global-schema.mjs +9 -30
  140. package/dist/client/hooks/use-global.mjs +63 -219
  141. package/dist/client/hooks/use-locks.mjs +117 -325
  142. package/dist/client/hooks/use-media-query.mjs +16 -36
  143. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  144. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  145. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  146. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  147. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  148. package/dist/client/hooks/use-saved-views.mjs +22 -103
  149. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  150. package/dist/client/hooks/use-search.mjs +31 -143
  151. package/dist/client/hooks/use-server-actions.mjs +18 -50
  152. package/dist/client/hooks/use-server-validation.mjs +72 -166
  153. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  154. package/dist/client/hooks/use-setup-status.mjs +12 -25
  155. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  156. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  157. package/dist/client/hooks/use-upload.mjs +54 -152
  158. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  159. package/dist/client/hooks/use-view-state.mjs +187 -437
  160. package/dist/client/i18n/hooks.mjs +65 -197
  161. package/dist/client/lib/render-profiler.mjs +14 -41
  162. package/dist/client/preview/block-scope-context.d.mts +2 -2
  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.d.mts +2 -2
  174. package/dist/client/scope/picker.mjs +86 -321
  175. package/dist/client/scope/provider.d.mts +2 -2
  176. package/dist/client/scope/provider.mjs +8 -17
  177. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  178. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  179. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  180. package/dist/client/views/auth/auth-layout.mjs +104 -284
  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 +109 -363
  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.mjs +41 -121
  222. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  223. package/dist/client/views/pages/setup-page.mjs +33 -95
  224. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  225. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  226. package/dist/server/modules/admin/collections/account.d.mts +46 -46
  227. package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
  228. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  229. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  230. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  231. package/dist/server/modules/admin/collections/assets.d.mts +39 -39
  232. package/dist/server/modules/admin/collections/session.d.mts +41 -41
  233. package/dist/server/modules/admin/collections/user.d.mts +63 -63
  234. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  235. package/dist/server/modules/admin/index.d.mts +20 -19
  236. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  237. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  238. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  239. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  240. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  241. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  242. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  243. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  244. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +45 -45
  245. package/dist/server/modules/audit/.generated/module.d.mts +6 -6
  246. package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
  247. package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
  248. package/package.json +3 -5
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { cn } from "../../lib/utils.mjs";
4
4
  import { Label } from "./label.mjs";
5
- import { c } from "react/compiler-runtime";
6
5
  import * as React from "react";
6
+ import { useMemo } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { cva } from "class-variance-authority";
9
9
 
@@ -17,37 +17,12 @@ const FieldIdsContext = React.createContext(null);
17
17
  function useFieldIds() {
18
18
  return React.useContext(FieldIdsContext);
19
19
  }
20
- function FieldGroup(t0) {
21
- const $ = c(8);
22
- let className;
23
- let props;
24
- if ($[0] !== t0) {
25
- ({className, ...props} = t0);
26
- $[0] = t0;
27
- $[1] = className;
28
- $[2] = props;
29
- } else {
30
- className = $[1];
31
- props = $[2];
32
- }
33
- let t1;
34
- if ($[3] !== className) {
35
- t1 = cn("qa-field-group group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4", className);
36
- $[3] = className;
37
- $[4] = t1;
38
- } else t1 = $[4];
39
- let t2;
40
- if ($[5] !== props || $[6] !== t1) {
41
- t2 = /* @__PURE__ */ jsx("div", {
42
- "data-slot": "field-group",
43
- className: t1,
44
- ...props
45
- });
46
- $[5] = props;
47
- $[6] = t1;
48
- $[7] = t2;
49
- } else t2 = $[7];
50
- return t2;
20
+ function FieldGroup({ className, ...props }) {
21
+ return /* @__PURE__ */ jsx("div", {
22
+ "data-slot": "field-group",
23
+ className: cn("qa-field-group group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4", className),
24
+ ...props
25
+ });
51
26
  }
52
27
  const fieldVariants = cva("qa-field data-[invalid=true]:text-destructive group/field flex w-full gap-2", {
53
28
  variants: { orientation: {
@@ -57,297 +32,86 @@ const fieldVariants = cva("qa-field data-[invalid=true]:text-destructive group/f
57
32
  } },
58
33
  defaultVariants: { orientation: "vertical" }
59
34
  });
60
- function Field(t0) {
61
- const $ = c(20);
62
- let className;
63
- let props;
64
- let t1;
65
- if ($[0] !== t0) {
66
- ({className, orientation: t1, ...props} = t0);
67
- $[0] = t0;
68
- $[1] = className;
69
- $[2] = props;
70
- $[3] = t1;
71
- } else {
72
- className = $[1];
73
- props = $[2];
74
- t1 = $[3];
75
- }
76
- const orientation = t1 === void 0 ? "vertical" : t1;
35
+ function Field({ className, orientation = "vertical", ...props }) {
77
36
  const baseId = React.useId();
78
37
  const [hasDescription, setHasDescription] = React.useState(false);
79
38
  const [hasError, setHasError] = React.useState(false);
80
- const t2 = `${baseId}-desc`;
81
- const t3 = `${baseId}-err`;
82
- let t4;
83
- if ($[4] !== baseId || $[5] !== hasDescription || $[6] !== hasError || $[7] !== t2 || $[8] !== t3) {
84
- t4 = {
85
- baseId,
86
- descriptionId: t2,
87
- errorId: t3,
88
- hasDescription,
89
- hasError,
90
- setHasDescription,
91
- setHasError
92
- };
93
- $[4] = baseId;
94
- $[5] = hasDescription;
95
- $[6] = hasError;
96
- $[7] = t2;
97
- $[8] = t3;
98
- $[9] = t4;
99
- } else t4 = $[9];
100
- const ids = t4;
101
- let t5;
102
- if ($[10] !== className || $[11] !== orientation) {
103
- t5 = cn(fieldVariants({ orientation }), className);
104
- $[10] = className;
105
- $[11] = orientation;
106
- $[12] = t5;
107
- } else t5 = $[12];
108
- let t6;
109
- if ($[13] !== orientation || $[14] !== props || $[15] !== t5) {
110
- t6 = /* @__PURE__ */ jsx("div", {
39
+ const ids = useMemo(() => ({
40
+ baseId,
41
+ descriptionId: `${baseId}-desc`,
42
+ errorId: `${baseId}-err`,
43
+ hasDescription,
44
+ hasError,
45
+ setHasDescription,
46
+ setHasError
47
+ }), [
48
+ baseId,
49
+ hasDescription,
50
+ hasError
51
+ ]);
52
+ return /* @__PURE__ */ jsx(FieldIdsContext.Provider, {
53
+ value: ids,
54
+ children: /* @__PURE__ */ jsx("div", {
111
55
  role: "group",
112
56
  "data-slot": "field",
113
57
  "data-orientation": orientation,
114
- className: t5,
58
+ className: cn(fieldVariants({ orientation }), className),
115
59
  ...props
116
- });
117
- $[13] = orientation;
118
- $[14] = props;
119
- $[15] = t5;
120
- $[16] = t6;
121
- } else t6 = $[16];
122
- let t7;
123
- if ($[17] !== ids || $[18] !== t6) {
124
- t7 = /* @__PURE__ */ jsx(FieldIdsContext.Provider, {
125
- value: ids,
126
- children: t6
127
- });
128
- $[17] = ids;
129
- $[18] = t6;
130
- $[19] = t7;
131
- } else t7 = $[19];
132
- return t7;
60
+ })
61
+ });
133
62
  }
134
- function FieldContent(t0) {
135
- const $ = c(8);
136
- let className;
137
- let props;
138
- if ($[0] !== t0) {
139
- ({className, ...props} = t0);
140
- $[0] = t0;
141
- $[1] = className;
142
- $[2] = props;
143
- } else {
144
- className = $[1];
145
- props = $[2];
146
- }
147
- let t1;
148
- if ($[3] !== className) {
149
- t1 = cn("qa-field__content group/field-content flex flex-1 flex-col gap-0.5 leading-snug", className);
150
- $[3] = className;
151
- $[4] = t1;
152
- } else t1 = $[4];
153
- let t2;
154
- if ($[5] !== props || $[6] !== t1) {
155
- t2 = /* @__PURE__ */ jsx("div", {
156
- "data-slot": "field-content",
157
- className: t1,
158
- ...props
159
- });
160
- $[5] = props;
161
- $[6] = t1;
162
- $[7] = t2;
163
- } else t2 = $[7];
164
- return t2;
63
+ function FieldContent({ className, ...props }) {
64
+ return /* @__PURE__ */ jsx("div", {
65
+ "data-slot": "field-content",
66
+ className: cn("qa-field__content group/field-content flex flex-1 flex-col gap-0.5 leading-snug", className),
67
+ ...props
68
+ });
165
69
  }
166
- function FieldLabel(t0) {
167
- const $ = c(8);
168
- let className;
169
- let props;
170
- if ($[0] !== t0) {
171
- ({className, ...props} = t0);
172
- $[0] = t0;
173
- $[1] = className;
174
- $[2] = props;
175
- } else {
176
- className = $[1];
177
- props = $[2];
178
- }
179
- let t1;
180
- if ($[3] !== className) {
181
- t1 = cn("qa-field__label has-data-checked:bg-accent has-data-checked:text-accent-foreground group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-2", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className);
182
- $[3] = className;
183
- $[4] = t1;
184
- } else t1 = $[4];
185
- let t2;
186
- if ($[5] !== props || $[6] !== t1) {
187
- t2 = /* @__PURE__ */ jsx(Label, {
188
- "data-slot": "field-label",
189
- className: t1,
190
- ...props
191
- });
192
- $[5] = props;
193
- $[6] = t1;
194
- $[7] = t2;
195
- } else t2 = $[7];
196
- return t2;
70
+ function FieldLabel({ className, ...props }) {
71
+ return /* @__PURE__ */ jsx(Label, {
72
+ "data-slot": "field-label",
73
+ className: cn("qa-field__label has-data-checked:bg-accent has-data-checked:text-accent-foreground group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-2", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className),
74
+ ...props
75
+ });
197
76
  }
198
- function FieldDescription(t0) {
199
- const $ = c(12);
200
- let className;
201
- let props;
202
- if ($[0] !== t0) {
203
- ({className, ...props} = t0);
204
- $[0] = t0;
205
- $[1] = className;
206
- $[2] = props;
207
- } else {
208
- className = $[1];
209
- props = $[2];
210
- }
77
+ function FieldDescription({ className, ...props }) {
211
78
  const fieldIds = React.useContext(FieldIdsContext);
212
- let t1;
213
- let t2;
214
- if ($[3] !== fieldIds) {
215
- t1 = () => {
216
- fieldIds?.setHasDescription(true);
217
- return () => fieldIds?.setHasDescription(false);
218
- };
219
- t2 = [fieldIds];
220
- $[3] = fieldIds;
221
- $[4] = t1;
222
- $[5] = t2;
223
- } else {
224
- t1 = $[4];
225
- t2 = $[5];
226
- }
227
- React.useEffect(t1, t2);
228
- const t3 = fieldIds?.descriptionId;
229
- let t4;
230
- if ($[6] !== className) {
231
- t4 = cn("qa-field__description text-muted-foreground text-left text-xs/relaxed leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance [[data-variant=legend]+&]:-mt-1.5", "last:mt-0 nth-last-2:-mt-1", "[&>a:hover]:text-foreground [&>a]:underline [&>a]:underline-offset-4", className);
232
- $[6] = className;
233
- $[7] = t4;
234
- } else t4 = $[7];
235
- let t5;
236
- if ($[8] !== props || $[9] !== t3 || $[10] !== t4) {
237
- t5 = /* @__PURE__ */ jsx("p", {
238
- id: t3,
239
- "data-slot": "field-description",
240
- className: t4,
241
- ...props
242
- });
243
- $[8] = props;
244
- $[9] = t3;
245
- $[10] = t4;
246
- $[11] = t5;
247
- } else t5 = $[11];
248
- return t5;
79
+ React.useEffect(() => {
80
+ fieldIds?.setHasDescription(true);
81
+ return () => fieldIds?.setHasDescription(false);
82
+ }, [fieldIds]);
83
+ return /* @__PURE__ */ jsx("p", {
84
+ id: fieldIds?.descriptionId,
85
+ "data-slot": "field-description",
86
+ className: cn("qa-field__description text-muted-foreground text-left text-xs/relaxed leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance [[data-variant=legend]+&]:-mt-1.5", "last:mt-0 nth-last-2:-mt-1", "[&>a:hover]:text-foreground [&>a]:underline [&>a]:underline-offset-4", className),
87
+ ...props
88
+ });
249
89
  }
250
- function FieldError(t0) {
251
- const $ = c(20);
252
- let children;
253
- let className;
254
- let errors;
255
- let props;
256
- if ($[0] !== t0) {
257
- ({className, children, errors, ...props} = t0);
258
- $[0] = t0;
259
- $[1] = children;
260
- $[2] = className;
261
- $[3] = errors;
262
- $[4] = props;
263
- } else {
264
- children = $[1];
265
- className = $[2];
266
- errors = $[3];
267
- props = $[4];
268
- }
90
+ function FieldError({ className, children, errors, ...props }) {
269
91
  const fieldIds = React.useContext(FieldIdsContext);
270
- let t1;
271
- bb0: {
272
- if (children) {
273
- t1 = children;
274
- break bb0;
275
- }
276
- if (!errors?.length) {
277
- t1 = null;
278
- break bb0;
279
- }
280
- let t2$1;
281
- if ($[5] !== errors) {
282
- t2$1 = [...new Map(errors.map(_temp)).values()];
283
- $[5] = errors;
284
- $[6] = t2$1;
285
- } else t2$1 = $[6];
286
- const uniqueErrors = t2$1;
287
- if (uniqueErrors?.length == 1) {
288
- t1 = uniqueErrors[0]?.message;
289
- break bb0;
290
- }
291
- let t3$1;
292
- if ($[7] !== uniqueErrors) {
293
- t3$1 = /* @__PURE__ */ jsx("ul", {
294
- className: "ml-4 flex list-disc flex-col gap-1",
295
- children: uniqueErrors.map(_temp2)
296
- });
297
- $[7] = uniqueErrors;
298
- $[8] = t3$1;
299
- } else t3$1 = $[8];
300
- t1 = t3$1;
301
- }
302
- const content = t1;
303
- let t2;
304
- let t3;
305
- if ($[9] !== content || $[10] !== fieldIds) {
306
- t2 = () => {
307
- fieldIds?.setHasError(!!content);
308
- return () => fieldIds?.setHasError(false);
309
- };
310
- t3 = [fieldIds, content];
311
- $[9] = content;
312
- $[10] = fieldIds;
313
- $[11] = t2;
314
- $[12] = t3;
315
- } else {
316
- t2 = $[11];
317
- t3 = $[12];
318
- }
319
- React.useEffect(t2, t3);
320
- if (!content) return null;
321
- const t4 = fieldIds?.errorId;
322
- let t5;
323
- if ($[13] !== className) {
324
- t5 = cn("qa-field__error text-destructive text-xs/relaxed font-normal", className);
325
- $[13] = className;
326
- $[14] = t5;
327
- } else t5 = $[14];
328
- let t6;
329
- if ($[15] !== content || $[16] !== props || $[17] !== t4 || $[18] !== t5) {
330
- t6 = /* @__PURE__ */ jsx("div", {
331
- id: t4,
332
- role: "alert",
333
- "data-slot": "field-error",
334
- className: t5,
335
- ...props,
336
- children: content
92
+ const content = useMemo(() => {
93
+ if (children) return children;
94
+ if (!errors?.length) return null;
95
+ const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];
96
+ if (uniqueErrors?.length == 1) return uniqueErrors[0]?.message;
97
+ return /* @__PURE__ */ jsx("ul", {
98
+ className: "ml-4 flex list-disc flex-col gap-1",
99
+ children: uniqueErrors.map((error) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, error.message))
337
100
  });
338
- $[15] = content;
339
- $[16] = props;
340
- $[17] = t4;
341
- $[18] = t5;
342
- $[19] = t6;
343
- } else t6 = $[19];
344
- return t6;
345
- }
346
- function _temp2(error_0) {
347
- return error_0?.message && /* @__PURE__ */ jsx("li", { children: error_0.message }, error_0.message);
348
- }
349
- function _temp(error) {
350
- return [error?.message, error];
101
+ }, [children, errors]);
102
+ React.useEffect(() => {
103
+ fieldIds?.setHasError(!!content);
104
+ return () => fieldIds?.setHasError(false);
105
+ }, [fieldIds, content]);
106
+ if (!content) return null;
107
+ return /* @__PURE__ */ jsx("div", {
108
+ id: fieldIds?.errorId,
109
+ role: "alert",
110
+ "data-slot": "field-error",
111
+ className: cn("qa-field__error text-destructive text-xs/relaxed font-normal", className),
112
+ ...props,
113
+ children: content
114
+ });
351
115
  }
352
116
 
353
117
  //#endregion
@@ -3,43 +3,17 @@
3
3
  import { cn } from "../../lib/utils.mjs";
4
4
  import { Button } from "./button.mjs";
5
5
  import { Input } from "./input.mjs";
6
- import { c } from "react/compiler-runtime";
7
6
  import { jsx } from "react/jsx-runtime";
8
7
  import { cva } from "class-variance-authority";
9
8
 
10
9
  //#region src/client/components/ui/input-group.tsx
11
- function InputGroup(t0) {
12
- const $ = c(8);
13
- let className;
14
- let props;
15
- if ($[0] !== t0) {
16
- ({className, ...props} = t0);
17
- $[0] = t0;
18
- $[1] = className;
19
- $[2] = props;
20
- } else {
21
- className = $[1];
22
- props = $[2];
23
- }
24
- let t1;
25
- if ($[3] !== className) {
26
- t1 = cn("qa-input-group control-surface font-chrome has-[[data-slot=input-group-control]:focus-visible]:border-border-strong has-[[data-slot=input-group-control]:focus-visible]:ring-ring/20 has-[[data-slot=input-group-control][aria-expanded=true]]:border-border-strong has-[[data-slot=input-group-control][aria-expanded=true]]:ring-ring/20 has-[[data-slot][aria-invalid=true]]:ring-ring/20 has-[[data-slot][aria-invalid=true]]:border-border-strong group/input-group hover:border-border-strong/70 relative flex w-full min-w-0 items-center overflow-hidden outline-none has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control][aria-expanded=true]]:ring-[3px] has-[[data-slot][aria-invalid=true]]:ring-[3px] has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0", className);
27
- $[3] = className;
28
- $[4] = t1;
29
- } else t1 = $[4];
30
- let t2;
31
- if ($[5] !== props || $[6] !== t1) {
32
- t2 = /* @__PURE__ */ jsx("div", {
33
- "data-slot": "input-group",
34
- role: "group",
35
- className: t1,
36
- ...props
37
- });
38
- $[5] = props;
39
- $[6] = t1;
40
- $[7] = t2;
41
- } else t2 = $[7];
42
- return t2;
10
+ function InputGroup({ className, ...props }) {
11
+ return /* @__PURE__ */ jsx("div", {
12
+ "data-slot": "input-group",
13
+ role: "group",
14
+ className: cn("qa-input-group control-surface font-chrome has-[[data-slot=input-group-control]:focus-visible]:border-border-strong has-[[data-slot=input-group-control]:focus-visible]:ring-ring/20 has-[[data-slot=input-group-control][aria-expanded=true]]:border-border-strong has-[[data-slot=input-group-control][aria-expanded=true]]:ring-ring/20 has-[[data-slot][aria-invalid=true]]:ring-ring/20 has-[[data-slot][aria-invalid=true]]:border-border-strong group/input-group hover:border-border-strong/70 relative flex w-full min-w-0 items-center overflow-hidden outline-none has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control][aria-expanded=true]]:ring-[3px] has-[[data-slot][aria-invalid=true]]:ring-[3px] has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0", className),
15
+ ...props
16
+ });
43
17
  }
44
18
  const inputGroupAddonVariants = cva("qa-input-group__addon font-chrome text-muted-foreground **:data-[slot=kbd]:bg-muted-foreground/10 flex h-full cursor-text items-center justify-center gap-1 py-1 text-xs/relaxed font-medium select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5", {
45
19
  variants: { align: {
@@ -50,60 +24,27 @@ const inputGroupAddonVariants = cva("qa-input-group__addon font-chrome text-mute
50
24
  } },
51
25
  defaultVariants: { align: "inline-start" }
52
26
  });
53
- function InputGroupAddon(t0) {
54
- const $ = c(11);
55
- let className;
56
- let props;
57
- let t1;
58
- if ($[0] !== t0) {
59
- ({className, align: t1, ...props} = t0);
60
- $[0] = t0;
61
- $[1] = className;
62
- $[2] = props;
63
- $[3] = t1;
64
- } else {
65
- className = $[1];
66
- props = $[2];
67
- t1 = $[3];
68
- }
69
- const align = t1 === void 0 ? "inline-start" : t1;
70
- const handleClick = _temp;
71
- const handleKeyDown = _temp2;
72
- let t2;
73
- if ($[4] !== align || $[5] !== className) {
74
- t2 = cn(inputGroupAddonVariants({ align }), className);
75
- $[4] = align;
76
- $[5] = className;
77
- $[6] = t2;
78
- } else t2 = $[6];
79
- let t3;
80
- if ($[7] !== align || $[8] !== props || $[9] !== t2) {
81
- t3 = /* @__PURE__ */ jsx("div", {
82
- role: "button",
83
- tabIndex: 0,
84
- "data-slot": "input-group-addon",
85
- "data-align": align,
86
- className: t2,
87
- onClick: handleClick,
88
- onKeyDown: handleKeyDown,
89
- ...props
90
- });
91
- $[7] = align;
92
- $[8] = props;
93
- $[9] = t2;
94
- $[10] = t3;
95
- } else t3 = $[10];
96
- return t3;
97
- }
98
- function _temp2(e_0) {
99
- if (e_0.key === "Enter" || e_0.key === " ") {
100
- e_0.preventDefault();
101
- e_0.currentTarget.parentElement?.querySelector("input")?.focus();
102
- }
103
- }
104
- function _temp(e) {
105
- if (e.target.closest("button")) return;
106
- e.currentTarget.parentElement?.querySelector("input")?.focus();
27
+ function InputGroupAddon({ className, align = "inline-start", ...props }) {
28
+ const handleClick = (e) => {
29
+ if (e.target.closest("button")) return;
30
+ e.currentTarget.parentElement?.querySelector("input")?.focus();
31
+ };
32
+ const handleKeyDown = (e) => {
33
+ if (e.key === "Enter" || e.key === " ") {
34
+ e.preventDefault();
35
+ e.currentTarget.parentElement?.querySelector("input")?.focus();
36
+ }
37
+ };
38
+ return /* @__PURE__ */ jsx("div", {
39
+ role: "button",
40
+ tabIndex: 0,
41
+ "data-slot": "input-group-addon",
42
+ "data-align": align,
43
+ className: cn(inputGroupAddonVariants({ align }), className),
44
+ onClick: handleClick,
45
+ onKeyDown: handleKeyDown,
46
+ ...props
47
+ });
107
48
  }
108
49
  const inputGroupButtonVariants = cva("qa-input-group__button flex items-center gap-2 rounded-[var(--control-radius-inner)] text-xs/relaxed shadow-none", {
109
50
  variants: { size: {
@@ -114,87 +55,21 @@ const inputGroupButtonVariants = cva("qa-input-group__button flex items-center g
114
55
  } },
115
56
  defaultVariants: { size: "xs" }
116
57
  });
117
- function InputGroupButton(t0) {
118
- const $ = c(15);
119
- let className;
120
- let props;
121
- let t1;
122
- let t2;
123
- let t3;
124
- if ($[0] !== t0) {
125
- ({className, type: t1, variant: t2, size: t3, ...props} = t0);
126
- $[0] = t0;
127
- $[1] = className;
128
- $[2] = props;
129
- $[3] = t1;
130
- $[4] = t2;
131
- $[5] = t3;
132
- } else {
133
- className = $[1];
134
- props = $[2];
135
- t1 = $[3];
136
- t2 = $[4];
137
- t3 = $[5];
138
- }
139
- const type = t1 === void 0 ? "button" : t1;
140
- const variant = t2 === void 0 ? "ghost" : t2;
141
- const size = t3 === void 0 ? "xs" : t3;
142
- let t4;
143
- if ($[6] !== className || $[7] !== size) {
144
- t4 = cn(inputGroupButtonVariants({ size }), className);
145
- $[6] = className;
146
- $[7] = size;
147
- $[8] = t4;
148
- } else t4 = $[8];
149
- let t5;
150
- if ($[9] !== props || $[10] !== size || $[11] !== t4 || $[12] !== type || $[13] !== variant) {
151
- t5 = /* @__PURE__ */ jsx(Button, {
152
- type,
153
- "data-size": size,
154
- variant,
155
- className: t4,
156
- ...props
157
- });
158
- $[9] = props;
159
- $[10] = size;
160
- $[11] = t4;
161
- $[12] = type;
162
- $[13] = variant;
163
- $[14] = t5;
164
- } else t5 = $[14];
165
- return t5;
58
+ function InputGroupButton({ className, type = "button", variant = "ghost", size = "xs", ...props }) {
59
+ return /* @__PURE__ */ jsx(Button, {
60
+ type,
61
+ "data-size": size,
62
+ variant,
63
+ className: cn(inputGroupButtonVariants({ size }), className),
64
+ ...props
65
+ });
166
66
  }
167
- function InputGroupInput(t0) {
168
- const $ = c(8);
169
- let className;
170
- let props;
171
- if ($[0] !== t0) {
172
- ({className, ...props} = t0);
173
- $[0] = t0;
174
- $[1] = className;
175
- $[2] = props;
176
- } else {
177
- className = $[1];
178
- props = $[2];
179
- }
180
- let t1;
181
- if ($[3] !== className) {
182
- t1 = cn("qa-input-group__input flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0", className);
183
- $[3] = className;
184
- $[4] = t1;
185
- } else t1 = $[4];
186
- let t2;
187
- if ($[5] !== props || $[6] !== t1) {
188
- t2 = /* @__PURE__ */ jsx(Input, {
189
- "data-slot": "input-group-control",
190
- className: t1,
191
- ...props
192
- });
193
- $[5] = props;
194
- $[6] = t1;
195
- $[7] = t2;
196
- } else t2 = $[7];
197
- return t2;
67
+ function InputGroupInput({ className, ...props }) {
68
+ return /* @__PURE__ */ jsx(Input, {
69
+ "data-slot": "input-group-control",
70
+ className: cn("qa-input-group__input flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0", className),
71
+ ...props
72
+ });
198
73
  }
199
74
 
200
75
  //#endregion