@pega/cosmos-react-work 3.0.0-dev.18.2 → 3.0.0-dev.19.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/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 +11 -10
- package/lib/components/Details/Details.d.ts.map +1 -1
- package/lib/components/Details/Details.js +56 -35
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Details/Details.styles.d.ts +46 -0
- package/lib/components/Details/Details.styles.d.ts.map +1 -0
- package/lib/components/Details/Details.styles.js +207 -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/Tasks/TaskList.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.js +5 -1
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/package.json +3 -3
|
@@ -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 }), _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
|
|
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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AAE,QAAQ,EAAE,aAC9C,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,sBAAsB,CAAC,GAAQ,EACpD,OAAO,IACH,CACR,EACA,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,EACL,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 {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,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
interface DetailsProps {
|
|
4
|
+
highlightedData?: ReactNode[];
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
columnCount?: 1 | 2 | 3;
|
|
7
|
+
name?: string;
|
|
8
|
+
nested?: boolean;
|
|
9
|
+
asFlex?: boolean;
|
|
10
|
+
ref?: Ref<HTMLDListElement>;
|
|
8
11
|
}
|
|
9
|
-
|
|
10
|
-
export declare const StyledHighlightedFields: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
11
|
-
declare const Details: FunctionComponent<DetailsProps & ForwardProps>;
|
|
12
|
+
declare const Details: FC<DetailsProps & ForwardProps>;
|
|
12
13
|
export default Details;
|
|
13
14
|
//# 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,EACb,MAAM,yBAAyB,CAAC;AAYjC,UAAU,YAAY;IACpB,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,GAAG,YAAY,CAgH5C,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,38 +1,59 @@
|
|
|
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 } 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, columnCount = 1, name = undefined, nested = false, asFlex = 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 [flexContextMobileView, setFlexContextMobileView] = useState(false);
|
|
17
|
+
const labelLength = Math.max(14, Math.min(longestLabelLength ?? 16, 40));
|
|
18
|
+
const headingDepth = depth ?? 1;
|
|
19
|
+
const applyMobileView = asFlex
|
|
20
|
+
? mobileView || (flexRow && flexContextMobileView) || !isSmallOrAbove
|
|
21
|
+
: mobileView || !isSmallOrAbove;
|
|
22
|
+
const contextValue = useMemo(() => {
|
|
23
|
+
return {
|
|
24
|
+
mobileView: applyMobileView,
|
|
25
|
+
depth: name ? headingDepth + 1 : headingDepth,
|
|
26
|
+
longestLabelLength,
|
|
27
|
+
...context
|
|
28
|
+
};
|
|
29
|
+
}, [applyMobileView, name, headingDepth, longestLabelLength, context]);
|
|
30
|
+
/**
|
|
31
|
+
* Mount resize observer to update flex context mobile view & run initial check.
|
|
32
|
+
*/
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const checkBreakpoint = (elementWidth) => {
|
|
35
|
+
const minWidthRem = chToRem(parseInt(sm, 10));
|
|
36
|
+
const minWidthPx = parseInt(remToPx(minWidthRem), 10);
|
|
37
|
+
const oneRemInPx = parseInt(remToPx(1), 10);
|
|
38
|
+
const colGapPxAllowance = oneRemInPx * (0.5 * flexGapProp) * (columnCount - 1);
|
|
39
|
+
const mobileViewBreakpoint = minWidthPx * columnCount + colGapPxAllowance;
|
|
40
|
+
setFlexContextMobileView(elementWidth < mobileViewBreakpoint);
|
|
41
|
+
};
|
|
42
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
43
|
+
const containerPxWidth = entries[0].contentRect.width;
|
|
44
|
+
checkBreakpoint(containerPxWidth);
|
|
45
|
+
});
|
|
46
|
+
if (listRef.current) {
|
|
47
|
+
checkBreakpoint(listRef.current.offsetWidth);
|
|
48
|
+
resizeObserver.observe(listRef.current);
|
|
49
|
+
}
|
|
50
|
+
return () => {
|
|
51
|
+
resizeObserver.disconnect();
|
|
52
|
+
};
|
|
53
|
+
}, [listRef, columnCount]);
|
|
54
|
+
return (_jsx(DetailsContext.Provider, { value: contextValue, children: _jsxs(StyledDetails, { children: [name && (_jsx(StyledFieldValueGroupLabel, { children: _jsx(Text, { variant: `h${Math.min(headingDepth, 6)}`, children: name }) })), highlightedData && (_jsxs(_Fragment, { children: [_jsx(StyledHighlightedDetailList, { as: nested ? 'div' : 'dl', children: highlightedData.map((child, i) => (
|
|
55
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
56
|
+
_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, children: children })] }) }));
|
|
24
57
|
});
|
|
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
58
|
export default Details;
|
|
38
59
|
//# sourceMappingURL=Details.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.js","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":";
|
|
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,EAET,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;AAY1B,MAAM,OAAO,GAAoC,UAAU,CACzD,CACE,EACE,eAAe,EACf,QAAQ,EACR,WAAW,GAAG,CAAC,EACf,IAAI,GAAG,SAAS,EAChB,MAAM,GAAG,KAAK,EACd,MAAM,GAAG,KAAK,EACf,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,kBAAkB,EAAE,UAAU,EAAE,KAAK,EAAE,GAA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G,CAAC,YAAY,EAAE,CAAC,CAAC,EAA6C,YAElF,IAAI,GACA,GACoB,CAC9B,EAEA,eAAe,IAAI,CAClB,8BACE,KAAC,2BAA2B,IAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,YACnD,eAAe,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;4BACjC,oDAAoD;4BACpD,KAAC,QAAQ,cAAU,KAAK,IAAT,CAAC,CAAoB,CACrC,CAAC,GAC0B,EAE9B,cAAM,IACL,CACJ,EAED,KAAC,gBAAgB,IACf,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EACzB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,CAAC,CAAC,IAAI,EACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,YAEjC,QAAQ,GACQ,IACL,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} 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\ninterface DetailsProps {\n highlightedData?: ReactNode[];\n children?: ReactNode;\n columnCount?: 1 | 2 | 3;\n name?: string;\n nested?: boolean;\n asFlex?: boolean;\n ref?: Ref<HTMLDListElement>;\n}\n\nconst Details: FC<DetailsProps & ForwardProps> = forwardRef(\n (\n {\n highlightedData,\n children,\n columnCount = 1,\n name = undefined,\n nested = false,\n asFlex = 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 [flexContextMobileView, setFlexContextMobileView] = useState(false);\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 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 /**\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 return (\n <DetailsContext.Provider value={contextValue}>\n <StyledDetails>\n {name && (\n <StyledFieldValueGroupLabel>\n <Text\n variant={`h${Math.min(headingDepth, 6)}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'}\n >\n {name}\n </Text>\n </StyledFieldValueGroupLabel>\n )}\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 >\n {children}\n </StyledDetailList>\n </StyledDetails>\n </DetailsContext.Provider>\n );\n }\n);\n\nexport default Details;\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DefaultTheme } from 'styled-components';
|
|
2
|
+
interface StyledDetailListProps {
|
|
3
|
+
/** Whether individual list items all have labels stacks on top */
|
|
4
|
+
stacked?: boolean;
|
|
5
|
+
/** Whether the list is a flex row of other lists */
|
|
6
|
+
flex?: boolean;
|
|
7
|
+
/** Whether the list has a name attribute */
|
|
8
|
+
hasName?: boolean;
|
|
9
|
+
/** Whether the list is nested */
|
|
10
|
+
nested?: boolean;
|
|
11
|
+
/** The character length applied to all list labels */
|
|
12
|
+
labelLength?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the list is wrapped to 1 column
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
wrapped?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Number of columns in the list
|
|
20
|
+
* @default 1
|
|
21
|
+
*/
|
|
22
|
+
columnCount?: 1 | 2 | 3;
|
|
23
|
+
theme: DefaultTheme;
|
|
24
|
+
}
|
|
25
|
+
export declare const colCountChWidth: {
|
|
26
|
+
'1': {
|
|
27
|
+
containerWidth: number;
|
|
28
|
+
colWidth: number;
|
|
29
|
+
};
|
|
30
|
+
'2': {
|
|
31
|
+
containerWidth: number;
|
|
32
|
+
colWidth: number;
|
|
33
|
+
};
|
|
34
|
+
'3': {
|
|
35
|
+
containerWidth: number;
|
|
36
|
+
colWidth: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const flexGapProp = 5.5;
|
|
40
|
+
export declare const chToRem: (chVal: number) => number;
|
|
41
|
+
export declare const StyledFieldValueGroupLabel: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
42
|
+
export declare const StyledHighlightedDetailList: import("styled-components").StyledComponent<"dl", DefaultTheme, {}, never>;
|
|
43
|
+
export declare const StyledDetails: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
44
|
+
export declare const StyledDetailList: import("styled-components").StyledComponent<"dl", DefaultTheme, import("@pega/cosmos-react-core").OmitStrict<StyledDetailListProps, "columnCount" | "wrapped"> & Required<Pick<StyledDetailListProps, "columnCount" | "wrapped">>, never>;
|
|
45
|
+
export {};
|
|
46
|
+
//# 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;AAW9D,UAAU,qBAAqB;IAC7B,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,6EAcrC,CAAC;AAIH,eAAO,MAAM,2BAA2B,4EA4BtC,CAAC;AAIH,eAAO,MAAM,aAAa,6EAIxB,CAAC;AAkCH,eAAO,MAAM,gBAAgB,2OAgI5B,CAAC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { calculateFontSize, defaultThemeProp, StyledFieldValue, StyledStackedFieldValue } from '@pega/cosmos-react-core';
|
|
3
|
+
const itemGapSpacingMultiplier = 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 } } = theme;
|
|
25
|
+
return css `
|
|
26
|
+
width: 100%;
|
|
27
|
+
grid-column-start: 1;
|
|
28
|
+
grid-column-end: -1;
|
|
29
|
+
|
|
30
|
+
&:not(:first-child) {
|
|
31
|
+
margin-block-start: calc(3 * ${spacing});
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
});
|
|
35
|
+
StyledFieldValueGroupLabel.defaultProps = defaultThemeProp;
|
|
36
|
+
export const StyledHighlightedDetailList = styled.dl(({ theme }) => {
|
|
37
|
+
const { base: { spacing, palette } } = theme;
|
|
38
|
+
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
39
|
+
return css `
|
|
40
|
+
display: grid;
|
|
41
|
+
grid-template-columns: repeat(auto-fit, minmax(40ch, 1fr));
|
|
42
|
+
column-gap: calc(5 * ${spacing});
|
|
43
|
+
gap: calc(2 * ${spacing});
|
|
44
|
+
align-items: start;
|
|
45
|
+
max-width: ${`${colCountChWidth[3].containerWidth}ch}`};
|
|
46
|
+
padding-block-end: calc(1.5 * ${spacing});
|
|
47
|
+
|
|
48
|
+
dd {
|
|
49
|
+
font-size: ${fontSize[theme.components.text.h1['font-size']]};
|
|
50
|
+
font-weight: ${theme.components.text.h1['font-weight']};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
+ hr {
|
|
54
|
+
border-top: unset;
|
|
55
|
+
border-radius: unset;
|
|
56
|
+
border-style: unset;
|
|
57
|
+
border-bottom: 0.0625rem solid ${palette['border-line']};
|
|
58
|
+
margin-block-end: calc(1.5 * ${spacing});
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
});
|
|
62
|
+
StyledHighlightedDetailList.defaultProps = defaultThemeProp;
|
|
63
|
+
export const StyledDetails = styled.div(() => {
|
|
64
|
+
return css `
|
|
65
|
+
grid-column: 1 / -1;
|
|
66
|
+
`;
|
|
67
|
+
});
|
|
68
|
+
StyledDetails.defaultProps = defaultThemeProp;
|
|
69
|
+
const nthRecursiveContainerSelector = (depth, includeAllImmediateContainers) => {
|
|
70
|
+
const firstContainerSelector = '> div:first-child';
|
|
71
|
+
const baseSelector = includeAllImmediateContainers ? '> div' : firstContainerSelector;
|
|
72
|
+
return baseSelector.concat(` ${firstContainerSelector}`.repeat(depth));
|
|
73
|
+
};
|
|
74
|
+
const initialLabelNoMargin = (applyToAllChildren = false) => {
|
|
75
|
+
return css `
|
|
76
|
+
${nthRecursiveContainerSelector(0, applyToAllChildren)},
|
|
77
|
+
${nthRecursiveContainerSelector(1, applyToAllChildren)},
|
|
78
|
+
${nthRecursiveContainerSelector(2, applyToAllChildren)},
|
|
79
|
+
${nthRecursiveContainerSelector(3, applyToAllChildren)},
|
|
80
|
+
${nthRecursiveContainerSelector(4, applyToAllChildren)},
|
|
81
|
+
${nthRecursiveContainerSelector(5, applyToAllChildren)},
|
|
82
|
+
${nthRecursiveContainerSelector(6, applyToAllChildren)},
|
|
83
|
+
${nthRecursiveContainerSelector(7, applyToAllChildren)},
|
|
84
|
+
${nthRecursiveContainerSelector(8, applyToAllChildren)},
|
|
85
|
+
${nthRecursiveContainerSelector(9, applyToAllChildren)},
|
|
86
|
+
${nthRecursiveContainerSelector(10, applyToAllChildren)} {
|
|
87
|
+
> ${StyledFieldValueGroupLabel}:first-child {
|
|
88
|
+
margin-block-start: 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
};
|
|
93
|
+
export const StyledDetailList = styled.dl(({ stacked, flex, hasName, nested, labelLength, wrapped = false, columnCount = 1, theme }) => {
|
|
94
|
+
const { base: { spacing } } = theme;
|
|
95
|
+
return css `
|
|
96
|
+
/* Top Level Styles */
|
|
97
|
+
${!nested &&
|
|
98
|
+
css `
|
|
99
|
+
${StyledFieldValue} {
|
|
100
|
+
word-break: break-word;
|
|
101
|
+
max-width: ${`${colCountChWidth[1].containerWidth}ch}`};
|
|
102
|
+
overflow: auto;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
${StyledFieldValueGroupLabel} {
|
|
106
|
+
margin-block-start: calc(3 * ${spacing});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
> ${StyledFieldValueGroupLabel}:nth-child(1) {
|
|
110
|
+
margin-block-start: 0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
${StyledStackedFieldValue} {
|
|
114
|
+
grid-column: 1 / -1;
|
|
115
|
+
}
|
|
116
|
+
`}
|
|
117
|
+
|
|
118
|
+
/* Nested List */
|
|
119
|
+
${nested &&
|
|
120
|
+
css `
|
|
121
|
+
grid-column: 1 / -1;
|
|
122
|
+
`}
|
|
123
|
+
|
|
124
|
+
/* As Field Grid */
|
|
125
|
+
${!flex &&
|
|
126
|
+
css `
|
|
127
|
+
display: grid;
|
|
128
|
+
grid-template-columns: ${!stacked
|
|
129
|
+
? `minmax(14ch, ${labelLength}ch) minmax(14ch, 1fr)`
|
|
130
|
+
: 'minmax(0, 1fr)'};
|
|
131
|
+
column-gap: calc(2 * ${spacing});
|
|
132
|
+
row-gap: calc(${stacked ? 0 : itemGapSpacingMultiplier} * ${spacing});
|
|
133
|
+
`}
|
|
134
|
+
|
|
135
|
+
/* As Flex Container */
|
|
136
|
+
${flex &&
|
|
137
|
+
css `
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: ${wrapped ? 'column' : 'row'};
|
|
140
|
+
column-gap: calc(${flexGapProp} * ${spacing});
|
|
141
|
+
align-items: flex-start;
|
|
142
|
+
|
|
143
|
+
max-width: ${`${chToRem(colCountChWidth[columnCount].containerWidth)}rem`};
|
|
144
|
+
|
|
145
|
+
${!wrapped &&
|
|
146
|
+
css `
|
|
147
|
+
> * {
|
|
148
|
+
max-width: ${`${100 / columnCount}%`};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
${hasName && initialLabelNoMargin(true)}
|
|
152
|
+
`}
|
|
153
|
+
|
|
154
|
+
${wrapped &&
|
|
155
|
+
css `
|
|
156
|
+
${hasName && initialLabelNoMargin()}
|
|
157
|
+
|
|
158
|
+
${!stacked &&
|
|
159
|
+
css `
|
|
160
|
+
> div:not(:first-child) {
|
|
161
|
+
margin-block-start: calc(${itemGapSpacingMultiplier} * ${spacing});
|
|
162
|
+
}
|
|
163
|
+
`}}
|
|
164
|
+
`}
|
|
165
|
+
`}
|
|
166
|
+
|
|
167
|
+
/* Key / Group Label Spacing */
|
|
168
|
+
${!nested &&
|
|
169
|
+
css `
|
|
170
|
+
> div {
|
|
171
|
+
+ dt {
|
|
172
|
+
margin-block-start: calc(3 * ${spacing});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
+ ${StyledStackedFieldValue} {
|
|
176
|
+
margin-block-start: calc(3 * ${spacing});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
${!stacked &&
|
|
180
|
+
css `
|
|
181
|
+
+ dt + dd {
|
|
182
|
+
margin-block-start: calc(3 * ${spacing});
|
|
183
|
+
}
|
|
184
|
+
`}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
${initialLabelNoMargin()}
|
|
188
|
+
`}
|
|
189
|
+
|
|
190
|
+
${stacked &&
|
|
191
|
+
css `
|
|
192
|
+
dt {
|
|
193
|
+
margin-block-start: calc(${itemGapSpacingMultiplier} * ${spacing});
|
|
194
|
+
}
|
|
195
|
+
`}
|
|
196
|
+
|
|
197
|
+
${StyledFieldValueGroupLabel} + div {
|
|
198
|
+
> ${StyledFieldValueGroupLabel}:first-child {
|
|
199
|
+
margin-block-start: 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
${initialLabelNoMargin()}
|
|
203
|
+
}
|
|
204
|
+
`;
|
|
205
|
+
});
|
|
206
|
+
StyledDetailList.defaultProps = defaultThemeProp;
|
|
207
|
+
//# 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,EAGxB,MAAM,yBAAyB,CAAC;AA+BjC,MAAM,wBAAwB,GAAG,CAAC,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AI,CAAC;SACxC;;UAEC,OAAO;YACT,GAAG,CAAA;YACC,OAAO,IAAI,oBAAoB,EAAE;;YAGjC,CAAC,OAAO;gBACR,GAAG,CAAA;;2CAE4B,wBAAwB,MAAM,OAAO;;aAGtE;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,wBAAwB,MAAM,OAAO;;OAEnE;;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 FontSize,\n PropsWithDefaults\n} from '@pega/cosmos-react-core';\n\ninterface StyledDetailListProps {\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 itemGapSpacingMultiplier = 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 }\n } = theme;\n\n return css`\n width: 100%;\n grid-column-start: 1;\n grid-column-end: -1;\n\n &:not(:first-child) {\n margin-block-start: calc(3 * ${spacing});\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.dl<StyledDetailListPropsWithDefaults>(\n ({\n stacked,\n flex,\n hasName,\n nested,\n labelLength,\n wrapped = false,\n columnCount = 1,\n theme\n }): any => {\n const {\n base: { spacing }\n } = theme;\n\n return css`\n /* Top Level Styles */\n ${!nested &&\n css`\n ${StyledFieldValue} {\n word-break: break-word;\n max-width: ${`${colCountChWidth[1].containerWidth}ch}`};\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: ${!stacked\n ? `minmax(14ch, ${labelLength}ch) minmax(14ch, 1fr)`\n : 'minmax(0, 1fr)'};\n column-gap: calc(2 * ${spacing});\n row-gap: calc(${stacked ? 0 : itemGapSpacingMultiplier} * ${spacing});\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: ${`${chToRem(colCountChWidth[columnCount].containerWidth)}rem`};\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(${itemGapSpacingMultiplier} * ${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(${itemGapSpacingMultiplier} * ${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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailsContext.d.ts","sourceRoot":"","sources":["../../../src/components/Details/DetailsContext.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,cAAc,8CAKlB,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
const DetailsContext = createContext({
|
|
3
|
+
longestLabelLength: undefined,
|
|
4
|
+
setLongestLabelLength: () => { },
|
|
5
|
+
mobileView: false,
|
|
6
|
+
depth: 1
|
|
7
|
+
});
|
|
8
|
+
export default DetailsContext;
|
|
9
|
+
//# sourceMappingURL=DetailsContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailsContext.js","sourceRoot":"","sources":["../../../src/components/Details/DetailsContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAStC,MAAM,cAAc,GAAG,aAAa,CAAsB;IACxD,kBAAkB,EAAE,SAAS;IAC7B,qBAAqB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC/B,UAAU,EAAE,KAAK;IACjB,KAAK,EAAE,CAAC;CACT,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC","sourcesContent":["import { createContext } from 'react';\n\nexport interface DetailsContextValue {\n longestLabelLength?: number;\n setLongestLabelLength?: (val: number) => void;\n mobileView?: boolean;\n depth?: number;\n}\n\nconst DetailsContext = createContext<DetailsContextValue>({\n longestLabelLength: undefined,\n setLongestLabelLength: () => {},\n mobileView: false,\n depth: 1\n});\n\nexport default DetailsContext;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default } from './Details';
|
|
2
|
-
export {
|
|
3
|
-
export { StyledDetails,
|
|
2
|
+
export { default as DetailsContext } from './DetailsContext';
|
|
3
|
+
export { StyledFieldValueGroupLabel, StyledDetailList, StyledDetails, StyledHighlightedDetailList } from './Details.styles';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default } from './Details';
|
|
2
|
-
export {
|
|
2
|
+
export { default as DetailsContext } from './DetailsContext';
|
|
3
|
+
export { StyledFieldValueGroupLabel, StyledDetailList, StyledDetails, StyledHighlightedDetailList } from './Details.styles';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC","sourcesContent":["export { default } from './Details';\nexport { default as DetailsContext } from './DetailsContext';\nexport {\n StyledFieldValueGroupLabel,\n StyledDetailList,\n StyledDetails,\n StyledHighlightedDetailList\n} from './Details.styles';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskList.d.ts","sourceRoot":"","sources":["../../../src/components/Tasks/TaskList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnG,OAAO,EACL,YAAY,
|
|
1
|
+
{"version":3,"file":"TaskList.d.ts","sourceRoot":"","sources":["../../../src/components/Tasks/TaskList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnG,OAAO,EACL,YAAY,EAWb,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,sDAAsD;IACtD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wDAAwD;IACxD,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC7E,sCAAsC;IACtC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAmBD,eAAO,MAAM,QAAQ,2EASlB,aAAa,gBA8Cf,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CAU7D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { createElement as _createElement } from "react";
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
|
-
import { SummaryItem, StyledSummaryListItem, Flex, defaultThemeProp, Button, useI18n, VisuallyHiddenText, Breadcrumbs } from '@pega/cosmos-react-core';
|
|
5
|
+
import { SummaryItem, StyledSummaryListItem, Flex, defaultThemeProp, Button, useI18n, VisuallyHiddenText, Breadcrumbs, StyledBreadcrumbs, StyledText } from '@pega/cosmos-react-core';
|
|
6
6
|
const StyledTaskList = styled.ul(({ theme, hasFooter }) => {
|
|
7
7
|
return css `
|
|
8
8
|
${hasFooter &&
|
|
@@ -11,6 +11,10 @@ const StyledTaskList = styled.ul(({ theme, hasFooter }) => {
|
|
|
11
11
|
border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
12
12
|
}
|
|
13
13
|
`}
|
|
14
|
+
|
|
15
|
+
${StyledBreadcrumbs} > ${StyledText} {
|
|
16
|
+
font-weight: ${theme.base['font-weight']['semi-bold']};
|
|
17
|
+
}
|
|
14
18
|
`;
|
|
15
19
|
});
|
|
16
20
|
StyledTaskList.defaultProps = defaultThemeProp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskList.js","sourceRoot":"","sources":["../../../src/components/Tasks/TaskList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAkE,MAAM,OAAO,CAAC;AACnG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAEL,WAAW,EACX,qBAAqB,EACrB,IAAI,EACJ,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,kBAAkB,EAClB,WAAW,
|
|
1
|
+
{"version":3,"file":"TaskList.js","sourceRoot":"","sources":["../../../src/components/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PropsWithoutRef, ReactNode, Ref, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n ForwardProps,\n SummaryItem,\n StyledSummaryListItem,\n Flex,\n defaultThemeProp,\n Button,\n useI18n,\n VisuallyHiddenText,\n Breadcrumbs,\n StyledBreadcrumbs,\n StyledText\n} from '@pega/cosmos-react-core';\n\nexport interface TaskItemProps {\n id: string;\n /** Name of the task displayed in the list. */\n name: string;\n /** Name of the process for the task. */\n processName?: string;\n /** Avatar element to represent the task's assignee. */\n avatar?: ReactNode;\n /** MetaList element with info related to the task. */\n meta?: ReactNode;\n /** Provide a callback to render a button for a task. */\n onOpen?: (id: TaskItemProps['id'], e: MouseEvent<HTMLButtonElement>) => void;\n /** Content for the task when open. */\n content?: ReactNode;\n [key: string]: unknown;\n}\n\nexport interface TaskListProps {\n items: TaskItemProps[];\n hasFooter?: boolean;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\nconst StyledTaskList = styled.ul<{ hasFooter: boolean }>(({ theme, hasFooter }) => {\n return css`\n ${hasFooter &&\n css`\n > li:last-child {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `}\n\n ${StyledBreadcrumbs} > ${StyledText} {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n }\n `;\n});\n\nStyledTaskList.defaultProps = defaultThemeProp;\n\nexport const TaskItem = ({\n id,\n name,\n avatar,\n meta,\n processName,\n onOpen,\n content,\n ...restProps\n}: TaskItemProps) => {\n const t = useI18n();\n const summary = (\n <SummaryItem\n visual={avatar}\n primary={\n processName ? (\n <Breadcrumbs\n path={[\n { id: 'processName', primary: processName },\n { id: 'name', primary: name }\n ]}\n />\n ) : (\n name\n )\n }\n secondary={meta}\n actions={\n onOpen && !content ? (\n <Button variant='primary' onClick={(e: MouseEvent<HTMLButtonElement>) => onOpen(id, e)}>\n <span>{t('go')}</span>\n <VisuallyHiddenText>{`-${processName ?? ''} ${name}`}</VisuallyHiddenText>\n </Button>\n ) : null\n }\n />\n );\n return (\n <Flex\n container={{ direction: 'column', gap: 2 }}\n item={{ grow: 1 }}\n as={StyledSummaryListItem}\n forwardedAs='li'\n {...restProps}\n >\n {content ? (\n <>\n {summary}\n {content}\n </>\n ) : (\n summary\n )}\n </Flex>\n );\n};\n\nconst TaskList: FunctionComponent<TaskListProps & ForwardProps> = forwardRef(\n ({ items, hasFooter = false }: PropsWithoutRef<TaskListProps>, ref) => {\n return (\n <Flex container={{ direction: 'column' }} as={StyledTaskList} hasFooter={hasFooter} ref={ref}>\n {items.map((item, i) => (\n <TaskItem {...item} key={`${i + 1}`} />\n ))}\n </Flex>\n );\n }\n);\n\nexport default TaskList;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-work",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.19.0",
|
|
4
4
|
"author": "Pegasystems",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"build": "tsc -b"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pega/cosmos-react-core": "3.0.0-dev.
|
|
23
|
+
"@pega/cosmos-react-core": "3.0.0-dev.19.0",
|
|
24
24
|
"@types/react": "^16.14.24 || ^17.0.38",
|
|
25
25
|
"@types/react-dom": "^16.9.14 || ^17.0.11",
|
|
26
26
|
"@types/styled-components": "^5.1.7",
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"@testing-library/react": "^12.1.3",
|
|
43
43
|
"@testing-library/user-event": "^13.5.0",
|
|
44
44
|
"enzyme": "^3.11.0",
|
|
45
|
-
"typescript": "~4.
|
|
45
|
+
"typescript": "~4.7.2"
|
|
46
46
|
}
|
|
47
47
|
}
|