@pega/cosmos-react-build 10.0.0-build.2.3 → 10.0.0-build.2.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Automation.d.ts","sourceRoot":"","sources":["../../../src/components/Automation/Automation.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAa,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAS1F,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,oBAAoB,CAAC;;;;AAyL5E,wBAA6D"}
1
+ {"version":3,"file":"Automation.d.ts","sourceRoot":"","sources":["../../../src/components/Automation/Automation.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAa,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAS1F,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,oBAAoB,CAAC;;;;AA0L5E,wBAA6D"}
@@ -7,7 +7,7 @@ import * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/ico
7
7
  import RuleStep from './RuleStep';
8
8
  import { getAutomationTestIds } from './Automation.test-ids';
9
9
  import { automationTreeHelpers } from './Automation.utils';
10
- import { StyledAIButton, StyledAutomation, StyledBaseTree } from './Automation.styles';
10
+ import { StyledAIButton, StyledBaseTree } from './Automation.styles';
11
11
  import AutomationContext from './AutomationContext';
12
12
  registerIcon(caretDownIcon, caretLeftIcon, caretRightIcon);
13
13
  const NodeRenderer = ({ subTree, ...restProps }) => {
@@ -21,6 +21,7 @@ const Automation = forwardRef(({ testId, nodes, onExpandAll, onCollapseAll, focu
21
21
  const [focusedNode, setFocusedNode] = useState('');
22
22
  const [focusInsideNode, setFocusInsideNode] = useState(false);
23
23
  const [focusInsideTree, setFocusInsideTree] = useState(false);
24
+ const focusInsideTreeRef = useRef(false);
24
25
  // handle key strokes on tree
25
26
  const handlekeyDown = (e) => {
26
27
  if (['Enter', 'ArrowDown', 'ArrowUp'].includes(e.key) && focusInsideNode) {
@@ -65,12 +66,14 @@ const Automation = forwardRef(({ testId, nodes, onExpandAll, onCollapseAll, focu
65
66
  setFocusedNode(nodes[0].stepId);
66
67
  }
67
68
  if (!focusInsideTree) {
69
+ focusInsideTreeRef.current = true;
68
70
  setFocusInsideTree(true);
69
71
  }
70
72
  break;
71
73
  }
72
74
  case 'focusout': {
73
75
  if (focusInsideTree) {
76
+ focusInsideTreeRef.current = false;
74
77
  setFocusInsideTree(false);
75
78
  }
76
79
  break;
@@ -83,7 +86,7 @@ const Automation = forwardRef(({ testId, nodes, onExpandAll, onCollapseAll, focu
83
86
  const currentNodeId = e.target instanceof Element
84
87
  ? e.target.closest('[role="treeitem"]')?.getAttribute('id')
85
88
  : null;
86
- if (focusInsideTree && !focusInsideNode && currentNodeId) {
89
+ if (focusInsideTreeRef.current && !focusInsideNode && currentNodeId) {
87
90
  setFocusInsideNode(true);
88
91
  setFocusedNode(currentNodeId);
89
92
  }
@@ -107,7 +110,7 @@ const Automation = forwardRef(({ testId, nodes, onExpandAll, onCollapseAll, focu
107
110
  focusInsideTree,
108
111
  firstNodeId: nodes[0]?.stepId
109
112
  }), [focusedNode, focusInsideNode, focusInsideTree, nodes]);
110
- return (_jsx(AutomationContext.Provider, { value: automationCtxValue, children: _jsxs(StyledAutomation, { children: [_jsxs(Flex, { container: { pad: [0, 0, 2, 2] }, justify: 'space-between', "data-testid": testIds.root, alignItems: 'center', children: [onExpandAll && (_jsxs(Button, { "aria-label": t('expand_steps'), "data-testid": testIds.expandAll, onClick: onExpandAll, children: [_jsx(Icon, { name: 'caret-down' }), t('expand_all')] })), onCollapseAll && (_jsxs(Button, { "aria-label": t('collapse_steps'), "data-testid": testIds.collapseAll, onClick: onCollapseAll, children: [_jsx(Icon, { name: `caret-${rtl ? 'left' : 'right'}` }), t('collapse_all')] })), onGenerateCommentsUsingGenAI && (_jsx(StyledAIButton, { label: t('generate_comments'), variant: 'secondary', onClick: onGenerateCommentsUsingGenAI, "data-testid": testIds.generateComments }))] }), _jsx(StyledBaseTree, { ref: treeRef, testId: testIds.steps, nodes: indexedNodes, nodeRenderer: NodeRenderer })] }) }));
113
+ return (_jsxs(AutomationContext.Provider, { value: automationCtxValue, children: [_jsxs(Flex, { container: { pad: [2, 2, 2, 0] }, justify: 'space-between', "data-testid": testIds.root, alignItems: 'center', children: [onExpandAll && (_jsxs(Button, { "aria-label": t('expand_steps'), "data-testid": testIds.expandAll, onClick: onExpandAll, children: [_jsx(Icon, { name: 'caret-down' }), t('expand_all')] })), onCollapseAll && (_jsxs(Button, { "aria-label": t('collapse_steps'), "data-testid": testIds.collapseAll, onClick: onCollapseAll, children: [_jsx(Icon, { name: `caret-${rtl ? 'left' : 'right'}` }), t('collapse_all')] })), onGenerateCommentsUsingGenAI && (_jsx(StyledAIButton, { label: t('generate_comments'), variant: 'secondary', onClick: onGenerateCommentsUsingGenAI, "data-testid": testIds.generateComments }))] }), _jsx(StyledBaseTree, { ref: treeRef, testId: testIds.steps, nodes: indexedNodes, nodeRenderer: NodeRenderer })] }));
111
114
  });
112
115
  export default withTestIds(Automation, getAutomationTestIds);
113
116
  //# sourceMappingURL=Automation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Automation.js","sourceRoot":"","sources":["../../../src/components/Automation/Automation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGzE,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,UAAU,EACV,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AAErG,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE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B,CAAC,EAC7B,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,4BAA4B,iBACxB,OAAO,CAAC,gBAAgB,GACrC,CACH,IACI,EAEP,KAAC,cAAc,IACb,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,OAAO,CAAC,KAAK,EACrB,KAAK,EAAE,YAAY,EACnB,YAAY,EAAE,YAAY,GAC1B,IACe,GACQ,CAC9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { useRef, useState, useEffect, useMemo, forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n Flex,\n Button,\n Icon,\n useTestIds,\n withTestIds,\n useDirection,\n useEvent,\n useI18n,\n registerIcon\n} from '@pega/cosmos-react-core';\nimport type { TreeProps, ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';\n\nimport RuleStep from './RuleStep';\nimport { getAutomationTestIds } from './Automation.test-ids';\nimport { automationTreeHelpers } from './Automation.utils';\nimport { StyledAIButton, StyledAutomation, StyledBaseTree } from './Automation.styles';\nimport type { AutomationProps, RuleStepTreeNode } from './Automation.types';\nimport AutomationContext from './AutomationContext';\n\nregisterIcon(caretDownIcon, caretLeftIcon, caretRightIcon);\n\nconst NodeRenderer: TreeProps<RuleStepTreeNode>['nodeRenderer'] = ({ subTree, ...restProps }) => {\n return (\n <>\n <RuleStep {...restProps} />\n {subTree}\n </>\n );\n};\n\nconst Automation: ForwardRefForwardPropsComponent<AutomationProps> = forwardRef(\n ({\n testId,\n nodes,\n onExpandAll,\n onCollapseAll,\n focusedNodeId,\n onGenerateCommentsUsingGenAI\n }: PropsWithoutRef<AutomationProps>) => {\n const t = useI18n();\n const { rtl } = useDirection();\n const testIds = useTestIds(testId, getAutomationTestIds);\n\n const treeRef = useRef<HTMLUListElement>(null);\n\n const [focusedNode, setFocusedNode] = useState<RuleStepTreeNode['stepId']>('');\n const [focusInsideNode, setFocusInsideNode] = useState(false);\n const [focusInsideTree, setFocusInsideTree] = useState(false);\n\n // handle key strokes on tree\n const handlekeyDown = (e: KeyboardEvent) => {\n if (['Enter', 'ArrowDown', 'ArrowUp'].includes(e.key) && focusInsideNode) {\n return;\n }\n switch (e.key) {\n case 'ArrowDown': {\n const nextNode = automationTreeHelpers.getNextNode(nodes, focusedNode);\n setFocusedNode(nextNode.stepId);\n break;\n }\n case 'ArrowUp': {\n const previousNode = automationTreeHelpers.getPreviousNode(nodes, focusedNode);\n setFocusedNode(previousNode.stepId);\n break;\n }\n case 'Enter': {\n setFocusInsideNode(true);\n break;\n }\n case 'Escape': {\n if (focusInsideNode) {\n const currentFocussedNodeId = document.activeElement\n ?.closest('[role=\"treeitem\"]')\n ?.getAttribute('id');\n if (currentFocussedNodeId) {\n setFocusedNode(currentFocussedNodeId);\n }\n setFocusInsideNode(false);\n }\n\n break;\n }\n default:\n break;\n }\n };\n\n // handle focus movements in and out of tree\n const handleFocusEvent = (e: FocusEvent) => {\n switch (e.type) {\n case 'focusin': {\n if (!focusedNode) {\n setFocusedNode(nodes[0].stepId);\n }\n if (!focusInsideTree) {\n setFocusInsideTree(true);\n }\n\n break;\n }\n case 'focusout': {\n if (focusInsideTree) {\n setFocusInsideTree(false);\n }\n break;\n }\n default:\n break;\n }\n };\n\n const handleClick = (e: Event) => {\n const currentNodeId =\n e.target instanceof Element\n ? e.target.closest('[role=\"treeitem\"]')?.getAttribute('id')\n : null;\n if (focusInsideTree && !focusInsideNode && currentNodeId) {\n setFocusInsideNode(true);\n setFocusedNode(currentNodeId);\n }\n };\n\n // event handlers for focus management.\n useEvent('keydown', handlekeyDown, { target: treeRef });\n useEvent('focusin', handleFocusEvent, { target: treeRef });\n useEvent('focusout', handleFocusEvent, { target: treeRef });\n useEvent('click', handleClick, { target: treeRef });\n\n // To capture focusNode from story\n useEffect(() => {\n if (focusedNodeId) {\n setFocusInsideNode(false);\n setFocusedNode(focusedNodeId);\n }\n }, [focusedNodeId]);\n\n const indexedNodes = useMemo(() => automationTreeHelpers.calculateStepIndices(nodes), [nodes]);\n\n const automationCtxValue = useMemo(\n () => ({\n focusedNodeId: focusedNode,\n focusInsideNode,\n focusInsideTree,\n firstNodeId: nodes[0]?.stepId\n }),\n [focusedNode, focusInsideNode, focusInsideTree, nodes]\n );\n\n return (\n <AutomationContext.Provider value={automationCtxValue}>\n <StyledAutomation>\n <Flex\n container={{ pad: [0, 0, 2, 2] }}\n justify='space-between'\n data-testid={testIds.root}\n alignItems='center'\n >\n {onExpandAll && (\n <Button\n aria-label={t('expand_steps')}\n data-testid={testIds.expandAll}\n onClick={onExpandAll}\n >\n <Icon name='caret-down' />\n {t('expand_all')}\n </Button>\n )}\n\n {onCollapseAll && (\n <Button\n aria-label={t('collapse_steps')}\n data-testid={testIds.collapseAll}\n onClick={onCollapseAll}\n >\n <Icon name={`caret-${rtl ? 'left' : 'right'}`} />\n {t('collapse_all')}\n </Button>\n )}\n\n {onGenerateCommentsUsingGenAI && (\n <StyledAIButton\n label={t('generate_comments')}\n variant='secondary'\n onClick={onGenerateCommentsUsingGenAI}\n data-testid={testIds.generateComments}\n />\n )}\n </Flex>\n\n <StyledBaseTree\n ref={treeRef}\n testId={testIds.steps}\n nodes={indexedNodes}\n nodeRenderer={NodeRenderer}\n />\n </StyledAutomation>\n </AutomationContext.Provider>\n );\n }\n);\n\nexport default withTestIds(Automation, getAutomationTestIds);\n"]}
1
+ {"version":3,"file":"Automation.js","sourceRoot":"","sources":["../../../src/components/Automation/Automation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AA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EAC9B,OAAO,EAAE,WAAW,aAEpB,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,GAAG,EACzB,CAAC,CAAC,YAAY,CAAC,IACT,CACV,EAEA,aAAa,IAAI,CAChB,MAAC,MAAM,kBACO,CAAC,CAAC,gBAAgB,CAAC,iBAClB,OAAO,CAAC,WAAW,EAChC,OAAO,EAAE,aAAa,aAEtB,KAAC,IAAI,IAAC,IAAI,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,GAAI,EAChD,CAAC,CAAC,cAAc,CAAC,IACX,CACV,EAEA,4BAA4B,IAAI,CAC/B,KAAC,cAAc,IACb,KAAK,EAAE,CAAC,CAAC,mBAAmB,CAAC,EAC7B,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,4BAA4B,iBACxB,OAAO,CAAC,gBAAgB,GACrC,CACH,IACI,EAEP,KAAC,cAAc,IACb,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,OAAO,CAAC,KAAK,EACrB,KAAK,EAAE,YAAY,EACnB,YAAY,EAAE,YAAY,GAC1B,IACyB,CAC9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { useRef, useState, useEffect, useMemo, forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n Flex,\n Button,\n Icon,\n useTestIds,\n withTestIds,\n useDirection,\n useEvent,\n useI18n,\n registerIcon\n} from '@pega/cosmos-react-core';\nimport type { TreeProps, ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';\n\nimport RuleStep from './RuleStep';\nimport { getAutomationTestIds } from './Automation.test-ids';\nimport { automationTreeHelpers } from './Automation.utils';\nimport { StyledAIButton, StyledBaseTree } from './Automation.styles';\nimport type { AutomationProps, RuleStepTreeNode } from './Automation.types';\nimport AutomationContext from './AutomationContext';\n\nregisterIcon(caretDownIcon, caretLeftIcon, caretRightIcon);\n\nconst NodeRenderer: TreeProps<RuleStepTreeNode>['nodeRenderer'] = ({ subTree, ...restProps }) => {\n return (\n <>\n <RuleStep {...restProps} />\n {subTree}\n </>\n );\n};\n\nconst Automation: ForwardRefForwardPropsComponent<AutomationProps> = forwardRef(\n ({\n testId,\n nodes,\n onExpandAll,\n onCollapseAll,\n focusedNodeId,\n onGenerateCommentsUsingGenAI\n }: PropsWithoutRef<AutomationProps>) => {\n const t = useI18n();\n const { rtl } = useDirection();\n const testIds = useTestIds(testId, getAutomationTestIds);\n\n const treeRef = useRef<HTMLUListElement>(null);\n\n const [focusedNode, setFocusedNode] = useState<RuleStepTreeNode['stepId']>('');\n const [focusInsideNode, setFocusInsideNode] = useState(false);\n const [focusInsideTree, setFocusInsideTree] = useState(false);\n const focusInsideTreeRef = useRef(false);\n\n // handle key strokes on tree\n const handlekeyDown = (e: KeyboardEvent) => {\n if (['Enter', 'ArrowDown', 'ArrowUp'].includes(e.key) && focusInsideNode) {\n return;\n }\n switch (e.key) {\n case 'ArrowDown': {\n const nextNode = automationTreeHelpers.getNextNode(nodes, focusedNode);\n setFocusedNode(nextNode.stepId);\n break;\n }\n case 'ArrowUp': {\n const previousNode = automationTreeHelpers.getPreviousNode(nodes, focusedNode);\n setFocusedNode(previousNode.stepId);\n break;\n }\n case 'Enter': {\n setFocusInsideNode(true);\n break;\n }\n case 'Escape': {\n if (focusInsideNode) {\n const currentFocussedNodeId = document.activeElement\n ?.closest('[role=\"treeitem\"]')\n ?.getAttribute('id');\n if (currentFocussedNodeId) {\n setFocusedNode(currentFocussedNodeId);\n }\n setFocusInsideNode(false);\n }\n\n break;\n }\n default:\n break;\n }\n };\n\n // handle focus movements in and out of tree\n const handleFocusEvent = (e: FocusEvent) => {\n switch (e.type) {\n case 'focusin': {\n if (!focusedNode) {\n setFocusedNode(nodes[0].stepId);\n }\n if (!focusInsideTree) {\n focusInsideTreeRef.current = true;\n setFocusInsideTree(true);\n }\n\n break;\n }\n case 'focusout': {\n if (focusInsideTree) {\n focusInsideTreeRef.current = false;\n setFocusInsideTree(false);\n }\n break;\n }\n default:\n break;\n }\n };\n\n const handleClick = (e: Event) => {\n const currentNodeId =\n e.target instanceof Element\n ? e.target.closest('[role=\"treeitem\"]')?.getAttribute('id')\n : null;\n if (focusInsideTreeRef.current && !focusInsideNode && currentNodeId) {\n setFocusInsideNode(true);\n setFocusedNode(currentNodeId);\n }\n };\n\n // event handlers for focus management.\n useEvent('keydown', handlekeyDown, { target: treeRef });\n useEvent('focusin', handleFocusEvent, { target: treeRef });\n useEvent('focusout', handleFocusEvent, { target: treeRef });\n useEvent('click', handleClick, { target: treeRef });\n\n // To capture focusNode from story\n useEffect(() => {\n if (focusedNodeId) {\n setFocusInsideNode(false);\n setFocusedNode(focusedNodeId);\n }\n }, [focusedNodeId]);\n\n const indexedNodes = useMemo(() => automationTreeHelpers.calculateStepIndices(nodes), [nodes]);\n\n const automationCtxValue = useMemo(\n () => ({\n focusedNodeId: focusedNode,\n focusInsideNode,\n focusInsideTree,\n firstNodeId: nodes[0]?.stepId\n }),\n [focusedNode, focusInsideNode, focusInsideTree, nodes]\n );\n\n return (\n <AutomationContext.Provider value={automationCtxValue}>\n <Flex\n container={{ pad: [2, 2, 2, 0] }}\n justify='space-between'\n data-testid={testIds.root}\n alignItems='center'\n >\n {onExpandAll && (\n <Button\n aria-label={t('expand_steps')}\n data-testid={testIds.expandAll}\n onClick={onExpandAll}\n >\n <Icon name='caret-down' />\n {t('expand_all')}\n </Button>\n )}\n\n {onCollapseAll && (\n <Button\n aria-label={t('collapse_steps')}\n data-testid={testIds.collapseAll}\n onClick={onCollapseAll}\n >\n <Icon name={`caret-${rtl ? 'left' : 'right'}`} />\n {t('collapse_all')}\n </Button>\n )}\n\n {onGenerateCommentsUsingGenAI && (\n <StyledAIButton\n label={t('generate_comments')}\n variant='secondary'\n onClick={onGenerateCommentsUsingGenAI}\n data-testid={testIds.generateComments}\n />\n )}\n </Flex>\n\n <StyledBaseTree\n ref={treeRef}\n testId={testIds.steps}\n nodes={indexedNodes}\n nodeRenderer={NodeRenderer}\n />\n </AutomationContext.Provider>\n );\n }\n);\n\nexport default withTestIds(Automation, getAutomationTestIds);\n"]}
@@ -31,5 +31,4 @@ export declare const StyledAIButton: import("styled-components/dist/types").ISty
31
31
  } & Omit<import("@pega/cosmos-react-core").Attributes<"button">, "icon" | "label" | "children" | "variant" | "iconOnly">, "ref"> & import("react").RefAttributes<HTMLButtonElement>, "ref"> & {
32
32
  ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
33
33
  }), import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<import("@pega/cosmos-react-core").AIButtonProps> & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
34
- export declare const StyledAutomation: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
35
34
  //# sourceMappingURL=Automation.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Automation.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Automation/Automation.styles.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,eAAO,MAAM,eAAe;;yLAiB1B,CAAC;AAIH,eAAO,MAAM,aAAa;;yLAEzB,CAAC;AAIF,eAAO,MAAM,aAAa,6NAKxB,CAAC;AAIH,eAAO,MAAM,eAAe,kaAI1B,CAAC;AAIH,eAAO,MAAM,aAAa;;2BAIxB,CAAC;AAIH,eAAO,MAAM,gBAAgB,6NAG5B,CAAC;AAMF,eAAO,MAAM,cAAc;2BAQY,CAAC;iDAGtC,CAAC;AAIH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;sSAI1B,CAAC;AAIF,eAAO,MAAM,gBAAgB,6NAI5B,CAAC"}
1
+ {"version":3,"file":"Automation.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Automation/Automation.styles.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,eAAO,MAAM,eAAe;;yLAsB1B,CAAC;AAIH,eAAO,MAAM,aAAa;;yLAEzB,CAAC;AAIF,eAAO,MAAM,aAAa,6NAKxB,CAAC;AAIH,eAAO,MAAM,eAAe,kaAI1B,CAAC;AAIH,eAAO,MAAM,aAAa;;2BAIxB,CAAC;AAIH,eAAO,MAAM,gBAAgB,6NAG5B,CAAC;AAMF,eAAO,MAAM,cAAc;2BAQV,CAAC;iDAGhB,CAAC;AAIH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;sSAI1B,CAAC"}
@@ -1,9 +1,8 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { Card, Text, Tree, Icon, defaultThemeProp, AIButton } from '@pega/cosmos-react-core';
3
- import { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';
4
3
  import { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';
5
4
  // Rule step styles
6
- export const StyledContainer = styled(Card)(({ theme: { base: { shadow, palette: { 'border-line': borderLine } } } }) => {
5
+ export const StyledContainer = styled(Card)(({ theme: { base: { shadow, palette: { 'border-line': borderLine }, 'disabled-opacity': disabledOpacity } } }) => {
7
6
  return css `
8
7
  border-bottom: 0.0625rem solid ${borderLine};
9
8
 
@@ -12,6 +11,10 @@ export const StyledContainer = styled(Card)(({ theme: { base: { shadow, palette:
12
11
  box-shadow: inset ${shadow['focus-solid']};
13
12
  outline: none;
14
13
  }
14
+
15
+ &[aria-disabled='true'] {
16
+ opacity: ${disabledOpacity};
17
+ }
15
18
  `;
16
19
  });
17
20
  StyledContainer.defaultProps = defaultThemeProp;
@@ -59,10 +62,4 @@ export const StyledAIButton = styled(AIButton) `
59
62
  }
60
63
  `;
61
64
  StyledAIButton.defaultProps = defaultThemeProp;
62
- export const StyledAutomation = styled.div `
63
- ${StyledCardContent}:has(&&&) {
64
- padding: unset;
65
- }
66
- `;
67
- StyledAutomation.defaultProps = defaultThemeProp;
68
65
  //# sourceMappingURL=Automation.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Automation.styles.js","sourceRoot":"","sources":["../../../src/components/Automation/Automation.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAI7E,mBAAmB;AAEnB,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAC3C,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,MAAM,EACN,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,EACvC,EACF,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;qCACyB,UAAU;;;;0BAIrB,MAAM,CAAC,aAAa,CAAC;;;GAG5C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD,MAA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J,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;;;;CAI7C,CAAC;AAEF,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;IACtC,iBAAiB;;;CAGpB,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { Card, Text, Tree, Icon, defaultThemeProp, AIButton } from '@pega/cosmos-react-core';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';\n\nimport type { RuleStepTreeNode } from './Automation.types';\n\n// Rule step styles\n\nexport const StyledContainer = styled(Card)(({\n theme: {\n base: {\n shadow,\n palette: { 'border-line': borderLine }\n }\n }\n}) => {\n return css`\n border-bottom: 0.0625rem solid ${borderLine};\n\n &:focus,\n &:focus-visible {\n box-shadow: inset ${shadow['focus-solid']};\n outline: none;\n }\n `;\n});\n\nStyledContainer.defaultProps = defaultThemeProp;\n\nexport const StyledSummary = styled(Text)`\n ${ellipsisOverflow}\n`;\n\nStyledSummary.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div(({ theme }) => {\n return css`\n position: relative;\n padding: ${theme.base.spacing};\n `;\n});\n\nStyledContent.defaultProps = defaultThemeProp;\n\nexport const StyledErrorIcon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n `;\n});\n\nStyledErrorIcon.defaultProps = defaultThemeProp;\n\nexport const StyledComment = styled(StyledSummary)(({ theme }) => {\n return css`\n padding-inline-start: calc(4 * ${theme.base.spacing});\n `;\n});\n\nStyledComment.defaultProps = defaultThemeProp;\n\nexport const StyledStepHeader = styled.div`\n min-width: 0;\n flex: 1 1 auto;\n`;\n\nStyledStepHeader.defaultProps = defaultThemeProp;\n\n// Automation wrapper styles\n\nexport const StyledBaseTree = styled(Tree<RuleStepTreeNode>)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n &,\n & ul {\n padding-inline-start: calc(2 * ${spacing});\n }\n `;\n});\n\nStyledBaseTree.defaultProps = defaultThemeProp;\n\nexport const StyledAIButton = styled(AIButton)`\n && {\n margin-inline-start: auto;\n }\n`;\n\nStyledAIButton.defaultProps = defaultThemeProp;\n\nexport const StyledAutomation = styled.div`\n ${StyledCardContent}:has(&&&) {\n padding: unset;\n }\n`;\n\nStyledAutomation.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"Automation.styles.js","sourceRoot":"","sources":["../../../src/components/Automation/Automation.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAI7E,mBAAmB;AAEnB,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAC3C,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,MAAM,EACN,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,EACtC,kBAAkB,EAAE,eAAe,EACpC,EACF,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;qCACyB,UAAU;;;;0BAIrB,MAAM,CAAC,aAAa,CAAC;;;;;iBAK9B,eAAe;;GAE7B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IACrC,g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C;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;;;;CAI7C,CAAC;AAEF,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { Card, Text, Tree, Icon, defaultThemeProp, AIButton } from '@pega/cosmos-react-core';\nimport { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';\n\nimport type { RuleStepTreeNode } from './Automation.types';\n\n// Rule step styles\n\nexport const StyledContainer = styled(Card)(({\n theme: {\n base: {\n shadow,\n palette: { 'border-line': borderLine },\n 'disabled-opacity': disabledOpacity\n }\n }\n}) => {\n return css`\n border-bottom: 0.0625rem solid ${borderLine};\n\n &:focus,\n &:focus-visible {\n box-shadow: inset ${shadow['focus-solid']};\n outline: none;\n }\n\n &[aria-disabled='true'] {\n opacity: ${disabledOpacity};\n }\n `;\n});\n\nStyledContainer.defaultProps = defaultThemeProp;\n\nexport const StyledSummary = styled(Text)`\n ${ellipsisOverflow}\n`;\n\nStyledSummary.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div(({ theme }) => {\n return css`\n position: relative;\n padding: ${theme.base.spacing};\n `;\n});\n\nStyledContent.defaultProps = defaultThemeProp;\n\nexport const StyledErrorIcon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n `;\n});\n\nStyledErrorIcon.defaultProps = defaultThemeProp;\n\nexport const StyledComment = styled(StyledSummary)(({ theme }) => {\n return css`\n padding-inline-start: calc(4 * ${theme.base.spacing});\n `;\n});\n\nStyledComment.defaultProps = defaultThemeProp;\n\nexport const StyledStepHeader = styled.div`\n min-width: 0;\n flex: 1 1 auto;\n`;\n\nStyledStepHeader.defaultProps = defaultThemeProp;\n\n// Automation wrapper styles\n\nexport const StyledBaseTree = styled(Tree<RuleStepTreeNode>)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n &,\n & ul {\n padding-inline-start: calc(2 * ${spacing});\n }\n `;\n});\n\nStyledBaseTree.defaultProps = defaultThemeProp;\n\nexport const StyledAIButton = styled(AIButton)`\n && {\n margin-inline-start: auto;\n }\n`;\n\nStyledAIButton.defaultProps = defaultThemeProp;\n"]}
@@ -1,3 +1,3 @@
1
1
  export declare const getAutomationTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["expand-all", "collapse-all", "generate-comments", "steps"]>;
2
- export declare const getRuleStepTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["expand-collapse-button", "error-icon", "step-number", "switch-menu", "summary", "summary-tooltip", "comment", "comment-tooltip", "add-step-menu", "step-actions", "content"]>;
2
+ export declare const getRuleStepTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["expand-collapse-button", "error-icon", "step-number", "switch-menu", "summary", "summary-tooltip", "comment", "comment-tooltip", "add-step-menu", "step-actions", "content", "disabled-badge"]>;
3
3
  //# sourceMappingURL=Automation.test-ids.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Automation.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Automation/Automation.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,iMAKtB,CAAC;AAEZ,eAAO,MAAM,kBAAkB,mTAYpB,CAAC"}
1
+ {"version":3,"file":"Automation.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Automation/Automation.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,iMAKtB,CAAC;AAEZ,eAAO,MAAM,kBAAkB,qUAapB,CAAC"}
@@ -16,6 +16,7 @@ export const getRuleStepTestIds = createTestIds('rule-step', [
16
16
  'comment-tooltip',
17
17
  'add-step-menu',
18
18
  'step-actions',
19
- 'content'
19
+ 'content',
20
+ 'disabled-badge'
20
21
  ]);
21
22
  //# sourceMappingURL=Automation.test-ids.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Automation.test-ids.js","sourceRoot":"","sources":["../../../src/components/Automation/Automation.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC,YAAY,EAAE;IAC9D,YAAY;IACZ,cAAc;IACd,mBAAmB;IACnB,OAAO;CACC,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,WAAW,EAAE;IAC3D,wBAAwB;IACxB,YAAY;IACZ,aAAa;IACb,aAAa;IACb,SAAS;IACT,iBAAiB;IACjB,SAAS;IACT,iBAAiB;IACjB,eAAe;IACf,cAAc;IACd,SAAS;CACD,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const getAutomationTestIds = createTestIds('automation', [\n 'expand-all',\n 'collapse-all',\n 'generate-comments',\n 'steps'\n] as const);\n\nexport const getRuleStepTestIds = createTestIds('rule-step', [\n 'expand-collapse-button',\n 'error-icon',\n 'step-number',\n 'switch-menu',\n 'summary',\n 'summary-tooltip',\n 'comment',\n 'comment-tooltip',\n 'add-step-menu',\n 'step-actions',\n 'content'\n] as const);\n"]}
1
+ {"version":3,"file":"Automation.test-ids.js","sourceRoot":"","sources":["../../../src/components/Automation/Automation.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC,YAAY,EAAE;IAC9D,YAAY;IACZ,cAAc;IACd,mBAAmB;IACnB,OAAO;CACC,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,WAAW,EAAE;IAC3D,wBAAwB;IACxB,YAAY;IACZ,aAAa;IACb,aAAa;IACb,SAAS;IACT,iBAAiB;IACjB,SAAS;IACT,iBAAiB;IACjB,eAAe;IACf,cAAc;IACd,SAAS;IACT,gBAAgB;CACR,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const getAutomationTestIds = createTestIds('automation', [\n 'expand-all',\n 'collapse-all',\n 'generate-comments',\n 'steps'\n] as const);\n\nexport const getRuleStepTestIds = createTestIds('rule-step', [\n 'expand-collapse-button',\n 'error-icon',\n 'step-number',\n 'switch-menu',\n 'summary',\n 'summary-tooltip',\n 'comment',\n 'comment-tooltip',\n 'add-step-menu',\n 'step-actions',\n 'content',\n 'disabled-badge'\n] as const);\n"]}
@@ -62,6 +62,8 @@ export interface RuleStepProps extends BaseProps, NoChildrenProp, TestIdProp {
62
62
  error?: boolean;
63
63
  /** Enables readonly mode of the rulestep */
64
64
  readOnly?: boolean;
65
+ /** Enables disabled mode of the rulestep */
66
+ stepDisabled?: boolean;
65
67
  /** Ref for the rulestep */
66
68
  ref?: Ref<HTMLDivElement>;
67
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Automation.types.d.ts","sourceRoot":"","sources":["../../../src/components/Automation/Automation.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,SAAS,EACT,cAAc,EACd,UAAU,EACV,MAAM,EACN,QAAQ,EACR,SAAS,EACV,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;CAgBpB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAG9F,UAAU,QAAQ;IAChB,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1B,OAAO,CAAC,E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AAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC3C,WAAW,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;CAC1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"Automation.types.js","sourceRoot":"","sources":["../../../src/components/Automation/Automation.types.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,UAAU,EAAE,YAAY;IACxB,iBAAiB,EAAE,mBAAmB;IACtC,oBAAoB,EAAE,sBAAsB;IAC5C,mBAAmB,EAAE,qBAAqB;IAC1C,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,oBAAoB;CAChC,CAAC","sourcesContent":["import type { ReactNode, Ref } from 'react';\n\nimport type {\n MenuProps,\n MenuButtonProps,\n BaseProps,\n NoChildrenProp,\n TestIdProp,\n Action,\n TreeNode,\n TreeProps\n} from '@pega/cosmos-react-core';\n\nimport type { IconTileProps } from '../IconTile';\n\nexport const AutomationActions = {\n ActionSet: 'ActionSet',\n ActionSetRow: 'ActionSetRow',\n ActionWhen: 'ActionWhen',\n ActionAppend: 'ActionAppend',\n ActionCall: 'ActionCall',\n ActionCreate: 'ActionCreate',\n ActionForEach: 'ActionForEach',\n ActionExit: 'ActionExit',\n ActionExitForEach: 'ActionExitForEach',\n ActionExitAutomation: 'ActionExitAutomation',\n ActionExitIteration: 'ActionExitIteration',\n ActionReturn: 'ActionReturn',\n ActionRemove: 'ActionRemove',\n ActionRemoveRow: 'ActionRemoveRow',\n ActionErrorHandler: 'ActionErrorHandler'\n} as const;\n\nexport type AutomationActionType = (typeof AutomationActions)[keyof typeof AutomationActions];\n\n// Rule step interfaces\ninterface StepMenu {\n items: MenuProps['items'];\n loading?: MenuProps['loading'];\n onItemClick?: (itemId: AutomationActionType, stepId: string, stepNumber: string) => void;\n}\n\nexport interface StepMenuData {\n menu: StepMenu;\n onClick?: MenuButtonProps['onClick'];\n onKeyDown?: MenuButtonProps['onKeyDown'];\n}\n\nexport interface RuleStepProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** Id of the rulestep */\n stepId: string;\n /** Step number displayed on the step to user */\n stepNumber: string;\n /** Name of the rulestep */\n stepName: AutomationActionType;\n /** Menu for add operations for the rulestep */\n addStepMenu: StepMenuData;\n /** Visual of the rulestep */\n stepVisual?: IconTileProps;\n /** Menu to switch between rules */\n switchMenu?: StepMenuData;\n /** Summary of the rulestep */\n summary?: string;\n /** Comment of the rulestep */\n comment?: string;\n /** Content of the rulestep */\n content?: ReactNode;\n /** Callback to handle expand/collapse of rulestep */\n onExpandCollapse?: (id: RuleStepProps['stepId']) => void;\n /** Secondary actions for the rulestep */\n stepActions?: Action[];\n /** Sets rulestep to expand */\n expanded?: boolean;\n /** Loader for the content */\n loading?: boolean;\n /** If true, mounts the content */\n mountContent?: boolean;\n /** Error state of the rulestep */\n error?: boolean;\n /** Enables readonly mode of the rulestep */\n readOnly?: boolean;\n /** Ref for the rulestep */\n ref?: Ref<HTMLDivElement>;\n}\n\n// Automation Wrapper interfaces\nexport interface RuleStepTreeNode extends TreeNode, RuleStepProps {\n nodes?: RuleStepTreeNode[];\n meta?: Record<string, unknown>;\n}\n\nexport interface RuleStepData {\n Id: RuleStepTreeNode['stepId'];\n Type: AutomationActionType;\n RuleSteps?: RuleStepData[];\n [key: string]: unknown;\n}\n\nexport interface AutomationProps extends TestIdProp, TreeProps<RuleStepTreeNode> {\n /** Expands all the rulesteps */\n onExpandAll?: () => void;\n /** Collapses all the rulesteps */\n onCollapseAll?: () => void;\n /** Generates comments for rulesteps */\n onGenerateCommentsUsingGenAI?: () => void;\n /** Focuses the rulestep that is passed */\n focusedNodeId?: RuleStepTreeNode['stepId'];\n}\n\nexport interface AutomationContextValue {\n focusInsideTree: boolean;\n focusInsideNode: boolean;\n focusedNodeId?: RuleStepTreeNode['stepId'];\n firstNodeId?: RuleStepTreeNode['stepId'];\n}\n"]}
1
+ {"version":3,"file":"Automation.types.js","sourceRoot":"","sources":["../../../src/components/Automation/Automation.types.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,UAAU,EAAE,YAAY;IACxB,iBAAiB,EAAE,mBAAmB;IACtC,oBAAoB,EAAE,sBAAsB;IAC5C,mBAAmB,EAAE,qBAAqB;IAC1C,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,oBAAoB;CAChC,CAAC","sourcesContent":["import type { ReactNode, Ref } from 'react';\n\nimport type {\n MenuProps,\n MenuButtonProps,\n BaseProps,\n NoChildrenProp,\n TestIdProp,\n Action,\n TreeNode,\n TreeProps\n} from '@pega/cosmos-react-core';\n\nimport type { IconTileProps } from '../IconTile';\n\nexport const AutomationActions = {\n ActionSet: 'ActionSet',\n ActionSetRow: 'ActionSetRow',\n ActionWhen: 'ActionWhen',\n ActionAppend: 'ActionAppend',\n ActionCall: 'ActionCall',\n ActionCreate: 'ActionCreate',\n ActionForEach: 'ActionForEach',\n ActionExit: 'ActionExit',\n ActionExitForEach: 'ActionExitForEach',\n ActionExitAutomation: 'ActionExitAutomation',\n ActionExitIteration: 'ActionExitIteration',\n ActionReturn: 'ActionReturn',\n ActionRemove: 'ActionRemove',\n ActionRemoveRow: 'ActionRemoveRow',\n ActionErrorHandler: 'ActionErrorHandler'\n} as const;\n\nexport type AutomationActionType = (typeof AutomationActions)[keyof typeof AutomationActions];\n\n// Rule step interfaces\ninterface StepMenu {\n items: MenuProps['items'];\n loading?: MenuProps['loading'];\n onItemClick?: (itemId: AutomationActionType, stepId: string, stepNumber: string) => void;\n}\n\nexport interface StepMenuData {\n menu: StepMenu;\n onClick?: MenuButtonProps['onClick'];\n onKeyDown?: MenuButtonProps['onKeyDown'];\n}\n\nexport interface RuleStepProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** Id of the rulestep */\n stepId: string;\n /** Step number displayed on the step to user */\n stepNumber: string;\n /** Name of the rulestep */\n stepName: AutomationActionType;\n /** Menu for add operations for the rulestep */\n addStepMenu: StepMenuData;\n /** Visual of the rulestep */\n stepVisual?: IconTileProps;\n /** Menu to switch between rules */\n switchMenu?: StepMenuData;\n /** Summary of the rulestep */\n summary?: string;\n /** Comment of the rulestep */\n comment?: string;\n /** Content of the rulestep */\n content?: ReactNode;\n /** Callback to handle expand/collapse of rulestep */\n onExpandCollapse?: (id: RuleStepProps['stepId']) => void;\n /** Secondary actions for the rulestep */\n stepActions?: Action[];\n /** Sets rulestep to expand */\n expanded?: boolean;\n /** Loader for the content */\n loading?: boolean;\n /** If true, mounts the content */\n mountContent?: boolean;\n /** Error state of the rulestep */\n error?: boolean;\n /** Enables readonly mode of the rulestep */\n readOnly?: boolean;\n /** Enables disabled mode of the rulestep */\n stepDisabled?: boolean;\n /** Ref for the rulestep */\n ref?: Ref<HTMLDivElement>;\n}\n\n// Automation Wrapper interfaces\nexport interface RuleStepTreeNode extends TreeNode, RuleStepProps {\n nodes?: RuleStepTreeNode[];\n meta?: Record<string, unknown>;\n}\n\nexport interface RuleStepData {\n Id: RuleStepTreeNode['stepId'];\n Type: AutomationActionType;\n RuleSteps?: RuleStepData[];\n [key: string]: unknown;\n}\n\nexport interface AutomationProps extends TestIdProp, TreeProps<RuleStepTreeNode> {\n /** Expands all the rulesteps */\n onExpandAll?: () => void;\n /** Collapses all the rulesteps */\n onCollapseAll?: () => void;\n /** Generates comments for rulesteps */\n onGenerateCommentsUsingGenAI?: () => void;\n /** Focuses the rulestep that is passed */\n focusedNodeId?: RuleStepTreeNode['stepId'];\n}\n\nexport interface AutomationContextValue {\n focusInsideTree: boolean;\n focusInsideNode: boolean;\n focusedNodeId?: RuleStepTreeNode['stepId'];\n firstNodeId?: RuleStepTreeNode['stepId'];\n}\n"]}
@@ -76,7 +76,8 @@ export declare const automationTreeHelpers: {
76
76
  */
77
77
  collapseAll(nodes: RuleStepTreeNode[]): RuleStepTreeNode[];
78
78
  /**
79
- * Calculate the step numbers and append to tree
79
+ * Calculate the step numbers and append to tree.
80
+ * Disabled steps are excluded from numbering.
80
81
  * @param nodes Current tree nodes
81
82
  * @param prefix Helper prefix text
82
83
  * @param depth Depth of node
@@ -1 +1 @@
1
- {"version":3,"file":"Automation.utils.d.ts","sourceRoot":"","sources":["../../../src/components/Automation/Automation.utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,eAAO,MAAM,qBAAqB;IAChC;;;;;OAKG;wBACiB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM;IAI3E;;;;;;OAMG;mBACY,gBAAgB,EAAE,SAAS,MAAM,WAAW,gBAAgB,GAAG,gBAAgB,EAAE;IAIhG;;;;;;OAMG;yBAEM,gBAAgB,EAAE,MACrB,gBAAgB,CAAC,IAAI,CAAC,WACjB,gBAAgB,GACxB,gBAAgB,EAAE;IAarB;;;;;;OAMG;wBAEM,gBAAgB,EAAE,MACrB,gBAAgB,CAAC,IAAI,CAAC,WACjB,gBAAgB,GACxB,gBAAgB,EAAE;IAarB;;;;;;OAMG;sBAEM,gBAAgB,E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AMhG;;;;;OAKG;wCAEa,YAAY,EAAE,MACxB,CAAC,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,oBAAoB,KAAK,gBAAgB,GAC3F,gBAAgB,EAAE;CAatB,CAAC;AAIF,eAAO,MAAM,2BAA2B,GAAI,OAAO,MAAM,KAAG,KAAK,IAAI,oBAEpE,CAAC"}
@@ -137,16 +137,23 @@ export const automationTreeHelpers = {
137
137
  }));
138
138
  },
139
139
  /**
140
- * Calculate the step numbers and append to tree
140
+ * Calculate the step numbers and append to tree.
141
+ * Disabled steps are excluded from numbering.
141
142
  * @param nodes Current tree nodes
142
143
  * @param prefix Helper prefix text
143
144
  * @param depth Depth of node
144
145
  * @returns Updated tree with step numbers
145
146
  */
146
147
  calculateStepIndices(nodes, prefix = '', depth = 0) {
147
- return nodes?.map((node, index) => {
148
- let currentPrefix = prefix ? `${prefix}.${index + 1}` : `${index + 1}`;
149
- if (node.stepName === AutomationActions.ActionErrorHandler) {
148
+ let enabledIndex = 0;
149
+ return nodes?.map(node => {
150
+ const isNodeDisabled = node.stepDisabled;
151
+ let currentPrefix = '';
152
+ if (!isNodeDisabled) {
153
+ enabledIndex += 1;
154
+ currentPrefix = prefix ? `${prefix}.${enabledIndex}` : `${enabledIndex}`;
155
+ }
156
+ if (currentPrefix && node.stepName === AutomationActions.ActionErrorHandler) {
150
157
  const segments = currentPrefix.split('.');
151
158
  segments[segments.length - 1] = 'Err';
152
159
  currentPrefix = segments.join('.');
@@ -1 +1 @@
1
- {"version":3,"file":"Automation.utils.js","sourceRoot":"","sources":["../../../src/components/Automation/Automation.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC;;;;;OAKG;IACH,YAAY,CAAC,KAAyB,EAAE,EAA0B;QAChE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from './Automation.types';\nimport type { RuleStepData, RuleStepTreeNode, AutomationActionType } from './Automation.types';\n\nexport const automationTreeHelpers = {\n /**\n * Get the index of a node\n * @param nodes Rulesteps\n * @param id Id of required node\n * @returns Index of the node in list of nodes\n */\n getNodeIndex(nodes: RuleStepTreeNode[], id: RuleStepTreeNode['id']): number {\n return (nodes ?? []).findIndex(n => n.id === id);\n },\n\n /**\n * Add a node\n * @param nodes Current tree nodes\n * @param index Index in list where new node should be appended.\n * @param newNode New node\n * @returns Updated node list\n */\n addNode(nodes: RuleStepTreeNode[], index: number, newNode: RuleStepTreeNode): RuleStepTreeNode[] {\n return [...(nodes ?? []).slice(0, index), newNode, ...(nodes ?? []).slice(index)];\n },\n\n /**\n * Add a step before a node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @param newNode New node\n * @returns Updated tree\n */\n addStepBefore(\n nodes: RuleStepTreeNode[],\n id: RuleStepTreeNode['id'],\n newNode: RuleStepTreeNode\n ): RuleStepTreeNode[] {\n const parentNode = treeHelpers.getParentNode([...nodes], id);\n if (!parentNode) {\n return this.addNode(nodes, this.getNodeIndex(nodes, id), newNode);\n }\n return treeHelpers.mapNode([...nodes], parentNode.id, node => {\n return {\n ...node,\n nodes: this.addNode(node.nodes || [], this.getNodeIndex(node.nodes || [], id), newNode)\n };\n });\n },\n\n /**\n * Add step after a node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @param newNode New node\n * @returns Updated tree\n */\n addStepAfter(\n nodes: RuleStepTreeNode[],\n id: RuleStepTreeNode['id'],\n newNode: RuleStepTreeNode\n ): RuleStepTreeNode[] {\n const parentNode = treeHelpers.getParentNode([...nodes], id);\n if (!parentNode) {\n return this.addNode(nodes, this.getNodeIndex(nodes, id) + 1, newNode);\n }\n return treeHelpers.mapNode([...nodes], parentNode.id, node => {\n return {\n ...node,\n nodes: this.addNode(node.nodes || [], this.getNodeIndex(node.nodes || [], id) + 1, newNode)\n };\n });\n },\n\n /**\n * Add sub-step on a node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @param newNode New node\n * @returns Updated tree\n */\n addSubStep(\n nodes: RuleStepTreeNode[],\n id: RuleStepTreeNode['id'],\n newNode: RuleStepTreeNode\n ): RuleStepTreeNode[] {\n return treeHelpers.appendTo([...nodes], id, [newNode]);\n },\n\n /**\n * Delete the node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @returns Updated tree\n */\n deleteStep(nodes: RuleStepTreeNode[], id: RuleStepTreeNode['id']): RuleStepTreeNode[] {\n const parentNode = treeHelpers.getParentNode([...nodes], id);\n if (!parentNode) {\n return nodes.filter(node => node.id !== id);\n }\n return treeHelpers.mapNode([...nodes], parentNode.id, node => ({\n ...node,\n nodes: [...(node.nodes ?? [])].filter(n => n.id !== id)\n }));\n },\n\n /**\n * Toggle expand/collapse of node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @param expand Option to set expand collapse if user specifies explicitly\n * @returns Updated tree\n */\n toggleExpandCollapse(nodes: RuleStepTreeNode[], id: RuleStepTreeNode['id']): RuleStepTreeNode[] {\n return treeHelpers.mapNode([...nodes], id, node => ({\n ...node,\n expanded: !node.expanded,\n mountContent: true\n }));\n },\n\n /**\n * Change step type of a node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @param stepName Name of step,\n * @param stepVisual Visual of step\n * @returns Updated tree\n */\n changeStep(\n nodes: RuleStepTreeNode[],\n id: RuleStepTreeNode['id'],\n stepName: RuleStepTreeNode['stepName'],\n stepVisual: RuleStepTreeNode['stepVisual']\n ): RuleStepTreeNode[] {\n return treeHelpers.mapNode([...nodes], id, node => ({\n ...node,\n stepName,\n stepVisual\n }));\n },\n\n /**\n * Expand all nodes of tree.\n * @param nodes Current tree nodes\n * @returns Updated tree\n */\n expandAll(nodes: RuleStepTreeNode[]): RuleStepTreeNode[] {\n return treeHelpers.mapTree([...nodes], node => ({\n ...node,\n expanded: true,\n mountContent: true\n }));\n },\n\n /**\n * Collapse all nodes of tree.\n * @param nodes Current tree nodes\n * @returns Updated tree\n */\n collapseAll(nodes: RuleStepTreeNode[]): RuleStepTreeNode[] {\n return treeHelpers.mapTree([...nodes], node => ({\n ...node,\n expanded: false\n }));\n },\n\n /**\n * Calculate the step numbers and append to tree\n * @param nodes Current tree nodes\n * @param prefix Helper prefix text\n * @param depth Depth of node\n * @returns Updated tree with step numbers\n */\n calculateStepIndices(\n nodes: RuleStepTreeNode[],\n prefix: string = '',\n depth: number = 0\n ): RuleStepTreeNode[] {\n return nodes?.map((node, index) => {\n let currentPrefix = prefix ? `${prefix}.${index + 1}` : `${index + 1}`;\n if (node.stepName === AutomationActions.ActionErrorHandler) {\n const segments = currentPrefix.split('.');\n segments[segments.length - 1] = 'Err';\n currentPrefix = segments.join('.');\n }\n return {\n ...node,\n stepNumber: currentPrefix,\n nodes: node.nodes ? this.calculateStepIndices(node.nodes, currentPrefix, depth + 1) : []\n };\n });\n },\n\n /**\n *\n * @param nodes Rule steps\n * @param stepId Current step id\n * @returns Next node.\n */\n getNextNode(nodes: RuleStepTreeNode[], stepId: RuleStepTreeNode['stepId']): RuleStepTreeNode {\n const nodelist = treeHelpers.flatten(nodes);\n const currentNodeIndex = this.getNodeIndex(nodelist, stepId);\n return currentNodeIndex === nodelist.length - 1\n ? nodelist[nodelist.length - 1]\n : nodelist[currentNodeIndex + 1];\n },\n\n /**\n *\n * @param nodes Rule steps\n * @param stepId Current step id\n * @returns Previous node.\n */\n getPreviousNode(nodes: RuleStepTreeNode[], stepId: RuleStepTreeNode['stepId']): RuleStepTreeNode {\n const nodelist = treeHelpers.flatten(nodes);\n const currentNodeIndex = this.getNodeIndex(nodelist, stepId);\n return currentNodeIndex === 0 ? nodelist[0] : nodelist[currentNodeIndex - 1];\n },\n\n /**\n * Converts rule step data to AutomationWrapperProps\n * @param ruleStepData Raw rule data\n * @param fn Helper function to create node.\n * @returns Tree in AutomationWrapperProps structure.\n */\n constructRuleStepTree(\n ruleStepData: RuleStepData[],\n fn: (stepId: RuleStepTreeNode['stepId'], stepName: AutomationActionType) => RuleStepTreeNode\n ): RuleStepTreeNode[] {\n if (!ruleStepData || ruleStepData.length === 0) {\n return [];\n }\n\n return ruleStepData.map(({ Id, Type, RuleSteps, ...rest }) => {\n return {\n ...fn(Id, Type),\n meta: { Id, Type, ...rest },\n nodes: this.constructRuleStepTree(Array.isArray(RuleSteps) ? RuleSteps : [], fn)\n };\n });\n }\n};\n\nconst AUTOMATION_ACTION_TYPES_SET = new Set<string>(Object.values(AutomationActions));\n\nexport const isValidAutomationActionType = (value: string): value is AutomationActionType => {\n return AUTOMATION_ACTION_TYPES_SET.has(value);\n};\n"]}
1
+ {"version":3,"file":"Automation.utils.js","sourceRoot":"","sources":["../../../src/components/Automation/Automation.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC;;;;;OAKG;IACH,YAAY,CAAC,KAAyB,EAAE,EAA0B;QAChE,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,KAAyB,EAAE,KAAa,EAAE,OAAyB;QACzE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;OAMG;IACH,aAAa,CACX,KAAyB,EACzB,EAA0B,EAC1B,OAAyB;QAEzB,MAAM,UAAU,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE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QAE5F,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/C,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;YAC3D,OAAO;gBACL,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC;gBACf,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE;gBAC3B,KAAK,EAAE,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC;aACjF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAEtF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,KAAa,EAAiC,EAAE;IAC1F,OAAO,2BAA2B,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import { treeHelpers } from '@pega/cosmos-react-core';\n\nimport { AutomationActions } from './Automation.types';\nimport type { RuleStepData, RuleStepTreeNode, AutomationActionType } from './Automation.types';\n\nexport const automationTreeHelpers = {\n /**\n * Get the index of a node\n * @param nodes Rulesteps\n * @param id Id of required node\n * @returns Index of the node in list of nodes\n */\n getNodeIndex(nodes: RuleStepTreeNode[], id: RuleStepTreeNode['id']): number {\n return (nodes ?? []).findIndex(n => n.id === id);\n },\n\n /**\n * Add a node\n * @param nodes Current tree nodes\n * @param index Index in list where new node should be appended.\n * @param newNode New node\n * @returns Updated node list\n */\n addNode(nodes: RuleStepTreeNode[], index: number, newNode: RuleStepTreeNode): RuleStepTreeNode[] {\n return [...(nodes ?? []).slice(0, index), newNode, ...(nodes ?? []).slice(index)];\n },\n\n /**\n * Add a step before a node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @param newNode New node\n * @returns Updated tree\n */\n addStepBefore(\n nodes: RuleStepTreeNode[],\n id: RuleStepTreeNode['id'],\n newNode: RuleStepTreeNode\n ): RuleStepTreeNode[] {\n const parentNode = treeHelpers.getParentNode([...nodes], id);\n if (!parentNode) {\n return this.addNode(nodes, this.getNodeIndex(nodes, id), newNode);\n }\n return treeHelpers.mapNode([...nodes], parentNode.id, node => {\n return {\n ...node,\n nodes: this.addNode(node.nodes || [], this.getNodeIndex(node.nodes || [], id), newNode)\n };\n });\n },\n\n /**\n * Add step after a node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @param newNode New node\n * @returns Updated tree\n */\n addStepAfter(\n nodes: RuleStepTreeNode[],\n id: RuleStepTreeNode['id'],\n newNode: RuleStepTreeNode\n ): RuleStepTreeNode[] {\n const parentNode = treeHelpers.getParentNode([...nodes], id);\n if (!parentNode) {\n return this.addNode(nodes, this.getNodeIndex(nodes, id) + 1, newNode);\n }\n return treeHelpers.mapNode([...nodes], parentNode.id, node => {\n return {\n ...node,\n nodes: this.addNode(node.nodes || [], this.getNodeIndex(node.nodes || [], id) + 1, newNode)\n };\n });\n },\n\n /**\n * Add sub-step on a node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @param newNode New node\n * @returns Updated tree\n */\n addSubStep(\n nodes: RuleStepTreeNode[],\n id: RuleStepTreeNode['id'],\n newNode: RuleStepTreeNode\n ): RuleStepTreeNode[] {\n return treeHelpers.appendTo([...nodes], id, [newNode]);\n },\n\n /**\n * Delete the node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @returns Updated tree\n */\n deleteStep(nodes: RuleStepTreeNode[], id: RuleStepTreeNode['id']): RuleStepTreeNode[] {\n const parentNode = treeHelpers.getParentNode([...nodes], id);\n if (!parentNode) {\n return nodes.filter(node => node.id !== id);\n }\n return treeHelpers.mapNode([...nodes], parentNode.id, node => ({\n ...node,\n nodes: [...(node.nodes ?? [])].filter(n => n.id !== id)\n }));\n },\n\n /**\n * Toggle expand/collapse of node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @param expand Option to set expand collapse if user specifies explicitly\n * @returns Updated tree\n */\n toggleExpandCollapse(nodes: RuleStepTreeNode[], id: RuleStepTreeNode['id']): RuleStepTreeNode[] {\n return treeHelpers.mapNode([...nodes], id, node => ({\n ...node,\n expanded: !node.expanded,\n mountContent: true\n }));\n },\n\n /**\n * Change step type of a node.\n * @param nodes Current tree nodes\n * @param id Id of node clicked\n * @param stepName Name of step,\n * @param stepVisual Visual of step\n * @returns Updated tree\n */\n changeStep(\n nodes: RuleStepTreeNode[],\n id: RuleStepTreeNode['id'],\n stepName: RuleStepTreeNode['stepName'],\n stepVisual: RuleStepTreeNode['stepVisual']\n ): RuleStepTreeNode[] {\n return treeHelpers.mapNode([...nodes], id, node => ({\n ...node,\n stepName,\n stepVisual\n }));\n },\n\n /**\n * Expand all nodes of tree.\n * @param nodes Current tree nodes\n * @returns Updated tree\n */\n expandAll(nodes: RuleStepTreeNode[]): RuleStepTreeNode[] {\n return treeHelpers.mapTree([...nodes], node => ({\n ...node,\n expanded: true,\n mountContent: true\n }));\n },\n\n /**\n * Collapse all nodes of tree.\n * @param nodes Current tree nodes\n * @returns Updated tree\n */\n collapseAll(nodes: RuleStepTreeNode[]): RuleStepTreeNode[] {\n return treeHelpers.mapTree([...nodes], node => ({\n ...node,\n expanded: false\n }));\n },\n\n /**\n * Calculate the step numbers and append to tree.\n * Disabled steps are excluded from numbering.\n * @param nodes Current tree nodes\n * @param prefix Helper prefix text\n * @param depth Depth of node\n * @returns Updated tree with step numbers\n */\n calculateStepIndices(\n nodes: RuleStepTreeNode[],\n prefix: string = '',\n depth: number = 0\n ): RuleStepTreeNode[] {\n let enabledIndex = 0;\n return nodes?.map(node => {\n const isNodeDisabled = node.stepDisabled;\n let currentPrefix = '';\n\n if (!isNodeDisabled) {\n enabledIndex += 1;\n currentPrefix = prefix ? `${prefix}.${enabledIndex}` : `${enabledIndex}`;\n }\n\n if (currentPrefix && node.stepName === AutomationActions.ActionErrorHandler) {\n const segments = currentPrefix.split('.');\n segments[segments.length - 1] = 'Err';\n currentPrefix = segments.join('.');\n }\n\n return {\n ...node,\n stepNumber: currentPrefix,\n nodes: node.nodes ? this.calculateStepIndices(node.nodes, currentPrefix, depth + 1) : []\n };\n });\n },\n\n /**\n *\n * @param nodes Rule steps\n * @param stepId Current step id\n * @returns Next node.\n */\n getNextNode(nodes: RuleStepTreeNode[], stepId: RuleStepTreeNode['stepId']): RuleStepTreeNode {\n const nodelist = treeHelpers.flatten(nodes);\n const currentNodeIndex = this.getNodeIndex(nodelist, stepId);\n return currentNodeIndex === nodelist.length - 1\n ? nodelist[nodelist.length - 1]\n : nodelist[currentNodeIndex + 1];\n },\n\n /**\n *\n * @param nodes Rule steps\n * @param stepId Current step id\n * @returns Previous node.\n */\n getPreviousNode(nodes: RuleStepTreeNode[], stepId: RuleStepTreeNode['stepId']): RuleStepTreeNode {\n const nodelist = treeHelpers.flatten(nodes);\n const currentNodeIndex = this.getNodeIndex(nodelist, stepId);\n return currentNodeIndex === 0 ? nodelist[0] : nodelist[currentNodeIndex - 1];\n },\n\n /**\n * Converts rule step data to AutomationWrapperProps\n * @param ruleStepData Raw rule data\n * @param fn Helper function to create node.\n * @returns Tree in AutomationWrapperProps structure.\n */\n constructRuleStepTree(\n ruleStepData: RuleStepData[],\n fn: (stepId: RuleStepTreeNode['stepId'], stepName: AutomationActionType) => RuleStepTreeNode\n ): RuleStepTreeNode[] {\n if (!ruleStepData || ruleStepData.length === 0) {\n return [];\n }\n\n return ruleStepData.map(({ Id, Type, RuleSteps, ...rest }) => {\n return {\n ...fn(Id, Type),\n meta: { Id, Type, ...rest },\n nodes: this.constructRuleStepTree(Array.isArray(RuleSteps) ? RuleSteps : [], fn)\n };\n });\n }\n};\n\nconst AUTOMATION_ACTION_TYPES_SET = new Set<string>(Object.values(AutomationActions));\n\nexport const isValidAutomationActionType = (value: string): value is AutomationActionType => {\n return AUTOMATION_ACTION_TYPES_SET.has(value);\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
2
2
  import type { RuleStepProps } from './Automation.types';
3
3
  declare const _default: ForwardRefForwardPropsComponent<RuleStepProps> & {
4
- getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["expand-collapse-button", "error-icon", "step-number", "switch-menu", "summary", "summary-tooltip", "comment", "comment-tooltip", "add-step-menu", "step-actions", "content"]>;
4
+ getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["expand-collapse-button", "error-icon", "step-number", "switch-menu", "summary", "summary-tooltip", "comment", "comment-tooltip", "add-step-menu", "step-actions", "content", "disabled-badge"]>;
5
5
  };
6
6
  export default _default;
7
7
  //# sourceMappingURL=RuleStep.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RuleStep.d.ts","sourceRoot":"","sources":["../../../src/components/Automation/RuleStep.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAgB/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;;;;AAgVxD,wBAAyD"}
1
+ {"version":3,"file":"RuleStep.d.ts","sourceRoot":"","sources":["../../../src/components/Automation/RuleStep.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAe/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;;;;AAmUxD,wBAAyD"}
@@ -1,24 +1,23 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useState, useRef, useEffect, useContext, useMemo } from 'react';
3
- import { useDirection, Progress, Tooltip, useElement, Flex, Button, MenuButton, Icon, VisuallyHiddenText, ExpandCollapse, useConsolidatedRef, Text, useI18n, useTestIds, withTestIds, useEvent, Actions, getFocusables, registerIcon } from '@pega/cosmos-react-core';
3
+ import { useDirection, Progress, Tooltip, useElement, Flex, Button, MenuButton, Icon, VisuallyHiddenText, ExpandCollapse, useConsolidatedRef, Text, useI18n, useTestIds, withTestIds, useEvent, Actions, getFocusables, registerIcon, Status } from '@pega/cosmos-react-core';
4
4
  import * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';
5
5
  import * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';
6
6
  import * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';
7
7
  import IconTile from '../IconTile';
8
- import { StyledContainer, StyledStepHeader, StyledErrorIcon, StyledSummary, StyledComment, StyledContent } from './Automation.styles';
8
+ import { StyledContainer, StyledStepHeader, StyledErrorIcon, StyledSummary, StyledContent } from './Automation.styles';
9
9
  import { AutomationActions } from './Automation.types';
10
10
  import { getRuleStepTestIds } from './Automation.test-ids';
11
11
  import AutomationContext from './AutomationContext';
12
12
  import { isValidAutomationActionType } from './Automation.utils';
13
13
  registerIcon(caretDownIcon, caretLeftIcon, caretRightIcon);
14
- const RuleStep = forwardRef(({ testId, stepId, stepName, stepNumber, stepVisual, switchMenu, summary, comment, addStepMenu, content, onExpandCollapse, stepActions, expanded, error, readOnly, loading, mountContent = expanded, ...restProps }, ref) => {
14
+ const RuleStep = forwardRef(({ testId, stepId, stepName, stepNumber, stepVisual, switchMenu, summary, comment, addStepMenu, content, onExpandCollapse, stepActions, expanded, error, readOnly, stepDisabled, loading, mountContent = expanded, ...restProps }, ref) => {
15
15
  const t = useI18n();
16
16
  const { rtl } = useDirection();
17
17
  const testIds = useTestIds(testId, getRuleStepTestIds);
18
18
  const ruleStepRef = useConsolidatedRef(ref);
19
19
  const ruleStepActionsRef = useRef(null);
20
20
  const [summaryEl, setSummaryEl] = useElement(null);
21
- const [commentEl, setCommentEl] = useElement(null);
22
21
  const [ruleStepTabIndex, setRuleStepTabIndex] = useState(-1);
23
22
  const { focusedNodeId, focusInsideNode, firstNodeId } = useContext(AutomationContext);
24
23
  const focused = stepId === focusedNodeId;
@@ -128,14 +127,14 @@ const RuleStep = forwardRef(({ testId, stepId, stepName, stepNumber, stepVisual,
128
127
  setFocusableElementsTabIndex('-1');
129
128
  }
130
129
  }, [expanded]);
131
- return (_jsxs(Flex, { item: { grow: 1 }, as: StyledContainer, "data-testid": `${stepNumber}-${testIds.root}`, tabIndex: ruleStepTabIndex, ref: ruleStepRef, role: 'treeitem', "aria-expanded": expanded, "aria-describedby": stepId, "aria-label": `${expanded ? t('expanded_step', [stepDetail]) : t('collapsed_step', [stepDetail])}`, ...restProps, children: [_jsxs(Flex, { container: { justify: 'between', pad: 1 }, children: [_jsxs(Flex, { as: StyledStepHeader, container: { direction: 'column' }, children: [_jsxs(Flex, { item: { shrink: 1, grow: 1, basis: 'auto' }, container: { gap: 1, alignItems: 'center' }, children: [_jsx(Button, { icon: true, variant: 'simple', compact: true, onClick: () => onExpandCollapse?.(stepId), "data-testid": `${stepNumber}-${testIds.expandCollapseButton}`, "aria-label": `${expanded ? t('collapse_step', [stepNumber]) : t('expand_step', [stepNumber])}`, "aria-expanded": expanded, label: expanded ? t('collapse') : t('expand'), tabIndex: focusInsideNode ? 0 : -1, children: _jsx(Icon, { name: expanded ? 'caret-down' : `caret-${rtl ? 'left' : 'right'}` }) }), _jsx(Text, { "data-testid": `${stepNumber}-${testIds.stepNumber}`, children: stepNumber }), error && (_jsx(StyledErrorIcon, { "data-testid": `${stepNumber}-${testIds.errorIcon}`, name: 'warn-solid' })), _jsx(Flex, { item: { shrink: 0 }, children: stepVisual && _jsx(IconTile, { ...stepVisual }) }), switchMenu && !readOnly ? (_jsx(MenuButton, { testId: `${stepNumber}${testIds.switchMenu}`, ...switchMenu, tabIndex: focusInsideNode ? 0 : -1, variant: 'text', text: translatedStepName, menu: {
132
- ...switchMenu.menu,
133
- onItemClick: (id) => {
134
- if (isValidAutomationActionType(id)) {
135
- switchMenu?.menu.onItemClick?.(id, stepId, stepNumber);
136
- }
130
+ return (_jsxs(Flex, { item: { grow: 1 }, as: StyledContainer, "data-testid": `${stepNumber}${testIds.root}`, tabIndex: ruleStepTabIndex, ref: ruleStepRef, role: 'treeitem', "aria-disabled": stepDisabled, "aria-expanded": expanded, "aria-describedby": stepId, "aria-label": `${expanded ? t('expanded_step', [stepDetail]) : t('collapsed_step', [stepDetail])}`, ...restProps, children: [_jsxs(Flex, { container: { justify: 'between', pad: 1 }, children: [_jsx(Flex, { as: StyledStepHeader, container: { direction: 'column' }, children: _jsxs(Flex, { item: { shrink: 1, grow: 1, basis: 'auto' }, container: { gap: 1, alignItems: 'center' }, children: [_jsx(Button, { icon: true, variant: 'simple', compact: true, onClick: () => onExpandCollapse?.(stepId), "data-testid": `${stepNumber}${testIds.expandCollapseButton}`, "aria-label": `${expanded ? t('collapse_step', [stepNumber]) : t('expand_step', [stepNumber])}`, "aria-expanded": expanded, label: expanded ? t('collapse') : t('expand'), tabIndex: focusInsideNode ? 0 : -1, children: _jsx(Icon, { name: expanded ? 'caret-down' : `caret-${rtl ? 'left' : 'right'}` }) }), _jsx(Text, { "data-testid": `${stepNumber}${testIds.stepNumber}`, children: stepNumber }), error && (_jsx(StyledErrorIcon, { "data-testid": `${stepNumber}${testIds.errorIcon}`, name: 'warn-solid' })), _jsx(Flex, { item: { shrink: 0 }, children: stepVisual && _jsx(IconTile, { ...stepVisual }) }), switchMenu && !readOnly && !stepDisabled ? (_jsx(MenuButton, { testId: `${stepNumber}${testIds.switchMenu}`, ...switchMenu, tabIndex: focusInsideNode ? 0 : -1, variant: 'text', text: translatedStepName, menu: {
131
+ ...switchMenu.menu,
132
+ onItemClick: (id) => {
133
+ if (isValidAutomationActionType(id)) {
134
+ switchMenu?.menu.onItemClick?.(id, stepId, stepNumber);
137
135
  }
138
- } })) : (translatedStepName), summary && (_jsxs(_Fragment, { children: [_jsx(StyledSummary, { "data-testid": `${stepNumber}-${testIds.summary}`, variant: 'secondary', ref: setSummaryEl, children: summary }), _jsx(Tooltip, { smart: true, target: summaryEl, hideDelay: 'none', "data-testid": `${stepNumber}-${testIds.summaryTooltip}`, children: summary })] }))] }), comment && (_jsxs(_Fragment, { children: [_jsx(StyledComment, { ref: setCommentEl, "data-testid": `${stepNumber}-${testIds.comment}`, variant: 'secondary', children: comment }), _jsx(Tooltip, { smart: true, target: commentEl, hideDelay: 'none', "data-testid": `${stepNumber}-${testIds.commentTooltip}`, children: comment })] }))] }), _jsxs(Flex, { ref: ruleStepActionsRef, item: { shrink: 0 }, container: { justify: 'center', alignItems: 'center' }, children: [addStepMenu && !readOnly && (_jsx(MenuButton, { testId: `${stepNumber}-${testIds.addStepMenu}`, ...addStepMenu, icon: 'plus', iconOnly: true, compact: true, text: t('add_step'), variant: 'simple', tabIndex: focusInsideNode ? 0 : -1, menu: {
136
+ }
137
+ } })) : (translatedStepName), (comment || summary) && (_jsxs(_Fragment, { children: [_jsx(StyledSummary, { "data-testid": `${stepNumber}${testIds.summary}`, variant: 'secondary', ref: setSummaryEl, children: comment?.length ? comment : summary }), _jsx(Tooltip, { smart: true, target: summaryEl, hideDelay: 'none', "data-testid": `${stepNumber}${testIds.summaryTooltip}`, children: comment?.length ? comment : summary })] })), stepDisabled && (_jsx(Status, { variant: 'info', "data-testid": `${stepNumber}${testIds.disabledBadge}`, children: t('disabled') }))] }) }), _jsxs(Flex, { ref: ruleStepActionsRef, item: { shrink: 0 }, container: { justify: 'center', alignItems: 'center' }, children: [addStepMenu && !readOnly && !stepDisabled && (_jsx(MenuButton, { testId: `${stepNumber}${testIds.addStepMenu}`, ...addStepMenu, icon: 'plus', iconOnly: true, compact: true, text: t('add_step'), variant: 'simple', tabIndex: focusInsideNode ? 0 : -1, menu: {
139
138
  ...addStepMenu.menu,
140
139
  scrollAt: 20,
141
140
  mode: 'action',
@@ -145,7 +144,7 @@ const RuleStep = forwardRef(({ testId, stepId, stepName, stepNumber, stepVisual,
145
144
  addStepMenu?.menu.onItemClick?.(id, stepId, stepNumber);
146
145
  }
147
146
  }
148
- } })), stepActions && (_jsx(Actions, { "data-testid": `${stepNumber}-${testIds.stepActions}`, compact: true, contextualLabel: `step-${stepNumber}`, items: stepActions, tabIndex: focusInsideNode ? 0 : -1 }))] })] }), _jsx(VisuallyHiddenText, { id: stepId, children: error ? `Step name ${translatedStepName} has errors` : `Step name ${translatedStepName}` }), (content || loading) && (_jsx(ExpandCollapse, { transitionSpeed: '0.1s', collapsed: !expanded, children: _jsxs(StyledContent, { "data-testid": `${stepNumber}-${testIds.content}`, children: [(expanded || mountContent) && content, loading && (_jsx(Progress, { variant: 'ring', placement: 'local', focusOnVisible: true, message: t('loading') }))] }) }))] }));
147
+ } })), stepActions && (_jsx(Actions, { "data-testid": `${stepNumber}${testIds.stepActions}`, compact: true, contextualLabel: `step-${stepNumber}`, items: stepActions, tabIndex: focusInsideNode ? 0 : -1 }))] })] }), _jsx(VisuallyHiddenText, { id: stepId, children: error ? `Step name ${translatedStepName} has errors` : `Step name ${translatedStepName}` }), (content || loading) && (_jsx(ExpandCollapse, { transitionSpeed: '0.1s', collapsed: !expanded, children: _jsxs(StyledContent, { "data-testid": `${stepNumber}${testIds.content}`, children: [(expanded || mountContent) && content, loading && (_jsx(Progress, { variant: 'ring', placement: 'local', focusOnVisible: true, message: t('loading') }))] }) }))] }));
149
148
  });
150
149
  export default withTestIds(RuleStep, getRuleStepTestIds);
151
150
  //# sourceMappingURL=RuleStep.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RuleStep.js","sourceRoot":"","sources":["../../../src/components/Automation/RuleStep.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EA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C,CAAC,GAClC,CACH,IACI,IACF,EAEP,KAAC,kBAAkB,IAAC,EAAE,EAAE,MAAM,YAC3B,KAAK,CAAC,CAAC,CAAC,aAAa,kBAAkB,aAAa,CAAC,CAAC,CAAC,aAAa,kBAAkB,EAAE,GACtE,EAEpB,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CACvB,KAAC,cAAc,IAAC,eAAe,EAAC,MAAM,EAAC,SAAS,EAAE,CAAC,QAAQ,YACzD,MAAC,aAAa,mBAAc,GAAG,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,aAC3D,CAAC,QAAQ,IAAI,YAAY,CAAC,IAAI,OAAO,EAErC,OAAO,IAAI,CACV,KAAC,QAAQ,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,OAAO,EAAC,cAAc,QAAC,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC,GAAI,CACpF,IACa,GACD,CAClB,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useRef, useEffect, useContext, useMemo } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n useDirection,\n Progress,\n Tooltip,\n useElement,\n Flex,\n Button,\n MenuButton,\n Icon,\n VisuallyHiddenText,\n ExpandCollapse,\n useConsolidatedRef,\n Text,\n useI18n,\n useTestIds,\n withTestIds,\n useEvent,\n Actions,\n getFocusables,\n registerIcon\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';\n\nimport IconTile from '../IconTile';\n\nimport {\n StyledContainer,\n StyledStepHeader,\n StyledErrorIcon,\n StyledSummary,\n StyledComment,\n StyledContent\n} from './Automation.styles';\nimport { AutomationActions } from './Automation.types';\nimport type { RuleStepProps } from './Automation.types';\nimport { getRuleStepTestIds } from './Automation.test-ids';\nimport AutomationContext from './AutomationContext';\nimport { isValidAutomationActionType } from './Automation.utils';\n\nregisterIcon(caretDownIcon, caretLeftIcon, caretRightIcon);\n\nconst RuleStep: ForwardRefForwardPropsComponent<RuleStepProps> = forwardRef(\n (\n {\n testId,\n stepId,\n stepName,\n stepNumber,\n stepVisual,\n switchMenu,\n summary,\n comment,\n addStepMenu,\n content,\n onExpandCollapse,\n stepActions,\n expanded,\n error,\n readOnly,\n loading,\n mountContent = expanded,\n ...restProps\n }: PropsWithoutRef<RuleStepProps>,\n ref: RuleStepProps['ref']\n ) => {\n const t = useI18n();\n const { rtl } = useDirection();\n const testIds = useTestIds(testId, getRuleStepTestIds);\n\n const ruleStepRef = useConsolidatedRef(ref);\n const ruleStepActionsRef = useRef<HTMLDivElement | null>(null);\n\n const [summaryEl, setSummaryEl] = useElement(null);\n const [commentEl, setCommentEl] = useElement(null);\n\n const [ruleStepTabIndex, setRuleStepTabIndex] = useState(-1);\n const { focusedNodeId, focusInsideNode, firstNodeId } = useContext(AutomationContext);\n\n const focused = stepId === focusedNodeId;\n\n const translatedStepName = useMemo(() => {\n switch (stepName) {\n case AutomationActions.ActionSet:\n case AutomationActions.ActionSetRow:\n return t('action_set');\n\n case AutomationActions.ActionWhen:\n return t('action_when');\n\n case AutomationActions.ActionAppend:\n return t('action_append');\n\n case AutomationActions.ActionCall:\n return t('action_call');\n\n case AutomationActions.ActionCreate:\n return t('action_create');\n\n case AutomationActions.ActionForEach:\n return t('action_for_each');\n\n case AutomationActions.ActionExit:\n case AutomationActions.ActionExitAutomation:\n case AutomationActions.ActionExitIteration:\n case AutomationActions.ActionExitForEach:\n return t('action_exit');\n\n case AutomationActions.ActionReturn:\n return t('action_return');\n\n case AutomationActions.ActionRemove:\n case AutomationActions.ActionRemoveRow:\n return t('action_remove');\n\n case AutomationActions.ActionErrorHandler:\n return t('action_error_handler');\n\n default:\n return stepName;\n }\n }, [stepName]);\n\n const stepDetail = `${stepNumber}, ${translatedStepName}, ${summary || ''}, ${comment || ''}`;\n\n const setFocusableElementsTabIndex = (tabIndex: number | string) => {\n const focusables = getFocusables(ruleStepRef, { includeNegativeTabIndex: true });\n focusables.forEach(item => item.setAttribute('tabIndex', tabIndex.toString()));\n\n return focusables;\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'Escape': {\n if (focusInsideNode && focused) {\n ruleStepRef.current?.focus();\n }\n setFocusableElementsTabIndex('-1');\n break;\n }\n case 'Enter': {\n if (!focusInsideNode) {\n e.preventDefault();\n const focusables = setFocusableElementsTabIndex('0');\n if (focused) {\n focusables[0]?.focus();\n }\n }\n break;\n }\n case 'ArrowRight': {\n if (!focusInsideNode && !expanded) {\n onExpandCollapse?.(stepId);\n setFocusableElementsTabIndex('-1');\n }\n break;\n }\n case 'ArrowLeft': {\n if (!focusInsideNode && expanded) {\n onExpandCollapse?.(stepId);\n }\n break;\n }\n default:\n break;\n }\n };\n\n useEvent('keydown', onKeyDown, { target: ruleStepRef });\n\n // effect to focus the current step\n useEffect(() => {\n if (!focusInsideNode) {\n setFocusableElementsTabIndex('-1');\n if (focused) {\n ruleStepRef.current?.focus();\n }\n } else {\n const focusables = setFocusableElementsTabIndex('0');\n if (focused) {\n focusables[0]?.focus();\n }\n }\n }, [focused, focusedNodeId, focusInsideNode]);\n\n // effect to calculate tabIndex for step\n useEffect(() => {\n if (focusedNodeId) {\n setRuleStepTabIndex(stepId === focusedNodeId && !focusInsideNode ? 0 : -1);\n } else {\n setRuleStepTabIndex(stepId === firstNodeId ? 0 : -1);\n }\n }, [focusedNodeId, firstNodeId, focusInsideNode]);\n\n useEffect(() => {\n if (expanded) {\n setFocusableElementsTabIndex(focusInsideNode ? '0' : '-1');\n }\n if (!expanded && !focusInsideNode) {\n setFocusableElementsTabIndex('-1');\n }\n }, [expanded]);\n\n return (\n <Flex\n item={{ grow: 1 }}\n as={StyledContainer}\n data-testid={`${stepNumber}-${testIds.root}`}\n tabIndex={ruleStepTabIndex}\n ref={ruleStepRef}\n role='treeitem'\n aria-expanded={expanded}\n aria-describedby={stepId}\n aria-label={`${expanded ? t('expanded_step', [stepDetail]) : t('collapsed_step', [stepDetail])}`}\n {...restProps}\n >\n <Flex container={{ justify: 'between', pad: 1 }}>\n <Flex as={StyledStepHeader} container={{ direction: 'column' }}>\n <Flex\n item={{ shrink: 1, grow: 1, basis: 'auto' }}\n container={{ gap: 1, alignItems: 'center' }}\n >\n <Button\n icon\n variant='simple'\n compact\n onClick={() => onExpandCollapse?.(stepId)}\n data-testid={`${stepNumber}-${testIds.expandCollapseButton}`}\n aria-label={`${expanded ? t('collapse_step', [stepNumber]) : t('expand_step', [stepNumber])}`}\n aria-expanded={expanded}\n label={expanded ? t('collapse') : t('expand')}\n tabIndex={focusInsideNode ? 0 : -1}\n >\n <Icon name={expanded ? 'caret-down' : `caret-${rtl ? 'left' : 'right'}`} />\n </Button>\n\n <Text data-testid={`${stepNumber}-${testIds.stepNumber}`}>{stepNumber}</Text>\n\n {error && (\n <StyledErrorIcon\n data-testid={`${stepNumber}-${testIds.errorIcon}`}\n name='warn-solid'\n />\n )}\n\n <Flex item={{ shrink: 0 }}>{stepVisual && <IconTile {...stepVisual} />}</Flex>\n\n {switchMenu && !readOnly ? (\n <MenuButton\n testId={`${stepNumber}${testIds.switchMenu}`}\n {...switchMenu}\n tabIndex={focusInsideNode ? 0 : -1}\n variant='text'\n text={translatedStepName}\n menu={{\n ...switchMenu.menu,\n onItemClick: (id: string) => {\n if (isValidAutomationActionType(id)) {\n switchMenu?.menu.onItemClick?.(id, stepId, stepNumber);\n }\n }\n }}\n />\n ) : (\n translatedStepName\n )}\n\n {summary && (\n <>\n <StyledSummary\n data-testid={`${stepNumber}-${testIds.summary}`}\n variant='secondary'\n ref={setSummaryEl}\n >\n {summary}\n </StyledSummary>\n <Tooltip\n smart\n target={summaryEl}\n hideDelay='none'\n data-testid={`${stepNumber}-${testIds.summaryTooltip}`}\n >\n {summary}\n </Tooltip>\n </>\n )}\n </Flex>\n\n {comment && (\n <>\n <StyledComment\n ref={setCommentEl}\n data-testid={`${stepNumber}-${testIds.comment}`}\n variant='secondary'\n >\n {comment}\n </StyledComment>\n <Tooltip\n smart\n target={commentEl}\n hideDelay='none'\n data-testid={`${stepNumber}-${testIds.commentTooltip}`}\n >\n {comment}\n </Tooltip>\n </>\n )}\n </Flex>\n\n <Flex\n ref={ruleStepActionsRef}\n item={{ shrink: 0 }}\n container={{ justify: 'center', alignItems: 'center' }}\n >\n {addStepMenu && !readOnly && (\n <MenuButton\n testId={`${stepNumber}-${testIds.addStepMenu}`}\n {...addStepMenu}\n icon='plus'\n iconOnly\n compact\n text={t('add_step')}\n variant='simple'\n tabIndex={focusInsideNode ? 0 : -1}\n menu={{\n ...addStepMenu.menu,\n scrollAt: 20,\n mode: 'action',\n variant: 'drill-down',\n onItemClick: (id: string) => {\n if (isValidAutomationActionType(id)) {\n addStepMenu?.menu.onItemClick?.(id, stepId, stepNumber);\n }\n }\n }}\n />\n )}\n\n {stepActions && (\n <Actions\n data-testid={`${stepNumber}-${testIds.stepActions}`}\n compact\n contextualLabel={`step-${stepNumber}`}\n items={stepActions}\n tabIndex={focusInsideNode ? 0 : -1}\n />\n )}\n </Flex>\n </Flex>\n\n <VisuallyHiddenText id={stepId}>\n {error ? `Step name ${translatedStepName} has errors` : `Step name ${translatedStepName}`}\n </VisuallyHiddenText>\n\n {(content || loading) && (\n <ExpandCollapse transitionSpeed='0.1s' collapsed={!expanded}>\n <StyledContent data-testid={`${stepNumber}-${testIds.content}`}>\n {(expanded || mountContent) && content}\n\n {loading && (\n <Progress variant='ring' placement='local' focusOnVisible message={t('loading')} />\n )}\n </StyledContent>\n </ExpandCollapse>\n )}\n </Flex>\n );\n }\n);\n\nexport default withTestIds(RuleStep, getRuleStepTestIds);\n"]}
1
+ {"version":3,"file":"RuleStep.js","sourceRoot":"","sources":["../../../src/components/Automation/RuleStep.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGrF,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,UAAU,EACV,IAAI,EACJ,MAAM,EACN,UAAU,EACV,IAAI,EACJ,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,WAAW,EACX,QAAQ,EACR,OAAO,EACP,aAAa,EACb,YAAY,EACZ,MAAM,EACP,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AAErG,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,aAAa,EACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEjE,YAAY,CAAC,aAAa,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;AAE3D,MAAM,QAAQ,GAAmD,UAAU,CACzE,CACE,EACE,MAAM,EACN,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,OAAO,EACP,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,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U,EAAE,EACrC,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAClC,CACH,IACI,IACF,EAEP,KAAC,kBAAkB,IAAC,EAAE,EAAE,MAAM,YAC3B,KAAK,CAAC,CAAC,CAAC,aAAa,kBAAkB,aAAa,CAAC,CAAC,CAAC,aAAa,kBAAkB,EAAE,GACtE,EAEpB,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CACvB,KAAC,cAAc,IAAC,eAAe,EAAC,MAAM,EAAC,SAAS,EAAE,CAAC,QAAQ,YACzD,MAAC,aAAa,mBAAc,GAAG,UAAU,GAAG,OAAO,CAAC,OAAO,EAAE,aAC1D,CAAC,QAAQ,IAAI,YAAY,CAAC,IAAI,OAAO,EAErC,OAAO,IAAI,CACV,KAAC,QAAQ,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,OAAO,EAAC,cAAc,QAAC,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC,GAAI,CACpF,IACa,GACD,CAClB,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useRef, useEffect, useContext, useMemo } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n useDirection,\n Progress,\n Tooltip,\n useElement,\n Flex,\n Button,\n MenuButton,\n Icon,\n VisuallyHiddenText,\n ExpandCollapse,\n useConsolidatedRef,\n Text,\n useI18n,\n useTestIds,\n withTestIds,\n useEvent,\n Actions,\n getFocusables,\n registerIcon,\n Status\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';\n\nimport IconTile from '../IconTile';\n\nimport {\n StyledContainer,\n StyledStepHeader,\n StyledErrorIcon,\n StyledSummary,\n StyledContent\n} from './Automation.styles';\nimport { AutomationActions } from './Automation.types';\nimport type { RuleStepProps } from './Automation.types';\nimport { getRuleStepTestIds } from './Automation.test-ids';\nimport AutomationContext from './AutomationContext';\nimport { isValidAutomationActionType } from './Automation.utils';\n\nregisterIcon(caretDownIcon, caretLeftIcon, caretRightIcon);\n\nconst RuleStep: ForwardRefForwardPropsComponent<RuleStepProps> = forwardRef(\n (\n {\n testId,\n stepId,\n stepName,\n stepNumber,\n stepVisual,\n switchMenu,\n summary,\n comment,\n addStepMenu,\n content,\n onExpandCollapse,\n stepActions,\n expanded,\n error,\n readOnly,\n stepDisabled,\n loading,\n mountContent = expanded,\n ...restProps\n }: PropsWithoutRef<RuleStepProps>,\n ref: RuleStepProps['ref']\n ) => {\n const t = useI18n();\n const { rtl } = useDirection();\n const testIds = useTestIds(testId, getRuleStepTestIds);\n\n const ruleStepRef = useConsolidatedRef(ref);\n const ruleStepActionsRef = useRef<HTMLDivElement | null>(null);\n\n const [summaryEl, setSummaryEl] = useElement(null);\n\n const [ruleStepTabIndex, setRuleStepTabIndex] = useState(-1);\n const { focusedNodeId, focusInsideNode, firstNodeId } = useContext(AutomationContext);\n\n const focused = stepId === focusedNodeId;\n\n const translatedStepName = useMemo(() => {\n switch (stepName) {\n case AutomationActions.ActionSet:\n case AutomationActions.ActionSetRow:\n return t('action_set');\n\n case AutomationActions.ActionWhen:\n return t('action_when');\n\n case AutomationActions.ActionAppend:\n return t('action_append');\n\n case AutomationActions.ActionCall:\n return t('action_call');\n\n case AutomationActions.ActionCreate:\n return t('action_create');\n\n case AutomationActions.ActionForEach:\n return t('action_for_each');\n\n case AutomationActions.ActionExit:\n case AutomationActions.ActionExitAutomation:\n case AutomationActions.ActionExitIteration:\n case AutomationActions.ActionExitForEach:\n return t('action_exit');\n\n case AutomationActions.ActionReturn:\n return t('action_return');\n\n case AutomationActions.ActionRemove:\n case AutomationActions.ActionRemoveRow:\n return t('action_remove');\n\n case AutomationActions.ActionErrorHandler:\n return t('action_error_handler');\n\n default:\n return stepName;\n }\n }, [stepName]);\n\n const stepDetail = `${stepNumber}, ${translatedStepName}, ${summary || ''}, ${comment || ''}`;\n\n const setFocusableElementsTabIndex = (tabIndex: number | string) => {\n const focusables = getFocusables(ruleStepRef, { includeNegativeTabIndex: true });\n focusables.forEach(item => item.setAttribute('tabIndex', tabIndex.toString()));\n\n return focusables;\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'Escape': {\n if (focusInsideNode && focused) {\n ruleStepRef.current?.focus();\n }\n setFocusableElementsTabIndex('-1');\n break;\n }\n case 'Enter': {\n if (!focusInsideNode) {\n e.preventDefault();\n const focusables = setFocusableElementsTabIndex('0');\n if (focused) {\n focusables[0]?.focus();\n }\n }\n break;\n }\n case 'ArrowRight': {\n if (!focusInsideNode && !expanded) {\n onExpandCollapse?.(stepId);\n setFocusableElementsTabIndex('-1');\n }\n break;\n }\n case 'ArrowLeft': {\n if (!focusInsideNode && expanded) {\n onExpandCollapse?.(stepId);\n }\n break;\n }\n default:\n break;\n }\n };\n\n useEvent('keydown', onKeyDown, { target: ruleStepRef });\n\n // effect to focus the current step\n useEffect(() => {\n if (!focusInsideNode) {\n setFocusableElementsTabIndex('-1');\n if (focused) {\n ruleStepRef.current?.focus();\n }\n } else {\n const focusables = setFocusableElementsTabIndex('0');\n if (focused) {\n focusables[0]?.focus();\n }\n }\n }, [focused, focusedNodeId, focusInsideNode]);\n\n // effect to calculate tabIndex for step\n useEffect(() => {\n if (focusedNodeId) {\n setRuleStepTabIndex(stepId === focusedNodeId && !focusInsideNode ? 0 : -1);\n } else {\n setRuleStepTabIndex(stepId === firstNodeId ? 0 : -1);\n }\n }, [focusedNodeId, firstNodeId, focusInsideNode]);\n\n useEffect(() => {\n if (expanded) {\n setFocusableElementsTabIndex(focusInsideNode ? '0' : '-1');\n }\n if (!expanded && !focusInsideNode) {\n setFocusableElementsTabIndex('-1');\n }\n }, [expanded]);\n\n return (\n <Flex\n item={{ grow: 1 }}\n as={StyledContainer}\n data-testid={`${stepNumber}${testIds.root}`}\n tabIndex={ruleStepTabIndex}\n ref={ruleStepRef}\n role='treeitem'\n aria-disabled={stepDisabled}\n aria-expanded={expanded}\n aria-describedby={stepId}\n aria-label={`${expanded ? t('expanded_step', [stepDetail]) : t('collapsed_step', [stepDetail])}`}\n {...restProps}\n >\n <Flex container={{ justify: 'between', pad: 1 }}>\n <Flex as={StyledStepHeader} container={{ direction: 'column' }}>\n <Flex\n item={{ shrink: 1, grow: 1, basis: 'auto' }}\n container={{ gap: 1, alignItems: 'center' }}\n >\n <Button\n icon\n variant='simple'\n compact\n onClick={() => onExpandCollapse?.(stepId)}\n data-testid={`${stepNumber}${testIds.expandCollapseButton}`}\n aria-label={`${expanded ? t('collapse_step', [stepNumber]) : t('expand_step', [stepNumber])}`}\n aria-expanded={expanded}\n label={expanded ? t('collapse') : t('expand')}\n tabIndex={focusInsideNode ? 0 : -1}\n >\n <Icon name={expanded ? 'caret-down' : `caret-${rtl ? 'left' : 'right'}`} />\n </Button>\n\n <Text data-testid={`${stepNumber}${testIds.stepNumber}`}>{stepNumber}</Text>\n\n {error && (\n <StyledErrorIcon\n data-testid={`${stepNumber}${testIds.errorIcon}`}\n name='warn-solid'\n />\n )}\n\n <Flex item={{ shrink: 0 }}>{stepVisual && <IconTile {...stepVisual} />}</Flex>\n\n {switchMenu && !readOnly && !stepDisabled ? (\n <MenuButton\n testId={`${stepNumber}${testIds.switchMenu}`}\n {...switchMenu}\n tabIndex={focusInsideNode ? 0 : -1}\n variant='text'\n text={translatedStepName}\n menu={{\n ...switchMenu.menu,\n onItemClick: (id: string) => {\n if (isValidAutomationActionType(id)) {\n switchMenu?.menu.onItemClick?.(id, stepId, stepNumber);\n }\n }\n }}\n />\n ) : (\n translatedStepName\n )}\n\n {(comment || summary) && (\n <>\n <StyledSummary\n data-testid={`${stepNumber}${testIds.summary}`}\n variant='secondary'\n ref={setSummaryEl}\n >\n {comment?.length ? comment : summary}\n </StyledSummary>\n <Tooltip\n smart\n target={summaryEl}\n hideDelay='none'\n data-testid={`${stepNumber}${testIds.summaryTooltip}`}\n >\n {comment?.length ? comment : summary}\n </Tooltip>\n </>\n )}\n\n {stepDisabled && (\n <Status variant='info' data-testid={`${stepNumber}${testIds.disabledBadge}`}>\n {t('disabled')}\n </Status>\n )}\n </Flex>\n </Flex>\n\n <Flex\n ref={ruleStepActionsRef}\n item={{ shrink: 0 }}\n container={{ justify: 'center', alignItems: 'center' }}\n >\n {addStepMenu && !readOnly && !stepDisabled && (\n <MenuButton\n testId={`${stepNumber}${testIds.addStepMenu}`}\n {...addStepMenu}\n icon='plus'\n iconOnly\n compact\n text={t('add_step')}\n variant='simple'\n tabIndex={focusInsideNode ? 0 : -1}\n menu={{\n ...addStepMenu.menu,\n scrollAt: 20,\n mode: 'action',\n variant: 'drill-down',\n onItemClick: (id: string) => {\n if (isValidAutomationActionType(id)) {\n addStepMenu?.menu.onItemClick?.(id, stepId, stepNumber);\n }\n }\n }}\n />\n )}\n\n {stepActions && (\n <Actions\n data-testid={`${stepNumber}${testIds.stepActions}`}\n compact\n contextualLabel={`step-${stepNumber}`}\n items={stepActions}\n tabIndex={focusInsideNode ? 0 : -1}\n />\n )}\n </Flex>\n </Flex>\n\n <VisuallyHiddenText id={stepId}>\n {error ? `Step name ${translatedStepName} has errors` : `Step name ${translatedStepName}`}\n </VisuallyHiddenText>\n\n {(content || loading) && (\n <ExpandCollapse transitionSpeed='0.1s' collapsed={!expanded}>\n <StyledContent data-testid={`${stepNumber}${testIds.content}`}>\n {(expanded || mountContent) && content}\n\n {loading && (\n <Progress variant='ring' placement='local' focusOnVisible message={t('loading')} />\n )}\n </StyledContent>\n </ExpandCollapse>\n )}\n </Flex>\n );\n }\n);\n\nexport default withTestIds(RuleStep, getRuleStepTestIds);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-build",
3
- "version": "10.0.0-build.2.3",
3
+ "version": "10.0.0-build.2.5",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "author": "Pegasystems",
6
6
  "sideEffects": false,
@@ -15,9 +15,9 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@dagrejs/dagre": "^3.0.0",
18
- "@pega/cosmos-react-core": "10.0.0-build.2.3",
19
- "@pega/cosmos-react-dnd": "10.0.0-build.2.3",
20
- "@pega/cosmos-react-rte": "10.0.0-build.2.3",
18
+ "@pega/cosmos-react-core": "10.0.0-build.2.5",
19
+ "@pega/cosmos-react-dnd": "10.0.0-build.2.5",
20
+ "@pega/cosmos-react-rte": "10.0.0-build.2.5",
21
21
  "@types/codemirror": "^5.60.15",
22
22
  "@types/react": "^17.0.62 || ^18.3.3",
23
23
  "@types/react-dom": "^17.0.20 || ^18.3.0",