@pega/cosmos-react-work 2.0.0-dev.9.2 → 2.0.0-rc.2

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 (170) hide show
  1. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +3 -3
  2. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
  3. package/lib/components/AppAnnouncement/AppAnnouncement.js +5 -7
  4. package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
  5. package/lib/components/CaseHeader/CaseHeader.d.ts +2 -2
  6. package/lib/components/CaseHeader/CaseHeader.d.ts.map +1 -1
  7. package/lib/components/CaseHeader/CaseHeader.js +9 -9
  8. package/lib/components/CaseHeader/CaseHeader.js.map +1 -1
  9. package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
  10. package/lib/components/CasePreview/CasePreview.js +14 -11
  11. package/lib/components/CasePreview/CasePreview.js.map +1 -1
  12. package/lib/components/CaseSummary/CaseSummary.d.ts +18 -1
  13. package/lib/components/CaseSummary/CaseSummary.d.ts.map +1 -1
  14. package/lib/components/CaseSummary/CaseSummary.js +122 -10
  15. package/lib/components/CaseSummary/CaseSummary.js.map +1 -1
  16. package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts.map +1 -1
  17. package/lib/components/CaseSummaryFields/CaseSummaryFields.js +12 -10
  18. package/lib/components/CaseSummaryFields/CaseSummaryFields.js.map +1 -1
  19. package/lib/components/CaseView/CaseView.d.ts +6 -23
  20. package/lib/components/CaseView/CaseView.d.ts.map +1 -1
  21. package/lib/components/CaseView/CaseView.js +167 -170
  22. package/lib/components/CaseView/CaseView.js.map +1 -1
  23. package/lib/components/CaseView/CaseView.styles.d.ts +24 -0
  24. package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -0
  25. package/lib/components/CaseView/CaseView.styles.js +111 -0
  26. package/lib/components/CaseView/CaseView.styles.js.map +1 -0
  27. package/lib/components/CaseView/MobileCaseView.js +1 -3
  28. package/lib/components/CaseView/MobileCaseView.js.map +1 -1
  29. package/lib/components/CaseView/UtilitiesSummary.js +4 -5
  30. package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
  31. package/lib/components/CaseView/index.d.ts +2 -1
  32. package/lib/components/CaseView/index.d.ts.map +1 -1
  33. package/lib/components/CaseView/index.js +1 -1
  34. package/lib/components/CaseView/index.js.map +1 -1
  35. package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts +4 -0
  36. package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts.map +1 -0
  37. package/lib/components/ConfigurableLayout/ConfigurableLayout.js +93 -0
  38. package/lib/components/ConfigurableLayout/ConfigurableLayout.js.map +1 -0
  39. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts +43 -0
  40. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts.map +1 -0
  41. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.js +2 -0
  42. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.js.map +1 -0
  43. package/lib/components/ConfigurableLayout/LayoutCell.d.ts +6 -0
  44. package/lib/components/ConfigurableLayout/LayoutCell.d.ts.map +1 -0
  45. package/lib/components/ConfigurableLayout/LayoutCell.js +64 -0
  46. package/lib/components/ConfigurableLayout/LayoutCell.js.map +1 -0
  47. package/lib/components/ConfigurableLayout/defaults.d.ts +4 -0
  48. package/lib/components/ConfigurableLayout/defaults.d.ts.map +1 -0
  49. package/lib/components/ConfigurableLayout/defaults.js +4 -0
  50. package/lib/components/ConfigurableLayout/defaults.js.map +1 -0
  51. package/lib/components/ConfigurableLayout/index.d.ts +3 -0
  52. package/lib/components/ConfigurableLayout/index.d.ts.map +1 -0
  53. package/lib/components/ConfigurableLayout/index.js +3 -0
  54. package/lib/components/ConfigurableLayout/index.js.map +1 -0
  55. package/lib/components/ConfigurableLayout/options.d.ts +10 -0
  56. package/lib/components/ConfigurableLayout/options.d.ts.map +1 -0
  57. package/lib/components/ConfigurableLayout/options.js +10 -0
  58. package/lib/components/ConfigurableLayout/options.js.map +1 -0
  59. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts +7 -0
  60. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts.map +1 -0
  61. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.js +37 -0
  62. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.js.map +1 -0
  63. package/lib/components/Confirmation/Confirmation.d.ts +19 -0
  64. package/lib/components/Confirmation/Confirmation.d.ts.map +1 -0
  65. package/lib/components/Confirmation/Confirmation.js +14 -0
  66. package/lib/components/Confirmation/Confirmation.js.map +1 -0
  67. package/lib/components/Confirmation/index.d.ts +3 -0
  68. package/lib/components/Confirmation/index.d.ts.map +1 -0
  69. package/lib/components/Confirmation/index.js +2 -0
  70. package/lib/components/Confirmation/index.js.map +1 -0
  71. package/lib/components/Details/Details.d.ts +13 -0
  72. package/lib/components/Details/Details.d.ts.map +1 -0
  73. package/lib/components/Details/Details.js +38 -0
  74. package/lib/components/Details/Details.js.map +1 -0
  75. package/lib/components/Details/index.d.ts +4 -0
  76. package/lib/components/Details/index.d.ts.map +1 -0
  77. package/lib/components/Details/index.js +3 -0
  78. package/lib/components/Details/index.js.map +1 -0
  79. package/lib/components/Glimpse/Glimpse.d.ts +2 -2
  80. package/lib/components/Glimpse/Glimpse.d.ts.map +1 -1
  81. package/lib/components/Glimpse/Glimpse.js +1 -2
  82. package/lib/components/Glimpse/Glimpse.js.map +1 -1
  83. package/lib/components/SearchResults/Filter.d.ts.map +1 -1
  84. package/lib/components/SearchResults/Filter.js +10 -42
  85. package/lib/components/SearchResults/Filter.js.map +1 -1
  86. package/lib/components/SearchResults/SearchResult.js +1 -4
  87. package/lib/components/SearchResults/SearchResult.js.map +1 -1
  88. package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
  89. package/lib/components/SearchResults/SearchResults.js +33 -69
  90. package/lib/components/SearchResults/SearchResults.js.map +1 -1
  91. package/lib/components/SearchResults/SearchResults.styles.d.ts +8 -0
  92. package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -0
  93. package/lib/components/SearchResults/SearchResults.styles.js +67 -0
  94. package/lib/components/SearchResults/SearchResults.styles.js.map +1 -0
  95. package/lib/components/SearchResults/SearchResults.types.d.ts +16 -6
  96. package/lib/components/SearchResults/SearchResults.types.d.ts.map +1 -1
  97. package/lib/components/SearchResults/SearchResults.types.js.map +1 -1
  98. package/lib/components/Stages/Stages.d.ts.map +1 -1
  99. package/lib/components/Stages/Stages.js +13 -15
  100. package/lib/components/Stages/Stages.js.map +1 -1
  101. package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
  102. package/lib/components/Stages/Stages.styles.js +2 -2
  103. package/lib/components/Stages/Stages.styles.js.map +1 -1
  104. package/lib/components/Stages/Stages.types.d.ts +2 -2
  105. package/lib/components/Stages/Stages.types.d.ts.map +1 -1
  106. package/lib/components/Stages/Stages.types.js.map +1 -1
  107. package/lib/components/Stages/Steps.d.ts.map +1 -1
  108. package/lib/components/Stages/Steps.js +5 -3
  109. package/lib/components/Stages/Steps.js.map +1 -1
  110. package/lib/components/Stages/StepsContainer.d.ts.map +1 -1
  111. package/lib/components/Stages/StepsContainer.js +4 -6
  112. package/lib/components/Stages/StepsContainer.js.map +1 -1
  113. package/lib/components/Stakeholders/StakeholderForm.d.ts +7 -0
  114. package/lib/components/Stakeholders/StakeholderForm.d.ts.map +1 -0
  115. package/lib/components/Stakeholders/StakeholderForm.js +49 -0
  116. package/lib/components/Stakeholders/StakeholderForm.js.map +1 -0
  117. package/lib/components/Stakeholders/Stakeholders.d.ts +6 -0
  118. package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -0
  119. package/lib/components/Stakeholders/Stakeholders.js +215 -0
  120. package/lib/components/Stakeholders/Stakeholders.js.map +1 -0
  121. package/lib/components/Stakeholders/Stakeholders.types.d.ts +83 -0
  122. package/lib/components/Stakeholders/Stakeholders.types.d.ts.map +1 -0
  123. package/lib/components/Stakeholders/Stakeholders.types.js +2 -0
  124. package/lib/components/Stakeholders/Stakeholders.types.js.map +1 -0
  125. package/lib/components/Stakeholders/index.d.ts +3 -0
  126. package/lib/components/Stakeholders/index.d.ts.map +1 -0
  127. package/lib/components/Stakeholders/index.js +2 -0
  128. package/lib/components/Stakeholders/index.js.map +1 -0
  129. package/lib/components/Tags/Tags.d.ts +34 -0
  130. package/lib/components/Tags/Tags.d.ts.map +1 -0
  131. package/lib/components/Tags/Tags.js +227 -0
  132. package/lib/components/Tags/Tags.js.map +1 -0
  133. package/lib/components/Tags/index.d.ts +3 -0
  134. package/lib/components/Tags/index.d.ts.map +1 -0
  135. package/lib/components/Tags/index.js +2 -0
  136. package/lib/components/Tags/index.js.map +1 -0
  137. package/lib/components/Tasks/TaskList.d.ts +25 -0
  138. package/lib/components/Tasks/TaskList.d.ts.map +1 -0
  139. package/lib/components/Tasks/TaskList.js +25 -0
  140. package/lib/components/Tasks/TaskList.js.map +1 -0
  141. package/lib/components/Tasks/Tasks.d.ts +3 -15
  142. package/lib/components/Tasks/Tasks.d.ts.map +1 -1
  143. package/lib/components/Tasks/Tasks.js +9 -28
  144. package/lib/components/Tasks/Tasks.js.map +1 -1
  145. package/lib/components/Tasks/index.d.ts +3 -0
  146. package/lib/components/Tasks/index.d.ts.map +1 -1
  147. package/lib/components/Tasks/index.js +1 -0
  148. package/lib/components/Tasks/index.js.map +1 -1
  149. package/lib/components/Timeline/Timeline.d.ts.map +1 -1
  150. package/lib/components/Timeline/Timeline.js +10 -12
  151. package/lib/components/Timeline/Timeline.js.map +1 -1
  152. package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
  153. package/lib/components/Timeline/Timeline.styles.js +8 -4
  154. package/lib/components/Timeline/Timeline.styles.js.map +1 -1
  155. package/lib/components/Timeline/Timeline.types.d.ts +18 -5
  156. package/lib/components/Timeline/Timeline.types.d.ts.map +1 -1
  157. package/lib/components/Timeline/Timeline.types.js.map +1 -1
  158. package/lib/components/Timeline/TimelineItem.d.ts +2 -1
  159. package/lib/components/Timeline/TimelineItem.d.ts.map +1 -1
  160. package/lib/components/Timeline/TimelineItem.js +4 -11
  161. package/lib/components/Timeline/TimelineItem.js.map +1 -1
  162. package/lib/components/Timeline/utils.d.ts +11 -3
  163. package/lib/components/Timeline/utils.d.ts.map +1 -1
  164. package/lib/components/Timeline/utils.js +48 -4
  165. package/lib/components/Timeline/utils.js.map +1 -1
  166. package/lib/index.d.ts +10 -0
  167. package/lib/index.d.ts.map +1 -1
  168. package/lib/index.js +10 -0
  169. package/lib/index.js.map +1 -1
  170. package/package.json +12 -12
