@strapi/content-manager 0.0.0-experimental.e60ec1829240dae21c1e1d29076681c322288813 → 0.0.0-experimental.e8d8fc824d0f6a695b2a9ebaa4680ed21c3645ca

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 (257) hide show
  1. package/LICENSE +18 -3
  2. package/dist/_chunks/{CardDragPreview-DSVYodBX.js → CardDragPreview-C0QyJgRA.js} +10 -14
  3. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -0
  4. package/dist/_chunks/{CardDragPreview-ikSG4M46.mjs → CardDragPreview-DOxamsuj.mjs} +7 -9
  5. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -0
  6. package/dist/_chunks/{ComponentConfigurationPage-DjWJdz6Y.js → ComponentConfigurationPage-BlzvDpbX.js} +5 -6
  7. package/dist/_chunks/{ComponentConfigurationPage-DjWJdz6Y.js.map → ComponentConfigurationPage-BlzvDpbX.js.map} +1 -1
  8. package/dist/_chunks/{ComponentConfigurationPage-BPvzFjM7.mjs → ComponentConfigurationPage-DaPOlQaD.mjs} +4 -4
  9. package/dist/_chunks/{ComponentConfigurationPage-BPvzFjM7.mjs.map → ComponentConfigurationPage-DaPOlQaD.mjs.map} +1 -1
  10. package/dist/_chunks/{ComponentIcon-BBQsYCVn.js → ComponentIcon-CRbtQEUV.js} +9 -4
  11. package/dist/_chunks/ComponentIcon-CRbtQEUV.js.map +1 -0
  12. package/dist/_chunks/{ComponentIcon-BOFnK76n.mjs → ComponentIcon-u4bIXTFY.mjs} +9 -3
  13. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -0
  14. package/dist/_chunks/{EditConfigurationPage-DacbqQ_f.mjs → EditConfigurationPage-BZPXItXo.mjs} +4 -4
  15. package/dist/_chunks/{EditConfigurationPage-DacbqQ_f.mjs.map → EditConfigurationPage-BZPXItXo.mjs.map} +1 -1
  16. package/dist/_chunks/{EditConfigurationPage-Dmv83RlS.js → EditConfigurationPage-uy-v43AR.js} +5 -6
  17. package/dist/_chunks/{EditConfigurationPage-Dmv83RlS.js.map → EditConfigurationPage-uy-v43AR.js.map} +1 -1
  18. package/dist/_chunks/{EditViewPage-DvNpQkam.js → EditViewPage-DT6A4ayX.js} +102 -54
  19. package/dist/_chunks/EditViewPage-DT6A4ayX.js.map +1 -0
  20. package/dist/_chunks/EditViewPage-oOLeTySr.mjs +254 -0
  21. package/dist/_chunks/EditViewPage-oOLeTySr.mjs.map +1 -0
  22. package/dist/_chunks/{Field-6gvGdPBV.mjs → Field-D7dv2aUX.mjs} +1192 -896
  23. package/dist/_chunks/Field-D7dv2aUX.mjs.map +1 -0
  24. package/dist/_chunks/{Field-DmVKIAOo.js → Field-kYFVIGiP.js} +1238 -943
  25. package/dist/_chunks/Field-kYFVIGiP.js.map +1 -0
  26. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
  27. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
  28. package/dist/_chunks/{Form-DW6K1IH-.mjs → Form-BxR6sc29.mjs} +67 -46
  29. package/dist/_chunks/Form-BxR6sc29.mjs.map +1 -0
  30. package/dist/_chunks/{Form-CPZC9vWa.js → Form-CCijSg3V.js} +68 -49
  31. package/dist/_chunks/Form-CCijSg3V.js.map +1 -0
  32. package/dist/_chunks/{History-DeAPlvtv.js → History-BMndx49M.js} +182 -147
  33. package/dist/_chunks/History-BMndx49M.js.map +1 -0
  34. package/dist/_chunks/{History-Dmr9fmUA.mjs → History-D8F7aYQU.mjs} +181 -144
  35. package/dist/_chunks/History-D8F7aYQU.mjs.map +1 -0
  36. package/dist/_chunks/{ListConfigurationPage-DPCwW5Vr.js → ListConfigurationPage-DouY1EWM.js} +72 -63
  37. package/dist/_chunks/ListConfigurationPage-DouY1EWM.js.map +1 -0
  38. package/dist/_chunks/{ListConfigurationPage-DhwvYcNv.mjs → ListConfigurationPage-DqAdSPwC.mjs} +68 -57
  39. package/dist/_chunks/ListConfigurationPage-DqAdSPwC.mjs.map +1 -0
  40. package/dist/_chunks/{ListViewPage-5ySZ-VUs.js → ListViewPage-BPVmh9pq.js} +179 -164
  41. package/dist/_chunks/ListViewPage-BPVmh9pq.js.map +1 -0
  42. package/dist/_chunks/{ListViewPage-BtAwuYLE.mjs → ListViewPage-C73F0jPh.mjs} +175 -159
  43. package/dist/_chunks/ListViewPage-C73F0jPh.mjs.map +1 -0
  44. package/dist/_chunks/{NoContentTypePage-DSPxnxxp.mjs → NoContentTypePage-B5w7iJOF.mjs} +3 -3
  45. package/dist/_chunks/NoContentTypePage-B5w7iJOF.mjs.map +1 -0
  46. package/dist/_chunks/{NoContentTypePage-DOC_yWOf.js → NoContentTypePage-BwcL--4H.js} +3 -3
  47. package/dist/_chunks/NoContentTypePage-BwcL--4H.js.map +1 -0
  48. package/dist/_chunks/{NoPermissionsPage-Dwu8rRJu.js → NoPermissionsPage-BMFKVcwJ.js} +2 -2
  49. package/dist/_chunks/{NoPermissionsPage-Dwu8rRJu.js.map → NoPermissionsPage-BMFKVcwJ.js.map} +1 -1
  50. package/dist/_chunks/{NoPermissionsPage-UWDC-1Tw.mjs → NoPermissionsPage-UnEgMGK4.mjs} +2 -2
  51. package/dist/_chunks/{NoPermissionsPage-UWDC-1Tw.mjs.map → NoPermissionsPage-UnEgMGK4.mjs.map} +1 -1
  52. package/dist/_chunks/Preview-B7PR3Ok_.js +312 -0
  53. package/dist/_chunks/Preview-B7PR3Ok_.js.map +1 -0
  54. package/dist/_chunks/Preview-DECOhK0D.mjs +294 -0
  55. package/dist/_chunks/Preview-DECOhK0D.mjs.map +1 -0
  56. package/dist/_chunks/{Relations-J8cscLlR.mjs → Relations-DinMQJ4B.mjs} +138 -94
  57. package/dist/_chunks/Relations-DinMQJ4B.mjs.map +1 -0
  58. package/dist/_chunks/{Relations-CgWtgnPe.js → Relations-lndx3aQk.js} +142 -100
  59. package/dist/_chunks/Relations-lndx3aQk.js.map +1 -0
  60. package/dist/_chunks/{en-C-V1_90f.js → en-BK8Xyl5I.js} +38 -18
  61. package/dist/_chunks/{en-C-V1_90f.js.map → en-BK8Xyl5I.js.map} +1 -1
  62. package/dist/_chunks/{en-MBPul9Su.mjs → en-Dtk_ot79.mjs} +38 -18
  63. package/dist/_chunks/{en-MBPul9Su.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
  64. package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
  65. package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
  66. package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
  67. package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
  68. package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
  69. package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
  70. package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
  71. package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
  72. package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
  73. package/dist/_chunks/{index-CwRRo1V9.mjs → index-C2SagWVW.mjs} +2070 -988
  74. package/dist/_chunks/index-C2SagWVW.mjs.map +1 -0
  75. package/dist/_chunks/{index-C6AH2hEl.js → index-Cnw4gqee.js} +2047 -966
  76. package/dist/_chunks/index-Cnw4gqee.js.map +1 -0
  77. package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
  78. package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
  79. package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
  80. package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
  81. package/dist/_chunks/{layout-jIDzX0Fp.mjs → layout-DY_D9MGA.mjs} +46 -28
  82. package/dist/_chunks/layout-DY_D9MGA.mjs.map +1 -0
  83. package/dist/_chunks/{layout-B_SXLhqf.js → layout-ivwIVPnV.js} +47 -32
  84. package/dist/_chunks/layout-ivwIVPnV.js.map +1 -0
  85. package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
  86. package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
  87. package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
  88. package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
  89. package/dist/_chunks/{relations-iBMa_OFG.js → relations-B7C7O_Pv.js} +6 -7
  90. package/dist/_chunks/relations-B7C7O_Pv.js.map +1 -0
  91. package/dist/_chunks/{relations-CuvIgCqI.mjs → relations-Boc5Y9kX.mjs} +6 -7
  92. package/dist/_chunks/relations-Boc5Y9kX.mjs.map +1 -0
  93. package/dist/_chunks/useDebounce-CtcjDB3L.js +28 -0
  94. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
  95. package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
  96. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
  97. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
  98. package/dist/_chunks/useDragAndDrop-BMtgCYzL.js.map +1 -0
  99. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
  100. package/dist/_chunks/useDragAndDrop-DJ6jqvZN.mjs.map +1 -0
  101. package/dist/admin/index.js +3 -1
  102. package/dist/admin/index.js.map +1 -1
  103. package/dist/admin/index.mjs +9 -7
  104. package/dist/admin/src/components/ComponentIcon.d.ts +6 -3
  105. package/dist/admin/src/content-manager.d.ts +6 -5
  106. package/dist/admin/src/exports.d.ts +2 -1
  107. package/dist/admin/src/history/components/VersionInputRenderer.d.ts +1 -1
  108. package/dist/admin/src/history/index.d.ts +3 -0
  109. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  110. package/dist/admin/src/hooks/useDocument.d.ts +37 -9
  111. package/dist/admin/src/hooks/useDocumentActions.d.ts +24 -3
  112. package/dist/admin/src/hooks/useDocumentLayout.d.ts +2 -2
  113. package/dist/admin/src/hooks/useDragAndDrop.d.ts +4 -4
  114. package/dist/admin/src/hooks/useKeyboardDragAndDrop.d.ts +1 -1
  115. package/dist/admin/src/index.d.ts +1 -0
  116. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  117. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +12 -5
  118. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
  119. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  120. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  121. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksInput.d.ts +3 -3
  122. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +5 -0
  123. package/dist/admin/src/pages/EditView/components/FormInputs/Component/Input.d.ts +2 -2
  124. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.d.ts +3 -5
  125. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +1 -1
  126. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +30 -18
  127. package/dist/admin/src/pages/EditView/components/FormInputs/UID.d.ts +2 -2
  128. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +3 -49
  129. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.d.ts +2 -2
  130. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  131. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +16 -53
  132. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  133. package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +2 -10
  134. package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
  135. package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
  136. package/dist/admin/src/pages/ListView/components/BulkActions/PublishAction.d.ts +9 -26
  137. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
  138. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
  139. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  140. package/dist/admin/src/preview/index.d.ts +4 -0
  141. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  142. package/dist/admin/src/preview/routes.d.ts +3 -0
  143. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  144. package/dist/admin/src/router.d.ts +1 -1
  145. package/dist/admin/src/services/api.d.ts +2 -3
  146. package/dist/admin/src/services/components.d.ts +2 -2
  147. package/dist/admin/src/services/contentTypes.d.ts +5 -5
  148. package/dist/admin/src/services/documents.d.ts +31 -20
  149. package/dist/admin/src/services/init.d.ts +2 -2
  150. package/dist/admin/src/services/relations.d.ts +3 -3
  151. package/dist/admin/src/services/uid.d.ts +3 -3
  152. package/dist/admin/src/utils/api.d.ts +4 -18
  153. package/dist/admin/src/utils/validation.d.ts +5 -7
  154. package/dist/server/index.js +886 -480
  155. package/dist/server/index.js.map +1 -1
  156. package/dist/server/index.mjs +892 -485
  157. package/dist/server/index.mjs.map +1 -1
  158. package/dist/server/src/bootstrap.d.ts.map +1 -1
  159. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  160. package/dist/server/src/controllers/index.d.ts.map +1 -1
  161. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  162. package/dist/server/src/controllers/single-types.d.ts.map +1 -1
  163. package/dist/server/src/controllers/uid.d.ts.map +1 -1
  164. package/dist/server/src/controllers/utils/metadata.d.ts +23 -0
  165. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -0
  166. package/dist/server/src/controllers/validation/dimensions.d.ts +11 -0
  167. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -0
  168. package/dist/server/src/controllers/validation/index.d.ts +1 -1
  169. package/dist/server/src/history/services/history.d.ts.map +1 -1
  170. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  171. package/dist/server/src/history/services/utils.d.ts +4 -4
  172. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  173. package/dist/server/src/index.d.ts +22 -42
  174. package/dist/server/src/index.d.ts.map +1 -1
  175. package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
  176. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  177. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  178. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  179. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  180. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  181. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  182. package/dist/server/src/preview/index.d.ts +4 -0
  183. package/dist/server/src/preview/index.d.ts.map +1 -0
  184. package/dist/server/src/preview/routes/index.d.ts +8 -0
  185. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  186. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  187. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  188. package/dist/server/src/preview/services/index.d.ts +16 -0
  189. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  190. package/dist/server/src/preview/services/preview-config.d.ts +32 -0
  191. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  192. package/dist/server/src/preview/services/preview.d.ts +12 -0
  193. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  194. package/dist/server/src/preview/utils.d.ts +19 -0
  195. package/dist/server/src/preview/utils.d.ts.map +1 -0
  196. package/dist/server/src/register.d.ts.map +1 -1
  197. package/dist/server/src/routes/index.d.ts.map +1 -1
  198. package/dist/server/src/services/document-manager.d.ts +13 -12
  199. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  200. package/dist/server/src/services/document-metadata.d.ts +16 -35
  201. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  202. package/dist/server/src/services/index.d.ts +22 -42
  203. package/dist/server/src/services/index.d.ts.map +1 -1
  204. package/dist/server/src/services/permission-checker.d.ts.map +1 -1
  205. package/dist/server/src/services/utils/populate.d.ts +8 -1
  206. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  207. package/dist/server/src/utils/index.d.ts +2 -0
  208. package/dist/server/src/utils/index.d.ts.map +1 -1
  209. package/dist/shared/contracts/collection-types.d.ts +17 -7
  210. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  211. package/dist/shared/contracts/index.d.ts +1 -0
  212. package/dist/shared/contracts/index.d.ts.map +1 -1
  213. package/dist/shared/contracts/preview.d.ts +27 -0
  214. package/dist/shared/contracts/preview.d.ts.map +1 -0
  215. package/dist/shared/contracts/relations.d.ts +2 -2
  216. package/dist/shared/contracts/relations.d.ts.map +1 -1
  217. package/dist/shared/index.js +4 -0
  218. package/dist/shared/index.js.map +1 -1
  219. package/dist/shared/index.mjs +4 -0
  220. package/dist/shared/index.mjs.map +1 -1
  221. package/package.json +22 -21
  222. package/dist/_chunks/CardDragPreview-DSVYodBX.js.map +0 -1
  223. package/dist/_chunks/CardDragPreview-ikSG4M46.mjs.map +0 -1
  224. package/dist/_chunks/ComponentIcon-BBQsYCVn.js.map +0 -1
  225. package/dist/_chunks/ComponentIcon-BOFnK76n.mjs.map +0 -1
  226. package/dist/_chunks/EditViewPage-DDS6H9HO.mjs +0 -203
  227. package/dist/_chunks/EditViewPage-DDS6H9HO.mjs.map +0 -1
  228. package/dist/_chunks/EditViewPage-DvNpQkam.js.map +0 -1
  229. package/dist/_chunks/Field-6gvGdPBV.mjs.map +0 -1
  230. package/dist/_chunks/Field-DmVKIAOo.js.map +0 -1
  231. package/dist/_chunks/Form-CPZC9vWa.js.map +0 -1
  232. package/dist/_chunks/Form-DW6K1IH-.mjs.map +0 -1
  233. package/dist/_chunks/History-DeAPlvtv.js.map +0 -1
  234. package/dist/_chunks/History-Dmr9fmUA.mjs.map +0 -1
  235. package/dist/_chunks/ListConfigurationPage-DPCwW5Vr.js.map +0 -1
  236. package/dist/_chunks/ListConfigurationPage-DhwvYcNv.mjs.map +0 -1
  237. package/dist/_chunks/ListViewPage-5ySZ-VUs.js.map +0 -1
  238. package/dist/_chunks/ListViewPage-BtAwuYLE.mjs.map +0 -1
  239. package/dist/_chunks/NoContentTypePage-DOC_yWOf.js.map +0 -1
  240. package/dist/_chunks/NoContentTypePage-DSPxnxxp.mjs.map +0 -1
  241. package/dist/_chunks/Relations-CgWtgnPe.js.map +0 -1
  242. package/dist/_chunks/Relations-J8cscLlR.mjs.map +0 -1
  243. package/dist/_chunks/index-C6AH2hEl.js.map +0 -1
  244. package/dist/_chunks/index-CwRRo1V9.mjs.map +0 -1
  245. package/dist/_chunks/layout-B_SXLhqf.js.map +0 -1
  246. package/dist/_chunks/layout-jIDzX0Fp.mjs.map +0 -1
  247. package/dist/_chunks/relations-CuvIgCqI.mjs.map +0 -1
  248. package/dist/_chunks/relations-iBMa_OFG.js.map +0 -1
  249. package/dist/_chunks/urls-CbOsUOoW.mjs +0 -7
  250. package/dist/_chunks/urls-CbOsUOoW.mjs.map +0 -1
  251. package/dist/_chunks/urls-DzZya_gm.js +0 -6
  252. package/dist/_chunks/urls-DzZya_gm.js.map +0 -1
  253. package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs.map +0 -1
  254. package/dist/_chunks/useDragAndDrop-J0TUUbR6.js.map +0 -1
  255. package/dist/server/src/controllers/utils/dimensions.d.ts +0 -5
  256. package/dist/server/src/controllers/utils/dimensions.d.ts.map +0 -1
  257. package/strapi-server.js +0 -3
@@ -5,19 +5,70 @@ const strapiAdmin = require("@strapi/admin/strapi-admin");
5
5
  const designSystem = require("@strapi/design-system");
6
6
  const pipe$1 = require("lodash/fp/pipe");
7
7
  const reactIntl = require("react-intl");
8
- const index = require("./index-C6AH2hEl.js");
8
+ const index = require("./index-Cnw4gqee.js");
9
9
  const fractionalIndexing = require("fractional-indexing");
10
- const Relations = require("./Relations-CgWtgnPe.js");
10
+ const Relations = require("./Relations-lndx3aQk.js");
11
11
  const Icons = require("@strapi/icons");
12
- const styled = require("styled-components");
13
- const ComponentIcon = require("./ComponentIcon-BBQsYCVn.js");
12
+ const styledComponents = require("styled-components");
13
+ const ComponentIcon = require("./ComponentIcon-CRbtQEUV.js");
14
14
  const reactDndHtml5Backend = require("react-dnd-html5-backend");
15
- const useDragAndDrop = require("./useDragAndDrop-J0TUUbR6.js");
16
- const objects = require("./objects-gigeqt7s.js");
15
+ const useDragAndDrop = require("./useDragAndDrop-BMtgCYzL.js");
16
+ const objects = require("./objects-BcXOv6_9.js");
17
17
  const slate = require("slate");
18
18
  const slateHistory = require("slate-history");
19
19
  const slateReact = require("slate-react");
20
- const urls = require("./urls-DzZya_gm.js");
20
+ const Prism = require("prismjs");
21
+ require("prismjs/themes/prism-solarizedlight.css");
22
+ require("prismjs/components/prism-asmatmel");
23
+ require("prismjs/components/prism-bash");
24
+ require("prismjs/components/prism-basic");
25
+ require("prismjs/components/prism-c");
26
+ require("prismjs/components/prism-clojure");
27
+ require("prismjs/components/prism-cobol");
28
+ require("prismjs/components/prism-cpp");
29
+ require("prismjs/components/prism-csharp");
30
+ require("prismjs/components/prism-dart");
31
+ require("prismjs/components/prism-docker");
32
+ require("prismjs/components/prism-elixir");
33
+ require("prismjs/components/prism-erlang");
34
+ require("prismjs/components/prism-fortran");
35
+ require("prismjs/components/prism-fsharp");
36
+ require("prismjs/components/prism-go");
37
+ require("prismjs/components/prism-graphql");
38
+ require("prismjs/components/prism-groovy");
39
+ require("prismjs/components/prism-haskell");
40
+ require("prismjs/components/prism-haxe");
41
+ require("prismjs/components/prism-ini");
42
+ require("prismjs/components/prism-java");
43
+ require("prismjs/components/prism-javascript");
44
+ require("prismjs/components/prism-jsx");
45
+ require("prismjs/components/prism-json");
46
+ require("prismjs/components/prism-julia");
47
+ require("prismjs/components/prism-kotlin");
48
+ require("prismjs/components/prism-latex");
49
+ require("prismjs/components/prism-lua");
50
+ require("prismjs/components/prism-markdown");
51
+ require("prismjs/components/prism-matlab");
52
+ require("prismjs/components/prism-makefile");
53
+ require("prismjs/components/prism-objectivec");
54
+ require("prismjs/components/prism-perl");
55
+ require("prismjs/components/prism-php");
56
+ require("prismjs/components/prism-powershell");
57
+ require("prismjs/components/prism-python");
58
+ require("prismjs/components/prism-r");
59
+ require("prismjs/components/prism-ruby");
60
+ require("prismjs/components/prism-rust");
61
+ require("prismjs/components/prism-sas");
62
+ require("prismjs/components/prism-scala");
63
+ require("prismjs/components/prism-scheme");
64
+ require("prismjs/components/prism-sql");
65
+ require("prismjs/components/prism-stata");
66
+ require("prismjs/components/prism-swift");
67
+ require("prismjs/components/prism-typescript");
68
+ require("prismjs/components/prism-tsx");
69
+ require("prismjs/components/prism-vbnet");
70
+ require("prismjs/components/prism-yaml");
71
+ const useDebounce = require("./useDebounce-CtcjDB3L.js");
21
72
  const Toolbar = require("@radix-ui/react-toolbar");
22
73
  const reactRouterDom = require("react-router-dom");
23
74
  const CodeMirror = require("codemirror5");
@@ -37,8 +88,7 @@ require("highlight.js/styles/solarized-dark.css");
37
88
  require("codemirror5/addon/display/placeholder");
38
89
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
39
90
  function _interopNamespace(e) {
40
- if (e && e.__esModule)
41
- return e;
91
+ if (e && e.__esModule) return e;
42
92
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
43
93
  if (e) {
44
94
  for (const k in e) {
@@ -56,7 +106,7 @@ function _interopNamespace(e) {
56
106
  }
57
107
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
58
108
  const pipe__default = /* @__PURE__ */ _interopDefault(pipe$1);
59
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
109
+ const Prism__namespace = /* @__PURE__ */ _interopNamespace(Prism);
60
110
  const Toolbar__namespace = /* @__PURE__ */ _interopNamespace(Toolbar);
61
111
  const CodeMirror__default = /* @__PURE__ */ _interopDefault(CodeMirror);
62
112
  const sanitizeHtml__default = /* @__PURE__ */ _interopDefault(sanitizeHtml);
@@ -195,6 +245,224 @@ const useLazyComponents = (componentUids = []) => {
195
245
  }, []);
196
246
  return { isLazyLoading: loading, lazyComponentStore, cleanup };
197
247
  };
248
+ const codeLanguages = [
249
+ {
250
+ value: "asm",
251
+ label: "Assembly",
252
+ decorate: "asmatmel"
253
+ },
254
+ {
255
+ value: "bash",
256
+ label: "Bash"
257
+ },
258
+ {
259
+ value: "c",
260
+ label: "C"
261
+ },
262
+ {
263
+ value: "clojure",
264
+ label: "Clojure"
265
+ },
266
+ {
267
+ value: "cobol",
268
+ label: "COBOL"
269
+ },
270
+ {
271
+ value: "cpp",
272
+ label: "C++"
273
+ },
274
+ {
275
+ value: "csharp",
276
+ label: "C#"
277
+ },
278
+ {
279
+ value: "css",
280
+ label: "CSS"
281
+ },
282
+ {
283
+ value: "dart",
284
+ label: "Dart"
285
+ },
286
+ {
287
+ value: "dockerfile",
288
+ label: "Dockerfile",
289
+ decorate: "docker"
290
+ },
291
+ {
292
+ value: "elixir",
293
+ label: "Elixir"
294
+ },
295
+ {
296
+ value: "erlang",
297
+ label: "Erlang"
298
+ },
299
+ {
300
+ value: "fortran",
301
+ label: "Fortran"
302
+ },
303
+ {
304
+ value: "fsharp",
305
+ label: "F#"
306
+ },
307
+ {
308
+ value: "go",
309
+ label: "Go"
310
+ },
311
+ {
312
+ value: "graphql",
313
+ label: "GraphQL"
314
+ },
315
+ {
316
+ value: "groovy",
317
+ label: "Groovy"
318
+ },
319
+ {
320
+ value: "haskell",
321
+ label: "Haskell"
322
+ },
323
+ {
324
+ value: "haxe",
325
+ label: "Haxe"
326
+ },
327
+ {
328
+ value: "html",
329
+ label: "HTML"
330
+ },
331
+ {
332
+ value: "ini",
333
+ label: "INI"
334
+ },
335
+ {
336
+ value: "java",
337
+ label: "Java"
338
+ },
339
+ {
340
+ value: "javascript",
341
+ label: "JavaScript"
342
+ },
343
+ {
344
+ value: "jsx",
345
+ label: "JavaScript (React)"
346
+ },
347
+ {
348
+ value: "json",
349
+ label: "JSON"
350
+ },
351
+ {
352
+ value: "julia",
353
+ label: "Julia"
354
+ },
355
+ {
356
+ value: "kotlin",
357
+ label: "Kotlin"
358
+ },
359
+ {
360
+ value: "latex",
361
+ label: "LaTeX"
362
+ },
363
+ {
364
+ value: "lua",
365
+ label: "Lua"
366
+ },
367
+ {
368
+ value: "markdown",
369
+ label: "Markdown"
370
+ },
371
+ {
372
+ value: "matlab",
373
+ label: "MATLAB"
374
+ },
375
+ {
376
+ value: "makefile",
377
+ label: "Makefile"
378
+ },
379
+ {
380
+ value: "objectivec",
381
+ label: "Objective-C"
382
+ },
383
+ {
384
+ value: "perl",
385
+ label: "Perl"
386
+ },
387
+ {
388
+ value: "php",
389
+ label: "PHP"
390
+ },
391
+ {
392
+ value: "plaintext",
393
+ label: "Plain text"
394
+ },
395
+ {
396
+ value: "powershell",
397
+ label: "PowerShell"
398
+ },
399
+ {
400
+ value: "python",
401
+ label: "Python"
402
+ },
403
+ {
404
+ value: "r",
405
+ label: "R"
406
+ },
407
+ {
408
+ value: "ruby",
409
+ label: "Ruby"
410
+ },
411
+ {
412
+ value: "rust",
413
+ label: "Rust"
414
+ },
415
+ {
416
+ value: "sas",
417
+ label: "SAS"
418
+ },
419
+ {
420
+ value: "scala",
421
+ label: "Scala"
422
+ },
423
+ {
424
+ value: "scheme",
425
+ label: "Scheme"
426
+ },
427
+ {
428
+ value: "shell",
429
+ label: "Shell"
430
+ },
431
+ {
432
+ value: "sql",
433
+ label: "SQL"
434
+ },
435
+ {
436
+ value: "stata",
437
+ label: "Stata"
438
+ },
439
+ {
440
+ value: "swift",
441
+ label: "Swift"
442
+ },
443
+ {
444
+ value: "typescript",
445
+ label: "TypeScript",
446
+ decorate: "ts"
447
+ },
448
+ {
449
+ value: "tsx",
450
+ label: "TypeScript (React)"
451
+ },
452
+ {
453
+ value: "vbnet",
454
+ label: "VB.NET"
455
+ },
456
+ {
457
+ value: "xml",
458
+ label: "XML"
459
+ },
460
+ {
461
+ value: "yaml",
462
+ label: "YAML",
463
+ decorate: "yml"
464
+ }
465
+ ];
198
466
  const baseHandleConvert = (editor, attributesToSet) => {
199
467
  const [_, lastNodePath] = slate.Editor.last(editor, []);
200
468
  slate.Transforms.unwrapNodes(editor, {
@@ -258,13 +526,37 @@ const pressEnterTwiceToExit = (editor) => {
258
526
  });
259
527
  }
260
528
  };
261
- const CodeBlock = styled__default.default.pre.attrs({ role: "code" })`
529
+ const decorateCode = ([node, path]) => {
530
+ const ranges = [];
531
+ if (!slate.Element.isElement(node) || node.type !== "code") return ranges;
532
+ const text = slate.Node.string(node);
533
+ const language = codeLanguages.find((lang) => lang.value === node.language);
534
+ const decorateKey = language?.decorate ?? language?.value;
535
+ const selectedLanguage = Prism__namespace.languages[decorateKey || "plaintext"];
536
+ const tokens = Prism__namespace.tokenize(text, selectedLanguage);
537
+ let start = 0;
538
+ for (const token of tokens) {
539
+ const length = token.length;
540
+ const end = start + length;
541
+ if (typeof token !== "string") {
542
+ ranges.push({
543
+ anchor: { path, offset: start },
544
+ focus: { path, offset: end },
545
+ className: `token ${token.type}`
546
+ });
547
+ }
548
+ start = end;
549
+ }
550
+ return ranges;
551
+ };
552
+ const CodeBlock = styledComponents.styled.pre`
262
553
  border-radius: ${({ theme }) => theme.borderRadius};
263
554
  background-color: ${({ theme }) => theme.colors.neutral100};
264
555
  max-width: 100%;
265
556
  overflow: auto;
266
557
  padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
267
558
  flex-shrink: 1;
559
+
268
560
  & > code {
269
561
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
270
562
  monospace;
@@ -273,10 +565,62 @@ const CodeBlock = styled__default.default.pre.attrs({ role: "code" })`
273
565
  max-width: 100%;
274
566
  }
275
567
  `;
568
+ const CodeEditor = (props) => {
569
+ const { editor } = useBlocksEditorContext("ImageDialog");
570
+ const editorIsFocused = slateReact.useFocused();
571
+ const imageIsSelected = slateReact.useSelected();
572
+ const { formatMessage } = reactIntl.useIntl();
573
+ const [isSelectOpen, setIsSelectOpen] = React__namespace.useState(false);
574
+ const shouldDisplayLanguageSelect = editorIsFocused && imageIsSelected || isSelectOpen;
575
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { position: "relative", width: "100%", children: [
576
+ /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: props.children }) }),
577
+ shouldDisplayLanguageSelect && /* @__PURE__ */ jsxRuntime.jsx(
578
+ designSystem.Box,
579
+ {
580
+ position: "absolute",
581
+ background: "neutral0",
582
+ borderColor: "neutral150",
583
+ borderStyle: "solid",
584
+ borderWidth: "0.5px",
585
+ shadow: "tableShadow",
586
+ top: "100%",
587
+ marginTop: 1,
588
+ right: 0,
589
+ padding: 1,
590
+ hasRadius: true,
591
+ children: /* @__PURE__ */ jsxRuntime.jsx(
592
+ designSystem.SingleSelect,
593
+ {
594
+ onChange: (open) => {
595
+ slate.Transforms.setNodes(
596
+ editor,
597
+ { language: open.toString() },
598
+ { match: (node) => !slate.Editor.isEditor(node) && node.type === "code" }
599
+ );
600
+ },
601
+ value: props.element.type === "code" && props.element.language || "plaintext",
602
+ onOpenChange: (open) => {
603
+ setIsSelectOpen(open);
604
+ if (!open) {
605
+ slateReact.ReactEditor.focus(editor);
606
+ }
607
+ },
608
+ onCloseAutoFocus: (e) => e.preventDefault(),
609
+ "aria-label": formatMessage({
610
+ id: "components.Blocks.blocks.code.languageLabel",
611
+ defaultMessage: "Select a language"
612
+ }),
613
+ children: codeLanguages.map(({ value, label }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value, children: label }, value))
614
+ }
615
+ )
616
+ }
617
+ )
618
+ ] });
619
+ };
276
620
  const codeBlocks = {
277
621
  code: {
278
- renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: props.children }) }),
279
- icon: Icons.Code,
622
+ renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { ...props }),
623
+ icon: Icons.CodeBlock,
280
624
  label: {
281
625
  id: "components.Blocks.blocks.code",
282
626
  defaultMessage: "Code block"
@@ -284,36 +628,35 @@ const codeBlocks = {
284
628
  matchNode: (node) => node.type === "code",
285
629
  isInBlocksSelector: true,
286
630
  handleConvert(editor) {
287
- baseHandleConvert(editor, { type: "code" });
631
+ baseHandleConvert(editor, { type: "code", language: "plaintext" });
288
632
  },
289
633
  handleEnterKey(editor) {
290
634
  pressEnterTwiceToExit(editor);
291
635
  },
292
- snippets: ["```"],
293
- dragHandleTopMargin: "10px"
636
+ snippets: ["```"]
294
637
  }
295
638
  };
