@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.
- 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 +103 -230
- 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 +94 -296
- 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 -180
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
- package/dist/client/components/fields/rich-text-editor/index.mjs +195 -513
- 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 +61 -72
- 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 +285 -605
- 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 +176 -476
- package/dist/client/components/preview/live-preview-mode.mjs +233 -458
- 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 +229 -572
- package/dist/client/components/primitives/select-single.mjs +179 -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.mjs +63 -146
- 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.mjs +14 -36
- package/dist/client/preview/preview-banner.d.mts +2 -2
- 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 +167 -348
- package/dist/client/preview/use-collection-preview.mjs +121 -215
- 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.mjs +86 -321
- package/dist/client/scope/provider.mjs +8 -17
- package/dist/client/utils/build-field-definitions-from-schema.mjs +4 -2
- 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.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.mjs +128 -453
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- 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 -379
- package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
- package/dist/client/views/collection/cells/primitive-cells.mjs +116 -356
- 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 +58 -182
- package/dist/client/views/collection/form-view.mjs +284 -518
- package/dist/client/views/collection/table-view.mjs +231 -463
- package/dist/client/views/collection/view-skeletons.mjs +112 -237
- package/dist/client/views/common/global-search.mjs +241 -560
- 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 +477 -1301
- 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 +458 -1274
- 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.d.mts +2 -2
- package/dist/client/views/pages/accept-invite-page.mjs +95 -290
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/dashboard-page.mjs +11 -57
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.mjs +31 -83
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.mjs +35 -90
- package/dist/client/views/pages/login-page.d.mts +2 -2
- 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.mjs +9 -33
- package/dist/server/adapters/index.d.mts +2 -0
- package/dist/server/adapters/nextjs.d.mts +1 -0
- package/dist/server/auth-helpers.d.mts +1 -0
- package/dist/server/modules/admin/.generated/module.d.mts +1 -0
- package/dist/server/modules/admin/collections/account.d.mts +46 -46
- package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
- 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 +39 -39
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +62 -62
- package/dist/server/modules/admin/collections/verification.d.mts +23 -23
- package/dist/server/modules/admin/index.d.mts +20 -19
- 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 +45 -45
- package/dist/server/modules/audit/.generated/module.d.mts +6 -6
- package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
- package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
- package/dist/server.d.mts +2 -0
- package/package.json +3 -5
|
@@ -9,9 +9,8 @@ import { useIsMobile } from "../../hooks/use-media-query.mjs";
|
|
|
9
9
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../ui/command.mjs";
|
|
10
10
|
import { Drawer, DrawerContent, DrawerHeader, DrawerTitle, DrawerTrigger } from "../ui/drawer.mjs";
|
|
11
11
|
import { FieldSelectTrigger } from "./field-select-control.mjs";
|
|
12
|
-
import { c } from "react/compiler-runtime";
|
|
13
12
|
import { Icon } from "@iconify/react";
|
|
14
|
-
import { useDeferredValue, useId, useState } from "react";
|
|
13
|
+
import { useCallback, useDeferredValue, useId, useMemo, useState } from "react";
|
|
15
14
|
import { useQuery } from "@tanstack/react-query";
|
|
16
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
16
|
|
|
@@ -39,532 +38,213 @@ const SEARCH_OPTION_THRESHOLD = 8;
|
|
|
39
38
|
* />
|
|
40
39
|
* ```
|
|
41
40
|
*/
|
|
42
|
-
function SelectSingle(
|
|
43
|
-
const $ = c(146);
|
|
44
|
-
const { value, onChange, options: staticOptions, loadOptions, queryKey, prefetchOnMount: t1, clearable: t2, loading: t3, emptyMessage: t4, searchable: t5, placeholder: t6, disabled, className, id, "aria-invalid": ariaInvalid, drawerTitle: t7, selectedLabel, isLoadingValue: t8, asInputGroupControl: t9 } = t0;
|
|
45
|
-
const prefetchOnMount = t1 === void 0 ? false : t1;
|
|
46
|
-
const clearable = t2 === void 0 ? true : t2;
|
|
47
|
-
const externalLoading = t3 === void 0 ? false : t3;
|
|
48
|
-
const emptyMessage = t4 === void 0 ? "No options found" : t4;
|
|
49
|
-
const searchable = t5 === void 0 ? "auto" : t5;
|
|
50
|
-
const placeholder = t6 === void 0 ? "Select..." : t6;
|
|
51
|
-
const drawerTitle = t7 === void 0 ? "Select option" : t7;
|
|
52
|
-
const isLoadingValue = t8 === void 0 ? false : t8;
|
|
53
|
-
const asInputGroupControl = t9 === void 0 ? false : t9;
|
|
41
|
+
function SelectSingle({ value, onChange, options: staticOptions, loadOptions, queryKey, prefetchOnMount = false, clearable = true, loading: externalLoading = false, emptyMessage = "No options found", searchable = "auto", placeholder = "Select...", disabled, className, id, "aria-invalid": ariaInvalid, drawerTitle = "Select option", selectedLabel, isLoadingValue = false, asInputGroupControl = false }) {
|
|
54
42
|
const resolvedStaticOptions = staticOptions ?? EMPTY_OPTIONS;
|
|
55
43
|
const resolveText = useResolveText();
|
|
56
44
|
const i18n = useSafeI18n();
|
|
57
|
-
|
|
58
|
-
if ($[0] !== i18n) {
|
|
59
|
-
t10 = (key) => i18n?.t(key) ?? key;
|
|
60
|
-
$[0] = i18n;
|
|
61
|
-
$[1] = t10;
|
|
62
|
-
} else t10 = $[1];
|
|
63
|
-
const translate = t10;
|
|
45
|
+
const translate = useCallback((key) => i18n?.t(key) ?? key, [i18n]);
|
|
64
46
|
const locale = i18n?.locale ?? "en";
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
$[3] = t11;
|
|
73
|
-
} else t11 = $[3];
|
|
74
|
-
const t = t11;
|
|
75
|
-
let t12;
|
|
76
|
-
if ($[4] !== placeholder || $[5] !== resolveText) {
|
|
77
|
-
t12 = resolveText(placeholder);
|
|
78
|
-
$[4] = placeholder;
|
|
79
|
-
$[5] = resolveText;
|
|
80
|
-
$[6] = t12;
|
|
81
|
-
} else t12 = $[6];
|
|
82
|
-
const resolvedPlaceholder = t12;
|
|
83
|
-
let t13;
|
|
84
|
-
if ($[7] !== emptyMessage || $[8] !== resolveText) {
|
|
85
|
-
t13 = resolveText(emptyMessage);
|
|
86
|
-
$[7] = emptyMessage;
|
|
87
|
-
$[8] = resolveText;
|
|
88
|
-
$[9] = t13;
|
|
89
|
-
} else t13 = $[9];
|
|
90
|
-
const resolvedEmptyMessage = t13;
|
|
91
|
-
let t14;
|
|
92
|
-
if ($[10] !== drawerTitle || $[11] !== resolveText) {
|
|
93
|
-
t14 = resolveText(drawerTitle);
|
|
94
|
-
$[10] = drawerTitle;
|
|
95
|
-
$[11] = resolveText;
|
|
96
|
-
$[12] = t14;
|
|
97
|
-
} else t14 = $[12];
|
|
98
|
-
const resolvedDrawerTitle = t14;
|
|
47
|
+
const t = (key, fallback) => {
|
|
48
|
+
const message = translate(key);
|
|
49
|
+
return message && message !== key ? message : fallback;
|
|
50
|
+
};
|
|
51
|
+
const resolvedPlaceholder = resolveText(placeholder);
|
|
52
|
+
const resolvedEmptyMessage = resolveText(emptyMessage);
|
|
53
|
+
const resolvedDrawerTitle = resolveText(drawerTitle);
|
|
99
54
|
const [open, setOpen] = useState(false);
|
|
100
55
|
const [search, setSearch] = useState("");
|
|
101
56
|
const instanceId = useId();
|
|
102
57
|
const deferredSearch = useDeferredValue(search);
|
|
103
58
|
const isMobile = useIsMobile();
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
$[13] = resolvedStaticOptions;
|
|
108
|
-
$[14] = t15;
|
|
109
|
-
} else t15 = $[14];
|
|
110
|
-
const flatStaticOptions = t15;
|
|
111
|
-
let t16;
|
|
112
|
-
if ($[15] !== deferredSearch || $[16] !== instanceId || $[17] !== queryKey) {
|
|
113
|
-
t16 = queryKey ? queryKey(deferredSearch) : [
|
|
59
|
+
const flatStaticOptions = useMemo(() => flattenOptions(resolvedStaticOptions), [resolvedStaticOptions]);
|
|
60
|
+
const { data: dynamicOptions = [], isFetching } = useQuery({
|
|
61
|
+
queryKey: useMemo(() => queryKey ? queryKey(deferredSearch) : [
|
|
114
62
|
"select-single",
|
|
115
63
|
instanceId,
|
|
116
64
|
deferredSearch
|
|
117
|
-
]
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
enabled: t18,
|
|
138
|
-
staleTime: 3e4,
|
|
139
|
-
gcTime: 3e5
|
|
140
|
-
};
|
|
141
|
-
$[22] = loadOptionsKey;
|
|
142
|
-
$[23] = t17;
|
|
143
|
-
$[24] = t18;
|
|
144
|
-
$[25] = t19;
|
|
145
|
-
} else t19 = $[25];
|
|
146
|
-
const { data: t20, isFetching } = useQuery(t19);
|
|
147
|
-
let t21;
|
|
148
|
-
if ($[26] !== t20) {
|
|
149
|
-
t21 = t20 === void 0 ? [] : t20;
|
|
150
|
-
$[26] = t20;
|
|
151
|
-
$[27] = t21;
|
|
152
|
-
} else t21 = $[27];
|
|
153
|
-
const dynamicOptions = t21;
|
|
154
|
-
let t22;
|
|
155
|
-
bb0: {
|
|
156
|
-
if (!loadOptions) {
|
|
157
|
-
t22 = flatStaticOptions;
|
|
158
|
-
break bb0;
|
|
159
|
-
}
|
|
160
|
-
if (flatStaticOptions.length === 0) {
|
|
161
|
-
t22 = dynamicOptions;
|
|
162
|
-
break bb0;
|
|
163
|
-
}
|
|
164
|
-
let t23$1;
|
|
165
|
-
if ($[28] !== dynamicOptions || $[29] !== flatStaticOptions) {
|
|
166
|
-
const mergedMap = [...flatStaticOptions, ...dynamicOptions].reduce(_temp, /* @__PURE__ */ new Map());
|
|
167
|
-
t23$1 = Array.from(mergedMap.values());
|
|
168
|
-
$[28] = dynamicOptions;
|
|
169
|
-
$[29] = flatStaticOptions;
|
|
170
|
-
$[30] = t23$1;
|
|
171
|
-
} else t23$1 = $[30];
|
|
172
|
-
t22 = t23$1;
|
|
173
|
-
}
|
|
174
|
-
const allOptions = t22;
|
|
65
|
+
], [
|
|
66
|
+
queryKey,
|
|
67
|
+
deferredSearch,
|
|
68
|
+
instanceId
|
|
69
|
+
]),
|
|
70
|
+
queryFn: () => loadOptions?.(deferredSearch) ?? Promise.resolve([]),
|
|
71
|
+
enabled: !!loadOptions && (open || prefetchOnMount),
|
|
72
|
+
staleTime: 3e4,
|
|
73
|
+
gcTime: 5 * 6e4
|
|
74
|
+
});
|
|
75
|
+
const allOptions = useMemo(() => {
|
|
76
|
+
if (!loadOptions) return flatStaticOptions;
|
|
77
|
+
if (flatStaticOptions.length === 0) return dynamicOptions;
|
|
78
|
+
const mergedMap = [...flatStaticOptions, ...dynamicOptions].reduce((map, opt) => new Map(map).set(opt.value, opt), /* @__PURE__ */ new Map());
|
|
79
|
+
return Array.from(mergedMap.values());
|
|
80
|
+
}, [
|
|
81
|
+
loadOptions,
|
|
82
|
+
dynamicOptions,
|
|
83
|
+
flatStaticOptions
|
|
84
|
+
]);
|
|
175
85
|
const showSearchInput = searchable === "auto" ? !!loadOptions || allOptions.length > SEARCH_OPTION_THRESHOLD : searchable;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
86
|
+
const getOptionLabel = useCallback((option) => resolveOptionLabel({
|
|
87
|
+
value: option.value,
|
|
88
|
+
label: option.label,
|
|
89
|
+
resolveText,
|
|
90
|
+
t: translate,
|
|
91
|
+
locale
|
|
92
|
+
}), [
|
|
93
|
+
locale,
|
|
94
|
+
resolveText,
|
|
95
|
+
translate
|
|
96
|
+
]);
|
|
97
|
+
const filteredOptions = useMemo(() => {
|
|
98
|
+
if (!showSearchInput) return allOptions;
|
|
99
|
+
if (loadOptions) return allOptions;
|
|
100
|
+
if (!search) return allOptions;
|
|
101
|
+
return allOptions.filter((opt) => getOptionLabel(opt).toLowerCase().includes(search.toLowerCase()));
|
|
102
|
+
}, [
|
|
103
|
+
allOptions,
|
|
104
|
+
search,
|
|
105
|
+
loadOptions,
|
|
106
|
+
getOptionLabel,
|
|
107
|
+
showSearchInput
|
|
108
|
+
]);
|
|
109
|
+
const getLabel = useCallback((val) => {
|
|
110
|
+
return resolveOptionLabel({
|
|
111
|
+
value: val,
|
|
112
|
+
label: allOptions.find((opt) => opt.value === val)?.label,
|
|
181
113
|
resolveText,
|
|
182
114
|
t: translate,
|
|
183
|
-
locale
|
|
115
|
+
locale,
|
|
116
|
+
fallback: selectedLabel ?? String(val)
|
|
184
117
|
});
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
$[40] = search;
|
|
212
|
-
$[41] = t26$1;
|
|
213
|
-
} else t26$1 = $[41];
|
|
214
|
-
t25$1 = allOptions.filter(t26$1);
|
|
215
|
-
$[35] = allOptions;
|
|
216
|
-
$[36] = getOptionLabel;
|
|
217
|
-
$[37] = search;
|
|
218
|
-
$[38] = t25$1;
|
|
219
|
-
} else t25$1 = $[38];
|
|
220
|
-
t24 = t25$1;
|
|
221
|
-
}
|
|
222
|
-
const filteredOptions = t24;
|
|
223
|
-
let t25;
|
|
224
|
-
if ($[42] !== allOptions || $[43] !== locale || $[44] !== resolveText || $[45] !== selectedLabel || $[46] !== translate) {
|
|
225
|
-
t25 = (val) => {
|
|
226
|
-
return resolveOptionLabel({
|
|
227
|
-
value: val,
|
|
228
|
-
label: allOptions.find((opt_1) => opt_1.value === val)?.label,
|
|
229
|
-
resolveText,
|
|
230
|
-
t: translate,
|
|
231
|
-
locale,
|
|
232
|
-
fallback: selectedLabel ?? String(val)
|
|
233
|
-
});
|
|
234
|
-
};
|
|
235
|
-
$[42] = allOptions;
|
|
236
|
-
$[43] = locale;
|
|
237
|
-
$[44] = resolveText;
|
|
238
|
-
$[45] = selectedLabel;
|
|
239
|
-
$[46] = translate;
|
|
240
|
-
$[47] = t25;
|
|
241
|
-
} else t25 = $[47];
|
|
242
|
-
const getLabel = t25;
|
|
243
|
-
let t26;
|
|
244
|
-
if ($[48] !== onChange) {
|
|
245
|
-
t26 = (selectedValue) => {
|
|
246
|
-
onChange(selectedValue);
|
|
247
|
-
setOpen(false);
|
|
248
|
-
setSearch("");
|
|
249
|
-
};
|
|
250
|
-
$[48] = onChange;
|
|
251
|
-
$[49] = t26;
|
|
252
|
-
} else t26 = $[49];
|
|
253
|
-
const handleSelect = t26;
|
|
254
|
-
let t27;
|
|
255
|
-
if ($[50] !== onChange) {
|
|
256
|
-
t27 = (e) => {
|
|
257
|
-
e.preventDefault();
|
|
258
|
-
e.stopPropagation();
|
|
259
|
-
onChange(null);
|
|
260
|
-
};
|
|
261
|
-
$[50] = onChange;
|
|
262
|
-
$[51] = t27;
|
|
263
|
-
} else t27 = $[51];
|
|
264
|
-
const handleClear = t27;
|
|
265
|
-
let t28;
|
|
266
|
-
if ($[52] !== clearable || $[53] !== disabled || $[54] !== handleClear || $[55] !== isLoadingValue || $[56] !== value) {
|
|
267
|
-
t28 = (event) => {
|
|
268
|
-
if (clearable && value && !disabled && !isLoadingValue && (event.key === "Backspace" || event.key === "Delete")) handleClear(event);
|
|
269
|
-
};
|
|
270
|
-
$[52] = clearable;
|
|
271
|
-
$[53] = disabled;
|
|
272
|
-
$[54] = handleClear;
|
|
273
|
-
$[55] = isLoadingValue;
|
|
274
|
-
$[56] = value;
|
|
275
|
-
$[57] = t28;
|
|
276
|
-
} else t28 = $[57];
|
|
277
|
-
const handleTriggerKeyDown = t28;
|
|
118
|
+
}, [
|
|
119
|
+
allOptions,
|
|
120
|
+
locale,
|
|
121
|
+
resolveText,
|
|
122
|
+
selectedLabel,
|
|
123
|
+
translate
|
|
124
|
+
]);
|
|
125
|
+
const handleSelect = useCallback((selectedValue) => {
|
|
126
|
+
onChange(selectedValue);
|
|
127
|
+
setOpen(false);
|
|
128
|
+
setSearch("");
|
|
129
|
+
}, [onChange]);
|
|
130
|
+
const handleClear = useCallback((e) => {
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
e.stopPropagation();
|
|
133
|
+
onChange(null);
|
|
134
|
+
}, [onChange]);
|
|
135
|
+
const handleTriggerKeyDown = useCallback((event) => {
|
|
136
|
+
if (clearable && value && !disabled && !isLoadingValue && (event.key === "Backspace" || event.key === "Delete")) handleClear(event);
|
|
137
|
+
}, [
|
|
138
|
+
clearable,
|
|
139
|
+
disabled,
|
|
140
|
+
handleClear,
|
|
141
|
+
isLoadingValue,
|
|
142
|
+
value
|
|
143
|
+
]);
|
|
278
144
|
const showLoading = isFetching || externalLoading;
|
|
279
145
|
const listboxId = `${instanceId}-listbox`;
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
$[60] = isLoadingValue;
|
|
294
|
-
$[61] = value;
|
|
295
|
-
$[62] = t31;
|
|
296
|
-
} else t31 = $[62];
|
|
297
|
-
const t32 = isLoadingValue && value && "text-muted-foreground";
|
|
298
|
-
let t33;
|
|
299
|
-
if ($[63] !== t32) {
|
|
300
|
-
t33 = cn("truncate", t32);
|
|
301
|
-
$[63] = t32;
|
|
302
|
-
$[64] = t33;
|
|
303
|
-
} else t33 = $[64];
|
|
304
|
-
let t34;
|
|
305
|
-
if ($[65] !== getLabel || $[66] !== resolvedPlaceholder || $[67] !== value) {
|
|
306
|
-
t34 = value ? getLabel(value) : resolvedPlaceholder;
|
|
307
|
-
$[65] = getLabel;
|
|
308
|
-
$[66] = resolvedPlaceholder;
|
|
309
|
-
$[67] = value;
|
|
310
|
-
$[68] = t34;
|
|
311
|
-
} else t34 = $[68];
|
|
312
|
-
let t35;
|
|
313
|
-
if ($[69] !== t33 || $[70] !== t34) {
|
|
314
|
-
t35 = /* @__PURE__ */ jsx("span", {
|
|
315
|
-
className: t33,
|
|
316
|
-
children: t34
|
|
317
|
-
});
|
|
318
|
-
$[69] = t33;
|
|
319
|
-
$[70] = t34;
|
|
320
|
-
$[71] = t35;
|
|
321
|
-
} else t35 = $[71];
|
|
322
|
-
let t36;
|
|
323
|
-
if ($[72] !== t31 || $[73] !== t35) {
|
|
324
|
-
t36 = /* @__PURE__ */ jsxs("span", {
|
|
146
|
+
const selectedOption = value ? allOptions.find((opt) => opt.value === value) : void 0;
|
|
147
|
+
const TriggerButton = /* @__PURE__ */ jsxs(FieldSelectTrigger, {
|
|
148
|
+
id,
|
|
149
|
+
role: "combobox",
|
|
150
|
+
"aria-expanded": open,
|
|
151
|
+
"aria-controls": listboxId,
|
|
152
|
+
"aria-invalid": ariaInvalid,
|
|
153
|
+
disabled,
|
|
154
|
+
hasValue: !!value,
|
|
155
|
+
onKeyDown: handleTriggerKeyDown,
|
|
156
|
+
asInputGroupControl,
|
|
157
|
+
className: cn(className, selectedOption?.className),
|
|
158
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
325
159
|
className: "flex min-w-0 flex-1 items-center gap-1.5 truncate",
|
|
326
|
-
children: [
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
onPointerDown: handleClear,
|
|
338
|
-
onClick: handleClear,
|
|
339
|
-
className: "hover:bg-surface-high -mr-1 inline-flex size-6 items-center justify-center rounded-md opacity-60 transition-[background-color,opacity] hover:opacity-100",
|
|
340
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
341
|
-
icon: "ph:x",
|
|
342
|
-
className: "size-3"
|
|
343
|
-
})
|
|
344
|
-
});
|
|
345
|
-
$[75] = clearable;
|
|
346
|
-
$[76] = disabled;
|
|
347
|
-
$[77] = handleClear;
|
|
348
|
-
$[78] = isLoadingValue;
|
|
349
|
-
$[79] = t;
|
|
350
|
-
$[80] = value;
|
|
351
|
-
$[81] = t37;
|
|
352
|
-
} else t37 = $[81];
|
|
353
|
-
let t38;
|
|
354
|
-
if ($[82] === Symbol.for("react.memo_cache_sentinel")) {
|
|
355
|
-
t38 = /* @__PURE__ */ jsx(Icon, {
|
|
356
|
-
icon: "ph:caret-up-down",
|
|
357
|
-
className: "size-3.5 opacity-50"
|
|
358
|
-
});
|
|
359
|
-
$[82] = t38;
|
|
360
|
-
} else t38 = $[82];
|
|
361
|
-
let t39;
|
|
362
|
-
if ($[83] !== t37) {
|
|
363
|
-
t39 = /* @__PURE__ */ jsxs("div", {
|
|
160
|
+
children: [isLoadingValue && value ? /* @__PURE__ */ jsx(Icon, {
|
|
161
|
+
icon: "ph:circle-notch",
|
|
162
|
+
className: "text-muted-foreground size-3 shrink-0 animate-spin"
|
|
163
|
+
}) : selectedOption?.icon ? /* @__PURE__ */ jsx("span", {
|
|
164
|
+
className: "flex shrink-0 items-center",
|
|
165
|
+
children: selectedOption.icon
|
|
166
|
+
}) : null, /* @__PURE__ */ jsx("span", {
|
|
167
|
+
className: cn("truncate", isLoadingValue && value && "text-muted-foreground"),
|
|
168
|
+
children: value ? getLabel(value) : resolvedPlaceholder
|
|
169
|
+
})]
|
|
170
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
364
171
|
className: "flex h-full shrink-0 items-center gap-1",
|
|
365
|
-
children: [
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
});
|
|
385
|
-
$[85] = ariaInvalid;
|
|
386
|
-
$[86] = asInputGroupControl;
|
|
387
|
-
$[87] = disabled;
|
|
388
|
-
$[88] = handleTriggerKeyDown;
|
|
389
|
-
$[89] = id;
|
|
390
|
-
$[90] = listboxId;
|
|
391
|
-
$[91] = open;
|
|
392
|
-
$[92] = t29;
|
|
393
|
-
$[93] = t30;
|
|
394
|
-
$[94] = t36;
|
|
395
|
-
$[95] = t39;
|
|
396
|
-
$[96] = t40;
|
|
397
|
-
} else t40 = $[96];
|
|
398
|
-
const TriggerButton = t40;
|
|
399
|
-
const t41 = showSearchInput && !loadOptions;
|
|
400
|
-
let t42;
|
|
401
|
-
if ($[97] !== search || $[98] !== showSearchInput || $[99] !== t) {
|
|
402
|
-
t42 = showSearchInput && /* @__PURE__ */ jsx(CommandInput, {
|
|
172
|
+
children: [clearable && value && !disabled && !isLoadingValue && /* @__PURE__ */ jsx("span", {
|
|
173
|
+
"aria-hidden": "true",
|
|
174
|
+
title: t("relation.clear", "Clear selection"),
|
|
175
|
+
onPointerDown: handleClear,
|
|
176
|
+
onClick: handleClear,
|
|
177
|
+
className: "hover:bg-surface-high -mr-1 inline-flex size-6 items-center justify-center rounded-md opacity-60 transition-[background-color,opacity] hover:opacity-100",
|
|
178
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
179
|
+
icon: "ph:x",
|
|
180
|
+
className: "size-3"
|
|
181
|
+
})
|
|
182
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
183
|
+
icon: "ph:caret-up-down",
|
|
184
|
+
className: "size-3.5 opacity-50"
|
|
185
|
+
})]
|
|
186
|
+
})]
|
|
187
|
+
});
|
|
188
|
+
const CommandContent = /* @__PURE__ */ jsxs(Command, {
|
|
189
|
+
shouldFilter: showSearchInput && !loadOptions,
|
|
190
|
+
children: [showSearchInput && /* @__PURE__ */ jsx(CommandInput, {
|
|
403
191
|
placeholder: t("ui.searchPlaceholder", "Search..."),
|
|
404
192
|
value: search,
|
|
405
193
|
onValueChange: setSearch
|
|
406
|
-
})
|
|
407
|
-
$[97] = search;
|
|
408
|
-
$[98] = showSearchInput;
|
|
409
|
-
$[99] = t;
|
|
410
|
-
$[100] = t42;
|
|
411
|
-
} else t42 = $[100];
|
|
412
|
-
let t43;
|
|
413
|
-
if ($[101] !== showLoading) {
|
|
414
|
-
t43 = showLoading && /* @__PURE__ */ jsx("div", {
|
|
415
|
-
className: "flex items-center justify-center py-6",
|
|
416
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
417
|
-
icon: "ph:circle-notch",
|
|
418
|
-
className: "text-muted-foreground size-4 animate-spin"
|
|
419
|
-
})
|
|
420
|
-
});
|
|
421
|
-
$[101] = showLoading;
|
|
422
|
-
$[102] = t43;
|
|
423
|
-
} else t43 = $[102];
|
|
424
|
-
let t44;
|
|
425
|
-
if ($[103] !== resolvedEmptyMessage) {
|
|
426
|
-
t44 = /* @__PURE__ */ jsx(CommandEmpty, { children: resolvedEmptyMessage });
|
|
427
|
-
$[103] = resolvedEmptyMessage;
|
|
428
|
-
$[104] = t44;
|
|
429
|
-
} else t44 = $[104];
|
|
430
|
-
let t45;
|
|
431
|
-
if ($[105] !== filteredOptions || $[106] !== getOptionLabel || $[107] !== handleSelect || $[108] !== value) {
|
|
432
|
-
let t46$1;
|
|
433
|
-
if ($[110] !== getOptionLabel || $[111] !== handleSelect || $[112] !== value) {
|
|
434
|
-
t46$1 = (option_1) => /* @__PURE__ */ jsxs(CommandItem, {
|
|
435
|
-
value: String(option_1.value),
|
|
436
|
-
onSelect: handleSelect,
|
|
437
|
-
disabled: option_1.disabled,
|
|
438
|
-
"data-checked": value === option_1.value,
|
|
439
|
-
children: [option_1.icon, /* @__PURE__ */ jsx("span", {
|
|
440
|
-
className: "truncate",
|
|
441
|
-
children: getOptionLabel(option_1)
|
|
442
|
-
})]
|
|
443
|
-
}, String(option_1.value));
|
|
444
|
-
$[110] = getOptionLabel;
|
|
445
|
-
$[111] = handleSelect;
|
|
446
|
-
$[112] = value;
|
|
447
|
-
$[113] = t46$1;
|
|
448
|
-
} else t46$1 = $[113];
|
|
449
|
-
t45 = filteredOptions.map(t46$1);
|
|
450
|
-
$[105] = filteredOptions;
|
|
451
|
-
$[106] = getOptionLabel;
|
|
452
|
-
$[107] = handleSelect;
|
|
453
|
-
$[108] = value;
|
|
454
|
-
$[109] = t45;
|
|
455
|
-
} else t45 = $[109];
|
|
456
|
-
let t46;
|
|
457
|
-
if ($[114] !== t45) {
|
|
458
|
-
t46 = /* @__PURE__ */ jsx(CommandGroup, { children: t45 });
|
|
459
|
-
$[114] = t45;
|
|
460
|
-
$[115] = t46;
|
|
461
|
-
} else t46 = $[115];
|
|
462
|
-
let t47;
|
|
463
|
-
if ($[116] !== listboxId || $[117] !== t43 || $[118] !== t44 || $[119] !== t46) {
|
|
464
|
-
t47 = /* @__PURE__ */ jsxs(CommandList, {
|
|
194
|
+
}), /* @__PURE__ */ jsxs(CommandList, {
|
|
465
195
|
id: listboxId,
|
|
466
196
|
children: [
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
197
|
+
showLoading && /* @__PURE__ */ jsx("div", {
|
|
198
|
+
className: "flex items-center justify-center py-6",
|
|
199
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
200
|
+
icon: "ph:circle-notch",
|
|
201
|
+
className: "text-muted-foreground size-4 animate-spin"
|
|
202
|
+
})
|
|
203
|
+
}),
|
|
204
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: resolvedEmptyMessage }),
|
|
205
|
+
/* @__PURE__ */ jsx(CommandGroup, { children: filteredOptions.map((option) => {
|
|
206
|
+
const description = option.description ? resolveText(option.description) : void 0;
|
|
207
|
+
return /* @__PURE__ */ jsxs(CommandItem, {
|
|
208
|
+
value: String(option.value),
|
|
209
|
+
onSelect: handleSelect,
|
|
210
|
+
disabled: option.disabled,
|
|
211
|
+
"data-checked": value === option.value,
|
|
212
|
+
className: cn("items-start", option.className),
|
|
213
|
+
children: [option.icon, /* @__PURE__ */ jsxs("div", {
|
|
214
|
+
className: "flex min-w-0 flex-1 flex-col",
|
|
215
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
216
|
+
className: "truncate",
|
|
217
|
+
children: getOptionLabel(option)
|
|
218
|
+
}), description && /* @__PURE__ */ jsx("span", {
|
|
219
|
+
className: "text-muted-foreground truncate text-xs",
|
|
220
|
+
children: description
|
|
221
|
+
})]
|
|
222
|
+
})]
|
|
223
|
+
}, String(option.value));
|
|
224
|
+
}) })
|
|
470
225
|
]
|
|
471
|
-
})
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
} else t48 = $[124];
|
|
489
|
-
const CommandContent = t48;
|
|
490
|
-
if (isMobile) {
|
|
491
|
-
let t49$1;
|
|
492
|
-
if ($[125] !== TriggerButton) {
|
|
493
|
-
t49$1 = /* @__PURE__ */ jsx(DrawerTrigger, {
|
|
494
|
-
asChild: true,
|
|
495
|
-
children: TriggerButton
|
|
496
|
-
});
|
|
497
|
-
$[125] = TriggerButton;
|
|
498
|
-
$[126] = t49$1;
|
|
499
|
-
} else t49$1 = $[126];
|
|
500
|
-
let t50$1;
|
|
501
|
-
if ($[127] !== resolvedDrawerTitle) {
|
|
502
|
-
t50$1 = /* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: resolvedDrawerTitle }) });
|
|
503
|
-
$[127] = resolvedDrawerTitle;
|
|
504
|
-
$[128] = t50$1;
|
|
505
|
-
} else t50$1 = $[128];
|
|
506
|
-
let t51$1;
|
|
507
|
-
if ($[129] !== CommandContent) {
|
|
508
|
-
t51$1 = /* @__PURE__ */ jsx("div", {
|
|
509
|
-
className: "px-4 pb-6",
|
|
510
|
-
children: CommandContent
|
|
511
|
-
});
|
|
512
|
-
$[129] = CommandContent;
|
|
513
|
-
$[130] = t51$1;
|
|
514
|
-
} else t51$1 = $[130];
|
|
515
|
-
let t52;
|
|
516
|
-
if ($[131] !== t50$1 || $[132] !== t51$1) {
|
|
517
|
-
t52 = /* @__PURE__ */ jsxs(DrawerContent, { children: [t50$1, t51$1] });
|
|
518
|
-
$[131] = t50$1;
|
|
519
|
-
$[132] = t51$1;
|
|
520
|
-
$[133] = t52;
|
|
521
|
-
} else t52 = $[133];
|
|
522
|
-
let t53;
|
|
523
|
-
if ($[134] !== open || $[135] !== t49$1 || $[136] !== t52) {
|
|
524
|
-
t53 = /* @__PURE__ */ jsxs(Drawer, {
|
|
525
|
-
open,
|
|
526
|
-
onOpenChange: setOpen,
|
|
527
|
-
children: [t49$1, t52]
|
|
528
|
-
});
|
|
529
|
-
$[134] = open;
|
|
530
|
-
$[135] = t49$1;
|
|
531
|
-
$[136] = t52;
|
|
532
|
-
$[137] = t53;
|
|
533
|
-
} else t53 = $[137];
|
|
534
|
-
return t53;
|
|
535
|
-
}
|
|
536
|
-
let t49;
|
|
537
|
-
if ($[138] !== TriggerButton) {
|
|
538
|
-
t49 = /* @__PURE__ */ jsx(PopoverTrigger, { render: TriggerButton });
|
|
539
|
-
$[138] = TriggerButton;
|
|
540
|
-
$[139] = t49;
|
|
541
|
-
} else t49 = $[139];
|
|
542
|
-
let t50;
|
|
543
|
-
if ($[140] !== CommandContent) {
|
|
544
|
-
t50 = /* @__PURE__ */ jsx(PopoverContent, {
|
|
226
|
+
})]
|
|
227
|
+
});
|
|
228
|
+
if (isMobile) return /* @__PURE__ */ jsxs(Drawer, {
|
|
229
|
+
open,
|
|
230
|
+
onOpenChange: setOpen,
|
|
231
|
+
children: [/* @__PURE__ */ jsx(DrawerTrigger, {
|
|
232
|
+
asChild: true,
|
|
233
|
+
children: TriggerButton
|
|
234
|
+
}), /* @__PURE__ */ jsxs(DrawerContent, { children: [/* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: resolvedDrawerTitle }) }), /* @__PURE__ */ jsx("div", {
|
|
235
|
+
className: "px-4 pb-6",
|
|
236
|
+
children: CommandContent
|
|
237
|
+
})] })]
|
|
238
|
+
});
|
|
239
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
240
|
+
open,
|
|
241
|
+
onOpenChange: setOpen,
|
|
242
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, { render: TriggerButton }), /* @__PURE__ */ jsx(PopoverContent, {
|
|
545
243
|
className: "w-(--anchor-width) p-0",
|
|
546
244
|
align: "start",
|
|
547
245
|
children: CommandContent
|
|
548
|
-
})
|
|
549
|
-
|
|
550
|
-
$[141] = t50;
|
|
551
|
-
} else t50 = $[141];
|
|
552
|
-
let t51;
|
|
553
|
-
if ($[142] !== open || $[143] !== t49 || $[144] !== t50) {
|
|
554
|
-
t51 = /* @__PURE__ */ jsxs(Popover, {
|
|
555
|
-
open,
|
|
556
|
-
onOpenChange: setOpen,
|
|
557
|
-
children: [t49, t50]
|
|
558
|
-
});
|
|
559
|
-
$[142] = open;
|
|
560
|
-
$[143] = t49;
|
|
561
|
-
$[144] = t50;
|
|
562
|
-
$[145] = t51;
|
|
563
|
-
} else t51 = $[145];
|
|
564
|
-
return t51;
|
|
565
|
-
}
|
|
566
|
-
function _temp(map, opt) {
|
|
567
|
-
return new Map(map).set(opt.value, opt);
|
|
246
|
+
})]
|
|
247
|
+
});
|
|
568
248
|
}
|
|
569
249
|
|
|
570
250
|
//#endregion
|