@strapi/content-manager 0.0.0-experimental.d954d57341a6623992a0d211daaec8e245c3517d → 0.0.0-experimental.dad3c50630ca4fd9eccdcbe549ee632fc572e23d

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 (225) hide show
  1. package/LICENSE +18 -3
  2. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
  3. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
  4. package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js → ComponentConfigurationPage-BLWQy8ru.js} +5 -6
  5. package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js.map → ComponentConfigurationPage-BLWQy8ru.js.map} +1 -1
  6. package/dist/_chunks/{ComponentConfigurationPage-gdUj_t-O.mjs → ComponentConfigurationPage-CtIa3aa2.mjs} +4 -4
  7. package/dist/_chunks/{ComponentConfigurationPage-gdUj_t-O.mjs.map → ComponentConfigurationPage-CtIa3aa2.mjs.map} +1 -1
  8. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
  9. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
  10. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
  11. package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs → EditConfigurationPage-DsPR2DVk.mjs} +4 -4
  12. package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs.map → EditConfigurationPage-DsPR2DVk.mjs.map} +1 -1
  13. package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js → EditConfigurationPage-RQkymxCy.js} +5 -6
  14. package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js.map → EditConfigurationPage-RQkymxCy.js.map} +1 -1
  15. package/dist/_chunks/{EditViewPage-DbcGfyqK.js → EditViewPage-B-kExt8C.js} +63 -13
  16. package/dist/_chunks/EditViewPage-B-kExt8C.js.map +1 -0
  17. package/dist/_chunks/{EditViewPage-0MiFkXa8.mjs → EditViewPage-BPyVuPfM.mjs} +63 -12
  18. package/dist/_chunks/EditViewPage-BPyVuPfM.mjs.map +1 -0
  19. package/dist/_chunks/{Field-BG1xu38N.js → Field-DPIsQRre.js} +680 -261
  20. package/dist/_chunks/Field-DPIsQRre.js.map +1 -0
  21. package/dist/_chunks/{Field-BDMSCcy5.mjs → Field-Dltnt1km.mjs} +676 -257
  22. package/dist/_chunks/Field-Dltnt1km.mjs.map +1 -0
  23. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
  24. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
  25. package/dist/_chunks/{Form-9BnFyUjy.js → Form-BFi4MXMT.js} +43 -22
  26. package/dist/_chunks/Form-BFi4MXMT.js.map +1 -0
  27. package/dist/_chunks/{Form-CPVWavB8.mjs → Form-C1IcWm1u.mjs} +41 -19
  28. package/dist/_chunks/Form-C1IcWm1u.mjs.map +1 -0
  29. package/dist/_chunks/{History-BVpd8LP3.mjs → History-04ChQ4pl.mjs} +108 -116
  30. package/dist/_chunks/History-04ChQ4pl.mjs.map +1 -0
  31. package/dist/_chunks/{History-BWWxLt2Z.js → History-wjcK4L0C.js} +107 -116
  32. package/dist/_chunks/History-wjcK4L0C.js.map +1 -0
  33. package/dist/_chunks/{ListConfigurationPage-DozVMKcR.mjs → ListConfigurationPage-BYqPYLSU.mjs} +25 -12
  34. package/dist/_chunks/ListConfigurationPage-BYqPYLSU.mjs.map +1 -0
  35. package/dist/_chunks/{ListConfigurationPage-6swzjdAZ.js → ListConfigurationPage-CRbxIC3J.js} +25 -13
  36. package/dist/_chunks/ListConfigurationPage-CRbxIC3J.js.map +1 -0
  37. package/dist/_chunks/{ListViewPage-BlzfjS2Q.js → ListViewPage-D5NY9183.js} +121 -81
  38. package/dist/_chunks/ListViewPage-D5NY9183.js.map +1 -0
  39. package/dist/_chunks/{ListViewPage-Ds0ulgfG.mjs → ListViewPage-FU2LBuhl.mjs} +118 -77
  40. package/dist/_chunks/ListViewPage-FU2LBuhl.mjs.map +1 -0
  41. package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js → NoContentTypePage-BgQVE_Qb.js} +2 -2
  42. package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js.map → NoContentTypePage-BgQVE_Qb.js.map} +1 -1
  43. package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs → NoContentTypePage-DCKUkwb8.mjs} +2 -2
  44. package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs.map → NoContentTypePage-DCKUkwb8.mjs.map} +1 -1
  45. package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js → NoPermissionsPage-C5jwn70o.js} +2 -2
  46. package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js.map → NoPermissionsPage-C5jwn70o.js.map} +1 -1
  47. package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs → NoPermissionsPage-jqve7C8l.mjs} +2 -2
  48. package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs.map → NoPermissionsPage-jqve7C8l.mjs.map} +1 -1
  49. package/dist/_chunks/Preview-BMYN548c.mjs +294 -0
  50. package/dist/_chunks/Preview-BMYN548c.mjs.map +1 -0
  51. package/dist/_chunks/Preview-DaOihysv.js +312 -0
  52. package/dist/_chunks/Preview-DaOihysv.js.map +1 -0
  53. package/dist/_chunks/{Relations-CcgFTcWo.js → Relations-CTGM7Hv5.js} +76 -43
  54. package/dist/_chunks/Relations-CTGM7Hv5.js.map +1 -0
  55. package/dist/_chunks/{Relations-Dnag3fhV.mjs → Relations-gscPkxjF.mjs} +76 -42
  56. package/dist/_chunks/Relations-gscPkxjF.mjs.map +1 -0
  57. package/dist/_chunks/{en-fbKQxLGn.js → en-BzQmavmK.js} +37 -18
  58. package/dist/_chunks/{en-fbKQxLGn.js.map → en-BzQmavmK.js.map} +1 -1
  59. package/dist/_chunks/{en-Ux26r5pl.mjs → en-CSxLmrh1.mjs} +37 -18
  60. package/dist/_chunks/{en-Ux26r5pl.mjs.map → en-CSxLmrh1.mjs.map} +1 -1
  61. package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
  62. package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
  63. package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
  64. package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
  65. package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
  66. package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
  67. package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
  68. package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
  69. package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
  70. package/dist/_chunks/{index-CWpLBSt0.js → index-Ca7YWlAA.js} +1271 -746
  71. package/dist/_chunks/index-Ca7YWlAA.js.map +1 -0
  72. package/dist/_chunks/{index-JNNNKUHs.mjs → index-DqasUQ6Q.mjs} +1288 -763
  73. package/dist/_chunks/index-DqasUQ6Q.mjs.map +1 -0
  74. package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
  75. package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
  76. package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
  77. package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
  78. package/dist/_chunks/{layout--iHdZzRk.js → layout-BW80JSCd.js} +27 -15
  79. package/dist/_chunks/layout-BW80JSCd.js.map +1 -0
  80. package/dist/_chunks/{layout-DC503LnF.mjs → layout-W3clJSCy.mjs} +28 -15
  81. package/dist/_chunks/layout-W3clJSCy.mjs.map +1 -0
  82. package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
  83. package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
  84. package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
  85. package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
  86. package/dist/_chunks/{relations-CTje5t-a.mjs → relations-BlDkoeWh.mjs} +6 -7
  87. package/dist/_chunks/relations-BlDkoeWh.mjs.map +1 -0
  88. package/dist/_chunks/{relations-BbHizA5K.js → relations-C9Usz9k5.js} +6 -7
  89. package/dist/_chunks/relations-C9Usz9k5.js.map +1 -0
  90. package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
  91. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
  92. package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
  93. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
  94. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
  95. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
  96. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
  97. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
  98. package/dist/admin/index.js +3 -1
  99. package/dist/admin/index.js.map +1 -1
  100. package/dist/admin/index.mjs +5 -3
  101. package/dist/admin/src/content-manager.d.ts +3 -2
  102. package/dist/admin/src/exports.d.ts +2 -1
  103. package/dist/admin/src/history/index.d.ts +3 -0
  104. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  105. package/dist/admin/src/hooks/useDocument.d.ts +32 -1
  106. package/dist/admin/src/index.d.ts +1 -0
  107. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  108. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +2 -1
  109. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
  110. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  111. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  112. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +5 -0
  113. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
  114. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
  115. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
  116. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
  117. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  118. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
  119. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  120. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
  121. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
  122. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  123. package/dist/admin/src/preview/index.d.ts +4 -0
  124. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  125. package/dist/admin/src/preview/routes.d.ts +3 -0
  126. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  127. package/dist/admin/src/router.d.ts +1 -1
  128. package/dist/admin/src/services/api.d.ts +1 -1
  129. package/dist/admin/src/services/components.d.ts +2 -2
  130. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  131. package/dist/admin/src/services/documents.d.ts +19 -20
  132. package/dist/admin/src/services/init.d.ts +1 -1
  133. package/dist/admin/src/services/relations.d.ts +2 -2
  134. package/dist/admin/src/services/uid.d.ts +3 -3
  135. package/dist/admin/src/utils/validation.d.ts +4 -1
  136. package/dist/server/index.js +765 -437
  137. package/dist/server/index.js.map +1 -1
  138. package/dist/server/index.mjs +766 -437
  139. package/dist/server/index.mjs.map +1 -1
  140. package/dist/server/src/bootstrap.d.ts.map +1 -1
  141. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  142. package/dist/server/src/controllers/index.d.ts.map +1 -1
  143. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  144. package/dist/server/src/controllers/uid.d.ts.map +1 -1
  145. package/dist/server/src/controllers/utils/metadata.d.ts +16 -1
  146. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  147. package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
  148. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
  149. package/dist/server/src/history/controllers/history-version.d.ts +1 -1
  150. package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
  151. package/dist/server/src/history/services/history.d.ts +3 -3
  152. package/dist/server/src/history/services/history.d.ts.map +1 -1
  153. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  154. package/dist/server/src/history/services/utils.d.ts +8 -12
  155. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  156. package/dist/server/src/index.d.ts +7 -6
  157. package/dist/server/src/index.d.ts.map +1 -1
  158. package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
  159. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  160. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  161. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  162. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  163. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  164. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  165. package/dist/server/src/preview/index.d.ts +4 -0
  166. package/dist/server/src/preview/index.d.ts.map +1 -0
  167. package/dist/server/src/preview/routes/index.d.ts +8 -0
  168. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  169. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  170. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  171. package/dist/server/src/preview/services/index.d.ts +16 -0
  172. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  173. package/dist/server/src/preview/services/preview-config.d.ts +32 -0
  174. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  175. package/dist/server/src/preview/services/preview.d.ts +12 -0
  176. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  177. package/dist/server/src/preview/utils.d.ts +19 -0
  178. package/dist/server/src/preview/utils.d.ts.map +1 -0
  179. package/dist/server/src/register.d.ts.map +1 -1
  180. package/dist/server/src/routes/index.d.ts.map +1 -1
  181. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  182. package/dist/server/src/services/document-metadata.d.ts +12 -10
  183. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  184. package/dist/server/src/services/index.d.ts +7 -6
  185. package/dist/server/src/services/index.d.ts.map +1 -1
  186. package/dist/server/src/services/permission-checker.d.ts.map +1 -1
  187. package/dist/server/src/services/utils/populate.d.ts +2 -2
  188. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  189. package/dist/server/src/utils/index.d.ts +2 -0
  190. package/dist/server/src/utils/index.d.ts.map +1 -1
  191. package/dist/shared/contracts/collection-types.d.ts +3 -1
  192. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  193. package/dist/shared/contracts/index.d.ts +1 -0
  194. package/dist/shared/contracts/index.d.ts.map +1 -1
  195. package/dist/shared/contracts/preview.d.ts +27 -0
  196. package/dist/shared/contracts/preview.d.ts.map +1 -0
  197. package/dist/shared/index.js +4 -0
  198. package/dist/shared/index.js.map +1 -1
  199. package/dist/shared/index.mjs +4 -0
  200. package/dist/shared/index.mjs.map +1 -1
  201. package/package.json +17 -15
  202. package/dist/_chunks/EditViewPage-0MiFkXa8.mjs.map +0 -1
  203. package/dist/_chunks/EditViewPage-DbcGfyqK.js.map +0 -1
  204. package/dist/_chunks/Field-BDMSCcy5.mjs.map +0 -1
  205. package/dist/_chunks/Field-BG1xu38N.js.map +0 -1
  206. package/dist/_chunks/Form-9BnFyUjy.js.map +0 -1
  207. package/dist/_chunks/Form-CPVWavB8.mjs.map +0 -1
  208. package/dist/_chunks/History-BVpd8LP3.mjs.map +0 -1
  209. package/dist/_chunks/History-BWWxLt2Z.js.map +0 -1
  210. package/dist/_chunks/ListConfigurationPage-6swzjdAZ.js.map +0 -1
  211. package/dist/_chunks/ListConfigurationPage-DozVMKcR.mjs.map +0 -1
  212. package/dist/_chunks/ListViewPage-BlzfjS2Q.js.map +0 -1
  213. package/dist/_chunks/ListViewPage-Ds0ulgfG.mjs.map +0 -1
  214. package/dist/_chunks/Relations-CcgFTcWo.js.map +0 -1
  215. package/dist/_chunks/Relations-Dnag3fhV.mjs.map +0 -1
  216. package/dist/_chunks/index-CWpLBSt0.js.map +0 -1
  217. package/dist/_chunks/index-JNNNKUHs.mjs.map +0 -1
  218. package/dist/_chunks/layout--iHdZzRk.js.map +0 -1
  219. package/dist/_chunks/layout-DC503LnF.mjs.map +0 -1
  220. package/dist/_chunks/relations-BbHizA5K.js.map +0 -1
  221. package/dist/_chunks/relations-CTje5t-a.mjs.map +0 -1
  222. package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
  223. package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
  224. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
  225. package/strapi-server.js +0 -3