296
- const H1 = styled__default.default(designSystem.Typography).attrs({ as: "h1" })`
639
+ const H1 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h1" })`
297
640
  font-size: 4.2rem;
298
641
  line-height: ${({ theme }) => theme.lineHeights[1]};
299
642
  `;
300
- const H2 = styled__default.default(designSystem.Typography).attrs({ as: "h2" })`
643
+ const H2 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h2" })`
301
644
  font-size: 3.5rem;
302
645
  line-height: ${({ theme }) => theme.lineHeights[1]};
303
646
  `;
304
- const H3 = styled__default.default(designSystem.Typography).attrs({ as: "h3" })`
647
+ const H3 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h3" })`
305
648
  font-size: 2.9rem;
306
649
  line-height: ${({ theme }) => theme.lineHeights[1]};
307
650
  `;
308
- const H4 = styled__default.default(designSystem.Typography).attrs({ as: "h4" })`
651
+ const H4 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h4" })`
309
652
  font-size: 2.4rem;
310
653
  line-height: ${({ theme }) => theme.lineHeights[1]};
311
654
  `;
312
- const H5 = styled__default.default(designSystem.Typography).attrs({ as: "h5" })`
655
+ const H5 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h5" })`
313
656
  font-size: 2rem;
314
657
  line-height: ${({ theme }) => theme.lineHeights[1]};
315
658
  `;
316
- const H6 = styled__default.default(designSystem.Typography).attrs({ as: "h6" })`
659
+ const H6 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h6" })`
317
660
  font-size: 1.6rem;
318
661
  line-height: ${({ theme }) => theme.lineHeights[1]};
319
662
  `;
@@ -399,10 +742,10 @@ const headingBlocks = {
399
742
  dragHandleTopMargin: "-2px"
400
743
  }
401
744
  };
402
- const ImageWrapper = styled__default.default(designSystem.Flex)`
745
+ const ImageWrapper = styledComponents.styled(designSystem.Flex)`
403
746
  transition-property: box-shadow;
404
747
  transition-duration: 0.2s;
405
- ${(props) => props.isFocused && styled.css`
748
+ ${(props) => props.$isFocused && styledComponents.css`
406
749
  box-shadow: ${props.theme.colors.primary600} 0px 0px 0px 3px;
407
750
  `}
408
751
 
@@ -454,7 +797,7 @@ const Image = ({ attributes, children, element }) => {
454
797
  background: "neutral100",
455
798
  contentEditable: false,
456
799
  justifyContent: "center",
457
- isFocused: editorIsFocused && imageIsSelected,
800
+ $isFocused: editorIsFocused && imageIsSelected,
458
801
  hasRadius: true,
459
802
  children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, alt: alternativeText, width, height })
460
803
  }
