@questpie/admin 3.2.4 → 3.2.6

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