@strapi/review-workflows 0.0.0-experimental.d23c1d5b0e45dd06ef09977f526c85468be05403 → 0.0.0-experimental.dd3311938ac827f1fa8560c8840a9a394f5896c0

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-dGg4FA1R.js → Layout-BMqtFafC.js} +7 -15
  2. package/dist/_chunks/Layout-BMqtFafC.js.map +1 -0
  3. package/dist/_chunks/{Layout-facLKucY.mjs → Layout-lg3hbwGL.mjs} +10 -16
  4. package/dist/_chunks/Layout-lg3hbwGL.mjs.map +1 -0
  5. package/dist/_chunks/{_id-D4CXKOqG.mjs → _id-B3jMqqMH.mjs} +262 -322
  6. package/dist/_chunks/_id-B3jMqqMH.mjs.map +1 -0
  7. package/dist/_chunks/{_id-B6DgrtpA.js → _id-B853wt9z.js} +268 -330
  8. package/dist/_chunks/_id-B853wt9z.js.map +1 -0
  9. package/dist/_chunks/{index-QbWLXdZR.mjs → index-BhJmjDbj.mjs} +19 -24
  10. package/dist/_chunks/index-BhJmjDbj.mjs.map +1 -0
  11. package/dist/_chunks/{index-BuKZWpJw.js → index-CdU1x9cZ.js} +20 -27
  12. package/dist/_chunks/index-CdU1x9cZ.js.map +1 -0
  13. package/dist/_chunks/{index-DX8AGcIP.js → index-Ujtj1Rcp.js} +88 -142
  14. package/dist/_chunks/index-Ujtj1Rcp.js.map +1 -0
  15. package/dist/_chunks/{index-D7Y0ofdg.mjs → index-lebOqdrv.mjs} +88 -140
  16. package/dist/_chunks/index-lebOqdrv.mjs.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-BboD243b.js} +3 -3
  22. package/dist/_chunks/{router-CL62NScV.js.map → router-BboD243b.js.map} +1 -1
  23. package/dist/_chunks/{router-ylD0eA48.mjs → router-CvMnSjb9.mjs} +3 -3
  24. package/dist/_chunks/{router-ylD0eA48.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-dGg4FA1R.js.map +0 -1
  39. package/dist/_chunks/Layout-facLKucY.mjs.map +0 -1
  40. package/dist/_chunks/_id-B6DgrtpA.js.map +0 -1
  41. package/dist/_chunks/_id-D4CXKOqG.mjs.map +0 -1
  42. package/dist/_chunks/index-BuKZWpJw.js.map +0 -1
  43. package/dist/_chunks/index-D7Y0ofdg.mjs.map +0 -1
  44. package/dist/_chunks/index-DX8AGcIP.js.map +0 -1
  45. package/dist/_chunks/index-QbWLXdZR.mjs.map +0 -1
  46. package/dist/_chunks/purchase-review-workflows-B-V0sA2I.mjs.map +0 -1
  47. package/dist/_chunks/purchase-review-workflows-Ds61D_tk.js.map +0 -1
@@ -11,13 +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-DX8AGcIP.js");
15
- const Layout = require("./Layout-dGg4FA1R.js");
16
- const v2 = require("@strapi/design-system/v2");
14
+ const index = require("./index-Ujtj1Rcp.js");
15
+ const Layout = require("./Layout-BMqtFafC.js");
17
16
  const reactDndHtml5Backend = require("react-dnd-html5-backend");
18
- const styled = require("styled-components");
17
+ const styledComponents = require("styled-components");
19
18
  const reactDnd = require("react-dnd");
20
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
21
19
  function _interopNamespace(e) {
22
20
  if (e && e.__esModule)
23
21
  return e;
@@ -38,11 +36,10 @@ function _interopNamespace(e) {
38
36
  }
39
37
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
40
38
  const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
41
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
42
39
  const adminApi = index.reviewWorkflowsApi.injectEndpoints({
43
40
  endpoints(builder) {
44
41
  return {
45
- getRoles: builder.query({
42
+ getAdminRoles: builder.query({
46
43
  query: () => ({
47
44
  url: `/admin/roles`,
48
45
  method: "GET"
@@ -54,7 +51,7 @@ const adminApi = index.reviewWorkflowsApi.injectEndpoints({
54
51
  };
55
52
  }
56
53
  });
57
- const { useGetRolesQuery } = adminApi;
54
+ const { useGetAdminRolesQuery } = adminApi;
58
55
  const useKeyboardDragAndDrop = (active, index2, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
59
56
  const [isSelected, setIsSelected] = React__namespace.useState(false);
60
57
  const handleMove = (movement) => {
@@ -273,74 +270,35 @@ const AddStage = ({ children, ...props }) => {
273
270
  return /* @__PURE__ */ jsxRuntime.jsx(
274
271
  StyledButton,
275
272
  {
276
- as: "button",
273
+ tag: "button",
277
274
  background: "neutral0",
278
- border: "neutral150",
275
+ borderColor: "neutral150",
279
276
  paddingBottom: 3,
280
277
  paddingLeft: 4,
281
278
  paddingRight: 4,
282
279
  paddingTop: 3,
283
280
  shadow: "filterShadow",
284
281
  ...props,
285
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
286
- /* @__PURE__ */ jsxRuntime.jsx(StyledAddIcon, { "aria-hidden": true }),
287
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral500", children })
288
- ] })
282
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "span", gap: 2, children: [
283
+ /* @__PURE__ */ jsxRuntime.jsx(icons.PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
284
+ children
285
+ ] }) })
289
286
  }
290
287
  );
291
288
  };
292
- const StyledAddIcon = styled__default.default(icons.PlusCircle)`
293
- > circle {
294
- fill: ${({ theme }) => theme.colors.neutral150};
295
- }
296
- > path {
297
- fill: ${({ theme }) => theme.colors.neutral600};
298
- }
299
- `;
300
- const StyledButton = styled__default.default(designSystem.Box)`
289
+ const StyledButton = styledComponents.styled(designSystem.Box)`
301
290
  border-radius: 26px;
302
-
303
- svg {
304
- height: ${({ theme }) => theme.spaces[6]};
305
- width: ${({ theme }) => theme.spaces[6]};
306
-
307
- > path {
308
- fill: ${({ theme }) => theme.colors.neutral600};
309
- }
310
- }
291
+ color: ${({ theme }) => theme.colors.neutral500};
311
292
 
312
293
  &:hover {
313
- color: ${({ theme }) => theme.colors.primary600} !important;
314
- ${designSystem.Typography} {
315
- color: ${({ theme }) => theme.colors.primary600} !important;
316
- }
317
-
318
- ${StyledAddIcon} {
319
- > circle {
320
- fill: ${({ theme }) => theme.colors.primary600};
321
- }
322
- > path {
323
- fill: ${({ theme }) => theme.colors.neutral100};
324
- }
325
- }
294
+ color: ${({ theme }) => theme.colors.primary600};
326
295
  }
327
296
 
328
297
  &:active {
329
- ${designSystem.Typography} {
330
- color: ${({ theme }) => theme.colors.primary600};
331
- }
332
-
333
- ${StyledAddIcon} {
334
- > circle {
335
- fill: ${({ theme }) => theme.colors.primary600};
336
- }
337
- > path {
338
- fill: ${({ theme }) => theme.colors.neutral100};
339
- }
340
- }
298
+ color: ${({ theme }) => theme.colors.primary600};
341
299
  }
342
300
  `;
343
- const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
301
+ const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
344
302
  const { formatMessage } = reactIntl.useIntl();
345
303
  const { trackUsage } = strapiAdmin.useTracking();
346
304
  const addFieldRow = strapiAdmin.useForm("Stages", (state) => state.addFieldRow);
@@ -367,9 +325,9 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
367
325
  gap: 6,
368
326
  zIndex: 2,
369
327
  position: "relative",
370
- as: "ol",
328
+ tag: "ol",
371
329
  children: stages.map((stage, index2) => {
372
- 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(
373
331
  Stage,
374
332
  {
375
333
  index: index2,
@@ -377,7 +335,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
377
335
  canReorder: stages.length > 1,
378
336
  canUpdate,
379
337
  stagesCount: stages.length,
380
- isOpen: isCreating,
338
+ defaultOpen: isCreating,
381
339
  ...stage
382
340
  }
383
341
  ) }, stage.__temp_key__);
@@ -401,7 +359,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
401
359
  )
402
360
  ] });
403
361
  };
404
- const Background = styled__default.default(designSystem.Box)`
362
+ const Background = styledComponents.styled(designSystem.Box)`
405
363
  transform: translateX(-50%);
406
364
  `;
407
365
  const Stage = ({
@@ -409,16 +367,15 @@ const Stage = ({
409
367
  canDelete = false,
410
368
  canReorder = false,
411
369
  canUpdate = false,
412
- isOpen: isOpenDefault = false,
413
370
  stagesCount,
414
371
  name,
415
372
  permissions,
416
- color
373
+ color,
374
+ defaultOpen
417
375
  }) => {
418
376
  const [liveText, setLiveText] = React__namespace.useState();
419
377
  const { formatMessage } = reactIntl.useIntl();
420
378
  const { trackUsage } = strapiAdmin.useTracking();
421
- const [isOpen, setIsOpen] = React__namespace.useState(isOpenDefault);
422
379
  const stageErrors = strapiAdmin.useForm("Stages", (state) => state.errors.stages);
423
380
  const error = stageErrors?.[index2];
424
381
  const addFieldRow = strapiAdmin.useForm("Stage", (state) => state.addFieldRow);
@@ -500,7 +457,8 @@ const Stage = ({
500
457
  const handleCloneClick = () => {
501
458
  addFieldRow("stages", { name, color, permissions });
502
459
  };
503
- 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: [
504
462
  liveText && /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
505
463
  isDragging ? /* @__PURE__ */ jsxRuntime.jsx(
506
464
  designSystem.Box,
@@ -511,74 +469,61 @@ const Stage = ({
511
469
  borderWidth: "1px",
512
470
  display: "block",
513
471
  hasRadius: true,
514
- padding: 6,
515
- shadow: "tableShadow"
472
+ padding: 6
516
473
  }
517
- ) : /* @__PURE__ */ jsxRuntime.jsxs(
518
- designSystem.Accordion,
474
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
475
+ AccordionRoot,
519
476
  {
520
- size: "S",
521
- variant: "primary",
522
- onToggle: () => {
523
- setIsOpen(!isOpen);
524
- if (!isOpen) {
477
+ onValueChange: (value) => {
478
+ if (value) {
525
479
  trackUsage("willEditStage");
526
480
  }
527
481
  },
528
- expanded: isOpen,
529
- shadow: "tableShadow",
530
- error: Object.values(error ?? {})[0],
531
- hasErrorMessage: false,
532
- children: [
533
- /* @__PURE__ */ jsxRuntime.jsx(
534
- designSystem.AccordionToggle,
535
- {
536
- title: name,
537
- togglePosition: "left",
538
- action: (canDelete || canUpdate) && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
539
- /* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.Root, { children: [
540
- /* @__PURE__ */ jsxRuntime.jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
541
- /* @__PURE__ */ jsxRuntime.jsx(icons.More, { "aria-hidden": true, focusable: false }),
542
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { as: "span", children: formatMessage({
543
- id: "[tbdb].components.DynamicZone.more-actions",
544
- defaultMessage: "More actions"
545
- }) })
546
- ] }),
547
- /* @__PURE__ */ jsxRuntime.jsx(v2.Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.SubRoot, { children: [
548
- canUpdate && /* @__PURE__ */ jsxRuntime.jsx(v2.MenuItem, { onClick: handleCloneClick, children: formatMessage({
549
- id: "Settings.review-workflows.stage.delete",
550
- defaultMessage: "Duplicate stage"
551
- }) }),
552
- canDelete && /* @__PURE__ */ jsxRuntime.jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index2), children: formatMessage({
553
- id: "Settings.review-workflows.stage.delete",
554
- defaultMessage: "Delete"
555
- }) })
556
- ] }) })
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
+ }) })
557
495
  ] }),
558
- canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
559
- DragIconButton,
560
- {
561
- background: "transparent",
562
- forwardedAs: "div",
563
- hasRadius: true,
564
- role: "button",
565
- noBorder: true,
566
- tabIndex: 0,
567
- "data-handler-id": handlerId,
568
- ref: dragRef,
569
- label: formatMessage({
570
- id: "Settings.review-workflows.stage.drag",
571
- defaultMessage: "Drag"
572
- }),
573
- onClick: (e) => e.stopPropagation(),
574
- onKeyDown: handleKeyDown,
575
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, {})
576
- }
577
- )
578
- ] })
579
- }
580
- ),
581
- /* @__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: [
582
527
  {
583
528
  disabled: !canUpdate,
584
529
  label: formatMessage({
@@ -617,15 +562,19 @@ const Stage = ({
617
562
  type: "permissions"
618
563
  }
619
564
  ].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: size, children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
620
- ]
565
+ ] })
621
566
  }
622
567
  )
623
568
  ] });
624
569
  };
625
- const DeleteMenuItem = styled__default.default(v2.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)`
626
575
  color: ${({ theme }) => theme.colors.danger600};
627
576
  `;
628
- const ContextMenuTrigger = styled__default.default(v2.Menu.Trigger)`
577
+ const ContextMenuTrigger = styledComponents.styled(designSystem.Menu.Trigger)`
629
578
  :hover,
630
579
  :focus {
631
580
  background-color: ${({ theme }) => theme.colors.neutral100};
@@ -635,22 +584,6 @@ const ContextMenuTrigger = styled__default.default(v2.Menu.Trigger)`
635
584
  font-size: 0;
636
585
  }
637
586
  `;
638
- const DragIconButton = styled__default.default(designSystem.IconButton)`
639
- align-items: center;
640
- border-radius: ${({ theme }) => theme.borderRadius};
641
- display: flex;
642
- justify-content: center;
643
-
644
- &:hover,
645
- &:focus {
646
- background-color: ${({ theme }) => theme.colors.neutral100};
647
- }
648
-
649
- svg {
650
- height: auto;
651
- width: ${({ theme }) => theme.spaces[3]};
652
- }
653
- `;
654
587
  const InputRenderer = (props) => {
655
588
  switch (props.type) {
656
589
  case "color":
@@ -676,54 +609,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
676
609
  color: hex
677
610
  }));
678
611
  const { themeColorName } = index.getStageColorByHex(value) ?? {};
679
- return /* @__PURE__ */ jsxRuntime.jsx(
680
- designSystem.SingleSelect,
681
- {
682
- disabled,
683
- error,
684
- required,
685
- label,
686
- onChange: (v) => {
687
- onChange(name, v.toString());
688
- },
689
- value: value?.toUpperCase(),
690
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(
691
- designSystem.Flex,
692
- {
693
- as: "span",
694
- height: 2,
695
- background: value,
696
- borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
697
- hasRadius: true,
698
- shrink: 0,
699
- width: 2
700
- }
701
- ),
702
- children: colorOptions.map(({ value: value2, label: label2, color }) => {
703
- const { themeColorName: themeColorName2 } = index.getStageColorByHex(color) || {};
704
- return /* @__PURE__ */ jsxRuntime.jsx(
705
- 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,
706
624
  {
707
- value: value2,
708
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(
709
- designSystem.Flex,
710
- {
711
- as: "span",
712
- height: 2,
713
- background: color,
714
- borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
715
- hasRadius: true,
716
- shrink: 0,
717
- width: 2
718
- }
719
- ),
720
- children: label2
721
- },
722
- value2
723
- );
724
- })
725
- }
726
- );
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
+ ] });
727
661
  };
