@strapi/content-manager 0.0.0-experimental.17b4116f461a49b8ce5386f7c8d79c511d40fb3b → 0.0.0-experimental.25e22c6cc9bc6b35392bb55d09f641a0a65e7403
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{CardDragPreview-DSVYodBX.js → CardDragPreview-C0QyJgRA.js} +10 -14
- package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -0
- package/dist/_chunks/{CardDragPreview-ikSG4M46.mjs → CardDragPreview-DOxamsuj.mjs} +7 -9
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -0
- package/dist/_chunks/{ComponentConfigurationPage-2iOVVhqV.js → ComponentConfigurationPage-WRPUXGd6.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-2iOVVhqV.js.map → ComponentConfigurationPage-WRPUXGd6.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DjQBdcKF.mjs → ComponentConfigurationPage-gdUj_t-O.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DjQBdcKF.mjs.map → ComponentConfigurationPage-gdUj_t-O.mjs.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BBQsYCVn.js → ComponentIcon-BXdiCGQp.js} +8 -2
- package/dist/_chunks/ComponentIcon-BXdiCGQp.js.map +1 -0
- package/dist/_chunks/{ComponentIcon-BOFnK76n.mjs → ComponentIcon-u4bIXTFY.mjs} +9 -3
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -0
- package/dist/_chunks/{EditConfigurationPage-BoBb-DLH.mjs → EditConfigurationPage-BwuIPOJG.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BoBb-DLH.mjs.map → EditConfigurationPage-BwuIPOJG.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-B7dw5_cS.js → EditConfigurationPage-C1vjMBgy.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-B7dw5_cS.js.map → EditConfigurationPage-C1vjMBgy.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-aUnqL-63.mjs → EditViewPage-0MiFkXa8.mjs} +47 -47
- package/dist/_chunks/EditViewPage-0MiFkXa8.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-KRG56aCq.js → EditViewPage-DbcGfyqK.js} +46 -48
- package/dist/_chunks/EditViewPage-DbcGfyqK.js.map +1 -0
- package/dist/_chunks/{Field-kVFO4ZKB.mjs → Field-BDMSCcy5.mjs} +585 -705
- package/dist/_chunks/Field-BDMSCcy5.mjs.map +1 -0
- package/dist/_chunks/{Field-kq1c2TF1.js → Field-BG1xu38N.js} +637 -758
- package/dist/_chunks/Field-BG1xu38N.js.map +1 -0
- package/dist/_chunks/{Form-CQ67ZifP.js → Form-9BnFyUjy.js} +35 -37
- package/dist/_chunks/Form-9BnFyUjy.js.map +1 -0
- package/dist/_chunks/{Form-Jgh5hGTu.mjs → Form-CPVWavB8.mjs} +35 -36
- package/dist/_chunks/Form-CPVWavB8.mjs.map +1 -0
- package/dist/_chunks/{History-DKhZAPcK.mjs → History-BVpd8LP3.mjs} +121 -48
- package/dist/_chunks/History-BVpd8LP3.mjs.map +1 -0
- package/dist/_chunks/{History-BLEnudTX.js → History-BWWxLt2Z.js} +122 -50
- package/dist/_chunks/History-BWWxLt2Z.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-Zso_LUjn.js → ListConfigurationPage-6swzjdAZ.js} +53 -56
- package/dist/_chunks/ListConfigurationPage-6swzjdAZ.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-nrXcxNYi.mjs → ListConfigurationPage-DozVMKcR.mjs} +49 -51
- package/dist/_chunks/ListConfigurationPage-DozVMKcR.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-DsaOakWQ.js → ListViewPage-BlzfjS2Q.js} +80 -105
- package/dist/_chunks/ListViewPage-BlzfjS2Q.js.map +1 -0
- package/dist/_chunks/{ListViewPage-ChhYmA-L.mjs → ListViewPage-Ds0ulgfG.mjs} +75 -100
- package/dist/_chunks/ListViewPage-Ds0ulgfG.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-BrdFcN33.mjs → NoContentTypePage-BH11kaKt.mjs} +3 -3
- package/dist/_chunks/NoContentTypePage-BH11kaKt.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DPCuS9Y1.js → NoContentTypePage-D2nCCWEl.js} +3 -3
- package/dist/_chunks/NoContentTypePage-D2nCCWEl.js.map +1 -0
- package/dist/_chunks/{NoPermissionsPage-B9dqrtTy.mjs → NoPermissionsPage-BT2Tn0D_.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-B9dqrtTy.mjs.map → NoPermissionsPage-BT2Tn0D_.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DdyOfdKb.js → NoPermissionsPage-DN_JlsU2.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DdyOfdKb.js.map → NoPermissionsPage-DN_JlsU2.js.map} +1 -1
- package/dist/_chunks/{Relations-CY8Isqdu.js → Relations-CcgFTcWo.js} +70 -61
- package/dist/_chunks/Relations-CcgFTcWo.js.map +1 -0
- package/dist/_chunks/{Relations-DjFiYd7-.mjs → Relations-Dnag3fhV.mjs} +66 -56
- package/dist/_chunks/Relations-Dnag3fhV.mjs.map +1 -0
- package/dist/_chunks/{en-MBPul9Su.mjs → en-Ux26r5pl.mjs} +7 -1
- package/dist/_chunks/{en-MBPul9Su.mjs.map → en-Ux26r5pl.mjs.map} +1 -1
- package/dist/_chunks/{en-C-V1_90f.js → en-fbKQxLGn.js} +7 -1
- package/dist/_chunks/{en-C-V1_90f.js.map → en-fbKQxLGn.js.map} +1 -1
- package/dist/_chunks/{index-DNa1J4HE.js → index-CWpLBSt0.js} +1391 -808
- package/dist/_chunks/index-CWpLBSt0.js.map +1 -0
- package/dist/_chunks/{index-CAc9yTnx.mjs → index-JNNNKUHs.mjs} +1465 -881
- package/dist/_chunks/index-JNNNKUHs.mjs.map +1 -0
- package/dist/_chunks/{layout-BqtLA6Lb.js → layout--iHdZzRk.js} +26 -23
- package/dist/_chunks/layout--iHdZzRk.js.map +1 -0
- package/dist/_chunks/{layout-CXsHbc3E.mjs → layout-DC503LnF.mjs} +24 -19
- package/dist/_chunks/layout-DC503LnF.mjs.map +1 -0
- package/dist/_chunks/{relations-BHY_KDJ_.js → relations-BbHizA5K.js} +2 -2
- package/dist/_chunks/{relations-BHY_KDJ_.js.map → relations-BbHizA5K.js.map} +1 -1
- package/dist/_chunks/{relations-mMFEcZRq.mjs → relations-CTje5t-a.mjs} +2 -2
- package/dist/_chunks/{relations-mMFEcZRq.mjs.map → relations-CTje5t-a.mjs.map} +1 -1
- package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs.map +1 -1
- package/dist/_chunks/useDragAndDrop-J0TUUbR6.js.map +1 -1
- package/dist/_chunks/usePrev-B9w_-eYc.js +15 -0
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +1 -0
- package/dist/_chunks/usePrev-DH6iah0A.mjs +16 -0
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +8 -7
- package/dist/admin/src/components/ComponentIcon.d.ts +6 -3
- package/dist/admin/src/content-manager.d.ts +3 -3
- package/dist/admin/src/exports.d.ts +1 -0
- package/dist/admin/src/history/components/VersionInputRenderer.d.ts +1 -1
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +5 -8
- package/dist/admin/src/hooks/useDocumentActions.d.ts +24 -3
- package/dist/admin/src/hooks/useDocumentLayout.d.ts +2 -2
- package/dist/admin/src/hooks/useDragAndDrop.d.ts +4 -4
- package/dist/admin/src/hooks/useKeyboardDragAndDrop.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +10 -4
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksInput.d.ts +3 -3
- package/dist/admin/src/pages/EditView/components/FormInputs/Component/Input.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.d.ts +3 -5
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +10 -18
- package/dist/admin/src/pages/EditView/components/FormInputs/UID.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +3 -49
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +59 -52
- package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +2 -10
- package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
- package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
- package/dist/admin/src/pages/ListView/components/BulkActions/PublishAction.d.ts +9 -26
- package/dist/admin/src/services/api.d.ts +2 -3
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +5 -5
- package/dist/admin/src/services/documents.d.ts +29 -17
- package/dist/admin/src/services/init.d.ts +2 -2
- package/dist/admin/src/services/relations.d.ts +3 -3
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/admin/src/utils/api.d.ts +4 -18
- package/dist/admin/src/utils/validation.d.ts +1 -6
- package/dist/server/index.js +285 -197
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +287 -199
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/single-types.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +8 -0
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/dimensions.d.ts +9 -0
- package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/index.d.ts +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +17 -33
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts +11 -6
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts +8 -29
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +17 -33
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts +8 -1
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +14 -6
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/dist/shared/contracts/relations.d.ts +2 -2
- package/dist/shared/contracts/relations.d.ts.map +1 -1
- package/package.json +13 -14
- package/dist/_chunks/CardDragPreview-DSVYodBX.js.map +0 -1
- package/dist/_chunks/CardDragPreview-ikSG4M46.mjs.map +0 -1
- package/dist/_chunks/ComponentIcon-BBQsYCVn.js.map +0 -1
- package/dist/_chunks/ComponentIcon-BOFnK76n.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-KRG56aCq.js.map +0 -1
- package/dist/_chunks/EditViewPage-aUnqL-63.mjs.map +0 -1
- package/dist/_chunks/Field-kVFO4ZKB.mjs.map +0 -1
- package/dist/_chunks/Field-kq1c2TF1.js.map +0 -1
- package/dist/_chunks/Form-CQ67ZifP.js.map +0 -1
- package/dist/_chunks/Form-Jgh5hGTu.mjs.map +0 -1
- package/dist/_chunks/History-BLEnudTX.js.map +0 -1
- package/dist/_chunks/History-DKhZAPcK.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-Zso_LUjn.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-nrXcxNYi.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-ChhYmA-L.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-DsaOakWQ.js.map +0 -1
- package/dist/_chunks/NoContentTypePage-BrdFcN33.mjs.map +0 -1
- package/dist/_chunks/NoContentTypePage-DPCuS9Y1.js.map +0 -1
- package/dist/_chunks/Relations-CY8Isqdu.js.map +0 -1
- package/dist/_chunks/Relations-DjFiYd7-.mjs.map +0 -1
- package/dist/_chunks/index-CAc9yTnx.mjs.map +0 -1
- package/dist/_chunks/index-DNa1J4HE.js.map +0 -1
- package/dist/_chunks/layout-BqtLA6Lb.js.map +0 -1
- package/dist/_chunks/layout-CXsHbc3E.mjs.map +0 -1
- package/dist/_chunks/urls-CbOsUOoW.mjs +0 -7
- package/dist/_chunks/urls-CbOsUOoW.mjs.map +0 -1
- package/dist/_chunks/urls-DzZya_gm.js +0 -6
- package/dist/_chunks/urls-DzZya_gm.js.map +0 -1
- package/dist/server/src/controllers/utils/dimensions.d.ts +0 -5
- package/dist/server/src/controllers/utils/dimensions.d.ts.map +0 -1
@@ -1,23 +1,23 @@
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
2
2
|
import * as React from "react";
|
3
|
-
import { useState, useEffect, useCallback } from "react";
|
3
|
+
import { useState, useEffect, useCallback, memo } from "react";
|
4
4
|
import { useStrapiApp, createContext, useField, useNotification, useForm, useAPIErrorHandler, useQueryParams, useFocusInputField, InputRenderer as InputRenderer$1 } from "@strapi/admin/strapi-admin";
|
5
|
-
import { Typography, Flex, Box, BaseLink, Button,
|
5
|
+
import { Typography, Flex, Box, BaseLink, Button, Popover, Field, Tooltip, SingleSelect, SingleSelectOption, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton, BaseButton, TextInput, IconButtonGroup, Menu, MenuItem } from "@strapi/design-system";
|
6
6
|
import pipe$1 from "lodash/fp/pipe";
|
7
7
|
import { useIntl } from "react-intl";
|
8
|
-
import {
|
8
|
+
import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, d as buildValidParams, f as useDocumentRBAC, n as useDocLayout } from "./index-JNNNKUHs.mjs";
|
9
9
|
import { generateNKeysBetween } from "fractional-indexing";
|
10
|
-
import { u as useComponent, C as ComponentProvider,
|
10
|
+
import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-Dnag3fhV.mjs";
|
11
11
|
import { Code, HeadingOne, HeadingTwo, HeadingThree, HeadingFour, HeadingFive, HeadingSix, Image as Image$1, NumberList, BulletList, Paragraph, Quotes, Link as Link$1, Drag, Collapse, Bold, Italic, Underline, StrikeThrough, Expand, PlusCircle, Plus, Trash, EyeStriked, CheckCircle, WarningCircle, Loader, ArrowClockwise, More } from "@strapi/icons";
|
12
|
-
import styled,
|
13
|
-
import { C as ComponentIcon } from "./ComponentIcon-
|
12
|
+
import { styled, css, keyframes } from "styled-components";
|
13
|
+
import { C as ComponentIcon, a as COMPONENT_ICONS } from "./ComponentIcon-u4bIXTFY.mjs";
|
14
14
|
import { getEmptyImage } from "react-dnd-html5-backend";
|
15
15
|
import { a as DIRECTIONS, u as useDragAndDrop, I as ItemTypes } from "./useDragAndDrop-DdHgKsqq.mjs";
|
16
16
|
import { g as getIn } from "./objects-mKMAmfec.mjs";
|
17
17
|
import { Editor as Editor$1, Transforms, Node, Element, Range, Path, Point, createEditor } from "slate";
|
18
18
|
import { withHistory } from "slate-history";
|
19
19
|
import { useFocused, useSelected, ReactEditor, Editable, useSlate, Slate, withReact } from "slate-react";
|
20
|
-
import { p as prefixFileUrlWithBackendUrl } from "./
|
20
|
+
import { p as prefixFileUrlWithBackendUrl, u as usePrev } from "./usePrev-DH6iah0A.mjs";
|
21
21
|
import * as Toolbar from "@radix-ui/react-toolbar";
|
22
22
|
import { useLocation } from "react-router-dom";
|
23
23
|
import CodeMirror from "codemirror5";
|
@@ -223,7 +223,7 @@ const pressEnterTwiceToExit = (editor) => {
|
|
223
223
|
});
|
224
224
|
}
|
225
225
|
};
|
226
|
-
const CodeBlock = styled.pre
|
226
|
+
const CodeBlock = styled.pre`
|
227
227
|
border-radius: ${({ theme }) => theme.borderRadius};
|
228
228
|
background-color: ${({ theme }) => theme.colors.neutral100};
|
229
229
|
max-width: 100%;
|
@@ -258,27 +258,27 @@ const codeBlocks = {
|
|
258
258
|
dragHandleTopMargin: "10px"
|
259
259
|
}
|
260
260
|
};
|
261
|
-
const H1 = styled(Typography).attrs({
|
261
|
+
const H1 = styled(Typography).attrs({ tag: "h1" })`
|
262
262
|
font-size: 4.2rem;
|
263
263
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
264
264
|
`;
|
265
|
-
const H2 = styled(Typography).attrs({
|
265
|
+
const H2 = styled(Typography).attrs({ tag: "h2" })`
|
266
266
|
font-size: 3.5rem;
|
267
267
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
268
268
|
`;
|
269
|
-
const H3 = styled(Typography).attrs({
|
269
|
+
const H3 = styled(Typography).attrs({ tag: "h3" })`
|
270
270
|
font-size: 2.9rem;
|
271
271
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
272
272
|
`;
|
273
|
-
const H4 = styled(Typography).attrs({
|
273
|
+
const H4 = styled(Typography).attrs({ tag: "h4" })`
|
274
274
|
font-size: 2.4rem;
|
275
275
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
276
276
|
`;
|
277
|
-
const H5 = styled(Typography).attrs({
|
277
|
+
const H5 = styled(Typography).attrs({ tag: "h5" })`
|
278
278
|
font-size: 2rem;
|
279
279
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
280
280
|
`;
|
281
|
-
const H6 = styled(Typography).attrs({
|
281
|
+
const H6 = styled(Typography).attrs({ tag: "h6" })`
|
282
282
|
font-size: 1.6rem;
|
283
283
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
284
284
|
`;
|
@@ -367,7 +367,7 @@ const headingBlocks = {
|
|
367
367
|
const ImageWrapper = styled(Flex)`
|
368
368
|
transition-property: box-shadow;
|
369
369
|
transition-duration: 0.2s;
|
370
|
-
${(props) => props
|
370
|
+
${(props) => props.$isFocused && css`
|
371
371
|
box-shadow: ${props.theme.colors.primary600} 0px 0px 0px 3px;
|
372
372
|
`}
|
373
373
|
|
@@ -419,7 +419,7 @@ const Image = ({ attributes, children, element }) => {
|
|
419
419
|
background: "neutral100",
|
420
420
|
contentEditable: false,
|
421
421
|
justifyContent: "center",
|
422
|
-
isFocused: editorIsFocused && imageIsSelected,
|
422
|
+
$isFocused: editorIsFocused && imageIsSelected,
|
423
423
|
hasRadius: true,
|
424
424
|
children: /* @__PURE__ */ jsx("img", { src: url, alt: alternativeText, width, height })
|
425
425
|
}
|
@@ -579,7 +579,7 @@ const StyledBaseLink = styled(BaseLink)`
|
|
579
579
|
text-decoration: none;
|
580
580
|
`;
|
581
581
|
const RemoveButton = styled(Button)`
|
582
|
-
visibility: ${(props) => props
|
582
|
+
visibility: ${(props) => props.$visible ? "visible" : "hidden"};
|
583
583
|
`;
|
584
584
|
const LinkContent = React.forwardRef(
|
585
585
|
({ link, children, attributes }, forwardedRef) => {
|
@@ -589,17 +589,23 @@ const LinkContent = React.forwardRef(
|
|
589
589
|
const [popoverOpen, setPopoverOpen] = React.useState(
|
590
590
|
editor.lastInsertedLinkPath ? Path.equals(path, editor.lastInsertedLinkPath) : false
|
591
591
|
);
|
592
|
-
const linkRef = React.useRef(null);
|
593
592
|
const elementText = link.children.map((child) => child.text).join("");
|
594
593
|
const [linkText, setLinkText] = React.useState(elementText);
|
595
594
|
const [linkUrl, setLinkUrl] = React.useState(link.url);
|
596
595
|
const linkInputRef = React.useRef(null);
|
597
596
|
const [showRemoveButton, setShowRemoveButton] = React.useState(false);
|
598
597
|
const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);
|
599
|
-
const
|
600
|
-
|
601
|
-
|
602
|
-
|
598
|
+
const handleOpenChange = (isOpen) => {
|
599
|
+
if (isOpen) {
|
600
|
+
setPopoverOpen(isOpen);
|
601
|
+
setShowRemoveButton(isOpen);
|
602
|
+
} else {
|
603
|
+
setPopoverOpen(isOpen);
|
604
|
+
if (link.url === "") {
|
605
|
+
removeLink(editor);
|
606
|
+
}
|
607
|
+
ReactEditor.focus(editor);
|
608
|
+
}
|
603
609
|
};
|
604
610
|
const onLinkChange = (e) => {
|
605
611
|
setIsSaveDisabled(false);
|
@@ -622,39 +628,21 @@ const LinkContent = React.forwardRef(
|
|
622
628
|
setPopoverOpen(false);
|
623
629
|
editor.lastInsertedLinkPath = null;
|
624
630
|
};
|
625
|
-
const handleDismiss = () => {
|
626
|
-
setPopoverOpen(false);
|
627
|
-
if (link.url === "") {
|
628
|
-
removeLink(editor);
|
629
|
-
}
|
630
|
-
ReactEditor.focus(editor);
|
631
|
-
};
|
632
|
-
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
633
|
-
const composedRefs = useComposedRefs(linkRef, forwardedRef);
|
634
631
|
React.useEffect(() => {
|
635
632
|
if (popoverOpen)
|
636
633
|
linkInputRef.current?.focus();
|
637
634
|
}, [popoverOpen]);
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
href: link.url,
|
645
|
-
onClick: handleOpenEditPopover,
|
646
|
-
color: "primary600",
|
647
|
-
children
|
648
|
-
}
|
649
|
-
),
|
650
|
-
popoverOpen && /* @__PURE__ */ jsx(Popover, { source: linkRef, onDismiss: handleDismiss, padding: 4, contentEditable: false, children: /* @__PURE__ */ jsxs(Flex, { as: "form", onSubmit: handleSave, direction: "column", gap: 4, children: [
|
651
|
-
/* @__PURE__ */ jsx(Field, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
652
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: formatMessage({
|
635
|
+
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
636
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { onOpenChange: handleOpenChange, open: popoverOpen, children: [
|
637
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(StyledBaseLink, { ...attributes, ref: forwardedRef, href: link.url, color: "primary600", children }) }),
|
638
|
+
/* @__PURE__ */ jsx(Popover.Content, { children: /* @__PURE__ */ jsxs(Flex, { padding: 4, tag: "form", onSubmit: handleSave, direction: "column", gap: 4, children: [
|
639
|
+
/* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
640
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
653
641
|
id: "components.Blocks.popover.text",
|
654
642
|
defaultMessage: "Text"
|
655
643
|
}) }),
|
656
644
|
/* @__PURE__ */ jsx(
|
657
|
-
|
645
|
+
Field.Input,
|
658
646
|
{
|
659
647
|
name: "text",
|
660
648
|
placeholder: formatMessage({
|
@@ -668,13 +656,13 @@ const LinkContent = React.forwardRef(
|
|
668
656
|
}
|
669
657
|
)
|
670
658
|
] }) }),
|
671
|
-
/* @__PURE__ */ jsx(Field, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
672
|
-
/* @__PURE__ */ jsx(
|
659
|
+
/* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
660
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
673
661
|
id: "components.Blocks.popover.link",
|
674
662
|
defaultMessage: "Link"
|
675
663
|
}) }),
|
676
664
|
/* @__PURE__ */ jsx(
|
677
|
-
|
665
|
+
Field.Input,
|
678
666
|
{
|
679
667
|
ref: linkInputRef,
|
680
668
|
name: "url",
|
@@ -693,7 +681,7 @@ const LinkContent = React.forwardRef(
|
|
693
681
|
{
|
694
682
|
variant: "danger-light",
|
695
683
|
onClick: () => removeLink(editor),
|
696
|
-
visible: showRemoveButton,
|
684
|
+
$visible: showRemoveButton,
|
697
685
|
children: formatMessage({
|
698
686
|
id: "components.Blocks.popover.remove",
|
699
687
|
defaultMessage: "Remove"
|
@@ -701,7 +689,7 @@ const LinkContent = React.forwardRef(
|
|
701
689
|
}
|
702
690
|
),
|
703
691
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
704
|
-
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick:
|
692
|
+
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: () => handleOpenChange(false), children: formatMessage({
|
705
693
|
id: "components.Blocks.popover.cancel",
|
706
694
|
defaultMessage: "Cancel"
|
707
695
|
}) }),
|
@@ -748,11 +736,11 @@ const listStyle = css`
|
|
748
736
|
}
|
749
737
|
`;
|
750
738
|
const Orderedlist = styled.ol`
|
751
|
-
list-style-type: ${(props) => props
|
739
|
+
list-style-type: ${(props) => props.$listStyleType};
|
752
740
|
${listStyle}
|
753
741
|
`;
|
754
742
|
const Unorderedlist = styled.ul`
|
755
|
-
list-style-type: ${(props) => props
|
743
|
+
list-style-type: ${(props) => props.$listStyleType};
|
756
744
|
${listStyle}
|
757
745
|
`;
|
758
746
|
const orderedStyles = ["decimal", "lower-alpha", "upper-roman"];
|
@@ -765,9 +753,9 @@ const List = ({ attributes, children, element }) => {
|
|
765
753
|
const nextIndex = (element.indentLevel || 0) % listStyles.length;
|
766
754
|
const listStyleType = listStyles[nextIndex];
|
767
755
|
if (element.format === "ordered") {
|
768
|
-
return /* @__PURE__ */ jsx(Orderedlist, { listStyleType, ...attributes, children });
|
756
|
+
return /* @__PURE__ */ jsx(Orderedlist, { $listStyleType: listStyleType, ...attributes, children });
|
769
757
|
}
|
770
|
-
return /* @__PURE__ */ jsx(Unorderedlist, { listStyleType, ...attributes, children });
|
758
|
+
return /* @__PURE__ */ jsx(Unorderedlist, { $listStyleType: listStyleType, ...attributes, children });
|
771
759
|
};
|
772
760
|
const replaceListWithEmptyBlock = (editor, currentListPath) => {
|
773
761
|
Transforms.removeNodes(editor, { at: currentListPath });
|
@@ -964,7 +952,7 @@ const listBlocks = {
|
|
964
952
|
snippets: ["-", "*", "+"]
|
965
953
|
},
|
966
954
|
"list-item": {
|
967
|
-
renderElement: (props) => /* @__PURE__ */ jsx(Typography, {
|
955
|
+
renderElement: (props) => /* @__PURE__ */ jsx(Typography, { tag: "li", ...props.attributes, children: props.children }),
|
968
956
|
// No handleConvert, list items are created when converting to the parent list
|
969
957
|
matchNode: (node) => node.type === "list-item",
|
970
958
|
isInBlocksSelector: false,
|
@@ -973,7 +961,7 @@ const listBlocks = {
|
|
973
961
|
};
|
974
962
|
const paragraphBlocks = {
|
975
963
|
paragraph: {
|
976
|
-
renderElement: (props) => /* @__PURE__ */ jsx(Typography, {
|
964
|
+
renderElement: (props) => /* @__PURE__ */ jsx(Typography, { tag: "p", variant: "omega", ...props.attributes, children: props.children }),
|
977
965
|
icon: Paragraph,
|
978
966
|
label: {
|
979
967
|
id: "components.Blocks.blocks.text",
|
@@ -1139,7 +1127,7 @@ const ToolbarButton = ({
|
|
1139
1127
|
children: /* @__PURE__ */ jsx(
|
1140
1128
|
FlexButton,
|
1141
1129
|
{
|
1142
|
-
|
1130
|
+
tag: "button",
|
1143
1131
|
background: isActive ? "primary100" : "",
|
1144
1132
|
alignItems: "center",
|
1145
1133
|
justifyContent: "center",
|
@@ -1460,7 +1448,7 @@ const DragItem = styled(Flex)`
|
|
1460
1448
|
|
1461
1449
|
// Set the visibility of drag button
|
1462
1450
|
[role='button'] {
|
1463
|
-
visibility: ${(props) => props
|
1451
|
+
visibility: ${(props) => props.$dragVisibility};
|
1464
1452
|
opacity: inherit;
|
1465
1453
|
}
|
1466
1454
|
&[aria-disabled='true'] {
|
@@ -1477,7 +1465,7 @@ const DragIconButton = styled(IconButton)`
|
|
1477
1465
|
visibility: hidden;
|
1478
1466
|
cursor: grab;
|
1479
1467
|
opacity: inherit;
|
1480
|
-
margin-top: ${(props) => props
|
1468
|
+
margin-top: ${(props) => props.$dragHandleTopMargin ?? 0};
|
1481
1469
|
|
1482
1470
|
&:hover {
|
1483
1471
|
background: ${({ theme }) => theme.colors.neutral200};
|
@@ -1552,7 +1540,7 @@ const DragAndDropElement = ({
|
|
1552
1540
|
React.useEffect(() => {
|
1553
1541
|
setDragVisibility("hidden");
|
1554
1542
|
}, [editor.selection]);
|
1555
|
-
return /* @__PURE__ */ jsxs(Wrapper$1, { ref:
|
1543
|
+
return /* @__PURE__ */ jsxs(Wrapper$1, { ref: composedBoxRefs, isOverDropTarget, children: [
|
1556
1544
|
isOverDropTarget && /* @__PURE__ */ jsx(
|
1557
1545
|
DropPlaceholder,
|
1558
1546
|
{
|
@@ -1590,15 +1578,16 @@ const DragAndDropElement = ({
|
|
1590
1578
|
onSelect: () => setDragVisibility("visible"),
|
1591
1579
|
onMouseLeave: () => setDragVisibility("hidden"),
|
1592
1580
|
"aria-disabled": disabled,
|
1593
|
-
dragVisibility,
|
1581
|
+
$dragVisibility: dragVisibility,
|
1594
1582
|
children: [
|
1595
1583
|
/* @__PURE__ */ jsx(
|
1596
1584
|
DragIconButton,
|
1597
1585
|
{
|
1598
|
-
|
1586
|
+
tag: "div",
|
1599
1587
|
role: "button",
|
1600
1588
|
tabIndex: 0,
|
1601
|
-
|
1589
|
+
withTooltip: false,
|
1590
|
+
label: formatMessage({
|
1602
1591
|
id: getTranslation("components.DragHandle-label"),
|
1603
1592
|
defaultMessage: "Drag"
|
1604
1593
|
}),
|
@@ -1606,7 +1595,7 @@ const DragAndDropElement = ({
|
|
1606
1595
|
"aria-disabled": disabled,
|
1607
1596
|
disabled,
|
1608
1597
|
draggable: true,
|
1609
|
-
dragHandleTopMargin,
|
1598
|
+
$dragHandleTopMargin: dragHandleTopMargin,
|
1610
1599
|
children: /* @__PURE__ */ jsx(Drag, { color: "neutral600" })
|
1611
1600
|
}
|
1612
1601
|
),
|
@@ -1618,17 +1607,18 @@ const DragAndDropElement = ({
|
|
1618
1607
|
};
|
1619
1608
|
const CloneDragItem = ({ children, dragHandleTopMargin }) => {
|
1620
1609
|
const { formatMessage } = useIntl();
|
1621
|
-
return /* @__PURE__ */ jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", dragVisibility: "visible", children: [
|
1610
|
+
return /* @__PURE__ */ jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", $dragVisibility: "visible", children: [
|
1622
1611
|
/* @__PURE__ */ jsx(
|
1623
1612
|
DragIconButton,
|
1624
1613
|
{
|
1625
|
-
|
1614
|
+
tag: "div",
|
1626
1615
|
role: "button",
|
1627
|
-
|
1616
|
+
withTooltip: false,
|
1617
|
+
label: formatMessage({
|
1628
1618
|
id: getTranslation("components.DragHandle-label"),
|
1629
1619
|
defaultMessage: "Drag"
|
1630
1620
|
}),
|
1631
|
-
dragHandleTopMargin,
|
1621
|
+
$dragHandleTopMargin: dragHandleTopMargin,
|
1632
1622
|
children: /* @__PURE__ */ jsx(Drag, { color: "neutral600" })
|
1633
1623
|
}
|
1634
1624
|
),
|
@@ -1950,8 +1940,8 @@ const EditorLayout$1 = ({
|
|
1950
1940
|
direction: "column",
|
1951
1941
|
alignItems: "flex-start",
|
1952
1942
|
height: "512px",
|
1953
|
-
disabled,
|
1954
|
-
hasError: Boolean(error),
|
1943
|
+
$disabled: disabled,
|
1944
|
+
$hasError: Boolean(error),
|
1955
1945
|
style: { overflow: "hidden" },
|
1956
1946
|
"aria-describedby": ariaDescriptionId,
|
1957
1947
|
position: "relative",
|
@@ -1959,6 +1949,29 @@ const EditorLayout$1 = ({
|
|
1959
1949
|
}
|
1960
1950
|
);
|
1961
1951
|
};
|
1952
|
+
const InputWrapper = styled(Flex)`
|
1953
|
+
border: 1px solid
|
1954
|
+
${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
|
1955
|
+
border-radius: ${({ theme }) => theme.borderRadius};
|
1956
|
+
background: ${({ theme }) => theme.colors.neutral0};
|
1957
|
+
|
1958
|
+
${({ theme, $hasError = false }) => css`
|
1959
|
+
outline: none;
|
1960
|
+
box-shadow: 0;
|
1961
|
+
transition-property: border-color, box-shadow, fill;
|
1962
|
+
transition-duration: 0.2s;
|
1963
|
+
|
1964
|
+
&:focus-within {
|
1965
|
+
border: 1px solid ${$hasError ? theme.colors.danger600 : theme.colors.primary600};
|
1966
|
+
box-shadow: ${$hasError ? theme.colors.danger600 : theme.colors.primary600} 0px 0px 0px 2px;
|
1967
|
+
}
|
1968
|
+
`}
|
1969
|
+
|
1970
|
+
${({ theme, $disabled }) => $disabled ? css`
|
1971
|
+
color: ${theme.colors.neutral600};
|
1972
|
+
background: ${theme.colors.neutral150};
|
1973
|
+
` : void 0}
|
1974
|
+
`;
|
1962
1975
|
const stylesToInherit = css`
|
1963
1976
|
font-size: inherit;
|
1964
1977
|
color: inherit;
|
@@ -1971,10 +1984,14 @@ const ItalicText = styled(Typography)`
|
|
1971
1984
|
font-style: italic;
|
1972
1985
|
${stylesToInherit}
|
1973
1986
|
`;
|
1974
|
-
const UnderlineText = styled(Typography).attrs({
|
1987
|
+
const UnderlineText = styled(Typography).attrs({
|
1988
|
+
textDecoration: "underline"
|
1989
|
+
})`
|
1975
1990
|
${stylesToInherit}
|
1976
1991
|
`;
|
1977
|
-
const StrikeThroughText = styled(Typography).attrs({
|
1992
|
+
const StrikeThroughText = styled(Typography).attrs({
|
1993
|
+
textDecoration: "line-through"
|
1994
|
+
})`
|
1978
1995
|
${stylesToInherit}
|
1979
1996
|
`;
|
1980
1997
|
const InlineCode = styled.code`
|
@@ -2265,8 +2282,8 @@ const BlocksInput = React.forwardRef(
|
|
2265
2282
|
({ label, name: name2, required = false, hint, labelAction, ...editorProps }, forwardedRef) => {
|
2266
2283
|
const id = React.useId();
|
2267
2284
|
const field = useField(name2);
|
2268
|
-
return /* @__PURE__ */ jsx(Field, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
2269
|
-
/* @__PURE__ */ jsx(
|
2285
|
+
return /* @__PURE__ */ jsx(Field.Root, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
2286
|
+
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
2270
2287
|
/* @__PURE__ */ jsx(
|
2271
2288
|
BlocksEditor,
|
2272
2289
|
{
|
@@ -2279,11 +2296,12 @@ const BlocksInput = React.forwardRef(
|
|
2279
2296
|
...editorProps
|
2280
2297
|
}
|
2281
2298
|
),
|
2282
|
-
/* @__PURE__ */ jsx(
|
2283
|
-
/* @__PURE__ */ jsx(
|
2299
|
+
/* @__PURE__ */ jsx(Field.Hint, {}),
|
2300
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
2284
2301
|
] }) });
|
2285
2302
|
}
|
2286
2303
|
);
|
2304
|
+
const MemoizedBlocksInput = React.memo(BlocksInput);
|
2287
2305
|
const createDefaultForm = (contentType, components = {}) => {
|
2288
2306
|
const traverseSchema = (attributes) => {
|
2289
2307
|
return Object.entries(attributes).reduce((acc, [key, attribute]) => {
|
@@ -2311,7 +2329,7 @@ const Initializer = ({ disabled, name: name2, onClick }) => {
|
|
2311
2329
|
/* @__PURE__ */ jsx(
|
2312
2330
|
Box,
|
2313
2331
|
{
|
2314
|
-
|
2332
|
+
tag: "button",
|
2315
2333
|
background: "neutral100",
|
2316
2334
|
borderColor: field.error ? "danger600" : "neutral200",
|
2317
2335
|
hasRadius: true,
|
@@ -2362,9 +2380,9 @@ const NonRepeatableComponent = ({
|
|
2362
2380
|
hasRadius: isNested,
|
2363
2381
|
borderColor: isNested ? "neutral200" : void 0,
|
2364
2382
|
children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index) => {
|
2365
|
-
return /* @__PURE__ */ jsx(Grid$1, { gap: 4, children: row.map(({ size, ...field }) => {
|
2383
|
+
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2366
2384
|
const completeFieldName = `${name2}.${field.name}`;
|
2367
|
-
return /* @__PURE__ */ jsx(
|
2385
|
+
return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
|
2368
2386
|
}) }, index);
|
2369
2387
|
}) })
|
2370
2388
|
}
|
@@ -2388,7 +2406,7 @@ const RepeatableComponent = ({
|
|
2388
2406
|
const moveFieldRow = useForm("RepeatableComponent", (state) => state.moveFieldRow);
|
2389
2407
|
const removeFieldRow = useForm("RepeatableComponent", (state) => state.removeFieldRow);
|
2390
2408
|
const { max = Infinity } = attribute;
|
2391
|
-
const [collapseToOpen, setCollapseToOpen] = React.useState(
|
2409
|
+
const [collapseToOpen, setCollapseToOpen] = React.useState("");
|
2392
2410
|
const [liveText, setLiveText] = React.useState("");
|
2393
2411
|
const componentTmpKeyWithFocussedField = React.useMemo(() => {
|
2394
2412
|
if (search.has("field")) {
|
@@ -2404,13 +2422,19 @@ const RepeatableComponent = ({
|
|
2404
2422
|
}
|
2405
2423
|
return void 0;
|
2406
2424
|
}, [search, name2, value]);
|
2425
|
+
const prevValue = usePrev(value);
|
2426
|
+
React.useEffect(() => {
|
2427
|
+
if (prevValue && prevValue.length < value.length) {
|
2428
|
+
setCollapseToOpen(value[value.length - 1].__temp_key__);
|
2429
|
+
}
|
2430
|
+
}, [value, prevValue]);
|
2407
2431
|
React.useEffect(() => {
|
2408
|
-
if (typeof componentTmpKeyWithFocussedField === "
|
2432
|
+
if (typeof componentTmpKeyWithFocussedField === "string") {
|
2409
2433
|
setCollapseToOpen(componentTmpKeyWithFocussedField);
|
2410
2434
|
}
|
2411
2435
|
}, [componentTmpKeyWithFocussedField]);
|
2412
2436
|
const toggleCollapses = () => {
|
2413
|
-
setCollapseToOpen(
|
2437
|
+
setCollapseToOpen("");
|
2414
2438
|
};
|
2415
2439
|
const handleClick = () => {
|
2416
2440
|
if (value.length < max) {
|
@@ -2442,12 +2466,8 @@ const RepeatableComponent = ({
|
|
2442
2466
|
);
|
2443
2467
|
moveFieldRow(name2, currentIndex, newIndex);
|
2444
2468
|
};
|
2445
|
-
const
|
2446
|
-
|
2447
|
-
setCollapseToOpen(null);
|
2448
|
-
} else {
|
2449
|
-
setCollapseToOpen(key);
|
2450
|
-
}
|
2469
|
+
const handleValueChange = (key) => {
|
2470
|
+
setCollapseToOpen(key);
|
2451
2471
|
};
|
2452
2472
|
const getItemPos = (index) => `${index + 1} of ${value.length}`;
|
2453
2473
|
const handleCancel = (index) => {
|
@@ -2502,158 +2522,104 @@ const RepeatableComponent = ({
|
|
2502
2522
|
defaultMessage: `Press spacebar to grab and re-order`
|
2503
2523
|
}) }),
|
2504
2524
|
/* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
2505
|
-
/* @__PURE__ */ jsxs(
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2525
|
+
/* @__PURE__ */ jsxs(
|
2526
|
+
AccordionRoot,
|
2527
|
+
{
|
2528
|
+
$error: error,
|
2529
|
+
value: collapseToOpen,
|
2530
|
+
onValueChange: handleValueChange,
|
2531
|
+
"aria-describedby": ariaDescriptionId,
|
2532
|
+
children: [
|
2533
|
+
value.map(({ __temp_key__: key, id }, index) => {
|
2534
|
+
const nameWithIndex = `${name2}.${index}`;
|
2535
|
+
return /* @__PURE__ */ jsx(
|
2536
|
+
ComponentProvider,
|
2517
2537
|
{
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2538
|
+
id,
|
2539
|
+
uid: attribute.component,
|
2540
|
+
level: level + 1,
|
2541
|
+
type: "repeatable",
|
2542
|
+
children: /* @__PURE__ */ jsx(
|
2543
|
+
Component,
|
2544
|
+
{
|
2545
|
+
disabled,
|
2546
|
+
name: nameWithIndex,
|
2547
|
+
attribute,
|
2548
|
+
index,
|
2549
|
+
mainField,
|
2550
|
+
onMoveItem: handleMoveComponentField,
|
2551
|
+
onDeleteComponent: () => {
|
2552
|
+
removeFieldRow(name2, index);
|
2553
|
+
toggleCollapses();
|
2554
|
+
},
|
2555
|
+
toggleCollapses,
|
2556
|
+
onCancel: handleCancel,
|
2557
|
+
onDropItem: handleDropItem,
|
2558
|
+
onGrabItem: handleGrabItem,
|
2559
|
+
__temp_key__: key,
|
2560
|
+
children: layout.map((row, index2) => {
|
2561
|
+
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2562
|
+
const completeFieldName = `${nameWithIndex}.${field.name}`;
|
2563
|
+
return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
|
2564
|
+
}) }, index2);
|
2565
|
+
})
|
2566
|
+
}
|
2567
|
+
)
|
2568
|
+
},
|
2569
|
+
key
|
2570
|
+
);
|
2571
|
+
}),
|
2572
|
+
/* @__PURE__ */ jsx(TextButtonCustom, { disabled, onClick: handleClick, startIcon: /* @__PURE__ */ jsx(Plus, {}), children: formatMessage({
|
2573
|
+
id: getTranslation("containers.EditView.add.new-entry"),
|
2574
|
+
defaultMessage: "Add an entry"
|
2575
|
+
}) })
|
2576
|
+
]
|
2577
|
+
}
|
2578
|
+
)
|
2551
2579
|
] });
|
2552
2580
|
};
|
2581
|
+
const AccordionRoot = styled(Accordion.Root)`
|
2582
|
+
border: 1px solid
|
2583
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
2584
|
+
`;
|
2553
2585
|
const TextButtonCustom = styled(TextButton)`
|
2554
|
-
height: 100%;
|
2555
2586
|
width: 100%;
|
2556
|
-
border-radius: 0 0 4px 4px;
|
2557
2587
|
display: flex;
|
2558
2588
|
justify-content: center;
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
}
|
2563
|
-
`;
|
2564
|
-
const AccordionFooter = styled(Box)`
|
2565
|
-
overflow: hidden;
|
2566
|
-
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2567
|
-
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2568
|
-
border-left: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2569
|
-
border-radius: 0 0 ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius};
|
2570
|
-
`;
|
2571
|
-
const AccordionContent = styled(Box)`
|
2572
|
-
border-bottom: none;
|
2573
|
-
|
2574
|
-
/* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
|
2575
|
-
& > div > div {
|
2576
|
-
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2577
|
-
border-top-color: transparent;
|
2578
|
-
}
|
2589
|
+
border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2590
|
+
padding-inline: ${(props) => props.theme.spaces[6]};
|
2591
|
+
padding-block: ${(props) => props.theme.spaces[3]};
|
2579
2592
|
|
2580
|
-
|
2581
|
-
|
2582
|
-
border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2583
|
-
}
|
2584
|
-
|
2585
|
-
/* Reset all the border-radius' */
|
2586
|
-
& > div > div,
|
2587
|
-
& > div > div > div {
|
2588
|
-
border-radius: unset;
|
2589
|
-
}
|
2590
|
-
|
2591
|
-
/* Give the border radius back to the first accordion */
|
2592
|
-
& > div:first-child > div,
|
2593
|
-
& > div:first-child > div > div {
|
2594
|
-
border-radius: ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius} 0 0;
|
2595
|
-
}
|
2596
|
-
|
2597
|
-
& > div > div[data-strapi-expanded='true'] {
|
2598
|
-
border: 1px solid ${({ theme }) => theme.colors.primary600};
|
2599
|
-
}
|
2600
|
-
`;
|
2601
|
-
const AccordionGroup = ({ children, error }) => {
|
2602
|
-
return /* @__PURE__ */ jsxs(KeyboardNavigable, { attributeName: "data-strapi-accordion-toggle", children: [
|
2603
|
-
children,
|
2604
|
-
error && /* @__PURE__ */ jsx(Box, { paddingTop: 1, children: /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "danger600", children: error }) })
|
2605
|
-
] });
|
2606
|
-
};
|
2607
|
-
const CustomIconButton$1 = styled(IconButton)`
|
2608
|
-
background-color: transparent;
|
2593
|
+
&:not([disabled]) {
|
2594
|
+
cursor: pointer;
|
2609
2595
|
|
2610
|
-
|
2611
|
-
|
2612
|
-
fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : theme.colors.neutral600};
|
2596
|
+
&:hover {
|
2597
|
+
background-color: ${(props) => props.theme.colors.primary100};
|
2613
2598
|
}
|
2614
2599
|
}
|
2615
2600
|
|
2616
|
-
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
}
|
2621
|
-
}
|
2601
|
+
span {
|
2602
|
+
font-weight: 600;
|
2603
|
+
font-size: 1.4rem;
|
2604
|
+
line-height: 2.4rem;
|
2622
2605
|
}
|
2623
|
-
`;
|
2624
|
-
const ActionsFlex$1 = styled(Flex)`
|
2625
|
-
& .drag-handle {
|
2626
|
-
background: unset;
|
2627
2606
|
|
2628
|
-
|
2629
|
-
|
2630
|
-
fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : void 0};
|
2631
|
-
}
|
2632
|
-
}
|
2633
|
-
|
2634
|
-
&:hover {
|
2635
|
-
svg {
|
2636
|
-
path {
|
2637
|
-
/* keeps the hover style of the accordion */
|
2638
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
2639
|
-
}
|
2640
|
-
}
|
2641
|
-
}
|
2607
|
+
@media (prefers-reduced-motion: no-preference) {
|
2608
|
+
transition: background-color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
2642
2609
|
}
|
2643
2610
|
`;
|
2644
2611
|
const Component = ({
|
2645
2612
|
disabled,
|
2646
2613
|
index,
|
2647
|
-
isOpen,
|
2648
2614
|
name: name2,
|
2649
2615
|
mainField = {
|
2650
2616
|
name: "id",
|
2651
2617
|
type: "integer"
|
2652
2618
|
},
|
2653
2619
|
children,
|
2654
|
-
onClickToggle,
|
2655
2620
|
onDeleteComponent,
|
2656
2621
|
toggleCollapses,
|
2622
|
+
__temp_key__,
|
2657
2623
|
...dragProps
|
2658
2624
|
}) => {
|
2659
2625
|
const { formatMessage } = useIntl();
|
@@ -2678,50 +2644,44 @@ const Component = ({
|
|
2678
2644
|
dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
|
2679
2645
|
}, [dragPreviewRef, index]);
|
2680
2646
|
const composedAccordionRefs = useComposedRefs(accordionRef, dragRef);
|
2681
|
-
const composedBoxRefs = useComposedRefs(
|
2682
|
-
|
2683
|
-
|
2684
|
-
|
2685
|
-
|
2686
|
-
|
2687
|
-
|
2688
|
-
|
2689
|
-
|
2690
|
-
|
2691
|
-
|
2692
|
-
|
2693
|
-
|
2694
|
-
|
2695
|
-
|
2696
|
-
|
2697
|
-
|
2698
|
-
}
|
2699
|
-
|
2700
|
-
|
2701
|
-
|
2702
|
-
|
2703
|
-
|
2704
|
-
|
2705
|
-
|
2706
|
-
|
2707
|
-
|
2708
|
-
|
2709
|
-
|
2710
|
-
"
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
] }),
|
2720
|
-
title: displayValue,
|
2721
|
-
togglePosition: "left"
|
2722
|
-
}
|
2723
|
-
),
|
2724
|
-
/* @__PURE__ */ jsx(AccordionContent$1, { children: /* @__PURE__ */ jsx(
|
2647
|
+
const composedBoxRefs = useComposedRefs(
|
2648
|
+
boxRef,
|
2649
|
+
dropRef
|
2650
|
+
);
|
2651
|
+
return /* @__PURE__ */ jsx(Fragment, { children: isDragging ? /* @__PURE__ */ jsx(Preview$1, {}) : /* @__PURE__ */ jsxs(Accordion.Item, { ref: composedBoxRefs, value: __temp_key__, children: [
|
2652
|
+
/* @__PURE__ */ jsxs(Accordion.Header, { children: [
|
2653
|
+
/* @__PURE__ */ jsx(Accordion.Trigger, { children: displayValue }),
|
2654
|
+
/* @__PURE__ */ jsxs(Accordion.Actions, { children: [
|
2655
|
+
/* @__PURE__ */ jsx(
|
2656
|
+
IconButton,
|
2657
|
+
{
|
2658
|
+
borderWidth: 0,
|
2659
|
+
onClick: onDeleteComponent,
|
2660
|
+
label: formatMessage({
|
2661
|
+
id: getTranslation("containers.Edit.delete"),
|
2662
|
+
defaultMessage: "Delete"
|
2663
|
+
}),
|
2664
|
+
children: /* @__PURE__ */ jsx(Trash, {})
|
2665
|
+
}
|
2666
|
+
),
|
2667
|
+
/* @__PURE__ */ jsx(
|
2668
|
+
IconButton,
|
2669
|
+
{
|
2670
|
+
ref: composedAccordionRefs,
|
2671
|
+
borderWidth: 0,
|
2672
|
+
onClick: (e) => e.stopPropagation(),
|
2673
|
+
"data-handler-id": handlerId,
|
2674
|
+
label: formatMessage({
|
2675
|
+
id: getTranslation("components.DragHandle-label"),
|
2676
|
+
defaultMessage: "Drag"
|
2677
|
+
}),
|
2678
|
+
onKeyDown: handleKeyDown,
|
2679
|
+
children: /* @__PURE__ */ jsx(Drag, {})
|
2680
|
+
}
|
2681
|
+
)
|
2682
|
+
] })
|
2683
|
+
] }),
|
2684
|
+
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(
|
2725
2685
|
Flex,
|
2726
2686
|
{
|
2727
2687
|
direction: "column",
|
@@ -2735,7 +2695,7 @@ const Component = ({
|
|
2735
2695
|
] }) });
|
2736
2696
|
};
|
2737
2697
|
const Preview$1 = () => {
|
2738
|
-
return /* @__PURE__ */ jsx(StyledSpan, {
|
2698
|
+
return /* @__PURE__ */ jsx(StyledSpan, { tag: "span", padding: 6, background: "primary100" });
|
2739
2699
|
};
|
2740
2700
|
const StyledSpan = styled(Box)`
|
2741
2701
|
display: block;
|
@@ -2761,29 +2721,15 @@ const ComponentInput = ({
|
|
2761
2721
|
const data = transformDocument(schema, components)(form);
|
2762
2722
|
field.onChange(name2, data);
|
2763
2723
|
};
|
2764
|
-
return /* @__PURE__ */ jsxs(
|
2724
|
+
return /* @__PURE__ */ jsxs(Field.Root, { error: field.error, required, children: [
|
2765
2725
|
/* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
|
2766
|
-
/* @__PURE__ */ jsxs(
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
fontWeight: "bold",
|
2774
|
-
as: "label",
|
2775
|
-
children: [
|
2776
|
-
label,
|
2777
|
-
attribute.repeatable && /* @__PURE__ */ jsxs(Fragment, { children: [
|
2778
|
-
" (",
|
2779
|
-
Array.isArray(field.value) ? field.value.length : 0,
|
2780
|
-
")"
|
2781
|
-
] }),
|
2782
|
-
required && /* @__PURE__ */ jsx(Typography, { textColor: "danger600", children: "*" })
|
2783
|
-
]
|
2784
|
-
}
|
2785
|
-
),
|
2786
|
-
labelAction && /* @__PURE__ */ jsx(Box, { paddingLeft: 1, children: labelAction })
|
2726
|
+
/* @__PURE__ */ jsxs(Field.Label, { action: labelAction, children: [
|
2727
|
+
label,
|
2728
|
+
attribute.repeatable && /* @__PURE__ */ jsxs(Fragment, { children: [
|
2729
|
+
" (",
|
2730
|
+
Array.isArray(field.value) ? field.value.length : 0,
|
2731
|
+
")"
|
2732
|
+
] })
|
2787
2733
|
] }),
|
2788
2734
|
showResetComponent && /* @__PURE__ */ jsx(
|
2789
2735
|
IconButton,
|
@@ -2792,21 +2738,21 @@ const ComponentInput = ({
|
|
2792
2738
|
id: getTranslation("components.reset-entry"),
|
2793
2739
|
defaultMessage: "Reset Entry"
|
2794
2740
|
}),
|
2795
|
-
icon: /* @__PURE__ */ jsx(Trash, {}),
|
2796
2741
|
borderWidth: 0,
|
2797
2742
|
onClick: () => {
|
2798
2743
|
field.onChange(name2, null);
|
2799
|
-
}
|
2744
|
+
},
|
2745
|
+
children: /* @__PURE__ */ jsx(Trash, {})
|
2800
2746
|
}
|
2801
2747
|
)
|
2802
2748
|
] }),
|
2803
|
-
/* @__PURE__ */
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
] })
|
2749
|
+
!attribute.repeatable && !field.value && /* @__PURE__ */ jsx(Initializer, { disabled, name: name2, onClick: handleInitialisationClick }),
|
2750
|
+
!attribute.repeatable && field.value ? /* @__PURE__ */ jsx(NonRepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }) : null,
|
2751
|
+
attribute.repeatable && /* @__PURE__ */ jsx(RepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }),
|
2752
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
2808
2753
|
] });
|
2809
2754
|
};
|
2755
|
+
const MemoizedComponentInput = React.memo(ComponentInput);
|
2810
2756
|
const AddComponentButton = ({
|
2811
2757
|
hasError,
|
2812
2758
|
isDisabled,
|
@@ -2826,10 +2772,10 @@ const AddComponentButton = ({
|
|
2826
2772
|
paddingLeft: 4,
|
2827
2773
|
paddingRight: 4,
|
2828
2774
|
style: { cursor: isDisabled ? "not-allowed" : "pointer" },
|
2829
|
-
children: /* @__PURE__ */ jsxs(Flex, {
|
2775
|
+
children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
|
2830
2776
|
/* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
|
2831
2777
|
/* @__PURE__ */ jsx(
|
2832
|
-
|
2778
|
+
AddComponentTitle,
|
2833
2779
|
{
|
2834
2780
|
variant: "pi",
|
2835
2781
|
fontWeight: "bold",
|
@@ -2853,13 +2799,14 @@ const StyledAddIcon = styled(PlusCircle)`
|
|
2853
2799
|
fill: ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral600};
|
2854
2800
|
}
|
2855
2801
|
`;
|
2802
|
+
const AddComponentTitle = styled(Typography)``;
|
2856
2803
|
const StyledButton = styled(BaseButton)`
|
2857
2804
|
border-radius: 26px;
|
2858
2805
|
border-color: ${({ theme }) => theme.colors.neutral150};
|
2859
2806
|
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
|
2860
2807
|
|
2861
2808
|
&:hover {
|
2862
|
-
${
|
2809
|
+
${AddComponentTitle} {
|
2863
2810
|
color: ${({ theme }) => theme.colors.primary600};
|
2864
2811
|
}
|
2865
2812
|
|
@@ -2873,7 +2820,7 @@ const StyledButton = styled(BaseButton)`
|
|
2873
2820
|
}
|
2874
2821
|
}
|
2875
2822
|
&:active {
|
2876
|
-
${
|
2823
|
+
${AddComponentTitle} {
|
2877
2824
|
color: ${({ theme }) => theme.colors.primary600};
|
2878
2825
|
}
|
2879
2826
|
${StyledAddIcon} {
|
@@ -2890,27 +2837,15 @@ const ComponentCategory = ({
|
|
2890
2837
|
category,
|
2891
2838
|
components = [],
|
2892
2839
|
variant = "primary",
|
2893
|
-
|
2894
|
-
onAddComponent,
|
2895
|
-
onToggle
|
2840
|
+
onAddComponent
|
2896
2841
|
}) => {
|
2897
2842
|
const { formatMessage } = useIntl();
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
return /* @__PURE__ */ jsxs(Accordion, { expanded: isOpen, onToggle: handleToggle, size: "S", children: [
|
2902
|
-
/* @__PURE__ */ jsx(
|
2903
|
-
AccordionToggle,
|
2904
|
-
{
|
2905
|
-
variant,
|
2906
|
-
title: formatMessage({ id: category, defaultMessage: category }),
|
2907
|
-
togglePosition: "left"
|
2908
|
-
}
|
2909
|
-
),
|
2910
|
-
/* @__PURE__ */ jsx(AccordionContent$1, { children: /* @__PURE__ */ jsx(Box, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: /* @__PURE__ */ jsx(Grid, { children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsx(
|
2843
|
+
return /* @__PURE__ */ jsxs(Accordion.Item, { value: category, children: [
|
2844
|
+
/* @__PURE__ */ jsx(Accordion.Header, { variant, children: /* @__PURE__ */ jsx(Accordion.Trigger, { children: formatMessage({ id: category, defaultMessage: category }) }) }),
|
2845
|
+
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Grid, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsx(
|
2911
2846
|
ComponentBox,
|
2912
2847
|
{
|
2913
|
-
|
2848
|
+
tag: "button",
|
2914
2849
|
type: "button",
|
2915
2850
|
background: "neutral100",
|
2916
2851
|
justifyContent: "center",
|
@@ -2920,34 +2855,32 @@ const ComponentCategory = ({
|
|
2920
2855
|
shrink: 0,
|
2921
2856
|
borderColor: "neutral200",
|
2922
2857
|
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "center", justifyContent: "center", children: [
|
2923
|
-
/* @__PURE__ */ jsx(ComponentIcon, { icon }),
|
2924
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold",
|
2858
|
+
/* @__PURE__ */ jsx(ComponentIcon, { color: "currentColor", background: "primary200", icon }),
|
2859
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: displayName })
|
2925
2860
|
] })
|
2926
2861
|
},
|
2927
2862
|
uid
|
2928
|
-
)) }) })
|
2863
|
+
)) }) })
|
2929
2864
|
] });
|
2930
2865
|
};
|
2931
|
-
const Grid = styled
|
2866
|
+
const Grid = styled(Box)`
|
2932
2867
|
display: grid;
|
2933
2868
|
grid-template-columns: repeat(auto-fit, 14rem);
|
2934
2869
|
grid-gap: ${({ theme }) => theme.spaces[1]};
|
2935
2870
|
`;
|
2936
2871
|
const ComponentBox = styled(Flex)`
|
2872
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
2873
|
+
cursor: pointer;
|
2874
|
+
|
2875
|
+
@media (prefers-reduced-motion: no-preference) {
|
2876
|
+
transition: color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
2877
|
+
}
|
2878
|
+
|
2937
2879
|
&:focus,
|
2938
2880
|
&:hover {
|
2939
2881
|
border: 1px solid ${({ theme }) => theme.colors.primary200};
|
2940
2882
|
background: ${({ theme }) => theme.colors.primary100};
|
2941
|
-
|
2942
|
-
${Typography} {
|
2943
|
-
color: ${({ theme }) => theme.colors.primary600};
|
2944
|
-
}
|
2945
|
-
|
2946
|
-
/* > Flex > ComponentIcon */
|
2947
|
-
> div > div:first-child {
|
2948
|
-
background: ${({ theme }) => theme.colors.primary200};
|
2949
|
-
color: ${({ theme }) => theme.colors.primary600};
|
2950
|
-
}
|
2883
|
+
color: ${({ theme }) => theme.colors.primary600};
|
2951
2884
|
}
|
2952
2885
|
`;
|
2953
2886
|
const ComponentPicker = ({
|
@@ -2956,19 +2889,8 @@ const ComponentPicker = ({
|
|
2956
2889
|
onClickAddComponent
|
2957
2890
|
}) => {
|
2958
2891
|
const { formatMessage } = useIntl();
|
2959
|
-
const [categoryToOpen, setCategoryToOpen] = React.useState("");
|
2960
|
-
React.useEffect(() => {
|
2961
|
-
const categoryKeys = Object.keys(dynamicComponentsByCategory);
|
2962
|
-
if (isOpen && categoryKeys.length > 0) {
|
2963
|
-
setCategoryToOpen(categoryKeys[0]);
|
2964
|
-
}
|
2965
|
-
}, [isOpen, dynamicComponentsByCategory]);
|
2966
2892
|
const handleAddComponentToDz = (componentUid) => () => {
|
2967
2893
|
onClickAddComponent(componentUid);
|
2968
|
-
setCategoryToOpen("");
|
2969
|
-
};
|
2970
|
-
const handleClickToggle = (categoryName) => {
|
2971
|
-
setCategoryToOpen((currentCat) => currentCat === categoryName ? "" : categoryName);
|
2972
2894
|
};
|
2973
2895
|
if (!isOpen) {
|
2974
2896
|
return null;
|
@@ -2989,14 +2911,12 @@ const ComponentPicker = ({
|
|
2989
2911
|
id: getTranslation("components.DynamicZone.ComponentPicker-label"),
|
2990
2912
|
defaultMessage: "Pick one component"
|
2991
2913
|
}) }) }),
|
2992
|
-
/* @__PURE__ */ jsx(Box, { paddingTop: 2, children: /* @__PURE__ */ jsx(
|
2914
|
+
/* @__PURE__ */ jsx(Box, { paddingTop: 2, children: /* @__PURE__ */ jsx(Accordion.Root, { defaultValue: Object.keys(dynamicComponentsByCategory)[0], children: Object.entries(dynamicComponentsByCategory).map(([category, components], index) => /* @__PURE__ */ jsx(
|
2993
2915
|
ComponentCategory,
|
2994
2916
|
{
|
2995
2917
|
category,
|
2996
2918
|
components,
|
2997
2919
|
onAddComponent: handleAddComponentToDz,
|
2998
|
-
isOpen: category === categoryToOpen,
|
2999
|
-
onToggle: handleClickToggle,
|
3000
2920
|
variant: index % 2 === 1 ? "primary" : "secondary"
|
3001
2921
|
},
|
3002
2922
|
category
|
@@ -3011,27 +2931,21 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
|
|
3011
2931
|
id: "components.NotAllowedInput.text",
|
3012
2932
|
defaultMessage: "No permissions to see this field"
|
3013
2933
|
});
|
3014
|
-
return /* @__PURE__ */
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3026
|
-
|
3027
|
-
|
3028
|
-
);
|
2934
|
+
return /* @__PURE__ */ jsxs(Field.Root, { id: name2, hint, name: name2, required, children: [
|
2935
|
+
/* @__PURE__ */ jsx(Field.Label, { children: label }),
|
2936
|
+
/* @__PURE__ */ jsx(
|
2937
|
+
TextInput,
|
2938
|
+
{
|
2939
|
+
disabled: true,
|
2940
|
+
placeholder,
|
2941
|
+
startAction: /* @__PURE__ */ jsx(EyeStriked, { fill: "neutral600" }),
|
2942
|
+
type: "text",
|
2943
|
+
value: ""
|
2944
|
+
}
|
2945
|
+
),
|
2946
|
+
/* @__PURE__ */ jsx(Field.Hint, {})
|
2947
|
+
] });
|
3029
2948
|
};
|
3030
|
-
const StyledIcon = styled(EyeStriked)`
|
3031
|
-
& > path {
|
3032
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
3033
|
-
}
|
3034
|
-
`;
|
3035
2949
|
function useDebounce(value, delay) {
|
3036
2950
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
3037
2951
|
useEffect(() => {
|
@@ -3084,188 +2998,193 @@ const uidApi = contentManagerApi.injectEndpoints({
|
|
3084
2998
|
});
|
3085
2999
|
const { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;
|
3086
3000
|
const UID_REGEX = /^[A-Za-z0-9-_.~]*$/;
|
3087
|
-
const UIDInput = React.forwardRef(
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3093
|
-
|
3094
|
-
|
3095
|
-
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
field: props.name,
|
3107
|
-
data: {
|
3108
|
-
id: id ?? "",
|
3109
|
-
...allFormValues
|
3110
|
-
},
|
3111
|
-
params
|
3112
|
-
},
|
3113
|
-
{
|
3114
|
-
skip: field.value || !props.required
|
3115
|
-
}
|
3116
|
-
);
|
3117
|
-
React.useEffect(() => {
|
3118
|
-
if (apiError) {
|
3119
|
-
toggleNotification({
|
3120
|
-
type: "warning",
|
3121
|
-
message: formatAPIError(apiError)
|
3122
|
-
});
|
3123
|
-
}
|
3124
|
-
}, [apiError, formatAPIError, toggleNotification]);
|
3125
|
-
React.useEffect(() => {
|
3126
|
-
if (defaultGeneratedUID && field.value === void 0) {
|
3127
|
-
field.onChange(props.name, defaultGeneratedUID);
|
3128
|
-
}
|
3129
|
-
}, [defaultGeneratedUID, field, props.name]);
|
3130
|
-
const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
|
3131
|
-
const handleRegenerateClick = async () => {
|
3132
|
-
try {
|
3133
|
-
const res = await generateUID({
|
3001
|
+
const UIDInput = React.forwardRef(
|
3002
|
+
({ hint, label, labelAction, name: name2, required, ...props }, ref) => {
|
3003
|
+
const { model, id } = useDoc();
|
3004
|
+
const allFormValues = useForm("InputUID", (form) => form.values);
|
3005
|
+
const [availability, setAvailability] = React.useState();
|
3006
|
+
const [showRegenerate, setShowRegenerate] = React.useState(false);
|
3007
|
+
const field = useField(name2);
|
3008
|
+
const debouncedValue = useDebounce(field.value, 300);
|
3009
|
+
const { toggleNotification } = useNotification();
|
3010
|
+
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
3011
|
+
const { formatMessage } = useIntl();
|
3012
|
+
const [{ query }] = useQueryParams();
|
3013
|
+
const params = React.useMemo(() => buildValidParams(query), [query]);
|
3014
|
+
const {
|
3015
|
+
data: defaultGeneratedUID,
|
3016
|
+
isLoading: isGeneratingDefaultUID,
|
3017
|
+
error: apiError
|
3018
|
+
} = useGetDefaultUIDQuery(
|
3019
|
+
{
|
3134
3020
|
contentTypeUID: model,
|
3135
|
-
field:
|
3136
|
-
data: {
|
3021
|
+
field: name2,
|
3022
|
+
data: {
|
3023
|
+
id: id ?? "",
|
3024
|
+
...allFormValues
|
3025
|
+
},
|
3137
3026
|
params
|
3138
|
-
}
|
3139
|
-
|
3140
|
-
field.
|
3141
|
-
}
|
3027
|
+
},
|
3028
|
+
{
|
3029
|
+
skip: field.value || !required
|
3030
|
+
}
|
3031
|
+
);
|
3032
|
+
React.useEffect(() => {
|
3033
|
+
if (apiError) {
|
3142
3034
|
toggleNotification({
|
3143
|
-
type: "
|
3144
|
-
message: formatAPIError(
|
3035
|
+
type: "warning",
|
3036
|
+
message: formatAPIError(apiError)
|
3145
3037
|
});
|
3146
3038
|
}
|
3147
|
-
}
|
3148
|
-
|
3149
|
-
|
3150
|
-
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3155
|
-
|
3156
|
-
|
3157
|
-
|
3158
|
-
|
3159
|
-
|
3160
|
-
|
3161
|
-
|
3162
|
-
|
3163
|
-
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
message: formatAPIError(availabilityError)
|
3179
|
-
});
|
3180
|
-
}
|
3181
|
-
}, [availabilityError, formatAPIError, toggleNotification]);
|
3182
|
-
React.useEffect(() => {
|
3183
|
-
setAvailability(availabilityData);
|
3184
|
-
let timer;
|
3185
|
-
if (availabilityData?.isAvailable) {
|
3186
|
-
timer = window.setTimeout(() => {
|
3187
|
-
setAvailability(void 0);
|
3188
|
-
}, 4e3);
|
3189
|
-
}
|
3190
|
-
return () => {
|
3191
|
-
if (timer) {
|
3192
|
-
clearTimeout(timer);
|
3039
|
+
}, [apiError, formatAPIError, toggleNotification]);
|
3040
|
+
React.useEffect(() => {
|
3041
|
+
if (defaultGeneratedUID && field.value === void 0) {
|
3042
|
+
field.onChange(name2, defaultGeneratedUID);
|
3043
|
+
}
|
3044
|
+
}, [defaultGeneratedUID, field, name2]);
|
3045
|
+
const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
|
3046
|
+
const handleRegenerateClick = async () => {
|
3047
|
+
try {
|
3048
|
+
const res = await generateUID({
|
3049
|
+
contentTypeUID: model,
|
3050
|
+
field: name2,
|
3051
|
+
data: { id: id ?? "", ...allFormValues },
|
3052
|
+
params
|
3053
|
+
});
|
3054
|
+
if ("data" in res) {
|
3055
|
+
field.onChange(name2, res.data);
|
3056
|
+
} else {
|
3057
|
+
toggleNotification({
|
3058
|
+
type: "danger",
|
3059
|
+
message: formatAPIError(res.error)
|
3060
|
+
});
|
3061
|
+
}
|
3062
|
+
} catch (err) {
|
3063
|
+
toggleNotification({
|
3064
|
+
type: "danger",
|
3065
|
+
message: formatMessage({
|
3066
|
+
id: "notification.error",
|
3067
|
+
defaultMessage: "An error occurred."
|
3068
|
+
})
|
3069
|
+
});
|
3193
3070
|
}
|
3194
3071
|
};
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
// @ts-expect-error – label _could_ be a ReactNode since it's a child, this should be fixed in the DS.
|
3201
|
-
/* @__PURE__ */ jsx(
|
3202
|
-
TextInput,
|
3072
|
+
const {
|
3073
|
+
data: availabilityData,
|
3074
|
+
isLoading: isCheckingAvailability,
|
3075
|
+
error: availabilityError
|
3076
|
+
} = useGetAvailabilityQuery(
|
3203
3077
|
{
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3078
|
+
contentTypeUID: model,
|
3079
|
+
field: name2,
|
3080
|
+
value: debouncedValue ? debouncedValue.trim() : "",
|
3081
|
+
params
|
3082
|
+
},
|
3083
|
+
{
|
3084
|
+
skip: !Boolean(
|
3085
|
+
debouncedValue !== field.initialValue && debouncedValue && UID_REGEX.test(debouncedValue.trim())
|
3086
|
+
)
|
3087
|
+
}
|
3088
|
+
);
|
3089
|
+
React.useEffect(() => {
|
3090
|
+
if (availabilityError) {
|
3091
|
+
toggleNotification({
|
3092
|
+
type: "warning",
|
3093
|
+
message: formatAPIError(availabilityError)
|
3094
|
+
});
|
3095
|
+
}
|
3096
|
+
}, [availabilityError, formatAPIError, toggleNotification]);
|
3097
|
+
React.useEffect(() => {
|
3098
|
+
setAvailability(availabilityData);
|
3099
|
+
let timer;
|
3100
|
+
if (availabilityData?.isAvailable) {
|
3101
|
+
timer = window.setTimeout(() => {
|
3102
|
+
setAvailability(void 0);
|
3103
|
+
}, 4e3);
|
3104
|
+
}
|
3105
|
+
return () => {
|
3106
|
+
if (timer) {
|
3107
|
+
clearTimeout(timer);
|
3108
|
+
}
|
3109
|
+
};
|
3110
|
+
}, [availabilityData]);
|
3111
|
+
const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
|
3112
|
+
const fieldRef = useFocusInputField(name2);
|
3113
|
+
const composedRefs = useComposedRefs(ref, fieldRef);
|
3114
|
+
return /* @__PURE__ */ jsxs(Field.Root, { hint, name: name2, error: field.error, required, children: [
|
3115
|
+
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
3116
|
+
/* @__PURE__ */ jsx(
|
3117
|
+
TextInput,
|
3118
|
+
{
|
3119
|
+
ref: composedRefs,
|
3120
|
+
disabled: props.disabled,
|
3121
|
+
endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
|
3122
|
+
availability && !showRegenerate && /* @__PURE__ */ jsxs(
|
3123
|
+
TextValidation,
|
3248
3124
|
{
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
|
3125
|
+
alignItems: "center",
|
3126
|
+
gap: 1,
|
3127
|
+
justifyContent: "flex-end",
|
3128
|
+
$available: !!availability?.isAvailable,
|
3129
|
+
"data-not-here-outer": true,
|
3130
|
+
position: "absolute",
|
3131
|
+
pointerEvents: "none",
|
3132
|
+
right: 6,
|
3133
|
+
width: "100px",
|
3134
|
+
children: [
|
3135
|
+
availability?.isAvailable ? /* @__PURE__ */ jsx(CheckCircle, {}) : /* @__PURE__ */ jsx(WarningCircle, {}),
|
3136
|
+
/* @__PURE__ */ jsx(
|
3137
|
+
Typography,
|
3138
|
+
{
|
3139
|
+
textColor: availability.isAvailable ? "success600" : "danger600",
|
3140
|
+
variant: "pi",
|
3141
|
+
children: formatMessage(
|
3142
|
+
availability.isAvailable ? {
|
3143
|
+
id: "content-manager.components.uid.available",
|
3144
|
+
defaultMessage: "Available"
|
3145
|
+
} : {
|
3146
|
+
id: "content-manager.components.uid.unavailable",
|
3147
|
+
defaultMessage: "Unavailable"
|
3148
|
+
}
|
3149
|
+
)
|
3150
|
+
}
|
3151
|
+
)
|
3152
|
+
]
|
3257
3153
|
}
|
3258
|
-
)
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3154
|
+
),
|
3155
|
+
!props.disabled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
3156
|
+
showRegenerate && /* @__PURE__ */ jsx(TextValidation, { alignItems: "center", justifyContent: "flex-end", gap: 1, children: /* @__PURE__ */ jsx(Typography, { textColor: "primary600", variant: "pi", children: formatMessage({
|
3157
|
+
id: "content-manager.components.uid.regenerate",
|
3158
|
+
defaultMessage: "Regenerate"
|
3159
|
+
}) }) }),
|
3160
|
+
/* @__PURE__ */ jsx(
|
3161
|
+
FieldActionWrapper,
|
3162
|
+
{
|
3163
|
+
onClick: handleRegenerateClick,
|
3164
|
+
label: formatMessage({
|
3165
|
+
id: "content-manager.components.uid.regenerate",
|
3166
|
+
defaultMessage: "Regenerate"
|
3167
|
+
}),
|
3168
|
+
onMouseEnter: () => setShowRegenerate(true),
|
3169
|
+
onMouseLeave: () => setShowRegenerate(false),
|
3170
|
+
children: isLoading ? /* @__PURE__ */ jsx(LoadingWrapper, { "data-testid": "loading-wrapper", children: /* @__PURE__ */ jsx(Loader, {}) }) : /* @__PURE__ */ jsx(ArrowClockwise, {})
|
3171
|
+
}
|
3172
|
+
)
|
3173
|
+
] })
|
3174
|
+
] }),
|
3175
|
+
onChange: field.onChange,
|
3176
|
+
value: field.value ?? "",
|
3177
|
+
...props
|
3178
|
+
}
|
3179
|
+
),
|
3180
|
+
/* @__PURE__ */ jsx(Field.Error, {}),
|
3181
|
+
/* @__PURE__ */ jsx(Field.Hint, {})
|
3182
|
+
] });
|
3183
|
+
}
|
3184
|
+
);
|
3185
|
+
const FieldActionWrapper = styled(Field.Action)`
|
3186
|
+
width: 1.6rem;
|
3187
|
+
|
3269
3188
|
svg {
|
3270
3189
|
height: 1.6rem;
|
3271
3190
|
width: 1.6rem;
|
@@ -3286,7 +3205,7 @@ const TextValidation = styled(Flex)`
|
|
3286
3205
|
width: 1.2rem;
|
3287
3206
|
|
3288
3207
|
path {
|
3289
|
-
fill: ${({ theme, available }) => available ? theme.colors.success600 : theme.colors.danger600};
|
3208
|
+
fill: ${({ theme, $available }) => $available ? theme.colors.success600 : theme.colors.danger600};
|
3290
3209
|
}
|
3291
3210
|
}
|
3292
3211
|
`;
|
@@ -3301,6 +3220,7 @@ const rotation = keyframes`
|
|
3301
3220
|
const LoadingWrapper = styled(Flex)`
|
3302
3221
|
animation: ${rotation} 2s infinite linear;
|
3303
3222
|
`;
|
3223
|
+
const MemoizedUIDInput = React.memo(UIDInput);
|
3304
3224
|
const md = new Markdown({
|
3305
3225
|
html: true,
|
3306
3226
|
// Enable HTML tags in source
|
@@ -3635,7 +3555,7 @@ const Editor = React.forwardRef(
|
|
3635
3555
|
[editorRef]
|
3636
3556
|
);
|
3637
3557
|
return /* @__PURE__ */ jsxs(EditorAndPreviewWrapper, { children: [
|
3638
|
-
/* @__PURE__ */ jsx(EditorStylesContainer, { isExpandMode, disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsx("textarea", { ref: textareaRef }) }),
|
3558
|
+
/* @__PURE__ */ jsx(EditorStylesContainer, { $isExpandMode: isExpandMode, $disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsx("textarea", { ref: textareaRef }) }),
|
3639
3559
|
isPreviewMode && /* @__PURE__ */ jsx(PreviewWysiwyg, { data: value })
|
3640
3560
|
] });
|
3641
3561
|
}
|
@@ -3645,7 +3565,7 @@ const EditorAndPreviewWrapper = styled.div`
|
|
3645
3565
|
height: calc(100% - 48px);
|
3646
3566
|
`;
|
3647
3567
|
const EditorStylesContainer = styled.div`
|
3648
|
-
cursor: ${({ disabled }) => disabled ? "not-allowed !important" : "auto"};
|
3568
|
+
cursor: ${({ $disabled }) => $disabled ? "not-allowed !important" : "auto"};
|
3649
3569
|
height: 100%;
|
3650
3570
|
/* BASICS */
|
3651
3571
|
.CodeMirror-placeholder {
|
@@ -3655,7 +3575,7 @@ const EditorStylesContainer = styled.div`
|
|
3655
3575
|
.CodeMirror {
|
3656
3576
|
/* Set height, width, borders, and global font properties here */
|
3657
3577
|
font-size: 1.4rem;
|
3658
|
-
height: ${({ isExpandMode }) => isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
|
3578
|
+
height: ${({ $isExpandMode }) => $isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
|
3659
3579
|
color: ${({ theme }) => theme.colors.neutral800};
|
3660
3580
|
direction: ltr;
|
3661
3581
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
@@ -4340,8 +4260,6 @@ const quoteAndCodeHandler = (editor, markdownType) => {
|
|
4340
4260
|
};
|
4341
4261
|
const CustomIconButton = styled(IconButton)`
|
4342
4262
|
padding: ${({ theme }) => theme.spaces[2]};
|
4343
|
-
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
4344
|
-
outline-offset: -2px !important;
|
4345
4263
|
|
4346
4264
|
svg {
|
4347
4265
|
width: 1.8rem;
|
@@ -4408,7 +4326,7 @@ const WysiwygNav = ({
|
|
4408
4326
|
id: "components.Wysiwyg.selectOptions.title",
|
4409
4327
|
defaultMessage: "Add a title"
|
4410
4328
|
});
|
4411
|
-
|
4329
|
+
React.useRef(null);
|
4412
4330
|
const handleTogglePopover = () => {
|
4413
4331
|
setVisiblePopover((prev) => !prev);
|
4414
4332
|
};
|
@@ -4421,21 +4339,21 @@ const WysiwygNav = ({
|
|
4421
4339
|
justifyContent: "space-between",
|
4422
4340
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4423
4341
|
children: [
|
4424
|
-
/* @__PURE__ */ jsxs(
|
4425
|
-
/* @__PURE__ */ jsxs(SingleSelect, { disabled: true, placeholder: selectPlaceholder,
|
4342
|
+
/* @__PURE__ */ jsxs(Flex, { children: [
|
4343
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(SingleSelect, { disabled: true, placeholder: selectPlaceholder, "aria-label": selectPlaceholder, children: [
|
4426
4344
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
|
4427
4345
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
|
4428
4346
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h3", children: "h3" }),
|
4429
4347
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h4", children: "h4" }),
|
4430
4348
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h5", children: "h5" }),
|
4431
4349
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
|
4432
|
-
] }),
|
4350
|
+
] }) }),
|
4433
4351
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4434
|
-
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Bold", name: "Bold",
|
4435
|
-
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Italic", name: "Italic",
|
4436
|
-
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Underline", name: "Underline",
|
4352
|
+
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
|
4353
|
+
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
|
4354
|
+
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
|
4437
4355
|
] }),
|
4438
|
-
/* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More",
|
4356
|
+
/* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsx(More, {}) })
|
4439
4357
|
] }),
|
4440
4358
|
!isExpandMode && /* @__PURE__ */ jsx(Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
|
4441
4359
|
id: "components.Wysiwyg.ToggleMode.markdown-mode",
|
@@ -4453,13 +4371,12 @@ const WysiwygNav = ({
|
|
4453
4371
|
justifyContent: "space-between",
|
4454
4372
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4455
4373
|
children: [
|
4456
|
-
/* @__PURE__ */ jsxs(
|
4457
|
-
/* @__PURE__ */ jsxs(
|
4374
|
+
/* @__PURE__ */ jsxs(Flex, { children: [
|
4375
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
|
4458
4376
|
SingleSelect,
|
4459
4377
|
{
|
4460
4378
|
placeholder: selectPlaceholder,
|
4461
|
-
label: selectPlaceholder,
|
4462
|
-
size: "S",
|
4379
|
+
"aria-label": selectPlaceholder,
|
4463
4380
|
onChange: (value) => onActionClick(value, editorRef),
|
4464
4381
|
children: [
|
4465
4382
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
|
@@ -4470,7 +4387,7 @@ const WysiwygNav = ({
|
|
4470
4387
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
|
4471
4388
|
]
|
4472
4389
|
}
|
4473
|
-
),
|
4390
|
+
) }),
|
4474
4391
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4475
4392
|
/* @__PURE__ */ jsx(
|
4476
4393
|
CustomIconButton,
|
@@ -4478,7 +4395,7 @@ const WysiwygNav = ({
|
|
4478
4395
|
onClick: () => onActionClick("Bold", editorRef),
|
4479
4396
|
label: "Bold",
|
4480
4397
|
name: "Bold",
|
4481
|
-
|
4398
|
+
children: /* @__PURE__ */ jsx(Bold, {})
|
4482
4399
|
}
|
4483
4400
|
),
|
4484
4401
|
/* @__PURE__ */ jsx(
|
@@ -4487,7 +4404,7 @@ const WysiwygNav = ({
|
|
4487
4404
|
onClick: () => onActionClick("Italic", editorRef),
|
4488
4405
|
label: "Italic",
|
4489
4406
|
name: "Italic",
|
4490
|
-
|
4407
|
+
children: /* @__PURE__ */ jsx(Italic, {})
|
4491
4408
|
}
|
4492
4409
|
),
|
4493
4410
|
/* @__PURE__ */ jsx(
|
@@ -4496,91 +4413,85 @@ const WysiwygNav = ({
|
|
4496
4413
|
onClick: () => onActionClick("Underline", editorRef),
|
4497
4414
|
label: "Underline",
|
4498
4415
|
name: "Underline",
|
4499
|
-
|
4416
|
+
children: /* @__PURE__ */ jsx(Underline, {})
|
4500
4417
|
}
|
4501
4418
|
)
|
4502
4419
|
] }),
|
4503
|
-
/* @__PURE__ */
|
4504
|
-
MoreButton,
|
4505
|
-
{
|
4506
|
-
|
4507
|
-
|
4508
|
-
|
4509
|
-
|
4510
|
-
|
4511
|
-
|
4512
|
-
|
4513
|
-
|
4514
|
-
|
4515
|
-
|
4516
|
-
|
4517
|
-
|
4518
|
-
|
4519
|
-
|
4520
|
-
|
4521
|
-
|
4522
|
-
|
4523
|
-
|
4524
|
-
|
4525
|
-
|
4526
|
-
|
4527
|
-
|
4528
|
-
|
4529
|
-
|
4530
|
-
|
4531
|
-
|
4532
|
-
|
4533
|
-
|
4534
|
-
|
4535
|
-
|
4536
|
-
|
4537
|
-
|
4538
|
-
|
4539
|
-
|
4540
|
-
|
4541
|
-
|
4542
|
-
|
4543
|
-
|
4544
|
-
|
4545
|
-
|
4546
|
-
|
4547
|
-
|
4548
|
-
|
4549
|
-
|
4550
|
-
|
4551
|
-
|
4552
|
-
|
4553
|
-
|
4554
|
-
|
4555
|
-
|
4556
|
-
|
4557
|
-
|
4558
|
-
|
4559
|
-
|
4560
|
-
|
4561
|
-
|
4562
|
-
|
4563
|
-
|
4564
|
-
|
4565
|
-
|
4566
|
-
|
4567
|
-
|
4568
|
-
|
4569
|
-
|
4570
|
-
|
4571
|
-
|
4572
|
-
|
4573
|
-
|
4574
|
-
|
4575
|
-
|
4576
|
-
|
4577
|
-
|
4578
|
-
name: "Quote",
|
4579
|
-
icon: /* @__PURE__ */ jsx(Quotes, {})
|
4580
|
-
}
|
4581
|
-
)
|
4582
|
-
] })
|
4583
|
-
] }) })
|
4420
|
+
/* @__PURE__ */ jsxs(Popover.Root, { children: [
|
4421
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(MoreButton, { label: "More", children: /* @__PURE__ */ jsx(More, {}) }) }),
|
4422
|
+
/* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
|
4423
|
+
/* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
|
4424
|
+
/* @__PURE__ */ jsx(
|
4425
|
+
CustomIconButton,
|
4426
|
+
{
|
4427
|
+
onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
|
4428
|
+
label: "Strikethrough",
|
4429
|
+
name: "Strikethrough",
|
4430
|
+
children: /* @__PURE__ */ jsx(StrikeThrough, {})
|
4431
|
+
}
|
4432
|
+
),
|
4433
|
+
/* @__PURE__ */ jsx(
|
4434
|
+
CustomIconButton,
|
4435
|
+
{
|
4436
|
+
onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
|
4437
|
+
label: "BulletList",
|
4438
|
+
name: "BulletList",
|
4439
|
+
children: /* @__PURE__ */ jsx(BulletList, {})
|
4440
|
+
}
|
4441
|
+
),
|
4442
|
+
/* @__PURE__ */ jsx(
|
4443
|
+
CustomIconButton,
|
4444
|
+
{
|
4445
|
+
onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
|
4446
|
+
label: "NumberList",
|
4447
|
+
name: "NumberList",
|
4448
|
+
children: /* @__PURE__ */ jsx(NumberList, {})
|
4449
|
+
}
|
4450
|
+
)
|
4451
|
+
] }),
|
4452
|
+
/* @__PURE__ */ jsxs(IconButtonGroup, { children: [
|
4453
|
+
/* @__PURE__ */ jsx(
|
4454
|
+
CustomIconButton,
|
4455
|
+
{
|
4456
|
+
onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
|
4457
|
+
label: "Code",
|
4458
|
+
name: "Code",
|
4459
|
+
children: /* @__PURE__ */ jsx(Code, {})
|
4460
|
+
}
|
4461
|
+
),
|
4462
|
+
/* @__PURE__ */ jsx(
|
4463
|
+
CustomIconButton,
|
4464
|
+
{
|
4465
|
+
onClick: () => {
|
4466
|
+
handleTogglePopover();
|
4467
|
+
onToggleMediaLib();
|
4468
|
+
},
|
4469
|
+
label: "Image",
|
4470
|
+
name: "Image",
|
4471
|
+
children: /* @__PURE__ */ jsx(Image$1, {})
|
4472
|
+
}
|
4473
|
+
),
|
4474
|
+
/* @__PURE__ */ jsx(
|
4475
|
+
CustomLinkIconButton,
|
4476
|
+
{
|
4477
|
+
onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
|
4478
|
+
label: "Link",
|
4479
|
+
name: "Link",
|
4480
|
+
children: /* @__PURE__ */ jsx(Link$1, {})
|
4481
|
+
}
|
4482
|
+
),
|
4483
|
+
/* @__PURE__ */ jsx(
|
4484
|
+
CustomIconButton,
|
4485
|
+
{
|
4486
|
+
onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
|
4487
|
+
label: "Quote",
|
4488
|
+
name: "Quote",
|
4489
|
+
children: /* @__PURE__ */ jsx(Quotes, {})
|
4490
|
+
}
|
4491
|
+
)
|
4492
|
+
] })
|
4493
|
+
] }) })
|
4494
|
+
] })
|
4584
4495
|
] }),
|
4585
4496
|
onTogglePreviewMode && /* @__PURE__ */ jsx(Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
|
4586
4497
|
id: "components.Wysiwyg.ToggleMode.preview-mode",
|
@@ -4590,19 +4501,6 @@ const WysiwygNav = ({
|
|
4590
4501
|
}
|
4591
4502
|
);
|
4592
4503
|
};
|
4593
|
-
const StyledFlex = styled(Flex)`
|
4594
|
-
/* Hide the label, every input needs a label. */
|
4595
|
-
label {
|
4596
|
-
border: 0;
|
4597
|
-
clip: rect(0 0 0 0);
|
4598
|
-
height: 1px;
|
4599
|
-
margin: -1px;
|
4600
|
-
overflow: hidden;
|
4601
|
-
padding: 0;
|
4602
|
-
position: absolute;
|
4603
|
-
width: 1px;
|
4604
|
-
}
|
4605
|
-
`;
|
4606
4504
|
const Wysiwyg = React.forwardRef(
|
4607
4505
|
({ hint, disabled, label, name: name2, placeholder, required, labelAction }, forwardedRef) => {
|
4608
4506
|
const field = useField(name2);
|
@@ -4667,9 +4565,9 @@ const Wysiwyg = React.forwardRef(
|
|
4667
4565
|
insertFile(editorRef, formattedFiles);
|
4668
4566
|
setMediaLibVisible(false);
|
4669
4567
|
};
|
4670
|
-
return /* @__PURE__ */ jsxs(Field, { name: name2, hint, error: field.error, required, children: [
|
4568
|
+
return /* @__PURE__ */ jsxs(Field.Root, { name: name2, hint, error: field.error, required, children: [
|
4671
4569
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
4672
|
-
/* @__PURE__ */ jsx(
|
4570
|
+
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
4673
4571
|
/* @__PURE__ */ jsxs(
|
4674
4572
|
EditorLayout,
|
4675
4573
|
{
|
@@ -4710,14 +4608,15 @@ const Wysiwyg = React.forwardRef(
|
|
4710
4608
|
]
|
4711
4609
|
}
|
4712
4610
|
),
|
4713
|
-
/* @__PURE__ */ jsx(
|
4714
|
-
/* @__PURE__ */ jsx(
|
4611
|
+
/* @__PURE__ */ jsx(Field.Hint, {}),
|
4612
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
4715
4613
|
] }),
|
4716
4614
|
mediaLibVisible && // @ts-expect-error – TODO: fix this way of injecting because it's not really typeable without a registry.
|
4717
4615
|
/* @__PURE__ */ jsx(MediaLibraryDialog, { onClose: handleToggleMediaLib, onSelectAssets: handleSelectAssets })
|
4718
4616
|
] });
|
4719
4617
|
}
|
4720
4618
|
);
|
4619
|
+
const MemoizedWysiwyg = React.memo(Wysiwyg);
|
4721
4620
|
const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
4722
4621
|
const { id } = useDoc();
|
4723
4622
|
const isFormDisabled = useForm("InputRenderer", (state) => state.disabled);
|
@@ -4767,10 +4666,10 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4767
4666
|
}
|
4768
4667
|
switch (props.type) {
|
4769
4668
|
case "blocks":
|
4770
|
-
return /* @__PURE__ */ jsx(
|
4669
|
+
return /* @__PURE__ */ jsx(MemoizedBlocksInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4771
4670
|
case "component":
|
4772
4671
|
return /* @__PURE__ */ jsx(
|
4773
|
-
|
4672
|
+
MemoizedComponentInput,
|
4774
4673
|
{
|
4775
4674
|
...props,
|
4776
4675
|
hint,
|
@@ -4782,11 +4681,11 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4782
4681
|
case "dynamiczone":
|
4783
4682
|
return /* @__PURE__ */ jsx(DynamicZone, { ...props, hint, disabled: fieldIsDisabled });
|
4784
4683
|
case "relation":
|
4785
|
-
return /* @__PURE__ */ jsx(
|
4684
|
+
return /* @__PURE__ */ jsx(MemoizedRelationsField, { ...props, hint, disabled: fieldIsDisabled });
|
4786
4685
|
case "richtext":
|
4787
|
-
return /* @__PURE__ */ jsx(
|
4686
|
+
return /* @__PURE__ */ jsx(MemoizedWysiwyg, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4788
4687
|
case "uid":
|
4789
|
-
return /* @__PURE__ */ jsx(
|
4688
|
+
return /* @__PURE__ */ jsx(MemoizedUIDInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4790
4689
|
case "enumeration":
|
4791
4690
|
return /* @__PURE__ */ jsx(
|
4792
4691
|
InputRenderer$1,
|
@@ -4858,6 +4757,7 @@ const getMinMax = (attribute) => {
|
|
4858
4757
|
return { maximum: void 0, minimum: void 0 };
|
4859
4758
|
}
|
4860
4759
|
};
|
4760
|
+
const MemoizedInputRenderer = memo(InputRenderer);
|
4861
4761
|
const DynamicComponent = ({
|
4862
4762
|
componentUid,
|
4863
4763
|
disabled,
|
@@ -4871,7 +4771,6 @@ const DynamicComponent = ({
|
|
4871
4771
|
dynamicComponentsByCategory = {},
|
4872
4772
|
onAddComponent
|
4873
4773
|
}) => {
|
4874
|
-
const [isOpen, setIsOpen] = React.useState(true);
|
4875
4774
|
const { formatMessage } = useIntl();
|
4876
4775
|
const formValues = useForm("DynamicComponent", (state) => state.values);
|
4877
4776
|
const {
|
@@ -4880,7 +4779,7 @@ const DynamicComponent = ({
|
|
4880
4779
|
const title = React.useMemo(() => {
|
4881
4780
|
const { mainField } = components[componentUid]?.settings ?? { mainField: "id" };
|
4882
4781
|
const mainFieldValue = getIn(formValues, `${name2}.${index}.${mainField}`);
|
4883
|
-
const displayedValue = mainField === "id" ? "" : String(mainFieldValue).trim();
|
4782
|
+
const displayedValue = mainField === "id" || !mainFieldValue ? "" : String(mainFieldValue).trim();
|
4884
4783
|
const mainValue = displayedValue.length > 0 ? `- ${displayedValue}` : displayedValue;
|
4885
4784
|
return mainValue;
|
4886
4785
|
}, [componentUid, components, formValues, name2, index]);
|
@@ -4891,9 +4790,6 @@ const DynamicComponent = ({
|
|
4891
4790
|
) ?? { icon: null, displayName: null };
|
4892
4791
|
return { icon: icon2, displayName: displayName2 };
|
4893
4792
|
}, [componentUid, dynamicComponentsByCategory]);
|
4894
|
-
const handleToggle = () => {
|
4895
|
-
setIsOpen((s) => !s);
|
4896
|
-
};
|
4897
4793
|
const [{ handlerId, isDragging, handleKeyDown }, boxRef, dropRef, dragRef, dragPreviewRef] = useDragAndDrop(!disabled, {
|
4898
4794
|
type: `${ItemTypes.DYNAMIC_ZONE}_${name2}`,
|
4899
4795
|
index,
|
@@ -4911,9 +4807,9 @@ const DynamicComponent = ({
|
|
4911
4807
|
dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
|
4912
4808
|
}, [dragPreviewRef, index]);
|
4913
4809
|
const composedBoxRefs = useComposedRefs(boxRef, dropRef);
|
4914
|
-
const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(
|
4810
|
+
const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
4915
4811
|
/* @__PURE__ */ jsx(
|
4916
|
-
|
4812
|
+
IconButton,
|
4917
4813
|
{
|
4918
4814
|
borderWidth: 0,
|
4919
4815
|
label: formatMessage(
|
@@ -4930,10 +4826,7 @@ const DynamicComponent = ({
|
|
4930
4826
|
/* @__PURE__ */ jsx(
|
4931
4827
|
IconButton,
|
4932
4828
|
{
|
4933
|
-
forwardedAs: "div",
|
4934
|
-
role: "button",
|
4935
4829
|
borderWidth: 0,
|
4936
|
-
tabIndex: 0,
|
4937
4830
|
onClick: (e) => e.stopPropagation(),
|
4938
4831
|
"data-handler-id": handlerId,
|
4939
4832
|
ref: dragRef,
|
@@ -4948,7 +4841,7 @@ const DynamicComponent = ({
|
|
4948
4841
|
/* @__PURE__ */ jsxs(Menu.Root, { children: [
|
4949
4842
|
/* @__PURE__ */ jsxs(Menu.Trigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
|
4950
4843
|
/* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
|
4951
|
-
/* @__PURE__ */ jsx(VisuallyHidden, {
|
4844
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children: formatMessage({
|
4952
4845
|
id: getTranslation("components.DynamicZone.more-actions"),
|
4953
4846
|
defaultMessage: "More actions"
|
4954
4847
|
}) })
|
@@ -4977,42 +4870,28 @@ const DynamicComponent = ({
|
|
4977
4870
|
] })
|
4978
4871
|
] })
|
4979
4872
|
] });
|
4980
|
-
|
4873
|
+
const accordionTitle = title ? `${displayName} ${title}` : displayName;
|
4874
|
+
const accordionValue = React.useId();
|
4875
|
+
return /* @__PURE__ */ jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
|
4981
4876
|
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Rectangle, { background: "neutral200" }) }),
|
4982
|
-
/* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */
|
4983
|
-
/* @__PURE__ */
|
4984
|
-
|
4985
|
-
|
4986
|
-
|
4987
|
-
|
4988
|
-
|
4989
|
-
|
4990
|
-
|
4991
|
-
|
4992
|
-
|
4877
|
+
/* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsx(Accordion.Root, { children: /* @__PURE__ */ jsxs(Accordion.Item, { value: accordionValue, children: [
|
4878
|
+
/* @__PURE__ */ jsxs(Accordion.Header, { children: [
|
4879
|
+
/* @__PURE__ */ jsx(
|
4880
|
+
Accordion.Trigger,
|
4881
|
+
{
|
4882
|
+
icon: icon && COMPONENT_ICONS[icon] ? COMPONENT_ICONS[icon] : COMPONENT_ICONS.dashboard,
|
4883
|
+
children: accordionTitle
|
4884
|
+
}
|
4885
|
+
),
|
4886
|
+
/* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
|
4887
|
+
] }),
|
4888
|
+
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
4993
4889
|
const fieldName = `${name2}.${index}.${field.name}`;
|
4994
|
-
return /* @__PURE__ */ jsx(
|
4890
|
+
return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field, name: fieldName }) }, fieldName);
|
4995
4891
|
}) }, rowInd)) }) }) })
|
4996
|
-
] }) })
|
4892
|
+
] }) }) })
|
4997
4893
|
] });
|
4998
4894
|
};
|
4999
|
-
const ActionsFlex = styled(Flex)`
|
5000
|
-
/*
|
5001
|
-
we need to remove the background from the button but we can't
|
5002
|
-
wrap the element in styled because it breaks the forwardedAs which
|
5003
|
-
we need for drag handler to work on firefox
|
5004
|
-
*/
|
5005
|
-
div[role='button'] {
|
5006
|
-
background: transparent;
|
5007
|
-
}
|
5008
|
-
`;
|
5009
|
-
const IconButtonCustom = styled(IconButton)`
|
5010
|
-
background-color: transparent;
|
5011
|
-
|
5012
|
-
svg path {
|
5013
|
-
fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : theme.colors.neutral600};
|
5014
|
-
}
|
5015
|
-
`;
|
5016
4895
|
const StyledBox = styled(Box)`
|
5017
4896
|
> div:first-child {
|
5018
4897
|
box-shadow: ${({ theme }) => theme.shadows.tableShadow};
|
@@ -5083,7 +4962,7 @@ const [DynamicZoneProvider, useDynamicZone] = createContext(
|
|
5083
4962
|
);
|
5084
4963
|
const DynamicZone = ({
|
5085
4964
|
attribute,
|
5086
|
-
disabled,
|
4965
|
+
disabled: disabledProp,
|
5087
4966
|
hint,
|
5088
4967
|
label,
|
5089
4968
|
labelAction,
|
@@ -5093,7 +4972,8 @@ const DynamicZone = ({
|
|
5093
4972
|
const { max = Infinity, min = -Infinity } = attribute ?? {};
|
5094
4973
|
const [addComponentIsOpen, setAddComponentIsOpen] = React.useState(false);
|
5095
4974
|
const [liveText, setLiveText] = React.useState("");
|
5096
|
-
const { components } = useDoc();
|
4975
|
+
const { components, isLoading } = useDoc();
|
4976
|
+
const disabled = disabledProp || isLoading;
|
5097
4977
|
const { addFieldRow, removeFieldRow, moveFieldRow } = useForm(
|
5098
4978
|
"DynamicZone",
|
5099
4979
|
({ addFieldRow: addFieldRow2, removeFieldRow: removeFieldRow2, moveFieldRow: moveFieldRow2 }) => ({
|
@@ -5301,19 +5181,19 @@ const DynamicZone = ({
|
|
5301
5181
|
] }) });
|
5302
5182
|
};
|
5303
5183
|
export {
|
5304
|
-
BlocksInput as B,
|
5305
|
-
ComponentInput as C,
|
5306
5184
|
DynamicZone as D,
|
5307
|
-
|
5185
|
+
MemoizedInputRenderer as M,
|
5308
5186
|
NotAllowedInput as N,
|
5309
|
-
UIDInput as U,
|
5310
|
-
Wysiwyg as W,
|
5311
5187
|
useDynamicZone as a,
|
5312
5188
|
useFieldHint as b,
|
5313
5189
|
createDefaultForm as c,
|
5190
|
+
MemoizedUIDInput as d,
|
5191
|
+
MemoizedWysiwyg as e,
|
5192
|
+
MemoizedComponentInput as f,
|
5193
|
+
MemoizedBlocksInput as g,
|
5314
5194
|
prepareTempKeys as p,
|
5315
5195
|
removeFieldsThatDontExistOnSchema as r,
|
5316
5196
|
transformDocument as t,
|
5317
5197
|
useLazyComponents as u
|
5318
5198
|
};
|
5319
|
-
//# sourceMappingURL=Field-
|
5199
|
+
//# sourceMappingURL=Field-BDMSCcy5.mjs.map
|