@electrolux-oss/sanity-plugin-media 4.1.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -31
- package/dist/index.d.ts +7 -107
- package/dist/index.js +195 -215
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useClient, useSchema, Preview, useColorSchemeValue, useDocumentStore, WithReferringDocuments, useCurrentUser, useFormValue, definePlugin } from "sanity";
|
|
2
|
+
import { useClient, useSchema, Preview, useColorSchemeValue, useDocumentStore, WithReferringDocuments, useCurrentUser, useFormValue, defineType, defineField, definePlugin } from "sanity";
|
|
3
3
|
import { forwardRef, createContext, useContext, useState, useEffect, useMemo, useRef, useCallback, memo } from "react";
|
|
4
|
-
import { usePortal,
|
|
4
|
+
import { usePortal, Button, Text, Box, Stack, Inline, Flex, Dialog as Dialog$1, Card, TextInput, useTheme_v2, rem, TextArea, TabList, Tab, TabPanel, Label, Container as Container$2, PortalProvider, useMediaIndex, Switch, Spinner, Checkbox, Grid, useLayer, Portal } from "@sanity/ui";
|
|
5
5
|
import { useSelector, useDispatch, Provider } from "react-redux";
|
|
6
6
|
import groq from "groq";
|
|
7
7
|
import { nanoid } from "nanoid";
|
|
@@ -17,13 +17,18 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|
|
17
17
|
import * as z from "zod";
|
|
18
18
|
import { format, formatRelative } from "date-fns";
|
|
19
19
|
import filesize from "filesize";
|
|
20
|
+
import { Popover } from "@sanity/ui/popover";
|
|
20
21
|
import copy from "copy-to-clipboard";
|
|
21
22
|
import { useIntentLink } from "sanity/router";
|
|
23
|
+
import { getTheme_v2 } from "@sanity/ui/theme";
|
|
22
24
|
import { FileIcon as FileIcon$1, defaultStyles } from "react-file-icon";
|
|
25
|
+
import { Tooltip } from "@sanity/ui/tooltip";
|
|
23
26
|
import { hues, white } from "@sanity/color";
|
|
24
27
|
import CreatableSelect from "react-select/creatable";
|
|
25
28
|
import Select, { components } from "react-select";
|
|
26
29
|
import { Virtuoso, VirtuosoGrid, GroupedVirtuoso } from "react-virtuoso";
|
|
30
|
+
import { MenuButton, Menu as Menu$2, MenuItem, MenuDivider, MenuGroup } from "@sanity/ui/menu";
|
|
31
|
+
import { useToast } from "@sanity/ui/toast";
|
|
27
32
|
import { isHotkey } from "is-hotkey-esm";
|
|
28
33
|
import { useNProgress } from "@tanem/react-nprogress";
|
|
29
34
|
import { useDropzone } from "react-dropzone";
|
|
@@ -1760,13 +1765,13 @@ const customScrollbar = css`
|
|
|
1760
1765
|
throw new Error("useToolOptions must be used within an ToolOptionsProvider");
|
|
1761
1766
|
return context;
|
|
1762
1767
|
}, tagOptionSchema = z.object({
|
|
1763
|
-
label: z.string().trim().min(1, {
|
|
1764
|
-
value: z.string().trim().min(1, {
|
|
1768
|
+
label: z.string().trim().min(1, { error: "Label cannot be empty" }),
|
|
1769
|
+
value: z.string().trim().min(1, { error: "Value cannot be empty" })
|
|
1765
1770
|
}), tagFormSchema = z.object({
|
|
1766
|
-
name: z.string().min(1, {
|
|
1771
|
+
name: z.string().min(1, { error: "Name cannot be empty" })
|
|
1767
1772
|
}), createAssetFormSchema = (languages, validateAltTexts = !1) => {
|
|
1768
1773
|
const defaultLanguage = languages.find((lang) => lang.default), createAltTextsSchema = () => {
|
|
1769
|
-
const baseSchema = z.record(z.string().nullable());
|
|
1774
|
+
const baseSchema = z.record(z.string(), z.string().nullable());
|
|
1770
1775
|
return validateAltTexts ? baseSchema.refine(
|
|
1771
1776
|
(altTexts) => {
|
|
1772
1777
|
if (defaultLanguage) {
|
|
@@ -1778,7 +1783,7 @@ const customScrollbar = css`
|
|
|
1778
1783
|
);
|
|
1779
1784
|
},
|
|
1780
1785
|
{
|
|
1781
|
-
|
|
1786
|
+
error: 'The default language must have alt text. Please fill in the default language field and click "Save and close".'
|
|
1782
1787
|
}
|
|
1783
1788
|
) : baseSchema;
|
|
1784
1789
|
};
|
|
@@ -1792,7 +1797,7 @@ const customScrollbar = css`
|
|
|
1792
1797
|
tags: z.array(tagOptionSchema).nullable()
|
|
1793
1798
|
})
|
|
1794
1799
|
}),
|
|
1795
|
-
originalFilename: z.string().trim().min(1, {
|
|
1800
|
+
originalFilename: z.string().trim().min(1, { error: "Filename cannot be empty" }),
|
|
1796
1801
|
title: z.string().trim().optional()
|
|
1797
1802
|
});
|
|
1798
1803
|
};
|
|
@@ -1993,7 +1998,7 @@ const ButtonAssetCopy = ({ disabled, url }) => {
|
|
|
1993
1998
|
window.location.href = `${asset.url}?dl=${asset.originalFilename}`;
|
|
1994
1999
|
};
|
|
1995
2000
|
return /* @__PURE__ */ jsxs(Box, { marginTop: 3, children: [
|
|
1996
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, {
|
|
2001
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
|
|
1997
2002
|
/* @__PURE__ */ jsx(Row, { label: "Size", value: filesize(asset?.size, { base: 10, round: 0 }) }),
|
|
1998
2003
|
/* @__PURE__ */ jsx(Row, { label: "MIME type", value: asset?.mimeType }),
|
|
1999
2004
|
/* @__PURE__ */ jsx(Row, { label: "Extension", value: asset?.extension?.toUpperCase() }),
|
|
@@ -2014,7 +2019,7 @@ const ButtonAssetCopy = ({ disabled, url }) => {
|
|
|
2014
2019
|
}
|
|
2015
2020
|
}
|
|
2016
2021
|
),
|
|
2017
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, {
|
|
2022
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
|
|
2018
2023
|
exif.ISO && /* @__PURE__ */ jsx(Row, { label: "ISO", value: exif.ISO }),
|
|
2019
2024
|
exif.FNumber && /* @__PURE__ */ jsx(Row, { label: "Aperture", value: `\u0192/${exif.FNumber}` }),
|
|
2020
2025
|
exif.FocalLength && /* @__PURE__ */ jsx(Row, { label: "Focal length", value: `${exif.FocalLength}mm` }),
|
|
@@ -2028,7 +2033,7 @@ const ButtonAssetCopy = ({ disabled, url }) => {
|
|
|
2028
2033
|
)
|
|
2029
2034
|
] }) })
|
|
2030
2035
|
] }),
|
|
2031
|
-
/* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsxs(Inline, {
|
|
2036
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsxs(Inline, { gap: 2, children: [
|
|
2032
2037
|
/* @__PURE__ */ jsx(
|
|
2033
2038
|
Button,
|
|
2034
2039
|
{
|
|
@@ -2045,7 +2050,7 @@ const ButtonAssetCopy = ({ disabled, url }) => {
|
|
|
2045
2050
|
] });
|
|
2046
2051
|
}, Dialog = (props) => /* @__PURE__ */ jsx(Dialog$1, { ...props, style: { position: "fixed" } }), DocumentList = ({ documents, isLoading }) => {
|
|
2047
2052
|
const schema = useSchema();
|
|
2048
|
-
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, {
|
|
2053
|
+
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, { gap: 2, children: documents?.map((doc) => /* @__PURE__ */ jsx(ReferringDocument, { doc, schemaType: schema.get(doc._type) }, doc._id)) }) });
|
|
2049
2054
|
}, ReferringDocument = (props) => {
|
|
2050
2055
|
const { doc, schemaType } = props, { onClick } = useIntentLink({
|
|
2051
2056
|
intent: "edit",
|
|
@@ -2057,7 +2062,7 @@ const ButtonAssetCopy = ({ disabled, url }) => {
|
|
|
2057
2062
|
] }) });
|
|
2058
2063
|
}, Container$1 = styled(Box)(({ theme }) => css`
|
|
2059
2064
|
text {
|
|
2060
|
-
font-family: ${theme.
|
|
2065
|
+
font-family: ${getTheme_v2(theme).font.text.family} !important;
|
|
2061
2066
|
font-size: 8px !important;
|
|
2062
2067
|
font-weight: 500 !important;
|
|
2063
2068
|
}
|
|
@@ -2101,11 +2106,11 @@ const ButtonAssetCopy = ({ disabled, url }) => {
|
|
|
2101
2106
|
})
|
|
2102
2107
|
});
|
|
2103
2108
|
}), StyledErrorOutlineIcon = styled(ErrorOutlineIcon)(({ theme }) => ({
|
|
2104
|
-
color: theme.
|
|
2109
|
+
color: getTheme_v2(theme).color.avatar.red.bg
|
|
2105
2110
|
})), FormFieldInputLabel = (props) => {
|
|
2106
2111
|
const { description, error, label, name } = props;
|
|
2107
2112
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2108
|
-
/* @__PURE__ */ jsx(Box, { marginY: 3, children: /* @__PURE__ */ jsxs(Inline, {
|
|
2113
|
+
/* @__PURE__ */ jsx(Box, { marginY: 3, children: /* @__PURE__ */ jsxs(Inline, { gap: 2, children: [
|
|
2109
2114
|
/* @__PURE__ */ jsx(Text, { as: "label", htmlFor: name, size: 1, weight: "semibold", children: label }),
|
|
2110
2115
|
error && /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(
|
|
2111
2116
|
Tooltip,
|
|
@@ -2179,30 +2184,6 @@ const ButtonAssetCopy = ({ disabled, url }) => {
|
|
|
2179
2184
|
bg2: {
|
|
2180
2185
|
dark: hues.gray[900].hex,
|
|
2181
2186
|
light: hues.gray[100].hex
|
|
2182
|
-
},
|
|
2183
|
-
inputEnabledBorder: {
|
|
2184
|
-
dark: studioTheme.color.dark.default.input.default.enabled.border,
|
|
2185
|
-
light: studioTheme.color.light.default.input.default.enabled.border
|
|
2186
|
-
},
|
|
2187
|
-
inputHoveredBorder: {
|
|
2188
|
-
dark: studioTheme.color.dark.default.input.default.hovered.border,
|
|
2189
|
-
light: studioTheme.color.light.default.input.default.hovered.border
|
|
2190
|
-
},
|
|
2191
|
-
mutedHoveredBg: {
|
|
2192
|
-
dark: studioTheme.color.dark.primary.muted.primary.hovered.bg,
|
|
2193
|
-
light: studioTheme.color.light.primary.muted.primary.hovered.bg
|
|
2194
|
-
},
|
|
2195
|
-
mutedHoveredFg: {
|
|
2196
|
-
dark: studioTheme.color.dark.primary.muted.primary.hovered.fg,
|
|
2197
|
-
light: studioTheme.color.light.primary.muted.primary.hovered.fg
|
|
2198
|
-
},
|
|
2199
|
-
mutedSelectedBg: {
|
|
2200
|
-
dark: studioTheme.color.dark.primary.muted.primary.selected.bg,
|
|
2201
|
-
light: studioTheme.color.light.primary.muted.primary.selected.bg
|
|
2202
|
-
},
|
|
2203
|
-
spotBlue: {
|
|
2204
|
-
dark: studioTheme.color.dark.primary.spot.blue,
|
|
2205
|
-
light: studioTheme.color.light.primary.spot.blue
|
|
2206
2187
|
}
|
|
2207
2188
|
};
|
|
2208
2189
|
function getSchemeColor(scheme, colorKey) {
|
|
@@ -2275,87 +2256,90 @@ const Image$1 = styled.img`
|
|
|
2275
2256
|
strokeLinejoin: "round"
|
|
2276
2257
|
})
|
|
2277
2258
|
});
|
|
2278
|
-
}),
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2259
|
+
}), useReactSelectStyles$1 = () => {
|
|
2260
|
+
const scheme = useColorSchemeValue(), { color, font, radius, space } = useTheme_v2();
|
|
2261
|
+
return {
|
|
2262
|
+
control: (styles, { isFocused }) => {
|
|
2263
|
+
let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
|
|
2264
|
+
return isFocused && (boxShadow = `inset 0 0 0 1px ${color.input.default.enabled.border},
|
|
2282
2265
|
0 0 0 1px var(--card-bg-color),
|
|
2283
2266
|
0 0 0 3px var(--card-focus-ring-color) !important`), {
|
|
2267
|
+
...styles,
|
|
2268
|
+
backgroundColor: "var(--card-bg-color)",
|
|
2269
|
+
color: "inherit",
|
|
2270
|
+
border: "none",
|
|
2271
|
+
borderRadius: radius[1],
|
|
2272
|
+
boxShadow,
|
|
2273
|
+
margin: 0,
|
|
2274
|
+
minHeight: "35px",
|
|
2275
|
+
outline: "none",
|
|
2276
|
+
padding: rem(space[1]),
|
|
2277
|
+
transition: "none",
|
|
2278
|
+
"&:hover": {
|
|
2279
|
+
boxShadow: `inset 0 0 0 1px ${color.input.default.hovered.border}`
|
|
2280
|
+
}
|
|
2281
|
+
};
|
|
2282
|
+
},
|
|
2283
|
+
indicatorsContainer: (styles, { isDisabled }) => ({
|
|
2284
2284
|
...styles,
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2285
|
+
opacity: isDisabled ? 0.25 : 1
|
|
2286
|
+
}),
|
|
2287
|
+
input: (styles) => ({
|
|
2288
|
+
...styles,
|
|
2289
|
+
color: "var(--card-fg-color)",
|
|
2290
|
+
fontFamily: font.text.family,
|
|
2291
|
+
marginLeft: rem(space[2])
|
|
2292
|
+
}),
|
|
2293
|
+
menuList: (styles) => ({
|
|
2294
|
+
...styles
|
|
2295
|
+
}),
|
|
2296
|
+
multiValue: (styles, { isDisabled }) => ({
|
|
2297
|
+
...styles,
|
|
2298
|
+
backgroundColor: color.button.ghost.primary.hovered.bg,
|
|
2299
|
+
borderRadius: radius[2],
|
|
2300
|
+
opacity: isDisabled ? 0.5 : 1
|
|
2301
|
+
}),
|
|
2302
|
+
multiValueLabel: () => ({
|
|
2303
|
+
color: color.button.ghost.primary.hovered.fg,
|
|
2304
|
+
fontSize: "inherit",
|
|
2305
|
+
padding: 0
|
|
2306
|
+
}),
|
|
2307
|
+
multiValueRemove: (styles) => ({
|
|
2308
|
+
...styles,
|
|
2309
|
+
borderTopLeftRadius: 0,
|
|
2310
|
+
borderBottomLeftRadius: 0,
|
|
2311
|
+
svg: { color: color.button.ghost.primary.hovered.fg },
|
|
2295
2312
|
"&:hover": {
|
|
2296
|
-
|
|
2313
|
+
backgroundColor: color.button.ghost.primary.selected.bg
|
|
2297
2314
|
}
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
borderTopLeftRadius: 0,
|
|
2327
|
-
borderBottomLeftRadius: 0,
|
|
2328
|
-
svg: { color: getSchemeColor(scheme, "mutedHoveredFg") },
|
|
2329
|
-
"&:hover": {
|
|
2330
|
-
backgroundColor: getSchemeColor(scheme, "mutedSelectedBg")
|
|
2331
|
-
}
|
|
2332
|
-
}),
|
|
2333
|
-
noOptionsMessage: (styles) => ({
|
|
2334
|
-
...styles,
|
|
2335
|
-
fontFamily: studioTheme.fonts.text.family,
|
|
2336
|
-
lineHeight: "1em"
|
|
2337
|
-
}),
|
|
2338
|
-
option: (styles, { isFocused }) => ({
|
|
2339
|
-
...styles,
|
|
2340
|
-
backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
|
|
2341
|
-
borderRadius: themeRadius$1[2],
|
|
2342
|
-
color: isFocused ? getSchemeColor(scheme, "bg") : "inherit",
|
|
2343
|
-
padding: `${rem(themeSpace$1[1])} ${rem(themeSpace$1[2])}`,
|
|
2344
|
-
"&:hover": {
|
|
2345
|
-
backgroundColor: getSchemeColor(scheme, "spotBlue"),
|
|
2346
|
-
color: getSchemeColor(scheme, "bg")
|
|
2347
|
-
}
|
|
2348
|
-
}),
|
|
2349
|
-
placeholder: (styles) => ({
|
|
2350
|
-
...styles,
|
|
2351
|
-
marginLeft: rem(themeSpace$1[2])
|
|
2352
|
-
}),
|
|
2353
|
-
valueContainer: (styles) => ({
|
|
2354
|
-
...styles,
|
|
2355
|
-
margin: 0,
|
|
2356
|
-
padding: 0
|
|
2357
|
-
})
|
|
2358
|
-
}), DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(Box, { paddingX: 2, children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) }) }) }), Menu$1 = (props) => /* @__PURE__ */ jsx(components.Menu, { ...props, children: /* @__PURE__ */ jsx(Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList$1 = (props) => {
|
|
2315
|
+
}),
|
|
2316
|
+
noOptionsMessage: (styles) => ({
|
|
2317
|
+
...styles,
|
|
2318
|
+
fontFamily: font.text.family,
|
|
2319
|
+
lineHeight: "1em"
|
|
2320
|
+
}),
|
|
2321
|
+
option: (styles, { isFocused }) => ({
|
|
2322
|
+
...styles,
|
|
2323
|
+
backgroundColor: isFocused ? color.avatar.blue.bg : "transparent",
|
|
2324
|
+
borderRadius: radius[2],
|
|
2325
|
+
color: isFocused ? getSchemeColor(scheme, "bg") : "inherit",
|
|
2326
|
+
padding: `${rem(space[1])} ${rem(space[2])}`,
|
|
2327
|
+
"&:hover": {
|
|
2328
|
+
backgroundColor: color.avatar.blue.bg,
|
|
2329
|
+
color: getSchemeColor(scheme, "bg")
|
|
2330
|
+
}
|
|
2331
|
+
}),
|
|
2332
|
+
placeholder: (styles) => ({
|
|
2333
|
+
...styles,
|
|
2334
|
+
marginLeft: rem(space[2])
|
|
2335
|
+
}),
|
|
2336
|
+
valueContainer: (styles) => ({
|
|
2337
|
+
...styles,
|
|
2338
|
+
margin: 0,
|
|
2339
|
+
padding: 0
|
|
2340
|
+
})
|
|
2341
|
+
};
|
|
2342
|
+
}, DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(Box, { paddingX: 2, children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) }) }) }), Menu$1 = (props) => /* @__PURE__ */ jsx(components.Menu, { ...props, children: /* @__PURE__ */ jsx(Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList$1 = (props) => {
|
|
2359
2343
|
const { children } = props, MAX_ROWS = 5, OPTION_HEIGHT = 37;
|
|
2360
2344
|
if (Array.isArray(children)) {
|
|
2361
2345
|
const height = children.length > MAX_ROWS ? OPTION_HEIGHT * MAX_ROWS : children.length * OPTION_HEIGHT;
|
|
@@ -2396,7 +2380,7 @@ const Image$1 = styled.img`
|
|
|
2396
2380
|
options,
|
|
2397
2381
|
placeholder,
|
|
2398
2382
|
value
|
|
2399
|
-
} = props,
|
|
2383
|
+
} = props, reactSelectStyles = useReactSelectStyles$1(), creating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching);
|
|
2400
2384
|
return /* @__PURE__ */ jsxs(
|
|
2401
2385
|
Box,
|
|
2402
2386
|
{
|
|
@@ -2427,7 +2411,7 @@ const Image$1 = styled.img`
|
|
|
2427
2411
|
onCreateOption: onCreateTag,
|
|
2428
2412
|
options,
|
|
2429
2413
|
placeholder: tagsFetching ? "Loading..." : placeholder,
|
|
2430
|
-
styles: reactSelectStyles
|
|
2414
|
+
styles: reactSelectStyles,
|
|
2431
2415
|
value: controllerValue
|
|
2432
2416
|
}
|
|
2433
2417
|
);
|
|
@@ -2468,7 +2452,7 @@ function Details({
|
|
|
2468
2452
|
currentAsset,
|
|
2469
2453
|
creditLine
|
|
2470
2454
|
}) {
|
|
2471
|
-
return /* @__PURE__ */ jsxs(Stack, {
|
|
2455
|
+
return /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
|
|
2472
2456
|
/* @__PURE__ */ jsx(
|
|
2473
2457
|
FormFieldInputTags,
|
|
2474
2458
|
{
|
|
@@ -2698,7 +2682,7 @@ const DialogAssetEdit = (props) => {
|
|
|
2698
2682
|
/* @__PURE__ */ jsx(Box, { flex: 1, marginTop: [5, 5, 0], padding: 4, children: /* @__PURE__ */ jsx(WithReferringDocuments, { documentStore, id: currentAsset._id, children: ({ isLoading, referringDocuments }) => {
|
|
2699
2683
|
const uniqueReferringDocuments = getUniqueDocuments(referringDocuments);
|
|
2700
2684
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2701
|
-
/* @__PURE__ */ jsxs(TabList, {
|
|
2685
|
+
/* @__PURE__ */ jsxs(TabList, { gap: 2, children: [
|
|
2702
2686
|
/* @__PURE__ */ jsx(
|
|
2703
2687
|
Tab,
|
|
2704
2688
|
{
|
|
@@ -2764,7 +2748,7 @@ const DialogAssetEdit = (props) => {
|
|
|
2764
2748
|
id: "alt-texts",
|
|
2765
2749
|
children: [
|
|
2766
2750
|
altTextsError && /* @__PURE__ */ jsx(Stack, { marginBottom: 3, children: /* @__PURE__ */ jsx(Card, { padding: [3, 3, 4], radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsx(Text, { size: 1, children: altTextsError }) }) }),
|
|
2767
|
-
/* @__PURE__ */ jsx(Stack, {
|
|
2751
|
+
/* @__PURE__ */ jsx(Stack, { gap: 2, style: { height: "65dvh", overflowY: "auto" }, children: languages.map((language) => {
|
|
2768
2752
|
const label = language.default ? `${language.title} (Default)` : language.title;
|
|
2769
2753
|
return /* @__PURE__ */ jsx(
|
|
2770
2754
|
FormFieldInputText,
|
|
@@ -2855,7 +2839,7 @@ const DialogAssetEdit = (props) => {
|
|
|
2855
2839
|
onClose: handleClose,
|
|
2856
2840
|
width: 1,
|
|
2857
2841
|
children: [
|
|
2858
|
-
/* @__PURE__ */ jsx(Box, { paddingX: 4, paddingY: 4, children: /* @__PURE__ */ jsxs(Stack, {
|
|
2842
|
+
/* @__PURE__ */ jsx(Box, { paddingX: 4, paddingY: 4, children: /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
|
|
2859
2843
|
dialog?.title && /* @__PURE__ */ jsx(Text, { size: 1, children: dialog.title }),
|
|
2860
2844
|
dialog?.description && /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsx("em", { children: dialog.description }) })
|
|
2861
2845
|
] }) }),
|
|
@@ -2883,7 +2867,7 @@ const DialogAssetEdit = (props) => {
|
|
|
2883
2867
|
}), Container = styled(Box)(
|
|
2884
2868
|
({ $scheme, theme }) => css`
|
|
2885
2869
|
background: ${getSchemeColor($scheme, "bg")};
|
|
2886
|
-
border-radius: ${rem(theme.
|
|
2870
|
+
border-radius: ${rem(getTheme_v2(theme).radius[2])};
|
|
2887
2871
|
`
|
|
2888
2872
|
), SearchFacet = (props) => {
|
|
2889
2873
|
const { children, facet } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), handleClose = () => {
|
|
@@ -3105,84 +3089,81 @@ const DialogAssetEdit = (props) => {
|
|
|
3105
3089
|
() => excludeTagSlugs.length > 0 ? tags.filter((tagItem) => !excludeTagSlugs.includes(tagItem.tag.name.current)) : tags,
|
|
3106
3090
|
[excludeTagSlugs, tags]
|
|
3107
3091
|
);
|
|
3108
|
-
}, {
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
} = studioTheme, reactSelectStyles = (scheme) => ({
|
|
3115
|
-
control: (styles, { isDisabled, isFocused }) => {
|
|
3116
|
-
let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
|
|
3117
|
-
return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
|
|
3092
|
+
}, useReactSelectStyles = () => {
|
|
3093
|
+
const scheme = useColorSchemeValue(), { color, font, radius, space } = useTheme_v2();
|
|
3094
|
+
return {
|
|
3095
|
+
control: (styles, { isDisabled, isFocused }) => {
|
|
3096
|
+
let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
|
|
3097
|
+
return isFocused && (boxShadow = `inset 0 0 0 1px ${color.input.default.enabled.border},
|
|
3118
3098
|
0 0 0 1px ${getSchemeColor(scheme, "bg2")},
|
|
3119
3099
|
0 0 0 3px var(--card-focus-ring-color) !important`), {
|
|
3100
|
+
...styles,
|
|
3101
|
+
backgroundColor: "var(--card-bg-color)",
|
|
3102
|
+
color: "inherit",
|
|
3103
|
+
border: "none",
|
|
3104
|
+
borderRadius: radius[2],
|
|
3105
|
+
boxShadow,
|
|
3106
|
+
fontSize: font.text.sizes[1].fontSize,
|
|
3107
|
+
minHeight: "25px",
|
|
3108
|
+
opacity: isDisabled ? 0.5 : "inherit",
|
|
3109
|
+
outline: "none",
|
|
3110
|
+
transition: "none",
|
|
3111
|
+
"&:hover": {
|
|
3112
|
+
boxShadow: `inset 0 0 0 1px ${color.input.default.hovered.border}`
|
|
3113
|
+
}
|
|
3114
|
+
};
|
|
3115
|
+
},
|
|
3116
|
+
input: (styles) => ({
|
|
3120
3117
|
...styles,
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3118
|
+
color: "var(--card-fg-color)",
|
|
3119
|
+
fontFamily: font.text.family,
|
|
3120
|
+
fontSize: font.text.sizes[1].fontSize,
|
|
3121
|
+
marginLeft: rem(space[2])
|
|
3122
|
+
}),
|
|
3123
|
+
menuList: (styles) => ({
|
|
3124
|
+
...styles,
|
|
3125
|
+
padding: 0
|
|
3126
|
+
}),
|
|
3127
|
+
noOptionsMessage: (styles) => ({
|
|
3128
|
+
...styles,
|
|
3129
|
+
fontFamily: font.text.family,
|
|
3130
|
+
fontSize: font.text.sizes[1].fontSize,
|
|
3131
|
+
lineHeight: "1em"
|
|
3132
|
+
}),
|
|
3133
|
+
option: (styles, { isFocused }) => ({
|
|
3134
|
+
...styles,
|
|
3135
|
+
backgroundColor: isFocused ? color.avatar.blue.bg : "transparent",
|
|
3136
|
+
borderRadius: radius[2],
|
|
3137
|
+
color: isFocused ? getSchemeColor(scheme, "bg") : "inherit",
|
|
3138
|
+
fontSize: font.text.sizes[1].fontSize,
|
|
3139
|
+
lineHeight: "1em",
|
|
3140
|
+
margin: 0,
|
|
3141
|
+
padding: rem(space[1]),
|
|
3131
3142
|
"&:hover": {
|
|
3132
|
-
|
|
3143
|
+
backgroundColor: color.avatar.blue.bg,
|
|
3144
|
+
color: getSchemeColor(scheme, "bg")
|
|
3133
3145
|
}
|
|
3134
|
-
}
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
|
|
3156
|
-
borderRadius: themeRadius[2],
|
|
3157
|
-
color: isFocused ? getSchemeColor(scheme, "bg") : "inherit",
|
|
3158
|
-
fontSize: themeTextSizes[1].fontSize,
|
|
3159
|
-
lineHeight: "1em",
|
|
3160
|
-
margin: 0,
|
|
3161
|
-
padding: rem(themeSpace[1]),
|
|
3162
|
-
"&:hover": {
|
|
3163
|
-
backgroundColor: getSchemeColor(scheme, "spotBlue"),
|
|
3164
|
-
color: getSchemeColor(scheme, "bg")
|
|
3165
|
-
}
|
|
3166
|
-
}),
|
|
3167
|
-
placeholder: (styles) => ({
|
|
3168
|
-
...styles,
|
|
3169
|
-
fontSize: themeTextSizes[1].fontSize,
|
|
3170
|
-
marginLeft: rem(themeSpace[2]),
|
|
3171
|
-
paddingLeft: 0
|
|
3172
|
-
}),
|
|
3173
|
-
singleValue: (styles) => ({
|
|
3174
|
-
...styles,
|
|
3175
|
-
alignItems: "center",
|
|
3176
|
-
display: "inline-flex",
|
|
3177
|
-
height: "100%",
|
|
3178
|
-
marginLeft: rem(themeSpace[2])
|
|
3179
|
-
}),
|
|
3180
|
-
valueContainer: (styles) => ({
|
|
3181
|
-
...styles,
|
|
3182
|
-
margin: 0,
|
|
3183
|
-
padding: 0
|
|
3184
|
-
})
|
|
3185
|
-
}), ClearIndicator = (props) => /* @__PURE__ */ jsx(components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsx(
|
|
3146
|
+
}),
|
|
3147
|
+
placeholder: (styles) => ({
|
|
3148
|
+
...styles,
|
|
3149
|
+
fontSize: font.text.sizes[1].fontSize,
|
|
3150
|
+
marginLeft: rem(space[2]),
|
|
3151
|
+
paddingLeft: 0
|
|
3152
|
+
}),
|
|
3153
|
+
singleValue: (styles) => ({
|
|
3154
|
+
...styles,
|
|
3155
|
+
alignItems: "center",
|
|
3156
|
+
display: "inline-flex",
|
|
3157
|
+
height: "100%",
|
|
3158
|
+
marginLeft: rem(space[2])
|
|
3159
|
+
}),
|
|
3160
|
+
valueContainer: (styles) => ({
|
|
3161
|
+
...styles,
|
|
3162
|
+
margin: 0,
|
|
3163
|
+
padding: 0
|
|
3164
|
+
})
|
|
3165
|
+
};
|
|
3166
|
+
}, ClearIndicator = (props) => /* @__PURE__ */ jsx(components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsx(
|
|
3186
3167
|
Box,
|
|
3187
3168
|
{
|
|
3188
3169
|
paddingRight: 1,
|
|
@@ -3219,7 +3200,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3219
3200
|
Option,
|
|
3220
3201
|
SingleValue
|
|
3221
3202
|
}, SearchFacetTags = ({ facet }) => {
|
|
3222
|
-
const
|
|
3203
|
+
const reactSelectStyles = useReactSelectStyles(), dispatch = useDispatch(), tags = useVisibleTags(), tagsFetching = useTypedSelector((state) => state.tags.fetching), allTagOptions = getTagSelectOptions(tags), popoverProps = usePortalPopoverProps(), handleChange = (option) => {
|
|
3223
3204
|
dispatch(
|
|
3224
3205
|
searchActions.facetsUpdateById({
|
|
3225
3206
|
id: facet.id,
|
|
@@ -3255,7 +3236,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3255
3236
|
fontSize: 1,
|
|
3256
3237
|
onClick: () => handleOperatorItemClick(operatorType),
|
|
3257
3238
|
padding: 2,
|
|
3258
|
-
|
|
3239
|
+
gap: 4,
|
|
3259
3240
|
style: { minWidth: "150px" },
|
|
3260
3241
|
text: operators[operatorType].label
|
|
3261
3242
|
},
|
|
@@ -3277,14 +3258,14 @@ const DialogAssetEdit = (props) => {
|
|
|
3277
3258
|
onChange: (value) => handleChange(value),
|
|
3278
3259
|
options: allTagOptions,
|
|
3279
3260
|
placeholder: tagsFetching ? "Loading..." : "Select...",
|
|
3280
|
-
styles: reactSelectStyles
|
|
3261
|
+
styles: reactSelectStyles,
|
|
3281
3262
|
value: facet?.value
|
|
3282
3263
|
}
|
|
3283
3264
|
) })
|
|
3284
3265
|
] });
|
|
3285
3266
|
}, StackContainer = styled(Flex)(({ theme }) => css`
|
|
3286
3267
|
> * {
|
|
3287
|
-
margin-bottom: ${rem(theme.
|
|
3268
|
+
margin-bottom: ${rem(getTheme_v2(theme).space[2])};
|
|
3288
3269
|
}
|
|
3289
3270
|
`), SearchFacets = (props) => {
|
|
3290
3271
|
const { layout = "inline" } = props, searchFacets = useTypedSelector((state) => state.search.facets), Items2 = searchFacets.map((facet) => {
|
|
@@ -3292,7 +3273,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3292
3273
|
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;
|
|
3293
3274
|
});
|
|
3294
3275
|
if (layout === "inline")
|
|
3295
|
-
return searchFacets.length === 0 ? null : /* @__PURE__ */ jsx(Box, { marginBottom: 2, children: /* @__PURE__ */ jsx(Inline, {
|
|
3276
|
+
return searchFacets.length === 0 ? null : /* @__PURE__ */ jsx(Box, { marginBottom: 2, children: /* @__PURE__ */ jsx(Inline, { gap: 2, children: Items2 }) });
|
|
3296
3277
|
if (layout === "stack")
|
|
3297
3278
|
return /* @__PURE__ */ jsx(StackContainer, { align: "flex-start", direction: "column", children: Items2 });
|
|
3298
3279
|
throw Error("Invalid layout");
|
|
@@ -3334,7 +3315,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3334
3315
|
fontSize: 1,
|
|
3335
3316
|
icon: AddIcon,
|
|
3336
3317
|
mode: "bleed",
|
|
3337
|
-
|
|
3318
|
+
gap: 2,
|
|
3338
3319
|
text: "Add filter",
|
|
3339
3320
|
tone: "primary"
|
|
3340
3321
|
}
|
|
@@ -3827,7 +3808,7 @@ const DialogAssetEdit = (props) => {
|
|
|
3827
3808
|
height: `${PANEL_HEIGHT}px`
|
|
3828
3809
|
},
|
|
3829
3810
|
children: [
|
|
3830
|
-
/* @__PURE__ */ jsxs(Inline, {
|
|
3811
|
+
/* @__PURE__ */ jsxs(Inline, { gap: 2, children: [
|
|
3831
3812
|
/* @__PURE__ */ jsx(Label, { size: 0, children: title }),
|
|
3832
3813
|
tagsFetching && /* @__PURE__ */ jsx(Label, { size: 0, style: { opacity: 0.3 }, children: "Loading..." })
|
|
3833
3814
|
] }),
|
|
@@ -4529,7 +4510,7 @@ const EPIC_END_TYPE = "media/epicEnd", createReduxStore = (props) => {
|
|
|
4529
4510
|
});
|
|
4530
4511
|
}), ButtonViewGroup = () => {
|
|
4531
4512
|
const dispatch = useDispatch(), view = useTypedSelector((state) => state.assets.view);
|
|
4532
|
-
return /* @__PURE__ */ jsxs(Inline, {
|
|
4513
|
+
return /* @__PURE__ */ jsxs(Inline, { gap: 0, style: { whiteSpace: "nowrap" }, children: [
|
|
4533
4514
|
/* @__PURE__ */ jsx(
|
|
4534
4515
|
Button,
|
|
4535
4516
|
{
|
|
@@ -4606,7 +4587,7 @@ const EPIC_END_TYPE = "media/epicEnd", createReduxStore = (props) => {
|
|
|
4606
4587
|
),
|
|
4607
4588
|
padding: 2,
|
|
4608
4589
|
selected,
|
|
4609
|
-
|
|
4590
|
+
gap: 4,
|
|
4610
4591
|
style: { minWidth: "200px" },
|
|
4611
4592
|
text: getOrderTitle(item.field, item.direction)
|
|
4612
4593
|
},
|
|
@@ -4750,7 +4731,7 @@ const EPIC_END_TYPE = "media/epicEnd", createReduxStore = (props) => {
|
|
|
4750
4731
|
/* @__PURE__ */ jsx(SearchFacets, {}),
|
|
4751
4732
|
/* @__PURE__ */ jsx(SearchFacetsControl, {})
|
|
4752
4733
|
] }),
|
|
4753
|
-
/* @__PURE__ */ jsx(Box, { display: ["block", "block", "none"], marginX: 2, children: /* @__PURE__ */ jsxs(Inline, {
|
|
4734
|
+
/* @__PURE__ */ jsx(Box, { display: ["block", "block", "none"], marginX: 2, children: /* @__PURE__ */ jsxs(Inline, { gap: 2, style: { whiteSpace: "nowrap" }, children: [
|
|
4754
4735
|
/* @__PURE__ */ jsx(
|
|
4755
4736
|
Button,
|
|
4756
4737
|
{
|
|
@@ -5002,7 +4983,7 @@ const EPIC_END_TYPE = "media/epicEnd", createReduxStore = (props) => {
|
|
|
5002
4983
|
user-select: none;
|
|
5003
4984
|
width: 100%;
|
|
5004
4985
|
|
|
5005
|
-
border: ${$picked ? `1px solid ${theme.
|
|
4986
|
+
border: ${$picked ? `1px solid ${getTheme_v2(theme).color.avatar.orange.bg} !important` : "1px solid inherit"};
|
|
5006
4987
|
|
|
5007
4988
|
${!$updating && css`
|
|
5008
4989
|
@media (hover: hover) and (pointer: fine) {
|
|
@@ -5024,7 +5005,7 @@ const EPIC_END_TYPE = "media/epicEnd", createReduxStore = (props) => {
|
|
|
5024
5005
|
}
|
|
5025
5006
|
`
|
|
5026
5007
|
), StyledWarningOutlineIcon = styled(WarningFilledIcon)(({ theme }) => ({
|
|
5027
|
-
color: theme.
|
|
5008
|
+
color: getTheme_v2(theme).color.avatar.red.bg
|
|
5028
5009
|
})), CardAsset$1 = (props) => {
|
|
5029
5010
|
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();
|
|
5030
5011
|
if (!asset)
|
|
@@ -5444,7 +5425,7 @@ const CardWrapper = styled(Flex)`
|
|
|
5444
5425
|
}
|
|
5445
5426
|
`
|
|
5446
5427
|
), StyledWarningIcon = styled(WarningFilledIcon)(({ theme }) => ({
|
|
5447
|
-
color: theme.
|
|
5428
|
+
color: getTheme_v2(theme).color.avatar.red.bg
|
|
5448
5429
|
})), TableRowAsset$1 = (props) => {
|
|
5449
5430
|
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(
|
|
5450
5431
|
(e) => {
|
|
@@ -5770,7 +5751,7 @@ const TableRowUpload = (props) => {
|
|
|
5770
5751
|
gridRow: mediaIndex < 3 ? "2/4" : "auto",
|
|
5771
5752
|
marginLeft: mediaIndex < 3 ? 3 : 0
|
|
5772
5753
|
},
|
|
5773
|
-
children: /* @__PURE__ */ jsxs(Stack, {
|
|
5754
|
+
children: /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
|
|
5774
5755
|
/* @__PURE__ */ jsxs(Text, { muted: !0, size: 1, textOverflow: "ellipsis", children: [
|
|
5775
5756
|
item.name,
|
|
5776
5757
|
" (",
|
|
@@ -6110,31 +6091,30 @@ const UploadDropzone = (props) => {
|
|
|
6110
6091
|
[toast]
|
|
6111
6092
|
), null;
|
|
6112
6093
|
};
|
|
6113
|
-
var mediaTag = {
|
|
6094
|
+
var mediaTag = defineType({
|
|
6114
6095
|
title: "Media Tag",
|
|
6115
6096
|
icon: TagIcon,
|
|
6116
6097
|
name: TAG_DOCUMENT_NAME,
|
|
6117
6098
|
type: "document",
|
|
6118
6099
|
fields: [
|
|
6119
|
-
{
|
|
6100
|
+
defineField({
|
|
6120
6101
|
title: "Name",
|
|
6121
6102
|
name: "name",
|
|
6122
6103
|
type: "slug"
|
|
6123
|
-
}
|
|
6104
|
+
})
|
|
6124
6105
|
],
|
|
6125
6106
|
preview: {
|
|
6126
6107
|
select: {
|
|
6127
6108
|
name: "name"
|
|
6128
6109
|
},
|
|
6129
|
-
prepare(
|
|
6130
|
-
const { name } = selection;
|
|
6110
|
+
prepare({ name }) {
|
|
6131
6111
|
return {
|
|
6132
6112
|
media: TagIcon,
|
|
6133
6113
|
title: name?.current
|
|
6134
6114
|
};
|
|
6135
6115
|
}
|
|
6136
6116
|
}
|
|
6137
|
-
};
|
|
6117
|
+
});
|
|
6138
6118
|
const getUploadedAssetId = (patches) => (Array.isArray(patches) ? patches : [patches]).find(
|
|
6139
6119
|
(patch) => patch?.type === "set" && patch.path?.length === 1 && patch.path[0] === "asset" && typeof patch.value?._ref == "string"
|
|
6140
6120
|
)?.value?._ref, withUploaderRecording = (source, { client, uploader }) => {
|