@strapi/content-manager 0.0.0-experimental.3d525b3d2d44b055469a7694f6aaecfe7145b9e6 → 0.0.0-experimental.3e198200d32a65f20bd375086da6b1501e469c51

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 (238) hide show
  1. package/dist/admin/chunks/{CardDragPreview-DwuraT0K.js → CardDragPreview-DwuraT0K.mjs} +1 -1
  2. package/dist/admin/chunks/CardDragPreview-DwuraT0K.mjs.map +1 -0
  3. package/dist/admin/chunks/{ComponentConfigurationPage-D4UH2BN4.js → ComponentConfigurationPage-DDybTE9k.js} +6 -6
  4. package/dist/admin/chunks/{ComponentConfigurationPage-D4UH2BN4.js.map → ComponentConfigurationPage-DDybTE9k.js.map} +1 -1
  5. package/dist/admin/chunks/{ComponentConfigurationPage-BSCYuG9k.js → ComponentConfigurationPage-Dtpjt9kW.mjs} +9 -9
  6. package/dist/admin/chunks/ComponentConfigurationPage-Dtpjt9kW.mjs.map +1 -0
  7. package/dist/admin/chunks/{ComponentIcon-BZcTc4rj.js → ComponentIcon-BZcTc4rj.mjs} +1 -1
  8. package/dist/admin/chunks/ComponentIcon-BZcTc4rj.mjs.map +1 -0
  9. package/dist/admin/chunks/{EditConfigurationPage-DAwy6frt.js → EditConfigurationPage-DAbUlQVr.mjs} +9 -9
  10. package/dist/admin/chunks/EditConfigurationPage-DAbUlQVr.mjs.map +1 -0
  11. package/dist/admin/chunks/{EditConfigurationPage-C6jesdjb.js → EditConfigurationPage-D_otE6ca.js} +6 -6
  12. package/dist/admin/chunks/{EditConfigurationPage-C6jesdjb.js.map → EditConfigurationPage-D_otE6ca.js.map} +1 -1
  13. package/dist/admin/chunks/EditViewPage-CILYfIn8.mjs +318 -0
  14. package/dist/admin/chunks/EditViewPage-CILYfIn8.mjs.map +1 -0
  15. package/dist/admin/chunks/EditViewPage-Cd7iCrfo.js +341 -0
  16. package/dist/admin/chunks/EditViewPage-Cd7iCrfo.js.map +1 -0
  17. package/dist/admin/chunks/{FieldTypeIcon-BY6MrVF4.js → FieldTypeIcon-BY6MrVF4.mjs} +1 -1
  18. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.mjs.map +1 -0
  19. package/dist/admin/chunks/{Form-Bwz2xTe9.js → Form-CER6uyhc.mjs} +5 -5
  20. package/dist/admin/chunks/Form-CER6uyhc.mjs.map +1 -0
  21. package/dist/admin/chunks/{Form-CzUHBbLw.js → Form-D6ROqMO7.js} +5 -5
  22. package/dist/admin/chunks/{Form-CzUHBbLw.js.map → Form-D6ROqMO7.js.map} +1 -1
  23. package/dist/admin/chunks/{History-5wpSVAu9.js → History-CORGJtti.mjs} +68 -15
  24. package/dist/admin/chunks/History-CORGJtti.mjs.map +1 -0
  25. package/dist/admin/chunks/{History-Dax5KiyG.js → History-DECiFmYO.js} +67 -14
  26. package/dist/admin/chunks/History-DECiFmYO.js.map +1 -0
  27. package/dist/admin/chunks/{Input-Dr7YL5Sv.js → Input-D3aI7eJe.js} +2201 -478
  28. package/dist/admin/chunks/Input-D3aI7eJe.js.map +1 -0
  29. package/dist/admin/chunks/{Input-Csrk7S5E.js → Input-hScqTWvW.mjs} +2276 -557
  30. package/dist/admin/chunks/Input-hScqTWvW.mjs.map +1 -0
  31. package/dist/admin/chunks/{ListConfigurationPage-Bp1dKd-U.js → ListConfigurationPage-Bgya7skT.mjs} +8 -8
  32. package/dist/admin/chunks/ListConfigurationPage-Bgya7skT.mjs.map +1 -0
  33. package/dist/admin/chunks/{ListConfigurationPage-oFwCMRWP.js → ListConfigurationPage-BiKI9-fH.js} +7 -7
  34. package/dist/admin/chunks/{ListConfigurationPage-oFwCMRWP.js.map → ListConfigurationPage-BiKI9-fH.js.map} +1 -1
  35. package/dist/admin/chunks/{ListViewPage-DfHXfD_c.js → ListViewPage-B3Frxm6y.mjs} +5 -5
  36. package/dist/admin/chunks/ListViewPage-B3Frxm6y.mjs.map +1 -0
  37. package/dist/admin/chunks/{ListViewPage-CkPfXiex.js → ListViewPage-BfFRaMK8.js} +8 -8
  38. package/dist/admin/chunks/{ListViewPage-CkPfXiex.js.map → ListViewPage-BfFRaMK8.js.map} +1 -1
  39. package/dist/admin/chunks/{NoContentTypePage-BLWccskh.js → NoContentTypePage-B2rBgAB9.mjs} +3 -2
  40. package/dist/admin/chunks/NoContentTypePage-B2rBgAB9.mjs.map +1 -0
  41. package/dist/admin/chunks/{NoContentTypePage-BgTBqH4R.js → NoContentTypePage-C-WQTH0F.js} +3 -2
  42. package/dist/admin/chunks/{NoContentTypePage-BLWccskh.js.map → NoContentTypePage-C-WQTH0F.js.map} +1 -1
  43. package/dist/admin/chunks/{NoPermissionsPage-CGC__b-5.js → NoPermissionsPage-BNXoY-4Q.mjs} +3 -2
  44. package/dist/admin/chunks/NoPermissionsPage-BNXoY-4Q.mjs.map +1 -0
  45. package/dist/admin/chunks/{NoPermissionsPage-CUnJ9nZ8.js → NoPermissionsPage-D0T5uTtv.js} +3 -2
  46. package/dist/admin/chunks/{NoPermissionsPage-CGC__b-5.js.map → NoPermissionsPage-D0T5uTtv.js.map} +1 -1
  47. package/dist/admin/chunks/Preview-BvCbqXQY.js +617 -0
  48. package/dist/admin/chunks/Preview-BvCbqXQY.js.map +1 -0
  49. package/dist/admin/chunks/Preview-D4L4y24d.mjs +595 -0
  50. package/dist/admin/chunks/Preview-D4L4y24d.mjs.map +1 -0
  51. package/dist/admin/chunks/{ar-DckYq_WK.js → ar-DckYq_WK.mjs} +1 -1
  52. package/dist/admin/chunks/ar-DckYq_WK.mjs.map +1 -0
  53. package/dist/admin/chunks/{ca-DviY7mRj.js → ca-DviY7mRj.mjs} +1 -1
  54. package/dist/admin/chunks/ca-DviY7mRj.mjs.map +1 -0
  55. package/dist/admin/chunks/{cs-C7OSYFQ7.js → cs-C7OSYFQ7.mjs} +1 -1
  56. package/dist/admin/chunks/cs-C7OSYFQ7.mjs.map +1 -0
  57. package/dist/admin/chunks/{de-5QRlDHyR.js → de-5QRlDHyR.mjs} +1 -1
  58. package/dist/admin/chunks/de-5QRlDHyR.mjs.map +1 -0
  59. package/dist/admin/chunks/{en-LfhocNG2.js → en-C2zEwS3-.mjs} +6 -1
  60. package/dist/admin/chunks/en-C2zEwS3-.mjs.map +1 -0
  61. package/dist/admin/chunks/{en-C1CjdAtC.js → en-G976DLsg.js} +6 -1
  62. package/dist/admin/chunks/{en-LfhocNG2.js.map → en-G976DLsg.js.map} +1 -1
  63. package/dist/admin/chunks/{es-DkoWSExG.js → es-DkoWSExG.mjs} +1 -1
  64. package/dist/admin/chunks/es-DkoWSExG.mjs.map +1 -0
  65. package/dist/admin/chunks/{eu-BG1xX7HK.js → eu-BG1xX7HK.mjs} +1 -1
  66. package/dist/admin/chunks/eu-BG1xX7HK.mjs.map +1 -0
  67. package/dist/admin/chunks/{fr-CFdRaRVj.js → fr-CFdRaRVj.mjs} +1 -1
  68. package/dist/admin/chunks/fr-CFdRaRVj.mjs.map +1 -0
  69. package/dist/admin/chunks/{gu-D5MMMXRs.js → gu-D5MMMXRs.mjs} +1 -1
  70. package/dist/admin/chunks/gu-D5MMMXRs.mjs.map +1 -0
  71. package/dist/admin/chunks/{hi-lp17SCjr.js → hi-lp17SCjr.mjs} +1 -1
  72. package/dist/admin/chunks/hi-lp17SCjr.mjs.map +1 -0
  73. package/dist/admin/chunks/{hooks-DMvik5y_.js → hooks-DMvik5y_.mjs} +1 -1
  74. package/dist/admin/chunks/hooks-DMvik5y_.mjs.map +1 -0
  75. package/dist/admin/chunks/{hu-CLka1U2C.js → hu-CLka1U2C.mjs} +1 -1
  76. package/dist/admin/chunks/hu-CLka1U2C.mjs.map +1 -0
  77. package/dist/admin/chunks/{id-USfY9m1g.js → id-USfY9m1g.mjs} +1 -1
  78. package/dist/admin/chunks/id-USfY9m1g.mjs.map +1 -0
  79. package/dist/admin/chunks/{index-BhFoy2kH.js → index-CB_ymrXf.js} +261 -144
  80. package/dist/admin/chunks/index-CB_ymrXf.js.map +1 -0
  81. package/dist/admin/chunks/{index-2cT6u68c.js → index-DsOgMEE-.mjs} +287 -174
  82. package/dist/admin/chunks/index-DsOgMEE-.mjs.map +1 -0
  83. package/dist/admin/chunks/{it-BAHrwmYS.js → it-BAHrwmYS.mjs} +1 -1
  84. package/dist/admin/chunks/it-BAHrwmYS.mjs.map +1 -0
  85. package/dist/admin/chunks/{ja-BWKmBJFT.js → ja-BWKmBJFT.mjs} +1 -1
  86. package/dist/admin/chunks/ja-BWKmBJFT.mjs.map +1 -0
  87. package/dist/admin/chunks/{ko-CgADGBNt.js → ko-CgADGBNt.mjs} +1 -1
  88. package/dist/admin/chunks/ko-CgADGBNt.mjs.map +1 -0
  89. package/dist/admin/chunks/{layout-CsDX52Zb.js → layout-C8AQHDvk.mjs} +81 -7
  90. package/dist/admin/chunks/layout-C8AQHDvk.mjs.map +1 -0
  91. package/dist/admin/chunks/{layout-CDvvkRib.js → layout-DGlrPEkC.js} +87 -13
  92. package/dist/admin/chunks/layout-DGlrPEkC.js.map +1 -0
  93. package/dist/admin/chunks/{ml-CnhCfOn_.js → ml-CnhCfOn_.mjs} +1 -1
  94. package/dist/admin/chunks/ml-CnhCfOn_.mjs.map +1 -0
  95. package/dist/admin/chunks/{ms-Bh09NFff.js → ms-Bh09NFff.mjs} +1 -1
  96. package/dist/admin/chunks/ms-Bh09NFff.mjs.map +1 -0
  97. package/dist/admin/chunks/{nl-C8HYflTc.js → nl-C8HYflTc.mjs} +1 -1
  98. package/dist/admin/chunks/nl-C8HYflTc.mjs.map +1 -0
  99. package/dist/admin/chunks/{useDragAndDrop-gcqEJMnO.js → objects-BJTP843m.js} +73 -1
  100. package/dist/admin/chunks/objects-BJTP843m.js.map +1 -0
  101. package/dist/admin/chunks/{useDragAndDrop-HYwNDExe.js → objects-D2z-IJgu.mjs} +72 -2
  102. package/dist/admin/chunks/objects-D2z-IJgu.mjs.map +1 -0
  103. package/dist/admin/chunks/{pl-MFCZJZuZ.js → pl-MFCZJZuZ.mjs} +1 -1
  104. package/dist/admin/chunks/pl-MFCZJZuZ.mjs.map +1 -0
  105. package/dist/admin/chunks/{pt-BR-CcotyBGJ.js → pt-BR-CcotyBGJ.mjs} +1 -1
  106. package/dist/admin/chunks/pt-BR-CcotyBGJ.mjs.map +1 -0
  107. package/dist/admin/chunks/{pt-HbmgeiYO.js → pt-HbmgeiYO.mjs} +1 -1
  108. package/dist/admin/chunks/pt-HbmgeiYO.mjs.map +1 -0
  109. package/dist/admin/chunks/{ru-CB4BUyQp.js → ru-CB4BUyQp.mjs} +1 -1
  110. package/dist/admin/chunks/{ru-CB4BUyQp.js.map → ru-CB4BUyQp.mjs.map} +1 -1
  111. package/dist/admin/chunks/{sa-n_aPA-pU.js → sa-n_aPA-pU.mjs} +1 -1
  112. package/dist/admin/chunks/sa-n_aPA-pU.mjs.map +1 -0
  113. package/dist/admin/chunks/{sk-tn_BDjE2.js → sk-tn_BDjE2.mjs} +1 -1
  114. package/dist/admin/chunks/sk-tn_BDjE2.mjs.map +1 -0
  115. package/dist/admin/chunks/{sv-cq4ZrQRd.js → sv-cq4ZrQRd.mjs} +1 -1
  116. package/dist/admin/chunks/sv-cq4ZrQRd.mjs.map +1 -0
  117. package/dist/admin/chunks/{th-mUH7hEtc.js → th-mUH7hEtc.mjs} +1 -1
  118. package/dist/admin/chunks/th-mUH7hEtc.mjs.map +1 -0
  119. package/dist/admin/chunks/{tr-Yt38daxh.js → tr-Yt38daxh.mjs} +1 -1
  120. package/dist/admin/chunks/tr-Yt38daxh.mjs.map +1 -0
  121. package/dist/admin/chunks/uk-BtM6WnaE.mjs +313 -0
  122. package/dist/admin/chunks/uk-BtM6WnaE.mjs.map +1 -0
  123. package/dist/admin/chunks/uk-DB6OgySY.js +318 -0
  124. package/dist/admin/chunks/{en-C1CjdAtC.js.map → uk-DB6OgySY.js.map} +1 -1
  125. package/dist/admin/chunks/{relations-LR7_V8ZN.js → usePrev-BJk2lXYH.mjs} +18 -4
  126. package/dist/admin/chunks/usePrev-BJk2lXYH.mjs.map +1 -0
  127. package/dist/admin/chunks/{relations--SHAQ-Ch.js → usePrev-BXNyqdUp.js} +18 -2
  128. package/dist/admin/chunks/usePrev-BXNyqdUp.js.map +1 -0
  129. package/dist/admin/chunks/{vi-CvBGlTjr.js → vi-CvBGlTjr.mjs} +1 -1
  130. package/dist/admin/chunks/vi-CvBGlTjr.mjs.map +1 -0
  131. package/dist/admin/chunks/{zh-BmF-sHaT.js → zh-BmF-sHaT.mjs} +1 -1
  132. package/dist/admin/chunks/zh-BmF-sHaT.mjs.map +1 -0
  133. package/dist/admin/chunks/{zh-Hans-CI0HKio3.js → zh-Hans-DEAhqI3x.mjs} +3 -2
  134. package/dist/admin/chunks/{zh-Hans-JVK9x7xr.js.map → zh-Hans-DEAhqI3x.mjs.map} +1 -1
  135. package/dist/admin/chunks/{zh-Hans-JVK9x7xr.js → zh-Hans-Djj7eGpO.js} +3 -2
  136. package/dist/admin/chunks/{zh-Hans-CI0HKio3.js.map → zh-Hans-Djj7eGpO.js.map} +1 -1
  137. package/dist/admin/index.js +2 -1
  138. package/dist/admin/index.js.map +1 -1
  139. package/dist/admin/index.mjs +2 -1
  140. package/dist/admin/index.mjs.map +1 -1
  141. package/dist/admin/src/components/InjectionZone.d.ts +7 -1
  142. package/dist/admin/src/content-manager.d.ts +6 -0
  143. package/dist/admin/src/features/DocumentContext.d.ts +53 -0
  144. package/dist/admin/src/features/DocumentRBAC.d.ts +3 -2
  145. package/dist/admin/src/hooks/useDocument.d.ts +2 -0
  146. package/dist/admin/src/hooks/useDocumentActions.d.ts +2 -1
  147. package/dist/admin/src/index.d.ts +1 -0
  148. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +2 -1
  149. package/dist/admin/src/pages/EditView/components/EditorToolbarObserver.d.ts +11 -0
  150. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +49 -1
  151. package/dist/admin/src/pages/EditView/components/FormInputs/Relations/RelationModal.d.ts +8 -0
  152. package/dist/admin/src/pages/EditView/components/FormInputs/{Relations.d.ts → Relations/Relations.d.ts} +8 -2
  153. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.d.ts +1 -2
  154. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +9 -3
  155. package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +7 -4
  156. package/dist/admin/src/preview/components/PreviewHeader.d.ts +1 -2
  157. package/dist/admin/src/preview/pages/Preview.d.ts +2 -0
  158. package/dist/server/index.js +1 -1
  159. package/dist/server/index.js.map +1 -1
  160. package/dist/server/index.mjs +1 -1
  161. package/dist/server/index.mjs.map +1 -1
  162. package/package.json +9 -9
  163. package/dist/admin/chunks/CardDragPreview-DwuraT0K.js.map +0 -1
  164. package/dist/admin/chunks/ComponentConfigurationPage-BSCYuG9k.js.map +0 -1
  165. package/dist/admin/chunks/ComponentIcon-BZcTc4rj.js.map +0 -1
  166. package/dist/admin/chunks/EditConfigurationPage-DAwy6frt.js.map +0 -1
  167. package/dist/admin/chunks/EditViewPage-BZuZJr0N.js +0 -265
  168. package/dist/admin/chunks/EditViewPage-BZuZJr0N.js.map +0 -1
  169. package/dist/admin/chunks/EditViewPage-D8FDB8_y.js +0 -288
  170. package/dist/admin/chunks/EditViewPage-D8FDB8_y.js.map +0 -1
  171. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.js.map +0 -1
  172. package/dist/admin/chunks/Form-Bwz2xTe9.js.map +0 -1
  173. package/dist/admin/chunks/History-5wpSVAu9.js.map +0 -1
  174. package/dist/admin/chunks/History-Dax5KiyG.js.map +0 -1
  175. package/dist/admin/chunks/Input-Csrk7S5E.js.map +0 -1
  176. package/dist/admin/chunks/Input-Dr7YL5Sv.js.map +0 -1
  177. package/dist/admin/chunks/ListConfigurationPage-Bp1dKd-U.js.map +0 -1
  178. package/dist/admin/chunks/ListViewPage-DfHXfD_c.js.map +0 -1
  179. package/dist/admin/chunks/NoContentTypePage-BgTBqH4R.js.map +0 -1
  180. package/dist/admin/chunks/NoPermissionsPage-CUnJ9nZ8.js.map +0 -1
  181. package/dist/admin/chunks/Preview-DKUCY7o_.js +0 -504
  182. package/dist/admin/chunks/Preview-DKUCY7o_.js.map +0 -1
  183. package/dist/admin/chunks/Preview-uBnW2CsI.js +0 -482
  184. package/dist/admin/chunks/Preview-uBnW2CsI.js.map +0 -1
  185. package/dist/admin/chunks/Relations-BgtVC-3t.js +0 -827
  186. package/dist/admin/chunks/Relations-BgtVC-3t.js.map +0 -1
  187. package/dist/admin/chunks/Relations-CzrnshXy.js +0 -853
  188. package/dist/admin/chunks/Relations-CzrnshXy.js.map +0 -1
  189. package/dist/admin/chunks/ar-DckYq_WK.js.map +0 -1
  190. package/dist/admin/chunks/ca-DviY7mRj.js.map +0 -1
  191. package/dist/admin/chunks/cs-C7OSYFQ7.js.map +0 -1
  192. package/dist/admin/chunks/de-5QRlDHyR.js.map +0 -1
  193. package/dist/admin/chunks/es-DkoWSExG.js.map +0 -1
  194. package/dist/admin/chunks/eu-BG1xX7HK.js.map +0 -1
  195. package/dist/admin/chunks/fr-CFdRaRVj.js.map +0 -1
  196. package/dist/admin/chunks/gu-D5MMMXRs.js.map +0 -1
  197. package/dist/admin/chunks/hi-lp17SCjr.js.map +0 -1
  198. package/dist/admin/chunks/hooks-DMvik5y_.js.map +0 -1
  199. package/dist/admin/chunks/hu-CLka1U2C.js.map +0 -1
  200. package/dist/admin/chunks/id-USfY9m1g.js.map +0 -1
  201. package/dist/admin/chunks/index-2cT6u68c.js.map +0 -1
  202. package/dist/admin/chunks/index-BhFoy2kH.js.map +0 -1
  203. package/dist/admin/chunks/it-BAHrwmYS.js.map +0 -1
  204. package/dist/admin/chunks/ja-BWKmBJFT.js.map +0 -1
  205. package/dist/admin/chunks/ko-CgADGBNt.js.map +0 -1
  206. package/dist/admin/chunks/layout-CDvvkRib.js.map +0 -1
  207. package/dist/admin/chunks/layout-CsDX52Zb.js.map +0 -1
  208. package/dist/admin/chunks/ml-CnhCfOn_.js.map +0 -1
  209. package/dist/admin/chunks/ms-Bh09NFff.js.map +0 -1
  210. package/dist/admin/chunks/nl-C8HYflTc.js.map +0 -1
  211. package/dist/admin/chunks/objects-C3EebVVe.js +0 -76
  212. package/dist/admin/chunks/objects-C3EebVVe.js.map +0 -1
  213. package/dist/admin/chunks/objects-wl73iEma.js +0 -73
  214. package/dist/admin/chunks/objects-wl73iEma.js.map +0 -1
  215. package/dist/admin/chunks/pl-MFCZJZuZ.js.map +0 -1
  216. package/dist/admin/chunks/pt-BR-CcotyBGJ.js.map +0 -1
  217. package/dist/admin/chunks/pt-HbmgeiYO.js.map +0 -1
  218. package/dist/admin/chunks/relations--SHAQ-Ch.js.map +0 -1
  219. package/dist/admin/chunks/relations-LR7_V8ZN.js.map +0 -1
  220. package/dist/admin/chunks/sa-n_aPA-pU.js.map +0 -1
  221. package/dist/admin/chunks/sk-tn_BDjE2.js.map +0 -1
  222. package/dist/admin/chunks/sv-cq4ZrQRd.js.map +0 -1
  223. package/dist/admin/chunks/th-mUH7hEtc.js.map +0 -1
  224. package/dist/admin/chunks/tr-Yt38daxh.js.map +0 -1
  225. package/dist/admin/chunks/uk-B24MoTVg.js +0 -145
  226. package/dist/admin/chunks/uk-B24MoTVg.js.map +0 -1
  227. package/dist/admin/chunks/uk-Cpgmm7gE.js +0 -140
  228. package/dist/admin/chunks/uk-Cpgmm7gE.js.map +0 -1
  229. package/dist/admin/chunks/useDragAndDrop-HYwNDExe.js.map +0 -1
  230. package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js.map +0 -1
  231. package/dist/admin/chunks/usePrev-Bjw2dhmq.js +0 -18
  232. package/dist/admin/chunks/usePrev-Bjw2dhmq.js.map +0 -1
  233. package/dist/admin/chunks/usePrev-DIYl-IAL.js +0 -21
  234. package/dist/admin/chunks/usePrev-DIYl-IAL.js.map +0 -1
  235. package/dist/admin/chunks/vi-CvBGlTjr.js.map +0 -1
  236. package/dist/admin/chunks/zh-BmF-sHaT.js.map +0 -1
  237. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +0 -0
  238. package/dist/admin/src/preview/components/PreviewContent.d.ts +0 -3
