@pega/cosmos-react-work 3.0.0-dev.8.0 → 3.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +4 -0
  2. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
  3. package/lib/components/AppAnnouncement/AppAnnouncement.js +3 -2
  4. package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
  5. package/lib/components/CasePreview/CasePreview.d.ts +2 -2
  6. package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
  7. package/lib/components/CasePreview/CasePreview.js +2 -2
  8. package/lib/components/CasePreview/CasePreview.js.map +1 -1
  9. package/lib/components/CaseView/CaseHeader.d.ts +4 -0
  10. package/lib/components/CaseView/CaseHeader.d.ts.map +1 -0
  11. package/lib/components/CaseView/CaseHeader.js +49 -0
  12. package/lib/components/CaseView/CaseHeader.js.map +1 -0
  13. package/lib/components/CaseView/CaseSummary.d.ts +4 -0
  14. package/lib/components/CaseView/CaseSummary.d.ts.map +1 -0
  15. package/lib/components/CaseView/CaseSummary.js +13 -0
  16. package/lib/components/CaseView/CaseSummary.js.map +1 -0
  17. package/lib/components/CaseView/CaseSummaryFields.d.ts +6 -0
  18. package/lib/components/CaseView/CaseSummaryFields.d.ts.map +1 -0
  19. package/lib/components/CaseView/CaseSummaryFields.js +8 -0
  20. package/lib/components/CaseView/CaseSummaryFields.js.map +1 -0
  21. package/lib/components/CaseView/CaseView.context.d.ts +5 -0
  22. package/lib/components/CaseView/CaseView.context.d.ts.map +1 -0
  23. package/lib/components/CaseView/CaseView.context.js +5 -0
  24. package/lib/components/CaseView/CaseView.context.js.map +1 -0
  25. package/lib/components/CaseView/CaseView.d.ts +2 -27
  26. package/lib/components/CaseView/CaseView.d.ts.map +1 -1
  27. package/lib/components/CaseView/CaseView.js +218 -190
  28. package/lib/components/CaseView/CaseView.js.map +1 -1
  29. package/lib/components/CaseView/CaseView.styles.d.ts +14 -17
  30. package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
  31. package/lib/components/CaseView/CaseView.styles.js +235 -41
  32. package/lib/components/CaseView/CaseView.styles.js.map +1 -1
  33. package/lib/components/CaseView/CaseView.types.d.ts +99 -0
  34. package/lib/components/CaseView/CaseView.types.d.ts.map +1 -0
  35. package/lib/components/CaseView/CaseView.types.js +2 -0
  36. package/lib/components/CaseView/CaseView.types.js.map +1 -0
  37. package/lib/components/CaseView/UtilitiesSummary.d.ts +4 -6
  38. package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
  39. package/lib/components/CaseView/UtilitiesSummary.js +6 -2
  40. package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
  41. package/lib/components/CaseView/index.d.ts +5 -2
  42. package/lib/components/CaseView/index.d.ts.map +1 -1
  43. package/lib/components/CaseView/index.js +4 -1
  44. package/lib/components/CaseView/index.js.map +1 -1
  45. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts +1 -1
  46. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts.map +1 -1
  47. package/lib/components/Confirmation/Confirmation.d.ts +2 -2
  48. package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
  49. package/lib/components/Confirmation/Confirmation.js +1 -1
  50. package/lib/components/Confirmation/Confirmation.js.map +1 -1
  51. package/lib/components/Details/Details.d.ts +31 -10
  52. package/lib/components/Details/Details.d.ts.map +1 -1
  53. package/lib/components/Details/Details.js +77 -35
  54. package/lib/components/Details/Details.js.map +1 -1
  55. package/lib/components/Details/Details.styles.d.ts +47 -0
  56. package/lib/components/Details/Details.styles.d.ts.map +1 -0
  57. package/lib/components/Details/Details.styles.js +243 -0
  58. package/lib/components/Details/Details.styles.js.map +1 -0
  59. package/lib/components/Details/DetailsContext.d.ts +9 -0
  60. package/lib/components/Details/DetailsContext.d.ts.map +1 -0
  61. package/lib/components/Details/DetailsContext.js +9 -0
  62. package/lib/components/Details/DetailsContext.js.map +1 -0
  63. package/lib/components/Details/index.d.ts +2 -2
  64. package/lib/components/Details/index.d.ts.map +1 -1
  65. package/lib/components/Details/index.js +2 -1
  66. package/lib/components/Details/index.js.map +1 -1
  67. package/lib/components/SearchResults/SearchResult.d.ts +1 -1
  68. package/lib/components/SearchResults/SearchResult.d.ts.map +1 -1
  69. package/lib/components/SearchResults/SearchResult.js +9 -3
  70. package/lib/components/SearchResults/SearchResult.js.map +1 -1
  71. package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
  72. package/lib/components/SearchResults/SearchResults.js +56 -37
  73. package/lib/components/SearchResults/SearchResults.js.map +1 -1
  74. package/lib/components/SearchResults/SearchResults.styles.d.ts +3 -0
  75. package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -1
  76. package/lib/components/SearchResults/SearchResults.styles.js +38 -17
  77. package/lib/components/SearchResults/SearchResults.styles.js.map +1 -1
  78. package/lib/components/SearchResults/SearchResults.types.d.ts +4 -0
  79. package/lib/components/SearchResults/SearchResults.types.d.ts.map +1 -1
  80. package/lib/components/SearchResults/SearchResults.types.js.map +1 -1
  81. package/lib/components/Stages/StageGlimpse.d.ts +10 -0
  82. package/lib/components/Stages/StageGlimpse.d.ts.map +1 -0
  83. package/lib/components/Stages/StageGlimpse.js +11 -0
  84. package/lib/components/Stages/StageGlimpse.js.map +1 -0
  85. package/lib/components/Stages/Stages.d.ts +1 -1
  86. package/lib/components/Stages/Stages.d.ts.map +1 -1
  87. package/lib/components/Stages/Stages.js +105 -112
  88. package/lib/components/Stages/Stages.js.map +1 -1
  89. package/lib/components/Stages/Stages.styles.d.ts +5 -7
  90. package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
  91. package/lib/components/Stages/Stages.styles.js +180 -189
  92. package/lib/components/Stages/Stages.styles.js.map +1 -1
  93. package/lib/components/Stages/Stages.types.d.ts +19 -4
  94. package/lib/components/Stages/Stages.types.d.ts.map +1 -1
  95. package/lib/components/Stages/Stages.types.js.map +1 -1
  96. package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
  97. package/lib/components/Stakeholders/Stakeholders.js +10 -4
  98. package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
  99. package/lib/components/Tags/Tags.d.ts.map +1 -1
  100. package/lib/components/Tags/Tags.js +23 -9
  101. package/lib/components/Tags/Tags.js.map +1 -1
  102. package/lib/components/Tasks/TaskList.d.ts +8 -5
  103. package/lib/components/Tasks/TaskList.d.ts.map +1 -1
  104. package/lib/components/Tasks/TaskList.js +12 -4
  105. package/lib/components/Tasks/TaskList.js.map +1 -1
  106. package/lib/components/Tasks/Tasks.d.ts.map +1 -1
  107. package/lib/components/Tasks/Tasks.js +2 -1
  108. package/lib/components/Tasks/Tasks.js.map +1 -1
  109. package/lib/components/Timeline/Timeline.styles.d.ts +1 -1
  110. package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
  111. package/lib/components/Timeline/Timeline.styles.js +1 -0
  112. package/lib/components/Timeline/Timeline.styles.js.map +1 -1
  113. package/lib/components/Timeline/TimelineItem.d.ts.map +1 -1
  114. package/lib/components/Timeline/TimelineItem.js +2 -2
  115. package/lib/components/Timeline/TimelineItem.js.map +1 -1
  116. package/lib/index.d.ts +0 -6
  117. package/lib/index.d.ts.map +1 -1
  118. package/lib/index.js +0 -6
  119. package/lib/index.js.map +1 -1
  120. package/package.json +7 -4
  121. package/lib/components/CaseHeader/CaseHeader.d.ts +0 -30
  122. package/lib/components/CaseHeader/CaseHeader.d.ts.map +0 -1
  123. package/lib/components/CaseHeader/CaseHeader.js +0 -119
  124. package/lib/components/CaseHeader/CaseHeader.js.map +0 -1
  125. package/lib/components/CaseHeader/index.d.ts +0 -4
  126. package/lib/components/CaseHeader/index.d.ts.map +0 -1
  127. package/lib/components/CaseHeader/index.js +0 -3
  128. package/lib/components/CaseHeader/index.js.map +0 -1
  129. package/lib/components/CaseSummary/CaseSummary.d.ts +0 -36
  130. package/lib/components/CaseSummary/CaseSummary.d.ts.map +0 -1
  131. package/lib/components/CaseSummary/CaseSummary.js +0 -130
  132. package/lib/components/CaseSummary/CaseSummary.js.map +0 -1
  133. package/lib/components/CaseSummary/index.d.ts +0 -4
  134. package/lib/components/CaseSummary/index.d.ts.map +0 -1
  135. package/lib/components/CaseSummary/index.js +0 -3
  136. package/lib/components/CaseSummary/index.js.map +0 -1
  137. package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts +0 -22
  138. package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts.map +0 -1
  139. package/lib/components/CaseSummaryFields/CaseSummaryFields.js +0 -25
  140. package/lib/components/CaseSummaryFields/CaseSummaryFields.js.map +0 -1
  141. package/lib/components/CaseSummaryFields/index.d.ts +0 -4
  142. package/lib/components/CaseSummaryFields/index.d.ts.map +0 -1
  143. package/lib/components/CaseSummaryFields/index.js +0 -3
  144. package/lib/components/CaseSummaryFields/index.js.map +0 -1
  145. package/lib/components/Stages/Steps.d.ts +0 -8
  146. package/lib/components/Stages/Steps.d.ts.map +0 -1
  147. package/lib/components/Stages/Steps.js +0 -12
  148. package/lib/components/Stages/Steps.js.map +0 -1
  149. package/lib/components/Stages/StepsContainer.d.ts +0 -8
  150. package/lib/components/Stages/StepsContainer.d.ts.map +0 -1
  151. package/lib/components/Stages/StepsContainer.js +0 -11
  152. package/lib/components/Stages/StepsContainer.js.map +0 -1
