@pega/cosmos-react-build 2.0.0-dev.17.0 → 2.0.0-dev.21.0

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 (133) hide show
  1. package/lib/components/AppHeader/AppHeader.js +3 -3
  2. package/lib/components/AppHeader/AppHeader.js.map +1 -1
  3. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  4. package/lib/components/AppShell/AppShell.js +44 -47
  5. package/lib/components/AppShell/AppShell.js.map +1 -1
  6. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  7. package/lib/components/AppShell/AppShell.styles.js +22 -18
  8. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  9. package/lib/components/AppShell/AppShell.types.d.ts +14 -9
  10. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  11. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  12. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  13. package/lib/components/AppShell/AppShellContext.js +5 -3
  14. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  15. package/lib/components/FlowModeller/FlowModeller.d.ts +6 -5
  16. package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -1
  17. package/lib/components/FlowModeller/FlowModeller.js +184 -61
  18. package/lib/components/FlowModeller/FlowModeller.js.map +1 -1
  19. package/lib/components/FlowModeller/Node/Node.types.d.ts +26 -16
  20. package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -1
  21. package/lib/components/FlowModeller/Node/Node.types.js +27 -1
  22. package/lib/components/FlowModeller/Node/Node.types.js.map +1 -1
  23. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +10 -5
  24. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -1
  25. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +38 -31
  26. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -1
  27. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +1 -4
  28. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -1
  29. package/lib/components/FlowModeller/Node/NodeTemplates.js +25 -19
  30. package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -1
  31. package/lib/components/FlowModeller/NodeLibrary.d.ts +12 -0
  32. package/lib/components/FlowModeller/NodeLibrary.d.ts.map +1 -0
  33. package/lib/components/FlowModeller/NodeLibrary.js +49 -0
  34. package/lib/components/FlowModeller/NodeLibrary.js.map +1 -0
  35. package/lib/components/FlowModeller/Renderer/AddNode.d.ts +10 -0
  36. package/lib/components/FlowModeller/Renderer/AddNode.d.ts.map +1 -0
  37. package/lib/components/FlowModeller/Renderer/AddNode.js +42 -0
  38. package/lib/components/FlowModeller/Renderer/AddNode.js.map +1 -0
  39. package/lib/components/FlowModeller/Renderer/Connector.d.ts +5 -0
  40. package/lib/components/FlowModeller/Renderer/Connector.d.ts.map +1 -0
  41. package/lib/components/FlowModeller/Renderer/Connector.js +50 -0
  42. package/lib/components/FlowModeller/Renderer/Connector.js.map +1 -0
  43. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.d.ts +12 -0
  44. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.d.ts.map +1 -0
  45. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.js +15 -0
  46. package/lib/components/FlowModeller/Renderer/ConnectorsContainer.js.map +1 -0
  47. package/lib/components/FlowModeller/Renderer/Node.d.ts +5 -0
  48. package/lib/components/FlowModeller/Renderer/Node.d.ts.map +1 -0
  49. package/lib/components/FlowModeller/Renderer/Node.js +18 -0
  50. package/lib/components/FlowModeller/Renderer/Node.js.map +1 -0
  51. package/lib/components/FlowModeller/Renderer/NodesContainer.d.ts +8 -0
  52. package/lib/components/FlowModeller/Renderer/NodesContainer.d.ts.map +1 -0
  53. package/lib/components/FlowModeller/Renderer/NodesContainer.js +15 -0
  54. package/lib/components/FlowModeller/Renderer/NodesContainer.js.map +1 -0
  55. package/lib/components/FlowModeller/Renderer/Renderer.d.ts +5 -0
  56. package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +1 -0
  57. package/lib/components/FlowModeller/Renderer/Renderer.js +17 -0
  58. package/lib/components/FlowModeller/Renderer/Renderer.js.map +1 -0
  59. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +18 -0
  60. package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +1 -0
  61. package/lib/components/FlowModeller/Renderer/Renderer.types.js +2 -0
  62. package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +1 -0
  63. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +51 -0
  64. package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +1 -0
  65. package/lib/components/FlowModeller/Renderer/Utils/Graph.js +247 -0
  66. package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +1 -0
  67. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts +35 -0
  68. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +1 -0
  69. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +104 -0
  70. package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +1 -0
  71. package/lib/components/FlowModeller/helper.d.ts +22 -0
  72. package/lib/components/FlowModeller/helper.d.ts.map +1 -0
  73. package/lib/components/FlowModeller/helper.js +97 -0
  74. package/lib/components/FlowModeller/helper.js.map +1 -0
  75. package/lib/components/LifeCycle/Category.js +5 -5
  76. package/lib/components/LifeCycle/Category.js.map +1 -1
  77. package/lib/components/LifeCycle/LifeCycle.js +5 -5
  78. package/lib/components/LifeCycle/LifeCycle.js.map +1 -1
  79. package/lib/components/LifeCycle/LifeCycleList.js +2 -2
  80. package/lib/components/LifeCycle/LifeCycleList.js.map +1 -1
  81. package/lib/components/LifeCycle/Stage.d.ts +3 -1
  82. package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
  83. package/lib/components/LifeCycle/Stage.js +9 -2
  84. package/lib/components/LifeCycle/Stage.js.map +1 -1
  85. package/lib/components/LifeCycle/Step.d.ts +4 -1
  86. package/lib/components/LifeCycle/Step.d.ts.map +1 -1
  87. package/lib/components/LifeCycle/Step.js +12 -2
  88. package/lib/components/LifeCycle/Step.js.map +1 -1
  89. package/lib/components/LifeCycle/Task.d.ts +3 -1
  90. package/lib/components/LifeCycle/Task.d.ts.map +1 -1
  91. package/lib/components/LifeCycle/Task.js +14 -5
  92. package/lib/components/LifeCycle/Task.js.map +1 -1
  93. package/lib/components/PageTemplates/GalleryPage.d.ts +23 -0
  94. package/lib/components/PageTemplates/GalleryPage.d.ts.map +1 -0
  95. package/lib/components/PageTemplates/GalleryPage.js +23 -0
  96. package/lib/components/PageTemplates/GalleryPage.js.map +1 -0
  97. package/lib/components/PageTemplates/GalleryPage.styles.d.ts +9 -0
  98. package/lib/components/PageTemplates/GalleryPage.styles.d.ts.map +1 -0
  99. package/lib/components/PageTemplates/GalleryPage.styles.js +70 -0
  100. package/lib/components/PageTemplates/GalleryPage.styles.js.map +1 -0
  101. package/lib/components/PageTemplates/PageTemplates.d.ts +10 -3
  102. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  103. package/lib/components/PageTemplates/PageTemplates.js +48 -8
  104. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  105. package/lib/components/PageTemplates/index.d.ts +2 -0
  106. package/lib/components/PageTemplates/index.d.ts.map +1 -1
  107. package/lib/components/PageTemplates/index.js +1 -0
  108. package/lib/components/PageTemplates/index.js.map +1 -1
  109. package/lib/components/SummaryCard/SummaryCard.d.ts +16 -0
  110. package/lib/components/SummaryCard/SummaryCard.d.ts.map +1 -0
  111. package/lib/components/SummaryCard/SummaryCard.js +31 -0
  112. package/lib/components/SummaryCard/SummaryCard.js.map +1 -0
  113. package/lib/components/SummaryCard/index.d.ts +3 -0
  114. package/lib/components/SummaryCard/index.d.ts.map +1 -0
  115. package/lib/components/SummaryCard/index.js +3 -0
  116. package/lib/components/SummaryCard/index.js.map +1 -0
  117. package/lib/components/Visual/Visual.d.ts +17 -0
  118. package/lib/components/Visual/Visual.d.ts.map +1 -0
  119. package/lib/components/Visual/Visual.js +28 -0
  120. package/lib/components/Visual/Visual.js.map +1 -0
  121. package/lib/components/Visual/index.d.ts +3 -0
  122. package/lib/components/Visual/index.d.ts.map +1 -0
  123. package/lib/components/Visual/index.js +3 -0
  124. package/lib/components/Visual/index.js.map +1 -0
  125. package/lib/index.d.ts +2 -0
  126. package/lib/index.d.ts.map +1 -1
  127. package/lib/index.js +2 -0
  128. package/lib/index.js.map +1 -1
  129. package/package.json +5 -4
  130. package/lib/components/FlowModeller/Connector.d.ts +0 -30
  131. package/lib/components/FlowModeller/Connector.d.ts.map +0 -1
  132. package/lib/components/FlowModeller/Connector.js +0 -89
  133. package/lib/components/FlowModeller/Connector.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Step.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA+D,MAAM,OAAO,CAAC;AAC9F,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,IAAI,EACJ,gBAAgB,EAGhB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,MAAM,EAEN,OAAO,EACP,OAAO,EACP,MAAM,EACN,aAAa,EAEd,MAAM,yBAAyB,CAAC;AAkDjC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CACtC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;IACxB,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,QAAQ,KAAK,EAAE;QACb,KAAK,SAAS;YACZ,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM;QACR,KAAK,QAAQ;YACX,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM;QACR,KAAK,cA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rB,EAAE,EAAE,IAAI,CAAC,EAAE,IACP,SAAS,UACb,EACD,KAAK,EAAE,IAAI,IAAI,CACd,KAAC,IAAI,kBAAC,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAC1E,KAAC,MAAM,kBAAC,OAAO,EAAE,KAAK,EAAE,IAAI,IAAI,SAAS,gBAAG,KAAK,EAAE,KAAK,YAAU,YAC7D,CACR,aACI,EACP,KAAC,OAAO,kBAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAC,MAAM,gBACvC,KAAK,IAAI,YAAY,IAAI,MAAM,YACxB,EACV,KAAC,IAAI,kBAAC,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,gBAC3E,YAAY,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,iBAAG,YAChE,EACP,KAAC,OAAO,kBAAC,MAAM,EAAE,QAAQ,iBAAc,MAAM,gBAC1C,OAAO,IAAI,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,YAC1D,aACL,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { useState, FunctionComponent, PropsWithoutRef, ChangeEvent, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Icon,\n Tooltip,\n useElement,\n Status,\n FormControlProps,\n Actions,\n useI18n,\n Avatar,\n StyledTooltip,\n Action\n} from '@pega/cosmos-react-core';\n\nimport {\n TaskItemProps,\n StepItemProps,\n StageItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface StepProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n}\n\ninterface StepComponentProps extends BaseProps, StepProps {\n /** Pass text for the step. */\n value?: string;\n /** step data id */\n id?: string;\n /** Determines the visual for icon, color and label to render.\n * This color is passed as a variant and accessible colors are used to display.\n * Icon and label are passed as normal string */\n visual: {\n imgurl: string;\n color:\n | 'magenta'\n | 'studio'\n | 'congressBlue'\n | 'Japaneselaurel'\n | 'violet'\n | 'yellow'\n | 'orange'\n | 'darkyellow';\n icon: string;\n title: string;\n };\n /* Determines the variant and label for the badges */\n badge?: StepItemProps['status'];\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /* Data of the steps which can be used to send the full info back */\n item: StepItemProps;\n stageItem: StageItemProps;\n taskItem: TaskItemProps;\n categoryItem: CategoryItemProps;\n}\n\nexport const StyledStepType = styled.div<{ color: string; ref: HTMLDivElement; img: string }>(\n ({ theme, color, img }) => {\n let bgColor = '';\n switch (color) {\n case 'magenta':\n bgColor = '#AC1361';\n break;\n case 'studio':\n bgColor = '#684AAE';\n break;\n case 'congressBlue':\n bgColor = '#0076d1';\n break;\n case 'Japaneselaurel':\n bgColor = '#27813E';\n break;\n case 'violet':\n bgColor = '#8C479F';\n break;\n case 'yellow':\n bgColor = '#f7a801';\n break;\n case 'darkyellow':\n bgColor = '#f7951c';\n break;\n case 'orange':\n bgColor = '#f46c22';\n break;\n\n default:\n bgColor = '#27813E';\n }\n\n const contrastColor = readableColor(bgColor);\n return img\n ? css`\n height: 2rem;\n padding-inline-end: calc(0.25 * ${theme.base.spacing});\n `\n : css`\n background: ${bgColor};\n margin: calc(0.5 * ${theme.base.spacing});\n padding: 0 calc(0.5 * ${theme.base.spacing});\n color: ${contrastColor};\n text-align: center;\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n `;\n }\n);\n\nexport const StyledStepBadge = styled.div(({ theme }) => {\n return css`\n padding: 0 calc(0.5 * ${theme.base.spacing});\n justify-content: flex-end;\n width: auto;\n max-width: calc(50% - ${theme.base.spacing});\n > span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n `;\n});\n\nconst StyledStepValue = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n ${error &&\n css`\n background: ${theme.base.colors.red['extra-light']};\n `}\n `;\n});\n\nexport const StyledStepValueInput = styled.input<{ error: string | undefined }>(\n ({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n border: none;\n border-inline-start: 0.0625rem solid transparent;\n border-inline-end: 0.0625rem solid transparent;\n text-overflow: ellipsis;\n min-width: 40%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n &:focus:enabled {\n border-color: ${theme.base.colors.red.medium};\n }\n `\n : css`\n background: ${theme.base.palette['secondary-background']};\n &&:hover {\n background: ${theme.base.palette['app-background']};\n }\n &&:focus:enabled {\n background: ${theme.base.palette['primary-background']};\n border-color: ${theme.base.colors.blue.medium};\n }\n `}\n `;\n }\n);\n\nexport const StyledStepStatus = styled.div<{\n badge: string;\n error: string;\n}>(({ theme, badge, error }) => {\n return css`\n border: none;\n ${badge &&\n css`\n display: none;\n `}\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n &:focus:not([disabled]) {\n outline: 0.0625rem solid ${theme.base.colors.blue.medium};\n }\n ${error &&\n !badge &&\n css`\n visibility: visible;\n `}\n `;\n});\n\nexport const StyledStep = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n background: ${theme.base.palette['secondary-background']};\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n width: 100%;\n ${error &&\n css`\n border-color: ${theme.base.colors.red.medium};\n box-shadow: none;\n `}\n &:hover {\n cursor: pointer;\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n visibility: visible;\n display: inline-block;\n `}\n }\n }\n &:focus-within {\n ${!error &&\n css`\n border-color: ${theme.base.colors.blue.medium};\n box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};\n `}\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n display: inline-block;\n visibility: visible;\n `}\n }\n ${StyledTooltip} {\n ${css`\n visibility: hidden;\n `}\n }\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nconst Step: FunctionComponent<StepComponentProps & ForwardProps> = ({\n value,\n id,\n visual,\n actions,\n badge,\n error,\n onChange,\n categoryItem,\n item,\n stageItem,\n taskItem,\n ...restProps\n}: PropsWithoutRef<StepComponentProps>) => {\n const t = useI18n();\n const [stepValue, setStepValue] = useState(value);\n const [iconEl, setIconEl] = useElement();\n const [actionEl, setActionEl] = useElement();\n const [inputEl, setInputEl] = useElement();\n const actionsLabel = t('actions');\n const singleActionLabel = (actions?.[0]?.text as string) ?? '';\n const tooltipValue = stepValue || error;\n\n /* Need to check the value with statusProps */\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n task: taskItem,\n stage: stageItem,\n step: item,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e);\n }\n });\n };\n /* Deep copy of actions is required to provide consistent callback objects on actions */\n const actionsClone: Action[] = [];\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setStepValue(e.target.value);\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onChange?.(actionParam, e);\n };\n\n return (\n <Flex as={StyledStep} container={{ inline: true }} error={error}>\n <Flex as={StyledStepType} color={visual.color} ref={setIconEl} img={visual.imgurl}>\n {visual.imgurl.length > 0 && (\n <Avatar name={visual.title || ''} imageSrc={visual?.imgurl} shape='squircle' size='m' />\n )}\n {!visual.imgurl && <Icon name={visual.icon} />}\n </Flex>\n\n <Tooltip target={iconEl}>{visual.title}</Tooltip>\n\n <Flex\n as={StyledStepValue}\n item={{ grow: 2 }}\n error={error}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledStepValueInput\n value={stepValue}\n type='text'\n ref={setInputEl}\n error={error}\n onChange={onInputChange}\n aria-label={stepValue}\n id={item.id}\n {...restProps}\n />\n {badge?.type && (\n <Flex as={StyledStepBadge} container={{ inline: true, alignItems: 'center' }}>\n <Status variant={badge?.type || 'success'}>{badge?.label}</Status>\n </Flex>\n )}\n </Flex>\n <Tooltip target={inputEl} hideDelay='none'>\n {error || tooltipValue || 'test'}\n </Tooltip>\n <Flex as={StyledStepStatus} ref={setActionEl} badge={badge?.type} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n </Flex>\n <Tooltip target={actionEl} aria-hidden='true'>\n {actions && actions?.length > 1 ? actionsLabel : singleActionLabel}\n </Tooltip>\n </Flex>\n );\n};\n\nexport default Step;\n"]}
1
+ {"version":3,"file":"Step.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Step.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAMT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU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AAI,IAAC,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,YAC3E,YAAY,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,iBAAG,WAChE,EACP,KAAC,OAAO,IAAC,MAAM,EAAE,QAAQ,iBAAc,MAAM,YAC1C,OAAO,IAAI,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,WAC1D,YACL,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithoutRef,\n ChangeEvent,\n FocusEvent,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Icon,\n Tooltip,\n useElement,\n Status,\n FormControlProps,\n Actions,\n useI18n,\n Avatar,\n StyledTooltip,\n Action\n} from '@pega/cosmos-react-core';\n\nimport {\n TaskItemProps,\n StepItemProps,\n StageItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface StepProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Input Change */\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** callback for Focus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n}\n\ninterface StepComponentProps extends BaseProps, StepProps {\n /** Pass text for the step. */\n value?: string;\n /** step data id */\n id?: string;\n /** Determines the visual for icon, color and label to render.\n * This color is passed as a variant and accessible colors are used to display.\n * Icon and label are passed as normal string */\n visual: {\n imgurl: string;\n color:\n | 'magenta'\n | 'studio'\n | 'congressBlue'\n | 'Japaneselaurel'\n | 'violet'\n | 'yellow'\n | 'orange'\n | 'darkyellow';\n icon: string;\n title: string;\n };\n /* Determines the variant and label for the badges */\n badge?: StepItemProps['status'];\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /* Data of the steps which can be used to send the full info back */\n item: StepItemProps;\n stageItem: StageItemProps;\n taskItem: TaskItemProps;\n categoryItem: CategoryItemProps;\n}\n\nexport const StyledStepType = styled.div<{ color: string; ref: HTMLDivElement; img: string }>(\n ({ theme, color, img }) => {\n let bgColor = '';\n switch (color) {\n case 'magenta':\n bgColor = '#AC1361';\n break;\n case 'studio':\n bgColor = '#684AAE';\n break;\n case 'congressBlue':\n bgColor = '#0076d1';\n break;\n case 'Japaneselaurel':\n bgColor = '#27813E';\n break;\n case 'violet':\n bgColor = '#8C479F';\n break;\n case 'yellow':\n bgColor = '#f7a801';\n break;\n case 'darkyellow':\n bgColor = '#f7951c';\n break;\n case 'orange':\n bgColor = '#f46c22';\n break;\n\n default:\n bgColor = '#27813E';\n }\n\n const contrastColor = readableColor(bgColor);\n return img\n ? css`\n height: 2rem;\n padding-inline-end: calc(0.25 * ${theme.base.spacing});\n `\n : css`\n background: ${bgColor};\n margin: calc(0.5 * ${theme.base.spacing});\n padding: 0 calc(0.5 * ${theme.base.spacing});\n color: ${contrastColor};\n text-align: center;\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n `;\n }\n);\n\nexport const StyledStepBadge = styled.div(({ theme }) => {\n return css`\n padding: 0 calc(0.5 * ${theme.base.spacing});\n justify-content: flex-end;\n width: auto;\n max-width: calc(50% - ${theme.base.spacing});\n > span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n `;\n});\n\nconst StyledStepValue = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n ${error &&\n css`\n background: ${theme.base.colors.red['extra-light']};\n `}\n `;\n});\n\nexport const StyledStepValueInput = styled.input<{ error: string | undefined }>(\n ({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n border: none;\n border-inline-start: 0.0625rem solid transparent;\n border-inline-end: 0.0625rem solid transparent;\n text-overflow: ellipsis;\n min-width: 40%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n &:focus:enabled {\n border-color: ${theme.base.colors.red.medium};\n }\n `\n : css`\n background: ${theme.base.palette['secondary-background']};\n &&:hover {\n background: ${theme.base.palette['app-background']};\n }\n &&:focus:enabled {\n background: ${theme.base.palette['primary-background']};\n border-color: ${theme.base.colors.blue.medium};\n }\n `}\n `;\n }\n);\n\nexport const StyledStepStatus = styled.div<{\n badge: string;\n error: string;\n}>(({ theme, badge, error }) => {\n return css`\n border: none;\n ${badge &&\n css`\n display: none;\n `}\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n &:focus:not([disabled]) {\n outline: 0.0625rem solid ${theme.base.colors.blue.medium};\n }\n ${error &&\n !badge &&\n css`\n visibility: visible;\n `}\n `;\n});\n\nexport const StyledStep = styled.div<{ error: string }>(({ theme, error }) => {\n return css`\n background: ${theme.base.palette['secondary-background']};\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n width: 100%;\n ${error &&\n css`\n border-color: ${theme.base.colors.red.medium};\n box-shadow: none;\n `}\n &:hover {\n cursor: pointer;\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n visibility: visible;\n display: inline-block;\n `}\n }\n }\n &:focus-within {\n ${!error &&\n css`\n border-color: ${theme.base.colors.blue.medium};\n box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};\n `}\n ${StyledStepBadge} {\n ${css`\n display: none;\n `}\n }\n ${StyledStepStatus} {\n ${css`\n display: inline-block;\n visibility: visible;\n `}\n }\n ${StyledTooltip} {\n ${css`\n visibility: hidden;\n `}\n }\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nconst Step: FunctionComponent<StepComponentProps & ForwardProps> = ({\n value,\n id,\n visual,\n actions,\n badge,\n error,\n onChange,\n categoryItem,\n item,\n stageItem,\n taskItem,\n onFocus,\n ...restProps\n}: PropsWithoutRef<StepComponentProps>) => {\n const t = useI18n();\n const [stepValue, setStepValue] = useState(value);\n const [iconEl, setIconEl] = useElement();\n const [actionEl, setActionEl] = useElement();\n const [inputEl, setInputEl] = useElement();\n const actionsLabel = t('actions');\n const singleActionLabel = (actions?.[0]?.text as string) ?? '';\n const tooltipValue = stepValue || error;\n\n /* Need to check the value with statusProps */\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n task: taskItem,\n stage: stageItem,\n step: item,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e);\n }\n });\n };\n /* Deep copy of actions is required to provide consistent callback objects on actions */\n const actionsClone: Action[] = [];\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setStepValue(e.target.value);\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onChange?.(actionParam, e);\n };\n\n const onInputFocus = (e: FocusEvent<HTMLInputElement>) => {\n const actionParam: LifeCycleActionParam = {\n value: e.target.value,\n step: item,\n task: taskItem,\n category: categoryItem,\n stage: stageItem\n };\n onFocus?.(actionParam, e);\n };\n\n return (\n <Flex as={StyledStep} container={{ inline: true }} error={error}>\n <Flex as={StyledStepType} color={visual.color} ref={setIconEl} img={visual.imgurl}>\n {visual.imgurl.length > 0 && (\n <Avatar name={visual.title || ''} imageSrc={visual?.imgurl} shape='squircle' size='m' />\n )}\n {!visual.imgurl && <Icon name={visual.icon} />}\n </Flex>\n\n <Tooltip target={iconEl}>{visual.title}</Tooltip>\n\n <Flex\n as={StyledStepValue}\n item={{ grow: 2 }}\n error={error}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledStepValueInput\n value={stepValue}\n type='text'\n ref={setInputEl}\n error={error}\n onChange={onInputChange}\n aria-label={stepValue}\n id={item.id}\n {...restProps}\n onFocus={onInputFocus}\n />\n {badge?.type && (\n <Flex as={StyledStepBadge} container={{ inline: true, alignItems: 'center' }}>\n <Status variant={badge?.type || 'success'}>{badge?.label}</Status>\n </Flex>\n )}\n </Flex>\n <Tooltip target={inputEl} hideDelay='none'>\n {error || tooltipValue || 'test'}\n </Tooltip>\n <Flex as={StyledStepStatus} ref={setActionEl} badge={badge?.type} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n </Flex>\n <Tooltip target={actionEl} aria-hidden='true'>\n {actions && actions?.length > 1 ? actionsLabel : singleActionLabel}\n </Tooltip>\n </Flex>\n );\n};\n\nexport default Step;\n"]}
@@ -1,4 +1,4 @@
1
- import { FunctionComponent, ChangeEvent } from 'react';
1
+ import { FunctionComponent, ChangeEvent, FocusEvent } from 'react';
2
2
  import { BaseProps, ForwardProps, FormControlProps } from '@pega/cosmos-react-core';
