@jpmorganchase/mosaic-components 0.1.0-beta.71 → 0.1.0-beta.73
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/package.json +8 -5
- package/.turbo/turbo-build.log +0 -4
- package/CHANGELOG.md +0 -686
- package/src/Accordion/__tests__/index.test.tsx +0 -82
- package/src/Accordion/index.tsx +0 -88
- package/src/Accordion/styles.css.ts +0 -16
- package/src/AudioPlayer/__tests__/index.test.tsx +0 -19
- package/src/AudioPlayer/index.tsx +0 -163
- package/src/AudioPlayer/styles.css.ts +0 -65
- package/src/BrowserOnly.tsx +0 -17
- package/src/Button.tsx +0 -25
- package/src/Callout/__tests__/index.test.tsx +0 -102
- package/src/Callout/index.tsx +0 -62
- package/src/Callout/styles.css.ts +0 -77
- package/src/Card/index.tsx +0 -35
- package/src/Card/styles.css.ts +0 -23
- package/src/Cards.tsx +0 -25
- package/src/ComponentExample/index.tsx +0 -23
- package/src/ComponentExample/styles.css.ts +0 -25
- package/src/DataTable.tsx +0 -114
- package/src/EditionFilterView/__tests__/index.test.tsx +0 -49
- package/src/EditionFilterView/index.tsx +0 -108
- package/src/EditionFilterView/styles.css.ts +0 -8
- package/src/EditionTileLink/index.tsx +0 -90
- package/src/EditionTileLink/styles.css.ts +0 -95
- package/src/Feature/Feature.tsx +0 -92
- package/src/Feature/FeatureActions/index.tsx +0 -34
- package/src/Feature/FeatureActions/styles.css.ts +0 -15
- package/src/Feature/FeatureContent/index.tsx +0 -30
- package/src/Feature/FeatureContent/styles.css.ts +0 -13
- package/src/Feature/FeatureEyebrow/index.tsx +0 -19
- package/src/Feature/FeatureEyebrow/styles.css.ts +0 -11
- package/src/Feature/FeatureTitle/index.tsx +0 -18
- package/src/Feature/FeatureTitle/styles.css.ts +0 -9
- package/src/Feature/index.tsx +0 -10
- package/src/Feature/styles.css.ts +0 -58
- package/src/Features/index.tsx +0 -33
- package/src/Features/styles.css.ts +0 -10
- package/src/FilterToolbar/ContentArea/index.tsx +0 -12
- package/src/FilterToolbar/ContentArea/styles.css.ts +0 -16
- package/src/FilterToolbar/FilterDropdown/__tests__/index.test.tsx +0 -22
- package/src/FilterToolbar/FilterDropdown/index.tsx +0 -62
- package/src/FilterToolbar/FilterDropdown/styles.css.ts +0 -16
- package/src/FilterToolbar/PillGroup/__tests__/index.test.tsx +0 -26
- package/src/FilterToolbar/PillGroup/index.tsx +0 -36
- package/src/FilterToolbar/PillGroup/styles.css.ts +0 -17
- package/src/FilterToolbar/Search/__tests__/index.test.tsx +0 -34
- package/src/FilterToolbar/Search/index.tsx +0 -33
- package/src/FilterToolbar/Search/styles.css.ts +0 -9
- package/src/FilterToolbar/SortDropdown/__tests__/index.test.tsx +0 -22
- package/src/FilterToolbar/SortDropdown/defaultSort.js +0 -8
- package/src/FilterToolbar/SortDropdown/index.tsx +0 -53
- package/src/FilterToolbar/SortDropdown/styles.css.ts +0 -15
- package/src/FilterToolbar/Toolbar.tsx +0 -38
- package/src/FilterToolbar/ToolbarProvider.tsx +0 -94
- package/src/FilterToolbar/__tests__/Toolbar.test.tsx +0 -127
- package/src/FilterToolbar/__tests__/ToolbarProvider.test.tsx +0 -85
- package/src/FilterToolbar/index.tsx +0 -9
- package/src/FilterToolbar/styles.css.ts +0 -19
- package/src/FilterView/ContentArea/index.tsx +0 -24
- package/src/FilterView/ContentArea/styles.css.ts +0 -16
- package/src/FilterView/FilterView.tsx +0 -205
- package/src/FilterView/FilterViewProvider.tsx +0 -23
- package/src/FilterView/NoResults/index.tsx +0 -19
- package/src/FilterView/NoResults/styles.css.ts +0 -13
- package/src/FilterView/Pagination/index.tsx +0 -40
- package/src/FilterView/Pagination/styles.css.ts +0 -40
- package/src/FilterView/Pagination/usePagination.ts +0 -31
- package/src/FilterView/ResultCount/index.tsx +0 -23
- package/src/FilterView/ResultCount/styles.css.ts +0 -11
- package/src/FilterView/__tests__/index.test.tsx +0 -109
- package/src/FilterView/index.tsx +0 -5
- package/src/FilterView/useResultCount.tsx +0 -8
- package/src/FormattedContent.tsx +0 -75
- package/src/Grid/index.tsx +0 -29
- package/src/Grid/styles.css.ts +0 -13
- package/src/GridBase/index.tsx +0 -60
- package/src/GridBase/styles.css.ts +0 -19
- package/src/HelpLinks/index.tsx +0 -80
- package/src/HelpLinks/styles.css.ts +0 -32
- package/src/Hero/__tests__/index.test.tsx +0 -19
- package/src/Hero/index.tsx +0 -172
- package/src/Hero/styles.css.ts +0 -111
- package/src/Icon/index.tsx +0 -50
- package/src/ImageProvider.ts +0 -9
- package/src/Impact/index.tsx +0 -36
- package/src/Impact/styles.css.ts +0 -72
- package/src/Impacts.tsx +0 -25
- package/src/IsomorphicSuspense.tsx +0 -9
- package/src/Label/__tests__/index.test.tsx +0 -27
- package/src/Label/index.tsx +0 -42
- package/src/Label/styles.css.ts +0 -14
- package/src/Link/index.tsx +0 -83
- package/src/Link/styles.css.ts +0 -15
- package/src/LinkBase/index.tsx +0 -32
- package/src/LinkButton.css.ts +0 -19
- package/src/LinkButton.tsx +0 -22
- package/src/LinkProvider.ts +0 -9
- package/src/LinkText/index.tsx +0 -121
- package/src/LinkText/styles.css.ts +0 -30
- package/src/Links/index.tsx +0 -18
- package/src/Links/styles.css.ts +0 -13
- package/src/List/ListItem.tsx +0 -31
- package/src/List/OrderedList.tsx +0 -22
- package/src/List/UnorderedList.tsx +0 -35
- package/src/List/index.tsx +0 -3
- package/src/Markdown/AnchorHeading/__tests__/index.test.tsx +0 -56
- package/src/Markdown/AnchorHeading/index.css.ts +0 -64
- package/src/Markdown/AnchorHeading/index.tsx +0 -97
- package/src/Markdown/BlockQuote/index.css.ts +0 -6
- package/src/Markdown/BlockQuote/index.tsx +0 -21
- package/src/Markdown/Heading.tsx +0 -39
- package/src/Markdown/InlineCode.tsx +0 -10
- package/src/Markdown/Link.tsx +0 -11
- package/src/Markdown/Pre/index.css.ts +0 -35
- package/src/Markdown/Pre/index.tsx +0 -155
- package/src/Markdown/Table.tsx +0 -11
- package/src/Markdown/Tbody.tsx +0 -9
- package/src/Markdown/Td.tsx +0 -9
- package/src/Markdown/Th.tsx +0 -9
- package/src/Markdown/Thead.tsx +0 -9
- package/src/Markdown/ThematicBreak/index.css.ts +0 -5
- package/src/Markdown/ThematicBreak/index.tsx +0 -10
- package/src/Markdown/Tr.tsx +0 -9
- package/src/Markdown/__tests__/Heading.test.tsx +0 -56
- package/src/Markdown/index.tsx +0 -210
- package/src/Markdown/markdownElements.tsx +0 -52
- package/src/Markdown/withMarkdownSpacing/index.tsx +0 -33
- package/src/Markdown/withMarkdownSpacing/styles.css.ts +0 -7
- package/src/PageFilterView/index.tsx +0 -86
- package/src/PageFilterView/styles.css.ts +0 -8
- package/src/ReactLive/index.tsx +0 -71
- package/src/ReactLive/styles.css.ts +0 -28
- package/src/SecondaryNavbar/index.tsx +0 -55
- package/src/SecondaryNavbar/styles.css.ts +0 -27
- package/src/SectionHeading/__tests__/index.test.tsx +0 -20
- package/src/SectionHeading/index.tsx +0 -33
- package/src/SectionHeading/styles.css.ts +0 -15
- package/src/StickyHeader/index.tsx +0 -52
- package/src/StickyHeader/styles.css.ts +0 -17
- package/src/Story/index.tsx +0 -70
- package/src/Story/styles.css.ts +0 -37
- package/src/Tabs/index.tsx +0 -65
- package/src/Tabs/styles.css.ts +0 -7
- package/src/TabsBase/TabsBase.tsx +0 -89
- package/src/TabsBase/TabsButton.tsx +0 -30
- package/src/TabsBase/TabsLink.tsx +0 -30
- package/src/TabsBase/TabsMenuButton.tsx +0 -41
- package/src/TabsBase/index.ts +0 -4
- package/src/TabsBase/styles.css.ts +0 -64
- package/src/TabsBase/tabsMenuButton.css.ts +0 -25
- package/src/Tag/__tests__/index.test.tsx +0 -58
- package/src/Tag/index.tsx +0 -62
- package/src/Tag/styles.css.ts +0 -48
- package/src/ThemeProvider.tsx +0 -37
- package/src/TileBase/TileBase.tsx +0 -159
- package/src/TileBase/TileStateProvider.tsx +0 -52
- package/src/TileBase/index.ts +0 -2
- package/src/TileBase/styles.css.ts +0 -15
- package/src/TileButton/index.tsx +0 -68
- package/src/TileContent/index.tsx +0 -155
- package/src/TileContent/styles.css.ts +0 -229
- package/src/TileContentLabel/index.tsx +0 -74
- package/src/TileContentLabel/styles.css.ts +0 -22
- package/src/TileLink/index.tsx +0 -83
- package/src/TileLink/styles.css.ts +0 -9
- package/src/Tiles.tsx +0 -17
- package/src/Typography/Typography.tsx +0 -22
- package/src/Typography/index.tsx +0 -54
- package/src/Typography/withStyledTypography.tsx +0 -25
- package/src/VideoPlayer/__tests__/index.test.tsx +0 -13
- package/src/VideoPlayer/index.tsx +0 -179
- package/src/VideoPlayer/styles.css.ts +0 -87
- package/src/ViewStack/View.tsx +0 -19
- package/src/ViewStack/ViewStack.tsx +0 -50
- package/src/ViewStack/__tests__/index.test.tsx +0 -86
- package/src/ViewStack/index.tsx +0 -2
- package/src/__tests__/Button.test.tsx +0 -13
- package/src/__tests__/LinkButton.test.tsx +0 -16
- package/src/__tests__/ReactLive.test.tsx +0 -21
- package/src/canUseDOM.ts +0 -5
- package/src/common/types/index.ts +0 -52
- package/src/index.tsx +0 -59
- package/src/styles.ts +0 -45
- package/src/useBreakpoint.ts +0 -28
- package/src/useLockBodyScroll.ts +0 -16
- package/src/useOutsideClick.ts +0 -25
- package/src/useSize.ts +0 -32
- package/src/useSpacing.ts +0 -17
- package/src/utils/hasProtocol.ts +0 -1
- package/src/utils/index.ts +0 -1
- package/tsconfig.json +0 -8
package/src/GridBase/index.tsx
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, ReactElement, Ref } from 'react';
|
|
2
|
-
import classnames from 'clsx';
|
|
3
|
-
import { responsiveSprinkles } from '@jpmorganchase/mosaic-theme';
|
|
4
|
-
import type { SpaceVars } from '@jpmorganchase/mosaic-theme';
|
|
5
|
-
|
|
6
|
-
import styles from './styles.css';
|
|
7
|
-
|
|
8
|
-
export interface GridBaseProps {
|
|
9
|
-
/* Child components */
|
|
10
|
-
children: ReactElement | ReactElement[];
|
|
11
|
-
/** Additional class name for root class override */
|
|
12
|
-
className?: string;
|
|
13
|
-
/** When true and direction is row, will justify content with space-inbetween * */
|
|
14
|
-
spaceBetween?: boolean;
|
|
15
|
-
/** Horizontal space between columns */
|
|
16
|
-
columnGap?: keyof SpaceVars['horizontal'];
|
|
17
|
-
/** Direction of layout */
|
|
18
|
-
direction?: 'column' | 'row';
|
|
19
|
-
/** Vertical space between rows */
|
|
20
|
-
rowGap?: keyof SpaceVars['vertical'];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const GridBase = forwardRef(
|
|
24
|
-
(
|
|
25
|
-
{
|
|
26
|
-
children,
|
|
27
|
-
columnGap = 'none',
|
|
28
|
-
className,
|
|
29
|
-
direction = 'row',
|
|
30
|
-
spaceBetween = false,
|
|
31
|
-
rowGap = 'none',
|
|
32
|
-
...rest
|
|
33
|
-
}: GridBaseProps,
|
|
34
|
-
ref: Ref<HTMLDivElement>
|
|
35
|
-
) => {
|
|
36
|
-
const columnGapClassName = responsiveSprinkles({
|
|
37
|
-
columnGap: [columnGap, columnGap, columnGap, columnGap]
|
|
38
|
-
});
|
|
39
|
-
const rowGapClassName = responsiveSprinkles({ rowGap });
|
|
40
|
-
return (
|
|
41
|
-
<div
|
|
42
|
-
className={classnames(
|
|
43
|
-
styles.root,
|
|
44
|
-
columnGapClassName,
|
|
45
|
-
rowGapClassName,
|
|
46
|
-
{
|
|
47
|
-
[styles.rowDirection]: direction === 'row',
|
|
48
|
-
[styles.spaceBetween]: spaceBetween,
|
|
49
|
-
[styles.columnDirection]: direction === 'column'
|
|
50
|
-
},
|
|
51
|
-
className
|
|
52
|
-
)}
|
|
53
|
-
ref={ref}
|
|
54
|
-
{...rest}
|
|
55
|
-
>
|
|
56
|
-
{children}
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
|
|
3
|
-
const styles = {
|
|
4
|
-
root: style({
|
|
5
|
-
display: 'flex',
|
|
6
|
-
flexWrap: 'wrap'
|
|
7
|
-
}),
|
|
8
|
-
rowDirection: style({
|
|
9
|
-
flexDirection: 'row'
|
|
10
|
-
}),
|
|
11
|
-
columnDirection: style({
|
|
12
|
-
flexDirection: 'column'
|
|
13
|
-
}),
|
|
14
|
-
spaceBetween: style({
|
|
15
|
-
justifyContent: 'space-between'
|
|
16
|
-
})
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default styles;
|
package/src/HelpLinks/index.tsx
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classnames from 'clsx';
|
|
3
|
-
import { Icon } from '../Icon';
|
|
4
|
-
import { Caption1 } from '../Typography';
|
|
5
|
-
|
|
6
|
-
import { Link } from '../Link';
|
|
7
|
-
import styles from './styles.css';
|
|
8
|
-
|
|
9
|
-
export interface HelpLinkDescriptor {
|
|
10
|
-
label: string;
|
|
11
|
-
link: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The HelpLinksProps interface.
|
|
16
|
-
*/
|
|
17
|
-
export interface HelpLinksProps {
|
|
18
|
-
/** Additional class name for root class override. */
|
|
19
|
-
className?: string;
|
|
20
|
-
/** The URL to link to when the Stack Overflow link is clicked. */
|
|
21
|
-
stackoverflowLabel?: string;
|
|
22
|
-
/** The label of the Stack Overflow link. */
|
|
23
|
-
stackoverflowUrl?: string;
|
|
24
|
-
/** An optional title above the links. */
|
|
25
|
-
subTitle?: string;
|
|
26
|
-
/** The label of the Symphony link. */
|
|
27
|
-
symphonyLabel?: string;
|
|
28
|
-
/** The URL to link to when the Symphony link is clicked. */
|
|
29
|
-
symphonyUrl?: string;
|
|
30
|
-
links?: Array<HelpLinkDescriptor>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Renders a HelpLinks component. This component is used to create Stack Overflow and Symphony help links.
|
|
35
|
-
* @example
|
|
36
|
-
* ```tsx
|
|
37
|
-
* <HelpLinks
|
|
38
|
-
* stackoverflowUrl="https://stackexchange.com/some/url"
|
|
39
|
-
* symphonyUrl="symhony://some/url"
|
|
40
|
-
* />
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export const HelpLinks: React.FC<React.PropsWithChildren<HelpLinksProps>> = ({
|
|
44
|
-
className,
|
|
45
|
-
stackoverflowLabel = 'Stack Overflow',
|
|
46
|
-
stackoverflowUrl,
|
|
47
|
-
subTitle,
|
|
48
|
-
symphonyLabel = 'Symphony',
|
|
49
|
-
symphonyUrl,
|
|
50
|
-
links = []
|
|
51
|
-
}) => (
|
|
52
|
-
<div className={classnames(className, styles.root)}>
|
|
53
|
-
{subTitle && <Caption1>{subTitle}</Caption1>}
|
|
54
|
-
{stackoverflowUrl && (
|
|
55
|
-
<Link className={styles.link} link={stackoverflowUrl} variant="component">
|
|
56
|
-
<Icon className={classnames(styles.startAdornment)} name="stackoverflow" />
|
|
57
|
-
{stackoverflowLabel}
|
|
58
|
-
<Icon className={classnames(styles.endAdornment)} name="tearOut" />
|
|
59
|
-
</Link>
|
|
60
|
-
)}
|
|
61
|
-
{symphonyUrl && (
|
|
62
|
-
<Link className={styles.link} link={symphonyUrl} variant="component">
|
|
63
|
-
<Icon className={classnames(styles.startAdornment)} name="symphony" />
|
|
64
|
-
{symphonyLabel}
|
|
65
|
-
<Icon className={classnames(styles.endAdornment)} name="tearOut" />
|
|
66
|
-
</Link>
|
|
67
|
-
)}
|
|
68
|
-
{links.map((descriptor: HelpLinkDescriptor) => (
|
|
69
|
-
<Link
|
|
70
|
-
key={descriptor.link}
|
|
71
|
-
className={styles.link}
|
|
72
|
-
link={descriptor.link}
|
|
73
|
-
variant="component"
|
|
74
|
-
>
|
|
75
|
-
{descriptor.label}
|
|
76
|
-
<Icon className={classnames(styles.endAdornment)} name="tearOut" />
|
|
77
|
-
</Link>
|
|
78
|
-
))}
|
|
79
|
-
</div>
|
|
80
|
-
);
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { action, responsiveSprinkles, link } from '@jpmorganchase/mosaic-theme';
|
|
3
|
-
|
|
4
|
-
const styles = {
|
|
5
|
-
root: style([
|
|
6
|
-
{
|
|
7
|
-
display: 'flex',
|
|
8
|
-
flexDirection: 'column'
|
|
9
|
-
},
|
|
10
|
-
action({ variant: 'action1' }),
|
|
11
|
-
responsiveSprinkles({
|
|
12
|
-
rowGap: ['x2', 'x2', 'x2', 'x2'],
|
|
13
|
-
columnGap: ['x2', 'x2', 'x2', 'x2'],
|
|
14
|
-
marginTop: ['x6', 'x6', 'x6', 'x6'],
|
|
15
|
-
marginLeft: ['x4', 'x4', 'x4', 'x4']
|
|
16
|
-
})
|
|
17
|
-
]),
|
|
18
|
-
iconRoot: style({
|
|
19
|
-
display: 'flex'
|
|
20
|
-
}),
|
|
21
|
-
link: style([
|
|
22
|
-
link({ variant: 'regular' }),
|
|
23
|
-
style({
|
|
24
|
-
display: 'flex',
|
|
25
|
-
whiteSpace: 'nowrap'
|
|
26
|
-
})
|
|
27
|
-
]),
|
|
28
|
-
endAdornment: responsiveSprinkles({ marginLeft: ['x2', 'x2', 'x2', 'x2'] }),
|
|
29
|
-
startAdornment: responsiveSprinkles({ marginRight: ['x2', 'x2', 'x2', 'x2'] })
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default styles;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { Hero } from '../index';
|
|
5
|
-
|
|
6
|
-
describe('GIVEN a Hero component', () => {
|
|
7
|
-
test('THEN it can render a datestamp and change the label', () => {
|
|
8
|
-
// arrange
|
|
9
|
-
const testDate = '03/02/2020 20:00:00';
|
|
10
|
-
jest.spyOn(Date.prototype, 'toLocaleString').mockReturnValue(testDate);
|
|
11
|
-
// act
|
|
12
|
-
const { getByText, getByLabelText } = render(
|
|
13
|
-
<Hero datestamp={testDate} datestampLabel="Last TESTED" />
|
|
14
|
-
);
|
|
15
|
-
// expect
|
|
16
|
-
expect(getByLabelText('Last TESTED:')).toBeDefined();
|
|
17
|
-
expect(getByText(testDate)).toBeDefined();
|
|
18
|
-
});
|
|
19
|
-
});
|
package/src/Hero/index.tsx
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
import classnames from 'clsx';
|
|
3
|
-
import { LinkButton } from '../LinkButton';
|
|
4
|
-
|
|
5
|
-
import styles from './styles.css';
|
|
6
|
-
import { Eyebrow, H1, P2 } from '../Typography';
|
|
7
|
-
import { useImageComponent } from '../ImageProvider';
|
|
8
|
-
|
|
9
|
-
const formatTitle = (fullWidth: boolean, title: string, key: string): React.ReactNode => {
|
|
10
|
-
const lines = title ? title.split('<br>') : [];
|
|
11
|
-
return lines.map((line, index) => (
|
|
12
|
-
<H1
|
|
13
|
-
className={classnames({
|
|
14
|
-
[styles.fullWidthTitle]: fullWidth,
|
|
15
|
-
[styles.title]: !fullWidth
|
|
16
|
-
})}
|
|
17
|
-
key={`${key}-${index}`}
|
|
18
|
-
>
|
|
19
|
-
{line}
|
|
20
|
-
</H1>
|
|
21
|
-
));
|
|
22
|
-
};
|
|
23
|
-
export interface HeroLink {
|
|
24
|
-
label: string;
|
|
25
|
-
url: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The HeroProps interface.
|
|
30
|
-
*/
|
|
31
|
-
export interface HeroProps {
|
|
32
|
-
backgroundImage?: string;
|
|
33
|
-
/** Additional class name for root class override. */
|
|
34
|
-
className?: string;
|
|
35
|
-
/** Prop to provide a datestamp. */
|
|
36
|
-
datestamp?: string;
|
|
37
|
-
datestampLabel?: string;
|
|
38
|
-
/** The content of the Hero. */
|
|
39
|
-
description?: string | ReactElement;
|
|
40
|
-
/** An optional eyebrow. */
|
|
41
|
-
eyebrow?: string;
|
|
42
|
-
/** Image to be displayed. */
|
|
43
|
-
image?: string;
|
|
44
|
-
/** The title of the Hero. */
|
|
45
|
-
title: string | ReactElement;
|
|
46
|
-
links?: HeroLink[];
|
|
47
|
-
/** Defines the variant.
|
|
48
|
-
* @defaultValue `regular`
|
|
49
|
-
*/
|
|
50
|
-
variant?: 'regular' | 'fullWidth' | 'framed';
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function HeroImageContainer({ isFramed, heroBackgroundImage, heroImage, isFullWidth }) {
|
|
54
|
-
const ImageComponent = useImageComponent();
|
|
55
|
-
|
|
56
|
-
if (isFramed) {
|
|
57
|
-
return (
|
|
58
|
-
<div className={styles.frame}>
|
|
59
|
-
{heroBackgroundImage && (
|
|
60
|
-
<ImageComponent
|
|
61
|
-
alt="main background image"
|
|
62
|
-
className={styles.frameBackgroundImage}
|
|
63
|
-
fill
|
|
64
|
-
src={heroBackgroundImage}
|
|
65
|
-
priority
|
|
66
|
-
/>
|
|
67
|
-
)}
|
|
68
|
-
<ImageComponent alt="main" className={styles.frameImage} src={heroImage} priority fill />
|
|
69
|
-
</div>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
return (
|
|
73
|
-
<ImageComponent
|
|
74
|
-
alt="main"
|
|
75
|
-
className={classnames(styles.image, {
|
|
76
|
-
[styles.fullWidthImage]: isFullWidth,
|
|
77
|
-
[styles.imageWidth]: !isFullWidth
|
|
78
|
-
})}
|
|
79
|
-
fill
|
|
80
|
-
src={heroImage}
|
|
81
|
-
priority
|
|
82
|
-
/>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Renders a Hero image.
|
|
88
|
-
* @example
|
|
89
|
-
* ```tsx
|
|
90
|
-
* <Hero
|
|
91
|
-
* description="Insert your description here"
|
|
92
|
-
* image="img/hero_image.png"
|
|
93
|
-
* title="Title"
|
|
94
|
-
* variant="regular"
|
|
95
|
-
* />
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
export const Hero: React.FC<React.PropsWithChildren<HeroProps>> = ({
|
|
99
|
-
backgroundImage,
|
|
100
|
-
className,
|
|
101
|
-
datestamp,
|
|
102
|
-
datestampLabel = 'Last Modified',
|
|
103
|
-
description,
|
|
104
|
-
eyebrow,
|
|
105
|
-
image,
|
|
106
|
-
title,
|
|
107
|
-
links,
|
|
108
|
-
variant = 'regular',
|
|
109
|
-
...rest
|
|
110
|
-
}) => {
|
|
111
|
-
const isFullWidth = variant === 'fullWidth';
|
|
112
|
-
const isFramed = variant === 'framed';
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<div
|
|
116
|
-
className={classnames(
|
|
117
|
-
styles.root,
|
|
118
|
-
{
|
|
119
|
-
[styles.fullWidth]: isFullWidth,
|
|
120
|
-
[styles.fixedSize]: !isFullWidth
|
|
121
|
-
},
|
|
122
|
-
className
|
|
123
|
-
)}
|
|
124
|
-
role="banner"
|
|
125
|
-
{...rest}
|
|
126
|
-
>
|
|
127
|
-
<div className={styles.heading} role="heading">
|
|
128
|
-
{eyebrow ? <Eyebrow className={styles.eyebrow}>{eyebrow}</Eyebrow> : null}
|
|
129
|
-
{typeof title === 'string' ? formatTitle(isFullWidth, title, 'title') : title}
|
|
130
|
-
{datestamp ? (
|
|
131
|
-
<>
|
|
132
|
-
<label className={styles.datestampLabel} id="last-modified-label">
|
|
133
|
-
{datestampLabel}:
|
|
134
|
-
</label>
|
|
135
|
-
<span aria-labelledby="last-modified-label" className={styles.datestamp}>
|
|
136
|
-
{new Date(datestamp).toLocaleString()}
|
|
137
|
-
</span>
|
|
138
|
-
</>
|
|
139
|
-
) : null}
|
|
140
|
-
{description ? <P2 className={styles.description}>{description}</P2> : null}
|
|
141
|
-
{links ? (
|
|
142
|
-
<div className={styles.links}>
|
|
143
|
-
{links.map((link, linkIndex) => {
|
|
144
|
-
const isLastLink = linkIndex === links.length - 1;
|
|
145
|
-
return (
|
|
146
|
-
<div
|
|
147
|
-
className={classnames({
|
|
148
|
-
[styles.link]: !isLastLink,
|
|
149
|
-
[styles.lastLink]: isLastLink
|
|
150
|
-
})}
|
|
151
|
-
key={link.label}
|
|
152
|
-
>
|
|
153
|
-
<LinkButton href={link.url} variant="regular">
|
|
154
|
-
{link.label}
|
|
155
|
-
</LinkButton>
|
|
156
|
-
</div>
|
|
157
|
-
);
|
|
158
|
-
})}
|
|
159
|
-
</div>
|
|
160
|
-
) : null}
|
|
161
|
-
</div>
|
|
162
|
-
{image ? (
|
|
163
|
-
<HeroImageContainer
|
|
164
|
-
heroBackgroundImage={backgroundImage}
|
|
165
|
-
heroImage={image}
|
|
166
|
-
isFramed={isFramed}
|
|
167
|
-
isFullWidth={isFullWidth}
|
|
168
|
-
/>
|
|
169
|
-
) : null}
|
|
170
|
-
</div>
|
|
171
|
-
);
|
|
172
|
-
};
|
package/src/Hero/styles.css.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import {
|
|
3
|
-
hero,
|
|
4
|
-
responsiveSprinkles,
|
|
5
|
-
foregroundColor,
|
|
6
|
-
caption,
|
|
7
|
-
responsiveStyle
|
|
8
|
-
} from '@jpmorganchase/mosaic-theme';
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
datestamp: style([
|
|
12
|
-
{
|
|
13
|
-
fontStyle: 'italic'
|
|
14
|
-
},
|
|
15
|
-
caption({ variant: 'caption6' })
|
|
16
|
-
]),
|
|
17
|
-
datestampLabel: style([
|
|
18
|
-
{
|
|
19
|
-
fontStyle: 'italic'
|
|
20
|
-
},
|
|
21
|
-
caption({ variant: 'caption6' }),
|
|
22
|
-
responsiveSprinkles({ marginRight: ['x1', 'x1', 'x1', 'x1'] })
|
|
23
|
-
]),
|
|
24
|
-
description: style([
|
|
25
|
-
style({
|
|
26
|
-
whiteSpace: 'normal'
|
|
27
|
-
}),
|
|
28
|
-
responsiveSprinkles({ marginTop: ['x6', 'x6', 'x6', 'x6'] }),
|
|
29
|
-
foregroundColor({ variant: 'high' })
|
|
30
|
-
]),
|
|
31
|
-
eyebrow: style({
|
|
32
|
-
whiteSpace: 'normal'
|
|
33
|
-
}),
|
|
34
|
-
fixedSize: style({
|
|
35
|
-
display: 'flex'
|
|
36
|
-
}),
|
|
37
|
-
fullWidth: style({
|
|
38
|
-
display: 'block'
|
|
39
|
-
}),
|
|
40
|
-
fullWidthImage: responsiveSprinkles({ marginTop: ['x6', 'x6', 'x6', 'x6'] }),
|
|
41
|
-
fullWidthTitle: style([
|
|
42
|
-
style({
|
|
43
|
-
whiteSpace: 'normal',
|
|
44
|
-
maxWidth: 'unset'
|
|
45
|
-
}),
|
|
46
|
-
foregroundColor({ variant: 'high' })
|
|
47
|
-
]),
|
|
48
|
-
frame: style([
|
|
49
|
-
{
|
|
50
|
-
backgroundRepeat: 'no-repeat',
|
|
51
|
-
position: 'relative'
|
|
52
|
-
},
|
|
53
|
-
hero.frame,
|
|
54
|
-
responsiveSprinkles({
|
|
55
|
-
marginLeft: ['none', 'none', 'x6', 'x6'],
|
|
56
|
-
marginTop: ['x6', 'x6', 'none', 'none']
|
|
57
|
-
})
|
|
58
|
-
]),
|
|
59
|
-
frameImage: style([{ position: 'absolute' }, hero.frameImage]),
|
|
60
|
-
frameBackgroundImage: style([{ position: 'relative' }, hero.frameBackgroundImage]),
|
|
61
|
-
heading: style([
|
|
62
|
-
style({
|
|
63
|
-
whiteSpace: 'normal'
|
|
64
|
-
}),
|
|
65
|
-
responsiveSprinkles({
|
|
66
|
-
marginRight: ['x6', 'x6', 'x6', 'x6']
|
|
67
|
-
}),
|
|
68
|
-
foregroundColor({ variant: 'high' })
|
|
69
|
-
]),
|
|
70
|
-
image: style([
|
|
71
|
-
style(
|
|
72
|
-
responsiveStyle({
|
|
73
|
-
mobile: { height: '257px' },
|
|
74
|
-
tablet: { height: '333px' },
|
|
75
|
-
web: { height: '414px' },
|
|
76
|
-
desktop: { height: '425px' }
|
|
77
|
-
})
|
|
78
|
-
),
|
|
79
|
-
responsiveSprinkles({
|
|
80
|
-
marginTop: ['x6', 'x6', 'none', 'none']
|
|
81
|
-
})
|
|
82
|
-
]),
|
|
83
|
-
imageWidth: style(
|
|
84
|
-
responsiveStyle({
|
|
85
|
-
mobile: { width: '343px' },
|
|
86
|
-
tablet: { width: '444px' },
|
|
87
|
-
web: { width: '552px' },
|
|
88
|
-
desktop: { width: '566px' }
|
|
89
|
-
})
|
|
90
|
-
),
|
|
91
|
-
|
|
92
|
-
lastLink: responsiveSprinkles({ marginRight: ['none', 'none', 'none', 'none'] }),
|
|
93
|
-
link: responsiveSprinkles({ marginRight: ['x6', 'x6', 'x6', 'x6'] }),
|
|
94
|
-
links: style([
|
|
95
|
-
style({
|
|
96
|
-
display: 'flex'
|
|
97
|
-
}),
|
|
98
|
-
responsiveSprinkles({ marginTop: ['x6', 'x6', 'x6', 'x6'] })
|
|
99
|
-
]),
|
|
100
|
-
root: style([
|
|
101
|
-
responsiveSprinkles({
|
|
102
|
-
flexWrap: ['wrap', 'wrap', 'nowrap', 'nowrap']
|
|
103
|
-
}),
|
|
104
|
-
style({
|
|
105
|
-
justifyContent: 'space-between'
|
|
106
|
-
})
|
|
107
|
-
]),
|
|
108
|
-
title: style({
|
|
109
|
-
whiteSpace: 'normal'
|
|
110
|
-
})
|
|
111
|
-
};
|
package/src/Icon/index.tsx
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { icons, IconNames } from '@jpmorganchase/mosaic-theme';
|
|
3
|
-
|
|
4
|
-
export interface IconProps {
|
|
5
|
-
/** Additional class name for root class override. */
|
|
6
|
-
className?: string;
|
|
7
|
-
/** Name of the icon */
|
|
8
|
-
name: IconNames;
|
|
9
|
-
/** Size of Icon */
|
|
10
|
-
size?: number | 'small' | 'medium' | 'large';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const iconSizeMap = {
|
|
14
|
-
small: 1,
|
|
15
|
-
medium: 2,
|
|
16
|
-
large: 3
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const deprecatedIcons = {
|
|
20
|
-
tick: 'successTick'
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const Icon: React.FC<React.PropsWithChildren<IconProps>> = ({
|
|
24
|
-
className,
|
|
25
|
-
name,
|
|
26
|
-
size = 1,
|
|
27
|
-
...rest
|
|
28
|
-
}) => {
|
|
29
|
-
if (name === 'none') {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
let currentIconName = name;
|
|
33
|
-
if (deprecatedIcons[name]) {
|
|
34
|
-
console.warn(
|
|
35
|
-
`icon ${name} has been deprecated and should be replaced by ${deprecatedIcons[name]}`
|
|
36
|
-
);
|
|
37
|
-
console.warn(`icon ${name} will be removed after March 2023`);
|
|
38
|
-
currentIconName = deprecatedIcons[name];
|
|
39
|
-
}
|
|
40
|
-
if (!icons || !icons[currentIconName]) {
|
|
41
|
-
throw new Error(`icon ${currentIconName} is not supported`);
|
|
42
|
-
}
|
|
43
|
-
const IconComponent = icons[currentIconName];
|
|
44
|
-
const iconSize = typeof size === 'string' ? iconSizeMap[size] : size;
|
|
45
|
-
return (
|
|
46
|
-
<span className={className} {...rest}>
|
|
47
|
-
<IconComponent size={iconSize} />
|
|
48
|
-
</span>
|
|
49
|
-
);
|
|
50
|
-
};
|
package/src/ImageProvider.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createContext, Context, ElementType, useContext } from 'react';
|
|
2
|
-
|
|
3
|
-
export type ImageProviderValue = ElementType;
|
|
4
|
-
|
|
5
|
-
const ImageContext: Context<ImageProviderValue> = createContext<ImageProviderValue>('img');
|
|
6
|
-
|
|
7
|
-
export const useImageComponent = (): ElementType => useContext(ImageContext);
|
|
8
|
-
|
|
9
|
-
export const ImageProvider = ImageContext.Provider;
|
package/src/Impact/index.tsx
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classnames from 'clsx';
|
|
3
|
-
|
|
4
|
-
import styles from './styles.css';
|
|
5
|
-
import { useImageComponent } from '../ImageProvider';
|
|
6
|
-
|
|
7
|
-
export interface ImpactProps {
|
|
8
|
-
/** Additional class name for root class override */
|
|
9
|
-
className?: string;
|
|
10
|
-
/* Impact image */
|
|
11
|
-
image: string;
|
|
12
|
-
/* Impact label */
|
|
13
|
-
label: string;
|
|
14
|
-
/* Impact title */
|
|
15
|
-
title: React.ReactNode;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Impact: React.FC<React.PropsWithChildren<ImpactProps>> = ({
|
|
19
|
-
className,
|
|
20
|
-
image,
|
|
21
|
-
title,
|
|
22
|
-
label,
|
|
23
|
-
...rest
|
|
24
|
-
}: ImpactProps) => {
|
|
25
|
-
const ImageComponent = useImageComponent();
|
|
26
|
-
return (
|
|
27
|
-
<div className={classnames(styles.root, className)} {...rest}>
|
|
28
|
-
<div className={styles.line} />
|
|
29
|
-
<ImageComponent className={styles.image} src={image} />
|
|
30
|
-
<div>
|
|
31
|
-
<p className={styles.title}>{title}</p>
|
|
32
|
-
<p className={styles.label}>{label}</p>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
};
|
package/src/Impact/styles.css.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import {
|
|
3
|
-
amount,
|
|
4
|
-
backgroundColor,
|
|
5
|
-
impact,
|
|
6
|
-
neutralBorder,
|
|
7
|
-
paragraph,
|
|
8
|
-
responsiveSprinkles
|
|
9
|
-
} from '@jpmorganchase/mosaic-theme';
|
|
10
|
-
|
|
11
|
-
const styles = {
|
|
12
|
-
root: style([
|
|
13
|
-
{
|
|
14
|
-
alignContent: 'center',
|
|
15
|
-
display: 'flex',
|
|
16
|
-
flex: 1,
|
|
17
|
-
flexDirection: 'column',
|
|
18
|
-
justifyContent: 'center'
|
|
19
|
-
},
|
|
20
|
-
responsiveSprinkles({
|
|
21
|
-
padding: ['x3', 'x3', 'x4', 'x4']
|
|
22
|
-
}),
|
|
23
|
-
neutralBorder({
|
|
24
|
-
variant: 'low',
|
|
25
|
-
borderTopWidth: 'thin',
|
|
26
|
-
borderRightWidth: 'thin',
|
|
27
|
-
borderBottomWidth: 'thin',
|
|
28
|
-
borderLeftWidth: 'thin'
|
|
29
|
-
})
|
|
30
|
-
]),
|
|
31
|
-
image: style([
|
|
32
|
-
{
|
|
33
|
-
boxSizing: 'content-box',
|
|
34
|
-
position: 'relative',
|
|
35
|
-
left: '50%',
|
|
36
|
-
transform: 'translateX(-50%)'
|
|
37
|
-
},
|
|
38
|
-
backgroundColor({ variant: 'regular' }),
|
|
39
|
-
responsiveSprinkles({
|
|
40
|
-
paddingX: ['x2', 'x2', 'x2', 'x2']
|
|
41
|
-
}),
|
|
42
|
-
impact.image
|
|
43
|
-
]),
|
|
44
|
-
label: style([
|
|
45
|
-
{
|
|
46
|
-
textAlign: 'center'
|
|
47
|
-
},
|
|
48
|
-
paragraph({ variant: 'paragraph6' }),
|
|
49
|
-
responsiveSprinkles({
|
|
50
|
-
paddingTop: ['x2', 'x2', 'x2', 'x2']
|
|
51
|
-
})
|
|
52
|
-
]),
|
|
53
|
-
line: style([
|
|
54
|
-
{
|
|
55
|
-
height: '1px',
|
|
56
|
-
position: 'relative'
|
|
57
|
-
},
|
|
58
|
-
neutralBorder({ variant: 'low', borderBottomWidth: 'thin' }),
|
|
59
|
-
impact.line
|
|
60
|
-
]),
|
|
61
|
-
title: style([
|
|
62
|
-
{
|
|
63
|
-
textAlign: 'center'
|
|
64
|
-
},
|
|
65
|
-
amount(),
|
|
66
|
-
responsiveSprinkles({
|
|
67
|
-
marginX: ['auto', 'auto', 'auto', 'auto']
|
|
68
|
-
})
|
|
69
|
-
])
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default styles;
|
package/src/Impacts.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React, { Children, cloneElement, ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { Grid } from './Grid';
|
|
4
|
-
import { ImpactProps } from './Impact';
|
|
5
|
-
|
|
6
|
-
export interface ImpactsProps {
|
|
7
|
-
className?: string;
|
|
8
|
-
children: ReactElement<ImpactProps>[];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function layoutChildren(children) {
|
|
12
|
-
return Children.map(children, (child, index) =>
|
|
13
|
-
cloneElement(child, {
|
|
14
|
-
key: `impact-${index}`,
|
|
15
|
-
// disable any default spacing added by withMarkdownSpacing
|
|
16
|
-
spacing: 'none'
|
|
17
|
-
})
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const Impacts: React.FC<ImpactsProps> = ({ children, ...rest }) => (
|
|
22
|
-
<Grid size="large" {...rest}>
|
|
23
|
-
{layoutChildren(children)}
|
|
24
|
-
</Grid>
|
|
25
|
-
);
|