@@ -6,23 +6,71 @@ var strapiAdmin = require('@strapi/admin/strapi-admin');
6
6
  var designSystem = require('@strapi/design-system');
7
7
  var Icons = require('@strapi/icons');
8
8
  var reactIntl = require('react-intl');
9
- var index = require('./index-BhFoy2kH.js');
9
+ var index = require('./index-CB_ymrXf.js');
10
10
  var styledComponents = require('styled-components');
11
11
  var slate = require('slate');
12
12
  var slateHistory = require('slate-history');
13
13
  var slateReact = require('slate-react');
14
14
  var Prism = require('prismjs');
15
15
  require('prismjs/themes/prism-solarizedlight.css');
16
- var usePrev = require('./usePrev-DIYl-IAL.js');
17
- var useDragAndDrop = require('./useDragAndDrop-gcqEJMnO.js');
16
+ require('prismjs/components/prism-asmatmel');
17
+ require('prismjs/components/prism-bash');
18
+ require('prismjs/components/prism-basic');
19
+ require('prismjs/components/prism-c');
20
+ require('prismjs/components/prism-clojure');
21
+ require('prismjs/components/prism-cobol');
22
+ require('prismjs/components/prism-cpp');
23
+ require('prismjs/components/prism-csharp');
24
+ require('prismjs/components/prism-dart');
25
+ require('prismjs/components/prism-docker');
26
+ require('prismjs/components/prism-elixir');
27
+ require('prismjs/components/prism-erlang');
28
+ require('prismjs/components/prism-fortran');
29
+ require('prismjs/components/prism-fsharp');
30
+ require('prismjs/components/prism-go');
31
+ require('prismjs/components/prism-graphql');
32
+ require('prismjs/components/prism-groovy');
33
+ require('prismjs/components/prism-haskell');
34
+ require('prismjs/components/prism-haxe');
35
+ require('prismjs/components/prism-ini');
36
+ require('prismjs/components/prism-java');
37
+ require('prismjs/components/prism-javascript');
38
+ require('prismjs/components/prism-jsx');
39
+ require('prismjs/components/prism-json');
40
+ require('prismjs/components/prism-julia');
41
+ require('prismjs/components/prism-kotlin');
42
+ require('prismjs/components/prism-latex');
43
+ require('prismjs/components/prism-lua');
44
+ require('prismjs/components/prism-markdown');
45
+ require('prismjs/components/prism-matlab');
46
+ require('prismjs/components/prism-makefile');
47
+ require('prismjs/components/prism-objectivec');
48
+ require('prismjs/components/prism-perl');
49
+ require('prismjs/components/prism-php');
50
+ require('prismjs/components/prism-powershell');
51
+ require('prismjs/components/prism-python');
52
+ require('prismjs/components/prism-r');
53
+ require('prismjs/components/prism-ruby');
54
+ require('prismjs/components/prism-rust');
55
+ require('prismjs/components/prism-sas');
56
+ require('prismjs/components/prism-scala');
57
+ require('prismjs/components/prism-scheme');
58
+ require('prismjs/components/prism-sql');
59
+ require('prismjs/components/prism-stata');
60
+ require('prismjs/components/prism-swift');
61
+ require('prismjs/components/prism-typescript');
62
+ require('prismjs/components/prism-tsx');
63
+ require('prismjs/components/prism-vbnet');
64
+ require('prismjs/components/prism-yaml');
65
+ var usePrev = require('./usePrev-BXNyqdUp.js');
66
+ var objects = require('./objects-BJTP843m.js');
18
67
  var Toolbar = require('@radix-ui/react-toolbar');
19
68
  var reactDndHtml5Backend = require('react-dnd-html5-backend');
20
69
  var reactRouterDom = require('react-router-dom');
21
- var objects = require('./objects-C3EebVVe.js');
22
- var Relations = require('./Relations-CzrnshXy.js');
23
70
  var pipe$1 = require('lodash/fp/pipe');
24
71
  var ComponentIcon = require('./ComponentIcon-C-EjOUPA.js');
25
- var relations = require('./relations--SHAQ-Ch.js');
72
+ var fractionalIndexing = require('fractional-indexing');
73
+ var reactWindow = require('react-window');
26
74
  var CodeMirror = require('codemirror5');
27
75
  var sanitizeHtml = require('sanitize-html');
28
76
  var highlight_js = require('highlight.js');
@@ -57,6 +105,7 @@ function _interopNamespaceDefault(e) {
57
105
  }
58
106
 
59
107
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
108
+ var Prism__namespace = /*#__PURE__*/_interopNamespaceDefault(Prism);
60
109
  var Toolbar__namespace = /*#__PURE__*/_interopNamespaceDefault(Toolbar);
61
110
 
62
111
  const componentStore = new Map();
@@ -431,56 +480,6 @@ const isText$2 = (node)=>{
431
480
  }
432
481
  };
433
482
 