@@ -1,23 +1,25 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
- import { Grid, FieldValueList, StyledFieldValueList, Text, defaultThemeProp } from '@pega/cosmos-react-core';
5
- export const StyledCaseSummaryFields = styled.div(({ theme }) => css `
4
+ import { Grid, FieldValueList, StyledFieldValueList, StyledFieldValue, calculateFontSize, defaultThemeProp } from '@pega/cosmos-react-core';
5
+ export const StyledCaseSummaryFields = styled.div(({ theme }) => {
6
+ const fontSizes = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
7
+ return css `
6
8
  padding: calc(2 * ${theme.base.spacing});
7
9
 
8
10
  > ${StyledFieldValueList}:first-child {
9
11
  grid-template-columns: 16ch auto;
12
+
13
+ ${StyledFieldValue} {
14
+ font-size: ${fontSizes[theme.components.text.h1['font-size']]};
15
+ font-weight: ${theme.components.text.h1['font-weight']};
16
+ }
10
17
  }
11
- `);
18
+ `;
19
+ });
12
20
  StyledCaseSummaryFields.defaultProps = defaultThemeProp;
13
21
  const CaseSummaryFields = forwardRef(({ primaryFields, secondaryFields, ...restProps }, ref) => {
14
- return (_jsxs(Grid, Object.assign({}, restProps, { as: StyledCaseSummaryFields, ref: ref, container: { rowGap: 2 } }, { children: [_jsx(FieldValueList, { variant: 'stacked', fields: primaryFields.map(field => typeof field.value === 'string'
15
- ? {
16
- ...field,
17
- value: (_jsx(Text, Object.assign({ variant: 'h1', as: 'span' }, { children: field.value }), void 0))
18
- }
19
- : field) }, void 0),
20
- _jsx(FieldValueList, { variant: 'inline', fields: secondaryFields }, void 0)] }), void 0));
22
+ return (_jsxs(Grid, { ...restProps, as: StyledCaseSummaryFields, ref: ref, container: { rowGap: 2 }, children: [_jsx(FieldValueList, { variant: 'stacked', fields: primaryFields }, void 0), _jsx(FieldValueList, { variant: 'inline', fields: secondaryFields }, void 0)] }, void 0));
21
23
  });