@@ -465,8 +808,7 @@ const ImageDialog = () => {
465
808
  const [isOpen, setIsOpen] = React__namespace.useState(true);
466
809
  const { editor } = useBlocksEditorContext("ImageDialog");
467
810
  const components = strapiAdmin.useStrapiApp("ImageDialog", (state) => state.components);
468
- if (!components || !isOpen)
469
- return null;
811
+ if (!components || !isOpen) return null;
470
812
  const MediaLibraryDialog = components["media-library"];
471
813
  const insertImages = (images) => {
472
814
  slate.Transforms.unwrapNodes(editor, {
@@ -475,14 +817,12 @@ const ImageDialog = () => {
475
817
  });
476
818
  const nodeEntryBeingReplaced = slate.Editor.above(editor, {
477
819
  match(node) {
478
- if (slate.Editor.isEditor(node))
479
- return false;
820
+ if (slate.Editor.isEditor(node)) return false;
480
821
  const isInlineNode = ["text", "link"].includes(node.type);
481
822
  return !isInlineNode;
482
823
  }
483
824
  });
484
- if (!nodeEntryBeingReplaced)
485
- return;
825
+ if (!nodeEntryBeingReplaced) return;
486
826
  const [, pathToInsert] = nodeEntryBeingReplaced;
487
827
  slate.Transforms.removeNodes(editor);
488
828
  const nodesToInsert = images.map((image) => {
@@ -502,7 +842,7 @@ const ImageDialog = () => {
502
842
  const nodeImage = {
503
843
  ...expectedImage,
504
844
  alternativeText: expectedImage.alternativeText || expectedImage.name,
505
- url: urls.prefixFileUrlWithBackendUrl(image.url)
845
+ url: useDebounce.prefixFileUrlWithBackendUrl(image.url)
506
846
  };
507
847
  return nodeImage;
508
848
  });
@@ -610,11 +950,11 @@ const isLinkNode = (element) => {
610
950
  const isListNode$1 = (element) => {
611
951
  return element.type === "list";
612
952
  };
613
- const StyledBaseLink = styled__default.default(designSystem.BaseLink)`
953
+ const StyledBaseLink = styledComponents.styled(designSystem.BaseLink)`
614
954
  text-decoration: none;
615
955
  `;
616
- const RemoveButton = styled__default.default(designSystem.Button)`
617
- visibility: ${(props) => props.visible ? "visible" : "hidden"};
956
+ const RemoveButton = styledComponents.styled(designSystem.Button)`
957
+ visibility: ${(props) => props.$visible ? "visible" : "hidden"};
618
958
  `;
619
959
  const LinkContent = React__namespace.forwardRef(
620
960
  ({ link, children, attributes }, forwardedRef) => {
@@ -624,18 +964,12 @@ const LinkContent = React__namespace.forwardRef(
624
964
  const [popoverOpen, setPopoverOpen] = React__namespace.useState(
625
965
  editor.lastInsertedLinkPath ? slate.Path.equals(path, editor.lastInsertedLinkPath) : false
626
966
  );
627
- const linkRef = React__namespace.useRef(null);
628
967
  const elementText = link.children.map((child) => child.text).join("");
629
968
  const [linkText, setLinkText] = React__namespace.useState(elementText);
630
969
  const [linkUrl, setLinkUrl] = React__namespace.useState(link.url);
631
970
  const linkInputRef = React__namespace.useRef(null);
632
- const [showRemoveButton, setShowRemoveButton] = React__namespace.useState(false);
971
+ const isLastInsertedLink = editor.lastInsertedLinkPath ? !slate.Path.equals(path, editor.lastInsertedLinkPath) : true;
633
972
  const [isSaveDisabled, setIsSaveDisabled] = React__namespace.useState(false);
634
- const handleOpenEditPopover = (e) => {
635
- e.preventDefault();
636
- setPopoverOpen(true);
637
- setShowRemoveButton(true);
638
- };
639
973
  const onLinkChange = (e) => {
640
974
  setIsSaveDisabled(false);
641
975
  setLinkUrl(e.target.value);
@@ -656,40 +990,39 @@ const LinkContent = React__namespace.forwardRef(
656
990
  editLink(editor, { url: linkUrl, text: linkText });
657
991
  setPopoverOpen(false);
658
992
  editor.lastInsertedLinkPath = null;
993
+ slateReact.ReactEditor.focus(editor);
659
994
  };
660
- const handleDismiss = () => {
661
- setPopoverOpen(false);
995
+ const handleClose = () => {
662
996
  if (link.url === "") {
663
997
  removeLink(editor);
664
998
  }
999
+ setPopoverOpen(false);
665
1000
  slateReact.ReactEditor.focus(editor);
666
1001
  };
667
- const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
668
- const composedRefs = designSystem.useComposedRefs(linkRef, forwardedRef);
669
1002
  React__namespace.useEffect(() => {
670
- if (popoverOpen)
671
- linkInputRef.current?.focus();
1003
+ if (popoverOpen) linkInputRef.current?.focus();
672
1004
  }, [popoverOpen]);
673
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
674
- /* @__PURE__ */ jsxRuntime.jsx(
1005
+ const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
1006
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { open: popoverOpen, children: [
1007
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
675
1008
  StyledBaseLink,
676
1009
  {
677
1010
  ...attributes,
678
- ref: composedRefs,
1011
+ ref: forwardedRef,
679
1012
  href: link.url,
680
- onClick: handleOpenEditPopover,
1013
+ onClick: () => setPopoverOpen(true),
681
1014
  color: "primary600",
682
1015
  children
683
1016
  }
684
- ),
685
- popoverOpen && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover, { source: linkRef, onDismiss: handleDismiss, padding: 4, contentEditable: false, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { as: "form", onSubmit: handleSave, direction: "column", gap: 4, children: [
686
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
687
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { children: formatMessage({
1017
+ ) }),
1018
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { onPointerDownOutside: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 4, children: [
1019
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
1020
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
688
1021
  id: "components.Blocks.popover.text",
689
1022
  defaultMessage: "Text"
690
1023
  }) }),
691
1024
  /* @__PURE__ */ jsxRuntime.jsx(
692
- designSystem.FieldInput,
1025
+ designSystem.Field.Input,
693
1026
  {
694
1027
  name: "text",
695
1028
  placeholder: formatMessage({
@@ -703,13 +1036,13 @@ const LinkContent = React__namespace.forwardRef(
703
1036
  }
704
1037
  )
705
1038
  ] }) }),
706
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
707
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { children: formatMessage({
1039
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
1040
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
708
1041
  id: "components.Blocks.popover.link",
709
1042
  defaultMessage: "Link"
710
1043
  }) }),
711
1044
  /* @__PURE__ */ jsxRuntime.jsx(
712
- designSystem.FieldInput,
1045
+ designSystem.Field.Input,
713
1046
  {
714
1047
  ref: linkInputRef,
715
1048
  name: "url",
@@ -728,7 +1061,7 @@ const LinkContent = React__namespace.forwardRef(
728
1061
  {
729
1062
  variant: "danger-light",
730
1063
  onClick: () => removeLink(editor),
731
- visible: showRemoveButton,
1064
+ $visible: isLastInsertedLink,
732
1065
  children: formatMessage({
733
1066
  id: "components.Blocks.popover.remove",
734
1067
  defaultMessage: "Remove"
@@ -736,12 +1069,12 @@ const LinkContent = React__namespace.forwardRef(
736
1069
  }
737
1070
  ),
738
1071
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
739
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: handleDismiss, children: formatMessage({
740
- id: "components.Blocks.popover.cancel",
1072
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
1073
+ id: "global.cancel",
741
1074
  defaultMessage: "Cancel"
742
1075
  }) }),
743
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", disabled: Boolean(inputNotDirty) || isSaveDisabled, children: formatMessage({
744
- id: "components.Blocks.popover.save",
1076
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
1077
+ id: "global.save",
745
1078
  defaultMessage: "Save"
746
1079
  }) })
747
1080
  ] })
@@ -764,7 +1097,7 @@ const linkBlocks = {
764
1097
  isInBlocksSelector: false
765
1098
  }
766
1099
  };
767
- const listStyle = styled.css`
1100
+ const listStyle = styledComponents.css`
768
1101
  display: flex;
769
1102
  flex-direction: column;
770
1103
  gap: ${({ theme }) => theme.spaces[2]};
@@ -782,12 +1115,12 @@ const listStyle = styled.css`
782
1115
  margin-inline-start: ${({ theme }) => theme.spaces[3]};
783
1116
  }
784
1117
  `;
785
- const Orderedlist = styled__default.default.ol`
786
- list-style-type: ${(props) => props.listStyleType};
1118
+ const Orderedlist = styledComponents.styled.ol`
1119
+ list-style-type: ${(props) => props.$listStyleType};
787
1120
  ${listStyle}
788
1121
  `;
789
- const Unorderedlist = styled__default.default.ul`
790
- list-style-type: ${(props) => props.listStyleType};
1122
+ const Unorderedlist = styledComponents.styled.ul`
1123
+ list-style-type: ${(props) => props.$listStyleType};
791
1124
  ${listStyle}
792
1125
  `;
793
1126
  const orderedStyles = ["decimal", "lower-alpha", "upper-roman"];
@@ -800,9 +1133,9 @@ const List = ({ attributes, children, element }) => {
800
1133
  const nextIndex = (element.indentLevel || 0) % listStyles.length;
801
1134
  const listStyleType = listStyles[nextIndex];
802
1135
  if (element.format === "ordered") {
803
- return /* @__PURE__ */ jsxRuntime.jsx(Orderedlist, { listStyleType, ...attributes, children });
1136
+ return /* @__PURE__ */ jsxRuntime.jsx(Orderedlist, { $listStyleType: listStyleType, ...attributes, children });
804
1137
  }
805
- return /* @__PURE__ */ jsxRuntime.jsx(Unorderedlist, { listStyleType, ...attributes, children });
1138
+ return /* @__PURE__ */ jsxRuntime.jsx(Unorderedlist, { $listStyleType: listStyleType, ...attributes, children });
806
1139
  };
807
1140
  const replaceListWithEmptyBlock = (editor, currentListPath) => {
808
1141
  slate.Transforms.removeNodes(editor, { at: currentListPath });
@@ -822,8 +1155,7 @@ const isText$1 = (node) => {
822
1155
  return slate.Node.isNode(node) && !slate.Editor.isEditor(node) && node.type === "text";
823
1156
  };
824
1157
  const handleBackspaceKeyOnList = (editor, event) => {
825
- if (!editor.selection)
826
- return;
1158
+ if (!editor.selection) return;
827
1159
  const [currentListItem, currentListItemPath] = slate.Editor.parent(editor, editor.selection.anchor);
828
1160
  const [currentList, currentListPath] = slate.Editor.parent(editor, currentListItemPath);
829
1161
  const isListEmpty = currentList.children.length === 1 && isText$1(currentListItem.children[0]) && currentListItem.children[0].text === "";
@@ -932,8 +1264,7 @@ const handleEnterKeyOnList = (editor) => {
932
1264
  };
933
1265
  const handleConvertToList = (editor, format) => {
934
1266
  const convertedPath = baseHandleConvert(editor, { type: "list-item" });
935
- if (!convertedPath)
936
- return;
1267
+ if (!convertedPath) return;
937
1268
  slate.Transforms.wrapNodes(editor, { type: "list", format, children: [] }, { at: convertedPath });
938
1269
  };
939
1270
  const handleTabOnList = (editor) => {
@@ -945,8 +1276,7 @@ const handleTabOnList = (editor) => {
945
1276
  }
946
1277
  const [currentListItem, currentListItemPath] = currentListItemEntry;
947
1278
  const [currentList] = slate.Editor.parent(editor, currentListItemPath);
948
- if (currentListItem === currentList.children[0])
949
- return;
1279
+ if (currentListItem === currentList.children[0]) return;
950
1280
  const currentListItemIndex = currentList.children.findIndex((item) => item === currentListItem);
951
1281
  const previousNode = currentList.children[currentListItemIndex - 1];
952
1282
  if (previousNode.type === "list") {
@@ -999,7 +1329,7 @@ const listBlocks = {
999
1329
  snippets: ["-", "*", "+"]
1000
1330
  },
1001
1331
  "list-item": {
1002
- renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "li", ...props.attributes, children: props.children }),
1332
+ renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "li", ...props.attributes, children: props.children }),
1003
1333
  // No handleConvert, list items are created when converting to the parent list
1004
1334
  matchNode: (node) => node.type === "list-item",
1005
1335
  isInBlocksSelector: false,
@@ -1008,7 +1338,7 @@ const listBlocks = {
1008
1338
  };
1009
1339
  const paragraphBlocks = {
1010
1340
  paragraph: {
1011
- renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "p", variant: "omega", ...props.attributes, children: props.children }),
1341
+ renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "p", variant: "omega", ...props.attributes, children: props.children }),
1012
1342
  icon: Icons.Paragraph,
1013
1343
  label: {
1014
1344
  id: "components.Blocks.blocks.text",
@@ -1056,7 +1386,7 @@ const paragraphBlocks = {
1056
1386
  }
1057
1387
  }
1058
1388
  };
1059
- const Blockquote = styled__default.default.blockquote.attrs({ role: "blockquote" })`
1389
+ const Blockquote = styledComponents.styled.blockquote.attrs({ role: "blockquote" })`
1060
1390
  font-weight: ${({ theme }) => theme.fontWeights.regular};
1061
1391
  border-left: ${({ theme }) => `${theme.spaces[1]} solid ${theme.colors.neutral200}`};
1062
1392
  padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[4]};
@@ -1082,24 +1412,24 @@ const quoteBlocks = {
1082
1412
  handleEnterKey(editor) {
1083
1413
  pressEnterTwiceToExit(editor);
1084
1414
  },
1085
- snippets: [">"],
1086
- dragHandleTopMargin: "6px"
1415
+ snippets: [">"]
1087
1416
  }
1088
1417
  };
1089
- const ToolbarWrapper = styled__default.default(designSystem.Flex)`
1418
+ const ToolbarWrapper = styledComponents.styled(designSystem.Flex)`
1090
1419
  &[aria-disabled='true'] {
1091
1420
  cursor: not-allowed;
1421
+ background: ${({ theme }) => theme.colors.neutral150};
1092
1422
  }
1093
1423
  `;
1094
- const Separator = styled__default.default(Toolbar__namespace.Separator)`
1424
+ const Separator = styledComponents.styled(Toolbar__namespace.Separator)`
1095
1425
  background: ${({ theme }) => theme.colors.neutral150};
1096
1426
  width: 1px;
1097
1427
  height: 2.4rem;
1098
1428
  `;
1099
- const FlexButton = styled__default.default(designSystem.Flex)`
1429
+ const FlexButton = styledComponents.styled(designSystem.Flex)`
1100
1430
  // Inherit the not-allowed cursor from ToolbarWrapper when disabled
1101
1431
  &[aria-disabled] {
1102
- cursor: inherit;
1432
+ cursor: not-allowed;
1103
1433
  }
1104
1434
 
1105
1435
  &[aria-disabled='false'] {
@@ -1111,7 +1441,7 @@ const FlexButton = styled__default.default(designSystem.Flex)`
1111
1441
  }
1112
1442
  }
1113
1443
  `;
1114
- const SelectWrapper = styled__default.default(designSystem.Box)`
1444
+ const SelectWrapper = styledComponents.styled(designSystem.Box)`
1115
1445
  // Styling changes to SingleSelect component don't work, so adding wrapper to target SingleSelect
1116
1446
  div[role='combobox'] {
1117
1447
  border: none;
@@ -1174,14 +1504,14 @@ const ToolbarButton = ({
1174
1504
  children: /* @__PURE__ */ jsxRuntime.jsx(
1175
1505
  FlexButton,
1176
1506
  {
1177
- as: "button",
1507
+ tag: "button",
1178
1508
  background: isActive ? "primary100" : "",
1179
1509
  alignItems: "center",
1180
1510
  justifyContent: "center",
1181
1511
  width: 7,
1182
1512
  height: 7,
1183
1513
  hasRadius: true,
1184
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { width: "1.2rem", height: "1.2rem", fill: disabled ? "neutral300" : enabledColor })
1514
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { fill: disabled ? "neutral300" : enabledColor })
1185
1515
  }
1186
1516
  )
1187
1517
  }
@@ -1313,8 +1643,7 @@ const isListNode = (node) => {
1313
1643
  const ListButton = ({ block, format }) => {
1314
1644
  const { editor, disabled, blocks } = useBlocksEditorContext("ListButton");
1315
1645
  const isListActive = () => {
1316
- if (!editor.selection)
1317
- return false;
1646
+ if (!editor.selection) return false;
1318
1647
  const currentListEntry = slate.Editor.above(editor, {
1319
1648
  match: (node) => !slate.Editor.isEditor(node) && node.type === "list",
1320
1649
  at: editor.selection.anchor
@@ -1326,6 +1655,26 @@ const ListButton = ({ block, format }) => {
1326
1655
  }
1327
1656
  return false;
1328
1657
  };
1658
+ const isListDisabled = () => {
1659
+ if (disabled) {
1660
+ return true;
1661
+ }
1662
+ if (!editor.selection) {
1663
+ return false;
1664
+ }
1665
+ const anchorNodeEntry = slate.Editor.above(editor, {
1666
+ at: editor.selection.anchor,
1667
+ match: (node) => !slate.Editor.isEditor(node) && node.type !== "text"
1668
+ });
1669
+ const focusNodeEntry = slate.Editor.above(editor, {
1670
+ at: editor.selection.focus,
1671
+ match: (node) => !slate.Editor.isEditor(node) && node.type !== "text"
1672
+ });
1673
+ if (!anchorNodeEntry || !focusNodeEntry) {
1674
+ return false;
1675
+ }
1676
+ return anchorNodeEntry[0] !== focusNodeEntry[0];
1677
+ };
1329
1678
  const toggleList = (format2) => {
1330
1679
  let currentListEntry;
1331
1680
  if (editor.selection) {
@@ -1359,7 +1708,7 @@ const ListButton = ({ block, format }) => {
1359
1708
  name: format,
1360
1709
  label: block.label,
1361
1710
  isActive: isListActive(),
1362
- disabled,
1711
+ disabled: isListDisabled(),
1363
1712
  handleClick: () => toggleList(format)
1364
1713
  }
1365
1714
  );
@@ -1368,8 +1717,7 @@ const LinkButton = ({ disabled }) => {
1368
1717
  const { editor } = useBlocksEditorContext("LinkButton");
1369
1718
  const isLinkActive = () => {
1370
1719
  const { selection } = editor;
1371
- if (!selection)
1372
- return false;
1720
+ if (!selection) return false;
1373
1721
  const [match] = Array.from(
1374
1722
  slate.Editor.nodes(editor, {
1375
1723
  at: slate.Editor.unhangRange(editor, selection),
@@ -1433,7 +1781,7 @@ const BlocksToolbar = () => {
1433
1781
  return false;
1434
1782
  };
1435
1783
  const isButtonDisabled = checkButtonDisabled();
1436
- return /* @__PURE__ */ jsxRuntime.jsx(Toolbar__namespace.Root, { "aria-disabled": disabled, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(ToolbarWrapper, { gap: 2, padding: 2, children: [
1784
+ return /* @__PURE__ */ jsxRuntime.jsx(Toolbar__namespace.Root, { "aria-disabled": disabled, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(ToolbarWrapper, { gap: 2, padding: 2, width: "100%", children: [
1437
1785
  /* @__PURE__ */ jsxRuntime.jsx(BlocksDropdown, {}),
1438
1786
  /* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
1439
1787
  /* @__PURE__ */ jsxRuntime.jsx(Toolbar__namespace.ToggleGroup, { type: "multiple", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, children: [
@@ -1458,7 +1806,7 @@ const BlocksToolbar = () => {
1458
1806
  ] }) })
1459
1807
  ] }) });
1460
1808
  };
1461
- const StyledEditable = styled__default.default(slateReact.Editable)`
1809
+ const StyledEditable = styledComponents.styled(slateReact.Editable)`
1462
1810
  // The outline style is set on the wrapper with :focus-within
1463
1811
  outline: none;
1464
1812
  display: flex;
@@ -1473,20 +1821,20 @@ const StyledEditable = styled__default.default(slateReact.Editable)`
1473
1821
  padding-bottom: ${({ theme }) => theme.spaces[3]};
1474
1822
  }
1475
1823
  `;
1476
- const Wrapper$1 = styled__default.default(designSystem.Box)`
1824
+ const Wrapper$1 = styledComponents.styled(designSystem.Box)`
1477
1825
  position: ${({ isOverDropTarget }) => isOverDropTarget && "relative"};
1478
1826
  `;
1479
- const DropPlaceholder = styled__default.default(designSystem.Box)`
1827
+ const DropPlaceholder = styledComponents.styled(designSystem.Box)`
1480
1828
  position: absolute;
1481
1829
  right: 0;
1482
1830
 
1483
1831
  // Show drop placeholder 8px above or below the drop target
1484
- ${({ dragDirection, theme, placeholderMargin }) => styled.css`
1832
+ ${({ dragDirection, theme, placeholderMargin }) => styledComponents.css`
1485
1833
  top: ${dragDirection === useDragAndDrop.DIRECTIONS.UPWARD && `-${theme.spaces[placeholderMargin]}`};
1486
1834
  bottom: ${dragDirection === useDragAndDrop.DIRECTIONS.DOWNWARD && `-${theme.spaces[placeholderMargin]}`};
1487
1835
  `}
1488
1836
  `;
1489
- const DragItem = styled__default.default(designSystem.Flex)`
1837
+ const DragItem = styledComponents.styled(designSystem.Flex)`
1490
1838
  // Style each block rendered using renderElement()
1491
1839
  & > [data-slate-node='element'] {
1492
1840
  width: 100%;
@@ -1495,41 +1843,44 @@ const DragItem = styled__default.default(designSystem.Flex)`
1495
1843
 
1496
1844
  // Set the visibility of drag button
1497
1845
  [role='button'] {
1498
- visibility: ${(props) => props.dragVisibility};
1846
+ visibility: ${(props) => props.$dragVisibility};
1499
1847
  opacity: inherit;
1500
1848
  }
1501
1849
  &[aria-disabled='true'] {
1502
1850
  user-drag: none;
1503
1851
  }
1504
1852
  `;
1505
- const DragIconButton = styled__default.default(designSystem.IconButton)`
1853
+ const DragIconButton = styledComponents.styled(designSystem.IconButton)`
1854
+ user-select: none;
1506
1855
  display: flex;
1507
1856
  align-items: center;
1508
1857
  justify-content: center;
1858
+ border: none;
1509
1859
  border-radius: ${({ theme }) => theme.borderRadius};
1510
- width: ${({ theme }) => theme.spaces[4]};
1511
- height: ${({ theme }) => theme.spaces[6]};
1860
+ padding-left: ${({ theme }) => theme.spaces[0]};
1861
+ padding-right: ${({ theme }) => theme.spaces[0]};
1862
+ padding-top: ${({ theme }) => theme.spaces[1]};
1863
+ padding-bottom: ${({ theme }) => theme.spaces[1]};
1512
1864
  visibility: hidden;
1513
1865
  cursor: grab;
1514
1866
  opacity: inherit;
1515
- margin-top: ${(props) => props.dragHandleTopMargin ?? 0};
1867
+ margin-top: ${(props) => props.$dragHandleTopMargin ?? 0};
1516
1868
 
1517
1869
  &:hover {
1518
- background: ${({ theme }) => theme.colors.neutral200};
1870
+ background: ${({ theme }) => theme.colors.neutral100};
1519
1871
  }
1520
1872
  &:active {
1521
1873
  cursor: grabbing;
1874
+ background: ${({ theme }) => theme.colors.neutral150};
1522
1875
  }
1523
1876
  &[aria-disabled='true'] {
1524
- cursor: not-allowed;
1525
- background: transparent;
1877
+ visibility: hidden;
1526
1878
  }
1527
1879
  svg {
1528
- height: auto;
1529
- width: ${({ theme }) => theme.spaces[3]};
1880
+ min-width: ${({ theme }) => theme.spaces[3]};
1530
1881
 
1531
1882
  path {
1532
- fill: ${({ theme }) => theme.colors.neutral700};
1883
+ fill: ${({ theme }) => theme.colors.neutral500};
1533
1884
  }
1534
1885
  }
1535
1886
  `;
@@ -1574,8 +1925,7 @@ const DragAndDropElement = ({
1574
1925
  displayedValue: children
1575
1926
  },
1576
1927
  onDropItem(currentIndex, newIndex) {
1577
- if (newIndex)
1578
- handleMoveBlock(newIndex, currentIndex);
1928
+ if (newIndex) handleMoveBlock(newIndex, currentIndex);
1579
1929
  }
1580
1930
  });
1581
1931
  const composedBoxRefs = designSystem.useComposedRefs(blockRef, dropRef);
@@ -1587,7 +1937,7 @@ const DragAndDropElement = ({
1587
1937
  React__namespace.useEffect(() => {
1588
1938
  setDragVisibility("hidden");
1589
1939
  }, [editor.selection]);
1590
- return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper$1, { ref: (ref) => composedBoxRefs(ref), isOverDropTarget, children: [
1940
+ return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper$1, { ref: composedBoxRefs, isOverDropTarget, children: [
1591
1941
  isOverDropTarget && /* @__PURE__ */ jsxRuntime.jsx(
1592
1942
  DropPlaceholder,
1593
1943
  {
@@ -1625,15 +1975,17 @@ const DragAndDropElement = ({
1625
1975
  onSelect: () => setDragVisibility("visible"),
1626
1976
  onMouseLeave: () => setDragVisibility("hidden"),
1627
1977
  "aria-disabled": disabled,
1628
- dragVisibility,
1978
+ $dragVisibility: dragVisibility,
1629
1979
  children: [
1630
1980
  /* @__PURE__ */ jsxRuntime.jsx(
1631
1981
  DragIconButton,
1632
1982
  {
1633
- forwardedAs: "div",
1983
+ tag: "div",
1984
+ contentEditable: false,
1634
1985
  role: "button",
1635
1986
  tabIndex: 0,
1636
- "aria-label": formatMessage({
1987
+ withTooltip: false,
1988
+ label: formatMessage({
1637
1989
  id: index.getTranslation("components.DragHandle-label"),
1638
1990
  defaultMessage: "Drag"
1639
1991
  }),
@@ -1641,8 +1993,8 @@ const DragAndDropElement = ({
1641
1993
  "aria-disabled": disabled,
1642
1994
  disabled,
1643
1995
  draggable: true,
1644
- dragHandleTopMargin,
1645
- children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, { color: "neutral600" })
1996
+ $dragHandleTopMargin: dragHandleTopMargin,
1997
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, { color: "primary500" })
1646
1998
  }
1647
1999
  ),
1648
2000
  children
@@ -1653,17 +2005,18 @@ const DragAndDropElement = ({
1653
2005
  };
1654
2006
  const CloneDragItem = ({ children, dragHandleTopMargin }) => {
1655
2007
  const { formatMessage } = reactIntl.useIntl();
1656
- return /* @__PURE__ */ jsxRuntime.jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", dragVisibility: "visible", children: [
2008
+ return /* @__PURE__ */ jsxRuntime.jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", $dragVisibility: "visible", children: [
1657
2009
  /* @__PURE__ */ jsxRuntime.jsx(
1658
2010
  DragIconButton,
1659
2011
  {
1660
- forwardedAs: "div",
2012
+ tag: "div",
1661
2013
  role: "button",
1662
- "aria-label": formatMessage({
2014
+ withTooltip: false,
2015
+ label: formatMessage({
1663
2016
  id: index.getTranslation("components.DragHandle-label"),
1664
2017
  defaultMessage: "Drag"
1665
2018
  }),
1666
- dragHandleTopMargin,
2019
+ $dragHandleTopMargin: dragHandleTopMargin,
1667
2020
  children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, { color: "neutral600" })
1668
2021
  }
1669
2022
  ),
@@ -1678,7 +2031,7 @@ const baseRenderLeaf = (props, modifiers2) => {
1678
2031
  }
1679
2032
  return currentChildren;
1680
2033
  }, props.children);
1681
- return /* @__PURE__ */ jsxRuntime.jsx("span", { ...props.attributes, children: wrappedChildren });
2034
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { ...props.attributes, className: props.leaf.className, children: wrappedChildren });
1682
2035
  };
1683
2036
  const baseRenderElement = ({
1684
2037
  props,
@@ -1716,8 +2069,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
1716
2069
  [modifiers2]
1717
2070
  );
1718
2071
  const handleMoveBlocks = (editor2, event) => {
1719
- if (!editor2.selection)
1720
- return;
2072
+ if (!editor2.selection) return;
1721
2073
  const start = slate.Range.start(editor2.selection);
1722
2074
  const currentIndex = [start.path[0]];
1723
2075
  let newIndexPosition = 0;
@@ -1854,8 +2206,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
1854
2206
  }
1855
2207
  };
1856
2208
  const handleScrollSelectionIntoView = () => {
1857
- if (!editor.selection)
1858
- return;
2209
+ if (!editor.selection) return;
1859
2210
  const domRange = slateReact.ReactEditor.toDOMRange(editor, editor.selection);
1860
2211
  const domRect = domRange.getBoundingClientRect();
1861
2212
  const blocksInput = blocksRef.current;
@@ -1882,7 +2233,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
1882
2233
  background: "neutral0",
1883
2234
  color: "neutral800",
1884
2235
  lineHeight: 6,
1885
- paddingRight: 4,
2236
+ paddingRight: 7,
1886
2237
  paddingTop: 6,
1887
2238
  paddingBottom: 3,
1888
2239
  children: [
@@ -1893,6 +2244,7 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
1893
2244
  readOnly: disabled,
1894
2245
  placeholder,
1895
2246
  isExpandedMode,
2247
+ decorate: decorateCode,
1896
2248
  renderElement,
1897
2249
  renderLeaf,
1898
2250
  onKeyDown: handleKeyDown,
@@ -1910,12 +2262,12 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
1910
2262
  }
1911
2263
  );
1912
2264
  };
1913
- const CollapseIconButton = styled__default.default(designSystem.IconButton)`
2265
+ const CollapseIconButton = styledComponents.styled(designSystem.IconButton)`
1914
2266
  position: absolute;
1915
2267
  bottom: 1.2rem;
1916
2268
  right: 1.2rem;
1917
2269
  `;
1918
- const ExpandWrapper$1 = styled__default.default(designSystem.Flex)`
2270
+ const ExpandWrapper$1 = styledComponents.styled(designSystem.Flex)`
1919
2271
  // Background with 20% opacity
1920
2272
  background: ${({ theme }) => `${theme.colors.neutral800}1F`};
1921
2273
  `;
@@ -1965,7 +2317,7 @@ const EditorLayout$1 = ({
1965
2317
  /* @__PURE__ */ jsxRuntime.jsx(
1966
2318
  CollapseIconButton,
1967
2319
  {
1968
- "aria-label": formatMessage({
2320
+ label: formatMessage({
1969
2321
  id: index.getTranslation("components.Blocks.collapse"),
1970
2322
  defaultMessage: "Collapse"
1971
2323
  }),
@@ -1980,13 +2332,13 @@ const EditorLayout$1 = ({
1980
2332
  ) }) });
1981
2333
  }
1982
2334
  return /* @__PURE__ */ jsxRuntime.jsx(
1983
- designSystem.InputWrapper,
2335
+ InputWrapper,
1984
2336
  {
1985
2337
  direction: "column",
1986
2338
  alignItems: "flex-start",
1987
2339
  height: "512px",
1988
- disabled,
1989
- hasError: Boolean(error),
2340
+ $disabled: disabled,
2341
+ $hasError: Boolean(error),
1990
2342
  style: { overflow: "hidden" },
1991
2343
  "aria-describedby": ariaDescriptionId,
1992
2344
  position: "relative",
@@ -1994,25 +2346,52 @@ const EditorLayout$1 = ({
1994
2346
  }
1995
2347
  );
1996
2348
  };
1997
- const stylesToInherit = styled.css`
2349
+ const InputWrapper = styledComponents.styled(designSystem.Flex)`
2350
+ border: 1px solid
2351
+ ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
2352
+ border-radius: ${({ theme }) => theme.borderRadius};
2353
+ background: ${({ theme }) => theme.colors.neutral0};
2354
+
2355
+ ${({ theme, $hasError = false }) => styledComponents.css`
2356
+ outline: none;
2357
+ box-shadow: 0;
2358
+ transition-property: border-color, box-shadow, fill;
2359
+ transition-duration: 0.2s;
2360
+
2361
+ &:focus-within {
2362
+ border: 1px solid ${$hasError ? theme.colors.danger600 : theme.colors.primary600};
2363
+ box-shadow: ${$hasError ? theme.colors.danger600 : theme.colors.primary600} 0px 0px 0px 2px;
2364
+ }
2365
+ `}
2366
+
2367
+ ${({ theme, $disabled }) => $disabled ? styledComponents.css`
2368
+ color: ${theme.colors.neutral600};
2369
+ background: ${theme.colors.neutral150};
2370
+ ` : void 0}
2371
+ `;
2372
+ const stylesToInherit = styledComponents.css`
1998
2373
  font-size: inherit;
1999
2374
  color: inherit;
2000
2375
  line-height: inherit;
2001
2376
  `;
2002
- const BoldText = styled__default.default(designSystem.Typography).attrs({ fontWeight: "bold" })`
2377
+ const BoldText = styledComponents.styled(designSystem.Typography).attrs({ fontWeight: "bold" })`
2003
2378
  ${stylesToInherit}
2004
2379
  `;
2005
- const ItalicText = styled__default.default(designSystem.Typography)`
2380
+ const ItalicText = styledComponents.styled(designSystem.Typography)`
2006
2381
  font-style: italic;
2007
2382
  ${stylesToInherit}
2008
2383
  `;
2009
- const UnderlineText = styled__default.default(designSystem.Typography).attrs({ textDecoration: "underline" })`
2384
+ const UnderlineText = styledComponents.styled(designSystem.Typography).attrs({
2385
+ textDecoration: "underline"
2386
+ })`
2010
2387
  ${stylesToInherit}
2011
2388
  `;
2012
- const StrikeThroughText = styled__default.default(designSystem.Typography).attrs({ textDecoration: "line-through" })`
2389
+ const StrikeThroughText = styledComponents.styled(designSystem.Typography).attrs({
2390
+ textDecoration: "line-through"
2391
+ })`
2013
2392
  ${stylesToInherit}
2014
2393
  `;
2015
- const InlineCode = styled__default.default.code`
2394
+ const InlineCode = styledComponents.styled.code`
2016
2395
  background-color: ${({ theme }) => theme.colors.neutral150};
2017
2396
  border-radius: ${({ theme }) => theme.borderRadius};
2018
2397
  padding: ${({ theme }) => `0 ${theme.spaces[2]}`};
@@ -2022,8 +2401,7 @@ const InlineCode = styled__default.default.code`
2022
2401
  `;
2023
2402
  const baseCheckIsActive = (editor, name2) => {
2024
2403
  const marks = slate.Editor.marks(editor);
2025
- if (!marks)
2026
- return false;
2404
+ if (!marks) return false;
2027
2405
  return Boolean(marks[name2]);
2028
2406
  };
2029
2407
  const baseHandleToggle = (editor, name2) => {
@@ -2182,13 +2560,14 @@ function useBlocksEditorContext(consumerName) {
2182
2560
  editor
2183
2561
  };
2184
2562
  }
2185
- const EditorDivider = styled__default.default(designSystem.Divider)`
2563
+ const EditorDivider = styledComponents.styled(designSystem.Divider)`
2186
2564
  background: ${({ theme }) => theme.colors.neutral200};
2187
2565
  `;
2188
- const ExpandIconButton = styled__default.default(designSystem.IconButton)`
2566
+ const ExpandIconButton = styledComponents.styled(designSystem.IconButton)`
2189
2567
  position: absolute;
2190
2568
  bottom: 1.2rem;
2191
2569
  right: 1.2rem;
2570
+ box-shadow: ${({ theme }) => theme.shadows.filterShadow};
2192
2571
  `;
2193
2572
  function useResetKey(value) {
2194
2573
  const slateUpdatesCount = React__namespace.useRef(0);
@@ -2277,7 +2656,7 @@ const BlocksEditor = React__namespace.forwardRef(
2277
2656
  !isExpandedMode && /* @__PURE__ */ jsxRuntime.jsx(
2278
2657
  ExpandIconButton,
2279
2658
  {
2280
- "aria-label": formatMessage({
2659
+ label: formatMessage({
2281
2660
  id: index.getTranslation("components.Blocks.expand"),
2282
2661
  defaultMessage: "Expand"
2283
2662
  }),
@@ -2300,8 +2679,8 @@ const BlocksInput = React__namespace.forwardRef(
2300
2679
  ({ label, name: name2, required = false, hint, labelAction, ...editorProps }, forwardedRef) => {
2301
2680
  const id = React__namespace.useId();
2302
2681
  const field = strapiAdmin.useField(name2);
2303
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
2304
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { action: labelAction, children: label }),
2682
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
2683
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
2305
2684
  /* @__PURE__ */ jsxRuntime.jsx(
2306
2685
  BlocksEditor,
2307
2686
  {
@@ -2314,11 +2693,12 @@ const BlocksInput = React__namespace.forwardRef(
2314
2693
  ...editorProps
2315
2694
  }
2316
2695
  ),
2317
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldHint, {}),
2318
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldError, {})
2696
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
2697
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
2319
2698
  ] }) });
2320
2699
  }
2321
2700
  );
2701
+ const MemoizedBlocksInput = React__namespace.memo(BlocksInput);
2322
2702
  const createDefaultForm = (contentType, components = {}) => {
2323
2703
  const traverseSchema = (attributes) => {
2324
2704
  return Object.entries(attributes).reduce((acc, [key, attribute]) => {
@@ -2342,47 +2722,44 @@ const createDefaultForm = (contentType, components = {}) => {
2342
2722
  const Initializer = ({ disabled, name: name2, onClick }) => {
2343
2723
  const { formatMessage } = reactIntl.useIntl();
2344
2724
  const field = strapiAdmin.useField(name2);
2345
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2346
- /* @__PURE__ */ jsxRuntime.jsx(
2347
- designSystem.Box,
2348
- {
2349
- as: "button",
2350
- background: "neutral100",
2351
- borderColor: field.error ? "danger600" : "neutral200",
2352
- hasRadius: true,
2353
- disabled,
2354
- onClick,
2355
- paddingTop: 9,
2356
- paddingBottom: 9,
2357
- type: "button",
2358
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
2359
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(CircleIcon, {}) }),
2360
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "primary600", variant: "pi", fontWeight: "bold", children: formatMessage({
2361
- id: index.getTranslation("components.empty-repeatable"),
2362
- defaultMessage: "No entry yet. Click on the button below to add one."
2363
- }) }) })
2364
- ] })
2365
- }
2366
- ),
2367
- field.error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "pi", children: field.error })
2368
- ] });
2725
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
2726
+ designSystem.Box,
2727
+ {
2728
+ tag: "button",
2729
+ background: disabled ? "neutral150" : "neutral100",
2730
+ borderColor: field.error ? "danger600" : "neutral200",
2731
+ hasRadius: true,
2732
+ disabled,
2733
+ onClick,
2734
+ paddingTop: 9,
2735
+ paddingBottom: 9,
2736
+ type: "button",
2737
+ style: { cursor: disabled ? "not-allowed" : "pointer" },
2738
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
2739
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", color: disabled ? "neutral500" : "primary600", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.PlusCircle, { width: "3.2rem", height: "3.2rem" }) }),
2740
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(
2741
+ designSystem.Typography,
2742
+ {
2743
+ textColor: disabled ? "neutral600" : "primary600",
2744
+ variant: "pi",
2745
+ fontWeight: "bold",
2746
+ children: formatMessage({
2747
+ id: index.getTranslation("components.empty-repeatable"),
2748
+ defaultMessage: "No entry yet. Click to add one."
2749
+ })
2750
+ }
2751
+ ) })
2752
+ ] })
2753
+ }
2754
+ ) });
2369
2755
  };
2370
- const CircleIcon = styled__default.default(Icons.PlusCircle)`
2371
- width: 2.4rem;
2372
- height: 2.4rem;
2373
- > circle {
2374
- fill: ${({ theme }) => theme.colors.primary200};
2375
- }
2376
- > path {
2377
- fill: ${({ theme }) => theme.colors.primary600};
2378
- }
2379
- `;
2380
2756
  const NonRepeatableComponent = ({
2381
2757
  attribute,
2382
2758
  name: name2,
2383
2759
  children,
2384
2760
  layout
2385
2761
  }) => {
2762
+ const { formatMessage } = reactIntl.useIntl();
2386
2763
  const { value } = strapiAdmin.useField(name2);
2387
2764
  const level = Relations.useComponent("NonRepeatableComponent", (state) => state.level);
2388
2765
  const isNested = level > 0;
@@ -2397,9 +2774,24 @@ const NonRepeatableComponent = ({
2397
2774
  hasRadius: isNested,
2398
2775
  borderColor: isNested ? "neutral200" : void 0,
2399
2776
  children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index2) => {
2400
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: row.map(({ size, ...field }) => {
2777
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
2401
2778
  const completeFieldName = `${name2}.${field.name}`;
2402
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2779
+ const translatedLabel = formatMessage({
2780
+ id: `content-manager.components.${attribute.component}.${field.name}`,
2781
+ defaultMessage: field.label
2782
+ });
2783
+ return /* @__PURE__ */ jsxRuntime.jsx(
2784
+ designSystem.Grid.Item,
2785
+ {
2786
+ col: size,
2787
+ s: 12,
2788
+ xs: 12,
2789
+ direction: "column",
2790
+ alignItems: "stretch",
2791
+ children: children({ ...field, label: translatedLabel, name: completeFieldName })
2792
+ },
2793
+ completeFieldName
2794
+ );
2403
2795
  }) }, index2);
2404
2796
  }) })
2405
2797
  }
@@ -2418,13 +2810,34 @@ const RepeatableComponent = ({
2418
2810
  const { search: searchString } = reactRouterDom.useLocation();
2419
2811
  const search = React__namespace.useMemo(() => new URLSearchParams(searchString), [searchString]);
2420
2812
  const { components } = index.useDoc();
2421
- const { value = [], error } = strapiAdmin.useField(name2);
2813
+ const {
2814
+ value = [],
2815
+ error,
2816
+ rawError
2817
+ } = strapiAdmin.useField(name2);
2422
2818
  const addFieldRow = strapiAdmin.useForm("RepeatableComponent", (state) => state.addFieldRow);
2423
2819
  const moveFieldRow = strapiAdmin.useForm("RepeatableComponent", (state) => state.moveFieldRow);
2424
2820
  const removeFieldRow = strapiAdmin.useForm("RepeatableComponent", (state) => state.removeFieldRow);
2425
2821
  const { max = Infinity } = attribute;
2426
- const [collapseToOpen, setCollapseToOpen] = React__namespace.useState(null);
2822
+ const [collapseToOpen, setCollapseToOpen] = React__namespace.useState("");
2427
2823
  const [liveText, setLiveText] = React__namespace.useState("");
2824
+ React__namespace.useEffect(() => {
2825
+ const hasNestedErrors = rawError && Array.isArray(rawError) && rawError.length > 0;
2826
+ const hasNestedValue = value && Array.isArray(value) && value.length > 0;
2827
+ if (hasNestedErrors && hasNestedValue) {
2828
+ const errorOpenItems = rawError.map((_, idx) => {
2829
+ return value[idx] ? value[idx].__temp_key__ : null;
2830
+ }).filter((value2) => !!value2);
2831
+ if (errorOpenItems && errorOpenItems.length > 0) {
2832
+ setCollapseToOpen((collapseToOpen2) => {
2833
+ if (!errorOpenItems.includes(collapseToOpen2)) {
2834
+ return errorOpenItems[0];
2835
+ }
2836
+ return collapseToOpen2;
2837
+ });
2838
+ }
2839
+ }
2840
+ }, [rawError, value]);
2428
2841
  const componentTmpKeyWithFocussedField = React__namespace.useMemo(() => {
2429
2842
  if (search.has("field")) {
2430
2843
  const fieldParam = search.get("field");
@@ -2439,13 +2852,19 @@ const RepeatableComponent = ({
2439
2852
  }
2440
2853
  return void 0;
2441
2854
  }, [search, name2, value]);
2855
+ const prevValue = useDebounce.usePrev(value);
2856
+ React__namespace.useEffect(() => {
2857
+ if (prevValue && prevValue.length < value.length) {
2858
+ setCollapseToOpen(value[value.length - 1].__temp_key__);
2859
+ }
2860
+ }, [value, prevValue]);
2442
2861
  React__namespace.useEffect(() => {
2443
- if (typeof componentTmpKeyWithFocussedField === "number") {
2862
+ if (typeof componentTmpKeyWithFocussedField === "string") {
2444
2863
  setCollapseToOpen(componentTmpKeyWithFocussedField);
2445
2864
  }
2446
2865
  }, [componentTmpKeyWithFocussedField]);
2447
2866
  const toggleCollapses = () => {
2448
- setCollapseToOpen(null);
2867
+ setCollapseToOpen("");
2449
2868
  };
2450
2869
  const handleClick = () => {
2451
2870
  if (value.length < max) {
@@ -2477,12 +2896,8 @@ const RepeatableComponent = ({
2477
2896
  );
2478
2897
  moveFieldRow(name2, currentIndex, newIndex);
2479
2898
  };
2480
- const handleToggle = (key) => () => {
2481
- if (collapseToOpen === key) {
2482
- setCollapseToOpen(null);
2483
- } else {
2484
- setCollapseToOpen(key);
2485
- }
2899
+ const handleValueChange = (key) => {
2900
+ setCollapseToOpen(key);
2486
2901
  };
2487
2902
  const getItemPos = (index2) => `${index2 + 1} of ${value.length}`;
2488
2903
  const handleCancel = (index$1) => {
@@ -2537,158 +2952,123 @@ const RepeatableComponent = ({
2537
2952
  defaultMessage: `Press spacebar to grab and re-order`
2538
2953
  }) }),
2539
2954
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
2540
- /* @__PURE__ */ jsxRuntime.jsxs(AccordionGroup, { error, children: [
2541
- /* @__PURE__ */ jsxRuntime.jsx(AccordionContent, { "aria-describedby": ariaDescriptionId, children: value.map(({ __temp_key__: key, id }, index2) => {
2542
- const nameWithIndex = `${name2}.${index2}`;
2543
- return /* @__PURE__ */ jsxRuntime.jsx(
2544
- Relations.ComponentProvider,
2545
- {
2546
- id,
2547
- uid: attribute.component,
2548
- level: level + 1,
2549
- type: "repeatable",
2550
- children: /* @__PURE__ */ jsxRuntime.jsx(
2551
- Component,
2955
+ /* @__PURE__ */ jsxRuntime.jsxs(
2956
+ AccordionRoot,
2957
+ {
2958
+ $error: error,
2959
+ value: collapseToOpen,
2960
+ onValueChange: handleValueChange,
2961
+ "aria-describedby": ariaDescriptionId,
2962
+ children: [
2963
+ value.map(({ __temp_key__: key, id }, index2) => {
2964
+ const nameWithIndex = `${name2}.${index2}`;
2965
+ return /* @__PURE__ */ jsxRuntime.jsx(
2966
+ Relations.ComponentProvider,
2552
2967
  {
2553
- disabled,
2554
- name: nameWithIndex,
2555
- attribute,
2556
- index: index2,
2557
- isOpen: collapseToOpen === key,
2558
- mainField,
2559
- onMoveItem: handleMoveComponentField,
2560
- onClickToggle: handleToggle(key),
2561
- onDeleteComponent: () => {
2562
- removeFieldRow(name2, index2);
2563
- toggleCollapses();
2564
- },
2565
- toggleCollapses,
2566
- onCancel: handleCancel,
2567
- onDropItem: handleDropItem,
2568
- onGrabItem: handleGrabItem,
2569
- children: layout.map((row, index22) => {
2570
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: row.map(({ size, ...field }) => {
2571
- const completeFieldName = `${nameWithIndex}.${field.name}`;
2572
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2573
- }) }, index22);
2574
- })
2575
- }
2576
- )
2577
- },
2578
- key
2579
- );
2580
- }) }),
2581
- /* @__PURE__ */ jsxRuntime.jsx(AccordionFooter, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", height: "48px", background: "neutral0", children: /* @__PURE__ */ jsxRuntime.jsx(TextButtonCustom, { disabled, onClick: handleClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Plus, {}), children: formatMessage({
2582
- id: index.getTranslation("containers.EditView.add.new-entry"),
2583
- defaultMessage: "Add an entry"
2584
- }) }) }) })
2585
- ] })
2968
+ id,
2969
+ uid: attribute.component,
2970
+ level: level + 1,
2971
+ type: "repeatable",
2972
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2973
+ Component,
2974
+ {
2975
+ disabled,
2976
+ name: nameWithIndex,
2977
+ attribute,
2978
+ index: index2,
2979
+ mainField,
2980
+ onMoveItem: handleMoveComponentField,
2981
+ onDeleteComponent: () => {
2982
+ removeFieldRow(name2, index2);
2983
+ toggleCollapses();
2984
+ },
2985
+ toggleCollapses,
2986
+ onCancel: handleCancel,
2987
+ onDropItem: handleDropItem,
2988
+ onGrabItem: handleGrabItem,
2989
+ __temp_key__: key,
2990
+ children: layout.map((row, index22) => {
2991
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
2992
+ const completeFieldName = `${nameWithIndex}.${field.name}`;
2993
+ const translatedLabel = formatMessage({
2994
+ id: `content-manager.components.${attribute.component}.${field.name}`,
2995
+ defaultMessage: field.label
2996
+ });
2997
+ return /* @__PURE__ */ jsxRuntime.jsx(
2998
+ designSystem.Grid.Item,
2999
+ {
3000
+ col: size,
3001
+ s: 12,
3002
+ xs: 12,
3003
+ direction: "column",
3004
+ alignItems: "stretch",
3005
+ children: children({
3006
+ ...field,
3007
+ label: translatedLabel,
3008
+ name: completeFieldName
3009
+ })
3010
+ },
3011
+ completeFieldName
3012
+ );
3013
+ }) }, index22);
3014
+ })
3015
+ }
3016
+ )
3017
+ },
3018
+ key
3019
+ );
3020
+ }),
3021
+ /* @__PURE__ */ jsxRuntime.jsx(TextButtonCustom, { disabled, onClick: handleClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Plus, {}), children: formatMessage({
3022
+ id: index.getTranslation("containers.EditView.add.new-entry"),
3023
+ defaultMessage: "Add an entry"
3024
+ }) })
3025
+ ]
3026
+ }
3027
+ )
2586
3028
  ] });
2587
3029
  };
2588
- const TextButtonCustom = styled__default.default(designSystem.TextButton)`
2589
- height: 100%;
3030
+ const AccordionRoot = styledComponents.styled(designSystem.Accordion.Root)`
3031
+ border: 1px solid
3032
+ ${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
3033
+ `;
3034
+ const TextButtonCustom = styledComponents.styled(designSystem.TextButton)`
2590
3035
  width: 100%;
2591
- border-radius: 0 0 4px 4px;
2592
3036
  display: flex;
2593
3037
  justify-content: center;
2594
- span {
2595
- font-weight: 600;
2596
- font-size: 14px;
2597
- }
2598
- `;
2599
- const AccordionFooter = styled__default.default(designSystem.Box)`
2600
- overflow: hidden;
2601
- border-bottom: 1px solid ${({ theme }) => theme.colors.neutral200};
2602
- border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
2603
- border-left: 1px solid ${({ theme }) => theme.colors.neutral200};
2604
- border-radius: 0 0 ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius};
2605
- `;
2606
- const AccordionContent = styled__default.default(designSystem.Box)`
2607
- border-bottom: none;
3038
+ border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
3039
+ padding-inline: ${(props) => props.theme.spaces[6]};
3040
+ padding-block: ${(props) => props.theme.spaces[3]};
2608
3041
 
2609
- /* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
2610
- & > div > div {
2611
- border: 1px solid ${({ theme }) => theme.colors.neutral200};
2612
- border-top-color: transparent;
2613
- }
2614
-
2615
- /* the top accordion _does_ need a border though */
2616
- & > div:first-child > div {
2617
- border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
2618
- }
2619
-
2620
- /* Reset all the border-radius' */
2621
- & > div > div,
2622
- & > div > div > div {
2623
- border-radius: unset;
2624
- }
2625
-
2626
- /* Give the border radius back to the first accordion */
2627
- & > div:first-child > div,
2628
- & > div:first-child > div > div {
2629
- border-radius: ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius} 0 0;
2630
- }
2631
-
2632
- & > div > div[data-strapi-expanded='true'] {
2633
- border: 1px solid ${({ theme }) => theme.colors.primary600};
2634
- }
2635
- `;
2636
- const AccordionGroup = ({ children, error }) => {
2637
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.KeyboardNavigable, { attributeName: "data-strapi-accordion-toggle", children: [
2638
- children,
2639
- error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "danger600", children: error }) })
2640
- ] });
2641
- };
2642
- const CustomIconButton$1 = styled__default.default(designSystem.IconButton)`
2643
- background-color: transparent;
3042
+ &:not([disabled]) {
3043
+ cursor: pointer;
2644
3044
 
2645
- svg {
2646
- path {
2647
- fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : theme.colors.neutral600};
3045
+ &:hover {
3046
+ background-color: ${(props) => props.theme.colors.primary100};
2648
3047
  }
2649
3048
  }
2650
3049
 
2651
- &:hover {
2652
- svg {
2653
- path {
2654
- fill: ${({ theme }) => theme.colors.primary600};
2655
- }
2656
- }
3050
+ span {
3051
+ font-weight: 600;
3052
+ font-size: 1.4rem;
3053
+ line-height: 2.4rem;
2657
3054
  }
2658
- `;
2659
- const ActionsFlex$1 = styled__default.default(designSystem.Flex)`
2660
- & .drag-handle {
2661
- background: unset;
2662
-
2663
- svg {
2664
- path {
2665
- fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : void 0};
2666
- }
2667
- }
2668
3055
 
2669
- &:hover {
2670
- svg {
2671
- path {
2672
- /* keeps the hover style of the accordion */
2673
- fill: ${({ theme }) => theme.colors.primary600};
2674
- }
2675
- }
2676
- }
3056
+ @media (prefers-reduced-motion: no-preference) {
3057
+ transition: background-color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
2677
3058
  }
2678
3059
  `;
2679
3060
  const Component = ({
2680
3061
  disabled,
2681
3062
  index: index$1,
2682
- isOpen,
2683
3063
  name: name2,
2684
3064
  mainField = {
2685
3065
  name: "id",
2686
3066
  type: "integer"
2687
3067
  },
2688
3068
  children,
2689
- onClickToggle,
2690
3069
  onDeleteComponent,
2691
3070
  toggleCollapses,
3071
+ __temp_key__,
2692
3072
  ...dragProps
2693
3073
  }) => {
2694
3074
  const { formatMessage } = reactIntl.useIntl();
@@ -2713,50 +3093,44 @@ const Component = ({
2713
3093
  dragPreviewRef(reactDndHtml5Backend.getEmptyImage(), { captureDraggingState: false });
2714
3094
  }, [dragPreviewRef, index$1]);
2715
3095
  const composedAccordionRefs = designSystem.useComposedRefs(accordionRef, dragRef);
2716
- const composedBoxRefs = designSystem.useComposedRefs(boxRef, dropRef);
2717
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { ref: (ref) => composedBoxRefs(ref), children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview$1, {}) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion, { expanded: isOpen, onToggle: onClickToggle, id: name2, size: "S", children: [
2718
- /* @__PURE__ */ jsxRuntime.jsx(
2719
- designSystem.AccordionToggle,
2720
- {
2721
- action: disabled ? null : /* @__PURE__ */ jsxRuntime.jsxs(ActionsFlex$1, { gap: 0, expanded: isOpen, children: [
2722
- /* @__PURE__ */ jsxRuntime.jsx(
2723
- CustomIconButton$1,
2724
- {
2725
- expanded: isOpen,
2726
- borderWidth: 0,
2727
- onClick: onDeleteComponent,
2728
- label: formatMessage({
2729
- id: index.getTranslation("containers.Edit.delete"),
2730
- defaultMessage: "Delete"
2731
- }),
2732
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {})
2733
- }
2734
- ),
2735
- /* @__PURE__ */ jsxRuntime.jsx(
2736
- designSystem.IconButton,
2737
- {
2738
- className: "drag-handle",
2739
- ref: composedAccordionRefs,
2740
- forwardedAs: "div",
2741
- role: "button",
2742
- borderWidth: 0,
2743
- tabIndex: 0,
2744
- onClick: (e) => e.stopPropagation(),
2745
- "data-handler-id": handlerId,
2746
- label: formatMessage({
2747
- id: index.getTranslation("components.DragHandle-label"),
2748
- defaultMessage: "Drag"
2749
- }),
2750
- onKeyDown: handleKeyDown,
2751
- children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, {})
2752
- }
2753
- )
2754
- ] }),
2755
- title: displayValue,
2756
- togglePosition: "left"
2757
- }
2758
- ),
2759
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.AccordionContent, { children: /* @__PURE__ */ jsxRuntime.jsx(
3096
+ const composedBoxRefs = designSystem.useComposedRefs(
3097
+ boxRef,
3098
+ dropRef
3099
+ );
3100
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview$1, {}) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { ref: composedBoxRefs, value: __temp_key__, children: [
3101
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
3102
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: displayValue }),
3103
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Actions, { children: [
3104
+ /* @__PURE__ */ jsxRuntime.jsx(
3105
+ designSystem.IconButton,
3106
+ {
3107
+ variant: "ghost",
3108
+ onClick: onDeleteComponent,
3109
+ label: formatMessage({
3110
+ id: index.getTranslation("containers.Edit.delete"),
3111
+ defaultMessage: "Delete"
3112
+ }),
3113
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {})
3114
+ }
3115
+ ),
3116
+ /* @__PURE__ */ jsxRuntime.jsx(
3117
+ designSystem.IconButton,
3118
+ {
3119
+ ref: composedAccordionRefs,
3120
+ variant: "ghost",
3121
+ onClick: (e) => e.stopPropagation(),
3122
+ "data-handler-id": handlerId,
3123
+ label: formatMessage({
3124
+ id: index.getTranslation("components.DragHandle-label"),
3125
+ defaultMessage: "Drag"
3126
+ }),
3127
+ onKeyDown: handleKeyDown,
3128
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, {})
3129
+ }
3130
+ )
3131
+ ] })
3132
+ ] }),
3133
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
2760
3134
  designSystem.Flex,
2761
3135
  {
2762
3136
  direction: "column",
@@ -2770,9 +3144,9 @@ const Component = ({
2770
3144
  ] }) });
2771
3145
  };
2772
3146
  const Preview$1 = () => {
2773
- return /* @__PURE__ */ jsxRuntime.jsx(StyledSpan, { as: "span", padding: 6, background: "primary100" });
3147
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledSpan, { tag: "span", padding: 6, background: "primary100" });
2774
3148
  };
2775
- const StyledSpan = styled__default.default(designSystem.Box)`
3149
+ const StyledSpan = styledComponents.styled(designSystem.Box)`
2776
3150
  display: block;
2777
3151
  outline: 1px dashed ${({ theme }) => theme.colors.primary500};
2778
3152
  outline-offset: -1px;
@@ -2796,29 +3170,15 @@ const ComponentInput = ({
2796
3170
  const data = transformDocument(schema, components)(form);
2797
3171
  field.onChange(name2, data);
2798
3172
  };
2799
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
3173
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error: field.error, required, children: [
2800
3174
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", children: [
2801
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingBottom: 1, children: [
2802
- /* @__PURE__ */ jsxRuntime.jsxs(
2803
- designSystem.Typography,
2804
- {
2805
- textColor: "neutral800",
2806
- htmlFor: name2,
2807
- variant: "pi",
2808
- fontWeight: "bold",
2809
- as: "label",
2810
- children: [
2811
- label,
2812
- attribute.repeatable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2813
- " (",
2814
- Array.isArray(field.value) ? field.value.length : 0,
2815
- ")"
2816
- ] }),
2817
- required && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", children: "*" })
2818
- ]
2819
- }
2820
- ),
2821
- labelAction && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 1, children: labelAction })
3175
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { action: labelAction, children: [
3176
+ label,
3177
+ attribute.repeatable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3178
+ " (",
3179
+ Array.isArray(field.value) ? field.value.length : 0,
3180
+ ")"
3181
+ ] })
2822
3182
  ] }),
2823
3183
  showResetComponent && /* @__PURE__ */ jsxRuntime.jsx(
2824
3184
  designSystem.IconButton,
@@ -2827,21 +3187,21 @@ const ComponentInput = ({
2827
3187
  id: index.getTranslation("components.reset-entry"),
2828
3188
  defaultMessage: "Reset Entry"
2829
3189
  }),
2830
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}),
2831
- borderWidth: 0,
3190
+ variant: "ghost",
2832
3191
  onClick: () => {
2833
3192
  field.onChange(name2, null);
2834
- }
3193
+ },
3194
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {})
2835
3195
  }
2836
3196
  )
2837
3197
  ] }),
2838
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
2839
- !attribute.repeatable && !field.value && /* @__PURE__ */ jsxRuntime.jsx(Initializer, { disabled, name: name2, onClick: handleInitialisationClick }),
2840
- !attribute.repeatable && field.value ? /* @__PURE__ */ jsxRuntime.jsx(NonRepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }) : null,
2841
- attribute.repeatable && /* @__PURE__ */ jsxRuntime.jsx(RepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children })
2842
- ] })
3198
+ !attribute.repeatable && !field.value && /* @__PURE__ */ jsxRuntime.jsx(Initializer, { disabled, name: name2, onClick: handleInitialisationClick }),
3199
+ !attribute.repeatable && field.value ? /* @__PURE__ */ jsxRuntime.jsx(NonRepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }) : null,
3200
+ attribute.repeatable && /* @__PURE__ */ jsxRuntime.jsx(RepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }),
3201
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
2843
3202
  ] });
