@strapi/content-manager 0.0.0-experimental.d042f6a350fa3a48d61e7c56875e2a0a7ba3c8f5 → 0.0.0-experimental.d1602f22dc638a4c3c5084965fd6126fff5e9d4f

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 (444) hide show
  1. package/dist/admin/chunks/CardDragPreview-DwuraT0K.js +80 -0
  2. package/dist/admin/chunks/CardDragPreview-DwuraT0K.js.map +1 -0
  3. package/dist/admin/chunks/CardDragPreview-_dubYgXO.js +82 -0
  4. package/dist/admin/chunks/CardDragPreview-_dubYgXO.js.map +1 -0
  5. package/dist/admin/chunks/ComponentConfigurationPage-DXwOtpq1.js +298 -0
  6. package/dist/admin/chunks/ComponentConfigurationPage-DXwOtpq1.js.map +1 -0
  7. package/dist/admin/chunks/ComponentConfigurationPage-DhYZp4nN.js +276 -0
  8. package/dist/admin/chunks/ComponentConfigurationPage-DhYZp4nN.js.map +1 -0
  9. package/dist/admin/chunks/ComponentIcon-BZcTc4rj.js +153 -0
  10. package/dist/admin/chunks/ComponentIcon-BZcTc4rj.js.map +1 -0
  11. package/dist/admin/chunks/ComponentIcon-C-EjOUPA.js +176 -0
  12. package/dist/admin/chunks/ComponentIcon-C-EjOUPA.js.map +1 -0
  13. package/dist/admin/chunks/EditConfigurationPage-D0Ng758X.js +180 -0
  14. package/dist/admin/chunks/EditConfigurationPage-D0Ng758X.js.map +1 -0
  15. package/dist/admin/chunks/EditConfigurationPage-DDuPch5d.js +158 -0
  16. package/dist/admin/chunks/EditConfigurationPage-DDuPch5d.js.map +1 -0
  17. package/dist/admin/chunks/EditViewPage-jCZnUuCR.js +265 -0
  18. package/dist/admin/chunks/EditViewPage-jCZnUuCR.js.map +1 -0
  19. package/dist/admin/chunks/EditViewPage-zSnDwLz3.js +288 -0
  20. package/dist/admin/chunks/EditViewPage-zSnDwLz3.js.map +1 -0
  21. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.js +56 -0
  22. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.js.map +1 -0
  23. package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js +58 -0
  24. package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js.map +1 -0
  25. package/dist/admin/chunks/Form-BEqiuSvQ.js +978 -0
  26. package/dist/admin/chunks/Form-BEqiuSvQ.js.map +1 -0
  27. package/dist/admin/chunks/Form-CZmB6JIg.js +955 -0
  28. package/dist/admin/chunks/Form-CZmB6JIg.js.map +1 -0
  29. package/dist/admin/chunks/History-BlLKDZSw.js +1331 -0
  30. package/dist/admin/chunks/History-BlLKDZSw.js.map +1 -0
  31. package/dist/admin/chunks/History-CPYXgxkS.js +1308 -0
  32. package/dist/admin/chunks/History-CPYXgxkS.js.map +1 -0
  33. package/dist/admin/chunks/Input-CLX3C5DI.js +6711 -0
  34. package/dist/admin/chunks/Input-CLX3C5DI.js.map +1 -0
  35. package/dist/admin/chunks/Input-DiR2Xfa7.js +6742 -0
  36. package/dist/admin/chunks/Input-DiR2Xfa7.js.map +1 -0
  37. package/dist/admin/chunks/ListConfigurationPage-CNvotSqe.js +795 -0
  38. package/dist/admin/chunks/ListConfigurationPage-CNvotSqe.js.map +1 -0
  39. package/dist/admin/chunks/ListConfigurationPage-DdTp-HxB.js +818 -0
  40. package/dist/admin/chunks/ListConfigurationPage-DdTp-HxB.js.map +1 -0
  41. package/dist/admin/chunks/ListViewPage-BtXYjEYz.js +1154 -0
  42. package/dist/admin/chunks/ListViewPage-BtXYjEYz.js.map +1 -0
  43. package/dist/admin/chunks/ListViewPage-MJNfQTp-.js +1132 -0
  44. package/dist/admin/chunks/ListViewPage-MJNfQTp-.js.map +1 -0
  45. package/dist/admin/chunks/NoContentTypePage-BJrZvYPY.js +57 -0
  46. package/dist/admin/chunks/NoContentTypePage-BJrZvYPY.js.map +1 -0
  47. package/dist/admin/chunks/NoContentTypePage-CVvVpwj4.js +59 -0
  48. package/dist/admin/chunks/NoContentTypePage-CVvVpwj4.js.map +1 -0
  49. package/dist/admin/chunks/NoPermissionsPage-BulvG4hB.js +36 -0
  50. package/dist/admin/chunks/NoPermissionsPage-BulvG4hB.js.map +1 -0
  51. package/dist/admin/chunks/NoPermissionsPage-C5yWg70d.js +38 -0
  52. package/dist/admin/chunks/NoPermissionsPage-C5yWg70d.js.map +1 -0
  53. package/dist/admin/chunks/Preview-DEuQgQg2.js +482 -0
  54. package/dist/admin/chunks/Preview-DEuQgQg2.js.map +1 -0
  55. package/dist/admin/chunks/Preview-H74FQ9Cq.js +504 -0
  56. package/dist/admin/chunks/Preview-H74FQ9Cq.js.map +1 -0
  57. package/dist/admin/chunks/Relations-C8jbZPVK.js +827 -0
  58. package/dist/admin/chunks/Relations-C8jbZPVK.js.map +1 -0
  59. package/dist/admin/chunks/Relations-mxOUS7TJ.js +853 -0
  60. package/dist/admin/chunks/Relations-mxOUS7TJ.js.map +1 -0
  61. package/dist/admin/chunks/ar-DckYq_WK.js +222 -0
  62. package/dist/admin/chunks/ar-DckYq_WK.js.map +1 -0
  63. package/dist/admin/chunks/ar-DeQBSsfl.js +227 -0
  64. package/dist/{_chunks/ru-BT3ybNny.js.map → admin/chunks/ar-DeQBSsfl.js.map} +1 -1
  65. package/dist/admin/chunks/ca-ClDTvatJ.js +202 -0
  66. package/dist/admin/chunks/ca-ClDTvatJ.js.map +1 -0
  67. package/dist/admin/chunks/ca-DviY7mRj.js +197 -0
  68. package/dist/{_chunks/de-CCEmbAah.js.map → admin/chunks/ca-DviY7mRj.js.map} +1 -1
  69. package/dist/admin/chunks/cs-BJFxwIWj.js +126 -0
  70. package/dist/{_chunks/ms-BuFotyP_.js.map → admin/chunks/cs-BJFxwIWj.js.map} +1 -1
  71. package/dist/admin/chunks/cs-C7OSYFQ7.js +122 -0
  72. package/dist/{_chunks/cs-CkJy6B2v.js.map → admin/chunks/cs-C7OSYFQ7.js.map} +1 -1
  73. package/dist/admin/chunks/de-5QRlDHyR.js +195 -0
  74. package/dist/{_chunks/ja-7sfIbjxE.js.map → admin/chunks/de-5QRlDHyR.js.map} +1 -1
  75. package/dist/admin/chunks/de-CbImAUA5.js +200 -0
  76. package/dist/{_chunks/gu-BRmF601H.js.map → admin/chunks/de-CbImAUA5.js.map} +1 -1
  77. package/dist/admin/chunks/en-C1CjdAtC.js +313 -0
  78. package/dist/{_chunks/en-D65uIF6Y.mjs.map → admin/chunks/en-C1CjdAtC.js.map} +1 -1
  79. package/dist/admin/chunks/en-LfhocNG2.js +308 -0
  80. package/dist/{_chunks/en-BR48D_RH.js.map → admin/chunks/en-LfhocNG2.js.map} +1 -1
  81. package/dist/admin/chunks/es-C8vLuvZL.js +197 -0
  82. package/dist/admin/chunks/es-C8vLuvZL.js.map +1 -0
  83. package/dist/admin/chunks/es-DkoWSExG.js +192 -0
  84. package/dist/{_chunks/ko-woFZPmLk.js.map → admin/chunks/es-DkoWSExG.js.map} +1 -1
  85. package/dist/admin/chunks/eu-BG1xX7HK.js +198 -0
  86. package/dist/admin/chunks/eu-BG1xX7HK.js.map +1 -0
  87. package/dist/admin/chunks/eu-BJW3AvXu.js +203 -0
  88. package/dist/admin/chunks/eu-BJW3AvXu.js.map +1 -0
  89. package/dist/admin/chunks/fr-CFdRaRVj.js +215 -0
  90. package/dist/admin/chunks/fr-CFdRaRVj.js.map +1 -0
  91. package/dist/admin/chunks/fr-gQSilC7w.js +220 -0
  92. package/dist/admin/chunks/fr-gQSilC7w.js.map +1 -0
  93. package/dist/admin/chunks/gu-D5MMMXRs.js +196 -0
  94. package/dist/admin/chunks/gu-D5MMMXRs.js.map +1 -0
  95. package/dist/admin/chunks/gu-DPU4wyx7.js +201 -0
  96. package/dist/{_chunks/eu-VDH-3ovk.js.map → admin/chunks/gu-DPU4wyx7.js.map} +1 -1
  97. package/dist/admin/chunks/hi-Dp4omeBb.js +201 -0
  98. package/dist/admin/chunks/hi-Dp4omeBb.js.map +1 -0
  99. package/dist/admin/chunks/hi-lp17SCjr.js +196 -0
  100. package/dist/admin/chunks/hi-lp17SCjr.js.map +1 -0
  101. package/dist/{_chunks/hooks-BAaaKPS_.js → admin/chunks/hooks-D-sOYd1s.js} +6 -3
  102. package/dist/admin/chunks/hooks-D-sOYd1s.js.map +1 -0
  103. package/dist/admin/chunks/hooks-DMvik5y_.js +7 -0
  104. package/dist/admin/chunks/hooks-DMvik5y_.js.map +1 -0
  105. package/dist/admin/chunks/hu-CLka1U2C.js +198 -0
  106. package/dist/admin/chunks/hu-CLka1U2C.js.map +1 -0
  107. package/dist/admin/chunks/hu-CtFJuhTd.js +203 -0
  108. package/dist/admin/chunks/hu-CtFJuhTd.js.map +1 -0
  109. package/dist/admin/chunks/id-D7V5S1rB.js +161 -0
  110. package/dist/{_chunks/it-DkBIs7vD.js.map → admin/chunks/id-D7V5S1rB.js.map} +1 -1
  111. package/dist/admin/chunks/id-USfY9m1g.js +156 -0
  112. package/dist/admin/chunks/id-USfY9m1g.js.map +1 -0
  113. package/dist/admin/chunks/index-BRlRBRLb.js +5350 -0
  114. package/dist/admin/chunks/index-BRlRBRLb.js.map +1 -0
  115. package/dist/admin/chunks/index-ZIwOPk6p.js +5416 -0
  116. package/dist/admin/chunks/index-ZIwOPk6p.js.map +1 -0
  117. package/dist/admin/chunks/it-BAHrwmYS.js +158 -0
  118. package/dist/admin/chunks/it-BAHrwmYS.js.map +1 -0
  119. package/dist/admin/chunks/it-CQFpa_Dc.js +163 -0
  120. package/dist/{_chunks/es-9K52xZIr.js.map → admin/chunks/it-CQFpa_Dc.js.map} +1 -1
  121. package/dist/admin/chunks/ja-BWKmBJFT.js +192 -0
  122. package/dist/admin/chunks/ja-BWKmBJFT.js.map +1 -0
  123. package/dist/admin/chunks/ja-jdQM-B79.js +197 -0
  124. package/dist/admin/chunks/ja-jdQM-B79.js.map +1 -0
  125. package/dist/admin/chunks/ko-CgADGBNt.js +191 -0
  126. package/dist/admin/chunks/ko-CgADGBNt.js.map +1 -0
  127. package/dist/admin/chunks/ko-k46sEyzt.js +196 -0
  128. package/dist/admin/chunks/ko-k46sEyzt.js.map +1 -0
  129. package/dist/admin/chunks/layout-B3-guCPG.js +598 -0
  130. package/dist/admin/chunks/layout-B3-guCPG.js.map +1 -0
  131. package/dist/admin/chunks/layout-ameRNiAM.js +618 -0
  132. package/dist/admin/chunks/layout-ameRNiAM.js.map +1 -0
  133. package/dist/admin/chunks/ml-CnhCfOn_.js +196 -0
  134. package/dist/admin/chunks/ml-CnhCfOn_.js.map +1 -0
  135. package/dist/admin/chunks/ml-DqxPwODx.js +201 -0
  136. package/dist/admin/chunks/ml-DqxPwODx.js.map +1 -0
  137. package/dist/admin/chunks/ms-Bh09NFff.js +140 -0
  138. package/dist/{_chunks/uk-C8EiqJY7.js.map → admin/chunks/ms-Bh09NFff.js.map} +1 -1
  139. package/dist/admin/chunks/ms-CvSC0OdG.js +145 -0
  140. package/dist/admin/chunks/ms-CvSC0OdG.js.map +1 -0
  141. package/dist/admin/chunks/nl-BEubhS8C.js +203 -0
  142. package/dist/admin/chunks/nl-BEubhS8C.js.map +1 -0
  143. package/dist/admin/chunks/nl-C8HYflTc.js +198 -0
  144. package/dist/admin/chunks/nl-C8HYflTc.js.map +1 -0
  145. package/dist/admin/chunks/objects-C3EebVVe.js +76 -0
  146. package/dist/admin/chunks/objects-C3EebVVe.js.map +1 -0
  147. package/dist/admin/chunks/objects-wl73iEma.js +73 -0
  148. package/dist/admin/chunks/objects-wl73iEma.js.map +1 -0
  149. package/dist/admin/chunks/pl-DWhGDzmM.js +200 -0
  150. package/dist/{_chunks/ca-Cmk45QO6.js.map → admin/chunks/pl-DWhGDzmM.js.map} +1 -1
  151. package/dist/admin/chunks/pl-MFCZJZuZ.js +195 -0
  152. package/dist/admin/chunks/pl-MFCZJZuZ.js.map +1 -0
  153. package/dist/admin/chunks/pt-BR-CPtAXD-4.js +202 -0
  154. package/dist/admin/chunks/pt-BR-CPtAXD-4.js.map +1 -0
  155. package/dist/admin/chunks/pt-BR-CcotyBGJ.js +197 -0
  156. package/dist/{_chunks/pt-BR-BiOz37D9.js.map → admin/chunks/pt-BR-CcotyBGJ.js.map} +1 -1
  157. package/dist/admin/chunks/pt-BoPxN80n.js +96 -0
  158. package/dist/admin/chunks/pt-BoPxN80n.js.map +1 -0
  159. package/dist/admin/chunks/pt-HbmgeiYO.js +93 -0
  160. package/dist/admin/chunks/pt-HbmgeiYO.js.map +1 -0
  161. package/dist/admin/chunks/relations-CmoFVrKj.js +178 -0
  162. package/dist/admin/chunks/relations-CmoFVrKj.js.map +1 -0
  163. package/dist/admin/chunks/relations-DYQAaXwZ.js +173 -0
  164. package/dist/admin/chunks/relations-DYQAaXwZ.js.map +1 -0
  165. package/dist/admin/chunks/ru-C0op0ALG.js +232 -0
  166. package/dist/admin/chunks/ru-C0op0ALG.js.map +1 -0
  167. package/dist/admin/chunks/ru-CB4BUyQp.js +230 -0
  168. package/dist/admin/chunks/ru-CB4BUyQp.js.map +1 -0
  169. package/dist/admin/chunks/sa-B_FuPyMw.js +201 -0
  170. package/dist/admin/chunks/sa-B_FuPyMw.js.map +1 -0
  171. package/dist/admin/chunks/sa-n_aPA-pU.js +196 -0
  172. package/dist/admin/chunks/sa-n_aPA-pU.js.map +1 -0
  173. package/dist/admin/chunks/sk-D_iXML2C.js +203 -0
  174. package/dist/admin/chunks/sk-D_iXML2C.js.map +1 -0
  175. package/dist/admin/chunks/sk-tn_BDjE2.js +198 -0
  176. package/dist/admin/chunks/sk-tn_BDjE2.js.map +1 -0
  177. package/dist/admin/chunks/sv-BstBC1Yp.js +203 -0
  178. package/dist/admin/chunks/sv-BstBC1Yp.js.map +1 -0
  179. package/dist/admin/chunks/sv-cq4ZrQRd.js +198 -0
  180. package/dist/admin/chunks/sv-cq4ZrQRd.js.map +1 -0
  181. package/dist/admin/chunks/th-lXoOCqPC.js +149 -0
  182. package/dist/{_chunks/th-D9_GfAjc.js.map → admin/chunks/th-lXoOCqPC.js.map} +1 -1
  183. package/dist/admin/chunks/th-mUH7hEtc.js +144 -0
  184. package/dist/admin/chunks/th-mUH7hEtc.js.map +1 -0
  185. package/dist/admin/chunks/tr-CkS6sLIE.js +200 -0
  186. package/dist/admin/chunks/tr-CkS6sLIE.js.map +1 -0
  187. package/dist/admin/chunks/tr-Yt38daxh.js +195 -0
  188. package/dist/admin/chunks/tr-Yt38daxh.js.map +1 -0
  189. package/dist/admin/chunks/uk-B24MoTVg.js +145 -0
  190. package/dist/admin/chunks/uk-B24MoTVg.js.map +1 -0
  191. package/dist/admin/chunks/uk-Cpgmm7gE.js +140 -0
  192. package/dist/admin/chunks/uk-Cpgmm7gE.js.map +1 -0
  193. package/dist/admin/chunks/useDragAndDrop-HYwNDExe.js +247 -0
  194. package/dist/admin/chunks/useDragAndDrop-HYwNDExe.js.map +1 -0
  195. package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js +271 -0
  196. package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js.map +1 -0
  197. package/dist/admin/chunks/usePrev-Bjw2dhmq.js +18 -0
  198. package/dist/admin/chunks/usePrev-Bjw2dhmq.js.map +1 -0
  199. package/dist/admin/chunks/usePrev-DIYl-IAL.js +21 -0
  200. package/dist/admin/chunks/usePrev-DIYl-IAL.js.map +1 -0
  201. package/dist/admin/chunks/vi-BGr1X_HZ.js +112 -0
  202. package/dist/admin/chunks/vi-BGr1X_HZ.js.map +1 -0
  203. package/dist/admin/chunks/vi-CvBGlTjr.js +108 -0
  204. package/dist/{_chunks/vi-CJlYDheJ.js.map → admin/chunks/vi-CvBGlTjr.js.map} +1 -1
  205. package/dist/admin/chunks/zh-BmF-sHaT.js +205 -0
  206. package/dist/admin/chunks/zh-BmF-sHaT.js.map +1 -0
  207. package/dist/admin/chunks/zh-DwFu_Kfj.js +210 -0
  208. package/dist/admin/chunks/zh-DwFu_Kfj.js.map +1 -0
  209. package/dist/admin/chunks/zh-Hans-CI0HKio3.js +934 -0
  210. package/dist/{_chunks/zh-Hans-9kOncHGw.js.map → admin/chunks/zh-Hans-CI0HKio3.js.map} +1 -1
  211. package/dist/admin/chunks/zh-Hans-JVK9x7xr.js +953 -0
  212. package/dist/{_chunks/zh-Hans-BPQcRIyH.mjs.map → admin/chunks/zh-Hans-JVK9x7xr.js.map} +1 -1
  213. package/dist/admin/index.js +23 -4
  214. package/dist/admin/index.js.map +1 -1
  215. package/dist/admin/index.mjs +16 -13
  216. package/dist/admin/index.mjs.map +1 -1
  217. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  218. package/dist/admin/src/hooks/useDocument.d.ts +2 -2
  219. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +0 -1
  220. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +0 -49
  221. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -1
  222. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -1
  223. package/dist/admin/src/preview/index.d.ts +2 -3
  224. package/dist/server/index.js +5459 -4387
  225. package/dist/server/index.js.map +1 -1
  226. package/dist/server/index.mjs +5446 -4372
  227. package/dist/server/index.mjs.map +1 -1
  228. package/dist/server/src/controllers/utils/metadata.d.ts +1 -1
  229. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  230. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  231. package/dist/server/src/services/utils/count.d.ts +1 -1
  232. package/dist/server/src/services/utils/count.d.ts.map +1 -1
  233. package/dist/server/src/services/utils/populate.d.ts +1 -1
  234. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  235. package/dist/shared/contracts/collection-types.d.ts +0 -1
  236. package/dist/shared/contracts/components.d.ts +0 -1
  237. package/dist/shared/contracts/content-types.d.ts +0 -1
  238. package/dist/shared/contracts/history-versions.d.ts +0 -1
  239. package/dist/shared/contracts/index.d.ts +0 -1
  240. package/dist/shared/contracts/init.d.ts +0 -1
  241. package/dist/shared/contracts/preview.d.ts +0 -1
  242. package/dist/shared/contracts/relations.d.ts +1 -2
  243. package/dist/shared/contracts/relations.d.ts.map +1 -1
  244. package/dist/shared/contracts/review-workflows.d.ts +0 -1
  245. package/dist/shared/contracts/single-types.d.ts +0 -1
  246. package/dist/shared/contracts/uid.d.ts +0 -1
  247. package/dist/shared/index.d.ts +0 -1
  248. package/dist/shared/index.js +35 -24
  249. package/dist/shared/index.js.map +1 -1
  250. package/dist/shared/index.mjs +34 -25
  251. package/dist/shared/index.mjs.map +1 -1
  252. package/package.json +13 -10
  253. package/dist/_chunks/CardDragPreview-C0QyJgRA.js +0 -69
  254. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +0 -1
  255. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs +0 -70
  256. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +0 -1
  257. package/dist/_chunks/ComponentConfigurationPage-9_4yUE9L.mjs +0 -236
  258. package/dist/_chunks/ComponentConfigurationPage-9_4yUE9L.mjs.map +0 -1
  259. package/dist/_chunks/ComponentConfigurationPage-DBSh-kET.js +0 -254
  260. package/dist/_chunks/ComponentConfigurationPage-DBSh-kET.js.map +0 -1
  261. package/dist/_chunks/ComponentIcon-CRbtQEUV.js +0 -175
  262. package/dist/_chunks/ComponentIcon-CRbtQEUV.js.map +0 -1
  263. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs +0 -157
  264. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +0 -1
  265. package/dist/_chunks/EditConfigurationPage-Bl_U2JgH.js +0 -150
  266. package/dist/_chunks/EditConfigurationPage-Bl_U2JgH.js.map +0 -1
  267. package/dist/_chunks/EditConfigurationPage-COe6hjPC.mjs +0 -132
  268. package/dist/_chunks/EditConfigurationPage-COe6hjPC.mjs.map +0 -1
  269. package/dist/_chunks/EditViewPage-D4yFJET6.js +0 -209
  270. package/dist/_chunks/EditViewPage-D4yFJET6.js.map +0 -1
  271. package/dist/_chunks/EditViewPage-DrmVmYN0.mjs +0 -191
  272. package/dist/_chunks/EditViewPage-DrmVmYN0.mjs.map +0 -1
  273. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs +0 -50
  274. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +0 -1
  275. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js +0 -49
  276. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +0 -1
  277. package/dist/_chunks/Form-C4rSaGsz.js +0 -778
  278. package/dist/_chunks/Form-C4rSaGsz.js.map +0 -1
  279. package/dist/_chunks/Form-DamaxNpG.mjs +0 -758
  280. package/dist/_chunks/Form-DamaxNpG.mjs.map +0 -1
  281. package/dist/_chunks/History-D1PreDSY.mjs +0 -999
  282. package/dist/_chunks/History-D1PreDSY.mjs.map +0 -1
  283. package/dist/_chunks/History-DTm8UCCQ.js +0 -1019
  284. package/dist/_chunks/History-DTm8UCCQ.js.map +0 -1
  285. package/dist/_chunks/Input-B7sapvBG.js +0 -5617
  286. package/dist/_chunks/Input-B7sapvBG.js.map +0 -1
  287. package/dist/_chunks/Input-CZ1YvjHR.mjs +0 -5585
  288. package/dist/_chunks/Input-CZ1YvjHR.mjs.map +0 -1
  289. package/dist/_chunks/ListConfigurationPage-Bbi32isk.mjs +0 -633
  290. package/dist/_chunks/ListConfigurationPage-Bbi32isk.mjs.map +0 -1
  291. package/dist/_chunks/ListConfigurationPage-ysFMjKI3.js +0 -652
  292. package/dist/_chunks/ListConfigurationPage-ysFMjKI3.js.map +0 -1
  293. package/dist/_chunks/ListViewPage-Bud_jBDQ.mjs +0 -854
  294. package/dist/_chunks/ListViewPage-Bud_jBDQ.mjs.map +0 -1
  295. package/dist/_chunks/ListViewPage-DTuuxU3n.js +0 -877
  296. package/dist/_chunks/ListViewPage-DTuuxU3n.js.map +0 -1
  297. package/dist/_chunks/NoContentTypePage-CL7VVeYs.js +0 -51
  298. package/dist/_chunks/NoContentTypePage-CL7VVeYs.js.map +0 -1
  299. package/dist/_chunks/NoContentTypePage-DVhkugsf.mjs +0 -51
  300. package/dist/_chunks/NoContentTypePage-DVhkugsf.mjs.map +0 -1
  301. package/dist/_chunks/NoPermissionsPage-CMdM-dCo.mjs +0 -23
  302. package/dist/_chunks/NoPermissionsPage-CMdM-dCo.mjs.map +0 -1
  303. package/dist/_chunks/NoPermissionsPage-v7I599vC.js +0 -23
  304. package/dist/_chunks/NoPermissionsPage-v7I599vC.js.map +0 -1
  305. package/dist/_chunks/Preview-BNuU0SuQ.mjs +0 -287
  306. package/dist/_chunks/Preview-BNuU0SuQ.mjs.map +0 -1
  307. package/dist/_chunks/Preview-Cxq-uI6D.js +0 -305
  308. package/dist/_chunks/Preview-Cxq-uI6D.js.map +0 -1
  309. package/dist/_chunks/Relations-C2Ahkrdg.mjs +0 -728
  310. package/dist/_chunks/Relations-C2Ahkrdg.mjs.map +0 -1
  311. package/dist/_chunks/Relations-CWS79QQn.js +0 -747
  312. package/dist/_chunks/Relations-CWS79QQn.js.map +0 -1
  313. package/dist/_chunks/ar-BUUWXIYu.js +0 -226
  314. package/dist/_chunks/ar-BUUWXIYu.js.map +0 -1
  315. package/dist/_chunks/ar-CCEVvqGG.mjs +0 -226
  316. package/dist/_chunks/ar-CCEVvqGG.mjs.map +0 -1
  317. package/dist/_chunks/ca-5U32ON2v.mjs +0 -201
  318. package/dist/_chunks/ca-5U32ON2v.mjs.map +0 -1
  319. package/dist/_chunks/ca-Cmk45QO6.js +0 -201
  320. package/dist/_chunks/cs-CM2aBUar.mjs +0 -125
  321. package/dist/_chunks/cs-CM2aBUar.mjs.map +0 -1
  322. package/dist/_chunks/cs-CkJy6B2v.js +0 -125
  323. package/dist/_chunks/de-C72KDNOl.mjs +0 -199
  324. package/dist/_chunks/de-C72KDNOl.mjs.map +0 -1
  325. package/dist/_chunks/de-CCEmbAah.js +0 -199
  326. package/dist/_chunks/en-BR48D_RH.js +0 -312
  327. package/dist/_chunks/en-D65uIF6Y.mjs +0 -312
  328. package/dist/_chunks/es-9K52xZIr.js +0 -196
  329. package/dist/_chunks/es-D34tqjMw.mjs +0 -196
  330. package/dist/_chunks/es-D34tqjMw.mjs.map +0 -1
  331. package/dist/_chunks/eu-CdALomew.mjs +0 -202
  332. package/dist/_chunks/eu-CdALomew.mjs.map +0 -1
  333. package/dist/_chunks/eu-VDH-3ovk.js +0 -202
  334. package/dist/_chunks/fr-C43IbhA_.js +0 -219
  335. package/dist/_chunks/fr-C43IbhA_.js.map +0 -1
  336. package/dist/_chunks/fr-DBseuRuB.mjs +0 -219
  337. package/dist/_chunks/fr-DBseuRuB.mjs.map +0 -1
  338. package/dist/_chunks/gu-BRmF601H.js +0 -200
  339. package/dist/_chunks/gu-CNpaMDpH.mjs +0 -200
  340. package/dist/_chunks/gu-CNpaMDpH.mjs.map +0 -1
  341. package/dist/_chunks/hi-CCJBptSq.js +0 -200
  342. package/dist/_chunks/hi-CCJBptSq.js.map +0 -1
  343. package/dist/_chunks/hi-Dwvd04m3.mjs +0 -200
  344. package/dist/_chunks/hi-Dwvd04m3.mjs.map +0 -1
  345. package/dist/_chunks/hooks-BAaaKPS_.js.map +0 -1
  346. package/dist/_chunks/hooks-E5u1mcgM.mjs +0 -8
  347. package/dist/_chunks/hooks-E5u1mcgM.mjs.map +0 -1
  348. package/dist/_chunks/hu-CeYvaaO0.mjs +0 -202
  349. package/dist/_chunks/hu-CeYvaaO0.mjs.map +0 -1
  350. package/dist/_chunks/hu-sNV_yLYy.js +0 -202
  351. package/dist/_chunks/hu-sNV_yLYy.js.map +0 -1
  352. package/dist/_chunks/id-B5Ser98A.js +0 -160
  353. package/dist/_chunks/id-B5Ser98A.js.map +0 -1
  354. package/dist/_chunks/id-BtwA9WJT.mjs +0 -160
  355. package/dist/_chunks/id-BtwA9WJT.mjs.map +0 -1
  356. package/dist/_chunks/index-DQsvBb_N.js +0 -4500
  357. package/dist/_chunks/index-DQsvBb_N.js.map +0 -1
  358. package/dist/_chunks/index-ZKrsjv-2.mjs +0 -4481
  359. package/dist/_chunks/index-ZKrsjv-2.mjs.map +0 -1
  360. package/dist/_chunks/it-BrVPqaf1.mjs +0 -162
  361. package/dist/_chunks/it-BrVPqaf1.mjs.map +0 -1
  362. package/dist/_chunks/it-DkBIs7vD.js +0 -162
  363. package/dist/_chunks/ja-7sfIbjxE.js +0 -196
  364. package/dist/_chunks/ja-BHqhDq4V.mjs +0 -196
  365. package/dist/_chunks/ja-BHqhDq4V.mjs.map +0 -1
  366. package/dist/_chunks/ko-HVQRlfUI.mjs +0 -195
  367. package/dist/_chunks/ko-HVQRlfUI.mjs.map +0 -1
  368. package/dist/_chunks/ko-woFZPmLk.js +0 -195
  369. package/dist/_chunks/layout-Cl0NhlQB.js +0 -488
  370. package/dist/_chunks/layout-Cl0NhlQB.js.map +0 -1
  371. package/dist/_chunks/layout-fQk1rMk9.mjs +0 -471
  372. package/dist/_chunks/layout-fQk1rMk9.mjs.map +0 -1
  373. package/dist/_chunks/ml-BihZwQit.mjs +0 -200
  374. package/dist/_chunks/ml-BihZwQit.mjs.map +0 -1
  375. package/dist/_chunks/ml-C2W8N8k1.js +0 -200
  376. package/dist/_chunks/ml-C2W8N8k1.js.map +0 -1
  377. package/dist/_chunks/ms-BuFotyP_.js +0 -144
  378. package/dist/_chunks/ms-m_WjyWx7.mjs +0 -144
  379. package/dist/_chunks/ms-m_WjyWx7.mjs.map +0 -1
  380. package/dist/_chunks/nl-D4R9gHx5.mjs +0 -202
  381. package/dist/_chunks/nl-D4R9gHx5.mjs.map +0 -1
  382. package/dist/_chunks/nl-bbEOHChV.js +0 -202
  383. package/dist/_chunks/nl-bbEOHChV.js.map +0 -1
  384. package/dist/_chunks/objects-BcXOv6_9.js +0 -47
  385. package/dist/_chunks/objects-BcXOv6_9.js.map +0 -1
  386. package/dist/_chunks/objects-D6yBsdmx.mjs +0 -45
  387. package/dist/_chunks/objects-D6yBsdmx.mjs.map +0 -1
  388. package/dist/_chunks/pl-sbx9mSt_.mjs +0 -199
  389. package/dist/_chunks/pl-sbx9mSt_.mjs.map +0 -1
  390. package/dist/_chunks/pl-uzwG-hk7.js +0 -199
  391. package/dist/_chunks/pl-uzwG-hk7.js.map +0 -1
  392. package/dist/_chunks/pt-BR-BiOz37D9.js +0 -201
  393. package/dist/_chunks/pt-BR-C71iDxnh.mjs +0 -201
  394. package/dist/_chunks/pt-BR-C71iDxnh.mjs.map +0 -1
  395. package/dist/_chunks/pt-BsaFvS8-.mjs +0 -95
  396. package/dist/_chunks/pt-BsaFvS8-.mjs.map +0 -1
  397. package/dist/_chunks/pt-CeXQuq50.js +0 -95
  398. package/dist/_chunks/pt-CeXQuq50.js.map +0 -1
  399. package/dist/_chunks/relations-BRfBxVbX.js +0 -133
  400. package/dist/_chunks/relations-BRfBxVbX.js.map +0 -1
  401. package/dist/_chunks/relations-BakOFl_1.mjs +0 -134
  402. package/dist/_chunks/relations-BakOFl_1.mjs.map +0 -1
  403. package/dist/_chunks/ru-BE6A4Exp.mjs +0 -231
  404. package/dist/_chunks/ru-BE6A4Exp.mjs.map +0 -1
  405. package/dist/_chunks/ru-BT3ybNny.js +0 -231
  406. package/dist/_chunks/sa-CcvkYInH.js +0 -200
  407. package/dist/_chunks/sa-CcvkYInH.js.map +0 -1
  408. package/dist/_chunks/sa-Dag0k-Z8.mjs +0 -200
  409. package/dist/_chunks/sa-Dag0k-Z8.mjs.map +0 -1
  410. package/dist/_chunks/sk-BFg-R8qJ.mjs +0 -202
  411. package/dist/_chunks/sk-BFg-R8qJ.mjs.map +0 -1
  412. package/dist/_chunks/sk-CvY09Xjv.js +0 -202
  413. package/dist/_chunks/sk-CvY09Xjv.js.map +0 -1
  414. package/dist/_chunks/sv-CUnfWGsh.mjs +0 -202
  415. package/dist/_chunks/sv-CUnfWGsh.mjs.map +0 -1
  416. package/dist/_chunks/sv-MYDuzgvT.js +0 -202
  417. package/dist/_chunks/sv-MYDuzgvT.js.map +0 -1
  418. package/dist/_chunks/th-BqbI8lIT.mjs +0 -148
  419. package/dist/_chunks/th-BqbI8lIT.mjs.map +0 -1
  420. package/dist/_chunks/th-D9_GfAjc.js +0 -148
  421. package/dist/_chunks/tr-CgeK3wJM.mjs +0 -199
  422. package/dist/_chunks/tr-CgeK3wJM.mjs.map +0 -1
  423. package/dist/_chunks/tr-D9UH-O_R.js +0 -199
  424. package/dist/_chunks/tr-D9UH-O_R.js.map +0 -1
  425. package/dist/_chunks/uk-C8EiqJY7.js +0 -144
  426. package/dist/_chunks/uk-CR-zDhAY.mjs +0 -144
  427. package/dist/_chunks/uk-CR-zDhAY.mjs.map +0 -1
  428. package/dist/_chunks/useDragAndDrop-BMtgCYzL.js +0 -245
  429. package/dist/_chunks/useDragAndDrop-BMtgCYzL.js.map +0 -1
  430. package/dist/_chunks/useDragAndDrop-DJ6jqvZN.mjs +0 -228
  431. package/dist/_chunks/useDragAndDrop-DJ6jqvZN.mjs.map +0 -1
  432. package/dist/_chunks/usePrev-CZGy2Vjf.mjs +0 -29
  433. package/dist/_chunks/usePrev-CZGy2Vjf.mjs.map +0 -1
  434. package/dist/_chunks/usePrev-D5J_2fEu.js +0 -28
  435. package/dist/_chunks/usePrev-D5J_2fEu.js.map +0 -1
  436. package/dist/_chunks/vi-CJlYDheJ.js +0 -111
  437. package/dist/_chunks/vi-DUXIk_fw.mjs +0 -111
  438. package/dist/_chunks/vi-DUXIk_fw.mjs.map +0 -1
  439. package/dist/_chunks/zh-BWZspA60.mjs +0 -209
  440. package/dist/_chunks/zh-BWZspA60.mjs.map +0 -1
  441. package/dist/_chunks/zh-CQQfszqR.js +0 -209
  442. package/dist/_chunks/zh-CQQfszqR.js.map +0 -1
  443. package/dist/_chunks/zh-Hans-9kOncHGw.js +0 -952
  444. package/dist/_chunks/zh-Hans-BPQcRIyH.mjs +0 -952
