@questpie/admin 3.2.3 → 3.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/dist/client/blocks/block-renderer.d.mts +2 -2
  2. package/dist/client/blocks/block-renderer.mjs +164 -339
  3. package/dist/client/components/actions/action-button.mjs +9 -9
  4. package/dist/client/components/actions/action-dialog.mjs +195 -493
  5. package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
  6. package/dist/client/components/actions/header-actions.mjs +73 -165
  7. package/dist/client/components/admin-link.d.mts +2 -2
  8. package/dist/client/components/admin-link.mjs +40 -126
  9. package/dist/client/components/auth/auth-loading.mjs +9 -44
  10. package/dist/client/components/blocks/block-canvas.mjs +31 -95
  11. package/dist/client/components/blocks/block-editor-context.mjs +13 -57
  12. package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
  13. package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
  14. package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
  15. package/dist/client/components/blocks/block-insert-button.mjs +49 -165
  16. package/dist/client/components/blocks/block-item-menu.mjs +102 -301
  17. package/dist/client/components/blocks/block-item.mjs +136 -370
  18. package/dist/client/components/blocks/block-library-sidebar.mjs +106 -220
  19. package/dist/client/components/blocks/block-tree.mjs +12 -68
  20. package/dist/client/components/blocks/block-type-icon.mjs +14 -56
  21. package/dist/client/components/brand-logo.mjs +35 -149
  22. package/dist/client/components/component-renderer.mjs +42 -118
  23. package/dist/client/components/error-boundary.mjs +14 -58
  24. package/dist/client/components/fields/array-field.mjs +209 -521
  25. package/dist/client/components/fields/asset-preview-field.mjs +41 -141
  26. package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
  27. package/dist/client/components/fields/boolean-field.mjs +29 -59
  28. package/dist/client/components/fields/date-field.mjs +7 -37
  29. package/dist/client/components/fields/datetime-field.mjs +7 -38
  30. package/dist/client/components/fields/email-field.mjs +25 -54
  31. package/dist/client/components/fields/field-wrapper.mjs +30 -105
  32. package/dist/client/components/fields/json-field.mjs +107 -313
  33. package/dist/client/components/fields/locale-badge.mjs +6 -15
  34. package/dist/client/components/fields/number-field.mjs +27 -60
  35. package/dist/client/components/fields/object-array-field.mjs +283 -659
  36. package/dist/client/components/fields/object-field.mjs +165 -633
  37. package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
  38. package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
  39. package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
  40. package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
  41. package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
  42. package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
  43. package/dist/client/components/fields/relation-field.mjs +10 -66
  44. package/dist/client/components/fields/relation-picker.mjs +18 -18
  45. package/dist/client/components/fields/relation-select.mjs +12 -12
  46. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -182
  47. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +8 -19
  48. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
  49. package/dist/client/components/fields/rich-text-editor/index.mjs +196 -530
  50. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
  51. package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
  52. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
  53. package/dist/client/components/fields/rich-text-field.mjs +14 -53
  54. package/dist/client/components/fields/select-field.mjs +39 -74
  55. package/dist/client/components/fields/text-field.mjs +26 -59
  56. package/dist/client/components/fields/textarea-field.mjs +26 -58
  57. package/dist/client/components/fields/time-field.mjs +7 -35
  58. package/dist/client/components/fields/upload-field.mjs +47 -165
  59. package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
  60. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
  61. package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
  62. package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
  63. package/dist/client/components/history-sidebar.mjs +306 -611
  64. package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
  65. package/dist/client/components/locale-switcher.mjs +106 -228
  66. package/dist/client/components/media/media-grid.mjs +84 -273
  67. package/dist/client/components/media/media-picker-dialog.mjs +177 -494
  68. package/dist/client/components/preview/live-preview-mode.mjs +240 -438
  69. package/dist/client/components/preview/preview-pane.mjs +22 -22
  70. package/dist/client/components/primitives/asset-preview.mjs +290 -666
  71. package/dist/client/components/primitives/checkbox-input.mjs +9 -35
  72. package/dist/client/components/primitives/date-input.mjs +109 -327
  73. package/dist/client/components/primitives/dropzone.mjs +209 -336
  74. package/dist/client/components/primitives/field-select-control.mjs +12 -80
  75. package/dist/client/components/primitives/number-input.mjs +4 -4
  76. package/dist/client/components/primitives/select-multi.mjs +200 -559
  77. package/dist/client/components/primitives/select-single.mjs +165 -499
  78. package/dist/client/components/primitives/time-input.mjs +43 -117
  79. package/dist/client/components/primitives/toggle-input.mjs +9 -29
  80. package/dist/client/components/sheets/resource-sheet.mjs +61 -70
  81. package/dist/client/components/ui/accordion.mjs +35 -155
  82. package/dist/client/components/ui/alert.mjs +13 -68
  83. package/dist/client/components/ui/badge.mjs +9 -51
  84. package/dist/client/components/ui/button.mjs +8 -54
  85. package/dist/client/components/ui/card.mjs +37 -193
  86. package/dist/client/components/ui/checkbox.mjs +12 -68
  87. package/dist/client/components/ui/command.mjs +48 -219
  88. package/dist/client/components/ui/dialog.mjs +50 -262
  89. package/dist/client/components/ui/drawer.mjs +55 -259
  90. package/dist/client/components/ui/dropdown-menu.mjs +86 -427
  91. package/dist/client/components/ui/empty-state.mjs +28 -98
  92. package/dist/client/components/ui/field.mjs +73 -309
  93. package/dist/client/components/ui/input-group.mjs +42 -167
  94. package/dist/client/components/ui/input.mjs +7 -37
  95. package/dist/client/components/ui/kbd.mjs +6 -36
  96. package/dist/client/components/ui/label.mjs +7 -37
  97. package/dist/client/components/ui/popover.mjs +34 -169
  98. package/dist/client/components/ui/responsive-dialog.mjs +67 -273
  99. package/dist/client/components/ui/scroll-fade.mjs +63 -158
  100. package/dist/client/components/ui/search-input.mjs +33 -100
  101. package/dist/client/components/ui/select.mjs +72 -393
  102. package/dist/client/components/ui/separator.mjs +7 -38
  103. package/dist/client/components/ui/sheet.mjs +49 -269
  104. package/dist/client/components/ui/sidebar.mjs +171 -690
  105. package/dist/client/components/ui/skeleton.mjs +7 -38
  106. package/dist/client/components/ui/sonner.mjs +11 -42
  107. package/dist/client/components/ui/switch.mjs +9 -45
  108. package/dist/client/components/ui/table.mjs +48 -266
  109. package/dist/client/components/ui/tabs.mjs +26 -139
  110. package/dist/client/components/ui/textarea.mjs +6 -32
  111. package/dist/client/components/ui/tooltip.mjs +27 -129
  112. package/dist/client/components/widgets/chart-widget.mjs +174 -522
  113. package/dist/client/components/widgets/progress-widget.mjs +66 -172
  114. package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
  115. package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
  116. package/dist/client/components/widgets/stats-widget.mjs +41 -175
  117. package/dist/client/components/widgets/table-widget.mjs +9 -9
  118. package/dist/client/components/widgets/timeline-widget.mjs +86 -226
  119. package/dist/client/components/widgets/value-widget.mjs +74 -381
  120. package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
  121. package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
  122. package/dist/client/contexts/focus-context.d.mts +4 -0
  123. package/dist/client/contexts/focus-context.mjs +87 -150
  124. package/dist/client/hooks/typed-hooks.mjs +241 -701
  125. package/dist/client/hooks/use-action.mjs +62 -198
  126. package/dist/client/hooks/use-admin-config.mjs +5 -35
  127. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  128. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  129. package/dist/client/hooks/use-audit-history.mjs +21 -69
  130. package/dist/client/hooks/use-brand.mjs +1 -9
  131. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  132. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  133. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  134. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  135. package/dist/client/hooks/use-collection.mjs +194 -614
  136. package/dist/client/hooks/use-current-user.mjs +0 -1
  137. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  138. package/dist/client/hooks/use-field-options.mjs +61 -202
  139. package/dist/client/hooks/use-global-fields.mjs +14 -46
  140. package/dist/client/hooks/use-global-meta.mjs +9 -30
  141. package/dist/client/hooks/use-global-schema.mjs +9 -30
  142. package/dist/client/hooks/use-global.mjs +63 -219
  143. package/dist/client/hooks/use-locks.mjs +117 -325
  144. package/dist/client/hooks/use-media-query.mjs +16 -36
  145. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  146. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  147. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  148. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  149. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  150. package/dist/client/hooks/use-saved-views.mjs +22 -103
  151. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  152. package/dist/client/hooks/use-search.mjs +31 -143
  153. package/dist/client/hooks/use-server-actions.mjs +18 -50
  154. package/dist/client/hooks/use-server-validation.mjs +72 -166
  155. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  156. package/dist/client/hooks/use-setup-status.mjs +12 -25
  157. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  158. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  159. package/dist/client/hooks/use-upload.mjs +54 -152
  160. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  161. package/dist/client/hooks/use-view-state.mjs +187 -437
  162. package/dist/client/i18n/hooks.mjs +65 -197
  163. package/dist/client/lib/render-profiler.mjs +14 -41
  164. package/dist/client/preview/block-scope-context.d.mts +2 -2
  165. package/dist/client/preview/block-scope-context.mjs +14 -36
  166. package/dist/client/preview/diff.mjs +110 -0
  167. package/dist/client/preview/preview-banner.mjs +42 -108
  168. package/dist/client/preview/preview-field.d.mts +4 -4
  169. package/dist/client/preview/preview-field.mjs +166 -409
  170. package/dist/client/preview/use-collection-preview.mjs +135 -201
  171. package/dist/client/runtime/content-locales-provider.mjs +31 -83
  172. package/dist/client/runtime/locale-scope.mjs +22 -63
  173. package/dist/client/runtime/provider.mjs +100 -255
  174. package/dist/client/runtime/translations-provider.mjs +41 -107
  175. package/dist/client/scope/picker.d.mts +2 -2
  176. package/dist/client/scope/picker.mjs +86 -321
  177. package/dist/client/scope/provider.d.mts +2 -2
  178. package/dist/client/scope/provider.mjs +8 -17
  179. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  180. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  181. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  182. package/dist/client/views/auth/auth-layout.mjs +104 -284
  183. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  184. package/dist/client/views/auth/forgot-password-form.mjs +94 -325
  185. package/dist/client/views/auth/invite-form.mjs +107 -442
  186. package/dist/client/views/auth/login-form.d.mts +2 -2
  187. package/dist/client/views/auth/login-form.mjs +116 -337
  188. package/dist/client/views/auth/reset-password-form.mjs +128 -453
  189. package/dist/client/views/auth/setup-form.mjs +140 -478
  190. package/dist/client/views/collection/auto-form-fields.mjs +243 -615
  191. package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -400
  192. package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
  193. package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
  194. package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
  195. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
  196. package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
  197. package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
  198. package/dist/client/views/collection/columns/build-columns.mjs +8 -48
  199. package/dist/client/views/collection/field-renderer.mjs +11 -24
  200. package/dist/client/views/collection/form-view.mjs +288 -560
  201. package/dist/client/views/collection/table-view.mjs +239 -469
  202. package/dist/client/views/collection/view-skeletons.mjs +112 -237
  203. package/dist/client/views/common/global-search.mjs +241 -543
  204. package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
  205. package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
  206. package/dist/client/views/dashboard/widget-card.mjs +61 -269
  207. package/dist/client/views/globals/global-form-view.mjs +478 -1298
  208. package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
  209. package/dist/client/views/layout/admin-layout.mjs +83 -246
  210. package/dist/client/views/layout/admin-router.mjs +457 -1289
  211. package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
  212. package/dist/client/views/layout/admin-theme.mjs +30 -64
  213. package/dist/client/views/layout/admin-view-layout.mjs +40 -144
  214. package/dist/client/views/pages/accept-invite-page.mjs +95 -290
  215. package/dist/client/views/pages/dashboard-page.mjs +11 -57
  216. package/dist/client/views/pages/forgot-password-page.mjs +31 -83
  217. package/dist/client/views/pages/invite-page.mjs +35 -90
  218. package/dist/client/views/pages/login-page.mjs +41 -121
  219. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  220. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  221. package/dist/client/views/pages/setup-page.d.mts +2 -2
  222. package/dist/client/views/pages/setup-page.mjs +33 -95
  223. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  224. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  225. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  226. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  227. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  228. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  229. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  230. package/dist/server/modules/admin/collections/assets.d.mts +34 -34
  231. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  232. package/dist/server/modules/admin/collections/user.d.mts +53 -53
  233. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  234. package/dist/server/modules/admin/index.d.mts +21 -20
  235. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  236. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  237. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  238. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  239. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  240. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  241. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  242. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  243. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
  244. package/package.json +3 -5