22
24
  export default CaseSummaryFields;
23
25
  //# sourceMappingURL=CaseSummaryFields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CaseSummaryFields.js","sourceRoot":"","sources":["../../../src/components/CaseSummaryFields/CaseSummaryFields.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,UAAU,EAA2C,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,cAAc,EACd,oBAAoB,EACpB,IAAI,EACJ,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAC/C,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;wBACI,KAAK,CAAC,IAAI,CAAC,OAAO;;QAElC,oBAAoB;;;GAGzB,CACF,CAAC;AAEF,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAmBxD,MAAM,iBAAiB,GAA6D,UAAU,CAC5F,CACE,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,SAAS,EAA2C,EACzF,GAAkC,EAClC,EAAE;IACF,OAAO,CACL,MAAC,IAAI,oBAAK,SAAS,IAAE,EAAE,EAAE,uBAAuB,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,iBAClF,KAAC,cAAc,IACb,OAAO,EAAC,SAAS,EACjB,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAChC,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;oBAC7B,CAAC,CAAC;wBACE,GAAG,KAAK;wBACR,KAAK,EAAE,CACL,KAAC,IAAI,kBAAC,OAAO,EAAC,IAAI,EAAC,EAAE,EAAC,MAAM,gBACzB,KAAK,CAAC,KAAK,YACP,CACR;qBACF;oBACH,CAAC,CAAC,KAAK,CACV,WACD;YACF,KAAC,cAAc,IAAC,OAAO,EAAC,QAAQ,EAAC,MAAM,EAAE,eAAe,WAAI,aACvD,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { ReactNode, forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Grid,\n FieldValueList,\n StyledFieldValueList,\n Text,\n defaultThemeProp,\n ForwardProps\n} from '@pega/cosmos-react-core';\n\nexport const StyledCaseSummaryFields = styled.div(\n ({ theme }) => css`\n padding: calc(2 * ${theme.base.spacing});\n\n > ${StyledFieldValueList}:first-child {\n grid-template-columns: 16ch auto;\n }\n `\n);\n\nStyledCaseSummaryFields.defaultProps = defaultThemeProp;\n\nexport interface CaseSummaryFieldsProps {\n /** The primary summary fields to display above secondary fields. */\n primaryFields: {\n id?: string;\n name: string;\n value: ReactNode;\n }[];\n /** The secondary summary fields to display below primary fields. */\n secondaryFields: {\n id?: string;\n name: string;\n value: ReactNode;\n }[];\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst CaseSummaryFields: FunctionComponent<CaseSummaryFieldsProps & ForwardProps> = forwardRef(\n (\n { primaryFields, secondaryFields, ...restProps }: PropsWithoutRef<CaseSummaryFieldsProps>,\n ref: CaseSummaryFieldsProps['ref']\n ) => {\n return (\n <Grid {...restProps} as={StyledCaseSummaryFields} ref={ref} container={{ rowGap: 2 }}>\n <FieldValueList\n variant='stacked'\n fields={primaryFields.map(field =>\n typeof field.value === 'string'\n ? {\n ...field,\n value: (\n <Text variant='h1' as='span'>\n {field.value}\n </Text>\n )\n }\n : field\n )}\n />\n <FieldValueList variant='inline' fields={secondaryFields} />\n </Grid>\n );\n }\n);\n\nexport default CaseSummaryFields;\n"]}
1
+ {"version":3,"file":"CaseSummaryFields.js","sourceRoot":"","sources":["../../../src/components/CaseSummaryFields/CaseSummaryFields.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,UAAU,EAA2C,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC9D,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEvF,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,IAAI,CAAC,OAAO;;QAElC,oBAAoB;;;QAGpB,gBAAgB;qBACH,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAa,CAAC;uBAC1D,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC;;;GAG3D,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAmBxD,MAAM,iBAAiB,GAA6D,UAAU,CAC5F,CACE,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,SAAS,EAA2C,EACzF,GAAkC,EAClC,EAAE;IACF,OAAO,CACL,MAAC,IAAI,OAAK,SAAS,EAAE,EAAE,EAAE,uBAAuB,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,aAClF,KAAC,cAAc,IAAC,OAAO,EAAC,SAAS,EAAC,MAAM,EAAE,aAAa,WAAI,EAC3D,KAAC,cAAc,IAAC,OAAO,EAAC,QAAQ,EAAC,MAAM,EAAE,eAAe,WAAI,YACvD,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { ReactNode, forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Grid,\n FieldValueList,\n StyledFieldValueList,\n StyledFieldValue,\n calculateFontSize,\n defaultThemeProp,\n ForwardProps,\n FontSize\n} from '@pega/cosmos-react-core';\n\nexport const StyledCaseSummaryFields = styled.div(({ theme }) => {\n const fontSizes = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n padding: calc(2 * ${theme.base.spacing});\n\n > ${StyledFieldValueList}:first-child {\n grid-template-columns: 16ch auto;\n\n ${StyledFieldValue} {\n font-size: ${fontSizes[theme.components.text.h1['font-size'] as FontSize]};\n font-weight: ${theme.components.text.h1['font-weight']};\n }\n }\n `;\n});\n\nStyledCaseSummaryFields.defaultProps = defaultThemeProp;\n\nexport interface CaseSummaryFieldsProps {\n /** The primary summary fields to display above secondary fields. */\n primaryFields: {\n id?: string;\n name: string;\n value: ReactNode;\n }[];\n /** The secondary summary fields to display below primary fields. */\n secondaryFields: {\n id?: string;\n name: string;\n value: ReactNode;\n }[];\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst CaseSummaryFields: FunctionComponent<CaseSummaryFieldsProps & ForwardProps> = forwardRef(\n (\n { primaryFields, secondaryFields, ...restProps }: PropsWithoutRef<CaseSummaryFieldsProps>,\n ref: CaseSummaryFieldsProps['ref']\n ) => {\n return (\n <Grid {...restProps} as={StyledCaseSummaryFields} ref={ref} container={{ rowGap: 2 }}>\n <FieldValueList variant='stacked' fields={primaryFields} />\n <FieldValueList variant='inline' fields={secondaryFields} />\n </Grid>\n );\n }\n);\n\nexport default CaseSummaryFields;\n"]}
@@ -11,6 +11,8 @@ export interface CaseViewProps extends CaseSummaryProps {
11
11
  utilities?: ReactNode;
12
12
  /** The utilities summary array will be used to render the minimized the utilities card. */
13
13
  utilitiesSummaryItems?: UtilitiesSummaryProps['items'];
14
+ /** Collapses the utilities by default on load */
15
+ defaultCollapsedUtilities?: boolean;
14
16
  /** A region above the center column to display banners. */
15
17
  banners?: ReactNode;
16
18
  /** A region to the right reserved for persistent utilities. */
@@ -19,30 +21,11 @@ export interface CaseViewProps extends CaseSummaryProps {
19
21
  title: string;
20
22
  };
21
23
  /** A region within the center column that is controlled by tabs in CaseSummary. */
22
- tabContent?: ReactNode;
24
+ tabContent?: {
25
+ content: ReactNode;
26
+ id: string;
27
+ }[];
23
28
  }
