@pega/cosmos-react-build 2.1.3 → 3.0.0-dev.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/lib/components/AppHeader/AppHeader.d.ts +3 -3
  2. package/lib/components/AppHeader/AppHeader.d.ts.map +1 -1
  3. package/lib/components/AppHeader/AppHeader.js +5 -4
  4. package/lib/components/AppHeader/AppHeader.js.map +1 -1
  5. package/lib/components/AppHeader/AppHeader.styles.d.ts.map +1 -1
  6. package/lib/components/AppHeader/AppHeader.styles.js +4 -0
  7. package/lib/components/AppHeader/AppHeader.styles.js.map +1 -1
  8. package/lib/components/AppHeader/BranchButton.d.ts +19 -0
  9. package/lib/components/AppHeader/BranchButton.d.ts.map +1 -0
  10. package/lib/components/AppHeader/BranchButton.js +87 -0
  11. package/lib/components/AppHeader/BranchButton.js.map +1 -0
  12. package/lib/components/AppHeader/index.d.ts +1 -0
  13. package/lib/components/AppHeader/index.d.ts.map +1 -1
  14. package/lib/components/AppHeader/index.js +1 -0
  15. package/lib/components/AppHeader/index.js.map +1 -1
  16. package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -1
  17. package/lib/components/FlowModeller/FlowModeller.js +4 -3
  18. package/lib/components/FlowModeller/FlowModeller.js.map +1 -1
  19. package/lib/components/FlowModeller/Node/Node.types.d.ts +4 -3
  20. package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -1
  21. package/lib/components/FlowModeller/Node/Node.types.js.map +1 -1
  22. package/lib/components/ItemLibrary/ItemLibrary.d.ts +23 -0
  23. package/lib/components/ItemLibrary/ItemLibrary.d.ts.map +1 -0
  24. package/lib/components/{FlowModeller/NodeLibrary.js → ItemLibrary/ItemLibrary.js} +22 -9
  25. package/lib/components/ItemLibrary/ItemLibrary.js.map +1 -0
  26. package/lib/components/ItemLibrary/index.d.ts +3 -0
  27. package/lib/components/ItemLibrary/index.d.ts.map +1 -0
  28. package/lib/components/ItemLibrary/index.js +3 -0
  29. package/lib/components/ItemLibrary/index.js.map +1 -0
  30. package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -1
  31. package/lib/components/LifeCycle/LifeCycle.js +4 -3
  32. package/lib/components/LifeCycle/LifeCycle.js.map +1 -1
  33. package/lib/components/LifeCycle/LifeCycle.types.d.ts +12 -1
  34. package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -1
  35. package/lib/components/LifeCycle/LifeCycle.types.js +78 -1
  36. package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -1
  37. package/lib/components/LifeCycle/LifeCycleList.d.ts +3 -2
  38. package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -1
  39. package/lib/components/LifeCycle/LifeCycleList.js +4 -2
  40. package/lib/components/LifeCycle/LifeCycleList.js.map +1 -1
  41. package/lib/components/LifeCycle/Stage.d.ts +6 -10
  42. package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
  43. package/lib/components/LifeCycle/Stage.js +40 -39
  44. package/lib/components/LifeCycle/Stage.js.map +1 -1
  45. package/lib/components/LifeCycle/Step.d.ts +2 -0
  46. package/lib/components/LifeCycle/Step.d.ts.map +1 -1
  47. package/lib/components/LifeCycle/Step.js +12 -2
  48. package/lib/components/LifeCycle/Step.js.map +1 -1
  49. package/lib/components/LifeCycle/Task.d.ts +2 -0
  50. package/lib/components/LifeCycle/Task.d.ts.map +1 -1
  51. package/lib/components/LifeCycle/Task.js +12 -3
  52. package/lib/components/LifeCycle/Task.js.map +1 -1
  53. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  54. package/lib/components/PageTemplates/PageTemplates.js +9 -17
  55. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  56. package/lib/components/Workbench/ConfigurationPanel.d.ts.map +1 -1
  57. package/lib/components/Workbench/ConfigurationPanel.js +3 -3
  58. package/lib/components/Workbench/ConfigurationPanel.js.map +1 -1
  59. package/lib/components/Workbench/Workbench.d.ts.map +1 -1
  60. package/lib/components/Workbench/Workbench.js +1 -1
  61. package/lib/components/Workbench/Workbench.js.map +1 -1
  62. package/lib/components/Workbench/Workbench.styles.d.ts +2 -3
  63. package/lib/components/Workbench/Workbench.styles.d.ts.map +1 -1
  64. package/lib/components/Workbench/Workbench.styles.js +14 -9
  65. package/lib/components/Workbench/Workbench.styles.js.map +1 -1
  66. package/lib/index.d.ts +1 -0
  67. package/lib/index.d.ts.map +1 -1
  68. package/lib/index.js +1 -0
  69. package/lib/index.js.map +1 -1
  70. package/package.json +11 -12
  71. package/lib/components/FlowModeller/NodeLibrary.d.ts +0 -13
  72. package/lib/components/FlowModeller/NodeLibrary.d.ts.map +0 -1
  73. package/lib/components/FlowModeller/NodeLibrary.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ export { default as ItemLibrary } from './ItemLibrary';
2
+ export * from './ItemLibrary';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ItemLibrary/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,cAAc,eAAe,CAAC","sourcesContent":["export { default as ItemLibrary } from './ItemLibrary';\nexport * from './ItemLibrary';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LifeCycle.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,GAAG,EAIJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,SAAS,EACT,YAAY,EAKZ,cAAc,EACf,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,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Ac,EAAE,CAAC;IAElC,IAAI,EAAE,SAAS,EAAE,CAAC;IAElB,KAAK,EAAE,UAAU,CAAC;IAElB,cAAc,EAAE,UAAU,CAAC;IAE3B,UAAU,EAAE,eAAe,EAAE,CAAC;IAE9B,IAAI,EAAE,SAAS,EAAE,CAAC;IAElB,UAAU,EAAE,MAAM,IAAI,CAAC;IAEvB,mBAAmB,EAAE,MAAM,IAAI,CAAC;CACjC;AAeD,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAkI/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createElement as _createElement } from "react";
2
3
  import { forwardRef, useLayoutEffect, useRef, useState } from 'react';
3
4
  import styled, { css } from 'styled-components';
4
5
  import { defaultThemeProp, Flex, Button, Icon, useI18n } from '@pega/cosmos-react-core';
