@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
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import {
|
|
3
|
-
backgroundColor,
|
|
4
|
-
calloutBorder,
|
|
5
|
-
calloutColor,
|
|
6
|
-
foregroundColor,
|
|
7
|
-
paragraph,
|
|
8
|
-
responsiveSprinkles
|
|
9
|
-
} from '@jpmorganchase/mosaic-theme';
|
|
10
|
-
|
|
11
|
-
const defaultBorder = calloutBorder({
|
|
12
|
-
variant: 'note',
|
|
13
|
-
borderTopWidth: 'thick',
|
|
14
|
-
borderBottomWidth: 'medium'
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export default {
|
|
18
|
-
root: style([
|
|
19
|
-
{
|
|
20
|
-
width: '100%'
|
|
21
|
-
},
|
|
22
|
-
backgroundColor({ variant: 'regular' }),
|
|
23
|
-
responsiveSprinkles({
|
|
24
|
-
paddingTop: ['x4', 'x4', 'x4', 'x4'],
|
|
25
|
-
paddingBottom: ['x4', 'x4', 'x4', 'x4']
|
|
26
|
-
})
|
|
27
|
-
]),
|
|
28
|
-
title: style([
|
|
29
|
-
{
|
|
30
|
-
verticalAlign: 'middle'
|
|
31
|
-
},
|
|
32
|
-
paragraph({ variant: 'paragraph1' })
|
|
33
|
-
]),
|
|
34
|
-
content: style([
|
|
35
|
-
paragraph({ variant: 'paragraph4' }),
|
|
36
|
-
responsiveSprinkles({
|
|
37
|
-
paddingLeft: ['x4', 'x4', 'x4', 'x4'],
|
|
38
|
-
paddingTop: ['x2', 'x2', 'x2', 'x2']
|
|
39
|
-
}),
|
|
40
|
-
foregroundColor({ variant: 'high' })
|
|
41
|
-
]),
|
|
42
|
-
icon: style([
|
|
43
|
-
{
|
|
44
|
-
verticalAlign: 'middle'
|
|
45
|
-
},
|
|
46
|
-
responsiveSprinkles({
|
|
47
|
-
paddingLeft: ['x4', 'x4', 'x4', 'x4'],
|
|
48
|
-
paddingRight: ['x2', 'x2', 'x2', 'x2']
|
|
49
|
-
})
|
|
50
|
-
]),
|
|
51
|
-
caution: calloutColor({ variant: 'caution' }),
|
|
52
|
-
important: calloutColor({ variant: 'important' }),
|
|
53
|
-
note: calloutColor({ variant: 'note' }),
|
|
54
|
-
tip: calloutColor({ variant: 'tip' }),
|
|
55
|
-
warning: calloutColor({ variant: 'warning' }),
|
|
56
|
-
cautionBorder: calloutBorder({
|
|
57
|
-
variant: 'caution',
|
|
58
|
-
borderTopWidth: 'thick',
|
|
59
|
-
borderBottomWidth: 'medium'
|
|
60
|
-
}),
|
|
61
|
-
importantBorder: calloutBorder({
|
|
62
|
-
variant: 'important',
|
|
63
|
-
borderTopWidth: 'thick',
|
|
64
|
-
borderBottomWidth: 'medium'
|
|
65
|
-
}),
|
|
66
|
-
noteBorder: defaultBorder,
|
|
67
|
-
tipBorder: calloutBorder({
|
|
68
|
-
variant: 'tip',
|
|
69
|
-
borderTopWidth: 'thick',
|
|
70
|
-
borderBottomWidth: 'medium'
|
|
71
|
-
}),
|
|
72
|
-
warningBorder: calloutBorder({
|
|
73
|
-
variant: 'warning',
|
|
74
|
-
borderTopWidth: 'thick',
|
|
75
|
-
borderBottomWidth: 'medium'
|
|
76
|
-
})
|
|
77
|
-
};
|
package/src/Card/index.tsx
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import styles from './styles.css';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The props type for [[`Card`]].
|
|
7
|
-
*/
|
|
8
|
-
export interface CardProps {
|
|
9
|
-
/** The content of the card. */
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
/** Additional class name for root class override. */
|
|
12
|
-
className?: string;
|
|
13
|
-
/** The step of the card. */
|
|
14
|
-
step: string;
|
|
15
|
-
/** The title of the card. */
|
|
16
|
-
title: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Renders a card. Cards are used to create a list of steps.
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* <Card step="01" title="Create">
|
|
24
|
-
* Starting with foundations and frameworks, create apps that leverage a common architecture to
|
|
25
|
-
* make your build easier.
|
|
26
|
-
* </Card>
|
|
27
|
-
*```
|
|
28
|
-
*/
|
|
29
|
-
export const Card: React.FC<CardProps> = ({ children, step, title, ...rest }: CardProps) => (
|
|
30
|
-
<div {...rest}>
|
|
31
|
-
<p className={styles.step}>{step}</p>
|
|
32
|
-
<p className={styles.title}>{title}</p>
|
|
33
|
-
<div className={styles.content}>{children}</div>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
package/src/Card/styles.css.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { heading, responsiveSprinkles, watermark } from '@jpmorganchase/mosaic-theme';
|
|
2
|
-
import { style } from '@vanilla-extract/css';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
content: style([
|
|
6
|
-
{
|
|
7
|
-
display: 'block'
|
|
8
|
-
},
|
|
9
|
-
responsiveSprinkles({ paddingTop: ['x6', 'x6', 'x6', 'x6'] })
|
|
10
|
-
]),
|
|
11
|
-
step: style([
|
|
12
|
-
{
|
|
13
|
-
display: 'block',
|
|
14
|
-
position: 'absolute'
|
|
15
|
-
},
|
|
16
|
-
watermark()
|
|
17
|
-
]),
|
|
18
|
-
title: style([
|
|
19
|
-
heading({ variant: 'heading6' }),
|
|
20
|
-
{ display: 'block' },
|
|
21
|
-
responsiveSprinkles({ paddingTop: ['x6', 'x6', 'x6', 'x6'] })
|
|
22
|
-
])
|
|
23
|
-
};
|
package/src/Cards.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React, { Children, cloneElement, ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import { Grid } from './Grid';
|
|
4
|
-
import { CardProps } from './Card';
|
|
5
|
-
|
|
6
|
-
export interface CardsProps {
|
|
7
|
-
className?: string;
|
|
8
|
-
children: ReactElement<CardProps>[];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function layoutChildren(children) {
|
|
12
|
-
return Children.map(children, (child, index) =>
|
|
13
|
-
cloneElement(child, {
|
|
14
|
-
key: `card-${index}`,
|
|
15
|
-
// disable any default spacing added by withMarkdownSpacing
|
|
16
|
-
spacing: 'none'
|
|
17
|
-
})
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const Cards: React.FC<CardsProps> = ({ children, ...rest }) => (
|
|
22
|
-
<Grid size="medium" {...rest}>
|
|
23
|
-
{layoutChildren(children)}
|
|
24
|
-
</Grid>
|
|
25
|
-
);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classnames from 'clsx';
|
|
3
|
-
|
|
4
|
-
import styles from './styles.css';
|
|
5
|
-
|
|
6
|
-
export interface ComponentExampleProps {
|
|
7
|
-
/** Contents */
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
/** Additional class name for overrides */
|
|
10
|
-
className?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const ComponentExample: React.FC<ComponentExampleProps> = ({
|
|
14
|
-
children,
|
|
15
|
-
className,
|
|
16
|
-
...rest
|
|
17
|
-
}: ComponentExampleProps) => (
|
|
18
|
-
<div className={classnames(styles.root, className)} {...rest}>
|
|
19
|
-
<div className={styles.innerContainer}>
|
|
20
|
-
<div className={styles.component}>{children}</div>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { componentExample, responsiveSprinkles, siteBorder } from '@jpmorganchase/mosaic-theme';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
component: componentExample({ backgroundColor: 'component' }),
|
|
6
|
-
innerContainer: style([
|
|
7
|
-
componentExample({ backgroundColor: 'inner' }),
|
|
8
|
-
siteBorder({
|
|
9
|
-
variant: 'boundary',
|
|
10
|
-
borderTopWidth: 'thin',
|
|
11
|
-
borderRightWidth: 'thin',
|
|
12
|
-
borderBottomWidth: 'thin',
|
|
13
|
-
borderLeftWidth: 'thin'
|
|
14
|
-
})
|
|
15
|
-
]),
|
|
16
|
-
root: style([
|
|
17
|
-
style({
|
|
18
|
-
width: '100%'
|
|
19
|
-
}),
|
|
20
|
-
style([componentExample({ backgroundColor: 'outer' })]),
|
|
21
|
-
responsiveSprinkles({
|
|
22
|
-
padding: ['x4', 'x4', 'x4', 'x4']
|
|
23
|
-
})
|
|
24
|
-
])
|
|
25
|
-
};
|
package/src/DataTable.tsx
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement, Ref } from 'react';
|
|
2
|
-
import type { Column, PluginHook } from 'react-table';
|
|
3
|
-
import classnames from 'clsx';
|
|
4
|
-
import {
|
|
5
|
-
table as tableRecipe,
|
|
6
|
-
tbody as tbodyRecipe,
|
|
7
|
-
td as tdRecipe,
|
|
8
|
-
th as thRecipe,
|
|
9
|
-
thead as theadRecipe,
|
|
10
|
-
tr as trRecipe
|
|
11
|
-
} from '@jpmorganchase/mosaic-theme';
|
|
12
|
-
|
|
13
|
-
import { IsomorphicSuspense } from './IsomorphicSuspense';
|
|
14
|
-
|
|
15
|
-
function TableHead({ headerGroups }) {
|
|
16
|
-
return (
|
|
17
|
-
<thead className={theadRecipe()}>
|
|
18
|
-
{headerGroups.map((headerGroup, groupIndex) => (
|
|
19
|
-
<tr
|
|
20
|
-
className={trRecipe()}
|
|
21
|
-
key={`headGroup${groupIndex}`}
|
|
22
|
-
{...headerGroup.getHeaderGroupProps()}
|
|
23
|
-
>
|
|
24
|
-
{headerGroup.headers.map((column, columnIndex) => (
|
|
25
|
-
<th
|
|
26
|
-
className={thRecipe()}
|
|
27
|
-
key={`headColumn${columnIndex}`}
|
|
28
|
-
{...column.getHeaderProps()}
|
|
29
|
-
>
|
|
30
|
-
{column.render('Header')}
|
|
31
|
-
</th>
|
|
32
|
-
))}
|
|
33
|
-
</tr>
|
|
34
|
-
))}
|
|
35
|
-
</thead>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function TableBody({ getTableBodyProps, prepareRow, rows }) {
|
|
40
|
-
return (
|
|
41
|
-
<tbody className={tbodyRecipe()} {...getTableBodyProps()}>
|
|
42
|
-
{rows.map((row, rowIndex) => {
|
|
43
|
-
prepareRow(row);
|
|
44
|
-
return (
|
|
45
|
-
<tr className={trRecipe()} key={`bodyRow${rowIndex}`} {...row.getRowProps()}>
|
|
46
|
-
{row.cells.map((cell, cellIndex) => (
|
|
47
|
-
<td className={tdRecipe()} key={`bodyCell${cellIndex}`} {...cell.getCellProps()}>
|
|
48
|
-
{cell.render('Cell')}
|
|
49
|
-
</td>
|
|
50
|
-
))}
|
|
51
|
-
</tr>
|
|
52
|
-
);
|
|
53
|
-
})}
|
|
54
|
-
</tbody>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface DataTableProps<RowData extends Record<string, unknown>> {
|
|
59
|
-
/** Additional class name for root class override */
|
|
60
|
-
className?: string;
|
|
61
|
-
/** Column specs (refer to react-table API) */
|
|
62
|
-
columns: Column<RowData>[];
|
|
63
|
-
/** Data model (refer to react-table API) */
|
|
64
|
-
data: Array<RowData>;
|
|
65
|
-
/** Ref */
|
|
66
|
-
ref?: Ref<HTMLDivElement>;
|
|
67
|
-
/** If false, column headers will be hidden */
|
|
68
|
-
showColumnHeaders?: boolean;
|
|
69
|
-
/** Collection of react-table plugin hooks to be applied to the table (refer to react-table API) */
|
|
70
|
-
plugins?: PluginHook<RowData>[];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const LazyTable = React.lazy(() =>
|
|
74
|
-
import('react-table').then(({ useTable }) => ({
|
|
75
|
-
default: React.forwardRef(
|
|
76
|
-
({ className, columns, data, plugins, showColumnHeaders }, ref: Ref<HTMLTableElement>) => {
|
|
77
|
-
const { getTableProps, getTableBodyProps, headerGroups, prepareRow, rows } = useTable(
|
|
78
|
-
{
|
|
79
|
-
columns,
|
|
80
|
-
data
|
|
81
|
-
},
|
|
82
|
-
...plugins
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<table className={classnames(className, tableRecipe())} {...getTableProps()} ref={ref}>
|
|
87
|
-
{showColumnHeaders ? <TableHead headerGroups={headerGroups} /> : null}
|
|
88
|
-
<TableBody getTableBodyProps={getTableBodyProps} prepareRow={prepareRow} rows={rows} />
|
|
89
|
-
</table>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
}))
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
const ForwardRefTable = <T extends Record<string, unknown>>(
|
|
97
|
-
{ className, columns, data, showColumnHeaders = true, plugins = [] }: DataTableProps<T>,
|
|
98
|
-
ref: Ref<HTMLTableElement>
|
|
99
|
-
) => (
|
|
100
|
-
<IsomorphicSuspense fallback={<span>Loading table...</span>}>
|
|
101
|
-
<LazyTable
|
|
102
|
-
className={className}
|
|
103
|
-
columns={columns}
|
|
104
|
-
data={data}
|
|
105
|
-
plugins={plugins}
|
|
106
|
-
ref={ref}
|
|
107
|
-
showColumnHeaders={showColumnHeaders}
|
|
108
|
-
/>
|
|
109
|
-
</IsomorphicSuspense>
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
export const DataTable = React.forwardRef(ForwardRefTable) as <T extends Record<string, unknown>>(
|
|
113
|
-
p: DataTableProps<T> & { ref?: Ref<HTMLTableElement> }
|
|
114
|
-
) => ReactElement;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { EditionFilterView } from '../index';
|
|
5
|
-
|
|
6
|
-
describe('GIVEN an EditionaFilterView', () => {
|
|
7
|
-
global.ResizeObserver = jest.fn().mockImplementation(() => ({
|
|
8
|
-
observe: jest.fn(),
|
|
9
|
-
unobserve: jest.fn(),
|
|
10
|
-
disconnect: jest.fn()
|
|
11
|
-
}));
|
|
12
|
-
const singleGroupView = [1, 2].map(index => ({
|
|
13
|
-
eyebrow: `EYEBROW${index}`,
|
|
14
|
-
group: 'SINGLE_GROUP',
|
|
15
|
-
link: `LINK_URL${index}`,
|
|
16
|
-
publicationDate: `PUBLICATION_DATE${index}`,
|
|
17
|
-
formattedDescription: `FORMATTED_DESCRIPTION${index}`,
|
|
18
|
-
title: `TITLE${index}`
|
|
19
|
-
}));
|
|
20
|
-
const multiGroupView = [1, 2].map(index => ({
|
|
21
|
-
eyebrow: `EYEBROW${index}`,
|
|
22
|
-
group: `MULTI_GROUP${index}`,
|
|
23
|
-
link: `LINK_URL${index}`,
|
|
24
|
-
publicationDate: `PUBLICATION_DATE${index}`,
|
|
25
|
-
formattedDescription: `FORMATTED_DESCRIPTION${index}`,
|
|
26
|
-
title: `TITLE${index}`
|
|
27
|
-
}));
|
|
28
|
-
test('THEN the children are rendered', () => {
|
|
29
|
-
// arrange
|
|
30
|
-
render(<EditionFilterView className="custom-class" view={multiGroupView} />);
|
|
31
|
-
// assert
|
|
32
|
-
expect(screen.getByText('EYEBROW1')).toBeInTheDocument();
|
|
33
|
-
expect(screen.getByText('FORMATTED_DESCRIPTION1')).toBeInTheDocument();
|
|
34
|
-
expect(screen.getByText('FORMATTED_DESCRIPTION1')).toBeInTheDocument();
|
|
35
|
-
expect(screen.getByText('TITLE1')).toBeInTheDocument();
|
|
36
|
-
});
|
|
37
|
-
test('THEN the filter view is not rendered for single group', () => {
|
|
38
|
-
// arrange
|
|
39
|
-
render(<EditionFilterView view={singleGroupView} />);
|
|
40
|
-
// assert
|
|
41
|
-
expect(screen.queryByText('All Results Displayed')).not.toBeInTheDocument();
|
|
42
|
-
});
|
|
43
|
-
test('THEN the filter view is rendered for multi-group', () => {
|
|
44
|
-
// arrange
|
|
45
|
-
render(<EditionFilterView view={multiGroupView} />);
|
|
46
|
-
// assert
|
|
47
|
-
expect(screen.getByText('All Results Displayed')).toBeInTheDocument();
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classnames from 'clsx';
|
|
3
|
-
|
|
4
|
-
import { FilterResultCount, FilterView } from '../FilterView';
|
|
5
|
-
import { FilterDropdown, FilterSortDropdown } from '../FilterToolbar';
|
|
6
|
-
import { EditionTileLink } from '../EditionTileLink';
|
|
7
|
-
import { FormattedContent } from '../FormattedContent';
|
|
8
|
-
import styles from './styles.css';
|
|
9
|
-
|
|
10
|
-
export const createCustomFilter = (view, filters) =>
|
|
11
|
-
view.filter(({ group }) => filters.includes(group));
|
|
12
|
-
|
|
13
|
-
export const createFiltersList = items =>
|
|
14
|
-
items.reduce((allGroups, { group }) => {
|
|
15
|
-
if (group && allGroups.indexOf(group) === -1) {
|
|
16
|
-
return [...allGroups, group];
|
|
17
|
-
}
|
|
18
|
-
return allGroups;
|
|
19
|
-
}, []);
|
|
20
|
-
|
|
21
|
-
function editionSort(view: Edition[], sort = 'DESC'): Edition[] {
|
|
22
|
-
return view.sort((sortableA, sortableB) => {
|
|
23
|
-
const publicationDateA = new Date(sortableA.publicationDate);
|
|
24
|
-
const publicationDateB = new Date(sortableB.publicationDate);
|
|
25
|
-
if (sort === 'Newest') {
|
|
26
|
-
return publicationDateB.valueOf() - publicationDateA.valueOf();
|
|
27
|
-
}
|
|
28
|
-
return publicationDateA.valueOf() - publicationDateB.valueOf();
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const itemToString = item => item;
|
|
33
|
-
const labelButton = item => item;
|
|
34
|
-
|
|
35
|
-
export type Edition = {
|
|
36
|
-
eyebrow?: string;
|
|
37
|
-
image?: string;
|
|
38
|
-
group?: string;
|
|
39
|
-
link: string;
|
|
40
|
-
publicationDate: string;
|
|
41
|
-
formattedDescription?: string;
|
|
42
|
-
title?: string;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type EditionFilterViewRenderer = (
|
|
46
|
-
/** Edition data item */
|
|
47
|
-
item: Edition,
|
|
48
|
-
/** Edition item index in view */
|
|
49
|
-
itemIndex: number
|
|
50
|
-
) => JSX.Element;
|
|
51
|
-
|
|
52
|
-
export type EditionFilterViewProps = {
|
|
53
|
-
/** Additional class name for root class override */
|
|
54
|
-
className?: string;
|
|
55
|
-
/** Data view of editions */
|
|
56
|
-
view: Edition[];
|
|
57
|
-
/** Item Renderer */
|
|
58
|
-
ItemRenderer: EditionFilterViewRenderer;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const DefaultEditionFilterViewRenderer: EditionFilterViewRenderer = (item, itemIndex) => (
|
|
62
|
-
<EditionTileLink
|
|
63
|
-
description={
|
|
64
|
-
item.formattedDescription ? (
|
|
65
|
-
<FormattedContent>{item.formattedDescription}</FormattedContent>
|
|
66
|
-
) : null
|
|
67
|
-
}
|
|
68
|
-
eyebrow={item.eyebrow}
|
|
69
|
-
image={item.image}
|
|
70
|
-
key={`editionTile-${itemIndex}`}
|
|
71
|
-
link={item.link}
|
|
72
|
-
title={item.title}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
export const EditionFilterView: React.FC<React.PropsWithChildren<EditionFilterViewProps>> = ({
|
|
76
|
-
className,
|
|
77
|
-
ItemRenderer = DefaultEditionFilterViewRenderer,
|
|
78
|
-
view,
|
|
79
|
-
...rest
|
|
80
|
-
}) => {
|
|
81
|
-
const filtersList = createFiltersList(view);
|
|
82
|
-
return (
|
|
83
|
-
<FilterView<Edition>
|
|
84
|
-
className={classnames(styles.root, className)}
|
|
85
|
-
filter={createCustomFilter}
|
|
86
|
-
itemRenderer={ItemRenderer}
|
|
87
|
-
size="fullWidth"
|
|
88
|
-
sort={editionSort}
|
|
89
|
-
initialState={{ sort: 'Newest' }}
|
|
90
|
-
view={view}
|
|
91
|
-
enablePagination
|
|
92
|
-
itemsPerPage={12}
|
|
93
|
-
{...rest}
|
|
94
|
-
>
|
|
95
|
-
{filtersList.length > 1 ? (
|
|
96
|
-
<>
|
|
97
|
-
<FilterResultCount />
|
|
98
|
-
<FilterDropdown source={filtersList} />
|
|
99
|
-
</>
|
|
100
|
-
) : null}
|
|
101
|
-
<FilterSortDropdown
|
|
102
|
-
source={['Oldest', 'Newest']}
|
|
103
|
-
itemToString={itemToString}
|
|
104
|
-
labelButton={labelButton}
|
|
105
|
-
/>
|
|
106
|
-
</FilterView>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React, { FC, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
import { LinkBase } from '../LinkBase';
|
|
4
|
-
import { LinkText } from '../LinkText';
|
|
5
|
-
import { TileBase, useTileState } from '../TileBase';
|
|
6
|
-
import { useImageComponent } from '../ImageProvider';
|
|
7
|
-
import { useBreakpoint } from '../useBreakpoint';
|
|
8
|
-
import styles, { imageRecipe, tileImageRecipe } from './styles.css';
|
|
9
|
-
|
|
10
|
-
const PseudoLink = ({ children }) => {
|
|
11
|
-
const {
|
|
12
|
-
highlighted: [isHighlighted]
|
|
13
|
-
} = useTileState();
|
|
14
|
-
return (
|
|
15
|
-
<LinkText endIcon="chevronRight" hovered={isHighlighted}>
|
|
16
|
-
{children}
|
|
17
|
-
</LinkText>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type EditionTileLinkProps = {
|
|
22
|
-
/** Additional class name for root class override */
|
|
23
|
-
className?: string;
|
|
24
|
-
/** Link description */
|
|
25
|
-
description?: ReactNode;
|
|
26
|
-
/** Eyebrow text describing the content type */
|
|
27
|
-
eyebrow?: string;
|
|
28
|
-
/** Image associated with edition */
|
|
29
|
-
image?: string;
|
|
30
|
-
/** Placement of the image */
|
|
31
|
-
imagePlacement?: 'left' | 'fullWidth';
|
|
32
|
-
/** Link href */
|
|
33
|
-
link: string;
|
|
34
|
-
/** Edition title */
|
|
35
|
-
title?: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const TileImage: FC<
|
|
39
|
-
React.PropsWithChildren<Pick<EditionTileLinkProps, 'image' | 'imagePlacement'>>
|
|
40
|
-
> = ({ image, imagePlacement }) => {
|
|
41
|
-
const ImageComponent = useImageComponent();
|
|
42
|
-
if (!image || !ImageComponent) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
return (
|
|
46
|
-
<div className={tileImageRecipe({ imagePlacement })}>
|
|
47
|
-
<ImageComponent
|
|
48
|
-
alt=""
|
|
49
|
-
aria-describedby="tilecontent-description"
|
|
50
|
-
className={imageRecipe({ imagePlacement })}
|
|
51
|
-
fill
|
|
52
|
-
src={image}
|
|
53
|
-
/>
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const EditionTileLink: React.FC<React.PropsWithChildren<EditionTileLinkProps>> = ({
|
|
59
|
-
description,
|
|
60
|
-
eyebrow = null,
|
|
61
|
-
image,
|
|
62
|
-
imagePlacement: imagePlacementProp,
|
|
63
|
-
link,
|
|
64
|
-
title,
|
|
65
|
-
...rest
|
|
66
|
-
}) => {
|
|
67
|
-
const breakpoint = useBreakpoint();
|
|
68
|
-
const imagePlacementResponsive = breakpoint === 'mobile' ? 'fullWidth' : 'left';
|
|
69
|
-
const imagePlacement = imagePlacementProp || imagePlacementResponsive;
|
|
70
|
-
return (
|
|
71
|
-
<TileBase className={styles.root} {...rest} size="fullWidth">
|
|
72
|
-
<LinkBase
|
|
73
|
-
className={styles.content}
|
|
74
|
-
aria-labelledby="tilecontent-title"
|
|
75
|
-
href={link}
|
|
76
|
-
tabIndex={0}
|
|
77
|
-
>
|
|
78
|
-
{image ? <TileImage image={image} imagePlacement={imagePlacement} /> : null}
|
|
79
|
-
<div>
|
|
80
|
-
{eyebrow ? <p className={styles.eyebrow}>{eyebrow}</p> : null}
|
|
81
|
-
{title ? <p className={styles.title}>{title}</p> : null}
|
|
82
|
-
{description ? <div className={styles.description}>{description}</div> : null}
|
|
83
|
-
<PseudoLink>
|
|
84
|
-
<p className={styles.action}>Read More</p>
|
|
85
|
-
</PseudoLink>
|
|
86
|
-
</div>
|
|
87
|
-
</LinkBase>
|
|
88
|
-
</TileBase>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
|
-
import {
|
|
4
|
-
action,
|
|
5
|
-
caption,
|
|
6
|
-
foregroundColor,
|
|
7
|
-
heading,
|
|
8
|
-
neutralBorder,
|
|
9
|
-
paragraph,
|
|
10
|
-
responsiveSprinkles
|
|
11
|
-
} from '@jpmorganchase/mosaic-theme';
|
|
12
|
-
|
|
13
|
-
export const tileImageRecipe = recipe({
|
|
14
|
-
base: responsiveSprinkles({
|
|
15
|
-
marginRight: ['none', 'x4', 'x4', 'x4'],
|
|
16
|
-
marginBottom: ['x4', 'none', 'none', 'none']
|
|
17
|
-
}),
|
|
18
|
-
variants: {
|
|
19
|
-
imagePlacement: {
|
|
20
|
-
left: {
|
|
21
|
-
width: '100px',
|
|
22
|
-
height: '100px'
|
|
23
|
-
},
|
|
24
|
-
fullWidth: neutralBorder({ variant: 'high', borderBottomWidth: 'thick' })
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
defaultVariants: {
|
|
28
|
-
imagePlacement: 'left'
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
export type TileImageVariants = RecipeVariants<typeof tileImageRecipe>;
|
|
32
|
-
|
|
33
|
-
export const imageRecipe = recipe({
|
|
34
|
-
variants: {
|
|
35
|
-
imagePlacement: {
|
|
36
|
-
left: style([
|
|
37
|
-
{
|
|
38
|
-
height: '100px',
|
|
39
|
-
width: '100px'
|
|
40
|
-
}
|
|
41
|
-
]),
|
|
42
|
-
fullWidth: {
|
|
43
|
-
width: '100%',
|
|
44
|
-
height: '186px'
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
defaultVariants: {
|
|
49
|
-
imagePlacement: 'left'
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
export type ImageVariants = RecipeVariants<typeof imageRecipe>;
|
|
53
|
-
|
|
54
|
-
export default {
|
|
55
|
-
root: style([
|
|
56
|
-
neutralBorder({ variant: 'low', borderBottomWidth: 'thin' }),
|
|
57
|
-
foregroundColor({ variant: 'high' }),
|
|
58
|
-
responsiveSprinkles({
|
|
59
|
-
padding: ['x8', 'x8', 'x8', 'x8']
|
|
60
|
-
})
|
|
61
|
-
]),
|
|
62
|
-
content: style([
|
|
63
|
-
{
|
|
64
|
-
display: 'flex',
|
|
65
|
-
width: '100%'
|
|
66
|
-
},
|
|
67
|
-
responsiveSprinkles({
|
|
68
|
-
flexDirection: ['column', 'row', 'row', 'row']
|
|
69
|
-
})
|
|
70
|
-
]),
|
|
71
|
-
eyebrow: style([
|
|
72
|
-
caption({ variant: 'caption2' }),
|
|
73
|
-
responsiveSprinkles({
|
|
74
|
-
marginBottom: ['x2', 'x2', 'x2', 'x2']
|
|
75
|
-
})
|
|
76
|
-
]),
|
|
77
|
-
title: style([
|
|
78
|
-
heading({ variant: 'heading5' }),
|
|
79
|
-
responsiveSprinkles({
|
|
80
|
-
marginBottom: ['x2', 'x2', 'x2', 'x2']
|
|
81
|
-
})
|
|
82
|
-
]),
|
|
83
|
-
description: style([
|
|
84
|
-
paragraph({ variant: 'paragraph4' }),
|
|
85
|
-
responsiveSprinkles({
|
|
86
|
-
marginBottom: ['x4', 'x4', 'x4', 'x4']
|
|
87
|
-
})
|
|
88
|
-
]),
|
|
89
|
-
action: style([
|
|
90
|
-
action({ variant: 'action1' }),
|
|
91
|
-
responsiveSprinkles({
|
|
92
|
-
marginTop: ['x4', 'x4', 'x4', 'x4']
|
|
93
|
-
})
|
|
94
|
-
])
|
|
95
|
-
};
|