2844
3203
  };
3204
+ const MemoizedComponentInput = React__namespace.memo(ComponentInput);
2845
3205
  const AddComponentButton = ({
2846
3206
  hasError,
2847
3207
  isDisabled,
@@ -2856,19 +3216,16 @@ const AddComponentButton = ({
2856
3216
  onClick,
2857
3217
  disabled: isDisabled,
2858
3218
  background: "neutral0",
2859
- paddingTop: 3,
2860
- paddingBottom: 3,
2861
- paddingLeft: 4,
2862
- paddingRight: 4,
2863
3219
  style: { cursor: isDisabled ? "not-allowed" : "pointer" },
2864
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { as: "span", gap: 2, children: [
3220
+ variant: "tertiary",
3221
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "span", gap: 2, children: [
2865
3222
  /* @__PURE__ */ jsxRuntime.jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
2866
3223
  /* @__PURE__ */ jsxRuntime.jsx(
2867
3224
  designSystem.Typography,
2868
3225
  {
2869
3226
  variant: "pi",
2870
3227
  fontWeight: "bold",
2871
- textColor: hasError && !isOpen ? "danger600" : "neutral500",
3228
+ textColor: hasError && !isOpen ? "danger600" : "neutral600",
2872
3229
  children
2873
3230
  }
2874
3231
  )
@@ -2876,7 +3233,7 @@ const AddComponentButton = ({
2876
3233
  }
2877
3234
  );
2878
3235
  };
2879
- const StyledAddIcon = styled__default.default(Icons.PlusCircle)`
3236
+ const StyledAddIcon = styledComponents.styled(Icons.PlusCircle)`
2880
3237
  height: ${({ theme }) => theme.spaces[6]};
2881
3238
  width: ${({ theme }) => theme.spaces[6]};
2882
3239
  transform: ${({ $isOpen }) => $isOpen ? "rotate(45deg)" : "rotate(0deg)"};
@@ -2885,67 +3242,28 @@ const StyledAddIcon = styled__default.default(Icons.PlusCircle)`
2885
3242
  fill: ${({ theme, $hasError }) => $hasError ? theme.colors.danger200 : theme.colors.neutral150};
2886
3243
  }
2887
3244
  > path {
2888
- fill: ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral600};
3245
+ fill: ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral500};
2889
3246
  }
2890
3247
  `;
2891
- const StyledButton = styled__default.default(designSystem.BaseButton)`
3248
+ const StyledButton = styledComponents.styled(designSystem.Button)`
3249
+ padding-left: ${({ theme }) => theme.spaces[3]};
2892
3250
  border-radius: 26px;
2893
- border-color: ${({ theme }) => theme.colors.neutral150};
2894
3251
  box-shadow: ${({ theme }) => theme.shadows.filterShadow};
2895
-
2896
- &:hover {
2897
- ${designSystem.Typography} {
2898
- color: ${({ theme }) => theme.colors.primary600};
2899
- }
2900
-
2901
- ${StyledAddIcon} {
2902
- > circle {
2903
- fill: ${({ theme }) => theme.colors.primary600};
2904
- }
2905
- > path {
2906
- fill: ${({ theme }) => theme.colors.neutral100};
2907
- }
2908
- }
2909
- }
2910
- &:active {
2911
- ${designSystem.Typography} {
2912
- color: ${({ theme }) => theme.colors.primary600};
2913
- }
2914
- ${StyledAddIcon} {
2915
- > circle {
2916
- fill: ${({ theme }) => theme.colors.primary600};
2917
- }
2918
- > path {
2919
- fill: ${({ theme }) => theme.colors.neutral100};
2920
- }
2921
- }
2922
- }
3252
+ height: 5rem;
2923
3253
  `;
2924
3254
  const ComponentCategory = ({
2925
3255
  category,
2926
3256
  components = [],
2927
3257
  variant = "primary",
2928
- isOpen,
2929
- onAddComponent,
2930
- onToggle
3258
+ onAddComponent
2931
3259
  }) => {
2932
3260
  const { formatMessage } = reactIntl.useIntl();
2933
- const handleToggle = () => {
2934
- onToggle(category);
2935
- };
2936
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion, { expanded: isOpen, onToggle: handleToggle, size: "S", children: [
2937
- /* @__PURE__ */ jsxRuntime.jsx(
2938
- designSystem.AccordionToggle,
2939
- {
2940
- variant,
2941
- title: formatMessage({ id: category, defaultMessage: category }),
2942
- togglePosition: "left"
2943
- }
2944
- ),
2945
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.AccordionContent, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: /* @__PURE__ */ jsxRuntime.jsx(Grid, { children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsxRuntime.jsx(
3261
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: category, children: [
3262
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Header, { variant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: formatMessage({ id: category, defaultMessage: category }) }) }),
3263
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(Grid, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsxRuntime.jsx(
2946
3264
  ComponentBox,
2947
3265
  {
2948
- as: "button",
3266
+ tag: "button",
2949
3267
  type: "button",
2950
3268
  background: "neutral100",
2951
3269
  justifyContent: "center",
@@ -2955,34 +3273,32 @@ const ComponentCategory = ({
2955
3273
  shrink: 0,
2956
3274
  borderColor: "neutral200",
2957
3275
  children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "center", justifyContent: "center", children: [
2958
- /* @__PURE__ */ jsxRuntime.jsx(ComponentIcon.ComponentIcon, { icon }),
2959
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral600", children: displayName })
3276
+ /* @__PURE__ */ jsxRuntime.jsx(ComponentIcon.ComponentIcon, { color: "currentColor", background: "primary200", icon }),
3277
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: displayName })
2960
3278
  ] })
2961
3279
  },
2962
3280
  uid
2963
- )) }) }) })
3281
+ )) }) })
2964
3282
  ] });
2965
3283
  };
2966
- const Grid = styled__default.default.div`
3284
+ const Grid = styledComponents.styled(designSystem.Box)`
2967
3285
  display: grid;
2968
3286
  grid-template-columns: repeat(auto-fit, 14rem);
2969
3287
  grid-gap: ${({ theme }) => theme.spaces[1]};
2970
3288
  `;
2971
- const ComponentBox = styled__default.default(designSystem.Flex)`
3289
+ const ComponentBox = styledComponents.styled(designSystem.Flex)`
3290
+ color: ${({ theme }) => theme.colors.neutral600};
3291
+ cursor: pointer;
3292
+
3293
+ @media (prefers-reduced-motion: no-preference) {
3294
+ transition: color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
3295
+ }
3296
+
2972
3297
  &:focus,
2973
3298
  &:hover {
2974
3299
  border: 1px solid ${({ theme }) => theme.colors.primary200};
2975
3300
  background: ${({ theme }) => theme.colors.primary100};
2976
-
2977
- ${designSystem.Typography} {
2978
- color: ${({ theme }) => theme.colors.primary600};
2979
- }
2980
-
2981
- /* > Flex > ComponentIcon */
2982
- > div > div:first-child {
2983
- background: ${({ theme }) => theme.colors.primary200};
2984
- color: ${({ theme }) => theme.colors.primary600};
2985
- }
3301
+ color: ${({ theme }) => theme.colors.primary600};
2986
3302
  }
2987
3303
  `;
2988
3304
  const ComponentPicker = ({
@@ -2991,19 +3307,8 @@ const ComponentPicker = ({
2991
3307
  onClickAddComponent
2992
3308
  }) => {
2993
3309
  const { formatMessage } = reactIntl.useIntl();
2994
- const [categoryToOpen, setCategoryToOpen] = React__namespace.useState("");
2995
- React__namespace.useEffect(() => {
2996
- const categoryKeys = Object.keys(dynamicComponentsByCategory);
2997
- if (isOpen && categoryKeys.length > 0) {
2998
- setCategoryToOpen(categoryKeys[0]);
2999
- }
3000
- }, [isOpen, dynamicComponentsByCategory]);
3001
3310
  const handleAddComponentToDz = (componentUid) => () => {
3002
3311
  onClickAddComponent(componentUid);
3003
- setCategoryToOpen("");
3004
- };
3005
- const handleClickToggle = (categoryName) => {
3006
- setCategoryToOpen((currentCat) => currentCat === categoryName ? "" : categoryName);
3007
3312
  };
3008
3313
  if (!isOpen) {
3009
3314
  return null;
@@ -3024,14 +3329,12 @@ const ComponentPicker = ({
3024
3329
  id: index.getTranslation("components.DynamicZone.ComponentPicker-label"),
3025
3330
  defaultMessage: "Pick one component"
3026
3331
  }) }) }),
3027
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.KeyboardNavigable, { attributeName: "data-strapi-accordion-toggle", children: Object.entries(dynamicComponentsByCategory).map(([category, components], index2) => /* @__PURE__ */ jsxRuntime.jsx(
3332
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Root, { defaultValue: Object.keys(dynamicComponentsByCategory)[0], children: Object.entries(dynamicComponentsByCategory).map(([category, components], index2) => /* @__PURE__ */ jsxRuntime.jsx(
3028
3333
  ComponentCategory,
3029
3334
  {
3030
3335
  category,
3031
3336
  components,
3032
3337
  onAddComponent: handleAddComponentToDz,
3033
- isOpen: category === categoryToOpen,
3034
- onToggle: handleClickToggle,
3035
3338
  variant: index2 % 2 === 1 ? "primary" : "secondary"
3036
3339
  },
3037
3340
  category
@@ -3046,39 +3349,21 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
3046
3349
  id: "components.NotAllowedInput.text",
3047
3350
  defaultMessage: "No permissions to see this field"
3048
3351
  });
3049
- return /* @__PURE__ */ jsxRuntime.jsx(
3050
- designSystem.TextInput,
3051
- {
3052
- disabled: true,
3053
- label,
3054
- id: name2,
3055
- hint,
3056
- name: name2,
3057
- placeholder,
3058
- required,
3059
- startAction: /* @__PURE__ */ jsxRuntime.jsx(StyledIcon, {}),
3060
- type: "text",
3061
- value: ""
3062
- }
3063
- );
3352
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { id: name2, hint, name: name2, required, children: [
3353
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
3354
+ /* @__PURE__ */ jsxRuntime.jsx(
3355
+ designSystem.TextInput,
3356
+ {
3357
+ disabled: true,
3358
+ placeholder,
3359
+ startAction: /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, { fill: "neutral600" }),
3360
+ type: "text",
3361
+ value: ""
3362
+ }
3363
+ ),
3364
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
3365
+ ] });
3064
3366
  };
3065
- const StyledIcon = styled__default.default(Icons.EyeStriked)`
3066
- & > path {
3067
- fill: ${({ theme }) => theme.colors.neutral600};
3068
- }
3069
- `;
3070
- function useDebounce(value, delay) {
3071
- const [debouncedValue, setDebouncedValue] = React.useState(value);
3072
- React.useEffect(() => {
3073
- const handler = setTimeout(() => {
3074
- setDebouncedValue(value);
3075
- }, delay);
3076
- return () => {
3077
- clearTimeout(handler);
3078
- };
3079
- }, [value, delay]);
3080
- return debouncedValue;
3081
- }
3082
3367
  const uidApi = index.contentManagerApi.injectEndpoints({
3083
3368
  endpoints: (builder) => ({
3084
3369
  getDefaultUID: builder.query({
@@ -3113,194 +3398,206 @@ const uidApi = index.contentManagerApi.injectEndpoints({
3113
3398
  config: {
3114
3399
  params
3115
3400
  }
3116
- })
3401
+ }),
3402
+ providesTags: (_res, _error, params) => [
3403
+ { type: "UidAvailability", id: params.contentTypeUID }
3404
+ ]
3117
3405
  })
3118
3406
  })
3119
3407
  });
3120
3408
  const { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;
3121
3409
  const UID_REGEX = /^[A-Za-z0-9-_.~]*$/;
3122
- const UIDInput = React__namespace.forwardRef((props, ref) => {
3123
- const { model, id } = index.useDoc();
3124
- const allFormValues = strapiAdmin.useForm("InputUID", (form) => form.values);
3125
- const [availability, setAvailability] = React__namespace.useState();
3126
- const [showRegenerate, setShowRegenerate] = React__namespace.useState(false);
3127
- const field = strapiAdmin.useField(props.name);
3128
- const debouncedValue = useDebounce(field.value, 300);
3129
- const { toggleNotification } = strapiAdmin.useNotification();
3130
- const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
3131
- const { formatMessage } = reactIntl.useIntl();
3132
- const [{ query }] = strapiAdmin.useQueryParams();
3133
- const params = React__namespace.useMemo(() => index.buildValidParams(query), [query]);
3134
- const {
3135
- data: defaultGeneratedUID,
3136
- isLoading: isGeneratingDefaultUID,
3137
- error: apiError
3138
- } = useGetDefaultUIDQuery(
3139
- {
3140
- contentTypeUID: model,
3141
- field: props.name,
3142
- data: {
3143
- id: id ?? "",
3144
- ...allFormValues
3145
- },
3146
- params
3147
- },
3148
- {
3149
- skip: field.value || !props.required
3150
- }
3151
- );
3152
- React__namespace.useEffect(() => {
3153
- if (apiError) {
3154
- toggleNotification({
3155
- type: "warning",
3156
- message: formatAPIError(apiError)
3157
- });
3158
- }
3159
- }, [apiError, formatAPIError, toggleNotification]);
3160
- React__namespace.useEffect(() => {
3161
- if (defaultGeneratedUID && field.value === void 0) {
3162
- field.onChange(props.name, defaultGeneratedUID);
3163
- }
3164
- }, [defaultGeneratedUID, field, props.name]);
3165
- const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
3166
- const handleRegenerateClick = async () => {
3167
- try {
3168
- const res = await generateUID({
3410
+ const UIDInput = React__namespace.forwardRef(
3411
+ ({ hint, label, labelAction, name: name2, required, ...props }, ref) => {
3412
+ const { model, id } = index.useDoc();
3413
+ const allFormValues = strapiAdmin.useForm("InputUID", (form) => form.values);
3414
+ const [availability, setAvailability] = React__namespace.useState();
3415
+ const [showRegenerate, setShowRegenerate] = React__namespace.useState(false);
3416
+ const isCloning = reactRouterDom.useMatch(index.CLONE_PATH) !== null;
3417
+ const field = strapiAdmin.useField(name2);
3418
+ const debouncedValue = useDebounce.useDebounce(field.value, 300);
3419
+ const hasChanged = debouncedValue !== field.initialValue;
3420
+ const { toggleNotification } = strapiAdmin.useNotification();
3421
+ const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
3422
+ const { formatMessage } = reactIntl.useIntl();
3423
+ const [{ query }] = strapiAdmin.useQueryParams();
3424
+ const params = React__namespace.useMemo(() => index.buildValidParams(query), [query]);
3425
+ const {
3426
+ data: defaultGeneratedUID,
3427
+ isLoading: isGeneratingDefaultUID,
3428
+ error: apiError
3429
+ } = useGetDefaultUIDQuery(
3430
+ {
3169
3431
  contentTypeUID: model,
3170
- field: props.name,
3171
- data: { id: id ?? "", ...allFormValues },
3432
+ field: name2,
3433
+ data: {
3434
+ id: id ?? "",
3435
+ ...allFormValues
3436
+ },
3172
3437
  params
3173
- });
3174
- if ("data" in res) {
3175
- field.onChange(props.name, res.data);
3176
- } else {
3438
+ },
3439
+ {
3440
+ skip: field.value || !required
3441
+ }
3442
+ );
3443
+ React__namespace.useEffect(() => {
3444
+ if (apiError) {
3177
3445
  toggleNotification({
3178
- type: "danger",
3179
- message: formatAPIError(res.error)
3446
+ type: "warning",
3447
+ message: formatAPIError(apiError)
3180
3448
  });
3181
3449
  }
3182
- } catch (err) {
3183
- toggleNotification({
3184
- type: "danger",
3185
- message: formatMessage({
3186
- id: "notification.error",
3187
- defaultMessage: "An error occurred."
3188
- })
3189
- });
3190
- }
3191
- };
3192
- const {
3193
- data: availabilityData,
3194
- isLoading: isCheckingAvailability,
3195
- error: availabilityError
3196
- } = useGetAvailabilityQuery(
3197
- {
3198
- contentTypeUID: model,
3199
- field: props.name,
3200
- value: debouncedValue ? debouncedValue.trim() : "",
3201
- params
3202
- },
3203
- {
3204
- skip: !Boolean(
3205
- debouncedValue !== field.initialValue && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3206
- )
3207
- }
3208
- );
3209
- React__namespace.useEffect(() => {
3210
- if (availabilityError) {
3211
- toggleNotification({
3212
- type: "warning",
3213
- message: formatAPIError(availabilityError)
3214
- });
3215
- }
3216
- }, [availabilityError, formatAPIError, toggleNotification]);
3217
- React__namespace.useEffect(() => {
3218
- setAvailability(availabilityData);
3219
- let timer;
3220
- if (availabilityData?.isAvailable) {
3221
- timer = window.setTimeout(() => {
3222
- setAvailability(void 0);
3223
- }, 4e3);
3224
- }
3225
- return () => {
3226
- if (timer) {
3227
- clearTimeout(timer);
3450
+ }, [apiError, formatAPIError, toggleNotification]);
3451
+ React__namespace.useEffect(() => {
3452
+ if (defaultGeneratedUID && field.value === void 0) {
3453
+ field.onChange(name2, defaultGeneratedUID);
3454
+ }
3455
+ }, [defaultGeneratedUID, field, name2]);
3456
+ const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
3457
+ const handleRegenerateClick = async () => {
3458
+ try {
3459
+ const res = await generateUID({
3460
+ contentTypeUID: model,
3461
+ field: name2,
3462
+ data: { id: id ?? "", ...allFormValues },
3463
+ params
3464
+ });
3465
+ if ("data" in res) {
3466
+ field.onChange(name2, res.data);
3467
+ } else {
3468
+ toggleNotification({
3469
+ type: "danger",
3470
+ message: formatAPIError(res.error)
3471
+ });
3472
+ }
3473
+ } catch (err) {
3474
+ toggleNotification({
3475
+ type: "danger",
3476
+ message: formatMessage({
3477
+ id: "notification.error",
3478
+ defaultMessage: "An error occurred."
3479
+ })
3480
+ });
3228
3481
  }
3229
3482
  };
3230
- }, [availabilityData]);
3231
- const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
3232
- const fieldRef = strapiAdmin.useFocusInputField(props.name);
3233
- const composedRefs = designSystem.useComposedRefs(ref, fieldRef);
3234
- return (
3235
- // @ts-expect-error – label _could_ be a ReactNode since it's a child, this should be fixed in the DS.
3236
- /* @__PURE__ */ jsxRuntime.jsx(
3237
- designSystem.TextInput,
3483
+ const {
3484
+ data: availabilityData,
3485
+ isLoading: isCheckingAvailability,
3486
+ error: availabilityError
3487
+ } = useGetAvailabilityQuery(
3238
3488
  {
3239
- ref: composedRefs,
3240
- disabled: props.disabled,
3241
- error: field.error,
3242
- endAction: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { position: "relative", gap: 1, children: [
3243
- availability && !showRegenerate && /* @__PURE__ */ jsxRuntime.jsxs(
3244
- TextValidation,
3245
- {
3246
- alignItems: "center",
3247
- gap: 1,
3248
- justifyContent: "flex-end",
3249
- available: !!availability?.isAvailable,
3250
- "data-not-here-outer": true,
3251
- position: "absolute",
3252
- pointerEvents: "none",
3253
- right: 6,
3254
- width: "100px",
3255
- children: [
3256
- availability?.isAvailable ? /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, {}),
3257
- /* @__PURE__ */ jsxRuntime.jsx(
3258
- designSystem.Typography,
3259
- {
3260
- textColor: availability.isAvailable ? "success600" : "danger600",
3261
- variant: "pi",
3262
- children: formatMessage(
3263
- availability.isAvailable ? {
3264
- id: "content-manager.components.uid.available",
3265
- defaultMessage: "Available"
3266
- } : {
3267
- id: "content-manager.components.uid.unavailable",
3268
- defaultMessage: "Unavailable"
3269
- }
3270
- )
3271
- }
3272
- )
3273
- ]
3274
- }
3275
- ),
3276
- !props.disabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3277
- showRegenerate && /* @__PURE__ */ jsxRuntime.jsx(TextValidation, { alignItems: "center", justifyContent: "flex-end", gap: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "primary600", variant: "pi", children: formatMessage({
3278
- id: "content-manager.components.uid.regenerate",
3279
- defaultMessage: "Regenerate"
3280
- }) }) }),
3281
- /* @__PURE__ */ jsxRuntime.jsx(
3282
- FieldActionWrapper,
3489
+ contentTypeUID: model,
3490
+ field: name2,
3491
+ value: debouncedValue ? debouncedValue.trim() : "",
3492
+ params
3493
+ },
3494
+ {
3495
+ // Don't check availability if the value is empty or wasn't changed
3496
+ skip: !Boolean(
3497
+ (hasChanged || isCloning) && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3498
+ )
3499
+ }
3500
+ );
3501
+ React__namespace.useEffect(() => {
3502
+ if (availabilityError) {
3503
+ toggleNotification({
3504
+ type: "warning",
3505
+ message: formatAPIError(availabilityError)
3506
+ });
3507
+ }
3508
+ }, [availabilityError, formatAPIError, toggleNotification]);
3509
+ React__namespace.useEffect(() => {
3510
+ setAvailability(availabilityData);
3511
+ let timer;
3512
+ if (availabilityData?.isAvailable) {
3513
+ timer = window.setTimeout(() => {
3514
+ setAvailability(void 0);
3515
+ }, 4e3);
3516
+ }
3517
+ return () => {
3518
+ if (timer) {
3519
+ clearTimeout(timer);
3520
+ }
3521
+ };
3522
+ }, [availabilityData]);
3523
+ const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
3524
+ const fieldRef = strapiAdmin.useFocusInputField(name2);
3525
+ const composedRefs = designSystem.useComposedRefs(ref, fieldRef);
3526
+ const shouldShowAvailability = (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;
3527
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { hint, name: name2, error: field.error, required, children: [
3528
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
3529
+ /* @__PURE__ */ jsxRuntime.jsx(
3530
+ designSystem.TextInput,
3531
+ {
3532
+ ref: composedRefs,
3533
+ disabled: props.disabled,
3534
+ endAction: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { position: "relative", gap: 1, children: [
3535
+ shouldShowAvailability && /* @__PURE__ */ jsxRuntime.jsxs(
3536
+ TextValidation,
3283
3537
  {
3284
- onClick: handleRegenerateClick,
3285
- label: formatMessage({
3286
- id: "content-manager.components.uid.regenerate",
3287
- defaultMessage: "Regenerate"
3288
- }),
3289
- onMouseEnter: () => setShowRegenerate(true),
3290
- onMouseLeave: () => setShowRegenerate(false),
3291
- children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingWrapper, { "data-testid": "loading-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Loader, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(Icons.ArrowClockwise, {})
3538
+ alignItems: "center",
3539
+ gap: 1,
3540
+ justifyContent: "flex-end",
3541
+ $available: !!availability?.isAvailable,
3542
+ "data-not-here-outer": true,
3543
+ position: "absolute",
3544
+ pointerEvents: "none",
3545
+ right: 6,
3546
+ width: "100px",
3547
+ children: [
3548
+ availability?.isAvailable ? /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, {}),
3549
+ /* @__PURE__ */ jsxRuntime.jsx(
3550
+ designSystem.Typography,
3551
+ {
3552
+ textColor: availability.isAvailable ? "success600" : "danger600",
3553
+ variant: "pi",
3554
+ children: formatMessage(
3555
+ availability.isAvailable ? {
3556
+ id: "content-manager.components.uid.available",
3557
+ defaultMessage: "Available"
3558
+ } : {
3559
+ id: "content-manager.components.uid.unavailable",
3560
+ defaultMessage: "Unavailable"
3561
+ }
3562
+ )
3563
+ }
3564
+ )
3565
+ ]
3292
3566
  }
3293
- )
3294
- ] })
3295
- ] }),
3296
- onChange: field.onChange,
3297
- value: field.value ?? "",
3298
- ...props
3299
- }
3300
- )
3301
- );
3302
- });
3303
- const FieldActionWrapper = styled__default.default(designSystem.FieldAction)`
3567
+ ),
3568
+ !props.disabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3569
+ showRegenerate && /* @__PURE__ */ jsxRuntime.jsx(TextValidation, { alignItems: "center", justifyContent: "flex-end", gap: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "primary600", variant: "pi", children: formatMessage({
3570
+ id: "content-manager.components.uid.regenerate",
3571
+ defaultMessage: "Regenerate"
3572
+ }) }) }),
3573
+ /* @__PURE__ */ jsxRuntime.jsx(
3574
+ FieldActionWrapper,
3575
+ {
3576
+ onClick: handleRegenerateClick,
3577
+ label: formatMessage({
3578
+ id: "content-manager.components.uid.regenerate",
3579
+ defaultMessage: "Regenerate"
3580
+ }),
3581
+ onMouseEnter: () => setShowRegenerate(true),
3582
+ onMouseLeave: () => setShowRegenerate(false),
3583
+ children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingWrapper, { "data-testid": "loading-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Loader, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(Icons.ArrowClockwise, {})
3584
+ }
3585
+ )
3586
+ ] })
3587
+ ] }),
3588
+ onChange: field.onChange,
3589
+ value: field.value ?? "",
3590
+ ...props
3591
+ }
3592
+ ),
3593
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {}),
3594
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
3595
+ ] });
3596
+ }
3597
+ );
3598
+ const FieldActionWrapper = styledComponents.styled(designSystem.Field.Action)`
3599
+ width: 1.6rem;
3600
+
3304
3601
  svg {
3305
3602
  height: 1.6rem;
3306
3603
  width: 1.6rem;
@@ -3315,17 +3612,17 @@ const FieldActionWrapper = styled__default.default(designSystem.FieldAction)`
3315
3612
  }
