@pega/cosmos-react-work 2.1.6 → 2.1.7

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 (225) hide show
  1. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +33 -0
  2. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -0
  3. package/lib/components/AppAnnouncement/AppAnnouncement.js +91 -0
  4. package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -0
  5. package/lib/components/AppAnnouncement/index.d.ts +3 -0
  6. package/lib/components/AppAnnouncement/index.d.ts.map +1 -0
  7. package/lib/components/AppAnnouncement/index.js +2 -0
  8. package/lib/components/AppAnnouncement/index.js.map +1 -0
  9. package/lib/components/CaseHeader/CaseHeader.d.ts +30 -0
  10. package/lib/components/CaseHeader/CaseHeader.d.ts.map +1 -0
  11. package/lib/components/CaseHeader/CaseHeader.js +119 -0
  12. package/lib/components/CaseHeader/CaseHeader.js.map +1 -0
  13. package/lib/components/CaseHeader/index.d.ts +4 -0
  14. package/lib/components/CaseHeader/index.d.ts.map +1 -0
  15. package/lib/components/CaseHeader/index.js +3 -0
  16. package/lib/components/CaseHeader/index.js.map +1 -0
  17. package/lib/components/CasePreview/CasePreview.d.ts +22 -0
  18. package/lib/components/CasePreview/CasePreview.d.ts.map +1 -0
  19. package/lib/components/CasePreview/CasePreview.js +80 -0
  20. package/lib/components/CasePreview/CasePreview.js.map +1 -0
  21. package/lib/components/CasePreview/index.d.ts +3 -0
  22. package/lib/components/CasePreview/index.d.ts.map +1 -0
  23. package/lib/components/CasePreview/index.js +2 -0
  24. package/lib/components/CasePreview/index.js.map +1 -0
  25. package/lib/components/CaseSummary/CaseSummary.d.ts +36 -0
  26. package/lib/components/CaseSummary/CaseSummary.d.ts.map +1 -0
  27. package/lib/components/CaseSummary/CaseSummary.js +130 -0
  28. package/lib/components/CaseSummary/CaseSummary.js.map +1 -0
  29. package/lib/components/CaseSummary/index.d.ts +4 -0
  30. package/lib/components/CaseSummary/index.d.ts.map +1 -0
  31. package/lib/components/CaseSummary/index.js +3 -0
  32. package/lib/components/CaseSummary/index.js.map +1 -0
  33. package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts +22 -0
  34. package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts.map +1 -0
  35. package/lib/components/CaseSummaryFields/CaseSummaryFields.js +25 -0
  36. package/lib/components/CaseSummaryFields/CaseSummaryFields.js.map +1 -0
  37. package/lib/components/CaseSummaryFields/index.d.ts +4 -0
  38. package/lib/components/CaseSummaryFields/index.d.ts.map +1 -0
  39. package/lib/components/CaseSummaryFields/index.js +3 -0
  40. package/lib/components/CaseSummaryFields/index.js.map +1 -0
  41. package/lib/components/CaseView/CaseView.d.ts +31 -0
  42. package/lib/components/CaseView/CaseView.d.ts.map +1 -0
  43. package/lib/components/CaseView/CaseView.js +259 -0
  44. package/lib/components/CaseView/CaseView.js.map +1 -0
  45. package/lib/components/CaseView/CaseView.styles.d.ts +23 -0
  46. package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -0
  47. package/lib/components/CaseView/CaseView.styles.js +106 -0
  48. package/lib/components/CaseView/CaseView.styles.js.map +1 -0
  49. package/lib/components/CaseView/MobileCaseView.d.ts +13 -0
  50. package/lib/components/CaseView/MobileCaseView.d.ts.map +1 -0
  51. package/lib/components/CaseView/MobileCaseView.js +25 -0
  52. package/lib/components/CaseView/MobileCaseView.js.map +1 -0
  53. package/lib/components/CaseView/UtilitiesSummary.d.ts +12 -0
  54. package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -0
  55. package/lib/components/CaseView/UtilitiesSummary.js +21 -0
  56. package/lib/components/CaseView/UtilitiesSummary.js.map +1 -0
  57. package/lib/components/CaseView/index.d.ts +6 -0
  58. package/lib/components/CaseView/index.d.ts.map +1 -0
  59. package/lib/components/CaseView/index.js +4 -0
  60. package/lib/components/CaseView/index.js.map +1 -0
  61. package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts +4 -0
  62. package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts.map +1 -0
  63. package/lib/components/ConfigurableLayout/ConfigurableLayout.js +93 -0
  64. package/lib/components/ConfigurableLayout/ConfigurableLayout.js.map +1 -0
  65. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts +43 -0
  66. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts.map +1 -0
  67. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.js +2 -0
  68. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.js.map +1 -0
  69. package/lib/components/ConfigurableLayout/LayoutCell.d.ts +6 -0
  70. package/lib/components/ConfigurableLayout/LayoutCell.d.ts.map +1 -0
  71. package/lib/components/ConfigurableLayout/LayoutCell.js +64 -0
  72. package/lib/components/ConfigurableLayout/LayoutCell.js.map +1 -0
  73. package/lib/components/ConfigurableLayout/defaults.d.ts +4 -0
  74. package/lib/components/ConfigurableLayout/defaults.d.ts.map +1 -0
  75. package/lib/components/ConfigurableLayout/defaults.js +4 -0
  76. package/lib/components/ConfigurableLayout/defaults.js.map +1 -0
  77. package/lib/components/ConfigurableLayout/index.d.ts +4 -0
  78. package/lib/components/ConfigurableLayout/index.d.ts.map +1 -0
  79. package/lib/components/ConfigurableLayout/index.js +3 -0
  80. package/lib/components/ConfigurableLayout/index.js.map +1 -0
  81. package/lib/components/ConfigurableLayout/options.d.ts +10 -0
  82. package/lib/components/ConfigurableLayout/options.d.ts.map +1 -0
  83. package/lib/components/ConfigurableLayout/options.js +10 -0
  84. package/lib/components/ConfigurableLayout/options.js.map +1 -0
  85. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts +7 -0
  86. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts.map +1 -0
  87. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.js +37 -0
  88. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.js.map +1 -0
  89. package/lib/components/Confirmation/Confirmation.d.ts +19 -0
  90. package/lib/components/Confirmation/Confirmation.d.ts.map +1 -0
  91. package/lib/components/Confirmation/Confirmation.js +14 -0
  92. package/lib/components/Confirmation/Confirmation.js.map +1 -0
  93. package/lib/components/Confirmation/index.d.ts +3 -0
  94. package/lib/components/Confirmation/index.d.ts.map +1 -0
  95. package/lib/components/Confirmation/index.js +2 -0
  96. package/lib/components/Confirmation/index.js.map +1 -0
  97. package/lib/components/Details/Details.d.ts +13 -0
  98. package/lib/components/Details/Details.d.ts.map +1 -0
  99. package/lib/components/Details/Details.js +38 -0
  100. package/lib/components/Details/Details.js.map +1 -0
  101. package/lib/components/Details/index.d.ts +4 -0
  102. package/lib/components/Details/index.d.ts.map +1 -0
  103. package/lib/components/Details/index.js +3 -0
  104. package/lib/components/Details/index.js.map +1 -0
  105. package/lib/components/Glimpse/Glimpse.d.ts +20 -0
  106. package/lib/components/Glimpse/Glimpse.d.ts.map +1 -0
  107. package/lib/components/Glimpse/Glimpse.js +22 -0
  108. package/lib/components/Glimpse/Glimpse.js.map +1 -0
  109. package/lib/components/Glimpse/index.d.ts +3 -0
  110. package/lib/components/Glimpse/index.d.ts.map +1 -0
  111. package/lib/components/Glimpse/index.js +3 -0
  112. package/lib/components/Glimpse/index.js.map +1 -0
  113. package/lib/components/SearchResults/Filter.d.ts +8 -0
  114. package/lib/components/SearchResults/Filter.d.ts.map +1 -0
  115. package/lib/components/SearchResults/Filter.js +45 -0
  116. package/lib/components/SearchResults/Filter.js.map +1 -0
  117. package/lib/components/SearchResults/SearchResult.d.ts +4 -0
  118. package/lib/components/SearchResults/SearchResult.d.ts.map +1 -0
  119. package/lib/components/SearchResults/SearchResult.js +21 -0
  120. package/lib/components/SearchResults/SearchResult.js.map +1 -0
  121. package/lib/components/SearchResults/SearchResults.d.ts +6 -0
  122. package/lib/components/SearchResults/SearchResults.d.ts.map +1 -0
  123. package/lib/components/SearchResults/SearchResults.js +102 -0
  124. package/lib/components/SearchResults/SearchResults.js.map +1 -0
  125. package/lib/components/SearchResults/SearchResults.styles.d.ts +8 -0
  126. package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -0
  127. package/lib/components/SearchResults/SearchResults.styles.js +67 -0
  128. package/lib/components/SearchResults/SearchResults.styles.js.map +1 -0
  129. package/lib/components/SearchResults/SearchResults.types.d.ts +96 -0
  130. package/lib/components/SearchResults/SearchResults.types.d.ts.map +1 -0
  131. package/lib/components/SearchResults/SearchResults.types.js +2 -0
  132. package/lib/components/SearchResults/SearchResults.types.js.map +1 -0
  133. package/lib/components/SearchResults/index.d.ts +3 -0
  134. package/lib/components/SearchResults/index.d.ts.map +1 -0
  135. package/lib/components/SearchResults/index.js +2 -0
  136. package/lib/components/SearchResults/index.js.map +1 -0
  137. package/lib/components/Stages/Stages.d.ts +6 -0
  138. package/lib/components/Stages/Stages.d.ts.map +1 -0
  139. package/lib/components/Stages/Stages.js +129 -0
  140. package/lib/components/Stages/Stages.js.map +1 -0
  141. package/lib/components/Stages/Stages.styles.d.ts +16 -0
  142. package/lib/components/Stages/Stages.styles.d.ts.map +1 -0
  143. package/lib/components/Stages/Stages.styles.js +280 -0
  144. package/lib/components/Stages/Stages.styles.js.map +1 -0
  145. package/lib/components/Stages/Stages.types.d.ts +23 -0
  146. package/lib/components/Stages/Stages.types.d.ts.map +1 -0
  147. package/lib/components/Stages/Stages.types.js +2 -0
  148. package/lib/components/Stages/Stages.types.js.map +1 -0
  149. package/lib/components/Stages/Steps.d.ts +8 -0
  150. package/lib/components/Stages/Steps.d.ts.map +1 -0
  151. package/lib/components/Stages/Steps.js +12 -0
  152. package/lib/components/Stages/Steps.js.map +1 -0
  153. package/lib/components/Stages/StepsContainer.d.ts +8 -0
  154. package/lib/components/Stages/StepsContainer.d.ts.map +1 -0
  155. package/lib/components/Stages/StepsContainer.js +11 -0
  156. package/lib/components/Stages/StepsContainer.js.map +1 -0
  157. package/lib/components/Stages/index.d.ts +3 -0
  158. package/lib/components/Stages/index.d.ts.map +1 -0
  159. package/lib/components/Stages/index.js +2 -0
  160. package/lib/components/Stages/index.js.map +1 -0
  161. package/lib/components/Stakeholders/StakeholderForm.d.ts +7 -0
  162. package/lib/components/Stakeholders/StakeholderForm.d.ts.map +1 -0
  163. package/lib/components/Stakeholders/StakeholderForm.js +49 -0
  164. package/lib/components/Stakeholders/StakeholderForm.js.map +1 -0
  165. package/lib/components/Stakeholders/Stakeholders.d.ts +6 -0
  166. package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -0
  167. package/lib/components/Stakeholders/Stakeholders.js +215 -0
  168. package/lib/components/Stakeholders/Stakeholders.js.map +1 -0
  169. package/lib/components/Stakeholders/Stakeholders.types.d.ts +83 -0
  170. package/lib/components/Stakeholders/Stakeholders.types.d.ts.map +1 -0
  171. package/lib/components/Stakeholders/Stakeholders.types.js +2 -0
  172. package/lib/components/Stakeholders/Stakeholders.types.js.map +1 -0
  173. package/lib/components/Stakeholders/index.d.ts +3 -0
  174. package/lib/components/Stakeholders/index.d.ts.map +1 -0
  175. package/lib/components/Stakeholders/index.js +2 -0
  176. package/lib/components/Stakeholders/index.js.map +1 -0
  177. package/lib/components/Tags/Tags.d.ts +34 -0
  178. package/lib/components/Tags/Tags.d.ts.map +1 -0
  179. package/lib/components/Tags/Tags.js +227 -0
  180. package/lib/components/Tags/Tags.js.map +1 -0
  181. package/lib/components/Tags/index.d.ts +2 -0
  182. package/lib/components/Tags/index.d.ts.map +1 -0
  183. package/lib/components/Tags/index.js +2 -0
  184. package/lib/components/Tags/index.js.map +1 -0
  185. package/lib/components/Tasks/TaskList.d.ts +25 -0
  186. package/lib/components/Tasks/TaskList.d.ts.map +1 -0
  187. package/lib/components/Tasks/TaskList.js +25 -0
  188. package/lib/components/Tasks/TaskList.js.map +1 -0
  189. package/lib/components/Tasks/Tasks.d.ts +22 -0
  190. package/lib/components/Tasks/Tasks.d.ts.map +1 -0
  191. package/lib/components/Tasks/Tasks.js +35 -0
  192. package/lib/components/Tasks/Tasks.js.map +1 -0
  193. package/lib/components/Tasks/index.d.ts +6 -0
  194. package/lib/components/Tasks/index.d.ts.map +1 -0
  195. package/lib/components/Tasks/index.js +3 -0
  196. package/lib/components/Tasks/index.js.map +1 -0
  197. package/lib/components/Timeline/Timeline.d.ts +6 -0
  198. package/lib/components/Timeline/Timeline.d.ts.map +1 -0
  199. package/lib/components/Timeline/Timeline.js +24 -0
  200. package/lib/components/Timeline/Timeline.js.map +1 -0
  201. package/lib/components/Timeline/Timeline.styles.d.ts +22 -0
  202. package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -0
  203. package/lib/components/Timeline/Timeline.styles.js +183 -0
  204. package/lib/components/Timeline/Timeline.styles.js.map +1 -0
  205. package/lib/components/Timeline/Timeline.types.d.ts +45 -0
  206. package/lib/components/Timeline/Timeline.types.d.ts.map +1 -0
  207. package/lib/components/Timeline/Timeline.types.js +2 -0
  208. package/lib/components/Timeline/Timeline.types.js.map +1 -0
  209. package/lib/components/Timeline/TimelineItem.d.ts +13 -0
  210. package/lib/components/Timeline/TimelineItem.d.ts.map +1 -0
  211. package/lib/components/Timeline/TimelineItem.js +21 -0
  212. package/lib/components/Timeline/TimelineItem.js.map +1 -0
  213. package/lib/components/Timeline/index.d.ts +3 -0
  214. package/lib/components/Timeline/index.d.ts.map +1 -0
  215. package/lib/components/Timeline/index.js +2 -0
  216. package/lib/components/Timeline/index.js.map +1 -0
  217. package/lib/components/Timeline/utils.d.ts +14 -0
  218. package/lib/components/Timeline/utils.d.ts.map +1 -0
  219. package/lib/components/Timeline/utils.js +63 -0
  220. package/lib/components/Timeline/utils.js.map +1 -0
  221. package/lib/index.d.ts +33 -0
  222. package/lib/index.d.ts.map +1 -0
  223. package/lib/index.js +34 -0
  224. package/lib/index.js.map +1 -0
  225. package/package.json +2 -2
