@strapi/content-manager 0.0.0-experimental.17b4116f461a49b8ce5386f7c8d79c511d40fb3b → 0.0.0-experimental.2a7cb5ff33df35e8ccde5ef918f9f9a4a3ee9a08

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 (170) hide show
  1. package/dist/_chunks/{CardDragPreview-DSVYodBX.js → CardDragPreview-C0QyJgRA.js} +10 -14
  2. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -0
  3. package/dist/_chunks/{CardDragPreview-ikSG4M46.mjs → CardDragPreview-DOxamsuj.mjs} +7 -9
  4. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -0
  5. package/dist/_chunks/{ComponentConfigurationPage-2iOVVhqV.js → ComponentConfigurationPage-BvHtG7uH.js} +3 -3
  6. package/dist/_chunks/{ComponentConfigurationPage-2iOVVhqV.js.map → ComponentConfigurationPage-BvHtG7uH.js.map} +1 -1
  7. package/dist/_chunks/{ComponentConfigurationPage-DjQBdcKF.mjs → ComponentConfigurationPage-DHNM3YBz.mjs} +3 -3
  8. package/dist/_chunks/{ComponentConfigurationPage-DjQBdcKF.mjs.map → ComponentConfigurationPage-DHNM3YBz.mjs.map} +1 -1
  9. package/dist/_chunks/{ComponentIcon-BBQsYCVn.js → ComponentIcon-BXdiCGQp.js} +8 -2
  10. package/dist/_chunks/ComponentIcon-BXdiCGQp.js.map +1 -0
  11. package/dist/_chunks/{ComponentIcon-BOFnK76n.mjs → ComponentIcon-u4bIXTFY.mjs} +9 -3
  12. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -0
  13. package/dist/_chunks/{EditConfigurationPage-BoBb-DLH.mjs → EditConfigurationPage-Cp6HAEzN.mjs} +3 -3
  14. package/dist/_chunks/{EditConfigurationPage-BoBb-DLH.mjs.map → EditConfigurationPage-Cp6HAEzN.mjs.map} +1 -1
  15. package/dist/_chunks/{EditConfigurationPage-B7dw5_cS.js → EditConfigurationPage-DOmfCEMo.js} +3 -3
  16. package/dist/_chunks/{EditConfigurationPage-B7dw5_cS.js.map → EditConfigurationPage-DOmfCEMo.js.map} +1 -1
  17. package/dist/_chunks/{EditViewPage-KRG56aCq.js → EditViewPage-BqNpC6hO.js} +46 -48
  18. package/dist/_chunks/EditViewPage-BqNpC6hO.js.map +1 -0
  19. package/dist/_chunks/{EditViewPage-aUnqL-63.mjs → EditViewPage-BtkEx339.mjs} +47 -47
  20. package/dist/_chunks/EditViewPage-BtkEx339.mjs.map +1 -0
  21. package/dist/_chunks/{Field-kVFO4ZKB.mjs → Field-R5NbffTB.mjs} +854 -707
  22. package/dist/_chunks/Field-R5NbffTB.mjs.map +1 -0
  23. package/dist/_chunks/{Field-kq1c2TF1.js → Field-lsPFnAmH.js} +906 -760
  24. package/dist/_chunks/Field-lsPFnAmH.js.map +1 -0
  25. package/dist/_chunks/{Form-Jgh5hGTu.mjs → Form-BHmXSfyy.mjs} +39 -37
  26. package/dist/_chunks/Form-BHmXSfyy.mjs.map +1 -0
  27. package/dist/_chunks/{Form-CQ67ZifP.js → Form-CcGboku8.js} +39 -38
  28. package/dist/_chunks/Form-CcGboku8.js.map +1 -0
  29. package/dist/_chunks/{History-BLEnudTX.js → History-Bsud8jwh.js} +138 -51
  30. package/dist/_chunks/History-Bsud8jwh.js.map +1 -0
  31. package/dist/_chunks/{History-DKhZAPcK.mjs → History-ByUPL3T3.mjs} +137 -49
  32. package/dist/_chunks/History-ByUPL3T3.mjs.map +1 -0
  33. package/dist/_chunks/{ListConfigurationPage-nrXcxNYi.mjs → ListConfigurationPage-Bm5HACXf.mjs} +49 -51
  34. package/dist/_chunks/ListConfigurationPage-Bm5HACXf.mjs.map +1 -0
  35. package/dist/_chunks/{ListConfigurationPage-Zso_LUjn.js → ListConfigurationPage-DiT463qx.js} +53 -56
  36. package/dist/_chunks/ListConfigurationPage-DiT463qx.js.map +1 -0
  37. package/dist/_chunks/{ListViewPage-DsaOakWQ.js → ListViewPage-CsrC9L_d.js} +92 -108
  38. package/dist/_chunks/ListViewPage-CsrC9L_d.js.map +1 -0
  39. package/dist/_chunks/{ListViewPage-ChhYmA-L.mjs → ListViewPage-JSyNAAYu.mjs} +87 -103
  40. package/dist/_chunks/ListViewPage-JSyNAAYu.mjs.map +1 -0
  41. package/dist/_chunks/{NoContentTypePage-DPCuS9Y1.js → NoContentTypePage-Bsvng4II.js} +3 -3
  42. package/dist/_chunks/NoContentTypePage-Bsvng4II.js.map +1 -0
  43. package/dist/_chunks/{NoContentTypePage-BrdFcN33.mjs → NoContentTypePage-CsrQUpBE.mjs} +3 -3
  44. package/dist/_chunks/NoContentTypePage-CsrQUpBE.mjs.map +1 -0
  45. package/dist/_chunks/{NoPermissionsPage-DdyOfdKb.js → NoPermissionsPage-CdHNJtEf.js} +2 -2
  46. package/dist/_chunks/{NoPermissionsPage-DdyOfdKb.js.map → NoPermissionsPage-CdHNJtEf.js.map} +1 -1
  47. package/dist/_chunks/{NoPermissionsPage-B9dqrtTy.mjs → NoPermissionsPage-DNmf_pj0.mjs} +2 -2
  48. package/dist/_chunks/{NoPermissionsPage-B9dqrtTy.mjs.map → NoPermissionsPage-DNmf_pj0.mjs.map} +1 -1
  49. package/dist/_chunks/{Relations-CY8Isqdu.js → Relations-CghaPv2D.js} +70 -61
  50. package/dist/_chunks/Relations-CghaPv2D.js.map +1 -0
  51. package/dist/_chunks/{Relations-DjFiYd7-.mjs → Relations-u8-37jK0.mjs} +66 -56
  52. package/dist/_chunks/Relations-u8-37jK0.mjs.map +1 -0
  53. package/dist/_chunks/{en-MBPul9Su.mjs → en-Ux26r5pl.mjs} +7 -1
  54. package/dist/_chunks/{en-MBPul9Su.mjs.map → en-Ux26r5pl.mjs.map} +1 -1
  55. package/dist/_chunks/{en-C-V1_90f.js → en-fbKQxLGn.js} +7 -1
  56. package/dist/_chunks/{en-C-V1_90f.js.map → en-fbKQxLGn.js.map} +1 -1
  57. package/dist/_chunks/{index-DNa1J4HE.js → index-BOZx6IMg.js} +1481 -864
  58. package/dist/_chunks/index-BOZx6IMg.js.map +1 -0
  59. package/dist/_chunks/{index-CAc9yTnx.mjs → index-CaE6NG4a.mjs} +1450 -832
  60. package/dist/_chunks/index-CaE6NG4a.mjs.map +1 -0
  61. package/dist/_chunks/{layout-CXsHbc3E.mjs → layout-Bx7svTbY.mjs} +28 -23
  62. package/dist/_chunks/layout-Bx7svTbY.mjs.map +1 -0
  63. package/dist/_chunks/{layout-BqtLA6Lb.js → layout-Ciz224q5.js} +29 -26
  64. package/dist/_chunks/layout-Ciz224q5.js.map +1 -0
  65. package/dist/_chunks/{relations-BHY_KDJ_.js → relations-CP8sB2YZ.js} +2 -2
  66. package/dist/_chunks/{relations-BHY_KDJ_.js.map → relations-CP8sB2YZ.js.map} +1 -1
  67. package/dist/_chunks/{relations-mMFEcZRq.mjs → relations-Cxc1cEv3.mjs} +2 -2
  68. package/dist/_chunks/{relations-mMFEcZRq.mjs.map → relations-Cxc1cEv3.mjs.map} +1 -1
  69. package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs.map +1 -1
  70. package/dist/_chunks/useDragAndDrop-J0TUUbR6.js.map +1 -1
  71. package/dist/_chunks/usePrev-B9w_-eYc.js +15 -0
  72. package/dist/_chunks/usePrev-B9w_-eYc.js.map +1 -0
  73. package/dist/_chunks/usePrev-DH6iah0A.mjs +16 -0
  74. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +1 -0
  75. package/dist/admin/index.js +2 -1
  76. package/dist/admin/index.js.map +1 -1
  77. package/dist/admin/index.mjs +5 -4
  78. package/dist/admin/src/components/ComponentIcon.d.ts +6 -3
  79. package/dist/admin/src/content-manager.d.ts +3 -3
  80. package/dist/admin/src/exports.d.ts +1 -0
  81. package/dist/admin/src/history/components/VersionInputRenderer.d.ts +1 -1
  82. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  83. package/dist/admin/src/hooks/useDocument.d.ts +5 -8
  84. package/dist/admin/src/hooks/useDocumentActions.d.ts +24 -3
  85. package/dist/admin/src/hooks/useDocumentLayout.d.ts +2 -2
  86. package/dist/admin/src/hooks/useDragAndDrop.d.ts +4 -4
  87. package/dist/admin/src/hooks/useKeyboardDragAndDrop.d.ts +1 -1
  88. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +10 -4
  89. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksInput.d.ts +3 -3
  90. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +4 -0
  91. package/dist/admin/src/pages/EditView/components/FormInputs/Component/Input.d.ts +2 -2
  92. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.d.ts +3 -5
  93. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +1 -1
  94. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +10 -18
  95. package/dist/admin/src/pages/EditView/components/FormInputs/UID.d.ts +2 -2
  96. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +3 -49
  97. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.d.ts +2 -2
  98. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +59 -52
  99. package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +2 -10
  100. package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
  101. package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
  102. package/dist/admin/src/pages/ListView/components/BulkActions/PublishAction.d.ts +9 -26
  103. package/dist/admin/src/services/api.d.ts +2 -3
  104. package/dist/admin/src/services/components.d.ts +2 -2
  105. package/dist/admin/src/services/contentTypes.d.ts +5 -5
  106. package/dist/admin/src/services/documents.d.ts +29 -17
  107. package/dist/admin/src/services/init.d.ts +2 -2
  108. package/dist/admin/src/services/relations.d.ts +3 -3
  109. package/dist/admin/src/services/uid.d.ts +3 -3
  110. package/dist/admin/src/utils/api.d.ts +4 -18
  111. package/dist/admin/src/utils/validation.d.ts +1 -6
  112. package/dist/server/index.js +293 -203
  113. package/dist/server/index.js.map +1 -1
  114. package/dist/server/index.mjs +295 -205
  115. package/dist/server/index.mjs.map +1 -1
  116. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  117. package/dist/server/src/controllers/single-types.d.ts.map +1 -1
  118. package/dist/server/src/controllers/utils/metadata.d.ts +8 -0
  119. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -0
  120. package/dist/server/src/controllers/validation/dimensions.d.ts +9 -0
  121. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -0
  122. package/dist/server/src/controllers/validation/index.d.ts +1 -1
  123. package/dist/server/src/history/services/history.d.ts.map +1 -1
  124. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  125. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  126. package/dist/server/src/index.d.ts +17 -33
  127. package/dist/server/src/index.d.ts.map +1 -1
  128. package/dist/server/src/services/document-manager.d.ts +11 -6
  129. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  130. package/dist/server/src/services/document-metadata.d.ts +8 -29
  131. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  132. package/dist/server/src/services/index.d.ts +17 -33
  133. package/dist/server/src/services/index.d.ts.map +1 -1
  134. package/dist/server/src/services/utils/populate.d.ts +8 -1
  135. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  136. package/dist/shared/contracts/collection-types.d.ts +14 -6
  137. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  138. package/dist/shared/contracts/relations.d.ts +2 -2
  139. package/dist/shared/contracts/relations.d.ts.map +1 -1
  140. package/package.json +13 -14
  141. package/dist/_chunks/CardDragPreview-DSVYodBX.js.map +0 -1
  142. package/dist/_chunks/CardDragPreview-ikSG4M46.mjs.map +0 -1
  143. package/dist/_chunks/ComponentIcon-BBQsYCVn.js.map +0 -1
  144. package/dist/_chunks/ComponentIcon-BOFnK76n.mjs.map +0 -1
  145. package/dist/_chunks/EditViewPage-KRG56aCq.js.map +0 -1
  146. package/dist/_chunks/EditViewPage-aUnqL-63.mjs.map +0 -1
  147. package/dist/_chunks/Field-kVFO4ZKB.mjs.map +0 -1
  148. package/dist/_chunks/Field-kq1c2TF1.js.map +0 -1
  149. package/dist/_chunks/Form-CQ67ZifP.js.map +0 -1
  150. package/dist/_chunks/Form-Jgh5hGTu.mjs.map +0 -1
  151. package/dist/_chunks/History-BLEnudTX.js.map +0 -1
  152. package/dist/_chunks/History-DKhZAPcK.mjs.map +0 -1
  153. package/dist/_chunks/ListConfigurationPage-Zso_LUjn.js.map +0 -1
  154. package/dist/_chunks/ListConfigurationPage-nrXcxNYi.mjs.map +0 -1
  155. package/dist/_chunks/ListViewPage-ChhYmA-L.mjs.map +0 -1
  156. package/dist/_chunks/ListViewPage-DsaOakWQ.js.map +0 -1
  157. package/dist/_chunks/NoContentTypePage-BrdFcN33.mjs.map +0 -1
  158. package/dist/_chunks/NoContentTypePage-DPCuS9Y1.js.map +0 -1
  159. package/dist/_chunks/Relations-CY8Isqdu.js.map +0 -1
  160. package/dist/_chunks/Relations-DjFiYd7-.mjs.map +0 -1
  161. package/dist/_chunks/index-CAc9yTnx.mjs.map +0 -1
  162. package/dist/_chunks/index-DNa1J4HE.js.map +0 -1
  163. package/dist/_chunks/layout-BqtLA6Lb.js.map +0 -1
  164. package/dist/_chunks/layout-CXsHbc3E.mjs.map +0 -1
  165. package/dist/_chunks/urls-CbOsUOoW.mjs +0 -7
  166. package/dist/_chunks/urls-CbOsUOoW.mjs.map +0 -1
  167. package/dist/_chunks/urls-DzZya_gm.js +0 -6
  168. package/dist/_chunks/urls-DzZya_gm.js.map +0 -1
  169. package/dist/server/src/controllers/utils/dimensions.d.ts +0 -5
  170. package/dist/server/src/controllers/utils/dimensions.d.ts.map +0 -1
