@strapi/content-manager 0.0.0-experimental.e60ec1829240dae21c1e1d29076681c322288813 → 0.0.0-experimental.eba25ec571b091c6bde1104eb6c753debdf15462
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.
- package/LICENSE +18 -3
- package/dist/_chunks/{CardDragPreview-DSVYodBX.js → CardDragPreview-C0QyJgRA.js} +10 -14
- package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -0
- package/dist/_chunks/{CardDragPreview-ikSG4M46.mjs → CardDragPreview-DOxamsuj.mjs} +7 -9
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -0
- package/dist/_chunks/{ComponentConfigurationPage-BPvzFjM7.mjs → ComponentConfigurationPage-BaJMOQyq.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-BPvzFjM7.mjs.map → ComponentConfigurationPage-BaJMOQyq.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DjWJdz6Y.js → ComponentConfigurationPage-N-CTtgQa.js} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-DjWJdz6Y.js.map → ComponentConfigurationPage-N-CTtgQa.js.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BBQsYCVn.js → ComponentIcon-BXdiCGQp.js} +8 -2
- package/dist/_chunks/ComponentIcon-BXdiCGQp.js.map +1 -0
- package/dist/_chunks/{ComponentIcon-BOFnK76n.mjs → ComponentIcon-u4bIXTFY.mjs} +9 -3
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -0
- package/dist/_chunks/{EditConfigurationPage-Dmv83RlS.js → EditConfigurationPage-BHkjAbxH.js} +4 -4
- package/dist/_chunks/{EditConfigurationPage-Dmv83RlS.js.map → EditConfigurationPage-BHkjAbxH.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DacbqQ_f.mjs → EditConfigurationPage-CKK-5LfX.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-DacbqQ_f.mjs.map → EditConfigurationPage-CKK-5LfX.mjs.map} +1 -1
- package/dist/_chunks/EditViewPage-B11aeMcf.mjs +254 -0
- package/dist/_chunks/EditViewPage-B11aeMcf.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-DvNpQkam.js → EditViewPage-QPUftxUd.js} +101 -52
- package/dist/_chunks/EditViewPage-QPUftxUd.js.map +1 -0
- package/dist/_chunks/{Field-6gvGdPBV.mjs → Field-Bj_RgtGo.mjs} +1077 -814
- package/dist/_chunks/Field-Bj_RgtGo.mjs.map +1 -0
- package/dist/_chunks/{Field-DmVKIAOo.js → Field-DUK83cfh.js} +1121 -859
- package/dist/_chunks/Field-DUK83cfh.js.map +1 -0
- package/dist/_chunks/{Form-CPZC9vWa.js → Form-DHmBRlHd.js} +66 -46
- package/dist/_chunks/Form-DHmBRlHd.js.map +1 -0
- package/dist/_chunks/{Form-DW6K1IH-.mjs → Form-DLMSoXV7.mjs} +66 -45
- package/dist/_chunks/Form-DLMSoXV7.mjs.map +1 -0
- package/dist/_chunks/{History-Dmr9fmUA.mjs → History-CfCSNlG9.mjs} +181 -144
- package/dist/_chunks/History-CfCSNlG9.mjs.map +1 -0
- package/dist/_chunks/{History-DeAPlvtv.js → History-Di3zm4HT.js} +181 -145
- package/dist/_chunks/History-Di3zm4HT.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DhwvYcNv.mjs → ListConfigurationPage-0mtv_iqk.mjs} +67 -56
- package/dist/_chunks/ListConfigurationPage-0mtv_iqk.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DPCwW5Vr.js → ListConfigurationPage-Cq361KIt.js} +70 -60
- package/dist/_chunks/ListConfigurationPage-Cq361KIt.js.map +1 -0
- package/dist/_chunks/{ListViewPage-BtAwuYLE.mjs → ListViewPage-BxLVROX8.mjs} +175 -159
- package/dist/_chunks/ListViewPage-BxLVROX8.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-5ySZ-VUs.js → ListViewPage-DFDcG8gM.js} +178 -162
- package/dist/_chunks/ListViewPage-DFDcG8gM.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DSPxnxxp.mjs → NoContentTypePage-BRfDd67_.mjs} +3 -3
- package/dist/_chunks/NoContentTypePage-BRfDd67_.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DOC_yWOf.js → NoContentTypePage-BSyvnDZZ.js} +3 -3
- package/dist/_chunks/NoContentTypePage-BSyvnDZZ.js.map +1 -0
- package/dist/_chunks/{NoPermissionsPage-UWDC-1Tw.mjs → NoPermissionsPage-CV9V8KWa.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-UWDC-1Tw.mjs.map → NoPermissionsPage-CV9V8KWa.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-Dwu8rRJu.js → NoPermissionsPage-DyLphsn_.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-Dwu8rRJu.js.map → NoPermissionsPage-DyLphsn_.js.map} +1 -1
- package/dist/_chunks/Preview-C_B1nx3g.mjs +272 -0
- package/dist/_chunks/Preview-C_B1nx3g.mjs.map +1 -0
- package/dist/_chunks/Preview-D_3aO6Ly.js +291 -0
- package/dist/_chunks/Preview-D_3aO6Ly.js.map +1 -0
- package/dist/_chunks/{Relations-J8cscLlR.mjs → Relations-C6pwmDXh.mjs} +135 -89
- package/dist/_chunks/Relations-C6pwmDXh.mjs.map +1 -0
- package/dist/_chunks/{Relations-CgWtgnPe.js → Relations-Cne2AlrL.js} +138 -93
- package/dist/_chunks/Relations-Cne2AlrL.js.map +1 -0
- package/dist/_chunks/{en-MBPul9Su.mjs → en-DhFUjrNW.mjs} +37 -18
- package/dist/_chunks/{en-MBPul9Su.mjs.map → en-DhFUjrNW.mjs.map} +1 -1
- package/dist/_chunks/{en-C-V1_90f.js → en-Ic0kXjxB.js} +37 -18
- package/dist/_chunks/{en-C-V1_90f.js.map → en-Ic0kXjxB.js.map} +1 -1
- package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
- package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
- package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
- package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
- package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
- package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
- package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
- package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
- package/dist/_chunks/{index-CwRRo1V9.mjs → index-BpxR3En4.mjs} +1835 -824
- package/dist/_chunks/index-BpxR3En4.mjs.map +1 -0
- package/dist/_chunks/{index-C6AH2hEl.js → index-T-aWjbj2.js} +1788 -777
- package/dist/_chunks/index-T-aWjbj2.js.map +1 -0
- package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
- package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
- package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
- package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
- package/dist/_chunks/{layout-B_SXLhqf.js → layout-BEuNwv-F.js} +45 -29
- package/dist/_chunks/layout-BEuNwv-F.js.map +1 -0
- package/dist/_chunks/{layout-jIDzX0Fp.mjs → layout-DhMZ_lDx.mjs} +45 -27
- package/dist/_chunks/layout-DhMZ_lDx.mjs.map +1 -0
- package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
- package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
- package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
- package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
- package/dist/_chunks/{relations-CuvIgCqI.mjs → relations-BdnxoX6f.mjs} +6 -7
- package/dist/_chunks/relations-BdnxoX6f.mjs.map +1 -0
- package/dist/_chunks/{relations-iBMa_OFG.js → relations-kLcuobLk.js} +6 -7
- package/dist/_chunks/relations-kLcuobLk.js.map +1 -0
- package/dist/_chunks/useDebounce-CtcjDB3L.js +28 -0
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
- package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs.map +1 -1
- package/dist/_chunks/useDragAndDrop-J0TUUbR6.js.map +1 -1
- package/dist/admin/index.js +3 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +9 -7
- package/dist/admin/src/components/ComponentIcon.d.ts +6 -3
- package/dist/admin/src/content-manager.d.ts +3 -3
- package/dist/admin/src/exports.d.ts +2 -1
- package/dist/admin/src/history/components/VersionInputRenderer.d.ts +1 -1
- package/dist/admin/src/history/index.d.ts +3 -0
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +37 -9
- package/dist/admin/src/hooks/useDocumentActions.d.ts +24 -3
- package/dist/admin/src/hooks/useDocumentLayout.d.ts +2 -2
- package/dist/admin/src/hooks/useDragAndDrop.d.ts +4 -4
- package/dist/admin/src/hooks/useKeyboardDragAndDrop.d.ts +1 -1
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +11 -4
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksInput.d.ts +3 -3
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +4 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Component/Input.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.d.ts +3 -5
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +30 -18
- package/dist/admin/src/pages/EditView/components/FormInputs/UID.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +3 -49
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +16 -53
- package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
- package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +2 -10
- package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
- package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
- package/dist/admin/src/pages/ListView/components/BulkActions/PublishAction.d.ts +9 -26
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
- package/dist/admin/src/preview/constants.d.ts +1 -0
- package/dist/admin/src/preview/index.d.ts +4 -0
- package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
- package/dist/admin/src/preview/routes.d.ts +3 -0
- package/dist/admin/src/preview/services/preview.d.ts +3 -0
- package/dist/admin/src/router.d.ts +1 -1
- package/dist/admin/src/services/api.d.ts +2 -3
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +5 -5
- package/dist/admin/src/services/documents.d.ts +31 -20
- package/dist/admin/src/services/init.d.ts +2 -2
- package/dist/admin/src/services/relations.d.ts +3 -3
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/admin/src/utils/api.d.ts +4 -18
- package/dist/admin/src/utils/validation.d.ts +5 -7
- package/dist/server/index.js +852 -436
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +859 -443
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/single-types.d.ts.map +1 -1
- package/dist/server/src/controllers/uid.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +22 -0
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/dimensions.d.ts +11 -0
- package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/index.d.ts +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +4 -4
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +21 -42
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
- package/dist/server/src/preview/constants.d.ts +2 -0
- package/dist/server/src/preview/constants.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/index.d.ts +2 -0
- package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/preview.d.ts +13 -0
- package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
- package/dist/server/src/preview/index.d.ts +4 -0
- package/dist/server/src/preview/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/index.d.ts +8 -0
- package/dist/server/src/preview/routes/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/preview.d.ts +4 -0
- package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
- package/dist/server/src/preview/services/index.d.ts +16 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview-config.d.ts +32 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview.d.ts +12 -0
- package/dist/server/src/preview/services/preview.d.ts.map +1 -0
- package/dist/server/src/preview/utils.d.ts +19 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -0
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts +13 -12
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts +14 -35
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +21 -42
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/permission-checker.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
- package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts +8 -1
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +17 -7
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/dist/shared/contracts/index.d.ts +1 -0
- package/dist/shared/contracts/index.d.ts.map +1 -1
- package/dist/shared/contracts/preview.d.ts +27 -0
- package/dist/shared/contracts/preview.d.ts.map +1 -0
- package/dist/shared/contracts/relations.d.ts +2 -2
- package/dist/shared/contracts/relations.d.ts.map +1 -1
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +4 -0
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +19 -20
- package/dist/_chunks/CardDragPreview-DSVYodBX.js.map +0 -1
- package/dist/_chunks/CardDragPreview-ikSG4M46.mjs.map +0 -1
- package/dist/_chunks/ComponentIcon-BBQsYCVn.js.map +0 -1
- package/dist/_chunks/ComponentIcon-BOFnK76n.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-DDS6H9HO.mjs +0 -203
- package/dist/_chunks/EditViewPage-DDS6H9HO.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-DvNpQkam.js.map +0 -1
- package/dist/_chunks/Field-6gvGdPBV.mjs.map +0 -1
- package/dist/_chunks/Field-DmVKIAOo.js.map +0 -1
- package/dist/_chunks/Form-CPZC9vWa.js.map +0 -1
- package/dist/_chunks/Form-DW6K1IH-.mjs.map +0 -1
- package/dist/_chunks/History-DeAPlvtv.js.map +0 -1
- package/dist/_chunks/History-Dmr9fmUA.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DPCwW5Vr.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DhwvYcNv.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-5ySZ-VUs.js.map +0 -1
- package/dist/_chunks/ListViewPage-BtAwuYLE.mjs.map +0 -1
- package/dist/_chunks/NoContentTypePage-DOC_yWOf.js.map +0 -1
- package/dist/_chunks/NoContentTypePage-DSPxnxxp.mjs.map +0 -1
- package/dist/_chunks/Relations-CgWtgnPe.js.map +0 -1
- package/dist/_chunks/Relations-J8cscLlR.mjs.map +0 -1
- package/dist/_chunks/index-C6AH2hEl.js.map +0 -1
- package/dist/_chunks/index-CwRRo1V9.mjs.map +0 -1
- package/dist/_chunks/layout-B_SXLhqf.js.map +0 -1
- package/dist/_chunks/layout-jIDzX0Fp.mjs.map +0 -1
- package/dist/_chunks/relations-CuvIgCqI.mjs.map +0 -1
- package/dist/_chunks/relations-iBMa_OFG.js.map +0 -1
- package/dist/_chunks/urls-CbOsUOoW.mjs +0 -7
- package/dist/_chunks/urls-CbOsUOoW.mjs.map +0 -1
- package/dist/_chunks/urls-DzZya_gm.js +0 -6
- package/dist/_chunks/urls-DzZya_gm.js.map +0 -1
- package/dist/server/src/controllers/utils/dimensions.d.ts +0 -5
- package/dist/server/src/controllers/utils/dimensions.d.ts.map +0 -1
- package/strapi-server.js +0 -3
@@ -5,19 +5,19 @@ const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
5
5
|
const designSystem = require("@strapi/design-system");
|
6
6
|
const pipe$1 = require("lodash/fp/pipe");
|
7
7
|
const reactIntl = require("react-intl");
|
8
|
-
const index = require("./index-
|
8
|
+
const index = require("./index-T-aWjbj2.js");
|
9
9
|
const fractionalIndexing = require("fractional-indexing");
|
10
|
-
const Relations = require("./Relations-
|
10
|
+
const Relations = require("./Relations-Cne2AlrL.js");
|
11
11
|
const Icons = require("@strapi/icons");
|
12
|
-
const
|
13
|
-
const ComponentIcon = require("./ComponentIcon-
|
12
|
+
const styledComponents = require("styled-components");
|
13
|
+
const ComponentIcon = require("./ComponentIcon-BXdiCGQp.js");
|
14
14
|
const reactDndHtml5Backend = require("react-dnd-html5-backend");
|
15
15
|
const useDragAndDrop = require("./useDragAndDrop-J0TUUbR6.js");
|
16
|
-
const objects = require("./objects-
|
16
|
+
const objects = require("./objects-BcXOv6_9.js");
|
17
17
|
const slate = require("slate");
|
18
18
|
const slateHistory = require("slate-history");
|
19
19
|
const slateReact = require("slate-react");
|
20
|
-
const
|
20
|
+
const useDebounce = require("./useDebounce-CtcjDB3L.js");
|
21
21
|
const Toolbar = require("@radix-ui/react-toolbar");
|
22
22
|
const reactRouterDom = require("react-router-dom");
|
23
23
|
const CodeMirror = require("codemirror5");
|
@@ -56,7 +56,6 @@ function _interopNamespace(e) {
|
|
56
56
|
}
|
57
57
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
58
58
|
const pipe__default = /* @__PURE__ */ _interopDefault(pipe$1);
|
59
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
60
59
|
const Toolbar__namespace = /* @__PURE__ */ _interopNamespace(Toolbar);
|
61
60
|
const CodeMirror__default = /* @__PURE__ */ _interopDefault(CodeMirror);
|
62
61
|
const sanitizeHtml__default = /* @__PURE__ */ _interopDefault(sanitizeHtml);
|
@@ -195,6 +194,220 @@ const useLazyComponents = (componentUids = []) => {
|
|
195
194
|
}, []);
|
196
195
|
return { isLazyLoading: loading, lazyComponentStore, cleanup };
|
197
196
|
};
|
197
|
+
const codeLanguages = [
|
198
|
+
{
|
199
|
+
value: "asm",
|
200
|
+
label: "Assembly"
|
201
|
+
},
|
202
|
+
{
|
203
|
+
value: "bash",
|
204
|
+
label: "Bash"
|
205
|
+
},
|
206
|
+
{
|
207
|
+
value: "c",
|
208
|
+
label: "C"
|
209
|
+
},
|
210
|
+
{
|
211
|
+
value: "clojure",
|
212
|
+
label: "Clojure"
|
213
|
+
},
|
214
|
+
{
|
215
|
+
value: "cobol",
|
216
|
+
label: "COBOL"
|
217
|
+
},
|
218
|
+
{
|
219
|
+
value: "cpp",
|
220
|
+
label: "C++"
|
221
|
+
},
|
222
|
+
{
|
223
|
+
value: "csharp",
|
224
|
+
label: "C#"
|
225
|
+
},
|
226
|
+
{
|
227
|
+
value: "css",
|
228
|
+
label: "CSS"
|
229
|
+
},
|
230
|
+
{
|
231
|
+
value: "dart",
|
232
|
+
label: "Dart"
|
233
|
+
},
|
234
|
+
{
|
235
|
+
value: "dockerfile",
|
236
|
+
label: "Dockerfile"
|
237
|
+
},
|
238
|
+
{
|
239
|
+
value: "elixir",
|
240
|
+
label: "Elixir"
|
241
|
+
},
|
242
|
+
{
|
243
|
+
value: "erlang",
|
244
|
+
label: "Erlang"
|
245
|
+
},
|
246
|
+
{
|
247
|
+
value: "fortran",
|
248
|
+
label: "Fortran"
|
249
|
+
},
|
250
|
+
{
|
251
|
+
value: "fsharp",
|
252
|
+
label: "F#"
|
253
|
+
},
|
254
|
+
{
|
255
|
+
value: "go",
|
256
|
+
label: "Go"
|
257
|
+
},
|
258
|
+
{
|
259
|
+
value: "graphql",
|
260
|
+
label: "GraphQL"
|
261
|
+
},
|
262
|
+
{
|
263
|
+
value: "groovy",
|
264
|
+
label: "Groovy"
|
265
|
+
},
|
266
|
+
{
|
267
|
+
value: "haskell",
|
268
|
+
label: "Haskell"
|
269
|
+
},
|
270
|
+
{
|
271
|
+
value: "haxe",
|
272
|
+
label: "Haxe"
|
273
|
+
},
|
274
|
+
{
|
275
|
+
value: "html",
|
276
|
+
label: "HTML"
|
277
|
+
},
|
278
|
+
{
|
279
|
+
value: "ini",
|
280
|
+
label: "INI"
|
281
|
+
},
|
282
|
+
{
|
283
|
+
value: "java",
|
284
|
+
label: "Java"
|
285
|
+
},
|
286
|
+
{
|
287
|
+
value: "javascript",
|
288
|
+
label: "JavaScript"
|
289
|
+
},
|
290
|
+
{
|
291
|
+
value: "jsx",
|
292
|
+
label: "JavaScript (React)"
|
293
|
+
},
|
294
|
+
{
|
295
|
+
value: "json",
|
296
|
+
label: "JSON"
|
297
|
+
},
|
298
|
+
{
|
299
|
+
value: "julia",
|
300
|
+
label: "Julia"
|
301
|
+
},
|
302
|
+
{
|
303
|
+
value: "kotlin",
|
304
|
+
label: "Kotlin"
|
305
|
+
},
|
306
|
+
{
|
307
|
+
value: "latex",
|
308
|
+
label: "LaTeX"
|
309
|
+
},
|
310
|
+
{
|
311
|
+
value: "lua",
|
312
|
+
label: "Lua"
|
313
|
+
},
|
314
|
+
{
|
315
|
+
value: "markdown",
|
316
|
+
label: "Markdown"
|
317
|
+
},
|
318
|
+
{
|
319
|
+
value: "matlab",
|
320
|
+
label: "MATLAB"
|
321
|
+
},
|
322
|
+
{
|
323
|
+
value: "makefile",
|
324
|
+
label: "Makefile"
|
325
|
+
},
|
326
|
+
{
|
327
|
+
value: "objectivec",
|
328
|
+
label: "Objective-C"
|
329
|
+
},
|
330
|
+
{
|
331
|
+
value: "perl",
|
332
|
+
label: "Perl"
|
333
|
+
},
|
334
|
+
{
|
335
|
+
value: "php",
|
336
|
+
label: "PHP"
|
337
|
+
},
|
338
|
+
{
|
339
|
+
value: "plaintext",
|
340
|
+
label: "Plain text"
|
341
|
+
},
|
342
|
+
{
|
343
|
+
value: "powershell",
|
344
|
+
label: "PowerShell"
|
345
|
+
},
|
346
|
+
{
|
347
|
+
value: "python",
|
348
|
+
label: "Python"
|
349
|
+
},
|
350
|
+
{
|
351
|
+
value: "r",
|
352
|
+
label: "R"
|
353
|
+
},
|
354
|
+
{
|
355
|
+
value: "ruby",
|
356
|
+
label: "Ruby"
|
357
|
+
},
|
358
|
+
{
|
359
|
+
value: "rust",
|
360
|
+
label: "Rust"
|
361
|
+
},
|
362
|
+
{
|
363
|
+
value: "sas",
|
364
|
+
label: "SAS"
|
365
|
+
},
|
366
|
+
{
|
367
|
+
value: "scala",
|
368
|
+
label: "Scala"
|
369
|
+
},
|
370
|
+
{
|
371
|
+
value: "scheme",
|
372
|
+
label: "Scheme"
|
373
|
+
},
|
374
|
+
{
|
375
|
+
value: "shell",
|
376
|
+
label: "Shell"
|
377
|
+
},
|
378
|
+
{
|
379
|
+
value: "sql",
|
380
|
+
label: "SQL"
|
381
|
+
},
|
382
|
+
{
|
383
|
+
value: "stata",
|
384
|
+
label: "Stata"
|
385
|
+
},
|
386
|
+
{
|
387
|
+
value: "swift",
|
388
|
+
label: "Swift"
|
389
|
+
},
|
390
|
+
{
|
391
|
+
value: "typescript",
|
392
|
+
label: "TypeScript"
|
393
|
+
},
|
394
|
+
{
|
395
|
+
value: "tsx",
|
396
|
+
label: "TypeScript (React)"
|
397
|
+
},
|
398
|
+
{
|
399
|
+
value: "vbnet",
|
400
|
+
label: "VB.NET"
|
401
|
+
},
|
402
|
+
{
|
403
|
+
value: "xml",
|
404
|
+
label: "XML"
|
405
|
+
},
|
406
|
+
{
|
407
|
+
value: "yaml",
|
408
|
+
label: "YAML"
|
409
|
+
}
|
410
|
+
];
|
198
411
|
const baseHandleConvert = (editor, attributesToSet) => {
|
199
412
|
const [_, lastNodePath] = slate.Editor.last(editor, []);
|
200
413
|
slate.Transforms.unwrapNodes(editor, {
|
@@ -258,13 +471,14 @@ const pressEnterTwiceToExit = (editor) => {
|
|
258
471
|
});
|
259
472
|
}
|
260
473
|
};
|
261
|
-
const CodeBlock =
|
474
|
+
const CodeBlock = styledComponents.styled.pre`
|
262
475
|
border-radius: ${({ theme }) => theme.borderRadius};
|
263
476
|
background-color: ${({ theme }) => theme.colors.neutral100};
|
264
477
|
max-width: 100%;
|
265
478
|
overflow: auto;
|
266
479
|
padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
|
267
480
|
flex-shrink: 1;
|
481
|
+
|
268
482
|
& > code {
|
269
483
|
font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
|
270
484
|
monospace;
|
@@ -273,10 +487,62 @@ const CodeBlock = styled__default.default.pre.attrs({ role: "code" })`
|
|
273
487
|
max-width: 100%;
|
274
488
|
}
|
275
489
|
`;
|
490
|
+
const CodeEditor = (props) => {
|
491
|
+
const { editor } = useBlocksEditorContext("ImageDialog");
|
492
|
+
const editorIsFocused = slateReact.useFocused();
|
493
|
+
const imageIsSelected = slateReact.useSelected();
|
494
|
+
const { formatMessage } = reactIntl.useIntl();
|
495
|
+
const [isSelectOpen, setIsSelectOpen] = React__namespace.useState(false);
|
496
|
+
const shouldDisplayLanguageSelect = editorIsFocused && imageIsSelected || isSelectOpen;
|
497
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { position: "relative", width: "100%", children: [
|
498
|
+
/* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: props.children }) }),
|
499
|
+
shouldDisplayLanguageSelect && /* @__PURE__ */ jsxRuntime.jsx(
|
500
|
+
designSystem.Box,
|
501
|
+
{
|
502
|
+
position: "absolute",
|
503
|
+
background: "neutral0",
|
504
|
+
borderColor: "neutral150",
|
505
|
+
borderStyle: "solid",
|
506
|
+
borderWidth: "0.5px",
|
507
|
+
shadow: "tableShadow",
|
508
|
+
top: "100%",
|
509
|
+
marginTop: 1,
|
510
|
+
right: 0,
|
511
|
+
padding: 1,
|
512
|
+
hasRadius: true,
|
513
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
514
|
+
designSystem.SingleSelect,
|
515
|
+
{
|
516
|
+
onChange: (open) => {
|
517
|
+
slate.Transforms.setNodes(
|
518
|
+
editor,
|
519
|
+
{ language: open.toString() },
|
520
|
+
{ match: (node) => !slate.Editor.isEditor(node) && node.type === "code" }
|
521
|
+
);
|
522
|
+
},
|
523
|
+
value: props.element.type === "code" && props.element.language || "plaintext",
|
524
|
+
onOpenChange: (open) => {
|
525
|
+
setIsSelectOpen(open);
|
526
|
+
if (!open) {
|
527
|
+
slateReact.ReactEditor.focus(editor);
|
528
|
+
}
|
529
|
+
},
|
530
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
531
|
+
"aria-label": formatMessage({
|
532
|
+
id: "components.Blocks.blocks.code.languageLabel",
|
533
|
+
defaultMessage: "Select a language"
|
534
|
+
}),
|
535
|
+
children: codeLanguages.map(({ value, label }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value, children: label }, value))
|
536
|
+
}
|
537
|
+
)
|
538
|
+
}
|
539
|
+
)
|
540
|
+
] });
|
541
|
+
};
|
276
542
|
const codeBlocks = {
|
277
543
|
code: {
|
278
|
-
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
279
|
-
icon: Icons.
|
544
|
+
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { ...props }),
|
545
|
+
icon: Icons.CodeBlock,
|
280
546
|
label: {
|
281
547
|
id: "components.Blocks.blocks.code",
|
282
548
|
defaultMessage: "Code block"
|
@@ -284,7 +550,7 @@ const codeBlocks = {
|
|
284
550
|
matchNode: (node) => node.type === "code",
|
285
551
|
isInBlocksSelector: true,
|
286
552
|
handleConvert(editor) {
|
287
|
-
baseHandleConvert(editor, { type: "code" });
|
553
|
+
baseHandleConvert(editor, { type: "code", language: "plaintext" });
|
288
554
|
},
|
289
555
|
handleEnterKey(editor) {
|
290
556
|
pressEnterTwiceToExit(editor);
|
@@ -293,27 +559,27 @@ const codeBlocks = {
|
|
293
559
|
dragHandleTopMargin: "10px"
|
294
560
|
}
|
295
561
|
};
|
296
|
-
const H1 =
|
562
|
+
const H1 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h1" })`
|
297
563
|
font-size: 4.2rem;
|
298
564
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
299
565
|
`;
|
300
|
-
const H2 =
|
566
|
+
const H2 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h2" })`
|
301
567
|
font-size: 3.5rem;
|
302
568
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
303
569
|
`;
|
304
|
-
const H3 =
|
570
|
+
const H3 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h3" })`
|
305
571
|
font-size: 2.9rem;
|
306
572
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
307
573
|
`;
|
308
|
-
const H4 =
|
574
|
+
const H4 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h4" })`
|
309
575
|
font-size: 2.4rem;
|
310
576
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
311
577
|
`;
|
312
|
-
const H5 =
|
578
|
+
const H5 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h5" })`
|
313
579
|
font-size: 2rem;
|
314
580
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
315
581
|
`;
|
316
|
-
const H6 =
|
582
|
+
const H6 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h6" })`
|
317
583
|
font-size: 1.6rem;
|
318
584
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
319
585
|
`;
|
@@ -399,10 +665,10 @@ const headingBlocks = {
|
|
399
665
|
dragHandleTopMargin: "-2px"
|
400
666
|
}
|
401
667
|
};
|
402
|
-
const ImageWrapper =
|
668
|
+
const ImageWrapper = styledComponents.styled(designSystem.Flex)`
|
403
669
|
transition-property: box-shadow;
|
404
670
|
transition-duration: 0.2s;
|
405
|
-
${(props) => props
|
671
|
+
${(props) => props.$isFocused && styledComponents.css`
|
406
672
|
box-shadow: ${props.theme.colors.primary600} 0px 0px 0px 3px;
|
407
673
|
`}
|
408
674
|
|
@@ -454,7 +720,7 @@ const Image = ({ attributes, children, element }) => {
|
|
454
720
|
background: "neutral100",
|
455
721
|
contentEditable: false,
|
456
722
|
justifyContent: "center",
|
457
|
-
isFocused: editorIsFocused && imageIsSelected,
|
723
|
+
$isFocused: editorIsFocused && imageIsSelected,
|
458
724
|
hasRadius: true,
|
459
725
|
children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, alt: alternativeText, width, height })
|
460
726
|
}
|
@@ -502,7 +768,7 @@ const ImageDialog = () => {
|
|
502
768
|
const nodeImage = {
|
503
769
|
...expectedImage,
|
504
770
|
alternativeText: expectedImage.alternativeText || expectedImage.name,
|
505
|
-
url:
|
771
|
+
url: useDebounce.prefixFileUrlWithBackendUrl(image.url)
|
506
772
|
};
|
507
773
|
return nodeImage;
|
508
774
|
});
|
@@ -610,11 +876,11 @@ const isLinkNode = (element) => {
|
|
610
876
|
const isListNode$1 = (element) => {
|
611
877
|
return element.type === "list";
|
612
878
|
};
|
613
|
-
const StyledBaseLink =
|
879
|
+
const StyledBaseLink = styledComponents.styled(designSystem.BaseLink)`
|
614
880
|
text-decoration: none;
|
615
881
|
`;
|
616
|
-
const RemoveButton =
|
617
|
-
visibility: ${(props) => props
|
882
|
+
const RemoveButton = styledComponents.styled(designSystem.Button)`
|
883
|
+
visibility: ${(props) => props.$visible ? "visible" : "hidden"};
|
618
884
|
`;
|
619
885
|
const LinkContent = React__namespace.forwardRef(
|
620
886
|
({ link, children, attributes }, forwardedRef) => {
|
@@ -624,18 +890,12 @@ const LinkContent = React__namespace.forwardRef(
|
|
624
890
|
const [popoverOpen, setPopoverOpen] = React__namespace.useState(
|
625
891
|
editor.lastInsertedLinkPath ? slate.Path.equals(path, editor.lastInsertedLinkPath) : false
|
626
892
|
);
|
627
|
-
const linkRef = React__namespace.useRef(null);
|
628
893
|
const elementText = link.children.map((child) => child.text).join("");
|
629
894
|
const [linkText, setLinkText] = React__namespace.useState(elementText);
|
630
895
|
const [linkUrl, setLinkUrl] = React__namespace.useState(link.url);
|
631
896
|
const linkInputRef = React__namespace.useRef(null);
|
632
|
-
const
|
897
|
+
const isLastInsertedLink = editor.lastInsertedLinkPath ? !slate.Path.equals(path, editor.lastInsertedLinkPath) : true;
|
633
898
|
const [isSaveDisabled, setIsSaveDisabled] = React__namespace.useState(false);
|
634
|
-
const handleOpenEditPopover = (e) => {
|
635
|
-
e.preventDefault();
|
636
|
-
setPopoverOpen(true);
|
637
|
-
setShowRemoveButton(true);
|
638
|
-
};
|
639
899
|
const onLinkChange = (e) => {
|
640
900
|
setIsSaveDisabled(false);
|
641
901
|
setLinkUrl(e.target.value);
|
@@ -656,40 +916,40 @@ const LinkContent = React__namespace.forwardRef(
|
|
656
916
|
editLink(editor, { url: linkUrl, text: linkText });
|
657
917
|
setPopoverOpen(false);
|
658
918
|
editor.lastInsertedLinkPath = null;
|
919
|
+
slateReact.ReactEditor.focus(editor);
|
659
920
|
};
|
660
|
-
const
|
661
|
-
setPopoverOpen(false);
|
921
|
+
const handleClose = () => {
|
662
922
|
if (link.url === "") {
|
663
923
|
removeLink(editor);
|
664
924
|
}
|
925
|
+
setPopoverOpen(false);
|
665
926
|
slateReact.ReactEditor.focus(editor);
|
666
927
|
};
|
667
|
-
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
668
|
-
const composedRefs = designSystem.useComposedRefs(linkRef, forwardedRef);
|
669
928
|
React__namespace.useEffect(() => {
|
670
929
|
if (popoverOpen)
|
671
930
|
linkInputRef.current?.focus();
|
672
931
|
}, [popoverOpen]);
|
673
|
-
|
674
|
-
|
932
|
+
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
933
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { open: popoverOpen, children: [
|
934
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
675
935
|
StyledBaseLink,
|
676
936
|
{
|
677
937
|
...attributes,
|
678
|
-
ref:
|
938
|
+
ref: forwardedRef,
|
679
939
|
href: link.url,
|
680
|
-
onClick:
|
940
|
+
onClick: () => setPopoverOpen(true),
|
681
941
|
color: "primary600",
|
682
942
|
children
|
683
943
|
}
|
684
|
-
),
|
685
|
-
|
686
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
687
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
944
|
+
) }),
|
945
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { onPointerDownOutside: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 4, children: [
|
946
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
947
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
688
948
|
id: "components.Blocks.popover.text",
|
689
949
|
defaultMessage: "Text"
|
690
950
|
}) }),
|
691
951
|
/* @__PURE__ */ jsxRuntime.jsx(
|
692
|
-
designSystem.
|
952
|
+
designSystem.Field.Input,
|
693
953
|
{
|
694
954
|
name: "text",
|
695
955
|
placeholder: formatMessage({
|
@@ -703,13 +963,13 @@ const LinkContent = React__namespace.forwardRef(
|
|
703
963
|
}
|
704
964
|
)
|
705
965
|
] }) }),
|
706
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
707
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
966
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
967
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
708
968
|
id: "components.Blocks.popover.link",
|
709
969
|
defaultMessage: "Link"
|
710
970
|
}) }),
|
711
971
|
/* @__PURE__ */ jsxRuntime.jsx(
|
712
|
-
designSystem.
|
972
|
+
designSystem.Field.Input,
|
713
973
|
{
|
714
974
|
ref: linkInputRef,
|
715
975
|
name: "url",
|
@@ -728,7 +988,7 @@ const LinkContent = React__namespace.forwardRef(
|
|
728
988
|
{
|
729
989
|
variant: "danger-light",
|
730
990
|
onClick: () => removeLink(editor),
|
731
|
-
visible:
|
991
|
+
$visible: isLastInsertedLink,
|
732
992
|
children: formatMessage({
|
733
993
|
id: "components.Blocks.popover.remove",
|
734
994
|
defaultMessage: "Remove"
|
@@ -736,11 +996,11 @@ const LinkContent = React__namespace.forwardRef(
|
|
736
996
|
}
|
737
997
|
),
|
738
998
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
739
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick:
|
999
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
|
740
1000
|
id: "components.Blocks.popover.cancel",
|
741
1001
|
defaultMessage: "Cancel"
|
742
1002
|
}) }),
|
743
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, {
|
1003
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
|
744
1004
|
id: "components.Blocks.popover.save",
|
745
1005
|
defaultMessage: "Save"
|
746
1006
|
}) })
|
@@ -764,7 +1024,7 @@ const linkBlocks = {
|
|
764
1024
|
isInBlocksSelector: false
|
765
1025
|
}
|
766
1026
|
};
|
767
|
-
const listStyle =
|
1027
|
+
const listStyle = styledComponents.css`
|
768
1028
|
display: flex;
|
769
1029
|
flex-direction: column;
|
770
1030
|
gap: ${({ theme }) => theme.spaces[2]};
|
@@ -782,12 +1042,12 @@ const listStyle = styled.css`
|
|
782
1042
|
margin-inline-start: ${({ theme }) => theme.spaces[3]};
|
783
1043
|
}
|
784
1044
|
`;
|
785
|
-
const Orderedlist =
|
786
|
-
list-style-type: ${(props) => props
|
1045
|
+
const Orderedlist = styledComponents.styled.ol`
|
1046
|
+
list-style-type: ${(props) => props.$listStyleType};
|
787
1047
|
${listStyle}
|
788
1048
|
`;
|
789
|
-
const Unorderedlist =
|
790
|
-
list-style-type: ${(props) => props
|
1049
|
+
const Unorderedlist = styledComponents.styled.ul`
|
1050
|
+
list-style-type: ${(props) => props.$listStyleType};
|
791
1051
|
${listStyle}
|
792
1052
|
`;
|
793
1053
|
const orderedStyles = ["decimal", "lower-alpha", "upper-roman"];
|
@@ -800,9 +1060,9 @@ const List = ({ attributes, children, element }) => {
|
|
800
1060
|
const nextIndex = (element.indentLevel || 0) % listStyles.length;
|
801
1061
|
const listStyleType = listStyles[nextIndex];
|
802
1062
|
if (element.format === "ordered") {
|
803
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Orderedlist, { listStyleType, ...attributes, children });
|
1063
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Orderedlist, { $listStyleType: listStyleType, ...attributes, children });
|
804
1064
|
}
|
805
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Unorderedlist, { listStyleType, ...attributes, children });
|
1065
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Unorderedlist, { $listStyleType: listStyleType, ...attributes, children });
|
806
1066
|
};
|
807
1067
|
const replaceListWithEmptyBlock = (editor, currentListPath) => {
|
808
1068
|
slate.Transforms.removeNodes(editor, { at: currentListPath });
|
@@ -999,7 +1259,7 @@ const listBlocks = {
|
|
999
1259
|
snippets: ["-", "*", "+"]
|
1000
1260
|
},
|
1001
1261
|
"list-item": {
|
1002
|
-
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
1262
|
+
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "li", ...props.attributes, children: props.children }),
|
1003
1263
|
// No handleConvert, list items are created when converting to the parent list
|
1004
1264
|
matchNode: (node) => node.type === "list-item",
|
1005
1265
|
isInBlocksSelector: false,
|
@@ -1008,7 +1268,7 @@ const listBlocks = {
|
|
1008
1268
|
};
|
1009
1269
|
const paragraphBlocks = {
|
1010
1270
|
paragraph: {
|
1011
|
-
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
1271
|
+
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "p", variant: "omega", ...props.attributes, children: props.children }),
|
1012
1272
|
icon: Icons.Paragraph,
|
1013
1273
|
label: {
|
1014
1274
|
id: "components.Blocks.blocks.text",
|
@@ -1056,7 +1316,7 @@ const paragraphBlocks = {
|
|
1056
1316
|
}
|
1057
1317
|
}
|
1058
1318
|
};
|
1059
|
-
const Blockquote =
|
1319
|
+
const Blockquote = styledComponents.styled.blockquote.attrs({ role: "blockquote" })`
|
1060
1320
|
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
1061
1321
|
border-left: ${({ theme }) => `${theme.spaces[1]} solid ${theme.colors.neutral200}`};
|
1062
1322
|
padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[4]};
|
@@ -1086,17 +1346,17 @@ const quoteBlocks = {
|
|
1086
1346
|
dragHandleTopMargin: "6px"
|
1087
1347
|
}
|
1088
1348
|
};
|
1089
|
-
const ToolbarWrapper =
|
1349
|
+
const ToolbarWrapper = styledComponents.styled(designSystem.Flex)`
|
1090
1350
|
&[aria-disabled='true'] {
|
1091
1351
|
cursor: not-allowed;
|
1092
1352
|
}
|
1093
1353
|
`;
|
1094
|
-
const Separator =
|
1354
|
+
const Separator = styledComponents.styled(Toolbar__namespace.Separator)`
|
1095
1355
|
background: ${({ theme }) => theme.colors.neutral150};
|
1096
1356
|
width: 1px;
|
1097
1357
|
height: 2.4rem;
|
1098
1358
|
`;
|
1099
|
-
const FlexButton =
|
1359
|
+
const FlexButton = styledComponents.styled(designSystem.Flex)`
|
1100
1360
|
// Inherit the not-allowed cursor from ToolbarWrapper when disabled
|
1101
1361
|
&[aria-disabled] {
|
1102
1362
|
cursor: inherit;
|
@@ -1111,7 +1371,7 @@ const FlexButton = styled__default.default(designSystem.Flex)`
|
|
1111
1371
|
}
|
1112
1372
|
}
|
1113
1373
|
`;
|
1114
|
-
const SelectWrapper =
|
1374
|
+
const SelectWrapper = styledComponents.styled(designSystem.Box)`
|
1115
1375
|
// Styling changes to SingleSelect component don't work, so adding wrapper to target SingleSelect
|
1116
1376
|
div[role='combobox'] {
|
1117
1377
|
border: none;
|
@@ -1174,14 +1434,14 @@ const ToolbarButton = ({
|
|
1174
1434
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
1175
1435
|
FlexButton,
|
1176
1436
|
{
|
1177
|
-
|
1437
|
+
tag: "button",
|
1178
1438
|
background: isActive ? "primary100" : "",
|
1179
1439
|
alignItems: "center",
|
1180
1440
|
justifyContent: "center",
|
1181
1441
|
width: 7,
|
1182
1442
|
height: 7,
|
1183
1443
|
hasRadius: true,
|
1184
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, {
|
1444
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { fill: disabled ? "neutral300" : enabledColor })
|
1185
1445
|
}
|
1186
1446
|
)
|
1187
1447
|
}
|
@@ -1326,6 +1586,26 @@ const ListButton = ({ block, format }) => {
|
|
1326
1586
|
}
|
1327
1587
|
return false;
|
1328
1588
|
};
|
1589
|
+
const isListDisabled = () => {
|
1590
|
+
if (disabled) {
|
1591
|
+
return true;
|
1592
|
+
}
|
1593
|
+
if (!editor.selection) {
|
1594
|
+
return false;
|
1595
|
+
}
|
1596
|
+
const anchorNodeEntry = slate.Editor.above(editor, {
|
1597
|
+
at: editor.selection.anchor,
|
1598
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type !== "text"
|
1599
|
+
});
|
1600
|
+
const focusNodeEntry = slate.Editor.above(editor, {
|
1601
|
+
at: editor.selection.focus,
|
1602
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type !== "text"
|
1603
|
+
});
|
1604
|
+
if (!anchorNodeEntry || !focusNodeEntry) {
|
1605
|
+
return false;
|
1606
|
+
}
|
1607
|
+
return anchorNodeEntry[0] !== focusNodeEntry[0];
|
1608
|
+
};
|
1329
1609
|
const toggleList = (format2) => {
|
1330
1610
|
let currentListEntry;
|
1331
1611
|
if (editor.selection) {
|
@@ -1359,7 +1639,7 @@ const ListButton = ({ block, format }) => {
|
|
1359
1639
|
name: format,
|
1360
1640
|
label: block.label,
|
1361
1641
|
isActive: isListActive(),
|
1362
|
-
disabled,
|
1642
|
+
disabled: isListDisabled(),
|
1363
1643
|
handleClick: () => toggleList(format)
|
1364
1644
|
}
|
1365
1645
|
);
|
@@ -1458,7 +1738,7 @@ const BlocksToolbar = () => {
|
|
1458
1738
|
] }) })
|
1459
1739
|
] }) });
|
1460
1740
|
};
|
1461
|
-
const StyledEditable =
|
1741
|
+
const StyledEditable = styledComponents.styled(slateReact.Editable)`
|
1462
1742
|
// The outline style is set on the wrapper with :focus-within
|
1463
1743
|
outline: none;
|
1464
1744
|
display: flex;
|
@@ -1473,20 +1753,20 @@ const StyledEditable = styled__default.default(slateReact.Editable)`
|
|
1473
1753
|
padding-bottom: ${({ theme }) => theme.spaces[3]};
|
1474
1754
|
}
|
1475
1755
|
`;
|
1476
|
-
const Wrapper$1 =
|
1756
|
+
const Wrapper$1 = styledComponents.styled(designSystem.Box)`
|
1477
1757
|
position: ${({ isOverDropTarget }) => isOverDropTarget && "relative"};
|
1478
1758
|
`;
|
1479
|
-
const DropPlaceholder =
|
1759
|
+
const DropPlaceholder = styledComponents.styled(designSystem.Box)`
|
1480
1760
|
position: absolute;
|
1481
1761
|
right: 0;
|
1482
1762
|
|
1483
1763
|
// Show drop placeholder 8px above or below the drop target
|
1484
|
-
${({ dragDirection, theme, placeholderMargin }) =>
|
1764
|
+
${({ dragDirection, theme, placeholderMargin }) => styledComponents.css`
|
1485
1765
|
top: ${dragDirection === useDragAndDrop.DIRECTIONS.UPWARD && `-${theme.spaces[placeholderMargin]}`};
|
1486
1766
|
bottom: ${dragDirection === useDragAndDrop.DIRECTIONS.DOWNWARD && `-${theme.spaces[placeholderMargin]}`};
|
1487
1767
|
`}
|
1488
1768
|
`;
|
1489
|
-
const DragItem =
|
1769
|
+
const DragItem = styledComponents.styled(designSystem.Flex)`
|
1490
1770
|
// Style each block rendered using renderElement()
|
1491
1771
|
& > [data-slate-node='element'] {
|
1492
1772
|
width: 100%;
|
@@ -1495,14 +1775,15 @@ const DragItem = styled__default.default(designSystem.Flex)`
|
|
1495
1775
|
|
1496
1776
|
// Set the visibility of drag button
|
1497
1777
|
[role='button'] {
|
1498
|
-
visibility: ${(props) => props
|
1778
|
+
visibility: ${(props) => props.$dragVisibility};
|
1499
1779
|
opacity: inherit;
|
1500
1780
|
}
|
1501
1781
|
&[aria-disabled='true'] {
|
1502
1782
|
user-drag: none;
|
1503
1783
|
}
|
1504
1784
|
`;
|
1505
|
-
const DragIconButton =
|
1785
|
+
const DragIconButton = styledComponents.styled(designSystem.IconButton)`
|
1786
|
+
user-select: none;
|
1506
1787
|
display: flex;
|
1507
1788
|
align-items: center;
|
1508
1789
|
justify-content: center;
|
@@ -1512,7 +1793,7 @@ const DragIconButton = styled__default.default(designSystem.IconButton)`
|
|
1512
1793
|
visibility: hidden;
|
1513
1794
|
cursor: grab;
|
1514
1795
|
opacity: inherit;
|
1515
|
-
margin-top: ${(props) => props
|
1796
|
+
margin-top: ${(props) => props.$dragHandleTopMargin ?? 0};
|
1516
1797
|
|
1517
1798
|
&:hover {
|
1518
1799
|
background: ${({ theme }) => theme.colors.neutral200};
|
@@ -1526,7 +1807,7 @@ const DragIconButton = styled__default.default(designSystem.IconButton)`
|
|
1526
1807
|
}
|
1527
1808
|
svg {
|
1528
1809
|
height: auto;
|
1529
|
-
width: ${({ theme }) => theme.spaces[3]};
|
1810
|
+
min-width: ${({ theme }) => theme.spaces[3]};
|
1530
1811
|
|
1531
1812
|
path {
|
1532
1813
|
fill: ${({ theme }) => theme.colors.neutral700};
|
@@ -1587,7 +1868,7 @@ const DragAndDropElement = ({
|
|
1587
1868
|
React__namespace.useEffect(() => {
|
1588
1869
|
setDragVisibility("hidden");
|
1589
1870
|
}, [editor.selection]);
|
1590
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper$1, { ref:
|
1871
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper$1, { ref: composedBoxRefs, isOverDropTarget, children: [
|
1591
1872
|
isOverDropTarget && /* @__PURE__ */ jsxRuntime.jsx(
|
1592
1873
|
DropPlaceholder,
|
1593
1874
|
{
|
@@ -1625,15 +1906,17 @@ const DragAndDropElement = ({
|
|
1625
1906
|
onSelect: () => setDragVisibility("visible"),
|
1626
1907
|
onMouseLeave: () => setDragVisibility("hidden"),
|
1627
1908
|
"aria-disabled": disabled,
|
1628
|
-
dragVisibility,
|
1909
|
+
$dragVisibility: dragVisibility,
|
1629
1910
|
children: [
|
1630
1911
|
/* @__PURE__ */ jsxRuntime.jsx(
|
1631
1912
|
DragIconButton,
|
1632
1913
|
{
|
1633
|
-
|
1914
|
+
tag: "div",
|
1915
|
+
contentEditable: false,
|
1634
1916
|
role: "button",
|
1635
1917
|
tabIndex: 0,
|
1636
|
-
|
1918
|
+
withTooltip: false,
|
1919
|
+
label: formatMessage({
|
1637
1920
|
id: index.getTranslation("components.DragHandle-label"),
|
1638
1921
|
defaultMessage: "Drag"
|
1639
1922
|
}),
|
@@ -1641,8 +1924,8 @@ const DragAndDropElement = ({
|
|
1641
1924
|
"aria-disabled": disabled,
|
1642
1925
|
disabled,
|
1643
1926
|
draggable: true,
|
1644
|
-
dragHandleTopMargin,
|
1645
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, { color: "
|
1927
|
+
$dragHandleTopMargin: dragHandleTopMargin,
|
1928
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, { color: "primary500" })
|
1646
1929
|
}
|
1647
1930
|
),
|
1648
1931
|
children
|
@@ -1653,17 +1936,18 @@ const DragAndDropElement = ({
|
|
1653
1936
|
};
|
1654
1937
|
const CloneDragItem = ({ children, dragHandleTopMargin }) => {
|
1655
1938
|
const { formatMessage } = reactIntl.useIntl();
|
1656
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", dragVisibility: "visible", children: [
|
1939
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", $dragVisibility: "visible", children: [
|
1657
1940
|
/* @__PURE__ */ jsxRuntime.jsx(
|
1658
1941
|
DragIconButton,
|
1659
1942
|
{
|
1660
|
-
|
1943
|
+
tag: "div",
|
1661
1944
|
role: "button",
|
1662
|
-
|
1945
|
+
withTooltip: false,
|
1946
|
+
label: formatMessage({
|
1663
1947
|
id: index.getTranslation("components.DragHandle-label"),
|
1664
1948
|
defaultMessage: "Drag"
|
1665
1949
|
}),
|
1666
|
-
dragHandleTopMargin,
|
1950
|
+
$dragHandleTopMargin: dragHandleTopMargin,
|
1667
1951
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, { color: "neutral600" })
|
1668
1952
|
}
|
1669
1953
|
),
|
@@ -1910,12 +2194,12 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
|
|
1910
2194
|
}
|
1911
2195
|
);
|
1912
2196
|
};
|
1913
|
-
const CollapseIconButton =
|
2197
|
+
const CollapseIconButton = styledComponents.styled(designSystem.IconButton)`
|
1914
2198
|
position: absolute;
|
1915
2199
|
bottom: 1.2rem;
|
1916
2200
|
right: 1.2rem;
|
1917
2201
|
`;
|
1918
|
-
const ExpandWrapper$1 =
|
2202
|
+
const ExpandWrapper$1 = styledComponents.styled(designSystem.Flex)`
|
1919
2203
|
// Background with 20% opacity
|
1920
2204
|
background: ${({ theme }) => `${theme.colors.neutral800}1F`};
|
1921
2205
|
`;
|
@@ -1965,7 +2249,7 @@ const EditorLayout$1 = ({
|
|
1965
2249
|
/* @__PURE__ */ jsxRuntime.jsx(
|
1966
2250
|
CollapseIconButton,
|
1967
2251
|
{
|
1968
|
-
|
2252
|
+
label: formatMessage({
|
1969
2253
|
id: index.getTranslation("components.Blocks.collapse"),
|
1970
2254
|
defaultMessage: "Collapse"
|
1971
2255
|
}),
|
@@ -1980,13 +2264,13 @@ const EditorLayout$1 = ({
|
|
1980
2264
|
) }) });
|
1981
2265
|
}
|
1982
2266
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1983
|
-
|
2267
|
+
InputWrapper,
|
1984
2268
|
{
|
1985
2269
|
direction: "column",
|
1986
2270
|
alignItems: "flex-start",
|
1987
2271
|
height: "512px",
|
1988
|
-
disabled,
|
1989
|
-
hasError: Boolean(error),
|
2272
|
+
$disabled: disabled,
|
2273
|
+
$hasError: Boolean(error),
|
1990
2274
|
style: { overflow: "hidden" },
|
1991
2275
|
"aria-describedby": ariaDescriptionId,
|
1992
2276
|
position: "relative",
|
@@ -1994,25 +2278,52 @@ const EditorLayout$1 = ({
|
|
1994
2278
|
}
|
1995
2279
|
);
|
1996
2280
|
};
|
1997
|
-
const
|
2281
|
+
const InputWrapper = styledComponents.styled(designSystem.Flex)`
|
2282
|
+
border: 1px solid
|
2283
|
+
${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
|
2284
|
+
border-radius: ${({ theme }) => theme.borderRadius};
|
2285
|
+
background: ${({ theme }) => theme.colors.neutral0};
|
2286
|
+
|
2287
|
+
${({ theme, $hasError = false }) => styledComponents.css`
|
2288
|
+
outline: none;
|
2289
|
+
box-shadow: 0;
|
2290
|
+
transition-property: border-color, box-shadow, fill;
|
2291
|
+
transition-duration: 0.2s;
|
2292
|
+
|
2293
|
+
&:focus-within {
|
2294
|
+
border: 1px solid ${$hasError ? theme.colors.danger600 : theme.colors.primary600};
|
2295
|
+
box-shadow: ${$hasError ? theme.colors.danger600 : theme.colors.primary600} 0px 0px 0px 2px;
|
2296
|
+
}
|
2297
|
+
`}
|
2298
|
+
|
2299
|
+
${({ theme, $disabled }) => $disabled ? styledComponents.css`
|
2300
|
+
color: ${theme.colors.neutral600};
|
2301
|
+
background: ${theme.colors.neutral150};
|
2302
|
+
` : void 0}
|
2303
|
+
`;
|
2304
|
+
const stylesToInherit = styledComponents.css`
|
1998
2305
|
font-size: inherit;
|
1999
2306
|
color: inherit;
|
2000
2307
|
line-height: inherit;
|
2001
2308
|
`;
|
2002
|
-
const BoldText =
|
2309
|
+
const BoldText = styledComponents.styled(designSystem.Typography).attrs({ fontWeight: "bold" })`
|
2003
2310
|
${stylesToInherit}
|
2004
2311
|
`;
|
2005
|
-
const ItalicText =
|
2312
|
+
const ItalicText = styledComponents.styled(designSystem.Typography)`
|
2006
2313
|
font-style: italic;
|
2007
2314
|
${stylesToInherit}
|
2008
2315
|
`;
|
2009
|
-
const UnderlineText =
|
2316
|
+
const UnderlineText = styledComponents.styled(designSystem.Typography).attrs({
|
2317
|
+
textDecoration: "underline"
|
2318
|
+
})`
|
2010
2319
|
${stylesToInherit}
|
2011
2320
|
`;
|
2012
|
-
const StrikeThroughText =
|
2321
|
+
const StrikeThroughText = styledComponents.styled(designSystem.Typography).attrs({
|
2322
|
+
textDecoration: "line-through"
|
2323
|
+
})`
|
2013
2324
|
${stylesToInherit}
|
2014
2325
|
`;
|
2015
|
-
const InlineCode =
|
2326
|
+
const InlineCode = styledComponents.styled.code`
|
2016
2327
|
background-color: ${({ theme }) => theme.colors.neutral150};
|
2017
2328
|
border-radius: ${({ theme }) => theme.borderRadius};
|
2018
2329
|
padding: ${({ theme }) => `0 ${theme.spaces[2]}`};
|
@@ -2182,10 +2493,10 @@ function useBlocksEditorContext(consumerName) {
|
|
2182
2493
|
editor
|
2183
2494
|
};
|
2184
2495
|
}
|
2185
|
-
const EditorDivider =
|
2496
|
+
const EditorDivider = styledComponents.styled(designSystem.Divider)`
|
2186
2497
|
background: ${({ theme }) => theme.colors.neutral200};
|
2187
2498
|
`;
|
2188
|
-
const ExpandIconButton =
|
2499
|
+
const ExpandIconButton = styledComponents.styled(designSystem.IconButton)`
|
2189
2500
|
position: absolute;
|
2190
2501
|
bottom: 1.2rem;
|
2191
2502
|
right: 1.2rem;
|
@@ -2277,7 +2588,7 @@ const BlocksEditor = React__namespace.forwardRef(
|
|
2277
2588
|
!isExpandedMode && /* @__PURE__ */ jsxRuntime.jsx(
|
2278
2589
|
ExpandIconButton,
|
2279
2590
|
{
|
2280
|
-
|
2591
|
+
label: formatMessage({
|
2281
2592
|
id: index.getTranslation("components.Blocks.expand"),
|
2282
2593
|
defaultMessage: "Expand"
|
2283
2594
|
}),
|
@@ -2300,8 +2611,8 @@ const BlocksInput = React__namespace.forwardRef(
|
|
2300
2611
|
({ label, name: name2, required = false, hint, labelAction, ...editorProps }, forwardedRef) => {
|
2301
2612
|
const id = React__namespace.useId();
|
2302
2613
|
const field = strapiAdmin.useField(name2);
|
2303
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
2304
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
2614
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
2615
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
2305
2616
|
/* @__PURE__ */ jsxRuntime.jsx(
|
2306
2617
|
BlocksEditor,
|
2307
2618
|
{
|
@@ -2314,11 +2625,12 @@ const BlocksInput = React__namespace.forwardRef(
|
|
2314
2625
|
...editorProps
|
2315
2626
|
}
|
2316
2627
|
),
|
2317
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
2318
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
2628
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
2629
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
2319
2630
|
] }) });
|
2320
2631
|
}
|
2321
2632
|
);
|
2633
|
+
const MemoizedBlocksInput = React__namespace.memo(BlocksInput);
|
2322
2634
|
const createDefaultForm = (contentType, components = {}) => {
|
2323
2635
|
const traverseSchema = (attributes) => {
|
2324
2636
|
return Object.entries(attributes).reduce((acc, [key, attribute]) => {
|
@@ -2342,47 +2654,44 @@ const createDefaultForm = (contentType, components = {}) => {
|
|
2342
2654
|
const Initializer = ({ disabled, name: name2, onClick }) => {
|
2343
2655
|
const { formatMessage } = reactIntl.useIntl();
|
2344
2656
|
const field = strapiAdmin.useField(name2);
|
2345
|
-
return /* @__PURE__ */ jsxRuntime.
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2357
|
-
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2363
|
-
|
2364
|
-
|
2365
|
-
|
2366
|
-
|
2367
|
-
|
2368
|
-
|
2657
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
2658
|
+
designSystem.Box,
|
2659
|
+
{
|
2660
|
+
tag: "button",
|
2661
|
+
background: disabled ? "neutral150" : "neutral100",
|
2662
|
+
borderColor: field.error ? "danger600" : "neutral200",
|
2663
|
+
hasRadius: true,
|
2664
|
+
disabled,
|
2665
|
+
onClick,
|
2666
|
+
paddingTop: 9,
|
2667
|
+
paddingBottom: 9,
|
2668
|
+
type: "button",
|
2669
|
+
style: { cursor: disabled ? "not-allowed" : "pointer" },
|
2670
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
2671
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", color: disabled ? "neutral500" : "primary600", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.PlusCircle, { width: "3.2rem", height: "3.2rem" }) }),
|
2672
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
2673
|
+
designSystem.Typography,
|
2674
|
+
{
|
2675
|
+
textColor: disabled ? "neutral600" : "primary600",
|
2676
|
+
variant: "pi",
|
2677
|
+
fontWeight: "bold",
|
2678
|
+
children: formatMessage({
|
2679
|
+
id: index.getTranslation("components.empty-repeatable"),
|
2680
|
+
defaultMessage: "No entry yet. Click to add one."
|
2681
|
+
})
|
2682
|
+
}
|
2683
|
+
) })
|
2684
|
+
] })
|
2685
|
+
}
|
2686
|
+
) });
|
2369
2687
|
};
|
2370
|
-
const CircleIcon = styled__default.default(Icons.PlusCircle)`
|
2371
|
-
width: 2.4rem;
|
2372
|
-
height: 2.4rem;
|
2373
|
-
> circle {
|
2374
|
-
fill: ${({ theme }) => theme.colors.primary200};
|
2375
|
-
}
|
2376
|
-
> path {
|
2377
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
2378
|
-
}
|
2379
|
-
`;
|
2380
2688
|
const NonRepeatableComponent = ({
|
2381
2689
|
attribute,
|
2382
2690
|
name: name2,
|
2383
2691
|
children,
|
2384
2692
|
layout
|
2385
2693
|
}) => {
|
2694
|
+
const { formatMessage } = reactIntl.useIntl();
|
2386
2695
|
const { value } = strapiAdmin.useField(name2);
|
2387
2696
|
const level = Relations.useComponent("NonRepeatableComponent", (state) => state.level);
|
2388
2697
|
const isNested = level > 0;
|
@@ -2397,9 +2706,24 @@ const NonRepeatableComponent = ({
|
|
2397
2706
|
hasRadius: isNested,
|
2398
2707
|
borderColor: isNested ? "neutral200" : void 0,
|
2399
2708
|
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index2) => {
|
2400
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: row.map(({ size, ...field }) => {
|
2709
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2401
2710
|
const completeFieldName = `${name2}.${field.name}`;
|
2402
|
-
|
2711
|
+
const translatedLabel = formatMessage({
|
2712
|
+
id: `content-manager.components.${attribute.component}.${field.name}`,
|
2713
|
+
defaultMessage: field.label
|
2714
|
+
});
|
2715
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
2716
|
+
designSystem.Grid.Item,
|
2717
|
+
{
|
2718
|
+
col: size,
|
2719
|
+
s: 12,
|
2720
|
+
xs: 12,
|
2721
|
+
direction: "column",
|
2722
|
+
alignItems: "stretch",
|
2723
|
+
children: children({ ...field, label: translatedLabel, name: completeFieldName })
|
2724
|
+
},
|
2725
|
+
completeFieldName
|
2726
|
+
);
|
2403
2727
|
}) }, index2);
|
2404
2728
|
}) })
|
2405
2729
|
}
|
@@ -2418,13 +2742,34 @@ const RepeatableComponent = ({
|
|
2418
2742
|
const { search: searchString } = reactRouterDom.useLocation();
|
2419
2743
|
const search = React__namespace.useMemo(() => new URLSearchParams(searchString), [searchString]);
|
2420
2744
|
const { components } = index.useDoc();
|
2421
|
-
const {
|
2745
|
+
const {
|
2746
|
+
value = [],
|
2747
|
+
error,
|
2748
|
+
rawError
|
2749
|
+
} = strapiAdmin.useField(name2);
|
2422
2750
|
const addFieldRow = strapiAdmin.useForm("RepeatableComponent", (state) => state.addFieldRow);
|
2423
2751
|
const moveFieldRow = strapiAdmin.useForm("RepeatableComponent", (state) => state.moveFieldRow);
|
2424
2752
|
const removeFieldRow = strapiAdmin.useForm("RepeatableComponent", (state) => state.removeFieldRow);
|
2425
2753
|
const { max = Infinity } = attribute;
|
2426
|
-
const [collapseToOpen, setCollapseToOpen] = React__namespace.useState(
|
2754
|
+
const [collapseToOpen, setCollapseToOpen] = React__namespace.useState("");
|
2427
2755
|
const [liveText, setLiveText] = React__namespace.useState("");
|
2756
|
+
React__namespace.useEffect(() => {
|
2757
|
+
const hasNestedErrors = rawError && Array.isArray(rawError) && rawError.length > 0;
|
2758
|
+
const hasNestedValue = value && Array.isArray(value) && value.length > 0;
|
2759
|
+
if (hasNestedErrors && hasNestedValue) {
|
2760
|
+
const errorOpenItems = rawError.map((_, idx) => {
|
2761
|
+
return value[idx] ? value[idx].__temp_key__ : null;
|
2762
|
+
}).filter((value2) => !!value2);
|
2763
|
+
if (errorOpenItems && errorOpenItems.length > 0) {
|
2764
|
+
setCollapseToOpen((collapseToOpen2) => {
|
2765
|
+
if (!errorOpenItems.includes(collapseToOpen2)) {
|
2766
|
+
return errorOpenItems[0];
|
2767
|
+
}
|
2768
|
+
return collapseToOpen2;
|
2769
|
+
});
|
2770
|
+
}
|
2771
|
+
}
|
2772
|
+
}, [rawError, value]);
|
2428
2773
|
const componentTmpKeyWithFocussedField = React__namespace.useMemo(() => {
|
2429
2774
|
if (search.has("field")) {
|
2430
2775
|
const fieldParam = search.get("field");
|
@@ -2439,13 +2784,19 @@ const RepeatableComponent = ({
|
|
2439
2784
|
}
|
2440
2785
|
return void 0;
|
2441
2786
|
}, [search, name2, value]);
|
2787
|
+
const prevValue = useDebounce.usePrev(value);
|
2788
|
+
React__namespace.useEffect(() => {
|
2789
|
+
if (prevValue && prevValue.length < value.length) {
|
2790
|
+
setCollapseToOpen(value[value.length - 1].__temp_key__);
|
2791
|
+
}
|
2792
|
+
}, [value, prevValue]);
|
2442
2793
|
React__namespace.useEffect(() => {
|
2443
|
-
if (typeof componentTmpKeyWithFocussedField === "
|
2794
|
+
if (typeof componentTmpKeyWithFocussedField === "string") {
|
2444
2795
|
setCollapseToOpen(componentTmpKeyWithFocussedField);
|
2445
2796
|
}
|
2446
2797
|
}, [componentTmpKeyWithFocussedField]);
|
2447
2798
|
const toggleCollapses = () => {
|
2448
|
-
setCollapseToOpen(
|
2799
|
+
setCollapseToOpen("");
|
2449
2800
|
};
|
2450
2801
|
const handleClick = () => {
|
2451
2802
|
if (value.length < max) {
|
@@ -2477,12 +2828,8 @@ const RepeatableComponent = ({
|
|
2477
2828
|
);
|
2478
2829
|
moveFieldRow(name2, currentIndex, newIndex);
|
2479
2830
|
};
|
2480
|
-
const
|
2481
|
-
|
2482
|
-
setCollapseToOpen(null);
|
2483
|
-
} else {
|
2484
|
-
setCollapseToOpen(key);
|
2485
|
-
}
|
2831
|
+
const handleValueChange = (key) => {
|
2832
|
+
setCollapseToOpen(key);
|
2486
2833
|
};
|
2487
2834
|
const getItemPos = (index2) => `${index2 + 1} of ${value.length}`;
|
2488
2835
|
const handleCancel = (index$1) => {
|
@@ -2537,158 +2884,123 @@ const RepeatableComponent = ({
|
|
2537
2884
|
defaultMessage: `Press spacebar to grab and re-order`
|
2538
2885
|
}) }),
|
2539
2886
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
2540
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2887
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
2888
|
+
AccordionRoot,
|
2889
|
+
{
|
2890
|
+
$error: error,
|
2891
|
+
value: collapseToOpen,
|
2892
|
+
onValueChange: handleValueChange,
|
2893
|
+
"aria-describedby": ariaDescriptionId,
|
2894
|
+
children: [
|
2895
|
+
value.map(({ __temp_key__: key, id }, index2) => {
|
2896
|
+
const nameWithIndex = `${name2}.${index2}`;
|
2897
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
2898
|
+
Relations.ComponentProvider,
|
2552
2899
|
{
|
2553
|
-
|
2554
|
-
|
2555
|
-
|
2556
|
-
|
2557
|
-
|
2558
|
-
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2900
|
+
id,
|
2901
|
+
uid: attribute.component,
|
2902
|
+
level: level + 1,
|
2903
|
+
type: "repeatable",
|
2904
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
2905
|
+
Component,
|
2906
|
+
{
|
2907
|
+
disabled,
|
2908
|
+
name: nameWithIndex,
|
2909
|
+
attribute,
|
2910
|
+
index: index2,
|
2911
|
+
mainField,
|
2912
|
+
onMoveItem: handleMoveComponentField,
|
2913
|
+
onDeleteComponent: () => {
|
2914
|
+
removeFieldRow(name2, index2);
|
2915
|
+
toggleCollapses();
|
2916
|
+
},
|
2917
|
+
toggleCollapses,
|
2918
|
+
onCancel: handleCancel,
|
2919
|
+
onDropItem: handleDropItem,
|
2920
|
+
onGrabItem: handleGrabItem,
|
2921
|
+
__temp_key__: key,
|
2922
|
+
children: layout.map((row, index22) => {
|
2923
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2924
|
+
const completeFieldName = `${nameWithIndex}.${field.name}`;
|
2925
|
+
const translatedLabel = formatMessage({
|
2926
|
+
id: `content-manager.components.${attribute.component}.${field.name}`,
|
2927
|
+
defaultMessage: field.label
|
2928
|
+
});
|
2929
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
2930
|
+
designSystem.Grid.Item,
|
2931
|
+
{
|
2932
|
+
col: size,
|
2933
|
+
s: 12,
|
2934
|
+
xs: 12,
|
2935
|
+
direction: "column",
|
2936
|
+
alignItems: "stretch",
|
2937
|
+
children: children({
|
2938
|
+
...field,
|
2939
|
+
label: translatedLabel,
|
2940
|
+
name: completeFieldName
|
2941
|
+
})
|
2942
|
+
},
|
2943
|
+
completeFieldName
|
2944
|
+
);
|
2945
|
+
}) }, index22);
|
2946
|
+
})
|
2947
|
+
}
|
2948
|
+
)
|
2949
|
+
},
|
2950
|
+
key
|
2951
|
+
);
|
2952
|
+
}),
|
2953
|
+
/* @__PURE__ */ jsxRuntime.jsx(TextButtonCustom, { disabled, onClick: handleClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Plus, {}), children: formatMessage({
|
2954
|
+
id: index.getTranslation("containers.EditView.add.new-entry"),
|
2955
|
+
defaultMessage: "Add an entry"
|
2956
|
+
}) })
|
2957
|
+
]
|
2958
|
+
}
|
2959
|
+
)
|
2586
2960
|
] });
|
2587
2961
|
};
|
2588
|
-
const
|
2589
|
-
|
2962
|
+
const AccordionRoot = styledComponents.styled(designSystem.Accordion.Root)`
|
2963
|
+
border: 1px solid
|
2964
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
2965
|
+
`;
|
2966
|
+
const TextButtonCustom = styledComponents.styled(designSystem.TextButton)`
|
2590
2967
|
width: 100%;
|
2591
|
-
border-radius: 0 0 4px 4px;
|
2592
2968
|
display: flex;
|
2593
2969
|
justify-content: center;
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
}
|
2598
|
-
`;
|
2599
|
-
const AccordionFooter = styled__default.default(designSystem.Box)`
|
2600
|
-
overflow: hidden;
|
2601
|
-
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2602
|
-
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2603
|
-
border-left: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2604
|
-
border-radius: 0 0 ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius};
|
2605
|
-
`;
|
2606
|
-
const AccordionContent = styled__default.default(designSystem.Box)`
|
2607
|
-
border-bottom: none;
|
2608
|
-
|
2609
|
-
/* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
|
2610
|
-
& > div > div {
|
2611
|
-
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2612
|
-
border-top-color: transparent;
|
2613
|
-
}
|
2970
|
+
border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2971
|
+
padding-inline: ${(props) => props.theme.spaces[6]};
|
2972
|
+
padding-block: ${(props) => props.theme.spaces[3]};
|
2614
2973
|
|
2615
|
-
|
2616
|
-
|
2617
|
-
border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2618
|
-
}
|
2974
|
+
&:not([disabled]) {
|
2975
|
+
cursor: pointer;
|
2619
2976
|
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
border-radius: unset;
|
2977
|
+
&:hover {
|
2978
|
+
background-color: ${(props) => props.theme.colors.primary100};
|
2979
|
+
}
|
2624
2980
|
}
|
2625
2981
|
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2982
|
+
span {
|
2983
|
+
font-weight: 600;
|
2984
|
+
font-size: 1.4rem;
|
2985
|
+
line-height: 2.4rem;
|
2630
2986
|
}
|
2631
2987
|
|
2632
|
-
|
2633
|
-
|
2634
|
-
}
|
2635
|
-
`;
|
2636
|
-
const AccordionGroup = ({ children, error }) => {
|
2637
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.KeyboardNavigable, { attributeName: "data-strapi-accordion-toggle", children: [
|
2638
|
-
children,
|
2639
|
-
error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "danger600", children: error }) })
|
2640
|
-
] });
|
2641
|
-
};
|
2642
|
-
const CustomIconButton$1 = styled__default.default(designSystem.IconButton)`
|
2643
|
-
background-color: transparent;
|
2644
|
-
|
2645
|
-
svg {
|
2646
|
-
path {
|
2647
|
-
fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : theme.colors.neutral600};
|
2648
|
-
}
|
2649
|
-
}
|
2650
|
-
|
2651
|
-
&:hover {
|
2652
|
-
svg {
|
2653
|
-
path {
|
2654
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
2655
|
-
}
|
2656
|
-
}
|
2657
|
-
}
|
2658
|
-
`;
|
2659
|
-
const ActionsFlex$1 = styled__default.default(designSystem.Flex)`
|
2660
|
-
& .drag-handle {
|
2661
|
-
background: unset;
|
2662
|
-
|
2663
|
-
svg {
|
2664
|
-
path {
|
2665
|
-
fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : void 0};
|
2666
|
-
}
|
2667
|
-
}
|
2668
|
-
|
2669
|
-
&:hover {
|
2670
|
-
svg {
|
2671
|
-
path {
|
2672
|
-
/* keeps the hover style of the accordion */
|
2673
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
2674
|
-
}
|
2675
|
-
}
|
2676
|
-
}
|
2988
|
+
@media (prefers-reduced-motion: no-preference) {
|
2989
|
+
transition: background-color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
2677
2990
|
}
|
2678
2991
|
`;
|
2679
2992
|
const Component = ({
|
2680
2993
|
disabled,
|
2681
2994
|
index: index$1,
|
2682
|
-
isOpen,
|
2683
2995
|
name: name2,
|
2684
2996
|
mainField = {
|
2685
2997
|
name: "id",
|
2686
2998
|
type: "integer"
|
2687
2999
|
},
|
2688
3000
|
children,
|
2689
|
-
onClickToggle,
|
2690
3001
|
onDeleteComponent,
|
2691
3002
|
toggleCollapses,
|
3003
|
+
__temp_key__,
|
2692
3004
|
...dragProps
|
2693
3005
|
}) => {
|
2694
3006
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2713,50 +3025,44 @@ const Component = ({
|
|
2713
3025
|
dragPreviewRef(reactDndHtml5Backend.getEmptyImage(), { captureDraggingState: false });
|
2714
3026
|
}, [dragPreviewRef, index$1]);
|
2715
3027
|
const composedAccordionRefs = designSystem.useComposedRefs(accordionRef, dragRef);
|
2716
|
-
const composedBoxRefs = designSystem.useComposedRefs(
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
}
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
"
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
] }),
|
2755
|
-
title: displayValue,
|
2756
|
-
togglePosition: "left"
|
2757
|
-
}
|
2758
|
-
),
|
2759
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.AccordionContent, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3028
|
+
const composedBoxRefs = designSystem.useComposedRefs(
|
3029
|
+
boxRef,
|
3030
|
+
dropRef
|
3031
|
+
);
|
3032
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview$1, {}) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { ref: composedBoxRefs, value: __temp_key__, children: [
|
3033
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
|
3034
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: displayValue }),
|
3035
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Actions, { children: [
|
3036
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3037
|
+
designSystem.IconButton,
|
3038
|
+
{
|
3039
|
+
variant: "ghost",
|
3040
|
+
onClick: onDeleteComponent,
|
3041
|
+
label: formatMessage({
|
3042
|
+
id: index.getTranslation("containers.Edit.delete"),
|
3043
|
+
defaultMessage: "Delete"
|
3044
|
+
}),
|
3045
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {})
|
3046
|
+
}
|
3047
|
+
),
|
3048
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3049
|
+
designSystem.IconButton,
|
3050
|
+
{
|
3051
|
+
ref: composedAccordionRefs,
|
3052
|
+
variant: "ghost",
|
3053
|
+
onClick: (e) => e.stopPropagation(),
|
3054
|
+
"data-handler-id": handlerId,
|
3055
|
+
label: formatMessage({
|
3056
|
+
id: index.getTranslation("components.DragHandle-label"),
|
3057
|
+
defaultMessage: "Drag"
|
3058
|
+
}),
|
3059
|
+
onKeyDown: handleKeyDown,
|
3060
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, {})
|
3061
|
+
}
|
3062
|
+
)
|
3063
|
+
] })
|
3064
|
+
] }),
|
3065
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
2760
3066
|
designSystem.Flex,
|
2761
3067
|
{
|
2762
3068
|
direction: "column",
|
@@ -2770,9 +3076,9 @@ const Component = ({
|
|
2770
3076
|
] }) });
|
2771
3077
|
};
|
2772
3078
|
const Preview$1 = () => {
|
2773
|
-
return /* @__PURE__ */ jsxRuntime.jsx(StyledSpan, {
|
3079
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledSpan, { tag: "span", padding: 6, background: "primary100" });
|
2774
3080
|
};
|
2775
|
-
const StyledSpan =
|
3081
|
+
const StyledSpan = styledComponents.styled(designSystem.Box)`
|
2776
3082
|
display: block;
|
2777
3083
|
outline: 1px dashed ${({ theme }) => theme.colors.primary500};
|
2778
3084
|
outline-offset: -1px;
|
@@ -2796,29 +3102,15 @@ const ComponentInput = ({
|
|
2796
3102
|
const data = transformDocument(schema, components)(form);
|
2797
3103
|
field.onChange(name2, data);
|
2798
3104
|
};
|
2799
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
3105
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error: field.error, required, children: [
|
2800
3106
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", children: [
|
2801
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
2802
|
-
|
2803
|
-
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
fontWeight: "bold",
|
2809
|
-
as: "label",
|
2810
|
-
children: [
|
2811
|
-
label,
|
2812
|
-
attribute.repeatable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
2813
|
-
" (",
|
2814
|
-
Array.isArray(field.value) ? field.value.length : 0,
|
2815
|
-
")"
|
2816
|
-
] }),
|
2817
|
-
required && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", children: "*" })
|
2818
|
-
]
|
2819
|
-
}
|
2820
|
-
),
|
2821
|
-
labelAction && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 1, children: labelAction })
|
3107
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { action: labelAction, children: [
|
3108
|
+
label,
|
3109
|
+
attribute.repeatable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
3110
|
+
" (",
|
3111
|
+
Array.isArray(field.value) ? field.value.length : 0,
|
3112
|
+
")"
|
3113
|
+
] })
|
2822
3114
|
] }),
|
2823
3115
|
showResetComponent && /* @__PURE__ */ jsxRuntime.jsx(
|
2824
3116
|
designSystem.IconButton,
|
@@ -2827,21 +3119,21 @@ const ComponentInput = ({
|
|
2827
3119
|
id: index.getTranslation("components.reset-entry"),
|
2828
3120
|
defaultMessage: "Reset Entry"
|
2829
3121
|
}),
|
2830
|
-
|
2831
|
-
borderWidth: 0,
|
3122
|
+
variant: "ghost",
|
2832
3123
|
onClick: () => {
|
2833
3124
|
field.onChange(name2, null);
|
2834
|
-
}
|
3125
|
+
},
|
3126
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {})
|
2835
3127
|
}
|
2836
3128
|
)
|
2837
3129
|
] }),
|
2838
|
-
/* @__PURE__ */ jsxRuntime.
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
] })
|
3130
|
+
!attribute.repeatable && !field.value && /* @__PURE__ */ jsxRuntime.jsx(Initializer, { disabled, name: name2, onClick: handleInitialisationClick }),
|
3131
|
+
!attribute.repeatable && field.value ? /* @__PURE__ */ jsxRuntime.jsx(NonRepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }) : null,
|
3132
|
+
attribute.repeatable && /* @__PURE__ */ jsxRuntime.jsx(RepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }),
|
3133
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
2843
3134
|
] });
|
2844
3135
|
};
|
3136
|
+
const MemoizedComponentInput = React__namespace.memo(ComponentInput);
|
2845
3137
|
const AddComponentButton = ({
|
2846
3138
|
hasError,
|
2847
3139
|
isDisabled,
|
@@ -2856,15 +3148,12 @@ const AddComponentButton = ({
|
|
2856
3148
|
onClick,
|
2857
3149
|
disabled: isDisabled,
|
2858
3150
|
background: "neutral0",
|
2859
|
-
paddingTop: 3,
|
2860
|
-
paddingBottom: 3,
|
2861
|
-
paddingLeft: 4,
|
2862
|
-
paddingRight: 4,
|
2863
3151
|
style: { cursor: isDisabled ? "not-allowed" : "pointer" },
|
2864
|
-
|
3152
|
+
variant: "tertiary",
|
3153
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "span", gap: 2, children: [
|
2865
3154
|
/* @__PURE__ */ jsxRuntime.jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
|
2866
3155
|
/* @__PURE__ */ jsxRuntime.jsx(
|
2867
|
-
|
3156
|
+
AddComponentTitle,
|
2868
3157
|
{
|
2869
3158
|
variant: "pi",
|
2870
3159
|
fontWeight: "bold",
|
@@ -2876,7 +3165,7 @@ const AddComponentButton = ({
|
|
2876
3165
|
}
|
2877
3166
|
);
|
2878
3167
|
};
|
2879
|
-
const StyledAddIcon =
|
3168
|
+
const StyledAddIcon = styledComponents.styled(Icons.PlusCircle)`
|
2880
3169
|
height: ${({ theme }) => theme.spaces[6]};
|
2881
3170
|
width: ${({ theme }) => theme.spaces[6]};
|
2882
3171
|
transform: ${({ $isOpen }) => $isOpen ? "rotate(45deg)" : "rotate(0deg)"};
|
@@ -2888,13 +3177,15 @@ const StyledAddIcon = styled__default.default(Icons.PlusCircle)`
|
|
2888
3177
|
fill: ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral600};
|
2889
3178
|
}
|
2890
3179
|
`;
|
2891
|
-
const
|
3180
|
+
const AddComponentTitle = styledComponents.styled(designSystem.Typography)``;
|
3181
|
+
const StyledButton = styledComponents.styled(designSystem.Button)`
|
2892
3182
|
border-radius: 26px;
|
2893
3183
|
border-color: ${({ theme }) => theme.colors.neutral150};
|
2894
3184
|
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
|
3185
|
+
height: 5rem;
|
2895
3186
|
|
2896
3187
|
&:hover {
|
2897
|
-
${
|
3188
|
+
${AddComponentTitle} {
|
2898
3189
|
color: ${({ theme }) => theme.colors.primary600};
|
2899
3190
|
}
|
2900
3191
|
|
@@ -2903,12 +3194,12 @@ const StyledButton = styled__default.default(designSystem.BaseButton)`
|
|
2903
3194
|
fill: ${({ theme }) => theme.colors.primary600};
|
2904
3195
|
}
|
2905
3196
|
> path {
|
2906
|
-
fill: ${({ theme }) => theme.colors.
|
3197
|
+
fill: ${({ theme }) => theme.colors.primary600};
|
2907
3198
|
}
|
2908
3199
|
}
|
2909
3200
|
}
|
2910
3201
|
&:active {
|
2911
|
-
${
|
3202
|
+
${AddComponentTitle} {
|
2912
3203
|
color: ${({ theme }) => theme.colors.primary600};
|
2913
3204
|
}
|
2914
3205
|
${StyledAddIcon} {
|
@@ -2925,27 +3216,15 @@ const ComponentCategory = ({
|
|
2925
3216
|
category,
|
2926
3217
|
components = [],
|
2927
3218
|
variant = "primary",
|
2928
|
-
|
2929
|
-
onAddComponent,
|
2930
|
-
onToggle
|
3219
|
+
onAddComponent
|
2931
3220
|
}) => {
|
2932
3221
|
const { formatMessage } = reactIntl.useIntl();
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion, { expanded: isOpen, onToggle: handleToggle, size: "S", children: [
|
2937
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2938
|
-
designSystem.AccordionToggle,
|
2939
|
-
{
|
2940
|
-
variant,
|
2941
|
-
title: formatMessage({ id: category, defaultMessage: category }),
|
2942
|
-
togglePosition: "left"
|
2943
|
-
}
|
2944
|
-
),
|
2945
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.AccordionContent, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: /* @__PURE__ */ jsxRuntime.jsx(Grid, { children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsxRuntime.jsx(
|
3222
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: category, children: [
|
3223
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Header, { variant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: formatMessage({ id: category, defaultMessage: category }) }) }),
|
3224
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(Grid, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsxRuntime.jsx(
|
2946
3225
|
ComponentBox,
|
2947
3226
|
{
|
2948
|
-
|
3227
|
+
tag: "button",
|
2949
3228
|
type: "button",
|
2950
3229
|
background: "neutral100",
|
2951
3230
|
justifyContent: "center",
|
@@ -2955,34 +3234,32 @@ const ComponentCategory = ({
|
|
2955
3234
|
shrink: 0,
|
2956
3235
|
borderColor: "neutral200",
|
2957
3236
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "center", justifyContent: "center", children: [
|
2958
|
-
/* @__PURE__ */ jsxRuntime.jsx(ComponentIcon.ComponentIcon, { icon }),
|
2959
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold",
|
3237
|
+
/* @__PURE__ */ jsxRuntime.jsx(ComponentIcon.ComponentIcon, { color: "currentColor", background: "primary200", icon }),
|
3238
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: displayName })
|
2960
3239
|
] })
|
2961
3240
|
},
|
2962
3241
|
uid
|
2963
|
-
)) }) })
|
3242
|
+
)) }) })
|
2964
3243
|
] });
|
2965
3244
|
};
|
2966
|
-
const Grid =
|
3245
|
+
const Grid = styledComponents.styled(designSystem.Box)`
|
2967
3246
|
display: grid;
|
2968
3247
|
grid-template-columns: repeat(auto-fit, 14rem);
|
2969
3248
|
grid-gap: ${({ theme }) => theme.spaces[1]};
|
2970
3249
|
`;
|
2971
|
-
const ComponentBox =
|
3250
|
+
const ComponentBox = styledComponents.styled(designSystem.Flex)`
|
3251
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
3252
|
+
cursor: pointer;
|
3253
|
+
|
3254
|
+
@media (prefers-reduced-motion: no-preference) {
|
3255
|
+
transition: color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
3256
|
+
}
|
3257
|
+
|
2972
3258
|
&:focus,
|
2973
3259
|
&:hover {
|
2974
3260
|
border: 1px solid ${({ theme }) => theme.colors.primary200};
|
2975
3261
|
background: ${({ theme }) => theme.colors.primary100};
|
2976
|
-
|
2977
|
-
${designSystem.Typography} {
|
2978
|
-
color: ${({ theme }) => theme.colors.primary600};
|
2979
|
-
}
|
2980
|
-
|
2981
|
-
/* > Flex > ComponentIcon */
|
2982
|
-
> div > div:first-child {
|
2983
|
-
background: ${({ theme }) => theme.colors.primary200};
|
2984
|
-
color: ${({ theme }) => theme.colors.primary600};
|
2985
|
-
}
|
3262
|
+
color: ${({ theme }) => theme.colors.primary600};
|
2986
3263
|
}
|
2987
3264
|
`;
|
2988
3265
|
const ComponentPicker = ({
|
@@ -2991,19 +3268,8 @@ const ComponentPicker = ({
|
|
2991
3268
|
onClickAddComponent
|
2992
3269
|
}) => {
|
2993
3270
|
const { formatMessage } = reactIntl.useIntl();
|
2994
|
-
const [categoryToOpen, setCategoryToOpen] = React__namespace.useState("");
|
2995
|
-
React__namespace.useEffect(() => {
|
2996
|
-
const categoryKeys = Object.keys(dynamicComponentsByCategory);
|
2997
|
-
if (isOpen && categoryKeys.length > 0) {
|
2998
|
-
setCategoryToOpen(categoryKeys[0]);
|
2999
|
-
}
|
3000
|
-
}, [isOpen, dynamicComponentsByCategory]);
|
3001
3271
|
const handleAddComponentToDz = (componentUid) => () => {
|
3002
3272
|
onClickAddComponent(componentUid);
|
3003
|
-
setCategoryToOpen("");
|
3004
|
-
};
|
3005
|
-
const handleClickToggle = (categoryName) => {
|
3006
|
-
setCategoryToOpen((currentCat) => currentCat === categoryName ? "" : categoryName);
|
3007
3273
|
};
|
3008
3274
|
if (!isOpen) {
|
3009
3275
|
return null;
|
@@ -3024,14 +3290,12 @@ const ComponentPicker = ({
|
|
3024
3290
|
id: index.getTranslation("components.DynamicZone.ComponentPicker-label"),
|
3025
3291
|
defaultMessage: "Pick one component"
|
3026
3292
|
}) }) }),
|
3027
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
3293
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Root, { defaultValue: Object.keys(dynamicComponentsByCategory)[0], children: Object.entries(dynamicComponentsByCategory).map(([category, components], index2) => /* @__PURE__ */ jsxRuntime.jsx(
|
3028
3294
|
ComponentCategory,
|
3029
3295
|
{
|
3030
3296
|
category,
|
3031
3297
|
components,
|
3032
3298
|
onAddComponent: handleAddComponentToDz,
|
3033
|
-
isOpen: category === categoryToOpen,
|
3034
|
-
onToggle: handleClickToggle,
|
3035
3299
|
variant: index2 % 2 === 1 ? "primary" : "secondary"
|
3036
3300
|
},
|
3037
3301
|
category
|
@@ -3046,39 +3310,21 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
|
|
3046
3310
|
id: "components.NotAllowedInput.text",
|
3047
3311
|
defaultMessage: "No permissions to see this field"
|
3048
3312
|
});
|
3049
|
-
return /* @__PURE__ */ jsxRuntime.
|
3050
|
-
designSystem.
|
3051
|
-
|
3052
|
-
|
3053
|
-
|
3054
|
-
|
3055
|
-
|
3056
|
-
|
3057
|
-
|
3058
|
-
|
3059
|
-
|
3060
|
-
|
3061
|
-
|
3062
|
-
|
3063
|
-
);
|
3313
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { id: name2, hint, name: name2, required, children: [
|
3314
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
|
3315
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3316
|
+
designSystem.TextInput,
|
3317
|
+
{
|
3318
|
+
disabled: true,
|
3319
|
+
placeholder,
|
3320
|
+
startAction: /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, { fill: "neutral600" }),
|
3321
|
+
type: "text",
|
3322
|
+
value: ""
|
3323
|
+
}
|
3324
|
+
),
|
3325
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
3326
|
+
] });
|
3064
3327
|
};
|
3065
|
-
const StyledIcon = styled__default.default(Icons.EyeStriked)`
|
3066
|
-
& > path {
|
3067
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
3068
|
-
}
|
3069
|
-
`;
|
3070
|
-
function useDebounce(value, delay) {
|
3071
|
-
const [debouncedValue, setDebouncedValue] = React.useState(value);
|
3072
|
-
React.useEffect(() => {
|
3073
|
-
const handler = setTimeout(() => {
|
3074
|
-
setDebouncedValue(value);
|
3075
|
-
}, delay);
|
3076
|
-
return () => {
|
3077
|
-
clearTimeout(handler);
|
3078
|
-
};
|
3079
|
-
}, [value, delay]);
|
3080
|
-
return debouncedValue;
|
3081
|
-
}
|
3082
3328
|
const uidApi = index.contentManagerApi.injectEndpoints({
|
3083
3329
|
endpoints: (builder) => ({
|
3084
3330
|
getDefaultUID: builder.query({
|
@@ -3113,194 +3359,206 @@ const uidApi = index.contentManagerApi.injectEndpoints({
|
|
3113
3359
|
config: {
|
3114
3360
|
params
|
3115
3361
|
}
|
3116
|
-
})
|
3362
|
+
}),
|
3363
|
+
providesTags: (_res, _error, params) => [
|
3364
|
+
{ type: "UidAvailability", id: params.contentTypeUID }
|
3365
|
+
]
|
3117
3366
|
})
|
3118
3367
|
})
|
3119
3368
|
});
|
3120
3369
|
const { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;
|
3121
3370
|
const UID_REGEX = /^[A-Za-z0-9-_.~]*$/;
|
3122
|
-
const UIDInput = React__namespace.forwardRef(
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3143
|
-
id: id ?? "",
|
3144
|
-
...allFormValues
|
3145
|
-
},
|
3146
|
-
params
|
3147
|
-
},
|
3148
|
-
{
|
3149
|
-
skip: field.value || !props.required
|
3150
|
-
}
|
3151
|
-
);
|
3152
|
-
React__namespace.useEffect(() => {
|
3153
|
-
if (apiError) {
|
3154
|
-
toggleNotification({
|
3155
|
-
type: "warning",
|
3156
|
-
message: formatAPIError(apiError)
|
3157
|
-
});
|
3158
|
-
}
|
3159
|
-
}, [apiError, formatAPIError, toggleNotification]);
|
3160
|
-
React__namespace.useEffect(() => {
|
3161
|
-
if (defaultGeneratedUID && field.value === void 0) {
|
3162
|
-
field.onChange(props.name, defaultGeneratedUID);
|
3163
|
-
}
|
3164
|
-
}, [defaultGeneratedUID, field, props.name]);
|
3165
|
-
const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
|
3166
|
-
const handleRegenerateClick = async () => {
|
3167
|
-
try {
|
3168
|
-
const res = await generateUID({
|
3371
|
+
const UIDInput = React__namespace.forwardRef(
|
3372
|
+
({ hint, label, labelAction, name: name2, required, ...props }, ref) => {
|
3373
|
+
const { model, id } = index.useDoc();
|
3374
|
+
const allFormValues = strapiAdmin.useForm("InputUID", (form) => form.values);
|
3375
|
+
const [availability, setAvailability] = React__namespace.useState();
|
3376
|
+
const [showRegenerate, setShowRegenerate] = React__namespace.useState(false);
|
3377
|
+
const isCloning = reactRouterDom.useMatch(index.CLONE_PATH) !== null;
|
3378
|
+
const field = strapiAdmin.useField(name2);
|
3379
|
+
const debouncedValue = useDebounce.useDebounce(field.value, 300);
|
3380
|
+
const hasChanged = debouncedValue !== field.initialValue;
|
3381
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
3382
|
+
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
3383
|
+
const { formatMessage } = reactIntl.useIntl();
|
3384
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
3385
|
+
const params = React__namespace.useMemo(() => index.buildValidParams(query), [query]);
|
3386
|
+
const {
|
3387
|
+
data: defaultGeneratedUID,
|
3388
|
+
isLoading: isGeneratingDefaultUID,
|
3389
|
+
error: apiError
|
3390
|
+
} = useGetDefaultUIDQuery(
|
3391
|
+
{
|
3169
3392
|
contentTypeUID: model,
|
3170
|
-
field:
|
3171
|
-
data: {
|
3393
|
+
field: name2,
|
3394
|
+
data: {
|
3395
|
+
id: id ?? "",
|
3396
|
+
...allFormValues
|
3397
|
+
},
|
3172
3398
|
params
|
3173
|
-
}
|
3174
|
-
|
3175
|
-
field.
|
3176
|
-
}
|
3399
|
+
},
|
3400
|
+
{
|
3401
|
+
skip: field.value || !required
|
3402
|
+
}
|
3403
|
+
);
|
3404
|
+
React__namespace.useEffect(() => {
|
3405
|
+
if (apiError) {
|
3177
3406
|
toggleNotification({
|
3178
|
-
type: "
|
3179
|
-
message: formatAPIError(
|
3407
|
+
type: "warning",
|
3408
|
+
message: formatAPIError(apiError)
|
3180
3409
|
});
|
3181
3410
|
}
|
3182
|
-
}
|
3183
|
-
|
3184
|
-
|
3185
|
-
|
3186
|
-
|
3187
|
-
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
message: formatAPIError(availabilityError)
|
3214
|
-
});
|
3215
|
-
}
|
3216
|
-
}, [availabilityError, formatAPIError, toggleNotification]);
|
3217
|
-
React__namespace.useEffect(() => {
|
3218
|
-
setAvailability(availabilityData);
|
3219
|
-
let timer;
|
3220
|
-
if (availabilityData?.isAvailable) {
|
3221
|
-
timer = window.setTimeout(() => {
|
3222
|
-
setAvailability(void 0);
|
3223
|
-
}, 4e3);
|
3224
|
-
}
|
3225
|
-
return () => {
|
3226
|
-
if (timer) {
|
3227
|
-
clearTimeout(timer);
|
3411
|
+
}, [apiError, formatAPIError, toggleNotification]);
|
3412
|
+
React__namespace.useEffect(() => {
|
3413
|
+
if (defaultGeneratedUID && field.value === void 0) {
|
3414
|
+
field.onChange(name2, defaultGeneratedUID);
|
3415
|
+
}
|
3416
|
+
}, [defaultGeneratedUID, field, name2]);
|
3417
|
+
const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
|
3418
|
+
const handleRegenerateClick = async () => {
|
3419
|
+
try {
|
3420
|
+
const res = await generateUID({
|
3421
|
+
contentTypeUID: model,
|
3422
|
+
field: name2,
|
3423
|
+
data: { id: id ?? "", ...allFormValues },
|
3424
|
+
params
|
3425
|
+
});
|
3426
|
+
if ("data" in res) {
|
3427
|
+
field.onChange(name2, res.data);
|
3428
|
+
} else {
|
3429
|
+
toggleNotification({
|
3430
|
+
type: "danger",
|
3431
|
+
message: formatAPIError(res.error)
|
3432
|
+
});
|
3433
|
+
}
|
3434
|
+
} catch (err) {
|
3435
|
+
toggleNotification({
|
3436
|
+
type: "danger",
|
3437
|
+
message: formatMessage({
|
3438
|
+
id: "notification.error",
|
3439
|
+
defaultMessage: "An error occurred."
|
3440
|
+
})
|
3441
|
+
});
|
3228
3442
|
}
|
3229
3443
|
};
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
// @ts-expect-error – label _could_ be a ReactNode since it's a child, this should be fixed in the DS.
|
3236
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
3237
|
-
designSystem.TextInput,
|
3444
|
+
const {
|
3445
|
+
data: availabilityData,
|
3446
|
+
isLoading: isCheckingAvailability,
|
3447
|
+
error: availabilityError
|
3448
|
+
} = useGetAvailabilityQuery(
|
3238
3449
|
{
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
|
3257
|
-
|
3258
|
-
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3450
|
+
contentTypeUID: model,
|
3451
|
+
field: name2,
|
3452
|
+
value: debouncedValue ? debouncedValue.trim() : "",
|
3453
|
+
params
|
3454
|
+
},
|
3455
|
+
{
|
3456
|
+
// Don't check availability if the value is empty or wasn't changed
|
3457
|
+
skip: !Boolean(
|
3458
|
+
(hasChanged || isCloning) && debouncedValue && UID_REGEX.test(debouncedValue.trim())
|
3459
|
+
)
|
3460
|
+
}
|
3461
|
+
);
|
3462
|
+
React__namespace.useEffect(() => {
|
3463
|
+
if (availabilityError) {
|
3464
|
+
toggleNotification({
|
3465
|
+
type: "warning",
|
3466
|
+
message: formatAPIError(availabilityError)
|
3467
|
+
});
|
3468
|
+
}
|
3469
|
+
}, [availabilityError, formatAPIError, toggleNotification]);
|
3470
|
+
React__namespace.useEffect(() => {
|
3471
|
+
setAvailability(availabilityData);
|
3472
|
+
let timer;
|
3473
|
+
if (availabilityData?.isAvailable) {
|
3474
|
+
timer = window.setTimeout(() => {
|
3475
|
+
setAvailability(void 0);
|
3476
|
+
}, 4e3);
|
3477
|
+
}
|
3478
|
+
return () => {
|
3479
|
+
if (timer) {
|
3480
|
+
clearTimeout(timer);
|
3481
|
+
}
|
3482
|
+
};
|
3483
|
+
}, [availabilityData]);
|
3484
|
+
const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
|
3485
|
+
const fieldRef = strapiAdmin.useFocusInputField(name2);
|
3486
|
+
const composedRefs = designSystem.useComposedRefs(ref, fieldRef);
|
3487
|
+
const shouldShowAvailability = (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;
|
3488
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { hint, name: name2, error: field.error, required, children: [
|
3489
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
3490
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3491
|
+
designSystem.TextInput,
|
3492
|
+
{
|
3493
|
+
ref: composedRefs,
|
3494
|
+
disabled: props.disabled,
|
3495
|
+
endAction: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { position: "relative", gap: 1, children: [
|
3496
|
+
shouldShowAvailability && /* @__PURE__ */ jsxRuntime.jsxs(
|
3497
|
+
TextValidation,
|
3283
3498
|
{
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3499
|
+
alignItems: "center",
|
3500
|
+
gap: 1,
|
3501
|
+
justifyContent: "flex-end",
|
3502
|
+
$available: !!availability?.isAvailable,
|
3503
|
+
"data-not-here-outer": true,
|
3504
|
+
position: "absolute",
|
3505
|
+
pointerEvents: "none",
|
3506
|
+
right: 6,
|
3507
|
+
width: "100px",
|
3508
|
+
children: [
|
3509
|
+
availability?.isAvailable ? /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, {}),
|
3510
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3511
|
+
designSystem.Typography,
|
3512
|
+
{
|
3513
|
+
textColor: availability.isAvailable ? "success600" : "danger600",
|
3514
|
+
variant: "pi",
|
3515
|
+
children: formatMessage(
|
3516
|
+
availability.isAvailable ? {
|
3517
|
+
id: "content-manager.components.uid.available",
|
3518
|
+
defaultMessage: "Available"
|
3519
|
+
} : {
|
3520
|
+
id: "content-manager.components.uid.unavailable",
|
3521
|
+
defaultMessage: "Unavailable"
|
3522
|
+
}
|
3523
|
+
)
|
3524
|
+
}
|
3525
|
+
)
|
3526
|
+
]
|
3292
3527
|
}
|
3293
|
-
)
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3297
|
-
|
3298
|
-
|
3299
|
-
|
3300
|
-
|
3301
|
-
|
3302
|
-
|
3303
|
-
|
3528
|
+
),
|
3529
|
+
!props.disabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
3530
|
+
showRegenerate && /* @__PURE__ */ jsxRuntime.jsx(TextValidation, { alignItems: "center", justifyContent: "flex-end", gap: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "primary600", variant: "pi", children: formatMessage({
|
3531
|
+
id: "content-manager.components.uid.regenerate",
|
3532
|
+
defaultMessage: "Regenerate"
|
3533
|
+
}) }) }),
|
3534
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3535
|
+
FieldActionWrapper,
|
3536
|
+
{
|
3537
|
+
onClick: handleRegenerateClick,
|
3538
|
+
label: formatMessage({
|
3539
|
+
id: "content-manager.components.uid.regenerate",
|
3540
|
+
defaultMessage: "Regenerate"
|
3541
|
+
}),
|
3542
|
+
onMouseEnter: () => setShowRegenerate(true),
|
3543
|
+
onMouseLeave: () => setShowRegenerate(false),
|
3544
|
+
children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingWrapper, { "data-testid": "loading-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Loader, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(Icons.ArrowClockwise, {})
|
3545
|
+
}
|
3546
|
+
)
|
3547
|
+
] })
|
3548
|
+
] }),
|
3549
|
+
onChange: field.onChange,
|
3550
|
+
value: field.value ?? "",
|
3551
|
+
...props
|
3552
|
+
}
|
3553
|
+
),
|
3554
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {}),
|
3555
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
3556
|
+
] });
|
3557
|
+
}
|
3558
|
+
);
|
3559
|
+
const FieldActionWrapper = styledComponents.styled(designSystem.Field.Action)`
|
3560
|
+
width: 1.6rem;
|
3561
|
+
|
3304
3562
|
svg {
|
3305
3563
|
height: 1.6rem;
|
3306
3564
|
width: 1.6rem;
|
@@ -3315,17 +3573,17 @@ const FieldActionWrapper = styled__default.default(designSystem.FieldAction)`
|
|
3315
3573
|
}
|
3316
3574
|
}
|
3317
3575
|
`;
|
3318
|
-
const TextValidation =
|
3576
|
+
const TextValidation = styledComponents.styled(designSystem.Flex)`
|
3319
3577
|
svg {
|
3320
3578
|
height: 1.2rem;
|
3321
3579
|
width: 1.2rem;
|
3322
3580
|
|
3323
3581
|
path {
|
3324
|
-
fill: ${({ theme, available }) => available ? theme.colors.success600 : theme.colors.danger600};
|
3582
|
+
fill: ${({ theme, $available }) => $available ? theme.colors.success600 : theme.colors.danger600};
|
3325
3583
|
}
|
3326
3584
|
}
|
3327
3585
|
`;
|
3328
|
-
const rotation =
|
3586
|
+
const rotation = styledComponents.keyframes`
|
3329
3587
|
from {
|
3330
3588
|
transform: rotate(0deg);
|
3331
3589
|
}
|
@@ -3333,9 +3591,10 @@ const rotation = styled.keyframes`
|
|
3333
3591
|
transform: rotate(359deg);
|
3334
3592
|
}
|
3335
3593
|
`;
|
3336
|
-
const LoadingWrapper =
|
3594
|
+
const LoadingWrapper = styledComponents.styled(designSystem.Flex)`
|
3337
3595
|
animation: ${rotation} 2s infinite linear;
|
3338
3596
|
`;
|
3597
|
+
const MemoizedUIDInput = React__namespace.memo(UIDInput);
|
3339
3598
|
const md = new Markdown__default.default({
|
3340
3599
|
html: true,
|
3341
3600
|
// Enable HTML tags in source
|
@@ -3378,7 +3637,7 @@ const PreviewWysiwyg = ({ data = "" }) => {
|
|
3378
3637
|
);
|
3379
3638
|
return /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: html } }) });
|
3380
3639
|
};
|
3381
|
-
const Wrapper =
|
3640
|
+
const Wrapper = styledComponents.styled.div`
|
3382
3641
|
position: absolute;
|
3383
3642
|
top: 0;
|
3384
3643
|
width: 100%;
|
@@ -3670,17 +3929,17 @@ const Editor = React__namespace.forwardRef(
|
|
3670
3929
|
[editorRef]
|
3671
3930
|
);
|
3672
3931
|
return /* @__PURE__ */ jsxRuntime.jsxs(EditorAndPreviewWrapper, { children: [
|
3673
|
-
/* @__PURE__ */ jsxRuntime.jsx(EditorStylesContainer, { isExpandMode, disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsxRuntime.jsx("textarea", { ref: textareaRef }) }),
|
3932
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorStylesContainer, { $isExpandMode: isExpandMode, $disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsxRuntime.jsx("textarea", { ref: textareaRef }) }),
|
3674
3933
|
isPreviewMode && /* @__PURE__ */ jsxRuntime.jsx(PreviewWysiwyg, { data: value })
|
3675
3934
|
] });
|
3676
3935
|
}
|
3677
3936
|
);
|
3678
|
-
const EditorAndPreviewWrapper =
|
3937
|
+
const EditorAndPreviewWrapper = styledComponents.styled.div`
|
3679
3938
|
position: relative;
|
3680
3939
|
height: calc(100% - 48px);
|
3681
3940
|
`;
|
3682
|
-
const EditorStylesContainer =
|
3683
|
-
cursor: ${({ disabled }) => disabled ? "not-allowed !important" : "auto"};
|
3941
|
+
const EditorStylesContainer = styledComponents.styled.div`
|
3942
|
+
cursor: ${({ $disabled }) => $disabled ? "not-allowed !important" : "auto"};
|
3684
3943
|
height: 100%;
|
3685
3944
|
/* BASICS */
|
3686
3945
|
.CodeMirror-placeholder {
|
@@ -3690,7 +3949,7 @@ const EditorStylesContainer = styled__default.default.div`
|
|
3690
3949
|
.CodeMirror {
|
3691
3950
|
/* Set height, width, borders, and global font properties here */
|
3692
3951
|
font-size: 1.4rem;
|
3693
|
-
height: ${({ isExpandMode }) => isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
|
3952
|
+
height: ${({ $isExpandMode }) => $isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
|
3694
3953
|
color: ${({ theme }) => theme.colors.neutral800};
|
3695
3954
|
direction: ltr;
|
3696
3955
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
@@ -4068,7 +4327,7 @@ const EditorLayout = ({
|
|
4068
4327
|
justifyContent: "flex-end",
|
4069
4328
|
shrink: 0,
|
4070
4329
|
width: "100%",
|
4071
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$1, { onClick: onCollapse, children: [
|
4330
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$1, { onClick: onCollapse, variant: "tertiary", size: "M", children: [
|
4072
4331
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
4073
4332
|
id: "components.Wysiwyg.collapse",
|
4074
4333
|
defaultMessage: "Collapse"
|
@@ -4086,27 +4345,37 @@ const EditorLayout = ({
|
|
4086
4345
|
) }) });
|
4087
4346
|
}
|
4088
4347
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
4089
|
-
designSystem.
|
4348
|
+
designSystem.Flex,
|
4090
4349
|
{
|
4091
4350
|
borderColor: error ? "danger600" : "neutral200",
|
4092
4351
|
borderStyle: "solid",
|
4093
4352
|
borderWidth: "1px",
|
4094
4353
|
hasRadius: true,
|
4354
|
+
direction: "column",
|
4355
|
+
alignItems: "stretch",
|
4095
4356
|
children
|
4096
4357
|
}
|
4097
4358
|
);
|
4098
4359
|
};
|
4099
|
-
const ExpandWrapper =
|
4360
|
+
const ExpandWrapper = styledComponents.styled(designSystem.Flex)`
|
4100
4361
|
background: ${({ theme }) => `${theme.colors.neutral800}${Math.floor(0.2 * 255).toString(16).padStart(2, "0")}`};
|
4101
4362
|
`;
|
4102
|
-
const BoxWithBorder =
|
4363
|
+
const BoxWithBorder = styledComponents.styled(designSystem.Box)`
|
4103
4364
|
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
4104
4365
|
`;
|
4105
|
-
const ExpandButton$1 =
|
4366
|
+
const ExpandButton$1 = styledComponents.styled(designSystem.Button)`
|
4106
4367
|
background-color: transparent;
|
4107
4368
|
border: none;
|
4108
4369
|
align-items: center;
|
4109
4370
|
|
4371
|
+
& > span {
|
4372
|
+
display: flex;
|
4373
|
+
justify-content: space-between;
|
4374
|
+
align-items: center;
|
4375
|
+
width: 100%;
|
4376
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4377
|
+
}
|
4378
|
+
|
4110
4379
|
svg {
|
4111
4380
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4112
4381
|
|
@@ -4373,42 +4642,28 @@ const quoteAndCodeHandler = (editor, markdownType) => {
|
|
4373
4642
|
insertWithoutTextToEdit(editor, markdownType, line, contentLength);
|
4374
4643
|
}
|
4375
4644
|
};
|
4376
|
-
const
|
4377
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4378
|
-
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
4379
|
-
outline-offset: -2px !important;
|
4380
|
-
|
4381
|
-
svg {
|
4382
|
-
width: 1.8rem;
|
4383
|
-
height: 1.8rem;
|
4384
|
-
}
|
4385
|
-
`;
|
4386
|
-
const CustomLinkIconButton = styled__default.default(CustomIconButton)`
|
4387
|
-
svg {
|
4388
|
-
width: 0.8rem;
|
4389
|
-
height: 0.8rem;
|
4390
|
-
}
|
4391
|
-
`;
|
4392
|
-
const MainButtons = styled__default.default(designSystem.IconButtonGroup)`
|
4645
|
+
const MainButtons = styledComponents.styled(designSystem.IconButtonGroup)`
|
4393
4646
|
margin-left: ${({ theme }) => theme.spaces[4]};
|
4394
4647
|
`;
|
4395
|
-
const MoreButton =
|
4648
|
+
const MoreButton = styledComponents.styled(designSystem.IconButton)`
|
4396
4649
|
margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
|
4397
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4398
|
-
|
4399
|
-
svg {
|
4400
|
-
width: 1.8rem;
|
4401
|
-
height: 1.8rem;
|
4402
|
-
}
|
4403
4650
|
`;
|
4404
|
-
const IconButtonGroupMargin =
|
4651
|
+
const IconButtonGroupMargin = styledComponents.styled(designSystem.IconButtonGroup)`
|
4405
4652
|
margin-right: ${({ theme }) => `${theme.spaces[2]}`};
|
4406
4653
|
`;
|
4407
|
-
const ExpandButton =
|
4654
|
+
const ExpandButton = styledComponents.styled(designSystem.Button)`
|
4408
4655
|
background-color: transparent;
|
4409
4656
|
border: none;
|
4410
4657
|
align-items: center;
|
4411
4658
|
|
4659
|
+
& > span {
|
4660
|
+
display: flex;
|
4661
|
+
justify-content: space-between;
|
4662
|
+
align-items: center;
|
4663
|
+
width: 100%;
|
4664
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4665
|
+
}
|
4666
|
+
|
4412
4667
|
svg {
|
4413
4668
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4414
4669
|
path {
|
@@ -4420,8 +4675,8 @@ const ExpandButton = styled__default.default(designSystem.BaseButton)`
|
|
4420
4675
|
`;
|
4421
4676
|
const WysiwygFooter = ({ onToggleExpand }) => {
|
4422
4677
|
const { formatMessage } = reactIntl.useIntl();
|
4423
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, children: [
|
4424
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
4678
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, variant: "tertiary", size: "M", children: [
|
4679
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: formatMessage({
|
4425
4680
|
id: "components.WysiwygBottomControls.fullscreen",
|
4426
4681
|
defaultMessage: "Expand"
|
4427
4682
|
}) }),
|
@@ -4443,7 +4698,7 @@ const WysiwygNav = ({
|
|
4443
4698
|
id: "components.Wysiwyg.selectOptions.title",
|
4444
4699
|
defaultMessage: "Add a title"
|
4445
4700
|
});
|
4446
|
-
|
4701
|
+
React__namespace.useRef(null);
|
4447
4702
|
const handleTogglePopover = () => {
|
4448
4703
|
setVisiblePopover((prev) => !prev);
|
4449
4704
|
};
|
@@ -4456,21 +4711,30 @@ const WysiwygNav = ({
|
|
4456
4711
|
justifyContent: "space-between",
|
4457
4712
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4458
4713
|
children: [
|
4459
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
4460
|
-
/* @__PURE__ */ jsxRuntime.
|
4461
|
-
|
4462
|
-
|
4463
|
-
|
4464
|
-
|
4465
|
-
|
4466
|
-
|
4467
|
-
|
4714
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
|
4715
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
4716
|
+
designSystem.SingleSelect,
|
4717
|
+
{
|
4718
|
+
disabled: true,
|
4719
|
+
placeholder: selectPlaceholder,
|
4720
|
+
"aria-label": selectPlaceholder,
|
4721
|
+
size: "S",
|
4722
|
+
children: [
|
4723
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h1", children: "h1" }),
|
4724
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h2", children: "h2" }),
|
4725
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h3", children: "h3" }),
|
4726
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h4", children: "h4" }),
|
4727
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h5", children: "h5" }),
|
4728
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h6", children: "h6" })
|
4729
|
+
]
|
4730
|
+
}
|
4731
|
+
) }),
|
4468
4732
|
/* @__PURE__ */ jsxRuntime.jsxs(MainButtons, { children: [
|
4469
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
4470
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
4471
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
4733
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {}) }),
|
4734
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Italic, {}) }),
|
4735
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Underline, {}) })
|
4472
4736
|
] }),
|
4473
|
-
/* @__PURE__ */ jsxRuntime.jsx(MoreButton, { disabled: true, label: "More",
|
4737
|
+
/* @__PURE__ */ jsxRuntime.jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.More, {}) })
|
4474
4738
|
] }),
|
4475
4739
|
!isExpandMode && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
|
4476
4740
|
id: "components.Wysiwyg.ToggleMode.markdown-mode",
|
@@ -4488,14 +4752,14 @@ const WysiwygNav = ({
|
|
4488
4752
|
justifyContent: "space-between",
|
4489
4753
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4490
4754
|
children: [
|
4491
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
4492
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
4755
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
|
4756
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
4493
4757
|
designSystem.SingleSelect,
|
4494
4758
|
{
|
4495
4759
|
placeholder: selectPlaceholder,
|
4496
|
-
label: selectPlaceholder,
|
4497
|
-
size: "S",
|
4760
|
+
"aria-label": selectPlaceholder,
|
4498
4761
|
onChange: (value) => onActionClick(value, editorRef),
|
4762
|
+
size: "S",
|
4499
4763
|
children: [
|
4500
4764
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h1", children: "h1" }),
|
4501
4765
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h2", children: "h2" }),
|
@@ -4505,117 +4769,103 @@ const WysiwygNav = ({
|
|
4505
4769
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h6", children: "h6" })
|
4506
4770
|
]
|
4507
4771
|
}
|
4508
|
-
),
|
4772
|
+
) }),
|
4509
4773
|
/* @__PURE__ */ jsxRuntime.jsxs(MainButtons, { children: [
|
4774
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { onClick: () => onActionClick("Bold", editorRef), label: "Bold", name: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {}) }),
|
4510
4775
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4511
|
-
|
4512
|
-
{
|
4513
|
-
onClick: () => onActionClick("Bold", editorRef),
|
4514
|
-
label: "Bold",
|
4515
|
-
name: "Bold",
|
4516
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {})
|
4517
|
-
}
|
4518
|
-
),
|
4519
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
4520
|
-
CustomIconButton,
|
4776
|
+
designSystem.IconButton,
|
4521
4777
|
{
|
4522
4778
|
onClick: () => onActionClick("Italic", editorRef),
|
4523
4779
|
label: "Italic",
|
4524
4780
|
name: "Italic",
|
4525
|
-
|
4781
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Italic, {})
|
4526
4782
|
}
|
4527
4783
|
),
|
4528
4784
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4529
|
-
|
4785
|
+
designSystem.IconButton,
|
4530
4786
|
{
|
4531
4787
|
onClick: () => onActionClick("Underline", editorRef),
|
4532
4788
|
label: "Underline",
|
4533
4789
|
name: "Underline",
|
4534
|
-
|
4790
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Underline, {})
|
4535
4791
|
}
|
4536
4792
|
)
|
4537
4793
|
] }),
|
4538
|
-
/* @__PURE__ */ jsxRuntime.
|
4539
|
-
MoreButton,
|
4540
|
-
{
|
4541
|
-
|
4542
|
-
|
4543
|
-
|
4544
|
-
|
4545
|
-
|
4546
|
-
|
4547
|
-
|
4548
|
-
|
4549
|
-
|
4550
|
-
|
4551
|
-
|
4552
|
-
|
4553
|
-
|
4554
|
-
|
4555
|
-
|
4556
|
-
|
4557
|
-
|
4558
|
-
|
4559
|
-
|
4560
|
-
|
4561
|
-
|
4562
|
-
|
4563
|
-
|
4564
|
-
|
4565
|
-
|
4566
|
-
|
4567
|
-
|
4568
|
-
|
4569
|
-
|
4570
|
-
|
4571
|
-
|
4572
|
-
|
4573
|
-
|
4574
|
-
|
4575
|
-
|
4576
|
-
|
4577
|
-
|
4578
|
-
|
4579
|
-
|
4580
|
-
|
4581
|
-
|
4582
|
-
|
4583
|
-
|
4584
|
-
|
4585
|
-
|
4586
|
-
|
4587
|
-
|
4588
|
-
|
4589
|
-
|
4590
|
-
|
4591
|
-
|
4592
|
-
|
4593
|
-
|
4594
|
-
|
4595
|
-
|
4596
|
-
|
4597
|
-
|
4598
|
-
|
4599
|
-
|
4600
|
-
|
4601
|
-
|
4602
|
-
|
4603
|
-
|
4604
|
-
|
4605
|
-
|
4606
|
-
|
4607
|
-
|
4608
|
-
|
4609
|
-
|
4610
|
-
|
4611
|
-
|
4612
|
-
|
4613
|
-
name: "Quote",
|
4614
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Quotes, {})
|
4615
|
-
}
|
4616
|
-
)
|
4617
|
-
] })
|
4618
|
-
] }) })
|
4794
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { children: [
|
4795
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(MoreButton, { label: "More", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.More, {}) }) }),
|
4796
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 2, children: [
|
4797
|
+
/* @__PURE__ */ jsxRuntime.jsxs(IconButtonGroupMargin, { children: [
|
4798
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4799
|
+
designSystem.IconButton,
|
4800
|
+
{
|
4801
|
+
onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
|
4802
|
+
label: "Strikethrough",
|
4803
|
+
name: "Strikethrough",
|
4804
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.StrikeThrough, {})
|
4805
|
+
}
|
4806
|
+
),
|
4807
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4808
|
+
designSystem.IconButton,
|
4809
|
+
{
|
4810
|
+
onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
|
4811
|
+
label: "BulletList",
|
4812
|
+
name: "BulletList",
|
4813
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.BulletList, {})
|
4814
|
+
}
|
4815
|
+
),
|
4816
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4817
|
+
designSystem.IconButton,
|
4818
|
+
{
|
4819
|
+
onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
|
4820
|
+
label: "NumberList",
|
4821
|
+
name: "NumberList",
|
4822
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.NumberList, {})
|
4823
|
+
}
|
4824
|
+
)
|
4825
|
+
] }),
|
4826
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.IconButtonGroup, { children: [
|
4827
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4828
|
+
designSystem.IconButton,
|
4829
|
+
{
|
4830
|
+
onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
|
4831
|
+
label: "Code",
|
4832
|
+
name: "Code",
|
4833
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Code, {})
|
4834
|
+
}
|
4835
|
+
),
|
4836
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4837
|
+
designSystem.IconButton,
|
4838
|
+
{
|
4839
|
+
onClick: () => {
|
4840
|
+
handleTogglePopover();
|
4841
|
+
onToggleMediaLib();
|
4842
|
+
},
|
4843
|
+
label: "Image",
|
4844
|
+
name: "Image",
|
4845
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Image, {})
|
4846
|
+
}
|
4847
|
+
),
|
4848
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4849
|
+
designSystem.IconButton,
|
4850
|
+
{
|
4851
|
+
onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
|
4852
|
+
label: "Link",
|
4853
|
+
name: "Link",
|
4854
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Link, {})
|
4855
|
+
}
|
4856
|
+
),
|
4857
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4858
|
+
designSystem.IconButton,
|
4859
|
+
{
|
4860
|
+
onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
|
4861
|
+
label: "Quote",
|
4862
|
+
name: "Quote",
|
4863
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Quotes, {})
|
4864
|
+
}
|
4865
|
+
)
|
4866
|
+
] })
|
4867
|
+
] }) })
|
4868
|
+
] })
|
4619
4869
|
] }),
|
4620
4870
|
onTogglePreviewMode && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
|
4621
4871
|
id: "components.Wysiwyg.ToggleMode.preview-mode",
|
@@ -4625,19 +4875,6 @@ const WysiwygNav = ({
|
|
4625
4875
|
}
|
4626
4876
|
);
|
4627
4877
|
};
|
4628
|
-
const StyledFlex = styled__default.default(designSystem.Flex)`
|
4629
|
-
/* Hide the label, every input needs a label. */
|
4630
|
-
label {
|
4631
|
-
border: 0;
|
4632
|
-
clip: rect(0 0 0 0);
|
4633
|
-
height: 1px;
|
4634
|
-
margin: -1px;
|
4635
|
-
overflow: hidden;
|
4636
|
-
padding: 0;
|
4637
|
-
position: absolute;
|
4638
|
-
width: 1px;
|
4639
|
-
}
|
4640
|
-
`;
|
4641
4878
|
const Wysiwyg = React__namespace.forwardRef(
|
4642
4879
|
({ hint, disabled, label, name: name2, placeholder, required, labelAction }, forwardedRef) => {
|
4643
4880
|
const field = strapiAdmin.useField(name2);
|
@@ -4696,15 +4933,15 @@ const Wysiwyg = React__namespace.forwardRef(
|
|
4696
4933
|
const handleSelectAssets = (files) => {
|
4697
4934
|
const formattedFiles = files.map((f) => ({
|
4698
4935
|
alt: f.alternativeText || f.name,
|
4699
|
-
url:
|
4936
|
+
url: useDebounce.prefixFileUrlWithBackendUrl(f.url),
|
4700
4937
|
mime: f.mime
|
4701
4938
|
}));
|
4702
4939
|
insertFile(editorRef, formattedFiles);
|
4703
4940
|
setMediaLibVisible(false);
|
4704
4941
|
};
|
4705
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field, { name: name2, hint, error: field.error, required, children: [
|
4942
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: name2, hint, error: field.error, required, children: [
|
4706
4943
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
4707
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
4944
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
4708
4945
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
4709
4946
|
EditorLayout,
|
4710
4947
|
{
|
@@ -4745,24 +4982,29 @@ const Wysiwyg = React__namespace.forwardRef(
|
|
4745
4982
|
]
|
4746
4983
|
}
|
4747
4984
|
),
|
4748
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
4749
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
4985
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
4986
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
4750
4987
|
] }),
|
4751
4988
|
mediaLibVisible && // @ts-expect-error – TODO: fix this way of injecting because it's not really typeable without a registry.
|
4752
4989
|
/* @__PURE__ */ jsxRuntime.jsx(MediaLibraryDialog, { onClose: handleToggleMediaLib, onSelectAssets: handleSelectAssets })
|
4753
4990
|
] });
|
4754
4991
|
}
|
4755
4992
|
);
|
4993
|
+
const MemoizedWysiwyg = React__namespace.memo(Wysiwyg);
|
4756
4994
|
const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
4757
|
-
const { id } = index.useDoc();
|
4995
|
+
const { id, document: document2, collectionType } = index.useDoc();
|
4758
4996
|
const isFormDisabled = strapiAdmin.useForm("InputRenderer", (state) => state.disabled);
|
4759
4997
|
const isInDynamicZone = useDynamicZone("isInDynamicZone", (state) => state.isInDynamicZone);
|
4760
4998
|
const canCreateFields = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canCreateFields);
|
4761
4999
|
const canReadFields = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canReadFields);
|
4762
5000
|
const canUpdateFields = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canUpdateFields);
|
4763
5001
|
const canUserAction = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canUserAction);
|
4764
|
-
|
4765
|
-
|
5002
|
+
let idToCheck = id;
|
5003
|
+
if (collectionType === index.SINGLE_TYPES) {
|
5004
|
+
idToCheck = document2?.documentId;
|
5005
|
+
}
|
5006
|
+
const editableFields = idToCheck ? canUpdateFields : canCreateFields;
|
5007
|
+
const readableFields = idToCheck ? canReadFields : canCreateFields;
|
4766
5008
|
const canUserReadField = canUserAction(props.name, readableFields, props.type);
|
4767
5009
|
const canUserEditField = canUserAction(props.name, editableFields, props.type);
|
4768
5010
|
const fields = strapiAdmin.useStrapiApp("InputRenderer", (app) => app.fields);
|
@@ -4773,6 +5015,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4773
5015
|
const {
|
4774
5016
|
edit: { components }
|
4775
5017
|
} = index.useDocLayout();
|
5018
|
+
const field = strapiAdmin.useField(props.name);
|
4776
5019
|
if (!visible) {
|
4777
5020
|
return null;
|
4778
5021
|
}
|
@@ -4783,7 +5026,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4783
5026
|
if (attributeHasCustomFieldProperty(props.attribute)) {
|
4784
5027
|
const CustomInput = lazyComponentStore[props.attribute.customField];
|
4785
5028
|
if (CustomInput) {
|
4786
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CustomInput, { ...props, hint, disabled: fieldIsDisabled });
|
5029
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CustomInput, { ...props, ...field, hint, disabled: fieldIsDisabled });
|
4787
5030
|
}
|
4788
5031
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
4789
5032
|
strapiAdmin.InputRenderer,
|
@@ -4802,10 +5045,10 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4802
5045
|
}
|
4803
5046
|
switch (props.type) {
|
4804
5047
|
case "blocks":
|
4805
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
5048
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MemoizedBlocksInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4806
5049
|
case "component":
|
4807
5050
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
4808
|
-
|
5051
|
+
MemoizedComponentInput,
|
4809
5052
|
{
|
4810
5053
|
...props,
|
4811
5054
|
hint,
|
@@ -4817,11 +5060,11 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4817
5060
|
case "dynamiczone":
|
4818
5061
|
return /* @__PURE__ */ jsxRuntime.jsx(DynamicZone, { ...props, hint, disabled: fieldIsDisabled });
|
4819
5062
|
case "relation":
|
4820
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Relations.
|
5063
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Relations.MemoizedRelationsField, { ...props, hint, disabled: fieldIsDisabled });
|
4821
5064
|
case "richtext":
|
4822
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
5065
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MemoizedWysiwyg, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4823
5066
|
case "uid":
|
4824
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
5067
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MemoizedUIDInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4825
5068
|
case "enumeration":
|
4826
5069
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
4827
5070
|
strapiAdmin.InputRenderer,
|
@@ -4853,7 +5096,9 @@ const useFieldHint = (hint = void 0, attribute) => {
|
|
4853
5096
|
if (!maximum && !minimum) {
|
4854
5097
|
return hint;
|
4855
5098
|
}
|
4856
|
-
const units = !["biginteger", "integer", "number"].includes(
|
5099
|
+
const units = !["biginteger", "integer", "number", "dynamiczone", "component"].includes(
|
5100
|
+
attribute.type
|
5101
|
+
) ? formatMessage(
|
4857
5102
|
{
|
4858
5103
|
id: "content-manager.form.Input.hint.character.unit",
|
4859
5104
|
defaultMessage: "{maxValue, plural, one { character} other { characters}}"
|
@@ -4893,6 +5138,7 @@ const getMinMax = (attribute) => {
|
|
4893
5138
|
return { maximum: void 0, minimum: void 0 };
|
4894
5139
|
}
|
4895
5140
|
};
|
5141
|
+
const MemoizedInputRenderer = React.memo(InputRenderer);
|
4896
5142
|
const DynamicComponent = ({
|
4897
5143
|
componentUid,
|
4898
5144
|
disabled,
|
@@ -4906,7 +5152,6 @@ const DynamicComponent = ({
|
|
4906
5152
|
dynamicComponentsByCategory = {},
|
4907
5153
|
onAddComponent
|
4908
5154
|
}) => {
|
4909
|
-
const [isOpen, setIsOpen] = React__namespace.useState(true);
|
4910
5155
|
const { formatMessage } = reactIntl.useIntl();
|
4911
5156
|
const formValues = strapiAdmin.useForm("DynamicComponent", (state) => state.values);
|
4912
5157
|
const {
|
@@ -4915,7 +5160,7 @@ const DynamicComponent = ({
|
|
4915
5160
|
const title = React__namespace.useMemo(() => {
|
4916
5161
|
const { mainField } = components[componentUid]?.settings ?? { mainField: "id" };
|
4917
5162
|
const mainFieldValue = objects.getIn(formValues, `${name2}.${index$1}.${mainField}`);
|
4918
|
-
const displayedValue = mainField === "id" ? "" : String(mainFieldValue).trim();
|
5163
|
+
const displayedValue = mainField === "id" || !mainFieldValue ? "" : String(mainFieldValue).trim();
|
4919
5164
|
const mainValue = displayedValue.length > 0 ? `- ${displayedValue}` : displayedValue;
|
4920
5165
|
return mainValue;
|
4921
5166
|
}, [componentUid, components, formValues, name2, index$1]);
|
@@ -4926,9 +5171,6 @@ const DynamicComponent = ({
|
|
4926
5171
|
) ?? { icon: null, displayName: null };
|
4927
5172
|
return { icon: icon2, displayName: displayName2 };
|
4928
5173
|
}, [componentUid, dynamicComponentsByCategory]);
|
4929
|
-
const handleToggle = () => {
|
4930
|
-
setIsOpen((s) => !s);
|
4931
|
-
};
|
4932
5174
|
const [{ handlerId, isDragging, handleKeyDown }, boxRef, dropRef, dragRef, dragPreviewRef] = useDragAndDrop.useDragAndDrop(!disabled, {
|
4933
5175
|
type: `${useDragAndDrop.ItemTypes.DYNAMIC_ZONE}_${name2}`,
|
4934
5176
|
index: index$1,
|
@@ -4945,12 +5187,20 @@ const DynamicComponent = ({
|
|
4945
5187
|
React__namespace.useEffect(() => {
|
4946
5188
|
dragPreviewRef(reactDndHtml5Backend.getEmptyImage(), { captureDraggingState: false });
|
4947
5189
|
}, [dragPreviewRef, index$1]);
|
5190
|
+
const accordionValue = React__namespace.useId();
|
5191
|
+
const { value = [], rawError } = strapiAdmin.useField(`${name2}.${index$1}`);
|
5192
|
+
const [collapseToOpen, setCollapseToOpen] = React__namespace.useState("");
|
5193
|
+
React__namespace.useEffect(() => {
|
5194
|
+
if (rawError && value) {
|
5195
|
+
setCollapseToOpen(accordionValue);
|
5196
|
+
}
|
5197
|
+
}, [rawError, value, accordionValue]);
|
4948
5198
|
const composedBoxRefs = designSystem.useComposedRefs(boxRef, dropRef);
|
4949
|
-
const accordionActions = disabled ? null : /* @__PURE__ */ jsxRuntime.jsxs(
|
5199
|
+
const accordionActions = disabled ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
4950
5200
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4951
|
-
|
5201
|
+
designSystem.IconButton,
|
4952
5202
|
{
|
4953
|
-
|
5203
|
+
variant: "ghost",
|
4954
5204
|
label: formatMessage(
|
4955
5205
|
{
|
4956
5206
|
id: index.getTranslation("components.DynamicZone.delete-label"),
|
@@ -4965,10 +5215,7 @@ const DynamicComponent = ({
|
|
4965
5215
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4966
5216
|
designSystem.IconButton,
|
4967
5217
|
{
|
4968
|
-
|
4969
|
-
role: "button",
|
4970
|
-
borderWidth: 0,
|
4971
|
-
tabIndex: 0,
|
5218
|
+
variant: "ghost",
|
4972
5219
|
onClick: (e) => e.stopPropagation(),
|
4973
5220
|
"data-handler-id": handlerId,
|
4974
5221
|
ref: dragRef,
|
@@ -4983,7 +5230,7 @@ const DynamicComponent = ({
|
|
4983
5230
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
4984
5231
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Trigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
|
4985
5232
|
/* @__PURE__ */ jsxRuntime.jsx(Icons.More, { "aria-hidden": true, focusable: false }),
|
4986
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, {
|
5233
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { tag: "span", children: formatMessage({
|
4987
5234
|
id: index.getTranslation("components.DynamicZone.more-actions"),
|
4988
5235
|
defaultMessage: "More actions"
|
4989
5236
|
}) })
|
@@ -5012,62 +5259,76 @@ const DynamicComponent = ({
|
|
5012
5259
|
] })
|
5013
5260
|
] })
|
5014
5261
|
] });
|
5015
|
-
|
5262
|
+
const accordionTitle = title ? `${displayName} ${title}` : displayName;
|
5263
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
|
5016
5264
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Rectangle, { background: "neutral200" }) }),
|
5017
|
-
/* @__PURE__ */ jsxRuntime.jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview, {}) : /* @__PURE__ */ jsxRuntime.
|
5018
|
-
/* @__PURE__ */ jsxRuntime.
|
5019
|
-
|
5265
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Root, { value: collapseToOpen, onValueChange: setCollapseToOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: accordionValue, children: [
|
5266
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
|
5267
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
5268
|
+
designSystem.Accordion.Trigger,
|
5269
|
+
{
|
5270
|
+
icon: icon && ComponentIcon.COMPONENT_ICONS[icon] ? ComponentIcon.COMPONENT_ICONS[icon] : ComponentIcon.COMPONENT_ICONS.dashboard,
|
5271
|
+
children: accordionTitle
|
5272
|
+
}
|
5273
|
+
),
|
5274
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Actions, { children: accordionActions })
|
5275
|
+
] }),
|
5276
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsxRuntime.jsx(
|
5277
|
+
designSystem.Grid.Item,
|
5020
5278
|
{
|
5021
|
-
|
5022
|
-
|
5023
|
-
|
5024
|
-
|
5025
|
-
|
5026
|
-
|
5027
|
-
|
5028
|
-
|
5029
|
-
|
5030
|
-
|
5031
|
-
|
5279
|
+
col: 12,
|
5280
|
+
s: 12,
|
5281
|
+
xs: 12,
|
5282
|
+
direction: "column",
|
5283
|
+
alignItems: "stretch",
|
5284
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
5285
|
+
const fieldName = `${name2}.${index$1}.${field.name}`;
|
5286
|
+
const fieldWithTranslatedLabel = {
|
5287
|
+
...field,
|
5288
|
+
label: formatMessage({
|
5289
|
+
id: `content-manager.components.${componentUid}.${field.name}`,
|
5290
|
+
defaultMessage: field.label
|
5291
|
+
})
|
5292
|
+
};
|
5293
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
5294
|
+
designSystem.Grid.Item,
|
5295
|
+
{
|
5296
|
+
col: size,
|
5297
|
+
s: 12,
|
5298
|
+
xs: 12,
|
5299
|
+
direction: "column",
|
5300
|
+
alignItems: "stretch",
|
5301
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(MemoizedInputRenderer, { ...fieldWithTranslatedLabel, name: fieldName })
|
5302
|
+
},
|
5303
|
+
fieldName
|
5304
|
+
);
|
5305
|
+
}) })
|
5306
|
+
},
|
5307
|
+
rowInd
|
5308
|
+
)) }) }) }) })
|
5309
|
+
] }) }) })
|
5032
5310
|
] });
|
5033
5311
|
};
|
5034
|
-
const
|
5035
|
-
/*
|
5036
|
-
we need to remove the background from the button but we can't
|
5037
|
-
wrap the element in styled because it breaks the forwardedAs which
|
5038
|
-
we need for drag handler to work on firefox
|
5039
|
-
*/
|
5040
|
-
div[role='button'] {
|
5041
|
-
background: transparent;
|
5042
|
-
}
|
5043
|
-
`;
|
5044
|
-
const IconButtonCustom = styled__default.default(designSystem.IconButton)`
|
5045
|
-
background-color: transparent;
|
5046
|
-
|
5047
|
-
svg path {
|
5048
|
-
fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : theme.colors.neutral600};
|
5049
|
-
}
|
5050
|
-
`;
|
5051
|
-
const StyledBox = styled__default.default(designSystem.Box)`
|
5312
|
+
const StyledBox = styledComponents.styled(designSystem.Box)`
|
5052
5313
|
> div:first-child {
|
5053
5314
|
box-shadow: ${({ theme }) => theme.shadows.tableShadow};
|
5054
5315
|
}
|
5055
5316
|
`;
|
5056
|
-
const AccordionContentRadius =
|
5317
|
+
const AccordionContentRadius = styledComponents.styled(designSystem.Box)`
|
5057
5318
|
border-radius: 0 0 ${({ theme }) => theme.spaces[1]} ${({ theme }) => theme.spaces[1]};
|
5058
5319
|
`;
|
5059
|
-
const Rectangle =
|
5320
|
+
const Rectangle = styledComponents.styled(designSystem.Box)`
|
5060
5321
|
width: ${({ theme }) => theme.spaces[2]};
|
5061
5322
|
height: ${({ theme }) => theme.spaces[4]};
|
5062
5323
|
`;
|
5063
|
-
const Preview =
|
5324
|
+
const Preview = styledComponents.styled.span`
|
5064
5325
|
display: block;
|
5065
5326
|
background-color: ${({ theme }) => theme.colors.primary100};
|
5066
5327
|
outline: 1px dashed ${({ theme }) => theme.colors.primary500};
|
5067
5328
|
outline-offset: -1px;
|
5068
5329
|
padding: ${({ theme }) => theme.spaces[6]};
|
5069
5330
|
`;
|
5070
|
-
const ComponentContainer =
|
5331
|
+
const ComponentContainer = styledComponents.styled(designSystem.Box)`
|
5071
5332
|
list-style: none;
|
5072
5333
|
padding: 0;
|
5073
5334
|
margin: 0;
|
@@ -5118,7 +5379,7 @@ const [DynamicZoneProvider, useDynamicZone] = strapiAdmin.createContext(
|
|
5118
5379
|
);
|
5119
5380
|
const DynamicZone = ({
|
5120
5381
|
attribute,
|
5121
|
-
disabled,
|
5382
|
+
disabled: disabledProp,
|
5122
5383
|
hint,
|
5123
5384
|
label,
|
5124
5385
|
labelAction,
|
@@ -5128,7 +5389,8 @@ const DynamicZone = ({
|
|
5128
5389
|
const { max = Infinity, min = -Infinity } = attribute ?? {};
|
5129
5390
|
const [addComponentIsOpen, setAddComponentIsOpen] = React__namespace.useState(false);
|
5130
5391
|
const [liveText, setLiveText] = React__namespace.useState("");
|
5131
|
-
const { components } = index.useDoc();
|
5392
|
+
const { components, isLoading } = index.useDoc();
|
5393
|
+
const disabled = disabledProp || isLoading;
|
5132
5394
|
const { addFieldRow, removeFieldRow, moveFieldRow } = strapiAdmin.useForm(
|
5133
5395
|
"DynamicZone",
|
5134
5396
|
({ addFieldRow: addFieldRow2, removeFieldRow: removeFieldRow2, moveFieldRow: moveFieldRow2 }) => ({
|
@@ -5235,7 +5497,7 @@ const DynamicZone = ({
|
|
5235
5497
|
const handleRemoveComponent = (name22, currentIndex) => () => {
|
5236
5498
|
removeFieldRow(name22, currentIndex);
|
5237
5499
|
};
|
5238
|
-
const hasError = error !== void 0
|
5500
|
+
const hasError = error !== void 0;
|
5239
5501
|
const renderButtonLabel = () => {
|
5240
5502
|
if (addComponentIsOpen) {
|
5241
5503
|
return formatMessage({ id: "app.utils.close-label", defaultMessage: "Close" });
|
@@ -5335,13 +5597,13 @@ const DynamicZone = ({
|
|
5335
5597
|
)
|
5336
5598
|
] }) });
|
5337
5599
|
};
|
5338
|
-
exports.BlocksInput = BlocksInput;
|
5339
|
-
exports.ComponentInput = ComponentInput;
|
5340
5600
|
exports.DynamicZone = DynamicZone;
|
5341
|
-
exports.
|
5601
|
+
exports.MemoizedBlocksInput = MemoizedBlocksInput;
|
5602
|
+
exports.MemoizedComponentInput = MemoizedComponentInput;
|
5603
|
+
exports.MemoizedInputRenderer = MemoizedInputRenderer;
|
5604
|
+
exports.MemoizedUIDInput = MemoizedUIDInput;
|
5605
|
+
exports.MemoizedWysiwyg = MemoizedWysiwyg;
|
5342
5606
|
exports.NotAllowedInput = NotAllowedInput;
|
5343
|
-
exports.UIDInput = UIDInput;
|
5344
|
-
exports.Wysiwyg = Wysiwyg;
|
5345
5607
|
exports.createDefaultForm = createDefaultForm;
|
5346
5608
|
exports.prepareTempKeys = prepareTempKeys;
|
5347
5609
|
exports.removeFieldsThatDontExistOnSchema = removeFieldsThatDontExistOnSchema;
|
@@ -5349,4 +5611,4 @@ exports.transformDocument = transformDocument;
|
|
5349
5611
|
exports.useDynamicZone = useDynamicZone;
|
5350
5612
|
exports.useFieldHint = useFieldHint;
|
5351
5613
|
exports.useLazyComponents = useLazyComponents;
|
5352
|
-
//# sourceMappingURL=Field-
|
5614
|
+
//# sourceMappingURL=Field-DUK83cfh.js.map
|