sanity 6.4.0-next.21 → 6.4.0-next.23
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/lib/_chunks-dts/ActiveWorkspaceMatcherContext.d.ts +1 -1
- package/lib/_chunks-es/CalendarFilter.js +3 -1
- package/lib/_chunks-es/CalendarFilter.js.map +1 -1
- package/lib/_chunks-es/CommentsInspector.js +58 -1
- package/lib/_chunks-es/CommentsInspector.js.map +1 -1
- package/lib/_chunks-es/PresentationToolGrantsCheck.js +9 -1
- package/lib/_chunks-es/PresentationToolGrantsCheck.js.map +1 -1
- package/lib/_chunks-es/ReleasesStudioLayout.js +58 -1
- package/lib/_chunks-es/ReleasesStudioLayout.js.map +1 -1
- package/lib/_chunks-es/ReleasesTool.js +68 -1
- package/lib/_chunks-es/ReleasesTool.js.map +1 -1
- package/lib/_chunks-es/StructureToolProvider.js +4 -1
- package/lib/_chunks-es/StructureToolProvider.js.map +1 -1
- package/lib/_chunks-es/Table.js +2 -1
- package/lib/_chunks-es/Table.js.map +1 -1
- package/lib/_chunks-es/TasksDocumentInputLayout.js +58 -1
- package/lib/_chunks-es/TasksDocumentInputLayout.js.map +1 -1
- package/lib/_chunks-es/TasksFooterOpenTasks.js +59 -1
- package/lib/_chunks-es/TasksFooterOpenTasks.js.map +1 -1
- package/lib/_chunks-es/TasksStudioActiveToolLayout.js +58 -1
- package/lib/_chunks-es/TasksStudioActiveToolLayout.js.map +1 -1
- package/lib/_chunks-es/TasksStudioLayout.js +58 -1
- package/lib/_chunks-es/TasksStudioLayout.js.map +1 -1
- package/lib/_chunks-es/TasksStudioNavbar.js +58 -1
- package/lib/_chunks-es/TasksStudioNavbar.js.map +1 -1
- package/lib/_chunks-es/Tool.js +7 -1
- package/lib/_chunks-es/Tool.js.map +1 -1
- package/lib/_chunks-es/VariantsStudioNavbar.js +58 -1
- package/lib/_chunks-es/VariantsStudioNavbar.js.map +1 -1
- package/lib/_chunks-es/VariantsTool.js +59 -1
- package/lib/_chunks-es/VariantsTool.js.map +1 -1
- package/lib/_chunks-es/index2.js +98 -1
- package/lib/_chunks-es/index2.js.map +1 -1
- package/lib/_chunks-es/index3.js +58 -1
- package/lib/_chunks-es/index3.js.map +1 -1
- package/lib/_chunks-es/index4.js +3 -1
- package/lib/_chunks-es/index4.js.map +1 -1
- package/lib/_chunks-es/index5.js +3 -1
- package/lib/_chunks-es/index5.js.map +1 -1
- package/lib/_chunks-es/index6.js +60 -1
- package/lib/_chunks-es/index6.js.map +1 -1
- package/lib/_chunks-es/index7.js +58 -1
- package/lib/_chunks-es/index7.js.map +1 -1
- package/lib/_chunks-es/index8.js +59 -1
- package/lib/_chunks-es/index8.js.map +1 -1
- package/lib/_chunks-es/index9.js +8 -1
- package/lib/_chunks-es/index9.js.map +1 -1
- package/lib/_chunks-es/inputResolver.js +2 -1
- package/lib/_chunks-es/inputResolver.js.map +1 -1
- package/lib/_chunks-es/presentation.js +7 -1
- package/lib/_chunks-es/presentation.js.map +1 -1
- package/lib/_chunks-es/resources2.js +58 -1
- package/lib/_chunks-es/resources2.js.map +1 -1
- package/lib/_chunks-es/resources3.js +58 -1
- package/lib/_chunks-es/resources3.js.map +1 -1
- package/lib/_chunks-es/resources4.js +58 -1
- package/lib/_chunks-es/resources4.js.map +1 -1
- package/lib/_chunks-es/resources5.js +58 -1
- package/lib/_chunks-es/resources5.js.map +1 -1
- package/lib/_chunks-es/resources6.js +58 -1
- package/lib/_chunks-es/resources6.js.map +1 -1
- package/lib/_chunks-es/resources7.js +58 -1
- package/lib/_chunks-es/resources7.js.map +1 -1
- package/lib/_chunks-es/structureTool.js +47 -1
- package/lib/_chunks-es/structureTool.js.map +1 -1
- package/lib/_chunks-es/version.js +2 -2
- package/lib/desk.js +4 -1
- package/lib/desk.js.map +1 -1
- package/lib/index.js +15 -1
- package/lib/index.js.map +1 -1
- package/lib/structure.js +3 -1
- package/lib/structure.js.map +1 -1
- package/package.json +11 -11
package/lib/structure.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structure.js","sources":["../src/structure/components/incomingReferencesDecoration/CrossDatasetIncomingReference/CrossDatasetIncomingReferenceType.tsx","../src/structure/components/incomingReferencesDecoration/CreateNewIncomingReference.tsx","../src/structure/components/incomingReferencesDecoration/LinkToExistingPreview.tsx","../src/structure/components/incomingReferencesDecoration/AddIncomingReference.tsx","../src/structure/components/incomingReferencesDecoration/IncomingReferencesType.tsx","../src/structure/components/incomingReferencesDecoration/types.ts","../src/structure/components/incomingReferencesDecoration/IncomingReferencesList.tsx","../src/structure/components/incomingReferencesDecoration/IncomingReferencesDecoration.tsx","../src/structure/components/incomingReferencesDecoration/defineIncomingReferenceDecoration.tsx","../src/structure/components/incomingReferencesDecoration/isIncomingReferenceCreation.ts"],"sourcesContent":["import {Box, Card, Flex, Stack, Text} from '@sanity/ui'\nimport {useCallback, useMemo} from 'react'\nimport {useObservable} from 'react-rx'\nimport {\n CommandList,\n type CommandListRenderItemCallback,\n DEFAULT_STUDIO_CLIENT_OPTIONS,\n LoadingBlock,\n useClient,\n useDocumentPreviewStore,\n useSchema,\n useTranslation,\n} from 'sanity'\n\nimport {structureLocaleNamespace} from '../../../i18n'\nimport {INITIAL_STATE} from '../getIncomingReferences'\nimport {INCOMING_REFERENCES_ITEM_HEIGHT, IncomingReferencesListContainer} from '../shared'\nimport {type CrossDatasetIncomingReference} from '../types'\nimport {CrossDatasetIncomingReferenceDocumentPreview} from './CrossDatasetIncomingReferenceDocumentPreview'\nimport {\n type CrossDatasetIncomingReferenceDocument,\n getCrossDatasetIncomingReferences,\n} from './getCrossDatasetIncomingReferences'\n\nexport function CrossDatasetIncomingReferenceType({\n type,\n referenced,\n shouldRenderTitle,\n}: {\n shouldRenderTitle: boolean\n referenced: {id: string; type: string}\n type: CrossDatasetIncomingReference\n}) {\n const client = useClient(DEFAULT_STUDIO_CLIENT_OPTIONS)\n const documentPreviewStore = useDocumentPreviewStore()\n\n const references$ = useMemo(\n () =>\n getCrossDatasetIncomingReferences({\n documentId: referenced.id,\n client,\n type: type,\n documentPreviewStore,\n }),\n [client, type, referenced.id, documentPreviewStore],\n )\n\n const {documents, loading} = useObservable(references$, INITIAL_STATE)\n\n const schema = useSchema()\n const {t} = useTranslation(structureLocaleNamespace)\n const schemaType = schema.get(type.type)\n\n const renderItem = useCallback<\n CommandListRenderItemCallback<CrossDatasetIncomingReferenceDocument>\n >(\n (document) => <CrossDatasetIncomingReferenceDocumentPreview document={document} type={type} />,\n [type],\n )\n\n if (!schemaType) return null\n if (loading) {\n return <LoadingBlock showText title={t('incoming-references-input.types-loading')} />\n }\n return (\n <Stack space={2} marginBottom={2}>\n {shouldRenderTitle && (\n <Box paddingY={2} paddingX={0}>\n <Text size={1} weight=\"medium\">\n {type.title || schemaType?.title}\n </Text>\n </Box>\n )}\n <Card radius={2} padding={1} border tone=\"default\">\n {documents && documents.length > 0 ? (\n <IncomingReferencesListContainer $itemCount={documents.length}>\n <CommandList\n activeItemDataAttr=\"data-hovered\"\n ariaLabel={t('incoming-references-input.list-label', {\n type: type.title || schemaType?.title,\n })}\n canReceiveFocus\n fixedHeight\n getItemKey={(index) => documents[index].id}\n itemHeight={INCOMING_REFERENCES_ITEM_HEIGHT}\n items={documents}\n onlyShowSelectionWhenActive\n overscan={5}\n renderItem={renderItem}\n wrapAround={false}\n />\n </IncomingReferencesListContainer>\n ) : (\n <>\n <Flex align=\"center\" justify=\"center\" padding={2}>\n <Text size={1} muted>\n {t('incoming-references-input.no-items')}\n </Text>\n </Flex>\n </>\n )}\n </Card>\n </Stack>\n )\n}\n","import {uuid} from '@sanity/uuid'\nimport {useCallback, useMemo} from 'react'\nimport {\n CreateReferenceButton,\n type CreateReferenceOption,\n getPublishedId,\n isNonNullable,\n useReferenceInputOptions,\n} from 'sanity'\nimport {useRouter} from 'sanity/router'\n\nimport {usePaneRouter} from '../paneRouter'\nimport {type IncomingReferenceCreationParams} from './isIncomingReferenceCreation'\nimport {type IncomingReferencesOptions} from './types'\n\nexport function CreateNewIncomingReference({\n type,\n referenceToId,\n referenceToType,\n onCreateNewReference,\n fieldName,\n creationAllowed,\n}: {\n type: string\n referenceToId: string\n referenceToType: string\n onCreateNewReference: (id: string) => void\n fieldName: string\n creationAllowed: IncomingReferencesOptions['creationAllowed']\n}) {\n const {initialValueTemplateItems} = useReferenceInputOptions()\n\n const {navigate} = useRouter()\n const {routerPanesState, groupIndex} = usePaneRouter()\n\n const handleCreate = useCallback(\n (option: CreateReferenceOption) => {\n const id = uuid()\n navigate({\n panes: [\n ...routerPanesState.slice(0, groupIndex + 1),\n [\n {\n id: getPublishedId(id),\n params: {type, template: option.template.id},\n payload: {\n reference: {\n _type: 'reference',\n _ref: referenceToId,\n _weak: true,\n _strengthenOnPublish: {type: referenceToType},\n },\n from: {fieldName, type: referenceToType},\n __internal_isIncomingReferenceCreation: true,\n } satisfies IncomingReferenceCreationParams,\n },\n ],\n ],\n })\n onCreateNewReference(id)\n },\n [\n type,\n navigate,\n routerPanesState,\n groupIndex,\n referenceToId,\n referenceToType,\n onCreateNewReference,\n fieldName,\n ],\n )\n\n const createOptions = useMemo(() => {\n if (!creationAllowed) return []\n return (initialValueTemplateItems || [])\n\n .filter((i) => {\n const typeMatch = type === i.template?.schemaType\n if (Array.isArray(creationAllowed)) {\n // Check if the template id is in the creationAllowed array\n return typeMatch && creationAllowed.includes(i.template.id)\n }\n return typeMatch\n })\n .map((item): CreateReferenceOption | undefined =>\n item.template?.schemaType\n ? {\n id: item.id,\n title: item.title || `${item.template.schemaType} from template ${item.template?.id}`,\n i18n: item.i18n,\n type: item.template.schemaType,\n icon: item.icon,\n template: {\n id: item.template?.id,\n params: item.parameters,\n },\n\n permission: {granted: item.granted, reason: item.reason},\n }\n : undefined,\n )\n .filter(isNonNullable)\n }, [creationAllowed, initialValueTemplateItems, type])\n\n if (!creationAllowed) {\n return null\n }\n return (\n <CreateReferenceButton\n id={`create-new-incoming-reference-${type}`}\n createOptions={createOptions}\n onCreate={handleCreate}\n />\n )\n}\n","import {type SchemaType} from '@sanity/types'\nimport {type BadgeTone, Text} from '@sanity/ui'\nimport {useMemo} from 'react'\nimport {useObservable} from 'react-rx'\nimport {\n type DocumentPreviewStore,\n getPreviewStateObservable,\n getPreviewValueWithFallback,\n getReleaseIdFromReleaseDocumentId,\n getReleaseTone,\n getVersionFromId,\n isDraftId,\n isPublishedId,\n isVersionId,\n PreviewCard,\n ReleaseTitle,\n SanityDefaultPreview,\n useActiveReleases,\n useTranslation,\n VersionInlineBadge,\n} from 'sanity'\n\nexport interface LinkToExistingPreviewProps {\n documentPreviewStore: DocumentPreviewStore\n schemaType: SchemaType\n value: {_id: string; _type: string}\n onLinkToDocument: () => void\n}\n\nconst getPerspective = (id: string) => {\n if (isDraftId(id)) return ['drafts']\n if (isVersionId(id)) return [getVersionFromId(id) as string]\n if (isPublishedId(id)) return ['published']\n return ['raw']\n}\n\nexport function LinkToExistingPreview(props: LinkToExistingPreviewProps) {\n const {schemaType, value, onLinkToDocument} = props\n const {data: releases} = useActiveReleases()\n const {t} = useTranslation()\n\n const previewStateObservable = useMemo(() => {\n return getPreviewStateObservable(\n props.documentPreviewStore,\n schemaType,\n value._id,\n getPerspective(value._id),\n )\n }, [props.documentPreviewStore, schemaType, value._id])\n\n const {snapshot, original, isLoading} = useObservable(previewStateObservable, {\n snapshot: null,\n isLoading: true,\n original: null,\n })\n\n const badgeProps = useMemo(():\n | {kind: 'static'; tone: BadgeTone; text: string}\n | {kind: 'release'; tone: BadgeTone; releaseTitle: string | undefined; releaseFallback: string}\n | null => {\n const id = value._id\n if (isDraftId(id)) {\n return {\n kind: 'static',\n tone: getReleaseTone('drafts'),\n text: t('release.chip.draft'),\n }\n }\n if (isPublishedId(id)) {\n return {\n kind: 'static',\n tone: getReleaseTone('published'),\n text: t('release.chip.published'),\n }\n }\n if (isVersionId(id)) {\n const releaseId = getVersionFromId(id)\n const release = releases.find((r) => getReleaseIdFromReleaseDocumentId(r._id) === releaseId)\n if (release) {\n return {\n kind: 'release',\n tone: getReleaseTone(release),\n releaseTitle: release.metadata.title,\n releaseFallback: release._id,\n }\n }\n }\n return null\n }, [releases, value._id, t])\n\n /**\n * If the document is not found, for example because it will be unpublished.\n * Then we don't want to render the preview of it. Because it shouldn't be possible\n * to link to a document that will be unpublished in this same release\n */\n if (!snapshot && !isLoading) return null\n return (\n <PreviewCard __unstable_focusRing onClick={onLinkToDocument} as=\"button\" radius={2}>\n <SanityDefaultPreview\n {...getPreviewValueWithFallback({snapshot, original, fallback: value})}\n isPlaceholder={isLoading}\n icon={schemaType.icon}\n layout=\"default\"\n status={\n badgeProps ? (\n <Text size={0}>\n {badgeProps.kind === 'release' ? (\n <ReleaseTitle title={badgeProps.releaseTitle} fallback={badgeProps.releaseFallback}>\n {({displayTitle}) => (\n <VersionInlineBadge $tone={badgeProps.tone}>{displayTitle}</VersionInlineBadge>\n )}\n </ReleaseTitle>\n ) : (\n <VersionInlineBadge $tone={badgeProps.tone}>{badgeProps.text}</VersionInlineBadge>\n )}\n </Text>\n ) : undefined\n }\n />\n </PreviewCard>\n )\n}\n","import {DEFAULT_MAX_FIELD_DEPTH} from '@sanity/schema/_internal'\nimport {type SanityDocumentLike} from '@sanity/types'\nimport {Box, Grid, Stack, Text, useToast} from '@sanity/ui'\nimport {useCallback, useMemo, useState} from 'react'\nimport {useObservableEvent} from 'react-rx'\nimport {catchError, concat, filter, map, type Observable, of, scan, switchMap, tap} from 'rxjs'\nimport {\n createSearch,\n DEFAULT_STUDIO_CLIENT_OPTIONS,\n getPublishedId,\n isDraftId,\n isNonNullable,\n isPublishedId,\n isVersionId,\n ReferenceAutocomplete,\n type SanityClient,\n type SchemaType,\n type SearchStrategy,\n useClient,\n useDocumentPreviewStore,\n useSchema,\n useSource,\n useTranslation,\n} from 'sanity'\n\nimport {structureLocaleNamespace} from '../../i18n'\nimport {CreateNewIncomingReference} from './CreateNewIncomingReference'\nimport {LinkToExistingPreview} from './LinkToExistingPreview'\nimport {type IncomingReferencesOptions} from './types'\n\ninterface ReferenceSearchState {\n hits: ReferenceSearchHit[]\n isLoading: boolean\n searchString?: string\n}\n\ninterface ReferenceOption {\n value: string\n hit: ReferenceSearchHit\n}\ninterface ReferenceSearchHit {\n _id: string\n _type: string\n}\n\nconst INITIAL_SEARCH_STATE: ReferenceSearchState = {\n hits: [],\n isLoading: false,\n}\nconst NO_FILTER = () => true\n\nconst incomingReferenceSearch = (\n client: SanityClient,\n schemaType: SchemaType,\n searchStrategy: SearchStrategy | undefined,\n): ((textTerm: string) => Observable<ReferenceSearchHit[]>) => {\n const search = createSearch([schemaType], client, {\n maxDepth: DEFAULT_MAX_FIELD_DEPTH,\n strategy: searchStrategy,\n tag: 'search.incoming-reference',\n })\n return (textTerm: string) =>\n search(textTerm, {perspective: 'raw'}).pipe(\n map(({hits}) => hits.map(({hit}) => hit)),\n map((docs) => {\n // We want to collate drafts and published documents into a single entry, but keep the versions as a separate entry\n const byId: Map<string, SanityDocumentLike> = new Map()\n\n docs.forEach((doc) => {\n if (isVersionId(doc._id)) {\n // We want to preserve version documents as a different entry.\n byId.set(doc._id, doc)\n return\n }\n const publishedId = getPublishedId(doc._id)\n const entry = byId.get(publishedId)\n if (!entry) {\n byId.set(publishedId, doc)\n // If the document is a draft and the entry is published, we want to keep the draft.\n } else if (isDraftId(doc._id) && isPublishedId(entry._id)) {\n byId.set(publishedId, doc)\n }\n })\n return Array.from(byId.values())\n }),\n map((collated) =>\n collated.map((entry) => ({\n _id: entry._id,\n _type: entry._type,\n })),\n ),\n map((docs) => docs.slice(0, 100)),\n )\n}\n\n/**\n * This component is responsible for two things:\n * 1) Search for the document type to add to the incoming references.\n * 2) Render the CreateNewIncomingReference button. Allowing users to add a new incoming reference.\n */\nexport function AddIncomingReference({\n type,\n referenced,\n onCreateNewReference,\n onLinkDocument,\n fieldName,\n creationAllowed,\n}: {\n type: string\n referenced: {id: string; type: string}\n onCreateNewReference: (id: string) => void\n onLinkDocument: (documentId: string) => void\n fieldName: string\n creationAllowed: IncomingReferencesOptions['creationAllowed']\n}) {\n const {t} = useTranslation(structureLocaleNamespace)\n const {push} = useToast()\n const schema = useSchema()\n const schemaType = schema.get(type)\n const client = useClient(DEFAULT_STUDIO_CLIENT_OPTIONS)\n const source = useSource()\n const {strategy: searchStrategy} = source.search\n const documentPreviewStore = useDocumentPreviewStore()\n const handleSearch = useMemo(\n () => incomingReferenceSearch(client, schemaType!, searchStrategy),\n [client, schemaType, searchStrategy],\n )\n\n const [searchState, setSearchState] = useState(INITIAL_SEARCH_STATE)\n const handleQueryChange = useObservableEvent((inputValue$: Observable<string | null>) => {\n return inputValue$.pipe(\n filter(isNonNullable),\n switchMap((searchString) =>\n concat(\n of({isLoading: true, hits: []}),\n handleSearch(searchString).pipe(\n map((hits) => ({hits, searchString, isLoading: false})),\n catchError((error) => {\n push({\n title: 'Reference search failed',\n description: error.message,\n status: 'error',\n id: `reference-search-fail-${type}`,\n })\n console.error(error)\n return of({hits: [], isLoading: false})\n }),\n ),\n ),\n ),\n\n scan(\n (prevState, nextState: ReferenceSearchState) => ({...prevState, ...nextState}),\n INITIAL_SEARCH_STATE,\n ),\n\n tap(setSearchState),\n )\n })\n\n const options: ReferenceOption[] = useMemo(() => {\n return searchState.hits.map((hit) => ({\n value: hit._id,\n hit: hit,\n }))\n }, [searchState.hits])\n\n const handleAutocompleteOpenButtonClick = useCallback(() => {\n handleQueryChange('')\n }, [handleQueryChange])\n\n const renderOption = useCallback(\n (option: ReferenceOption) => {\n return (\n <LinkToExistingPreview\n onLinkToDocument={() => onLinkDocument(option.value)}\n documentPreviewStore={documentPreviewStore}\n schemaType={schemaType!}\n value={option.hit}\n />\n )\n },\n [documentPreviewStore, schemaType, onLinkDocument],\n )\n\n return (\n <Stack space={2} padding={2}>\n <Box paddingY={2}>\n <Text size={1} weight=\"medium\">\n {t('incoming-references-input.reference-from', {type})}\n </Text>\n </Box>\n <Grid gap={creationAllowed ? 2 : 0} style={{gridTemplateColumns: '1fr min-content'}}>\n <ReferenceAutocomplete\n id={`${type}-autocomplete`}\n radius={2}\n autoFocus\n options={options}\n placeholder={t('incoming-references-input.type-to-search')}\n onQueryChange={handleQueryChange}\n filterOption={NO_FILTER}\n path={[]}\n // @ts-expect-error - Types are not derived correctly\n renderOption={renderOption}\n openButton={{onClick: handleAutocompleteOpenButtonClick}}\n referenceElement={null}\n loading={searchState.isLoading}\n />\n <CreateNewIncomingReference\n type={type}\n referenceToId={referenced.id}\n referenceToType={referenced.type}\n creationAllowed={creationAllowed}\n onCreateNewReference={onCreateNewReference}\n fieldName={fieldName}\n />\n </Grid>\n </Stack>\n )\n}\n","import {AddIcon} from '@sanity/icons'\nimport {type SanityDocument} from '@sanity/types'\nimport {Box, Card, Flex, Stack, Text, useToast} from '@sanity/ui'\nimport {useCallback, useEffect, useMemo, useState} from 'react'\nimport {useObservable} from 'react-rx'\nimport {\n CommandList,\n type CommandListRenderItemCallback,\n DEFAULT_STUDIO_CLIENT_OPTIONS,\n getDraftId,\n getPublishedId,\n isPublishedId,\n LoadingBlock,\n SanityDefaultPreview,\n useClient,\n useDocumentPreviewStore,\n useSchema,\n useSource,\n useTranslation,\n} from 'sanity'\n\nimport {Button} from '../../../ui-components/button/Button'\nimport {structureLocaleNamespace} from '../../i18n'\nimport {useDocumentPane} from '../../panes/document/useDocumentPane'\nimport {AddIncomingReference} from './AddIncomingReference'\nimport {CreateNewIncomingReference} from './CreateNewIncomingReference'\nimport {getIncomingReferences, INITIAL_STATE} from './getIncomingReferences'\nimport {IncomingReferenceDocument} from './IncomingReferenceDocument'\nimport {INCOMING_REFERENCES_ITEM_HEIGHT, IncomingReferencesListContainer} from './shared'\nimport {type IncomingReferencesOptions, type IncomingReferenceType} from './types'\n\nexport function IncomingReferencesType({\n type,\n referenced,\n onLinkDocument,\n actions,\n shouldRenderTitle,\n fieldName,\n creationAllowed,\n filter,\n filterParams,\n}: {\n shouldRenderTitle: boolean\n referenced: {id: string; type: string}\n fieldName: string\n type: IncomingReferenceType\n onLinkDocument: IncomingReferencesOptions['onLinkDocument']\n actions: IncomingReferencesOptions['actions']\n creationAllowed: IncomingReferencesOptions['creationAllowed']\n filter: IncomingReferencesOptions['filter']\n filterParams: IncomingReferencesOptions['filterParams']\n}) {\n const documentPreviewStore = useDocumentPreviewStore()\n const {displayed} = useDocumentPane()\n const {getClient} = useSource()\n const displayedId = displayed?._id as string\n /**\n * `filter` is a function or a string, if it's a function it will get a new reference on every render\n * `filterParams` is an object, so it will also get a new reference on every render.\n *\n * If they are not memoized the `references$` observable will be recreated on every render,\n * causing the list to jump even when the resolved GROQ filter is unchanged.\n *\n * It is safe to capture the initial values here because both come from the schema, not\n * from React render state. Schema changes reload the studio, so pinning the first reference for this mount\n * does not stale meaningful configuration.\n */\n const [memoizedFilter] = useState(() => filter)\n const [memoizedFilterParams] = useState(() => filterParams)\n\n const references$ = useMemo(\n () =>\n getIncomingReferences({\n documentId: displayedId,\n documentPreviewStore,\n type: type.type,\n filter: memoizedFilter,\n filterParams: memoizedFilterParams,\n getClient,\n }),\n [documentPreviewStore, type.type, memoizedFilter, memoizedFilterParams, displayedId, getClient],\n )\n\n const {documents, loading} = useObservable(references$, INITIAL_STATE)\n\n const schema = useSchema()\n const {t} = useTranslation(structureLocaleNamespace)\n const schemaType = schema.get(type.type)\n const client = useClient(DEFAULT_STUDIO_CLIENT_OPTIONS)\n const [isAdding, setIsAdding] = useState(false)\n const [newReferenceId, setNewReferenceId] = useState<string | null>(null)\n const {editState} = useDocumentPane()\n const toast = useToast()\n const handleAdd = useCallback(() => {\n setIsAdding((p) => !p)\n }, [])\n\n const publishedExists = Boolean(editState?.published)\n\n const handleCreateNewReference = useCallback(async (documentId: string) => {\n setIsAdding(false)\n setNewReferenceId(documentId)\n }, [])\n\n const handleLinkDocument = useCallback(\n async (documentId: string) => {\n setIsAdding(false)\n setNewReferenceId(documentId)\n try {\n const liveEdit = Boolean(schemaType?.liveEdit)\n const document = await client.fetch('*[_id == $id][0]', {id: documentId})\n\n const linkedDocument = onLinkDocument?.(document, {\n _type: 'reference',\n _ref: getPublishedId(referenced.id),\n ...(publishedExists ? {} : {_weak: true, _strengthenOnPublish: {type: referenced.type}}),\n })\n if (!linkedDocument) {\n toast.push({\n title: 'Not possible to link to document',\n description: 'The document you are trying to link cannot be linked to',\n status: 'error',\n })\n return\n }\n\n // if the document is published and the schema is not live edit, we want to update the draft id, not the published id\n // If it's a version, we can update the version document.\n if (isPublishedId(documentId) && !liveEdit) {\n linkedDocument._id = getDraftId(documentId)\n }\n await client.createOrReplace(linkedDocument)\n } catch (err) {\n // The fetch or write failed (e.g. insufficient permissions) —\n // tell the user.\n console.error(err)\n toast.push({\n title: 'Failed to link document',\n description: err instanceof Error ? err.message : undefined,\n status: 'error',\n })\n } finally {\n // Always clear the optimistic placeholder. The effect below also clears\n // it once the linked document shows up in `documents`, but that never\n // happens if the references stream has degraded to an empty list (e.g.\n // after a load error), so don't rely on it alone.\n setNewReferenceId(null)\n }\n },\n [client, onLinkDocument, referenced, publishedExists, toast, schemaType],\n )\n\n useEffect(() => {\n if (documents.length > 0 && newReferenceId) {\n // new reference is now part of the documents, we need to remove it from the newReferenceId state\n const isAdded = documents.find(\n (document) => getPublishedId(document._id) === getPublishedId(newReferenceId),\n )\n // oxlint-disable-next-line react/react-compiler\n if (isAdded) setNewReferenceId(null)\n }\n }, [documents, newReferenceId])\n\n const renderItem = useCallback<CommandListRenderItemCallback<SanityDocument>>(\n (document) => (\n <IncomingReferenceDocument\n document={document}\n referenceToId={referenced.id}\n actions={actions}\n />\n ),\n [referenced.id, actions],\n )\n\n if (!schemaType) return null\n if (loading) {\n return <LoadingBlock showText title={t('incoming-references-input.types-loading')} />\n }\n return (\n <Stack space={2} marginBottom={2}>\n {shouldRenderTitle && (\n <Box paddingY={2} paddingX={0}>\n <Text size={1} weight=\"medium\">\n {type.title || schemaType?.title}\n </Text>\n </Box>\n )}\n <Card radius={2} padding={1} border tone=\"default\">\n {documents.length > 0 ? (\n <IncomingReferencesListContainer $itemCount={documents.length}>\n <CommandList\n activeItemDataAttr=\"data-hovered\"\n ariaLabel={t('incoming-references-input.list-label', {\n type: type.title || schemaType?.title,\n })}\n canReceiveFocus\n fixedHeight\n getItemKey={(index) => documents[index]._id}\n itemHeight={INCOMING_REFERENCES_ITEM_HEIGHT}\n items={documents}\n onlyShowSelectionWhenActive\n overscan={5}\n renderItem={renderItem}\n wrapAround={false}\n />\n </IncomingReferencesListContainer>\n ) : (\n <>\n <Flex\n align=\"center\"\n justify=\"center\"\n padding={2}\n hidden={isAdding || Boolean(newReferenceId)}\n >\n <Text size={1} muted>\n {t('incoming-references-input.no-items')}\n </Text>\n </Flex>\n </>\n )}\n\n {newReferenceId && (\n <SanityDefaultPreview icon={schemaType.icon} layout={'default'} isPlaceholder />\n )}\n {isAdding && (\n <AddIncomingReference\n type={type.type}\n referenced={referenced}\n onCreateNewReference={handleCreateNewReference}\n onLinkDocument={handleLinkDocument}\n creationAllowed={creationAllowed}\n fieldName={fieldName}\n />\n )}\n </Card>\n {onLinkDocument ? (\n <Button\n size=\"large\"\n disabled={false}\n icon={AddIcon}\n mode=\"ghost\"\n onClick={handleAdd}\n text={t('incoming-references-input.add-reference-item')}\n />\n ) : (\n <CreateNewIncomingReference\n type={type.type}\n referenceToId={referenced.id}\n referenceToType={referenced.type}\n creationAllowed={creationAllowed}\n onCreateNewReference={handleCreateNewReference}\n fieldName={fieldName}\n />\n )}\n </Stack>\n )\n}\n","import {type SelectableTone} from '@sanity/ui'\nimport {\n type ActionComponent,\n type DocumentActionDialogProps,\n type PreviewConfig,\n type SanityClient,\n type SanityDocument,\n} from 'sanity'\n\nexport type IncomingReferenceActionsContext = {\n /**\n * The document that is linked to the reference.\n */\n document: SanityDocument\n getClient: (options: {apiVersion: string}) => SanityClient\n}\n\nexport type IncomingReferenceActionDescription = {\n label: string\n icon?: React.ElementType\n tone?: SelectableTone\n disabled?: boolean\n onHandle: (() => Promise<void>) | (() => void)\n dialog?: DocumentActionDialogProps | false | null\n}\n\n/**\n * Incoming reference action component definition.\n * Allows users to define actions that will be shown in the IncomingReferences component as part\n * of each reference\n * example:\n * ```ts\n * export const LogReferenceAction: IncomingReferenceAction = ({document, getClient}) => {\n * return {\n * label: 'Log reference',\n * icon: LogIcon,\n * onHandle: () => console.log(document._id)\n * }\n * }\n * ```\n *\n * @beta\n */\nexport type IncomingReferenceAction = ActionComponent<\n IncomingReferenceActionsContext,\n IncomingReferenceActionDescription\n>\n\nexport interface CrossDatasetIncomingReference {\n type: string\n title?: string\n dataset: string\n preview: PreviewConfig\n studioUrl?: (document: {id: string; type?: string}) => string | null\n}\n\nexport interface IncomingReferenceType {\n type: string\n dataset?: never\n title?: string\n}\n\nexport function isCrossDatasetIncomingReference(\n type: IncomingReferenceType | CrossDatasetIncomingReference,\n): type is CrossDatasetIncomingReference {\n return Boolean(type.dataset)\n}\n\nexport type IncomingReferencesFilterResolver = (context: {\n document: SanityDocument | undefined\n getClient: (options: {apiVersion: string}) => SanityClient\n}) =>\n | string\n | {filter: string; filterParams?: Record<string, string>}\n | Promise<{filter: string; filterParams?: Record<string, string>}>\n\nexport type IncomingReferencesOptions = {\n name: string\n title?: string\n description?: string\n /**\n * The type of the incoming references.\n */\n types: (IncomingReferenceType | CrossDatasetIncomingReference)[]\n\n /**\n * The filter query to apply to the incoming references in addition to the type filter.\n * For example: filter all books that are from an specific editorial brand: `editorialBrand == \"Random House\"`\n * The `_type` filter is applied automatically.\n */\n filter?: string | IncomingReferencesFilterResolver\n filterParams?: Record<string, string>\n\n /**\n * Callback to link a document to a reference.\n *\n * This function is called when a user wants to link an existing document to the current document.\n * It receives two parameters:\n * - The document that will be linked (the target document)\n * - The reference object with all properties needed to establish the link\n *\n * The developer must implement this function to define where and how the reference\n * should be placed within the document structure. The function should return the\n * modified document with the reference properly added.\n *\n * For example:\n * - We want to link a book to an author:\n * ```ts\n * onLinkDocument: (document, reference) => {\n * return {\n * ...document,\n * author: reference,\n * }\n * }\n * ```\n *\n *\n * @param document - The document to link to the reference.\n * @param reference - The reference to link to the document.\n * @returns The document to link to the reference. If false, the document will not be linked to the reference.\n */\n\n onLinkDocument?: (\n document: SanityDocument,\n reference: {\n _type: 'reference'\n _ref: string\n _weak?: boolean\n _strengthenOnPublish?: {\n type: string\n }\n },\n ) => SanityDocument | false\n /**\n * Callback to define the actions that will be shown for the incoming reference document.\n *\n * For example:\n * ```ts\n * actions: ({document, client}) => {\n * return [\n * {label: 'Unlink document',\n * icon: TrashIcon,\n * tone: 'critical',\n * onClick: async () => {\n * await client.createOrReplace({...document, _id: getDraftId(document._id), author: undefined})\n * }\n * }\n * ]\n * }\n * ```\n * @param context - The context of the linked document.\n * @returns The actions that will be shown for the linked document.\n\n */\n actions?: IncomingReferenceAction[]\n /**\n * Whether to allow creation of new references.\n * default: true\n *\n * If false, it will only be possible to link to existing documents, if the `onLinkDocument` callback is provided.\n * If true, it will be possible to create new references to any template of the type.\n * If an array is provided, it will only be possible to create new references that match the template id in the array provided.\n *\n * To define how a creation will be handled, you can use the `initialValue` option in the\n * document type that will be linked.\n *\n * For example:\n * I want to create a new book from an author:\n * In the author we will have the <IncomingReferenceInput /> with the creationAllowed set to true.\n *\n * Then in the book type, we will have the `initialValue` option to define the default values for the new book.\n * This initialValue callback will receive the `reference` object that needs to be linked to the book in the params.\n *\n * ```ts\n * // Book type\n * export default {\n * type: 'document',\n * name: 'book',\n * title: 'Book',\n * fields: [\n * {\n * name: 'author',\n * type: 'reference',\n * to: [{type: 'author'}],\n * },\n * ],\n * initialValue: (params) => {\n * return {\n * author: params?.reference,\n * }\n * }\n * ```\n */\n creationAllowed?: boolean | string[]\n}\n","import {Card, Flex, Stack, Text} from '@sanity/ui'\nimport {useTranslation} from 'sanity'\n\nimport {structureLocaleNamespace} from '../../i18n'\nimport {useDocumentPane} from '../../panes/document/useDocumentPane'\nimport {CrossDatasetIncomingReferenceType} from './CrossDatasetIncomingReference/CrossDatasetIncomingReferenceType'\nimport {IncomingReferencesType} from './IncomingReferencesType'\nimport {type IncomingReferencesOptions, isCrossDatasetIncomingReference} from './types'\n\nexport function IncomingReferencesList({\n types,\n onLinkDocument,\n actions,\n filter,\n filterParams,\n name,\n creationAllowed,\n}: IncomingReferencesOptions) {\n const {documentId, documentType} = useDocumentPane()\n const {t} = useTranslation(structureLocaleNamespace)\n\n if (!types || types?.length === 0) {\n return (\n <Card border radius={2} padding={3} tone=\"critical\">\n <Flex align=\"center\" justify=\"center\">\n <Text size={1} muted>\n {t('incoming-references-input.types-not-defined')}\n </Text>\n </Flex>\n </Card>\n )\n }\n\n return (\n <Stack space={3}>\n {types.map((type) => {\n if (isCrossDatasetIncomingReference(type)) {\n return (\n <CrossDatasetIncomingReferenceType\n key={`${type.type}-${type.dataset || ''}`}\n type={type}\n referenced={{id: documentId, type: documentType}}\n shouldRenderTitle={types.length > 1}\n />\n )\n }\n return (\n <IncomingReferencesType\n key={type.type}\n type={type}\n referenced={{id: documentId, type: documentType}}\n onLinkDocument={onLinkDocument}\n actions={actions}\n shouldRenderTitle={types.length > 1}\n fieldName={name}\n creationAllowed={creationAllowed}\n filter={filter}\n filterParams={filterParams}\n />\n )\n })}\n </Stack>\n )\n}\n","import {Box, Flex, Stack, Text} from '@sanity/ui'\nimport startCase from 'lodash-es/startCase.js'\n\nimport {IncomingReferencesList} from './IncomingReferencesList'\nimport {type IncomingReferencesOptions} from './types'\n\n/**\n * @beta\n */\nexport function IncomingReferencesDecoration(\n props: IncomingReferencesOptions & {\n name: string\n title?: string\n description?: string\n },\n) {\n const {\n onLinkDocument,\n actions,\n filter,\n filterParams,\n name,\n creationAllowed = true,\n types,\n title,\n description,\n } = props\n\n return (\n <Stack space={2}>\n <Box paddingY={2}>\n <Stack space={3}>\n <Flex align=\"center\" paddingY={1}>\n <Text as=\"label\" weight=\"medium\" size={1}>\n {title || startCase(name)}\n </Text>\n </Flex>\n\n {description && (\n <Text muted size={1}>\n {description}\n </Text>\n )}\n </Stack>\n </Box>\n <IncomingReferencesList\n name={name}\n types={types}\n onLinkDocument={onLinkDocument}\n actions={actions}\n filter={filter}\n filterParams={filterParams}\n creationAllowed={creationAllowed}\n />\n </Stack>\n )\n}\n","import {type DecorationMember} from 'sanity'\n\nimport {IncomingReferencesDecoration} from './IncomingReferencesDecoration'\nimport {type IncomingReferencesOptions} from './types'\n\n/**\n * Helper function to define an incoming references decoration.\n *\n * example:\n * ```ts\n * defineType({\n * name: 'author',\n * type: 'document',\n * renderMembers: (members) => {\n * return [\n * ...members,\n * defineIncomingReferenceDecoration({\n * name: 'incomingReferences',\n * title: 'Incoming references',\n * types: [{type: 'author'}],\n * }),\n * ]\n * },\n * })\n * ```\n *\n * @beta\n */\nexport function defineIncomingReferenceDecoration(\n options: IncomingReferencesOptions,\n): DecorationMember {\n return {\n kind: 'decoration',\n key: options.name,\n component: <IncomingReferencesDecoration {...options} />,\n }\n}\n","import {type DocumentDefinition} from 'sanity'\n\nexport interface IncomingReferenceCreationParams {\n reference: {\n _type: 'reference'\n _ref: string\n _weak?: boolean\n _strengthenOnPublish?: {\n type: string\n }\n }\n from: {\n fieldName: string\n type: string\n }\n __internal_isIncomingReferenceCreation: true\n [key: string]: unknown\n}\n\n/**\n * Helper function to check if the document is being created from an incoming reference.\n * It will be used in the initialValue callback to determine if the document is being created from an incoming reference.\n *\n * example:\n * ```ts\n * defineType({\n * name: 'book',\n * type: 'document',\n * fields: [...],\n * initialValue: (params) => {\n * // If the document is being created from an incoming reference, return the reference\n * // Otherwise, return undefined\n * return {\n * author: isIncomingReferenceCreation(params) ? params.reference : undefined,\n * }\n * },\n * })\n * ```\n *\n * @beta\n */\nexport function isIncomingReferenceCreation(\n initialValue: DocumentDefinition['initialValue'],\n): initialValue is IncomingReferenceCreationParams {\n return (\n typeof initialValue === 'object' &&\n initialValue !== null &&\n '__internal_isIncomingReferenceCreation' in initialValue\n )\n}\n"],"names":["CrossDatasetIncomingReferenceType","t0","$","_c","type","referenced","shouldRenderTitle","client","useClient","DEFAULT_STUDIO_CLIENT_OPTIONS","documentPreviewStore","useDocumentPreviewStore","t1","id","getCrossDatasetIncomingReferences","documentId","references$","documents","loading","useObservable","INITIAL_STATE","schema","useSchema","t","useTranslation","structureLocaleNamespace","T0","T1","t10","t2","t3","t4","t5","t6","t7","t8","t9","Symbol","for","bb0","schemaType","get","t11","document","renderItem","t12","t13","Stack","title","Card","length","index","INCOMING_REFERENCES_ITEM_HEIGHT","CreateNewIncomingReference","referenceToId","referenceToType","onCreateNewReference","fieldName","creationAllowed","initialValueTemplateItems","useReferenceInputOptions","navigate","useRouter","routerPanesState","groupIndex","usePaneRouter","option","uuid","panes","slice","getPublishedId","params","template","payload","reference","_type","_ref","_weak","_strengthenOnPublish","from","__internal_isIncomingReferenceCreation","handleCreate","i","typeMatch","Array","isArray","includes","filter","map","_temp","isNonNullable","createOptions","item","i18n","icon","parameters","permission","granted","reason","undefined","getPerspective","isDraftId","isVersionId","getVersionFromId","isPublishedId","LinkToExistingPreview","props","value","onLinkToDocument","data","releases","useActiveReleases","_id","getPreviewStateObservable","previewStateObservable","snapshot","isLoading","original","getReleaseTone","kind","tone","text","releaseId","r","getReleaseIdFromReleaseDocumentId","release","find","releaseTitle","metadata","releaseFallback","badgeProps","getPreviewValueWithFallback","fallback","displayTitle","INITIAL_SEARCH_STATE","hits","NO_FILTER","incomingReferenceSearch","searchStrategy","search","createSearch","maxDepth","DEFAULT_MAX_FIELD_DEPTH","strategy","tag","textTerm","perspective","pipe","hit","docs","byId","Map","forEach","doc","set","publishedId","entry","values","collated","AddIncomingReference","onLinkDocument","push","useToast","source","useSource","handleSearch","searchState","setSearchState","useState","inputValue$","switchMap","searchString","concat","of","catchError","error","description","message","status","console","scan","tap","handleQueryChange","useObservableEvent","_temp2","options","handleAutocompleteOpenButtonClick","renderOption","gridTemplateColumns","t14","onClick","t15","t16","t17","t18","prevState","nextState","IncomingReferencesType","actions","filterParams","displayed","useDocumentPane","getClient","displayedId","memoizedFilter","memoizedFilterParams","useMemo","getIncomingReferences","isAdding","setIsAdding","newReferenceId","setNewReferenceId","editState","toast","handleAdd","useCallback","p","publishedExists","Boolean","published","handleCreateNewReference","handleLinkDocument","liveEdit","fetch","linkedDocument","getDraftId","createOrReplace","err","Error","useEffect","AddIcon","isCrossDatasetIncomingReference","dataset","IncomingReferencesList","types","name","documentType","IncomingReferencesDecoration","startCase","defineIncomingReferenceDecoration","key","component","isIncomingReferenceCreation","initialValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBO,SAAAA,kCAAAC,IAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAA2C;AAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,EAAAA,IAAAL,IAShDM,SAAeC,UAAUC,6BAA6B,GACtDC,uBAA6BC,wBAAAA;AAAyB,MAAAC;AAAAV,IAAA,CAAA,MAAAK,UAAAL,SAAAQ,wBAAAR,EAAA,CAAA,MAAAG,WAAAQ,MAAAX,SAAAE,QAIlDQ,KAAAE,kCAAkC;AAAA,IAAAC,YACpBV,WAAUQ;AAAAA,IAAGN;AAAAA,IAAAH;AAAAA,IAAAM;AAAAA,EAAAA,CAI1B,GAACR,OAAAK,QAAAL,OAAAQ,sBAAAR,EAAA,CAAA,IAAAG,WAAAQ,IAAAX,OAAAE,MAAAF,OAAAU,MAAAA,KAAAV,EAAA,CAAA;AAPN,QAAAc,cAEIJ,IASJ;AAAA,IAAAK;AAAAA,IAAAC;AAAAA,EAAAA,IAA6BC,cAAcH,aAAaI,aAAa,GAErEC,SAAeC,aACf;AAAA,IAAAC;AAAAA,EAAAA,IAAYC,eAAeC,wBAAwB;AAAC,MAAAC,IAAAC,IAAAC,KAAAC,IAAAC,IAAAC,IAAAC,IAAAC,IAAAC,IAAAC,IAAAC;AAAA,MAAAlC,SAAAe,aAAAf,EAAA,CAAA,MAAAgB,WAAAhB,EAAA,CAAA,MAAAmB,UAAAnB,EAAA,CAAA,MAAAI,qBAAAJ,SAAAqB,KAAArB,EAAA,EAAA,MAAAE,MAAA;AAU5BwB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D,QAAQkD;AAAAA,IACbM,WAAW,oBAAC,8BAAA,EAA6B,GAAIxD,QAAAA,CAAQ;AAAA,EAAA;AAEzD;ACKO,SAASyD,4BACdC,cACiD;AACjD,SACE,OAAOA,gBAAiB,YACxBA,iBAAiB,QACjB,4CAA4CA;AAEhD;"}
|
|
1
|
+
{"version":3,"file":"structure.js","sources":["../src/structure/components/incomingReferencesDecoration/CrossDatasetIncomingReference/CrossDatasetIncomingReferenceType.tsx","../src/structure/components/incomingReferencesDecoration/CreateNewIncomingReference.tsx","../src/structure/components/incomingReferencesDecoration/LinkToExistingPreview.tsx","../src/structure/components/incomingReferencesDecoration/AddIncomingReference.tsx","../src/structure/components/incomingReferencesDecoration/IncomingReferencesType.tsx","../src/structure/components/incomingReferencesDecoration/types.ts","../src/structure/components/incomingReferencesDecoration/IncomingReferencesList.tsx","../src/structure/components/incomingReferencesDecoration/IncomingReferencesDecoration.tsx","../src/structure/components/incomingReferencesDecoration/defineIncomingReferenceDecoration.tsx","../src/structure/components/incomingReferencesDecoration/isIncomingReferenceCreation.ts"],"sourcesContent":["import {Box, Card, Flex, Stack, Text} from '@sanity/ui'\nimport {useCallback, useMemo} from 'react'\nimport {useObservable} from 'react-rx'\nimport {\n CommandList,\n type CommandListRenderItemCallback,\n DEFAULT_STUDIO_CLIENT_OPTIONS,\n LoadingBlock,\n useClient,\n useDocumentPreviewStore,\n useSchema,\n useTranslation,\n} from 'sanity'\n\nimport {structureLocaleNamespace} from '../../../i18n'\nimport {INITIAL_STATE} from '../getIncomingReferences'\nimport {INCOMING_REFERENCES_ITEM_HEIGHT, IncomingReferencesListContainer} from '../shared'\nimport {type CrossDatasetIncomingReference} from '../types'\nimport {CrossDatasetIncomingReferenceDocumentPreview} from './CrossDatasetIncomingReferenceDocumentPreview'\nimport {\n type CrossDatasetIncomingReferenceDocument,\n getCrossDatasetIncomingReferences,\n} from './getCrossDatasetIncomingReferences'\n\nexport function CrossDatasetIncomingReferenceType({\n type,\n referenced,\n shouldRenderTitle,\n}: {\n shouldRenderTitle: boolean\n referenced: {id: string; type: string}\n type: CrossDatasetIncomingReference\n}) {\n const client = useClient(DEFAULT_STUDIO_CLIENT_OPTIONS)\n const documentPreviewStore = useDocumentPreviewStore()\n\n const references$ = useMemo(\n () =>\n getCrossDatasetIncomingReferences({\n documentId: referenced.id,\n client,\n type: type,\n documentPreviewStore,\n }),\n [client, type, referenced.id, documentPreviewStore],\n )\n\n const {documents, loading} = useObservable(references$, INITIAL_STATE)\n\n const schema = useSchema()\n const {t} = useTranslation(structureLocaleNamespace)\n const schemaType = schema.get(type.type)\n\n const renderItem = useCallback<\n CommandListRenderItemCallback<CrossDatasetIncomingReferenceDocument>\n >(\n (document) => <CrossDatasetIncomingReferenceDocumentPreview document={document} type={type} />,\n [type],\n )\n\n if (!schemaType) return null\n if (loading) {\n return <LoadingBlock showText title={t('incoming-references-input.types-loading')} />\n }\n return (\n <Stack space={2} marginBottom={2}>\n {shouldRenderTitle && (\n <Box paddingY={2} paddingX={0}>\n <Text size={1} weight=\"medium\">\n {type.title || schemaType?.title}\n </Text>\n </Box>\n )}\n <Card radius={2} padding={1} border tone=\"default\">\n {documents && documents.length > 0 ? (\n <IncomingReferencesListContainer $itemCount={documents.length}>\n <CommandList\n activeItemDataAttr=\"data-hovered\"\n ariaLabel={t('incoming-references-input.list-label', {\n type: type.title || schemaType?.title,\n })}\n canReceiveFocus\n fixedHeight\n getItemKey={(index) => documents[index].id}\n itemHeight={INCOMING_REFERENCES_ITEM_HEIGHT}\n items={documents}\n onlyShowSelectionWhenActive\n overscan={5}\n renderItem={renderItem}\n wrapAround={false}\n />\n </IncomingReferencesListContainer>\n ) : (\n <>\n <Flex align=\"center\" justify=\"center\" padding={2}>\n <Text size={1} muted>\n {t('incoming-references-input.no-items')}\n </Text>\n </Flex>\n </>\n )}\n </Card>\n </Stack>\n )\n}\n","import {uuid} from '@sanity/uuid'\nimport {useCallback, useMemo} from 'react'\nimport {\n CreateReferenceButton,\n type CreateReferenceOption,\n getPublishedId,\n isNonNullable,\n useReferenceInputOptions,\n} from 'sanity'\nimport {useRouter} from 'sanity/router'\n\nimport {usePaneRouter} from '../paneRouter'\nimport {type IncomingReferenceCreationParams} from './isIncomingReferenceCreation'\nimport {type IncomingReferencesOptions} from './types'\n\nexport function CreateNewIncomingReference({\n type,\n referenceToId,\n referenceToType,\n onCreateNewReference,\n fieldName,\n creationAllowed,\n}: {\n type: string\n referenceToId: string\n referenceToType: string\n onCreateNewReference: (id: string) => void\n fieldName: string\n creationAllowed: IncomingReferencesOptions['creationAllowed']\n}) {\n const {initialValueTemplateItems} = useReferenceInputOptions()\n\n const {navigate} = useRouter()\n const {routerPanesState, groupIndex} = usePaneRouter()\n\n const handleCreate = useCallback(\n (option: CreateReferenceOption) => {\n const id = uuid()\n navigate({\n panes: [\n ...routerPanesState.slice(0, groupIndex + 1),\n [\n {\n id: getPublishedId(id),\n params: {type, template: option.template.id},\n payload: {\n reference: {\n _type: 'reference',\n _ref: referenceToId,\n _weak: true,\n _strengthenOnPublish: {type: referenceToType},\n },\n from: {fieldName, type: referenceToType},\n __internal_isIncomingReferenceCreation: true,\n } satisfies IncomingReferenceCreationParams,\n },\n ],\n ],\n })\n onCreateNewReference(id)\n },\n [\n type,\n navigate,\n routerPanesState,\n groupIndex,\n referenceToId,\n referenceToType,\n onCreateNewReference,\n fieldName,\n ],\n )\n\n const createOptions = useMemo(() => {\n if (!creationAllowed) return []\n return (initialValueTemplateItems || [])\n\n .filter((i) => {\n const typeMatch = type === i.template?.schemaType\n if (Array.isArray(creationAllowed)) {\n // Check if the template id is in the creationAllowed array\n return typeMatch && creationAllowed.includes(i.template.id)\n }\n return typeMatch\n })\n .map((item): CreateReferenceOption | undefined =>\n item.template?.schemaType\n ? {\n id: item.id,\n title: item.title || `${item.template.schemaType} from template ${item.template?.id}`,\n i18n: item.i18n,\n type: item.template.schemaType,\n icon: item.icon,\n template: {\n id: item.template?.id,\n params: item.parameters,\n },\n\n permission: {granted: item.granted, reason: item.reason},\n }\n : undefined,\n )\n .filter(isNonNullable)\n }, [creationAllowed, initialValueTemplateItems, type])\n\n if (!creationAllowed) {\n return null\n }\n return (\n <CreateReferenceButton\n id={`create-new-incoming-reference-${type}`}\n createOptions={createOptions}\n onCreate={handleCreate}\n />\n )\n}\n","import {type SchemaType} from '@sanity/types'\nimport {type BadgeTone, Text} from '@sanity/ui'\nimport {useMemo} from 'react'\nimport {useObservable} from 'react-rx'\nimport {\n type DocumentPreviewStore,\n getPreviewStateObservable,\n getPreviewValueWithFallback,\n getReleaseIdFromReleaseDocumentId,\n getReleaseTone,\n getVersionFromId,\n isDraftId,\n isPublishedId,\n isVersionId,\n PreviewCard,\n ReleaseTitle,\n SanityDefaultPreview,\n useActiveReleases,\n useTranslation,\n VersionInlineBadge,\n} from 'sanity'\n\nexport interface LinkToExistingPreviewProps {\n documentPreviewStore: DocumentPreviewStore\n schemaType: SchemaType\n value: {_id: string; _type: string}\n onLinkToDocument: () => void\n}\n\nconst getPerspective = (id: string) => {\n if (isDraftId(id)) return ['drafts']\n if (isVersionId(id)) return [getVersionFromId(id) as string]\n if (isPublishedId(id)) return ['published']\n return ['raw']\n}\n\nexport function LinkToExistingPreview(props: LinkToExistingPreviewProps) {\n const {schemaType, value, onLinkToDocument} = props\n const {data: releases} = useActiveReleases()\n const {t} = useTranslation()\n\n const previewStateObservable = useMemo(() => {\n return getPreviewStateObservable(\n props.documentPreviewStore,\n schemaType,\n value._id,\n getPerspective(value._id),\n )\n }, [props.documentPreviewStore, schemaType, value._id])\n\n const {snapshot, original, isLoading} = useObservable(previewStateObservable, {\n snapshot: null,\n isLoading: true,\n original: null,\n })\n\n const badgeProps = useMemo(():\n | {kind: 'static'; tone: BadgeTone; text: string}\n | {kind: 'release'; tone: BadgeTone; releaseTitle: string | undefined; releaseFallback: string}\n | null => {\n const id = value._id\n if (isDraftId(id)) {\n return {\n kind: 'static',\n tone: getReleaseTone('drafts'),\n text: t('release.chip.draft'),\n }\n }\n if (isPublishedId(id)) {\n return {\n kind: 'static',\n tone: getReleaseTone('published'),\n text: t('release.chip.published'),\n }\n }\n if (isVersionId(id)) {\n const releaseId = getVersionFromId(id)\n const release = releases.find((r) => getReleaseIdFromReleaseDocumentId(r._id) === releaseId)\n if (release) {\n return {\n kind: 'release',\n tone: getReleaseTone(release),\n releaseTitle: release.metadata.title,\n releaseFallback: release._id,\n }\n }\n }\n return null\n }, [releases, value._id, t])\n\n /**\n * If the document is not found, for example because it will be unpublished.\n * Then we don't want to render the preview of it. Because it shouldn't be possible\n * to link to a document that will be unpublished in this same release\n */\n if (!snapshot && !isLoading) return null\n return (\n <PreviewCard __unstable_focusRing onClick={onLinkToDocument} as=\"button\" radius={2}>\n <SanityDefaultPreview\n {...getPreviewValueWithFallback({snapshot, original, fallback: value})}\n isPlaceholder={isLoading}\n icon={schemaType.icon}\n layout=\"default\"\n status={\n badgeProps ? (\n <Text size={0}>\n {badgeProps.kind === 'release' ? (\n <ReleaseTitle title={badgeProps.releaseTitle} fallback={badgeProps.releaseFallback}>\n {({displayTitle}) => (\n <VersionInlineBadge $tone={badgeProps.tone}>{displayTitle}</VersionInlineBadge>\n )}\n </ReleaseTitle>\n ) : (\n <VersionInlineBadge $tone={badgeProps.tone}>{badgeProps.text}</VersionInlineBadge>\n )}\n </Text>\n ) : undefined\n }\n />\n </PreviewCard>\n )\n}\n","import {DEFAULT_MAX_FIELD_DEPTH} from '@sanity/schema/_internal'\nimport {type SanityDocumentLike} from '@sanity/types'\nimport {Box, Grid, Stack, Text, useToast} from '@sanity/ui'\nimport {useCallback, useMemo, useState} from 'react'\nimport {useObservableEvent} from 'react-rx'\nimport {catchError, concat, filter, map, type Observable, of, scan, switchMap, tap} from 'rxjs'\nimport {\n createSearch,\n DEFAULT_STUDIO_CLIENT_OPTIONS,\n getPublishedId,\n isDraftId,\n isNonNullable,\n isPublishedId,\n isVersionId,\n ReferenceAutocomplete,\n type SanityClient,\n type SchemaType,\n type SearchStrategy,\n useClient,\n useDocumentPreviewStore,\n useSchema,\n useSource,\n useTranslation,\n} from 'sanity'\n\nimport {structureLocaleNamespace} from '../../i18n'\nimport {CreateNewIncomingReference} from './CreateNewIncomingReference'\nimport {LinkToExistingPreview} from './LinkToExistingPreview'\nimport {type IncomingReferencesOptions} from './types'\n\ninterface ReferenceSearchState {\n hits: ReferenceSearchHit[]\n isLoading: boolean\n searchString?: string\n}\n\ninterface ReferenceOption {\n value: string\n hit: ReferenceSearchHit\n}\ninterface ReferenceSearchHit {\n _id: string\n _type: string\n}\n\nconst INITIAL_SEARCH_STATE: ReferenceSearchState = {\n hits: [],\n isLoading: false,\n}\nconst NO_FILTER = () => true\n\nconst incomingReferenceSearch = (\n client: SanityClient,\n schemaType: SchemaType,\n searchStrategy: SearchStrategy | undefined,\n): ((textTerm: string) => Observable<ReferenceSearchHit[]>) => {\n const search = createSearch([schemaType], client, {\n maxDepth: DEFAULT_MAX_FIELD_DEPTH,\n strategy: searchStrategy,\n tag: 'search.incoming-reference',\n })\n return (textTerm: string) =>\n search(textTerm, {perspective: 'raw'}).pipe(\n map(({hits}) => hits.map(({hit}) => hit)),\n map((docs) => {\n // We want to collate drafts and published documents into a single entry, but keep the versions as a separate entry\n const byId: Map<string, SanityDocumentLike> = new Map()\n\n docs.forEach((doc) => {\n if (isVersionId(doc._id)) {\n // We want to preserve version documents as a different entry.\n byId.set(doc._id, doc)\n return\n }\n const publishedId = getPublishedId(doc._id)\n const entry = byId.get(publishedId)\n if (!entry) {\n byId.set(publishedId, doc)\n // If the document is a draft and the entry is published, we want to keep the draft.\n } else if (isDraftId(doc._id) && isPublishedId(entry._id)) {\n byId.set(publishedId, doc)\n }\n })\n return Array.from(byId.values())\n }),\n map((collated) =>\n collated.map((entry) => ({\n _id: entry._id,\n _type: entry._type,\n })),\n ),\n map((docs) => docs.slice(0, 100)),\n )\n}\n\n/**\n * This component is responsible for two things:\n * 1) Search for the document type to add to the incoming references.\n * 2) Render the CreateNewIncomingReference button. Allowing users to add a new incoming reference.\n */\nexport function AddIncomingReference({\n type,\n referenced,\n onCreateNewReference,\n onLinkDocument,\n fieldName,\n creationAllowed,\n}: {\n type: string\n referenced: {id: string; type: string}\n onCreateNewReference: (id: string) => void\n onLinkDocument: (documentId: string) => void\n fieldName: string\n creationAllowed: IncomingReferencesOptions['creationAllowed']\n}) {\n const {t} = useTranslation(structureLocaleNamespace)\n const {push} = useToast()\n const schema = useSchema()\n const schemaType = schema.get(type)\n const client = useClient(DEFAULT_STUDIO_CLIENT_OPTIONS)\n const source = useSource()\n const {strategy: searchStrategy} = source.search\n const documentPreviewStore = useDocumentPreviewStore()\n const handleSearch = useMemo(\n () => incomingReferenceSearch(client, schemaType!, searchStrategy),\n [client, schemaType, searchStrategy],\n )\n\n const [searchState, setSearchState] = useState(INITIAL_SEARCH_STATE)\n const handleQueryChange = useObservableEvent((inputValue$: Observable<string | null>) => {\n return inputValue$.pipe(\n filter(isNonNullable),\n switchMap((searchString) =>\n concat(\n of({isLoading: true, hits: []}),\n handleSearch(searchString).pipe(\n map((hits) => ({hits, searchString, isLoading: false})),\n catchError((error) => {\n push({\n title: 'Reference search failed',\n description: error.message,\n status: 'error',\n id: `reference-search-fail-${type}`,\n })\n console.error(error)\n return of({hits: [], isLoading: false})\n }),\n ),\n ),\n ),\n\n scan(\n (prevState, nextState: ReferenceSearchState) => ({...prevState, ...nextState}),\n INITIAL_SEARCH_STATE,\n ),\n\n tap(setSearchState),\n )\n })\n\n const options: ReferenceOption[] = useMemo(() => {\n return searchState.hits.map((hit) => ({\n value: hit._id,\n hit: hit,\n }))\n }, [searchState.hits])\n\n const handleAutocompleteOpenButtonClick = useCallback(() => {\n handleQueryChange('')\n }, [handleQueryChange])\n\n const renderOption = useCallback(\n (option: ReferenceOption) => {\n return (\n <LinkToExistingPreview\n onLinkToDocument={() => onLinkDocument(option.value)}\n documentPreviewStore={documentPreviewStore}\n schemaType={schemaType!}\n value={option.hit}\n />\n )\n },\n [documentPreviewStore, schemaType, onLinkDocument],\n )\n\n return (\n <Stack space={2} padding={2}>\n <Box paddingY={2}>\n <Text size={1} weight=\"medium\">\n {t('incoming-references-input.reference-from', {type})}\n </Text>\n </Box>\n <Grid gap={creationAllowed ? 2 : 0} style={{gridTemplateColumns: '1fr min-content'}}>\n <ReferenceAutocomplete\n id={`${type}-autocomplete`}\n radius={2}\n autoFocus\n options={options}\n placeholder={t('incoming-references-input.type-to-search')}\n onQueryChange={handleQueryChange}\n filterOption={NO_FILTER}\n path={[]}\n // @ts-expect-error - Types are not derived correctly\n renderOption={renderOption}\n openButton={{onClick: handleAutocompleteOpenButtonClick}}\n referenceElement={null}\n loading={searchState.isLoading}\n />\n <CreateNewIncomingReference\n type={type}\n referenceToId={referenced.id}\n referenceToType={referenced.type}\n creationAllowed={creationAllowed}\n onCreateNewReference={onCreateNewReference}\n fieldName={fieldName}\n />\n </Grid>\n </Stack>\n )\n}\n","import {AddIcon} from '@sanity/icons/Add'\nimport {type SanityDocument} from '@sanity/types'\nimport {Box, Card, Flex, Stack, Text, useToast} from '@sanity/ui'\nimport {useCallback, useEffect, useMemo, useState} from 'react'\nimport {useObservable} from 'react-rx'\nimport {\n CommandList,\n type CommandListRenderItemCallback,\n DEFAULT_STUDIO_CLIENT_OPTIONS,\n getDraftId,\n getPublishedId,\n isPublishedId,\n LoadingBlock,\n SanityDefaultPreview,\n useClient,\n useDocumentPreviewStore,\n useSchema,\n useSource,\n useTranslation,\n} from 'sanity'\n\nimport {Button} from '../../../ui-components/button/Button'\nimport {structureLocaleNamespace} from '../../i18n'\nimport {useDocumentPane} from '../../panes/document/useDocumentPane'\nimport {AddIncomingReference} from './AddIncomingReference'\nimport {CreateNewIncomingReference} from './CreateNewIncomingReference'\nimport {getIncomingReferences, INITIAL_STATE} from './getIncomingReferences'\nimport {IncomingReferenceDocument} from './IncomingReferenceDocument'\nimport {INCOMING_REFERENCES_ITEM_HEIGHT, IncomingReferencesListContainer} from './shared'\nimport {type IncomingReferencesOptions, type IncomingReferenceType} from './types'\n\nexport function IncomingReferencesType({\n type,\n referenced,\n onLinkDocument,\n actions,\n shouldRenderTitle,\n fieldName,\n creationAllowed,\n filter,\n filterParams,\n}: {\n shouldRenderTitle: boolean\n referenced: {id: string; type: string}\n fieldName: string\n type: IncomingReferenceType\n onLinkDocument: IncomingReferencesOptions['onLinkDocument']\n actions: IncomingReferencesOptions['actions']\n creationAllowed: IncomingReferencesOptions['creationAllowed']\n filter: IncomingReferencesOptions['filter']\n filterParams: IncomingReferencesOptions['filterParams']\n}) {\n const documentPreviewStore = useDocumentPreviewStore()\n const {displayed} = useDocumentPane()\n const {getClient} = useSource()\n const displayedId = displayed?._id as string\n /**\n * `filter` is a function or a string, if it's a function it will get a new reference on every render\n * `filterParams` is an object, so it will also get a new reference on every render.\n *\n * If they are not memoized the `references$` observable will be recreated on every render,\n * causing the list to jump even when the resolved GROQ filter is unchanged.\n *\n * It is safe to capture the initial values here because both come from the schema, not\n * from React render state. Schema changes reload the studio, so pinning the first reference for this mount\n * does not stale meaningful configuration.\n */\n const [memoizedFilter] = useState(() => filter)\n const [memoizedFilterParams] = useState(() => filterParams)\n\n const references$ = useMemo(\n () =>\n getIncomingReferences({\n documentId: displayedId,\n documentPreviewStore,\n type: type.type,\n filter: memoizedFilter,\n filterParams: memoizedFilterParams,\n getClient,\n }),\n [documentPreviewStore, type.type, memoizedFilter, memoizedFilterParams, displayedId, getClient],\n )\n\n const {documents, loading} = useObservable(references$, INITIAL_STATE)\n\n const schema = useSchema()\n const {t} = useTranslation(structureLocaleNamespace)\n const schemaType = schema.get(type.type)\n const client = useClient(DEFAULT_STUDIO_CLIENT_OPTIONS)\n const [isAdding, setIsAdding] = useState(false)\n const [newReferenceId, setNewReferenceId] = useState<string | null>(null)\n const {editState} = useDocumentPane()\n const toast = useToast()\n const handleAdd = useCallback(() => {\n setIsAdding((p) => !p)\n }, [])\n\n const publishedExists = Boolean(editState?.published)\n\n const handleCreateNewReference = useCallback(async (documentId: string) => {\n setIsAdding(false)\n setNewReferenceId(documentId)\n }, [])\n\n const handleLinkDocument = useCallback(\n async (documentId: string) => {\n setIsAdding(false)\n setNewReferenceId(documentId)\n try {\n const liveEdit = Boolean(schemaType?.liveEdit)\n const document = await client.fetch('*[_id == $id][0]', {id: documentId})\n\n const linkedDocument = onLinkDocument?.(document, {\n _type: 'reference',\n _ref: getPublishedId(referenced.id),\n ...(publishedExists ? {} : {_weak: true, _strengthenOnPublish: {type: referenced.type}}),\n })\n if (!linkedDocument) {\n toast.push({\n title: 'Not possible to link to document',\n description: 'The document you are trying to link cannot be linked to',\n status: 'error',\n })\n return\n }\n\n // if the document is published and the schema is not live edit, we want to update the draft id, not the published id\n // If it's a version, we can update the version document.\n if (isPublishedId(documentId) && !liveEdit) {\n linkedDocument._id = getDraftId(documentId)\n }\n await client.createOrReplace(linkedDocument)\n } catch (err) {\n // The fetch or write failed (e.g. insufficient permissions) —\n // tell the user.\n console.error(err)\n toast.push({\n title: 'Failed to link document',\n description: err instanceof Error ? err.message : undefined,\n status: 'error',\n })\n } finally {\n // Always clear the optimistic placeholder. The effect below also clears\n // it once the linked document shows up in `documents`, but that never\n // happens if the references stream has degraded to an empty list (e.g.\n // after a load error), so don't rely on it alone.\n setNewReferenceId(null)\n }\n },\n [client, onLinkDocument, referenced, publishedExists, toast, schemaType],\n )\n\n useEffect(() => {\n if (documents.length > 0 && newReferenceId) {\n // new reference is now part of the documents, we need to remove it from the newReferenceId state\n const isAdded = documents.find(\n (document) => getPublishedId(document._id) === getPublishedId(newReferenceId),\n )\n // oxlint-disable-next-line react/react-compiler\n if (isAdded) setNewReferenceId(null)\n }\n }, [documents, newReferenceId])\n\n const renderItem = useCallback<CommandListRenderItemCallback<SanityDocument>>(\n (document) => (\n <IncomingReferenceDocument\n document={document}\n referenceToId={referenced.id}\n actions={actions}\n />\n ),\n [referenced.id, actions],\n )\n\n if (!schemaType) return null\n if (loading) {\n return <LoadingBlock showText title={t('incoming-references-input.types-loading')} />\n }\n return (\n <Stack space={2} marginBottom={2}>\n {shouldRenderTitle && (\n <Box paddingY={2} paddingX={0}>\n <Text size={1} weight=\"medium\">\n {type.title || schemaType?.title}\n </Text>\n </Box>\n )}\n <Card radius={2} padding={1} border tone=\"default\">\n {documents.length > 0 ? (\n <IncomingReferencesListContainer $itemCount={documents.length}>\n <CommandList\n activeItemDataAttr=\"data-hovered\"\n ariaLabel={t('incoming-references-input.list-label', {\n type: type.title || schemaType?.title,\n })}\n canReceiveFocus\n fixedHeight\n getItemKey={(index) => documents[index]._id}\n itemHeight={INCOMING_REFERENCES_ITEM_HEIGHT}\n items={documents}\n onlyShowSelectionWhenActive\n overscan={5}\n renderItem={renderItem}\n wrapAround={false}\n />\n </IncomingReferencesListContainer>\n ) : (\n <>\n <Flex\n align=\"center\"\n justify=\"center\"\n padding={2}\n hidden={isAdding || Boolean(newReferenceId)}\n >\n <Text size={1} muted>\n {t('incoming-references-input.no-items')}\n </Text>\n </Flex>\n </>\n )}\n\n {newReferenceId && (\n <SanityDefaultPreview icon={schemaType.icon} layout={'default'} isPlaceholder />\n )}\n {isAdding && (\n <AddIncomingReference\n type={type.type}\n referenced={referenced}\n onCreateNewReference={handleCreateNewReference}\n onLinkDocument={handleLinkDocument}\n creationAllowed={creationAllowed}\n fieldName={fieldName}\n />\n )}\n </Card>\n {onLinkDocument ? (\n <Button\n size=\"large\"\n disabled={false}\n icon={AddIcon}\n mode=\"ghost\"\n onClick={handleAdd}\n text={t('incoming-references-input.add-reference-item')}\n />\n ) : (\n <CreateNewIncomingReference\n type={type.type}\n referenceToId={referenced.id}\n referenceToType={referenced.type}\n creationAllowed={creationAllowed}\n onCreateNewReference={handleCreateNewReference}\n fieldName={fieldName}\n />\n )}\n </Stack>\n )\n}\n","import {type SelectableTone} from '@sanity/ui'\nimport {\n type ActionComponent,\n type DocumentActionDialogProps,\n type PreviewConfig,\n type SanityClient,\n type SanityDocument,\n} from 'sanity'\n\nexport type IncomingReferenceActionsContext = {\n /**\n * The document that is linked to the reference.\n */\n document: SanityDocument\n getClient: (options: {apiVersion: string}) => SanityClient\n}\n\nexport type IncomingReferenceActionDescription = {\n label: string\n icon?: React.ElementType\n tone?: SelectableTone\n disabled?: boolean\n onHandle: (() => Promise<void>) | (() => void)\n dialog?: DocumentActionDialogProps | false | null\n}\n\n/**\n * Incoming reference action component definition.\n * Allows users to define actions that will be shown in the IncomingReferences component as part\n * of each reference\n * example:\n * ```ts\n * export const LogReferenceAction: IncomingReferenceAction = ({document, getClient}) => {\n * return {\n * label: 'Log reference',\n * icon: LogIcon,\n * onHandle: () => console.log(document._id)\n * }\n * }\n * ```\n *\n * @beta\n */\nexport type IncomingReferenceAction = ActionComponent<\n IncomingReferenceActionsContext,\n IncomingReferenceActionDescription\n>\n\nexport interface CrossDatasetIncomingReference {\n type: string\n title?: string\n dataset: string\n preview: PreviewConfig\n studioUrl?: (document: {id: string; type?: string}) => string | null\n}\n\nexport interface IncomingReferenceType {\n type: string\n dataset?: never\n title?: string\n}\n\nexport function isCrossDatasetIncomingReference(\n type: IncomingReferenceType | CrossDatasetIncomingReference,\n): type is CrossDatasetIncomingReference {\n return Boolean(type.dataset)\n}\n\nexport type IncomingReferencesFilterResolver = (context: {\n document: SanityDocument | undefined\n getClient: (options: {apiVersion: string}) => SanityClient\n}) =>\n | string\n | {filter: string; filterParams?: Record<string, string>}\n | Promise<{filter: string; filterParams?: Record<string, string>}>\n\nexport type IncomingReferencesOptions = {\n name: string\n title?: string\n description?: string\n /**\n * The type of the incoming references.\n */\n types: (IncomingReferenceType | CrossDatasetIncomingReference)[]\n\n /**\n * The filter query to apply to the incoming references in addition to the type filter.\n * For example: filter all books that are from an specific editorial brand: `editorialBrand == \"Random House\"`\n * The `_type` filter is applied automatically.\n */\n filter?: string | IncomingReferencesFilterResolver\n filterParams?: Record<string, string>\n\n /**\n * Callback to link a document to a reference.\n *\n * This function is called when a user wants to link an existing document to the current document.\n * It receives two parameters:\n * - The document that will be linked (the target document)\n * - The reference object with all properties needed to establish the link\n *\n * The developer must implement this function to define where and how the reference\n * should be placed within the document structure. The function should return the\n * modified document with the reference properly added.\n *\n * For example:\n * - We want to link a book to an author:\n * ```ts\n * onLinkDocument: (document, reference) => {\n * return {\n * ...document,\n * author: reference,\n * }\n * }\n * ```\n *\n *\n * @param document - The document to link to the reference.\n * @param reference - The reference to link to the document.\n * @returns The document to link to the reference. If false, the document will not be linked to the reference.\n */\n\n onLinkDocument?: (\n document: SanityDocument,\n reference: {\n _type: 'reference'\n _ref: string\n _weak?: boolean\n _strengthenOnPublish?: {\n type: string\n }\n },\n ) => SanityDocument | false\n /**\n * Callback to define the actions that will be shown for the incoming reference document.\n *\n * For example:\n * ```ts\n * actions: ({document, client}) => {\n * return [\n * {label: 'Unlink document',\n * icon: TrashIcon,\n * tone: 'critical',\n * onClick: async () => {\n * await client.createOrReplace({...document, _id: getDraftId(document._id), author: undefined})\n * }\n * }\n * ]\n * }\n * ```\n * @param context - The context of the linked document.\n * @returns The actions that will be shown for the linked document.\n\n */\n actions?: IncomingReferenceAction[]\n /**\n * Whether to allow creation of new references.\n * default: true\n *\n * If false, it will only be possible to link to existing documents, if the `onLinkDocument` callback is provided.\n * If true, it will be possible to create new references to any template of the type.\n * If an array is provided, it will only be possible to create new references that match the template id in the array provided.\n *\n * To define how a creation will be handled, you can use the `initialValue` option in the\n * document type that will be linked.\n *\n * For example:\n * I want to create a new book from an author:\n * In the author we will have the <IncomingReferenceInput /> with the creationAllowed set to true.\n *\n * Then in the book type, we will have the `initialValue` option to define the default values for the new book.\n * This initialValue callback will receive the `reference` object that needs to be linked to the book in the params.\n *\n * ```ts\n * // Book type\n * export default {\n * type: 'document',\n * name: 'book',\n * title: 'Book',\n * fields: [\n * {\n * name: 'author',\n * type: 'reference',\n * to: [{type: 'author'}],\n * },\n * ],\n * initialValue: (params) => {\n * return {\n * author: params?.reference,\n * }\n * }\n * ```\n */\n creationAllowed?: boolean | string[]\n}\n","import {Card, Flex, Stack, Text} from '@sanity/ui'\nimport {useTranslation} from 'sanity'\n\nimport {structureLocaleNamespace} from '../../i18n'\nimport {useDocumentPane} from '../../panes/document/useDocumentPane'\nimport {CrossDatasetIncomingReferenceType} from './CrossDatasetIncomingReference/CrossDatasetIncomingReferenceType'\nimport {IncomingReferencesType} from './IncomingReferencesType'\nimport {type IncomingReferencesOptions, isCrossDatasetIncomingReference} from './types'\n\nexport function IncomingReferencesList({\n types,\n onLinkDocument,\n actions,\n filter,\n filterParams,\n name,\n creationAllowed,\n}: IncomingReferencesOptions) {\n const {documentId, documentType} = useDocumentPane()\n const {t} = useTranslation(structureLocaleNamespace)\n\n if (!types || types?.length === 0) {\n return (\n <Card border radius={2} padding={3} tone=\"critical\">\n <Flex align=\"center\" justify=\"center\">\n <Text size={1} muted>\n {t('incoming-references-input.types-not-defined')}\n </Text>\n </Flex>\n </Card>\n )\n }\n\n return (\n <Stack space={3}>\n {types.map((type) => {\n if (isCrossDatasetIncomingReference(type)) {\n return (\n <CrossDatasetIncomingReferenceType\n key={`${type.type}-${type.dataset || ''}`}\n type={type}\n referenced={{id: documentId, type: documentType}}\n shouldRenderTitle={types.length > 1}\n />\n )\n }\n return (\n <IncomingReferencesType\n key={type.type}\n type={type}\n referenced={{id: documentId, type: documentType}}\n onLinkDocument={onLinkDocument}\n actions={actions}\n shouldRenderTitle={types.length > 1}\n fieldName={name}\n creationAllowed={creationAllowed}\n filter={filter}\n filterParams={filterParams}\n />\n )\n })}\n </Stack>\n )\n}\n","import {Box, Flex, Stack, Text} from '@sanity/ui'\nimport startCase from 'lodash-es/startCase.js'\n\nimport {IncomingReferencesList} from './IncomingReferencesList'\nimport {type IncomingReferencesOptions} from './types'\n\n/**\n * @beta\n */\nexport function IncomingReferencesDecoration(\n props: IncomingReferencesOptions & {\n name: string\n title?: string\n description?: string\n },\n) {\n const {\n onLinkDocument,\n actions,\n filter,\n filterParams,\n name,\n creationAllowed = true,\n types,\n title,\n description,\n } = props\n\n return (\n <Stack space={2}>\n <Box paddingY={2}>\n <Stack space={3}>\n <Flex align=\"center\" paddingY={1}>\n <Text as=\"label\" weight=\"medium\" size={1}>\n {title || startCase(name)}\n </Text>\n </Flex>\n\n {description && (\n <Text muted size={1}>\n {description}\n </Text>\n )}\n </Stack>\n </Box>\n <IncomingReferencesList\n name={name}\n types={types}\n onLinkDocument={onLinkDocument}\n actions={actions}\n filter={filter}\n filterParams={filterParams}\n creationAllowed={creationAllowed}\n />\n </Stack>\n )\n}\n","import {type DecorationMember} from 'sanity'\n\nimport {IncomingReferencesDecoration} from './IncomingReferencesDecoration'\nimport {type IncomingReferencesOptions} from './types'\n\n/**\n * Helper function to define an incoming references decoration.\n *\n * example:\n * ```ts\n * defineType({\n * name: 'author',\n * type: 'document',\n * renderMembers: (members) => {\n * return [\n * ...members,\n * defineIncomingReferenceDecoration({\n * name: 'incomingReferences',\n * title: 'Incoming references',\n * types: [{type: 'author'}],\n * }),\n * ]\n * },\n * })\n * ```\n *\n * @beta\n */\nexport function defineIncomingReferenceDecoration(\n options: IncomingReferencesOptions,\n): DecorationMember {\n return {\n kind: 'decoration',\n key: options.name,\n component: <IncomingReferencesDecoration {...options} />,\n }\n}\n","import {type DocumentDefinition} from 'sanity'\n\nexport interface IncomingReferenceCreationParams {\n reference: {\n _type: 'reference'\n _ref: string\n _weak?: boolean\n _strengthenOnPublish?: {\n type: string\n }\n }\n from: {\n fieldName: string\n type: string\n }\n __internal_isIncomingReferenceCreation: true\n [key: string]: unknown\n}\n\n/**\n * Helper function to check if the document is being created from an incoming reference.\n * It will be used in the initialValue callback to determine if the document is being created from an incoming reference.\n *\n * example:\n * ```ts\n * defineType({\n * name: 'book',\n * type: 'document',\n * fields: [...],\n * initialValue: (params) => {\n * // If the document is being created from an incoming reference, return the reference\n * // Otherwise, return undefined\n * return {\n * author: isIncomingReferenceCreation(params) ? params.reference : undefined,\n * }\n * },\n * })\n * ```\n *\n * @beta\n */\nexport function isIncomingReferenceCreation(\n initialValue: DocumentDefinition['initialValue'],\n): initialValue is IncomingReferenceCreationParams {\n return (\n typeof initialValue === 'object' &&\n initialValue !== null &&\n '__internal_isIncomingReferenceCreation' in initialValue\n )\n}\n"],"names":["CrossDatasetIncomingReferenceType","t0","$","_c","type","referenced","shouldRenderTitle","client","useClient","DEFAULT_STUDIO_CLIENT_OPTIONS","documentPreviewStore","useDocumentPreviewStore","t1","id","getCrossDatasetIncomingReferences","documentId","references$","documents","loading","useObservable","INITIAL_STATE","schema","useSchema","t","useTranslation","structureLocaleNamespace","T0","T1","t10","t2","t3","t4","t5","t6","t7","t8","t9","Symbol","for","bb0","schemaType","get","t11","document","renderItem","t12","t13","Stack","title","Card","length","index","INCOMING_REFERENCES_ITEM_HEIGHT","CreateNewIncomingReference","referenceToId","referenceToType","onCreateNewReference","fieldName","creationAllowed","initialValueTemplateItems","useReferenceInputOptions","navigate","useRouter","routerPanesState","groupIndex","usePaneRouter","option","uuid","panes","slice","getPublishedId","params","template","payload","reference","_type","_ref","_weak","_strengthenOnPublish","from","__internal_isIncomingReferenceCreation","handleCreate","i","typeMatch","Array","isArray","includes","filter","map","_temp","isNonNullable","createOptions","item","i18n","icon","parameters","permission","granted","reason","undefined","getPerspective","isDraftId","isVersionId","getVersionFromId","isPublishedId","LinkToExistingPreview","props","value","onLinkToDocument","data","releases","useActiveReleases","_id","getPreviewStateObservable","previewStateObservable","snapshot","isLoading","original","getReleaseTone","kind","tone","text","releaseId","r","getReleaseIdFromReleaseDocumentId","release","find","releaseTitle","metadata","releaseFallback","badgeProps","getPreviewValueWithFallback","fallback","displayTitle","INITIAL_SEARCH_STATE","hits","NO_FILTER","incomingReferenceSearch","searchStrategy","search","createSearch","maxDepth","DEFAULT_MAX_FIELD_DEPTH","strategy","tag","textTerm","perspective","pipe","hit","docs","byId","Map","forEach","doc","set","publishedId","entry","values","collated","AddIncomingReference","onLinkDocument","push","useToast","source","useSource","handleSearch","searchState","setSearchState","useState","inputValue$","switchMap","searchString","concat","of","catchError","error","description","message","status","console","scan","tap","handleQueryChange","useObservableEvent","_temp2","options","handleAutocompleteOpenButtonClick","renderOption","gridTemplateColumns","t14","onClick","t15","t16","t17","t18","prevState","nextState","IncomingReferencesType","actions","filterParams","displayed","useDocumentPane","getClient","displayedId","memoizedFilter","memoizedFilterParams","useMemo","getIncomingReferences","isAdding","setIsAdding","newReferenceId","setNewReferenceId","editState","toast","handleAdd","useCallback","p","publishedExists","Boolean","published","handleCreateNewReference","handleLinkDocument","liveEdit","fetch","linkedDocument","getDraftId","createOrReplace","err","Error","useEffect","AddIcon","isCrossDatasetIncomingReference","dataset","IncomingReferencesList","types","name","documentType","IncomingReferencesDecoration","startCase","defineIncomingReferenceDecoration","key","component","isIncomingReferenceCreation","initialValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBO,SAAAA,kCAAAC,IAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAA2C;AAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,EAAAA,IAAAL,IAShDM,SAAeC,UAAUC,6BAA6B,GACtDC,uBAA6BC,wBAAAA;AAAyB,MAAAC;AAAAV,IAAA,CAAA,MAAAK,UAAAL,SAAAQ,wBAAAR,EAAA,CAAA,MAAAG,WAAAQ,MAAAX,SAAAE,QAIlDQ,KAAAE,kCAAkC;AAAA,IAAAC,YACpBV,WAAUQ;AAAAA,IAAGN;AAAAA,IAAAH;AAAAA,IAAAM;AAAAA,EAAAA,CAI1B,GAACR,OAAAK,QAAAL,OAAAQ,sBAAAR,EAAA,CAAA,IAAAG,WAAAQ,IAAAX,OAAAE,MAAAF,OAAAU,MAAAA,KAAAV,EAAA,CAAA;AAPN,QAAAc,cAEIJ,IASJ;AAAA,IAAAK;AAAAA,IAAAC;AAAAA,EAAAA,IAA6BC,cAAcH,aAAaI,aAAa,GAErEC,SAAeC,aACf;AAAA,IAAAC;AAAAA,EAAAA,IAAYC,eAAeC,wBAAwB;AAAC,MAAAC,IAAAC,IAAAC,KAAAC,IAAAC,IAAAC,IAAAC,IAAAC,IAAAC,IAAAC,I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B,QAAA6B,IAAA7B,QAAA8B,IAAA9B,QAAA+B,MAAAA,KAAA/B,EAAA,EAAA,GAzBR+B;AAyBQ;AC1BL,SAAS8M,kCACdtD,SACkB;AAClB,SAAO;AAAA,IACLlE,MAAM;AAAA,IACNyH,KAAKvD,QAAQkD;AAAAA,IACbM,WAAW,oBAAC,8BAAA,EAA6B,GAAIxD,QAAAA,CAAQ;AAAA,EAAA;AAEzD;ACKO,SAASyD,4BACdC,cACiD;AACjD,SACE,OAAOA,gBAAiB,YACxBA,iBAAiB,QACjB,4CAA4CA;AAEhD;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity",
|
|
3
|
-
"version": "6.4.0-next.
|
|
3
|
+
"version": "6.4.0-next.23",
|
|
4
4
|
"description": "Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@sanity/diff-match-patch": "^3.2.0",
|
|
86
86
|
"@sanity/diff-patch": "^5.0.0",
|
|
87
87
|
"@sanity/eventsource": "^5.0.2",
|
|
88
|
-
"@sanity/icons": "^
|
|
88
|
+
"@sanity/icons": "^4.1.0",
|
|
89
89
|
"@sanity/id-utils": "^1.0.0",
|
|
90
90
|
"@sanity/image-url": "^2.1.1",
|
|
91
91
|
"@sanity/insert-menu": "^3.0.8",
|
|
@@ -154,11 +154,11 @@
|
|
|
154
154
|
"uuid": "^14.0.1",
|
|
155
155
|
"web-vitals": "^5.3.0",
|
|
156
156
|
"xstate": "^5.32.2",
|
|
157
|
-
"@sanity/diff": "6.4.0-next.
|
|
158
|
-
"@sanity/
|
|
159
|
-
"@sanity/types": "6.4.0-next.
|
|
160
|
-
"@sanity/
|
|
161
|
-
"@sanity/util": "6.4.0-next.
|
|
157
|
+
"@sanity/diff": "6.4.0-next.23+218795d6eb",
|
|
158
|
+
"@sanity/mutator": "6.4.0-next.23+218795d6eb",
|
|
159
|
+
"@sanity/types": "6.4.0-next.23+218795d6eb",
|
|
160
|
+
"@sanity/schema": "6.4.0-next.23+218795d6eb",
|
|
161
|
+
"@sanity/util": "6.4.0-next.23+218795d6eb"
|
|
162
162
|
},
|
|
163
163
|
"devDependencies": {
|
|
164
164
|
"@rolldown/plugin-babel": "^0.2.3",
|
|
@@ -200,10 +200,10 @@
|
|
|
200
200
|
"vitest": "^4.1.9",
|
|
201
201
|
"vitest-browser-react": "^2.2.0",
|
|
202
202
|
"vitest-package-exports": "^1.2.0",
|
|
203
|
-
"@repo/package.bundle": "6.4.0-next.
|
|
204
|
-
"@repo/
|
|
205
|
-
"@repo/
|
|
206
|
-
"@repo/tsconfig": "6.4.0-next.
|
|
203
|
+
"@repo/package.bundle": "6.4.0-next.23+218795d6eb",
|
|
204
|
+
"@repo/package.config": "6.4.0-next.23+218795d6eb",
|
|
205
|
+
"@repo/test-config": "6.4.0-next.23+218795d6eb",
|
|
206
|
+
"@repo/tsconfig": "6.4.0-next.23+218795d6eb"
|
|
207
207
|
},
|
|
208
208
|
"peerDependencies": {
|
|
209
209
|
"react": "^19.2.2",
|