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

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 (220) 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-DmwmiFQy.mjs → ComponentConfigurationPage-D4J64ny7.mjs} +4 -4
  5. package/dist/_chunks/{ComponentConfigurationPage-DmwmiFQy.mjs.map → ComponentConfigurationPage-D4J64ny7.mjs.map} +1 -1
  6. package/dist/_chunks/{ComponentConfigurationPage-C-49MccQ.js → ComponentConfigurationPage-DHV8IFbd.js} +5 -6
  7. package/dist/_chunks/{ComponentConfigurationPage-C-49MccQ.js.map → ComponentConfigurationPage-DHV8IFbd.js.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-JT3E7NZy.mjs → EditConfigurationPage-DMnf8orh.mjs} +4 -4
  12. package/dist/_chunks/{EditConfigurationPage-JT3E7NZy.mjs.map → EditConfigurationPage-DMnf8orh.mjs.map} +1 -1
  13. package/dist/_chunks/{EditConfigurationPage-DjFJw56M.js → EditConfigurationPage-q76oeVU1.js} +5 -6
  14. package/dist/_chunks/{EditConfigurationPage-DjFJw56M.js.map → EditConfigurationPage-q76oeVU1.js.map} +1 -1
  15. package/dist/_chunks/{EditViewPage-zT3fBr4Y.js → EditViewPage-BXoY-ITh.js} +63 -13
  16. package/dist/_chunks/EditViewPage-BXoY-ITh.js.map +1 -0
  17. package/dist/_chunks/{EditViewPage-CPj61RMh.mjs → EditViewPage-COVXj9bh.mjs} +63 -12
  18. package/dist/_chunks/EditViewPage-COVXj9bh.mjs.map +1 -0
  19. package/dist/_chunks/{Field-dha5VnIQ.mjs → Field-CcppsFQR.mjs} +300 -203
  20. package/dist/_chunks/Field-CcppsFQR.mjs.map +1 -0
  21. package/dist/_chunks/{Field-Boxf9Ajp.js → Field-Dj1nOvt8.js} +303 -207
  22. package/dist/_chunks/Field-Dj1nOvt8.js.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-DHrru2AV.mjs → Form-DbWwH0-A.mjs} +37 -18
  26. package/dist/_chunks/Form-DbWwH0-A.mjs.map +1 -0
  27. package/dist/_chunks/{Form-y5g1SRsh.js → Form-aTchNxab.js} +39 -21
  28. package/dist/_chunks/Form-aTchNxab.js.map +1 -0
  29. package/dist/_chunks/{History-CqN6K7SX.js → History-Cs6XM6EU.js} +81 -114
  30. package/dist/_chunks/History-Cs6XM6EU.js.map +1 -0
  31. package/dist/_chunks/{History-Bru_KoeP.mjs → History-tU567_hc.mjs} +82 -114
  32. package/dist/_chunks/History-tU567_hc.mjs.map +1 -0
  33. package/dist/_chunks/{ListConfigurationPage-R_p-SbHZ.js → ListConfigurationPage-7LeytuFD.js} +25 -13
  34. package/dist/_chunks/ListConfigurationPage-7LeytuFD.js.map +1 -0
  35. package/dist/_chunks/{ListConfigurationPage-D8wGABj0.mjs → ListConfigurationPage-DQryo_4i.mjs} +25 -12
  36. package/dist/_chunks/ListConfigurationPage-DQryo_4i.mjs.map +1 -0
  37. package/dist/_chunks/{ListViewPage-SID6TRb9.mjs → ListViewPage-B50esy_x.mjs} +118 -77
  38. package/dist/_chunks/ListViewPage-B50esy_x.mjs.map +1 -0
  39. package/dist/_chunks/{ListViewPage-pEw_zug9.js → ListViewPage-CaGBu5H5.js} +121 -81
  40. package/dist/_chunks/ListViewPage-CaGBu5H5.js.map +1 -0
  41. package/dist/_chunks/{NoContentTypePage-C5dcQojD.js → NoContentTypePage-BaBE00IO.js} +2 -2
  42. package/dist/_chunks/{NoContentTypePage-C5dcQojD.js.map → NoContentTypePage-BaBE00IO.js.map} +1 -1
  43. package/dist/_chunks/{NoContentTypePage-CJ7UXwrQ.mjs → NoContentTypePage-CiPP8cLx.mjs} +2 -2
  44. package/dist/_chunks/{NoContentTypePage-CJ7UXwrQ.mjs.map → NoContentTypePage-CiPP8cLx.mjs.map} +1 -1
  45. package/dist/_chunks/{NoPermissionsPage-B7syEq5E.mjs → NoPermissionsPage-0-CW106p.mjs} +2 -2
  46. package/dist/_chunks/{NoPermissionsPage-B7syEq5E.mjs.map → NoPermissionsPage-0-CW106p.mjs.map} +1 -1
  47. package/dist/_chunks/{NoPermissionsPage-BtPrImPP.js → NoPermissionsPage-DQn5cqZz.js} +2 -2
  48. package/dist/_chunks/{NoPermissionsPage-BtPrImPP.js.map → NoPermissionsPage-DQn5cqZz.js.map} +1 -1
  49. package/dist/_chunks/Preview-C1dBkhXf.mjs +272 -0
  50. package/dist/_chunks/Preview-C1dBkhXf.mjs.map +1 -0
  51. package/dist/_chunks/Preview-DH1h7kJ6.js +290 -0
  52. package/dist/_chunks/Preview-DH1h7kJ6.js.map +1 -0
  53. package/dist/_chunks/{Relations-B9Crnhnn.mjs → Relations-Bvne4TvU.mjs} +76 -42
  54. package/dist/_chunks/Relations-Bvne4TvU.mjs.map +1 -0
  55. package/dist/_chunks/{Relations-DjTQ5kGB.js → Relations-CkECnBOd.js} +76 -43
  56. package/dist/_chunks/Relations-CkECnBOd.js.map +1 -0
  57. package/dist/_chunks/{en-fbKQxLGn.js → en-BK8Xyl5I.js} +32 -18
  58. package/dist/_chunks/{en-fbKQxLGn.js.map → en-BK8Xyl5I.js.map} +1 -1
  59. package/dist/_chunks/{en-Ux26r5pl.mjs → en-Dtk_ot79.mjs} +32 -18
  60. package/dist/_chunks/{en-Ux26r5pl.mjs.map → en-Dtk_ot79.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-DVPWZkbS.js → index-BN1pPa5v.js} +1135 -693
  71. package/dist/_chunks/index-BN1pPa5v.js.map +1 -0
  72. package/dist/_chunks/{index-DJXJw9V5.mjs → index-ByPZ754U.mjs} +1156 -714
  73. package/dist/_chunks/index-ByPZ754U.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-Bau7ZfLV.mjs → layout-CUTOYU8I.mjs} +26 -13
  79. package/dist/_chunks/layout-CUTOYU8I.mjs.map +1 -0
  80. package/dist/_chunks/{layout-Dm6fbiQj.js → layout-nBPDlXjr.js} +26 -14
  81. package/dist/_chunks/layout-nBPDlXjr.js.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-CKnpRgrN.js → relations-B6B-b7lI.js} +6 -7
  87. package/dist/_chunks/relations-B6B-b7lI.js.map +1 -0
  88. package/dist/_chunks/{relations-BH_kBSJ0.mjs → relations-CBc5HYHC.mjs} +6 -7
  89. package/dist/_chunks/relations-CBc5HYHC.mjs.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 +2 -1
  99. package/dist/admin/index.js.map +1 -1
  100. package/dist/admin/index.mjs +5 -4
  101. package/dist/admin/src/content-manager.d.ts +3 -2
  102. package/dist/admin/src/exports.d.ts +1 -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 +2 -2
  110. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
  111. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
  112. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  113. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
  114. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  115. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
  116. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
  117. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  118. package/dist/admin/src/preview/constants.d.ts +1 -0
  119. package/dist/admin/src/preview/index.d.ts +4 -0
  120. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  121. package/dist/admin/src/preview/routes.d.ts +3 -0
  122. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  123. package/dist/admin/src/router.d.ts +1 -1
  124. package/dist/admin/src/services/api.d.ts +1 -1
  125. package/dist/admin/src/services/components.d.ts +2 -2
  126. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  127. package/dist/admin/src/services/documents.d.ts +19 -20
  128. package/dist/admin/src/services/init.d.ts +1 -1
  129. package/dist/admin/src/services/relations.d.ts +2 -2
  130. package/dist/admin/src/services/uid.d.ts +3 -3
  131. package/dist/admin/src/utils/validation.d.ts +4 -1
  132. package/dist/server/index.js +615 -299
  133. package/dist/server/index.js.map +1 -1
  134. package/dist/server/index.mjs +615 -298
  135. package/dist/server/index.mjs.map +1 -1
  136. package/dist/server/src/bootstrap.d.ts.map +1 -1
  137. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  138. package/dist/server/src/controllers/index.d.ts.map +1 -1
  139. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  140. package/dist/server/src/controllers/uid.d.ts.map +1 -1
  141. package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
  142. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  143. package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
  144. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
  145. package/dist/server/src/history/services/history.d.ts.map +1 -1
  146. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  147. package/dist/server/src/history/services/utils.d.ts +4 -4
  148. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  149. package/dist/server/src/index.d.ts +4 -4
  150. package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
  151. package/dist/server/src/preview/constants.d.ts +2 -0
  152. package/dist/server/src/preview/constants.d.ts.map +1 -0
  153. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  154. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  155. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  156. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  157. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  158. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  159. package/dist/server/src/preview/index.d.ts +4 -0
  160. package/dist/server/src/preview/index.d.ts.map +1 -0
  161. package/dist/server/src/preview/routes/index.d.ts +8 -0
  162. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  163. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  164. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  165. package/dist/server/src/preview/services/index.d.ts +16 -0
  166. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  167. package/dist/server/src/preview/services/preview-config.d.ts +32 -0
  168. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  169. package/dist/server/src/preview/services/preview.d.ts +12 -0
  170. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  171. package/dist/server/src/preview/utils.d.ts +19 -0
  172. package/dist/server/src/preview/utils.d.ts.map +1 -0
  173. package/dist/server/src/register.d.ts.map +1 -1
  174. package/dist/server/src/routes/index.d.ts.map +1 -1
  175. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  176. package/dist/server/src/services/document-metadata.d.ts +8 -8
  177. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  178. package/dist/server/src/services/index.d.ts +4 -4
  179. package/dist/server/src/services/index.d.ts.map +1 -1
  180. package/dist/server/src/services/permission-checker.d.ts.map +1 -1
  181. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  182. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  183. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  184. package/dist/server/src/utils/index.d.ts +2 -0
  185. package/dist/server/src/utils/index.d.ts.map +1 -1
  186. package/dist/shared/contracts/collection-types.d.ts +3 -1
  187. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  188. package/dist/shared/contracts/index.d.ts +1 -0
  189. package/dist/shared/contracts/index.d.ts.map +1 -1
  190. package/dist/shared/contracts/preview.d.ts +27 -0
  191. package/dist/shared/contracts/preview.d.ts.map +1 -0
  192. package/dist/shared/index.js +4 -0
  193. package/dist/shared/index.js.map +1 -1
  194. package/dist/shared/index.mjs +4 -0
  195. package/dist/shared/index.mjs.map +1 -1
  196. package/package.json +15 -15
  197. package/dist/_chunks/EditViewPage-CPj61RMh.mjs.map +0 -1
  198. package/dist/_chunks/EditViewPage-zT3fBr4Y.js.map +0 -1
  199. package/dist/_chunks/Field-Boxf9Ajp.js.map +0 -1
  200. package/dist/_chunks/Field-dha5VnIQ.mjs.map +0 -1
  201. package/dist/_chunks/Form-DHrru2AV.mjs.map +0 -1
  202. package/dist/_chunks/Form-y5g1SRsh.js.map +0 -1
  203. package/dist/_chunks/History-Bru_KoeP.mjs.map +0 -1
  204. package/dist/_chunks/History-CqN6K7SX.js.map +0 -1
  205. package/dist/_chunks/ListConfigurationPage-D8wGABj0.mjs.map +0 -1
  206. package/dist/_chunks/ListConfigurationPage-R_p-SbHZ.js.map +0 -1
  207. package/dist/_chunks/ListViewPage-SID6TRb9.mjs.map +0 -1
  208. package/dist/_chunks/ListViewPage-pEw_zug9.js.map +0 -1
  209. package/dist/_chunks/Relations-B9Crnhnn.mjs.map +0 -1
  210. package/dist/_chunks/Relations-DjTQ5kGB.js.map +0 -1
  211. package/dist/_chunks/index-DJXJw9V5.mjs.map +0 -1
  212. package/dist/_chunks/index-DVPWZkbS.js.map +0 -1
  213. package/dist/_chunks/layout-Bau7ZfLV.mjs.map +0 -1
  214. package/dist/_chunks/layout-Dm6fbiQj.js.map +0 -1
  215. package/dist/_chunks/relations-BH_kBSJ0.mjs.map +0 -1
  216. package/dist/_chunks/relations-CKnpRgrN.js.map +0 -1
  217. package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
  218. package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
  219. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
  220. 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-ByPZ754U.mjs";