3316
3613
  }
3317
3614
  `;
3318
- const TextValidation = styled__default.default(designSystem.Flex)`
3615
+ const TextValidation = styledComponents.styled(designSystem.Flex)`
3319
3616
  svg {
3320
3617
  height: 1.2rem;
3321
3618
  width: 1.2rem;
3322
3619
 
3323
3620
  path {
3324
- fill: ${({ theme, available }) => available ? theme.colors.success600 : theme.colors.danger600};
3621
+ fill: ${({ theme, $available }) => $available ? theme.colors.success600 : theme.colors.danger600};
3325
3622
  }
3326
3623
  }
3327
3624
  `;
3328
- const rotation = styled.keyframes`
3625
+ const rotation = styledComponents.keyframes`
3329
3626
  from {
3330
3627
  transform: rotate(0deg);
3331
3628
  }
@@ -3333,9 +3630,10 @@ const rotation = styled.keyframes`
3333
3630
  transform: rotate(359deg);
3334
3631
  }
3335
3632
  `;
3336
- const LoadingWrapper = styled__default.default(designSystem.Flex)`
3633
+ const LoadingWrapper = styledComponents.styled(designSystem.Flex)`
3337
3634
  animation: ${rotation} 2s infinite linear;
3338
3635
  `;
3636
+ const MemoizedUIDInput = React__namespace.memo(UIDInput);
3339
3637
  const md = new Markdown__default.default({
3340
3638
  html: true,
3341
3639
  // Enable HTML tags in source
@@ -3378,7 +3676,7 @@ const PreviewWysiwyg = ({ data = "" }) => {
3378
3676
  );
3379
3677
  return /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: html } }) });
3380
3678
  };
3381
- const Wrapper = styled__default.default.div`
3679
+ const Wrapper = styledComponents.styled.div`
3382
3680
  position: absolute;
3383
3681
  top: 0;
3384
3682
  width: 100%;
@@ -3523,8 +3821,7 @@ const Wrapper = styled__default.default.div`
3523
3821
  `;
3524
3822
  var listRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/, emptyListRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/, unorderedListRE = /[*+-]\s/;
3525
3823
  function newlineAndIndentContinueMarkdownList(cm) {
3526
- if (cm.getOption("disableInput"))
3527
- return CodeMirror__default.default.Pass;
3824
+ if (cm.getOption("disableInput")) return CodeMirror__default.default.Pass;
3528
3825
  var ranges = cm.listSelections(), replacements = [];
3529
3826
  for (var i = 0; i < ranges.length; i++) {
3530
3827
  var pos = ranges[i].head;
@@ -3558,8 +3855,7 @@ function newlineAndIndentContinueMarkdownList(cm) {
3558
3855
  var numbered = !(unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0);
3559
3856
  var bullet = numbered ? parseInt(match[3], 10) + 1 + match[4] : match[2].replace("x", " ");
3560
3857
  replacements[i] = "\n" + indent + bullet + after;
3561
- if (numbered)
3562
- incrementRemainingMarkdownListNumbers(cm, pos);
3858
+ if (numbered) incrementRemainingMarkdownListNumbers(cm, pos);
3563
3859
  }
3564
3860
  }
3565
3861
  cm.replaceSelections(replacements);
@@ -3577,10 +3873,8 @@ function incrementRemainingMarkdownListNumbers(cm, pos) {
3577
3873
  var newNumber = parseInt(startItem[3], 10) + lookAhead - skipCount;
3578
3874
  var nextNumber = parseInt(nextItem[3], 10), itemNumber = nextNumber;
3579
3875
  if (startIndent === nextIndent && !isNaN(nextNumber)) {
3580
- if (newNumber === nextNumber)
3581
- itemNumber = nextNumber + 1;
3582
- if (newNumber > nextNumber)
3583
- itemNumber = newNumber + 1;
3876
+ if (newNumber === nextNumber) itemNumber = nextNumber + 1;
3877
+ if (newNumber > nextNumber) itemNumber = newNumber + 1;
3584
3878
  cm.replaceRange(
3585
3879
  nextLine.replace(listRE, nextIndent + itemNumber + nextItem[4] + nextItem[5]),
3586
3880
  {
@@ -3593,10 +3887,8 @@ function incrementRemainingMarkdownListNumbers(cm, pos) {
3593
3887
  }
3594
3888
  );
3595
3889
  } else {
3596
- if (startIndent.length > nextIndent.length)
3597
- return;
3598
- if (startIndent.length < nextIndent.length && lookAhead === 1)
3599
- return;
3890
+ if (startIndent.length > nextIndent.length) return;
3891
+ if (startIndent.length < nextIndent.length && lookAhead === 1) return;
3600
3892
  skipCount += 1;
3601
3893
  }
3602
3894
  }
@@ -3670,17 +3962,17 @@ const Editor = React__namespace.forwardRef(
3670
3962
  [editorRef]
3671
3963
  );
3672
3964
  return /* @__PURE__ */ jsxRuntime.jsxs(EditorAndPreviewWrapper, { children: [
3673
- /* @__PURE__ */ jsxRuntime.jsx(EditorStylesContainer, { isExpandMode, disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsxRuntime.jsx("textarea", { ref: textareaRef }) }),
3965
+ /* @__PURE__ */ jsxRuntime.jsx(EditorStylesContainer, { $isExpandMode: isExpandMode, $disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsxRuntime.jsx("textarea", { ref: textareaRef }) }),
3674
3966
  isPreviewMode && /* @__PURE__ */ jsxRuntime.jsx(PreviewWysiwyg, { data: value })
3675
3967
  ] });
3676
3968
  }
3677
3969
  );
3678
- const EditorAndPreviewWrapper = styled__default.default.div`
3970
+ const EditorAndPreviewWrapper = styledComponents.styled.div`
3679
3971
  position: relative;
3680
3972
  height: calc(100% - 48px);
3681
3973
  `;