3
3
  import { StepProps } from './Step';
4
4
  import { TaskItemProps, StageItemProps, CategoryItemProps, LifeCycleAction, LifeCycleActionParam } from './LifeCycle.types';
@@ -15,6 +15,8 @@ export interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {
15
15
  };
16
16
  onAddStep?: LifeCycleAction['onClick'];
17
17
  onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;
18
+ /** callback for Focus of input */
19
+ onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;
18
20
  }
19
21
  interface TaskComponentProps extends BaseProps, TaskProps {
20
22
  /** Pass text for the task. */
@@ -1 +1 @@
1
- {"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,iBAAiB,EAAqB,WAAW,EAAc,MAAM,OAAO,CAAC;AAGhG,OAAO,EAGL,SAAS,EACT,YAAY,EAOZ,gBAAgB,EAIjB,MAAM,yBAAyB,CAAC;AAEjC,OAAa,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EACL,aAAa,EACb,cAAc,EAEd,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxE,iFAAiF;IACjF,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;KACxC,CAAC;IACF,SAAS,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CACpF;AAED,UAAU,kBAAmB,SAAQ,SAAS,EAAE,SAAS;IACvD,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,q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GAQ9B,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAqK9D,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -110,7 +110,7 @@ export const StyledInputWrapper = styled.div `
110
110
  }
111
111
  }
