@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
|
@@ -7,7 +7,6 @@ import { useCollectionList } from "../../hooks/use-collection.mjs";
|
|
|
7
7
|
import { useUploadCollection } from "../../hooks/use-upload-collection.mjs";
|
|
8
8
|
import { AssetPreview } from "../primitives/asset-preview.mjs";
|
|
9
9
|
import { MediaGrid } from "./media-grid.mjs";
|
|
10
|
-
import { c } from "react/compiler-runtime";
|
|
11
10
|
import { Icon } from "@iconify/react";
|
|
12
11
|
import * as React from "react";
|
|
13
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -64,494 +63,195 @@ const MIME_TYPE_FILTERS = [
|
|
|
64
63
|
mimePattern: "application/pdf"
|
|
65
64
|
}
|
|
66
65
|
];
|
|
67
|
-
function MediaPickerDialog(
|
|
68
|
-
const $ = c(112);
|
|
69
|
-
const { open, onOpenChange, mode: t1, accept, onSelect, maxItems, collection } = t0;
|
|
70
|
-
const mode = t1 === void 0 ? "single" : t1;
|
|
66
|
+
function MediaPickerDialog({ open, onOpenChange, mode = "single", accept, onSelect, maxItems, collection }) {
|
|
71
67
|
const { t } = useTranslation();
|
|
72
68
|
const { collection: resolvedCollection, collections: availableUploadCollections } = useUploadCollection(collection);
|
|
73
|
-
|
|
74
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
75
|
-
t2 = /* @__PURE__ */ new Set();
|
|
76
|
-
$[0] = t2;
|
|
77
|
-
} else t2 = $[0];
|
|
78
|
-
const [selectedIds, setSelectedIds] = React.useState(t2);
|
|
69
|
+
const [selectedIds, setSelectedIds] = React.useState(/* @__PURE__ */ new Set());
|
|
79
70
|
const [searchQuery, setSearchQuery] = React.useState("");
|
|
80
71
|
const [mimeFilter, setMimeFilter] = React.useState("all");
|
|
81
72
|
const [previewAssetId, setPreviewAssetId] = React.useState(null);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (selectedFilter?.mimePattern) {
|
|
95
|
-
let t5$1;
|
|
96
|
-
if ($[6] !== selectedFilter.mimePattern) {
|
|
97
|
-
t5$1 = { mimeType: { startsWith: selectedFilter.mimePattern } };
|
|
98
|
-
$[6] = selectedFilter.mimePattern;
|
|
99
|
-
$[7] = t5$1;
|
|
100
|
-
} else t5$1 = $[7];
|
|
101
|
-
andConditions.push(t5$1);
|
|
102
|
-
}
|
|
103
|
-
if (accept && accept.length > 0) {
|
|
104
|
-
let t5$1;
|
|
105
|
-
if ($[8] !== accept) {
|
|
106
|
-
t5$1 = accept.map(_temp);
|
|
107
|
-
$[8] = accept;
|
|
108
|
-
$[9] = t5$1;
|
|
109
|
-
} else t5$1 = $[9];
|
|
110
|
-
const acceptPatterns = t5$1;
|
|
111
|
-
if (acceptPatterns.length === 1) andConditions.push(acceptPatterns[0]);
|
|
112
|
-
else {
|
|
113
|
-
let t6$1;
|
|
114
|
-
if ($[10] !== acceptPatterns) {
|
|
115
|
-
t6$1 = { OR: acceptPatterns };
|
|
116
|
-
$[10] = acceptPatterns;
|
|
117
|
-
$[11] = t6$1;
|
|
118
|
-
} else t6$1 = $[11];
|
|
119
|
-
andConditions.push(t6$1);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
$[1] = accept;
|
|
123
|
-
$[2] = mimeFilter;
|
|
124
|
-
$[3] = andConditions;
|
|
125
|
-
} else andConditions = $[3];
|
|
126
|
-
if (andConditions.length === 0) {
|
|
127
|
-
t3 = void 0;
|
|
128
|
-
break bb0;
|
|
73
|
+
const where = React.useMemo(() => {
|
|
74
|
+
const andConditions = [];
|
|
75
|
+
const selectedFilter = MIME_TYPE_FILTERS.find((f) => f.value === mimeFilter);
|
|
76
|
+
if (selectedFilter?.mimePattern) andConditions.push({ mimeType: { startsWith: selectedFilter.mimePattern } });
|
|
77
|
+
if (accept && accept.length > 0) {
|
|
78
|
+
const acceptPatterns = accept.map((pattern) => {
|
|
79
|
+
if (pattern.startsWith(".")) return { filename: { endsWith: pattern } };
|
|
80
|
+
if (pattern.endsWith("/*")) return { mimeType: { startsWith: pattern.slice(0, -1) } };
|
|
81
|
+
return { mimeType: pattern };
|
|
82
|
+
});
|
|
83
|
+
if (acceptPatterns.length === 1) andConditions.push(acceptPatterns[0]);
|
|
84
|
+
else andConditions.push({ OR: acceptPatterns });
|
|
129
85
|
}
|
|
130
|
-
if (andConditions.length ===
|
|
131
|
-
|
|
132
|
-
|
|
86
|
+
if (andConditions.length === 0) return void 0;
|
|
87
|
+
if (andConditions.length === 1) return andConditions[0];
|
|
88
|
+
return { AND: andConditions };
|
|
89
|
+
}, [mimeFilter, accept]);
|
|
90
|
+
const trimmedSearch = searchQuery.trim();
|
|
91
|
+
const { data, isLoading } = useCollectionList(resolvedCollection || "", {
|
|
92
|
+
where,
|
|
93
|
+
search: trimmedSearch || void 0,
|
|
94
|
+
limit: 50,
|
|
95
|
+
orderBy: { createdAt: "desc" }
|
|
96
|
+
}, { enabled: open && !!resolvedCollection });
|
|
97
|
+
const assets = React.useMemo(() => data?.docs || [], [data?.docs]);
|
|
98
|
+
const previewAsset = React.useMemo(() => {
|
|
99
|
+
if (!open || assets.length === 0) return null;
|
|
100
|
+
return assets.find((asset) => asset.id === previewAssetId) ?? assets[0];
|
|
101
|
+
}, [
|
|
102
|
+
assets,
|
|
103
|
+
open,
|
|
104
|
+
previewAssetId
|
|
105
|
+
]);
|
|
106
|
+
const selectedMimeFilterLabel = React.useMemo(() => {
|
|
107
|
+
return t((MIME_TYPE_FILTERS.find((filter) => filter.value === mimeFilter) ?? MIME_TYPE_FILTERS[0]).labelKey);
|
|
108
|
+
}, [mimeFilter, t]);
|
|
109
|
+
const resetPickerState = React.useCallback(() => {
|
|
110
|
+
setSelectedIds(/* @__PURE__ */ new Set());
|
|
111
|
+
setSearchQuery("");
|
|
112
|
+
setMimeFilter("all");
|
|
113
|
+
setPreviewAssetId(null);
|
|
114
|
+
}, []);
|
|
115
|
+
const handleOpenChange = React.useCallback((nextOpen) => {
|
|
116
|
+
if (!nextOpen) resetPickerState();
|
|
117
|
+
onOpenChange(nextOpen);
|
|
118
|
+
}, [onOpenChange, resetPickerState]);
|
|
119
|
+
const handleSelectionChange = (ids) => {
|
|
120
|
+
if (mode === "multiple" && maxItems && ids.size > maxItems) {
|
|
121
|
+
toast.warning(t("error.maxItemsAllowed", { max: maxItems }));
|
|
122
|
+
return;
|
|
133
123
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
$
|
|
139
|
-
|
|
140
|
-
t3 = t4$1;
|
|
141
|
-
}
|
|
142
|
-
const where = t3;
|
|
143
|
-
let t4;
|
|
144
|
-
if ($[14] !== searchQuery) {
|
|
145
|
-
t4 = searchQuery.trim();
|
|
146
|
-
$[14] = searchQuery;
|
|
147
|
-
$[15] = t4;
|
|
148
|
-
} else t4 = $[15];
|
|
149
|
-
const t5 = t4 || void 0;
|
|
150
|
-
let t6;
|
|
151
|
-
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
152
|
-
t6 = { createdAt: "desc" };
|
|
153
|
-
$[16] = t6;
|
|
154
|
-
} else t6 = $[16];
|
|
155
|
-
let t7;
|
|
156
|
-
if ($[17] !== t5 || $[18] !== where) {
|
|
157
|
-
t7 = {
|
|
158
|
-
where,
|
|
159
|
-
search: t5,
|
|
160
|
-
limit: 50,
|
|
161
|
-
orderBy: t6
|
|
162
|
-
};
|
|
163
|
-
$[17] = t5;
|
|
164
|
-
$[18] = where;
|
|
165
|
-
$[19] = t7;
|
|
166
|
-
} else t7 = $[19];
|
|
167
|
-
const t8 = open && !!resolvedCollection;
|
|
168
|
-
let t9;
|
|
169
|
-
if ($[20] !== t8) {
|
|
170
|
-
t9 = { enabled: t8 };
|
|
171
|
-
$[20] = t8;
|
|
172
|
-
$[21] = t9;
|
|
173
|
-
} else t9 = $[21];
|
|
174
|
-
const { data, isLoading } = useCollectionList(resolvedCollection || "", t7, t9);
|
|
175
|
-
data?.docs;
|
|
176
|
-
let t10;
|
|
177
|
-
if ($[22] !== data?.docs) {
|
|
178
|
-
t10 = data?.docs || [];
|
|
179
|
-
$[22] = data?.docs;
|
|
180
|
-
$[23] = t10;
|
|
181
|
-
} else t10 = $[23];
|
|
182
|
-
const assets = t10;
|
|
183
|
-
let t11;
|
|
184
|
-
bb1: {
|
|
185
|
-
if (!open || assets.length === 0) {
|
|
186
|
-
t11 = null;
|
|
187
|
-
break bb1;
|
|
124
|
+
setSelectedIds(ids);
|
|
125
|
+
};
|
|
126
|
+
const handleSelect = () => {
|
|
127
|
+
if (!resolvedCollection) {
|
|
128
|
+
toast.error(availableUploadCollections.length > 1 ? `Multiple upload collections are available (${availableUploadCollections.join(", ")}). Specify the collection for MediaPickerDialog.` : "No upload collection is configured for media library.");
|
|
129
|
+
return;
|
|
188
130
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
let t13;
|
|
208
|
-
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
209
|
-
t13 = () => {
|
|
210
|
-
setSelectedIds(/* @__PURE__ */ new Set());
|
|
211
|
-
setSearchQuery("");
|
|
212
|
-
setMimeFilter("all");
|
|
213
|
-
setPreviewAssetId(null);
|
|
214
|
-
};
|
|
215
|
-
$[30] = t13;
|
|
216
|
-
} else t13 = $[30];
|
|
217
|
-
const resetPickerState = t13;
|
|
218
|
-
let t14;
|
|
219
|
-
if ($[31] !== onOpenChange) {
|
|
220
|
-
t14 = (nextOpen) => {
|
|
221
|
-
if (!nextOpen) resetPickerState();
|
|
222
|
-
onOpenChange(nextOpen);
|
|
223
|
-
};
|
|
224
|
-
$[31] = onOpenChange;
|
|
225
|
-
$[32] = t14;
|
|
226
|
-
} else t14 = $[32];
|
|
227
|
-
const handleOpenChange = t14;
|
|
228
|
-
let t15;
|
|
229
|
-
if ($[33] !== maxItems || $[34] !== mode || $[35] !== t) {
|
|
230
|
-
t15 = (ids) => {
|
|
231
|
-
if (mode === "multiple" && maxItems && ids.size > maxItems) {
|
|
232
|
-
toast.warning(t("error.maxItemsAllowed", { max: maxItems }));
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
setSelectedIds(ids);
|
|
236
|
-
};
|
|
237
|
-
$[33] = maxItems;
|
|
238
|
-
$[34] = mode;
|
|
239
|
-
$[35] = t;
|
|
240
|
-
$[36] = t15;
|
|
241
|
-
} else t15 = $[36];
|
|
242
|
-
const handleSelectionChange = t15;
|
|
243
|
-
let t16;
|
|
244
|
-
if ($[37] !== assets || $[38] !== availableUploadCollections || $[39] !== handleOpenChange || $[40] !== mode || $[41] !== onSelect || $[42] !== resolvedCollection || $[43] !== selectedIds || $[44] !== t) {
|
|
245
|
-
t16 = () => {
|
|
246
|
-
if (!resolvedCollection) {
|
|
247
|
-
toast.error(availableUploadCollections.length > 1 ? `Multiple upload collections are available (${availableUploadCollections.join(", ")}). Specify the collection for MediaPickerDialog.` : "No upload collection is configured for media library.");
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
if (selectedIds.size === 0) {
|
|
251
|
-
toast.error(t("error.selectAtLeastOne"));
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
if (mode === "single") {
|
|
255
|
-
const [id] = Array.from(selectedIds);
|
|
256
|
-
onSelect(id, assets.find((candidate) => candidate.id === id));
|
|
257
|
-
} else onSelect(Array.from(selectedIds), assets.filter((asset_1) => selectedIds.has(asset_1.id)));
|
|
258
|
-
handleOpenChange(false);
|
|
259
|
-
};
|
|
260
|
-
$[37] = assets;
|
|
261
|
-
$[38] = availableUploadCollections;
|
|
262
|
-
$[39] = handleOpenChange;
|
|
263
|
-
$[40] = mode;
|
|
264
|
-
$[41] = onSelect;
|
|
265
|
-
$[42] = resolvedCollection;
|
|
266
|
-
$[43] = selectedIds;
|
|
267
|
-
$[44] = t;
|
|
268
|
-
$[45] = t16;
|
|
269
|
-
} else t16 = $[45];
|
|
270
|
-
const handleSelect = t16;
|
|
271
|
-
let t17;
|
|
272
|
-
if ($[46] !== handleOpenChange) {
|
|
273
|
-
t17 = () => {
|
|
274
|
-
handleOpenChange(false);
|
|
275
|
-
};
|
|
276
|
-
$[46] = handleOpenChange;
|
|
277
|
-
$[47] = t17;
|
|
278
|
-
} else t17 = $[47];
|
|
279
|
-
const handleCancel = t17;
|
|
280
|
-
let t18;
|
|
281
|
-
if ($[48] !== t) {
|
|
282
|
-
t18 = t("media.browseLibrary");
|
|
283
|
-
$[48] = t;
|
|
284
|
-
$[49] = t18;
|
|
285
|
-
} else t18 = $[49];
|
|
286
|
-
let t19;
|
|
287
|
-
if ($[50] !== t18) {
|
|
288
|
-
t19 = /* @__PURE__ */ jsx(SheetTitle, { children: t18 });
|
|
289
|
-
$[50] = t18;
|
|
290
|
-
$[51] = t19;
|
|
291
|
-
} else t19 = $[51];
|
|
292
|
-
const t20 = mode === "single" ? "Select an asset from your library" : `Select up to ${maxItems || "multiple"} assets`;
|
|
293
|
-
let t21;
|
|
294
|
-
if ($[52] !== t20) {
|
|
295
|
-
t21 = /* @__PURE__ */ jsx(SheetDescription, { children: t20 });
|
|
296
|
-
$[52] = t20;
|
|
297
|
-
$[53] = t21;
|
|
298
|
-
} else t21 = $[53];
|
|
299
|
-
let t22;
|
|
300
|
-
if ($[54] !== t19 || $[55] !== t21) {
|
|
301
|
-
t22 = /* @__PURE__ */ jsxs(SheetHeader, {
|
|
302
|
-
className: "px-6 pt-6",
|
|
303
|
-
children: [t19, t21]
|
|
304
|
-
});
|
|
305
|
-
$[54] = t19;
|
|
306
|
-
$[55] = t21;
|
|
307
|
-
$[56] = t22;
|
|
308
|
-
} else t22 = $[56];
|
|
309
|
-
let t23;
|
|
310
|
-
if ($[57] !== availableUploadCollections || $[58] !== resolvedCollection) {
|
|
311
|
-
t23 = !resolvedCollection && /* @__PURE__ */ jsx("div", {
|
|
312
|
-
className: "border-warning/40 bg-warning/5 text-warning border p-3 text-sm",
|
|
313
|
-
children: availableUploadCollections.length > 1 ? `Multiple upload collections are available (${availableUploadCollections.join(", ")}). Pass the collection prop to choose one.` : "No upload collection is configured for media library."
|
|
314
|
-
});
|
|
315
|
-
$[57] = availableUploadCollections;
|
|
316
|
-
$[58] = resolvedCollection;
|
|
317
|
-
$[59] = t23;
|
|
318
|
-
} else t23 = $[59];
|
|
319
|
-
let t24;
|
|
320
|
-
if ($[60] === Symbol.for("react.memo_cache_sentinel")) {
|
|
321
|
-
t24 = /* @__PURE__ */ jsx(Icon, {
|
|
322
|
-
icon: "ph:magnifying-glass-bold",
|
|
323
|
-
className: "text-muted-foreground absolute top-1/2 left-3 size-4 -translate-y-1/2"
|
|
324
|
-
});
|
|
325
|
-
$[60] = t24;
|
|
326
|
-
} else t24 = $[60];
|
|
327
|
-
let t25;
|
|
328
|
-
if ($[61] !== t) {
|
|
329
|
-
t25 = t("media.searchPlaceholder");
|
|
330
|
-
$[61] = t;
|
|
331
|
-
$[62] = t25;
|
|
332
|
-
} else t25 = $[62];
|
|
333
|
-
let t26;
|
|
334
|
-
if ($[63] === Symbol.for("react.memo_cache_sentinel")) {
|
|
335
|
-
t26 = (e) => setSearchQuery(e.target.value);
|
|
336
|
-
$[63] = t26;
|
|
337
|
-
} else t26 = $[63];
|
|
338
|
-
let t27;
|
|
339
|
-
if ($[64] !== searchQuery || $[65] !== t25) {
|
|
340
|
-
t27 = /* @__PURE__ */ jsxs("div", {
|
|
341
|
-
className: "relative flex-1",
|
|
342
|
-
children: [t24, /* @__PURE__ */ jsx(Input, {
|
|
343
|
-
type: "text",
|
|
344
|
-
placeholder: t25,
|
|
345
|
-
value: searchQuery,
|
|
346
|
-
onChange: t26,
|
|
347
|
-
className: "pl-9"
|
|
348
|
-
})]
|
|
349
|
-
});
|
|
350
|
-
$[64] = searchQuery;
|
|
351
|
-
$[65] = t25;
|
|
352
|
-
$[66] = t27;
|
|
353
|
-
} else t27 = $[66];
|
|
354
|
-
let t28;
|
|
355
|
-
if ($[67] !== accept || $[68] !== mimeFilter || $[69] !== selectedMimeFilterLabel || $[70] !== t) {
|
|
356
|
-
t28 = !accept && /* @__PURE__ */ jsxs(Select, {
|
|
357
|
-
value: mimeFilter,
|
|
358
|
-
onValueChange: (value) => setMimeFilter(value || "all"),
|
|
359
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
360
|
-
className: "w-full sm:w-[180px]",
|
|
361
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
362
|
-
className: "flex items-center gap-2",
|
|
363
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
364
|
-
icon: "ph:funnel-simple-bold",
|
|
365
|
-
className: "size-4"
|
|
366
|
-
}), /* @__PURE__ */ jsx(SelectValue, { children: selectedMimeFilterLabel })]
|
|
367
|
-
})
|
|
368
|
-
}), /* @__PURE__ */ jsx(SelectContent, { children: MIME_TYPE_FILTERS.map((filter_0) => /* @__PURE__ */ jsx(SelectItem, {
|
|
369
|
-
value: filter_0.value,
|
|
370
|
-
children: t(filter_0.labelKey)
|
|
371
|
-
}, filter_0.value)) })]
|
|
372
|
-
});
|
|
373
|
-
$[67] = accept;
|
|
374
|
-
$[68] = mimeFilter;
|
|
375
|
-
$[69] = selectedMimeFilterLabel;
|
|
376
|
-
$[70] = t;
|
|
377
|
-
$[71] = t28;
|
|
378
|
-
} else t28 = $[71];
|
|
379
|
-
let t29;
|
|
380
|
-
if ($[72] !== t27 || $[73] !== t28) {
|
|
381
|
-
t29 = /* @__PURE__ */ jsxs("div", {
|
|
382
|
-
className: "flex flex-col gap-3 border-b pb-4 sm:flex-row",
|
|
383
|
-
children: [t27, t28]
|
|
384
|
-
});
|
|
385
|
-
$[72] = t27;
|
|
386
|
-
$[73] = t28;
|
|
387
|
-
$[74] = t29;
|
|
388
|
-
} else t29 = $[74];
|
|
389
|
-
let t30;
|
|
390
|
-
if ($[75] === Symbol.for("react.memo_cache_sentinel")) {
|
|
391
|
-
t30 = (asset_2) => setPreviewAssetId(asset_2.id);
|
|
392
|
-
$[75] = t30;
|
|
393
|
-
} else t30 = $[75];
|
|
394
|
-
let t31;
|
|
395
|
-
if ($[76] !== assets || $[77] !== handleSelectionChange || $[78] !== isLoading || $[79] !== mode || $[80] !== selectedIds) {
|
|
396
|
-
t31 = /* @__PURE__ */ jsx("div", {
|
|
397
|
-
className: "flex-1 overflow-y-auto pr-1",
|
|
398
|
-
children: /* @__PURE__ */ jsx(MediaGrid, {
|
|
399
|
-
assets,
|
|
400
|
-
selectedIds,
|
|
401
|
-
onSelectionChange: handleSelectionChange,
|
|
402
|
-
selectionMode: mode,
|
|
403
|
-
loading: isLoading,
|
|
404
|
-
columns: 5,
|
|
405
|
-
className: "gap-2",
|
|
406
|
-
onAssetClick: t30
|
|
407
|
-
})
|
|
408
|
-
});
|
|
409
|
-
$[76] = assets;
|
|
410
|
-
$[77] = handleSelectionChange;
|
|
411
|
-
$[78] = isLoading;
|
|
412
|
-
$[79] = mode;
|
|
413
|
-
$[80] = selectedIds;
|
|
414
|
-
$[81] = t31;
|
|
415
|
-
} else t31 = $[81];
|
|
416
|
-
let t32;
|
|
417
|
-
if ($[82] === Symbol.for("react.memo_cache_sentinel")) {
|
|
418
|
-
t32 = /* @__PURE__ */ jsx("p", {
|
|
419
|
-
className: "text-muted-foreground font-chrome chrome-meta text-xs font-medium",
|
|
420
|
-
children: "Preview"
|
|
421
|
-
});
|
|
422
|
-
$[82] = t32;
|
|
423
|
-
} else t32 = $[82];
|
|
424
|
-
let t33;
|
|
425
|
-
if ($[83] !== previewAsset) {
|
|
426
|
-
t33 = /* @__PURE__ */ jsxs("div", {
|
|
427
|
-
className: "border-border hidden w-80 shrink-0 flex-col gap-3 border-l pl-4 lg:flex xl:w-96",
|
|
428
|
-
children: [t32, previewAsset ? /* @__PURE__ */ jsx(AssetPreview, {
|
|
429
|
-
asset: previewAsset,
|
|
430
|
-
variant: "card"
|
|
431
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
432
|
-
className: "text-muted-foreground flex min-h-24 items-center justify-center p-4 text-sm",
|
|
433
|
-
children: "Select an asset to preview"
|
|
434
|
-
})]
|
|
435
|
-
});
|
|
436
|
-
$[83] = previewAsset;
|
|
437
|
-
$[84] = t33;
|
|
438
|
-
} else t33 = $[84];
|
|
439
|
-
let t34;
|
|
440
|
-
if ($[85] !== t31 || $[86] !== t33) {
|
|
441
|
-
t34 = /* @__PURE__ */ jsxs("div", {
|
|
442
|
-
className: "flex flex-1 gap-4 overflow-hidden",
|
|
443
|
-
children: [t31, t33]
|
|
444
|
-
});
|
|
445
|
-
$[85] = t31;
|
|
446
|
-
$[86] = t33;
|
|
447
|
-
$[87] = t34;
|
|
448
|
-
} else t34 = $[87];
|
|
449
|
-
let t35;
|
|
450
|
-
if ($[88] !== previewAsset) {
|
|
451
|
-
t35 = /* @__PURE__ */ jsx("div", {
|
|
452
|
-
className: "border-t pt-4 lg:hidden",
|
|
453
|
-
children: previewAsset ? /* @__PURE__ */ jsx(AssetPreview, {
|
|
454
|
-
asset: previewAsset,
|
|
455
|
-
variant: "compact"
|
|
456
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
457
|
-
className: "text-muted-foreground flex min-h-16 items-center justify-center p-2 text-sm",
|
|
458
|
-
children: "Select an asset to preview"
|
|
459
|
-
})
|
|
460
|
-
});
|
|
461
|
-
$[88] = previewAsset;
|
|
462
|
-
$[89] = t35;
|
|
463
|
-
} else t35 = $[89];
|
|
464
|
-
let t36;
|
|
465
|
-
if ($[90] !== t23 || $[91] !== t29 || $[92] !== t34 || $[93] !== t35) {
|
|
466
|
-
t36 = /* @__PURE__ */ jsxs("div", {
|
|
467
|
-
className: "flex flex-1 flex-col gap-4 overflow-hidden px-6 pb-6",
|
|
468
|
-
children: [
|
|
469
|
-
t23,
|
|
470
|
-
t29,
|
|
471
|
-
t34,
|
|
472
|
-
t35
|
|
473
|
-
]
|
|
474
|
-
});
|
|
475
|
-
$[90] = t23;
|
|
476
|
-
$[91] = t29;
|
|
477
|
-
$[92] = t34;
|
|
478
|
-
$[93] = t35;
|
|
479
|
-
$[94] = t36;
|
|
480
|
-
} else t36 = $[94];
|
|
481
|
-
let t37;
|
|
482
|
-
if ($[95] !== handleCancel) {
|
|
483
|
-
t37 = /* @__PURE__ */ jsx(Button, {
|
|
484
|
-
variant: "outline",
|
|
485
|
-
onClick: handleCancel,
|
|
486
|
-
children: "Cancel"
|
|
487
|
-
});
|
|
488
|
-
$[95] = handleCancel;
|
|
489
|
-
$[96] = t37;
|
|
490
|
-
} else t37 = $[96];
|
|
491
|
-
const t38 = selectedIds.size === 0 || isLoading;
|
|
492
|
-
const t39 = selectedIds.size > 0 && `(${selectedIds.size})`;
|
|
493
|
-
let t40;
|
|
494
|
-
if ($[97] !== handleSelect || $[98] !== t38 || $[99] !== t39) {
|
|
495
|
-
t40 = /* @__PURE__ */ jsxs(Button, {
|
|
496
|
-
className: "tabular-nums",
|
|
497
|
-
onClick: handleSelect,
|
|
498
|
-
disabled: t38,
|
|
499
|
-
children: ["Select ", t39]
|
|
500
|
-
});
|
|
501
|
-
$[97] = handleSelect;
|
|
502
|
-
$[98] = t38;
|
|
503
|
-
$[99] = t39;
|
|
504
|
-
$[100] = t40;
|
|
505
|
-
} else t40 = $[100];
|
|
506
|
-
let t41;
|
|
507
|
-
if ($[101] !== t37 || $[102] !== t40) {
|
|
508
|
-
t41 = /* @__PURE__ */ jsx(SheetFooter, {
|
|
509
|
-
className: "border-t px-6 py-4",
|
|
510
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
511
|
-
className: "flex w-full justify-end gap-2",
|
|
512
|
-
children: [t37, t40]
|
|
513
|
-
})
|
|
514
|
-
});
|
|
515
|
-
$[101] = t37;
|
|
516
|
-
$[102] = t40;
|
|
517
|
-
$[103] = t41;
|
|
518
|
-
} else t41 = $[103];
|
|
519
|
-
let t42;
|
|
520
|
-
if ($[104] !== t22 || $[105] !== t36 || $[106] !== t41) {
|
|
521
|
-
t42 = /* @__PURE__ */ jsxs(SheetContent, {
|
|
131
|
+
if (selectedIds.size === 0) {
|
|
132
|
+
toast.error(t("error.selectAtLeastOne"));
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (mode === "single") {
|
|
136
|
+
const [id] = Array.from(selectedIds);
|
|
137
|
+
onSelect(id, assets.find((candidate) => candidate.id === id));
|
|
138
|
+
} else onSelect(Array.from(selectedIds), assets.filter((asset) => selectedIds.has(asset.id)));
|
|
139
|
+
handleOpenChange(false);
|
|
140
|
+
};
|
|
141
|
+
const handleCancel = () => {
|
|
142
|
+
handleOpenChange(false);
|
|
143
|
+
};
|
|
144
|
+
return /* @__PURE__ */ jsx(Sheet, {
|
|
145
|
+
open,
|
|
146
|
+
onOpenChange: handleOpenChange,
|
|
147
|
+
modal: false,
|
|
148
|
+
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
522
149
|
side: "right",
|
|
523
150
|
showOverlay: false,
|
|
524
151
|
className: "qa-media-picker w-full p-0 data-[side=right]:sm:max-w-6xl",
|
|
525
152
|
children: [
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
153
|
+
/* @__PURE__ */ jsxs(SheetHeader, {
|
|
154
|
+
className: "px-6 pt-6",
|
|
155
|
+
children: [/* @__PURE__ */ jsx(SheetTitle, { children: t("media.browseLibrary") }), /* @__PURE__ */ jsx(SheetDescription, { children: mode === "single" ? "Select an asset from your library" : `Select up to ${maxItems || "multiple"} assets` })]
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ jsxs("div", {
|
|
158
|
+
className: "flex flex-1 flex-col gap-4 overflow-hidden px-6 pb-6",
|
|
159
|
+
children: [
|
|
160
|
+
!resolvedCollection && /* @__PURE__ */ jsx("div", {
|
|
161
|
+
className: "border-warning/40 bg-warning/5 text-warning border p-3 text-sm",
|
|
162
|
+
children: availableUploadCollections.length > 1 ? `Multiple upload collections are available (${availableUploadCollections.join(", ")}). Pass the collection prop to choose one.` : "No upload collection is configured for media library."
|
|
163
|
+
}),
|
|
164
|
+
/* @__PURE__ */ jsxs("div", {
|
|
165
|
+
className: "flex flex-col gap-3 border-b pb-4 sm:flex-row",
|
|
166
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
167
|
+
className: "relative flex-1",
|
|
168
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
169
|
+
icon: "ph:magnifying-glass-bold",
|
|
170
|
+
className: "text-muted-foreground absolute top-1/2 left-3 size-4 -translate-y-1/2"
|
|
171
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
172
|
+
type: "text",
|
|
173
|
+
placeholder: t("media.searchPlaceholder"),
|
|
174
|
+
value: searchQuery,
|
|
175
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
176
|
+
className: "pl-9"
|
|
177
|
+
})]
|
|
178
|
+
}), !accept && /* @__PURE__ */ jsxs(Select, {
|
|
179
|
+
value: mimeFilter,
|
|
180
|
+
onValueChange: (value) => setMimeFilter(value || "all"),
|
|
181
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
182
|
+
className: "w-full sm:w-[180px]",
|
|
183
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
184
|
+
className: "flex items-center gap-2",
|
|
185
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
186
|
+
icon: "ph:funnel-simple-bold",
|
|
187
|
+
className: "size-4"
|
|
188
|
+
}), /* @__PURE__ */ jsx(SelectValue, { children: selectedMimeFilterLabel })]
|
|
189
|
+
})
|
|
190
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: MIME_TYPE_FILTERS.map((filter) => /* @__PURE__ */ jsx(SelectItem, {
|
|
191
|
+
value: filter.value,
|
|
192
|
+
children: t(filter.labelKey)
|
|
193
|
+
}, filter.value)) })]
|
|
194
|
+
})]
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ jsxs("div", {
|
|
197
|
+
className: "flex flex-1 gap-4 overflow-hidden",
|
|
198
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
199
|
+
className: "flex-1 overflow-y-auto pr-1",
|
|
200
|
+
children: /* @__PURE__ */ jsx(MediaGrid, {
|
|
201
|
+
assets,
|
|
202
|
+
selectedIds,
|
|
203
|
+
onSelectionChange: handleSelectionChange,
|
|
204
|
+
selectionMode: mode,
|
|
205
|
+
loading: isLoading,
|
|
206
|
+
columns: 5,
|
|
207
|
+
className: "gap-2",
|
|
208
|
+
onAssetClick: (asset) => setPreviewAssetId(asset.id)
|
|
209
|
+
})
|
|
210
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
211
|
+
className: "border-border hidden w-80 shrink-0 flex-col gap-3 border-l pl-4 lg:flex xl:w-96",
|
|
212
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
213
|
+
className: "text-muted-foreground font-chrome chrome-meta text-xs font-medium",
|
|
214
|
+
children: "Preview"
|
|
215
|
+
}), previewAsset ? /* @__PURE__ */ jsx(AssetPreview, {
|
|
216
|
+
asset: previewAsset,
|
|
217
|
+
variant: "card"
|
|
218
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
219
|
+
className: "text-muted-foreground flex min-h-24 items-center justify-center p-4 text-sm",
|
|
220
|
+
children: "Select an asset to preview"
|
|
221
|
+
})]
|
|
222
|
+
})]
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ jsx("div", {
|
|
225
|
+
className: "border-t pt-4 lg:hidden",
|
|
226
|
+
children: previewAsset ? /* @__PURE__ */ jsx(AssetPreview, {
|
|
227
|
+
asset: previewAsset,
|
|
228
|
+
variant: "compact"
|
|
229
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
230
|
+
className: "text-muted-foreground flex min-h-16 items-center justify-center p-2 text-sm",
|
|
231
|
+
children: "Select an asset to preview"
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ jsx(SheetFooter, {
|
|
237
|
+
className: "border-t px-6 py-4",
|
|
238
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
239
|
+
className: "flex w-full justify-end gap-2",
|
|
240
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
241
|
+
variant: "outline",
|
|
242
|
+
onClick: handleCancel,
|
|
243
|
+
children: "Cancel"
|
|
244
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
245
|
+
className: "tabular-nums",
|
|
246
|
+
onClick: handleSelect,
|
|
247
|
+
disabled: selectedIds.size === 0 || isLoading,
|
|
248
|
+
children: ["Select ", selectedIds.size > 0 && `(${selectedIds.size})`]
|
|
249
|
+
})]
|
|
250
|
+
})
|
|
251
|
+
})
|
|
529
252
|
]
|
|
530
|
-
})
|
|
531
|
-
|
|
532
|
-
$[105] = t36;
|
|
533
|
-
$[106] = t41;
|
|
534
|
-
$[107] = t42;
|
|
535
|
-
} else t42 = $[107];
|
|
536
|
-
let t43;
|
|
537
|
-
if ($[108] !== handleOpenChange || $[109] !== open || $[110] !== t42) {
|
|
538
|
-
t43 = /* @__PURE__ */ jsx(Sheet, {
|
|
539
|
-
open,
|
|
540
|
-
onOpenChange: handleOpenChange,
|
|
541
|
-
modal: false,
|
|
542
|
-
children: t42
|
|
543
|
-
});
|
|
544
|
-
$[108] = handleOpenChange;
|
|
545
|
-
$[109] = open;
|
|
546
|
-
$[110] = t42;
|
|
547
|
-
$[111] = t43;
|
|
548
|
-
} else t43 = $[111];
|
|
549
|
-
return t43;
|
|
550
|
-
}
|
|
551
|
-
function _temp(pattern) {
|
|
552
|
-
if (pattern.startsWith(".")) return { filename: { endsWith: pattern } };
|
|
553
|
-
if (pattern.endsWith("/*")) return { mimeType: { startsWith: pattern.slice(0, -1) } };
|
|
554
|
-
return { mimeType: pattern };
|
|
253
|
+
})
|
|
254
|
+
});
|
|
555
255
|
}
|
|
556
256
|
|
|
557
257
|
//#endregion
|