434
- require('prismjs/components/prism-asmatmel');
435
- require('prismjs/components/prism-bash');
436
- require('prismjs/components/prism-basic');
437
- require('prismjs/components/prism-c');
438
- require('prismjs/components/prism-clojure');
439
- require('prismjs/components/prism-cobol');
440
- require('prismjs/components/prism-cpp');
441
- require('prismjs/components/prism-csharp');
442
- require('prismjs/components/prism-dart');
443
- require('prismjs/components/prism-docker');
444
- require('prismjs/components/prism-elixir');
445
- require('prismjs/components/prism-erlang');
446
- require('prismjs/components/prism-fortran');
447
- require('prismjs/components/prism-fsharp');
448
- require('prismjs/components/prism-go');
449
- require('prismjs/components/prism-graphql');
450
- require('prismjs/components/prism-groovy');
451
- require('prismjs/components/prism-haskell');
452
- require('prismjs/components/prism-haxe');
453
- require('prismjs/components/prism-ini');
454
- require('prismjs/components/prism-java');
455
- require('prismjs/components/prism-javascript');
456
- require('prismjs/components/prism-jsx');
457
- require('prismjs/components/prism-json');
458
- require('prismjs/components/prism-julia');
459
- require('prismjs/components/prism-kotlin');
460
- require('prismjs/components/prism-latex');
461
- require('prismjs/components/prism-lua');
462
- require('prismjs/components/prism-markdown');
463
- require('prismjs/components/prism-matlab');
464
- require('prismjs/components/prism-makefile');
465
- require('prismjs/components/prism-objectivec');
466
- require('prismjs/components/prism-perl');
467
- require('prismjs/components/prism-php');
468
- require('prismjs/components/prism-powershell');
469
- require('prismjs/components/prism-python');
470
- require('prismjs/components/prism-r');
471
- require('prismjs/components/prism-ruby');
472
- require('prismjs/components/prism-rust');
473
- require('prismjs/components/prism-sas');
474
- require('prismjs/components/prism-scala');
475
- require('prismjs/components/prism-scheme');
476
- require('prismjs/components/prism-sql');
477
- require('prismjs/components/prism-stata');
478
- require('prismjs/components/prism-swift');
479
- require('prismjs/components/prism-typescript');
480
- require('prismjs/components/prism-tsx');
481
- require('prismjs/components/prism-vbnet');
482
- require('prismjs/components/prism-yaml');
483
-
484
483
  const decorateCode = ([node, path])=>{
485
484
  const ranges = [];
486
485
  // make sure it is an Slate Element
@@ -489,9 +488,9 @@ const decorateCode = ([node, path])=>{
489
488
  const text = slate.Node.string(node);
490
489
  const language = codeLanguages.find((lang)=>lang.value === node.language);
491
490
  const decorateKey = language?.decorate ?? language?.value;
492
- const selectedLanguage = Prism.languages[decorateKey || 'plaintext'];
491
+ const selectedLanguage = Prism__namespace.languages[decorateKey || 'plaintext'];
493
492
  // create "tokens" with "prismjs" and put them in "ranges"
494
- const tokens = Prism.tokenize(text, selectedLanguage);
493
+ const tokens = Prism__namespace.tokenize(text, selectedLanguage);
495
494
  let start = 0;
496
495
  for (const token of tokens){
497
496
  const length = token.length;
@@ -1053,7 +1052,7 @@ const isListNode$1 = (element)=>{
1053
1052
  return element.type === 'list';
1054
1053
  };
1055
1054
 
1056
- const StyledBaseLink = styledComponents.styled(designSystem.BaseLink)`
1055
+ const StyledLink = styledComponents.styled(designSystem.Box)`
1057
1056
  text-decoration: none;
1058
1057
  `;
1059
1058
  const RemoveButton = styledComponents.styled(designSystem.Button)`
@@ -1113,9 +1112,10 @@ const LinkContent = /*#__PURE__*/ React__namespace.forwardRef(({ link, children,
1113
1112
  open: popoverOpen,
1114
1113
  children: [
1115
1114
  /*#__PURE__*/ jsxRuntime.jsx(designSystem.Popover.Trigger, {
1116
- children: /*#__PURE__*/ jsxRuntime.jsx(StyledBaseLink, {
1115
+ children: /*#__PURE__*/ jsxRuntime.jsx(StyledLink, {
1117
1116
  ...attributes,
1118
1117
  ref: forwardedRef,
1118
+ tag: "a",
1119
1119
  href: link.url,
1120
1120
  onClick: ()=>setPopoverOpen(true),
1121
1121
  color: "primary600",
@@ -1719,13 +1719,103 @@ const quoteBlocks = {
1719
1719
  }
1720
1720
  };
1721
1721
 
1722
+ const ObservedToolbarComponent = ({ index, lastVisibleIndex, setLastVisibleIndex, rootRef, children })=>{
1723
+ const isVisible = index <= lastVisibleIndex;
1724
+ const containerRef = strapiAdmin.useElementOnScreen((isVisible)=>{
1725
+ /**
1726
+ * It's the MoreMenu's job to make an item not visible when there's not room for it.
1727
+ * But we need to react here to the element becoming visible again.
1728
+ */ if (isVisible) {
1729
+ setLastVisibleIndex((prev)=>Math.max(prev, index));
1730
+ }
1731
+ }, {
1732
+ threshold: 1,
1733
+ root: rootRef.current
1734
+ });
1735
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
1736
+ ref: containerRef,
1737
+ style: {
1738
+ /**
1739
+ * Use visibility so that the element occupies the space if requires even when there's not
1740
+ * enough room for it to be visible. The empty reserved space will be clipped by the
1741
+ * overflow:hidden rule on the parent, so it doesn't affect the UI.
1742
+ * This way we can keep observing its visiblity and react to browser resize events.
1743
+ */ visibility: isVisible ? 'visible' : 'hidden'
1744
+ },
1745
+ children: children
1746
+ });
1747
+ };
1748
+ const EditorToolbarObserver = ({ observedComponents, menuTriggerVariant = 'ghost' })=>{
1749
+ const { formatMessage } = reactIntl.useIntl();
1750
+ const toolbarRef = React__namespace.useRef(null);
1751
+ const [lastVisibleIndex, setLastVisibleIndex] = React__namespace.useState(observedComponents.length - 1);
1752
+ const hasHiddenItems = lastVisibleIndex < observedComponents.length - 1;
1753
+ const menuIndex = lastVisibleIndex + 1;
1754
+ const [open, setOpen] = React__namespace.useState(false);
1755
+ const isMenuOpenWithContent = open && hasHiddenItems;
1756
+ const menuTriggerRef = strapiAdmin.useElementOnScreen((isVisible)=>{
1757
+ // We only react to the menu becoming invisible. When that happens, we hide the last item.
1758
+ if (!isVisible) {
1759
+ /**
1760
+ * If there's no room for any item, the index can be -1.
1761
+ * This is intentional, in that case only the more menu will be visible.
1762
+ **/ setLastVisibleIndex((prev)=>prev - 1);
1763
+ // Maintain the menu state if it has content
1764
+ setOpen(isMenuOpenWithContent);
1765
+ }
1766
+ }, {
1767
+ threshold: 1,
1768
+ root: toolbarRef.current
1769
+ });
1770
+ return observedComponents.map((component, index)=>{
1771
+ return /*#__PURE__*/ jsxRuntime.jsx(ObservedToolbarComponent, {
1772
+ index: index,
1773
+ lastVisibleIndex: lastVisibleIndex,
1774
+ setLastVisibleIndex: setLastVisibleIndex,
1775
+ rootRef: toolbarRef,
1776
+ children: component.toolbar
1777
+ }, component.key);
1778
+ }).toSpliced(menuIndex, 0, /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Menu.Root, {
1779
+ defaultOpen: false,
1780
+ open: isMenuOpenWithContent,
1781
+ onOpenChange: setOpen,
1782
+ children: [
1783
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Trigger, {
1784
+ paddingLeft: 0,
1785
+ paddingRight: 0,
1786
+ ref: menuTriggerRef,
1787
+ variant: menuTriggerVariant,
1788
+ style: {
1789
+ visibility: hasHiddenItems ? 'visible' : 'hidden'
1790
+ },
1791
+ label: formatMessage({
1792
+ id: 'global.more',
1793
+ defaultMessage: 'More'
1794
+ }),
1795
+ tag: designSystem.IconButton,
1796
+ icon: /*#__PURE__*/ jsxRuntime.jsx(Icons.More, {})
1797
+ }),
1798
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Content, {
1799
+ onCloseAutoFocus: (e)=>e.preventDefault(),
1800
+ maxHeight: "100%",
1801
+ minWidth: "256px",
1802
+ popoverPlacement: "bottom-end",
1803
+ zIndex: 2,
1804
+ children: observedComponents.slice(menuIndex).map((component)=>/*#__PURE__*/ jsxRuntime.jsx(React__namespace.Fragment, {
1805
+ children: component.menu
1806
+ }, component.key))
1807
+ })
1808
+ ]
1809
+ }, "more-menu"));
1810
+ };
1811
+
1722
1812
  const ToolbarWrapper = styledComponents.styled(designSystem.Flex)`
1723
1813
  &[aria-disabled='true'] {
1724
1814
  cursor: not-allowed;
1725
1815
  background: ${({ theme })=>theme.colors.neutral150};
1726
1816
  }
1727
1817
  `;
1728
- const Separator = styledComponents.styled(Toolbar__namespace.Separator)`
1818
+ const ToolbarSeparator = styledComponents.styled(Toolbar__namespace.Separator)`
1729
1819
  background: ${({ theme })=>theme.colors.neutral150};
1730
1820
  width: 1px;
1731
1821
  height: 2.4rem;
@@ -1795,7 +1885,7 @@ const ToolbarButton = ({ icon: Icon, name, label, isActive, disabled, handleClic
1795
1885
  const labelMessage = formatMessage(label);
1796
1886
  const enabledColor = isActive ? 'primary600' : 'neutral600';
1797
1887
  return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tooltip, {
1798
- description: labelMessage,
1888
+ label: labelMessage,
1799
1889
  children: /*#__PURE__*/ jsxRuntime.jsx(Toolbar__namespace.ToggleItem, {
1800
1890
  value: name,
1801
1891
  "data-state": isActive ? 'on' : 'off',
@@ -1987,8 +2077,9 @@ const BlockOption = ({ value, icon: Icon, label, blockSelected })=>{
1987
2077
  const isListNode = (node)=>{
1988
2078
  return slate.Node.isNode(node) && !slate.Editor.isEditor(node) && node.type === 'list';
1989
2079
  };
1990
- const ListButton = ({ block, format })=>{
2080
+ const ListButton = ({ block, format, location = 'toolbar' })=>{
1991
2081
  const { editor, disabled, blocks } = useBlocksEditorContext('ListButton');
2082
+ const { formatMessage } = reactIntl.useIntl();
1992
2083
  const isListActive = ()=>{
1993
2084
  if (!editor.selection) return false;
1994
2085
  // Get the parent list at selection anchor node
@@ -2064,6 +2155,18 @@ const ListButton = ({ block, format })=>{
2064
2155
  }
2065
2156
  }
2066
2157
  };
2158
+ if (location === 'menu') {
2159
+ const Icon = block.icon;
2160
+ return /*#__PURE__*/ jsxRuntime.jsxs(StyledMenuItem, {
2161
+ onSelect: ()=>toggleList(format),
2162
+ isActive: isListActive(),
2163
+ disabled: isListDisabled(),
2164
+ children: [
2165
+ /*#__PURE__*/ jsxRuntime.jsx(Icon, {}),
2166
+ formatMessage(block.label)
2167
+ ]
2168
+ });
2169
+ }
2067
2170
  return /*#__PURE__*/ jsxRuntime.jsx(ToolbarButton, {
2068
2171
  icon: block.icon,
2069
2172
  name: format,
@@ -2073,8 +2176,9 @@ const ListButton = ({ block, format })=>{
2073
2176
  handleClick: ()=>toggleList(format)
2074
2177
  });
2075
2178
  };
2076
- const LinkButton = ({ disabled })=>{
2179
+ const LinkButton = ({ disabled, location = 'toolbar' })=>{
2077
2180
  const { editor } = useBlocksEditorContext('LinkButton');
2181
+ const { formatMessage } = reactIntl.useIntl();
2078
2182
  const isLinkActive = ()=>{
2079
2183
  const { selection } = editor;
2080
2184
  if (!selection) return false;
@@ -2115,20 +2219,55 @@ const LinkButton = ({ disabled })=>{
2115
2219
  url: ''
2116
2220
  });
2117
2221
  };
2222
+ const label = {
2223
+ id: 'components.Blocks.link',
2224
+ defaultMessage: 'Link'
2225
+ };
2226
+ if (location === 'menu') {
2227
+ return /*#__PURE__*/ jsxRuntime.jsxs(StyledMenuItem, {
2228
+ onSelect: addLink,
2229
+ isActive: isLinkActive(),
2230
+ disabled: isLinkDisabled(),
2231
+ children: [
2232
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.Link, {}),
2233
+ formatMessage(label)
2234
+ ]
2235
+ });
2236
+ }
2118
2237
  return /*#__PURE__*/ jsxRuntime.jsx(ToolbarButton, {
2119
2238
  icon: Icons.Link,
2120
2239
  name: "link",
2121
- label: {
2122
- id: 'components.Blocks.link',
2123
- defaultMessage: 'Link'
2124
- },
2240
+ label: label,
2125
2241
  isActive: isLinkActive(),
2126
2242
  handleClick: addLink,
2127
2243
  disabled: isLinkDisabled()
2128
2244
  });
2129
2245
  };
2246
+ const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
2247
+ &:hover {
2248
+ background-color: ${({ theme })=>theme.colors.primary100};
2249
+ }
2250
+
2251
+ ${(props)=>props.isActive && styledComponents.css`
2252
+ font-weight: bold;
2253
+ background-color: ${({ theme })=>theme.colors.primary100};
2254
+ color: ${({ theme })=>theme.colors.primary600};
2255
+ font-weight: bold;
2256
+ `}
2257
+
2258
+ > span {
2259
+ display: inline-flex;
2260
+ gap: ${({ theme })=>theme.spaces[2]};
2261
+ align-items: center;
2262
+ }
2263
+
2264
+ svg {
2265
+ fill: ${({ theme, isActive })=>isActive ? theme.colors.primary600 : theme.colors.neutral600};
2266
+ }
2267
+ `;
2130
2268
  const BlocksToolbar = ()=>{
2131
2269
  const { editor, blocks, modifiers, disabled } = useBlocksEditorContext('BlocksToolbar');
2270
+ const { formatMessage } = reactIntl.useIntl();
2132
2271
  /**
2133
2272
  * The modifier buttons are disabled when an image is selected.
2134
2273
  */ const checkButtonDisabled = ()=>{
@@ -2149,6 +2288,94 @@ const BlocksToolbar = ()=>{
2149
2288
  return false;
2150
2289
  };
2151
2290
  const isButtonDisabled = checkButtonDisabled();
2291
+ /**
2292
+ * Observed components are ones that may or may not be visible in the toolbar, depending on the
2293
+ * available space. They provide two render props:
2294
+ * - renderInToolbar: for when we try to render the component in the toolbar (may be hidden)
2295
+ * - renderInMenu: for when the component didn't fit in the toolbar and is relegated
2296
+ * to the "more" menu
2297
+ */ const observedComponents = [
2298
+ ...Object.entries(modifiers).map(([name, modifier])=>{
2299
+ const Icon = modifier.icon;
2300
+ const isActive = modifier.checkIsActive(editor);
2301
+ const handleSelect = ()=>modifier.handleToggle(editor);
2302
+ return {
2303
+ toolbar: /*#__PURE__*/ jsxRuntime.jsx(ToolbarButton, {
2304
+ name: name,
2305
+ icon: modifier.icon,
2306
+ label: modifier.label,
2307
+ isActive: modifier.checkIsActive(editor),
2308
+ handleClick: handleSelect,
2309
+ disabled: isButtonDisabled
2310
+ }, name),
2311
+ menu: /*#__PURE__*/ jsxRuntime.jsxs(StyledMenuItem, {
2312
+ onSelect: handleSelect,
2313
+ isActive: isActive,
2314
+ children: [
2315
+ /*#__PURE__*/ jsxRuntime.jsx(Icon, {}),
2316
+ formatMessage(modifier.label)
2317
+ ]
2318
+ }),
2319
+ key: `modifier.${name}`
2320
+ };
2321
+ }),
2322
+ {
2323
+ toolbar: /*#__PURE__*/ jsxRuntime.jsx(LinkButton, {
2324
+ disabled: isButtonDisabled,
2325
+ location: "toolbar"
2326
+ }),
2327
+ menu: /*#__PURE__*/ jsxRuntime.jsx(LinkButton, {
2328
+ disabled: isButtonDisabled,
2329
+ location: "menu"
2330
+ }),
2331
+ key: 'block.link'
2332
+ },
2333
+ {
2334
+ // List buttons can only be rendered together when in the toolbar
2335
+ toolbar: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
2336
+ direction: "row",
2337
+ gap: 1,
2338
+ children: [
2339
+ /*#__PURE__*/ jsxRuntime.jsx(ToolbarSeparator, {}),
2340
+ /*#__PURE__*/ jsxRuntime.jsx(Toolbar__namespace.ToggleGroup, {
2341
+ type: "single",
2342
+ asChild: true,
2343
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
2344
+ gap: 1,
2345
+ children: [
2346
+ /*#__PURE__*/ jsxRuntime.jsx(ListButton, {
2347
+ block: blocks['list-unordered'],
2348
+ format: "unordered",
2349
+ location: "toolbar"
2350
+ }),
2351
+ /*#__PURE__*/ jsxRuntime.jsx(ListButton, {
2352
+ block: blocks['list-ordered'],
2353
+ format: "ordered",
2354
+ location: "toolbar"
2355
+ })
2356
+ ]
2357
+ })
2358
+ })
2359
+ ]
2360
+ }),
2361
+ menu: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
2362
+ children: [
2363
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Separator, {}),
2364
+ /*#__PURE__*/ jsxRuntime.jsx(ListButton, {
2365
+ block: blocks['list-unordered'],
2366
+ format: "unordered",
2367
+ location: "menu"
2368
+ }),
2369
+ /*#__PURE__*/ jsxRuntime.jsx(ListButton, {
2370
+ block: blocks['list-ordered'],
2371
+ format: "ordered",
2372
+ location: "menu"
2373
+ })
2374
+ ]
2375
+ }),
2376
+ key: 'block.list'
2377
+ }
2378
+ ];
2152
2379
  return /*#__PURE__*/ jsxRuntime.jsx(Toolbar__namespace.Root, {
2153
2380
  "aria-disabled": disabled,
2154
2381
  asChild: true,
@@ -2158,43 +2385,18 @@ const BlocksToolbar = ()=>{
2158
2385
  width: "100%",
2159
2386
  children: [
2160
2387
  /*#__PURE__*/ jsxRuntime.jsx(BlocksDropdown, {}),
2161
- /*#__PURE__*/ jsxRuntime.jsx(Separator, {}),
2388
+ /*#__PURE__*/ jsxRuntime.jsx(ToolbarSeparator, {}),
2162
2389
  /*#__PURE__*/ jsxRuntime.jsx(Toolbar__namespace.ToggleGroup, {
2163
2390
  type: "multiple",
2164
2391
  asChild: true,
2165
- children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
2166
- gap: 1,
2167
- children: [
2168
- Object.entries(modifiers).map(([name, modifier])=>/*#__PURE__*/ jsxRuntime.jsx(ToolbarButton, {
2169
- name: name,
2170
- icon: modifier.icon,
2171
- label: modifier.label,
2172
- isActive: modifier.checkIsActive(editor),
2173
- handleClick: ()=>modifier.handleToggle(editor),
2174
- disabled: isButtonDisabled
2175
- }, name)),
2176
- /*#__PURE__*/ jsxRuntime.jsx(LinkButton, {
2177
- disabled: isButtonDisabled
2178
- })
2179
- ]
2180
- })
2181
- }),
2182
- /*#__PURE__*/ jsxRuntime.jsx(Separator, {}),
2183
- /*#__PURE__*/ jsxRuntime.jsx(Toolbar__namespace.ToggleGroup, {
2184
- type: "single",
2185
- asChild: true,
2186
- children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
2392
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
2393
+ direction: "row",
2187
2394
  gap: 1,
2188
- children: [
2189
- /*#__PURE__*/ jsxRuntime.jsx(ListButton, {
2190
- block: blocks['list-unordered'],
2191
- format: "unordered"
2192
- }),
2193
- /*#__PURE__*/ jsxRuntime.jsx(ListButton, {
2194
- block: blocks['list-ordered'],
2195
- format: "ordered"
2196
- })
2197
- ]
2395
+ grow: 1,
2396
+ overflow: "hidden",
2397
+ children: /*#__PURE__*/ jsxRuntime.jsx(EditorToolbarObserver, {
2398
+ observedComponents: observedComponents
2399
+ })
2198
2400
  })
2199
2401
  })
2200
2402
  ]
@@ -2226,8 +2428,8 @@ const DropPlaceholder = styledComponents.styled(designSystem.Box)`
2226
2428
 
2227
2429
  // Show drop placeholder 8px above or below the drop target
2228
2430
  ${({ dragDirection, theme, placeholderMargin })=>styledComponents.css`
2229
- top: ${dragDirection === useDragAndDrop.DIRECTIONS.UPWARD && `-${theme.spaces[placeholderMargin]}`};
2230
- bottom: ${dragDirection === useDragAndDrop.DIRECTIONS.DOWNWARD && `-${theme.spaces[placeholderMargin]}`};
2431
+ top: ${dragDirection === objects.DIRECTIONS.UPWARD && `-${theme.spaces[placeholderMargin]}`};
2432
+ bottom: ${dragDirection === objects.DIRECTIONS.DOWNWARD && `-${theme.spaces[placeholderMargin]}`};
2231
2433
  `}
2232
2434
  `;
2233
2435
  const DragItem = styledComponents.styled(designSystem.Flex)`
@@ -2311,8 +2513,8 @@ const DragAndDropElement = ({ children, index: index$1, setDragDirection, dragDi
2311
2513
  name1,
2312
2514
  setLiveText
2313
2515
  ]);
2314
- const [{ handlerId, isDragging, isOverDropTarget, direction }, blockRef, dropRef, dragRef] = useDragAndDrop.useDragAndDrop(!disabled, {
2315
- type: `${useDragAndDrop.ItemTypes.BLOCKS}_${name1}`,
2516
+ const [{ handlerId, isDragging, isOverDropTarget, direction }, blockRef, dropRef, dragRef] = objects.useDragAndDrop(!disabled, {
2517
+ type: `${objects.ItemTypes.BLOCKS}_${name1}`,
2316
2518
  index: index$1,
2317
2519
  item: {
2318
2520
  index: index$1,
@@ -3283,6 +3485,20 @@ const Initializer = ({ disabled, name, onClick })=>{
3283
3485
  });
3284
3486
  };
3285
3487
 
3488
+ /**
3489
+ * We use this component to wrap any individual component field in the Edit View,
3490
+ * this could be a component field in a dynamic zone, a component within a repeatable space,
3491
+ * or even nested components.
3492
+ *
3493
+ * We primarily need this to provide the component id to the components so that they can
3494
+ * correctly fetch their relations.
3495
+ */ const [ComponentProvider, useComponent] = strapiAdmin.createContext('ComponentContext', {
3496
+ id: undefined,
3497
+ level: -1,
3498
+ uid: undefined,
3499
+ type: undefined
3500
+ });
3501
+
3286
3502
  const AddComponentButton = ({ hasError, isDisabled, isOpen, children, onClick })=>{
3287
3503
  return /*#__PURE__*/ jsxRuntime.jsx(StyledButton, {
3288
3504
  type: "button",
@@ -3388,15 +3604,24 @@ const ComponentCategory = ({ category, components = [], variant = 'primary', onA
3388
3604
  const ResponsiveAccordionContent = styledComponents.styled(designSystem.Accordion.Content)`
3389
3605
  container-type: inline-size;
3390
3606
  `;
3391
- const Grid = styledComponents.styled(designSystem.Box)`
3392
- display: grid;
3393
- grid-template-columns: repeat(auto-fill, 100%);
3394
- grid-gap: ${({ theme })=>theme.spaces[1]};
3395
-
3396
- @container (min-width: ${()=>RESPONSIVE_CONTAINER_BREAKPOINTS.sm}) {
3397
- grid-template-columns: repeat(auto-fill, 14rem);
3398
- }
3399
- `;
3607
+ /**
3608
+ * TODO:
3609
+ * JSDOM cannot handle container queries.
3610
+ * This is a temporary workaround so that tests do not fail in the CI when jestdom throws an error
3611
+ * for failing to parse the stylesheet.
3612
+ */ const Grid = process.env.NODE_ENV !== 'test' ? styledComponents.styled(designSystem.Box)`
3613
+ display: grid;
3614
+ grid-template-columns: repeat(auto-fill, 100%);
3615
+ grid-gap: 4px;
3616
+
3617
+ @container (min-width: ${()=>RESPONSIVE_CONTAINER_BREAKPOINTS.sm}) {
3618
+ grid-template-columns: repeat(auto-fill, 14rem);
3619
+ }
3620
+ ` : styledComponents.styled(designSystem.Box)`
3621
+ display: grid;
3622
+ grid-template-columns: repeat(auto-fill, 100%);
3623
+ grid-gap: 4px;
3624
+ `;
3400
3625
  const ComponentBox = styledComponents.styled(designSystem.Flex)`
3401
3626
  color: ${({ theme })=>theme.colors.neutral600};
3402
3627
  cursor: pointer;
@@ -3461,7 +3686,19 @@ const ComponentPicker = ({ dynamicComponentsByCategory = {}, isOpen, onClickAddC
3461
3686
  const DynamicComponent = ({ componentUid, disabled, index: index$1, name, onRemoveComponentClick, onMoveComponent, onGrabItem, onDropItem, onCancel, dynamicComponentsByCategory = {}, onAddComponent, children })=>{
3462
3687
  const { formatMessage } = reactIntl.useIntl();
3463
3688
  const formValues = strapiAdmin.useForm('DynamicComponent', (state)=>state.values);
3464
- const { edit: { components } } = index.useDocLayout();
3689
+ const documentMeta = index.useDocumentContext('DynamicComponent', (state)=>state.meta);
3690
+ const rootDocumentMeta = index.useDocumentContext('DynamicComponent', (state)=>state.rootDocumentMeta);
3691
+ const { edit: { components: rootComponents } } = index.useDocumentLayout(rootDocumentMeta.model);
3692
+ const { edit: { components: relatedComponents } } = index.useDocumentLayout(documentMeta.model);
3693
+ // Merge the root level components and related components
3694
+ const components = React__namespace.useMemo(()=>({
3695
+ ...rootComponents,
3696
+ ...relatedComponents
3697
+ }), [
3698
+ rootComponents,
3699
+ relatedComponents
3700
+ ]);
3701
+ const document = index.useDocumentContext('DynamicComponent', (state)=>state.document);
3465
3702
  const title = React__namespace.useMemo(()=>{
3466
3703
  const { mainField } = components[componentUid]?.settings ?? {
3467
3704
  mainField: 'id'
@@ -3491,8 +3728,8 @@ const DynamicComponent = ({ componentUid, disabled, index: index$1, name, onRemo
3491
3728
  componentUid,
3492
3729
  dynamicComponentsByCategory
3493
3730
  ]);
3494
- const [{ handlerId, isDragging, handleKeyDown }, boxRef, dropRef, dragRef, dragPreviewRef] = useDragAndDrop.useDragAndDrop(!disabled, {
3495
- type: `${useDragAndDrop.ItemTypes.DYNAMIC_ZONE}_${name}`,
3731
+ const [{ handlerId, isDragging, handleKeyDown }, boxRef, dropRef, dragRef, dragPreviewRef] = objects.useDragAndDrop(!disabled, {
3732
+ type: `${objects.ItemTypes.DYNAMIC_ZONE}_${name}`,
3496
3733
  index: index$1,
3497
3734
  item: {
3498
3735
  index: index$1,
@@ -3693,9 +3930,11 @@ const DynamicComponent = ({ componentUid, disabled, index: index$1, name, onRemo
3693
3930
  alignItems: "stretch",
3694
3931
  children: children ? children({
3695
3932
  ...fieldWithTranslatedLabel,
3933
+ document,
3696
3934
  name: fieldName
3697
3935
  }) : /*#__PURE__*/ jsxRuntime.jsx(MemoizedInputRenderer, {
3698
3936
  ...fieldWithTranslatedLabel,
3937
+ document: document,
3699
3938
  name: fieldName
3700
3939
  })
3701
3940
  }, fieldName);
@@ -3813,7 +4052,8 @@ const DynamicZone = ({ attribute, disabled: disabledProp, hint, label, labelActi
3813
4052
  const { max = Infinity, min = -Infinity } = attribute ?? {};
3814
4053
  const [addComponentIsOpen, setAddComponentIsOpen] = React__namespace.useState(false);
3815
4054
  const [liveText, setLiveText] = React__namespace.useState('');
3816
- const { components, isLoading } = index.useDoc();
4055
+ const document = index.useDocumentContext('DynamicZone', (state)=>state.document);
4056
+ const { components, isLoading } = document;
3817
4057
  const disabled = disabledProp || isLoading;
3818
4058
  const { addFieldRow, removeFieldRow, moveFieldRow } = strapiAdmin.useForm('DynamicZone', ({ addFieldRow, removeFieldRow, moveFieldRow })=>({
3819
4059
  addFieldRow,
@@ -3941,7 +4181,7 @@ const DynamicZone = ({ attribute, disabled: disabledProp, hint, label, labelActi
3941
4181
  componentName: label || name
3942
4182
  });
3943
4183
  };
3944
- const level = Relations.useComponent('DynamicZone', (state)=>state.level);
4184
+ const level = useComponent('DynamicZone', (state)=>state.level);
3945
4185
  const ariaDescriptionId = React__namespace.useId();
3946
4186
  return /*#__PURE__*/ jsxRuntime.jsx(DynamicZoneProvider, {
3947
4187
  isInDynamicZone: true,
@@ -3973,7 +4213,7 @@ const DynamicZone = ({ attribute, disabled: disabledProp, hint, label, labelActi
3973
4213
  }),
3974
4214
  /*#__PURE__*/ jsxRuntime.jsx("ol", {
3975
4215
  "aria-describedby": ariaDescriptionId,
3976
- children: value.map((field, index)=>/*#__PURE__*/ jsxRuntime.jsx(Relations.ComponentProvider, {
4216
+ children: value.map((field, index)=>/*#__PURE__*/ jsxRuntime.jsx(ComponentProvider, {
3977
4217
  level: level + 1,
3978
4218
  uid: field.__component,
3979
4219
  // id is always a number in a dynamic zone.
@@ -4046,63 +4286,1298 @@ const NotAllowedInput = ({ hint, label, required, name })=>{
4046
4286
  });
4047
4287
  };
4048
4288
 
4049
- const uidApi = index.contentManagerApi.injectEndpoints({
4050
- endpoints: (builder)=>({
4051
- getDefaultUID: builder.query({
4052
- query: ({ params, ...data })=>{
4053
- return {
4054
- url: '/content-manager/uid/generate',
4055
- method: 'POST',
4056
- data,
4057
- config: {
4058
- params
4059
- }
4060
- };
4061
- },
4062
- transformResponse: (response)=>response.data
4063
- }),
4064
- generateUID: builder.mutation({
4065
- query: ({ params, ...data })=>({
4066
- url: '/content-manager/uid/generate',
4067
- method: 'POST',
4068
- data,
4069
- config: {
4070
- params
4071
- }
4072
- }),
4073
- transformResponse: (response)=>response.data
4074
- }),
4075
- getAvailability: builder.query({
4076
- query: ({ params, ...data })=>({
4077
- url: '/content-manager/uid/check-availability',
4078
- method: 'POST',
4079
- data,
4080
- config: {
4081
- params
4082
- }
4083
- }),
4084
- providesTags: (_res, _error, params)=>[
4085
- {
4086
- type: 'UidAvailability',
4087
- id: params.contentTypeUID
4088
- }
4089
- ]
4090
- })
4091
- })
4289
+ function getCollectionType(url) {
4290
+ const regex = new RegExp(`(${index.COLLECTION_TYPES}|${index.SINGLE_TYPES})`);
4291
+ const match = url.match(regex);
4292
+ return match ? match[1] : undefined;
4293
+ }
4294
+ const CustomModalContent = styledComponents.styled(designSystem.Modal.Content)`
4295
+ width: 90%;
4296
+ max-width: 100%;
4297
+ height: 90%;
4298
+ max-height: 100%;
4299
+ `;
4300
+ const [RelationModalProvider, useRelationModal] = strapiAdmin.createContext('RelationModal', {
4301
+ parentModified: false,
4302
+ depth: 0
4092
4303
  });
4093
- const { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;
4094
-
4095
- /* -------------------------------------------------------------------------------------------------
4096
- * InputUID
4097
- * -----------------------------------------------------------------------------------------------*/ const UID_REGEX = /^[A-Za-z0-9-_.~]*$/;
4098
- const UIDInput = /*#__PURE__*/ React__namespace.forwardRef(({ hint, label, labelAction, name, required, ...props }, ref)=>{
4099
- const { model, id } = index.useDoc();
4100
- const allFormValues = strapiAdmin.useForm('InputUID', (form)=>form.values);
4304
+ const RelationModalForm = ({ relation, triggerButtonLabel })=>{
4305
+ const navigate = reactRouterDom.useNavigate();
4306
+ const { pathname, search } = reactRouterDom.useLocation();
4307
+ const { formatMessage } = reactIntl.useIntl();
4308
+ const [triggerRefetchDocument] = index.useLazyGetDocumentQuery();
4309
+ const currentDocument = index.useDocumentContext('RelationModalForm', (state)=>state.document);
4310
+ const rootDocumentMeta = index.useDocumentContext('RelationModalForm', (state)=>state.rootDocumentMeta);
4311
+ const currentDocumentMeta = index.useDocumentContext('RelationModalForm', (state)=>state.meta);
4312
+ const changeDocument = index.useDocumentContext('RelationModalForm', (state)=>state.changeDocument);
4313
+ const documentHistory = index.useDocumentContext('RelationModalForm', (state)=>state.documentHistory);
4314
+ const setDocumentHistory = index.useDocumentContext('RelationModalForm', (state)=>state.setDocumentHistory);
4315
+ const [isConfirmationOpen, setIsConfirmationOpen] = React__namespace.useState(false);
4316
+ const [actionPosition, setActionPosition] = React__namespace.useState('cancel');
4317
+ const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
4318
+ // NOTE: Not sure about this relation modal context, maybe we should move this to DocumentContext?
4319
+ // Get parent modal context if it exists
4320
+ const parentContext = useRelationModal('RelationModalForm', (state)=>state);
4321
+ // Get depth of nested modals
4322
+ const depth = parentContext ? parentContext.depth + 1 : 0;
4323
+ // Check if this is a nested modal
4324
+ const isNested = depth > 0;
4325
+ const addDocumentToHistory = (document)=>setDocumentHistory((prev)=>[
4326
+ ...prev,
4327
+ document
4328
+ ]);
4329
+ const getPreviousDocument = ()=>{
4330
+ if (documentHistory.length === 0) return undefined;
4331
+ const lastDocument = documentHistory[documentHistory.length - 1];
4332
+ return lastDocument;
4333
+ };
4334
+ const removeLastDocumentFromHistory = ()=>{
4335
+ setDocumentHistory((prev)=>[
4336
+ ...prev
4337
+ ].slice(0, prev.length - 1));
4338
+ };
4339
+ const handleToggleModal = ()=>{
4340
+ if (isModalOpen) {
4341
+ setIsModalOpen(false);
4342
+ const document = {
4343
+ collectionType: rootDocumentMeta.collectionType,
4344
+ model: rootDocumentMeta.model,
4345
+ documentId: rootDocumentMeta.documentId
4346
+ };
4347
+ // Change back to the root document
4348
+ changeDocument(document);
4349
+ // Reset the document history
4350
+ setDocumentHistory([]);
4351
+ // Reset action position
4352
+ setActionPosition('cancel');
4353
+ // Read from cache or refetch root document
4354
+ triggerRefetchDocument(document, // Favor the cache
4355
+ true);
4356
+ } else {
4357
+ changeDocument(relation);
4358
+ setIsModalOpen(true);
4359
+ }
4360
+ };
4361
+ const getFullPageLink = ()=>{
4362
+ const isSingleType = currentDocumentMeta.collectionType === index.SINGLE_TYPES;
4363
+ const queryParams = currentDocumentMeta.params?.locale ? `?plugins[i18n][locale]=${currentDocumentMeta.params.locale}` : '';
4364
+ return `/content-manager/${currentDocumentMeta.collectionType}/${currentDocumentMeta.model}${isSingleType ? '' : '/' + currentDocumentMeta.documentId}${queryParams}`;
4365
+ };
4366
+ const handleRedirection = ()=>{
4367
+ const editViewUrl = `${pathname}${search}`;
4368
+ const isRootDocumentUrl = editViewUrl.includes(getFullPageLink());
4369
+ if (isRootDocumentUrl) {
4370
+ handleToggleModal();
4371
+ } else {
4372
+ navigate(getFullPageLink());
4373
+ }
4374
+ };
4375
+ const handleConfirm = ()=>{
4376
+ if (actionPosition === 'navigate') {
4377
+ handleRedirection();
4378
+ } else if (actionPosition === 'back') {
4379
+ const previousRelation = getPreviousDocument();
4380
+ if (previousRelation) {
4381
+ removeLastDocumentFromHistory();
4382
+ changeDocument(previousRelation);
4383
+ }
4384
+ } else {
4385
+ // Add current relation to history before opening a new one in case we are opening a new one
4386
+ if (currentDocumentMeta && Object.keys(currentDocumentMeta).length > 0) {
4387
+ addDocumentToHistory(currentDocumentMeta);
4388
+ }
4389
+ handleToggleModal();
4390
+ }
4391
+ };
4392
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Form, {
4393
+ method: "PUT",
4394
+ initialValues: currentDocument.getInitialFormValues(),
4395
+ validate: (values, options)=>{
4396
+ const yupSchema = index.createYupSchema(currentDocument.schema?.attributes, currentDocument.components, {
4397
+ status: currentDocument.document?.status,
4398
+ ...options
4399
+ });
4400
+ return yupSchema.validate(values, {
4401
+ abortEarly: false
4402
+ });
4403
+ },
4404
+ children: ({ modified, isSubmitting, resetForm })=>{
4405
+ // We don't count the root document, so history starts after 1
4406
+ const hasHistory = documentHistory.length > 1;
4407
+ return /*#__PURE__*/ jsxRuntime.jsxs(RelationModalProvider, {
4408
+ parentModified: modified,
4409
+ depth: depth,
4410
+ children: [
4411
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Modal.Root, {
4412
+ open: isModalOpen,
4413
+ onOpenChange: ()=>{
4414
+ if (isModalOpen) {
4415
+ if (modified && !isSubmitting) {
4416
+ setIsConfirmationOpen(true);
4417
+ } else {
4418
+ handleToggleModal();
4419
+ }
4420
+ }
4421
+ },
4422
+ children: [
4423
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Trigger, {
4424
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tooltip, {
4425
+ description: triggerButtonLabel,
4426
+ children: /*#__PURE__*/ jsxRuntime.jsx(CustomTextButton, {
4427
+ onClick: ()=>{
4428
+ // Check if parent modal has unsaved changes
4429
+ if (isNested && parentContext.parentModified) {
4430
+ setIsConfirmationOpen(true);
4431
+ // Return early to avoid opening the modal
4432
+ return;
4433
+ } else {
4434
+ if (modified && !isSubmitting) {
4435
+ setIsConfirmationOpen(true);
4436
+ } else {
4437
+ // Add current relation to history before opening a new one
4438
+ if (currentDocumentMeta && Object.keys(currentDocumentMeta).length > 0) {
4439
+ addDocumentToHistory(currentDocumentMeta);
4440
+ }
4441
+ handleToggleModal();
4442
+ }
4443
+ if (!isModalOpen) {
4444
+ setIsModalOpen(true);
4445
+ }
4446
+ }
4447
+ },
4448
+ width: "100%",
4449
+ children: triggerButtonLabel
4450
+ })
4451
+ })
4452
+ }),
4453
+ /*#__PURE__*/ jsxRuntime.jsxs(CustomModalContent, {
4454
+ children: [
4455
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Header, {
4456
+ gap: 2,
4457
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
4458
+ justifyContent: "space-between",
4459
+ alignItems: "center",
4460
+ width: "100%",
4461
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
4462
+ gap: 2,
4463
+ children: [
4464
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
4465
+ withTooltip: false,
4466
+ label: "Back",
4467
+ variant: "ghost",
4468
+ disabled: !hasHistory,
4469
+ onClick: ()=>{
4470
+ setActionPosition('back');
4471
+ if (modified && !isSubmitting) {
4472
+ setIsConfirmationOpen(true);
4473
+ } else {
4474
+ const previousRelation = getPreviousDocument();
4475
+ if (previousRelation) {
4476
+ removeLastDocumentFromHistory();
4477
+ changeDocument(previousRelation);
4478
+ }
4479
+ }
4480
+ },
4481
+ marginRight: 1,
4482
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.ArrowLeft, {})
4483
+ }),
4484
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
4485
+ tag: "span",
4486
+ fontWeight: 600,
4487
+ children: formatMessage({
4488
+ id: 'content-manager.components.RelationInputModal.modal-title',
4489
+ defaultMessage: 'Edit a relation'
4490
+ })
4491
+ })
4492
+ ]
4493
+ })
4494
+ })
4495
+ }),
4496
+ /*#__PURE__*/ jsxRuntime.jsx(RelationModalBody, {
4497
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
4498
+ onClick: ()=>{
4499
+ setActionPosition('navigate');
4500
+ if (modified && !isSubmitting) {
4501
+ setIsConfirmationOpen(true);
4502
+ } else {
4503
+ navigate(getFullPageLink());
4504
+ }
4505
+ },
4506
+ variant: "tertiary",
4507
+ label: formatMessage({
4508
+ id: 'content-manager.components.RelationInputModal.button-fullpage',
4509
+ defaultMessage: 'Go to entry'
4510
+ }),
4511
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.ArrowsOut, {})
4512
+ })
4513
+ }),
4514
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Footer, {
4515
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
4516
+ onClick: ()=>{
4517
+ if (modified && !isSubmitting) {
4518
+ setIsConfirmationOpen(true);
4519
+ } else {
4520
+ handleToggleModal();
4521
+ }
4522
+ },
4523
+ variant: "tertiary",
4524
+ children: formatMessage({
4525
+ id: 'app.components.Button.cancel',
4526
+ defaultMessage: 'Cancel'
4527
+ })
4528
+ })
4529
+ })
4530
+ ]
4531
+ })
4532
+ ]
4533
+ }),
4534
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Dialog.Root, {
4535
+ open: isConfirmationOpen,
4536
+ onOpenChange: setIsConfirmationOpen,
4537
+ children: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, {
4538
+ onConfirm: ()=>{
4539
+ handleConfirm();
4540
+ setIsConfirmationOpen(false);
4541
+ resetForm();
4542
+ },
4543
+ onCancel: ()=>{
4544
+ setIsConfirmationOpen(false);
4545
+ },
4546
+ variant: "danger",
4547
+ children: formatMessage({
4548
+ id: 'content-manager.components.RelationInputModal.confirmation-message',
4549
+ defaultMessage: 'Some changes were not saved. Are you sure you want to close this relation? All changes that were not saved will be lost.'
4550
+ })
4551
+ })
4552
+ })
4553
+ ]
4554
+ });
4555
+ }
4556
+ });
4557
+ };
4558
+ const CustomTextButton = styledComponents.styled(designSystem.TextButton)`
4559
+ & > span {
4560
+ font-size: ${({ theme })=>theme.fontSizes[2]};
4561
+ width: inherit;
4562
+ overflow: hidden;
4563
+ white-space: nowrap;
4564
+ text-overflow: ellipsis;
4565
+ }
4566
+ `;
4567
+ const RelationModalBody = ({ children })=>{
4568
+ const { formatMessage } = reactIntl.useIntl();
4569
+ const documentMeta = index.useDocumentContext('RelationModalBody', (state)=>state.meta);
4570
+ const documentResponse = index.useDocumentContext('RelationModalBody', (state)=>state.document);
4571
+ const onPreview = index.useDocumentContext('RelationModalBody', (state)=>state.onPreview);
4572
+ const documentLayoutResponse = index.useDocumentLayout(documentMeta.model);
4573
+ const plugins = strapiAdmin.useStrapiApp('RelationModalBody', (state)=>state.plugins);
4574
+ const initialValues = documentResponse.getInitialFormValues();
4575
+ const { permissions = [], isLoading: isLoadingPermissions, error } = strapiAdmin.useRBAC(index.PERMISSIONS.map((action)=>({
4576
+ action,
4577
+ subject: documentMeta.model
4578
+ })));
4579
+ const isLoading = isLoadingPermissions || documentLayoutResponse.isLoading || documentResponse.isLoading;
4580
+ if (isLoading && !documentResponse.document?.documentId) {
4581
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Loader, {
4582
+ small: true,
4583
+ children: formatMessage({
4584
+ id: 'content-manager.ListViewTable.relation-loading',
4585
+ defaultMessage: 'Relations are loading'
4586
+ })
4587
+ });
4588
+ }
4589
+ if (error || !documentMeta.model || documentLayoutResponse.error || !documentResponse.document || !documentResponse.meta || !documentResponse.schema || !initialValues) {
4590
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
4591
+ alignItems: "center",
4592
+ height: "100%",
4593
+ justifyContent: "center",
4594
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.EmptyStateLayout, {
4595
+ icon: /*#__PURE__*/ jsxRuntime.jsx(Icons.WarningCircle, {
4596
+ width: "16rem"
4597
+ }),
4598
+ content: formatMessage({
4599
+ id: 'anErrorOccurred',
4600
+ defaultMessage: 'Whoops! Something went wrong. Please, try again.'
4601
+ })
4602
+ })
4603
+ });
4604
+ }
4605
+ const documentTitle = documentResponse.getTitle(documentLayoutResponse.edit.settings.mainField);
4606
+ const hasDraftAndPublished = documentResponse.schema?.options?.draftAndPublish ?? false;
4607
+ const props = {
4608
+ activeTab: 'draft',
4609
+ collectionType: documentMeta.collectionType,
4610
+ model: documentMeta.model,
4611
+ documentId: documentMeta.documentId,
4612
+ document: documentResponse.document,
4613
+ meta: documentResponse.meta,
4614
+ onPreview,
4615
+ fromRelationModal: true,
4616
+ fromPreview: onPreview !== undefined
4617
+ };
4618
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Body, {
4619
+ children: /*#__PURE__*/ jsxRuntime.jsxs(index.DocumentRBAC, {
4620
+ permissions: permissions,
4621
+ model: documentMeta.model,
4622
+ children: [
4623
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
4624
+ alignItems: "flex-start",
4625
+ direction: "column",
4626
+ gap: 2,
4627
+ children: [
4628
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
4629
+ width: "100%",
4630
+ justifyContent: "space-between",
4631
+ gap: 2,
4632
+ children: [
4633
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
4634
+ tag: "h2",
4635
+ variant: "alpha",
4636
+ children: documentTitle
4637
+ }),
4638
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
4639
+ gap: 2,
4640
+ children: [
4641
+ children,
4642
+ /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.DescriptionComponentRenderer, {
4643
+ props: props,
4644
+ descriptions: plugins['content-manager'].apis.getDocumentActions('relation-modal'),
4645
+ children: (actions)=>{
4646
+ const filteredActions = actions.filter((action)=>{
4647
+ return [
4648
+ action.position
4649
+ ].flat().includes('relation-modal');
4650
+ });
4651
+ const [primaryAction, secondaryAction] = filteredActions;
4652
+ if (!primaryAction && !secondaryAction) return null;
4653
+ // Both actions are available when draft and publish enabled
4654
+ if (primaryAction && secondaryAction) {
4655
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
4656
+ children: [
4657
+ /*#__PURE__*/ jsxRuntime.jsx(index.DocumentActionButton, {
4658
+ ...secondaryAction,
4659
+ variant: secondaryAction.variant || 'secondary'
4660
+ }),
4661
+ /*#__PURE__*/ jsxRuntime.jsx(index.DocumentActionButton, {
4662
+ ...primaryAction,
4663
+ variant: primaryAction.variant || 'default'
4664
+ })
4665
+ ]
4666
+ });
4667
+ }
4668
+ // Otherwise we just have the save action
4669
+ return /*#__PURE__*/ jsxRuntime.jsx(index.DocumentActionButton, {
4670
+ ...primaryAction,
4671
+ variant: primaryAction.variant || 'secondary'
4672
+ });
4673
+ }
4674
+ })
4675
+ ]
4676
+ })
4677
+ ]
4678
+ }),
4679
+ hasDraftAndPublished ? /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
4680
+ children: /*#__PURE__*/ jsxRuntime.jsx(index.DocumentStatus, {
4681
+ status: documentResponse.document?.status
4682
+ })
4683
+ }) : null
4684
+ ]
4685
+ }),
4686
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
4687
+ flex: 1,
4688
+ overflow: "auto",
4689
+ alignItems: "stretch",
4690
+ paddingTop: 7,
4691
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
4692
+ overflow: "auto",
4693
+ flex: 1,
4694
+ children: /*#__PURE__*/ jsxRuntime.jsx(FormLayout, {
4695
+ layout: documentLayoutResponse.edit.layout,
4696
+ document: documentResponse,
4697
+ hasBackground: false
4698
+ })
4699
+ })
4700
+ })
4701
+ ]
4702
+ })
4703
+ });
4704
+ };
4705
+
4706
+ /**
4707
+ * Remove a relation, whether it's been already saved or not.
4708
+ * It's used both in RelationsList, where the "remove relation" button is, and in the input,
4709
+ * because we sometimes need to remove a previous relation when selecting a new one.
4710
+ */ function useHandleDisconnect(fieldName, consumerName) {
4711
+ const field = strapiAdmin.useField(fieldName);
4712
+ const removeFieldRow = strapiAdmin.useForm(consumerName, (state)=>state.removeFieldRow);
4713
+ const addFieldRow = strapiAdmin.useForm(consumerName, (state)=>state.addFieldRow);
4714
+ const handleDisconnect = (relation)=>{
4715
+ if (field.value && field.value.connect) {
4716
+ /**
4717
+ * A relation will exist in the `connect` array _if_ it has
4718
+ * been added without saving. In this case, we just remove it
4719
+ * from the connect array
4720
+ */ const indexOfRelationInConnectArray = field.value.connect.findIndex((rel)=>rel.id === relation.id);
4721
+ if (indexOfRelationInConnectArray >= 0) {
4722
+ removeFieldRow(`${fieldName}.connect`, indexOfRelationInConnectArray);
4723
+ return;
4724
+ }
4725
+ }
4726
+ addFieldRow(`${fieldName}.disconnect`, {
4727
+ id: relation.id,
4728
+ apiData: {
4729
+ id: relation.id,
4730
+ documentId: relation.documentId,
4731
+ locale: relation.locale
4732
+ }
4733
+ });
4734
+ };
4735
+ return handleDisconnect;
4736
+ }
4737
+ /* -------------------------------------------------------------------------------------------------
4738
+ * RelationsField
4739
+ * -----------------------------------------------------------------------------------------------*/ const RELATIONS_TO_DISPLAY = 5;
4740
+ const ONE_WAY_RELATIONS = [
4741
+ 'oneWay',
4742
+ 'oneToOne',
4743
+ 'manyToOne',
4744
+ 'oneToManyMorph',
4745
+ 'oneToOneMorph'
4746
+ ];
4747
+ /**
4748
+ * TODO: we get a rather ugly flash when we remove a single relation from the list leaving
4749
+ * no other relations when we press save. The initial relation re-renders, probably because
4750
+ * of the lag in the Form cleaning it's "disconnect" array, whilst our data has not been invalidated.
4751
+ *
4752
+ * Could we invalidate relation data on the document actions? Should we?
4753
+ */ /**
4754
+ * @internal
4755
+ * @description The relations field holds a lot of domain logic for handling relations which is rather complicated
4756
+ * At present we do not expose this to plugin developers, however, they are able to overwrite it themselves should
4757
+ * they wish to do so.
4758
+ */ const RelationsField = /*#__PURE__*/ React__namespace.forwardRef(({ disabled, label, ...props }, ref)=>{
4759
+ const currentDocumentMeta = index.useDocumentContext('RelationsField', (state)=>state.meta);
4760
+ const currentDocument = index.useDocumentContext('RelationsField', (state)=>state.document);
4761
+ const rootDocumentMeta = index.useDocumentContext('RelationsField', (state)=>state.rootDocumentMeta);
4762
+ const [currentPage, setCurrentPage] = React__namespace.useState(1);
4763
+ const isRootDocument = rootDocumentMeta.documentId === currentDocumentMeta.documentId;
4764
+ const documentMeta = isRootDocument ? rootDocumentMeta : currentDocumentMeta;
4765
+ // Use the documentId from the actual document, not the params (meta)
4766
+ const documentId = currentDocument.document?.documentId;
4767
+ const { formatMessage } = reactIntl.useIntl();
4768
+ const [{ query }] = strapiAdmin.useQueryParams();
4769
+ const params = documentMeta.params ?? index.buildValidParams(query);
4770
+ const isMorph = props.attribute.relation.toLowerCase().includes('morph');
4771
+ const isDisabled = isMorph || disabled;
4772
+ const { componentId, componentUID } = useComponent('RelationsField', ({ uid, id })=>({
4773
+ componentId: id,
4774
+ componentUID: uid
4775
+ }));
4776
+ const isSubmitting = strapiAdmin.useForm('RelationsList', (state)=>state.isSubmitting);
4777
+ React__namespace.useEffect(()=>{
4778
+ setCurrentPage(1);
4779
+ }, [
4780
+ isSubmitting
4781
+ ]);
4782
+ const component = componentUID && currentDocument.components[componentUID];
4783
+ /**
4784
+ * We'll always have a documentId in a created entry, so we look for a componentId first.
4785
+ * Same with `uid` and `documentModel`.
4786
+ */ const model = component ? component.uid : documentMeta.model;
4787
+ const id = component && componentId ? componentId.toString() : documentId;
4788
+ /**
4789
+ * The `name` prop is a complete path to the field, e.g. `field1.field2.field3`.
4790
+ * Where the above example would a nested field within two components, however
4791
+ * we only require the field on the component not the complete path since we query
4792
+ * individual components. Therefore we split the string and take the last item.
4793
+ */ const [targetField] = props.name.split('.').slice(-1);
4794
+ const schemaAttributes = component ? component.attributes ?? {} : currentDocument.schema?.attributes ?? {};
4795
+ /**
4796
+ * Confirm the target field is related to the current document.
4797
+ * Since relations can exist in a modal on top of the root document,
4798
+ * we need to ensure we are fetching relations for the correct document (root document vs related document),
4799
+ */ const isRelatedToCurrentDocument = Object.values(schemaAttributes).filter((attribute)=>attribute.type === 'relation' && 'target' in attribute && 'target' in props.attribute && attribute.target === props.attribute.target).length > 0;
4800
+ const { data, isLoading, isFetching } = usePrev.useGetRelationsQuery({
4801
+ model,
4802
+ targetField,
4803
+ // below we don't run the query if there is no id.
4804
+ id,
4805
+ params: {
4806
+ ...params,
4807
+ pageSize: RELATIONS_TO_DISPLAY,
4808
+ page: currentPage
4809
+ }
4810
+ }, {
4811
+ refetchOnMountOrArgChange: true,
4812
+ skip: !id || !isRelatedToCurrentDocument,
4813
+ selectFromResult: (result)=>{
4814
+ return {
4815
+ ...result,
4816
+ data: {
4817
+ ...result.data,
4818
+ results: result.data?.results ? result.data.results : []
4819
+ }
4820
+ };
4821
+ }
4822
+ });
4823
+ const handleLoadMore = ()=>{
4824
+ setCurrentPage((prev)=>prev + 1);
4825
+ };
4826
+ const field = strapiAdmin.useField(props.name);
4827
+ const isFetchingMoreRelations = isLoading || isFetching;
4828
+ const realServerRelationsCount = 'pagination' in data && data.pagination ? data.pagination.total : 0;
4829
+ /**
4830
+ * Items that are already connected, but reordered would be in
4831
+ * this list, so to get an accurate figure, we remove them.
4832
+ */ const relationsConnected = (field.value?.connect ?? []).filter((rel)=>data.results.findIndex((relation)=>relation.id === rel.id) === -1).length ?? 0;
4833
+ const relationsDisconnected = field.value?.disconnect?.length ?? 0;
4834
+ const relationsCount = realServerRelationsCount + relationsConnected - relationsDisconnected;
4835
+ /**
4836
+ * This is it, the source of truth for reordering in conjunction with partial loading & updating
4837
+ * of relations. Relations on load are given __temp_key__ when fetched, because we don't want to
4838
+ * create brand new keys everytime the data updates, just keep adding them onto the newly loaded ones.
4839
+ */ const relations = React__namespace.useMemo(()=>{
4840
+ const ctx = {
4841
+ field: field.value,
4842
+ // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.
4843
+ href: `../${index.COLLECTION_TYPES}/${props.attribute.targetModel}`,
4844
+ mainField: props.mainField
4845
+ };
4846
+ /**
4847
+ * Tidy up our data.
4848
+ */ const transformations = pipe$1(removeConnected(ctx), removeDisconnected(ctx), addLabelAndHref(ctx));
4849
+ const transformedRels = transformations([
4850
+ ...data.results
4851
+ ]);
4852
+ /**
4853
+ * THIS IS CRUCIAL. If you don't sort by the __temp_key__ which comes from fractional indexing
4854
+ * then the list will be in the wrong order.
4855
+ */ return [
4856
+ ...transformedRels,
4857
+ ...field.value?.connect ?? []
4858
+ ].sort((a, b)=>{
4859
+ if (a.__temp_key__ < b.__temp_key__) return -1;
4860
+ if (a.__temp_key__ > b.__temp_key__) return 1;
4861
+ return 0;
4862
+ });
4863
+ }, [
4864
+ data.results,
4865
+ field.value,
4866
+ // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.
4867
+ props.attribute.targetModel,
4868
+ props.mainField
4869
+ ]);
4870
+ const handleDisconnect = useHandleDisconnect(props.name, 'RelationsField');
4871
+ const handleConnect = (relation)=>{
4872
+ const [lastItemInList] = relations.slice(-1);
4873
+ const item = {
4874
+ id: relation.id,
4875
+ apiData: {
4876
+ id: relation.id,
4877
+ documentId: relation.documentId,
4878
+ locale: relation.locale
4879
+ },
4880
+ status: relation.status,
4881
+ /**
4882
+ * If there's a last item, that's the first key we use to generate out next one.
4883
+ */ __temp_key__: fractionalIndexing.generateNKeysBetween(lastItemInList?.__temp_key__ ?? null, null, 1)[0],
4884
+ // Fallback to `id` if there is no `mainField` value, which will overwrite the above `id` property with the exact same data.
4885
+ [props.mainField?.name ?? 'documentId']: relation[props.mainField?.name ?? 'documentId'],
4886
+ label: usePrev.getRelationLabel(relation, props.mainField),
4887
+ // @ts-expect-error – targetModel does exist on the attribute, but it's not typed.
4888
+ href: `../${index.COLLECTION_TYPES}/${props.attribute.targetModel}/${relation.documentId}?${relation.locale ? `plugins[i18n][locale]=${relation.locale}` : ''}`
4889
+ };
4890
+ if (ONE_WAY_RELATIONS.includes(props.attribute.relation)) {
4891
+ // Remove any existing relation so they can be replaced with the new one
4892
+ field.value?.connect?.forEach(handleDisconnect);
4893
+ relations.forEach(handleDisconnect);
4894
+ field.onChange(`${props.name}.connect`, [
4895
+ item
4896
+ ]);
4897
+ } else {
4898
+ field.onChange(`${props.name}.connect`, [
4899
+ ...field.value?.connect ?? [],
4900
+ item
4901
+ ]);
4902
+ }
4903
+ };
4904
+ return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
4905
+ ref: ref,
4906
+ direction: "column",
4907
+ gap: 3,
4908
+ justifyContent: "space-between",
4909
+ alignItems: "stretch",
4910
+ wrap: "wrap",
4911
+ children: [
4912
+ /*#__PURE__*/ jsxRuntime.jsxs(StyledFlex, {
4913
+ direction: "column",
4914
+ alignItems: "start",
4915
+ gap: 2,
4916
+ width: "100%",
4917
+ children: [
4918
+ /*#__PURE__*/ jsxRuntime.jsx(RelationsInput, {
4919
+ disabled: isDisabled,
4920
+ // NOTE: we should not default to using the documentId if the component is being created (componentUID is undefined)
4921
+ id: componentUID && component ? componentId ? `${componentId}` : '' : documentId,
4922
+ label: `${label} ${relationsCount > 0 ? `(${relationsCount})` : ''}`,
4923
+ model: model,
4924
+ onChange: handleConnect,
4925
+ isRelatedToCurrentDocument: isRelatedToCurrentDocument,
4926
+ ...props
4927
+ }),
4928
+ 'pagination' in data && data.pagination && data.pagination.pageCount > data.pagination.page ? /*#__PURE__*/ jsxRuntime.jsx(designSystem.TextButton, {
4929
+ disabled: isFetchingMoreRelations,
4930
+ onClick: handleLoadMore,
4931
+ loading: isFetchingMoreRelations,
4932
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.ArrowClockwise, {}),
4933
+ // prevent the label from line-wrapping
4934
+ shrink: 0,
4935
+ children: formatMessage({
4936
+ id: index.getTranslation('relation.loadMore'),
4937
+ defaultMessage: 'Load More'
4938
+ })
4939
+ }) : null
4940
+ ]
4941
+ }),
4942
+ /*#__PURE__*/ jsxRuntime.jsx(RelationsList, {
4943
+ data: relations,
4944
+ serverData: data.results,
4945
+ disabled: isDisabled,
4946
+ name: props.name,
4947
+ isLoading: isFetchingMoreRelations,
4948
+ relationType: props.attribute.relation,
4949
+ // @ts-expect-error – targetModel does exist on the attribute. But it's not typed.
4950
+ targetModel: props.attribute.targetModel
4951
+ })
4952
+ ]
4953
+ });
4954
+ });
4955
+ /**
4956
+ * TODO: this can be removed once we stop shipping Inputs with
4957
+ * labels wrapped round in DS@2.
4958
+ */ const StyledFlex = styledComponents.styled(designSystem.Flex)`
4959
+ & > div {
4960
+ width: 100%;
4961
+ }
4962
+ `;
4963
+ /**
4964
+ * If it's in the connected array, it can get out of our data array,
4965
+ * we'll be putting it back in later and sorting it anyway.
4966
+ */ const removeConnected = ({ field })=>(relations)=>{
4967
+ return relations.filter((relation)=>{
4968
+ const connectedRelations = field?.connect ?? [];
4969
+ return connectedRelations.findIndex((rel)=>rel.id === relation.id) === -1;
4970
+ });
4971
+ };
4972
+ /**
4973
+ * @description Removes relations that are in the `disconnect` array of the field
4974
+ */ const removeDisconnected = ({ field })=>(relations)=>relations.filter((relation)=>{
4975
+ const disconnectedRelations = field?.disconnect ?? [];
4976
+ return disconnectedRelations.findIndex((rel)=>rel.id === relation.id) === -1;
4977
+ });
4978
+ /**
4979
+ * @description Adds a label and href to the relation object we use this to render
4980
+ * a better UI where we can link to the relation and display a human-readable label.
4981
+ */ const addLabelAndHref = ({ mainField, href })=>(relations)=>relations.map((relation)=>{
4982
+ return {
4983
+ ...relation,
4984
+ // Fallback to `id` if there is no `mainField` value, which will overwrite the above `documentId` property with the exact same data.
4985
+ [mainField?.name ?? 'documentId']: relation[mainField?.name ?? 'documentId'],
4986
+ label: usePrev.getRelationLabel(relation, mainField),
4987
+ href: `${href}/${relation.documentId}?${relation.locale ? `plugins[i18n][locale]=${relation.locale}` : ''}`
4988
+ };
4989
+ });
4990
+ /**
4991
+ * @description Contains all the logic for the combobox that can search
4992
+ * for relations and then add them to the field's connect array.
4993
+ */ const RelationsInput = ({ hint, id, model, label, labelAction, name, mainField, placeholder, required, unique: _unique, 'aria-label': _ariaLabel, onChange, isRelatedToCurrentDocument, ...props })=>{
4994
+ const [textValue, setTextValue] = React__namespace.useState('');
4995
+ const [searchParams, setSearchParams] = React__namespace.useState({
4996
+ _q: '',
4997
+ page: 1
4998
+ });
4999
+ const { toggleNotification } = strapiAdmin.useNotification();
5000
+ const [{ query }] = strapiAdmin.useQueryParams();
5001
+ const currentDocumentMeta = index.useDocumentContext('RelationsInput', (state)=>state.meta);
5002
+ const rootDocumentMeta = index.useDocumentContext('RelationsInput', (state)=>state.rootDocumentMeta);
5003
+ const isRootDocument = rootDocumentMeta.documentId === currentDocumentMeta.documentId;
5004
+ const documentMeta = isRootDocument ? rootDocumentMeta : currentDocumentMeta;
5005
+ const { formatMessage } = reactIntl.useIntl();
5006
+ const fieldRef = strapiAdmin.useFocusInputField(name);
5007
+ const field = strapiAdmin.useField(name);
5008
+ const searchParamsDebounced = usePrev.useDebounce(searchParams, 300);
5009
+ const [searchForTrigger, { data, isLoading }] = usePrev.useLazySearchRelationsQuery();
5010
+ /**
5011
+ * Because we're using a lazy query, we need to trigger the search
5012
+ * when the component mounts and when the search params change.
5013
+ * We also need to trigger the search when the field value changes
5014
+ * so that we can filter out the relations that are already connected.
5015
+ */ React__namespace.useEffect(()=>{
5016
+ /**
5017
+ * The `name` prop is a complete path to the field, e.g. `field1.field2.field3`.
5018
+ * Where the above example would a nested field within two components, however
5019
+ * we only require the field on the component not the complete path since we query
5020
+ * individual components. Therefore we split the string and take the last item.
5021
+ */ const [targetField] = name.split('.').slice(-1);
5022
+ // Return early if there is no relation to the document
5023
+ if (!isRelatedToCurrentDocument) return;
5024
+ const params = documentMeta.params ?? index.buildValidParams(query);
5025
+ searchForTrigger({
5026
+ model,
5027
+ targetField,
5028
+ params: {
5029
+ ...params,
5030
+ id: id ?? '',
5031
+ pageSize: 10,
5032
+ idsToInclude: field.value?.disconnect?.map((rel)=>rel.id.toString()) ?? [],
5033
+ idsToOmit: field.value?.connect?.map((rel)=>rel.id.toString()) ?? [],
5034
+ ...searchParamsDebounced
5035
+ }
5036
+ });
5037
+ }, [
5038
+ field.value?.connect,
5039
+ field.value?.disconnect,
5040
+ id,
5041
+ model,
5042
+ name,
5043
+ query,
5044
+ searchForTrigger,
5045
+ searchParamsDebounced,
5046
+ isRelatedToCurrentDocument,
5047
+ documentMeta
5048
+ ]);
5049
+ const handleSearch = async (search)=>{
5050
+ setSearchParams((s)=>({
5051
+ ...s,
5052
+ _q: search,
5053
+ page: 1
5054
+ }));
5055
+ };
5056
+ const hasNextPage = data?.pagination ? data.pagination.page < data.pagination.pageCount : false;
5057
+ const options = data?.results ?? [];
5058
+ const handleChange = (relationId)=>{
5059
+ if (!relationId) {
5060
+ return;
5061
+ }
5062
+ const relation = options.find((opt)=>opt.id.toString() === relationId);
5063
+ if (!relation) {
5064
+ // This is very unlikely to happen, but it ensures we don't have any data for.
5065
+ console.error("You've tried to add a relation with an id that does not exist in the options you can see, this is likely a bug with Strapi. Please open an issue.");
5066
+ toggleNotification({
5067
+ message: formatMessage({
5068
+ id: index.getTranslation('relation.error-adding-relation'),
5069
+ defaultMessage: 'An error occurred while trying to add the relation.'
5070
+ }),
5071
+ type: 'danger'
5072
+ });
5073
+ return;
5074
+ }
5075
+ /**
5076
+ * You need to give this relation a correct _temp_key_ but
5077
+ * this component doesn't know about those ones, you can't rely
5078
+ * on the connect array because that doesn't hold items that haven't
5079
+ * moved. So use a callback to fill in the gaps when connecting.
5080
+ *
5081
+ */ onChange(relation);
5082
+ };
5083
+ const handleLoadMore = ()=>{
5084
+ if (!data || !data.pagination) {
5085
+ return;
5086
+ } else if (data.pagination.page < data.pagination.pageCount) {
5087
+ setSearchParams((s)=>({
5088
+ ...s,
5089
+ page: s.page + 1
5090
+ }));
5091
+ }
5092
+ };
5093
+ React__namespace.useLayoutEffect(()=>{
5094
+ setTextValue('');
5095
+ }, [
5096
+ field.value
5097
+ ]);
5098
+ return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Field.Root, {
5099
+ error: field.error,
5100
+ hint: hint,
5101
+ name: name,
5102
+ required: required,
5103
+ children: [
5104
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Label, {
5105
+ action: labelAction,
5106
+ children: label
5107
+ }),
5108
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Combobox, {
5109
+ ref: fieldRef,
5110
+ name: name,
5111
+ autocomplete: "list",
5112
+ placeholder: placeholder || formatMessage({
5113
+ id: index.getTranslation('relation.add'),
5114
+ defaultMessage: 'Add relation'
5115
+ }),
5116
+ hasMoreItems: hasNextPage,
5117
+ loading: isLoading,
5118
+ onOpenChange: ()=>{
5119
+ handleSearch(textValue ?? '');
5120
+ },
5121
+ noOptionsMessage: ()=>formatMessage({
5122
+ id: index.getTranslation('relation.notAvailable'),
5123
+ defaultMessage: 'No relations available'
5124
+ }),
5125
+ loadingMessage: formatMessage({
5126
+ id: index.getTranslation('relation.isLoading'),
5127
+ defaultMessage: 'Relations are loading'
5128
+ }),
5129
+ onLoadMore: handleLoadMore,
5130
+ textValue: textValue,
5131
+ onChange: handleChange,
5132
+ onTextValueChange: (text)=>{
5133
+ setTextValue(text);
5134
+ },
5135
+ onInputChange: (event)=>{
5136
+ handleSearch(event.currentTarget.value);
5137
+ },
5138
+ ...props,
5139
+ children: options.map((opt)=>{
5140
+ const textValue = usePrev.getRelationLabel(opt, mainField);
5141
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.ComboboxOption, {
5142
+ value: opt.id.toString(),
5143
+ textValue: textValue,
5144
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
5145
+ gap: 2,
5146
+ justifyContent: "space-between",
5147
+ children: [
5148
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
5149
+ ellipsis: true,
5150
+ children: textValue
5151
+ }),
5152
+ opt.status ? /*#__PURE__*/ jsxRuntime.jsx(index.DocumentStatus, {
5153
+ status: opt.status
5154
+ }) : null
5155
+ ]
5156
+ })
5157
+ }, opt.id);
5158
+ })
5159
+ }),
5160
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Error, {}),
5161
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Hint, {})
5162
+ ]
5163
+ });
5164
+ };
5165
+ /* -------------------------------------------------------------------------------------------------
5166
+ * RelationsList
5167
+ * -----------------------------------------------------------------------------------------------*/ const RELATION_ITEM_HEIGHT = 50;
5168
+ const RELATION_GUTTER = 4;
5169
+ const RelationsList = ({ data, serverData, disabled, name, isLoading, relationType, targetModel })=>{
5170
+ const ariaDescriptionId = React__namespace.useId();
5171
+ const { formatMessage } = reactIntl.useIntl();
5172
+ const listRef = React__namespace.useRef(null);
5173
+ const outerListRef = React__namespace.useRef(null);
5174
+ const [overflow, setOverflow] = React__namespace.useState();
5175
+ const [liveText, setLiveText] = React__namespace.useState('');
5176
+ const field = strapiAdmin.useField(name);
5177
+ React__namespace.useEffect(()=>{
5178
+ if (data.length <= RELATIONS_TO_DISPLAY) {
5179
+ return setOverflow(undefined);
5180
+ }
5181
+ const handleNativeScroll = (e)=>{
5182
+ const el = e.target;
5183
+ const parentScrollContainerHeight = el.parentNode.scrollHeight;
5184
+ const maxScrollBottom = el.scrollHeight - el.scrollTop;
5185
+ if (el.scrollTop === 0) {
5186
+ return setOverflow('bottom');
5187
+ }
5188
+ if (maxScrollBottom === parentScrollContainerHeight) {
5189
+ return setOverflow('top');
5190
+ }
5191
+ return setOverflow('top-bottom');
5192
+ };
5193
+ const outerListRefCurrent = outerListRef?.current;
5194
+ if (!isLoading && data.length > 0 && outerListRefCurrent) {
5195
+ outerListRef.current.addEventListener('scroll', handleNativeScroll);
5196
+ }
5197
+ return ()=>{
5198
+ if (outerListRefCurrent) {
5199
+ outerListRefCurrent.removeEventListener('scroll', handleNativeScroll);
5200
+ }
5201
+ };
5202
+ }, [
5203
+ isLoading,
5204
+ data.length
5205
+ ]);
5206
+ const getItemPos = (index)=>`${index + 1} of ${data.length}`;
5207
+ const handleMoveItem = (newIndex, oldIndex)=>{
5208
+ const item = data[oldIndex];
5209
+ setLiveText(formatMessage({
5210
+ id: index.getTranslation('dnd.reorder'),
5211
+ defaultMessage: '{item}, moved. New position in list: {position}.'
5212
+ }, {
5213
+ item: item.label ?? item.documentId,
5214
+ position: getItemPos(newIndex)
5215
+ }));
5216
+ /**
5217
+ * Splicing mutates the array, so we need to create a new array
5218
+ */ const newData = [
5219
+ ...data
5220
+ ];
5221
+ const currentRow = data[oldIndex];
5222
+ const startKey = oldIndex > newIndex ? newData[newIndex - 1]?.__temp_key__ : newData[newIndex]?.__temp_key__;
5223
+ const endKey = oldIndex > newIndex ? newData[newIndex]?.__temp_key__ : newData[newIndex + 1]?.__temp_key__;
5224
+ /**
5225
+ * We're moving the relation between two other relations, so
5226
+ * we need to generate a new key that keeps the order
5227
+ */ const [newKey] = fractionalIndexing.generateNKeysBetween(startKey, endKey, 1);
5228
+ newData.splice(oldIndex, 1);
5229
+ newData.splice(newIndex, 0, {
5230
+ ...currentRow,
5231
+ __temp_key__: newKey
5232
+ });
5233
+ /**
5234
+ * Now we diff against the server to understand what's different so we
5235
+ * can keep the connect array nice and tidy. It also needs reversing because
5236
+ * we reverse the relations from the server in the first place.
5237
+ */ const connectedRelations = newData.reduce((acc, relation, currentIndex, array)=>{
5238
+ const relationOnServer = serverData.find((oldRelation)=>oldRelation.id === relation.id);
5239
+ const relationInFront = array[currentIndex + 1];
5240
+ if (!relationOnServer || relationOnServer.__temp_key__ !== relation.__temp_key__) {
5241
+ const position = relationInFront ? {
5242
+ before: relationInFront.documentId,
5243
+ locale: relationInFront.locale,
5244
+ status: 'publishedAt' in relationInFront && relationInFront.publishedAt ? 'published' : 'draft'
5245
+ } : {
5246
+ end: true
5247
+ };
5248
+ const relationWithPosition = {
5249
+ ...relation,
5250
+ ...{
5251
+ apiData: {
5252
+ id: relation.id,
5253
+ documentId: relation.documentId ?? relation.apiData?.documentId ?? '',
5254
+ locale: relation.locale || relation.apiData?.locale,
5255
+ position
5256
+ }
5257
+ }
5258
+ };
5259
+ return [
5260
+ ...acc,
5261
+ relationWithPosition
5262
+ ];
5263
+ }
5264
+ return acc;
5265
+ }, []).toReversed();
5266
+ field.onChange(`${name}.connect`, connectedRelations);
5267
+ };
5268
+ const handleGrabItem = (index$1)=>{
5269
+ const item = data[index$1];
5270
+ setLiveText(formatMessage({
5271
+ id: index.getTranslation('dnd.grab-item'),
5272
+ defaultMessage: `{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel.`
5273
+ }, {
5274
+ item: item.label ?? item.documentId,
5275
+ position: getItemPos(index$1)
5276
+ }));
5277
+ };
5278
+ const handleDropItem = (index$1)=>{
5279
+ const { href: _href, label, ...item } = data[index$1];
5280
+ setLiveText(formatMessage({
5281
+ id: index.getTranslation('dnd.drop-item'),
5282
+ defaultMessage: `{item}, dropped. Final position in list: {position}.`
5283
+ }, {
5284
+ item: label ?? item.documentId,
5285
+ position: getItemPos(index$1)
5286
+ }));
5287
+ };
5288
+ const handleCancel = (index$1)=>{
5289
+ const item = data[index$1];
5290
+ setLiveText(formatMessage({
5291
+ id: index.getTranslation('dnd.cancel-item'),
5292
+ defaultMessage: '{item}, dropped. Re-order cancelled.'
5293
+ }, {
5294
+ item: item.label ?? item.documentId
5295
+ }));
5296
+ };
5297
+ const handleDisconnect = useHandleDisconnect(name, 'RelationsList');
5298
+ /**
5299
+ * These relation types will only ever have one item
5300
+ * in their list, so you can't reorder a single item!
5301
+ */ const canReorder = !ONE_WAY_RELATIONS.includes(relationType);
5302
+ const dynamicListHeight = data.length > RELATIONS_TO_DISPLAY ? Math.min(data.length, RELATIONS_TO_DISPLAY) * (RELATION_ITEM_HEIGHT + RELATION_GUTTER) + RELATION_ITEM_HEIGHT / 2 : Math.min(data.length, RELATIONS_TO_DISPLAY) * (RELATION_ITEM_HEIGHT + RELATION_GUTTER);
5303
+ return /*#__PURE__*/ jsxRuntime.jsxs(ShadowBox, {
5304
+ $overflowDirection: overflow,
5305
+ children: [
5306
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.VisuallyHidden, {
5307
+ id: ariaDescriptionId,
5308
+ children: formatMessage({
5309
+ id: index.getTranslation('dnd.instructions'),
5310
+ defaultMessage: `Press spacebar to grab and re-order`
5311
+ })
5312
+ }),
5313
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.VisuallyHidden, {
5314
+ "aria-live": "assertive",
5315
+ children: liveText
5316
+ }),
5317
+ /*#__PURE__*/ jsxRuntime.jsx(reactWindow.FixedSizeList, {
5318
+ height: dynamicListHeight,
5319
+ ref: listRef,
5320
+ outerRef: outerListRef,
5321
+ itemCount: data.length,
5322
+ itemSize: RELATION_ITEM_HEIGHT + RELATION_GUTTER,
5323
+ itemData: {
5324
+ ariaDescribedBy: ariaDescriptionId,
5325
+ canDrag: canReorder,
5326
+ disabled,
5327
+ handleCancel,
5328
+ handleDropItem,
5329
+ handleGrabItem,
5330
+ handleMoveItem,
5331
+ name,
5332
+ handleDisconnect,
5333
+ relations: data,
5334
+ targetModel
5335
+ },
5336
+ itemKey: (index)=>data[index].id,
5337
+ innerElementType: "ol",
5338
+ children: ListItem
5339
+ })
5340
+ ]
5341
+ });
5342
+ };
5343
+ const ShadowBox = styledComponents.styled(designSystem.Box)`
5344
+ position: relative;
5345
+ overflow: hidden;
5346
+ flex: 1;
5347
+
5348
+ &:before,
5349
+ &:after {
5350
+ position: absolute;
5351
+ width: 100%;
5352
+ height: 4px;
5353
+ z-index: 1;
5354
+ }
5355
+
5356
+ &:before {
5357
+ /* TODO: as for DS Table component we would need this to be handled by the DS theme */
5358
+ content: '';
5359
+ background: linear-gradient(rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
5360
+ top: 0;
5361
+ opacity: ${({ $overflowDirection })=>$overflowDirection === 'top-bottom' || $overflowDirection === 'top' ? 1 : 0};
5362
+ transition: opacity 0.2s ease-in-out;
5363
+ }
5364
+
5365
+ &:after {
5366
+ /* TODO: as for DS Table component we would need this to be handled by the DS theme */
5367
+ content: '';
5368
+ background: linear-gradient(0deg, rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
5369
+ bottom: 0;
5370
+ opacity: ${({ $overflowDirection })=>$overflowDirection === 'top-bottom' || $overflowDirection === 'bottom' ? 1 : 0};
5371
+ transition: opacity 0.2s ease-in-out;
5372
+ }
5373
+ `;
5374
+ const ListItem = ({ data, index: index$1, style })=>{
5375
+ const { ariaDescribedBy, canDrag = false, disabled = false, handleCancel, handleDisconnect, handleDropItem, handleGrabItem, handleMoveItem, name, relations, targetModel } = data;
5376
+ const { formatMessage } = reactIntl.useIntl();
5377
+ const { href, id, label, status, documentId, apiData, locale } = relations[index$1];
5378
+ const [{ handlerId, isDragging, handleKeyDown }, relationRef, dropRef, dragRef, dragPreviewRef] = objects.useDragAndDrop(canDrag && !disabled, {
5379
+ type: `${objects.ItemTypes.RELATION}_${name}`,
5380
+ index: index$1,
5381
+ item: {
5382
+ displayedValue: label,
5383
+ status,
5384
+ id: id,
5385
+ index: index$1
5386
+ },
5387
+ onMoveItem: handleMoveItem,
5388
+ onDropItem: handleDropItem,
5389
+ onGrabItem: handleGrabItem,
5390
+ onCancel: handleCancel,
5391
+ dropSensitivity: objects.DROP_SENSITIVITY.REGULAR
5392
+ });
5393
+ const composedRefs = designSystem.useComposedRefs(relationRef, dragRef);
5394
+ React__namespace.useEffect(()=>{
5395
+ dragPreviewRef(reactDndHtml5Backend.getEmptyImage());
5396
+ }, [
5397
+ dragPreviewRef
5398
+ ]);
5399
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
5400
+ style: style,
5401
+ tag: "li",
5402
+ ref: dropRef,
5403
+ "aria-describedby": ariaDescribedBy,
5404
+ cursor: canDrag ? 'all-scroll' : 'default',
5405
+ children: isDragging ? /*#__PURE__*/ jsxRuntime.jsx(RelationItemPlaceholder, {}) : /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
5406
+ paddingTop: 2,
5407
+ paddingBottom: 2,
5408
+ paddingLeft: canDrag ? 2 : 4,
5409
+ paddingRight: 4,
5410
+ hasRadius: true,
5411
+ borderColor: "neutral200",
5412
+ background: disabled ? 'neutral150' : 'neutral0',
5413
+ justifyContent: "space-between",
5414
+ ref: composedRefs,
5415
+ "data-handler-id": handlerId,
5416
+ children: [
5417
+ /*#__PURE__*/ jsxRuntime.jsxs(FlexWrapper, {
5418
+ gap: 1,
5419
+ children: [
5420
+ canDrag ? /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5421
+ tag: "div",
5422
+ role: "button",
5423
+ tabIndex: 0,
5424
+ withTooltip: false,
5425
+ label: formatMessage({
5426
+ id: index.getTranslation('components.RelationInput.icon-button-aria-label'),
5427
+ defaultMessage: 'Drag'
5428
+ }),
5429
+ variant: "ghost",
5430
+ onKeyDown: handleKeyDown,
5431
+ disabled: disabled,
5432
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Drag, {})
5433
+ }) : null,
5434
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
5435
+ width: "100%",
5436
+ minWidth: 0,
5437
+ justifyContent: "space-between",
5438
+ children: [
5439
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
5440
+ minWidth: 0,
5441
+ paddingTop: 1,
5442
+ paddingBottom: 1,
5443
+ paddingRight: 4,
5444
+ children: /*#__PURE__*/ jsxRuntime.jsx(RelationModalForm, {
5445
+ triggerButtonLabel: label,
5446
+ relation: {
5447
+ documentId: documentId ?? apiData?.documentId,
5448
+ model: targetModel,
5449
+ collectionType: getCollectionType(href),
5450
+ params: {
5451
+ locale: locale || apiData?.locale || null
5452
+ }
5453
+ }
5454
+ })
5455
+ }),
5456
+ status ? /*#__PURE__*/ jsxRuntime.jsx(index.DocumentStatus, {
5457
+ status: status
5458
+ }) : null
5459
+ ]
5460
+ })
5461
+ ]
5462
+ }),
5463
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
5464
+ paddingLeft: 4,
5465
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5466
+ onClick: ()=>handleDisconnect(relations[index$1]),
5467
+ disabled: disabled,
5468
+ label: formatMessage({
5469
+ id: index.getTranslation('relation.disconnect'),
5470
+ defaultMessage: 'Remove'
5471
+ }),
5472
+ variant: "ghost",
5473
+ size: "S",
5474
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Cross, {})
5475
+ })
5476
+ })
5477
+ ]
5478
+ })
5479
+ });
5480
+ };
5481
+ const FlexWrapper = styledComponents.styled(designSystem.Flex)`
5482
+ width: 100%;
5483
+ /* Used to prevent endAction to be pushed out of container */
5484
+ min-width: 0;
5485
+
5486
+ & > div[role='button'] {
5487
+ cursor: all-scroll;
5488
+ }
5489
+ `;
5490
+ const DisconnectButton = styledComponents.styled.button`
5491
+ svg path {
5492
+ fill: ${({ theme, disabled })=>disabled ? theme.colors.neutral600 : theme.colors.neutral500};
5493
+ }
5494
+
5495
+ &:hover svg path,
5496
+ &:focus svg path {
5497
+ fill: ${({ theme, disabled })=>!disabled && theme.colors.neutral600};
5498
+ }
5499
+ `;
5500
+ const LinkEllipsis = styledComponents.styled(designSystem.Link)`
5501
+ display: block;
5502
+
5503
+ & > span {
5504
+ white-space: nowrap;
5505
+ overflow: hidden;
5506
+ text-overflow: ellipsis;
5507
+ display: block;
5508
+ }
5509
+ `;
5510
+ const RelationItemPlaceholder = ()=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
5511
+ paddingTop: 2,
5512
+ paddingBottom: 2,
5513
+ paddingLeft: 4,
5514
+ paddingRight: 4,
5515
+ hasRadius: true,
5516
+ borderStyle: "dashed",
5517
+ borderColor: "primary600",
5518
+ borderWidth: "1px",
5519
+ background: "primary100",
5520
+ height: `calc(100% - ${RELATION_GUTTER}px)`
5521
+ });
5522
+ const MemoizedRelationsField = /*#__PURE__*/ React__namespace.memo(RelationsField);
5523
+
5524
+ const uidApi = index.contentManagerApi.injectEndpoints({
5525
+ endpoints: (builder)=>({
5526
+ getDefaultUID: builder.query({
5527
+ query: ({ params, ...data })=>{
5528
+ return {
5529
+ url: '/content-manager/uid/generate',
5530
+ method: 'POST',
5531
+ data,
5532
+ config: {
5533
+ params
5534
+ }
5535
+ };
5536
+ },
5537
+ transformResponse: (response)=>response.data
5538
+ }),
5539
+ generateUID: builder.mutation({
5540
+ query: ({ params, ...data })=>({
5541
+ url: '/content-manager/uid/generate',
5542
+ method: 'POST',
5543
+ data,
5544
+ config: {
5545
+ params
5546
+ }
5547
+ }),
5548
+ transformResponse: (response)=>response.data
5549
+ }),
5550
+ getAvailability: builder.query({
5551
+ query: ({ params, ...data })=>({
5552
+ url: '/content-manager/uid/check-availability',
5553
+ method: 'POST',
5554
+ data,
5555
+ config: {
5556
+ params
5557
+ }
5558
+ }),
5559
+ providesTags: (_res, _error, params)=>[
5560
+ {
5561
+ type: 'UidAvailability',
5562
+ id: params.contentTypeUID
5563
+ }
5564
+ ]
5565
+ })
5566
+ })
5567
+ });
5568
+ const { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;
5569
+
5570
+ /* -------------------------------------------------------------------------------------------------
5571
+ * InputUID
5572
+ * -----------------------------------------------------------------------------------------------*/ const UID_REGEX = /^[A-Za-z0-9-_.~]*$/;
5573
+ const UIDInput = /*#__PURE__*/ React__namespace.forwardRef(({ hint, label, labelAction, name, required, ...props }, ref)=>{
5574
+ const { model, id } = index.useDoc();
5575
+ const allFormValues = strapiAdmin.useForm('InputUID', (form)=>form.values);
4101
5576
  const [availability, setAvailability] = React__namespace.useState();
4102
5577
  const [showRegenerate, setShowRegenerate] = React__namespace.useState(false);
4103
5578
  const isCloning = reactRouterDom.useMatch(index.CLONE_PATH) !== null;
4104
5579
  const field = strapiAdmin.useField(name);
4105
- const debouncedValue = relations.useDebounce(field.value, 300);
5580
+ const debouncedValue = usePrev.useDebounce(field.value, 300);
4106
5581
  const hasChanged = debouncedValue !== field.initialValue;
4107
5582
  const { toggleNotification } = strapiAdmin.useNotification();
4108
5583
  const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
@@ -5550,14 +7025,14 @@ const quoteAndCodeHandler = (editor, markdownType)=>{
5550
7025
  };
5551
7026
 
5552
7027
  // NAV BUTTONS
5553
- const MainButtons = styledComponents.styled(designSystem.IconButtonGroup)`
7028
+ styledComponents.styled(designSystem.IconButtonGroup)`
5554
7029
  margin-left: ${({ theme })=>theme.spaces[4]};
5555
7030
  `;
5556
- const MoreButton = styledComponents.styled(designSystem.IconButton)`
7031
+ styledComponents.styled(designSystem.IconButton)`
5557
7032
  margin: ${({ theme })=>`0 ${theme.spaces[2]}`};
5558
7033
  `;
5559
7034
  // NAV
5560
- const IconButtonGroupMargin = styledComponents.styled(designSystem.IconButtonGroup)`
7035
+ styledComponents.styled(designSystem.IconButtonGroup)`
5561
7036
  margin-right: ${({ theme })=>`${theme.spaces[2]}`};
5562
7037
  `;
5563
7038
  // FOOTER
@@ -5606,254 +7081,524 @@ const WysiwygFooter = ({ onToggleExpand })=>{
5606
7081
  defaultMessage: 'Expand'
5607
7082
  })
5608
7083
  }),
5609
- /*#__PURE__*/ jsxRuntime.jsx(Icons.Expand, {})
7084
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.Expand, {})
7085
+ ]
7086
+ })
7087
+ })
7088
+ });
7089
+ };
7090
+
7091
+ /**
7092
+ * TODO: refactor this mess.
7093
+ */ const WysiwygNav = ({ disabled, editorRef, isPreviewMode, onToggleMediaLib, onTogglePreviewMode })=>{
7094
+ const { formatMessage } = reactIntl.useIntl();
7095
+ const isDisabled = disabled || isPreviewMode;
7096
+ const handleActionClick = (value, currentEditorRef)=>{
7097
+ switch(value){
7098
+ case 'Link':
7099
+ {
7100
+ markdownHandler(currentEditorRef, value);
7101
+ break;
7102
+ }
7103
+ case 'Code':
7104
+ case 'Quote':
7105
+ {
7106
+ quoteAndCodeHandler(currentEditorRef, value);
7107
+ break;
7108
+ }
7109
+ case 'Bold':
7110
+ case 'Italic':
7111
+ case 'Underline':
7112
+ case 'Strikethrough':
7113
+ {
7114
+ markdownHandler(currentEditorRef, value);
7115
+ break;
7116
+ }
7117
+ case 'BulletList':
7118
+ case 'NumberList':
7119
+ {
7120
+ listHandler(currentEditorRef, value);
7121
+ break;
7122
+ }
7123
+ case 'h1':
7124
+ case 'h2':
7125
+ case 'h3':
7126
+ case 'h4':
7127
+ case 'h5':
7128
+ case 'h6':
7129
+ {
7130
+ titleHandler(currentEditorRef, value);
7131
+ break;
7132
+ }
7133
+ }
7134
+ };
7135
+ const observedComponents = [
7136
+ {
7137
+ toolbar: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.IconButtonGroup, {
7138
+ children: [
7139
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
7140
+ disabled: isDisabled,
7141
+ onClick: ()=>handleActionClick('Bold', editorRef),
7142
+ label: formatMessage({
7143
+ id: 'components.Blocks.modifiers.bold',
7144
+ defaultMessage: 'Bold'
7145
+ }),
7146
+ name: formatMessage({
7147
+ id: 'components.Blocks.modifiers.bold',
7148
+ defaultMessage: 'Bold'
7149
+ }),
7150
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Bold, {})
7151
+ }),
7152
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
7153
+ disabled: isDisabled,
7154
+ onClick: ()=>handleActionClick('Italic', editorRef),
7155
+ label: formatMessage({
7156
+ id: 'components.Blocks.modifiers.italic',
7157
+ defaultMessage: 'Italic'
7158
+ }),
7159
+ name: formatMessage({
7160
+ id: 'components.Blocks.modifiers.italic',
7161
+ defaultMessage: 'Italic'
7162
+ }),
7163
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Italic, {})
7164
+ }),
7165
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
7166
+ disabled: isDisabled,
7167
+ onClick: ()=>handleActionClick('Underline', editorRef),
7168
+ label: formatMessage({
7169
+ id: 'components.Blocks.modifiers.underline',
7170
+ defaultMessage: 'Underline'
7171
+ }),
7172
+ name: formatMessage({
7173
+ id: 'components.Blocks.modifiers.underline',
7174
+ defaultMessage: 'Underline'
7175
+ }),
7176
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Underline, {})
7177
+ }),
7178
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
7179
+ disabled: isDisabled,
7180
+ onClick: ()=>handleActionClick('Strikethrough', editorRef),
7181
+ label: formatMessage({
7182
+ id: 'components.Blocks.modifiers.strikethrough',
7183
+ defaultMessage: 'Strikethrough'
7184
+ }),
7185
+ name: formatMessage({
7186
+ id: 'components.Blocks.modifiers.strikethrough',
7187
+ defaultMessage: 'Strikethrough'
7188
+ }),
7189
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.StrikeThrough, {})
7190
+ })
7191
+ ]
7192
+ }),
7193
+ menu: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
7194
+ children: [
7195
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Separator, {}),
7196
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Item, {
7197
+ onSelect: ()=>handleActionClick('Bold', editorRef),
7198
+ disabled: isDisabled,
7199
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7200
+ tag: "span",
7201
+ gap: 2,
7202
+ children: [
7203
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.Bold, {
7204
+ "aria-hidden": true,
7205
+ fill: "neutral600"
7206
+ }),
7207
+ formatMessage({
7208
+ id: 'components.Blocks.modifiers.bold',
7209
+ defaultMessage: 'Bold'
7210
+ })
7211
+ ]
7212
+ })
7213
+ }),
7214
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Item, {
7215
+ onSelect: ()=>handleActionClick('Italic', editorRef),
7216
+ disabled: isDisabled,
7217
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7218
+ tag: "span",
7219
+ gap: 2,
7220
+ children: [
7221
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.Italic, {
7222
+ "aria-hidden": true,
7223
+ fill: "neutral600"
7224
+ }),
7225
+ formatMessage({
7226
+ id: 'components.Blocks.modifiers.italic',
7227
+ defaultMessage: 'Italic'
7228
+ })
7229
+ ]
7230
+ })
7231
+ }),
7232
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Item, {
7233
+ onSelect: ()=>handleActionClick('Underline', editorRef),
7234
+ disabled: isDisabled,
7235
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7236
+ tag: "span",
7237
+ gap: 2,
7238
+ children: [
7239
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.Underline, {
7240
+ "aria-hidden": true,
7241
+ fill: "neutral600"
7242
+ }),
7243
+ formatMessage({
7244
+ id: 'components.Blocks.modifiers.underline',
7245
+ defaultMessage: 'Underline'
7246
+ })
7247
+ ]
7248
+ })
7249
+ }),
7250
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Item, {
7251
+ onSelect: ()=>handleActionClick('Strikethrough', editorRef),
7252
+ disabled: isDisabled,
7253
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7254
+ tag: "span",
7255
+ gap: 2,
7256
+ children: [
7257
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.StrikeThrough, {
7258
+ "aria-hidden": true,
7259
+ fill: "neutral600"
7260
+ }),
7261
+ formatMessage({
7262
+ id: 'components.Blocks.modifiers.strikethrough',
7263
+ defaultMessage: 'Strikethrough'
7264
+ })
7265
+ ]
7266
+ })
7267
+ })
5610
7268
  ]