@@ -1,23 +1,23 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import { useState, useEffect, useCallback } from "react";
3
+ import { useState, useEffect, useCallback, memo } from "react";
4
4
  import { useStrapiApp, createContext, useField, useNotification, useForm, useAPIErrorHandler, useQueryParams, useFocusInputField, InputRenderer as InputRenderer$1 } from "@strapi/admin/strapi-admin";
5
- import { Typography, Flex, Box, BaseLink, Button, useComposedRefs, Popover, Field, FieldLabel, FieldInput, Tooltip, SingleSelect, SingleSelectOption, IconButton, Portal, FocusTrap, InputWrapper, Divider, VisuallyHidden, FieldHint, FieldError, Grid as Grid$1, GridItem, TextButton, KeyboardNavigable, Accordion, AccordionToggle, AccordionContent as AccordionContent$1, BaseButton, TextInput, FieldAction, IconButtonGroup, Menu, MenuItem } from "@strapi/design-system";
5
+ import { Box, SingleSelect, SingleSelectOption, Typography, Flex, BaseLink, Button, Popover, Field, Tooltip, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton, BaseButton, TextInput, IconButtonGroup, Menu, MenuItem } from "@strapi/design-system";
6
6
  import pipe$1 from "lodash/fp/pipe";
7
7
  import { useIntl } from "react-intl";
8
- import { l as DOCUMENT_META_FIELDS, g as getTranslation, b as useDoc, d as contentManagerApi, c as buildValidParams, e as useDocumentRBAC, m as useDocLayout } from "./index-CAc9yTnx.mjs";
8
+ import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, d as buildValidParams, f as useDocumentRBAC, n as useDocLayout } from "./index-CaE6NG4a.mjs";
9
9
  import { generateNKeysBetween } from "fractional-indexing";
10
- import { u as useComponent, C as ComponentProvider, R as RelationsField } from "./Relations-DjFiYd7-.mjs";
10
+ import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-u8-37jK0.mjs";
11
11
  import { Code, HeadingOne, HeadingTwo, HeadingThree, HeadingFour, HeadingFive, HeadingSix, Image as Image$1, NumberList, BulletList, Paragraph, Quotes, Link as Link$1, Drag, Collapse, Bold, Italic, Underline, StrikeThrough, Expand, PlusCircle, Plus, Trash, EyeStriked, CheckCircle, WarningCircle, Loader, ArrowClockwise, More } from "@strapi/icons";
12
- import styled, { css, keyframes } from "styled-components";
13
- import { C as ComponentIcon } from "./ComponentIcon-BOFnK76n.mjs";
12
+ import { styled, css, keyframes } from "styled-components";
13
+ import { C as ComponentIcon, a as COMPONENT_ICONS } from "./ComponentIcon-u4bIXTFY.mjs";
14
14
  import { getEmptyImage } from "react-dnd-html5-backend";
15
15
  import { a as DIRECTIONS, u as useDragAndDrop, I as ItemTypes } from "./useDragAndDrop-DdHgKsqq.mjs";
16
16
  import { g as getIn } from "./objects-mKMAmfec.mjs";
17
17
  import { Editor as Editor$1, Transforms, Node, Element, Range, Path, Point, createEditor } from "slate";
18
18
  import { withHistory } from "slate-history";
19
19
  import { useFocused, useSelected, ReactEditor, Editable, useSlate, Slate, withReact } from "slate-react";
20
- import { p as prefixFileUrlWithBackendUrl } from "./urls-CbOsUOoW.mjs";
20
+ import { p as prefixFileUrlWithBackendUrl, u as usePrev } from "./usePrev-DH6iah0A.mjs";
21
21
  import * as Toolbar from "@radix-ui/react-toolbar";
22
22
  import { useLocation } from "react-router-dom";
23
23
  import CodeMirror from "codemirror5";
@@ -160,6 +160,220 @@ const useLazyComponents = (componentUids = []) => {
160
160
  }, []);
161
161
  return { isLazyLoading: loading, lazyComponentStore, cleanup };
162
162
  };
163
+ const codeLanguages = [
164
+ {
165
+ value: "asm",
166
+ label: "Assembly"
167
+ },
168
+ {
169
+ value: "bash",
170
+ label: "Bash"
171
+ },
172
+ {
173
+ value: "c",
174
+ label: "C"
175
+ },
176
+ {
177
+ value: "clojure",
178
+ label: "Clojure"
179
+ },
180
+ {
181
+ value: "cobol",
182
+ label: "COBOL"
183
+ },
184
+ {
185
+ value: "cpp",
186
+ label: "C++"
187
+ },
188
+ {
189
+ value: "csharp",
190
+ label: "C#"
191
+ },
192
+ {
193
+ value: "css",
194
+ label: "CSS"
195
+ },
196
+ {
197
+ value: "dart",
198
+ label: "Dart"
199
+ },
200
+ {
201
+ value: "dockerfile",
202
+ label: "Dockerfile"
203
+ },
204
+ {
205
+ value: "elixir",
206
+ label: "Elixir"
207
+ },
208
+ {
209
+ value: "erlang",
210
+ label: "Erlang"
211
+ },
212
+ {
213
+ value: "fortran",
214
+ label: "Fortran"
215
+ },
216
+ {
217
+ value: "fsharp",
218
+ label: "F#"
219
+ },
220
+ {
221
+ value: "go",
222
+ label: "Go"
223
+ },
224
+ {
225
+ value: "graphql",
226
+ label: "GraphQL"
227
+ },
228
+ {
229
+ value: "groovy",
230
+ label: "Groovy"
231
+ },
232
+ {
233
+ value: "haskell",
234
+ label: "Haskell"
235
+ },
236
+ {
237
+ value: "haxe",
238
+ label: "Haxe"
239
+ },
240
+ {
241
+ value: "html",
242
+ label: "HTML"
243
+ },
244
+ {
245
+ value: "ini",
246
+ label: "INI"
247
+ },
248
+ {
249
+ value: "java",
250
+ label: "Java"
251
+ },
252
+ {
253
+ value: "javascript",
254
+ label: "JavaScript"
255
+ },
256
+ {
257
+ value: "jsx",
258
+ label: "JavaScript (React)"
259
+ },
260
+ {
261
+ value: "json",
262
+ label: "JSON"
263
+ },
264
+ {
265
+ value: "julia",
266
+ label: "Julia"
267
+ },
268
+ {
269
+ value: "kotlin",
270
+ label: "Kotlin"
271
+ },
272
+ {
273
+ value: "latex",
274
+ label: "LaTeX"
275
+ },
276
+ {
277
+ value: "lua",
278
+ label: "Lua"
279
+ },
280
+ {
281
+ value: "markdown",
282
+ label: "Markdown"
283
+ },
284
+ {
285
+ value: "matlab",
286
+ label: "MATLAB"
287
+ },
288
+ {
289
+ value: "makefile",
290
+ label: "Makefile"
291
+ },
292
+ {
293
+ value: "objectivec",
294
+ label: "Objective-C"
295
+ },
296
+ {
297
+ value: "perl",
298
+ label: "Perl"
299
+ },
300
+ {
301
+ value: "php",
302
+ label: "PHP"
303
+ },
304
+ {
305
+ value: "plaintext",
306
+ label: "Plain text"
307
+ },
308
+ {
309
+ value: "powershell",
310
+ label: "PowerShell"
311
+ },
312
+ {
313
+ value: "python",
314
+ label: "Python"
315
+ },
316
+ {
317
+ value: "r",
318
+ label: "R"
319
+ },
320
+ {
321
+ value: "ruby",
322
+ label: "Ruby"
323
+ },
324
+ {
325
+ value: "rust",
326
+ label: "Rust"
327
+ },
328
+ {
329
+ value: "sas",
330
+ label: "SAS"
331
+ },
332
+ {
333
+ value: "scala",
334
+ label: "Scala"
335
+ },
336
+ {
337
+ value: "scheme",
338
+ label: "Scheme"
339
+ },
340
+ {
341
+ value: "shell",
342
+ label: "Shell"
343
+ },
344
+ {
345
+ value: "sql",
346
+ label: "SQL"
347
+ },
348
+ {
349
+ value: "stata",
350
+ label: "Stata"
351
+ },
352
+ {
353
+ value: "swift",
354
+ label: "Swift"
355
+ },
356
+ {
357
+ value: "typescript",
358
+ label: "TypeScript"
359
+ },
360
+ {
361
+ value: "tsx",
362
+ label: "TypeScript (React)"
363
+ },
364
+ {
365
+ value: "vbnet",
366
+ label: "VB.NET"
367
+ },
368
+ {
369
+ value: "xml",
370
+ label: "XML"
371
+ },
372
+ {
373
+ value: "yaml",
374
+ label: "YAML"
375
+ }
376
+ ];
163
377
  const baseHandleConvert = (editor, attributesToSet) => {
164
378
  const [_, lastNodePath] = Editor$1.last(editor, []);
165
379
  Transforms.unwrapNodes(editor, {
@@ -223,13 +437,14 @@ const pressEnterTwiceToExit = (editor) => {
223
437
  });
224
438
  }
225
439
  };
226
- const CodeBlock = styled.pre.attrs({ role: "code" })`
440
+ const CodeBlock = styled.pre`
227
441
  border-radius: ${({ theme }) => theme.borderRadius};
228
442
  background-color: ${({ theme }) => theme.colors.neutral100};
229
443
  max-width: 100%;
230
444
  overflow: auto;
231
445
  padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
232
446
  flex-shrink: 1;
447
+
233
448
  & > code {
234
449
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
235
450
  monospace;
@@ -238,9 +453,61 @@ const CodeBlock = styled.pre.attrs({ role: "code" })`
238
453
  max-width: 100%;
239
454
  }
240
455
  `;
456
+ const CodeEditor = (props) => {
457
+ const { editor } = useBlocksEditorContext("ImageDialog");
458
+ const editorIsFocused = useFocused();
459
+ const imageIsSelected = useSelected();
460
+ const { formatMessage } = useIntl();
461
+ const [isSelectOpen, setIsSelectOpen] = React.useState(false);
462
+ const shouldDisplayLanguageSelect = editorIsFocused && imageIsSelected || isSelectOpen;
463
+ return /* @__PURE__ */ jsxs(Box, { position: "relative", width: "100%", children: [
464
+ /* @__PURE__ */ jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsx("code", { children: props.children }) }),
465
+ shouldDisplayLanguageSelect && /* @__PURE__ */ jsx(
466
+ Box,
467
+ {
468
+ position: "absolute",
469
+ background: "neutral0",
470
+ borderColor: "neutral150",
471
+ borderStyle: "solid",
472
+ borderWidth: "0.5px",
473
+ shadow: "tableShadow",
474
+ top: "100%",
475
+ marginTop: 1,
476
+ right: 0,
477
+ padding: 1,
478
+ hasRadius: true,
479
+ children: /* @__PURE__ */ jsx(
480
+ SingleSelect,
481
+ {
482
+ onChange: (open) => {
483
+ Transforms.setNodes(
484
+ editor,
485
+ { language: open.toString() },
486
+ { match: (node) => !Editor$1.isEditor(node) && node.type === "code" }
487
+ );
488
+ },
489
+ value: props.element.type === "code" && props.element.language || "plaintext",
490
+ onOpenChange: (open) => {
491
+ setIsSelectOpen(open);
492
+ if (!open) {
493
+ ReactEditor.focus(editor);
494
+ }
495
+ },
496
+ onCloseAutoFocus: (e) => e.preventDefault(),
497
+ "aria-label": formatMessage({
498
+ id: "components.Blocks.blocks.code.languageLabel",
499
+ defaultMessage: "Select a language"
500
+ }),
501
+ children: codeLanguages.map(({ value, label }) => /* @__PURE__ */ jsx(SingleSelectOption, { value, children: label }, value))
502
+ }
503
+ )
504
+ }
505
+ )
506
+ ] });
507
+ };
241
508
  const codeBlocks = {
242
509
  code: {
243
- renderElement: (props) => /* @__PURE__ */ jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsx("code", { children: props.children }) }),
510
+ renderElement: (props) => /* @__PURE__ */ jsx(CodeEditor, { ...props }),
244
511
  icon: Code,
