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