@@ -1,4 +1,7 @@
1
1
  export { default } from './CaseView';
2
- export { StyledCaseView, StyledCaseViewContent, StyledCaseDrawer, StyledCaseDrawerContent, StyledSummaryRegion } from './CaseView.styles';
2
+ export { StyledCaseView, StyledWorkArea as StyledCaseViewContent, StyledCaseDrawer, StyledCaseDrawerContent, StyledSummary as StyledSummaryRegion } from './CaseView.styles';
3
3
  export { default as MobileCaseView } from './MobileCaseView';
4
+ export { default as CaseSummary } from './CaseSummary';
5
+ export { default as CaseSummaryFields } from './CaseSummaryFields';
6
+ export { default as CaseHeader } from './CaseHeader';
4
7
  //# 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,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { default } from './CaseView';\nexport { CaseViewProps } from './CaseView';\nexport {\n StyledCaseView,\n StyledCaseViewContent,\n StyledCaseDrawer,\n StyledCaseDrawerContent,\n StyledSummaryRegion\n} from './CaseView.styles';\nexport { default as MobileCaseView } from './MobileCaseView';\nexport { MobileCaseViewProps } from './MobileCaseView';\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,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { default } from './CaseView';\nexport { 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 MobileCaseView } from './MobileCaseView';\nexport { MobileCaseViewProps } from './MobileCaseView';\nexport { default as CaseSummary } from './CaseSummary';\nexport { default as CaseSummaryFields } from './CaseSummaryFields';\nexport { default as CaseHeader } from './CaseHeader';\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Ref } from 'react';
