@strapi/content-manager 0.0.0-experimental.a65a85fdea97faae8679d3ffc5f9d79af61abd26 → 0.0.0-experimental.abc
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--2aLCv-G.mjs → ComponentConfigurationPage-B3yDbeU1.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage--2aLCv-G.mjs.map → ComponentConfigurationPage-B3yDbeU1.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-43KmCNQE.js → ComponentConfigurationPage-KXSuLnQD.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-43KmCNQE.js.map → ComponentConfigurationPage-KXSuLnQD.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-BfFzJ4Br.js → EditConfigurationPage-BQ17--5R.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BfFzJ4Br.js.map → EditConfigurationPage-BQ17--5R.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CUcGHHvQ.mjs → EditConfigurationPage-D7PrLO8j.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CUcGHHvQ.mjs.map → EditConfigurationPage-D7PrLO8j.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-Bm8lgcm6.mjs → EditViewPage-B7VgwJaG.mjs} +58 -47
- package/dist/_chunks/EditViewPage-B7VgwJaG.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-CzOT5Kpj.js → EditViewPage-BgjdnGz2.js} +57 -48
- package/dist/_chunks/EditViewPage-BgjdnGz2.js.map +1 -0
- package/dist/_chunks/{Field-Caef4JjM.js → Field-CdK7ZLmv.js} +1030 -800
- package/dist/_chunks/Field-CdK7ZLmv.js.map +1 -0
- package/dist/_chunks/{Field-Dlh0uGnL.mjs → Field-tHCw4lGA.mjs} +981 -750
- package/dist/_chunks/Field-tHCw4lGA.mjs.map +1 -0
- package/dist/_chunks/{Form-EnaQL_6L.mjs → Form-BJxdTv3Q.mjs} +56 -43
- package/dist/_chunks/Form-BJxdTv3Q.mjs.map +1 -0
- package/dist/_chunks/{Form-BzuAjtRq.js → Form-C_0KTVvV.js} +55 -43
- package/dist/_chunks/Form-C_0KTVvV.js.map +1 -0
- package/dist/_chunks/{History-D6sbCJvo.mjs → History-DR2txJLE.mjs} +151 -57
- package/dist/_chunks/History-DR2txJLE.mjs.map +1 -0
- package/dist/_chunks/{History-C17LiyRg.js → History-nuEzM5qm.js} +151 -58
- package/dist/_chunks/History-nuEzM5qm.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-Dks5SX6f.js → ListConfigurationPage-CnB86Psm.js} +70 -61
- package/dist/_chunks/ListConfigurationPage-CnB86Psm.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-Ce4qs7qE.mjs → ListConfigurationPage-voFVtXu6.mjs} +67 -57
- package/dist/_chunks/ListConfigurationPage-voFVtXu6.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-Be7S5aKL.mjs → ListViewPage-B_GaWgRH.mjs} +95 -106
- package/dist/_chunks/ListViewPage-B_GaWgRH.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-BwrZrPsh.js → ListViewPage-SXIXm-RM.js} +100 -111
- package/dist/_chunks/ListViewPage-SXIXm-RM.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-Cu5r1-JT.js → NoContentTypePage-BzsQ3hLZ.js} +5 -5
- package/dist/_chunks/NoContentTypePage-BzsQ3hLZ.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-CIPmYQMm.mjs → NoContentTypePage-CYiGpsbj.mjs} +7 -7
- package/dist/_chunks/NoContentTypePage-CYiGpsbj.mjs.map +1 -0
- package/dist/_chunks/{NoPermissionsPage-DhJ7LYrr.mjs → NoPermissionsPage-B5baIHal.mjs} +5 -6
- package/dist/_chunks/NoPermissionsPage-B5baIHal.mjs.map +1 -0
- package/dist/_chunks/{NoPermissionsPage-C-j6TEUF.js → NoPermissionsPage-IGkId4C5.js} +4 -5
- package/dist/_chunks/NoPermissionsPage-IGkId4C5.js.map +1 -0
- package/dist/_chunks/{Relations-CY7AtkDA.mjs → Relations-CIYDdKU-.mjs} +67 -57
- package/dist/_chunks/Relations-CIYDdKU-.mjs.map +1 -0
- package/dist/_chunks/{Relations-Czs-uZ-s.js → Relations-Dhuurpx2.js} +71 -62
- package/dist/_chunks/Relations-Dhuurpx2.js.map +1 -0
- package/dist/_chunks/{en-MBPul9Su.mjs → en-BrCTWlZv.mjs} +11 -4
- package/dist/_chunks/{en-MBPul9Su.mjs.map → en-BrCTWlZv.mjs.map} +1 -1
- package/dist/_chunks/{en-C-V1_90f.js → en-uOUIxfcQ.js} +11 -4
- package/dist/_chunks/{en-C-V1_90f.js.map → en-uOUIxfcQ.js.map} +1 -1
- package/dist/_chunks/{index-DNVx8ssZ.mjs → index-C9TJPyni.mjs} +1696 -912
- package/dist/_chunks/index-C9TJPyni.mjs.map +1 -0
- package/dist/_chunks/{index-X_2tafck.js → index-CdT0kHZ8.js} +1626 -843
- package/dist/_chunks/index-CdT0kHZ8.js.map +1 -0
- package/dist/_chunks/{layout-Dnh0PNp9.mjs → layout-BNqvLR_b.mjs} +45 -28
- package/dist/_chunks/layout-BNqvLR_b.mjs.map +1 -0
- package/dist/_chunks/{layout-dBc7wN7L.js → layout-C6dxWYT7.js} +45 -30
- package/dist/_chunks/layout-C6dxWYT7.js.map +1 -0
- package/dist/_chunks/{relations-Dx7tMKJN.mjs → relations-CkKqKw65.mjs} +2 -2
- package/dist/_chunks/{relations-Dx7tMKJN.mjs.map → relations-CkKqKw65.mjs.map} +1 -1
- package/dist/_chunks/{relations-4pHtBrHJ.js → relations-DtFaDnP1.js} +2 -2
- package/dist/_chunks/{relations-4pHtBrHJ.js.map → relations-DtFaDnP1.js.map} +1 -1
- package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs.map +1 -1
- package/dist/_chunks/useDragAndDrop-J0TUUbR6.js.map +1 -1
- package/dist/_chunks/usePrev-B9w_-eYc.js +15 -0
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +1 -0
- package/dist/_chunks/usePrev-DH6iah0A.mjs +16 -0
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +5 -4
- 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 +1 -0
- 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 +5 -8
- 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/components/DocumentActions.d.ts +11 -4
- 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 +48 -53
- 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/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 +29 -17
- 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 +1 -6
- package/dist/server/index.js +602 -426
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +610 -434
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.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 +8 -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 +2 -4
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/index.d.ts +6 -2
- package/dist/server/src/history/services/index.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts +9 -0
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -0
- package/dist/server/src/history/services/utils.d.ts +41 -9
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/history/utils.d.ts +6 -2
- package/dist/server/src/history/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +18 -39
- package/dist/server/src/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 +8 -29
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +18 -39
- package/dist/server/src/services/index.d.ts.map +1 -1
- 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/shared/contracts/collection-types.d.ts +14 -6
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/dist/shared/contracts/relations.d.ts +2 -2
- package/dist/shared/contracts/relations.d.ts.map +1 -1
- package/package.json +13 -14
- 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-Bm8lgcm6.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-CzOT5Kpj.js.map +0 -1
- package/dist/_chunks/Field-Caef4JjM.js.map +0 -1
- package/dist/_chunks/Field-Dlh0uGnL.mjs.map +0 -1
- package/dist/_chunks/Form-BzuAjtRq.js.map +0 -1
- package/dist/_chunks/Form-EnaQL_6L.mjs.map +0 -1
- package/dist/_chunks/History-C17LiyRg.js.map +0 -1
- package/dist/_chunks/History-D6sbCJvo.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-Ce4qs7qE.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-Dks5SX6f.js.map +0 -1
- package/dist/_chunks/ListViewPage-Be7S5aKL.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-BwrZrPsh.js.map +0 -1
- package/dist/_chunks/NoContentTypePage-CIPmYQMm.mjs.map +0 -1
- package/dist/_chunks/NoContentTypePage-Cu5r1-JT.js.map +0 -1
- package/dist/_chunks/NoPermissionsPage-C-j6TEUF.js.map +0 -1
- package/dist/_chunks/NoPermissionsPage-DhJ7LYrr.mjs.map +0 -1
- package/dist/_chunks/Relations-CY7AtkDA.mjs.map +0 -1
- package/dist/_chunks/Relations-Czs-uZ-s.js.map +0 -1
- package/dist/_chunks/index-DNVx8ssZ.mjs.map +0 -1
- package/dist/_chunks/index-X_2tafck.js.map +0 -1
- package/dist/_chunks/layout-Dnh0PNp9.mjs.map +0 -1
- package/dist/_chunks/layout-dBc7wN7L.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
@@ -1,23 +1,23 @@
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
2
2
|
import * as React from "react";
|
3
|
-
import { useState, useEffect, useCallback } from "react";
|
3
|
+
import { useState, useEffect, useCallback, memo } from "react";
|
4
4
|
import { useStrapiApp, createContext, useField, useNotification, useForm, useAPIErrorHandler, useQueryParams, useFocusInputField, InputRenderer as InputRenderer$1 } from "@strapi/admin/strapi-admin";
|
5
|
-
import { Typography, Flex,
|
5
|
+
import { Box, SingleSelect, SingleSelectOption, Typography, Flex, BaseLink, Button, Popover, Field, Tooltip, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton, TextInput, IconButtonGroup, Menu, MenuItem } from "@strapi/design-system";
|
6
6
|
import pipe$1 from "lodash/fp/pipe";
|
7
7
|
import { useIntl } from "react-intl";
|
8
|
-
import {
|
8
|
+
import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, d as buildValidParams, f as useDocumentRBAC, n as useDocLayout } from "./index-C9TJPyni.mjs";
|
9
9
|
import { generateNKeysBetween } from "fractional-indexing";
|
10
|
-
import { u as useComponent, C as ComponentProvider,
|
10
|
+
import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-CIYDdKU-.mjs";
|
11
11
|
import { Code, HeadingOne, HeadingTwo, HeadingThree, HeadingFour, HeadingFive, HeadingSix, Image as Image$1, NumberList, BulletList, Paragraph, Quotes, Link as Link$1, Drag, Collapse, Bold, Italic, Underline, StrikeThrough, Expand, PlusCircle, Plus, Trash, EyeStriked, CheckCircle, WarningCircle, Loader, ArrowClockwise, More } from "@strapi/icons";
|
12
|
-
import styled,
|
13
|
-
import { C as ComponentIcon } from "./ComponentIcon-
|
12
|
+
import { styled, css, keyframes } from "styled-components";
|
13
|
+
import { C as ComponentIcon, a as COMPONENT_ICONS } from "./ComponentIcon-u4bIXTFY.mjs";
|
14
14
|
import { getEmptyImage } from "react-dnd-html5-backend";
|
15
15
|
import { a as DIRECTIONS, u as useDragAndDrop, I as ItemTypes } from "./useDragAndDrop-DdHgKsqq.mjs";
|
16
16
|
import { g as getIn } from "./objects-mKMAmfec.mjs";
|
17
17
|
import { Editor as Editor$1, Transforms, Node, Element, Range, Path, Point, createEditor } from "slate";
|
18
18
|
import { withHistory } from "slate-history";
|
19
19
|
import { useFocused, useSelected, ReactEditor, Editable, useSlate, Slate, withReact } from "slate-react";
|
20
|
-
import { p as prefixFileUrlWithBackendUrl } from "./
|
20
|
+
import { p as prefixFileUrlWithBackendUrl, u as usePrev } from "./usePrev-DH6iah0A.mjs";
|
21
21
|
import * as Toolbar from "@radix-ui/react-toolbar";
|
22
22
|
import { useLocation } from "react-router-dom";
|
23
23
|
import CodeMirror from "codemirror5";
|
@@ -160,6 +160,220 @@ const useLazyComponents = (componentUids = []) => {
|
|
160
160
|
}, []);
|
161
161
|
return { isLazyLoading: loading, lazyComponentStore, cleanup };
|
162
162
|
};
|
163
|
+
const codeLanguages = [
|
164
|
+
{
|
165
|
+
value: "asm",
|
166
|
+
label: "Assembly"
|
167
|
+
},
|
168
|
+
{
|
169
|
+
value: "bash",
|
170
|
+
label: "Bash"
|
171
|
+
},
|
172
|
+
{
|
173
|
+
value: "c",
|
174
|
+
label: "C"
|
175
|
+
},
|
176
|
+
{
|
177
|
+
value: "clojure",
|
178
|
+
label: "Clojure"
|
179
|
+
},
|
180
|
+
{
|
181
|
+
value: "cobol",
|
182
|
+
label: "COBOL"
|
183
|
+
},
|
184
|
+
{
|
185
|
+
value: "cpp",
|
186
|
+
label: "C++"
|
187
|
+
},
|
188
|
+
{
|
189
|
+
value: "csharp",
|
190
|
+
label: "C#"
|
191
|
+
},
|
192
|
+
{
|
193
|
+
value: "css",
|
194
|
+
label: "CSS"
|
195
|
+
},
|
196
|
+
{
|
197
|
+
value: "dart",
|
198
|
+
label: "Dart"
|
199
|
+
},
|
200
|
+
{
|
201
|
+
value: "dockerfile",
|
202
|
+
label: "Dockerfile"
|
203
|
+
},
|
204
|
+
{
|
205
|
+
value: "elixir",
|
206
|
+
label: "Elixir"
|
207
|
+
},
|
208
|
+
{
|
209
|
+
value: "erlang",
|
210
|
+
label: "Erlang"
|
211
|
+
},
|
212
|
+
{
|
213
|
+
value: "fortran",
|
214
|
+
label: "Fortran"
|
215
|
+
},
|
216
|
+
{
|
217
|
+
value: "fsharp",
|
218
|
+
label: "F#"
|
219
|
+
},
|
220
|
+
{
|
221
|
+
value: "go",
|
222
|
+
label: "Go"
|
223
|
+
},
|
224
|
+
{
|
225
|
+
value: "graphql",
|
226
|
+
label: "GraphQL"
|
227
|
+
},
|
228
|
+
{
|
229
|
+
value: "groovy",
|
230
|
+
label: "Groovy"
|
231
|
+
},
|
232
|
+
{
|
233
|
+
value: "haskell",
|
234
|
+
label: "Haskell"
|
235
|
+
},
|
236
|
+
{
|
237
|
+
value: "haxe",
|
238
|
+
label: "Haxe"
|
239
|
+
},
|
240
|
+
{
|
241
|
+
value: "html",
|
242
|
+
label: "HTML"
|
243
|
+
},
|
244
|
+
{
|
245
|
+
value: "ini",
|
246
|
+
label: "INI"
|
247
|
+
},
|
248
|
+
{
|
249
|
+
value: "java",
|
250
|
+
label: "Java"
|
251
|
+
},
|
252
|
+
{
|
253
|
+
value: "javascript",
|
254
|
+
label: "JavaScript"
|
255
|
+
},
|
256
|
+
{
|
257
|
+
value: "jsx",
|
258
|
+
label: "JavaScript (React)"
|
259
|
+
},
|
260
|
+
{
|
261
|
+
value: "json",
|
262
|
+
label: "JSON"
|
263
|
+
},
|
264
|
+
{
|
265
|
+
value: "julia",
|
266
|
+
label: "Julia"
|
267
|
+
},
|
268
|
+
{
|
269
|
+
value: "kotlin",
|
270
|
+
label: "Kotlin"
|
271
|
+
},
|
272
|
+
{
|
273
|
+
value: "latex",
|
274
|
+
label: "LaTeX"
|
275
|
+
},
|
276
|
+
{
|
277
|
+
value: "lua",
|
278
|
+
label: "Lua"
|
279
|
+
},
|
280
|
+
{
|
281
|
+
value: "markdown",
|
282
|
+
label: "Markdown"
|
283
|
+
},
|
284
|
+
{
|
285
|
+
value: "matlab",
|
286
|
+
label: "MATLAB"
|
287
|
+
},
|
288
|
+
{
|
289
|
+
value: "makefile",
|
290
|
+
label: "Makefile"
|
291
|
+
},
|
292
|
+
{
|
293
|
+
value: "objectivec",
|
294
|
+
label: "Objective-C"
|
295
|
+
},
|
296
|
+
{
|
297
|
+
value: "perl",
|
298
|
+
label: "Perl"
|
299
|
+
},
|
300
|
+
{
|
301
|
+
value: "php",
|
302
|
+
label: "PHP"
|
303
|
+
},
|
304
|
+
{
|
305
|
+
value: "plaintext",
|
306
|
+
label: "Plain text"
|
307
|
+
},
|
308
|
+
{
|
309
|
+
value: "powershell",
|
310
|
+
label: "PowerShell"
|
311
|
+
},
|
312
|
+
{
|
313
|
+
value: "python",
|
314
|
+
label: "Python"
|
315
|
+
},
|
316
|
+
{
|
317
|
+
value: "r",
|
318
|
+
label: "R"
|
319
|
+
},
|
320
|
+
{
|
321
|
+
value: "ruby",
|
322
|
+
label: "Ruby"
|
323
|
+
},
|
324
|
+
{
|
325
|
+
value: "rust",
|
326
|
+
label: "Rust"
|
327
|
+
},
|
328
|
+
{
|
329
|
+
value: "sas",
|
330
|
+
label: "SAS"
|
331
|
+
},
|
332
|
+
{
|
333
|
+
value: "scala",
|
334
|
+
label: "Scala"
|
335
|
+
},
|
336
|
+
{
|
337
|
+
value: "scheme",
|
338
|
+
label: "Scheme"
|
339
|
+
},
|
340
|
+
{
|
341
|
+
value: "shell",
|
342
|
+
label: "Shell"
|
343
|
+
},
|
344
|
+
{
|
345
|
+
value: "sql",
|
346
|
+
label: "SQL"
|
347
|
+
},
|
348
|
+
{
|
349
|
+
value: "stata",
|
350
|
+
label: "Stata"
|
351
|
+
},
|
352
|
+
{
|
353
|
+
value: "swift",
|
354
|
+
label: "Swift"
|
355
|
+
},
|
356
|
+
{
|
357
|
+
value: "typescript",
|
358
|
+
label: "TypeScript"
|
359
|
+
},
|
360
|
+
{
|
361
|
+
value: "tsx",
|
362
|
+
label: "TypeScript (React)"
|
363
|
+
},
|
364
|
+
{
|
365
|
+
value: "vbnet",
|
366
|
+
label: "VB.NET"
|
367
|
+
},
|
368
|
+
{
|
369
|
+
value: "xml",
|
370
|
+
label: "XML"
|
371
|
+
},
|
372
|
+
{
|
373
|
+
value: "yaml",
|
374
|
+
label: "YAML"
|
375
|
+
}
|
376
|
+
];
|
163
377
|
const baseHandleConvert = (editor, attributesToSet) => {
|
164
378
|
const [_, lastNodePath] = Editor$1.last(editor, []);
|
165
379
|
Transforms.unwrapNodes(editor, {
|
@@ -223,13 +437,14 @@ const pressEnterTwiceToExit = (editor) => {
|
|
223
437
|
});
|
224
438
|
}
|
225
439
|
};
|
226
|
-
const CodeBlock = styled.pre
|
440
|
+
const CodeBlock = styled.pre`
|
227
441
|
border-radius: ${({ theme }) => theme.borderRadius};
|
228
442
|
background-color: ${({ theme }) => theme.colors.neutral100};
|
229
443
|
max-width: 100%;
|
230
444
|
overflow: auto;
|
231
445
|
padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
|
232
446
|
flex-shrink: 1;
|
447
|
+
|
233
448
|
& > code {
|
234
449
|
font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
|
235
450
|
monospace;
|
@@ -238,9 +453,61 @@ const CodeBlock = styled.pre.attrs({ role: "code" })`
|
|
238
453
|
max-width: 100%;
|
239
454
|
}
|
240
455
|
`;
|
456
|
+
const CodeEditor = (props) => {
|
457
|
+
const { editor } = useBlocksEditorContext("ImageDialog");
|
458
|
+
const editorIsFocused = useFocused();
|
459
|
+
const imageIsSelected = useSelected();
|
460
|
+
const { formatMessage } = useIntl();
|
461
|
+
const [isSelectOpen, setIsSelectOpen] = React.useState(false);
|
462
|
+
const shouldDisplayLanguageSelect = editorIsFocused && imageIsSelected || isSelectOpen;
|
463
|
+
return /* @__PURE__ */ jsxs(Box, { position: "relative", width: "100%", children: [
|
464
|
+
/* @__PURE__ */ jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsx("code", { children: props.children }) }),
|
465
|
+
shouldDisplayLanguageSelect && /* @__PURE__ */ jsx(
|
466
|
+
Box,
|
467
|
+
{
|
468
|
+
position: "absolute",
|
469
|
+
background: "neutral0",
|
470
|
+
borderColor: "neutral150",
|
471
|
+
borderStyle: "solid",
|
472
|
+
borderWidth: "0.5px",
|
473
|
+
shadow: "tableShadow",
|
474
|
+
top: "100%",
|
475
|
+
marginTop: 1,
|
476
|
+
right: 0,
|
477
|
+
padding: 1,
|
478
|
+
hasRadius: true,
|
479
|
+
children: /* @__PURE__ */ jsx(
|
480
|
+
SingleSelect,
|
481
|
+
{
|
482
|
+
onChange: (open) => {
|
483
|
+
Transforms.setNodes(
|
484
|
+
editor,
|
485
|
+
{ language: open.toString() },
|
486
|
+
{ match: (node) => !Editor$1.isEditor(node) && node.type === "code" }
|
487
|
+
);
|
488
|
+
},
|
489
|
+
value: props.element.type === "code" && props.element.language || "plaintext",
|
490
|
+
onOpenChange: (open) => {
|
491
|
+
setIsSelectOpen(open);
|
492
|
+
if (!open) {
|
493
|
+
ReactEditor.focus(editor);
|
494
|
+
}
|
495
|
+
},
|
496
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
497
|
+
"aria-label": formatMessage({
|
498
|
+
id: "components.Blocks.blocks.code.languageLabel",
|
499
|
+
defaultMessage: "Select a language"
|
500
|
+
}),
|
501
|
+
children: codeLanguages.map(({ value, label }) => /* @__PURE__ */ jsx(SingleSelectOption, { value, children: label }, value))
|
502
|
+
}
|
503
|
+
)
|
504
|
+
}
|
505
|
+
)
|
506
|
+
] });
|
507
|
+
};
|
241
508
|
const codeBlocks = {
|
242
509
|
code: {
|
243
|
-
renderElement: (props) => /* @__PURE__ */ jsx(
|
510
|
+
renderElement: (props) => /* @__PURE__ */ jsx(CodeEditor, { ...props }),
|
244
511
|
icon: Code,
|
245
512
|
label: {
|
246
513
|
id: "components.Blocks.blocks.code",
|
@@ -249,7 +516,7 @@ const codeBlocks = {
|
|
249
516
|
matchNode: (node) => node.type === "code",
|
250
517
|
isInBlocksSelector: true,
|
251
518
|
handleConvert(editor) {
|
252
|
-
baseHandleConvert(editor, { type: "code" });
|
519
|
+
baseHandleConvert(editor, { type: "code", language: "plaintext" });
|
253
520
|
},
|
254
521
|
handleEnterKey(editor) {
|
255
522
|
pressEnterTwiceToExit(editor);
|
@@ -258,27 +525,27 @@ const codeBlocks = {
|
|
258
525
|
dragHandleTopMargin: "10px"
|
259
526
|
}
|
260
527
|
};
|
261
|
-
const H1 = styled(Typography).attrs({
|
528
|
+
const H1 = styled(Typography).attrs({ tag: "h1" })`
|
262
529
|
font-size: 4.2rem;
|
263
530
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
264
531
|
`;
|
265
|
-
const H2 = styled(Typography).attrs({
|
532
|
+
const H2 = styled(Typography).attrs({ tag: "h2" })`
|
266
533
|
font-size: 3.5rem;
|
267
534
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
268
535
|
`;
|
269
|
-
const H3 = styled(Typography).attrs({
|
536
|
+
const H3 = styled(Typography).attrs({ tag: "h3" })`
|
270
537
|
font-size: 2.9rem;
|
271
538
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
272
539
|
`;
|
273
|
-
const H4 = styled(Typography).attrs({
|
540
|
+
const H4 = styled(Typography).attrs({ tag: "h4" })`
|
274
541
|
font-size: 2.4rem;
|
275
542
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
276
543
|
`;
|
277
|
-
const H5 = styled(Typography).attrs({
|
544
|
+
const H5 = styled(Typography).attrs({ tag: "h5" })`
|
278
545
|
font-size: 2rem;
|
279
546
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
280
547
|
`;
|
281
|
-
const H6 = styled(Typography).attrs({
|
548
|
+
const H6 = styled(Typography).attrs({ tag: "h6" })`
|
282
549
|
font-size: 1.6rem;
|
283
550
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
284
551
|
`;
|
@@ -367,7 +634,7 @@ const headingBlocks = {
|
|
367
634
|
const ImageWrapper = styled(Flex)`
|
368
635
|
transition-property: box-shadow;
|
369
636
|
transition-duration: 0.2s;
|
370
|
-
${(props) => props
|
637
|
+
${(props) => props.$isFocused && css`
|
371
638
|
box-shadow: ${props.theme.colors.primary600} 0px 0px 0px 3px;
|
372
639
|
`}
|
373
640
|
|
@@ -419,7 +686,7 @@ const Image = ({ attributes, children, element }) => {
|
|
419
686
|
background: "neutral100",
|
420
687
|
contentEditable: false,
|
421
688
|
justifyContent: "center",
|
422
|
-
isFocused: editorIsFocused && imageIsSelected,
|
689
|
+
$isFocused: editorIsFocused && imageIsSelected,
|
423
690
|
hasRadius: true,
|
424
691
|
children: /* @__PURE__ */ jsx("img", { src: url, alt: alternativeText, width, height })
|
425
692
|
}
|
@@ -579,7 +846,7 @@ const StyledBaseLink = styled(BaseLink)`
|
|
579
846
|
text-decoration: none;
|
580
847
|
`;
|
581
848
|
const RemoveButton = styled(Button)`
|
582
|
-
visibility: ${(props) => props
|
849
|
+
visibility: ${(props) => props.$visible ? "visible" : "hidden"};
|
583
850
|
`;
|
584
851
|
const LinkContent = React.forwardRef(
|
585
852
|
({ link, children, attributes }, forwardedRef) => {
|
@@ -589,18 +856,12 @@ const LinkContent = React.forwardRef(
|
|
589
856
|
const [popoverOpen, setPopoverOpen] = React.useState(
|
590
857
|
editor.lastInsertedLinkPath ? Path.equals(path, editor.lastInsertedLinkPath) : false
|
591
858
|
);
|
592
|
-
const linkRef = React.useRef(null);
|
593
859
|
const elementText = link.children.map((child) => child.text).join("");
|
594
860
|
const [linkText, setLinkText] = React.useState(elementText);
|
595
861
|
const [linkUrl, setLinkUrl] = React.useState(link.url);
|
596
862
|
const linkInputRef = React.useRef(null);
|
597
|
-
const
|
863
|
+
const isLastInsertedLink = editor.lastInsertedLinkPath ? !Path.equals(path, editor.lastInsertedLinkPath) : true;
|
598
864
|
const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);
|
599
|
-
const handleOpenEditPopover = (e) => {
|
600
|
-
e.preventDefault();
|
601
|
-
setPopoverOpen(true);
|
602
|
-
setShowRemoveButton(true);
|
603
|
-
};
|
604
865
|
const onLinkChange = (e) => {
|
605
866
|
setIsSaveDisabled(false);
|
606
867
|
setLinkUrl(e.target.value);
|
@@ -621,40 +882,40 @@ const LinkContent = React.forwardRef(
|
|
621
882
|
editLink(editor, { url: linkUrl, text: linkText });
|
622
883
|
setPopoverOpen(false);
|
623
884
|
editor.lastInsertedLinkPath = null;
|
885
|
+
ReactEditor.focus(editor);
|
624
886
|
};
|
625
|
-
const
|
626
|
-
setPopoverOpen(false);
|
887
|
+
const handleClose = () => {
|
627
888
|
if (link.url === "") {
|
628
889
|
removeLink(editor);
|
629
890
|
}
|
891
|
+
setPopoverOpen(false);
|
630
892
|
ReactEditor.focus(editor);
|
631
893
|
};
|
632
|
-
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
633
|
-
const composedRefs = useComposedRefs(linkRef, forwardedRef);
|
634
894
|
React.useEffect(() => {
|
635
895
|
if (popoverOpen)
|
636
896
|
linkInputRef.current?.focus();
|
637
897
|
}, [popoverOpen]);
|
638
|
-
|
639
|
-
|
898
|
+
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
899
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { open: popoverOpen, children: [
|
900
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
640
901
|
StyledBaseLink,
|
641
902
|
{
|
642
903
|
...attributes,
|
643
|
-
ref:
|
904
|
+
ref: forwardedRef,
|
644
905
|
href: link.url,
|
645
|
-
onClick:
|
906
|
+
onClick: () => setPopoverOpen(true),
|
646
907
|
color: "primary600",
|
647
908
|
children
|
648
909
|
}
|
649
|
-
),
|
650
|
-
|
651
|
-
/* @__PURE__ */ jsx(Field, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
652
|
-
/* @__PURE__ */ jsx(
|
910
|
+
) }),
|
911
|
+
/* @__PURE__ */ jsx(Popover.Content, { onPointerDownOutside: handleClose, children: /* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 4, children: [
|
912
|
+
/* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
913
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
653
914
|
id: "components.Blocks.popover.text",
|
654
915
|
defaultMessage: "Text"
|
655
916
|
}) }),
|
656
917
|
/* @__PURE__ */ jsx(
|
657
|
-
|
918
|
+
Field.Input,
|
658
919
|
{
|
659
920
|
name: "text",
|
660
921
|
placeholder: formatMessage({
|
@@ -668,13 +929,13 @@ const LinkContent = React.forwardRef(
|
|
668
929
|
}
|
669
930
|
)
|
670
931
|
] }) }),
|
671
|
-
/* @__PURE__ */ jsx(Field, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
672
|
-
/* @__PURE__ */ jsx(
|
932
|
+
/* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
933
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
673
934
|
id: "components.Blocks.popover.link",
|
674
935
|
defaultMessage: "Link"
|
675
936
|
}) }),
|
676
937
|
/* @__PURE__ */ jsx(
|
677
|
-
|
938
|
+
Field.Input,
|
678
939
|
{
|
679
940
|
ref: linkInputRef,
|
680
941
|
name: "url",
|
@@ -693,7 +954,7 @@ const LinkContent = React.forwardRef(
|
|
693
954
|
{
|
694
955
|
variant: "danger-light",
|
695
956
|
onClick: () => removeLink(editor),
|
696
|
-
visible:
|
957
|
+
$visible: isLastInsertedLink,
|
697
958
|
children: formatMessage({
|
698
959
|
id: "components.Blocks.popover.remove",
|
699
960
|
defaultMessage: "Remove"
|
@@ -701,11 +962,11 @@ const LinkContent = React.forwardRef(
|
|
701
962
|
}
|
702
963
|
),
|
703
964
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
704
|
-
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick:
|
965
|
+
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
|
705
966
|
id: "components.Blocks.popover.cancel",
|
706
967
|
defaultMessage: "Cancel"
|
707
968
|
}) }),
|
708
|
-
/* @__PURE__ */ jsx(Button, {
|
969
|
+
/* @__PURE__ */ jsx(Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
|
709
970
|
id: "components.Blocks.popover.save",
|
710
971
|
defaultMessage: "Save"
|
711
972
|
}) })
|
@@ -748,11 +1009,11 @@ const listStyle = css`
|
|
748
1009
|
}
|
749
1010
|
`;
|
750
1011
|
const Orderedlist = styled.ol`
|
751
|
-
list-style-type: ${(props) => props
|
1012
|
+
list-style-type: ${(props) => props.$listStyleType};
|
752
1013
|
${listStyle}
|
753
1014
|
`;
|
754
1015
|
const Unorderedlist = styled.ul`
|
755
|
-
list-style-type: ${(props) => props
|
1016
|
+
list-style-type: ${(props) => props.$listStyleType};
|
756
1017
|
${listStyle}
|
757
1018
|
`;
|
758
1019
|
const orderedStyles = ["decimal", "lower-alpha", "upper-roman"];
|
@@ -765,9 +1026,9 @@ const List = ({ attributes, children, element }) => {
|
|
765
1026
|
const nextIndex = (element.indentLevel || 0) % listStyles.length;
|
766
1027
|
const listStyleType = listStyles[nextIndex];
|
767
1028
|
if (element.format === "ordered") {
|
768
|
-
return /* @__PURE__ */ jsx(Orderedlist, { listStyleType, ...attributes, children });
|
1029
|
+
return /* @__PURE__ */ jsx(Orderedlist, { $listStyleType: listStyleType, ...attributes, children });
|
769
1030
|
}
|
770
|
-
return /* @__PURE__ */ jsx(Unorderedlist, { listStyleType, ...attributes, children });
|
1031
|
+
return /* @__PURE__ */ jsx(Unorderedlist, { $listStyleType: listStyleType, ...attributes, children });
|
771
1032
|
};
|
772
1033
|
const replaceListWithEmptyBlock = (editor, currentListPath) => {
|
773
1034
|
Transforms.removeNodes(editor, { at: currentListPath });
|
@@ -964,7 +1225,7 @@ const listBlocks = {
|
|
964
1225
|
snippets: ["-", "*", "+"]
|
965
1226
|
},
|
966
1227
|
"list-item": {
|
967
|
-
renderElement: (props) => /* @__PURE__ */ jsx(Typography, {
|
1228
|
+
renderElement: (props) => /* @__PURE__ */ jsx(Typography, { tag: "li", ...props.attributes, children: props.children }),
|
968
1229
|
// No handleConvert, list items are created when converting to the parent list
|
969
1230
|
matchNode: (node) => node.type === "list-item",
|
970
1231
|
isInBlocksSelector: false,
|
@@ -973,7 +1234,7 @@ const listBlocks = {
|
|
973
1234
|
};
|
974
1235
|
const paragraphBlocks = {
|
975
1236
|
paragraph: {
|
976
|
-
renderElement: (props) => /* @__PURE__ */ jsx(Typography, {
|
1237
|
+
renderElement: (props) => /* @__PURE__ */ jsx(Typography, { tag: "p", variant: "omega", ...props.attributes, children: props.children }),
|
977
1238
|
icon: Paragraph,
|
978
1239
|
label: {
|
979
1240
|
id: "components.Blocks.blocks.text",
|
@@ -1139,7 +1400,7 @@ const ToolbarButton = ({
|
|
1139
1400
|
children: /* @__PURE__ */ jsx(
|
1140
1401
|
FlexButton,
|
1141
1402
|
{
|
1142
|
-
|
1403
|
+
tag: "button",
|
1143
1404
|
background: isActive ? "primary100" : "",
|
1144
1405
|
alignItems: "center",
|
1145
1406
|
justifyContent: "center",
|
@@ -1291,6 +1552,26 @@ const ListButton = ({ block, format }) => {
|
|
1291
1552
|
}
|
1292
1553
|
return false;
|
1293
1554
|
};
|
1555
|
+
const isListDisabled = () => {
|
1556
|
+
if (disabled) {
|
1557
|
+
return true;
|
1558
|
+
}
|
1559
|
+
if (!editor.selection) {
|
1560
|
+
return false;
|
1561
|
+
}
|
1562
|
+
const anchorNodeEntry = Editor$1.above(editor, {
|
1563
|
+
at: editor.selection.anchor,
|
1564
|
+
match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
|
1565
|
+
});
|
1566
|
+
const focusNodeEntry = Editor$1.above(editor, {
|
1567
|
+
at: editor.selection.focus,
|
1568
|
+
match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
|
1569
|
+
});
|
1570
|
+
if (!anchorNodeEntry || !focusNodeEntry) {
|
1571
|
+
return false;
|
1572
|
+
}
|
1573
|
+
return anchorNodeEntry[0] !== focusNodeEntry[0];
|
1574
|
+
};
|
1294
1575
|
const toggleList = (format2) => {
|
1295
1576
|
let currentListEntry;
|
1296
1577
|
if (editor.selection) {
|
@@ -1324,7 +1605,7 @@ const ListButton = ({ block, format }) => {
|
|
1324
1605
|
name: format,
|
1325
1606
|
label: block.label,
|
1326
1607
|
isActive: isListActive(),
|
1327
|
-
disabled,
|
1608
|
+
disabled: isListDisabled(),
|
1328
1609
|
handleClick: () => toggleList(format)
|
1329
1610
|
}
|
1330
1611
|
);
|
@@ -1460,7 +1741,7 @@ const DragItem = styled(Flex)`
|
|
1460
1741
|
|
1461
1742
|
// Set the visibility of drag button
|
1462
1743
|
[role='button'] {
|
1463
|
-
visibility: ${(props) => props
|
1744
|
+
visibility: ${(props) => props.$dragVisibility};
|
1464
1745
|
opacity: inherit;
|
1465
1746
|
}
|
1466
1747
|
&[aria-disabled='true'] {
|
@@ -1477,7 +1758,7 @@ const DragIconButton = styled(IconButton)`
|
|
1477
1758
|
visibility: hidden;
|
1478
1759
|
cursor: grab;
|
1479
1760
|
opacity: inherit;
|
1480
|
-
margin-top: ${(props) => props
|
1761
|
+
margin-top: ${(props) => props.$dragHandleTopMargin ?? 0};
|
1481
1762
|
|
1482
1763
|
&:hover {
|
1483
1764
|
background: ${({ theme }) => theme.colors.neutral200};
|
@@ -1491,7 +1772,7 @@ const DragIconButton = styled(IconButton)`
|
|
1491
1772
|
}
|
1492
1773
|
svg {
|
1493
1774
|
height: auto;
|
1494
|
-
width: ${({ theme }) => theme.spaces[3]};
|
1775
|
+
min-width: ${({ theme }) => theme.spaces[3]};
|
1495
1776
|
|
1496
1777
|
path {
|
1497
1778
|
fill: ${({ theme }) => theme.colors.neutral700};
|
@@ -1552,7 +1833,7 @@ const DragAndDropElement = ({
|
|
1552
1833
|
React.useEffect(() => {
|
1553
1834
|
setDragVisibility("hidden");
|
1554
1835
|
}, [editor.selection]);
|
1555
|
-
return /* @__PURE__ */ jsxs(Wrapper$1, { ref:
|
1836
|
+
return /* @__PURE__ */ jsxs(Wrapper$1, { ref: composedBoxRefs, isOverDropTarget, children: [
|
1556
1837
|
isOverDropTarget && /* @__PURE__ */ jsx(
|
1557
1838
|
DropPlaceholder,
|
1558
1839
|
{
|
@@ -1590,15 +1871,16 @@ const DragAndDropElement = ({
|
|
1590
1871
|
onSelect: () => setDragVisibility("visible"),
|
1591
1872
|
onMouseLeave: () => setDragVisibility("hidden"),
|
1592
1873
|
"aria-disabled": disabled,
|
1593
|
-
dragVisibility,
|
1874
|
+
$dragVisibility: dragVisibility,
|
1594
1875
|
children: [
|
1595
1876
|
/* @__PURE__ */ jsx(
|
1596
1877
|
DragIconButton,
|
1597
1878
|
{
|
1598
|
-
|
1879
|
+
tag: "div",
|
1599
1880
|
role: "button",
|
1600
1881
|
tabIndex: 0,
|
1601
|
-
|
1882
|
+
withTooltip: false,
|
1883
|
+
label: formatMessage({
|
1602
1884
|
id: getTranslation("components.DragHandle-label"),
|
1603
1885
|
defaultMessage: "Drag"
|
1604
1886
|
}),
|
@@ -1606,8 +1888,8 @@ const DragAndDropElement = ({
|
|
1606
1888
|
"aria-disabled": disabled,
|
1607
1889
|
disabled,
|
1608
1890
|
draggable: true,
|
1609
|
-
dragHandleTopMargin,
|
1610
|
-
children: /* @__PURE__ */ jsx(Drag, { color: "
|
1891
|
+
$dragHandleTopMargin: dragHandleTopMargin,
|
1892
|
+
children: /* @__PURE__ */ jsx(Drag, { color: "primary500" })
|
1611
1893
|
}
|
1612
1894
|
),
|
1613
1895
|
children
|
@@ -1618,17 +1900,18 @@ const DragAndDropElement = ({
|
|
1618
1900
|
};
|
1619
1901
|
const CloneDragItem = ({ children, dragHandleTopMargin }) => {
|
1620
1902
|
const { formatMessage } = useIntl();
|
1621
|
-
return /* @__PURE__ */ jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", dragVisibility: "visible", children: [
|
1903
|
+
return /* @__PURE__ */ jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", $dragVisibility: "visible", children: [
|
1622
1904
|
/* @__PURE__ */ jsx(
|
1623
1905
|
DragIconButton,
|
1624
1906
|
{
|
1625
|
-
|
1907
|
+
tag: "div",
|
1626
1908
|
role: "button",
|
1627
|
-
|
1909
|
+
withTooltip: false,
|
1910
|
+
label: formatMessage({
|
1628
1911
|
id: getTranslation("components.DragHandle-label"),
|
1629
1912
|
defaultMessage: "Drag"
|
1630
1913
|
}),
|
1631
|
-
dragHandleTopMargin,
|
1914
|
+
$dragHandleTopMargin: dragHandleTopMargin,
|
1632
1915
|
children: /* @__PURE__ */ jsx(Drag, { color: "neutral600" })
|
1633
1916
|
}
|
1634
1917
|
),
|
@@ -1930,7 +2213,7 @@ const EditorLayout$1 = ({
|
|
1930
2213
|
/* @__PURE__ */ jsx(
|
1931
2214
|
CollapseIconButton,
|
1932
2215
|
{
|
1933
|
-
|
2216
|
+
label: formatMessage({
|
1934
2217
|
id: getTranslation("components.Blocks.collapse"),
|
1935
2218
|
defaultMessage: "Collapse"
|
1936
2219
|
}),
|
@@ -1950,8 +2233,8 @@ const EditorLayout$1 = ({
|
|
1950
2233
|
direction: "column",
|
1951
2234
|
alignItems: "flex-start",
|
1952
2235
|
height: "512px",
|
1953
|
-
disabled,
|
1954
|
-
hasError: Boolean(error),
|
2236
|
+
$disabled: disabled,
|
2237
|
+
$hasError: Boolean(error),
|
1955
2238
|
style: { overflow: "hidden" },
|
1956
2239
|
"aria-describedby": ariaDescriptionId,
|
1957
2240
|
position: "relative",
|
@@ -1959,6 +2242,29 @@ const EditorLayout$1 = ({
|
|
1959
2242
|
}
|
1960
2243
|
);
|
1961
2244
|
};
|
2245
|
+
const InputWrapper = styled(Flex)`
|
2246
|
+
border: 1px solid
|
2247
|
+
${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
|
2248
|
+
border-radius: ${({ theme }) => theme.borderRadius};
|
2249
|
+
background: ${({ theme }) => theme.colors.neutral0};
|
2250
|
+
|
2251
|
+
${({ theme, $hasError = false }) => css`
|
2252
|
+
outline: none;
|
2253
|
+
box-shadow: 0;
|
2254
|
+
transition-property: border-color, box-shadow, fill;
|
2255
|
+
transition-duration: 0.2s;
|
2256
|
+
|
2257
|
+
&:focus-within {
|
2258
|
+
border: 1px solid ${$hasError ? theme.colors.danger600 : theme.colors.primary600};
|
2259
|
+
box-shadow: ${$hasError ? theme.colors.danger600 : theme.colors.primary600} 0px 0px 0px 2px;
|
2260
|
+
}
|
2261
|
+
`}
|
2262
|
+
|
2263
|
+
${({ theme, $disabled }) => $disabled ? css`
|
2264
|
+
color: ${theme.colors.neutral600};
|
2265
|
+
background: ${theme.colors.neutral150};
|
2266
|
+
` : void 0}
|
2267
|
+
`;
|
1962
2268
|
const stylesToInherit = css`
|
1963
2269
|
font-size: inherit;
|
1964
2270
|
color: inherit;
|
@@ -1971,10 +2277,14 @@ const ItalicText = styled(Typography)`
|
|
1971
2277
|
font-style: italic;
|
1972
2278
|
${stylesToInherit}
|
1973
2279
|
`;
|
1974
|
-
const UnderlineText = styled(Typography).attrs({
|
2280
|
+
const UnderlineText = styled(Typography).attrs({
|
2281
|
+
textDecoration: "underline"
|
2282
|
+
})`
|
1975
2283
|
${stylesToInherit}
|
1976
2284
|
`;
|
1977
|
-
const StrikeThroughText = styled(Typography).attrs({
|
2285
|
+
const StrikeThroughText = styled(Typography).attrs({
|
2286
|
+
textDecoration: "line-through"
|
2287
|
+
})`
|
1978
2288
|
${stylesToInherit}
|
1979
2289
|
`;
|
1980
2290
|
const InlineCode = styled.code`
|
@@ -2242,7 +2552,7 @@ const BlocksEditor = React.forwardRef(
|
|
2242
2552
|
!isExpandedMode && /* @__PURE__ */ jsx(
|
2243
2553
|
ExpandIconButton,
|
2244
2554
|
{
|
2245
|
-
|
2555
|
+
label: formatMessage({
|
2246
2556
|
id: getTranslation("components.Blocks.expand"),
|
2247
2557
|
defaultMessage: "Expand"
|
2248
2558
|
}),
|
@@ -2265,8 +2575,8 @@ const BlocksInput = React.forwardRef(
|
|
2265
2575
|
({ label, name: name2, required = false, hint, labelAction, ...editorProps }, forwardedRef) => {
|
2266
2576
|
const id = React.useId();
|
2267
2577
|
const field = useField(name2);
|
2268
|
-
return /* @__PURE__ */ jsx(Field, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
2269
|
-
/* @__PURE__ */ jsx(
|
2578
|
+
return /* @__PURE__ */ jsx(Field.Root, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
2579
|
+
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
2270
2580
|
/* @__PURE__ */ jsx(
|
2271
2581
|
BlocksEditor,
|
2272
2582
|
{
|
@@ -2279,11 +2589,12 @@ const BlocksInput = React.forwardRef(
|
|
2279
2589
|
...editorProps
|
2280
2590
|
}
|
2281
2591
|
),
|
2282
|
-
/* @__PURE__ */ jsx(
|
2283
|
-
/* @__PURE__ */ jsx(
|
2592
|
+
/* @__PURE__ */ jsx(Field.Hint, {}),
|
2593
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
2284
2594
|
] }) });
|
2285
2595
|
}
|
2286
2596
|
);
|
2597
|
+
const MemoizedBlocksInput = React.memo(BlocksInput);
|
2287
2598
|
const createDefaultForm = (contentType, components = {}) => {
|
2288
2599
|
const traverseSchema = (attributes) => {
|
2289
2600
|
return Object.entries(attributes).reduce((acc, [key, attribute]) => {
|
@@ -2307,30 +2618,27 @@ const createDefaultForm = (contentType, components = {}) => {
|
|
2307
2618
|
const Initializer = ({ disabled, name: name2, onClick }) => {
|
2308
2619
|
const { formatMessage } = useIntl();
|
2309
2620
|
const field = useField(name2);
|
2310
|
-
return /* @__PURE__ */
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
),
|
2332
|
-
field.error && /* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "pi", children: field.error })
|
2333
|
-
] });
|
2621
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
2622
|
+
Box,
|
2623
|
+
{
|
2624
|
+
tag: "button",
|
2625
|
+
background: "neutral100",
|
2626
|
+
borderColor: field.error ? "danger600" : "neutral200",
|
2627
|
+
hasRadius: true,
|
2628
|
+
disabled,
|
2629
|
+
onClick,
|
2630
|
+
paddingTop: 9,
|
2631
|
+
paddingBottom: 9,
|
2632
|
+
type: "button",
|
2633
|
+
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
|
2634
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(CircleIcon, {}) }),
|
2635
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Typography, { textColor: "primary600", variant: "pi", fontWeight: "bold", children: formatMessage({
|
2636
|
+
id: getTranslation("components.empty-repeatable"),
|
2637
|
+
defaultMessage: "No entry yet. Click on the button below to add one."
|
2638
|
+
}) }) })
|
2639
|
+
] })
|
2640
|
+
}
|
2641
|
+
) });
|
2334
2642
|
};
|
2335
2643
|
const CircleIcon = styled(PlusCircle)`
|
2336
2644
|
width: 2.4rem;
|
@@ -2362,9 +2670,20 @@ const NonRepeatableComponent = ({
|
|
2362
2670
|
hasRadius: isNested,
|
2363
2671
|
borderColor: isNested ? "neutral200" : void 0,
|
2364
2672
|
children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index) => {
|
2365
|
-
return /* @__PURE__ */ jsx(Grid$1, { gap: 4, children: row.map(({ size, ...field }) => {
|
2673
|
+
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2366
2674
|
const completeFieldName = `${name2}.${field.name}`;
|
2367
|
-
return /* @__PURE__ */ jsx(
|
2675
|
+
return /* @__PURE__ */ jsx(
|
2676
|
+
Grid$1.Item,
|
2677
|
+
{
|
2678
|
+
col: size,
|
2679
|
+
s: 12,
|
2680
|
+
xs: 12,
|
2681
|
+
direction: "column",
|
2682
|
+
alignItems: "stretch",
|
2683
|
+
children: children({ ...field, name: completeFieldName })
|
2684
|
+
},
|
2685
|
+
completeFieldName
|
2686
|
+
);
|
2368
2687
|
}) }, index);
|
2369
2688
|
}) })
|
2370
2689
|
}
|
@@ -2388,7 +2707,7 @@ const RepeatableComponent = ({
|
|
2388
2707
|
const moveFieldRow = useForm("RepeatableComponent", (state) => state.moveFieldRow);
|
2389
2708
|
const removeFieldRow = useForm("RepeatableComponent", (state) => state.removeFieldRow);
|
2390
2709
|
const { max = Infinity } = attribute;
|
2391
|
-
const [collapseToOpen, setCollapseToOpen] = React.useState(
|
2710
|
+
const [collapseToOpen, setCollapseToOpen] = React.useState("");
|
2392
2711
|
const [liveText, setLiveText] = React.useState("");
|
2393
2712
|
const componentTmpKeyWithFocussedField = React.useMemo(() => {
|
2394
2713
|
if (search.has("field")) {
|
@@ -2404,13 +2723,19 @@ const RepeatableComponent = ({
|
|
2404
2723
|
}
|
2405
2724
|
return void 0;
|
2406
2725
|
}, [search, name2, value]);
|
2726
|
+
const prevValue = usePrev(value);
|
2407
2727
|
React.useEffect(() => {
|
2408
|
-
if (
|
2728
|
+
if (prevValue && prevValue.length < value.length) {
|
2729
|
+
setCollapseToOpen(value[value.length - 1].__temp_key__);
|
2730
|
+
}
|
2731
|
+
}, [value, prevValue]);
|
2732
|
+
React.useEffect(() => {
|
2733
|
+
if (typeof componentTmpKeyWithFocussedField === "string") {
|
2409
2734
|
setCollapseToOpen(componentTmpKeyWithFocussedField);
|
2410
2735
|
}
|
2411
2736
|
}, [componentTmpKeyWithFocussedField]);
|
2412
2737
|
const toggleCollapses = () => {
|
2413
|
-
setCollapseToOpen(
|
2738
|
+
setCollapseToOpen("");
|
2414
2739
|
};
|
2415
2740
|
const handleClick = () => {
|
2416
2741
|
if (value.length < max) {
|
@@ -2442,12 +2767,8 @@ const RepeatableComponent = ({
|
|
2442
2767
|
);
|
2443
2768
|
moveFieldRow(name2, currentIndex, newIndex);
|
2444
2769
|
};
|
2445
|
-
const
|
2446
|
-
|
2447
|
-
setCollapseToOpen(null);
|
2448
|
-
} else {
|
2449
|
-
setCollapseToOpen(key);
|
2450
|
-
}
|
2770
|
+
const handleValueChange = (key) => {
|
2771
|
+
setCollapseToOpen(key);
|
2451
2772
|
};
|
2452
2773
|
const getItemPos = (index) => `${index + 1} of ${value.length}`;
|
2453
2774
|
const handleCancel = (index) => {
|
@@ -2502,158 +2823,115 @@ const RepeatableComponent = ({
|
|
2502
2823
|
defaultMessage: `Press spacebar to grab and re-order`
|
2503
2824
|
}) }),
|
2504
2825
|
/* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
2505
|
-
/* @__PURE__ */ jsxs(
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2826
|
+
/* @__PURE__ */ jsxs(
|
2827
|
+
AccordionRoot,
|
2828
|
+
{
|
2829
|
+
$error: error,
|
2830
|
+
value: collapseToOpen,
|
2831
|
+
onValueChange: handleValueChange,
|
2832
|
+
"aria-describedby": ariaDescriptionId,
|
2833
|
+
children: [
|
2834
|
+
value.map(({ __temp_key__: key, id }, index) => {
|
2835
|
+
const nameWithIndex = `${name2}.${index}`;
|
2836
|
+
return /* @__PURE__ */ jsx(
|
2837
|
+
ComponentProvider,
|
2517
2838
|
{
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2839
|
+
id,
|
2840
|
+
uid: attribute.component,
|
2841
|
+
level: level + 1,
|
2842
|
+
type: "repeatable",
|
2843
|
+
children: /* @__PURE__ */ jsx(
|
2844
|
+
Component,
|
2845
|
+
{
|
2846
|
+
disabled,
|
2847
|
+
name: nameWithIndex,
|
2848
|
+
attribute,
|
2849
|
+
index,
|
2850
|
+
mainField,
|
2851
|
+
onMoveItem: handleMoveComponentField,
|
2852
|
+
onDeleteComponent: () => {
|
2853
|
+
removeFieldRow(name2, index);
|
2854
|
+
toggleCollapses();
|
2855
|
+
},
|
2856
|
+
toggleCollapses,
|
2857
|
+
onCancel: handleCancel,
|
2858
|
+
onDropItem: handleDropItem,
|
2859
|
+
onGrabItem: handleGrabItem,
|
2860
|
+
__temp_key__: key,
|
2861
|
+
children: layout.map((row, index2) => {
|
2862
|
+
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2863
|
+
const completeFieldName = `${nameWithIndex}.${field.name}`;
|
2864
|
+
return /* @__PURE__ */ jsx(
|
2865
|
+
Grid$1.Item,
|
2866
|
+
{
|
2867
|
+
col: size,
|
2868
|
+
s: 12,
|
2869
|
+
xs: 12,
|
2870
|
+
direction: "column",
|
2871
|
+
alignItems: "stretch",
|
2872
|
+
children: children({ ...field, name: completeFieldName })
|
2873
|
+
},
|
2874
|
+
completeFieldName
|
2875
|
+
);
|
2876
|
+
}) }, index2);
|
2877
|
+
})
|
2878
|
+
}
|
2879
|
+
)
|
2880
|
+
},
|
2881
|
+
key
|
2882
|
+
);
|
2883
|
+
}),
|
2884
|
+
/* @__PURE__ */ jsx(TextButtonCustom, { disabled, onClick: handleClick, startIcon: /* @__PURE__ */ jsx(Plus, {}), children: formatMessage({
|
2885
|
+
id: getTranslation("containers.EditView.add.new-entry"),
|
2886
|
+
defaultMessage: "Add an entry"
|
2887
|
+
}) })
|
2888
|
+
]
|
2889
|
+
}
|
2890
|
+
)
|
2551
2891
|
] });
|
2552
2892
|
};
|
2893
|
+
const AccordionRoot = styled(Accordion.Root)`
|
2894
|
+
border: 1px solid
|
2895
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
2896
|
+
`;
|
2553
2897
|
const TextButtonCustom = styled(TextButton)`
|
2554
|
-
height: 100%;
|
2555
2898
|
width: 100%;
|
2556
|
-
border-radius: 0 0 4px 4px;
|
2557
2899
|
display: flex;
|
2558
2900
|
justify-content: center;
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
}
|
2563
|
-
`;
|
2564
|
-
const AccordionFooter = styled(Box)`
|
2565
|
-
overflow: hidden;
|
2566
|
-
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2567
|
-
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2568
|
-
border-left: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2569
|
-
border-radius: 0 0 ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius};
|
2570
|
-
`;
|
2571
|
-
const AccordionContent = styled(Box)`
|
2572
|
-
border-bottom: none;
|
2573
|
-
|
2574
|
-
/* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
|
2575
|
-
& > div > div {
|
2576
|
-
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2577
|
-
border-top-color: transparent;
|
2578
|
-
}
|
2579
|
-
|
2580
|
-
/* the top accordion _does_ need a border though */
|
2581
|
-
& > div:first-child > div {
|
2582
|
-
border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2583
|
-
}
|
2584
|
-
|
2585
|
-
/* Reset all the border-radius' */
|
2586
|
-
& > div > div,
|
2587
|
-
& > div > div > div {
|
2588
|
-
border-radius: unset;
|
2589
|
-
}
|
2901
|
+
border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2902
|
+
padding-inline: ${(props) => props.theme.spaces[6]};
|
2903
|
+
padding-block: ${(props) => props.theme.spaces[3]};
|
2590
2904
|
|
2591
|
-
|
2592
|
-
|
2593
|
-
& > div:first-child > div > div {
|
2594
|
-
border-radius: ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius} 0 0;
|
2595
|
-
}
|
2905
|
+
&:not([disabled]) {
|
2906
|
+
cursor: pointer;
|
2596
2907
|
|
2597
|
-
|
2598
|
-
|
2908
|
+
&:hover {
|
2909
|
+
background-color: ${(props) => props.theme.colors.primary100};
|
2910
|
+
}
|
2599
2911
|
}
|
2600
|
-
`;
|
2601
|
-
const AccordionGroup = ({ children, error }) => {
|
2602
|
-
return /* @__PURE__ */ jsxs(KeyboardNavigable, { attributeName: "data-strapi-accordion-toggle", children: [
|
2603
|
-
children,
|
2604
|
-
error && /* @__PURE__ */ jsx(Box, { paddingTop: 1, children: /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "danger600", children: error }) })
|
2605
|
-
] });
|
2606
|
-
};
|
2607
|
-
const CustomIconButton$1 = styled(IconButton)`
|
2608
|
-
background-color: transparent;
|
2609
2912
|
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2913
|
+
span {
|
2914
|
+
font-weight: 600;
|
2915
|
+
font-size: 1.4rem;
|
2916
|
+
line-height: 2.4rem;
|
2614
2917
|
}
|
2615
2918
|
|
2616
|
-
|
2617
|
-
|
2618
|
-
path {
|
2619
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
2620
|
-
}
|
2621
|
-
}
|
2622
|
-
}
|
2623
|
-
`;
|
2624
|
-
const ActionsFlex$1 = styled(Flex)`
|
2625
|
-
& .drag-handle {
|
2626
|
-
background: unset;
|
2627
|
-
|
2628
|
-
svg {
|
2629
|
-
path {
|
2630
|
-
fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : void 0};
|
2631
|
-
}
|
2632
|
-
}
|
2633
|
-
|
2634
|
-
&:hover {
|
2635
|
-
svg {
|
2636
|
-
path {
|
2637
|
-
/* keeps the hover style of the accordion */
|
2638
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
2639
|
-
}
|
2640
|
-
}
|
2641
|
-
}
|
2919
|
+
@media (prefers-reduced-motion: no-preference) {
|
2920
|
+
transition: background-color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
2642
2921
|
}
|
2643
2922
|
`;
|
2644
2923
|
const Component = ({
|
2645
2924
|
disabled,
|
2646
2925
|
index,
|
2647
|
-
isOpen,
|
2648
2926
|
name: name2,
|
2649
2927
|
mainField = {
|
2650
2928
|
name: "id",
|
2651
2929
|
type: "integer"
|
2652
2930
|
},
|
2653
2931
|
children,
|
2654
|
-
onClickToggle,
|
2655
2932
|
onDeleteComponent,
|
2656
2933
|
toggleCollapses,
|
2934
|
+
__temp_key__,
|
2657
2935
|
...dragProps
|
2658
2936
|
}) => {
|
2659
2937
|
const { formatMessage } = useIntl();
|
@@ -2678,50 +2956,44 @@ const Component = ({
|
|
2678
2956
|
dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
|
2679
2957
|
}, [dragPreviewRef, index]);
|
2680
2958
|
const composedAccordionRefs = useComposedRefs(accordionRef, dragRef);
|
2681
|
-
const composedBoxRefs = useComposedRefs(
|
2682
|
-
|
2683
|
-
|
2684
|
-
|
2685
|
-
|
2686
|
-
|
2687
|
-
|
2688
|
-
|
2689
|
-
|
2690
|
-
|
2691
|
-
|
2692
|
-
|
2693
|
-
|
2694
|
-
|
2695
|
-
|
2696
|
-
|
2697
|
-
|
2698
|
-
}
|
2699
|
-
|
2700
|
-
|
2701
|
-
|
2702
|
-
|
2703
|
-
|
2704
|
-
|
2705
|
-
|
2706
|
-
|
2707
|
-
|
2708
|
-
|
2709
|
-
|
2710
|
-
"
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
] }),
|
2720
|
-
title: displayValue,
|
2721
|
-
togglePosition: "left"
|
2722
|
-
}
|
2723
|
-
),
|
2724
|
-
/* @__PURE__ */ jsx(AccordionContent$1, { children: /* @__PURE__ */ jsx(
|
2959
|
+
const composedBoxRefs = useComposedRefs(
|
2960
|
+
boxRef,
|
2961
|
+
dropRef
|
2962
|
+
);
|
2963
|
+
return /* @__PURE__ */ jsx(Fragment, { children: isDragging ? /* @__PURE__ */ jsx(Preview$1, {}) : /* @__PURE__ */ jsxs(Accordion.Item, { ref: composedBoxRefs, value: __temp_key__, children: [
|
2964
|
+
/* @__PURE__ */ jsxs(Accordion.Header, { children: [
|
2965
|
+
/* @__PURE__ */ jsx(Accordion.Trigger, { children: displayValue }),
|
2966
|
+
/* @__PURE__ */ jsxs(Accordion.Actions, { children: [
|
2967
|
+
/* @__PURE__ */ jsx(
|
2968
|
+
IconButton,
|
2969
|
+
{
|
2970
|
+
variant: "ghost",
|
2971
|
+
onClick: onDeleteComponent,
|
2972
|
+
label: formatMessage({
|
2973
|
+
id: getTranslation("containers.Edit.delete"),
|
2974
|
+
defaultMessage: "Delete"
|
2975
|
+
}),
|
2976
|
+
children: /* @__PURE__ */ jsx(Trash, {})
|
2977
|
+
}
|
2978
|
+
),
|
2979
|
+
/* @__PURE__ */ jsx(
|
2980
|
+
IconButton,
|
2981
|
+
{
|
2982
|
+
ref: composedAccordionRefs,
|
2983
|
+
variant: "ghost",
|
2984
|
+
onClick: (e) => e.stopPropagation(),
|
2985
|
+
"data-handler-id": handlerId,
|
2986
|
+
label: formatMessage({
|
2987
|
+
id: getTranslation("components.DragHandle-label"),
|
2988
|
+
defaultMessage: "Drag"
|
2989
|
+
}),
|
2990
|
+
onKeyDown: handleKeyDown,
|
2991
|
+
children: /* @__PURE__ */ jsx(Drag, {})
|
2992
|
+
}
|
2993
|
+
)
|
2994
|
+
] })
|
2995
|
+
] }),
|
2996
|
+
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(
|
2725
2997
|
Flex,
|
2726
2998
|
{
|
2727
2999
|
direction: "column",
|
@@ -2735,7 +3007,7 @@ const Component = ({
|
|
2735
3007
|
] }) });
|
2736
3008
|
};
|
2737
3009
|
const Preview$1 = () => {
|
2738
|
-
return /* @__PURE__ */ jsx(StyledSpan, {
|
3010
|
+
return /* @__PURE__ */ jsx(StyledSpan, { tag: "span", padding: 6, background: "primary100" });
|
2739
3011
|
};
|
2740
3012
|
const StyledSpan = styled(Box)`
|
2741
3013
|
display: block;
|
@@ -2761,29 +3033,15 @@ const ComponentInput = ({
|
|
2761
3033
|
const data = transformDocument(schema, components)(form);
|
2762
3034
|
field.onChange(name2, data);
|
2763
3035
|
};
|
2764
|
-
return /* @__PURE__ */ jsxs(
|
3036
|
+
return /* @__PURE__ */ jsxs(Field.Root, { error: field.error, required, children: [
|
2765
3037
|
/* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
|
2766
|
-
/* @__PURE__ */ jsxs(
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
fontWeight: "bold",
|
2774
|
-
as: "label",
|
2775
|
-
children: [
|
2776
|
-
label,
|
2777
|
-
attribute.repeatable && /* @__PURE__ */ jsxs(Fragment, { children: [
|
2778
|
-
" (",
|
2779
|
-
Array.isArray(field.value) ? field.value.length : 0,
|
2780
|
-
")"
|
2781
|
-
] }),
|
2782
|
-
required && /* @__PURE__ */ jsx(Typography, { textColor: "danger600", children: "*" })
|
2783
|
-
]
|
2784
|
-
}
|
2785
|
-
),
|
2786
|
-
labelAction && /* @__PURE__ */ jsx(Box, { paddingLeft: 1, children: labelAction })
|
3038
|
+
/* @__PURE__ */ jsxs(Field.Label, { action: labelAction, children: [
|
3039
|
+
label,
|
3040
|
+
attribute.repeatable && /* @__PURE__ */ jsxs(Fragment, { children: [
|
3041
|
+
" (",
|
3042
|
+
Array.isArray(field.value) ? field.value.length : 0,
|
3043
|
+
")"
|
3044
|
+
] })
|
2787
3045
|
] }),
|
2788
3046
|
showResetComponent && /* @__PURE__ */ jsx(
|
2789
3047
|
IconButton,
|
@@ -2792,21 +3050,21 @@ const ComponentInput = ({
|
|
2792
3050
|
id: getTranslation("components.reset-entry"),
|
2793
3051
|
defaultMessage: "Reset Entry"
|
2794
3052
|
}),
|
2795
|
-
|
2796
|
-
borderWidth: 0,
|
3053
|
+
variant: "ghost",
|
2797
3054
|
onClick: () => {
|
2798
3055
|
field.onChange(name2, null);
|
2799
|
-
}
|
3056
|
+
},
|
3057
|
+
children: /* @__PURE__ */ jsx(Trash, {})
|
2800
3058
|
}
|
2801
3059
|
)
|
2802
3060
|
] }),
|
2803
|
-
/* @__PURE__ */
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
] })
|
3061
|
+
!attribute.repeatable && !field.value && /* @__PURE__ */ jsx(Initializer, { disabled, name: name2, onClick: handleInitialisationClick }),
|
3062
|
+
!attribute.repeatable && field.value ? /* @__PURE__ */ jsx(NonRepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }) : null,
|
3063
|
+
attribute.repeatable && /* @__PURE__ */ jsx(RepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }),
|
3064
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
2808
3065
|
] });
|
2809
3066
|
};
|
3067
|
+
const MemoizedComponentInput = React.memo(ComponentInput);
|
2810
3068
|
const AddComponentButton = ({
|
2811
3069
|
hasError,
|
2812
3070
|
isDisabled,
|
@@ -2821,15 +3079,12 @@ const AddComponentButton = ({
|
|
2821
3079
|
onClick,
|
2822
3080
|
disabled: isDisabled,
|
2823
3081
|
background: "neutral0",
|
2824
|
-
paddingTop: 3,
|
2825
|
-
paddingBottom: 3,
|
2826
|
-
paddingLeft: 4,
|
2827
|
-
paddingRight: 4,
|
2828
3082
|
style: { cursor: isDisabled ? "not-allowed" : "pointer" },
|
2829
|
-
|
3083
|
+
variant: "tertiary",
|
3084
|
+
children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
|
2830
3085
|
/* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
|
2831
3086
|
/* @__PURE__ */ jsx(
|
2832
|
-
|
3087
|
+
AddComponentTitle,
|
2833
3088
|
{
|
2834
3089
|
variant: "pi",
|
2835
3090
|
fontWeight: "bold",
|
@@ -2853,13 +3108,15 @@ const StyledAddIcon = styled(PlusCircle)`
|
|
2853
3108
|
fill: ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral600};
|
2854
3109
|
}
|
2855
3110
|
`;
|
2856
|
-
const
|
3111
|
+
const AddComponentTitle = styled(Typography)``;
|
3112
|
+
const StyledButton = styled(Button)`
|
2857
3113
|
border-radius: 26px;
|
2858
3114
|
border-color: ${({ theme }) => theme.colors.neutral150};
|
2859
3115
|
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
|
3116
|
+
height: 5rem;
|
2860
3117
|
|
2861
3118
|
&:hover {
|
2862
|
-
${
|
3119
|
+
${AddComponentTitle} {
|
2863
3120
|
color: ${({ theme }) => theme.colors.primary600};
|
2864
3121
|
}
|
2865
3122
|
|
@@ -2868,12 +3125,12 @@ const StyledButton = styled(BaseButton)`
|
|
2868
3125
|
fill: ${({ theme }) => theme.colors.primary600};
|
2869
3126
|
}
|
2870
3127
|
> path {
|
2871
|
-
fill: ${({ theme }) => theme.colors.
|
3128
|
+
fill: ${({ theme }) => theme.colors.primary600};
|
2872
3129
|
}
|
2873
3130
|
}
|
2874
3131
|
}
|
2875
3132
|
&:active {
|
2876
|
-
${
|
3133
|
+
${AddComponentTitle} {
|
2877
3134
|
color: ${({ theme }) => theme.colors.primary600};
|
2878
3135
|
}
|
2879
3136
|
${StyledAddIcon} {
|
@@ -2890,27 +3147,15 @@ const ComponentCategory = ({
|
|
2890
3147
|
category,
|
2891
3148
|
components = [],
|
2892
3149
|
variant = "primary",
|
2893
|
-
|
2894
|
-
onAddComponent,
|
2895
|
-
onToggle
|
3150
|
+
onAddComponent
|
2896
3151
|
}) => {
|
2897
3152
|
const { formatMessage } = useIntl();
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
return /* @__PURE__ */ jsxs(Accordion, { expanded: isOpen, onToggle: handleToggle, size: "S", children: [
|
2902
|
-
/* @__PURE__ */ jsx(
|
2903
|
-
AccordionToggle,
|
2904
|
-
{
|
2905
|
-
variant,
|
2906
|
-
title: formatMessage({ id: category, defaultMessage: category }),
|
2907
|
-
togglePosition: "left"
|
2908
|
-
}
|
2909
|
-
),
|
2910
|
-
/* @__PURE__ */ jsx(AccordionContent$1, { children: /* @__PURE__ */ jsx(Box, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: /* @__PURE__ */ jsx(Grid, { children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsx(
|
3153
|
+
return /* @__PURE__ */ jsxs(Accordion.Item, { value: category, children: [
|
3154
|
+
/* @__PURE__ */ jsx(Accordion.Header, { variant, children: /* @__PURE__ */ jsx(Accordion.Trigger, { children: formatMessage({ id: category, defaultMessage: category }) }) }),
|
3155
|
+
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Grid, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsx(
|
2911
3156
|
ComponentBox,
|
2912
3157
|
{
|
2913
|
-
|
3158
|
+
tag: "button",
|
2914
3159
|
type: "button",
|
2915
3160
|
background: "neutral100",
|
2916
3161
|
justifyContent: "center",
|
@@ -2920,34 +3165,32 @@ const ComponentCategory = ({
|
|
2920
3165
|
shrink: 0,
|
2921
3166
|
borderColor: "neutral200",
|
2922
3167
|
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "center", justifyContent: "center", children: [
|
2923
|
-
/* @__PURE__ */ jsx(ComponentIcon, { icon }),
|
2924
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold",
|
3168
|
+
/* @__PURE__ */ jsx(ComponentIcon, { color: "currentColor", background: "primary200", icon }),
|
3169
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: displayName })
|
2925
3170
|
] })
|
2926
3171
|
},
|
2927
3172
|
uid
|
2928
|
-
)) }) })
|
3173
|
+
)) }) })
|
2929
3174
|
] });
|
2930
3175
|
};
|
2931
|
-
const Grid = styled
|
3176
|
+
const Grid = styled(Box)`
|
2932
3177
|
display: grid;
|
2933
3178
|
grid-template-columns: repeat(auto-fit, 14rem);
|
2934
3179
|
grid-gap: ${({ theme }) => theme.spaces[1]};
|
2935
3180
|
`;
|
2936
3181
|
const ComponentBox = styled(Flex)`
|
3182
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
3183
|
+
cursor: pointer;
|
3184
|
+
|
3185
|
+
@media (prefers-reduced-motion: no-preference) {
|
3186
|
+
transition: color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
3187
|
+
}
|
3188
|
+
|
2937
3189
|
&:focus,
|
2938
3190
|
&:hover {
|
2939
3191
|
border: 1px solid ${({ theme }) => theme.colors.primary200};
|
2940
3192
|
background: ${({ theme }) => theme.colors.primary100};
|
2941
|
-
|
2942
|
-
${Typography} {
|
2943
|
-
color: ${({ theme }) => theme.colors.primary600};
|
2944
|
-
}
|
2945
|
-
|
2946
|
-
/* > Flex > ComponentIcon */
|
2947
|
-
> div > div:first-child {
|
2948
|
-
background: ${({ theme }) => theme.colors.primary200};
|
2949
|
-
color: ${({ theme }) => theme.colors.primary600};
|
2950
|
-
}
|
3193
|
+
color: ${({ theme }) => theme.colors.primary600};
|
2951
3194
|
}
|
2952
3195
|
`;
|
2953
3196
|
const ComponentPicker = ({
|
@@ -2956,19 +3199,8 @@ const ComponentPicker = ({
|
|
2956
3199
|
onClickAddComponent
|
2957
3200
|
}) => {
|
2958
3201
|
const { formatMessage } = useIntl();
|
2959
|
-
const [categoryToOpen, setCategoryToOpen] = React.useState("");
|
2960
|
-
React.useEffect(() => {
|
2961
|
-
const categoryKeys = Object.keys(dynamicComponentsByCategory);
|
2962
|
-
if (isOpen && categoryKeys.length > 0) {
|
2963
|
-
setCategoryToOpen(categoryKeys[0]);
|
2964
|
-
}
|
2965
|
-
}, [isOpen, dynamicComponentsByCategory]);
|
2966
3202
|
const handleAddComponentToDz = (componentUid) => () => {
|
2967
3203
|
onClickAddComponent(componentUid);
|
2968
|
-
setCategoryToOpen("");
|
2969
|
-
};
|
2970
|
-
const handleClickToggle = (categoryName) => {
|
2971
|
-
setCategoryToOpen((currentCat) => currentCat === categoryName ? "" : categoryName);
|
2972
3204
|
};
|
2973
3205
|
if (!isOpen) {
|
2974
3206
|
return null;
|
@@ -2989,14 +3221,12 @@ const ComponentPicker = ({
|
|
2989
3221
|
id: getTranslation("components.DynamicZone.ComponentPicker-label"),
|
2990
3222
|
defaultMessage: "Pick one component"
|
2991
3223
|
}) }) }),
|
2992
|
-
/* @__PURE__ */ jsx(Box, { paddingTop: 2, children: /* @__PURE__ */ jsx(
|
3224
|
+
/* @__PURE__ */ jsx(Box, { paddingTop: 2, children: /* @__PURE__ */ jsx(Accordion.Root, { defaultValue: Object.keys(dynamicComponentsByCategory)[0], children: Object.entries(dynamicComponentsByCategory).map(([category, components], index) => /* @__PURE__ */ jsx(
|
2993
3225
|
ComponentCategory,
|
2994
3226
|
{
|
2995
3227
|
category,
|
2996
3228
|
components,
|
2997
3229
|
onAddComponent: handleAddComponentToDz,
|
2998
|
-
isOpen: category === categoryToOpen,
|
2999
|
-
onToggle: handleClickToggle,
|
3000
3230
|
variant: index % 2 === 1 ? "primary" : "secondary"
|
3001
3231
|
},
|
3002
3232
|
category
|
@@ -3011,27 +3241,21 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
|
|
3011
3241
|
id: "components.NotAllowedInput.text",
|
3012
3242
|
defaultMessage: "No permissions to see this field"
|
3013
3243
|
});
|
3014
|
-
return /* @__PURE__ */
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3026
|
-
|
3027
|
-
|
3028
|
-
);
|
3244
|
+
return /* @__PURE__ */ jsxs(Field.Root, { id: name2, hint, name: name2, required, children: [
|
3245
|
+
/* @__PURE__ */ jsx(Field.Label, { children: label }),
|
3246
|
+
/* @__PURE__ */ jsx(
|
3247
|
+
TextInput,
|
3248
|
+
{
|
3249
|
+
disabled: true,
|
3250
|
+
placeholder,
|
3251
|
+
startAction: /* @__PURE__ */ jsx(EyeStriked, { fill: "neutral600" }),
|
3252
|
+
type: "text",
|
3253
|
+
value: ""
|
3254
|
+
}
|
3255
|
+
),
|
3256
|
+
/* @__PURE__ */ jsx(Field.Hint, {})
|
3257
|
+
] });
|
3029
3258
|
};
|
3030
|
-
const StyledIcon = styled(EyeStriked)`
|
3031
|
-
& > path {
|
3032
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
3033
|
-
}
|
3034
|
-
`;
|
3035
3259
|
function useDebounce(value, delay) {
|
3036
3260
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
3037
3261
|
useEffect(() => {
|
@@ -3084,188 +3308,193 @@ const uidApi = contentManagerApi.injectEndpoints({
|
|
3084
3308
|
});
|
3085
3309
|
const { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;
|
3086
3310
|
const UID_REGEX = /^[A-Za-z0-9-_.~]*$/;
|
3087
|
-
const UIDInput = React.forwardRef(
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3093
|
-
|
3094
|
-
|
3095
|
-
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
field: props.name,
|
3107
|
-
data: {
|
3108
|
-
id: id ?? "",
|
3109
|
-
...allFormValues
|
3110
|
-
},
|
3111
|
-
params
|
3112
|
-
},
|
3113
|
-
{
|
3114
|
-
skip: field.value || !props.required
|
3115
|
-
}
|
3116
|
-
);
|
3117
|
-
React.useEffect(() => {
|
3118
|
-
if (apiError) {
|
3119
|
-
toggleNotification({
|
3120
|
-
type: "warning",
|
3121
|
-
message: formatAPIError(apiError)
|
3122
|
-
});
|
3123
|
-
}
|
3124
|
-
}, [apiError, formatAPIError, toggleNotification]);
|
3125
|
-
React.useEffect(() => {
|
3126
|
-
if (defaultGeneratedUID && field.value === void 0) {
|
3127
|
-
field.onChange(props.name, defaultGeneratedUID);
|
3128
|
-
}
|
3129
|
-
}, [defaultGeneratedUID, field, props.name]);
|
3130
|
-
const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
|
3131
|
-
const handleRegenerateClick = async () => {
|
3132
|
-
try {
|
3133
|
-
const res = await generateUID({
|
3311
|
+
const UIDInput = React.forwardRef(
|
3312
|
+
({ hint, label, labelAction, name: name2, required, ...props }, ref) => {
|
3313
|
+
const { model, id } = useDoc();
|
3314
|
+
const allFormValues = useForm("InputUID", (form) => form.values);
|
3315
|
+
const [availability, setAvailability] = React.useState();
|
3316
|
+
const [showRegenerate, setShowRegenerate] = React.useState(false);
|
3317
|
+
const field = useField(name2);
|
3318
|
+
const debouncedValue = useDebounce(field.value, 300);
|
3319
|
+
const { toggleNotification } = useNotification();
|
3320
|
+
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
3321
|
+
const { formatMessage } = useIntl();
|
3322
|
+
const [{ query }] = useQueryParams();
|
3323
|
+
const params = React.useMemo(() => buildValidParams(query), [query]);
|
3324
|
+
const {
|
3325
|
+
data: defaultGeneratedUID,
|
3326
|
+
isLoading: isGeneratingDefaultUID,
|
3327
|
+
error: apiError
|
3328
|
+
} = useGetDefaultUIDQuery(
|
3329
|
+
{
|
3134
3330
|
contentTypeUID: model,
|
3135
|
-
field:
|
3136
|
-
data: {
|
3331
|
+
field: name2,
|
3332
|
+
data: {
|
3333
|
+
id: id ?? "",
|
3334
|
+
...allFormValues
|
3335
|
+
},
|
3137
3336
|
params
|
3138
|
-
}
|
3139
|
-
|
3140
|
-
field.
|
3141
|
-
}
|
3337
|
+
},
|
3338
|
+
{
|
3339
|
+
skip: field.value || !required
|
3340
|
+
}
|
3341
|
+
);
|
3342
|
+
React.useEffect(() => {
|
3343
|
+
if (apiError) {
|
3142
3344
|
toggleNotification({
|
3143
|
-
type: "
|
3144
|
-
message: formatAPIError(
|
3345
|
+
type: "warning",
|
3346
|
+
message: formatAPIError(apiError)
|
3145
3347
|
});
|
3146
3348
|
}
|
3147
|
-
}
|
3148
|
-
|
3149
|
-
|
3150
|
-
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3155
|
-
|
3156
|
-
|
3157
|
-
|
3158
|
-
|
3159
|
-
|
3160
|
-
|
3161
|
-
|
3162
|
-
|
3163
|
-
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
message: formatAPIError(availabilityError)
|
3179
|
-
});
|
3180
|
-
}
|
3181
|
-
}, [availabilityError, formatAPIError, toggleNotification]);
|
3182
|
-
React.useEffect(() => {
|
3183
|
-
setAvailability(availabilityData);
|
3184
|
-
let timer;
|
3185
|
-
if (availabilityData?.isAvailable) {
|
3186
|
-
timer = window.setTimeout(() => {
|
3187
|
-
setAvailability(void 0);
|
3188
|
-
}, 4e3);
|
3189
|
-
}
|
3190
|
-
return () => {
|
3191
|
-
if (timer) {
|
3192
|
-
clearTimeout(timer);
|
3349
|
+
}, [apiError, formatAPIError, toggleNotification]);
|
3350
|
+
React.useEffect(() => {
|
3351
|
+
if (defaultGeneratedUID && field.value === void 0) {
|
3352
|
+
field.onChange(name2, defaultGeneratedUID);
|
3353
|
+
}
|
3354
|
+
}, [defaultGeneratedUID, field, name2]);
|
3355
|
+
const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
|
3356
|
+
const handleRegenerateClick = async () => {
|
3357
|
+
try {
|
3358
|
+
const res = await generateUID({
|
3359
|
+
contentTypeUID: model,
|
3360
|
+
field: name2,
|
3361
|
+
data: { id: id ?? "", ...allFormValues },
|
3362
|
+
params
|
3363
|
+
});
|
3364
|
+
if ("data" in res) {
|
3365
|
+
field.onChange(name2, res.data);
|
3366
|
+
} else {
|
3367
|
+
toggleNotification({
|
3368
|
+
type: "danger",
|
3369
|
+
message: formatAPIError(res.error)
|
3370
|
+
});
|
3371
|
+
}
|
3372
|
+
} catch (err) {
|
3373
|
+
toggleNotification({
|
3374
|
+
type: "danger",
|
3375
|
+
message: formatMessage({
|
3376
|
+
id: "notification.error",
|
3377
|
+
defaultMessage: "An error occurred."
|
3378
|
+
})
|
3379
|
+
});
|
3193
3380
|
}
|
3194
3381
|
};
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
// @ts-expect-error – label _could_ be a ReactNode since it's a child, this should be fixed in the DS.
|
3201
|
-
/* @__PURE__ */ jsx(
|
3202
|
-
TextInput,
|
3382
|
+
const {
|
3383
|
+
data: availabilityData,
|
3384
|
+
isLoading: isCheckingAvailability,
|
3385
|
+
error: availabilityError
|
3386
|
+
} = useGetAvailabilityQuery(
|
3203
3387
|
{
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3388
|
+
contentTypeUID: model,
|
3389
|
+
field: name2,
|
3390
|
+
value: debouncedValue ? debouncedValue.trim() : "",
|
3391
|
+
params
|
3392
|
+
},
|
3393
|
+
{
|
3394
|
+
skip: !Boolean(
|
3395
|
+
debouncedValue !== field.initialValue && debouncedValue && UID_REGEX.test(debouncedValue.trim())
|
3396
|
+
)
|
3397
|
+
}
|
3398
|
+
);
|
3399
|
+
React.useEffect(() => {
|
3400
|
+
if (availabilityError) {
|
3401
|
+
toggleNotification({
|
3402
|
+
type: "warning",
|
3403
|
+
message: formatAPIError(availabilityError)
|
3404
|
+
});
|
3405
|
+
}
|
3406
|
+
}, [availabilityError, formatAPIError, toggleNotification]);
|
3407
|
+
React.useEffect(() => {
|
3408
|
+
setAvailability(availabilityData);
|
3409
|
+
let timer;
|
3410
|
+
if (availabilityData?.isAvailable) {
|
3411
|
+
timer = window.setTimeout(() => {
|
3412
|
+
setAvailability(void 0);
|
3413
|
+
}, 4e3);
|
3414
|
+
}
|
3415
|
+
return () => {
|
3416
|
+
if (timer) {
|
3417
|
+
clearTimeout(timer);
|
3418
|
+
}
|
3419
|
+
};
|
3420
|
+
}, [availabilityData]);
|
3421
|
+
const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
|
3422
|
+
const fieldRef = useFocusInputField(name2);
|
3423
|
+
const composedRefs = useComposedRefs(ref, fieldRef);
|
3424
|
+
return /* @__PURE__ */ jsxs(Field.Root, { hint, name: name2, error: field.error, required, children: [
|
3425
|
+
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
3426
|
+
/* @__PURE__ */ jsx(
|
3427
|
+
TextInput,
|
3428
|
+
{
|
3429
|
+
ref: composedRefs,
|
3430
|
+
disabled: props.disabled,
|
3431
|
+
endAction: /* @__PURE__ */ jsxs(Flex, { position: "relative", gap: 1, children: [
|
3432
|
+
availability && !showRegenerate && /* @__PURE__ */ jsxs(
|
3433
|
+
TextValidation,
|
3248
3434
|
{
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
|
3435
|
+
alignItems: "center",
|
3436
|
+
gap: 1,
|
3437
|
+
justifyContent: "flex-end",
|
3438
|
+
$available: !!availability?.isAvailable,
|
3439
|
+
"data-not-here-outer": true,
|
3440
|
+
position: "absolute",
|
3441
|
+
pointerEvents: "none",
|
3442
|
+
right: 6,
|
3443
|
+
width: "100px",
|
3444
|
+
children: [
|
3445
|
+
availability?.isAvailable ? /* @__PURE__ */ jsx(CheckCircle, {}) : /* @__PURE__ */ jsx(WarningCircle, {}),
|
3446
|
+
/* @__PURE__ */ jsx(
|
3447
|
+
Typography,
|
3448
|
+
{
|
3449
|
+
textColor: availability.isAvailable ? "success600" : "danger600",
|
3450
|
+
variant: "pi",
|
3451
|
+
children: formatMessage(
|
3452
|
+
availability.isAvailable ? {
|
3453
|
+
id: "content-manager.components.uid.available",
|
3454
|
+
defaultMessage: "Available"
|
3455
|
+
} : {
|
3456
|
+
id: "content-manager.components.uid.unavailable",
|
3457
|
+
defaultMessage: "Unavailable"
|
3458
|
+
}
|
3459
|
+
)
|
3460
|
+
}
|
3461
|
+
)
|
3462
|
+
]
|
3257
3463
|
}
|
3258
|
-
)
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3464
|
+
),
|
3465
|
+
!props.disabled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
3466
|
+
showRegenerate && /* @__PURE__ */ jsx(TextValidation, { alignItems: "center", justifyContent: "flex-end", gap: 1, children: /* @__PURE__ */ jsx(Typography, { textColor: "primary600", variant: "pi", children: formatMessage({
|
3467
|
+
id: "content-manager.components.uid.regenerate",
|
3468
|
+
defaultMessage: "Regenerate"
|
3469
|
+
}) }) }),
|
3470
|
+
/* @__PURE__ */ jsx(
|
3471
|
+
FieldActionWrapper,
|
3472
|
+
{
|
3473
|
+
onClick: handleRegenerateClick,
|
3474
|
+
label: formatMessage({
|
3475
|
+
id: "content-manager.components.uid.regenerate",
|
3476
|
+
defaultMessage: "Regenerate"
|
3477
|
+
}),
|
3478
|
+
onMouseEnter: () => setShowRegenerate(true),
|
3479
|
+
onMouseLeave: () => setShowRegenerate(false),
|
3480
|
+
children: isLoading ? /* @__PURE__ */ jsx(LoadingWrapper, { "data-testid": "loading-wrapper", children: /* @__PURE__ */ jsx(Loader, {}) }) : /* @__PURE__ */ jsx(ArrowClockwise, {})
|
3481
|
+
}
|
3482
|
+
)
|
3483
|
+
] })
|
3484
|
+
] }),
|
3485
|
+
onChange: field.onChange,
|
3486
|
+
value: field.value ?? "",
|
3487
|
+
...props
|
3488
|
+
}
|
3489
|
+
),
|
3490
|
+
/* @__PURE__ */ jsx(Field.Error, {}),
|
3491
|
+
/* @__PURE__ */ jsx(Field.Hint, {})
|
3492
|
+
] });
|
3493
|
+
}
|
3494
|
+
);
|
3495
|
+
const FieldActionWrapper = styled(Field.Action)`
|
3496
|
+
width: 1.6rem;
|
3497
|
+
|
3269
3498
|
svg {
|
3270
3499
|
height: 1.6rem;
|
3271
3500
|
width: 1.6rem;
|
@@ -3286,7 +3515,7 @@ const TextValidation = styled(Flex)`
|
|
3286
3515
|
width: 1.2rem;
|
3287
3516
|
|
3288
3517
|
path {
|
3289
|
-
fill: ${({ theme, available }) => available ? theme.colors.success600 : theme.colors.danger600};
|
3518
|
+
fill: ${({ theme, $available }) => $available ? theme.colors.success600 : theme.colors.danger600};
|
3290
3519
|
}
|
3291
3520
|
}
|
3292
3521
|
`;
|
@@ -3301,6 +3530,7 @@ const rotation = keyframes`
|
|
3301
3530
|
const LoadingWrapper = styled(Flex)`
|
3302
3531
|
animation: ${rotation} 2s infinite linear;
|
3303
3532
|
`;
|
3533
|
+
const MemoizedUIDInput = React.memo(UIDInput);
|
3304
3534
|
const md = new Markdown({
|
3305
3535
|
html: true,
|
3306
3536
|
// Enable HTML tags in source
|
@@ -3635,7 +3865,7 @@ const Editor = React.forwardRef(
|
|
3635
3865
|
[editorRef]
|
3636
3866
|
);
|
3637
3867
|
return /* @__PURE__ */ jsxs(EditorAndPreviewWrapper, { children: [
|
3638
|
-
/* @__PURE__ */ jsx(EditorStylesContainer, { isExpandMode, disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsx("textarea", { ref: textareaRef }) }),
|
3868
|
+
/* @__PURE__ */ jsx(EditorStylesContainer, { $isExpandMode: isExpandMode, $disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsx("textarea", { ref: textareaRef }) }),
|
3639
3869
|
isPreviewMode && /* @__PURE__ */ jsx(PreviewWysiwyg, { data: value })
|
3640
3870
|
] });
|
3641
3871
|
}
|
@@ -3645,7 +3875,7 @@ const EditorAndPreviewWrapper = styled.div`
|
|
3645
3875
|
height: calc(100% - 48px);
|
3646
3876
|
`;
|
3647
3877
|
const EditorStylesContainer = styled.div`
|
3648
|
-
cursor: ${({ disabled }) => disabled ? "not-allowed !important" : "auto"};
|
3878
|
+
cursor: ${({ $disabled }) => $disabled ? "not-allowed !important" : "auto"};
|
3649
3879
|
height: 100%;
|
3650
3880
|
/* BASICS */
|
3651
3881
|
.CodeMirror-placeholder {
|
@@ -3655,7 +3885,7 @@ const EditorStylesContainer = styled.div`
|
|
3655
3885
|
.CodeMirror {
|
3656
3886
|
/* Set height, width, borders, and global font properties here */
|
3657
3887
|
font-size: 1.4rem;
|
3658
|
-
height: ${({ isExpandMode }) => isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
|
3888
|
+
height: ${({ $isExpandMode }) => $isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
|
3659
3889
|
color: ${({ theme }) => theme.colors.neutral800};
|
3660
3890
|
direction: ltr;
|
3661
3891
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
@@ -4033,7 +4263,7 @@ const EditorLayout = ({
|
|
4033
4263
|
justifyContent: "flex-end",
|
4034
4264
|
shrink: 0,
|
4035
4265
|
width: "100%",
|
4036
|
-
children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, children: [
|
4266
|
+
children: /* @__PURE__ */ jsxs(ExpandButton$1, { onClick: onCollapse, variant: "tertiary", size: "M", children: [
|
4037
4267
|
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
4038
4268
|
id: "components.Wysiwyg.collapse",
|
4039
4269
|
defaultMessage: "Collapse"
|
@@ -4051,12 +4281,14 @@ const EditorLayout = ({
|
|
4051
4281
|
) }) });
|
4052
4282
|
}
|
4053
4283
|
return /* @__PURE__ */ jsx(
|
4054
|
-
|
4284
|
+
Flex,
|
4055
4285
|
{
|
4056
4286
|
borderColor: error ? "danger600" : "neutral200",
|
4057
4287
|
borderStyle: "solid",
|
4058
4288
|
borderWidth: "1px",
|
4059
4289
|
hasRadius: true,
|
4290
|
+
direction: "column",
|
4291
|
+
alignItems: "stretch",
|
4060
4292
|
children
|
4061
4293
|
}
|
4062
4294
|
);
|
@@ -4067,11 +4299,19 @@ const ExpandWrapper = styled(Flex)`
|
|
4067
4299
|
const BoxWithBorder = styled(Box)`
|
4068
4300
|
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
4069
4301
|
`;
|
4070
|
-
const ExpandButton$1 = styled(
|
4302
|
+
const ExpandButton$1 = styled(Button)`
|
4071
4303
|
background-color: transparent;
|
4072
4304
|
border: none;
|
4073
4305
|
align-items: center;
|
4074
4306
|
|
4307
|
+
& > span {
|
4308
|
+
display: flex;
|
4309
|
+
justify-content: space-between;
|
4310
|
+
align-items: center;
|
4311
|
+
width: 100%;
|
4312
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4313
|
+
}
|
4314
|
+
|
4075
4315
|
svg {
|
4076
4316
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4077
4317
|
|
@@ -4340,8 +4580,6 @@ const quoteAndCodeHandler = (editor, markdownType) => {
|
|
4340
4580
|
};
|
4341
4581
|
const CustomIconButton = styled(IconButton)`
|
4342
4582
|
padding: ${({ theme }) => theme.spaces[2]};
|
4343
|
-
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
4344
|
-
outline-offset: -2px !important;
|
4345
4583
|
|
4346
4584
|
svg {
|
4347
4585
|
width: 1.8rem;
|
@@ -4369,11 +4607,19 @@ const MoreButton = styled(IconButton)`
|
|
4369
4607
|
const IconButtonGroupMargin = styled(IconButtonGroup)`
|
4370
4608
|
margin-right: ${({ theme }) => `${theme.spaces[2]}`};
|
4371
4609
|
`;
|
4372
|
-
const ExpandButton = styled(
|
4610
|
+
const ExpandButton = styled(Button)`
|
4373
4611
|
background-color: transparent;
|
4374
4612
|
border: none;
|
4375
4613
|
align-items: center;
|
4376
4614
|
|
4615
|
+
& > span {
|
4616
|
+
display: flex;
|
4617
|
+
justify-content: space-between;
|
4618
|
+
align-items: center;
|
4619
|
+
width: 100%;
|
4620
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4621
|
+
}
|
4622
|
+
|
4377
4623
|
svg {
|
4378
4624
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4379
4625
|
path {
|
@@ -4385,8 +4631,8 @@ const ExpandButton = styled(BaseButton)`
|
|
4385
4631
|
`;
|
4386
4632
|
const WysiwygFooter = ({ onToggleExpand }) => {
|
4387
4633
|
const { formatMessage } = useIntl();
|
4388
|
-
return /* @__PURE__ */ jsx(Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, children: [
|
4389
|
-
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
4634
|
+
return /* @__PURE__ */ jsx(Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, variant: "tertiary", size: "M", children: [
|
4635
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
|
4390
4636
|
id: "components.WysiwygBottomControls.fullscreen",
|
4391
4637
|
defaultMessage: "Expand"
|
4392
4638
|
}) }),
|
@@ -4408,7 +4654,7 @@ const WysiwygNav = ({
|
|
4408
4654
|
id: "components.Wysiwyg.selectOptions.title",
|
4409
4655
|
defaultMessage: "Add a title"
|
4410
4656
|
});
|
4411
|
-
|
4657
|
+
React.useRef(null);
|
4412
4658
|
const handleTogglePopover = () => {
|
4413
4659
|
setVisiblePopover((prev) => !prev);
|
4414
4660
|
};
|
@@ -4421,21 +4667,30 @@ const WysiwygNav = ({
|
|
4421
4667
|
justifyContent: "space-between",
|
4422
4668
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4423
4669
|
children: [
|
4424
|
-
/* @__PURE__ */ jsxs(
|
4425
|
-
/* @__PURE__ */
|
4426
|
-
|
4427
|
-
|
4428
|
-
|
4429
|
-
|
4430
|
-
|
4431
|
-
|
4432
|
-
|
4670
|
+
/* @__PURE__ */ jsxs(Flex, { children: [
|
4671
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
|
4672
|
+
SingleSelect,
|
4673
|
+
{
|
4674
|
+
disabled: true,
|
4675
|
+
placeholder: selectPlaceholder,
|
4676
|
+
"aria-label": selectPlaceholder,
|
4677
|
+
size: "S",
|
4678
|
+
children: [
|
4679
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
|
4680
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
|
4681
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h3", children: "h3" }),
|
4682
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h4", children: "h4" }),
|
4683
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h5", children: "h5" }),
|
4684
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
|
4685
|
+
]
|
4686
|
+
}
|
4687
|
+
) }),
|
4433
4688
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4434
|
-
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Bold", name: "Bold",
|
4435
|
-
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Italic", name: "Italic",
|
4436
|
-
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Underline", name: "Underline",
|
4689
|
+
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsx(Bold, {}) }),
|
4690
|
+
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsx(Italic, {}) }),
|
4691
|
+
/* @__PURE__ */ jsx(CustomIconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsx(Underline, {}) })
|
4437
4692
|
] }),
|
4438
|
-
/* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More",
|
4693
|
+
/* @__PURE__ */ jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsx(More, {}) })
|
4439
4694
|
] }),
|
4440
4695
|
!isExpandMode && /* @__PURE__ */ jsx(Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
|
4441
4696
|
id: "components.Wysiwyg.ToggleMode.markdown-mode",
|
@@ -4453,14 +4708,14 @@ const WysiwygNav = ({
|
|
4453
4708
|
justifyContent: "space-between",
|
4454
4709
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4455
4710
|
children: [
|
4456
|
-
/* @__PURE__ */ jsxs(
|
4457
|
-
/* @__PURE__ */ jsxs(
|
4711
|
+
/* @__PURE__ */ jsxs(Flex, { children: [
|
4712
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsxs(
|
4458
4713
|
SingleSelect,
|
4459
4714
|
{
|
4460
4715
|
placeholder: selectPlaceholder,
|
4461
|
-
label: selectPlaceholder,
|
4462
|
-
size: "S",
|
4716
|
+
"aria-label": selectPlaceholder,
|
4463
4717
|
onChange: (value) => onActionClick(value, editorRef),
|
4718
|
+
size: "S",
|
4464
4719
|
children: [
|
4465
4720
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h1", children: "h1" }),
|
4466
4721
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h2", children: "h2" }),
|
@@ -4470,7 +4725,7 @@ const WysiwygNav = ({
|
|
4470
4725
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "h6", children: "h6" })
|
4471
4726
|
]
|
4472
4727
|
}
|
4473
|
-
),
|
4728
|
+
) }),
|
4474
4729
|
/* @__PURE__ */ jsxs(MainButtons, { children: [
|
4475
4730
|
/* @__PURE__ */ jsx(
|
4476
4731
|
CustomIconButton,
|
@@ -4478,7 +4733,7 @@ const WysiwygNav = ({
|
|
4478
4733
|
onClick: () => onActionClick("Bold", editorRef),
|
4479
4734
|
label: "Bold",
|
4480
4735
|
name: "Bold",
|
4481
|
-
|
4736
|
+
children: /* @__PURE__ */ jsx(Bold, {})
|
4482
4737
|
}
|
4483
4738
|
),
|
4484
4739
|
/* @__PURE__ */ jsx(
|
@@ -4487,7 +4742,7 @@ const WysiwygNav = ({
|
|
4487
4742
|
onClick: () => onActionClick("Italic", editorRef),
|
4488
4743
|
label: "Italic",
|
4489
4744
|
name: "Italic",
|
4490
|
-
|
4745
|
+
children: /* @__PURE__ */ jsx(Italic, {})
|
4491
4746
|
}
|
4492
4747
|
),
|
4493
4748
|
/* @__PURE__ */ jsx(
|
@@ -4496,91 +4751,85 @@ const WysiwygNav = ({
|
|
4496
4751
|
onClick: () => onActionClick("Underline", editorRef),
|
4497
4752
|
label: "Underline",
|
4498
4753
|
name: "Underline",
|
4499
|
-
|
4754
|
+
children: /* @__PURE__ */ jsx(Underline, {})
|
4500
4755
|
}
|
4501
4756
|
)
|
4502
4757
|
] }),
|
4503
|
-
/* @__PURE__ */
|
4504
|
-
MoreButton,
|
4505
|
-
{
|
4506
|
-
|
4507
|
-
|
4508
|
-
|
4509
|
-
|
4510
|
-
|
4511
|
-
|
4512
|
-
|
4513
|
-
|
4514
|
-
|
4515
|
-
|
4516
|
-
|
4517
|
-
|
4518
|
-
|
4519
|
-
|
4520
|
-
|
4521
|
-
|
4522
|
-
|
4523
|
-
|
4524
|
-
|
4525
|
-
|
4526
|
-
|
4527
|
-
|
4528
|
-
|
4529
|
-
|
4530
|
-
|
4531
|
-
|
4532
|
-
|
4533
|
-
|
4534
|
-
|
4535
|
-
|
4536
|
-
|
4537
|
-
|
4538
|
-
|
4539
|
-
|
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
|
-
name: "Quote",
|
4579
|
-
icon: /* @__PURE__ */ jsx(Quotes, {})
|
4580
|
-
}
|
4581
|
-
)
|
4582
|
-
] })
|
4583
|
-
] }) })
|
4758
|
+
/* @__PURE__ */ jsxs(Popover.Root, { children: [
|
4759
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(MoreButton, { label: "More", children: /* @__PURE__ */ jsx(More, {}) }) }),
|
4760
|
+
/* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
|
4761
|
+
/* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
|
4762
|
+
/* @__PURE__ */ jsx(
|
4763
|
+
CustomIconButton,
|
4764
|
+
{
|
4765
|
+
onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
|
4766
|
+
label: "Strikethrough",
|
4767
|
+
name: "Strikethrough",
|
4768
|
+
children: /* @__PURE__ */ jsx(StrikeThrough, {})
|
4769
|
+
}
|
4770
|
+
),
|
4771
|
+
/* @__PURE__ */ jsx(
|
4772
|
+
CustomIconButton,
|
4773
|
+
{
|
4774
|
+
onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
|
4775
|
+
label: "BulletList",
|
4776
|
+
name: "BulletList",
|
4777
|
+
children: /* @__PURE__ */ jsx(BulletList, {})
|
4778
|
+
}
|
4779
|
+
),
|
4780
|
+
/* @__PURE__ */ jsx(
|
4781
|
+
CustomIconButton,
|
4782
|
+
{
|
4783
|
+
onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
|
4784
|
+
label: "NumberList",
|
4785
|
+
name: "NumberList",
|
4786
|
+
children: /* @__PURE__ */ jsx(NumberList, {})
|
4787
|
+
}
|
4788
|
+
)
|
4789
|
+
] }),
|
4790
|
+
/* @__PURE__ */ jsxs(IconButtonGroup, { children: [
|
4791
|
+
/* @__PURE__ */ jsx(
|
4792
|
+
CustomIconButton,
|
4793
|
+
{
|
4794
|
+
onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
|
4795
|
+
label: "Code",
|
4796
|
+
name: "Code",
|
4797
|
+
children: /* @__PURE__ */ jsx(Code, {})
|
4798
|
+
}
|
4799
|
+
),
|
4800
|
+
/* @__PURE__ */ jsx(
|
4801
|
+
CustomIconButton,
|
4802
|
+
{
|
4803
|
+
onClick: () => {
|
4804
|
+
handleTogglePopover();
|
4805
|
+
onToggleMediaLib();
|
4806
|
+
},
|
4807
|
+
label: "Image",
|
4808
|
+
name: "Image",
|
4809
|
+
children: /* @__PURE__ */ jsx(Image$1, {})
|
4810
|
+
}
|
4811
|
+
),
|
4812
|
+
/* @__PURE__ */ jsx(
|
4813
|
+
CustomLinkIconButton,
|
4814
|
+
{
|
4815
|
+
onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
|
4816
|
+
label: "Link",
|
4817
|
+
name: "Link",
|
4818
|
+
children: /* @__PURE__ */ jsx(Link$1, {})
|
4819
|
+
}
|
4820
|
+
),
|
4821
|
+
/* @__PURE__ */ jsx(
|
4822
|
+
CustomIconButton,
|
4823
|
+
{
|
4824
|
+
onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
|
4825
|
+
label: "Quote",
|
4826
|
+
name: "Quote",
|
4827
|
+
children: /* @__PURE__ */ jsx(Quotes, {})
|
4828
|
+
}
|
4829
|
+
)
|
4830
|
+
] })
|
4831
|
+
] }) })
|
4832
|
+
] })
|
4584
4833
|
] }),
|
4585
4834
|
onTogglePreviewMode && /* @__PURE__ */ jsx(Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
|
4586
4835
|
id: "components.Wysiwyg.ToggleMode.preview-mode",
|
@@ -4590,19 +4839,6 @@ const WysiwygNav = ({
|
|
4590
4839
|
}
|
4591
4840
|
);
|
4592
4841
|
};
|
4593
|
-
const StyledFlex = styled(Flex)`
|
4594
|
-
/* Hide the label, every input needs a label. */
|
4595
|
-
label {
|
4596
|
-
border: 0;
|
4597
|
-
clip: rect(0 0 0 0);
|
4598
|
-
height: 1px;
|
4599
|
-
margin: -1px;
|
4600
|
-
overflow: hidden;
|
4601
|
-
padding: 0;
|
4602
|
-
position: absolute;
|
4603
|
-
width: 1px;
|
4604
|
-
}
|
4605
|
-
`;
|
4606
4842
|
const Wysiwyg = React.forwardRef(
|
4607
4843
|
({ hint, disabled, label, name: name2, placeholder, required, labelAction }, forwardedRef) => {
|
4608
4844
|
const field = useField(name2);
|
@@ -4667,9 +4903,9 @@ const Wysiwyg = React.forwardRef(
|
|
4667
4903
|
insertFile(editorRef, formattedFiles);
|
4668
4904
|
setMediaLibVisible(false);
|
4669
4905
|
};
|
4670
|
-
return /* @__PURE__ */ jsxs(Field, { name: name2, hint, error: field.error, required, children: [
|
4906
|
+
return /* @__PURE__ */ jsxs(Field.Root, { name: name2, hint, error: field.error, required, children: [
|
4671
4907
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
4672
|
-
/* @__PURE__ */ jsx(
|
4908
|
+
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
4673
4909
|
/* @__PURE__ */ jsxs(
|
4674
4910
|
EditorLayout,
|
4675
4911
|
{
|
@@ -4710,14 +4946,15 @@ const Wysiwyg = React.forwardRef(
|
|
4710
4946
|
]
|
4711
4947
|
}
|
4712
4948
|
),
|
4713
|
-
/* @__PURE__ */ jsx(
|
4714
|
-
/* @__PURE__ */ jsx(
|
4949
|
+
/* @__PURE__ */ jsx(Field.Hint, {}),
|
4950
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
4715
4951
|
] }),
|
4716
4952
|
mediaLibVisible && // @ts-expect-error – TODO: fix this way of injecting because it's not really typeable without a registry.
|
4717
4953
|
/* @__PURE__ */ jsx(MediaLibraryDialog, { onClose: handleToggleMediaLib, onSelectAssets: handleSelectAssets })
|
4718
4954
|
] });
|
4719
4955
|
}
|
4720
4956
|
);
|
4957
|
+
const MemoizedWysiwyg = React.memo(Wysiwyg);
|
4721
4958
|
const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
4722
4959
|
const { id } = useDoc();
|
4723
4960
|
const isFormDisabled = useForm("InputRenderer", (state) => state.disabled);
|
@@ -4767,10 +5004,10 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4767
5004
|
}
|
4768
5005
|
switch (props.type) {
|
4769
5006
|
case "blocks":
|
4770
|
-
return /* @__PURE__ */ jsx(
|
5007
|
+
return /* @__PURE__ */ jsx(MemoizedBlocksInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4771
5008
|
case "component":
|
4772
5009
|
return /* @__PURE__ */ jsx(
|
4773
|
-
|
5010
|
+
MemoizedComponentInput,
|
4774
5011
|
{
|
4775
5012
|
...props,
|
4776
5013
|
hint,
|
@@ -4782,11 +5019,11 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4782
5019
|
case "dynamiczone":
|
4783
5020
|
return /* @__PURE__ */ jsx(DynamicZone, { ...props, hint, disabled: fieldIsDisabled });
|
4784
5021
|
case "relation":
|
4785
|
-
return /* @__PURE__ */ jsx(
|
5022
|
+
return /* @__PURE__ */ jsx(MemoizedRelationsField, { ...props, hint, disabled: fieldIsDisabled });
|
4786
5023
|
case "richtext":
|
4787
|
-
return /* @__PURE__ */ jsx(
|
5024
|
+
return /* @__PURE__ */ jsx(MemoizedWysiwyg, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4788
5025
|
case "uid":
|
4789
|
-
return /* @__PURE__ */ jsx(
|
5026
|
+
return /* @__PURE__ */ jsx(MemoizedUIDInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4790
5027
|
case "enumeration":
|
4791
5028
|
return /* @__PURE__ */ jsx(
|
4792
5029
|
InputRenderer$1,
|
@@ -4818,7 +5055,9 @@ const useFieldHint = (hint = void 0, attribute) => {
|
|
4818
5055
|
if (!maximum && !minimum) {
|
4819
5056
|
return hint;
|
4820
5057
|
}
|
4821
|
-
const units = !["biginteger", "integer", "number"].includes(
|
5058
|
+
const units = !["biginteger", "integer", "number", "dynamiczone", "component"].includes(
|
5059
|
+
attribute.type
|
5060
|
+
) ? formatMessage(
|
4822
5061
|
{
|
4823
5062
|
id: "content-manager.form.Input.hint.character.unit",
|
4824
5063
|
defaultMessage: "{maxValue, plural, one { character} other { characters}}"
|
@@ -4858,6 +5097,7 @@ const getMinMax = (attribute) => {
|
|
4858
5097
|
return { maximum: void 0, minimum: void 0 };
|
4859
5098
|
}
|
4860
5099
|
};
|
5100
|
+
const MemoizedInputRenderer = memo(InputRenderer);
|
4861
5101
|
const DynamicComponent = ({
|
4862
5102
|
componentUid,
|
4863
5103
|
disabled,
|
@@ -4871,7 +5111,6 @@ const DynamicComponent = ({
|
|
4871
5111
|
dynamicComponentsByCategory = {},
|
4872
5112
|
onAddComponent
|
4873
5113
|
}) => {
|
4874
|
-
const [isOpen, setIsOpen] = React.useState(true);
|
4875
5114
|
const { formatMessage } = useIntl();
|
4876
5115
|
const formValues = useForm("DynamicComponent", (state) => state.values);
|
4877
5116
|
const {
|
@@ -4880,7 +5119,7 @@ const DynamicComponent = ({
|
|
4880
5119
|
const title = React.useMemo(() => {
|
4881
5120
|
const { mainField } = components[componentUid]?.settings ?? { mainField: "id" };
|
4882
5121
|
const mainFieldValue = getIn(formValues, `${name2}.${index}.${mainField}`);
|
4883
|
-
const displayedValue = mainField === "id" ? "" : String(mainFieldValue).trim();
|
5122
|
+
const displayedValue = mainField === "id" || !mainFieldValue ? "" : String(mainFieldValue).trim();
|
4884
5123
|
const mainValue = displayedValue.length > 0 ? `- ${displayedValue}` : displayedValue;
|
4885
5124
|
return mainValue;
|
4886
5125
|
}, [componentUid, components, formValues, name2, index]);
|
@@ -4891,9 +5130,6 @@ const DynamicComponent = ({
|
|
4891
5130
|
) ?? { icon: null, displayName: null };
|
4892
5131
|
return { icon: icon2, displayName: displayName2 };
|
4893
5132
|
}, [componentUid, dynamicComponentsByCategory]);
|
4894
|
-
const handleToggle = () => {
|
4895
|
-
setIsOpen((s) => !s);
|
4896
|
-
};
|
4897
5133
|
const [{ handlerId, isDragging, handleKeyDown }, boxRef, dropRef, dragRef, dragPreviewRef] = useDragAndDrop(!disabled, {
|
4898
5134
|
type: `${ItemTypes.DYNAMIC_ZONE}_${name2}`,
|
4899
5135
|
index,
|
@@ -4911,11 +5147,11 @@ const DynamicComponent = ({
|
|
4911
5147
|
dragPreviewRef(getEmptyImage(), { captureDraggingState: false });
|
4912
5148
|
}, [dragPreviewRef, index]);
|
4913
5149
|
const composedBoxRefs = useComposedRefs(boxRef, dropRef);
|
4914
|
-
const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(
|
5150
|
+
const accordionActions = disabled ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
4915
5151
|
/* @__PURE__ */ jsx(
|
4916
|
-
|
5152
|
+
IconButton,
|
4917
5153
|
{
|
4918
|
-
|
5154
|
+
variant: "ghost",
|
4919
5155
|
label: formatMessage(
|
4920
5156
|
{
|
4921
5157
|
id: getTranslation("components.DynamicZone.delete-label"),
|
@@ -4930,10 +5166,7 @@ const DynamicComponent = ({
|
|
4930
5166
|
/* @__PURE__ */ jsx(
|
4931
5167
|
IconButton,
|
4932
5168
|
{
|
4933
|
-
|
4934
|
-
role: "button",
|
4935
|
-
borderWidth: 0,
|
4936
|
-
tabIndex: 0,
|
5169
|
+
variant: "ghost",
|
4937
5170
|
onClick: (e) => e.stopPropagation(),
|
4938
5171
|
"data-handler-id": handlerId,
|
4939
5172
|
ref: dragRef,
|
@@ -4948,7 +5181,7 @@ const DynamicComponent = ({
|
|
4948
5181
|
/* @__PURE__ */ jsxs(Menu.Root, { children: [
|
4949
5182
|
/* @__PURE__ */ jsxs(Menu.Trigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
|
4950
5183
|
/* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
|
4951
|
-
/* @__PURE__ */ jsx(VisuallyHidden, {
|
5184
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children: formatMessage({
|
4952
5185
|
id: getTranslation("components.DynamicZone.more-actions"),
|
4953
5186
|
defaultMessage: "More actions"
|
4954
5187
|
}) })
|
@@ -4977,42 +5210,39 @@ const DynamicComponent = ({
|
|
4977
5210
|
] })
|
4978
5211
|
] })
|
4979
5212
|
] });
|
4980
|
-
|
5213
|
+
const accordionTitle = title ? `${displayName} ${title}` : displayName;
|
5214
|
+
const accordionValue = React.useId();
|
5215
|
+
return /* @__PURE__ */ jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
|
4981
5216
|
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Rectangle, { background: "neutral200" }) }),
|
4982
|
-
/* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */
|
4983
|
-
/* @__PURE__ */
|
4984
|
-
|
4985
|
-
|
4986
|
-
|
4987
|
-
|
4988
|
-
|
4989
|
-
|
4990
|
-
|
4991
|
-
|
4992
|
-
|
5217
|
+
/* @__PURE__ */ jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsx(Preview, {}) : /* @__PURE__ */ jsx(Accordion.Root, { children: /* @__PURE__ */ jsxs(Accordion.Item, { value: accordionValue, children: [
|
5218
|
+
/* @__PURE__ */ jsxs(Accordion.Header, { children: [
|
5219
|
+
/* @__PURE__ */ jsx(
|
5220
|
+
Accordion.Trigger,
|
5221
|
+
{
|
5222
|
+
icon: icon && COMPONENT_ICONS[icon] ? COMPONENT_ICONS[icon] : COMPONENT_ICONS.dashboard,
|
5223
|
+
children: accordionTitle
|
5224
|
+
}
|
5225
|
+
),
|
5226
|
+
/* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
|
5227
|
+
] }),
|
5228
|
+
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
4993
5229
|
const fieldName = `${name2}.${index}.${field.name}`;
|
4994
|
-
return /* @__PURE__ */ jsx(
|
5230
|
+
return /* @__PURE__ */ jsx(
|
5231
|
+
Grid$1.Item,
|
5232
|
+
{
|
5233
|
+
col: size,
|
5234
|
+
s: 12,
|
5235
|
+
xs: 12,
|
5236
|
+
direction: "column",
|
5237
|
+
alignItems: "stretch",
|
5238
|
+
children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field, name: fieldName })
|
5239
|
+
},
|
5240
|
+
fieldName
|
5241
|
+
);
|
4995
5242
|
}) }, rowInd)) }) }) })
|
4996
|
-
] }) })
|
5243
|
+
] }) }) })
|
4997
5244
|
] });
|
4998
5245
|
};
|
4999
|
-
const ActionsFlex = styled(Flex)`
|
5000
|
-
/*
|
5001
|
-
we need to remove the background from the button but we can't
|
5002
|
-
wrap the element in styled because it breaks the forwardedAs which
|
5003
|
-
we need for drag handler to work on firefox
|
5004
|
-
*/
|
5005
|
-
div[role='button'] {
|
5006
|
-
background: transparent;
|
5007
|
-
}
|
5008
|
-
`;
|
5009
|
-
const IconButtonCustom = styled(IconButton)`
|
5010
|
-
background-color: transparent;
|
5011
|
-
|
5012
|
-
svg path {
|
5013
|
-
fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : theme.colors.neutral600};
|
5014
|
-
}
|
5015
|
-
`;
|
5016
5246
|
const StyledBox = styled(Box)`
|
5017
5247
|
> div:first-child {
|
5018
5248
|
box-shadow: ${({ theme }) => theme.shadows.tableShadow};
|
@@ -5083,7 +5313,7 @@ const [DynamicZoneProvider, useDynamicZone] = createContext(
|
|
5083
5313
|
);
|
5084
5314
|
const DynamicZone = ({
|
5085
5315
|
attribute,
|
5086
|
-
disabled,
|
5316
|
+
disabled: disabledProp,
|
5087
5317
|
hint,
|
5088
5318
|
label,
|
5089
5319
|
labelAction,
|
@@ -5093,7 +5323,8 @@ const DynamicZone = ({
|
|
5093
5323
|
const { max = Infinity, min = -Infinity } = attribute ?? {};
|
5094
5324
|
const [addComponentIsOpen, setAddComponentIsOpen] = React.useState(false);
|
5095
5325
|
const [liveText, setLiveText] = React.useState("");
|
5096
|
-
const { components } = useDoc();
|
5326
|
+
const { components, isLoading } = useDoc();
|
5327
|
+
const disabled = disabledProp || isLoading;
|
5097
5328
|
const { addFieldRow, removeFieldRow, moveFieldRow } = useForm(
|
5098
5329
|
"DynamicZone",
|
5099
5330
|
({ addFieldRow: addFieldRow2, removeFieldRow: removeFieldRow2, moveFieldRow: moveFieldRow2 }) => ({
|
@@ -5200,7 +5431,7 @@ const DynamicZone = ({
|
|
5200
5431
|
const handleRemoveComponent = (name22, currentIndex) => () => {
|
5201
5432
|
removeFieldRow(name22, currentIndex);
|
5202
5433
|
};
|
5203
|
-
const hasError = error !== void 0
|
5434
|
+
const hasError = error !== void 0;
|
5204
5435
|
const renderButtonLabel = () => {
|
5205
5436
|
if (addComponentIsOpen) {
|
5206
5437
|
return formatMessage({ id: "app.utils.close-label", defaultMessage: "Close" });
|
@@ -5301,19 +5532,19 @@ const DynamicZone = ({
|
|
5301
5532
|
] }) });
|
5302
5533
|
};
|
5303
5534
|
export {
|
5304
|
-
BlocksInput as B,
|
5305
|
-
ComponentInput as C,
|
5306
5535
|
DynamicZone as D,
|
5307
|
-
|
5536
|
+
MemoizedInputRenderer as M,
|
5308
5537
|
NotAllowedInput as N,
|
5309
|
-
UIDInput as U,
|
5310
|
-
Wysiwyg as W,
|
5311
5538
|
useDynamicZone as a,
|
5312
5539
|
useFieldHint as b,
|
5313
5540
|
createDefaultForm as c,
|
5541
|
+
MemoizedUIDInput as d,
|
5542
|
+
MemoizedWysiwyg as e,
|
5543
|
+
MemoizedComponentInput as f,
|
5544
|
+
MemoizedBlocksInput as g,
|
5314
5545
|
prepareTempKeys as p,
|
5315
5546
|
removeFieldsThatDontExistOnSchema as r,
|
5316
5547
|
transformDocument as t,
|
5317
5548
|
useLazyComponents as u
|
5318
5549
|
};
|
5319
|
-
//# sourceMappingURL=Field-
|
5550
|
+
//# sourceMappingURL=Field-tHCw4lGA.mjs.map
|