112
112
  `;
113
- const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem, error, onAddStep, onChange, categoryItem, id, step: stepProp, ...restProps }) => {
113
+ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem, error, onAddStep, onChange, onFocus, categoryItem, id, step: stepProp, ...restProps }) => {
114
114
  const t = useI18n();
115
115
  const [taskValue, setTaskValue] = useState(value);
116
116
  const [actionEl, setActionEl] = useElement();
@@ -153,6 +153,15 @@ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem,
153
153
  };
154
154
  onChange?.(param, e);
155
155
  };
156
+ const onInputFocus = (e) => {
157
+ const param = {
158
+ value: taskValue,
159
+ task: item,
160
+ stage: stageItem,
161
+ category: categoryItem
162
+ };
163
+ onFocus?.(param, e);
164
+ };
156
165
  const onAddStepClick = (e) => {
157
166
  const param = {
158
167
  task: item,
@@ -161,10 +170,10 @@ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem,
161
170
  };
162
171
  onAddStep?.(param, e);
163
172
  };
164
- return (_jsx(Flex, Object.assign({ as: StyledTaskList }, restProps, { children: _jsxs(Flex, Object.assign({ as: StyledTask, container: { direction: 'column' }, role: 'region' }, { children: [_jsxs(Flex, Object.assign({ as: StyledCardHeader, container: { itemGap: 0.4 } }, { children: [visual?.imgurl.length > 0 && _jsx(Avatar, { name: taskValue || '', imageSrc: visual?.imgurl }, void 0), _jsxs(Flex, Object.assign({ item: { grow: 1 }, as: StyledInputWrapper, container: { inline: true, alignItems: 'center' } }, { children: [_jsx(StyledInput, { value: taskValue, type: 'text', onChange: onInputChange, ref: setInputEl, error: error, id: item.id, "aria-labelledby": categoryItem.categoryId }, void 0), taskValue && (_jsx(Tooltip, Object.assign({ target: inputEl, hideDelay: 'none' }, { children: error || taskValue }), void 0))] }), void 0), _jsxs(Flex, Object.assign({ as: StyledTaskActions, ref: setActionEl, error: error }, { children: [actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }, void 0), _jsx(Tooltip, Object.assign({ target: actionEl, "aria-hidden": 'true' }, { children: actions && actions?.length > 1 ? actionsLabel : singleActionLabel }), void 0)] }), void 0)] }), void 0), _jsxs(Flex, Object.assign({ as: StyledCardContent }, { children: [item?.steps.map((steps) => {
173
+ return (_jsx(Flex, { as: StyledTaskList, ...restProps, children: _jsxs(Flex, { as: StyledTask, container: { direction: 'column' }, role: 'region', children: [_jsxs(Flex, { as: StyledCardHeader, container: { itemGap: 0.4 }, children: [visual?.imgurl.length > 0 && _jsx(Avatar, { name: taskValue || '', imageSrc: visual?.imgurl }, void 0), _jsxs(Flex, { item: { grow: 1 }, as: StyledInputWrapper, container: { inline: true, alignItems: 'center' }, children: [_jsx(StyledInput, { value: taskValue, type: 'text', onChange: onInputChange, ref: setInputEl, error: error, id: item.id, "aria-labelledby": categoryItem.categoryId, onFocus: onInputFocus }, void 0), taskValue && (_jsx(Tooltip, { target: inputEl, hideDelay: 'none', children: error || taskValue }, void 0))] }, void 0), _jsxs(Flex, { as: StyledTaskActions, ref: setActionEl, error: error, children: [actionsClone && _jsx(Actions, { items: actionsClone, menuAt: 2, iconOnly: true }, void 0), _jsx(Tooltip, { target: actionEl, "aria-hidden": 'true', children: actions && actions?.length > 1 ? actionsLabel : singleActionLabel }, void 0)] }, void 0)] }, void 0), _jsxs(Flex, { as: StyledCardContent, children: [item?.steps.map((steps) => {
165
174
  const badgeStatus = steps?.status?.type ? steps.status.type : '';
166
175
  const badgeLabel = steps?.status?.label ? steps.status.label : '';
167
- return (_jsx(Step, Object.assign({ id: steps.id, value: steps.label, visual: {
176
+ return (_jsx(Step, { id: steps.id, value: steps.label, visual: {
168
177
  imgurl: steps.visual.imgurl,
169
178
  color: steps.visual.color,
170
179
  icon: steps.visual.icon,
@@ -172,8 +181,8 @@ const Task = ({ value, visual, actions, item, addStepTitle, addTask, stageItem,
172
181
  }, item: steps, taskItem: item, stageItem: stageItem, badge: {
173
182
  type: badgeStatus,
174
183
  label: badgeLabel
175
- }, error: steps.error, categoryItem: categoryItem }, stepProp), steps.id));
176
- }), _jsxs(Flex, { children: [_jsx(Button, Object.assign({ variant: 'simple', label: addStepTitle, onClick: onAddStepClick, ref: setAddEl, icon: true, "aria-label": `${t('add')} ${addStepTitle}` }, { children: _jsx(Icon, { name: 'plus' }, void 0) }), void 0), _jsx(Tooltip, Object.assign({ target: addEl, "aria-hidden": 'true' }, { children: `${t('add')} ${addStepTitle}` }), void 0)] }, void 0)] }), void 0)] }), void 0) }), void 0));
184
+ }, error: steps.error, categoryItem: categoryItem, ...stepProp }, steps.id));
185
+ }), _jsxs(Flex, { children: [_jsx(Button, { variant: 'simple', label: addStepTitle, onClick: onAddStepClick, ref: setAddEl, icon: true, "aria-label": `${t('add')} ${addStepTitle}`, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0), _jsx(Tooltip, { target: addEl, "aria-hidden": 'true', children: `${t('add')} ${addStepTitle}` }, void 0)] }, void 0)] }, void 0)] }, void 0) }, void 0));
177
186
  };
178
187
  export default Task;
179
188
  //# sourceMappingURL=Task.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Task.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAiE,MAAM,OAAO,CAAC;AAChG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,gBAAgB,EAGhB,MAAM,EACN,IAAI,EAEJ,OAAO,EACP,UAAU,EACV,OAAO,EAEP,OAAO,EACP,MAAM,EACN,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,IAAmB,MAAM,QAAQ,CAAC;AA6C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AK,EAClB,MAAM,EAAE;oCACN,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;oCAC3B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;oCACzB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;oCACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;iCAC1B,EACD,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,IAAI,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE;oCACL,IAAI,EAAE,WAAW;oCACjB,KAAK,EAAE,UAAU;iCAClB,EACD,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,YAAY,EAAE,YAAY,IACtB,QAAQ,GAlBP,KAAK,CAAC,EAAE,CAmBb,CACH,CAAC;wBACJ,CAAC,CAAC,EACF,MAAC,IAAI,eACH,KAAC,MAAM,kBACL,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,cAAc,EACvB,GAAG,EAAE,QAAQ,EACb,IAAI,sBACQ,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,gBAEzC,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,WAAG,YACb,EACT,KAAC,OAAO,kBAAC,MAAM,EAAE,KAAK,iBAAc,MAAM,gBACvC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,YACtB,YACL,aACF,aACF,YACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { useState, FunctionComponent, PropsWithChildren, ChangeEvent, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Button,\n Icon,\n Action,\n Tooltip,\n useElement,\n Actions,\n FormControlProps,\n useI18n,\n Avatar,\n StyledTooltip\n} from '@pega/cosmos-react-core';\n\nimport Step, { StepProps } from './Step';\nimport {\n TaskItemProps,\n StageItemProps,\n StepItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Tooltip for adding items to the task component */\n addStepTitle: string;\n /** Region for adding the task component */\n addTask: {\n title: string;\n showOnce: boolean;\n onAddTask?: LifeCycleAction['onClick'];\n };\n onAddStep?: LifeCycleAction['onClick'];\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n}\n\ninterface TaskComponentProps extends BaseProps, TaskProps {\n /** Pass text for the task. */\n value?: string;\n /** support for an Avatar, Icon, or other supporting visual. */\n visual: {\n imgurl: string;\n };\n /** Pass task data */\n item: TaskItemProps;\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /** Step Props */\n step?: StepProps;\n /** Stage data to pass it as callback */\n stageItem: StageItemProps;\n /** Category data to pass it as callback */\n categoryItem: CategoryItemProps;\n id: string;\n}\n\nexport const StyledTaskList = styled.li(({ theme }) => {\n return css`\n list-style-type: none;\n margin-block-end: ${theme.base.spacing};\n &:last-child > article {\n margin-block-end: 0;\n }\n `;\n});\n\nexport const StyledCardHeader = styled.header(({ theme }) => {\n return css`\n padding: 0;\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n `;\n});\nStyledCardHeader.defaultProps = defaultThemeProp;\n\nexport const StyledCardContent = styled.div(() => {\n return css`\n padding: 0;\n `;\n});\nStyledCardContent.defaultProps = defaultThemeProp;\n\nexport const StyledInput = styled.input<{ error: string | undefined }>(({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n text-overflow: ellipsis;\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n width: 100%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n border: 0.0625rem solid ${theme.base.colors.red.medium};\n `\n : css`\n background: ${theme.base.palette['primary-background']};\n &&:hover {\n background: ${theme.base.palette['secondary-background']};\n }\n &&:focus:enabled {\n border: 0.0625rem solid ${theme.base.colors.blue.medium};\n background: ${theme.base.palette['primary-background']};\n }\n `}\n `;\n});\nStyledInput.defaultProps = defaultThemeProp;\n\nexport const StyledTaskActions = styled.div<{\n ref: HTMLDivElement;\n error: string;\n}>(({ error }) => {\n return css`\n border: none;\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n ${error &&\n css`\n visibility: visible;\n `}\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n `;\n});\nStyledTaskActions.defaultProps = defaultThemeProp;\n\nexport const StyledTask = styled.article(({ theme }) => {\n return css`\n background: ${theme.base.palette['primary-background']};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n padding: ${theme.base.spacing};\n &:focus-within,\n &:hover {\n ${StyledTaskActions} {\n ${css`\n visibility: visible;\n `}\n }\n }\n &:focus-within {\n box-shadow: 0 0 0.2rem 0.0625rem ${theme.base.colors.blue.medium};\n }\n &:hover {\n cursor: pointer;\n }\n `;\n});\nStyledTask.defaultProps = defaultThemeProp;\n\nexport const StyledInputWrapper = styled.div`\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n`;\n\nconst Task: FunctionComponent<TaskComponentProps & ForwardProps> = ({\n value,\n visual,\n actions,\n item,\n addStepTitle,\n addTask,\n stageItem,\n error,\n onAddStep,\n onChange,\n categoryItem,\n id,\n step: stepProp,\n ...restProps\n}: PropsWithChildren<TaskComponentProps>) => {\n const t = useI18n();\n const [taskValue, setTaskValue] = useState(value);\n const [actionEl, setActionEl] = useElement();\n const [inputEl, setInputEl] = useElement();\n const [addEl, setAddEl] = useElement();\n const actionsLabel = t('actions');\n const singleActionLabel = (actions?.[0]?.text as string) || '';\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e);\n }\n });\n };\n /* Deep copy of actions is required to provide consistent callback objects on actions */\n const actionsClone: Action[] = [];\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setTaskValue(e.target.value);\n const param: LifeCycleActionParam = {\n value: taskValue,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onChange?.(param, e);\n };\n const onAddStepClick = (e: MouseEvent<HTMLButtonElement>) => {\n const param: LifeCycleActionParam = {\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onAddStep?.(param, e);\n };\n\n return (\n <Flex as={StyledTaskList} {...restProps}>\n <Flex as={StyledTask} container={{ direction: 'column' }} role='region'>\n <Flex as={StyledCardHeader} container={{ itemGap: 0.4 }}>\n {visual?.imgurl.length > 0 && <Avatar name={taskValue || ''} imageSrc={visual?.imgurl} />}\n <Flex\n item={{ grow: 1 }}\n as={StyledInputWrapper}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledInput\n value={taskValue}\n type='text'\n onChange={onInputChange}\n ref={setInputEl}\n error={error}\n id={item.id}\n aria-labelledby={categoryItem.categoryId}\n />\n {taskValue && (\n <Tooltip target={inputEl} hideDelay='none'>\n {error || taskValue}\n </Tooltip>\n )}\n </Flex>\n <Flex as={StyledTaskActions} ref={setActionEl} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n <Tooltip target={actionEl} aria-hidden='true'>\n {actions && actions?.length > 1 ? actionsLabel : singleActionLabel}\n </Tooltip>\n </Flex>\n </Flex>\n <Flex as={StyledCardContent}>\n {item?.steps.map((steps: StepItemProps) => {\n const badgeStatus = steps?.status?.type ? steps.status.type : '';\n const badgeLabel = steps?.status?.label ? steps.status.label : '';\n return (\n <Step\n key={steps.id}\n id={steps.id}\n value={steps.label}\n visual={{\n imgurl: steps.visual.imgurl,\n color: steps.visual.color,\n icon: steps.visual.icon,\n title: steps.visual.label\n }}\n item={steps}\n taskItem={item}\n stageItem={stageItem}\n badge={{\n type: badgeStatus,\n label: badgeLabel\n }}\n error={steps.error}\n categoryItem={categoryItem}\n {...stepProp}\n />\n );\n })}\n <Flex>\n <Button\n variant='simple'\n label={addStepTitle}\n onClick={onAddStepClick}\n ref={setAddEl}\n icon\n aria-label={`${t('add')} ${addStepTitle}`}\n >\n <Icon name='plus' />\n </Button>\n <Tooltip target={addEl} aria-hidden='true'>\n {`${t('add')} ${addStepTitle}`}\n </Tooltip>\n </Flex>\n </Flex>\n </Flex>\n </Flex>\n );\n};\n\nexport default Task;\n"]}
1
+ {"version":3,"file":"Task.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/Task.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EAMT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,gBAAgB,EAGhB,MAAM,EACN,IAAI,EAEJ,OAAO,EACP,UAAU,EACV,OAAO,EAEP,OAAO,EACP,MAAM,EACN,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,IAAmB,MAAM,QAAQ,CAAC;AA+CzC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,OAAO,GAAG,CAAA;;wBAEY,KAAK,CAAC,IAAI,CAAC,OAAO;;;;GAIvC,CAAC;AACJ,CAAC,CAAC,CAAC;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AAI,IAEH,EAAE,EAAE,KAAK,CAAC,EAAE,EACZ,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,MAAM,EAAE;oCACN,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;oCAC3B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;oCACzB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;oCACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;iCAC1B,EACD,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,IAAI,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE;oCACL,IAAI,EAAE,WAAW;oCACjB,KAAK,EAAE,UAAU;iCAClB,EACD,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,YAAY,EAAE,YAAY,KACtB,QAAQ,IAlBP,KAAK,CAAC,EAAE,CAmBb,CACH,CAAC;wBACJ,CAAC,CAAC,EACF,MAAC,IAAI,eACH,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,cAAc,EACvB,GAAG,EAAE,QAAQ,EACb,IAAI,sBACQ,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,YAEzC,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,WAAG,WACb,EACT,KAAC,OAAO,IAAC,MAAM,EAAE,KAAK,iBAAc,MAAM,YACvC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,YAAY,EAAE,WACtB,YACL,YACF,YACF,WACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n useState,\n FunctionComponent,\n PropsWithChildren,\n ChangeEvent,\n FocusEvent,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Button,\n Icon,\n Action,\n Tooltip,\n useElement,\n Actions,\n FormControlProps,\n useI18n,\n Avatar,\n StyledTooltip\n} from '@pega/cosmos-react-core';\n\nimport Step, { StepProps } from './Step';\nimport {\n TaskItemProps,\n StageItemProps,\n StepItemProps,\n CategoryItemProps,\n LifeCycleAction,\n LifeCycleActionParam\n} from './LifeCycle.types';\n\nexport interface TaskProps extends Omit<FormControlProps, 'status' | 'id'> {\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: LifeCycleAction[];\n /** Tooltip for adding items to the task component */\n addStepTitle: string;\n /** Region for adding the task component */\n addTask: {\n title: string;\n showOnce: boolean;\n onAddTask?: LifeCycleAction['onClick'];\n };\n onAddStep?: LifeCycleAction['onClick'];\n onChange?: (param: LifeCycleActionParam, e: ChangeEvent<HTMLInputElement>) => void;\n /** callback for Focus of input */\n onFocus?: (param: LifeCycleActionParam, e: FocusEvent<HTMLInputElement>) => void;\n}\n\ninterface TaskComponentProps extends BaseProps, TaskProps {\n /** Pass text for the task. */\n value?: string;\n /** support for an Avatar, Icon, or other supporting visual. */\n visual: {\n imgurl: string;\n };\n /** Pass task data */\n item: TaskItemProps;\n /* The status is used to show the input error status and the info on tooltip in case of error */\n error?: string;\n /** Step Props */\n step?: StepProps;\n /** Stage data to pass it as callback */\n stageItem: StageItemProps;\n /** Category data to pass it as callback */\n categoryItem: CategoryItemProps;\n id: string;\n}\n\nexport const StyledTaskList = styled.li(({ theme }) => {\n return css`\n list-style-type: none;\n margin-block-end: ${theme.base.spacing};\n &:last-child > article {\n margin-block-end: 0;\n }\n `;\n});\n\nexport const StyledCardHeader = styled.header(({ theme }) => {\n return css`\n padding: 0;\n margin: 0 0 calc(0.5 * ${theme.base.spacing});\n `;\n});\nStyledCardHeader.defaultProps = defaultThemeProp;\n\nexport const StyledCardContent = styled.div(() => {\n return css`\n padding: 0;\n `;\n});\nStyledCardContent.defaultProps = defaultThemeProp;\n\nexport const StyledInput = styled.input<{ error: string | undefined }>(({ error, theme }) => {\n return css`\n height: ${theme.components.input.height};\n padding: 0 calc(0.5 * ${theme.base.spacing});\n text-overflow: ellipsis;\n border: 0.0625rem solid transparent;\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n width: 100%;\n outline: none;\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n ${error\n ? css`\n background: ${theme.base.colors.red['extra-light']};\n border: 0.0625rem solid ${theme.base.colors.red.medium};\n `\n : css`\n background: ${theme.base.palette['primary-background']};\n &&:hover {\n background: ${theme.base.palette['secondary-background']};\n }\n &&:focus:enabled {\n border: 0.0625rem solid ${theme.base.colors.blue.medium};\n background: ${theme.base.palette['primary-background']};\n }\n `}\n `;\n});\nStyledInput.defaultProps = defaultThemeProp;\n\nexport const StyledTaskActions = styled.div<{\n ref: HTMLDivElement;\n error: string;\n}>(({ error }) => {\n return css`\n border: none;\n visibility: hidden;\n &:hover {\n cursor: pointer;\n }\n ${error &&\n css`\n visibility: visible;\n `}\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n `;\n});\nStyledTaskActions.defaultProps = defaultThemeProp;\n\nexport const StyledTask = styled.article(({ theme }) => {\n return css`\n background: ${theme.base.palette['primary-background']};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n padding: ${theme.base.spacing};\n &:focus-within,\n &:hover {\n ${StyledTaskActions} {\n ${css`\n visibility: visible;\n `}\n }\n }\n &:focus-within {\n box-shadow: 0 0 0.2rem 0.0625rem ${theme.base.colors.blue.medium};\n }\n &:hover {\n cursor: pointer;\n }\n `;\n});\nStyledTask.defaultProps = defaultThemeProp;\n\nexport const StyledInputWrapper = styled.div`\n &:focus-within {\n ${StyledTooltip} {\n ${css`\n display: none;\n `}\n }\n }\n`;\n\nconst Task: FunctionComponent<TaskComponentProps & ForwardProps> = ({\n value,\n visual,\n actions,\n item,\n addStepTitle,\n addTask,\n stageItem,\n error,\n onAddStep,\n onChange,\n onFocus,\n categoryItem,\n id,\n step: stepProp,\n ...restProps\n}: PropsWithChildren<TaskComponentProps>) => {\n const t = useI18n();\n const [taskValue, setTaskValue] = useState(value);\n const [actionEl, setActionEl] = useElement();\n const [inputEl, setInputEl] = useElement();\n const [addEl, setAddEl] = useElement();\n const actionsLabel = t('actions');\n const singleActionLabel = (actions?.[0]?.text as string) || '';\n\n const onActionItemClick = (\n actionId: string,\n e: MouseEvent<HTMLInputElement | HTMLAnchorElement | HTMLButtonElement>\n ) => {\n const param: LifeCycleActionParam = {\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n actions?.forEach(actionItem => {\n if (actionItem.id === actionId) {\n actionItem.onClick(param, e);\n }\n });\n };\n /* Deep copy of actions is required to provide consistent callback objects on actions */\n const actionsClone: Action[] = [];\n\n if (actions) {\n actions.forEach(actionItem => {\n const actionCloneItem = {} as Action;\n Object.keys(actionItem).forEach((key: string) => {\n actionCloneItem[key] = actionItem[key];\n });\n actionCloneItem.onClick = onActionItemClick;\n actionsClone.push(actionCloneItem);\n return actionItem;\n });\n }\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n setTaskValue(e.target.value);\n const param: LifeCycleActionParam = {\n value: taskValue,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onChange?.(param, e);\n };\n\n const onInputFocus = (e: FocusEvent<HTMLInputElement>) => {\n const param: LifeCycleActionParam = {\n value: taskValue,\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onFocus?.(param, e);\n };\n\n const onAddStepClick = (e: MouseEvent<HTMLButtonElement>) => {\n const param: LifeCycleActionParam = {\n task: item,\n stage: stageItem,\n category: categoryItem\n };\n onAddStep?.(param, e);\n };\n\n return (\n <Flex as={StyledTaskList} {...restProps}>\n <Flex as={StyledTask} container={{ direction: 'column' }} role='region'>\n <Flex as={StyledCardHeader} container={{ itemGap: 0.4 }}>\n {visual?.imgurl.length > 0 && <Avatar name={taskValue || ''} imageSrc={visual?.imgurl} />}\n <Flex\n item={{ grow: 1 }}\n as={StyledInputWrapper}\n container={{ inline: true, alignItems: 'center' }}\n >\n <StyledInput\n value={taskValue}\n type='text'\n onChange={onInputChange}\n ref={setInputEl}\n error={error}\n id={item.id}\n aria-labelledby={categoryItem.categoryId}\n onFocus={onInputFocus}\n />\n {taskValue && (\n <Tooltip target={inputEl} hideDelay='none'>\n {error || taskValue}\n </Tooltip>\n )}\n </Flex>\n <Flex as={StyledTaskActions} ref={setActionEl} error={error}>\n {actionsClone && <Actions items={actionsClone} menuAt={2} iconOnly />}\n <Tooltip target={actionEl} aria-hidden='true'>\n {actions && actions?.length > 1 ? actionsLabel : singleActionLabel}\n </Tooltip>\n </Flex>\n </Flex>\n <Flex as={StyledCardContent}>\n {item?.steps.map((steps: StepItemProps) => {\n const badgeStatus = steps?.status?.type ? steps.status.type : '';\n const badgeLabel = steps?.status?.label ? steps.status.label : '';\n return (\n <Step\n key={steps.id}\n id={steps.id}\n value={steps.label}\n visual={{\n imgurl: steps.visual.imgurl,\n color: steps.visual.color,\n icon: steps.visual.icon,\n title: steps.visual.label\n }}\n item={steps}\n taskItem={item}\n stageItem={stageItem}\n badge={{\n type: badgeStatus,\n label: badgeLabel\n }}\n error={steps.error}\n categoryItem={categoryItem}\n {...stepProp}\n />\n );\n })}\n <Flex>\n <Button\n variant='simple'\n label={addStepTitle}\n onClick={onAddStepClick}\n ref={setAddEl}\n icon\n aria-label={`${t('add')} ${addStepTitle}`}\n >\n <Icon name='plus' />\n </Button>\n <Tooltip target={addEl} aria-hidden='true'>\n {`${t('add')} ${addStepTitle}`}\n </Tooltip>\n </Flex>\n </Flex>\n </Flex>\n </Flex>\n );\n};\n\nexport default Task;\n"]}
@@ -0,0 +1,23 @@
1
+ import { FC, Ref, MouseEvent } from 'react';
2
+ import { ForwardProps, ImageProps } from '@pega/cosmos-react-core';
3
+ import { SummaryCardProps } from '../SummaryCard';
4
+ interface EmptyStateProps {
5
+ heading: string;
6
+ description?: string;
7
+ }
8
+ export interface GalleryPageProps {
9
+ heading: string;
10
+ description?: string;
11
+ image?: ImageProps;
12
+ action: {
13
+ text: string;
14
+ onClick: (e: MouseEvent<HTMLButtonElement>) => void;
15
+ };
16
+ emptyState: EmptyStateProps;
17
+ items?: SummaryCardProps[];
18
+ onItemClick: (id: SummaryCardProps['id'], e: MouseEvent<HTMLDivElement>) => void;
19
+ ref?: Ref<HTMLDivElement>;
20
+ }
21
+ declare const GalleryPage: FC<GalleryPageProps & ForwardProps>;
22
+ export default GalleryPage;
23
+ //# sourceMappingURL=GalleryPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryPage.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/GalleryPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA+B,GAAG,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAS,UAAU,EAAsB,MAAM,yBAAyB,CAAC;AAE9F,OAAoB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAY/D,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;KACrD,CAAC;IACF,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC3B,WAAW,EAAE,CAAC,EAAE,EAAE,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IACjF,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAmED,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,GAAG,YAAY,CA+BpD,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { Image, Flex, Grid, Button } from '@pega/cosmos-react-core';
4
+ import SummaryCard from '../SummaryCard';
5
+ import { StyledDescription, StyledHeading, StyledSummaryCardList, StyledBanner, StyledImageContainer, StyledGalleryPage, StyledBannerInfo } from './GalleryPage.styles';
6
+ const Banner = ({ heading, description, image, action }) => {
7
+ return (_jsxs(Flex, { container: { alignItems: 'center', justify: 'between' }, as: StyledBanner, children: [_jsxs(Flex, { as: StyledBannerInfo, item: { grow: 1 }, children: [_jsx(StyledHeading, { variant: 'h1', children: heading }, void 0), description && _jsx(StyledDescription, { children: description }, void 0), action && (_jsx(Button, { onClick: (e) => action.onClick(e), children: action.text }, void 0))] }, void 0), image && (_jsx(StyledImageContainer, { children: _jsx(Image, { ...image }, void 0) }, void 0))] }, void 0));
8
+ };
9
+ const SummaryCardList = ({ items, onItemClick }) => {
10
+ return (_jsx(Grid, { container: {
11
+ cols: 'repeat(auto-fill, minmax(18.75rem, 1fr))',
12
+ autoRows: '10rem',
13
+ gap: 2
14
+ }, as: StyledSummaryCardList, children: items && items.map(item => _jsx(SummaryCard, { ...item, onClick: onItemClick }, item.id)) }, void 0));
15
+ };
16
+ const EmptyState = ({ heading, description, action }) => {
17
+ return (_jsxs(Flex, { container: { direction: 'column', alignItems: 'center', justify: 'center', rowGap: 2 }, item: { grow: 1 }, children: [_jsx(StyledHeading, { variant: 'h2', children: heading }, void 0), description && _jsx(StyledDescription, { children: description }, void 0), action && (_jsx(Button, { variant: 'primary', onClick: action.onClick, children: action.text }, void 0))] }, void 0));
18
+ };
19
+ const GalleryPage = forwardRef(({ heading, description, image, items, onItemClick, emptyState, action }, ref) => {
20
+ return (_jsx(StyledGalleryPage, { title: '', ref: ref, header: _jsx(Banner, { heading: heading, description: description, action: action, image: image }, void 0), a: items && items.length > 0 ? (_jsx(SummaryCardList, { items: items, onItemClick: onItemClick }, void 0)) : (_jsx(EmptyState, { ...emptyState, action: action }, void 0)), scrollContent: true }, void 0));
21
+ });
22
+ export default GalleryPage;
23
+ //# sourceMappingURL=GalleryPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryPage.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/GalleryPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAuB,UAAU,EAAmB,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAgB,KAAK,EAAc,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,WAAiC,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAqB9B,MAAM,MAAM,GAA+E,CAAC,EAC1F,OAAO,EACP,WAAW,EACX,KAAK,EACL,MAAM,EACP,EAAE,EAAE;IACH,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,YAAY,aAC7E,MAAC,IAAI,IAAC,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,aAC3C,KAAC,aAAa,IAAC,OAAO,EAAC,IAAI,YAAE,OAAO,WAAiB,EACpD,WAAW,IAAI,KAAC,iBAAiB,cAAE,WAAW,WAAqB,EACnE,MAAM,IAAI,CACT,KAAC,MAAM,IAAC,OAAO,EAAE,CAAC,CAAgC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,YACrE,MAAM,CAAC,IAAI,WACL,CACV,YACI,EACN,KAAK,IAAI,CACR,KAAC,oBAAoB,cACnB,KAAC,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AK,EAAC,EAAE,EACR,GAAG,EAAE,GAAG,EACR,MAAM,EACJ,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,WAAI,EAEtF,CAAC,EACC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAC1B,KAAC,eAAe,IAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,WAAI,CAC5D,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,OAAK,UAAU,EAAE,MAAM,EAAE,MAAM,WAAI,CAC/C,EAEH,aAAa,iBACb,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { FC, PropsWithoutRef, forwardRef, Ref, MouseEvent } from 'react';\n\nimport { ForwardProps, Image, ImageProps, Flex, Grid, Button } from '@pega/cosmos-react-core';\n\nimport SummaryCard, { SummaryCardProps } from '../SummaryCard';\n\nimport {\n StyledDescription,\n StyledHeading,\n StyledSummaryCardList,\n StyledBanner,\n StyledImageContainer,\n StyledGalleryPage,\n StyledBannerInfo\n} from './GalleryPage.styles';\n\ninterface EmptyStateProps {\n heading: string;\n description?: string;\n}\n\nexport interface GalleryPageProps {\n heading: string;\n description?: string;\n image?: ImageProps;\n action: {\n text: string;\n onClick: (e: MouseEvent<HTMLButtonElement>) => void;\n };\n emptyState: EmptyStateProps;\n items?: SummaryCardProps[];\n onItemClick: (id: SummaryCardProps['id'], e: MouseEvent<HTMLDivElement>) => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst Banner: FC<Pick<GalleryPageProps, 'heading' | 'description' | 'image' | 'action'>> = ({\n heading,\n description,\n image,\n action\n}) => {\n return (\n <Flex container={{ alignItems: 'center', justify: 'between' }} as={StyledBanner}>\n <Flex as={StyledBannerInfo} item={{ grow: 1 }}>\n <StyledHeading variant='h1'>{heading}</StyledHeading>\n {description && <StyledDescription>{description}</StyledDescription>}\n {action && (\n <Button onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick(e)}>\n {action.text}\n </Button>\n )}\n </Flex>\n {image && (\n <StyledImageContainer>\n <Image {...image} />\n </StyledImageContainer>\n )}\n </Flex>\n );\n};\n\nconst SummaryCardList: FC<{\n items: GalleryPageProps['items'];\n onItemClick: GalleryPageProps['onItemClick'];\n}> = ({ items, onItemClick }) => {\n return (\n <Grid\n container={{\n cols: 'repeat(auto-fill, minmax(18.75rem, 1fr))',\n autoRows: '10rem',\n gap: 2\n }}\n as={StyledSummaryCardList}\n >\n {items && items.map(item => <SummaryCard key={item.id} {...item} onClick={onItemClick} />)}\n </Grid>\n );\n};\n\nconst EmptyState: FC<EmptyStateProps & Pick<GalleryPageProps, 'action'>> = ({\n heading,\n description,\n action\n}) => {\n return (\n <Flex\n container={{ direction: 'column', alignItems: 'center', justify: 'center', rowGap: 2 }}\n item={{ grow: 1 }}\n >\n <StyledHeading variant='h2'>{heading}</StyledHeading>\n {description && <StyledDescription>{description}</StyledDescription>}\n {action && (\n <Button variant='primary' onClick={action.onClick}>\n {action.text}\n </Button>\n )}\n </Flex>\n );\n};\n\nconst GalleryPage: FC<GalleryPageProps & ForwardProps> = forwardRef(\n (\n {\n heading,\n description,\n image,\n items,\n onItemClick,\n emptyState,\n action\n }: PropsWithoutRef<GalleryPageProps>,\n ref: GalleryPageProps['ref']\n ) => {\n return (\n <StyledGalleryPage\n title=''\n ref={ref}\n header={\n <Banner heading={heading} description={description} action={action} image={image} />\n }\n a={\n items && items.length > 0 ? (\n <SummaryCardList items={items} onItemClick={onItemClick} />\n ) : (\n <EmptyState {...emptyState} action={action} />\n )\n }\n scrollContent\n />\n );\n }\n);\n\nexport default GalleryPage;\n"]}
@@ -0,0 +1,9 @@
1
+ import { Text, Flex, OneColumnPage } from '@pega/cosmos-react-core';
2
+ export declare const StyledBanner: import("styled-components").StyledComponent<"article", import("styled-components").DefaultTheme, {}, never>;
3
+ export declare const StyledBannerInfo: typeof Flex;
4
+ export declare const StyledImageContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
+ export declare const StyledSummaryCardList: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
6
+ export declare const StyledHeading: typeof Text;
7
+ export declare const StyledDescription: typeof Text;
8
+ export declare const StyledGalleryPage: typeof OneColumnPage;
9
+ //# sourceMappingURL=GalleryPage.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryPage.styles.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/GalleryPage.styles.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,IAAI,EAGJ,IAAI,EAEJ,aAAa,EAEd,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,YAAY,6GAcvB,CAAC;AAIH,eAAO,MAAM,gBAAgB,EAAE,OAAO,IAqBpC,CAAC;AAIH,eAAO,MAAM,oBAAoB,yGAQhC,CAAC;AAEF,eAAO,MAAM,qBAAqB,yGAIhC,CAAC;AAIH,eAAO,MAAM,aAAa,EAAE,OAAO,IAIlC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,OAAO,IAKtC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,OAAO,aAStC,CAAC"}
@@ -0,0 +1,70 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { readableColor } from 'polished';
3
+ import { Text, StyledButton, tryCatch, Flex, defaultThemeProp, OneColumnPage, StyledRegion } from '@pega/cosmos-react-core';
4
+ export const StyledBanner = styled.article(({ theme }) => {
5
+ const { base: { palette: { 'brand-primary': brandBackground } } } = theme;
6
+ const color = tryCatch(() => readableColor(brandBackground));
7
+ return css `
8
+ background: ${brandBackground};
9
+ color: ${color};
10
+ height: 11rem;
11
+ `;
12
+ });
13
+ StyledBanner.defaultProps = defaultThemeProp;
14
+ export const StyledBannerInfo = styled(Flex)(({ theme }) => {
15
+ const { base: { spacing, shadow } } = theme;
16
+ return css `
17
+ padding-inline-start: calc(5 * ${spacing});
18
+ max-width: 50%;
19
+
20
+ ${StyledButton} {
21
+ margin-block-start: calc(2 * ${spacing});
22
+ &:enabled:focus,
23
+ &:not([disabled]):focus {
24
+ box-shadow: ${shadow['focus-inverted']};
25
+ }
26
+ }
27
+
28
+ span {
29
+ margin-block-start: ${spacing};
30
+ }
31
+ `;
32
+ });
33
+ StyledBannerInfo.defaultProps = defaultThemeProp;
34
+ export const StyledImageContainer = styled.div `
35
+ padding: 0;
36
+ height: 100%;
37
+ max-width: 50%;
38
+ img {
39
+ object-fit: contain;
40
+ height: 100%;
41
+ }
42
+ `;
43
+ export const StyledSummaryCardList = styled.div(({ theme }) => {
44
+ return css `
45
+ margin-block-start: calc(2 * ${theme.base.spacing});
46
+ `;
47
+ });
48
+ StyledSummaryCardList.defaultProps = defaultThemeProp;
49
+ export const StyledHeading = styled(Text) `
50
+ text-overflow: ellipsis;
51
+ white-space: nowrap;
52
+ overflow: hidden;
53
+ `;
54
+ export const StyledDescription = styled(Text) `
55
+ display: -webkit-box;
56
+ -webkit-box-orient: vertical;
57
+ -webkit-line-clamp: 2;
58
+ overflow: hidden;
59
+ `;
60
+ export const StyledGalleryPage = styled(OneColumnPage) `
61
+ gap: 0;
62
+ & > header {
63
+ padding: 0;
64
+ }
65
+
66
+ ${StyledRegion} {
67
+ height: 100%;
68
+ }
69
+ `;
70
+ //# sourceMappingURL=GalleryPage.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryPage.styles.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/GalleryPage.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACb,MAAM,y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AC,CAAA;;;;CAIrD,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAgB,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;CAKzD,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAyB,MAAM,CAAC,aAAa,CAAC,CAAA;;;;;;IAMxE,YAAY;;;CAGf,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Text,\n StyledButton,\n tryCatch,\n Flex,\n defaultThemeProp,\n OneColumnPage,\n StyledRegion\n} from '@pega/cosmos-react-core';\n\nexport const StyledBanner = styled.article(({ theme }) => {\n const {\n base: {\n palette: { 'brand-primary': brandBackground }\n }\n } = theme;\n\n const color = tryCatch(() => readableColor(brandBackground));\n\n return css`\n background: ${brandBackground};\n color: ${color};\n height: 11rem;\n `;\n});\n\nStyledBanner.defaultProps = defaultThemeProp;\n\nexport const StyledBannerInfo: typeof Flex = styled(Flex)(({ theme }) => {\n const {\n base: { spacing, shadow }\n } = theme;\n\n return css`\n padding-inline-start: calc(5 * ${spacing});\n max-width: 50%;\n\n ${StyledButton} {\n margin-block-start: calc(2 * ${spacing});\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: ${shadow['focus-inverted']};\n }\n }\n\n span {\n margin-block-start: ${spacing};\n }\n `;\n});\n\nStyledBannerInfo.defaultProps = defaultThemeProp;\n\nexport const StyledImageContainer = styled.div`\n padding: 0;\n height: 100%;\n max-width: 50%;\n img {\n object-fit: contain;\n height: 100%;\n }\n`;\n\nexport const StyledSummaryCardList = styled.div(({ theme }) => {\n return css`\n margin-block-start: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledSummaryCardList.defaultProps = defaultThemeProp;\n\nexport const StyledHeading: typeof Text = styled(Text)`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n`;\n\nexport const StyledDescription: typeof Text = styled(Text)`\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n`;\n\nexport const StyledGalleryPage: typeof OneColumnPage = styled(OneColumnPage)`\n gap: 0;\n & > header {\n padding: 0;\n }\n\n ${StyledRegion} {\n height: 100%;\n }\n`;\n"]}
@@ -1,11 +1,17 @@
1
- import { FunctionComponent } from 'react';
2
- import { OneColumnPageProps as CoreOneColumnPageProps, TabbedPageProps as CoreTabbedPageProps, FieldValueListProps, ForwardProps, PageTemplateProps, OmitStrict } from '@pega/cosmos-react-core';
1
+ import { FunctionComponent, MouseEvent } from 'react';
2
+ import { OneColumnPageProps as CoreOneColumnPageProps, TabbedPageProps as CoreTabbedPageProps, FieldValueListProps, ForwardProps, PageTemplateProps, OmitStrict, StatusProps } from '@pega/cosmos-react-core';
3
3
  export interface PageHeaderProps extends Pick<PageTemplateProps, 'title' | 'actions'> {
4
- subTitle?: string;
4
+ metadata?: FieldValueListProps['fields'];
5
+ branchName?: string;
6
+ status?: {
7
+ type?: StatusProps['variant'];
8
+ label: string;
9
+ };
5
10
  additionalInfo?: {
6
11
  title: string;
7
12
  description?: string;
8
13
  fields: FieldValueListProps['fields'];
14
+ onEdit?: (e: MouseEvent<HTMLButtonElement>) => void;
9
15
  };
10
16
  }
