@strapi/content-manager 5.11.2 → 5.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/admin/chunks/{ComponentConfigurationPage-BGBNQxFJ.js → ComponentConfigurationPage-C6-yVoE3.js} +3 -3
  2. package/dist/admin/chunks/{ComponentConfigurationPage-BGBNQxFJ.js.map → ComponentConfigurationPage-C6-yVoE3.js.map} +1 -1
  3. package/dist/admin/chunks/{ComponentConfigurationPage-DKtL-tec.mjs → ComponentConfigurationPage-DuN0XVMW.mjs} +3 -3
  4. package/dist/admin/chunks/{ComponentConfigurationPage-DKtL-tec.mjs.map → ComponentConfigurationPage-DuN0XVMW.mjs.map} +1 -1
  5. package/dist/admin/chunks/{EditConfigurationPage-yliOxLUv.js → EditConfigurationPage-CGLkm6-l.js} +3 -3
  6. package/dist/admin/chunks/{EditConfigurationPage-yliOxLUv.js.map → EditConfigurationPage-CGLkm6-l.js.map} +1 -1
  7. package/dist/admin/chunks/{EditConfigurationPage-KDwSFRyn.mjs → EditConfigurationPage-dMHIBbF1.mjs} +3 -3
  8. package/dist/admin/chunks/{EditConfigurationPage-KDwSFRyn.mjs.map → EditConfigurationPage-dMHIBbF1.mjs.map} +1 -1
  9. package/dist/admin/chunks/{EditViewPage-BAI2r49P.mjs → EditViewPage-C6t9zIMh.mjs} +5 -5
  10. package/dist/admin/chunks/{EditViewPage-BAI2r49P.mjs.map → EditViewPage-C6t9zIMh.mjs.map} +1 -1
  11. package/dist/admin/chunks/{EditViewPage-DpvonssD.js → EditViewPage-DXT_1NHv.js} +5 -5
  12. package/dist/admin/chunks/{EditViewPage-DpvonssD.js.map → EditViewPage-DXT_1NHv.js.map} +1 -1
  13. package/dist/admin/chunks/{Form-BrzQyDxU.mjs → Form-CYwwV0U-.mjs} +2 -2
  14. package/dist/admin/chunks/{Form-BrzQyDxU.mjs.map → Form-CYwwV0U-.mjs.map} +1 -1
  15. package/dist/admin/chunks/{Form-XD_sf25E.js → Form-D7GCEkaE.js} +2 -2
  16. package/dist/admin/chunks/{Form-XD_sf25E.js.map → Form-D7GCEkaE.js.map} +1 -1
  17. package/dist/admin/chunks/{History-DClLuGIg.mjs → History-CZ9Cnw23.mjs} +5 -5
  18. package/dist/admin/chunks/{History-DClLuGIg.mjs.map → History-CZ9Cnw23.mjs.map} +1 -1
  19. package/dist/admin/chunks/{History-C-_o7tz8.js → History-CZP7hLUV.js} +5 -5
  20. package/dist/admin/chunks/{History-C-_o7tz8.js.map → History-CZP7hLUV.js.map} +1 -1
  21. package/dist/admin/chunks/{Input-BMLRZBE3.mjs → Input-BR5JpzSp.mjs} +5 -11
  22. package/dist/admin/chunks/Input-BR5JpzSp.mjs.map +1 -0
  23. package/dist/admin/chunks/{Input-Bv-rqfYH.js → Input-ZnF7wer5.js} +5 -11
  24. package/dist/admin/chunks/Input-ZnF7wer5.js.map +1 -0
  25. package/dist/admin/chunks/{ListConfigurationPage-Do3UDres.mjs → ListConfigurationPage-CSHB8jY5.mjs} +2 -2
  26. package/dist/admin/chunks/{ListConfigurationPage-Do3UDres.mjs.map → ListConfigurationPage-CSHB8jY5.mjs.map} +1 -1
  27. package/dist/admin/chunks/{ListConfigurationPage-D66hgG4-.js → ListConfigurationPage-DqDJ3esz.js} +2 -2
  28. package/dist/admin/chunks/{ListConfigurationPage-D66hgG4-.js.map → ListConfigurationPage-DqDJ3esz.js.map} +1 -1
  29. package/dist/admin/chunks/{ListViewPage-Q0auz5lE.mjs → ListViewPage-o7MuKWe7.mjs} +3 -3
  30. package/dist/admin/chunks/{ListViewPage-Q0auz5lE.mjs.map → ListViewPage-o7MuKWe7.mjs.map} +1 -1
  31. package/dist/admin/chunks/{ListViewPage-DNvysJaJ.js → ListViewPage-uGHyqfkp.js} +3 -3
  32. package/dist/admin/chunks/{ListViewPage-DNvysJaJ.js.map → ListViewPage-uGHyqfkp.js.map} +1 -1
  33. package/dist/admin/chunks/{NoContentTypePage-C5qFFfgn.js → NoContentTypePage-CJTJmAcN.js} +2 -2
  34. package/dist/admin/chunks/{NoContentTypePage-C5qFFfgn.js.map → NoContentTypePage-CJTJmAcN.js.map} +1 -1
  35. package/dist/admin/chunks/{NoContentTypePage-B_oOeOQb.mjs → NoContentTypePage-Ci7qKVSj.mjs} +2 -2
  36. package/dist/admin/chunks/{NoContentTypePage-B_oOeOQb.mjs.map → NoContentTypePage-Ci7qKVSj.mjs.map} +1 -1
  37. package/dist/admin/chunks/{NoPermissionsPage-C9sDJXRu.js → NoPermissionsPage-C_oTwBmY.js} +2 -2
  38. package/dist/admin/chunks/{NoPermissionsPage-C9sDJXRu.js.map → NoPermissionsPage-C_oTwBmY.js.map} +1 -1
  39. package/dist/admin/chunks/{NoPermissionsPage-BAW7WY-M.mjs → NoPermissionsPage-DgYW5cC4.mjs} +2 -2
  40. package/dist/admin/chunks/{NoPermissionsPage-BAW7WY-M.mjs.map → NoPermissionsPage-DgYW5cC4.mjs.map} +1 -1
  41. package/dist/admin/chunks/{Preview-05BZGpV2.mjs → Preview-BIEc2-KZ.mjs} +84 -81
  42. package/dist/admin/chunks/Preview-BIEc2-KZ.mjs.map +1 -0
  43. package/dist/admin/chunks/{Preview-B6ThL2SA.js → Preview-DFV3Bgia.js} +83 -80
  44. package/dist/admin/chunks/Preview-DFV3Bgia.js.map +1 -0
  45. package/dist/admin/chunks/{Relations-CiOfFNxW.mjs → Relations-B6iGFlMU.mjs} +6 -470
  46. package/dist/admin/chunks/Relations-B6iGFlMU.mjs.map +1 -0
  47. package/dist/admin/chunks/{Relations-CJ0GWuqq.js → Relations-BhhL2fE7.js} +4 -469
  48. package/dist/admin/chunks/Relations-BhhL2fE7.js.map +1 -0
  49. package/dist/admin/chunks/{index-SQ88CePz.js → index-BHsh5hLe.js} +11 -11
  50. package/dist/admin/chunks/{index-SQ88CePz.js.map → index-BHsh5hLe.js.map} +1 -1
  51. package/dist/admin/chunks/{index-CcJLBLNf.mjs → index-D_xHP7Sa.mjs} +11 -11
  52. package/dist/admin/chunks/{index-CcJLBLNf.mjs.map → index-D_xHP7Sa.mjs.map} +1 -1
  53. package/dist/admin/chunks/{layout-xxDnIsHG.js → layout-C3DUumtc.js} +4 -4
  54. package/dist/admin/chunks/{layout-xxDnIsHG.js.map → layout-C3DUumtc.js.map} +1 -1
  55. package/dist/admin/chunks/{layout-4nCaNnTs.mjs → layout-Dp806Nqc.mjs} +4 -4
  56. package/dist/admin/chunks/{layout-4nCaNnTs.mjs.map → layout-Dp806Nqc.mjs.map} +1 -1
  57. package/dist/admin/chunks/{relations-D1R7vM_e.mjs → relations-ksVp_JdY.mjs} +2 -2
  58. package/dist/admin/chunks/{relations-D1R7vM_e.mjs.map → relations-ksVp_JdY.mjs.map} +1 -1
  59. package/dist/admin/chunks/{relations-VlsO9KQZ.js → relations-yfvNHWQO.js} +2 -2
  60. package/dist/admin/chunks/{relations-VlsO9KQZ.js.map → relations-yfvNHWQO.js.map} +1 -1
  61. package/dist/admin/index.js +1 -1
  62. package/dist/admin/index.mjs +1 -1
  63. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +1 -2
  64. package/package.json +5 -5
  65. package/dist/admin/chunks/Input-BMLRZBE3.mjs.map +0 -1
  66. package/dist/admin/chunks/Input-Bv-rqfYH.js.map +0 -1
  67. package/dist/admin/chunks/Preview-05BZGpV2.mjs.map +0 -1
  68. package/dist/admin/chunks/Preview-B6ThL2SA.js.map +0 -1
  69. package/dist/admin/chunks/Relations-CJ0GWuqq.js.map +0 -1
  70. package/dist/admin/chunks/Relations-CiOfFNxW.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Preview-DFV3Bgia.js","sources":["../../../admin/src/preview/components/PreviewContent.tsx","../../../admin/src/preview/components/PreviewHeader.tsx","../../../admin/src/preview/pages/Preview.tsx"],"sourcesContent":["import { Box } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { usePreviewContext } from '../pages/Preview';\n\nconst PreviewContent = () => {\n const previewUrl = usePreviewContext('PreviewContent', (state) => state.url);\n\n const { formatMessage } = useIntl();\n\n return (\n <Box\n src={previewUrl}\n /**\n * For some reason, changing an iframe's src tag causes the browser to add a new item in the\n * history stack. This is an issue for us as it means clicking the back button will not let us\n * go back to the edit view. To fix it, we need to trick the browser into thinking this is a\n * different iframe when the preview URL changes. So we set a key prop to force React\n * to mount a different node when the src changes.\n */\n key={previewUrl}\n title={formatMessage({\n id: 'content-manager.preview.panel.title',\n defaultMessage: 'Preview',\n })}\n width=\"100%\"\n height=\"100%\"\n borderWidth={0}\n tag=\"iframe\"\n />\n );\n};\n\nexport { PreviewContent };\n","import * as React from 'react';\n\nimport {\n DescriptionComponentRenderer,\n useClipboard,\n useHistory,\n useNotification,\n useQueryParams,\n useStrapiApp,\n} from '@strapi/admin/strapi-admin';\nimport { IconButton, Tabs, Typography, Grid, Flex } from '@strapi/design-system';\nimport { Cross, Link as LinkIcon } from '@strapi/icons';\nimport { stringify } from 'qs';\nimport { useIntl } from 'react-intl';\nimport { Link, type To } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { InjectionZone } from '../../components/InjectionZone';\nimport { DocumentActionButton } from '../../pages/EditView/components/DocumentActions';\nimport { DocumentStatus } from '../../pages/EditView/components/DocumentStatus';\nimport { getDocumentStatus } from '../../pages/EditView/EditViewPage';\nimport { usePreviewContext } from '../pages/Preview';\n\nimport type { ContentManagerPlugin, DocumentActionProps } from '../../content-manager';\n\n/* -------------------------------------------------------------------------------------------------\n * ClosePreviewButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst ClosePreviewButton = () => {\n const [{ query }] = useQueryParams<{\n plugins?: Record<string, unknown>;\n }>();\n const { formatMessage } = useIntl();\n\n const canGoBack = useHistory('BackButton', (state) => state.canGoBack);\n const goBack = useHistory('BackButton', (state) => state.goBack);\n const history = useHistory('BackButton', (state) => state.history);\n const locationIndex = useHistory('BackButton', (state) => state.currentLocationIndex);\n\n /**\n * Get the link destination from the history.\n * Rely on a fallback (the parent edit view page) if there's no page to go back .\n */\n const historyTo = canGoBack ? history.at(locationIndex - 2) : undefined;\n const fallback = {\n pathname: '..',\n search: stringify(query, { encode: false }),\n } satisfies To;\n const toWithFallback = historyTo ?? fallback;\n\n const handleClick = (e: React.MouseEvent) => {\n if (canGoBack) {\n // Prevent normal link behavior, go back in the history stack instead\n e.preventDefault();\n goBack();\n return;\n }\n\n // Otherwise rely on native link behavior to go back to the edit view. We don't use navigate()\n // here in order to get the relative=\"path\" functionality from the Link component.\n };\n\n return (\n <IconButton\n variant=\"ghost\"\n tag={Link}\n relative=\"path\"\n to={toWithFallback}\n onClick={handleClick}\n label={formatMessage({\n id: 'content-manager.preview.header.close',\n defaultMessage: 'Close preview',\n })}\n >\n <Cross />\n </IconButton>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Status\n * -----------------------------------------------------------------------------------------------*/\n\nconst Status = () => {\n // Get status\n const document = usePreviewContext('PreviewHeader', (state) => state.document);\n const schema = usePreviewContext('PreviewHeader', (state) => state.schema);\n const meta = usePreviewContext('PreviewHeader', (state) => state.meta);\n const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;\n\n if (!hasDraftAndPublished) {\n return null;\n }\n\n const status = getDocumentStatus(document, meta);\n\n return <DocumentStatus status={status} size=\"XS\" />;\n};\n\nconst PreviewTabs = () => {\n const { formatMessage } = useIntl();\n\n // URL query params\n const [{ query }, setQuery] = useQueryParams<{ status: 'draft' | 'published' }>();\n\n // Get status\n const document = usePreviewContext('PreviewHeader', (state) => state.document);\n const schema = usePreviewContext('PreviewHeader', (state) => state.schema);\n const meta = usePreviewContext('PreviewHeader', (state) => state.meta);\n const hasDraftAndPublish = schema?.options?.draftAndPublish ?? false;\n const documentStatus = getDocumentStatus(document, meta);\n\n const handleTabChange = (status: string) => {\n if (status === 'published' || status === 'draft') {\n setQuery({ status }, 'push', true);\n }\n };\n\n if (!hasDraftAndPublish) {\n return null;\n }\n\n return (\n <Tabs.Root variant=\"simple\" value={query.status || 'draft'} onValueChange={handleTabChange}>\n <Tabs.List\n aria-label={formatMessage({\n id: 'preview.tabs.label',\n defaultMessage: 'Document status',\n })}\n >\n <StatusTab value=\"draft\">\n {formatMessage({\n id: 'content-manager.containers.List.draft',\n defaultMessage: 'draft',\n })}\n </StatusTab>\n <StatusTab value=\"published\" disabled={documentStatus === 'draft'}>\n {formatMessage({\n id: 'content-manager.containers.List.published',\n defaultMessage: 'published',\n })}\n </StatusTab>\n </Tabs.List>\n </Tabs.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PreviewHeader\n * -----------------------------------------------------------------------------------------------*/\n\nconst UnstablePreviewHeader = () => {\n const title = usePreviewContext('PreviewHeader', (state) => state.title);\n const document = usePreviewContext('PreviewHeader', (state) => state.document);\n const schema = usePreviewContext('PreviewHeader', (state) => state.schema);\n const meta = usePreviewContext('PreviewHeader', (state) => state.meta);\n const plugins = useStrapiApp('PreviewHeader', (state) => state.plugins);\n const iframeRef = usePreviewContext('PreviewHeader', (state) => state.iframeRef);\n\n const [{ query }] = useQueryParams<{\n status?: 'draft' | 'published';\n }>();\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { copy } = useClipboard();\n\n const handleCopyLink = () => {\n copy(window.location.href);\n toggleNotification({\n message: formatMessage({\n id: 'content-manager.preview.copy.success',\n defaultMessage: 'Copied preview link',\n }),\n type: 'success',\n });\n };\n\n const hasDraftAndPublish = schema.options?.draftAndPublish ?? false;\n const documentActionProps = {\n activeTab: query.status ?? null,\n collectionType: schema.kind === 'collectionType' ? 'collection-types' : 'single-types',\n model: schema.uid,\n documentId: document.documentId,\n document,\n meta,\n onPreview: () => {\n iframeRef?.current?.contentWindow?.postMessage(\n { type: 'strapiUpdate' },\n // The iframe origin is safe to use since it must be provided through the allowedOrigins config\n new URL(iframeRef.current.src).origin\n );\n },\n } satisfies DocumentActionProps;\n\n return (\n <Flex height=\"48px\" gap={4} background=\"neutral0\" borderColor=\"neutral150\" tag=\"header\">\n {/* Title and status */}\n <TitleContainer height=\"100%\" paddingLeft={2} paddingRight={4}>\n <ClosePreviewButton />\n <PreviewTitle\n tag=\"h1\"\n title={title}\n maxWidth=\"200px\"\n fontSize={2}\n paddingLeft={2}\n paddingRight={3}\n fontWeight={600}\n >\n {title}\n </PreviewTitle>\n <Status />\n </TitleContainer>\n\n {/* Tabs and actions */}\n <Flex\n flex={1}\n paddingRight={2}\n gap={2}\n justifyContent={hasDraftAndPublish ? 'space-between' : 'flex-end'}\n >\n <Flex flex=\"1 1 70%\">\n <PreviewTabs />\n </Flex>\n <Flex gap={2}>\n <IconButton\n type=\"button\"\n label={formatMessage({\n id: 'preview.copy.label',\n defaultMessage: 'Copy preview link',\n })}\n onClick={handleCopyLink}\n >\n <LinkIcon />\n </IconButton>\n <InjectionZone area=\"preview.actions\" />\n <DescriptionComponentRenderer\n props={documentActionProps}\n descriptions={(\n plugins['content-manager'].apis as ContentManagerPlugin['config']['apis']\n ).getDocumentActions('preview')}\n >\n {(actions) => {\n const filteredActions = actions.filter((action) =>\n [action.position].flat().includes('preview')\n );\n const [primaryAction, secondaryAction] = filteredActions;\n\n if (!primaryAction && !secondaryAction) return null;\n\n // Both actions are available when draft and publish enabled\n if (primaryAction && secondaryAction) {\n return (\n <>\n {/* Save */}\n <DocumentActionButton\n {...secondaryAction}\n variant={secondaryAction.variant || 'secondary'}\n />\n {/* Publish */}\n <DocumentActionButton\n {...primaryAction}\n variant={primaryAction.variant || 'default'}\n />\n </>\n );\n }\n\n // Otherwise we just have the save action\n return (\n <DocumentActionButton\n {...primaryAction}\n variant={primaryAction.variant || 'secondary'}\n />\n );\n }}\n </DescriptionComponentRenderer>\n </Flex>\n </Flex>\n </Flex>\n );\n};\n\nconst PreviewHeader = () => {\n // Get the document title\n const title = usePreviewContext('PreviewHeader', (state) => state.title);\n\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { copy } = useClipboard();\n\n const handleCopyLink = () => {\n copy(window.location.href);\n toggleNotification({\n message: formatMessage({\n id: 'content-manager.preview.copy.success',\n defaultMessage: 'Copied preview link',\n }),\n type: 'success',\n });\n };\n\n return (\n <Grid.Root\n gap={3}\n gridCols={3}\n paddingLeft={2}\n paddingRight={2}\n background=\"neutral0\"\n borderColor=\"neutral150\"\n tag=\"header\"\n >\n {/* Title and status */}\n <Grid.Item xs={1} paddingTop={2} paddingBottom={2} gap={3}>\n <ClosePreviewButton />\n <PreviewTitle tag=\"h1\" fontWeight={600} fontSize={2} maxWidth=\"200px\" title={title}>\n {title}\n </PreviewTitle>\n <Status />\n </Grid.Item>\n {/* Tabs */}\n <Grid.Item xs={1} marginBottom=\"-1px\" alignItems=\"end\" margin=\"auto\">\n <PreviewTabs />\n </Grid.Item>\n {/* Copy link */}\n <Grid.Item xs={1} justifyContent=\"end\" paddingTop={2} paddingBottom={2}>\n <IconButton\n type=\"button\"\n label={formatMessage({\n id: 'preview.copy.label',\n defaultMessage: 'Copy preview link',\n })}\n onClick={handleCopyLink}\n >\n <LinkIcon />\n </IconButton>\n </Grid.Item>\n </Grid.Root>\n );\n};\n\nconst PreviewTitle = styled(Typography)`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst StatusTab = styled(Tabs.Trigger)`\n text-transform: uppercase;\n`;\n\nconst TitleContainer = styled(Flex)`\n border-right: 1px solid ${({ theme }) => theme.colors.neutral150};\n`;\n\nexport { PreviewHeader, UnstablePreviewHeader };\n","import * as React from 'react';\n\nimport {\n Page,\n useQueryParams,\n useRBAC,\n createContext,\n Form as FormContext,\n Blocker,\n} from '@strapi/admin/strapi-admin';\nimport { Box, Flex, FocusTrap, IconButton, Portal } from '@strapi/design-system';\nimport { ArrowLineLeft } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { useLocation, useParams } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { GetPreviewUrl } from '../../../../shared/contracts/preview';\nimport { COLLECTION_TYPES } from '../../constants/collections';\nimport { DocumentRBAC } from '../../features/DocumentRBAC';\nimport { type UseDocument, useDocument } from '../../hooks/useDocument';\nimport { type EditLayout, useDocumentLayout } from '../../hooks/useDocumentLayout';\nimport { FormLayout } from '../../pages/EditView/components/FormLayout';\nimport { buildValidParams } from '../../utils/api';\nimport { createYupSchema } from '../../utils/validation';\nimport { PreviewContent } from '../components/PreviewContent';\nimport { PreviewHeader, UnstablePreviewHeader } from '../components/PreviewHeader';\nimport { useGetPreviewUrlQuery } from '../services/preview';\n\nimport type { UID } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * PreviewProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface PreviewContextValue {\n url: string;\n title: string;\n document: NonNullable<ReturnType<UseDocument>['document']>;\n meta: NonNullable<ReturnType<UseDocument>['meta']>;\n schema: NonNullable<ReturnType<UseDocument>['schema']>;\n layout: EditLayout;\n iframeRef?: React.RefObject<HTMLIFrameElement>;\n}\n\nconst [PreviewProvider, usePreviewContext] = createContext<PreviewContextValue>('PreviewPage');\n\n/* -------------------------------------------------------------------------------------------------\n * PreviewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst AnimatedArrow = styled(ArrowLineLeft)<{ isSideEditorOpen: boolean }>`\n will-change: transform;\n rotate: ${(props) => (props.isSideEditorOpen ? '0deg' : '180deg')};\n transition: rotate 0.2s ease-in-out;\n`;\n\nconst PreviewPage = () => {\n const location = useLocation();\n const { formatMessage } = useIntl();\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null);\n const [isSideEditorOpen, setIsSideEditorOpen] = React.useState(true);\n\n // Read all the necessary data from the URL to find the right preview URL\n const {\n slug: model,\n id: documentId,\n collectionType,\n } = useParams<{\n slug: UID.ContentType;\n id: string;\n collectionType: string;\n }>();\n const [{ query }] = useQueryParams<{\n plugins?: Record<string, unknown>;\n status?: string;\n }>();\n\n const params = React.useMemo(() => buildValidParams(query), [query]);\n\n if (!collectionType) {\n throw new Error('Could not find collectionType in url params');\n }\n\n if (!model) {\n throw new Error('Could not find model in url params');\n }\n\n // Only collection types must have a documentId\n if (collectionType === COLLECTION_TYPES && !documentId) {\n throw new Error('Could not find documentId in url params');\n }\n\n const previewUrlResponse = useGetPreviewUrlQuery({\n params: {\n contentType: model,\n },\n query: {\n documentId,\n locale: params.locale,\n status: params.status as GetPreviewUrl.Request['query']['status'],\n },\n });\n const documentResponse = useDocument({\n model,\n collectionType,\n documentId,\n params,\n });\n const documentLayoutResponse = useDocumentLayout(model);\n\n const isLoading =\n previewUrlResponse.isLoading || documentLayoutResponse.isLoading || documentResponse.isLoading;\n if (isLoading && !documentResponse.document?.documentId) {\n return <Page.Loading />;\n }\n\n const initialValues = documentResponse.getInitialFormValues();\n\n if (\n previewUrlResponse.error ||\n documentLayoutResponse.error ||\n !documentResponse.document ||\n !documentResponse.meta ||\n !documentResponse.schema ||\n !initialValues\n ) {\n return <Page.Error />;\n }\n\n if (!previewUrlResponse.data?.data?.url) {\n return <Page.NoData />;\n }\n\n const documentTitle = documentResponse.getTitle(documentLayoutResponse.edit.settings.mainField);\n\n const validateSync = (values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(\n documentResponse.schema?.attributes,\n documentResponse.components,\n {\n status: documentResponse.document?.status,\n ...options,\n }\n );\n\n return yupSchema.validateSync(values, { abortEarly: false });\n };\n\n const previewUrl = previewUrlResponse.data.data.url;\n\n return (\n <>\n <Page.Title>\n {formatMessage(\n {\n id: 'content-manager.preview.page-title',\n defaultMessage: '{contentType} preview',\n },\n {\n contentType: documentTitle,\n }\n )}\n </Page.Title>\n <PreviewProvider\n url={previewUrl}\n document={documentResponse.document}\n title={documentTitle}\n meta={documentResponse.meta}\n schema={documentResponse.schema}\n layout={documentLayoutResponse.edit}\n iframeRef={iframeRef}\n >\n <FormContext\n method=\"PUT\"\n disabled={\n query.status === 'published' &&\n documentResponse &&\n documentResponse.document.status !== 'draft'\n }\n initialValues={documentResponse.getInitialFormValues()}\n initialErrors={location?.state?.forceValidation ? validateSync(initialValues, {}) : {}}\n height=\"100%\"\n validate={(values: Record<string, unknown>, options: Record<string, string>) => {\n const yupSchema = createYupSchema(\n documentResponse.schema?.attributes,\n documentResponse.components,\n {\n status: documentResponse.document?.status,\n ...options,\n }\n );\n\n return yupSchema.validate(values, { abortEarly: false });\n }}\n >\n {({ resetForm }) => (\n <Flex direction=\"column\" height=\"100%\" alignItems=\"stretch\">\n {window.strapi.future.isEnabled('unstablePreviewSideEditor') ? (\n <>\n <Blocker onProceed={resetForm} />\n <UnstablePreviewHeader />\n <Flex flex={1} overflow=\"auto\" alignItems=\"stretch\">\n <Box\n overflow=\"auto\"\n width={isSideEditorOpen ? '50%' : 0}\n borderWidth=\"0 1px 0 0\"\n borderColor=\"neutral150\"\n paddingTop={6}\n paddingBottom={6}\n // Remove horizontal padding when the editor is closed or it won't fully disappear\n paddingLeft={isSideEditorOpen ? 6 : 0}\n paddingRight={isSideEditorOpen ? 6 : 0}\n transition=\"all 0.2s ease-in-out\"\n >\n <FormLayout layout={documentLayoutResponse.edit.layout} hasBackground />\n </Box>\n <Box position=\"relative\" flex={1} height=\"100%\" overflow=\"hidden\">\n <Box\n data-testid=\"preview-iframe\"\n ref={iframeRef}\n src={previewUrl}\n /**\n * For some reason, changing an iframe's src tag causes the browser to add a new item in the\n * history stack. This is an issue for us as it means clicking the back button will not let us\n * go back to the edit view. To fix it, we need to trick the browser into thinking this is a\n * different iframe when the preview URL changes. So we set a key prop to force React\n * to mount a different node when the src changes.\n */\n key={previewUrl}\n title={formatMessage({\n id: 'content-manager.preview.panel.title',\n defaultMessage: 'Preview',\n })}\n width=\"100%\"\n height=\"100%\"\n borderWidth={0}\n tag=\"iframe\"\n />\n <IconButton\n variant=\"tertiary\"\n label={formatMessage(\n isSideEditorOpen\n ? {\n id: 'content-manager.preview.content.close-editor',\n defaultMessage: 'Close editor',\n }\n : {\n id: 'content-manager.preview.content.open-editor',\n defaultMessage: 'Open editor',\n }\n )}\n onClick={() => setIsSideEditorOpen((prev) => !prev)}\n position=\"absolute\"\n top={2}\n left={2}\n >\n <AnimatedArrow isSideEditorOpen={isSideEditorOpen} />\n </IconButton>\n </Box>\n </Flex>\n </>\n ) : (\n <>\n <PreviewHeader />\n <PreviewContent />\n </>\n )}\n </Flex>\n )}\n </FormContext>\n </PreviewProvider>\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ProtectedPreviewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedPreviewPageImpl = () => {\n const { slug: model } = useParams<{\n slug: string;\n }>();\n const {\n permissions = [],\n isLoading,\n error,\n } = useRBAC([\n { action: 'plugin::content-manager.explorer.read', subject: model },\n { action: 'plugin::content-manager.explorer.update', subject: model },\n { action: 'plugin::content-manager.explorer.publish', subject: model },\n ]);\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || !model) {\n return (\n <Box\n height=\"100vh\"\n width=\"100vw\"\n position=\"fixed\"\n top={0}\n left={0}\n zIndex={2}\n background=\"neutral0\"\n >\n <Page.Error />\n </Box>\n );\n }\n\n return (\n <Box\n height=\"100vh\"\n width=\"100vw\"\n position=\"fixed\"\n top={0}\n left={0}\n zIndex={2}\n background=\"neutral0\"\n >\n <Page.Protect\n permissions={permissions.filter((permission) =>\n permission.action.includes('explorer.read')\n )}\n >\n <DocumentRBAC permissions={permissions}>\n <PreviewPage />\n </DocumentRBAC>\n </Page.Protect>\n </Box>\n );\n};\n\nconst ProtectedPreviewPage = () => {\n return (\n <Portal>\n <FocusTrap>\n <ProtectedPreviewPageImpl />\n </FocusTrap>\n </Portal>\n );\n};\n\nexport { ProtectedPreviewPage, usePreviewContext };\n"],"names":["PreviewContent","previewUrl","usePreviewContext","state","url","formatMessage","useIntl","_jsx","Box","src","title","id","defaultMessage","width","height","borderWidth","tag","ClosePreviewButton","query","useQueryParams","canGoBack","useHistory","goBack","history","locationIndex","currentLocationIndex","historyTo","at","undefined","fallback","pathname","search","stringify","encode","toWithFallback","handleClick","e","preventDefault","IconButton","variant","Link","relative","to","onClick","label","Cross","Status","document","schema","meta","hasDraftAndPublished","options","draftAndPublish","status","getDocumentStatus","DocumentStatus","size","PreviewTabs","setQuery","hasDraftAndPublish","documentStatus","handleTabChange","Tabs","Root","value","onValueChange","_jsxs","List","aria-label","StatusTab","disabled","UnstablePreviewHeader","plugins","useStrapiApp","iframeRef","toggleNotification","useNotification","copy","useClipboard","handleCopyLink","window","location","href","message","type","documentActionProps","activeTab","collectionType","kind","model","uid","documentId","onPreview","current","contentWindow","postMessage","URL","origin","Flex","gap","background","borderColor","TitleContainer","paddingLeft","paddingRight","PreviewTitle","maxWidth","fontSize","fontWeight","flex","justifyContent","LinkIcon","InjectionZone","area","DescriptionComponentRenderer","props","descriptions","apis","getDocumentActions","actions","filteredActions","filter","action","position","flat","includes","primaryAction","secondaryAction","_Fragment","DocumentActionButton","PreviewHeader","Grid","gridCols","Item","xs","paddingTop","paddingBottom","marginBottom","alignItems","margin","styled","Typography","Trigger","theme","colors","neutral150","PreviewProvider","createContext","AnimatedArrow","ArrowLineLeft","isSideEditorOpen","PreviewPage","useLocation","React","useRef","setIsSideEditorOpen","useState","slug","useParams","params","useMemo","buildValidParams","Error","COLLECTION_TYPES","previewUrlResponse","useGetPreviewUrlQuery","contentType","locale","documentResponse","useDocument","documentLayoutResponse","useDocumentLayout","isLoading","Page","Loading","initialValues","getInitialFormValues","error","data","NoData","documentTitle","getTitle","edit","settings","mainField","validateSync","values","yupSchema","createYupSchema","attributes","components","abortEarly","Title","layout","FormContext","method","initialErrors","forceValidation","validate","resetForm","direction","strapi","future","isEnabled","Blocker","onProceed","overflow","transition","FormLayout","hasBackground","data-testid","ref","prev","top","left","ProtectedPreviewPageImpl","permissions","useRBAC","subject","zIndex","Protect","permission","DocumentRBAC","ProtectedPreviewPage","Portal","FocusTrap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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J,CAAAA,WAAAA,EAAAA,EAAAA;;;;AAKX,CAAA;AAEA,MAAMwE,oBAAuB,GAAA,IAAA;AAC3B,IAAA,qBACExN,cAACyN,CAAAA,mBAAAA,EAAAA;AACC,QAAA,QAAA,gBAAAzN,cAAC0N,CAAAA,sBAAAA,EAAAA;AACC,YAAA,QAAA,gBAAA1N,cAACgN,CAAAA,wBAAAA,EAAAA,EAAAA;;;AAIT;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { createContext, useQueryParams, useForm, useField, useNotification, useFocusInputField } from '@strapi/admin/strapi-admin';
4
- import { Flex, Box, TextButton, Link, Field, Combobox, ComboboxOption, Typography, VisuallyHidden, useComposedRefs, IconButton, Tooltip } from '@strapi/design-system';
4
+ import { Flex, Box, Link, TextButton, Field, Combobox, ComboboxOption, Typography, VisuallyHidden, useComposedRefs, IconButton, Tooltip } from '@strapi/design-system';
5
5
  import { ArrowClockwise, Drag, Cross } from '@strapi/icons';
6
6
  import { generateNKeysBetween } from 'fractional-indexing';
7
7
  import pipe from 'lodash/fp/pipe';
@@ -10,9 +10,9 @@ import { useIntl } from 'react-intl';
10
10
  import { NavLink } from 'react-router-dom';
11
11
  import { FixedSizeList } from 'react-window';
12
12
  import { styled } from 'styled-components';
13
- import { c as useDoc, d as buildValidParams, C as COLLECTION_TYPES, g as getTranslation, D as DocumentStatus } from './index-CcJLBLNf.mjs';
13
+ import { c as useDoc, d as buildValidParams, C as COLLECTION_TYPES, g as getTranslation, D as DocumentStatus } from './index-D_xHP7Sa.mjs';
14
14
  import { u as useDragAndDrop, I as ItemTypes, D as DROP_SENSITIVITY } from './useDragAndDrop-HYwNDExe.mjs';
15
- import { u as useGetRelationsQuery, g as getRelationLabel, a as useDebounce, b as useLazySearchRelationsQuery } from './relations-D1R7vM_e.mjs';
15
+ import { u as useGetRelationsQuery, g as getRelationLabel, a as useDebounce, b as useLazySearchRelationsQuery } from './relations-ksVp_JdY.mjs';
16
16
 
17
17
  /**
18
18
  * We use this component to wrap any individual component field in the Edit View,
@@ -80,189 +80,7 @@ const ONE_WAY_RELATIONS = [
80
80
  * @description The relations field holds a lot of domain logic for handling relations which is rather complicated
81
81
  * At present we do not expose this to plugin developers, however, they are able to overwrite it themselves should
82
82
  * they wish to do so.
83
- */ const UnstableRelationsField = /*#__PURE__*/ React.forwardRef(({ disabled, label, ...props }, ref)=>{
84
- const [currentPage, setCurrentPage] = React.useState(1);
85
- const { document, model: documentModel } = useDoc();
86
- const documentId = document?.documentId;
87
- const { formatMessage } = useIntl();
88
- const [{ query }] = useQueryParams();
89
- const params = buildValidParams(query);
90
- const isMorph = props.attribute.relation.toLowerCase().includes('morph');
91
- const isDisabled = isMorph || disabled;
92
- const { componentId, componentUID } = useComponent('RelationsField', ({ uid, id })=>({
93
- componentId: id,
94
- componentUID: uid
95
- }));
96
- const isSubmitting = useForm('RelationsList', (state)=>state.isSubmitting);
97
- React.useEffect(()=>{
98
- setCurrentPage(1);
99
- }, [
100
- isSubmitting
101
- ]);
102
- /**
103
- * We'll always have a documentId in a created entry, so we look for a componentId first.
104
- * Same with `uid` and `documentModel`.
105
- */ const id = componentId ? componentId.toString() : documentId;
106
- const model = componentUID ?? documentModel;
107
- /**
108
- * The `name` prop is a complete path to the field, e.g. `field1.field2.field3`.
109
- * Where the above example would a nested field within two components, however
110
- * we only require the field on the component not the complete path since we query
111
- * individual components. Therefore we split the string and take the last item.
112
- */ const [targetField] = props.name.split('.').slice(-1);
113
- const { data, isLoading, isFetching } = useGetRelationsQuery({
114
- model,
115
- targetField,
116
- // below we don't run the query if there is no id.
117
- id: id,
118
- params: {
119
- ...params,
120
- pageSize: RELATIONS_TO_DISPLAY,
121
- page: currentPage
122
- }
123
- }, {
124
- refetchOnMountOrArgChange: true,
125
- skip: !id,
126
- selectFromResult: (result)=>{
127
- return {
128
- ...result,
129
- data: {
130
- ...result.data,
131
- results: result.data?.results ? result.data.results : []
132
- }
133
- };
134
- }
135
- });
136
- const handleLoadMore = ()=>{
137
- setCurrentPage((prev)=>prev + 1);
138
- };
139
- const field = useField(props.name);
140
- const isFetchingMoreRelations = isLoading || isFetching;
141
- const realServerRelationsCount = 'pagination' in data && data.pagination ? data.pagination.total : 0;
142
- /**
143
- * Items that are already connected, but reordered would be in
144
- * this list, so to get an accurate figure, we remove them.
145
- */ const relationsConnected = (field.value?.connect ?? []).filter((rel)=>data.results.findIndex((relation)=>relation.id === rel.id) === -1).length ?? 0;
146
- const relationsDisconnected = field.value?.disconnect?.length ?? 0;
147
- const relationsCount = realServerRelationsCount + relationsConnected - relationsDisconnected;
148
- /**
149
- * This is it, the source of truth for reordering in conjunction with partial loading & updating
150
- * of relations. Relations on load are given __temp_key__ when fetched, because we don't want to
151
- * create brand new keys everytime the data updates, just keep adding them onto the newly loaded ones.
152
- */ const relations = React.useMemo(()=>{
153
- const ctx = {
154
- field: field.value,
155
- // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.
156
- href: `../${COLLECTION_TYPES}/${props.attribute.targetModel}`,
157
- mainField: props.mainField
158
- };
159
- /**
160
- * Tidy up our data.
161
- */ const transformations = pipe(removeConnected(ctx), removeDisconnected(ctx), addLabelAndHref(ctx));
162
- const transformedRels = transformations([
163
- ...data.results
164
- ]);
165
- /**
166
- * THIS IS CRUCIAL. If you don't sort by the __temp_key__ which comes from fractional indexing
167
- * then the list will be in the wrong order.
168
- */ return [
169
- ...transformedRels,
170
- ...field.value?.connect ?? []
171
- ].sort((a, b)=>{
172
- if (a.__temp_key__ < b.__temp_key__) return -1;
173
- if (a.__temp_key__ > b.__temp_key__) return 1;
174
- return 0;
175
- });
176
- }, [
177
- data.results,
178
- field.value,
179
- // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.
180
- props.attribute.targetModel,
181
- props.mainField
182
- ]);
183
- const handleDisconnect = useHandleDisconnect(props.name, 'RelationsField');
184
- const handleConnect = (relation)=>{
185
- const [lastItemInList] = relations.slice(-1);
186
- const item = {
187
- id: relation.id,
188
- apiData: {
189
- id: relation.id,
190
- documentId: relation.documentId,
191
- locale: relation.locale
192
- },
193
- status: relation.status,
194
- /**
195
- * If there's a last item, that's the first key we use to generate out next one.
196
- */ __temp_key__: generateNKeysBetween(lastItemInList?.__temp_key__ ?? null, null, 1)[0],
197
- // Fallback to `id` if there is no `mainField` value, which will overwrite the above `id` property with the exact same data.
198
- [props.mainField?.name ?? 'documentId']: relation[props.mainField?.name ?? 'documentId'],
199
- label: getRelationLabel(relation, props.mainField),
200
- // @ts-expect-error – targetModel does exist on the attribute, but it's not typed.
201
- href: `../${COLLECTION_TYPES}/${props.attribute.targetModel}/${relation.documentId}?${relation.locale ? `plugins[i18n][locale]=${relation.locale}` : ''}`
202
- };
203
- if (ONE_WAY_RELATIONS.includes(props.attribute.relation)) {
204
- // Remove any existing relation so they can be replaced with the new one
205
- field.value?.connect?.forEach(handleDisconnect);
206
- relations.forEach(handleDisconnect);
207
- field.onChange(`${props.name}.connect`, [
208
- item
209
- ]);
210
- } else {
211
- field.onChange(`${props.name}.connect`, [
212
- ...field.value?.connect ?? [],
213
- item
214
- ]);
215
- }
216
- };
217
- return /*#__PURE__*/ jsxs(Flex, {
218
- ref: ref,
219
- direction: "column",
220
- gap: 3,
221
- justifyContent: "space-between",
222
- alignItems: "stretch",
223
- wrap: "wrap",
224
- children: [
225
- /*#__PURE__*/ jsxs(StyledFlex, {
226
- direction: "column",
227
- alignItems: "start",
228
- gap: 2,
229
- width: "100%",
230
- children: [
231
- /*#__PURE__*/ jsx(RelationsInput, {
232
- disabled: isDisabled,
233
- // NOTE: we should not default to using the documentId if the component is being created (componentUID is undefined)
234
- id: componentUID ? componentId ? `${componentId}` : '' : documentId,
235
- label: `${label} ${relationsCount > 0 ? `(${relationsCount})` : ''}`,
236
- model: model,
237
- onChange: handleConnect,
238
- ...props
239
- }),
240
- 'pagination' in data && data.pagination && data.pagination.pageCount > data.pagination.page ? /*#__PURE__*/ jsx(TextButton, {
241
- disabled: isFetchingMoreRelations,
242
- onClick: handleLoadMore,
243
- loading: isFetchingMoreRelations,
244
- startIcon: /*#__PURE__*/ jsx(ArrowClockwise, {}),
245
- // prevent the label from line-wrapping
246
- shrink: 0,
247
- children: formatMessage({
248
- id: getTranslation('relation.loadMore'),
249
- defaultMessage: 'Load More'
250
- })
251
- }) : null
252
- ]
253
- }),
254
- /*#__PURE__*/ jsx(UnstableRelationsList, {
255
- data: relations,
256
- serverData: data.results,
257
- disabled: isDisabled,
258
- name: props.name,
259
- isLoading: isFetchingMoreRelations,
260
- relationType: props.attribute.relation
261
- })
262
- ]
263
- });
264
- });
265
- const RelationsField = /*#__PURE__*/ React.forwardRef(({ disabled, label, ...props }, ref)=>{
83
+ */ const RelationsField = /*#__PURE__*/ React.forwardRef(({ disabled, label, ...props }, ref)=>{
266
84
  const [currentPage, setCurrentPage] = React.useState(1);
267
85
  const { document, model: documentModel } = useDoc();
268
86
  const documentId = document?.documentId;
@@ -649,179 +467,6 @@ const RelationsField = /*#__PURE__*/ React.forwardRef(({ disabled, label, ...pro
649
467
  * RelationsList
650
468
  * -----------------------------------------------------------------------------------------------*/ const RELATION_ITEM_HEIGHT = 50;
651
469
  const RELATION_GUTTER = 4;
652
- const UnstableRelationsList = ({ data, serverData, disabled, name, isLoading, relationType })=>{
653
- const ariaDescriptionId = React.useId();
654
- const { formatMessage } = useIntl();
655
- const listRef = React.useRef(null);
656
- const outerListRef = React.useRef(null);
657
- const [overflow, setOverflow] = React.useState();
658
- const [liveText, setLiveText] = React.useState('');
659
- const field = useField(name);
660
- React.useEffect(()=>{
661
- if (data.length <= RELATIONS_TO_DISPLAY) {
662
- return setOverflow(undefined);
663
- }
664
- const handleNativeScroll = (e)=>{
665
- const el = e.target;
666
- const parentScrollContainerHeight = el.parentNode.scrollHeight;
667
- const maxScrollBottom = el.scrollHeight - el.scrollTop;
668
- if (el.scrollTop === 0) {
669
- return setOverflow('bottom');
670
- }
671
- if (maxScrollBottom === parentScrollContainerHeight) {
672
- return setOverflow('top');
673
- }
674
- return setOverflow('top-bottom');
675
- };
676
- const outerListRefCurrent = outerListRef?.current;
677
- if (!isLoading && data.length > 0 && outerListRefCurrent) {
678
- outerListRef.current.addEventListener('scroll', handleNativeScroll);
679
- }
680
- return ()=>{
681
- if (outerListRefCurrent) {
682
- outerListRefCurrent.removeEventListener('scroll', handleNativeScroll);
683
- }
684
- };
685
- }, [
686
- isLoading,
687
- data.length
688
- ]);
689
- const getItemPos = (index)=>`${index + 1} of ${data.length}`;
690
- const handleMoveItem = (newIndex, oldIndex)=>{
691
- const item = data[oldIndex];
692
- setLiveText(formatMessage({
693
- id: getTranslation('dnd.reorder'),
694
- defaultMessage: '{item}, moved. New position in list: {position}.'
695
- }, {
696
- item: item.label ?? item.documentId,
697
- position: getItemPos(newIndex)
698
- }));
699
- /**
700
- * Splicing mutates the array, so we need to create a new array
701
- */ const newData = [
702
- ...data
703
- ];
704
- const currentRow = data[oldIndex];
705
- const startKey = oldIndex > newIndex ? newData[newIndex - 1]?.__temp_key__ : newData[newIndex]?.__temp_key__;
706
- const endKey = oldIndex > newIndex ? newData[newIndex]?.__temp_key__ : newData[newIndex + 1]?.__temp_key__;
707
- /**
708
- * We're moving the relation between two other relations, so
709
- * we need to generate a new key that keeps the order
710
- */ const [newKey] = generateNKeysBetween(startKey, endKey, 1);
711
- newData.splice(oldIndex, 1);
712
- newData.splice(newIndex, 0, {
713
- ...currentRow,
714
- __temp_key__: newKey
715
- });
716
- /**
717
- * Now we diff against the server to understand what's different so we
718
- * can keep the connect array nice and tidy. It also needs reversing because
719
- * we reverse the relations from the server in the first place.
720
- */ const connectedRelations = newData.reduce((acc, relation, currentIndex, array)=>{
721
- const relationOnServer = serverData.find((oldRelation)=>oldRelation.id === relation.id);
722
- const relationInFront = array[currentIndex + 1];
723
- if (!relationOnServer || relationOnServer.__temp_key__ !== relation.__temp_key__) {
724
- const position = relationInFront ? {
725
- before: relationInFront.documentId,
726
- locale: relationInFront.locale,
727
- status: 'publishedAt' in relationInFront && relationInFront.publishedAt ? 'published' : 'draft'
728
- } : {
729
- end: true
730
- };
731
- const relationWithPosition = {
732
- ...relation,
733
- ...{
734
- apiData: {
735
- id: relation.id,
736
- documentId: relation.documentId,
737
- locale: relation.locale,
738
- position
739
- }
740
- }
741
- };
742
- return [
743
- ...acc,
744
- relationWithPosition
745
- ];
746
- }
747
- return acc;
748
- }, []).toReversed();
749
- field.onChange(`${name}.connect`, connectedRelations);
750
- };
751
- const handleGrabItem = (index)=>{
752
- const item = data[index];
753
- setLiveText(formatMessage({
754
- id: getTranslation('dnd.grab-item'),
755
- defaultMessage: `{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel.`
756
- }, {
757
- item: item.label ?? item.documentId,
758
- position: getItemPos(index)
759
- }));
760
- };
761
- const handleDropItem = (index)=>{
762
- const { href: _href, label, ...item } = data[index];
763
- setLiveText(formatMessage({
764
- id: getTranslation('dnd.drop-item'),
765
- defaultMessage: `{item}, dropped. Final position in list: {position}.`
766
- }, {
767
- item: label ?? item.documentId,
768
- position: getItemPos(index)
769
- }));
770
- };
771
- const handleCancel = (index)=>{
772
- const item = data[index];
773
- setLiveText(formatMessage({
774
- id: getTranslation('dnd.cancel-item'),
775
- defaultMessage: '{item}, dropped. Re-order cancelled.'
776
- }, {
777
- item: item.label ?? item.documentId
778
- }));
779
- };
780
- const handleDisconnect = useHandleDisconnect(name, 'RelationsList');
781
- /**
782
- * These relation types will only ever have one item
783
- * in their list, so you can't reorder a single item!
784
- */ const canReorder = !ONE_WAY_RELATIONS.includes(relationType);
785
- const dynamicListHeight = data.length > RELATIONS_TO_DISPLAY ? Math.min(data.length, RELATIONS_TO_DISPLAY) * (RELATION_ITEM_HEIGHT + RELATION_GUTTER) + RELATION_ITEM_HEIGHT / 2 : Math.min(data.length, RELATIONS_TO_DISPLAY) * (RELATION_ITEM_HEIGHT + RELATION_GUTTER);
786
- return /*#__PURE__*/ jsxs(ShadowBox, {
787
- $overflowDirection: overflow,
788
- children: [
789
- /*#__PURE__*/ jsx(VisuallyHidden, {
790
- id: ariaDescriptionId,
791
- children: formatMessage({
792
- id: getTranslation('dnd.instructions'),
793
- defaultMessage: `Press spacebar to grab and re-order`
794
- })
795
- }),
796
- /*#__PURE__*/ jsx(VisuallyHidden, {
797
- "aria-live": "assertive",
798
- children: liveText
799
- }),
800
- /*#__PURE__*/ jsx(FixedSizeList, {
801
- height: dynamicListHeight,
802
- ref: listRef,
803
- outerRef: outerListRef,
804
- itemCount: data.length,
805
- itemSize: RELATION_ITEM_HEIGHT + RELATION_GUTTER,
806
- itemData: {
807
- ariaDescribedBy: ariaDescriptionId,
808
- canDrag: canReorder,
809
- disabled,
810
- handleCancel,
811
- handleDropItem,
812
- handleGrabItem,
813
- handleMoveItem,
814
- name,
815
- handleDisconnect,
816
- relations: data
817
- },
818
- itemKey: (index)=>data[index].id,
819
- innerElementType: "ol",
820
- children: UnstableListItem
821
- })
822
- ]
823
- });
824
- };
825
470
  const RelationsList = ({ data, serverData, disabled, name, isLoading, relationType })=>{
826
471
  const ariaDescriptionId = React.useId();
827
472
  const { formatMessage } = useIntl();
@@ -1026,114 +671,6 @@ const ShadowBox = styled(Box)`
1026
671
  transition: opacity 0.2s ease-in-out;
1027
672
  }
1028
673
  `;
1029
- const CustomTextButton = styled(TextButton)`
1030
- & > span {
1031
- font-size: ${({ theme })=>theme.fontSizes[2]};
1032
- }
1033
- `;
1034
- const UnstableListItem = ({ data, index, style })=>{
1035
- const { ariaDescribedBy, canDrag = false, disabled = false, handleCancel, handleDisconnect, handleDropItem, handleGrabItem, handleMoveItem, name, relations } = data;
1036
- const { formatMessage } = useIntl();
1037
- const { id, label, status } = relations[index];
1038
- const [{ handlerId, isDragging, handleKeyDown }, relationRef, dropRef, dragRef, dragPreviewRef] = useDragAndDrop(canDrag && !disabled, {
1039
- type: `${ItemTypes.RELATION}_${name}`,
1040
- index,
1041
- item: {
1042
- displayedValue: label,
1043
- status,
1044
- id: id,
1045
- index
1046
- },
1047
- onMoveItem: handleMoveItem,
1048
- onDropItem: handleDropItem,
1049
- onGrabItem: handleGrabItem,
1050
- onCancel: handleCancel,
1051
- dropSensitivity: DROP_SENSITIVITY.REGULAR
1052
- });
1053
- const composedRefs = useComposedRefs(relationRef, dragRef);
1054
- React.useEffect(()=>{
1055
- dragPreviewRef(getEmptyImage());
1056
- }, [
1057
- dragPreviewRef
1058
- ]);
1059
- return /*#__PURE__*/ jsx(Box, {
1060
- style: style,
1061
- tag: "li",
1062
- ref: dropRef,
1063
- "aria-describedby": ariaDescribedBy,
1064
- cursor: canDrag ? 'all-scroll' : 'default',
1065
- children: isDragging ? /*#__PURE__*/ jsx(RelationItemPlaceholder, {}) : /*#__PURE__*/ jsxs(Flex, {
1066
- paddingTop: 2,
1067
- paddingBottom: 2,
1068
- paddingLeft: canDrag ? 2 : 4,
1069
- paddingRight: 4,
1070
- hasRadius: true,
1071
- borderColor: "neutral200",
1072
- background: disabled ? 'neutral150' : 'neutral0',
1073
- justifyContent: "space-between",
1074
- ref: composedRefs,
1075
- "data-handler-id": handlerId,
1076
- children: [
1077
- /*#__PURE__*/ jsxs(FlexWrapper, {
1078
- gap: 1,
1079
- children: [
1080
- canDrag ? /*#__PURE__*/ jsx(IconButton, {
1081
- tag: "div",
1082
- role: "button",
1083
- tabIndex: 0,
1084
- withTooltip: false,
1085
- label: formatMessage({
1086
- id: getTranslation('components.RelationInput.icon-button-aria-label'),
1087
- defaultMessage: 'Drag'
1088
- }),
1089
- variant: "ghost",
1090
- onKeyDown: handleKeyDown,
1091
- disabled: disabled,
1092
- children: /*#__PURE__*/ jsx(Drag, {})
1093
- }) : null,
1094
- /*#__PURE__*/ jsxs(Flex, {
1095
- width: "100%",
1096
- minWidth: 0,
1097
- justifyContent: "space-between",
1098
- children: [
1099
- /*#__PURE__*/ jsx(Box, {
1100
- minWidth: 0,
1101
- paddingTop: 1,
1102
- paddingBottom: 1,
1103
- paddingRight: 4,
1104
- children: /*#__PURE__*/ jsx(Tooltip, {
1105
- description: label,
1106
- children: /*#__PURE__*/ jsx(CustomTextButton, {
1107
- onClick: ()=>console.log('OPEN MODAL'),
1108
- children: label
1109
- })
1110
- })
1111
- }),
1112
- status ? /*#__PURE__*/ jsx(DocumentStatus, {
1113
- status: status
1114
- }) : null
1115
- ]
1116
- })
1117
- ]
1118
- }),
1119
- /*#__PURE__*/ jsx(Box, {
1120
- paddingLeft: 4,
1121
- children: /*#__PURE__*/ jsx(IconButton, {
1122
- onClick: ()=>handleDisconnect(relations[index]),
1123
- disabled: disabled,
1124
- label: formatMessage({
1125
- id: getTranslation('relation.disconnect'),
1126
- defaultMessage: 'Remove'
1127
- }),
1128
- variant: "ghost",
1129
- size: "S",
1130
- children: /*#__PURE__*/ jsx(Cross, {})
1131
- })
1132
- })
1133
- ]
1134
- })
1135
- });
1136
- };
1137
674
  const ListItem = ({ data, index, style })=>{
1138
675
  const { ariaDescribedBy, canDrag = false, disabled = false, handleCancel, handleDisconnect, handleDropItem, handleGrabItem, handleMoveItem, name, relations } = data;
1139
676
  const { formatMessage } = useIntl();
@@ -1285,7 +822,6 @@ const RelationItemPlaceholder = ()=>/*#__PURE__*/ jsx(Box, {
1285
822
  height: `calc(100% - ${RELATION_GUTTER}px)`
1286
823
  });
1287
824
  const MemoizedRelationsField = /*#__PURE__*/ React.memo(RelationsField);
1288
- const MemoizedUnstableRelationsField = /*#__PURE__*/ React.memo(UnstableRelationsField);
1289
825
 
1290
- export { ComponentProvider as C, DisconnectButton as D, FlexWrapper as F, LinkEllipsis as L, MemoizedUnstableRelationsField as M, MemoizedRelationsField as a, useComponent as u };
1291
- //# sourceMappingURL=Relations-CiOfFNxW.mjs.map
826
+ export { ComponentProvider as C, DisconnectButton as D, FlexWrapper as F, LinkEllipsis as L, MemoizedRelationsField as M, useComponent as u };
827
+ //# sourceMappingURL=Relations-B6iGFlMU.mjs.map