@proveanything/smartlinks-utils-ui 0.12.17 → 0.12.19
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/{chunk-2IQEDRSZ.js → chunk-ZTUZPAHD.js} +250 -134
- package/dist/chunk-ZTUZPAHD.js.map +1 -0
- package/dist/components/AssetPicker/index.css +6 -0
- package/dist/components/AssetPicker/index.css.map +1 -1
- package/dist/components/AssetPicker/index.js +1 -1
- package/dist/components/ConditionsEditor/index.css +6 -0
- package/dist/components/ConditionsEditor/index.css.map +1 -1
- package/dist/components/FontPicker/index.css +6 -0
- package/dist/components/FontPicker/index.css.map +1 -1
- package/dist/components/IconPicker/index.css +6 -0
- package/dist/components/IconPicker/index.css.map +1 -1
- package/dist/components/LinkPicker/index.css +6 -0
- package/dist/components/LinkPicker/index.css.map +1 -1
- package/dist/components/RecordsAdmin/index.css +6 -0
- package/dist/components/RecordsAdmin/index.css.map +1 -1
- package/dist/components/RecordsAdmin/index.js +17 -9
- package/dist/components/RecordsAdmin/index.js.map +1 -1
- package/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2IQEDRSZ.js.map +0 -1
|
@@ -506,22 +506,33 @@ var UploadZone = ({
|
|
|
506
506
|
e.stopPropagation();
|
|
507
507
|
setDragOver(false);
|
|
508
508
|
}, []);
|
|
509
|
+
const presentForRename = useCallback((file) => {
|
|
510
|
+
const previewUrl = file.type.startsWith("image/") ? URL.createObjectURL(file) : "";
|
|
511
|
+
const defaultName = file.name.replace(/\.[^.]+$/, "") || "file";
|
|
512
|
+
setPastedFile({ file, previewUrl, name: defaultName });
|
|
513
|
+
setFileName(defaultName);
|
|
514
|
+
setEditingName(false);
|
|
515
|
+
}, []);
|
|
509
516
|
const handleDrop = useCallback((e) => {
|
|
510
517
|
e.preventDefault();
|
|
511
518
|
e.stopPropagation();
|
|
512
519
|
setDragOver(false);
|
|
513
520
|
const files = Array.from(e.dataTransfer.files);
|
|
514
|
-
if (files.length
|
|
521
|
+
if (files.length === 1 && !multiple) {
|
|
522
|
+
presentForRename(files[0]);
|
|
523
|
+
} else if (files.length > 0) {
|
|
515
524
|
onFiles(multiple ? files : [files[0]]);
|
|
516
525
|
}
|
|
517
|
-
}, [onFiles, multiple]);
|
|
526
|
+
}, [onFiles, multiple, presentForRename]);
|
|
518
527
|
const handleInputChange = useCallback((e) => {
|
|
519
528
|
const files = Array.from(e.target.files || []);
|
|
520
|
-
if (files.length
|
|
529
|
+
if (files.length === 1 && !multiple) {
|
|
530
|
+
presentForRename(files[0]);
|
|
531
|
+
} else if (files.length > 0) {
|
|
521
532
|
onFiles(multiple ? files : [files[0]]);
|
|
522
533
|
}
|
|
523
534
|
e.target.value = "";
|
|
524
|
-
}, [onFiles, multiple]);
|
|
535
|
+
}, [onFiles, multiple, presentForRename]);
|
|
525
536
|
if (pastedFile) {
|
|
526
537
|
return /* @__PURE__ */ jsx("div", { className: cn(
|
|
527
538
|
"border-2 border-solid border-primary rounded-lg p-4 transition-colors",
|
|
@@ -672,6 +683,7 @@ var UrlImport = ({
|
|
|
672
683
|
className
|
|
673
684
|
}) => {
|
|
674
685
|
const [url, setUrl] = useState("");
|
|
686
|
+
const [name, setName] = useState("");
|
|
675
687
|
const [error, setError] = useState("");
|
|
676
688
|
const handleSubmit = useCallback(async (e) => {
|
|
677
689
|
e?.preventDefault();
|
|
@@ -684,58 +696,74 @@ var UrlImport = ({
|
|
|
684
696
|
return;
|
|
685
697
|
}
|
|
686
698
|
setError("");
|
|
687
|
-
const result = await onImport(url.trim());
|
|
688
|
-
if (result)
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
699
|
+
const result = await onImport(url.trim(), name.trim() || void 0);
|
|
700
|
+
if (result) {
|
|
701
|
+
setUrl("");
|
|
702
|
+
setName("");
|
|
703
|
+
}
|
|
704
|
+
}, [url, name, onImport]);
|
|
705
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
706
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
707
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex-1", children: [
|
|
708
|
+
/* @__PURE__ */ jsx(Link, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" }),
|
|
709
|
+
/* @__PURE__ */ jsx(
|
|
710
|
+
"input",
|
|
711
|
+
{
|
|
712
|
+
type: "text",
|
|
713
|
+
value: url,
|
|
714
|
+
onChange: (e) => {
|
|
715
|
+
setUrl(e.target.value);
|
|
716
|
+
setError("");
|
|
717
|
+
},
|
|
718
|
+
onKeyDown: (e) => {
|
|
719
|
+
if (e.key === "Enter") {
|
|
720
|
+
e.preventDefault();
|
|
721
|
+
e.stopPropagation();
|
|
722
|
+
handleSubmit();
|
|
723
|
+
}
|
|
724
|
+
},
|
|
725
|
+
placeholder: "https://example.com/image.png",
|
|
726
|
+
disabled: importing,
|
|
727
|
+
className: cn(
|
|
728
|
+
"w-full pl-8 pr-3 py-2 text-sm rounded-md border bg-transparent",
|
|
729
|
+
"placeholder:text-muted-foreground",
|
|
730
|
+
"focus:outline-none focus:ring-2 focus:ring-ring",
|
|
731
|
+
error ? "border-destructive" : "border-border"
|
|
732
|
+
)
|
|
733
|
+
}
|
|
734
|
+
)
|
|
735
|
+
] }),
|
|
736
|
+
/* @__PURE__ */ jsxs(
|
|
737
|
+
"button",
|
|
695
738
|
{
|
|
696
|
-
type: "
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
setUrl(e.target.value);
|
|
700
|
-
setError("");
|
|
701
|
-
},
|
|
702
|
-
onKeyDown: (e) => {
|
|
703
|
-
if (e.key === "Enter") {
|
|
704
|
-
e.preventDefault();
|
|
705
|
-
e.stopPropagation();
|
|
706
|
-
handleSubmit();
|
|
707
|
-
}
|
|
708
|
-
},
|
|
709
|
-
placeholder: "https://example.com/image.png",
|
|
710
|
-
disabled: importing,
|
|
739
|
+
type: "button",
|
|
740
|
+
onClick: handleSubmit,
|
|
741
|
+
disabled: !url.trim() || importing,
|
|
711
742
|
className: cn(
|
|
712
|
-
"
|
|
713
|
-
"
|
|
714
|
-
"
|
|
715
|
-
|
|
716
|
-
)
|
|
743
|
+
"px-3 py-2 text-sm font-medium rounded-md transition-colors",
|
|
744
|
+
"bg-primary text-primary-foreground hover:bg-primary/90",
|
|
745
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
746
|
+
"flex items-center gap-1.5"
|
|
747
|
+
),
|
|
748
|
+
children: [
|
|
749
|
+
importing ? /* @__PURE__ */ jsx(Loader2, { className: "w-3.5 h-3.5 animate-spin" }) : null,
|
|
750
|
+
"Import"
|
|
751
|
+
]
|
|
717
752
|
}
|
|
718
753
|
)
|
|
719
754
|
] }),
|
|
720
|
-
/* @__PURE__ */
|
|
721
|
-
"
|
|
755
|
+
/* @__PURE__ */ jsx(
|
|
756
|
+
"input",
|
|
722
757
|
{
|
|
723
|
-
type: "
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
730
|
-
"flex items-center gap-1.5"
|
|
731
|
-
),
|
|
732
|
-
children: [
|
|
733
|
-
importing ? /* @__PURE__ */ jsx(Loader2, { className: "w-3.5 h-3.5 animate-spin" }) : null,
|
|
734
|
-
"Import"
|
|
735
|
-
]
|
|
758
|
+
type: "text",
|
|
759
|
+
value: name,
|
|
760
|
+
onChange: (e) => setName(e.target.value),
|
|
761
|
+
placeholder: "Optional name (defaults to filename from URL)",
|
|
762
|
+
disabled: importing,
|
|
763
|
+
className: "w-full px-3 py-1.5 text-xs rounded-md border border-border bg-transparent placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
736
764
|
}
|
|
737
765
|
),
|
|
738
|
-
error && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive
|
|
766
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: error })
|
|
739
767
|
] });
|
|
740
768
|
};
|
|
741
769
|
var ASPECT_PRESETS = [
|
|
@@ -784,6 +812,7 @@ var AIImageGenerate = ({
|
|
|
784
812
|
const [error, setError] = useState(null);
|
|
785
813
|
const [previewUrl, setPreviewUrl] = useState(null);
|
|
786
814
|
const [saved, setSaved] = useState(false);
|
|
815
|
+
const [customName, setCustomName] = useState("");
|
|
787
816
|
const SpeechRecognitionCtor = typeof window !== "undefined" ? window.SpeechRecognition || window.webkitSpeechRecognition : null;
|
|
788
817
|
const voiceSupported = !!SpeechRecognitionCtor;
|
|
789
818
|
const recognitionRef = useRef(null);
|
|
@@ -886,16 +915,18 @@ var AIImageGenerate = ({
|
|
|
886
915
|
}, [prompt, aspect, quality, style, provider, model, collectionId]);
|
|
887
916
|
const handleSave = useCallback(async () => {
|
|
888
917
|
if (!previewUrl) return;
|
|
889
|
-
const
|
|
890
|
-
const
|
|
918
|
+
const custom = customName.trim();
|
|
919
|
+
const fileName = custom ? /\.[a-z0-9]{2,5}$/i.test(custom) ? custom : `${custom}.png` : `ai-${prompt.trim().slice(0, 60).replace(/\s+/g, "-") || "ai-image"}.png`;
|
|
920
|
+
const result = await onSave(previewUrl, fileName);
|
|
891
921
|
if (result) {
|
|
892
922
|
setSaved(true);
|
|
893
923
|
setTimeout(() => {
|
|
894
924
|
setPreviewUrl(null);
|
|
895
925
|
setSaved(false);
|
|
926
|
+
setCustomName("");
|
|
896
927
|
}, 1500);
|
|
897
928
|
}
|
|
898
|
-
}, [previewUrl, prompt, onSave]);
|
|
929
|
+
}, [previewUrl, prompt, customName, onSave]);
|
|
899
930
|
if (!collectionId) {
|
|
900
931
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-3 rounded-md bg-muted text-muted-foreground text-sm", children: [
|
|
901
932
|
/* @__PURE__ */ jsx(AlertCircle, { className: "w-4 h-4 flex-shrink-0" }),
|
|
@@ -1080,6 +1111,20 @@ var AIImageGenerate = ({
|
|
|
1080
1111
|
className: "max-w-full max-h-80 object-contain"
|
|
1081
1112
|
}
|
|
1082
1113
|
) }),
|
|
1114
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1115
|
+
/* @__PURE__ */ jsx("label", { className: "text-[11px] font-medium text-foreground", children: "Name (optional)" }),
|
|
1116
|
+
/* @__PURE__ */ jsx(
|
|
1117
|
+
"input",
|
|
1118
|
+
{
|
|
1119
|
+
type: "text",
|
|
1120
|
+
value: customName,
|
|
1121
|
+
onChange: (e) => setCustomName(e.target.value),
|
|
1122
|
+
placeholder: "Defaults to a name based on your prompt",
|
|
1123
|
+
disabled: saving || saved,
|
|
1124
|
+
className: "w-full px-2 py-1.5 text-xs rounded-md border border-border bg-transparent placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"
|
|
1125
|
+
}
|
|
1126
|
+
)
|
|
1127
|
+
] }),
|
|
1083
1128
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2", children: [
|
|
1084
1129
|
/* @__PURE__ */ jsx(
|
|
1085
1130
|
"button",
|
|
@@ -1140,6 +1185,7 @@ var StockPhotoSearch = ({
|
|
|
1140
1185
|
const [results, setResults] = useState([]);
|
|
1141
1186
|
const [savedUrl, setSavedUrl] = useState(null);
|
|
1142
1187
|
const [pendingUrl, setPendingUrl] = useState(null);
|
|
1188
|
+
const [nameOverrides, setNameOverrides] = useState({});
|
|
1143
1189
|
const handleSearch = useCallback(async () => {
|
|
1144
1190
|
if (!query.trim() || !collectionId) return;
|
|
1145
1191
|
setSearching(true);
|
|
@@ -1167,14 +1213,15 @@ var StockPhotoSearch = ({
|
|
|
1167
1213
|
const handleSave = useCallback(async (photo) => {
|
|
1168
1214
|
const fullUrl = getFullUrl(photo);
|
|
1169
1215
|
setPendingUrl(fullUrl);
|
|
1170
|
-
const
|
|
1171
|
-
const
|
|
1216
|
+
const override = (nameOverrides[fullUrl] || "").trim();
|
|
1217
|
+
const fileName = override ? /\.[a-z0-9]{2,5}$/i.test(override) ? override : `${override}.jpg` : `stock-${(photo.alt || query.trim() || "stock-photo").slice(0, 60).replace(/\s+/g, "-")}.jpg`;
|
|
1218
|
+
const result = await onSave(fullUrl, fileName);
|
|
1172
1219
|
setPendingUrl(null);
|
|
1173
1220
|
if (result) {
|
|
1174
1221
|
setSavedUrl(fullUrl);
|
|
1175
1222
|
setTimeout(() => setSavedUrl(null), 1500);
|
|
1176
1223
|
}
|
|
1177
|
-
}, [onSave, query]);
|
|
1224
|
+
}, [onSave, query, nameOverrides]);
|
|
1178
1225
|
if (!collectionId) {
|
|
1179
1226
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-3 rounded-md bg-muted text-muted-foreground text-sm", children: [
|
|
1180
1227
|
/* @__PURE__ */ jsx(AlertCircle, { className: "w-4 h-4 flex-shrink-0" }),
|
|
@@ -1245,52 +1292,65 @@ var StockPhotoSearch = ({
|
|
|
1245
1292
|
return /* @__PURE__ */ jsxs(
|
|
1246
1293
|
"div",
|
|
1247
1294
|
{
|
|
1248
|
-
className: "
|
|
1295
|
+
className: "flex flex-col gap-1",
|
|
1249
1296
|
children: [
|
|
1297
|
+
/* @__PURE__ */ jsxs("div", { className: "group relative aspect-square rounded-md overflow-hidden border border-border bg-muted/30", children: [
|
|
1298
|
+
/* @__PURE__ */ jsx(
|
|
1299
|
+
"img",
|
|
1300
|
+
{
|
|
1301
|
+
src: thumb,
|
|
1302
|
+
alt: photo.alt || "",
|
|
1303
|
+
loading: "lazy",
|
|
1304
|
+
className: "w-full h-full object-cover"
|
|
1305
|
+
}
|
|
1306
|
+
),
|
|
1307
|
+
/* @__PURE__ */ jsx(
|
|
1308
|
+
"button",
|
|
1309
|
+
{
|
|
1310
|
+
type: "button",
|
|
1311
|
+
onClick: () => handleSave(photo),
|
|
1312
|
+
disabled: !!pendingUrl || saving,
|
|
1313
|
+
className: cn(
|
|
1314
|
+
"absolute inset-0 flex items-center justify-center text-xs font-medium",
|
|
1315
|
+
"bg-background/80 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1316
|
+
"text-foreground gap-1.5",
|
|
1317
|
+
(isPending || isSaved) && "opacity-100"
|
|
1318
|
+
),
|
|
1319
|
+
children: isPending ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1320
|
+
/* @__PURE__ */ jsx(Loader2, { className: "w-3.5 h-3.5 animate-spin" }),
|
|
1321
|
+
" Saving\u2026"
|
|
1322
|
+
] }) : isSaved ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1323
|
+
/* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5" }),
|
|
1324
|
+
" Saved"
|
|
1325
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1326
|
+
/* @__PURE__ */ jsx(Image, { className: "w-3.5 h-3.5" }),
|
|
1327
|
+
" Save"
|
|
1328
|
+
] })
|
|
1329
|
+
}
|
|
1330
|
+
),
|
|
1331
|
+
photo.photographer && /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 inset-x-0 px-1.5 py-0.5 text-[10px] text-background bg-foreground/60 truncate", children: photo.photographerUrl ? /* @__PURE__ */ jsx(
|
|
1332
|
+
"a",
|
|
1333
|
+
{
|
|
1334
|
+
href: photo.photographerUrl,
|
|
1335
|
+
target: "_blank",
|
|
1336
|
+
rel: "noreferrer noopener",
|
|
1337
|
+
onClick: (e) => e.stopPropagation(),
|
|
1338
|
+
className: "hover:underline",
|
|
1339
|
+
children: photo.photographer
|
|
1340
|
+
}
|
|
1341
|
+
) : photo.photographer })
|
|
1342
|
+
] }),
|
|
1250
1343
|
/* @__PURE__ */ jsx(
|
|
1251
|
-
"
|
|
1252
|
-
{
|
|
1253
|
-
src: thumb,
|
|
1254
|
-
alt: photo.alt || "",
|
|
1255
|
-
loading: "lazy",
|
|
1256
|
-
className: "w-full h-full object-cover"
|
|
1257
|
-
}
|
|
1258
|
-
),
|
|
1259
|
-
/* @__PURE__ */ jsx(
|
|
1260
|
-
"button",
|
|
1344
|
+
"input",
|
|
1261
1345
|
{
|
|
1262
|
-
type: "
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
"text-foreground gap-1.5",
|
|
1269
|
-
(isPending || isSaved) && "opacity-100"
|
|
1270
|
-
),
|
|
1271
|
-
children: isPending ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1272
|
-
/* @__PURE__ */ jsx(Loader2, { className: "w-3.5 h-3.5 animate-spin" }),
|
|
1273
|
-
" Saving\u2026"
|
|
1274
|
-
] }) : isSaved ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1275
|
-
/* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5" }),
|
|
1276
|
-
" Saved"
|
|
1277
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1278
|
-
/* @__PURE__ */ jsx(Image, { className: "w-3.5 h-3.5" }),
|
|
1279
|
-
" Save"
|
|
1280
|
-
] })
|
|
1346
|
+
type: "text",
|
|
1347
|
+
value: nameOverrides[full] || "",
|
|
1348
|
+
onChange: (e) => setNameOverrides((prev) => ({ ...prev, [full]: e.target.value })),
|
|
1349
|
+
placeholder: "Optional name",
|
|
1350
|
+
disabled: isPending || saving,
|
|
1351
|
+
className: "w-full px-1.5 py-1 text-[11px] rounded-md border border-border bg-transparent placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"
|
|
1281
1352
|
}
|
|
1282
|
-
)
|
|
1283
|
-
photo.photographer && /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 inset-x-0 px-1.5 py-0.5 text-[10px] text-background bg-foreground/60 truncate", children: photo.photographerUrl ? /* @__PURE__ */ jsx(
|
|
1284
|
-
"a",
|
|
1285
|
-
{
|
|
1286
|
-
href: photo.photographerUrl,
|
|
1287
|
-
target: "_blank",
|
|
1288
|
-
rel: "noreferrer noopener",
|
|
1289
|
-
onClick: (e) => e.stopPropagation(),
|
|
1290
|
-
className: "hover:underline",
|
|
1291
|
-
children: photo.photographer
|
|
1292
|
-
}
|
|
1293
|
-
) : photo.photographer })
|
|
1353
|
+
)
|
|
1294
1354
|
]
|
|
1295
1355
|
},
|
|
1296
1356
|
`${full}-${i}`
|
|
@@ -1298,6 +1358,21 @@ var StockPhotoSearch = ({
|
|
|
1298
1358
|
}) })
|
|
1299
1359
|
] });
|
|
1300
1360
|
};
|
|
1361
|
+
var GlobalUploadToggle = ({ checked, onChange, appName }) => /* @__PURE__ */ jsxs("label", { className: "flex items-start gap-2 text-xs text-muted-foreground cursor-pointer select-none p-2 rounded-md border border-border bg-muted/30", children: [
|
|
1362
|
+
/* @__PURE__ */ jsx(
|
|
1363
|
+
"input",
|
|
1364
|
+
{
|
|
1365
|
+
type: "checkbox",
|
|
1366
|
+
checked,
|
|
1367
|
+
onChange: (e) => onChange(e.target.checked),
|
|
1368
|
+
className: "mt-0.5 cursor-pointer"
|
|
1369
|
+
}
|
|
1370
|
+
),
|
|
1371
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
1372
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: "Add to shared collection" }),
|
|
1373
|
+
/* @__PURE__ */ jsx("span", { className: "block", children: checked ? `Asset will be available to every app in this collection.` : `Asset will be tagged to ${appName}. Tick to share with every app in the collection instead.` })
|
|
1374
|
+
] })
|
|
1375
|
+
] });
|
|
1301
1376
|
var ScopedAssetBrowser = ({ scope, accept, pageSize, viewMode, search, selectedIds, onToggleSelect, onDoubleClickSelect, onDelete, allowDelete, emptyText, listAppId, currentAppId, currentAppName, getAppName }) => {
|
|
1302
1377
|
const { assets, loading, error, refresh } = useAssets({ scope, accept, pageSize, listAppId });
|
|
1303
1378
|
const filteredAssets = useMemo(() => {
|
|
@@ -1364,6 +1439,7 @@ var AssetPickerContent = ({
|
|
|
1364
1439
|
const [appFilter, setAppFilter] = useState(defaultAppFilter);
|
|
1365
1440
|
const hasAppFilter = !!appId;
|
|
1366
1441
|
const [otherAppFilter, setOtherAppFilter] = useState("");
|
|
1442
|
+
const [uploadGlobal, setUploadGlobal] = useState(false);
|
|
1367
1443
|
const collectionIdForRegistry = scope.collectionId;
|
|
1368
1444
|
const { apps: registryApps, getAppName } = useAppRegistry(collectionIdForRegistry);
|
|
1369
1445
|
const resolvedAppName = appName || (appId ? getAppName(appId) : void 0);
|
|
@@ -1372,7 +1448,7 @@ var AssetPickerContent = ({
|
|
|
1372
1448
|
scope,
|
|
1373
1449
|
accept: acceptProp,
|
|
1374
1450
|
pageSize,
|
|
1375
|
-
appId,
|
|
1451
|
+
appId: uploadGlobal ? void 0 : appId,
|
|
1376
1452
|
listAppId
|
|
1377
1453
|
});
|
|
1378
1454
|
const [tab, setTab] = useState("browse");
|
|
@@ -1442,8 +1518,8 @@ var AssetPickerContent = ({
|
|
|
1442
1518
|
}
|
|
1443
1519
|
setTab("browse");
|
|
1444
1520
|
}, [upload, multiple, onSelect, toSelection]);
|
|
1445
|
-
const handleUrlImport = useCallback(async (url) => {
|
|
1446
|
-
const result = await uploadFromUrl(url);
|
|
1521
|
+
const handleUrlImport = useCallback(async (url, name) => {
|
|
1522
|
+
const result = await uploadFromUrl(url, name);
|
|
1447
1523
|
if (result) {
|
|
1448
1524
|
setTab("browse");
|
|
1449
1525
|
if (!multiple) {
|
|
@@ -1651,39 +1727,79 @@ var AssetPickerContent = ({
|
|
|
1651
1727
|
},
|
|
1652
1728
|
`${activeScope.type}-${activeScope.productId || ""}-${effectiveAccept || "all"}-${listAppId || "no-app-filter"}`
|
|
1653
1729
|
),
|
|
1654
|
-
tab === "upload" && /* @__PURE__ */
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1730
|
+
tab === "upload" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1731
|
+
hasAppFilter && /* @__PURE__ */ jsx(
|
|
1732
|
+
GlobalUploadToggle,
|
|
1733
|
+
{
|
|
1734
|
+
checked: uploadGlobal,
|
|
1735
|
+
onChange: setUploadGlobal,
|
|
1736
|
+
appName: resolvedAppName || appId
|
|
1737
|
+
}
|
|
1738
|
+
),
|
|
1739
|
+
/* @__PURE__ */ jsx(
|
|
1740
|
+
UploadZone,
|
|
1741
|
+
{
|
|
1742
|
+
onFiles: handleUploadFiles,
|
|
1743
|
+
accept: acceptProp,
|
|
1744
|
+
multiple,
|
|
1745
|
+
uploading,
|
|
1746
|
+
uploadProgress
|
|
1747
|
+
}
|
|
1748
|
+
)
|
|
1749
|
+
] }),
|
|
1750
|
+
tab === "url" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1751
|
+
hasAppFilter && /* @__PURE__ */ jsx(
|
|
1752
|
+
GlobalUploadToggle,
|
|
1753
|
+
{
|
|
1754
|
+
checked: uploadGlobal,
|
|
1755
|
+
onChange: setUploadGlobal,
|
|
1756
|
+
appName: resolvedAppName || appId
|
|
1757
|
+
}
|
|
1758
|
+
),
|
|
1759
|
+
/* @__PURE__ */ jsx(
|
|
1760
|
+
UrlImport,
|
|
1761
|
+
{
|
|
1762
|
+
onImport: handleUrlImport,
|
|
1763
|
+
importing: uploading
|
|
1764
|
+
}
|
|
1765
|
+
)
|
|
1766
|
+
] }),
|
|
1767
|
+
tab === "ai" && aiEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1768
|
+
hasAppFilter && /* @__PURE__ */ jsx(
|
|
1769
|
+
GlobalUploadToggle,
|
|
1770
|
+
{
|
|
1771
|
+
checked: uploadGlobal,
|
|
1772
|
+
onChange: setUploadGlobal,
|
|
1773
|
+
appName: resolvedAppName || appId
|
|
1774
|
+
}
|
|
1775
|
+
),
|
|
1776
|
+
/* @__PURE__ */ jsx(
|
|
1777
|
+
AIImageGenerate,
|
|
1778
|
+
{
|
|
1779
|
+
collectionId,
|
|
1780
|
+
onSave: handleRemoteIngest,
|
|
1781
|
+
saving: uploading
|
|
1782
|
+
}
|
|
1783
|
+
)
|
|
1784
|
+
] }),
|
|
1785
|
+
tab === "stock" && stockEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1786
|
+
hasAppFilter && /* @__PURE__ */ jsx(
|
|
1787
|
+
GlobalUploadToggle,
|
|
1788
|
+
{
|
|
1789
|
+
checked: uploadGlobal,
|
|
1790
|
+
onChange: setUploadGlobal,
|
|
1791
|
+
appName: resolvedAppName || appId
|
|
1792
|
+
}
|
|
1793
|
+
),
|
|
1794
|
+
/* @__PURE__ */ jsx(
|
|
1795
|
+
StockPhotoSearch,
|
|
1796
|
+
{
|
|
1797
|
+
collectionId,
|
|
1798
|
+
onSave: handleRemoteIngest,
|
|
1799
|
+
saving: uploading
|
|
1800
|
+
}
|
|
1801
|
+
)
|
|
1802
|
+
] }),
|
|
1687
1803
|
onConfirm && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-2 border-t border-border", children: [
|
|
1688
1804
|
/* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
1689
1805
|
selectedIds.size,
|
|
@@ -1776,5 +1892,5 @@ var AssetPicker = (props) => {
|
|
|
1776
1892
|
assertStylesLoaded();
|
|
1777
1893
|
|
|
1778
1894
|
export { ASSET_MIME_FILTERS, AssetPicker, useAppRegistry, useAssets };
|
|
1779
|
-
//# sourceMappingURL=chunk-
|
|
1780
|
-
//# sourceMappingURL=chunk-
|
|
1895
|
+
//# sourceMappingURL=chunk-ZTUZPAHD.js.map
|
|
1896
|
+
//# sourceMappingURL=chunk-ZTUZPAHD.js.map
|