5611
- })
5612
- })
5613
- });
5614
- };
5615
-
5616
- /**
5617
- * TODO: refactor this mess.
5618
- */ const WysiwygNav = ({ disabled, editorRef, isExpandMode, isPreviewMode, onActionClick, onToggleMediaLib, onTogglePreviewMode })=>{
5619
- const [visiblePopover, setVisiblePopover] = React__namespace.useState(false);
5620
- const { formatMessage } = reactIntl.useIntl();
5621
- const selectPlaceholder = formatMessage({
5622
- id: 'components.Wysiwyg.selectOptions.title',
5623
- defaultMessage: 'Add a title'
5624
- });
5625
- React__namespace.useRef(null);
5626
- const handleTogglePopover = ()=>{
5627
- setVisiblePopover((prev)=>!prev);
5628
- };
5629
- if (disabled || isPreviewMode) {
5630
- return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
5631
- padding: 2,
5632
- background: "neutral100",
5633
- justifyContent: "space-between",
5634
- borderRadius: `0.4rem 0.4rem 0 0`,
5635
- children: [
5636
- /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
5637
- children: [
5638
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Root, {
5639
- children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.SingleSelect, {
5640
- disabled: true,
5641
- placeholder: selectPlaceholder,
5642
- "aria-label": selectPlaceholder,
5643
- size: "S",
5644
- children: [
5645
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5646
- value: "h1",
5647
- children: "h1"
5648
- }),
5649
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5650
- value: "h2",
5651
- children: "h2"
5652
- }),
5653
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5654
- value: "h3",
5655
- children: "h3"
5656
- }),
5657
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5658
- value: "h4",
5659
- children: "h4"
5660
- }),
5661
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5662
- value: "h5",
5663
- children: "h5"
5664
- }),
5665
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5666
- value: "h6",
5667
- children: "h6"
5668
- })
5669
- ]
5670
- })
7269
+ }),
7270
+ key: 'formatting-group-1'
7271
+ },
7272
+ {
7273
+ toolbar: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.IconButtonGroup, {
7274
+ children: [
7275
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
7276
+ disabled: isDisabled,
7277
+ onClick: ()=>handleActionClick('BulletList', editorRef),
7278
+ label: formatMessage({
7279
+ id: 'components.Blocks.blocks.bulletList',
7280
+ defaultMessage: 'Bulleted list'
7281
+ }),
7282
+ name: formatMessage({
7283
+ id: 'components.Blocks.blocks.bulletList',
7284
+ defaultMessage: 'Bulleted list'
7285
+ }),
7286
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.BulletList, {})
7287
+ }),
7288
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
7289
+ disabled: isDisabled,
7290
+ onClick: ()=>handleActionClick('NumberList', editorRef),
7291
+ label: formatMessage({
7292
+ id: 'components.Blocks.blocks.numberList',
7293
+ defaultMessage: 'Numbered list'
5671
7294
  }),
