@strapi/review-workflows 5.0.0-beta.6 → 5.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/_chunks/{Layout-2ZuobDLm.js → Layout-BMqtFafC.js} +6 -14
  2. package/dist/_chunks/Layout-BMqtFafC.js.map +1 -0
  3. package/dist/_chunks/{Layout-BlUjTO46.mjs → Layout-lg3hbwGL.mjs} +8 -14
  4. package/dist/_chunks/Layout-lg3hbwGL.mjs.map +1 -0
  5. package/dist/_chunks/{_id-BuJ0Ud8T.mjs → _id-B3jMqqMH.mjs} +256 -276
  6. package/dist/_chunks/_id-B3jMqqMH.mjs.map +1 -0
  7. package/dist/_chunks/{_id-yjWLof5q.js → _id-B853wt9z.js} +262 -284
  8. package/dist/_chunks/_id-B853wt9z.js.map +1 -0
  9. package/dist/_chunks/{index-sU2Cg2WW.mjs → index-BhJmjDbj.mjs} +9 -8
  10. package/dist/_chunks/index-BhJmjDbj.mjs.map +1 -0
  11. package/dist/_chunks/{index-CQGgid_7.js → index-CdU1x9cZ.js} +10 -11
  12. package/dist/_chunks/index-CdU1x9cZ.js.map +1 -0
  13. package/dist/_chunks/{index-qAnk2xH9.js → index-Ujtj1Rcp.js} +84 -137
  14. package/dist/_chunks/index-Ujtj1Rcp.js.map +1 -0
  15. package/dist/_chunks/{index-D91cCzpN.mjs → index-lebOqdrv.mjs} +86 -137
  16. package/dist/_chunks/index-lebOqdrv.mjs.map +1 -0
  17. package/dist/_chunks/{purchase-review-workflows-DyffLpyz.mjs → purchase-review-workflows-BN-5Ube7.mjs} +5 -4
  18. package/dist/_chunks/purchase-review-workflows-BN-5Ube7.mjs.map +1 -0
  19. package/dist/_chunks/{purchase-review-workflows-BaOk5p_m.js → purchase-review-workflows-DlCDg0fD.js} +4 -3
  20. package/dist/_chunks/purchase-review-workflows-DlCDg0fD.js.map +1 -0
  21. package/dist/_chunks/{router-n4oxCWpr.js → router-BboD243b.js} +3 -3
  22. package/dist/_chunks/{router-n4oxCWpr.js.map → router-BboD243b.js.map} +1 -1
  23. package/dist/_chunks/{router-DkLtLJRZ.mjs → router-CvMnSjb9.mjs} +3 -3
  24. package/dist/_chunks/{router-DkLtLJRZ.mjs.map → router-CvMnSjb9.mjs.map} +1 -1
  25. package/dist/admin/index.js +1 -1
  26. package/dist/admin/index.mjs +1 -1
  27. package/dist/admin/src/routes/settings/hooks/useDragAndDrop.d.ts +4 -4
  28. package/dist/admin/src/routes/settings/hooks/useKeyboardDragAndDrop.d.ts +1 -1
  29. package/dist/admin/src/routes/settings/hooks/useReviewWorkflows.d.ts +3 -3
  30. package/dist/admin/src/services/admin.d.ts +2 -2
  31. package/dist/admin/src/services/api.d.ts +2 -3
  32. package/dist/admin/src/services/content-manager.d.ts +6 -6
  33. package/dist/admin/src/services/settings.d.ts +4 -4
  34. package/dist/admin/src/utils/api.d.ts +4 -19
  35. package/package.json +13 -14
  36. package/dist/_chunks/Layout-2ZuobDLm.js.map +0 -1
  37. package/dist/_chunks/Layout-BlUjTO46.mjs.map +0 -1
  38. package/dist/_chunks/_id-BuJ0Ud8T.mjs.map +0 -1
  39. package/dist/_chunks/_id-yjWLof5q.js.map +0 -1
  40. package/dist/_chunks/index-CQGgid_7.js.map +0 -1
  41. package/dist/_chunks/index-D91cCzpN.mjs.map +0 -1
  42. package/dist/_chunks/index-qAnk2xH9.js.map +0 -1
  43. package/dist/_chunks/index-sU2Cg2WW.mjs.map +0 -1
  44. package/dist/_chunks/purchase-review-workflows-BaOk5p_m.js.map +0 -1
  45. package/dist/_chunks/purchase-review-workflows-DyffLpyz.mjs.map +0 -1
