index int64 0 0 | repo_id stringlengths 16 181 | file_path stringlengths 28 270 | content stringlengths 1 11.6M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/DateInputs/base | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/DateInputs/base/calendar/YearInput.tsx | import React from 'react'
import {TextInput} from '@sanity/ui'
import {LazyTextInput} from '../LazyTextInput'
type Props = Omit<React.ComponentProps<typeof TextInput>, 'onChange' | 'value'> & {
value?: number
onChange: (year: number) => void
}
export const YearInput = ({onChange, ...props}: Props) => {
const ha... | 3,100 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/DateInputs/base | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/DateInputs/base/calendar/constants.ts | import {range} from 'lodash'
export const MONTH_NAMES = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
]
export const WEEK_DAY_NAMES = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
export const HOURS_24 = range(0... | 3,101 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/DateInputs/base | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/DateInputs/base/calendar/features.ts | export const features = {
dayPresets: false,
timePresets: false,
}
| 3,102 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/DateInputs/base | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/DateInputs/base/calendar/utils.ts | import {addDays, eachWeekOfInterval, getWeek, lastDayOfMonth, startOfMonth} from 'date-fns'
import {TAIL_WEEKDAYS} from './constants'
export const getWeekStartsOfMonth = (date: Date): Date[] => {
const firstDay = startOfMonth(date)
return eachWeekOfInterval({
start: firstDay,
end: lastDayOfMonth(firstDay),... | 3,103 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/InvalidValueInput/InvalidValueInput.tsx | import {Button, Card, Code, Stack, Text} from '@sanity/ui'
import React, {forwardRef, useCallback, useImperativeHandle, useMemo} from 'react'
import {PatchEvent, set, unset} from '../../patch'
import {Alert} from '../../components/Alert'
import {Details} from '../../components/Details'
import {isDev} from '../../../env... | 3,104 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/InvalidValueInput/UntypedValueInput.tsx | import React, {useCallback, useMemo} from 'react'
import {Button, Card, Code, Grid, Stack, Text} from '@sanity/ui'
import {PatchEvent, setIfMissing, unset} from '../../patch'
import {Alert} from '../../components/Alert'
import {Details} from '../../components/Details'
import {useSchema} from '../../../hooks'
import {is... | 3,105 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/InvalidValueInput/converters.ts | import isValidDate from 'date-fns/isValid'
const TRUTHY_STRINGS = ['yes', 'true', '1']
const FALSEY_STRINGS = ['false', 'no', 'false', '0', 'null']
const BOOL_STRINGS = TRUTHY_STRINGS.concat(FALSEY_STRINGS)
const TRUE = (): true => true
const has = (prop: string) => (val?: Record<string, any>) => val && val[prop]
co... | 3,106 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/InvalidValueInput/index.ts | export * from './InvalidValueInput'
| 3,107 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput/ObjectInput.styled.tsx | import {Card} from '@sanity/ui'
import styled from 'styled-components'
// The negative margins here removes the extra space between the tabs and the fields when inside of a grid
export const FieldGroupTabsWrapper = styled(Card)<{$level?: number}>`
margin-bottom: ${({$level, theme}) => ($level === 0 ? 0 : theme.sanit... | 3,108 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput/ObjectInput.tsx | import React, {memo, useCallback, useMemo} from 'react'
import {Grid, Stack} from '@sanity/ui'
import {ObjectInputProps} from '../../types'
import {ObjectInputMembers} from '../../members'
import {UnknownFields} from './UnknownFields'
import {FieldGroupTabsWrapper} from './ObjectInput.styled'
import {FieldGroupTabs} fr... | 3,109 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput/UnknownFields.tsx | import React, {useCallback} from 'react'
import {Box, Button, Card, Code, Stack, Text} from '@sanity/ui'
import {TrashIcon} from '@sanity/icons'
import {FormPatch, PatchEvent, unset} from '../../patch'
import {Details} from '../../components/Details'
import {Alert} from '../../components/Alert'
import {isDev} from '../... | 3,110 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput/index.ts | export {ObjectInput} from './ObjectInput'
| 3,111 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput/__tests__/ObjectFieldset.test.tsx | import {defineField} from '@sanity/types'
import userEvent from '@testing-library/user-event'
import React from 'react'
import {renderObjectInput} from '../../../../../../test/form'
import {ObjectInput} from '../ObjectInput'
import {FieldProps} from '../../../types'
const fieldsetsTestType = defineField({
title: 'Fi... | 3,112 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput/__tests__/ObjectInput.test.tsx | import {defineType} from '@sanity/types'
import React from 'react'
import {renderObjectInput} from '../../../../../../test/form'
import {ObjectInput} from '../ObjectInput'
const defs = {
basic: defineType({
title: 'very basic object',
name: 'basic',
type: 'object',
fields: [{name: 'first', type: 'str... | 3,113 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput/__tests__/test-utils.tsx | /* eslint-disable import/export */
import React, {FC, ReactElement} from 'react'
import {render, RenderOptions} from '@testing-library/react'
import {LayerProvider, studioTheme, ThemeProvider} from '@sanity/ui'
const Providers: FC<{children?: React.ReactNode}> = ({children}) => {
return (
<ThemeProvider theme={s... | 3,114 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput/fieldGroups/FieldGroupTabs.tsx | import React, {useCallback} from 'react'
import {ElementQuery, Select, TabList} from '@sanity/ui'
import styled from 'styled-components'
import {FormFieldGroup} from '../../../store'
import {GroupOption, GroupTab} from './GroupTab'
interface FieldGroupTabsProps {
disabled?: boolean
groups: FormFieldGroup[]
input... | 3,115 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput/fieldGroups/GroupTab.tsx | import React, {forwardRef} from 'react'
import {Tab} from '@sanity/ui'
interface GroupType {
'aria-controls': string
autoFocus?: boolean
disabled?: boolean
icon?: React.ComponentType
name: string
onClick?: (value: string) => void
selected: boolean
title: string
}
export const GroupTab = forwardRef(fun... | 3,116 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ObjectInput/fieldGroups/index.ts | export * from './FieldGroupTabs'
| 3,117 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/BlockActions.tsx | import {PortableTextEditor, usePortableTextEditor} from '@sanity/portable-text-editor'
import React, {useMemo} from 'react'
import styled from 'styled-components'
import {PortableTextBlock} from '@sanity/types'
import {PatchEvent} from '../../patch'
import {RenderBlockActionsCallback, RenderBlockActionsProps} from '../... | 3,118 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/Compositor.styles.tsx | import {Layer} from '@sanity/ui'
import styled, {css} from 'styled-components'
import {focusRingBorderStyle, focusRingStyle} from '../../components/withFocusRing/helpers'
export const Root = styled.div(({theme}) => {
const {focusRing, input} = theme.sanity
const base = theme.sanity.color.base
const color = theme... | 3,119 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/Compositor.tsx | import React, {useState, useMemo, useCallback} from 'react'
import {
OnCopyFn,
OnPasteFn,
usePortableTextEditor,
HotkeyOptions,
BlockRenderProps as EditorBlockRenderProps,
BlockChildRenderProps as EditorChildRenderProps,
BlockAnnotationRenderProps,
EditorSelection,
} from '@sanity/portable-text-editor'
... | 3,120 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/Editor.styles.tsx | import {Card, Container, rem} from '@sanity/ui'
import styled, {css} from 'styled-components'
import {ScrollContainer} from '../../../components/scroll'
import {createListName, TEXT_LEVELS} from './text'
export const Root = styled(Card)<{$fullscreen: boolean}>`
height: ${({$fullscreen}) => ($fullscreen ? '100%' : '1... | 3,121 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/Editor.tsx | import {
HotkeyOptions,
PortableTextEditable,
RenderAnnotationFunction,
RenderBlockFunction,
RenderChildFunction,
RenderDecoratorFunction,
OnPasteFn,
OnCopyFn,
EditorSelection,
RenderStyleFunction,
RenderListItemFunction,
} from '@sanity/portable-text-editor'
import {Path} from '@sanity/types'
imp... | 3,122 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/InvalidValue.tsx | import {InvalidValueResolution} from '@sanity/portable-text-editor'
import {Box, Button, Card, Code, Grid, Stack, Text} from '@sanity/ui'
import React, {useCallback} from 'react'
import {Alert} from '../../components/Alert'
interface InvalidValueProps {
onChange: (...args: any[]) => any
onIgnore: () => void
read... | 3,123 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/PortableTextInput.tsx | import {PortableTextBlock} from '@sanity/types'
import {
EditorChange,
Patch as EditorPatch,
PortableTextEditor,
InvalidValue,
Patch,
} from '@sanity/portable-text-editor'
import React, {
useEffect,
useState,
useMemo,
useCallback,
useRef,
useImperativeHandle,
createRef,
ReactNode,
startTrans... | 3,124 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/_helpers.ts | import {SchemaType} from '@sanity/types'
import {ArrayOfObjectsFormNode, FieldMember, ObjectMember} from '../../store'
/**
* @internal
*/
export function isBlockType(type: SchemaType): boolean {
if (type.type) {
return isBlockType(type.type)
}
return type.name === 'block'
}
/**
* @internal
*/
export fu... | 3,125 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/debugRender.ts | const DEBUG_RENDERING = false
function getRandomColor(): string {
const letters = '0123456789ABCDEF'
let color = '#'
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)]
}
return color
}
export function debugRender(style?: React.CSSProperties): React.CSSProperties | undefined {... | 3,126 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/usePatches.ts | import {Path, PathSegment} from '@sanity/types'
import {get, find} from 'lodash'
import {useCallback} from 'react'
import shallowEquals from 'shallow-equals'
import {isRecord} from '../../../util'
import {FormPatch} from '../../patch'
import {useFormBuilder} from '../../useFormBuilder'
/**
* @internal
*/
export inte... | 3,127 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/index.ts | import {defineScope} from '@sanity/ui-workshop'
import {lazy} from 'react'
import DefaultSchemaStory from './defaultSchema/Story'
export default defineScope({
name: 'core/form/inputs/portable-text',
title: 'PortableText',
stories: [
{
name: 'default',
title: 'Default Schema',
component: Def... | 3,128 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/_common/TestInput.tsx | import {ArraySchemaType, Path, ValidationMarker, PortableTextBlock} from '@sanity/types'
import React, {useCallback, useEffect, useMemo, useState} from 'react'
import {PortableTextMarker, RenderCustomMarkers} from '../../../../types'
import {applyAll} from '../../../../patch/simplePatch'
import {RenderBlockActionsCallb... | 3,129 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/_common/input.tsx | import {TextArea, Theme} from '@sanity/ui'
import React, {forwardRef, useImperativeHandle, useRef} from 'react'
import styled, {css} from 'styled-components'
import {SchemaType} from '@sanity/types'
import {PortableTextInput} from '../../PortableTextInput'
import {defaultResolveInputComponent} from '../../../../studio/... | 3,130 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/_common/resolvePreviewComponent.tsx | import {Button, Card, Code, ErrorBoundary, Stack} from '@sanity/ui'
import React, {useCallback, useState} from 'react'
import {SanityDefaultPreview, PreviewLoader} from '../../../../../preview'
export const resolvePreviewComponent = () => TestPreview
interface ErrorParams {
error: Error
info: React.ErrorInfo
}
f... | 3,131 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/customSchema/Story.tsx | import {Card, Container, Flex, LayerProvider} from '@sanity/ui'
import React from 'react'
import {useBoolean, useSelect} from '@sanity/ui-workshop'
import {TestInput} from '../_common/TestInput'
import {FIXME} from '../../../../../FIXME'
import {schema, portableTextType} from './schema'
import {values, valueOptions} fr... | 3,132 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/customSchema/blockActions.tsx | import {Box, Button, Text, Tooltip} from '@sanity/ui'
import React, {memo, useCallback} from 'react'
import {CopyIcon} from '@sanity/icons'
import {keyGenerator} from '@sanity/portable-text-editor'
import {PortableTextBlock, PortableTextTextBlock} from '@sanity/types'
import {RenderBlockActionsCallback} from '../../../... | 3,133 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/customSchema/customMarkers.tsx | import {Box, Flex, Text} from '@sanity/ui'
import React from 'react'
import {CommentIcon} from '@sanity/icons'
import {PortableTextMarker} from '../../../../types'
export function renderCustomMarkers(markers: PortableTextMarker[]) {
return markers.map((marker) => {
if (marker.type === 'customMarkerTest') {
... | 3,134 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/customSchema/schema.ts | import {Rule} from '@sanity/types'
import {createSchema} from '../../../../../schema'
interface PTBlockValue {
_type: 'block'
_key: string
children?: {_type: string; _key: string; text?: string}[]
}
const imageType = {
type: 'image',
name: 'blockImage',
}
const linkType = {
type: 'object',
name: 'link'... | 3,135 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/customSchema/values.ts | import {keyGenerator as createKey} from '@sanity/portable-text-editor'
import {PortableTextBlock} from '@sanity/types'
import {words} from './words'
export const valueOptions: Record<string, 'empty' | 'withCustomContent' | 'withLargeContent'> = {
Empty: 'empty',
'Custom content': 'withCustomContent',
'Large cont... | 3,136 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/customSchema/words.ts | export const words = [
'lorem',
'ipsum',
'dolor',
'sit',
'amet',
'consectetur',
'adipiscing',
'elit',
'curabitur',
'vel',
'hendrerit',
'libero',
'eleifend',
'blandit',
'nunc',
'ornare',
'odio',
'ut',
'orci',
'gravida',
'imperdiet',
'nullam',
'purus',
'lacinia',
'a',
'... | 3,137 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/defaultSchema/Story.tsx | import {SanityClient} from '@sanity/client'
import {Card, Container, Flex} from '@sanity/ui'
import {useAction, useSelect} from '@sanity/ui-workshop'
import React, {useCallback, useMemo, useRef, useState} from 'react'
import {Path} from '@sanity/types'
import {createMockSanityClient} from '../../../../../../../test/moc... | 3,138 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/defaultSchema/values.ts | import {PortableTextBlock} from '@sanity/types'
export const valueOptions = {
Empty: 'empty',
'With Text': 'withText',
}
export const values: Record<string, PortableTextBlock[] | undefined> = {
empty: undefined,
withText: [
{
_type: 'block',
_key: 'a',
style: 'normal',
markDefs: [
... | 3,139 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/listCounter/ListCounterStory.tsx | import {Box, Container, Flex, Stack, Text} from '@sanity/ui'
import {useBoolean, useSelect} from '@sanity/ui-workshop'
import React from 'react'
import styled, {css} from 'styled-components'
interface BlockType {
level: number
listItem?: 'bullet' | 'number'
}
const LEVELS = [0, 1, 2, 3, 4, 5, 6, 7, 8]
const BULLE... | 3,140 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/listCounter/index.ts | export {ListCounterStory as default} from './ListCounterStory'
| 3,141 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/textBlocks/TextBlocksStory.tsx | import {ValidationMarker} from '@sanity/types'
import {Box, Card, Container} from '@sanity/ui'
import {useAction, useBoolean} from '@sanity/ui-workshop'
import React, {useMemo} from 'react'
import {useSource} from '../../../../../studio'
import {PortableTextMarker} from '../../../../types'
const errorMarker: Validatio... | 3,142 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__ | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/__workshop__/textBlocks/index.ts | export {TextBlocksStory as default} from './TextBlocksStory'
| 3,143 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/_common/ReviewChangesHighlightBlock.tsx | import {rgba} from '@sanity/ui'
import styled, {css} from 'styled-components'
export const ReviewChangesHighlightBlock = styled.div(({theme}) => {
const {radius, space, color} = theme.sanity
const bg = rgba(color.spot.yellow, 0.2)
return css`
position: absolute;
border-radius: ${radius[3]}px;
top: -... | 3,144 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/_common/StyledChangeIndicatorWithProvidedFullPath.tsx | import styled, {css} from 'styled-components'
import {ChangeIndicator} from '../../../../changeIndicators'
export const StyledChangeIndicatorWithProvidedFullPath = styled(ChangeIndicator)(() => {
return css`
width: 1px;
height: 100%;
& > div {
height: 100%;
}
`
})
| 3,145 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/_common/index.ts | export * from './ReviewChangesHighlightBlock'
export * from './StyledChangeIndicatorWithProvidedFullPath'
| 3,146 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/_legacyDefaultParts/CustomMarkers.tsx | import React from 'react'
import {Text} from '@sanity/ui'
// This is the fallback marker renderer if the block editor didn't get the 'renderCustomMarkers' prop
// You will probably only see this when you first start to play with custom markers as a developer
export function DefaultCustomMarkers() {
return (
<Tex... | 3,147 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/_legacyDefaultParts/Markers.tsx | import {ErrorOutlineIcon, InfoOutlineIcon, WarningOutlineIcon} from '@sanity/icons'
import {FormNodeValidation} from '@sanity/types'
import {Box, Flex, Stack, Text, Theme} from '@sanity/ui'
import React from 'react'
import styled, {css} from 'styled-components'
import {PortableTextMarker, RenderCustomMarkers} from '../... | 3,148 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/_legacyDefaultParts | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/_legacyDefaultParts/__tests__/BlockExtras.test.tsx | import {fireEvent, waitFor} from '@testing-library/react'
import React from 'react'
import {PortableTextMarker} from '../../../../types'
// import {renderInput} from '../../../../test/renderInput'
// import {PortableTextInput, PortableTextInputProps} from '../../PortableTextInput'
// import {portableTextType} from './s... | 3,149 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/_legacyDefaultParts | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/_legacyDefaultParts/__tests__/schema.ts | const imageType = {
type: 'image',
name: 'blockImage',
}
export const someObject = {
type: 'object',
name: 'someObject',
fields: [{type: 'string', name: 'color'}],
}
export const blockType = {
type: 'block',
name: 'myTestBlockType',
styles: [
{title: 'Normal', value: 'normal'},
{title: 'H1', v... | 3,150 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/callbacks/index.ts | export * from './insertCallback'
export * from './setCallback'
export * from './unsetCallback'
| 3,151 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/callbacks/insertCallback.ts | import {normalizeBlock} from '@sanity/block-tools'
import {PortableTextBlock} from '@sanity/types'
import {PatchEvent, insert} from '../../../patch'
import {InsertCallback} from './types'
export function createInsertCallback(options: {
allowedDecorators: string[]
block: PortableTextBlock
onChange: (patches: Patc... | 3,152 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/callbacks/setCallback.ts | import {normalizeBlock} from '@sanity/block-tools'
import {PortableTextBlock} from '@sanity/types'
import {PatchEvent, set} from '../../../patch'
import {SetCallback} from './types'
export function createSetCallback(options: {
allowedDecorators: string[]
block: PortableTextBlock
onChange: (patches: PatchEvent) =... | 3,153 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/callbacks/types.ts | import {PortableTextBlock} from '@sanity/types'
export type UnsetCallback = () => void
export type SetCallback = (block: PortableTextBlock) => void
export type InsertCallback = (blocks: PortableTextBlock | PortableTextBlock[]) => void
| 3,154 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/callbacks/unsetCallback.ts | import {PortableTextBlock} from '@sanity/types'
import {PatchEvent, unset} from '../../../patch'
import {UnsetCallback} from './types'
export function createUnsetCallback(options: {
block: PortableTextBlock
onChange: (patches: PatchEvent) => void
}): UnsetCallback {
const {block, onChange} = options
return ()... | 3,155 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/contexts/PortableTextMarkers.tsx | import React, {createContext} from 'react'
import {PortableTextMarker} from '../../../types'
export const PortableTextMarkersContext = createContext<PortableTextMarker[]>([])
export function PortableTextMarkersProvider(props: {
markers: PortableTextMarker[]
children: React.ReactNode
}) {
return (
<PortableT... | 3,156 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/contexts/PortableTextMembers.tsx | import React, {createContext} from 'react'
import {PortableTextMemberItem} from '../PortableTextInput'
export const PortableTextMemberItemsContext = createContext<PortableTextMemberItem[]>([])
export function PortableTextMemberItemsProvider(props: {
memberItems: PortableTextMemberItem[]
children: React.ReactNode
... | 3,157 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/hooks/useHotKeys.tsx | import {useMemo, useState} from 'react'
import {HotkeyOptions, usePortableTextEditor} from '@sanity/portable-text-editor'
// This hook will create final hotkeys for the editor from on those from props.
export function useHotkeys(hotkeys: HotkeyOptions): HotkeyOptions {
const editor = usePortableTextEditor()
// Gu... | 3,158 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/hooks/useMemberValidation.tsx | import {FormNodeValidation} from '@sanity/types'
import {useMemo, useRef} from 'react'
import {EMPTY_ARRAY} from '../../../../util'
import {BaseFormNode} from '../../../store'
import {immutableReconcile} from '../../../store/utils/immutableReconcile'
import {useChildValidation} from '../../../studio/contexts/Validation... | 3,159 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/hooks/usePortableTextMarkers.tsx | import {Path} from '@sanity/types'
import {isEqual} from '@sanity/util/paths'
import {useContext, useMemo} from 'react'
import {PortableTextMarker} from '../../../types'
import {PortableTextMarkersContext} from '../contexts/PortableTextMarkers'
export function usePortableTextMarkers(path: Path): PortableTextMarker[] {... | 3,160 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/hooks/usePortableTextMembers.tsx | import {useContext} from 'react'
import {PortableTextMemberItemsContext} from '../contexts/PortableTextMembers'
import {PortableTextMemberItem} from '../PortableTextInput'
export function usePortableTextMemberItem(key: string): PortableTextMemberItem | undefined {
const ctx = useContext(PortableTextMemberItemsContex... | 3,161 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/hooks/useScrollSelectionIntoView.tsx | import {PortableTextEditor} from '@sanity/portable-text-editor'
import {useMemo} from 'react'
import scrollIntoView from 'scroll-into-view-if-needed'
// This hook is used to scroll the editor selection into place when actively editing the document.
export function useScrollSelectionIntoView(scrollElement: HTMLElement ... | 3,162 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/hooks/useSpellCheck.tsx | import {usePortableTextEditor} from '@sanity/portable-text-editor'
import {useMemo} from 'react'
export function useSpellcheck(): boolean {
const editor = usePortableTextEditor()
return useMemo(() => {
// Chrome 96. has serious perf. issues with spellchecking
// https://bugs.chromium.org/p/chromium/issues/... | 3,163 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/hooks/useTrackFocusPath.tsx | import {
PortableTextEditor,
usePortableTextEditor,
usePortableTextEditorSelection,
} from '@sanity/portable-text-editor'
import {Path, KeyedObject, isKeyedObject} from '@sanity/types'
import {useLayoutEffect} from 'react'
import scrollIntoView from 'scroll-into-view-if-needed'
import {isEqual} from '@sanity/util... | 3,164 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/Annotation.styles.ts | import {hues} from '@sanity/color'
import {Box, Theme, ThemeColorToneKey} from '@sanity/ui'
import styled, {css} from 'styled-components'
export const Root = styled.span<{$toneKey?: Exclude<ThemeColorToneKey, 'transparent'>}>(
(props: {$toneKey?: Exclude<ThemeColorToneKey, 'transparent'>; theme: Theme}) => {
con... | 3,165 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/Annotation.tsx | import {PortableTextEditor, usePortableTextEditor} from '@sanity/portable-text-editor'
import {ObjectSchemaType, Path, PortableTextObject} from '@sanity/types'
import {Tooltip} from '@sanity/ui'
import React, {ComponentType, useCallback, useMemo, useState} from 'react'
import {isEqual} from '@sanity/util/paths'
import ... | 3,166 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/AnnotationToolbarPopover.tsx | import React, {useState, useRef, useMemo, useEffect, useCallback} from 'react'
import {
Box,
Button,
Inline,
Popover,
PopoverProps,
Text,
useGlobalKeyDown,
useTheme,
} from '@sanity/ui'
import styled from 'styled-components'
import {EditIcon, TrashIcon} from '@sanity/icons'
const ToolbarPopover = style... | 3,167 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/BlockObject.styles.ts | import {hues} from '@sanity/color'
import {Card, Theme, Flex, Box} from '@sanity/ui'
import styled, {css} from 'styled-components'
export const Root = styled(Card)((props: {theme: Theme}) => {
const {color, radius, space} = props.theme.sanity
const overlay = css`
pointer-events: none;
content: '';
pos... | 3,168 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/BlockObject.tsx | /* eslint-disable complexity */
import {
PortableTextEditor,
EditorSelection,
usePortableTextEditor,
} from '@sanity/portable-text-editor'
import {ObjectSchemaType, Path, PortableTextBlock, isImage} from '@sanity/types'
import {Tooltip, Flex, ResponsivePaddingProps, Box} from '@sanity/ui'
import React, {PropsWith... | 3,169 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/BlockObjectActionsMenu.tsx | import {EditIcon, LinkIcon, TrashIcon, EyeOpenIcon, EllipsisVerticalIcon} from '@sanity/icons'
import {
Box,
Button,
Flex,
Menu,
MenuButton,
MenuButtonProps,
MenuItem,
useGlobalKeyDown,
} from '@sanity/ui'
import React, {
forwardRef,
ReactElement,
useCallback,
useMemo,
useRef,
useId,
useEf... | 3,170 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/InlineObject.styles.ts | import {Box, Card, Theme} from '@sanity/ui'
import styled, {css} from 'styled-components'
import {hues} from '@sanity/color'
export const Root = styled(Card)(rootStyle)
export const PreviewSpan = styled.span`
display: block;
max-width: calc(5em + 80px);
position: relative;
`
export const TooltipBox = styled(Bo... | 3,171 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/InlineObject.tsx | import {
EditorSelection,
PortableTextEditor,
usePortableTextEditor,
} from '@sanity/portable-text-editor'
import {ObjectSchemaType, Path, PortableTextBlock, PortableTextChild} from '@sanity/types'
import React, {useCallback, useEffect, useMemo, useState} from 'react'
import {Tooltip} from '@sanity/ui'
import {is... | 3,172 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/InlineObjectToolbarPopover.tsx | import React, {useRef, useCallback, useMemo} from 'react'
import {
Box,
Button,
Inline,
Popover,
PopoverProps,
Text,
useGlobalKeyDown,
useTheme,
} from '@sanity/ui'
import styled from 'styled-components'
import {EditIcon, TrashIcon} from '@sanity/icons'
const ToolbarPopover = styled(Popover)`
&[data-... | 3,173 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/helpers.ts | import {ObjectSchemaType} from '@sanity/types'
const parseResponsiveWidth = (value: unknown): (number | 'auto')[] => {
if (Array.isArray(value)) {
return value.flatMap(parseResponsiveWidth)
}
if (typeof value === 'number') {
return [value]
}
return value === 'auto' ? ['auto'] : []
}
const parseModalT... | 3,174 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/modals/DialogModal.tsx | import React, {useId, useRef, useState} from 'react'
import {Box, Dialog} from '@sanity/ui'
import {PresenceOverlay} from '../../../../../presence'
import {VirtualizerScrollInstanceProvider} from '../../../arrays/ArrayOfObjectsInput/List/VirtualizerScrollInstanceProvider'
import {ModalWidth} from './types'
interface D... | 3,175 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/modals/ObjectEditModal.tsx | import React, {useCallback, useMemo} from 'react'
import {ObjectSchemaType} from '@sanity/types'
import {_getModalOption} from '../helpers'
import {DefaultEditDialog} from './DialogModal'
import {PopoverEditDialog} from './PopoverModal'
export function ObjectEditModal(props: {
autoFocus?: boolean
children: React.R... | 3,176 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/modals/PopoverModal.styles.ts | import {Box, Popover} from '@sanity/ui'
import styled from 'styled-components'
export const RootPopover = styled(Popover)`
&[data-popper-reference-hidden='true'] {
visibility: hidden;
pointer-events: none;
}
& > div {
overflow: hidden;
overflow: clip;
}
`
export const ContentScrollerBox = sty... | 3,177 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/modals/PopoverModal.tsx | /* eslint-disable react/no-unused-prop-types */
import {CloseIcon} from '@sanity/icons'
import {Box, Button, Flex, PopoverProps, Text, useClickOutside, useGlobalKeyDown} from '@sanity/ui'
import React, {useCallback, useEffect, useRef, useState} from 'react'
import {PresenceOverlay} from '../../../../../presence'
impor... | 3,178 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/object/modals/types.ts | export type ModalWidth = number | 'auto' | (number | 'auto')[]
| 3,179 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/text/Decorator.tsx | import React, {useCallback, useMemo} from 'react'
import styled from 'styled-components'
import {BlockDecoratorRenderProps} from '@sanity/portable-text-editor'
import {BlockDecoratorProps} from '../../../types'
import {TEXT_DECORATOR_TAGS} from './constants'
const Root = styled.span`
/* Make sure the annotation styl... | 3,180 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/text/ListItem.tsx | import {BlockListItemRenderProps} from '@sanity/portable-text-editor'
import React, {useMemo} from 'react'
import {BlockListItemProps} from '../../../types'
const DefaultComponent = (dProps: BlockListItemProps) => {
return <>{dProps.children}</>
}
export const ListItem = (props: BlockListItemRenderProps) => {
con... | 3,181 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/text/Style.tsx | import React, {useCallback, useMemo} from 'react'
import {BlockStyleRenderProps} from '@sanity/portable-text-editor'
import {BlockStyleProps} from '../../../types'
import {Normal as FallbackComponent, TEXT_STYLES, TextContainer} from './textStyles'
export const Style = (props: BlockStyleRenderProps) => {
const {bloc... | 3,182 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/text/TextBlock.styles.ts | import {hues} from '@sanity/color'
import {Box, Flex, Theme} from '@sanity/ui'
import styled, {css} from 'styled-components'
import {TEXT_BULLET_MARKERS, TEXT_NUMBER_FORMATS} from './constants'
import {createListName} from './helpers'
interface TextBlockStyleProps {
$level: number
}
function textBlockStyle(props: T... | 3,183 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/text/TextBlock.tsx | import {Box, Flex, ResponsivePaddingProps, Tooltip, Text} from '@sanity/ui'
import React, {RefObject, useCallback, useMemo, useState} from 'react'
import {ObjectSchemaType, Path, PortableTextTextBlock} from '@sanity/types'
import {
EditorSelection,
PortableTextEditor,
usePortableTextEditor,
} from '@sanity/portab... | 3,184 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/text/constants.ts | import {ResponsivePaddingProps} from '@sanity/ui'
export const TEXT_LEVELS = [1, 2, 3, 4, 5, 6, 7, 8, 9]
export const TEXT_BULLET_MARKERS = ['●', '○', '■']
export const TEXT_NUMBER_FORMATS = ['number', 'lower-alpha', 'lower-roman']
export const TEXT_DECORATOR_TAGS: Record<string, React.ElementType> = {
em: 'em',
... | 3,185 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/text/helpers.ts | export function createListName(level: number): string {
return `list-level-${level}`
}
| 3,186 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/text/index.ts | export * from './constants'
export * from './Decorator'
export * from './helpers'
export * from './TextBlock'
export * from './textStyles'
| 3,187 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/text/textStyles.tsx | import {Heading, Text} from '@sanity/ui'
import React from 'react'
import styled from 'styled-components'
type TextStyleProps = Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'ref'>
type BlockQuoteStyleProps = Omit<React.HTMLProps<HTMLQuoteElement>, 'as' | 'ref'>
/**
* Without this container, editing with Android brea... | 3,188 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/toolbar/ActionMenu.tsx | import React, {memo, useCallback, useMemo} from 'react'
import {Button, ButtonProps, PopoverProps} from '@sanity/ui'
import {EllipsisVerticalIcon} from '@sanity/icons'
import {PortableTextEditor, usePortableTextEditor} from '@sanity/portable-text-editor'
import {CollapseMenu, CollapseMenuButton} from '../../../../compo... | 3,189 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/toolbar/BlockStyleSelect.tsx | import React, {memo, useCallback, useMemo} from 'react'
import {PortableTextEditor, usePortableTextEditor} from '@sanity/portable-text-editor'
import {Button, Menu, MenuButton, MenuButtonProps, MenuItem, Text} from '@sanity/ui'
import {SelectIcon} from '@sanity/icons'
import styled from 'styled-components'
import {
H... | 3,190 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/toolbar/CustomIcon.tsx | import React, {useMemo} from 'react'
import styled from 'styled-components'
interface Props {
icon: string
active: boolean
}
const CustomIconDiv = styled.div`
width: 1em;
height: 1em;
border-radius: inherit;
background-origin: content-box;
background-position: center;
background-repeat: no-repeat;
b... | 3,191 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/toolbar/InsertMenu.tsx | import React, {memo, useCallback, useMemo} from 'react'
import {AddIcon} from '@sanity/icons'
import {Button, PopoverProps} from '@sanity/ui'
import {PortableTextEditor, usePortableTextEditor} from '@sanity/portable-text-editor'
import {upperFirst} from 'lodash'
import {CollapseMenu, CollapseMenuButton} from '../../../... | 3,192 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/toolbar/Toolbar.tsx | import {
HotkeyOptions,
usePortableTextEditor,
usePortableTextEditorSelection,
PortableTextEditor,
} from '@sanity/portable-text-editor'
import React, {memo, useCallback, useMemo, useState} from 'react'
import {ObjectSchemaType, Path, SchemaType} from '@sanity/types'
import {Box, Button, Flex, Hotkeys, Text, To... | 3,193 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/toolbar/helpers.tsx | import {
BlockElementIcon,
BoldIcon,
CodeIcon,
InlineElementIcon,
ItalicIcon,
LinkIcon,
OlistIcon,
StrikethroughIcon,
UnderlineIcon,
UnknownIcon,
UlistIcon,
} from '@sanity/icons'
import {
HotkeyOptions,
PortableTextEditor,
PortableTextMemberSchemaTypes,
} from '@sanity/portable-text-editor'... | 3,194 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/toolbar/hooks.ts | import {
HotkeyOptions,
PortableTextEditor,
usePortableTextEditor,
usePortableTextEditorSelection,
} from '@sanity/portable-text-editor'
import {ObjectSchemaType, Path, PortableTextBlock, PortableTextChild} from '@sanity/types'
import {useCallback, useMemo} from 'react'
import {FIXME} from '../../../../FIXME'
i... | 3,195 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/toolbar/index.ts | export * from './Toolbar'
| 3,196 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/PortableText/toolbar/types.ts | // import {Type} from '@sanity/portable-text-editor'
import {ObjectSchemaType} from '@sanity/types'
import {ComponentType, ReactNode} from 'react'
export interface BlockItem {
handle: () => void
icon: React.ElementType
inline: boolean
key: string
type: ObjectSchemaType
}
export interface BlockStyleItem {
... | 3,197 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ReferenceInput/AutocompleteContainer.tsx | import {Grid, useElementRect} from '@sanity/ui'
import React, {ReactNode, ForwardedRef, forwardRef, useCallback, useState} from 'react'
import styled, {css} from 'styled-components'
const NARROW_LAYOUT = css`
grid-template-columns: minmax(0px, 1fr);
`
const WIDE_LAYOUT = css`
grid-template-columns: 1fr min-conten... | 3,198 |
0 | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs | petrpan-code/sanity-io/sanity/packages/sanity/src/core/form/inputs/ReferenceInput/CreateButton.tsx | import React, {ComponentProps} from 'react'
import {AddIcon} from '@sanity/icons'
import {Box, Button, Menu, MenuButton, MenuButtonProps, MenuItem, Tooltip} from '@sanity/ui'
import {InsufficientPermissionsMessage} from '../../../components'
import {CreateReferenceOption} from './types'
interface Props extends Compone... | 3,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.