@@ -2,24 +2,75 @@ 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 { 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";
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-JNNNKUHs.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-DqasUQ6Q.mjs";
9
9
  import { generateNKeysBetween } from "fractional-indexing";
10
- import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-Dnag3fhV.mjs";
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";
10
+ import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-gscPkxjF.mjs";
11
+ import { CodeBlock as CodeBlock$1, HeadingOne, HeadingTwo, HeadingThree, HeadingFour, HeadingFive, HeadingSix, Image as Image$1, NumberList, BulletList, Paragraph, Quotes, Link as Link$1, Drag, Collapse, Bold, Italic, Underline, StrikeThrough, Code, 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
- import { a as DIRECTIONS, u as useDragAndDrop, I as ItemTypes } from "./useDragAndDrop-DdHgKsqq.mjs";
16
- import { g as getIn } from "./objects-mKMAmfec.mjs";
15
+ import { a as DIRECTIONS, u as useDragAndDrop, I as ItemTypes } from "./useDragAndDrop-DJ6jqvZN.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 * as Prism from "prismjs";
21
+ import "prismjs/themes/prism-solarizedlight.css";
22
+ import "prismjs/components/prism-asmatmel";
23
+ import "prismjs/components/prism-bash";
24
+ import "prismjs/components/prism-basic";
25
+ import "prismjs/components/prism-c";
26
+ import "prismjs/components/prism-clojure";
27
+ import "prismjs/components/prism-cobol";
28
+ import "prismjs/components/prism-cpp";
29
+ import "prismjs/components/prism-csharp";
30
+ import "prismjs/components/prism-dart";
31
+ import "prismjs/components/prism-docker";
32
+ import "prismjs/components/prism-elixir";
33
+ import "prismjs/components/prism-erlang";
34
+ import "prismjs/components/prism-fortran";
35
+ import "prismjs/components/prism-fsharp";
36
+ import "prismjs/components/prism-go";
37
+ import "prismjs/components/prism-graphql";
38
+ import "prismjs/components/prism-groovy";
39
+ import "prismjs/components/prism-haskell";
40
+ import "prismjs/components/prism-haxe";
41
+ import "prismjs/components/prism-ini";
42
+ import "prismjs/components/prism-java";
43
+ import "prismjs/components/prism-javascript";
44
+ import "prismjs/components/prism-jsx";
45
+ import "prismjs/components/prism-json";
46
+ import "prismjs/components/prism-julia";
47
+ import "prismjs/components/prism-kotlin";
48
+ import "prismjs/components/prism-latex";
49
+ import "prismjs/components/prism-lua";
50
+ import "prismjs/components/prism-markdown";
51
+ import "prismjs/components/prism-matlab";
52
+ import "prismjs/components/prism-makefile";
53
+ import "prismjs/components/prism-objectivec";
54
+ import "prismjs/components/prism-perl";
55
+ import "prismjs/components/prism-php";
56
+ import "prismjs/components/prism-powershell";
57
+ import "prismjs/components/prism-python";
58
+ import "prismjs/components/prism-r";
59
+ import "prismjs/components/prism-ruby";
60
+ import "prismjs/components/prism-rust";
61
+ import "prismjs/components/prism-sas";
62
+ import "prismjs/components/prism-scala";
63
+ import "prismjs/components/prism-scheme";
64
+ import "prismjs/components/prism-sql";
65
+ import "prismjs/components/prism-stata";
66
+ import "prismjs/components/prism-swift";
67
+ import "prismjs/components/prism-typescript";
68
+ import "prismjs/components/prism-tsx";
69
+ import "prismjs/components/prism-vbnet";
70
+ import "prismjs/components/prism-yaml";
71
+ import { p as prefixFileUrlWithBackendUrl, u as usePrev, a as useDebounce } from "./useDebounce-DmuSJIF3.mjs";
21
72
  import * as Toolbar from "@radix-ui/react-toolbar";
22
- import { useLocation } from "react-router-dom";
73
+ import { useLocation, useMatch } from "react-router-dom";
23
74
  import CodeMirror from "codemirror5";
24
75
  import sanitizeHtml from "sanitize-html";
25
76
  import { getLanguage, highlight, highlightAuto } from "highlight.js";
@@ -160,6 +211,224 @@ const useLazyComponents = (componentUids = []) => {
160
211
  }, []);
161
212
  return { isLazyLoading: loading, lazyComponentStore, cleanup };
162
213
  };
