@strapi/content-manager 0.0.0-experimental.d53e940834bf72ddc725f1d2fd36dac9abec30cb → 0.0.0-experimental.d65615a2b9130dd742d3c396674457d7971da928

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 (134) hide show
  1. package/LICENSE +18 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-C-49MccQ.js → ComponentConfigurationPage-CO977CPh.js} +4 -4
  3. package/dist/_chunks/{ComponentConfigurationPage-C-49MccQ.js.map → ComponentConfigurationPage-CO977CPh.js.map} +1 -1
  4. package/dist/_chunks/{ComponentConfigurationPage-DmwmiFQy.mjs → ComponentConfigurationPage-CQroR9Qk.mjs} +4 -4
  5. package/dist/_chunks/{ComponentConfigurationPage-DmwmiFQy.mjs.map → ComponentConfigurationPage-CQroR9Qk.mjs.map} +1 -1
  6. package/dist/_chunks/{EditConfigurationPage-DjFJw56M.js → EditConfigurationPage-BPgoE-kf.js} +4 -4
  7. package/dist/_chunks/{EditConfigurationPage-DjFJw56M.js.map → EditConfigurationPage-BPgoE-kf.js.map} +1 -1
  8. package/dist/_chunks/{EditConfigurationPage-JT3E7NZy.mjs → EditConfigurationPage-tVCJ5vWC.mjs} +4 -4
  9. package/dist/_chunks/{EditConfigurationPage-JT3E7NZy.mjs.map → EditConfigurationPage-tVCJ5vWC.mjs.map} +1 -1
  10. package/dist/_chunks/{EditViewPage-CPj61RMh.mjs → EditViewPage-8mOu02ji.mjs} +30 -9
  11. package/dist/_chunks/EditViewPage-8mOu02ji.mjs.map +1 -0
  12. package/dist/_chunks/{EditViewPage-zT3fBr4Y.js → EditViewPage-BMVgUNOX.js} +30 -9
  13. package/dist/_chunks/EditViewPage-BMVgUNOX.js.map +1 -0
  14. package/dist/_chunks/{Field-dha5VnIQ.mjs → Field-CJPYzwD7.mjs} +249 -152
  15. package/dist/_chunks/Field-CJPYzwD7.mjs.map +1 -0
  16. package/dist/_chunks/{Field-Boxf9Ajp.js → Field-CdSLKFQk.js} +251 -154
  17. package/dist/_chunks/Field-CdSLKFQk.js.map +1 -0
  18. package/dist/_chunks/{Form-DHrru2AV.mjs → Form-DJOJ-GF1.mjs} +36 -17
  19. package/dist/_chunks/Form-DJOJ-GF1.mjs.map +1 -0
  20. package/dist/_chunks/{Form-y5g1SRsh.js → Form-eP5bZwap.js} +36 -17
  21. package/dist/_chunks/Form-eP5bZwap.js.map +1 -0
  22. package/dist/_chunks/{History-CqN6K7SX.js → History-B-Mrquzu.js} +63 -25
  23. package/dist/_chunks/History-B-Mrquzu.js.map +1 -0
  24. package/dist/_chunks/{History-Bru_KoeP.mjs → History-MnQLtk1g.mjs} +64 -26
  25. package/dist/_chunks/History-MnQLtk1g.mjs.map +1 -0
  26. package/dist/_chunks/{ListConfigurationPage-D8wGABj0.mjs → ListConfigurationPage-BcycI8Lw.mjs} +21 -9
  27. package/dist/_chunks/ListConfigurationPage-BcycI8Lw.mjs.map +1 -0
  28. package/dist/_chunks/{ListConfigurationPage-R_p-SbHZ.js → ListConfigurationPage-C0n4rUzH.js} +21 -9
  29. package/dist/_chunks/ListConfigurationPage-C0n4rUzH.js.map +1 -0
  30. package/dist/_chunks/{ListViewPage-SID6TRb9.mjs → ListViewPage-CRXONXwZ.mjs} +59 -41
  31. package/dist/_chunks/ListViewPage-CRXONXwZ.mjs.map +1 -0
  32. package/dist/_chunks/{ListViewPage-pEw_zug9.js → ListViewPage-q0SHVPUS.js} +61 -43
  33. package/dist/_chunks/ListViewPage-q0SHVPUS.js.map +1 -0
  34. package/dist/_chunks/{NoContentTypePage-C5dcQojD.js → NoContentTypePage-Bh3komDV.js} +2 -2
  35. package/dist/_chunks/{NoContentTypePage-C5dcQojD.js.map → NoContentTypePage-Bh3komDV.js.map} +1 -1
  36. package/dist/_chunks/{NoContentTypePage-CJ7UXwrQ.mjs → NoContentTypePage-ukzFRF3z.mjs} +2 -2
  37. package/dist/_chunks/{NoContentTypePage-CJ7UXwrQ.mjs.map → NoContentTypePage-ukzFRF3z.mjs.map} +1 -1
  38. package/dist/_chunks/{NoPermissionsPage-B7syEq5E.mjs → NoPermissionsPage-B4sD7Ble.mjs} +2 -2
  39. package/dist/_chunks/{NoPermissionsPage-B7syEq5E.mjs.map → NoPermissionsPage-B4sD7Ble.mjs.map} +1 -1
  40. package/dist/_chunks/{NoPermissionsPage-BtPrImPP.js → NoPermissionsPage-BGBpj_Y1.js} +2 -2
  41. package/dist/_chunks/{NoPermissionsPage-BtPrImPP.js.map → NoPermissionsPage-BGBpj_Y1.js.map} +1 -1
  42. package/dist/_chunks/{Relations-DjTQ5kGB.js → Relations-B53wYe8g.js} +33 -24
  43. package/dist/_chunks/Relations-B53wYe8g.js.map +1 -0
  44. package/dist/_chunks/{Relations-B9Crnhnn.mjs → Relations-CIexb8gr.mjs} +33 -24
  45. package/dist/_chunks/Relations-CIexb8gr.mjs.map +1 -0
  46. package/dist/_chunks/{en-fbKQxLGn.js → en-Bm0D0IWz.js} +17 -15
  47. package/dist/_chunks/{en-fbKQxLGn.js.map → en-Bm0D0IWz.js.map} +1 -1
  48. package/dist/_chunks/{en-Ux26r5pl.mjs → en-DKV44jRb.mjs} +17 -15
  49. package/dist/_chunks/{en-Ux26r5pl.mjs.map → en-DKV44jRb.mjs.map} +1 -1
  50. package/dist/_chunks/{index-DJXJw9V5.mjs → index-CJ2vYwuT.mjs} +997 -690
  51. package/dist/_chunks/index-CJ2vYwuT.mjs.map +1 -0
  52. package/dist/_chunks/{index-DVPWZkbS.js → index-DbT2sx-Q.js} +978 -671
  53. package/dist/_chunks/index-DbT2sx-Q.js.map +1 -0
  54. package/dist/_chunks/{layout-Dm6fbiQj.js → layout-CeBSIkmP.js} +24 -11
  55. package/dist/_chunks/layout-CeBSIkmP.js.map +1 -0
  56. package/dist/_chunks/{layout-Bau7ZfLV.mjs → layout-vzKSrr7p.mjs} +25 -12
  57. package/dist/_chunks/layout-vzKSrr7p.mjs.map +1 -0
  58. package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
  59. package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
  60. package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
  61. package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
  62. package/dist/_chunks/{relations-CKnpRgrN.js → relations-Cl-6t9iz.js} +2 -2
  63. package/dist/_chunks/{relations-CKnpRgrN.js.map → relations-Cl-6t9iz.js.map} +1 -1
  64. package/dist/_chunks/{relations-BH_kBSJ0.mjs → relations-DI0lguF0.mjs} +2 -2
  65. package/dist/_chunks/{relations-BH_kBSJ0.mjs.map → relations-DI0lguF0.mjs.map} +1 -1
  66. package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
  67. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
  68. package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
  69. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
  70. package/dist/admin/index.js +2 -1
  71. package/dist/admin/index.js.map +1 -1
  72. package/dist/admin/index.mjs +5 -4
  73. package/dist/admin/src/exports.d.ts +1 -1
  74. package/dist/admin/src/history/index.d.ts +3 -0
  75. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  76. package/dist/admin/src/hooks/useDocument.d.ts +32 -1
  77. package/dist/admin/src/index.d.ts +1 -0
  78. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -0
  79. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
  80. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
  81. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  82. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
  83. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  84. package/dist/admin/src/services/api.d.ts +1 -1
  85. package/dist/admin/src/services/components.d.ts +2 -2
  86. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  87. package/dist/admin/src/services/documents.d.ts +19 -17
  88. package/dist/admin/src/services/init.d.ts +1 -1
  89. package/dist/admin/src/services/relations.d.ts +2 -2
  90. package/dist/admin/src/services/uid.d.ts +3 -3
  91. package/dist/admin/src/utils/validation.d.ts +4 -1
  92. package/dist/server/index.js +207 -120
  93. package/dist/server/index.js.map +1 -1
  94. package/dist/server/index.mjs +208 -121
  95. package/dist/server/index.mjs.map +1 -1
  96. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  97. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  98. package/dist/server/src/controllers/uid.d.ts.map +1 -1
  99. package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
  100. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
  101. package/dist/server/src/history/services/history.d.ts.map +1 -1
  102. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  103. package/dist/server/src/history/services/utils.d.ts +2 -1
  104. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  105. package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
  106. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  107. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  108. package/dist/server/src/services/permission-checker.d.ts.map +1 -1
  109. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  110. package/dist/shared/contracts/collection-types.d.ts +3 -1
  111. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  112. package/package.json +12 -12
  113. package/dist/_chunks/EditViewPage-CPj61RMh.mjs.map +0 -1
  114. package/dist/_chunks/EditViewPage-zT3fBr4Y.js.map +0 -1
  115. package/dist/_chunks/Field-Boxf9Ajp.js.map +0 -1
  116. package/dist/_chunks/Field-dha5VnIQ.mjs.map +0 -1
  117. package/dist/_chunks/Form-DHrru2AV.mjs.map +0 -1
  118. package/dist/_chunks/Form-y5g1SRsh.js.map +0 -1
  119. package/dist/_chunks/History-Bru_KoeP.mjs.map +0 -1
  120. package/dist/_chunks/History-CqN6K7SX.js.map +0 -1
  121. package/dist/_chunks/ListConfigurationPage-D8wGABj0.mjs.map +0 -1
  122. package/dist/_chunks/ListConfigurationPage-R_p-SbHZ.js.map +0 -1
  123. package/dist/_chunks/ListViewPage-SID6TRb9.mjs.map +0 -1
  124. package/dist/_chunks/ListViewPage-pEw_zug9.js.map +0 -1
  125. package/dist/_chunks/Relations-B9Crnhnn.mjs.map +0 -1
  126. package/dist/_chunks/Relations-DjTQ5kGB.js.map +0 -1
  127. package/dist/_chunks/index-DJXJw9V5.mjs.map +0 -1
  128. package/dist/_chunks/index-DVPWZkbS.js.map +0 -1
  129. package/dist/_chunks/layout-Bau7ZfLV.mjs.map +0 -1
  130. package/dist/_chunks/layout-Dm6fbiQj.js.map +0 -1
  131. package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
  132. package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
  133. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
  134. package/strapi-server.js +0 -3
