@strapi/review-workflows 0.0.0-experimental.76447298a89499e415c97916c03f4f90c25ff336 → 0.0.0-experimental.baa6cf22298e591b4d52d8e59c60406d7a9f137f

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