11
17
  declare type OmittedPageProps = 'header' | 'scrollContent';
@@ -13,6 +19,7 @@ export interface OneColumnPageProps extends OmitStrict<CoreOneColumnPageProps, O
13
19
  }
14
20
  export interface TabbedPageProps extends OmitStrict<CoreTabbedPageProps, OmittedPageProps>, PageHeaderProps {
15
21
  }
22
+ export declare const StyledBranch: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
16
23
  export declare const StyledPage: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
17
24
  export declare const TabbedPage: FunctionComponent<TabbedPageProps & ForwardProps>;
18
25
  export declare const OneColumnPage: FunctionComponent<OneColumnPageProps & ForwardProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"PageTemplates.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,iBAAiB,EAAmC,MAAM,OAAO,CAAC;AAGjG,OAAO,EAEL,kBAAkB,IAAI,sBAAsB,EAE5C,eAAe,IAAI,mBAAmB,EACtC,mBAAmB,EAQnB,YAAY,EAKZ,iBAAiB,EACjB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAC;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;KACvC,CAAC;CACH;AAED,aAAK,gBAAgB,GAAG,QAAQ,GAAG,eAAe,CAAC;AAEnD,MAAM,WAAW,kBACf,SAAQ,UAAU,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,EAC1D,eAAe;CAAG;AAEtB,MAAM,WAAW,eACf,SAAQ,UAAU,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,EACvD,eAAe;CAAG;AAEtB,eAAO,MAAM,UAAU,yGAIrB,CAAC;AAqEH,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAcxE,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAoB9E,CAAC"}
