uikit-react-public 0.21.8 → 0.21.9
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/dist/components/Heading/Heading.d.ts +6 -4
- package/dist/components/Heading/Heading.stories.d.ts +8 -6
- package/dist/components/Paragraph/Paragraph.d.ts +5 -2
- package/dist/components/Paragraph/Paragraph.stories.d.ts +6 -3
- package/dist/components/index.d.ts +4 -4
- package/dist/index.js +3852 -3952
- package/lib/components/Heading/Heading.stories.tsx +34 -41
- package/lib/components/Heading/Heading.tsx +180 -49
- package/lib/components/Heading/__tests__/__snapshots__/Heading.test.tsx.snap +4 -4
- package/lib/components/Paragraph/Paragraph.stories.tsx +29 -27
- package/lib/components/Paragraph/Paragraph.tsx +212 -81
- package/lib/components/Paragraph/__tests__/__snapshots__/Paragraph.test.tsx.snap +5 -5
- package/lib/components/index.ts +4 -4
- package/package.json +1 -1
- package/dist/components/HeadingNew/Heading.d.ts +0 -13
- package/dist/components/HeadingNew/index.d.ts +0 -2
- package/dist/components/ParagraphNew/Paragraph.d.ts +0 -13
- package/dist/components/ParagraphNew/index.d.ts +0 -4
- package/lib/components/HeadingNew/Heading.tsx +0 -208
- package/lib/components/HeadingNew/index.ts +0 -2
- package/lib/components/ParagraphNew/Paragraph.tsx +0 -200
- package/lib/components/ParagraphNew/index.ts +0 -6
|
@@ -1,95 +1,226 @@
|
|
|
1
|
-
import { memo, HTMLAttributes,
|
|
1
|
+
import { memo, HTMLAttributes, JSX } from 'react';
|
|
2
2
|
import { css, cx } from '@emotion/css';
|
|
3
3
|
import useTheme from '../../theme/useTheme';
|
|
4
4
|
import marginsStyle, { MarginProps } from '../common/marginsStyle';
|
|
5
5
|
|
|
6
6
|
export const NAME = 'ucl-uikit-paragrah';
|
|
7
7
|
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export type ParagraphLevel =
|
|
9
|
+
| 'lg'
|
|
10
|
+
| 'lg-medium'
|
|
11
|
+
| 'lg-semibold'
|
|
12
|
+
| 'lg-bold'
|
|
13
|
+
| 'md'
|
|
14
|
+
| 'md-medium'
|
|
15
|
+
| 'md-semibold'
|
|
16
|
+
| 'md-semibold'
|
|
17
|
+
| 'md-medium-numeric'
|
|
18
|
+
| 'sm'
|
|
19
|
+
| 'sm-medium'
|
|
20
|
+
| 'sm-semibold'
|
|
21
|
+
| 'xs'
|
|
22
|
+
| 'xs-medium';
|
|
23
|
+
|
|
24
|
+
export interface ParagraphBaseProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
25
|
+
level?: ParagraphLevel;
|
|
26
|
+
size?: 'standfirst' | 'body' | 'small'; // deprecated
|
|
27
|
+
emphasis?: 'high' | 'medium'; // deprecated
|
|
28
|
+
as?: 'p' | 'div' | 'span';
|
|
29
|
+
margins?: boolean; // deprecated
|
|
13
30
|
testId?: string;
|
|
31
|
+
ref?: React.Ref<HTMLParagraphElement>;
|
|
14
32
|
}
|
|
15
33
|
|
|
16
34
|
export type ParagraphProps = ParagraphBaseProps & MarginProps;
|
|
17
35
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
const Paragraph = ({
|
|
37
|
+
level = 'md',
|
|
38
|
+
size = 'body',
|
|
39
|
+
emphasis = 'high',
|
|
40
|
+
as = 'p',
|
|
41
|
+
margins = true,
|
|
42
|
+
testId = NAME,
|
|
43
|
+
className,
|
|
44
|
+
ref,
|
|
45
|
+
noMargins,
|
|
46
|
+
...props
|
|
47
|
+
}: ParagraphProps) => {
|
|
48
|
+
const [theme] = useTheme();
|
|
49
|
+
|
|
50
|
+
const {
|
|
51
|
+
typography: {
|
|
52
|
+
body: {
|
|
53
|
+
lg,
|
|
54
|
+
lgMedium,
|
|
55
|
+
lgSemibold,
|
|
56
|
+
lgBold,
|
|
57
|
+
md,
|
|
58
|
+
mdMedium,
|
|
59
|
+
mdSemibold,
|
|
60
|
+
mdMediumNumeric,
|
|
61
|
+
sm,
|
|
62
|
+
smMedium,
|
|
63
|
+
smSemibold,
|
|
64
|
+
xs,
|
|
65
|
+
xsMedium,
|
|
66
|
+
},
|
|
29
67
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
68
|
+
} = theme;
|
|
69
|
+
|
|
70
|
+
const mappedLevel: ParagraphLevel =
|
|
71
|
+
level ||
|
|
72
|
+
(size === 'standfirst'
|
|
73
|
+
? emphasis === 'medium'
|
|
74
|
+
? 'lg-medium'
|
|
75
|
+
: 'lg'
|
|
76
|
+
: size === 'small'
|
|
77
|
+
? emphasis === 'medium'
|
|
78
|
+
? 'sm-medium'
|
|
79
|
+
: 'sm'
|
|
80
|
+
: emphasis === 'medium'
|
|
81
|
+
? 'md-medium'
|
|
82
|
+
: 'md');
|
|
83
|
+
|
|
84
|
+
const baseStyle = css`
|
|
85
|
+
font-family: ${md.fontFamily};
|
|
86
|
+
font-feature-settings: ${md.fontSettings};
|
|
87
|
+
color: ${emphasis === 'medium'
|
|
88
|
+
? theme.colour.text.secondary
|
|
89
|
+
: theme.colour.text.default};
|
|
90
|
+
margin: 0;
|
|
91
|
+
`;
|
|
92
|
+
|
|
93
|
+
const lgStyle = css`
|
|
94
|
+
font-size: ${lg.fontSize}px;
|
|
95
|
+
font-weight: ${lg.fontWeight};
|
|
96
|
+
line-height: ${lg.lineHeight}%;
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
const lgMediumStyle = css`
|
|
100
|
+
font-size: ${lgMedium.fontSize}px;
|
|
101
|
+
font-weight: ${lgMedium.fontWeight};
|
|
102
|
+
line-height: ${lgMedium.lineHeight}%;
|
|
103
|
+
`;
|
|
104
|
+
|
|
105
|
+
const lgSemiboldStyle = css`
|
|
106
|
+
font-size: ${lgSemibold.fontSize}px;
|
|
107
|
+
font-weight: ${lgSemibold.fontWeight};
|
|
108
|
+
line-height: ${lgSemibold.lineHeight}%;
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
const lgBoldStyle = css`
|
|
112
|
+
font-size: ${lgBold.fontSize}px;
|
|
113
|
+
font-weight: ${lgBold.fontWeight};
|
|
114
|
+
line-height: ${lgBold.lineHeight}%;
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
const mdStyle = css`
|
|
118
|
+
font-size: ${md.fontSize}px;
|
|
119
|
+
font-weight: ${md.fontWeight};
|
|
120
|
+
line-height: ${md.lineHeight}%;
|
|
121
|
+
`;
|
|
122
|
+
|
|
123
|
+
const mdMediumStyle = css`
|
|
124
|
+
font-size: ${mdMedium.fontSize}px;
|
|
125
|
+
font-weight: ${mdMedium.fontWeight};
|
|
126
|
+
line-height: ${mdMedium.lineHeight}%;
|
|
127
|
+
`;
|
|
128
|
+
|
|
129
|
+
const mdSemiboldStyle = css`
|
|
130
|
+
font-size: ${mdSemibold.fontSize}px;
|
|
131
|
+
font-weight: ${mdSemibold.fontWeight};
|
|
132
|
+
line-height: ${mdSemibold.lineHeight}%;
|
|
133
|
+
`;
|
|
134
|
+
|
|
135
|
+
const mdMediumNumericStyle = css`
|
|
136
|
+
font-size: ${mdMediumNumeric.fontSize}px;
|
|
137
|
+
font-weight: ${mdMediumNumeric.fontWeight};
|
|
138
|
+
line-height: ${mdMediumNumeric.lineHeight}%;
|
|
139
|
+
`;
|
|
140
|
+
|
|
141
|
+
const smStyle = css`
|
|
142
|
+
font-size: ${sm.fontSize}px;
|
|
143
|
+
font-weight: ${sm.fontWeight};
|
|
144
|
+
line-height: ${sm.lineHeight}%;
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
const smMediumStyle = css`
|
|
148
|
+
font-size: ${smMedium.fontSize}px;
|
|
149
|
+
font-weight: ${smMedium.fontWeight};
|
|
150
|
+
line-height: ${smMedium.lineHeight}%;
|
|
151
|
+
`;
|
|
152
|
+
|
|
153
|
+
const smSemiboldStyle = css`
|
|
154
|
+
font-size: ${smSemibold.fontSize}px;
|
|
155
|
+
font-weight: ${smSemibold.fontWeight};
|
|
156
|
+
line-height: ${smSemibold.lineHeight}%;
|
|
157
|
+
`;
|
|
158
|
+
|
|
159
|
+
const xsStyle = css`
|
|
160
|
+
font-size: ${xs.fontSize}px;
|
|
161
|
+
font-weight: ${xs.fontWeight};
|
|
162
|
+
line-height: ${xs.lineHeight}%;
|
|
163
|
+
`;
|
|
164
|
+
|
|
165
|
+
const xsMediumStyle = css`
|
|
166
|
+
font-size: ${xsMedium.fontSize}px;
|
|
167
|
+
font-weight: ${xsMedium.fontWeight};
|
|
168
|
+
line-height: ${xsMedium.lineHeight}%;
|
|
169
|
+
`;
|
|
170
|
+
|
|
171
|
+
const style = cx(
|
|
172
|
+
NAME,
|
|
173
|
+
baseStyle,
|
|
174
|
+
mappedLevel === 'lg' && lgStyle,
|
|
175
|
+
mappedLevel === 'lg-medium' && lgMediumStyle,
|
|
176
|
+
mappedLevel === 'lg-semibold' && lgSemiboldStyle,
|
|
177
|
+
mappedLevel === 'lg-bold' && lgBoldStyle,
|
|
178
|
+
mappedLevel === 'md' && mdStyle,
|
|
179
|
+
mappedLevel === 'md-medium' && mdMediumStyle,
|
|
180
|
+
mappedLevel === 'md-semibold' && mdSemiboldStyle,
|
|
181
|
+
mappedLevel === 'md-medium-numeric' && mdMediumNumericStyle,
|
|
182
|
+
mappedLevel === 'sm' && smStyle,
|
|
183
|
+
mappedLevel === 'sm-medium' && smMediumStyle,
|
|
184
|
+
mappedLevel === 'sm-semibold' && smSemiboldStyle,
|
|
185
|
+
mappedLevel === 'xs' && xsStyle,
|
|
186
|
+
mappedLevel === 'xs-medium' && xsMediumStyle,
|
|
187
|
+
marginsStyle(
|
|
188
|
+
{ ...props, noMargins: noMargins || margins === false },
|
|
189
|
+
theme
|
|
190
|
+
),
|
|
191
|
+
className
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const paragraphTag = as as keyof JSX.IntrinsicElements;
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
<>
|
|
198
|
+
{paragraphTag === 'p' && (
|
|
199
|
+
<p
|
|
200
|
+
ref={ref}
|
|
201
|
+
className={style}
|
|
202
|
+
data-testid={testId}
|
|
203
|
+
{...props}
|
|
204
|
+
/>
|
|
205
|
+
)}
|
|
206
|
+
{paragraphTag === 'div' && (
|
|
207
|
+
<div
|
|
208
|
+
ref={ref as React.Ref<HTMLDivElement>}
|
|
209
|
+
className={style}
|
|
210
|
+
data-testid={testId}
|
|
211
|
+
{...props}
|
|
212
|
+
/>
|
|
213
|
+
)}
|
|
214
|
+
{paragraphTag === 'span' && (
|
|
215
|
+
<span
|
|
216
|
+
ref={ref as React.Ref<HTMLSpanElement>}
|
|
217
|
+
className={style}
|
|
218
|
+
data-testid={testId}
|
|
219
|
+
{...props}
|
|
220
|
+
/>
|
|
221
|
+
)}
|
|
222
|
+
</>
|
|
223
|
+
);
|
|
224
|
+
};
|
|
94
225
|
|
|
95
226
|
export default memo(Paragraph);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Paragraph > snapshot: custom test id 1`] = `
|
|
4
4
|
<p
|
|
5
|
-
class="ucl-uikit-paragrah css-
|
|
5
|
+
class="ucl-uikit-paragrah css-h12wmf"
|
|
6
6
|
data-testid="custom-test-id"
|
|
7
7
|
>
|
|
8
8
|
This is a test
|
|
@@ -11,7 +11,7 @@ exports[`Paragraph > snapshot: custom test id 1`] = `
|
|
|
11
11
|
|
|
12
12
|
exports[`Paragraph > snapshot: emphasis 1`] = `
|
|
13
13
|
<p
|
|
14
|
-
class="ucl-uikit-paragrah css-
|
|
14
|
+
class="ucl-uikit-paragrah css-h12wmf"
|
|
15
15
|
data-testid="ucl-uikit-paragrah"
|
|
16
16
|
>
|
|
17
17
|
high emphasis
|
|
@@ -20,7 +20,7 @@ exports[`Paragraph > snapshot: emphasis 1`] = `
|
|
|
20
20
|
|
|
21
21
|
exports[`Paragraph > snapshot: minimal props 1`] = `
|
|
22
22
|
<p
|
|
23
|
-
class="ucl-uikit-paragrah css-
|
|
23
|
+
class="ucl-uikit-paragrah css-h12wmf"
|
|
24
24
|
data-testid="ucl-uikit-paragrah"
|
|
25
25
|
>
|
|
26
26
|
This is a test
|
|
@@ -29,7 +29,7 @@ exports[`Paragraph > snapshot: minimal props 1`] = `
|
|
|
29
29
|
|
|
30
30
|
exports[`Paragraph > snapshot: no margins 1`] = `
|
|
31
31
|
<p
|
|
32
|
-
class="ucl-uikit-paragrah css-
|
|
32
|
+
class="ucl-uikit-paragrah css-1dosm7d"
|
|
33
33
|
data-testid="ucl-uikit-paragrah"
|
|
34
34
|
>
|
|
35
35
|
no margins
|
|
@@ -38,7 +38,7 @@ exports[`Paragraph > snapshot: no margins 1`] = `
|
|
|
38
38
|
|
|
39
39
|
exports[`Paragraph > snapshot: size 1`] = `
|
|
40
40
|
<p
|
|
41
|
-
class="ucl-uikit-paragrah css-
|
|
41
|
+
class="ucl-uikit-paragrah css-h12wmf"
|
|
42
42
|
data-testid="ucl-uikit-paragrah"
|
|
43
43
|
>
|
|
44
44
|
standfirst
|
package/lib/components/index.ts
CHANGED
|
@@ -40,14 +40,14 @@ export type { TextareaProps } from './Textarea';
|
|
|
40
40
|
export { default as Heading } from './Heading';
|
|
41
41
|
export type { HeadingProps } from './Heading';
|
|
42
42
|
|
|
43
|
-
export { default as HeadingNew } from './
|
|
44
|
-
export type { HeadingProps as HeadingNewProps } from './
|
|
43
|
+
export { default as HeadingNew } from './Heading';
|
|
44
|
+
export type { HeadingProps as HeadingNewProps } from './Heading';
|
|
45
45
|
|
|
46
46
|
export { default as Paragraph } from './Paragraph';
|
|
47
47
|
export type { ParagraphProps } from './Paragraph';
|
|
48
48
|
|
|
49
|
-
export { default as ParagraphNew } from './
|
|
50
|
-
export type { ParagraphProps as ParagraphNewProps } from './
|
|
49
|
+
export { default as ParagraphNew } from './Paragraph';
|
|
50
|
+
export type { ParagraphProps as ParagraphNewProps } from './Paragraph';
|
|
51
51
|
|
|
52
52
|
// TODO: Remove aliased export in future breaking release
|
|
53
53
|
// <Paragraph> will be used in place of <Text> in the future
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
2
|
-
import { MarginProps } from '../common/marginsStyle';
|
|
3
|
-
export declare const NAME = "ucl-uikit-heading";
|
|
4
|
-
export type HeadingLevel = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
5
|
-
export interface HeadingBaseProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
6
|
-
level?: HeadingLevel;
|
|
7
|
-
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div' | 'span';
|
|
8
|
-
testId?: string;
|
|
9
|
-
ref?: React.Ref<HTMLHeadingElement>;
|
|
10
|
-
}
|
|
11
|
-
export type HeadingProps = HeadingBaseProps & MarginProps;
|
|
12
|
-
declare const Heading: import('react').MemoExoticComponent<({ level, as, testId, className, ref, ...props }: HeadingProps) => import("react/jsx-runtime").JSX.Element>;
|
|
13
|
-
export default Heading;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
2
|
-
import { MarginProps } from '../common/marginsStyle';
|
|
3
|
-
export declare const NAME = "ucl-uikit-paragrah";
|
|
4
|
-
export type ParagraphLevel = 'lg' | 'lg-medium' | 'lg-semibold' | 'lg-bold' | 'md' | 'md-medium' | 'md-semibold' | 'md-semibold' | 'md-medium-numeric' | 'sm' | 'sm-medium' | 'sm-semibold' | 'xs' | 'xs-medium';
|
|
5
|
-
export interface ParagraphBaseProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
6
|
-
level?: ParagraphLevel;
|
|
7
|
-
as?: 'p' | 'div' | 'span';
|
|
8
|
-
testId?: string;
|
|
9
|
-
ref?: React.Ref<HTMLParagraphElement>;
|
|
10
|
-
}
|
|
11
|
-
export type ParagraphProps = ParagraphBaseProps & MarginProps;
|
|
12
|
-
declare const _default: import('react').MemoExoticComponent<({ level, as, testId, className, ref, ...props }: ParagraphProps) => import("react/jsx-runtime").JSX.Element>;
|
|
13
|
-
export default _default;
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { memo, HTMLAttributes, JSX } from 'react';
|
|
2
|
-
import { css, cx } from '@emotion/css';
|
|
3
|
-
import useTheme from '../../theme/useTheme';
|
|
4
|
-
import marginsStyle, { MarginProps } from '../common/marginsStyle';
|
|
5
|
-
|
|
6
|
-
export const NAME = 'ucl-uikit-heading';
|
|
7
|
-
|
|
8
|
-
export type HeadingLevel = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
9
|
-
|
|
10
|
-
export interface HeadingBaseProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
11
|
-
level?: HeadingLevel;
|
|
12
|
-
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div' | 'span';
|
|
13
|
-
testId?: string;
|
|
14
|
-
ref?: React.Ref<HTMLHeadingElement>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type HeadingProps = HeadingBaseProps & MarginProps;
|
|
18
|
-
|
|
19
|
-
const Heading = memo(
|
|
20
|
-
({
|
|
21
|
-
level = 'md',
|
|
22
|
-
as,
|
|
23
|
-
testId = NAME,
|
|
24
|
-
className,
|
|
25
|
-
ref,
|
|
26
|
-
...props
|
|
27
|
-
}: HeadingProps) => {
|
|
28
|
-
const [theme] = useTheme();
|
|
29
|
-
|
|
30
|
-
const {
|
|
31
|
-
typography: {
|
|
32
|
-
heading: { xxl, xl, lg, md, sm, xs },
|
|
33
|
-
},
|
|
34
|
-
} = theme;
|
|
35
|
-
|
|
36
|
-
const defaultHeadingTag =
|
|
37
|
-
level === 'xxl'
|
|
38
|
-
? 'h1'
|
|
39
|
-
: level === 'xl'
|
|
40
|
-
? 'h2'
|
|
41
|
-
: level === 'lg'
|
|
42
|
-
? 'h3'
|
|
43
|
-
: level === 'md'
|
|
44
|
-
? 'h4'
|
|
45
|
-
: level === 'sm'
|
|
46
|
-
? 'h5'
|
|
47
|
-
: 'h6';
|
|
48
|
-
|
|
49
|
-
const baseStyle = css`
|
|
50
|
-
font-family: ${md.md.fontFamily};
|
|
51
|
-
font-feature-settings: ${md.md.fontSettings};
|
|
52
|
-
color: ${theme.colour.text.default};
|
|
53
|
-
margin: 0;
|
|
54
|
-
`;
|
|
55
|
-
|
|
56
|
-
const levelXxlStyle = css`
|
|
57
|
-
font-size: ${xxl.sm.fontSize}px;
|
|
58
|
-
font-weight: ${xxl.sm.fontWeight};
|
|
59
|
-
line-height: ${xxl.sm.lineHeight}%;
|
|
60
|
-
@media screen and (min-width: ${theme.breakpoints.tablet}px) {
|
|
61
|
-
font-size: ${xxl.md.fontSize}px;
|
|
62
|
-
font-weight: ${xxl.md.fontWeight};
|
|
63
|
-
line-height: ${xxl.md.lineHeight}%;
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
|
|
67
|
-
const levelXlStyle = css`
|
|
68
|
-
font-size: ${xl.sm.fontSize}px;
|
|
69
|
-
font-weight: ${xl.sm.fontWeight};
|
|
70
|
-
line-height: ${xl.sm.lineHeight}%;
|
|
71
|
-
@media screen and (min-width: ${theme.breakpoints.tablet}px) {
|
|
72
|
-
font-size: ${xl.md.fontSize}px;
|
|
73
|
-
font-weight: ${xl.md.fontWeight};
|
|
74
|
-
line-height: ${xl.md.lineHeight}%;
|
|
75
|
-
}
|
|
76
|
-
`;
|
|
77
|
-
|
|
78
|
-
const levelLgStyle = css`
|
|
79
|
-
font-size: ${lg.sm.fontSize}px;
|
|
80
|
-
font-weight: ${lg.sm.fontWeight};
|
|
81
|
-
line-height: ${lg.sm.lineHeight}%;
|
|
82
|
-
@media screen and (min-width: ${theme.breakpoints.tablet}px) {
|
|
83
|
-
font-size: ${lg.md.fontSize}px;
|
|
84
|
-
font-weight: ${lg.md.fontWeight};
|
|
85
|
-
line-height: ${lg.md.lineHeight}%;
|
|
86
|
-
}
|
|
87
|
-
`;
|
|
88
|
-
|
|
89
|
-
const levelMdStyle = css`
|
|
90
|
-
font-size: ${md.sm.fontSize}px;
|
|
91
|
-
font-weight: ${md.sm.fontWeight};
|
|
92
|
-
line-height: ${md.sm.lineHeight}%;
|
|
93
|
-
@media screen and (min-width: ${theme.breakpoints.tablet}px) {
|
|
94
|
-
font-size: ${md.md.fontSize}px;
|
|
95
|
-
font-weight: ${md.md.fontWeight};
|
|
96
|
-
line-height: ${md.md.lineHeight}%;
|
|
97
|
-
}
|
|
98
|
-
`;
|
|
99
|
-
|
|
100
|
-
const levelSmStyle = css`
|
|
101
|
-
font-size: ${sm.sm.fontSize}px;
|
|
102
|
-
font-weight: ${sm.sm.fontWeight};
|
|
103
|
-
line-height: ${sm.sm.lineHeight}%;
|
|
104
|
-
@media screen and (min-width: ${theme.breakpoints.tablet}px) {
|
|
105
|
-
font-size: ${sm.md.fontSize}px;
|
|
106
|
-
font-weight: ${sm.md.fontWeight};
|
|
107
|
-
line-height: ${sm.md.lineHeight}%;
|
|
108
|
-
}
|
|
109
|
-
`;
|
|
110
|
-
|
|
111
|
-
const levelXsStyle = css`
|
|
112
|
-
font-size: ${xs.sm.fontSize}px;
|
|
113
|
-
font-weight: ${xs.sm.fontWeight};
|
|
114
|
-
line-height: ${xs.sm.lineHeight}%;
|
|
115
|
-
@media screen and (min-width: ${theme.breakpoints.tablet}px) {
|
|
116
|
-
font-size: ${xs.md.fontSize}px;
|
|
117
|
-
font-weight: ${xs.md.fontWeight};
|
|
118
|
-
line-height: ${xs.md.lineHeight}%;
|
|
119
|
-
}
|
|
120
|
-
`;
|
|
121
|
-
|
|
122
|
-
const style = cx(
|
|
123
|
-
NAME,
|
|
124
|
-
baseStyle,
|
|
125
|
-
level === 'xxl' && levelXxlStyle,
|
|
126
|
-
level === 'xl' && levelXlStyle,
|
|
127
|
-
level === 'lg' && levelLgStyle,
|
|
128
|
-
level === 'md' && levelMdStyle,
|
|
129
|
-
level === 'sm' && levelSmStyle,
|
|
130
|
-
level === 'xs' && levelXsStyle,
|
|
131
|
-
marginsStyle(props, theme),
|
|
132
|
-
className
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
const headingTag = (as || defaultHeadingTag) as keyof JSX.IntrinsicElements;
|
|
136
|
-
|
|
137
|
-
return (
|
|
138
|
-
<>
|
|
139
|
-
{headingTag === 'h1' && (
|
|
140
|
-
<h1
|
|
141
|
-
ref={ref}
|
|
142
|
-
className={style}
|
|
143
|
-
data-testid={testId}
|
|
144
|
-
{...props}
|
|
145
|
-
/>
|
|
146
|
-
)}
|
|
147
|
-
{headingTag === 'h2' && (
|
|
148
|
-
<h2
|
|
149
|
-
ref={ref}
|
|
150
|
-
className={style}
|
|
151
|
-
data-testid={testId}
|
|
152
|
-
{...props}
|
|
153
|
-
/>
|
|
154
|
-
)}
|
|
155
|
-
{headingTag === 'h3' && (
|
|
156
|
-
<h3
|
|
157
|
-
ref={ref}
|
|
158
|
-
className={style}
|
|
159
|
-
data-testid={testId}
|
|
160
|
-
{...props}
|
|
161
|
-
/>
|
|
162
|
-
)}
|
|
163
|
-
{headingTag === 'h4' && (
|
|
164
|
-
<h4
|
|
165
|
-
ref={ref}
|
|
166
|
-
className={style}
|
|
167
|
-
data-testid={testId}
|
|
168
|
-
{...props}
|
|
169
|
-
/>
|
|
170
|
-
)}
|
|
171
|
-
{headingTag === 'h5' && (
|
|
172
|
-
<h5
|
|
173
|
-
ref={ref}
|
|
174
|
-
className={style}
|
|
175
|
-
data-testid={testId}
|
|
176
|
-
{...props}
|
|
177
|
-
/>
|
|
178
|
-
)}
|
|
179
|
-
{headingTag === 'h6' && (
|
|
180
|
-
<h6
|
|
181
|
-
ref={ref}
|
|
182
|
-
className={style}
|
|
183
|
-
data-testid={testId}
|
|
184
|
-
{...props}
|
|
185
|
-
/>
|
|
186
|
-
)}
|
|
187
|
-
{headingTag === 'span' && (
|
|
188
|
-
<span
|
|
189
|
-
ref={ref as React.Ref<HTMLSpanElement>}
|
|
190
|
-
className={style}
|
|
191
|
-
data-testid={testId}
|
|
192
|
-
{...props}
|
|
193
|
-
/>
|
|
194
|
-
)}
|
|
195
|
-
{headingTag === 'div' && (
|
|
196
|
-
<div
|
|
197
|
-
ref={ref as React.Ref<HTMLDivElement>}
|
|
198
|
-
className={style}
|
|
199
|
-
data-testid={testId}
|
|
200
|
-
{...props}
|
|
201
|
-
/>
|
|
202
|
-
)}
|
|
203
|
-
</>
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
export default Heading;
|