214
+ const codeLanguages = [
215
+ {
216
+ value: "asm",
217
+ label: "Assembly",
218
+ decorate: "asmatmel"
219
+ },
220
+ {
221
+ value: "bash",
222
+ label: "Bash"
223
+ },
224
+ {
225
+ value: "c",
226
+ label: "C"
227
+ },
228
+ {
229
+ value: "clojure",
230
+ label: "Clojure"
231
+ },
232
+ {
233
+ value: "cobol",
234
+ label: "COBOL"
235
+ },
236
+ {
237
+ value: "cpp",
238
+ label: "C++"
239
+ },
240
+ {
241
+ value: "csharp",
242
+ label: "C#"
243
+ },
244
+ {
245
+ value: "css",
246
+ label: "CSS"
247
+ },
248
+ {
249
+ value: "dart",
250
+ label: "Dart"
251
+ },
252
+ {
253
+ value: "dockerfile",
254
+ label: "Dockerfile",
255
+ decorate: "docker"
256
+ },
257
+ {
258
+ value: "elixir",
259
+ label: "Elixir"
260
+ },
261
+ {
262
+ value: "erlang",
263
+ label: "Erlang"
264
+ },
265
+ {
266
+ value: "fortran",
267
+ label: "Fortran"
268
+ },
269
+ {
270
+ value: "fsharp",
271
+ label: "F#"
272
+ },
273
+ {
274
+ value: "go",
275
+ label: "Go"
276
+ },
277
+ {
278
+ value: "graphql",
279
+ label: "GraphQL"
280
+ },
281
+ {
282
+ value: "groovy",
283
+ label: "Groovy"
284
+ },
285
+ {
286
+ value: "haskell",
287
+ label: "Haskell"
288
+ },
289
+ {
290
+ value: "haxe",
291
+ label: "Haxe"
292
+ },
293
+ {
294
+ value: "html",
295
+ label: "HTML"
296
+ },
297
+ {
298
+ value: "ini",
299
+ label: "INI"
300
+ },
301
+ {
302
+ value: "java",
303
+ label: "Java"
304
+ },
305
+ {
306
+ value: "javascript",
307
+ label: "JavaScript"
308
+ },
309
+ {
310
+ value: "jsx",
311
+ label: "JavaScript (React)"
312
+ },
313
+ {
314
+ value: "json",
315
+ label: "JSON"
316
+ },
317
+ {
318
+ value: "julia",
319
+ label: "Julia"
320
+ },
321
+ {
322
+ value: "kotlin",
323
+ label: "Kotlin"
324
+ },
325
+ {
326
+ value: "latex",
327
+ label: "LaTeX"
328
+ },
329
+ {
330
+ value: "lua",
331
+ label: "Lua"
332
+ },
333
+ {
334
+ value: "markdown",
335
+ label: "Markdown"
336
+ },
337
+ {
338
+ value: "matlab",
339
+ label: "MATLAB"
340
+ },
341
+ {
342
+ value: "makefile",
343
+ label: "Makefile"
344
+ },
345
+ {
346
+ value: "objectivec",
347
+ label: "Objective-C"
348
+ },
349
+ {
350
+ value: "perl",
351
+ label: "Perl"
352
+ },
353
+ {
354
+ value: "php",
355
+ label: "PHP"
356
+ },
357
+ {
358
+ value: "plaintext",
359
+ label: "Plain text"
360
+ },
361
+ {
362
+ value: "powershell",
363
+ label: "PowerShell"
364
+ },
365
+ {
366
+ value: "python",
367
+ label: "Python"
368
+ },
369
+ {
370
+ value: "r",
371
+ label: "R"
372
+ },
373
+ {
374
+ value: "ruby",
375
+ label: "Ruby"
376
+ },
377
+ {
378
+ value: "rust",
379
+ label: "Rust"
380
+ },
381
+ {
382
+ value: "sas",
383
+ label: "SAS"
384
+ },
385
+ {
386
+ value: "scala",
387
+ label: "Scala"
388
+ },
389
+ {
390
+ value: "scheme",
391
+ label: "Scheme"
392
+ },
393
+ {
394
+ value: "shell",
395
+ label: "Shell"
396
+ },
397
+ {
398
+ value: "sql",
399
+ label: "SQL"
400
+ },
401
+ {
402
+ value: "stata",
403
+ label: "Stata"
404
+ },
405
+ {
406
+ value: "swift",
407
+ label: "Swift"
408
+ },
409
+ {
410
+ value: "typescript",
411
+ label: "TypeScript",
412
+ decorate: "ts"
413
+ },
414
+ {
415
+ value: "tsx",
416
+ label: "TypeScript (React)"
417
+ },
418
+ {
419
+ value: "vbnet",
420
+ label: "VB.NET"
421
+ },
422
+ {
423
+ value: "xml",
424
+ label: "XML"
425
+ },
426
+ {
427
+ value: "yaml",
428
+ label: "YAML",
429
+ decorate: "yml"
430
+ }
431
+ ];
163
432
  const baseHandleConvert = (editor, attributesToSet) => {
164
433
  const [_, lastNodePath] = Editor$1.last(editor, []);
165
434
  Transforms.unwrapNodes(editor, {
@@ -223,6 +492,29 @@ const pressEnterTwiceToExit = (editor) => {
223
492
  });
224
493
  }
225
494
  };
495
+ const decorateCode = ([node, path]) => {
496
+ const ranges = [];
497
+ if (!Element.isElement(node) || node.type !== "code") return ranges;
498
+ const text = Node.string(node);
499
+ const language = codeLanguages.find((lang) => lang.value === node.language);
500
+ const decorateKey = language?.decorate ?? language?.value;
501
+ const selectedLanguage = Prism.languages[decorateKey || "plaintext"];
502
+ const tokens = Prism.tokenize(text, selectedLanguage);
503
+ let start = 0;
504
+ for (const token of tokens) {
505
+ const length = token.length;
506
+ const end = start + length;
507
+ if (typeof token !== "string") {
508
+ ranges.push({
509
+ anchor: { path, offset: start },
510
+ focus: { path, offset: end },
511
+ className: `token ${token.type}`
512
+ });
513
+ }
514
+ start = end;
515
+ }
516
+ return ranges;
517
+ };
226
518
  const CodeBlock = styled.pre`
227
519
  border-radius: ${({ theme }) => theme.borderRadius};
228
520
  background-color: ${({ theme }) => theme.colors.neutral100};
@@ -230,6 +522,7 @@ const CodeBlock = styled.pre`
230
522
  overflow: auto;
231
523
  padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
232
524
  flex-shrink: 1;
525
+
233
526
  & > code {
234
527
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
235
528
  monospace;
@@ -238,10 +531,62 @@ const CodeBlock = styled.pre`
238
531
  max-width: 100%;
239
532
  }
240
533
  `;
534
+ const CodeEditor = (props) => {
535
+ const { editor } = useBlocksEditorContext("ImageDialog");
536
+ const editorIsFocused = useFocused();
537
+ const imageIsSelected = useSelected();
538
+ const { formatMessage } = useIntl();
539
+ const [isSelectOpen, setIsSelectOpen] = React.useState(false);
540
+ const shouldDisplayLanguageSelect = editorIsFocused && imageIsSelected || isSelectOpen;
541
+ return /* @__PURE__ */ jsxs(Box, { position: "relative", width: "100%", children: [
542
+ /* @__PURE__ */ jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsx("code", { children: props.children }) }),
543
+ shouldDisplayLanguageSelect && /* @__PURE__ */ jsx(
544
+ Box,
545
+ {
546
+ position: "absolute",
547
+ background: "neutral0",
548
+ borderColor: "neutral150",
549
+ borderStyle: "solid",
550
+ borderWidth: "0.5px",
551
+ shadow: "tableShadow",
552
+ top: "100%",
553
+ marginTop: 1,
554
+ right: 0,
555
+ padding: 1,
556
+ hasRadius: true,
557
+ children: /* @__PURE__ */ jsx(
558
+ SingleSelect,
559
+ {
560
+ onChange: (open) => {
561
+ Transforms.setNodes(
562
+ editor,
563
+ { language: open.toString() },
564
+ { match: (node) => !Editor$1.isEditor(node) && node.type === "code" }
565
+ );
566
+ },
567
+ value: props.element.type === "code" && props.element.language || "plaintext",
568
+ onOpenChange: (open) => {
569
+ setIsSelectOpen(open);
570
+ if (!open) {
571
+ ReactEditor.focus(editor);
572
+ }
573
+ },
574
+ onCloseAutoFocus: (e) => e.preventDefault(),
575
+ "aria-label": formatMessage({
576
+ id: "components.Blocks.blocks.code.languageLabel",
577
+ defaultMessage: "Select a language"
578
+ }),
579
+ children: codeLanguages.map(({ value, label }) => /* @__PURE__ */ jsx(SingleSelectOption, { value, children: label }, value))
580
+ }
581
+ )
582
+ }
583
+ )
584
+ ] });
585
+ };
241
586
  const codeBlocks = {
242
587
  code: {
243
- renderElement: (props) => /* @__PURE__ */ jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsx("code", { children: props.children }) }),
244
- icon: Code,
588
+ renderElement: (props) => /* @__PURE__ */ jsx(CodeEditor, { ...props }),
589
+ icon: CodeBlock$1,
245
590
  label: {
246
591
  id: "components.Blocks.blocks.code",
247
592
  defaultMessage: "Code block"
@@ -249,13 +594,12 @@ const codeBlocks = {
249
594
  matchNode: (node) => node.type === "code",
250
595
  isInBlocksSelector: true,
251
596
  handleConvert(editor) {
252
- baseHandleConvert(editor, { type: "code" });
597
+ baseHandleConvert(editor, { type: "code", language: "plaintext" });
253
598
  },
254
599
  handleEnterKey(editor) {
255
600
  pressEnterTwiceToExit(editor);
256
601
  },
257
- snippets: ["```"],
258
- dragHandleTopMargin: "10px"
602
+ snippets: ["```"]
259
603
  }
260
604
  };