9
9
  import { generateNKeysBetween } from "fractional-indexing";
10
- import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-B9Crnhnn.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-Bvne4TvU.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 { 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";
@@ -508,7 +508,7 @@ const CodeEditor = (props) => {
508
508
  const codeBlocks = {
509
509
  code: {
510
510
  renderElement: (props) => /* @__PURE__ */ jsx(CodeEditor, { ...props }),
511
- icon: Code,
511
+ icon: CodeBlock$1,
512
512
  label: {
513
513
  id: "components.Blocks.blocks.code",
514
514
  defaultMessage: "Code block"
@@ -697,8 +697,7 @@ const ImageDialog = () => {
697
697
  const [isOpen, setIsOpen] = React.useState(true);
698
698
  const { editor } = useBlocksEditorContext("ImageDialog");
699
699
  const components = useStrapiApp("ImageDialog", (state) => state.components);
700
- if (!components || !isOpen)
701
- return null;
700
+ if (!components || !isOpen) return null;
702
701
  const MediaLibraryDialog = components["media-library"];
703
702
  const insertImages = (images) => {
704
703
  Transforms.unwrapNodes(editor, {
@@ -707,14 +706,12 @@ const ImageDialog = () => {
707
706
  });
708
707
  const nodeEntryBeingReplaced = Editor$1.above(editor, {
709
708
  match(node) {
710
- if (Editor$1.isEditor(node))
711
- return false;
709
+ if (Editor$1.isEditor(node)) return false;
712
710
  const isInlineNode = ["text", "link"].includes(node.type);
713
711
  return !isInlineNode;
714
712
  }
715
713
  });
716
- if (!nodeEntryBeingReplaced)
717
- return;
714
+ if (!nodeEntryBeingReplaced) return;
718
715
  const [, pathToInsert] = nodeEntryBeingReplaced;
719
716
  Transforms.removeNodes(editor);
720
717
  const nodesToInsert = images.map((image) => {
@@ -860,20 +857,8 @@ const LinkContent = React.forwardRef(
860
857
  const [linkText, setLinkText] = React.useState(elementText);
861
858
  const [linkUrl, setLinkUrl] = React.useState(link.url);
862
859
  const linkInputRef = React.useRef(null);
863
- const [showRemoveButton, setShowRemoveButton] = React.useState(false);
860
+ const isLastInsertedLink = editor.lastInsertedLinkPath ? !Path.equals(path, editor.lastInsertedLinkPath) : true;
864
861
  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
862
  const onLinkChange = (e) => {
878
863
  setIsSaveDisabled(false);
879
864
  setLinkUrl(e.target.value);
@@ -894,15 +879,32 @@ const LinkContent = React.forwardRef(
894
879
  editLink(editor, { url: linkUrl, text: linkText });
895
880
  setPopoverOpen(false);
896
881
  editor.lastInsertedLinkPath = null;
882
+ ReactEditor.focus(editor);
883
+ };
884
+ const handleClose = () => {
885
+ if (link.url === "") {
886
+ removeLink(editor);
887
+ }
888
+ setPopoverOpen(false);
889
+ ReactEditor.focus(editor);
897
890
  };
898
891
  React.useEffect(() => {
899
- if (popoverOpen)
900
- linkInputRef.current?.focus();
892
+ if (popoverOpen) linkInputRef.current?.focus();
901
893
  }, [popoverOpen]);
902
894
  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: [
895
+ return /* @__PURE__ */ jsxs(Popover.Root, { open: popoverOpen, children: [
896
+ /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
897
+ StyledBaseLink,
898
+ {
899
+ ...attributes,
900
+ ref: forwardedRef,
901
+ href: link.url,
902
+ onClick: () => setPopoverOpen(true),
903
+ color: "primary600",
904
+ children
905
+ }
906
+ ) }),
907
+ /* @__PURE__ */ jsx(Popover.Content, { onPointerDownOutside: handleClose, children: /* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 4, children: [
906
908
  /* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
907
909
  /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
908
910
  id: "components.Blocks.popover.text",
@@ -948,7 +950,7 @@ const LinkContent = React.forwardRef(
948
950
  {
949
951
  variant: "danger-light",
950
952
  onClick: () => removeLink(editor),
951
- $visible: showRemoveButton,
953
+ $visible: isLastInsertedLink,
952
954
  children: formatMessage({
953
955
  id: "components.Blocks.popover.remove",
954
956
  defaultMessage: "Remove"
@@ -956,11 +958,11 @@ const LinkContent = React.forwardRef(
956
958
  }
957
959
  ),
958
960
  /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
959
- /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: () => handleOpenChange(false), children: formatMessage({
961
+ /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
960
962
  id: "components.Blocks.popover.cancel",
961
963
  defaultMessage: "Cancel"
962
964
  }) }),
963
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: Boolean(inputNotDirty) || isSaveDisabled, children: formatMessage({
965
+ /* @__PURE__ */ jsx(Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
964
966
  id: "components.Blocks.popover.save",
965
967
  defaultMessage: "Save"
966
968
  }) })
@@ -1042,8 +1044,7 @@ const isText$1 = (node) => {
1042
1044
  return Node.isNode(node) && !Editor$1.isEditor(node) && node.type === "text";
1043
1045
  };
1044
1046
  const handleBackspaceKeyOnList = (editor, event) => {
1045
- if (!editor.selection)
1046
- return;
1047
+ if (!editor.selection) return;
1047
1048
  const [currentListItem, currentListItemPath] = Editor$1.parent(editor, editor.selection.anchor);
1048
1049
  const [currentList, currentListPath] = Editor$1.parent(editor, currentListItemPath);
1049
1050
  const isListEmpty = currentList.children.length === 1 && isText$1(currentListItem.children[0]) && currentListItem.children[0].text === "";
@@ -1152,8 +1153,7 @@ const handleEnterKeyOnList = (editor) => {
1152
1153
  };
1153
1154
  const handleConvertToList = (editor, format) => {
1154
1155
  const convertedPath = baseHandleConvert(editor, { type: "list-item" });
1155
- if (!convertedPath)
1156
- return;
1156
+ if (!convertedPath) return;
1157
1157
  Transforms.wrapNodes(editor, { type: "list", format, children: [] }, { at: convertedPath });
1158
1158
  };
1159
1159
  const handleTabOnList = (editor) => {
@@ -1165,8 +1165,7 @@ const handleTabOnList = (editor) => {
1165
1165
  }
1166
1166
  const [currentListItem, currentListItemPath] = currentListItemEntry;
1167
1167
  const [currentList] = Editor$1.parent(editor, currentListItemPath);
1168
- if (currentListItem === currentList.children[0])
1169
- return;
1168
+ if (currentListItem === currentList.children[0]) return;
1170
1169
  const currentListItemIndex = currentList.children.findIndex((item) => item === currentListItem);
1171
1170
  const previousNode = currentList.children[currentListItemIndex - 1];
1172
1171
  if (previousNode.type === "list") {
@@ -1401,7 +1400,7 @@ const ToolbarButton = ({
1401
1400
  width: 7,
1402
1401
  height: 7,
1403
1402
  hasRadius: true,
1404
- children: /* @__PURE__ */ jsx(Icon, { width: "1.2rem", height: "1.2rem", fill: disabled ? "neutral300" : enabledColor })
1403
+ children: /* @__PURE__ */ jsx(Icon, { fill: disabled ? "neutral300" : enabledColor })
1405
1404
  }
1406
1405
  )
1407
1406
  }
@@ -1533,8 +1532,7 @@ const isListNode = (node) => {
1533
1532
  const ListButton = ({ block, format }) => {
1534
1533
  const { editor, disabled, blocks } = useBlocksEditorContext("ListButton");
1535
1534
  const isListActive = () => {
1536
- if (!editor.selection)
1537
- return false;
1535
+ if (!editor.selection) return false;
1538
1536
  const currentListEntry = Editor$1.above(editor, {
1539
1537
  match: (node) => !Editor$1.isEditor(node) && node.type === "list",
1540
1538
  at: editor.selection.anchor
@@ -1546,6 +1544,26 @@ const ListButton = ({ block, format }) => {
1546
1544
  }
1547
1545
  return false;
1548
1546
  };
1547
+ const isListDisabled = () => {
1548
+ if (disabled) {
1549
+ return true;
1550
+ }
1551
+ if (!editor.selection) {
1552
+ return false;
1553
+ }
1554
+ const anchorNodeEntry = Editor$1.above(editor, {
1555
+ at: editor.selection.anchor,
1556
+ match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
1557
+ });
1558
+ const focusNodeEntry = Editor$1.above(editor, {
1559
+ at: editor.selection.focus,
1560
+ match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
1561
+ });
1562
+ if (!anchorNodeEntry || !focusNodeEntry) {
1563
+ return false;
1564
+ }
1565
+ return anchorNodeEntry[0] !== focusNodeEntry[0];
1566
+ };
1549
1567
  const toggleList = (format2) => {
1550
1568
  let currentListEntry;
1551
1569
  if (editor.selection) {
@@ -1579,7 +1597,7 @@ const ListButton = ({ block, format }) => {
1579
1597
  name: format,
1580
1598
  label: block.label,
1581
1599
  isActive: isListActive(),
1582
- disabled,
1600
+ disabled: isListDisabled(),
1583
1601
  handleClick: () => toggleList(format)
1584
1602
  }
1585
1603
  );
@@ -1588,8 +1606,7 @@ const LinkButton = ({ disabled }) => {
1588
1606
  const { editor } = useBlocksEditorContext("LinkButton");
1589
1607
  const isLinkActive = () => {
1590
1608
  const { selection } = editor;
1591
- if (!selection)
1592
- return false;
1609
+ if (!selection) return false;
1593
1610
  const [match] = Array.from(
1594
1611
  Editor$1.nodes(editor, {
1595
1612
  at: Editor$1.unhangRange(editor, selection),
@@ -1723,6 +1740,7 @@ const DragItem = styled(Flex)`
1723
1740
  }
1724
1741
  `;
1725
1742
  const DragIconButton = styled(IconButton)`
1743
+ user-select: none;
1726
1744
  display: flex;
1727
1745
  align-items: center;
1728
1746
  justify-content: center;
@@ -1746,7 +1764,7 @@ const DragIconButton = styled(IconButton)`
1746
1764
  }
1747
1765
  svg {
1748
1766
  height: auto;
1749
- width: ${({ theme }) => theme.spaces[3]};
1767
+ min-width: ${({ theme }) => theme.spaces[3]};
1750
1768
 
1751
1769
  path {
1752
1770
  fill: ${({ theme }) => theme.colors.neutral700};
@@ -1794,8 +1812,7 @@ const DragAndDropElement = ({
1794
1812
  displayedValue: children
1795
1813
  },
1796
1814
  onDropItem(currentIndex, newIndex) {
1797
- if (newIndex)
1798
- handleMoveBlock(newIndex, currentIndex);
1815
+ if (newIndex) handleMoveBlock(newIndex, currentIndex);
1799
1816
  }
1800
1817
  });
1801
1818
  const composedBoxRefs = useComposedRefs(blockRef, dropRef);
@@ -1851,6 +1868,7 @@ const DragAndDropElement = ({
1851
1868
  DragIconButton,
1852
1869
  {
1853
1870
  tag: "div",
1871
+ contentEditable: false,
1854
1872
  role: "button",
1855
1873
  tabIndex: 0,
1856
1874
  withTooltip: false,
@@ -1863,7 +1881,7 @@ const DragAndDropElement = ({
1863
1881
  disabled,
1864
1882
  draggable: true,
1865
1883
  $dragHandleTopMargin: dragHandleTopMargin,
1866
- children: /* @__PURE__ */ jsx(Drag, { color: "neutral600" })
1884
+ children: /* @__PURE__ */ jsx(Drag, { color: "primary500" })
1867
1885
  }
1868
1886
  ),
1869
1887
  children
@@ -1938,8 +1956,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
1938
1956
  [modifiers2]
1939
1957
  );
1940
1958
  const handleMoveBlocks = (editor2, event) => {
1941
- if (!editor2.selection)
1942
- return;
1959
+ if (!editor2.selection) return;
1943
1960
  const start = Range.start(editor2.selection);
1944
1961
  const currentIndex = [start.path[0]];
1945
1962
  let newIndexPosition = 0;
@@ -2076,8 +2093,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
2076
2093
  }
2077
2094
  };
2078
2095
  const handleScrollSelectionIntoView = () => {
2079
- if (!editor.selection)
2080
- return;
2096
+ if (!editor.selection) return;
2081
2097
  const domRange = ReactEditor.toDOMRange(editor, editor.selection);
2082
2098
  const domRect = domRange.getBoundingClientRect();
2083
2099
  const blocksInput = blocksRef.current;
@@ -2187,7 +2203,7 @@ const EditorLayout$1 = ({
2187
2203
  /* @__PURE__ */ jsx(
2188
2204
  CollapseIconButton,
2189
2205
  {
2190
- "aria-label": formatMessage({
2206
+ label: formatMessage({
2191
2207
  id: getTranslation("components.Blocks.collapse"),
2192
2208
  defaultMessage: "Collapse"
2193
2209
  }),
@@ -2271,8 +2287,7 @@ const InlineCode = styled.code`
2271
2287
  `;
2272
2288
  const baseCheckIsActive = (editor, name2) => {
2273
2289
  const marks = Editor$1.marks(editor);
2274
- if (!marks)
2275
- return false;
2290
+ if (!marks) return false;
2276
2291
  return Boolean(marks[name2]);
2277
2292
  };
2278
2293
  const baseHandleToggle = (editor, name2) => {
@@ -2526,7 +2541,7 @@ const BlocksEditor = React.forwardRef(
2526
2541
  !isExpandedMode && /* @__PURE__ */ jsx(
2527
2542
  ExpandIconButton,
2528
2543
  {
2529
- "aria-label": formatMessage({
2544
+ label: formatMessage({
2530
2545
  id: getTranslation("components.Blocks.expand"),
2531
2546
  defaultMessage: "Expand"
2532
2547
  }),
@@ -2592,47 +2607,44 @@ const createDefaultForm = (contentType, components = {}) => {
2592
2607
  const Initializer = ({ disabled, name: name2, onClick }) => {
2593
2608
  const { formatMessage } = useIntl();
2594
2609
  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
- ] });
2610
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
2611
+ Box,
2612
+ {
2613
+ tag: "button",
2614
+ background: disabled ? "neutral150" : "neutral100",
2615
+ borderColor: field.error ? "danger600" : "neutral200",
2616
+ hasRadius: true,
2617
+ disabled,
2618
+ onClick,
2619
+ paddingTop: 9,
2620
+ paddingBottom: 9,
2621
+ type: "button",
2622
+ style: { cursor: disabled ? "not-allowed" : "pointer" },
2623
+ children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
2624
+ /* @__PURE__ */ jsx(Flex, { justifyContent: "center", color: disabled ? "neutral500" : "primary600", children: /* @__PURE__ */ jsx(PlusCircle, { width: "3.2rem", height: "3.2rem" }) }),
2625
+ /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(
2626
+ Typography,
2627
+ {
2628
+ textColor: disabled ? "neutral600" : "primary600",
2629
+ variant: "pi",
2630
+ fontWeight: "bold",
2631
+ children: formatMessage({
2632
+ id: getTranslation("components.empty-repeatable"),
2633
+ defaultMessage: "No entry yet. Click to add one."
2634
+ })
2635
+ }
2636
+ ) })
2637
+ ] })
2638
+ }
2639
+ ) });
2619
2640
  };
2620
- const CircleIcon = styled(PlusCircle)`
2621
- width: 2.4rem;
2622
- height: 2.4rem;
2623
- > circle {
2624
- fill: ${({ theme }) => theme.colors.primary200};
2625
- }
2626
- > path {
2627
- fill: ${({ theme }) => theme.colors.primary600};
2628
- }
2629
- `;
2630
2641
  const NonRepeatableComponent = ({
2631
2642
  attribute,
2632
2643
  name: name2,
2633
2644
  children,
2634
2645
  layout
2635
2646
  }) => {
2647
+ const { formatMessage } = useIntl();
2636
2648
  const { value } = useField(name2);
2637
2649
  const level = useComponent("NonRepeatableComponent", (state) => state.level);
2638
2650
  const isNested = level > 0;
@@ -2649,7 +2661,22 @@ const NonRepeatableComponent = ({
2649
2661
  children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index) => {
2650
2662
  return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
2651
2663
  const completeFieldName = `${name2}.${field.name}`;
2652
- return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2664
+ const translatedLabel = formatMessage({
2665
+ id: `content-manager.components.${attribute.component}.${field.name}`,
2666
+ defaultMessage: field.label
2667
+ });
2668
+ return /* @__PURE__ */ jsx(
2669
+ Grid$1.Item,
2670
+ {
2671
+ col: size,
2672
+ s: 12,
2673
+ xs: 12,
2674
+ direction: "column",
2675
+ alignItems: "stretch",
2676
+ children: children({ ...field, label: translatedLabel, name: completeFieldName })
2677
+ },
2678
+ completeFieldName
2679
+ );
2653
2680
  }) }, index);
2654
2681
  }) })
2655
2682
  }
@@ -2668,13 +2695,34 @@ const RepeatableComponent = ({
2668
2695
  const { search: searchString } = useLocation();
2669
2696
  const search = React.useMemo(() => new URLSearchParams(searchString), [searchString]);
2670
2697
  const { components } = useDoc();
2671
- const { value = [], error } = useField(name2);
2698
+ const {
2699
+ value = [],
2700
+ error,
2701
+ rawError
2702
+ } = useField(name2);
2672
2703
  const addFieldRow = useForm("RepeatableComponent", (state) => state.addFieldRow);
2673
2704
  const moveFieldRow = useForm("RepeatableComponent", (state) => state.moveFieldRow);
2674
2705
  const removeFieldRow = useForm("RepeatableComponent", (state) => state.removeFieldRow);
2675
2706
  const { max = Infinity } = attribute;
2676
2707
  const [collapseToOpen, setCollapseToOpen] = React.useState("");
2677
2708
  const [liveText, setLiveText] = React.useState("");
2709
+ React.useEffect(() => {
2710
+ const hasNestedErrors = rawError && Array.isArray(rawError) && rawError.length > 0;
2711
+ const hasNestedValue = value && Array.isArray(value) && value.length > 0;
2712
+ if (hasNestedErrors && hasNestedValue) {
2713
+ const errorOpenItems = rawError.map((_, idx) => {
2714
+ return value[idx] ? value[idx].__temp_key__ : null;
2715
+ }).filter((value2) => !!value2);
2716
+ if (errorOpenItems && errorOpenItems.length > 0) {
2717
+ setCollapseToOpen((collapseToOpen2) => {
2718
+ if (!errorOpenItems.includes(collapseToOpen2)) {
2719
+ return errorOpenItems[0];
2720
+ }
2721
+ return collapseToOpen2;
2722
+ });
2723
+ }
2724
+ }
2725
+ }, [rawError, value]);
2678
2726
  const componentTmpKeyWithFocussedField = React.useMemo(() => {
2679
2727
  if (search.has("field")) {
2680
2728
  const fieldParam = search.get("field");
@@ -2827,7 +2875,26 @@ const RepeatableComponent = ({
2827
2875
  children: layout.map((row, index2) => {
2828
2876
  return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
2829
2877
  const completeFieldName = `${nameWithIndex}.${field.name}`;
2830
- return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2878
+ const translatedLabel = formatMessage({
2879
+ id: `content-manager.components.${attribute.component}.${field.name}`,
2880
+ defaultMessage: field.label
2881
+ });
2882
+ return /* @__PURE__ */ jsx(
2883
+ Grid$1.Item,
2884
+ {
2885
+ col: size,
2886
+ s: 12,
2887
+ xs: 12,
2888
+ direction: "column",
2889
+ alignItems: "stretch",
2890
+ children: children({
2891
+ ...field,
2892
+ label: translatedLabel,
2893
+ name: completeFieldName
2894
+ })
2895
+ },
2896
+ completeFieldName
2897
+ );
2831
2898
  }) }, index2);
2832
2899
  })
2833
2900
  }
@@ -2922,7 +2989,7 @@ const Component = ({
2922
2989
  /* @__PURE__ */ jsx(
2923
2990
  IconButton,
2924
2991
  {
2925
- borderWidth: 0,
2992
+ variant: "ghost",
2926
2993
  onClick: onDeleteComponent,
2927
2994
  label: formatMessage({
2928
2995
  id: getTranslation("containers.Edit.delete"),
@@ -2935,7 +3002,7 @@ const Component = ({
2935
3002
  IconButton,
2936
3003
  {
2937
3004
  ref: composedAccordionRefs,
2938
- borderWidth: 0,
3005
+ variant: "ghost",
2939
3006
  onClick: (e) => e.stopPropagation(),
2940
3007
  "data-handler-id": handlerId,
2941
3008
  label: formatMessage({
@@ -3005,7 +3072,7 @@ const ComponentInput = ({
3005
3072
  id: getTranslation("components.reset-entry"),
3006
3073
  defaultMessage: "Reset Entry"
3007
3074
  }),
3008
- borderWidth: 0,
3075
+ variant: "ghost",
3009
3076
  onClick: () => {
3010
3077
  field.onChange(name2, null);
3011
3078
  },
@@ -3034,11 +3101,8 @@ const AddComponentButton = ({
3034
3101
  onClick,
3035
3102
  disabled: isDisabled,
3036
3103
  background: "neutral0",
3037
- paddingTop: 3,
3038
- paddingBottom: 3,
3039
- paddingLeft: 4,
3040
- paddingRight: 4,
3041
3104
  style: { cursor: isDisabled ? "not-allowed" : "pointer" },
3105
+ variant: "tertiary",
3042
3106
  children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
3043
3107
  /* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
3044
3108
  /* @__PURE__ */ jsx(
@@ -3067,10 +3131,11 @@ const StyledAddIcon = styled(PlusCircle)`
3067
3131
  }
3068
3132
  `;
3069
3133
  const AddComponentTitle = styled(Typography)``;
3070
- const StyledButton = styled(BaseButton)`
3134
+ const StyledButton = styled(Button)`
3071
3135
  border-radius: 26px;
3072
3136
  border-color: ${({ theme }) => theme.colors.neutral150};
3073
3137
  box-shadow: ${({ theme }) => theme.shadows.filterShadow};
3138
+ height: 5rem;
3074
3139
 
3075
3140
  &:hover {
3076
3141
  ${AddComponentTitle} {
@@ -3082,7 +3147,7 @@ const StyledButton = styled(BaseButton)`
3082
3147
  fill: ${({ theme }) => theme.colors.primary600};
3083
3148
  }
3084
3149
  > path {
3085
- fill: ${({ theme }) => theme.colors.neutral100};
3150
+ fill: ${({ theme }) => theme.colors.primary600};
3086
3151
  }
3087
3152
  }
3088
3153
  }
@@ -3213,18 +3278,6 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
3213
3278
  /* @__PURE__ */ jsx(Field.Hint, {})
3214
3279
  ] });
3215
3280
  };
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
3281
  const uidApi = contentManagerApi.injectEndpoints({
3229
3282
  endpoints: (builder) => ({
3230
3283
  getDefaultUID: builder.query({
@@ -3259,7 +3312,10 @@ const uidApi = contentManagerApi.injectEndpoints({
3259
3312
  config: {
3260
3313
  params
3261
3314
  }
3262
- })
3315
+ }),
3316
+ providesTags: (_res, _error, params) => [
3317
+ { type: "UidAvailability", id: params.contentTypeUID }
3318
+ ]
3263
3319
  })
3264
3320
  })
3265
3321
  });
@@ -3271,8 +3327,10 @@ const UIDInput = React.forwardRef(
3271
3327
  const allFormValues = useForm("InputUID", (form) => form.values);
3272
3328
  const [availability, setAvailability] = React.useState();
3273
3329
  const [showRegenerate, setShowRegenerate] = React.useState(false);
3330
+ const isCloning = useMatch(CLONE_PATH) !== null;
3274
3331
  const field = useField(name2);
3275
3332
  const debouncedValue = useDebounce(field.value, 300);
3333
+ const hasChanged = debouncedValue !== field.initialValue;
3276
3334
  const { toggleNotification } = useNotification();
3277
3335
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
3278
3336
  const { formatMessage } = useIntl();
@@ -3348,8 +3406,9 @@ const UIDInput = React.forwardRef(
3348
3406
  params
3349
3407
  },
3350
3408
  {
3409
+ // Don't check availability if the value is empty or wasn't changed
3351
3410
  skip: !Boolean(
3352
- debouncedValue !== field.initialValue && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3411
+ (hasChanged || isCloning) && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3353
3412
  )
3354
3413
  }
3355
3414
  );
@@ -3378,6 +3437,7 @@ const UIDInput = React.forwardRef(
3378
3437
  const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
3379
3438
  const fieldRef = useFocusInputField(name2);
3380
3439
  const composedRefs = useComposedRefs(ref, fieldRef);
3440
+ const shouldShowAvailability = (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;
3381
3441
  return /* @__PURE__ */ jsxs(Field.Root, { hint, name: name2, error: field.error, required, children: [
3382
3442
  /* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
3383
3443
  /* @__PURE__ */ jsx(
@@ -3386,7 +3446,7 @@ const UIDInput = React.forwardRef(
3386
3446
  ref: composedRefs,
3387
3447
  disabled: props.disabled,
3388
3448
  endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
3389
- availability && !showRegenerate && /* @__PURE__ */ jsxs(
3449
+ shouldShowAvailability && /* @__PURE__ */ jsxs(
3390
3450
  TextValidation,
3391
3451
  {
3392
3452
  alignItems: "center",
@@ -3675,8 +3735,7 @@ const Wrapper = styled.div`
3675
3735
  `;
3676
3736
  var listRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/, emptyListRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/, unorderedListRE = /[*+-]\s/;
3677
3737
  function newlineAndIndentContinueMarkdownList(cm) {
3678
- if (cm.getOption("disableInput"))
3679
- return CodeMirror.Pass;
3738
+ if (cm.getOption("disableInput")) return CodeMirror.Pass;
3680
3739
  var ranges = cm.listSelections(), replacements = [];
3681
3740
  for (var i = 0; i < ranges.length; i++) {
3682
3741
  var pos = ranges[i].head;
@@ -3710,8 +3769,7 @@ function newlineAndIndentContinueMarkdownList(cm) {
3710
3769
  var numbered = !(unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0);
3711
3770
  var bullet = numbered ? parseInt(match[3], 10) + 1 + match[4] : match[2].replace("x", " ");
3712
3771
  replacements[i] = "\n" + indent + bullet + after;
3713
- if (numbered)
3714
- incrementRemainingMarkdownListNumbers(cm, pos);
3772
+ if (numbered) incrementRemainingMarkdownListNumbers(cm, pos);
3715
3773
  }
3716
3774
  }
3717
3775
  cm.replaceSelections(replacements);
@@ -3729,10 +3787,8 @@ function incrementRemainingMarkdownListNumbers(cm, pos) {
3729
3787
  var newNumber = parseInt(startItem[3], 10) + lookAhead - skipCount;
3730
3788
  var nextNumber = parseInt(nextItem[3], 10), itemNumber = nextNumber;
3731
3789
  if (startIndent === nextIndent && !isNaN(nextNumber)) {
3732
- if (newNumber === nextNumber)
3733
- itemNumber = nextNumber + 1;
3734
- if (newNumber > nextNumber)
3735
- itemNumber = newNumber + 1;
3790
+ if (newNumber === nextNumber) itemNumber = nextNumber + 1;
3791
+ if (newNumber > nextNumber) itemNumber = newNumber + 1;
3736
3792
  cm.replaceRange(
3737
3793
  nextLine.replace(listRE, nextIndent + itemNumber + nextItem[4] + nextItem[5]),
3738
3794
  {
@@ -3745,10 +3801,8 @@ function incrementRemainingMarkdownListNumbers(cm, pos) {
3745
3801
  }
3746
3802
  );
3747
3803
  } else {
3748
- if (startIndent.length > nextIndent.length)
3749
- return;
3750
- if (startIndent.length < nextIndent.length && lookAhead === 1)
3751
- return;
3804
+ if (startIndent.length > nextIndent.length) return;
3805
+ if (startIndent.length < nextIndent.length && lookAhead === 1) return;
3752
3806
  skipCount += 1;
3753
3807
  }
3754
3808
  }
@@ -4220,7 +4274,7 @@ const EditorLayout = ({
4220
4274
  justifyContent: "flex-end",
4221
4275
  shrink: 0,
4222
4276
  width: "100%",
4223
- children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, children: [
4277
+ children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, variant: "tertiary", size: "M", children: [
4224
4278
  /* @__PURE__ */ jsx(Typography, { children: formatMessage({
4225
4279
  id: "components.Wysiwyg.collapse",
4226
4280
  defaultMessage: "Collapse"
@@ -4238,12 +4292,14 @@ const EditorLayout = ({
4238
4292
  ) }) });
4239
4293
  }
4240
4294
  return /* @__PURE__ */ jsx(
4241
- Box,
4295
+ Flex,
4242
4296
  {
4243
4297
  borderColor: error ? "danger600" : "neutral200",
4244
4298
  borderStyle: "solid",
4245
4299
  borderWidth: "1px",
4246
4300
  hasRadius: true,
4301
+ direction: "column",
4302
+ alignItems: "stretch",
4247
4303
  children
4248
4304
  }
4249
4305
  );
@@ -4254,11 +4310,19 @@ const ExpandWrapper = styled(Flex)`
4254
4310
  const BoxWithBorder = styled(Box)`
4255
4311
  border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
4256
4312
  `;
4257
- const ExpandButton$1 = styled(BaseButton)`
4313
+ const ExpandButton$1 = styled(Button)`
4258
4314
  background-color: transparent;
4259
4315
  border: none;
4260
4316
  align-items: center;
4261
4317
 
4318
+ & > span {
4319
+ display: flex;
4320
+ justify-content: space-between;
4321
+ align-items: center;
4322
+ width: 100%;
4323
+ font-weight: ${({ theme }) => theme.fontWeights.regular};
4324
+ }
4325
+
4262
4326
  svg {
4263
4327
  margin-left: ${({ theme }) => `${theme.spaces[2]}`};
4264
4328
 
@@ -4525,40 +4589,28 @@ const quoteAndCodeHandler = (editor, markdownType) => {
4525
4589
  insertWithoutTextToEdit(editor, markdownType, line, contentLength);
4526
4590
  }
4527
4591
  };
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
4592
  const MainButtons = styled(IconButtonGroup)`
4543
4593
  margin-left: ${({ theme }) => theme.spaces[4]};
4544
4594
  `;
4545
4595
  const MoreButton = styled(IconButton)`
4546
4596
  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
4597
  `;
4554
4598
  const IconButtonGroupMargin = styled(IconButtonGroup)`
4555
4599
  margin-right: ${({ theme }) => `${theme.spaces[2]}`};
4556
4600
  `;
4557
- const ExpandButton = styled(BaseButton)`
4601
+ const ExpandButton = styled(Button)`
4558
4602
  background-color: transparent;
4559
4603
  border: none;
4560
4604
  align-items: center;
4561
4605
 
4606
+ & > span {
4607
+ display: flex;
4608
+ justify-content: space-between;
4609
+ align-items: center;
4610
+ width: 100%;
4611
+ font-weight: ${({ theme }) => theme.fontWeights.regular};
4612
+ }
4613
+
4562
4614
  svg {
4563
4615
  margin-left: ${({ theme }) => `${theme.spaces[2]}`};
4564
4616
  path {
@@ -4570,8 +4622,8 @@ const ExpandButton = styled(BaseButton)`
4570
4622
  `;
4571
4623
  const WysiwygFooter = ({ onToggleExpand }) => {
4572
4624
  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({
4625
+ 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: [
4626
+ /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
4575
4627
  id: "components.WysiwygBottomControls.fullscreen",
4576
4628
  defaultMessage: "Expand"
4577
4629
  }) }),
@@ -4607,18 +4659,27 @@ const WysiwygNav = ({
4607
4659
  borderRadius: `0.4rem 0.4rem 0 0`,
4608
4660
  children: [
4609
4661
  /* @__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
- ] }) }),
4662
+ /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
4663
+ SingleSelect,
4664
+ {
4665
+ disabled: true,
4666
+ placeholder: selectPlaceholder,
4667
+ "aria-label": selectPlaceholder,
4668
+ size: "S",
4669
+ children: [
4670
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
4671
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
4672
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h3", children: "h3" }),
4673
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h4", children: "h4" }),
4674
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h5", children: "h5" }),
4675
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
4676
+ ]
4677
+ }
4678
+ ) }),
4618
4679
  /* @__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, {}) })
4680
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
4681
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
4682
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
4622
4683
  ] }),
4623
4684
  /* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsx(More, {}) })
4624
4685
  ] }),
@@ -4645,6 +4706,7 @@ const WysiwygNav = ({
4645
4706
  placeholder: selectPlaceholder,
4646
4707
  "aria-label": selectPlaceholder,
4647
4708
  onChange: (value) => onActionClick(value, editorRef),
4709
+ size: "S",
4648
4710
  children: [
4649
4711
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
4650
4712
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
@@ -4656,17 +4718,9 @@ const WysiwygNav = ({
4656
4718
  }
4657
4719
  ) }),
4658
4720
  /* @__PURE__ */ jsxs(MainButtons, { children: [
4721
+ /* @__PURE__ */ jsx(IconButton, { onClick: () => onActionClick("Bold", editorRef), label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
4659
4722
  /* @__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,
4723
+ IconButton,
4670
4724
  {
4671
4725
  onClick: () => onActionClick("Italic", editorRef),
4672
4726
  label: "Italic",
@@ -4675,7 +4729,7 @@ const WysiwygNav = ({
4675
4729
  }
4676
4730
  ),
4677
4731
  /* @__PURE__ */ jsx(
4678
- CustomIconButton,
4732
+ IconButton,
4679
4733
  {
4680
4734
  onClick: () => onActionClick("Underline", editorRef),
4681
4735
  label: "Underline",
@@ -4689,7 +4743,7 @@ const WysiwygNav = ({
4689
4743
  /* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
4690
4744
  /* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
4691
4745
  /* @__PURE__ */ jsx(
4692
- CustomIconButton,
4746
+ IconButton,
4693
4747
  {
4694
4748
  onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
4695
4749
  label: "Strikethrough",
@@ -4698,7 +4752,7 @@ const WysiwygNav = ({
4698
4752
  }
4699
4753
  ),
4700
4754
  /* @__PURE__ */ jsx(
4701
- CustomIconButton,
4755
+ IconButton,
4702
4756
  {
4703
4757
  onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
4704
4758
  label: "BulletList",
@@ -4707,7 +4761,7 @@ const WysiwygNav = ({
4707
4761
  }
4708
4762
  ),
4709
4763
  /* @__PURE__ */ jsx(
4710
- CustomIconButton,
4764
+ IconButton,
4711
4765
  {
4712
4766
  onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
4713
4767
  label: "NumberList",
@@ -4718,7 +4772,7 @@ const WysiwygNav = ({
4718
4772
  ] }),
4719
4773
  /* @__PURE__ */ jsxs(IconButtonGroup, { children: [
4720
4774
  /* @__PURE__ */ jsx(
4721
- CustomIconButton,
4775
+ IconButton,
4722
4776
  {
4723
4777
  onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
4724
4778
  label: "Code",
@@ -4727,7 +4781,7 @@ const WysiwygNav = ({
4727
4781
  }
4728
4782
  ),
4729
4783
  /* @__PURE__ */ jsx(
4730
- CustomIconButton,
4784
+ IconButton,
4731
4785
  {
4732
4786
  onClick: () => {
4733
4787
  handleTogglePopover();
@@ -4739,7 +4793,7 @@ const WysiwygNav = ({
4739
4793
  }
4740
4794
  ),
4741
4795
  /* @__PURE__ */ jsx(
4742
- CustomLinkIconButton,
4796
+ IconButton,
4743
4797
  {
4744
4798
  onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
4745
4799
  label: "Link",
@@ -4748,7 +4802,7 @@ const WysiwygNav = ({
4748
4802
  }
4749
4803
  ),
4750
4804
  /* @__PURE__ */ jsx(
4751
- CustomIconButton,
4805
+ IconButton,
4752
4806
  {
4753
4807
  onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
4754
4808
  label: "Quote",
@@ -4885,15 +4939,19 @@ const Wysiwyg = React.forwardRef(
4885
4939
  );
4886
4940
  const MemoizedWysiwyg = React.memo(Wysiwyg);
4887
4941
  const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4888
- const { id } = useDoc();
4942
+ const { id, document: document2, collectionType } = useDoc();
4889
4943
  const isFormDisabled = useForm("InputRenderer", (state) => state.disabled);
4890
4944
  const isInDynamicZone = useDynamicZone("isInDynamicZone", (state) => state.isInDynamicZone);
4891
4945
  const canCreateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canCreateFields);
4892
4946
  const canReadFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canReadFields);
4893
4947
  const canUpdateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUpdateFields);
4894
4948
  const canUserAction = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUserAction);
4895
- const editableFields = id ? canUpdateFields : canCreateFields;
4896
- const readableFields = id ? canReadFields : canCreateFields;
4949
+ let idToCheck = id;
4950
+ if (collectionType === SINGLE_TYPES) {
4951
+ idToCheck = document2?.documentId;
4952
+ }
4953
+ const editableFields = idToCheck ? canUpdateFields : canCreateFields;
4954
+ const readableFields = idToCheck ? canReadFields : canCreateFields;
4897
4955
  const canUserReadField = canUserAction(props.name, readableFields, props.type);
4898
4956
  const canUserEditField = canUserAction(props.name, editableFields, props.type);
4899
4957
  const fields = useStrapiApp("InputRenderer", (app) => app.fields);
@@ -4904,6 +4962,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4904
4962
  const {
4905
4963
  edit: { components }
4906
4964
  } = useDocLayout();
4965
+ const field = useField(props.name);
4907
4966
  if (!visible) {
4908
4967
  return null;
4909
4968
  }
@@ -4914,7 +4973,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4914
4973
  if (attributeHasCustomFieldProperty(props.attribute)) {
4915
4974
  const CustomInput = lazyComponentStore[props.attribute.customField];
4916
4975
  if (CustomInput) {
4917
- return /* @__PURE__ */ jsx(CustomInput, { ...props, hint, disabled: fieldIsDisabled });
4976
+ return /* @__PURE__ */ jsx(CustomInput, { ...props, ...field, hint, disabled: fieldIsDisabled });
4918
4977
  }
4919
4978
  return /* @__PURE__ */ jsx(
4920
4979
  InputRenderer$1,
@@ -4984,7 +5043,9 @@ const useFieldHint = (hint = void 0, attribute) => {
4984
5043
  if (!maximum && !minimum) {
4985
5044
  return hint;
4986
5045
  }
4987
- const units = !["biginteger", "integer", "number"].includes(attribute.type) ? formatMessage(
5046
+ const units = !["biginteger", "integer", "number", "dynamiczone", "component"].includes(
5047
+ attribute.type
5048
+ ) ? formatMessage(
4988
5049
  {
4989
5050
  id: "content-manager.form.Input.hint.character.unit",
4990
5051
  defaultMessage: "{maxValue, plural, one { character} other { characters}}"
@@ -5073,12 +5134,20 @@ const DynamicComponent = ({
5073
5134
  React.useEffect(() => {
5074
5135
  dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
5075
5136
  }, [dragPreviewRef, index]);
5137
+ const accordionValue = React.useId();
5138
+ const { value = [], rawError } = useField(`${name2}.${index}`);
5139
+ const [collapseToOpen, setCollapseToOpen] = React.useState("");
5140
+ React.useEffect(() => {
5141
+ if (rawError && value) {
5142
+ setCollapseToOpen(accordionValue);
5143
+ }
5144
+ }, [rawError, value, accordionValue]);
5076
5145
  const composedBoxRefs = useComposedRefs(boxRef, dropRef);
5077
5146
  const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
5078
5147
  /* @__PURE__ */ jsx(
5079
5148
  IconButton,
5080
5149
  {
5081
- borderWidth: 0,
5150
+ variant: "ghost",
5082
5151
  label: formatMessage(
5083
5152
  {
5084
5153
  id: getTranslation("components.DynamicZone.delete-label"),
@@ -5093,7 +5162,7 @@ const DynamicComponent = ({
5093
5162
  /* @__PURE__ */ jsx(
5094
5163
  IconButton,
5095
5164
  {
5096
- borderWidth: 0,
5165
+ variant: "ghost",
5097
5166
  onClick: (e) => e.stopPropagation(),
5098
5167
  "data-handler-id": handlerId,
5099
5168
  ref: dragRef,
@@ -5138,10 +5207,9 @@ const DynamicComponent = ({
5138
5207
  ] })
5139
5208
  ] });
5140
5209
  const accordionTitle = title ? `${displayName} ${title}` : displayName;
5141
- const accordionValue = React.useId();
5142
5210
  return /* @__PURE__ */ jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
5143
5211
  /* @__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: [
5212
+ /* @__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
5213
  /* @__PURE__ */ jsxs(Accordion.Header, { children: [
5146
5214
  /* @__PURE__ */ jsx(
5147
5215
  Accordion.Trigger,
@@ -5152,10 +5220,39 @@ const DynamicComponent = ({
5152
5220
  ),
5153
5221
  /* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
5154
5222
  ] }),
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)) }) }) })
5223
+ /* @__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(
5224
+ Grid$1.Item,
5225
+ {
5226
+ col: 12,
5227
+ s: 12,
5228
+ xs: 12,
5229
+ direction: "column",
5230
+ alignItems: "stretch",
5231
+ children: /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
5232
+ const fieldName = `${name2}.${index}.${field.name}`;
5233
+ const fieldWithTranslatedLabel = {
5234
+ ...field,
5235
+ label: formatMessage({
5236
+ id: `content-manager.components.${componentUid}.${field.name}`,
5237
+ defaultMessage: field.label
5238
+ })
5239
+ };
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, { ...fieldWithTranslatedLabel, 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-CcppsFQR.mjs.map