@@ -11,12 +11,11 @@ const reactIntl = require("react-intl");
11
11
  const reactRedux = require("react-redux");
12
12
  const reactRouterDom = require("react-router-dom");
13
13
  const yup = require("yup");
14
- const index = require("./index-qAnk2xH9.js");
15
- const Layout = require("./Layout-2ZuobDLm.js");
14
+ const index = require("./index-Ujtj1Rcp.js");
15
+ const Layout = require("./Layout-BMqtFafC.js");
16
16
  const reactDndHtml5Backend = require("react-dnd-html5-backend");
17
- const styled = require("styled-components");
17
+ const styledComponents = require("styled-components");
18
18
  const reactDnd = require("react-dnd");
19
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
20
19
  function _interopNamespace(e) {
21
20
  if (e && e.__esModule)
22
21
  return e;
@@ -37,11 +36,10 @@ function _interopNamespace(e) {
37
36
  }
38
37
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
39
38
  const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
40
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
41
39
  const adminApi = index.reviewWorkflowsApi.injectEndpoints({
42
40
  endpoints(builder) {
43
41
  return {
44
- getRoles: builder.query({
42
+ getAdminRoles: builder.query({
45
43
  query: () => ({
46
44
  url: `/admin/roles`,
47
45
  method: "GET"
@@ -53,7 +51,7 @@ const adminApi = index.reviewWorkflowsApi.injectEndpoints({
53
51
  };
54
52
  }
55
53
  });
56
- const { useGetRolesQuery } = adminApi;
54
+ const { useGetAdminRolesQuery } = adminApi;
57
55
  const useKeyboardDragAndDrop = (active, index2, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
58
56
  const [isSelected, setIsSelected] = React__namespace.useState(false);
59
57
  const handleMove = (movement) => {
@@ -272,23 +270,23 @@ const AddStage = ({ children, ...props }) => {
272
270
  return /* @__PURE__ */ jsxRuntime.jsx(
273
271
  StyledButton,
274
272
  {
275
- as: "button",
273
+ tag: "button",
276
274
  background: "neutral0",
277
- border: "neutral150",
275
+ borderColor: "neutral150",
278
276
  paddingBottom: 3,
279
277
  paddingLeft: 4,
280
278
  paddingRight: 4,
281
279
  paddingTop: 3,
282
280
  shadow: "filterShadow",
283
281
  ...props,
284
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "inherit", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { as: "span", gap: 2, children: [
282
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "span", gap: 2, children: [
285
283
  /* @__PURE__ */ jsxRuntime.jsx(icons.PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
286
284
  children
287
285
  ] }) })
288
286
  }
289
287
  );
290
288
  };
291
- const StyledButton = styled__default.default(designSystem.Box)`
289
+ const StyledButton = styledComponents.styled(designSystem.Box)`
292
290
  border-radius: 26px;
293
291
  color: ${({ theme }) => theme.colors.neutral500};
294
292
 
@@ -300,7 +298,7 @@ const StyledButton = styled__default.default(designSystem.Box)`
300
298
  color: ${({ theme }) => theme.colors.primary600};
301
299
  }
302
300
  `;
303
- const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
301
+ const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
304
302
  const { formatMessage } = reactIntl.useIntl();
305
303
  const { trackUsage } = strapiAdmin.useTracking();
306
304
  const addFieldRow = strapiAdmin.useForm("Stages", (state) => state.addFieldRow);
@@ -327,9 +325,9 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
327
325
  gap: 6,
328
326
  zIndex: 2,
329
327
  position: "relative",
330
- as: "ol",
328
+ tag: "ol",
331
329
  children: stages.map((stage, index2) => {
332
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { as: "li", children: /* @__PURE__ */ jsxRuntime.jsx(
330
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "li", children: /* @__PURE__ */ jsxRuntime.jsx(
333
331
  Stage,
334
332
  {
335
333
  index: index2,
@@ -337,7 +335,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
337
335
  canReorder: stages.length > 1,
338
336
  canUpdate,
339
337
  stagesCount: stages.length,
340
- isOpen: isCreating,
338
+ defaultOpen: isCreating,
341
339
  ...stage
342
340
  }
343
341
  ) }, stage.__temp_key__);
@@ -361,7 +359,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
361
359
  )
362
360
  ] });
363
361
  };
364
- const Background = styled__default.default(designSystem.Box)`
362
+ const Background = styledComponents.styled(designSystem.Box)`
365
363
  transform: translateX(-50%);
366
364
  `;
367
365
  const Stage = ({
@@ -369,16 +367,15 @@ const Stage = ({
369
367
  canDelete = false,
370
368
  canReorder = false,
371
369
  canUpdate = false,
372
- isOpen: isOpenDefault = false,
373
370
  stagesCount,
374
371
  name,
375
372
  permissions,
376
- color
373
+ color,
374
+ defaultOpen
377
375
  }) => {
378
376
  const [liveText, setLiveText] = React__namespace.useState();
379
377
  const { formatMessage } = reactIntl.useIntl();
380
378
  const { trackUsage } = strapiAdmin.useTracking();
381
- const [isOpen, setIsOpen] = React__namespace.useState(isOpenDefault);
382
379
  const stageErrors = strapiAdmin.useForm("Stages", (state) => state.errors.stages);
383
380
  const error = stageErrors?.[index2];
384
381
  const addFieldRow = strapiAdmin.useForm("Stage", (state) => state.addFieldRow);
@@ -460,7 +457,8 @@ const Stage = ({
460
457
  const handleCloneClick = () => {
461
458
  addFieldRow("stages", { name, color, permissions });
462
459
  };
463
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: (ref) => composedRef(ref), children: [
460
+ const id = React__namespace.useId();
461
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, children: [
464
462
  liveText && /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
465
463
  isDragging ? /* @__PURE__ */ jsxRuntime.jsx(
466
464
  designSystem.Box,
@@ -471,74 +469,61 @@ const Stage = ({
471
469
  borderWidth: "1px",
472
470
  display: "block",
473
471
  hasRadius: true,
474
- padding: 6,
475
- shadow: "tableShadow"
472
+ padding: 6
476
473
  }
477
- ) : /* @__PURE__ */ jsxRuntime.jsxs(
478
- designSystem.Accordion,
474
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
475
+ AccordionRoot,
479
476
  {
480
- size: "S",
481
- variant: "primary",
482
- onToggle: () => {
483
- setIsOpen(!isOpen);
484
- if (!isOpen) {
477
+ onValueChange: (value) => {
478
+ if (value) {
485
479
  trackUsage("willEditStage");
486
480
  }
487
481
  },
488
- expanded: isOpen,
489
- shadow: "tableShadow",
490
- error: Object.values(error ?? {})[0],
491
- hasErrorMessage: false,
492
- children: [
493
- /* @__PURE__ */ jsxRuntime.jsx(
494
- designSystem.AccordionToggle,
495
- {
496
- title: name,
497
- togglePosition: "left",
498
- action: (canDelete || canUpdate) && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
499
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
500
- /* @__PURE__ */ jsxRuntime.jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
501
- /* @__PURE__ */ jsxRuntime.jsx(icons.More, { "aria-hidden": true, focusable: false }),
502
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { as: "span", children: formatMessage({
503
- id: "[tbdb].components.DynamicZone.more-actions",
504
- defaultMessage: "More actions"
505
- }) })
506
- ] }),
507
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.SubRoot, { children: [
508
- canUpdate && /* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: handleCloneClick, children: formatMessage({
509
- id: "Settings.review-workflows.stage.delete",
510
- defaultMessage: "Duplicate stage"
511
- }) }),
512
- canDelete && /* @__PURE__ */ jsxRuntime.jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index2), children: formatMessage({
513
- id: "Settings.review-workflows.stage.delete",
514
- defaultMessage: "Delete"
515
- }) })
516
- ] }) })
482
+ defaultValue: defaultOpen ? id : void 0,
483
+ $error: Object.values(error ?? {}).length > 0,
484
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: id, children: [
485
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
486
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: name }),
487
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Actions, { children: canDelete || canUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
488
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
489
+ /* @__PURE__ */ jsxRuntime.jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
490
+ /* @__PURE__ */ jsxRuntime.jsx(icons.More, { "aria-hidden": true, focusable: false }),
491
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { tag: "span", children: formatMessage({
492
+ id: "[tbdb].components.DynamicZone.more-actions",
493
+ defaultMessage: "More actions"
494
+ }) })
517
495
  ] }),
518
- canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
519
- DragIconButton,
520
- {
521
- background: "transparent",
522
- forwardedAs: "div",
523
- hasRadius: true,
524
- role: "button",
525
- noBorder: true,
526
- tabIndex: 0,
527
- "data-handler-id": handlerId,
528
- ref: dragRef,
529
- label: formatMessage({
530
- id: "Settings.review-workflows.stage.drag",
531
- defaultMessage: "Drag"
532
- }),
533
- onClick: (e) => e.stopPropagation(),
534
- onKeyDown: handleKeyDown,
535
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, {})
536
- }
537
- )
538
- ] })
539
- }
540
- ),
541
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.AccordionContent, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: [
496
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.SubRoot, { children: [
497
+ canUpdate && /* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: handleCloneClick, children: formatMessage({
498
+ id: "Settings.review-workflows.stage.delete",
499
+ defaultMessage: "Duplicate stage"
500
+ }) }),
501
+ canDelete && /* @__PURE__ */ jsxRuntime.jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index2), children: formatMessage({
502
+ id: "Settings.review-workflows.stage.delete",
503
+ defaultMessage: "Delete"
504
+ }) })
505
+ ] }) })
506
+ ] }),
507
+ canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
508
+ designSystem.IconButton,
509
+ {
510
+ background: "transparent",
511
+ hasRadius: true,
512
+ borderWidth: 0,
513
+ "data-handler-id": handlerId,
514
+ ref: dragRef,
515
+ label: formatMessage({
516
+ id: "Settings.review-workflows.stage.drag",
517
+ defaultMessage: "Drag"
518
+ }),
519
+ onClick: (e) => e.stopPropagation(),
520
+ onKeyDown: handleKeyDown,
521
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, {})
522
+ }
523
+ )
524
+ ] }) : null })
525
+ ] }),
526
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, padding: 6, children: [
542
527
  {
543
528
  disabled: !canUpdate,
544
529
  label: formatMessage({
@@ -577,15 +562,19 @@ const Stage = ({
577
562
  type: "permissions"
578
563
  }
579
564
  ].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: size, children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
580
- ]
565
+ ] })
581
566
  }
582
567
  )
583
568
  ] });
584
569
  };
585
- const DeleteMenuItem = styled__default.default(designSystem.MenuItem)`
570
+ const AccordionRoot = styledComponents.styled(designSystem.Accordion.Root)`
571
+ border: 1px solid
572
+ ${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
573
+ `;
574
+ const DeleteMenuItem = styledComponents.styled(designSystem.MenuItem)`
586
575
  color: ${({ theme }) => theme.colors.danger600};
587
576
  `;
588
- const ContextMenuTrigger = styled__default.default(designSystem.Menu.Trigger)`
577
+ const ContextMenuTrigger = styledComponents.styled(designSystem.Menu.Trigger)`
589
578
  :hover,
590
579
  :focus {
591
580
  background-color: ${({ theme }) => theme.colors.neutral100};
@@ -595,22 +584,6 @@ const ContextMenuTrigger = styled__default.default(designSystem.Menu.Trigger)`
595
584
  font-size: 0;
596
585
  }
597
586
  `;
598
- const DragIconButton = styled__default.default(designSystem.IconButton)`
599
- align-items: center;
600
- border-radius: ${({ theme }) => theme.borderRadius};
601
- display: flex;
602
- justify-content: center;
603
-
604
- &:hover,
605
- &:focus {
606
- background-color: ${({ theme }) => theme.colors.neutral100};
607
- }
608
-
609
- svg {
610
- height: auto;
611
- width: ${({ theme }) => theme.spaces[3]};
612
- }
613
- `;
614
587
  const InputRenderer = (props) => {
615
588
  switch (props.type) {
616
589
  case "color":
@@ -636,54 +609,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
636
609
  color: hex
637
610
  }));
638
611
  const { themeColorName } = index.getStageColorByHex(value) ?? {};
639
- return /* @__PURE__ */ jsxRuntime.jsx(
640
- designSystem.SingleSelect,
641
- {
642
- disabled,
643
- error,
644
- required,
645
- label,
646
- onChange: (v) => {
647
- onChange(name, v.toString());
648
- },
649
- value: value?.toUpperCase(),
650
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(
651
- designSystem.Flex,
652
- {
653
- as: "span",
654
- height: 2,
655
- background: value,
656
- borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
657
- hasRadius: true,
658
- shrink: 0,
659
- width: 2
660
- }
661
- ),
662
- children: colorOptions.map(({ value: value2, label: label2, color }) => {
663
- const { themeColorName: themeColorName2 } = index.getStageColorByHex(color) || {};
664
- return /* @__PURE__ */ jsxRuntime.jsx(
665
- designSystem.SingleSelectOption,
612
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required, children: [
613
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
614
+ /* @__PURE__ */ jsxRuntime.jsx(
615
+ designSystem.SingleSelect,
616
+ {
617
+ disabled,
618
+ onChange: (v) => {
619
+ onChange(name, v.toString());
620
+ },
621
+ value: value?.toUpperCase(),
622
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(
623
+ designSystem.Flex,
666
624
  {
667
- value: value2,
668
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(
669
- designSystem.Flex,
670
- {
671
- as: "span",
672
- height: 2,
673
- background: color,
674
- borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
675
- hasRadius: true,
676
- shrink: 0,
677
- width: 2
678
- }
679
- ),
680
- children: label2
681
- },
682
- value2
683
- );
684
- })
685
- }
686
- );
625
+ tag: "span",
626
+ height: 2,
627
+ background: value,
628
+ borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
629
+ hasRadius: true,
630
+ shrink: 0,
631
+ width: 2
632
+ }
633
+ ),
634
+ children: colorOptions.map(({ value: value2, label: label2, color }) => {
635
+ const { themeColorName: themeColorName2 } = index.getStageColorByHex(color) || {};
636
+ return /* @__PURE__ */ jsxRuntime.jsx(
637
+ designSystem.SingleSelectOption,
638
+ {
639
+ value: value2,
640
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(
641
+ designSystem.Flex,
642
+ {
643
+ tag: "span",
644
+ height: 2,
645
+ background: color,
646
+ borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
647
+ hasRadius: true,
648
+ shrink: 0,
649
+ width: 2
650
+ }
651
+ ),
652
+ children: label2
653
+ },
654
+ value2
655
+ );
656
+ })
657
+ }
658
+ ),
659
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
660
+ ] });
687
661
  };
688
662
  const PermissionsField = ({ disabled, name, placeholder, required }) => {
689
663
  const { formatMessage } = reactIntl.useIntl();
@@ -692,7 +666,7 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
692
666
  const { value = [], error, onChange } = strapiAdmin.useField(name);
693
667
  const allStages = strapiAdmin.useForm("PermissionsField", (state) => state.values.stages);
694
668
  const onFormValueChange = strapiAdmin.useForm("PermissionsField", (state) => state.onChange);
695
- const { data: roles = [], isLoading } = useGetRolesQuery();
669
+ const { data: roles = [], isLoading } = useGetAdminRolesQuery();
696
670
  const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
697
671
  React__namespace.useEffect(() => {
698
672
  if (!isLoading && roles.length === 0) {
@@ -707,80 +681,88 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
707
681
  }
708
682
  }, [formatMessage, isLoading, roles, toggleNotification]);
709
683
  if (!isLoading && filteredRoles.length === 0) {
710
- return /* @__PURE__ */ jsxRuntime.jsx(
711
- designSystem.TextInput,
684
+ return /* @__PURE__ */ jsxRuntime.jsxs(
685
+ designSystem.Field.Root,
712
686
  {
713
- disabled: true,
714
687
  name,
715
688
  hint: formatMessage({
716
689
  id: "Settings.review-workflows.stage.permissions.noPermissions.description",
717
690
  defaultMessage: "You don’t have the permission to see roles"
718
691
  }),
719
- label: formatMessage({
720
- id: "Settings.review-workflows.stage.permissions.label",
721
- defaultMessage: "Roles that can change this stage"
722
- }),
723
- placeholder: formatMessage({
724
- id: "components.NotAllowedInput.text",
725
- defaultMessage: "No permissions to see this field"
726
- }),
727
692
  required,
728
- startAction: /* @__PURE__ */ jsxRuntime.jsx(StyledIcon, {}),
729
- type: "text",
730
- value: ""
731
- }
732
- );
733
- }
734
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
735
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "flex-end", gap: 3, children: [
736
- /* @__PURE__ */ jsxRuntime.jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
737
- designSystem.MultiSelect,
738
- {
739
- disabled,
740
- error,
741
- id: name,
742
- label: formatMessage({
693
+ children: [
694
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
743
695
  id: "Settings.review-workflows.stage.permissions.label",
744
696
  defaultMessage: "Roles that can change this stage"
745
- }),
746
- onChange: (values) => {
747
- const permissions = values.map((value2) => ({
748
- role: parseInt(value2, 10),
749
- action: "admin::review-workflows.stage.transition"
750
- }));
751
- onChange(name, permissions);
752
- },
753
- placeholder,
754
- required: true,
755
- value: value.map((permission) => `${permission.role}`),
756
- withTags: true,
757
- children: /* @__PURE__ */ jsxRuntime.jsx(
758
- designSystem.MultiSelectGroup,
697
+ }) }),
698
+ /* @__PURE__ */ jsxRuntime.jsx(
699
+ designSystem.TextInput,
759
700
  {
760
- label: formatMessage({
761
- id: "Settings.review-workflows.stage.permissions.allRoles.label",
762
- defaultMessage: "All roles"
701
+ disabled: true,
702
+ placeholder: formatMessage({
703
+ id: "components.NotAllowedInput.text",
704
+ defaultMessage: "No permissions to see this field"
763
705
  }),
764
- values: filteredRoles.map((r) => `${r.id}`),
765
- children: filteredRoles.map((role) => {
766
- return /* @__PURE__ */ jsxRuntime.jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
767
- })
706
+ startAction: /* @__PURE__ */ jsxRuntime.jsx(icons.EyeStriked, { fill: "neutral600" }),
707
+ type: "text",
708
+ value: ""
768
709
  }
769
- )
770
- }
771
- ) }),
710
+ ),
711
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
712
+ ]
713
+ }
714
+ );
715
+ }
716
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
717
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "flex-end", gap: 3, children: [
718
+ /* @__PURE__ */ jsxRuntime.jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required: true, children: [
719
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
720
+ id: "Settings.review-workflows.stage.permissions.label",
721
+ defaultMessage: "Roles that can change this stage"
722
+ }) }),
723
+ /* @__PURE__ */ jsxRuntime.jsx(
724
+ designSystem.MultiSelect,
725
+ {
726
+ disabled,
727
+ onChange: (values) => {
728
+ const permissions = values.map((value2) => ({
729
+ role: parseInt(value2, 10),
730
+ action: "admin::review-workflows.stage.transition"
731
+ }));
732
+ onChange(name, permissions);
733
+ },
734
+ placeholder,
735
+ value: value.map((permission) => `${permission.role}`),
736
+ withTags: true,
737
+ children: /* @__PURE__ */ jsxRuntime.jsx(
738
+ designSystem.MultiSelectGroup,
739
+ {
740
+ label: formatMessage({
741
+ id: "Settings.review-workflows.stage.permissions.allRoles.label",
742
+ defaultMessage: "All roles"
743
+ }),
744
+ values: filteredRoles.map((r) => `${r.id}`),
745
+ children: filteredRoles.map((role) => {
746
+ return /* @__PURE__ */ jsxRuntime.jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
747
+ })
748
+ }
749
+ )
750
+ }
751
+ ),
752
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
753
+ ] }) }),
772
754
  /* @__PURE__ */ jsxRuntime.jsx(
773
755
  designSystem.IconButton,
774
756
  {
775
757
  disabled,
776
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {}),
777
758
  label: formatMessage({
778
759
  id: "Settings.review-workflows.stage.permissions.apply.label",
779
760
  defaultMessage: "Apply to all stages"
780
761
  }),
781
762
  size: "L",
782
763
  variant: "secondary",
783
- onClick: () => setIsApplyAllConfirmationOpen(true)
764
+ onClick: () => setIsApplyAllConfirmationOpen(true),
765
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {})
784
766
  }