261
605
  const H1 = styled(Typography).attrs({ tag: "h1" })`
@@ -430,8 +774,7 @@ const ImageDialog = () => {
430
774
  const [isOpen, setIsOpen] = React.useState(true);
431
775
  const { editor } = useBlocksEditorContext("ImageDialog");
432
776
  const components = useStrapiApp("ImageDialog", (state) => state.components);
433
- if (!components || !isOpen)
434
- return null;
777
+ if (!components || !isOpen) return null;
435
778
  const MediaLibraryDialog = components["media-library"];
436
779
  const insertImages = (images) => {
437
780
  Transforms.unwrapNodes(editor, {
@@ -440,14 +783,12 @@ const ImageDialog = () => {
440
783
  });
441
784
  const nodeEntryBeingReplaced = Editor$1.above(editor, {
442
785
  match(node) {
443
- if (Editor$1.isEditor(node))
444
- return false;
786
+ if (Editor$1.isEditor(node)) return false;
445
787
  const isInlineNode = ["text", "link"].includes(node.type);
446
788
  return !isInlineNode;
447
789
  }
448
790
  });
449
- if (!nodeEntryBeingReplaced)
450
- return;
791
+ if (!nodeEntryBeingReplaced) return;
451
792
  const [, pathToInsert] = nodeEntryBeingReplaced;
452
793
  Transforms.removeNodes(editor);
453
794
  const nodesToInsert = images.map((image) => {
@@ -593,20 +934,8 @@ const LinkContent = React.forwardRef(
593
934
  const [linkText, setLinkText] = React.useState(elementText);
594
935
  const [linkUrl, setLinkUrl] = React.useState(link.url);
595
936
  const linkInputRef = React.useRef(null);
596
- const [showRemoveButton, setShowRemoveButton] = React.useState(false);
937
+ const isLastInsertedLink = editor.lastInsertedLinkPath ? !Path.equals(path, editor.lastInsertedLinkPath) : true;
597
938
  const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);
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
- }
609
- };
610
939
  const onLinkChange = (e) => {
611
940
  setIsSaveDisabled(false);
612
941
  setLinkUrl(e.target.value);
@@ -627,15 +956,32 @@ const LinkContent = React.forwardRef(
627
956
  editLink(editor, { url: linkUrl, text: linkText });
628
957
  setPopoverOpen(false);
629
958
  editor.lastInsertedLinkPath = null;
959
+ ReactEditor.focus(editor);
960
+ };
961
+ const handleClose = () => {
962
+ if (link.url === "") {
963
+ removeLink(editor);
964
+ }
965
+ setPopoverOpen(false);
966
+ ReactEditor.focus(editor);
630
967
  };
631
968
  React.useEffect(() => {
632
- if (popoverOpen)
633
- linkInputRef.current?.focus();
969
+ if (popoverOpen) linkInputRef.current?.focus();
634
970
  }, [popoverOpen]);
635
971
  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: [
972
+ return /* @__PURE__ */ jsxs(Popover.Root, { open: popoverOpen, children: [
973
+ /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
974
+ StyledBaseLink,
975
+ {
976
+ ...attributes,
977
+ ref: forwardedRef,
978
+ href: link.url,
979
+ onClick: () => setPopoverOpen(true),
980
+ color: "primary600",
981
+ children
982
+ }
983
+ ) }),
984
+ /* @__PURE__ */ jsx(Popover.Content, { onPointerDownOutside: handleClose, children: /* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 4, children: [
639
985
  /* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
640
986
  /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
641
987
  id: "components.Blocks.popover.text",
@@ -681,7 +1027,7 @@ const LinkContent = React.forwardRef(
681
1027
  {
682
1028
  variant: "danger-light",
683
1029
  onClick: () => removeLink(editor),
684
- $visible: showRemoveButton,
1030
+ $visible: isLastInsertedLink,
685
1031
  children: formatMessage({
686
1032
  id: "components.Blocks.popover.remove",
687
1033
  defaultMessage: "Remove"
@@ -689,12 +1035,12 @@ const LinkContent = React.forwardRef(
689
1035
  }
690
1036
  ),
691
1037
  /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
692
- /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: () => handleOpenChange(false), children: formatMessage({
693
- id: "components.Blocks.popover.cancel",
1038
+ /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
1039
+ id: "global.cancel",
694
1040
  defaultMessage: "Cancel"
695
1041
  }) }),
696
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: Boolean(inputNotDirty) || isSaveDisabled, children: formatMessage({
697
- id: "components.Blocks.popover.save",
1042
+ /* @__PURE__ */ jsx(Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
1043
+ id: "global.save",
698
1044
  defaultMessage: "Save"
699
1045
  }) })
700
1046
  ] })
@@ -775,8 +1121,7 @@ const isText$1 = (node) => {
775
1121
  return Node.isNode(node) && !Editor$1.isEditor(node) && node.type === "text";
776
1122
  };
777
1123
  const handleBackspaceKeyOnList = (editor, event) => {
778
- if (!editor.selection)
779
- return;
1124
+ if (!editor.selection) return;
780
1125
  const [currentListItem, currentListItemPath] = Editor$1.parent(editor, editor.selection.anchor);
781
1126
  const [currentList, currentListPath] = Editor$1.parent(editor, currentListItemPath);
782
1127
  const isListEmpty = currentList.children.length === 1 && isText$1(currentListItem.children[0]) && currentListItem.children[0].text === "";
@@ -885,8 +1230,7 @@ const handleEnterKeyOnList = (editor) => {
885
1230
  };
886
1231
  const handleConvertToList = (editor, format) => {
887
1232
  const convertedPath = baseHandleConvert(editor, { type: "list-item" });
888
- if (!convertedPath)
889
- return;
1233
+ if (!convertedPath) return;
890
1234
  Transforms.wrapNodes(editor, { type: "list", format, children: [] }, { at: convertedPath });
891
1235
  };
892
1236
  const handleTabOnList = (editor) => {
@@ -898,8 +1242,7 @@ const handleTabOnList = (editor) => {
898
1242
  }
899
1243
  const [currentListItem, currentListItemPath] = currentListItemEntry;
900
1244
  const [currentList] = Editor$1.parent(editor, currentListItemPath);
901
- if (currentListItem === currentList.children[0])
902
- return;
1245
+ if (currentListItem === currentList.children[0]) return;
903
1246
  const currentListItemIndex = currentList.children.findIndex((item) => item === currentListItem);
904
1247
  const previousNode = currentList.children[currentListItemIndex - 1];
905
1248
  if (previousNode.type === "list") {
@@ -1035,13 +1378,13 @@ const quoteBlocks = {
1035
1378
  handleEnterKey(editor) {
1036
1379
  pressEnterTwiceToExit(editor);
1037
1380
  },
1038
- snippets: [">"],
1039
- dragHandleTopMargin: "6px"
1381
+ snippets: [">"]
1040
1382
  }
1041
1383
  };
1042
1384
  const ToolbarWrapper = styled(Flex)`
1043
1385
  &[aria-disabled='true'] {
1044
1386
  cursor: not-allowed;
1387
+ background: ${({ theme }) => theme.colors.neutral150};
1045
1388
  }
1046
1389
  `;
1047
1390
  const Separator = styled(Toolbar.Separator)`
@@ -1052,7 +1395,7 @@ const Separator = styled(Toolbar.Separator)`
1052
1395
  const FlexButton = styled(Flex)`
1053
1396
  // Inherit the not-allowed cursor from ToolbarWrapper when disabled
1054
1397
  &[aria-disabled] {
1055
- cursor: inherit;
1398
+ cursor: not-allowed;
1056
1399
  }
1057
1400
 
1058
1401
  &[aria-disabled='false'] {
@@ -1134,7 +1477,7 @@ const ToolbarButton = ({
1134
1477
  width: 7,
1135
1478
  height: 7,
1136
1479
  hasRadius: true,
1137
- children: /* @__PURE__ */ jsx(Icon, { width: "1.2rem", height: "1.2rem", fill: disabled ? "neutral300" : enabledColor })
1480
+ children: /* @__PURE__ */ jsx(Icon, { fill: disabled ? "neutral300" : enabledColor })
1138
1481
  }
1139
1482
  )
1140
1483
  }