@@ -63,10 +64,10 @@ const LifeCycle = forwardRef(({ items, categories, alternateItems = [], onAddSta
63
64
  });
64
65
  return (_jsxs(Flex, { container: { itemGap: 2 }, ref: ref, children: [_jsxs(Flex, { as: StyledLifeCycle, ref: lifeCycleEl, container: true, role: 'grid', "aria-label": t('stage'), children: [items.map((stageItem, index, stageArray) => {
65
66
  const listId = stageItem.id;
66
- return (_jsx(LifeCycleList, { id: listId, item: stageItem, isFirstItem: index === 0, isLastItem: index === stageArray.length - 1, ref: setRef, stage: stage, categories: categoriesState, ...restProps }, listId));
67
- }), _jsx(StyledAddButton, { variant: 'simple', label: t('add_stage'), icon: true, onClick: onAddStage, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0)] }, void 0), alternateItems.length !== 0 && (_jsxs(Flex, { as: StyledLifeCycle, container: true, ref: lifeCycleEl, role: 'grid', "aria-label": t('alternate_stage'), children: [alternateItems.map((stageItem) => {
67
+ return (_createElement(LifeCycleList, { ...restProps, key: listId, id: listId, item: stageItem, isFirstItem: index === 0, isLastItem: index === stageArray.length - 1, ref: setRef, stage: stage, prevStageVariant: stageArray[index - 1]?.type, categories: categoriesState }));
68
+ }), _jsx(StyledAddButton, { variant: 'simple', label: t('add_stage'), icon: true, onClick: onAddStage, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0)] }, void 0), alternateItems.length !== 0 && (_jsxs(Flex, { as: StyledLifeCycle, container: true, ref: lifeCycleEl, role: 'grid', "aria-label": t('alternate_stage'), children: [alternateItems.map((stageItem, index, stageArray) => {
68
69
  const listId = stageItem.id;
69
- return (_jsx(LifeCycleList, { id: listId, item: stageItem, ref: setRef, categories: categoriesState, stageVariant: 'alternate', stage: alternateStage, ...restProps }, listId));
70
+ return (_createElement(LifeCycleList, { ...restProps, key: listId, id: listId, item: stageItem, isFirstItem: index === 0, isLastItem: index === stageArray.length - 1, ref: setRef, categories: categoriesState, stageVariant: 'alternate', prevStageVariant: stageArray[index - 1]?.type, stage: alternateStage }));
70
71
  }), _jsx(StyledAddButton, { variant: 'simple', label: t('add_alternate_stage'), icon: true, onClick: onAddAlternateStage, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0)] }, void 0))] }, void 0));
71
72
  });
72
73
  export default LifeCycle;
@@ -1 +1 @@
1
- {"version":3,"file":"LifeCycle.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAIV,eAAe,EACf,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAGhB,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,OAAO,EAER,MAAM,yBAAyB,CAAC;AAEjC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AA8B5C,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AAEpC,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD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AAe,IACd,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,CAAC,CAAC,qBAAqB,CAAC,EAC/B,IAAI,QACJ,OAAO,EAAE,mBAAmB,YAE5B,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,WAAG,WACJ,YACb,CACR,YACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useLayoutEffect,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Flex,\n Button,\n Icon,\n useI18n,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\n\nimport LifeCycleList from './LifeCycleList';\nimport { StageItemProps } from './LifeCycle.types';\nimport { StageProps } from './Stage';\nimport { CategoriesProps } from './Category';\nimport { TaskProps } from './Task';\nimport { StepProps } from './Step';\n\nexport interface LifeCycleProps extends BaseProps, NoChildrenProp {\n /* Pass reference to the LifeCycleComponent */\n ref?: Ref<HTMLDivElement>;\n /* Array of stages and its contents */\n items: StageItemProps[];\n /* Array of alternate stages and its contents */\n alternateItems?: StageItemProps[];\n /* Props for the task component */\n task: TaskProps[];\n /* Props for the Stage component */\n stage: StageProps;\n /* Props for the AlternatStage component */\n alternateStage: StageProps;\n /* Props for the Cluster component */\n categories: CategoriesProps[];\n /* Props for the Step component */\n step: StepProps[];\n /* Call back function for on AddState */\n onAddStage: () => void;\n /* Call back function to add alternate stages */\n onAddAlternateStage: () => void;\n}\n\nconst StyledLifeCycle = styled.ol``;\n\nStyledLifeCycle.defaultProps = defaultThemeProp;\n\nconst StyledAddButton = styled(Button)(({ theme }) => {\n return css`\n align-self: flex-start;\n margin-block-start: calc(${theme.base.spacing} / 2);\n `;\n});\n\nStyledAddButton.defaultProps = defaultThemeProp;\n\nconst LifeCycle: FunctionComponent<LifeCycleProps & ForwardProps> = forwardRef(\n (\n {\n items,\n categories,\n alternateItems = [],\n onAddStage,\n onAddAlternateStage,\n stage,\n alternateStage,\n ...restProps\n }: PropsWithoutRef<LifeCycleProps>,\n ref: LifeCycleProps['ref']\n ) => {\n const lifeCycleEl = useRef(null);\n const t = useI18n();\n const [categoriesState, setcategoriesState] = useState(categories);\n const categoryElements: HTMLElement[] = [];\n const setRef = (element: HTMLOListElement) => {\n if (element) {\n categoryElements.push(element);\n }\n };\n\n useLayoutEffect(() => {\n let isHeightChanged = false;\n const categoriesColumn = [...categories];\n if (categoriesColumn && categoriesColumn.length > 0) {\n categoriesColumn.forEach((categoryItem, index) => {\n const categoryElm = [...categoryElements];\n let isActiveElement = false;\n const categoryComponent = categoryElm.filter((element: HTMLElement) => {\n if (element.getAttribute('data-id') === categoryItem.id) {\n if (categoryItem.elementId === element.getAttribute('id')) {\n isActiveElement = true;\n }\n return true;\n }\n return false;\n });\n if (!isActiveElement) {\n categoryItem.elementId = '';\n categoryItem.height = 0;\n }\n categoryComponent.forEach(categoryElement => {\n const columnHeight = categoryItem?.height ?? 0;\n const height = categoryElement.scrollHeight;\n const elementId = categoryElement.getAttribute('id');\n if (\n height > columnHeight ||\n (categoryItem.elementId === elementId && height !== columnHeight)\n ) {\n isHeightChanged = true;\n categoriesColumn[index].height = height;\n if (elementId) categoriesColumn[index].elementId = elementId;\n }\n });\n });\n if (isHeightChanged) {\n isHeightChanged = false;\n setcategoriesState(categoriesColumn);\n }\n }\n });\n\n return (\n <Flex container={{ itemGap: 2 }} ref={ref}>\n <Flex as={StyledLifeCycle} ref={lifeCycleEl} container role='grid' aria-label={t('stage')}>\n {items.map((stageItem: StageItemProps, index: number, stageArray: StageItemProps[]) => {\n const listId = stageItem.id;\n return (\n <LifeCycleList\n key={listId}\n id={listId}\n item={stageItem}\n isFirstItem={index === 0}\n isLastItem={index === stageArray.length - 1}\n ref={setRef}\n stage={stage}\n categories={categoriesState}\n {...restProps}\n />\n );\n })}\n <StyledAddButton variant='simple' label={t('add_stage')} icon onClick={onAddStage}>\n <Icon name='plus' />\n </StyledAddButton>\n </Flex>\n {alternateItems.length !== 0 && (\n <Flex\n as={StyledLifeCycle}\n container\n ref={lifeCycleEl}\n role='grid'\n aria-label={t('alternate_stage')}\n >\n {alternateItems.map((stageItem: StageItemProps) => {\n const listId = stageItem.id;\n return (\n <LifeCycleList\n key={listId}\n id={listId}\n item={stageItem}\n ref={setRef}\n categories={categoriesState}\n stageVariant='alternate'\n stage={alternateStage}\n {...restProps}\n />\n );\n })}\n <StyledAddButton\n variant='simple'\n label={t('add_alternate_stage')}\n icon\n onClick={onAddAlternateStage}\n >\n <Icon name='plus' />\n </StyledAddButton>\n </Flex>\n )}\n </Flex>\n );\n }\n);\n\nexport default LifeCycle;\n"]}
1
+ {"version":3,"file":"LifeCycle.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EAIV,eAAe,EACf,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAGhB,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,OAAO,EAER,MAAM,yBAAyB,CAAC;AAEjC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AA8B5C,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AAEpC,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACnD,OAAO,GAAG,CAAA;;+BAEmB,KAAK,CAAC,IAAI,CAAC,OAAO;GAC9C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD,MAAM,SAAS,GAAqD,UAAU,CAC5E,CACE,EACE,KAAK,EACL,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AO,EAAC,QAAQ,EAChB,KAAK,EAAE,CAAC,CAAC,qBAAqB,CAAC,EAC/B,IAAI,QACJ,OAAO,EAAE,mBAAmB,YAE5B,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,WAAG,WACJ,YACb,CACR,YACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useLayoutEffect,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Flex,\n Button,\n Icon,\n useI18n,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\n\nimport LifeCycleList from './LifeCycleList';\nimport { StageItemProps } from './LifeCycle.types';\nimport { StageProps } from './Stage';\nimport { CategoriesProps } from './Category';\nimport { TaskProps } from './Task';\nimport { StepProps } from './Step';\n\nexport interface LifeCycleProps extends BaseProps, NoChildrenProp {\n /* Pass reference to the LifeCycleComponent */\n ref?: Ref<HTMLDivElement>;\n /* Array of stages and its contents */\n items: StageItemProps[];\n /* Array of alternate stages and its contents */\n alternateItems?: StageItemProps[];\n /* Props for the task component */\n task: TaskProps[];\n /* Props for the Stage component */\n stage: StageProps;\n /* Props for the AlternatStage component */\n alternateStage: StageProps;\n /* Props for the Cluster component */\n categories: CategoriesProps[];\n /* Props for the Step component */\n step: StepProps[];\n /* Call back function for on AddState */\n onAddStage: () => void;\n /* Call back function to add alternate stages */\n onAddAlternateStage: () => void;\n}\n\nconst StyledLifeCycle = styled.ol``;\n\nStyledLifeCycle.defaultProps = defaultThemeProp;\n\nconst StyledAddButton = styled(Button)(({ theme }) => {\n return css`\n align-self: flex-start;\n margin-block-start: calc(${theme.base.spacing} / 2);\n `;\n});\n\nStyledAddButton.defaultProps = defaultThemeProp;\n\nconst LifeCycle: FunctionComponent<LifeCycleProps & ForwardProps> = forwardRef(\n (\n {\n items,\n categories,\n alternateItems = [],\n onAddStage,\n onAddAlternateStage,\n stage,\n alternateStage,\n ...restProps\n }: PropsWithoutRef<LifeCycleProps>,\n ref: LifeCycleProps['ref']\n ) => {\n const lifeCycleEl = useRef(null);\n const t = useI18n();\n const [categoriesState, setcategoriesState] = useState(categories);\n const categoryElements: HTMLElement[] = [];\n const setRef = (element: HTMLOListElement) => {\n if (element) {\n categoryElements.push(element);\n }\n };\n\n useLayoutEffect(() => {\n let isHeightChanged = false;\n const categoriesColumn = [...categories];\n if (categoriesColumn && categoriesColumn.length > 0) {\n categoriesColumn.forEach((categoryItem, index) => {\n const categoryElm = [...categoryElements];\n let isActiveElement = false;\n const categoryComponent = categoryElm.filter((element: HTMLElement) => {\n if (element.getAttribute('data-id') === categoryItem.id) {\n if (categoryItem.elementId === element.getAttribute('id')) {\n isActiveElement = true;\n }\n return true;\n }\n return false;\n });\n if (!isActiveElement) {\n categoryItem.elementId = '';\n categoryItem.height = 0;\n }\n categoryComponent.forEach(categoryElement => {\n const columnHeight = categoryItem?.height ?? 0;\n const height = categoryElement.scrollHeight;\n const elementId = categoryElement.getAttribute('id');\n if (\n height > columnHeight ||\n (categoryItem.elementId === elementId && height !== columnHeight)\n ) {\n isHeightChanged = true;\n categoriesColumn[index].height = height;\n if (elementId) categoriesColumn[index].elementId = elementId;\n }\n });\n });\n if (isHeightChanged) {\n isHeightChanged = false;\n setcategoriesState(categoriesColumn);\n }\n }\n });\n\n return (\n <Flex container={{ itemGap: 2 }} ref={ref}>\n <Flex as={StyledLifeCycle} ref={lifeCycleEl} container role='grid' aria-label={t('stage')}>\n {items.map((stageItem: StageItemProps, index: number, stageArray: StageItemProps[]) => {\n const listId = stageItem.id;\n return (\n <LifeCycleList\n {...restProps}\n key={listId}\n id={listId}\n item={stageItem}\n isFirstItem={index === 0}\n isLastItem={index === stageArray.length - 1}\n ref={setRef}\n stage={stage}\n prevStageVariant={stageArray[index - 1]?.type}\n categories={categoriesState}\n />\n );\n })}\n <StyledAddButton variant='simple' label={t('add_stage')} icon onClick={onAddStage}>\n <Icon name='plus' />\n </StyledAddButton>\n </Flex>\n {alternateItems.length !== 0 && (\n <Flex\n as={StyledLifeCycle}\n container\n ref={lifeCycleEl}\n role='grid'\n aria-label={t('alternate_stage')}\n >\n {alternateItems.map(\n (stageItem: StageItemProps, index: number, stageArray: StageItemProps[]) => {\n const listId = stageItem.id;\n return (\n <LifeCycleList\n {...restProps}\n key={listId}\n id={listId}\n item={stageItem}\n isFirstItem={index === 0}\n isLastItem={index === stageArray.length - 1}\n ref={setRef}\n categories={categoriesState}\n stageVariant='alternate'\n prevStageVariant={stageArray[index - 1]?.type}\n stage={alternateStage}\n />\n );\n }\n )}\n <StyledAddButton\n variant='simple'\n label={t('add_alternate_stage')}\n icon\n onClick={onAddAlternateStage}\n >\n <Icon name='plus' />\n </StyledAddButton>\n </Flex>\n )}\n </Flex>\n );\n }\n);\n\nexport default LifeCycle;\n"]}
@@ -3,6 +3,7 @@ import { Action, StatusProps } from '@pega/cosmos-react-core';
3
3
  export interface VisualColorProps {
4
4
  color: 'magenta' | 'studio' | 'congressBlue' | 'Japaneselaurel' | 'violet' | 'yellow' | 'orange' | 'darkyellow';
5
5
  }
6
+ export declare type StageType = 'start' | 'default' | 'default-wait' | 'resolution' | 'alternate' | 'alternate-wait';
6
7
  export interface StepItemProps {
7
8
  id: string;
8
9
  label: string;
@@ -31,7 +32,7 @@ export interface StageItemProps {
31
32
  id: string;
32
33
  label: string;
33
34
  categories: CategoryItemProps[];
34
- type: 'start' | 'default' | 'resolution' | 'alternate';
35
+ type: StageType;
35
36
  error: string;
36
37
  }
37
38
  export interface CategoryItemProps {
@@ -53,4 +54,14 @@ export interface LifeCycleActionParam {
53
54
  export interface LifeCycleAction extends Omit<Action, 'onClick'> {
54
55
  onClick: (param: LifeCycleActionParam, e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>) => void;
55
56
  }
57
+ export interface StageInfo {
58
+ id: StageType;
59
+ visual: {
60
+ bgColor: string;
61
+ bgHover: string;
62
+ tailPointed?: boolean;
63
+ headPointed?: boolean;
64
+ };
65
+ }
66
+ export declare const getStageInfo: (currentType: StageType, prevType: StageType | null, isLastItem: boolean | undefined) => StageInfo;
56
67
  //# sourceMappingURL=LifeCycle.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LifeCycle.types.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EACD,SAAS,GACT,QAAQ,GACR,cAAc,GACd,gBAAgB,GAChB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,YAAY,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QACN,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACjC,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9D,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAE7B,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,E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AC;IACrB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC;IAC9D,OAAO,EAAE,CACP,KAAK,EAAE,oBAAoB,EAC3B,CAAC,EAAE,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,GAAG,gBAAgB,CAAC,KACpE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,SAAS,CAAC;IACd,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AA6DD,eAAO,MAAM,YAAY,gBACV,SAAS,YACZ,SAAS,GAAG,IAAI,cACd,OAAO,GAAG,SAAS,cAoBhC,CAAC"}
@@ -1,2 +1,79 @@
1
- export {};
1
+ import { WorkTheme as Theme } from '@pega/cosmos-react-core';
2
+ const StageTypeDefaults = {
3
+ start: {
4
+ id: 'start',
5
+ visual: {
6
+ bgColor: Theme.base.colors.blue.dark,
7
+ bgHover: Theme.base.colors.blue.medium,
8
+ tailPointed: false,
9
+ headPointed: true
10
+ }
11
+ },
12
+ default: {
13
+ id: 'default',
14
+ visual: {
15
+ bgColor: Theme.base.colors.blue.medium,
16
+ bgHover: Theme.base.colors.blue.light,
17
+ tailPointed: true,
18
+ headPointed: true
19
+ }
20
+ },
21
+ 'default-wait': {
22
+ id: 'default-wait',
23
+ visual: {
24
+ bgColor: Theme.base.colors.blue.medium,
25
+ bgHover: Theme.base.colors.blue.light,
26
+ tailPointed: true,
27
+ headPointed: false
28
+ }
29
+ },
30
+ resolution: {
31
+ id: 'resolution',
32
+ visual: {
33
+ bgColor: Theme.base.colors.green.medium,
34
+ bgHover: Theme.base.colors.green.light,
35
+ tailPointed: true,
36
+ headPointed: false
37
+ }
38
+ },
39
+ alternate: {
40
+ id: 'alternate',
41
+ visual: {
42
+ bgColor: Theme.base.colors.red.dark,
43
+ bgHover: Theme.base.colors.red.medium,
44
+ tailPointed: false,
45
+ headPointed: false
46
+ }
47
+ },
48
+ 'alternate-wait': {
49
+ id: 'alternate-wait',
50
+ visual: {
51
+ bgColor: Theme.base.colors.red.dark,
52
+ bgHover: Theme.base.colors.red.medium,
53
+ tailPointed: false,
54
+ headPointed: false
55
+ }
56
+ }
57
+ };
58
+ // calculates the final stage info based on prev type and returns the final stage info
59
+ // second param is mandatory for accurate results, optional only for the first stage
60
+ export const getStageInfo = (currentType, prevType, isLastItem) => {
61
+ const currentStageInfo = StageTypeDefaults[currentType] || StageTypeDefaults.default;
62
+ // cloning, to avoid getting modified
63
+ const result = {
64
+ ...currentStageInfo,
65
+ visual: {
66
+ ...currentStageInfo.visual
67
+ }
68
+ };
69
+ if (prevType) {
70
+ const prevStageInfo = StageTypeDefaults[prevType] || StageTypeDefaults.start;
71
+ result.visual.tailPointed =
72
+ currentStageInfo.visual.tailPointed && prevStageInfo.visual.headPointed;
73
+ }
74
+ if (isLastItem) {
75
+ result.visual.headPointed = false;
76
+ }
77
+ return result;
78
+ };
2
79
  //# sourceMappingURL=LifeCycle.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LifeCycle.types.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEvent } from 'react';\n\nimport { Action, StatusProps } from '@pega/cosmos-react-core';\n\nexport interface VisualColorProps {\n color:\n | 'magenta'\n | 'studio'\n | 'congressBlue'\n | 'Japaneselaurel'\n | 'violet'\n | 'yellow'\n | 'orange'\n | 'darkyellow';\n}\n\nexport interface StepItemProps {\n id: string;\n label: string;\n visual: {\n color: VisualColorProps['color'];\n icon: string;\n label: string;\n imgurl: string;\n };\n status: { type?: StatusProps['variant'] | ''; label: string };\n error: string;\n}\n\nexport interface TaskItemProps {\n id: string;\n label: string;\n visual: {\n imgurl: string;\n };\n error: string;\n steps: StepItemProps[];\n}\n\nexport interface StageItemProps {\n /* Data model should have id of the stage item */\n id: string;\n /* Data model should have the stage label */\n label: string;\n /* Data model should have the categoryData array */\n categories: CategoryItemProps[];\n /* Data model should have the stageType as below */\n type: 'start' | 'default' | 'resolution' | 'alternate';\n error: string;\n}\n\nexport interface CategoryItemProps {\n /* Data model should have id of the stage item */\n id: string;\n /* Data model should have id of the stage item */\n categoryId: string;\n /* Data model should have the categoryData array */\n tasks: TaskItemProps[] | TaskItemProps[][];\n}\n\nexport interface CategoriesItemProps {\n label: string;\n id: string;\n}\n\nexport interface LifeCycleActionParam {\n value?: string;\n stage?: StageItemProps;\n task?: TaskItemProps;\n category?: CategoryItemProps;\n step?: StepItemProps;\n}\n\nexport interface LifeCycleAction extends Omit<Action, 'onClick'> {\n onClick: (\n param: LifeCycleActionParam,\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>\n ) => void;\n}\n"]}
1
+ {"version":3,"file":"LifeCycle.types.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,SAAS,IAAI,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAgGlF,MAAM,iBAAiB,GAAiC;IACtD,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,MAAM,EAAE;YACN,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI;YACpC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;YACtC,WAAW,EAAE,KAAK;YAClB,WAAW,EAAE,IAAI;SAClB;KACF;IACD,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,MAAM,EAAE;YACN,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;YACtC,OAAO,E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GAAG,CAC1B,WAAsB,EACtB,QAA0B,EAC1B,UAA+B,EAC/B,EAAE;IACF,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,WAAW,CAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC;IACrF,qCAAqC;IACrC,MAAM,MAAM,GAAc;QACxB,GAAG,gBAAgB;QACnB,MAAM,EAAE;YACN,GAAG,gBAAgB,CAAC,MAAM;SAC3B;KACF,CAAC;IAEF,IAAI,QAAQ,EAAE;QACZ,MAAM,aAAa,GAAG,iBAAiB,CAAC,QAAQ,CAAC,IAAI,iBAAiB,CAAC,KAAK,CAAC;QAC7E,MAAM,CAAC,MAAM,CAAC,WAAW;YACvB,gBAAgB,CAAC,MAAM,CAAC,WAAW,IAAI,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;KAC3E;IACD,IAAI,UAAU,EAAE;QACd,MAAM,CAAC,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;KACnC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { MouseEvent } from 'react';\n\nimport { Action, StatusProps, WorkTheme as Theme } from '@pega/cosmos-react-core';\n\nexport interface VisualColorProps {\n color:\n | 'magenta'\n | 'studio'\n | 'congressBlue'\n | 'Japaneselaurel'\n | 'violet'\n | 'yellow'\n | 'orange'\n | 'darkyellow';\n}\n\nexport type StageType =\n | 'start'\n | 'default'\n | 'default-wait'\n | 'resolution'\n | 'alternate'\n | 'alternate-wait';\n\nexport interface StepItemProps {\n id: string;\n label: string;\n visual: {\n color: VisualColorProps['color'];\n icon: string;\n label: string;\n imgurl: string;\n };\n status: { type?: StatusProps['variant'] | ''; label: string };\n error: string;\n}\n\nexport interface TaskItemProps {\n id: string;\n label: string;\n visual: {\n imgurl: string;\n };\n error: string;\n steps: StepItemProps[];\n}\n\nexport interface StageItemProps {\n /* Data model should have id of the stage item */\n id: string;\n /* Data model should have the stage label */\n label: string;\n /* Data model should have the categoryData array */\n categories: CategoryItemProps[];\n /* Data model should have the stageType as below */\n type: StageType;\n error: string;\n}\n\nexport interface CategoryItemProps {\n /* Data model should have id of the stage item */\n id: string;\n /* Data model should have id of the stage item */\n categoryId: string;\n /* Data model should have the categoryData array */\n tasks: TaskItemProps[] | TaskItemProps[][];\n}\n\nexport interface CategoriesItemProps {\n label: string;\n id: string;\n}\n\nexport interface LifeCycleActionParam {\n value?: string;\n stage?: StageItemProps;\n task?: TaskItemProps;\n category?: CategoryItemProps;\n step?: StepItemProps;\n}\n\nexport interface LifeCycleAction extends Omit<Action, 'onClick'> {\n onClick: (\n param: LifeCycleActionParam,\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>\n ) => void;\n}\n\nexport interface StageInfo {\n id: StageType;\n visual: {\n bgColor: string;\n bgHover: string;\n tailPointed?: boolean;\n headPointed?: boolean;\n };\n}\n\nconst StageTypeDefaults: Record<StageType, StageInfo> = {\n start: {\n id: 'start',\n visual: {\n bgColor: Theme.base.colors.blue.dark,\n bgHover: Theme.base.colors.blue.medium,\n tailPointed: false,\n headPointed: true\n }\n },\n default: {\n id: 'default',\n visual: {\n bgColor: Theme.base.colors.blue.medium,\n bgHover: Theme.base.colors.blue.light,\n tailPointed: true,\n headPointed: true\n }\n },\n 'default-wait': {\n id: 'default-wait',\n visual: {\n bgColor: Theme.base.colors.blue.medium,\n bgHover: Theme.base.colors.blue.light,\n tailPointed: true,\n headPointed: false\n }\n },\n resolution: {\n id: 'resolution',\n visual: {\n bgColor: Theme.base.colors.green.medium,\n bgHover: Theme.base.colors.green.light,\n tailPointed: true,\n headPointed: false\n }\n },\n alternate: {\n id: 'alternate',\n visual: {\n bgColor: Theme.base.colors.red.dark,\n bgHover: Theme.base.colors.red.medium,\n tailPointed: false,\n headPointed: false\n }\n },\n 'alternate-wait': {\n id: 'alternate-wait',\n visual: {\n bgColor: Theme.base.colors.red.dark,\n bgHover: Theme.base.colors.red.medium,\n tailPointed: false,\n headPointed: false\n }\n }\n};\n\n// calculates the final stage info based on prev type and returns the final stage info\n// second param is mandatory for accurate results, optional only for the first stage\nexport const getStageInfo = (\n currentType: StageType,\n prevType: StageType | null,\n isLastItem: boolean | undefined\n) => {\n const currentStageInfo = StageTypeDefaults[currentType] || StageTypeDefaults.default;\n // cloning, to avoid getting modified\n const result: StageInfo = {\n ...currentStageInfo,\n visual: {\n ...currentStageInfo.visual\n }\n };\n\n if (prevType) {\n const prevStageInfo = StageTypeDefaults[prevType] || StageTypeDefaults.start;\n result.visual.tailPointed =\n currentStageInfo.visual.tailPointed && prevStageInfo.visual.headPointed;\n }\n if (isLastItem) {\n result.visual.headPointed = false;\n }\n return result;\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import { FunctionComponent, Ref } from 'react';
2
2
  import type { NoChildrenProp } from '@pega/cosmos-react-core';
3
- import { StageItemProps } from './LifeCycle.types';
3
+ import { StageItemProps, StageType } from './LifeCycle.types';
4
4
  import { StageProps } from './Stage';
5
5
  import { CategoriesProps } from './Category';
6
6
  import { TaskProps } from './Task';
@@ -14,7 +14,8 @@ export interface LifeCycleListProps extends NoChildrenProp {
14
14
  item: StageItemProps;
15
15
  isFirstItem?: boolean;
16
16
  isLastItem?: boolean;
17
- stageVariant?: 'start' | 'default' | 'resolution' | 'alternate';
17
+ stageVariant?: StageType;
18
+ prevStageVariant: StageType;
18
19
  id?: string;
19
20
  }
20
21
  declare const LifeCycleList: FunctionComponent<LifeCycleListProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"LifeCycleList.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycleList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAqB,MAAM,mBAAmB,CAAC;AACtE,OAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAiB,EAAE,eAAe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GAAG,CAAC,gBAAgB,CAAC,CAAC;IAE5B,UAAU,EAAE,eAAe,EAAE,CAAC;IAE9B,IAAI,EAAE,SAAS,EAAE,CAAC;IAElB,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IAEnB,IAAI,EAAE,cAAc,CAAC;IAErB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,gBAAgB,EAAE,SAAS,CAAC;IAE5B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAoBD,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,CAiGxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { forwardRef } from 'react';
4
4
  import styled, { css } from 'styled-components';
5
5
  import { createUID, useDirection } from '@pega/cosmos-react-core';
6
+ import { getStageInfo } from './LifeCycle.types';
6
7
  import Stage from './Stage';
7
8
  import Category from './Category';
8
9
  const StyledLifeCycleList = styled.li(({ theme, lastItem }) => {
@@ -22,7 +23,7 @@ const StyledLifeCycleList = styled.li(({ theme, lastItem }) => {
22
23
  `}
23
24
  `;
24
25
  });
25
- const LifeCycleList = forwardRef(({ item, isFirstItem, categories, isLastItem, stage: stageProps, task, step, stageVariant, id, ...restProps }, ref) => {
26
+ const LifeCycleList = forwardRef(({ item, isFirstItem, isLastItem, categories, stage: stageProps, task, step, prevStageVariant, stageVariant, id, ...restProps }, ref) => {
26
27
  const showTitle = isFirstItem || false;
27
28
  let sortedCategory = [];
28
29
  const listId = id || createUID();
@@ -43,7 +44,8 @@ const LifeCycleList = forwardRef(({ item, isFirstItem, categories, isLastItem, s
43
44
  if (categories && categories.length !== 0) {
44
45
  sortedCategory = catgoryItem(item.categories);
45
46
  }
46
- return (_jsxs(StyledLifeCycleList, { role: 'row', lastItem: isLastItem, children: [_jsx(Stage, { value: item.label, variant: stageVariant || (item.type ? item.type : 'default'), item: item, tailPointed: isFirstItem, headPointed: isLastItem, error: item.error, id: item.id, ...stageProps }, void 0), sortedCategory.length !== 0 &&
47
+ const stageInfo = getStageInfo(item.type, prevStageVariant, isLastItem);
48
+ return (_jsxs(StyledLifeCycleList, { role: 'row', lastItem: isLastItem, children: [_jsx(Stage, { value: item.label, stageInfo: stageInfo, item: item, error: item.error, id: item.id, ...stageProps }, void 0), sortedCategory.length !== 0 &&
47
49
  sortedCategory.map((categoryItem, categoryindex) => {
48
50
  const taskProps = task[categoryindex];
49
51
  let stepProps;
@@ -1 +1 @@
1
- {"version":3,"file":"LifeCycleList.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycleList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,OAAO,CAAC;AAC3D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGlE,OAAO,KAAqB,MAAM,SAAS,CAAC;AAC5C,OAAO,QAA6B,MAAM,YAAY,CAAC;AA2BvD,MAAM,mBAAmB,GAAG,MAAM,CAAC,EAAE,CAAoC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/F,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IAC/B,OAAO,GAAG,CAAA;;iBAEK,KAAK,CAAC,IAAI,CAAC,OAAO;;MAE7B,QAAQ;QACV,GAAG,CAAA;8BACuB,KAAK,CAAC,IAAI,CAAC,OAAO;KAC3C;MACC,QAAQ;QACV,GAAG;QACH,GAAG,CAAA;mBACY,KAAK,CAAC,IAAI,CAAC,OAAO,iBAAiB,KAAK,CAAC,IAAI,CAAC,OAAO;KACnE;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;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UAAU,EAC3B,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,IAAI,EACf,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,SAAS,IARf,YAAY,CAAC,UAAU,CAS5B,CACH,CAAC;gBACJ,CAAC,CAAC,KArDoB,MAAM,CAsDV,CACvB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport type { NoChildrenProp } from '@pega/cosmos-react-core';\nimport { createUID, useDirection } from '@pega/cosmos-react-core';\n\nimport { StageItemProps, CategoryItemProps } from './LifeCycle.types';\nimport Stage, { StageProps } from './Stage';\nimport Category, { CategoriesProps } from './Category';\nimport { TaskProps } from './Task';\nimport { StepProps } from './Step';\n\nexport interface LifeCycleListProps extends NoChildrenProp {\n /* Pass reference to the LifeCycleComponent */\n ref?: Ref<HTMLOListElement>;\n /* Array of categories column props */\n categories: CategoriesProps[];\n /* Array of Task props */\n task: TaskProps[];\n /* Array of Step props */\n stage?: StageProps;\n /* Array of Stage props */\n step?: StepProps[];\n /* Data model should be have stages array */\n item: StageItemProps;\n /* Count of number of stages */\n isFirstItem?: boolean;\n /* Index of stages item */\n isLastItem?: boolean;\n /* type of stages */\n stageVariant?: 'start' | 'default' | 'resolution' | 'alternate';\n /* id for the list item */\n id?: string;\n}\n\nconst StyledLifeCycleList = styled.li<{ lastItem: boolean | undefined }>(({ theme, lastItem }) => {\n const { rtl } = useDirection();\n return css`\n list-style-type: none;\n padding: 0 ${theme.base.spacing} 0 0;\n width: 15rem;\n ${lastItem &&\n css`\n padding: 0 calc(0.5 * ${theme.base.spacing}) 0 0;\n `}\n ${lastItem &&\n rtl &&\n css`\n padding: 0 ${theme.base.spacing} 0 calc(0.5 * ${theme.base.spacing});\n `}\n `;\n});\n\nconst LifeCycleList: FunctionComponent<LifeCycleListProps> = forwardRef(\n (\n {\n item,\n isFirstItem,\n categories,\n isLastItem,\n stage: stageProps,\n task,\n step,\n stageVariant,\n id,\n ...restProps\n }: LifeCycleListProps,\n ref: LifeCycleListProps['ref']\n ) => {\n const showTitle = isFirstItem || false;\n let sortedCategory: CategoryItemProps[] = [];\n const listId = id || createUID();\n\n /* Function used to rearrange the category data depends on Categories order */\n const catgoryItem = (categoryData: CategoryItemProps[]) => {\n const sortedColumn: CategoryItemProps[] = [];\n if (categories && categories.length > 0 && categoryData.length > 0) {\n categories.forEach(categoryColumnItem => {\n categoryData.forEach((categoryItem: CategoryItemProps) => {\n if (categoryItem.categoryId === categoryColumnItem.id) {\n sortedColumn.push(categoryItem);\n }\n });\n });\n }\n return sortedColumn;\n };\n\n if (categories && categories.length !== 0) {\n sortedCategory = catgoryItem(item.categories);\n }\n\n return (\n <StyledLifeCycleList key={listId} role='row' lastItem={isLastItem}>\n <Stage\n value={item.label}\n variant={stageVariant || (item.type ? item.type : 'default')}\n item={item}\n tailPointed={isFirstItem}\n headPointed={isLastItem}\n error={item.error}\n id={item.id}\n {...stageProps}\n />\n {sortedCategory.length !== 0 &&\n sortedCategory.map((categoryItem: CategoryItemProps, categoryindex: number) => {\n const taskProps = task[categoryindex];\n let stepProps;\n if (step) stepProps = step[categoryindex];\n return (\n <Category\n {...restProps}\n key={categoryItem.categoryId}\n role='gridcell'\n id={categoryItem.categoryId}\n ref={ref}\n category={categories[categoryindex]}\n item={categoryItem}\n showTitle={showTitle}\n stageItem={item}\n task={taskProps}\n step={stepProps}\n />\n );\n })}\n {sortedCategory.length === 0 &&\n categories.length === 0 &&\n item.categories.length > 0 &&\n item.categories.map((categoryItem: CategoryItemProps, categoryindex: number) => {\n const taskProps = task[categoryindex];\n let stepProps;\n if (step) stepProps = step[categoryindex];\n\n return (\n <Category\n key={categoryItem.categoryId}\n role='gridcell'\n id={categoryItem.categoryId}\n ref={ref}\n item={categoryItem}\n stageItem={item}\n task={taskProps}\n step={stepProps}\n showTitle={showTitle}\n />\n );\n })}\n </StyledLifeCycleList>\n );\n }\n);\n\nexport default LifeCycleList;\n"]}
1
+ {"version":3,"file":"LifeCycleList.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycleList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,OAAO,CAAC;AAC3D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAqC,YAAY,EAAa,MAAM,mBAAmB,CAAC;AAC/F,OAAO,KAAqB,MAAM,SAAS,CAAC;AAC5C,OAAO,QAA6B,MAAM,YAAY,CAAC;AA4BvD,MAAM,mBAAmB,GAAG,MAAM,CAAC,EAAE,CAAoC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/F,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IAC/B,OAAO,GAAG,CAAA;;iBAEK,KAAK,CAAC,IAAI,CAAC,OAAO;;MAE7B,QAAQ;QACV,GAAG,CAAA;8BACuB,KAAK,CAAC,IAAI,CAAC,OAAO;KAC3C;MACC,QAAQ;QACV,GAAG;QACH,GAAG,CAAA;mBACY,KAAK,CAAC,IAAI,CAAC,OAAO,iBAAiB,KAAK,CAAC,IAAI,CAAC,OAAO;KACnE;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,aAAa,GAA0C,UAAU,CACrE,CACE,EACE,IAAI,EACJ,WAAW,EACX,UAAU,EACV,UAAU,EACV,KAAK,EAAE,UAAU,EACjB,IAAI,EACJ,IAAI,EACJ,gBAAgB,EAChB,YAAY,EACZ,EAAE,EACF,GAAG,SAAS,EACO,EACrB,GAA8B,EAC9B,EAAE;IACF,MAAM,SAAS,GAAG,WAAW,IAAI,KAAK,CAAC;IACvC,IAAI,cAAc,GAAwB,EAAE,CAAC;I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led-components';\n\nimport type { NoChildrenProp } from '@pega/cosmos-react-core';\nimport { createUID, useDirection } from '@pega/cosmos-react-core';\n\nimport { StageItemProps, CategoryItemProps, getStageInfo, StageType } from './LifeCycle.types';\nimport Stage, { StageProps } from './Stage';\nimport Category, { CategoriesProps } from './Category';\nimport { TaskProps } from './Task';\nimport { StepProps } from './Step';\n\nexport interface LifeCycleListProps extends NoChildrenProp {\n /* Pass reference to the LifeCycleComponent */\n ref?: Ref<HTMLOListElement>;\n /* Array of categories column props */\n categories: CategoriesProps[];\n /* Array of Task props */\n task: TaskProps[];\n /* Array of Step props */\n stage?: StageProps;\n /* Array of Stage props */\n step?: StepProps[];\n /* Data model should be have stages array */\n item: StageItemProps;\n /* Count of number of stages */\n isFirstItem?: boolean;\n /* Index of stages item */\n isLastItem?: boolean;\n /* type of stages */\n stageVariant?: StageType;\n prevStageVariant: StageType;\n /* id for the list item */\n id?: string;\n}\n\nconst StyledLifeCycleList = styled.li<{ lastItem: boolean | undefined }>(({ theme, lastItem }) => {\n const { rtl } = useDirection();\n return css`\n list-style-type: none;\n padding: 0 ${theme.base.spacing} 0 0;\n width: 15rem;\n ${lastItem &&\n css`\n padding: 0 calc(0.5 * ${theme.base.spacing}) 0 0;\n `}\n ${lastItem &&\n rtl &&\n css`\n padding: 0 ${theme.base.spacing} 0 calc(0.5 * ${theme.base.spacing});\n `}\n `;\n});\n\nconst LifeCycleList: FunctionComponent<LifeCycleListProps> = forwardRef(\n (\n {\n item,\n isFirstItem,\n isLastItem,\n categories,\n stage: stageProps,\n task,\n step,\n prevStageVariant,\n stageVariant,\n id,\n ...restProps\n }: LifeCycleListProps,\n ref: LifeCycleListProps['ref']\n ) => {\n const showTitle = isFirstItem || false;\n let sortedCategory: CategoryItemProps[] = [];\n const listId = id || createUID();\n\n /* Function used to rearrange the category data depends on Categories order */\n const catgoryItem = (categoryData: CategoryItemProps[]) => {\n const sortedColumn: CategoryItemProps[] = [];\n if (categories && categories.length > 0 && categoryData.length > 0) {\n categories.forEach(categoryColumnItem => {\n categoryData.forEach((categoryItem: CategoryItemProps) => {\n if (categoryItem.categoryId === categoryColumnItem.id) {\n sortedColumn.push(categoryItem);\n }\n });\n });\n }\n return sortedColumn;\n };\n\n if (categories && categories.length !== 0) {\n sortedCategory = catgoryItem(item.categories);\n }\n\n const stageInfo = getStageInfo(item.type, prevStageVariant, isLastItem);\n return (\n <StyledLifeCycleList key={listId} role='row' lastItem={isLastItem}>\n <Stage\n value={item.label}\n stageInfo={stageInfo}\n item={item}\n error={item.error}\n id={item.id}\n {...stageProps}\n />\n {sortedCategory.length !== 0 &&\n sortedCategory.map((categoryItem: CategoryItemProps, categoryindex: number) => {\n const taskProps = task[categoryindex];\n let stepProps;\n if (step) stepProps = step[categoryindex];\n return (\n <Category\n {...restProps}\n key={categoryItem.categoryId}\n role='gridcell'\n id={categoryItem.categoryId}\n ref={ref}\n category={categories[categoryindex]}\n item={categoryItem}\n showTitle={showTitle}\n stageItem={item}\n task={taskProps}\n step={stepProps}\n />\n );\n })}\n {sortedCategory.length === 0 &&\n categories.length === 0 &&\n item.categories.length > 0 &&\n item.categories.map((categoryItem: CategoryItemProps, categoryindex: number) => {\n const taskProps = task[categoryindex];\n let stepProps;\n if (step) stepProps = step[categoryindex];\n\n return (\n <Category\n key={categoryItem.categoryId}\n role='gridcell'\n id={categoryItem.categoryId}\n ref={ref}\n item={categoryItem}\n stageItem={item}\n task={taskProps}\n step={stepProps}\n showTitle={showTitle}\n />\n );\n })}\n </StyledLifeCycleList>\n );\n }\n);\n\nexport default LifeCycleList;\n"]}
@@ -1,9 +1,9 @@
1
1
  import { FunctionComponent, Ref, ChangeEvent, FocusEvent } from 'react';
2
2
  import { BaseProps, ForwardProps, FormControlProps } from '@pega/cosmos-react-core';
3
- import { LifeCycleAction, LifeCycleActionParam, StageItemProps } from './LifeCycle.types';
3
+ import { LifeCycleAction, LifeCycleActionParam, StageInfo, StageItemProps, StageType } from './LifeCycle.types';
4
4
  export interface StageProps extends Omit<FormControlProps, 'status' | 'id'> {
5
5
  /** Pass an array of Action objects to append button(s) inline with the Input. */
6
- actions?: LifeCycleAction[];
6
+ actions?: Record<StageType, LifeCycleAction[]> | LifeCycleAction[];
7
7
  /** Callback for Add stage */
8
8
  onAddStage?: () => void;
9
9
  /** Callback for Adding alternate stage */
@@ -12,6 +12,8 @@ export interface StageProps extends Omit<FormControlProps, 'status' | 'id'> {
12
12
  onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;
13
13
  /** onFocus of input */
14
14
  onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;
15
+ /** onBlur of input */
16
+ onBlur?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;
15
17
  }
16
18
  export interface StageComponentProps extends BaseProps, StageProps {
17
19
  ref?: Ref<HTMLDivElement>;
@@ -19,11 +21,7 @@ export interface StageComponentProps extends BaseProps, StageProps {
19
21
  value: string;
20
22
  id: string;
21
23
  /** Controls the styling of the stage. */
22
- variant?: StageItemProps['type'] | 'default';
23
- /** To make the stage with pointed tail */
24
- tailPointed?: boolean;
25
- /** To make the stage with pointed head */
26
- headPointed?: boolean;
24
+ stageInfo: StageInfo;
27
25
  /** Full data object which can be passed to the callback */
28
26
  item: StageItemProps;
29
27
  error?: string;
@@ -38,9 +36,7 @@ export declare const StyledInput: import("styled-components").StyledComponent<"i
38
36
  export declare const StyledStageActions: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
39
37
  error?: string | undefined;
40
38
  }, never>;
41
- export declare const StyledStage: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<StageComponentProps, "variant"> & {
42
- tailPointed: boolean;
43
- headPointed: boolean;
39
+ export declare const StyledStage: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<StageComponentProps, "stageInfo"> & {
44
40
  status: boolean;
45
41
  }, never>;
46
42
  export declare const StyledInputWrapper: import("styled-components").StyledComponent<"div", import("styled-components").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B,EAAE,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACnF,uBAAuB;IACvB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,EAAE,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACjF,sBAAsB;IACtB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,EAAE,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CACjF;AAED,MAAM,WAAW,mBAAoB,SAAQ,SAAS,EAAE,UAAU;IAChE,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IAEd,EAAE,EAAE,MAAM,CAAC;IACX,yCAAyC;IACzC,SAAS,EAAE,SAAS,CAAC;IACrB,2DAA2D;IAC3D,IAAI,EAAE,cAAc,CAAC;IAErB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,yGAEzB,CAAC;AAEF,eAAO,MAAM,cAAc;WAAuB,MAAM;SAatD,CAAC;AAEH,eAAO,MAAM,WAAW;WAAyB,MAAM,GAAG,SAAS;SA+BjE,CAAC;AAEH,eAAO,MAAM,kBAAkB;;SAiB7B,CAAC;AAEH,eAAO,MAAM,WAAW;YAEZ,OAAO;SAuJjB,CAAC;AAIH,eAAO,MAAM,kBAAkB,yGAQ9B,CAAC;AAEF,QAAA,MAAM,KAAK,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAyIhE,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -67,31 +67,8 @@ export const StyledStageActions = styled.div(({ theme, error }) => {
67
67
  }
68
68
  `;
69
69
  });
70
- export const StyledStage = styled.div(({ variant, theme, tailPointed, headPointed, status }) => {
71
- let bgColor;
72
- let bgHover = '';
73
- switch (variant) {
74
- case 'start':
75
- bgColor = theme.base.colors.blue.dark;
76
- bgHover = theme.base.colors.blue.medium;
77
- break;
78
- case 'default':
79
- bgColor = theme.base.colors.blue.medium;
80
- bgHover = theme.base.colors.blue.light;
81
- break;
82
- case 'resolution':
83
- bgColor = theme.base.colors.green.medium;
84
- bgHover = theme.base.colors.green.light;
85
- break;
86
- case 'alternate':
87
- bgColor = theme.base.colors.red.light;
88
- bgHover = theme.base.colors.red['extra-light'];
89
- break;
90
- // eslint-disable-next-line sonarjs/no-duplicated-branches
91
- default:
92
- bgColor = theme.base.colors.blue.medium;
93
- bgHover = theme.base.colors.blue.light;
94
- }
70
+ export const StyledStage = styled.div(({ stageInfo, theme, status }) => {
71
+ const { visual: { bgColor, bgHover, tailPointed, headPointed } } = stageInfo;
95
72
  const { rtl } = useDirection();
96
73
  const roundedEndsStyles = css `
97
74
  content: '';
@@ -133,7 +110,7 @@ export const StyledStage = styled.div(({ variant, theme, tailPointed, headPointe
133
110
  }
134
111
  &:focus-within {
135
112
  border: 0.0625rem solid ${theme.base.colors.blue.medium};
136
- ${!headPointed &&
113
+ ${headPointed &&
137
114
  css `
138
115
  &::after {
139
116
  border-inline-end: 0.0625rem solid ${theme.base.colors.blue.medium};
@@ -146,7 +123,7 @@ export const StyledStage = styled.div(({ variant, theme, tailPointed, headPointe
146
123
  `}
147
124
  }
148
125
  `}
149
- ${!tailPointed &&
126
+ ${tailPointed &&
150
127
  css `
151
128
  &::before {
152
129
  border-inline-end: 0.0625rem solid ${theme.base.colors.blue.medium};
@@ -181,7 +158,7 @@ export const StyledStage = styled.div(({ variant, theme, tailPointed, headPointe
181
158
  }
182
159
  }
183
160
 
184
- ${!headPointed &&
161
+ ${headPointed &&
185
162
  css `
186
163
  &::after {
187
164
  ${roundedEndsStyles}
@@ -201,7 +178,7 @@ export const StyledStage = styled.div(({ variant, theme, tailPointed, headPointe
201
178
  }
202
179
  `}
203
180
 
204
- ${!tailPointed &&
181
+ ${tailPointed &&
205
182
  css `
206
183
  &::before {
207
184
  ${roundedEndsStyles}
@@ -211,11 +188,11 @@ export const StyledStage = styled.div(({ variant, theme, tailPointed, headPointe
211
188
  ${rtl
212
189
  ? css `
213
190
  border-block-end: 0.0625rem solid transparent;
214
- border-radius: 0.0625rem 0 0.0625rem calc(0.75 * ${theme.base['border-radius']});
191
+ border-radius: 0.0625rem 1rem 0.0625rem calc(0.75 * ${theme.base['border-radius']});
215
192
  `
216
193
  : css `
217
194
  border-block-start: 0.0625rem solid transparent;
218
- border-radius: 0.0625rem calc(0.75 * ${theme.base['border-radius']}) 0.0625rem 0;
195
+ border-radius: 0.0625rem calc(0.75 * ${theme.base['border-radius']}) 0.0625rem 1rem;
219
196
  `}
220
197
  }
221
198
  `}
@@ -246,13 +223,13 @@ export const StyledInputWrapper = styled.div `
246
223
  }
247
224
  }
248
225
  `;
249
- const Stage = forwardRef(({ value, actions, variant = 'default', headPointed = true, tailPointed = true, onChange, onFocus, id, item, error, ...restProps }, ref) => {
226
+ const Stage = forwardRef(({ value, actions, stageInfo, onChange, onFocus, onBlur, id, item, error, ...restProps }, ref) => {
250
227
  const [inputEl, setInputEl] = useElement();
251
228
  const [stageName, setStageName] = useState(value);
252
229
  const onInputChange = (e) => {
253
230
  setStageName(e.target.value);
254
231
  const param = {
255
- value: stageName,
232
+ value: e.target.value,
256
233
  stage: item
257
234
  };
258
235
  onChange?.(param, e);
@@ -264,20 +241,44 @@ const Stage = forwardRef(({ value, actions, variant = 'default', headPointed = t
264
241
  };
265
242
  onFocus?.(param, e);
266
243
  };
244
+ const onInputBlur = (e) => {
245
+ setStageName(e.target.value);
246
+ const param = {
247
+ value: e.target.value,
248
+ stage: item
249
+ };
250
+ onBlur?.(param, e);
251
+ };
267
252
  const onActionItemClick = (actionId, e) => {
268
253
  const param = {
269
254
  stage: item
270
255
  };
271
- actions?.forEach((actionItem) => {
272
- if (actionItem.id === actionId) {
273
- actionItem.onClick?.(param, e);
256
+ if (actions) {
257
+ let actionsList = [];
258
+ if (Array.isArray(actions)) {
259
+ actionsList = actions;
274
260
  }
275
- });
261
+ else {
262
+ actionsList = actions[item.type];
263
+ }
264
+ actionsList?.forEach((actionItem) => {
265
+ if (actionItem.id === actionId) {
266
+ actionItem.onClick?.(param, e);
267
+ }
268
+ });
269
+ }
276
270
  };
277
271
  /* Deep copy of actions object is required to provide consistent callback objects on actions */
278
272
  const actionsClone = [];
279
273
  if (actions) {
280
- actions.forEach(actionItem => {
274
+ let actionsList = [];
275
+ if (Array.isArray(actions)) {
276
+ actionsList = actions;
277
+ }
278
+ else {
279
+ actionsList = actions[item.type];
280
+ }
281
+ actionsList.forEach(actionItem => {
281
282
  const actionCloneItem = {};
282
283
  Object.keys(actionItem).forEach((key) => {
283
284
  actionCloneItem[key] = actionItem[key];
@@ -287,7 +288,7 @@ const Stage = forwardRef(({ value, actions, variant = 'default', headPointed = t
287
288
  return actionItem;
288
289
  });
289
290
  }
290
- return (_jsx(Flex, { container: { inline: true }, as: StyledStage, ...restProps, ref: ref, variant: variant || 'default', tailPointed: tailPointed, headPointed: headPointed, status: error, role: 'columnheader', children: _jsxs(Flex, { as: StyledWrapper, container: { inline: true }, children: [_jsx(Flex, { as: StyledDragIcon, error: error, children: _jsx(Icon, { name: 'drag' }, void 0) }, void 0), _jsxs(Flex, { container: true, children: [_jsxs(Flex, { as: StyledInputWrapper, item: { grow: 1 }, container: { inline: true, alignItems: 'center' }, children: [_jsx(StyledInput, { value: stageName, type: 'text', ref: setInputEl, error: error, id: item.id, onChange: onInputChange, "aria-label": stageName, onFocus: onInputFocus }, void 0), stageName && (_jsx(Tooltip, { target: inputEl, hideDelay: 'none', children: error || stageName }, void 0))] }, void 0), _jsx(StyledStageActions, { error: error, children: actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }, void 0) }, void 0)] }, void 0)] }, void 0) }, void 0));
291
+ return (_jsx(Flex, { container: { inline: true }, as: StyledStage, ...restProps, ref: ref, stageInfo: stageInfo, status: error, role: 'columnheader', children: _jsxs(Flex, { as: StyledWrapper, container: { inline: true }, children: [_jsx(Flex, { as: StyledDragIcon, error: error, children: _jsx(Icon, { name: 'drag' }, void 0) }, void 0), _jsxs(Flex, { container: true, children: [_jsxs(Flex, { as: StyledInputWrapper, item: { grow: 1 }, container: { inline: true, alignItems: 'center' }, children: [_jsx(StyledInput, { value: stageName, type: 'text', ref: setInputEl, error: error, id: item.id, onChange: onInputChange, "aria-label": stageName, onFocus: onInputFocus, onBlur: onInputBlur }, void 0), stageName && (_jsx(Tooltip, { target: inputEl, hideDelay: 'none', children: error || stageName }, void 0))] }, void 0), _jsx(StyledStageActions, { error: error, children: actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }, void 0) }, void 0)] }, void 0)] }, void 0) }, void 0));
291
292
  });
292
293
  export default Stage;
293
294
  //# sourceMappingURL=Stage.js.map