1
+ {"version":3,"file":"PageTemplates.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAKjB,UAAU,EACX,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,kBAAkB,IAAI,sBAAsB,EAE5C,eAAe,IAAI,mBAAmB,EACtC,mBAAmB,EASnB,YAAY,EAMZ,iBAAiB,EACjB,UAAU,EAEV,WAAW,EAGZ,MAAM,yBAAyB,CAAC;AAMjC,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAC;IACnF,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,cAAc,CAAC,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACtC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;KACrD,CAAC;CACH;AAED,aAAK,gBAAgB,GAAG,QAAQ,GAAG,eAAe,CAAC;AAEnD,MAAM,WAAW,kBACf,SAAQ,UAAU,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,EAC1D,eAAe;CAAG;AAEtB,MAAM,WAAW,eACf,SAAQ,UAAU,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,EACvD,eAAe;CAAG;AAoBtB,eAAO,MAAM,YAAY,yGAQvB,CAAC;AAUH,eAAO,MAAM,UAAU,yGAAe,CAAC;AAmIvC,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAcxE,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAoB9E,CAAC"}
@@ -1,18 +1,55 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { forwardRef, useState, useEffect } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
- import { OneColumnPage as CoreOneColumnPage, TabbedPage as CoreTabbedPage, Flex, SummaryItem, Text, Button, Popover, FieldValueList, Icon, defaultThemeProp, useI18n, useElement, useOuterEvent } from '@pega/cosmos-react-core';
5
- export const StyledPage = styled.div(({ theme }) => {
4
+ import { OneColumnPage as CoreOneColumnPage, TabbedPage as CoreTabbedPage, Flex, Status, SummaryItem, Text, Button, Popover, FieldValueList, Icon, defaultThemeProp, useI18n, useDirection, useElement, useOuterEvent, StyledSummaryItemActions, registerIcon, StyledLabel } from '@pega/cosmos-react-core';
5
+ import * as nodesDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/nodes-down.icon';
6
+ import * as informationIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/information.icon';
7
+ registerIcon(nodesDownIcon, informationIcon);
8
+ const StyledTextWithEllipsis = styled(Text) `
9
+ overflow: hidden;
10
+ white-space: nowrap;
11
+ text-overflow: ellipsis;
12
+ `;
13
+ const StyledInfoPopover = styled(Popover) `
14
+ max-width: 60ch;
15
+ overflow-wrap: break-word;
16
+ `;
17
+ const StyledMetaFields = styled.dl `
18
+ dd,
19
+ dt {
20
+ display: inline;
21
+ }
22
+ `;
23
+ export const StyledBranch = styled.div(({ theme }) => {
6
24
  return css `
7
- background-color: ${theme.base.palette['primary-background']};
25
+ border: 0.0625rem solid ${theme.base.colors.gray.light};
26
+ border-radius: calc(0.5 * ${theme.base['border-radius']});
27
+ padding: calc(0.5 * ${theme.base.spacing});
28
+ max-width: 100%;
29
+ overflow: hidden;
8
30
  `;
9
31
  });
10
- StyledPage.defaultProps = defaultThemeProp;
11
- const PageHeader = ({ title, subTitle, additionalInfo, actions }) => {
32
+ StyledBranch.defaultProps = defaultThemeProp;
33
+ const StyledHeaderContent = styled(SummaryItem) `
34
+ ${StyledSummaryItemActions} {
35
+ align-self: start;
36
+ }
37
+ `;
38
+ export const StyledPage = styled.div ``;
39
+ const MetaFields = ({ metadata }) => {
40
+ return (_jsx(Flex, { container: { wrap: 'wrap', colGap: 1, rowGap: 0.25 }, as: StyledMetaFields, children: metadata.map(meta => {
41
+ return (_jsxs("div", { children: [_jsxs(StyledLabel, { as: 'dt', children: [meta.name, _jsx("span", { "aria-hidden": 'true', children: ": " }, void 0)] }, void 0), _jsx(Text, { variant: 'secondary', as: 'dd', children: meta.value }, void 0)] }, meta.id));
42
+ }) }, void 0));
43
+ };
44
+ const Branch = ({ branchName, status }) => {
45
+ return (_jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: StyledBranch, children: [status && (_jsx(Flex, { item: { shrink: 0 }, as: Status, variant: status.type, children: status.label }, void 0)), _jsx(Flex, { item: { shrink: 0 }, as: Icon, name: 'nodes-down' }, void 0), branchName && _jsx(StyledTextWithEllipsis, { children: branchName }, void 0)] }, void 0));
46
+ };
47
+ const PageHeader = ({ title, metadata, additionalInfo, actions, branchName, status }) => {
12
48
  const [open, setOpen] = useState(false);
13
49
  const [popoverEl, setPopoverRef] = useElement();
14
50
  const [buttonEl, setButtonEl] = useElement();
15
51
  const t = useI18n();
52
+ const { rtl } = useDirection();
16
53
  useOuterEvent('mousedown', [popoverEl, buttonEl], () => {
17
54
  if (open)
18
55
  setOpen(false);
@@ -35,12 +72,15 @@ const PageHeader = ({ title, subTitle, additionalInfo, actions }) => {
35
72
  popoverEl?.removeEventListener('keydown', closePopover);
36
73
  };
37
74
  }, [popoverEl]);
38
- return (_jsx(SummaryItem, { primary: _jsxs(Flex, Object.assign({ container: { alignItems: 'end', gap: 0.5 } }, { children: [_jsx(Text, Object.assign({ variant: 'h1' }, { children: title }), void 0), additionalInfo && (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ label: t('additional_info'), variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur) }, { children: _jsx(Icon, { name: 'information' }, void 0) }), void 0), _jsx(Popover, Object.assign({ ref: setPopoverRef, show: open, target: buttonEl, placement: 'right-end' }, { children: _jsxs(Flex, Object.assign({ container: { direction: 'column', gap: 1, pad: 2 } }, { children: [_jsx(Text, Object.assign({ variant: 'h3' }, { children: additionalInfo.title }), void 0), additionalInfo.description && (_jsx(Text, Object.assign({ variant: 'primary' }, { children: additionalInfo.description }), void 0)), _jsx(FieldValueList, { variant: 'inline', fields: additionalInfo.fields }, void 0)] }), void 0) }), void 0)] }, void 0))] }), void 0), secondary: _jsx(Text, Object.assign({ variant: 'secondary' }, { children: subTitle }), void 0), actions: actions }, void 0));
75
+ return (_jsx(StyledHeaderContent, { container: { rowGap: 0.5 }, primary: _jsxs(Flex, { container: { alignItems: 'start', gap: 0.5, wrap: 'wrap' }, children: [_jsxs(Flex, { container: { gap: 0.5 }, item: { shrink: 0 }, children: [_jsx(StyledTextWithEllipsis, { variant: 'h1', children: title }, void 0), additionalInfo && (_jsxs(_Fragment, { children: [_jsx(Button, { label: t('additional_info'), variant: 'simple', icon: true, ref: setButtonEl, onClick: () => setOpen(cur => !cur), children: _jsx(Icon, { name: 'information' }, void 0) }, void 0), _jsx(StyledInfoPopover, { ref: setPopoverRef, show: open, target: buttonEl, placement: rtl ? 'bottom-end' : 'bottom-start', children: _jsxs(Flex, { container: { direction: 'column', alignItems: 'start', gap: 2, pad: 2 }, children: [_jsxs(Flex, { container: { direction: 'column', gap: 1 }, children: [_jsx(Text, { variant: 'h3', children: additionalInfo.title }, void 0), additionalInfo.description && (_jsx(Text, { as: 'p', children: additionalInfo.description }, void 0)), _jsx(FieldValueList, { variant: 'inline', fields: additionalInfo.fields }, void 0)] }, void 0), additionalInfo.onEdit && (_jsx(Button, { onClick: (e) => {
76
+ setOpen(false);
77
+ additionalInfo.onEdit?.(e);
78
+ }, children: t('edit_details') }, void 0))] }, void 0) }, void 0)] }, void 0))] }, void 0), branchName && status && _jsx(Branch, { branchName: branchName, status: status }, void 0)] }, void 0), secondary: metadata && _jsx(MetaFields, { metadata: metadata }, void 0), actions: actions }, void 0));
39
79
  };