3682
- const EditorStylesContainer = styled__default.default.div`
3683
- cursor: ${({ disabled }) => disabled ? "not-allowed !important" : "auto"};
3974
+ const EditorStylesContainer = styledComponents.styled.div`
3975
+ cursor: ${({ $disabled }) => $disabled ? "not-allowed !important" : "auto"};
3684
3976
  height: 100%;
3685
3977
  /* BASICS */
3686
3978
  .CodeMirror-placeholder {
@@ -3690,7 +3982,7 @@ const EditorStylesContainer = styled__default.default.div`
3690
3982
  .CodeMirror {
3691
3983
  /* Set height, width, borders, and global font properties here */
3692
3984
  font-size: 1.4rem;
3693
- height: ${({ isExpandMode }) => isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
3985
+ height: ${({ $isExpandMode }) => $isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
3694
3986
  color: ${({ theme }) => theme.colors.neutral800};
3695
3987
  direction: ltr;
3696
3988
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
@@ -4068,7 +4360,7 @@ const EditorLayout = ({
4068
4360
  justifyContent: "flex-end",
4069
4361
  shrink: 0,
4070
4362
  width: "100%",
4071
- children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$1, { onClick: onCollapse, children: [
4363
+ children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$1, { onClick: onCollapse, variant: "tertiary", size: "M", children: [
4072
4364
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
4073
4365
  id: "components.Wysiwyg.collapse",
4074
4366
  defaultMessage: "Collapse"
@@ -4086,27 +4378,37 @@ const EditorLayout = ({
4086
4378
  ) }) });
4087
4379
  }
4088
4380
  return /* @__PURE__ */ jsxRuntime.jsx(
4089
- designSystem.Box,
4381
+ designSystem.Flex,
4090
4382
  {
4091
4383
  borderColor: error ? "danger600" : "neutral200",
4092
4384
  borderStyle: "solid",
4093
4385
  borderWidth: "1px",
4094
4386
  hasRadius: true,
4387
+ direction: "column",
4388
+ alignItems: "stretch",
4095
4389
  children
4096
4390
  }
4097
4391
  );
4098
4392
  };
4099
- const ExpandWrapper = styled__default.default(designSystem.Flex)`
4393
+ const ExpandWrapper = styledComponents.styled(designSystem.Flex)`
4100
4394
  background: ${({ theme }) => `${theme.colors.neutral800}${Math.floor(0.2 * 255).toString(16).padStart(2, "0")}`};
4101
4395
  `;
4102
- const BoxWithBorder = styled__default.default(designSystem.Box)`
4396
+ const BoxWithBorder = styledComponents.styled(designSystem.Box)`
4103
4397
  border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
4104
4398
  `;
4105
- const ExpandButton$1 = styled__default.default(designSystem.BaseButton)`
4399
+ const ExpandButton$1 = styledComponents.styled(designSystem.Button)`
4106
4400
  background-color: transparent;
4107
4401
  border: none;
4108
4402
  align-items: center;
4109
4403
 
4404
+ & > span {
4405
+ display: flex;
4406
+ justify-content: space-between;
4407
+ align-items: center;
4408
+ width: 100%;
4409
+ font-weight: ${({ theme }) => theme.fontWeights.regular};
4410
+ }
4411
+
4110
4412
  svg {
4111
4413
  margin-left: ${({ theme }) => `${theme.spaces[2]}`};
4112
4414
 
@@ -4373,42 +4675,28 @@ const quoteAndCodeHandler = (editor, markdownType) => {
4373
4675
  insertWithoutTextToEdit(editor, markdownType, line, contentLength);
4374
4676
  }
4375
4677
  };
4376
- const CustomIconButton = styled__default.default(designSystem.IconButton)`
4377
- padding: ${({ theme }) => theme.spaces[2]};
4378
- /* Trick to prevent the outline from overflowing because of the general outline-offset */
4379
- outline-offset: -2px !important;
4380
-
4381
- svg {
4382
- width: 1.8rem;
4383
- height: 1.8rem;
4384
- }
4385
- `;
4386
- const CustomLinkIconButton = styled__default.default(CustomIconButton)`
4387
- svg {
4388
- width: 0.8rem;
4389
- height: 0.8rem;
4390
- }
4391
- `;
4392
- const MainButtons = styled__default.default(designSystem.IconButtonGroup)`
4678
+ const MainButtons = styledComponents.styled(designSystem.IconButtonGroup)`
4393
4679
  margin-left: ${({ theme }) => theme.spaces[4]};
4394
4680
  `;
4395
- const MoreButton = styled__default.default(designSystem.IconButton)`
4681
+ const MoreButton = styledComponents.styled(designSystem.IconButton)`
4396
4682
  margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
4397
- padding: ${({ theme }) => theme.spaces[2]};
4398
-
4399
- svg {
4400
- width: 1.8rem;
4401
- height: 1.8rem;
4402
- }
4403
4683
  `;
4404
- const IconButtonGroupMargin = styled__default.default(designSystem.IconButtonGroup)`
4684
+ const IconButtonGroupMargin = styledComponents.styled(designSystem.IconButtonGroup)`
4405
4685
  margin-right: ${({ theme }) => `${theme.spaces[2]}`};
4406
4686
  `;
4407
- const ExpandButton = styled__default.default(designSystem.BaseButton)`
4687
+ const ExpandButton = styledComponents.styled(designSystem.Button)`
4408
4688
  background-color: transparent;
4409
4689
  border: none;
4410
4690
  align-items: center;
4411
4691
 
4692
+ & > span {
4693
+ display: flex;
4694
+ justify-content: space-between;
4695
+ align-items: center;
4696
+ width: 100%;
4697
+ font-weight: ${({ theme }) => theme.fontWeights.regular};
4698
+ }
4699
+
4412
4700
  svg {
4413
4701
  margin-left: ${({ theme }) => `${theme.spaces[2]}`};
4414
4702
  path {
@@ -4420,8 +4708,8 @@ const ExpandButton = styled__default.default(designSystem.BaseButton)`
4420
4708
  `;
4421
4709
  const WysiwygFooter = ({ onToggleExpand }) => {
4422
4710
  const { formatMessage } = reactIntl.useIntl();
4423
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, children: [
4424
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
4711
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, variant: "tertiary", size: "M", children: [
4712
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: formatMessage({
4425
4713
  id: "components.WysiwygBottomControls.fullscreen",
4426
4714
  defaultMessage: "Expand"
4427
4715
  }) }),
@@ -4443,7 +4731,7 @@ const WysiwygNav = ({
4443
4731
  id: "components.Wysiwyg.selectOptions.title",
4444
4732
  defaultMessage: "Add a title"
4445
4733
  });
4446
- const buttonMoreRef = React__namespace.useRef(null);
4734
+ React__namespace.useRef(null);
4447
4735
  const handleTogglePopover = () => {
4448
4736
  setVisiblePopover((prev) => !prev);
4449
4737
  };
@@ -4456,21 +4744,30 @@ const WysiwygNav = ({
4456
4744
  justifyContent: "space-between",
4457
4745
  borderRadius: `0.4rem 0.4rem 0 0`,
4458
4746
  children: [
4459
- /* @__PURE__ */ jsxRuntime.jsxs(StyledFlex, { children: [
4460
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SingleSelect, { disabled: true, placeholder: selectPlaceholder, size: "S", label: selectPlaceholder, children: [
4461
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h1", children: "h1" }),
4462
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h2", children: "h2" }),
4463
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h3", children: "h3" }),
4464
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h4", children: "h4" }),
4465
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h5", children: "h5" }),
4466
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h6", children: "h6" })
4467
- ] }),
4747
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
4748
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(
4749
+ designSystem.SingleSelect,
4750
+ {
4751
+ disabled: true,
4752
+ placeholder: selectPlaceholder,
4753
+ "aria-label": selectPlaceholder,
4754
+ size: "S",
4755
+ children: [
4756
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h1", children: "h1" }),
4757
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h2", children: "h2" }),
4758
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h3", children: "h3" }),
4759
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h4", children: "h4" }),
4760
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h5", children: "h5" }),
4761
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h6", children: "h6" })
4762
+ ]
4763
+ }
4764
+ ) }),
4468
4765
  /* @__PURE__ */ jsxRuntime.jsxs(MainButtons, { children: [
4469
- /* @__PURE__ */ jsxRuntime.jsx(CustomIconButton, { disabled: true, label: "Bold", name: "Bold", icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {}) }),
4470
- /* @__PURE__ */ jsxRuntime.jsx(CustomIconButton, { disabled: true, label: "Italic", name: "Italic", icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Italic, {}) }),
4471
- /* @__PURE__ */ jsxRuntime.jsx(CustomIconButton, { disabled: true, label: "Underline", name: "Underline", icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Underline, {}) })
4766
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {}) }),
4767
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Italic, {}) }),
4768
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Underline, {}) })
4472
4769
  ] }),