@@ -7,10 +7,9 @@ import { InputGroup, InputGroupAddon, InputGroupInput } from "../../components/u
7
7
  import { ResponsiveDialog, ResponsiveDialogContent } from "../../components/ui/responsive-dialog.mjs";
8
8
  import { Kbd } from "../../components/ui/kbd.mjs";
9
9
  import { useDebouncedValue, useGlobalSearch } from "../../hooks/use-search.mjs";
10
- import { c } from "react/compiler-runtime";
11
10
  import { Icon } from "@iconify/react";
12
11
  import * as React from "react";
13
- import { useRef, useState } from "react";
12
+ import { useCallback, useMemo, useRef, useState } from "react";
14
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
14
 
16
15
  //#region src/client/views/common/global-search.tsx
@@ -35,11 +34,11 @@ const DEFAULT_FILE_ICON = "ph:file";
35
34
  * Server config entries come as plain objects without strict typing.
36
35
  */
37
36
  function getConfigProps(config) {
38
- const c$1 = config;
37
+ const c = config;
39
38
  return {
40
- label: c$1?.label,
41
- icon: c$1?.icon,
42
- hidden: c$1?.hidden
39
+ label: c?.label,
40
+ icon: c?.icon,
41
+ hidden: c?.hidden
43
42
  };
44
43
  }
