@strapi/content-manager 5.0.0-rc.9 → 5.0.0

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 (110) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-BwnO0su2.mjs → ComponentConfigurationPage-DfFSZQxe.mjs} +3 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-BwnO0su2.mjs.map → ComponentConfigurationPage-DfFSZQxe.mjs.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-BOKmq7mz.js → ComponentConfigurationPage-FqfsxQ1j.js} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-BOKmq7mz.js.map → ComponentConfigurationPage-FqfsxQ1j.js.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-N3OaN53v.js → EditConfigurationPage-Cn0e8t3I.js} +3 -3
  6. package/dist/_chunks/{EditConfigurationPage-N3OaN53v.js.map → EditConfigurationPage-Cn0e8t3I.js.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-DJDSIf3D.mjs → EditConfigurationPage-DdPNAbl3.mjs} +3 -3
  8. package/dist/_chunks/{EditConfigurationPage-DJDSIf3D.mjs.map → EditConfigurationPage-DdPNAbl3.mjs.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-IZbGSeL3.mjs → EditViewPage-B82x_x1b.mjs} +15 -5
  10. package/dist/_chunks/EditViewPage-B82x_x1b.mjs.map +1 -0
  11. package/dist/_chunks/{EditViewPage-l9qOdDUI.js → EditViewPage-DlxEHhUt.js} +15 -5
  12. package/dist/_chunks/EditViewPage-DlxEHhUt.js.map +1 -0
  13. package/dist/_chunks/{Field-CWjyW47-.js → Field-COL25JiC.js} +100 -87
  14. package/dist/_chunks/Field-COL25JiC.js.map +1 -0
  15. package/dist/_chunks/{Field-D3mNj-iY.mjs → Field-DufHXW17.mjs} +97 -84
  16. package/dist/_chunks/Field-DufHXW17.mjs.map +1 -0
  17. package/dist/_chunks/{Form-DFXXFrJV.js → Form-BssUwrTO.js} +16 -8
  18. package/dist/_chunks/Form-BssUwrTO.js.map +1 -0
  19. package/dist/_chunks/{Form-Ddy3XYS-.mjs → Form-u_kAOhwB.mjs} +16 -8
  20. package/dist/_chunks/Form-u_kAOhwB.mjs.map +1 -0
  21. package/dist/_chunks/{History-pesEeFFT.js → History-C9t9UqpO.js} +23 -10
  22. package/dist/_chunks/History-C9t9UqpO.js.map +1 -0
  23. package/dist/_chunks/{History-BEFrLZfz.mjs → History-DRwA3oMM.mjs} +24 -11
  24. package/dist/_chunks/History-DRwA3oMM.mjs.map +1 -0
  25. package/dist/_chunks/{ListConfigurationPage-BIoi-Sog.js → ListConfigurationPage-BXYPohh-.js} +2 -2
  26. package/dist/_chunks/{ListConfigurationPage-BIoi-Sog.js.map → ListConfigurationPage-BXYPohh-.js.map} +1 -1
  27. package/dist/_chunks/{ListConfigurationPage-CB_lBFVX.mjs → ListConfigurationPage-BxfQJzPk.mjs} +2 -2
  28. package/dist/_chunks/{ListConfigurationPage-CB_lBFVX.mjs.map → ListConfigurationPage-BxfQJzPk.mjs.map} +1 -1
  29. package/dist/_chunks/{ListViewPage-DBbH7Esr.mjs → ListViewPage-CELx2ysp.mjs} +40 -36
  30. package/dist/_chunks/ListViewPage-CELx2ysp.mjs.map +1 -0
  31. package/dist/_chunks/{ListViewPage-C6FK36UI.js → ListViewPage-D2VD8Szg.js} +43 -39
  32. package/dist/_chunks/ListViewPage-D2VD8Szg.js.map +1 -0
  33. package/dist/_chunks/{NoContentTypePage-Dod8M_xM.js → NoContentTypePage-BV9IjJSM.js} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-Dod8M_xM.js.map → NoContentTypePage-BV9IjJSM.js.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-BU9Omzp4.mjs → NoContentTypePage-DtJ9jcfk.mjs} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-BU9Omzp4.mjs.map → NoContentTypePage-DtJ9jcfk.mjs.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-B88W05rh.mjs → NoPermissionsPage-DWleVYK7.mjs} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-B88W05rh.mjs.map → NoPermissionsPage-DWleVYK7.mjs.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-CMLH3uMk.js → NoPermissionsPage-Dp8NpF9I.js} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-CMLH3uMk.js.map → NoPermissionsPage-Dp8NpF9I.js.map} +1 -1
  41. package/dist/_chunks/{Relations-BBJRxopY.mjs → Relations-BTcf5xaw.mjs} +32 -23
  42. package/dist/_chunks/Relations-BTcf5xaw.mjs.map +1 -0
  43. package/dist/_chunks/{Relations-OXbsEvNt.js → Relations-DR7EUgyC.js} +32 -23
  44. package/dist/_chunks/Relations-DR7EUgyC.js.map +1 -0
  45. package/dist/_chunks/{en-uOUIxfcQ.js → en-Bm0D0IWz.js} +13 -12
  46. package/dist/_chunks/{en-uOUIxfcQ.js.map → en-Bm0D0IWz.js.map} +1 -1
  47. package/dist/_chunks/{en-BrCTWlZv.mjs → en-DKV44jRb.mjs} +13 -12
  48. package/dist/_chunks/{en-BrCTWlZv.mjs.map → en-DKV44jRb.mjs.map} +1 -1
  49. package/dist/_chunks/{index-Bj8wwbdx.js → index-BdMf2lfT.js} +1879 -1765
  50. package/dist/_chunks/index-BdMf2lfT.js.map +1 -0
  51. package/dist/_chunks/{index-BgiNQ7Q9.mjs → index-wnqzm4Q8.mjs} +1899 -1785
  52. package/dist/_chunks/index-wnqzm4Q8.mjs.map +1 -0
  53. package/dist/_chunks/{layout-LOFMsdWo.mjs → layout-2CfjL0T9.mjs} +5 -4
  54. package/dist/_chunks/{layout-LOFMsdWo.mjs.map → layout-2CfjL0T9.mjs.map} +1 -1
  55. package/dist/_chunks/{layout-DBvOIgWG.js → layout-B2MyZU-_.js} +5 -4
  56. package/dist/_chunks/{layout-DBvOIgWG.js.map → layout-B2MyZU-_.js.map} +1 -1
  57. package/dist/_chunks/{relations-BLilXMyN.js → relations-BH7JJGGe.js} +2 -2
  58. package/dist/_chunks/{relations-BLilXMyN.js.map → relations-BH7JJGGe.js.map} +1 -1
  59. package/dist/_chunks/{relations-BTQKCDqX.mjs → relations-C0w0GcXi.mjs} +2 -2
  60. package/dist/_chunks/{relations-BTQKCDqX.mjs.map → relations-C0w0GcXi.mjs.map} +1 -1
  61. package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
  62. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
  63. package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
  64. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
  65. package/dist/admin/index.js +2 -1
  66. package/dist/admin/index.js.map +1 -1
  67. package/dist/admin/index.mjs +5 -4
  68. package/dist/admin/src/exports.d.ts +1 -1
  69. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  70. package/dist/admin/src/hooks/useDocument.d.ts +32 -1
  71. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +0 -32
  72. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  73. package/dist/admin/src/services/api.d.ts +1 -1
  74. package/dist/admin/src/services/components.d.ts +2 -2
  75. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  76. package/dist/admin/src/services/documents.d.ts +19 -17
  77. package/dist/admin/src/services/init.d.ts +1 -1
  78. package/dist/admin/src/services/relations.d.ts +2 -2
  79. package/dist/admin/src/services/uid.d.ts +3 -3
  80. package/dist/server/index.js +48 -21
  81. package/dist/server/index.js.map +1 -1
  82. package/dist/server/index.mjs +48 -21
  83. package/dist/server/index.mjs.map +1 -1
  84. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  85. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  86. package/dist/server/src/history/services/history.d.ts.map +1 -1
  87. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  88. package/dist/server/src/history/services/utils.d.ts +1 -0
  89. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  90. package/dist/shared/contracts/collection-types.d.ts +3 -1
  91. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  92. package/package.json +12 -12
  93. package/dist/_chunks/EditViewPage-IZbGSeL3.mjs.map +0 -1
  94. package/dist/_chunks/EditViewPage-l9qOdDUI.js.map +0 -1
  95. package/dist/_chunks/Field-CWjyW47-.js.map +0 -1
  96. package/dist/_chunks/Field-D3mNj-iY.mjs.map +0 -1
  97. package/dist/_chunks/Form-DFXXFrJV.js.map +0 -1
  98. package/dist/_chunks/Form-Ddy3XYS-.mjs.map +0 -1
  99. package/dist/_chunks/History-BEFrLZfz.mjs.map +0 -1
  100. package/dist/_chunks/History-pesEeFFT.js.map +0 -1
  101. package/dist/_chunks/ListViewPage-C6FK36UI.js.map +0 -1
  102. package/dist/_chunks/ListViewPage-DBbH7Esr.mjs.map +0 -1
  103. package/dist/_chunks/Relations-BBJRxopY.mjs.map +0 -1
  104. package/dist/_chunks/Relations-OXbsEvNt.js.map +0 -1
  105. package/dist/_chunks/index-BgiNQ7Q9.mjs.map +0 -1
  106. package/dist/_chunks/index-Bj8wwbdx.js.map +0 -1
  107. package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
  108. package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
  109. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
  110. package/strapi-server.js +0 -3