24
- export declare const StyledCaseViewContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
25
- forceMobile?: boolean | undefined;
26
- isMediumOrAbove?: boolean | undefined;
27
- }, never>;
28
- export declare const StyledMobileTabs: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
29
- export declare const StyledCaseViewUtilities: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
30
- utilitiesShown: boolean;
31
- }, never>;
32
- export declare const StyledCaseView: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
33
- forceMobile?: boolean | undefined;
34
- isMediumOrAbove?: boolean | undefined;
35
- }, never>;
36
- export declare const StyledSummaryRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
37
- forceMobile?: boolean | undefined;
38
- isMediumOrAbove?: boolean | undefined;
39
- }, never>;
40
- export declare const StyledCaseDrawer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
41
- hasPersistentUtility?: boolean | undefined;
42
- }, never>;
43
- export declare const StyledCaseDrawerContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
44
- export declare const StyledPersistentUtility: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
45
- export declare const ScrollStick: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
46
29
  declare const CaseView: FC<CaseViewProps & ForwardProps>;
47
30
  export default CaseView;
48
31
  //# sourceMappingURL=CaseView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CaseView.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,EAAE,EASH,MAAM,OAAO,CAAC;AAGf,OAAO,EASL,YAAY,EAMb,MAAM,yBAAyB,CAAC;AAGjC,OAAoB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAyB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD,2CAA2C;IAC3C,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gFAAgF;IAChF,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,2FAA2F;IAC3F,qBAAqB,CAAC,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACvD,2DAA2D;IAC3D,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,mFAAmF;IACnF,UAAU,CAAC,EAAE,SAAS,CAAC;CAMxB;AAID,eAAO,MAAM,qBAAqB;;;SAahC,CAAC;AAEH,eAAO,MAAM,gBAAgB,yGAK3B,CAAC;AAcH,eAAO,MAAM,uBAAuB;oBAAgC,OAAO;SAQ1E,CAAC;AAIF,eAAO,MAAM,cAAc;;;SAgB1B,CAAC;AAIF,eAAO,MAAM,mBAAmB;;;SAqB/B,CAAC;AAIF,eAAO,MAAM,gBAAgB;;SAiB5B,CAAC;AAIF,eAAO,MAAM,uBAAuB,yGAOlC,CAAC;AAIH,eAAO,MAAM,uBAAuB,yGAIlC,CAAC;AAIH,eAAO,MAAM,WAAW,yGAGvB,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,GAAG,YAAY,CAiS9C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"CaseView.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,EAAE,EAWH,MAAM,OAAO,CAAC;AAEf,OAAO,EAUL,YAAY,EAOb,MAAM,yBAAyB,CAAC;AAMjC,OAAoB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAyB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAe7E,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD,2CAA2C;IAC3C,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gFAAgF;IAChF,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,2FAA2F;IAC3F,qBAAqB,CAAC,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACvD,iDAAiD;IACjD,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,2DAA2D;IAC3D,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,mFAAmF;IACnF,UAAU,CAAC,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAMnD;AAED,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,GAAG,YAAY,CAoc9C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1,138 +1,54 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState, useCallback, useMemo, useRef } from 'react';
3
- import styled, { css } from 'styled-components';
4
- import { Button, Flex, Grid, Icon, TabPanel, useBreakpoint, useScrollStick, defaultThemeProp, Card, Drawer, useI18n, useDirection, Tabs } from '@pega/cosmos-react-core';
2
+ import { useContext, useEffect, useState, useCallback, useMemo, useRef, useLayoutEffect } from 'react';
3
+ import { Button, Flex, Grid, Icon, registerIcon, TabPanel, useBreakpoint, useScrollStick, useElement, Card, Drawer, useI18n, useDirection, useConsolidatedRef } from '@pega/cosmos-react-core';
4
+ import AppShellContext from '@pega/cosmos-react-core/lib/components/AppShell/AppShellContext';
5
+ import * as moveRightSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/move-right-solid.icon';
6
+ import * as moveLeftSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/move-left-solid.icon';
5
7
  import CaseSummary from '../CaseSummary';
6
8
  import UtilitiesSummary from './UtilitiesSummary';