5672
- /*#__PURE__*/ jsxRuntime.jsxs(MainButtons, {
7295
+ name: formatMessage({
7296
+ id: 'components.Blocks.blocks.numberList',
7297
+ defaultMessage: 'Numbered list'
7298
+ }),
7299
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.NumberList, {})
7300
+ })
7301
+ ]
7302
+ }),
7303
+ menu: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
7304
+ children: [
7305
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Separator, {}),
7306
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Item, {
7307
+ onSelect: ()=>handleActionClick('BulletList', editorRef),
7308
+ disabled: isDisabled,
7309
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7310
+ tag: "span",
7311
+ gap: 2,
5673
7312
  children: [
5674
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5675
- disabled: true,
5676
- label: "Bold",
5677
- name: "Bold",
5678
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Bold, {})
7313
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.BulletList, {
7314
+ "aria-hidden": true,
7315
+ fill: "neutral600"
5679
7316
  }),
5680
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5681
- disabled: true,
5682
- label: "Italic",
5683
- name: "Italic",
5684
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Italic, {})
7317
+ formatMessage({
7318
+ id: 'components.Blocks.blocks.unorderedList',
7319
+ defaultMessage: 'Bulleted list'
7320
+ })
7321
+ ]
7322
+ })
7323
+ }),
7324
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Item, {
7325
+ onSelect: ()=>handleActionClick('NumberList', editorRef),
7326
+ disabled: isDisabled,
7327
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7328
+ tag: "span",
7329
+ gap: 2,
7330
+ children: [
7331
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.NumberList, {
7332
+ "aria-hidden": true,
7333
+ fill: "neutral600"
5685
7334
  }),
5686
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5687
- disabled: true,
5688
- label: "Underline",
5689
- name: "Underline",
5690
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Underline, {})
7335
+ formatMessage({
7336
+ id: 'components.Blocks.blocks.orderedList',
7337
+ defaultMessage: 'Numbered list'
5691
7338
  })
