sanity-plugin-media 4.3.5 → 4.3.6

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