@pega/cosmos-react-work 5.0.0-dev.1.0 → 5.0.0-dev.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +2 -2
  2. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
  3. package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
  4. package/lib/components/Article/Article.d.ts +17 -6
  5. package/lib/components/Article/Article.d.ts.map +1 -1
  6. package/lib/components/Article/Article.js +22 -5
  7. package/lib/components/Article/Article.js.map +1 -1
  8. package/lib/components/Article/ArticleFooter.d.ts +7 -9
  9. package/lib/components/Article/ArticleFooter.d.ts.map +1 -1
  10. package/lib/components/Article/ArticleFooter.js +5 -1
  11. package/lib/components/Article/ArticleFooter.js.map +1 -1
  12. package/lib/components/Article/ArticleMeta.d.ts +2 -6
  13. package/lib/components/Article/ArticleMeta.d.ts.map +1 -1
  14. package/lib/components/Article/ArticleMeta.js +12 -11
  15. package/lib/components/Article/ArticleMeta.js.map +1 -1
  16. package/lib/components/Article/ArticleRating.d.ts +13 -0
  17. package/lib/components/Article/ArticleRating.d.ts.map +1 -0
  18. package/lib/components/Article/ArticleRating.js +43 -0
  19. package/lib/components/Article/ArticleRating.js.map +1 -0
  20. package/lib/components/Article/index.d.ts +2 -0
  21. package/lib/components/Article/index.d.ts.map +1 -1
  22. package/lib/components/Article/index.js +1 -0
  23. package/lib/components/Article/index.js.map +1 -1
  24. package/lib/components/ArticleList/ArticleBuddy.d.ts +9 -0
  25. package/lib/components/ArticleList/ArticleBuddy.d.ts.map +1 -0
  26. package/lib/components/ArticleList/ArticleBuddy.js +68 -0
  27. package/lib/components/ArticleList/ArticleBuddy.js.map +1 -0
  28. package/lib/components/ArticleList/ArticleList.d.ts +3 -3
  29. package/lib/components/ArticleList/ArticleList.d.ts.map +1 -1
  30. package/lib/components/ArticleList/ArticleList.js +19 -12
  31. package/lib/components/ArticleList/ArticleList.js.map +1 -1
  32. package/lib/components/ArticleList/ArticleList.types.d.ts +60 -6
  33. package/lib/components/ArticleList/ArticleList.types.d.ts.map +1 -1
  34. package/lib/components/ArticleList/ArticleList.types.js +6 -1
  35. package/lib/components/ArticleList/ArticleList.types.js.map +1 -1
  36. package/lib/components/ArticleList/ArticleListFilter.d.ts +3 -3
  37. package/lib/components/ArticleList/ArticleListFilter.d.ts.map +1 -1
  38. package/lib/components/ArticleList/ArticleListFilter.js.map +1 -1
  39. package/lib/components/ArticleList/ArticleListHeader.d.ts +3 -2
  40. package/lib/components/ArticleList/ArticleListHeader.d.ts.map +1 -1
  41. package/lib/components/ArticleList/ArticleListHeader.js +2 -1
  42. package/lib/components/ArticleList/ArticleListHeader.js.map +1 -1
  43. package/lib/components/ArticleList/ArticleSummary.d.ts +3 -3
  44. package/lib/components/ArticleList/ArticleSummary.d.ts.map +1 -1
  45. package/lib/components/ArticleList/ArticleSummary.js +10 -3
  46. package/lib/components/ArticleList/ArticleSummary.js.map +1 -1
  47. package/lib/components/ArticleList/index.d.ts +2 -0
  48. package/lib/components/ArticleList/index.d.ts.map +1 -1
  49. package/lib/components/ArticleList/index.js +1 -0
  50. package/lib/components/ArticleList/index.js.map +1 -1
  51. package/lib/components/Assignments/Assignments.d.ts +3 -3
  52. package/lib/components/Assignments/Assignments.d.ts.map +1 -1
  53. package/lib/components/Assignments/Assignments.js.map +1 -1
  54. package/lib/components/Assignments/index.d.ts +2 -1
  55. package/lib/components/Assignments/index.d.ts.map +1 -1
  56. package/lib/components/Assignments/index.js.map +1 -1
  57. package/lib/components/CasePreview/CasePreview.d.ts +4 -4
  58. package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
  59. package/lib/components/CasePreview/CasePreview.js.map +1 -1
  60. package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts +1 -1
  61. package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -1
  62. package/lib/components/CaseView/CaseHeader/CaseHeader.js +15 -7
  63. package/lib/components/CaseView/CaseHeader/CaseHeader.js.map +1 -1
  64. package/lib/components/CaseView/CaseHeader/Summary.d.ts +1 -1
  65. package/lib/components/CaseView/CaseHeader/Summary.d.ts.map +1 -1
  66. package/lib/components/CaseView/CaseHeader/Summary.js.map +1 -1
  67. package/lib/components/CaseView/CaseSummary.d.ts +1 -1
  68. package/lib/components/CaseView/CaseSummary.d.ts.map +1 -1
  69. package/lib/components/CaseView/CaseSummary.js.map +1 -1
  70. package/lib/components/CaseView/CaseSummaryFields.d.ts +3 -3
  71. package/lib/components/CaseView/CaseSummaryFields.d.ts.map +1 -1
  72. package/lib/components/CaseView/CaseSummaryFields.js.map +1 -1
  73. package/lib/components/CaseView/CaseView.context.d.ts +1 -1
  74. package/lib/components/CaseView/CaseView.context.d.ts.map +1 -1
  75. package/lib/components/CaseView/CaseView.context.js.map +1 -1
  76. package/lib/components/CaseView/CaseView.d.ts +4 -4
  77. package/lib/components/CaseView/CaseView.d.ts.map +1 -1
  78. package/lib/components/CaseView/CaseView.js +3 -1
  79. package/lib/components/CaseView/CaseView.js.map +1 -1
  80. package/lib/components/CaseView/CaseView.styles.d.ts +1 -2
  81. package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
  82. package/lib/components/CaseView/CaseView.styles.js +1 -22
  83. package/lib/components/CaseView/CaseView.styles.js.map +1 -1
  84. package/lib/components/CaseView/CaseView.test-ids.d.ts +1 -1
  85. package/lib/components/CaseView/CaseView.test-ids.d.ts.map +1 -1
  86. package/lib/components/CaseView/CaseView.test-ids.js +1 -0
  87. package/lib/components/CaseView/CaseView.test-ids.js.map +1 -1
  88. package/lib/components/CaseView/CaseView.types.d.ts +11 -9
  89. package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
  90. package/lib/components/CaseView/CaseView.types.js.map +1 -1
  91. package/lib/components/CaseView/UtilitiesSummary.d.ts +2 -2
  92. package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
  93. package/lib/components/CaseView/UtilitiesSummary.js +42 -10
  94. package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
  95. package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts +9 -0
  96. package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts.map +1 -0
  97. package/lib/components/CaseView/UtilitySummaryItemDialog.js +33 -0
  98. package/lib/components/CaseView/UtilitySummaryItemDialog.js.map +1 -0
  99. package/lib/components/CaseView/index.d.ts +1 -0
  100. package/lib/components/CaseView/index.d.ts.map +1 -1
  101. package/lib/components/CaseView/index.js +1 -0
  102. package/lib/components/CaseView/index.js.map +1 -1
  103. package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts.map +1 -1
  104. package/lib/components/ConfigurableLayout/ConfigurableLayout.js.map +1 -1
  105. package/lib/components/ConfigurableLayout/LayoutCell.d.ts.map +1 -1
  106. package/lib/components/ConfigurableLayout/LayoutCell.js.map +1 -1
  107. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts +1 -1
  108. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts.map +1 -1
  109. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.js.map +1 -1
  110. package/lib/components/Confirmation/Confirmation.d.ts +2 -2
  111. package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
  112. package/lib/components/Confirmation/Confirmation.js.map +1 -1
  113. package/lib/components/Details/Details.d.ts +21 -11
  114. package/lib/components/Details/Details.d.ts.map +1 -1
  115. package/lib/components/Details/Details.js +8 -5
  116. package/lib/components/Details/Details.js.map +1 -1
  117. package/lib/components/Details/Details.styles.d.ts +2 -2
  118. package/lib/components/Details/Details.styles.d.ts.map +1 -1
  119. package/lib/components/Details/Details.styles.js +20 -4
  120. package/lib/components/Details/Details.styles.js.map +1 -1
  121. package/lib/components/Glimpse/Glimpse.d.ts +2 -2
  122. package/lib/components/Glimpse/Glimpse.d.ts.map +1 -1
  123. package/lib/components/Glimpse/Glimpse.js +2 -2
  124. package/lib/components/Glimpse/Glimpse.js.map +1 -1
  125. package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts +2 -2
  126. package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -1
  127. package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
  128. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts +2 -2
  129. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts.map +1 -1
  130. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js.map +1 -1
  131. package/lib/components/InteractionNotification/CountdownButton.d.ts +15 -0
  132. package/lib/components/InteractionNotification/CountdownButton.d.ts.map +1 -0
  133. package/lib/components/InteractionNotification/CountdownButton.js +45 -0
  134. package/lib/components/InteractionNotification/CountdownButton.js.map +1 -0
  135. package/lib/components/InteractionNotification/InteractionNotification.d.ts +35 -0
  136. package/lib/components/InteractionNotification/InteractionNotification.d.ts.map +1 -0
  137. package/lib/components/InteractionNotification/InteractionNotification.js +110 -0
  138. package/lib/components/InteractionNotification/InteractionNotification.js.map +1 -0
  139. package/lib/components/InteractionNotification/index.d.ts +2 -0
  140. package/lib/components/InteractionNotification/index.d.ts.map +1 -0
  141. package/lib/components/InteractionNotification/index.js +2 -0
  142. package/lib/components/InteractionNotification/index.js.map +1 -0
  143. package/lib/components/Predictions/Predictions.d.ts +4 -4
  144. package/lib/components/Predictions/Predictions.d.ts.map +1 -1
  145. package/lib/components/Predictions/Predictions.js.map +1 -1
  146. package/lib/components/Predictions/Predictions.types.d.ts +2 -2
  147. package/lib/components/Predictions/Predictions.types.d.ts.map +1 -1
  148. package/lib/components/Predictions/Predictions.types.js.map +1 -1
  149. package/lib/components/SearchResults/Filter.d.ts +1 -1
  150. package/lib/components/SearchResults/Filter.d.ts.map +1 -1
  151. package/lib/components/SearchResults/Filter.js.map +1 -1
  152. package/lib/components/SearchResults/SearchResult.d.ts +1 -1
  153. package/lib/components/SearchResults/SearchResult.d.ts.map +1 -1
  154. package/lib/components/SearchResults/SearchResult.js.map +1 -1
  155. package/lib/components/SearchResults/SearchResults.d.ts +3 -3
  156. package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
  157. package/lib/components/SearchResults/SearchResults.js.map +1 -1
  158. package/lib/components/SearchResults/SearchResults.types.d.ts +2 -2
  159. package/lib/components/SearchResults/SearchResults.types.d.ts.map +1 -1
  160. package/lib/components/SearchResults/SearchResults.types.js.map +1 -1
  161. package/lib/components/Stages/StageGlimpse.d.ts +2 -2
  162. package/lib/components/Stages/StageGlimpse.d.ts.map +1 -1
  163. package/lib/components/Stages/StageGlimpse.js.map +1 -1
  164. package/lib/components/Stages/Stages.d.ts +2 -2
  165. package/lib/components/Stages/Stages.d.ts.map +1 -1
  166. package/lib/components/Stages/Stages.js +30 -26
  167. package/lib/components/Stages/Stages.js.map +1 -1
  168. package/lib/components/Stages/Stages.styles.d.ts +3 -1
  169. package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
  170. package/lib/components/Stages/Stages.styles.js +78 -61
  171. package/lib/components/Stages/Stages.styles.js.map +1 -1
  172. package/lib/components/Stages/Stages.types.d.ts +2 -2
  173. package/lib/components/Stages/Stages.types.d.ts.map +1 -1
  174. package/lib/components/Stages/Stages.types.js.map +1 -1
  175. package/lib/components/Stakeholders/Stakeholders.d.ts +1 -1
  176. package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
  177. package/lib/components/Stakeholders/Stakeholders.js +48 -33
  178. package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
  179. package/lib/components/Tags/Tags.d.ts +2 -2
  180. package/lib/components/Tags/Tags.d.ts.map +1 -1
  181. package/lib/components/Tags/Tags.js.map +1 -1
  182. package/lib/components/Tasks/TaskList.d.ts +2 -2
  183. package/lib/components/Tasks/TaskList.d.ts.map +1 -1
  184. package/lib/components/Tasks/TaskList.js +10 -1
  185. package/lib/components/Tasks/TaskList.js.map +1 -1
  186. package/lib/components/Tasks/Tasks.d.ts +5 -4
  187. package/lib/components/Tasks/Tasks.d.ts.map +1 -1
  188. package/lib/components/Tasks/Tasks.js +19 -3
  189. package/lib/components/Tasks/Tasks.js.map +1 -1
  190. package/lib/components/Tasks/index.d.ts +4 -2
  191. package/lib/components/Tasks/index.d.ts.map +1 -1
  192. package/lib/components/Tasks/index.js.map +1 -1
  193. package/lib/components/Timeline/Timeline.d.ts +2 -2
  194. package/lib/components/Timeline/Timeline.d.ts.map +1 -1
  195. package/lib/components/Timeline/Timeline.js.map +1 -1
  196. package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
  197. package/lib/components/Timeline/Timeline.styles.js +6 -3
  198. package/lib/components/Timeline/Timeline.styles.js.map +1 -1
  199. package/lib/components/Timeline/Timeline.types.d.ts +4 -4
  200. package/lib/components/Timeline/Timeline.types.d.ts.map +1 -1
  201. package/lib/components/Timeline/Timeline.types.js.map +1 -1
  202. package/lib/components/Timeline/TimelineItem.d.ts +2 -2
  203. package/lib/components/Timeline/TimelineItem.d.ts.map +1 -1
  204. package/lib/components/Timeline/TimelineItem.js.map +1 -1
  205. package/lib/components/Timeline/TimelineToolbar.d.ts +3 -3
  206. package/lib/components/Timeline/TimelineToolbar.d.ts.map +1 -1
  207. package/lib/components/Timeline/TimelineToolbar.js.map +1 -1
  208. package/lib/index.d.ts +1 -0
  209. package/lib/index.d.ts.map +1 -1
  210. package/lib/index.js +1 -0
  211. package/lib/index.js.map +1 -1
  212. package/package.json +12 -18