45
44
  /**
@@ -75,33 +74,17 @@ function filterItems(items, query) {
75
74
  return false;
76
75
  });
77
76
  }
78
- const SearchGroup = React.memo(function SearchGroup$1(t0) {
79
- const $ = c(25);
80
- const { title, items, selectedIndex, startIndex, onSelect, onHover, query: t1 } = t0;
81
- const query = t1 === void 0 ? "" : t1;
77
+ const SearchGroup = React.memo(function SearchGroup$1({ title, items, selectedIndex, startIndex, onSelect, onHover, query = "" }) {
82
78
  const resolveText = useResolveText();
83
79
  if (items.length === 0) return null;
84
- let t2;
85
- if ($[0] !== resolveText || $[1] !== title) {
86
- t2 = resolveText(title);
87
- $[0] = resolveText;
88
- $[1] = title;
89
- $[2] = t2;
90
- } else t2 = $[2];
91
- let t3;
92
- if ($[3] !== t2) {
93
- t3 = /* @__PURE__ */ jsx("h3", {
80
+ return /* @__PURE__ */ jsxs("div", {
81
+ className: "mb-4 last:mb-0",
82
+ children: [/* @__PURE__ */ jsx("h3", {
94
83
  className: "qa-global-search__group-title text-muted-foreground font-chrome chrome-meta mb-2 px-2.5 text-xs font-medium",
95
- children: t2
96
- });
97
- $[3] = t2;
98
- $[4] = t3;
99
- } else t3 = $[4];
100
- let t4;
101
- if ($[5] !== items || $[6] !== onHover || $[7] !== onSelect || $[8] !== query || $[9] !== resolveText || $[10] !== selectedIndex || $[11] !== startIndex) {
102
- let t5$1;
103
- if ($[13] !== onHover || $[14] !== onSelect || $[15] !== query || $[16] !== resolveText || $[17] !== selectedIndex || $[18] !== startIndex) {
104
- t5$1 = (item, idx) => {
84
+ children: resolveText(title)
85
+ }), /* @__PURE__ */ jsx("div", {
86
+ className: "space-y-0.5",
87
+ children: items.map((item, idx) => {
105
88
  const globalIndex = startIndex + idx;
106
89
  const isSelected = globalIndex === selectedIndex;
107
90
  return /* @__PURE__ */ jsxs("button", {
@@ -127,49 +110,11 @@ const SearchGroup = React.memo(function SearchGroup$1(t0) {
127
110
  })]
128
111
  })]
129
112
  }, item.id);
130
- };
131
- $[13] = onHover;
132
- $[14] = onSelect;
133
- $[15] = query;
134
- $[16] = resolveText;
135
- $[17] = selectedIndex;
136
- $[18] = startIndex;
137
- $[19] = t5$1;
138
- } else t5$1 = $[19];
139
- t4 = items.map(t5$1);
140
- $[5] = items;
141
- $[6] = onHover;
142
- $[7] = onSelect;
143
- $[8] = query;
144
- $[9] = resolveText;
145
- $[10] = selectedIndex;
146
- $[11] = startIndex;
147
- $[12] = t4;
148
- } else t4 = $[12];
149
- let t5;
150
- if ($[20] !== t4) {
151
- t5 = /* @__PURE__ */ jsx("div", {
152
- className: "space-y-0.5",
153
- children: t4
154
- });
155
- $[20] = t4;
156
- $[21] = t5;
157
- } else t5 = $[21];
158
- let t6;
159
- if ($[22] !== t3 || $[23] !== t5) {
160
- t6 = /* @__PURE__ */ jsxs("div", {
161
- className: "mb-4 last:mb-0",
162
- children: [t3, t5]
163
- });
164
- $[22] = t3;
165
- $[23] = t5;
166
- $[24] = t6;
167
- } else t6 = $[24];
168
- return t6;
113
+ })
114
+ })]
115
+ });
169
116
  });