@@ -5,9 +5,9 @@ import { useStrapiApp, createContext, useField, useNotification, useForm, useAPI
5
5
  import { Box, SingleSelect, SingleSelectOption, Typography, Flex, BaseLink, Button, Popover, Field, Tooltip, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton, TextInput, IconButtonGroup, Menu, MenuItem } from "@strapi/design-system";
6
6
  import pipe$1 from "lodash/fp/pipe";
7
7
  import { useIntl } from "react-intl";
8
- import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, d as buildValidParams, f as useDocumentRBAC, n as useDocLayout } from "./index-BgiNQ7Q9.mjs";
8
+ import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, n as CLONE_PATH, d as buildValidParams, f as useDocumentRBAC, S as SINGLE_TYPES, o as useDocLayout } from "./index-wnqzm4Q8.mjs";
9
9
  import { generateNKeysBetween } from "fractional-indexing";
10
- import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-BBJRxopY.mjs";
10
+ import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-BTcf5xaw.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
12
  import { styled, css, keyframes } from "styled-components";
13
13
  import { C as ComponentIcon, a as COMPONENT_ICONS } from "./ComponentIcon-u4bIXTFY.mjs";
@@ -17,9 +17,9 @@ 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, u as usePrev } from "./usePrev-DH6iah0A.mjs";
20
+ import { p as prefixFileUrlWithBackendUrl, u as usePrev, a as useDebounce } from "./useDebounce-DmuSJIF3.mjs";
21
21
  import * as Toolbar from "@radix-ui/react-toolbar";
