@pega/cosmos-react-work 3.0.0-dev.3.0 → 3.0.0-dev.30.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.
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +4 -0
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js +4 -3
- package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/CasePreview/CasePreview.d.ts +2 -2
- package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
- package/lib/components/CasePreview/CasePreview.js +7 -2
- package/lib/components/CasePreview/CasePreview.js.map +1 -1
- package/lib/components/CaseView/CaseHeader.d.ts +4 -0
- package/lib/components/CaseView/CaseHeader.d.ts.map +1 -0
- package/lib/components/CaseView/CaseHeader.js +49 -0
- package/lib/components/CaseView/CaseHeader.js.map +1 -0
- package/lib/components/CaseView/CaseSummary.d.ts +4 -0
- package/lib/components/CaseView/CaseSummary.d.ts.map +1 -0
- package/lib/components/CaseView/CaseSummary.js +13 -0
- package/lib/components/CaseView/CaseSummary.js.map +1 -0
- package/lib/components/CaseView/CaseSummaryFields.d.ts +6 -0
- package/lib/components/CaseView/CaseSummaryFields.d.ts.map +1 -0
- package/lib/components/CaseView/CaseSummaryFields.js +8 -0
- package/lib/components/CaseView/CaseSummaryFields.js.map +1 -0
- package/lib/components/CaseView/CaseView.context.d.ts +5 -0
- package/lib/components/CaseView/CaseView.context.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.context.js +5 -0
- package/lib/components/CaseView/CaseView.context.js.map +1 -0
- package/lib/components/CaseView/CaseView.d.ts +2 -27
- package/lib/components/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +219 -192
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +14 -18
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +235 -44
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/CaseView/CaseView.types.d.ts +97 -0
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.types.js +2 -0
- package/lib/components/CaseView/CaseView.types.js.map +1 -0
- package/lib/components/CaseView/MobileCaseView.js +1 -1
- package/lib/components/CaseView/MobileCaseView.js.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.d.ts +4 -6
- package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.js +8 -4
- package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
- package/lib/components/CaseView/index.d.ts +5 -2
- package/lib/components/CaseView/index.d.ts.map +1 -1
- package/lib/components/CaseView/index.js +4 -1
- package/lib/components/CaseView/index.js.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.js +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.js.map +1 -1
- package/lib/components/ConfigurableLayout/LayoutCell.js +1 -1
- package/lib/components/ConfigurableLayout/LayoutCell.js.map +1 -1
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts +1 -1
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.d.ts +2 -2
- package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.js +1 -1
- package/lib/components/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/Details/Details.d.ts +31 -10
- package/lib/components/Details/Details.d.ts.map +1 -1
- package/lib/components/Details/Details.js +77 -35
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Details/Details.styles.d.ts +47 -0
- package/lib/components/Details/Details.styles.d.ts.map +1 -0
- package/lib/components/Details/Details.styles.js +243 -0
- package/lib/components/Details/Details.styles.js.map +1 -0
- package/lib/components/Details/DetailsContext.d.ts +9 -0
- package/lib/components/Details/DetailsContext.d.ts.map +1 -0
- package/lib/components/Details/DetailsContext.js +9 -0
- package/lib/components/Details/DetailsContext.js.map +1 -0
- package/lib/components/Details/index.d.ts +2 -2
- package/lib/components/Details/index.d.ts.map +1 -1
- package/lib/components/Details/index.js +2 -1
- package/lib/components/Details/index.js.map +1 -1
- package/lib/components/Glimpse/Glimpse.js +1 -1
- package/lib/components/Glimpse/Glimpse.js.map +1 -1
- package/lib/components/SearchResults/Filter.js +2 -2
- package/lib/components/SearchResults/Filter.js.map +1 -1
- package/lib/components/SearchResults/SearchResult.d.ts +1 -1
- package/lib/components/SearchResults/SearchResult.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResult.js +9 -3
- package/lib/components/SearchResults/SearchResult.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.js +59 -40
- package/lib/components/SearchResults/SearchResults.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.styles.d.ts +3 -0
- package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.styles.js +38 -17
- package/lib/components/SearchResults/SearchResults.styles.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.types.d.ts +4 -0
- package/lib/components/SearchResults/SearchResults.types.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.types.js.map +1 -1
- package/lib/components/Stages/StageGlimpse.d.ts +10 -0
- package/lib/components/Stages/StageGlimpse.d.ts.map +1 -0
- package/lib/components/Stages/StageGlimpse.js +11 -0
- package/lib/components/Stages/StageGlimpse.js.map +1 -0
- package/lib/components/Stages/Stages.d.ts +1 -1
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +105 -112
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts +5 -7
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +180 -189
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/lib/components/Stages/Stages.types.d.ts +19 -4
- package/lib/components/Stages/Stages.types.d.ts.map +1 -1
- package/lib/components/Stages/Stages.types.js.map +1 -1
- package/lib/components/Stakeholders/StakeholderForm.js +4 -4
- package/lib/components/Stakeholders/StakeholderForm.js.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.js +16 -10
- package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
- package/lib/components/Tags/Tags.d.ts.map +1 -1
- package/lib/components/Tags/Tags.js +16 -17
- package/lib/components/Tags/Tags.js.map +1 -1
- package/lib/components/Tasks/TaskList.d.ts +8 -5
- package/lib/components/Tasks/TaskList.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.js +14 -6
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/lib/components/Tasks/Tasks.d.ts.map +1 -1
- package/lib/components/Tasks/Tasks.js +5 -4
- package/lib/components/Tasks/Tasks.js.map +1 -1
- package/lib/components/Timeline/Timeline.js +2 -2
- package/lib/components/Timeline/Timeline.js.map +1 -1
- package/lib/components/Timeline/Timeline.styles.d.ts +1 -1
- package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.styles.js +1 -0
- package/lib/components/Timeline/Timeline.styles.js.map +1 -1
- package/lib/components/Timeline/Timeline.types.d.ts +24 -3
- package/lib/components/Timeline/Timeline.types.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.types.js.map +1 -1
- package/lib/components/Timeline/TimelineItem.d.ts.map +1 -1
- package/lib/components/Timeline/TimelineItem.js +4 -4
- package/lib/components/Timeline/TimelineItem.js.map +1 -1
- package/lib/components/Timeline/TimelineToolbar.d.ts +6 -0
- package/lib/components/Timeline/TimelineToolbar.d.ts.map +1 -0
- package/lib/components/Timeline/TimelineToolbar.js +68 -0
- package/lib/components/Timeline/TimelineToolbar.js.map +1 -0
- package/lib/components/Timeline/index.d.ts +1 -0
- package/lib/components/Timeline/index.d.ts.map +1 -1
- package/lib/components/Timeline/index.js +1 -0
- package/lib/components/Timeline/index.js.map +1 -1
- package/lib/index.d.ts +0 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -6
- package/lib/index.js.map +1 -1
- package/package.json +17 -11
- package/lib/components/CaseHeader/CaseHeader.d.ts +0 -30
- package/lib/components/CaseHeader/CaseHeader.d.ts.map +0 -1
- package/lib/components/CaseHeader/CaseHeader.js +0 -119
- package/lib/components/CaseHeader/CaseHeader.js.map +0 -1
- package/lib/components/CaseHeader/index.d.ts +0 -4
- package/lib/components/CaseHeader/index.d.ts.map +0 -1
- package/lib/components/CaseHeader/index.js +0 -3
- package/lib/components/CaseHeader/index.js.map +0 -1
- package/lib/components/CaseSummary/CaseSummary.d.ts +0 -36
- package/lib/components/CaseSummary/CaseSummary.d.ts.map +0 -1
- package/lib/components/CaseSummary/CaseSummary.js +0 -130
- package/lib/components/CaseSummary/CaseSummary.js.map +0 -1
- package/lib/components/CaseSummary/index.d.ts +0 -4
- package/lib/components/CaseSummary/index.d.ts.map +0 -1
- package/lib/components/CaseSummary/index.js +0 -3
- package/lib/components/CaseSummary/index.js.map +0 -1
- package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts +0 -22
- package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts.map +0 -1
- package/lib/components/CaseSummaryFields/CaseSummaryFields.js +0 -25
- package/lib/components/CaseSummaryFields/CaseSummaryFields.js.map +0 -1
- package/lib/components/CaseSummaryFields/index.d.ts +0 -4
- package/lib/components/CaseSummaryFields/index.d.ts.map +0 -1
- package/lib/components/CaseSummaryFields/index.js +0 -3
- package/lib/components/CaseSummaryFields/index.js.map +0 -1
- package/lib/components/Stages/Steps.d.ts +0 -8
- package/lib/components/Stages/Steps.d.ts.map +0 -1
- package/lib/components/Stages/Steps.js +0 -12
- package/lib/components/Stages/Steps.js.map +0 -1
- package/lib/components/Stages/StepsContainer.d.ts +0 -8
- package/lib/components/Stages/StepsContainer.d.ts.map +0 -1
- package/lib/components/Stages/StepsContainer.js +0 -11
- package/lib/components/Stages/StepsContainer.js.map +0 -1
|
@@ -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,
|
|
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,MAAM,yBAAyB,CAAC;AAS3E,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;;GAE9B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAA6C,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAC7F,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CACpB,KAAC,IAAI,IACH,WAAW,QACX,QAAQ,EAAE,CAAC,EACX,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,gBACpD,GAAG,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,wBAAwB,CAAC,EAAE,EACvE,EAAE,EAAE,sBAAsB,EAC1B,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAC,CAAgC,EAAE,EAAE;YAC9C,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO;gBAAE,OAAO,EAAE,EAAE,CAAC;QACtD,CAAC,YAEA,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,IAAC,OAAO,EAAC,SAAS,YAAE,IAAI,CAAC,KAAK,GAAS,KAHrE,IAAI,CAAC,QAAQ,CAIb,CACR,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { FunctionComponent, KeyboardEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Card, Count, Flex, Icon, useI18n } from '@pega/cosmos-react-core';\n\nimport { CaseViewProps } from './CaseView.types';\n\nexport interface UtilitiesSummaryProps {\n items?: CaseViewProps['utilitiesSummaryItems'];\n onClick?: () => void;\n}\n\nexport const StyledUtilitiesSummary = styled.div(({ theme }) => {\n return css`\n width: 2.75rem;\n padding: ${theme.base.spacing} 0;\n cursor: pointer;\n `;\n});\n\nconst UtilitiesSummary: FunctionComponent<UtilitiesSummaryProps> = ({ items = [], onClick }) => {\n const t = useI18n();\n return items.length ? (\n <Card\n interactive\n tabIndex={0}\n role='button'\n container={{ direction: 'column', alignItems: 'center', gap: 3 }}\n aria-label={`${t('utilities_summary')}. ${t('expand_utilities_panel')}`}\n as={StyledUtilitiesSummary}\n onClick={onClick}\n onKeyDown={(e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === ' ' || e.key === 'Enter') onClick?.();\n }}\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 variant='default'>{item.count}</Count>}\n </Flex>\n );\n })}\n </Card>\n ) : null;\n};\n\nexport default UtilitiesSummary;\n"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { default } from './CaseView';
|
|
2
|
-
export { CaseViewProps } from './CaseView';
|
|
3
|
-
export { StyledCaseView, StyledCaseViewContent, StyledCaseDrawer, StyledCaseDrawerContent, StyledSummaryRegion } from './CaseView.styles';
|
|
2
|
+
export { CaseViewProps } from './CaseView.types';
|
|
3
|
+
export { StyledCaseView, StyledWorkArea as StyledCaseViewContent, StyledCaseDrawer, StyledCaseDrawerContent, StyledSummary as StyledSummaryRegion } from './CaseView.styles';
|
|
4
4
|
export { default as MobileCaseView } from './MobileCaseView';
|
|
5
5
|
export { MobileCaseViewProps } from './MobileCaseView';
|
|
6
|
+
export { default as CaseSummary } from './CaseSummary';
|
|
7
|
+
export { default as CaseSummaryFields } from './CaseSummaryFields';
|
|
8
|
+
export { default as CaseHeader } from './CaseHeader';
|
|
6
9
|
//# 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,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
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,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,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;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,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"}
|
|
@@ -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,
|
|
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"]}
|
|
@@ -87,7 +87,7 @@ const ConfigurableLayout = forwardRef(({ items, arrangement }, ref) => {
|
|
|
87
87
|
}
|
|
88
88
|
return null;
|
|
89
89
|
}, [items, renderMode]);
|
|
90
|
-
return (_jsx(StyledConfigurableLayout, { children: _jsxs(Flex, { as: StyledCellGrid, container: { wrap: 'wrap', justify: 'stretch', alignItems: 'stretch' }, item: { basis: containerMinWidth, grow: 1 }, ref: ref, children: [_jsx(StyledContainerRuler, { ref: containerRulerRef }
|
|
90
|
+
return (_jsx(StyledConfigurableLayout, { children: _jsxs(Flex, { as: StyledCellGrid, container: { wrap: 'wrap', justify: 'stretch', alignItems: 'stretch' }, item: { basis: containerMinWidth, grow: 1 }, ref: ref, children: [_jsx(StyledContainerRuler, { ref: containerRulerRef }), content] }) }));
|
|
91
91
|
});
|
|
92
92
|
export default ConfigurableLayout;
|
|
93
93
|
//# sourceMappingURL=ConfigurableLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurableLayout.js","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAwB,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/F,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,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;kCACvB,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;GAC9D,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,OAAO,GAAG,CAAA;0BACc,OAAO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AAuD;gCACtE,KAAK,EAAE,KAAK;gCACZ,KAAK,EAAE,KAAK;gCACZ,KAAK,EAAE,MAAM;gCACb,KAAK,EAAE,MAAM;gCACb,KAAK,EAAE,MAAM;gCACb,IAAI,EAAE,MAAM;6BACb,CAAC;4BAEF,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;4BAEnE,MAAM;yBACP;wBACD,KAAK,MAAM;4BACT,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC;4BACnC,MAAM;wBACR;4BACE,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC;4BACnC,MAAM;qBACT;iBACF;gBAED,OAAO,KAAC,UAAU,IAAyC,MAAM,EAAE,MAAM,IAAjD,GAAG,UAAU,CAAC,EAAE,KAAK,UAAU,EAAE,CAAoB,CAAC;YAChF,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;IAExB,OAAO,CACL,KAAC,wBAAwB,cACvB,MAAC,IAAI,IACH,EAAE,EAAE,cAAc,EAClB,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,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,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, useState, useEffect, 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(\n ({ items, arrangement }: PropsWithoutRef<ConfigurableLayoutProps>, ref: Ref<HTMLElement>) => {\n const [renderMode, setRenderMode] = useState<'direct' | 'double' | 'full'>('direct');\n const containerRulerRef = useRef<HTMLDivElement>(null);\n\n // Update render mode when arrangement wraps\n useEffect(() => {\n const activeArrangement = arrangement?.hasWrapped !== undefined && !arrangement.hasWrapped;\n\n if (activeArrangement) {\n switch (arrangement.size) {\n case 'main':\n setRenderMode('direct');\n break;\n case 'half':\n setRenderMode('double');\n break;\n case 'narrow':\n setRenderMode('full');\n break;\n default:\n setRenderMode('direct');\n break;\n }\n\n return;\n }\n\n // Use direct by default\n setRenderMode('direct');\n }, [arrangement?.hasWrapped]);\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}--${renderMode}`} 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);\n\nexport default ConfigurableLayout;\n"]}
|
|
@@ -58,7 +58,7 @@ const LayoutCell = ({ config }) => {
|
|
|
58
58
|
}, [layoutConfig.minWidth]);
|
|
59
59
|
return config?.content ? (_jsx(Flex, { as: StyledCell, item: {
|
|
60
60
|
grow: 1
|
|
61
|
-
}, container: { justify: 'stretch', alignItems: 'start' }, fillAvailable: layoutConfig.fillAvailable, percentageWidth: percentageWidth, minWidth: minWidth, children: config.content }
|
|
61
|
+
}, container: { justify: 'stretch', alignItems: 'start' }, fillAvailable: layoutConfig.fillAvailable, percentageWidth: percentageWidth, minWidth: minWidth, children: config.content })) : null;
|
|
62
62
|
};
|
|
63
63
|
export default LayoutCell;
|
|
64
64
|
//# sourceMappingURL=LayoutCell.js.map
|
|
@@ -1 +1 @@
|
|
|
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,EAAgB,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,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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,5 +1,5 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
|
-
declare const useTrackWrappedRegions: (regionElArray: (HTMLElement | null)[], disabled?: boolean
|
|
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;
|
|
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
|
|
5
|
+
title?: string;
|
|
6
6
|
/** Region for a Field Value List component */
|
|
7
|
-
details
|
|
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;
|
|
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 },
|
|
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,
|
|
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,CA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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 {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 {
|
|
2
|
-
import {
|
|
3
|
-
export interface DetailsProps
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
|
|
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
|
-
|
|
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,
|
|
1
|
+
{"version":3,"file":"Details.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EAEF,SAAS,EACT,GAAG,EAKJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAKL,YAAY,EAMb,MAAM,yBAAyB,CAAC;AAYjC,MAAM,WAAW,YAAY;IAC3B,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;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;AAED,QAAA,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
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 }, void 0) }, void 0)), 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
|
-
}) }, void 0))] }, void 0));
|
|
36
|
-
};
|
|
37
79
|
export default Details;
|
|
38
80
|
//# sourceMappingURL=Details.js.map
|
|
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AAiB,WAAI,WACvC,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,WACG,CACR,YACa,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,EACpB,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,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c,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"}
|