@@ -1,21 +1,53 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { createElement as _createElement } from "react";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
3
  import styled, { css } from 'styled-components';
3
- import { Card, Count, Flex, Icon, useI18n, VisuallyHiddenText } from '@pega/cosmos-react-core';
4
- export const StyledUtilitiesSummary = styled.div(({ theme }) => {
4
+ import { Button, Card, Count, Flex, Icon, Tooltip, useI18n, VisuallyHiddenText, useElement } from '@pega/cosmos-react-core';
5
+ export const StyledUtilitiesSummary = styled.div(() => {
5
6
  return css `
6
7
  width: 2.75rem;
7
- padding: ${theme.base.spacing} 0;
8
8
  `;
9
9
  });
10
- const UtilitiesSummary = ({ items = [] }) => {
11
- const t = useI18n();
12
- return items.length ? (_jsx(Card, { container: { direction: 'column', alignItems: 'center', gap: 3 }, as: StyledUtilitiesSummary, "aria-label": t('utilities_summary'), role: 'list', children: items.map(item => {
13
- return (_jsxs(Flex, { container: {
10
+ const StyledUtilitySummaryButton = styled(Button)(({ theme }) => css `
11
+ padding-block: ${theme.base.spacing};
12
+ padding-inline: 0;
13
+ width: 100%;
14
+ color: currentColor;
15
+ border-radius: unset;
16
+ border: none;
17
+
18
+ &:hover {
19
+ color: currentColor;
20
+ }
21
+
22
+ &:focus {
23
+ z-index: 1;
24
+ }
25
+
26
+ &:first-child {
27
+ border-start-start-radius: inherit;
28
+ border-start-end-radius: inherit;
29
+ }
30
+
31
+ &:last-child {
32
+ border-end-start-radius: inherit;
33
+ border-end-end-radius: inherit;
34
+ }
35
+
36
+ & + & {
37
+ margin: 0;
38
+ }
39
+ `);
40
+ const UtilitySummary = ({ name, iconName, count, onClick }) => {
41
+ const [utilSummaryTooltip, setUtilSummaryTooltip] = useElement();
42
+ return (_jsxs(_Fragment, { children: [_jsxs(Flex, { container: {
14
43
  direction: 'column',
15
44
  alignItems: 'center',
16
45
  gap: 0.5
17
- }, item: { grow: 1 }, children: [_jsx(Icon, { name: item.iconName }), item.count !== undefined && _jsx(Count, { "aria-hidden": true, children: item.count }), _jsx(VisuallyHiddenText, { role: 'listitem', children: `${item.count ?? ''} ${item.name}` })] }, item.iconName));
18
- }) })) : null;
46
+ }, onClick: onClick, ref: setUtilSummaryTooltip, as: StyledUtilitySummaryButton, children: [_jsx(Icon, { name: iconName }), count !== undefined && _jsx(Count, { "aria-hidden": true, children: count }), _jsx(VisuallyHiddenText, { role: 'listitem', children: `${count ?? ''} ${name}` })] }), _jsx(Tooltip, { target: utilSummaryTooltip, showDelay: 'none', hideDelay: 'none', children: name })] }));
47
+ };
48
+ const UtilitiesSummary = ({ items = [] }) => {
49
+ const t = useI18n();
50
+ return (_jsx(Card, { container: { direction: 'column', alignItems: 'center' }, as: StyledUtilitiesSummary, "aria-label": t('utilities_summary'), role: 'list', children: items.map(item => (_createElement(UtilitySummary, { ...item, key: item.iconName }))) }));
19
51
  };
20
52
  export default UtilitiesSummary;
21
53
  //# sourceMappingURL=UtilitiesSummary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UtilitiesSummary.js","sourceRoot":"","sources":["../../../src/components/CaseView/UtilitiesSummary.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAQ/F,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7D,OAAO,GAAG,CAAA;;eAEG,KAAK,CAAC,IAAI,CAAC,OAAO;GAC9B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAA6C,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,EAAE;IACpF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CACpB,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAChE,EAAE,EAAE,sBAAsB,gBACd,CAAC,CAAC,mBAAmB,CAAC,EAClC,IAAI,EAAC,MAAM,YAEV,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAChB,OAAO,CACL,MAAC,IAAI,IACH,SAAS,EAAE;oBACT,SAAS,EAAE,QAAQ;oBACnB,UAAU,EAAE,QAAQ;oBACpB,GAAG,EAAE,GAAG;iBACT,EACD,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,aAGjB,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,GAAI,EAC5B,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,KAAC,KAAK,mCAAc,IAAI,CAAC,KAAK,GAAS,EACpE,KAAC,kBAAkB,IAAC,IAAI,EAAC,UAAU,YAAE,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,IACtD,IAAI,CAAC,IACP,EAAE,GAAsB,KANnB,IAAI,CAAC,QAAQ,CAOb,CACR,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { FunctionComponent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Card, Count, Flex, Icon, useI18n, VisuallyHiddenText } from '@pega/cosmos-react-core';\n\nimport { CaseViewProps } from './CaseView.types';\n\nexport interface UtilitiesSummaryProps {\n items?: CaseViewProps['utilitiesSummaryItems'];\n}\n\nexport const StyledUtilitiesSummary = styled.div(({ theme }) => {\n return css`\n width: 2.75rem;\n padding: ${theme.base.spacing} 0;\n `;\n});\n\nconst UtilitiesSummary: FunctionComponent<UtilitiesSummaryProps> = ({ items = [] }) => {\n const t = useI18n();\n return items.length ? (\n <Card\n container={{ direction: 'column', alignItems: 'center', gap: 3 }}\n as={StyledUtilitiesSummary}\n aria-label={t('utilities_summary')}\n role='list'\n >\n {items.map(item => {\n return (\n <Flex\n container={{\n direction: 'column',\n alignItems: 'center',\n gap: 0.5\n }}\n item={{ grow: 1 }}\n key={item.iconName}\n >\n <Icon name={item.iconName} />\n {item.count !== undefined && <Count aria-hidden>{item.count}</Count>}\n <VisuallyHiddenText role='listitem'>{`${item.count ?? ''} ${\n item.name\n }`}</VisuallyHiddenText>\n </Flex>\n );\n })}\n </Card>\n ) : null;\n};\n\nexport default UtilitiesSummary;\n"]}
1
+ {"version":3,"file":"UtilitiesSummary.js","sourceRoot":"","sources":["../../../src/components/CaseView/UtilitiesSummary.tsx"],"names":[],"mappings":";;AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,OAAO,EACP,kBAAkB,EAClB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAQjC,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE;IACpD,OAAO,GAAG,CAAA;;GAET,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,CAC/C,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;qBACC,KAAK,CAAC,IAAI,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BpC,CACF,CAAC;AAEF,MAAM,cAAc,GAA0C,CAAC,EAC7D,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,OAAO,EACR,EAAE,EAAE;IACH,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,UAAU,EAAe,CAAC;IAC9E,OAAO,CACL,8BACE,MAAC,IAAI,IACH,SAAS,EAAE;oBACT,SAAS,EAAE,QAAQ;oBACnB,UAAU,EAAE,QAAQ;oBACpB,GAAG,EAAE,GAAG;iBACT,EACD,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,qBAAqB,EAC1B,EAAE,EAAE,0BAA0B,aAE9B,KAAC,IAAI,IAAC,IAAI,EAAE,QAAQ,GAAI,EACvB,KAAK,KAAK,SAAS,IAAI,KAAC,KAAK,mCAAc,KAAK,GAAS,EAC1D,KAAC,kBAAkB,IAAC,IAAI,EAAC,UAAU,YAAE,GAAG,KAAK,IAAI,EAAE,IAAI,IAAI,EAAE,GAAsB,IAC9E,EAEP,KAAC,OAAO,IAAC,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,YACnE,IAAI,GACG,IACT,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAA6C,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,EAAE;IACpF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EACxD,EAAE,EAAE,sBAAsB,gBACd,CAAC,CAAC,mBAAmB,CAAC,EAClC,IAAI,EAAC,MAAM,YAEV,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACjB,eAAC,cAAc,OAAK,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ,GAAI,CACjD,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import type { FunctionComponent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Card,\n Count,\n Flex,\n Icon,\n Tooltip,\n useI18n,\n VisuallyHiddenText,\n useElement\n} from '@pega/cosmos-react-core';\n\nimport type { CaseViewProps, UtilitySummaryItem } from './CaseView.types';\n\nexport interface UtilitiesSummaryProps {\n items?: CaseViewProps['utilitiesSummaryItems'];\n}\n\nexport const StyledUtilitiesSummary = styled.div(() => {\n return css`\n width: 2.75rem;\n `;\n});\n\nconst StyledUtilitySummaryButton = styled(Button)(\n ({ theme }) => css`\n padding-block: ${theme.base.spacing};\n padding-inline: 0;\n width: 100%;\n color: currentColor;\n border-radius: unset;\n border: none;\n\n &:hover {\n color: currentColor;\n }\n\n &:focus {\n z-index: 1;\n }\n\n &:first-child {\n border-start-start-radius: inherit;\n border-start-end-radius: inherit;\n }\n\n &:last-child {\n border-end-start-radius: inherit;\n border-end-end-radius: inherit;\n }\n\n & + & {\n margin: 0;\n }\n `\n);\n\nconst UtilitySummary: FunctionComponent<UtilitySummaryItem> = ({\n name,\n iconName,\n count,\n onClick\n}) => {\n const [utilSummaryTooltip, setUtilSummaryTooltip] = useElement<HTMLElement>();\n return (\n <>\n <Flex\n container={{\n direction: 'column',\n alignItems: 'center',\n gap: 0.5\n }}\n onClick={onClick}\n ref={setUtilSummaryTooltip}\n as={StyledUtilitySummaryButton}\n >\n <Icon name={iconName} />\n {count !== undefined && <Count aria-hidden>{count}</Count>}\n <VisuallyHiddenText role='listitem'>{`${count ?? ''} ${name}`}</VisuallyHiddenText>\n </Flex>\n\n <Tooltip target={utilSummaryTooltip} showDelay='none' hideDelay='none'>\n {name}\n </Tooltip>\n </>\n );\n};\n\nconst UtilitiesSummary: FunctionComponent<UtilitiesSummaryProps> = ({ items = [] }) => {\n const t = useI18n();\n\n return (\n <Card\n container={{ direction: 'column', alignItems: 'center' }}\n as={StyledUtilitiesSummary}\n aria-label={t('utilities_summary')}\n role='list'\n >\n {items.map(item => (\n <UtilitySummary {...item} key={item.iconName} />\n ))}\n </Card>\n );\n};\n\nexport default UtilitiesSummary;\n"]}
@@ -0,0 +1,9 @@
1
+ import type { WithAttributes } from '@pega/cosmos-react-core';
2
+ import type { BaseDialogProps } from '@pega/cosmos-react-core/lib/components/Dialog/Dialog.types';
3
+ type UtilitySummaryItemDialogProps = WithAttributes<'div', {
4
+ target: BaseDialogProps['target'];
5
+ onDismiss?: () => void;
6
+ }>;
7
+ declare const UtilitySummaryItemDialog: import("react").ForwardRefExoticComponent<Omit<UtilitySummaryItemDialogProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
8
+ export default UtilitySummaryItemDialog;
9
+ //# sourceMappingURL=UtilitySummaryItemDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UtilitySummaryItemDialog.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/UtilitySummaryItemDialog.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4DAA4D,CAAC;AAQlG,KAAK,6BAA6B,GAAG,cAAc,CACjD,KAAK,EACL;IACE,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CACF,CAAC;AAEF,QAAA,MAAM,wBAAwB,uIAwC5B,CAAC;AAEH,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect } from 'react';
3
+ import styled from 'styled-components';
4
+ import { defaultThemeProp, getFocusables, useConsolidatedRef, useDirection, useFocusTrap, useEscape, useOuterEvent } from '@pega/cosmos-react-core';
5
+ import Dialog from '@pega/cosmos-react-core/lib/components/Dialog/Dialog';
6
+ const StyledUtilitySummaryItemDialog = styled(Dialog) `
7
+ width: 25rem;
8
+ `;
9
+ StyledUtilitySummaryItemDialog.defaultProps = defaultThemeProp;
10
+ const UtilitySummaryItemDialog = forwardRef(function UtilitySummaryItemDialog({ children, target, onDismiss }, ref) {
11
+ const dialogRef = useConsolidatedRef(ref);
12
+ useOuterEvent('mousedown', [dialogRef], e => {
13
+ // FIXME: This targets the modal backdrop. We need a better solution.
14
+ if (e.target.closest('[opacity="1"]')) {
15
+ return;
16
+ }
17
+ onDismiss?.();
18
+ target.focus();
19
+ });
20
+ useEscape(() => {
21
+ onDismiss?.();
22
+ target.focus();
23
+ }, dialogRef);
24
+ useFocusTrap(dialogRef, false);
25
+ useEffect(() => {
26
+ const focusables = getFocusables(dialogRef);
27
+ focusables[0]?.focus();
28
+ }, []);
29
+ const { start } = useDirection();
30
+ return (_jsx(StyledUtilitySummaryItemDialog, { ref: dialogRef, target: target, arrow: true, placement: `${start}-start`, children: children }));
31
+ });
32
+ export default UtilitySummaryItemDialog;
33
+ //# sourceMappingURL=UtilitySummaryItemDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UtilitySummaryItemDialog.js","sourceRoot":"","sources":["../../../src/components/CaseView/UtilitySummaryItemDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,MAAM,MAAM,sDAAsD,CAAC;AAG1E,MAAM,8BAA8B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;;CAEpD,CAAC;AAEF,8BAA8B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAU/D,MAAM,wBAAwB,GAAG,UAAU,CAGzC,SAAS,wBAAwB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,GAAG;IACtE,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAE1C,aAAa,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE;QAC1C,qEAAqE;QACrE,IAAK,CAAC,CAAC,MAAkB,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;YAClD,OAAO;SACR;QAED,SAAS,EAAE,EAAE,CAAC;QACd,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,EAAE,EAAE,CAAC;QACd,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC,EAAE,SAAS,CAAC,CAAC;IAEd,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QAC5C,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC;IAEjC,OAAO,CACL,KAAC,8BAA8B,IAC7B,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,MAAM,EACd,KAAK,QACL,SAAS,EAAE,GAAG,KAAK,QAAQ,YAE1B,QAAQ,GACsB,CAClC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,wBAAwB,CAAC","sourcesContent":["import { forwardRef, useEffect } from 'react';\nimport type { PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport {\n defaultThemeProp,\n getFocusables,\n useConsolidatedRef,\n useDirection,\n useFocusTrap,\n useEscape,\n useOuterEvent\n} from '@pega/cosmos-react-core';\nimport type { RefElement, WithAttributes } from '@pega/cosmos-react-core';\nimport Dialog from '@pega/cosmos-react-core/lib/components/Dialog/Dialog';\nimport type { BaseDialogProps } from '@pega/cosmos-react-core/lib/components/Dialog/Dialog.types';\n\nconst StyledUtilitySummaryItemDialog = styled(Dialog)`\n width: 25rem;\n`;\n\nStyledUtilitySummaryItemDialog.defaultProps = defaultThemeProp;\n\ntype UtilitySummaryItemDialogProps = WithAttributes<\n 'div',\n {\n target: BaseDialogProps['target'];\n onDismiss?: () => void;\n }\n>;\n\nconst UtilitySummaryItemDialog = forwardRef<\n RefElement<UtilitySummaryItemDialogProps>,\n PropsWithoutRef<UtilitySummaryItemDialogProps>\n>(function UtilitySummaryItemDialog({ children, target, onDismiss }, ref) {\n const dialogRef = useConsolidatedRef(ref);\n\n useOuterEvent('mousedown', [dialogRef], e => {\n // FIXME: This targets the modal backdrop. We need a better solution.\n if ((e.target as Element).closest('[opacity=\"1\"]')) {\n return;\n }\n\n onDismiss?.();\n target.focus();\n });\n\n useEscape(() => {\n onDismiss?.();\n target.focus();\n }, dialogRef);\n\n useFocusTrap(dialogRef, false);\n\n useEffect(() => {\n const focusables = getFocusables(dialogRef);\n focusables[0]?.focus();\n }, []);\n\n const { start } = useDirection();\n\n return (\n <StyledUtilitySummaryItemDialog\n ref={dialogRef}\n target={target}\n arrow\n placement={`${start}-start`}\n >\n {children}\n </StyledUtilitySummaryItemDialog>\n );\n});\n\nexport default UtilitySummaryItemDialog;\n"]}
@@ -1,4 +1,5 @@
1
1
  export { default } from './CaseView';
2
2
  export type { CaseViewProps } from './CaseView.types';
3
3
  export { StyledCaseView, StyledWorkArea as StyledCaseViewContent, StyledCaseDrawer, StyledCaseDrawerContent, StyledSummary as StyledSummaryRegion } from './CaseView.styles';
4
+ export { default as UtilitySummaryItemDialog } from './UtilitySummaryItemDialog';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EACL,cAAc,EACd,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,IAAI,mBAAmB,EACrC,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EACL,cAAc,EACd,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,IAAI,mBAAmB,EACrC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { default } from './CaseView';
2
2
  export { StyledCaseView, StyledWorkArea as StyledCaseViewContent, StyledCaseDrawer, StyledCaseDrawerContent, StyledSummary as StyledSummaryRegion } from './CaseView.styles';
3
+ export { default as UtilitySummaryItemDialog } from './UtilitySummaryItemDialog';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CaseView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EACL,cAAc,EACd,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,IAAI,mBAAmB,EACrC,MAAM,mBAAmB,CAAC","sourcesContent":["export { default } from './CaseView';\nexport type { CaseViewProps } from './CaseView.types';\nexport {\n StyledCaseView,\n StyledWorkArea as StyledCaseViewContent,\n StyledCaseDrawer,\n StyledCaseDrawerContent,\n StyledSummary as StyledSummaryRegion\n} from './CaseView.styles';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CaseView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EACL,cAAc,EACd,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,IAAI,mBAAmB,EACrC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["export { default } from './CaseView';\nexport type { CaseViewProps } from './CaseView.types';\nexport {\n StyledCaseView,\n StyledWorkArea as StyledCaseViewContent,\n StyledCaseDrawer,\n StyledCaseDrawerContent,\n StyledSummary as StyledSummaryRegion\n} from './CaseView.styles';\nexport { default as UtilitySummaryItemDialog } from './UtilitySummaryItemDialog';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigurableLayout.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AA+B1E,QAAA,MAAM,kBAAkB,iHA+EtB,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"ConfigurableLayout.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AA+B1E,QAAA,MAAM,kBAAkB,iHA+EtB,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigurableLayout.js","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAwB,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE;IAC/C,OAAO,GAAG,CAAA;;GAET,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC9C,OAAO,GAAG,CAAA;;;yBAGa,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;6BAC/B,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;0BACtC,OAAO,MAA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AE,iBAAiB,GAAI,EAC/C,OAAO,IACH,GACkB,CAC5B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, useRef, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Flex, defaultThemeProp } from '@pega/cosmos-react-core';\n\nimport type { ConfigurableLayoutProps } from './ConfigurableLayout.types';\nimport { containerMinWidth, cellGap } from './defaults';\nimport widthConfigOptions from './options';\nimport LayoutCell from './LayoutCell';\n\nconst StyledConfigurableLayout = styled.div(() => {\n return css`\n overflow: hidden;\n `;\n});\n\nconst StyledCellGrid = styled.div(({ theme }) => {\n return css`\n /* Note: inset position used to negate \"column\" inline margin on items */\n position: relative;\n width: calc(100% + ${cellGap * 2} * ${theme.base.spacing});\n max-width: calc(100% + ${cellGap * 2} * ${theme.base.spacing});\n inset-inline: calc(-${cellGap} * ${theme.base.spacing});\n margin-block-end: calc(-2 * ${cellGap} * ${theme.base.spacing});\n `;\n});\nStyledCellGrid.defaultProps = defaultThemeProp;\n\nconst StyledContainerRuler = styled.div(({ theme }) => {\n return css`\n margin-inline: calc(${cellGap} * ${theme.base.spacing});\n width: calc(100% - ${cellGap * 2} * ${theme.base.spacing});\n `;\n});\nStyledContainerRuler.defaultProps = defaultThemeProp;\n\nconst ConfigurableLayout = forwardRef(function ConfigurableLayout(\n { items, arrangement }: PropsWithoutRef<ConfigurableLayoutProps>,\n ref: Ref<HTMLElement>\n) {\n const containerRulerRef = useRef<HTMLDivElement>(null);\n\n const renderMode = useMemo(() => {\n const activeArrangement = arrangement?.hasWrapped !== undefined && !arrangement.hasWrapped;\n\n if (activeArrangement) {\n switch (arrangement.size) {\n case 'main':\n return 'direct';\n case 'half':\n return 'double';\n case 'narrow':\n return 'full';\n default:\n return 'direct';\n }\n }\n\n // Use direct by default\n return 'direct';\n }, [arrangement]);\n\n const content = useMemo(() => {\n if (items && !!items.length) {\n return items.map(itemConfig => {\n const config = {\n ...itemConfig,\n layoutConfig: { ...itemConfig.layoutConfig }\n };\n\n if (renderMode !== 'direct') {\n switch (renderMode) {\n case 'double': {\n const doubleWidth: { [key: string]: keyof typeof widthConfigOptions } = {\n '1/4': '1/2',\n '1/3': '2/3',\n '1/2': 'full',\n '2/3': 'full',\n '3/4': 'full',\n full: 'full'\n };\n\n config.layoutConfig.width = doubleWidth[config.layoutConfig.width];\n\n break;\n }\n case 'full':\n config.layoutConfig.width = 'full';\n break;\n default:\n config.layoutConfig.width = 'full';\n break;\n }\n }\n\n return <LayoutCell key={`${itemConfig.id}`} config={config} />;\n });\n }\n\n return null;\n }, [items, renderMode]);\n\n return (\n <StyledConfigurableLayout>\n <Flex\n as={StyledCellGrid}\n container={{ wrap: 'wrap', justify: 'stretch', alignItems: 'stretch' }}\n item={{ basis: containerMinWidth, grow: 1 }}\n ref={ref}\n >\n <StyledContainerRuler ref={containerRulerRef} />\n {content}\n </Flex>\n </StyledConfigurableLayout>\n );\n});\n\nexport default ConfigurableLayout;\n"]}
1
+ {"version":3,"file":"ConfigurableLayout.js","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE;IAC/C,OAAO,GAAG,CAAA;;GAET,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAA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,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,EACtE,IAAI,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,EAAE,EAC3C,GAAG,EAAE,GAAG,aAER,KAAC,oBAAoB,IAAC,GAAG,EAAE,iBAAiB,GAAI,EAC/C,OAAO,IACH,GACkB,CAC5B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC","sourcesContent":["import { forwardRef, useRef, useMemo } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Flex, defaultThemeProp } from '@pega/cosmos-react-core';\n\nimport type { ConfigurableLayoutProps } from './ConfigurableLayout.types';\nimport { containerMinWidth, cellGap } from './defaults';\nimport type widthConfigOptions from './options';\nimport LayoutCell from './LayoutCell';\n\nconst StyledConfigurableLayout = styled.div(() => {\n return css`\n overflow: hidden;\n `;\n});\n\nconst StyledCellGrid = styled.div(({ theme }) => {\n return css`\n /* Note: inset position used to negate \"column\" inline margin on items */\n position: relative;\n width: calc(100% + ${cellGap * 2} * ${theme.base.spacing});\n max-width: calc(100% + ${cellGap * 2} * ${theme.base.spacing});\n inset-inline: calc(-${cellGap} * ${theme.base.spacing});\n margin-block-end: calc(-2 * ${cellGap} * ${theme.base.spacing});\n `;\n});\nStyledCellGrid.defaultProps = defaultThemeProp;\n\nconst StyledContainerRuler = styled.div(({ theme }) => {\n return css`\n margin-inline: calc(${cellGap} * ${theme.base.spacing});\n width: calc(100% - ${cellGap * 2} * ${theme.base.spacing});\n `;\n});\nStyledContainerRuler.defaultProps = defaultThemeProp;\n\nconst ConfigurableLayout = forwardRef(function ConfigurableLayout(\n { items, arrangement }: PropsWithoutRef<ConfigurableLayoutProps>,\n ref: Ref<HTMLElement>\n) {\n const containerRulerRef = useRef<HTMLDivElement>(null);\n\n const renderMode = useMemo(() => {\n const activeArrangement = arrangement?.hasWrapped !== undefined && !arrangement.hasWrapped;\n\n if (activeArrangement) {\n switch (arrangement.size) {\n case 'main':\n return 'direct';\n case 'half':\n return 'double';\n case 'narrow':\n return 'full';\n default:\n return 'direct';\n }\n }\n\n // Use direct by default\n return 'direct';\n }, [arrangement]);\n\n const content = useMemo(() => {\n if (items && !!items.length) {\n return items.map(itemConfig => {\n const config = {\n ...itemConfig,\n layoutConfig: { ...itemConfig.layoutConfig }\n };\n\n if (renderMode !== 'direct') {\n switch (renderMode) {\n case 'double': {\n const doubleWidth: { [key: string]: keyof typeof widthConfigOptions } = {\n '1/4': '1/2',\n '1/3': '2/3',\n '1/2': 'full',\n '2/3': 'full',\n '3/4': 'full',\n full: 'full'\n };\n\n config.layoutConfig.width = doubleWidth[config.layoutConfig.width];\n\n break;\n }\n case 'full':\n config.layoutConfig.width = 'full';\n break;\n default:\n config.layoutConfig.width = 'full';\n break;\n }\n }\n\n return <LayoutCell key={`${itemConfig.id}`} config={config} />;\n });\n }\n\n return null;\n }, [items, renderMode]);\n\n return (\n <StyledConfigurableLayout>\n <Flex\n as={StyledCellGrid}\n container={{ wrap: 'wrap', justify: 'stretch', alignItems: 'stretch' }}\n item={{ basis: containerMinWidth, grow: 1 }}\n ref={ref}\n >\n <StyledContainerRuler ref={containerRulerRef} />\n {content}\n </Flex>\n </StyledConfigurableLayout>\n );\n});\n\nexport default ConfigurableLayout;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutCell.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/LayoutCell.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAoDzD,QAAA,MAAM,UAAU;YAA0B,MAAM;wBAoC/C,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"LayoutCell.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/LayoutCell.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4B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AG,EAAE;QACnC,OAAO,kBAAkB,CAAC,YAAY,CAAC,KAAwC,CAAC,IAAI,MAAM,CAAC;IAC7F,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,CAAC;QAEpC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO,GAAG,KAAK,IAAI,CAAC;SACrB;QAED,IACE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACpB,KAAK,CAAC,MAAM,IAAI,CAAC;YACjB,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ;YAC5B,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAClC;YACA,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SACjC;IACH,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CACvB,KAAC,IAAI,IACH,EAAE,EAAE,UAAU,EACd,IAAI,EAAE;YACJ,IAAI,EAAE,CAAC;SACR,EACD,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,EACtD,aAAa,EAAE,YAAY,CAAC,aAAa,EACzC,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,YAEjB,MAAM,CAAC,OAAO,GACV,CACR,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { useMemo } from 'react';\nimport styled, { css, DefaultTheme } from 'styled-components';\n\nimport { Flex, defaultThemeProp } from '@pega/cosmos-react-core';\n\nimport { StyledAppAnnouncement } from '../AppAnnouncement/AppAnnouncement';\n\nimport type { Config } from './ConfigurableLayout.types';\nimport widthConfigOptions from './options';\nimport { itemMinWidth, cellGap } from './defaults';\n\nconst StyledCell = styled.div(\n ({\n fillAvailable = true,\n percentageWidth,\n minWidth,\n theme\n }: {\n fillAvailable: boolean;\n percentageWidth?: string;\n minWidth?: string | undefined;\n theme: DefaultTheme;\n }) => {\n return css`\n /* variables */\n --marginGap: calc(${cellGap} * ${theme.base.spacing});\n --totalMargin: calc(2 * var(--marginGap));\n --percentageBasis: calc(${percentageWidth} - var(--totalMargin));\n --maxWidth: calc(100% - var(--totalMargin));\n\n /* styles */\n flex-wrap: wrap;\n flex-basis: var(--percentageBasis);\n min-width: min(var(--maxWidth), ${minWidth || itemMinWidth});\n max-width: var(--maxWidth);\n margin-block-end: var(--totalMargin);\n margin-inline: var(--marginGap);\n\n ${!fillAvailable &&\n css`\n flex-grow: 0;\n `}\n\n ${StyledAppAnnouncement} {\n align-self: stretch;\n }\n\n > * {\n width: 100%;\n height: auto;\n overflow-x: auto;\n }\n `;\n }\n);\nStyledCell.defaultProps = defaultThemeProp;\n\nconst validWidthUnits = ['px', 'ch', 'rem', 'em'];\n\nconst LayoutCell = ({ config }: { config: Config }) => {\n const layoutConfig = useMemo(() => config.layoutConfig, [config]);\n const percentageWidth = useMemo(() => {\n return widthConfigOptions[layoutConfig.width as keyof typeof widthConfigOptions] || '100%';\n }, [layoutConfig.width]);\n const minWidth = useMemo(() => {\n const value = layoutConfig.minWidth;\n\n if (typeof value === 'number') {\n return `${value}px`;\n }\n\n if (\n Array.isArray(value) &&\n value.length >= 2 &&\n typeof value[0] === 'number' &&\n validWidthUnits.includes(value[1])\n ) {\n return `${value[0]}${value[1]}`;\n }\n }, [layoutConfig.minWidth]);\n\n return config?.content ? (\n <Flex\n as={StyledCell}\n item={{\n grow: 1\n }}\n container={{ justify: 'stretch', alignItems: 'start' }}\n fillAvailable={layoutConfig.fillAvailable}\n percentageWidth={percentageWidth}\n minWidth={minWidth}\n >\n {config.content}\n </Flex>\n ) : null;\n};\n\nexport default LayoutCell;\n"]}
1
+ {"version":3,"file":"LayoutCell.js","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/LayoutCell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAG3E,OAAO,kBAAkB,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAC3B,CAAC,EACC,aAAa,GAAG,IAAI,EACpB,eAAe,EACf,QAAQ,EACR,KAAK,EAMN,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;;0BAEY,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;;gCAEzB,eAAe;;;;;;wCAMP,QAAQ,IAAI,YAAY;;;;;QAKxD,CAAC,aAAa;QAChB,GAAG,CAAA;;OAEF;;QAEC,qBAAqB;;;;;;;;;KASxB,CAAC;AACJ,CAAC,CACF,CAAC;AACF,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3C,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAElD,MAAM,UAAU,GAAG,CAAC,EAAE,MAAM,EAAsB,EAAE,EAAE;IACpD,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE;QACnC,OAAO,kBAAkB,CAAC,YAAY,CAAC,KAAwC,CAAC,IAAI,MAAM,CAAC;IAC7F,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,CAAC;QAEpC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO,GAAG,KAAK,IAAI,CAAC;SACrB;QAED,IACE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACpB,KAAK,CAAC,MAAM,IAAI,CAAC;YACjB,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ;YAC5B,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAClC;YACA,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SACjC;IACH,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CACvB,KAAC,IAAI,IACH,EAAE,EAAE,UAAU,EACd,IAAI,EAAE;YACJ,IAAI,EAAE,CAAC;SACR,EACD,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,EACtD,aAAa,EAAE,YAAY,CAAC,aAAa,EACzC,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,YAEjB,MAAM,CAAC,OAAO,GACV,CACR,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { useMemo } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\n\nimport { Flex, defaultThemeProp } from '@pega/cosmos-react-core';\n\nimport { StyledAppAnnouncement } from '../AppAnnouncement/AppAnnouncement';\n\nimport type { Config } from './ConfigurableLayout.types';\nimport widthConfigOptions from './options';\nimport { itemMinWidth, cellGap } from './defaults';\n\nconst StyledCell = styled.div(\n ({\n fillAvailable = true,\n percentageWidth,\n minWidth,\n theme\n }: {\n fillAvailable: boolean;\n percentageWidth?: string;\n minWidth?: string | undefined;\n theme: DefaultTheme;\n }) => {\n return css`\n /* variables */\n --marginGap: calc(${cellGap} * ${theme.base.spacing});\n --totalMargin: calc(2 * var(--marginGap));\n --percentageBasis: calc(${percentageWidth} - var(--totalMargin));\n --maxWidth: calc(100% - var(--totalMargin));\n\n /* styles */\n flex-wrap: wrap;\n flex-basis: var(--percentageBasis);\n min-width: min(var(--maxWidth), ${minWidth || itemMinWidth});\n max-width: var(--maxWidth);\n margin-block-end: var(--totalMargin);\n margin-inline: var(--marginGap);\n\n ${!fillAvailable &&\n css`\n flex-grow: 0;\n `}\n\n ${StyledAppAnnouncement} {\n align-self: stretch;\n }\n\n > * {\n width: 100%;\n height: auto;\n overflow-x: auto;\n }\n `;\n }\n);\nStyledCell.defaultProps = defaultThemeProp;\n\nconst validWidthUnits = ['px', 'ch', 'rem', 'em'];\n\nconst LayoutCell = ({ config }: { config: Config }) => {\n const layoutConfig = useMemo(() => config.layoutConfig, [config]);\n const percentageWidth = useMemo(() => {\n return widthConfigOptions[layoutConfig.width as keyof typeof widthConfigOptions] || '100%';\n }, [layoutConfig.width]);\n const minWidth = useMemo(() => {\n const value = layoutConfig.minWidth;\n\n if (typeof value === 'number') {\n return `${value}px`;\n }\n\n if (\n Array.isArray(value) &&\n value.length >= 2 &&\n typeof value[0] === 'number' &&\n validWidthUnits.includes(value[1])\n ) {\n return `${value[0]}${value[1]}`;\n }\n }, [layoutConfig.minWidth]);\n\n return config?.content ? (\n <Flex\n as={StyledCell}\n item={{\n grow: 1\n }}\n container={{ justify: 'stretch', alignItems: 'start' }}\n fillAvailable={layoutConfig.fillAvailable}\n percentageWidth={percentageWidth}\n minWidth={minWidth}\n >\n {config.content}\n </Flex>\n ) : null;\n};\n\nexport default LayoutCell;\n"]}
@@ -1,4 +1,4 @@
1
- import { Ref } from 'react';
1
+ import type { Ref } from 'react';
2
2
  declare const useTrackWrappedRegions: (regionElArray: (HTMLElement | null)[], disabled?: boolean) => {
3
3
  containerRef: Ref<HTMLElement | null>;
4
4
  regionWrappedStates: boolean[];
@@ -1 +1 @@
1
- {"version":3,"file":"useTrackWrappedRegions.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/useTrackWrappedRegions.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,GAAG,EAAE,MAAM,OAAO,CAAC;AAIzD,QAAA,MAAM,sBAAsB,kBACX,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,aAC1B,OAAO;kBACD,IAAI,WAAW,GAAG,IAAI,CAAC;yBAAuB,OAAO,EAAE;CA2CzE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"useTrackWrappedRegions.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/useTrackWrappedRegions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,QAAA,MAAM,sBAAsB,kBACX,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,aAC1B,OAAO;kBACD,IAAI,WAAW,GAAG,IAAI,CAAC;yBAAuB,OAAO,EAAE;CA2CzE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTrackWrappedRegions.js","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/useTrackWrappedRegions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAO,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,MAAM,sBAAsB,GAAG,CAC7B,aAAqC,EACrC,QAAkB,EACyD,EAAE;IAC7E,MAAM,YAAY,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IACtD,MAAM,CAAC,mBAAmB,EA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AAE,CAAC;AAC/C,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import { useRef, useEffect, useState, Ref } from 'react';\n\nimport { debounce } from '@pega/cosmos-react-core';\n\nconst useTrackWrappedRegions = (\n regionElArray: (HTMLElement | null)[],\n disabled?: boolean\n): { containerRef: Ref<HTMLElement | null>; regionWrappedStates: boolean[] } => {\n const containerRef = useRef<HTMLElement | null>(null);\n const [regionWrappedStates, setRegionWrappedStates] = useState(\n new Array(regionElArray.length).fill(false)\n );\n\n useEffect(() => {\n if (disabled) return;\n\n let isMounted = true;\n\n const observer = new ResizeObserver(\n debounce(entries => {\n if (isMounted) {\n const containerWidth = entries[0].contentRect.width;\n const newWrappedStates = [...regionWrappedStates];\n\n regionElArray.forEach((regionEl, index) => {\n const regionWidth = regionEl?.getBoundingClientRect().width;\n\n if (regionWidth !== undefined && regionWidth >= containerWidth) {\n newWrappedStates[index] = true;\n } else {\n newWrappedStates[index] = false;\n }\n });\n\n setRegionWrappedStates(newWrappedStates);\n }\n }, 100)\n );\n\n if (containerRef.current && regionElArray.length) {\n observer.observe(containerRef.current);\n }\n\n return () => {\n isMounted = false;\n observer.disconnect();\n };\n }, [containerRef, regionElArray]);\n\n return { containerRef, regionWrappedStates };\n};\n\nexport default useTrackWrappedRegions;\n"]}
1
+ {"version":3,"file":"useTrackWrappedRegions.js","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/useTrackWrappedRegions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,MAAM,sBAAsB,GAAG,CAC7B,aAAqC,EACrC,QAAkB,EACyD,EAAE;IAC7E,MAAM,YAAY,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IACtD,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,QAAQ,CAC5D,I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e,sBAAsB,CAAC","sourcesContent":["import { useRef, useEffect, useState } from 'react';\nimport type { Ref } from 'react';\n\nimport { debounce } from '@pega/cosmos-react-core';\n\nconst useTrackWrappedRegions = (\n regionElArray: (HTMLElement | null)[],\n disabled?: boolean\n): { containerRef: Ref<HTMLElement | null>; regionWrappedStates: boolean[] } => {\n const containerRef = useRef<HTMLElement | null>(null);\n const [regionWrappedStates, setRegionWrappedStates] = useState(\n new Array(regionElArray.length).fill(false)\n );\n\n useEffect(() => {\n if (disabled) return;\n\n let isMounted = true;\n\n const observer = new ResizeObserver(\n debounce(entries => {\n if (isMounted) {\n const containerWidth = entries[0].contentRect.width;\n const newWrappedStates = [...regionWrappedStates];\n\n regionElArray.forEach((regionEl, index) => {\n const regionWidth = regionEl?.getBoundingClientRect().width;\n\n if (regionWidth !== undefined && regionWidth >= containerWidth) {\n newWrappedStates[index] = true;\n } else {\n newWrappedStates[index] = false;\n }\n });\n\n setRegionWrappedStates(newWrappedStates);\n }\n }, 100)\n );\n\n if (containerRef.current && regionElArray.length) {\n observer.observe(containerRef.current);\n }\n\n return () => {\n isMounted = false;\n observer.disconnect();\n };\n }, [containerRef, regionElArray]);\n\n return { containerRef, regionWrappedStates };\n};\n\nexport default useTrackWrappedRegions;\n"]}
@@ -1,5 +1,5 @@
1
- import { FunctionComponent, ReactNode, Ref } from 'react';
2
- import { ForwardProps, UnorderedListProps, NoChildrenProp } from '@pega/cosmos-react-core';
1
+ import type { FunctionComponent, ReactNode, Ref } from 'react';
2
+ import type { ForwardProps, UnorderedListProps, NoChildrenProp } from '@pega/cosmos-react-core';
3
3
  export interface ConfirmationProps extends NoChildrenProp {
4
4
  /** The title of the confirmation */
5
5
  title?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Confirmation.d.ts","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,SAAS,EACT,GAAG,EAGJ,MAAM,OAAO,CAAC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AAC;IAErB,OAAO,CACL,KAAC,IAAI,OAAK,SAAS,EAAE,GAAG,EAAE,GAAG,YAC3B,KAAC,WAAW,cACV,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAC7C,KAAK,IAAI,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,KAAK,GAAQ,EAE1C,OAAO,IAAI,CACV,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YAC7C,KAAC,yBAAyB,cAAE,OAAO,GAA6B,GACxC,CAC3B,EAEA,SAAS,IAAI,CACZ,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAC9C,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,yBAAyB,CAAC,GAAQ,EACxD,KAAC,mBAAmB,IAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,mBAAmB,GAAI,IAC7D,CACR,EAEA,KAAK,EAEL,OAAO,IAAI,CACV,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,YACjC,MAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,SAAS,aACxC,CAAC,CAAC,MAAM,CAAC,EACT,KAAK,CAAC,CAAC,CAAC,KAAC,kBAAkB,cAAE,KAAK,KAAK,EAAE,GAAsB,CAAC,CAAC,CAAC,IAAI,IAChE,GACJ,CACR,IACI,GACK,GACT,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n ReactNode,\n Ref,\n useContext,\n useMemo\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Card,\n CardContent,\n ForwardProps,\n Flex,\n Text,\n useI18n,\n UnorderedList,\n Button,\n defaultThemeProp,\n UnorderedListProps,\n NoChildrenProp,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\n\nimport { StyledDetails, StyledFieldValueGroupLabel, DetailsContext } from '../Details';\n\nconst StyledWhatsNextList = styled(UnorderedList)`\n padding-inline-start: 0;\n`;\n\nStyledWhatsNextList.defaultProps = defaultThemeProp;\n\nexport interface ConfirmationProps extends NoChildrenProp {\n /** The title of the confirmation */\n title?: string;\n /** Region for a Field Value List component */\n details?: ReactNode;\n /** Array of React nodes to be put into a list */\n whatsNext?: UnorderedListProps['items'];\n /** Region for a Tasks component */\n tasks?: ReactNode;\n /** Called when the done/close button is clicked */\n onClose?: () => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\nconst StyledConfirmationDetails = styled.div(() => {\n return css`\n > ${StyledDetails} > ${StyledFieldValueGroupLabel}:first-child {\n margin-block-start: 0;\n }\n `;\n});\n\nconst Confirmation: FunctionComponent<ConfirmationProps & ForwardProps> = forwardRef(\n function Confirmation(\n { title, details, whatsNext, tasks, onClose, ...restProps }: PropsWithoutRef<ConfirmationProps>,\n ref\n ) {\n const t = useI18n();\n const detailsContext = useContext(DetailsContext);\n\n const detailsCtxValue = useMemo(() => {\n return {\n ...detailsContext,\n depth: 4\n };\n }, [detailsContext]);\n\n return (\n <Card {...restProps} ref={ref}>\n <CardContent>\n <Flex container={{ gap: 3, direction: 'column' }}>\n {title && <Text variant='h3'>{title}</Text>}\n\n {details && (\n <DetailsContext.Provider value={detailsCtxValue}>\n <StyledConfirmationDetails>{details}</StyledConfirmationDetails>\n </DetailsContext.Provider>\n )}\n\n {whatsNext && (\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h4'>{t('confirmation_whats_next')}</Text>\n <StyledWhatsNextList items={whatsNext} as={StyledWhatsNextList} />\n </Flex>\n )}\n\n {tasks}\n\n {onClose && (\n <Flex container={{ justify: 'end' }}>\n <Button onClick={onClose} variant='primary'>\n {t('done')}\n {title ? <VisuallyHiddenText>{`- ${title}`}</VisuallyHiddenText> : null}\n </Button>\n </Flex>\n )}\n </Flex>\n </CardContent>\n </Card>\n );\n }\n);\n\nexport default Confirmation;\n"]}
1
+ {"version":3,"file":"Confirmation.js","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEvF,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;CAEhD,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAiBpD,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE;IAChD,OAAO,GAAG,CAAA;QACJ,aAAa,MAAM,0BAA0B;;;GAGlD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,YAAY,GAAwD,UAAU,CAClF,SAAS,YAAY,CACnB,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,SAAS,EAAsC,EAC/F,GAAG;IAEH,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAElD,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE;QACnC,OAAO;YACL,GAAG,cAAc;YACjB,KAAK,EAAE,CAAC;SACT,CAAC;IACJ,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,KAAC,IAAI,OAAK,SAAS,EAAE,GAAG,EAAE,GAAG,YAC3B,KAAC,WAAW,cACV,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAC7C,KAAK,IAAI,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,KAAK,GAAQ,EAE1C,OAAO,IAAI,CACV,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YAC7C,KAAC,yBAAyB,cAAE,OAAO,GAA6B,GACxC,CAC3B,EAEA,SAAS,IAAI,CACZ,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAC9C,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,yBAAyB,CAAC,GAAQ,EACxD,KAAC,mBAAmB,IAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,mBAAmB,GAAI,IAC7D,CACR,EAEA,KAAK,EAEL,OAAO,IAAI,CACV,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,YACjC,MAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,SAAS,aACxC,CAAC,CAAC,MAAM,CAAC,EACT,KAAK,CAAC,CAAC,CAAC,KAAC,kBAAkB,cAAE,KAAK,KAAK,EAAE,GAAsB,CAAC,CAAC,CAAC,IAAI,IAChE,GACJ,CACR,IACI,GACK,GACT,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, useContext, useMemo } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, ReactNode, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Card,\n CardContent,\n Flex,\n Text,\n useI18n,\n UnorderedList,\n Button,\n defaultThemeProp,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps, UnorderedListProps, NoChildrenProp } from '@pega/cosmos-react-core';\n\nimport { StyledDetails, StyledFieldValueGroupLabel, DetailsContext } from '../Details';\n\nconst StyledWhatsNextList = styled(UnorderedList)`\n padding-inline-start: 0;\n`;\n\nStyledWhatsNextList.defaultProps = defaultThemeProp;\n\nexport interface ConfirmationProps extends NoChildrenProp {\n /** The title of the confirmation */\n title?: string;\n /** Region for a Field Value List component */\n details?: ReactNode;\n /** Array of React nodes to be put into a list */\n whatsNext?: UnorderedListProps['items'];\n /** Region for a Tasks component */\n tasks?: ReactNode;\n /** Called when the done/close button is clicked */\n onClose?: () => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\nconst StyledConfirmationDetails = styled.div(() => {\n return css`\n > ${StyledDetails} > ${StyledFieldValueGroupLabel}:first-child {\n margin-block-start: 0;\n }\n `;\n});\n\nconst Confirmation: FunctionComponent<ConfirmationProps & ForwardProps> = forwardRef(\n function Confirmation(\n { title, details, whatsNext, tasks, onClose, ...restProps }: PropsWithoutRef<ConfirmationProps>,\n ref\n ) {\n const t = useI18n();\n const detailsContext = useContext(DetailsContext);\n\n const detailsCtxValue = useMemo(() => {\n return {\n ...detailsContext,\n depth: 4\n };\n }, [detailsContext]);\n\n return (\n <Card {...restProps} ref={ref}>\n <CardContent>\n <Flex container={{ gap: 3, direction: 'column' }}>\n {title && <Text variant='h3'>{title}</Text>}\n\n {details && (\n <DetailsContext.Provider value={detailsCtxValue}>\n <StyledConfirmationDetails>{details}</StyledConfirmationDetails>\n </DetailsContext.Provider>\n )}\n\n {whatsNext && (\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h4'>{t('confirmation_whats_next')}</Text>\n <StyledWhatsNextList items={whatsNext} as={StyledWhatsNextList} />\n </Flex>\n )}\n\n {tasks}\n\n {onClose && (\n <Flex container={{ justify: 'end' }}>\n <Button onClick={onClose} variant='primary'>\n {t('done')}\n {title ? <VisuallyHiddenText>{`- ${title}`}</VisuallyHiddenText> : null}\n </Button>\n </Flex>\n )}\n </Flex>\n </CardContent>\n </Card>\n );\n }\n);\n\nexport default Confirmation;\n"]}
@@ -1,17 +1,10 @@
1
- import { FC, ReactNode, Ref } from 'react';
2
- import { ForwardProps, TestIdProp } from '@pega/cosmos-react-core';
3
- export interface DetailsProps extends TestIdProp {
1
+ import type { FC, ReactNode, Ref } from 'react';
2
+ import type { AdditionalInfoProps, ForwardProps, TestIdProp } from '@pega/cosmos-react-core';
3
+ export type DetailsProps = TestIdProp & {
4
4
  highlightedData?: ReactNode[];
5
5
  children?: ReactNode;
6
- /** Text used as heading of list */
7
- name?: string;
8
6
  /** Copy placed in paragraph below the name */
9
7
  description?: string;
10
- /**
11
- * Whether the items children can be collapsed (only applies if name is provided)
12
- * @default false
13
- */
14
- collapsible?: boolean;
15
8
  /**
16
9
  * Number of columns in detail layout
17
10
  * @default 1
@@ -30,7 +23,24 @@ export interface DetailsProps extends TestIdProp {
30
23
  */
31
24
  valueComparison?: boolean;
32
25
  ref?: Ref<HTMLDListElement>;
33
- }
26
+ } & ({
27
+ /** Text used as heading of list */
28
+ name: string;
29
+ /** Pass a heading and content to show additional information on the list. */
30
+ additionalInfo?: {
31
+ heading?: AdditionalInfoProps['heading'];
32
+ content: AdditionalInfoProps['children'];
33
+ };
34
+ /**
35
+ * Whether the items children can be collapsed (only applies if name is provided)
36
+ * @default false
37
+ */
38
+ collapsible?: boolean;
39
+ } | {
40
+ name?: undefined;
41
+ additionalInfo?: never;
42
+ collapsible?: never;
43
+ });
34
44
  declare const _default: FC<DetailsProps & ForwardProps> & {
35
45
  getTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["heading", "description", "highlighted-data", "data", "expand-collapse"]>;
36
46
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Details.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,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OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B,GAAG,CACE;IACE,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,cAAc,CAAC,EAAE;QACf,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACzC,OAAO,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;KAC1C,CAAC;IACF;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GACD;IACE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,cAAc,CAAC,EAAE,KAAK,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,CACJ,CAAC;;;;AAqNJ,wBAAuD"}
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, Fragment, useState, useContext, useEffect, useMemo } from 'react';
3
3
  import { remToPx } from 'polished';
4
- import { Text, useBreakpoint, useConsolidatedRef, useTheme, ExpandCollapse, Button, Flex, Icon, useChToPxConversionFactor, useI18n, HTML, useTestIds, withTestIds } from '@pega/cosmos-react-core';
4
+ import { AdditionalInfo, Text, useBreakpoint, useConsolidatedRef, useTheme, ExpandCollapse, Button, Flex, Icon, useChToPxConversionFactor, useI18n, HTML, useTestIds, withTestIds } from '@pega/cosmos-react-core';
5
5
  import { getDetailsTestIds } from './Details.test-ids';
6
6
  import DetailsContext from './DetailsContext';
7
7
  import { StyledFieldValueGroupLabel, StyledDetails, StyledDetailList, StyledHighlightedDetailList, flexGapProp, StyledDetailDescription } from './Details.styles';
8
- const Details = forwardRef(function Details({ testId, highlightedData, children, name, description, columnCount = 1, nested = false, asFlex = false, valueComparison = false, collapsible = false }, ref) {
8
+ const Details = forwardRef(function Details({ testId, highlightedData, children, name, description, columnCount = 1, nested = false, asFlex = false, valueComparison = false, collapsible = false, additionalInfo: additionalInfoProp }, ref) {
9
9
  const { longestLabelLength, mobileView: inMobileView, depth, ...context } = useContext(DetailsContext);
10
10
  const { base: { 'content-width': { sm: smContentWidth } } } = useTheme();
11
11
  const isSmallOrAbove = useBreakpoint('sm');
@@ -65,6 +65,9 @@ const Details = forwardRef(function Details({ testId, highlightedData, children,
65
65
  const nameText = useMemo(() => {
66
66
  return _jsx(Text, { variant: `h${Math.min(headingDepth, 6)}`, children: name });
67
67
  }, [name, headingDepth]);
68
+ const additionalInfo = useMemo(() => {
69
+ return name && additionalInfoProp ? (_jsx(AdditionalInfo, { heading: additionalInfoProp.heading, contextualLabel: name, children: additionalInfoProp.content })) : undefined;
70
+ }, [name, additionalInfoProp?.heading, additionalInfoProp?.content]);
68
71
  const details = useMemo(() => {
69
72
  return (_jsxs(_Fragment, { children: [highlightedData && (_jsxs(_Fragment, { children: [_jsx(Flex, { "data-testid": testIds.highlightedData, as: StyledHighlightedDetailList, forwardedAs: nested ? 'div' : 'dl', container: { wrap: 'wrap', colGap: 10, rowGap: 1, alignItems: 'start' }, children: highlightedData.map((child, i) => (
70
73
  // eslint-disable-next-line react/no-array-index-key
@@ -84,9 +87,9 @@ const Details = forwardRef(function Details({ testId, highlightedData, children,
84
87
  ]);
85
88
  if (!name && !children && !highlightedData && !description)
86
89
  return null;
87
- return (_jsx(DetailsContext.Provider, { value: contextValue, children: _jsxs(StyledDetails, { "data-testid": testIds.root, children: [name && (_jsx(StyledFieldValueGroupLabel, { "data-testid": testIds.heading, children: collapsible ? (_jsx(Button, { type: 'button', variant: 'text', onClick: () => {
88
- setOpen(cur => !cur);
89
- }, "aria-expanded": open ? 'true' : 'false', "aria-label": t(open ? 'collapse_noun' : 'expand_noun', [name]), children: _jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: 'span', children: [_jsx(Icon, { name: 'caret-right' }), nameText] }) })) : (nameText) })), description && (_jsx(StyledDetailDescription, { "data-testid": testIds.description, children: _jsx(HTML, { as: 'p', content: description }) })), collapsible ? (_jsx(ExpandCollapse, { "data-testid": testIds.expandCollapse, collapsed: !open, children: details })) : (details)] }) }));
90
+ return (_jsx(DetailsContext.Provider, { value: contextValue, children: _jsxs(StyledDetails, { "data-testid": testIds.root, children: [name && (_jsx(StyledFieldValueGroupLabel, { "data-testid": testIds.heading, children: _jsx(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: 'span', children: collapsible ? (_jsxs(_Fragment, { children: [_jsx(Button, { type: 'button', variant: 'text', onClick: () => {
91
+ setOpen(cur => !cur);
92
+ }, "aria-expanded": open ? 'true' : 'false', "aria-label": t(open ? 'collapse_noun' : 'expand_noun', [name]), children: _jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: 'span', children: [_jsx(Icon, { name: 'caret-right' }), nameText] }) }), additionalInfo] })) : (_jsxs(_Fragment, { children: [nameText, additionalInfo] })) }) })), description && (_jsx(StyledDetailDescription, { "data-testid": testIds.description, children: _jsx(HTML, { as: 'p', content: description }) })), collapsible ? (_jsx(ExpandCollapse, { "data-testid": testIds.expandCollapse, collapsed: !open, children: details })) : (details)] }) }));
90
93
  });
91
94
  export default withTestIds(Details, getDetailsTestIds);
92
95
  //# sourceMappingURL=Details.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Details.js","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAEV,QAAQ,EAGR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,aAAa,EACb,kBAAkB,EAClB,QAAQ,EAER,cAAc,EACd,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,yBAAyB,EACzB,OAAO,EAEP,IAAI,EAEJ,UAAU,EACV,WAAW,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0B,mBAAc,OAAO,CAAC,OAAO,YACrD,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;4BACZ,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;wBACvB,CAAC,mBACc,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,gBAC1B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,YAE7D,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAC,MAAM,aAC5D,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,EAC1B,QAAQ,IACJ,GACA,CACV,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GAC0B,CAC9B,EAEA,WAAW,IAAI,CACd,KAAC,uBAAuB,mBAAc,OAAO,CAAC,WAAW,YACvD,KAAC,IAAI,IAAC,EAAE,EAAC,GAAG,EAAC,OAAO,EAAE,WAAW,GAAI,GACb,CAC3B,EAEA,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,cAAc,mBAAc,OAAO,CAAC,cAAc,EAAE,SAAS,EAAE,CAAC,IAAI,YAClE,OAAO,GACO,CAClB,CAAC,CAAC,CAAC,CACF,OAAO,CACR,IACa,GACQ,CAC3B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import {\n forwardRef,\n FC,\n Fragment,\n ReactNode,\n Ref,\n useState,\n useContext,\n useEffect,\n useMemo\n} from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Text,\n useBreakpoint,\n useConsolidatedRef,\n useTheme,\n ForwardProps,\n ExpandCollapse,\n Button,\n Flex,\n Icon,\n useChToPxConversionFactor,\n useI18n,\n HeadingTag,\n HTML,\n TestIdProp,\n useTestIds,\n withTestIds\n} from '@pega/cosmos-react-core';\n\nimport { getDetailsTestIds } from './Details.test-ids';\nimport DetailsContext from './DetailsContext';\nimport {\n StyledFieldValueGroupLabel,\n StyledDetails,\n StyledDetailList,\n StyledHighlightedDetailList,\n flexGapProp,\n StyledDetailDescription\n} from './Details.styles';\n\nexport interface DetailsProps extends TestIdProp {\n highlightedData?: ReactNode[];\n children?: ReactNode;\n /** Text used as heading of list */\n name?: string;\n /** Copy placed in paragraph below the name */\n description?: string;\n /**\n * Whether the items children can be collapsed (only applies if name is provided)\n * @default false\n */\n collapsible?: boolean;\n /**\n * Number of columns in detail layout\n * @default 1\n */\n columnCount?: 1 | 2 | 3;\n /** Whether detail list is rendering within another detail list\n * @default false\n */\n nested?: boolean;\n /** Whether detail list is rendering multiple sub-lists in columns (passed as children)\n * @default false\n */\n asFlex?: boolean;\n /** Whether to apply `value-comparison` styles to list items\n * @default false\n */\n valueComparison?: boolean;\n ref?: Ref<HTMLDListElement>;\n}\n\nconst Details: FC<DetailsProps & ForwardProps> = forwardRef(function Details(\n {\n testId,\n highlightedData,\n children,\n name,\n description,\n columnCount = 1,\n nested = false,\n asFlex = false,\n valueComparison = false,\n collapsible = false\n },\n ref\n) {\n const {\n longestLabelLength,\n mobileView: inMobileView,\n depth,\n ...context\n } = useContext(DetailsContext);\n const {\n base: {\n 'content-width': { sm: smContentWidth }\n }\n } = useTheme();\n const isSmallOrAbove = useBreakpoint('sm');\n const listRef = useConsolidatedRef<HTMLDListElement>(ref);\n const isXsContentWidthOrAbove = useBreakpoint('xs', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const isMdContentWidthOrAbove = useBreakpoint('md', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const flexRow = useBreakpoint(columnCount > 2 ? 'lg' : 'md', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const t = useI18n();\n const testIds = useTestIds(testId, getDetailsTestIds);\n\n const [flexContextMobileView, setFlexContextMobileView] = useState(false);\n const [open, setOpen] = useState(true);\n\n const labelLength = Math.max(14, Math.min(longestLabelLength ?? 16, 40));\n const headingDepth = depth ?? 1;\n const applyMobileView =\n inMobileView ||\n !isSmallOrAbove ||\n !isXsContentWidthOrAbove ||\n (asFlex && flexRow && flexContextMobileView);\n\n const chToPxConversionFactor = useChToPxConversionFactor();\n\n // Mount resize observer to update flex context mobile view & run initial check.\n useEffect(() => {\n const checkBreakpoint = (elementWidth: number) => {\n const minWidthPx = parseInt(smContentWidth, 10) * chToPxConversionFactor;\n const oneRemInPx = parseInt(remToPx(1), 10);\n const colGapPxAllowance = oneRemInPx * (0.5 * flexGapProp) * (columnCount - 1);\n const mobileViewBreakpoint = minWidthPx * columnCount + colGapPxAllowance;\n\n setFlexContextMobileView(elementWidth < mobileViewBreakpoint);\n };\n const resizeObserver = new ResizeObserver(entries => {\n const containerPxWidth = entries[0].contentRect.width;\n checkBreakpoint(containerPxWidth);\n });\n\n if (listRef.current) {\n checkBreakpoint(listRef.current.offsetWidth);\n resizeObserver.observe(listRef.current);\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [listRef, columnCount]);\n\n const contextValue = useMemo(() => {\n return {\n mobileView: applyMobileView,\n depth: name ? headingDepth + 1 : headingDepth,\n longestLabelLength,\n ...context\n };\n }, [applyMobileView, name, headingDepth, longestLabelLength, context]);\n\n const nameText = useMemo(() => {\n return <Text variant={`h${Math.min(headingDepth, 6)}` as HeadingTag}>{name}</Text>;\n }, [name, headingDepth]);\n\n const details = useMemo(() => {\n return (\n <>\n {highlightedData && (\n <>\n <Flex\n data-testid={testIds.highlightedData}\n as={StyledHighlightedDetailList}\n forwardedAs={nested ? 'div' : 'dl'}\n container={{ wrap: 'wrap', colGap: 10, rowGap: 1, alignItems: 'start' }}\n >\n {highlightedData.map((child, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>{child}</Fragment>\n ))}\n </Flex>\n\n <hr />\n </>\n )}\n\n {children ? (\n <StyledDetailList\n data-testid={testIds.data}\n ref={listRef}\n as={nested ? 'div' : 'dl'}\n columnCount={columnCount}\n labelLength={labelLength}\n stacked={applyMobileView}\n nested={nested}\n flex={asFlex}\n wrapped={asFlex ? !flexRow : false}\n variant={valueComparison ? 'value-comparison' : undefined}\n narrow={!isMdContentWidthOrAbove}\n >\n {children}\n </StyledDetailList>\n ) : null}\n </>\n );\n }, [\n highlightedData,\n nested,\n columnCount,\n labelLength,\n applyMobileView,\n name,\n asFlex,\n flexRow,\n valueComparison,\n children,\n testIds\n ]);\n\n if (!name && !children && !highlightedData && !description) return null;\n\n return (\n <DetailsContext.Provider value={contextValue}>\n <StyledDetails data-testid={testIds.root}>\n {name && (\n <StyledFieldValueGroupLabel data-testid={testIds.heading}>\n {collapsible ? (\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open ? 'true' : 'false'}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n <Icon name='caret-right' />\n {nameText}\n </Flex>\n </Button>\n ) : (\n nameText\n )}\n </StyledFieldValueGroupLabel>\n )}\n\n {description && (\n <StyledDetailDescription data-testid={testIds.description}>\n <HTML as='p' content={description} />\n </StyledDetailDescription>\n )}\n\n {collapsible ? (\n <ExpandCollapse data-testid={testIds.expandCollapse} collapsed={!open}>\n {details}\n </ExpandCollapse>\n ) : (\n details\n )}\n </StyledDetails>\n </DetailsContext.Provider>\n );\n});\n\nexport default withTestIds(Details, getDetailsTestIds);\n"]}
1
+ {"version":3,"file":"Details.js","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAA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AC,MAAM,aAC5D,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,EAC1B,QAAQ,IACJ,GACA,EACR,cAAc,IACd,CACJ,CAAC,CAAC,CAAC,CACF,8BACG,QAAQ,EACR,cAAc,IACd,CACJ,GACI,GACoB,CAC9B,EAEA,WAAW,IAAI,CACd,KAAC,uBAAuB,mBAAc,OAAO,CAAC,WAAW,YACvD,KAAC,IAAI,IAAC,EAAE,EAAC,GAAG,EAAC,OAAO,EAAE,WAAW,GAAI,GACb,CAC3B,EAEA,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,cAAc,mBAAc,OAAO,CAAC,cAAc,EAAE,SAAS,EAAE,CAAC,IAAI,YAClE,OAAO,GACO,CAClB,CAAC,CAAC,CAAC,CACF,OAAO,CACR,IACa,GACQ,CAC3B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { forwardRef, Fragment, useState, useContext, useEffect, useMemo } from 'react';\nimport type { FC, ReactNode, Ref } from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n AdditionalInfo,\n Text,\n useBreakpoint,\n useConsolidatedRef,\n useTheme,\n ExpandCollapse,\n Button,\n Flex,\n Icon,\n useChToPxConversionFactor,\n useI18n,\n HTML,\n useTestIds,\n withTestIds\n} from '@pega/cosmos-react-core';\nimport type {\n AdditionalInfoProps,\n ForwardProps,\n HeadingTag,\n TestIdProp\n} from '@pega/cosmos-react-core';\n\nimport { getDetailsTestIds } from './Details.test-ids';\nimport DetailsContext from './DetailsContext';\nimport {\n StyledFieldValueGroupLabel,\n StyledDetails,\n StyledDetailList,\n StyledHighlightedDetailList,\n flexGapProp,\n StyledDetailDescription\n} from './Details.styles';\n\nexport type DetailsProps = TestIdProp & {\n highlightedData?: ReactNode[];\n children?: ReactNode;\n /** Copy placed in paragraph below the name */\n description?: string;\n /**\n * Number of columns in detail layout\n * @default 1\n */\n columnCount?: 1 | 2 | 3;\n /** Whether detail list is rendering within another detail list\n * @default false\n */\n nested?: boolean;\n /** Whether detail list is rendering multiple sub-lists in columns (passed as children)\n * @default false\n */\n asFlex?: boolean;\n /** Whether to apply `value-comparison` styles to list items\n * @default false\n */\n valueComparison?: boolean;\n ref?: Ref<HTMLDListElement>;\n} & (\n | {\n /** Text used as heading of list */\n name: string;\n /** Pass a heading and content to show additional information on the list. */\n additionalInfo?: {\n heading?: AdditionalInfoProps['heading'];\n content: AdditionalInfoProps['children'];\n };\n /**\n * Whether the items children can be collapsed (only applies if name is provided)\n * @default false\n */\n collapsible?: boolean;\n }\n | {\n name?: undefined;\n additionalInfo?: never;\n collapsible?: never;\n }\n );\n\nconst Details: FC<DetailsProps & ForwardProps> = forwardRef(function Details(\n {\n testId,\n highlightedData,\n children,\n name,\n description,\n columnCount = 1,\n nested = false,\n asFlex = false,\n valueComparison = false,\n collapsible = false,\n additionalInfo: additionalInfoProp\n },\n ref\n) {\n const {\n longestLabelLength,\n mobileView: inMobileView,\n depth,\n ...context\n } = useContext(DetailsContext);\n const {\n base: {\n 'content-width': { sm: smContentWidth }\n }\n } = useTheme();\n const isSmallOrAbove = useBreakpoint('sm');\n const listRef = useConsolidatedRef<HTMLDListElement>(ref);\n const isXsContentWidthOrAbove = useBreakpoint('xs', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const isMdContentWidthOrAbove = useBreakpoint('md', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const flexRow = useBreakpoint(columnCount > 2 ? 'lg' : 'md', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const t = useI18n();\n const testIds = useTestIds(testId, getDetailsTestIds);\n\n const [flexContextMobileView, setFlexContextMobileView] = useState(false);\n const [open, setOpen] = useState(true);\n\n const labelLength = Math.max(14, Math.min(longestLabelLength ?? 16, 40));\n const headingDepth = depth ?? 1;\n const applyMobileView =\n inMobileView ||\n !isSmallOrAbove ||\n !isXsContentWidthOrAbove ||\n (asFlex && flexRow && flexContextMobileView);\n\n const chToPxConversionFactor = useChToPxConversionFactor();\n\n // Mount resize observer to update flex context mobile view & run initial check.\n useEffect(() => {\n const checkBreakpoint = (elementWidth: number) => {\n const minWidthPx = parseInt(smContentWidth, 10) * chToPxConversionFactor;\n const oneRemInPx = parseInt(remToPx(1), 10);\n const colGapPxAllowance = oneRemInPx * (0.5 * flexGapProp) * (columnCount - 1);\n const mobileViewBreakpoint = minWidthPx * columnCount + colGapPxAllowance;\n\n setFlexContextMobileView(elementWidth < mobileViewBreakpoint);\n };\n const resizeObserver = new ResizeObserver(entries => {\n const containerPxWidth = entries[0].contentRect.width;\n checkBreakpoint(containerPxWidth);\n });\n\n if (listRef.current) {\n checkBreakpoint(listRef.current.offsetWidth);\n resizeObserver.observe(listRef.current);\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [listRef, columnCount]);\n\n const contextValue = useMemo(() => {\n return {\n mobileView: applyMobileView,\n depth: name ? headingDepth + 1 : headingDepth,\n longestLabelLength,\n ...context\n };\n }, [applyMobileView, name, headingDepth, longestLabelLength, context]);\n\n const nameText = useMemo(() => {\n return <Text variant={`h${Math.min(headingDepth, 6)}` as HeadingTag}>{name}</Text>;\n }, [name, headingDepth]);\n\n const additionalInfo = useMemo(() => {\n return name && additionalInfoProp ? (\n <AdditionalInfo heading={additionalInfoProp.heading} contextualLabel={name}>\n {additionalInfoProp.content}\n </AdditionalInfo>\n ) : undefined;\n }, [name, additionalInfoProp?.heading, additionalInfoProp?.content]);\n\n const details = useMemo(() => {\n return (\n <>\n {highlightedData && (\n <>\n <Flex\n data-testid={testIds.highlightedData}\n as={StyledHighlightedDetailList}\n forwardedAs={nested ? 'div' : 'dl'}\n container={{ wrap: 'wrap', colGap: 10, rowGap: 1, alignItems: 'start' }}\n >\n {highlightedData.map((child, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>{child}</Fragment>\n ))}\n </Flex>\n\n <hr />\n </>\n )}\n\n {children ? (\n <StyledDetailList\n data-testid={testIds.data}\n ref={listRef}\n as={nested ? 'div' : 'dl'}\n columnCount={columnCount}\n labelLength={labelLength}\n stacked={applyMobileView}\n nested={nested}\n flex={asFlex}\n wrapped={asFlex ? !flexRow : false}\n variant={valueComparison ? 'value-comparison' : undefined}\n narrow={!isMdContentWidthOrAbove}\n >\n {children}\n </StyledDetailList>\n ) : null}\n </>\n );\n }, [\n highlightedData,\n nested,\n columnCount,\n labelLength,\n applyMobileView,\n name,\n asFlex,\n flexRow,\n valueComparison,\n children,\n testIds\n ]);\n\n if (!name && !children && !highlightedData && !description) return null;\n\n return (\n <DetailsContext.Provider value={contextValue}>\n <StyledDetails data-testid={testIds.root}>\n {name && (\n <StyledFieldValueGroupLabel data-testid={testIds.heading}>\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n {collapsible ? (\n <>\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open ? 'true' : 'false'}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n <Icon name='caret-right' />\n {nameText}\n </Flex>\n </Button>\n {additionalInfo}\n </>\n ) : (\n <>\n {nameText}\n {additionalInfo}\n </>\n )}\n </Flex>\n </StyledFieldValueGroupLabel>\n )}\n\n {description && (\n <StyledDetailDescription data-testid={testIds.description}>\n <HTML as='p' content={description} />\n </StyledDetailDescription>\n )}\n\n {collapsible ? (\n <ExpandCollapse data-testid={testIds.expandCollapse} collapsed={!open}>\n {details}\n </ExpandCollapse>\n ) : (\n details\n )}\n </StyledDetails>\n </DetailsContext.Provider>\n );\n});\n\nexport default withTestIds(Details, getDetailsTestIds);\n"]}
@@ -1,5 +1,5 @@
1
- import { DefaultTheme } from 'styled-components';
2
- import { StyledFieldValueListProps } from '@pega/cosmos-react-core';
1
+ import type { DefaultTheme } from 'styled-components';
2
+ import type { StyledFieldValueListProps } from '@pega/cosmos-react-core';
3
3
  interface StyledDetailListProps extends StyledFieldValueListProps {
4
4
  /** Whether individual list items all have labels stacks on top */
5
5
  stacked?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Details.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.styles.ts"],"names":[],"mappings":"AAAA,OAAe,EAAO,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAML,yBAAyB,EAM1B,MAAM,yBAAyB,CAAC;AAEjC,UAAU,qBAAsB,SAAQ,yBAAyB;IAC/D,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iCAAiC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;CACrB;AAUD,eAAO,MAAM,eAAe;;;;;;;;;;;;;CAa3B,CAAC;AAEF,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,eAAO,MAAM,0BAA0B,6EAyBrC,CAAC;AAIH,eAAO,MAAM,uBAAuB,6EAYlC,CAAC;AAIH,eAAO,MAAM,2BAA2B,4EAuBtC,CAAC;AAIH,eAAO,MAAM,aAAa,6EAAe,CAAC;AAE1C,eAAO,MAAM,gBAAgB,oRA+H5B,CAAC"}
1
+ {"version":3,"file":"Details.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAYtD,OAAO,KAAK,EACV,yBAAyB,EAG1B,MAAM,yBAAyB,CAAC;AAEjC,UAAU,qBAAsB,SAAQ,yBAAyB;IAC/D,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iCAAiC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;CACrB;AAUD,eAAO,MAAM,eAAe;;;;;;;;;;;;;CAa3B,CAAC;AAEF,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,eAAO,MAAM,0BAA0B,6EAyBrC,CAAC;AAIH,eAAO,MAAM,uBAAuB,6EAYlC,CAAC;AAIH,eAAO,MAAM,2BAA2B,4EAuBtC,CAAC;AAIH,eAAO,MAAM,aAAa,6EAAe,CAAC;AAE1C,eAAO,MAAM,gBAAgB,oRA+I5B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import styled, { css } from 'styled-components';
2
- import { calculateFontSize, defaultThemeProp, StyledFieldValue, StyledStackedFieldValue, StyledFieldValueList, StyledIcon, useDirection, StyledButton } from '@pega/cosmos-react-core';
2
+ import { calculateFontSize, defaultThemeProp, StyledFieldValue, StyledStackedFieldValue, StyledFieldValueList, StyledIcon, useDirection, StyledButtonLink } from '@pega/cosmos-react-core';
3
3
  const verticalGapSpacingMultiplier = 1;
4
4
  // colWidth reduces by 20% as column count increases
5
5
  export const colCountChWidth = {
@@ -27,15 +27,15 @@ export const StyledFieldValueGroupLabel = styled.div(({ theme }) => {
27
27
  margin-block-end: calc(0.5 * ${spacing});
28
28
  margin-block-start: calc(1.5 * ${spacing});
29
29
 
30
- ${StyledButton} ${StyledIcon} {
30
+ ${StyledButtonLink} ${StyledIcon} {
31
31
  transition: transform ${animation.speed} ${animation.timing.ease};
32
32
  }
33
33
 
34
- ${StyledButton}[aria-expanded='true'] ${StyledIcon} {
34
+ ${StyledButtonLink}[aria-expanded='true'] ${StyledIcon} {
35
35
  transform: rotate(90deg);
36
36
  }
37
37
 
38
- ${StyledButton}[aria-expanded='false'] ${StyledIcon} {
38
+ ${StyledButtonLink}[aria-expanded='false'] ${StyledIcon} {
39
39
  transform: rotate(${rtl ? 180 : 0}deg);
40
40
  }
41
41
  `;
@@ -110,6 +110,14 @@ export const StyledDetailList = styled(StyledFieldValueList)(({ stacked, flex, n
110
110
  css `
111
111
  grid-template-columns: minmax(0, 1fr);
112
112
  row-gap: 0;
113
+
114
+ ${!isValueComparison &&
115
+ css `
116
+ > dt,
117
+ ${StyledStackedFieldValue} {
118
+ margin-block-start: calc(${verticalGapSpacingMultiplier} * ${spacing});
119
+ }
120
+ `}
113
121
  `}
114
122
 
115
123
  > ${StyledStackedFieldValue} {
@@ -163,6 +171,14 @@ export const StyledDetailList = styled(StyledFieldValueList)(({ stacked, flex, n
163
171
 
164
172
  > ${StyledDetails} {
165
173
  width: 100%;
174
+
175
+ ${wrapped &&
176
+ !stacked &&
177
+ css `
178
+ + ${StyledDetails} > ${StyledDetailList}:first-child {
179
+ margin-block-start: ${theme.base.spacing};
180
+ }
181
+ `}
166
182
  }
167
183
  `}
168
184