5692
7339
  ]
5693
- }),
5694
- /*#__PURE__*/ jsxRuntime.jsx(MoreButton, {
5695
- disabled: true,
5696
- label: "More",
5697
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.More, {})
5698
7340
  })
5699
- ]
5700
- }),
5701
- !isExpandMode && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
5702
- onClick: onTogglePreviewMode,
5703
- variant: "tertiary",
5704
- children: formatMessage({
5705
- id: 'components.Wysiwyg.ToggleMode.markdown-mode',
5706
- defaultMessage: 'Markdown mode'
5707
7341
  })
5708
- })
5709
- ]
5710
- });
5711
- }
5712
- return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
5713
- padding: 2,
5714
- background: "neutral100",
5715
- justifyContent: "space-between",
5716
- borderRadius: `0.4rem 0.4rem 0 0`,
5717
- children: [
5718
- /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7342
+ ]
7343
+ }),
7344
+ key: 'formatting-group-2'
7345
+ },
7346
+ {
7347
+ toolbar: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.IconButtonGroup, {
7348
+ children: [
7349
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
7350
+ disabled: isDisabled,
7351
+ onClick: ()=>handleActionClick('Code', editorRef),
7352
+ label: formatMessage({
7353
+ id: 'components.Wysiwyg.blocks.code',
7354
+ defaultMessage: 'Code'
7355
+ }),
7356
+ name: formatMessage({
7357
+ id: 'components.Wysiwyg.blocks.code',
7358
+ defaultMessage: 'Code'
7359
+ }),
7360
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Code, {})
7361
+ }),
7362
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
7363
+ disabled: isDisabled,
7364
+ onClick: ()=>{
7365
+ onToggleMediaLib();
7366
+ },
7367
+ label: formatMessage({
7368
+ id: 'components.Blocks.blocks.image',
7369
+ defaultMessage: 'Image'
7370
+ }),
7371
+ name: formatMessage({
7372
+ id: 'components.Blocks.blocks.image',
7373
+ defaultMessage: 'Image'
7374
+ }),
7375
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Image, {})
7376
+ }),
7377
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
7378
+ disabled: isDisabled,
7379
+ onClick: ()=>handleActionClick('Link', editorRef),
7380
+ label: formatMessage({
7381
+ id: 'components.Blocks.popover.link',
7382
+ defaultMessage: 'Link'
7383
+ }),
7384
+ name: formatMessage({
7385
+ id: 'components.Blocks.popover.link',
7386
+ defaultMessage: 'Link'
7387
+ }),
7388
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Link, {})
7389
+ }),
7390
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
7391
+ disabled: isDisabled,
7392
+ onClick: ()=>handleActionClick('Quote', editorRef),
7393
+ label: formatMessage({
7394
+ id: 'components.Blocks.blocks.quote',
7395
+ defaultMessage: 'Quote'
7396
+ }),
7397
+ name: formatMessage({
7398
+ id: 'components.Blocks.blocks.quote',
7399
+ defaultMessage: 'Quote'
7400
+ }),
7401
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Quotes, {})
7402
+ })
7403
+ ]
7404
+ }),
7405
+ menu: /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
5719
7406
  children: [
5720
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Root, {
5721
- children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.SingleSelect, {
5722
- placeholder: selectPlaceholder,
5723
- "aria-label": selectPlaceholder,
5724
- // @ts-expect-error DS v2 will only allow strings.
5725
- onChange: (value)=>onActionClick(value, editorRef),
5726
- size: "S",
7407
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Separator, {}),
7408
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Item, {
7409
+ onSelect: ()=>handleActionClick('Code', editorRef),
7410
+ disabled: isDisabled,
7411
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7412
+ tag: "span",
7413
+ gap: 2,
5727
7414
  children: [
5728
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5729
- value: "h1",
5730
- children: "h1"
5731
- }),
5732
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5733
- value: "h2",
5734
- children: "h2"
7415
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.Code, {
7416
+ "aria-hidden": true,
7417
+ fill: "neutral600"
5735
7418
  }),
5736
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5737
- value: "h3",
5738
- children: "h3"
7419
+ formatMessage({
7420
+ id: 'components.Wysiwyg.blocks.code',
7421
+ defaultMessage: 'Code'
7422
+ })
7423
+ ]
7424
+ })
7425
+ }),
7426
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Item, {
7427
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Image, {}),
7428
+ onSelect: ()=>{
7429
+ onToggleMediaLib();
7430
+ },
7431
+ disabled: isDisabled,
7432
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7433
+ tag: "span",
7434
+ gap: 2,
7435
+ children: [
7436
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.Image, {
7437
+ "aria-hidden": true,
7438
+ fill: "neutral600"
5739
7439
  }),
