sanity-plugin-media 4.3.2 → 4.3.3
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.mjs → index.cjs} +1051 -1059
- package/dist/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/index.js +1058 -1050
- package/dist/index.js.map +1 -1
- package/package.json +10 -11
- /package/dist/{index.d.mts → index.d.cts} +0 -0
|
@@ -1,56 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
24
|
-
import { format, formatRelative } from "date-fns";
|
|
25
|
-
import filesize from "filesize";
|
|
26
|
-
import copy from "copy-to-clipboard";
|
|
27
|
-
import { useIntentLink } from "sanity/router";
|
|
28
|
-
import { FileIcon as FileIcon$1, defaultStyles } from "react-file-icon";
|
|
29
|
-
import CreatableSelect from "react-select/creatable";
|
|
30
|
-
import { useDropzone } from "react-dropzone";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
+
var jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), sanity = require("sanity"), ui = require("@sanity/ui"), react = require("react"), isHotkeyEsm = require("is-hotkey-esm"), styledComponents = require("styled-components"), reactRedux = require("react-redux"), toolkit = require("@reduxjs/toolkit"), pluralize = require("pluralize"), reduxObservable = require("redux-observable"), rxjs = require("rxjs"), operators$1 = require("rxjs/operators"), groq = require("groq"), nanoid = require("nanoid"), uuid = require("@sanity/uuid"), reactNprogress = require("@tanem/react-nprogress"), color = require("@sanity/color"), Select = require("react-select"), reactVirtuoso = require("react-virtuoso"), reactHookForm = require("react-hook-form"), z = require("zod"), zod = require("@hookform/resolvers/zod"), dateFns = require("date-fns"), filesize = require("filesize"), copy = require("copy-to-clipboard"), router = require("sanity/router"), reactFileIcon = require("react-file-icon"), CreatableSelect = require("react-select/creatable"), reactDropzone = require("react-dropzone");
|
|
4
|
+
function _interopDefaultCompat(e) {
|
|
5
|
+
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
6
|
+
}
|
|
7
|
+
function _interopNamespaceCompat(e) {
|
|
8
|
+
if (e && typeof e == "object" && "default" in e) return e;
|
|
9
|
+
var n = /* @__PURE__ */ Object.create(null);
|
|
10
|
+
return e && Object.keys(e).forEach(function(k) {
|
|
11
|
+
if (k !== "default") {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: !0,
|
|
15
|
+
get: function() {
|
|
16
|
+
return e[k];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}), n.default = e, Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
var pluralize__default = /* @__PURE__ */ _interopDefaultCompat(pluralize), groq__default = /* @__PURE__ */ _interopDefaultCompat(groq), Select__default = /* @__PURE__ */ _interopDefaultCompat(Select), z__namespace = /* @__PURE__ */ _interopNamespaceCompat(z), filesize__default = /* @__PURE__ */ _interopDefaultCompat(filesize), copy__default = /* @__PURE__ */ _interopDefaultCompat(copy), CreatableSelect__default = /* @__PURE__ */ _interopDefaultCompat(CreatableSelect);
|
|
31
23
|
const useKeyPress = (hotkey, onPress) => {
|
|
32
|
-
const keyPressed = useRef(!1), downHandler = useCallback(
|
|
24
|
+
const keyPressed = react.useRef(!1), downHandler = react.useCallback(
|
|
33
25
|
(e) => {
|
|
34
|
-
isHotkey(hotkey, e) && (keyPressed.current = !0, onPress && onPress());
|
|
26
|
+
isHotkeyEsm.isHotkey(hotkey, e) && (keyPressed.current = !0, onPress && onPress());
|
|
35
27
|
},
|
|
36
28
|
[hotkey, onPress]
|
|
37
|
-
), upHandler = useCallback(() => {
|
|
29
|
+
), upHandler = react.useCallback(() => {
|
|
38
30
|
keyPressed.current = !1;
|
|
39
31
|
}, []);
|
|
40
|
-
return useEffect(() => (window.addEventListener("keydown", downHandler), window.addEventListener("keyup", upHandler), () => {
|
|
32
|
+
return react.useEffect(() => (window.addEventListener("keydown", downHandler), window.addEventListener("keyup", upHandler), () => {
|
|
41
33
|
window.removeEventListener("keydown", downHandler), window.removeEventListener("keyup", upHandler);
|
|
42
34
|
}), [downHandler, upHandler]), keyPressed;
|
|
43
|
-
}, AssetSourceDispatchContext = createContext(void 0), AssetBrowserDispatchProvider = (props) => {
|
|
35
|
+
}, AssetSourceDispatchContext = react.createContext(void 0), AssetBrowserDispatchProvider = (props) => {
|
|
44
36
|
const { children, onSelect } = props, contextValue = {
|
|
45
37
|
onSelect
|
|
46
38
|
};
|
|
47
|
-
return /* @__PURE__ */ jsx(AssetSourceDispatchContext.Provider, { value: contextValue, children });
|
|
39
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AssetSourceDispatchContext.Provider, { value: contextValue, children });
|
|
48
40
|
}, useAssetSourceActions = () => {
|
|
49
|
-
const context = useContext(AssetSourceDispatchContext);
|
|
41
|
+
const context = react.useContext(AssetSourceDispatchContext);
|
|
50
42
|
if (context === void 0)
|
|
51
43
|
throw new Error("useAssetSourceActions must be used within an AssetSourceDispatchProvider");
|
|
52
44
|
return context;
|
|
53
|
-
}, useVersionedClient = () => useClient({ apiVersion: "2025-10-02" }), customScrollbar = css`
|
|
45
|
+
}, useVersionedClient = () => sanity.useClient({ apiVersion: "2025-10-02" }), customScrollbar = styledComponents.css`
|
|
54
46
|
::-webkit-scrollbar {
|
|
55
47
|
width: 14px;
|
|
56
48
|
}
|
|
@@ -66,7 +58,7 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
66
58
|
background-clip: padding-box;
|
|
67
59
|
}
|
|
68
60
|
}
|
|
69
|
-
`, GlobalStyle = createGlobalStyle`
|
|
61
|
+
`, GlobalStyle = styledComponents.createGlobalStyle`
|
|
70
62
|
.media__custom-scrollbar {
|
|
71
63
|
${customScrollbar}
|
|
72
64
|
}
|
|
@@ -83,7 +75,7 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
83
75
|
background-color: rgba(15, 17, 18, 0.9);
|
|
84
76
|
}
|
|
85
77
|
|
|
86
|
-
`, useTypedSelector = useSelector, ORDER_DICTIONARY = {
|
|
78
|
+
`, useTypedSelector = reactRedux.useSelector, ORDER_DICTIONARY = {
|
|
87
79
|
_createdAt: {
|
|
88
80
|
asc: "Last created: Oldest first",
|
|
89
81
|
desc: "Last created: Newest first"
|
|
@@ -170,12 +162,12 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
170
162
|
{
|
|
171
163
|
name: "true",
|
|
172
164
|
title: "True",
|
|
173
|
-
value:
|
|
165
|
+
value: groq__default.default`_id in $documentAssetIds`
|
|
174
166
|
},
|
|
175
167
|
{
|
|
176
168
|
name: "false",
|
|
177
169
|
title: "False",
|
|
178
|
-
value:
|
|
170
|
+
value: groq__default.default`!(_id in $documentAssetIds)`
|
|
179
171
|
}
|
|
180
172
|
],
|
|
181
173
|
selectOnly: !0,
|
|
@@ -191,12 +183,12 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
191
183
|
{
|
|
192
184
|
name: "true",
|
|
193
185
|
title: "True",
|
|
194
|
-
value:
|
|
186
|
+
value: groq__default.default`count(*[references(^._id)]) > 0`
|
|
195
187
|
},
|
|
196
188
|
{
|
|
197
189
|
name: "false",
|
|
198
190
|
title: "False",
|
|
199
|
-
value:
|
|
191
|
+
value: groq__default.default`count(*[references(^._id)]) == 0`
|
|
200
192
|
}
|
|
201
193
|
],
|
|
202
194
|
title: "In use",
|
|
@@ -468,14 +460,14 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
468
460
|
SMALL: "3rem 100px auto 1.5rem",
|
|
469
461
|
LARGE: "3rem 100px auto 5.5rem 5.5rem 3.5rem 8.5rem 4.75rem 2rem"
|
|
470
462
|
}, PANEL_HEIGHT = 32, TAG_DOCUMENT_NAME = "media.tag", TAGS_PANEL_WIDTH = 250, debugThrottle = (throttled) => function(source) {
|
|
471
|
-
return iif(
|
|
463
|
+
return rxjs.iif(
|
|
472
464
|
() => !!throttled,
|
|
473
465
|
source.pipe(
|
|
474
|
-
delay(3e3),
|
|
475
|
-
mergeMap((v) => Math.random() > 0.5 ? throwError({
|
|
466
|
+
operators$1.delay(3e3),
|
|
467
|
+
operators$1.mergeMap((v) => Math.random() > 0.5 ? rxjs.throwError({
|
|
476
468
|
message: "Test error",
|
|
477
469
|
statusCode: 500
|
|
478
|
-
}) : of(v))
|
|
470
|
+
}) : rxjs.of(v))
|
|
479
471
|
),
|
|
480
472
|
source
|
|
481
473
|
);
|
|
@@ -484,7 +476,7 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
484
476
|
searchFacets,
|
|
485
477
|
searchQuery
|
|
486
478
|
}) => {
|
|
487
|
-
const documentAssetTypes = assetTypes.map((type) => `sanity.${type}Asset`), baseFilter =
|
|
479
|
+
const documentAssetTypes = assetTypes.map((type) => `sanity.${type}Asset`), baseFilter = groq__default.default`
|
|
488
480
|
_type in ${JSON.stringify(documentAssetTypes)} && !(_id in path("drafts.**"))
|
|
489
481
|
`, searchFacetFragments = searchFacets.reduce((acc, facet) => {
|
|
490
482
|
if (facet.type === "number") {
|
|
@@ -513,22 +505,22 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
513
505
|
// It's possible to add this by adding the following line to the searchQuery, but it's quite slow
|
|
514
506
|
// references(*[_type == "media.tag" && name.current == "${searchQuery.trim()}"]._id)
|
|
515
507
|
...searchQuery ? [
|
|
516
|
-
|
|
508
|
+
groq__default.default`[_id, altText, assetId, creditLine, description, originalFilename, title, url] match '*${searchQuery.trim()}*'`
|
|
517
509
|
] : [],
|
|
518
510
|
// Search facets
|
|
519
511
|
...searchFacetFragments
|
|
520
512
|
].join(" && ");
|
|
521
513
|
}, checkTagName = (client, name) => function(source) {
|
|
522
514
|
return source.pipe(
|
|
523
|
-
mergeMap(() => from(
|
|
524
|
-
client.fetch(
|
|
515
|
+
operators$1.mergeMap(() => rxjs.from(
|
|
516
|
+
client.fetch(groq__default.default`count(*[_type == "${TAG_DOCUMENT_NAME}" && name.current == $name])`, {
|
|
525
517
|
name
|
|
526
518
|
})
|
|
527
519
|
)),
|
|
528
|
-
mergeMap((existingTagCount) => existingTagCount > 0 ? throwError({
|
|
520
|
+
operators$1.mergeMap((existingTagCount) => existingTagCount > 0 ? rxjs.throwError({
|
|
529
521
|
message: "Tag already exists",
|
|
530
522
|
statusCode: 409
|
|
531
|
-
}) : of(!0))
|
|
523
|
+
}) : rxjs.of(!0))
|
|
532
524
|
);
|
|
533
525
|
}, getTagSelectOptions = (tags) => tags.reduce((acc, val) => {
|
|
534
526
|
const tag = val?.tag;
|
|
@@ -537,45 +529,45 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
537
529
|
value: tag?._id
|
|
538
530
|
}), acc;
|
|
539
531
|
}, []), ASSETS_ACTIONS = {
|
|
540
|
-
tagsAddComplete: createAction(
|
|
532
|
+
tagsAddComplete: toolkit.createAction(
|
|
541
533
|
"actions/tagsAddComplete",
|
|
542
534
|
function({ assets, tag }) {
|
|
543
535
|
return { payload: { assets, tag } };
|
|
544
536
|
}
|
|
545
537
|
),
|
|
546
|
-
tagsAddError: createAction(
|
|
538
|
+
tagsAddError: toolkit.createAction(
|
|
547
539
|
"actions/tagsAddError",
|
|
548
540
|
function({ assets, error, tag }) {
|
|
549
541
|
return { payload: { assets, error, tag } };
|
|
550
542
|
}
|
|
551
543
|
),
|
|
552
|
-
tagsAddRequest: createAction(
|
|
544
|
+
tagsAddRequest: toolkit.createAction(
|
|
553
545
|
"actions/tagsAddRequest",
|
|
554
546
|
function({ assets, tag }) {
|
|
555
547
|
return { payload: { assets, tag } };
|
|
556
548
|
}
|
|
557
549
|
),
|
|
558
|
-
tagsRemoveComplete: createAction(
|
|
550
|
+
tagsRemoveComplete: toolkit.createAction(
|
|
559
551
|
"actions/tagsRemoveComplete",
|
|
560
552
|
function({ assets, tag }) {
|
|
561
553
|
return { payload: { assets, tag } };
|
|
562
554
|
}
|
|
563
555
|
),
|
|
564
|
-
tagsRemoveError: createAction(
|
|
556
|
+
tagsRemoveError: toolkit.createAction(
|
|
565
557
|
"actions/tagsRemoveError",
|
|
566
558
|
function({ assets, error, tag }) {
|
|
567
559
|
return { payload: { assets, error, tag } };
|
|
568
560
|
}
|
|
569
561
|
),
|
|
570
|
-
tagsRemoveRequest: createAction(
|
|
562
|
+
tagsRemoveRequest: toolkit.createAction(
|
|
571
563
|
"actions/tagsRemoveRequest",
|
|
572
564
|
function({ assets, tag }) {
|
|
573
565
|
return { payload: { assets, tag } };
|
|
574
566
|
}
|
|
575
567
|
)
|
|
576
568
|
}, DIALOG_ACTIONS = {
|
|
577
|
-
showTagCreate: createAction("dialog/showTagCreate"),
|
|
578
|
-
showTagEdit: createAction("dialog/showTagEdit", function({ tagId }) {
|
|
569
|
+
showTagCreate: toolkit.createAction("dialog/showTagCreate"),
|
|
570
|
+
showTagEdit: toolkit.createAction("dialog/showTagEdit", function({ tagId }) {
|
|
579
571
|
return {
|
|
580
572
|
payload: { tagId }
|
|
581
573
|
};
|
|
@@ -589,7 +581,7 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
589
581
|
fetching: !1,
|
|
590
582
|
fetchingError: void 0,
|
|
591
583
|
panelVisible: !0
|
|
592
|
-
}, tagsSlice = createSlice({
|
|
584
|
+
}, tagsSlice = toolkit.createSlice({
|
|
593
585
|
name: "tags",
|
|
594
586
|
initialState: initialState$7,
|
|
595
587
|
extraReducers: (builder) => {
|
|
@@ -599,7 +591,7 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
599
591
|
const { tagId } = action.payload;
|
|
600
592
|
delete state.byIds[tagId].error;
|
|
601
593
|
}).addMatcher(
|
|
602
|
-
isAnyOf(
|
|
594
|
+
toolkit.isAnyOf(
|
|
603
595
|
ASSETS_ACTIONS.tagsAddComplete,
|
|
604
596
|
ASSETS_ACTIONS.tagsAddError,
|
|
605
597
|
ASSETS_ACTIONS.tagsRemoveComplete,
|
|
@@ -610,7 +602,7 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
610
602
|
state.byIds[tag._id].updating = !1;
|
|
611
603
|
}
|
|
612
604
|
).addMatcher(
|
|
613
|
-
isAnyOf(ASSETS_ACTIONS.tagsAddRequest, ASSETS_ACTIONS.tagsRemoveRequest),
|
|
605
|
+
toolkit.isAnyOf(ASSETS_ACTIONS.tagsAddRequest, ASSETS_ACTIONS.tagsRemoveRequest),
|
|
614
606
|
(state, action) => {
|
|
615
607
|
const { tag } = action.payload;
|
|
616
608
|
state.byIds[tag._id].updating = !0;
|
|
@@ -666,7 +658,7 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
666
658
|
reducer: (state, _action) => {
|
|
667
659
|
state.fetching = !0, delete state.fetchingError;
|
|
668
660
|
},
|
|
669
|
-
prepare: () => ({ payload: { query:
|
|
661
|
+
prepare: () => ({ payload: { query: groq__default.default`
|
|
670
662
|
{
|
|
671
663
|
"items": *[
|
|
672
664
|
_type == "${TAG_DOCUMENT_NAME}"
|
|
@@ -744,14 +736,14 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
744
736
|
}
|
|
745
737
|
}
|
|
746
738
|
}), tagsCreateEpic = (action$, state$, { client }) => action$.pipe(
|
|
747
|
-
filter(tagsSlice.actions.createRequest.match),
|
|
748
|
-
withLatestFrom(state$),
|
|
749
|
-
mergeMap(([action, state]) => {
|
|
739
|
+
operators$1.filter(tagsSlice.actions.createRequest.match),
|
|
740
|
+
operators$1.withLatestFrom(state$),
|
|
741
|
+
operators$1.mergeMap(([action, state]) => {
|
|
750
742
|
const { assetId, name } = action.payload;
|
|
751
|
-
return of(action).pipe(
|
|
743
|
+
return rxjs.of(action).pipe(
|
|
752
744
|
debugThrottle(state.debug.badConnection),
|
|
753
745
|
checkTagName(client, name),
|
|
754
|
-
mergeMap(
|
|
746
|
+
operators$1.mergeMap(
|
|
755
747
|
() => client.observable.create({
|
|
756
748
|
_type: TAG_DOCUMENT_NAME,
|
|
757
749
|
name: {
|
|
@@ -760,9 +752,9 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
760
752
|
}
|
|
761
753
|
})
|
|
762
754
|
),
|
|
763
|
-
mergeMap((result) => of(tagsSlice.actions.createComplete({ assetId, tag: result }))),
|
|
764
|
-
catchError(
|
|
765
|
-
(error) => of(
|
|
755
|
+
operators$1.mergeMap((result) => rxjs.of(tagsSlice.actions.createComplete({ assetId, tag: result }))),
|
|
756
|
+
operators$1.catchError(
|
|
757
|
+
(error) => rxjs.of(
|
|
766
758
|
tagsSlice.actions.createError({
|
|
767
759
|
error: {
|
|
768
760
|
message: error?.message || "Internal error",
|
|
@@ -775,17 +767,17 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
775
767
|
);
|
|
776
768
|
})
|
|
777
769
|
), tagsDeleteEpic = (action$, state$, { client }) => action$.pipe(
|
|
778
|
-
filter(tagsSlice.actions.deleteRequest.match),
|
|
779
|
-
withLatestFrom(state$),
|
|
780
|
-
mergeMap(([action, state]) => {
|
|
770
|
+
operators$1.filter(tagsSlice.actions.deleteRequest.match),
|
|
771
|
+
operators$1.withLatestFrom(state$),
|
|
772
|
+
operators$1.mergeMap(([action, state]) => {
|
|
781
773
|
const { tag } = action.payload;
|
|
782
|
-
return of(action).pipe(
|
|
774
|
+
return rxjs.of(action).pipe(
|
|
783
775
|
// Optionally throttle
|
|
784
776
|
debugThrottle(state.debug.badConnection),
|
|
785
777
|
// Fetch assets which reference this tag
|
|
786
|
-
mergeMap(
|
|
778
|
+
operators$1.mergeMap(
|
|
787
779
|
() => client.observable.fetch(
|
|
788
|
-
|
|
780
|
+
groq__default.default`*[
|
|
789
781
|
_type in ["sanity.fileAsset", "sanity.imageAsset"]
|
|
790
782
|
&& references(*[_type == "media.tag" && name.current == $tagName]._id)
|
|
791
783
|
] {
|
|
@@ -797,7 +789,7 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
797
789
|
)
|
|
798
790
|
),
|
|
799
791
|
// Create transaction which remove tag references from all matched assets and delete tag
|
|
800
|
-
mergeMap((assets) => {
|
|
792
|
+
operators$1.mergeMap((assets) => {
|
|
801
793
|
const transaction = assets.map((asset) => ({
|
|
802
794
|
id: asset._id,
|
|
803
795
|
patch: {
|
|
@@ -809,12 +801,12 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
809
801
|
(tx, patch) => tx.patch(patch.id, patch.patch),
|
|
810
802
|
client.transaction()
|
|
811
803
|
);
|
|
812
|
-
return transaction.delete(tag._id), from(transaction.commit());
|
|
804
|
+
return transaction.delete(tag._id), rxjs.from(transaction.commit());
|
|
813
805
|
}),
|
|
814
806
|
// Dispatch complete action
|
|
815
|
-
mergeMap(() => of(tagsSlice.actions.deleteComplete({ tagId: tag._id }))),
|
|
816
|
-
catchError(
|
|
817
|
-
(error) => of(
|
|
807
|
+
operators$1.mergeMap(() => rxjs.of(tagsSlice.actions.deleteComplete({ tagId: tag._id }))),
|
|
808
|
+
operators$1.catchError(
|
|
809
|
+
(error) => rxjs.of(
|
|
818
810
|
tagsSlice.actions.deleteError({
|
|
819
811
|
error: {
|
|
820
812
|
message: error?.message || "Internal error",
|
|
@@ -827,24 +819,24 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
827
819
|
);
|
|
828
820
|
})
|
|
829
821
|
), tagsFetchEpic = (action$, state$, { client }) => action$.pipe(
|
|
830
|
-
filter(tagsSlice.actions.fetchRequest.match),
|
|
831
|
-
withLatestFrom(state$),
|
|
832
|
-
switchMap(([action, state]) => {
|
|
822
|
+
operators$1.filter(tagsSlice.actions.fetchRequest.match),
|
|
823
|
+
operators$1.withLatestFrom(state$),
|
|
824
|
+
operators$1.switchMap(([action, state]) => {
|
|
833
825
|
const { query } = action.payload;
|
|
834
|
-
return of(action).pipe(
|
|
826
|
+
return rxjs.of(action).pipe(
|
|
835
827
|
// Optionally throttle
|
|
836
828
|
debugThrottle(state.debug.badConnection),
|
|
837
829
|
// Fetch tags
|
|
838
|
-
mergeMap(
|
|
830
|
+
operators$1.mergeMap(
|
|
839
831
|
() => client.observable.fetch(query)
|
|
840
832
|
),
|
|
841
833
|
// Dispatch complete action
|
|
842
|
-
mergeMap((result) => {
|
|
834
|
+
operators$1.mergeMap((result) => {
|
|
843
835
|
const { items } = result;
|
|
844
|
-
return of(tagsSlice.actions.fetchComplete({ tags: items }));
|
|
836
|
+
return rxjs.of(tagsSlice.actions.fetchComplete({ tags: items }));
|
|
845
837
|
}),
|
|
846
|
-
catchError(
|
|
847
|
-
(error) => of(
|
|
838
|
+
operators$1.catchError(
|
|
839
|
+
(error) => rxjs.of(
|
|
848
840
|
tagsSlice.actions.fetchError({
|
|
849
841
|
error: {
|
|
850
842
|
message: error?.message || "Internal error",
|
|
@@ -856,62 +848,62 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
856
848
|
);
|
|
857
849
|
})
|
|
858
850
|
), tagsListenerCreateQueueEpic = (action$) => action$.pipe(
|
|
859
|
-
filter(tagsSlice.actions.listenerCreateQueue.match),
|
|
860
|
-
bufferTime(2e3),
|
|
861
|
-
filter((actions) => actions.length > 0),
|
|
862
|
-
mergeMap((actions) => {
|
|
851
|
+
operators$1.filter(tagsSlice.actions.listenerCreateQueue.match),
|
|
852
|
+
operators$1.bufferTime(2e3),
|
|
853
|
+
operators$1.filter((actions) => actions.length > 0),
|
|
854
|
+
operators$1.mergeMap((actions) => {
|
|
863
855
|
const tags = actions?.map((action) => action.payload.tag);
|
|
864
|
-
return of(tagsSlice.actions.listenerCreateQueueComplete({ tags }));
|
|
856
|
+
return rxjs.of(tagsSlice.actions.listenerCreateQueueComplete({ tags }));
|
|
865
857
|
})
|
|
866
858
|
), tagsListenerDeleteQueueEpic = (action$) => action$.pipe(
|
|
867
|
-
filter(tagsSlice.actions.listenerDeleteQueue.match),
|
|
868
|
-
bufferTime(2e3),
|
|
869
|
-
filter((actions) => actions.length > 0),
|
|
870
|
-
mergeMap((actions) => {
|
|
859
|
+
operators$1.filter(tagsSlice.actions.listenerDeleteQueue.match),
|
|
860
|
+
operators$1.bufferTime(2e3),
|
|
861
|
+
operators$1.filter((actions) => actions.length > 0),
|
|
862
|
+
operators$1.mergeMap((actions) => {
|
|
871
863
|
const tagIds = actions?.map((action) => action.payload.tagId);
|
|
872
|
-
return of(tagsSlice.actions.listenerDeleteQueueComplete({ tagIds }));
|
|
864
|
+
return rxjs.of(tagsSlice.actions.listenerDeleteQueueComplete({ tagIds }));
|
|
873
865
|
})
|
|
874
866
|
), tagsListenerUpdateQueueEpic = (action$) => action$.pipe(
|
|
875
|
-
filter(tagsSlice.actions.listenerUpdateQueue.match),
|
|
876
|
-
bufferTime(2e3),
|
|
877
|
-
filter((actions) => actions.length > 0),
|
|
878
|
-
mergeMap((actions) => {
|
|
867
|
+
operators$1.filter(tagsSlice.actions.listenerUpdateQueue.match),
|
|
868
|
+
operators$1.bufferTime(2e3),
|
|
869
|
+
operators$1.filter((actions) => actions.length > 0),
|
|
870
|
+
operators$1.mergeMap((actions) => {
|
|
879
871
|
const tags = actions?.map((action) => action.payload.tag);
|
|
880
|
-
return of(tagsSlice.actions.listenerUpdateQueueComplete({ tags }));
|
|
872
|
+
return rxjs.of(tagsSlice.actions.listenerUpdateQueueComplete({ tags }));
|
|
881
873
|
})
|
|
882
874
|
), tagsSortEpic = (action$) => action$.pipe(
|
|
883
|
-
ofType(
|
|
875
|
+
reduxObservable.ofType(
|
|
884
876
|
tagsSlice.actions.listenerCreateQueueComplete.type,
|
|
885
877
|
tagsSlice.actions.listenerUpdateQueueComplete.type
|
|
886
878
|
),
|
|
887
|
-
bufferTime(1e3),
|
|
888
|
-
filter((actions) => actions.length > 0),
|
|
889
|
-
mergeMap(() => of(tagsSlice.actions.sort()))
|
|
879
|
+
operators$1.bufferTime(1e3),
|
|
880
|
+
operators$1.filter((actions) => actions.length > 0),
|
|
881
|
+
operators$1.mergeMap(() => rxjs.of(tagsSlice.actions.sort()))
|
|
890
882
|
), tagsUpdateEpic = (action$, state$, { client }) => action$.pipe(
|
|
891
|
-
filter(tagsSlice.actions.updateRequest.match),
|
|
892
|
-
withLatestFrom(state$),
|
|
893
|
-
mergeMap(([action, state]) => {
|
|
883
|
+
operators$1.filter(tagsSlice.actions.updateRequest.match),
|
|
884
|
+
operators$1.withLatestFrom(state$),
|
|
885
|
+
operators$1.mergeMap(([action, state]) => {
|
|
894
886
|
const { closeDialogId, formData, tag } = action.payload;
|
|
895
|
-
return of(action).pipe(
|
|
887
|
+
return rxjs.of(action).pipe(
|
|
896
888
|
// Optionally throttle
|
|
897
889
|
debugThrottle(state.debug.badConnection),
|
|
898
890
|
// Check if tag name is available, throw early if not
|
|
899
891
|
checkTagName(client, formData?.name?.current),
|
|
900
892
|
// Patch document (Update tag)
|
|
901
|
-
mergeMap(
|
|
902
|
-
() => from(
|
|
893
|
+
operators$1.mergeMap(
|
|
894
|
+
() => rxjs.from(
|
|
903
895
|
client.patch(tag._id).set({ name: { _type: "slug", current: formData?.name.current } }).commit()
|
|
904
896
|
)
|
|
905
897
|
),
|
|
906
898
|
// Dispatch complete action
|
|
907
|
-
mergeMap((updatedTag) => of(
|
|
899
|
+
operators$1.mergeMap((updatedTag) => rxjs.of(
|
|
908
900
|
tagsSlice.actions.updateComplete({
|
|
909
901
|
closeDialogId,
|
|
910
902
|
tag: updatedTag
|
|
911
903
|
})
|
|
912
904
|
)),
|
|
913
|
-
catchError(
|
|
914
|
-
(error) => of(
|
|
905
|
+
operators$1.catchError(
|
|
906
|
+
(error) => rxjs.of(
|
|
915
907
|
tagsSlice.actions.updateError({
|
|
916
908
|
error: {
|
|
917
909
|
message: error?.message || "Internal error",
|
|
@@ -923,10 +915,10 @@ const useKeyPress = (hotkey, onPress) => {
|
|
|
923
915
|
)
|
|
924
916
|
);
|
|
925
917
|
})
|
|
926
|
-
), selectTagsByIds = (state) => state.tags.byIds, selectTagsAllIds = (state) => state.tags.allIds, selectTags = createSelector(
|
|
918
|
+
), selectTagsByIds = (state) => state.tags.byIds, selectTagsAllIds = (state) => state.tags.allIds, selectTags = toolkit.createSelector(
|
|
927
919
|
[selectTagsByIds, selectTagsAllIds],
|
|
928
920
|
(byIds, allIds) => allIds.map((id) => byIds[id])
|
|
929
|
-
), selectTagById = createSelector(
|
|
921
|
+
), selectTagById = toolkit.createSelector(
|
|
930
922
|
[selectTagsByIds, (_state, tagId) => tagId],
|
|
931
923
|
(byIds, tagId) => byIds[tagId]
|
|
932
924
|
), selectTagSelectOptions = (asset) => (state) => {
|
|
@@ -940,13 +932,13 @@ var tagsReducer = tagsSlice.reducer;
|
|
|
940
932
|
const initialState$6 = {
|
|
941
933
|
facets: [],
|
|
942
934
|
query: ""
|
|
943
|
-
}, searchSlice = createSlice({
|
|
935
|
+
}, searchSlice = toolkit.createSlice({
|
|
944
936
|
name: "search",
|
|
945
937
|
initialState: initialState$6,
|
|
946
938
|
reducers: {
|
|
947
939
|
// Add search facet
|
|
948
940
|
facetsAdd(state, action) {
|
|
949
|
-
state.facets.push({ ...action.payload.facet, id: uuid() });
|
|
941
|
+
state.facets.push({ ...action.payload.facet, id: uuid.uuid() });
|
|
950
942
|
},
|
|
951
943
|
// Clear all search facets
|
|
952
944
|
facetsClear(state) {
|
|
@@ -984,11 +976,11 @@ const initialState$6 = {
|
|
|
984
976
|
}
|
|
985
977
|
}
|
|
986
978
|
}), searchFacetTagUpdateEpic = (action$, state$) => action$.pipe(
|
|
987
|
-
filter(tagsActions.updateComplete.match),
|
|
988
|
-
withLatestFrom(state$),
|
|
989
|
-
mergeMap(([action, state]) => {
|
|
979
|
+
operators$1.filter(tagsActions.updateComplete.match),
|
|
980
|
+
operators$1.withLatestFrom(state$),
|
|
981
|
+
operators$1.mergeMap(([action, state]) => {
|
|
990
982
|
const { tag } = action.payload, currentSearchFacetTag = state.search.facets?.find((facet) => facet.name === "tag"), tagItem = state.tags.byIds[tag._id];
|
|
991
|
-
return currentSearchFacetTag?.type === "searchable" && currentSearchFacetTag.value?.value === tag._id ? of(
|
|
983
|
+
return currentSearchFacetTag?.type === "searchable" && currentSearchFacetTag.value?.value === tag._id ? rxjs.of(
|
|
992
984
|
searchSlice.actions.facetsUpdate({
|
|
993
985
|
name: "tag",
|
|
994
986
|
value: {
|
|
@@ -996,9 +988,9 @@ const initialState$6 = {
|
|
|
996
988
|
value: tagItem?.tag?._id
|
|
997
989
|
}
|
|
998
990
|
})
|
|
999
|
-
) : EMPTY;
|
|
991
|
+
) : rxjs.EMPTY;
|
|
1000
992
|
})
|
|
1001
|
-
), selectIsSearchFacetTag = createSelector(
|
|
993
|
+
), selectIsSearchFacetTag = toolkit.createSelector(
|
|
1002
994
|
[
|
|
1003
995
|
(state) => state.search.facets,
|
|
1004
996
|
(_state, tagId) => tagId
|
|
@@ -1009,7 +1001,7 @@ const initialState$6 = {
|
|
|
1009
1001
|
), searchActions = { ...searchSlice.actions };
|
|
1010
1002
|
var searchReducer = searchSlice.reducer;
|
|
1011
1003
|
const UPLOADS_ACTIONS = {
|
|
1012
|
-
uploadComplete: createAction(
|
|
1004
|
+
uploadComplete: toolkit.createAction(
|
|
1013
1005
|
"uploads/uploadComplete",
|
|
1014
1006
|
function({ asset }) {
|
|
1015
1007
|
return {
|
|
@@ -1034,7 +1026,7 @@ const UPLOADS_ACTIONS = {
|
|
|
1034
1026
|
pageSize: 100,
|
|
1035
1027
|
// totalCount: -1,
|
|
1036
1028
|
view: "grid"
|
|
1037
|
-
}, assetsSlice = createSlice({
|
|
1029
|
+
}, assetsSlice = toolkit.createSlice({
|
|
1038
1030
|
name: "assets",
|
|
1039
1031
|
initialState: initialState$5,
|
|
1040
1032
|
extraReducers: (builder) => {
|
|
@@ -1132,9 +1124,9 @@ const UPLOADS_ACTIONS = {
|
|
|
1132
1124
|
params = {},
|
|
1133
1125
|
queryFilter,
|
|
1134
1126
|
selector = "",
|
|
1135
|
-
sort =
|
|
1127
|
+
sort = groq__default.default`order(_updatedAt desc)`
|
|
1136
1128
|
}) => {
|
|
1137
|
-
const query =
|
|
1129
|
+
const query = groq__default.default`
|
|
1138
1130
|
{
|
|
1139
1131
|
"items": *[${queryFilter}] {
|
|
1140
1132
|
_id,
|
|
@@ -1251,38 +1243,38 @@ const UPLOADS_ACTIONS = {
|
|
|
1251
1243
|
}
|
|
1252
1244
|
}
|
|
1253
1245
|
}), assetsDeleteEpic = (action$, _state$, { client }) => action$.pipe(
|
|
1254
|
-
filter(assetsActions.deleteRequest.match),
|
|
1255
|
-
mergeMap((action) => {
|
|
1246
|
+
operators$1.filter(assetsActions.deleteRequest.match),
|
|
1247
|
+
operators$1.mergeMap((action) => {
|
|
1256
1248
|
const { assets } = action.payload, assetIds = assets.map((asset) => asset._id);
|
|
1257
|
-
return of(assets).pipe(
|
|
1258
|
-
mergeMap(
|
|
1249
|
+
return rxjs.of(assets).pipe(
|
|
1250
|
+
operators$1.mergeMap(
|
|
1259
1251
|
() => client.observable.delete({
|
|
1260
|
-
query:
|
|
1252
|
+
query: groq__default.default`*[_id in ${JSON.stringify(assetIds)}]`
|
|
1261
1253
|
})
|
|
1262
1254
|
),
|
|
1263
|
-
mergeMap(() => of(assetsActions.deleteComplete({ assetIds }))),
|
|
1264
|
-
catchError((error) => of(assetsActions.deleteError({ assetIds, error })))
|
|
1255
|
+
operators$1.mergeMap(() => rxjs.of(assetsActions.deleteComplete({ assetIds }))),
|
|
1256
|
+
operators$1.catchError((error) => rxjs.of(assetsActions.deleteError({ assetIds, error })))
|
|
1265
1257
|
);
|
|
1266
1258
|
})
|
|
1267
1259
|
), assetsFetchEpic = (action$, state$, { client }) => action$.pipe(
|
|
1268
|
-
filter(assetsActions.fetchRequest.match),
|
|
1269
|
-
withLatestFrom(state$),
|
|
1270
|
-
switchMap(([action, state]) => {
|
|
1260
|
+
operators$1.filter(assetsActions.fetchRequest.match),
|
|
1261
|
+
operators$1.withLatestFrom(state$),
|
|
1262
|
+
operators$1.switchMap(([action, state]) => {
|
|
1271
1263
|
const params = action.payload?.params, query = action.payload?.query;
|
|
1272
|
-
return of(action).pipe(
|
|
1264
|
+
return rxjs.of(action).pipe(
|
|
1273
1265
|
debugThrottle(state.debug.badConnection),
|
|
1274
|
-
mergeMap(
|
|
1266
|
+
operators$1.mergeMap(
|
|
1275
1267
|
() => client.observable.fetch(query, params)
|
|
1276
1268
|
),
|
|
1277
|
-
mergeMap((result) => {
|
|
1269
|
+
operators$1.mergeMap((result) => {
|
|
1278
1270
|
const {
|
|
1279
1271
|
items
|
|
1280
1272
|
// totalCount
|
|
1281
1273
|
} = result;
|
|
1282
|
-
return of(assetsActions.fetchComplete({ assets: items }));
|
|
1274
|
+
return rxjs.of(assetsActions.fetchComplete({ assets: items }));
|
|
1283
1275
|
}),
|
|
1284
|
-
catchError(
|
|
1285
|
-
(error) => of(
|
|
1276
|
+
operators$1.catchError(
|
|
1277
|
+
(error) => rxjs.of(
|
|
1286
1278
|
assetsActions.fetchError({
|
|
1287
1279
|
message: error?.message || "Internal error",
|
|
1288
1280
|
statusCode: error?.statusCode || 500
|
|
@@ -1292,9 +1284,9 @@ const UPLOADS_ACTIONS = {
|
|
|
1292
1284
|
);
|
|
1293
1285
|
})
|
|
1294
1286
|
), assetsFetchPageIndexEpic = (action$, state$) => action$.pipe(
|
|
1295
|
-
filter(assetsActions.loadPageIndex.match),
|
|
1296
|
-
withLatestFrom(state$),
|
|
1297
|
-
switchMap(([action, state]) => {
|
|
1287
|
+
operators$1.filter(assetsActions.loadPageIndex.match),
|
|
1288
|
+
operators$1.withLatestFrom(state$),
|
|
1289
|
+
operators$1.switchMap(([action, state]) => {
|
|
1298
1290
|
const pageSize = state.assets.pageSize, start = action.payload.pageIndex * pageSize, end = start + pageSize, documentId = state?.selected.document?._id, documentAssetIds = state?.selected?.documentAssetIds, constructedFilter = constructFilter({
|
|
1299
1291
|
assetTypes: state.assets.assetTypes,
|
|
1300
1292
|
searchFacets: state.search.facets,
|
|
@@ -1303,40 +1295,40 @@ const UPLOADS_ACTIONS = {
|
|
|
1303
1295
|
...documentId ? { documentId } : {},
|
|
1304
1296
|
documentAssetIds
|
|
1305
1297
|
};
|
|
1306
|
-
return of(
|
|
1298
|
+
return rxjs.of(
|
|
1307
1299
|
assetsActions.fetchRequest({
|
|
1308
1300
|
params,
|
|
1309
1301
|
queryFilter: constructedFilter,
|
|
1310
|
-
selector:
|
|
1311
|
-
sort:
|
|
1302
|
+
selector: groq__default.default`[${start}...${end}]`,
|
|
1303
|
+
sort: groq__default.default`order(${state.assets?.order?.field} ${state.assets?.order?.direction})`
|
|
1312
1304
|
})
|
|
1313
1305
|
);
|
|
1314
1306
|
})
|
|
1315
1307
|
), assetsFetchNextPageEpic = (action$, state$) => action$.pipe(
|
|
1316
|
-
filter(assetsActions.loadNextPage.match),
|
|
1317
|
-
withLatestFrom(state$),
|
|
1318
|
-
switchMap(
|
|
1319
|
-
([_action, state]) => of(assetsActions.loadPageIndex({ pageIndex: state.assets.pageIndex + 1 }))
|
|
1308
|
+
operators$1.filter(assetsActions.loadNextPage.match),
|
|
1309
|
+
operators$1.withLatestFrom(state$),
|
|
1310
|
+
operators$1.switchMap(
|
|
1311
|
+
([_action, state]) => rxjs.of(assetsActions.loadPageIndex({ pageIndex: state.assets.pageIndex + 1 }))
|
|
1320
1312
|
)
|
|
1321
1313
|
), assetsFetchAfterDeleteAllEpic = (action$, state$) => action$.pipe(
|
|
1322
|
-
filter(assetsActions.deleteComplete.match),
|
|
1323
|
-
withLatestFrom(state$),
|
|
1324
|
-
switchMap(([_action, state]) => {
|
|
1314
|
+
operators$1.filter(assetsActions.deleteComplete.match),
|
|
1315
|
+
operators$1.withLatestFrom(state$),
|
|
1316
|
+
operators$1.switchMap(([_action, state]) => {
|
|
1325
1317
|
if (state.assets.allIds.length === 0) {
|
|
1326
1318
|
const nextPageIndex = Math.floor(state.assets.allIds.length / state.assets.pageSize);
|
|
1327
|
-
return of(assetsActions.loadPageIndex({ pageIndex: nextPageIndex }));
|
|
1319
|
+
return rxjs.of(assetsActions.loadPageIndex({ pageIndex: nextPageIndex }));
|
|
1328
1320
|
}
|
|
1329
|
-
return EMPTY;
|
|
1321
|
+
return rxjs.EMPTY;
|
|
1330
1322
|
})
|
|
1331
|
-
), filterAssetWithoutTag = (tag) => (asset) => (asset?.asset?.opt?.media?.tags?.findIndex((t) => t._ref === tag?._id) ?? -1) < 0, patchOperationTagAppend = ({ tag }) => (patch) => patch.setIfMissing({ opt: {} }).setIfMissing({ "opt.media": {} }).setIfMissing({ "opt.media.tags": [] }).append("opt.media.tags", [{ _key: nanoid(), _ref: tag?._id, _type: "reference", _weak: !0 }]), patchOperationTagUnset = ({ asset, tag }) => (patch) => patch.ifRevisionId(asset?.asset?._rev).unset([`opt.media.tags[_ref == "${tag._id}"]`]), assetsOrderSetEpic = (action$) => action$.pipe(
|
|
1332
|
-
filter(assetsActions.orderSet.match),
|
|
1333
|
-
mergeMap(() => of(
|
|
1323
|
+
), filterAssetWithoutTag = (tag) => (asset) => (asset?.asset?.opt?.media?.tags?.findIndex((t) => t._ref === tag?._id) ?? -1) < 0, patchOperationTagAppend = ({ tag }) => (patch) => patch.setIfMissing({ opt: {} }).setIfMissing({ "opt.media": {} }).setIfMissing({ "opt.media.tags": [] }).append("opt.media.tags", [{ _key: nanoid.nanoid(), _ref: tag?._id, _type: "reference", _weak: !0 }]), patchOperationTagUnset = ({ asset, tag }) => (patch) => patch.ifRevisionId(asset?.asset?._rev).unset([`opt.media.tags[_ref == "${tag._id}"]`]), assetsOrderSetEpic = (action$) => action$.pipe(
|
|
1324
|
+
operators$1.filter(assetsActions.orderSet.match),
|
|
1325
|
+
operators$1.mergeMap(() => rxjs.of(
|
|
1334
1326
|
assetsActions.clear(),
|
|
1335
1327
|
//
|
|
1336
1328
|
assetsActions.loadPageIndex({ pageIndex: 0 })
|
|
1337
1329
|
))
|
|
1338
1330
|
), assetsSearchEpic = (action$) => action$.pipe(
|
|
1339
|
-
ofType(
|
|
1331
|
+
reduxObservable.ofType(
|
|
1340
1332
|
searchActions.facetsAdd.type,
|
|
1341
1333
|
searchActions.facetsClear.type,
|
|
1342
1334
|
searchActions.facetsRemoveById.type,
|
|
@@ -1346,63 +1338,63 @@ const UPLOADS_ACTIONS = {
|
|
|
1346
1338
|
searchActions.facetsUpdateById.type,
|
|
1347
1339
|
searchActions.querySet.type
|
|
1348
1340
|
),
|
|
1349
|
-
debounceTime(400),
|
|
1350
|
-
mergeMap(() => of(
|
|
1341
|
+
operators$1.debounceTime(400),
|
|
1342
|
+
operators$1.mergeMap(() => rxjs.of(
|
|
1351
1343
|
assetsActions.clear(),
|
|
1352
1344
|
//
|
|
1353
1345
|
assetsActions.loadPageIndex({ pageIndex: 0 })
|
|
1354
1346
|
))
|
|
1355
1347
|
), assetsListenerCreateQueueEpic = (action$) => action$.pipe(
|
|
1356
|
-
filter(assetsActions.listenerCreateQueue.match),
|
|
1357
|
-
bufferTime(2e3),
|
|
1358
|
-
filter((actions) => actions.length > 0),
|
|
1359
|
-
mergeMap((actions) => {
|
|
1348
|
+
operators$1.filter(assetsActions.listenerCreateQueue.match),
|
|
1349
|
+
operators$1.bufferTime(2e3),
|
|
1350
|
+
operators$1.filter((actions) => actions.length > 0),
|
|
1351
|
+
operators$1.mergeMap((actions) => {
|
|
1360
1352
|
const assets = actions?.map((action) => action.payload.asset);
|
|
1361
|
-
return of(assetsActions.listenerCreateQueueComplete({ assets }));
|
|
1353
|
+
return rxjs.of(assetsActions.listenerCreateQueueComplete({ assets }));
|
|
1362
1354
|
})
|
|
1363
1355
|
), assetsListenerDeleteQueueEpic = (action$) => action$.pipe(
|
|
1364
|
-
filter(assetsActions.listenerDeleteQueue.match),
|
|
1365
|
-
bufferTime(2e3),
|
|
1366
|
-
filter((actions) => actions.length > 0),
|
|
1367
|
-
mergeMap((actions) => {
|
|
1356
|
+
operators$1.filter(assetsActions.listenerDeleteQueue.match),
|
|
1357
|
+
operators$1.bufferTime(2e3),
|
|
1358
|
+
operators$1.filter((actions) => actions.length > 0),
|
|
1359
|
+
operators$1.mergeMap((actions) => {
|
|
1368
1360
|
const assetIds = actions?.map((action) => action.payload.assetId);
|
|
1369
|
-
return of(assetsActions.listenerDeleteQueueComplete({ assetIds }));
|
|
1361
|
+
return rxjs.of(assetsActions.listenerDeleteQueueComplete({ assetIds }));
|
|
1370
1362
|
})
|
|
1371
1363
|
), assetsListenerUpdateQueueEpic = (action$) => action$.pipe(
|
|
1372
|
-
filter(assetsActions.listenerUpdateQueue.match),
|
|
1373
|
-
bufferTime(2e3),
|
|
1374
|
-
filter((actions) => actions.length > 0),
|
|
1375
|
-
mergeMap((actions) => {
|
|
1364
|
+
operators$1.filter(assetsActions.listenerUpdateQueue.match),
|
|
1365
|
+
operators$1.bufferTime(2e3),
|
|
1366
|
+
operators$1.filter((actions) => actions.length > 0),
|
|
1367
|
+
operators$1.mergeMap((actions) => {
|
|
1376
1368
|
const assets = actions?.map((action) => action.payload.asset);
|
|
1377
|
-
return of(assetsActions.listenerUpdateQueueComplete({ assets }));
|
|
1369
|
+
return rxjs.of(assetsActions.listenerUpdateQueueComplete({ assets }));
|
|
1378
1370
|
})
|
|
1379
1371
|
), assetsSortEpic = (action$) => action$.pipe(
|
|
1380
|
-
ofType(
|
|
1372
|
+
reduxObservable.ofType(
|
|
1381
1373
|
assetsActions.insertUploads.type,
|
|
1382
1374
|
assetsActions.listenerUpdateQueueComplete.type,
|
|
1383
1375
|
assetsActions.updateComplete.type
|
|
1384
1376
|
),
|
|
1385
|
-
mergeMap(() => of(assetsActions.sort()))
|
|
1377
|
+
operators$1.mergeMap(() => rxjs.of(assetsActions.sort()))
|
|
1386
1378
|
), assetsTagsAddEpic = (action$, state$, { client }) => action$.pipe(
|
|
1387
|
-
filter(ASSETS_ACTIONS.tagsAddRequest.match),
|
|
1388
|
-
withLatestFrom(state$),
|
|
1389
|
-
mergeMap(([action, state]) => {
|
|
1379
|
+
operators$1.filter(ASSETS_ACTIONS.tagsAddRequest.match),
|
|
1380
|
+
operators$1.withLatestFrom(state$),
|
|
1381
|
+
operators$1.mergeMap(([action, state]) => {
|
|
1390
1382
|
const { assets, tag } = action.payload;
|
|
1391
|
-
return of(action).pipe(
|
|
1383
|
+
return rxjs.of(action).pipe(
|
|
1392
1384
|
// Optionally throttle
|
|
1393
1385
|
debugThrottle(state.debug.badConnection),
|
|
1394
1386
|
// Add tag references to all picked assets
|
|
1395
|
-
mergeMap(() => {
|
|
1387
|
+
operators$1.mergeMap(() => {
|
|
1396
1388
|
const transaction = (selectAssetsPicked(state)?.filter(filterAssetWithoutTag(tag))).reduce(
|
|
1397
1389
|
(tx, pickedAsset) => tx.patch(pickedAsset?.asset?._id, patchOperationTagAppend({ tag })),
|
|
1398
1390
|
client.transaction()
|
|
1399
1391
|
);
|
|
1400
|
-
return from(transaction.commit());
|
|
1392
|
+
return rxjs.from(transaction.commit());
|
|
1401
1393
|
}),
|
|
1402
1394
|
// Dispatch complete action
|
|
1403
|
-
mergeMap(() => of(ASSETS_ACTIONS.tagsAddComplete({ assets, tag }))),
|
|
1404
|
-
catchError(
|
|
1405
|
-
(error) => of(
|
|
1395
|
+
operators$1.mergeMap(() => rxjs.of(ASSETS_ACTIONS.tagsAddComplete({ assets, tag }))),
|
|
1396
|
+
operators$1.catchError(
|
|
1397
|
+
(error) => rxjs.of(
|
|
1406
1398
|
ASSETS_ACTIONS.tagsAddError({
|
|
1407
1399
|
assets,
|
|
1408
1400
|
error: {
|
|
@@ -1416,25 +1408,25 @@ const UPLOADS_ACTIONS = {
|
|
|
1416
1408
|
);
|
|
1417
1409
|
})
|
|
1418
1410
|
), assetsTagsRemoveEpic = (action$, state$, { client }) => action$.pipe(
|
|
1419
|
-
filter(ASSETS_ACTIONS.tagsRemoveRequest.match),
|
|
1420
|
-
withLatestFrom(state$),
|
|
1421
|
-
mergeMap(([action, state]) => {
|
|
1411
|
+
operators$1.filter(ASSETS_ACTIONS.tagsRemoveRequest.match),
|
|
1412
|
+
operators$1.withLatestFrom(state$),
|
|
1413
|
+
operators$1.mergeMap(([action, state]) => {
|
|
1422
1414
|
const { assets, tag } = action.payload;
|
|
1423
|
-
return of(action).pipe(
|
|
1415
|
+
return rxjs.of(action).pipe(
|
|
1424
1416
|
// Optionally throttle
|
|
1425
1417
|
debugThrottle(state.debug.badConnection),
|
|
1426
1418
|
// Remove tag references from all picked assets
|
|
1427
|
-
mergeMap(() => {
|
|
1419
|
+
operators$1.mergeMap(() => {
|
|
1428
1420
|
const transaction = selectAssetsPicked(state).reduce(
|
|
1429
1421
|
(tx, pickedAsset) => tx.patch(pickedAsset?.asset?._id, patchOperationTagUnset({ asset: pickedAsset, tag })),
|
|
1430
1422
|
client.transaction()
|
|
1431
1423
|
);
|
|
1432
|
-
return from(transaction.commit());
|
|
1424
|
+
return rxjs.from(transaction.commit());
|
|
1433
1425
|
}),
|
|
1434
1426
|
// Dispatch complete action
|
|
1435
|
-
mergeMap(() => of(ASSETS_ACTIONS.tagsRemoveComplete({ assets, tag }))),
|
|
1436
|
-
catchError(
|
|
1437
|
-
(error) => of(
|
|
1427
|
+
operators$1.mergeMap(() => rxjs.of(ASSETS_ACTIONS.tagsRemoveComplete({ assets, tag }))),
|
|
1428
|
+
operators$1.catchError(
|
|
1429
|
+
(error) => rxjs.of(
|
|
1438
1430
|
ASSETS_ACTIONS.tagsRemoveError({
|
|
1439
1431
|
assets,
|
|
1440
1432
|
error: {
|
|
@@ -1448,7 +1440,7 @@ const UPLOADS_ACTIONS = {
|
|
|
1448
1440
|
);
|
|
1449
1441
|
})
|
|
1450
1442
|
), assetsUnpickEpic = (action$) => action$.pipe(
|
|
1451
|
-
ofType(
|
|
1443
|
+
reduxObservable.ofType(
|
|
1452
1444
|
assetsActions.orderSet.type,
|
|
1453
1445
|
assetsActions.viewSet.type,
|
|
1454
1446
|
searchActions.facetsAdd.type,
|
|
@@ -1460,29 +1452,29 @@ const UPLOADS_ACTIONS = {
|
|
|
1460
1452
|
searchActions.facetsUpdateById.type,
|
|
1461
1453
|
searchActions.querySet.type
|
|
1462
1454
|
),
|
|
1463
|
-
mergeMap(() => of(assetsActions.pickClear()))
|
|
1455
|
+
operators$1.mergeMap(() => rxjs.of(assetsActions.pickClear()))
|
|
1464
1456
|
), assetsUpdateEpic = (action$, state$, { client }) => action$.pipe(
|
|
1465
|
-
filter(assetsActions.updateRequest.match),
|
|
1466
|
-
withLatestFrom(state$),
|
|
1467
|
-
mergeMap(([action, state]) => {
|
|
1457
|
+
operators$1.filter(assetsActions.updateRequest.match),
|
|
1458
|
+
operators$1.withLatestFrom(state$),
|
|
1459
|
+
operators$1.mergeMap(([action, state]) => {
|
|
1468
1460
|
const { asset, closeDialogId, formData } = action.payload;
|
|
1469
|
-
return of(action).pipe(
|
|
1461
|
+
return rxjs.of(action).pipe(
|
|
1470
1462
|
debugThrottle(state.debug.badConnection),
|
|
1471
|
-
mergeMap(
|
|
1472
|
-
() => from(
|
|
1463
|
+
operators$1.mergeMap(
|
|
1464
|
+
() => rxjs.from(
|
|
1473
1465
|
client.patch(asset._id).setIfMissing({ opt: {} }).setIfMissing({ "opt.media": {} }).set(formData).commit()
|
|
1474
1466
|
)
|
|
1475
1467
|
),
|
|
1476
|
-
mergeMap(
|
|
1477
|
-
(updatedAsset) => of(
|
|
1468
|
+
operators$1.mergeMap(
|
|
1469
|
+
(updatedAsset) => rxjs.of(
|
|
1478
1470
|
assetsActions.updateComplete({
|
|
1479
1471
|
asset: updatedAsset,
|
|
1480
1472
|
closeDialogId
|
|
1481
1473
|
})
|
|
1482
1474
|
)
|
|
1483
1475
|
),
|
|
1484
|
-
catchError(
|
|
1485
|
-
(error) => of(
|
|
1476
|
+
operators$1.catchError(
|
|
1477
|
+
(error) => rxjs.of(
|
|
1486
1478
|
assetsActions.updateError({
|
|
1487
1479
|
asset,
|
|
1488
1480
|
error: {
|
|
@@ -1494,26 +1486,26 @@ const UPLOADS_ACTIONS = {
|
|
|
1494
1486
|
)
|
|
1495
1487
|
);
|
|
1496
1488
|
})
|
|
1497
|
-
), selectAssetsByIds = (state) => state.assets.byIds, selectAssetsAllIds = (state) => state.assets.allIds, selectAssetById = createSelector(
|
|
1489
|
+
), selectAssetsByIds = (state) => state.assets.byIds, selectAssetsAllIds = (state) => state.assets.allIds, selectAssetById = toolkit.createSelector(
|
|
1498
1490
|
[
|
|
1499
1491
|
(state) => state.assets.byIds,
|
|
1500
1492
|
(_state, assetId) => assetId
|
|
1501
1493
|
],
|
|
1502
1494
|
(byIds, assetId) => byIds[assetId] || void 0
|
|
1503
|
-
), selectAssets = createSelector(
|
|
1495
|
+
), selectAssets = toolkit.createSelector(
|
|
1504
1496
|
[selectAssetsByIds, selectAssetsAllIds],
|
|
1505
1497
|
(byIds, allIds) => allIds.map((id) => byIds[id])
|
|
1506
|
-
), selectAssetsLength = createSelector([selectAssets], (assets) => assets.length), selectAssetsPicked = createSelector(
|
|
1498
|
+
), selectAssetsLength = toolkit.createSelector([selectAssets], (assets) => assets.length), selectAssetsPicked = toolkit.createSelector(
|
|
1507
1499
|
[selectAssets],
|
|
1508
1500
|
(assets) => assets.filter((item) => item?.picked)
|
|
1509
|
-
), selectAssetsPickedLength = createSelector(
|
|
1501
|
+
), selectAssetsPickedLength = toolkit.createSelector(
|
|
1510
1502
|
[selectAssetsPicked],
|
|
1511
1503
|
(assetsPicked) => assetsPicked.length
|
|
1512
1504
|
), assetsActions = { ...assetsSlice.actions };
|
|
1513
1505
|
var assetsReducer = assetsSlice.reducer;
|
|
1514
1506
|
const initialState$4 = {
|
|
1515
1507
|
items: []
|
|
1516
|
-
}, dialogSlice = createSlice({
|
|
1508
|
+
}, dialogSlice = toolkit.createSlice({
|
|
1517
1509
|
name: "dialog",
|
|
1518
1510
|
initialState: initialState$4,
|
|
1519
1511
|
extraReducers: (builder) => {
|
|
@@ -1559,7 +1551,7 @@ const initialState$4 = {
|
|
|
1559
1551
|
state.items = state.items.filter((item) => item.id !== id);
|
|
1560
1552
|
},
|
|
1561
1553
|
showConfirmAssetsTagAdd(state, action) {
|
|
1562
|
-
const { assetsPicked, closeDialogId, tag } = action.payload, suffix = `${assetsPicked.length} ${
|
|
1554
|
+
const { assetsPicked, closeDialogId, tag } = action.payload, suffix = `${assetsPicked.length} ${pluralize__default.default("asset", assetsPicked.length)}`;
|
|
1563
1555
|
state.items.push({
|
|
1564
1556
|
closeDialogId,
|
|
1565
1557
|
confirmCallbackAction: ASSETS_ACTIONS.tagsAddRequest({
|
|
@@ -1575,7 +1567,7 @@ const initialState$4 = {
|
|
|
1575
1567
|
});
|
|
1576
1568
|
},
|
|
1577
1569
|
showConfirmAssetsTagRemove(state, action) {
|
|
1578
|
-
const { assetsPicked, closeDialogId, tag } = action.payload, suffix = `${assetsPicked.length} ${
|
|
1570
|
+
const { assetsPicked, closeDialogId, tag } = action.payload, suffix = `${assetsPicked.length} ${pluralize__default.default("asset", assetsPicked.length)}`;
|
|
1579
1571
|
state.items.push({
|
|
1580
1572
|
closeDialogId,
|
|
1581
1573
|
confirmCallbackAction: ASSETS_ACTIONS.tagsRemoveRequest({ assets: assetsPicked, tag }),
|
|
@@ -1588,7 +1580,7 @@ const initialState$4 = {
|
|
|
1588
1580
|
});
|
|
1589
1581
|
},
|
|
1590
1582
|
showConfirmDeleteAssets(state, action) {
|
|
1591
|
-
const { assets, closeDialogId } = action.payload, suffix = `${assets.length} ${
|
|
1583
|
+
const { assets, closeDialogId } = action.payload, suffix = `${assets.length} ${pluralize__default.default("asset", assets.length)}`;
|
|
1592
1584
|
state.items.push({
|
|
1593
1585
|
closeDialogId,
|
|
1594
1586
|
confirmCallbackAction: assetsActions.deleteRequest({
|
|
@@ -1639,41 +1631,41 @@ const initialState$4 = {
|
|
|
1639
1631
|
}
|
|
1640
1632
|
}
|
|
1641
1633
|
}), dialogClearOnAssetUpdateEpic = (action$) => action$.pipe(
|
|
1642
|
-
ofType(
|
|
1634
|
+
reduxObservable.ofType(
|
|
1643
1635
|
assetsActions.deleteComplete.type,
|
|
1644
1636
|
assetsActions.updateComplete.type,
|
|
1645
1637
|
tagsActions.deleteComplete.type,
|
|
1646
1638
|
tagsActions.updateComplete.type
|
|
1647
1639
|
),
|
|
1648
|
-
filter(
|
|
1640
|
+
operators$1.filter(
|
|
1649
1641
|
(action) => !!action?.payload?.closeDialogId
|
|
1650
1642
|
),
|
|
1651
|
-
mergeMap((action) => {
|
|
1643
|
+
operators$1.mergeMap((action) => {
|
|
1652
1644
|
const dialogId = action?.payload?.closeDialogId;
|
|
1653
|
-
return dialogId ? of(dialogSlice.actions.remove({ id: dialogId })) : EMPTY;
|
|
1645
|
+
return dialogId ? rxjs.of(dialogSlice.actions.remove({ id: dialogId })) : rxjs.EMPTY;
|
|
1654
1646
|
})
|
|
1655
1647
|
), dialogTagCreateEpic = (action$) => action$.pipe(
|
|
1656
|
-
filter(tagsActions.createComplete.match),
|
|
1657
|
-
mergeMap((action) => {
|
|
1648
|
+
operators$1.filter(tagsActions.createComplete.match),
|
|
1649
|
+
operators$1.mergeMap((action) => {
|
|
1658
1650
|
const { assetId, tag } = action?.payload;
|
|
1659
|
-
return assetId ? of(dialogSlice.actions.inlineTagCreate({ tag, assetId })) : tag._id ? of(dialogSlice.actions.remove({ id: "tagCreate" })) : EMPTY;
|
|
1651
|
+
return assetId ? rxjs.of(dialogSlice.actions.inlineTagCreate({ tag, assetId })) : tag._id ? rxjs.of(dialogSlice.actions.remove({ id: "tagCreate" })) : rxjs.EMPTY;
|
|
1660
1652
|
})
|
|
1661
1653
|
), dialogTagDeleteEpic = (action$) => action$.pipe(
|
|
1662
|
-
filter(tagsActions.listenerDeleteQueueComplete.match),
|
|
1663
|
-
mergeMap((action) => {
|
|
1654
|
+
operators$1.filter(tagsActions.listenerDeleteQueueComplete.match),
|
|
1655
|
+
operators$1.mergeMap((action) => {
|
|
1664
1656
|
const { tagIds } = action?.payload;
|
|
1665
|
-
return of(dialogSlice.actions.inlineTagRemove({ tagIds }));
|
|
1657
|
+
return rxjs.of(dialogSlice.actions.inlineTagRemove({ tagIds }));
|
|
1666
1658
|
})
|
|
1667
1659
|
), dialogActions = { ...dialogSlice.actions };
|
|
1668
1660
|
var dialogReducer = dialogSlice.reducer;
|
|
1669
1661
|
const ButtonViewGroup = () => {
|
|
1670
|
-
const dispatch = useDispatch(), view = useTypedSelector((state) => state.assets.view);
|
|
1671
|
-
return /* @__PURE__ */ jsxs(Inline, { space: 0, style: { whiteSpace: "nowrap" }, children: [
|
|
1672
|
-
/* @__PURE__ */ jsx(
|
|
1673
|
-
Button,
|
|
1662
|
+
const dispatch = reactRedux.useDispatch(), view = useTypedSelector((state) => state.assets.view);
|
|
1663
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 0, style: { whiteSpace: "nowrap" }, children: [
|
|
1664
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1665
|
+
ui.Button,
|
|
1674
1666
|
{
|
|
1675
1667
|
fontSize: 1,
|
|
1676
|
-
icon: ThLargeIcon,
|
|
1668
|
+
icon: icons.ThLargeIcon,
|
|
1677
1669
|
mode: view === "grid" ? "default" : "ghost",
|
|
1678
1670
|
onClick: () => dispatch(assetsActions.viewSet({ view: "grid" })),
|
|
1679
1671
|
style: {
|
|
@@ -1682,11 +1674,11 @@ const ButtonViewGroup = () => {
|
|
|
1682
1674
|
}
|
|
1683
1675
|
}
|
|
1684
1676
|
),
|
|
1685
|
-
/* @__PURE__ */ jsx(
|
|
1686
|
-
Button,
|
|
1677
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1678
|
+
ui.Button,
|
|
1687
1679
|
{
|
|
1688
1680
|
fontSize: 1,
|
|
1689
|
-
icon: ThListIcon,
|
|
1681
|
+
icon: icons.ThListIcon,
|
|
1690
1682
|
mode: view === "table" ? "default" : "ghost",
|
|
1691
1683
|
onClick: () => dispatch(assetsActions.viewSet({ view: "table" })),
|
|
1692
1684
|
style: {
|
|
@@ -1698,7 +1690,7 @@ const ButtonViewGroup = () => {
|
|
|
1698
1690
|
] });
|
|
1699
1691
|
};
|
|
1700
1692
|
function usePortalPopoverProps() {
|
|
1701
|
-
const portal = usePortal();
|
|
1693
|
+
const portal = ui.usePortal();
|
|
1702
1694
|
return {
|
|
1703
1695
|
animate: !0,
|
|
1704
1696
|
constrainSize: !0,
|
|
@@ -1708,26 +1700,26 @@ function usePortalPopoverProps() {
|
|
|
1708
1700
|
};
|
|
1709
1701
|
}
|
|
1710
1702
|
const OrderSelect = () => {
|
|
1711
|
-
const dispatch = useDispatch(), order = useTypedSelector((state) => state.assets.order), popoverProps = usePortalPopoverProps();
|
|
1712
|
-
return /* @__PURE__ */ jsx(
|
|
1713
|
-
MenuButton,
|
|
1703
|
+
const dispatch = reactRedux.useDispatch(), order = useTypedSelector((state) => state.assets.order), popoverProps = usePortalPopoverProps();
|
|
1704
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1705
|
+
ui.MenuButton,
|
|
1714
1706
|
{
|
|
1715
|
-
button: /* @__PURE__ */ jsx(
|
|
1716
|
-
Button,
|
|
1707
|
+
button: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1708
|
+
ui.Button,
|
|
1717
1709
|
{
|
|
1718
1710
|
fontSize: 1,
|
|
1719
|
-
icon: SortIcon,
|
|
1711
|
+
icon: icons.SortIcon,
|
|
1720
1712
|
mode: "bleed",
|
|
1721
1713
|
padding: 3,
|
|
1722
1714
|
text: getOrderTitle(order.field, order.direction)
|
|
1723
1715
|
}
|
|
1724
1716
|
),
|
|
1725
1717
|
id: "order",
|
|
1726
|
-
menu: /* @__PURE__ */ jsx(Menu
|
|
1718
|
+
menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: ORDER_OPTIONS?.map((item, index) => {
|
|
1727
1719
|
if (item) {
|
|
1728
1720
|
const selected = order.field === item.field && order.direction === item.direction;
|
|
1729
|
-
return /* @__PURE__ */ jsx(
|
|
1730
|
-
MenuItem,
|
|
1721
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1722
|
+
ui.MenuItem,
|
|
1731
1723
|
{
|
|
1732
1724
|
disabled: selected,
|
|
1733
1725
|
fontSize: 1,
|
|
@@ -1746,25 +1738,25 @@ const OrderSelect = () => {
|
|
|
1746
1738
|
index
|
|
1747
1739
|
);
|
|
1748
1740
|
}
|
|
1749
|
-
return /* @__PURE__ */ jsx(MenuDivider, {}, index);
|
|
1741
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index);
|
|
1750
1742
|
}) }),
|
|
1751
1743
|
popover: popoverProps
|
|
1752
1744
|
}
|
|
1753
1745
|
);
|
|
1754
1746
|
}, Progress = (props) => {
|
|
1755
|
-
const { loading } = props, { animationDuration, isFinished, progress } = useNProgress({
|
|
1747
|
+
const { loading } = props, { animationDuration, isFinished, progress } = reactNprogress.useNProgress({
|
|
1756
1748
|
animationDuration: 300,
|
|
1757
1749
|
isAnimating: loading
|
|
1758
1750
|
});
|
|
1759
|
-
return /* @__PURE__ */ jsx(
|
|
1760
|
-
Box,
|
|
1751
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1752
|
+
ui.Box,
|
|
1761
1753
|
{
|
|
1762
1754
|
style: {
|
|
1763
1755
|
opacity: isFinished ? 0 : 1,
|
|
1764
1756
|
transition: `opacity ${animationDuration}ms linear`
|
|
1765
1757
|
},
|
|
1766
|
-
children: /* @__PURE__ */ jsx(
|
|
1767
|
-
Box,
|
|
1758
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1759
|
+
ui.Box,
|
|
1768
1760
|
{
|
|
1769
1761
|
style: {
|
|
1770
1762
|
height: "1px",
|
|
@@ -1781,51 +1773,51 @@ const OrderSelect = () => {
|
|
|
1781
1773
|
);
|
|
1782
1774
|
}, SCHEME_COLORS = {
|
|
1783
1775
|
bg: {
|
|
1784
|
-
dark: hues.gray[950].hex,
|
|
1785
|
-
light: hues.gray[50].hex
|
|
1776
|
+
dark: color.hues.gray[950].hex,
|
|
1777
|
+
light: color.hues.gray[50].hex
|
|
1786
1778
|
},
|
|
1787
1779
|
bg2: {
|
|
1788
|
-
dark: hues.gray[900].hex,
|
|
1789
|
-
light: hues.gray[100].hex
|
|
1780
|
+
dark: color.hues.gray[900].hex,
|
|
1781
|
+
light: color.hues.gray[100].hex
|
|
1790
1782
|
},
|
|
1791
1783
|
inputEnabledBorder: {
|
|
1792
|
-
dark: studioTheme.color.dark.default.input.default.enabled.border,
|
|
1793
|
-
light: studioTheme.color.light.default.input.default.enabled.border
|
|
1784
|
+
dark: ui.studioTheme.color.dark.default.input.default.enabled.border,
|
|
1785
|
+
light: ui.studioTheme.color.light.default.input.default.enabled.border
|
|
1794
1786
|
},
|
|
1795
1787
|
inputHoveredBorder: {
|
|
1796
|
-
dark: studioTheme.color.dark.default.input.default.hovered.border,
|
|
1797
|
-
light: studioTheme.color.light.default.input.default.hovered.border
|
|
1788
|
+
dark: ui.studioTheme.color.dark.default.input.default.hovered.border,
|
|
1789
|
+
light: ui.studioTheme.color.light.default.input.default.hovered.border
|
|
1798
1790
|
},
|
|
1799
1791
|
mutedHoveredBg: {
|
|
1800
|
-
dark: studioTheme.color.dark.primary.muted.primary.hovered.bg,
|
|
1801
|
-
light: studioTheme.color.light.primary.muted.primary.hovered.bg
|
|
1792
|
+
dark: ui.studioTheme.color.dark.primary.muted.primary.hovered.bg,
|
|
1793
|
+
light: ui.studioTheme.color.light.primary.muted.primary.hovered.bg
|
|
1802
1794
|
},
|
|
1803
1795
|
mutedHoveredFg: {
|
|
1804
|
-
dark: studioTheme.color.dark.primary.muted.primary.hovered.fg,
|
|
1805
|
-
light: studioTheme.color.light.primary.muted.primary.hovered.fg
|
|
1796
|
+
dark: ui.studioTheme.color.dark.primary.muted.primary.hovered.fg,
|
|
1797
|
+
light: ui.studioTheme.color.light.primary.muted.primary.hovered.fg
|
|
1806
1798
|
},
|
|
1807
1799
|
mutedSelectedBg: {
|
|
1808
|
-
dark: studioTheme.color.dark.primary.muted.primary.selected.bg,
|
|
1809
|
-
light: studioTheme.color.light.primary.muted.primary.selected.bg
|
|
1800
|
+
dark: ui.studioTheme.color.dark.primary.muted.primary.selected.bg,
|
|
1801
|
+
light: ui.studioTheme.color.light.primary.muted.primary.selected.bg
|
|
1810
1802
|
},
|
|
1811
1803
|
spotBlue: {
|
|
1812
|
-
dark: studioTheme.color.dark.primary.spot.blue,
|
|
1813
|
-
light: studioTheme.color.light.primary.spot.blue
|
|
1804
|
+
dark: ui.studioTheme.color.dark.primary.spot.blue,
|
|
1805
|
+
light: ui.studioTheme.color.light.primary.spot.blue
|
|
1814
1806
|
}
|
|
1815
1807
|
};
|
|
1816
1808
|
function getSchemeColor(scheme, colorKey) {
|
|
1817
1809
|
return SCHEME_COLORS[colorKey]?.[scheme];
|
|
1818
1810
|
}
|
|
1819
|
-
const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
1811
|
+
const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styledComponents.css`
|
|
1820
1812
|
background: ${getSchemeColor($scheme, "bg")};
|
|
1821
|
-
border-radius: ${rem(theme.sanity.radius[2])};
|
|
1813
|
+
border-radius: ${ui.rem(theme.sanity.radius[2])};
|
|
1822
1814
|
`), SearchFacet = (props) => {
|
|
1823
|
-
const { children, facet } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), handleClose = () => {
|
|
1815
|
+
const { children, facet } = props, scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), handleClose = () => {
|
|
1824
1816
|
dispatch(searchActions.facetsRemoveById({ facetId: facet.id }));
|
|
1825
1817
|
};
|
|
1826
|
-
return /* @__PURE__ */ jsx(Container$1, { padding: [2, 2, 1], $scheme: scheme, children: /* @__PURE__ */ jsxs(Flex, { align: ["flex-start", "flex-start", "center"], direction: ["column", "column", "row"], children: [
|
|
1827
|
-
/* @__PURE__ */ jsx(Box, { paddingBottom: [3, 3, 0], paddingLeft: 1, paddingRight: 2, paddingTop: [1, 1, 0], children: /* @__PURE__ */ jsx(
|
|
1828
|
-
Label,
|
|
1818
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container$1, { padding: [2, 2, 1], $scheme: scheme, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: ["flex-start", "flex-start", "center"], direction: ["column", "column", "row"], children: [
|
|
1819
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingBottom: [3, 3, 0], paddingLeft: 1, paddingRight: 2, paddingTop: [1, 1, 0], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1820
|
+
ui.Label,
|
|
1829
1821
|
{
|
|
1830
1822
|
size: 0,
|
|
1831
1823
|
style: {
|
|
@@ -1834,15 +1826,15 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
1834
1826
|
children: facet.title
|
|
1835
1827
|
}
|
|
1836
1828
|
) }),
|
|
1837
|
-
/* @__PURE__ */ jsxs(Flex, { align: "center", children: [
|
|
1829
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
|
|
1838
1830
|
children,
|
|
1839
|
-
/* @__PURE__ */ jsx(Box, { marginLeft: 1, paddingX: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsx(CloseIcon, { onClick: handleClose }) }) })
|
|
1831
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 1, paddingX: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, { onClick: handleClose }) }) })
|
|
1840
1832
|
] })
|
|
1841
1833
|
] }) });
|
|
1842
1834
|
}, TextInputNumber = (props) => {
|
|
1843
1835
|
const { onValueChange, value, ...remainingProps } = props;
|
|
1844
|
-
return /* @__PURE__ */ jsx(
|
|
1845
|
-
TextInput,
|
|
1836
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1837
|
+
ui.TextInput,
|
|
1846
1838
|
{
|
|
1847
1839
|
...remainingProps,
|
|
1848
1840
|
onChange: (e) => {
|
|
@@ -1853,29 +1845,29 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
1853
1845
|
}
|
|
1854
1846
|
);
|
|
1855
1847
|
}, SearchFacetNumber = ({ facet }) => {
|
|
1856
|
-
const dispatch = useDispatch(), popoverProps = usePortalPopoverProps(), modifiers = facet?.modifiers, selectedModifier = facet?.modifier ? modifiers?.find((modifier) => modifier.name === facet?.modifier) : modifiers?.[0], handleOperatorItemClick = (operatorType) => {
|
|
1848
|
+
const dispatch = reactRedux.useDispatch(), popoverProps = usePortalPopoverProps(), modifiers = facet?.modifiers, selectedModifier = facet?.modifier ? modifiers?.find((modifier) => modifier.name === facet?.modifier) : modifiers?.[0], handleOperatorItemClick = (operatorType) => {
|
|
1857
1849
|
dispatch(searchActions.facetsUpdateById({ id: facet.id, operatorType }));
|
|
1858
1850
|
}, handleModifierClick = (modifier) => {
|
|
1859
1851
|
dispatch(searchActions.facetsUpdateById({ id: facet.id, modifier: modifier.name }));
|
|
1860
1852
|
}, handleValueChange = (value) => {
|
|
1861
1853
|
dispatch(searchActions.facetsUpdateById({ id: facet.id, value }));
|
|
1862
1854
|
}, selectedOperatorType = facet.operatorType ?? "greaterThan";
|
|
1863
|
-
return /* @__PURE__ */ jsxs(SearchFacet, { facet, children: [
|
|
1864
|
-
facet?.operatorTypes && /* @__PURE__ */ jsx(
|
|
1865
|
-
MenuButton,
|
|
1855
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(SearchFacet, { facet, children: [
|
|
1856
|
+
facet?.operatorTypes && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1857
|
+
ui.MenuButton,
|
|
1866
1858
|
{
|
|
1867
|
-
button: /* @__PURE__ */ jsx(
|
|
1868
|
-
Button,
|
|
1859
|
+
button: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1860
|
+
ui.Button,
|
|
1869
1861
|
{
|
|
1870
1862
|
fontSize: 1,
|
|
1871
|
-
iconRight: SelectIcon,
|
|
1863
|
+
iconRight: icons.SelectIcon,
|
|
1872
1864
|
padding: 2,
|
|
1873
1865
|
text: operators[selectedOperatorType].label
|
|
1874
1866
|
}
|
|
1875
1867
|
),
|
|
1876
1868
|
id: "operators",
|
|
1877
|
-
menu: /* @__PURE__ */ jsx(Menu
|
|
1878
|
-
MenuItem,
|
|
1869
|
+
menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1870
|
+
ui.MenuItem,
|
|
1879
1871
|
{
|
|
1880
1872
|
disabled: operatorType === selectedOperatorType,
|
|
1881
1873
|
fontSize: 1,
|
|
@@ -1884,11 +1876,11 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
1884
1876
|
text: operators[operatorType].label
|
|
1885
1877
|
},
|
|
1886
1878
|
operatorType
|
|
1887
|
-
) : /* @__PURE__ */ jsx(MenuDivider, {}, index)) }),
|
|
1879
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index)) }),
|
|
1888
1880
|
popover: popoverProps
|
|
1889
1881
|
}
|
|
1890
1882
|
),
|
|
1891
|
-
/* @__PURE__ */ jsx(Box, { marginX: 1, style: { maxWidth: "50px" }, children: /* @__PURE__ */ jsx(
|
|
1883
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginX: 1, style: { maxWidth: "50px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1892
1884
|
TextInputNumber,
|
|
1893
1885
|
{
|
|
1894
1886
|
fontSize: 1,
|
|
@@ -1899,23 +1891,23 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
1899
1891
|
value: facet?.value
|
|
1900
1892
|
}
|
|
1901
1893
|
) }),
|
|
1902
|
-
modifiers && /* @__PURE__ */ jsx(
|
|
1903
|
-
MenuButton,
|
|
1894
|
+
modifiers && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1895
|
+
ui.MenuButton,
|
|
1904
1896
|
{
|
|
1905
|
-
button: /* @__PURE__ */ jsx(
|
|
1906
|
-
Button,
|
|
1897
|
+
button: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1898
|
+
ui.Button,
|
|
1907
1899
|
{
|
|
1908
1900
|
fontSize: 1,
|
|
1909
|
-
iconRight: SelectIcon,
|
|
1901
|
+
iconRight: icons.SelectIcon,
|
|
1910
1902
|
padding: 2,
|
|
1911
1903
|
text: selectedModifier?.title
|
|
1912
1904
|
}
|
|
1913
1905
|
),
|
|
1914
1906
|
id: "modifier",
|
|
1915
|
-
menu: /* @__PURE__ */ jsx(Menu
|
|
1907
|
+
menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: modifiers.map((modifier) => {
|
|
1916
1908
|
const selected = modifier.name === facet.modifier;
|
|
1917
|
-
return /* @__PURE__ */ jsx(
|
|
1918
|
-
MenuItem,
|
|
1909
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1910
|
+
ui.MenuItem,
|
|
1919
1911
|
{
|
|
1920
1912
|
disabled: selected,
|
|
1921
1913
|
fontSize: 1,
|
|
@@ -1931,27 +1923,27 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
1931
1923
|
)
|
|
1932
1924
|
] });
|
|
1933
1925
|
}, SearchFacetSelect = ({ facet }) => {
|
|
1934
|
-
const dispatch = useDispatch(), popoverProps = usePortalPopoverProps(), options = facet?.options, selectedItem = options?.find((v) => v.name === facet?.value), handleListItemClick = (option) => {
|
|
1926
|
+
const dispatch = reactRedux.useDispatch(), popoverProps = usePortalPopoverProps(), options = facet?.options, selectedItem = options?.find((v) => v.name === facet?.value), handleListItemClick = (option) => {
|
|
1935
1927
|
dispatch(searchActions.facetsUpdate({ name: facet.name, value: option.name }));
|
|
1936
1928
|
}, handleOperatorItemClick = (operatorType) => {
|
|
1937
1929
|
dispatch(searchActions.facetsUpdate({ name: facet.name, operatorType }));
|
|
1938
1930
|
}, selectedOperatorType = facet?.operatorType ?? "is";
|
|
1939
|
-
return /* @__PURE__ */ jsxs(SearchFacet, { facet, children: [
|
|
1940
|
-
facet?.operatorTypes && /* @__PURE__ */ jsx(
|
|
1941
|
-
MenuButton,
|
|
1931
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(SearchFacet, { facet, children: [
|
|
1932
|
+
facet?.operatorTypes && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1933
|
+
ui.MenuButton,
|
|
1942
1934
|
{
|
|
1943
|
-
button: /* @__PURE__ */ jsx(Box, { marginRight: 1, children: /* @__PURE__ */ jsx(
|
|
1944
|
-
Button,
|
|
1935
|
+
button: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1936
|
+
ui.Button,
|
|
1945
1937
|
{
|
|
1946
1938
|
fontSize: 1,
|
|
1947
|
-
iconRight: SelectIcon,
|
|
1939
|
+
iconRight: icons.SelectIcon,
|
|
1948
1940
|
padding: 2,
|
|
1949
1941
|
text: operators[selectedOperatorType].label
|
|
1950
1942
|
}
|
|
1951
1943
|
) }),
|
|
1952
1944
|
id: "operators",
|
|
1953
|
-
menu: /* @__PURE__ */ jsx(Menu
|
|
1954
|
-
MenuItem,
|
|
1945
|
+
menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1946
|
+
ui.MenuItem,
|
|
1955
1947
|
{
|
|
1956
1948
|
disabled: operatorType === selectedOperatorType,
|
|
1957
1949
|
fontSize: 1,
|
|
@@ -1960,19 +1952,19 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
1960
1952
|
text: operators[operatorType].label
|
|
1961
1953
|
},
|
|
1962
1954
|
operatorType
|
|
1963
|
-
) : /* @__PURE__ */ jsx(MenuDivider, {}, index)) }),
|
|
1955
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index)) }),
|
|
1964
1956
|
popover: popoverProps
|
|
1965
1957
|
}
|
|
1966
1958
|
),
|
|
1967
|
-
/* @__PURE__ */ jsx(
|
|
1968
|
-
MenuButton,
|
|
1959
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1960
|
+
ui.MenuButton,
|
|
1969
1961
|
{
|
|
1970
|
-
button: /* @__PURE__ */ jsx(Button, { fontSize: 1, iconRight: SelectIcon, padding: 2, text: selectedItem?.title }),
|
|
1962
|
+
button: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { fontSize: 1, iconRight: icons.SelectIcon, padding: 2, text: selectedItem?.title }),
|
|
1971
1963
|
id: "list",
|
|
1972
|
-
menu: /* @__PURE__ */ jsx(Menu
|
|
1964
|
+
menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: options?.map((item, index) => {
|
|
1973
1965
|
const selected = item.name === selectedItem?.name;
|
|
1974
|
-
return /* @__PURE__ */ jsx(
|
|
1975
|
-
MenuItem,
|
|
1966
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1967
|
+
ui.MenuItem,
|
|
1976
1968
|
{
|
|
1977
1969
|
disabled: selected,
|
|
1978
1970
|
fontSize: 1,
|
|
@@ -1988,27 +1980,27 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
1988
1980
|
)
|
|
1989
1981
|
] });
|
|
1990
1982
|
}, SearchFacetString = ({ facet }) => {
|
|
1991
|
-
const dispatch = useDispatch(), popoverProps = usePortalPopoverProps(), handleOperatorItemClick = (operatorType) => {
|
|
1983
|
+
const dispatch = reactRedux.useDispatch(), popoverProps = usePortalPopoverProps(), handleOperatorItemClick = (operatorType) => {
|
|
1992
1984
|
dispatch(searchActions.facetsUpdateById({ id: facet.id, operatorType }));
|
|
1993
1985
|
}, handleChange = (e) => {
|
|
1994
1986
|
dispatch(searchActions.facetsUpdateById({ id: facet.id, value: e.target.value }));
|
|
1995
1987
|
}, selectedOperatorType = facet.operatorType;
|
|
1996
|
-
return /* @__PURE__ */ jsxs(SearchFacet, { facet, children: [
|
|
1997
|
-
facet?.operatorTypes && /* @__PURE__ */ jsx(
|
|
1998
|
-
MenuButton,
|
|
1988
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(SearchFacet, { facet, children: [
|
|
1989
|
+
facet?.operatorTypes && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1990
|
+
ui.MenuButton,
|
|
1999
1991
|
{
|
|
2000
|
-
button: /* @__PURE__ */ jsx(
|
|
2001
|
-
Button,
|
|
1992
|
+
button: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1993
|
+
ui.Button,
|
|
2002
1994
|
{
|
|
2003
1995
|
fontSize: 1,
|
|
2004
|
-
iconRight: SelectIcon,
|
|
1996
|
+
iconRight: icons.SelectIcon,
|
|
2005
1997
|
padding: 2,
|
|
2006
1998
|
text: operators[selectedOperatorType].label
|
|
2007
1999
|
}
|
|
2008
2000
|
),
|
|
2009
2001
|
id: "operators",
|
|
2010
|
-
menu: /* @__PURE__ */ jsx(Menu
|
|
2011
|
-
MenuItem,
|
|
2002
|
+
menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2003
|
+
ui.MenuItem,
|
|
2012
2004
|
{
|
|
2013
2005
|
disabled: operatorType === selectedOperatorType,
|
|
2014
2006
|
fontSize: 1,
|
|
@@ -2017,12 +2009,12 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2017
2009
|
text: operators[operatorType].label
|
|
2018
2010
|
},
|
|
2019
2011
|
operatorType
|
|
2020
|
-
) : /* @__PURE__ */ jsx(MenuDivider, {}, index)) }),
|
|
2012
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index)) }),
|
|
2021
2013
|
popover: popoverProps
|
|
2022
2014
|
}
|
|
2023
2015
|
),
|
|
2024
|
-
!operators[selectedOperatorType].hideInput && /* @__PURE__ */ jsx(Box, { marginLeft: 1, style: { maxWidth: "125px" }, children: /* @__PURE__ */ jsx(
|
|
2025
|
-
TextInput,
|
|
2016
|
+
!operators[selectedOperatorType].hideInput && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 1, style: { maxWidth: "125px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2017
|
+
ui.TextInput,
|
|
2026
2018
|
{
|
|
2027
2019
|
fontSize: 1,
|
|
2028
2020
|
onChange: handleChange,
|
|
@@ -2039,7 +2031,7 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2039
2031
|
},
|
|
2040
2032
|
radius: themeRadius$1,
|
|
2041
2033
|
space: themeSpace$1
|
|
2042
|
-
} = studioTheme, reactSelectStyles$1 = (scheme) => ({
|
|
2034
|
+
} = ui.studioTheme, reactSelectStyles$1 = (scheme) => ({
|
|
2043
2035
|
control: (styles, { isDisabled, isFocused }) => {
|
|
2044
2036
|
let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
|
|
2045
2037
|
return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
|
|
@@ -2064,9 +2056,9 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2064
2056
|
input: (styles) => ({
|
|
2065
2057
|
...styles,
|
|
2066
2058
|
color: "var(--card-fg-color)",
|
|
2067
|
-
fontFamily: studioTheme.fonts.text.family,
|
|
2059
|
+
fontFamily: ui.studioTheme.fonts.text.family,
|
|
2068
2060
|
fontSize: themeTextSizes[1].fontSize,
|
|
2069
|
-
marginLeft: rem(themeSpace$1[2])
|
|
2061
|
+
marginLeft: ui.rem(themeSpace$1[2])
|
|
2070
2062
|
}),
|
|
2071
2063
|
menuList: (styles) => ({
|
|
2072
2064
|
...styles,
|
|
@@ -2074,7 +2066,7 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2074
2066
|
}),
|
|
2075
2067
|
noOptionsMessage: (styles) => ({
|
|
2076
2068
|
...styles,
|
|
2077
|
-
fontFamily: studioTheme.fonts.text.family,
|
|
2069
|
+
fontFamily: ui.studioTheme.fonts.text.family,
|
|
2078
2070
|
fontSize: themeTextSizes[1].fontSize,
|
|
2079
2071
|
lineHeight: "1em"
|
|
2080
2072
|
}),
|
|
@@ -2086,7 +2078,7 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2086
2078
|
fontSize: themeTextSizes[1].fontSize,
|
|
2087
2079
|
lineHeight: "1em",
|
|
2088
2080
|
margin: 0,
|
|
2089
|
-
padding: rem(themeSpace$1[1]),
|
|
2081
|
+
padding: ui.rem(themeSpace$1[1]),
|
|
2090
2082
|
"&:hover": {
|
|
2091
2083
|
backgroundColor: getSchemeColor(scheme, "spotBlue"),
|
|
2092
2084
|
color: getSchemeColor(scheme, "bg")
|
|
@@ -2095,7 +2087,7 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2095
2087
|
placeholder: (styles) => ({
|
|
2096
2088
|
...styles,
|
|
2097
2089
|
fontSize: themeTextSizes[1].fontSize,
|
|
2098
|
-
marginLeft: rem(themeSpace$1[2]),
|
|
2090
|
+
marginLeft: ui.rem(themeSpace$1[2]),
|
|
2099
2091
|
paddingLeft: 0
|
|
2100
2092
|
}),
|
|
2101
2093
|
singleValue: (styles) => ({
|
|
@@ -2103,41 +2095,41 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2103
2095
|
alignItems: "center",
|
|
2104
2096
|
display: "inline-flex",
|
|
2105
2097
|
height: "100%",
|
|
2106
|
-
marginLeft: rem(themeSpace$1[2])
|
|
2098
|
+
marginLeft: ui.rem(themeSpace$1[2])
|
|
2107
2099
|
}),
|
|
2108
2100
|
valueContainer: (styles) => ({
|
|
2109
2101
|
...styles,
|
|
2110
2102
|
margin: 0,
|
|
2111
2103
|
padding: 0
|
|
2112
2104
|
})
|
|
2113
|
-
}), ClearIndicator = (props) => /* @__PURE__ */ jsx(components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsx(
|
|
2114
|
-
Box,
|
|
2105
|
+
}), ClearIndicator = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2106
|
+
ui.Box,
|
|
2115
2107
|
{
|
|
2116
2108
|
paddingRight: 1,
|
|
2117
2109
|
style: {
|
|
2118
2110
|
transform: "scale(0.85)"
|
|
2119
2111
|
},
|
|
2120
|
-
children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsx(CloseIcon, {}) })
|
|
2112
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, {}) })
|
|
2121
2113
|
}
|
|
2122
|
-
) }), Menu$1 = (props) => /* @__PURE__ */ jsx(components.Menu, { ...props, children: /* @__PURE__ */ jsx(Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList$1 = (props) => {
|
|
2114
|
+
) }), Menu$1 = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.Menu, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList$1 = (props) => {
|
|
2123
2115
|
const { children } = props, MAX_ROWS = 5, OPTION_HEIGHT = 33;
|
|
2124
2116
|
if (Array.isArray(children)) {
|
|
2125
2117
|
const height = children.length > MAX_ROWS ? OPTION_HEIGHT * MAX_ROWS : children.length * OPTION_HEIGHT;
|
|
2126
|
-
return /* @__PURE__ */ jsx(
|
|
2127
|
-
Virtuoso,
|
|
2118
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2119
|
+
reactVirtuoso.Virtuoso,
|
|
2128
2120
|
{
|
|
2129
2121
|
className: "media__custom-scrollbar",
|
|
2130
2122
|
itemContent: (index) => {
|
|
2131
2123
|
const item = children[index];
|
|
2132
|
-
return /* @__PURE__ */ jsx(Option$1, { ...item.props });
|
|
2124
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Option$1, { ...item.props });
|
|
2133
2125
|
},
|
|
2134
2126
|
style: { height },
|
|
2135
2127
|
totalCount: children.length
|
|
2136
2128
|
}
|
|
2137
2129
|
);
|
|
2138
2130
|
}
|
|
2139
|
-
return /* @__PURE__ */ jsx(components.MenuList, { ...props, children });
|
|
2140
|
-
}, NoOptionsMessage = (props) => /* @__PURE__ */ jsx(components.NoOptionsMessage, { ...props, children: props.children }), Option$1 = (props) => /* @__PURE__ */ jsx(Box, { padding: 1, children: /* @__PURE__ */ jsx(components.Option, { ...props, children: /* @__PURE__ */ jsx(Box, { paddingY: 1, children: /* @__PURE__ */ jsx(Text, { size: 1, style: { color: "inherit" }, textOverflow: "ellipsis", children: props.children }) }) }) }), SingleValue = (props) => /* @__PURE__ */ jsx(components.SingleValue, { ...props, children: /* @__PURE__ */ jsx(Text, { size: 1, textOverflow: "ellipsis", children: props.children }) }), reactSelectComponents$1 = {
|
|
2131
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Select.components.MenuList, { ...props, children });
|
|
2132
|
+
}, NoOptionsMessage = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.NoOptionsMessage, { ...props, children: props.children }), Option$1 = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Select.components.Option, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingY: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, style: { color: "inherit" }, textOverflow: "ellipsis", children: props.children }) }) }) }), SingleValue = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.SingleValue, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, textOverflow: "ellipsis", children: props.children }) }), reactSelectComponents$1 = {
|
|
2141
2133
|
ClearIndicator,
|
|
2142
2134
|
DropdownIndicator: null,
|
|
2143
2135
|
IndicatorSeparator: null,
|
|
@@ -2147,7 +2139,7 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2147
2139
|
Option: Option$1,
|
|
2148
2140
|
SingleValue
|
|
2149
2141
|
}, SearchFacetTags = ({ facet }) => {
|
|
2150
|
-
const scheme = useColorSchemeValue(), dispatch = useDispatch(), tags = useTypedSelector((state) => selectTags(state)), tagsFetching = useTypedSelector((state) => state.tags.fetching), allTagOptions = getTagSelectOptions(tags), popoverProps = usePortalPopoverProps(), handleChange = (option) => {
|
|
2142
|
+
const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), tags = useTypedSelector((state) => selectTags(state)), tagsFetching = useTypedSelector((state) => state.tags.fetching), allTagOptions = getTagSelectOptions(tags), popoverProps = usePortalPopoverProps(), handleChange = (option) => {
|
|
2151
2143
|
dispatch(
|
|
2152
2144
|
searchActions.facetsUpdateById({
|
|
2153
2145
|
id: facet.id,
|
|
@@ -2162,22 +2154,22 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2162
2154
|
})
|
|
2163
2155
|
);
|
|
2164
2156
|
}, selectedOperatorType = facet.operatorType;
|
|
2165
|
-
return /* @__PURE__ */ jsxs(SearchFacet, { facet, children: [
|
|
2166
|
-
facet?.operatorTypes && /* @__PURE__ */ jsx(
|
|
2167
|
-
MenuButton,
|
|
2157
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(SearchFacet, { facet, children: [
|
|
2158
|
+
facet?.operatorTypes && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2159
|
+
ui.MenuButton,
|
|
2168
2160
|
{
|
|
2169
|
-
button: /* @__PURE__ */ jsx(
|
|
2170
|
-
Button,
|
|
2161
|
+
button: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2162
|
+
ui.Button,
|
|
2171
2163
|
{
|
|
2172
2164
|
fontSize: 1,
|
|
2173
|
-
iconRight: SelectIcon,
|
|
2165
|
+
iconRight: icons.SelectIcon,
|
|
2174
2166
|
padding: 2,
|
|
2175
2167
|
text: operators[selectedOperatorType].label
|
|
2176
2168
|
}
|
|
2177
2169
|
),
|
|
2178
2170
|
id: "operators",
|
|
2179
|
-
menu: /* @__PURE__ */ jsx(Menu
|
|
2180
|
-
MenuItem,
|
|
2171
|
+
menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2172
|
+
ui.MenuItem,
|
|
2181
2173
|
{
|
|
2182
2174
|
disabled: operatorType === selectedOperatorType,
|
|
2183
2175
|
fontSize: 1,
|
|
@@ -2188,12 +2180,12 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2188
2180
|
text: operators[operatorType].label
|
|
2189
2181
|
},
|
|
2190
2182
|
operatorType
|
|
2191
|
-
) : /* @__PURE__ */ jsx(MenuDivider, {}, index)) }),
|
|
2183
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index)) }),
|
|
2192
2184
|
popover: popoverProps
|
|
2193
2185
|
}
|
|
2194
2186
|
),
|
|
2195
|
-
!operators[selectedOperatorType].hideInput && /* @__PURE__ */ jsx(Box, { marginX: 1, style: { width: "160px" }, children: /* @__PURE__ */ jsx(
|
|
2196
|
-
|
|
2187
|
+
!operators[selectedOperatorType].hideInput && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginX: 1, style: { width: "160px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2188
|
+
Select__default.default,
|
|
2197
2189
|
{
|
|
2198
2190
|
components: reactSelectComponents$1,
|
|
2199
2191
|
instanceId: "facet-searchable",
|
|
@@ -2210,22 +2202,22 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2210
2202
|
}
|
|
2211
2203
|
) })
|
|
2212
2204
|
] });
|
|
2213
|
-
}, StackContainer = styled(Flex)(({ theme }) => css`
|
|
2205
|
+
}, StackContainer = styledComponents.styled(ui.Flex)(({ theme }) => styledComponents.css`
|
|
2214
2206
|
> * {
|
|
2215
|
-
margin-bottom: ${rem(theme.sanity.space[2])};
|
|
2207
|
+
margin-bottom: ${ui.rem(theme.sanity.space[2])};
|
|
2216
2208
|
}
|
|
2217
2209
|
`), SearchFacets = (props) => {
|
|
2218
2210
|
const { layout = "inline" } = props, searchFacets = useTypedSelector((state) => state.search.facets), Items2 = searchFacets.map((facet) => {
|
|
2219
2211
|
const key = facet.id;
|
|
2220
|
-
return facet.type === "number" ? /* @__PURE__ */ jsx(SearchFacetNumber, { facet }, key) : facet.type === "searchable" ? /* @__PURE__ */ jsx(SearchFacetTags, { facet }, key) : facet.type === "select" ? /* @__PURE__ */ jsx(SearchFacetSelect, { facet }, key) : facet.type === "string" ? /* @__PURE__ */ jsx(SearchFacetString, { facet }, key) : null;
|
|
2212
|
+
return facet.type === "number" ? /* @__PURE__ */ jsxRuntime.jsx(SearchFacetNumber, { facet }, key) : facet.type === "searchable" ? /* @__PURE__ */ jsxRuntime.jsx(SearchFacetTags, { facet }, key) : facet.type === "select" ? /* @__PURE__ */ jsxRuntime.jsx(SearchFacetSelect, { facet }, key) : facet.type === "string" ? /* @__PURE__ */ jsxRuntime.jsx(SearchFacetString, { facet }, key) : null;
|
|
2221
2213
|
});
|
|
2222
2214
|
if (layout === "inline")
|
|
2223
|
-
return searchFacets.length === 0 ? null : /* @__PURE__ */ jsx(Box, { marginBottom: 2, children: /* @__PURE__ */ jsx(Inline, { space: 2, children: Items2 }) });
|
|
2215
|
+
return searchFacets.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginBottom: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Inline, { space: 2, children: Items2 }) });
|
|
2224
2216
|
if (layout === "stack")
|
|
2225
|
-
return /* @__PURE__ */ jsx(StackContainer, { align: "flex-start", direction: "column", children: Items2 });
|
|
2217
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StackContainer, { align: "flex-start", direction: "column", children: Items2 });
|
|
2226
2218
|
throw Error("Invalid layout");
|
|
2227
|
-
}, ToolOptionsContext = createContext(null), ToolOptionsProvider = ({ options, children }) => {
|
|
2228
|
-
const value = useMemo(() => {
|
|
2219
|
+
}, ToolOptionsContext = react.createContext(null), ToolOptionsProvider = ({ options, children }) => {
|
|
2220
|
+
const value = react.useMemo(() => {
|
|
2229
2221
|
let creditLineExcludeSources;
|
|
2230
2222
|
return options?.creditLine?.excludeSources && (creditLineExcludeSources = Array.isArray(options?.creditLine?.excludeSources) ? options.creditLine.excludeSources : [options?.creditLine?.excludeSources]), {
|
|
2231
2223
|
dropzone: { maxSize: options?.maximumUploadSize },
|
|
@@ -2249,27 +2241,27 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2249
2241
|
options?.directUploads,
|
|
2250
2242
|
options?.locales
|
|
2251
2243
|
]);
|
|
2252
|
-
return /* @__PURE__ */ jsx(ToolOptionsContext.Provider, { value, children });
|
|
2244
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToolOptionsContext.Provider, { value, children });
|
|
2253
2245
|
}, useToolOptions = () => {
|
|
2254
|
-
const context = useContext(ToolOptionsContext);
|
|
2246
|
+
const context = react.useContext(ToolOptionsContext);
|
|
2255
2247
|
if (!context)
|
|
2256
2248
|
throw new Error("useToolOptions must be used within an ToolOptionsProvider");
|
|
2257
2249
|
return context;
|
|
2258
2250
|
}, SearchFacetsControl = () => {
|
|
2259
|
-
const dispatch = useDispatch(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), searchFacets = useTypedSelector((state) => state.search.facets), selectedDocument = useTypedSelector((state) => state.selected.document), popoverProps = usePortalPopoverProps(), { creditLine } = useToolOptions(), isTool = !selectedDocument, filteredFacets = FACETS.filter((facet) => !creditLine?.enabled && facet?.type === "string" && facet?.name === "creditLine" ? !1 : facet.type === "group" || facet.type === "divider" ? !0 : isTool ? !facet?.selectOnly : facet.assetTypes.filter(
|
|
2251
|
+
const dispatch = reactRedux.useDispatch(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), searchFacets = useTypedSelector((state) => state.search.facets), selectedDocument = useTypedSelector((state) => state.selected.document), popoverProps = usePortalPopoverProps(), { creditLine } = useToolOptions(), isTool = !selectedDocument, filteredFacets = FACETS.filter((facet) => !creditLine?.enabled && facet?.type === "string" && facet?.name === "creditLine" ? !1 : facet.type === "group" || facet.type === "divider" ? !0 : isTool ? !facet?.selectOnly : facet.assetTypes.filter(
|
|
2260
2252
|
(assetType) => assetTypes.includes(assetType)
|
|
2261
2253
|
).length > 0).filter((facet, index, facets) => {
|
|
2262
2254
|
const previousFacet = facets[index - 1];
|
|
2263
2255
|
return !(facet.type === "divider" && (index === 0 || index === facets.length - 1) || facet.type === "divider" && previousFacet?.type === "divider");
|
|
2264
|
-
}), hasSearchFacets = filteredFacets.length > 0, renderMenuFacets = (facets, level = 0) => /* @__PURE__ */ jsx(Fragment, { children: facets?.map((facet, index) => {
|
|
2256
|
+
}), hasSearchFacets = filteredFacets.length > 0, renderMenuFacets = (facets, level = 0) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: facets?.map((facet, index) => {
|
|
2265
2257
|
if (facet.type === "divider")
|
|
2266
|
-
return /* @__PURE__ */ jsx(MenuDivider, {}, index);
|
|
2258
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index);
|
|
2267
2259
|
if (facet.type === "group")
|
|
2268
|
-
return /* @__PURE__ */ jsx(MenuGroup, { text: facet.title, title: facet.title, children: renderMenuFacets(facet.facets, level + 1) }, `group-${level}-${index}`);
|
|
2260
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.MenuGroup, { text: facet.title, title: facet.title, children: renderMenuFacets(facet.facets, level + 1) }, `group-${level}-${index}`);
|
|
2269
2261
|
if (facet) {
|
|
2270
2262
|
const disabled = !facet.operatorTypes && !!searchFacets.find((v) => v.name === facet.name);
|
|
2271
|
-
return /* @__PURE__ */ jsx(
|
|
2272
|
-
MenuItem,
|
|
2263
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2264
|
+
ui.MenuItem,
|
|
2273
2265
|
{
|
|
2274
2266
|
disabled,
|
|
2275
2267
|
fontSize: 1,
|
|
@@ -2282,16 +2274,16 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2282
2274
|
}
|
|
2283
2275
|
return null;
|
|
2284
2276
|
}) });
|
|
2285
|
-
return /* @__PURE__ */ jsxs(Flex, { children: [
|
|
2286
|
-
/* @__PURE__ */ jsx(
|
|
2287
|
-
MenuButton,
|
|
2277
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
|
|
2278
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2279
|
+
ui.MenuButton,
|
|
2288
2280
|
{
|
|
2289
|
-
button: /* @__PURE__ */ jsx(
|
|
2290
|
-
Button,
|
|
2281
|
+
button: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2282
|
+
ui.Button,
|
|
2291
2283
|
{
|
|
2292
2284
|
disabled: !hasSearchFacets,
|
|
2293
2285
|
fontSize: 1,
|
|
2294
|
-
icon: AddIcon,
|
|
2286
|
+
icon: icons.AddIcon,
|
|
2295
2287
|
mode: "bleed",
|
|
2296
2288
|
space: 2,
|
|
2297
2289
|
text: "Add filter",
|
|
@@ -2299,15 +2291,15 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2299
2291
|
}
|
|
2300
2292
|
),
|
|
2301
2293
|
id: "facets",
|
|
2302
|
-
menu: /* @__PURE__ */ jsx(Menu
|
|
2294
|
+
menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: renderMenuFacets(filteredFacets) }),
|
|
2303
2295
|
popover: {
|
|
2304
2296
|
...popoverProps,
|
|
2305
2297
|
placement: "right-start"
|
|
2306
2298
|
}
|
|
2307
2299
|
}
|
|
2308
2300
|
),
|
|
2309
|
-
searchFacets.length > 0 && /* @__PURE__ */ jsx(
|
|
2310
|
-
Button,
|
|
2301
|
+
searchFacets.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2302
|
+
ui.Button,
|
|
2311
2303
|
{
|
|
2312
2304
|
fontSize: 1,
|
|
2313
2305
|
mode: "bleed",
|
|
@@ -2316,7 +2308,7 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2316
2308
|
}
|
|
2317
2309
|
)
|
|
2318
2310
|
] });
|
|
2319
|
-
}, TagIcon = () => /* @__PURE__ */ jsxs(
|
|
2311
|
+
}, TagIcon = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2320
2312
|
"svg",
|
|
2321
2313
|
{
|
|
2322
2314
|
"data-sanity-icon": "media__tag",
|
|
@@ -2327,7 +2319,7 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2327
2319
|
viewBox: "0 0 512 512",
|
|
2328
2320
|
width: "1em",
|
|
2329
2321
|
children: [
|
|
2330
|
-
/* @__PURE__ */ jsx(
|
|
2322
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2331
2323
|
"path",
|
|
2332
2324
|
{
|
|
2333
2325
|
d: "M435.25 48h-122.9a14.46 14.46 0 00-10.2 4.2L56.45 297.9a28.85 28.85 0 000 40.7l117 117a28.85 28.85 0 0040.7 0L459.75 210a14.46 14.46 0 004.2-10.2v-123a28.66 28.66 0 00-28.7-28.8z",
|
|
@@ -2337,29 +2329,29 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2337
2329
|
strokeWidth: "32"
|
|
2338
2330
|
}
|
|
2339
2331
|
),
|
|
2340
|
-
/* @__PURE__ */ jsx("path", { d: "M384 160a32 32 0 1132-32 32 32 0 01-32 32z" })
|
|
2332
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M384 160a32 32 0 1132-32 32 32 0 01-32 32z" })
|
|
2341
2333
|
]
|
|
2342
2334
|
}
|
|
2343
2335
|
), TextInputSearch = () => {
|
|
2344
|
-
const searchQuery = useTypedSelector((state) => state.search.query), dispatch = useDispatch(), handleChange = (e) => {
|
|
2336
|
+
const searchQuery = useTypedSelector((state) => state.search.query), dispatch = reactRedux.useDispatch(), handleChange = (e) => {
|
|
2345
2337
|
dispatch(searchActions.querySet({ searchQuery: e.currentTarget.value }));
|
|
2346
2338
|
}, handleClear = () => {
|
|
2347
2339
|
dispatch(searchActions.querySet({ searchQuery: "" }));
|
|
2348
2340
|
};
|
|
2349
|
-
return /* @__PURE__ */ jsxs(Box, { style: { position: "relative" }, children: [
|
|
2350
|
-
/* @__PURE__ */ jsx(
|
|
2351
|
-
TextInput,
|
|
2341
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { position: "relative" }, children: [
|
|
2342
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2343
|
+
ui.TextInput,
|
|
2352
2344
|
{
|
|
2353
2345
|
fontSize: 1,
|
|
2354
|
-
icon: SearchIcon,
|
|
2346
|
+
icon: icons.SearchIcon,
|
|
2355
2347
|
onChange: handleChange,
|
|
2356
2348
|
placeholder: "Search",
|
|
2357
2349
|
radius: 2,
|
|
2358
2350
|
value: searchQuery
|
|
2359
2351
|
}
|
|
2360
2352
|
),
|
|
2361
|
-
searchQuery.length > 0 && /* @__PURE__ */ jsx(
|
|
2362
|
-
Flex,
|
|
2353
|
+
searchQuery.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2354
|
+
ui.Flex,
|
|
2363
2355
|
{
|
|
2364
2356
|
align: "center",
|
|
2365
2357
|
justify: "center",
|
|
@@ -2375,20 +2367,20 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2375
2367
|
zIndex: 1
|
|
2376
2368
|
// force stacking context
|
|
2377
2369
|
},
|
|
2378
|
-
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
2370
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, {})
|
|
2379
2371
|
}
|
|
2380
2372
|
)
|
|
2381
2373
|
] });
|
|
2382
2374
|
}, Controls = () => {
|
|
2383
|
-
const dispatch = useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), pageIndex = useTypedSelector((state) => state.assets.pageIndex), searchFacets = useTypedSelector((state) => state.search.facets), tagsPanelVisible = useTypedSelector((state) => state.tags.panelVisible), mediaIndex = useMediaIndex(), handleShowSearchFacetDialog = () => {
|
|
2375
|
+
const dispatch = reactRedux.useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), pageIndex = useTypedSelector((state) => state.assets.pageIndex), searchFacets = useTypedSelector((state) => state.search.facets), tagsPanelVisible = useTypedSelector((state) => state.tags.panelVisible), mediaIndex = ui.useMediaIndex(), handleShowSearchFacetDialog = () => {
|
|
2384
2376
|
dispatch(dialogActions.showSearchFacets());
|
|
2385
2377
|
}, handleShowTagsDialog = () => {
|
|
2386
2378
|
dispatch(dialogActions.showTags());
|
|
2387
2379
|
}, toggleTagsPanelToggle = () => {
|
|
2388
2380
|
dispatch(tagsActions.panelVisibleSet({ panelVisible: !tagsPanelVisible }));
|
|
2389
2381
|
};
|
|
2390
|
-
return /* @__PURE__ */ jsxs(
|
|
2391
|
-
Box,
|
|
2382
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2383
|
+
ui.Box,
|
|
2392
2384
|
{
|
|
2393
2385
|
paddingY: 2,
|
|
2394
2386
|
style: {
|
|
@@ -2396,14 +2388,14 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2396
2388
|
zIndex: 2
|
|
2397
2389
|
},
|
|
2398
2390
|
children: [
|
|
2399
|
-
/* @__PURE__ */ jsx(Box, { marginBottom: 2, children: /* @__PURE__ */ jsx(
|
|
2400
|
-
Flex,
|
|
2391
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginBottom: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2392
|
+
ui.Flex,
|
|
2401
2393
|
{
|
|
2402
2394
|
align: "flex-start",
|
|
2403
2395
|
direction: ["column", "column", "column", "column", "row"],
|
|
2404
2396
|
justify: "space-between",
|
|
2405
|
-
children: /* @__PURE__ */ jsxs(
|
|
2406
|
-
Flex,
|
|
2397
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2398
|
+
ui.Flex,
|
|
2407
2399
|
{
|
|
2408
2400
|
flex: 1,
|
|
2409
2401
|
style: {
|
|
@@ -2415,14 +2407,14 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2415
2407
|
width: "100%"
|
|
2416
2408
|
},
|
|
2417
2409
|
children: [
|
|
2418
|
-
/* @__PURE__ */ jsx(Box, { marginX: 2, style: { minWidth: "200px" }, children: /* @__PURE__ */ jsx(TextInputSearch, {}) }),
|
|
2419
|
-
/* @__PURE__ */ jsxs(Box, { display: ["none", "none", "block"], children: [
|
|
2420
|
-
/* @__PURE__ */ jsx(SearchFacets, {}),
|
|
2421
|
-
/* @__PURE__ */ jsx(SearchFacetsControl, {})
|
|
2410
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginX: 2, style: { minWidth: "200px" }, children: /* @__PURE__ */ jsxRuntime.jsx(TextInputSearch, {}) }),
|
|
2411
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: ["none", "none", "block"], children: [
|
|
2412
|
+
/* @__PURE__ */ jsxRuntime.jsx(SearchFacets, {}),
|
|
2413
|
+
/* @__PURE__ */ jsxRuntime.jsx(SearchFacetsControl, {})
|
|
2422
2414
|
] }),
|
|
2423
|
-
/* @__PURE__ */ jsx(Box, { display: ["block", "block", "none"], marginX: 2, children: /* @__PURE__ */ jsxs(Inline, { space: 2, style: { whiteSpace: "nowrap" }, children: [
|
|
2424
|
-
/* @__PURE__ */ jsx(
|
|
2425
|
-
Button,
|
|
2415
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { display: ["block", "block", "none"], marginX: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 2, style: { whiteSpace: "nowrap" }, children: [
|
|
2416
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2417
|
+
ui.Button,
|
|
2426
2418
|
{
|
|
2427
2419
|
fontSize: 1,
|
|
2428
2420
|
mode: "ghost",
|
|
@@ -2431,8 +2423,8 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2431
2423
|
tone: "primary"
|
|
2432
2424
|
}
|
|
2433
2425
|
),
|
|
2434
|
-
/* @__PURE__ */ jsx(
|
|
2435
|
-
Button,
|
|
2426
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2427
|
+
ui.Button,
|
|
2436
2428
|
{
|
|
2437
2429
|
fontSize: 1,
|
|
2438
2430
|
mode: "ghost",
|
|
@@ -2447,15 +2439,15 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2447
2439
|
)
|
|
2448
2440
|
}
|
|
2449
2441
|
) }),
|
|
2450
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Flex, { align: "center", justify: ["space-between"], children: [
|
|
2451
|
-
/* @__PURE__ */ jsx(Box, { marginX: 2, children: /* @__PURE__ */ jsx(ButtonViewGroup, {}) }),
|
|
2452
|
-
/* @__PURE__ */ jsxs(Flex, { marginX: 2, children: [
|
|
2453
|
-
/* @__PURE__ */ jsx(OrderSelect, {}),
|
|
2454
|
-
/* @__PURE__ */ jsx(Box, { display: ["none", "none", "block"], marginLeft: 2, children: /* @__PURE__ */ jsx(
|
|
2455
|
-
Button,
|
|
2442
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: ["space-between"], children: [
|
|
2443
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginX: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ButtonViewGroup, {}) }),
|
|
2444
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { marginX: 2, children: [
|
|
2445
|
+
/* @__PURE__ */ jsxRuntime.jsx(OrderSelect, {}),
|
|
2446
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { display: ["none", "none", "block"], marginLeft: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2447
|
+
ui.Button,
|
|
2456
2448
|
{
|
|
2457
2449
|
fontSize: 1,
|
|
2458
|
-
icon: /* @__PURE__ */ jsx(Box, { style: { transform: "scale(0.75)" }, children: /* @__PURE__ */ jsx(TagIcon, {}) }),
|
|
2450
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { transform: "scale(0.75)" }, children: /* @__PURE__ */ jsxRuntime.jsx(TagIcon, {}) }),
|
|
2459
2451
|
onClick: toggleTagsPanelToggle,
|
|
2460
2452
|
mode: tagsPanelVisible ? "default" : "ghost",
|
|
2461
2453
|
text: tagsPanelVisible ? "Tags" : ""
|
|
@@ -2463,14 +2455,14 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2463
2455
|
) })
|
|
2464
2456
|
] })
|
|
2465
2457
|
] }) }),
|
|
2466
|
-
/* @__PURE__ */ jsx(Progress, { loading: fetching }, pageIndex)
|
|
2458
|
+
/* @__PURE__ */ jsxRuntime.jsx(Progress, { loading: fetching }, pageIndex)
|
|
2467
2459
|
]
|
|
2468
2460
|
}
|
|
2469
2461
|
);
|
|
2470
2462
|
}, initialState$3 = {
|
|
2471
2463
|
badConnection: !1,
|
|
2472
2464
|
enabled: !1
|
|
2473
|
-
}, debugSlice = createSlice({
|
|
2465
|
+
}, debugSlice = toolkit.createSlice({
|
|
2474
2466
|
name: "debug",
|
|
2475
2467
|
initialState: initialState$3,
|
|
2476
2468
|
reducers: {
|
|
@@ -2484,14 +2476,14 @@ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
|
|
|
2484
2476
|
}), debugActions = { ...debugSlice.actions };
|
|
2485
2477
|
var debugReducer = debugSlice.reducer;
|
|
2486
2478
|
const DebugControls = () => {
|
|
2487
|
-
const dispatch = useDispatch(), badConnection = useTypedSelector((state) => state.debug.badConnection), debugEnabled = useTypedSelector((state) => state.debug.enabled), handleChange = (e) => {
|
|
2479
|
+
const dispatch = reactRedux.useDispatch(), badConnection = useTypedSelector((state) => state.debug.badConnection), debugEnabled = useTypedSelector((state) => state.debug.enabled), handleChange = (e) => {
|
|
2488
2480
|
const checked = e.target.checked;
|
|
2489
2481
|
dispatch(debugActions.setBadConnection(checked));
|
|
2490
2482
|
};
|
|
2491
2483
|
return useKeyPress("alt+ctrl+shift+/", () => {
|
|
2492
2484
|
dispatch(debugActions.toggleEnabled());
|
|
2493
|
-
}), debugEnabled ? /* @__PURE__ */ jsx(
|
|
2494
|
-
Box,
|
|
2485
|
+
}), debugEnabled ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2486
|
+
ui.Box,
|
|
2495
2487
|
{
|
|
2496
2488
|
padding: 4,
|
|
2497
2489
|
style: {
|
|
@@ -2501,18 +2493,18 @@ const DebugControls = () => {
|
|
|
2501
2493
|
position: "fixed",
|
|
2502
2494
|
width: "100%"
|
|
2503
2495
|
},
|
|
2504
|
-
children: /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
|
|
2505
|
-
/* @__PURE__ */ jsx(Box, { marginRight: 3, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsx(PlugIcon, {}) }) }),
|
|
2506
|
-
/* @__PURE__ */ jsx(
|
|
2507
|
-
Tooltip,
|
|
2496
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
|
|
2497
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginRight: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(icons.PlugIcon, {}) }) }),
|
|
2498
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2499
|
+
ui.Tooltip,
|
|
2508
2500
|
{
|
|
2509
2501
|
animate: !0,
|
|
2510
|
-
content: /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: badConnection ? "Bad connection: +3000ms & 50% chance to fail" : "No connection throttling" }) }),
|
|
2502
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: badConnection ? "Bad connection: +3000ms & 50% chance to fail" : "No connection throttling" }) }),
|
|
2511
2503
|
fallbackPlacements: ["right", "left"],
|
|
2512
2504
|
placement: "bottom",
|
|
2513
2505
|
portal: !0,
|
|
2514
|
-
children: /* @__PURE__ */ jsx(
|
|
2515
|
-
Switch,
|
|
2506
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2507
|
+
ui.Switch,
|
|
2516
2508
|
{
|
|
2517
2509
|
checked: badConnection,
|
|
2518
2510
|
onChange: handleChange,
|
|
@@ -2529,33 +2521,33 @@ const DebugControls = () => {
|
|
|
2529
2521
|
};
|
|
2530
2522
|
function localizedStringSchema(locales) {
|
|
2531
2523
|
if (!locales || locales.length === 0)
|
|
2532
|
-
return
|
|
2524
|
+
return z__namespace.string().trim().optional();
|
|
2533
2525
|
const shape = {};
|
|
2534
2526
|
for (const locale of locales)
|
|
2535
|
-
shape[locale.id] =
|
|
2536
|
-
return
|
|
2527
|
+
shape[locale.id] = z__namespace.string().trim().optional();
|
|
2528
|
+
return z__namespace.object(shape).passthrough();
|
|
2537
2529
|
}
|
|
2538
|
-
const tagOptionSchema =
|
|
2539
|
-
label:
|
|
2540
|
-
value:
|
|
2530
|
+
const tagOptionSchema = z__namespace.object({
|
|
2531
|
+
label: z__namespace.string().trim().min(1, { message: "Label cannot be empty" }),
|
|
2532
|
+
value: z__namespace.string().trim().min(1, { message: "Value cannot be empty" })
|
|
2541
2533
|
});
|
|
2542
2534
|
function getAssetFormSchema(locales) {
|
|
2543
|
-
return
|
|
2535
|
+
return z__namespace.object({
|
|
2544
2536
|
altText: localizedStringSchema(locales),
|
|
2545
2537
|
creditLine: localizedStringSchema(locales),
|
|
2546
2538
|
description: localizedStringSchema(locales),
|
|
2547
|
-
opt:
|
|
2548
|
-
media:
|
|
2549
|
-
tags:
|
|
2539
|
+
opt: z__namespace.object({
|
|
2540
|
+
media: z__namespace.object({
|
|
2541
|
+
tags: z__namespace.array(tagOptionSchema).nullable()
|
|
2550
2542
|
})
|
|
2551
2543
|
}),
|
|
2552
|
-
originalFilename:
|
|
2544
|
+
originalFilename: z__namespace.string().trim().min(1, { message: "Filename cannot be empty" }),
|
|
2553
2545
|
title: localizedStringSchema(locales)
|
|
2554
2546
|
});
|
|
2555
2547
|
}
|
|
2556
2548
|
getAssetFormSchema();
|
|
2557
|
-
const tagFormSchema =
|
|
2558
|
-
name:
|
|
2549
|
+
const tagFormSchema = z__namespace.object({
|
|
2550
|
+
name: z__namespace.string().min(1, { message: "Name cannot be empty" })
|
|
2559
2551
|
});
|
|
2560
2552
|
function getUniqueDocuments(documents) {
|
|
2561
2553
|
const draftIds = documents.reduce(
|
|
@@ -2574,33 +2566,33 @@ const imageDprUrl = (asset, options) => {
|
|
|
2574
2566
|
return typeof val == "object" && val !== null && val.constructor !== Array ? acc[key] = sanitizeFormData(val) : val === "" || typeof val > "u" || val?.length === 0 ? acc[key] = null : typeof val == "string" && val ? acc[key] = formData[key].trim() : acc[key] = formData[key], acc;
|
|
2575
2567
|
}, {}), isFileAsset = (asset) => asset._type === "sanity.fileAsset", isImageAsset = (asset) => asset._type === "sanity.imageAsset";
|
|
2576
2568
|
function zodFormResolver(schema) {
|
|
2577
|
-
return zodResolver(
|
|
2569
|
+
return zod.zodResolver(
|
|
2578
2570
|
schema
|
|
2579
2571
|
);
|
|
2580
2572
|
}
|
|
2581
2573
|
const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asset.metadata.dimensions.height}px`, ButtonAssetCopy = ({ disabled, url }) => {
|
|
2582
|
-
const popoverProps = usePortalPopoverProps(), refPopoverTimeout = useRef(null), [popoverVisible, setPopoverVisible] = useState(!1), handleClick = () => {
|
|
2583
|
-
refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current), setPopoverVisible(!0),
|
|
2574
|
+
const popoverProps = usePortalPopoverProps(), refPopoverTimeout = react.useRef(null), [popoverVisible, setPopoverVisible] = react.useState(!1), handleClick = () => {
|
|
2575
|
+
refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current), setPopoverVisible(!0), copy__default.default(url), refPopoverTimeout.current = setTimeout(() => {
|
|
2584
2576
|
setPopoverVisible(!1);
|
|
2585
2577
|
}, 1250);
|
|
2586
2578
|
};
|
|
2587
|
-
return useEffect(() => () => {
|
|
2579
|
+
return react.useEffect(() => () => {
|
|
2588
2580
|
refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current);
|
|
2589
|
-
}, []), /* @__PURE__ */ jsx(
|
|
2590
|
-
Popover,
|
|
2581
|
+
}, []), /* @__PURE__ */ jsxRuntime.jsx(
|
|
2582
|
+
ui.Popover,
|
|
2591
2583
|
{
|
|
2592
|
-
content: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "Copied!" }),
|
|
2584
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: "Copied!" }),
|
|
2593
2585
|
open: popoverVisible,
|
|
2594
2586
|
padding: 2,
|
|
2595
2587
|
placement: "top",
|
|
2596
2588
|
radius: 1,
|
|
2597
2589
|
...popoverProps,
|
|
2598
|
-
children: /* @__PURE__ */ jsx(
|
|
2599
|
-
Button,
|
|
2590
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2591
|
+
ui.Button,
|
|
2600
2592
|
{
|
|
2601
2593
|
disabled,
|
|
2602
2594
|
fontSize: 1,
|
|
2603
|
-
icon: ClipboardIcon,
|
|
2595
|
+
icon: icons.ClipboardIcon,
|
|
2604
2596
|
mode: "ghost",
|
|
2605
2597
|
onClick: handleClick,
|
|
2606
2598
|
text: "Copy URL"
|
|
@@ -2608,9 +2600,9 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2608
2600
|
)
|
|
2609
2601
|
}
|
|
2610
2602
|
);
|
|
2611
|
-
}, Row = ({ label, value }) => /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
|
|
2612
|
-
/* @__PURE__ */ jsx(
|
|
2613
|
-
Text,
|
|
2603
|
+
}, Row = ({ label, value }) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "space-between", children: [
|
|
2604
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2605
|
+
ui.Text,
|
|
2614
2606
|
{
|
|
2615
2607
|
size: 1,
|
|
2616
2608
|
style: {
|
|
@@ -2621,8 +2613,8 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2621
2613
|
children: label
|
|
2622
2614
|
}
|
|
2623
2615
|
),
|
|
2624
|
-
/* @__PURE__ */ jsx(
|
|
2625
|
-
Text,
|
|
2616
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2617
|
+
ui.Text,
|
|
2626
2618
|
{
|
|
2627
2619
|
size: 1,
|
|
2628
2620
|
style: {
|
|
@@ -2638,16 +2630,16 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2638
2630
|
const { asset, item } = props, exif = asset?.metadata?.exif, handleDownload = () => {
|
|
2639
2631
|
window.location.href = `${asset.url}?dl=${asset.originalFilename}`;
|
|
2640
2632
|
};
|
|
2641
|
-
return /* @__PURE__ */ jsxs(Box, { marginTop: 3, children: [
|
|
2642
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
2643
|
-
/* @__PURE__ */ jsx(Row, { label: "Size", value:
|
|
2644
|
-
/* @__PURE__ */ jsx(Row, { label: "MIME type", value: asset?.mimeType }),
|
|
2645
|
-
/* @__PURE__ */ jsx(Row, { label: "Extension", value: (asset?.extension).toUpperCase() }),
|
|
2646
|
-
isImageAsset(asset) && /* @__PURE__ */ jsx(Row, { label: "Dimensions", value: getAssetResolution(asset) })
|
|
2633
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { marginTop: 3, children: [
|
|
2634
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
2635
|
+
/* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Size", value: filesize__default.default(asset?.size, { base: 10, round: 0 }) }),
|
|
2636
|
+
/* @__PURE__ */ jsxRuntime.jsx(Row, { label: "MIME type", value: asset?.mimeType }),
|
|
2637
|
+
/* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Extension", value: (asset?.extension).toUpperCase() }),
|
|
2638
|
+
isImageAsset(asset) && /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Dimensions", value: getAssetResolution(asset) })
|
|
2647
2639
|
] }) }),
|
|
2648
|
-
exif && (exif.DateTimeOriginal || exif.FNumber || exif.FocalLength || exif.ExposureTime || exif.ISO) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2649
|
-
/* @__PURE__ */ jsx(
|
|
2650
|
-
Box,
|
|
2640
|
+
exif && (exif.DateTimeOriginal || exif.FNumber || exif.FocalLength || exif.ExposureTime || exif.ISO) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2641
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2642
|
+
ui.Box,
|
|
2651
2643
|
{
|
|
2652
2644
|
marginY: 4,
|
|
2653
2645
|
style: {
|
|
@@ -2657,48 +2649,48 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2657
2649
|
}
|
|
2658
2650
|
}
|
|
2659
2651
|
),
|
|
2660
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
2661
|
-
exif.ISO && /* @__PURE__ */ jsx(Row, { label: "ISO", value: exif.ISO }),
|
|
2662
|
-
exif.FNumber && /* @__PURE__ */ jsx(Row, { label: "Aperture", value: `\u0192/${exif.FNumber}` }),
|
|
2663
|
-
exif.FocalLength && /* @__PURE__ */ jsx(Row, { label: "Focal length", value: `${exif.FocalLength}mm` }),
|
|
2664
|
-
exif.ExposureTime && /* @__PURE__ */ jsx(Row, { label: "Exposure time", value: `1/${1 / exif.ExposureTime}` }),
|
|
2665
|
-
exif.DateTimeOriginal && /* @__PURE__ */ jsx(
|
|
2652
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
2653
|
+
exif.ISO && /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "ISO", value: exif.ISO }),
|
|
2654
|
+
exif.FNumber && /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Aperture", value: `\u0192/${exif.FNumber}` }),
|
|
2655
|
+
exif.FocalLength && /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Focal length", value: `${exif.FocalLength}mm` }),
|
|
2656
|
+
exif.ExposureTime && /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Exposure time", value: `1/${1 / exif.ExposureTime}` }),
|
|
2657
|
+
exif.DateTimeOriginal && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2666
2658
|
Row,
|
|
2667
2659
|
{
|
|
2668
2660
|
label: "Original date",
|
|
2669
|
-
value: format(new Date(exif.DateTimeOriginal), "PPp")
|
|
2661
|
+
value: dateFns.format(new Date(exif.DateTimeOriginal), "PPp")
|
|
2670
2662
|
}
|
|
2671
2663
|
)
|
|
2672
2664
|
] }) })
|
|
2673
2665
|
] }),
|
|
2674
|
-
/* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsxs(Inline, { space: 2, children: [
|
|
2675
|
-
/* @__PURE__ */ jsx(
|
|
2676
|
-
Button,
|
|
2666
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 5, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 2, children: [
|
|
2667
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2668
|
+
ui.Button,
|
|
2677
2669
|
{
|
|
2678
2670
|
disabled: !item || item?.updating,
|
|
2679
2671
|
fontSize: 1,
|
|
2680
|
-
icon: DownloadIcon,
|
|
2672
|
+
icon: icons.DownloadIcon,
|
|
2681
2673
|
mode: "ghost",
|
|
2682
2674
|
onClick: handleDownload,
|
|
2683
2675
|
text: "Download"
|
|
2684
2676
|
}
|
|
2685
2677
|
),
|
|
2686
|
-
/* @__PURE__ */ jsx(ButtonAssetCopy, { disabled: !item || item?.updating, url: asset.url })
|
|
2678
|
+
/* @__PURE__ */ jsxRuntime.jsx(ButtonAssetCopy, { disabled: !item || item?.updating, url: asset.url })
|
|
2687
2679
|
] }) })
|
|
2688
2680
|
] });
|
|
2689
|
-
}, Dialog = (props) => /* @__PURE__ */ jsx(Dialog
|
|
2690
|
-
const schema = useSchema();
|
|
2691
|
-
return isLoading ? /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "Loading..." }) : documents.length === 0 ? /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "No documents are referencing this asset" }) : /* @__PURE__ */ jsx(Card, { flex: 1, marginBottom: 2, padding: 2, radius: 2, shadow: 1, children: /* @__PURE__ */ jsx(Stack, { space: 2, children: documents?.map((doc) => /* @__PURE__ */ jsx(ReferringDocument, { doc, schemaType: schema.get(doc._type) }, doc._id)) }) });
|
|
2681
|
+
}, Dialog = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { ...props, style: { position: "fixed" } }), DocumentList = ({ documents, isLoading }) => {
|
|
2682
|
+
const schema = sanity.useSchema();
|
|
2683
|
+
return isLoading ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: "Loading..." }) : documents.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: "No documents are referencing this asset" }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { flex: 1, marginBottom: 2, padding: 2, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 2, children: documents?.map((doc) => /* @__PURE__ */ jsxRuntime.jsx(ReferringDocument, { doc, schemaType: schema.get(doc._type) }, doc._id)) }) });
|
|
2692
2684
|
}, ReferringDocument = (props) => {
|
|
2693
|
-
const { doc, schemaType } = props, { onClick } = useIntentLink({
|
|
2685
|
+
const { doc, schemaType } = props, { onClick } = router.useIntentLink({
|
|
2694
2686
|
intent: "edit",
|
|
2695
2687
|
params: { id: doc._id }
|
|
2696
2688
|
});
|
|
2697
|
-
return schemaType ? /* @__PURE__ */ jsx(Button, { mode: "bleed", onClick, padding: 2, style: { width: "100%" }, children: /* @__PURE__ */ jsx(Preview, { layout: "default", schemaType, value: doc }) }, doc._id) : /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsxs(Text, { size: 1, children: [
|
|
2689
|
+
return schemaType ? /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { mode: "bleed", onClick, padding: 2, style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(sanity.Preview, { layout: "default", schemaType, value: doc }) }, doc._id) : /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 1, children: [
|
|
2698
2690
|
"A document of the unknown type ",
|
|
2699
|
-
/* @__PURE__ */ jsx("em", { children: doc._type })
|
|
2691
|
+
/* @__PURE__ */ jsxRuntime.jsx("em", { children: doc._type })
|
|
2700
2692
|
] }) });
|
|
2701
|
-
}, Container = styled(Box)(({ theme }) => css`
|
|
2693
|
+
}, Container = styledComponents.styled(ui.Box)(({ theme }) => styledComponents.css`
|
|
2702
2694
|
text {
|
|
2703
2695
|
font-family: ${theme.sanity.fonts.text.family} !important;
|
|
2704
2696
|
font-size: 8px !important;
|
|
@@ -2706,16 +2698,16 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2706
2698
|
}
|
|
2707
2699
|
`), FileIcon = (props) => {
|
|
2708
2700
|
const { extension, onClick, width } = props;
|
|
2709
|
-
return /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", onClick, style: { height: "100%" }, children: /* @__PURE__ */ jsx(Container, { style: { width }, children: extension ? /* @__PURE__ */ jsx(
|
|
2710
|
-
FileIcon
|
|
2701
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "center", justify: "center", onClick, style: { height: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(Container, { style: { width }, children: extension ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2702
|
+
reactFileIcon.FileIcon,
|
|
2711
2703
|
{
|
|
2712
2704
|
extension,
|
|
2713
|
-
...defaultStyles[extension]
|
|
2705
|
+
...reactFileIcon.defaultStyles[extension]
|
|
2714
2706
|
}
|
|
2715
|
-
) : /* @__PURE__ */ jsx(FileIcon
|
|
2707
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(reactFileIcon.FileIcon, {}) }) });
|
|
2716
2708
|
}, FileAssetPreview = (props) => {
|
|
2717
2709
|
const { asset } = props;
|
|
2718
|
-
return asset.mimeType.search("audio") === 0 ? /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", style: { height: "100%" }, children: /* @__PURE__ */ jsx("audio", { controls: !0, src: asset.url, style: { width: "100%" } }) }) : asset.mimeType.search("video") === 0 ? /* @__PURE__ */ jsx(
|
|
2710
|
+
return asset.mimeType.search("audio") === 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "center", justify: "center", style: { height: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx("audio", { controls: !0, src: asset.url, style: { width: "100%" } }) }) : asset.mimeType.search("video") === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2719
2711
|
"video",
|
|
2720
2712
|
{
|
|
2721
2713
|
controls: !0,
|
|
@@ -2725,25 +2717,25 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2725
2717
|
width: "100%"
|
|
2726
2718
|
}
|
|
2727
2719
|
}
|
|
2728
|
-
) : /* @__PURE__ */ jsx(FileIcon, { extension: asset.extension, width: "50%" });
|
|
2720
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { extension: asset.extension, width: "50%" });
|
|
2729
2721
|
}, FormSubmitButton = (props) => {
|
|
2730
2722
|
const { disabled, isValid, lastUpdated, onClick } = props;
|
|
2731
2723
|
let content;
|
|
2732
|
-
return isValid ? lastUpdated ? content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2724
|
+
return isValid ? lastUpdated ? content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2733
2725
|
"Last updated",
|
|
2734
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
2726
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
2735
2727
|
" ",
|
|
2736
|
-
format(new Date(lastUpdated), "PPp")
|
|
2737
|
-
] }) : content = "No unpublished changes" : content = "There are validation errors that need to be fixed before this document can be published", /* @__PURE__ */ jsx(
|
|
2738
|
-
Tooltip,
|
|
2728
|
+
dateFns.format(new Date(lastUpdated), "PPp")
|
|
2729
|
+
] }) : content = "No unpublished changes" : content = "There are validation errors that need to be fixed before this document can be published", /* @__PURE__ */ jsxRuntime.jsx(
|
|
2730
|
+
ui.Tooltip,
|
|
2739
2731
|
{
|
|
2740
2732
|
animate: !0,
|
|
2741
|
-
content: /* @__PURE__ */ jsx(Box, { padding: 3, style: { maxWidth: "185px" }, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: content }) }),
|
|
2733
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, style: { maxWidth: "185px" }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: content }) }),
|
|
2742
2734
|
disabled: "ontouchstart" in window,
|
|
2743
2735
|
placement: "top",
|
|
2744
2736
|
portal: !0,
|
|
2745
|
-
children: /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
2746
|
-
Button,
|
|
2737
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2738
|
+
ui.Button,
|
|
2747
2739
|
{
|
|
2748
2740
|
disabled,
|
|
2749
2741
|
fontSize: 1,
|
|
@@ -2754,7 +2746,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2754
2746
|
) })
|
|
2755
2747
|
}
|
|
2756
2748
|
);
|
|
2757
|
-
}, Image$1 = styled.img`
|
|
2749
|
+
}, Image$1 = styledComponents.styled.img`
|
|
2758
2750
|
--checkerboard-color: ${(props) => props.$scheme ? getSchemeColor(props.$scheme, "bg2") : "inherit"};
|
|
2759
2751
|
|
|
2760
2752
|
display: block;
|
|
@@ -2762,7 +2754,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2762
2754
|
height: 100%;
|
|
2763
2755
|
object-fit: contain;
|
|
2764
2756
|
|
|
2765
|
-
${(props) => props.$showCheckerboard && css`
|
|
2757
|
+
${(props) => props.$showCheckerboard && styledComponents.css`
|
|
2766
2758
|
background-image:
|
|
2767
2759
|
linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
|
|
2768
2760
|
linear-gradient(-45deg, var(--checkerboard-color) 25%, transparent 25%),
|
|
@@ -2775,7 +2767,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2775
2767
|
10px -10px,
|
|
2776
2768
|
-10px 0;
|
|
2777
2769
|
`}
|
|
2778
|
-
`, { radius: themeRadius, space: themeSpace } = studioTheme, reactSelectStyles = (scheme) => ({
|
|
2770
|
+
`, { radius: themeRadius, space: themeSpace } = ui.studioTheme, reactSelectStyles = (scheme) => ({
|
|
2779
2771
|
control: (styles, { isFocused }) => {
|
|
2780
2772
|
let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
|
|
2781
2773
|
return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
|
|
@@ -2790,7 +2782,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2790
2782
|
margin: 0,
|
|
2791
2783
|
minHeight: "35px",
|
|
2792
2784
|
outline: "none",
|
|
2793
|
-
padding: rem(themeSpace[1]),
|
|
2785
|
+
padding: ui.rem(themeSpace[1]),
|
|
2794
2786
|
transition: "none",
|
|
2795
2787
|
"&:hover": {
|
|
2796
2788
|
boxShadow: `inset 0 0 0 1px ${getSchemeColor(scheme, "inputHoveredBorder")}`
|
|
@@ -2804,8 +2796,8 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2804
2796
|
input: (styles) => ({
|
|
2805
2797
|
...styles,
|
|
2806
2798
|
color: "var(--card-fg-color)",
|
|
2807
|
-
fontFamily: studioTheme.fonts.text.family,
|
|
2808
|
-
marginLeft: rem(themeSpace[2])
|
|
2799
|
+
fontFamily: ui.studioTheme.fonts.text.family,
|
|
2800
|
+
marginLeft: ui.rem(themeSpace[2])
|
|
2809
2801
|
}),
|
|
2810
2802
|
menuList: (styles) => ({
|
|
2811
2803
|
...styles
|
|
@@ -2832,7 +2824,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2832
2824
|
}),
|
|
2833
2825
|
noOptionsMessage: (styles) => ({
|
|
2834
2826
|
...styles,
|
|
2835
|
-
fontFamily: studioTheme.fonts.text.family,
|
|
2827
|
+
fontFamily: ui.studioTheme.fonts.text.family,
|
|
2836
2828
|
lineHeight: "1em"
|
|
2837
2829
|
}),
|
|
2838
2830
|
option: (styles, { isFocused }) => ({
|
|
@@ -2840,7 +2832,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2840
2832
|
backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
|
|
2841
2833
|
borderRadius: themeRadius[2],
|
|
2842
2834
|
color: isFocused ? getSchemeColor(scheme, "bg") : "inherit",
|
|
2843
|
-
padding: `${rem(themeSpace[1])} ${rem(themeSpace[2])}`,
|
|
2835
|
+
padding: `${ui.rem(themeSpace[1])} ${ui.rem(themeSpace[2])}`,
|
|
2844
2836
|
"&:hover": {
|
|
2845
2837
|
backgroundColor: getSchemeColor(scheme, "spotBlue"),
|
|
2846
2838
|
color: getSchemeColor(scheme, "bg")
|
|
@@ -2848,33 +2840,33 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2848
2840
|
}),
|
|
2849
2841
|
placeholder: (styles) => ({
|
|
2850
2842
|
...styles,
|
|
2851
|
-
marginLeft: rem(themeSpace[2])
|
|
2843
|
+
marginLeft: ui.rem(themeSpace[2])
|
|
2852
2844
|
}),
|
|
2853
2845
|
valueContainer: (styles) => ({
|
|
2854
2846
|
...styles,
|
|
2855
2847
|
margin: 0,
|
|
2856
2848
|
padding: 0
|
|
2857
2849
|
})
|
|
2858
|
-
}), DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(Box, { paddingX: 2, children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) }) }) }), Menu = (props) => /* @__PURE__ */ jsx(components.Menu, { ...props, children: /* @__PURE__ */ jsx(Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList = (props) => {
|
|
2850
|
+
}), DropdownIndicator = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownIcon, {}) }) }) }), Menu = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.Menu, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList = (props) => {
|
|
2859
2851
|
const { children } = props, MAX_ROWS = 5, OPTION_HEIGHT = 37;
|
|
2860
2852
|
if (Array.isArray(children)) {
|
|
2861
2853
|
const height = children.length > MAX_ROWS ? OPTION_HEIGHT * MAX_ROWS : children.length * OPTION_HEIGHT;
|
|
2862
|
-
return /* @__PURE__ */ jsx(
|
|
2863
|
-
Virtuoso,
|
|
2854
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2855
|
+
reactVirtuoso.Virtuoso,
|
|
2864
2856
|
{
|
|
2865
2857
|
className: "media__custom-scrollbar",
|
|
2866
2858
|
itemContent: (index) => {
|
|
2867
2859
|
const item = children[index];
|
|
2868
|
-
return /* @__PURE__ */ jsx(Option, { ...item.props });
|
|
2860
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Option, { ...item.props });
|
|
2869
2861
|
},
|
|
2870
2862
|
style: { height },
|
|
2871
2863
|
totalCount: children.length
|
|
2872
2864
|
}
|
|
2873
2865
|
);
|
|
2874
2866
|
}
|
|
2875
|
-
return /* @__PURE__ */ jsx(components.MenuList, { ...props, children });
|
|
2876
|
-
}, MultiValueLabel = (props) => /* @__PURE__ */ jsx(Box, { padding: 2, paddingRight: 1, children: /* @__PURE__ */ jsx(Text, { size: 1, weight: "medium", children: /* @__PURE__ */ jsx(components.MultiValueLabel, { ...props }) }) }), MultiValueRemove = (props) => /* @__PURE__ */ jsx(components.MultiValueRemove, { ...props, children: /* @__PURE__ */ jsx(CloseIcon, { color: "#1f2123" }) }), Option = (props) => /* @__PURE__ */ jsx(Box, { paddingX: 1, paddingY: 1, children: /* @__PURE__ */ jsx(components.Option, { ...props, children: /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
|
|
2877
|
-
props.data.__isNew__ && /* @__PURE__ */ jsx(AddIcon, { style: { marginRight: "3px" } }),
|
|
2867
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Select.components.MenuList, { ...props, children });
|
|
2868
|
+
}, MultiValueLabel = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, paddingRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, weight: "medium", children: /* @__PURE__ */ jsxRuntime.jsx(Select.components.MultiValueLabel, { ...props }) }) }), MultiValueRemove = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.MultiValueRemove, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, { color: "#1f2123" }) }), Option = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 1, paddingY: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Select.components.Option, { ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
|
|
2869
|
+
props.data.__isNew__ && /* @__PURE__ */ jsxRuntime.jsx(icons.AddIcon, { style: { marginRight: "3px" } }),
|
|
2878
2870
|
props.children
|
|
2879
2871
|
] }) }) }), reactSelectComponents = {
|
|
2880
2872
|
DropdownIndicator,
|
|
@@ -2884,29 +2876,29 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2884
2876
|
MultiValueLabel,
|
|
2885
2877
|
MultiValueRemove,
|
|
2886
2878
|
Option
|
|
2887
|
-
}, StyledErrorOutlineIcon = styled(ErrorOutlineIcon)(({ theme }) => ({
|
|
2879
|
+
}, StyledErrorOutlineIcon = styledComponents.styled(icons.ErrorOutlineIcon)(({ theme }) => ({
|
|
2888
2880
|
color: theme.sanity.color.spot.red
|
|
2889
2881
|
})), FormFieldInputLabel = (props) => {
|
|
2890
2882
|
const { description, error, label, name } = props;
|
|
2891
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2892
|
-
/* @__PURE__ */ jsx(Box, { marginY: 3, children: /* @__PURE__ */ jsxs(Inline, { space: 2, children: [
|
|
2893
|
-
/* @__PURE__ */ jsx(Text, { as: "label", htmlFor: name, size: 1, weight: "semibold", children: label }),
|
|
2894
|
-
error && /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(
|
|
2895
|
-
Tooltip,
|
|
2883
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2884
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginY: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 2, children: [
|
|
2885
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", htmlFor: name, size: 1, weight: "semibold", children: label }),
|
|
2886
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2887
|
+
ui.Tooltip,
|
|
2896
2888
|
{
|
|
2897
2889
|
animate: !0,
|
|
2898
|
-
content: /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsxs(Text, { muted: !0, size: 1, children: [
|
|
2899
|
-
/* @__PURE__ */ jsx(StyledErrorOutlineIcon, { style: { marginRight: "0.1em" } }),
|
|
2890
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { muted: !0, size: 1, children: [
|
|
2891
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledErrorOutlineIcon, { style: { marginRight: "0.1em" } }),
|
|
2900
2892
|
error
|
|
2901
2893
|
] }) }),
|
|
2902
2894
|
fallbackPlacements: ["top", "left"],
|
|
2903
2895
|
placement: "right",
|
|
2904
2896
|
portal: !0,
|
|
2905
|
-
children: /* @__PURE__ */ jsx(StyledErrorOutlineIcon, {})
|
|
2897
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(StyledErrorOutlineIcon, {})
|
|
2906
2898
|
}
|
|
2907
2899
|
) })
|
|
2908
2900
|
] }) }),
|
|
2909
|
-
description && /* @__PURE__ */ jsx(Box, { marginY: 3, children: /* @__PURE__ */ jsx(Text, { htmlFor: name, muted: !0, size: 1, children: description }) })
|
|
2901
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginY: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { htmlFor: name, muted: !0, size: 1, children: description }) })
|
|
2910
2902
|
] });
|
|
2911
2903
|
}, FormFieldInputTags = (props) => {
|
|
2912
2904
|
const {
|
|
@@ -2920,23 +2912,23 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2920
2912
|
options,
|
|
2921
2913
|
placeholder,
|
|
2922
2914
|
value
|
|
2923
|
-
} = props, scheme = useColorSchemeValue(), creating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching);
|
|
2924
|
-
return /* @__PURE__ */ jsxs(
|
|
2925
|
-
Box,
|
|
2915
|
+
} = props, scheme = sanity.useColorSchemeValue(), creating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching);
|
|
2916
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2917
|
+
ui.Box,
|
|
2926
2918
|
{
|
|
2927
2919
|
style: { zIndex: 2 },
|
|
2928
2920
|
children: [
|
|
2929
|
-
/* @__PURE__ */ jsx(FormFieldInputLabel, { description, error, label, name }),
|
|
2930
|
-
/* @__PURE__ */ jsx(
|
|
2931
|
-
Controller,
|
|
2921
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormFieldInputLabel, { description, error, label, name }),
|
|
2922
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2923
|
+
reactHookForm.Controller,
|
|
2932
2924
|
{
|
|
2933
2925
|
control,
|
|
2934
2926
|
defaultValue: value,
|
|
2935
2927
|
name,
|
|
2936
2928
|
render: ({ field }) => {
|
|
2937
2929
|
const { onBlur, onChange, value: controllerValue } = field;
|
|
2938
|
-
return /* @__PURE__ */ jsx(
|
|
2939
|
-
|
|
2930
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2931
|
+
CreatableSelect__default.default,
|
|
2940
2932
|
{
|
|
2941
2933
|
components: reactSelectComponents,
|
|
2942
2934
|
instanceId: "tags",
|
|
@@ -2961,12 +2953,12 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2961
2953
|
]
|
|
2962
2954
|
}
|
|
2963
2955
|
);
|
|
2964
|
-
}, FormFieldInputText = forwardRef((props, ref) => {
|
|
2956
|
+
}, FormFieldInputText = react.forwardRef((props, ref) => {
|
|
2965
2957
|
const { description, disabled, error, label, name, placeholder, value, ...rest } = props;
|
|
2966
|
-
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
2967
|
-
/* @__PURE__ */ jsx(FormFieldInputLabel, { description, error, label, name }),
|
|
2968
|
-
/* @__PURE__ */ jsx(
|
|
2969
|
-
TextInput,
|
|
2958
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
|
|
2959
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormFieldInputLabel, { description, error, label, name }),
|
|
2960
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2961
|
+
ui.TextInput,
|
|
2970
2962
|
{
|
|
2971
2963
|
...rest,
|
|
2972
2964
|
autoComplete: "off",
|
|
@@ -2980,12 +2972,12 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
|
|
|
2980
2972
|
}
|
|
2981
2973
|
)
|
|
2982
2974
|
] });
|
|
2983
|
-
}), FormFieldInputTextarea = forwardRef((props, ref) => {
|
|
2975
|
+
}), FormFieldInputTextarea = react.forwardRef((props, ref) => {
|
|
2984
2976
|
const { description, disabled, error, label, name, placeholder, rows, value, ...rest } = props;
|
|
2985
|
-
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
2986
|
-
/* @__PURE__ */ jsx(FormFieldInputLabel, { description, error, label, name }),
|
|
2987
|
-
/* @__PURE__ */ jsx(
|
|
2988
|
-
TextArea,
|
|
2977
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
|
|
2978
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormFieldInputLabel, { description, error, label, name }),
|
|
2979
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2980
|
+
ui.TextArea,
|
|
2989
2981
|
{
|
|
2990
2982
|
...rest,
|
|
2991
2983
|
autoComplete: "off",
|
|
@@ -3017,9 +3009,9 @@ function Details({
|
|
|
3017
3009
|
creditLine,
|
|
3018
3010
|
locales
|
|
3019
3011
|
}) {
|
|
3020
|
-
const hasLocales = locales && locales.length > 0, [activeLocaleTab, setActiveLocaleTab] = useState(0);
|
|
3021
|
-
return /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
3022
|
-
/* @__PURE__ */ jsx(
|
|
3012
|
+
const hasLocales = locales && locales.length > 0, [activeLocaleTab, setActiveLocaleTab] = react.useState(0);
|
|
3013
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
3014
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3023
3015
|
FormFieldInputTags,
|
|
3024
3016
|
{
|
|
3025
3017
|
control,
|
|
@@ -3033,7 +3025,7 @@ function Details({
|
|
|
3033
3025
|
value: assetTagOptions
|
|
3034
3026
|
}
|
|
3035
3027
|
),
|
|
3036
|
-
/* @__PURE__ */ jsx(
|
|
3028
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3037
3029
|
FormFieldInputText,
|
|
3038
3030
|
{
|
|
3039
3031
|
...register("originalFilename"),
|
|
@@ -3044,9 +3036,9 @@ function Details({
|
|
|
3044
3036
|
value: currentAsset?.originalFilename
|
|
3045
3037
|
}
|
|
3046
3038
|
),
|
|
3047
|
-
hasLocales ? /* @__PURE__ */ jsx(Card, { marginTop: 2, shadow: 1, padding: 3, radius: 1, children: /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
|
|
3048
|
-
/* @__PURE__ */ jsx(TabList, { space: 2, children: locales.map((locale, idx) => /* @__PURE__ */ jsx(
|
|
3049
|
-
Tab,
|
|
3039
|
+
hasLocales ? /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { marginTop: 2, shadow: 1, padding: 3, radius: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
|
|
3040
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TabList, { space: 2, children: locales.map((locale, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3041
|
+
ui.Tab,
|
|
3050
3042
|
{
|
|
3051
3043
|
id: `locale-tab-${locale.id}`,
|
|
3052
3044
|
"aria-controls": `locale-panel-${locale.id}`,
|
|
@@ -3056,14 +3048,14 @@ function Details({
|
|
|
3056
3048
|
},
|
|
3057
3049
|
locale.id
|
|
3058
3050
|
)) }),
|
|
3059
|
-
locales.map((locale, idx) => /* @__PURE__ */ jsx(
|
|
3060
|
-
TabPanel,
|
|
3051
|
+
locales.map((locale, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3052
|
+
ui.TabPanel,
|
|
3061
3053
|
{
|
|
3062
3054
|
id: `locale-panel-${locale.id}`,
|
|
3063
3055
|
"aria-labelledby": `locale-tab-${locale.id}`,
|
|
3064
3056
|
hidden: activeLocaleTab !== idx,
|
|
3065
|
-
children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
3066
|
-
/* @__PURE__ */ jsx(
|
|
3057
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
3058
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3067
3059
|
FormFieldInputText,
|
|
3068
3060
|
{
|
|
3069
3061
|
...register(`title.${locale.id}`),
|
|
@@ -3073,7 +3065,7 @@ function Details({
|
|
|
3073
3065
|
name: `title.${locale.id}`
|
|
3074
3066
|
}
|
|
3075
3067
|
),
|
|
3076
|
-
/* @__PURE__ */ jsx(
|
|
3068
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3077
3069
|
FormFieldInputText,
|
|
3078
3070
|
{
|
|
3079
3071
|
...register(`altText.${locale.id}`),
|
|
@@ -3083,7 +3075,7 @@ function Details({
|
|
|
3083
3075
|
name: `altText.${locale.id}`
|
|
3084
3076
|
}
|
|
3085
3077
|
),
|
|
3086
|
-
/* @__PURE__ */ jsx(
|
|
3078
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3087
3079
|
FormFieldInputTextarea,
|
|
3088
3080
|
{
|
|
3089
3081
|
...register(`description.${locale.id}`),
|
|
@@ -3094,7 +3086,7 @@ function Details({
|
|
|
3094
3086
|
rows: 5
|
|
3095
3087
|
}
|
|
3096
3088
|
),
|
|
3097
|
-
creditLine?.enabled && /* @__PURE__ */ jsx(
|
|
3089
|
+
creditLine?.enabled && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3098
3090
|
FormFieldInputText,
|
|
3099
3091
|
{
|
|
3100
3092
|
...register(`creditLine.${locale.id}`),
|
|
@@ -3108,8 +3100,8 @@ function Details({
|
|
|
3108
3100
|
},
|
|
3109
3101
|
locale.id
|
|
3110
3102
|
))
|
|
3111
|
-
] }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3112
|
-
/* @__PURE__ */ jsx(
|
|
3103
|
+
] }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3104
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3113
3105
|
FormFieldInputText,
|
|
3114
3106
|
{
|
|
3115
3107
|
...register("title"),
|
|
@@ -3120,7 +3112,7 @@ function Details({
|
|
|
3120
3112
|
value: toStringField(currentAsset?.title)
|
|
3121
3113
|
}
|
|
3122
3114
|
),
|
|
3123
|
-
/* @__PURE__ */ jsx(
|
|
3115
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3124
3116
|
FormFieldInputText,
|
|
3125
3117
|
{
|
|
3126
3118
|
...register("altText"),
|
|
@@ -3131,7 +3123,7 @@ function Details({
|
|
|
3131
3123
|
value: toStringField(currentAsset?.altText)
|
|
3132
3124
|
}
|
|
3133
3125
|
),
|
|
3134
|
-
/* @__PURE__ */ jsx(
|
|
3126
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3135
3127
|
FormFieldInputTextarea,
|
|
3136
3128
|
{
|
|
3137
3129
|
...register("description"),
|
|
@@ -3143,7 +3135,7 @@ function Details({
|
|
|
3143
3135
|
value: toStringField(currentAsset?.description)
|
|
3144
3136
|
}
|
|
3145
3137
|
),
|
|
3146
|
-
creditLine?.enabled && /* @__PURE__ */ jsx(
|
|
3138
|
+
creditLine?.enabled && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3147
3139
|
FormFieldInputText,
|
|
3148
3140
|
{
|
|
3149
3141
|
...register("creditLine"),
|
|
@@ -3158,13 +3150,13 @@ function Details({
|
|
|
3158
3150
|
] });
|
|
3159
3151
|
}
|
|
3160
3152
|
function renderDefaultDetails(props) {
|
|
3161
|
-
return /* @__PURE__ */ jsx(Details, { ...props });
|
|
3153
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Details, { ...props });
|
|
3162
3154
|
}
|
|
3163
3155
|
const DialogAssetEdit = (props) => {
|
|
3164
3156
|
const {
|
|
3165
3157
|
children,
|
|
3166
3158
|
dialog: { assetId, id, lastCreatedTag, lastRemovedTagIds }
|
|
3167
|
-
} = props, client = useVersionedClient(), scheme = useColorSchemeValue(), documentStore = useDocumentStore(), dispatch = useDispatch(), assetItem = useTypedSelector((state) => selectAssetById(state, String(assetId))), tags = useTypedSelector(selectTags), assetUpdatedPrev = useRef(void 0), [assetSnapshot, setAssetSnapshot] = useState(assetItem?.asset), [tabSection, setTabSection] = useState("details"), currentAsset = assetItem ? assetItem?.asset : assetSnapshot, allTagOptions = getTagSelectOptions(tags), assetTagOptions = useTypedSelector(selectTagSelectOptions(currentAsset)), { creditLine, components: { details: CustomDetails } = {}, locales } = useToolOptions(), generateDefaultValues = useCallback(
|
|
3159
|
+
} = props, client = useVersionedClient(), scheme = sanity.useColorSchemeValue(), documentStore = sanity.useDocumentStore(), dispatch = reactRedux.useDispatch(), assetItem = useTypedSelector((state) => selectAssetById(state, String(assetId))), tags = useTypedSelector(selectTags), assetUpdatedPrev = react.useRef(void 0), [assetSnapshot, setAssetSnapshot] = react.useState(assetItem?.asset), [tabSection, setTabSection] = react.useState("details"), currentAsset = assetItem ? assetItem?.asset : assetSnapshot, allTagOptions = getTagSelectOptions(tags), assetTagOptions = useTypedSelector(selectTagSelectOptions(currentAsset)), { creditLine, components: { details: CustomDetails } = {}, locales } = useToolOptions(), generateDefaultValues = react.useCallback(
|
|
3168
3160
|
(asset) => {
|
|
3169
3161
|
if (locales && locales.length > 0) {
|
|
3170
3162
|
const makeLocaleObj = (field) => {
|
|
@@ -3204,23 +3196,23 @@ const DialogAssetEdit = (props) => {
|
|
|
3204
3196
|
register,
|
|
3205
3197
|
reset,
|
|
3206
3198
|
setValue
|
|
3207
|
-
} = useForm({
|
|
3199
|
+
} = reactHookForm.useForm({
|
|
3208
3200
|
defaultValues: generateDefaultValues(assetItem?.asset),
|
|
3209
3201
|
mode: "onChange",
|
|
3210
3202
|
resolver: zodFormResolver(getAssetFormSchema(locales))
|
|
3211
|
-
}), formUpdating = !assetItem || assetItem?.updating, handleClose = useCallback(() => {
|
|
3203
|
+
}), formUpdating = !assetItem || assetItem?.updating, handleClose = react.useCallback(() => {
|
|
3212
3204
|
dispatch(dialogActions.remove({ id }));
|
|
3213
|
-
}, [dispatch, id]), handleDelete = useCallback(() => {
|
|
3205
|
+
}, [dispatch, id]), handleDelete = react.useCallback(() => {
|
|
3214
3206
|
assetItem?.asset && dispatch(
|
|
3215
3207
|
dialogActions.showConfirmDeleteAssets({
|
|
3216
3208
|
assets: [assetItem],
|
|
3217
3209
|
closeDialogId: assetItem?.asset._id
|
|
3218
3210
|
})
|
|
3219
3211
|
);
|
|
3220
|
-
}, [assetItem, dispatch]), handleAssetUpdate = useCallback((update) => {
|
|
3212
|
+
}, [assetItem, dispatch]), handleAssetUpdate = react.useCallback((update) => {
|
|
3221
3213
|
const { result, transition } = update;
|
|
3222
3214
|
result && transition === "update" && setAssetSnapshot(result);
|
|
3223
|
-
}, []), handleCreateTag = useCallback(
|
|
3215
|
+
}, []), handleCreateTag = react.useCallback(
|
|
3224
3216
|
(tagName) => {
|
|
3225
3217
|
dispatch(
|
|
3226
3218
|
tagsActions.createRequest({
|
|
@@ -3230,7 +3222,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3230
3222
|
);
|
|
3231
3223
|
},
|
|
3232
3224
|
[currentAsset?._id, dispatch]
|
|
3233
|
-
), hasOrphanedLocales = useMemo(() => {
|
|
3225
|
+
), hasOrphanedLocales = react.useMemo(() => {
|
|
3234
3226
|
if (!currentAsset) return !1;
|
|
3235
3227
|
const isLocaleObj = (v) => typeof v == "object" && v !== null && !Array.isArray(v), fields = [
|
|
3236
3228
|
currentAsset.title,
|
|
@@ -3242,7 +3234,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3242
3234
|
if (!locales || locales.length === 0) return !0;
|
|
3243
3235
|
const configuredIds = new Set(locales.map((l) => l.id));
|
|
3244
3236
|
return fields.some((f) => isLocaleObj(f) ? Object.keys(f).some((k) => !configuredIds.has(k)) : !1);
|
|
3245
|
-
}, [currentAsset, locales]), handleCleanupLocales = useCallback(async () => {
|
|
3237
|
+
}, [currentAsset, locales]), handleCleanupLocales = react.useCallback(async () => {
|
|
3246
3238
|
if (!currentAsset) return;
|
|
3247
3239
|
const cleanField = (field) => {
|
|
3248
3240
|
if (typeof field != "object" || field === null || Array.isArray(field)) return field;
|
|
@@ -3262,7 +3254,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3262
3254
|
creditLine: cleanField(currentAsset.creditLine)
|
|
3263
3255
|
}
|
|
3264
3256
|
}).commit();
|
|
3265
|
-
}, [client, currentAsset, locales]), onSubmit = useCallback(
|
|
3257
|
+
}, [client, currentAsset, locales]), onSubmit = react.useCallback(
|
|
3266
3258
|
(formData) => {
|
|
3267
3259
|
if (!assetItem?.asset)
|
|
3268
3260
|
return;
|
|
@@ -3290,31 +3282,31 @@ const DialogAssetEdit = (props) => {
|
|
|
3290
3282
|
},
|
|
3291
3283
|
[assetItem?.asset, dispatch]
|
|
3292
3284
|
);
|
|
3293
|
-
useEffect(() => {
|
|
3285
|
+
react.useEffect(() => {
|
|
3294
3286
|
if (!assetItem?.asset)
|
|
3295
3287
|
return;
|
|
3296
|
-
const subscriptionAsset = client.listen(
|
|
3288
|
+
const subscriptionAsset = client.listen(groq__default.default`*[_id == $id]`, { id: assetItem?.asset._id }).subscribe(handleAssetUpdate);
|
|
3297
3289
|
return () => {
|
|
3298
3290
|
subscriptionAsset?.unsubscribe();
|
|
3299
3291
|
};
|
|
3300
|
-
}, [assetItem?.asset, client, handleAssetUpdate]), useEffect(() => {
|
|
3292
|
+
}, [assetItem?.asset, client, handleAssetUpdate]), react.useEffect(() => {
|
|
3301
3293
|
if (lastCreatedTag) {
|
|
3302
3294
|
const updatedTags = (getValues("opt.media.tags") || []).concat([lastCreatedTag]);
|
|
3303
3295
|
setValue("opt.media.tags", updatedTags, { shouldDirty: !0 });
|
|
3304
3296
|
}
|
|
3305
|
-
}, [getValues, lastCreatedTag, setValue]), useEffect(() => {
|
|
3297
|
+
}, [getValues, lastCreatedTag, setValue]), react.useEffect(() => {
|
|
3306
3298
|
if (lastRemovedTagIds) {
|
|
3307
3299
|
const updatedTags = (getValues("opt.media.tags") || []).filter((tag) => !lastRemovedTagIds.includes(tag.value));
|
|
3308
3300
|
setValue("opt.media.tags", updatedTags, { shouldDirty: !0 });
|
|
3309
3301
|
}
|
|
3310
|
-
}, [getValues, lastRemovedTagIds, setValue]), useEffect(() => {
|
|
3302
|
+
}, [getValues, lastRemovedTagIds, setValue]), react.useEffect(() => {
|
|
3311
3303
|
assetUpdatedPrev.current !== assetItem?.asset._updatedAt && reset(generateDefaultValues(assetItem?.asset)), assetUpdatedPrev.current = assetItem?.asset._updatedAt;
|
|
3312
3304
|
}, [assetItem?.asset, generateDefaultValues, reset]);
|
|
3313
|
-
const Footer = () => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
3314
|
-
hasOrphanedLocales && /* @__PURE__ */ jsx(Card, { padding: 3, radius: 2, shadow: 1, tone: "caution", children: /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "space-between", gap: 3, children: [
|
|
3315
|
-
/* @__PURE__ */ jsx(Text, { size: 1, children: "This asset has localized fields that are no longer configured. Clean them up to avoid validation errors." }),
|
|
3316
|
-
/* @__PURE__ */ jsx(
|
|
3317
|
-
Button,
|
|
3305
|
+
const Footer = () => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
3306
|
+
hasOrphanedLocales && /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { padding: 3, radius: 2, shadow: 1, tone: "caution", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "space-between", gap: 3, children: [
|
|
3307
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "This asset has localized fields that are no longer configured. Clean them up to avoid validation errors." }),
|
|
3308
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3309
|
+
ui.Button,
|
|
3318
3310
|
{
|
|
3319
3311
|
fontSize: 1,
|
|
3320
3312
|
mode: "ghost",
|
|
@@ -3324,9 +3316,9 @@ const DialogAssetEdit = (props) => {
|
|
|
3324
3316
|
}
|
|
3325
3317
|
)
|
|
3326
3318
|
] }) }),
|
|
3327
|
-
/* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
|
|
3328
|
-
/* @__PURE__ */ jsx(
|
|
3329
|
-
Button,
|
|
3319
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "space-between", children: [
|
|
3320
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3321
|
+
ui.Button,
|
|
3330
3322
|
{
|
|
3331
3323
|
disabled: formUpdating,
|
|
3332
3324
|
fontSize: 1,
|
|
@@ -3336,7 +3328,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3336
3328
|
tone: "critical"
|
|
3337
3329
|
}
|
|
3338
3330
|
),
|
|
3339
|
-
/* @__PURE__ */ jsx(
|
|
3331
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3340
3332
|
FormSubmitButton,
|
|
3341
3333
|
{
|
|
3342
3334
|
disabled: formUpdating || !isDirty || !isValid || hasOrphanedLocales,
|
|
@@ -3362,23 +3354,23 @@ const DialogAssetEdit = (props) => {
|
|
|
3362
3354
|
creditLine,
|
|
3363
3355
|
locales
|
|
3364
3356
|
};
|
|
3365
|
-
return /* @__PURE__ */ jsxs(
|
|
3357
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3366
3358
|
Dialog,
|
|
3367
3359
|
{
|
|
3368
3360
|
animate: !0,
|
|
3369
|
-
footer: /* @__PURE__ */ jsx(Footer, {}),
|
|
3361
|
+
footer: /* @__PURE__ */ jsxRuntime.jsx(Footer, {}),
|
|
3370
3362
|
header: "Asset details",
|
|
3371
3363
|
id,
|
|
3372
3364
|
onClose: handleClose,
|
|
3373
3365
|
width: 3,
|
|
3374
3366
|
children: [
|
|
3375
|
-
/* @__PURE__ */ jsxs(Flex, { direction: ["column-reverse", "column-reverse", "row-reverse"], children: [
|
|
3376
|
-
/* @__PURE__ */ jsx(Box, { flex: 1, marginTop: [5, 5, 0], padding: 4, children: /* @__PURE__ */ jsx(WithReferringDocuments, { documentStore, id: currentAsset._id, children: ({ isLoading, referringDocuments }) => {
|
|
3367
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: ["column-reverse", "column-reverse", "row-reverse"], children: [
|
|
3368
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, marginTop: [5, 5, 0], padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(sanity.WithReferringDocuments, { documentStore, id: currentAsset._id, children: ({ isLoading, referringDocuments }) => {
|
|
3377
3369
|
const uniqueReferringDocuments = getUniqueDocuments(referringDocuments);
|
|
3378
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3379
|
-
/* @__PURE__ */ jsxs(TabList, { space: 2, children: [
|
|
3380
|
-
/* @__PURE__ */ jsx(
|
|
3381
|
-
Tab,
|
|
3370
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3371
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.TabList, { space: 2, children: [
|
|
3372
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3373
|
+
ui.Tab,
|
|
3382
3374
|
{
|
|
3383
3375
|
"aria-controls": "details-panel",
|
|
3384
3376
|
disabled: formUpdating,
|
|
@@ -3389,8 +3381,8 @@ const DialogAssetEdit = (props) => {
|
|
|
3389
3381
|
size: 2
|
|
3390
3382
|
}
|
|
3391
3383
|
),
|
|
3392
|
-
/* @__PURE__ */ jsx(
|
|
3393
|
-
Tab,
|
|
3384
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3385
|
+
ui.Tab,
|
|
3394
3386
|
{
|
|
3395
3387
|
"aria-controls": "references-panel",
|
|
3396
3388
|
disabled: formUpdating,
|
|
@@ -3402,31 +3394,31 @@ const DialogAssetEdit = (props) => {
|
|
|
3402
3394
|
}
|
|
3403
3395
|
)
|
|
3404
3396
|
] }),
|
|
3405
|
-
/* @__PURE__ */ jsxs(Box, { as: "form", marginTop: 4, onSubmit: handleSubmit(onSubmit), children: [
|
|
3406
|
-
!assetItem && /* @__PURE__ */ jsx(Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsx(Text, { size: 1, children: "This file cannot be found \u2013 it may have been deleted." }) }),
|
|
3407
|
-
/* @__PURE__ */ jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
|
|
3408
|
-
/* @__PURE__ */ jsx(
|
|
3409
|
-
TabPanel,
|
|
3397
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", marginTop: 4, onSubmit: handleSubmit(onSubmit), children: [
|
|
3398
|
+
!assetItem && /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "This file cannot be found \u2013 it may have been deleted." }) }),
|
|
3399
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
|
|
3400
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3401
|
+
ui.TabPanel,
|
|
3410
3402
|
{
|
|
3411
3403
|
"aria-labelledby": "details",
|
|
3412
3404
|
hidden: tabSection !== "details",
|
|
3413
3405
|
id: "details-panel",
|
|
3414
|
-
children: CustomDetails ? /* @__PURE__ */ jsx(
|
|
3406
|
+
children: CustomDetails ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3415
3407
|
CustomDetails,
|
|
3416
3408
|
{
|
|
3417
3409
|
...detailsProps,
|
|
3418
3410
|
renderDefaultDetails
|
|
3419
3411
|
}
|
|
3420
|
-
) : /* @__PURE__ */ jsx(Details, { ...detailsProps })
|
|
3412
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(Details, { ...detailsProps })
|
|
3421
3413
|
}
|
|
3422
3414
|
),
|
|
3423
|
-
/* @__PURE__ */ jsx(
|
|
3424
|
-
TabPanel,
|
|
3415
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3416
|
+
ui.TabPanel,
|
|
3425
3417
|
{
|
|
3426
3418
|
"aria-labelledby": "references",
|
|
3427
3419
|
hidden: tabSection !== "references",
|
|
3428
3420
|
id: "references-panel",
|
|
3429
|
-
children: /* @__PURE__ */ jsx(Box, { marginTop: 5, children: assetItem?.asset && /* @__PURE__ */ jsx(
|
|
3421
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 5, children: assetItem?.asset && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3430
3422
|
DocumentList,
|
|
3431
3423
|
{
|
|
3432
3424
|
documents: uniqueReferringDocuments,
|
|
@@ -3438,10 +3430,10 @@ const DialogAssetEdit = (props) => {
|
|
|
3438
3430
|
] })
|
|
3439
3431
|
] });
|
|
3440
3432
|
} }) }),
|
|
3441
|
-
/* @__PURE__ */ jsxs(Box, { flex: 1, padding: 4, children: [
|
|
3442
|
-
/* @__PURE__ */ jsxs(Box, { style: { aspectRatio: "1" }, children: [
|
|
3443
|
-
isFileAsset(currentAsset) && /* @__PURE__ */ jsx(FileAssetPreview, { asset: currentAsset }),
|
|
3444
|
-
isImageAsset(currentAsset) && /* @__PURE__ */ jsx(
|
|
3433
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 1, padding: 4, children: [
|
|
3434
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { aspectRatio: "1" }, children: [
|
|
3435
|
+
isFileAsset(currentAsset) && /* @__PURE__ */ jsxRuntime.jsx(FileAssetPreview, { asset: currentAsset }),
|
|
3436
|
+
isImageAsset(currentAsset) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3445
3437
|
Image$1,
|
|
3446
3438
|
{
|
|
3447
3439
|
draggable: !1,
|
|
@@ -3451,7 +3443,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3451
3443
|
}
|
|
3452
3444
|
)
|
|
3453
3445
|
] }),
|
|
3454
|
-
currentAsset && /* @__PURE__ */ jsx(Box, { marginTop: 4, children: /* @__PURE__ */ jsx(AssetMetadata, { asset: currentAsset, item: assetItem }) })
|
|
3446
|
+
currentAsset && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(AssetMetadata, { asset: currentAsset, item: assetItem }) })
|
|
3455
3447
|
] })
|
|
3456
3448
|
] }),
|
|
3457
3449
|
children
|
|
@@ -3459,19 +3451,19 @@ const DialogAssetEdit = (props) => {
|
|
|
3459
3451
|
}
|
|
3460
3452
|
);
|
|
3461
3453
|
}, DialogConfirm = (props) => {
|
|
3462
|
-
const { children, dialog } = props, dispatch = useDispatch(), handleClose = () => {
|
|
3454
|
+
const { children, dialog } = props, dispatch = reactRedux.useDispatch(), handleClose = () => {
|
|
3463
3455
|
dispatch(dialogActions.remove({ id: dialog?.id }));
|
|
3464
3456
|
}, handleConfirm = () => {
|
|
3465
3457
|
dialog?.closeDialogId && dispatch(dialogActions.remove({ id: dialog?.closeDialogId })), dialog?.confirmCallbackAction && dispatch(dialog.confirmCallbackAction), handleClose();
|
|
3466
3458
|
};
|
|
3467
|
-
return /* @__PURE__ */ jsxs(
|
|
3459
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3468
3460
|
Dialog,
|
|
3469
3461
|
{
|
|
3470
3462
|
animate: !0,
|
|
3471
|
-
footer: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
|
|
3472
|
-
/* @__PURE__ */ jsx(Button, { fontSize: 1, mode: "bleed", onClick: handleClose, text: "Cancel" }),
|
|
3473
|
-
/* @__PURE__ */ jsx(
|
|
3474
|
-
Button,
|
|
3463
|
+
footer: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "space-between", children: [
|
|
3464
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { fontSize: 1, mode: "bleed", onClick: handleClose, text: "Cancel" }),
|
|
3465
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3466
|
+
ui.Button,
|
|
3475
3467
|
{
|
|
3476
3468
|
fontSize: 1,
|
|
3477
3469
|
onClick: handleConfirm,
|
|
@@ -3480,17 +3472,17 @@ const DialogAssetEdit = (props) => {
|
|
|
3480
3472
|
}
|
|
3481
3473
|
)
|
|
3482
3474
|
] }) }), {}),
|
|
3483
|
-
header: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
|
|
3484
|
-
/* @__PURE__ */ jsx(Box, { paddingX: 1, children: /* @__PURE__ */ jsx(WarningOutlineIcon, {}) }),
|
|
3485
|
-
/* @__PURE__ */ jsx(Box, { marginLeft: 2, children: dialog?.headerTitle })
|
|
3475
|
+
header: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
|
|
3476
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 1, children: /* @__PURE__ */ jsxRuntime.jsx(icons.WarningOutlineIcon, {}) }),
|
|
3477
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 2, children: dialog?.headerTitle })
|
|
3486
3478
|
] }), {}),
|
|
3487
3479
|
id: "confirm",
|
|
3488
3480
|
onClose: handleClose,
|
|
3489
3481
|
width: 1,
|
|
3490
3482
|
children: [
|
|
3491
|
-
/* @__PURE__ */ jsx(Box, { paddingX: 4, paddingY: 4, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
3492
|
-
dialog?.title && /* @__PURE__ */ jsx(Text, { size: 1, children: dialog.title }),
|
|
3493
|
-
dialog?.description && /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsx("em", { children: dialog.description }) })
|
|
3483
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 4, paddingY: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
3484
|
+
dialog?.title && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: dialog.title }),
|
|
3485
|
+
dialog?.description && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: dialog.description }) })
|
|
3494
3486
|
] }) }),
|
|
3495
3487
|
children
|
|
3496
3488
|
]
|
|
@@ -3500,13 +3492,13 @@ const DialogAssetEdit = (props) => {
|
|
|
3500
3492
|
const {
|
|
3501
3493
|
children,
|
|
3502
3494
|
dialog: { id }
|
|
3503
|
-
} = props, dispatch = useDispatch(), handleClose = useCallback(() => {
|
|
3495
|
+
} = props, dispatch = reactRedux.useDispatch(), handleClose = react.useCallback(() => {
|
|
3504
3496
|
dispatch(dialogActions.clear());
|
|
3505
3497
|
}, []);
|
|
3506
|
-
return /* @__PURE__ */ jsxs(Dialog, { animate: !0, header: "Filters", id, onClose: handleClose, width: 1, children: [
|
|
3507
|
-
/* @__PURE__ */ jsxs(Box, { padding: 3, children: [
|
|
3508
|
-
/* @__PURE__ */ jsx(SearchFacets, { layout: "stack" }),
|
|
3509
|
-
/* @__PURE__ */ jsx(SearchFacetsControl, {})
|
|
3498
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, header: "Filters", id, onClose: handleClose, width: 1, children: [
|
|
3499
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { padding: 3, children: [
|
|
3500
|
+
/* @__PURE__ */ jsxRuntime.jsx(SearchFacets, { layout: "stack" }),
|
|
3501
|
+
/* @__PURE__ */ jsxRuntime.jsx(SearchFacetsControl, {})
|
|
3510
3502
|
] }),
|
|
3511
3503
|
children
|
|
3512
3504
|
] });
|
|
@@ -3514,13 +3506,13 @@ const DialogAssetEdit = (props) => {
|
|
|
3514
3506
|
const {
|
|
3515
3507
|
children,
|
|
3516
3508
|
dialog: { id }
|
|
3517
|
-
} = props, dispatch = useDispatch(), creating = useTypedSelector((state) => state.tags.creating), creatingError = useTypedSelector((state) => state.tags.creatingError), {
|
|
3509
|
+
} = props, dispatch = reactRedux.useDispatch(), creating = useTypedSelector((state) => state.tags.creating), creatingError = useTypedSelector((state) => state.tags.creatingError), {
|
|
3518
3510
|
// Read the formState before render to subscribe the form state through Proxy
|
|
3519
3511
|
formState: { errors, isDirty, isValid },
|
|
3520
3512
|
handleSubmit,
|
|
3521
3513
|
register,
|
|
3522
3514
|
setError
|
|
3523
|
-
} = useForm({
|
|
3515
|
+
} = reactHookForm.useForm({
|
|
3524
3516
|
defaultValues: {
|
|
3525
3517
|
name: ""
|
|
3526
3518
|
},
|
|
@@ -3532,11 +3524,11 @@ const DialogAssetEdit = (props) => {
|
|
|
3532
3524
|
const sanitizedFormData = sanitizeFormData(formData);
|
|
3533
3525
|
dispatch(tagsActions.createRequest({ name: sanitizedFormData.name }));
|
|
3534
3526
|
};
|
|
3535
|
-
return useEffect(() => {
|
|
3527
|
+
return react.useEffect(() => {
|
|
3536
3528
|
creatingError && setError("name", {
|
|
3537
3529
|
message: creatingError?.message
|
|
3538
3530
|
});
|
|
3539
|
-
}, [creatingError, setError]), /* @__PURE__ */ jsxs(Dialog, { animate: !0, footer: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsx(
|
|
3531
|
+
}, [creatingError, setError]), /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, footer: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3540
3532
|
FormSubmitButton,
|
|
3541
3533
|
{
|
|
3542
3534
|
disabled: formUpdating || !isDirty || !isValid,
|
|
@@ -3544,9 +3536,9 @@ const DialogAssetEdit = (props) => {
|
|
|
3544
3536
|
onClick: handleSubmit(onSubmit)
|
|
3545
3537
|
}
|
|
3546
3538
|
) }) }), {}), header: "Create Tag", id, onClose: handleClose, width: 1, children: [
|
|
3547
|
-
/* @__PURE__ */ jsxs(Box, { as: "form", padding: 4, onSubmit: handleSubmit(onSubmit), children: [
|
|
3548
|
-
/* @__PURE__ */ jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
|
|
3549
|
-
/* @__PURE__ */ jsx(
|
|
3539
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", padding: 4, onSubmit: handleSubmit(onSubmit), children: [
|
|
3540
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
|
|
3541
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3550
3542
|
FormFieldInputText,
|
|
3551
3543
|
{
|
|
3552
3544
|
...register("name"),
|
|
@@ -3563,7 +3555,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3563
3555
|
const {
|
|
3564
3556
|
children,
|
|
3565
3557
|
dialog: { id, tagId }
|
|
3566
|
-
} = props, client = useVersionedClient(), dispatch = useDispatch(), tagItem = useTypedSelector((state) => selectTagById(state, String(tagId))), [tagSnapshot, setTagSnapshot] = useState(tagItem?.tag), currentTag = tagItem ? tagItem?.tag : tagSnapshot, generateDefaultValues = (tag) => ({
|
|
3558
|
+
} = props, client = useVersionedClient(), dispatch = reactRedux.useDispatch(), tagItem = useTypedSelector((state) => selectTagById(state, String(tagId))), [tagSnapshot, setTagSnapshot] = react.useState(tagItem?.tag), currentTag = tagItem ? tagItem?.tag : tagSnapshot, generateDefaultValues = (tag) => ({
|
|
3567
3559
|
name: tag?.name?.current || ""
|
|
3568
3560
|
}), {
|
|
3569
3561
|
// Read the formState before render to subscribe the form state through Proxy
|
|
@@ -3572,7 +3564,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3572
3564
|
register,
|
|
3573
3565
|
reset,
|
|
3574
3566
|
setError
|
|
3575
|
-
} = useForm({
|
|
3567
|
+
} = reactHookForm.useForm({
|
|
3576
3568
|
defaultValues: generateDefaultValues(tagItem?.tag),
|
|
3577
3569
|
mode: "onChange",
|
|
3578
3570
|
resolver: zodFormResolver(tagFormSchema)
|
|
@@ -3601,27 +3593,28 @@ const DialogAssetEdit = (props) => {
|
|
|
3601
3593
|
tag: tagItem?.tag
|
|
3602
3594
|
})
|
|
3603
3595
|
);
|
|
3604
|
-
}, handleTagUpdate = useCallback(
|
|
3596
|
+
}, handleTagUpdate = react.useCallback(
|
|
3605
3597
|
(update) => {
|
|
3606
3598
|
const { result, transition } = update;
|
|
3607
3599
|
result && transition === "update" && (setTagSnapshot(result), reset(generateDefaultValues(result)));
|
|
3608
3600
|
},
|
|
3609
3601
|
[reset]
|
|
3610
3602
|
);
|
|
3611
|
-
|
|
3603
|
+
react.useEffect(() => {
|
|
3612
3604
|
tagItem?.error && setError("name", {
|
|
3613
3605
|
message: tagItem.error?.message
|
|
3614
3606
|
});
|
|
3615
|
-
}, [setError, tagItem.error]), useEffect(() => {
|
|
3607
|
+
}, [setError, tagItem.error]), react.useEffect(() => {
|
|
3616
3608
|
if (!tagItem?.tag)
|
|
3617
3609
|
return;
|
|
3618
|
-
const subscriptionAsset = client.listen(
|
|
3610
|
+
const subscriptionAsset = client.listen(groq__default.default`*[_id == $id]`, { id: tagItem?.tag._id }).subscribe(handleTagUpdate);
|
|
3619
3611
|
return () => {
|
|
3620
3612
|
subscriptionAsset?.unsubscribe();
|
|
3621
3613
|
};
|
|
3622
|
-
}, [client, handleTagUpdate, tagItem?.tag])
|
|
3623
|
-
|
|
3624
|
-
|
|
3614
|
+
}, [client, handleTagUpdate, tagItem?.tag]);
|
|
3615
|
+
const Footer = () => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "space-between", children: [
|
|
3616
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3617
|
+
ui.Button,
|
|
3625
3618
|
{
|
|
3626
3619
|
disabled: formUpdating,
|
|
3627
3620
|
fontSize: 1,
|
|
@@ -3631,7 +3624,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3631
3624
|
tone: "critical"
|
|
3632
3625
|
}
|
|
3633
3626
|
),
|
|
3634
|
-
/* @__PURE__ */ jsx(
|
|
3627
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3635
3628
|
FormSubmitButton,
|
|
3636
3629
|
{
|
|
3637
3630
|
disabled: formUpdating || !isDirty || !isValid,
|
|
@@ -3640,11 +3633,12 @@ const DialogAssetEdit = (props) => {
|
|
|
3640
3633
|
onClick: handleSubmit(onSubmit)
|
|
3641
3634
|
}
|
|
3642
3635
|
)
|
|
3643
|
-
] }) })
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
/* @__PURE__ */ jsx(
|
|
3647
|
-
/* @__PURE__ */ jsx(
|
|
3636
|
+
] }) });
|
|
3637
|
+
return currentTag ? /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, footer: /* @__PURE__ */ jsxRuntime.jsx(Footer, {}), header: "Edit Tag", id, onClose: handleClose, width: 1, children: [
|
|
3638
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", padding: 4, onSubmit: handleSubmit(onSubmit), children: [
|
|
3639
|
+
!tagItem && /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "This tag cannot be found \u2013 it may have been deleted." }) }),
|
|
3640
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
|
|
3641
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3648
3642
|
FormFieldInputText,
|
|
3649
3643
|
{
|
|
3650
3644
|
...register("name"),
|
|
@@ -3657,9 +3651,9 @@ const DialogAssetEdit = (props) => {
|
|
|
3657
3651
|
] }),
|
|
3658
3652
|
children
|
|
3659
3653
|
] }) : null;
|
|
3660
|
-
}, TagContainer = styled(Flex)`
|
|
3654
|
+
}, TagContainer = styledComponents.styled(ui.Flex)`
|
|
3661
3655
|
height: ${PANEL_HEIGHT}px;
|
|
3662
|
-
`, ButtonContainer = styled(Flex)`
|
|
3656
|
+
`, ButtonContainer = styledComponents.styled(ui.Flex)`
|
|
3663
3657
|
@media (pointer: fine) {
|
|
3664
3658
|
visibility: hidden;
|
|
3665
3659
|
}
|
|
@@ -3671,16 +3665,16 @@ const DialogAssetEdit = (props) => {
|
|
|
3671
3665
|
}
|
|
3672
3666
|
`, TagButton = (props) => {
|
|
3673
3667
|
const { disabled, icon, onClick, tone, tooltip } = props;
|
|
3674
|
-
return /* @__PURE__ */ jsx(
|
|
3675
|
-
Tooltip,
|
|
3668
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3669
|
+
ui.Tooltip,
|
|
3676
3670
|
{
|
|
3677
3671
|
animate: !0,
|
|
3678
|
-
content: /* @__PURE__ */ jsx(Container
|
|
3672
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: tooltip }) }),
|
|
3679
3673
|
disabled: "ontouchstart" in window,
|
|
3680
3674
|
placement: "top",
|
|
3681
3675
|
portal: !0,
|
|
3682
|
-
children: /* @__PURE__ */ jsx(
|
|
3683
|
-
Button,
|
|
3676
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3677
|
+
ui.Button,
|
|
3684
3678
|
{
|
|
3685
3679
|
disabled,
|
|
3686
3680
|
fontSize: 1,
|
|
@@ -3694,7 +3688,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3694
3688
|
}
|
|
3695
3689
|
);
|
|
3696
3690
|
}, Tag = (props) => {
|
|
3697
|
-
const { actions, tag } = props, dispatch = useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), isSearchFacetTag = useTypedSelector((state) => selectIsSearchFacetTag(state, tag?.tag?._id)), handleSearchFacetTagRemove = () => {
|
|
3691
|
+
const { actions, tag } = props, dispatch = reactRedux.useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), isSearchFacetTag = useTypedSelector((state) => selectIsSearchFacetTag(state, tag?.tag?._id)), handleSearchFacetTagRemove = () => {
|
|
3698
3692
|
dispatch(searchActions.facetsRemoveByTag({ tagId: tag.tag._id }));
|
|
3699
3693
|
}, handleShowAddTagToAssetsDialog = () => {
|
|
3700
3694
|
dispatch(dialogActions.showConfirmAssetsTagAdd({ assetsPicked, tag: tag.tag }));
|
|
@@ -3720,9 +3714,9 @@ const DialogAssetEdit = (props) => {
|
|
|
3720
3714
|
}) : searchActions.facetsAdd({ facet: searchFacet })
|
|
3721
3715
|
);
|
|
3722
3716
|
};
|
|
3723
|
-
return /* @__PURE__ */ jsxs(TagContainer, { align: "center", flex: 1, justify: "space-between", paddingLeft: 3, children: [
|
|
3724
|
-
/* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(
|
|
3725
|
-
Text,
|
|
3717
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(TagContainer, { align: "center", flex: 1, justify: "space-between", paddingLeft: 3, children: [
|
|
3718
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3719
|
+
ui.Text,
|
|
3726
3720
|
{
|
|
3727
3721
|
muted: !0,
|
|
3728
3722
|
size: 1,
|
|
@@ -3734,51 +3728,51 @@ const DialogAssetEdit = (props) => {
|
|
|
3734
3728
|
children: tag?.tag?.name?.current
|
|
3735
3729
|
}
|
|
3736
3730
|
) }),
|
|
3737
|
-
/* @__PURE__ */ jsxs(ButtonContainer, { align: "center", style: { flexShrink: 0 }, children: [
|
|
3738
|
-
actions?.includes("search") && /* @__PURE__ */ jsx(
|
|
3731
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ButtonContainer, { align: "center", style: { flexShrink: 0 }, children: [
|
|
3732
|
+
actions?.includes("search") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3739
3733
|
TagButton,
|
|
3740
3734
|
{
|
|
3741
3735
|
disabled: tag?.updating,
|
|
3742
|
-
icon: isSearchFacetTag ? /* @__PURE__ */ jsx(CloseIcon, {}) : /* @__PURE__ */ jsx(SearchIcon, {}),
|
|
3736
|
+
icon: isSearchFacetTag ? /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(icons.SearchIcon, {}),
|
|
3743
3737
|
onClick: isSearchFacetTag ? handleSearchFacetTagRemove : handleSearchFacetTagAddOrUpdate,
|
|
3744
3738
|
tooltip: isSearchFacetTag ? "Remove filter" : "Filter by tag"
|
|
3745
3739
|
}
|
|
3746
3740
|
),
|
|
3747
|
-
actions?.includes("edit") && /* @__PURE__ */ jsx(
|
|
3741
|
+
actions?.includes("edit") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3748
3742
|
TagButton,
|
|
3749
3743
|
{
|
|
3750
3744
|
disabled: tag?.updating,
|
|
3751
|
-
icon: /* @__PURE__ */ jsx(EditIcon, {}),
|
|
3745
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EditIcon, {}),
|
|
3752
3746
|
onClick: handleShowTagEditDialog,
|
|
3753
3747
|
tone: "primary",
|
|
3754
3748
|
tooltip: "Edit tag"
|
|
3755
3749
|
}
|
|
3756
3750
|
),
|
|
3757
|
-
actions?.includes("applyAll") && /* @__PURE__ */ jsx(
|
|
3751
|
+
actions?.includes("applyAll") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3758
3752
|
TagButton,
|
|
3759
3753
|
{
|
|
3760
3754
|
disabled: tag?.updating,
|
|
3761
|
-
icon: /* @__PURE__ */ jsx(ArrowUpIcon, {}),
|
|
3755
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpIcon, {}),
|
|
3762
3756
|
onClick: handleShowAddTagToAssetsDialog,
|
|
3763
3757
|
tone: "primary",
|
|
3764
3758
|
tooltip: "Add tag to selected assets"
|
|
3765
3759
|
}
|
|
3766
3760
|
),
|
|
3767
|
-
actions?.includes("removeAll") && /* @__PURE__ */ jsx(
|
|
3761
|
+
actions?.includes("removeAll") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3768
3762
|
TagButton,
|
|
3769
3763
|
{
|
|
3770
3764
|
disabled: tag?.updating,
|
|
3771
|
-
icon: /* @__PURE__ */ jsx(ArrowDownIcon, {}),
|
|
3765
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownIcon, {}),
|
|
3772
3766
|
onClick: handleShowRemoveTagFromAssetsDialog,
|
|
3773
3767
|
tone: "critical",
|
|
3774
3768
|
tooltip: "Remove tag from selected assets"
|
|
3775
3769
|
}
|
|
3776
3770
|
),
|
|
3777
|
-
actions?.includes("delete") && /* @__PURE__ */ jsx(
|
|
3771
|
+
actions?.includes("delete") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3778
3772
|
TagButton,
|
|
3779
3773
|
{
|
|
3780
3774
|
disabled: tag?.updating,
|
|
3781
|
-
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
3775
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.TrashIcon, {}),
|
|
3782
3776
|
onClick: handleShowTagDeleteDialog,
|
|
3783
3777
|
tone: "critical",
|
|
3784
3778
|
tooltip: "Delete tag"
|
|
@@ -3786,23 +3780,23 @@ const DialogAssetEdit = (props) => {
|
|
|
3786
3780
|
)
|
|
3787
3781
|
] })
|
|
3788
3782
|
] });
|
|
3789
|
-
}, VirtualRow$1 = memo(
|
|
3783
|
+
}, VirtualRow$1 = react.memo(
|
|
3790
3784
|
({
|
|
3791
3785
|
isScrolling,
|
|
3792
3786
|
item
|
|
3793
|
-
}) => typeof item == "string" ? /* @__PURE__ */ jsx(
|
|
3794
|
-
Flex,
|
|
3787
|
+
}) => typeof item == "string" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3788
|
+
ui.Flex,
|
|
3795
3789
|
{
|
|
3796
3790
|
align: "center",
|
|
3797
3791
|
justify: "space-between",
|
|
3798
3792
|
paddingX: 3,
|
|
3799
3793
|
style: { height: `${PANEL_HEIGHT}px` },
|
|
3800
|
-
children: /* @__PURE__ */ jsx(Label, { size: 0, children: item })
|
|
3794
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 0, children: item })
|
|
3801
3795
|
},
|
|
3802
3796
|
item
|
|
3803
|
-
) : /* @__PURE__ */ jsx(Tag, { actions: isScrolling ? void 0 : item.actions, tag: item }, item.tag?._id)
|
|
3797
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(Tag, { actions: isScrolling ? void 0 : item.actions, tag: item }, item.tag?._id)
|
|
3804
3798
|
), TagsVirtualized = () => {
|
|
3805
|
-
const assetsPicked = useTypedSelector(selectAssetsPicked), tags = useTypedSelector(selectTags), [isScrolling, setIsScrolling] = useState(!1), pickedTagIds = assetsPicked?.reduce((acc, val) => {
|
|
3799
|
+
const assetsPicked = useTypedSelector(selectAssetsPicked), tags = useTypedSelector(selectTags), [isScrolling, setIsScrolling] = react.useState(!1), pickedTagIds = assetsPicked?.reduce((acc, val) => {
|
|
3806
3800
|
const assetTagIds = val?.asset?.opt?.media?.tags?.map((tag) => tag._ref) || [];
|
|
3807
3801
|
return acc = acc.concat(assetTagIds), acc;
|
|
3808
3802
|
}, []), pickedTagIdsUnique = [...new Set(pickedTagIds)], tagIdsSegmented = pickedTagIdsUnique.reduce(
|
|
@@ -3840,8 +3834,8 @@ const DialogAssetEdit = (props) => {
|
|
|
3840
3834
|
//
|
|
3841
3835
|
"Unused",
|
|
3842
3836
|
...tagsUnused
|
|
3843
|
-
])), /* @__PURE__ */ jsx(
|
|
3844
|
-
Virtuoso,
|
|
3837
|
+
])), /* @__PURE__ */ jsxRuntime.jsx(
|
|
3838
|
+
reactVirtuoso.Virtuoso,
|
|
3845
3839
|
{
|
|
3846
3840
|
className: "media__custom-scrollbar",
|
|
3847
3841
|
computeItemKey: (index) => {
|
|
@@ -3849,17 +3843,17 @@ const DialogAssetEdit = (props) => {
|
|
|
3849
3843
|
return typeof item == "string" ? item : item.tag._id;
|
|
3850
3844
|
},
|
|
3851
3845
|
isScrolling: setIsScrolling,
|
|
3852
|
-
itemContent: (index) => /* @__PURE__ */ jsx(VirtualRow$1, { isScrolling, item: items[index] }),
|
|
3846
|
+
itemContent: (index) => /* @__PURE__ */ jsxRuntime.jsx(VirtualRow$1, { isScrolling, item: items[index] }),
|
|
3853
3847
|
style: { flex: 1, overflowX: "hidden" },
|
|
3854
3848
|
totalCount: items.length
|
|
3855
3849
|
}
|
|
3856
3850
|
);
|
|
3857
3851
|
}, TagViewHeader = ({ allowCreate, light, title }) => {
|
|
3858
|
-
const scheme = useColorSchemeValue(), dispatch = useDispatch(), tagsCreating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching), handleTagCreate = () => {
|
|
3852
|
+
const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), tagsCreating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching), handleTagCreate = () => {
|
|
3859
3853
|
dispatch(DIALOG_ACTIONS.showTagCreate());
|
|
3860
3854
|
};
|
|
3861
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
3862
|
-
Flex,
|
|
3855
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3856
|
+
ui.Flex,
|
|
3863
3857
|
{
|
|
3864
3858
|
align: "center",
|
|
3865
3859
|
justify: "space-between",
|
|
@@ -3871,16 +3865,16 @@ const DialogAssetEdit = (props) => {
|
|
|
3871
3865
|
height: `${PANEL_HEIGHT}px`
|
|
3872
3866
|
},
|
|
3873
3867
|
children: [
|
|
3874
|
-
/* @__PURE__ */ jsxs(Inline, { space: 2, children: [
|
|
3875
|
-
/* @__PURE__ */ jsx(Label, { size: 0, children: title }),
|
|
3876
|
-
tagsFetching && /* @__PURE__ */ jsx(Label, { size: 0, style: { opacity: 0.3 }, children: "Loading..." })
|
|
3868
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 2, children: [
|
|
3869
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 0, children: title }),
|
|
3870
|
+
tagsFetching && /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 0, style: { opacity: 0.3 }, children: "Loading..." })
|
|
3877
3871
|
] }),
|
|
3878
|
-
allowCreate && /* @__PURE__ */ jsx(Box, { marginRight: 1, children: /* @__PURE__ */ jsx(
|
|
3879
|
-
Button,
|
|
3872
|
+
allowCreate && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3873
|
+
ui.Button,
|
|
3880
3874
|
{
|
|
3881
3875
|
disabled: tagsCreating,
|
|
3882
3876
|
fontSize: 1,
|
|
3883
|
-
icon: ComposeIcon,
|
|
3877
|
+
icon: icons.ComposeIcon,
|
|
3884
3878
|
mode: "bleed",
|
|
3885
3879
|
onClick: handleTagCreate,
|
|
3886
3880
|
style: {
|
|
@@ -3894,8 +3888,8 @@ const DialogAssetEdit = (props) => {
|
|
|
3894
3888
|
) });
|
|
3895
3889
|
}, TagView = () => {
|
|
3896
3890
|
const numPickedAssets = useTypedSelector(selectAssetsPickedLength), tags = useTypedSelector(selectTags), fetching = useTypedSelector((state) => state.tags.fetching), fetchComplete = useTypedSelector((state) => state.tags.fetchCount) !== -1, hasTags = !fetching && tags?.length > 0, hasPicked = numPickedAssets > 0;
|
|
3897
|
-
return /* @__PURE__ */ jsxs(Flex, { direction: "column", flex: 1, height: "fill", children: [
|
|
3898
|
-
/* @__PURE__ */ jsx(
|
|
3891
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", flex: 1, height: "fill", children: [
|
|
3892
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3899
3893
|
TagViewHeader,
|
|
3900
3894
|
{
|
|
3901
3895
|
allowCreate: !0,
|
|
@@ -3903,26 +3897,26 @@ const DialogAssetEdit = (props) => {
|
|
|
3903
3897
|
title: hasPicked ? "Tags (in selection)" : "Tags"
|
|
3904
3898
|
}
|
|
3905
3899
|
),
|
|
3906
|
-
fetchComplete && !hasTags && /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsx("em", { children: "No tags" }) }) }),
|
|
3907
|
-
hasTags && /* @__PURE__ */ jsx(TagsVirtualized, {})
|
|
3900
|
+
fetchComplete && !hasTags && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: "No tags" }) }) }),
|
|
3901
|
+
hasTags && /* @__PURE__ */ jsxRuntime.jsx(TagsVirtualized, {})
|
|
3908
3902
|
] });
|
|
3909
3903
|
}, DialogTags = (props) => {
|
|
3910
3904
|
const {
|
|
3911
3905
|
children,
|
|
3912
3906
|
dialog: { id }
|
|
3913
|
-
} = props, dispatch = useDispatch(), handleClose = useCallback(() => {
|
|
3907
|
+
} = props, dispatch = reactRedux.useDispatch(), handleClose = react.useCallback(() => {
|
|
3914
3908
|
dispatch(dialogActions.clear());
|
|
3915
3909
|
}, []);
|
|
3916
|
-
return /* @__PURE__ */ jsxs(Dialog, { animate: !0, header: "All Tags", id, onClose: handleClose, width: 1, children: [
|
|
3917
|
-
/* @__PURE__ */ jsx(
|
|
3918
|
-
Box,
|
|
3910
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, header: "All Tags", id, onClose: handleClose, width: 1, children: [
|
|
3911
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3912
|
+
ui.Box,
|
|
3919
3913
|
{
|
|
3920
3914
|
style: {
|
|
3921
3915
|
height: "100%",
|
|
3922
3916
|
minHeight: "420px"
|
|
3923
3917
|
// explicit height required as <TagView> is virtualized
|
|
3924
3918
|
},
|
|
3925
|
-
children: /* @__PURE__ */ jsx(TagView, {})
|
|
3919
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TagView, {})
|
|
3926
3920
|
}
|
|
3927
3921
|
),
|
|
3928
3922
|
children
|
|
@@ -3932,43 +3926,43 @@ const DialogAssetEdit = (props) => {
|
|
|
3932
3926
|
if (dialogs.length === 0 || index >= dialogs.length)
|
|
3933
3927
|
return null;
|
|
3934
3928
|
const dialog = dialogs[index], childDialogs = renderDialogs(dialogs, index + 1);
|
|
3935
|
-
return dialog.type === "assetEdit" ? /* @__PURE__ */ jsx(DialogAssetEdit, { dialog, children: childDialogs }, index) : dialog.type === "confirm" ? /* @__PURE__ */ jsx(DialogConfirm, { dialog, children: childDialogs }, index) : dialog.type === "searchFacets" ? /* @__PURE__ */ jsx(DialogSearchFacets, { dialog, children: childDialogs }, index) : dialog.type === "tagCreate" ? /* @__PURE__ */ jsx(DialogTagCreate, { dialog, children: childDialogs }, index) : dialog.type === "tagEdit" ? /* @__PURE__ */ jsx(DialogTagEdit, { dialog, children: childDialogs }, index) : dialog.type === "tags" ? /* @__PURE__ */ jsx(DialogTags, { dialog, children: childDialogs }, index) : null;
|
|
3929
|
+
return dialog.type === "assetEdit" ? /* @__PURE__ */ jsxRuntime.jsx(DialogAssetEdit, { dialog, children: childDialogs }, index) : dialog.type === "confirm" ? /* @__PURE__ */ jsxRuntime.jsx(DialogConfirm, { dialog, children: childDialogs }, index) : dialog.type === "searchFacets" ? /* @__PURE__ */ jsxRuntime.jsx(DialogSearchFacets, { dialog, children: childDialogs }, index) : dialog.type === "tagCreate" ? /* @__PURE__ */ jsxRuntime.jsx(DialogTagCreate, { dialog, children: childDialogs }, index) : dialog.type === "tagEdit" ? /* @__PURE__ */ jsxRuntime.jsx(DialogTagEdit, { dialog, children: childDialogs }, index) : dialog.type === "tags" ? /* @__PURE__ */ jsxRuntime.jsx(DialogTags, { dialog, children: childDialogs }, index) : null;
|
|
3936
3930
|
};
|
|
3937
3931
|
return renderDialogs(currentDialogs, 0);
|
|
3938
|
-
}, DropzoneDispatchContext = createContext(void 0), DropzoneDispatchProvider = (props) => {
|
|
3932
|
+
}, DropzoneDispatchContext = react.createContext(void 0), DropzoneDispatchProvider = (props) => {
|
|
3939
3933
|
const { children, open } = props, contextValue = { open };
|
|
3940
|
-
return /* @__PURE__ */ jsx(DropzoneDispatchContext.Provider, { value: contextValue, children });
|
|
3934
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropzoneDispatchContext.Provider, { value: contextValue, children });
|
|
3941
3935
|
}, useDropzoneActions = () => {
|
|
3942
|
-
const context = useContext(DropzoneDispatchContext);
|
|
3936
|
+
const context = react.useContext(DropzoneDispatchContext);
|
|
3943
3937
|
if (context === void 0)
|
|
3944
3938
|
throw new Error("useDropzoneActions must be used within an DropzoneDispatchProvider");
|
|
3945
3939
|
return context;
|
|
3946
3940
|
}, Header = (props) => {
|
|
3947
3941
|
const { onClose } = props, { open } = useDropzoneActions(), { onSelect } = useAssetSourceActions(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), selectedDocument = useTypedSelector((state) => state.selected.document), { directUploads } = useToolOptions();
|
|
3948
|
-
return /* @__PURE__ */ jsx(Box, { paddingY: 2, children: /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "space-between", children: [
|
|
3949
|
-
/* @__PURE__ */ jsx(Box, { flex: 1, marginX: 3, children: /* @__PURE__ */ jsxs(Inline, { style: { whiteSpace: "nowrap" }, children: [
|
|
3950
|
-
/* @__PURE__ */ jsx(Text, { textOverflow: "ellipsis", weight: "semibold", children: /* @__PURE__ */ jsx("span", { children: onSelect ? `Insert ${assetTypes.join(" or ")}` : "Browse Assets" }) }),
|
|
3951
|
-
selectedDocument && /* @__PURE__ */ jsx(Box, { display: ["none", "none", "block"], children: /* @__PURE__ */ jsxs(Text, { children: [
|
|
3952
|
-
/* @__PURE__ */ jsx("span", { style: { margin: "0 0.5em" }, children: /* @__PURE__ */ jsx(Icon, { symbol: "arrow-right" }) }),
|
|
3953
|
-
/* @__PURE__ */ jsx("span", { style: { textTransform: "capitalize" }, children: selectedDocument._type })
|
|
3942
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingY: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "space-between", children: [
|
|
3943
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, marginX: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { style: { whiteSpace: "nowrap" }, children: [
|
|
3944
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { textOverflow: "ellipsis", weight: "semibold", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: onSelect ? `Insert ${assetTypes.join(" or ")}` : "Browse Assets" }) }),
|
|
3945
|
+
selectedDocument && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { display: ["none", "none", "block"], children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
|
|
3946
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { margin: "0 0.5em" }, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Icon, { symbol: "arrow-right" }) }),
|
|
3947
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { textTransform: "capitalize" }, children: selectedDocument._type })
|
|
3954
3948
|
] }) })
|
|
3955
3949
|
] }) }),
|
|
3956
|
-
/* @__PURE__ */ jsxs(Flex, { marginX: 2, children: [
|
|
3957
|
-
directUploads && /* @__PURE__ */ jsx(
|
|
3958
|
-
Button,
|
|
3950
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { marginX: 2, children: [
|
|
3951
|
+
directUploads && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3952
|
+
ui.Button,
|
|
3959
3953
|
{
|
|
3960
3954
|
fontSize: 1,
|
|
3961
|
-
icon: UploadIcon,
|
|
3955
|
+
icon: icons.UploadIcon,
|
|
3962
3956
|
mode: "bleed",
|
|
3963
3957
|
onClick: open,
|
|
3964
|
-
text: `Upload ${assetTypes.length === 1 ?
|
|
3958
|
+
text: `Upload ${assetTypes.length === 1 ? pluralize__default.default(assetTypes[0]) : "assets"}`
|
|
3965
3959
|
}
|
|
3966
3960
|
),
|
|
3967
|
-
onClose && /* @__PURE__ */ jsx(Box, { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx(
|
|
3968
|
-
Button,
|
|
3961
|
+
onClose && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3962
|
+
ui.Button,
|
|
3969
3963
|
{
|
|
3970
3964
|
disabled: !onClose,
|
|
3971
|
-
icon: CloseIcon,
|
|
3965
|
+
icon: icons.CloseIcon,
|
|
3972
3966
|
mode: "bleed",
|
|
3973
3967
|
onClick: onClose,
|
|
3974
3968
|
radius: 2
|
|
@@ -3977,10 +3971,10 @@ const DialogAssetEdit = (props) => {
|
|
|
3977
3971
|
] })
|
|
3978
3972
|
] }) });
|
|
3979
3973
|
}, useBreakpointIndex = () => {
|
|
3980
|
-
const mediaQueryLists = studioTheme?.container?.map(
|
|
3974
|
+
const mediaQueryLists = ui.studioTheme?.container?.map(
|
|
3981
3975
|
(width) => window.matchMedia(`(max-width: ${width}px)`)
|
|
3982
|
-
), getBreakpointIndex = () => mediaQueryLists.findIndex((mql) => mql.matches), [value, setValue] = useState(getBreakpointIndex());
|
|
3983
|
-
return useEffect(() => {
|
|
3976
|
+
), getBreakpointIndex = () => mediaQueryLists.findIndex((mql) => mql.matches), [value, setValue] = react.useState(getBreakpointIndex());
|
|
3977
|
+
return react.useEffect(() => {
|
|
3984
3978
|
const handleBreakpoint = () => {
|
|
3985
3979
|
setValue(getBreakpointIndex);
|
|
3986
3980
|
};
|
|
@@ -4004,7 +3998,7 @@ const DialogAssetEdit = (props) => {
|
|
|
4004
3998
|
}
|
|
4005
3999
|
};
|
|
4006
4000
|
}, []), value;
|
|
4007
|
-
}, selectCombinedItems = createSelector(
|
|
4001
|
+
}, selectCombinedItems = toolkit.createSelector(
|
|
4008
4002
|
[
|
|
4009
4003
|
(state) => state.assets.allIds,
|
|
4010
4004
|
(state) => state.uploads.allIds
|
|
@@ -4013,17 +4007,17 @@ const DialogAssetEdit = (props) => {
|
|
|
4013
4007
|
const assetItems = assetIds.map((id) => ({ id, type: "asset" }));
|
|
4014
4008
|
return [...uploadIds.map((id) => ({ id, type: "upload" })), ...assetItems];
|
|
4015
4009
|
}
|
|
4016
|
-
), CardWrapper$1 = styled(Flex)`
|
|
4010
|
+
), CardWrapper$1 = styledComponents.styled(ui.Flex)`
|
|
4017
4011
|
box-sizing: border-box;
|
|
4018
4012
|
height: 100%;
|
|
4019
4013
|
overflow: hidden;
|
|
4020
4014
|
position: relative;
|
|
4021
4015
|
width: 100%;
|
|
4022
|
-
`, CardContainer = styled(Flex)(({
|
|
4016
|
+
`, CardContainer = styledComponents.styled(ui.Flex)(({
|
|
4023
4017
|
$picked,
|
|
4024
4018
|
theme,
|
|
4025
4019
|
$updating
|
|
4026
|
-
}) => css`
|
|
4020
|
+
}) => styledComponents.css`
|
|
4027
4021
|
border: 1px solid transparent;
|
|
4028
4022
|
height: 100%;
|
|
4029
4023
|
pointer-events: ${$updating ? "none" : "auto"};
|
|
@@ -4034,16 +4028,16 @@ const DialogAssetEdit = (props) => {
|
|
|
4034
4028
|
|
|
4035
4029
|
border: ${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};
|
|
4036
4030
|
|
|
4037
|
-
${!$updating && css`
|
|
4031
|
+
${!$updating && styledComponents.css`
|
|
4038
4032
|
@media (hover: hover) and (pointer: fine) {
|
|
4039
4033
|
&:hover {
|
|
4040
4034
|
border: 1px solid var(--card-border-color);
|
|
4041
4035
|
}
|
|
4042
4036
|
}
|
|
4043
4037
|
`}
|
|
4044
|
-
`), ContextActionContainer$2 = styled(Flex)(({
|
|
4038
|
+
`), ContextActionContainer$2 = styledComponents.styled(ui.Flex)(({
|
|
4045
4039
|
$scheme
|
|
4046
|
-
}) => css`
|
|
4040
|
+
}) => styledComponents.css`
|
|
4047
4041
|
cursor: pointer;
|
|
4048
4042
|
height: ${PANEL_HEIGHT}px;
|
|
4049
4043
|
transition: all 300ms;
|
|
@@ -4052,10 +4046,10 @@ const DialogAssetEdit = (props) => {
|
|
|
4052
4046
|
background: ${getSchemeColor($scheme, "bg")};
|
|
4053
4047
|
}
|
|
4054
4048
|
}
|
|
4055
|
-
`), StyledWarningOutlineIcon = styled(WarningFilledIcon)(({ theme }) => ({
|
|
4049
|
+
`), StyledWarningOutlineIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
|
|
4056
4050
|
color: theme.sanity.color.spot.red
|
|
4057
4051
|
})), CardAsset$1 = (props) => {
|
|
4058
|
-
const { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions();
|
|
4052
|
+
const { id, selected } = props, scheme = sanity.useColorSchemeValue(), shiftPressed = useKeyPress("shift"), dispatch = reactRedux.useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions();
|
|
4059
4053
|
if (!asset)
|
|
4060
4054
|
return null;
|
|
4061
4055
|
const handleAssetClick = (e) => {
|
|
@@ -4068,9 +4062,9 @@ const DialogAssetEdit = (props) => {
|
|
|
4068
4062
|
}, handleContextActionClick = (e) => {
|
|
4069
4063
|
e.stopPropagation(), onSelect ? dispatch(dialogActions.showAssetEdit({ assetId: asset._id })) : shiftPressed.current && !picked ? dispatch(assetsActions.pickRange({ startId: lastPicked || asset._id, endId: asset._id })) : dispatch(assetsActions.pick({ assetId: asset._id, picked: !picked }));
|
|
4070
4064
|
}, opacityContainer = updating ? 0.5 : 1, opacityPreview = selected || updating ? 0.25 : 1;
|
|
4071
|
-
return /* @__PURE__ */ jsx(CardWrapper$1, { padding: 1, children: /* @__PURE__ */ jsxs(CardContainer, { direction: "column", $picked: picked, $updating: item.updating, children: [
|
|
4072
|
-
/* @__PURE__ */ jsxs(
|
|
4073
|
-
Box,
|
|
4065
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CardWrapper$1, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(CardContainer, { direction: "column", $picked: picked, $updating: item.updating, children: [
|
|
4066
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4067
|
+
ui.Box,
|
|
4074
4068
|
{
|
|
4075
4069
|
flex: 1,
|
|
4076
4070
|
style: {
|
|
@@ -4078,9 +4072,9 @@ const DialogAssetEdit = (props) => {
|
|
|
4078
4072
|
position: "relative"
|
|
4079
4073
|
},
|
|
4080
4074
|
children: [
|
|
4081
|
-
/* @__PURE__ */ jsxs("div", { onClick: handleAssetClick, style: { height: "100%", opacity: opacityPreview }, children: [
|
|
4082
|
-
isFileAsset(asset) && /* @__PURE__ */ jsx(FileIcon, { extension: asset.extension, width: "80px" }),
|
|
4083
|
-
isImageAsset(asset) && /* @__PURE__ */ jsx(
|
|
4075
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { onClick: handleAssetClick, style: { height: "100%", opacity: opacityPreview }, children: [
|
|
4076
|
+
isFileAsset(asset) && /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { extension: asset.extension, width: "80px" }),
|
|
4077
|
+
isImageAsset(asset) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4084
4078
|
Image$1,
|
|
4085
4079
|
{
|
|
4086
4080
|
draggable: !1,
|
|
@@ -4094,8 +4088,8 @@ const DialogAssetEdit = (props) => {
|
|
|
4094
4088
|
}
|
|
4095
4089
|
)
|
|
4096
4090
|
] }),
|
|
4097
|
-
selected && !updating && /* @__PURE__ */ jsx(
|
|
4098
|
-
Flex,
|
|
4091
|
+
selected && !updating && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4092
|
+
ui.Flex,
|
|
4099
4093
|
{
|
|
4100
4094
|
align: "center",
|
|
4101
4095
|
justify: "center",
|
|
@@ -4107,11 +4101,11 @@ const DialogAssetEdit = (props) => {
|
|
|
4107
4101
|
top: 0,
|
|
4108
4102
|
width: "100%"
|
|
4109
4103
|
},
|
|
4110
|
-
children: /* @__PURE__ */ jsx(Text, { size: 2, children: /* @__PURE__ */ jsx(CheckmarkCircleIcon, {}) })
|
|
4104
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 2, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckmarkCircleIcon, {}) })
|
|
4111
4105
|
}
|
|
4112
4106
|
),
|
|
4113
|
-
updating && /* @__PURE__ */ jsx(
|
|
4114
|
-
Flex,
|
|
4107
|
+
updating && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4108
|
+
ui.Flex,
|
|
4115
4109
|
{
|
|
4116
4110
|
align: "center",
|
|
4117
4111
|
justify: "center",
|
|
@@ -4122,13 +4116,13 @@ const DialogAssetEdit = (props) => {
|
|
|
4122
4116
|
top: 0,
|
|
4123
4117
|
width: "100%"
|
|
4124
4118
|
},
|
|
4125
|
-
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
4119
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {})
|
|
4126
4120
|
}
|
|
4127
4121
|
)
|
|
4128
4122
|
]
|
|
4129
4123
|
}
|
|
4130
4124
|
),
|
|
4131
|
-
/* @__PURE__ */ jsxs(
|
|
4125
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4132
4126
|
ContextActionContainer$2,
|
|
4133
4127
|
{
|
|
4134
4128
|
align: "center",
|
|
@@ -4137,16 +4131,16 @@ const DialogAssetEdit = (props) => {
|
|
|
4137
4131
|
$scheme: scheme,
|
|
4138
4132
|
style: { opacity: opacityContainer },
|
|
4139
4133
|
children: [
|
|
4140
|
-
onSelect ? /* @__PURE__ */ jsx(
|
|
4141
|
-
EditIcon,
|
|
4134
|
+
onSelect ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4135
|
+
icons.EditIcon,
|
|
4142
4136
|
{
|
|
4143
4137
|
style: {
|
|
4144
4138
|
flexShrink: 0,
|
|
4145
4139
|
opacity: 0.5
|
|
4146
4140
|
}
|
|
4147
4141
|
}
|
|
4148
|
-
) : /* @__PURE__ */ jsx(
|
|
4149
|
-
Checkbox,
|
|
4142
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4143
|
+
ui.Checkbox,
|
|
4150
4144
|
{
|
|
4151
4145
|
checked: picked,
|
|
4152
4146
|
readOnly: !0,
|
|
@@ -4157,12 +4151,12 @@ const DialogAssetEdit = (props) => {
|
|
|
4157
4151
|
}
|
|
4158
4152
|
}
|
|
4159
4153
|
),
|
|
4160
|
-
/* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 0, textOverflow: "ellipsis", children: asset.originalFilename }) })
|
|
4154
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 0, textOverflow: "ellipsis", children: asset.originalFilename }) })
|
|
4161
4155
|
]
|
|
4162
4156
|
}
|
|
4163
4157
|
),
|
|
4164
|
-
error && /* @__PURE__ */ jsx(
|
|
4165
|
-
Box,
|
|
4158
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4159
|
+
ui.Box,
|
|
4166
4160
|
{
|
|
4167
4161
|
padding: 3,
|
|
4168
4162
|
style: {
|
|
@@ -4170,21 +4164,21 @@ const DialogAssetEdit = (props) => {
|
|
|
4170
4164
|
right: 0,
|
|
4171
4165
|
top: 0
|
|
4172
4166
|
},
|
|
4173
|
-
children: /* @__PURE__ */ jsx(
|
|
4174
|
-
Tooltip,
|
|
4167
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4168
|
+
ui.Tooltip,
|
|
4175
4169
|
{
|
|
4176
4170
|
animate: !0,
|
|
4177
|
-
content: /* @__PURE__ */ jsx(Container
|
|
4171
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: error }) }),
|
|
4178
4172
|
placement: "left",
|
|
4179
4173
|
portal: !0,
|
|
4180
|
-
children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(StyledWarningOutlineIcon, { color: "critical" }) })
|
|
4174
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(StyledWarningOutlineIcon, { color: "critical" }) })
|
|
4181
4175
|
}
|
|
4182
4176
|
)
|
|
4183
4177
|
}
|
|
4184
4178
|
)
|
|
4185
4179
|
] }) });
|
|
4186
4180
|
};
|
|
4187
|
-
var CardAsset = memo(CardAsset$1);
|
|
4181
|
+
var CardAsset = react.memo(CardAsset$1);
|
|
4188
4182
|
const PREVIEW_WIDTH = 180, createBlob = (img) => new Promise((resolve) => {
|
|
4189
4183
|
const imageAspect = img.width / img.height, canvas = document.createElement("canvas");
|
|
4190
4184
|
canvas.width = PREVIEW_WIDTH, canvas.height = Math.max(PREVIEW_WIDTH / imageAspect, 1);
|
|
@@ -4203,17 +4197,17 @@ const PREVIEW_WIDTH = 180, createBlob = (img) => new Promise((resolve) => {
|
|
|
4203
4197
|
if (!blob)
|
|
4204
4198
|
throw Error("Unable to generate file Blob");
|
|
4205
4199
|
return window.URL.createObjectURL(blob);
|
|
4206
|
-
}, generatePreviewBlobUrl$ = (file) => of(null).pipe(mergeMap(() => from(generatePreviewBlobUrl(file)))), DEFAULT_CONCURRENCY = 4;
|
|
4200
|
+
}, generatePreviewBlobUrl$ = (file) => rxjs.of(null).pipe(operators$1.mergeMap(() => rxjs.from(generatePreviewBlobUrl(file)))), DEFAULT_CONCURRENCY = 4;
|
|
4207
4201
|
function remove(array, item) {
|
|
4208
4202
|
const index = array.indexOf(item);
|
|
4209
4203
|
return index > -1 && array.splice(index, 1), array;
|
|
4210
4204
|
}
|
|
4211
4205
|
const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
|
|
4212
|
-
const currentSubscriptions = [], pendingObservables = [], ready$ = new Subject();
|
|
4206
|
+
const currentSubscriptions = [], pendingObservables = [], ready$ = new rxjs.Subject();
|
|
4213
4207
|
function request(observable) {
|
|
4214
|
-
return new Observable((observer) => {
|
|
4208
|
+
return new rxjs.Observable((observer) => {
|
|
4215
4209
|
if (currentSubscriptions.length >= concurrency)
|
|
4216
|
-
return scheduleAndWait$(observable).pipe(mergeMap(request)).subscribe(observer);
|
|
4210
|
+
return scheduleAndWait$(observable).pipe(operators$1.mergeMap(request)).subscribe(observer);
|
|
4217
4211
|
const subscription = observable.subscribe(observer);
|
|
4218
4212
|
return currentSubscriptions.push(subscription), () => {
|
|
4219
4213
|
for (remove(currentSubscriptions, subscription), remove(pendingObservables, observable), subscription.unsubscribe(); pendingObservables.length > 0 && currentSubscriptions.length < concurrency; )
|
|
@@ -4222,16 +4216,16 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
|
|
|
4222
4216
|
});
|
|
4223
4217
|
}
|
|
4224
4218
|
function scheduleAndWait$(observable) {
|
|
4225
|
-
return pendingObservables.push(observable), ready$.asObservable().pipe(first((obs) => obs === observable));
|
|
4219
|
+
return pendingObservables.push(observable), ready$.asObservable().pipe(operators$1.first((obs) => obs === observable));
|
|
4226
4220
|
}
|
|
4227
4221
|
return request;
|
|
4228
4222
|
}, withMaxConcurrency = (func, concurrency = DEFAULT_CONCURRENCY) => {
|
|
4229
4223
|
const throttler = createThrottler(concurrency);
|
|
4230
|
-
return (...args) => from(throttler(func(...args)));
|
|
4224
|
+
return (...args) => rxjs.from(throttler(func(...args)));
|
|
4231
4225
|
}, fetchExisting$ = (client, type, hash) => client.observable.fetch("*[_type == $documentType && sha1hash == $hash][0]", {
|
|
4232
4226
|
documentType: type,
|
|
4233
4227
|
hash
|
|
4234
|
-
}), readFile$ = (file) => new Observable((subscriber) => {
|
|
4228
|
+
}), readFile$ = (file) => new rxjs.Observable((subscriber) => {
|
|
4235
4229
|
const reader = new FileReader();
|
|
4236
4230
|
return reader.onload = () => {
|
|
4237
4231
|
subscriber.next(reader.result), subscriber.complete();
|
|
@@ -4240,25 +4234,25 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
|
|
|
4240
4234
|
}, reader.readAsArrayBuffer(file), () => {
|
|
4241
4235
|
reader.abort();
|
|
4242
4236
|
};
|
|
4243
|
-
}), hexFromBuffer = (buffer) => Array.prototype.map.call(new Uint8Array(buffer), (x) => `00${x.toString(16)}`.slice(-2)).join(""), hashFile$ = (file) => !window.crypto || !window.crypto.subtle || !window.FileReader ? throwError({
|
|
4237
|
+
}), hexFromBuffer = (buffer) => Array.prototype.map.call(new Uint8Array(buffer), (x) => `00${x.toString(16)}`.slice(-2)).join(""), hashFile$ = (file) => !window.crypto || !window.crypto.subtle || !window.FileReader ? rxjs.throwError({
|
|
4244
4238
|
message: "Unable to generate hash: uploads are only allowed in secure contexts",
|
|
4245
4239
|
statusCode: 500
|
|
4246
4240
|
}) : readFile$(file).pipe(
|
|
4247
|
-
mergeMap((arrayBuffer) => window.crypto.subtle.digest("SHA-1", arrayBuffer)),
|
|
4248
|
-
map(hexFromBuffer)
|
|
4249
|
-
), uploadSanityAsset$ = (client, assetType, file, hash) => of(null).pipe(
|
|
4241
|
+
operators$1.mergeMap((arrayBuffer) => window.crypto.subtle.digest("SHA-1", arrayBuffer)),
|
|
4242
|
+
operators$1.map(hexFromBuffer)
|
|
4243
|
+
), uploadSanityAsset$ = (client, assetType, file, hash) => rxjs.of(null).pipe(
|
|
4250
4244
|
// NOTE: the sanity api will still dedupe unique files, but this saves us from uploading the asset file entirely
|
|
4251
|
-
mergeMap(() => fetchExisting$(client, `sanity.${assetType}Asset`, hash)),
|
|
4245
|
+
operators$1.mergeMap(() => fetchExisting$(client, `sanity.${assetType}Asset`, hash)),
|
|
4252
4246
|
// Cancel if the asset already exists
|
|
4253
|
-
mergeMap((existingAsset) => existingAsset ? throwError({
|
|
4247
|
+
operators$1.mergeMap((existingAsset) => existingAsset ? rxjs.throwError({
|
|
4254
4248
|
message: "Asset already exists",
|
|
4255
4249
|
statusCode: 409
|
|
4256
|
-
}) : of(null)),
|
|
4257
|
-
mergeMap(() => client.observable.assets.upload(assetType, file, {
|
|
4250
|
+
}) : rxjs.of(null)),
|
|
4251
|
+
operators$1.mergeMap(() => client.observable.assets.upload(assetType, file, {
|
|
4258
4252
|
extract: ["blurhash", "exif", "location", "lqip", "palette"],
|
|
4259
4253
|
preserveFilename: !0
|
|
4260
4254
|
}).pipe(
|
|
4261
|
-
map(
|
|
4255
|
+
operators$1.map(
|
|
4262
4256
|
(event) => event.type === "response" ? {
|
|
4263
4257
|
// rewrite to a 'complete' event
|
|
4264
4258
|
asset: event.body.document,
|
|
@@ -4270,7 +4264,7 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
|
|
|
4270
4264
|
), uploadAsset$ = withMaxConcurrency(uploadSanityAsset$), initialState$2 = {
|
|
4271
4265
|
allIds: [],
|
|
4272
4266
|
byIds: {}
|
|
4273
|
-
}, uploadsSlice = createSlice({
|
|
4267
|
+
}, uploadsSlice = toolkit.createSlice({
|
|
4274
4268
|
name: "uploads",
|
|
4275
4269
|
initialState: initialState$2,
|
|
4276
4270
|
extraReducers: (builder) => {
|
|
@@ -4316,14 +4310,14 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
|
|
|
4316
4310
|
}
|
|
4317
4311
|
}
|
|
4318
4312
|
}), uploadsAssetStartEpic = (action$, _state$, { client }) => action$.pipe(
|
|
4319
|
-
filter(uploadsActions.uploadStart.match),
|
|
4320
|
-
mergeMap((action) => {
|
|
4313
|
+
operators$1.filter(uploadsActions.uploadStart.match),
|
|
4314
|
+
operators$1.mergeMap((action) => {
|
|
4321
4315
|
const { file, uploadItem } = action.payload;
|
|
4322
|
-
return merge(
|
|
4316
|
+
return rxjs.merge(
|
|
4323
4317
|
// Generate low res preview
|
|
4324
|
-
of(null).pipe(
|
|
4325
|
-
mergeMap(() => generatePreviewBlobUrl$(file)),
|
|
4326
|
-
mergeMap((url) => of(
|
|
4318
|
+
rxjs.of(null).pipe(
|
|
4319
|
+
operators$1.mergeMap(() => generatePreviewBlobUrl$(file)),
|
|
4320
|
+
operators$1.mergeMap((url) => rxjs.of(
|
|
4327
4321
|
uploadsActions.previewReady({
|
|
4328
4322
|
blobUrl: url,
|
|
4329
4323
|
hash: uploadItem.hash
|
|
@@ -4331,27 +4325,27 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
|
|
|
4331
4325
|
))
|
|
4332
4326
|
),
|
|
4333
4327
|
// Upload asset and receive progress / complete events
|
|
4334
|
-
of(null).pipe(
|
|
4328
|
+
rxjs.of(null).pipe(
|
|
4335
4329
|
// delay(500000), // debug uploads
|
|
4336
|
-
mergeMap(() => uploadAsset$(client, uploadItem.assetType, file, uploadItem.hash)),
|
|
4337
|
-
takeUntil(
|
|
4330
|
+
operators$1.mergeMap(() => uploadAsset$(client, uploadItem.assetType, file, uploadItem.hash)),
|
|
4331
|
+
operators$1.takeUntil(
|
|
4338
4332
|
action$.pipe(
|
|
4339
|
-
filter(uploadsActions.uploadCancel.match),
|
|
4340
|
-
filter((v) => v.payload.hash === uploadItem.hash)
|
|
4333
|
+
operators$1.filter(uploadsActions.uploadCancel.match),
|
|
4334
|
+
operators$1.filter((v) => v.payload.hash === uploadItem.hash)
|
|
4341
4335
|
)
|
|
4342
4336
|
),
|
|
4343
|
-
mergeMap((event) => event?.type === "complete" ? of(
|
|
4337
|
+
operators$1.mergeMap((event) => event?.type === "complete" ? rxjs.of(
|
|
4344
4338
|
UPLOADS_ACTIONS.uploadComplete({
|
|
4345
4339
|
asset: event.asset
|
|
4346
4340
|
})
|
|
4347
|
-
) : event?.type === "progress" && event?.stage === "upload" ? of(
|
|
4341
|
+
) : event?.type === "progress" && event?.stage === "upload" ? rxjs.of(
|
|
4348
4342
|
uploadsActions.uploadProgress({
|
|
4349
4343
|
event,
|
|
4350
4344
|
uploadHash: uploadItem.hash
|
|
4351
4345
|
})
|
|
4352
|
-
) : empty()),
|
|
4353
|
-
catchError(
|
|
4354
|
-
(error) => of(
|
|
4346
|
+
) : rxjs.empty()),
|
|
4347
|
+
operators$1.catchError(
|
|
4348
|
+
(error) => rxjs.of(
|
|
4355
4349
|
uploadsActions.uploadError({
|
|
4356
4350
|
error: {
|
|
4357
4351
|
message: error?.message || "Internal error",
|
|
@@ -4365,18 +4359,18 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
|
|
|
4365
4359
|
);
|
|
4366
4360
|
})
|
|
4367
4361
|
), uploadsAssetUploadEpic = (action$, state$) => action$.pipe(
|
|
4368
|
-
filter(uploadsActions.uploadRequest.match),
|
|
4369
|
-
withLatestFrom(state$),
|
|
4370
|
-
mergeMap(([action, state]) => {
|
|
4362
|
+
operators$1.filter(uploadsActions.uploadRequest.match),
|
|
4363
|
+
operators$1.withLatestFrom(state$),
|
|
4364
|
+
operators$1.mergeMap(([action, state]) => {
|
|
4371
4365
|
const { file, forceAsAssetType } = action.payload;
|
|
4372
|
-
return of(action).pipe(
|
|
4366
|
+
return rxjs.of(action).pipe(
|
|
4373
4367
|
// Generate SHA1 hash from local file
|
|
4374
4368
|
// This will throw in insecure contexts (non-localhost / https)
|
|
4375
|
-
mergeMap(() => hashFile$(file)),
|
|
4369
|
+
operators$1.mergeMap(() => hashFile$(file)),
|
|
4376
4370
|
// Ignore if the file exists and is currently being uploaded
|
|
4377
|
-
filter((hash) => !state.uploads.byIds[hash]),
|
|
4371
|
+
operators$1.filter((hash) => !state.uploads.byIds[hash]),
|
|
4378
4372
|
// Dispatch start action and begin upload process
|
|
4379
|
-
mergeMap((hash) => {
|
|
4373
|
+
operators$1.mergeMap((hash) => {
|
|
4380
4374
|
const uploadItem = {
|
|
4381
4375
|
_type: "upload",
|
|
4382
4376
|
assetType: forceAsAssetType || (file.type.indexOf("image") >= 0 ? "image" : "file"),
|
|
@@ -4385,35 +4379,35 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
|
|
|
4385
4379
|
size: file.size,
|
|
4386
4380
|
status: "queued"
|
|
4387
4381
|
};
|
|
4388
|
-
return of(uploadsActions.uploadStart({ file, uploadItem }));
|
|
4382
|
+
return rxjs.of(uploadsActions.uploadStart({ file, uploadItem }));
|
|
4389
4383
|
})
|
|
4390
4384
|
);
|
|
4391
4385
|
})
|
|
4392
4386
|
), uploadsCompleteQueueEpic = (action$) => action$.pipe(
|
|
4393
|
-
filter(UPLOADS_ACTIONS.uploadComplete.match),
|
|
4394
|
-
mergeMap((action) => of(
|
|
4387
|
+
operators$1.filter(UPLOADS_ACTIONS.uploadComplete.match),
|
|
4388
|
+
operators$1.mergeMap((action) => rxjs.of(
|
|
4395
4389
|
uploadsActions.checkRequest({
|
|
4396
4390
|
assets: [action.payload.asset]
|
|
4397
4391
|
})
|
|
4398
4392
|
))
|
|
4399
4393
|
), uploadsCheckRequestEpic = (action$, state$, { client }) => action$.pipe(
|
|
4400
|
-
filter(uploadsActions.checkRequest.match),
|
|
4401
|
-
withLatestFrom(state$),
|
|
4402
|
-
mergeMap(([action, state]) => {
|
|
4394
|
+
operators$1.filter(uploadsActions.checkRequest.match),
|
|
4395
|
+
operators$1.withLatestFrom(state$),
|
|
4396
|
+
operators$1.mergeMap(([action, state]) => {
|
|
4403
4397
|
const { assets } = action.payload, documentIds = assets.map((asset) => asset._id), constructedFilter = constructFilter({
|
|
4404
4398
|
assetTypes: state.assets.assetTypes,
|
|
4405
4399
|
searchFacets: state.search.facets,
|
|
4406
4400
|
searchQuery: state.search.query
|
|
4407
|
-
}), query =
|
|
4401
|
+
}), query = groq__default.default`
|
|
4408
4402
|
*[${constructedFilter} && _id in $documentIds].sha1hash
|
|
4409
4403
|
`;
|
|
4410
|
-
return of(action).pipe(
|
|
4411
|
-
delay(1e3),
|
|
4404
|
+
return rxjs.of(action).pipe(
|
|
4405
|
+
operators$1.delay(1e3),
|
|
4412
4406
|
// give Sanity some time to register the recently uploaded asset
|
|
4413
|
-
mergeMap(() => client.observable.fetch(query, { documentIds })),
|
|
4414
|
-
mergeMap((resultHashes) => {
|
|
4407
|
+
operators$1.mergeMap(() => client.observable.fetch(query, { documentIds })),
|
|
4408
|
+
operators$1.mergeMap((resultHashes) => {
|
|
4415
4409
|
const checkedResults = assets.reduce((acc, asset) => (acc[asset.sha1hash] = resultHashes.includes(asset.sha1hash) ? asset._id : null, acc), {});
|
|
4416
|
-
return of(
|
|
4410
|
+
return rxjs.of(
|
|
4417
4411
|
uploadsActions.checkComplete({ results: checkedResults }),
|
|
4418
4412
|
//
|
|
4419
4413
|
assetsActions.insertUploads({ results: checkedResults })
|
|
@@ -4421,37 +4415,37 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
|
|
|
4421
4415
|
})
|
|
4422
4416
|
);
|
|
4423
4417
|
})
|
|
4424
|
-
), selectUploadsByIds = (state) => state.uploads.byIds, selectUploadsAllIds = (state) => state.uploads.allIds, selectUploadById = createSelector(
|
|
4418
|
+
), selectUploadsByIds = (state) => state.uploads.byIds, selectUploadsAllIds = (state) => state.uploads.allIds, selectUploadById = toolkit.createSelector(
|
|
4425
4419
|
[
|
|
4426
4420
|
(state) => state.uploads.byIds,
|
|
4427
4421
|
(_state, uploadId) => uploadId
|
|
4428
4422
|
],
|
|
4429
4423
|
(byIds, uploadId) => byIds[uploadId]
|
|
4430
4424
|
);
|
|
4431
|
-
createSelector(
|
|
4425
|
+
toolkit.createSelector(
|
|
4432
4426
|
[selectUploadsByIds, selectUploadsAllIds],
|
|
4433
4427
|
(byIds, allIds) => allIds.map((id) => byIds[id])
|
|
4434
4428
|
);
|
|
4435
4429
|
const uploadsActions = { ...uploadsSlice.actions };
|
|
4436
4430
|
var uploadsReducer = uploadsSlice.reducer;
|
|
4437
|
-
const CardWrapper = styled(Flex)`
|
|
4431
|
+
const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
4438
4432
|
box-sizing: border-box;
|
|
4439
4433
|
height: 100%;
|
|
4440
4434
|
overflow: hidden;
|
|
4441
4435
|
position: relative;
|
|
4442
4436
|
width: 100%;
|
|
4443
4437
|
`, CardUpload = (props) => {
|
|
4444
|
-
const { id } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id));
|
|
4438
|
+
const { id } = props, scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id));
|
|
4445
4439
|
if (!item)
|
|
4446
4440
|
return null;
|
|
4447
|
-
const fileSize =
|
|
4441
|
+
const fileSize = filesize__default.default(item.size, { base: 10, round: 0 }), percentLoaded = Math.round(item.percent || 0), isComplete = item.status === "complete", isUploading = item.status === "uploading", isQueued = item.status === "queued";
|
|
4448
4442
|
let status;
|
|
4449
4443
|
isComplete && (status = "Verifying"), isUploading && (status = `${percentLoaded}%`), isQueued && (status = "Queued");
|
|
4450
4444
|
const handleCancelUpload = () => {
|
|
4451
4445
|
dispatch(uploadsActions.uploadCancel({ hash: item.hash }));
|
|
4452
4446
|
};
|
|
4453
|
-
return /* @__PURE__ */ jsx(CardWrapper, { padding: 1, children: /* @__PURE__ */ jsxs(
|
|
4454
|
-
Flex,
|
|
4447
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CardWrapper, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4448
|
+
ui.Flex,
|
|
4455
4449
|
{
|
|
4456
4450
|
direction: "column",
|
|
4457
4451
|
flex: 1,
|
|
@@ -4462,7 +4456,7 @@ const CardWrapper = styled(Flex)`
|
|
|
4462
4456
|
position: "relative"
|
|
4463
4457
|
},
|
|
4464
4458
|
children: [
|
|
4465
|
-
/* @__PURE__ */ jsx(
|
|
4459
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4466
4460
|
"div",
|
|
4467
4461
|
{
|
|
4468
4462
|
style: {
|
|
@@ -4478,8 +4472,8 @@ const CardWrapper = styled(Flex)`
|
|
|
4478
4472
|
}
|
|
4479
4473
|
}
|
|
4480
4474
|
),
|
|
4481
|
-
/* @__PURE__ */ jsxs(Box, { flex: 1, style: { position: "relative" }, children: [
|
|
4482
|
-
item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsx(
|
|
4475
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 1, style: { position: "relative" }, children: [
|
|
4476
|
+
item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4483
4477
|
Image$1,
|
|
4484
4478
|
{
|
|
4485
4479
|
draggable: !1,
|
|
@@ -4490,9 +4484,9 @@ const CardWrapper = styled(Flex)`
|
|
|
4490
4484
|
}
|
|
4491
4485
|
}
|
|
4492
4486
|
),
|
|
4493
|
-
item.assetType === "file" && /* @__PURE__ */ jsx("div", { style: { height: "100%", opacity: 0.1 }, children: /* @__PURE__ */ jsx(FileIcon, { width: "80px" }) }),
|
|
4494
|
-
!isComplete && percentLoaded !== 100 && /* @__PURE__ */ jsx(
|
|
4495
|
-
Flex,
|
|
4487
|
+
item.assetType === "file" && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100%", opacity: 0.1 }, children: /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { width: "80px" }) }),
|
|
4488
|
+
!isComplete && percentLoaded !== 100 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4489
|
+
ui.Flex,
|
|
4496
4490
|
{
|
|
4497
4491
|
align: "center",
|
|
4498
4492
|
direction: "column",
|
|
@@ -4504,11 +4498,11 @@ const CardWrapper = styled(Flex)`
|
|
|
4504
4498
|
top: 0,
|
|
4505
4499
|
width: "100%"
|
|
4506
4500
|
},
|
|
4507
|
-
children: /* @__PURE__ */ jsx(
|
|
4508
|
-
Button,
|
|
4501
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4502
|
+
ui.Button,
|
|
4509
4503
|
{
|
|
4510
4504
|
fontSize: 4,
|
|
4511
|
-
icon: CloseIcon,
|
|
4505
|
+
icon: icons.CloseIcon,
|
|
4512
4506
|
mode: "bleed",
|
|
4513
4507
|
onClick: handleCancelUpload,
|
|
4514
4508
|
padding: 2,
|
|
@@ -4519,48 +4513,48 @@ const CardWrapper = styled(Flex)`
|
|
|
4519
4513
|
}
|
|
4520
4514
|
)
|
|
4521
4515
|
] }),
|
|
4522
|
-
/* @__PURE__ */ jsxs(
|
|
4523
|
-
Flex,
|
|
4516
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4517
|
+
ui.Flex,
|
|
4524
4518
|
{
|
|
4525
4519
|
align: "center",
|
|
4526
4520
|
justify: "space-between",
|
|
4527
4521
|
paddingX: 2,
|
|
4528
4522
|
style: { height: `${PANEL_HEIGHT}px` },
|
|
4529
4523
|
children: [
|
|
4530
|
-
/* @__PURE__ */ jsx(Box, { flex: 1, marginRight: 1, children: /* @__PURE__ */ jsxs(Text, { size: 0, textOverflow: "ellipsis", children: [
|
|
4524
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, marginRight: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 0, textOverflow: "ellipsis", children: [
|
|
4531
4525
|
item.name,
|
|
4532
4526
|
" (",
|
|
4533
4527
|
fileSize,
|
|
4534
4528
|
")"
|
|
4535
4529
|
] }) }),
|
|
4536
|
-
/* @__PURE__ */ jsx(Text, { size: 0, style: { flexShrink: 0 }, weight: "semibold", children: status })
|
|
4530
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 0, style: { flexShrink: 0 }, weight: "semibold", children: status })
|
|
4537
4531
|
]
|
|
4538
4532
|
}
|
|
4539
4533
|
)
|
|
4540
4534
|
]
|
|
4541
4535
|
}
|
|
4542
4536
|
) });
|
|
4543
|
-
}, CARD_HEIGHT = 220, CARD_WIDTH = 240, VirtualCell = memo(
|
|
4544
|
-
({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsx(CardAsset, { id: item.id, selected }) : item?.type === "upload" ? /* @__PURE__ */ jsx(CardUpload, { id: item.id }) : null
|
|
4545
|
-
), StyledItemContainer = styled.div`
|
|
4537
|
+
}, CARD_HEIGHT = 220, CARD_WIDTH = 240, VirtualCell = react.memo(
|
|
4538
|
+
({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsxRuntime.jsx(CardAsset, { id: item.id, selected }) : item?.type === "upload" ? /* @__PURE__ */ jsxRuntime.jsx(CardUpload, { id: item.id }) : null
|
|
4539
|
+
), StyledItemContainer = styledComponents.styled.div`
|
|
4546
4540
|
height: ${CARD_HEIGHT}px;
|
|
4547
4541
|
width: ${CARD_WIDTH}px;
|
|
4548
|
-
`, ItemContainer = forwardRef((props, ref) => {
|
|
4542
|
+
`, ItemContainer = react.forwardRef((props, ref) => {
|
|
4549
4543
|
const { context, ...rest } = props;
|
|
4550
|
-
return /* @__PURE__ */ jsx(StyledItemContainer, { ref, ...rest });
|
|
4551
|
-
}), StyledListContainer = styled.div`
|
|
4544
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledItemContainer, { ref, ...rest });
|
|
4545
|
+
}), StyledListContainer = styledComponents.styled.div`
|
|
4552
4546
|
display: grid;
|
|
4553
4547
|
grid-template-columns: repeat(auto-fill, ${CARD_WIDTH}px);
|
|
4554
4548
|
grid-template-rows: repeat(auto-fill, ${CARD_HEIGHT}px);
|
|
4555
4549
|
justify-content: center;
|
|
4556
4550
|
margin: 0 auto;
|
|
4557
|
-
`, ListContainer = forwardRef((props, ref) => {
|
|
4551
|
+
`, ListContainer = react.forwardRef((props, ref) => {
|
|
4558
4552
|
const { context, ...rest } = props;
|
|
4559
|
-
return /* @__PURE__ */ jsx(StyledListContainer, { ref, ...rest });
|
|
4553
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledListContainer, { ref, ...rest });
|
|
4560
4554
|
}), AssetGridVirtualized = (props) => {
|
|
4561
4555
|
const { items, onLoadMore } = props, selectedAssets = useTypedSelector((state) => state.selected.assets), selectedIds = selectedAssets && selectedAssets.map((asset) => asset._id) || [], totalCount = items?.length;
|
|
4562
|
-
return totalCount === 0 ? null : /* @__PURE__ */ jsx(
|
|
4563
|
-
VirtuosoGrid,
|
|
4556
|
+
return totalCount === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4557
|
+
reactVirtuoso.VirtuosoGrid,
|
|
4564
4558
|
{
|
|
4565
4559
|
className: "media__custom-scrollbar",
|
|
4566
4560
|
computeItemKey: (index) => items[index]?.id,
|
|
@@ -4571,7 +4565,7 @@ const CardWrapper = styled(Flex)`
|
|
|
4571
4565
|
endReached: onLoadMore,
|
|
4572
4566
|
itemContent: (index) => {
|
|
4573
4567
|
const item = items[index], selected = selectedIds.includes(item?.id);
|
|
4574
|
-
return /* @__PURE__ */ jsx(VirtualCell, { item, selected });
|
|
4568
|
+
return /* @__PURE__ */ jsxRuntime.jsx(VirtualCell, { item, selected });
|
|
4575
4569
|
},
|
|
4576
4570
|
overscan: 48,
|
|
4577
4571
|
style: { overflowX: "hidden", overflowY: "scroll" },
|
|
@@ -4579,9 +4573,9 @@ const CardWrapper = styled(Flex)`
|
|
|
4579
4573
|
}
|
|
4580
4574
|
);
|
|
4581
4575
|
}, TableHeaderItem = (props) => {
|
|
4582
|
-
const { field, title } = props, dispatch = useDispatch(), order = useTypedSelector((state) => state.assets.order), isActive = order.field === field;
|
|
4583
|
-
return /* @__PURE__ */ jsx(Label, { muted: !field, size: 0, children: /* @__PURE__ */ jsxs(
|
|
4584
|
-
Box,
|
|
4576
|
+
const { field, title } = props, dispatch = reactRedux.useDispatch(), order = useTypedSelector((state) => state.assets.order), isActive = order.field === field;
|
|
4577
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { muted: !field, size: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4578
|
+
ui.Box,
|
|
4585
4579
|
{
|
|
4586
4580
|
onClick: field ? () => {
|
|
4587
4581
|
if (!(!field || !title))
|
|
@@ -4597,7 +4591,7 @@ const CardWrapper = styled(Flex)`
|
|
|
4597
4591
|
whiteSpace: "nowrap"
|
|
4598
4592
|
},
|
|
4599
4593
|
children: [
|
|
4600
|
-
/* @__PURE__ */ jsx(
|
|
4594
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4601
4595
|
"span",
|
|
4602
4596
|
{
|
|
4603
4597
|
style: {
|
|
@@ -4606,14 +4600,14 @@ const CardWrapper = styled(Flex)`
|
|
|
4606
4600
|
children: title
|
|
4607
4601
|
}
|
|
4608
4602
|
),
|
|
4609
|
-
isActive && order?.direction === "asc" && /* @__PURE__ */ jsx(ChevronUpIcon, {}),
|
|
4610
|
-
isActive && order?.direction === "desc" && /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
4603
|
+
isActive && order?.direction === "asc" && /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronUpIcon, {}),
|
|
4604
|
+
isActive && order?.direction === "desc" && /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownIcon, {})
|
|
4611
4605
|
]
|
|
4612
4606
|
}
|
|
4613
4607
|
) });
|
|
4614
|
-
}, ContextActionContainer$1 = styled(Flex)(({
|
|
4608
|
+
}, ContextActionContainer$1 = styledComponents.styled(ui.Flex)(({
|
|
4615
4609
|
$scheme
|
|
4616
|
-
}) => css`
|
|
4610
|
+
}) => styledComponents.css`
|
|
4617
4611
|
cursor: pointer;
|
|
4618
4612
|
@media (hover: hover) and (pointer: fine) {
|
|
4619
4613
|
&:hover {
|
|
@@ -4621,11 +4615,11 @@ const CardWrapper = styled(Flex)`
|
|
|
4621
4615
|
}
|
|
4622
4616
|
}
|
|
4623
4617
|
`), TableHeader = () => {
|
|
4624
|
-
const scheme = useColorSchemeValue(), dispatch = useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, handleContextActionClick = (e) => {
|
|
4618
|
+
const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = ui.useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, handleContextActionClick = (e) => {
|
|
4625
4619
|
e.stopPropagation(), dispatch(allSelected ? assetsActions.pickClear() : assetsActions.pickAll());
|
|
4626
4620
|
};
|
|
4627
|
-
return /* @__PURE__ */ jsxs(
|
|
4628
|
-
Grid,
|
|
4621
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4622
|
+
ui.Grid,
|
|
4629
4623
|
{
|
|
4630
4624
|
style: {
|
|
4631
4625
|
alignItems: "center",
|
|
@@ -4644,7 +4638,7 @@ const CardWrapper = styled(Flex)`
|
|
|
4644
4638
|
// force stacking context
|
|
4645
4639
|
},
|
|
4646
4640
|
children: [
|
|
4647
|
-
onSelect ? /* @__PURE__ */ jsx(TableHeaderItem, {}) : /* @__PURE__ */ jsx(
|
|
4641
|
+
onSelect ? /* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, {}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4648
4642
|
ContextActionContainer$1,
|
|
4649
4643
|
{
|
|
4650
4644
|
align: "center",
|
|
@@ -4655,8 +4649,8 @@ const CardWrapper = styled(Flex)`
|
|
|
4655
4649
|
height: "100%",
|
|
4656
4650
|
position: "relative"
|
|
4657
4651
|
},
|
|
4658
|
-
children: /* @__PURE__ */ jsx(
|
|
4659
|
-
Checkbox,
|
|
4652
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4653
|
+
ui.Checkbox,
|
|
4660
4654
|
{
|
|
4661
4655
|
checked: !fetching && allSelected,
|
|
4662
4656
|
readOnly: !0,
|
|
@@ -4669,18 +4663,18 @@ const CardWrapper = styled(Flex)`
|
|
|
4669
4663
|
)
|
|
4670
4664
|
}
|
|
4671
4665
|
),
|
|
4672
|
-
/* @__PURE__ */ jsx(TableHeaderItem, {}),
|
|
4673
|
-
/* @__PURE__ */ jsx(TableHeaderItem, { field: "originalFilename", title: "Filename" }),
|
|
4674
|
-
/* @__PURE__ */ jsx(TableHeaderItem, { title: "Resolution" }),
|
|
4675
|
-
/* @__PURE__ */ jsx(TableHeaderItem, { field: "mimeType", title: "MIME type" }),
|
|
4676
|
-
/* @__PURE__ */ jsx(TableHeaderItem, { field: "size", title: "Size" }),
|
|
4677
|
-
/* @__PURE__ */ jsx(TableHeaderItem, { field: "_updatedAt", title: "Last updated" }),
|
|
4678
|
-
/* @__PURE__ */ jsx(TableHeaderItem, { title: "References" }),
|
|
4679
|
-
/* @__PURE__ */ jsx(TableHeaderItem, {})
|
|
4666
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, {}),
|
|
4667
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { field: "originalFilename", title: "Filename" }),
|
|
4668
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { title: "Resolution" }),
|
|
4669
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { field: "mimeType", title: "MIME type" }),
|
|
4670
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { field: "size", title: "Size" }),
|
|
4671
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { field: "_updatedAt", title: "Last updated" }),
|
|
4672
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { title: "References" }),
|
|
4673
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, {})
|
|
4680
4674
|
]
|
|
4681
4675
|
}
|
|
4682
4676
|
);
|
|
4683
|
-
}, REFERENCE_COUNT_VISIBILITY_DELAY = 750, ContainerGrid = styled(Grid)(({ $scheme, $selected, $updating }) => css`
|
|
4677
|
+
}, REFERENCE_COUNT_VISIBILITY_DELAY = 750, ContainerGrid = styledComponents.styled(ui.Grid)(({ $scheme, $selected, $updating }) => styledComponents.css`
|
|
4684
4678
|
align-items: center;
|
|
4685
4679
|
cursor: ${$selected ? "default" : "pointer"};
|
|
4686
4680
|
height: 100%;
|
|
@@ -4688,42 +4682,42 @@ const CardWrapper = styled(Flex)`
|
|
|
4688
4682
|
user-select: none;
|
|
4689
4683
|
white-space: nowrap;
|
|
4690
4684
|
|
|
4691
|
-
${!$updating && css`
|
|
4685
|
+
${!$updating && styledComponents.css`
|
|
4692
4686
|
@media (hover: hover) and (pointer: fine) {
|
|
4693
4687
|
&:hover {
|
|
4694
4688
|
background: ${getSchemeColor($scheme, "bg")};
|
|
4695
4689
|
}
|
|
4696
4690
|
}
|
|
4697
4691
|
`}
|
|
4698
|
-
`), ContextActionContainer = styled(Flex)(({
|
|
4692
|
+
`), ContextActionContainer = styledComponents.styled(ui.Flex)(({
|
|
4699
4693
|
$scheme
|
|
4700
|
-
}) => css`
|
|
4694
|
+
}) => styledComponents.css`
|
|
4701
4695
|
cursor: pointer;
|
|
4702
4696
|
@media (hover: hover) and (pointer: fine) {
|
|
4703
4697
|
&:hover {
|
|
4704
4698
|
background: ${getSchemeColor($scheme, "bg2")};
|
|
4705
4699
|
}
|
|
4706
4700
|
}
|
|
4707
|
-
`), StyledWarningIcon = styled(WarningFilledIcon)(({ theme }) => ({
|
|
4701
|
+
`), StyledWarningIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
|
|
4708
4702
|
color: theme.sanity.color.spot.red
|
|
4709
4703
|
})), TableRowAsset$1 = (props) => {
|
|
4710
|
-
const { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = useState(!1), refCountVisibleTimeout = useRef(null), dispatch = useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), mediaIndex = useMediaIndex(), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions(), handleContextActionClick = useCallback(
|
|
4704
|
+
const { id, selected } = props, scheme = sanity.useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = react.useState(!1), refCountVisibleTimeout = react.useRef(null), dispatch = reactRedux.useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), mediaIndex = ui.useMediaIndex(), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions(), handleContextActionClick = react.useCallback(
|
|
4711
4705
|
(e) => {
|
|
4712
4706
|
e.stopPropagation(), asset && (onSelect ? dispatch(dialogActions.showAssetEdit({ assetId: asset._id })) : shiftPressed.current && !picked ? dispatch(assetsActions.pickRange({ startId: lastPicked || asset._id, endId: asset._id })) : dispatch(assetsActions.pick({ assetId: asset._id, picked: !picked })));
|
|
4713
4707
|
},
|
|
4714
4708
|
[asset, dispatch, lastPicked, onSelect, picked, shiftPressed]
|
|
4715
|
-
), handleClick = useCallback(
|
|
4709
|
+
), handleClick = react.useCallback(
|
|
4716
4710
|
(e) => {
|
|
4717
4711
|
e.stopPropagation(), asset && (onSelect ? onSelect([{ kind: "assetDocumentId", value: asset._id }]) : shiftPressed.current ? dispatch(picked ? assetsActions.pick({ assetId: asset._id, picked: !picked }) : assetsActions.pickRange({ startId: lastPicked || asset._id, endId: asset._id })) : dispatch(dialogActions.showAssetEdit({ assetId: asset._id })));
|
|
4718
4712
|
},
|
|
4719
4713
|
[asset, dispatch, lastPicked, onSelect, picked, shiftPressed]
|
|
4720
4714
|
), opacityCell = updating ? 0.5 : 1, opacityPreview = selected || updating ? 0.1 : 1;
|
|
4721
|
-
return useEffect(() => (refCountVisibleTimeout.current = setTimeout(
|
|
4715
|
+
return react.useEffect(() => (refCountVisibleTimeout.current = setTimeout(
|
|
4722
4716
|
() => setReferenceCountVisible(!0),
|
|
4723
4717
|
REFERENCE_COUNT_VISIBILITY_DELAY
|
|
4724
4718
|
), () => {
|
|
4725
4719
|
refCountVisibleTimeout.current && clearTimeout(refCountVisibleTimeout.current);
|
|
4726
|
-
}), []), asset ? /* @__PURE__ */ jsxs(
|
|
4720
|
+
}), []), asset ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4727
4721
|
ContainerGrid,
|
|
4728
4722
|
{
|
|
4729
4723
|
onClick: selected ? void 0 : handleClick,
|
|
@@ -4737,7 +4731,7 @@ const CardWrapper = styled(Flex)`
|
|
|
4737
4731
|
},
|
|
4738
4732
|
$updating: item.updating,
|
|
4739
4733
|
children: [
|
|
4740
|
-
/* @__PURE__ */ jsx(
|
|
4734
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4741
4735
|
ContextActionContainer,
|
|
4742
4736
|
{
|
|
4743
4737
|
onClick: handleContextActionClick,
|
|
@@ -4752,16 +4746,16 @@ const CardWrapper = styled(Flex)`
|
|
|
4752
4746
|
opacity: opacityCell,
|
|
4753
4747
|
position: "relative"
|
|
4754
4748
|
},
|
|
4755
|
-
children: onSelect ? /* @__PURE__ */ jsx(
|
|
4756
|
-
EditIcon,
|
|
4749
|
+
children: onSelect ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4750
|
+
icons.EditIcon,
|
|
4757
4751
|
{
|
|
4758
4752
|
style: {
|
|
4759
4753
|
flexShrink: 0,
|
|
4760
4754
|
opacity: 0.5
|
|
4761
4755
|
}
|
|
4762
4756
|
}
|
|
4763
|
-
) : /* @__PURE__ */ jsx(
|
|
4764
|
-
Checkbox,
|
|
4757
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4758
|
+
ui.Checkbox,
|
|
4765
4759
|
{
|
|
4766
4760
|
checked: picked,
|
|
4767
4761
|
readOnly: !0,
|
|
@@ -4774,8 +4768,8 @@ const CardWrapper = styled(Flex)`
|
|
|
4774
4768
|
)
|
|
4775
4769
|
}
|
|
4776
4770
|
),
|
|
4777
|
-
/* @__PURE__ */ jsx(
|
|
4778
|
-
Box,
|
|
4771
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4772
|
+
ui.Box,
|
|
4779
4773
|
{
|
|
4780
4774
|
style: {
|
|
4781
4775
|
gridColumn: 2,
|
|
@@ -4784,10 +4778,10 @@ const CardWrapper = styled(Flex)`
|
|
|
4784
4778
|
height: "90px",
|
|
4785
4779
|
width: "100px"
|
|
4786
4780
|
},
|
|
4787
|
-
children: /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "center", style: { height: "100%", position: "relative" }, children: [
|
|
4788
|
-
/* @__PURE__ */ jsxs(Box, { style: { height: "100%", opacity: opacityPreview, position: "relative" }, children: [
|
|
4789
|
-
isFileAsset(asset) && /* @__PURE__ */ jsx(FileIcon, { extension: asset.extension, width: "40px" }),
|
|
4790
|
-
isImageAsset(asset) && /* @__PURE__ */ jsx(
|
|
4781
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "center", style: { height: "100%", position: "relative" }, children: [
|
|
4782
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { height: "100%", opacity: opacityPreview, position: "relative" }, children: [
|
|
4783
|
+
isFileAsset(asset) && /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { extension: asset.extension, width: "40px" }),
|
|
4784
|
+
isImageAsset(asset) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4791
4785
|
Image$1,
|
|
4792
4786
|
{
|
|
4793
4787
|
draggable: !1,
|
|
@@ -4797,8 +4791,8 @@ const CardWrapper = styled(Flex)`
|
|
|
4797
4791
|
}
|
|
4798
4792
|
)
|
|
4799
4793
|
] }),
|
|
4800
|
-
updating && /* @__PURE__ */ jsx(
|
|
4801
|
-
Flex,
|
|
4794
|
+
updating && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4795
|
+
ui.Flex,
|
|
4802
4796
|
{
|
|
4803
4797
|
align: "center",
|
|
4804
4798
|
justify: "center",
|
|
@@ -4809,11 +4803,11 @@ const CardWrapper = styled(Flex)`
|
|
|
4809
4803
|
top: 0,
|
|
4810
4804
|
width: "100%"
|
|
4811
4805
|
},
|
|
4812
|
-
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
4806
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {})
|
|
4813
4807
|
}
|
|
4814
4808
|
),
|
|
4815
|
-
selected && !updating && /* @__PURE__ */ jsx(
|
|
4816
|
-
Flex,
|
|
4809
|
+
selected && !updating && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4810
|
+
ui.Flex,
|
|
4817
4811
|
{
|
|
4818
4812
|
align: "center",
|
|
4819
4813
|
justify: "center",
|
|
@@ -4824,14 +4818,14 @@ const CardWrapper = styled(Flex)`
|
|
|
4824
4818
|
top: 0,
|
|
4825
4819
|
width: "100%"
|
|
4826
4820
|
},
|
|
4827
|
-
children: /* @__PURE__ */ jsx(Text, { size: 2, children: /* @__PURE__ */ jsx(CheckmarkCircleIcon, {}) })
|
|
4821
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 2, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckmarkCircleIcon, {}) })
|
|
4828
4822
|
}
|
|
4829
4823
|
)
|
|
4830
4824
|
] })
|
|
4831
4825
|
}
|
|
4832
4826
|
),
|
|
4833
|
-
/* @__PURE__ */ jsx(
|
|
4834
|
-
Box,
|
|
4827
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4828
|
+
ui.Box,
|
|
4835
4829
|
{
|
|
4836
4830
|
marginLeft: mediaIndex < 3 ? 3 : 0,
|
|
4837
4831
|
style: {
|
|
@@ -4839,11 +4833,11 @@ const CardWrapper = styled(Flex)`
|
|
|
4839
4833
|
gridRow: mediaIndex < 3 ? 2 : "auto",
|
|
4840
4834
|
opacity: opacityCell
|
|
4841
4835
|
},
|
|
4842
|
-
children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: asset.originalFilename })
|
|
4836
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: asset.originalFilename })
|
|
4843
4837
|
}
|
|
4844
4838
|
),
|
|
4845
|
-
/* @__PURE__ */ jsx(
|
|
4846
|
-
Box,
|
|
4839
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4840
|
+
ui.Box,
|
|
4847
4841
|
{
|
|
4848
4842
|
marginLeft: mediaIndex < 3 ? 3 : 0,
|
|
4849
4843
|
style: {
|
|
@@ -4851,11 +4845,11 @@ const CardWrapper = styled(Flex)`
|
|
|
4851
4845
|
gridRow: mediaIndex < 3 ? 3 : "auto",
|
|
4852
4846
|
opacity: opacityCell
|
|
4853
4847
|
},
|
|
4854
|
-
children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: isImageAsset(asset) && getAssetResolution(asset) })
|
|
4848
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: isImageAsset(asset) && getAssetResolution(asset) })
|
|
4855
4849
|
}
|
|
4856
4850
|
),
|
|
4857
|
-
/* @__PURE__ */ jsx(
|
|
4858
|
-
Box,
|
|
4851
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4852
|
+
ui.Box,
|
|
4859
4853
|
{
|
|
4860
4854
|
style: {
|
|
4861
4855
|
display: mediaIndex < 3 ? "none" : "block",
|
|
@@ -4863,11 +4857,11 @@ const CardWrapper = styled(Flex)`
|
|
|
4863
4857
|
gridRow: "auto",
|
|
4864
4858
|
opacity: opacityCell
|
|
4865
4859
|
},
|
|
4866
|
-
children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: asset.mimeType })
|
|
4860
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: asset.mimeType })
|
|
4867
4861
|
}
|
|
4868
4862
|
),
|
|
4869
|
-
/* @__PURE__ */ jsx(
|
|
4870
|
-
Box,
|
|
4863
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4864
|
+
ui.Box,
|
|
4871
4865
|
{
|
|
4872
4866
|
style: {
|
|
4873
4867
|
display: mediaIndex < 3 ? "none" : "block",
|
|
@@ -4875,11 +4869,11 @@ const CardWrapper = styled(Flex)`
|
|
|
4875
4869
|
gridRow: "auto",
|
|
4876
4870
|
opacity: opacityCell
|
|
4877
4871
|
},
|
|
4878
|
-
children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children:
|
|
4872
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: filesize__default.default(asset.size, { base: 10, round: 0 }) })
|
|
4879
4873
|
}
|
|
4880
4874
|
),
|
|
4881
|
-
/* @__PURE__ */ jsx(
|
|
4882
|
-
Box,
|
|
4875
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4876
|
+
ui.Box,
|
|
4883
4877
|
{
|
|
4884
4878
|
marginLeft: mediaIndex < 3 ? 3 : 0,
|
|
4885
4879
|
style: {
|
|
@@ -4887,11 +4881,11 @@ const CardWrapper = styled(Flex)`
|
|
|
4887
4881
|
gridRow: mediaIndex < 3 ? 4 : "auto",
|
|
4888
4882
|
opacity: opacityCell
|
|
4889
4883
|
},
|
|
4890
|
-
children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: formatRelative(new Date(asset._updatedAt), /* @__PURE__ */ new Date()) })
|
|
4884
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: dateFns.formatRelative(new Date(asset._updatedAt), /* @__PURE__ */ new Date()) })
|
|
4891
4885
|
}
|
|
4892
4886
|
),
|
|
4893
|
-
/* @__PURE__ */ jsx(
|
|
4894
|
-
Box,
|
|
4887
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4888
|
+
ui.Box,
|
|
4895
4889
|
{
|
|
4896
4890
|
style: {
|
|
4897
4891
|
display: mediaIndex < 3 ? "none" : "block",
|
|
@@ -4899,14 +4893,14 @@ const CardWrapper = styled(Flex)`
|
|
|
4899
4893
|
gridRow: "auto",
|
|
4900
4894
|
opacity: opacityCell
|
|
4901
4895
|
},
|
|
4902
|
-
children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: referenceCountVisible ? /* @__PURE__ */ jsx(WithReferringDocuments, { id, children: ({ isLoading, referringDocuments }) => {
|
|
4896
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: referenceCountVisible ? /* @__PURE__ */ jsxRuntime.jsx(sanity.WithReferringDocuments, { id, children: ({ isLoading, referringDocuments }) => {
|
|
4903
4897
|
const uniqueDocuments = getUniqueDocuments(referringDocuments);
|
|
4904
|
-
return isLoading ? /* @__PURE__ */ jsx(Fragment, { children: "-" }) : /* @__PURE__ */ jsx(Fragment, { children: Array.isArray(uniqueDocuments) ? uniqueDocuments.length : 0 });
|
|
4905
|
-
} }) : /* @__PURE__ */ jsx(Fragment, { children: "-" }) })
|
|
4898
|
+
return isLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "-" }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.isArray(uniqueDocuments) ? uniqueDocuments.length : 0 });
|
|
4899
|
+
} }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "-" }) })
|
|
4906
4900
|
}
|
|
4907
4901
|
),
|
|
4908
|
-
/* @__PURE__ */ jsx(
|
|
4909
|
-
Flex,
|
|
4902
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4903
|
+
ui.Flex,
|
|
4910
4904
|
{
|
|
4911
4905
|
align: "center",
|
|
4912
4906
|
justify: "center",
|
|
@@ -4916,14 +4910,14 @@ const CardWrapper = styled(Flex)`
|
|
|
4916
4910
|
gridRowEnd: mediaIndex < 3 ? "span 5" : "auto",
|
|
4917
4911
|
opacity: opacityCell
|
|
4918
4912
|
},
|
|
4919
|
-
children: error && /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(
|
|
4920
|
-
Tooltip,
|
|
4913
|
+
children: error && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4914
|
+
ui.Tooltip,
|
|
4921
4915
|
{
|
|
4922
4916
|
animate: !0,
|
|
4923
|
-
content: /* @__PURE__ */ jsx(Container
|
|
4917
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: error }) }),
|
|
4924
4918
|
placement: "left",
|
|
4925
4919
|
portal: !0,
|
|
4926
|
-
children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(StyledWarningIcon, { color: "critical" }) })
|
|
4920
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(StyledWarningIcon, { color: "critical" }) })
|
|
4927
4921
|
}
|
|
4928
4922
|
) })
|
|
4929
4923
|
}
|
|
@@ -4932,19 +4926,19 @@ const CardWrapper = styled(Flex)`
|
|
|
4932
4926
|
}
|
|
4933
4927
|
) : null;
|
|
4934
4928
|
};
|
|
4935
|
-
var TableRowAsset = memo(TableRowAsset$1);
|
|
4929
|
+
var TableRowAsset = react.memo(TableRowAsset$1);
|
|
4936
4930
|
const TableRowUpload = (props) => {
|
|
4937
|
-
const { id } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id)), mediaIndex = useMediaIndex();
|
|
4931
|
+
const { id } = props, scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id)), mediaIndex = ui.useMediaIndex();
|
|
4938
4932
|
if (!item)
|
|
4939
4933
|
return null;
|
|
4940
|
-
const fileSize =
|
|
4934
|
+
const fileSize = filesize__default.default(item.size, { base: 10, round: 0 }), percentLoaded = Math.round(item.percent || 0), isComplete = item.status === "complete", isUploading = item.status === "uploading", isQueued = item.status === "queued";
|
|
4941
4935
|
let status;
|
|
4942
4936
|
isComplete && (status = "Verifying"), isUploading && (status = `${percentLoaded}%`), isQueued && (status = "Queued");
|
|
4943
4937
|
const handleCancelUpload = () => {
|
|
4944
4938
|
dispatch(uploadsActions.uploadCancel({ hash: item.hash }));
|
|
4945
4939
|
};
|
|
4946
|
-
return /* @__PURE__ */ jsxs(
|
|
4947
|
-
Grid,
|
|
4940
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4941
|
+
ui.Grid,
|
|
4948
4942
|
{
|
|
4949
4943
|
style: {
|
|
4950
4944
|
alignItems: "center",
|
|
@@ -4957,7 +4951,7 @@ const TableRowUpload = (props) => {
|
|
|
4957
4951
|
position: "relative"
|
|
4958
4952
|
},
|
|
4959
4953
|
children: [
|
|
4960
|
-
/* @__PURE__ */ jsx(
|
|
4954
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4961
4955
|
"div",
|
|
4962
4956
|
{
|
|
4963
4957
|
style: {
|
|
@@ -4973,8 +4967,8 @@ const TableRowUpload = (props) => {
|
|
|
4973
4967
|
}
|
|
4974
4968
|
}
|
|
4975
4969
|
),
|
|
4976
|
-
/* @__PURE__ */ jsx(
|
|
4977
|
-
Box,
|
|
4970
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4971
|
+
ui.Box,
|
|
4978
4972
|
{
|
|
4979
4973
|
style: {
|
|
4980
4974
|
gridColumn: 2,
|
|
@@ -4983,8 +4977,8 @@ const TableRowUpload = (props) => {
|
|
|
4983
4977
|
height: "90px",
|
|
4984
4978
|
width: "100px"
|
|
4985
4979
|
},
|
|
4986
|
-
children: /* @__PURE__ */ jsxs(Box, { style: { height: "100%", position: "relative" }, children: [
|
|
4987
|
-
item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsx(
|
|
4980
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { height: "100%", position: "relative" }, children: [
|
|
4981
|
+
item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4988
4982
|
Image$1,
|
|
4989
4983
|
{
|
|
4990
4984
|
draggable: !1,
|
|
@@ -4993,9 +4987,9 @@ const TableRowUpload = (props) => {
|
|
|
4993
4987
|
style: { opacity: 0.25 }
|
|
4994
4988
|
}
|
|
4995
4989
|
),
|
|
4996
|
-
item.assetType === "file" && /* @__PURE__ */ jsx("div", { style: { height: "100%", opacity: 0.1 }, children: /* @__PURE__ */ jsx(FileIcon, { width: "40px" }) }),
|
|
4997
|
-
!isComplete && percentLoaded !== 100 && /* @__PURE__ */ jsx(
|
|
4998
|
-
Flex,
|
|
4990
|
+
item.assetType === "file" && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100%", opacity: 0.1 }, children: /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { width: "40px" }) }),
|
|
4991
|
+
!isComplete && percentLoaded !== 100 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4992
|
+
ui.Flex,
|
|
4999
4993
|
{
|
|
5000
4994
|
align: "center",
|
|
5001
4995
|
justify: "center",
|
|
@@ -5006,11 +5000,11 @@ const TableRowUpload = (props) => {
|
|
|
5006
5000
|
top: 0,
|
|
5007
5001
|
width: "100%"
|
|
5008
5002
|
},
|
|
5009
|
-
children: /* @__PURE__ */ jsx(
|
|
5010
|
-
Button,
|
|
5003
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5004
|
+
ui.Button,
|
|
5011
5005
|
{
|
|
5012
5006
|
fontSize: 3,
|
|
5013
|
-
icon: CloseIcon,
|
|
5007
|
+
icon: icons.CloseIcon,
|
|
5014
5008
|
mode: "bleed",
|
|
5015
5009
|
onClick: handleCancelUpload,
|
|
5016
5010
|
padding: 2,
|
|
@@ -5023,60 +5017,60 @@ const TableRowUpload = (props) => {
|
|
|
5023
5017
|
] })
|
|
5024
5018
|
}
|
|
5025
5019
|
),
|
|
5026
|
-
/* @__PURE__ */ jsx(
|
|
5027
|
-
Box,
|
|
5020
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5021
|
+
ui.Box,
|
|
5028
5022
|
{
|
|
5029
5023
|
style: {
|
|
5030
5024
|
gridColumn: mediaIndex < 3 ? 3 : "3/8",
|
|
5031
5025
|
gridRow: mediaIndex < 3 ? "2/4" : "auto",
|
|
5032
5026
|
marginLeft: mediaIndex < 3 ? 3 : 0
|
|
5033
5027
|
},
|
|
5034
|
-
children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
5035
|
-
/* @__PURE__ */ jsxs(Text, { muted: !0, size: 1, textOverflow: "ellipsis", children: [
|
|
5028
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
5029
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { muted: !0, size: 1, textOverflow: "ellipsis", children: [
|
|
5036
5030
|
item.name,
|
|
5037
5031
|
" (",
|
|
5038
5032
|
fileSize,
|
|
5039
5033
|
")"
|
|
5040
5034
|
] }),
|
|
5041
|
-
/* @__PURE__ */ jsx(Text, { size: 1, textOverflow: "ellipsis", weight: "semibold", children: status })
|
|
5035
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, textOverflow: "ellipsis", weight: "semibold", children: status })
|
|
5042
5036
|
] })
|
|
5043
5037
|
}
|
|
5044
5038
|
)
|
|
5045
5039
|
]
|
|
5046
5040
|
}
|
|
5047
5041
|
);
|
|
5048
|
-
}, VirtualRow = memo(
|
|
5049
|
-
({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsx(Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsx(TableRowAsset, { id: item.id, selected }) }) : item?.type === "upload" ? /* @__PURE__ */ jsx(Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsx(TableRowUpload, { id: item.id }) }) : null
|
|
5042
|
+
}, VirtualRow = react.memo(
|
|
5043
|
+
({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsxRuntime.jsx(TableRowAsset, { id: item.id, selected }) }) : item?.type === "upload" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsxRuntime.jsx(TableRowUpload, { id: item.id }) }) : null
|
|
5050
5044
|
), AssetTableVirtualized = (props) => {
|
|
5051
5045
|
const { items, onLoadMore } = props, selectedAssets = useTypedSelector((state) => state.selected.assets), selectedIds = selectedAssets && selectedAssets.map((asset) => asset._id) || [], totalCount = items?.length;
|
|
5052
|
-
return totalCount === 0 ? null : /* @__PURE__ */ jsx(
|
|
5053
|
-
GroupedVirtuoso,
|
|
5046
|
+
return totalCount === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5047
|
+
reactVirtuoso.GroupedVirtuoso,
|
|
5054
5048
|
{
|
|
5055
5049
|
className: "media__custom-scrollbar",
|
|
5056
5050
|
computeItemKey: (index) => items[index]?.id || index,
|
|
5057
5051
|
endReached: onLoadMore,
|
|
5058
5052
|
groupCounts: Array(1).fill(totalCount),
|
|
5059
|
-
groupContent: () => /* @__PURE__ */ jsx(TableHeader, {}),
|
|
5053
|
+
groupContent: () => /* @__PURE__ */ jsxRuntime.jsx(TableHeader, {}),
|
|
5060
5054
|
itemContent: (index) => {
|
|
5061
5055
|
const item = items[index], selected = selectedIds.includes(item?.id);
|
|
5062
|
-
return /* @__PURE__ */ jsx(VirtualRow, { item, selected });
|
|
5056
|
+
return /* @__PURE__ */ jsxRuntime.jsx(VirtualRow, { item, selected });
|
|
5063
5057
|
},
|
|
5064
5058
|
style: { overflowX: "hidden" }
|
|
5065
5059
|
}
|
|
5066
5060
|
);
|
|
5067
5061
|
}, Items = () => {
|
|
5068
|
-
const dispatch = useDispatch(), fetchCount = useTypedSelector((state) => state.assets.fetchCount), fetching = useTypedSelector((state) => state.assets.fetching), tagsPanelVisible = useTypedSelector((state) => state.tags.panelVisible), view = useTypedSelector((state) => state.assets.view), combinedItems = useTypedSelector(selectCombinedItems), breakpointIndex = useBreakpointIndex(), hasFetchedOnce = fetchCount >= 0, hasItems = combinedItems.length > 0, handleLoadMoreItems = () => {
|
|
5062
|
+
const dispatch = reactRedux.useDispatch(), fetchCount = useTypedSelector((state) => state.assets.fetchCount), fetching = useTypedSelector((state) => state.assets.fetching), tagsPanelVisible = useTypedSelector((state) => state.tags.panelVisible), view = useTypedSelector((state) => state.assets.view), combinedItems = useTypedSelector(selectCombinedItems), breakpointIndex = useBreakpointIndex(), hasFetchedOnce = fetchCount >= 0, hasItems = combinedItems.length > 0, handleLoadMoreItems = () => {
|
|
5069
5063
|
fetching || dispatch(assetsActions.loadNextPage());
|
|
5070
5064
|
};
|
|
5071
|
-
return useEffect(() => {
|
|
5065
|
+
return react.useEffect(() => {
|
|
5072
5066
|
breakpointIndex <= 1 && tagsPanelVisible && dispatch(tagsActions.panelVisibleSet({ panelVisible: !1 }));
|
|
5073
|
-
}, [breakpointIndex]), /* @__PURE__ */ jsx(Box, { flex: 1, style: { width: "100%" }, children: !hasItems && hasFetchedOnce && !fetching ? /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(Text, { size: 1, weight: "semibold", children: "No results for the current query" }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5074
|
-
view === "grid" && /* @__PURE__ */ jsx(AssetGridVirtualized, { items: combinedItems, onLoadMore: handleLoadMoreItems }),
|
|
5075
|
-
view === "table" && /* @__PURE__ */ jsx(AssetTableVirtualized, { items: combinedItems, onLoadMore: handleLoadMoreItems })
|
|
5067
|
+
}, [breakpointIndex]), /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, style: { width: "100%" }, children: !hasItems && hasFetchedOnce && !fetching ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, weight: "semibold", children: "No results for the current query" }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5068
|
+
view === "grid" && /* @__PURE__ */ jsxRuntime.jsx(AssetGridVirtualized, { items: combinedItems, onLoadMore: handleLoadMoreItems }),
|
|
5069
|
+
view === "table" && /* @__PURE__ */ jsxRuntime.jsx(AssetTableVirtualized, { items: combinedItems, onLoadMore: handleLoadMoreItems })
|
|
5076
5070
|
] }) });
|
|
5077
5071
|
}, Notifications = () => {
|
|
5078
|
-
const items = useTypedSelector((state) => state.notifications.items), toast = useToast();
|
|
5079
|
-
return useEffect(() => {
|
|
5072
|
+
const items = useTypedSelector((state) => state.notifications.items), toast = ui.useToast();
|
|
5073
|
+
return react.useEffect(() => {
|
|
5080
5074
|
if (items.length > 0) {
|
|
5081
5075
|
const lastItem = items[items.length - 1];
|
|
5082
5076
|
toast.push({
|
|
@@ -5087,13 +5081,13 @@ const TableRowUpload = (props) => {
|
|
|
5087
5081
|
}
|
|
5088
5082
|
}, [items.length]), null;
|
|
5089
5083
|
}, PickedBar = () => {
|
|
5090
|
-
const scheme = useColorSchemeValue(), dispatch = useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), handlePickClear = () => {
|
|
5084
|
+
const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), handlePickClear = () => {
|
|
5091
5085
|
dispatch(assetsActions.pickClear());
|
|
5092
5086
|
}, handleDeletePicked = () => {
|
|
5093
5087
|
dispatch(dialogActions.showConfirmDeleteAssets({ assets: assetsPicked }));
|
|
5094
5088
|
};
|
|
5095
|
-
return assetsPicked.length === 0 ? null : /* @__PURE__ */ jsx(
|
|
5096
|
-
Flex,
|
|
5089
|
+
return assetsPicked.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5090
|
+
ui.Flex,
|
|
5097
5091
|
{
|
|
5098
5092
|
align: "center",
|
|
5099
5093
|
justify: "flex-start",
|
|
@@ -5104,33 +5098,33 @@ const TableRowUpload = (props) => {
|
|
|
5104
5098
|
position: "relative",
|
|
5105
5099
|
width: "100%"
|
|
5106
5100
|
},
|
|
5107
|
-
children: /* @__PURE__ */ jsxs(Flex, { align: "center", paddingX: 3, children: [
|
|
5108
|
-
/* @__PURE__ */ jsx(Box, { paddingRight: 2, children: /* @__PURE__ */ jsxs(Label, { size: 0, style: { color: "inherit" }, children: [
|
|
5101
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", paddingX: 3, children: [
|
|
5102
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingRight: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Label, { size: 0, style: { color: "inherit" }, children: [
|
|
5109
5103
|
assetsPicked.length,
|
|
5110
5104
|
" ",
|
|
5111
|
-
|
|
5105
|
+
pluralize__default.default("asset", assetsPicked.length),
|
|
5112
5106
|
" selected"
|
|
5113
5107
|
] }) }),
|
|
5114
|
-
/* @__PURE__ */ jsx(
|
|
5115
|
-
Button,
|
|
5108
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5109
|
+
ui.Button,
|
|
5116
5110
|
{
|
|
5117
5111
|
mode: "bleed",
|
|
5118
5112
|
onClick: handlePickClear,
|
|
5119
5113
|
padding: 2,
|
|
5120
5114
|
style: { background: "none", boxShadow: "none" },
|
|
5121
5115
|
tone: "default",
|
|
5122
|
-
children: /* @__PURE__ */ jsx(Label, { size: 0, children: "Deselect" })
|
|
5116
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 0, children: "Deselect" })
|
|
5123
5117
|
}
|
|
5124
5118
|
),
|
|
5125
|
-
/* @__PURE__ */ jsx(
|
|
5126
|
-
Button,
|
|
5119
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5120
|
+
ui.Button,
|
|
5127
5121
|
{
|
|
5128
5122
|
mode: "bleed",
|
|
5129
5123
|
onClick: handleDeletePicked,
|
|
5130
5124
|
padding: 2,
|
|
5131
5125
|
style: { background: "none", boxShadow: "none" },
|
|
5132
5126
|
tone: "critical",
|
|
5133
|
-
children: /* @__PURE__ */ jsx(Label, { size: 0, children: "Delete" })
|
|
5127
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 0, children: "Delete" })
|
|
5134
5128
|
}
|
|
5135
5129
|
)
|
|
5136
5130
|
] })
|
|
@@ -5142,7 +5136,7 @@ function messageFromGenericErrorPayload(payload) {
|
|
|
5142
5136
|
}
|
|
5143
5137
|
const initialState$1 = {
|
|
5144
5138
|
items: []
|
|
5145
|
-
}, notificationsSlice = createSlice({
|
|
5139
|
+
}, notificationsSlice = toolkit.createSlice({
|
|
5146
5140
|
name: "notifications",
|
|
5147
5141
|
initialState: initialState$1,
|
|
5148
5142
|
reducers: {
|
|
@@ -5156,24 +5150,24 @@ const initialState$1 = {
|
|
|
5156
5150
|
}
|
|
5157
5151
|
}
|
|
5158
5152
|
}), notificationsAssetsDeleteCompleteEpic = (action$) => action$.pipe(
|
|
5159
|
-
filter(assetsActions.deleteComplete.match),
|
|
5160
|
-
mergeMap((action) => {
|
|
5153
|
+
operators$1.filter(assetsActions.deleteComplete.match),
|
|
5154
|
+
operators$1.mergeMap((action) => {
|
|
5161
5155
|
const { assetIds } = action.payload, deletedCount = assetIds.length;
|
|
5162
|
-
return of(
|
|
5156
|
+
return rxjs.of(
|
|
5163
5157
|
notificationsSlice.actions.add({
|
|
5164
5158
|
status: "info",
|
|
5165
|
-
title: `${deletedCount} ${
|
|
5159
|
+
title: `${deletedCount} ${pluralize__default.default("asset", deletedCount)} deleted`
|
|
5166
5160
|
})
|
|
5167
5161
|
);
|
|
5168
5162
|
})
|
|
5169
5163
|
), notificationsAssetsDeleteErrorEpic = (action$) => action$.pipe(
|
|
5170
|
-
filter(assetsActions.deleteError.match),
|
|
5171
|
-
mergeMap((action) => {
|
|
5164
|
+
operators$1.filter(assetsActions.deleteError.match),
|
|
5165
|
+
operators$1.mergeMap((action) => {
|
|
5172
5166
|
const { assetIds } = action.payload, count = assetIds.length;
|
|
5173
|
-
return of(
|
|
5167
|
+
return rxjs.of(
|
|
5174
5168
|
notificationsSlice.actions.add({
|
|
5175
5169
|
status: "error",
|
|
5176
|
-
title: `Unable to delete ${count} ${
|
|
5170
|
+
title: `Unable to delete ${count} ${pluralize__default.default(
|
|
5177
5171
|
"asset",
|
|
5178
5172
|
count
|
|
5179
5173
|
)}. Please review any asset errors and try again.`
|
|
@@ -5181,42 +5175,42 @@ const initialState$1 = {
|
|
|
5181
5175
|
);
|
|
5182
5176
|
})
|
|
5183
5177
|
), notificationsAssetsTagsAddCompleteEpic = (action$) => action$.pipe(
|
|
5184
|
-
filter(ASSETS_ACTIONS.tagsAddComplete.match),
|
|
5185
|
-
mergeMap((action) => {
|
|
5178
|
+
operators$1.filter(ASSETS_ACTIONS.tagsAddComplete.match),
|
|
5179
|
+
operators$1.mergeMap((action) => {
|
|
5186
5180
|
const count = action?.payload?.assets?.length;
|
|
5187
|
-
return of(
|
|
5181
|
+
return rxjs.of(
|
|
5188
5182
|
notificationsSlice.actions.add({
|
|
5189
5183
|
status: "info",
|
|
5190
|
-
title: `Tag added to ${count} ${
|
|
5184
|
+
title: `Tag added to ${count} ${pluralize__default.default("asset", count)}`
|
|
5191
5185
|
})
|
|
5192
5186
|
);
|
|
5193
5187
|
})
|
|
5194
5188
|
), notificationsAssetsTagsRemoveCompleteEpic = (action$) => action$.pipe(
|
|
5195
|
-
filter(ASSETS_ACTIONS.tagsRemoveComplete.match),
|
|
5196
|
-
mergeMap((action) => {
|
|
5189
|
+
operators$1.filter(ASSETS_ACTIONS.tagsRemoveComplete.match),
|
|
5190
|
+
operators$1.mergeMap((action) => {
|
|
5197
5191
|
const count = action?.payload?.assets?.length;
|
|
5198
|
-
return of(
|
|
5192
|
+
return rxjs.of(
|
|
5199
5193
|
notificationsSlice.actions.add({
|
|
5200
5194
|
status: "info",
|
|
5201
|
-
title: `Tag removed from ${count} ${
|
|
5195
|
+
title: `Tag removed from ${count} ${pluralize__default.default("asset", count)}`
|
|
5202
5196
|
})
|
|
5203
5197
|
);
|
|
5204
5198
|
})
|
|
5205
5199
|
), notificationsAssetsUpdateCompleteEpic = (action$) => action$.pipe(
|
|
5206
|
-
filter(assetsActions.updateComplete.match),
|
|
5207
|
-
bufferTime(2e3),
|
|
5208
|
-
filter((actions) => actions.length > 0),
|
|
5209
|
-
mergeMap((actions) => {
|
|
5200
|
+
operators$1.filter(assetsActions.updateComplete.match),
|
|
5201
|
+
operators$1.bufferTime(2e3),
|
|
5202
|
+
operators$1.filter((actions) => actions.length > 0),
|
|
5203
|
+
operators$1.mergeMap((actions) => {
|
|
5210
5204
|
const updatedCount = actions.length;
|
|
5211
|
-
return of(
|
|
5205
|
+
return rxjs.of(
|
|
5212
5206
|
notificationsSlice.actions.add({
|
|
5213
5207
|
status: "info",
|
|
5214
|
-
title: `${updatedCount} ${
|
|
5208
|
+
title: `${updatedCount} ${pluralize__default.default("asset", updatedCount)} updated`
|
|
5215
5209
|
})
|
|
5216
5210
|
);
|
|
5217
5211
|
})
|
|
5218
5212
|
), notificationsGenericErrorEpic = (action$) => action$.pipe(
|
|
5219
|
-
ofType(
|
|
5213
|
+
reduxObservable.ofType(
|
|
5220
5214
|
assetsActions.fetchError.type,
|
|
5221
5215
|
assetsActions.updateError.type,
|
|
5222
5216
|
tagsActions.createError.type,
|
|
@@ -5225,9 +5219,9 @@ const initialState$1 = {
|
|
|
5225
5219
|
tagsActions.updateError.type,
|
|
5226
5220
|
uploadsActions.uploadError.type
|
|
5227
5221
|
),
|
|
5228
|
-
mergeMap((action) => {
|
|
5222
|
+
operators$1.mergeMap((action) => {
|
|
5229
5223
|
const title = `An error occurred: ${messageFromGenericErrorPayload(action.payload)}`;
|
|
5230
|
-
return of(
|
|
5224
|
+
return rxjs.of(
|
|
5231
5225
|
notificationsSlice.actions.add({
|
|
5232
5226
|
status: "error",
|
|
5233
5227
|
title
|
|
@@ -5235,27 +5229,27 @@ const initialState$1 = {
|
|
|
5235
5229
|
);
|
|
5236
5230
|
})
|
|
5237
5231
|
), notificationsTagCreateCompleteEpic = (action$) => action$.pipe(
|
|
5238
|
-
filter(tagsActions.createComplete.match),
|
|
5239
|
-
mergeMap(() => of(notificationsSlice.actions.add({ status: "info", title: "Tag created" })))
|
|
5232
|
+
operators$1.filter(tagsActions.createComplete.match),
|
|
5233
|
+
operators$1.mergeMap(() => rxjs.of(notificationsSlice.actions.add({ status: "info", title: "Tag created" })))
|
|
5240
5234
|
), notificationsTagDeleteCompleteEpic = (action$) => action$.pipe(
|
|
5241
|
-
filter(tagsActions.deleteComplete.match),
|
|
5242
|
-
mergeMap(() => of(notificationsSlice.actions.add({ status: "info", title: "Tag deleted" })))
|
|
5235
|
+
operators$1.filter(tagsActions.deleteComplete.match),
|
|
5236
|
+
operators$1.mergeMap(() => rxjs.of(notificationsSlice.actions.add({ status: "info", title: "Tag deleted" })))
|
|
5243
5237
|
), notificationsTagUpdateCompleteEpic = (action$) => action$.pipe(
|
|
5244
|
-
filter(tagsActions.updateComplete.match),
|
|
5245
|
-
mergeMap(() => of(notificationsSlice.actions.add({ status: "info", title: "Tag updated" })))
|
|
5238
|
+
operators$1.filter(tagsActions.updateComplete.match),
|
|
5239
|
+
operators$1.mergeMap(() => rxjs.of(notificationsSlice.actions.add({ status: "info", title: "Tag updated" })))
|
|
5246
5240
|
), notificationsActions = { ...notificationsSlice.actions };
|
|
5247
5241
|
var notificationsReducer = notificationsSlice.reducer;
|
|
5248
5242
|
const initialState = {
|
|
5249
5243
|
assets: [],
|
|
5250
5244
|
document: void 0,
|
|
5251
5245
|
documentAssetIds: []
|
|
5252
|
-
}, selectedSlice = createSlice({
|
|
5246
|
+
}, selectedSlice = toolkit.createSlice({
|
|
5253
5247
|
name: "selected",
|
|
5254
5248
|
initialState,
|
|
5255
5249
|
reducers: {}
|
|
5256
5250
|
});
|
|
5257
5251
|
var selectedReducer = selectedSlice.reducer;
|
|
5258
|
-
const rootEpic = combineEpics(
|
|
5252
|
+
const rootEpic = reduxObservable.combineEpics(
|
|
5259
5253
|
assetsDeleteEpic,
|
|
5260
5254
|
assetsFetchEpic,
|
|
5261
5255
|
assetsFetchAfterDeleteAllEpic,
|
|
@@ -5305,7 +5299,7 @@ const rootEpic = combineEpics(
|
|
|
5305
5299
|
selected: selectedReducer,
|
|
5306
5300
|
tags: tagsReducer,
|
|
5307
5301
|
uploads: uploadsReducer
|
|
5308
|
-
}, rootReducer = combineReducers(reducers), isPlainObject = (value) => value !== null && typeof value == "object" && !Array.isArray(value), getAssetIds = (node, acc = []) => (Array.isArray(node) && node.forEach((v) => {
|
|
5302
|
+
}, rootReducer = toolkit.combineReducers(reducers), isPlainObject = (value) => value !== null && typeof value == "object" && !Array.isArray(value), getAssetIds = (node, acc = []) => (Array.isArray(node) && node.forEach((v) => {
|
|
5309
5303
|
getAssetIds(v, acc);
|
|
5310
5304
|
}), isPlainObject(node) && (node?.asset?._type === "reference" && node?.asset?._ref && acc.push(node.asset._ref), Object.values(node).forEach((val) => {
|
|
5311
5305
|
getAssetIds(val, acc);
|
|
@@ -5316,17 +5310,17 @@ const rootEpic = combineEpics(
|
|
|
5316
5310
|
function isSupportedAssetType(assetType) {
|
|
5317
5311
|
return assetType ? SUPPORTED_ASSET_TYPES.includes(assetType) : !1;
|
|
5318
5312
|
}
|
|
5319
|
-
class ReduxProvider extends Component {
|
|
5313
|
+
class ReduxProvider extends react.Component {
|
|
5320
5314
|
store;
|
|
5321
5315
|
constructor(props) {
|
|
5322
5316
|
super(props);
|
|
5323
|
-
const epicMiddleware = createEpicMiddleware({
|
|
5317
|
+
const epicMiddleware = reduxObservable.createEpicMiddleware({
|
|
5324
5318
|
dependencies: {
|
|
5325
5319
|
client: props.client
|
|
5326
5320
|
// inject sanity client as a dependency to all epics
|
|
5327
5321
|
}
|
|
5328
5322
|
});
|
|
5329
|
-
this.store = configureStore({
|
|
5323
|
+
this.store = toolkit.configureStore({
|
|
5330
5324
|
reducer: rootReducer,
|
|
5331
5325
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
5332
5326
|
/*
|
|
@@ -5376,18 +5370,18 @@ class ReduxProvider extends Component {
|
|
|
5376
5370
|
}), epicMiddleware.run(rootEpic);
|
|
5377
5371
|
}
|
|
5378
5372
|
render() {
|
|
5379
|
-
return /* @__PURE__ */ jsx(Provider, { store: this.store, children: this.props.children });
|
|
5373
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRedux.Provider, { store: this.store, children: this.props.children });
|
|
5380
5374
|
}
|
|
5381
5375
|
}
|
|
5382
|
-
const TagsPanel = () => useTypedSelector((state) => state.tags.panelVisible) ? /* @__PURE__ */ jsx(
|
|
5383
|
-
Box,
|
|
5376
|
+
const TagsPanel = () => useTypedSelector((state) => state.tags.panelVisible) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5377
|
+
ui.Box,
|
|
5384
5378
|
{
|
|
5385
5379
|
style: {
|
|
5386
5380
|
position: "relative",
|
|
5387
5381
|
width: TAGS_PANEL_WIDTH
|
|
5388
5382
|
},
|
|
5389
|
-
children: /* @__PURE__ */ jsx(
|
|
5390
|
-
Box,
|
|
5383
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5384
|
+
ui.Box,
|
|
5391
5385
|
{
|
|
5392
5386
|
className: "media__custom-scrollbar",
|
|
5393
5387
|
style: {
|
|
@@ -5400,11 +5394,11 @@ const TagsPanel = () => useTypedSelector((state) => state.tags.panelVisible) ? /
|
|
|
5400
5394
|
top: 0,
|
|
5401
5395
|
width: "100%"
|
|
5402
5396
|
},
|
|
5403
|
-
children: /* @__PURE__ */ jsx(TagView, {})
|
|
5397
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TagView, {})
|
|
5404
5398
|
}
|
|
5405
5399
|
)
|
|
5406
5400
|
}
|
|
5407
|
-
) : null, UploadContainer = styled.div`
|
|
5401
|
+
) : null, UploadContainer = styledComponents.styled.div`
|
|
5408
5402
|
color: white;
|
|
5409
5403
|
height: 100%;
|
|
5410
5404
|
min-height: 100%;
|
|
@@ -5415,7 +5409,7 @@ const TagsPanel = () => useTypedSelector((state) => state.tags.panelVisible) ? /
|
|
|
5415
5409
|
&:focus {
|
|
5416
5410
|
outline: none;
|
|
5417
5411
|
}
|
|
5418
|
-
`, DragActiveContainer = styled.div`
|
|
5412
|
+
`, DragActiveContainer = styledComponents.styled.div`
|
|
5419
5413
|
align-items: center;
|
|
5420
5414
|
background: rgba(0, 0, 0, 0.75);
|
|
5421
5415
|
display: flex;
|
|
@@ -5440,7 +5434,7 @@ const UploadDropzone = (props) => {
|
|
|
5440
5434
|
const { children } = props, {
|
|
5441
5435
|
dropzone: { maxSize },
|
|
5442
5436
|
directUploads
|
|
5443
|
-
} = useToolOptions(), { onSelect } = useAssetSourceActions(), dispatch = useDispatch(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), isImageAssetType = assetTypes.length === 1 && assetTypes[0] === "image", handleDrop = async (acceptedFiles) => {
|
|
5437
|
+
} = useToolOptions(), { onSelect } = useAssetSourceActions(), dispatch = reactRedux.useDispatch(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), isImageAssetType = assetTypes.length === 1 && assetTypes[0] === "image", handleDrop = async (acceptedFiles) => {
|
|
5444
5438
|
acceptedFiles.forEach(
|
|
5445
5439
|
(file) => dispatch(
|
|
5446
5440
|
uploadsActions.uploadRequest({
|
|
@@ -5471,7 +5465,7 @@ const UploadDropzone = (props) => {
|
|
|
5471
5465
|
title: "Unable to upload some items (folders and packages aren't supported)"
|
|
5472
5466
|
})
|
|
5473
5467
|
), files;
|
|
5474
|
-
}, { getRootProps, getInputProps, isDragActive, open } = useDropzone({
|
|
5468
|
+
}, { getRootProps, getInputProps, isDragActive, open } = reactDropzone.useDropzone({
|
|
5475
5469
|
accept: isImageAssetType ? "image/*" : "",
|
|
5476
5470
|
getFilesFromEvent: handleFileGetter,
|
|
5477
5471
|
noClick: !0,
|
|
@@ -5483,9 +5477,9 @@ const UploadDropzone = (props) => {
|
|
|
5483
5477
|
onDropRejected: handleDropRejected,
|
|
5484
5478
|
disabled: !directUploads
|
|
5485
5479
|
});
|
|
5486
|
-
return /* @__PURE__ */ jsx(DropzoneDispatchProvider, { open, children: /* @__PURE__ */ jsxs(UploadContainer, { ...getRootProps(), children: [
|
|
5487
|
-
/* @__PURE__ */ jsx("input", { ...getInputProps() }),
|
|
5488
|
-
isDragActive && /* @__PURE__ */ jsx(DragActiveContainer, { children: /* @__PURE__ */ jsx(Flex, { direction: "column", justify: "center", style: { color: white.hex }, children: /* @__PURE__ */ jsx(Text, { size: 3, style: { color: "inherit" }, children: "Drop files to upload" }) }) }),
|
|
5480
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropzoneDispatchProvider, { open, children: /* @__PURE__ */ jsxRuntime.jsxs(UploadContainer, { ...getRootProps(), children: [
|
|
5481
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { ...getInputProps() }),
|
|
5482
|
+
isDragActive && /* @__PURE__ */ jsxRuntime.jsx(DragActiveContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { direction: "column", justify: "center", style: { color: color.white.hex }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 3, style: { color: "inherit" }, children: "Drop files to upload" }) }) }),
|
|
5489
5483
|
children
|
|
5490
5484
|
] }) });
|
|
5491
5485
|
};
|
|
@@ -5530,16 +5524,16 @@ function createTagHandler(dispatch) {
|
|
|
5530
5524
|
};
|
|
5531
5525
|
}
|
|
5532
5526
|
function useBrowserInit(client, schemaType) {
|
|
5533
|
-
const dispatch = useDispatch(), tagsByIds = useSelector((state) => state.tags.byIds), tagsFetchCount = useSelector((state) => state.tags.fetchCount), tagNames = getMediaTagNames(schemaType), hasMediaTags = tagNames.length > 0;
|
|
5534
|
-
useEffect(() => {
|
|
5527
|
+
const dispatch = reactRedux.useDispatch(), tagsByIds = reactRedux.useSelector((state) => state.tags.byIds), tagsFetchCount = reactRedux.useSelector((state) => state.tags.fetchCount), tagNames = getMediaTagNames(schemaType), hasMediaTags = tagNames.length > 0;
|
|
5528
|
+
react.useEffect(() => {
|
|
5535
5529
|
hasMediaTags || dispatch(searchActions.facetsClear()), dispatch(tagsActions.fetchRequest());
|
|
5536
5530
|
const assetSubscription = client.listen(
|
|
5537
|
-
|
|
5538
|
-
).subscribe(createAssetHandler(dispatch)), tagSubscription = client.listen(
|
|
5531
|
+
groq__default.default`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))]`
|
|
5532
|
+
).subscribe(createAssetHandler(dispatch)), tagSubscription = client.listen(groq__default.default`*[_type == "${TAG_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(createTagHandler(dispatch));
|
|
5539
5533
|
return () => {
|
|
5540
5534
|
assetSubscription.unsubscribe(), tagSubscription.unsubscribe();
|
|
5541
5535
|
};
|
|
5542
|
-
}, [client, dispatch, hasMediaTags]), useEffect(() => {
|
|
5536
|
+
}, [client, dispatch, hasMediaTags]), react.useEffect(() => {
|
|
5543
5537
|
if (!hasMediaTags || tagsFetchCount < 0) return;
|
|
5544
5538
|
const tagFacetInput = inputs.tag;
|
|
5545
5539
|
if (tagFacetInput.type !== "searchable") return;
|
|
@@ -5561,46 +5555,46 @@ const BrowserContent = ({
|
|
|
5561
5555
|
onClose,
|
|
5562
5556
|
schemaType
|
|
5563
5557
|
}) => {
|
|
5564
|
-
const client = useVersionedClient(), [portalElement, setPortalElement] = useState(null);
|
|
5565
|
-
return useBrowserInit(client, schemaType), /* @__PURE__ */ jsx(PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsxs(UploadDropzone, { children: [
|
|
5566
|
-
/* @__PURE__ */ jsx(Dialogs, {}),
|
|
5567
|
-
/* @__PURE__ */ jsx(Notifications, {}),
|
|
5568
|
-
/* @__PURE__ */ jsx(Card, { display: "flex", height: "fill", ref: setPortalElement, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", flex: 1, children: [
|
|
5569
|
-
/* @__PURE__ */ jsx(Header, { onClose }),
|
|
5570
|
-
/* @__PURE__ */ jsx(Controls, {}),
|
|
5571
|
-
/* @__PURE__ */ jsxs(Flex, { flex: 1, children: [
|
|
5572
|
-
/* @__PURE__ */ jsxs(Flex, { align: "flex-end", direction: "column", flex: 1, style: { position: "relative" }, children: [
|
|
5573
|
-
/* @__PURE__ */ jsx(PickedBar, {}),
|
|
5574
|
-
/* @__PURE__ */ jsx(Items, {})
|
|
5558
|
+
const client = useVersionedClient(), [portalElement, setPortalElement] = react.useState(null);
|
|
5559
|
+
return useBrowserInit(client, schemaType), /* @__PURE__ */ jsxRuntime.jsx(ui.PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsxRuntime.jsxs(UploadDropzone, { children: [
|
|
5560
|
+
/* @__PURE__ */ jsxRuntime.jsx(Dialogs, {}),
|
|
5561
|
+
/* @__PURE__ */ jsxRuntime.jsx(Notifications, {}),
|
|
5562
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Card, { display: "flex", height: "fill", ref: setPortalElement, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", flex: 1, children: [
|
|
5563
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header, { onClose }),
|
|
5564
|
+
/* @__PURE__ */ jsxRuntime.jsx(Controls, {}),
|
|
5565
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { flex: 1, children: [
|
|
5566
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "flex-end", direction: "column", flex: 1, style: { position: "relative" }, children: [
|
|
5567
|
+
/* @__PURE__ */ jsxRuntime.jsx(PickedBar, {}),
|
|
5568
|
+
/* @__PURE__ */ jsxRuntime.jsx(Items, {})
|
|
5575
5569
|
] }),
|
|
5576
|
-
/* @__PURE__ */ jsx(TagsPanel, {})
|
|
5570
|
+
/* @__PURE__ */ jsxRuntime.jsx(TagsPanel, {})
|
|
5577
5571
|
] }),
|
|
5578
|
-
/* @__PURE__ */ jsx(DebugControls, {})
|
|
5572
|
+
/* @__PURE__ */ jsxRuntime.jsx(DebugControls, {})
|
|
5579
5573
|
] }) })
|
|
5580
5574
|
] }) });
|
|
5581
5575
|
}, Browser = (props) => {
|
|
5582
5576
|
const client = useVersionedClient();
|
|
5583
|
-
return /* @__PURE__ */ jsx(
|
|
5577
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5584
5578
|
ReduxProvider,
|
|
5585
5579
|
{
|
|
5586
5580
|
assetType: props?.assetType,
|
|
5587
5581
|
client,
|
|
5588
5582
|
document: props?.document,
|
|
5589
5583
|
selectedAssets: props?.selectedAssets,
|
|
5590
|
-
children: /* @__PURE__ */ jsxs(AssetBrowserDispatchProvider, { onSelect: props?.onSelect, children: [
|
|
5591
|
-
/* @__PURE__ */ jsx(GlobalStyle, {}),
|
|
5592
|
-
/* @__PURE__ */ jsx(BrowserContent, { onClose: props?.onClose, schemaType: props?.schemaType })
|
|
5584
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(AssetBrowserDispatchProvider, { onSelect: props?.onSelect, children: [
|
|
5585
|
+
/* @__PURE__ */ jsxRuntime.jsx(GlobalStyle, {}),
|
|
5586
|
+
/* @__PURE__ */ jsxRuntime.jsx(BrowserContent, { onClose: props?.onClose, schemaType: props?.schemaType })
|
|
5593
5587
|
] })
|
|
5594
5588
|
}
|
|
5595
5589
|
);
|
|
5596
5590
|
}, FormBuilderTool = (props) => {
|
|
5597
|
-
const { onClose } = props, portalElement = useRootPortalElement(), currentDocument = useFormValue([]);
|
|
5591
|
+
const { onClose } = props, portalElement = useRootPortalElement(), currentDocument = sanity.useFormValue([]);
|
|
5598
5592
|
useKeyPress("escape", onClose);
|
|
5599
5593
|
const handleStopPropagation = (event) => {
|
|
5600
5594
|
event.nativeEvent.stopImmediatePropagation(), event.stopPropagation();
|
|
5601
|
-
}, { zIndex } = useLayer();
|
|
5602
|
-
return /* @__PURE__ */ jsx(PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
|
|
5603
|
-
Box,
|
|
5595
|
+
}, { zIndex } = ui.useLayer();
|
|
5596
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5597
|
+
ui.Box,
|
|
5604
5598
|
{
|
|
5605
5599
|
onDragEnter: handleStopPropagation,
|
|
5606
5600
|
onDragLeave: handleStopPropagation,
|
|
@@ -5616,15 +5610,15 @@ const BrowserContent = ({
|
|
|
5616
5610
|
width: "100%",
|
|
5617
5611
|
zIndex
|
|
5618
5612
|
},
|
|
5619
|
-
children: /* @__PURE__ */ jsx(Browser, { document: currentDocument, schemaType: props.schemaType, ...props })
|
|
5613
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Browser, { document: currentDocument, schemaType: props.schemaType, ...props })
|
|
5620
5614
|
}
|
|
5621
5615
|
) }) });
|
|
5622
5616
|
}, useRootPortalElement = () => {
|
|
5623
|
-
const [container] = useState(() => document.createElement("div"));
|
|
5624
|
-
return useEffect(() => (container.classList.add("media-portal"), document.body.appendChild(container), () => {
|
|
5617
|
+
const [container] = react.useState(() => document.createElement("div"));
|
|
5618
|
+
return react.useEffect(() => (container.classList.add("media-portal"), document.body.appendChild(container), () => {
|
|
5625
5619
|
document.body.removeChild(container);
|
|
5626
5620
|
}), [container]), container;
|
|
5627
|
-
}, Tool = () => /* @__PURE__ */ jsx(Flex, { direction: "column", height: "fill", flex: 1, children: /* @__PURE__ */ jsx(Browser, {}) });
|
|
5621
|
+
}, Tool = () => /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { direction: "column", height: "fill", flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Browser, {}) });
|
|
5628
5622
|
var mediaTag = {
|
|
5629
5623
|
title: "Media Tag",
|
|
5630
5624
|
icon: TagIcon,
|
|
@@ -5651,7 +5645,7 @@ var mediaTag = {
|
|
|
5651
5645
|
}
|
|
5652
5646
|
};
|
|
5653
5647
|
const plugin = {
|
|
5654
|
-
icon: ImageIcon,
|
|
5648
|
+
icon: icons.ImageIcon,
|
|
5655
5649
|
name: "media",
|
|
5656
5650
|
title: "Media"
|
|
5657
5651
|
}, mediaAssetSource = {
|
|
@@ -5661,11 +5655,11 @@ const plugin = {
|
|
|
5661
5655
|
...plugin,
|
|
5662
5656
|
component: Tool,
|
|
5663
5657
|
__internalApplicationType: "sanity/media"
|
|
5664
|
-
}, media = definePlugin((options) => ({
|
|
5658
|
+
}, media = sanity.definePlugin((options) => ({
|
|
5665
5659
|
name: "media",
|
|
5666
5660
|
studio: {
|
|
5667
5661
|
components: {
|
|
5668
|
-
layout: (props) => /* @__PURE__ */ jsx(ToolOptionsProvider, { options, children: props.renderDefault(props) })
|
|
5662
|
+
layout: (props) => /* @__PURE__ */ jsxRuntime.jsx(ToolOptionsProvider, { options, children: props.renderDefault(props) })
|
|
5669
5663
|
}
|
|
5670
5664
|
},
|
|
5671
5665
|
form: {
|
|
@@ -5699,7 +5693,7 @@ async function doApplyMediaTags({
|
|
|
5699
5693
|
if (!mediaTags || mediaTags.length === 0) return;
|
|
5700
5694
|
const validTags = (await Promise.all(
|
|
5701
5695
|
mediaTags.map(async (tagName) => await client.fetch(
|
|
5702
|
-
|
|
5696
|
+
groq__default.default`*[_type == "${TAG_DOCUMENT_NAME}" && name.current == $tagName][0]`,
|
|
5703
5697
|
{ tagName }
|
|
5704
5698
|
) || (createTagsOnUpload ? await client.create({
|
|
5705
5699
|
_type: TAG_DOCUMENT_NAME,
|
|
@@ -5708,12 +5702,12 @@ async function doApplyMediaTags({
|
|
|
5708
5702
|
)).filter((tag) => tag !== null);
|
|
5709
5703
|
if (validTags.length === 0) return;
|
|
5710
5704
|
const existing = await client.fetch(
|
|
5711
|
-
|
|
5705
|
+
groq__default.default`*[_id == $assetId][0]{'tagIds': opt.media.tags[]._ref}`,
|
|
5712
5706
|
{ assetId },
|
|
5713
5707
|
{ useCdn: !1 }
|
|
5714
5708
|
// bypass CDN cache so we see the latest committed tag refs
|
|
5715
5709
|
), existingIds = new Set(existing?.tagIds ?? []), tagReferences = validTags.filter((tag) => !existingIds.has(tag._id)).map((tag) => ({
|
|
5716
|
-
_key: nanoid(),
|
|
5710
|
+
_key: nanoid.nanoid(),
|
|
5717
5711
|
_ref: tag._id,
|
|
5718
5712
|
_type: "reference",
|
|
5719
5713
|
_weak: !0
|
|
@@ -5721,8 +5715,8 @@ async function doApplyMediaTags({
|
|
|
5721
5715
|
tagReferences.length !== 0 && await client.patch(assetId).setIfMissing({ opt: {} }).setIfMissing({ "opt.media": {} }).setIfMissing({ "opt.media.tags": [] }).append("opt.media.tags", tagReferences).commit();
|
|
5722
5716
|
}
|
|
5723
5717
|
function AutoTagInput(props) {
|
|
5724
|
-
const { renderDefault, schemaType, value, mediaTags: mediaTagsProp } = props, toast = useToast(), mediaTags = mediaTagsProp ?? schemaType?.options?.mediaTags, client = useVersionedClient(), { createTagsOnUpload } = useToolOptions(), prevAssetRef = useRef(void 0), isInitialMount = useRef(!0), currentAssetRef = value?.asset?._ref;
|
|
5725
|
-
return useEffect(() => {
|
|
5718
|
+
const { renderDefault, schemaType, value, mediaTags: mediaTagsProp } = props, toast = ui.useToast(), mediaTags = mediaTagsProp ?? schemaType?.options?.mediaTags, client = useVersionedClient(), { createTagsOnUpload } = useToolOptions(), prevAssetRef = react.useRef(void 0), isInitialMount = react.useRef(!0), currentAssetRef = value?.asset?._ref;
|
|
5719
|
+
return react.useEffect(() => {
|
|
5726
5720
|
if (isInitialMount.current) {
|
|
5727
5721
|
isInitialMount.current = !1, prevAssetRef.current = currentAssetRef;
|
|
5728
5722
|
return;
|
|
@@ -5745,17 +5739,15 @@ function AutoTagInput(props) {
|
|
|
5745
5739
|
}, [currentAssetRef, mediaTags, client, createTagsOnUpload]), renderDefault(props);
|
|
5746
5740
|
}
|
|
5747
5741
|
function mediaField(config) {
|
|
5748
|
-
const { mediaTags, options, components
|
|
5742
|
+
const { mediaTags, options, components, ...rest } = config;
|
|
5749
5743
|
return {
|
|
5750
5744
|
...rest,
|
|
5751
5745
|
options: { ...options, mediaTags },
|
|
5752
|
-
components: { ...
|
|
5746
|
+
components: { ...components, input: AutoTagInput }
|
|
5753
5747
|
};
|
|
5754
5748
|
}
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
};
|
|
5761
|
-
//# sourceMappingURL=index.mjs.map
|
|
5749
|
+
exports.AutoTagInput = AutoTagInput;
|
|
5750
|
+
exports.media = media;
|
|
5751
|
+
exports.mediaAssetSource = mediaAssetSource;
|
|
5752
|
+
exports.mediaField = mediaField;
|
|
5753
|
+
//# sourceMappingURL=index.cjs.map
|