2
- declare const useTrackWrappedRegions: (regionElArray: (HTMLElement | null)[], disabled?: boolean | undefined) => {
2
+ declare const useTrackWrappedRegions: (regionElArray: (HTMLElement | null)[], disabled?: boolean) => {
3
3
  containerRef: Ref<HTMLElement | null>;
4
4
  regionWrappedStates: boolean[];
5
5
  };
@@ -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;kBAEpB,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":"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"}
@@ -2,9 +2,9 @@ import { FunctionComponent, ReactNode, Ref } from 'react';
2
2
  import { ForwardProps, UnorderedListProps, NoChildrenProp } from '@pega/cosmos-react-core';
3
3
  export interface ConfirmationProps extends NoChildrenProp {
4
4
  /** The title of the confirmation */
5
- title: string;
5
+ title?: string;
6
6
  /** Region for a Field Value List component */
7
- details: ReactNode;
7
+ details?: ReactNode;
8
8
  /** Array of React nodes to be put into a list */
9
9
  whatsNext?: UnorderedListProps['items'];
10
10
  /** Region for a Tasks component */
@@ -1 +1 @@
1
- {"version":3,"file":"Confirmation.d.ts","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAGL,YAAY,EAOZ,kBAAkB,EAClB,cAAc,EACf,MAAM,yBAAyB,CAAC;AAQjC,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,OAAO,EAAE,SAAS,CAAC;IACnB,kDAAkD;IAClD,SAAS,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,mCAAmC;IACnC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAwCrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"Confirmation.d.ts","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAGL,YAAY,EAOZ,kBAAkB,EAClB,cAAc,EACf,MAAM,yBAAyB,CAAC;AAQjC,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,kDAAkD;IAClD,SAAS,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,mCAAmC;IACnC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAqCrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -8,7 +8,7 @@ const StyledWhatsNextList = styled(UnorderedList) `
8
8
  StyledWhatsNextList.defaultProps = defaultThemeProp;
9
9
  const Confirmation = forwardRef(({ title, details, whatsNext, tasks, onClose, ...restProps }, ref) => {
10
10
  const t = useI18n();
11
- return (_jsx(Card, { ...restProps, ref: ref, children: _jsx(CardContent, { children: _jsxs(Flex, { container: { gap: 3, direction: 'column' }, children: [_jsx(Text, { variant: 'h2', children: title }), _jsxs(Flex, { container: { gap: 1, direction: 'column' }, children: [_jsx(Text, { variant: 'h3', children: t('confirmation_details') }), details] }), whatsNext && (_jsxs(Flex, { container: { gap: 1, direction: 'column' }, children: [_jsx(Text, { variant: 'h3', children: t('confirmation_whats_next') }), _jsx(StyledWhatsNextList, { items: whatsNext, as: StyledWhatsNextList })] })), tasks && (_jsxs(Flex, { container: { gap: 1, direction: 'column' }, children: [_jsx(Text, { variant: 'h3', children: t('confirmation_open_tasks') }), tasks] })), onClose && (_jsx(Flex, { container: { justify: 'end' }, children: _jsx(Button, { onClick: onClose, variant: 'primary', children: t('done') }) }))] }) }) }));
11
+ return (_jsx(Card, { ...restProps, ref: ref, children: _jsx(CardContent, { children: _jsxs(Flex, { container: { gap: 3, direction: 'column' }, children: [title && _jsx(Text, { variant: 'h2', children: title }), details && (_jsxs(Flex, { container: { gap: 1, direction: 'column' }, children: [_jsx(Text, { variant: 'h3', children: t('confirmation_details') }), details] })), whatsNext && (_jsxs(Flex, { container: { gap: 1, direction: 'column' }, children: [_jsx(Text, { variant: 'h3', children: t('confirmation_whats_next') }), _jsx(StyledWhatsNextList, { items: whatsNext, as: StyledWhatsNextList })] })), tasks, onClose && (_jsx(Flex, { container: { justify: 'end' }, children: _jsx(Button, { onClick: onClose, variant: 'primary', children: t('done') }) }))] }) }) }));
12
12
  });
13
13
  export default Confirmation;
14
14
  //# sourceMappingURL=Confirmation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Confirmation.js","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,IAAI,EACJ,WAAW,EAEX,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,MAAM,EACN,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;CAEhD,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAiBpD,MAAM,YAAY,GAAwD,UAAU,CAClF,CACE,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,SAAS,EAAsC,EAC/F,GAAG,EACH,EAAE;IACF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,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,aAC9C,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,KAAK,GAAQ,EACjC,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAC9C,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,sBAAsB,CAAC,GAAQ,EACpD,OAAO,IACH,EACN,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,EACA,KAAK,IAAI,CACR,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,EACvD,KAAK,IACD,CACR,EACA,OAAO,IAAI,CACV,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,YACjC,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,SAAS,YACxC,CAAC,CAAC,MAAM,CAAC,GACH,GACJ,CACR,IACI,GACK,GACT,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, ReactNode, Ref } from 'react';\nimport styled 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} from '@pega/cosmos-react-core';\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 Confirmation: FunctionComponent<ConfirmationProps & ForwardProps> = forwardRef(\n (\n { title, details, whatsNext, tasks, onClose, ...restProps }: PropsWithoutRef<ConfirmationProps>,\n ref\n ) => {\n const t = useI18n();\n\n return (\n <Card {...restProps} ref={ref}>\n <CardContent>\n <Flex container={{ gap: 3, direction: 'column' }}>\n <Text variant='h2'>{title}</Text>\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h3'>{t('confirmation_details')}</Text>\n {details}\n </Flex>\n {whatsNext && (\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h3'>{t('confirmation_whats_next')}</Text>\n <StyledWhatsNextList items={whatsNext} as={StyledWhatsNextList} />\n </Flex>\n )}\n {tasks && (\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h3'>{t('confirmation_open_tasks')}</Text>\n {tasks}\n </Flex>\n )}\n {onClose && (\n <Flex container={{ justify: 'end' }}>\n <Button onClick={onClose} variant='primary'>\n {t('done')}\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,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,IAAI,EACJ,WAAW,EAEX,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,MAAM,EACN,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;C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,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, ReactNode, Ref } from 'react';\nimport styled 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} from '@pega/cosmos-react-core';\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 Confirmation: FunctionComponent<ConfirmationProps & ForwardProps> = forwardRef(\n (\n { title, details, whatsNext, tasks, onClose, ...restProps }: PropsWithoutRef<ConfirmationProps>,\n ref\n ) => {\n const t = useI18n();\n\n return (\n <Card {...restProps} ref={ref}>\n <CardContent>\n <Flex container={{ gap: 3, direction: 'column' }}>\n {title && <Text variant='h2'>{title}</Text>}\n {details && (\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h3'>{t('confirmation_details')}</Text>\n {details}\n </Flex>\n )}\n {whatsNext && (\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h3'>{t('confirmation_whats_next')}</Text>\n <StyledWhatsNextList items={whatsNext} as={StyledWhatsNextList} />\n </Flex>\n )}\n {tasks}\n {onClose && (\n <Flex container={{ justify: 'end' }}>\n <Button onClick={onClose} variant='primary'>\n {t('done')}\n </Button>\n </Flex>\n )}\n </Flex>\n </CardContent>\n </Card>\n );\n }\n);\n\nexport default Confirmation;\n"]}
@@ -1,13 +1,34 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { FieldValueListProps, ForwardProps, BaseProps, NoChildrenProp } from '@pega/cosmos-react-core';
3
- export interface DetailsProps extends BaseProps, NoChildrenProp {
4
- /** The set of field values to render in the Highlighted Data list. */
5
- highlightedFields?: FieldValueListProps['fields'];
6
- /** List of React components below the highlighted data and line seperation. */
7
- regions?: [ReactNode] | [ReactNode, ReactNode] | [ReactNode, ReactNode, ReactNode];
1
+ import { FC, ReactNode, Ref } from 'react';
2
+ import { ForwardProps } from '@pega/cosmos-react-core';
3
+ export interface DetailsProps {
4
+ highlightedData?: ReactNode[];
5
+ children?: ReactNode;
6
+ /** Text used as heading of list */
7
+ name?: string;
8
+ /**
9
+ * Whether the items children can be collapsed (only applies if name is provided)
10
+ * @default false
11
+ */
12
+ collapsible?: boolean;
13
+ /**
14
+ * Number of columns in detail layout
15
+ * @default 1
16
+ */
17
+ columnCount?: 1 | 2 | 3;
18
+ /** Whether detail list is rendering within another detail list
19
+ * @default false
20
+ */
21
+ nested?: boolean;
22
+ /** Whether detail list is rendering multiple sub-lists in columns (passed as children)
23
+ * @default false
24
+ */
25
+ asFlex?: boolean;
26
+ /** Whether to apply `value-comparison` styles to list items
27
+ * @default false
28
+ */
29
+ valueComparison?: boolean;
30
+ ref?: Ref<HTMLDListElement>;
8
31
  }
9
- export declare const StyledDetails: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
- export declare const StyledHighlightedFields: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
11
- declare const Details: FunctionComponent<DetailsProps & ForwardProps>;
32
+ declare const Details: FC<DetailsProps & ForwardProps>;
12
33
  export default Details;
13
34
  //# sourceMappingURL=Details.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Details.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,EA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AA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,GAAG,YAAY,CA8J5C,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1,38 +1,80 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import styled, { css } from 'styled-components';
3
- import { Grid, defaultThemeProp, FieldValueList, StyledFieldValueList, calculateFontSize } from '@pega/cosmos-react-core';
4
- export const StyledDetails = styled.div ``;
5
- export const StyledHighlightedFields = styled.div(({ theme }) => {
6
- const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
7
- return css `
8
- ${StyledFieldValueList} {
9
- display: grid;
10
- grid-template-columns: repeat(auto-fill, minmax(20ch, 1fr));
11
- padding-block-end: calc(1.5 * ${theme.base.spacing});
12
- border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};
13
- column-gap: calc(5 * ${theme.base.spacing});
14
- dd {
15
- font-size: ${fontSize[theme.components.text.h1['font-size']]};
16
- font-weight: ${theme.components.text.h1['font-weight']};
17
- }
18
- }
19
-
20
- & + div {
21
- padding-block-start: calc(1.5 * ${theme.base.spacing});
22
- }
23
- `;
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, Fragment, useState, useContext, useEffect, useMemo } from 'react';
3
+ import { remToPx } from 'polished';
4
+ import { Text, useBreakpoint, useConsolidatedRef, useTheme, ExpandCollapse, Button, Flex, Icon, useI18n } from '@pega/cosmos-react-core';
5
+ import DetailsContext from './DetailsContext';
6
+ import { StyledFieldValueGroupLabel, StyledDetails, StyledDetailList, StyledHighlightedDetailList, flexGapProp, chToRem } from './Details.styles';
7
+ const Details = forwardRef(({ highlightedData, children, name, columnCount = 1, nested = false, asFlex = false, valueComparison = false, collapsible = false }, ref) => {
8
+ const { longestLabelLength, mobileView, depth, ...context } = useContext(DetailsContext);
9
+ const { base: { 'content-width': { sm } } } = useTheme();
10
+ const isSmallOrAbove = useBreakpoint('sm');
11
+ const listRef = useConsolidatedRef(ref);
12
+ const flexRow = useBreakpoint(columnCount > 2 ? 'md' : 'sm', {
13
+ breakpointRef: listRef,
14
+ themeProp: 'content-width'
15
+ });
16
+ const t = useI18n();
17
+ const [flexContextMobileView, setFlexContextMobileView] = useState(false);
18
+ const [open, setOpen] = useState(true);
19
+ const labelLength = Math.max(14, Math.min(longestLabelLength ?? 16, 40));
20
+ const headingDepth = depth ?? 1;
21
+ const applyMobileView = asFlex
22
+ ? mobileView || (flexRow && flexContextMobileView) || !isSmallOrAbove
23
+ : mobileView || !isSmallOrAbove;
24
+ /**
25
+ * Mount resize observer to update flex context mobile view & run initial check.
26
+ */
27
+ useEffect(() => {
28
+ const checkBreakpoint = (elementWidth) => {
29
+ const minWidthRem = chToRem(parseInt(sm, 10));
30
+ const minWidthPx = parseInt(remToPx(minWidthRem), 10);
31
+ const oneRemInPx = parseInt(remToPx(1), 10);
32
+ const colGapPxAllowance = oneRemInPx * (0.5 * flexGapProp) * (columnCount - 1);
33
+ const mobileViewBreakpoint = minWidthPx * columnCount + colGapPxAllowance;
34
+ setFlexContextMobileView(elementWidth < mobileViewBreakpoint);
35
+ };
36
+ const resizeObserver = new ResizeObserver(entries => {
37
+ const containerPxWidth = entries[0].contentRect.width;
38
+ checkBreakpoint(containerPxWidth);
39
+ });
40
+ if (listRef.current) {
41
+ checkBreakpoint(listRef.current.offsetWidth);
42
+ resizeObserver.observe(listRef.current);
43
+ }
44
+ return () => {
45
+ resizeObserver.disconnect();
46
+ };
47
+ }, [listRef, columnCount]);
48
+ const contextValue = useMemo(() => {
49
+ return {
50
+ mobileView: applyMobileView,
51
+ depth: name ? headingDepth + 1 : headingDepth,
52
+ longestLabelLength,
53
+ ...context
54
+ };
55
+ }, [applyMobileView, name, headingDepth, longestLabelLength, context]);
56
+ const nameText = useMemo(() => {
57
+ return (_jsx(Text, { variant: `h${Math.min(headingDepth, 6)}`, children: name }));
58
+ }, [name, headingDepth]);
59
+ const details = useMemo(() => {
60
+ return (_jsxs(_Fragment, { children: [highlightedData && (_jsxs(_Fragment, { children: [_jsx(StyledHighlightedDetailList, { as: nested ? 'div' : 'dl', children: highlightedData.map((child, i) => (
61
+ // eslint-disable-next-line react/no-array-index-key
62
+ _jsx(Fragment, { children: child }, i))) }), _jsx("hr", {})] })), _jsx(StyledDetailList, { ref: listRef, as: nested ? 'div' : 'dl', columnCount: columnCount, labelLength: labelLength, stacked: applyMobileView, hasName: !!name, nested: nested, flex: asFlex, wrapped: asFlex ? !flexRow : false, variant: valueComparison ? 'value-comparison' : undefined, children: children })] }));
63
+ }, [
64
+ highlightedData,
65
+ nested,
66
+ columnCount,
67
+ labelLength,
68
+ applyMobileView,
69
+ name,
70
+ asFlex,
71
+ flexRow,
72
+ valueComparison,
73
+ children
74
+ ]);
75
+ return (_jsx(DetailsContext.Provider, { value: contextValue, children: _jsxs(StyledDetails, { children: [name && (_jsx(StyledFieldValueGroupLabel, { children: collapsible ? (_jsx(Button, { type: 'button', variant: 'text', onClick: () => {
76
+ setOpen(cur => !cur);
77
+ }, "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) })), collapsible ? _jsx(ExpandCollapse, { collapsed: !open, children: details }) : details] }) }));
24
78
  });
25
- StyledHighlightedFields.defaultProps = defaultThemeProp;
26
- const Details = ({ highlightedFields, regions }) => {
27
- return (_jsxs(StyledDetails, { children: [highlightedFields && (_jsx(StyledHighlightedFields, { children: _jsx(FieldValueList, { variant: 'stacked', fields: highlightedFields }) })), regions && regions.length > 0 && (_jsx(Grid, { container: {
28
- cols: 'repeat(auto-fit, minmax(30ch, 1fr))',
29
- alignItems: 'start',
30
- alignContent: 'start',
31
- gap: 2
32
- }, children: regions?.map((colItem, i) => {
33
- // eslint-disable-next-line react/no-array-index-key
34
- return _jsx("div", { children: colItem }, i);
35
- }) }))] }));
36
- };
37
79
  export default Details;
38
80
  //# sourceMappingURL=Details.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Details.js","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EAIpB,iBAAiB,EAGlB,MAAM,yBAAyB,CAAC;AASjC,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC9D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACtF,OAAO,GAAG,CAAA;MACN,oBAAoB;;;sCAGY,KAAK,CAAC,IAAI,CAAC,OAAO;uCACjB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;6BAC3C,KAAK,CAAC,IAAI,CAAC,OAAO;;qBAE1B,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAa,CAAC;uBACzD,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC;;;;;wCAKtB,KAAK,CAAC,IAAI,CAAC,OAAO;;GAEvD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,OAAO,GAAmD,CAAC,EAC/D,iBAAiB,EACjB,OAAO,EACM,EAAE,EAAE;IACjB,OAAO,CACL,MAAC,aAAa,eACX,iBAAiB,IAAI,CACpB,KAAC,uBAAuB,cACtB,KAAC,cAAc,IAAC,OAAO,EAAC,SAAS,EAAC,MAAM,EAAE,iBAAiB,GAAI,GACvC,CAC3B,EACA,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CAChC,KAAC,IAAI,IACH,SAAS,EAAE;oBACT,IAAI,EAAE,qCAAqC;oBAC3C,UAAU,EAAE,OAAO;oBACnB,YAAY,EAAE,OAAO;oBACrB,GAAG,EAAE,CAAC;iBACP,YAEA,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;oBAC3B,oDAAoD;oBACpD,OAAO,wBAAc,OAAO,IAAX,CAAC,CAAiB,CAAC;gBACtC,CAAC,CAAC,GACG,CACR,IACa,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import { FunctionComponent, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Grid,\n defaultThemeProp,\n FieldValueList,\n StyledFieldValueList,\n FieldValueListProps,\n ForwardProps,\n BaseProps,\n calculateFontSize,\n FontSize,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\n\nexport interface DetailsProps extends BaseProps, NoChildrenProp {\n /** The set of field values to render in the Highlighted Data list. */\n highlightedFields?: FieldValueListProps['fields'];\n /** List of React components below the highlighted data and line seperation. */\n regions?: [ReactNode] | [ReactNode, ReactNode] | [ReactNode, ReactNode, ReactNode];\n}\n\nexport const StyledDetails = styled.div``;\n\nexport const StyledHighlightedFields = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n return css`\n ${StyledFieldValueList} {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(20ch, 1fr));\n padding-block-end: calc(1.5 * ${theme.base.spacing});\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n column-gap: calc(5 * ${theme.base.spacing});\n dd {\n font-size: ${fontSize[theme.components.text.h1['font-size'] as FontSize]};\n font-weight: ${theme.components.text.h1['font-weight']};\n }\n }\n\n & + div {\n padding-block-start: calc(1.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledHighlightedFields.defaultProps = defaultThemeProp;\n\nconst Details: FunctionComponent<DetailsProps & ForwardProps> = ({\n highlightedFields,\n regions\n}: DetailsProps) => {\n return (\n <StyledDetails>\n {highlightedFields && (\n <StyledHighlightedFields>\n <FieldValueList variant='stacked' fields={highlightedFields} />\n </StyledHighlightedFields>\n )}\n {regions && regions.length > 0 && (\n <Grid\n container={{\n cols: 'repeat(auto-fit, minmax(30ch, 1fr))',\n alignItems: 'start',\n alignContent: 'start',\n gap: 2\n }}\n >\n {regions?.map((colItem, i) => {\n // eslint-disable-next-line react/no-array-index-key\n return <div key={i}>{colItem}</div>;\n })}\n </Grid>\n )}\n </StyledDetails>\n );\n};\n\nexport default Details;\n"]}
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,OAAO,EACR,MAAM,yBAAyB,CAAC;AAEjC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,gBAAgB,EAChB,2BAA2B,EAC3B,WAAW,EACX,OAAO,EACR,MAAM,kBAAkB,CAAC;AAgC1B,MAAM,OAAO,GAAoC,UAAU,CACzD,CACE,EACE,eAAe,EACf,QAAQ,EACR,IAAI,EACJ,WAAW,GAAG,CAAC,EACf,MAAM,GAAG,KAAK,EACd,MAAM,GAAG,KAAK,EACd,eAAe,GAAG,KAAK,EACvB,WAAW,GAAG,KAAK,EACp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T,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC1C,MAAC,aAAa,eACX,IAAI,IAAI,CACP,KAAC,0BAA0B,cACxB,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,CAAC,CAAC,CAAC,KAAC,cAAc,IAAC,SAAS,EAAE,CAAC,IAAI,YAAG,OAAO,GAAkB,CAAC,CAAC,CAAC,OAAO,IACvE,GACQ,CAC3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,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 useI18n\n} from '@pega/cosmos-react-core';\n\nimport DetailsContext from './DetailsContext';\nimport {\n StyledFieldValueGroupLabel,\n StyledDetails,\n StyledDetailList,\n StyledHighlightedDetailList,\n flexGapProp,\n chToRem\n} from './Details.styles';\n\nexport interface DetailsProps {\n highlightedData?: ReactNode[];\n children?: ReactNode;\n /** Text used as heading of list */\n name?: 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(\n (\n {\n highlightedData,\n children,\n name,\n columnCount = 1,\n nested = false,\n asFlex = false,\n valueComparison = false,\n collapsible = false\n },\n ref\n ) => {\n const { longestLabelLength, mobileView, depth, ...context } = useContext(DetailsContext);\n const {\n base: {\n 'content-width': { sm }\n }\n } = useTheme();\n const isSmallOrAbove = useBreakpoint('sm');\n const listRef = useConsolidatedRef<HTMLDListElement>(ref);\n const flexRow = useBreakpoint(columnCount > 2 ? 'md' : 'sm', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const t = useI18n();\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 = asFlex\n ? mobileView || (flexRow && flexContextMobileView) || !isSmallOrAbove\n : mobileView || !isSmallOrAbove;\n\n /**\n * Mount resize observer to update flex context mobile view & run initial check.\n */\n useEffect(() => {\n const checkBreakpoint = (elementWidth: number) => {\n const minWidthRem = chToRem(parseInt(sm, 10));\n const minWidthPx = parseInt(remToPx(minWidthRem), 10);\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 (\n <Text variant={`h${Math.min(headingDepth, 6)}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'}>\n {name}\n </Text>\n );\n }, [name, headingDepth]);\n\n const details = useMemo(() => {\n return (\n <>\n {highlightedData && (\n <>\n <StyledHighlightedDetailList as={nested ? 'div' : 'dl'}>\n {highlightedData.map((child, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>{child}</Fragment>\n ))}\n </StyledHighlightedDetailList>\n\n <hr />\n </>\n )}\n\n <StyledDetailList\n ref={listRef}\n as={nested ? 'div' : 'dl'}\n columnCount={columnCount}\n labelLength={labelLength}\n stacked={applyMobileView}\n hasName={!!name}\n nested={nested}\n flex={asFlex}\n wrapped={asFlex ? !flexRow : false}\n variant={valueComparison ? 'value-comparison' : undefined}\n >\n {children}\n </StyledDetailList>\n </>\n );\n }, [\n highlightedData,\n nested,\n columnCount,\n labelLength,\n applyMobileView,\n name,\n asFlex,\n flexRow,\n valueComparison,\n children\n ]);\n\n return (\n <DetailsContext.Provider value={contextValue}>\n <StyledDetails>\n {name && (\n <StyledFieldValueGroupLabel>\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 {collapsible ? <ExpandCollapse collapsed={!open}>{details}</ExpandCollapse> : details}\n </StyledDetails>\n </DetailsContext.Provider>\n );\n }\n);\n\nexport default Details;\n"]}
@@ -0,0 +1,47 @@
1
+ import { DefaultTheme } from 'styled-components';
2
+ import { StyledFieldValueListProps } from '@pega/cosmos-react-core';
3
+ interface StyledDetailListProps extends StyledFieldValueListProps {
4
+ /** Whether individual list items all have labels stacks on top */
5
+ stacked?: boolean;
6
+ /** Whether the list is a flex row of other lists */
7
+ flex?: boolean;
8
+ /** Whether the list has a name attribute */
9
+ hasName?: boolean;
10
+ /** Whether the list is nested */
11
+ nested?: boolean;
12
+ /** The character length applied to all list labels */
13
+ labelLength?: number;
14
+ /**
15
+ * Whether the list is wrapped to 1 column
16
+ * @default false
17
+ */
18
+ wrapped?: boolean;
19
+ /**
20
+ * Number of columns in the list
21
+ * @default 1
22
+ */
23
+ columnCount?: 1 | 2 | 3;
24
+ theme: DefaultTheme;
25
+ }
26
+ export declare const colCountChWidth: {
27
+ '1': {
28
+ containerWidth: number;
29
+ colWidth: number;
30
+ };
31
+ '2': {
32
+ containerWidth: number;
33
+ colWidth: number;
34
+ };
35
+ '3': {
36
+ containerWidth: number;
37
+ colWidth: number;
38
+ };
39
+ };
40
+ export declare const flexGapProp = 5.5;
41
+ export declare const chToRem: (chVal: number) => number;
42
+ export declare const StyledFieldValueGroupLabel: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
43
+ export declare const StyledHighlightedDetailList: import("styled-components").StyledComponent<"dl", DefaultTheme, {}, never>;
44
+ export declare const StyledDetails: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
45
+ export declare const StyledDetailList: import("styled-components").StyledComponent<"dl", DefaultTheme, StyledFieldValueListProps & import("@pega/cosmos-react-core").OmitStrict<StyledDetailListProps, "columnCount" | "wrapped"> & Required<Pick<StyledDetailListProps, "columnCount" | "wrapped">>, never>;
46
+ export {};
47
+ //# sourceMappingURL=Details.styles.d.ts.map
@@ -0,0 +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,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,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,KAAK,EAAE,YAAY,CAAC;CACrB;AAUD,eAAO,MAAM,eAAe;;;;;;;;;;;;;CAa3B,CAAC;AAEF,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,MAEvC,CAAC;AAEF,eAAO,MAAM,0BAA0B,6EA4BrC,CAAC;AAIH,eAAO,MAAM,2BAA2B,4EA4BtC,CAAC;AAIH,eAAO,MAAM,aAAa,6EAIxB,CAAC;AAkCH,eAAO,MAAM,gBAAgB,uQAwJ5B,CAAC"}
@@ -0,0 +1,243 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { calculateFontSize, defaultThemeProp, StyledFieldValue, StyledStackedFieldValue, StyledFieldValueList, StyledIcon, useDirection, StyledButton } from '@pega/cosmos-react-core';
3
+ const verticalGapSpacingMultiplier = 1;
4
+ // colWidth reduces by 20% as column count increases
5
+ export const colCountChWidth = {
6
+ '1': {
7
+ containerWidth: 100,
8
+ colWidth: 100
9
+ },
10
+ '2': {
11
+ containerWidth: 80 * 2,
12
+ colWidth: 80
13
+ },
14
+ '3': {
15
+ containerWidth: 64 * 3,
16
+ colWidth: 64
17
+ }
18
+ };
19
+ export const flexGapProp = 5.5;
20
+ export const chToRem = (chVal) => {
21
+ return chVal / 2;
22
+ };
23
+ export const StyledFieldValueGroupLabel = styled.div(({ theme }) => {
24
+ const { base: { spacing, animation } } = theme;
25
+ const { rtl } = useDirection();
26
+ return css `
27
+ width: 100%;
28
+ grid-column-start: 1;
29
+ grid-column-end: -1;
30
+ margin-block-end: calc(0.5 * ${spacing});
31
+
32
+ &:not(:first-child) {
33
+ margin-block-start: calc(3 * ${spacing});
34
+ }
35
+
36
+ ${StyledButton} ${StyledIcon} {
37
+ transition: transform ${animation.speed} ${animation.timing.ease};
38
+ }
39
+
40
+ ${StyledButton}[aria-expanded='true'] ${StyledIcon} {
41
+ transform: rotate(90deg);
42
+ }
43
+
44
+ ${StyledButton}[aria-expanded='false'] ${StyledIcon} {
45
+ transform: rotate(${rtl ? 180 : 0}deg);
46
+ }
47
+ `;
48
+ });
49
+ StyledFieldValueGroupLabel.defaultProps = defaultThemeProp;
50
+ export const StyledHighlightedDetailList = styled.dl(({ theme }) => {
51
+ const { base: { spacing, palette } } = theme;
52
+ const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
53
+ return css `
54
+ display: grid;
55
+ grid-template-columns: repeat(auto-fit, minmax(40ch, 1fr));
56
+ column-gap: calc(5 * ${spacing});
57
+ gap: calc(2 * ${spacing});
58
+ align-items: start;
59
+ max-width: ${`${colCountChWidth[3].containerWidth}ch}`};
60
+ padding-block-end: calc(1.5 * ${spacing});
61
+
62
+ dd {
63
+ font-size: ${fontSize[theme.components.text.h1['font-size']]};
64
+ font-weight: ${theme.components.text.h1['font-weight']};
65
+ }
66
+
67
+ + hr {
68
+ border-top: unset;
69
+ border-radius: unset;
70
+ border-style: unset;
71
+ border-bottom: 0.0625rem solid ${palette['border-line']};
72
+ margin-block-end: calc(1.5 * ${spacing});
73
+ }
74
+ `;
75
+ });
76
+ StyledHighlightedDetailList.defaultProps = defaultThemeProp;
77
+ export const StyledDetails = styled.div(() => {
78
+ return css `
79
+ grid-column: 1 / -1;
80
+ `;
81
+ });
82
+ StyledDetails.defaultProps = defaultThemeProp;
83
+ const nthRecursiveContainerSelector = (depth, includeAllImmediateContainers) => {
84
+ const firstContainerSelector = '> div:first-child';
85
+ const baseSelector = includeAllImmediateContainers ? '> div' : firstContainerSelector;
86
+ return baseSelector.concat(` ${firstContainerSelector}`.repeat(depth));
87
+ };
88
+ const initialLabelNoMargin = (applyToAllChildren = false) => {
89
+ return css `
90
+ ${nthRecursiveContainerSelector(0, applyToAllChildren)},
91
+ ${nthRecursiveContainerSelector(1, applyToAllChildren)},
92
+ ${nthRecursiveContainerSelector(2, applyToAllChildren)},
93
+ ${nthRecursiveContainerSelector(3, applyToAllChildren)},
94
+ ${nthRecursiveContainerSelector(4, applyToAllChildren)},
95
+ ${nthRecursiveContainerSelector(5, applyToAllChildren)},
96
+ ${nthRecursiveContainerSelector(6, applyToAllChildren)},
97
+ ${nthRecursiveContainerSelector(7, applyToAllChildren)},
98
+ ${nthRecursiveContainerSelector(8, applyToAllChildren)},
99
+ ${nthRecursiveContainerSelector(9, applyToAllChildren)},
100
+ ${nthRecursiveContainerSelector(10, applyToAllChildren)} {
101
+ > ${StyledFieldValueGroupLabel}:first-child {
102
+ margin-block-start: 0;
103
+ }
104
+ }
105
+ `;
106
+ };
107
+ export const StyledDetailList = styled(StyledFieldValueList)(({ stacked, flex, hasName, nested, labelLength, variant, theme, wrapped = false, columnCount = 1 }) => {
108
+ const { base: { spacing } } = theme;
109
+ const isValueComparison = variant === 'value-comparison';
110
+ const containerWidthCh = colCountChWidth[columnCount].containerWidth;
111
+ const containerWidthMinusLabel = `${containerWidthCh - (labelLength ?? 0)}ch`;
112
+ return css `
113
+ /* Top Level Styles */
114
+ ${!nested &&
115
+ css `
116
+ ${StyledFieldValue} {
117
+ word-break: break-word;
118
+ overflow: auto;
119
+ }
120
+
121
+ ${StyledFieldValueGroupLabel} {
122
+ margin-block-start: calc(3 * ${spacing});
123
+ }
124
+
125
+ > ${StyledFieldValueGroupLabel}:nth-child(1) {
126
+ margin-block-start: 0;
127
+ }
128
+
129
+ ${StyledStackedFieldValue} {
130
+ grid-column: 1 / -1;
131
+ }
132
+ `}
133
+
134
+ /* Nested List */
135
+ ${nested &&
136
+ css `
137
+ grid-column: 1 / -1;
138
+ `}
139
+
140
+ /* As Field Grid */
141
+ ${!flex &&
142
+ css `
143
+ display: grid;
144
+ grid-template-columns: ${`minmax(14ch, ${labelLength}ch) minmax(14ch, 1fr)`};
145
+ column-gap: calc(2 * ${spacing});
146
+ row-gap: calc(${verticalGapSpacingMultiplier} * ${spacing});
147
+
148
+ ${stacked &&
149
+ css `
150
+ grid-template-columns: minmax(0, 1fr);
151
+ row-gap: 0;
152
+ `}
153
+
154
+ > ${StyledStackedFieldValue} {
155
+ max-width: ${`${containerWidthCh}ch`};
156
+ }
157
+
158
+ > ${StyledFieldValue} {
159
+ max-width: calc(${containerWidthMinusLabel} - calc(2 * ${spacing}));
160
+ }
161
+
162
+ ${isValueComparison &&
163
+ css `
164
+ grid-template-columns: auto auto;
165
+ column-gap: 0;
166
+ row-gap: calc(0.5 * ${spacing});
167
+ max-width: ${`${containerWidthCh}ch`};
168
+ `}
169
+ `}
170
+
171
+ /* As Flex Container */
172
+ ${flex &&
173
+ css `
174
+ display: flex;
175
+ flex-direction: ${wrapped ? 'column' : 'row'};
176
+ column-gap: calc(${flexGapProp} * ${spacing});
177
+ align-items: flex-start;
178
+
179
+ max-width: ${`${containerWidthCh}ch`};
180
+
181
+ ${!wrapped &&
182
+ css `
183
+ > * {
184
+ max-width: ${`${100 / columnCount}%`};
185
+ }
186
+
187
+ ${hasName && initialLabelNoMargin(true)}
188
+ `}
189
+
190
+ ${wrapped &&
191
+ css `
192
+ ${hasName && initialLabelNoMargin()}
193
+
194
+ ${!stacked &&
195
+ css `
196
+ > div:not(:first-child) {
197
+ margin-block-start: calc(${verticalGapSpacingMultiplier} * ${spacing});
198
+ }
199
+ `}}
200
+ `}
201
+ `}
202
+
203
+ /* Key / Group Label Spacing */
204
+ ${!nested &&
205
+ css `
206
+ > div {
207
+ + dt {
208
+ margin-block-start: calc(3 * ${spacing});
209
+ }
210
+
211
+ + ${StyledStackedFieldValue} {
212
+ margin-block-start: calc(3 * ${spacing});
213
+ }
214
+
215
+ ${!stacked &&
216
+ css `
217
+ + dt + dd {
218
+ margin-block-start: calc(3 * ${spacing});
219
+ }
220
+ `}
221
+ }
222
+
223
+ ${initialLabelNoMargin()}
224
+ `}
225
+
226
+ ${stacked &&
227
+ css `
228
+ dt {
229
+ margin-block-start: calc(${verticalGapSpacingMultiplier} * ${spacing});
230
+ }
231
+ `}
232
+
233
+ ${StyledFieldValueGroupLabel} + div {
234
+ > ${StyledFieldValueGroupLabel}:first-child {
235
+ margin-block-start: 0;
236
+ }
237
+
238
+ ${initialLabelNoMargin()}
239
+ }
240
+ `;
241
+ });
242
+ StyledDetailList.defaultProps = defaultThemeProp;
243
+ //# sourceMappingURL=Details.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Details.styles.js","sourceRoot":"","sources":["../../../src/components/Details/Details.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAgB,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EAEpB,UAAU,EAGV,YAAY,EACZ,YAAY,EACb,MAAM,yBAAyB,CAAC;AA+BjC,M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;;iCAEwB,gBAAgB,WAAW,uBAAuB;+BACpD,OAAO;wBACd,4BAA4B,MAAM,OAAO;;UAEvD,OAAO;YACT,GAAG,CAAA;;;SAGF;;YAEG,uBAAuB;uBACZ,GAAG,gBAAgB,IAAI;;;YAGlC,gBAAgB;4BACA,wBAAwB,eAAe,OAAO;;;UAGhE,iBAAiB;YACnB,GAAG,CAAA;;;gCAGqB,OAAO;uBAChB,GAAG,gBAAgB,IAAI;SACrC;OACF;;;QAGC,IAAI;QACN,GAAG,CAAA;;0BAEiB,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK;2BACzB,WAAW,MAAM,OAAO;;;qBAG9B,GAAG,gBAAgB,IAAI;;UAElC,CAAC,OAAO;YACV,GAAG,CAAA;;yBAEc,GAAG,GAAG,GAAG,WAAW,GAAG;;;YAGpC,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC;SACxC;;UAEC,OAAO;YACT,GAAG,CAAA;YACC,OAAO,IAAI,oBAAoB,EAAE;;YAGjC,CAAC,OAAO;gBACR,GAAG,CAAA;;2CAE4B,4BAA4B,MAAM,OAAO;;aAG1E;SACD;OACF;;;QAGC,CAAC,MAAM;QACT,GAAG,CAAA;;;2CAGkC,OAAO;;;cAGpC,uBAAuB;2CACM,OAAO;;;YAGtC,CAAC,OAAO;YACV,GAAG,CAAA;;6CAEgC,OAAO;;WAEzC;;;UAGD,oBAAoB,EAAE;OACzB;;QAEC,OAAO;QACT,GAAG,CAAA;;qCAE4B,4BAA4B,MAAM,OAAO;;OAEvE;;QAEC,0BAA0B;YACtB,0BAA0B;;;;UAI5B,oBAAoB,EAAE;;KAE3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css, DefaultTheme } from 'styled-components';\n\nimport {\n calculateFontSize,\n defaultThemeProp,\n StyledFieldValue,\n StyledStackedFieldValue,\n StyledFieldValueList,\n StyledFieldValueListProps,\n StyledIcon,\n FontSize,\n PropsWithDefaults,\n useDirection,\n StyledButton\n} from '@pega/cosmos-react-core';\n\ninterface StyledDetailListProps extends StyledFieldValueListProps {\n /** Whether individual list items all have labels stacks on top */\n stacked?: boolean;\n /** Whether the list is a flex row of other lists */\n flex?: boolean;\n /** Whether the list has a name attribute */\n hasName?: boolean;\n /** Whether the list is nested */\n nested?: boolean;\n /** The character length applied to all list labels */\n labelLength?: number;\n /**\n * Whether the list is wrapped to 1 column\n * @default false\n */\n wrapped?: boolean;\n /**\n * Number of columns in the list\n * @default 1\n */\n columnCount?: 1 | 2 | 3;\n theme: DefaultTheme;\n}\n\ntype StyledDetailListPropsWithDefaults = PropsWithDefaults<\n StyledDetailListProps,\n 'wrapped' | 'columnCount'\n>;\n\nconst verticalGapSpacingMultiplier = 1;\n\n// colWidth reduces by 20% as column count increases\nexport const colCountChWidth = {\n '1': {\n containerWidth: 100,\n colWidth: 100\n },\n '2': {\n containerWidth: 80 * 2,\n colWidth: 80\n },\n '3': {\n containerWidth: 64 * 3,\n colWidth: 64\n }\n};\n\nexport const flexGapProp = 5.5;\n\nexport const chToRem = (chVal: number): number => {\n return chVal / 2;\n};\n\nexport const StyledFieldValueGroupLabel = styled.div(({ theme }) => {\n const {\n base: { spacing, animation }\n } = theme;\n const { rtl } = useDirection();\n\n return css`\n width: 100%;\n grid-column-start: 1;\n grid-column-end: -1;\n margin-block-end: calc(0.5 * ${spacing});\n\n &:not(:first-child) {\n margin-block-start: calc(3 * ${spacing});\n }\n\n ${StyledButton} ${StyledIcon} {\n transition: transform ${animation.speed} ${animation.timing.ease};\n }\n\n ${StyledButton}[aria-expanded='true'] ${StyledIcon} {\n transform: rotate(90deg);\n }\n\n ${StyledButton}[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(${rtl ? 180 : 0}deg);\n }\n `;\n});\n\nStyledFieldValueGroupLabel.defaultProps = defaultThemeProp;\n\nexport const StyledHighlightedDetailList = styled.dl(({ theme }) => {\n const {\n base: { spacing, palette }\n } = theme;\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(40ch, 1fr));\n column-gap: calc(5 * ${spacing});\n gap: calc(2 * ${spacing});\n align-items: start;\n max-width: ${`${colCountChWidth[3].containerWidth}ch}`};\n padding-block-end: calc(1.5 * ${spacing});\n\n dd {\n font-size: ${fontSize[theme.components.text.h1['font-size'] as FontSize]};\n font-weight: ${theme.components.text.h1['font-weight']};\n }\n\n + hr {\n border-top: unset;\n border-radius: unset;\n border-style: unset;\n border-bottom: 0.0625rem solid ${palette['border-line']};\n margin-block-end: calc(1.5 * ${spacing});\n }\n `;\n});\n\nStyledHighlightedDetailList.defaultProps = defaultThemeProp;\n\nexport const StyledDetails = styled.div(() => {\n return css`\n grid-column: 1 / -1;\n `;\n});\n\nStyledDetails.defaultProps = defaultThemeProp;\n\nconst nthRecursiveContainerSelector = (\n depth: number,\n includeAllImmediateContainers?: boolean\n): string => {\n const firstContainerSelector = '> div:first-child';\n const baseSelector = includeAllImmediateContainers ? '> div' : firstContainerSelector;\n\n return baseSelector.concat(` ${firstContainerSelector}`.repeat(depth));\n};\n\nconst initialLabelNoMargin = (applyToAllChildren = false) => {\n return css`\n ${nthRecursiveContainerSelector(0, applyToAllChildren)},\n ${nthRecursiveContainerSelector(1, applyToAllChildren)},\n ${nthRecursiveContainerSelector(2, applyToAllChildren)},\n ${nthRecursiveContainerSelector(3, applyToAllChildren)},\n ${nthRecursiveContainerSelector(4, applyToAllChildren)},\n ${nthRecursiveContainerSelector(5, applyToAllChildren)},\n ${nthRecursiveContainerSelector(6, applyToAllChildren)},\n ${nthRecursiveContainerSelector(7, applyToAllChildren)},\n ${nthRecursiveContainerSelector(8, applyToAllChildren)},\n ${nthRecursiveContainerSelector(9, applyToAllChildren)},\n ${nthRecursiveContainerSelector(10, applyToAllChildren)} {\n > ${StyledFieldValueGroupLabel}:first-child {\n margin-block-start: 0;\n }\n }\n `;\n};\n\nexport const StyledDetailList = styled(StyledFieldValueList)<StyledDetailListPropsWithDefaults>(\n ({\n stacked,\n flex,\n hasName,\n nested,\n labelLength,\n variant,\n theme,\n wrapped = false,\n columnCount = 1\n }): any => {\n const {\n base: { spacing }\n } = theme;\n\n const isValueComparison = variant === 'value-comparison';\n const containerWidthCh = colCountChWidth[columnCount].containerWidth;\n const containerWidthMinusLabel = `${containerWidthCh - (labelLength ?? 0)}ch`;\n\n return css`\n /* Top Level Styles */\n ${!nested &&\n css`\n ${StyledFieldValue} {\n word-break: break-word;\n overflow: auto;\n }\n\n ${StyledFieldValueGroupLabel} {\n margin-block-start: calc(3 * ${spacing});\n }\n\n > ${StyledFieldValueGroupLabel}:nth-child(1) {\n margin-block-start: 0;\n }\n\n ${StyledStackedFieldValue} {\n grid-column: 1 / -1;\n }\n `}\n\n /* Nested List */\n ${nested &&\n css`\n grid-column: 1 / -1;\n `}\n\n /* As Field Grid */\n ${!flex &&\n css`\n display: grid;\n grid-template-columns: ${`minmax(14ch, ${labelLength}ch) minmax(14ch, 1fr)`};\n column-gap: calc(2 * ${spacing});\n row-gap: calc(${verticalGapSpacingMultiplier} * ${spacing});\n\n ${stacked &&\n css`\n grid-template-columns: minmax(0, 1fr);\n row-gap: 0;\n `}\n\n > ${StyledStackedFieldValue} {\n max-width: ${`${containerWidthCh}ch`};\n }\n\n > ${StyledFieldValue} {\n max-width: calc(${containerWidthMinusLabel} - calc(2 * ${spacing}));\n }\n\n ${isValueComparison &&\n css`\n grid-template-columns: auto auto;\n column-gap: 0;\n row-gap: calc(0.5 * ${spacing});\n max-width: ${`${containerWidthCh}ch`};\n `}\n `}\n\n /* As Flex Container */\n ${flex &&\n css`\n display: flex;\n flex-direction: ${wrapped ? 'column' : 'row'};\n column-gap: calc(${flexGapProp} * ${spacing});\n align-items: flex-start;\n\n max-width: ${`${containerWidthCh}ch`};\n\n ${!wrapped &&\n css`\n > * {\n max-width: ${`${100 / columnCount}%`};\n }\n\n ${hasName && initialLabelNoMargin(true)}\n `}\n\n ${wrapped &&\n css`\n ${hasName && initialLabelNoMargin()}\n\n ${\n !stacked &&\n css`\n > div:not(:first-child) {\n margin-block-start: calc(${verticalGapSpacingMultiplier} * ${spacing});\n }\n `\n }}\n `}\n `}\n\n /* Key / Group Label Spacing */\n ${!nested &&\n css`\n > div {\n + dt {\n margin-block-start: calc(3 * ${spacing});\n }\n\n + ${StyledStackedFieldValue} {\n margin-block-start: calc(3 * ${spacing});\n }\n\n ${!stacked &&\n css`\n + dt + dd {\n margin-block-start: calc(3 * ${spacing});\n }\n `}\n }\n\n ${initialLabelNoMargin()}\n `}\n\n ${stacked &&\n css`\n dt {\n margin-block-start: calc(${verticalGapSpacingMultiplier} * ${spacing});\n }\n `}\n\n ${StyledFieldValueGroupLabel} + div {\n > ${StyledFieldValueGroupLabel}:first-child {\n margin-block-start: 0;\n }\n\n ${initialLabelNoMargin()}\n }\n `;\n }\n);\n\nStyledDetailList.defaultProps = defaultThemeProp;\n"]}
@@ -0,0 +1,9 @@
1
+ export interface DetailsContextValue {
2
+ longestLabelLength?: number;
3
+ setLongestLabelLength?: (val: number) => void;
4
+ mobileView?: boolean;
5
+ depth?: number;
6
+ }
7
+ declare const DetailsContext: import("react").Context<DetailsContextValue>;
8
+ export default DetailsContext;
9
+ //# sourceMappingURL=DetailsContext.d.ts.map