@strapi/review-workflows 5.0.0-beta.5 → 5.0.0-beta.7

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 (44) hide show
  1. package/dist/_chunks/{Layout-dGg4FA1R.js → Layout-60gjGInX.js} +8 -10
  2. package/dist/_chunks/Layout-60gjGInX.js.map +1 -0
  3. package/dist/_chunks/{Layout-facLKucY.mjs → Layout-CJYuYwXO.mjs} +10 -10
  4. package/dist/_chunks/Layout-CJYuYwXO.mjs.map +1 -0
  5. package/dist/_chunks/{_id-B6DgrtpA.js → _id-BO7wNLt1.js} +210 -242
  6. package/dist/_chunks/_id-BO7wNLt1.js.map +1 -0
  7. package/dist/_chunks/{_id-D4CXKOqG.mjs → _id-UJ-8gken.mjs} +198 -228
  8. package/dist/_chunks/_id-UJ-8gken.mjs.map +1 -0
  9. package/dist/_chunks/{index-DX8AGcIP.js → index-CfiZnfhM.js} +83 -69
  10. package/dist/_chunks/index-CfiZnfhM.js.map +1 -0
  11. package/dist/_chunks/{index-QbWLXdZR.mjs → index-DhEhUlv9.mjs} +15 -21
  12. package/dist/_chunks/index-DhEhUlv9.mjs.map +1 -0
  13. package/dist/_chunks/{index-D7Y0ofdg.mjs → index-DmQNXb0P.mjs} +83 -67
  14. package/dist/_chunks/index-DmQNXb0P.mjs.map +1 -0
  15. package/dist/_chunks/{index-BuKZWpJw.js → index-DnXnsrOM.js} +16 -24
  16. package/dist/_chunks/index-DnXnsrOM.js.map +1 -0
  17. package/dist/_chunks/{purchase-review-workflows-B-V0sA2I.mjs → purchase-review-workflows-BN-5Ube7.mjs} +8 -7
  18. package/dist/_chunks/purchase-review-workflows-BN-5Ube7.mjs.map +1 -0
  19. package/dist/_chunks/{purchase-review-workflows-Ds61D_tk.js → purchase-review-workflows-DlCDg0fD.js} +7 -6
  20. package/dist/_chunks/purchase-review-workflows-DlCDg0fD.js.map +1 -0
  21. package/dist/_chunks/{router-CL62NScV.js → router-BiQI7EcM.js} +3 -3
  22. package/dist/_chunks/{router-CL62NScV.js.map → router-BiQI7EcM.js.map} +1 -1
  23. package/dist/_chunks/{router-ylD0eA48.mjs → router-DFD0S0ey.mjs} +3 -3
  24. package/dist/_chunks/{router-ylD0eA48.mjs.map → router-DFD0S0ey.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/content-manager/[model]/[id]/components/Panel.d.ts +1 -1
  28. package/dist/admin/src/routes/settings/hooks/useDragAndDrop.d.ts +4 -4
  29. package/dist/admin/src/routes/settings/hooks/useKeyboardDragAndDrop.d.ts +1 -1
  30. package/dist/admin/src/routes/settings/hooks/useReviewWorkflows.d.ts +3 -3
  31. package/dist/admin/src/services/content-manager.d.ts +1 -1
  32. package/dist/admin/src/utils/api.d.ts +8 -9
  33. package/dist/admin/src/utils/cm-hooks.d.ts +1 -1
  34. package/package.json +11 -12
  35. package/dist/_chunks/Layout-dGg4FA1R.js.map +0 -1
  36. package/dist/_chunks/Layout-facLKucY.mjs.map +0 -1
  37. package/dist/_chunks/_id-B6DgrtpA.js.map +0 -1
  38. package/dist/_chunks/_id-D4CXKOqG.mjs.map +0 -1
  39. package/dist/_chunks/index-BuKZWpJw.js.map +0 -1
  40. package/dist/_chunks/index-D7Y0ofdg.mjs.map +0 -1
  41. package/dist/_chunks/index-DX8AGcIP.js.map +0 -1
  42. package/dist/_chunks/index-QbWLXdZR.mjs.map +0 -1
  43. package/dist/_chunks/purchase-review-workflows-B-V0sA2I.mjs.map +0 -1
  44. package/dist/_chunks/purchase-review-workflows-Ds61D_tk.js.map +0 -1
@@ -2,18 +2,17 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { useTracking, useForm, useField, InputRenderer as InputRenderer$1, useNotification, ConfirmDialog, Page, useAPIErrorHandler, useRBAC, Form, BackButton } from "@strapi/admin/strapi-admin";
4
4
  import { useLicenseLimits } from "@strapi/admin/strapi-admin/ee";
5
- import { Box, Typography, Flex, IconButton, MultiSelectOption, useComposedRefs, VisuallyHidden, Accordion, AccordionToggle, AccordionContent, Grid, GridItem, SingleSelect, SingleSelectOption, TextInput, MultiSelect, MultiSelectGroup, useCollator, Button } from "@strapi/design-system";
5
+ import { Box, Typography, Flex, MenuItem, Menu, IconButton, MultiSelectOption, useComposedRefs, VisuallyHidden, Accordion, AccordionToggle, AccordionContent, Grid, GridItem, Field, SingleSelect, SingleSelectOption, TextInput, MultiSelect, MultiSelectGroup, useCollator, Button } from "@strapi/design-system";
6
6
  import { PlusCircle, EyeStriked, More, Drag, Duplicate, Check } from "@strapi/icons";
7
7
  import { generateNKeysBetween } from "fractional-indexing";
8
8
  import { useIntl } from "react-intl";
9
9
  import { useDispatch } from "react-redux";
10
10
  import { useParams, useNavigate } from "react-router-dom";
11
11
  import * as yup from "yup";
12
- import { r as reviewWorkflowsApi, A as AVAILABLE_COLORS, g as getStageColorByHex, u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, b as CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal, i as isBaseQueryError } from "./index-D7Y0ofdg.mjs";
13
- import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-facLKucY.mjs";
14
- import { MenuItem, Menu } from "@strapi/design-system/v2";
12
+ import { r as reviewWorkflowsApi, A as AVAILABLE_COLORS, g as getStageColorByHex, u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, b as CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal, i as isBaseQueryError } from "./index-DmQNXb0P.mjs";
13
+ import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-CJYuYwXO.mjs";
15
14
  import { getEmptyImage } from "react-dnd-html5-backend";
16
- import styled from "styled-components";
15
+ import { styled } from "styled-components";
17
16
  import { useDrop, useDrag } from "react-dnd";
18
17
  const adminApi = reviewWorkflowsApi.injectEndpoints({
19
18
  endpoints(builder) {
@@ -249,7 +248,7 @@ const AddStage = ({ children, ...props }) => {
249
248
  return /* @__PURE__ */ jsx(
250
249
  StyledButton,
251
250
  {
252
- as: "button",
251
+ tag: "button",
253
252
  background: "neutral0",
254
253
  border: "neutral150",
255
254
  paddingBottom: 3,
@@ -258,62 +257,23 @@ const AddStage = ({ children, ...props }) => {
258
257
  paddingTop: 3,
259
258
  shadow: "filterShadow",
260
259
  ...props,
261
- children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
262
- /* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true }),
263
- /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral500", children })
264
- ] })
260
+ children: /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
261
+ /* @__PURE__ */ jsx(PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
262
+ children
263
+ ] }) })
265
264
  }
266
265
  );
267
266
  };
268
- const StyledAddIcon = styled(PlusCircle)`
269
- > circle {
270
- fill: ${({ theme }) => theme.colors.neutral150};
271
- }
272
- > path {
273
- fill: ${({ theme }) => theme.colors.neutral600};
274
- }
275
- `;
276
267
  const StyledButton = styled(Box)`
277
268
  border-radius: 26px;
278
-
279
- svg {
280
- height: ${({ theme }) => theme.spaces[6]};
281
- width: ${({ theme }) => theme.spaces[6]};
282
-
283
- > path {
284
- fill: ${({ theme }) => theme.colors.neutral600};
285
- }
286
- }
269
+ color: ${({ theme }) => theme.colors.neutral500};
287
270
 
288
271
  &:hover {
289
- color: ${({ theme }) => theme.colors.primary600} !important;
290
- ${Typography} {
291
- color: ${({ theme }) => theme.colors.primary600} !important;
292
- }
293
-
294
- ${StyledAddIcon} {
295
- > circle {
296
- fill: ${({ theme }) => theme.colors.primary600};
297
- }
298
- > path {
299
- fill: ${({ theme }) => theme.colors.neutral100};
300
- }
301
- }
272
+ color: ${({ theme }) => theme.colors.primary600};
302
273
  }
303
274
 
304
275
  &:active {
305
- ${Typography} {
306
- color: ${({ theme }) => theme.colors.primary600};
307
- }
308
-
309
- ${StyledAddIcon} {
310
- > circle {
311
- fill: ${({ theme }) => theme.colors.primary600};
312
- }
313
- > path {
314
- fill: ${({ theme }) => theme.colors.neutral100};
315
- }
316
- }
276
+ color: ${({ theme }) => theme.colors.primary600};
317
277
  }
318
278
  `;
319
279
  const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
@@ -343,9 +303,9 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
343
303
  gap: 6,
344
304
  zIndex: 2,
345
305
  position: "relative",
346
- as: "ol",
306
+ tag: "ol",
347
307
  children: stages.map((stage, index) => {
348
- return /* @__PURE__ */ jsx(Box, { as: "li", children: /* @__PURE__ */ jsx(
308
+ return /* @__PURE__ */ jsx(Box, { tag: "li", children: /* @__PURE__ */ jsx(
349
309
  Stage,
350
310
  {
351
311
  index,
@@ -476,7 +436,7 @@ const Stage = ({
476
436
  const handleCloneClick = () => {
477
437
  addFieldRow("stages", { name, color, permissions });
478
438
  };
479
- return /* @__PURE__ */ jsxs(Box, { ref: (ref) => composedRef(ref), children: [
439
+ return /* @__PURE__ */ jsxs(Box, { ref: composedRef, children: [
480
440
  liveText && /* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "assertive", children: liveText }),
481
441
  isDragging ? /* @__PURE__ */ jsx(
482
442
  Box,
@@ -515,7 +475,7 @@ const Stage = ({
515
475
  /* @__PURE__ */ jsxs(Menu.Root, { children: [
516
476
  /* @__PURE__ */ jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
517
477
  /* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
518
- /* @__PURE__ */ jsx(VisuallyHidden, { as: "span", children: formatMessage({
478
+ /* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children: formatMessage({
519
479
  id: "[tbdb].components.DynamicZone.more-actions",
520
480
  defaultMessage: "More actions"
521
481
  }) })
@@ -535,7 +495,7 @@ const Stage = ({
535
495
  DragIconButton,
536
496
  {
537
497
  background: "transparent",
538
- forwardedAs: "div",
498
+ tag: "div",
539
499
  hasRadius: true,
540
500
  role: "button",
541
501
  noBorder: true,
@@ -652,54 +612,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
652
612
  color: hex
653
613
  }));
654
614
  const { themeColorName } = getStageColorByHex(value) ?? {};
655
- return /* @__PURE__ */ jsx(
656
- SingleSelect,
657
- {
658
- disabled,
659
- error,
660
- required,
661
- label,
662
- onChange: (v) => {
663
- onChange(name, v.toString());
664
- },
665
- value: value?.toUpperCase(),
666
- startIcon: /* @__PURE__ */ jsx(
667
- Flex,
668
- {
669
- as: "span",
670
- height: 2,
671
- background: value,
672
- borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
673
- hasRadius: true,
674
- shrink: 0,
675
- width: 2
676
- }
677
- ),
678
- children: colorOptions.map(({ value: value2, label: label2, color }) => {
679
- const { themeColorName: themeColorName2 } = getStageColorByHex(color) || {};
680
- return /* @__PURE__ */ jsx(
681
- SingleSelectOption,
615
+ return /* @__PURE__ */ jsxs(Field.Root, { error, name, required, children: [
616
+ /* @__PURE__ */ jsx(Field.Label, { children: label }),
617
+ /* @__PURE__ */ jsx(
618
+ SingleSelect,
619
+ {
620
+ disabled,
621
+ onChange: (v) => {
622
+ onChange(name, v.toString());
623
+ },
624
+ value: value?.toUpperCase(),
625
+ startIcon: /* @__PURE__ */ jsx(
626
+ Flex,
682
627
  {
683
- value: value2,
684
- startIcon: /* @__PURE__ */ jsx(
685
- Flex,
686
- {
687
- as: "span",
688
- height: 2,
689
- background: color,
690
- borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
691
- hasRadius: true,
692
- shrink: 0,
693
- width: 2
694
- }
695
- ),
696
- children: label2
697
- },
698
- value2
699
- );
700
- })
701
- }
702
- );
628
+ tag: "span",
629
+ height: 2,
630
+ background: value,
631
+ borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
632
+ hasRadius: true,
633
+ shrink: 0,
634
+ width: 2
635
+ }
636
+ ),
637
+ children: colorOptions.map(({ value: value2, label: label2, color }) => {
638
+ const { themeColorName: themeColorName2 } = getStageColorByHex(color) || {};
639
+ return /* @__PURE__ */ jsx(
640
+ SingleSelectOption,
641
+ {
642
+ value: value2,
643
+ startIcon: /* @__PURE__ */ jsx(
644
+ Flex,
645
+ {
646
+ tag: "span",
647
+ height: 2,
648
+ background: color,
649
+ borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
650
+ hasRadius: true,
651
+ shrink: 0,
652
+ width: 2
653
+ }
654
+ ),
655
+ children: label2
656
+ },
657
+ value2
658
+ );
659
+ })
660
+ }
661
+ ),
662
+ /* @__PURE__ */ jsx(Field.Error, {})
663
+ ] });
703
664
  };
704
665
  const PermissionsField = ({ disabled, name, placeholder, required }) => {
705
666
  const { formatMessage } = useIntl();
@@ -723,68 +684,76 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
723
684
  }
724
685
  }, [formatMessage, isLoading, roles, toggleNotification]);
725
686
  if (!isLoading && filteredRoles.length === 0) {
726
- return /* @__PURE__ */ jsx(
727
- TextInput,
687
+ return /* @__PURE__ */ jsxs(
688
+ Field.Root,
728
689
  {
729
- disabled: true,
730
690
  name,
731
691
  hint: formatMessage({
732
692
  id: "Settings.review-workflows.stage.permissions.noPermissions.description",
733
693
  defaultMessage: "You don’t have the permission to see roles"
734
694
  }),
735
- label: formatMessage({
736
- id: "Settings.review-workflows.stage.permissions.label",
737
- defaultMessage: "Roles that can change this stage"
738
- }),
739
- placeholder: formatMessage({
740
- id: "components.NotAllowedInput.text",
741
- defaultMessage: "No permissions to see this field"
742
- }),
743
695
  required,
744
- startAction: /* @__PURE__ */ jsx(StyledIcon, {}),
745
- type: "text",
746
- value: ""
747
- }
748
- );
749
- }
750
- return /* @__PURE__ */ jsxs(Fragment, { children: [
751
- /* @__PURE__ */ jsxs(Flex, { alignItems: "flex-end", gap: 3, children: [
752
- /* @__PURE__ */ jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsx(
753
- MultiSelect,
754
- {
755
- disabled,
756
- error,
757
- id: name,
758
- label: formatMessage({
696
+ children: [
697
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
759
698
  id: "Settings.review-workflows.stage.permissions.label",
760
699
  defaultMessage: "Roles that can change this stage"
761
- }),
762
- onChange: (values) => {
763
- const permissions = values.map((value2) => ({
764
- role: parseInt(value2, 10),
765
- action: "admin::review-workflows.stage.transition"
766
- }));
767
- onChange(name, permissions);
768
- },
769
- placeholder,
770
- required: true,
771
- value: value.map((permission) => `${permission.role}`),
772
- withTags: true,
773
- children: /* @__PURE__ */ jsx(
774
- MultiSelectGroup,
700
+ }) }),
701
+ /* @__PURE__ */ jsx(
702
+ TextInput,
775
703
  {
776
- label: formatMessage({
777
- id: "Settings.review-workflows.stage.permissions.allRoles.label",
778
- defaultMessage: "All roles"
704
+ disabled: true,
705
+ placeholder: formatMessage({
706
+ id: "components.NotAllowedInput.text",
707
+ defaultMessage: "No permissions to see this field"
779
708
  }),
780
- values: filteredRoles.map((r) => `${r.id}`),
781
- children: filteredRoles.map((role) => {
782
- return /* @__PURE__ */ jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
783
- })
709
+ startAction: /* @__PURE__ */ jsx(StyledIcon, {}),
710
+ type: "text",
711
+ value: ""
784
712
  }
785
- )
786
- }
787
- ) }),
713
+ ),
714
+ /* @__PURE__ */ jsx(Field.Hint, {})
715
+ ]
716
+ }
717
+ );
718
+ }
719
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
720
+ /* @__PURE__ */ jsxs(Flex, { alignItems: "flex-end", gap: 3, children: [
721
+ /* @__PURE__ */ jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxs(Field.Root, { error, name, required: true, children: [
722
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
723
+ id: "Settings.review-workflows.stage.permissions.label",
724
+ defaultMessage: "Roles that can change this stage"
725
+ }) }),
726
+ /* @__PURE__ */ jsx(
727
+ MultiSelect,
728
+ {
729
+ disabled,
730
+ onChange: (values) => {
731
+ const permissions = values.map((value2) => ({
732
+ role: parseInt(value2, 10),
733
+ action: "admin::review-workflows.stage.transition"
734
+ }));
735
+ onChange(name, permissions);
736
+ },
737
+ placeholder,
738
+ value: value.map((permission) => `${permission.role}`),
739
+ withTags: true,
740
+ children: /* @__PURE__ */ jsx(
741
+ MultiSelectGroup,
742
+ {
743
+ label: formatMessage({
744
+ id: "Settings.review-workflows.stage.permissions.allRoles.label",
745
+ defaultMessage: "All roles"
746
+ }),
747
+ values: filteredRoles.map((r) => `${r.id}`),
748
+ children: filteredRoles.map((role) => {
749
+ return /* @__PURE__ */ jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
750
+ })
751
+ }
752
+ )
753
+ }
754
+ ),
755
+ /* @__PURE__ */ jsx(Field.Error, {})
756
+ ] }) }),
788
757
  /* @__PURE__ */ jsx(
789
758
  IconButton,
790
759
  {
@@ -881,81 +850,82 @@ const ContentTypesSelector = ({ disabled }) => {
881
850
  label: contentType.info.displayName,
882
851
  value: contentType.uid
883
852
  }));
884
- return /* @__PURE__ */ jsx(
885
- MultiSelect,
886
- {
887
- customizeContent: (value2) => formatMessage(
888
- {
889
- id: "Settings.review-workflows.workflow.contentTypes.displayValue",
890
- defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
891
- },
892
- { count: value2?.length }
893
- ),
894
- disabled: isDisabled,
895
- error,
896
- label: formatMessage({
897
- id: "Settings.review-workflows.workflow.contentTypes.label",
898
- defaultMessage: "Associated to"
899
- }),
900
- onChange: (values) => {
901
- onChange("contentTypes", values);
902
- },
903
- value,
904
- placeholder: formatMessage({
905
- id: "Settings.review-workflows.workflow.contentTypes.placeholder",
906
- defaultMessage: "Select"
907
- }),
908
- children: [
909
- ...collectionTypes.length > 0 ? [
910
- {
911
- label: formatMessage({
912
- id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
913
- defaultMessage: "Collection Types"
914
- }),
915
- children: collectionTypes
916
- }
917
- ] : [],
918
- ...singleTypes.length > 0 ? [
919
- {
920
- label: formatMessage({
921
- id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
922
- defaultMessage: "Single Types"
923
- }),
924
- children: singleTypes
925
- }
926
- ] : []
927
- ].map((opt) => {
928
- return /* @__PURE__ */ jsx(
929
- MultiSelectGroup,
853
+ return /* @__PURE__ */ jsxs(Field.Root, { error, name: "contentTypes", children: [
854
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
855
+ id: "Settings.review-workflows.workflow.contentTypes.label",
856
+ defaultMessage: "Associated to"
857
+ }) }),
858
+ /* @__PURE__ */ jsx(
859
+ MultiSelect,
860
+ {
861
+ customizeContent: (value2) => formatMessage(
930
862
  {
931
- label: opt.label,
932
- values: opt.children.map((child) => child.value.toString()),
933
- children: opt.children.map((child) => {
934
- const { name: assignedWorkflowName } = workflows?.find(
935
- (workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
936
- ) ?? {};
937
- return /* @__PURE__ */ jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsx(Typography, {
938
- // @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
939
- children: formatMessage(
940
- {
941
- id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
942
- defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
943
- },
944
- {
945
- label: child.label,
946
- name: assignedWorkflowName,
947
- em: (...children) => /* @__PURE__ */ jsx(Typography, { as: "em", fontWeight: "bold", children }),
948
- i: (...children) => /* @__PURE__ */ jsx(ContentTypeTakeNotice, { children })
949
- }
950
- )
951
- }) }, child.value);
952
- })
863
+ id: "Settings.review-workflows.workflow.contentTypes.displayValue",
864
+ defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
953
865
  },
954
- opt.label
955
- );
956
- })
957
- }
958
- );
866
+ { count: value2?.length }
867
+ ),
868
+ disabled: isDisabled,
869
+ onChange: (values) => {
870
+ onChange("contentTypes", values);
871
+ },
872
+ value,
873
+ placeholder: formatMessage({
874
+ id: "Settings.review-workflows.workflow.contentTypes.placeholder",
875
+ defaultMessage: "Select"
876
+ }),
877
+ children: [
878
+ ...collectionTypes.length > 0 ? [
879
+ {
880
+ label: formatMessage({
881
+ id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
882
+ defaultMessage: "Collection Types"
883
+ }),
884
+ children: collectionTypes
885
+ }
886
+ ] : [],
887
+ ...singleTypes.length > 0 ? [
888
+ {
889
+ label: formatMessage({
890
+ id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
891
+ defaultMessage: "Single Types"
892
+ }),
893
+ children: singleTypes
894
+ }
895
+ ] : []
896
+ ].map((opt) => {
897
+ return /* @__PURE__ */ jsx(
898
+ MultiSelectGroup,
899
+ {
900
+ label: opt.label,
901
+ values: opt.children.map((child) => child.value.toString()),
902
+ children: opt.children.map((child) => {
903
+ const { name: assignedWorkflowName } = workflows?.find(
904
+ (workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
905
+ ) ?? {};
906
+ return /* @__PURE__ */ jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsx(Typography, {
907
+ // @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
908
+ children: formatMessage(
909
+ {
910
+ id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
911
+ defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
912
+ },
913
+ {
914
+ label: child.label,
915
+ name: assignedWorkflowName,
916
+ em: (...children) => /* @__PURE__ */ jsx(Typography, { tag: "em", fontWeight: "bold", children }),
917
+ i: (...children) => /* @__PURE__ */ jsx(ContentTypeTakeNotice, { children })
918
+ }
919
+ )
920
+ }) }, child.value);
921
+ })
922
+ },
923
+ opt.label
924
+ );
925
+ })
926
+ }
927
+ )
928
+ ] });
959
929
  };
960
930
  const NestedOption = styled(MultiSelectOption)`
961
931
  padding-left: ${({ theme }) => theme.spaces[7]};
@@ -1308,4 +1278,4 @@ const ProtectedEditPage = () => {
1308
1278
  export {
1309
1279
  ProtectedEditPage
1310
1280
  };
1311
- //# sourceMappingURL=_id-D4CXKOqG.mjs.map
1281
+ //# sourceMappingURL=_id-UJ-8gken.mjs.map