@strapi/content-manager 0.0.0-experimental.17b4116f461a49b8ce5386f7c8d79c511d40fb3b → 0.0.0-experimental.2a7cb5ff33df35e8ccde5ef918f9f9a4a3ee9a08
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-2iOVVhqV.js → ComponentConfigurationPage-BvHtG7uH.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-2iOVVhqV.js.map → ComponentConfigurationPage-BvHtG7uH.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DjQBdcKF.mjs → ComponentConfigurationPage-DHNM3YBz.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DjQBdcKF.mjs.map → ComponentConfigurationPage-DHNM3YBz.mjs.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-BoBb-DLH.mjs → EditConfigurationPage-Cp6HAEzN.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BoBb-DLH.mjs.map → EditConfigurationPage-Cp6HAEzN.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-B7dw5_cS.js → EditConfigurationPage-DOmfCEMo.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-B7dw5_cS.js.map → EditConfigurationPage-DOmfCEMo.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-KRG56aCq.js → EditViewPage-BqNpC6hO.js} +46 -48
- package/dist/_chunks/EditViewPage-BqNpC6hO.js.map +1 -0
- package/dist/_chunks/{EditViewPage-aUnqL-63.mjs → EditViewPage-BtkEx339.mjs} +47 -47
- package/dist/_chunks/EditViewPage-BtkEx339.mjs.map +1 -0
- package/dist/_chunks/{Field-kVFO4ZKB.mjs → Field-R5NbffTB.mjs} +854 -707
- package/dist/_chunks/Field-R5NbffTB.mjs.map +1 -0
- package/dist/_chunks/{Field-kq1c2TF1.js → Field-lsPFnAmH.js} +906 -760
- package/dist/_chunks/Field-lsPFnAmH.js.map +1 -0
- package/dist/_chunks/{Form-Jgh5hGTu.mjs → Form-BHmXSfyy.mjs} +39 -37
- package/dist/_chunks/Form-BHmXSfyy.mjs.map +1 -0
- package/dist/_chunks/{Form-CQ67ZifP.js → Form-CcGboku8.js} +39 -38
- package/dist/_chunks/Form-CcGboku8.js.map +1 -0
- package/dist/_chunks/{History-BLEnudTX.js → History-Bsud8jwh.js} +138 -51
- package/dist/_chunks/History-Bsud8jwh.js.map +1 -0
- package/dist/_chunks/{History-DKhZAPcK.mjs → History-ByUPL3T3.mjs} +137 -49
- package/dist/_chunks/History-ByUPL3T3.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-nrXcxNYi.mjs → ListConfigurationPage-Bm5HACXf.mjs} +49 -51
- package/dist/_chunks/ListConfigurationPage-Bm5HACXf.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-Zso_LUjn.js → ListConfigurationPage-DiT463qx.js} +53 -56
- package/dist/_chunks/ListConfigurationPage-DiT463qx.js.map +1 -0
- package/dist/_chunks/{ListViewPage-DsaOakWQ.js → ListViewPage-CsrC9L_d.js} +92 -108
- package/dist/_chunks/ListViewPage-CsrC9L_d.js.map +1 -0
- package/dist/_chunks/{ListViewPage-ChhYmA-L.mjs → ListViewPage-JSyNAAYu.mjs} +87 -103
- package/dist/_chunks/ListViewPage-JSyNAAYu.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DPCuS9Y1.js → NoContentTypePage-Bsvng4II.js} +3 -3
- package/dist/_chunks/NoContentTypePage-Bsvng4II.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-BrdFcN33.mjs → NoContentTypePage-CsrQUpBE.mjs} +3 -3
- package/dist/_chunks/NoContentTypePage-CsrQUpBE.mjs.map +1 -0
- package/dist/_chunks/{NoPermissionsPage-DdyOfdKb.js → NoPermissionsPage-CdHNJtEf.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DdyOfdKb.js.map → NoPermissionsPage-CdHNJtEf.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-B9dqrtTy.mjs → NoPermissionsPage-DNmf_pj0.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-B9dqrtTy.mjs.map → NoPermissionsPage-DNmf_pj0.mjs.map} +1 -1
- package/dist/_chunks/{Relations-CY8Isqdu.js → Relations-CghaPv2D.js} +70 -61
- package/dist/_chunks/Relations-CghaPv2D.js.map +1 -0
- package/dist/_chunks/{Relations-DjFiYd7-.mjs → Relations-u8-37jK0.mjs} +66 -56
- package/dist/_chunks/Relations-u8-37jK0.mjs.map +1 -0
- package/dist/_chunks/{en-MBPul9Su.mjs → en-Ux26r5pl.mjs} +7 -1
- package/dist/_chunks/{en-MBPul9Su.mjs.map → en-Ux26r5pl.mjs.map} +1 -1
- package/dist/_chunks/{en-C-V1_90f.js → en-fbKQxLGn.js} +7 -1
- package/dist/_chunks/{en-C-V1_90f.js.map → en-fbKQxLGn.js.map} +1 -1
- package/dist/_chunks/{index-DNa1J4HE.js → index-BOZx6IMg.js} +1481 -864
- package/dist/_chunks/index-BOZx6IMg.js.map +1 -0
- package/dist/_chunks/{index-CAc9yTnx.mjs → index-CaE6NG4a.mjs} +1450 -832
- package/dist/_chunks/index-CaE6NG4a.mjs.map +1 -0
- package/dist/_chunks/{layout-CXsHbc3E.mjs → layout-Bx7svTbY.mjs} +28 -23
- package/dist/_chunks/layout-Bx7svTbY.mjs.map +1 -0
- package/dist/_chunks/{layout-BqtLA6Lb.js → layout-Ciz224q5.js} +29 -26
- package/dist/_chunks/layout-Ciz224q5.js.map +1 -0
- package/dist/_chunks/{relations-BHY_KDJ_.js → relations-CP8sB2YZ.js} +2 -2
- package/dist/_chunks/{relations-BHY_KDJ_.js.map → relations-CP8sB2YZ.js.map} +1 -1
- package/dist/_chunks/{relations-mMFEcZRq.mjs → relations-Cxc1cEv3.mjs} +2 -2
- package/dist/_chunks/{relations-mMFEcZRq.mjs.map → relations-Cxc1cEv3.mjs.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/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/pages/EditView/components/DocumentActions.d.ts +10 -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 +10 -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/WysiwygStyles.d.ts +59 -52
- 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 +293 -203
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +295 -205
- 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/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 +9 -0
- package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/index.d.ts +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +17 -33
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts +11 -6
- 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 +17 -33
- 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-KRG56aCq.js.map +0 -1
- package/dist/_chunks/EditViewPage-aUnqL-63.mjs.map +0 -1
- package/dist/_chunks/Field-kVFO4ZKB.mjs.map +0 -1
- package/dist/_chunks/Field-kq1c2TF1.js.map +0 -1
- package/dist/_chunks/Form-CQ67ZifP.js.map +0 -1
- package/dist/_chunks/Form-Jgh5hGTu.mjs.map +0 -1
- package/dist/_chunks/History-BLEnudTX.js.map +0 -1
- package/dist/_chunks/History-DKhZAPcK.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-Zso_LUjn.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-nrXcxNYi.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-ChhYmA-L.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-DsaOakWQ.js.map +0 -1
- package/dist/_chunks/NoContentTypePage-BrdFcN33.mjs.map +0 -1
- package/dist/_chunks/NoContentTypePage-DPCuS9Y1.js.map +0 -1
- package/dist/_chunks/Relations-CY8Isqdu.js.map +0 -1
- package/dist/_chunks/Relations-DjFiYd7-.mjs.map +0 -1
- package/dist/_chunks/index-CAc9yTnx.mjs.map +0 -1
- package/dist/_chunks/index-DNa1J4HE.js.map +0 -1
- package/dist/_chunks/layout-BqtLA6Lb.js.map +0 -1
- package/dist/_chunks/layout-CXsHbc3E.mjs.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
@@ -5,19 +5,19 @@ const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
5
5
|
const designSystem = require("@strapi/design-system");
|
6
6
|
const pipe$1 = require("lodash/fp/pipe");
|
7
7
|
const reactIntl = require("react-intl");
|
8
|
-
const index = require("./index-
|
8
|
+
const index = require("./index-BOZx6IMg.js");
|
9
9
|
const fractionalIndexing = require("fractional-indexing");
|
10
|
-
const Relations = require("./Relations-
|
10
|
+
const Relations = require("./Relations-CghaPv2D.js");
|
11
11
|
const Icons = require("@strapi/icons");
|
12
|
-
const
|
13
|
-
const ComponentIcon = require("./ComponentIcon-
|
12
|
+
const styledComponents = require("styled-components");
|
13
|
+
const ComponentIcon = require("./ComponentIcon-BXdiCGQp.js");
|
14
14
|
const reactDndHtml5Backend = require("react-dnd-html5-backend");
|
15
15
|
const useDragAndDrop = require("./useDragAndDrop-J0TUUbR6.js");
|
16
16
|
const objects = require("./objects-gigeqt7s.js");
|
17
17
|
const slate = require("slate");
|
18
18
|
const slateHistory = require("slate-history");
|
19
19
|
const slateReact = require("slate-react");
|
20
|
-
const
|
20
|
+
const usePrev = require("./usePrev-B9w_-eYc.js");
|
21
21
|
const Toolbar = require("@radix-ui/react-toolbar");
|
22
22
|
const reactRouterDom = require("react-router-dom");
|
23
23
|
const CodeMirror = require("codemirror5");
|
@@ -56,7 +56,6 @@ function _interopNamespace(e) {
|
|
56
56
|
}
|
57
57
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
58
58
|
const pipe__default = /* @__PURE__ */ _interopDefault(pipe$1);
|
59
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
60
59
|
const Toolbar__namespace = /* @__PURE__ */ _interopNamespace(Toolbar);
|
61
60
|
const CodeMirror__default = /* @__PURE__ */ _interopDefault(CodeMirror);
|
62
61
|
const sanitizeHtml__default = /* @__PURE__ */ _interopDefault(sanitizeHtml);
|
@@ -195,6 +194,220 @@ const useLazyComponents = (componentUids = []) => {
|
|
195
194
|
}, []);
|
196
195
|
return { isLazyLoading: loading, lazyComponentStore, cleanup };
|
197
196
|
};
|
197
|
+
const codeLanguages = [
|
198
|
+
{
|
199
|
+
value: "asm",
|
200
|
+
label: "Assembly"
|
201
|
+
},
|
202
|
+
{
|
203
|
+
value: "bash",
|
204
|
+
label: "Bash"
|
205
|
+
},
|
206
|
+
{
|
207
|
+
value: "c",
|
208
|
+
label: "C"
|
209
|
+
},
|
210
|
+
{
|
211
|
+
value: "clojure",
|
212
|
+
label: "Clojure"
|
213
|
+
},
|
214
|
+
{
|
215
|
+
value: "cobol",
|
216
|
+
label: "COBOL"
|
217
|
+
},
|
218
|
+
{
|
219
|
+
value: "cpp",
|
220
|
+
label: "C++"
|
221
|
+
},
|
222
|
+
{
|
223
|
+
value: "csharp",
|
224
|
+
label: "C#"
|
225
|
+
},
|
226
|
+
{
|
227
|
+
value: "css",
|
228
|
+
label: "CSS"
|
229
|
+
},
|
230
|
+
{
|
231
|
+
value: "dart",
|
232
|
+
label: "Dart"
|
233
|
+
},
|
234
|
+
{
|
235
|
+
value: "dockerfile",
|
236
|
+
label: "Dockerfile"
|
237
|
+
},
|
238
|
+
{
|
239
|
+
value: "elixir",
|
240
|
+
label: "Elixir"
|
241
|
+
},
|
242
|
+
{
|
243
|
+
value: "erlang",
|
244
|
+
label: "Erlang"
|
245
|
+
},
|
246
|
+
{
|
247
|
+
value: "fortran",
|
248
|
+
label: "Fortran"
|
249
|
+
},
|
250
|
+
{
|
251
|
+
value: "fsharp",
|
252
|
+
label: "F#"
|
253
|
+
},
|
254
|
+
{
|
255
|
+
value: "go",
|
256
|
+
label: "Go"
|
257
|
+
},
|
258
|
+
{
|
259
|
+
value: "graphql",
|
260
|
+
label: "GraphQL"
|
261
|
+
},
|
262
|
+
{
|
263
|
+
value: "groovy",
|
264
|
+
label: "Groovy"
|
265
|
+
},
|
266
|
+
{
|
267
|
+
value: "haskell",
|
268
|
+
label: "Haskell"
|
269
|
+
},
|
270
|
+
{
|
271
|
+
value: "haxe",
|
272
|
+
label: "Haxe"
|
273
|
+
},
|
274
|
+
{
|
275
|
+
value: "html",
|
276
|
+
label: "HTML"
|
277
|
+
},
|
278
|
+
{
|
279
|
+
value: "ini",
|
280
|
+
label: "INI"
|
281
|
+
},
|
282
|
+
{
|
283
|
+
value: "java",
|
284
|
+
label: "Java"
|
285
|
+
},
|
286
|
+
{
|
287
|
+
value: "javascript",
|
288
|
+
label: "JavaScript"
|
289
|
+
},
|
290
|
+
{
|
291
|
+
value: "jsx",
|
292
|
+
label: "JavaScript (React)"
|
293
|
+
},
|
294
|
+
{
|
295
|
+
value: "json",
|
296
|
+
label: "JSON"
|
297
|
+
},
|
298
|
+
{
|
299
|
+
value: "julia",
|
300
|
+
label: "Julia"
|
301
|
+
},
|
302
|
+
{
|
303
|
+
value: "kotlin",
|
304
|
+
label: "Kotlin"
|
305
|
+
},
|
306
|
+
{
|
307
|
+
value: "latex",
|
308
|
+
label: "LaTeX"
|
309
|
+
},
|
310
|
+
{
|
311
|
+
value: "lua",
|
312
|
+
label: "Lua"
|
313
|
+
},
|
314
|
+
{
|
315
|
+
value: "markdown",
|
316
|
+
label: "Markdown"
|
317
|
+
},
|
318
|
+
{
|
319
|
+
value: "matlab",
|
320
|
+
label: "MATLAB"
|
321
|
+
},
|
322
|
+
{
|
323
|
+
value: "makefile",
|
324
|
+
label: "Makefile"
|
325
|
+
},
|
326
|
+
{
|
327
|
+
value: "objectivec",
|
328
|
+
label: "Objective-C"
|
329
|
+
},
|
330
|
+
{
|
331
|
+
value: "perl",
|
332
|
+
label: "Perl"
|
333
|
+
},
|
334
|
+
{
|
335
|
+
value: "php",
|
336
|
+
label: "PHP"
|
337
|
+
},
|
338
|
+
{
|
339
|
+
value: "plaintext",
|
340
|
+
label: "Plain text"
|
341
|
+
},
|
342
|
+
{
|
343
|
+
value: "powershell",
|
344
|
+
label: "PowerShell"
|
345
|
+
},
|
346
|
+
{
|
347
|
+
value: "python",
|
348
|
+
label: "Python"
|
349
|
+
},
|
350
|
+
{
|
351
|
+
value: "r",
|
352
|
+
label: "R"
|
353
|
+
},
|
354
|
+
{
|
355
|
+
value: "ruby",
|
356
|
+
label: "Ruby"
|
357
|
+
},
|
358
|
+
{
|
359
|
+
value: "rust",
|
360
|
+
label: "Rust"
|
361
|
+
},
|
362
|
+
{
|
363
|
+
value: "sas",
|
364
|
+
label: "SAS"
|
365
|
+
},
|
366
|
+
{
|
367
|
+
value: "scala",
|
368
|
+
label: "Scala"
|
369
|
+
},
|
370
|
+
{
|
371
|
+
value: "scheme",
|
372
|
+
label: "Scheme"
|
373
|
+
},
|
374
|
+
{
|
375
|
+
value: "shell",
|
376
|
+
label: "Shell"
|
377
|
+
},
|
378
|
+
{
|
379
|
+
value: "sql",
|
380
|
+
label: "SQL"
|
381
|
+
},
|
382
|
+
{
|
383
|
+
value: "stata",
|
384
|
+
label: "Stata"
|
385
|
+
},
|
386
|
+
{
|
387
|
+
value: "swift",
|
388
|
+
label: "Swift"
|
389
|
+
},
|
390
|
+
{
|
391
|
+
value: "typescript",
|
392
|
+
label: "TypeScript"
|
393
|
+
},
|
394
|
+
{
|
395
|
+
value: "tsx",
|
396
|
+
label: "TypeScript (React)"
|
397
|
+
},
|
398
|
+
{
|
399
|
+
value: "vbnet",
|
400
|
+
label: "VB.NET"
|
401
|
+
},
|
402
|
+
{
|
403
|
+
value: "xml",
|
404
|
+
label: "XML"
|
405
|
+
},
|
406
|
+
{
|
407
|
+
value: "yaml",
|
408
|
+
label: "YAML"
|
409
|
+
}
|
410
|
+
];
|
198
411
|
const baseHandleConvert = (editor, attributesToSet) => {
|
199
412
|
const [_, lastNodePath] = slate.Editor.last(editor, []);
|
200
413
|
slate.Transforms.unwrapNodes(editor, {
|
@@ -258,13 +471,14 @@ const pressEnterTwiceToExit = (editor) => {
|
|
258
471
|
});
|
259
472
|
}
|
260
473
|
};
|
261
|
-
const CodeBlock =
|
474
|
+
const CodeBlock = styledComponents.styled.pre`
|
262
475
|
border-radius: ${({ theme }) => theme.borderRadius};
|
263
476
|
background-color: ${({ theme }) => theme.colors.neutral100};
|
264
477
|
max-width: 100%;
|
265
478
|
overflow: auto;
|
266
479
|
padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
|
267
480
|
flex-shrink: 1;
|
481
|
+
|
268
482
|
& > code {
|
269
483
|
font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
|
270
484
|
monospace;
|
@@ -273,9 +487,61 @@ const CodeBlock = styled__default.default.pre.attrs({ role: "code" })`
|
|
273
487
|
max-width: 100%;
|
274
488
|
}
|
275
489
|
`;
|
490
|
+
const CodeEditor = (props) => {
|
491
|
+
const { editor } = useBlocksEditorContext("ImageDialog");
|
492
|
+
const editorIsFocused = slateReact.useFocused();
|
493
|
+
const imageIsSelected = slateReact.useSelected();
|
494
|
+
const { formatMessage } = reactIntl.useIntl();
|
495
|
+
const [isSelectOpen, setIsSelectOpen] = React__namespace.useState(false);
|
496
|
+
const shouldDisplayLanguageSelect = editorIsFocused && imageIsSelected || isSelectOpen;
|
497
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { position: "relative", width: "100%", children: [
|
498
|
+
/* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: props.children }) }),
|
499
|
+
shouldDisplayLanguageSelect && /* @__PURE__ */ jsxRuntime.jsx(
|
500
|
+
designSystem.Box,
|
501
|
+
{
|
502
|
+
position: "absolute",
|
503
|
+
background: "neutral0",
|
504
|
+
borderColor: "neutral150",
|
505
|
+
borderStyle: "solid",
|
506
|
+
borderWidth: "0.5px",
|
507
|
+
shadow: "tableShadow",
|
508
|
+
top: "100%",
|
509
|
+
marginTop: 1,
|
510
|
+
right: 0,
|
511
|
+
padding: 1,
|
512
|
+
hasRadius: true,
|
513
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
514
|
+
designSystem.SingleSelect,
|
515
|
+
{
|
516
|
+
onChange: (open) => {
|
517
|
+
slate.Transforms.setNodes(
|
518
|
+
editor,
|
519
|
+
{ language: open.toString() },
|
520
|
+
{ match: (node) => !slate.Editor.isEditor(node) && node.type === "code" }
|
521
|
+
);
|
522
|
+
},
|
523
|
+
value: props.element.type === "code" && props.element.language || "plaintext",
|
524
|
+
onOpenChange: (open) => {
|
525
|
+
setIsSelectOpen(open);
|
526
|
+
if (!open) {
|
527
|
+
slateReact.ReactEditor.focus(editor);
|
528
|
+
}
|
529
|
+
},
|
530
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
531
|
+
"aria-label": formatMessage({
|
532
|
+
id: "components.Blocks.blocks.code.languageLabel",
|
533
|
+
defaultMessage: "Select a language"
|
534
|
+
}),
|
535
|
+
children: codeLanguages.map(({ value, label }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value, children: label }, value))
|
536
|
+
}
|
537
|
+
)
|
538
|
+
}
|
539
|
+
)
|
540
|
+
] });
|
541
|
+
};
|
276
542
|
const codeBlocks = {
|
277
543
|
code: {
|
278
|
-
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
544
|
+
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { ...props }),
|
279
545
|
icon: Icons.Code,
|
280
546
|
label: {
|
281
547
|
id: "components.Blocks.blocks.code",
|
@@ -284,7 +550,7 @@ const codeBlocks = {
|
|
284
550
|
matchNode: (node) => node.type === "code",
|
285
551
|
isInBlocksSelector: true,
|
286
552
|
handleConvert(editor) {
|
287
|
-
baseHandleConvert(editor, { type: "code" });
|
553
|
+
baseHandleConvert(editor, { type: "code", language: "plaintext" });
|
288
554
|
},
|
289
555
|
handleEnterKey(editor) {
|
290
556
|
pressEnterTwiceToExit(editor);
|
@@ -293,27 +559,27 @@ const codeBlocks = {
|
|
293
559
|
dragHandleTopMargin: "10px"
|
294
560
|
}
|
295
561
|
};
|
296
|
-
const H1 =
|
562
|
+
const H1 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h1" })`
|
297
563
|
font-size: 4.2rem;
|
298
564
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
299
565
|
`;
|
300
|
-
const H2 =
|
566
|
+
const H2 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h2" })`
|
301
567
|
font-size: 3.5rem;
|
302
568
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
303
569
|
`;
|
304
|
-
const H3 =
|
570
|
+
const H3 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h3" })`
|
305
571
|
font-size: 2.9rem;
|
306
572
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
307
573
|
`;
|
308
|
-
const H4 =
|
574
|
+
const H4 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h4" })`
|
309
575
|
font-size: 2.4rem;
|
310
576
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
311
577
|
`;
|
312
|
-
const H5 =
|
578
|
+
const H5 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h5" })`
|
313
579
|
font-size: 2rem;
|
314
580
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
315
581
|
`;
|
316
|
-
const H6 =
|
582
|
+
const H6 = styledComponents.styled(designSystem.Typography).attrs({ tag: "h6" })`
|
317
583
|
font-size: 1.6rem;
|
318
584
|
line-height: ${({ theme }) => theme.lineHeights[1]};
|
319
585
|
`;
|
@@ -399,10 +665,10 @@ const headingBlocks = {
|
|
399
665
|
dragHandleTopMargin: "-2px"
|
400
666
|
}
|
401
667
|
};
|
402
|
-
const ImageWrapper =
|
668
|
+
const ImageWrapper = styledComponents.styled(designSystem.Flex)`
|
403
669
|
transition-property: box-shadow;
|
404
670
|
transition-duration: 0.2s;
|
405
|
-
${(props) => props
|
671
|
+
${(props) => props.$isFocused && styledComponents.css`
|
406
672
|
box-shadow: ${props.theme.colors.primary600} 0px 0px 0px 3px;
|
407
673
|
`}
|
408
674
|
|
@@ -454,7 +720,7 @@ const Image = ({ attributes, children, element }) => {
|
|
454
720
|
background: "neutral100",
|
455
721
|
contentEditable: false,
|
456
722
|
justifyContent: "center",
|
457
|
-
isFocused: editorIsFocused && imageIsSelected,
|
723
|
+
$isFocused: editorIsFocused && imageIsSelected,
|
458
724
|
hasRadius: true,
|
459
725
|
children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, alt: alternativeText, width, height })
|
460
726
|
}
|
@@ -502,7 +768,7 @@ const ImageDialog = () => {
|
|
502
768
|
const nodeImage = {
|
503
769
|
...expectedImage,
|
504
770
|
alternativeText: expectedImage.alternativeText || expectedImage.name,
|
505
|
-
url:
|
771
|
+
url: usePrev.prefixFileUrlWithBackendUrl(image.url)
|
506
772
|
};
|
507
773
|
return nodeImage;
|
508
774
|
});
|
@@ -610,11 +876,11 @@ const isLinkNode = (element) => {
|
|
610
876
|
const isListNode$1 = (element) => {
|
611
877
|
return element.type === "list";
|
612
878
|
};
|
613
|
-
const StyledBaseLink =
|
879
|
+
const StyledBaseLink = styledComponents.styled(designSystem.BaseLink)`
|
614
880
|
text-decoration: none;
|
615
881
|
`;
|
616
|
-
const RemoveButton =
|
617
|
-
visibility: ${(props) => props
|
882
|
+
const RemoveButton = styledComponents.styled(designSystem.Button)`
|
883
|
+
visibility: ${(props) => props.$visible ? "visible" : "hidden"};
|
618
884
|
`;
|
619
885
|
const LinkContent = React__namespace.forwardRef(
|
620
886
|
({ link, children, attributes }, forwardedRef) => {
|
@@ -624,17 +890,23 @@ const LinkContent = React__namespace.forwardRef(
|
|
624
890
|
const [popoverOpen, setPopoverOpen] = React__namespace.useState(
|
625
891
|
editor.lastInsertedLinkPath ? slate.Path.equals(path, editor.lastInsertedLinkPath) : false
|
626
892
|
);
|
627
|
-
const linkRef = React__namespace.useRef(null);
|
628
893
|
const elementText = link.children.map((child) => child.text).join("");
|
629
894
|
const [linkText, setLinkText] = React__namespace.useState(elementText);
|
630
895
|
const [linkUrl, setLinkUrl] = React__namespace.useState(link.url);
|
631
896
|
const linkInputRef = React__namespace.useRef(null);
|
632
897
|
const [showRemoveButton, setShowRemoveButton] = React__namespace.useState(false);
|
633
898
|
const [isSaveDisabled, setIsSaveDisabled] = React__namespace.useState(false);
|
634
|
-
const
|
635
|
-
|
636
|
-
|
637
|
-
|
899
|
+
const handleOpenChange = (isOpen) => {
|
900
|
+
if (isOpen) {
|
901
|
+
setPopoverOpen(isOpen);
|
902
|
+
setShowRemoveButton(isOpen);
|
903
|
+
} else {
|
904
|
+
setPopoverOpen(isOpen);
|
905
|
+
if (link.url === "") {
|
906
|
+
removeLink(editor);
|
907
|
+
}
|
908
|
+
slateReact.ReactEditor.focus(editor);
|
909
|
+
}
|
638
910
|
};
|
639
911
|
const onLinkChange = (e) => {
|
640
912
|
setIsSaveDisabled(false);
|
@@ -657,39 +929,21 @@ const LinkContent = React__namespace.forwardRef(
|
|
657
929
|
setPopoverOpen(false);
|
658
930
|
editor.lastInsertedLinkPath = null;
|
659
931
|
};
|
660
|
-
const handleDismiss = () => {
|
661
|
-
setPopoverOpen(false);
|
662
|
-
if (link.url === "") {
|
663
|
-
removeLink(editor);
|
664
|
-
}
|
665
|
-
slateReact.ReactEditor.focus(editor);
|
666
|
-
};
|
667
|
-
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
668
|
-
const composedRefs = designSystem.useComposedRefs(linkRef, forwardedRef);
|
669
932
|
React__namespace.useEffect(() => {
|
670
933
|
if (popoverOpen)
|
671
934
|
linkInputRef.current?.focus();
|
672
935
|
}, [popoverOpen]);
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
href: link.url,
|
680
|
-
onClick: handleOpenEditPopover,
|
681
|
-
color: "primary600",
|
682
|
-
children
|
683
|
-
}
|
684
|
-
),
|
685
|
-
popoverOpen && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover, { source: linkRef, onDismiss: handleDismiss, padding: 4, contentEditable: false, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { as: "form", onSubmit: handleSave, direction: "column", gap: 4, children: [
|
686
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
687
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { children: formatMessage({
|
936
|
+
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
937
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { onOpenChange: handleOpenChange, open: popoverOpen, children: [
|
938
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(StyledBaseLink, { ...attributes, ref: forwardedRef, href: link.url, color: "primary600", children }) }),
|
939
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, tag: "form", onSubmit: handleSave, direction: "column", gap: 4, children: [
|
940
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
941
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
688
942
|
id: "components.Blocks.popover.text",
|
689
943
|
defaultMessage: "Text"
|
690
944
|
}) }),
|
691
945
|
/* @__PURE__ */ jsxRuntime.jsx(
|
692
|
-
designSystem.
|
946
|
+
designSystem.Field.Input,
|
693
947
|
{
|
694
948
|
name: "text",
|
695
949
|
placeholder: formatMessage({
|
@@ -703,13 +957,13 @@ const LinkContent = React__namespace.forwardRef(
|
|
703
957
|
}
|
704
958
|
)
|
705
959
|
] }) }),
|
706
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
707
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
960
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
961
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
708
962
|
id: "components.Blocks.popover.link",
|
709
963
|
defaultMessage: "Link"
|
710
964
|
}) }),
|
711
965
|
/* @__PURE__ */ jsxRuntime.jsx(
|
712
|
-
designSystem.
|
966
|
+
designSystem.Field.Input,
|
713
967
|
{
|
714
968
|
ref: linkInputRef,
|
715
969
|
name: "url",
|
@@ -728,7 +982,7 @@ const LinkContent = React__namespace.forwardRef(
|
|
728
982
|
{
|
729
983
|
variant: "danger-light",
|
730
984
|
onClick: () => removeLink(editor),
|
731
|
-
visible: showRemoveButton,
|
985
|
+
$visible: showRemoveButton,
|
732
986
|
children: formatMessage({
|
733
987
|
id: "components.Blocks.popover.remove",
|
734
988
|
defaultMessage: "Remove"
|
@@ -736,7 +990,7 @@ const LinkContent = React__namespace.forwardRef(
|
|
736
990
|
}
|
737
991
|
),
|
738
992
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
739
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick:
|
993
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: () => handleOpenChange(false), children: formatMessage({
|
740
994
|
id: "components.Blocks.popover.cancel",
|
741
995
|
defaultMessage: "Cancel"
|
742
996
|
}) }),
|
@@ -764,7 +1018,7 @@ const linkBlocks = {
|
|
764
1018
|
isInBlocksSelector: false
|
765
1019
|
}
|
766
1020
|
};
|
767
|
-
const listStyle =
|
1021
|
+
const listStyle = styledComponents.css`
|
768
1022
|
display: flex;
|
769
1023
|
flex-direction: column;
|
770
1024
|
gap: ${({ theme }) => theme.spaces[2]};
|
@@ -782,12 +1036,12 @@ const listStyle = styled.css`
|
|
782
1036
|
margin-inline-start: ${({ theme }) => theme.spaces[3]};
|
783
1037
|
}
|
784
1038
|
`;
|
785
|
-
const Orderedlist =
|
786
|
-
list-style-type: ${(props) => props
|
1039
|
+
const Orderedlist = styledComponents.styled.ol`
|
1040
|
+
list-style-type: ${(props) => props.$listStyleType};
|
787
1041
|
${listStyle}
|
788
1042
|
`;
|
789
|
-
const Unorderedlist =
|
790
|
-
list-style-type: ${(props) => props
|
1043
|
+
const Unorderedlist = styledComponents.styled.ul`
|
1044
|
+
list-style-type: ${(props) => props.$listStyleType};
|
791
1045
|
${listStyle}
|
792
1046
|
`;
|
793
1047
|
const orderedStyles = ["decimal", "lower-alpha", "upper-roman"];
|
@@ -800,9 +1054,9 @@ const List = ({ attributes, children, element }) => {
|
|
800
1054
|
const nextIndex = (element.indentLevel || 0) % listStyles.length;
|
801
1055
|
const listStyleType = listStyles[nextIndex];
|
802
1056
|
if (element.format === "ordered") {
|
803
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Orderedlist, { listStyleType, ...attributes, children });
|
1057
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Orderedlist, { $listStyleType: listStyleType, ...attributes, children });
|
804
1058
|
}
|
805
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Unorderedlist, { listStyleType, ...attributes, children });
|
1059
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Unorderedlist, { $listStyleType: listStyleType, ...attributes, children });
|
806
1060
|
};
|
807
1061
|
const replaceListWithEmptyBlock = (editor, currentListPath) => {
|
808
1062
|
slate.Transforms.removeNodes(editor, { at: currentListPath });
|
@@ -999,7 +1253,7 @@ const listBlocks = {
|
|
999
1253
|
snippets: ["-", "*", "+"]
|
1000
1254
|
},
|
1001
1255
|
"list-item": {
|
1002
|
-
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
1256
|
+
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "li", ...props.attributes, children: props.children }),
|
1003
1257
|
// No handleConvert, list items are created when converting to the parent list
|
1004
1258
|
matchNode: (node) => node.type === "list-item",
|
1005
1259
|
isInBlocksSelector: false,
|
@@ -1008,7 +1262,7 @@ const listBlocks = {
|
|
1008
1262
|
};
|
1009
1263
|
const paragraphBlocks = {
|
1010
1264
|
paragraph: {
|
1011
|
-
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
1265
|
+
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "p", variant: "omega", ...props.attributes, children: props.children }),
|
1012
1266
|
icon: Icons.Paragraph,
|
1013
1267
|
label: {
|
1014
1268
|
id: "components.Blocks.blocks.text",
|
@@ -1056,7 +1310,7 @@ const paragraphBlocks = {
|
|
1056
1310
|
}
|
1057
1311
|
}
|
1058
1312
|
};
|
1059
|
-
const Blockquote =
|
1313
|
+
const Blockquote = styledComponents.styled.blockquote.attrs({ role: "blockquote" })`
|
1060
1314
|
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
1061
1315
|
border-left: ${({ theme }) => `${theme.spaces[1]} solid ${theme.colors.neutral200}`};
|
1062
1316
|
padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[4]};
|
@@ -1086,17 +1340,17 @@ const quoteBlocks = {
|
|
1086
1340
|
dragHandleTopMargin: "6px"
|
1087
1341
|
}
|
1088
1342
|
};
|
1089
|
-
const ToolbarWrapper =
|
1343
|
+
const ToolbarWrapper = styledComponents.styled(designSystem.Flex)`
|
1090
1344
|
&[aria-disabled='true'] {
|
1091
1345
|
cursor: not-allowed;
|
1092
1346
|
}
|
1093
1347
|
`;
|
1094
|
-
const Separator =
|
1348
|
+
const Separator = styledComponents.styled(Toolbar__namespace.Separator)`
|
1095
1349
|
background: ${({ theme }) => theme.colors.neutral150};
|
1096
1350
|
width: 1px;
|
1097
1351
|
height: 2.4rem;
|
1098
1352
|
`;
|
1099
|
-
const FlexButton =
|
1353
|
+
const FlexButton = styledComponents.styled(designSystem.Flex)`
|
1100
1354
|
// Inherit the not-allowed cursor from ToolbarWrapper when disabled
|
1101
1355
|
&[aria-disabled] {
|
1102
1356
|
cursor: inherit;
|
@@ -1111,7 +1365,7 @@ const FlexButton = styled__default.default(designSystem.Flex)`
|
|
1111
1365
|
}
|
1112
1366
|
}
|
1113
1367
|
`;
|
1114
|
-
const SelectWrapper =
|
1368
|
+
const SelectWrapper = styledComponents.styled(designSystem.Box)`
|
1115
1369
|
// Styling changes to SingleSelect component don't work, so adding wrapper to target SingleSelect
|
1116
1370
|
div[role='combobox'] {
|
1117
1371
|
border: none;
|
@@ -1174,7 +1428,7 @@ const ToolbarButton = ({
|
|
1174
1428
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
1175
1429
|
FlexButton,
|
1176
1430
|
{
|
1177
|
-
|
1431
|
+
tag: "button",
|
1178
1432
|
background: isActive ? "primary100" : "",
|
1179
1433
|
alignItems: "center",
|
1180
1434
|
justifyContent: "center",
|
@@ -1458,7 +1712,7 @@ const BlocksToolbar = () => {
|
|
1458
1712
|
] }) })
|
1459
1713
|
] }) });
|
1460
1714
|
};
|
1461
|
-
const StyledEditable =
|
1715
|
+
const StyledEditable = styledComponents.styled(slateReact.Editable)`
|
1462
1716
|
// The outline style is set on the wrapper with :focus-within
|
1463
1717
|
outline: none;
|
1464
1718
|
display: flex;
|
@@ -1473,20 +1727,20 @@ const StyledEditable = styled__default.default(slateReact.Editable)`
|
|
1473
1727
|
padding-bottom: ${({ theme }) => theme.spaces[3]};
|
1474
1728
|
}
|
1475
1729
|
`;
|
1476
|
-
const Wrapper$1 =
|
1730
|
+
const Wrapper$1 = styledComponents.styled(designSystem.Box)`
|
1477
1731
|
position: ${({ isOverDropTarget }) => isOverDropTarget && "relative"};
|
1478
1732
|
`;
|
1479
|
-
const DropPlaceholder =
|
1733
|
+
const DropPlaceholder = styledComponents.styled(designSystem.Box)`
|
1480
1734
|
position: absolute;
|
1481
1735
|
right: 0;
|
1482
1736
|
|
1483
1737
|
// Show drop placeholder 8px above or below the drop target
|
1484
|
-
${({ dragDirection, theme, placeholderMargin }) =>
|
1738
|
+
${({ dragDirection, theme, placeholderMargin }) => styledComponents.css`
|
1485
1739
|
top: ${dragDirection === useDragAndDrop.DIRECTIONS.UPWARD && `-${theme.spaces[placeholderMargin]}`};
|
1486
1740
|
bottom: ${dragDirection === useDragAndDrop.DIRECTIONS.DOWNWARD && `-${theme.spaces[placeholderMargin]}`};
|
1487
1741
|
`}
|
1488
1742
|
`;
|
1489
|
-
const DragItem =
|
1743
|
+
const DragItem = styledComponents.styled(designSystem.Flex)`
|
1490
1744
|
// Style each block rendered using renderElement()
|
1491
1745
|
& > [data-slate-node='element'] {
|
1492
1746
|
width: 100%;
|
@@ -1495,14 +1749,14 @@ const DragItem = styled__default.default(designSystem.Flex)`
|
|
1495
1749
|
|
1496
1750
|
// Set the visibility of drag button
|
1497
1751
|
[role='button'] {
|
1498
|
-
visibility: ${(props) => props
|
1752
|
+
visibility: ${(props) => props.$dragVisibility};
|
1499
1753
|
opacity: inherit;
|
1500
1754
|
}
|
1501
1755
|
&[aria-disabled='true'] {
|
1502
1756
|
user-drag: none;
|
1503
1757
|
}
|
1504
1758
|
`;
|
1505
|
-
const DragIconButton =
|
1759
|
+
const DragIconButton = styledComponents.styled(designSystem.IconButton)`
|
1506
1760
|
display: flex;
|
1507
1761
|
align-items: center;
|
1508
1762
|
justify-content: center;
|
@@ -1512,7 +1766,7 @@ const DragIconButton = styled__default.default(designSystem.IconButton)`
|
|
1512
1766
|
visibility: hidden;
|
1513
1767
|
cursor: grab;
|
1514
1768
|
opacity: inherit;
|
1515
|
-
margin-top: ${(props) => props
|
1769
|
+
margin-top: ${(props) => props.$dragHandleTopMargin ?? 0};
|
1516
1770
|
|
1517
1771
|
&:hover {
|
1518
1772
|
background: ${({ theme }) => theme.colors.neutral200};
|
@@ -1587,7 +1841,7 @@ const DragAndDropElement = ({
|
|
1587
1841
|
React__namespace.useEffect(() => {
|
1588
1842
|
setDragVisibility("hidden");
|
1589
1843
|
}, [editor.selection]);
|
1590
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper$1, { ref:
|
1844
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper$1, { ref: composedBoxRefs, isOverDropTarget, children: [
|
1591
1845
|
isOverDropTarget && /* @__PURE__ */ jsxRuntime.jsx(
|
1592
1846
|
DropPlaceholder,
|
1593
1847
|
{
|
@@ -1625,15 +1879,16 @@ const DragAndDropElement = ({
|
|
1625
1879
|
onSelect: () => setDragVisibility("visible"),
|
1626
1880
|
onMouseLeave: () => setDragVisibility("hidden"),
|
1627
1881
|
"aria-disabled": disabled,
|
1628
|
-
dragVisibility,
|
1882
|
+
$dragVisibility: dragVisibility,
|
1629
1883
|
children: [
|
1630
1884
|
/* @__PURE__ */ jsxRuntime.jsx(
|
1631
1885
|
DragIconButton,
|
1632
1886
|
{
|
1633
|
-
|
1887
|
+
tag: "div",
|
1634
1888
|
role: "button",
|
1635
1889
|
tabIndex: 0,
|
1636
|
-
|
1890
|
+
withTooltip: false,
|
1891
|
+
label: formatMessage({
|
1637
1892
|
id: index.getTranslation("components.DragHandle-label"),
|
1638
1893
|
defaultMessage: "Drag"
|
1639
1894
|
}),
|
@@ -1641,7 +1896,7 @@ const DragAndDropElement = ({
|
|
1641
1896
|
"aria-disabled": disabled,
|
1642
1897
|
disabled,
|
1643
1898
|
draggable: true,
|
1644
|
-
dragHandleTopMargin,
|
1899
|
+
$dragHandleTopMargin: dragHandleTopMargin,
|
1645
1900
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, { color: "neutral600" })
|
1646
1901
|
}
|
1647
1902
|
),
|
@@ -1653,17 +1908,18 @@ const DragAndDropElement = ({
|
|
1653
1908
|
};
|
1654
1909
|
const CloneDragItem = ({ children, dragHandleTopMargin }) => {
|
1655
1910
|
const { formatMessage } = reactIntl.useIntl();
|
1656
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", dragVisibility: "visible", children: [
|
1911
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DragItem, { gap: 2, paddingLeft: 2, alignItems: "start", $dragVisibility: "visible", children: [
|
1657
1912
|
/* @__PURE__ */ jsxRuntime.jsx(
|
1658
1913
|
DragIconButton,
|
1659
1914
|
{
|
1660
|
-
|
1915
|
+
tag: "div",
|
1661
1916
|
role: "button",
|
1662
|
-
|
1917
|
+
withTooltip: false,
|
1918
|
+
label: formatMessage({
|
1663
1919
|
id: index.getTranslation("components.DragHandle-label"),
|
1664
1920
|
defaultMessage: "Drag"
|
1665
1921
|
}),
|
1666
|
-
dragHandleTopMargin,
|
1922
|
+
$dragHandleTopMargin: dragHandleTopMargin,
|
1667
1923
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, { color: "neutral600" })
|
1668
1924
|
}
|
1669
1925
|
),
|
@@ -1910,12 +2166,12 @@ const BlocksContent = ({ placeholder, ariaLabelId }) => {
|
|
1910
2166
|
}
|
1911
2167
|
);
|
1912
2168
|
};
|
1913
|
-
const CollapseIconButton =
|
2169
|
+
const CollapseIconButton = styledComponents.styled(designSystem.IconButton)`
|
1914
2170
|
position: absolute;
|
1915
2171
|
bottom: 1.2rem;
|
1916
2172
|
right: 1.2rem;
|
1917
2173
|
`;
|
1918
|
-
const ExpandWrapper$1 =
|
2174
|
+
const ExpandWrapper$1 = styledComponents.styled(designSystem.Flex)`
|
1919
2175
|
// Background with 20% opacity
|
1920
2176
|
background: ${({ theme }) => `${theme.colors.neutral800}1F`};
|
1921
2177
|
`;
|
@@ -1980,13 +2236,13 @@ const EditorLayout$1 = ({
|
|
1980
2236
|
) }) });
|
1981
2237
|
}
|
1982
2238
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1983
|
-
|
2239
|
+
InputWrapper,
|
1984
2240
|
{
|
1985
2241
|
direction: "column",
|
1986
2242
|
alignItems: "flex-start",
|
1987
2243
|
height: "512px",
|
1988
|
-
disabled,
|
1989
|
-
hasError: Boolean(error),
|
2244
|
+
$disabled: disabled,
|
2245
|
+
$hasError: Boolean(error),
|
1990
2246
|
style: { overflow: "hidden" },
|
1991
2247
|
"aria-describedby": ariaDescriptionId,
|
1992
2248
|
position: "relative",
|
@@ -1994,25 +2250,52 @@ const EditorLayout$1 = ({
|
|
1994
2250
|
}
|
1995
2251
|
);
|
1996
2252
|
};
|
1997
|
-
const
|
2253
|
+
const InputWrapper = styledComponents.styled(designSystem.Flex)`
|
2254
|
+
border: 1px solid
|
2255
|
+
${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
|
2256
|
+
border-radius: ${({ theme }) => theme.borderRadius};
|
2257
|
+
background: ${({ theme }) => theme.colors.neutral0};
|
2258
|
+
|
2259
|
+
${({ theme, $hasError = false }) => styledComponents.css`
|
2260
|
+
outline: none;
|
2261
|
+
box-shadow: 0;
|
2262
|
+
transition-property: border-color, box-shadow, fill;
|
2263
|
+
transition-duration: 0.2s;
|
2264
|
+
|
2265
|
+
&:focus-within {
|
2266
|
+
border: 1px solid ${$hasError ? theme.colors.danger600 : theme.colors.primary600};
|
2267
|
+
box-shadow: ${$hasError ? theme.colors.danger600 : theme.colors.primary600} 0px 0px 0px 2px;
|
2268
|
+
}
|
2269
|
+
`}
|
2270
|
+
|
2271
|
+
${({ theme, $disabled }) => $disabled ? styledComponents.css`
|
2272
|
+
color: ${theme.colors.neutral600};
|
2273
|
+
background: ${theme.colors.neutral150};
|
2274
|
+
` : void 0}
|
2275
|
+
`;
|
2276
|
+
const stylesToInherit = styledComponents.css`
|
1998
2277
|
font-size: inherit;
|
1999
2278
|
color: inherit;
|
2000
2279
|
line-height: inherit;
|
2001
2280
|
`;
|
2002
|
-
const BoldText =
|
2281
|
+
const BoldText = styledComponents.styled(designSystem.Typography).attrs({ fontWeight: "bold" })`
|
2003
2282
|
${stylesToInherit}
|
2004
2283
|
`;
|
2005
|
-
const ItalicText =
|
2284
|
+
const ItalicText = styledComponents.styled(designSystem.Typography)`
|
2006
2285
|
font-style: italic;
|
2007
2286
|
${stylesToInherit}
|
2008
2287
|
`;
|
2009
|
-
const UnderlineText =
|
2288
|
+
const UnderlineText = styledComponents.styled(designSystem.Typography).attrs({
|
2289
|
+
textDecoration: "underline"
|
2290
|
+
})`
|
2010
2291
|
${stylesToInherit}
|
2011
2292
|
`;
|
2012
|
-
const StrikeThroughText =
|
2293
|
+
const StrikeThroughText = styledComponents.styled(designSystem.Typography).attrs({
|
2294
|
+
textDecoration: "line-through"
|
2295
|
+
})`
|
2013
2296
|
${stylesToInherit}
|
2014
2297
|
`;
|
2015
|
-
const InlineCode =
|
2298
|
+
const InlineCode = styledComponents.styled.code`
|
2016
2299
|
background-color: ${({ theme }) => theme.colors.neutral150};
|
2017
2300
|
border-radius: ${({ theme }) => theme.borderRadius};
|
2018
2301
|
padding: ${({ theme }) => `0 ${theme.spaces[2]}`};
|
@@ -2182,10 +2465,10 @@ function useBlocksEditorContext(consumerName) {
|
|
2182
2465
|
editor
|
2183
2466
|
};
|
2184
2467
|
}
|
2185
|
-
const EditorDivider =
|
2468
|
+
const EditorDivider = styledComponents.styled(designSystem.Divider)`
|
2186
2469
|
background: ${({ theme }) => theme.colors.neutral200};
|
2187
2470
|
`;
|
2188
|
-
const ExpandIconButton =
|
2471
|
+
const ExpandIconButton = styledComponents.styled(designSystem.IconButton)`
|
2189
2472
|
position: absolute;
|
2190
2473
|
bottom: 1.2rem;
|
2191
2474
|
right: 1.2rem;
|
@@ -2300,8 +2583,8 @@ const BlocksInput = React__namespace.forwardRef(
|
|
2300
2583
|
({ label, name: name2, required = false, hint, labelAction, ...editorProps }, forwardedRef) => {
|
2301
2584
|
const id = React__namespace.useId();
|
2302
2585
|
const field = strapiAdmin.useField(name2);
|
2303
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
2304
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
2586
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { id, name: name2, hint, error: field.error, required, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
2587
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
2305
2588
|
/* @__PURE__ */ jsxRuntime.jsx(
|
2306
2589
|
BlocksEditor,
|
2307
2590
|
{
|
@@ -2314,11 +2597,12 @@ const BlocksInput = React__namespace.forwardRef(
|
|
2314
2597
|
...editorProps
|
2315
2598
|
}
|
2316
2599
|
),
|
2317
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
2318
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
2600
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
2601
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
2319
2602
|
] }) });
|
2320
2603
|
}
|
2321
2604
|
);
|
2605
|
+
const MemoizedBlocksInput = React__namespace.memo(BlocksInput);
|
2322
2606
|
const createDefaultForm = (contentType, components = {}) => {
|
2323
2607
|
const traverseSchema = (attributes) => {
|
2324
2608
|
return Object.entries(attributes).reduce((acc, [key, attribute]) => {
|
@@ -2346,7 +2630,7 @@ const Initializer = ({ disabled, name: name2, onClick }) => {
|
|
2346
2630
|
/* @__PURE__ */ jsxRuntime.jsx(
|
2347
2631
|
designSystem.Box,
|
2348
2632
|
{
|
2349
|
-
|
2633
|
+
tag: "button",
|
2350
2634
|
background: "neutral100",
|
2351
2635
|
borderColor: field.error ? "danger600" : "neutral200",
|
2352
2636
|
hasRadius: true,
|
@@ -2367,7 +2651,7 @@ const Initializer = ({ disabled, name: name2, onClick }) => {
|
|
2367
2651
|
field.error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "pi", children: field.error })
|
2368
2652
|
] });
|
2369
2653
|
};
|
2370
|
-
const CircleIcon =
|
2654
|
+
const CircleIcon = styledComponents.styled(Icons.PlusCircle)`
|
2371
2655
|
width: 2.4rem;
|
2372
2656
|
height: 2.4rem;
|
2373
2657
|
> circle {
|
@@ -2397,9 +2681,9 @@ const NonRepeatableComponent = ({
|
|
2397
2681
|
hasRadius: isNested,
|
2398
2682
|
borderColor: isNested ? "neutral200" : void 0,
|
2399
2683
|
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index2) => {
|
2400
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: row.map(({ size, ...field }) => {
|
2684
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2401
2685
|
const completeFieldName = `${name2}.${field.name}`;
|
2402
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
2686
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
|
2403
2687
|
}) }, index2);
|
2404
2688
|
}) })
|
2405
2689
|
}
|
@@ -2423,7 +2707,7 @@ const RepeatableComponent = ({
|
|
2423
2707
|
const moveFieldRow = strapiAdmin.useForm("RepeatableComponent", (state) => state.moveFieldRow);
|
2424
2708
|
const removeFieldRow = strapiAdmin.useForm("RepeatableComponent", (state) => state.removeFieldRow);
|
2425
2709
|
const { max = Infinity } = attribute;
|
2426
|
-
const [collapseToOpen, setCollapseToOpen] = React__namespace.useState(
|
2710
|
+
const [collapseToOpen, setCollapseToOpen] = React__namespace.useState("");
|
2427
2711
|
const [liveText, setLiveText] = React__namespace.useState("");
|
2428
2712
|
const componentTmpKeyWithFocussedField = React__namespace.useMemo(() => {
|
2429
2713
|
if (search.has("field")) {
|
@@ -2439,13 +2723,19 @@ const RepeatableComponent = ({
|
|
2439
2723
|
}
|
2440
2724
|
return void 0;
|
2441
2725
|
}, [search, name2, value]);
|
2726
|
+
const prevValue = usePrev.usePrev(value);
|
2442
2727
|
React__namespace.useEffect(() => {
|
2443
|
-
if (
|
2728
|
+
if (prevValue && prevValue.length < value.length) {
|
2729
|
+
setCollapseToOpen(value[value.length - 1].__temp_key__);
|
2730
|
+
}
|
2731
|
+
}, [value, prevValue]);
|
2732
|
+
React__namespace.useEffect(() => {
|
2733
|
+
if (typeof componentTmpKeyWithFocussedField === "string") {
|
2444
2734
|
setCollapseToOpen(componentTmpKeyWithFocussedField);
|
2445
2735
|
}
|
2446
2736
|
}, [componentTmpKeyWithFocussedField]);
|
2447
2737
|
const toggleCollapses = () => {
|
2448
|
-
setCollapseToOpen(
|
2738
|
+
setCollapseToOpen("");
|
2449
2739
|
};
|
2450
2740
|
const handleClick = () => {
|
2451
2741
|
if (value.length < max) {
|
@@ -2477,12 +2767,8 @@ const RepeatableComponent = ({
|
|
2477
2767
|
);
|
2478
2768
|
moveFieldRow(name2, currentIndex, newIndex);
|
2479
2769
|
};
|
2480
|
-
const
|
2481
|
-
|
2482
|
-
setCollapseToOpen(null);
|
2483
|
-
} else {
|
2484
|
-
setCollapseToOpen(key);
|
2485
|
-
}
|
2770
|
+
const handleValueChange = (key) => {
|
2771
|
+
setCollapseToOpen(key);
|
2486
2772
|
};
|
2487
2773
|
const getItemPos = (index2) => `${index2 + 1} of ${value.length}`;
|
2488
2774
|
const handleCancel = (index$1) => {
|
@@ -2537,158 +2823,104 @@ const RepeatableComponent = ({
|
|
2537
2823
|
defaultMessage: `Press spacebar to grab and re-order`
|
2538
2824
|
}) }),
|
2539
2825
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
2540
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2826
|
+
/* @__PURE__ */ jsxRuntime.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 }, index2) => {
|
2835
|
+
const nameWithIndex = `${name2}.${index2}`;
|
2836
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
2837
|
+
Relations.ComponentProvider,
|
2552
2838
|
{
|
2553
|
-
|
2554
|
-
|
2555
|
-
|
2556
|
-
|
2557
|
-
|
2558
|
-
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2839
|
+
id,
|
2840
|
+
uid: attribute.component,
|
2841
|
+
level: level + 1,
|
2842
|
+
type: "repeatable",
|
2843
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
2844
|
+
Component,
|
2845
|
+
{
|
2846
|
+
disabled,
|
2847
|
+
name: nameWithIndex,
|
2848
|
+
attribute,
|
2849
|
+
index: index2,
|
2850
|
+
mainField,
|
2851
|
+
onMoveItem: handleMoveComponentField,
|
2852
|
+
onDeleteComponent: () => {
|
2853
|
+
removeFieldRow(name2, index2);
|
2854
|
+
toggleCollapses();
|
2855
|
+
},
|
2856
|
+
toggleCollapses,
|
2857
|
+
onCancel: handleCancel,
|
2858
|
+
onDropItem: handleDropItem,
|
2859
|
+
onGrabItem: handleGrabItem,
|
2860
|
+
__temp_key__: key,
|
2861
|
+
children: layout.map((row, index22) => {
|
2862
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2863
|
+
const completeFieldName = `${nameWithIndex}.${field.name}`;
|
2864
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
|
2865
|
+
}) }, index22);
|
2866
|
+
})
|
2867
|
+
}
|
2868
|
+
)
|
2869
|
+
},
|
2870
|
+
key
|
2871
|
+
);
|
2872
|
+
}),
|
2873
|
+
/* @__PURE__ */ jsxRuntime.jsx(TextButtonCustom, { disabled, onClick: handleClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Plus, {}), children: formatMessage({
|
2874
|
+
id: index.getTranslation("containers.EditView.add.new-entry"),
|
2875
|
+
defaultMessage: "Add an entry"
|
2876
|
+
}) })
|
2877
|
+
]
|
2878
|
+
}
|
2879
|
+
)
|
2586
2880
|
] });
|
2587
2881
|
};
|
2588
|
-
const
|
2589
|
-
|
2882
|
+
const AccordionRoot = styledComponents.styled(designSystem.Accordion.Root)`
|
2883
|
+
border: 1px solid
|
2884
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
2885
|
+
`;
|
2886
|
+
const TextButtonCustom = styledComponents.styled(designSystem.TextButton)`
|
2590
2887
|
width: 100%;
|
2591
|
-
border-radius: 0 0 4px 4px;
|
2592
2888
|
display: flex;
|
2593
2889
|
justify-content: center;
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
}
|
2598
|
-
`;
|
2599
|
-
const AccordionFooter = styled__default.default(designSystem.Box)`
|
2600
|
-
overflow: hidden;
|
2601
|
-
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2602
|
-
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2603
|
-
border-left: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2604
|
-
border-radius: 0 0 ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius};
|
2605
|
-
`;
|
2606
|
-
const AccordionContent = styled__default.default(designSystem.Box)`
|
2607
|
-
border-bottom: none;
|
2608
|
-
|
2609
|
-
/* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
|
2610
|
-
& > div > div {
|
2611
|
-
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2612
|
-
border-top-color: transparent;
|
2613
|
-
}
|
2614
|
-
|
2615
|
-
/* the top accordion _does_ need a border though */
|
2616
|
-
& > div:first-child > div {
|
2617
|
-
border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2618
|
-
}
|
2619
|
-
|
2620
|
-
/* Reset all the border-radius' */
|
2621
|
-
& > div > div,
|
2622
|
-
& > div > div > div {
|
2623
|
-
border-radius: unset;
|
2624
|
-
}
|
2890
|
+
border-top: 1px solid ${({ theme }) => theme.colors.neutral200};
|
2891
|
+
padding-inline: ${(props) => props.theme.spaces[6]};
|
2892
|
+
padding-block: ${(props) => props.theme.spaces[3]};
|
2625
2893
|
|
2626
|
-
|
2627
|
-
|
2628
|
-
& > div:first-child > div > div {
|
2629
|
-
border-radius: ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius} 0 0;
|
2630
|
-
}
|
2631
|
-
|
2632
|
-
& > div > div[data-strapi-expanded='true'] {
|
2633
|
-
border: 1px solid ${({ theme }) => theme.colors.primary600};
|
2634
|
-
}
|
2635
|
-
`;
|
2636
|
-
const AccordionGroup = ({ children, error }) => {
|
2637
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.KeyboardNavigable, { attributeName: "data-strapi-accordion-toggle", children: [
|
2638
|
-
children,
|
2639
|
-
error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "danger600", children: error }) })
|
2640
|
-
] });
|
2641
|
-
};
|
2642
|
-
const CustomIconButton$1 = styled__default.default(designSystem.IconButton)`
|
2643
|
-
background-color: transparent;
|
2894
|
+
&:not([disabled]) {
|
2895
|
+
cursor: pointer;
|
2644
2896
|
|
2645
|
-
|
2646
|
-
|
2647
|
-
fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : theme.colors.neutral600};
|
2897
|
+
&:hover {
|
2898
|
+
background-color: ${(props) => props.theme.colors.primary100};
|
2648
2899
|
}
|
2649
2900
|
}
|
2650
2901
|
|
2651
|
-
|
2652
|
-
|
2653
|
-
|
2654
|
-
|
2655
|
-
}
|
2656
|
-
}
|
2902
|
+
span {
|
2903
|
+
font-weight: 600;
|
2904
|
+
font-size: 1.4rem;
|
2905
|
+
line-height: 2.4rem;
|
2657
2906
|
}
|
2658
|
-
`;
|
2659
|
-
const ActionsFlex$1 = styled__default.default(designSystem.Flex)`
|
2660
|
-
& .drag-handle {
|
2661
|
-
background: unset;
|
2662
2907
|
|
2663
|
-
|
2664
|
-
|
2665
|
-
fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : void 0};
|
2666
|
-
}
|
2667
|
-
}
|
2668
|
-
|
2669
|
-
&:hover {
|
2670
|
-
svg {
|
2671
|
-
path {
|
2672
|
-
/* keeps the hover style of the accordion */
|
2673
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
2674
|
-
}
|
2675
|
-
}
|
2676
|
-
}
|
2908
|
+
@media (prefers-reduced-motion: no-preference) {
|
2909
|
+
transition: background-color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
2677
2910
|
}
|
2678
2911
|
`;
|
2679
2912
|
const Component = ({
|
2680
2913
|
disabled,
|
2681
2914
|
index: index$1,
|
2682
|
-
isOpen,
|
2683
2915
|
name: name2,
|
2684
2916
|
mainField = {
|
2685
2917
|
name: "id",
|
2686
2918
|
type: "integer"
|
2687
2919
|
},
|
2688
2920
|
children,
|
2689
|
-
onClickToggle,
|
2690
2921
|
onDeleteComponent,
|
2691
2922
|
toggleCollapses,
|
2923
|
+
__temp_key__,
|
2692
2924
|
...dragProps
|
2693
2925
|
}) => {
|
2694
2926
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2713,50 +2945,44 @@ const Component = ({
|
|
2713
2945
|
dragPreviewRef(reactDndHtml5Backend.getEmptyImage(), { captureDraggingState: false });
|
2714
2946
|
}, [dragPreviewRef, index$1]);
|
2715
2947
|
const composedAccordionRefs = designSystem.useComposedRefs(accordionRef, dragRef);
|
2716
|
-
const composedBoxRefs = designSystem.useComposedRefs(
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
}
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
"
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
] }),
|
2755
|
-
title: displayValue,
|
2756
|
-
togglePosition: "left"
|
2757
|
-
}
|
2758
|
-
),
|
2759
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.AccordionContent, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
2948
|
+
const composedBoxRefs = designSystem.useComposedRefs(
|
2949
|
+
boxRef,
|
2950
|
+
dropRef
|
2951
|
+
);
|
2952
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview$1, {}) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { ref: composedBoxRefs, value: __temp_key__, children: [
|
2953
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
|
2954
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: displayValue }),
|
2955
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Actions, { children: [
|
2956
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2957
|
+
designSystem.IconButton,
|
2958
|
+
{
|
2959
|
+
borderWidth: 0,
|
2960
|
+
onClick: onDeleteComponent,
|
2961
|
+
label: formatMessage({
|
2962
|
+
id: index.getTranslation("containers.Edit.delete"),
|
2963
|
+
defaultMessage: "Delete"
|
2964
|
+
}),
|
2965
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {})
|
2966
|
+
}
|
2967
|
+
),
|
2968
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2969
|
+
designSystem.IconButton,
|
2970
|
+
{
|
2971
|
+
ref: composedAccordionRefs,
|
2972
|
+
borderWidth: 0,
|
2973
|
+
onClick: (e) => e.stopPropagation(),
|
2974
|
+
"data-handler-id": handlerId,
|
2975
|
+
label: formatMessage({
|
2976
|
+
id: index.getTranslation("components.DragHandle-label"),
|
2977
|
+
defaultMessage: "Drag"
|
2978
|
+
}),
|
2979
|
+
onKeyDown: handleKeyDown,
|
2980
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, {})
|
2981
|
+
}
|
2982
|
+
)
|
2983
|
+
] })
|
2984
|
+
] }),
|
2985
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
2760
2986
|
designSystem.Flex,
|
2761
2987
|
{
|
2762
2988
|
direction: "column",
|
@@ -2770,9 +2996,9 @@ const Component = ({
|
|
2770
2996
|
] }) });
|
2771
2997
|
};
|
2772
2998
|
const Preview$1 = () => {
|
2773
|
-
return /* @__PURE__ */ jsxRuntime.jsx(StyledSpan, {
|
2999
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledSpan, { tag: "span", padding: 6, background: "primary100" });
|
2774
3000
|
};
|
2775
|
-
const StyledSpan =
|
3001
|
+
const StyledSpan = styledComponents.styled(designSystem.Box)`
|
2776
3002
|
display: block;
|
2777
3003
|
outline: 1px dashed ${({ theme }) => theme.colors.primary500};
|
2778
3004
|
outline-offset: -1px;
|
@@ -2796,29 +3022,15 @@ const ComponentInput = ({
|
|
2796
3022
|
const data = transformDocument(schema, components)(form);
|
2797
3023
|
field.onChange(name2, data);
|
2798
3024
|
};
|
2799
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
3025
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error: field.error, required, children: [
|
2800
3026
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", children: [
|
2801
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
2802
|
-
|
2803
|
-
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
fontWeight: "bold",
|
2809
|
-
as: "label",
|
2810
|
-
children: [
|
2811
|
-
label,
|
2812
|
-
attribute.repeatable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
2813
|
-
" (",
|
2814
|
-
Array.isArray(field.value) ? field.value.length : 0,
|
2815
|
-
")"
|
2816
|
-
] }),
|
2817
|
-
required && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", children: "*" })
|
2818
|
-
]
|
2819
|
-
}
|
2820
|
-
),
|
2821
|
-
labelAction && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 1, children: labelAction })
|
3027
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { action: labelAction, children: [
|
3028
|
+
label,
|
3029
|
+
attribute.repeatable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
3030
|
+
" (",
|
3031
|
+
Array.isArray(field.value) ? field.value.length : 0,
|
3032
|
+
")"
|
3033
|
+
] })
|
2822
3034
|
] }),
|
2823
3035
|
showResetComponent && /* @__PURE__ */ jsxRuntime.jsx(
|
2824
3036
|
designSystem.IconButton,
|
@@ -2827,21 +3039,21 @@ const ComponentInput = ({
|
|
2827
3039
|
id: index.getTranslation("components.reset-entry"),
|
2828
3040
|
defaultMessage: "Reset Entry"
|
2829
3041
|
}),
|
2830
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}),
|
2831
3042
|
borderWidth: 0,
|
2832
3043
|
onClick: () => {
|
2833
3044
|
field.onChange(name2, null);
|
2834
|
-
}
|
3045
|
+
},
|
3046
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {})
|
2835
3047
|
}
|
2836
3048
|
)
|
2837
3049
|
] }),
|
2838
|
-
/* @__PURE__ */ jsxRuntime.
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
] })
|
3050
|
+
!attribute.repeatable && !field.value && /* @__PURE__ */ jsxRuntime.jsx(Initializer, { disabled, name: name2, onClick: handleInitialisationClick }),
|
3051
|
+
!attribute.repeatable && field.value ? /* @__PURE__ */ jsxRuntime.jsx(NonRepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }) : null,
|
3052
|
+
attribute.repeatable && /* @__PURE__ */ jsxRuntime.jsx(RepeatableComponent, { attribute, name: name2, disabled, ...props, children: props.children }),
|
3053
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
2843
3054
|
] });
|
2844
3055
|
};
|
3056
|
+
const MemoizedComponentInput = React__namespace.memo(ComponentInput);
|
2845
3057
|
const AddComponentButton = ({
|
2846
3058
|
hasError,
|
2847
3059
|
isDisabled,
|
@@ -2861,10 +3073,10 @@ const AddComponentButton = ({
|
|
2861
3073
|
paddingLeft: 4,
|
2862
3074
|
paddingRight: 4,
|
2863
3075
|
style: { cursor: isDisabled ? "not-allowed" : "pointer" },
|
2864
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, {
|
3076
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "span", gap: 2, children: [
|
2865
3077
|
/* @__PURE__ */ jsxRuntime.jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
|
2866
3078
|
/* @__PURE__ */ jsxRuntime.jsx(
|
2867
|
-
|
3079
|
+
AddComponentTitle,
|
2868
3080
|
{
|
2869
3081
|
variant: "pi",
|
2870
3082
|
fontWeight: "bold",
|
@@ -2876,7 +3088,7 @@ const AddComponentButton = ({
|
|
2876
3088
|
}
|
2877
3089
|
);
|
2878
3090
|
};
|
2879
|
-
const StyledAddIcon =
|
3091
|
+
const StyledAddIcon = styledComponents.styled(Icons.PlusCircle)`
|
2880
3092
|
height: ${({ theme }) => theme.spaces[6]};
|
2881
3093
|
width: ${({ theme }) => theme.spaces[6]};
|
2882
3094
|
transform: ${({ $isOpen }) => $isOpen ? "rotate(45deg)" : "rotate(0deg)"};
|
@@ -2888,13 +3100,14 @@ const StyledAddIcon = styled__default.default(Icons.PlusCircle)`
|
|
2888
3100
|
fill: ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral600};
|
2889
3101
|
}
|
2890
3102
|
`;
|
2891
|
-
const
|
3103
|
+
const AddComponentTitle = styledComponents.styled(designSystem.Typography)``;
|
3104
|
+
const StyledButton = styledComponents.styled(designSystem.BaseButton)`
|
2892
3105
|
border-radius: 26px;
|
2893
3106
|
border-color: ${({ theme }) => theme.colors.neutral150};
|
2894
3107
|
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
|
2895
3108
|
|
2896
3109
|
&:hover {
|
2897
|
-
${
|
3110
|
+
${AddComponentTitle} {
|
2898
3111
|
color: ${({ theme }) => theme.colors.primary600};
|
2899
3112
|
}
|
2900
3113
|
|
@@ -2908,7 +3121,7 @@ const StyledButton = styled__default.default(designSystem.BaseButton)`
|
|
2908
3121
|
}
|
2909
3122
|
}
|
2910
3123
|
&:active {
|
2911
|
-
${
|
3124
|
+
${AddComponentTitle} {
|
2912
3125
|
color: ${({ theme }) => theme.colors.primary600};
|
2913
3126
|
}
|
2914
3127
|
${StyledAddIcon} {
|
@@ -2925,27 +3138,15 @@ const ComponentCategory = ({
|
|
2925
3138
|
category,
|
2926
3139
|
components = [],
|
2927
3140
|
variant = "primary",
|
2928
|
-
|
2929
|
-
onAddComponent,
|
2930
|
-
onToggle
|
3141
|
+
onAddComponent
|
2931
3142
|
}) => {
|
2932
3143
|
const { formatMessage } = reactIntl.useIntl();
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion, { expanded: isOpen, onToggle: handleToggle, size: "S", children: [
|
2937
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2938
|
-
designSystem.AccordionToggle,
|
2939
|
-
{
|
2940
|
-
variant,
|
2941
|
-
title: formatMessage({ id: category, defaultMessage: category }),
|
2942
|
-
togglePosition: "left"
|
2943
|
-
}
|
2944
|
-
),
|
2945
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.AccordionContent, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: /* @__PURE__ */ jsxRuntime.jsx(Grid, { children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsxRuntime.jsx(
|
3144
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: category, children: [
|
3145
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Header, { variant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: formatMessage({ id: category, defaultMessage: category }) }) }),
|
3146
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(Grid, { paddingTop: 4, paddingBottom: 4, paddingLeft: 3, paddingRight: 3, children: components.map(({ uid, displayName, icon }) => /* @__PURE__ */ jsxRuntime.jsx(
|
2946
3147
|
ComponentBox,
|
2947
3148
|
{
|
2948
|
-
|
3149
|
+
tag: "button",
|
2949
3150
|
type: "button",
|
2950
3151
|
background: "neutral100",
|
2951
3152
|
justifyContent: "center",
|
@@ -2955,34 +3156,32 @@ const ComponentCategory = ({
|
|
2955
3156
|
shrink: 0,
|
2956
3157
|
borderColor: "neutral200",
|
2957
3158
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "center", justifyContent: "center", children: [
|
2958
|
-
/* @__PURE__ */ jsxRuntime.jsx(ComponentIcon.ComponentIcon, { icon }),
|
2959
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold",
|
3159
|
+
/* @__PURE__ */ jsxRuntime.jsx(ComponentIcon.ComponentIcon, { color: "currentColor", background: "primary200", icon }),
|
3160
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: displayName })
|
2960
3161
|
] })
|
2961
3162
|
},
|
2962
3163
|
uid
|
2963
|
-
)) }) })
|
3164
|
+
)) }) })
|
2964
3165
|
] });
|
2965
3166
|
};
|
2966
|
-
const Grid =
|
3167
|
+
const Grid = styledComponents.styled(designSystem.Box)`
|
2967
3168
|
display: grid;
|
2968
3169
|
grid-template-columns: repeat(auto-fit, 14rem);
|
2969
3170
|
grid-gap: ${({ theme }) => theme.spaces[1]};
|
2970
3171
|
`;
|
2971
|
-
const ComponentBox =
|
3172
|
+
const ComponentBox = styledComponents.styled(designSystem.Flex)`
|
3173
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
3174
|
+
cursor: pointer;
|
3175
|
+
|
3176
|
+
@media (prefers-reduced-motion: no-preference) {
|
3177
|
+
transition: color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
3178
|
+
}
|
3179
|
+
|
2972
3180
|
&:focus,
|
2973
3181
|
&:hover {
|
2974
3182
|
border: 1px solid ${({ theme }) => theme.colors.primary200};
|
2975
3183
|
background: ${({ theme }) => theme.colors.primary100};
|
2976
|
-
|
2977
|
-
${designSystem.Typography} {
|
2978
|
-
color: ${({ theme }) => theme.colors.primary600};
|
2979
|
-
}
|
2980
|
-
|
2981
|
-
/* > Flex > ComponentIcon */
|
2982
|
-
> div > div:first-child {
|
2983
|
-
background: ${({ theme }) => theme.colors.primary200};
|
2984
|
-
color: ${({ theme }) => theme.colors.primary600};
|
2985
|
-
}
|
3184
|
+
color: ${({ theme }) => theme.colors.primary600};
|
2986
3185
|
}
|
2987
3186
|
`;
|
2988
3187
|
const ComponentPicker = ({
|
@@ -2991,19 +3190,8 @@ const ComponentPicker = ({
|
|
2991
3190
|
onClickAddComponent
|
2992
3191
|
}) => {
|
2993
3192
|
const { formatMessage } = reactIntl.useIntl();
|
2994
|
-
const [categoryToOpen, setCategoryToOpen] = React__namespace.useState("");
|
2995
|
-
React__namespace.useEffect(() => {
|
2996
|
-
const categoryKeys = Object.keys(dynamicComponentsByCategory);
|
2997
|
-
if (isOpen && categoryKeys.length > 0) {
|
2998
|
-
setCategoryToOpen(categoryKeys[0]);
|
2999
|
-
}
|
3000
|
-
}, [isOpen, dynamicComponentsByCategory]);
|
3001
3193
|
const handleAddComponentToDz = (componentUid) => () => {
|
3002
3194
|
onClickAddComponent(componentUid);
|
3003
|
-
setCategoryToOpen("");
|
3004
|
-
};
|
3005
|
-
const handleClickToggle = (categoryName) => {
|
3006
|
-
setCategoryToOpen((currentCat) => currentCat === categoryName ? "" : categoryName);
|
3007
3195
|
};
|
3008
3196
|
if (!isOpen) {
|
3009
3197
|
return null;
|
@@ -3024,14 +3212,12 @@ const ComponentPicker = ({
|
|
3024
3212
|
id: index.getTranslation("components.DynamicZone.ComponentPicker-label"),
|
3025
3213
|
defaultMessage: "Pick one component"
|
3026
3214
|
}) }) }),
|
3027
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
3215
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Root, { defaultValue: Object.keys(dynamicComponentsByCategory)[0], children: Object.entries(dynamicComponentsByCategory).map(([category, components], index2) => /* @__PURE__ */ jsxRuntime.jsx(
|
3028
3216
|
ComponentCategory,
|
3029
3217
|
{
|
3030
3218
|
category,
|
3031
3219
|
components,
|
3032
3220
|
onAddComponent: handleAddComponentToDz,
|
3033
|
-
isOpen: category === categoryToOpen,
|
3034
|
-
onToggle: handleClickToggle,
|
3035
3221
|
variant: index2 % 2 === 1 ? "primary" : "secondary"
|
3036
3222
|
},
|
3037
3223
|
category
|
@@ -3046,27 +3232,21 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
|
|
3046
3232
|
id: "components.NotAllowedInput.text",
|
3047
3233
|
defaultMessage: "No permissions to see this field"
|
3048
3234
|
});
|
3049
|
-
return /* @__PURE__ */ jsxRuntime.
|
3050
|
-
designSystem.
|
3051
|
-
|
3052
|
-
|
3053
|
-
|
3054
|
-
|
3055
|
-
|
3056
|
-
|
3057
|
-
|
3058
|
-
|
3059
|
-
|
3060
|
-
|
3061
|
-
|
3062
|
-
|
3063
|
-
);
|
3235
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { id: name2, hint, name: name2, required, children: [
|
3236
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
|
3237
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3238
|
+
designSystem.TextInput,
|
3239
|
+
{
|
3240
|
+
disabled: true,
|
3241
|
+
placeholder,
|
3242
|
+
startAction: /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, { fill: "neutral600" }),
|
3243
|
+
type: "text",
|
3244
|
+
value: ""
|
3245
|
+
}
|
3246
|
+
),
|
3247
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
3248
|
+
] });
|
3064
3249
|
};
|
3065
|
-
const StyledIcon = styled__default.default(Icons.EyeStriked)`
|
3066
|
-
& > path {
|
3067
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
3068
|
-
}
|
3069
|
-
`;
|
3070
3250
|
function useDebounce(value, delay) {
|
3071
3251
|
const [debouncedValue, setDebouncedValue] = React.useState(value);
|
3072
3252
|
React.useEffect(() => {
|
@@ -3119,188 +3299,193 @@ const uidApi = index.contentManagerApi.injectEndpoints({
|
|
3119
3299
|
});
|
3120
3300
|
const { useGenerateUIDMutation, useGetDefaultUIDQuery, useGetAvailabilityQuery } = uidApi;
|
3121
3301
|
const UID_REGEX = /^[A-Za-z0-9-_.~]*$/;
|
3122
|
-
const UIDInput = React__namespace.forwardRef(
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
field: props.name,
|
3142
|
-
data: {
|
3143
|
-
id: id ?? "",
|
3144
|
-
...allFormValues
|
3145
|
-
},
|
3146
|
-
params
|
3147
|
-
},
|
3148
|
-
{
|
3149
|
-
skip: field.value || !props.required
|
3150
|
-
}
|
3151
|
-
);
|
3152
|
-
React__namespace.useEffect(() => {
|
3153
|
-
if (apiError) {
|
3154
|
-
toggleNotification({
|
3155
|
-
type: "warning",
|
3156
|
-
message: formatAPIError(apiError)
|
3157
|
-
});
|
3158
|
-
}
|
3159
|
-
}, [apiError, formatAPIError, toggleNotification]);
|
3160
|
-
React__namespace.useEffect(() => {
|
3161
|
-
if (defaultGeneratedUID && field.value === void 0) {
|
3162
|
-
field.onChange(props.name, defaultGeneratedUID);
|
3163
|
-
}
|
3164
|
-
}, [defaultGeneratedUID, field, props.name]);
|
3165
|
-
const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
|
3166
|
-
const handleRegenerateClick = async () => {
|
3167
|
-
try {
|
3168
|
-
const res = await generateUID({
|
3302
|
+
const UIDInput = React__namespace.forwardRef(
|
3303
|
+
({ hint, label, labelAction, name: name2, required, ...props }, ref) => {
|
3304
|
+
const { model, id } = index.useDoc();
|
3305
|
+
const allFormValues = strapiAdmin.useForm("InputUID", (form) => form.values);
|
3306
|
+
const [availability, setAvailability] = React__namespace.useState();
|
3307
|
+
const [showRegenerate, setShowRegenerate] = React__namespace.useState(false);
|
3308
|
+
const field = strapiAdmin.useField(name2);
|
3309
|
+
const debouncedValue = useDebounce(field.value, 300);
|
3310
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
3311
|
+
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
3312
|
+
const { formatMessage } = reactIntl.useIntl();
|
3313
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
3314
|
+
const params = React__namespace.useMemo(() => index.buildValidParams(query), [query]);
|
3315
|
+
const {
|
3316
|
+
data: defaultGeneratedUID,
|
3317
|
+
isLoading: isGeneratingDefaultUID,
|
3318
|
+
error: apiError
|
3319
|
+
} = useGetDefaultUIDQuery(
|
3320
|
+
{
|
3169
3321
|
contentTypeUID: model,
|
3170
|
-
field:
|
3171
|
-
data: {
|
3322
|
+
field: name2,
|
3323
|
+
data: {
|
3324
|
+
id: id ?? "",
|
3325
|
+
...allFormValues
|
3326
|
+
},
|
3172
3327
|
params
|
3173
|
-
}
|
3174
|
-
|
3175
|
-
field.
|
3176
|
-
}
|
3328
|
+
},
|
3329
|
+
{
|
3330
|
+
skip: field.value || !required
|
3331
|
+
}
|
3332
|
+
);
|
3333
|
+
React__namespace.useEffect(() => {
|
3334
|
+
if (apiError) {
|
3177
3335
|
toggleNotification({
|
3178
|
-
type: "
|
3179
|
-
message: formatAPIError(
|
3336
|
+
type: "warning",
|
3337
|
+
message: formatAPIError(apiError)
|
3180
3338
|
});
|
3181
3339
|
}
|
3182
|
-
}
|
3183
|
-
|
3184
|
-
|
3185
|
-
|
3186
|
-
|
3187
|
-
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
message: formatAPIError(availabilityError)
|
3214
|
-
});
|
3215
|
-
}
|
3216
|
-
}, [availabilityError, formatAPIError, toggleNotification]);
|
3217
|
-
React__namespace.useEffect(() => {
|
3218
|
-
setAvailability(availabilityData);
|
3219
|
-
let timer;
|
3220
|
-
if (availabilityData?.isAvailable) {
|
3221
|
-
timer = window.setTimeout(() => {
|
3222
|
-
setAvailability(void 0);
|
3223
|
-
}, 4e3);
|
3224
|
-
}
|
3225
|
-
return () => {
|
3226
|
-
if (timer) {
|
3227
|
-
clearTimeout(timer);
|
3340
|
+
}, [apiError, formatAPIError, toggleNotification]);
|
3341
|
+
React__namespace.useEffect(() => {
|
3342
|
+
if (defaultGeneratedUID && field.value === void 0) {
|
3343
|
+
field.onChange(name2, defaultGeneratedUID);
|
3344
|
+
}
|
3345
|
+
}, [defaultGeneratedUID, field, name2]);
|
3346
|
+
const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();
|
3347
|
+
const handleRegenerateClick = async () => {
|
3348
|
+
try {
|
3349
|
+
const res = await generateUID({
|
3350
|
+
contentTypeUID: model,
|
3351
|
+
field: name2,
|
3352
|
+
data: { id: id ?? "", ...allFormValues },
|
3353
|
+
params
|
3354
|
+
});
|
3355
|
+
if ("data" in res) {
|
3356
|
+
field.onChange(name2, res.data);
|
3357
|
+
} else {
|
3358
|
+
toggleNotification({
|
3359
|
+
type: "danger",
|
3360
|
+
message: formatAPIError(res.error)
|
3361
|
+
});
|
3362
|
+
}
|
3363
|
+
} catch (err) {
|
3364
|
+
toggleNotification({
|
3365
|
+
type: "danger",
|
3366
|
+
message: formatMessage({
|
3367
|
+
id: "notification.error",
|
3368
|
+
defaultMessage: "An error occurred."
|
3369
|
+
})
|
3370
|
+
});
|
3228
3371
|
}
|
3229
3372
|
};
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
// @ts-expect-error – label _could_ be a ReactNode since it's a child, this should be fixed in the DS.
|
3236
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
3237
|
-
designSystem.TextInput,
|
3373
|
+
const {
|
3374
|
+
data: availabilityData,
|
3375
|
+
isLoading: isCheckingAvailability,
|
3376
|
+
error: availabilityError
|
3377
|
+
} = useGetAvailabilityQuery(
|
3238
3378
|
{
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
|
3257
|
-
|
3258
|
-
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3379
|
+
contentTypeUID: model,
|
3380
|
+
field: name2,
|
3381
|
+
value: debouncedValue ? debouncedValue.trim() : "",
|
3382
|
+
params
|
3383
|
+
},
|
3384
|
+
{
|
3385
|
+
skip: !Boolean(
|
3386
|
+
debouncedValue !== field.initialValue && debouncedValue && UID_REGEX.test(debouncedValue.trim())
|
3387
|
+
)
|
3388
|
+
}
|
3389
|
+
);
|
3390
|
+
React__namespace.useEffect(() => {
|
3391
|
+
if (availabilityError) {
|
3392
|
+
toggleNotification({
|
3393
|
+
type: "warning",
|
3394
|
+
message: formatAPIError(availabilityError)
|
3395
|
+
});
|
3396
|
+
}
|
3397
|
+
}, [availabilityError, formatAPIError, toggleNotification]);
|
3398
|
+
React__namespace.useEffect(() => {
|
3399
|
+
setAvailability(availabilityData);
|
3400
|
+
let timer;
|
3401
|
+
if (availabilityData?.isAvailable) {
|
3402
|
+
timer = window.setTimeout(() => {
|
3403
|
+
setAvailability(void 0);
|
3404
|
+
}, 4e3);
|
3405
|
+
}
|
3406
|
+
return () => {
|
3407
|
+
if (timer) {
|
3408
|
+
clearTimeout(timer);
|
3409
|
+
}
|
3410
|
+
};
|
3411
|
+
}, [availabilityData]);
|
3412
|
+
const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
|
3413
|
+
const fieldRef = strapiAdmin.useFocusInputField(name2);
|
3414
|
+
const composedRefs = designSystem.useComposedRefs(ref, fieldRef);
|
3415
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { hint, name: name2, error: field.error, required, children: [
|
3416
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
3417
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3418
|
+
designSystem.TextInput,
|
3419
|
+
{
|
3420
|
+
ref: composedRefs,
|
3421
|
+
disabled: props.disabled,
|
3422
|
+
endAction: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { position: "relative", gap: 1, children: [
|
3423
|
+
availability && !showRegenerate && /* @__PURE__ */ jsxRuntime.jsxs(
|
3424
|
+
TextValidation,
|
3283
3425
|
{
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3426
|
+
alignItems: "center",
|
3427
|
+
gap: 1,
|
3428
|
+
justifyContent: "flex-end",
|
3429
|
+
$available: !!availability?.isAvailable,
|
3430
|
+
"data-not-here-outer": true,
|
3431
|
+
position: "absolute",
|
3432
|
+
pointerEvents: "none",
|
3433
|
+
right: 6,
|
3434
|
+
width: "100px",
|
3435
|
+
children: [
|
3436
|
+
availability?.isAvailable ? /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, {}),
|
3437
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3438
|
+
designSystem.Typography,
|
3439
|
+
{
|
3440
|
+
textColor: availability.isAvailable ? "success600" : "danger600",
|
3441
|
+
variant: "pi",
|
3442
|
+
children: formatMessage(
|
3443
|
+
availability.isAvailable ? {
|
3444
|
+
id: "content-manager.components.uid.available",
|
3445
|
+
defaultMessage: "Available"
|
3446
|
+
} : {
|
3447
|
+
id: "content-manager.components.uid.unavailable",
|
3448
|
+
defaultMessage: "Unavailable"
|
3449
|
+
}
|
3450
|
+
)
|
3451
|
+
}
|
3452
|
+
)
|
3453
|
+
]
|
3292
3454
|
}
|
3293
|
-
)
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3297
|
-
|
3298
|
-
|
3299
|
-
|
3300
|
-
|
3301
|
-
|
3302
|
-
|
3303
|
-
|
3455
|
+
),
|
3456
|
+
!props.disabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
3457
|
+
showRegenerate && /* @__PURE__ */ jsxRuntime.jsx(TextValidation, { alignItems: "center", justifyContent: "flex-end", gap: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "primary600", variant: "pi", children: formatMessage({
|
3458
|
+
id: "content-manager.components.uid.regenerate",
|
3459
|
+
defaultMessage: "Regenerate"
|
3460
|
+
}) }) }),
|
3461
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3462
|
+
FieldActionWrapper,
|
3463
|
+
{
|
3464
|
+
onClick: handleRegenerateClick,
|
3465
|
+
label: formatMessage({
|
3466
|
+
id: "content-manager.components.uid.regenerate",
|
3467
|
+
defaultMessage: "Regenerate"
|
3468
|
+
}),
|
3469
|
+
onMouseEnter: () => setShowRegenerate(true),
|
3470
|
+
onMouseLeave: () => setShowRegenerate(false),
|
3471
|
+
children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingWrapper, { "data-testid": "loading-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Loader, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(Icons.ArrowClockwise, {})
|
3472
|
+
}
|
3473
|
+
)
|
3474
|
+
] })
|
3475
|
+
] }),
|
3476
|
+
onChange: field.onChange,
|
3477
|
+
value: field.value ?? "",
|
3478
|
+
...props
|
3479
|
+
}
|
3480
|
+
),
|
3481
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {}),
|
3482
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
3483
|
+
] });
|
3484
|
+
}
|
3485
|
+
);
|
3486
|
+
const FieldActionWrapper = styledComponents.styled(designSystem.Field.Action)`
|
3487
|
+
width: 1.6rem;
|
3488
|
+
|
3304
3489
|
svg {
|
3305
3490
|
height: 1.6rem;
|
3306
3491
|
width: 1.6rem;
|
@@ -3315,17 +3500,17 @@ const FieldActionWrapper = styled__default.default(designSystem.FieldAction)`
|
|
3315
3500
|
}
|
3316
3501
|
}
|
3317
3502
|
`;
|
3318
|
-
const TextValidation =
|
3503
|
+
const TextValidation = styledComponents.styled(designSystem.Flex)`
|
3319
3504
|
svg {
|
3320
3505
|
height: 1.2rem;
|
3321
3506
|
width: 1.2rem;
|
3322
3507
|
|
3323
3508
|
path {
|
3324
|
-
fill: ${({ theme, available }) => available ? theme.colors.success600 : theme.colors.danger600};
|
3509
|
+
fill: ${({ theme, $available }) => $available ? theme.colors.success600 : theme.colors.danger600};
|
3325
3510
|
}
|
3326
3511
|
}
|
3327
3512
|
`;
|
3328
|
-
const rotation =
|
3513
|
+
const rotation = styledComponents.keyframes`
|
3329
3514
|
from {
|
3330
3515
|
transform: rotate(0deg);
|
3331
3516
|
}
|
@@ -3333,9 +3518,10 @@ const rotation = styled.keyframes`
|
|
3333
3518
|
transform: rotate(359deg);
|
3334
3519
|
}
|
3335
3520
|
`;
|
3336
|
-
const LoadingWrapper =
|
3521
|
+
const LoadingWrapper = styledComponents.styled(designSystem.Flex)`
|
3337
3522
|
animation: ${rotation} 2s infinite linear;
|
3338
3523
|
`;
|
3524
|
+
const MemoizedUIDInput = React__namespace.memo(UIDInput);
|
3339
3525
|
const md = new Markdown__default.default({
|
3340
3526
|
html: true,
|
3341
3527
|
// Enable HTML tags in source
|
@@ -3378,7 +3564,7 @@ const PreviewWysiwyg = ({ data = "" }) => {
|
|
3378
3564
|
);
|
3379
3565
|
return /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: html } }) });
|
3380
3566
|
};
|
3381
|
-
const Wrapper =
|
3567
|
+
const Wrapper = styledComponents.styled.div`
|
3382
3568
|
position: absolute;
|
3383
3569
|
top: 0;
|
3384
3570
|
width: 100%;
|
@@ -3670,17 +3856,17 @@ const Editor = React__namespace.forwardRef(
|
|
3670
3856
|
[editorRef]
|
3671
3857
|
);
|
3672
3858
|
return /* @__PURE__ */ jsxRuntime.jsxs(EditorAndPreviewWrapper, { children: [
|
3673
|
-
/* @__PURE__ */ jsxRuntime.jsx(EditorStylesContainer, { isExpandMode, disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsxRuntime.jsx("textarea", { ref: textareaRef }) }),
|
3859
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorStylesContainer, { $isExpandMode: isExpandMode, $disabled: disabled || isPreviewMode, children: /* @__PURE__ */ jsxRuntime.jsx("textarea", { ref: textareaRef }) }),
|
3674
3860
|
isPreviewMode && /* @__PURE__ */ jsxRuntime.jsx(PreviewWysiwyg, { data: value })
|
3675
3861
|
] });
|
3676
3862
|
}
|
3677
3863
|
);
|
3678
|
-
const EditorAndPreviewWrapper =
|
3864
|
+
const EditorAndPreviewWrapper = styledComponents.styled.div`
|
3679
3865
|
position: relative;
|
3680
3866
|
height: calc(100% - 48px);
|
3681
3867
|
`;
|
3682
|
-
const EditorStylesContainer =
|
3683
|
-
cursor: ${({ disabled }) => disabled ? "not-allowed !important" : "auto"};
|
3868
|
+
const EditorStylesContainer = styledComponents.styled.div`
|
3869
|
+
cursor: ${({ $disabled }) => $disabled ? "not-allowed !important" : "auto"};
|
3684
3870
|
height: 100%;
|
3685
3871
|
/* BASICS */
|
3686
3872
|
.CodeMirror-placeholder {
|
@@ -3690,7 +3876,7 @@ const EditorStylesContainer = styled__default.default.div`
|
|
3690
3876
|
.CodeMirror {
|
3691
3877
|
/* Set height, width, borders, and global font properties here */
|
3692
3878
|
font-size: 1.4rem;
|
3693
|
-
height: ${({ isExpandMode }) => isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
|
3879
|
+
height: ${({ $isExpandMode }) => $isExpandMode ? "100%" : "410px"}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border
|
3694
3880
|
color: ${({ theme }) => theme.colors.neutral800};
|
3695
3881
|
direction: ltr;
|
3696
3882
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
@@ -4096,13 +4282,13 @@ const EditorLayout = ({
|
|
4096
4282
|
}
|
4097
4283
|
);
|
4098
4284
|
};
|
4099
|
-
const ExpandWrapper =
|
4285
|
+
const ExpandWrapper = styledComponents.styled(designSystem.Flex)`
|
4100
4286
|
background: ${({ theme }) => `${theme.colors.neutral800}${Math.floor(0.2 * 255).toString(16).padStart(2, "0")}`};
|
4101
4287
|
`;
|
4102
|
-
const BoxWithBorder =
|
4288
|
+
const BoxWithBorder = styledComponents.styled(designSystem.Box)`
|
4103
4289
|
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
4104
4290
|
`;
|
4105
|
-
const ExpandButton$1 =
|
4291
|
+
const ExpandButton$1 = styledComponents.styled(designSystem.BaseButton)`
|
4106
4292
|
background-color: transparent;
|
4107
4293
|
border: none;
|
4108
4294
|
align-items: center;
|
@@ -4373,26 +4559,24 @@ const quoteAndCodeHandler = (editor, markdownType) => {
|
|
4373
4559
|
insertWithoutTextToEdit(editor, markdownType, line, contentLength);
|
4374
4560
|
}
|
4375
4561
|
};
|
4376
|
-
const CustomIconButton =
|
4562
|
+
const CustomIconButton = styledComponents.styled(designSystem.IconButton)`
|
4377
4563
|
padding: ${({ theme }) => theme.spaces[2]};
|
4378
|
-
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
4379
|
-
outline-offset: -2px !important;
|
4380
4564
|
|
4381
4565
|
svg {
|
4382
4566
|
width: 1.8rem;
|
4383
4567
|
height: 1.8rem;
|
4384
4568
|
}
|
4385
4569
|
`;
|
4386
|
-
const CustomLinkIconButton =
|
4570
|
+
const CustomLinkIconButton = styledComponents.styled(CustomIconButton)`
|
4387
4571
|
svg {
|
4388
4572
|
width: 0.8rem;
|
4389
4573
|
height: 0.8rem;
|
4390
4574
|
}
|
4391
4575
|
`;
|
4392
|
-
const MainButtons =
|
4576
|
+
const MainButtons = styledComponents.styled(designSystem.IconButtonGroup)`
|
4393
4577
|
margin-left: ${({ theme }) => theme.spaces[4]};
|
4394
4578
|
`;
|
4395
|
-
const MoreButton =
|
4579
|
+
const MoreButton = styledComponents.styled(designSystem.IconButton)`
|
4396
4580
|
margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
|
4397
4581
|
padding: ${({ theme }) => theme.spaces[2]};
|
4398
4582
|
|
@@ -4401,10 +4585,10 @@ const MoreButton = styled__default.default(designSystem.IconButton)`
|
|
4401
4585
|
height: 1.8rem;
|
4402
4586
|
}
|
4403
4587
|
`;
|
4404
|
-
const IconButtonGroupMargin =
|
4588
|
+
const IconButtonGroupMargin = styledComponents.styled(designSystem.IconButtonGroup)`
|
4405
4589
|
margin-right: ${({ theme }) => `${theme.spaces[2]}`};
|
4406
4590
|
`;
|
4407
|
-
const ExpandButton =
|
4591
|
+
const ExpandButton = styledComponents.styled(designSystem.BaseButton)`
|
4408
4592
|
background-color: transparent;
|
4409
4593
|
border: none;
|
4410
4594
|
align-items: center;
|
@@ -4443,7 +4627,7 @@ const WysiwygNav = ({
|
|
4443
4627
|
id: "components.Wysiwyg.selectOptions.title",
|
4444
4628
|
defaultMessage: "Add a title"
|
4445
4629
|
});
|
4446
|
-
|
4630
|
+
React__namespace.useRef(null);
|
4447
4631
|
const handleTogglePopover = () => {
|
4448
4632
|
setVisiblePopover((prev) => !prev);
|
4449
4633
|
};
|
@@ -4456,21 +4640,21 @@ const WysiwygNav = ({
|
|
4456
4640
|
justifyContent: "space-between",
|
4457
4641
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4458
4642
|
children: [
|
4459
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
4460
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.SingleSelect, { disabled: true, placeholder: selectPlaceholder,
|
4643
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
|
4644
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SingleSelect, { disabled: true, placeholder: selectPlaceholder, "aria-label": selectPlaceholder, children: [
|
4461
4645
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h1", children: "h1" }),
|
4462
4646
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h2", children: "h2" }),
|
4463
4647
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h3", children: "h3" }),
|
4464
4648
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h4", children: "h4" }),
|
4465
4649
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h5", children: "h5" }),
|
4466
4650
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h6", children: "h6" })
|
4467
|
-
] }),
|
4651
|
+
] }) }),
|
4468
4652
|
/* @__PURE__ */ jsxRuntime.jsxs(MainButtons, { children: [
|
4469
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomIconButton, { disabled: true, label: "Bold", name: "Bold",
|
4470
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomIconButton, { disabled: true, label: "Italic", name: "Italic",
|
4471
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomIconButton, { disabled: true, label: "Underline", name: "Underline",
|
4653
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomIconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {}) }),
|
4654
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomIconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Italic, {}) }),
|
4655
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomIconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Underline, {}) })
|
4472
4656
|
] }),
|
4473
|
-
/* @__PURE__ */ jsxRuntime.jsx(MoreButton, { disabled: true, label: "More",
|
4657
|
+
/* @__PURE__ */ jsxRuntime.jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.More, {}) })
|
4474
4658
|
] }),
|
4475
4659
|
!isExpandMode && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
|
4476
4660
|
id: "components.Wysiwyg.ToggleMode.markdown-mode",
|
@@ -4488,13 +4672,12 @@ const WysiwygNav = ({
|
|
4488
4672
|
justifyContent: "space-between",
|
4489
4673
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4490
4674
|
children: [
|
4491
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
4492
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
4675
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
|
4676
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
4493
4677
|
designSystem.SingleSelect,
|
4494
4678
|
{
|
4495
4679
|
placeholder: selectPlaceholder,
|
4496
|
-
label: selectPlaceholder,
|
4497
|
-
size: "S",
|
4680
|
+
"aria-label": selectPlaceholder,
|
4498
4681
|
onChange: (value) => onActionClick(value, editorRef),
|
4499
4682
|
children: [
|
4500
4683
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h1", children: "h1" }),
|
@@ -4505,7 +4688,7 @@ const WysiwygNav = ({
|
|
4505
4688
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h6", children: "h6" })
|
4506
4689
|
]
|
4507
4690
|
}
|
4508
|
-
),
|
4691
|
+
) }),
|
4509
4692
|
/* @__PURE__ */ jsxRuntime.jsxs(MainButtons, { children: [
|
4510
4693
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4511
4694
|
CustomIconButton,
|
@@ -4513,7 +4696,7 @@ const WysiwygNav = ({
|
|
4513
4696
|
onClick: () => onActionClick("Bold", editorRef),
|
4514
4697
|
label: "Bold",
|
4515
4698
|
name: "Bold",
|
4516
|
-
|
4699
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {})
|
4517
4700
|
}
|
4518
4701
|
),
|
4519
4702
|
/* @__PURE__ */ jsxRuntime.jsx(
|
@@ -4522,7 +4705,7 @@ const WysiwygNav = ({
|
|
4522
4705
|
onClick: () => onActionClick("Italic", editorRef),
|
4523
4706
|
label: "Italic",
|
4524
4707
|
name: "Italic",
|
4525
|
-
|
4708
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Italic, {})
|
4526
4709
|
}
|
4527
4710
|
),
|
4528
4711
|
/* @__PURE__ */ jsxRuntime.jsx(
|
@@ -4531,91 +4714,85 @@ const WysiwygNav = ({
|
|
4531
4714
|
onClick: () => onActionClick("Underline", editorRef),
|
4532
4715
|
label: "Underline",
|
4533
4716
|
name: "Underline",
|
4534
|
-
|
4717
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Underline, {})
|
4535
4718
|
}
|
4536
4719
|
)
|
4537
4720
|
] }),
|
4538
|
-
/* @__PURE__ */ jsxRuntime.
|
4539
|
-
MoreButton,
|
4540
|
-
{
|
4541
|
-
|
4542
|
-
|
4543
|
-
|
4544
|
-
|
4545
|
-
|
4546
|
-
|
4547
|
-
|
4548
|
-
|
4549
|
-
|
4550
|
-
|
4551
|
-
|
4552
|
-
|
4553
|
-
|
4554
|
-
|
4555
|
-
|
4556
|
-
|
4557
|
-
|
4558
|
-
|
4559
|
-
|
4560
|
-
|
4561
|
-
|
4562
|
-
|
4563
|
-
|
4564
|
-
|
4565
|
-
|
4566
|
-
|
4567
|
-
|
4568
|
-
|
4569
|
-
|
4570
|
-
|
4571
|
-
|
4572
|
-
|
4573
|
-
|
4574
|
-
|
4575
|
-
|
4576
|
-
|
4577
|
-
|
4578
|
-
|
4579
|
-
|
4580
|
-
|
4581
|
-
|
4582
|
-
|
4583
|
-
|
4584
|
-
|
4585
|
-
|
4586
|
-
|
4587
|
-
|
4588
|
-
|
4589
|
-
|
4590
|
-
|
4591
|
-
|
4592
|
-
|
4593
|
-
|
4594
|
-
|
4595
|
-
|
4596
|
-
|
4597
|
-
|
4598
|
-
|
4599
|
-
|
4600
|
-
|
4601
|
-
|
4602
|
-
|
4603
|
-
|
4604
|
-
|
4605
|
-
|
4606
|
-
|
4607
|
-
|
4608
|
-
|
4609
|
-
|
4610
|
-
|
4611
|
-
|
4612
|
-
|
4613
|
-
name: "Quote",
|
4614
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Quotes, {})
|
4615
|
-
}
|
4616
|
-
)
|
4617
|
-
] })
|
4618
|
-
] }) })
|
4721
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { children: [
|
4722
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(MoreButton, { label: "More", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.More, {}) }) }),
|
4723
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 2, children: [
|
4724
|
+
/* @__PURE__ */ jsxRuntime.jsxs(IconButtonGroupMargin, { children: [
|
4725
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4726
|
+
CustomIconButton,
|
4727
|
+
{
|
4728
|
+
onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
|
4729
|
+
label: "Strikethrough",
|
4730
|
+
name: "Strikethrough",
|
4731
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.StrikeThrough, {})
|
4732
|
+
}
|
4733
|
+
),
|
4734
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4735
|
+
CustomIconButton,
|
4736
|
+
{
|
4737
|
+
onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
|
4738
|
+
label: "BulletList",
|
4739
|
+
name: "BulletList",
|
4740
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.BulletList, {})
|
4741
|
+
}
|
4742
|
+
),
|
4743
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4744
|
+
CustomIconButton,
|
4745
|
+
{
|
4746
|
+
onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
|
4747
|
+
label: "NumberList",
|
4748
|
+
name: "NumberList",
|
4749
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.NumberList, {})
|
4750
|
+
}
|
4751
|
+
)
|
4752
|
+
] }),
|
4753
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.IconButtonGroup, { children: [
|
4754
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4755
|
+
CustomIconButton,
|
4756
|
+
{
|
4757
|
+
onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
|
4758
|
+
label: "Code",
|
4759
|
+
name: "Code",
|
4760
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Code, {})
|
4761
|
+
}
|
4762
|
+
),
|
4763
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4764
|
+
CustomIconButton,
|
4765
|
+
{
|
4766
|
+
onClick: () => {
|
4767
|
+
handleTogglePopover();
|
4768
|
+
onToggleMediaLib();
|
4769
|
+
},
|
4770
|
+
label: "Image",
|
4771
|
+
name: "Image",
|
4772
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Image, {})
|
4773
|
+
}
|
4774
|
+
),
|
4775
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4776
|
+
CustomLinkIconButton,
|
4777
|
+
{
|
4778
|
+
onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
|
4779
|
+
label: "Link",
|
4780
|
+
name: "Link",
|
4781
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Link, {})
|
4782
|
+
}
|
4783
|
+
),
|
4784
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4785
|
+
CustomIconButton,
|
4786
|
+
{
|
4787
|
+
onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
|
4788
|
+
label: "Quote",
|
4789
|
+
name: "Quote",
|
4790
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Quotes, {})
|
4791
|
+
}
|
4792
|
+
)
|
4793
|
+
] })
|
4794
|
+
] }) })
|
4795
|
+
] })
|
4619
4796
|
] }),
|
4620
4797
|
onTogglePreviewMode && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
|
4621
4798
|
id: "components.Wysiwyg.ToggleMode.preview-mode",
|
@@ -4625,19 +4802,6 @@ const WysiwygNav = ({
|
|
4625
4802
|
}
|
4626
4803
|
);
|
4627
4804
|
};
|
4628
|
-
const StyledFlex = styled__default.default(designSystem.Flex)`
|
4629
|
-
/* Hide the label, every input needs a label. */
|
4630
|
-
label {
|
4631
|
-
border: 0;
|
4632
|
-
clip: rect(0 0 0 0);
|
4633
|
-
height: 1px;
|
4634
|
-
margin: -1px;
|
4635
|
-
overflow: hidden;
|
4636
|
-
padding: 0;
|
4637
|
-
position: absolute;
|
4638
|
-
width: 1px;
|
4639
|
-
}
|
4640
|
-
`;
|
4641
4805
|
const Wysiwyg = React__namespace.forwardRef(
|
4642
4806
|
({ hint, disabled, label, name: name2, placeholder, required, labelAction }, forwardedRef) => {
|
4643
4807
|
const field = strapiAdmin.useField(name2);
|
@@ -4696,15 +4860,15 @@ const Wysiwyg = React__namespace.forwardRef(
|
|
4696
4860
|
const handleSelectAssets = (files) => {
|
4697
4861
|
const formattedFiles = files.map((f) => ({
|
4698
4862
|
alt: f.alternativeText || f.name,
|
4699
|
-
url:
|
4863
|
+
url: usePrev.prefixFileUrlWithBackendUrl(f.url),
|
4700
4864
|
mime: f.mime
|
4701
4865
|
}));
|
4702
4866
|
insertFile(editorRef, formattedFiles);
|
4703
4867
|
setMediaLibVisible(false);
|
4704
4868
|
};
|
4705
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field, { name: name2, hint, error: field.error, required, children: [
|
4869
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: name2, hint, error: field.error, required, children: [
|
4706
4870
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
4707
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
4871
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
4708
4872
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
4709
4873
|
EditorLayout,
|
4710
4874
|
{
|
@@ -4745,14 +4909,15 @@ const Wysiwyg = React__namespace.forwardRef(
|
|
4745
4909
|
]
|
4746
4910
|
}
|
4747
4911
|
),
|
4748
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
4749
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
4912
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
4913
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
4750
4914
|
] }),
|
4751
4915
|
mediaLibVisible && // @ts-expect-error – TODO: fix this way of injecting because it's not really typeable without a registry.
|
4752
4916
|
/* @__PURE__ */ jsxRuntime.jsx(MediaLibraryDialog, { onClose: handleToggleMediaLib, onSelectAssets: handleSelectAssets })
|
4753
4917
|
] });
|
4754
4918
|
}
|
4755
4919
|
);
|
4920
|
+
const MemoizedWysiwyg = React__namespace.memo(Wysiwyg);
|
4756
4921
|
const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
4757
4922
|
const { id } = index.useDoc();
|
4758
4923
|
const isFormDisabled = strapiAdmin.useForm("InputRenderer", (state) => state.disabled);
|
@@ -4802,10 +4967,10 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4802
4967
|
}
|
4803
4968
|
switch (props.type) {
|
4804
4969
|
case "blocks":
|
4805
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
4970
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MemoizedBlocksInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4806
4971
|
case "component":
|
4807
4972
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
4808
|
-
|
4973
|
+
MemoizedComponentInput,
|
4809
4974
|
{
|
4810
4975
|
...props,
|
4811
4976
|
hint,
|
@@ -4817,11 +4982,11 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4817
4982
|
case "dynamiczone":
|
4818
4983
|
return /* @__PURE__ */ jsxRuntime.jsx(DynamicZone, { ...props, hint, disabled: fieldIsDisabled });
|
4819
4984
|
case "relation":
|
4820
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Relations.
|
4985
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Relations.MemoizedRelationsField, { ...props, hint, disabled: fieldIsDisabled });
|
4821
4986
|
case "richtext":
|
4822
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
4987
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MemoizedWysiwyg, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4823
4988
|
case "uid":
|
4824
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
4989
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MemoizedUIDInput, { ...props, hint, type: props.type, disabled: fieldIsDisabled });
|
4825
4990
|
case "enumeration":
|
4826
4991
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
4827
4992
|
strapiAdmin.InputRenderer,
|
@@ -4893,6 +5058,7 @@ const getMinMax = (attribute) => {
|
|
4893
5058
|
return { maximum: void 0, minimum: void 0 };
|
4894
5059
|
}
|
4895
5060
|
};
|
5061
|
+
const MemoizedInputRenderer = React.memo(InputRenderer);
|
4896
5062
|
const DynamicComponent = ({
|
4897
5063
|
componentUid,
|
4898
5064
|
disabled,
|
@@ -4906,7 +5072,6 @@ const DynamicComponent = ({
|
|
4906
5072
|
dynamicComponentsByCategory = {},
|
4907
5073
|
onAddComponent
|
4908
5074
|
}) => {
|
4909
|
-
const [isOpen, setIsOpen] = React__namespace.useState(true);
|
4910
5075
|
const { formatMessage } = reactIntl.useIntl();
|
4911
5076
|
const formValues = strapiAdmin.useForm("DynamicComponent", (state) => state.values);
|
4912
5077
|
const {
|
@@ -4915,7 +5080,7 @@ const DynamicComponent = ({
|
|
4915
5080
|
const title = React__namespace.useMemo(() => {
|
4916
5081
|
const { mainField } = components[componentUid]?.settings ?? { mainField: "id" };
|
4917
5082
|
const mainFieldValue = objects.getIn(formValues, `${name2}.${index$1}.${mainField}`);
|
4918
|
-
const displayedValue = mainField === "id" ? "" : String(mainFieldValue).trim();
|
5083
|
+
const displayedValue = mainField === "id" || !mainFieldValue ? "" : String(mainFieldValue).trim();
|
4919
5084
|
const mainValue = displayedValue.length > 0 ? `- ${displayedValue}` : displayedValue;
|
4920
5085
|
return mainValue;
|
4921
5086
|
}, [componentUid, components, formValues, name2, index$1]);
|
@@ -4926,9 +5091,6 @@ const DynamicComponent = ({
|
|
4926
5091
|
) ?? { icon: null, displayName: null };
|
4927
5092
|
return { icon: icon2, displayName: displayName2 };
|
4928
5093
|
}, [componentUid, dynamicComponentsByCategory]);
|
4929
|
-
const handleToggle = () => {
|
4930
|
-
setIsOpen((s) => !s);
|
4931
|
-
};
|
4932
5094
|
const [{ handlerId, isDragging, handleKeyDown }, boxRef, dropRef, dragRef, dragPreviewRef] = useDragAndDrop.useDragAndDrop(!disabled, {
|
4933
5095
|
type: `${useDragAndDrop.ItemTypes.DYNAMIC_ZONE}_${name2}`,
|
4934
5096
|
index: index$1,
|
@@ -4946,9 +5108,9 @@ const DynamicComponent = ({
|
|
4946
5108
|
dragPreviewRef(reactDndHtml5Backend.getEmptyImage(), { captureDraggingState: false });
|
4947
5109
|
}, [dragPreviewRef, index$1]);
|
4948
5110
|
const composedBoxRefs = designSystem.useComposedRefs(boxRef, dropRef);
|
4949
|
-
const accordionActions = disabled ? null : /* @__PURE__ */ jsxRuntime.jsxs(
|
5111
|
+
const accordionActions = disabled ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
4950
5112
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4951
|
-
|
5113
|
+
designSystem.IconButton,
|
4952
5114
|
{
|
4953
5115
|
borderWidth: 0,
|
4954
5116
|
label: formatMessage(
|
@@ -4965,10 +5127,7 @@ const DynamicComponent = ({
|
|
4965
5127
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4966
5128
|
designSystem.IconButton,
|
4967
5129
|
{
|
4968
|
-
forwardedAs: "div",
|
4969
|
-
role: "button",
|
4970
5130
|
borderWidth: 0,
|
4971
|
-
tabIndex: 0,
|
4972
5131
|
onClick: (e) => e.stopPropagation(),
|
4973
5132
|
"data-handler-id": handlerId,
|
4974
5133
|
ref: dragRef,
|
@@ -4983,7 +5142,7 @@ const DynamicComponent = ({
|
|
4983
5142
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
4984
5143
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Trigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
|
4985
5144
|
/* @__PURE__ */ jsxRuntime.jsx(Icons.More, { "aria-hidden": true, focusable: false }),
|
4986
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, {
|
5145
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { tag: "span", children: formatMessage({
|
4987
5146
|
id: index.getTranslation("components.DynamicZone.more-actions"),
|
4988
5147
|
defaultMessage: "More actions"
|
4989
5148
|
}) })
|
@@ -5012,62 +5171,48 @@ const DynamicComponent = ({
|
|
5012
5171
|
] })
|
5013
5172
|
] })
|
5014
5173
|
] });
|
5015
|
-
|
5174
|
+
const accordionTitle = title ? `${displayName} ${title}` : displayName;
|
5175
|
+
const accordionValue = React__namespace.useId();
|
5176
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
|
5016
5177
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Rectangle, { background: "neutral200" }) }),
|
5017
|
-
/* @__PURE__ */ jsxRuntime.jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview, {}) : /* @__PURE__ */ jsxRuntime.
|
5018
|
-
/* @__PURE__ */ jsxRuntime.
|
5019
|
-
|
5020
|
-
|
5021
|
-
|
5022
|
-
|
5023
|
-
|
5024
|
-
|
5025
|
-
|
5026
|
-
|
5027
|
-
|
5178
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: accordionValue, children: [
|
5179
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
|
5180
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
5181
|
+
designSystem.Accordion.Trigger,
|
5182
|
+
{
|
5183
|
+
icon: icon && ComponentIcon.COMPONENT_ICONS[icon] ? ComponentIcon.COMPONENT_ICONS[icon] : ComponentIcon.COMPONENT_ICONS.dashboard,
|
5184
|
+
children: accordionTitle
|
5185
|
+
}
|
5186
|
+
),
|
5187
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Actions, { children: accordionActions })
|
5188
|
+
] }),
|
5189
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
5028
5190
|
const fieldName = `${name2}.${index$1}.${field.name}`;
|
5029
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
5191
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, s: 12, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(MemoizedInputRenderer, { ...field, name: fieldName }) }, fieldName);
|
5030
5192
|
}) }, rowInd)) }) }) })
|
5031
|
-
] }) })
|
5193
|
+
] }) }) })
|
5032
5194
|
] });
|
5033
5195
|
};
|
5034
|
-
const
|
5035
|
-
/*
|
5036
|
-
we need to remove the background from the button but we can't
|
5037
|
-
wrap the element in styled because it breaks the forwardedAs which
|
5038
|
-
we need for drag handler to work on firefox
|
5039
|
-
*/
|
5040
|
-
div[role='button'] {
|
5041
|
-
background: transparent;
|
5042
|
-
}
|
5043
|
-
`;
|
5044
|
-
const IconButtonCustom = styled__default.default(designSystem.IconButton)`
|
5045
|
-
background-color: transparent;
|
5046
|
-
|
5047
|
-
svg path {
|
5048
|
-
fill: ${({ theme, expanded }) => expanded ? theme.colors.primary600 : theme.colors.neutral600};
|
5049
|
-
}
|
5050
|
-
`;
|
5051
|
-
const StyledBox = styled__default.default(designSystem.Box)`
|
5196
|
+
const StyledBox = styledComponents.styled(designSystem.Box)`
|
5052
5197
|
> div:first-child {
|
5053
5198
|
box-shadow: ${({ theme }) => theme.shadows.tableShadow};
|
5054
5199
|
}
|
5055
5200
|
`;
|
5056
|
-
const AccordionContentRadius =
|
5201
|
+
const AccordionContentRadius = styledComponents.styled(designSystem.Box)`
|
5057
5202
|
border-radius: 0 0 ${({ theme }) => theme.spaces[1]} ${({ theme }) => theme.spaces[1]};
|
5058
5203
|
`;
|
5059
|
-
const Rectangle =
|
5204
|
+
const Rectangle = styledComponents.styled(designSystem.Box)`
|
5060
5205
|
width: ${({ theme }) => theme.spaces[2]};
|
5061
5206
|
height: ${({ theme }) => theme.spaces[4]};
|
5062
5207
|
`;
|
5063
|
-
const Preview =
|
5208
|
+
const Preview = styledComponents.styled.span`
|
5064
5209
|
display: block;
|
5065
5210
|
background-color: ${({ theme }) => theme.colors.primary100};
|
5066
5211
|
outline: 1px dashed ${({ theme }) => theme.colors.primary500};
|
5067
5212
|
outline-offset: -1px;
|
5068
5213
|
padding: ${({ theme }) => theme.spaces[6]};
|
5069
5214
|
`;
|
5070
|
-
const ComponentContainer =
|
5215
|
+
const ComponentContainer = styledComponents.styled(designSystem.Box)`
|
5071
5216
|
list-style: none;
|
5072
5217
|
padding: 0;
|
5073
5218
|
margin: 0;
|
@@ -5118,7 +5263,7 @@ const [DynamicZoneProvider, useDynamicZone] = strapiAdmin.createContext(
|
|
5118
5263
|
);
|
5119
5264
|
const DynamicZone = ({
|
5120
5265
|
attribute,
|
5121
|
-
disabled,
|
5266
|
+
disabled: disabledProp,
|
5122
5267
|
hint,
|
5123
5268
|
label,
|
5124
5269
|
labelAction,
|
@@ -5128,7 +5273,8 @@ const DynamicZone = ({
|
|
5128
5273
|
const { max = Infinity, min = -Infinity } = attribute ?? {};
|
5129
5274
|
const [addComponentIsOpen, setAddComponentIsOpen] = React__namespace.useState(false);
|
5130
5275
|
const [liveText, setLiveText] = React__namespace.useState("");
|
5131
|
-
const { components } = index.useDoc();
|
5276
|
+
const { components, isLoading } = index.useDoc();
|
5277
|
+
const disabled = disabledProp || isLoading;
|
5132
5278
|
const { addFieldRow, removeFieldRow, moveFieldRow } = strapiAdmin.useForm(
|
5133
5279
|
"DynamicZone",
|
5134
5280
|
({ addFieldRow: addFieldRow2, removeFieldRow: removeFieldRow2, moveFieldRow: moveFieldRow2 }) => ({
|
@@ -5335,13 +5481,13 @@ const DynamicZone = ({
|
|
5335
5481
|
)
|
5336
5482
|
] }) });
|
5337
5483
|
};
|
5338
|
-
exports.BlocksInput = BlocksInput;
|
5339
|
-
exports.ComponentInput = ComponentInput;
|
5340
5484
|
exports.DynamicZone = DynamicZone;
|
5341
|
-
exports.
|
5485
|
+
exports.MemoizedBlocksInput = MemoizedBlocksInput;
|
5486
|
+
exports.MemoizedComponentInput = MemoizedComponentInput;
|
5487
|
+
exports.MemoizedInputRenderer = MemoizedInputRenderer;
|
5488
|
+
exports.MemoizedUIDInput = MemoizedUIDInput;
|
5489
|
+
exports.MemoizedWysiwyg = MemoizedWysiwyg;
|
5342
5490
|
exports.NotAllowedInput = NotAllowedInput;
|
5343
|
-
exports.UIDInput = UIDInput;
|
5344
|
-
exports.Wysiwyg = Wysiwyg;
|
5345
5491
|
exports.createDefaultForm = createDefaultForm;
|
5346
5492
|
exports.prepareTempKeys = prepareTempKeys;
|
5347
5493
|
exports.removeFieldsThatDontExistOnSchema = removeFieldsThatDontExistOnSchema;
|
@@ -5349,4 +5495,4 @@ exports.transformDocument = transformDocument;
|
|
5349
5495
|
exports.useDynamicZone = useDynamicZone;
|
5350
5496
|
exports.useFieldHint = useFieldHint;
|
5351
5497
|
exports.useLazyComponents = useLazyComponents;
|
5352
|
-
//# sourceMappingURL=Field-
|
5498
|
+
//# sourceMappingURL=Field-lsPFnAmH.js.map
|