@@ -2,24 +2,24 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
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 { Box, SingleSelect, SingleSelectOption, Typography, Flex, BaseLink, Button, Popover, Field, Tooltip, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton, BaseButton, TextInput, IconButtonGroup, Menu, MenuItem } from "@strapi/design-system";
5
+ import { Box, SingleSelect, SingleSelectOption, Typography, Flex, BaseLink, Button, Popover, Field, Tooltip, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton, 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 { 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-DJXJw9V5.mjs";
8
+ import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, n as CLONE_PATH, d as buildValidParams, f as useDocumentRBAC, S as SINGLE_TYPES, o as useDocLayout } from "./index-CJ2vYwuT.mjs";
9
9
  import { generateNKeysBetween } from "fractional-indexing";
10
- import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-B9Crnhnn.mjs";
10
+ import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-CIexb8gr.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
12
  import { styled, css, keyframes } from "styled-components";
13
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
- import { g as getIn } from "./objects-mKMAmfec.mjs";
16
+ import { g as getIn } from "./objects-D6yBsdmx.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, u as usePrev } from "./usePrev-DH6iah0A.mjs";
20
+ import { p as prefixFileUrlWithBackendUrl, u as usePrev, a as useDebounce } from "./useDebounce-DmuSJIF3.mjs";
21
21
  import * as Toolbar from "@radix-ui/react-toolbar";
22
- import { useLocation } from "react-router-dom";
22
+ import { useLocation, useMatch } from "react-router-dom";
23
23
  import CodeMirror from "codemirror5";
24
24
  import sanitizeHtml from "sanitize-html";
25
25
  import { getLanguage, highlight, highlightAuto } from "highlight.js";
@@ -860,20 +860,8 @@ const LinkContent = React.forwardRef(
860
860
  const [linkText, setLinkText] = React.useState(elementText);
861
861
  const [linkUrl, setLinkUrl] = React.useState(link.url);
862
862
  const linkInputRef = React.useRef(null);
863
- const [showRemoveButton, setShowRemoveButton] = React.useState(false);
863
+ const isLastInsertedLink = editor.lastInsertedLinkPath ? !Path.equals(path, editor.lastInsertedLinkPath) : true;
864
864
  const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);
865
- const handleOpenChange = (isOpen) => {
866
- if (isOpen) {
867
- setPopoverOpen(isOpen);
868
- setShowRemoveButton(isOpen);
869
- } else {
870
- setPopoverOpen(isOpen);
871
- if (link.url === "") {
872
- removeLink(editor);
873
- }
874
- ReactEditor.focus(editor);
875
- }
876
- };
877
865
  const onLinkChange = (e) => {
878
866
  setIsSaveDisabled(false);
879
867
  setLinkUrl(e.target.value);
@@ -894,15 +882,33 @@ const LinkContent = React.forwardRef(
894
882
  editLink(editor, { url: linkUrl, text: linkText });
895
883
  setPopoverOpen(false);
896
884
  editor.lastInsertedLinkPath = null;
885
+ ReactEditor.focus(editor);
886
+ };
887
+ const handleClose = () => {
888
+ if (link.url === "") {
889
+ removeLink(editor);
890
+ }
891
+ setPopoverOpen(false);
892
+ ReactEditor.focus(editor);
897
893
  };
898
894
  React.useEffect(() => {
899
895
  if (popoverOpen)
900
896
  linkInputRef.current?.focus();
901
897
  }, [popoverOpen]);
902
898
  const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
903
- return /* @__PURE__ */ jsxs(Popover.Root, { onOpenChange: handleOpenChange, open: popoverOpen, children: [
904
- /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(StyledBaseLink, { ...attributes, ref: forwardedRef, href: link.url, color: "primary600", children }) }),
905
- /* @__PURE__ */ jsx(Popover.Content, { children: /* @__PURE__ */ jsxs(Flex, { padding: 4, tag: "form", onSubmit: handleSave, direction: "column", gap: 4, children: [
899
+ return /* @__PURE__ */ jsxs(Popover.Root, { open: popoverOpen, children: [
900
+ /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
901
+ StyledBaseLink,
902
+ {
903
+ ...attributes,
904
+ ref: forwardedRef,
905
+ href: link.url,
906
+ onClick: () => setPopoverOpen(true),
907
+ color: "primary600",
908
+ children
909
+ }
910
+ ) }),
911
+ /* @__PURE__ */ jsx(Popover.Content, { onPointerDownOutside: handleClose, children: /* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 4, children: [
906
912
  /* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
907
913
  /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
908
914
  id: "components.Blocks.popover.text",
@@ -948,7 +954,7 @@ const LinkContent = React.forwardRef(
948
954
  {
949
955
  variant: "danger-light",
950
956
  onClick: () => removeLink(editor),
951
- $visible: showRemoveButton,
957
+ $visible: isLastInsertedLink,
952
958
  children: formatMessage({
953
959
  id: "components.Blocks.popover.remove",
954
960
  defaultMessage: "Remove"
@@ -956,11 +962,11 @@ const LinkContent = React.forwardRef(
956
962
  }
957
963
  ),
958
964
  /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
959
- /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: () => handleOpenChange(false), children: formatMessage({
965
+ /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
960
966
  id: "components.Blocks.popover.cancel",
961
967
  defaultMessage: "Cancel"
962
968
  }) }),
963
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: Boolean(inputNotDirty) || isSaveDisabled, children: formatMessage({
969
+ /* @__PURE__ */ jsx(Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
964
970
  id: "components.Blocks.popover.save",
965
971
  defaultMessage: "Save"
966
972
  }) })
@@ -1401,7 +1407,7 @@ const ToolbarButton = ({
1401
1407
  width: 7,
1402
1408
  height: 7,
1403
1409
  hasRadius: true,
1404
- children: /* @__PURE__ */ jsx(Icon, { width: "1.2rem", height: "1.2rem", fill: disabled ? "neutral300" : enabledColor })
1410
+ children: /* @__PURE__ */ jsx(Icon, { fill: disabled ? "neutral300" : enabledColor })
1405
1411
  }
1406
1412
  )
1407
1413
  }
@@ -1546,6 +1552,26 @@ const ListButton = ({ block, format }) => {
1546
1552
  }
1547
1553
  return false;
1548
1554
  };
1555
+ const isListDisabled = () => {
1556
+ if (disabled) {
1557
+ return true;
1558
+ }
1559
+ if (!editor.selection) {
1560
+ return false;
1561
+ }
1562
+ const anchorNodeEntry = Editor$1.above(editor, {
1563
+ at: editor.selection.anchor,
1564
+ match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
1565
+ });
1566
+ const focusNodeEntry = Editor$1.above(editor, {
1567
+ at: editor.selection.focus,
1568
+ match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
1569
+ });
1570
+ if (!anchorNodeEntry || !focusNodeEntry) {
1571
+ return false;
1572
+ }
1573
+ return anchorNodeEntry[0] !== focusNodeEntry[0];
1574
+ };
1549
1575
  const toggleList = (format2) => {
1550
1576
  let currentListEntry;
1551
1577
  if (editor.selection) {
@@ -1579,7 +1605,7 @@ const ListButton = ({ block, format }) => {
1579
1605
  name: format,
1580
1606
  label: block.label,
1581
1607
  isActive: isListActive(),
1582
- disabled,
1608
+ disabled: isListDisabled(),
1583
1609
  handleClick: () => toggleList(format)
1584
1610
  }
1585
1611
  );
@@ -1723,6 +1749,7 @@ const DragItem = styled(Flex)`
1723
1749
  }
1724
1750
  `;
1725
1751
  const DragIconButton = styled(IconButton)`
1752
+ user-select: none;
1726
1753
  display: flex;
1727
1754
  align-items: center;
1728
1755
  justify-content: center;
@@ -1746,7 +1773,7 @@ const DragIconButton = styled(IconButton)`
1746
1773
  }
1747
1774
  svg {
1748
1775
  height: auto;
1749
- width: ${({ theme }) => theme.spaces[3]};
1776
+ min-width: ${({ theme }) => theme.spaces[3]};
1750
1777
 
1751
1778
  path {
1752
1779
  fill: ${({ theme }) => theme.colors.neutral700};
@@ -1851,6 +1878,7 @@ const DragAndDropElement = ({
1851
1878
  DragIconButton,
1852
1879
  {
1853
1880
  tag: "div",
1881
+ contentEditable: false,
1854
1882
  role: "button",
1855
1883
  tabIndex: 0,
1856
1884
  withTooltip: false,
@@ -1863,7 +1891,7 @@ const DragAndDropElement = ({
1863
1891
  disabled,
1864
1892
  draggable: true,
1865
1893
  $dragHandleTopMargin: dragHandleTopMargin,
1866
- children: /* @__PURE__ */ jsx(Drag, { color: "neutral600" })
1894
+ children: /* @__PURE__ */ jsx(Drag, { color: "primary500" })
1867
1895
  }
1868
1896
  ),
1869
1897
  children
@@ -2187,7 +2215,7 @@ const EditorLayout$1 = ({
2187
2215
  /* @__PURE__ */ jsx(
2188
2216
  CollapseIconButton,
2189
2217
  {
2190
- "aria-label": formatMessage({
2218
+ label: formatMessage({
2191
2219
  id: getTranslation("components.Blocks.collapse"),
2192
2220
  defaultMessage: "Collapse"
2193
2221
  }),
@@ -2526,7 +2554,7 @@ const BlocksEditor = React.forwardRef(
2526
2554
  !isExpandedMode && /* @__PURE__ */ jsx(
2527
2555
  ExpandIconButton,
2528
2556
  {
2529
- "aria-label": formatMessage({
2557
+ label: formatMessage({
2530
2558
  id: getTranslation("components.Blocks.expand"),
2531
2559
  defaultMessage: "Expand"
2532
2560
  }),
@@ -2592,30 +2620,27 @@ const createDefaultForm = (contentType, components = {}) => {
2592
2620
  const Initializer = ({ disabled, name: name2, onClick }) => {
2593
2621
  const { formatMessage } = useIntl();
2594
2622
  const field = useField(name2);
2595
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2596
- /* @__PURE__ */ jsx(
2597
- Box,
2598
- {
2599
- tag: "button",
2600
- background: "neutral100",
2601
- borderColor: field.error ? "danger600" : "neutral200",
2602
- hasRadius: true,
2603
- disabled,
2604
- onClick,
2605
- paddingTop: 9,
2606
- paddingBottom: 9,
2607
- type: "button",
2608
- children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
2609
- /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(CircleIcon, {}) }),
2610
- /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Typography, { textColor: "primary600", variant: "pi", fontWeight: "bold", children: formatMessage({
2611
- id: getTranslation("components.empty-repeatable"),
2612
- defaultMessage: "No entry yet. Click on the button below to add one."
2613
- }) }) })
2614
- ] })
2615
- }
2616
- ),
2617
- field.error && /* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "pi", children: field.error })
2618
- ] });
2623
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
2624
+ Box,
2625
+ {
2626
+ tag: "button",
2627
+ background: "neutral100",
2628
+ borderColor: field.error ? "danger600" : "neutral200",
2629
+ hasRadius: true,
2630
+ disabled,
2631
+ onClick,
2632
+ paddingTop: 9,
2633
+ paddingBottom: 9,
2634
+ type: "button",
2635
+ children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
2636
+ /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(CircleIcon, {}) }),
2637
+ /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Typography, { textColor: "primary600", variant: "pi", fontWeight: "bold", children: formatMessage({
2638
+ id: getTranslation("components.empty-repeatable"),
2639
+ defaultMessage: "No entry yet. Click on the button below to add one."
2640
+ }) }) })
2641
+ ] })
2642
+ }
2643
+ ) });
2619
2644
  };
2620
2645
  const CircleIcon = styled(PlusCircle)`
2621
2646
  width: 2.4rem;
@@ -2649,7 +2674,18 @@ const NonRepeatableComponent = ({
2649
2674
  children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index) => {
2650
2675
  return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
2651
2676
  const completeFieldName = `${name2}.${field.name}`;
2652
- return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2677
+ return /* @__PURE__ */ jsx(
2678
+ Grid$1.Item,
2679
+ {
2680
+ col: size,
2681
+ s: 12,
2682
+ xs: 12,
2683
+ direction: "column",
2684
+ alignItems: "stretch",
2685
+ children: children({ ...field, name: completeFieldName })
2686
+ },
2687
+ completeFieldName
2688
+ );
2653
2689
  }) }, index);
2654
2690
  }) })
2655
2691
  }
@@ -2668,13 +2704,34 @@ const RepeatableComponent = ({
2668
2704
  const { search: searchString } = useLocation();
2669
2705
  const search = React.useMemo(() => new URLSearchParams(searchString), [searchString]);
2670
2706
  const { components } = useDoc();
2671
- const { value = [], error } = useField(name2);
2707
+ const {
2708
+ value = [],
2709
+ error,
2710
+ rawError
2711
+ } = useField(name2);
2672
2712
  const addFieldRow = useForm("RepeatableComponent", (state) => state.addFieldRow);
2673
2713
  const moveFieldRow = useForm("RepeatableComponent", (state) => state.moveFieldRow);
2674
2714
  const removeFieldRow = useForm("RepeatableComponent", (state) => state.removeFieldRow);
2675
2715
  const { max = Infinity } = attribute;
2676
2716
  const [collapseToOpen, setCollapseToOpen] = React.useState("");
2677
2717
  const [liveText, setLiveText] = React.useState("");
2718
+ React.useEffect(() => {
2719
+ const hasNestedErrors = rawError && Array.isArray(rawError) && rawError.length > 0;
2720
+ const hasNestedValue = value && Array.isArray(value) && value.length > 0;
2721
+ if (hasNestedErrors && hasNestedValue) {
2722
+ const errorOpenItems = rawError.map((_, idx) => {
2723
+ return value[idx] ? value[idx].__temp_key__ : null;
2724
+ }).filter((value2) => !!value2);
2725
+ if (errorOpenItems && errorOpenItems.length > 0) {
2726
+ setCollapseToOpen((collapseToOpen2) => {
2727
+ if (!errorOpenItems.includes(collapseToOpen2)) {
2728
+ return errorOpenItems[0];
2729
+ }
2730
+ return collapseToOpen2;
2731
+ });
2732
+ }
2733
+ }
2734
+ }, [rawError, value]);
2678
2735
  const componentTmpKeyWithFocussedField = React.useMemo(() => {
2679
2736
  if (search.has("field")) {
2680
2737
  const fieldParam = search.get("field");
@@ -2827,7 +2884,18 @@ const RepeatableComponent = ({
2827
2884
  children: layout.map((row, index2) => {
2828
2885
  return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
2829
2886
  const completeFieldName = `${nameWithIndex}.${field.name}`;
2830
- return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2887
+ return /* @__PURE__ */ jsx(
2888
+ Grid$1.Item,
2889
+ {
2890
+ col: size,
2891
+ s: 12,
2892
+ xs: 12,
2893
+ direction: "column",
2894
+ alignItems: "stretch",
2895
+ children: children({ ...field, name: completeFieldName })
2896
+ },
2897
+ completeFieldName
2898
+ );
2831
2899
  }) }, index2);
2832
2900
  })
2833
2901
  }
@@ -2922,7 +2990,7 @@ const Component = ({
2922
2990
  /* @__PURE__ */ jsx(
2923
2991
  IconButton,
2924
2992
  {
2925
- borderWidth: 0,
2993
+ variant: "ghost",
2926
2994
  onClick: onDeleteComponent,
2927
2995
  label: formatMessage({
2928
2996
  id: getTranslation("containers.Edit.delete"),
@@ -2935,7 +3003,7 @@ const Component = ({
2935
3003
  IconButton,
2936
3004
  {
2937
3005
  ref: composedAccordionRefs,
2938
- borderWidth: 0,
3006
+ variant: "ghost",
2939
3007
  onClick: (e) => e.stopPropagation(),
2940
3008
  "data-handler-id": handlerId,
2941
3009
  label: formatMessage({
@@ -3005,7 +3073,7 @@ const ComponentInput = ({
3005
3073
  id: getTranslation("components.reset-entry"),
3006
3074
  defaultMessage: "Reset Entry"
3007
3075
  }),
3008
- borderWidth: 0,
3076
+ variant: "ghost",
3009
3077
  onClick: () => {
3010
3078
  field.onChange(name2, null);
3011
3079
  },
@@ -3034,11 +3102,8 @@ const AddComponentButton = ({
3034
3102
  onClick,
3035
3103
  disabled: isDisabled,
3036
3104
  background: "neutral0",
3037
- paddingTop: 3,
3038
- paddingBottom: 3,
3039
- paddingLeft: 4,
3040
- paddingRight: 4,
3041
3105
  style: { cursor: isDisabled ? "not-allowed" : "pointer" },
3106
+ variant: "tertiary",
3042
3107
  children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
3043
3108
  /* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
3044
3109
  /* @__PURE__ */ jsx(
@@ -3067,10 +3132,11 @@ const StyledAddIcon = styled(PlusCircle)`
3067
3132
  }
3068
3133
  `;
3069
3134
  const AddComponentTitle = styled(Typography)``;
3070
- const StyledButton = styled(BaseButton)`
3135
+ const StyledButton = styled(Button)`
3071
3136
  border-radius: 26px;
3072
3137
  border-color: ${({ theme }) => theme.colors.neutral150};
3073
3138
  box-shadow: ${({ theme }) => theme.shadows.filterShadow};
3139
+ height: 5rem;
3074
3140
 
3075
3141
  &:hover {
3076
3142
  ${AddComponentTitle} {
@@ -3082,7 +3148,7 @@ const StyledButton = styled(BaseButton)`
3082
3148
  fill: ${({ theme }) => theme.colors.primary600};
3083
3149
  }
3084
3150
  > path {
3085
- fill: ${({ theme }) => theme.colors.neutral100};
3151
+ fill: ${({ theme }) => theme.colors.primary600};
3086
3152
  }
3087
3153
  }
3088
3154
  }
@@ -3213,18 +3279,6 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
3213
3279
  /* @__PURE__ */ jsx(Field.Hint, {})
3214
3280
  ] });
3215
3281
  };
3216
- function useDebounce(value, delay) {
3217
- const [debouncedValue, setDebouncedValue] = useState(value);
3218
- useEffect(() => {
3219
- const handler = setTimeout(() => {
3220
- setDebouncedValue(value);
3221
- }, delay);
3222
- return () => {
3223
- clearTimeout(handler);
3224
- };
3225
- }, [value, delay]);
3226
- return debouncedValue;
3227
- }
3228
3282
  const uidApi = contentManagerApi.injectEndpoints({
3229
3283
  endpoints: (builder) => ({
3230
3284
  getDefaultUID: builder.query({
@@ -3259,7 +3313,10 @@ const uidApi = contentManagerApi.injectEndpoints({
3259
3313
  config: {
3260
3314
  params
3261
3315
  }
3262
- })
3316
+ }),
3317
+ providesTags: (_res, _error, params) => [
3318
+ { type: "UidAvailability", id: params.contentTypeUID }
3319
+ ]
3263
3320
  })
3264
3321
  })
3265
3322
  });
@@ -3271,8 +3328,10 @@ const UIDInput = React.forwardRef(
3271
3328
  const allFormValues = useForm("InputUID", (form) => form.values);
3272
3329
  const [availability, setAvailability] = React.useState();
3273
3330
  const [showRegenerate, setShowRegenerate] = React.useState(false);
3331
+ const isCloning = useMatch(CLONE_PATH) !== null;
3274
3332
  const field = useField(name2);
3275
3333
  const debouncedValue = useDebounce(field.value, 300);
3334
+ const hasChanged = debouncedValue !== field.initialValue;
3276
3335
  const { toggleNotification } = useNotification();
3277
3336
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
3278
3337
  const { formatMessage } = useIntl();
@@ -3348,8 +3407,9 @@ const UIDInput = React.forwardRef(
3348
3407
  params
3349
3408
  },
3350
3409
  {
3410
+ // Don't check availability if the value is empty or wasn't changed
3351
3411
  skip: !Boolean(
3352
- debouncedValue !== field.initialValue && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3412
+ (hasChanged || isCloning) && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3353
3413
  )
3354
3414
  }
3355
3415
  );
@@ -3378,6 +3438,7 @@ const UIDInput = React.forwardRef(
3378
3438
  const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
3379
3439
  const fieldRef = useFocusInputField(name2);
3380
3440
  const composedRefs = useComposedRefs(ref, fieldRef);
3441
+ const shouldShowAvailability = (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;
3381
3442
  return /* @__PURE__ */ jsxs(Field.Root, { hint, name: name2, error: field.error, required, children: [
3382
3443
  /* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
3383
3444
  /* @__PURE__ */ jsx(
@@ -3386,7 +3447,7 @@ const UIDInput = React.forwardRef(
3386
3447
  ref: composedRefs,
3387
3448
  disabled: props.disabled,
3388
3449
  endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
3389
- availability && !showRegenerate && /* @__PURE__ */ jsxs(
3450
+ shouldShowAvailability && /* @__PURE__ */ jsxs(
3390
3451
  TextValidation,
3391
3452
  {
3392
3453
  alignItems: "center",
@@ -4220,7 +4281,7 @@ const EditorLayout = ({
4220
4281
  justifyContent: "flex-end",
4221
4282
  shrink: 0,
4222
4283
  width: "100%",
4223
- children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, children: [
4284
+ children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, variant: "tertiary", size: "M", children: [
4224
4285
  /* @__PURE__ */ jsx(Typography, { children: formatMessage({
4225
4286
  id: "components.Wysiwyg.collapse",
4226
4287
  defaultMessage: "Collapse"
@@ -4238,12 +4299,14 @@ const EditorLayout = ({
4238
4299
  ) }) });
4239
4300
  }
4240
4301
  return /* @__PURE__ */ jsx(
4241
- Box,
4302
+ Flex,
4242
4303
  {
4243
4304
  borderColor: error ? "danger600" : "neutral200",
4244
4305
  borderStyle: "solid",
4245
4306
  borderWidth: "1px",
4246
4307
  hasRadius: true,
4308
+ direction: "column",
4309
+ alignItems: "stretch",
4247
4310
  children
4248
4311
  }
4249
4312
  );
@@ -4254,11 +4317,19 @@ const ExpandWrapper = styled(Flex)`
4254
4317
  const BoxWithBorder = styled(Box)`
4255
4318
  border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
4256
4319
  `;
4257
- const ExpandButton$1 = styled(BaseButton)`
4320
+ const ExpandButton$1 = styled(Button)`
4258
4321
  background-color: transparent;
4259
4322
  border: none;
4260
4323
  align-items: center;
4261
4324
 
4325
+ & > span {
4326
+ display: flex;
4327
+ justify-content: space-between;
4328
+ align-items: center;
4329
+ width: 100%;
4330
+ font-weight: ${({ theme }) => theme.fontWeights.regular};
4331
+ }
4332
+
4262
4333
  svg {
4263
4334
  margin-left: ${({ theme }) => `${theme.spaces[2]}`};
4264
4335
 
@@ -4525,40 +4596,28 @@ const quoteAndCodeHandler = (editor, markdownType) => {
4525
4596
  insertWithoutTextToEdit(editor, markdownType, line, contentLength);
4526
4597
  }
4527
4598
  };
4528
- const CustomIconButton = styled(IconButton)`
4529
- padding: ${({ theme }) => theme.spaces[2]};
4530
-
4531
- svg {
4532
- width: 1.8rem;
4533
- height: 1.8rem;
4534
- }
4535
- `;
4536
- const CustomLinkIconButton = styled(CustomIconButton)`
4537
- svg {
4538
- width: 0.8rem;
4539
- height: 0.8rem;
4540
- }
4541
- `;
4542
4599
  const MainButtons = styled(IconButtonGroup)`
4543
4600
  margin-left: ${({ theme }) => theme.spaces[4]};
4544
4601
  `;
4545
4602
  const MoreButton = styled(IconButton)`
4546
4603
  margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
4547
- padding: ${({ theme }) => theme.spaces[2]};
4548
-
4549
- svg {
4550
- width: 1.8rem;
4551
- height: 1.8rem;
4552
- }
4553
4604
  `;
4554
4605
  const IconButtonGroupMargin = styled(IconButtonGroup)`
4555
4606
  margin-right: ${({ theme }) => `${theme.spaces[2]}`};
4556
4607
  `;
4557
- const ExpandButton = styled(BaseButton)`
4608
+ const ExpandButton = styled(Button)`
4558
4609
  background-color: transparent;
4559
4610
  border: none;
4560
4611
  align-items: center;
4561
4612
 
4613
+ & > span {
4614
+ display: flex;
4615
+ justify-content: space-between;
4616
+ align-items: center;
4617
+ width: 100%;
4618
+ font-weight: ${({ theme }) => theme.fontWeights.regular};
4619
+ }
4620
+
4562
4621
  svg {
4563
4622
  margin-left: ${({ theme }) => `${theme.spaces[2]}`};
4564
4623
  path {
@@ -4570,8 +4629,8 @@ const ExpandButton = styled(BaseButton)`
4570
4629
  `;
4571
4630
  const WysiwygFooter = ({ onToggleExpand }) => {
4572
4631
  const { formatMessage } = useIntl();
4573
- return /* @__PURE__ */ jsx(Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, children: [
4574
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({
4632
+ return /* @__PURE__ */ jsx(Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, variant: "tertiary", size: "M", children: [
4633
+ /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
4575
4634
  id: "components.WysiwygBottomControls.fullscreen",
4576
4635
  defaultMessage: "Expand"
4577
4636
  }) }),
@@ -4607,18 +4666,27 @@ const WysiwygNav = ({
4607
4666
  borderRadius: `0.4rem 0.4rem 0 0`,
4608
4667
  children: [
4609
4668
  /* @__PURE__ */ jsxs(Flex, { children: [
4610
- /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(SingleSelect, { disabled: true, placeholder: selectPlaceholder, "aria-label": selectPlaceholder, children: [
4611
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
4612
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
4613
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h3", children: "h3" }),
4614
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h4", children: "h4" }),
4615
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h5", children: "h5" }),
4616
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
4617
- ] }) }),
4669
+ /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
4670
+ SingleSelect,
4671
+ {
4672
+ disabled: true,
4673
+ placeholder: selectPlaceholder,
4674
+ "aria-label": selectPlaceholder,
4675
+ size: "S",
4676
+ children: [
4677
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
4678
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
4679
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h3", children: "h3" }),
4680
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h4", children: "h4" }),
4681
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h5", children: "h5" }),
4682
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
4683
+ ]
4684
+ }
4685
+ ) }),
4618
4686
  /* @__PURE__ */ jsxs(MainButtons, { children: [
4619
- /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
4620
- /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
4621
- /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
4687
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
4688
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
4689
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
4622
4690
  ] }),
4623
4691
  /* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsx(More, {}) })
4624
4692
  ] }),
@@ -4645,6 +4713,7 @@ const WysiwygNav = ({
4645
4713
  placeholder: selectPlaceholder,
4646
4714
  "aria-label": selectPlaceholder,
4647
4715
  onChange: (value) => onActionClick(value, editorRef),
4716
+ size: "S",
4648
4717
  children: [
4649
4718
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
4650
4719
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
@@ -4656,17 +4725,9 @@ const WysiwygNav = ({
4656
4725
  }
4657
4726
  ) }),
4658
4727
  /* @__PURE__ */ jsxs(MainButtons, { children: [
4728
+ /* @__PURE__ */ jsx(IconButton, { onClick: () => onActionClick("Bold", editorRef), label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
4659
4729
  /* @__PURE__ */ jsx(
4660
- CustomIconButton,
4661
- {
4662
- onClick: () => onActionClick("Bold", editorRef),
4663
- label: "Bold",
4664
- name: "Bold",
4665
- children: /* @__PURE__ */ jsx(Bold, {})
4666
- }
4667
- ),
4668
- /* @__PURE__ */ jsx(
4669
- CustomIconButton,
4730
+ IconButton,
4670
4731
  {
4671
4732
  onClick: () => onActionClick("Italic", editorRef),
4672
4733
  label: "Italic",
@@ -4675,7 +4736,7 @@ const WysiwygNav = ({
4675
4736
  }
4676
4737
  ),
4677
4738
  /* @__PURE__ */ jsx(
4678
- CustomIconButton,
4739
+ IconButton,
4679
4740
  {
4680
4741
  onClick: () => onActionClick("Underline", editorRef),
4681
4742
  label: "Underline",
@@ -4689,7 +4750,7 @@ const WysiwygNav = ({
4689
4750
  /* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
4690
4751
  /* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
4691
4752
  /* @__PURE__ */ jsx(
4692
- CustomIconButton,
4753
+ IconButton,
4693
4754
  {
4694
4755
  onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
4695
4756
  label: "Strikethrough",
@@ -4698,7 +4759,7 @@ const WysiwygNav = ({
4698
4759
  }
4699
4760
  ),
4700
4761
  /* @__PURE__ */ jsx(
4701
- CustomIconButton,
4762
+ IconButton,
4702
4763
  {
4703
4764
  onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
4704
4765
  label: "BulletList",
@@ -4707,7 +4768,7 @@ const WysiwygNav = ({
4707
4768
  }
4708
4769
  ),
4709
4770
  /* @__PURE__ */ jsx(
4710
- CustomIconButton,
4771
+ IconButton,
4711
4772
  {
4712
4773
  onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
4713
4774
  label: "NumberList",
@@ -4718,7 +4779,7 @@ const WysiwygNav = ({
4718
4779
  ] }),
4719
4780
  /* @__PURE__ */ jsxs(IconButtonGroup, { children: [
4720
4781
  /* @__PURE__ */ jsx(
4721
- CustomIconButton,
4782
+ IconButton,
4722
4783
  {
4723
4784
  onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
4724
4785
  label: "Code",
@@ -4727,7 +4788,7 @@ const WysiwygNav = ({
4727
4788
  }
4728
4789
  ),
4729
4790
  /* @__PURE__ */ jsx(
4730
- CustomIconButton,
4791
+ IconButton,
4731
4792
  {
4732
4793
  onClick: () => {
4733
4794
  handleTogglePopover();
@@ -4739,7 +4800,7 @@ const WysiwygNav = ({
4739
4800
  }
4740
4801
  ),
4741
4802
  /* @__PURE__ */ jsx(
4742
- CustomLinkIconButton,
4803
+ IconButton,
4743
4804
  {
4744
4805
  onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
4745
4806
  label: "Link",
@@ -4748,7 +4809,7 @@ const WysiwygNav = ({
4748
4809
  }
4749
4810
  ),
4750
4811
  /* @__PURE__ */ jsx(
4751
- CustomIconButton,
4812
+ IconButton,
4752
4813
  {
4753
4814
  onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
4754
4815
  label: "Quote",
@@ -4885,15 +4946,19 @@ const Wysiwyg = React.forwardRef(
4885
4946
  );
4886
4947
  const MemoizedWysiwyg = React.memo(Wysiwyg);
4887
4948
  const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4888
- const { id } = useDoc();
4949
+ const { id, document: document2, collectionType } = useDoc();
4889
4950
  const isFormDisabled = useForm("InputRenderer", (state) => state.disabled);
4890
4951
  const isInDynamicZone = useDynamicZone("isInDynamicZone", (state) => state.isInDynamicZone);
4891
4952
  const canCreateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canCreateFields);
4892
4953
  const canReadFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canReadFields);
4893
4954
  const canUpdateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUpdateFields);
4894
4955
  const canUserAction = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUserAction);
4895
- const editableFields = id ? canUpdateFields : canCreateFields;
4896
- const readableFields = id ? canReadFields : canCreateFields;
4956
+ let idToCheck = id;
4957
+ if (collectionType === SINGLE_TYPES) {
4958
+ idToCheck = document2?.documentId;
4959
+ }
4960
+ const editableFields = idToCheck ? canUpdateFields : canCreateFields;
4961
+ const readableFields = idToCheck ? canReadFields : canCreateFields;
4897
4962
  const canUserReadField = canUserAction(props.name, readableFields, props.type);
4898
4963
  const canUserEditField = canUserAction(props.name, editableFields, props.type);
4899
4964
  const fields = useStrapiApp("InputRenderer", (app) => app.fields);
@@ -4904,6 +4969,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4904
4969
  const {
4905
4970
  edit: { components }
4906
4971
  } = useDocLayout();
4972
+ const field = useField(props.name);
4907
4973
  if (!visible) {
4908
4974
  return null;
4909
4975
  }
@@ -4914,7 +4980,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4914
4980
  if (attributeHasCustomFieldProperty(props.attribute)) {
4915
4981
  const CustomInput = lazyComponentStore[props.attribute.customField];
4916
4982
  if (CustomInput) {
4917
- return /* @__PURE__ */ jsx(CustomInput, { ...props, hint, disabled: fieldIsDisabled });
4983
+ return /* @__PURE__ */ jsx(CustomInput, { ...props, ...field, hint, disabled: fieldIsDisabled });
4918
4984
  }
4919
4985
  return /* @__PURE__ */ jsx(
4920
4986
  InputRenderer$1,
@@ -4984,7 +5050,9 @@ const useFieldHint = (hint = void 0, attribute) => {
4984
5050
  if (!maximum && !minimum) {
4985
5051
  return hint;
4986
5052
  }
4987
- const units = !["biginteger", "integer", "number"].includes(attribute.type) ? formatMessage(
5053
+ const units = !["biginteger", "integer", "number", "dynamiczone", "component"].includes(
5054
+ attribute.type
5055
+ ) ? formatMessage(
4988
5056
  {
4989
5057
  id: "content-manager.form.Input.hint.character.unit",
4990
5058
  defaultMessage: "{maxValue, plural, one { character} other { characters}}"
@@ -5073,12 +5141,20 @@ const DynamicComponent = ({
5073
5141
  React.useEffect(() => {
5074
5142
  dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
5075
5143
  }, [dragPreviewRef, index]);
5144
+ const accordionValue = React.useId();
5145
+ const { value = [], rawError } = useField(`${name2}.${index}`);
5146
+ const [collapseToOpen, setCollapseToOpen] = React.useState("");
5147
+ React.useEffect(() => {
5148
+ if (rawError && value) {
5149
+ setCollapseToOpen(accordionValue);
5150
+ }
5151
+ }, [rawError, value, accordionValue]);
5076
5152
  const composedBoxRefs = useComposedRefs(boxRef, dropRef);
5077
5153
  const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
5078
5154
  /* @__PURE__ */ jsx(
5079
5155
  IconButton,
5080
5156
  {
5081
- borderWidth: 0,
5157
+ variant: "ghost",
5082
5158
  label: formatMessage(
5083
5159
  {
5084
5160
  id: getTranslation("components.DynamicZone.delete-label"),
@@ -5093,7 +5169,7 @@ const DynamicComponent = ({
5093
5169
  /* @__PURE__ */ jsx(
5094
5170
  IconButton,
5095
5171
  {
5096
- borderWidth: 0,
5172
+ variant: "ghost",
5097
5173
  onClick: (e) => e.stopPropagation(),
5098
5174
  "data-handler-id": handlerId,
5099
5175
  ref: dragRef,
@@ -5138,10 +5214,9 @@ const DynamicComponent = ({
5138
5214
  ] })
5139
5215
  ] });
5140
5216
  const accordionTitle = title ? `${displayName} ${title}` : displayName;
5141
- const accordionValue = React.useId();
5142
5217
  return /* @__PURE__ */ jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
5143
5218
  /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Rectangle, { background: "neutral200" }) }),
5144
- /* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsx(Accordion.Root, { children: /* @__PURE__ */ jsxs(Accordion.Item, { value: accordionValue, children: [
5219
+ /* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsx(Accordion.Root, { value: collapseToOpen, onValueChange: setCollapseToOpen, children: /* @__PURE__ */ jsxs(Accordion.Item, { value: accordionValue, children: [
5145
5220
  /* @__PURE__ */ jsxs(Accordion.Header, { children: [
5146
5221
  /* @__PURE__ */ jsx(
5147
5222
  Accordion.Trigger,
@@ -5152,10 +5227,32 @@ const DynamicComponent = ({
5152
5227
  ),
5153
5228
  /* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
5154
5229
  ] }),
5155
- /* @__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 }) => {
5156
- const fieldName = `${name2}.${index}.${field.name}`;
5157
- return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field, name: fieldName }) }, fieldName);
5158
- }) }, rowInd)) }) }) })
5230
+ /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsx(
5231
+ Grid$1.Item,
5232
+ {
5233
+ col: 12,
5234
+ s: 12,
5235
+ xs: 12,
5236
+ direction: "column",
5237
+ alignItems: "stretch",
5238
+ children: /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
5239
+ const fieldName = `${name2}.${index}.${field.name}`;
5240
+ return /* @__PURE__ */ jsx(
5241
+ Grid$1.Item,
5242
+ {
5243
+ col: size,
5244
+ s: 12,
5245
+ xs: 12,
5246
+ direction: "column",
5247
+ alignItems: "stretch",
5248
+ children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field, name: fieldName })
5249
+ },
5250
+ fieldName
5251
+ );
5252
+ }) })
5253
+ },
5254
+ rowInd
5255
+ )) }) }) }) })
5159
5256
  ] }) }) })
5160
5257
  ] });
5161
5258
  };
@@ -5347,7 +5444,7 @@ const DynamicZone = ({
5347
5444
  const handleRemoveComponent = (name22, currentIndex) => () => {
5348
5445
  removeFieldRow(name22, currentIndex);
5349
5446
  };
5350
- const hasError = error !== void 0 || dynamicDisplayedComponentsLength < min || dynamicDisplayedComponentsLength > max;
5447
+ const hasError = error !== void 0;
5351
5448
  const renderButtonLabel = () => {
5352
5449
  if (addComponentIsOpen) {
5353
5450
  return formatMessage({ id: "app.utils.close-label", defaultMessage: "Close" });
@@ -5463,4 +5560,4 @@ export {
5463
5560
  transformDocument as t,
5464
5561
  useLazyComponents as u
5465
5562
  };
5466
- //# sourceMappingURL=Field-dha5VnIQ.mjs.map
5563
+ //# sourceMappingURL=Field-CJPYzwD7.mjs.map