sanity-plugin-media 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,11 +1,20 @@
1
- import type {AssetSource} from 'sanity'
1
+ import {AssetSourceComponentProps} from 'sanity'
2
+ import {JSX as JSX_2} from 'react/jsx-runtime'
2
3
  import {Plugin as Plugin_2} from 'sanity'
4
+ import {default as React_2} from 'react'
3
5
 
4
6
  export declare const media: Plugin_2<void | MediaToolOptions>
5
7
 
6
- export declare const mediaAssetSource: AssetSource
8
+ export declare const mediaAssetSource: {
9
+ component: (props: AssetSourceComponentProps) => JSX_2.Element
10
+ icon: React_2.ForwardRefExoticComponent<
11
+ Omit<React_2.SVGProps<SVGSVGElement>, 'ref'> & React_2.RefAttributes<SVGSVGElement>
12
+ >
13
+ name: string
14
+ title: string
15
+ }
7
16
 
8
- declare type MediaToolOptions = {
17
+ export declare type MediaToolOptions = {
9
18
  maximumUploadSize?: number
10
19
  }
11
20
 
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
1
2
  import { useClient, useColorScheme, useSchema, Preview, useDocumentStore, WithReferringDocuments, useFormValue, definePlugin } from 'sanity';
2
3
  import { forwardRef, createElement, useRef, useCallback, useEffect, createContext, useContext, useState, memo, Component, useMemo } from 'react';
3
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { Inline, Button, usePortal, MenuButton, Menu as Menu$2, MenuItem, MenuDivider, Box, studioTheme, rem, Flex, Label, Text, TextInput, Card, MenuGroup, useMediaIndex, Tooltip, Switch, Popover, Stack, Dialog as Dialog$1, TextArea, TabList, Tab, TabPanel, Container as Container$2, Spinner, Checkbox, Grid, useToast, ThemeProvider, ToastProvider, PortalProvider, useLayer, Portal } from '@sanity/ui';
5
5
  import isHotkey from 'is-hotkey';
6
6
  import groq from 'groq';
@@ -11731,20 +11731,12 @@ const useRootPortalElement = () => {
11731
11731
  }, [container]);
11732
11732
  return container;
11733
11733
  };
11734
- const Tool = _ref74 => {
11735
- let {
11736
- tool: {
11737
- options
11738
- }
11739
- } = _ref74;
11740
- return /* @__PURE__ */jsx(ToolOptionsProvider, {
11741
- options,
11742
- children: /* @__PURE__ */jsx(Flex, {
11743
- direction: "column",
11744
- height: "fill",
11745
- flex: 1,
11746
- children: /* @__PURE__ */jsx(Browser, {})
11747
- })
11734
+ const Tool = () => {
11735
+ return /* @__PURE__ */jsx(Flex, {
11736
+ direction: "column",
11737
+ height: "fill",
11738
+ flex: 1,
11739
+ children: /* @__PURE__ */jsx(Browser, {})
11748
11740
  });
11749
11741
  };
11750
11742
  var mediaTag = {
@@ -11781,8 +11773,20 @@ const mediaAssetSource = {
11781
11773
  ...plugin,
11782
11774
  component: FormBuilderTool
11783
11775
  };
11776
+ const tool = {
11777
+ ...plugin,
11778
+ component: Tool
11779
+ };
11784
11780
  const media = definePlugin(options => ({
11785
11781
  name: "media",
11782
+ studio: {
11783
+ components: {
11784
+ layout: props => /* @__PURE__ */jsx(ToolOptionsProvider, {
11785
+ options,
11786
+ children: props.renderDefault(props)
11787
+ })
11788
+ }
11789
+ },
11786
11790
  form: {
11787
11791
  file: {
11788
11792
  assetSources: prev => {
@@ -11799,11 +11803,7 @@ const media = definePlugin(options => ({
11799
11803
  types: [mediaTag]
11800
11804
  },
11801
11805
  tools: prev => {
11802
- return [...prev, {
11803
- ...plugin,
11804
- options,
11805
- component: Tool
11806
- }];
11806
+ return [...prev, tool];
11807
11807
  }
11808
11808
  }));
11809
11809
  export { media, mediaAssetSource };