@panneau/media 5.0.0-alpha.6 → 5.0.0-alpha.8
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/README.md +1 -0
- package/dist/ImageItem.d.ts +1 -1
- package/dist/ImageItem.js.map +1 -1
- package/dist/MediaField.d.ts +1 -1
- package/dist/MediaField.d.ts.map +1 -1
- package/dist/MediaField.js +603 -237
- package/dist/MediaField.js.map +1 -1
- package/dist/editor/ImageEditor.d.ts +1 -1
- package/dist/editor/ImageEditor.js +376 -145
- package/dist/editor/ImageEditor.js.map +1 -1
- package/dist/editor/draw.d.ts +2 -2
- package/dist/editor/draw.js +49 -12
- package/dist/editor/draw.js.map +1 -1
- package/dist/editor/geometry.js.map +1 -1
- package/dist/editor/index.d.ts +4 -4
- package/dist/editor/tools.d.ts +1 -1
- package/dist/editor/tools.js.map +1 -1
- package/dist/editor/types.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/picker/MediaDetails.d.ts +1 -1
- package/dist/picker/MediaDetails.js.map +1 -1
- package/dist/picker/MediaGrid.d.ts +1 -1
- package/dist/picker/MediaGrid.js +57 -15
- package/dist/picker/MediaGrid.js.map +1 -1
- package/dist/picker/MediaPicker.css +0 -45
- package/dist/picker/MediaPicker.d.ts +1 -1
- package/dist/picker/MediaPicker.d.ts.map +1 -1
- package/dist/picker/MediaPicker.js +859 -342
- package/dist/picker/MediaPicker.js.map +1 -1
- package/dist/picker/MediaPicker.module.js +1 -11
- package/dist/picker/MediaPicker.module.js.map +1 -1
- package/dist/picker/PickerToolbar.d.ts +2 -2
- package/dist/picker/PickerToolbar.js.map +1 -1
- package/dist/picker/UploadPanel.js.map +1 -1
- package/dist/picker/format.d.ts +1 -1
- package/dist/picker/format.js.map +1 -1
- package/dist/picker/index.d.ts +2 -2
- package/dist/picker/useMediaBrowser.d.ts +1 -1
- package/dist/picker/useMediaBrowser.js.map +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/resourceSource.d.ts +1 -1
- package/dist/resourceSource.js.map +1 -1
- package/package.json +9 -9
|
@@ -10,7 +10,7 @@ import { Images, Lock, SearchX } from "lucide-react";
|
|
|
10
10
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
11
11
|
import { formatSize, useFieldsContext, useRejectionMessage, useUploads } from "@panneau/fields";
|
|
12
12
|
import { mediaMessages } from "@panneau/intl";
|
|
13
|
-
import { Alert, Button, Dialog, Heading, SegmentedControl, Select, Spinner, Tab, TabList, TabPanel, Tabs, Text, usePanneauIntl } from "@panneau/ui";
|
|
13
|
+
import { Alert, Button, Dialog, Heading, LoadingRegion, SegmentedControl, Select, Skeleton, Spinner, Tab, TabList, TabPanel, Tabs, Text, usePanneauIntl } from "@panneau/ui";
|
|
14
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
//#region src/picker/MediaPicker.tsx
|
|
16
16
|
var NO_FILTER = {};
|
|
@@ -32,13 +32,13 @@ function toReference({ source, item }) {
|
|
|
32
32
|
media: item.media
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
+
/** The cards of a library that loads: a thumbnail, a name and a line of details. */
|
|
35
36
|
function Skeletons() {
|
|
36
37
|
const $ = c(1);
|
|
37
38
|
let t0;
|
|
38
39
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
39
40
|
t0 = /* @__PURE__ */ jsx("div", {
|
|
40
41
|
className: MediaPicker_module_default.grid,
|
|
41
|
-
"aria-hidden": true,
|
|
42
42
|
children: Array.from({ length: 12 }, _temp)
|
|
43
43
|
});
|
|
44
44
|
$[0] = t0;
|
|
@@ -55,9 +55,18 @@ function _temp(_, index) {
|
|
|
55
55
|
return /* @__PURE__ */ jsxs("div", {
|
|
56
56
|
className: MediaPicker_module_default.skeletonCard,
|
|
57
57
|
children: [
|
|
58
|
-
/* @__PURE__ */ jsx(
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
59
|
+
shape: "rect",
|
|
60
|
+
aspectRatio: 1
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
63
|
+
className: MediaPicker_module_default.cardName,
|
|
64
|
+
width: "80%"
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
67
|
+
className: MediaPicker_module_default.cardMeta,
|
|
68
|
+
width: "50%"
|
|
69
|
+
})
|
|
61
70
|
]
|
|
62
71
|
}, index);
|
|
63
72
|
}
|
|
@@ -72,35 +81,91 @@ function MediaPicker(props) {
|
|
|
72
81
|
} else t0 = $[1];
|
|
73
82
|
return t0;
|
|
74
83
|
}
|
|
75
|
-
function OpenMediaPicker(
|
|
84
|
+
function OpenMediaPicker(t0) {
|
|
85
|
+
const $ = c(180);
|
|
86
|
+
const { onOpenChange, sources, source: initialSource, multiple: t1, accept: t2, maxSize: t3, filter: t4, filters: t5, sorts: t6, sort: openerSort, value: t7, title, confirmLabel, confirmOnUpload: t8, stateKey, uploadSource, refreshInterval: t9, onSelect } = t0;
|
|
87
|
+
const multiple = t1 === void 0 ? false : t1;
|
|
88
|
+
const accept = t2 === void 0 ? null : t2;
|
|
89
|
+
const maxSize = t3 === void 0 ? null : t3;
|
|
90
|
+
const locked = t4 === void 0 ? NO_FILTER : t4;
|
|
91
|
+
const openerFilters = t5 === void 0 ? [] : t5;
|
|
92
|
+
let t10;
|
|
93
|
+
if ($[0] !== t6) {
|
|
94
|
+
t10 = t6 === void 0 ? [] : t6;
|
|
95
|
+
$[0] = t6;
|
|
96
|
+
$[1] = t10;
|
|
97
|
+
} else t10 = $[1];
|
|
98
|
+
const openerSorts = t10;
|
|
99
|
+
const value = t7 === void 0 ? [] : t7;
|
|
100
|
+
const confirmOnUpload = t8 === void 0 ? false : t8;
|
|
101
|
+
const refreshInterval = t9 === void 0 ? 3e3 : t9;
|
|
76
102
|
const intl = usePanneauIntl();
|
|
77
103
|
const context = useFieldsContext();
|
|
78
104
|
const [sourceId, setSourceId] = useState(initialSource ?? sources[0]?.id ?? "");
|
|
79
105
|
const source = sources.find((candidate) => candidate.id === sourceId) ?? sources[0] ?? null;
|
|
80
106
|
const [tab, setTab] = useState("library");
|
|
81
|
-
|
|
107
|
+
let t11;
|
|
108
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
109
|
+
t11 = /* @__PURE__ */ new Map();
|
|
110
|
+
$[2] = t11;
|
|
111
|
+
} else t11 = $[2];
|
|
112
|
+
const [selection, setSelection] = useState(t11);
|
|
82
113
|
const [focused, setFocused] = useState(null);
|
|
83
114
|
const [pendingFocus, setPendingFocus] = useState(null);
|
|
84
115
|
const [detailsOpen, setDetailsOpen] = useState(false);
|
|
85
116
|
const [draft, setDraft] = useState(null);
|
|
86
117
|
const [saving, setSaving] = useState(false);
|
|
87
118
|
const [saveError, setSaveError] = useState(null);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
119
|
+
let t12;
|
|
120
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
121
|
+
t12 = /* @__PURE__ */ new Map();
|
|
122
|
+
$[3] = t12;
|
|
123
|
+
} else t12 = $[3];
|
|
124
|
+
const [uploaded, setUploaded] = useState(t12);
|
|
125
|
+
let t13;
|
|
126
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
127
|
+
t13 = [];
|
|
128
|
+
$[4] = t13;
|
|
129
|
+
} else t13 = $[4];
|
|
130
|
+
const [problems, setProblems] = useState(t13);
|
|
131
|
+
let t14;
|
|
132
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
133
|
+
t14 = [];
|
|
134
|
+
$[5] = t14;
|
|
135
|
+
} else t14 = $[5];
|
|
136
|
+
const [creating, setCreating] = useState(t14);
|
|
137
|
+
let t15;
|
|
138
|
+
if ($[6] !== openerSorts) {
|
|
139
|
+
t15 = (candidate_0) => [...candidate_0.sorts ?? [], ...openerSorts.filter((sort) => !(candidate_0.sorts ?? []).some((own) => own.id === sort.id))];
|
|
140
|
+
$[6] = openerSorts;
|
|
141
|
+
$[7] = t15;
|
|
142
|
+
} else t15 = $[7];
|
|
143
|
+
const sortsOf = t15;
|
|
144
|
+
let t16;
|
|
145
|
+
if ($[8] !== openerSort || $[9] !== sortsOf) {
|
|
146
|
+
t16 = (candidate_1) => openerSort ?? sortsOf(candidate_1)[0]?.id ?? null;
|
|
147
|
+
$[8] = openerSort;
|
|
148
|
+
$[9] = sortsOf;
|
|
149
|
+
$[10] = t16;
|
|
150
|
+
} else t16 = $[10];
|
|
92
151
|
const browser = useMediaBrowser({
|
|
93
152
|
sources,
|
|
94
153
|
source,
|
|
95
154
|
locked,
|
|
96
|
-
defaultSort:
|
|
155
|
+
defaultSort: t16,
|
|
97
156
|
stateKey
|
|
98
157
|
});
|
|
99
158
|
const { state } = browser;
|
|
100
|
-
|
|
159
|
+
let t17;
|
|
160
|
+
if ($[11] !== sources[0]?.id) {
|
|
161
|
+
t17 = (reference) => keyOf(reference.resource ?? sources[0]?.id ?? "", reference.id);
|
|
162
|
+
$[11] = sources[0]?.id;
|
|
163
|
+
$[12] = t17;
|
|
164
|
+
} else t17 = $[12];
|
|
165
|
+
const current = new Set(value.map(t17));
|
|
101
166
|
const picked = [...selection.values()];
|
|
102
167
|
const unchanged = !multiple && picked.length === 1 && value.length === 1 && current.has(keyOf(picked[0]?.source ?? "", picked[0]?.item.id ?? ""));
|
|
103
|
-
const pickedSources = new Set(picked.map(
|
|
168
|
+
const pickedSources = new Set(picked.map(_temp2));
|
|
104
169
|
const known = /* @__PURE__ */ new Map();
|
|
105
170
|
for (const [id, items] of uploaded) items.forEach((item) => known.set(keyOf(id, item.id), {
|
|
106
171
|
source: id,
|
|
@@ -116,98 +181,140 @@ function OpenMediaPicker({ onOpenChange, sources, source: initialSource, multipl
|
|
|
116
181
|
const fields = focusedSource?.update !== void 0 ? focusedSource.fields ?? [] : [];
|
|
117
182
|
const draftValues = draft !== null && draft.key === focused ? draft.values : focusedEntry?.item.values ?? {};
|
|
118
183
|
const dirty = draft !== null && draft.key === focused;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
184
|
+
let t18;
|
|
185
|
+
if ($[13] !== browser) {
|
|
186
|
+
t18 = (sourceKey, item_1) => {
|
|
187
|
+
const key_0 = keyOf(sourceKey, item_1.id);
|
|
188
|
+
browser.upsert(sourceKey, [item_1]);
|
|
189
|
+
setSelection((currentSelection) => currentSelection.has(key_0) ? new Map(currentSelection).set(key_0, {
|
|
190
|
+
source: sourceKey,
|
|
191
|
+
item: item_1
|
|
192
|
+
}) : currentSelection);
|
|
193
|
+
setUploaded((currentUploaded) => {
|
|
194
|
+
const items_0 = currentUploaded.get(sourceKey);
|
|
195
|
+
return items_0?.some((entry_2) => entry_2.id === item_1.id) === true ? new Map(currentUploaded).set(sourceKey, items_0.map((entry_1) => entry_1.id === item_1.id ? item_1 : entry_1)) : currentUploaded;
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
$[13] = browser;
|
|
199
|
+
$[14] = t18;
|
|
200
|
+
} else t18 = $[14];
|
|
201
|
+
const replace = t18;
|
|
202
|
+
let t19;
|
|
203
|
+
if ($[15] !== dirty || $[16] !== focused || $[17] !== setFocused || $[18] !== setPendingFocus) {
|
|
204
|
+
t19 = (key_1) => {
|
|
205
|
+
if (dirty && key_1 !== focused) {
|
|
206
|
+
setPendingFocus(key_1);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
setFocused(key_1);
|
|
210
|
+
setSaveError(null);
|
|
211
|
+
};
|
|
212
|
+
$[15] = dirty;
|
|
213
|
+
$[16] = focused;
|
|
214
|
+
$[17] = setFocused;
|
|
215
|
+
$[18] = setPendingFocus;
|
|
216
|
+
$[19] = t19;
|
|
217
|
+
} else t19 = $[19];
|
|
218
|
+
const focus = t19;
|
|
140
219
|
const save = async () => {
|
|
141
220
|
if (focusedEntry === null || focusedSource?.update === void 0 || draft === null) return true;
|
|
142
221
|
setSaving(true);
|
|
143
222
|
setSaveError(null);
|
|
223
|
+
let saved = true;
|
|
144
224
|
try {
|
|
145
|
-
const
|
|
146
|
-
replace(focusedEntry.source,
|
|
225
|
+
const item_2 = await focusedSource.update(focusedEntry.item.id, draft.values);
|
|
226
|
+
replace(focusedEntry.source, item_2);
|
|
147
227
|
setDraft(null);
|
|
148
|
-
|
|
149
|
-
|
|
228
|
+
} catch (t20) {
|
|
229
|
+
const error = t20;
|
|
150
230
|
setSaveError(intl.formatMessage(mediaMessages.pickerSaveFailed, { error: error instanceof Error ? error.message : String(error) }));
|
|
151
|
-
|
|
152
|
-
} finally {
|
|
153
|
-
setSaving(false);
|
|
231
|
+
saved = false;
|
|
154
232
|
}
|
|
233
|
+
setSaving(false);
|
|
234
|
+
return saved;
|
|
155
235
|
};
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
236
|
+
let t21;
|
|
237
|
+
if ($[20] !== onOpenChange || $[21] !== onSelect) {
|
|
238
|
+
t21 = (entries) => {
|
|
239
|
+
onSelect(entries.map(toReference));
|
|
240
|
+
onOpenChange(false);
|
|
241
|
+
};
|
|
242
|
+
$[20] = onOpenChange;
|
|
243
|
+
$[21] = onSelect;
|
|
244
|
+
$[22] = t21;
|
|
245
|
+
} else t21 = $[22];
|
|
246
|
+
const confirm = t21;
|
|
247
|
+
let t22;
|
|
248
|
+
if ($[23] !== focus || $[24] !== multiple) {
|
|
249
|
+
t22 = (sourceKey_0, items_1, ids, added) => {
|
|
250
|
+
const shown = new Set(items_1.map(_temp3));
|
|
251
|
+
const isShown = (entry_3) => entry_3.source === sourceKey_0 && shown.has(entry_3.item.id);
|
|
252
|
+
setSelection((currentSelection_0) => {
|
|
253
|
+
if (!multiple) {
|
|
254
|
+
const item_4 = items_1.find((entry_4) => ids.has(entry_4.id));
|
|
255
|
+
if (item_4 !== void 0) return /* @__PURE__ */ new Map([[keyOf(sourceKey_0, item_4.id), {
|
|
256
|
+
source: sourceKey_0,
|
|
257
|
+
item: item_4
|
|
258
|
+
}]]);
|
|
259
|
+
return [...currentSelection_0.values()].some(isShown) ? /* @__PURE__ */ new Map() : currentSelection_0;
|
|
260
|
+
}
|
|
261
|
+
const next = new Map([...currentSelection_0].filter((t23) => {
|
|
262
|
+
const [, entry_5] = t23;
|
|
263
|
+
return !isShown(entry_5) || ids.has(entry_5.item.id);
|
|
264
|
+
}));
|
|
265
|
+
for (const item_5 of items_1) if (ids.has(item_5.id)) next.set(keyOf(sourceKey_0, item_5.id), {
|
|
171
266
|
source: sourceKey_0,
|
|
172
|
-
item:
|
|
173
|
-
}
|
|
174
|
-
return
|
|
175
|
-
}
|
|
176
|
-
const next = new Map([...currentSelection_0].filter(([, entry_5]) => !isShown(entry_5) || ids.has(entry_5.item.id)));
|
|
177
|
-
for (const item_4 of items_1) if (ids.has(item_4.id)) next.set(keyOf(sourceKey_0, item_4.id), {
|
|
178
|
-
source: sourceKey_0,
|
|
179
|
-
item: item_4
|
|
267
|
+
item: item_5
|
|
268
|
+
});
|
|
269
|
+
return next;
|
|
180
270
|
});
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
271
|
+
if (added !== null) focus(keyOf(sourceKey_0, added));
|
|
272
|
+
};
|
|
273
|
+
$[23] = focus;
|
|
274
|
+
$[24] = multiple;
|
|
275
|
+
$[25] = t22;
|
|
276
|
+
} else t22 = $[25];
|
|
277
|
+
const select = t22;
|
|
278
|
+
const following = [...known.values()].filter(_temp4);
|
|
279
|
+
const followKey = following.map(_temp5).join(",");
|
|
187
280
|
const latestFollowing = useRef(following);
|
|
188
281
|
const latestReplace = useRef(replace);
|
|
189
282
|
useEffect(() => {
|
|
190
283
|
latestFollowing.current = following;
|
|
191
284
|
latestReplace.current = replace;
|
|
192
285
|
});
|
|
286
|
+
let t23;
|
|
287
|
+
if ($[26] !== followKey || $[27] !== refreshInterval || $[28] !== sources) {
|
|
288
|
+
t23 = [
|
|
289
|
+
followKey,
|
|
290
|
+
refreshInterval,
|
|
291
|
+
sources
|
|
292
|
+
];
|
|
293
|
+
$[26] = followKey;
|
|
294
|
+
$[27] = refreshInterval;
|
|
295
|
+
$[28] = sources;
|
|
296
|
+
$[29] = t23;
|
|
297
|
+
} else t23 = $[29];
|
|
193
298
|
useEffect(() => {
|
|
194
299
|
if (followKey === "") return;
|
|
195
300
|
const controller = new AbortController();
|
|
196
301
|
const timer = setTimeout(() => {
|
|
197
|
-
for (const entry_6 of latestFollowing.current) sources.find((candidate_3) => candidate_3.id === entry_6.source)?.get(entry_6.item.id, { signal: controller.signal }).then((
|
|
302
|
+
for (const entry_6 of latestFollowing.current) sources.find((candidate_3) => candidate_3.id === entry_6.source)?.get(entry_6.item.id, { signal: controller.signal }).then((item_8) => latestReplace.current(entry_6.source, item_8)).catch(_temp6);
|
|
198
303
|
}, refreshInterval);
|
|
199
304
|
return () => {
|
|
200
305
|
clearTimeout(timer);
|
|
201
306
|
controller.abort();
|
|
202
307
|
};
|
|
203
|
-
},
|
|
204
|
-
followKey,
|
|
205
|
-
refreshInterval,
|
|
206
|
-
sources
|
|
207
|
-
]);
|
|
308
|
+
}, t23);
|
|
208
309
|
const uploadAccept = accept ?? source?.accept ?? null;
|
|
209
310
|
const uploadMaxSize = smallest(maxSize, source?.maxSize);
|
|
210
311
|
const rejectionMessage = useRejectionMessage(uploadMaxSize);
|
|
312
|
+
let t24;
|
|
313
|
+
if ($[30] !== rejectionMessage) {
|
|
314
|
+
t24 = (file_0, reason) => setProblems((currentProblems_0) => [...currentProblems_0, rejectionMessage(file_0, reason)]);
|
|
315
|
+
$[30] = rejectionMessage;
|
|
316
|
+
$[31] = t24;
|
|
317
|
+
} else t24 = $[31];
|
|
211
318
|
const upload = useUploads({
|
|
212
319
|
source: uploadSource === void 0 ? context.uploadSource : uploadSource,
|
|
213
320
|
accept: uploadAccept,
|
|
@@ -217,19 +324,19 @@ function OpenMediaPicker({ onOpenChange, sources, source: initialSource, multipl
|
|
|
217
324
|
const target = source;
|
|
218
325
|
const name = file.name;
|
|
219
326
|
setCreating((currentCreating) => [...currentCreating, name]);
|
|
220
|
-
target.create(file).then((
|
|
327
|
+
target.create(file).then((item_9) => {
|
|
221
328
|
const entry_7 = {
|
|
222
329
|
source: target.id,
|
|
223
|
-
item:
|
|
330
|
+
item: item_9
|
|
224
331
|
};
|
|
225
|
-
setUploaded((currentUploaded_0) => new Map(currentUploaded_0).set(target.id, [
|
|
226
|
-
browser.upsert(target.id, [
|
|
332
|
+
setUploaded((currentUploaded_0) => new Map(currentUploaded_0).set(target.id, [item_9, ...currentUploaded_0.get(target.id) ?? []]));
|
|
333
|
+
browser.upsert(target.id, [item_9]);
|
|
227
334
|
if (!multiple && confirmOnUpload) {
|
|
228
335
|
confirm([entry_7]);
|
|
229
336
|
return;
|
|
230
337
|
}
|
|
231
|
-
setSelection((currentSelection_1) => multiple ? new Map(currentSelection_1).set(keyOf(target.id,
|
|
232
|
-
focus(keyOf(target.id,
|
|
338
|
+
setSelection((currentSelection_1) => multiple ? new Map(currentSelection_1).set(keyOf(target.id, item_9.id), entry_7) : /* @__PURE__ */ new Map([[keyOf(target.id, item_9.id), entry_7]]));
|
|
339
|
+
focus(keyOf(target.id, item_9.id));
|
|
233
340
|
}).catch((error_0) => setProblems((currentProblems) => [...currentProblems, intl.formatMessage(mediaMessages.pickerCreateFailed, {
|
|
234
341
|
name,
|
|
235
342
|
error: error_0 instanceof Error ? error_0.message : String(error_0)
|
|
@@ -238,50 +345,97 @@ function OpenMediaPicker({ onOpenChange, sources, source: initialSource, multipl
|
|
|
238
345
|
return at === -1 ? currentCreating_0 : currentCreating_0.filter((_, index) => index !== at);
|
|
239
346
|
}));
|
|
240
347
|
},
|
|
241
|
-
onRejected:
|
|
348
|
+
onRejected: t24
|
|
242
349
|
});
|
|
243
350
|
const scroller = useRef(null);
|
|
244
351
|
const sentinel = useRef(null);
|
|
245
352
|
const latestLoadMore = useRef(browser.loadMore);
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
353
|
+
let t25;
|
|
354
|
+
if ($[32] !== browser.loadMore) {
|
|
355
|
+
t25 = () => {
|
|
356
|
+
latestLoadMore.current = browser.loadMore;
|
|
357
|
+
};
|
|
358
|
+
$[32] = browser.loadMore;
|
|
359
|
+
$[33] = t25;
|
|
360
|
+
} else t25 = $[33];
|
|
361
|
+
useEffect(t25);
|
|
249
362
|
const hasMore = state.nextCursor !== null;
|
|
250
363
|
const browsing = state.items.length > 0;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
]
|
|
364
|
+
let t26;
|
|
365
|
+
if ($[34] !== hasMore) {
|
|
366
|
+
t26 = () => {
|
|
367
|
+
const target_0 = sentinel.current;
|
|
368
|
+
if (target_0 === null || !hasMore || typeof IntersectionObserver === "undefined") return;
|
|
369
|
+
const observer = new IntersectionObserver((entries_0) => {
|
|
370
|
+
if (entries_0.some(_temp7)) latestLoadMore.current();
|
|
371
|
+
}, {
|
|
372
|
+
root: scroller.current,
|
|
373
|
+
rootMargin: "200px"
|
|
374
|
+
});
|
|
375
|
+
observer.observe(target_0);
|
|
376
|
+
return () => observer.disconnect();
|
|
377
|
+
};
|
|
378
|
+
$[34] = hasMore;
|
|
379
|
+
$[35] = t26;
|
|
380
|
+
} else t26 = $[35];
|
|
381
|
+
let t27;
|
|
382
|
+
if ($[36] !== browsing || $[37] !== hasMore || $[38] !== sourceId || $[39] !== tab) {
|
|
383
|
+
t27 = [
|
|
384
|
+
hasMore,
|
|
385
|
+
browsing,
|
|
386
|
+
sourceId,
|
|
387
|
+
tab
|
|
388
|
+
];
|
|
389
|
+
$[36] = browsing;
|
|
390
|
+
$[37] = hasMore;
|
|
391
|
+
$[38] = sourceId;
|
|
392
|
+
$[39] = tab;
|
|
393
|
+
$[40] = t27;
|
|
394
|
+
} else t27 = $[40];
|
|
395
|
+
useEffect(t26, t27);
|
|
268
396
|
const restoreScroll = useRef(browser.scrollTop);
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
397
|
+
let t28;
|
|
398
|
+
if ($[41] !== browser.scrollTop) {
|
|
399
|
+
t28 = () => {
|
|
400
|
+
restoreScroll.current = browser.scrollTop;
|
|
401
|
+
};
|
|
402
|
+
$[41] = browser.scrollTop;
|
|
403
|
+
$[42] = t28;
|
|
404
|
+
} else t28 = $[42];
|
|
405
|
+
useEffect(t28);
|
|
406
|
+
let t29;
|
|
407
|
+
if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
|
|
408
|
+
t29 = () => {
|
|
409
|
+
if (scroller.current !== null) scroller.current.scrollTop = restoreScroll.current();
|
|
410
|
+
};
|
|
411
|
+
$[43] = t29;
|
|
412
|
+
} else t29 = $[43];
|
|
413
|
+
let t30;
|
|
414
|
+
if ($[44] !== browsing || $[45] !== sourceId || $[46] !== tab) {
|
|
415
|
+
t30 = [
|
|
416
|
+
sourceId,
|
|
417
|
+
tab,
|
|
418
|
+
browsing
|
|
419
|
+
];
|
|
420
|
+
$[44] = browsing;
|
|
421
|
+
$[45] = sourceId;
|
|
422
|
+
$[46] = tab;
|
|
423
|
+
$[47] = t30;
|
|
424
|
+
} else t30 = $[47];
|
|
425
|
+
useLayoutEffect(t29, t30);
|
|
279
426
|
if (source === null) return null;
|
|
280
427
|
const library = source.label;
|
|
281
428
|
const filters = [...source.filters ?? [], ...openerFilters];
|
|
282
429
|
const label = typeof confirmLabel === "function" ? confirmLabel(picked.length) : confirmLabel ?? intl.formatMessage(mediaMessages.pickerSelect);
|
|
283
|
-
const selectedIn = (sourceKey_1) => new Set(picked.filter((entry_9) => entry_9.source === sourceKey_1).map(
|
|
284
|
-
|
|
430
|
+
const selectedIn = (sourceKey_1) => new Set(picked.filter((entry_9) => entry_9.source === sourceKey_1).map(_temp8));
|
|
431
|
+
let t31;
|
|
432
|
+
if ($[48] !== sources[0]?.id || $[49] !== value) {
|
|
433
|
+
t31 = (sourceKey_2) => new Set(value.filter((reference_0) => (reference_0.resource ?? sources[0]?.id) === sourceKey_2).map(_temp9));
|
|
434
|
+
$[48] = sources[0]?.id;
|
|
435
|
+
$[49] = value;
|
|
436
|
+
$[50] = t31;
|
|
437
|
+
} else t31 = $[50];
|
|
438
|
+
const currentIn = t31;
|
|
285
439
|
const grid = (items_2, gridLabel) => /* @__PURE__ */ jsx(MediaGrid, {
|
|
286
440
|
items: items_2,
|
|
287
441
|
label: gridLabel,
|
|
@@ -297,141 +451,571 @@ function OpenMediaPicker({ onOpenChange, sources, source: initialSource, multipl
|
|
|
297
451
|
maxSize
|
|
298
452
|
});
|
|
299
453
|
let libraryContent;
|
|
300
|
-
if (state.items.length === 0 && (state.status === "idle" || state.status === "loading"))
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
454
|
+
if (state.items.length === 0 && (state.status === "idle" || state.status === "loading")) {
|
|
455
|
+
let t32;
|
|
456
|
+
if ($[51] !== intl) {
|
|
457
|
+
t32 = intl.formatMessage(mediaMessages.pickerLoading);
|
|
458
|
+
$[51] = intl;
|
|
459
|
+
$[52] = t32;
|
|
460
|
+
} else t32 = $[52];
|
|
461
|
+
let t33;
|
|
462
|
+
if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
|
|
463
|
+
t33 = /* @__PURE__ */ jsx(Skeletons, {});
|
|
464
|
+
$[53] = t33;
|
|
465
|
+
} else t33 = $[53];
|
|
466
|
+
let t34;
|
|
467
|
+
if ($[54] !== t32) {
|
|
468
|
+
t34 = /* @__PURE__ */ jsx(LoadingRegion, {
|
|
469
|
+
className: MediaPicker_module_default.scroll,
|
|
470
|
+
label: t32,
|
|
471
|
+
children: t33
|
|
472
|
+
});
|
|
473
|
+
$[54] = t32;
|
|
474
|
+
$[55] = t34;
|
|
475
|
+
} else t34 = $[55];
|
|
476
|
+
libraryContent = t34;
|
|
477
|
+
} else if (state.items.length === 0 && state.status === "error") {
|
|
478
|
+
let t32;
|
|
479
|
+
if ($[56] !== intl) {
|
|
480
|
+
t32 = intl.formatMessage(mediaMessages.pickerLoadError);
|
|
481
|
+
$[56] = intl;
|
|
482
|
+
$[57] = t32;
|
|
483
|
+
} else t32 = $[57];
|
|
484
|
+
const t33 = browser.retry;
|
|
485
|
+
let t34;
|
|
486
|
+
if ($[58] !== intl) {
|
|
487
|
+
t34 = intl.formatMessage(mediaMessages.pickerRetry);
|
|
488
|
+
$[58] = intl;
|
|
489
|
+
$[59] = t34;
|
|
490
|
+
} else t34 = $[59];
|
|
491
|
+
let t35;
|
|
492
|
+
if ($[60] !== browser.retry || $[61] !== t34) {
|
|
493
|
+
t35 = /* @__PURE__ */ jsx(Button, {
|
|
316
494
|
size: "sm",
|
|
317
|
-
onPress:
|
|
318
|
-
children:
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
495
|
+
onPress: t33,
|
|
496
|
+
children: t34
|
|
497
|
+
});
|
|
498
|
+
$[60] = browser.retry;
|
|
499
|
+
$[61] = t34;
|
|
500
|
+
$[62] = t35;
|
|
501
|
+
} else t35 = $[62];
|
|
502
|
+
let t36;
|
|
503
|
+
if ($[63] !== t32 || $[64] !== t35) {
|
|
504
|
+
t36 = /* @__PURE__ */ jsx("div", {
|
|
505
|
+
className: MediaPicker_module_default.center,
|
|
506
|
+
children: /* @__PURE__ */ jsx(Alert, {
|
|
507
|
+
tone: "danger",
|
|
508
|
+
role: "alert",
|
|
509
|
+
title: t32,
|
|
510
|
+
actions: t35
|
|
511
|
+
})
|
|
512
|
+
});
|
|
513
|
+
$[63] = t32;
|
|
514
|
+
$[64] = t35;
|
|
515
|
+
$[65] = t36;
|
|
516
|
+
} else t36 = $[65];
|
|
517
|
+
libraryContent = t36;
|
|
518
|
+
} else if (state.items.length === 0 && isDefaultQuery(state.query)) {
|
|
519
|
+
let t32;
|
|
520
|
+
if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
|
|
521
|
+
t32 = /* @__PURE__ */ jsx(Images, {
|
|
326
522
|
"aria-hidden": true,
|
|
327
523
|
size: 48,
|
|
328
524
|
strokeWidth: 1.25,
|
|
329
525
|
className: MediaPicker_module_default.emptyIcon
|
|
330
|
-
})
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
526
|
+
});
|
|
527
|
+
$[66] = t32;
|
|
528
|
+
} else t32 = $[66];
|
|
529
|
+
libraryContent = /* @__PURE__ */ jsxs("div", {
|
|
530
|
+
className: MediaPicker_module_default.empty,
|
|
531
|
+
children: [
|
|
532
|
+
t32,
|
|
533
|
+
/* @__PURE__ */ jsx(Heading, {
|
|
534
|
+
level: 3,
|
|
535
|
+
size: 4,
|
|
536
|
+
children: intl.formatMessage(mediaMessages.pickerEmpty, { library })
|
|
537
|
+
}),
|
|
538
|
+
source.canCreate ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Text, {
|
|
539
|
+
muted: true,
|
|
540
|
+
size: "sm",
|
|
541
|
+
children: intl.formatMessage(mediaMessages.pickerEmptyUpload, { library })
|
|
542
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
543
|
+
variant: "primary",
|
|
544
|
+
onPress: () => setTab("upload"),
|
|
545
|
+
children: intl.formatMessage(mediaMessages.pickerUploadFiles)
|
|
546
|
+
})] }) : /* @__PURE__ */ jsx(Text, {
|
|
547
|
+
muted: true,
|
|
548
|
+
size: "sm",
|
|
549
|
+
children: intl.formatMessage(mediaMessages.pickerEmptyReadOnly)
|
|
550
|
+
})
|
|
551
|
+
]
|
|
552
|
+
});
|
|
553
|
+
} else if (state.items.length === 0) {
|
|
554
|
+
let t32;
|
|
555
|
+
if ($[67] === Symbol.for("react.memo_cache_sentinel")) {
|
|
556
|
+
t32 = /* @__PURE__ */ jsx(SearchX, {
|
|
355
557
|
"aria-hidden": true,
|
|
356
558
|
size: 48,
|
|
357
559
|
strokeWidth: 1.25,
|
|
358
560
|
className: MediaPicker_module_default.emptyIcon
|
|
359
|
-
})
|
|
360
|
-
|
|
561
|
+
});
|
|
562
|
+
$[67] = t32;
|
|
563
|
+
} else t32 = $[67];
|
|
564
|
+
let t33;
|
|
565
|
+
if ($[68] !== intl) {
|
|
566
|
+
t33 = intl.formatMessage(mediaMessages.pickerNoResults);
|
|
567
|
+
$[68] = intl;
|
|
568
|
+
$[69] = t33;
|
|
569
|
+
} else t33 = $[69];
|
|
570
|
+
let t34;
|
|
571
|
+
if ($[70] !== t33) {
|
|
572
|
+
t34 = /* @__PURE__ */ jsx(Heading, {
|
|
361
573
|
level: 3,
|
|
362
574
|
size: 4,
|
|
363
|
-
children:
|
|
364
|
-
})
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
575
|
+
children: t33
|
|
576
|
+
});
|
|
577
|
+
$[70] = t33;
|
|
578
|
+
$[71] = t34;
|
|
579
|
+
} else t34 = $[71];
|
|
580
|
+
let t35;
|
|
581
|
+
if ($[72] !== browser || $[73] !== state.query) {
|
|
582
|
+
t35 = () => browser.setQuery({
|
|
583
|
+
...state.query,
|
|
584
|
+
q: "",
|
|
585
|
+
type: null,
|
|
586
|
+
filter: {}
|
|
587
|
+
});
|
|
588
|
+
$[72] = browser;
|
|
589
|
+
$[73] = state.query;
|
|
590
|
+
$[74] = t35;
|
|
591
|
+
} else t35 = $[74];
|
|
592
|
+
let t36;
|
|
593
|
+
if ($[75] !== intl) {
|
|
594
|
+
t36 = intl.formatMessage(mediaMessages.pickerClearSearch);
|
|
595
|
+
$[75] = intl;
|
|
596
|
+
$[76] = t36;
|
|
597
|
+
} else t36 = $[76];
|
|
598
|
+
let t37;
|
|
599
|
+
if ($[77] !== t35 || $[78] !== t36) {
|
|
600
|
+
t37 = /* @__PURE__ */ jsx(Button, {
|
|
601
|
+
onPress: t35,
|
|
602
|
+
children: t36
|
|
603
|
+
});
|
|
604
|
+
$[77] = t35;
|
|
605
|
+
$[78] = t36;
|
|
606
|
+
$[79] = t37;
|
|
607
|
+
} else t37 = $[79];
|
|
608
|
+
let t38;
|
|
609
|
+
if ($[80] !== t34 || $[81] !== t37) {
|
|
610
|
+
t38 = /* @__PURE__ */ jsxs("div", {
|
|
611
|
+
className: MediaPicker_module_default.empty,
|
|
612
|
+
children: [
|
|
613
|
+
t32,
|
|
614
|
+
t34,
|
|
615
|
+
t37
|
|
616
|
+
]
|
|
617
|
+
});
|
|
618
|
+
$[80] = t34;
|
|
619
|
+
$[81] = t37;
|
|
620
|
+
$[82] = t38;
|
|
621
|
+
} else t38 = $[82];
|
|
622
|
+
libraryContent = t38;
|
|
623
|
+
} else {
|
|
624
|
+
let t32;
|
|
625
|
+
if ($[83] !== browser) {
|
|
626
|
+
t32 = (event) => browser.rememberScroll(event.currentTarget.scrollTop);
|
|
627
|
+
$[83] = browser;
|
|
628
|
+
$[84] = t32;
|
|
629
|
+
} else t32 = $[84];
|
|
630
|
+
let t33;
|
|
631
|
+
if ($[85] !== intl || $[86] !== state.items.length || $[87] !== state.total) {
|
|
632
|
+
t33 = state.total !== null ? /* @__PURE__ */ jsx(Text, {
|
|
633
|
+
muted: true,
|
|
634
|
+
size: "sm",
|
|
635
|
+
as: "span",
|
|
636
|
+
children: intl.formatMessage(mediaMessages.pickerCount, {
|
|
637
|
+
shown: state.items.length,
|
|
638
|
+
total: state.total
|
|
639
|
+
})
|
|
640
|
+
}) : null;
|
|
641
|
+
$[85] = intl;
|
|
642
|
+
$[86] = state.items.length;
|
|
643
|
+
$[87] = state.total;
|
|
644
|
+
$[88] = t33;
|
|
645
|
+
} else t33 = $[88];
|
|
646
|
+
let t34;
|
|
647
|
+
if ($[89] !== intl || $[90] !== state.status) {
|
|
648
|
+
t34 = state.status === "more" ? /* @__PURE__ */ jsx(Spinner, {
|
|
649
|
+
size: "sm",
|
|
650
|
+
label: intl.formatMessage(mediaMessages.pickerLoadingMore)
|
|
651
|
+
}) : null;
|
|
652
|
+
$[89] = intl;
|
|
653
|
+
$[90] = state.status;
|
|
654
|
+
$[91] = t34;
|
|
655
|
+
} else t34 = $[91];
|
|
656
|
+
let t35;
|
|
657
|
+
if ($[92] !== browser.loadMore || $[93] !== browser.retry || $[94] !== hasMore || $[95] !== intl || $[96] !== state.status) {
|
|
658
|
+
t35 = state.status === "error" ? /* @__PURE__ */ jsx(Button, {
|
|
659
|
+
size: "sm",
|
|
660
|
+
onPress: browser.retry,
|
|
661
|
+
children: intl.formatMessage(mediaMessages.pickerRetry)
|
|
662
|
+
}) : hasMore && state.status === "ready" ? /* @__PURE__ */ jsx(Button, {
|
|
663
|
+
size: "sm",
|
|
664
|
+
variant: "ghost",
|
|
665
|
+
onPress: browser.loadMore,
|
|
666
|
+
children: intl.formatMessage(mediaMessages.pickerLoadMore)
|
|
667
|
+
}) : null;
|
|
668
|
+
$[92] = browser.loadMore;
|
|
669
|
+
$[93] = browser.retry;
|
|
670
|
+
$[94] = hasMore;
|
|
671
|
+
$[95] = intl;
|
|
672
|
+
$[96] = state.status;
|
|
673
|
+
$[97] = t35;
|
|
674
|
+
} else t35 = $[97];
|
|
675
|
+
let t36;
|
|
676
|
+
if ($[98] === Symbol.for("react.memo_cache_sentinel")) {
|
|
677
|
+
t36 = /* @__PURE__ */ jsx("div", {
|
|
678
|
+
ref: sentinel,
|
|
679
|
+
className: MediaPicker_module_default.sentinel
|
|
680
|
+
});
|
|
681
|
+
$[98] = t36;
|
|
682
|
+
} else t36 = $[98];
|
|
683
|
+
let t37;
|
|
684
|
+
if ($[99] !== t33 || $[100] !== t34 || $[101] !== t35) {
|
|
685
|
+
t37 = /* @__PURE__ */ jsxs("div", {
|
|
384
686
|
className: MediaPicker_module_default.more,
|
|
385
687
|
children: [
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
children: intl.formatMessage(mediaMessages.pickerCount, {
|
|
391
|
-
shown: state.items.length,
|
|
392
|
-
total: state.total
|
|
393
|
-
})
|
|
394
|
-
}) : null,
|
|
395
|
-
state.status === "more" ? /* @__PURE__ */ jsx(Spinner, {
|
|
396
|
-
size: "sm",
|
|
397
|
-
label: intl.formatMessage(mediaMessages.pickerLoadingMore)
|
|
398
|
-
}) : null,
|
|
399
|
-
state.status === "error" ? /* @__PURE__ */ jsx(Button, {
|
|
400
|
-
size: "sm",
|
|
401
|
-
onPress: browser.retry,
|
|
402
|
-
children: intl.formatMessage(mediaMessages.pickerRetry)
|
|
403
|
-
}) : hasMore && state.status === "ready" ? /* @__PURE__ */ jsx(Button, {
|
|
404
|
-
size: "sm",
|
|
405
|
-
variant: "ghost",
|
|
406
|
-
onPress: browser.loadMore,
|
|
407
|
-
children: intl.formatMessage(mediaMessages.pickerLoadMore)
|
|
408
|
-
}) : null,
|
|
409
|
-
/* @__PURE__ */ jsx("div", {
|
|
410
|
-
ref: sentinel,
|
|
411
|
-
className: MediaPicker_module_default.sentinel
|
|
412
|
-
})
|
|
688
|
+
t33,
|
|
689
|
+
t34,
|
|
690
|
+
t35,
|
|
691
|
+
t36
|
|
413
692
|
]
|
|
414
|
-
})
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
693
|
+
});
|
|
694
|
+
$[99] = t33;
|
|
695
|
+
$[100] = t34;
|
|
696
|
+
$[101] = t35;
|
|
697
|
+
$[102] = t37;
|
|
698
|
+
} else t37 = $[102];
|
|
699
|
+
let t38;
|
|
700
|
+
if ($[103] !== focused || $[104] !== setDraft) {
|
|
701
|
+
t38 = (values) => focused !== null ? setDraft({
|
|
420
702
|
key: focused,
|
|
421
703
|
values
|
|
422
|
-
}) : void 0
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
704
|
+
}) : void 0;
|
|
705
|
+
$[103] = focused;
|
|
706
|
+
$[104] = setDraft;
|
|
707
|
+
$[105] = t38;
|
|
708
|
+
} else t38 = $[105];
|
|
709
|
+
let t39;
|
|
710
|
+
if ($[106] === Symbol.for("react.memo_cache_sentinel")) {
|
|
711
|
+
t39 = () => setDetailsOpen(false);
|
|
712
|
+
$[106] = t39;
|
|
713
|
+
} else t39 = $[106];
|
|
714
|
+
libraryContent = /* @__PURE__ */ jsxs("div", {
|
|
715
|
+
className: MediaPicker_module_default.browse,
|
|
716
|
+
"data-details-open": detailsOpen || void 0,
|
|
717
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
718
|
+
ref: scroller,
|
|
719
|
+
className: MediaPicker_module_default.scroll,
|
|
720
|
+
onScroll: t32,
|
|
721
|
+
children: [grid(state.items, intl.formatMessage(mediaMessages.pickerMedia, { library })), t37]
|
|
722
|
+
}), /* @__PURE__ */ jsx(MediaDetails, {
|
|
723
|
+
item: focusedEntry?.item ?? null,
|
|
724
|
+
fields,
|
|
725
|
+
draft: draftValues,
|
|
726
|
+
onDraftChange: t38,
|
|
727
|
+
dirty,
|
|
728
|
+
saving,
|
|
729
|
+
error: saveError,
|
|
730
|
+
onSave: () => void save(),
|
|
731
|
+
onBack: t39
|
|
732
|
+
})]
|
|
733
|
+
});
|
|
734
|
+
}
|
|
430
735
|
const uploadedHere = uploaded.get(source.id) ?? [];
|
|
736
|
+
let t32;
|
|
737
|
+
if ($[107] !== intl || $[108] !== title) {
|
|
738
|
+
t32 = title ?? intl.formatMessage(mediaMessages.pickerTitle);
|
|
739
|
+
$[107] = intl;
|
|
740
|
+
$[108] = title;
|
|
741
|
+
$[109] = t32;
|
|
742
|
+
} else t32 = $[109];
|
|
743
|
+
const t33 = picked.length === 0 ? /* @__PURE__ */ jsx(Text, {
|
|
744
|
+
muted: true,
|
|
745
|
+
size: "sm",
|
|
746
|
+
as: "span",
|
|
747
|
+
children: intl.formatMessage(mediaMessages.pickerNothingSelected)
|
|
748
|
+
}) : multiple ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Text, {
|
|
749
|
+
size: "sm",
|
|
750
|
+
weight: "medium",
|
|
751
|
+
as: "span",
|
|
752
|
+
children: pickedSources.size > 1 ? intl.formatMessage(mediaMessages.pickerSelectedIn, {
|
|
753
|
+
count: picked.length,
|
|
754
|
+
libraries: pickedSources.size
|
|
755
|
+
}) : intl.formatMessage(mediaMessages.pickerSelectedCount, { count: picked.length })
|
|
756
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
757
|
+
size: "sm",
|
|
758
|
+
variant: "ghost",
|
|
759
|
+
onPress: () => setSelection(/* @__PURE__ */ new Map()),
|
|
760
|
+
children: intl.formatMessage(mediaMessages.pickerClear)
|
|
761
|
+
})] }) : /* @__PURE__ */ jsx(Text, {
|
|
762
|
+
size: "sm",
|
|
763
|
+
as: "span",
|
|
764
|
+
truncate: true,
|
|
765
|
+
children: intl.formatMessage(mediaMessages.pickerSelected, { name: picked[0]?.item.label ?? "" })
|
|
766
|
+
});
|
|
767
|
+
let t34;
|
|
768
|
+
if ($[110] !== t33) {
|
|
769
|
+
t34 = /* @__PURE__ */ jsx("div", {
|
|
770
|
+
className: MediaPicker_module_default.summary,
|
|
771
|
+
"aria-live": "polite",
|
|
772
|
+
children: t33
|
|
773
|
+
});
|
|
774
|
+
$[110] = t33;
|
|
775
|
+
$[111] = t34;
|
|
776
|
+
} else t34 = $[111];
|
|
777
|
+
let t35;
|
|
778
|
+
if ($[112] !== onOpenChange) {
|
|
779
|
+
t35 = () => onOpenChange(false);
|
|
780
|
+
$[112] = onOpenChange;
|
|
781
|
+
$[113] = t35;
|
|
782
|
+
} else t35 = $[113];
|
|
783
|
+
let t36;
|
|
784
|
+
if ($[114] !== intl) {
|
|
785
|
+
t36 = intl.formatMessage(mediaMessages.pickerCancel);
|
|
786
|
+
$[114] = intl;
|
|
787
|
+
$[115] = t36;
|
|
788
|
+
} else t36 = $[115];
|
|
789
|
+
let t37;
|
|
790
|
+
if ($[116] !== t35 || $[117] !== t36) {
|
|
791
|
+
t37 = /* @__PURE__ */ jsx(Button, {
|
|
792
|
+
className: MediaPicker_module_default.cancel,
|
|
793
|
+
onPress: t35,
|
|
794
|
+
children: t36
|
|
795
|
+
});
|
|
796
|
+
$[116] = t35;
|
|
797
|
+
$[117] = t36;
|
|
798
|
+
$[118] = t37;
|
|
799
|
+
} else t37 = $[118];
|
|
800
|
+
let t38;
|
|
801
|
+
if ($[119] === Symbol.for("react.memo_cache_sentinel")) {
|
|
802
|
+
t38 = (key_2) => setTab(String(key_2));
|
|
803
|
+
$[119] = t38;
|
|
804
|
+
} else t38 = $[119];
|
|
805
|
+
let t39;
|
|
806
|
+
if ($[120] !== intl) {
|
|
807
|
+
t39 = intl.formatMessage(mediaMessages.pickerTabs);
|
|
808
|
+
$[120] = intl;
|
|
809
|
+
$[121] = t39;
|
|
810
|
+
} else t39 = $[121];
|
|
811
|
+
let t40;
|
|
812
|
+
if ($[122] !== intl) {
|
|
813
|
+
t40 = intl.formatMessage(mediaMessages.pickerTabLibrary);
|
|
814
|
+
$[122] = intl;
|
|
815
|
+
$[123] = t40;
|
|
816
|
+
} else t40 = $[123];
|
|
817
|
+
let t41;
|
|
818
|
+
if ($[124] !== t40) {
|
|
819
|
+
t41 = /* @__PURE__ */ jsx(Tab, {
|
|
820
|
+
id: "library",
|
|
821
|
+
children: t40
|
|
822
|
+
});
|
|
823
|
+
$[124] = t40;
|
|
824
|
+
$[125] = t41;
|
|
825
|
+
} else t41 = $[125];
|
|
826
|
+
let t42;
|
|
827
|
+
if ($[126] !== intl) {
|
|
828
|
+
t42 = intl.formatMessage(mediaMessages.pickerTabUpload);
|
|
829
|
+
$[126] = intl;
|
|
830
|
+
$[127] = t42;
|
|
831
|
+
} else t42 = $[127];
|
|
832
|
+
let t43;
|
|
833
|
+
if ($[128] !== t42) {
|
|
834
|
+
t43 = /* @__PURE__ */ jsx(Tab, {
|
|
835
|
+
id: "upload",
|
|
836
|
+
children: t42
|
|
837
|
+
});
|
|
838
|
+
$[128] = t42;
|
|
839
|
+
$[129] = t43;
|
|
840
|
+
} else t43 = $[129];
|
|
841
|
+
let t44;
|
|
842
|
+
if ($[130] !== t39 || $[131] !== t41 || $[132] !== t43) {
|
|
843
|
+
t44 = /* @__PURE__ */ jsxs(TabList, {
|
|
844
|
+
"aria-label": t39,
|
|
845
|
+
className: MediaPicker_module_default.tabList,
|
|
846
|
+
children: [t41, t43]
|
|
847
|
+
});
|
|
848
|
+
$[130] = t39;
|
|
849
|
+
$[131] = t41;
|
|
850
|
+
$[132] = t43;
|
|
851
|
+
$[133] = t44;
|
|
852
|
+
} else t44 = $[133];
|
|
853
|
+
const t45 = !source.canCreate ? /* @__PURE__ */ jsxs("span", {
|
|
854
|
+
className: MediaPicker_module_default.cannotUpload,
|
|
855
|
+
children: [/* @__PURE__ */ jsx(Lock, {
|
|
856
|
+
"aria-hidden": true,
|
|
857
|
+
size: 14
|
|
858
|
+
}), intl.formatMessage(mediaMessages.pickerCannotUpload, { library })]
|
|
859
|
+
}) : null;
|
|
860
|
+
let t46;
|
|
861
|
+
if ($[134] !== t44 || $[135] !== t45) {
|
|
862
|
+
t46 = /* @__PURE__ */ jsxs("div", {
|
|
863
|
+
className: MediaPicker_module_default.bar,
|
|
864
|
+
children: [t44, t45]
|
|
865
|
+
});
|
|
866
|
+
$[134] = t44;
|
|
867
|
+
$[135] = t45;
|
|
868
|
+
$[136] = t46;
|
|
869
|
+
} else t46 = $[136];
|
|
870
|
+
const t47 = state.items.length > 0 || !isDefaultQuery(state.query) ? /* @__PURE__ */ jsx(PickerToolbar, {
|
|
871
|
+
query: state.query,
|
|
872
|
+
onQueryChange: browser.setQuery,
|
|
873
|
+
sorts: sortsOf(source),
|
|
874
|
+
filters,
|
|
875
|
+
locked,
|
|
876
|
+
lockedFilters: filters
|
|
877
|
+
}) : null;
|
|
878
|
+
let t48;
|
|
879
|
+
if ($[137] !== accept || $[138] !== intl || $[139] !== maxSize) {
|
|
880
|
+
t48 = accept !== null || maxSize !== null ? /* @__PURE__ */ jsx(Text, {
|
|
881
|
+
size: "sm",
|
|
882
|
+
muted: true,
|
|
883
|
+
className: MediaPicker_module_default.constraints,
|
|
884
|
+
children: maxSize !== null ? intl.formatMessage(mediaMessages.pickerAcceptedSize, {
|
|
885
|
+
types: accept !== null && accept.length > 0 ? describeAccept(accept, intl) : intl.formatMessage(mediaMessages.pickerAnyFile),
|
|
886
|
+
size: formatSize(maxSize, intl.locale)
|
|
887
|
+
}) : intl.formatMessage(mediaMessages.pickerAccepted, { types: describeAccept(accept ?? [], intl) })
|
|
888
|
+
}) : null;
|
|
889
|
+
$[137] = accept;
|
|
890
|
+
$[138] = intl;
|
|
891
|
+
$[139] = maxSize;
|
|
892
|
+
$[140] = t48;
|
|
893
|
+
} else t48 = $[140];
|
|
894
|
+
let t49;
|
|
895
|
+
if ($[141] !== libraryContent || $[142] !== t47 || $[143] !== t48) {
|
|
896
|
+
t49 = /* @__PURE__ */ jsxs(TabPanel, {
|
|
897
|
+
id: "library",
|
|
898
|
+
className: MediaPicker_module_default.panel,
|
|
899
|
+
children: [
|
|
900
|
+
t47,
|
|
901
|
+
t48,
|
|
902
|
+
libraryContent
|
|
903
|
+
]
|
|
904
|
+
});
|
|
905
|
+
$[141] = libraryContent;
|
|
906
|
+
$[142] = t47;
|
|
907
|
+
$[143] = t48;
|
|
908
|
+
$[144] = t49;
|
|
909
|
+
} else t49 = $[144];
|
|
910
|
+
const T0 = Dialog;
|
|
911
|
+
const t50 = pendingFocus !== null;
|
|
912
|
+
let t51;
|
|
913
|
+
if ($[145] !== setPendingFocus) {
|
|
914
|
+
t51 = (open) => open ? void 0 : setPendingFocus(null);
|
|
915
|
+
$[145] = setPendingFocus;
|
|
916
|
+
$[146] = t51;
|
|
917
|
+
} else t51 = $[146];
|
|
918
|
+
const t52 = "alertdialog";
|
|
919
|
+
const t53 = false;
|
|
920
|
+
const t54 = "sm";
|
|
921
|
+
const t55 = intl.formatMessage(mediaMessages.pickerUnsaved, { name: focusedEntry?.item.label ?? "" });
|
|
922
|
+
let t56;
|
|
923
|
+
if ($[147] !== pendingFocus || $[148] !== setDraft || $[149] !== setFocused || $[150] !== setPendingFocus) {
|
|
924
|
+
t56 = () => {
|
|
925
|
+
setDraft(null);
|
|
926
|
+
setFocused(pendingFocus);
|
|
927
|
+
setPendingFocus(null);
|
|
928
|
+
};
|
|
929
|
+
$[147] = pendingFocus;
|
|
930
|
+
$[148] = setDraft;
|
|
931
|
+
$[149] = setFocused;
|
|
932
|
+
$[150] = setPendingFocus;
|
|
933
|
+
$[151] = t56;
|
|
934
|
+
} else t56 = $[151];
|
|
935
|
+
let t57;
|
|
936
|
+
if ($[152] !== intl) {
|
|
937
|
+
t57 = intl.formatMessage(mediaMessages.pickerDiscard);
|
|
938
|
+
$[152] = intl;
|
|
939
|
+
$[153] = t57;
|
|
940
|
+
} else t57 = $[153];
|
|
941
|
+
let t58;
|
|
942
|
+
if ($[154] !== t56 || $[155] !== t57) {
|
|
943
|
+
t58 = /* @__PURE__ */ jsx(Button, {
|
|
944
|
+
onPress: t56,
|
|
945
|
+
children: t57
|
|
946
|
+
});
|
|
947
|
+
$[154] = t56;
|
|
948
|
+
$[155] = t57;
|
|
949
|
+
$[156] = t58;
|
|
950
|
+
} else t58 = $[156];
|
|
951
|
+
let t59;
|
|
952
|
+
if ($[157] !== pendingFocus || $[158] !== save || $[159] !== setFocused || $[160] !== setPendingFocus) {
|
|
953
|
+
t59 = () => void save().then((saved_0) => {
|
|
954
|
+
if (saved_0) setFocused(pendingFocus);
|
|
955
|
+
setPendingFocus(null);
|
|
956
|
+
});
|
|
957
|
+
$[157] = pendingFocus;
|
|
958
|
+
$[158] = save;
|
|
959
|
+
$[159] = setFocused;
|
|
960
|
+
$[160] = setPendingFocus;
|
|
961
|
+
$[161] = t59;
|
|
962
|
+
} else t59 = $[161];
|
|
963
|
+
let t60;
|
|
964
|
+
if ($[162] !== intl) {
|
|
965
|
+
t60 = intl.formatMessage(mediaMessages.pickerSave);
|
|
966
|
+
$[162] = intl;
|
|
967
|
+
$[163] = t60;
|
|
968
|
+
} else t60 = $[163];
|
|
969
|
+
let t61;
|
|
970
|
+
if ($[164] !== saving || $[165] !== t59 || $[166] !== t60) {
|
|
971
|
+
t61 = /* @__PURE__ */ jsx(Button, {
|
|
972
|
+
variant: "primary",
|
|
973
|
+
isDisabled: saving,
|
|
974
|
+
onPress: t59,
|
|
975
|
+
children: t60
|
|
976
|
+
});
|
|
977
|
+
$[164] = saving;
|
|
978
|
+
$[165] = t59;
|
|
979
|
+
$[166] = t60;
|
|
980
|
+
$[167] = t61;
|
|
981
|
+
} else t61 = $[167];
|
|
982
|
+
let t62;
|
|
983
|
+
if ($[168] !== t58 || $[169] !== t61) {
|
|
984
|
+
t62 = /* @__PURE__ */ jsxs(Fragment, { children: [t58, t61] });
|
|
985
|
+
$[168] = t58;
|
|
986
|
+
$[169] = t61;
|
|
987
|
+
$[170] = t62;
|
|
988
|
+
} else t62 = $[170];
|
|
989
|
+
let t63;
|
|
990
|
+
if ($[171] !== intl) {
|
|
991
|
+
t63 = intl.formatMessage(mediaMessages.pickerUnsavedText);
|
|
992
|
+
$[171] = intl;
|
|
993
|
+
$[172] = t63;
|
|
994
|
+
} else t63 = $[172];
|
|
995
|
+
let t64;
|
|
996
|
+
if ($[173] !== T0 || $[174] !== t50 || $[175] !== t51 || $[176] !== t55 || $[177] !== t62 || $[178] !== t63) {
|
|
997
|
+
t64 = /* @__PURE__ */ jsx(T0, {
|
|
998
|
+
isOpen: t50,
|
|
999
|
+
onOpenChange: t51,
|
|
1000
|
+
role: t52,
|
|
1001
|
+
isDismissable: t53,
|
|
1002
|
+
size: t54,
|
|
1003
|
+
title: t55,
|
|
1004
|
+
footer: t62,
|
|
1005
|
+
children: t63
|
|
1006
|
+
});
|
|
1007
|
+
$[173] = T0;
|
|
1008
|
+
$[174] = t50;
|
|
1009
|
+
$[175] = t51;
|
|
1010
|
+
$[176] = t55;
|
|
1011
|
+
$[177] = t62;
|
|
1012
|
+
$[178] = t63;
|
|
1013
|
+
$[179] = t64;
|
|
1014
|
+
} else t64 = $[179];
|
|
431
1015
|
return /* @__PURE__ */ jsxs(Dialog, {
|
|
432
1016
|
isOpen: true,
|
|
433
1017
|
onOpenChange,
|
|
434
|
-
title:
|
|
1018
|
+
title: t32,
|
|
435
1019
|
size: "xl",
|
|
436
1020
|
fullScreenOnPhone: true,
|
|
437
1021
|
className: MediaPicker_module_default.dialog,
|
|
@@ -439,59 +1023,22 @@ function OpenMediaPicker({ onOpenChange, sources, source: initialSource, multipl
|
|
|
439
1023
|
headerContent: sources.length > 3 ? /* @__PURE__ */ jsx(Select, {
|
|
440
1024
|
"aria-label": intl.formatMessage(mediaMessages.pickerLibraries),
|
|
441
1025
|
isRequired: true,
|
|
442
|
-
options: sources.map(
|
|
443
|
-
value: candidate_4.id,
|
|
444
|
-
label: candidate_4.label
|
|
445
|
-
})),
|
|
1026
|
+
options: sources.map(_temp0),
|
|
446
1027
|
value: source.id,
|
|
447
1028
|
onChange: (next_0) => setSourceId(String(next_0)),
|
|
448
1029
|
className: MediaPicker_module_default.librarySelect
|
|
449
1030
|
}) : sources.length > 1 ? /* @__PURE__ */ jsx(SegmentedControl, {
|
|
450
1031
|
"aria-label": intl.formatMessage(mediaMessages.pickerLibraries),
|
|
451
1032
|
size: "sm",
|
|
452
|
-
options: sources.map(
|
|
453
|
-
value: candidate_5.id,
|
|
454
|
-
label: candidate_5.label
|
|
455
|
-
})),
|
|
1033
|
+
options: sources.map(_temp1),
|
|
456
1034
|
value: source.id,
|
|
457
1035
|
onChange: setSourceId
|
|
458
1036
|
}) : null,
|
|
459
1037
|
footer: /* @__PURE__ */ jsxs("div", {
|
|
460
1038
|
className: MediaPicker_module_default.footer,
|
|
461
|
-
children: [/* @__PURE__ */
|
|
462
|
-
className: MediaPicker_module_default.summary,
|
|
463
|
-
"aria-live": "polite",
|
|
464
|
-
children: picked.length === 0 ? /* @__PURE__ */ jsx(Text, {
|
|
465
|
-
muted: true,
|
|
466
|
-
size: "sm",
|
|
467
|
-
as: "span",
|
|
468
|
-
children: intl.formatMessage(mediaMessages.pickerNothingSelected)
|
|
469
|
-
}) : multiple ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Text, {
|
|
470
|
-
size: "sm",
|
|
471
|
-
weight: "medium",
|
|
472
|
-
as: "span",
|
|
473
|
-
children: pickedSources.size > 1 ? intl.formatMessage(mediaMessages.pickerSelectedIn, {
|
|
474
|
-
count: picked.length,
|
|
475
|
-
libraries: pickedSources.size
|
|
476
|
-
}) : intl.formatMessage(mediaMessages.pickerSelectedCount, { count: picked.length })
|
|
477
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
478
|
-
size: "sm",
|
|
479
|
-
variant: "ghost",
|
|
480
|
-
onPress: () => setSelection(/* @__PURE__ */ new Map()),
|
|
481
|
-
children: intl.formatMessage(mediaMessages.pickerClear)
|
|
482
|
-
})] }) : /* @__PURE__ */ jsx(Text, {
|
|
483
|
-
size: "sm",
|
|
484
|
-
as: "span",
|
|
485
|
-
truncate: true,
|
|
486
|
-
children: intl.formatMessage(mediaMessages.pickerSelected, { name: picked[0]?.item.label ?? "" })
|
|
487
|
-
})
|
|
488
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
1039
|
+
children: [t34, /* @__PURE__ */ jsxs("div", {
|
|
489
1040
|
className: MediaPicker_module_default.actions,
|
|
490
|
-
children: [/* @__PURE__ */ jsx(Button, {
|
|
491
|
-
className: MediaPicker_module_default.cancel,
|
|
492
|
-
onPress: () => onOpenChange(false),
|
|
493
|
-
children: intl.formatMessage(mediaMessages.pickerCancel)
|
|
494
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
1041
|
+
children: [t37, /* @__PURE__ */ jsx(Button, {
|
|
495
1042
|
variant: "primary",
|
|
496
1043
|
isDisabled: picked.length === 0 || unchanged,
|
|
497
1044
|
onPress: () => confirm(picked),
|
|
@@ -502,53 +1049,11 @@ function OpenMediaPicker({ onOpenChange, sources, source: initialSource, multipl
|
|
|
502
1049
|
children: [/* @__PURE__ */ jsxs(Tabs, {
|
|
503
1050
|
className: MediaPicker_module_default.tabs,
|
|
504
1051
|
selectedKey: tab,
|
|
505
|
-
onSelectionChange:
|
|
1052
|
+
onSelectionChange: t38,
|
|
506
1053
|
disabledKeys: source.canCreate ? [] : ["upload"],
|
|
507
1054
|
children: [
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
children: [/* @__PURE__ */ jsxs(TabList, {
|
|
511
|
-
"aria-label": intl.formatMessage(mediaMessages.pickerTabs),
|
|
512
|
-
className: MediaPicker_module_default.tabList,
|
|
513
|
-
children: [/* @__PURE__ */ jsx(Tab, {
|
|
514
|
-
id: "library",
|
|
515
|
-
children: intl.formatMessage(mediaMessages.pickerTabLibrary)
|
|
516
|
-
}), /* @__PURE__ */ jsx(Tab, {
|
|
517
|
-
id: "upload",
|
|
518
|
-
children: intl.formatMessage(mediaMessages.pickerTabUpload)
|
|
519
|
-
})]
|
|
520
|
-
}), !source.canCreate ? /* @__PURE__ */ jsxs("span", {
|
|
521
|
-
className: MediaPicker_module_default.cannotUpload,
|
|
522
|
-
children: [/* @__PURE__ */ jsx(Lock, {
|
|
523
|
-
"aria-hidden": true,
|
|
524
|
-
size: 14
|
|
525
|
-
}), intl.formatMessage(mediaMessages.pickerCannotUpload, { library })]
|
|
526
|
-
}) : null]
|
|
527
|
-
}),
|
|
528
|
-
/* @__PURE__ */ jsxs(TabPanel, {
|
|
529
|
-
id: "library",
|
|
530
|
-
className: MediaPicker_module_default.panel,
|
|
531
|
-
children: [
|
|
532
|
-
state.items.length > 0 || !isDefaultQuery(state.query) ? /* @__PURE__ */ jsx(PickerToolbar, {
|
|
533
|
-
query: state.query,
|
|
534
|
-
onQueryChange: browser.setQuery,
|
|
535
|
-
sorts: sortsOf(source),
|
|
536
|
-
filters,
|
|
537
|
-
locked,
|
|
538
|
-
lockedFilters: filters
|
|
539
|
-
}) : null,
|
|
540
|
-
accept !== null || maxSize !== null ? /* @__PURE__ */ jsx(Text, {
|
|
541
|
-
size: "sm",
|
|
542
|
-
muted: true,
|
|
543
|
-
className: MediaPicker_module_default.constraints,
|
|
544
|
-
children: maxSize !== null ? intl.formatMessage(mediaMessages.pickerAcceptedSize, {
|
|
545
|
-
types: accept !== null && accept.length > 0 ? describeAccept(accept, intl) : intl.formatMessage(mediaMessages.pickerAnyFile),
|
|
546
|
-
size: formatSize(maxSize, intl.locale)
|
|
547
|
-
}) : intl.formatMessage(mediaMessages.pickerAccepted, { types: describeAccept(accept ?? [], intl) })
|
|
548
|
-
}) : null,
|
|
549
|
-
libraryContent
|
|
550
|
-
]
|
|
551
|
-
}),
|
|
1055
|
+
t46,
|
|
1056
|
+
t49,
|
|
552
1057
|
/* @__PURE__ */ jsx(TabPanel, {
|
|
553
1058
|
id: "upload",
|
|
554
1059
|
className: MediaPicker_module_default.panel,
|
|
@@ -568,33 +1073,45 @@ function OpenMediaPicker({ onOpenChange, sources, source: initialSource, multipl
|
|
|
568
1073
|
})
|
|
569
1074
|
})
|
|
570
1075
|
]
|
|
571
|
-
}),
|
|
572
|
-
isOpen: pendingFocus !== null,
|
|
573
|
-
onOpenChange: (open) => open ? void 0 : setPendingFocus(null),
|
|
574
|
-
role: "alertdialog",
|
|
575
|
-
isDismissable: false,
|
|
576
|
-
size: "sm",
|
|
577
|
-
title: intl.formatMessage(mediaMessages.pickerUnsaved, { name: focusedEntry?.item.label ?? "" }),
|
|
578
|
-
footer: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
|
|
579
|
-
onPress: () => {
|
|
580
|
-
setDraft(null);
|
|
581
|
-
setFocused(pendingFocus);
|
|
582
|
-
setPendingFocus(null);
|
|
583
|
-
},
|
|
584
|
-
children: intl.formatMessage(mediaMessages.pickerDiscard)
|
|
585
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
586
|
-
variant: "primary",
|
|
587
|
-
isDisabled: saving,
|
|
588
|
-
onPress: () => void save().then((saved_0) => {
|
|
589
|
-
if (saved_0) setFocused(pendingFocus);
|
|
590
|
-
setPendingFocus(null);
|
|
591
|
-
}),
|
|
592
|
-
children: intl.formatMessage(mediaMessages.pickerSave)
|
|
593
|
-
})] }),
|
|
594
|
-
children: intl.formatMessage(mediaMessages.pickerUnsavedText)
|
|
595
|
-
})]
|
|
1076
|
+
}), t64]
|
|
596
1077
|
});
|
|
597
1078
|
}
|
|
1079
|
+
function _temp1(candidate_5) {
|
|
1080
|
+
return {
|
|
1081
|
+
value: candidate_5.id,
|
|
1082
|
+
label: candidate_5.label
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
function _temp0(candidate_4) {
|
|
1086
|
+
return {
|
|
1087
|
+
value: candidate_4.id,
|
|
1088
|
+
label: candidate_4.label
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
function _temp9(reference_1) {
|
|
1092
|
+
return reference_1.id;
|
|
1093
|
+
}
|
|
1094
|
+
function _temp8(entry_10) {
|
|
1095
|
+
return entry_10.item.id;
|
|
1096
|
+
}
|
|
1097
|
+
function _temp7(entry_8) {
|
|
1098
|
+
return entry_8.isIntersecting;
|
|
1099
|
+
}
|
|
1100
|
+
function _temp6() {}
|
|
1101
|
+
function _temp5(t0) {
|
|
1102
|
+
const { source: id_0, item: item_7 } = t0;
|
|
1103
|
+
return `${keyOf(id_0, item_7.id)}:${item_7.media.status ?? ""}`;
|
|
1104
|
+
}
|
|
1105
|
+
function _temp4(t0) {
|
|
1106
|
+
const { item: item_6 } = t0;
|
|
1107
|
+
return isProcessingMedia(item_6);
|
|
1108
|
+
}
|
|
1109
|
+
function _temp3(item_3) {
|
|
1110
|
+
return item_3.id;
|
|
1111
|
+
}
|
|
1112
|
+
function _temp2(entry) {
|
|
1113
|
+
return entry.source;
|
|
1114
|
+
}
|
|
598
1115
|
//#endregion
|
|
599
1116
|
export { MediaPicker };
|
|
600
1117
|
|