4473
- /* @__PURE__ */ jsxRuntime.jsx(MoreButton, { disabled: true, label: "More", icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.More, {}) })
4770
+ /* @__PURE__ */ jsxRuntime.jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.More, {}) })
4474
4771
  ] }),
4475
4772
  !isExpandMode && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
4476
4773
  id: "components.Wysiwyg.ToggleMode.markdown-mode",
@@ -4488,14 +4785,14 @@ const WysiwygNav = ({
4488
4785
  justifyContent: "space-between",
4489
4786
  borderRadius: `0.4rem 0.4rem 0 0`,
4490
4787
  children: [
4491
- /* @__PURE__ */ jsxRuntime.jsxs(StyledFlex, { children: [
4492
- /* @__PURE__ */ jsxRuntime.jsxs(
4788
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
4789
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(
4493
4790
  designSystem.SingleSelect,
4494
4791
  {
4495
4792
  placeholder: selectPlaceholder,
4496
- label: selectPlaceholder,
4497
- size: "S",
4793
+ "aria-label": selectPlaceholder,
4498
4794
  onChange: (value) => onActionClick(value, editorRef),
4795
+ size: "S",
4499
4796
  children: [
4500
4797
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h1", children: "h1" }),
4501
4798
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h2", children: "h2" }),
@@ -4505,117 +4802,103 @@ const WysiwygNav = ({
4505
4802
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h6", children: "h6" })
4506
4803
  ]
4507
4804
  }
4508
- ),
4805
+ ) }),
4509
4806
  /* @__PURE__ */ jsxRuntime.jsxs(MainButtons, { children: [
4807
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { onClick: () => onActionClick("Bold", editorRef), label: "Bold", name: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {}) }),
4510
4808
  /* @__PURE__ */ jsxRuntime.jsx(
4511
- CustomIconButton,
4512
- {
4513
- onClick: () => onActionClick("Bold", editorRef),
4514
- label: "Bold",
4515
- name: "Bold",
4516
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {})
4517
- }
4518
- ),
4519
- /* @__PURE__ */ jsxRuntime.jsx(
4520
- CustomIconButton,
4809
+ designSystem.IconButton,
4521
4810
  {
4522
4811
  onClick: () => onActionClick("Italic", editorRef),
4523
4812
  label: "Italic",
4524
4813
  name: "Italic",
4525
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Italic, {})
4814
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Italic, {})
4526
4815
  }
4527
4816
  ),
4528
4817
  /* @__PURE__ */ jsxRuntime.jsx(
4529
- CustomIconButton,
4818
+ designSystem.IconButton,
4530
4819
  {
4531
4820
  onClick: () => onActionClick("Underline", editorRef),
4532
4821
  label: "Underline",
4533
4822
  name: "Underline",
4534
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Underline, {})
4823
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Underline, {})
4535
4824
  }
4536
4825
  )
4537
4826
  ] }),
4538
- /* @__PURE__ */ jsxRuntime.jsx(
4539
- MoreButton,
4540
- {
4541
- ref: buttonMoreRef,
4542
- onClick: handleTogglePopover,
4543
- label: "More",
4544
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.More, {})
4545
- }
4546
- ),
4547
- visiblePopover && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover, { onDismiss: handleTogglePopover, centered: true, source: buttonMoreRef, spacing: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
4548
- /* @__PURE__ */ jsxRuntime.jsxs(IconButtonGroupMargin, { children: [
4549
- /* @__PURE__ */ jsxRuntime.jsx(
4550
- CustomIconButton,
4551
- {
4552
- onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
4553
- label: "Strikethrough",
4554
- name: "Strikethrough",
4555
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.StrikeThrough, {})
4556
- }
4557
- ),
4558
- /* @__PURE__ */ jsxRuntime.jsx(
4559
- CustomIconButton,
4560
- {
4561
- onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
4562
- label: "BulletList",
4563
- name: "BulletList",
4564
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.BulletList, {})
4565
- }
4566
- ),
4567
- /* @__PURE__ */ jsxRuntime.jsx(
4568
- CustomIconButton,
4569
- {
4570
- onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
4571
- label: "NumberList",
4572
- name: "NumberList",
4573
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.NumberList, {})
4574
- }
4575
- )
4576
- ] }),
4577
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.IconButtonGroup, { children: [
4578
- /* @__PURE__ */ jsxRuntime.jsx(
4579
- CustomIconButton,
4580
- {
4581
- onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
4582
- label: "Code",
4583
- name: "Code",
4584
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Code, {})
4585
- }
4586
- ),
4587
- /* @__PURE__ */ jsxRuntime.jsx(
4588
- CustomIconButton,
4589
- {
4590
- onClick: () => {
4591
- handleTogglePopover();
4592
- onToggleMediaLib();
4593
- },
4594
- label: "Image",
4595
- name: "Image",
4596
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Image, {})
4597
- }
4598
- ),
4599
- /* @__PURE__ */ jsxRuntime.jsx(
4600
- CustomLinkIconButton,
4601
- {
4602
- onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
4603
- label: "Link",
4604
- name: "Link",
4605
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Link, {})
4606
- }
4607
- ),
4608
- /* @__PURE__ */ jsxRuntime.jsx(
4609
- CustomIconButton,
4610
- {
4611
- onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
4612
- label: "Quote",
4613
- name: "Quote",
4614
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Quotes, {})
4615
- }
4616
- )
4617
- ] })
4618
- ] }) })
4827
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { children: [
4828
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(MoreButton, { label: "More", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.More, {}) }) }),
4829
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 2, children: [
4830
+ /* @__PURE__ */ jsxRuntime.jsxs(IconButtonGroupMargin, { children: [
4831
+ /* @__PURE__ */ jsxRuntime.jsx(
4832
+ designSystem.IconButton,
4833
+ {
4834
+ onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
4835
+ label: "Strikethrough",
4836
+ name: "Strikethrough",
4837
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.StrikeThrough, {})
4838
+ }
4839
+ ),
4840
+ /* @__PURE__ */ jsxRuntime.jsx(
4841
+ designSystem.IconButton,
4842
+ {
4843
+ onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
4844
+ label: "BulletList",
4845
+ name: "BulletList",
4846
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.BulletList, {})
4847
+ }
4848
+ ),
4849
+ /* @__PURE__ */ jsxRuntime.jsx(
4850
+ designSystem.IconButton,
4851
+ {
4852
+ onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
4853
+ label: "NumberList",
4854
+ name: "NumberList",
4855
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.NumberList, {})
4856
+ }
4857
+ )
4858
+ ] }),
4859
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.IconButtonGroup, { children: [
4860
+ /* @__PURE__ */ jsxRuntime.jsx(
4861
+ designSystem.IconButton,
4862
+ {
4863
+ onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
4864
+ label: "Code",
4865
+ name: "Code",
4866
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Code, {})
4867
+ }
4868
+ ),
4869
+ /* @__PURE__ */ jsxRuntime.jsx(
4870
+ designSystem.IconButton,
4871
+ {
4872
+ onClick: () => {
4873
+ handleTogglePopover();
4874
+ onToggleMediaLib();
4875
+ },
4876
+ label: "Image",
4877
+ name: "Image",
4878
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Image, {})
4879
+ }
4880
+ ),
4881
+ /* @__PURE__ */ jsxRuntime.jsx(
4882
+ designSystem.IconButton,
4883
+ {
4884
+ onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
4885
+ label: "Link",
4886
+ name: "Link",
4887
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Link, {})
4888
+ }
4889
+ ),
4890
+ /* @__PURE__ */ jsxRuntime.jsx(
4891
+ designSystem.IconButton,
4892
+ {
4893
+ onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
4894
+ label: "Quote",
4895
+ name: "Quote",
4896
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Quotes, {})
4897
+ }
4898
+ )
4899
+ ] })
4900
+ ] }) })
4901
+ ] })
4619
4902
  ] }),
4620
4903
  onTogglePreviewMode && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