@@ -0,0 +1,130 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useState, useEffect, useRef } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { Flex, Tabs, ExpandCollapse, defaultThemeProp, useConsolidatedRef, Icon, registerIcon, useI18n, useFocusWithin, Button, StyledIcon } from '@pega/cosmos-react-core';
5
+ import * as arrowMicroLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-micro-left.icon';
6
+ import CaseHeader from '../CaseHeader';
7
+ registerIcon(arrowMicroLeftIcon);
8
+ export const StyledCaseSummary = styled.div(({ theme, expanded, fixedWidth }) => {
9
+ return css `
10
+ position: relative;
11
+ width: ${fixedWidth || 'auto'};
12
+ max-width: ${fixedWidth ? 'none' : '100%'};
13
+ height: 100%;
14
+
15
+ ${expanded &&
16
+ css `
17
+ @media (min-width: ${theme.base.breakpoints.md}) {
18
+ &:hover {
19
+ &::after {
20
+ content: '';
21
+ position: absolute;
22
+ top: 0;
23
+ bottom: 0;
24
+ inset-inline-start: 100%;
25
+ width: 0.75rem;
26
+ }
27
+ }
28
+ }
29
+ `}
30
+ `;
31
+ });
32
+ export const StyledCaseSummaryInfo = styled.div `
33
+ overflow: auto;
34
+ flex: 1;
35
+ `;
36
+ const StyledExpandCollapse = styled.div(({ animationState }) => {
37
+ const expandingOrCollapsing = ['expanding', 'collapsing'].includes(animationState);
38
+ return css `
39
+ position: ${expandingOrCollapsing ? 'fixed' : 'relative'};
40
+ top: ${expandingOrCollapsing ? 'var(--appshell-offset, 0)' : 0};
41
+ `;
42
+ });
43
+ const StyledExpandCollapseButton = styled(Button)(({ theme, expanded, headerHeight, animationState, visible }) => {
44
+ return css `
45
+ border-radius: ${expanded ? '1.5rem' : '0 1.5rem 1.5rem 0'};
46
+ box-shadow: ${theme.base.shadow.low};
47
+ border: none;
48
+ opacity: ${visible ? '1' : '0'};
49
+ position: ${animationState === 'collapsing' ? 'fixed' : 'absolute'};
50
+ inset-inline-start: ${expanded ? 'calc(100% - 0.75rem)' : 0};
51
+ top: calc(calc(${headerHeight}px / 2) - 0.75rem);
52
+ z-index: 1;
53
+
54
+ ${StyledIcon} {
55
+ width: 1.5rem;
56
+ height: 1.5rem;
57
+ transform: rotate(${expanded ? '0' : '180deg'});
58
+ }
59
+ `;
60
+ });
61
+ StyledExpandCollapseButton.defaultProps = defaultThemeProp;
62
+ const CaseSummary = forwardRef((props, ref) => {
63
+ const { icon, heading, caseId, caseLink, parentCases, followed, onFollowedChange, actions, onEdit, summary, tabs, forceMobile, collapsible = false, desktop = true, fixedWidth, onBeforeCollapse, onAfterCollapse, onBeforeExpand, onAfterExpand, onAnimationStateChange, headerRef: caseSummaryHeaderRef, ...restProps } = props;
64
+ const [showExpandCollapse, setShowExpandCollapse] = useState(false);
65
+ const expandCollapseBtnRef = useRef(null);
66
+ const [expanded, setExpanded] = useState(true);
67
+ const isMediumOrAbove = !forceMobile && desktop;
68
+ const [animationState, setAnimationState] = useState('expanded');
69
+ const [collapsedHeight, setCollapsedHeight] = useState(0);
70
+ const caseSummaryRef = useConsolidatedRef(ref);
71
+ const focusWithin = useFocusWithin([caseSummaryRef.current]);
72
+ const t = useI18n();
73
+ const setAnimStateAndUpdateParent = (state) => {
74
+ setAnimationState(state);
75
+ onAnimationStateChange?.(state);
76
+ };
77
+ const headerRef = useConsolidatedRef(caseSummaryHeaderRef);
78
+ const showTabs = (isMediumOrAbove && tabs.items.length > 1) || !isMediumOrAbove;
79
+ const caseHeaderProps = {
80
+ actions,
81
+ onEdit,
82
+ isMediumOrAbove,
83
+ caseId,
84
+ parentCases,
85
+ heading,
86
+ caseLink,
87
+ icon,
88
+ followed,
89
+ onFollowedChange,
90
+ style: {
91
+ maxHeight: ['expanding', 'collapsed', 'collapsing'].includes(animationState)
92
+ ? `${collapsedHeight}px`
93
+ : 'auto'
94
+ }
95
+ };
96
+ useEffect(() => {
97
+ if (['expanded'].includes(animationState)) {
98
+ setCollapsedHeight(headerRef.current?.offsetHeight || 0);
99
+ }
100
+ }, [animationState, headerRef.current]);
101
+ const expandOrCollapseLabel = expanded ? t('collapse') : t('expand');
102
+ const expandOrCollapseA11y = expanded ? t('collapse_summary_panel') : t('expand_summary_panel');
103
+ return (_jsxs(Flex, { as: StyledCaseSummary, expanded: expanded, fixedWidth: fixedWidth, container: { direction: 'column' }, item: { shrink: 0 }, ref: caseSummaryRef, style: {
104
+ marginTop: ['collapsing', 'expanding'].includes(animationState)
105
+ ? `${collapsedHeight}px`
106
+ : 0
107
+ }, onMouseEnter: () => {
108
+ setShowExpandCollapse(true);
109
+ }, onMouseLeave: () => {
110
+ setShowExpandCollapse(false);
111
+ }, ...restProps, children: [collapsible ? (_jsxs(_Fragment, { children: [_jsx(StyledExpandCollapseButton, { onClick: () => setExpanded(!expanded), expanded: expanded, headerHeight: collapsedHeight, animationState: animationState, label: ['expanded', 'collapsed'].includes(animationState)
112
+ ? expandOrCollapseLabel
113
+ : undefined, "aria-label": ['expanding', 'collapsing'].includes(animationState)
114
+ ? expandOrCollapseA11y
115
+ : undefined, visible: showExpandCollapse || !expanded || focusWithin, tabIndex: 0, icon: true, compact: true, ref: expandCollapseBtnRef, children: _jsx(Icon, { name: 'arrow-micro-left' }, void 0) }, void 0), _jsx(ExpandCollapse, { dimension: 'width', min: isMediumOrAbove || !expanded ? fixedWidth : '100%', max: '100%', collapsed: expanded, onBeforeExpand: () => {
116
+ setAnimStateAndUpdateParent('collapsing');
117
+ onBeforeCollapse?.();
118
+ }, onAfterExpand: () => {
119
+ setAnimStateAndUpdateParent('collapsed');
120
+ onAfterCollapse?.();
121
+ }, onBeforeCollapse: () => {
122
+ setAnimStateAndUpdateParent('expanding');
123
+ onBeforeExpand?.();
124
+ }, onAfterCollapse: () => {
125
+ setAnimStateAndUpdateParent('expanded');
126
+ onAfterExpand?.();
127
+ }, as: StyledExpandCollapse, animationState: animationState, ref: headerRef, children: _jsx(CaseHeader, { ...caseHeaderProps }, void 0) }, void 0)] }, void 0)) : (_jsx(CaseHeader, { ...caseHeaderProps }, void 0)), _jsxs(StyledCaseSummaryInfo, { children: [isMediumOrAbove && summary, showTabs && isMediumOrAbove && (_jsx(Tabs, { type: 'vertical', tabs: tabs.items, onTabClick: tabs.onClick, currentTabId: tabs.currentTabId }, void 0))] }, void 0)] }, void 0));
128
+ });
129
+ export default CaseSummary;
130
+ //# sourceMappingURL=CaseSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaseSummary.js","sourceRoot":"","sources":["../../../src/components/CaseSummary/CaseSummary.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAMV,QAAQ,EACR,SAAS,EACT,MAAM,EACP,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,IAAI,EAGJ,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,cAAc,EACd,MAAM,EACN,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,kBAAkB,MAAM,yEAAyE,CAAC;AAE9G,OAAO,UAA+B,MAAM,eAAe,CAAC;AAE5D,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAuCjC,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CACzC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;IAClC,OAAO,GAAG,CAAA;;eAEC,UAAU,IAAI,MAAM;mBAChB,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;;;QAGvC,QAAQ;QACV,GAAG,CAAA;6BACoB,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;;;;;;;;;;;;OAY/C;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAG9C,CAAC;AAEF,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CACrC,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE;IACrB,MAAM,qBAAqB,GAAG,CAAC,WAAW,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AAE,EAAE,CAAC;wBACpB,CAAC,EACD,EAAE,EAAE,oBAAoB,EACxB,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,SAAS,YAEd,KAAC,UAAU,OAAK,eAAe,WAAI,WACpB,YAChB,CACJ,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,OAAK,eAAe,WAAI,CACpC,EACD,MAAC,qBAAqB,eACnB,eAAe,IAAI,OAAO,EAE1B,QAAQ,IAAI,eAAe,IAAI,CAC9B,KAAC,IAAI,IACH,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,IAAI,CAAC,KAAK,EAChB,UAAU,EAAE,IAAI,CAAC,OAAO,EACxB,YAAY,EAAE,IAAI,CAAC,YAAY,WAC/B,CACH,YACqB,YACnB,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n ReactNode,\n Ref,\n MouseEvent,\n useState,\n useEffect,\n useRef\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Tabs,\n Tab,\n ForwardProps,\n ExpandCollapse,\n defaultThemeProp,\n useConsolidatedRef,\n Icon,\n registerIcon,\n useI18n,\n useFocusWithin,\n Button,\n StyledIcon\n} from '@pega/cosmos-react-core';\nimport * as arrowMicroLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-micro-left.icon';\n\nimport CaseHeader, { CaseHeaderProps } from '../CaseHeader';\n\nregisterIcon(arrowMicroLeftIcon);\n\nexport interface CaseSummaryProps extends CaseHeaderProps {\n /** A region to display any summary information about the CaseView. */\n summary: ReactNode;\n /** An object handling the rendering and functionality of the Tabs in CaseSummary. */\n tabs: {\n items: Tab[];\n onClick: (id: string, event?: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;\n currentTabId: string;\n };\n /**\n * Forces rendering in the mobile layout, regardless of screen size.\n * @internal\n */\n forceMobile?: boolean;\n /**\n * Indicator for a desktop size.\n * @internal\n */\n desktop?: boolean;\n /** The fixed width string is needed for the expandable and collapsible header. */\n fixedWidth?: string;\n /** A boolean that toggles the collapsible feature of the case summary. */\n collapsible?: boolean;\n onBeforeCollapse?: () => void;\n onAfterCollapse?: () => void;\n onBeforeExpand?: () => void;\n onAfterExpand?: () => void;\n /** A callback that will return the animation state of the case summary. */\n onAnimationStateChange?: (state: AnimationState) => void;\n /** Ref for the header element inside the Case Summary */\n headerRef?: Ref<HTMLDivElement>;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\ntype AnimationState = 'expanding' | 'expanded' | 'collapsing' | 'collapsed';\n\nexport const StyledCaseSummary = styled.div<{ expanded?: boolean; fixedWidth?: string }>(\n ({ theme, expanded, fixedWidth }) => {\n return css`\n position: relative;\n width: ${fixedWidth || 'auto'};\n max-width: ${fixedWidth ? 'none' : '100%'};\n height: 100%;\n\n ${expanded &&\n css`\n @media (min-width: ${theme.base.breakpoints.md}) {\n &:hover {\n &::after {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n inset-inline-start: 100%;\n width: 0.75rem;\n }\n }\n }\n `}\n `;\n }\n);\n\nexport const StyledCaseSummaryInfo = styled.div`\n overflow: auto;\n flex: 1;\n`;\n\nconst StyledExpandCollapse = styled.div<{ animationState: AnimationState }>(\n ({ animationState }) => {\n const expandingOrCollapsing = ['expanding', 'collapsing'].includes(animationState);\n return css`\n position: ${expandingOrCollapsing ? 'fixed' : 'relative'};\n top: ${expandingOrCollapsing ? 'var(--appshell-offset, 0)' : 0};\n `;\n }\n);\n\nconst StyledExpandCollapseButton = styled(Button)<{\n expanded: boolean;\n headerHeight: number;\n animationState: AnimationState;\n visible: boolean;\n}>(({ theme, expanded, headerHeight, animationState, visible }) => {\n return css`\n border-radius: ${expanded ? '1.5rem' : '0 1.5rem 1.5rem 0'};\n box-shadow: ${theme.base.shadow.low};\n border: none;\n opacity: ${visible ? '1' : '0'};\n position: ${animationState === 'collapsing' ? 'fixed' : 'absolute'};\n inset-inline-start: ${expanded ? 'calc(100% - 0.75rem)' : 0};\n top: calc(calc(${headerHeight}px / 2) - 0.75rem);\n z-index: 1;\n\n ${StyledIcon} {\n width: 1.5rem;\n height: 1.5rem;\n transform: rotate(${expanded ? '0' : '180deg'});\n }\n `;\n});\n\nStyledExpandCollapseButton.defaultProps = defaultThemeProp;\n\nconst CaseSummary: FunctionComponent<CaseSummaryProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<CaseSummaryProps>, ref: CaseSummaryProps['ref']) => {\n const {\n icon,\n heading,\n caseId,\n caseLink,\n parentCases,\n followed,\n onFollowedChange,\n actions,\n onEdit,\n summary,\n tabs,\n forceMobile,\n collapsible = false,\n desktop = true,\n fixedWidth,\n onBeforeCollapse,\n onAfterCollapse,\n onBeforeExpand,\n onAfterExpand,\n onAnimationStateChange,\n headerRef: caseSummaryHeaderRef,\n ...restProps\n } = props;\n\n const [showExpandCollapse, setShowExpandCollapse] = useState(false);\n const expandCollapseBtnRef = useRef<HTMLButtonElement>(null);\n const [expanded, setExpanded] = useState(true);\n const isMediumOrAbove = !forceMobile && desktop;\n const [animationState, setAnimationState] = useState('expanded');\n const [collapsedHeight, setCollapsedHeight] = useState(0);\n const caseSummaryRef = useConsolidatedRef(ref);\n const focusWithin = useFocusWithin<HTMLDivElement>([caseSummaryRef.current]);\n const t = useI18n();\n\n const setAnimStateAndUpdateParent = (state: AnimationState) => {\n setAnimationState(state);\n onAnimationStateChange?.(state);\n };\n\n const headerRef = useConsolidatedRef<HTMLDivElement>(caseSummaryHeaderRef);\n\n const showTabs = (isMediumOrAbove && tabs.items.length > 1) || !isMediumOrAbove;\n\n const caseHeaderProps = {\n actions,\n onEdit,\n isMediumOrAbove,\n caseId,\n parentCases,\n heading,\n caseLink,\n icon,\n followed,\n onFollowedChange,\n style: {\n maxHeight: ['expanding', 'collapsed', 'collapsing'].includes(animationState)\n ? `${collapsedHeight}px`\n : 'auto'\n }\n };\n\n useEffect(() => {\n if (['expanded'].includes(animationState)) {\n setCollapsedHeight(headerRef.current?.offsetHeight || 0);\n }\n }, [animationState, headerRef.current]);\n\n const expandOrCollapseLabel = expanded ? t('collapse') : t('expand');\n const expandOrCollapseA11y = expanded ? t('collapse_summary_panel') : t('expand_summary_panel');\n\n return (\n <Flex\n as={StyledCaseSummary}\n expanded={expanded}\n fixedWidth={fixedWidth}\n container={{ direction: 'column' }}\n item={{ shrink: 0 }}\n ref={caseSummaryRef}\n style={{\n marginTop: ['collapsing', 'expanding'].includes(animationState)\n ? `${collapsedHeight}px`\n : 0\n }}\n onMouseEnter={() => {\n setShowExpandCollapse(true);\n }}\n onMouseLeave={() => {\n setShowExpandCollapse(false);\n }}\n {...restProps}\n >\n {collapsible ? (\n <>\n <StyledExpandCollapseButton\n onClick={() => setExpanded(!expanded)}\n expanded={expanded}\n headerHeight={collapsedHeight}\n animationState={animationState}\n label={\n ['expanded', 'collapsed'].includes(animationState)\n ? expandOrCollapseLabel\n : undefined\n }\n aria-label={\n ['expanding', 'collapsing'].includes(animationState)\n ? expandOrCollapseA11y\n : undefined\n }\n visible={showExpandCollapse || !expanded || focusWithin}\n tabIndex={0}\n icon\n compact\n ref={expandCollapseBtnRef}\n >\n <Icon name='arrow-micro-left' />\n </StyledExpandCollapseButton>\n <ExpandCollapse\n dimension='width'\n min={isMediumOrAbove || !expanded ? fixedWidth : '100%'}\n max='100%'\n collapsed={expanded}\n onBeforeExpand={() => {\n setAnimStateAndUpdateParent('collapsing');\n onBeforeCollapse?.();\n }}\n onAfterExpand={() => {\n setAnimStateAndUpdateParent('collapsed');\n onAfterCollapse?.();\n }}\n onBeforeCollapse={() => {\n setAnimStateAndUpdateParent('expanding');\n onBeforeExpand?.();\n }}\n onAfterCollapse={() => {\n setAnimStateAndUpdateParent('expanded');\n onAfterExpand?.();\n }}\n as={StyledExpandCollapse}\n animationState={animationState}\n ref={headerRef}\n >\n <CaseHeader {...caseHeaderProps} />\n </ExpandCollapse>\n </>\n ) : (\n <CaseHeader {...caseHeaderProps} />\n )}\n <StyledCaseSummaryInfo>\n {isMediumOrAbove && summary}\n\n {showTabs && isMediumOrAbove && (\n <Tabs\n type='vertical'\n tabs={tabs.items}\n onTabClick={tabs.onClick}\n currentTabId={tabs.currentTabId}\n />\n )}\n </StyledCaseSummaryInfo>\n </Flex>\n );\n }\n);\n\nexport default CaseSummary;\n"]}
@@ -0,0 +1,4 @@
1
+ export { default } from './CaseSummary';
2
+ export { CaseSummaryProps } from './CaseSummary';
3
+ export { StyledCaseSummary } from './CaseSummary';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CaseSummary/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default } from './CaseSummary';
2
+ export { StyledCaseSummary } from './CaseSummary';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CaseSummary/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { default } from './CaseSummary';\nexport { CaseSummaryProps } from './CaseSummary';\nexport { StyledCaseSummary } from './CaseSummary';\n"]}
@@ -0,0 +1,22 @@
1
+ import { ReactNode, FunctionComponent, Ref } from 'react';
2
+ import { ForwardProps } from '@pega/cosmos-react-core';
3
+ export declare const StyledCaseSummaryFields: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
4
+ export interface CaseSummaryFieldsProps {
5
+ /** The primary summary fields to display above secondary fields. */
6
+ primaryFields: {
7
+ id?: string;
8
+ name: string;
9
+ value: ReactNode;
10
+ }[];
11
+ /** The secondary summary fields to display below primary fields. */
12
+ secondaryFields: {
13
+ id?: string;
14
+ name: string;
15
+ value: ReactNode;
16
+ }[];
17
+ /** Ref for the wrapping element. */
18
+ ref?: Ref<HTMLDivElement>;
19
+ }
20
+ declare const CaseSummaryFields: FunctionComponent<CaseSummaryFieldsProps & ForwardProps>;
21
+ export default CaseSummaryFields;
22
+ //# sourceMappingURL=CaseSummaryFields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaseSummaryFields.d.ts","sourceRoot":"","sources":["../../../src/components/CaseSummaryFields/CaseSummaryFields.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAOL,YAAY,EAEb,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,uBAAuB,yGAelC,CAAC;AAIH,MAAM,WAAW,sBAAsB;IACrC,oEAAoE;IACpE,aAAa,EAAE;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,SAAS,CAAC;KAClB,EAAE,CAAC;IACJ,oEAAoE;IACpE,eAAe,EAAE;QACf,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,SAAS,CAAC;KAClB,EAAE,CAAC;IACJ,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,QAAA,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,sBAAsB,GAAG,YAAY,CAY/E,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import styled, { css } from 'styled-components';
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 `
8
+ padding: calc(2 * ${theme.base.spacing});
9
+
10
+ > ${StyledFieldValueList}:first-child {
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
+ }
17
+ }
18
+ `;
19
+ });
20
+ StyledCaseSummaryFields.defaultProps = defaultThemeProp;
21
+ const CaseSummaryFields = forwardRef(({ primaryFields, secondaryFields, ...restProps }, ref) => {
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));
23
+ });
24
+ export default CaseSummaryFields;
25
+ //# sourceMappingURL=CaseSummaryFields.js.map
@@ -0,0 +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,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"]}
@@ -0,0 +1,4 @@
1
+ export { default } from './CaseSummaryFields';
2
+ export { CaseSummaryFieldsProps } from './CaseSummaryFields';
3
+ export { StyledCaseSummaryFields } from './CaseSummaryFields';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CaseSummaryFields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default } from './CaseSummaryFields';
2
+ export { StyledCaseSummaryFields } from './CaseSummaryFields';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CaseSummaryFields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { default } from './CaseSummaryFields';\nexport { CaseSummaryFieldsProps } from './CaseSummaryFields';\nexport { StyledCaseSummaryFields } from './CaseSummaryFields';\n"]}
@@ -0,0 +1,31 @@
1
+ import { ReactNode, FC } from 'react';
2
+ import { ForwardProps } from '@pega/cosmos-react-core';
3
+ import { CaseSummaryProps } from '../CaseSummary';
4
+ import { UtilitiesSummaryProps } from './UtilitiesSummary';
5
+ export interface CaseViewProps extends CaseSummaryProps {
6
+ /** A region to hold a Stages component. */
7
+ stages?: ReactNode;
8
+ /** A region to hold a Tasks component. */
9
+ tasks?: ReactNode;
10
+ /** A region that is used to hold Utility components for example SummaryList. */
11
+ utilities?: ReactNode;
12
+ /** The utilities summary array will be used to render the minimized the utilities card. */
13
+ utilitiesSummaryItems?: UtilitiesSummaryProps['items'];
14
+ /** Collapses the utilities by default on load */
15
+ defaultCollapsedUtilities?: boolean;
16
+ /** A region above the center column to display banners. */
17
+ banners?: ReactNode;
18
+ /** A region to the right reserved for persistent utilities. */
19
+ persistentUtility?: {
20
+ content: ReactNode;
21
+ title: string;
22
+ };
23
+ /** A region within the center column that is controlled by tabs in CaseSummary. */
24
+ tabContent?: {
25
+ content: ReactNode;
26
+ id: string;
27
+ }[];
28
+ }
29
+ declare const CaseView: FC<CaseViewProps & ForwardProps>;
30
+ export default CaseView;
31
+ //# sourceMappingURL=CaseView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaseView.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,EAAE,EAUH,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;AAc7E,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;CACnD;AAED,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,GAAG,YAAY,CA6b9C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,259 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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, Tabs } 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';
7
+ import CaseSummary from '../CaseSummary';
8
+ import UtilitiesSummary from './UtilitiesSummary';
9
+ import { StyledCaseDrawer, StyledCaseDrawerContent, StyledCaseView, StyledCaseViewContent, StyledPersistentUtility, StyledSummaryRegion, StyledCaseViewUtilities, StyledUtilToggle } from './CaseView.styles';
10
+ registerIcon(moveRightSolidIcon, moveLeftSolidIcon);
11
+ const CaseView = (props) => {
12
+ const { caseId, parentCases, heading, caseLink, icon, followed, onFollowedChange, summary, tabs: { currentTabId, items: tabItemsProp, onClick: onTabClick }, stages, tasks, tabContent: tabContentProp = [], utilities, utilitiesSummaryItems, defaultCollapsedUtilities = false, actions, onEdit, banners, persistentUtility, forceMobile, ...restProps } = props;
13
+ const t = useI18n();
14
+ const caseViewRef = useRef(null);
15
+ const caseViewSummaryRef = useRef(null);
16
+ const caseSummaryHeaderRef = useRef(null);
17
+ const caseViewSummaryContainerRef = useRef(null);
18
+ const [tabContentEl, setTabContentEl] = useElement(null);
19
+ let isExtraLargeOrAbove = useBreakpoint('xl', { breakpointRef: caseViewRef });
20
+ let isLargeOrAbove = useBreakpoint('lg', { breakpointRef: caseViewRef });
21
+ let isMediumOrAbove = useBreakpoint('md', { breakpointRef: caseViewRef });
22
+ if (forceMobile) {
23
+ isExtraLargeOrAbove = false;
24
+ isLargeOrAbove = false;
25
+ isMediumOrAbove = false;
26
+ }
27
+ const { headerEl } = useContext(AppShellContext);
28
+ const [summaryAnimationState, setSummaryAnimationState] = useState('expanded');
29
+ const summaryTabId = `summary-${caseId}`;
30
+ const utilitiesTabId = `utilities-${caseId}`;
31
+ const persistentUtilityTabId = `persistent-utility-${caseId}`;
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);
36
+ const hasSideBySideColumns = isMediumOrAbove;
37
+ const scrollStickOptions = useRef({
38
+ elements: []
39
+ });
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);
52
+ const toggleUtilities = useCallback((e) => {
53
+ if (e.type === 'keydown' && e.key !== 'Enter') {
54
+ return;
55
+ }
56
+ setUtilitiesShown(shown => {
57
+ setUserUtilState(shown ? 'hidden' : 'shown');
58
+ return !shown;
59
+ });
60
+ }, []);
61
+ useLayoutEffect(() => {
62
+ setOffsets(getOffsets());
63
+ }, [isExtraLargeOrAbove, isLargeOrAbove, isMediumOrAbove, headerEl, summaryPanelCollapsed]);
64
+ useEffect(() => {
65
+ if (isLargeOrAbove) {
66
+ setUtilitiesShown(userUtilState !== 'hidden');
67
+ }
68
+ else {
69
+ setUtilitiesShown(false);
70
+ }
71
+ }, [isLargeOrAbove]);
72
+ useEffect(() => {
73
+ if (isMediumOrAbove &&
74
+ !summaryPanelCollapsed &&
75
+ !persistentUtility &&
76
+ (currentTabId === summaryTabId || currentTabId === utilitiesTabId)) {
77
+ onTabClick(tabItemsProp[0]?.id);
78
+ }
79
+ }, [
80
+ isMediumOrAbove,
81
+ onTabClick,
82
+ currentTabId,
83
+ summaryTabId,
84
+ utilitiesTabId,
85
+ summaryPanelCollapsed
86
+ ]);
87
+ useEffect(() => {
88
+ if ((isMediumOrAbove && !isLargeOrAbove && utilities) || persistentUtility)
89
+ setUtilitiesShown(false);
90
+ }, [isMediumOrAbove, utilities]);
91
+ useEffect(() => {
92
+ if (persistentUtility && currentTabId === persistentUtilityTabId)
93
+ onTabClick(summaryTabId);
94
+ }, [persistentUtility]);
95
+ const tabItems = useMemo(() => {
96
+ const summaryTab = { id: summaryTabId, name: 'Summary' };
97
+ if (isMediumOrAbove)
98
+ return summaryPanelCollapsed || (persistentUtility && !isExtraLargeOrAbove)
99
+ ? [summaryTab, ...tabItemsProp]
100
+ : tabItemsProp;
101
+ const utilityTabs = [];
102
+ if (utilities)
103
+ utilityTabs.push({ id: utilitiesTabId, name: 'Utilities' });
104
+ if (persistentUtility && !isMediumOrAbove)
105
+ utilityTabs.push({ id: persistentUtilityTabId, name: persistentUtility.title });
106
+ return [summaryTab, ...tabItemsProp, ...utilityTabs];
107
+ }, [
108
+ isMediumOrAbove,
109
+ isExtraLargeOrAbove,
110
+ summaryTabId,
111
+ utilitiesTabId,
112
+ persistentUtilityTabId,
113
+ utilities,
114
+ persistentUtility,
115
+ tabItemsProp,
116
+ summaryPanelCollapsed
117
+ ]);
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' });
128
+ }
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
+ ]);
155
+ const direction = useDirection();
156
+ const utilitiesIcon = utilitiesShown
157
+ ? `move-${direction.end}-solid`
158
+ : `move-${direction.start}-solid`;
159
+ let caseViewGridContainer = {
160
+ cols: 'minmax(0, 1fr)',
161
+ colGap: 0,
162
+ rows: 'minmax(0, max-content) auto',
163
+ areas: '"case-nav" "content"'
164
+ };
165
+ let fixedSummaryWidth = '100%';
166
+ if (!forceMobile && !persistentUtility && !summaryPanelCollapsed) {
167
+ fixedSummaryWidth = isLargeOrAbove ? '25rem' : '22rem';
168
+ if (isLargeOrAbove || isMediumOrAbove) {
169
+ caseViewGridContainer = {
170
+ cols: 'minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content)',
171
+ colGap: 2,
172
+ rows: caseViewGridContainer.rows,
173
+ areas: '"case-nav content utilities"'
174
+ };
175
+ }
176
+ }
177
+ else if (summaryPanelCollapsed) {
178
+ if (isLargeOrAbove || isMediumOrAbove) {
179
+ caseViewGridContainer = {
180
+ cols: 'minmax(0, 1fr) minmax(0, max-content)',
181
+ colGap: 2,
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"'
203
+ };
204
+ }
205
+ }
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: {
221
+ items: tabItems,
222
+ onClick: onTabClick,
223
+ currentTabId
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(Flex, { container: {
231
+ direction: 'column',
232
+ alignContent: 'start',
233
+ rowGap: 2
234
+ }, 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(Tabs, { 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) => {
245
+ if (el)
246
+ (scrollStickOptions.current?.elements).push(el);
247
+ }, as: StyledCaseViewUtilities, container: {
248
+ cols: 'minmax(0, 1fr)',
249
+ rowGap: 2
250
+ }, item: {
251
+ area: 'utilities'
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));
257
+ };
258
+ export default CaseView;
259
+ //# sourceMappingURL=CaseView.js.map