sanity-plugin-media 4.3.1 → 4.3.2
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/LICENSE +4 -4
- package/README.md +12 -12
- package/dist/index.d.mts +263 -195
- package/dist/index.d.ts +263 -195
- package/dist/index.js +83 -203
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -203
- package/dist/index.mjs.map +1 -1
- package/package.json +41 -63
- package/src/__tests__/fixtures/createEpicTestStore.ts +5 -4
- package/src/__tests__/fixtures/mockSanityClient.ts +8 -8
- package/src/__tests__/fixtures/renderWithProviders.tsx +8 -7
- package/src/__tests__/fixtures/rootState.ts +4 -4
- package/src/components/AssetGridVirtualized/index.tsx +8 -7
- package/src/components/AssetMetadata/index.tsx +6 -5
- package/src/components/AssetTableVirtualized/index.tsx +7 -6
- package/src/components/AutoTagInputWrapper/index.tsx +9 -4
- package/src/components/Browser/Browser.test.tsx +9 -8
- package/src/components/Browser/index.tsx +2 -1
- package/src/components/Browser/useBrowserInit.ts +9 -9
- package/src/components/ButtonAssetCopy/index.tsx +1 -0
- package/src/components/ButtonViewGroup/index.tsx +4 -3
- package/src/components/CardAsset/CardAsset.test.tsx +53 -52
- package/src/components/CardAsset/index.tsx +52 -49
- package/src/components/CardUpload/index.tsx +7 -6
- package/src/components/Controls/index.tsx +7 -6
- package/src/components/DebugControls/index.tsx +5 -4
- package/src/components/DialogAssetEdit/Details.tsx +3 -2
- package/src/components/DialogAssetEdit/DialogAssetEdit.test.tsx +28 -27
- package/src/components/DialogAssetEdit/index.tsx +37 -37
- package/src/components/DialogConfirm/index.tsx +2 -1
- package/src/components/DialogSearchFacets/index.tsx +3 -2
- package/src/components/DialogTagCreate/DialogTagCreate.test.tsx +16 -15
- package/src/components/DialogTagCreate/index.tsx +11 -10
- package/src/components/DialogTagEdit/DialogTagEdit.test.tsx +28 -27
- package/src/components/DialogTagEdit/index.tsx +17 -16
- package/src/components/DialogTags/index.tsx +4 -3
- package/src/components/Dialogs/index.tsx +2 -3
- package/src/components/DocumentList/index.tsx +2 -3
- package/src/components/FileAssetPreview/index.tsx +2 -2
- package/src/components/FormBuilderTool/FormBuilderTool.test.tsx +12 -11
- package/src/components/FormBuilderTool/index.tsx +2 -1
- package/src/components/FormFieldInputLabel/index.tsx +1 -2
- package/src/components/FormFieldInputTags/index.tsx +4 -3
- package/src/components/FormSubmitButton/index.tsx +1 -1
- package/src/components/Header/index.tsx +3 -3
- package/src/components/Image/index.tsx +10 -4
- package/src/components/Items/index.tsx +5 -4
- package/src/components/Notifications/index.tsx +3 -2
- package/src/components/OrderSelect/index.tsx +4 -3
- package/src/components/PickedBar/index.tsx +2 -1
- package/src/components/Progress/index.tsx +3 -3
- package/src/components/ReduxProvider/index.tsx +15 -12
- package/src/components/SearchFacet/index.tsx +3 -2
- package/src/components/SearchFacetNumber/index.tsx +8 -8
- package/src/components/SearchFacetSelect/index.tsx +7 -8
- package/src/components/SearchFacetString/index.tsx +1 -1
- package/src/components/SearchFacetTags/index.tsx +13 -12
- package/src/components/SearchFacets/index.tsx +2 -3
- package/src/components/SearchFacetsControl/index.tsx +13 -12
- package/src/components/TableHeader/index.tsx +18 -17
- package/src/components/TableHeaderItem/index.tsx +4 -4
- package/src/components/TableRowAsset/index.tsx +37 -36
- package/src/components/TableRowUpload/index.tsx +7 -6
- package/src/components/Tag/index.tsx +8 -7
- package/src/components/TagView/index.tsx +2 -2
- package/src/components/TagViewHeader/index.tsx +5 -4
- package/src/components/TagsPanel/index.tsx +3 -3
- package/src/components/TagsVirtualized/index.tsx +25 -24
- package/src/components/TextInputSearch/index.tsx +3 -2
- package/src/components/UploadDropzone/UploadDropzone.test.tsx +8 -7
- package/src/components/UploadDropzone/index.tsx +14 -13
- package/src/config/orders.ts +6 -6
- package/src/config/searchFacets.ts +56 -55
- package/src/constants.ts +15 -14
- package/src/contexts/AssetSourceDispatchContext.tsx +1 -1
- package/src/contexts/ToolOptionsContext.tsx +6 -5
- package/src/formSchema/index.test.ts +6 -5
- package/src/formSchema/index.ts +5 -5
- package/src/hooks/useBreakpointIndex.ts +6 -6
- package/src/hooks/useKeyPress.ts +2 -2
- package/src/hooks/usePortalPopoverProps.ts +1 -1
- package/src/modules/assets/actions.ts +8 -7
- package/src/modules/assets/deleteAndUpdateEpics.test.ts +18 -17
- package/src/modules/assets/fetchEpic.test.ts +12 -11
- package/src/modules/assets/index.ts +134 -133
- package/src/modules/assets/reducer.test.ts +9 -8
- package/src/modules/assets/tagsAndListenerEpics.test.ts +36 -35
- package/src/modules/debug/index.ts +3 -3
- package/src/modules/dialog/actions.ts +2 -2
- package/src/modules/dialog/epics.test.ts +29 -28
- package/src/modules/dialog/index.ts +36 -35
- package/src/modules/dialog/reducer.test.ts +31 -30
- package/src/modules/index.ts +9 -9
- package/src/modules/notifications/epics.test.ts +71 -70
- package/src/modules/notifications/index.ts +50 -49
- package/src/modules/notifications/reducer.test.ts +8 -7
- package/src/modules/search/index.test.ts +2 -1
- package/src/modules/search/index.ts +22 -22
- package/src/modules/selected/index.ts +2 -2
- package/src/modules/selectors.test.ts +4 -3
- package/src/modules/selectors.ts +5 -5
- package/src/modules/tags/epics.test.ts +16 -15
- package/src/modules/tags/index.test.ts +2 -1
- package/src/modules/tags/index.ts +82 -81
- package/src/modules/uploads/actions.ts +3 -3
- package/src/modules/uploads/epics.test.ts +13 -12
- package/src/modules/uploads/index.test.ts +8 -7
- package/src/modules/uploads/index.ts +48 -47
- package/src/operators/checkTagName.test.ts +7 -6
- package/src/operators/checkTagName.ts +6 -5
- package/src/operators/debugThrottle.ts +4 -4
- package/src/plugin.tsx +18 -18
- package/src/schemas/tag.ts +7 -7
- package/src/styled/react-select/creatable.tsx +40 -39
- package/src/styled/react-select/single.tsx +39 -38
- package/src/types/index.ts +4 -3
- package/src/utils/applyMediaTags.ts +11 -10
- package/src/utils/blocksToText.test.ts +5 -4
- package/src/utils/blocksToText.ts +2 -2
- package/src/utils/constructFilter.test.ts +15 -14
- package/src/utils/constructFilter.ts +7 -7
- package/src/utils/generatePreviewBlobUrl.test.ts +6 -5
- package/src/utils/generatePreviewBlobUrl.ts +2 -2
- package/src/utils/getAssetResolution.test.ts +3 -2
- package/src/utils/getDocumentAssetIds.test.ts +7 -6
- package/src/utils/getDocumentAssetIds.ts +2 -2
- package/src/utils/getSchemeColor.test.ts +1 -0
- package/src/utils/getSchemeColor.ts +9 -9
- package/src/utils/getTagSelectOptions.test.ts +6 -5
- package/src/utils/getTagSelectOptions.ts +1 -1
- package/src/utils/getUniqueDocuments.test.ts +4 -3
- package/src/utils/getUniqueDocuments.ts +2 -2
- package/src/utils/imageDprUrl.test.ts +4 -3
- package/src/utils/imageDprUrl.ts +1 -1
- package/src/utils/isSupportedAssetType.test.ts +1 -0
- package/src/utils/mediaField.ts +4 -3
- package/src/utils/sanitizeFormData.test.ts +14 -13
- package/src/utils/typeGuards.test.ts +2 -1
- package/src/utils/uploadSanityAsset.test.ts +5 -4
- package/src/utils/uploadSanityAsset.ts +17 -16
- package/src/utils/withMaxConcurrency.test.ts +5 -4
- package/src/utils/withMaxConcurrency.ts +4 -4
- package/src/utils/zodFormResolver.ts +17 -0
- package/v2-incompatible.js +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {AssetSourceComponentProps} from
|
|
2
|
-
import type {ComponentType} from
|
|
3
|
-
import {Control} from
|
|
4
|
-
import type {FieldDefinitionBase} from
|
|
5
|
-
import {FieldErrors} from
|
|
6
|
-
import type {FileDefinition} from
|
|
7
|
-
import {ForwardRefExoticComponent} from
|
|
8
|
-
import type {ImageDefinition} from
|
|
9
|
-
import {InputProps} from
|
|
10
|
-
import {JSX
|
|
11
|
-
import {Plugin as Plugin_2} from
|
|
12
|
-
import {RefAttributes} from
|
|
13
|
-
import type {SanityAssetDocument} from
|
|
14
|
-
import type {SanityImageAssetDocument} from
|
|
15
|
-
import {SVGProps} from
|
|
16
|
-
import {UseFormRegister} from
|
|
17
|
-
import type {WidenInitialValue} from
|
|
18
|
-
import type {WidenValidation} from
|
|
19
|
-
import * as z from
|
|
1
|
+
import { AssetSourceComponentProps } from "sanity";
|
|
2
|
+
import type { ComponentType } from "react";
|
|
3
|
+
import { Control } from "react-hook-form";
|
|
4
|
+
import type { FieldDefinitionBase } from "sanity";
|
|
5
|
+
import { FieldErrors } from "react-hook-form";
|
|
6
|
+
import type { FileDefinition } from "sanity";
|
|
7
|
+
import { ForwardRefExoticComponent } from "react";
|
|
8
|
+
import type { ImageDefinition } from "sanity";
|
|
9
|
+
import { InputProps } from "sanity";
|
|
10
|
+
import { JSX } from "react";
|
|
11
|
+
import { Plugin as Plugin_2 } from "sanity";
|
|
12
|
+
import { RefAttributes } from "react";
|
|
13
|
+
import type { SanityAssetDocument } from "@sanity/client";
|
|
14
|
+
import type { SanityImageAssetDocument } from "@sanity/client";
|
|
15
|
+
import { SVGProps } from "react";
|
|
16
|
+
import { UseFormRegister } from "react-hook-form";
|
|
17
|
+
import type { WidenInitialValue } from "sanity";
|
|
18
|
+
import type { WidenValidation } from "sanity";
|
|
19
|
+
import * as z from "zod";
|
|
20
20
|
|
|
21
|
-
declare type Asset = FileAsset | ImageAsset
|
|
21
|
+
declare type Asset = FileAsset | ImageAsset;
|
|
22
22
|
|
|
23
|
-
declare type AssetFormData = z.infer<ReturnType<typeof getAssetFormSchema
|
|
23
|
+
declare type AssetFormData = z.infer<ReturnType<typeof getAssetFormSchema>>;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Input component that automatically applies media tags when an asset is selected or uploaded.
|
|
@@ -41,95 +41,119 @@ declare type AssetFormData = z.infer<ReturnType<typeof getAssetFormSchema>>
|
|
|
41
41
|
* components: { input: (props) => <AutoTagInput {...props} mediaTags={['product']} /> }
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
export declare function AutoTagInput(props: AutoTagInputProps):
|
|
44
|
+
export declare function AutoTagInput(props: AutoTagInputProps): JSX;
|
|
45
45
|
|
|
46
46
|
export declare type AutoTagInputProps = InputProps & {
|
|
47
|
-
mediaTags?: string[]
|
|
48
|
-
}
|
|
47
|
+
mediaTags?: string[];
|
|
48
|
+
};
|
|
49
49
|
|
|
50
50
|
declare type CustomFields = {
|
|
51
|
-
altText?: LocalizedString
|
|
52
|
-
description?: LocalizedString
|
|
51
|
+
altText?: LocalizedString;
|
|
52
|
+
description?: LocalizedString;
|
|
53
53
|
opt?: {
|
|
54
54
|
media?: {
|
|
55
|
-
tags?: SanityReference[]
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
title?: LocalizedString
|
|
59
|
-
}
|
|
55
|
+
tags?: SanityReference[];
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
title?: LocalizedString;
|
|
59
|
+
};
|
|
60
60
|
|
|
61
61
|
declare type DetailsProps = {
|
|
62
|
-
formUpdating: boolean
|
|
63
|
-
handleCreateTag: (title: string) => void
|
|
64
|
-
control: Control<AssetFormData
|
|
65
|
-
errors: FieldErrors<AssetFormData
|
|
66
|
-
register: UseFormRegister<AssetFormData
|
|
67
|
-
allTagOptions: TagSelectOption[]
|
|
68
|
-
assetTagOptions: TagSelectOption[] | null
|
|
69
|
-
currentAsset: Asset
|
|
62
|
+
formUpdating: boolean;
|
|
63
|
+
handleCreateTag: (title: string) => void;
|
|
64
|
+
control: Control<AssetFormData>;
|
|
65
|
+
errors: FieldErrors<AssetFormData>;
|
|
66
|
+
register: UseFormRegister<AssetFormData>;
|
|
67
|
+
allTagOptions: TagSelectOption[];
|
|
68
|
+
assetTagOptions: TagSelectOption[] | null;
|
|
69
|
+
currentAsset: Asset;
|
|
70
70
|
creditLine?: {
|
|
71
|
-
enabled: boolean
|
|
72
|
-
excludeSources?: string | string[] | undefined
|
|
73
|
-
}
|
|
74
|
-
locales?:
|
|
75
|
-
}
|
|
71
|
+
enabled: boolean;
|
|
72
|
+
excludeSources?: string | string[] | undefined;
|
|
73
|
+
};
|
|
74
|
+
locales?: Locale[];
|
|
75
|
+
};
|
|
76
76
|
|
|
77
77
|
declare type FileAsset = SanityAssetDocument &
|
|
78
78
|
CustomFields & {
|
|
79
|
-
_type:
|
|
80
|
-
}
|
|
79
|
+
_type: "sanity.fileAsset";
|
|
80
|
+
};
|
|
81
81
|
|
|
82
|
-
declare type FileMediaFieldConfig = Omit<FileDefinition,
|
|
82
|
+
declare type FileMediaFieldConfig = Omit<FileDefinition, "options"> &
|
|
83
83
|
FieldDefinitionBase & {
|
|
84
|
-
name: string
|
|
85
|
-
mediaTags: string[]
|
|
86
|
-
options?: FileDefinition[
|
|
87
|
-
}
|
|
84
|
+
name: string;
|
|
85
|
+
mediaTags: string[];
|
|
86
|
+
options?: FileDefinition["options"];
|
|
87
|
+
};
|
|
88
88
|
|
|
89
|
-
declare type FileMediaFieldResult = Omit<FileDefinition,
|
|
89
|
+
declare type FileMediaFieldResult = Omit<FileDefinition, "options"> &
|
|
90
90
|
FieldDefinitionBase & {
|
|
91
|
-
options?: FileDefinition[
|
|
92
|
-
mediaTags: string[]
|
|
93
|
-
}
|
|
91
|
+
options?: FileDefinition["options"] & {
|
|
92
|
+
mediaTags: string[];
|
|
93
|
+
};
|
|
94
94
|
components: {
|
|
95
|
-
input: typeof AutoTagInput
|
|
96
|
-
}
|
|
95
|
+
input: typeof AutoTagInput;
|
|
96
|
+
};
|
|
97
97
|
} & WidenValidation &
|
|
98
|
-
WidenInitialValue
|
|
98
|
+
WidenInitialValue;
|
|
99
99
|
|
|
100
100
|
declare function getAssetFormSchema(
|
|
101
101
|
locales?: {
|
|
102
|
-
id: string
|
|
103
|
-
}[]
|
|
102
|
+
id: string;
|
|
103
|
+
}[],
|
|
104
104
|
): z.ZodObject<
|
|
105
105
|
{
|
|
106
106
|
altText:
|
|
107
107
|
| z.ZodOptional<z.ZodString>
|
|
108
108
|
| z.ZodObject<
|
|
109
109
|
Record<string, z.ZodTypeAny>,
|
|
110
|
-
|
|
110
|
+
"passthrough",
|
|
111
111
|
z.ZodTypeAny,
|
|
112
|
-
z.objectOutputType<
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
z.objectOutputType<
|
|
113
|
+
Record<string, z.ZodTypeAny>,
|
|
114
|
+
z.ZodTypeAny,
|
|
115
|
+
"passthrough"
|
|
116
|
+
>,
|
|
117
|
+
z.objectInputType<
|
|
118
|
+
Record<string, z.ZodTypeAny>,
|
|
119
|
+
z.ZodTypeAny,
|
|
120
|
+
"passthrough"
|
|
121
|
+
>
|
|
122
|
+
>;
|
|
115
123
|
creditLine:
|
|
116
124
|
| z.ZodOptional<z.ZodString>
|
|
117
125
|
| z.ZodObject<
|
|
118
126
|
Record<string, z.ZodTypeAny>,
|
|
119
|
-
|
|
127
|
+
"passthrough",
|
|
120
128
|
z.ZodTypeAny,
|
|
121
|
-
z.objectOutputType<
|
|
122
|
-
|
|
123
|
-
|
|
129
|
+
z.objectOutputType<
|
|
130
|
+
Record<string, z.ZodTypeAny>,
|
|
131
|
+
z.ZodTypeAny,
|
|
132
|
+
"passthrough"
|
|
133
|
+
>,
|
|
134
|
+
z.objectInputType<
|
|
135
|
+
Record<string, z.ZodTypeAny>,
|
|
136
|
+
z.ZodTypeAny,
|
|
137
|
+
"passthrough"
|
|
138
|
+
>
|
|
139
|
+
>;
|
|
124
140
|
description:
|
|
125
141
|
| z.ZodOptional<z.ZodString>
|
|
126
142
|
| z.ZodObject<
|
|
127
143
|
Record<string, z.ZodTypeAny>,
|
|
128
|
-
|
|
144
|
+
"passthrough",
|
|
129
145
|
z.ZodTypeAny,
|
|
130
|
-
z.objectOutputType<
|
|
131
|
-
|
|
132
|
-
|
|
146
|
+
z.objectOutputType<
|
|
147
|
+
Record<string, z.ZodTypeAny>,
|
|
148
|
+
z.ZodTypeAny,
|
|
149
|
+
"passthrough"
|
|
150
|
+
>,
|
|
151
|
+
z.objectInputType<
|
|
152
|
+
Record<string, z.ZodTypeAny>,
|
|
153
|
+
z.ZodTypeAny,
|
|
154
|
+
"passthrough"
|
|
155
|
+
>
|
|
156
|
+
>;
|
|
133
157
|
opt: z.ZodObject<
|
|
134
158
|
{
|
|
135
159
|
media: z.ZodObject<
|
|
@@ -138,182 +162,222 @@ declare function getAssetFormSchema(
|
|
|
138
162
|
z.ZodArray<
|
|
139
163
|
z.ZodObject<
|
|
140
164
|
{
|
|
141
|
-
label: z.ZodString
|
|
142
|
-
value: z.ZodString
|
|
165
|
+
label: z.ZodString;
|
|
166
|
+
value: z.ZodString;
|
|
143
167
|
},
|
|
144
|
-
|
|
168
|
+
"strip",
|
|
145
169
|
z.ZodTypeAny,
|
|
146
170
|
{
|
|
147
|
-
value: string
|
|
148
|
-
label: string
|
|
171
|
+
value: string;
|
|
172
|
+
label: string;
|
|
149
173
|
},
|
|
150
174
|
{
|
|
151
|
-
value: string
|
|
152
|
-
label: string
|
|
175
|
+
value: string;
|
|
176
|
+
label: string;
|
|
153
177
|
}
|
|
154
178
|
>,
|
|
155
|
-
|
|
179
|
+
"many"
|
|
156
180
|
>
|
|
157
|
-
|
|
181
|
+
>;
|
|
158
182
|
},
|
|
159
|
-
|
|
183
|
+
"strip",
|
|
160
184
|
z.ZodTypeAny,
|
|
161
185
|
{
|
|
162
186
|
tags:
|
|
163
187
|
| {
|
|
164
|
-
value: string
|
|
165
|
-
label: string
|
|
188
|
+
value: string;
|
|
189
|
+
label: string;
|
|
166
190
|
}[]
|
|
167
|
-
| null
|
|
191
|
+
| null;
|
|
168
192
|
},
|
|
169
193
|
{
|
|
170
194
|
tags:
|
|
171
195
|
| {
|
|
172
|
-
value: string
|
|
173
|
-
label: string
|
|
196
|
+
value: string;
|
|
197
|
+
label: string;
|
|
174
198
|
}[]
|
|
175
|
-
| null
|
|
199
|
+
| null;
|
|
176
200
|
}
|
|
177
|
-
|
|
201
|
+
>;
|
|
178
202
|
},
|
|
179
|
-
|
|
203
|
+
"strip",
|
|
180
204
|
z.ZodTypeAny,
|
|
181
205
|
{
|
|
182
206
|
media: {
|
|
183
207
|
tags:
|
|
184
208
|
| {
|
|
185
|
-
value: string
|
|
186
|
-
label: string
|
|
209
|
+
value: string;
|
|
210
|
+
label: string;
|
|
187
211
|
}[]
|
|
188
|
-
| null
|
|
189
|
-
}
|
|
212
|
+
| null;
|
|
213
|
+
};
|
|
190
214
|
},
|
|
191
215
|
{
|
|
192
216
|
media: {
|
|
193
217
|
tags:
|
|
194
218
|
| {
|
|
195
|
-
value: string
|
|
196
|
-
label: string
|
|
219
|
+
value: string;
|
|
220
|
+
label: string;
|
|
197
221
|
}[]
|
|
198
|
-
| null
|
|
199
|
-
}
|
|
222
|
+
| null;
|
|
223
|
+
};
|
|
200
224
|
}
|
|
201
|
-
|
|
202
|
-
originalFilename: z.ZodString
|
|
225
|
+
>;
|
|
226
|
+
originalFilename: z.ZodString;
|
|
203
227
|
title:
|
|
204
228
|
| z.ZodOptional<z.ZodString>
|
|
205
229
|
| z.ZodObject<
|
|
206
230
|
Record<string, z.ZodTypeAny>,
|
|
207
|
-
|
|
231
|
+
"passthrough",
|
|
208
232
|
z.ZodTypeAny,
|
|
209
|
-
z.objectOutputType<
|
|
210
|
-
|
|
211
|
-
|
|
233
|
+
z.objectOutputType<
|
|
234
|
+
Record<string, z.ZodTypeAny>,
|
|
235
|
+
z.ZodTypeAny,
|
|
236
|
+
"passthrough"
|
|
237
|
+
>,
|
|
238
|
+
z.objectInputType<
|
|
239
|
+
Record<string, z.ZodTypeAny>,
|
|
240
|
+
z.ZodTypeAny,
|
|
241
|
+
"passthrough"
|
|
242
|
+
>
|
|
243
|
+
>;
|
|
212
244
|
},
|
|
213
|
-
|
|
245
|
+
"strip",
|
|
214
246
|
z.ZodTypeAny,
|
|
215
247
|
{
|
|
248
|
+
originalFilename: string;
|
|
216
249
|
opt: {
|
|
217
250
|
media: {
|
|
218
251
|
tags:
|
|
219
252
|
| {
|
|
220
|
-
value: string
|
|
221
|
-
label: string
|
|
253
|
+
value: string;
|
|
254
|
+
label: string;
|
|
222
255
|
}[]
|
|
223
|
-
| null
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
originalFilename: string
|
|
256
|
+
| null;
|
|
257
|
+
};
|
|
258
|
+
};
|
|
227
259
|
altText?:
|
|
228
260
|
| string
|
|
229
|
-
| z.objectOutputType<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
| undefined
|
|
261
|
+
| z.objectOutputType<
|
|
262
|
+
Record<string, z.ZodTypeAny>,
|
|
263
|
+
z.ZodTypeAny,
|
|
264
|
+
"passthrough"
|
|
265
|
+
>
|
|
266
|
+
| undefined;
|
|
235
267
|
description?:
|
|
236
268
|
| string
|
|
237
|
-
| z.objectOutputType<
|
|
238
|
-
|
|
269
|
+
| z.objectOutputType<
|
|
270
|
+
Record<string, z.ZodTypeAny>,
|
|
271
|
+
z.ZodTypeAny,
|
|
272
|
+
"passthrough"
|
|
273
|
+
>
|
|
274
|
+
| undefined;
|
|
239
275
|
title?:
|
|
240
276
|
| string
|
|
241
|
-
| z.objectOutputType<
|
|
242
|
-
|
|
277
|
+
| z.objectOutputType<
|
|
278
|
+
Record<string, z.ZodTypeAny>,
|
|
279
|
+
z.ZodTypeAny,
|
|
280
|
+
"passthrough"
|
|
281
|
+
>
|
|
282
|
+
| undefined;
|
|
283
|
+
creditLine?:
|
|
284
|
+
| string
|
|
285
|
+
| z.objectOutputType<
|
|
286
|
+
Record<string, z.ZodTypeAny>,
|
|
287
|
+
z.ZodTypeAny,
|
|
288
|
+
"passthrough"
|
|
289
|
+
>
|
|
290
|
+
| undefined;
|
|
243
291
|
},
|
|
244
292
|
{
|
|
293
|
+
originalFilename: string;
|
|
245
294
|
opt: {
|
|
246
295
|
media: {
|
|
247
296
|
tags:
|
|
248
297
|
| {
|
|
249
|
-
value: string
|
|
250
|
-
label: string
|
|
298
|
+
value: string;
|
|
299
|
+
label: string;
|
|
251
300
|
}[]
|
|
252
|
-
| null
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
originalFilename: string
|
|
301
|
+
| null;
|
|
302
|
+
};
|
|
303
|
+
};
|
|
256
304
|
altText?:
|
|
257
305
|
| string
|
|
258
|
-
| z.objectInputType<
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
| undefined
|
|
306
|
+
| z.objectInputType<
|
|
307
|
+
Record<string, z.ZodTypeAny>,
|
|
308
|
+
z.ZodTypeAny,
|
|
309
|
+
"passthrough"
|
|
310
|
+
>
|
|
311
|
+
| undefined;
|
|
264
312
|
description?:
|
|
265
313
|
| string
|
|
266
|
-
| z.objectInputType<
|
|
267
|
-
|
|
314
|
+
| z.objectInputType<
|
|
315
|
+
Record<string, z.ZodTypeAny>,
|
|
316
|
+
z.ZodTypeAny,
|
|
317
|
+
"passthrough"
|
|
318
|
+
>
|
|
319
|
+
| undefined;
|
|
268
320
|
title?:
|
|
269
321
|
| string
|
|
270
|
-
| z.objectInputType<
|
|
271
|
-
|
|
322
|
+
| z.objectInputType<
|
|
323
|
+
Record<string, z.ZodTypeAny>,
|
|
324
|
+
z.ZodTypeAny,
|
|
325
|
+
"passthrough"
|
|
326
|
+
>
|
|
327
|
+
| undefined;
|
|
328
|
+
creditLine?:
|
|
329
|
+
| string
|
|
330
|
+
| z.objectInputType<
|
|
331
|
+
Record<string, z.ZodTypeAny>,
|
|
332
|
+
z.ZodTypeAny,
|
|
333
|
+
"passthrough"
|
|
334
|
+
>
|
|
335
|
+
| undefined;
|
|
272
336
|
}
|
|
273
|
-
|
|
337
|
+
>;
|
|
274
338
|
|
|
275
339
|
declare type ImageAsset = SanityImageAssetDocument &
|
|
276
340
|
CustomFields & {
|
|
277
|
-
_type:
|
|
278
|
-
creditLine?: LocalizedString
|
|
279
|
-
}
|
|
341
|
+
_type: "sanity.imageAsset";
|
|
342
|
+
creditLine?: LocalizedString;
|
|
343
|
+
};
|
|
280
344
|
|
|
281
|
-
declare type ImageMediaFieldConfig = Omit<ImageDefinition,
|
|
345
|
+
declare type ImageMediaFieldConfig = Omit<ImageDefinition, "options"> &
|
|
282
346
|
FieldDefinitionBase & {
|
|
283
|
-
name: string
|
|
284
|
-
mediaTags: string[]
|
|
285
|
-
options?: ImageDefinition[
|
|
286
|
-
}
|
|
347
|
+
name: string;
|
|
348
|
+
mediaTags: string[];
|
|
349
|
+
options?: ImageDefinition["options"];
|
|
350
|
+
};
|
|
287
351
|
|
|
288
|
-
declare type ImageMediaFieldResult = Omit<ImageDefinition,
|
|
352
|
+
declare type ImageMediaFieldResult = Omit<ImageDefinition, "options"> &
|
|
289
353
|
FieldDefinitionBase & {
|
|
290
|
-
options?: ImageDefinition[
|
|
291
|
-
mediaTags: string[]
|
|
292
|
-
}
|
|
354
|
+
options?: ImageDefinition["options"] & {
|
|
355
|
+
mediaTags: string[];
|
|
356
|
+
};
|
|
293
357
|
components: {
|
|
294
|
-
input: typeof AutoTagInput
|
|
295
|
-
}
|
|
358
|
+
input: typeof AutoTagInput;
|
|
359
|
+
};
|
|
296
360
|
} & WidenValidation &
|
|
297
|
-
WidenInitialValue
|
|
361
|
+
WidenInitialValue;
|
|
298
362
|
|
|
299
|
-
declare type
|
|
300
|
-
title: string
|
|
301
|
-
id: string
|
|
302
|
-
[key: string]: unknown
|
|
303
|
-
}
|
|
363
|
+
declare type Locale = {
|
|
364
|
+
title: string;
|
|
365
|
+
id: string;
|
|
366
|
+
[key: string]: unknown;
|
|
367
|
+
};
|
|
304
368
|
|
|
305
|
-
declare type LocalizedString = string | Record<string, string
|
|
369
|
+
declare type LocalizedString = string | Record<string, string>;
|
|
306
370
|
|
|
307
|
-
export declare const media: Plugin_2<void | MediaToolOptions
|
|
371
|
+
export declare const media: Plugin_2<void | MediaToolOptions>;
|
|
308
372
|
|
|
309
373
|
export declare const mediaAssetSource: {
|
|
310
|
-
component: (props: AssetSourceComponentProps) =>
|
|
374
|
+
component: (props: AssetSourceComponentProps) => JSX;
|
|
311
375
|
icon: ForwardRefExoticComponent<
|
|
312
|
-
Omit<SVGProps<SVGSVGElement>,
|
|
313
|
-
|
|
314
|
-
name: string
|
|
315
|
-
title: string
|
|
316
|
-
}
|
|
376
|
+
Omit<SVGProps<SVGSVGElement>, "ref"> & RefAttributes<SVGSVGElement>
|
|
377
|
+
>;
|
|
378
|
+
name: string;
|
|
379
|
+
title: string;
|
|
380
|
+
};
|
|
317
381
|
|
|
318
382
|
/**
|
|
319
383
|
* Defines an image or file field with automatic media tag application when an asset is selected.
|
|
@@ -336,59 +400,63 @@ export declare const mediaAssetSource: {
|
|
|
336
400
|
* mediaField({ name: 'drawing', type: 'file', mediaTags: ['model-drawing'] })
|
|
337
401
|
* ```
|
|
338
402
|
*/
|
|
339
|
-
export declare function mediaField(
|
|
403
|
+
export declare function mediaField(
|
|
404
|
+
config: ImageMediaFieldConfig,
|
|
405
|
+
): ImageMediaFieldResult;
|
|
340
406
|
|
|
341
|
-
export declare function mediaField(
|
|
407
|
+
export declare function mediaField(
|
|
408
|
+
config: FileMediaFieldConfig,
|
|
409
|
+
): FileMediaFieldResult;
|
|
342
410
|
|
|
343
411
|
export declare type MediaTagsOptions = {
|
|
344
|
-
mediaTags?: string[]
|
|
345
|
-
}
|
|
412
|
+
mediaTags?: string[];
|
|
413
|
+
};
|
|
346
414
|
|
|
347
415
|
export declare type MediaToolOptions = {
|
|
348
|
-
maximumUploadSize?: number
|
|
349
|
-
createTagsOnUpload?: boolean
|
|
416
|
+
maximumUploadSize?: number;
|
|
417
|
+
createTagsOnUpload?: boolean;
|
|
350
418
|
components?: {
|
|
351
419
|
details?: ComponentType<
|
|
352
420
|
DetailsProps & {
|
|
353
|
-
renderDefaultDetails: (props: DetailsProps) =>
|
|
421
|
+
renderDefaultDetails: (props: DetailsProps) => JSX.Element;
|
|
354
422
|
}
|
|
355
|
-
|
|
356
|
-
}
|
|
423
|
+
>;
|
|
424
|
+
};
|
|
357
425
|
creditLine?: {
|
|
358
|
-
enabled: boolean
|
|
359
|
-
excludeSources?: string | string[]
|
|
360
|
-
}
|
|
361
|
-
directUploads?: boolean
|
|
426
|
+
enabled: boolean;
|
|
427
|
+
excludeSources?: string | string[];
|
|
428
|
+
};
|
|
429
|
+
directUploads?: boolean;
|
|
362
430
|
/**
|
|
363
431
|
* Optional locales following Sanity recommended scheme: [{ id, title }]
|
|
364
432
|
* https://www.sanity.io/docs/studio/localization#k4da239411955
|
|
365
433
|
*/
|
|
366
|
-
locales?:
|
|
367
|
-
}
|
|
434
|
+
locales?: Locale[];
|
|
435
|
+
};
|
|
368
436
|
|
|
369
437
|
declare type SanityReference = {
|
|
370
|
-
_ref: string
|
|
371
|
-
_type:
|
|
372
|
-
_weak?: boolean
|
|
373
|
-
}
|
|
438
|
+
_ref: string;
|
|
439
|
+
_type: "reference";
|
|
440
|
+
_weak?: boolean;
|
|
441
|
+
};
|
|
374
442
|
|
|
375
443
|
declare const tagOptionSchema: z.ZodObject<
|
|
376
444
|
{
|
|
377
|
-
label: z.ZodString
|
|
378
|
-
value: z.ZodString
|
|
445
|
+
label: z.ZodString;
|
|
446
|
+
value: z.ZodString;
|
|
379
447
|
},
|
|
380
|
-
|
|
448
|
+
"strip",
|
|
381
449
|
z.ZodTypeAny,
|
|
382
450
|
{
|
|
383
|
-
value: string
|
|
384
|
-
label: string
|
|
451
|
+
value: string;
|
|
452
|
+
label: string;
|
|
385
453
|
},
|
|
386
454
|
{
|
|
387
|
-
value: string
|
|
388
|
-
label: string
|
|
455
|
+
value: string;
|
|
456
|
+
label: string;
|
|
389
457
|
}
|
|
390
|
-
|
|
458
|
+
>;
|
|
391
459
|
|
|
392
|
-
declare type TagSelectOption = z.infer<typeof tagOptionSchema
|
|
460
|
+
declare type TagSelectOption = z.infer<typeof tagOptionSchema>;
|
|
393
461
|
|
|
394
|
-
export {}
|
|
462
|
+
export {};
|