728
662
  const PermissionsField = ({ disabled, name, placeholder, required }) => {
729
663
  const { formatMessage } = reactIntl.useIntl();
@@ -732,7 +666,7 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
732
666
  const { value = [], error, onChange } = strapiAdmin.useField(name);
733
667
  const allStages = strapiAdmin.useForm("PermissionsField", (state) => state.values.stages);
734
668
  const onFormValueChange = strapiAdmin.useForm("PermissionsField", (state) => state.onChange);
735
- const { data: roles = [], isLoading } = useGetRolesQuery();
669
+ const { data: roles = [], isLoading } = useGetAdminRolesQuery();
736
670
  const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
737
671
  React__namespace.useEffect(() => {
738
672
  if (!isLoading && roles.length === 0) {
@@ -747,80 +681,88 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
747
681
  }
748
682
  }, [formatMessage, isLoading, roles, toggleNotification]);
749
683
  if (!isLoading && filteredRoles.length === 0) {
750
- return /* @__PURE__ */ jsxRuntime.jsx(
751
- designSystem.TextInput,
684
+ return /* @__PURE__ */ jsxRuntime.jsxs(
685
+ designSystem.Field.Root,
752
686
  {
753
- disabled: true,
754
687
  name,
755
688
  hint: formatMessage({
756
689
  id: "Settings.review-workflows.stage.permissions.noPermissions.description",
757
690
  defaultMessage: "You don’t have the permission to see roles"
758
691
  }),
759
- label: formatMessage({
760
- id: "Settings.review-workflows.stage.permissions.label",
761
- defaultMessage: "Roles that can change this stage"
762
- }),
763
- placeholder: formatMessage({
764
- id: "components.NotAllowedInput.text",
765
- defaultMessage: "No permissions to see this field"
766
- }),
767
692
  required,
768
- startAction: /* @__PURE__ */ jsxRuntime.jsx(StyledIcon, {}),
769
- type: "text",
770
- value: ""
771
- }
772
- );
773
- }
774
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
775
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "flex-end", gap: 3, children: [
776
- /* @__PURE__ */ jsxRuntime.jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
777
- designSystem.MultiSelect,
778
- {
779
- disabled,
780
- error,
781
- id: name,
782
- label: formatMessage({
693
+ children: [
694
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
783
695
  id: "Settings.review-workflows.stage.permissions.label",
784
696
  defaultMessage: "Roles that can change this stage"
785
- }),
786
- onChange: (values) => {
787
- const permissions = values.map((value2) => ({
788
- role: parseInt(value2, 10),
789
- action: "admin::review-workflows.stage.transition"
790
- }));
791
- onChange(name, permissions);
792
- },
793
- placeholder,
794
- required: true,
795
- value: value.map((permission) => `${permission.role}`),
796
- withTags: true,
797
- children: /* @__PURE__ */ jsxRuntime.jsx(
798
- designSystem.MultiSelectGroup,
697
+ }) }),
698
+ /* @__PURE__ */ jsxRuntime.jsx(
699
+ designSystem.TextInput,
799
700
  {
800
- label: formatMessage({
801
- id: "Settings.review-workflows.stage.permissions.allRoles.label",
802
- defaultMessage: "All roles"
701
+ disabled: true,
702
+ placeholder: formatMessage({
703
+ id: "components.NotAllowedInput.text",
704
+ defaultMessage: "No permissions to see this field"
803
705
  }),
804
- values: filteredRoles.map((r) => `${r.id}`),
805
- children: filteredRoles.map((role) => {
806
- return /* @__PURE__ */ jsxRuntime.jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
807
- })
706
+ startAction: /* @__PURE__ */ jsxRuntime.jsx(icons.EyeStriked, { fill: "neutral600" }),
707
+ type: "text",
708
+ value: ""
808
709
  }
809
- )
810
- }
811
- ) }),
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
+ ] }) }),
812
754
  /* @__PURE__ */ jsxRuntime.jsx(
813
755
  designSystem.IconButton,
814
756
  {
815
757
  disabled,
816
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {}),
817
758
  label: formatMessage({
818
759
  id: "Settings.review-workflows.stage.permissions.apply.label",
819
760
  defaultMessage: "Apply to all stages"
820
761
  }),
821
762
  size: "L",
822
763
  variant: "secondary",
823
- onClick: () => setIsApplyAllConfirmationOpen(true)
764
+ onClick: () => setIsApplyAllConfirmationOpen(true),
765
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {})
824
766
  }