40
80
  export const TabbedPage = forwardRef(({ tabs, a, ...restProps }, ref) => {
41
- return (_jsx(CoreTabbedPage, Object.assign({}, restProps, { as: StyledPage, header: _jsx(PageHeader, Object.assign({}, restProps), void 0), tabs: tabs, ref: ref, scrollContent: true, a: a }), void 0));
81
+ return (_jsx(CoreTabbedPage, { ...restProps, as: StyledPage, header: _jsx(PageHeader, { ...restProps }, void 0), tabs: tabs, ref: ref, scrollContent: true, a: a }, void 0));
42
82
  });
43
83
  export const OneColumnPage = forwardRef(({ a, ...restProps }, ref) => {
44
- return (_jsx(CoreOneColumnPage, Object.assign({}, restProps, { as: StyledPage, header: _jsx(PageHeader, Object.assign({}, restProps), void 0), scrollContent: true, a: a, ref: ref }), void 0));
84
+ return (_jsx(CoreOneColumnPage, { ...restProps, as: StyledPage, header: _jsx(PageHeader, { ...restProps }, void 0), scrollContent: true, a: a, ref: ref }, void 0));
45
85
  });
46
86
  //# sourceMappingURL=PageTemplates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageTemplates.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA2C,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACjG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,aAAa,IAAI,iBAAiB,EAElC,UAAU,IAAI,cAAc,EAG5B,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,MAAM,EACN,OAAO,EACP,cAAc,EACd,IAAI,EAEJ,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,aAAa,EAGd,MAAM,yBAAyB,CAAC;AAqBjC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACjD,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;GAC7D,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3C,MAAM,UAAU,GAAG,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E,GAAwB,EAAE,EAAE;IACxF,OAAO,CACL,KAAC,cAAc,oBACT,SAAS,IACb,EAAE,EAAE,UAAU,EACd,MAAM,EAAE,KAAC,UAAU,oBAAK,SAAS,UAAI,EACrC,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,GAAG,EACR,aAAa,QACb,CAAC,EAAE,CAAC,YACJ,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAyD,UAAU,CAC3F,CACE,EACE,CAAC,EAED,GAAG,SAAS,EACwB,EACtC,GAAwB,EACxB,EAAE;IACF,OAAO,CACL,KAAC,iBAAiB,oBACZ,SAAS,IACb,EAAE,EAAE,UAAU,EACd,MAAM,EAAE,KAAC,UAAU,oBAAK,SAAS,UAAI,EACrC,aAAa,QACb,CAAC,EAAE,CAAC,EACJ,GAAG,EAAE,GAAG,YACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { PropsWithoutRef, Ref, FunctionComponent, forwardRef, useState, useEffect } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n OneColumnPage as CoreOneColumnPage,\n OneColumnPageProps as CoreOneColumnPageProps,\n TabbedPage as CoreTabbedPage,\n TabbedPageProps as CoreTabbedPageProps,\n FieldValueListProps,\n Flex,\n SummaryItem,\n Text,\n Button,\n Popover,\n FieldValueList,\n Icon,\n ForwardProps,\n defaultThemeProp,\n useI18n,\n useElement,\n useOuterEvent,\n PageTemplateProps,\n OmitStrict\n} from '@pega/cosmos-react-core';\n\nexport interface PageHeaderProps extends Pick<PageTemplateProps, 'title' | 'actions'> {\n subTitle?: string;\n additionalInfo?: {\n title: string;\n description?: string;\n fields: FieldValueListProps['fields'];\n };\n}\n\ntype OmittedPageProps = 'header' | 'scrollContent';\n\nexport interface OneColumnPageProps\n extends OmitStrict<CoreOneColumnPageProps, OmittedPageProps>,\n PageHeaderProps {}\n\nexport interface TabbedPageProps\n extends OmitStrict<CoreTabbedPageProps, OmittedPageProps>,\n PageHeaderProps {}\n\nexport const StyledPage = styled.div(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['primary-background']};\n `;\n});\n\nStyledPage.defaultProps = defaultThemeProp;\n\nconst PageHeader = ({ title, subTitle, additionalInfo, actions }: PageHeaderProps) => {\n const [open, setOpen] = useState(false);\n const [popoverEl, setPopoverRef] = useElement<HTMLElement>();\n const [buttonEl, setButtonEl] = useElement<HTMLElement>();\n const t = useI18n();\n\n useOuterEvent('mousedown', [popoverEl, buttonEl], () => {\n if (open) setOpen(false);\n });\n\n useEffect(() => {\n const closePopover = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n setOpen(false);\n if (e.currentTarget === popoverEl) {\n e.stopPropagation();\n buttonEl?.focus();\n }\n }\n };\n document.addEventListener('keydown', closePopover);\n popoverEl?.addEventListener('keydown', closePopover);\n\n return () => {\n document.removeEventListener('keydown', closePopover);\n popoverEl?.removeEventListener('keydown', closePopover);\n };\n }, [popoverEl]);\n\n return (\n <SummaryItem\n primary={\n <Flex container={{ alignItems: 'end', gap: 0.5 }}>\n <Text variant='h1'>{title}</Text>\n {additionalInfo && (\n <>\n <Button\n label={t('additional_info')}\n variant='simple'\n icon\n ref={setButtonEl}\n onClick={() => setOpen(cur => !cur)}\n >\n <Icon name='information' />\n </Button>\n <Popover ref={setPopoverRef} show={open} target={buttonEl} placement='right-end'>\n <Flex container={{ direction: 'column', gap: 1, pad: 2 }}>\n <Text variant='h3'>{additionalInfo.title}</Text>\n {additionalInfo.description && (\n <Text variant='primary'>{additionalInfo.description}</Text>\n )}\n <FieldValueList variant='inline' fields={additionalInfo.fields} />\n </Flex>\n </Popover>\n </>\n )}\n </Flex>\n }\n secondary={<Text variant='secondary'>{subTitle}</Text>}\n actions={actions}\n />\n );\n};\n\nexport const TabbedPage: FunctionComponent<TabbedPageProps & ForwardProps> = forwardRef(\n ({ tabs, a, ...restProps }: PropsWithoutRef<TabbedPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <CoreTabbedPage\n {...restProps}\n as={StyledPage}\n header={<PageHeader {...restProps} />}\n tabs={tabs}\n ref={ref}\n scrollContent\n a={a}\n />\n );\n }\n);\n\nexport const OneColumnPage: FunctionComponent<OneColumnPageProps & ForwardProps> = forwardRef(\n (\n {\n a,\n\n ...restProps\n }: PropsWithoutRef<OneColumnPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <CoreOneColumnPage\n {...restProps}\n as={StyledPage}\n header={<PageHeader {...restProps} />}\n scrollContent\n a={a}\n ref={ref}\n />\n );\n }\n);\n"]}
