@strapi/review-workflows 0.0.0-experimental.defd8568ae03ef8d52f86e1f3541979f953c3941 → 0.0.0-experimental.f75e3c6d67cc47c64ab37479efdbb7b43be50b78

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 (47) hide show
  1. package/dist/_chunks/{Layout-Py8gxQW2.js → Layout-BMqtFafC.js} +6 -14
  2. package/dist/_chunks/Layout-BMqtFafC.js.map +1 -0
  3. package/dist/_chunks/{Layout-B_cKmQA3.mjs → Layout-lg3hbwGL.mjs} +8 -14
  4. package/dist/_chunks/Layout-lg3hbwGL.mjs.map +1 -0
  5. package/dist/_chunks/{_id-C_HRFhcV.mjs → _id-B3jMqqMH.mjs} +262 -321
  6. package/dist/_chunks/_id-B3jMqqMH.mjs.map +1 -0
  7. package/dist/_chunks/{_id-BeUU-t6D.js → _id-B853wt9z.js} +268 -329
  8. package/dist/_chunks/_id-B853wt9z.js.map +1 -0
  9. package/dist/_chunks/{index-CAgnun9R.mjs → index-BhJmjDbj.mjs} +17 -21
  10. package/dist/_chunks/index-BhJmjDbj.mjs.map +1 -0
  11. package/dist/_chunks/{index-DyJcIA81.js → index-CdU1x9cZ.js} +18 -24
  12. package/dist/_chunks/index-CdU1x9cZ.js.map +1 -0
  13. package/dist/_chunks/{index-D3AvHSbj.js → index-Ujtj1Rcp.js} +85 -138
  14. package/dist/_chunks/index-Ujtj1Rcp.js.map +1 -0
  15. package/dist/_chunks/{index-DjHtLGgq.mjs → index-lebOqdrv.mjs} +87 -138
  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-BwVSq4yF.js → router-BboD243b.js} +3 -3
  22. package/dist/_chunks/{router-BwVSq4yF.js.map → router-BboD243b.js.map} +1 -1
  23. package/dist/_chunks/{router-zN3-SLwz.mjs → router-CvMnSjb9.mjs} +3 -3
  24. package/dist/_chunks/{router-zN3-SLwz.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/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/admin.d.ts +2 -2
  32. package/dist/admin/src/services/api.d.ts +2 -3
  33. package/dist/admin/src/services/content-manager.d.ts +7 -7
  34. package/dist/admin/src/services/settings.d.ts +4 -4
  35. package/dist/admin/src/utils/api.d.ts +4 -19
  36. package/dist/admin/src/utils/cm-hooks.d.ts +1 -1
  37. package/package.json +14 -15
  38. package/dist/_chunks/Layout-B_cKmQA3.mjs.map +0 -1
  39. package/dist/_chunks/Layout-Py8gxQW2.js.map +0 -1
  40. package/dist/_chunks/_id-BeUU-t6D.js.map +0 -1
  41. package/dist/_chunks/_id-C_HRFhcV.mjs.map +0 -1
  42. package/dist/_chunks/index-CAgnun9R.mjs.map +0 -1
  43. package/dist/_chunks/index-D3AvHSbj.js.map +0 -1
  44. package/dist/_chunks/index-DjHtLGgq.mjs.map +0 -1
  45. package/dist/_chunks/index-DyJcIA81.js.map +0 -1
  46. package/dist/_chunks/purchase-review-workflows-BaOk5p_m.js.map +0 -1
  47. package/dist/_chunks/purchase-review-workflows-DyffLpyz.mjs.map +0 -1
@@ -2,22 +2,22 @@ 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, MenuItem, Menu, IconButton, MultiSelectOption, useComposedRefs, VisuallyHidden, Accordion, AccordionToggle, AccordionContent, Grid, GridItem, SingleSelect, SingleSelectOption, TextInput, MultiSelect, MultiSelectGroup, useCollator, Button } from "@strapi/design-system";
6
- import { PlusCircle, EyeStriked, More, Drag, Duplicate, Check } from "@strapi/icons";
5
+ import { Box, Typography, Flex, Accordion, MenuItem, Menu, MultiSelectOption, useComposedRefs, VisuallyHidden, IconButton, Grid, GridItem, Field, SingleSelect, SingleSelectOption, TextInput, MultiSelect, MultiSelectGroup, useCollator, Button } from "@strapi/design-system";
6
+ import { PlusCircle, More, Drag, EyeStriked, 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-DjHtLGgq.mjs";
13
- import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-B_cKmQA3.mjs";
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-lebOqdrv.mjs";
13
+ import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-lg3hbwGL.mjs";
14
14
  import { getEmptyImage } from "react-dnd-html5-backend";
15
- import styled from "styled-components";
15
+ import { styled } from "styled-components";
16
16
  import { useDrop, useDrag } from "react-dnd";
17
17
  const adminApi = reviewWorkflowsApi.injectEndpoints({
18
18
  endpoints(builder) {
19
19
  return {
20
- getRoles: builder.query({
20
+ getAdminRoles: builder.query({
21
21
  query: () => ({
22
22
  url: `/admin/roles`,
23
23
  method: "GET"
@@ -29,7 +29,7 @@ const adminApi = reviewWorkflowsApi.injectEndpoints({
29
29
  };
30
30
  }
31
31
  });
32
- const { useGetRolesQuery } = adminApi;
32
+ const { useGetAdminRolesQuery } = adminApi;
33
33
  const useKeyboardDragAndDrop = (active, index, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
34
34
  const [isSelected, setIsSelected] = React.useState(false);
35
35
  const handleMove = (movement) => {
@@ -248,74 +248,35 @@ const AddStage = ({ children, ...props }) => {
248
248
  return /* @__PURE__ */ jsx(
249
249
  StyledButton,
250
250
  {
251
- as: "button",
251
+ tag: "button",
252
252
  background: "neutral0",
253
- border: "neutral150",
253
+ borderColor: "neutral150",
254
254
  paddingBottom: 3,
255
255
  paddingLeft: 4,
256
256
  paddingRight: 4,
257
257
  paddingTop: 3,
258
258
  shadow: "filterShadow",
259
259
  ...props,
260
- children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
261
- /* @__PURE__ */ jsx(StyledAddIcon, { "aria-hidden": true }),
262
- /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral500", children })
263
- ] })
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
+ ] }) })
264
264
  }
265
265
  );
266
266
  };
267
- const StyledAddIcon = styled(PlusCircle)`
268
- > circle {
269
- fill: ${({ theme }) => theme.colors.neutral150};
270
- }
271
- > path {
272
- fill: ${({ theme }) => theme.colors.neutral600};
273
- }
274
- `;
275
267
  const StyledButton = styled(Box)`
276
268
  border-radius: 26px;
277
-
278
- svg {
279
- height: ${({ theme }) => theme.spaces[6]};
280
- width: ${({ theme }) => theme.spaces[6]};
281
-
282
- > path {
283
- fill: ${({ theme }) => theme.colors.neutral600};
284
- }
285
- }
269
+ color: ${({ theme }) => theme.colors.neutral500};
286
270
 
287
271
  &:hover {
288
- color: ${({ theme }) => theme.colors.primary600} !important;
289
- ${Typography} {
290
- color: ${({ theme }) => theme.colors.primary600} !important;
291
- }
292
-
293
- ${StyledAddIcon} {
294
- > circle {
295
- fill: ${({ theme }) => theme.colors.primary600};
296
- }
297
- > path {
298
- fill: ${({ theme }) => theme.colors.neutral100};
299
- }
300
- }
272
+ color: ${({ theme }) => theme.colors.primary600};
301
273
  }
302
274
 
303
275
  &:active {
304
- ${Typography} {
305
- color: ${({ theme }) => theme.colors.primary600};
306
- }
307
-
308
- ${StyledAddIcon} {
309
- > circle {
310
- fill: ${({ theme }) => theme.colors.primary600};
311
- }
312
- > path {
313
- fill: ${({ theme }) => theme.colors.neutral100};
314
- }
315
- }
276
+ color: ${({ theme }) => theme.colors.primary600};
316
277
  }
317
278
  `;
318
- const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
279
+ const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
319
280
  const { formatMessage } = useIntl();
320
281
  const { trackUsage } = useTracking();
321
282
  const addFieldRow = useForm("Stages", (state) => state.addFieldRow);
@@ -342,9 +303,9 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
342
303
  gap: 6,
343
304
  zIndex: 2,
344
305
  position: "relative",
345
- as: "ol",
306
+ tag: "ol",
346
307
  children: stages.map((stage, index) => {
347
- return /* @__PURE__ */ jsx(Box, { as: "li", children: /* @__PURE__ */ jsx(
308
+ return /* @__PURE__ */ jsx(Box, { tag: "li", children: /* @__PURE__ */ jsx(
348
309
  Stage,
349
310
  {
350
311
  index,
@@ -352,7 +313,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
352
313
  canReorder: stages.length > 1,
353
314
  canUpdate,
354
315
  stagesCount: stages.length,
355
- isOpen: isCreating,
316
+ defaultOpen: isCreating,
356
317
  ...stage
357
318
  }
358
319
  ) }, stage.__temp_key__);
@@ -384,16 +345,15 @@ const Stage = ({
384
345
  canDelete = false,
385
346
  canReorder = false,
386
347
  canUpdate = false,
387
- isOpen: isOpenDefault = false,
388
348
  stagesCount,
389
349
  name,
390
350
  permissions,
391
- color
351
+ color,
352
+ defaultOpen
392
353
  }) => {
393
354
  const [liveText, setLiveText] = React.useState();
394
355
  const { formatMessage } = useIntl();
395
356
  const { trackUsage } = useTracking();
396
- const [isOpen, setIsOpen] = React.useState(isOpenDefault);
397
357
  const stageErrors = useForm("Stages", (state) => state.errors.stages);
398
358
  const error = stageErrors?.[index];
399
359
  const addFieldRow = useForm("Stage", (state) => state.addFieldRow);
@@ -475,7 +435,8 @@ const Stage = ({
475
435
  const handleCloneClick = () => {
476
436
  addFieldRow("stages", { name, color, permissions });
477
437
  };
478
- return /* @__PURE__ */ jsxs(Box, { ref: (ref) => composedRef(ref), children: [
438
+ const id = React.useId();
439
+ return /* @__PURE__ */ jsxs(Box, { ref: composedRef, children: [
479
440
  liveText && /* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "assertive", children: liveText }),
480
441
  isDragging ? /* @__PURE__ */ jsx(
481
442
  Box,
@@ -486,74 +447,61 @@ const Stage = ({
486
447
  borderWidth: "1px",
487
448
  display: "block",
488
449
  hasRadius: true,
489
- padding: 6,
490
- shadow: "tableShadow"
450
+ padding: 6
491
451
  }
492
- ) : /* @__PURE__ */ jsxs(
493
- Accordion,
452
+ ) : /* @__PURE__ */ jsx(
453
+ AccordionRoot,
494
454
  {
495
- size: "S",
496
- variant: "primary",
497
- onToggle: () => {
498
- setIsOpen(!isOpen);
499
- if (!isOpen) {
455
+ onValueChange: (value) => {
456
+ if (value) {
500
457
  trackUsage("willEditStage");
501
458
  }
502
459
  },
503
- expanded: isOpen,
504
- shadow: "tableShadow",
505
- error: Object.values(error ?? {})[0],
506
- hasErrorMessage: false,
507
- children: [
508
- /* @__PURE__ */ jsx(
509
- AccordionToggle,
510
- {
511
- title: name,
512
- togglePosition: "left",
513
- action: (canDelete || canUpdate) && /* @__PURE__ */ jsxs(Flex, { children: [
514
- /* @__PURE__ */ jsxs(Menu.Root, { children: [
515
- /* @__PURE__ */ jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
516
- /* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
517
- /* @__PURE__ */ jsx(VisuallyHidden, { as: "span", children: formatMessage({
518
- id: "[tbdb].components.DynamicZone.more-actions",
519
- defaultMessage: "More actions"
520
- }) })
521
- ] }),
522
- /* @__PURE__ */ jsx(Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxs(Menu.SubRoot, { children: [
523
- canUpdate && /* @__PURE__ */ jsx(MenuItem, { onClick: handleCloneClick, children: formatMessage({
524
- id: "Settings.review-workflows.stage.delete",
525
- defaultMessage: "Duplicate stage"
526
- }) }),
527
- canDelete && /* @__PURE__ */ jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index), children: formatMessage({
528
- id: "Settings.review-workflows.stage.delete",
529
- defaultMessage: "Delete"
530
- }) })
531
- ] }) })
460
+ defaultValue: defaultOpen ? id : void 0,
461
+ $error: Object.values(error ?? {}).length > 0,
462
+ children: /* @__PURE__ */ jsxs(Accordion.Item, { value: id, children: [
463
+ /* @__PURE__ */ jsxs(Accordion.Header, { children: [
464
+ /* @__PURE__ */ jsx(Accordion.Trigger, { children: name }),
465
+ /* @__PURE__ */ jsx(Accordion.Actions, { children: canDelete || canUpdate ? /* @__PURE__ */ jsxs(Fragment, { children: [
466
+ /* @__PURE__ */ jsxs(Menu.Root, { children: [
467
+ /* @__PURE__ */ jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
468
+ /* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
469
+ /* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children: formatMessage({
470
+ id: "[tbdb].components.DynamicZone.more-actions",
471
+ defaultMessage: "More actions"
472
+ }) })
532
473
  ] }),
533
- canUpdate && /* @__PURE__ */ jsx(
534
- DragIconButton,
535
- {
536
- background: "transparent",
537
- forwardedAs: "div",
538
- hasRadius: true,
539
- role: "button",
540
- noBorder: true,
541
- tabIndex: 0,
542
- "data-handler-id": handlerId,
543
- ref: dragRef,
544
- label: formatMessage({
545
- id: "Settings.review-workflows.stage.drag",
546
- defaultMessage: "Drag"
547
- }),
548
- onClick: (e) => e.stopPropagation(),
549
- onKeyDown: handleKeyDown,
550
- children: /* @__PURE__ */ jsx(Drag, {})
551
- }
552
- )
553
- ] })
554
- }
555
- ),
556
- /* @__PURE__ */ jsx(AccordionContent, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ jsx(Grid, { gap: 4, children: [
474
+ /* @__PURE__ */ jsx(Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxs(Menu.SubRoot, { children: [
475
+ canUpdate && /* @__PURE__ */ jsx(MenuItem, { onClick: handleCloneClick, children: formatMessage({
476
+ id: "Settings.review-workflows.stage.delete",
477
+ defaultMessage: "Duplicate stage"
478
+ }) }),
479
+ canDelete && /* @__PURE__ */ jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index), children: formatMessage({
480
+ id: "Settings.review-workflows.stage.delete",
481
+ defaultMessage: "Delete"
482
+ }) })
483
+ ] }) })
484
+ ] }),
485
+ canUpdate && /* @__PURE__ */ jsx(
486
+ IconButton,
487
+ {
488
+ background: "transparent",
489
+ hasRadius: true,
490
+ borderWidth: 0,
491
+ "data-handler-id": handlerId,
492
+ ref: dragRef,
493
+ label: formatMessage({
494
+ id: "Settings.review-workflows.stage.drag",
495
+ defaultMessage: "Drag"
496
+ }),
497
+ onClick: (e) => e.stopPropagation(),
498
+ onKeyDown: handleKeyDown,
499
+ children: /* @__PURE__ */ jsx(Drag, {})
500
+ }
501
+ )
502
+ ] }) : null })
503
+ ] }),
504
+ /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Grid, { gap: 4, padding: 6, children: [
557
505
  {
558
506
  disabled: !canUpdate,
559
507
  label: formatMessage({
@@ -592,11 +540,15 @@ const Stage = ({
592
540
  type: "permissions"
593
541
  }
594
542
  ].map(({ size, ...field }) => /* @__PURE__ */ jsx(GridItem, { col: size, children: /* @__PURE__ */ jsx(InputRenderer, { ...field }) }, field.name)) }) })
595
- ]
543
+ ] })
596
544
  }
597
545
  )
598
546
  ] });
599
547
  };
548
+ const AccordionRoot = styled(Accordion.Root)`
549
+ border: 1px solid
550
+ ${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
551
+ `;
600
552
  const DeleteMenuItem = styled(MenuItem)`
601
553
  color: ${({ theme }) => theme.colors.danger600};
602
554
  `;
@@ -610,22 +562,6 @@ const ContextMenuTrigger = styled(Menu.Trigger)`
610
562
  font-size: 0;
611
563
  }
612
564
  `;
613
- const DragIconButton = styled(IconButton)`
614
- align-items: center;
615
- border-radius: ${({ theme }) => theme.borderRadius};
616
- display: flex;
617
- justify-content: center;
618
-
619
- &:hover,
620
- &:focus {
621
- background-color: ${({ theme }) => theme.colors.neutral100};
622
- }
623
-
624
- svg {
625
- height: auto;
626
- width: ${({ theme }) => theme.spaces[3]};
627
- }
628
- `;
629
565
  const InputRenderer = (props) => {
630
566
  switch (props.type) {
631
567
  case "color":
@@ -651,54 +587,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
651
587
  color: hex
652
588
  }));
653
589
  const { themeColorName } = getStageColorByHex(value) ?? {};
654
- return /* @__PURE__ */ jsx(
655
- SingleSelect,
656
- {
657
- disabled,
658
- error,
659
- required,
660
- label,
661
- onChange: (v) => {
662
- onChange(name, v.toString());
663
- },
664
- value: value?.toUpperCase(),
665
- startIcon: /* @__PURE__ */ jsx(
666
- Flex,
667
- {
668
- as: "span",
669
- height: 2,
670
- background: value,
671
- borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
672
- hasRadius: true,
673
- shrink: 0,
674
- width: 2
675
- }
676
- ),
677
- children: colorOptions.map(({ value: value2, label: label2, color }) => {
678
- const { themeColorName: themeColorName2 } = getStageColorByHex(color) || {};
679
- return /* @__PURE__ */ jsx(
680
- SingleSelectOption,
590
+ return /* @__PURE__ */ jsxs(Field.Root, { error, name, required, children: [
591
+ /* @__PURE__ */ jsx(Field.Label, { children: label }),
592
+ /* @__PURE__ */ jsx(
593
+ SingleSelect,
594
+ {
595
+ disabled,
596
+ onChange: (v) => {
597
+ onChange(name, v.toString());
598
+ },
599
+ value: value?.toUpperCase(),
600
+ startIcon: /* @__PURE__ */ jsx(
601
+ Flex,
681
602
  {
682
- value: value2,
683
- startIcon: /* @__PURE__ */ jsx(
684
- Flex,
685
- {
686
- as: "span",
687
- height: 2,
688
- background: color,
689
- borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
690
- hasRadius: true,
691
- shrink: 0,
692
- width: 2
693
- }
694
- ),
695
- children: label2
696
- },
697
- value2
698
- );
699
- })
700
- }
701
- );
603
+ tag: "span",
604
+ height: 2,
605
+ background: value,
606
+ borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
607
+ hasRadius: true,
608
+ shrink: 0,
609
+ width: 2
610
+ }
611
+ ),
612
+ children: colorOptions.map(({ value: value2, label: label2, color }) => {
613
+ const { themeColorName: themeColorName2 } = getStageColorByHex(color) || {};
614
+ return /* @__PURE__ */ jsx(
615
+ SingleSelectOption,
616
+ {
617
+ value: value2,
618
+ startIcon: /* @__PURE__ */ jsx(
619
+ Flex,
620
+ {
621
+ tag: "span",
622
+ height: 2,
623
+ background: color,
624
+ borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
625
+ hasRadius: true,
626
+ shrink: 0,
627
+ width: 2
628
+ }
629
+ ),
630
+ children: label2
631
+ },
632
+ value2
633
+ );
634
+ })
635
+ }
636
+ ),
637
+ /* @__PURE__ */ jsx(Field.Error, {})
638
+ ] });
702
639
  };
703
640
  const PermissionsField = ({ disabled, name, placeholder, required }) => {
704
641
  const { formatMessage } = useIntl();
@@ -707,7 +644,7 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
707
644
  const { value = [], error, onChange } = useField(name);
708
645
  const allStages = useForm("PermissionsField", (state) => state.values.stages);
709
646
  const onFormValueChange = useForm("PermissionsField", (state) => state.onChange);
710
- const { data: roles = [], isLoading } = useGetRolesQuery();
647
+ const { data: roles = [], isLoading } = useGetAdminRolesQuery();
711
648
  const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
712
649
  React.useEffect(() => {
713
650
  if (!isLoading && roles.length === 0) {
@@ -722,80 +659,88 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
722
659
  }
723
660
  }, [formatMessage, isLoading, roles, toggleNotification]);
724
661
  if (!isLoading && filteredRoles.length === 0) {
725
- return /* @__PURE__ */ jsx(
726
- TextInput,
662
+ return /* @__PURE__ */ jsxs(
663
+ Field.Root,
727
664
  {
728
- disabled: true,
729
665
  name,
730
666
  hint: formatMessage({
731
667
  id: "Settings.review-workflows.stage.permissions.noPermissions.description",
732
668
  defaultMessage: "You don’t have the permission to see roles"
733
669
  }),
734
- label: formatMessage({
735
- id: "Settings.review-workflows.stage.permissions.label",
736
- defaultMessage: "Roles that can change this stage"
737
- }),
738
- placeholder: formatMessage({
739
- id: "components.NotAllowedInput.text",
740
- defaultMessage: "No permissions to see this field"
741
- }),
742
670
  required,
743
- startAction: /* @__PURE__ */ jsx(StyledIcon, {}),
744
- type: "text",
745
- value: ""
746
- }
747
- );
748
- }
749
- return /* @__PURE__ */ jsxs(Fragment, { children: [
750
- /* @__PURE__ */ jsxs(Flex, { alignItems: "flex-end", gap: 3, children: [
751
- /* @__PURE__ */ jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsx(
752
- MultiSelect,
753
- {
754
- disabled,
755
- error,
756
- id: name,
757
- label: formatMessage({
671
+ children: [
672
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
758
673
  id: "Settings.review-workflows.stage.permissions.label",
759
674
  defaultMessage: "Roles that can change this stage"
760
- }),
761
- onChange: (values) => {
762
- const permissions = values.map((value2) => ({
763
- role: parseInt(value2, 10),
764
- action: "admin::review-workflows.stage.transition"
765
- }));
766
- onChange(name, permissions);
767
- },
768
- placeholder,
769
- required: true,
770
- value: value.map((permission) => `${permission.role}`),
771
- withTags: true,
772
- children: /* @__PURE__ */ jsx(
773
- MultiSelectGroup,
675
+ }) }),
676
+ /* @__PURE__ */ jsx(
677
+ TextInput,
774
678
  {
775
- label: formatMessage({
776
- id: "Settings.review-workflows.stage.permissions.allRoles.label",
777
- defaultMessage: "All roles"
679
+ disabled: true,
680
+ placeholder: formatMessage({
681
+ id: "components.NotAllowedInput.text",
682
+ defaultMessage: "No permissions to see this field"
778
683
  }),
779
- values: filteredRoles.map((r) => `${r.id}`),
780
- children: filteredRoles.map((role) => {
781
- return /* @__PURE__ */ jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
782
- })
684
+ startAction: /* @__PURE__ */ jsx(EyeStriked, { fill: "neutral600" }),
685
+ type: "text",
686
+ value: ""
783
687
  }
784
- )
785
- }
786
- ) }),
688
+ ),
689
+ /* @__PURE__ */ jsx(Field.Hint, {})
690
+ ]
691
+ }
692
+ );
693
+ }
694
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
695
+ /* @__PURE__ */ jsxs(Flex, { alignItems: "flex-end", gap: 3, children: [
696
+ /* @__PURE__ */ jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxs(Field.Root, { error, name, required: true, children: [
697
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
698
+ id: "Settings.review-workflows.stage.permissions.label",
699
+ defaultMessage: "Roles that can change this stage"
700
+ }) }),
701
+ /* @__PURE__ */ jsx(
702
+ MultiSelect,
703
+ {
704
+ disabled,
705
+ onChange: (values) => {
706
+ const permissions = values.map((value2) => ({
707
+ role: parseInt(value2, 10),
708
+ action: "admin::review-workflows.stage.transition"
709
+ }));
710
+ onChange(name, permissions);
711
+ },
712
+ placeholder,
713
+ value: value.map((permission) => `${permission.role}`),
714
+ withTags: true,
715
+ children: /* @__PURE__ */ jsx(
716
+ MultiSelectGroup,
717
+ {
718
+ label: formatMessage({
719
+ id: "Settings.review-workflows.stage.permissions.allRoles.label",
720
+ defaultMessage: "All roles"
721
+ }),
722
+ values: filteredRoles.map((r) => `${r.id}`),
723
+ children: filteredRoles.map((role) => {
724
+ return /* @__PURE__ */ jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
725
+ })
726
+ }
727
+ )
728
+ }
729
+ ),
730
+ /* @__PURE__ */ jsx(Field.Error, {})
731
+ ] }) }),
787
732
  /* @__PURE__ */ jsx(
788
733
  IconButton,
789
734
  {
790
735
  disabled,
791
- icon: /* @__PURE__ */ jsx(Duplicate, {}),
792
736
  label: formatMessage({
793
737
  id: "Settings.review-workflows.stage.permissions.apply.label",
794
738
  defaultMessage: "Apply to all stages"
795
739
  }),
796
740
  size: "L",
797
741
  variant: "secondary",
798
- onClick: () => setIsApplyAllConfirmationOpen(true)
742
+ onClick: () => setIsApplyAllConfirmationOpen(true),
743
+ children: /* @__PURE__ */ jsx(Duplicate, {})
799
744
  }
800
745
  )
801
746
  ] }),
@@ -830,11 +775,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
830
775
  )
831
776
  ] });
832
777
  };
