@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/Feature/Feature.tsx
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classnames from 'clsx';
|
|
3
|
-
import { feature } from '@jpmorganchase/mosaic-theme';
|
|
4
|
-
|
|
5
|
-
import styles from './styles.css';
|
|
6
|
-
import { useImageComponent } from '../ImageProvider';
|
|
7
|
-
|
|
8
|
-
export type FeatureClassesType = {
|
|
9
|
-
content?: string;
|
|
10
|
-
image?: string;
|
|
11
|
-
title?: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The props type for [[`Feature`]].
|
|
16
|
-
*/
|
|
17
|
-
export interface FeatureProps {
|
|
18
|
-
/** Additional class name for root class override */
|
|
19
|
-
/** Content of the Feature. */
|
|
20
|
-
children?: React.ReactNode;
|
|
21
|
-
/** Additional class name for root class override. */
|
|
22
|
-
className?: string;
|
|
23
|
-
/** Object to override internal class names. */
|
|
24
|
-
classes?: FeatureClassesType;
|
|
25
|
-
/** Image to be displayed. */
|
|
26
|
-
image?: string;
|
|
27
|
-
/** Image placement, relative to content. */
|
|
28
|
-
imagePlacement?: 'left' | 'right';
|
|
29
|
-
/** The variant of the Feature. */
|
|
30
|
-
variant?: 'primary' | 'secondary' | 'regular';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Renders a Feature. A Feature consists of an image, associated text description, and actions.
|
|
35
|
-
* @example
|
|
36
|
-
* ```
|
|
37
|
-
* <Feature
|
|
38
|
-
* image="img/feature_image.png"
|
|
39
|
-
* >
|
|
40
|
-
* <FeatureTitle>Title</FeatureTitle>
|
|
41
|
-
* <FeatureContent>
|
|
42
|
-
* Insert your content here.
|
|
43
|
-
* </FeatureContent>
|
|
44
|
-
* <FeatureActions>
|
|
45
|
-
* <Button link="mailto:contact@example.com:">
|
|
46
|
-
* Button label
|
|
47
|
-
* </Button>
|
|
48
|
-
* </FeatureActions>
|
|
49
|
-
* </Feature>
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export const Feature: React.FC<FeatureProps> = ({
|
|
53
|
-
children,
|
|
54
|
-
classes = {},
|
|
55
|
-
className,
|
|
56
|
-
image,
|
|
57
|
-
imagePlacement = 'right',
|
|
58
|
-
variant = 'primary',
|
|
59
|
-
...rest
|
|
60
|
-
}) => {
|
|
61
|
-
const isPrimary = variant === 'primary';
|
|
62
|
-
const ImageComponent = useImageComponent();
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<div
|
|
66
|
-
className={classnames(
|
|
67
|
-
styles.root,
|
|
68
|
-
styles[`${imagePlacement}ImageRoot`],
|
|
69
|
-
styles[`${variant}ContentRoot`],
|
|
70
|
-
feature(),
|
|
71
|
-
className
|
|
72
|
-
)}
|
|
73
|
-
{...rest}
|
|
74
|
-
>
|
|
75
|
-
<div>
|
|
76
|
-
{isPrimary && <div className={classnames(styles.highlightBar)} />}
|
|
77
|
-
{children}
|
|
78
|
-
</div>
|
|
79
|
-
<div>
|
|
80
|
-
{image && (
|
|
81
|
-
<ImageComponent
|
|
82
|
-
alt="feature image"
|
|
83
|
-
aria-describedby="feature image"
|
|
84
|
-
className={classnames(classes.image, styles.image, styles[`${imagePlacement}Image`])}
|
|
85
|
-
fill
|
|
86
|
-
src={image}
|
|
87
|
-
/>
|
|
88
|
-
)}
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
);
|
|
92
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React, { cloneElement, Children, ReactNode } from 'react';
|
|
2
|
-
import classNames from 'clsx';
|
|
3
|
-
|
|
4
|
-
import styles from './styles.css';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The props type for [[`FeatureActions`]].
|
|
8
|
-
*/
|
|
9
|
-
export interface FeatureActionsProps {
|
|
10
|
-
/** Additional class name for root class override. */
|
|
11
|
-
className?: string;
|
|
12
|
-
/** The content of the FeatureActions. */
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function layoutChildren(children) {
|
|
17
|
-
return Children.map(children, (child, index) =>
|
|
18
|
-
cloneElement(child, {
|
|
19
|
-
key: `featureAction-${index}`,
|
|
20
|
-
// disable any default spacing added by withMarkdownSpacing
|
|
21
|
-
spacing: 'none'
|
|
22
|
-
})
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const FeatureActions: React.FC<React.PropsWithChildren<FeatureActionsProps>> = ({
|
|
27
|
-
children,
|
|
28
|
-
className,
|
|
29
|
-
...rest
|
|
30
|
-
}) => (
|
|
31
|
-
<div className={classNames(className, styles.root)} {...rest}>
|
|
32
|
-
{layoutChildren(children)}
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { responsiveSprinkles } from '@jpmorganchase/mosaic-theme';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
root: style([
|
|
6
|
-
{
|
|
7
|
-
display: 'flex'
|
|
8
|
-
},
|
|
9
|
-
responsiveSprinkles({
|
|
10
|
-
columnGap: ['x2', 'x2', 'x2', 'x2'],
|
|
11
|
-
marginBottom: ['x6', 'x6', 'x6', 'x6'],
|
|
12
|
-
marginTop: ['x2', 'x2', 'x2', 'x2']
|
|
13
|
-
})
|
|
14
|
-
])
|
|
15
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React, { cloneElement, Children, ReactNode } from 'react';
|
|
2
|
-
import classNames from 'clsx';
|
|
3
|
-
|
|
4
|
-
import styles from './styles.css';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The props type for [[`FeatureContent`]].
|
|
8
|
-
*/
|
|
9
|
-
export interface FeatureContentProps {
|
|
10
|
-
/** Additional class name for root class override. */
|
|
11
|
-
className?: string;
|
|
12
|
-
/** The content of the FeatureContent. */
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function layoutChildren(children) {
|
|
17
|
-
return Children.map(children, (child, index) =>
|
|
18
|
-
child.type != null
|
|
19
|
-
? cloneElement(child, {
|
|
20
|
-
key: `featureContent-${index}`,
|
|
21
|
-
// disable any default spacing added by withMarkdownSpacing
|
|
22
|
-
spacing: 'none'
|
|
23
|
-
})
|
|
24
|
-
: child
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const FeatureContent: React.FC<FeatureContentProps> = ({ children, className }) => (
|
|
29
|
-
<div className={classNames(className, styles.root)}>{layoutChildren(children)}</div>
|
|
30
|
-
);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { responsiveSprinkles, paragraph } from '@jpmorganchase/mosaic-theme';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
root: style([
|
|
6
|
-
{
|
|
7
|
-
flexGrow: 1,
|
|
8
|
-
display: 'inline-block'
|
|
9
|
-
},
|
|
10
|
-
responsiveSprinkles({ marginBottom: ['x2', 'x2', 'x2', 'x2'] }),
|
|
11
|
-
paragraph({ variant: 'paragraph2' })
|
|
12
|
-
])
|
|
13
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import classNames from 'clsx';
|
|
3
|
-
|
|
4
|
-
import { Eyebrow } from '../../Typography';
|
|
5
|
-
import styles from './styles.css';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The props type for [[`FeatureEyebrow`]].
|
|
9
|
-
*/
|
|
10
|
-
export interface FeatureEyebrowProps {
|
|
11
|
-
/** Additional class name for root class override. */
|
|
12
|
-
className?: string;
|
|
13
|
-
/** The content of the FeatureEyebrow. */
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const FeatureEyebrow: React.FC<FeatureEyebrowProps> = ({ children, className }) => (
|
|
18
|
-
<Eyebrow className={classNames(className, styles.root)}>{children}</Eyebrow>
|
|
19
|
-
);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { responsiveSprinkles } from '@jpmorganchase/mosaic-theme';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
root: style([
|
|
6
|
-
{
|
|
7
|
-
whiteSpace: 'normal'
|
|
8
|
-
},
|
|
9
|
-
responsiveSprinkles({ marginBottom: ['x4', 'x4', 'x4', 'x4'] })
|
|
10
|
-
])
|
|
11
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import classNames from 'clsx';
|
|
3
|
-
|
|
4
|
-
import styles from './styles.css';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The props type for [[`FeatureTitle`]].
|
|
8
|
-
*/
|
|
9
|
-
export interface FeatureTitleProps {
|
|
10
|
-
/** Additional class name for root class override. */
|
|
11
|
-
className?: string;
|
|
12
|
-
/** The content of the FeatureTitle. */
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const FeatureTitle: React.FC<FeatureTitleProps> = ({ children, className }) => (
|
|
17
|
-
<div className={classNames(className, styles.root)}>{children}</div>
|
|
18
|
-
);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { heading, responsiveSprinkles } from '@jpmorganchase/mosaic-theme';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
root: style([
|
|
6
|
-
responsiveSprinkles({ marginBottom: ['x4', 'x4', 'x4', 'x4'] }),
|
|
7
|
-
heading({ variant: 'heading3' })
|
|
8
|
-
])
|
|
9
|
-
};
|
package/src/Feature/index.tsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { Feature } from './Feature';
|
|
2
|
-
export { FeatureContent } from './FeatureContent';
|
|
3
|
-
export type { FeatureContentProps } from './FeatureContent';
|
|
4
|
-
export { FeatureEyebrow } from './FeatureEyebrow';
|
|
5
|
-
export type { FeatureEyebrowProps } from './FeatureEyebrow';
|
|
6
|
-
export type { FeatureProps } from './Feature';
|
|
7
|
-
export { FeatureActions } from './FeatureActions';
|
|
8
|
-
export type { FeatureActionsProps } from './FeatureActions';
|
|
9
|
-
export { FeatureTitle } from './FeatureTitle';
|
|
10
|
-
export type { FeatureTitleProps } from './FeatureTitle';
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { neutralBorder, paragraph, responsiveSprinkles, vars } from '@jpmorganchase/mosaic-theme';
|
|
3
|
-
|
|
4
|
-
const styles = {
|
|
5
|
-
root: style([
|
|
6
|
-
{
|
|
7
|
-
display: 'flex',
|
|
8
|
-
width: '100%'
|
|
9
|
-
},
|
|
10
|
-
responsiveSprinkles({ flexDirection: ['column', 'column', 'row', 'row'] })
|
|
11
|
-
]),
|
|
12
|
-
secondaryContentRoot: style([
|
|
13
|
-
{
|
|
14
|
-
alignItems: 'center'
|
|
15
|
-
}
|
|
16
|
-
]),
|
|
17
|
-
primaryContentRoot: style([
|
|
18
|
-
{
|
|
19
|
-
alignItems: 'start'
|
|
20
|
-
}
|
|
21
|
-
]),
|
|
22
|
-
content: style([paragraph({ variant: 'paragraph2' })]),
|
|
23
|
-
leftImageRoot: style([
|
|
24
|
-
{ justifyContent: 'flex-end' },
|
|
25
|
-
responsiveSprinkles({
|
|
26
|
-
flexDirection: ['column', 'column', 'row-reverse', 'row-reverse']
|
|
27
|
-
})
|
|
28
|
-
]),
|
|
29
|
-
rightImageRoot: style([
|
|
30
|
-
{ justifyContent: 'space-between' },
|
|
31
|
-
responsiveSprinkles({ flexDirection: ['column', 'column', 'row', 'row'] })
|
|
32
|
-
]),
|
|
33
|
-
leftImage: responsiveSprinkles({
|
|
34
|
-
paddingTop: ['x6', 'x6', 'none', 'none'],
|
|
35
|
-
marginRight: ['x6', 'x6', 'x6', 'x6']
|
|
36
|
-
}),
|
|
37
|
-
rightImage: responsiveSprinkles({
|
|
38
|
-
paddingTop: ['x6', 'x6', 'none', 'none'],
|
|
39
|
-
marginLeft: ['x6', 'x6', 'x6', 'x6']
|
|
40
|
-
}),
|
|
41
|
-
highlightBar: style([
|
|
42
|
-
{
|
|
43
|
-
width: '40px',
|
|
44
|
-
height: '5px',
|
|
45
|
-
backgroundColor: vars.color.light.neutral.foreground.low
|
|
46
|
-
},
|
|
47
|
-
neutralBorder({ variant: 'low', borderBottomWidth: 'thick' }),
|
|
48
|
-
responsiveSprinkles({ marginBottom: ['x4', 'x4', 'x4', 'x4'] })
|
|
49
|
-
]),
|
|
50
|
-
image: style([
|
|
51
|
-
{
|
|
52
|
-
height: '340px',
|
|
53
|
-
width: '415px'
|
|
54
|
-
}
|
|
55
|
-
])
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default styles;
|
package/src/Features/index.tsx
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React, { Children, cloneElement, ReactElement } from 'react';
|
|
2
|
-
import classnames from 'clsx';
|
|
3
|
-
|
|
4
|
-
import styles from './styles.css';
|
|
5
|
-
import { FeatureProps } from '../Feature';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The props type for [[`Features`]].
|
|
9
|
-
*/
|
|
10
|
-
export interface FeaturesProps {
|
|
11
|
-
/** Additional class name for root class override. */
|
|
12
|
-
className?: string;
|
|
13
|
-
/** The content of the Features. This should be multiple [[`Feature`]] components. */
|
|
14
|
-
children: ReactElement<FeatureProps>[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function layoutChildren(children) {
|
|
18
|
-
return Children.map(children, (child, index) =>
|
|
19
|
-
cloneElement(child, {
|
|
20
|
-
imagePlacement: index % 2 === 0 ? 'right' : 'left',
|
|
21
|
-
key: `feature-${index}`
|
|
22
|
-
})
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
Renders Features, a group for Feature components. Image placement starts on the right and is alternated for each subsequent Feature.
|
|
28
|
-
*/
|
|
29
|
-
export const Features: React.FC<FeaturesProps> = ({ children, className, ...rest }) => (
|
|
30
|
-
<div className={classnames(styles.root, className)} {...rest}>
|
|
31
|
-
{layoutChildren(children)}
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classnames from 'clsx';
|
|
3
|
-
|
|
4
|
-
import styles from './styles.css';
|
|
5
|
-
|
|
6
|
-
export const FilterToolbarContentArea: React.FC<
|
|
7
|
-
React.PropsWithChildren<React.HTMLProps<HTMLDivElement>>
|
|
8
|
-
> = ({ children, className, ...rest }) => (
|
|
9
|
-
<div className={classnames(styles.root, className)} {...rest}>
|
|
10
|
-
{children}
|
|
11
|
-
</div>
|
|
12
|
-
);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { responsiveSprinkles } from '@jpmorganchase/mosaic-theme';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
root: style([
|
|
6
|
-
{
|
|
7
|
-
display: 'flex',
|
|
8
|
-
flexGrow: 1,
|
|
9
|
-
justifyContent: 'flex-start'
|
|
10
|
-
},
|
|
11
|
-
responsiveSprinkles({
|
|
12
|
-
marginRight: ['x2', 'x2', 'x2', 'x2'],
|
|
13
|
-
columnGap: ['x2', 'x2', 'x2', 'x2']
|
|
14
|
-
})
|
|
15
|
-
])
|
|
16
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { fireEvent, render, waitFor } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { ToolbarProvider } from '../../ToolbarProvider';
|
|
5
|
-
import { FilterDropdown } from '../index';
|
|
6
|
-
|
|
7
|
-
test('renders a filter dropdown', async () => {
|
|
8
|
-
// arrange
|
|
9
|
-
const source = ['Filter 1', 'Filter 2', 'Filter 3'];
|
|
10
|
-
const { getAllByRole, getByText } = render(
|
|
11
|
-
<ToolbarProvider>
|
|
12
|
-
<FilterDropdown source={source} />
|
|
13
|
-
</ToolbarProvider>
|
|
14
|
-
);
|
|
15
|
-
// assert
|
|
16
|
-
expect(getAllByRole('option').length).toEqual(1);
|
|
17
|
-
// action
|
|
18
|
-
const dropdownButton = getByText('All');
|
|
19
|
-
fireEvent.click(dropdownButton);
|
|
20
|
-
// assert
|
|
21
|
-
await waitFor(() => expect(getAllByRole('option').length).toEqual(5));
|
|
22
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, useState } from 'react';
|
|
2
|
-
import classnames from 'clsx';
|
|
3
|
-
import { Dropdown, DropdownButton, DropdownProps, SelectionChangeHandler } from '@salt-ds/lab';
|
|
4
|
-
import { Icon } from '../../Icon';
|
|
5
|
-
import styles from './styles.css';
|
|
6
|
-
import { useToolbarDispatch, useToolbarState } from '../ToolbarProvider';
|
|
7
|
-
|
|
8
|
-
const defaultButtonLabel = (selectedItems: string[] | undefined) => {
|
|
9
|
-
if (!selectedItems || selectedItems.length === 0) {
|
|
10
|
-
return 'All';
|
|
11
|
-
}
|
|
12
|
-
if (selectedItems.length === 1) {
|
|
13
|
-
return `${selectedItems[0]}`;
|
|
14
|
-
}
|
|
15
|
-
return `${selectedItems.length} Items Selected`;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export interface FilterDropdownProps extends DropdownProps<string, 'multiple'> {
|
|
19
|
-
/** Callback to translate the selected list item to a Button label */
|
|
20
|
-
labelButton?: (selectedItems: string[] | undefined) => string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const CLEAR_ALL = 'Clear all';
|
|
24
|
-
|
|
25
|
-
export function FilterDropdown({
|
|
26
|
-
className,
|
|
27
|
-
itemToString,
|
|
28
|
-
labelButton,
|
|
29
|
-
source = [],
|
|
30
|
-
...rest
|
|
31
|
-
}: FilterDropdownProps) {
|
|
32
|
-
const dispatch = useToolbarDispatch();
|
|
33
|
-
const { filters = [] } = useToolbarState();
|
|
34
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
35
|
-
const listItems = useMemo(() => (source.length > 1 ? [...source, CLEAR_ALL] : source), [source]);
|
|
36
|
-
const handleSelect: SelectionChangeHandler<string, 'multiple'> = (_e, selectedItems) => {
|
|
37
|
-
const nextSelectedItems: string[] = selectedItems.includes(CLEAR_ALL) ? [] : selectedItems;
|
|
38
|
-
dispatch({ type: 'setFilters', value: nextSelectedItems });
|
|
39
|
-
};
|
|
40
|
-
return (
|
|
41
|
-
<Dropdown<string, 'multiple'>
|
|
42
|
-
aria-label={isOpen ? 'close filters menu' : 'open filters menu'}
|
|
43
|
-
className={classnames(className, styles.root)}
|
|
44
|
-
itemToString={itemToString}
|
|
45
|
-
onOpenChange={setIsOpen}
|
|
46
|
-
onSelectionChange={handleSelect}
|
|
47
|
-
selected={filters}
|
|
48
|
-
selectionStrategy="multiple"
|
|
49
|
-
source={listItems}
|
|
50
|
-
triggerComponent={
|
|
51
|
-
<span className={styles.triggerRoot}>
|
|
52
|
-
<Icon name="filter" />
|
|
53
|
-
<DropdownButton
|
|
54
|
-
label={labelButton ? labelButton(filters) : defaultButtonLabel(filters)}
|
|
55
|
-
/>
|
|
56
|
-
</span>
|
|
57
|
-
}
|
|
58
|
-
width={200}
|
|
59
|
-
{...rest}
|
|
60
|
-
/>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { style, globalStyle } from '@vanilla-extract/css';
|
|
2
|
-
|
|
3
|
-
const triggerRoot = style({ display: 'inline-flex', alignItems: 'center' });
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
root: style({
|
|
7
|
-
display: 'flex !important',
|
|
8
|
-
alignSelf: 'stretch',
|
|
9
|
-
alignItems: 'center'
|
|
10
|
-
}),
|
|
11
|
-
triggerRoot
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
globalStyle(`${triggerRoot} svg.saltIcon`, {
|
|
15
|
-
vars: { '--saltIcon-size-multiplier': '1.2!important' }
|
|
16
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { ToolbarProvider } from '../../ToolbarProvider';
|
|
5
|
-
import { FilterPillGroup } from '../index';
|
|
6
|
-
|
|
7
|
-
test('updates the toolbar sort state when a filter is removed', () => {
|
|
8
|
-
// arrange
|
|
9
|
-
const filters = ['Filter 1', 'Filter 2', 'Filter 3'];
|
|
10
|
-
const handleStateChangeMock = jest.fn();
|
|
11
|
-
render(
|
|
12
|
-
<ToolbarProvider initialState={{ filters }} onStateChange={handleStateChangeMock}>
|
|
13
|
-
<FilterPillGroup />
|
|
14
|
-
</ToolbarProvider>
|
|
15
|
-
);
|
|
16
|
-
// assert
|
|
17
|
-
const pills = screen.getAllByTestId('pill');
|
|
18
|
-
expect(pills.length).toEqual(3);
|
|
19
|
-
// action
|
|
20
|
-
fireEvent.click(pills[1]);
|
|
21
|
-
// assert
|
|
22
|
-
expect(handleStateChangeMock).toHaveBeenCalledWith({
|
|
23
|
-
filters: ['Filter 1', 'Filter 3'],
|
|
24
|
-
hasStateChanged: true
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Pill } from '@salt-ds/core';
|
|
3
|
-
import classnames from 'clsx';
|
|
4
|
-
|
|
5
|
-
import { useToolbarDispatch, useToolbarState } from '../ToolbarProvider';
|
|
6
|
-
import styles from './styles.css';
|
|
7
|
-
import { Icon } from '../../Icon';
|
|
8
|
-
|
|
9
|
-
export interface FilterPillGroupProps {
|
|
10
|
-
/** Additional class name for root class override */
|
|
11
|
-
className?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const FilterPillGroup: React.FC<React.PropsWithChildren<FilterPillGroupProps>> = ({
|
|
15
|
-
className
|
|
16
|
-
}) => {
|
|
17
|
-
const { filters = [] } = useToolbarState();
|
|
18
|
-
const dispatch = useToolbarDispatch();
|
|
19
|
-
const handleDeletePill = (itemIndex: number) => {
|
|
20
|
-
dispatch({ type: 'removeFilter', value: filters[itemIndex] });
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<div className={classnames(styles.root, className)}>
|
|
25
|
-
{filters.map((item: string, itemIndex: number) => (
|
|
26
|
-
<Pill
|
|
27
|
-
data-mosaic-testid="pill"
|
|
28
|
-
key={`pill-${item}`}
|
|
29
|
-
onClick={() => handleDeletePill(itemIndex)}
|
|
30
|
-
>
|
|
31
|
-
{item} <Icon name="close" />
|
|
32
|
-
</Pill>
|
|
33
|
-
))}
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { responsiveSprinkles } from '@jpmorganchase/mosaic-theme';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
root: style([
|
|
6
|
-
{
|
|
7
|
-
alignItems: 'center',
|
|
8
|
-
display: 'flex',
|
|
9
|
-
flexWrap: 'nowrap',
|
|
10
|
-
justifyContent: 'flex-end'
|
|
11
|
-
},
|
|
12
|
-
responsiveSprinkles({
|
|
13
|
-
columnGap: ['x2', 'x2', 'x2', 'x2'],
|
|
14
|
-
paddingY: ['x4', 'x4', 'x4', 'x4']
|
|
15
|
-
})
|
|
16
|
-
])
|
|
17
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import userEvents from '@testing-library/user-event';
|
|
4
|
-
|
|
5
|
-
import { ToolbarProvider } from '../../ToolbarProvider';
|
|
6
|
-
import { FilterSearch } from '../index';
|
|
7
|
-
|
|
8
|
-
test('updates the toolbar filters state when Filter 2 is selected', async () => {
|
|
9
|
-
const source = ['Filter 1', 'Filter 2', 'Filter 3'];
|
|
10
|
-
const handleStateChangeMock = jest.fn();
|
|
11
|
-
// arrange
|
|
12
|
-
const { getByTestId } = render(
|
|
13
|
-
<ToolbarProvider onStateChange={handleStateChangeMock}>
|
|
14
|
-
<FilterSearch
|
|
15
|
-
InputProps={{ inputProps: { 'data-mosaic-testid': 'test-input' } }}
|
|
16
|
-
source={source}
|
|
17
|
-
/>
|
|
18
|
-
</ToolbarProvider>
|
|
19
|
-
);
|
|
20
|
-
// action
|
|
21
|
-
const searchInput = getByTestId('test-input');
|
|
22
|
-
await userEvents.type(searchInput, 'Filter'); // lower case to test filter
|
|
23
|
-
// assert
|
|
24
|
-
expect(screen.getAllByRole('option').length).toEqual(3);
|
|
25
|
-
|
|
26
|
-
// action
|
|
27
|
-
await userEvents.click(screen.getByRole('option', { name: 'Filter 2' }));
|
|
28
|
-
|
|
29
|
-
// assert
|
|
30
|
-
expect(handleStateChangeMock).toHaveBeenLastCalledWith({
|
|
31
|
-
filters: ['Filter 2'],
|
|
32
|
-
hasStateChanged: true
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classnames from 'clsx';
|
|
3
|
-
import { escapeRegExp, ComboBox, ComboBoxProps, SelectionChangeHandler } from '@salt-ds/lab';
|
|
4
|
-
import { Icon } from '../../Icon';
|
|
5
|
-
|
|
6
|
-
import { useToolbarDispatch } from '../ToolbarProvider';
|
|
7
|
-
import styles from '../SortDropdown/styles.css';
|
|
8
|
-
|
|
9
|
-
export interface FilterSearchProps extends ComboBoxProps<string, 'deselectable'> {}
|
|
10
|
-
|
|
11
|
-
export function FilterSearch({ className, source = [], ...rest }: FilterSearchProps) {
|
|
12
|
-
const dispatch = useToolbarDispatch();
|
|
13
|
-
|
|
14
|
-
// TODO convert to multiselect once Salt supports Multiselect from a ComboBox
|
|
15
|
-
const handleSelect: SelectionChangeHandler<string, 'deselectable'> = (_e, item) => {
|
|
16
|
-
const value = item === null ? [] : [item];
|
|
17
|
-
dispatch({ type: 'setFilters', value });
|
|
18
|
-
};
|
|
19
|
-
const getFilterRegex: (text: string) => RegExp = value =>
|
|
20
|
-
new RegExp(`\\b(${escapeRegExp(value)})`, 'gi');
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<ComboBox
|
|
24
|
-
InputProps={{ startAdornment: <Icon name="filter" /> }}
|
|
25
|
-
className={classnames(className, styles.root)}
|
|
26
|
-
getFilterRegex={getFilterRegex}
|
|
27
|
-
onSelectionChange={handleSelect}
|
|
28
|
-
source={source}
|
|
29
|
-
width={200}
|
|
30
|
-
{...rest}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
}
|