170
- function GlobalSearch(t0) {
171
- const $ = c(109);
172
- const { isOpen, onClose, navigate, basePath: basePathProp } = t0;
117
+ function GlobalSearch({ isOpen, onClose, navigate, basePath: basePathProp }) {
173
118
  const { t } = useTranslation();
174
119
  const resolveText = useResolveText();
175
120
  const { data: serverConfig } = useAdminConfig();
@@ -179,28 +124,13 @@ function GlobalSearch(t0) {
179
124
  const [selectedIndex, setSelectedIndex] = useState(0);
180
125
  const inputRef = useRef(null);
181
126
  const debouncedQuery = useDebouncedValue(query, 300);
182
- let t1;
183
- if ($[0] !== debouncedQuery) {
184
- t1 = debouncedQuery.trim();
185
- $[0] = debouncedQuery;
186
- $[1] = t1;
187
- } else t1 = $[1];
188
- const t2 = t1.length >= 2;
189
- let t3;
190
- if ($[2] !== debouncedQuery || $[3] !== t2) {
191
- t3 = {
192
- query: debouncedQuery,
193
- limit: 10,
194
- enabled: t2
195
- };
196
- $[2] = debouncedQuery;
197
- $[3] = t2;
198
- $[4] = t3;
199
- } else t3 = $[4];
200
- const { data: searchResults, isLoading: isSearching } = useGlobalSearch(t3);
201
- let items;
202
- if ($[5] !== basePath || $[6] !== resolveText || $[7] !== serverConfig?.collections || $[8] !== serverConfig?.globals || $[9] !== t) {
203
- items = [];
127
+ const { data: searchResults, isLoading: isSearching } = useGlobalSearch({
128
+ query: debouncedQuery,
129
+ limit: 10,
130
+ enabled: debouncedQuery.trim().length >= 2
131
+ });
132
+ const navItems = useMemo(() => {
133
+ const items = [];
204
134
  const collections = serverConfig?.collections ?? {};
205
135
  const globals = serverConfig?.globals ?? {};
206
136
  for (const [name, config] of Object.entries(collections)) {
@@ -220,491 +150,259 @@ function GlobalSearch(t0) {
220
150
  ]
221
151
  });
222
152
  }
223
- for (const [name_0, config_0] of Object.entries(globals)) {
224
- const { label: rawLabel_0, icon: icon_0, hidden: hidden_0 } = getConfigProps(config_0);
225
- if (hidden_0) continue;
226
- const label_0 = resolveText(rawLabel_0, name_0);
153
+ for (const [name, config] of Object.entries(globals)) {
154
+ const { label: rawLabel, icon, hidden } = getConfigProps(config);
155
+ if (hidden) continue;
156
+ const label = resolveText(rawLabel, name);
227
157
  items.push({
228
- id: `glob-${name_0}`,
158
+ id: `glob-${name}`,
229
159
  type: "global",
230
- label: label_0,
231
- href: `${basePath}/globals/${name_0}`,
232
- icon: icon_0 ?? DEFAULT_GEAR_ICON,
160
+ label,
161
+ href: `${basePath}/globals/${name}`,
162
+ icon: icon ?? DEFAULT_GEAR_ICON,
233
163
  keywords: [
234
- name_0,
164
+ name,
235
165
  "global",
236
166
  "settings",
237
167
  "config"
238
168
  ]
239
169
  });
240
170
  }
241
- for (const [name_1, config_1] of Object.entries(collections)) {
242
- const { label: rawLabel_1, icon: collectionIcon, hidden: hidden_1 } = getConfigProps(config_1);
243
- if (hidden_1) continue;
244
- const label_1 = resolveText(rawLabel_1, name_1);
171
+ for (const [name, config] of Object.entries(collections)) {
172
+ const { label: rawLabel, icon: collectionIcon, hidden } = getConfigProps(config);
173
+ if (hidden) continue;
174
+ const label = resolveText(rawLabel, name);
245
175
  items.push({
246
- id: `action-create-${name_1}`,
176
+ id: `action-create-${name}`,
247
177
  type: "action",
248
- label: t("globalSearch.createNew", { name: label_1 }),
249
- href: `${basePath}/collections/${name_1}/create`,
178
+ label: t("globalSearch.createNew", { name: label }),
179
+ href: `${basePath}/collections/${name}/create`,
250
180
  icon: collectionIcon ?? DEFAULT_PLUS_ICON,
251
181
  keywords: [
252
182
  "create",
253
183
  "new",
254
184
  "add",
255
- name_1
185
+ name
256
186
  ]
257
187
  });
258
188
  }
259
- $[5] = basePath;
260
- $[6] = resolveText;
261
- $[7] = serverConfig?.collections;
262
- $[8] = serverConfig?.globals;
263
- $[9] = t;
264
- $[10] = items;
265
- } else items = $[10];
266
- const navItems = items;
267
- let t4;
268
- if ($[11] !== navItems || $[12] !== query) {
269
- t4 = filterItems(navItems, query);
270
- $[11] = navItems;
271
- $[12] = query;
272
- $[13] = t4;
273
- } else t4 = $[13];
274
- const filteredNavItems = t4;
275
- let t5;
276
- bb0: {
277
- if (!searchResults?.docs) {
278
- let t6$2;
279
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
280
- t6$2 = [];
281
- $[14] = t6$2;
282
- } else t6$2 = $[14];
283
- t5 = t6$2;
284
- break bb0;
285
- }
286
- let t6$1;
287
- if ($[15] !== serverConfig?.collections) {
288
- t6$1 = serverConfig?.collections ?? {};
289
- $[15] = serverConfig?.collections;
290
- $[16] = t6$1;
291
- } else t6$1 = $[16];
292
- const collections_0 = t6$1;
293
- let t7$1;
294
- if ($[17] !== basePath || $[18] !== collections_0 || $[19] !== resolveText || $[20] !== searchResults.docs) {
295
- let t8$1;
296
- if ($[22] !== basePath || $[23] !== collections_0 || $[24] !== resolveText) {
297
- t8$1 = (doc) => {
298
- const collectionName = doc._collection;
299
- const collectionConfig = collections_0[collectionName];
300
- const { label: rawLabel_2, icon: configIcon } = getConfigProps(collectionConfig);
301
- const collectionLabel = resolveText(rawLabel_2, collectionName);
302
- const icon_1 = configIcon ?? DEFAULT_FILE_ICON;
303
- return {
304
- id: `record-${collectionName}-${doc.id}`,
305
- type: "record",
306
- label: doc._search?.indexedTitle || doc.id,
307
- sublabel: collectionLabel,
308
- href: `${basePath}/collections/${collectionName}/${doc.id}`,
309
- icon: icon_1,
310
- highlights: doc._search?.highlights
311
- };
312
- };
313
- $[22] = basePath;
314
- $[23] = collections_0;
315
- $[24] = resolveText;
316
- $[25] = t8$1;
317
- } else t8$1 = $[25];
318
- t7$1 = searchResults.docs.map(t8$1);
319
- $[17] = basePath;
320
- $[18] = collections_0;
321
- $[19] = resolveText;
322
- $[20] = searchResults.docs;
323
- $[21] = t7$1;
324
- } else t7$1 = $[21];
325
- t5 = t7$1;
326
- }
327
- const recordItems = t5;
328
- let t6;
329
- if ($[26] !== filteredNavItems) {
330
- t6 = filteredNavItems.filter(_temp);
331
- $[26] = filteredNavItems;
332
- $[27] = t6;
333
- } else t6 = $[27];
334
- let t7;
335
- if ($[28] !== filteredNavItems) {
336
- t7 = filteredNavItems.filter(_temp2);
337
- $[28] = filteredNavItems;
338
- $[29] = t7;
339
- } else t7 = $[29];
340
- let t8;
341
- if ($[30] !== filteredNavItems) {
342
- t8 = filteredNavItems.filter(_temp3);
343
- $[30] = filteredNavItems;
344
- $[31] = t8;
345
- } else t8 = $[31];
346
- let t9;
347
- if ($[32] !== t6 || $[33] !== t7 || $[34] !== t8) {
348
- t9 = {
349
- collections: t6,
350
- globals: t7,
351
- actions: t8
189
+ return items;
190
+ }, [
191
+ serverConfig,
192
+ basePath,
193
+ resolveText,
194
+ t
195
+ ]);
196
+ const filteredNavItems = useMemo(() => filterItems(navItems, query), [navItems, query]);
197
+ const recordItems = useMemo(() => {
198
+ if (!searchResults?.docs) return [];
199
+ const collections = serverConfig?.collections ?? {};
200
+ return searchResults.docs.map((doc) => {
201
+ const collectionName = doc._collection;
202
+ const collectionConfig = collections[collectionName];
203
+ const { label: rawLabel, icon: configIcon } = getConfigProps(collectionConfig);
204
+ const collectionLabel = resolveText(rawLabel, collectionName);
205
+ const icon = configIcon ?? DEFAULT_FILE_ICON;
206
+ return {
207
+ id: `record-${collectionName}-${doc.id}`,
208
+ type: "record",
209
+ label: doc._search?.indexedTitle || doc.id,
210
+ sublabel: collectionLabel,
211
+ href: `${basePath}/collections/${collectionName}/${doc.id}`,
212
+ icon,
213
+ highlights: doc._search?.highlights
214
+ };
215
+ });
216
+ }, [
217
+ searchResults,
218
+ serverConfig,
219
+ basePath,
220
+ resolveText
221
+ ]);
222
+ const groupedNavItems = useMemo(() => {
223
+ return {
224
+ collections: filteredNavItems.filter((i) => i.type === "collection"),
225
+ globals: filteredNavItems.filter((i) => i.type === "global"),
226
+ actions: filteredNavItems.filter((i) => i.type === "action")
352
227
  };
353
- $[32] = t6;
354
- $[33] = t7;
355
- $[34] = t8;
356
- $[35] = t9;
357
- } else t9 = $[35];
358
- const groupedNavItems = t9;
359
- let t10;
360
- if ($[36] !== groupedNavItems.actions || $[37] !== groupedNavItems.collections || $[38] !== groupedNavItems.globals || $[39] !== recordItems) {
361
- t10 = [
228
+ }, [filteredNavItems]);
229
+ const allItems = useMemo(() => {
230
+ return [
362
231
  ...groupedNavItems.collections,
363
232
  ...groupedNavItems.globals,
364
233
  ...groupedNavItems.actions,
365
234
  ...recordItems
366
235
  ];
367
- $[36] = groupedNavItems.actions;
368
- $[37] = groupedNavItems.collections;
369
- $[38] = groupedNavItems.globals;
370
- $[39] = recordItems;
371
- $[40] = t10;
372
- } else t10 = $[40];
373
- const allItems = t10;
236
+ }, [groupedNavItems, recordItems]);
374
237
  const totalCount = allItems.length;
238
+ const collectionsStartIndex = 0;
375
239
  const globalsStartIndex = groupedNavItems.collections.length;
376
240
  const actionsStartIndex = groupedNavItems.collections.length + groupedNavItems.globals.length;
377
241
  const recordsStartIndex = groupedNavItems.collections.length + groupedNavItems.globals.length + groupedNavItems.actions.length;
378
- let t11;
379
- let t12;
380
- if ($[41] !== isOpen) {
381
- t11 = () => {
382
- if (!isOpen) return;
383
- setQuery("");
384
- setSelectedIndex(0);
385
- const timer = setTimeout(() => inputRef.current?.focus(), 50);
386
- return () => clearTimeout(timer);
387
- };
388
- t12 = [isOpen];
389
- $[41] = isOpen;
390
- $[42] = t11;
391
- $[43] = t12;
392
- } else {
393
- t11 = $[42];
394
- t12 = $[43];
395
- }
396
- React.useEffect(t11, t12);
397
- let t13;
398
- if ($[44] !== navigate || $[45] !== onClose) {
399
- t13 = (item) => {
400
- navigate(item.href);
401
- onClose();
402
- };
403
- $[44] = navigate;
404
- $[45] = onClose;
405
- $[46] = t13;
406
- } else t13 = $[46];
407
- const handleSelect = t13;
408
- let t14;
409
- if ($[47] !== allItems || $[48] !== handleSelect || $[49] !== onClose || $[50] !== selectedIndex || $[51] !== totalCount) {
410
- t14 = (e) => {
411
- bb125: switch (e.key) {
412
- case "ArrowDown":
413
- e.preventDefault();
414
- setSelectedIndex((i_3) => totalCount > 0 ? (i_3 + 1) % totalCount : 0);
415
- break bb125;
416
- case "ArrowUp":
417
- e.preventDefault();
418
- setSelectedIndex((i_2) => totalCount > 0 ? (i_2 - 1 + totalCount) % totalCount : 0);
419
- break bb125;
420
- case "Enter":
421
- e.preventDefault();
422
- if (allItems[selectedIndex]) handleSelect(allItems[selectedIndex]);
423
- break bb125;
424
- case "Escape":
425
- e.preventDefault();
426
- onClose();
427
- }
428
- };
429
- $[47] = allItems;
430
- $[48] = handleSelect;
431
- $[49] = onClose;
432
- $[50] = selectedIndex;
433
- $[51] = totalCount;
434
- $[52] = t14;
435
- } else t14 = $[52];
436
- const handleKeyDown = t14;
437
- let t15;
438
- if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
439
- t15 = (index) => {
440
- setSelectedIndex(index);
441
- };
442
- $[53] = t15;
443
- } else t15 = $[53];
444
- const handleHover = t15;
242
+ React.useEffect(() => {
243
+ if (!isOpen) return;
244
+ const timer = setTimeout(() => inputRef.current?.focus(), 50);
245
+ return () => clearTimeout(timer);
246
+ }, [isOpen]);
247
+ const resetSearchState = useCallback(() => {
248
+ setQuery("");
249
+ setSelectedIndex(0);
250
+ }, []);
251
+ const closeSearch = useCallback(() => {
252
+ resetSearchState();
253
+ onClose();
254
+ }, [onClose, resetSearchState]);
255
+ const handleSelect = useCallback((item) => {
256
+ navigate(item.href);
257
+ closeSearch();
258
+ }, [navigate, closeSearch]);
259
+ const handleKeyDown = useCallback((e) => {
260
+ switch (e.key) {
261
+ case "ArrowDown":
262
+ e.preventDefault();
263
+ setSelectedIndex((i) => totalCount > 0 ? (i + 1) % totalCount : 0);
264
+ break;
265
+ case "ArrowUp":
266
+ e.preventDefault();
267
+ setSelectedIndex((i) => totalCount > 0 ? (i - 1 + totalCount) % totalCount : 0);
268
+ break;
269
+ case "Enter":
270
+ e.preventDefault();
271
+ if (allItems[selectedIndex]) handleSelect(allItems[selectedIndex]);
272
+ break;
273
+ case "Escape":
274
+ e.preventDefault();
275
+ closeSearch();
276
+ break;
277
+ }
278
+ }, [
279
+ allItems,
280
+ selectedIndex,
281
+ totalCount,
282
+ handleSelect,
283
+ closeSearch
284
+ ]);
285
+ const handleHover = useCallback((index) => {
286
+ setSelectedIndex(index);
287
+ }, []);
445
288
  const hasNavResults = groupedNavItems.collections.length > 0 || groupedNavItems.globals.length > 0 || groupedNavItems.actions.length > 0;
446
289
  const hasRecordResults = recordItems.length > 0;
447
290
  const hasResults = hasNavResults || hasRecordResults;
448
- let t16;
449
- if ($[54] !== onClose) {
450
- t16 = (open) => !open && onClose();
451
- $[54] = onClose;
452
- $[55] = t16;
453
- } else t16 = $[55];
454
- let t17;
455
- if ($[56] === Symbol.for("react.memo_cache_sentinel")) {
456
- t17 = /* @__PURE__ */ jsx(InputGroupAddon, {
457
- align: "inline-start",
458
- className: "pl-0",
459
- children: /* @__PURE__ */ jsx(Icon, {
460
- icon: "ph:magnifying-glass",
461
- className: "size-5"
462
- })
463
- });
464
- $[56] = t17;
465
- } else t17 = $[56];
466
- let t18;
467
- if ($[57] !== t) {
468
- t18 = t("globalSearch.placeholder");
469
- $[57] = t;
470
- $[58] = t18;
471
- } else t18 = $[58];
472
- let t19;
473
- if ($[59] === Symbol.for("react.memo_cache_sentinel")) {
474
- t19 = (e_0) => {
475
- setQuery(e_0.target.value);
476
- setSelectedIndex(0);
477
- };
478
- $[59] = t19;
479
- } else t19 = $[59];
480
- let t20;
481
- if ($[60] !== handleKeyDown || $[61] !== query || $[62] !== t18) {
482
- t20 = /* @__PURE__ */ jsx(InputGroupInput, {
483
- ref: inputRef,
484
- className: "h-12 px-0 text-base",
485
- placeholder: t18,
486
- value: query,
487
- onChange: t19,
488
- onKeyDown: handleKeyDown
489
- });
490
- $[60] = handleKeyDown;
491
- $[61] = query;
492
- $[62] = t18;
493
- $[63] = t20;
494
- } else t20 = $[63];
495
- let t21;
496
- if ($[64] !== isSearching) {
497
- t21 = isSearching && /* @__PURE__ */ jsx(Icon, {
498
- icon: "ph:spinner",
499
- className: "size-4 animate-spin"
500
- });
501
- $[64] = isSearching;
502
- $[65] = t21;
503
- } else t21 = $[65];
504
- let t22;
505
- if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
506
- t22 = /* @__PURE__ */ jsx(Kbd, { children: "ESC" });
507
- $[66] = t22;
508
- } else t22 = $[66];
509
- let t23;
510
- if ($[67] !== t21) {
511
- t23 = /* @__PURE__ */ jsxs(InputGroupAddon, {
512
- align: "inline-end",
513
- className: "gap-2 pr-0",
514
- children: [t21, t22]
515
- });
516
- $[67] = t21;
517
- $[68] = t23;
518
- } else t23 = $[68];
519
- let t24;
520
- if ($[69] !== t20 || $[70] !== t23) {
521
- t24 = /* @__PURE__ */ jsx("div", {
522
- className: "qa-global-search__input-area border-border-subtle bg-popover border-b p-3",
523
- children: /* @__PURE__ */ jsxs(InputGroup, {
524
- className: "h-12 border-transparent bg-transparent focus-within:border-transparent focus-within:ring-0 hover:border-transparent",
525
- children: [
526
- t17,
527
- t20,
528
- t23
529
- ]
530
- })
531
- });
532
- $[69] = t20;
533
- $[70] = t23;
534
- $[71] = t24;
535
- } else t24 = $[71];
536
- let t25;
537
- if ($[72] !== actionsStartIndex || $[73] !== globalsStartIndex || $[74] !== groupedNavItems.actions || $[75] !== groupedNavItems.collections || $[76] !== groupedNavItems.globals || $[77] !== handleSelect || $[78] !== hasRecordResults || $[79] !== hasResults || $[80] !== isSearching || $[81] !== query || $[82] !== recordItems || $[83] !== recordsStartIndex || $[84] !== selectedIndex || $[85] !== t) {
538
- t25 = /* @__PURE__ */ jsx("div", {
539
- className: "qa-global-search__results max-h-[60vh] overflow-y-auto p-2",
540
- children: hasResults ? /* @__PURE__ */ jsxs(Fragment, { children: [
541
- /* @__PURE__ */ jsx(SearchGroup, {
542
- title: t("globalSearch.collections"),
543
- items: groupedNavItems.collections,
544
- selectedIndex,
545
- startIndex: 0,
546
- onSelect: handleSelect,
547
- onHover: handleHover
548
- }),
549
- /* @__PURE__ */ jsx(SearchGroup, {
550
- title: t("globalSearch.globals"),
551
- items: groupedNavItems.globals,
552
- selectedIndex,
553
- startIndex: globalsStartIndex,
554
- onSelect: handleSelect,
555
- onHover: handleHover
556
- }),
557
- /* @__PURE__ */ jsx(SearchGroup, {
558
- title: t("globalSearch.quickActions"),
559
- items: groupedNavItems.actions,
560
- selectedIndex,
561
- startIndex: actionsStartIndex,
562
- onSelect: handleSelect,
563
- onHover: handleHover
564
- }),
565
- hasRecordResults && /* @__PURE__ */ jsx(SearchGroup, {
566
- title: t("globalSearch.records"),
567
- items: recordItems,
568
- selectedIndex,
569
- startIndex: recordsStartIndex,
570
- onSelect: handleSelect,
571
- onHover: handleHover,
572
- query
573
- })
574
- ] }) : /* @__PURE__ */ jsx("div", {
575
- className: "text-muted-foreground py-8 text-center text-sm",
576
- children: isSearching ? /* @__PURE__ */ jsxs("div", {
577
- className: "flex items-center justify-center gap-2",
578
- children: [/* @__PURE__ */ jsx(Icon, {
579
- icon: "ph:spinner",
580
- className: "h-4 w-4 animate-spin"
581
- }), /* @__PURE__ */ jsx("span", { children: t("globalSearch.searching") })]
582
- }) : t("globalSearch.noResults")
583
- })
584
- });
585
- $[72] = actionsStartIndex;
586
- $[73] = globalsStartIndex;
587
- $[74] = groupedNavItems.actions;
588
- $[75] = groupedNavItems.collections;
589
- $[76] = groupedNavItems.globals;
590
- $[77] = handleSelect;
591
- $[78] = hasRecordResults;
592
- $[79] = hasResults;
593
- $[80] = isSearching;
594
- $[81] = query;
595
- $[82] = recordItems;
596
- $[83] = recordsStartIndex;
597
- $[84] = selectedIndex;
598
- $[85] = t;
599
- $[86] = t25;
600
- } else t25 = $[86];
601
- let t26;
602
- let t27;
603
- if ($[87] === Symbol.for("react.memo_cache_sentinel")) {
604
- t26 = /* @__PURE__ */ jsx(Kbd, {
605
- className: "px-1 text-[10px]",
606
- children: "↑"
607
- });
608
- t27 = /* @__PURE__ */ jsx(Kbd, {
609
- className: "px-1 text-[10px]",
610
- children: "↓"
611
- });
612
- $[87] = t26;
613
- $[88] = t27;
614
- } else {
615
- t26 = $[87];
616
- t27 = $[88];
617
- }
618
- let t28;
619
- if ($[89] !== t) {
620
- t28 = t("globalSearch.navigate");
621
- $[89] = t;
622
- $[90] = t28;
623
- } else t28 = $[90];
624
- let t29;
625
- if ($[91] !== t28) {
626
- t29 = /* @__PURE__ */ jsxs("span", {
627
- className: "flex items-center gap-1",
628
- children: [
629
- t26,
630
- t27,
631
- /* @__PURE__ */ jsx("span", { children: t28 })
632
- ]
633
- });
634
- $[91] = t28;
635
- $[92] = t29;
636
- } else t29 = $[92];
637
- let t30;
638
- if ($[93] === Symbol.for("react.memo_cache_sentinel")) {
639
- t30 = /* @__PURE__ */ jsx(Kbd, {
640
- className: "px-1.5 text-[10px]",
641
- children: "↵"
642
- });
643
- $[93] = t30;
644
- } else t30 = $[93];
645
- let t31;
646
- if ($[94] !== t) {
647
- t31 = t("globalSearch.select");
648
- $[94] = t;
649
- $[95] = t31;
650
- } else t31 = $[95];
651
- let t32;
652
- if ($[96] !== t31) {
653
- t32 = /* @__PURE__ */ jsxs("span", {
654
- className: "flex items-center gap-1",
655
- children: [t30, /* @__PURE__ */ jsx("span", { children: t31 })]
656
- });
657
- $[96] = t31;
658
- $[97] = t32;
659
- } else t32 = $[97];
660
- let t33;
661
- if ($[98] !== t29 || $[99] !== t32) {
662
- t33 = /* @__PURE__ */ jsxs("div", {
663
- className: "qa-global-search__footer text-muted-foreground flex items-center justify-end gap-4 border-t px-3 py-2 text-xs",
664
- children: [t29, t32]
665
- });
666
- $[98] = t29;
667
- $[99] = t32;
668
- $[100] = t33;
669
- } else t33 = $[100];
670
- let t34;
671
- if ($[101] !== t24 || $[102] !== t25 || $[103] !== t33) {
672
- t34 = /* @__PURE__ */ jsxs(ResponsiveDialogContent, {
291
+ return /* @__PURE__ */ jsx(ResponsiveDialog, {
292
+ open: isOpen,
293
+ onOpenChange: (open) => !open && closeSearch(),
294
+ children: /* @__PURE__ */ jsxs(ResponsiveDialogContent, {
673
295
  className: "qa-global-search gap-0 p-0 sm:max-w-3xl",
674
296
  showCloseButton: false,
675
297
  children: [
676
- t24,
677
- t25,
678
- t33
298
+ /* @__PURE__ */ jsx("div", {
299
+ className: "qa-global-search__input-area border-border-subtle bg-popover border-b p-3",
300
+ children: /* @__PURE__ */ jsxs(InputGroup, {
301
+ className: "h-12 border-transparent bg-transparent focus-within:border-transparent focus-within:ring-0 hover:border-transparent",
302
+ children: [
303
+ /* @__PURE__ */ jsx(InputGroupAddon, {
304
+ align: "inline-start",
305
+ className: "pl-0",
306
+ children: /* @__PURE__ */ jsx(Icon, {
307
+ icon: "ph:magnifying-glass",
308
+ className: "size-5"
309
+ })
310
+ }),
311
+ /* @__PURE__ */ jsx(InputGroupInput, {
312
+ ref: inputRef,
313
+ className: "h-12 px-0 text-base",
314
+ placeholder: t("globalSearch.placeholder"),
315
+ value: query,
316
+ onChange: (e) => {
317
+ setQuery(e.target.value);
318
+ setSelectedIndex(0);
319
+ },
320
+ onKeyDown: handleKeyDown
321
+ }),
322
+ /* @__PURE__ */ jsxs(InputGroupAddon, {
323
+ align: "inline-end",
324
+ className: "gap-2 pr-0",
325
+ children: [isSearching && /* @__PURE__ */ jsx(Icon, {
326
+ icon: "ph:spinner",
327
+ className: "size-4 animate-spin"
328
+ }), /* @__PURE__ */ jsx(Kbd, { children: "ESC" })]
329
+ })
330
+ ]
331
+ })
332
+ }),
333
+ /* @__PURE__ */ jsx("div", {
334
+ className: "qa-global-search__results max-h-[60vh] overflow-y-auto p-2",
335
+ children: hasResults ? /* @__PURE__ */ jsxs(Fragment, { children: [
336
+ /* @__PURE__ */ jsx(SearchGroup, {
337
+ title: t("globalSearch.collections"),
338
+ items: groupedNavItems.collections,
339
+ selectedIndex,
340
+ startIndex: collectionsStartIndex,
341
+ onSelect: handleSelect,
342
+ onHover: handleHover
343
+ }),
344
+ /* @__PURE__ */ jsx(SearchGroup, {
345
+ title: t("globalSearch.globals"),
346
+ items: groupedNavItems.globals,
347
+ selectedIndex,
348
+ startIndex: globalsStartIndex,
349
+ onSelect: handleSelect,
350
+ onHover: handleHover
351
+ }),
352
+ /* @__PURE__ */ jsx(SearchGroup, {
353
+ title: t("globalSearch.quickActions"),
354
+ items: groupedNavItems.actions,
355
+ selectedIndex,
356
+ startIndex: actionsStartIndex,
357
+ onSelect: handleSelect,
358
+ onHover: handleHover
359
+ }),
360
+ hasRecordResults && /* @__PURE__ */ jsx(SearchGroup, {
361
+ title: t("globalSearch.records"),
362
+ items: recordItems,
363
+ selectedIndex,
364
+ startIndex: recordsStartIndex,
365
+ onSelect: handleSelect,
366
+ onHover: handleHover,
367
+ query
368
+ })
369
+ ] }) : /* @__PURE__ */ jsx("div", {
370
+ className: "text-muted-foreground py-8 text-center text-sm",
371
+ children: isSearching ? /* @__PURE__ */ jsxs("div", {
372
+ className: "flex items-center justify-center gap-2",
373
+ children: [/* @__PURE__ */ jsx(Icon, {
374
+ icon: "ph:spinner",
375
+ className: "h-4 w-4 animate-spin"
376
+ }), /* @__PURE__ */ jsx("span", { children: t("globalSearch.searching") })]
377
+ }) : t("globalSearch.noResults")
378
+ })
379
+ }),
380
+ /* @__PURE__ */ jsxs("div", {
381
+ className: "qa-global-search__footer text-muted-foreground flex items-center justify-end gap-4 border-t px-3 py-2 text-xs",
382
+ children: [/* @__PURE__ */ jsxs("span", {
383
+ className: "flex items-center gap-1",
384
+ children: [
385
+ /* @__PURE__ */ jsx(Kbd, {
386
+ className: "px-1 text-[10px]",
387
+ children: "↑"
388
+ }),
389
+ /* @__PURE__ */ jsx(Kbd, {
390
+ className: "px-1 text-[10px]",
391
+ children: "↓"
392
+ }),
393
+ /* @__PURE__ */ jsx("span", { children: t("globalSearch.navigate") })
394
+ ]
395
+ }), /* @__PURE__ */ jsxs("span", {
396
+ className: "flex items-center gap-1",
397
+ children: [/* @__PURE__ */ jsx(Kbd, {
398
+ className: "px-1.5 text-[10px]",
399
+ children: "↵"
400
+ }), /* @__PURE__ */ jsx("span", { children: t("globalSearch.select") })]
401
+ })]
402
+ })
679
403
  ]
680
- });
681
- $[101] = t24;
682
- $[102] = t25;
683
- $[103] = t33;
684
- $[104] = t34;
685
- } else t34 = $[104];
686
- let t35;
687
- if ($[105] !== isOpen || $[106] !== t16 || $[107] !== t34) {
688
- t35 = /* @__PURE__ */ jsx(ResponsiveDialog, {
689
- open: isOpen,
690
- onOpenChange: t16,
691
- children: t34
692
- });
693
- $[105] = isOpen;
694
- $[106] = t16;
695
- $[107] = t34;
696
- $[108] = t35;
697
- } else t35 = $[108];
698
- return t35;
699
- }
700
- function _temp3(i_1) {
701
- return i_1.type === "action";
702
- }
703
- function _temp2(i_0) {
704
- return i_0.type === "global";
705
- }
706
- function _temp(i) {
707
- return i.type === "collection";
404
+ })
405
+ });
708
406
  }
709
407
 
710
408
  //#endregion