@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.
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/blocks/block-renderer.mjs +164 -339
- package/dist/client/components/actions/action-button.mjs +9 -9
- package/dist/client/components/actions/action-dialog.mjs +195 -493
- package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
- package/dist/client/components/actions/header-actions.mjs +73 -165
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/admin-link.mjs +40 -126
- package/dist/client/components/auth/auth-loading.mjs +9 -44
- package/dist/client/components/blocks/block-canvas.mjs +31 -95
- package/dist/client/components/blocks/block-editor-context.mjs +13 -57
- package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
- package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
- package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
- package/dist/client/components/blocks/block-insert-button.mjs +49 -165
- package/dist/client/components/blocks/block-item-menu.mjs +102 -301
- package/dist/client/components/blocks/block-item.mjs +136 -370
- package/dist/client/components/blocks/block-library-sidebar.mjs +106 -220
- package/dist/client/components/blocks/block-tree.mjs +12 -68
- package/dist/client/components/blocks/block-type-icon.mjs +14 -56
- package/dist/client/components/brand-logo.mjs +35 -149
- package/dist/client/components/component-renderer.mjs +42 -118
- package/dist/client/components/error-boundary.mjs +14 -58
- package/dist/client/components/fields/array-field.mjs +209 -521
- package/dist/client/components/fields/asset-preview-field.mjs +41 -141
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
- package/dist/client/components/fields/boolean-field.mjs +29 -59
- package/dist/client/components/fields/date-field.mjs +7 -37
- package/dist/client/components/fields/datetime-field.mjs +7 -38
- package/dist/client/components/fields/email-field.mjs +25 -54
- package/dist/client/components/fields/field-wrapper.mjs +30 -105
- package/dist/client/components/fields/json-field.mjs +107 -313
- package/dist/client/components/fields/locale-badge.mjs +6 -15
- package/dist/client/components/fields/number-field.mjs +27 -60
- package/dist/client/components/fields/object-array-field.mjs +283 -659
- package/dist/client/components/fields/object-field.mjs +165 -633
- package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
- package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
- package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
- package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
- package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
- package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
- package/dist/client/components/fields/relation-field.mjs +10 -66
- package/dist/client/components/fields/relation-picker.mjs +18 -18
- package/dist/client/components/fields/relation-select.mjs +12 -12
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -182
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +8 -19
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
- package/dist/client/components/fields/rich-text-editor/index.mjs +196 -530
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
- package/dist/client/components/fields/rich-text-field.mjs +14 -53
- package/dist/client/components/fields/select-field.mjs +39 -74
- package/dist/client/components/fields/text-field.mjs +26 -59
- package/dist/client/components/fields/textarea-field.mjs +26 -58
- package/dist/client/components/fields/time-field.mjs +7 -35
- package/dist/client/components/fields/upload-field.mjs +47 -165
- package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
- package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
- package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
- package/dist/client/components/history-sidebar.mjs +306 -611
- package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
- package/dist/client/components/locale-switcher.mjs +106 -228
- package/dist/client/components/media/media-grid.mjs +84 -273
- package/dist/client/components/media/media-picker-dialog.mjs +177 -494
- package/dist/client/components/preview/live-preview-mode.mjs +240 -438
- package/dist/client/components/preview/preview-pane.mjs +22 -22
- package/dist/client/components/primitives/asset-preview.mjs +290 -666
- package/dist/client/components/primitives/checkbox-input.mjs +9 -35
- package/dist/client/components/primitives/date-input.mjs +109 -327
- package/dist/client/components/primitives/dropzone.mjs +209 -336
- package/dist/client/components/primitives/field-select-control.mjs +12 -80
- package/dist/client/components/primitives/number-input.mjs +4 -4
- package/dist/client/components/primitives/select-multi.mjs +200 -559
- package/dist/client/components/primitives/select-single.mjs +165 -499
- package/dist/client/components/primitives/time-input.mjs +43 -117
- package/dist/client/components/primitives/toggle-input.mjs +9 -29
- package/dist/client/components/sheets/resource-sheet.mjs +61 -70
- package/dist/client/components/ui/accordion.mjs +35 -155
- package/dist/client/components/ui/alert.mjs +13 -68
- package/dist/client/components/ui/badge.mjs +9 -51
- package/dist/client/components/ui/button.mjs +8 -54
- package/dist/client/components/ui/card.mjs +37 -193
- package/dist/client/components/ui/checkbox.mjs +12 -68
- package/dist/client/components/ui/command.mjs +48 -219
- package/dist/client/components/ui/dialog.mjs +50 -262
- package/dist/client/components/ui/drawer.mjs +55 -259
- package/dist/client/components/ui/dropdown-menu.mjs +86 -427
- package/dist/client/components/ui/empty-state.mjs +28 -98
- package/dist/client/components/ui/field.mjs +73 -309
- package/dist/client/components/ui/input-group.mjs +42 -167
- package/dist/client/components/ui/input.mjs +7 -37
- package/dist/client/components/ui/kbd.mjs +6 -36
- package/dist/client/components/ui/label.mjs +7 -37
- package/dist/client/components/ui/popover.mjs +34 -169
- package/dist/client/components/ui/responsive-dialog.mjs +67 -273
- package/dist/client/components/ui/scroll-fade.mjs +63 -158
- package/dist/client/components/ui/search-input.mjs +33 -100
- package/dist/client/components/ui/select.mjs +72 -393
- package/dist/client/components/ui/separator.mjs +7 -38
- package/dist/client/components/ui/sheet.mjs +49 -269
- package/dist/client/components/ui/sidebar.mjs +171 -690
- package/dist/client/components/ui/skeleton.mjs +7 -38
- package/dist/client/components/ui/sonner.mjs +11 -42
- package/dist/client/components/ui/switch.mjs +9 -45
- package/dist/client/components/ui/table.mjs +48 -266
- package/dist/client/components/ui/tabs.mjs +26 -139
- package/dist/client/components/ui/textarea.mjs +6 -32
- package/dist/client/components/ui/tooltip.mjs +27 -129
- package/dist/client/components/widgets/chart-widget.mjs +174 -522
- package/dist/client/components/widgets/progress-widget.mjs +66 -172
- package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
- package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
- package/dist/client/components/widgets/stats-widget.mjs +41 -175
- package/dist/client/components/widgets/table-widget.mjs +9 -9
- package/dist/client/components/widgets/timeline-widget.mjs +86 -226
- package/dist/client/components/widgets/value-widget.mjs +74 -381
- package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
- package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
- package/dist/client/contexts/focus-context.d.mts +4 -0
- package/dist/client/contexts/focus-context.mjs +87 -150
- package/dist/client/hooks/typed-hooks.mjs +241 -701
- package/dist/client/hooks/use-action.mjs +62 -198
- package/dist/client/hooks/use-admin-config.mjs +5 -35
- package/dist/client/hooks/use-admin-preferences.mjs +16 -88
- package/dist/client/hooks/use-admin-routes.mjs +22 -56
- package/dist/client/hooks/use-audit-history.mjs +21 -69
- package/dist/client/hooks/use-brand.mjs +1 -9
- package/dist/client/hooks/use-collection-fields.mjs +17 -57
- package/dist/client/hooks/use-collection-meta.mjs +12 -44
- package/dist/client/hooks/use-collection-schema.mjs +10 -33
- package/dist/client/hooks/use-collection-validation.mjs +23 -53
- package/dist/client/hooks/use-collection.mjs +194 -614
- package/dist/client/hooks/use-current-user.mjs +0 -1
- package/dist/client/hooks/use-field-hooks.mjs +10 -10
- package/dist/client/hooks/use-field-options.mjs +61 -202
- package/dist/client/hooks/use-global-fields.mjs +14 -46
- package/dist/client/hooks/use-global-meta.mjs +9 -30
- package/dist/client/hooks/use-global-schema.mjs +9 -30
- package/dist/client/hooks/use-global.mjs +63 -219
- package/dist/client/hooks/use-locks.mjs +117 -325
- package/dist/client/hooks/use-media-query.mjs +16 -36
- package/dist/client/hooks/use-prefill-params.mjs +0 -1
- package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
- package/dist/client/hooks/use-reactive-fields.mjs +1 -1
- package/dist/client/hooks/use-reactive-prop.mjs +65 -223
- package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
- package/dist/client/hooks/use-saved-views.mjs +22 -103
- package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
- package/dist/client/hooks/use-search.mjs +31 -143
- package/dist/client/hooks/use-server-actions.mjs +18 -50
- package/dist/client/hooks/use-server-validation.mjs +72 -166
- package/dist/client/hooks/use-server-widget-data.mjs +7 -33
- package/dist/client/hooks/use-setup-status.mjs +12 -25
- package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
- package/dist/client/hooks/use-transition-stage.mjs +8 -38
- package/dist/client/hooks/use-upload.mjs +54 -152
- package/dist/client/hooks/use-validation-error-map.mjs +6 -26
- package/dist/client/hooks/use-view-state.mjs +187 -437
- package/dist/client/i18n/hooks.mjs +65 -197
- package/dist/client/lib/render-profiler.mjs +14 -41
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/block-scope-context.mjs +14 -36
- package/dist/client/preview/diff.mjs +110 -0
- package/dist/client/preview/preview-banner.mjs +42 -108
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +166 -409
- package/dist/client/preview/use-collection-preview.mjs +135 -201
- package/dist/client/runtime/content-locales-provider.mjs +31 -83
- package/dist/client/runtime/locale-scope.mjs +22 -63
- package/dist/client/runtime/provider.mjs +100 -255
- package/dist/client/runtime/translations-provider.mjs +41 -107
- package/dist/client/scope/picker.d.mts +2 -2
- package/dist/client/scope/picker.mjs +86 -321
- package/dist/client/scope/provider.d.mts +2 -2
- package/dist/client/scope/provider.mjs +8 -17
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/accept-invite-form.mjs +121 -412
- package/dist/client/views/auth/auth-layout.d.mts +3 -3
- package/dist/client/views/auth/auth-layout.mjs +104 -284
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/forgot-password-form.mjs +94 -325
- package/dist/client/views/auth/invite-form.mjs +107 -442
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.mjs +116 -337
- package/dist/client/views/auth/reset-password-form.mjs +128 -453
- package/dist/client/views/auth/setup-form.mjs +140 -478
- package/dist/client/views/collection/auto-form-fields.mjs +243 -615
- package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -400
- package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
- package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
- package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
- package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
- package/dist/client/views/collection/columns/build-columns.mjs +8 -48
- package/dist/client/views/collection/field-renderer.mjs +11 -24
- package/dist/client/views/collection/form-view.mjs +288 -560
- package/dist/client/views/collection/table-view.mjs +239 -469
- package/dist/client/views/collection/view-skeletons.mjs +112 -237
- package/dist/client/views/common/global-search.mjs +241 -543
- package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
- package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
- package/dist/client/views/dashboard/widget-card.mjs +61 -269
- package/dist/client/views/globals/global-form-view.mjs +478 -1298
- package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
- package/dist/client/views/layout/admin-layout.mjs +83 -246
- package/dist/client/views/layout/admin-router.mjs +457 -1289
- package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
- package/dist/client/views/layout/admin-theme.mjs +30 -64
- package/dist/client/views/layout/admin-view-layout.mjs +40 -144
- package/dist/client/views/pages/accept-invite-page.mjs +95 -290
- package/dist/client/views/pages/dashboard-page.mjs +11 -57
- package/dist/client/views/pages/forgot-password-page.mjs +31 -83
- package/dist/client/views/pages/invite-page.mjs +35 -90
- package/dist/client/views/pages/login-page.mjs +41 -121
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.mjs +46 -173
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.mjs +33 -95
- package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
- package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
- package/dist/server/modules/admin/collections/account.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
- package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
- package/dist/server/modules/admin/collections/assets.d.mts +34 -34
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +53 -53
- package/dist/server/modules/admin/collections/verification.d.mts +36 -36
- package/dist/server/modules/admin/index.d.mts +21 -20
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.d.mts +11 -11
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/setup.d.mts +7 -7
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
- 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
|
|
37
|
+
const c = config;
|
|
39
38
|
return {
|
|
40
|
-
label: c
|
|
41
|
-
icon: c
|
|
42
|
-
hidden: c
|
|
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(
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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:
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
132
|
-
|
|
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(
|
|
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
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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 [
|
|
224
|
-
const { label:
|
|
225
|
-
if (
|
|
226
|
-
const
|
|
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-${
|
|
158
|
+
id: `glob-${name}`,
|
|
229
159
|
type: "global",
|
|
230
|
-
label
|
|
231
|
-
href: `${basePath}/globals/${
|
|
232
|
-
icon:
|
|
160
|
+
label,
|
|
161
|
+
href: `${basePath}/globals/${name}`,
|
|
162
|
+
icon: icon ?? DEFAULT_GEAR_ICON,
|
|
233
163
|
keywords: [
|
|
234
|
-
|
|
164
|
+
name,
|
|
235
165
|
"global",
|
|
236
166
|
"settings",
|
|
237
167
|
"config"
|
|
238
168
|
]
|
|
239
169
|
});
|
|
240
170
|
}
|
|
241
|
-
for (const [
|
|
242
|
-
const { label:
|
|
243
|
-
if (
|
|
244
|
-
const
|
|
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-${
|
|
176
|
+
id: `action-create-${name}`,
|
|
247
177
|
type: "action",
|
|
248
|
-
label: t("globalSearch.createNew", { name:
|
|
249
|
-
href: `${basePath}/collections/${
|
|
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
|
-
|
|
185
|
+
name
|
|
256
186
|
]
|
|
257
187
|
});
|
|
258
188
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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
|
-
|
|
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
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
-
|
|
677
|
-
|
|
678
|
-
|
|
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
|
-
|
|
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
|