sanity-plugin-media 6.1.0 → 6.1.1
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/index.js +438 -426
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { bufferTime, catchError, concatMap, debounceTime, delay, filter, first,
|
|
|
15
15
|
import { uuid } from "@sanity/uuid";
|
|
16
16
|
import pluralize from "pluralize";
|
|
17
17
|
import { createGlobalStyle, css, styled } from "styled-components";
|
|
18
|
-
import { Controller, useForm } from "react-hook-form";
|
|
18
|
+
import { Controller, useForm, useFormState } from "react-hook-form";
|
|
19
19
|
import * as z from "zod";
|
|
20
20
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
21
21
|
import { DownloadIcon } from "@sanity/icons/Download";
|
|
@@ -1208,7 +1208,10 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
|
|
|
1208
1208
|
return of(assetsActions.listenerUpdateQueueComplete({ assets }));
|
|
1209
1209
|
})), assetsSortEpic = (action$) => action$.pipe(ofType(assetsActions.insertUploads.type, assetsActions.listenerUpdateQueueComplete.type, assetsActions.updateComplete.type), mergeMap(() => of(assetsActions.sort()))), assetsTagsAddEpic = (action$, state$, { client }) => action$.pipe(filter(ASSETS_ACTIONS.tagsAddRequest.match), withLatestFrom(state$), mergeMap(([action, state]) => {
|
|
1210
1210
|
let { assets, tag } = action.payload;
|
|
1211
|
-
return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() =>
|
|
1211
|
+
return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() => {
|
|
1212
|
+
let transaction = (selectAssetsPicked(state)?.filter(filterAssetWithoutTag(tag))).reduce((tx, pickedAsset) => tx.patch(pickedAsset?.asset?._id, patchOperationTagAppend({ tag })), client.transaction());
|
|
1213
|
+
return from(transaction.commit());
|
|
1214
|
+
}), mergeMap(() => of(ASSETS_ACTIONS.tagsAddComplete({
|
|
1212
1215
|
assets,
|
|
1213
1216
|
tag
|
|
1214
1217
|
}))), catchError((error) => of(ASSETS_ACTIONS.tagsAddError({
|
|
@@ -1221,10 +1224,13 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
|
|
|
1221
1224
|
}))));
|
|
1222
1225
|
})), assetsTagsRemoveEpic = (action$, state$, { client }) => action$.pipe(filter(ASSETS_ACTIONS.tagsRemoveRequest.match), withLatestFrom(state$), mergeMap(([action, state]) => {
|
|
1223
1226
|
let { assets, tag } = action.payload;
|
|
1224
|
-
return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() =>
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1227
|
+
return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() => {
|
|
1228
|
+
let transaction = selectAssetsPicked(state).reduce((tx, pickedAsset) => tx.patch(pickedAsset?.asset?._id, patchOperationTagUnset({
|
|
1229
|
+
asset: pickedAsset,
|
|
1230
|
+
tag
|
|
1231
|
+
})), client.transaction());
|
|
1232
|
+
return from(transaction.commit());
|
|
1233
|
+
}), mergeMap(() => of(ASSETS_ACTIONS.tagsRemoveComplete({
|
|
1228
1234
|
assets,
|
|
1229
1235
|
tag
|
|
1230
1236
|
}))), catchError((error) => of(ASSETS_ACTIONS.tagsRemoveError({
|
|
@@ -1237,10 +1243,13 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
|
|
|
1237
1243
|
}))));
|
|
1238
1244
|
})), assetsFolderSetEpic = (action$, state$, { client }) => action$.pipe(filter(assetsActions.folderSetRequest.match), withLatestFrom(state$), mergeMap(([action, state]) => {
|
|
1239
1245
|
let { assets, closeDialogId, folderId } = action.payload, assetIds = assets.map((asset) => asset.asset._id);
|
|
1240
|
-
return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() =>
|
|
1241
|
-
asset,
|
|
1242
|
-
|
|
1243
|
-
|
|
1246
|
+
return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() => {
|
|
1247
|
+
let transaction = assets.reduce((tx, asset) => tx.patch(asset.asset._id, patchOperationFolderSet({
|
|
1248
|
+
asset,
|
|
1249
|
+
folderId
|
|
1250
|
+
})), client.transaction());
|
|
1251
|
+
return from(transaction.commit());
|
|
1252
|
+
}), mergeMap(() => of(assetsActions.folderSetComplete({
|
|
1244
1253
|
assetIds,
|
|
1245
1254
|
closeDialogId,
|
|
1246
1255
|
folderId
|
|
@@ -1540,18 +1549,18 @@ const initialState = {
|
|
|
1540
1549
|
path: buildFolderPath(id, byId),
|
|
1541
1550
|
totalCount: 0
|
|
1542
1551
|
}));
|
|
1543
|
-
}),
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1552
|
+
}), selectFoldersIndex = createSelector([
|
|
1553
|
+
selectById,
|
|
1554
|
+
selectChildrenByParentId,
|
|
1555
|
+
selectRootIds,
|
|
1556
|
+
selectExactCountByFolderId
|
|
1557
|
+
], (byId, childrenByParentId, rootIds, exactCountByFolderId) => ({
|
|
1558
|
+
byId,
|
|
1559
|
+
childrenByParentId,
|
|
1560
|
+
rootIds,
|
|
1561
|
+
exactCountByFolderId
|
|
1562
|
+
})), selectCurrentFolderChildren = createSelector([
|
|
1563
|
+
selectFoldersIndex,
|
|
1555
1564
|
selectCurrentFolderId,
|
|
1556
1565
|
selectCurrentFolderUnfiled
|
|
1557
1566
|
], ({ byId, childrenByParentId, rootIds, exactCountByFolderId }, currentFolderId, currentFolderUnfiled) => {
|
|
@@ -1831,7 +1840,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
1831
1840
|
return urlParams.append("fit", "max"), urlParams.append("w", imgW.toString()), imgH && urlParams.append("h", imgH.toString()), `${asset.url}?${urlParams.toString()}`;
|
|
1832
1841
|
}, sanitizeFormData = (formData) => Object.keys(formData).reduce((acc, key) => {
|
|
1833
1842
|
let val = formData[key];
|
|
1834
|
-
return typeof val == "object" && val && val.constructor !== Array ?
|
|
1843
|
+
return acc[key] = typeof val == "object" && val && val.constructor !== Array ? sanitizeFormData(val) : val === "" || val === void 0 || val?.length === 0 ? null : typeof val == "string" && val ? formData[key].trim() : formData[key], acc;
|
|
1835
1844
|
}, {}), isFileAsset = (asset) => asset._type === "sanity.fileAsset", isImageAsset = (asset) => asset._type === "sanity.imageAsset";
|
|
1836
1845
|
/**
|
|
1837
1846
|
* `@hookform/resolvers/zod` resolves its own `zod` typings through dependency
|
|
@@ -2515,17 +2524,17 @@ function _temp3$10() {
|
|
|
2515
2524
|
return "No tags";
|
|
2516
2525
|
}
|
|
2517
2526
|
const FormFieldInputText = (props) => {
|
|
2518
|
-
let $ = c(
|
|
2519
|
-
$[0] === props ? (description = $[1], disabled = $[2], error = $[3], label = $[4], name = $[5],
|
|
2527
|
+
let $ = c(29), description, disabled, error, label, name, onBlur, onChange, placeholder, ref, rest, value;
|
|
2528
|
+
$[0] === props ? (description = $[1], disabled = $[2], error = $[3], label = $[4], name = $[5], onBlur = $[6], onChange = $[7], placeholder = $[8], ref = $[9], rest = $[10], value = $[11]) : ({description, disabled, error, label, name, onBlur, onChange, placeholder, value, ref, ...rest} = props, $[0] = props, $[1] = description, $[2] = disabled, $[3] = error, $[4] = label, $[5] = name, $[6] = onBlur, $[7] = onChange, $[8] = placeholder, $[9] = ref, $[10] = rest, $[11] = value);
|
|
2520
2529
|
let t0;
|
|
2521
|
-
$[
|
|
2530
|
+
$[12] !== description || $[13] !== error || $[14] !== label || $[15] !== name ? (t0 = /* @__PURE__ */ jsx(FormFieldInputLabel, {
|
|
2522
2531
|
description,
|
|
2523
2532
|
error,
|
|
2524
2533
|
label,
|
|
2525
2534
|
name
|
|
2526
|
-
}), $[
|
|
2535
|
+
}), $[12] = description, $[13] = error, $[14] = label, $[15] = name, $[16] = t0) : t0 = $[16];
|
|
2527
2536
|
let t1;
|
|
2528
|
-
$[
|
|
2537
|
+
$[17] !== disabled || $[18] !== name || $[19] !== onBlur || $[20] !== onChange || $[21] !== placeholder || $[22] !== ref || $[23] !== rest || $[24] !== value ? (t1 = /* @__PURE__ */ jsx(TextInput, {
|
|
2529
2538
|
...rest,
|
|
2530
2539
|
autoComplete: "off",
|
|
2531
2540
|
autoFocus: !0,
|
|
@@ -2533,35 +2542,39 @@ const FormFieldInputText = (props) => {
|
|
|
2533
2542
|
disabled,
|
|
2534
2543
|
id: name,
|
|
2535
2544
|
name,
|
|
2545
|
+
onBlur,
|
|
2546
|
+
onChange,
|
|
2536
2547
|
placeholder,
|
|
2537
2548
|
ref
|
|
2538
|
-
}), $[
|
|
2549
|
+
}), $[17] = disabled, $[18] = name, $[19] = onBlur, $[20] = onChange, $[21] = placeholder, $[22] = ref, $[23] = rest, $[24] = value, $[25] = t1) : t1 = $[25];
|
|
2539
2550
|
let t2;
|
|
2540
|
-
return $[
|
|
2551
|
+
return $[26] !== t0 || $[27] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Box, { children: [t0, t1] }), $[26] = t0, $[27] = t1, $[28] = t2) : t2 = $[28], t2;
|
|
2541
2552
|
}, FormFieldInputTextarea = (props) => {
|
|
2542
|
-
let $ = c(
|
|
2543
|
-
$[0] === props ? (description = $[1], disabled = $[2], error = $[3], label = $[4], name = $[5],
|
|
2553
|
+
let $ = c(31), description, disabled, error, label, name, onBlur, onChange, placeholder, ref, rest, rows, value;
|
|
2554
|
+
$[0] === props ? (description = $[1], disabled = $[2], error = $[3], label = $[4], name = $[5], onBlur = $[6], onChange = $[7], placeholder = $[8], ref = $[9], rest = $[10], rows = $[11], value = $[12]) : ({description, disabled, error, label, name, onBlur, onChange, placeholder, rows, value, ref, ...rest} = props, $[0] = props, $[1] = description, $[2] = disabled, $[3] = error, $[4] = label, $[5] = name, $[6] = onBlur, $[7] = onChange, $[8] = placeholder, $[9] = ref, $[10] = rest, $[11] = rows, $[12] = value);
|
|
2544
2555
|
let t0;
|
|
2545
|
-
$[
|
|
2556
|
+
$[13] !== description || $[14] !== error || $[15] !== label || $[16] !== name ? (t0 = /* @__PURE__ */ jsx(FormFieldInputLabel, {
|
|
2546
2557
|
description,
|
|
2547
2558
|
error,
|
|
2548
2559
|
label,
|
|
2549
2560
|
name
|
|
2550
|
-
}), $[
|
|
2561
|
+
}), $[13] = description, $[14] = error, $[15] = label, $[16] = name, $[17] = t0) : t0 = $[17];
|
|
2551
2562
|
let t1;
|
|
2552
|
-
$[
|
|
2563
|
+
$[18] !== disabled || $[19] !== name || $[20] !== onBlur || $[21] !== onChange || $[22] !== placeholder || $[23] !== ref || $[24] !== rest || $[25] !== rows || $[26] !== value ? (t1 = /* @__PURE__ */ jsx(TextArea, {
|
|
2553
2564
|
...rest,
|
|
2554
2565
|
autoComplete: "off",
|
|
2555
2566
|
defaultValue: value,
|
|
2556
2567
|
disabled,
|
|
2557
2568
|
id: name,
|
|
2558
2569
|
name,
|
|
2570
|
+
onBlur,
|
|
2571
|
+
onChange,
|
|
2559
2572
|
placeholder,
|
|
2560
2573
|
ref,
|
|
2561
2574
|
rows
|
|
2562
|
-
}), $[
|
|
2575
|
+
}), $[18] = disabled, $[19] = name, $[20] = onBlur, $[21] = onChange, $[22] = placeholder, $[23] = ref, $[24] = rest, $[25] = rows, $[26] = value, $[27] = t1) : t1 = $[27];
|
|
2563
2576
|
let t2;
|
|
2564
|
-
return $[
|
|
2577
|
+
return $[28] !== t0 || $[29] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Box, { children: [t0, t1] }), $[28] = t0, $[29] = t1, $[30] = t2) : t2 = $[30], t2;
|
|
2565
2578
|
};
|
|
2566
2579
|
function toStringField(value) {
|
|
2567
2580
|
if (typeof value == "string") return value;
|
|
@@ -2575,201 +2588,180 @@ function truncateFolderPath(path) {
|
|
|
2575
2588
|
...segments.slice(-2)
|
|
2576
2589
|
].join("/");
|
|
2577
2590
|
}
|
|
2578
|
-
function Details(
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
$[13] !== folderLabel || $[14] !== t7 ? (t8 = /* @__PURE__ */ jsxs(Flex, {
|
|
2607
|
-
align: "center",
|
|
2608
|
-
gap: 2,
|
|
2609
|
-
flex: 1,
|
|
2610
|
-
style: t5,
|
|
2611
|
-
children: [t6, /* @__PURE__ */ jsx(Text, {
|
|
2612
|
-
muted: t7,
|
|
2613
|
-
size: 1,
|
|
2614
|
-
children: folderLabel
|
|
2615
|
-
})]
|
|
2616
|
-
}), $[13] = folderLabel, $[14] = t7, $[15] = t8) : t8 = $[15];
|
|
2617
|
-
let t9;
|
|
2618
|
-
$[16] !== folderId || $[17] !== formUpdating || $[18] !== onRemoveFolder ? (t9 = folderId && /* @__PURE__ */ jsx(Button, {
|
|
2619
|
-
"aria-label": "Remove from folder",
|
|
2620
|
-
disabled: formUpdating,
|
|
2621
|
-
fontSize: 1,
|
|
2622
|
-
icon: TrashIcon,
|
|
2623
|
-
mode: "bleed",
|
|
2624
|
-
onClick: onRemoveFolder,
|
|
2625
|
-
padding: 2,
|
|
2626
|
-
tone: "critical",
|
|
2627
|
-
type: "button"
|
|
2628
|
-
}), $[16] = folderId, $[17] = formUpdating, $[18] = onRemoveFolder, $[19] = t9) : t9 = $[19];
|
|
2629
|
-
let t10 = folderId ? "Change folder" : "Add to folder", t11;
|
|
2630
|
-
$[20] !== formUpdating || $[21] !== onChangeFolder || $[22] !== t10 ? (t11 = /* @__PURE__ */ jsx(Button, {
|
|
2631
|
-
padding: 2,
|
|
2632
|
-
disabled: formUpdating,
|
|
2633
|
-
fontSize: 1,
|
|
2634
|
-
mode: "ghost",
|
|
2635
|
-
onClick: onChangeFolder,
|
|
2636
|
-
text: t10,
|
|
2637
|
-
type: "button"
|
|
2638
|
-
}), $[20] = formUpdating, $[21] = onChangeFolder, $[22] = t10, $[23] = t11) : t11 = $[23];
|
|
2639
|
-
let t12;
|
|
2640
|
-
$[24] !== t11 || $[25] !== t8 || $[26] !== t9 ? (t12 = /* @__PURE__ */ jsxs(Box, { children: [t4, /* @__PURE__ */ jsx(Card, {
|
|
2641
|
-
border: !0,
|
|
2642
|
-
padding: 2,
|
|
2643
|
-
radius: 2,
|
|
2644
|
-
children: /* @__PURE__ */ jsxs(Flex, {
|
|
2645
|
-
align: "center",
|
|
2646
|
-
gap: 3,
|
|
2647
|
-
justify: "space-between",
|
|
2648
|
-
children: [
|
|
2649
|
-
t8,
|
|
2650
|
-
t9,
|
|
2651
|
-
t11
|
|
2652
|
-
]
|
|
2653
|
-
})
|
|
2654
|
-
})] }), $[24] = t11, $[25] = t8, $[26] = t9, $[27] = t12) : t12 = $[27];
|
|
2655
|
-
let t13;
|
|
2656
|
-
$[28] === register ? t13 = $[29] : (t13 = register("originalFilename"), $[28] = register, $[29] = t13);
|
|
2657
|
-
let t14 = errors?.originalFilename?.message, t15 = currentAsset?.originalFilename, t16;
|
|
2658
|
-
$[30] !== formUpdating || $[31] !== t13 || $[32] !== t14 || $[33] !== t15 ? (t16 = /* @__PURE__ */ jsx(FormFieldInputText, {
|
|
2659
|
-
...t13,
|
|
2660
|
-
disabled: formUpdating,
|
|
2661
|
-
error: t14,
|
|
2662
|
-
label: "Filename",
|
|
2663
|
-
name: "originalFilename",
|
|
2664
|
-
value: t15
|
|
2665
|
-
}), $[30] = formUpdating, $[31] = t13, $[32] = t14, $[33] = t15, $[34] = t16) : t16 = $[34];
|
|
2666
|
-
let t17;
|
|
2667
|
-
$[35] !== activeLocaleTab || $[36] !== creditLine?.enabled || $[37] !== creditLine?.excludeSources || $[38] !== currentAsset?.altText || $[39] !== currentAsset?.creditLine || $[40] !== currentAsset?.source?.name || $[41] !== currentAsset?.title || $[42] !== errors?.altText || $[43] !== errors?.creditLine || $[44] !== errors?.description || $[45] !== errors?.title || $[46] !== formUpdating || $[47] !== hasLocales || $[48] !== locales || $[49] !== register ? (t17 = hasLocales ? /* @__PURE__ */ jsx(Card, {
|
|
2668
|
-
marginTop: 2,
|
|
2669
|
-
shadow: 1,
|
|
2670
|
-
padding: 3,
|
|
2671
|
-
radius: 1,
|
|
2672
|
-
children: /* @__PURE__ */ jsxs(Stack, {
|
|
2673
|
-
space: 2,
|
|
2674
|
-
children: [/* @__PURE__ */ jsx(TabList, {
|
|
2675
|
-
space: 2,
|
|
2676
|
-
children: locales.map((locale, idx) => /* @__PURE__ */ jsx(Tab, {
|
|
2677
|
-
id: `locale-tab-${locale.id}`,
|
|
2678
|
-
"aria-controls": `locale-panel-${locale.id}`,
|
|
2679
|
-
selected: activeLocaleTab === idx,
|
|
2680
|
-
onClick: () => setActiveLocaleTab(idx),
|
|
2681
|
-
label: locale.title
|
|
2682
|
-
}, locale.id))
|
|
2683
|
-
}), locales.map((locale_0, idx_0) => /* @__PURE__ */ jsx(TabPanel, {
|
|
2684
|
-
id: `locale-panel-${locale_0.id}`,
|
|
2685
|
-
"aria-labelledby": `locale-tab-${locale_0.id}`,
|
|
2686
|
-
hidden: activeLocaleTab !== idx_0,
|
|
2687
|
-
children: /* @__PURE__ */ jsxs(Stack, {
|
|
2688
|
-
space: 3,
|
|
2591
|
+
function Details({ formUpdating, handleCreateTag, control, errors, register, allTagOptions, assetTagOptions, currentAsset, folderPath, folderMissing, onChangeFolder, onRemoveFolder, creditLine, locales }) {
|
|
2592
|
+
"use no memo";
|
|
2593
|
+
let hasLocales = locales && locales.length > 0, [activeLocaleTab, setActiveLocaleTab] = useState(0), folderId = currentAsset?.opt?.media?.folder?._ref, folderLabel = truncateFolderPath(folderPath) || (folderMissing ? "Folder no longer exists" : "No folder");
|
|
2594
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
2595
|
+
space: 3,
|
|
2596
|
+
children: [
|
|
2597
|
+
/* @__PURE__ */ jsx(FormFieldInputTags, {
|
|
2598
|
+
control,
|
|
2599
|
+
disabled: formUpdating,
|
|
2600
|
+
error: errors?.opt?.media?.tags?.message,
|
|
2601
|
+
label: "Tags",
|
|
2602
|
+
name: "opt.media.tags",
|
|
2603
|
+
onCreateTag: handleCreateTag,
|
|
2604
|
+
options: allTagOptions,
|
|
2605
|
+
placeholder: "Select or create...",
|
|
2606
|
+
value: assetTagOptions
|
|
2607
|
+
}),
|
|
2608
|
+
/* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(FormFieldInputLabel, {
|
|
2609
|
+
label: "Folder",
|
|
2610
|
+
name: "folder"
|
|
2611
|
+
}), /* @__PURE__ */ jsx(Card, {
|
|
2612
|
+
border: !0,
|
|
2613
|
+
padding: 2,
|
|
2614
|
+
radius: 2,
|
|
2615
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
2616
|
+
align: "center",
|
|
2617
|
+
gap: 3,
|
|
2618
|
+
justify: "space-between",
|
|
2689
2619
|
children: [
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2620
|
+
/* @__PURE__ */ jsxs(Flex, {
|
|
2621
|
+
align: "center",
|
|
2622
|
+
gap: 2,
|
|
2623
|
+
flex: 1,
|
|
2624
|
+
style: {
|
|
2625
|
+
minWidth: 0,
|
|
2626
|
+
overflowX: "auto",
|
|
2627
|
+
whiteSpace: "nowrap",
|
|
2628
|
+
overflowY: "hidden"
|
|
2629
|
+
},
|
|
2630
|
+
children: [/* @__PURE__ */ jsx(FolderIcon, {}), /* @__PURE__ */ jsx(Text, {
|
|
2631
|
+
muted: !folderId,
|
|
2632
|
+
size: 1,
|
|
2633
|
+
children: folderLabel
|
|
2634
|
+
})]
|
|
2696
2635
|
}),
|
|
2697
|
-
/* @__PURE__ */ jsx(
|
|
2698
|
-
|
|
2636
|
+
folderId && /* @__PURE__ */ jsx(Button, {
|
|
2637
|
+
"aria-label": "Remove from folder",
|
|
2699
2638
|
disabled: formUpdating,
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2639
|
+
fontSize: 1,
|
|
2640
|
+
icon: TrashIcon,
|
|
2641
|
+
mode: "bleed",
|
|
2642
|
+
onClick: onRemoveFolder,
|
|
2643
|
+
padding: 2,
|
|
2644
|
+
tone: "critical",
|
|
2645
|
+
type: "button"
|
|
2703
2646
|
}),
|
|
2704
|
-
/* @__PURE__ */ jsx(
|
|
2705
|
-
|
|
2647
|
+
/* @__PURE__ */ jsx(Button, {
|
|
2648
|
+
padding: 2,
|
|
2706
2649
|
disabled: formUpdating,
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
creditLine?.enabled && /* @__PURE__ */ jsx(FormFieldInputText, {
|
|
2713
|
-
...register(`creditLine.${locale_0.id}`),
|
|
2714
|
-
error: (errors?.creditLine)?.[locale_0.id]?.message,
|
|
2715
|
-
label: "Credit",
|
|
2716
|
-
name: `creditLine.${locale_0.id}`,
|
|
2717
|
-
disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
|
|
2650
|
+
fontSize: 1,
|
|
2651
|
+
mode: "ghost",
|
|
2652
|
+
onClick: onChangeFolder,
|
|
2653
|
+
text: folderId ? "Change folder" : "Add to folder",
|
|
2654
|
+
type: "button"
|
|
2718
2655
|
})
|
|
2719
2656
|
]
|
|
2720
2657
|
})
|
|
2721
|
-
}
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2658
|
+
})] }),
|
|
2659
|
+
/* @__PURE__ */ jsx(FormFieldInputText, {
|
|
2660
|
+
...register("originalFilename"),
|
|
2661
|
+
disabled: formUpdating,
|
|
2662
|
+
error: errors?.originalFilename?.message,
|
|
2663
|
+
label: "Filename",
|
|
2664
|
+
name: "originalFilename",
|
|
2665
|
+
value: currentAsset?.originalFilename
|
|
2666
|
+
}),
|
|
2667
|
+
hasLocales ? /* @__PURE__ */ jsx(Card, {
|
|
2668
|
+
marginTop: 2,
|
|
2669
|
+
shadow: 1,
|
|
2670
|
+
padding: 3,
|
|
2671
|
+
radius: 1,
|
|
2672
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
2673
|
+
space: 2,
|
|
2674
|
+
children: [/* @__PURE__ */ jsx(TabList, {
|
|
2675
|
+
space: 2,
|
|
2676
|
+
children: locales.map((locale, idx) => /* @__PURE__ */ jsx(Tab, {
|
|
2677
|
+
id: `locale-tab-${locale.id}`,
|
|
2678
|
+
"aria-controls": `locale-panel-${locale.id}`,
|
|
2679
|
+
selected: activeLocaleTab === idx,
|
|
2680
|
+
onClick: () => setActiveLocaleTab(idx),
|
|
2681
|
+
label: locale.title
|
|
2682
|
+
}, locale.id))
|
|
2683
|
+
}), locales.map((locale_0, idx_0) => /* @__PURE__ */ jsx(TabPanel, {
|
|
2684
|
+
id: `locale-panel-${locale_0.id}`,
|
|
2685
|
+
"aria-labelledby": `locale-tab-${locale_0.id}`,
|
|
2686
|
+
hidden: activeLocaleTab !== idx_0,
|
|
2687
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
2688
|
+
space: 3,
|
|
2689
|
+
children: [
|
|
2690
|
+
/* @__PURE__ */ jsx(FormFieldInputText, {
|
|
2691
|
+
...register(`title.${locale_0.id}`),
|
|
2692
|
+
disabled: formUpdating,
|
|
2693
|
+
error: (errors?.title)?.[locale_0.id]?.message,
|
|
2694
|
+
label: "Title",
|
|
2695
|
+
name: `title.${locale_0.id}`
|
|
2696
|
+
}),
|
|
2697
|
+
/* @__PURE__ */ jsx(FormFieldInputText, {
|
|
2698
|
+
...register(`altText.${locale_0.id}`),
|
|
2699
|
+
disabled: formUpdating,
|
|
2700
|
+
error: (errors?.altText)?.[locale_0.id]?.message,
|
|
2701
|
+
label: "Alt Text",
|
|
2702
|
+
name: `altText.${locale_0.id}`
|
|
2703
|
+
}),
|
|
2704
|
+
/* @__PURE__ */ jsx(FormFieldInputTextarea, {
|
|
2705
|
+
...register(`description.${locale_0.id}`),
|
|
2706
|
+
disabled: formUpdating,
|
|
2707
|
+
error: (errors?.description)?.[locale_0.id]?.message,
|
|
2708
|
+
label: "Description",
|
|
2709
|
+
name: `description.${locale_0.id}`,
|
|
2710
|
+
rows: 5
|
|
2711
|
+
}),
|
|
2712
|
+
creditLine?.enabled && /* @__PURE__ */ jsx(FormFieldInputText, {
|
|
2713
|
+
...register(`creditLine.${locale_0.id}`),
|
|
2714
|
+
error: (errors?.creditLine)?.[locale_0.id]?.message,
|
|
2715
|
+
label: "Credit",
|
|
2716
|
+
name: `creditLine.${locale_0.id}`,
|
|
2717
|
+
disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
|
|
2718
|
+
})
|
|
2719
|
+
]
|
|
2720
|
+
})
|
|
2721
|
+
}, locale_0.id))]
|
|
2722
|
+
})
|
|
2723
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2724
|
+
/* @__PURE__ */ jsx(FormFieldInputText, {
|
|
2725
|
+
...register("title"),
|
|
2726
|
+
disabled: formUpdating,
|
|
2727
|
+
error: errors?.title?.message,
|
|
2728
|
+
label: "Title",
|
|
2729
|
+
name: "title",
|
|
2730
|
+
value: toStringField(currentAsset?.title)
|
|
2731
|
+
}),
|
|
2732
|
+
/* @__PURE__ */ jsx(FormFieldInputText, {
|
|
2733
|
+
...register("altText"),
|
|
2734
|
+
disabled: formUpdating,
|
|
2735
|
+
error: errors?.altText?.message,
|
|
2736
|
+
label: "Alt Text",
|
|
2737
|
+
name: "altText",
|
|
2738
|
+
value: toStringField(currentAsset?.altText)
|
|
2739
|
+
}),
|
|
2740
|
+
/* @__PURE__ */ jsx(FormFieldInputTextarea, {
|
|
2741
|
+
...register("description"),
|
|
2742
|
+
disabled: formUpdating,
|
|
2743
|
+
error: errors?.description?.message,
|
|
2744
|
+
label: "Description",
|
|
2745
|
+
name: "description",
|
|
2746
|
+
rows: 5
|
|
2747
|
+
}),
|
|
2748
|
+
creditLine?.enabled && /* @__PURE__ */ jsx(FormFieldInputText, {
|
|
2749
|
+
...register("creditLine"),
|
|
2750
|
+
error: errors?.creditLine?.message,
|
|
2751
|
+
label: "Credit",
|
|
2752
|
+
name: "creditLine",
|
|
2753
|
+
value: toStringField(currentAsset?.creditLine),
|
|
2754
|
+
disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
|
|
2755
|
+
})
|
|
2756
|
+
] })
|
|
2765
2757
|
]
|
|
2766
|
-
})
|
|
2758
|
+
});
|
|
2767
2759
|
}
|
|
2768
2760
|
function renderDefaultDetails(props) {
|
|
2769
2761
|
return /* @__PURE__ */ jsx(Details, { ...props });
|
|
2770
2762
|
}
|
|
2771
2763
|
const DialogAssetEdit = (props) => {
|
|
2772
|
-
let $ = c(
|
|
2764
|
+
let $ = c(149), { children, dialog: t0 } = props, { assetId, id, lastCreatedTag, lastRemovedTagIds } = t0, client = useVersionedClient(), scheme = useColorSchemeValue(), documentStore = useDocumentStore(), dispatch = useDispatch(), t1;
|
|
2773
2765
|
$[0] === assetId ? t1 = $[1] : (t1 = (state) => selectAssetById(state, String(assetId)), $[0] = assetId, $[1] = t1);
|
|
2774
2766
|
let assetItem = useTypedSelector(t1), tags = useTypedSelector(selectTags), assetUpdatedPrev = useRef(void 0), [assetSnapshot, setAssetSnapshot] = useState(assetItem?.asset), [tabSection, setTabSection] = useState("details"), currentAsset = assetItem ? assetItem?.asset : assetSnapshot, t2;
|
|
2775
2767
|
$[2] === tags ? t2 = $[3] : (t2 = getTagSelectOptions(tags), $[2] = tags, $[3] = t2);
|
|
@@ -2824,45 +2816,47 @@ const DialogAssetEdit = (props) => {
|
|
|
2824
2816
|
mode: "onChange",
|
|
2825
2817
|
resolver: t10
|
|
2826
2818
|
}, $[18] = t10, $[19] = t9, $[20] = t11) : t11 = $[20];
|
|
2827
|
-
let { control,
|
|
2828
|
-
$[21]
|
|
2819
|
+
let { control, getValues, handleSubmit, register, reset, setValue } = useForm(t11), t12;
|
|
2820
|
+
$[21] === control ? t12 = $[22] : (t12 = { control }, $[21] = control, $[22] = t12);
|
|
2821
|
+
let { errors, isDirty, isValid } = useFormState(t12), formUpdating = !assetItem || assetItem?.updating, t13;
|
|
2822
|
+
$[23] !== dispatch || $[24] !== id ? (t13 = () => {
|
|
2829
2823
|
dispatch(dialogActions.remove({ id }));
|
|
2830
|
-
}, $[
|
|
2824
|
+
}, $[23] = dispatch, $[24] = id, $[25] = t13) : t13 = $[25];
|
|
2831
2825
|
let handleClose = t13, t14;
|
|
2832
|
-
$[
|
|
2826
|
+
$[26] !== assetItem || $[27] !== dispatch ? (t14 = () => {
|
|
2833
2827
|
assetItem?.asset && dispatch(dialogActions.showConfirmDeleteAssets({
|
|
2834
2828
|
assets: [assetItem],
|
|
2835
2829
|
closeDialogId: assetItem?.asset._id
|
|
2836
2830
|
}));
|
|
2837
|
-
}, $[
|
|
2831
|
+
}, $[26] = assetItem, $[27] = dispatch, $[28] = t14) : t14 = $[28];
|
|
2838
2832
|
let handleDelete = t14, t15;
|
|
2839
|
-
$[
|
|
2833
|
+
$[29] === Symbol.for("react.memo_cache_sentinel") ? (t15 = (update) => {
|
|
2840
2834
|
let { result, transition } = update;
|
|
2841
2835
|
result && transition === "update" && setAssetSnapshot(result);
|
|
2842
|
-
}, $[
|
|
2836
|
+
}, $[29] = t15) : t15 = $[29];
|
|
2843
2837
|
let handleAssetUpdate = t15, t16;
|
|
2844
|
-
$[
|
|
2838
|
+
$[30] !== currentAsset?._id || $[31] !== dispatch ? (t16 = (tagName) => {
|
|
2845
2839
|
dispatch(tagsActions.createRequest({
|
|
2846
2840
|
assetId: currentAsset?._id,
|
|
2847
2841
|
name: tagName
|
|
2848
2842
|
}));
|
|
2849
|
-
}, $[
|
|
2843
|
+
}, $[30] = currentAsset?._id, $[31] = dispatch, $[32] = t16) : t16 = $[32], currentAsset?._id;
|
|
2850
2844
|
let handleCreateTag = t16, t17;
|
|
2851
|
-
$[
|
|
2845
|
+
$[33] !== assetItem || $[34] !== currentFolderId || $[35] !== dispatch ? (t17 = () => {
|
|
2852
2846
|
assetItem && dispatch(DIALOG_ACTIONS.showFolderMove({
|
|
2853
2847
|
assets: [assetItem],
|
|
2854
2848
|
folderId: currentFolderId
|
|
2855
2849
|
}));
|
|
2856
|
-
}, $[
|
|
2850
|
+
}, $[33] = assetItem, $[34] = currentFolderId, $[35] = dispatch, $[36] = t17) : t17 = $[36];
|
|
2857
2851
|
let handleChangeFolder = t17, t18;
|
|
2858
|
-
$[
|
|
2852
|
+
$[37] !== assetItem || $[38] !== currentFolderId || $[39] !== dispatch ? (t18 = () => {
|
|
2859
2853
|
!assetItem || !currentFolderId || dispatch(assetsActions.folderSetRequest({
|
|
2860
2854
|
assets: [assetItem],
|
|
2861
2855
|
folderId: null
|
|
2862
2856
|
}));
|
|
2863
|
-
}, $[
|
|
2857
|
+
}, $[37] = assetItem, $[38] = currentFolderId, $[39] = dispatch, $[40] = t18) : t18 = $[40];
|
|
2864
2858
|
let handleRemoveFolder = t18, t19;
|
|
2865
|
-
if ($[
|
|
2859
|
+
if ($[41] !== currentAsset || $[42] !== locales) {
|
|
2866
2860
|
bb0: {
|
|
2867
2861
|
if (!currentAsset) {
|
|
2868
2862
|
t19 = !1;
|
|
@@ -2885,10 +2879,10 @@ const DialogAssetEdit = (props) => {
|
|
|
2885
2879
|
let configuredIds = new Set(locales.map(_temp4$5));
|
|
2886
2880
|
t19 = fields.some((f_0) => isLocaleObj(f_0) ? Object.keys(f_0).some((k) => !configuredIds.has(k)) : !1);
|
|
2887
2881
|
}
|
|
2888
|
-
$[
|
|
2889
|
-
} else t19 = $[
|
|
2882
|
+
$[41] = currentAsset, $[42] = locales, $[43] = t19;
|
|
2883
|
+
} else t19 = $[43];
|
|
2890
2884
|
let hasOrphanedLocales = t19, t20;
|
|
2891
|
-
$[
|
|
2885
|
+
$[44] !== client || $[45] !== currentAsset || $[46] !== locales ? (t20 = async () => {
|
|
2892
2886
|
if (!currentAsset) return;
|
|
2893
2887
|
let cleanField = (field_1) => {
|
|
2894
2888
|
if (typeof field_1 != "object" || !field_1 || Array.isArray(field_1)) return field_1;
|
|
@@ -2904,9 +2898,9 @@ const DialogAssetEdit = (props) => {
|
|
|
2904
2898
|
description: cleanField(currentAsset.description),
|
|
2905
2899
|
...currentAsset._type === "sanity.imageAsset" && { creditLine: cleanField(currentAsset.creditLine) }
|
|
2906
2900
|
}).commit();
|
|
2907
|
-
}, $[
|
|
2901
|
+
}, $[44] = client, $[45] = currentAsset, $[46] = locales, $[47] = t20) : t20 = $[47];
|
|
2908
2902
|
let handleCleanupLocales = t20, t21;
|
|
2909
|
-
$[
|
|
2903
|
+
$[48] !== assetItem?.asset || $[49] !== dispatch ? (t21 = (formData) => {
|
|
2910
2904
|
if (!assetItem?.asset) return;
|
|
2911
2905
|
let sanitizedFormData = sanitizeFormData(formData);
|
|
2912
2906
|
formData.description === "" && (sanitizedFormData.description = ""), dispatch(assetsActions.updateRequest({
|
|
@@ -2920,23 +2914,23 @@ const DialogAssetEdit = (props) => {
|
|
|
2920
2914
|
} }
|
|
2921
2915
|
}
|
|
2922
2916
|
}));
|
|
2923
|
-
}, $[
|
|
2917
|
+
}, $[48] = assetItem?.asset, $[49] = dispatch, $[50] = t21) : t21 = $[50], assetItem?.asset;
|
|
2924
2918
|
let onSubmit = t21, t22;
|
|
2925
|
-
$[
|
|
2919
|
+
$[51] !== assetItem?.asset || $[52] !== client ? (t22 = () => {
|
|
2926
2920
|
if (!assetItem?.asset) return;
|
|
2927
2921
|
let subscriptionAsset = client.listen(groq`*[_id == $id]`, { id: assetItem?.asset._id }).subscribe(handleAssetUpdate);
|
|
2928
2922
|
return () => {
|
|
2929
2923
|
subscriptionAsset?.unsubscribe();
|
|
2930
2924
|
};
|
|
2931
|
-
}, $[
|
|
2925
|
+
}, $[51] = assetItem?.asset, $[52] = client, $[53] = t22) : t22 = $[53];
|
|
2932
2926
|
let t23 = assetItem?.asset, t24;
|
|
2933
|
-
$[
|
|
2927
|
+
$[54] !== client || $[55] !== t23 ? (t24 = [
|
|
2934
2928
|
t23,
|
|
2935
2929
|
client,
|
|
2936
2930
|
handleAssetUpdate
|
|
2937
|
-
], $[
|
|
2931
|
+
], $[54] = client, $[55] = t23, $[56] = t24) : t24 = $[56], useEffect(t22, t24);
|
|
2938
2932
|
let t25, t26;
|
|
2939
|
-
$[
|
|
2933
|
+
$[57] !== getValues || $[58] !== lastCreatedTag || $[59] !== setValue ? (t25 = () => {
|
|
2940
2934
|
if (lastCreatedTag) {
|
|
2941
2935
|
let updatedTags = (getValues("opt.media.tags") || []).concat([lastCreatedTag]);
|
|
2942
2936
|
setValue("opt.media.tags", updatedTags, { shouldDirty: !0 });
|
|
@@ -2945,9 +2939,9 @@ const DialogAssetEdit = (props) => {
|
|
|
2945
2939
|
getValues,
|
|
2946
2940
|
lastCreatedTag,
|
|
2947
2941
|
setValue
|
|
2948
|
-
], $[
|
|
2942
|
+
], $[57] = getValues, $[58] = lastCreatedTag, $[59] = setValue, $[60] = t25, $[61] = t26) : (t25 = $[60], t26 = $[61]), useEffect(t25, t26);
|
|
2949
2943
|
let t27, t28;
|
|
2950
|
-
$[
|
|
2944
|
+
$[62] !== getValues || $[63] !== lastRemovedTagIds || $[64] !== setValue ? (t27 = () => {
|
|
2951
2945
|
if (lastRemovedTagIds) {
|
|
2952
2946
|
let updatedTags_0 = (getValues("opt.media.tags") || []).filter((tag_0) => !lastRemovedTagIds.includes(tag_0.value));
|
|
2953
2947
|
setValue("opt.media.tags", updatedTags_0, { shouldDirty: !0 });
|
|
@@ -2956,64 +2950,74 @@ const DialogAssetEdit = (props) => {
|
|
|
2956
2950
|
getValues,
|
|
2957
2951
|
lastRemovedTagIds,
|
|
2958
2952
|
setValue
|
|
2959
|
-
], $[
|
|
2953
|
+
], $[62] = getValues, $[63] = lastRemovedTagIds, $[64] = setValue, $[65] = t27, $[66] = t28) : (t27 = $[65], t28 = $[66]), useEffect(t27, t28);
|
|
2960
2954
|
let t29;
|
|
2961
|
-
$[
|
|
2955
|
+
$[67] !== assetItem?.asset || $[68] !== generateDefaultValues || $[69] !== reset ? (t29 = () => {
|
|
2962
2956
|
assetUpdatedPrev.current !== assetItem?.asset._updatedAt && reset(generateDefaultValues(assetItem?.asset)), assetUpdatedPrev.current = assetItem?.asset._updatedAt;
|
|
2963
|
-
}, $[
|
|
2957
|
+
}, $[67] = assetItem?.asset, $[68] = generateDefaultValues, $[69] = reset, $[70] = t29) : t29 = $[70];
|
|
2964
2958
|
let t30 = assetItem?.asset, t31;
|
|
2965
|
-
$[
|
|
2959
|
+
$[71] !== generateDefaultValues || $[72] !== reset || $[73] !== t30 ? (t31 = [
|
|
2966
2960
|
t30,
|
|
2967
2961
|
generateDefaultValues,
|
|
2968
2962
|
reset
|
|
2969
|
-
], $[
|
|
2963
|
+
], $[71] = generateDefaultValues, $[72] = reset, $[73] = t30, $[74] = t31) : t31 = $[74], useEffect(t29, t31);
|
|
2970
2964
|
let t32;
|
|
2971
|
-
$[
|
|
2965
|
+
$[75] !== handleCleanupLocales || $[76] !== hasOrphanedLocales ? (t32 = hasOrphanedLocales && /* @__PURE__ */ jsx(Card, {
|
|
2966
|
+
padding: 3,
|
|
2967
|
+
radius: 2,
|
|
2968
|
+
shadow: 1,
|
|
2969
|
+
tone: "caution",
|
|
2970
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
2971
|
+
align: "center",
|
|
2972
|
+
justify: "space-between",
|
|
2973
|
+
gap: 3,
|
|
2974
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
2975
|
+
size: 1,
|
|
2976
|
+
children: "This asset has localized fields that are no longer configured. Clean them up to avoid validation errors."
|
|
2977
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
2978
|
+
fontSize: 1,
|
|
2979
|
+
mode: "ghost",
|
|
2980
|
+
onClick: handleCleanupLocales,
|
|
2981
|
+
text: "Cleanup localized fields",
|
|
2982
|
+
tone: "caution"
|
|
2983
|
+
})]
|
|
2984
|
+
})
|
|
2985
|
+
}), $[75] = handleCleanupLocales, $[76] = hasOrphanedLocales, $[77] = t32) : t32 = $[77];
|
|
2986
|
+
let t33;
|
|
2987
|
+
$[78] !== formUpdating || $[79] !== handleDelete ? (t33 = /* @__PURE__ */ jsx(Button, {
|
|
2988
|
+
disabled: formUpdating,
|
|
2989
|
+
fontSize: 1,
|
|
2990
|
+
mode: "bleed",
|
|
2991
|
+
onClick: handleDelete,
|
|
2992
|
+
text: "Delete",
|
|
2993
|
+
tone: "critical"
|
|
2994
|
+
}), $[78] = formUpdating, $[79] = handleDelete, $[80] = t33) : t33 = $[80];
|
|
2995
|
+
let t34 = formUpdating || !isDirty || !isValid || hasOrphanedLocales, t35 = currentAsset?._updatedAt, t36;
|
|
2996
|
+
$[81] !== handleSubmit || $[82] !== onSubmit ? (t36 = handleSubmit(onSubmit), $[81] = handleSubmit, $[82] = onSubmit, $[83] = t36) : t36 = $[83];
|
|
2997
|
+
let t37;
|
|
2998
|
+
$[84] !== isValid || $[85] !== t34 || $[86] !== t35 || $[87] !== t36 ? (t37 = /* @__PURE__ */ jsx(FormSubmitButton, {
|
|
2999
|
+
disabled: t34,
|
|
3000
|
+
isValid,
|
|
3001
|
+
lastUpdated: t35,
|
|
3002
|
+
onClick: t36
|
|
3003
|
+
}), $[84] = isValid, $[85] = t34, $[86] = t35, $[87] = t36, $[88] = t37) : t37 = $[88];
|
|
3004
|
+
let t38;
|
|
3005
|
+
$[89] !== t33 || $[90] !== t37 ? (t38 = /* @__PURE__ */ jsxs(Flex, {
|
|
3006
|
+
justify: "space-between",
|
|
3007
|
+
children: [t33, t37]
|
|
3008
|
+
}), $[89] = t33, $[90] = t37, $[91] = t38) : t38 = $[91];
|
|
3009
|
+
let t39;
|
|
3010
|
+
$[92] !== t32 || $[93] !== t38 ? (t39 = /* @__PURE__ */ jsx(Box, {
|
|
2972
3011
|
padding: 3,
|
|
2973
3012
|
children: /* @__PURE__ */ jsxs(Stack, {
|
|
2974
3013
|
space: 3,
|
|
2975
|
-
children: [
|
|
2976
|
-
padding: 3,
|
|
2977
|
-
radius: 2,
|
|
2978
|
-
shadow: 1,
|
|
2979
|
-
tone: "caution",
|
|
2980
|
-
children: /* @__PURE__ */ jsxs(Flex, {
|
|
2981
|
-
align: "center",
|
|
2982
|
-
justify: "space-between",
|
|
2983
|
-
gap: 3,
|
|
2984
|
-
children: [/* @__PURE__ */ jsx(Text, {
|
|
2985
|
-
size: 1,
|
|
2986
|
-
children: "This asset has localized fields that are no longer configured. Clean them up to avoid validation errors."
|
|
2987
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
2988
|
-
fontSize: 1,
|
|
2989
|
-
mode: "ghost",
|
|
2990
|
-
onClick: handleCleanupLocales,
|
|
2991
|
-
text: "Cleanup localized fields",
|
|
2992
|
-
tone: "caution"
|
|
2993
|
-
})]
|
|
2994
|
-
})
|
|
2995
|
-
}), /* @__PURE__ */ jsxs(Flex, {
|
|
2996
|
-
justify: "space-between",
|
|
2997
|
-
children: [/* @__PURE__ */ jsx(Button, {
|
|
2998
|
-
disabled: formUpdating,
|
|
2999
|
-
fontSize: 1,
|
|
3000
|
-
mode: "bleed",
|
|
3001
|
-
onClick: handleDelete,
|
|
3002
|
-
text: "Delete",
|
|
3003
|
-
tone: "critical"
|
|
3004
|
-
}), /* @__PURE__ */ jsx(FormSubmitButton, {
|
|
3005
|
-
disabled: formUpdating || !isDirty || !isValid || hasOrphanedLocales,
|
|
3006
|
-
isValid,
|
|
3007
|
-
lastUpdated: currentAsset?._updatedAt,
|
|
3008
|
-
onClick: handleSubmit(onSubmit)
|
|
3009
|
-
})]
|
|
3010
|
-
})]
|
|
3014
|
+
children: [t32, t38]
|
|
3011
3015
|
})
|
|
3012
|
-
}), $[
|
|
3013
|
-
let
|
|
3016
|
+
}), $[92] = t32, $[93] = t38, $[94] = t39) : t39 = $[94];
|
|
3017
|
+
let footer = t39;
|
|
3014
3018
|
if (!currentAsset) return null;
|
|
3015
|
-
let
|
|
3016
|
-
$[
|
|
3019
|
+
let t40 = !!currentFolderId && !currentFolderPath, t41;
|
|
3020
|
+
$[95] !== allTagOptions || $[96] !== assetTagOptions || $[97] !== control || $[98] !== creditLine || $[99] !== currentAsset || $[100] !== currentFolderPath || $[101] !== errors || $[102] !== formUpdating || $[103] !== handleChangeFolder || $[104] !== handleCreateTag || $[105] !== handleRemoveFolder || $[106] !== locales || $[107] !== register || $[108] !== setValue || $[109] !== t40 ? (t41 = {
|
|
3017
3021
|
control,
|
|
3018
3022
|
errors,
|
|
3019
3023
|
formUpdating,
|
|
@@ -3024,29 +3028,27 @@ const DialogAssetEdit = (props) => {
|
|
|
3024
3028
|
handleCreateTag,
|
|
3025
3029
|
currentAsset,
|
|
3026
3030
|
folderPath: currentFolderPath,
|
|
3027
|
-
folderMissing:
|
|
3031
|
+
folderMissing: t40,
|
|
3028
3032
|
onChangeFolder: handleChangeFolder,
|
|
3029
3033
|
onRemoveFolder: handleRemoveFolder,
|
|
3030
3034
|
creditLine,
|
|
3031
3035
|
locales
|
|
3032
|
-
}, $[
|
|
3033
|
-
let detailsProps =
|
|
3034
|
-
$[
|
|
3035
|
-
let t36;
|
|
3036
|
-
$[101] === Symbol.for("react.memo_cache_sentinel") ? (t36 = [
|
|
3036
|
+
}, $[95] = allTagOptions, $[96] = assetTagOptions, $[97] = control, $[98] = creditLine, $[99] = currentAsset, $[100] = currentFolderPath, $[101] = errors, $[102] = formUpdating, $[103] = handleChangeFolder, $[104] = handleCreateTag, $[105] = handleRemoveFolder, $[106] = locales, $[107] = register, $[108] = setValue, $[109] = t40, $[110] = t41) : t41 = $[110];
|
|
3037
|
+
let detailsProps = t41, t42;
|
|
3038
|
+
$[111] === Symbol.for("react.memo_cache_sentinel") ? (t42 = [
|
|
3037
3039
|
"column-reverse",
|
|
3038
3040
|
"column-reverse",
|
|
3039
3041
|
"row-reverse"
|
|
3040
|
-
], $[
|
|
3041
|
-
let
|
|
3042
|
-
$[
|
|
3042
|
+
], $[111] = t42) : t42 = $[111];
|
|
3043
|
+
let t43;
|
|
3044
|
+
$[112] === Symbol.for("react.memo_cache_sentinel") ? (t43 = [
|
|
3043
3045
|
5,
|
|
3044
3046
|
5,
|
|
3045
3047
|
0
|
|
3046
|
-
], $[
|
|
3047
|
-
let
|
|
3048
|
-
$[
|
|
3049
|
-
let { isLoading, referringDocuments } =
|
|
3048
|
+
], $[112] = t43) : t43 = $[112];
|
|
3049
|
+
let t44;
|
|
3050
|
+
$[113] !== CustomDetails || $[114] !== assetItem || $[115] !== detailsProps || $[116] !== formUpdating || $[117] !== handleSubmit || $[118] !== onSubmit || $[119] !== tabSection ? (t44 = (t45) => {
|
|
3051
|
+
let { isLoading, referringDocuments } = t45, uniqueReferringDocuments = getUniqueDocuments(referringDocuments);
|
|
3050
3052
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(TabList, {
|
|
3051
3053
|
space: 2,
|
|
3052
3054
|
children: [/* @__PURE__ */ jsx(Tab, {
|
|
@@ -3110,24 +3112,24 @@ const DialogAssetEdit = (props) => {
|
|
|
3110
3112
|
})
|
|
3111
3113
|
]
|
|
3112
3114
|
})] });
|
|
3113
|
-
}, $[
|
|
3114
|
-
let
|
|
3115
|
-
$[
|
|
3115
|
+
}, $[113] = CustomDetails, $[114] = assetItem, $[115] = detailsProps, $[116] = formUpdating, $[117] = handleSubmit, $[118] = onSubmit, $[119] = tabSection, $[120] = t44) : t44 = $[120];
|
|
3116
|
+
let t45;
|
|
3117
|
+
$[121] !== currentAsset._id || $[122] !== documentStore || $[123] !== t44 ? (t45 = /* @__PURE__ */ jsx(Box, {
|
|
3116
3118
|
flex: 1,
|
|
3117
|
-
marginTop:
|
|
3119
|
+
marginTop: t43,
|
|
3118
3120
|
padding: 4,
|
|
3119
3121
|
children: /* @__PURE__ */ jsx(WithReferringDocuments, {
|
|
3120
3122
|
documentStore,
|
|
3121
3123
|
id: currentAsset._id,
|
|
3122
|
-
children:
|
|
3124
|
+
children: t44
|
|
3123
3125
|
})
|
|
3124
|
-
}), $[
|
|
3125
|
-
let
|
|
3126
|
-
$[
|
|
3127
|
-
let
|
|
3128
|
-
$[
|
|
3129
|
-
let
|
|
3130
|
-
$[
|
|
3126
|
+
}), $[121] = currentAsset._id, $[122] = documentStore, $[123] = t44, $[124] = t45) : t45 = $[124];
|
|
3127
|
+
let t46;
|
|
3128
|
+
$[125] === Symbol.for("react.memo_cache_sentinel") ? (t46 = { aspectRatio: "1" }, $[125] = t46) : t46 = $[125];
|
|
3129
|
+
let t47;
|
|
3130
|
+
$[126] === currentAsset ? t47 = $[127] : (t47 = isFileAsset(currentAsset) && /* @__PURE__ */ jsx(FileAssetPreview, { asset: currentAsset }), $[126] = currentAsset, $[127] = t47);
|
|
3131
|
+
let t48;
|
|
3132
|
+
$[128] !== currentAsset || $[129] !== scheme ? (t48 = isImageAsset(currentAsset) && /* @__PURE__ */ jsx(Image$1, {
|
|
3131
3133
|
draggable: !1,
|
|
3132
3134
|
$scheme: scheme,
|
|
3133
3135
|
$showCheckerboard: !currentAsset?.metadata?.isOpaque,
|
|
@@ -3135,41 +3137,41 @@ const DialogAssetEdit = (props) => {
|
|
|
3135
3137
|
height: 600,
|
|
3136
3138
|
width: 600
|
|
3137
3139
|
})
|
|
3138
|
-
}), $[
|
|
3139
|
-
let
|
|
3140
|
-
$[
|
|
3141
|
-
style:
|
|
3142
|
-
children: [
|
|
3143
|
-
}), $[
|
|
3144
|
-
let
|
|
3145
|
-
$[
|
|
3140
|
+
}), $[128] = currentAsset, $[129] = scheme, $[130] = t48) : t48 = $[130];
|
|
3141
|
+
let t49;
|
|
3142
|
+
$[131] !== t47 || $[132] !== t48 ? (t49 = /* @__PURE__ */ jsxs(Box, {
|
|
3143
|
+
style: t46,
|
|
3144
|
+
children: [t47, t48]
|
|
3145
|
+
}), $[131] = t47, $[132] = t48, $[133] = t49) : t49 = $[133];
|
|
3146
|
+
let t50;
|
|
3147
|
+
$[134] !== assetItem || $[135] !== currentAsset ? (t50 = currentAsset && /* @__PURE__ */ jsx(Box, {
|
|
3146
3148
|
marginTop: 4,
|
|
3147
3149
|
children: /* @__PURE__ */ jsx(AssetMetadata, {
|
|
3148
3150
|
asset: currentAsset,
|
|
3149
3151
|
item: assetItem
|
|
3150
3152
|
})
|
|
3151
|
-
}), $[
|
|
3152
|
-
let
|
|
3153
|
-
$[
|
|
3153
|
+
}), $[134] = assetItem, $[135] = currentAsset, $[136] = t50) : t50 = $[136];
|
|
3154
|
+
let t51;
|
|
3155
|
+
$[137] !== t49 || $[138] !== t50 ? (t51 = /* @__PURE__ */ jsxs(Box, {
|
|
3154
3156
|
flex: 1,
|
|
3155
3157
|
padding: 4,
|
|
3156
|
-
children: [
|
|
3157
|
-
}), $[
|
|
3158
|
-
let
|
|
3159
|
-
$[
|
|
3160
|
-
direction:
|
|
3161
|
-
children: [
|
|
3162
|
-
}), $[
|
|
3163
|
-
let
|
|
3164
|
-
return $[
|
|
3158
|
+
children: [t49, t50]
|
|
3159
|
+
}), $[137] = t49, $[138] = t50, $[139] = t51) : t51 = $[139];
|
|
3160
|
+
let t52;
|
|
3161
|
+
$[140] !== t45 || $[141] !== t51 ? (t52 = /* @__PURE__ */ jsxs(Flex, {
|
|
3162
|
+
direction: t42,
|
|
3163
|
+
children: [t45, t51]
|
|
3164
|
+
}), $[140] = t45, $[141] = t51, $[142] = t52) : t52 = $[142];
|
|
3165
|
+
let t53;
|
|
3166
|
+
return $[143] !== children || $[144] !== footer || $[145] !== handleClose || $[146] !== id || $[147] !== t52 ? (t53 = /* @__PURE__ */ jsxs(Dialog$1, {
|
|
3165
3167
|
animate: !0,
|
|
3166
|
-
footer
|
|
3168
|
+
footer,
|
|
3167
3169
|
header: "Asset details",
|
|
3168
3170
|
id,
|
|
3169
3171
|
onClose: handleClose,
|
|
3170
3172
|
width: 3,
|
|
3171
|
-
children: [
|
|
3172
|
-
}), $[
|
|
3173
|
+
children: [t52, children]
|
|
3174
|
+
}), $[143] = children, $[144] = footer, $[145] = handleClose, $[146] = id, $[147] = t52, $[148] = t53) : t53 = $[148], t53;
|
|
3173
3175
|
};
|
|
3174
3176
|
function _temp$35(v) {
|
|
3175
3177
|
return v;
|
|
@@ -3236,18 +3238,18 @@ const selectCombinedItems = createSelector([
|
|
|
3236
3238
|
}), t3 = [downHandler, upHandler], $[4] = downHandler, $[5] = t2, $[6] = t3), useEffect(t2, t3), keyPressed;
|
|
3237
3239
|
}, CardWrapper$2 = styled(Flex).withConfig({
|
|
3238
3240
|
displayName: "CardWrapper",
|
|
3239
|
-
componentId: "sc-
|
|
3241
|
+
componentId: "sc-0wpyxz-0"
|
|
3240
3242
|
})`box-sizing:border-box;height:100%;overflow:hidden;position:relative;width:100%;`, CardContainer = /* @__PURE__ */ styled(Flex).withConfig({
|
|
3241
3243
|
displayName: "CardContainer",
|
|
3242
|
-
componentId: "sc-
|
|
3244
|
+
componentId: "sc-0wpyxz-1"
|
|
3243
3245
|
})(({ $picked, theme, $updating }) => css`border:1px solid transparent;height:100%;pointer-events:${$updating ? "none" : "auto"};position:relative;transition:all 300ms;user-select:none;width:100%;border:${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};${!$updating && css`@media (hover:hover) and (pointer:fine){&:hover{border:1px solid var(--card-border-color);}}`}`), ContextActionContainer$2 = /* @__PURE__ */ styled(Flex).withConfig({
|
|
3244
3246
|
displayName: "ContextActionContainer",
|
|
3245
|
-
componentId: "sc-
|
|
3247
|
+
componentId: "sc-0wpyxz-2"
|
|
3246
3248
|
})(({ $scheme }) => css`cursor:pointer;height:${32}px;transition:all 300ms;@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg")};}}`), StyledWarningOutlineIcon = /* @__PURE__ */ styled(WarningFilledIcon).withConfig({
|
|
3247
3249
|
displayName: "StyledWarningOutlineIcon",
|
|
3248
|
-
componentId: "sc-
|
|
3250
|
+
componentId: "sc-0wpyxz-3"
|
|
3249
3251
|
})(({ theme }) => ({ color: theme.sanity.color.spot.red })), CardAsset = (props) => {
|
|
3250
|
-
let $ = c(
|
|
3252
|
+
let $ = c(83), { id, selected, source } = props, scheme = useColorSchemeValue(), toast = useToast(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$34), assetsPicked = useTypedSelector(selectAssetsPicked), t0;
|
|
3251
3253
|
$[0] === id ? t0 = $[1] : (t0 = (state_0) => selectAssetById(state_0, id), $[0] = id, $[1] = t0);
|
|
3252
3254
|
let item = useTypedSelector(t0), t1;
|
|
3253
3255
|
$[2] === source ? t1 = $[3] : (t1 = (state_1) => {
|
|
@@ -3311,18 +3313,18 @@ const selectCombinedItems = createSelector([
|
|
|
3311
3313
|
cursor: t6,
|
|
3312
3314
|
position: "relative"
|
|
3313
3315
|
}, $[34] = t6, $[35] = t7);
|
|
3314
|
-
let t8;
|
|
3315
|
-
$[36] === opacityPreview ?
|
|
3316
|
+
let t8 = `media-asset-card-${asset._id}`, t9;
|
|
3317
|
+
$[36] === opacityPreview ? t9 = $[37] : (t9 = {
|
|
3316
3318
|
height: "100%",
|
|
3317
3319
|
opacity: opacityPreview
|
|
3318
|
-
}, $[36] = opacityPreview, $[37] =
|
|
3319
|
-
let
|
|
3320
|
-
$[38] === asset ?
|
|
3320
|
+
}, $[36] = opacityPreview, $[37] = t9);
|
|
3321
|
+
let t10;
|
|
3322
|
+
$[38] === asset ? t10 = $[39] : (t10 = isFileAsset(asset) && /* @__PURE__ */ jsx(FileIcon$1, {
|
|
3321
3323
|
extension: asset.extension,
|
|
3322
3324
|
width: "80px"
|
|
3323
|
-
}), $[38] = asset, $[39] =
|
|
3324
|
-
let
|
|
3325
|
-
$[40] !== asset || $[41] !== isOpaque || $[42] !== scheme ? (
|
|
3325
|
+
}), $[38] = asset, $[39] = t10);
|
|
3326
|
+
let t11;
|
|
3327
|
+
$[40] !== asset || $[41] !== isOpaque || $[42] !== scheme ? (t11 = isImageAsset(asset) && /* @__PURE__ */ jsx(Image$1, {
|
|
3326
3328
|
draggable: !1,
|
|
3327
3329
|
$scheme: scheme,
|
|
3328
3330
|
$showCheckerboard: !isOpaque,
|
|
@@ -3334,15 +3336,16 @@ const selectCombinedItems = createSelector([
|
|
|
3334
3336
|
draggable: !1,
|
|
3335
3337
|
transition: "opacity 1000ms"
|
|
3336
3338
|
}
|
|
3337
|
-
}), $[40] = asset, $[41] = isOpaque, $[42] = scheme, $[43] =
|
|
3338
|
-
let t11;
|
|
3339
|
-
$[44] !== handleAssetClick || $[45] !== t10 || $[46] !== t8 || $[47] !== t9 ? (t11 = /* @__PURE__ */ jsxs("div", {
|
|
3340
|
-
onClick: handleAssetClick,
|
|
3341
|
-
style: t8,
|
|
3342
|
-
children: [t9, t10]
|
|
3343
|
-
}), $[44] = handleAssetClick, $[45] = t10, $[46] = t8, $[47] = t9, $[48] = t11) : t11 = $[48];
|
|
3339
|
+
}), $[40] = asset, $[41] = isOpaque, $[42] = scheme, $[43] = t11) : t11 = $[43];
|
|
3344
3340
|
let t12;
|
|
3345
|
-
$[
|
|
3341
|
+
$[44] !== handleAssetClick || $[45] !== t10 || $[46] !== t11 || $[47] !== t8 || $[48] !== t9 ? (t12 = /* @__PURE__ */ jsxs("div", {
|
|
3342
|
+
"data-testid": t8,
|
|
3343
|
+
onClick: handleAssetClick,
|
|
3344
|
+
style: t9,
|
|
3345
|
+
children: [t10, t11]
|
|
3346
|
+
}), $[44] = handleAssetClick, $[45] = t10, $[46] = t11, $[47] = t8, $[48] = t9, $[49] = t12) : t12 = $[49];
|
|
3347
|
+
let t13;
|
|
3348
|
+
$[50] !== opacityContainer || $[51] !== selected || $[52] !== updating ? (t13 = selected && !updating && /* @__PURE__ */ jsx(Flex, {
|
|
3346
3349
|
align: "center",
|
|
3347
3350
|
justify: "center",
|
|
3348
3351
|
style: {
|
|
@@ -3357,9 +3360,9 @@ const selectCombinedItems = createSelector([
|
|
|
3357
3360
|
size: 2,
|
|
3358
3361
|
children: /* @__PURE__ */ jsx(CheckmarkCircleIcon, {})
|
|
3359
3362
|
})
|
|
3360
|
-
}), $[
|
|
3361
|
-
let
|
|
3362
|
-
$[
|
|
3363
|
+
}), $[50] = opacityContainer, $[51] = selected, $[52] = updating, $[53] = t13) : t13 = $[53];
|
|
3364
|
+
let t14;
|
|
3365
|
+
$[54] === updating ? t14 = $[55] : (t14 = updating && /* @__PURE__ */ jsx(Flex, {
|
|
3363
3366
|
align: "center",
|
|
3364
3367
|
justify: "center",
|
|
3365
3368
|
style: {
|
|
@@ -3370,21 +3373,21 @@ const selectCombinedItems = createSelector([
|
|
|
3370
3373
|
width: "100%"
|
|
3371
3374
|
},
|
|
3372
3375
|
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
3373
|
-
}), $[
|
|
3374
|
-
let
|
|
3375
|
-
$[
|
|
3376
|
+
}), $[54] = updating, $[55] = t14);
|
|
3377
|
+
let t15;
|
|
3378
|
+
$[56] !== t12 || $[57] !== t13 || $[58] !== t14 || $[59] !== t7 ? (t15 = /* @__PURE__ */ jsxs(Box, {
|
|
3376
3379
|
flex: 1,
|
|
3377
3380
|
style: t7,
|
|
3378
3381
|
children: [
|
|
3379
|
-
t11,
|
|
3380
3382
|
t12,
|
|
3381
|
-
t13
|
|
3383
|
+
t13,
|
|
3384
|
+
t14
|
|
3382
3385
|
]
|
|
3383
|
-
}), $[
|
|
3384
|
-
let t15;
|
|
3385
|
-
$[60] === opacityContainer ? t15 = $[61] : (t15 = { opacity: opacityContainer }, $[60] = opacityContainer, $[61] = t15);
|
|
3386
|
+
}), $[56] = t12, $[57] = t13, $[58] = t14, $[59] = t7, $[60] = t15) : t15 = $[60];
|
|
3386
3387
|
let t16;
|
|
3387
|
-
$[
|
|
3388
|
+
$[61] === opacityContainer ? t16 = $[62] : (t16 = { opacity: opacityContainer }, $[61] = opacityContainer, $[62] = t16);
|
|
3389
|
+
let t17;
|
|
3390
|
+
$[63] !== isMultiSelect || $[64] !== onSelect || $[65] !== picked ? (t17 = onSelect && !isMultiSelect ? /* @__PURE__ */ jsx(EditIcon, { style: {
|
|
3388
3391
|
flexShrink: 0,
|
|
3389
3392
|
opacity: .5
|
|
3390
3393
|
} }) : /* @__PURE__ */ jsx(Checkbox, {
|
|
@@ -3395,9 +3398,9 @@ const selectCombinedItems = createSelector([
|
|
|
3395
3398
|
pointerEvents: "none",
|
|
3396
3399
|
transform: "scale(0.8)"
|
|
3397
3400
|
}
|
|
3398
|
-
}), $[
|
|
3399
|
-
let
|
|
3400
|
-
$[
|
|
3401
|
+
}), $[63] = isMultiSelect, $[64] = onSelect, $[65] = picked, $[66] = t17) : t17 = $[66];
|
|
3402
|
+
let t18;
|
|
3403
|
+
$[67] === asset.originalFilename ? t18 = $[68] : (t18 = /* @__PURE__ */ jsx(Box, {
|
|
3401
3404
|
marginLeft: 2,
|
|
3402
3405
|
children: /* @__PURE__ */ jsx(Text, {
|
|
3403
3406
|
muted: !0,
|
|
@@ -3405,18 +3408,18 @@ const selectCombinedItems = createSelector([
|
|
|
3405
3408
|
textOverflow: "ellipsis",
|
|
3406
3409
|
children: asset.originalFilename
|
|
3407
3410
|
})
|
|
3408
|
-
}), $[
|
|
3409
|
-
let
|
|
3410
|
-
$[
|
|
3411
|
+
}), $[67] = asset.originalFilename, $[68] = t18);
|
|
3412
|
+
let t19;
|
|
3413
|
+
$[69] !== handleContextActionClick || $[70] !== scheme || $[71] !== t16 || $[72] !== t17 || $[73] !== t18 ? (t19 = /* @__PURE__ */ jsxs(ContextActionContainer$2, {
|
|
3411
3414
|
align: "center",
|
|
3412
3415
|
onClick: handleContextActionClick,
|
|
3413
3416
|
paddingX: 1,
|
|
3414
3417
|
$scheme: scheme,
|
|
3415
|
-
style:
|
|
3416
|
-
children: [
|
|
3417
|
-
}), $[
|
|
3418
|
-
let
|
|
3419
|
-
$[
|
|
3418
|
+
style: t16,
|
|
3419
|
+
children: [t17, t18]
|
|
3420
|
+
}), $[69] = handleContextActionClick, $[70] = scheme, $[71] = t16, $[72] = t17, $[73] = t18, $[74] = t19) : t19 = $[74];
|
|
3421
|
+
let t20;
|
|
3422
|
+
$[75] === error ? t20 = $[76] : (t20 = error && /* @__PURE__ */ jsx(Box, {
|
|
3420
3423
|
padding: 3,
|
|
3421
3424
|
style: {
|
|
3422
3425
|
position: "absolute",
|
|
@@ -3440,21 +3443,21 @@ const selectCombinedItems = createSelector([
|
|
|
3440
3443
|
children: /* @__PURE__ */ jsx(StyledWarningOutlineIcon, { color: "critical" })
|
|
3441
3444
|
})
|
|
3442
3445
|
})
|
|
3443
|
-
}), $[
|
|
3444
|
-
let
|
|
3445
|
-
return $[
|
|
3446
|
+
}), $[75] = error, $[76] = t20);
|
|
3447
|
+
let t21;
|
|
3448
|
+
return $[77] !== item.updating || $[78] !== picked || $[79] !== t15 || $[80] !== t19 || $[81] !== t20 ? (t21 = /* @__PURE__ */ jsx(CardWrapper$2, {
|
|
3446
3449
|
padding: 1,
|
|
3447
3450
|
children: /* @__PURE__ */ jsxs(CardContainer, {
|
|
3448
3451
|
direction: "column",
|
|
3449
3452
|
$picked: picked,
|
|
3450
3453
|
$updating: item.updating,
|
|
3451
3454
|
children: [
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
+
t15,
|
|
3456
|
+
t19,
|
|
3457
|
+
t20
|
|
3455
3458
|
]
|
|
3456
3459
|
})
|
|
3457
|
-
}), $[
|
|
3460
|
+
}), $[77] = item.updating, $[78] = picked, $[79] = t15, $[80] = t19, $[81] = t20, $[82] = t21) : t21 = $[82], t21;
|
|
3458
3461
|
};
|
|
3459
3462
|
var CardAsset_default = memo(CardAsset);
|
|
3460
3463
|
function _temp$34(state) {
|
|
@@ -3697,14 +3700,14 @@ const createThrottler = (concurrency = 4) => {
|
|
|
3697
3700
|
}));
|
|
3698
3701
|
}));
|
|
3699
3702
|
})), uploadsCompleteQueueEpic = (action$) => action$.pipe(filter(UPLOADS_ACTIONS.uploadComplete.match), mergeMap((action) => of(uploadsActions.checkRequest({ assets: [action.payload.asset] })))), uploadsCheckRequestEpic = (action$, state$, { client }) => action$.pipe(filter(uploadsActions.checkRequest.match), withLatestFrom(state$), mergeMap(([action, state]) => {
|
|
3700
|
-
let { assets } = action.payload, documentIds = assets.map((asset) => asset._id),
|
|
3701
|
-
*[${constructFilter({
|
|
3703
|
+
let { assets } = action.payload, documentIds = assets.map((asset) => asset._id), constructedFilter = constructFilter({
|
|
3702
3704
|
assetTypes: state.assets.assetTypes,
|
|
3703
3705
|
currentFolderId: state.folders.currentFolderId,
|
|
3704
3706
|
excludeTagSlugs: state.assets.excludeTagSlugs,
|
|
3705
3707
|
searchFacets: state.search.facets,
|
|
3706
3708
|
searchQuery: state.search.query
|
|
3707
|
-
})
|
|
3709
|
+
}), query = groq`
|
|
3710
|
+
*[${constructedFilter} && _id in $documentIds].sha1hash
|
|
3708
3711
|
`;
|
|
3709
3712
|
return of(action).pipe(delay(1e3), mergeMap(() => client.observable.fetch(query, { documentIds })), mergeMap((resultHashes) => {
|
|
3710
3713
|
let checkedResults = assets.reduce((acc, asset) => (acc[asset.sha1hash] = resultHashes.includes(asset.sha1hash) ? asset._id : null, acc), {});
|
|
@@ -4965,13 +4968,16 @@ const DialogFolders = (props) => {
|
|
|
4965
4968
|
text: selectedModifier?.title
|
|
4966
4969
|
}),
|
|
4967
4970
|
id: "modifier",
|
|
4968
|
-
menu: /* @__PURE__ */ jsx(Menu, { children: modifiers.map((modifier_1) =>
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4971
|
+
menu: /* @__PURE__ */ jsx(Menu, { children: modifiers.map((modifier_1) => {
|
|
4972
|
+
let selected_0 = modifier_1.name === facet.modifier;
|
|
4973
|
+
return /* @__PURE__ */ jsx(MenuItem, {
|
|
4974
|
+
disabled: selected_0,
|
|
4975
|
+
fontSize: 1,
|
|
4976
|
+
onClick: () => handleModifierClick(modifier_1),
|
|
4977
|
+
padding: 2,
|
|
4978
|
+
text: modifier_1.title
|
|
4979
|
+
}, modifier_1.name);
|
|
4980
|
+
}) }),
|
|
4975
4981
|
popover: popoverProps
|
|
4976
4982
|
}), $[21] = facet.modifier, $[22] = handleModifierClick, $[23] = modifiers, $[24] = popoverProps, $[25] = selectedModifier?.title, $[26] = t9) : t9 = $[26];
|
|
4977
4983
|
let t10;
|
|
@@ -5029,13 +5035,16 @@ const DialogFolders = (props) => {
|
|
|
5029
5035
|
text: t5
|
|
5030
5036
|
}), $[14] = t5, $[15] = t6);
|
|
5031
5037
|
let t7;
|
|
5032
|
-
$[16] !== handleListItemClick || $[17] !== options || $[18] !== selectedItem?.name ? (t7 = options?.map((item) =>
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5038
|
+
$[16] !== handleListItemClick || $[17] !== options || $[18] !== selectedItem?.name ? (t7 = options?.map((item) => {
|
|
5039
|
+
let selected_0 = item.name === selectedItem?.name;
|
|
5040
|
+
return /* @__PURE__ */ jsx(MenuItem, {
|
|
5041
|
+
disabled: selected_0,
|
|
5042
|
+
fontSize: 1,
|
|
5043
|
+
onClick: () => handleListItemClick(item),
|
|
5044
|
+
padding: 2,
|
|
5045
|
+
text: item.title
|
|
5046
|
+
}, item.name);
|
|
5047
|
+
}), $[16] = handleListItemClick, $[17] = options, $[18] = selectedItem?.name, $[19] = t7) : t7 = $[19];
|
|
5039
5048
|
let t8;
|
|
5040
5049
|
$[20] === t7 ? t8 = $[21] : (t8 = /* @__PURE__ */ jsx(Menu, { children: t7 }), $[20] = t7, $[21] = t8);
|
|
5041
5050
|
let t9;
|
|
@@ -5386,17 +5395,25 @@ const SearchFacetsControl = () => {
|
|
|
5386
5395
|
$[11] !== assetTypes || $[12] !== creditLine?.enabled || $[13] !== isTool ? (t3 = (facet) => !creditLine?.enabled && facet?.type === "string" && facet?.name === "creditLine" ? !1 : facet.type === "group" || facet.type === "divider" ? !0 : isTool ? !facet?.selectOnly : facet.assetTypes.filter((assetType) => assetTypes.includes(assetType)).length > 0, $[11] = assetTypes, $[12] = creditLine?.enabled, $[13] = isTool, $[14] = t3) : t3 = $[14];
|
|
5387
5396
|
let filteredFacets = FACETS.filter(t3).filter(_temp4$3), hasSearchFacets = filteredFacets.length > 0, renderMenuFacets = (facets_0, t4) => {
|
|
5388
5397
|
let level = t4 === void 0 ? 0 : t4;
|
|
5389
|
-
return /* @__PURE__ */ jsx(Fragment, { children: facets_0?.map((facet_1, index_0) =>
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5398
|
+
return /* @__PURE__ */ jsx(Fragment, { children: facets_0?.map((facet_1, index_0) => {
|
|
5399
|
+
if (facet_1.type === "divider") return /* @__PURE__ */ jsx(MenuDivider, {}, index_0);
|
|
5400
|
+
if (facet_1.type === "group") return /* @__PURE__ */ jsx(MenuGroup, {
|
|
5401
|
+
text: facet_1.title,
|
|
5402
|
+
title: facet_1.title,
|
|
5403
|
+
children: renderMenuFacets(facet_1.facets, level + 1)
|
|
5404
|
+
}, `group-${level}-${index_0}`);
|
|
5405
|
+
if (facet_1) {
|
|
5406
|
+
let disabled = !facet_1.operatorTypes && !!searchFacets.find((v) => v.name === facet_1.name);
|
|
5407
|
+
return /* @__PURE__ */ jsx(MenuItem, {
|
|
5408
|
+
disabled,
|
|
5409
|
+
fontSize: 1,
|
|
5410
|
+
onClick: () => dispatch(searchActions.facetsAdd({ facet: facet_1 })),
|
|
5411
|
+
padding: 2,
|
|
5412
|
+
text: facet_1.title
|
|
5413
|
+
}, facet_1.name);
|
|
5414
|
+
}
|
|
5415
|
+
return null;
|
|
5416
|
+
}) });
|
|
5400
5417
|
};
|
|
5401
5418
|
T2 = Flex, T1 = MenuButton;
|
|
5402
5419
|
let t5 = !hasSearchFacets;
|
|
@@ -8254,10 +8271,7 @@ function createAssetHandler(dispatch) {
|
|
|
8254
8271
|
case "disappear":
|
|
8255
8272
|
dispatch(assetsActions.listenerDeleteQueue({ assetId: documentId }));
|
|
8256
8273
|
break;
|
|
8257
|
-
case "update":
|
|
8258
|
-
dispatch(assetsActions.listenerUpdateQueue({ asset: result }));
|
|
8259
|
-
break;
|
|
8260
|
-
default: break;
|
|
8274
|
+
case "update": dispatch(assetsActions.listenerUpdateQueue({ asset: result }));
|
|
8261
8275
|
}
|
|
8262
8276
|
};
|
|
8263
8277
|
}
|
|
@@ -8271,10 +8285,7 @@ function createTagHandler(dispatch) {
|
|
|
8271
8285
|
case "disappear":
|
|
8272
8286
|
dispatch(tagsActions.listenerDeleteQueue({ tagId: documentId }));
|
|
8273
8287
|
break;
|
|
8274
|
-
case "update":
|
|
8275
|
-
dispatch(tagsActions.listenerUpdateQueue({ tag: result }));
|
|
8276
|
-
break;
|
|
8277
|
-
default: break;
|
|
8288
|
+
case "update": dispatch(tagsActions.listenerUpdateQueue({ tag: result }));
|
|
8278
8289
|
}
|
|
8279
8290
|
};
|
|
8280
8291
|
}
|
|
@@ -8337,6 +8348,7 @@ const BrowserContent = (t0) => {
|
|
|
8337
8348
|
t1,
|
|
8338
8349
|
t2,
|
|
8339
8350
|
/* @__PURE__ */ jsx(Card, {
|
|
8351
|
+
"data-testid": "media-browser",
|
|
8340
8352
|
display: "flex",
|
|
8341
8353
|
height: "fill",
|
|
8342
8354
|
ref: setPortalElement,
|