22
- import { useLocation } from "react-router-dom";
22
+ import { useLocation, useMatch } from "react-router-dom";
23
23
  import CodeMirror from "codemirror5";
24
24
  import sanitizeHtml from "sanitize-html";
25
25
  import { getLanguage, highlight, highlightAuto } from "highlight.js";
@@ -1407,7 +1407,7 @@ const ToolbarButton = ({
1407
1407
  width: 7,
1408
1408
  height: 7,
1409
1409
  hasRadius: true,
1410
- children: /* @__PURE__ */ jsx(Icon, { width: "1.2rem", height: "1.2rem", fill: disabled ? "neutral300" : enabledColor })
1410
+ children: /* @__PURE__ */ jsx(Icon, { fill: disabled ? "neutral300" : enabledColor })
1411
1411
  }
1412
1412
  )
1413
1413
  }
@@ -1749,6 +1749,7 @@ const DragItem = styled(Flex)`
1749
1749
  }
1750
1750
  `;
1751
1751
  const DragIconButton = styled(IconButton)`
1752
+ user-select: none;
1752
1753
  display: flex;
1753
1754
  align-items: center;
1754
1755
  justify-content: center;
@@ -1877,6 +1878,7 @@ const DragAndDropElement = ({
1877
1878
  DragIconButton,
1878
1879
  {
1879
1880
  tag: "div",
1881
+ contentEditable: false,
1880
1882
  role: "button",
1881
1883
  tabIndex: 0,
1882
1884
  withTooltip: false,
@@ -2702,13 +2704,34 @@ const RepeatableComponent = ({
2702
2704
  const { search: searchString } = useLocation();
2703
2705
  const search = React.useMemo(() => new URLSearchParams(searchString), [searchString]);
2704
2706
  const { components } = useDoc();
2705
- const { value = [], error } = useField(name2);
2707
+ const {
2708
+ value = [],
2709
+ error,
2710
+ rawError
2711
+ } = useField(name2);
2706
2712
  const addFieldRow = useForm("RepeatableComponent", (state) => state.addFieldRow);
2707
2713
  const moveFieldRow = useForm("RepeatableComponent", (state) => state.moveFieldRow);
2708
2714
  const removeFieldRow = useForm("RepeatableComponent", (state) => state.removeFieldRow);
2709
2715
  const { max = Infinity } = attribute;
2710
2716
  const [collapseToOpen, setCollapseToOpen] = React.useState("");
2711
2717
  const [liveText, setLiveText] = React.useState("");
2718
+ React.useEffect(() => {
2719
+ const hasNestedErrors = rawError && Array.isArray(rawError) && rawError.length > 0;
2720
+ const hasNestedValue = value && Array.isArray(value) && value.length > 0;
2721
+ if (hasNestedErrors && hasNestedValue) {
2722
+ const errorOpenItems = rawError.map((_, idx) => {
2723
+ return value[idx] ? value[idx].__temp_key__ : null;
2724
+ }).filter((value2) => !!value2);
2725
+ if (errorOpenItems && errorOpenItems.length > 0) {
2726
+ setCollapseToOpen((collapseToOpen2) => {
2727
+ if (!errorOpenItems.includes(collapseToOpen2)) {
2728
+ return errorOpenItems[0];
2729
+ }
2730
+ return collapseToOpen2;
2731
+ });
2732
+ }
2733
+ }
2734
+ }, [rawError, value]);
2712
2735
  const componentTmpKeyWithFocussedField = React.useMemo(() => {
2713
2736
  if (search.has("field")) {
2714
2737
  const fieldParam = search.get("field");
@@ -3256,18 +3279,6 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
3256
3279
  /* @__PURE__ */ jsx(Field.Hint, {})
3257
3280
  ] });
3258
3281
  };
3259
- function useDebounce(value, delay) {
3260
- const [debouncedValue, setDebouncedValue] = useState(value);
3261
- useEffect(() => {
3262
- const handler = setTimeout(() => {
3263
- setDebouncedValue(value);
3264
- }, delay);
3265
- return () => {
3266
- clearTimeout(handler);
3267
- };
3268
- }, [value, delay]);
3269
- return debouncedValue;
3270
- }
3271
3282
  const uidApi = contentManagerApi.injectEndpoints({
3272
3283
  endpoints: (builder) => ({
3273
3284
  getDefaultUID: builder.query({
@@ -3302,7 +3313,10 @@ const uidApi = contentManagerApi.injectEndpoints({
3302
3313
  config: {
3303
3314
  params
3304
3315
  }
3305
- })
3316
+ }),
3317
+ providesTags: (_res, _error, params) => [
3318
+ { type: "UidAvailability", id: params.contentTypeUID }
3319
+ ]
3306
3320
  })
3307
3321
  })
3308
3322
  });
@@ -3314,8 +3328,10 @@ const UIDInput = React.forwardRef(
3314
3328
  const allFormValues = useForm("InputUID", (form) => form.values);
3315
3329
  const [availability, setAvailability] = React.useState();
3316
3330
  const [showRegenerate, setShowRegenerate] = React.useState(false);
3331
+ const isCloning = useMatch(CLONE_PATH) !== null;
3317
3332
  const field = useField(name2);
3318
3333
  const debouncedValue = useDebounce(field.value, 300);
3334
+ const hasChanged = debouncedValue !== field.initialValue;
3319
3335
  const { toggleNotification } = useNotification();
3320
3336
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
3321
3337
  const { formatMessage } = useIntl();
@@ -3391,8 +3407,9 @@ const UIDInput = React.forwardRef(
3391
3407
  params
3392
3408
  },
3393
3409
  {
3410
+ // Don't check availability if the value is empty or wasn't changed
3394
3411
  skip: !Boolean(
3395
- debouncedValue !== field.initialValue && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3412
+ (hasChanged || isCloning) && debouncedValue && UID_REGEX.test(debouncedValue.trim())
3396
3413
  )
3397
3414
  }
3398
3415
  );
@@ -3421,6 +3438,7 @@ const UIDInput = React.forwardRef(
3421
3438
  const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
3422
3439
  const fieldRef = useFocusInputField(name2);
3423
3440
  const composedRefs = useComposedRefs(ref, fieldRef);
3441
+ const shouldShowAvailability = (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;
3424
3442
  return /* @__PURE__ */ jsxs(Field.Root, { hint, name: name2, error: field.error, required, children: [
3425
3443
  /* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
3426
3444
  /* @__PURE__ */ jsx(
@@ -3429,7 +3447,7 @@ const UIDInput = React.forwardRef(
3429
3447
  ref: composedRefs,
3430
3448
  disabled: props.disabled,
3431
3449
  endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
3432
- availability && !showRegenerate && /* @__PURE__ */ jsxs(
3450
+ shouldShowAvailability && /* @__PURE__ */ jsxs(
3433
3451
  TextValidation,
3434
3452
  {
3435
3453
  alignItems: "center",
@@ -4578,31 +4596,11 @@ const quoteAndCodeHandler = (editor, markdownType) => {
4578
4596
  insertWithoutTextToEdit(editor, markdownType, line, contentLength);
4579
4597
  }
4580
4598
  };
4581
- const CustomIconButton = styled(IconButton)`
4582
- padding: ${({ theme }) => theme.spaces[2]};
4583
-
4584
- svg {
4585
- width: 1.8rem;
4586
- height: 1.8rem;
4587
- }
4588
- `;
4589
- const CustomLinkIconButton = styled(CustomIconButton)`
4590
- svg {
4591
- width: 0.8rem;
4592
- height: 0.8rem;
4593
- }
4594
- `;
4595
4599
  const MainButtons = styled(IconButtonGroup)`
