Skip to content

Commit

Permalink
chore: remove remaining react imports
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge committed Feb 12, 2024
1 parent 5eb8755 commit ff4c3bb
Show file tree
Hide file tree
Showing 147 changed files with 126 additions and 168 deletions.
2 changes: 1 addition & 1 deletion dev/test-studio/components/studioComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Box, Card, Flex, Stack, Text} from '@sanity/ui'
import React, {createContext, useContext} from 'react'
import {createContext, useContext} from 'react'
import {
definePlugin,
type LayoutProps,
Expand Down
2 changes: 1 addition & 1 deletion dev/test-studio/plugins/presence/Presence3D.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Physics, useCylinder, useSphere} from '@react-three/cannon'
import {Effects as EffectComposer, Environment, Sky, useTexture} from '@react-three/drei'
import {Canvas, extend, useFrame, useThree} from '@react-three/fiber'
import {Box, Card, Text} from '@sanity/ui'
import React, {memo, useState} from 'react'
import {memo, useState} from 'react'
import {useGlobalPresence, useUserColor, useWorkspace} from 'sanity'
import styled from 'styled-components'
import * as THREE from 'three'
Expand Down
2 changes: 1 addition & 1 deletion dev/test-studio/preview/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {PortableText} from '@portabletext/react'
import {createClient} from '@sanity/client'
import {createQueryStore} from '@sanity/react-loader'
import {enableVisualEditing} from '@sanity/visual-editing'
import React, {Suspense, useEffect} from 'react'
import {Suspense, useEffect} from 'react'
import {createRoot} from 'react-dom/client'