245
512
  label: {
246
513
  id: "components.Blocks.blocks.code",
@@ -249,7 +516,7 @@ const codeBlocks = {
249
516
  matchNode: (node) => node.type === "code",
250
517
  isInBlocksSelector: true,
251
518
  handleConvert(editor) {
252
- baseHandleConvert(editor, { type: "code" });
519
+ baseHandleConvert(editor, { type: "code", language: "plaintext" });
253
520
  },
254
521
  handleEnterKey(editor) {
255
522
  pressEnterTwiceToExit(editor);
@@ -258,27 +525,27 @@ const codeBlocks = {
258
525
  dragHandleTopMargin: "10px"
259
526
  }
260
527
  };
261
- const H1 = styled(Typography).attrs({ as: "h1" })`
528
+ const H1 = styled(Typography).attrs({ tag: "h1" })`
262
529
  font-size: 4.2rem;
263
530
  line-height: ${({ theme }) => theme.lineHeights[1]};
264
531
  `;
265
- const H2 = styled(Typography).attrs({ as: "h2" })`
532
+ const H2 = styled(Typography).attrs({ tag: "h2" })`
266
533
  font-size: 3.5rem;
267
534
  line-height: ${({ theme }) => theme.lineHeights[1]};
268
535
  `;
269
- const H3 = styled(Typography).attrs({ as: "h3" })`
536
+ const H3 = styled(Typography).attrs({ tag: "h3" })`
270
537
  font-size: 2.9rem;
271
538
  line-height: ${({ theme }) => theme.lineHeights[1]};
272
539
  `;
273
- const H4 = styled(Typography).attrs({ as: "h4" })`
540
+ const H4 = styled(Typography).attrs({ tag: "h4" })`
274
541
  font-size: 2.4rem;
275
542
  line-height: ${({ theme }) => theme.lineHeights[1]};
276
543
  `;
277
- const H5 = styled(Typography).attrs({ as: "h5" })`
544
+ const H5 = styled(Typography).attrs({ tag: "h5" })`
278
545
  font-size: 2rem;
279
546
  line-height: ${({ theme }) => theme.lineHeights[1]};
280
547
  `;
281
- const H6 = styled(Typography).attrs({ as: "h6" })`
548
+ const H6 = styled(Typography).attrs({ tag: "h6" })`
282
549
  font-size: 1.6rem;
283
550
  line-height: ${({ theme }) => theme.lineHeights[1]};
284
551
  `;
@@ -367,7 +634,7 @@ const headingBlocks = {
367
634
  const ImageWrapper = styled(Flex)`
368
635
  transition-property: box-shadow;
369
636
  transition-duration: 0.2s;
370
- ${(props) => props.isFocused && css`
637
+ ${(props) => props.$isFocused && css`
371
638
  box-shadow: ${props.theme.colors.primary600} 0px 0px 0px 3px;
372
639
  `}
373
640
 
@@ -419,7 +686,7 @@ const Image = ({ attributes, children, element }) => {
419
686
  background: "neutral100",
420
687
  contentEditable: false,
421
688
  justifyContent: "center",
422
- isFocused: editorIsFocused && imageIsSelected,
689
+ $isFocused: editorIsFocused && imageIsSelected,
423
690
  hasRadius: true,
424
691
  children: /* @__PURE__ */ jsx("img", { src: url, alt: alternativeText, width, height })
425
692
  }
@@ -579,7 +846,7 @@ const StyledBaseLink = styled(BaseLink)`
579
846
  text-decoration: none;
580
847
  `;
581
848
  const RemoveButton = styled(Button)`
582
- visibility: ${(props) => props.visible ? "visible" : "hidden"};
849
+ visibility: ${(props) => props.$visible ? "visible" : "hidden"};
583
850
  `;
584
851
  const LinkContent = React.forwardRef(
585
852
  ({ link, children, attributes }, forwardedRef) => {
@@ -589,17 +856,23 @@ const LinkContent = React.forwardRef(
589
856
  const [popoverOpen, setPopoverOpen] = React.useState(
590
857
  editor.lastInsertedLinkPath ? Path.equals(path, editor.lastInsertedLinkPath) : false
591
858
  );
592
- const linkRef = React.useRef(null);
593
859
  const elementText = link.children.map((child) => child.text).join("");
594
860
  const [linkText, setLinkText] = React.useState(elementText);
595
861
  const [linkUrl, setLinkUrl] = React.useState(link.url);
596
862
  const linkInputRef = React.useRef(null);
597
863
  const [showRemoveButton, setShowRemoveButton] = React.useState(false);
598
864
  const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);
599
- const handleOpenEditPopover = (e) => {
600
- e.preventDefault();
601
- setPopoverOpen(true);
602
- setShowRemoveButton(true);
865
+ const handleOpenChange = (isOpen) => {
866
+ if (isOpen) {
867
+ setPopoverOpen(isOpen);
868
+ setShowRemoveButton(isOpen);
869
+ } else {
870
+ setPopoverOpen(isOpen);
871
+ if (link.url === "") {
872
+ removeLink(editor);
873
+ }
874
+ ReactEditor.focus(editor);
875
+ }
603
876
  };
604
877
  const onLinkChange = (e) => {
605
878
  setIsSaveDisabled(false);
@@ -622,39 +895,21 @@ const LinkContent = React.forwardRef(
622
895
  setPopoverOpen(false);
623
896
  editor.lastInsertedLinkPath = null;
624
897
  };
625
- const handleDismiss = () => {
626
- setPopoverOpen(false);
627
- if (link.url === "") {
628
- removeLink(editor);
629
- }
630
- ReactEditor.focus(editor);
631
- };
632
- const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
633
- const composedRefs = useComposedRefs(linkRef, forwardedRef);
634
898
  React.useEffect(() => {
635
899
  if (popoverOpen)
636
900
  linkInputRef.current?.focus();
637
901
  }, [popoverOpen]);
638
- return /* @__PURE__ */ jsxs(Fragment, { children: [
639
- /* @__PURE__ */ jsx(
640
- StyledBaseLink,
641
- {
642
- ...attributes,
643
- ref: composedRefs,
644
- href: link.url,
645
- onClick: handleOpenEditPopover,
646
- color: "primary600",
647
- children
648
- }
649
- ),
650
- popoverOpen && /* @__PURE__ */ jsx(Popover, { source: linkRef, onDismiss: handleDismiss, padding: 4, contentEditable: false, children: /* @__PURE__ */ jsxs(Flex, { as: "form", onSubmit: handleSave, direction: "column", gap: 4, children: [
651
- /* @__PURE__ */ jsx(Field, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
652
- /* @__PURE__ */ jsx(FieldLabel, { children: formatMessage({
902
+ const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
903
+ return /* @__PURE__ */ jsxs(Popover.Root, { onOpenChange: handleOpenChange, open: popoverOpen, children: [
904
+ /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(StyledBaseLink, { ...attributes, ref: forwardedRef, href: link.url, color: "primary600", children }) }),
905
+ /* @__PURE__ */ jsx(Popover.Content, { children: /* @__PURE__ */ jsxs(Flex, { padding: 4, tag: "form", onSubmit: handleSave, direction: "column", gap: 4, children: [
906
+ /* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
907
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
653
908
  id: "components.Blocks.popover.text",
654
909
  defaultMessage: "Text"
655
910
  }) }),
656
911
  /* @__PURE__ */ jsx(
657
- FieldInput,
912
+ Field.Input,
658
913
  {
659
914
  name: "text",
660
915
  placeholder: formatMessage({
@@ -668,13 +923,13 @@ const LinkContent = React.forwardRef(
668
923
  }
669
924
  )
670
925
  ] }) }),
671
- /* @__PURE__ */ jsx(Field, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
672
- /* @__PURE__ */ jsx(FieldLabel, { children: formatMessage({
926
+ /* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
927
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
673
928
  id: "components.Blocks.popover.link",
674
929
  defaultMessage: "Link"
675
930
  }) }),
676
931
  /* @__PURE__ */ jsx(
677
- FieldInput,
932
+ Field.Input,
678
933
  {
679
934
  ref: linkInputRef,
680
935
  name: "url",
@@ -693,7 +948,7 @@ const LinkContent = React.forwardRef(
693
948
  {
694
949
  variant: "danger-light",
695
950
  onClick: () => removeLink(editor),
696
- visible: showRemoveButton,
951
+ $visible: showRemoveButton,
697
952
  children: formatMessage({
698
953
  id: "components.Blocks.popover.remove",
699
954
  defaultMessage: "Remove"
@@ -701,7 +956,7 @@ const LinkContent = React.forwardRef(
701
956
  }
702
957
  ),
703
958
  /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
704
- /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleDismiss, children: formatMessage({
959
+ /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: () => handleOpenChange(false), children: formatMessage({
705
960
  id: "components.Blocks.popover.cancel",
706
961
  defaultMessage: "Cancel"
707
962
  }) }),
@@ -748,11 +1003,11 @@ const listStyle = css`
748
1003
  }
749
1004
  `;
750
1005
  const Orderedlist = styled.ol`
751
- list-style-type: ${(props) => props.listStyleType};
1006
+ list-style-type: ${(props) => props.$listStyleType};
752
1007
  ${listStyle}
753
1008
  `;
754
1009
  const Unorderedlist = styled.ul`
755
- list-style-type: ${(props) => props.listStyleType};
1010
+ list-style-type: ${(props) => props.$listStyleType};
756
1011
  ${listStyle}
757
1012
  `;
758
1013
  const orderedStyles = ["decimal", "lower-alpha", "upper-roman"];
@@ -765,9 +1020,9 @@ const List = ({ attributes, children, element }) => {
765
1020
  const nextIndex = (element.indentLevel || 0) % listStyles.length;
766
1021
  const listStyleType = listStyles[nextIndex];
767
1022
  if (element.format === "ordered") {
768
- return /* @__PURE__ */ jsx(Orderedlist, { listStyleType, ...attributes, children });
1023
+ return /* @__PURE__ */ jsx(Orderedlist, { $listStyleType: listStyleType, ...attributes, children });
769
1024
  }
770
- return /* @__PURE__ */ jsx(Unorderedlist, { listStyleType, ...attributes, children });
1025
+ return /* @__PURE__ */ jsx(Unorderedlist, { $listStyleType: listStyleType, ...attributes, children });
771
1026
  };
772
1027
  const replaceListWithEmptyBlock = (editor, currentListPath) => {
773
1028
  Transforms.removeNodes(editor, { at: currentListPath });
@@ -964,7 +1219,7 @@ const listBlocks = {
964
1219
  snippets: ["-", "*", "+"]
965
1220
  },
966
1221
  "list-item": {
967
- renderElement: (props) => /* @__PURE__ */ jsx(Typography, { as: "li", ...props.attributes, children: props.children }),
1222
+ renderElement: (props) => /* @__PURE__ */ jsx(Typography, { tag: "li", ...props.attributes, children: props.children }),
968
1223
  // No handleConvert, list items are created when converting to the parent list
969
1224
  matchNode: (node) => node.type === "list-item",
970
1225
  isInBlocksSelector: false,
@@ -973,7 +1228,7 @@ const listBlocks = {
973
1228
  };
974
1229
  const paragraphBlocks = {
975
1230
  paragraph: {
976
- renderElement: (props) => /* @__PURE__ */ jsx(Typography, { as: "p", variant: "omega", ...props.attributes, children: props.children }),
1231
+ renderElement: (props) => /* @__PURE__ */ jsx(Typography, { tag: "p", variant: "omega", ...props.attributes, children: props.children }),
977
1232
  icon: Paragraph,
978
1233
  label: {
979
1234
  id: "components.Blocks.blocks.text",
@@ -1139,7 +1394,7 @@ const ToolbarButton = ({
1139
1394
  children: /* @__PURE__ */ jsx(
1140
1395
  FlexButton,
1141
1396
  {
1142
- as: "button",
1397
+ tag: "button",
1143
1398
  background: isActive ? "primary100" : "",
1144
1399
  alignItems: "center",
1145
1400
  justifyContent: "center",
@@ -1460,7 +1715,7 @@ const DragItem = styled(Flex)`
1460
1715
 
1461
1716
  // Set the visibility of drag button
1462
1717
  [role='button'] {
1463
- visibility: ${(props) => props.dragVisibility};
1718
+ visibility: ${(props) => props.$dragVisibility};
1464
1719
  opacity: inherit;
1465
1720
  }
1466
1721
  &[aria-disabled='true'] {
@@ -1477,7 +1732,7 @@ const DragIconButton = styled(IconButton)`
1477
1732
  visibility: hidden;
1478
1733
  cursor: grab;
1479
1734
  opacity: inherit;
1480
- margin-top: ${(props) => props.dragHandleTopMargin ?? 0};
1735
+ margin-top: ${(props) => props.$dragHandleTopMargin ?? 0};
1481
1736
 
1482
1737
  &:hover {
1483
1738
  background: ${({ theme }) => theme.colors.neutral200};
@@ -1552,7 +1807,7 @@ const DragAndDropElement = ({
1552
1807
  React.useEffect(() => {
1553
1808
  setDragVisibility("hidden");
1554
1809
  }, [editor.selection]);
1555
- return /* @__PURE__ */ jsxs(Wrapper$1, { ref: (ref) => composedBoxRefs(ref), isOverDropTarget, children: [
1810
+ return /* @__PURE__ */ jsxs(Wrapper$1, { ref: composedBoxRefs, isOverDropTarget, children: [
1556
1811
  isOverDropTarget && /* @__PURE__ */ jsx(
1557
1812
  DropPlaceholder,
1558
1813
  {
@@ -1590,15 +1845,16 @@ const DragAndDropElement = ({
1590
1845
  onSelect: () => setDragVisibility("visible"),
1591
1846
  onMouseLeave: () => setDragVisibility("hidden"),
1592
1847
  "aria-disabled": disabled,
1593
- dragVisibility,
1848
+ $dragVisibility: dragVisibility,
1594
1849
  children: [
1595
1850
  /* @__PURE__ */ jsx(
1596
1851
  DragIconButton,
1597
1852
  {
1598
- forwardedAs: "div",
1853
+ tag: "div",
1599
1854
  role: "button",
1600
1855
  tabIndex: 0,
1601
- "aria-label": formatMessage({
1856
+ withTooltip: false,
1857
+ label: formatMessage({
1602
1858
  id: getTranslation("components.DragHandle-label"),
1603
1859
  defaultMessage: "Drag"
1604
1860
  }),
@@ -1606,7 +1862,7 @@ const DragAndDropElement = ({
1606
1862
  "aria-disabled": disabled,
1607
1863
  disabled,
1608
1864
  draggable: true,
1609
- dragHandleTopMargin,
1865
+ $dragHandleTopMargin: dragHandleTopMargin,
1610
1866
  children: /* @__PURE__ */ jsx(Drag, { color: "neutral600" })
1611
1867
  }
1612
1868
  ),
@@ -1618,17 +1874,18 @@ const DragAndDropElement = ({
1618
1874
  };
1619
1875
  const CloneDragItem = ({ children, dragHandleTopMargin }) => {
1620
1876
  const { formatMessage } = useIntl();
1621
- return /* @__PURE__ */ jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", dragVisibility: "visible", children: [
1877
+ return /* @__PURE__ */ jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", $dragVisibility: "visible", children: [
1622
1878
  /* @__PURE__ */ jsx(
1623
1879
  DragIconButton,
1624
1880
  {
1625
- forwardedAs: "div",
1881
+ tag: "div",
1626
1882
  role: "button",
1627
- "aria-label": formatMessage({
1883
+ withTooltip: false,
1884
+ label: formatMessage({
1628
1885
  id: getTranslation("components.DragHandle-label"),
1629
1886
  defaultMessage: "Drag"
1630
1887
  }),
1631
- dragHandleTopMargin,
1888
+ $dragHandleTopMargin: dragHandleTopMargin,
1632
1889
  children: /* @__PURE__ */ jsx(Drag, { color: "neutral600" })
1633
1890
  }
1634
1891
  ),
@@ -1950,8 +2207,8 @@ const EditorLayout$1 = ({
1950
2207
  direction: "column",
1951
2208
  alignItems: "flex-start",
1952
2209
  height: "512px",
1953
- disabled,
1954
- hasError: Boolean(error),
2210
+ $disabled: disabled,
2211
+ $hasError: Boolean(error),
1955
2212
  style: { overflow: "hidden" },
1956
2213
  "aria-describedby": ariaDescriptionId,
1957
2214
  position: "relative",
@@ -1959,6 +2216,29 @@ const EditorLayout$1 = ({
1959
2216
  }
1960
2217
  );
1961
2218
  };
2219
+ const InputWrapper = styled(Flex)`
2220
+ border: 1px solid
2221
+ ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
2222
+ border-radius: ${({ theme }) => theme.borderRadius};
2223
+ background: ${({ theme }) => theme.colors.neutral0};
2224
+
2225
+ ${({ theme, $hasError = false }) => css`
2226
+ outline: none;
2227
+ box-shadow: 0;
2228
+ transition-property: border-color, box-shadow, fill;
2229
+ transition-duration: 0.2s;
2230
+
2231
+ &:focus-within {
2232
+ border: 1px solid ${$hasError ? theme.colors.danger600 : theme.colors.primary600};
2233
+ box-shadow: ${$hasError ? theme.colors.danger600 : theme.colors.primary600} 0px 0px 0px 2px;
2234
+ }
2235
+ `}
2236
+
2237
+ ${({ theme, $disabled }) => $disabled ? css`
2238
+ color: ${theme.colors.neutral600};
2239
+ background: ${theme.colors.neutral150};
2240
+ ` : void 0}
2241
+ `;
1962
2242
  const stylesToInherit = css`
1963
2243
  font-size: inherit;
1964
2244
  color: inherit;
@@ -1971,10 +2251,14 @@ const ItalicText = styled(Typography)`
1971
2251
  font-style: italic;
1972
2252
  ${stylesToInherit}
1973
2253
  `;
1974
- const UnderlineText = styled(Typography).attrs({ textDecoration: "underline" })`
2254
+ const UnderlineText = styled(Typography).attrs({
2255
+ textDecoration: "underline"
2256
+ })`
1975
2257
  ${stylesToInherit}
1976
2258
  `;
1977
- const StrikeThroughText = styled(Typography).attrs({ textDecoration: "line-through" })`
2259
+ const StrikeThroughText = styled(Typography).attrs({
2260
+ textDecoration: "line-through"
2261
+ })`
1978
2262
  ${stylesToInherit}
1979
2263
  `;
1980
2264
  const InlineCode = styled.code`
@@ -2265,8 +2549,8 @@ const BlocksInput = React.forwardRef(
2265
2549
  ({ label, name: name2, required = false, hint, labelAction, ...editorProps }, forwardedRef) => {
2266
2550
  const id = React.useId();
2267
2551
  const field = useField(name2);
2268
- return /* @__PURE__ */ jsx(Field, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
2269
- /* @__PURE__ */ jsx(FieldLabel, { action: labelAction, children: label }),
2552
+ return /* @__PURE__ */ jsx(Field.Root, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
2553
+ /* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
2270
2554
  /* @__PURE__ */ jsx(
2271
2555
  BlocksEditor,
2272
2556
  {
@@ -2279,11 +2563,12 @@ const BlocksInput = React.forwardRef(
2279
2563
  ...editorProps
2280
2564
  }
2281
2565
  ),
2282
- /* @__PURE__ */ jsx(FieldHint, {}),
2283
- /* @__PURE__ */ jsx(FieldError, {})
2566
+ /* @__PURE__ */ jsx(Field.Hint, {}),
2567
+ /* @__PURE__ */ jsx(Field.Error, {})
2284
2568
  ] }) });
2285
2569
  }
2286
2570
  );
2571
+ const MemoizedBlocksInput = React.memo(BlocksInput);
2287
2572
  const createDefaultForm = (contentType, components = {}) => {
2288
2573
  const traverseSchema = (attributes) => {
2289
2574
  return Object.entries(attributes).reduce((acc, [key, attribute]) => {
@@ -2311,7 +2596,7 @@ const Initializer = ({ disabled, name: name2, onClick }) => {
2311
2596
  /* @__PURE__ */ jsx(
2312
2597
  Box,
2313
2598
  {
2314
- as: "button",
2599
+ tag: "button",
2315
2600
  background: "neutral100",
2316
2601
  borderColor: field.error ? "danger600" : "neutral200",
2317
2602
  hasRadius: true,
@@ -2362,9 +2647,9 @@ const NonRepeatableComponent = ({
2362
2647
  hasRadius: isNested,
2363
2648
  borderColor: isNested ? "neutral200" : void 0,
2364
2649
  children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index) => {
2365
- return /* @__PURE__ */ jsx(Grid$1, { gap: 4, children: row.map(({ size, ...field }) => {
2650
+ return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
2366
2651
  const completeFieldName = `${name2}.${field.name}`;
2367
- return /* @__PURE__ */ jsx(GridItem, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2652
+ return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2368
2653
  }) }, index);
2369
2654
  }) })
2370
2655
  }
@@ -2388,7 +2673,7 @@ const RepeatableComponent = ({
2388
2673
  const moveFieldRow = useForm("RepeatableComponent", (state) => state.moveFieldRow);
2389
2674
  const removeFieldRow = useForm("RepeatableComponent", (state) => state.removeFieldRow);
2390
2675
  const { max = Infinity } = attribute;
2391
- const [collapseToOpen, setCollapseToOpen] = React.useState(null);
2676
+ const [collapseToOpen, setCollapseToOpen] = React.useState("");
2392
2677
  const [liveText, setLiveText] = React.useState("");
2393
2678
  const componentTmpKeyWithFocussedField = React.useMemo(() => {
2394
2679
  if (search.has("field")) {
@@ -2404,13 +2689,19 @@ const RepeatableComponent = ({
2404
2689
  }
2405
2690
  return void 0;
2406
2691
  }, [search, name2, value]);
2692
+ const prevValue = usePrev(value);
2407
2693
  React.useEffect(() => {
2408
- if (typeof componentTmpKeyWithFocussedField === "number") {
2694
+ if (prevValue && prevValue.length < value.length) {
2695
+ setCollapseToOpen(value[value.length - 1].__temp_key__);
2696
+ }
2697
+ }, [value, prevValue]);
2698
+ React.useEffect(() => {
2699
+ if (typeof componentTmpKeyWithFocussedField === "string") {
2409
2700
  setCollapseToOpen(componentTmpKeyWithFocussedField);
2410
2701
  }
2411
2702
  }, [componentTmpKeyWithFocussedField]);
2412
2703
  const toggleCollapses = () => {
2413
- setCollapseToOpen(null);
2704
+ setCollapseToOpen("");
2414
2705
  };
2415
2706
  const handleClick = () => {
2416
2707
  if (value.length < max) {
@@ -2442,12 +2733,8 @@ const RepeatableComponent = ({
2442
2733
  );
2443
2734
  moveFieldRow(name2, currentIndex, newIndex);
2444
2735
  };
2445
- const handleToggle = (key) => () => {
2446
- if (collapseToOpen === key) {
2447
- setCollapseToOpen(null);
2448
- } else {
2449
- setCollapseToOpen(key);
2450
- }
2736
+ const handleValueChange = (key) => {
2737
+ setCollapseToOpen(key);
2451
2738
  };
2452
2739
  const getItemPos = (index) => `${index + 1} of ${value.length}`;
2453
2740
  const handleCancel = (index) => {
@@ -2502,158 +2789,104 @@ const RepeatableComponent = ({
2502
2789
  defaultMessage: `Press spacebar to grab and re-order`
2503
2790
  }) }),
2504
2791
  /* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "assertive", children: liveText }),
2505
- /* @__PURE__ */ jsxs(AccordionGroup, { error, children: [
2506
- /* @__PURE__ */ jsx(AccordionContent, { "aria-describedby": ariaDescriptionId, children: value.map(({ __temp_key__: key, id }, index) => {
2507
- const nameWithIndex = `${name2}.${index}`;
2508
- return /* @__PURE__ */ jsx(
2509
- ComponentProvider,
2510
- {
2511
- id,
2512
- uid: attribute.component,
2513
- level: level + 1,
2514
- type: "repeatable",
2515
- children: /* @__PURE__ */ jsx(
2516
- Component,
2792
+ /* @__PURE__ */ jsxs(
2793
+ AccordionRoot,
2794
+ {
2795
+ $error: error,
2796
+ value: collapseToOpen,
2797
+ onValueChange: handleValueChange,
2798
+ "aria-describedby": ariaDescriptionId,
2799
+ children: [
2800
+ value.map(({ __temp_key__: key, id }, index) => {
2801
+ const nameWithIndex = `${name2}.${index}`;
2802
+ return /* @__PURE__ */ jsx(
2803
+ ComponentProvider,
2517
2804
  {
2518
- disabled,
2519
- name: nameWithIndex,
2520
- attribute,
2521
- index,
2522
- isOpen: collapseToOpen === key,
2523
- mainField,
2524
- onMoveItem: handleMoveComponentField,
2525
- onClickToggle: handleToggle(key),
2526
- onDeleteComponent: () => {
2527
- removeFieldRow(name2, index);
2528
- toggleCollapses();
2529
- },
2530
- toggleCollapses,
2531
- onCancel: handleCancel,
2532
- onDropItem: handleDropItem,
2533
- onGrabItem: handleGrabItem,
2534
- children: layout.map((row, index2) => {
2535
- return /* @__PURE__ */ jsx(Grid$1, { gap: 4, children: row.map(({ size, ...field }) => {
2536
- const completeFieldName = `${nameWithIndex}.${field.name}`;
2537
- return /* @__PURE__ */ jsx(GridItem, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2538
- }) }, index2);
2539
- })
2540
- }
2541
- )
2542
- },
2543
- key
2544
- );
2545
- }) }),
2546
- /* @__PURE__ */ jsx(AccordionFooter, { children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", height: "48px", background: "neutral0", children: /* @__PURE__ */ jsx(TextButtonCustom, { disabled, onClick: handleClick, startIcon: /* @__PURE__ */ jsx(Plus, {}), children: formatMessage({
2547
- id: getTranslation("containers.EditView.add.new-entry"),
2548
- defaultMessage: "Add an entry"
2549
- }) }) }) })
2550
- ] })
2805
+ id,
2806
+ uid: attribute.component,
2807
+ level: level + 1,
2808
+ type: "repeatable",
2809
+ children: /* @__PURE__ */ jsx(
2810
+ Component,
2811
+ {
2812
+ disabled,
2813
+ name: nameWithIndex,
2814
+ attribute,
2815
+ index,
2816
+ mainField,
2817
+ onMoveItem: handleMoveComponentField,
2818
+ onDeleteComponent: () => {
2819
+ removeFieldRow(name2, index);
2820
+ toggleCollapses();
2821
+ },
2822
+ toggleCollapses,
2823
+ onCancel: handleCancel,
2824
+ onDropItem: handleDropItem,
2825
+ onGrabItem: handleGrabItem,
2826
+ __temp_key__: key,
2827
+ children: layout.map((row, index2) => {
2828
+ return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
2829
+ const completeFieldName = `${nameWithIndex}.${field.name}`;
2830
+ return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
2831
+ }) }, index2);
2832
+ })
2833
+ }
2834
+ )
2835
+ },
2836
+ key
2837
+ );
2838
+ }),
2839
+ /* @__PURE__ */ jsx(TextButtonCustom, { disabled, onClick: handleClick, startIcon: /* @__PURE__ */ jsx(Plus, {}), children: formatMessage({
2840
+ id: getTranslation("containers.EditView.add.new-entry"),
2841
+ defaultMessage: "Add an entry"
2842
+ }) })
2843
+ ]
2844
+ }
2845
+ )
2551
2846
  ] });
2552
2847
  };
2848
+ const AccordionRoot = styled(Accordion.Root)`
2849
+ border: 1px solid
2850
+ ${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
2851
+ `;
2553
2852
  const TextButtonCustom = styled(TextButton)`
2554
- height: 100%;
2555
2853
  width: 100%;
2556
- border-radius: 0 0 4px 4px;
2557
2854
  display: flex;
2558
2855
  justify-content: center;
2559
- span {
2560
- font-weight: 600;
2561
- font-size: 14px;
2562
- }
2563
- `;
2564
- const AccordionFooter = styled(Box)`
2565
- overflow: hidden;
2566
- border-bottom: 1px solid ${({ theme }) => theme.colors.neutral200};
2567
- border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
2568
- border-left: 1px solid ${({ theme }) => theme.colors.neutral200};
2569
- border-radius: 0 0 ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius};
2570
- `;
2571
- const AccordionContent = styled(Box)`
2572
- border-bottom: none;
2573
-
2574
- /* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
2575
- & > div > div {
2576
- border: 1px solid ${({ theme }) => theme.colors.neutral200};
2577
- border-top-color: transparent;
2578
- }
2579
-
2580
- /* the top accordion _does_ need a border though */
2581
- & > div:first-child > div {
2582
- border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
2583
- }
2584
-
2585
- /* Reset all the border-radius' */
2586
- & > div > div,
2587
- & > div > div > div {
2588
- border-radius: unset;
2589
- }
2856
+ border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
2857
+ padding-inline: ${(props) => props.theme.spaces[6]};
2858
+ padding-block: ${(props) => props.theme.spaces[3]};
2590
2859
 
2591
- /* Give the border radius back to the first accordion */
2592
- & > div:first-child > div,
2593
- & > div:first-child > div > div {
2594
- border-radius: ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius} 0 0;
2595
- }
2596
-
2597
- & > div > div[data-strapi-expanded='true'] {
2598
- border: 1px solid ${({ theme }) => theme.colors.primary600};
2599
- }
2600
- `;
2601
- const AccordionGroup = ({ children, error }) => {
2602
- return /* @__PURE__ */ jsxs(KeyboardNavigable, { attributeName: "data-strapi-accordion-toggle", children: [
2603
- children,
2604
- error && /* @__PURE__ */ jsx(Box, { paddingTop: 1, children: /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "danger600", children: error }) })
2605
- ] });
2606
- };
2607
- const CustomIconButton$1 = styled(IconButton)`
2608
- background-color: transparent;
2860
+ &:not([disabled]) {
2861
+ cursor: pointer;
2609
2862
 
2610
- svg {
2611
- path {
2612
- fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : theme.colors.neutral600};
2863
+ &:hover {
2864
+ background-color: ${(props) => props.theme.colors.primary100};
2613
2865
  }
2614
2866
  }
2615
2867
 
2616
- &:hover {
2617
- svg {
2618
- path {
2619
- fill: ${({ theme }) => theme.colors.primary600};
2620
- }
2621
- }
2868
+ span {
2869
+ font-weight: 600;
2870
+ font-size: 1.4rem;
2871
+ line-height: 2.4rem;
2622
2872
  }
2623
- `;
2624
- const ActionsFlex$1 = styled(Flex)`
2625
- & .drag-handle {
2626
- background: unset;
2627
2873
 
2628
- svg {
2629
- path {
2630
- fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : void 0};
2631
- }
2632
- }
2633
-
2634
- &:hover {
2635
- svg {
2636
- path {
2637
- /* keeps the hover style of the accordion */
2638
- fill: ${({ theme }) => theme.colors.primary600};
2639
- }
2640
- }
2641
- }
2874
+ @media (prefers-reduced-motion: no-preference) {
2875
+ transition: background-color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
2642
2876
  }
2643
2877
  `;
2644
2878
  const Component = ({
2645
2879
  disabled,
2646
2880
  index,
2647
- isOpen,
2648
2881
  name: name2,
2649
2882
  mainField = {
2650
2883
  name: "id",
2651
2884
  type: "integer"
2652
2885
  },
2653
2886
  children,
2654
- onClickToggle,
2655
2887
  onDeleteComponent,
2656
2888
  toggleCollapses,
2889
+ __temp_key__,
2657
2890
  ...dragProps
2658
2891
  }) => {
2659
2892
  const { formatMessage } = useIntl();
@@ -2678,50 +2911,44 @@ const Component = ({
2678
2911
  dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
2679
2912
  }, [dragPreviewRef, index]);
2680
2913
  const composedAccordionRefs = useComposedRefs(accordionRef, dragRef);
2681
- const composedBoxRefs = useComposedRefs(boxRef, dropRef);
2682
- return /* @__PURE__ */ jsx(Box, { ref: (ref) => composedBoxRefs(ref), children: isDragging ? /* @__PURE__ */ jsx(Preview$1, {}) : /* @__PURE__ */ jsxs(Accordion, { expanded: isOpen, onToggle: onClickToggle, id: name2, size: "S", children: [
2683
- /* @__PURE__ */ jsx(
2684
- AccordionToggle,
2685
- {
2686
- action: disabled ? null : /* @__PURE__ */ jsxs(ActionsFlex$1, { gap: 0, expanded: isOpen, children: [
2687
- /* @__PURE__ */ jsx(
2688
- CustomIconButton$1,
2689
- {
2690
- expanded: isOpen,
2691
- borderWidth: 0,
2692
- onClick: onDeleteComponent,
2693
- label: formatMessage({
2694
- id: getTranslation("containers.Edit.delete"),
2695
- defaultMessage: "Delete"
2696
- }),
2697
- icon: /* @__PURE__ */ jsx(Trash, {})
2698
- }
2699
- ),
2700
- /* @__PURE__ */ jsx(
2701
- IconButton,
2702
- {
2703
- className: "drag-handle",
2704
- ref: composedAccordionRefs,
2705
- forwardedAs: "div",
2706
- role: "button",
2707
- borderWidth: 0,
2708
- tabIndex: 0,
2709
- onClick: (e) => e.stopPropagation(),
2710
- "data-handler-id": handlerId,
2711
- label: formatMessage({
2712
- id: getTranslation("components.DragHandle-label"),
2713
- defaultMessage: "Drag"
2714
- }),
2715
- onKeyDown: handleKeyDown,
2716
- children: /* @__PURE__ */ jsx(Drag, {})
2717
- }
2718
- )
2719
- ] }),
2720
- title: displayValue,
2721
- togglePosition: "left"
2722
- }
2723
- ),
2724
- /* @__PURE__ */ jsx(AccordionContent$1, { children: /* @__PURE__ */ jsx(
2914
+ const composedBoxRefs = useComposedRefs(
2915
+ boxRef,
2916
+ dropRef
2917
+ );
2918
+ return /* @__PURE__ */ jsx(Fragment, { children: isDragging ? /* @__PURE__ */ jsx(Preview$1, {}) : /* @__PURE__ */ jsxs(Accordion.Item, { ref: composedBoxRefs, value: __temp_key__, children: [
2919
+ /* @__PURE__ */ jsxs(Accordion.Header, { children: [
2920
+ /* @__PURE__ */ jsx(Accordion.Trigger, { children: displayValue }),
2921
+ /* @__PURE__ */ jsxs(Accordion.Actions, { children: [
2922
+ /* @__PURE__ */ jsx(
2923
+ IconButton,
2924
+ {
2925
+ borderWidth: 0,
2926
+ onClick: onDeleteComponent,
2927
+ label: formatMessage({
2928
+ id: getTranslation("containers.Edit.delete"),
2929
+ defaultMessage: "Delete"
2930
+ }),
2931
+ children: /* @__PURE__ */ jsx(Trash, {})
2932
+ }
2933
+ ),
2934
+ /* @__PURE__ */ jsx(
2935
+ IconButton,
2936
+ {
2937
+ ref: composedAccordionRefs,
2938
+ borderWidth: 0,
2939
+ onClick: (e) => e.stopPropagation(),
2940
+ "data-handler-id": handlerId,
2941
+ label: formatMessage({
2942
+ id: getTranslation("components.DragHandle-label"),
2943
+ defaultMessage: "Drag"
2944
+ }),
2945
+ onKeyDown: handleKeyDown,
2946
+ children: /* @__PURE__ */ jsx(Drag, {})
2947
+ }
2948
+ )
2949
+ ] })
2950
+ ] }),
2951
+ /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(
2725
2952
  Flex,
2726
2953
  {
2727
2954
  direction: "column",
@@ -2735,7 +2962,7 @@ const Component = ({
2735
2962
  ] }) });
2736
2963
  };
2737
2964
  const Preview$1 = () => {
2738
- return /* @__PURE__ */ jsx(StyledSpan, { as: "span", padding: 6, background: "primary100" });
2965
+ return /* @__PURE__ */ jsx(StyledSpan, { tag: "span", padding: 6, background: "primary100" });
2739
2966
  };
2740
2967
  const StyledSpan = styled(Box)`
2741
2968
  display: block;
@@ -2761,29 +2988,15 @@ const ComponentInput = ({
2761
2988
  const data = transformDocument(schema, components)(form);
2762
2989
  field.onChange(name2, data);
2763
2990
  };
2764
- return /* @__PURE__ */ jsxs(Box, { children: [
2991
+ return /* @__PURE__ */ jsxs(Field.Root, { error: field.error, required, children: [
2765
2992
  /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
2766
- /* @__PURE__ */ jsxs(Flex, { paddingBottom: 1, children: [
2767
- /* @__PURE__ */ jsxs(
2768
- Typography,
2769
- {
2770
- textColor: "neutral800",
2771
- htmlFor: name2,
2772
- variant: "pi",
2773
- fontWeight: "bold",
2774
- as: "label",
2775
- children: [
2776
- label,
2777
- attribute.repeatable && /* @__PURE__ */ jsxs(Fragment, { children: [
2778
- " (",
2779
- Array.isArray(field.value) ? field.value.length : 0,
2780
- ")"
2781
- ] }),
2782
- required && /* @__PURE__ */ jsx(Typography, { textColor: "danger600", children: "*" })
2783
- ]
2784
- }
2785
- ),
2786
- labelAction && /* @__PURE__ */ jsx(Box, { paddingLeft: 1, children: labelAction })
2993
+ /* @__PURE__ */ jsxs(Field.Label, { action: labelAction, children: [
2994
+ label,
2995
+ attribute.repeatable && /* @__PURE__ */ jsxs(Fragment, { children: [
2996
+ " (",
2997
+ Array.isArray(field.value) ? field.value.length : 0,
2998
+ ")"
2999
+ ] })
2787
3000
  ] }),
2788
3001
  showResetComponent && /* @__PURE__ */ jsx(
2789
3002
  IconButton,
@@ -2792,21 +3005,21 @@ const ComponentInput = ({
2792
3005
  id: getTranslation("components.reset-entry"),
2793
3006
  defaultMessage: "Reset Entry"
2794
3007
  }),
2795
- icon: /* @__PURE__ */ jsx(Trash, {}),
2796
3008
  borderWidth: 0,
2797
3009
  onClick: () => {
2798
3010
  field.onChange(name2, null);
2799
- }
3011
+ },
3012
+ children: /* @__PURE__ */ jsx(Trash, {})
2800
3013
  }
2801
3014
  )
2802
3015
  ] }),
2803
- /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
2804
- !attribute.repeatable && !field.value && /* @__PURE__ */ jsx(Initializer, { disabled, name: name2, onClick: handleInitialisationClick }),
2805
- !attribute.repeatable && field.value ? /* @__PURE__ */ jsx(NonRepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }) : null,
2806
- attribute.repeatable && /* @__PURE__ */ jsx(RepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children })
2807
- ] })
3016
+ !attribute.repeatable && !field.value && /* @__PURE__ */ jsx(Initializer, { disabled, name: name2, onClick: handleInitialisationClick }),
3017
+ !attribute.repeatable && field.value ? /* @__PURE__ */ jsx(NonRepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }) : null,
3018
+ attribute.repeatable && /* @__PURE__ */ jsx(RepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }),
3019
+ /* @__PURE__ */ jsx(Field.Error, {})
2808
3020
  ] });
2809
3021
  };
3022
+ const MemoizedComponentInput = React.memo(ComponentInput);
2810
3023
  const AddComponentButton = ({
2811
3024
  hasError,
2812
3025
  isDisabled,
@@ -2826,10 +3039,10 @@ const AddComponentButton = ({
2826
3039
  paddingLeft: 4,
2827
3040
  paddingRight: 4,
2828
3041
  style: { cursor: isDisabled ? "not-allowed" : "pointer" },
2829
- children: /* @__PURE__ */ jsxs(Flex, { as: "span", gap: 2, children: [
3042
+ children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
2830
3043
  /* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
2831
3044
  /* @__PURE__ */ jsx(
2832
- Typography,
3045
+ AddComponentTitle,
2833
3046
  {
2834
3047
  variant: "pi",
2835
3048
  fontWeight: "bold",
@@ -2853,13 +3066,14 @@ const StyledAddIcon = styled(PlusCircle)`
2853
3066
  fill: ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral600};
2854
3067
  }
2855
3068
  `;
3069
+ const AddComponentTitle = styled(Typography)``;
2856
3070
  const StyledButton = styled(BaseButton)`
2857
3071
  border-radius: 26px;
2858
3072
  border-color: ${({ theme }) => theme.colors.neutral150};
2859
3073
  box-shadow: ${({ theme }) => theme.shadows.filterShadow};
2860
3074
 
2861
3075
  &:hover {
2862
- ${Typography} {
3076
+ ${AddComponentTitle} {
2863
3077
  color: ${({ theme }) => theme.colors.primary600};
2864
3078
  }
2865
3079
 
@@ -2873,7 +3087,7 @@ const StyledButton = styled(BaseButton)`
2873
3087
  }
2874
3088
  }
2875
3089
  &:active {
2876
- ${Typography} {
3090
+ ${AddComponentTitle} {
2877
3091
  color: ${({ theme }) => theme.colors.primary600};
2878
3092
  }
2879
3093
  ${StyledAddIcon} {
@@ -2890,27 +3104,15 @@ const ComponentCategory = ({
2890
3104
  category,
2891
3105
  components = [],
2892
3106
  variant = "primary",
2893
- isOpen,
2894
- onAddComponent,
2895
- onToggle
3107
+ onAddComponent
2896
3108
  }) => {
2897
3109
  const { formatMessage } = useIntl();
2898
- const handleToggle = () => {
2899
- onToggle(category);
2900
- };
2901
- return /* @__PURE__ */ jsxs(Accordion, { expanded: isOpen, onToggle: handleToggle, size: "S", children: [
2902
- /* @__PURE__ */ jsx(
2903
- AccordionToggle,
2904
- {
2905
- variant,
2906
- title: formatMessage({ id: category, defaultMessage: category }),
2907
- togglePosition: "left"
2908
- }
2909
- ),
2910
- /* @__PURE__ */ jsx(AccordionContent$1, { children: /* @__PURE__ */ jsx(Box, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: /* @__PURE__ */ jsx(Grid, { children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsx(
3110
+ return /* @__PURE__ */ jsxs(Accordion.Item, { value: category, children: [
3111
+ /* @__PURE__ */ jsx(Accordion.Header, { variant, children: /* @__PURE__ */ jsx(Accordion.Trigger, { children: formatMessage({ id: category, defaultMessage: category }) }) }),
3112
+ /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Grid, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsx(
2911
3113
  ComponentBox,
2912
3114
  {
2913
- as: "button",
3115
+ tag: "button",
2914
3116
  type: "button",
2915
3117
  background: "neutral100",
2916
3118
  justifyContent: "center",
@@ -2920,34 +3122,32 @@ const ComponentCategory = ({
2920
3122
  shrink: 0,
2921
3123
  borderColor: "neutral200",
2922
3124
  children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "center", justifyContent: "center", children: [
2923
- /* @__PURE__ */ jsx(ComponentIcon, { icon }),
2924
- /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral600", children: displayName })
3125
+ /* @__PURE__ */ jsx(ComponentIcon, { color: "currentColor", background: "primary200", icon }),
3126
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: displayName })
2925
3127
  ] })
2926
3128
  },
2927
3129
  uid
2928
- )) }) }) })
3130
+ )) }) })
2929
3131
  ] });
2930
3132
  };
2931
- const Grid = styled.div`
3133
+ const Grid = styled(Box)`
2932
3134
  display: grid;
2933
3135
  grid-template-columns: repeat(auto-fit, 14rem);
2934
3136
  grid-gap: ${({ theme }) => theme.spaces[1]};
2935
3137
  `;
2936
3138
  const ComponentBox = styled(Flex)`
3139
+ color: ${({ theme }) => theme.colors.neutral600};
3140
+ cursor: pointer;
3141
+
3142
+ @media (prefers-reduced-motion: no-preference) {
3143
+ transition: color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
3144
+ }
3145
+
2937
3146
  &:focus,
2938
3147
  &:hover {
2939
3148
  border: 1px solid ${({ theme }) => theme.colors.primary200};
2940
3149
  background: ${({ theme }) => theme.colors.primary100};
2941
-
2942
- ${Typography} {
2943
- color: ${({ theme }) => theme.colors.primary600};
2944
- }
2945
-
2946
- /* > Flex > ComponentIcon */
2947
- > div > div:first-child {
2948
- background: ${({ theme }) => theme.colors.primary200};
2949
- color: ${({ theme }) => theme.colors.primary600};
2950
- }
3150
+ color: ${({ theme }) => theme.colors.primary600};
2951
3151
  }
2952
3152
  `;
2953
3153
  const ComponentPicker = ({
@@ -2956,19 +3156,8 @@ const ComponentPicker = ({
2956
3156
  onClickAddComponent
2957
3157
  }) => {
2958
3158
  const { formatMessage } = useIntl();
2959
- const [categoryToOpen, setCategoryToOpen] = React.useState("");
2960
- React.useEffect(() => {
2961
- const categoryKeys = Object.keys(dynamicComponentsByCategory);
2962
- if (isOpen && categoryKeys.length > 0) {
2963
- setCategoryToOpen(categoryKeys[0]);
2964
- }
2965
- }, [isOpen, dynamicComponentsByCategory]);
2966
3159
  const handleAddComponentToDz = (componentUid) => () => {
2967
3160
  onClickAddComponent(componentUid);
2968
- setCategoryToOpen("");
2969
- };
2970
- const handleClickToggle = (categoryName) => {
2971
- setCategoryToOpen((currentCat) => currentCat === categoryName ? "" : categoryName);
2972
3161
  };
2973
3162
  if (!isOpen) {
2974
3163
  return null;
@@ -2989,14 +3178,12 @@ const ComponentPicker = ({
2989
3178
  id: getTranslation("components.DynamicZone.ComponentPicker-label"),
2990
3179
  defaultMessage: "Pick one component"
2991
3180
  }) }) }),
2992
- /* @__PURE__ */ jsx(Box, { paddingTop: 2, children: /* @__PURE__ */ jsx(KeyboardNavigable, { attributeName: "data-strapi-accordion-toggle", children: Object.entries(dynamicComponentsByCategory).map(([category, components], index) => /* @__PURE__ */ jsx(
3181
+ /* @__PURE__ */ jsx(Box, { paddingTop: 2, children: /* @__PURE__ */ jsx(Accordion.Root, { defaultValue: Object.keys(dynamicComponentsByCategory)[0], children: Object.entries(dynamicComponentsByCategory).map(([category, components], index) => /* @__PURE__ */ jsx(
2993
3182
  ComponentCategory,
2994
3183
  {
2995
3184
  category,
2996
3185
  components,
2997
3186
  onAddComponent: handleAddComponentToDz,
2998
- isOpen: category === categoryToOpen,
2999
- onToggle: handleClickToggle,
3000
3187
  variant: index % 2 === 1 ? "primary" : "secondary"
3001
3188
  },
3002
3189
  category
@@ -3011,27 +3198,21 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
3011
3198
  id: "components.NotAllowedInput.text",
3012
3199
  defaultMessage: "No permissions to see this field"
3013
3200
  });
3014
- return /* @__PURE__ */ jsx(
3015
- TextInput,
3016
- {
3017
- disabled: true,
3018
- label,
3019
- id: name2,
3020
- hint,
3021
- name: name2,
3022
- placeholder,
3023
- required,
3024
- startAction: /* @__PURE__ */ jsx(StyledIcon, {}),
3025
- type: "text",
3026
- value: ""
3027
- }
3028
- );
3201
+ return /* @__PURE__ */ jsxs(Field.Root, { id: name2, hint, name: name2, required, children: [
3202
+ /* @__PURE__ */ jsx(Field.Label, { children: label }),
3203
+ /* @__PURE__ */ jsx(
3204
+ TextInput,
3205
+ {
3206
+ disabled: true,
3207
+ placeholder,
3208
+ startAction: /* @__PURE__ */ jsx(EyeStriked, { fill: "neutral600" }),
3209
+ type: "text",
3210
+ value: ""
3211
+ }
3212
+ ),
3213
+ /* @__PURE__ */ jsx(Field.Hint, {})
3214
+ ] });
3029
3215
  };
3030
- const StyledIcon = styled(EyeStriked)`
3031
- & > path {
3032
- fill: ${({ theme }) => theme.colors.neutral600};
3033
- }
3034
- `;
3035
3216
  function useDebounce(value, delay) {
3036
3217
  const [debouncedValue, setDebouncedValue] = useState(value);
3037
3218
  useEffect(() => {
@@ -3084,188 +3265,193 @@ const uidApi = contentManagerApi.injectEndpoints({
3084
3265
  });
3085
3266
  const { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;
3086
3267
  const UID_REGEX = /^[A-Za-z0-9-_.~]*$/;
3087
- const UIDInput = React.forwardRef((props, ref) => {
3088
- const { model, id } = useDoc();
3089
- const allFormValues = useForm("InputUID", (form) => form.values);
3090
- const [availability, setAvailability] = React.useState();
3091
- const [showRegenerate, setShowRegenerate] = React.useState(false);
3092
- const field = useField(props.name);
3093
- const debouncedValue = useDebounce(field.value, 300);
3094
- const { toggleNotification } = useNotification();
3095
- const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
3096
- const { formatMessage } = useIntl();
3097
- const [{ query }] = useQueryParams();
3098
- const params = React.useMemo(() => buildValidParams(query), [query]);
3099
- const {
3100
- data: defaultGeneratedUID,
3101
- isLoading: isGeneratingDefaultUID,
3102
- error: apiError
3103
- } = useGetDefaultUIDQuery(
3104
- {
3105
- contentTypeUID: model,
3106
- field: props.name,
3107
- data: {
3108
- id: id ?? "",
3109
- ...allFormValues
3110
- },
3111
- params
3112
- },
3113
- {
3114
- skip: field.value || !props.required
3115
- }
3116
- );
3117
- React.useEffect(() => {
3118
- if (apiError) {
3119
- toggleNotification({
3120
- type: "warning",
3121
- message: formatAPIError(apiError)
3122
- });
3123
- }
3124
- }, [apiError, formatAPIError, toggleNotification]);
3125
- React.useEffect(() => {
3126
- if (defaultGeneratedUID && field.value === void 0) {
3127
- field.onChange(props.name, defaultGeneratedUID);
3128
- }
3129
- }, [defaultGeneratedUID, field, props.name]);
3130
- const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
3131
- const handleRegenerateClick = async () => {
3132
- try {
3133
- const res = await generateUID({
3268
+ const UIDInput = React.forwardRef(
3269
+ ({ hint, label, labelAction, name: name2, required, ...props }, ref) => {
3270
+ const { model, id } = useDoc();
3271
+ const allFormValues = useForm("InputUID", (form) => form.values);
3272
+ const [availability, setAvailability] = React.useState();
3273
+ const [showRegenerate, setShowRegenerate] = React.useState(false);
3274
+ const field = useField(name2);
3275
+ const debouncedValue = useDebounce(field.value, 300);
3276
+ const { toggleNotification } = useNotification();
3277
+ const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
3278
+ const { formatMessage } = useIntl();
3279
+ const [{ query }] = useQueryParams();
3280
+ const params = React.useMemo(() => buildValidParams(query), [query]);
3281
+ const {
3282
+ data: defaultGeneratedUID,
3283
+ isLoading: isGeneratingDefaultUID,
3284
+ error: apiError
3285
+ } = useGetDefaultUIDQuery(
3286
+ {
3134
3287
  contentTypeUID: model,
3135
- field: props.name,
3136
- data: { id: id ?? "", ...allFormValues },
3288
+ field: name2,
3289
+ data: {
3290
+ id: id ?? "",
3291
+ ...allFormValues
3292
+ },
3137
3293
  params
3138
- });
3139
- if ("data" in res) {
3140
- field.onChange(props.name, res.data);
3141
- } else {
3294
+ },
3295
+ {
3296
+ skip: field.value || !required
3297
+ }
3298
+ );
3299
+ React.useEffect(() => {
3300
+ if (apiError) {
3142
3301
  toggleNotification({
3143
- type: "danger",
3144
- message: formatAPIError(res.error)
3302
+ type: "warning",
3303
+ message: formatAPIError(apiError)
3145
3304
  });
3146
3305
  }
3147
- } catch (err) {
3148
- toggleNotification({
3149
- type: "danger",
3150
- message: formatMessage({
3151
- id: "notification.error",
3152
- defaultMessage: "An error occurred."
3153
- })
3154
- });
3155
- }
3156
- };
3157
- const {
3158
- data: availabilityData,
3159
- isLoading: isCheckingAvailability,
3160
- error: availabilityError
3161
- } = useGetAvailabilityQuery(
3162
- {
3163
- contentTypeUID: model,
3164
- field: props.name,
3165
- value: debouncedValue ? debouncedValue.trim() : "",
3166
- params
3167
- },
3168
- {
3169
- skip: !Boolean(
3170
- debouncedValue !== field.initialValue && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3171
- )
3172
- }
3173
- );
3174
- React.useEffect(() => {
3175
- if (availabilityError) {
3176
- toggleNotification({
3177
- type: "warning",
3178
- message: formatAPIError(availabilityError)
3179
- });
3180
- }
3181
- }, [availabilityError, formatAPIError, toggleNotification]);
3182
- React.useEffect(() => {
3183
- setAvailability(availabilityData);
3184
- let timer;
3185
- if (availabilityData?.isAvailable) {
3186
- timer = window.setTimeout(() => {
3187
- setAvailability(void 0);
3188
- }, 4e3);
3189
- }
3190
- return () => {
3191
- if (timer) {
3192
- clearTimeout(timer);
3306
+ }, [apiError, formatAPIError, toggleNotification]);
3307
+ React.useEffect(() => {
3308
+ if (defaultGeneratedUID && field.value === void 0) {
3309
+ field.onChange(name2, defaultGeneratedUID);
3310
+ }
3311
+ }, [defaultGeneratedUID, field, name2]);
3312
+ const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
3313
+ const handleRegenerateClick = async () => {
3314
+ try {
3315
+ const res = await generateUID({
3316
+ contentTypeUID: model,
3317
+ field: name2,
3318
+ data: { id: id ?? "", ...allFormValues },
3319
+ params
3320
+ });
3321
+ if ("data" in res) {
3322
+ field.onChange(name2, res.data);
3323
+ } else {
3324
+ toggleNotification({
3325
+ type: "danger",
3326
+ message: formatAPIError(res.error)
3327
+ });
3328
+ }
3329
+ } catch (err) {
3330
+ toggleNotification({
3331
+ type: "danger",
3332
+ message: formatMessage({
3333
+ id: "notification.error",
3334
+ defaultMessage: "An error occurred."
3335
+ })
3336
+ });
3193
3337
  }
3194
3338
  };
3195
- }, [availabilityData]);
3196
- const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
3197
- const fieldRef = useFocusInputField(props.name);
3198
- const composedRefs = useComposedRefs(ref, fieldRef);
3199
- return (
3200
- // @ts-expect-error – label _could_ be a ReactNode since it's a child, this should be fixed in the DS.
3201
- /* @__PURE__ */ jsx(
3202
- TextInput,
3339
+ const {
3340
+ data: availabilityData,
3341
+ isLoading: isCheckingAvailability,
3342
+ error: availabilityError
3343
+ } = useGetAvailabilityQuery(
3203
3344
  {
3204
- ref: composedRefs,
3205
- disabled: props.disabled,
3206
- error: field.error,
3207
- endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
3208
- availability && !showRegenerate && /* @__PURE__ */ jsxs(
3209
- TextValidation,
3210
- {
3211
- alignItems: "center",
3212
- gap: 1,
3213
- justifyContent: "flex-end",
3214
- available: !!availability?.isAvailable,
3215
- "data-not-here-outer": true,
3216
- position: "absolute",
3217
- pointerEvents: "none",
3218
- right: 6,
3219
- width: "100px",
3220
- children: [
3221
- availability?.isAvailable ? /* @__PURE__ */ jsx(CheckCircle, {}) : /* @__PURE__ */ jsx(WarningCircle, {}),
3222
- /* @__PURE__ */ jsx(
3223
- Typography,
3224
- {
3225
- textColor: availability.isAvailable ? "success600" : "danger600",
3226
- variant: "pi",
3227
- children: formatMessage(
3228
- availability.isAvailable ? {
3229
- id: "content-manager.components.uid.available",
3230
- defaultMessage: "Available"
3231
- } : {
3232
- id: "content-manager.components.uid.unavailable",
3233
- defaultMessage: "Unavailable"
3234
- }
3235
- )
3236
- }
3237
- )
3238
- ]
3239
- }
3240
- ),
3241
- !props.disabled && /* @__PURE__ */ jsxs(Fragment, { children: [
3242
- showRegenerate && /* @__PURE__ */ jsx(TextValidation, { alignItems: "center", justifyContent: "flex-end", gap: 1, children: /* @__PURE__ */ jsx(Typography, { textColor: "primary600", variant: "pi", children: formatMessage({
3243
- id: "content-manager.components.uid.regenerate",
3244
- defaultMessage: "Regenerate"
3245
- }) }) }),
3246
- /* @__PURE__ */ jsx(
3247
- FieldActionWrapper,
3345
+ contentTypeUID: model,
3346
+ field: name2,
3347
+ value: debouncedValue ? debouncedValue.trim() : "",
3348
+ params
3349
+ },
3350
+ {
3351
+ skip: !Boolean(
3352
+ debouncedValue !== field.initialValue && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3353
+ )
3354
+ }
3355
+ );
3356
+ React.useEffect(() => {
3357
+ if (availabilityError) {
3358
+ toggleNotification({
3359
+ type: "warning",
3360
+ message: formatAPIError(availabilityError)
3361
+ });
3362
+ }
3363
+ }, [availabilityError, formatAPIError, toggleNotification]);
3364
+ React.useEffect(() => {
3365
+ setAvailability(availabilityData);
3366
+ let timer;
3367
+ if (availabilityData?.isAvailable) {
3368
+ timer = window.setTimeout(() => {
3369
+ setAvailability(void 0);
3370
+ }, 4e3);
3371
+ }
3372
+ return () => {
3373
+ if (timer) {
3374
+ clearTimeout(timer);
3375
+ }
3376
+ };
3377
+ }, [availabilityData]);
3378
+ const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
3379
+ const fieldRef = useFocusInputField(name2);
3380
+ const composedRefs = useComposedRefs(ref, fieldRef);
3381
+ return /* @__PURE__ */ jsxs(Field.Root, { hint, name: name2, error: field.error, required, children: [
3382
+ /* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
3383
+ /* @__PURE__ */ jsx(
3384
+ TextInput,
3385
+ {
3386
+ ref: composedRefs,
3387
+ disabled: props.disabled,
3388
+ endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
3389
+ availability && !showRegenerate && /* @__PURE__ */ jsxs(
3390
+ TextValidation,
3248
3391
  {
3249
- onClick: handleRegenerateClick,
3250
- label: formatMessage({
3251
- id: "content-manager.components.uid.regenerate",
3252
- defaultMessage: "Regenerate"
3253
- }),
3254
- onMouseEnter: () => setShowRegenerate(true),
3255
- onMouseLeave: () => setShowRegenerate(false),
3256
- children: isLoading ? /* @__PURE__ */ jsx(LoadingWrapper, { "data-testid": "loading-wrapper", children: /* @__PURE__ */ jsx(Loader, {}) }) : /* @__PURE__ */ jsx(ArrowClockwise, {})
3392
+ alignItems: "center",
3393
+ gap: 1,
3394
+ justifyContent: "flex-end",
3395
+ $available: !!availability?.isAvailable,
3396
+ "data-not-here-outer": true,
3397
+ position: "absolute",
3398
+ pointerEvents: "none",
3399
+ right: 6,
3400
+ width: "100px",
3401
+ children: [
3402
+ availability?.isAvailable ? /* @__PURE__ */ jsx(CheckCircle, {}) : /* @__PURE__ */ jsx(WarningCircle, {}),
3403
+ /* @__PURE__ */ jsx(
3404
+ Typography,
3405
+ {
3406
+ textColor: availability.isAvailable ? "success600" : "danger600",
3407
+ variant: "pi",
3408
+ children: formatMessage(
3409
+ availability.isAvailable ? {
3410
+ id: "content-manager.components.uid.available",
3411
+ defaultMessage: "Available"
3412
+ } : {
3413
+ id: "content-manager.components.uid.unavailable",
3414
+ defaultMessage: "Unavailable"
3415
+ }
3416
+ )
3417
+ }
3418
+ )
3419
+ ]
3257
3420
  }
3258
- )
3259
- ] })
3260
- ] }),
3261
- onChange: field.onChange,
3262
- value: field.value ?? "",
3263
- ...props
3264
- }
3265
- )
3266
- );
3267
- });
3268
- const FieldActionWrapper = styled(FieldAction)`
3421
+ ),
3422
+ !props.disabled && /* @__PURE__ */ jsxs(Fragment, { children: [
3423
+ showRegenerate && /* @__PURE__ */ jsx(TextValidation, { alignItems: "center", justifyContent: "flex-end", gap: 1, children: /* @__PURE__ */ jsx(Typography, { textColor: "primary600", variant: "pi", children: formatMessage({
3424
+ id: "content-manager.components.uid.regenerate",
3425
+ defaultMessage: "Regenerate"
3426
+ }) }) }),
3427
+ /* @__PURE__ */ jsx(
3428
+ FieldActionWrapper,
3429
+ {
3430
+ onClick: handleRegenerateClick,
3431
+ label: formatMessage({
3432
+ id: "content-manager.components.uid.regenerate",
3433
+ defaultMessage: "Regenerate"
3434
+ }),
3435
+ onMouseEnter: () => setShowRegenerate(true),
3436
+ onMouseLeave: () => setShowRegenerate(false),
3437
+ children: isLoading ? /* @__PURE__ */ jsx(LoadingWrapper, { "data-testid": "loading-wrapper", children: /* @__PURE__ */ jsx(Loader, {}) }) : /* @__PURE__ */ jsx(ArrowClockwise, {})
3438
+ }
3439
+ )
3440
+ ] })
3441
+ ] }),
3442
+ onChange: field.onChange,
3443
+ value: field.value ?? "",
3444
+ ...props
3445
+ }
3446
+ ),
3447
+ /* @__PURE__ */ jsx(Field.Error, {}),
3448
+ /* @__PURE__ */ jsx(Field.Hint, {})
3449
+ ] });
3450
+ }
3451
+ );
3452
+ const FieldActionWrapper = styled(Field.Action)`
3453
+ width: 1.6rem;
3454
+
3269
3455
  svg {
3270
3456
  height: 1.6rem;
3271
3457
  width: 1.6rem;
@@ -3286,7 +3472,7 @@ const TextValidation = styled(Flex)`
3286
3472
  width: 1.2rem;
3287
3473
 
3288
3474
  path {
3289
- fill: ${({ theme, available }) => available ? theme.colors.success600 : theme.colors.danger600};
3475
+ fill: ${({ theme, $available }) => $available ? theme.colors.success600 : theme.colors.danger600};
3290
3476
  }
3291
3477
  }
3292
3478
  `;
@@ -3301,6 +3487,7 @@ const rotation = keyframes`
3301
3487
  const LoadingWrapper = styled(Flex)`
3302
3488
  animation: ${rotation} 2s infinite linear;
3303
3489
  `;
3490
+ const MemoizedUIDInput = React.memo(UIDInput);
3304
3491
  const md = new Markdown({
3305
3492
  html: true,
3306
3493
  // Enable HTML tags in source
@@ -3635,7 +3822,7 @@ const Editor = React.forwardRef(
3635
3822
  [editorRef]
3636
3823
  );
3637
3824
  return /* @__PURE__ */ jsxs(EditorAndPreviewWrapper, { children: [
3638
- /* @__PURE__ */ jsx(EditorStylesContainer, { isExpandMode, disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsx("textarea", { ref: textareaRef }) }),
3825
+ /* @__PURE__ */ jsx(EditorStylesContainer, { $isExpandMode: isExpandMode, $disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsx("textarea", { ref: textareaRef }) }),
3639
3826
  isPreviewMode && /* @__PURE__ */ jsx(PreviewWysiwyg, { data: value })
3640
3827
  ] });
3641
3828
  }
@@ -3645,7 +3832,7 @@ const EditorAndPreviewWrapper = styled.div`
3645
3832
  height: calc(100% - 48px);
3646
3833
  `;
3647
3834
  const EditorStylesContainer = styled.div`
3648
- cursor: ${({ disabled }) => disabled ? "not-allowed !important" : "auto"};
3835
+ cursor: ${({ $disabled }) => $disabled ? "not-allowed !important" : "auto"};
3649
3836
  height: 100%;
3650
3837
  /* BASICS */
3651
3838
  .CodeMirror-placeholder {
@@ -3655,7 +3842,7 @@ const EditorStylesContainer = styled.div`
3655
3842
  .CodeMirror {
3656
3843
  /* Set height, width, borders, and global font properties here */
3657
3844
  font-size: 1.4rem;
3658
- height: ${({ isExpandMode }) => isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
3845
+ height: ${({ $isExpandMode }) => $isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
3659
3846
  color: ${({ theme }) => theme.colors.neutral800};
3660
3847
  direction: ltr;
3661
3848
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
@@ -4340,8 +4527,6 @@ const quoteAndCodeHandler = (editor, markdownType) => {
4340
4527
  };
4341
4528
  const CustomIconButton = styled(IconButton)`
4342
4529
  padding: ${({ theme }) => theme.spaces[2]};
4343
- /* Trick to prevent the outline from overflowing because of the general outline-offset */
4344
- outline-offset: -2px !important;
4345
4530
 
4346
4531
  svg {
4347
4532
  width: 1.8rem;
@@ -4408,7 +4593,7 @@ const WysiwygNav = ({
4408
4593
  id: "components.Wysiwyg.selectOptions.title",
4409
4594
  defaultMessage: "Add a title"
4410
4595
  });
4411
- const buttonMoreRef = React.useRef(null);
4596
+ React.useRef(null);
4412
4597
  const handleTogglePopover = () => {
4413
4598
  setVisiblePopover((prev) => !prev);
4414
4599
  };
@@ -4421,21 +4606,21 @@ const WysiwygNav = ({
4421
4606
  justifyContent: "space-between",
4422
4607
  borderRadius: `0.4rem 0.4rem 0 0`,
4423
4608
  children: [
4424
- /* @__PURE__ */ jsxs(StyledFlex, { children: [
4425
- /* @__PURE__ */ jsxs(SingleSelect, { disabled: true, placeholder: selectPlaceholder, size: "S", label: selectPlaceholder, children: [
4609
+ /* @__PURE__ */ jsxs(Flex, { children: [
4610
+ /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(SingleSelect, { disabled: true, placeholder: selectPlaceholder, "aria-label": selectPlaceholder, children: [
4426
4611
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
4427
4612
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
4428
4613
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h3", children: "h3" }),
4429
4614
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h4", children: "h4" }),
4430
4615
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h5", children: "h5" }),
4431
4616
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
4432
- ] }),
4617
+ ] }) }),
4433
4618
  /* @__PURE__ */ jsxs(MainButtons, { children: [
4434
- /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Bold", name: "Bold", icon: /* @__PURE__ */ jsx(Bold, {}) }),
4435
- /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Italic", name: "Italic", icon: /* @__PURE__ */ jsx(Italic, {}) }),
4436
- /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Underline", name: "Underline", icon: /* @__PURE__ */ jsx(Underline, {}) })
4619
+ /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
4620
+ /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
4621
+ /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
4437
4622
  ] }),
4438
- /* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", icon: /* @__PURE__ */ jsx(More, {}) })
4623
+ /* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsx(More, {}) })
4439
4624
  ] }),
4440
4625
  !isExpandMode && /* @__PURE__ */ jsx(Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
4441
4626
  id: "components.Wysiwyg.ToggleMode.markdown-mode",
@@ -4453,13 +4638,12 @@ const WysiwygNav = ({
4453
4638
  justifyContent: "space-between",
4454
4639
  borderRadius: `0.4rem 0.4rem 0 0`,
4455
4640
  children: [
4456
- /* @__PURE__ */ jsxs(StyledFlex, { children: [
4457
- /* @__PURE__ */ jsxs(
4641
+ /* @__PURE__ */ jsxs(Flex, { children: [
4642
+ /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
4458
4643
  SingleSelect,
4459
4644
  {
4460
4645
  placeholder: selectPlaceholder,
4461
- label: selectPlaceholder,
4462
- size: "S",
4646
+ "aria-label": selectPlaceholder,
4463
4647
  onChange: (value) => onActionClick(value, editorRef),
4464
4648
  children: [
4465
4649
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
@@ -4470,7 +4654,7 @@ const WysiwygNav = ({
4470
4654
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
4471
4655
  ]
4472
4656
  }
4473
- ),
4657
+ ) }),
4474
4658
  /* @__PURE__ */ jsxs(MainButtons, { children: [
4475
4659
  /* @__PURE__ */ jsx(
4476
4660
  CustomIconButton,
@@ -4478,7 +4662,7 @@ const WysiwygNav = ({
4478
4662
  onClick: () => onActionClick("Bold", editorRef),
4479
4663
  label: "Bold",
4480
4664
  name: "Bold",
4481
- icon: /* @__PURE__ */ jsx(Bold, {})
4665
+ children: /* @__PURE__ */ jsx(Bold, {})
4482
4666
  }
4483
4667
  ),
4484
4668
  /* @__PURE__ */ jsx(
@@ -4487,7 +4671,7 @@ const WysiwygNav = ({
4487
4671
  onClick: () => onActionClick("Italic", editorRef),
4488
4672
  label: "Italic",
4489
4673
  name: "Italic",
4490
- icon: /* @__PURE__ */ jsx(Italic, {})
4674
+ children: /* @__PURE__ */ jsx(Italic, {})
4491
4675
  }
4492
4676
  ),
4493
4677
  /* @__PURE__ */ jsx(
@@ -4496,91 +4680,85 @@ const WysiwygNav = ({
4496
4680
  onClick: () => onActionClick("Underline", editorRef),
4497
4681
  label: "Underline",
4498
4682
  name: "Underline",
4499
- icon: /* @__PURE__ */ jsx(Underline, {})
4683
+ children: /* @__PURE__ */ jsx(Underline, {})
4500
4684
  }
4501
4685
  )
4502
4686
  ] }),
4503
- /* @__PURE__ */ jsx(
4504
- MoreButton,
4505
- {
4506
- ref: buttonMoreRef,
4507
- onClick: handleTogglePopover,
4508
- label: "More",
4509
- icon: /* @__PURE__ */ jsx(More, {})
4510
- }
4511
- ),
4512
- visiblePopover && /* @__PURE__ */ jsx(Popover, { onDismiss: handleTogglePopover, centered: true, source: buttonMoreRef, spacing: 4, children: /* @__PURE__ */ jsxs(Flex, { children: [
4513
- /* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
4514
- /* @__PURE__ */ jsx(
4515
- CustomIconButton,
4516
- {
4517
- onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
4518
- label: "Strikethrough",
4519
- name: "Strikethrough",
4520
- icon: /* @__PURE__ */ jsx(StrikeThrough, {})
4521
- }
4522
- ),
4523
- /* @__PURE__ */ jsx(
4524
- CustomIconButton,
4525
- {
4526
- onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
4527
- label: "BulletList",
4528
- name: "BulletList",
4529
- icon: /* @__PURE__ */ jsx(BulletList, {})
4530
- }
4531
- ),
4532
- /* @__PURE__ */ jsx(
4533
- CustomIconButton,
4534
- {
4535
- onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
4536
- label: "NumberList",
4537
- name: "NumberList",
4538
- icon: /* @__PURE__ */ jsx(NumberList, {})
4539
- }
4540
- )
4541
- ] }),
4542
- /* @__PURE__ */ jsxs(IconButtonGroup, { children: [
4543
- /* @__PURE__ */ jsx(
4544
- CustomIconButton,
4545
- {
4546
- onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
4547
- label: "Code",
4548
- name: "Code",
4549
- icon: /* @__PURE__ */ jsx(Code, {})
4550
- }
4551
- ),
4552
- /* @__PURE__ */ jsx(
4553
- CustomIconButton,
4554
- {
4555
- onClick: () => {
4556
- handleTogglePopover();
4557
- onToggleMediaLib();
4558
- },
4559
- label: "Image",
4560
- name: "Image",
4561
- icon: /* @__PURE__ */ jsx(Image$1, {})
4562
- }
4563
- ),
4564
- /* @__PURE__ */ jsx(
4565
- CustomLinkIconButton,
4566
- {
4567
- onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
4568
- label: "Link",
4569
- name: "Link",
4570
- icon: /* @__PURE__ */ jsx(Link$1, {})
4571
- }
4572
- ),
4573
- /* @__PURE__ */ jsx(
4574
- CustomIconButton,
4575
- {
4576
- onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
4577
- label: "Quote",
4578
- name: "Quote",
4579
- icon: /* @__PURE__ */ jsx(Quotes, {})
4580
- }
4581
- )
4582
- ] })
4583
- ] }) })
4687
+ /* @__PURE__ */ jsxs(Popover.Root, { children: [
4688
+ /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(MoreButton, { label: "More", children: /* @__PURE__ */ jsx(More, {}) }) }),
4689
+ /* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
4690
+ /* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
4691
+ /* @__PURE__ */ jsx(
4692
+ CustomIconButton,
4693
+ {
4694
+ onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
4695
+ label: "Strikethrough",
4696
+ name: "Strikethrough",
4697
+ children: /* @__PURE__ */ jsx(StrikeThrough, {})
4698
+ }
4699
+ ),
4700
+ /* @__PURE__ */ jsx(
4701
+ CustomIconButton,
4702
+ {
4703
+ onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
4704
+ label: "BulletList",
4705
+ name: "BulletList",
4706
+ children: /* @__PURE__ */ jsx(BulletList, {})
4707
+ }
4708
+ ),
4709
+ /* @__PURE__ */ jsx(
4710
+ CustomIconButton,
4711
+ {
4712
+ onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
4713
+ label: "NumberList",
4714
+ name: "NumberList",
4715
+ children: /* @__PURE__ */ jsx(NumberList, {})
4716
+ }
4717
+ )
4718
+ ] }),
4719
+ /* @__PURE__ */ jsxs(IconButtonGroup, { children: [
4720
+ /* @__PURE__ */ jsx(
4721
+ CustomIconButton,
4722
+ {
4723
+ onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
4724
+ label: "Code",
4725
+ name: "Code",
4726
+ children: /* @__PURE__ */ jsx(Code, {})
4727
+ }
4728
+ ),
4729
+ /* @__PURE__ */ jsx(
4730
+ CustomIconButton,
4731
+ {
4732
+ onClick: () => {
4733
+ handleTogglePopover();
4734
+ onToggleMediaLib();
4735
+ },
4736
+ label: "Image",
4737
+ name: "Image",
4738
+ children: /* @__PURE__ */ jsx(Image$1, {})
4739
+ }
4740
+ ),
4741
+ /* @__PURE__ */ jsx(
4742
+ CustomLinkIconButton,
4743
+ {
4744
+ onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
4745
+ label: "Link",
4746
+ name: "Link",
4747
+ children: /* @__PURE__ */ jsx(Link$1, {})
4748
+ }
4749
+ ),
4750
+ /* @__PURE__ */ jsx(
4751
+ CustomIconButton,
4752
+ {
4753
+ onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
4754
+ label: "Quote",
4755
+ name: "Quote",
4756
+ children: /* @__PURE__ */ jsx(Quotes, {})
4757
+ }
4758
+ )
4759
+ ] })
4760
+ ] }) })
4761
+ ] })
4584
4762
  ] }),
4585
4763
  onTogglePreviewMode && /* @__PURE__ */ jsx(Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
4586
4764
  id: "components.Wysiwyg.ToggleMode.preview-mode",
@@ -4590,19 +4768,6 @@ const WysiwygNav = ({
4590
4768
  }
4591
4769
  );
4592
4770
  };
4593
- const StyledFlex = styled(Flex)`
4594
- /* Hide the label, every input needs a label. */
4595
- label {
4596
- border: 0;
4597
- clip: rect(0 0 0 0);
4598
- height: 1px;
4599
- margin: -1px;
4600
- overflow: hidden;
4601
- padding: 0;
4602
- position: absolute;
4603
- width: 1px;
4604
- }
4605
- `;
4606
4771
  const Wysiwyg = React.forwardRef(
4607
4772
  ({ hint, disabled, label, name: name2, placeholder, required, labelAction }, forwardedRef) => {
4608
4773
  const field = useField(name2);
@@ -4667,9 +4832,9 @@ const Wysiwyg = React.forwardRef(
4667
4832
  insertFile(editorRef, formattedFiles);
4668
4833
  setMediaLibVisible(false);
4669
4834
  };
4670
- return /* @__PURE__ */ jsxs(Field, { name: name2, hint, error: field.error, required, children: [
4835
+ return /* @__PURE__ */ jsxs(Field.Root, { name: name2, hint, error: field.error, required, children: [
4671
4836
  /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
4672
- /* @__PURE__ */ jsx(FieldLabel, { action: labelAction, children: label }),
4837
+ /* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
4673
4838
  /* @__PURE__ */ jsxs(
4674
4839
  EditorLayout,
4675
4840
  {
@@ -4710,14 +4875,15 @@ const Wysiwyg = React.forwardRef(
4710
4875
  ]
4711
4876
  }
4712
4877
  ),
4713
- /* @__PURE__ */ jsx(FieldHint, {}),
4714
- /* @__PURE__ */ jsx(FieldError, {})
4878
+ /* @__PURE__ */ jsx(Field.Hint, {}),
4879
+ /* @__PURE__ */ jsx(Field.Error, {})
4715
4880
  ] }),
4716
4881
  mediaLibVisible && // @ts-expect-error – TODO: fix this way of injecting because it's not really typeable without a registry.
4717
4882
  /* @__PURE__ */ jsx(MediaLibraryDialog, { onClose: handleToggleMediaLib, onSelectAssets: handleSelectAssets })
4718
4883
  ] });
4719
4884
  }
4720
4885
  );
4886
+ const MemoizedWysiwyg = React.memo(Wysiwyg);
4721
4887
  const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4722
4888
  const { id } = useDoc();
4723
4889
  const isFormDisabled = useForm("InputRenderer", (state) => state.disabled);
@@ -4767,10 +4933,10 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4767
4933
  }
4768
4934
  switch (props.type) {
4769
4935
  case "blocks":
4770
- return /* @__PURE__ */ jsx(BlocksInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
4936
+ return /* @__PURE__ */ jsx(MemoizedBlocksInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
4771
4937
  case "component":
4772
4938
  return /* @__PURE__ */ jsx(
4773
- ComponentInput,
4939
+ MemoizedComponentInput,
4774
4940
  {
4775
4941
  ...props,
4776
4942
  hint,
@@ -4782,11 +4948,11 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4782
4948
  case "dynamiczone":
4783
4949
  return /* @__PURE__ */ jsx(DynamicZone, { ...props, hint, disabled: fieldIsDisabled });
4784
4950
  case "relation":
4785
- return /* @__PURE__ */ jsx(RelationsField, { ...props, hint, disabled: fieldIsDisabled });
4951
+ return /* @__PURE__ */ jsx(MemoizedRelationsField, { ...props, hint, disabled: fieldIsDisabled });
4786
4952
  case "richtext":
4787
- return /* @__PURE__ */ jsx(Wysiwyg, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
4953
+ return /* @__PURE__ */ jsx(MemoizedWysiwyg, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
4788
4954
  case "uid":
4789
- return /* @__PURE__ */ jsx(UIDInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
4955
+ return /* @__PURE__ */ jsx(MemoizedUIDInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
4790
4956
  case "enumeration":
4791
4957
  return /* @__PURE__ */ jsx(
4792
4958
  InputRenderer$1,
@@ -4858,6 +5024,7 @@ const getMinMax = (attribute) => {
4858
5024
  return { maximum: void 0, minimum: void 0 };
4859
5025
  }
4860
5026
  };
5027
+ const MemoizedInputRenderer = memo(InputRenderer);
4861
5028
  const DynamicComponent = ({
4862
5029
  componentUid,
4863
5030
  disabled,
@@ -4871,7 +5038,6 @@ const DynamicComponent = ({
4871
5038
  dynamicComponentsByCategory = {},
4872
5039
  onAddComponent
4873
5040
  }) => {
4874
- const [isOpen, setIsOpen] = React.useState(true);
4875
5041
  const { formatMessage } = useIntl();
4876
5042
  const formValues = useForm("DynamicComponent", (state) => state.values);
4877
5043
  const {
@@ -4880,7 +5046,7 @@ const DynamicComponent = ({
4880
5046
  const title = React.useMemo(() => {
4881
5047
  const { mainField } = components[componentUid]?.settings ?? { mainField: "id" };
4882
5048
  const mainFieldValue = getIn(formValues, `${name2}.${index}.${mainField}`);
4883
- const displayedValue = mainField === "id" ? "" : String(mainFieldValue).trim();
5049
+ const displayedValue = mainField === "id" || !mainFieldValue ? "" : String(mainFieldValue).trim();
4884
5050
  const mainValue = displayedValue.length > 0 ? `- ${displayedValue}` : displayedValue;
4885
5051
  return mainValue;
4886
5052
  }, [componentUid, components, formValues, name2, index]);
@@ -4891,9 +5057,6 @@ const DynamicComponent = ({
4891
5057
  ) ?? { icon: null, displayName: null };
4892
5058
  return { icon: icon2, displayName: displayName2 };
4893
5059
  }, [componentUid, dynamicComponentsByCategory]);
4894
- const handleToggle = () => {
4895
- setIsOpen((s) => !s);
4896
- };
4897
5060
  const [{ handlerId, isDragging, handleKeyDown }, boxRef, dropRef, dragRef, dragPreviewRef] = useDragAndDrop(!disabled, {
4898
5061
  type: `${ItemTypes.DYNAMIC_ZONE}_${name2}`,
4899
5062
  index,
@@ -4911,9 +5074,9 @@ const DynamicComponent = ({
4911
5074
  dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
4912
5075
  }, [dragPreviewRef, index]);
4913
5076
  const composedBoxRefs = useComposedRefs(boxRef, dropRef);
4914
- const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(ActionsFlex, { gap: 0, children: [
5077
+ const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
4915
5078
  /* @__PURE__ */ jsx(
4916
- IconButtonCustom,
5079
+ IconButton,
4917
5080
  {
4918
5081
  borderWidth: 0,
4919
5082
  label: formatMessage(
@@ -4930,10 +5093,7 @@ const DynamicComponent = ({
4930
5093
  /* @__PURE__ */ jsx(
4931
5094
  IconButton,
4932
5095
  {
4933
- forwardedAs: "div",
4934
- role: "button",
4935
5096
  borderWidth: 0,
4936
- tabIndex: 0,
4937
5097
  onClick: (e) => e.stopPropagation(),
4938
5098
  "data-handler-id": handlerId,
4939
5099
  ref: dragRef,
@@ -4948,7 +5108,7 @@ const DynamicComponent = ({
4948
5108
  /* @__PURE__ */ jsxs(Menu.Root, { children: [
4949
5109
  /* @__PURE__ */ jsxs(Menu.Trigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
4950
5110
  /* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
4951
- /* @__PURE__ */ jsx(VisuallyHidden, { as: "span", children: formatMessage({
5111
+ /* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children: formatMessage({
4952
5112
  id: getTranslation("components.DynamicZone.more-actions"),
4953
5113
  defaultMessage: "More actions"
4954
5114
  }) })
@@ -4977,42 +5137,28 @@ const DynamicComponent = ({
4977
5137
  ] })
4978
5138
  ] })
4979
5139
  ] });
4980
- return /* @__PURE__ */ jsxs(ComponentContainer, { as: "li", width: "100%", children: [
5140
+ const accordionTitle = title ? `${displayName} ${title}` : displayName;
5141
+ const accordionValue = React.useId();
5142
+ return /* @__PURE__ */ jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
4981
5143
  /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Rectangle, { background: "neutral200" }) }),
4982
- /* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsxs(Accordion, { expanded: isOpen, onToggle: handleToggle, size: "S", children: [
4983
- /* @__PURE__ */ jsx(
4984
- AccordionToggle,
4985
- {
4986
- startIcon: /* @__PURE__ */ jsx(ComponentIcon, { icon, showBackground: false, size: "S" }),
4987
- action: accordionActions,
4988
- title: `${displayName} ${title}`,
4989
- togglePosition: "left"
4990
- }
4991
- ),
4992
- /* @__PURE__ */ jsx(AccordionContent$1, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsx(Grid$1, { gap: 4, children: row.map(({ size, ...field }) => {
5144
+ /* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsx(Accordion.Root, { children: /* @__PURE__ */ jsxs(Accordion.Item, { value: accordionValue, children: [
5145
+ /* @__PURE__ */ jsxs(Accordion.Header, { children: [
5146
+ /* @__PURE__ */ jsx(
5147
+ Accordion.Trigger,
5148
+ {
5149
+ icon: icon && COMPONENT_ICONS[icon] ? COMPONENT_ICONS[icon] : COMPONENT_ICONS.dashboard,
5150
+ children: accordionTitle
5151
+ }
5152
+ ),
5153
+ /* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
5154
+ ] }),
5155
+ /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
4993
5156
  const fieldName = `${name2}.${index}.${field.name}`;
4994
- return /* @__PURE__ */ jsx(GridItem, { col: size, s: 12, xs: 12, children: /* @__PURE__ */ jsx(InputRenderer, { ...field, name: fieldName }) }, fieldName);
5157
+ return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field, name: fieldName }) }, fieldName);
4995
5158
  }) }, rowInd)) }) }) })
4996
- ] }) })
5159
+ ] }) }) })
4997
5160
  ] });
4998
5161
  };
4999
- const ActionsFlex = styled(Flex)`
5000
- /*
5001
- we need to remove the background from the button but we can't
5002
- wrap the element in styled because it breaks the forwardedAs which
5003
- we need for drag handler to work on firefox
5004
- */
5005
- div[role='button'] {
5006
- background: transparent;
5007
- }
5008
- `;
5009
- const IconButtonCustom = styled(IconButton)`
5010
- background-color: transparent;
5011
-
5012
- svg path {
5013
- fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : theme.colors.neutral600};
5014
- }
5015
- `;
5016
5162
  const StyledBox = styled(Box)`
5017
5163
  > div:first-child {
5018
5164
  box-shadow: ${({ theme }) => theme.shadows.tableShadow};
@@ -5083,7 +5229,7 @@ const [DynamicZoneProvider, useDynamicZone] = createContext(
5083
5229
  );
5084
5230
  const DynamicZone = ({
5085
5231
  attribute,
5086
- disabled,
5232
+ disabled: disabledProp,
5087
5233
  hint,
5088
5234
  label,
5089
5235
  labelAction,
@@ -5093,7 +5239,8 @@ const DynamicZone = ({
5093
5239
  const { max = Infinity, min = -Infinity } = attribute ?? {};
5094
5240
  const [addComponentIsOpen, setAddComponentIsOpen] = React.useState(false);
5095
5241
  const [liveText, setLiveText] = React.useState("");
5096
- const { components } = useDoc();
5242
+ const { components, isLoading } = useDoc();
5243
+ const disabled = disabledProp || isLoading;
5097
5244
  const { addFieldRow, removeFieldRow, moveFieldRow } = useForm(
5098
5245
  "DynamicZone",
5099
5246
  ({ addFieldRow: addFieldRow2, removeFieldRow: removeFieldRow2, moveFieldRow: moveFieldRow2 }) => ({
@@ -5301,19 +5448,19 @@ const DynamicZone = ({
5301
5448
  ] }) });
5302
5449
  };
5303
5450
  export {
5304
- BlocksInput as B,
5305
- ComponentInput as C,
5306
5451
  DynamicZone as D,
5307
- InputRenderer as I,
5452
+ MemoizedInputRenderer as M,
5308
5453
  NotAllowedInput as N,
5309
- UIDInput as U,
5310
- Wysiwyg as W,
5311
5454
  useDynamicZone as a,
5312
5455
  useFieldHint as b,
5313
5456
  createDefaultForm as c,
5457
+ MemoizedUIDInput as d,
5458
+ MemoizedWysiwyg as e,
5459
+ MemoizedComponentInput as f,
5460
+ MemoizedBlocksInput as g,
5314
5461
  prepareTempKeys as p,
5315
5462
  removeFieldsThatDontExistOnSchema as r,
5316
5463
  transformDocument as t,
5317
5464
  useLazyComponents as u
5318
5465
  };
5319
- //# sourceMappingURL=Field-kVFO4ZKB.mjs.map
5466
+ //# sourceMappingURL=Field-R5NbffTB.mjs.map