833
- const StyledIcon = styled(EyeStriked)`
834
- & > path {
835
- fill: ${({ theme }) => theme.colors.neutral600};
836
- }
837
- `;
838
778
  const NestedOption$1 = styled(MultiSelectOption)`
839
779
  padding-left: ${({ theme }) => theme.spaces[7]};
840
780
  `;
@@ -880,81 +820,82 @@ const ContentTypesSelector = ({ disabled }) => {
880
820
  label: contentType.info.displayName,
881
821
  value: contentType.uid
882
822
  }));
883
- return /* @__PURE__ */ jsx(
884
- MultiSelect,
885
- {
886
- customizeContent: (value2) => formatMessage(
887
- {
888
- id: "Settings.review-workflows.workflow.contentTypes.displayValue",
889
- defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
890
- },
891
- { count: value2?.length }
892
- ),
893
- disabled: isDisabled,
894
- error,
895
- label: formatMessage({
896
- id: "Settings.review-workflows.workflow.contentTypes.label",
897
- defaultMessage: "Associated to"
898
- }),
899
- onChange: (values) => {
900
- onChange("contentTypes", values);
901
- },
902
- value,
903
- placeholder: formatMessage({
904
- id: "Settings.review-workflows.workflow.contentTypes.placeholder",
905
- defaultMessage: "Select"
906
- }),
907
- children: [
908
- ...collectionTypes.length > 0 ? [
909
- {
910
- label: formatMessage({
911
- id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
912
- defaultMessage: "Collection Types"
913
- }),
914
- children: collectionTypes
915
- }
916
- ] : [],
917
- ...singleTypes.length > 0 ? [
918
- {
919
- label: formatMessage({
920
- id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
921
- defaultMessage: "Single Types"
922
- }),
923
- children: singleTypes
924
- }
925
- ] : []
926
- ].map((opt) => {
927
- return /* @__PURE__ */ jsx(
928
- MultiSelectGroup,
823
+ return /* @__PURE__ */ jsxs(Field.Root, { error, name: "contentTypes", children: [
824
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
825
+ id: "Settings.review-workflows.workflow.contentTypes.label",
826
+ defaultMessage: "Associated to"
827
+ }) }),
828
+ /* @__PURE__ */ jsx(
829
+ MultiSelect,
830
+ {
831
+ customizeContent: (value2) => formatMessage(
929
832
  {
930
- label: opt.label,
931
- values: opt.children.map((child) => child.value.toString()),
932
- children: opt.children.map((child) => {
933
- const { name: assignedWorkflowName } = workflows?.find(
934
- (workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
935
- ) ?? {};
936
- return /* @__PURE__ */ jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsx(Typography, {
937
- // @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
938
- children: formatMessage(
939
- {
940
- id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
941
- defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
942
- },
943
- {
944
- label: child.label,
945
- name: assignedWorkflowName,
946
- em: (...children) => /* @__PURE__ */ jsx(Typography, { as: "em", fontWeight: "bold", children }),
947
- i: (...children) => /* @__PURE__ */ jsx(ContentTypeTakeNotice, { children })
948
- }
949
- )
950
- }) }, child.value);
951
- })
833
+ id: "Settings.review-workflows.workflow.contentTypes.displayValue",
834
+ defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
952
835
  },
953
- opt.label
954
- );
955
- })
956
- }
957
- );
836
+ { count: value2?.length }
837
+ ),
838
+ disabled: isDisabled,
839
+ onChange: (values) => {
840
+ onChange("contentTypes", values);
841
+ },
842
+ value,
843
+ placeholder: formatMessage({
844
+ id: "Settings.review-workflows.workflow.contentTypes.placeholder",
845
+ defaultMessage: "Select"
846
+ }),
847
+ children: [
848
+ ...collectionTypes.length > 0 ? [
849
+ {
850
+ label: formatMessage({
851
+ id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
852
+ defaultMessage: "Collection Types"
853
+ }),
854
+ children: collectionTypes
855
+ }
856
+ ] : [],
857
+ ...singleTypes.length > 0 ? [
858
+ {
859
+ label: formatMessage({
860
+ id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
861
+ defaultMessage: "Single Types"
862
+ }),
863
+ children: singleTypes
864
+ }
865
+ ] : []
866
+ ].map((opt) => {
867
+ return /* @__PURE__ */ jsx(
868
+ MultiSelectGroup,
869
+ {
870
+ label: opt.label,
871
+ values: opt.children.map((child) => child.value.toString()),
872
+ children: opt.children.map((child) => {
873
+ const { name: assignedWorkflowName } = workflows?.find(
874
+ (workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
875
+ ) ?? {};
876
+ return /* @__PURE__ */ jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsx(Typography, {
877
+ // @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
878
+ children: formatMessage(
879
+ {
880
+ id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
881
+ defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
882
+ },
883
+ {
884
+ label: child.label,
885
+ name: assignedWorkflowName,
886
+ em: (...children) => /* @__PURE__ */ jsx(Typography, { tag: "em", fontWeight: "bold", children }),
887
+ i: (...children) => /* @__PURE__ */ jsx(ContentTypeTakeNotice, { children })
888
+ }
889
+ )
890
+ }) }, child.value);
891
+ })
892
+ },
893
+ opt.label
894
+ );
895
+ })
896
+ }
897
+ )
898
+ ] });
958
899
  };
959
900
  const NestedOption = styled(MultiSelectOption)`
960
901
  padding-left: ${({ theme }) => theme.spaces[7]};
@@ -1307,4 +1248,4 @@ const ProtectedEditPage = () => {
1307
1248
  export {
1308
1249
  ProtectedEditPage
1309
1250
  };
1310
- //# sourceMappingURL=_id-C_HRFhcV.mjs.map
1251
+ //# sourceMappingURL=_id-B3jMqqMH.mjs.map