const client = createClient({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {range} from 'lodash'
import React, {type ForwardedRef, forwardRef, useCallback} from 'react'
import {type ForwardedRef, forwardRef, useCallback} from 'react'
import {FieldPresence, type ObjectInputProps, PresenceScope, set, setIfMissing} from 'sanity'

export const CustomInputWithDefaultPresence = forwardRef(function CustomInputWithDefaultPresence(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Card} from '@sanity/ui'
import React, {type ReactNode} from 'react'
import {type ReactNode} from 'react'
import {
ArrayOfObjectsInput,
type ArrayOfObjectsInputProps,
Expand Down
1 change: 0 additions & 1 deletion dev/test-studio/schema/debug/scrollBug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
TrendUpwardIcon,
} from '@sanity/icons'
import {Stack, Text} from '@sanity/ui'
import React from 'react'
import {defineArrayMember, defineField, defineType, type PreviewProps} from 'sanity'

export const articleImage = defineType({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Skeleton, Stack, TextSkeleton} from '@sanity/ui'
import React, {type ComponentProps, lazy, memo, Suspense} from 'react'
import {type ComponentProps, lazy, memo, Suspense} from 'react'

const TorusKnotPreview = lazy(() => import('./TorusKnotPreview'))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {hues} from '@sanity/color'
import {Box, Button, Flex, Grid, Heading, Inline, Stack, Text} from '@sanity/ui'
import React, {useCallback} from 'react'
import {useCallback} from 'react'
import {
type ArrayInputFunctionsProps,
ArrayOfPrimitivesFunctions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {htmlToBlocks} from '@sanity/block-tools'
import {type OnPasteFn, type PortableTextBlock} from '@sanity/portable-text-editor'
import React, {useCallback, useMemo} from 'react'
import {useCallback, useMemo} from 'react'
import {PortableTextInput, type PortableTextInputProps, type PortableTextMarker} from 'sanity'

import {renderBlockActions} from './blockActions'
Expand Down
1 change: 0 additions & 1 deletion dev/test-studio/workshop/WorkshopTool.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Workshop} from '@sanity/ui-workshop'
import React from 'react'
import {type Tool, useColorScheme, useWorkspace} from 'sanity'

import {config} from './config'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable i18next/no-literal-string */
import {type PortableTextBlock} from '@sanity/types'
import {Box, Card, Heading, Inline, Stack, studioTheme, Text, ThemeProvider} from '@sanity/ui'
import React, {useCallback, useMemo, useState} from 'react'
import {useCallback, useMemo, useState} from 'react'
import {Subject} from 'rxjs'

import {type EditorSelection, type Patch} from '../../src'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable i18next/no-literal-string */
import {type PortableTextBlock} from '@sanity/types'
import {Box, Card, Code, Text} from '@sanity/ui'
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
import {type Subject} from 'rxjs'
import styled from 'styled-components'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable i18next/no-literal-string */
import {type PortableTextBlock} from '@sanity/types'
import {Box, Card, Code, Heading} from '@sanity/ui'
import React from 'react'

type Props = {value: PortableTextBlock[] | undefined; revId: string}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import {createRoot} from 'react-dom/client'

import {App} from './app'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
type PortableTextObject,
type SpanSchemaType,
} from '@sanity/types'
import React, {Component, type PropsWithChildren} from 'react'
import {Component, type PropsWithChildren} from 'react'
import {Subject} from 'rxjs'

import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import {type PortableTextBlock} from '@sanity/types'
import {render, waitFor} from '@testing-library/react'
import React, {createRef, type RefObject} from 'react'
import {createRef, type RefObject} from 'react'

import {type EditorSelection} from '../..'
import {PortableTextEditor} from '../PortableTextEditor'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Schema} from '@sanity/schema'
import {defineArrayMember, defineField} from '@sanity/types'
import React, {type ForwardedRef, forwardRef, useCallback, useEffect} from 'react'
import {type ForwardedRef, forwardRef, useCallback, useEffect} from 'react'

import {
PortableTextEditable,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {useTheme} from '@sanity/ui'
import CodeMirror, {type ReactCodeMirrorProps} from '@uiw/react-codemirror'
import React from 'react'

import {codemirrorExtensions} from './extensions'
import {useCodemirrorTheme} from './useCodemirrorTheme'
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/vision/src/components/ParamsEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {debounce} from 'lodash'
import React, {useCallback, useEffect, useMemo, useState} from 'react'
import {useCallback, useEffect, useMemo, useState} from 'react'
import {type TFunction, useTranslation} from 'sanity'

import {VisionCodeMirror} from '../codemirror/VisionCodeMirror'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {type CurrentUser, type PortableTextBlock} from '@sanity/types'
import {noop} from 'lodash'
import React, {useState} from 'react'
import {useState} from 'react'

import {type MentionOptionsHookValue} from '../../../src/structure/comments'
import {CommentInput} from '../../../src/structure/comments/src/components/pte/comment-input/CommentInput'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import {expect, test} from '@playwright/experimental-ct-react'
import {type Page} from '@playwright/test'
import {type Path, type SanityDocument} from '@sanity/types'
import React from 'react'

import FocusTrackingStory from './FocusTrackingStory'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable i18next/no-literal-string */
import {defineArrayMember, defineField, defineType} from '@sanity/types'
import {Box, Text} from '@sanity/ui'
import React from 'react'
import {type PreviewProps} from 'sanity'

import {TestForm} from '../../utils/TestForm'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable max-nested-callbacks */
import {expect, test} from '@playwright/experimental-ct-react'
import {type Path, type SanityDocument} from '@sanity/types'
import React from 'react'

import {testHelpers} from '../../../../utils/testHelpers'
import CopyPasteStory from './CopyPasteStory'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {type Path} from '@sanity/types'
import React, {type ReactNode, useMemo, useState} from 'react'
import {type ReactNode, useMemo, useState} from 'react'

import {ScrollContainer} from '../../components/scroll'
import {ConnectorContext} from '../ConnectorContext'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {type Path} from '@sanity/types'
import {sortBy} from 'lodash'
import React, {useCallback, useMemo, useState} from 'react'
import {useCallback, useMemo, useState} from 'react'

import {type Reported} from '../../components/react-track-elements'
import {ScrollMonitor} from '../../components/scroll'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Flex} from '@sanity/ui'
import React, {
import {
Children,
cloneElement,
type ForwardedRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {ChevronRightIcon} from '@sanity/icons'
import {Breadcrumbs, Text} from '@sanity/ui'
import React from 'react'

import {type ChangeTitlePath, type FieldChangeNode} from '../../types'
import {ChangeTitleSegment} from './ChangeTitleSegment'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {type SanityDocument} from '@sanity/client'
import {RevertIcon} from '@sanity/icons'
import {type ObjectSchemaType} from '@sanity/types'
import {Box, Card, Flex, Stack, Text, useClickOutside} from '@sanity/ui'
import React, {type ReactElement, useCallback, useContext, useMemo, useState} from 'react'
import {type ReactElement, useCallback, useContext, useMemo, useState} from 'react'

import {Button, Popover} from '../../../../ui-components'
import {useDocumentOperation} from '../../../hooks'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {type Path} from '@sanity/types'
import {Card, rem} from '@sanity/ui'
import React, {type ElementType, forwardRef, type HTMLProps, type ReactNode, useMemo} from 'react'
import {type ElementType, forwardRef, type HTMLProps, type ReactNode, useMemo} from 'react'
import styled from 'styled-components'

import {type Annotation, type Diff} from '../../types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ErrorOutlineIcon} from '@sanity/icons'
import {Box, Card, Flex, Text} from '@sanity/ui'
import React, {Component, type ReactNode} from 'react'
import {Component, type ReactNode} from 'react'

import {isDev} from '../../../environment'
import {type TFunction} from '../../../i18n'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {type ObjectSchemaType} from '@sanity/types'
import {Box, Flex, Stack, Text, useClickOutside} from '@sanity/ui'
import React, {Fragment, type HTMLAttributes, useCallback, useMemo, useState} from 'react'
import {Fragment, type HTMLAttributes, useCallback, useMemo, useState} from 'react'

import {Button, Popover} from '../../../../ui-components'
import {useDocumentOperation} from '../../../hooks'
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/src/core/field/diff/components/FromTo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Flex, Grid, rem, useTheme} from '@sanity/ui'
import React, {forwardRef, type HTMLProps, type ReactNode, useMemo} from 'react'
import {forwardRef, type HTMLProps, type ReactNode, useMemo} from 'react'

import {FromToArrow} from './FromToArrow'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Box, Flex, Stack, Text, useClickOutside} from '@sanity/ui'
import React, {
import {
type HTMLAttributes,
type ReactElement,
useCallback,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {hues} from '@sanity/color'
import {ImageIcon} from '@sanity/icons'
import imageUrlBuilder from '@sanity/image-url'
import {Box, Card, Flex, Text} from '@sanity/ui'
import React, {type ReactElement, type SyntheticEvent, useMemo, useState} from 'react'
import {type ReactElement, type SyntheticEvent, useMemo, useState} from 'react'
import styled from 'styled-components'

import {useClient} from '../../../../hooks'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Card, Code, Grid, Stack, Text, TextArea} from '@sanity/ui'
import React, {type ForwardedRef, forwardRef, useCallback, useMemo} from 'react'
import {type ForwardedRef, forwardRef, useCallback, useMemo} from 'react'
import styled from 'styled-components'

import {Button} from '../../../../ui-components'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This is transitional in order to track usage of the ActivateOnFocusPart part from within the form-builder package
import {Text} from '@sanity/ui'
import React, {type KeyboardEvent, type ReactNode, useCallback, useMemo, useState} from 'react'
import {type KeyboardEvent, type ReactNode, useCallback, useMemo, useState} from 'react'

import {useTranslation} from '../../../i18n'
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/src/core/form/components/EditPortal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Box, type ResponsiveWidthProps} from '@sanity/ui'
import React, {type DragEvent, type ReactElement, type ReactNode, useRef, useState} from 'react'
import {type DragEvent, type ReactElement, type ReactNode, useRef, useState} from 'react'

import {Dialog} from '../../../ui-components'
import {PopoverDialog} from '../../components'
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/src/core/form/components/FormInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {isIndexSegment, isKeySegment, type Path} from '@sanity/types'
import {isEqual, startsWith, trimLeft} from '@sanity/util/paths'
import React, {memo, type ReactNode, useCallback, useMemo} from 'react'
import {memo, type ReactNode, useCallback, useMemo} from 'react'

import {pathToString} from '../../field'
import {Translate, useTranslation} from '../../i18n'
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/src/core/form/contexts/FormValue.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {type Path} from '@sanity/types'
import {pathFor} from '@sanity/util/paths'
import React, {createContext, type ReactNode, useContext, useMemo} from 'react'
import {createContext, type ReactNode, useContext, useMemo} from 'react'

import {getValueAtPath} from '../../field'
import {type FormDocumentValue} from '../types'
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/src/core/form/contexts/GetFormValue.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {type Path} from '@sanity/types'
import React, {createContext, type ReactNode, useCallback, useContext, useRef} from 'react'
import {createContext, type ReactNode, useCallback, useContext, useRef} from 'react'

import {getValueAtPath} from '../../field'
import {type FormDocumentValue} from '../types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {type Path} from '@sanity/types'
import React, {type PropsWithChildren, useCallback, useMemo} from 'react'
import {type PropsWithChildren, useCallback, useMemo} from 'react'

import {type DocumentFieldActionNode} from '../../../config'
import {pathToString} from '../../../field'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {ResetIcon as ClearIcon, SyncIcon as ReplaceIcon} from '@sanity/icons'
import {type CrossDatasetReferenceSchemaType, type CrossDatasetReferenceValue} from '@sanity/types'
import {Box, Card, Flex, Inline, Menu, Stack, useToast} from '@sanity/ui'
import {FOCUS_TERMINATOR} from '@sanity/util/paths'
import React, {
import {
type FocusEvent,
type KeyboardEvent,
useCallback,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {AccessDeniedIcon, HelpCircleIcon, LaunchIcon} from '@sanity/icons'
import imageUrlBuilder from '@sanity/image-url'
import {type CrossDatasetType, type PreviewValue} from '@sanity/types'
import {Badge, Box, Flex, Inline, Text} from '@sanity/ui'
import React, {createElement, isValidElement as ReactIsValidElement, useMemo} from 'react'
import {createElement, isValidElement as ReactIsValidElement, useMemo} from 'react'

import {Tooltip} from '../../../../ui-components'
import {DefaultPreview, type PreviewMediaDimensions, TextWithTone} from '../../../components'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {type CrossDatasetReferenceSchemaType, type CrossDatasetReferenceValue} from '@sanity/types'
import {Stack, Text, TextSkeleton} from '@sanity/ui'
import React from 'react'

import {Translate, useTranslation} from '../../../i18n'
import {CrossDatasetReferencePreview} from './CrossDatasetReferencePreview'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Autocomplete, Box, Flex, type Placement, Text} from '@sanity/ui'
import React, {
import {
type ComponentProps,
type ForwardedRef,
forwardRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {type TextInputProps} from '@sanity/ui'
import React, {type ChangeEvent, type HTMLProps, useCallback} from 'react'
import {type ChangeEvent, type HTMLProps, useCallback} from 'react'

import {LazyTextInput} from '../LazyTextInput'

Expand Down
1 change: 0 additions & 1 deletion packages/sanity/src/core/form/inputs/EmailInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {TextInput} from '@sanity/ui'
import React from 'react'

import {type StringInputProps} from '../types'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Card, Code, Stack, Text} from '@sanity/ui'
import {isPlainObject} from 'lodash'
import React, {forwardRef, type Ref, useCallback, useImperativeHandle, useMemo} from 'react'
import {forwardRef, type Ref, useCallback, useImperativeHandle, useMemo} from 'react'

import {Button} from '../../../../ui-components'
import {isDev} from '../../../environment'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {TrashIcon} from '@sanity/icons'
import {Box, Card, Code, Stack, Text} from '@sanity/ui'
import React, {useCallback} from 'react'
import {useCallback} from 'react'

import {Button} from '../../../../ui-components'
import {isDev} from '../../../environment'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ElementQuery, Select, TabList} from '@sanity/ui'
import React, {type ChangeEvent, memo, useCallback} from 'react'
import {type ChangeEvent, memo, useCallback} from 'react'
import styled from 'styled-components'

import {useTranslation} from '../../../../i18n'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@sanity/portable-text-editor'
import {type Path, type PortableTextBlock, type PortableTextTextBlock} from '@sanity/types'
import {Box, Portal, PortalProvider, useBoundaryElement, usePortal} from '@sanity/ui'
import React, {useCallback, useMemo, useState} from 'react'
import {useCallback, useMemo, useState} from 'react'

import {ChangeIndicator} from '../../../changeIndicators'
import {EMPTY_ARRAY} from '../../../util'
Expand Down
Loading

0 comments on commit ff4c3bb

Please sign in to comment.