7
- const persistentUtilityWidth = '60ch';
8
- export const StyledCaseViewContent = styled.div(({ theme, forceMobile, isMediumOrAbove }) => {
9
- return css `
10
- padding: calc(2 * ${theme.base.spacing});
11
-
12
- ${!forceMobile &&
13
- isMediumOrAbove &&
14
- css `
15
- padding: calc(2 * ${theme.base.spacing}) 0;
16
- `}
17
- `;
18
- });
19
- export const StyledMobileTabs = styled.div(({ theme }) => {
20
- return css `
21
- border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};
22
- margin: 0 calc(-2 * ${theme.base.spacing});
23
- `;
24
- });
25
- StyledCaseViewContent.defaultProps = defaultThemeProp;
26
- const StyledUtilToggle = styled.button(({ theme }) => {
27
- return css `
28
- align-self: flex-end;
29
- color: ${theme.base.palette['foreground-color']};
30
- margin-inline-end: 0.375rem;
31
- `;
32
- });
33
- StyledUtilToggle.defaultProps = defaultThemeProp;
34
- export const StyledCaseViewUtilities = styled.div(({ utilitiesShown, theme }) => {
35
- return css `
36
- width: ${utilitiesShown ? '25rem' : 'auto'};
37
- height: max-content;
38
- padding: calc(2 * ${theme.base.spacing}) 0 calc(2 * ${theme.base.spacing});
39
- `;
40
- });
41
- StyledCaseViewUtilities.defaultProps = defaultThemeProp;
42
- export const StyledCaseView = styled.div(({ theme, forceMobile, isMediumOrAbove }) => {
43
- return css `
44
- min-height: 100vh;
45
- position: relative;
46
- background-color: ${theme.base.palette['app-background']};
47
-
48
- > :last-child {
49
- ${!forceMobile &&
50
- isMediumOrAbove &&
51
- css `
52
- margin-inline-end: calc(2 * ${theme.base.spacing});
53
- `}
54
- }
55
- `;
56
- });
57
- StyledCaseView.defaultProps = defaultThemeProp;
58
- export const StyledSummaryRegion = styled.div(({ theme, forceMobile, isMediumOrAbove }) => {
59
- return css `
60
- position: sticky;
61
- top: 0;
62
- width: 100%;
63
- background-color: ${theme.base.palette['primary-background']};
64
- overflow: auto;
65
-
66
- ${(forceMobile || !isMediumOrAbove) &&
67
- css `
68
- z-index: ${theme.base['z-index'].popover + 1};
69
- `}
70
-
71
- ${!forceMobile &&
72
- isMediumOrAbove &&
73
- css `
74
- height: 100vh;
75
- `}
76
- `;
77
- });
78
- StyledSummaryRegion.defaultProps = defaultThemeProp;
79
- export const StyledCaseDrawer = styled.div(({ hasPersistentUtility, theme }) => {
80
- return css `
81
- min-width: 21.875rem;
82
- max-width: 31.25rem;
83
- width: calc((100vw - 31.25rem) / 10 + 21.875rem);
84
- background-color: ${theme.base.palette['primary-background']};
85
- height: 100vh;
86
-
87
- ${hasPersistentUtility &&
88
- css `
89
- @media (min-width: ${theme.base.breakpoints.md}) {
90
- inset-inline-end: ${persistentUtilityWidth};
91
- }
92
- `}
93
- `;
94
- });
95
- StyledCaseDrawer.defaultProps = defaultThemeProp;
96
- export const StyledCaseDrawerContent = styled.div(({ theme }) => {
97
- return css `
98
- background-color: ${theme.base.palette['app-background']};
99
- padding: calc(2 * ${theme.base.spacing});
100
- height: 100%;
101
- overflow: auto;
102
- `;
103
- });
104
- StyledCaseDrawerContent.defaultProps = defaultThemeProp;
105
- export const StyledPersistentUtility = styled.div(({ theme }) => {
106
- return css `
107
- z-index: calc(${theme.base['z-index'].drawer} + 400);
108
- `;
109
- });
110
- StyledPersistentUtility.defaultProps = defaultThemeProp;
111
- export const ScrollStick = styled.div `
112
- position: sticky;
113
- top: 0;
114
- `;
9
+ import { StyledCaseDrawer, StyledCaseDrawerContent, StyledCaseView, StyledCaseViewContent, StyledPersistentUtility, StyledSummaryRegion, StyledCaseViewUtilities, StyledMobileTabs, StyledUtilToggle } from './CaseView.styles';
10
+ registerIcon(moveRightSolidIcon, moveLeftSolidIcon);
115
11
  const CaseView = (props) => {
116
- const { caseId, parentCases, heading, caseLink, icon, followed, onFollowedChange, summary, caseSummaryRef, tabs: { currentTabId, items: tabItemsProp, onClick: onTabClick }, stages, tasks, tabContent: tabContentProp, utilities, utilitiesSummaryItems, actions, onEdit, banners, persistentUtility, forceMobile, ...restProps } = props;
12
+ const { caseId, parentCases, heading, caseLink, icon, followed, onFollowedChange, summary, caseSummaryRef, tabs: { currentTabId, items: tabItemsProp, onClick: onTabClick }, stages, tasks, tabContent: tabContentProp = [], utilities, utilitiesSummaryItems, defaultCollapsedUtilities = false, actions, onEdit, banners, persistentUtility, forceMobile, ...restProps } = props;
117
13
  const t = useI18n();
118
14
  const caseViewRef = useRef(null);
15
+ const caseViewSummaryRef = useConsolidatedRef(caseSummaryRef);
16
+ const caseSummaryHeaderRef = useRef(null);
17
+ const caseViewSummaryContainerRef = useRef(null);
18
+ const [tabContentEl, setTabContentEl] = useElement(null);
19
+ let isExtraLargeOrAbove = useBreakpoint('xl', { breakpointRef: caseViewRef });
119
20
  let isLargeOrAbove = useBreakpoint('lg', { breakpointRef: caseViewRef });
120
21
  let isMediumOrAbove = useBreakpoint('md', { breakpointRef: caseViewRef });
121
- const isViewPortMediumOrAbove = useBreakpoint('md');
122
22
  if (forceMobile) {
23
+ isExtraLargeOrAbove = false;
123
24
  isLargeOrAbove = false;
124
25
  isMediumOrAbove = false;
125
26
  }
27
+ const { headerEl } = useContext(AppShellContext);
28
+ const [summaryAnimationState, setSummaryAnimationState] = useState('expanded');
126
29
  const summaryTabId = `summary-${caseId}`;
127
30
  const utilitiesTabId = `utilities-${caseId}`;
128
31
  const persistentUtilityTabId = `persistent-utility-${caseId}`;
129
- const [utilitiesShown, setUtilitiesShown] = useState(isLargeOrAbove);
130
- const [userUtilState, setUserUtilState] = useState();
32
+ const [utilitiesShown, setUtilitiesShown] = useState(isLargeOrAbove && !defaultCollapsedUtilities);
33
+ const initialUserUtilState = defaultCollapsedUtilities ? 'hidden' : undefined;
34
+ const [userUtilState, setUserUtilState] = useState(initialUserUtilState);
35
+ const [summaryPanelCollapsed, setSummaryPanelCollapsed] = useState(false);
131
36
  const hasSideBySideColumns = isMediumOrAbove;
132
37
  const scrollStickOptions = useRef({
133
38
  elements: []
134
39
  });
135
- useScrollStick(hasSideBySideColumns ? scrollStickOptions.current : undefined);
40
+ const getOffsets = () => {
41
+ const appshellHeaderHeight = headerEl?.offsetHeight || 0;
42
+ const summaryHeight = !isMediumOrAbove || (persistentUtility && !isExtraLargeOrAbove) || summaryPanelCollapsed
43
+ ? caseViewSummaryRef?.current?.offsetHeight || 0
44
+ : 0;
45
+ return {
46
+ sticky: appshellHeaderHeight + summaryHeight,
47
+ summary: summaryHeight
48
+ };
49
+ };
50
+ const [offsets, setOffsets] = useState(getOffsets);
51
+ useScrollStick(hasSideBySideColumns ? { ...scrollStickOptions.current, offset: offsets.sticky } : undefined);
136
52
  const toggleUtilities = useCallback((e) => {
137
53
  if (e.type === 'keydown' && e.key !== 'Enter') {
138
54
  return;
@@ -142,6 +58,9 @@ const CaseView = (props) => {
142
58
  return !shown;
143
59
  });
144
60
  }, []);
61
+ useLayoutEffect(() => {
62
+ setOffsets(getOffsets());
63
+ }, [isExtraLargeOrAbove, isLargeOrAbove, isMediumOrAbove, headerEl, summaryPanelCollapsed]);
145
64
  useEffect(() => {
146
65
  if (isLargeOrAbove) {
147
66
  setUtilitiesShown(userUtilState !== 'hidden');
@@ -151,51 +70,88 @@ const CaseView = (props) => {
151
70
  }
152
71
  }, [isLargeOrAbove]);
153
72
  useEffect(() => {
154
- var _a;
155
- if (isMediumOrAbove) {
156
- if (currentTabId === summaryTabId || currentTabId === utilitiesTabId)
157
- onTabClick((_a = tabItemsProp[0]) === null || _a === void 0 ? void 0 : _a.id);
73
+ if (isMediumOrAbove &&
74
+ !summaryPanelCollapsed &&
75
+ !persistentUtility &&
76
+ (currentTabId === summaryTabId || currentTabId === utilitiesTabId)) {
77
+ onTabClick(tabItemsProp[0]?.id);
158
78
  }
159
- }, [isMediumOrAbove, onTabClick, currentTabId, summaryTabId, utilitiesTabId]);
79
+ }, [
80
+ isMediumOrAbove,
81
+ onTabClick,
82
+ currentTabId,
83
+ summaryTabId,
84
+ utilitiesTabId,
85
+ summaryPanelCollapsed
86
+ ]);
160
87
  useEffect(() => {
161
- if (isMediumOrAbove && !isLargeOrAbove && utilities)
88
+ if ((isMediumOrAbove && !isLargeOrAbove && utilities) || persistentUtility)
162
89
  setUtilitiesShown(false);
163
90
  }, [isMediumOrAbove, utilities]);
164
91
  useEffect(() => {
165
- if (isViewPortMediumOrAbove && persistentUtility) {
166
- if (currentTabId === persistentUtilityTabId)
167
- onTabClick(summaryTabId);
168
- }
169
- }, [isViewPortMediumOrAbove, persistentUtility]);
92
+ if (persistentUtility && currentTabId === persistentUtilityTabId)
93
+ onTabClick(summaryTabId);
94
+ }, [persistentUtility]);
170
95
  const tabItems = useMemo(() => {
96
+ const summaryTab = { id: summaryTabId, name: 'Summary' };
171
97
  if (isMediumOrAbove)
172
- return tabItemsProp;
98
+ return summaryPanelCollapsed || (persistentUtility && !isExtraLargeOrAbove)
99
+ ? [summaryTab, ...tabItemsProp]
100
+ : tabItemsProp;
173
101
  const utilityTabs = [];
174
102
  if (utilities)
175
103
  utilityTabs.push({ id: utilitiesTabId, name: 'Utilities' });
176
- if (persistentUtility && !isViewPortMediumOrAbove)
104
+ if (persistentUtility && !isMediumOrAbove)
177
105
  utilityTabs.push({ id: persistentUtilityTabId, name: persistentUtility.title });
178
- return [{ id: summaryTabId, name: 'Summary' }, ...tabItemsProp, ...utilityTabs];
106
+ return [summaryTab, ...tabItemsProp, ...utilityTabs];
179
107
  }, [
180
108
  isMediumOrAbove,
181
- isViewPortMediumOrAbove,
109
+ isExtraLargeOrAbove,
182
110
  summaryTabId,
183
111
  utilitiesTabId,
184
112
  persistentUtilityTabId,
185
113
  utilities,
186
114
  persistentUtility,
187
- tabItemsProp
115
+ tabItemsProp,
116
+ summaryPanelCollapsed
188
117
  ]);