4621
4904
  id: "components.Wysiwyg.ToggleMode.preview-mode",
@@ -4625,19 +4908,6 @@ const WysiwygNav = ({
4625
4908
  }
4626
4909
  );
4627
4910
  };
4628
- const StyledFlex = styled__default.default(designSystem.Flex)`
4629
- /* Hide the label, every input needs a label. */
4630
- label {
4631
- border: 0;
4632
- clip: rect(0 0 0 0);
4633
- height: 1px;
4634
- margin: -1px;
4635
- overflow: hidden;
4636
- padding: 0;
4637
- position: absolute;
4638
- width: 1px;
4639
- }
4640
- `;
4641
4911
  const Wysiwyg = React__namespace.forwardRef(
4642
4912
  ({ hint, disabled, label, name: name2, placeholder, required, labelAction }, forwardedRef) => {
4643
4913
  const field = strapiAdmin.useField(name2);
@@ -4696,15 +4966,15 @@ const Wysiwyg = React__namespace.forwardRef(
4696
4966
  const handleSelectAssets = (files) => {
4697
4967
  const formattedFiles = files.map((f) => ({
4698
4968
  alt: f.alternativeText || f.name,
4699
- url: urls.prefixFileUrlWithBackendUrl(f.url),
4969
+ url: useDebounce.prefixFileUrlWithBackendUrl(f.url),
4700
4970
  mime: f.mime
4701
4971
  }));
4702
4972
  insertFile(editorRef, formattedFiles);
4703
4973
  setMediaLibVisible(false);
4704
4974
  };
4705
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field, { name: name2, hint, error: field.error, required, children: [
4975
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: name2, hint, error: field.error, required, children: [
4706
4976
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
4707
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { action: labelAction, children: label }),
4977
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
4708
4978
  /* @__PURE__ */ jsxRuntime.jsxs(
4709
4979
  EditorLayout,
4710
4980
  {
@@ -4745,24 +5015,29 @@ const Wysiwyg = React__namespace.forwardRef(
4745
5015
  ]
4746
5016
  }
4747
5017
  ),
4748
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldHint, {}),
4749
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldError, {})
5018
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
5019
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
4750
5020
  ] }),
4751
5021
  mediaLibVisible && // @ts-expect-error – TODO: fix this way of injecting because it's not really typeable without a registry.
4752
5022
  /* @__PURE__ */ jsxRuntime.jsx(MediaLibraryDialog, { onClose: handleToggleMediaLib, onSelectAssets: handleSelectAssets })
4753
5023
  ] });
4754
5024
  }
4755
5025
  );
5026
+ const MemoizedWysiwyg = React__namespace.memo(Wysiwyg);
4756
5027
  const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4757
- const { id } = index.useDoc();
5028
+ const { id, document: document2, collectionType } = index.useDoc();
4758
5029
  const isFormDisabled = strapiAdmin.useForm("InputRenderer", (state) => state.disabled);
4759
5030
  const isInDynamicZone = useDynamicZone("isInDynamicZone", (state) => state.isInDynamicZone);
4760
5031
  const canCreateFields = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canCreateFields);
4761
5032
  const canReadFields = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canReadFields);
4762
5033
  const canUpdateFields = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canUpdateFields);
4763
5034
  const canUserAction = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canUserAction);
4764
- const editableFields = id ? canUpdateFields : canCreateFields;
4765
- const readableFields = id ? canReadFields : canCreateFields;
5035
+ let idToCheck = id;
5036
+ if (collectionType === index.SINGLE_TYPES) {
5037
+ idToCheck = document2?.documentId;
5038
+ }
5039
+ const editableFields = idToCheck ? canUpdateFields : canCreateFields;
5040
+ const readableFields = idToCheck ? canReadFields : canCreateFields;
4766
5041
  const canUserReadField = canUserAction(props.name, readableFields, props.type);
4767
5042
  const canUserEditField = canUserAction(props.name, editableFields, props.type);
4768
5043
  const fields = strapiAdmin.useStrapiApp("InputRenderer", (app) => app.fields);
@@ -4773,6 +5048,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4773
5048
  const {
4774
5049
  edit: { components }
4775
5050
  } = index.useDocLayout();
5051
+ const field = strapiAdmin.useField(props.name);
4776
5052
  if (!visible) {
4777
5053
  return null;
4778
5054
  }
@@ -4783,7 +5059,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4783
5059
  if (attributeHasCustomFieldProperty(props.attribute)) {
4784
5060
  const CustomInput = lazyComponentStore[props.attribute.customField];
4785
5061
  if (CustomInput) {
4786
- return /* @__PURE__ */ jsxRuntime.jsx(CustomInput, { ...props, hint, disabled: fieldIsDisabled });
5062
+ return /* @__PURE__ */ jsxRuntime.jsx(CustomInput, { ...props, ...field, hint, disabled: fieldIsDisabled });
4787
5063
  }
4788
5064
  return /* @__PURE__ */ jsxRuntime.jsx(
4789
5065
  strapiAdmin.InputRenderer,
@@ -4802,10 +5078,10 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4802
5078
  }
4803
5079
  switch (props.type) {
4804
5080
  case "blocks":
4805
- return /* @__PURE__ */ jsxRuntime.jsx(BlocksInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
5081
+ return /* @__PURE__ */ jsxRuntime.jsx(MemoizedBlocksInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
4806
5082
  case "component":
4807
5083
  return /* @__PURE__ */ jsxRuntime.jsx(
4808
- ComponentInput,
5084
+ MemoizedComponentInput,
4809
5085
  {
4810
5086
  ...props,
4811
5087
  hint,
@@ -4817,11 +5093,11 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4817
5093
  case "dynamiczone":
4818
5094
  return /* @__PURE__ */ jsxRuntime.jsx(DynamicZone, { ...props, hint, disabled: fieldIsDisabled });
4819
5095
  case "relation":
4820
- return /* @__PURE__ */ jsxRuntime.jsx(Relations.RelationsField, { ...props, hint, disabled: fieldIsDisabled });
5096
+ return /* @__PURE__ */ jsxRuntime.jsx(Relations.MemoizedRelationsField, { ...props, hint, disabled: fieldIsDisabled });
4821
5097
  case "richtext":
4822
- return /* @__PURE__ */ jsxRuntime.jsx(Wysiwyg, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
5098
+ return /* @__PURE__ */ jsxRuntime.jsx(MemoizedWysiwyg, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
4823
5099
  case "uid":
4824
- return /* @__PURE__ */ jsxRuntime.jsx(UIDInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
5100
+ return /* @__PURE__ */ jsxRuntime.jsx(MemoizedUIDInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
4825
5101
  case "enumeration":
4826
5102
  return /* @__PURE__ */ jsxRuntime.jsx(
4827
5103
  strapiAdmin.InputRenderer,
@@ -4853,7 +5129,9 @@ const useFieldHint = (hint = void 0, attribute) => {
4853
5129
  if (!maximum && !minimum) {
4854
5130
  return hint;
4855
5131
  }
4856
- const units = !["biginteger", "integer", "number"].includes(attribute.type) ? formatMessage(
5132
+ const units = !["biginteger", "integer", "number", "dynamiczone", "component"].includes(
5133
+ attribute.type
5134
+ ) ? formatMessage(
4857
5135
  {
4858
5136
  id: "content-manager.form.Input.hint.character.unit",
4859
5137
  defaultMessage: "{maxValue, plural, one { character} other { characters}}"
@@ -4893,6 +5171,7 @@ const getMinMax = (attribute) => {
4893
5171
  return { maximum: void 0, minimum: void 0 };
4894
5172
  }
4895
5173
  };
5174
+ const MemoizedInputRenderer = React.memo(InputRenderer);
4896
5175
  const DynamicComponent = ({
4897
5176
  componentUid,
4898
5177
  disabled,
@@ -4906,7 +5185,6 @@ const DynamicComponent = ({
4906
5185
  dynamicComponentsByCategory = {},
4907
5186
  onAddComponent
4908
5187
  }) => {
4909
- const [isOpen, setIsOpen] = React__namespace.useState(true);
4910
5188
  const { formatMessage } = reactIntl.useIntl();
4911
5189
  const formValues = strapiAdmin.useForm("DynamicComponent", (state) => state.values);
4912
5190
  const {
@@ -4915,7 +5193,7 @@ const DynamicComponent = ({
4915
5193
  const title = React__namespace.useMemo(() => {
4916
5194
  const { mainField } = components[componentUid]?.settings ?? { mainField: "id" };
4917
5195
  const mainFieldValue = objects.getIn(formValues, `${name2}.${index$1}.${mainField}`);
4918
- const displayedValue = mainField === "id" ? "" : String(mainFieldValue).trim();
5196
+ const displayedValue = mainField === "id" || !mainFieldValue ? "" : String(mainFieldValue).trim();
4919
5197
  const mainValue = displayedValue.length > 0 ? `- ${displayedValue}` : displayedValue;
4920
5198
  return mainValue;
4921
5199
  }, [componentUid, components, formValues, name2, index$1]);
@@ -4926,9 +5204,6 @@ const DynamicComponent = ({
4926
5204
  ) ?? { icon: null, displayName: null };
4927
5205
  return { icon: icon2, displayName: displayName2 };
4928
5206
  }, [componentUid, dynamicComponentsByCategory]);
4929
- const handleToggle = () => {
4930
- setIsOpen((s) => !s);
4931
- };
4932
5207
  const [{ handlerId, isDragging, handleKeyDown }, boxRef, dropRef, dragRef, dragPreviewRef] = useDragAndDrop.useDragAndDrop(!disabled, {
4933
5208
  type: `${useDragAndDrop.ItemTypes.DYNAMIC_ZONE}_${name2}`,
4934
5209
  index: index$1,
@@ -4945,12 +5220,20 @@ const DynamicComponent = ({
4945
5220
  React__namespace.useEffect(() => {
4946
5221
  dragPreviewRef(reactDndHtml5Backend.getEmptyImage(), { captureDraggingState: false });
4947
5222
  }, [dragPreviewRef, index$1]);
5223
+ const accordionValue = React__namespace.useId();
5224
+ const { value = [], rawError } = strapiAdmin.useField(`${name2}.${index$1}`);
5225
+ const [collapseToOpen, setCollapseToOpen] = React__namespace.useState("");
5226
+ React__namespace.useEffect(() => {
5227
+ if (rawError && value) {
5228
+ setCollapseToOpen(accordionValue);
5229
+ }
5230
+ }, [rawError, value, accordionValue]);
4948
5231
  const composedBoxRefs = designSystem.useComposedRefs(boxRef, dropRef);
4949
- const accordionActions = disabled ? null : /* @__PURE__ */ jsxRuntime.jsxs(ActionsFlex, { gap: 0, children: [
5232
+ const accordionActions = disabled ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4950
5233
  /* @__PURE__ */ jsxRuntime.jsx(
4951
- IconButtonCustom,
5234
+ designSystem.IconButton,
4952
5235
  {
4953
- borderWidth: 0,
5236
+ variant: "ghost",
4954
5237
  label: formatMessage(
4955
5238
  {
4956
5239
  id: index.getTranslation("components.DynamicZone.delete-label"),
@@ -4965,10 +5248,7 @@ const DynamicComponent = ({
4965
5248
  /* @__PURE__ */ jsxRuntime.jsx(
4966
5249
  designSystem.IconButton,
4967
5250
  {
4968
- forwardedAs: "div",
4969
- role: "button",
4970
- borderWidth: 0,
4971
- tabIndex: 0,
5251
+ variant: "ghost",
4972
5252
  onClick: (e) => e.stopPropagation(),
4973
5253
  "data-handler-id": handlerId,
4974
5254
  ref: dragRef,
@@ -4983,7 +5263,7 @@ const DynamicComponent = ({
4983
5263
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
4984
5264
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Trigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
4985
5265
  /* @__PURE__ */ jsxRuntime.jsx(Icons.More, { "aria-hidden": true, focusable: false }),
4986
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { as: "span", children: formatMessage({
5266
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { tag: "span", children: formatMessage({
4987
5267
  id: index.getTranslation("components.DynamicZone.more-actions"),
4988
5268
  defaultMessage: "More actions"
4989
5269
  }) })
@@ -5012,62 +5292,76 @@ const DynamicComponent = ({
5012
5292
  ] })
5013
5293
  ] })
5014
5294
  ] });
5015
- return /* @__PURE__ */ jsxRuntime.jsxs(ComponentContainer, { as: "li", width: "100%", children: [
5295
+ const accordionTitle = title ? `${displayName} ${title}` : displayName;
5296
+ return /* @__PURE__ */ jsxRuntime.jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
5016
5297
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Rectangle, { background: "neutral200" }) }),
5017
- /* @__PURE__ */ jsxRuntime.jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview, {}) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion, { expanded: isOpen, onToggle: handleToggle, size: "S", children: [
5018
- /* @__PURE__ */ jsxRuntime.jsx(
5019
- designSystem.AccordionToggle,
5298
+ /* @__PURE__ */ jsxRuntime.jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Root, { value: collapseToOpen, onValueChange: setCollapseToOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: accordionValue, children: [
5299
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
5300
+ /* @__PURE__ */ jsxRuntime.jsx(
5301
+ designSystem.Accordion.Trigger,
5302
+ {
5303
+ icon: icon && ComponentIcon.COMPONENT_ICONS[icon] ? ComponentIcon.COMPONENT_ICONS[icon] : ComponentIcon.COMPONENT_ICONS.dashboard,
5304
+ children: accordionTitle
5305
+ }
5306
+ ),
5307
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Actions, { children: accordionActions })
5308
+ ] }),
5309
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsxRuntime.jsx(
5310
+ designSystem.Grid.Item,
5020
5311
  {
5021
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(ComponentIcon.ComponentIcon, { icon, showBackground: false, size: "S" }),
5022
- action: accordionActions,
5023
- title: `${displayName} ${title}`,
5024
- togglePosition: "left"
5025
- }
5026
- ),
5027
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.AccordionContent, { children: /* @__PURE__ */ jsxRuntime.jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: row.map(({ size, ...field }) => {
5028
- const fieldName = `${name2}.${index$1}.${field.name}`;
5029
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: size, s: 12, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field, name: fieldName }) }, fieldName);
5030
- }) }, rowInd)) }) }) })
5031
- ] }) })
5312
+ col: 12,
5313
+ s: 12,
5314
+ xs: 12,
5315
+ direction: "column",
5316
+ alignItems: "stretch",
5317
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
5318
+ const fieldName = `${name2}.${index$1}.${field.name}`;
5319
+ const fieldWithTranslatedLabel = {
5320
+ ...field,
5321
+ label: formatMessage({
5322
+ id: `content-manager.components.${componentUid}.${field.name}`,
5323
+ defaultMessage: field.label
5324
+ })
5325
+ };
5326
+ return /* @__PURE__ */ jsxRuntime.jsx(
5327
+ designSystem.Grid.Item,
5328
+ {
5329
+ col: size,
5330
+ s: 12,
5331
+ xs: 12,
5332
+ direction: "column",
5333
+ alignItems: "stretch",
5334
+ children: /* @__PURE__ */ jsxRuntime.jsx(MemoizedInputRenderer, { ...fieldWithTranslatedLabel, name: fieldName })
5335
+ },
5336
+ fieldName
5337
+ );
5338
+ }) })
5339
+ },
5340
+ rowInd
5341
+ )) }) }) }) })
5342
+ ] }) }) })
5032
5343
  ] });
5033
5344
  };
5034
- const ActionsFlex = styled__default.default(designSystem.Flex)`
5035
- /*
5036
- we need to remove the background from the button but we can't
5037
- wrap the element in styled because it breaks the forwardedAs which
5038
- we need for drag handler to work on firefox
5039
- */
5040
- div[role='button'] {
5041
- background: transparent;
5042
- }
5043
- `;
5044
- const IconButtonCustom = styled__default.default(designSystem.IconButton)`
5045
- background-color: transparent;
5046
-
5047
- svg path {
5048
- fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : theme.colors.neutral600};
5049
- }
5050
- `;
5051
- const StyledBox = styled__default.default(designSystem.Box)`
5345
+ const StyledBox = styledComponents.styled(designSystem.Box)`
5052
5346
  > div:first-child {
5053
5347
  box-shadow: ${({ theme }) => theme.shadows.tableShadow};
5054
5348
  }
5055
5349
  `;
5056
- const AccordionContentRadius = styled__default.default(designSystem.Box)`
5350
+ const AccordionContentRadius = styledComponents.styled(designSystem.Box)`
5057
5351
  border-radius: 0 0 ${({ theme }) => theme.spaces[1]} ${({ theme }) => theme.spaces[1]};
5058
5352
  `;
5059
- const Rectangle = styled__default.default(designSystem.Box)`
5353
+ const Rectangle = styledComponents.styled(designSystem.Box)`
5060
5354
  width: ${({ theme }) => theme.spaces[2]};
5061
5355
  height: ${({ theme }) => theme.spaces[4]};
5062
5356
  `;
5063
- const Preview = styled__default.default.span`
5357
+ const Preview = styledComponents.styled.span`
5064
5358
  display: block;
5065
5359
  background-color: ${({ theme }) => theme.colors.primary100};
5066
5360
  outline: 1px dashed ${({ theme }) => theme.colors.primary500};
5067
5361
  outline-offset: -1px;
5068
5362
  padding: ${({ theme }) => theme.spaces[6]};
5069
5363
  `;
5070
- const ComponentContainer = styled__default.default(designSystem.Box)`
5364
+ const ComponentContainer = styledComponents.styled(designSystem.Box)`
5071
5365
  list-style: none;
5072
5366
  padding: 0;
5073
5367
  margin: 0;
@@ -5118,7 +5412,7 @@ const [DynamicZoneProvider, useDynamicZone] = strapiAdmin.createContext(
5118
5412
  );
5119
5413
  const DynamicZone = ({
5120
5414
  attribute,
5121
- disabled,
5415
+ disabled: disabledProp,
5122
5416
  hint,
5123
5417
  label,
5124
5418
  labelAction,
@@ -5128,7 +5422,8 @@ const DynamicZone = ({
5128
5422
  const { max = Infinity, min = -Infinity } = attribute ?? {};
5129
5423
  const [addComponentIsOpen, setAddComponentIsOpen] = React__namespace.useState(false);
5130
5424
  const [liveText, setLiveText] = React__namespace.useState("");
5131
- const { components } = index.useDoc();
5425
+ const { components, isLoading } = index.useDoc();
5426
+ const disabled = disabledProp || isLoading;
5132
5427
  const { addFieldRow, removeFieldRow, moveFieldRow } = strapiAdmin.useForm(
5133
5428
  "DynamicZone",
5134
5429
  ({ addFieldRow: addFieldRow2, removeFieldRow: removeFieldRow2, moveFieldRow: moveFieldRow2 }) => ({
@@ -5235,7 +5530,7 @@ const DynamicZone = ({
5235
5530
  const handleRemoveComponent = (name22, currentIndex) => () => {
5236
5531
  removeFieldRow(name22, currentIndex);
5237
5532
  };
5238
- const hasError = error !== void 0 || dynamicDisplayedComponentsLength < min || dynamicDisplayedComponentsLength > max;
5533
+ const hasError = error !== void 0;
5239
5534
  const renderButtonLabel = () => {
5240
5535
  if (addComponentIsOpen) {
5241
5536
  return formatMessage({ id: "app.utils.close-label", defaultMessage: "Close" });
@@ -5335,13 +5630,13 @@ const DynamicZone = ({
5335
5630
  )
5336
5631
  ] }) });
5337
5632
  };
5338
- exports.BlocksInput = BlocksInput;
5339
- exports.ComponentInput = ComponentInput;
5340
5633
  exports.DynamicZone = DynamicZone;
5341
- exports.InputRenderer = InputRenderer;
5634
+ exports.MemoizedBlocksInput = MemoizedBlocksInput;
5635
+ exports.MemoizedComponentInput = MemoizedComponentInput;
5636
+ exports.MemoizedInputRenderer = MemoizedInputRenderer;
5637
+ exports.MemoizedUIDInput = MemoizedUIDInput;
5638
+ exports.MemoizedWysiwyg = MemoizedWysiwyg;
5342
5639
  exports.NotAllowedInput = NotAllowedInput;
5343
- exports.UIDInput = UIDInput;
5344
- exports.Wysiwyg = Wysiwyg;
5345
5640
  exports.createDefaultForm = createDefaultForm;
5346
5641
  exports.prepareTempKeys = prepareTempKeys;
5347
5642
  exports.removeFieldsThatDontExistOnSchema = removeFieldsThatDontExistOnSchema;
@@ -5349,4 +5644,4 @@ exports.transformDocument = transformDocument;
5349
5644
  exports.useDynamicZone = useDynamicZone;
5350
5645
  exports.useFieldHint = useFieldHint;
5351
5646
  exports.useLazyComponents = useLazyComponents;
5352
- //# sourceMappingURL=Field-DmVKIAOo.js.map
5647
+ //# sourceMappingURL=Field-kYFVIGiP.js.map