4596
4600
  margin-left: ${({ theme }) => theme.spaces[4]};
4597
4601
  `;
4598
4602
  const MoreButton = styled(IconButton)`
4599
4603
  margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
4600
- padding: ${({ theme }) => theme.spaces[2]};
4601
-
4602
- svg {
4603
- width: 1.8rem;
4604
- height: 1.8rem;
4605
- }
4606
4604
  `;
4607
4605
  const IconButtonGroupMargin = styled(IconButtonGroup)`
4608
4606
  margin-right: ${({ theme }) => `${theme.spaces[2]}`};
@@ -4686,9 +4684,9 @@ const WysiwygNav = ({
4686
4684
  }
4687
4685
  ) }),
4688
4686
  /* @__PURE__ */ jsxs(MainButtons, { children: [
4689
- /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
4690
- /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
4691
- /* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
4687
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
4688
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
4689
+ /* @__PURE__ */ jsx(IconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
4692
4690
  ] }),
4693
4691
  /* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsx(More, {}) })
4694
4692
  ] }),
@@ -4727,17 +4725,9 @@ const WysiwygNav = ({
4727
4725
  }
4728
4726
  ) }),
4729
4727
  /* @__PURE__ */ jsxs(MainButtons, { children: [
4728
+ /* @__PURE__ */ jsx(IconButton, { onClick: () => onActionClick("Bold", editorRef), label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
4730
4729
  /* @__PURE__ */ jsx(
4731
- CustomIconButton,
4732
- {
4733
- onClick: () => onActionClick("Bold", editorRef),
4734
- label: "Bold",
4735
- name: "Bold",
4736
- children: /* @__PURE__ */ jsx(Bold, {})
4737
- }
4738
- ),
4739
- /* @__PURE__ */ jsx(
4740
- CustomIconButton,
4730
+ IconButton,
4741
4731
  {
4742
4732
  onClick: () => onActionClick("Italic", editorRef),
4743
4733
  label: "Italic",
@@ -4746,7 +4736,7 @@ const WysiwygNav = ({
4746
4736
  }
4747
4737
  ),
4748
4738
  /* @__PURE__ */ jsx(
4749
- CustomIconButton,
4739
+ IconButton,
4750
4740
  {
4751
4741
  onClick: () => onActionClick("Underline", editorRef),
4752
4742
  label: "Underline",
@@ -4760,7 +4750,7 @@ const WysiwygNav = ({
4760
4750
  /* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
4761
4751
  /* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
4762
4752
  /* @__PURE__ */ jsx(
4763
- CustomIconButton,
4753
+ IconButton,
4764
4754
  {
4765
4755
  onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
4766
4756
  label: "Strikethrough",
@@ -4769,7 +4759,7 @@ const WysiwygNav = ({
4769
4759
  }
4770
4760
  ),
4771
4761
  /* @__PURE__ */ jsx(
4772
- CustomIconButton,
4762
+ IconButton,
4773
4763
  {
4774
4764
  onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
4775
4765
  label: "BulletList",
@@ -4778,7 +4768,7 @@ const WysiwygNav = ({
4778
4768
  }
4779
4769
  ),
4780
4770
  /* @__PURE__ */ jsx(
4781
- CustomIconButton,
4771
+ IconButton,
4782
4772
  {
4783
4773
  onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
4784
4774
  label: "NumberList",
@@ -4789,7 +4779,7 @@ const WysiwygNav = ({
4789
4779
  ] }),
4790
4780
  /* @__PURE__ */ jsxs(IconButtonGroup, { children: [
4791
4781
  /* @__PURE__ */ jsx(
4792
- CustomIconButton,
4782
+ IconButton,
4793
4783
  {
4794
4784
  onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
4795
4785
  label: "Code",
@@ -4798,7 +4788,7 @@ const WysiwygNav = ({
4798
4788
  }
4799
4789
  ),
4800
4790
  /* @__PURE__ */ jsx(
4801
- CustomIconButton,
4791
+ IconButton,
4802
4792
  {
4803
4793
  onClick: () => {
4804
4794
  handleTogglePopover();
@@ -4810,7 +4800,7 @@ const WysiwygNav = ({
4810
4800
  }
4811
4801
  ),
4812
4802
  /* @__PURE__ */ jsx(
4813
- CustomLinkIconButton,
4803
+ IconButton,
4814
4804
  {
4815
4805
  onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
4816
4806
  label: "Link",
@@ -4819,7 +4809,7 @@ const WysiwygNav = ({
4819
4809
  }
4820
4810
  ),
4821
4811
  /* @__PURE__ */ jsx(
4822
- CustomIconButton,
4812
+ IconButton,
4823
4813
  {
4824
4814
  onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
4825
4815
  label: "Quote",
@@ -4956,15 +4946,19 @@ const Wysiwyg = React.forwardRef(
4956
4946
  );
4957
4947
  const MemoizedWysiwyg = React.memo(Wysiwyg);
4958
4948
  const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4959
- const { id } = useDoc();
4949
+ const { id, document: document2, collectionType } = useDoc();
4960
4950
  const isFormDisabled = useForm("InputRenderer", (state) => state.disabled);
4961
4951
  const isInDynamicZone = useDynamicZone("isInDynamicZone", (state) => state.isInDynamicZone);
4962
4952
  const canCreateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canCreateFields);
4963
4953
  const canReadFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canReadFields);
4964
4954
  const canUpdateFields = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUpdateFields);
4965
4955
  const canUserAction = useDocumentRBAC("InputRenderer", (rbac) => rbac.canUserAction);
4966
- const editableFields = id ? canUpdateFields : canCreateFields;
4967
- const readableFields = id ? canReadFields : canCreateFields;
4956
+ let idToCheck = id;
4957
+ if (collectionType === SINGLE_TYPES) {
4958
+ idToCheck = document2?.documentId;
4959
+ }
4960
+ const editableFields = idToCheck ? canUpdateFields : canCreateFields;
4961
+ const readableFields = idToCheck ? canReadFields : canCreateFields;
4968
4962
  const canUserReadField = canUserAction(props.name, readableFields, props.type);
4969
4963
  const canUserEditField = canUserAction(props.name, editableFields, props.type);
4970
4964
  const fields = useStrapiApp("InputRenderer", (app) => app.fields);
@@ -4975,6 +4969,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4975
4969
  const {
4976
4970
  edit: { components }
4977
4971
  } = useDocLayout();
4972
+ const field = useField(props.name);
4978
4973
  if (!visible) {
4979
4974
  return null;
4980
4975
  }
@@ -4985,7 +4980,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
4985
4980
  if (attributeHasCustomFieldProperty(props.attribute)) {
4986
4981
  const CustomInput = lazyComponentStore[props.attribute.customField];
4987
4982
  if (CustomInput) {
4988
- return /* @__PURE__ */ jsx(CustomInput, { ...props, hint, disabled: fieldIsDisabled });
4983
+ return /* @__PURE__ */ jsx(CustomInput, { ...props, ...field, hint, disabled: fieldIsDisabled });
4989
4984
  }
4990
4985
  return /* @__PURE__ */ jsx(
4991
4986
  InputRenderer$1,
@@ -5146,6 +5141,14 @@ const DynamicComponent = ({
5146
5141
  React.useEffect(() => {
5147
5142
  dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
5148
5143
  }, [dragPreviewRef, index]);
5144
+ const accordionValue = React.useId();
5145
+ const { value = [], rawError } = useField(`${name2}.${index}`);
5146
+ const [collapseToOpen, setCollapseToOpen] = React.useState("");
5147
+ React.useEffect(() => {
5148
+ if (rawError && value) {
5149
+ setCollapseToOpen(accordionValue);
5150
+ }
5151
+ }, [rawError, value, accordionValue]);
5149
5152
  const composedBoxRefs = useComposedRefs(boxRef, dropRef);
5150
5153
  const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
5151
5154
  /* @__PURE__ */ jsx(
@@ -5211,10 +5214,9 @@ const DynamicComponent = ({
5211
5214
  ] })
5212
5215
  ] });
5213
5216
  const accordionTitle = title ? `${displayName} ${title}` : displayName;
5214
- const accordionValue = React.useId();
5215
5217
  return /* @__PURE__ */ jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
5216
5218
  /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Rectangle, { background: "neutral200" }) }),
5217
- /* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsx(Accordion.Root, { children: /* @__PURE__ */ jsxs(Accordion.Item, { value: accordionValue, children: [
5219
+ /* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsx(Accordion.Root, { value: collapseToOpen, onValueChange: setCollapseToOpen, children: /* @__PURE__ */ jsxs(Accordion.Item, { value: accordionValue, children: [
5218
5220
  /* @__PURE__ */ jsxs(Accordion.Header, { children: [
5219
5221
  /* @__PURE__ */ jsx(
5220
5222
  Accordion.Trigger,
@@ -5225,21 +5227,32 @@ const DynamicComponent = ({
5225
5227
  ),
5226
5228
  /* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
5227
5229
  ] }),
5228
- /* @__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 }) => {
5229
- const fieldName = `${name2}.${index}.${field.name}`;
5230
- return /* @__PURE__ */ jsx(
5231
- Grid$1.Item,
5232
- {
5233
- col: size,
5234
- s: 12,
5235
- xs: 12,
5236
- direction: "column",
5237
- alignItems: "stretch",
5238
- children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field, name: fieldName })
5239
- },
5240
- fieldName
5241
- );
5242
- }) }, rowInd)) }) }) })
5230
+ /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsx(
5231
+ Grid$1.Item,
5232
+ {
5233
+ col: 12,
5234
+ s: 12,
5235
+ xs: 12,
5236
+ direction: "column",
5237
+ alignItems: "stretch",
5238
+ children: /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
5239
+ const fieldName = `${name2}.${index}.${field.name}`;
5240
+ return /* @__PURE__ */ jsx(
5241
+ Grid$1.Item,
5242
+ {
5243
+ col: size,
5244
+ s: 12,
5245
+ xs: 12,
5246
+ direction: "column",
5247
+ alignItems: "stretch",
5248
+ children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field, name: fieldName })
5249
+ },
5250
+ fieldName
5251
+ );
5252
+ }) })
5253
+ },
5254
+ rowInd
5255
+ )) }) }) }) })
5243
5256
  ] }) }) })
5244
5257
  ] });
5245
5258
  };
@@ -5547,4 +5560,4 @@ export {
5547
5560
  transformDocument as t,
5548
5561
  useLazyComponents as u
5549
5562
  };
5550
- //# sourceMappingURL=Field-D3mNj-iY.mjs.map
5563
+ //# sourceMappingURL=Field-DufHXW17.mjs.map