189
- const tabContent = useMemo(() => {
190
- if (currentTabId === summaryTabId)
191
- return _jsx(Card, { children: summary }, void 0);
192
- if (currentTabId === utilitiesTabId) {
193
- return _jsx(Flex, Object.assign({ container: { direction: 'column', gap: 2 } }, { children: utilities }), void 0);
118
+ useEffect(() => {
119
+ if (!tabContentEl)
120
+ return;
121
+ const scrollPos = window.scrollY;
122
+ const windowHeight = document.documentElement.clientHeight;
123
+ const bottomPos = scrollPos + windowHeight * 0.8;
124
+ const tabContentPos = tabContentEl.offsetTop;
125
+ if (tabContentPos > bottomPos) {
126
+ const top = tabContentPos - windowHeight * 0.2;
127
+ window.scrollTo({ top, behavior: 'smooth' });
194
128
  }
195
- if (currentTabId === persistentUtilityTabId)
196
- return persistentUtility === null || persistentUtility === void 0 ? void 0 : persistentUtility.content;
197
- return tabContentProp;
198
- }, [currentTabId, tabContentProp, summary, summaryTabId, utilities, utilitiesTabId]);
129
+ }, [currentTabId]);
130
+ const tabContent = useMemo(() => {
131
+ const summaryTabContent = { id: summaryTabId, content: _jsx(Card, { children: summary }, void 0) };
132
+ if (isMediumOrAbove)
133
+ return summaryPanelCollapsed || (persistentUtility && !isExtraLargeOrAbove)
134
+ ? [summaryTabContent, ...tabContentProp]
135
+ : tabContentProp;
136
+ const utilityTabs = [];
137
+ if (utilities)
138
+ utilityTabs.push({
139
+ id: utilitiesTabId,
140
+ content: _jsx(Flex, { container: { direction: 'column', gap: 2 }, children: utilities }, void 0)
141
+ });
142
+ if (persistentUtility)
143
+ utilityTabs.push({ id: persistentUtilityTabId, content: persistentUtility?.content });
144
+ return [summaryTabContent, ...tabContentProp, ...utilityTabs];
145
+ }, [
146
+ currentTabId,
147
+ tabContentProp,
148
+ summary,
149
+ summaryTabId,
150
+ utilities,
151
+ utilitiesTabId,
152
+ isMediumOrAbove,
153
+ isExtraLargeOrAbove
154
+ ]);
199
155
  const direction = useDirection();
200
156
  const utilitiesIcon = utilitiesShown
201
157
  ? `move-${direction.end}-solid`
@@ -206,57 +162,98 @@ const CaseView = (props) => {
206
162
  rows: 'minmax(0, max-content) auto',
207
163
  areas: '"case-nav" "content"'
208
164
  };
209
- if (!forceMobile) {
210
- if (isLargeOrAbove) {
165
+ let fixedSummaryWidth = '100%';
166
+ if (!forceMobile && !persistentUtility && !summaryPanelCollapsed) {
167
+ fixedSummaryWidth = isLargeOrAbove ? '25rem' : '22rem';
168
+ if (isLargeOrAbove || isMediumOrAbove) {
211
169
  caseViewGridContainer = {
212
- cols: '25rem minmax(0, 1fr) minmax(0, max-content)',
170
+ cols: 'minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content)',
213
171
  colGap: 2,
214
- rows: 'minmax(0, max-content) auto',
172
+ rows: caseViewGridContainer.rows,
215
173
  areas: '"case-nav content utilities"'
216
174
  };
217
175
  }
218
- else if (isMediumOrAbove) {
176
+ }
177
+ else if (summaryPanelCollapsed) {
178
+ if (isLargeOrAbove || isMediumOrAbove) {
219
179
  caseViewGridContainer = {
220
- cols: '22rem minmax(0, 1fr) minmax(0, max-content)',
180
+ cols: 'minmax(0, 1fr) minmax(0, max-content)',
221
181
  colGap: 2,
222
- rows: 'minmax(0, max-content) auto',
223
- areas: '"case-nav content utilities"'
182
+ rows: caseViewGridContainer.rows,
183
+ areas: '"case-nav case-nav" "content utilities"'
184
+ };
185
+ }
186
+ }
187
+ else if (persistentUtility) {
188
+ if (isExtraLargeOrAbove) {
189
+ fixedSummaryWidth = '25rem';
190
+ caseViewGridContainer = {
191
+ cols: 'minmax(0, max-content) minmax(0, 1fr) repeat(2, minmax(0, max-content))',
192
+ colGap: 2,
193
+ rows: caseViewGridContainer.rows,
194
+ areas: '"case-nav content persistentUtility utilities"'
195
+ };
196
+ }
197
+ else if (isLargeOrAbove || isMediumOrAbove) {
198
+ caseViewGridContainer = {
199
+ cols: 'minmax(0, 1fr) repeat(2, minmax(0, max-content))',
200
+ colGap: 2,
201
+ rows: caseViewGridContainer.rows,
202
+ areas: '"case-nav case-nav case-nav" "content persistentUtility utilities"'
224
203
  };
225
204
  }
226
205
  }
227
- return (_jsxs(Grid, Object.assign({ as: StyledCaseView, ref: caseViewRef, container: caseViewGridContainer, item: { area: 'caseView' }, forceMobile: forceMobile, isMediumOrAbove: isMediumOrAbove }, restProps, { children: [_jsx(Grid, Object.assign({ as: StyledSummaryRegion, item: { area: 'case-nav' }, col: true, forceMobile: forceMobile, isMediumOrAbove: isMediumOrAbove }, { children: _jsx(CaseSummary, { ref: caseSummaryRef, caseId: caseId, heading: heading, caseLink: caseLink, icon: icon, followed: followed, onFollowedChange: onFollowedChange, parentCases: parentCases, summary: summary, actions: actions, onEdit: onEdit, tabs: {
206
+ const animateSummaryPanel = (type) => {
207
+ if (type === 'close') {
208
+ const animation = [{ width: fixedSummaryWidth }, { width: 0 }];
209
+ caseViewSummaryContainerRef.current?.animate(animation, 250);
210
+ }
211
+ else {
212
+ const animation = [{ width: 0 }, { width: isLargeOrAbove ? '25rem' : '22rem' }];
213
+ caseViewSummaryContainerRef.current?.animate(animation, 250);
214
+ }
215
+ };
216
+ return (_jsxs(Grid, { as: StyledCaseView, stickyOffset: offsets.sticky, ref: caseViewRef, container: caseViewGridContainer, item: { area: 'caseView' }, forceMobile: forceMobile, isMediumOrAbove: isMediumOrAbove, ...restProps, children: [_jsx(Grid, { as: StyledSummaryRegion, item: { area: 'case-nav' }, forceMobile: forceMobile, desktop: isMediumOrAbove && (!persistentUtility || isExtraLargeOrAbove) && !summaryPanelCollapsed, isLargeOrAbove: isLargeOrAbove, ref: caseViewSummaryContainerRef, style: ['collapsing', 'expanding'].includes(summaryAnimationState)
217
+ ? {
218
+ overflow: 'hidden'
219
+ }
220
+ : undefined, children: _jsx(CaseSummary, { ref: caseViewSummaryRef, headerRef: caseSummaryHeaderRef, caseId: caseId, heading: heading, caseLink: caseLink, icon: icon, followed: followed, onFollowedChange: onFollowedChange, parentCases: parentCases, summary: summary, actions: actions, onEdit: onEdit, tabs: {
228
221
  items: tabItems,
229
222
  onClick: onTabClick,
230
223
  currentTabId
231
- }, forceMobile: forceMobile, isMediumOrAbove: isMediumOrAbove }, void 0) }), void 0),
232
- _jsxs(Grid, Object.assign({ container: {
224
+ }, forceMobile: forceMobile, desktop: ((isMediumOrAbove && !persistentUtility) || isExtraLargeOrAbove) &&
225
+ !summaryPanelCollapsed, fixedWidth: isMediumOrAbove ? fixedSummaryWidth : undefined, collapsible: isMediumOrAbove && !persistentUtility, collapsed: summaryPanelCollapsed, onBeforeCollapse: () => {
226
+ animateSummaryPanel('close');
227
+ }, onAfterCollapse: () => setSummaryPanelCollapsed(true), onBeforeExpand: () => {
228
+ animateSummaryPanel('open');
229
+ setSummaryPanelCollapsed(false);
230
+ }, onAnimationStateChange: setSummaryAnimationState }, void 0) }, void 0), _jsxs(Grid, { container: {
233
231
  cols: 'minmax(0, 1fr)',
234
232
  alignContent: 'start',
235
233
  rowGap: 2
236
- }, item: { area: 'content' }, as: StyledCaseViewContent, forceMobile: forceMobile, isMediumOrAbove: isMediumOrAbove }, { children: [banners && _jsx("div", { children: banners }, void 0),
237
- stages && _jsx("div", { children: stages }, void 0),
238
- tasks && _jsx("div", { children: tasks }, void 0),
239
- !isMediumOrAbove && (_jsx(Tabs, { forwardedAs: StyledMobileTabs, type: 'horizontal', tabs: tabItems, onTabClick: onTabClick, currentTabId: currentTabId }, void 0)),
240
- currentTabId ? _jsx(TabPanel, Object.assign({ tabId: currentTabId }, { children: tabContent }), void 0) : tabContent] }), void 0),
241
- persistentUtility && isViewPortMediumOrAbove && (_jsx(Grid, Object.assign({ as: StyledPersistentUtility, item: { area: 'persistentUtility' } }, { children: _jsx(ScrollStick, { children: persistentUtility.content }, void 0) }), void 0)),
242
- !isLargeOrAbove && (_jsx(Drawer, Object.assign({ as: StyledCaseDrawer, open: utilitiesShown && isMediumOrAbove, position: 'fixed', placement: direction.end, shadow: true, nullWhenClosed: true, hasPersistentUtility: !!persistentUtility }, { children: _jsxs(Flex, Object.assign({ as: StyledCaseDrawerContent, container: { direction: 'column', gap: 2 } }, { children: [_jsx(Flex, Object.assign({ container: { justify: 'end' } }, { children: _jsx(Button, Object.assign({ variant: 'simple', icon: true, onClick: toggleUtilities, as: StyledUtilToggle, "aria-label": t('collapse_noun', t('utilities_panel')) }, { children: _jsx(Icon, { name: `move-${direction.end}-solid` }, void 0) }), void 0) }), void 0),
243
- utilities] }), void 0) }), void 0)),
244
- utilities && isMediumOrAbove && (_jsxs(Grid, Object.assign({ ref: (el) => {
245
- var _a;
234
+ }, item: { area: 'content' }, as: StyledCaseViewContent, forceMobile: forceMobile, isMediumOrAbove: isMediumOrAbove, persistentUtility: Boolean(persistentUtility), style: {
235
+ transform: ['collapsing', 'expanding'].includes(summaryAnimationState)
236
+ ? `translate(0, ${caseSummaryHeaderRef.current?.offsetHeight}px) `
237
+ : undefined,
238
+ marginInlineStart: (summaryPanelCollapsed && isMediumOrAbove) ||
239
+ (persistentUtility && !isExtraLargeOrAbove)
240
+ ? '1rem'
241
+ : 0
242
+ }, children: [banners && _jsx("div", { children: banners }, void 0), stages && _jsx("div", { children: stages }, void 0), tasks && _jsx("div", { children: tasks }, void 0), (!isMediumOrAbove ||
243
+ (persistentUtility && !isExtraLargeOrAbove) ||
244
+ summaryPanelCollapsed) && (_jsx(StyledMobileTabs, { type: 'horizontal', tabs: tabItems, onTabClick: onTabClick, currentTabId: currentTabId }, void 0)), _jsx("div", { ref: setTabContentEl, children: tabContent?.map(({ id, content }) => (_jsx(TabPanel, { currentTabId: currentTabId, tabId: id, children: content }, id))) }, void 0)] }, void 0), persistentUtility && isMediumOrAbove && (_jsx(Grid, { as: StyledPersistentUtility, item: { area: 'persistentUtility' }, children: persistentUtility.content }, void 0)), !isLargeOrAbove && (_jsx(Drawer, { as: StyledCaseDrawer, open: utilitiesShown && isMediumOrAbove, position: 'fixed', placement: direction.end, shadow: true, nullWhenClosed: true, hasPersistentUtility: !!persistentUtility, children: _jsxs(Flex, { as: StyledCaseDrawerContent, container: { direction: 'column', gap: 2 }, children: [_jsx(Flex, { container: { justify: 'end' }, children: _jsx(Button, { variant: 'simple', icon: true, onClick: toggleUtilities, as: StyledUtilToggle, label: t('collapse_utilities_panel'), children: _jsx(Icon, { name: `move-${direction.end}-solid` }, void 0) }, void 0) }, void 0), utilities] }, void 0) }, void 0)), utilities && isMediumOrAbove && (_jsxs(Grid, { ref: (el) => {
246
245
  if (el)
247
- ((_a = scrollStickOptions.current) === null || _a === void 0 ? void 0 : _a.elements).push(el);
246
+ (scrollStickOptions.current?.elements).push(el);
248
247
  }, as: StyledCaseViewUtilities, container: {
249
248
  cols: 'minmax(0, 1fr)',
250
249
  rowGap: 2
251
250
  }, item: {
252
251
  area: 'utilities'
253
- }, utilitiesShown: utilitiesShown && isLargeOrAbove }, { children: [_jsx(Flex, Object.assign({ container: { justify: utilitiesShown ? 'end' : 'center' } }, { children: _jsx(Button, Object.assign({ variant: 'simple', icon: true, onClick: toggleUtilities, as: StyledUtilToggle, label: t(utilitiesShown ? 'collapse_noun' : 'expand_noun', t('utilities_panel')) }, { children: _jsx(Icon, { name: utilitiesIcon }, void 0) }), void 0) }), void 0),
254
- _jsx(Flex, Object.assign({ ref: (el) => {
255
- var _a;
256
- if (el)
257
- ((_a = scrollStickOptions.current) === null || _a === void 0 ? void 0 : _a.elements).push(el);
258
- }, container: utilitiesShown && isLargeOrAbove ? { direction: 'column', gap: 2 } : false, hidden: !utilitiesShown || !isLargeOrAbove }, { children: utilities }), void 0),
259
- (!utilitiesShown || (isMediumOrAbove && !isLargeOrAbove)) && (_jsx(UtilitiesSummary, { items: utilitiesSummaryItems || [], onClick: toggleUtilities, onKeyDown: toggleUtilities }, void 0))] }), void 0))] }), void 0));
252
+ }, utilitiesShown: utilitiesShown && isLargeOrAbove, style: ['collapsing', 'expanding'].includes(summaryAnimationState)
253
+ ? {
254
+ transform: `translate(0, ${caseSummaryHeaderRef.current?.offsetHeight}px) `
255
+ }
256
+ : undefined, children: [_jsx(Flex, { container: { justify: utilitiesShown ? 'end' : 'center' }, children: _jsx(Button, { variant: 'simple', icon: true, onClick: toggleUtilities, as: StyledUtilToggle, label: t(utilitiesShown ? 'collapse_utilities_panel' : 'expand_utilities_panel'), children: _jsx(Icon, { name: utilitiesIcon }, void 0) }, void 0) }, void 0), _jsx(Flex, { container: utilitiesShown && isLargeOrAbove ? { direction: 'column', gap: 2 } : undefined, hidden: !utilitiesShown || !isLargeOrAbove, children: utilities }, void 0), (!utilitiesShown || (isMediumOrAbove && !isLargeOrAbove)) && (_jsx(UtilitiesSummary, { items: utilitiesSummaryItems || [], onClick: toggleUtilities, onKeyDown: toggleUtilities }, void 0))] }, void 0))] }, void 0));
260
257
  };
261
258
  export default CaseView;
262
259
  //# sourceMappingURL=CaseView.js.map