@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.
Files changed (192) hide show
  1. package/package.json +8 -5
  2. package/.turbo/turbo-build.log +0 -4
  3. package/CHANGELOG.md +0 -686
  4. package/src/Accordion/__tests__/index.test.tsx +0 -82
  5. package/src/Accordion/index.tsx +0 -88
  6. package/src/Accordion/styles.css.ts +0 -16
  7. package/src/AudioPlayer/__tests__/index.test.tsx +0 -19
  8. package/src/AudioPlayer/index.tsx +0 -163
  9. package/src/AudioPlayer/styles.css.ts +0 -65
  10. package/src/BrowserOnly.tsx +0 -17
  11. package/src/Button.tsx +0 -25
  12. package/src/Callout/__tests__/index.test.tsx +0 -102
  13. package/src/Callout/index.tsx +0 -62
  14. package/src/Callout/styles.css.ts +0 -77
  15. package/src/Card/index.tsx +0 -35
  16. package/src/Card/styles.css.ts +0 -23
  17. package/src/Cards.tsx +0 -25
  18. package/src/ComponentExample/index.tsx +0 -23
  19. package/src/ComponentExample/styles.css.ts +0 -25
  20. package/src/DataTable.tsx +0 -114
  21. package/src/EditionFilterView/__tests__/index.test.tsx +0 -49
  22. package/src/EditionFilterView/index.tsx +0 -108
  23. package/src/EditionFilterView/styles.css.ts +0 -8
  24. package/src/EditionTileLink/index.tsx +0 -90
  25. package/src/EditionTileLink/styles.css.ts +0 -95
  26. package/src/Feature/Feature.tsx +0 -92
  27. package/src/Feature/FeatureActions/index.tsx +0 -34
  28. package/src/Feature/FeatureActions/styles.css.ts +0 -15
  29. package/src/Feature/FeatureContent/index.tsx +0 -30
  30. package/src/Feature/FeatureContent/styles.css.ts +0 -13
  31. package/src/Feature/FeatureEyebrow/index.tsx +0 -19
  32. package/src/Feature/FeatureEyebrow/styles.css.ts +0 -11
  33. package/src/Feature/FeatureTitle/index.tsx +0 -18
  34. package/src/Feature/FeatureTitle/styles.css.ts +0 -9
  35. package/src/Feature/index.tsx +0 -10
  36. package/src/Feature/styles.css.ts +0 -58
  37. package/src/Features/index.tsx +0 -33
  38. package/src/Features/styles.css.ts +0 -10
  39. package/src/FilterToolbar/ContentArea/index.tsx +0 -12
  40. package/src/FilterToolbar/ContentArea/styles.css.ts +0 -16
  41. package/src/FilterToolbar/FilterDropdown/__tests__/index.test.tsx +0 -22
  42. package/src/FilterToolbar/FilterDropdown/index.tsx +0 -62
  43. package/src/FilterToolbar/FilterDropdown/styles.css.ts +0 -16
  44. package/src/FilterToolbar/PillGroup/__tests__/index.test.tsx +0 -26
  45. package/src/FilterToolbar/PillGroup/index.tsx +0 -36
  46. package/src/FilterToolbar/PillGroup/styles.css.ts +0 -17
  47. package/src/FilterToolbar/Search/__tests__/index.test.tsx +0 -34
  48. package/src/FilterToolbar/Search/index.tsx +0 -33
  49. package/src/FilterToolbar/Search/styles.css.ts +0 -9
  50. package/src/FilterToolbar/SortDropdown/__tests__/index.test.tsx +0 -22
  51. package/src/FilterToolbar/SortDropdown/defaultSort.js +0 -8
  52. package/src/FilterToolbar/SortDropdown/index.tsx +0 -53
  53. package/src/FilterToolbar/SortDropdown/styles.css.ts +0 -15
  54. package/src/FilterToolbar/Toolbar.tsx +0 -38
  55. package/src/FilterToolbar/ToolbarProvider.tsx +0 -94
  56. package/src/FilterToolbar/__tests__/Toolbar.test.tsx +0 -127
  57. package/src/FilterToolbar/__tests__/ToolbarProvider.test.tsx +0 -85
  58. package/src/FilterToolbar/index.tsx +0 -9
  59. package/src/FilterToolbar/styles.css.ts +0 -19
  60. package/src/FilterView/ContentArea/index.tsx +0 -24
  61. package/src/FilterView/ContentArea/styles.css.ts +0 -16
  62. package/src/FilterView/FilterView.tsx +0 -205
  63. package/src/FilterView/FilterViewProvider.tsx +0 -23
  64. package/src/FilterView/NoResults/index.tsx +0 -19
  65. package/src/FilterView/NoResults/styles.css.ts +0 -13
  66. package/src/FilterView/Pagination/index.tsx +0 -40
  67. package/src/FilterView/Pagination/styles.css.ts +0 -40
  68. package/src/FilterView/Pagination/usePagination.ts +0 -31
  69. package/src/FilterView/ResultCount/index.tsx +0 -23
  70. package/src/FilterView/ResultCount/styles.css.ts +0 -11
  71. package/src/FilterView/__tests__/index.test.tsx +0 -109
  72. package/src/FilterView/index.tsx +0 -5
  73. package/src/FilterView/useResultCount.tsx +0 -8
  74. package/src/FormattedContent.tsx +0 -75
  75. package/src/Grid/index.tsx +0 -29
  76. package/src/Grid/styles.css.ts +0 -13
  77. package/src/GridBase/index.tsx +0 -60
  78. package/src/GridBase/styles.css.ts +0 -19
  79. package/src/HelpLinks/index.tsx +0 -80
  80. package/src/HelpLinks/styles.css.ts +0 -32
  81. package/src/Hero/__tests__/index.test.tsx +0 -19
  82. package/src/Hero/index.tsx +0 -172
  83. package/src/Hero/styles.css.ts +0 -111
  84. package/src/Icon/index.tsx +0 -50
  85. package/src/ImageProvider.ts +0 -9
  86. package/src/Impact/index.tsx +0 -36
  87. package/src/Impact/styles.css.ts +0 -72
  88. package/src/Impacts.tsx +0 -25
  89. package/src/IsomorphicSuspense.tsx +0 -9
  90. package/src/Label/__tests__/index.test.tsx +0 -27
  91. package/src/Label/index.tsx +0 -42
  92. package/src/Label/styles.css.ts +0 -14
  93. package/src/Link/index.tsx +0 -83
  94. package/src/Link/styles.css.ts +0 -15
  95. package/src/LinkBase/index.tsx +0 -32
  96. package/src/LinkButton.css.ts +0 -19
  97. package/src/LinkButton.tsx +0 -22
  98. package/src/LinkProvider.ts +0 -9
  99. package/src/LinkText/index.tsx +0 -121
  100. package/src/LinkText/styles.css.ts +0 -30
  101. package/src/Links/index.tsx +0 -18
  102. package/src/Links/styles.css.ts +0 -13
  103. package/src/List/ListItem.tsx +0 -31
  104. package/src/List/OrderedList.tsx +0 -22
  105. package/src/List/UnorderedList.tsx +0 -35
  106. package/src/List/index.tsx +0 -3
  107. package/src/Markdown/AnchorHeading/__tests__/index.test.tsx +0 -56
  108. package/src/Markdown/AnchorHeading/index.css.ts +0 -64
  109. package/src/Markdown/AnchorHeading/index.tsx +0 -97
  110. package/src/Markdown/BlockQuote/index.css.ts +0 -6
  111. package/src/Markdown/BlockQuote/index.tsx +0 -21
  112. package/src/Markdown/Heading.tsx +0 -39
  113. package/src/Markdown/InlineCode.tsx +0 -10
  114. package/src/Markdown/Link.tsx +0 -11
  115. package/src/Markdown/Pre/index.css.ts +0 -35
  116. package/src/Markdown/Pre/index.tsx +0 -155
  117. package/src/Markdown/Table.tsx +0 -11
  118. package/src/Markdown/Tbody.tsx +0 -9
  119. package/src/Markdown/Td.tsx +0 -9
  120. package/src/Markdown/Th.tsx +0 -9
  121. package/src/Markdown/Thead.tsx +0 -9
  122. package/src/Markdown/ThematicBreak/index.css.ts +0 -5
  123. package/src/Markdown/ThematicBreak/index.tsx +0 -10
  124. package/src/Markdown/Tr.tsx +0 -9
  125. package/src/Markdown/__tests__/Heading.test.tsx +0 -56
  126. package/src/Markdown/index.tsx +0 -210
  127. package/src/Markdown/markdownElements.tsx +0 -52
  128. package/src/Markdown/withMarkdownSpacing/index.tsx +0 -33
  129. package/src/Markdown/withMarkdownSpacing/styles.css.ts +0 -7
  130. package/src/PageFilterView/index.tsx +0 -86
  131. package/src/PageFilterView/styles.css.ts +0 -8
  132. package/src/ReactLive/index.tsx +0 -71
  133. package/src/ReactLive/styles.css.ts +0 -28
  134. package/src/SecondaryNavbar/index.tsx +0 -55
  135. package/src/SecondaryNavbar/styles.css.ts +0 -27
  136. package/src/SectionHeading/__tests__/index.test.tsx +0 -20
  137. package/src/SectionHeading/index.tsx +0 -33
  138. package/src/SectionHeading/styles.css.ts +0 -15
  139. package/src/StickyHeader/index.tsx +0 -52
  140. package/src/StickyHeader/styles.css.ts +0 -17
  141. package/src/Story/index.tsx +0 -70
  142. package/src/Story/styles.css.ts +0 -37
  143. package/src/Tabs/index.tsx +0 -65
  144. package/src/Tabs/styles.css.ts +0 -7
  145. package/src/TabsBase/TabsBase.tsx +0 -89
  146. package/src/TabsBase/TabsButton.tsx +0 -30
  147. package/src/TabsBase/TabsLink.tsx +0 -30
  148. package/src/TabsBase/TabsMenuButton.tsx +0 -41
  149. package/src/TabsBase/index.ts +0 -4
  150. package/src/TabsBase/styles.css.ts +0 -64
  151. package/src/TabsBase/tabsMenuButton.css.ts +0 -25
  152. package/src/Tag/__tests__/index.test.tsx +0 -58
  153. package/src/Tag/index.tsx +0 -62
  154. package/src/Tag/styles.css.ts +0 -48
  155. package/src/ThemeProvider.tsx +0 -37
  156. package/src/TileBase/TileBase.tsx +0 -159
  157. package/src/TileBase/TileStateProvider.tsx +0 -52
  158. package/src/TileBase/index.ts +0 -2
  159. package/src/TileBase/styles.css.ts +0 -15
  160. package/src/TileButton/index.tsx +0 -68
  161. package/src/TileContent/index.tsx +0 -155
  162. package/src/TileContent/styles.css.ts +0 -229
  163. package/src/TileContentLabel/index.tsx +0 -74
  164. package/src/TileContentLabel/styles.css.ts +0 -22
  165. package/src/TileLink/index.tsx +0 -83
  166. package/src/TileLink/styles.css.ts +0 -9
  167. package/src/Tiles.tsx +0 -17
  168. package/src/Typography/Typography.tsx +0 -22
  169. package/src/Typography/index.tsx +0 -54
  170. package/src/Typography/withStyledTypography.tsx +0 -25
  171. package/src/VideoPlayer/__tests__/index.test.tsx +0 -13
  172. package/src/VideoPlayer/index.tsx +0 -179
  173. package/src/VideoPlayer/styles.css.ts +0 -87
  174. package/src/ViewStack/View.tsx +0 -19
  175. package/src/ViewStack/ViewStack.tsx +0 -50
  176. package/src/ViewStack/__tests__/index.test.tsx +0 -86
  177. package/src/ViewStack/index.tsx +0 -2
  178. package/src/__tests__/Button.test.tsx +0 -13
  179. package/src/__tests__/LinkButton.test.tsx +0 -16
  180. package/src/__tests__/ReactLive.test.tsx +0 -21
  181. package/src/canUseDOM.ts +0 -5
  182. package/src/common/types/index.ts +0 -52
  183. package/src/index.tsx +0 -59
  184. package/src/styles.ts +0 -45
  185. package/src/useBreakpoint.ts +0 -28
  186. package/src/useLockBodyScroll.ts +0 -16
  187. package/src/useOutsideClick.ts +0 -25
  188. package/src/useSize.ts +0 -32
  189. package/src/useSpacing.ts +0 -17
  190. package/src/utils/hasProtocol.ts +0 -1
  191. package/src/utils/index.ts +0 -1
  192. package/tsconfig.json +0 -8
@@ -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;
@@ -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
- });
@@ -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
- };
@@ -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
- };
@@ -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
- };
@@ -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;
@@ -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
- };
@@ -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
- );