825
767
  )
826
768
  ] }),
@@ -855,15 +797,10 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
855
797
  )
856
798
  ] });
857
799
  };
858
- const StyledIcon = styled__default.default(icons.EyeStriked)`
859
- & > path {
860
- fill: ${({ theme }) => theme.colors.neutral600};
861
- }
862
- `;
863
- const NestedOption$1 = styled__default.default(designSystem.MultiSelectOption)`
800
+ const NestedOption$1 = styledComponents.styled(designSystem.MultiSelectOption)`
864
801
  padding-left: ${({ theme }) => theme.spaces[7]};
865
802
  `;
866
- const PermissionWrapper = styled__default.default(designSystem.Flex)`
803
+ const PermissionWrapper = styledComponents.styled(designSystem.Flex)`
867
804
  > * {
868
805
  flex-grow: 1;
869
806
  }
@@ -905,86 +842,87 @@ const ContentTypesSelector = ({ disabled }) => {
905
842
  label: contentType.info.displayName,
906
843
  value: contentType.uid
907
844
  }));
908
- return /* @__PURE__ */ jsxRuntime.jsx(
909
- designSystem.MultiSelect,
910
- {
911
- customizeContent: (value2) => formatMessage(
912
- {
913
- id: "Settings.review-workflows.workflow.contentTypes.displayValue",
914
- defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
915
- },
916
- { count: value2?.length }
917
- ),
918
- disabled: isDisabled,
919
- error,
920
- label: formatMessage({
921
- id: "Settings.review-workflows.workflow.contentTypes.label",
922
- defaultMessage: "Associated to"
923
- }),
924
- onChange: (values) => {
925
- onChange("contentTypes", values);
926
- },
927
- value,
928
- placeholder: formatMessage({
929
- id: "Settings.review-workflows.workflow.contentTypes.placeholder",
930
- defaultMessage: "Select"
931
- }),
932
- children: [
933
- ...collectionTypes.length > 0 ? [
934
- {
935
- label: formatMessage({
936
- id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
937
- defaultMessage: "Collection Types"
938
- }),
939
- children: collectionTypes
940
- }
941
- ] : [],
942
- ...singleTypes.length > 0 ? [
943
- {
944
- label: formatMessage({
945
- id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
946
- defaultMessage: "Single Types"
947
- }),
948
- children: singleTypes
949
- }
950
- ] : []
951
- ].map((opt) => {
952
- return /* @__PURE__ */ jsxRuntime.jsx(
953
- 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(
954
854
  {
955
- label: opt.label,
956
- values: opt.children.map((child) => child.value.toString()),
957
- children: opt.children.map((child) => {
958
- const { name: assignedWorkflowName } = workflows?.find(
959
- (workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
960
- ) ?? {};
961
- return /* @__PURE__ */ jsxRuntime.jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
962
- // @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
963
- children: formatMessage(
964
- {
965
- id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
966
- defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
967
- },
968
- {
969
- label: child.label,
970
- name: assignedWorkflowName,
971
- em: (...children) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "em", fontWeight: "bold", children }),
972
- i: (...children) => /* @__PURE__ */ jsxRuntime.jsx(ContentTypeTakeNotice, { children })
973
- }
974
- )
975
- }) }, child.value);
976
- })
855
+ id: "Settings.review-workflows.workflow.contentTypes.displayValue",
856
+ defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
977
857
  },
978
- opt.label
979
- );
980
- })
981
- }
982
- );
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
+ ] });
983
921
  };
984
- const NestedOption = styled__default.default(designSystem.MultiSelectOption)`
922
+ const NestedOption = styledComponents.styled(designSystem.MultiSelectOption)`
985
923
  padding-left: ${({ theme }) => theme.spaces[7]};
986
924
  `;
987
- const ContentTypeTakeNotice = styled__default.default(designSystem.Typography)`
925
+ const ContentTypeTakeNotice = styledComponents.styled(designSystem.Typography)`
988
926
  font-style: italic;
989
927
  `;
990
928
  const WORKFLOW_SCHEMA = yup__namespace.object({
@@ -1330,4 +1268,4 @@ const ProtectedEditPage = () => {
1330
1268
  return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
1331
1269
  };
1332
1270
  exports.ProtectedEditPage = ProtectedEditPage;
1333
- //# sourceMappingURL=_id-B6DgrtpA.js.map
1271
+ //# sourceMappingURL=_id-B853wt9z.js.map