@@ -1,245 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const reactDnd = require("react-dnd");
4
- function _interopNamespace(e) {
5
- if (e && e.__esModule) return e;
6
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
- if (e) {
8
- for (const k in e) {
9
- if (k !== "default") {
10
- const d = Object.getOwnPropertyDescriptor(e, k);
11
- Object.defineProperty(n, k, d.get ? d : {
12
- enumerable: true,
13
- get: () => e[k]
14
- });
15
- }
16
- }
17
- }
18
- n.default = e;
19
- return Object.freeze(n);
20
- }
21
- const React__namespace = /* @__PURE__ */ _interopNamespace(React);
22
- const ItemTypes = {
23
- COMPONENT: "component",
24
- EDIT_FIELD: "editField",
25
- FIELD: "field",
26
- DYNAMIC_ZONE: "dynamicZone",
27
- RELATION: "relation",
28
- BLOCKS: "blocks"
29
- };
30
- const useKeyboardDragAndDrop = (active, index, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
31
- const [isSelected, setIsSelected] = React__namespace.useState(false);
32
- const handleMove = (movement) => {
33
- if (!isSelected) {
34
- return;
35
- }
36
- if (typeof index === "number" && onMoveItem) {
37
- if (movement === "UP") {
38
- onMoveItem(index - 1, index);
39
- } else if (movement === "DOWN") {
40
- onMoveItem(index + 1, index);
41
- }
42
- }
43
- };
44
- const handleDragClick = () => {
45
- if (isSelected) {
46
- if (onDropItem) {
47
- onDropItem(index);
48
- }
49
- setIsSelected(false);
50
- } else {
51
- if (onGrabItem) {
52
- onGrabItem(index);
53
- }
54
- setIsSelected(true);
55
- }
56
- };
57
- const handleCancel = () => {
58
- if (isSelected) {
59
- setIsSelected(false);
60
- if (onCancel) {
61
- onCancel(index);
62
- }
63
- }
64
- };
65
- const handleKeyDown = (e) => {
66
- if (!active) {
67
- return;
68
- }
69
- if (e.key === "Tab" && !isSelected) {
70
- return;
71
- }
72
- e.preventDefault();
73
- switch (e.key) {
74
- case " ":
75
- case "Enter":
76
- handleDragClick();
77
- break;
78
- case "Escape":
79
- handleCancel();
80
- break;
81
- case "ArrowDown":
82
- case "ArrowRight":
83
- handleMove("DOWN");
84
- break;
85
- case "ArrowUp":
86
- case "ArrowLeft":
87
- handleMove("UP");
88
- break;
89
- }
90
- };
91
- return handleKeyDown;
92
- };
93
- const DIRECTIONS = {
94
- UPWARD: "upward",
95
- DOWNWARD: "downward"
96
- };
97
- const DROP_SENSITIVITY = {
98
- REGULAR: "regular",
99
- IMMEDIATE: "immediate"
100
- };
101
- const useDragAndDrop = (active, {
102
- type = "STRAPI_DND",
103
- index,
104
- item,
105
- onStart,
106
- onEnd,
107
- onGrabItem,
108
- onDropItem,
109
- onCancel,
110
- onMoveItem,
111
- dropSensitivity = DROP_SENSITIVITY.REGULAR
112
- }) => {
113
- const objectRef = React__namespace.useRef(null);
114
- const [{ handlerId, isOver }, dropRef] = reactDnd.useDrop({
115
- accept: type,
116
- collect(monitor) {
117
- return {
118
- handlerId: monitor.getHandlerId(),
119
- isOver: monitor.isOver({ shallow: true })
120
- };
121
- },
122
- drop(item2) {
123
- const draggedIndex = item2.index;
124
- const newIndex = index;
125
- if (isOver && onDropItem) {
126
- onDropItem(draggedIndex, newIndex);
127
- }
128
- },
129
- hover(item2, monitor) {
130
- if (!objectRef.current || !onMoveItem) {
131
- return;
132
- }
133
- const dragIndex = item2.index;
134
- const newIndex = index;
135
- const hoverBoundingRect = objectRef.current?.getBoundingClientRect();
136
- const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
137
- const clientOffset = monitor.getClientOffset();
138
- if (!clientOffset) return;
139
- const hoverClientY = clientOffset && clientOffset.y - hoverBoundingRect.top;
140
- if (typeof dragIndex === "number" && typeof newIndex === "number") {
141
- if (dragIndex === newIndex) {
142
- return;
143
- }
144
- if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {
145
- if (dragIndex < newIndex && hoverClientY < hoverMiddleY) {
146
- return;
147
- }
148
- if (dragIndex > newIndex && hoverClientY > hoverMiddleY) {
149
- return;
150
- }
151
- }
152
- onMoveItem(newIndex, dragIndex);
153
- item2.index = newIndex;
154
- } else {
155
- if (Array.isArray(dragIndex) && Array.isArray(newIndex)) {
156
- const minLength = Math.min(dragIndex.length, newIndex.length);
157
- let areEqual = true;
158
- let isLessThan = false;
159
- let isGreaterThan = false;
160
- for (let i = 0; i < minLength; i++) {
161
- if (dragIndex[i] < newIndex[i]) {
162
- isLessThan = true;
163
- areEqual = false;
164
- break;
165
- } else if (dragIndex[i] > newIndex[i]) {
166
- isGreaterThan = true;
167
- areEqual = false;
168
- break;
169
- }
170
- }
171
- if (areEqual && dragIndex.length === newIndex.length) {
172
- return;
173
- }
174
- if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {
175
- if (isLessThan && !isGreaterThan && hoverClientY < hoverMiddleY) {
176
- return;
177
- }
178
- if (isGreaterThan && !isLessThan && hoverClientY > hoverMiddleY) {
179
- return;
180
- }
181
- }
182
- }
183
- onMoveItem(newIndex, dragIndex);
184
- item2.index = newIndex;
185
- }
186
- }
187
- });
188
- const getDragDirection = (monitor) => {
189
- if (monitor && monitor.isDragging() && !monitor.didDrop() && monitor.getInitialClientOffset() && monitor.getClientOffset()) {
190
- const deltaY = monitor.getInitialClientOffset().y - monitor.getClientOffset().y;
191
- if (deltaY > 0) return DIRECTIONS.UPWARD;
192
- if (deltaY < 0) return DIRECTIONS.DOWNWARD;
193
- return null;
194
- }
195
- return null;
196
- };
197
- const [{ isDragging, direction }, dragRef, dragPreviewRef] = reactDnd.useDrag({
198
- type,
199
- item() {
200
- if (onStart) {
201
- onStart();
202
- }
203
- const { width } = objectRef.current?.getBoundingClientRect() ?? {};
204
- return { index, width, ...item };
205
- },
206
- end() {
207
- if (onEnd) {
208
- onEnd();
209
- }
210
- },
211
- canDrag: active,
212
- /**
213
- * This is useful when the item is in a virtualized list.
214
- * However, if we don't have an ID then we want the libraries
215
- * defaults to take care of this.
216
- */
217
- isDragging: item?.id ? (monitor) => {
218
- return item.id === monitor.getItem().id;
219
- } : void 0,
220
- collect: (monitor) => ({
221
- isDragging: monitor.isDragging(),
222
- initialOffset: monitor.getInitialClientOffset(),
223
- currentOffset: monitor.getClientOffset(),
224
- direction: getDragDirection(monitor)
225
- })
226
- });
227
- const handleKeyDown = useKeyboardDragAndDrop(active, index, {
228
- onGrabItem,
229
- onDropItem,
230
- onCancel,
231
- onMoveItem
232
- });
233
- return [
234
- { handlerId, isDragging, handleKeyDown, isOverDropTarget: isOver, direction },
235
- objectRef,
236
- dropRef,
237
- dragRef,
238
- dragPreviewRef
239
- ];
240
- };
241
- exports.DIRECTIONS = DIRECTIONS;
242
- exports.DROP_SENSITIVITY = DROP_SENSITIVITY;
243
- exports.ItemTypes = ItemTypes;
244
- exports.useDragAndDrop = useDragAndDrop;
245
- //# sourceMappingURL=useDragAndDrop-BMtgCYzL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDragAndDrop-BMtgCYzL.js","sources":["../../admin/src/constants/dragAndDrop.ts","../../admin/src/hooks/useKeyboardDragAndDrop.ts","../../admin/src/hooks/useDragAndDrop.ts"],"sourcesContent":["export const ItemTypes = {\n COMPONENT: 'component',\n EDIT_FIELD: 'editField',\n FIELD: 'field',\n DYNAMIC_ZONE: 'dynamicZone',\n RELATION: 'relation',\n BLOCKS: 'blocks',\n} as const;\n","import * as React from 'react';\n\nexport type UseKeyboardDragAndDropCallbacks<TIndex extends number | Array<number> = number> = {\n onCancel?: (index: TIndex) => void;\n onDropItem?: (currentIndex: TIndex, newIndex?: TIndex) => void;\n onGrabItem?: (index: TIndex) => void;\n onMoveItem?: (newIndex: TIndex, currentIndex: TIndex) => void;\n};\n\n/**\n * Utility hook designed to implement keyboard accessibile drag and drop by\n * returning an onKeyDown handler to be passed to the drag icon button.\n *\n * @internal - You should use `useDragAndDrop` instead.\n */\nexport const useKeyboardDragAndDrop = <TIndex extends number | Array<number> = number>(\n active: boolean,\n index: TIndex,\n { onCancel, onDropItem, onGrabItem, onMoveItem }: UseKeyboardDragAndDropCallbacks<TIndex>\n) => {\n const [isSelected, setIsSelected] = React.useState(false);\n\n const handleMove = (movement: 'UP' | 'DOWN') => {\n if (!isSelected) {\n return;\n }\n if (typeof index === 'number' && onMoveItem) {\n if (movement === 'UP') {\n onMoveItem((index - 1) as TIndex, index);\n } else if (movement === 'DOWN') {\n onMoveItem((index + 1) as TIndex, index);\n }\n }\n };\n\n const handleDragClick = () => {\n if (isSelected) {\n if (onDropItem) {\n onDropItem(index);\n }\n setIsSelected(false);\n } else {\n if (onGrabItem) {\n onGrabItem(index);\n }\n setIsSelected(true);\n }\n };\n\n const handleCancel = () => {\n if (isSelected) {\n setIsSelected(false);\n\n if (onCancel) {\n onCancel(index);\n }\n }\n };\n\n const handleKeyDown = <E extends Element>(e: React.KeyboardEvent<E>) => {\n if (!active) {\n return;\n }\n\n if (e.key === 'Tab' && !isSelected) {\n return;\n }\n\n e.preventDefault();\n\n switch (e.key) {\n case ' ':\n case 'Enter':\n handleDragClick();\n break;\n\n case 'Escape':\n handleCancel();\n break;\n\n case 'ArrowDown':\n case 'ArrowRight':\n handleMove('DOWN');\n break;\n\n case 'ArrowUp':\n case 'ArrowLeft':\n handleMove('UP');\n break;\n\n default:\n }\n };\n\n return handleKeyDown;\n};\n","import * as React from 'react';\n\nimport {\n useDrag,\n useDrop,\n type HandlerManager,\n type ConnectDragSource,\n type ConnectDropTarget,\n type ConnectDragPreview,\n type DragSourceMonitor,\n} from 'react-dnd';\n\nimport {\n useKeyboardDragAndDrop,\n type UseKeyboardDragAndDropCallbacks,\n} from './useKeyboardDragAndDrop';\n\nimport type { Data } from '@strapi/types';\n\nconst DIRECTIONS = {\n UPWARD: 'upward',\n DOWNWARD: 'downward',\n} as const;\n\nconst DROP_SENSITIVITY = {\n REGULAR: 'regular',\n IMMEDIATE: 'immediate',\n} as const;\n\ninterface UseDragAndDropOptions<\n TIndex extends number | Array<number> = number,\n TItem extends { index: TIndex } = { index: TIndex },\n> extends UseKeyboardDragAndDropCallbacks<TIndex> {\n type?: string;\n index: TIndex;\n item?: TItem;\n onStart?: () => void;\n onEnd?: () => void;\n dropSensitivity?: (typeof DROP_SENSITIVITY)[keyof typeof DROP_SENSITIVITY];\n}\n\ntype Identifier = ReturnType<HandlerManager['getHandlerId']>;\n\ntype UseDragAndDropReturn<E extends Element = HTMLElement> = [\n props: {\n handlerId: Identifier;\n isDragging: boolean;\n handleKeyDown: <E extends Element>(event: React.KeyboardEvent<E>) => void;\n isOverDropTarget: boolean;\n direction: (typeof DIRECTIONS)[keyof typeof DIRECTIONS] | null;\n },\n objectRef: React.RefObject<E>,\n dropRef: ConnectDropTarget,\n dragRef: ConnectDragSource,\n dragPreviewRef: ConnectDragPreview,\n];\n\ntype DropCollectedProps = {\n handlerId: Identifier;\n isOver: boolean;\n};\n\n/**\n * A utility hook abstracting the general drag and drop hooks from react-dnd.\n * Centralising the same behaviours and by default offering keyboard support.\n */\nconst useDragAndDrop = <\n TIndex extends number | Array<number>,\n TItem extends { index: TIndex; id?: Data.ID; [key: string]: unknown } = {\n index: TIndex;\n [key: string]: unknown;\n },\n E extends Element = HTMLElement,\n>(\n active: boolean,\n {\n type = 'STRAPI_DND',\n index,\n item,\n onStart,\n onEnd,\n onGrabItem,\n onDropItem,\n onCancel,\n onMoveItem,\n dropSensitivity = DROP_SENSITIVITY.REGULAR,\n }: UseDragAndDropOptions<TIndex, TItem>\n): UseDragAndDropReturn<E> => {\n const objectRef = React.useRef<E>(null);\n\n const [{ handlerId, isOver }, dropRef] = useDrop<TItem, void, DropCollectedProps>({\n accept: type,\n collect(monitor) {\n return {\n handlerId: monitor.getHandlerId(),\n isOver: monitor.isOver({ shallow: true }),\n };\n },\n drop(item) {\n const draggedIndex = item.index;\n const newIndex = index;\n\n if (isOver && onDropItem) {\n onDropItem(draggedIndex, newIndex);\n }\n },\n hover(item, monitor) {\n if (!objectRef.current || !onMoveItem) {\n return;\n }\n\n const dragIndex = item.index;\n const newIndex = index;\n\n const hoverBoundingRect = objectRef.current?.getBoundingClientRect();\n const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;\n const clientOffset = monitor.getClientOffset();\n if (!clientOffset) return;\n\n const hoverClientY = clientOffset && clientOffset.y - hoverBoundingRect.top;\n if (typeof dragIndex === 'number' && typeof newIndex === 'number') {\n if (dragIndex === newIndex) {\n // Don't replace items with themselves\n return;\n }\n\n if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {\n // Dragging downwards\n if (dragIndex < newIndex && hoverClientY < hoverMiddleY) {\n return;\n }\n\n // Dragging upwards\n if (dragIndex > newIndex && hoverClientY > hoverMiddleY) {\n return;\n }\n }\n\n // Time to actually perform the action\n onMoveItem(newIndex, dragIndex);\n item.index = newIndex;\n } else {\n // Using numbers as indices doesn't work for nested list items with path like [1, 1, 0]\n if (Array.isArray(dragIndex) && Array.isArray(newIndex)) {\n // Indices comparison to find item position in nested list\n const minLength = Math.min(dragIndex.length, newIndex.length);\n let areEqual = true;\n let isLessThan = false;\n let isGreaterThan = false;\n\n for (let i = 0; i < minLength; i++) {\n if (dragIndex[i] < newIndex[i]) {\n isLessThan = true;\n areEqual = false;\n break;\n } else if (dragIndex[i] > newIndex[i]) {\n isGreaterThan = true;\n areEqual = false;\n break;\n }\n }\n\n // Don't replace items with themselves\n if (areEqual && dragIndex.length === newIndex.length) {\n return;\n }\n\n if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {\n // Dragging downwards\n if (isLessThan && !isGreaterThan && hoverClientY < hoverMiddleY) {\n return;\n }\n\n // Dragging upwards\n if (isGreaterThan && !isLessThan && hoverClientY > hoverMiddleY) {\n return;\n }\n }\n }\n\n onMoveItem(newIndex, dragIndex);\n item.index = newIndex;\n }\n },\n });\n\n const getDragDirection = (monitor: DragSourceMonitor<TItem, void>) => {\n if (\n monitor &&\n monitor.isDragging() &&\n !monitor.didDrop() &&\n monitor.getInitialClientOffset() &&\n monitor.getClientOffset()\n ) {\n const deltaY = monitor.getInitialClientOffset()!.y - monitor.getClientOffset()!.y;\n\n if (deltaY > 0) return DIRECTIONS.UPWARD;\n\n if (deltaY < 0) return DIRECTIONS.DOWNWARD;\n\n return null;\n }\n\n return null;\n };\n\n const [{ isDragging, direction }, dragRef, dragPreviewRef] = useDrag({\n type,\n item() {\n if (onStart) {\n onStart();\n }\n\n /**\n * This will be attached and it helps define the preview sizes\n * when a component is flexy e.g. Relations\n */\n const { width } = objectRef.current?.getBoundingClientRect() ?? {};\n\n return { index, width, ...item };\n },\n end() {\n if (onEnd) {\n onEnd();\n }\n },\n canDrag: active,\n /**\n * This is useful when the item is in a virtualized list.\n * However, if we don't have an ID then we want the libraries\n * defaults to take care of this.\n */\n isDragging: item?.id\n ? (monitor) => {\n return item.id === monitor.getItem().id;\n }\n : undefined,\n collect: (monitor) => ({\n isDragging: monitor.isDragging(),\n initialOffset: monitor.getInitialClientOffset(),\n currentOffset: monitor.getClientOffset(),\n direction: getDragDirection(monitor),\n }),\n });\n\n const handleKeyDown = useKeyboardDragAndDrop(active, index, {\n onGrabItem,\n onDropItem,\n onCancel,\n onMoveItem,\n });\n\n return [\n { handlerId, isDragging, handleKeyDown, isOverDropTarget: isOver, direction },\n objectRef,\n dropRef,\n dragRef,\n dragPreviewRef,\n ];\n};\n\nexport {\n useDragAndDrop,\n UseDragAndDropReturn,\n UseDragAndDropOptions,\n DIRECTIONS,\n DROP_SENSITIVITY,\n};\n"],"names":["React","useDrop","item","useDrag"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,YAAY;AAAA,EACvB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,cAAc;AAAA,EACd,UAAU;AAAA,EACV,QAAQ;AACV;ACQa,MAAA,yBAAyB,CACpC,QACA,OACA,EAAE,UAAU,YAAY,YAAY,iBACjC;AACH,QAAM,CAAC,YAAY,aAAa,IAAIA,iBAAM,SAAS,KAAK;AAElD,QAAA,aAAa,CAAC,aAA4B;AAC9C,QAAI,CAAC,YAAY;AACf;AAAA,IAAA;AAEE,QAAA,OAAO,UAAU,YAAY,YAAY;AAC3C,UAAI,aAAa,MAAM;AACT,mBAAA,QAAQ,GAAc,KAAK;AAAA,MAAA,WAC9B,aAAa,QAAQ;AAClB,mBAAA,QAAQ,GAAc,KAAK;AAAA,MAAA;AAAA,IACzC;AAAA,EAEJ;AAEA,QAAM,kBAAkB,MAAM;AAC5B,QAAI,YAA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e,QAAQ,uBAAuB;AAAA,MAC9C,eAAe,QAAQ,gBAAgB;AAAA,MACvC,WAAW,iBAAiB,OAAO;AAAA,IACrC;AAAA,EAAA,CACD;AAEK,QAAA,gBAAgB,uBAAuB,QAAQ,OAAO;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAEM,SAAA;AAAA,IACL,EAAE,WAAW,YAAY,eAAe,kBAAkB,QAAQ,UAAU;AAAA,IAC5E;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;;;;;"}
@@ -1,228 +0,0 @@
1
- import * as React from "react";
2
- import { useDrop, useDrag } from "react-dnd";
3
- const ItemTypes = {
4
- COMPONENT: "component",
5
- EDIT_FIELD: "editField",
6
- FIELD: "field",
7
- DYNAMIC_ZONE: "dynamicZone",
8
- RELATION: "relation",
9
- BLOCKS: "blocks"
10
- };
11
- const useKeyboardDragAndDrop = (active, index, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
12
- const [isSelected, setIsSelected] = React.useState(false);
13
- const handleMove = (movement) => {
14
- if (!isSelected) {
15
- return;
16
- }
17
- if (typeof index === "number" && onMoveItem) {
18
- if (movement === "UP") {
19
- onMoveItem(index - 1, index);
20
- } else if (movement === "DOWN") {
21
- onMoveItem(index + 1, index);
22
- }
23
- }
24
- };
25
- const handleDragClick = () => {
26
- if (isSelected) {
27
- if (onDropItem) {
28
- onDropItem(index);
29
- }
30
- setIsSelected(false);
31
- } else {
32
- if (onGrabItem) {
33
- onGrabItem(index);
34
- }
35
- setIsSelected(true);
36
- }
37
- };
38
- const handleCancel = () => {
39
- if (isSelected) {
40
- setIsSelected(false);
41
- if (onCancel) {
42
- onCancel(index);
43
- }
44
- }
45
- };
46
- const handleKeyDown = (e) => {
47
- if (!active) {
48
- return;
49
- }
50
- if (e.key === "Tab" && !isSelected) {
51
- return;
52
- }
53
- e.preventDefault();
54
- switch (e.key) {
55
- case " ":
56
- case "Enter":
57
- handleDragClick();
58
- break;
59
- case "Escape":
60
- handleCancel();
61
- break;
62
- case "ArrowDown":
63
- case "ArrowRight":
64
- handleMove("DOWN");
65
- break;
66
- case "ArrowUp":
67
- case "ArrowLeft":
68
- handleMove("UP");
69
- break;
70
- }
71
- };
72
- return handleKeyDown;
73
- };
74
- const DIRECTIONS = {
75
- UPWARD: "upward",
76
- DOWNWARD: "downward"
77
- };
78
- const DROP_SENSITIVITY = {
79
- REGULAR: "regular",
80
- IMMEDIATE: "immediate"
81
- };
82
- const useDragAndDrop = (active, {
83
- type = "STRAPI_DND",
84
- index,
85
- item,
86
- onStart,
87
- onEnd,
88
- onGrabItem,
89
- onDropItem,
90
- onCancel,
91
- onMoveItem,
92
- dropSensitivity = DROP_SENSITIVITY.REGULAR
93
- }) => {
94
- const objectRef = React.useRef(null);
95
- const [{ handlerId, isOver }, dropRef] = useDrop({
96
- accept: type,
97
- collect(monitor) {
98
- return {
99
- handlerId: monitor.getHandlerId(),
100
- isOver: monitor.isOver({ shallow: true })
101
- };
102
- },
103
- drop(item2) {
104
- const draggedIndex = item2.index;
105
- const newIndex = index;
106
- if (isOver && onDropItem) {
107
- onDropItem(draggedIndex, newIndex);
108
- }
109
- },
110
- hover(item2, monitor) {
111
- if (!objectRef.current || !onMoveItem) {
112
- return;
113
- }
114
- const dragIndex = item2.index;
115
- const newIndex = index;
116
- const hoverBoundingRect = objectRef.current?.getBoundingClientRect();
117
- const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
118
- const clientOffset = monitor.getClientOffset();
119
- if (!clientOffset) return;
120
- const hoverClientY = clientOffset && clientOffset.y - hoverBoundingRect.top;
121
- if (typeof dragIndex === "number" && typeof newIndex === "number") {
122
- if (dragIndex === newIndex) {
123
- return;
124
- }
125
- if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {
126
- if (dragIndex < newIndex && hoverClientY < hoverMiddleY) {
127
- return;
128
- }
129
- if (dragIndex > newIndex && hoverClientY > hoverMiddleY) {
130
- return;
131
- }
132
- }
133
- onMoveItem(newIndex, dragIndex);
134
- item2.index = newIndex;
135
- } else {
136
- if (Array.isArray(dragIndex) && Array.isArray(newIndex)) {
137
- const minLength = Math.min(dragIndex.length, newIndex.length);
138
- let areEqual = true;
139
- let isLessThan = false;
140
- let isGreaterThan = false;
141
- for (let i = 0; i < minLength; i++) {
142
- if (dragIndex[i] < newIndex[i]) {
143
- isLessThan = true;
144
- areEqual = false;
145
- break;
146
- } else if (dragIndex[i] > newIndex[i]) {
147
- isGreaterThan = true;
148
- areEqual = false;
149
- break;
150
- }
151
- }
152
- if (areEqual && dragIndex.length === newIndex.length) {
153
- return;
154
- }
155
- if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {
156
- if (isLessThan && !isGreaterThan && hoverClientY < hoverMiddleY) {
157
- return;
158
- }
159
- if (isGreaterThan && !isLessThan && hoverClientY > hoverMiddleY) {
160
- return;
161
- }
162
- }
163
- }
164
- onMoveItem(newIndex, dragIndex);
165
- item2.index = newIndex;
166
- }
167
- }
168
- });
169
- const getDragDirection = (monitor) => {
170
- if (monitor && monitor.isDragging() && !monitor.didDrop() && monitor.getInitialClientOffset() && monitor.getClientOffset()) {
171
- const deltaY = monitor.getInitialClientOffset().y - monitor.getClientOffset().y;
172
- if (deltaY > 0) return DIRECTIONS.UPWARD;
173
- if (deltaY < 0) return DIRECTIONS.DOWNWARD;
174
- return null;
175
- }
176
- return null;
177
- };
178
- const [{ isDragging, direction }, dragRef, dragPreviewRef] = useDrag({
179
- type,
180
- item() {
181
- if (onStart) {
182
- onStart();
183
- }
184
- const { width } = objectRef.current?.getBoundingClientRect() ?? {};
185
- return { index, width, ...item };
186
- },
187
- end() {
188
- if (onEnd) {
189
- onEnd();
190
- }
191
- },
192
- canDrag: active,
193
- /**
194
- * This is useful when the item is in a virtualized list.
195
- * However, if we don't have an ID then we want the libraries
196
- * defaults to take care of this.
197
- */
198
- isDragging: item?.id ? (monitor) => {
199
- return item.id === monitor.getItem().id;
200
- } : void 0,
201
- collect: (monitor) => ({
202
- isDragging: monitor.isDragging(),
203
- initialOffset: monitor.getInitialClientOffset(),
204
- currentOffset: monitor.getClientOffset(),
205
- direction: getDragDirection(monitor)
206
- })
207
- });
208
- const handleKeyDown = useKeyboardDragAndDrop(active, index, {
209
- onGrabItem,
210
- onDropItem,
211
- onCancel,
212
- onMoveItem
213
- });
214
- return [
215
- { handlerId, isDragging, handleKeyDown, isOverDropTarget: isOver, direction },
216
- objectRef,
217
- dropRef,
218
- dragRef,
219
- dragPreviewRef
220
- ];
221
- };
222
- export {
223
- DROP_SENSITIVITY as D,
224
- ItemTypes as I,
225
- DIRECTIONS as a,
226
- useDragAndDrop as u
227
- };
228
- //# sourceMappingURL=useDragAndDrop-DJ6jqvZN.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDragAndDrop-DJ6jqvZN.mjs","sources":["../../admin/src/constants/dragAndDrop.ts","../../admin/src/hooks/useKeyboardDragAndDrop.ts","../../admin/src/hooks/useDragAndDrop.ts"],"sourcesContent":["export const ItemTypes = {\n COMPONENT: 'component',\n EDIT_FIELD: 'editField',\n FIELD: 'field',\n DYNAMIC_ZONE: 'dynamicZone',\n RELATION: 'relation',\n BLOCKS: 'blocks',\n} as const;\n","import * as React from 'react';\n\nexport type UseKeyboardDragAndDropCallbacks<TIndex extends number | Array<number> = number> = {\n onCancel?: (index: TIndex) => void;\n onDropItem?: (currentIndex: TIndex, newIndex?: TIndex) => void;\n onGrabItem?: (index: TIndex) => void;\n onMoveItem?: (newIndex: TIndex, currentIndex: TIndex) => void;\n};\n\n/**\n * Utility hook designed to implement keyboard accessibile drag and drop by\n * returning an onKeyDown handler to be passed to the drag icon button.\n *\n * @internal - You should use `useDragAndDrop` instead.\n */\nexport const useKeyboardDragAndDrop = <TIndex extends number | Array<number> = number>(\n active: boolean,\n index: TIndex,\n { onCancel, onDropItem, onGrabItem, onMoveItem }: UseKeyboardDragAndDropCallbacks<TIndex>\n) => {\n const [isSelected, setIsSelected] = React.useState(false);\n\n const handleMove = (movement: 'UP' | 'DOWN') => {\n if (!isSelected) {\n return;\n }\n if (typeof index === 'number' && onMoveItem) {\n if (movement === 'UP') {\n onMoveItem((index - 1) as TIndex, index);\n } else if (movement === 'DOWN') {\n onMoveItem((index + 1) as TIndex, index);\n }\n }\n };\n\n const handleDragClick = () => {\n if (isSelected) {\n if (onDropItem) {\n onDropItem(index);\n }\n setIsSelected(false);\n } else {\n if (onGrabItem) {\n onGrabItem(index);\n }\n setIsSelected(true);\n }\n };\n\n const handleCancel = () => {\n if (isSelected) {\n setIsSelected(false);\n\n if (onCancel) {\n onCancel(index);\n }\n }\n };\n\n const handleKeyDown = <E extends Element>(e: React.KeyboardEvent<E>) => {\n if (!active) {\n return;\n }\n\n if (e.key === 'Tab' && !isSelected) {\n return;\n }\n\n e.preventDefault();\n\n switch (e.key) {\n case ' ':\n case 'Enter':\n handleDragClick();\n break;\n\n case 'Escape':\n handleCancel();\n break;\n\n case 'ArrowDown':\n case 'ArrowRight':\n handleMove('DOWN');\n break;\n\n case 'ArrowUp':\n case 'ArrowLeft':\n handleMove('UP');\n break;\n\n default:\n }\n };\n\n return handleKeyDown;\n};\n","import * as React from 'react';\n\nimport {\n useDrag,\n useDrop,\n type HandlerManager,\n type ConnectDragSource,\n type ConnectDropTarget,\n type ConnectDragPreview,\n type DragSourceMonitor,\n} from 'react-dnd';\n\nimport {\n useKeyboardDragAndDrop,\n type UseKeyboardDragAndDropCallbacks,\n} from './useKeyboardDragAndDrop';\n\nimport type { Data } from '@strapi/types';\n\nconst DIRECTIONS = {\n UPWARD: 'upward',\n DOWNWARD: 'downward',\n} as const;\n\nconst DROP_SENSITIVITY = {\n REGULAR: 'regular',\n IMMEDIATE: 'immediate',\n} as const;\n\ninterface UseDragAndDropOptions<\n TIndex extends number | Array<number> = number,\n TItem extends { index: TIndex } = { index: TIndex },\n> extends UseKeyboardDragAndDropCallbacks<TIndex> {\n type?: string;\n index: TIndex;\n item?: TItem;\n onStart?: () => void;\n onEnd?: () => void;\n dropSensitivity?: (typeof DROP_SENSITIVITY)[keyof typeof DROP_SENSITIVITY];\n}\n\ntype Identifier = ReturnType<HandlerManager['getHandlerId']>;\n\ntype UseDragAndDropReturn<E extends Element = HTMLElement> = [\n props: {\n handlerId: Identifier;\n isDragging: boolean;\n handleKeyDown: <E extends Element>(event: React.KeyboardEvent<E>) => void;\n isOverDropTarget: boolean;\n direction: (typeof DIRECTIONS)[keyof typeof DIRECTIONS] | null;\n },\n objectRef: React.RefObject<E>,\n dropRef: ConnectDropTarget,\n dragRef: ConnectDragSource,\n dragPreviewRef: ConnectDragPreview,\n];\n\ntype DropCollectedProps = {\n handlerId: Identifier;\n isOver: boolean;\n};\n\n/**\n * A utility hook abstracting the general drag and drop hooks from react-dnd.\n * Centralising the same behaviours and by default offering keyboard support.\n */\nconst useDragAndDrop = <\n TIndex extends number | Array<number>,\n TItem extends { index: TIndex; id?: Data.ID; [key: string]: unknown } = {\n index: TIndex;\n [key: string]: unknown;\n },\n E extends Element = HTMLElement,\n>(\n active: boolean,\n {\n type = 'STRAPI_DND',\n index,\n item,\n onStart,\n onEnd,\n onGrabItem,\n onDropItem,\n onCancel,\n onMoveItem,\n dropSensitivity = DROP_SENSITIVITY.REGULAR,\n }: UseDragAndDropOptions<TIndex, TItem>\n): UseDragAndDropReturn<E> => {\n const objectRef = React.useRef<E>(null);\n\n const [{ handlerId, isOver }, dropRef] = useDrop<TItem, void, DropCollectedProps>({\n accept: type,\n collect(monitor) {\n return {\n handlerId: monitor.getHandlerId(),\n isOver: monitor.isOver({ shallow: true }),\n };\n },\n drop(item) {\n const draggedIndex = item.index;\n const newIndex = index;\n\n if (isOver && onDropItem) {\n onDropItem(draggedIndex, newIndex);\n }\n },\n hover(item, monitor) {\n if (!objectRef.current || !onMoveItem) {\n return;\n }\n\n const dragIndex = item.index;\n const newIndex = index;\n\n const hoverBoundingRect = objectRef.current?.getBoundingClientRect();\n const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;\n const clientOffset = monitor.getClientOffset();\n if (!clientOffset) return;\n\n const hoverClientY = clientOffset && clientOffset.y - hoverBoundingRect.top;\n if (typeof dragIndex === 'number' && typeof newIndex === 'number') {\n if (dragIndex === newIndex) {\n // Don't replace items with themselves\n return;\n }\n\n if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {\n // Dragging downwards\n if (dragIndex < newIndex && hoverClientY < hoverMiddleY) {\n return;\n }\n\n // Dragging upwards\n if (dragIndex > newIndex && hoverClientY > hoverMiddleY) {\n return;\n }\n }\n\n // Time to actually perform the action\n onMoveItem(newIndex, dragIndex);\n item.index = newIndex;\n } else {\n // Using numbers as indices doesn't work for nested list items with path like [1, 1, 0]\n if (Array.isArray(dragIndex) && Array.isArray(newIndex)) {\n // Indices comparison to find item position in nested list\n const minLength = Math.min(dragIndex.length, newIndex.length);\n let areEqual = true;\n let isLessThan = false;\n let isGreaterThan = false;\n\n for (let i = 0; i < minLength; i++) {\n if (dragIndex[i] < newIndex[i]) {\n isLessThan = true;\n areEqual = false;\n break;\n } else if (dragIndex[i] > newIndex[i]) {\n isGreaterThan = true;\n areEqual = false;\n break;\n }\n }\n\n // Don't replace items with themselves\n if (areEqual && dragIndex.length === newIndex.length) {\n return;\n }\n\n if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {\n // Dragging downwards\n if (isLessThan && !isGreaterThan && hoverClientY < hoverMiddleY) {\n return;\n }\n\n // Dragging upwards\n if (isGreaterThan && !isLessThan && hoverClientY > hoverMiddleY) {\n return;\n }\n }\n }\n\n onMoveItem(newIndex, dragIndex);\n item.index = newIndex;\n }\n },\n });\n\n const getDragDirection = (monitor: DragSourceMonitor<TItem, void>) => {\n if (\n monitor &&\n monitor.isDragging() &&\n !monitor.didDrop() &&\n monitor.getInitialClientOffset() &&\n monitor.getClientOffset()\n ) {\n const deltaY = monitor.getInitialClientOffset()!.y - monitor.getClientOffset()!.y;\n\n if (deltaY > 0) return DIRECTIONS.UPWARD;\n\n if (deltaY < 0) return DIRECTIONS.DOWNWARD;\n\n return null;\n }\n\n return null;\n };\n\n const [{ isDragging, direction }, dragRef, dragPreviewRef] = useDrag({\n type,\n item() {\n if (onStart) {\n onStart();\n }\n\n /**\n * This will be attached and it helps define the preview sizes\n * when a component is flexy e.g. Relations\n */\n const { width } = objectRef.current?.getBoundingClientRect() ?? {};\n\n return { index, width, ...item };\n },\n end() {\n if (onEnd) {\n onEnd();\n }\n },\n canDrag: active,\n /**\n * This is useful when the item is in a virtualized list.\n * However, if we don't have an ID then we want the libraries\n * defaults to take care of this.\n */\n isDragging: item?.id\n ? (monitor) => {\n return item.id === monitor.getItem().id;\n }\n : undefined,\n collect: (monitor) => ({\n isDragging: monitor.isDragging(),\n initialOffset: monitor.getInitialClientOffset(),\n currentOffset: monitor.getClientOffset(),\n direction: getDragDirection(monitor),\n }),\n });\n\n const handleKeyDown = useKeyboardDragAndDrop(active, index, {\n onGrabItem,\n onDropItem,\n onCancel,\n onMoveItem,\n });\n\n return [\n { handlerId, isDragging, handleKeyDown, isOverDropTarget: isOver, direction },\n objectRef,\n dropRef,\n dragRef,\n dragPreviewRef,\n ];\n};\n\nexport {\n useDragAndDrop,\n UseDragAndDropReturn,\n UseDragAndDropOptions,\n DIRECTIONS,\n DROP_SENSITIVITY,\n};\n"],"names":["item"],"mappings":";;AAAO,MAAM,YAAY;AAAA,EACvB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,cAAc;AAAA,EACd,UAAU;AAAA,EACV,QAAQ;AACV;ACQa,MAAA,yBAAyB,CACpC,QACA,OACA,EAAE,UAAU,YAAY,YAAY,iBACjC;AACH,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,KAAK;AAElD,QAAA,aAAa,CAAC,aAA4B;AAC9C,QAAI,CAAC,YAAY;AACf;AAAA,IAAA;AAEE,QAAA,OAAO,UAAU,YAAY,YAAY;AAC3C,UAAI,aAAa,MAAM;AACT,mBAAA,QAAQ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YAAY;AACX,aAAO,KAAK,OAAO,QAAQ,QAAU,EAAA;AAAA,IAEvC,IAAA;AAAA,IACJ,SAAS,CAAC,aAAa;AAAA,MACrB,YAAY,QAAQ,WAAW;AAAA,MAC/B,eAAe,QAAQ,uBAAuB;AAAA,MAC9C,eAAe,QAAQ,gBAAgB;AAAA,MACvC,WAAW,iBAAiB,OAAO;AAAA,IACrC;AAAA,EAAA,CACD;AAEK,QAAA,gBAAgB,uBAAuB,QAAQ,OAAO;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAEM,SAAA;AAAA,IACL,EAAE,WAAW,YAAY,eAAe,kBAAkB,QAAQ,UAAU;AAAA,IAC5E;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;"}
@@ -1,29 +0,0 @@
1
- import { useState, useEffect, useRef } from "react";
2
- const prefixFileUrlWithBackendUrl = (fileURL) => {
3
- return !!fileURL && fileURL.startsWith("/") ? `${window.strapi.backendURL}${fileURL}` : fileURL;
4
- };
5
- function useDebounce(value, delay) {
6
- const [debouncedValue, setDebouncedValue] = useState(value);
7
- useEffect(() => {
8
- const handler = setTimeout(() => {
9
- setDebouncedValue(value);
10
- }, delay);
11
- return () => {
12
- clearTimeout(handler);
13
- };
14
- }, [value, delay]);
15
- return debouncedValue;
16
- }
17
- const usePrev = (value) => {
18
- const ref = useRef();
19
- useEffect(() => {
20
- ref.current = value;
21
- }, [value]);
22
- return ref.current;
23
- };
24
- export {
25
- usePrev as a,
26
- prefixFileUrlWithBackendUrl as p,
27
- useDebounce as u
28
- };
29
- //# sourceMappingURL=usePrev-CZGy2Vjf.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePrev-CZGy2Vjf.mjs","sources":["../../admin/src/utils/urls.ts","../../admin/src/hooks/useDebounce.ts","../../admin/src/hooks/usePrev.ts"],"sourcesContent":["const prefixFileUrlWithBackendUrl = (fileURL?: string): string | undefined => {\n return !!fileURL && fileURL.startsWith('/') ? `${window.strapi.backendURL}${fileURL}` : fileURL;\n};\n\nexport { prefixFileUrlWithBackendUrl };\n","import { useEffect, useState } from 'react';\n\nexport function useDebounce<TValue>(value: TValue, delay: number): TValue {\n const [debouncedValue, setDebouncedValue] = useState(value);\n\n useEffect(() => {\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n\n return () => {\n clearTimeout(handler);\n };\n }, [value, delay]);\n\n return debouncedValue;\n}\n","import { useEffect, useRef } from 'react';\n\nexport const usePrev = <T>(value: T): T | undefined => {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n};\n"],"names":[],"mappings":";AAAM,MAAA,8BAA8B,CAAC,YAAyC;AAC5E,SAAO,CAAC,CAAC,WAAW,QAAQ,WAAW,GAAG,IAAI,GAAG,OAAO,OAAO,UAAU,GAAG,OAAO,KAAK;AAC1F;ACAgB,SAAA,YAAoB,OAAe,OAAuB;AACxE,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAAK;AAE1D,YAAU,MAAM;AACR,UAAA,UAAU,WAAW,MAAM;AAC/B,wBAAkB,KAAK;AAAA,OACtB,KAAK;AAER,WAAO,MAAM;AACX,mBAAa,OAAO;AAAA,IACtB;AAAA,EAAA,GACC,CAAC,OAAO,KAAK,CAAC;AAEV,SAAA;AACT;ACda,MAAA,UAAU,CAAI,UAA4B;AACrD,QAAM,MAAM,OAAU;AAEtB,YAAU,MAAM;AACd,QAAI,UAAU;AAAA,EAAA,GACb,CAAC,KAAK,CAAC;AAEV,SAAO,IAAI;AACb;"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const prefixFileUrlWithBackendUrl = (fileURL) => {
4
- return !!fileURL && fileURL.startsWith("/") ? `${window.strapi.backendURL}${fileURL}` : fileURL;
5
- };
6
- function useDebounce(value, delay) {
7
- const [debouncedValue, setDebouncedValue] = React.useState(value);
8
- React.useEffect(() => {
9
- const handler = setTimeout(() => {
10
- setDebouncedValue(value);
11
- }, delay);
12
- return () => {
13
- clearTimeout(handler);
14
- };
15
- }, [value, delay]);
16
- return debouncedValue;
17
- }
18
- const usePrev = (value) => {
19
- const ref = React.useRef();
20
- React.useEffect(() => {
21
- ref.current = value;
22
- }, [value]);
23
- return ref.current;
24
- };
25
- exports.prefixFileUrlWithBackendUrl = prefixFileUrlWithBackendUrl;
26
- exports.useDebounce = useDebounce;
27
- exports.usePrev = usePrev;
28
- //# sourceMappingURL=usePrev-D5J_2fEu.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePrev-D5J_2fEu.js","sources":["../../admin/src/utils/urls.ts","../../admin/src/hooks/useDebounce.ts","../../admin/src/hooks/usePrev.ts"],"sourcesContent":["const prefixFileUrlWithBackendUrl = (fileURL?: string): string | undefined => {\n return !!fileURL && fileURL.startsWith('/') ? `${window.strapi.backendURL}${fileURL}` : fileURL;\n};\n\nexport { prefixFileUrlWithBackendUrl };\n","import { useEffect, useState } from 'react';\n\nexport function useDebounce<TValue>(value: TValue, delay: number): TValue {\n const [debouncedValue, setDebouncedValue] = useState(value);\n\n useEffect(() => {\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n\n return () => {\n clearTimeout(handler);\n };\n }, [value, delay]);\n\n return debouncedValue;\n}\n","import { useEffect, useRef } from 'react';\n\nexport const usePrev = <T>(value: T): T | undefined => {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n};\n"],"names":["useState","useEffect","useRef"],"mappings":";;AAAM,MAAA,8BAA8B,CAAC,YAAyC;AAC5E,SAAO,CAAC,CAAC,WAAW,QAAQ,WAAW,GAAG,IAAI,GAAG,OAAO,OAAO,UAAU,GAAG,OAAO,KAAK;AAC1F;ACAgB,SAAA,YAAoB,OAAe,OAAuB;AACxE,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,MAAAA,SAAS,KAAK;AAE1DC,QAAAA,UAAU,MAAM;AACR,UAAA,UAAU,WAAW,MAAM;AAC/B,wBAAkB,KAAK;AAAA,OACtB,KAAK;AAER,WAAO,MAAM;AACX,mBAAa,OAAO;AAAA,IACtB;AAAA,EAAA,GACC,CAAC,OAAO,KAAK,CAAC;AAEV,SAAA;AACT;ACda,MAAA,UAAU,CAAI,UAA4B;AACrD,QAAM,MAAMC,MAAAA,OAAU;AAEtBD,QAAAA,UAAU,MAAM;AACd,QAAI,UAAU;AAAA,EAAA,GACb,CAAC,KAAK,CAAC;AAEV,SAAO,IAAI;AACb;;;;"}