@@ -1266,8 +1609,7 @@ const isListNode = (node) => {
1266
1609
  const ListButton = ({ block, format }) => {
1267
1610
  const { editor, disabled, blocks } = useBlocksEditorContext("ListButton");
1268
1611
  const isListActive = () => {
1269
- if (!editor.selection)
1270
- return false;
1612
+ if (!editor.selection) return false;
1271
1613
  const currentListEntry = Editor$1.above(editor, {
1272
1614
  match: (node) => !Editor$1.isEditor(node) && node.type === "list",
1273
1615
  at: editor.selection.anchor
@@ -1279,6 +1621,26 @@ const ListButton = ({ block, format }) => {
1279
1621
  }
1280
1622
  return false;
1281
1623
  };
1624
+ const isListDisabled = () => {
1625
+ if (disabled) {
1626
+ return true;
1627
+ }
1628
+ if (!editor.selection) {
1629
+ return false;
1630
+ }
1631
+ const anchorNodeEntry = Editor$1.above(editor, {
1632
+ at: editor.selection.anchor,
1633
+ match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
1634
+ });
1635
+ const focusNodeEntry = Editor$1.above(editor, {
1636
+ at: editor.selection.focus,
1637
+ match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
1638
+ });
1639
+ if (!anchorNodeEntry || !focusNodeEntry) {
1640
+ return false;
1641
+ }
1642
+ return anchorNodeEntry[0] !== focusNodeEntry[0];
1643
+ };
1282
1644
  const toggleList = (format2) => {
1283
1645
  let currentListEntry;
1284
1646
  if (editor.selection) {
@@ -1312,7 +1674,7 @@ const ListButton = ({ block, format }) => {
1312
1674
  name: format,
1313
1675
  label: block.label,
1314
1676
  isActive: isListActive(),
1315
- disabled,
1677
+ disabled: isListDisabled(),
1316
1678
  handleClick: () => toggleList(format)
1317
1679
  }
1318
1680
  );
@@ -1321,8 +1683,7 @@ const LinkButton = ({ disabled }) => {
1321
1683
  const { editor } = useBlocksEditorContext("LinkButton");
1322
1684
  const isLinkActive = () => {
1323
1685
  const { selection } = editor;
1324
- if (!selection)
1325
- return false;
1686
+ if (!selection) return false;
1326
1687
  const [match] = Array.from(
1327
1688
  Editor$1.nodes(editor, {
1328
1689
  at: Editor$1.unhangRange(editor, selection),
@@ -1386,7 +1747,7 @@ const BlocksToolbar = () => {
1386
1747
  return false;
1387
1748
  };
1388
1749
  const isButtonDisabled = checkButtonDisabled();
1389
- return /* @__PURE__ */ jsx(Toolbar.Root, { "aria-disabled": disabled, asChild: true, children: /* @__PURE__ */ jsxs(ToolbarWrapper, { gap: 2, padding: 2, children: [
1750
+ return /* @__PURE__ */ jsx(Toolbar.Root, { "aria-disabled": disabled, asChild: true, children: /* @__PURE__ */ jsxs(ToolbarWrapper, { gap: 2, padding: 2, width: "100%", children: [
1390
1751
  /* @__PURE__ */ jsx(BlocksDropdown, {}),
1391
1752
  /* @__PURE__ */ jsx(Separator, {}),
1392
1753
  /* @__PURE__ */ jsx(Toolbar.ToggleGroup, { type: "multiple", asChild: true, children: /* @__PURE__ */ jsxs(Flex, { gap: 1, children: [
@@ -1456,33 +1817,36 @@ const DragItem = styled(Flex)`
1456
1817
  }
1457
1818
  `;
1458
1819
  const DragIconButton = styled(IconButton)`
1820
+ user-select: none;
1459
1821
  display: flex;
1460
1822
  align-items: center;
1461
1823
  justify-content: center;
1824
+ border: none;
1462
1825
  border-radius: ${({ theme }) => theme.borderRadius};
1463
- width: ${({ theme }) => theme.spaces[4]};
1464
- height: ${({ theme }) => theme.spaces[6]};
1826
+ padding-left: ${({ theme }) => theme.spaces[0]};
1827
+ padding-right: ${({ theme }) => theme.spaces[0]};
1828
+ padding-top: ${({ theme }) => theme.spaces[1]};
1829
+ padding-bottom: ${({ theme }) => theme.spaces[1]};
1465
1830
  visibility: hidden;
1466
1831
  cursor: grab;
1467
1832
  opacity: inherit;
1468
1833
  margin-top: ${(props) => props.$dragHandleTopMargin ?? 0};
1469
1834
 
1470
1835
  &:hover {
1471
- background: ${({ theme }) => theme.colors.neutral200};
1836
+ background: ${({ theme }) => theme.colors.neutral100};
1472
1837
  }
1473
1838
  &:active {
1474
1839
  cursor: grabbing;
1840
+ background: ${({ theme }) => theme.colors.neutral150};
1475
1841
  }
1476
1842
  &[aria-disabled='true'] {
1477
- cursor: not-allowed;
1478
- background: transparent;
1843
+ visibility: hidden;
1479
1844
  }
1480
1845
  svg {
1481
- height: auto;
1482
- width: ${({ theme }) => theme.spaces[3]};
1846
+ min-width: ${({ theme }) => theme.spaces[3]};
1483
1847
 
1484
1848
  path {
1485
- fill: ${({ theme }) => theme.colors.neutral700};
1849
+ fill: ${({ theme }) => theme.colors.neutral500};
1486
1850
  }
1487
1851
  }
1488
1852
  `;
@@ -1527,8 +1891,7 @@ const DragAndDropElement = ({
1527
1891
  displayedValue: children
1528
1892
  },
1529
1893
  onDropItem(currentIndex, newIndex) {
1530
- if (newIndex)
1531
- handleMoveBlock(newIndex, currentIndex);
1894
+ if (newIndex) handleMoveBlock(newIndex, currentIndex);
1532
1895
  }
1533
1896
  });
1534
1897
  const composedBoxRefs = useComposedRefs(blockRef, dropRef);
@@ -1584,6 +1947,7 @@ const DragAndDropElement = ({
1584
1947
  DragIconButton,
1585
1948
  {
1586
1949
  tag: "div",
1950
+ contentEditable: false,
1587
1951
  role: "button",
1588
1952
  tabIndex: 0,
1589
1953
  withTooltip: false,
@@ -1596,7 +1960,7 @@ const DragAndDropElement = ({
1596
1960
  disabled,
1597
1961
  draggable: true,
1598
1962
  $dragHandleTopMargin: dragHandleTopMargin,
1599
- children: /* @__PURE__ */ jsx(Drag, { color: "neutral600" })
1963
+ children: /* @__PURE__ */ jsx(Drag, { color: "primary500" })
1600
1964
  }
1601
1965
  ),
1602
1966
  children
@@ -1633,7 +1997,7 @@ const baseRenderLeaf = (props, modifiers2) => {
1633
1997
  }
1634
1998
  return currentChildren;
1635
1999
  }, props.children);
1636
- return /* @__PURE__ */ jsx("span", { ...props.attributes, children: wrappedChildren });
2000
+ return /* @__PURE__ */ jsx("span", { ...props.attributes, className: props.leaf.className, children: wrappedChildren });
1637
2001
  };
1638
2002
  const baseRenderElement = ({
1639
2003
  props,
@@ -1671,8 +2035,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
1671
2035
  [modifiers2]
1672
2036
  );
1673
2037
  const handleMoveBlocks = (editor2, event) => {
1674
- if (!editor2.selection)
1675
- return;
2038
+ if (!editor2.selection) return;
1676
2039
  const start = Range.start(editor2.selection);
1677
2040
  const currentIndex = [start.path[0]];
1678
2041
  let newIndexPosition = 0;
@@ -1809,8 +2172,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
1809
2172
  }
1810
2173
  };
1811
2174
  const handleScrollSelectionIntoView = () => {
1812
- if (!editor.selection)
1813
- return;
2175
+ if (!editor.selection) return;
1814
2176
  const domRange = ReactEditor.toDOMRange(editor, editor.selection);
1815
2177
  const domRect = domRange.getBoundingClientRect();
1816
2178
  const blocksInput = blocksRef.current;
@@ -1837,7 +2199,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
1837
2199
  background: "neutral0",
1838
2200
  color: "neutral800",
1839
2201
  lineHeight: 6,
1840
- paddingRight: 4,
2202
+ paddingRight: 7,
1841
2203
  paddingTop: 6,
1842
2204
  paddingBottom: 3,
1843
2205
  children: [
@@ -1848,6 +2210,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
1848
2210
  readOnly: disabled,
1849
2211
  placeholder,
1850
2212
  isExpandedMode,
2213
+ decorate: decorateCode,
1851
2214
  renderElement,
1852
2215
  renderLeaf,
1853
2216
  onKeyDown: handleKeyDown,
@@ -1920,7 +2283,7 @@ const EditorLayout$1 = ({
1920
2283
  /* @__PURE__ */ jsx(
1921
2284
  CollapseIconButton,
1922
2285
  {
1923
- "aria-label": formatMessage({
2286
+ label: formatMessage({
1924
2287
  id: getTranslation("components.Blocks.collapse"),
1925
2288
  defaultMessage: "Collapse"
1926
2289
  }),
@@ -2004,8 +2367,7 @@ const InlineCode = styled.code`
2004
2367
  `;
2005
2368
  const baseCheckIsActive = (editor, name2) => {
2006
2369
  const marks = Editor$1.marks(editor);
2007
- if (!marks)
2008
- return false;
2370
+ if (!marks) return false;
2009
2371
  return Boolean(marks[name2]);
2010
2372
  };
2011
2373
  const baseHandleToggle = (editor, name2) => {
@@ -2171,6 +2533,7 @@ const ExpandIconButton = styled(IconButton)`
2171
2533
  position: absolute;
2172
2534
  bottom: 1.2rem;
2173
2535
  right: 1.2rem;
2536
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
2174
2537
  `;
2175
2538
  function useResetKey(value) {
2176
2539
  const slateUpdatesCount = React.useRef(0);
@@ -2259,7 +2622,7 @@ const BlocksEditor = React.forwardRef(
2259
2622
  !isExpandedMode && /* @__PURE__ */ jsx(
2260
2623
  ExpandIconButton,
2261
2624
  {
2262
- "aria-label": formatMessage({
2625
+ label: formatMessage({
2263
2626
  id: getTranslation("components.Blocks.expand"),
2264
2627
  defaultMessage: "Expand"
2265
2628
  }),
@@ -2325,47 +2688,44 @@ const createDefaultForm = (contentType, components = {}) => {
2325
2688
  const Initializer = ({ disabled, name: name2, onClick }) => {
2326
2689
  const { formatMessage } = useIntl();
2327
2690
  const field = useField(name2);
2328
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2329
- /* @__PURE__ */ jsx(
2330
- Box,
2331
- {
2332
- tag: "button",
2333
- background: "neutral100",
2334
- borderColor: field.error ? "danger600" : "neutral200",
2335
- hasRadius: true,
2336
- disabled,
2337
- onClick,
2338
- paddingTop: 9,
2339
- paddingBottom: 9,
2340
- type: "button",
2341
- children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
2342
- /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(CircleIcon, {}) }),
2343
- /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Typography, { textColor: "primary600", variant: "pi", fontWeight: "bold", children: formatMessage({
2344
- id: getTranslation("components.empty-repeatable"),
2345
- defaultMessage: "No entry yet. Click on the button below to add one."
2346
- }) }) })
2347
- ] })
2348
- }
2349
- ),
2350
- field.error && /* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "pi", children: field.error })
2351
- ] });
2691
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
2692
+ Box,
2693
+ {
2694
+ tag: "button",
2695
+ background: disabled ? "neutral150" : "neutral100",
2696
+ borderColor: field.error ? "danger600" : "neutral200",
2697
+ hasRadius: true,
2698
+ disabled,
2699
+ onClick,
2700
+ paddingTop: 9,
2701
+ paddingBottom: 9,
2702
+ type: "button",
2703
+ style: { cursor: disabled ? "not-allowed" : "pointer" },
2704
+ children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
2705
+ /* @__PURE__ */ jsx(Flex, { justifyContent: "center", color: disabled ? "neutral500" : "primary600", children: /* @__PURE__ */ jsx(PlusCircle, { width: "3.2rem", height: "3.2rem" }) }),
2706
+ /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(
2707
+ Typography,
2708
+ {
2709
+ textColor: disabled ? "neutral600" : "primary600",
2710
+ variant: "pi",
2711
+ fontWeight: "bold",
2712
+ children: formatMessage({
2713
+ id: getTranslation("components.empty-repeatable"),
2714
+ defaultMessage: "No entry yet. Click to add one."
2715
+ })
2716
+ }
2717
+ ) })
2718
+ ] })
2719
+ }
2720
+ ) });
2352
2721
  };
2353
- const CircleIcon = styled(PlusCircle)`
2354
- width: 2.4rem;
2355
- height: 2.4rem;
2356
- > circle {
2357
- fill: ${({ theme }) => theme.colors.primary200};
2358
- }
2359
- > path {
2360
- fill: ${({ theme }) => theme.colors.primary600};
2361
- }
2362
- `;
2363
2722
  const NonRepeatableComponent = ({
2364
2723
  attribute,
2365
2724
  name: name2,
2366
2725
  children,
2367
2726
  layout
2368
2727
  }) => {
2728
+ const { formatMessage } = useIntl();
2369
2729
  const { value } = useField(name2);
2370
2730
  const level = useComponent("NonRepeatableComponent", (state) => state.level);
2371
2731
  const isNested = level > 0;
@@ -2382,7 +2742,22 @@ const NonRepeatableComponent = ({
2382
2742
  children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index) => {
2383
2743
  return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
2384
2744
  const completeFieldName = `${name2}.${field.name}`;
2385
- return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2745
+ const translatedLabel = formatMessage({
2746
+ id: `content-manager.components.${attribute.component}.${field.name}`,
2747
+ defaultMessage: field.label
2748
+ });
2749
+ return /* @__PURE__ */ jsx(
2750
+ Grid$1.Item,
2751
+ {
2752
+ col: size,
2753
+ s: 12,
2754
+ xs: 12,
2755
+ direction: "column",
2756
+ alignItems: "stretch",
2757
+ children: children({ ...field, label: translatedLabel, name: completeFieldName })
2758
+ },
2759
+ completeFieldName
2760
+ );
2386
2761
  }) }, index);
2387
2762
  }) })
2388
2763
  }
@@ -2401,13 +2776,34 @@ const RepeatableComponent = ({
2401
2776
  const { search: searchString } = useLocation();
2402
2777
  const search = React.useMemo(() => new URLSearchParams(searchString), [searchString]);
2403
2778
  const { components } = useDoc();
2404
- const { value = [], error } = useField(name2);
2779
+ const {
2780
+ value = [],
2781
+ error,
2782
+ rawError
2783
+ } = useField(name2);
2405
2784
  const addFieldRow = useForm("RepeatableComponent", (state) => state.addFieldRow);
2406
2785
  const moveFieldRow = useForm("RepeatableComponent", (state) => state.moveFieldRow);
2407
2786
  const removeFieldRow = useForm("RepeatableComponent", (state) => state.removeFieldRow);
2408
2787
  const { max = Infinity } = attribute;
2409
2788
  const [collapseToOpen, setCollapseToOpen] = React.useState("");
2410
2789
  const [liveText, setLiveText] = React.useState("");
2790
+ React.useEffect(() => {
2791
+ const hasNestedErrors = rawError && Array.isArray(rawError) && rawError.length > 0;
2792
+ const hasNestedValue = value && Array.isArray(value) && value.length > 0;
2793
+ if (hasNestedErrors && hasNestedValue) {
2794
+ const errorOpenItems = rawError.map((_, idx) => {
2795
+ return value[idx] ? value[idx].__temp_key__ : null;
2796
+ }).filter((value2) => !!value2);
2797
+ if (errorOpenItems && errorOpenItems.length > 0) {
2798
+ setCollapseToOpen((collapseToOpen2) => {
2799
+ if (!errorOpenItems.includes(collapseToOpen2)) {
2800
+ return errorOpenItems[0];
2801
+ }
2802
+ return collapseToOpen2;
2803
+ });
2804
+ }
2805
+ }
2806
+ }, [rawError, value]);
2411
2807
  const componentTmpKeyWithFocussedField = React.useMemo(() => {
2412
2808
  if (search.has("field")) {
2413
2809
  const fieldParam = search.get("field");
@@ -2560,7 +2956,26 @@ const RepeatableComponent = ({
2560
2956
  children: layout.map((row, index2) => {
2561
2957
  return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
2562
2958
  const completeFieldName = `${nameWithIndex}.${field.name}`;
2563
- return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2959
+ const translatedLabel = formatMessage({
2960
+ id: `content-manager.components.${attribute.component}.${field.name}`,
2961
+ defaultMessage: field.label
2962
+ });
2963
+ return /* @__PURE__ */ jsx(
2964
+ Grid$1.Item,
2965
+ {
2966
+ col: size,
2967
+ s: 12,
2968
+ xs: 12,
2969
+ direction: "column",
2970
+ alignItems: "stretch",
2971
+ children: children({
2972
+ ...field,
2973
+ label: translatedLabel,
2974
+ name: completeFieldName
2975
+ })
2976
+ },
2977
+ completeFieldName
2978
+ );
2564
2979
  }) }, index2);
2565
2980
  })
2566
2981
  }
@@ -2655,7 +3070,7 @@ const Component = ({
2655
3070
  /* @__PURE__ */ jsx(
2656
3071
  IconButton,
2657
3072
  {
2658
- borderWidth: 0,
3073
+ variant: "ghost",
2659
3074
  onClick: onDeleteComponent,
2660
3075
  label: formatMessage({
2661
3076
  id: getTranslation("containers.Edit.delete"),
@@ -2668,7 +3083,7 @@ const Component = ({
2668
3083
  IconButton,
2669
3084
  {
2670
3085
  ref: composedAccordionRefs,
2671
- borderWidth: 0,
3086
+ variant: "ghost",
2672
3087
  onClick: (e) => e.stopPropagation(),
2673
3088
  "data-handler-id": handlerId,
2674
3089
  label: formatMessage({
@@ -2738,7 +3153,7 @@ const ComponentInput = ({
2738
3153
  id: getTranslation("components.reset-entry"),
2739
3154
  defaultMessage: "Reset Entry"
2740
3155
  }),
2741
- borderWidth: 0,
3156
+ variant: "ghost",
2742
3157
  onClick: () => {
2743
3158
  field.onChange(name2, null);
2744
3159
  },
@@ -2767,19 +3182,16 @@ const AddComponentButton = ({
2767
3182
  onClick,
2768
3183
  disabled: isDisabled,
2769
3184
  background: "neutral0",
2770
- paddingTop: 3,
2771
- paddingBottom: 3,
2772
- paddingLeft: 4,
2773
- paddingRight: 4,
2774
3185
  style: { cursor: isDisabled ? "not-allowed" : "pointer" },
3186
+ variant: "tertiary",
2775
3187
  children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
2776
3188
  /* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
2777
3189
  /* @__PURE__ */ jsx(
2778
- AddComponentTitle,
3190
+ Typography,
2779
3191
  {
2780
3192
  variant: "pi",
2781
3193
  fontWeight: "bold",
2782
- textColor: hasError && !isOpen ? "danger600" : "neutral500",
3194
+ textColor: hasError && !isOpen ? "danger600" : "neutral600",
2783
3195
  children
2784
3196
  }
2785
3197
  )
@@ -2796,42 +3208,14 @@ const StyledAddIcon = styled(PlusCircle)`
2796
3208
  fill: ${({ theme, $hasError }) => $hasError ? theme.colors.danger200 : theme.colors.neutral150};
2797
3209
  }
2798
3210
  > path {
2799
- fill: ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral600};
3211
+ fill: ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral500};
2800
3212
  }
2801
3213
  `;
2802
- const AddComponentTitle = styled(Typography)``;
2803
- const StyledButton = styled(BaseButton)`
3214
+ const StyledButton = styled(Button)`
3215
+ padding-left: ${({ theme }) => theme.spaces[3]};
2804
3216
  border-radius: 26px;
2805
- border-color: ${({ theme }) => theme.colors.neutral150};
2806
3217
  box-shadow: ${({ theme }) => theme.shadows.filterShadow};
2807
-
2808
- &:hover {
2809
- ${AddComponentTitle} {
2810
- color: ${({ theme }) => theme.colors.primary600};
2811
- }
2812
-
2813
- ${StyledAddIcon} {
2814
- > circle {
2815
- fill: ${({ theme }) => theme.colors.primary600};
2816
- }
2817
- > path {
2818
- fill: ${({ theme }) => theme.colors.neutral100};
2819
- }
2820
- }
2821
- }
2822
- &:active {
2823
- ${AddComponentTitle} {
2824
- color: ${({ theme }) => theme.colors.primary600};
2825
- }
2826
- ${StyledAddIcon} {
2827
- > circle {
2828
- fill: ${({ theme }) => theme.colors.primary600};
2829
- }
2830
- > path {
2831
- fill: ${({ theme }) => theme.colors.neutral100};
2832
- }
2833
- }
2834
- }
3218
+ height: 5rem;
2835
3219
  `;
2836
3220
  const ComponentCategory = ({
2837
3221
  category,
@@ -2946,18 +3330,6 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
2946
3330
  /* @__PURE__ */ jsx(Field.Hint, {})
2947
3331
  ] });
2948
3332
  };
2949
- function useDebounce(value, delay) {
2950
- const [debouncedValue, setDebouncedValue] = useState(value);
2951
- useEffect(() => {
2952
- const handler = setTimeout(() => {
2953
- setDebouncedValue(value);
2954
- }, delay);
2955
- return () => {
2956
- clearTimeout(handler);
2957
- };
2958
- }, [value, delay]);
2959
- return debouncedValue;
2960
- }
2961
3333
  const uidApi = contentManagerApi.injectEndpoints({
2962
3334
  endpoints: (builder) => ({
2963
3335
  getDefaultUID: builder.query({
@@ -2992,7 +3364,10 @@ const uidApi = contentManagerApi.injectEndpoints({
2992
3364
  config: {
2993
3365
  params
2994
3366
  }
2995
- })
3367
+ }),
3368
+ providesTags: (_res, _error, params) => [
3369
+ { type: "UidAvailability", id: params.contentTypeUID }
3370
+ ]
2996
3371
  })
2997
3372
  })
2998
3373
  });
@@ -3004,8 +3379,10 @@ const UIDInput = React.forwardRef(
3004
3379
  const allFormValues = useForm("InputUID", (form) => form.values);
3005
3380
  const [availability, setAvailability] = React.useState();
3006
3381
  const [showRegenerate, setShowRegenerate] = React.useState(false);
3382
+ const isCloning = useMatch(CLONE_PATH) !== null;
3007
3383
  const field = useField(name2);
3008
3384
  const debouncedValue = useDebounce(field.value, 300);
3385
+ const hasChanged = debouncedValue !== field.initialValue;
3009
3386
  const { toggleNotification } = useNotification();
3010
3387
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
3011
3388
  const { formatMessage } = useIntl();
@@ -3081,8 +3458,9 @@ const UIDInput = React.forwardRef(
3081
3458
  params
3082
3459
  },
3083
3460
  {
3461
+ // Don't check availability if the value is empty or wasn't changed
3084
3462
  skip: !Boolean(
3085
- debouncedValue !== field.initialValue && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3463
+ (hasChanged || isCloning) && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3086
3464
  )
3087
3465
  }
3088
3466
  );
@@ -3111,6 +3489,7 @@ const UIDInput = React.forwardRef(
3111
3489
  const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
3112
3490
  const fieldRef = useFocusInputField(name2);
3113
3491
  const composedRefs = useComposedRefs(ref, fieldRef);
3492
+ const shouldShowAvailability = (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;
3114
3493
  return /* @__PURE__ */ jsxs(Field.Root, { hint, name: name2, error: field.error, required, children: [
3115
3494
  /* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
3116
3495
  /* @__PURE__ */ jsx(
@@ -3119,7 +3498,7 @@ const UIDInput = React.forwardRef(
3119
3498
  ref: composedRefs,
3120
3499
  disabled: props.disabled,
3121
3500
  endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
3122
- availability && !showRegenerate && /* @__PURE__ */ jsxs(
3501
+ shouldShowAvailability && /* @__PURE__ */ jsxs(
3123
3502
  TextValidation,
3124
3503
  {
3125
3504
  alignItems: "center",
@@ -3408,8 +3787,7 @@ const Wrapper = styled.div`
3408
3787
  `;
3409
3788
  var listRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/, emptyListRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/, unorderedListRE = /[*+-]\s/;
3410
3789
  function newlineAndIndentContinueMarkdownList(cm) {
3411
- if (cm.getOption("disableInput"))
3412
- return CodeMirror.Pass;
3790
+ if (cm.getOption("disableInput")) return CodeMirror.Pass;
3413
3791
  var ranges = cm.listSelections(), replacements = [];
3414
3792
  for (var i = 0; i < ranges.length; i++) {
3415
3793
  var pos = ranges[i].head;
@@ -3443,8 +3821,7 @@ function newlineAndIndentContinueMarkdownList(cm) {
3443
3821
  var numbered = !(unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0);
3444
3822
  var bullet = numbered ? parseInt(match[3], 10) + 1 + match[4] : match[2].replace("x", " ");
3445
3823
  replacements[i] = "\n" + indent + bullet + after;
3446
- if (numbered)
3447
- incrementRemainingMarkdownListNumbers(cm, pos);
3824
+ if (numbered) incrementRemainingMarkdownListNumbers(cm, pos);
3448
3825
  }
3449
3826
  }
3450
3827
  cm.replaceSelections(replacements);
@@ -3462,10 +3839,8 @@ function incrementRemainingMarkdownListNumbers(cm, pos) {
3462
3839
  var newNumber = parseInt(startItem[3], 10) + lookAhead - skipCount;
3463
3840
  var nextNumber = parseInt(nextItem[3], 10), itemNumber = nextNumber;
3464
3841
  if (startIndent === nextIndent && !isNaN(nextNumber)) {
3465
- if (newNumber === nextNumber)
3466
- itemNumber = nextNumber + 1;
3467
- if (newNumber > nextNumber)
3468
- itemNumber = newNumber + 1;
3842
+ if (newNumber === nextNumber) itemNumber = nextNumber + 1;
3843
+ if (newNumber > nextNumber) itemNumber = newNumber + 1;
3469
3844
  cm.replaceRange(
3470
3845
  nextLine.replace(listRE, nextIndent + itemNumber + nextItem[4] + nextItem[5]),
3471
3846
  {
@@ -3478,10 +3853,8 @@ function incrementRemainingMarkdownListNumbers(cm, pos) {
3478
3853
  }
3479
3854
  );
3480
3855
  } else {
3481
- if (startIndent.length > nextIndent.length)
3482
- return;
3483
- if (startIndent.length < nextIndent.length && lookAhead === 1)
3484
- return;
3856
+ if (startIndent.length > nextIndent.length) return;
3857
+ if (startIndent.length < nextIndent.length && lookAhead === 1) return;
3485
3858
  skipCount += 1;
3486
3859
  }
3487
3860
  }
@@ -3953,7 +4326,7 @@ const EditorLayout = ({
3953
4326
  justifyContent: "flex-end",
3954
4327
  shrink: 0,
3955
4328
  width: "100%",
3956
- children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, children: [
4329
+ children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, variant: "tertiary", size: "M", children: [
3957
4330
  /* @__PURE__ */ jsx(Typography, { children: formatMessage({
3958
4331
  id: "components.Wysiwyg.collapse",
3959
4332
  defaultMessage: "Collapse"
@@ -3971,12 +4344,14 @@ const EditorLayout = ({
3971
4344
  ) }) });
3972
4345
  }
3973
4346
  return /* @__PURE__ */ jsx(
3974
- Box,
4347
+ Flex,
3975
4348
  {
3976
4349
  borderColor: error ? "danger600" : "neutral200",
3977
4350
  borderStyle: "solid",
3978
4351
  borderWidth: "1px",
3979
4352
  hasRadius: true,
4353
+ direction: "column",
4354
+ alignItems: "stretch",
3980
4355
  children
3981
4356
  }
3982
4357
  );
@@ -3987,11 +4362,19 @@ const ExpandWrapper = styled(Flex)`
3987
4362
  const BoxWithBorder = styled(Box)`
3988
4363
  border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
3989
4364
  `;
3990
- const ExpandButton$1 = styled(BaseButton)`
4365
+ const ExpandButton$1 = styled(Button)`
3991
4366
  background-color: transparent;
3992
4367
  border: none;
3993
4368
  align-items: center;
3994
4369
 
4370
+ & > span {
4371
+ display: flex;
4372
+ justify-content: space-between;
4373
+ align-items: center;
4374
+ width: 100%;
4375
+ font-weight: ${({ theme }) => theme.fontWeights.regular};
4376
+ }
4377
+
3995
4378
  svg {
3996
4379
  margin-left: ${({ theme }) => `${theme.spaces[2]}`};
3997
4380
 
@@ -4258,40 +4641,28 @@ const quoteAndCodeHandler = (editor, markdownType) => {
4258
4641
  insertWithoutTextToEdit(editor, markdownType, line, contentLength);
4259
4642
  }
4260
4643
  };
4261
- const CustomIconButton = styled(IconButton)`
4262
- padding: ${({ theme }) => theme.spaces[2]};
4263
-
4264
- svg {
4265
- width: 1.8rem;
4266
- height: 1.8rem;
4267
- }
4268
- `;
4269
- const CustomLinkIconButton = styled(CustomIconButton)`
4270
- svg {
4271
- width: 0.8rem;
4272
- height: 0.8rem;
4273
- }
4274
- `;
4275
4644
  const MainButtons = styled(IconButtonGroup)`
4276
4645
  margin-left: ${({ theme }) => theme.spaces[4]};
4277
4646
  `;
4278
4647
  const MoreButton = styled(IconButton)`
4279
4648
  margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
4280
- padding: ${({ theme }) => theme.spaces[2]};
4281
-
4282
- svg {
4283
- width: 1.8rem;
4284
- height: 1.8rem;
4285
- }
4286
4649
  `;
4287
4650
  const IconButtonGroupMargin = styled(IconButtonGroup)`
4288
4651
  margin-right: ${({ theme }) => `${theme.spaces[2]}`};
4289
4652
  `;
4290
- const ExpandButton = styled(BaseButton)`
4653
+ const ExpandButton = styled(Button)`
4291
4654
  background-color: transparent;
4292
4655
  border: none;
4293
4656
  align-items: center;
4294
4657
 
4658
+ & > span {
4659
+ display: flex;
4660
+ justify-content: space-between;
4661
+ align-items: center;
4662
+ width: 100%;
4663
+ font-weight: ${({ theme }) => theme.fontWeights.regular};
4664
+ }
4665
+
4295
4666
  svg {
4296
4667
  margin-left: ${({ theme }) => `${theme.spaces[2]}`};
4297
4668
  path {
@@ -4303,8 +4674,8 @@ const ExpandButton = styled(BaseButton)`
4303
4674
  `;
4304
4675
  const WysiwygFooter = ({ onToggleExpand }) => {
4305
4676
  const { formatMessage } = useIntl();
4306
- 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: [
4307
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({
4677
+ 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: [
4678
+ /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
4308
4679
  id: "components.WysiwygBottomControls.fullscreen",
4309
4680
  defaultMessage: "Expand"
4310
4681
  }) }),
@@ -4340,18 +4711,27 @@ const WysiwygNav = ({
4340
4711
  borderRadius: `0.4rem 0.4rem 0 0`,
4341
4712
  children: [
4342
4713
  /* @__PURE__ */ jsxs(Flex, { children: [
4343
- /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(SingleSelect, { disabled: true, placeholder: selectPlaceholder, "aria-label": selectPlaceholder, children: [
4344
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
4345
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
4346
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h3", children: "h3" }),
4347
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h4", children: "h4" }),
4348
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h5", children: "h5" }),
4349
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
4350
- ] }) }),
4714
+ /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
4715
+ SingleSelect,
4716
+ {
4717
+ disabled: true,
4718
+ placeholder: selectPlaceholder,
4719
+ "aria-label": selectPlaceholder,
4720
+ size: "S",
4721
+ children: [
4722
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
4723
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
4724
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h3", children: "h3" }),
4725
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h4", children: "h4" }),
4726
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h5", children: "h5" }),
4727
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
4728
+ ]
4729
+ }
4730
+ ) }),
4351
4731
  /* @__PURE__ */ jsxs(MainButtons, { children: [
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, {}) })
4732
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
4733
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
4734
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
4355
4735
  ] }),
4356
4736
  /* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsx(More, {}) })
4357
4737
  ] }),
@@ -4378,6 +4758,7 @@ const WysiwygNav = ({
4378
4758
  placeholder: selectPlaceholder,
4379
4759
  "aria-label": selectPlaceholder,
4380
4760
  onChange: (value) => onActionClick(value, editorRef),
4761
+ size: "S",
4381
4762
  children: [
4382
4763
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
4383
4764
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
@@ -4389,17 +4770,9 @@ const WysiwygNav = ({
4389
4770
  }
4390
4771
  ) }),
4391
4772
  /* @__PURE__ */ jsxs(MainButtons, { children: [
4773
+ /* @__PURE__ */ jsx(IconButton, { onClick: () => onActionClick("Bold", editorRef), label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
4392
4774
  /* @__PURE__ */ jsx(
4393
- CustomIconButton,
4394
- {
4395
- onClick: () => onActionClick("Bold", editorRef),
4396
- label: "Bold",
4397
- name: "Bold",
4398
- children: /* @__PURE__ */ jsx(Bold, {})
4399
- }
4400
- ),
4401
- /* @__PURE__ */ jsx(
4402
- CustomIconButton,
4775
+ IconButton,
4403
4776
  {
4404
4777
  onClick: () => onActionClick("Italic", editorRef),
4405
4778
  label: "Italic",
@@ -4408,7 +4781,7 @@ const WysiwygNav = ({
4408
4781
  }
4409
4782
  ),
4410
4783
  /* @__PURE__ */ jsx(
4411
- CustomIconButton,
4784
+ IconButton,
4412
4785
  {
4413
4786
  onClick: () => onActionClick("Underline", editorRef),
4414
4787
  label: "Underline",
@@ -4422,7 +4795,7 @@ const WysiwygNav = ({
4422
4795
  /* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
4423
4796
  /* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
4424
4797
  /* @__PURE__ */ jsx(
4425
- CustomIconButton,
4798
+ IconButton,
4426
4799
  {
4427
4800
  onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
4428
4801
  label: "Strikethrough",
@@ -4431,7 +4804,7 @@ const WysiwygNav = ({
4431
4804
  }
4432
4805
  ),
4433
4806
  /* @__PURE__ */ jsx(
4434
- CustomIconButton,
4807
+ IconButton,
4435
4808
  {
4436
4809
  onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
4437
4810
  label: "BulletList",
@@ -4440,7 +4813,7 @@ const WysiwygNav = ({
4440
4813
  }
4441
4814
  ),
4442
4815
  /* @__PURE__ */ jsx(
4443
- CustomIconButton,
4816
+ IconButton,
4444
4817
  {
4445
4818
  onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
4446
4819
  label: "NumberList",
@@ -4451,7 +4824,7 @@ const WysiwygNav = ({
4451
4824
  ] }),
4452
4825
  /* @__PURE__ */ jsxs(IconButtonGroup, { children: [
4453
4826
  /* @__PURE__ */ jsx(
4454
- CustomIconButton,
4827
+ IconButton,
4455
4828
  {
4456
4829
  onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
4457
4830
  label: "Code",
@@ -4460,7 +4833,7 @@ const WysiwygNav = ({
4460
4833
  }
4461
4834
  ),
4462
4835
  /* @__PURE__ */ jsx(
4463
- CustomIconButton,
4836
+ IconButton,
4464
4837
  {
4465
4838
  onClick: () => {
4466
4839
  handleTogglePopover();
@@ -4472,7 +4845,7 @@ const WysiwygNav = ({
4472
4845
  }
4473
4846
  ),
4474
4847
  /* @__PURE__ */ jsx(
4475
- CustomLinkIconButton,
4848
+ IconButton,
4476
4849
  {
4477
4850
  onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
4478
4851
  label: "Link",
@@ -4481,7 +4854,7 @@ const WysiwygNav = ({
4481
4854
  }
4482
4855
  ),
4483
4856
  /* @__PURE__ */ jsx(
4484
- CustomIconButton,
4857
+ IconButton,
4485
4858
  {
4486
4859
  onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
4487
4860
  label: "Quote",
@@ -4618,15 +4991,19 @@ const Wysiwyg = React.forwardRef(
4618
4991
  );
4619
4992
  const MemoizedWysiwyg = React.memo(Wysiwyg);
4620
4993
  const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4621
- const { id } = useDoc();
4994
+ const { id, document: document2, collectionType } = useDoc();
4622
4995
  const isFormDisabled = useForm("InputRenderer", (state) => state.disabled);
4623
4996
  const isInDynamicZone = useDynamicZone("isInDynamicZone", (state) => state.isInDynamicZone);
4624
4997
  const canCreateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canCreateFields);
4625
4998
  const canReadFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canReadFields);
4626
4999
  const canUpdateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUpdateFields);
4627
5000
  const canUserAction = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUserAction);
4628
- const editableFields = id ? canUpdateFields : canCreateFields;
4629
- const readableFields = id ? canReadFields : canCreateFields;
5001
+ let idToCheck = id;
5002
+ if (collectionType === SINGLE_TYPES) {
5003
+ idToCheck = document2?.documentId;
5004
+ }
5005
+ const editableFields = idToCheck ? canUpdateFields : canCreateFields;
5006
+ const readableFields = idToCheck ? canReadFields : canCreateFields;
4630
5007
  const canUserReadField = canUserAction(props.name, readableFields, props.type);
4631
5008
  const canUserEditField = canUserAction(props.name, editableFields, props.type);
4632
5009
  const fields = useStrapiApp("InputRenderer", (app) => app.fields);
@@ -4637,6 +5014,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4637
5014
  const {
4638
5015
  edit: { components }
4639
5016
  } = useDocLayout();
5017
+ const field = useField(props.name);
4640
5018
  if (!visible) {
4641
5019
  return null;
4642
5020
  }
@@ -4647,7 +5025,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4647
5025
  if (attributeHasCustomFieldProperty(props.attribute)) {
4648
5026
  const CustomInput = lazyComponentStore[props.attribute.customField];
4649
5027
  if (CustomInput) {
4650
- return /* @__PURE__ */ jsx(CustomInput, { ...props, hint, disabled: fieldIsDisabled });
5028
+ return /* @__PURE__ */ jsx(CustomInput, { ...props, ...field, hint, disabled: fieldIsDisabled });
4651
5029
  }
4652
5030
  return /* @__PURE__ */ jsx(
4653
5031
  InputRenderer$1,
@@ -4717,7 +5095,9 @@ const useFieldHint = (hint = void 0, attribute) => {
4717
5095
  if (!maximum && !minimum) {
4718
5096
  return hint;
4719
5097
  }
4720
- const units = !["biginteger", "integer", "number"].includes(attribute.type) ? formatMessage(
5098
+ const units = !["biginteger", "integer", "number", "dynamiczone", "component"].includes(
5099
+ attribute.type
5100
+ ) ? formatMessage(
4721
5101
  {
4722
5102
  id: "content-manager.form.Input.hint.character.unit",
4723
5103
  defaultMessage: "{maxValue, plural, one { character} other { characters}}"
@@ -4769,7 +5149,8 @@ const DynamicComponent = ({
4769
5149
  onDropItem,
4770
5150
  onCancel,
4771
5151
  dynamicComponentsByCategory = {},
4772
- onAddComponent
5152
+ onAddComponent,
5153
+ children
4773
5154
  }) => {
4774
5155
  const { formatMessage } = useIntl();
4775
5156
  const formValues = useForm("DynamicComponent", (state) => state.values);
@@ -4806,12 +5187,20 @@ const DynamicComponent = ({
4806
5187
  React.useEffect(() => {
4807
5188
  dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
4808
5189
  }, [dragPreviewRef, index]);
5190
+ const accordionValue = React.useId();
5191
+ const { value = [], rawError } = useField(`${name2}.${index}`);
5192
+ const [collapseToOpen, setCollapseToOpen] = React.useState("");
5193
+ React.useEffect(() => {
5194
+ if (rawError && value) {
5195
+ setCollapseToOpen(accordionValue);
5196
+ }
5197
+ }, [rawError, value, accordionValue]);
4809
5198
  const composedBoxRefs = useComposedRefs(boxRef, dropRef);
4810
5199
  const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
4811
5200
  /* @__PURE__ */ jsx(
4812
5201
  IconButton,
4813
5202
  {
4814
- borderWidth: 0,
5203
+ variant: "ghost",
4815
5204
  label: formatMessage(
4816
5205
  {
4817
5206
  id: getTranslation("components.DynamicZone.delete-label"),
@@ -4826,7 +5215,7 @@ const DynamicComponent = ({
4826
5215
  /* @__PURE__ */ jsx(
4827
5216
  IconButton,
4828
5217
  {
4829
- borderWidth: 0,
5218
+ variant: "ghost",
4830
5219
  onClick: (e) => e.stopPropagation(),
4831
5220
  "data-handler-id": handlerId,
4832
5221
  ref: dragRef,
@@ -4871,10 +5260,9 @@ const DynamicComponent = ({
4871
5260
  ] })
4872
5261
  ] });
4873
5262
  const accordionTitle = title ? `${displayName} ${title}` : displayName;
4874
- const accordionValue = React.useId();
4875
5263
  return /* @__PURE__ */ jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
4876
5264
  /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Rectangle, { background: "neutral200" }) }),
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: [
5265
+ /* @__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: [
4878
5266
  /* @__PURE__ */ jsxs(Accordion.Header, { children: [
4879
5267
  /* @__PURE__ */ jsx(
4880
5268
  Accordion.Trigger,
@@ -4885,10 +5273,39 @@ const DynamicComponent = ({
4885
5273
  ),
4886
5274
  /* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
4887
5275
  ] }),
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 }) => {
4889
- const fieldName = `${name2}.${index}.${field.name}`;
4890
- return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field, name: fieldName }) }, fieldName);
4891
- }) }, rowInd)) }) }) })
5276
+ /* @__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(
5277
+ Grid$1.Item,
5278
+ {
5279
+ col: 12,
5280
+ s: 12,
5281
+ xs: 12,
5282
+ direction: "column",
5283
+ alignItems: "stretch",
5284
+ children: /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
5285
+ const fieldName = `${name2}.${index}.${field.name}`;
5286
+ const fieldWithTranslatedLabel = {
5287
+ ...field,
5288
+ label: formatMessage({
5289
+ id: `content-manager.components.${componentUid}.${field.name}`,
5290
+ defaultMessage: field.label
5291
+ })
5292
+ };
5293
+ return /* @__PURE__ */ jsx(
5294
+ Grid$1.Item,
5295
+ {
5296
+ col: size,
5297
+ s: 12,
5298
+ xs: 12,
5299
+ direction: "column",
5300
+ alignItems: "stretch",
5301
+ children: children ? children({ ...fieldWithTranslatedLabel, name: fieldName }) : /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...fieldWithTranslatedLabel, name: fieldName })
5302
+ },
5303
+ fieldName
5304
+ );
5305
+ }) })
5306
+ },
5307
+ rowInd
5308
+ )) }) }) }) })
4892
5309
  ] }) }) })
4893
5310
  ] });
4894
5311
  };
@@ -4967,7 +5384,8 @@ const DynamicZone = ({
4967
5384
  label,
4968
5385
  labelAction,
4969
5386
  name: name2,
4970
- required = false
5387
+ required = false,
5388
+ children
4971
5389
  }) => {
4972
5390
  const { max = Infinity, min = -Infinity } = attribute ?? {};
4973
5391
  const [addComponentIsOpen, setAddComponentIsOpen] = React.useState(false);
@@ -5080,7 +5498,7 @@ const DynamicZone = ({
5080
5498
  const handleRemoveComponent = (name22, currentIndex) => () => {
5081
5499
  removeFieldRow(name22, currentIndex);
5082
5500
  };
5083
- const hasError = error !== void 0 || dynamicDisplayedComponentsLength < min || dynamicDisplayedComponentsLength > max;
5501
+ const hasError = error !== void 0;
5084
5502
  const renderButtonLabel = () => {
5085
5503
  if (addComponentIsOpen) {
5086
5504
  return formatMessage({ id: "app.utils.close-label", defaultMessage: "Close" });
@@ -5153,7 +5571,8 @@ const DynamicZone = ({
5153
5571
  onDropItem: handleDropItem,
5154
5572
  onGrabItem: handleGrabItem,
5155
5573
  onAddComponent: handleAddComponent,
5156
- dynamicComponentsByCategory
5574
+ dynamicComponentsByCategory,
5575
+ children
5157
5576
  }
5158
5577
  )
5159
5578
  },
@@ -5196,4 +5615,4 @@ export {
5196
5615
  transformDocument as t,
5197
5616
  useLazyComponents as u
5198
5617
  };
5199
- //# sourceMappingURL=Field-BDMSCcy5.mjs.map
5618
+ //# sourceMappingURL=Field-Dltnt1km.mjs.map