1
+ {"version":3,"file":"PageTemplates.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,UAAU,EACV,QAAQ,EACR,SAAS,EAGV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,aAAa,IAAI,iBAAiB,EAElC,UAAU,IAAI,cAAc,EAG5B,IAAI,EACJ,MAAM,EACN,WAAW,EACX,IAAI,EACJ,MAAM,EACN,OAAO,EACP,cAAc,EACd,IAAI,EAEJ,gBAAgB,EAChB,OAAO,EACP,YAAY,EACZ,UAAU,EACV,aAAa,EAGb,wBAAwB,EAExB,YAAY,EACZ,WAAW,EACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,eAAe,MAAM,oEAAoE,CAAC;AAEtG,YAAY,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AAwB7C,MAAM,sBAAsB,GAAgB,MAAM,CAAC,IAAI,CAAC,CAAA;;;;CAIvD,CAAC;AAEF,MAAM,iBAAiB,GAAmB,MAAM,CAAC,OAAO,CAAC,CAAA;;;CAGxD,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;CAKjC,CAAC;AAEF,MAAM,CAA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,KAAC,cAAc,OACT,SAAS,EACb,EAAE,EAAE,UAAU,EACd,MAAM,EAAE,KAAC,UAAU,OAAK,SAAS,WAAI,EACrC,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,GAAG,EACR,aAAa,QACb,CAAC,EAAE,CAAC,WACJ,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAyD,UAAU,CAC3F,CACE,EACE,CAAC,EAED,GAAG,SAAS,EACwB,EACtC,GAAwB,EACxB,EAAE;IACF,OAAO,CACL,KAAC,iBAAiB,OACZ,SAAS,EACb,EAAE,EAAE,UAAU,EACd,MAAM,EAAE,KAAC,UAAU,OAAK,SAAS,WAAI,EACrC,aAAa,QACb,CAAC,EAAE,CAAC,EACJ,GAAG,EAAE,GAAG,WACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import {\n PropsWithoutRef,\n Ref,\n FunctionComponent,\n forwardRef,\n useState,\n useEffect,\n FC,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n OneColumnPage as CoreOneColumnPage,\n OneColumnPageProps as CoreOneColumnPageProps,\n TabbedPage as CoreTabbedPage,\n TabbedPageProps as CoreTabbedPageProps,\n FieldValueListProps,\n Flex,\n Status,\n SummaryItem,\n Text,\n Button,\n Popover,\n FieldValueList,\n Icon,\n ForwardProps,\n defaultThemeProp,\n useI18n,\n useDirection,\n useElement,\n useOuterEvent,\n PageTemplateProps,\n OmitStrict,\n StyledSummaryItemActions,\n StatusProps,\n registerIcon,\n StyledLabel\n} from '@pega/cosmos-react-core';\nimport * as nodesDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/nodes-down.icon';\nimport * as informationIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/information.icon';\n\nregisterIcon(nodesDownIcon, informationIcon);\n\nexport interface PageHeaderProps extends Pick<PageTemplateProps, 'title' | 'actions'> {\n metadata?: FieldValueListProps['fields'];\n branchName?: string;\n status?: { type?: StatusProps['variant']; label: string };\n additionalInfo?: {\n title: string;\n description?: string;\n fields: FieldValueListProps['fields'];\n onEdit?: (e: MouseEvent<HTMLButtonElement>) => void;\n };\n}\n\ntype OmittedPageProps = 'header' | 'scrollContent';\n\nexport interface OneColumnPageProps\n extends OmitStrict<CoreOneColumnPageProps, OmittedPageProps>,\n PageHeaderProps {}\n\nexport interface TabbedPageProps\n extends OmitStrict<CoreTabbedPageProps, OmittedPageProps>,\n PageHeaderProps {}\n\nconst StyledTextWithEllipsis: typeof Text = styled(Text)`\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n`;\n\nconst StyledInfoPopover: typeof Popover = styled(Popover)`\n max-width: 60ch;\n overflow-wrap: break-word;\n`;\n\nconst StyledMetaFields = styled.dl`\n dd,\n dt {\n display: inline;\n }\n`;\n\nexport const StyledBranch = styled.div(({ theme }) => {\n return css`\n border: 0.0625rem solid ${theme.base.colors.gray.light};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n padding: calc(0.5 * ${theme.base.spacing});\n max-width: 100%;\n overflow: hidden;\n `;\n});\n\nStyledBranch.defaultProps = defaultThemeProp;\n\nconst StyledHeaderContent = styled(SummaryItem)`\n ${StyledSummaryItemActions} {\n align-self: start;\n }\n`;\n\nexport const StyledPage = styled.div``;\n\nconst MetaFields: FC<{ metadata: NonNullable<PageHeaderProps['metadata']> }> = ({ metadata }) => {\n return (\n <Flex container={{ wrap: 'wrap', colGap: 1, rowGap: 0.25 }} as={StyledMetaFields}>\n {metadata.map(meta => {\n return (\n <div key={meta.id}>\n <StyledLabel as='dt'>\n {meta.name}\n <span aria-hidden='true'>: </span>\n </StyledLabel>\n <Text variant='secondary' as='dd'>\n {meta.value}\n </Text>\n </div>\n );\n })}\n </Flex>\n );\n};\n\nconst Branch: FC<Pick<PageHeaderProps, 'branchName' | 'status'>> = ({ branchName, status }) => {\n return (\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as={StyledBranch}>\n {status && (\n <Flex item={{ shrink: 0 }} as={Status} variant={status.type}>\n {status.label}\n </Flex>\n )}\n <Flex item={{ shrink: 0 }} as={Icon} name='nodes-down' />\n {branchName && <StyledTextWithEllipsis>{branchName}</StyledTextWithEllipsis>}\n </Flex>\n );\n};\n\nconst PageHeader = ({\n title,\n metadata,\n additionalInfo,\n actions,\n branchName,\n status\n}: PageHeaderProps) => {\n const [open, setOpen] = useState(false);\n const [popoverEl, setPopoverRef] = useElement<HTMLElement>();\n const [buttonEl, setButtonEl] = useElement<HTMLElement>();\n const t = useI18n();\n const { rtl } = useDirection();\n\n useOuterEvent('mousedown', [popoverEl, buttonEl], () => {\n if (open) setOpen(false);\n });\n\n useEffect(() => {\n const closePopover = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n setOpen(false);\n if (e.currentTarget === popoverEl) {\n e.stopPropagation();\n buttonEl?.focus();\n }\n }\n };\n\n document.addEventListener('keydown', closePopover);\n popoverEl?.addEventListener('keydown', closePopover);\n\n return () => {\n document.removeEventListener('keydown', closePopover);\n popoverEl?.removeEventListener('keydown', closePopover);\n };\n }, [popoverEl]);\n\n return (\n <StyledHeaderContent\n container={{ rowGap: 0.5 }}\n primary={\n <Flex container={{ alignItems: 'start', gap: 0.5, wrap: 'wrap' }}>\n <Flex container={{ gap: 0.5 }} item={{ shrink: 0 }}>\n <StyledTextWithEllipsis variant='h1'>{title}</StyledTextWithEllipsis>\n {additionalInfo && (\n <>\n <Button\n label={t('additional_info')}\n variant='simple'\n icon\n ref={setButtonEl}\n onClick={() => setOpen(cur => !cur)}\n >\n <Icon name='information' />\n </Button>\n <StyledInfoPopover\n ref={setPopoverRef}\n show={open}\n target={buttonEl}\n placement={rtl ? 'bottom-end' : 'bottom-start'}\n >\n <Flex container={{ direction: 'column', alignItems: 'start', gap: 2, pad: 2 }}>\n <Flex container={{ direction: 'column', gap: 1 }}>\n <Text variant='h3'>{additionalInfo.title}</Text>\n {additionalInfo.description && (\n <Text as='p'>{additionalInfo.description}</Text>\n )}\n <FieldValueList variant='inline' fields={additionalInfo.fields} />\n </Flex>\n {additionalInfo.onEdit && (\n <Button\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n setOpen(false);\n additionalInfo.onEdit?.(e);\n }}\n >\n {t('edit_details')}\n </Button>\n )}\n </Flex>\n </StyledInfoPopover>\n </>\n )}\n </Flex>\n {branchName && status && <Branch branchName={branchName} status={status} />}\n </Flex>\n }\n secondary={metadata && <MetaFields metadata={metadata} />}\n actions={actions}\n />\n );\n};\n\nexport const TabbedPage: FunctionComponent<TabbedPageProps & ForwardProps> = forwardRef(\n ({ tabs, a, ...restProps }: PropsWithoutRef<TabbedPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <CoreTabbedPage\n {...restProps}\n as={StyledPage}\n header={<PageHeader {...restProps} />}\n tabs={tabs}\n ref={ref}\n scrollContent\n a={a}\n />\n );\n }\n);\n\nexport const OneColumnPage: FunctionComponent<OneColumnPageProps & ForwardProps> = forwardRef(\n (\n {\n a,\n\n ...restProps\n }: PropsWithoutRef<OneColumnPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <CoreOneColumnPage\n {...restProps}\n as={StyledPage}\n header={<PageHeader {...restProps} />}\n scrollContent\n a={a}\n ref={ref}\n />\n );\n }\n);\n"]}