5740
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5741
- value: "h4",
5742
- children: "h4"
7440
+ formatMessage({
7441
+ id: 'components.Blocks.blocks.image',
7442
+ defaultMessage: 'Image'
7443
+ })
7444
+ ]
7445
+ })
7446
+ }),
7447
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Item, {
7448
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Link, {}),
7449
+ onSelect: ()=>handleActionClick('Link', editorRef),
7450
+ disabled: isDisabled,
7451
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7452
+ tag: "span",
7453
+ gap: 2,
7454
+ children: [
7455
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.Link, {
7456
+ "aria-hidden": true,
7457
+ fill: "neutral600"
5743
7458
  }),
5744
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5745
- value: "h5",
5746
- children: "h5"
7459
+ formatMessage({
7460
+ id: 'components.Blocks.popover.link',
7461
+ defaultMessage: 'Link'
7462
+ })
7463
+ ]
7464
+ })
7465
+ }),
7466
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Menu.Item, {
7467
+ onSelect: ()=>handleActionClick('Quote', editorRef),
7468
+ disabled: isDisabled,
7469
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7470
+ tag: "span",
7471
+ gap: 2,
7472
+ children: [
7473
+ /*#__PURE__*/ jsxRuntime.jsx(Icons.Quotes, {
7474
+ "aria-hidden": true,
7475
+ fill: "neutral600"
5747
7476
  }),
5748
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
5749
- value: "h6",
5750
- children: "h6"
7477
+ formatMessage({
7478
+ id: 'components.Blocks.blocks.quote',
7479
+ defaultMessage: 'Quote'
5751
7480
  })
5752
7481
  ]
5753
7482
  })
7483
+ })
7484
+ ]
7485
+ }),
7486
+ key: 'formatting-group-3'
7487
+ }
7488
+ ];
7489
+ return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7490
+ padding: 2,
7491
+ background: "neutral100",
7492
+ justifyContent: "space-between",
7493
+ borderRadius: "0.4rem 0.4rem 0 0",
7494
+ width: "100%",
7495
+ gap: 4,
7496
+ children: [
7497
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Root, {
7498
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.SingleSelect, {
7499
+ disabled: isDisabled,
7500
+ placeholder: formatMessage({
7501
+ id: 'components.Wysiwyg.selectOptions.title',
7502
+ defaultMessage: 'Headings'
5754
7503
  }),
5755
- /*#__PURE__*/ jsxRuntime.jsxs(MainButtons, {
5756
- children: [
5757
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5758
- onClick: ()=>onActionClick('Bold', editorRef),
5759
- label: "Bold",
5760
- name: "Bold",
5761
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Bold, {})
7504
+ "aria-label": formatMessage({
7505
+ id: 'components.Wysiwyg.selectOptions.title',
7506
+ defaultMessage: 'Headings'
7507
+ }),
7508
+ // @ts-expect-error – DS v2 will only allow strings.
7509
+ onChange: (value)=>handleActionClick(value, editorRef),
7510
+ size: "S",
7511
+ children: [
7512
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
7513
+ value: "h1",
7514
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.HeadingOne, {
7515
+ fill: "neutral600"
5762
7516
  }),
5763
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5764
- onClick: ()=>onActionClick('Italic', editorRef),
5765
- label: "Italic",
5766
- name: "Italic",
5767
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Italic, {})
7517
+ children: formatMessage({
7518
+ id: 'components.Wysiwyg.selectOptions.H1',
7519
+ defaultMessage: 'Heading 1'
7520
+ })
7521
+ }),
7522
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
7523
+ value: "h2",
7524
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.HeadingTwo, {
7525
+ fill: "neutral600"
5768
7526
  }),
5769
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5770
- onClick: ()=>onActionClick('Underline', editorRef),
5771
- label: "Underline",
5772
- name: "Underline",
5773
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Underline, {})
7527
+ children: formatMessage({
7528
+ id: 'components.Wysiwyg.selectOptions.H2',
7529
+ defaultMessage: 'Heading 2'
5774
7530
  })
5775
- ]
5776
- }),
5777
- /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Popover.Root, {
5778
- children: [
5779
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.Popover.Trigger, {
5780
- children: /*#__PURE__*/ jsxRuntime.jsx(MoreButton, {
5781
- label: "More",
5782
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.More, {})
5783
- })
7531
+ }),
7532
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
7533
+ value: "h3",
7534
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.HeadingThree, {
7535
+ fill: "neutral600"
5784
7536
  }),