785
767
  )
786
768
  ] }),
@@ -815,15 +797,10 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
815
797
  )
816
798
  ] });
817
799
  };
818
- const StyledIcon = styled__default.default(icons.EyeStriked)`
819
- & > path {
820
- fill: ${({ theme }) => theme.colors.neutral600};
821
- }
822
- `;
823
- const NestedOption$1 = styled__default.default(designSystem.MultiSelectOption)`
800
+ const NestedOption$1 = styledComponents.styled(designSystem.MultiSelectOption)`
824
801
  padding-left: ${({ theme }) => theme.spaces[7]};
825
802
  `;
826
- const PermissionWrapper = styled__default.default(designSystem.Flex)`
803
+ const PermissionWrapper = styledComponents.styled(designSystem.Flex)`
827
804
  > * {
828
805
  flex-grow: 1;
829
806
  }
@@ -865,86 +842,87 @@ const ContentTypesSelector = ({ disabled }) => {
865
842
  label: contentType.info.displayName,
866
843
  value: contentType.uid
867
844
  }));
868
- return /* @__PURE__ */ jsxRuntime.jsx(
869
- designSystem.MultiSelect,
870
- {
871
- customizeContent: (value2) => formatMessage(
872
- {
873
- id: "Settings.review-workflows.workflow.contentTypes.displayValue",
874
- defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
875
- },
876
- { count: value2?.length }
877
- ),
878
- disabled: isDisabled,
879
- error,
880
- label: formatMessage({
881
- id: "Settings.review-workflows.workflow.contentTypes.label",
882
- defaultMessage: "Associated to"
883
- }),
884
- onChange: (values) => {
885
- onChange("contentTypes", values);
886
- },
887
- value,
888
- placeholder: formatMessage({
889
- id: "Settings.review-workflows.workflow.contentTypes.placeholder",
890
- defaultMessage: "Select"
891
- }),
892
- children: [
893
- ...collectionTypes.length > 0 ? [
894
- {
895
- label: formatMessage({
896
- id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
897
- defaultMessage: "Collection Types"
898
- }),
899
- children: collectionTypes
900
- }
901
- ] : [],
902
- ...singleTypes.length > 0 ? [
903
- {
904
- label: formatMessage({
905
- id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
906
- defaultMessage: "Single Types"
907
- }),
908
- children: singleTypes
909
- }
910
- ] : []
911
- ].map((opt) => {
912
- return /* @__PURE__ */ jsxRuntime.jsx(
913
- designSystem.MultiSelectGroup,
845
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name: "contentTypes", children: [
846
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
847
+ id: "Settings.review-workflows.workflow.contentTypes.label",
848
+ defaultMessage: "Associated to"
849
+ }) }),
850
+ /* @__PURE__ */ jsxRuntime.jsx(
851
+ designSystem.MultiSelect,
852
+ {
853
+ customizeContent: (value2) => formatMessage(
914
854
  {
915
- label: opt.label,
916
- values: opt.children.map((child) => child.value.toString()),
917
- children: opt.children.map((child) => {
918
- const { name: assignedWorkflowName } = workflows?.find(
919
- (workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
920
- ) ?? {};
921
- return /* @__PURE__ */ jsxRuntime.jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
922
- // @ts-expect-error - formatMessage options doesn't expect to be a React component but that's what we need actually for the <i> and <em> components
923
- children: formatMessage(
924
- {
925
- id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
926
- defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
927
- },
928
- {
929
- label: child.label,
930
- name: assignedWorkflowName,
931
- em: (...children) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "em", fontWeight: "bold", children }),
932
- i: (...children) => /* @__PURE__ */ jsxRuntime.jsx(ContentTypeTakeNotice, { children })
933
- }
934
- )
935
- }) }, child.value);
936
- })
855
+ id: "Settings.review-workflows.workflow.contentTypes.displayValue",
856
+ defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
937
857
  },
938
- opt.label
939
- );
940
- })
941
- }
942
- );
858
+ { count: value2?.length }
859
+ ),
860
+ disabled: isDisabled,
861
+ onChange: (values) => {
862
+ onChange("contentTypes", values);
863
+ },
864
+ value,
865
+ placeholder: formatMessage({
866
+ id: "Settings.review-workflows.workflow.contentTypes.placeholder",
867
+ defaultMessage: "Select"
868
+ }),
869
+ children: [
870
+ ...collectionTypes.length > 0 ? [
871
+ {
872
+ label: formatMessage({
873
+ id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
874
+ defaultMessage: "Collection Types"
875
+ }),
876
+ children: collectionTypes
877
+ }
878
+ ] : [],
879
+ ...singleTypes.length > 0 ? [
880
+ {
881
+ label: formatMessage({
882
+ id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
883
+ defaultMessage: "Single Types"
884
+ }),
885
+ children: singleTypes
886
+ }
887
+ ] : []
888
+ ].map((opt) => {
889
+ return /* @__PURE__ */ jsxRuntime.jsx(
890
+ designSystem.MultiSelectGroup,
891
+ {
892
+ label: opt.label,
893
+ values: opt.children.map((child) => child.value.toString()),
894
+ children: opt.children.map((child) => {
895
+ const { name: assignedWorkflowName } = workflows?.find(
896
+ (workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
897
+ ) ?? {};
898
+ return /* @__PURE__ */ jsxRuntime.jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
899
+ // @ts-expect-error - formatMessage options doesn't expect to be a React component but that's what we need actually for the <i> and <em> components
900
+ children: formatMessage(
901
+ {
902
+ id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
903
+ defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
904
+ },
905
+ {
906
+ label: child.label,
907
+ name: assignedWorkflowName,
908
+ em: (...children) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "em", fontWeight: "bold", children }),
909
+ i: (...children) => /* @__PURE__ */ jsxRuntime.jsx(ContentTypeTakeNotice, { children })
910
+ }
911
+ )
912
+ }) }, child.value);
913
+ })
914
+ },
915
+ opt.label
916
+ );
917
+ })
918
+ }
919
+ )
920
+ ] });
943
921
  };
944
- const NestedOption = styled__default.default(designSystem.MultiSelectOption)`
922
+ const NestedOption = styledComponents.styled(designSystem.MultiSelectOption)`
945
923
  padding-left: ${({ theme }) => theme.spaces[7]};
946
924
  `;
947
- const ContentTypeTakeNotice = styled__default.default(designSystem.Typography)`
925
+ const ContentTypeTakeNotice = styledComponents.styled(designSystem.Typography)`
948
926
  font-style: italic;
949
927
  `;
950
928
  const WORKFLOW_SCHEMA = yup__namespace.object({
@@ -1290,4 +1268,4 @@ const ProtectedEditPage = () => {
1290
1268
  return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
1291
1269
  };
1292
1270
  exports.ProtectedEditPage = ProtectedEditPage;
1293
- //# sourceMappingURL=_id-yjWLof5q.js.map
1271
+ //# sourceMappingURL=_id-B853wt9z.js.map