5785
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.Popover.Content, {
5786
- sideOffset: 12,
5787
- children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
5788
- padding: 2,
5789
- children: [
5790
- /*#__PURE__*/ jsxRuntime.jsxs(IconButtonGroupMargin, {
5791
- children: [
5792
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5793
- onClick: ()=>onActionClick('Strikethrough', editorRef, handleTogglePopover),
5794
- label: "Strikethrough",
5795
- name: "Strikethrough",
5796
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.StrikeThrough, {})
5797
- }),
5798
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5799
- onClick: ()=>onActionClick('BulletList', editorRef, handleTogglePopover),
5800
- label: "BulletList",
5801
- name: "BulletList",
5802
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.BulletList, {})
5803
- }),
5804
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5805
- onClick: ()=>onActionClick('NumberList', editorRef, handleTogglePopover),
5806
- label: "NumberList",
5807
- name: "NumberList",
5808
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.NumberList, {})
5809
- })
5810
- ]
5811
- }),
5812
- /*#__PURE__*/ jsxRuntime.jsxs(designSystem.IconButtonGroup, {
5813
- children: [
5814
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5815
- onClick: ()=>onActionClick('Code', editorRef, handleTogglePopover),
5816
- label: "Code",
5817
- name: "Code",
5818
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Code, {})
5819
- }),
5820
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5821
- onClick: ()=>{
5822
- handleTogglePopover();
5823
- onToggleMediaLib();
5824
- },
5825
- label: "Image",
5826
- name: "Image",
5827
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Image, {})
5828
- }),
5829
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5830
- onClick: ()=>onActionClick('Link', editorRef, handleTogglePopover),
5831
- label: "Link",
5832
- name: "Link",
5833
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Link, {})
5834
- }),
5835
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
5836
- onClick: ()=>onActionClick('Quote', editorRef, handleTogglePopover),
5837
- label: "Quote",
5838
- name: "Quote",
5839
- children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Quotes, {})
5840
- })
5841
- ]
5842
- })
5843
- ]
5844
- })
7537
+ children: formatMessage({
7538
+ id: 'components.Wysiwyg.selectOptions.H3',
7539
+ defaultMessage: 'Heading 3'
5845
7540
  })
5846
- ]
7541
+ }),
7542
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
7543
+ value: "h4",
7544
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.HeadingFour, {
7545
+ fill: "neutral600"
7546
+ }),
7547
+ children: formatMessage({
7548
+ id: 'components.Wysiwyg.selectOptions.H4',
7549
+ defaultMessage: 'Heading 4'
7550
+ })
7551
+ }),
7552
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
7553
+ value: "h5",
7554
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.HeadingFive, {
7555
+ fill: "neutral600"
7556
+ }),
7557
+ children: formatMessage({
7558
+ id: 'components.Wysiwyg.selectOptions.H5',
7559
+ defaultMessage: 'Heading 5'
7560
+ })
7561
+ }),
7562
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
7563
+ value: "h6",
7564
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.HeadingSix, {
7565
+ fill: "neutral600"
7566
+ }),
7567
+ children: formatMessage({
7568
+ id: 'components.Wysiwyg.selectOptions.H6',
7569
+ defaultMessage: 'Heading 6'
7570
+ })
7571
+ })
7572
+ ]
7573
+ })
7574
+ }),
7575
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
7576
+ width: "100%",
7577
+ justifyContent: "space-between",
7578
+ overflow: "hidden",
7579
+ children: [
7580
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
7581
+ gap: 2,
7582
+ overflow: "hidden",
7583
+ width: "100%",
7584
+ children: /*#__PURE__*/ jsxRuntime.jsx(EditorToolbarObserver, {
7585
+ menuTriggerVariant: "tertiary",
7586
+ observedComponents: observedComponents
7587
+ })
7588
+ }),
7589
+ onTogglePreviewMode && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
7590
+ onClick: onTogglePreviewMode,
7591
+ variant: "tertiary",
7592
+ minWidth: "132px",
7593
+ children: isPreviewMode ? formatMessage({
7594
+ id: 'components.Wysiwyg.ToggleMode.markdown-mode',
7595
+ defaultMessage: 'Markdown mode'
7596
+ }) : formatMessage({
7597
+ id: 'components.Wysiwyg.ToggleMode.preview-mode',
7598
+ defaultMessage: 'Preview mode'
7599
+ })
5847
7600
  })
5848
7601
  ]
5849
- }),
5850
- onTogglePreviewMode && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
5851
- onClick: onTogglePreviewMode,
5852
- variant: "tertiary",
5853
- children: formatMessage({
5854
- id: 'components.Wysiwyg.ToggleMode.preview-mode',
5855
- defaultMessage: 'Preview mode'
5856
- })
5857
7602
  })
5858
7603
  ]
5859
7604
  });
@@ -5874,48 +7619,6 @@ const Wysiwyg = /*#__PURE__*/ React__namespace.forwardRef(({ hint, disabled, lab
5874
7619
  setIsPreviewMode(false);
5875
7620
  setIsExpandMode((prev)=>!prev);
5876
7621
  };
5877
- const handleActionClick = (value, currentEditorRef, togglePopover)=>{
5878
- switch(value){
5879
- case 'Link':
5880
- case 'Strikethrough':
5881
- {
5882
- markdownHandler(currentEditorRef, value);
5883
- togglePopover?.();
5884
- break;
5885
- }
5886
- case 'Code':
5887
- case 'Quote':
5888
- {
5889
- quoteAndCodeHandler(currentEditorRef, value);
5890
- togglePopover?.();
5891
- break;
5892
- }
5893
- case 'Bold':
5894
- case 'Italic':
5895
- case 'Underline':
5896
- {
5897
- markdownHandler(currentEditorRef, value);
5898
- break;
5899
- }
5900
- case 'BulletList':
5901
- case 'NumberList':
5902
- {
5903
- listHandler(currentEditorRef, value);
5904
- togglePopover?.();
5905
- break;
5906
- }
5907
- case 'h1':
5908
- case 'h2':
5909
- case 'h3':
5910
- case 'h4':
5911
- case 'h5':
5912
- case 'h6':
5913
- {
5914
- titleHandler(currentEditorRef, value);
5915
- break;
5916
- }
5917
- }
5918
- };
5919
7622
  const handleSelectAssets = (files)=>{
5920
7623
  const formattedFiles = files.map((f)=>({
5921
7624
  alt: f.alternativeText || f.name,
@@ -5950,7 +7653,6 @@ const Wysiwyg = /*#__PURE__*/ React__namespace.forwardRef(({ hint, disabled, lab
5950
7653
  isExpandMode: isExpandMode,
5951
7654
  editorRef: editorRef,
5952
7655
  isPreviewMode: isPreviewMode,
5953
- onActionClick: handleActionClick,
5954
7656
  onToggleMediaLib: handleToggleMediaLib,
5955
7657
  onTogglePreviewMode: isExpandMode ? undefined : handleTogglePreviewMode,
5956
7658
  disabled: disabled
@@ -5994,17 +7696,25 @@ const MemoizedWysiwyg = /*#__PURE__*/ React__namespace.memo(Wysiwyg);
5994
7696
  * specifically to be used in the EditView of the content-manager this understands
5995
7697
  * the complete EditFieldLayout and will handle RBAC conditions and rendering CM specific
5996
7698
  * components such as Blocks / Relations.
5997
- */ const InputRenderer = ({ visible, hint: providedHint, ...props })=>{
5998
- const { id, document, collectionType } = index.useDoc();
5999
- const isFormDisabled = strapiAdmin.useForm('InputRenderer', (state)=>state.disabled);
7699
+ */ const InputRenderer = ({ visible, hint: providedHint, document, ...props })=>{
7700
+ const { model: rootModel } = index.useDoc();
7701
+ const rootDocumentMeta = index.useDocumentContext('DynamicComponent', (state)=>state.rootDocumentMeta);
7702
+ const { edit: { components: rootComponents } } = index.useDocumentLayout(rootDocumentMeta.model);
7703
+ const { edit: { components: relatedComponents } } = index.useDocumentLayout(document.schema?.uid ?? rootModel);
7704
+ const components = {
7705
+ ...rootComponents,
7706
+ ...relatedComponents
7707
+ };
7708
+ const collectionType = document.schema?.kind === 'collectionType' ? 'collection-types' : 'single-types';
6000
7709
  const isInDynamicZone = useDynamicZone('isInDynamicZone', (state)=>state.isInDynamicZone);
7710
+ const isFormDisabled = strapiAdmin.useForm('InputRenderer', (state)=>state.disabled);
6001
7711
  const canCreateFields = index.useDocumentRBAC('InputRenderer', (rbac)=>rbac.canCreateFields);
6002
7712
  const canReadFields = index.useDocumentRBAC('InputRenderer', (rbac)=>rbac.canReadFields);
6003
7713
  const canUpdateFields = index.useDocumentRBAC('InputRenderer', (rbac)=>rbac.canUpdateFields);
6004
7714
  const canUserAction = index.useDocumentRBAC('InputRenderer', (rbac)=>rbac.canUserAction);
6005
- let idToCheck = id;
7715
+ let idToCheck = document.document?.documentId;
6006
7716
  if (collectionType === index.SINGLE_TYPES) {
6007
- idToCheck = document?.documentId;
7717
+ idToCheck = document?.document?.documentId;
6008
7718
  }
6009
7719
  const editableFields = idToCheck ? canUpdateFields : canCreateFields;
6010
7720
  const readableFields = idToCheck ? canReadFields : canCreateFields;
@@ -6018,7 +7728,6 @@ const MemoizedWysiwyg = /*#__PURE__*/ React__namespace.memo(Wysiwyg);
6018
7728
  props.attribute.customField
6019
7729
  ] : undefined);
6020
7730
  const hint = useFieldHint(providedHint, props.attribute);
6021
- const { edit: { components } } = index.useDocLayout();
6022
7731
  // We pass field in case of Custom Fields to keep backward compatibility
6023
7732
  const field = strapiAdmin.useField(props.name);
6024
7733
  if (!visible) {
@@ -6095,7 +7804,7 @@ const MemoizedWysiwyg = /*#__PURE__*/ React__namespace.memo(Wysiwyg);
6095
7804
  disabled: fieldIsDisabled
6096
7805
  });
6097
7806
  case 'relation':
6098
- return /*#__PURE__*/ jsxRuntime.jsx(Relations.MemoizedRelationsField, {
7807
+ return /*#__PURE__*/ jsxRuntime.jsx(MemoizedRelationsField, {
6099
7808
  ...props,
6100
7809
  hint: hint,
6101
7810
  disabled: fieldIsDisabled
@@ -6192,7 +7901,7 @@ const getMinMax = (attribute)=>{
6192
7901
  };
6193
7902
  }
6194
7903
  };
6195
- const MemoizedInputRenderer = /*#__PURE__*/ React.memo(InputRenderer);
7904
+ const MemoizedInputRenderer = /*#__PURE__*/ React__namespace.memo(InputRenderer);
6196
7905
 
6197
7906
  const RESPONSIVE_CONTAINER_BREAKPOINTS = {
6198
7907
  sm: '27.5rem'
@@ -6200,16 +7909,22 @@ const RESPONSIVE_CONTAINER_BREAKPOINTS = {
6200
7909
  const ResponsiveGridRoot = styledComponents.styled(designSystem.Grid.Root)`
6201
7910
  container-type: inline-size;
6202
7911
  `;
6203
- const ResponsiveGridItem = styledComponents.styled(designSystem.Grid.Item)`
6204
- grid-column: span 12;
6205
-
6206
- @container (min-width: ${RESPONSIVE_CONTAINER_BREAKPOINTS.sm}) {
6207
- ${({ col })=>col && `grid-column: span ${col};`}
6208
- }
6209
- `;
6210
- const FormLayout = ({ layout })=>{
7912
+ const ResponsiveGridItem = /**
7913
+ * TODO:
7914
+ * JSDOM cannot handle container queries.
7915
+ * This is a temporary workaround so that tests do not fail in the CI when jestdom throws an error
7916
+ * for failing to parse the stylesheet.
7917
+ */ process.env.NODE_ENV !== 'test' ? styledComponents.styled(designSystem.Grid.Item)`
7918
+ grid-column: span 12;
7919
+ @container (min-width: ${RESPONSIVE_CONTAINER_BREAKPOINTS.sm}) {
7920
+ ${({ col })=>col && `grid-column: span ${col};`}
7921
+ }
7922
+ ` : styledComponents.styled(designSystem.Grid.Item)`
7923
+ grid-column: span 12;
7924
+ `;
7925
+ const FormLayout = ({ layout, document, hasBackground = true })=>{
6211
7926
  const { formatMessage } = reactIntl.useIntl();
6212
- const { model } = index.useDoc();
7927
+ const model = document.schema?.modelName;
6213
7928
  return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
6214
7929
  direction: "column",
6215
7930
  alignItems: "stretch",
@@ -6234,20 +7949,20 @@ const FormLayout = ({ layout })=>{
6234
7949
  direction: "column",
6235
7950
  alignItems: "stretch",
6236
7951
  children: /*#__PURE__*/ jsxRuntime.jsx(MemoizedInputRenderer, {
6237
- ...fieldWithTranslatedLabel
7952
+ ...fieldWithTranslatedLabel,
7953
+ document: document
6238
7954
  })
6239
7955
  })
6240
7956
  }, field.name);
6241
7957
  }
6242
7958
  return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
6243
- hasRadius: true,
6244
- background: "neutral0",
6245
- shadow: "tableShadow",
6246
- paddingLeft: 6,
6247
- paddingRight: 6,
6248
- paddingTop: 6,
6249
- paddingBottom: 6,
6250
- borderColor: "neutral150",
7959
+ ...hasBackground && {
7960
+ padding: 6,
7961
+ borderColor: 'neutral150',
7962
+ background: 'neutral0',
7963
+ hasRadius: true,
7964
+ shadow: 'tableShadow'
7965
+ },
6251
7966
  children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
6252
7967
  direction: "column",
6253
7968
  alignItems: "stretch",
@@ -6269,7 +7984,8 @@ const FormLayout = ({ layout })=>{
6269
7984
  direction: "column",
6270
7985
  alignItems: "stretch",
6271
7986
  children: /*#__PURE__*/ jsxRuntime.jsx(MemoizedInputRenderer, {
6272
- ...fieldWithTranslatedLabel
7987
+ ...fieldWithTranslatedLabel,
7988
+ document: document
6273
7989
  })
6274
7990
  }, field.name);
6275
7991
  })
@@ -6283,9 +7999,10 @@ const FormLayout = ({ layout })=>{
6283
7999
  const NonRepeatableComponent = ({ attribute, name, children, layout })=>{
6284
8000
  const { formatMessage } = reactIntl.useIntl();
6285
8001
  const { value } = strapiAdmin.useField(name);
6286
- const level = Relations.useComponent('NonRepeatableComponent', (state)=>state.level);
8002
+ const level = useComponent('NonRepeatableComponent', (state)=>state.level);
6287
8003
  const isNested = level > 0;
6288
- return /*#__PURE__*/ jsxRuntime.jsx(Relations.ComponentProvider, {
8004
+ const currentDocument = index.useDocumentContext('NonRepeatableComponent', (state)=>state.document);
8005
+ return /*#__PURE__*/ jsxRuntime.jsx(ComponentProvider, {
6289
8006
  id: value?.id,
6290
8007
  uid: attribute.component,
6291
8008
  level: level + 1,
@@ -6325,7 +8042,8 @@ const NonRepeatableComponent = ({ attribute, name, children, layout })=>{
6325
8042
  children: children({
6326
8043
  ...field,
6327
8044
  label: translatedLabel,
6328
- name: completeFieldName
8045
+ name: completeFieldName,
8046
+ document: currentDocument
6329
8047
  })
6330
8048
  }, completeFieldName);
6331
8049
  })
@@ -6343,7 +8061,8 @@ const RepeatableComponent = ({ attribute, disabled, name, mainField, children, l
6343
8061
  const search = React__namespace.useMemo(()=>new URLSearchParams(searchString), [
6344
8062
  searchString
6345
8063
  ]);
6346
- const { components } = index.useDoc();
8064
+ const currentDocument = index.useDocumentContext('RepeatableComponent', (state)=>state.document);
8065
+ const components = currentDocument.components;
6347
8066
  const { value = [], error, rawError } = strapiAdmin.useField(name);
6348
8067
  const addFieldRow = strapiAdmin.useForm('RepeatableComponent', (state)=>state.addFieldRow);
6349
8068
  const moveFieldRow = strapiAdmin.useForm('RepeatableComponent', (state)=>state.moveFieldRow);
@@ -6471,7 +8190,7 @@ const RepeatableComponent = ({ attribute, disabled, name, mainField, children, l
6471
8190
  }));
6472
8191
  };
6473
8192
  const ariaDescriptionId = React__namespace.useId();
6474
- const level = Relations.useComponent('RepeatableComponent', (state)=>state.level);
8193
+ const level = useComponent('RepeatableComponent', (state)=>state.level);
6475
8194
  if (value.length === 0) {
6476
8195
  return /*#__PURE__*/ jsxRuntime.jsx(Initializer, {
6477
8196
  disabled: disabled,
@@ -6501,7 +8220,7 @@ const RepeatableComponent = ({ attribute, disabled, name, mainField, children, l
6501
8220
  children: [
6502
8221
  value.map(({ __temp_key__: key, id }, index)=>{
6503
8222
  const nameWithIndex = `${name}.${index}`;
6504
- return /*#__PURE__*/ jsxRuntime.jsx(Relations.ComponentProvider, {
8223
+ return /*#__PURE__*/ jsxRuntime.jsx(ComponentProvider, {
6505
8224
  // id is always a number in a component
6506
8225
  id: id,
6507
8226
  uid: attribute.component,
@@ -6546,7 +8265,8 @@ const RepeatableComponent = ({ attribute, disabled, name, mainField, children, l
6546
8265
  children: children({
6547
8266
  ...field,
6548
8267
  label: translatedLabel,
6549
- name: completeFieldName
8268
+ name: completeFieldName,
8269
+ document: currentDocument
6550
8270
  })
6551
8271
  }, completeFieldName);
6552
8272
  })
@@ -6617,8 +8337,8 @@ const Component = ({ disabled, index: index$1, name, mainField = {
6617
8337
  * components are not affected by the drag and drop of the parent component in
6618
8338
  * their own re-ordering context.
6619
8339
  */ const componentKey = name.split('.').slice(0, -1).join('.');
6620
- const [{ handlerId, isDragging, handleKeyDown }, boxRef, dropRef, dragRef, dragPreviewRef] = useDragAndDrop.useDragAndDrop(!disabled, {
6621
- type: `${useDragAndDrop.ItemTypes.COMPONENT}_${componentKey}`,
8340
+ const [{ handlerId, isDragging, handleKeyDown }, boxRef, dropRef, dragRef, dragPreviewRef] = objects.useDragAndDrop(!disabled, {
8341
+ type: `${objects.ItemTypes.COMPONENT}_${componentKey}`,
6622
8342
  index: index$1,
6623
8343
  item: {
6624
8344
  index: index$1,
@@ -6708,7 +8428,7 @@ const ComponentInput = ({ label, required, name, attribute, disabled, labelActio
6708
8428
  const { formatMessage } = reactIntl.useIntl();
6709
8429
  const field = strapiAdmin.useField(name);
6710
8430
  const showResetComponent = !attribute.repeatable && field.value && !disabled;
6711
- const { components } = index.useDoc();
8431
+ const components = index.useDocumentContext('ComponentInput', (state)=>state.document.components);
6712
8432
  const handleInitialisationClick = ()=>{
6713
8433
  const schema = components[attribute.component];
6714
8434
  const form = index.createDefaultForm(schema, components);
@@ -6773,8 +8493,11 @@ const ComponentInput = ({ label, required, name, attribute, disabled, labelActio
6773
8493
  };
6774
8494
  const MemoizedComponentInput = /*#__PURE__*/ React__namespace.memo(ComponentInput);
6775
8495
 
8496
+ exports.DisconnectButton = DisconnectButton;
6776
8497
  exports.DynamicZone = DynamicZone;
8498
+ exports.FlexWrapper = FlexWrapper;
6777
8499
  exports.FormLayout = FormLayout;
8500
+ exports.LinkEllipsis = LinkEllipsis;
6778
8501
  exports.MemoizedBlocksInput = MemoizedBlocksInput;
6779
8502
  exports.MemoizedComponentInput = MemoizedComponentInput;
6780
8503
  exports.MemoizedUIDInput = MemoizedUIDInput;
@@ -6783,4 +8506,4 @@ exports.NotAllowedInput = NotAllowedInput;
6783
8506
  exports.useDynamicZone = useDynamicZone;
6784
8507
  exports.useFieldHint = useFieldHint;
6785
8508
  exports.useLazyComponents = useLazyComponents;
6786
- //# sourceMappingURL=Input-Dr7YL5Sv.js.map
8509
+ //# sourceMappingURL=Input-D3aI7eJe.js.map