onecart-ui 1.0.1 → 1.0.2
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/README.md +64 -27
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts +2 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Icon/Icon.d.ts +40 -0
- package/dist/components/Icon/Icon.d.ts.map +1 -0
- package/dist/components/Icon/IconList.d.ts +21 -0
- package/dist/components/Icon/IconList.d.ts.map +1 -0
- package/dist/components/Icon/index.d.ts +6 -0
- package/dist/components/Icon/index.d.ts.map +1 -0
- package/dist/components/Typography/Body.d.ts +4 -0
- package/dist/components/Typography/Body.d.ts.map +1 -0
- package/dist/components/Typography/Display.d.ts +4 -0
- package/dist/components/Typography/Display.d.ts.map +1 -0
- package/dist/components/Typography/Heading.d.ts +4 -0
- package/dist/components/Typography/Heading.d.ts.map +1 -0
- package/dist/components/Typography/Utility.d.ts +4 -0
- package/dist/components/Typography/Utility.d.ts.map +1 -0
- package/dist/components/Typography/index.d.ts +4 -2
- package/dist/components/Typography/index.d.ts.map +1 -1
- package/dist/index.d.ts +4 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles/tokens/typography.d.ts +11 -0
- package/dist/styles/tokens/typography.d.ts.map +1 -1
- package/dist/types/Button.d.ts +17 -40
- package/dist/types/Button.d.ts.map +1 -1
- package/dist/types/Typography.d.ts +20 -55
- package/dist/types/Typography.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/components/Button/Button.tsx +235 -136
- package/src/components/Button/index.ts +7 -2
- package/src/components/Icon/Icon.tsx +113 -0
- package/src/components/Icon/IconList.tsx +110 -0
- package/src/components/Icon/icons.json +81 -0
- package/src/components/Icon/index.ts +5 -0
- package/src/components/Typography/Body.tsx +94 -0
- package/src/components/Typography/Display.tsx +79 -0
- package/src/components/Typography/Heading.tsx +110 -0
- package/src/components/Typography/Utility.tsx +107 -0
- package/src/components/Typography/index.ts +4 -7
- package/src/index.ts +8 -17
- package/src/styles/tokens/tokens-autocomplete-config.json +2 -2
- package/src/styles/tokens/tokens.css +1 -1
- package/src/styles/tokens/typography.ts +11 -0
- package/src/types/Button.ts +19 -48
- package/src/types/Typography.ts +21 -81
- package/src/components/Heading/Heading.tsx +0 -48
- package/src/components/Heading/index.ts +0 -2
- package/src/components/Paragraph/Paragraph.tsx +0 -93
- package/src/components/Paragraph/index.ts +0 -6
- package/src/components/Text/Text.tsx +0 -96
- package/src/components/Text/index.ts +0 -2
- package/src/components/Typography/Typography.tsx +0 -123
- package/src/types/Heading.ts +0 -27
- package/src/types/Paragraph.ts +0 -40
- package/src/types/Text.ts +0 -40
package/src/types/Typography.ts
CHANGED
|
@@ -1,94 +1,34 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Typography variants
|
|
5
|
-
*/
|
|
6
|
-
export type TypographyVariant =
|
|
7
|
-
// Display variants - Used for large headlines and intro sections
|
|
8
|
-
| "display2xl"
|
|
9
|
-
| "displayXl"
|
|
10
|
-
// Heading variants - Used for section headings
|
|
11
|
-
| "headingXl"
|
|
12
|
-
| "headingLg"
|
|
13
|
-
| "headingMd"
|
|
14
|
-
| "headingSm"
|
|
15
|
-
| "headingXs"
|
|
16
|
-
// Body text variants - Used for paragraphs and content
|
|
17
|
-
| "bodyLg"
|
|
18
|
-
| "bodyMd"
|
|
19
|
-
| "bodySm"
|
|
20
|
-
| "bodyXs"
|
|
21
|
-
// Label variants - Used for form labels, captions, etc.
|
|
22
|
-
| "labelLg"
|
|
23
|
-
| "labelMd"
|
|
24
|
-
| "labelSm";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Text alignment options
|
|
28
|
-
*/
|
|
29
3
|
export type TypographyAlign = "left" | "center" | "right";
|
|
30
4
|
|
|
31
|
-
/**
|
|
32
|
-
* Font weight options
|
|
33
|
-
*/
|
|
34
5
|
export type TypographyWeight = "normal" | "medium" | "semibold" | "bold";
|
|
35
6
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
39
|
-
export interface TypographyProps extends Omit<TextProps, "children"> {
|
|
40
|
-
/**
|
|
41
|
-
* The content to display
|
|
42
|
-
*/
|
|
43
|
-
children?: React.ReactNode;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The typography variant to use
|
|
47
|
-
* @default 'bodyMd'
|
|
48
|
-
*/
|
|
49
|
-
variant?: TypographyVariant;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Text alignment
|
|
53
|
-
* @default 'left'
|
|
54
|
-
*/
|
|
7
|
+
export interface BaseTypographyProps {
|
|
8
|
+
element?: React.ElementType;
|
|
55
9
|
align?: TypographyAlign;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Font weight
|
|
59
|
-
*/
|
|
60
10
|
weight?: TypographyWeight;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Text color
|
|
64
|
-
* If not provided, uses variant's default color from theme
|
|
65
|
-
*/
|
|
66
11
|
color?: string;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Whether to truncate text with ellipsis if it overflows
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
12
|
truncate?: boolean;
|
|
13
|
+
lineClamp?: number;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
18
|
+
testID?: string;
|
|
19
|
+
}
|
|
73
20
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Additional custom styles for the text
|
|
82
|
-
*/
|
|
83
|
-
style?: TextProps["style"];
|
|
21
|
+
export interface DisplayProps extends BaseTypographyProps {
|
|
22
|
+
size: "2xl" | "xl";
|
|
23
|
+
}
|
|
24
|
+
export interface HeadingProps extends BaseTypographyProps {
|
|
25
|
+
size: "xl" | "lg" | "md" | "sm" | "xs";
|
|
26
|
+
}
|
|
84
27
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
accessibilityLabel?: string;
|
|
28
|
+
export interface BodyProps extends BaseTypographyProps {
|
|
29
|
+
size: "xl" | "lg" | "md" | "sm";
|
|
30
|
+
}
|
|
89
31
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*/
|
|
93
|
-
testID?: string;
|
|
32
|
+
export interface UtilityProps extends BaseTypographyProps {
|
|
33
|
+
variant: "button" | "link" | "caption";
|
|
94
34
|
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import * as tokens from "../../styles/tokens/tokens";
|
|
3
|
-
import { HeadingProps } from "../../types/Heading";
|
|
4
|
-
import { Typography } from "../Typography";
|
|
5
|
-
|
|
6
|
-
const headingLevelToVariant = {
|
|
7
|
-
h1: "headingXl",
|
|
8
|
-
h2: "headingLg",
|
|
9
|
-
h3: "headingMd",
|
|
10
|
-
h4: "headingSm",
|
|
11
|
-
h5: "headingXs",
|
|
12
|
-
h6: "headingXs",
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const Heading: React.FC<HeadingProps> = ({
|
|
16
|
-
children,
|
|
17
|
-
level = "h2",
|
|
18
|
-
subtitle,
|
|
19
|
-
subtitleProps,
|
|
20
|
-
...rest
|
|
21
|
-
}) => {
|
|
22
|
-
const variant = headingLevelToVariant[level];
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<>
|
|
26
|
-
<Typography variant={variant} accessibilityRole={level} {...rest}>
|
|
27
|
-
{children}
|
|
28
|
-
</Typography>
|
|
29
|
-
|
|
30
|
-
{subtitle && (
|
|
31
|
-
<Typography
|
|
32
|
-
variant="bodySm"
|
|
33
|
-
color={tokens.TEXT_TERTIARY}
|
|
34
|
-
style={{
|
|
35
|
-
marginTop: tokens.LAYOUT_SPACING_STACK_XS
|
|
36
|
-
? parseInt(tokens.LAYOUT_SPACING_STACK_XS)
|
|
37
|
-
: 4,
|
|
38
|
-
}}
|
|
39
|
-
{...subtitleProps}
|
|
40
|
-
>
|
|
41
|
-
{subtitle}
|
|
42
|
-
</Typography>
|
|
43
|
-
)}
|
|
44
|
-
</>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default Heading;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
import * as tokens from "../../styles/tokens/tokens";
|
|
4
|
-
import { ParagraphProps } from "../../types/Paragraph";
|
|
5
|
-
import { remToNumber } from "../../styles/tokens/utils/utils";
|
|
6
|
-
import { Text } from "../Text";
|
|
7
|
-
|
|
8
|
-
export const Paragraph: React.FC<ParagraphProps> = ({
|
|
9
|
-
children,
|
|
10
|
-
size = "md",
|
|
11
|
-
spacing = "md",
|
|
12
|
-
firstLineIndent = false,
|
|
13
|
-
dropCap = false,
|
|
14
|
-
style,
|
|
15
|
-
...rest
|
|
16
|
-
}) => {
|
|
17
|
-
const getVariant = () => {
|
|
18
|
-
switch (size) {
|
|
19
|
-
case "xs":
|
|
20
|
-
return "bodyXs";
|
|
21
|
-
case "sm":
|
|
22
|
-
return "bodySm";
|
|
23
|
-
case "lg":
|
|
24
|
-
return "bodyLg";
|
|
25
|
-
case "md":
|
|
26
|
-
default:
|
|
27
|
-
return "bodyMd";
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const getMarginBottom = () => {
|
|
32
|
-
switch (spacing) {
|
|
33
|
-
case "none":
|
|
34
|
-
return tokens.LAYOUT_SPACING_STACK_NONE;
|
|
35
|
-
case "xs":
|
|
36
|
-
return remToNumber(tokens.LAYOUT_SPACING_STACK_XS);
|
|
37
|
-
case "sm":
|
|
38
|
-
return remToNumber(tokens.LAYOUT_SPACING_STACK_SM);
|
|
39
|
-
case "lg":
|
|
40
|
-
return remToNumber(tokens.LAYOUT_SPACING_STACK_LG);
|
|
41
|
-
case "xl":
|
|
42
|
-
return remToNumber(tokens.LAYOUT_SPACING_STACK_XL);
|
|
43
|
-
case "md":
|
|
44
|
-
default:
|
|
45
|
-
return remToNumber(tokens.LAYOUT_SPACING_STACK_MD);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const paragraphStyle = {
|
|
50
|
-
marginBottom: getMarginBottom(),
|
|
51
|
-
...(firstLineIndent
|
|
52
|
-
? {
|
|
53
|
-
textIndent: remToNumber(tokens.LAYOUT_SPACING_INLINE_MD) || 20,
|
|
54
|
-
}
|
|
55
|
-
: {}),
|
|
56
|
-
...style,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
if (dropCap && typeof children === "string" && children.length > 0) {
|
|
60
|
-
const firstChar = children.charAt(0);
|
|
61
|
-
const restOfText = children.slice(1);
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<View style={paragraphStyle}>
|
|
65
|
-
<View style={{ flexDirection: "row", alignItems: "flex-start" }}>
|
|
66
|
-
<Text
|
|
67
|
-
variant="headingLg"
|
|
68
|
-
style={{
|
|
69
|
-
lineHeight: 1,
|
|
70
|
-
marginRight:
|
|
71
|
-
remToNumber(tokens.LAYOUT_SPACING_INLINE_2XS) / 4 || 2,
|
|
72
|
-
marginTop: -2,
|
|
73
|
-
}}
|
|
74
|
-
{...rest}
|
|
75
|
-
>
|
|
76
|
-
{firstChar}
|
|
77
|
-
</Text>
|
|
78
|
-
<Text variant={getVariant()} {...rest}>
|
|
79
|
-
{restOfText}
|
|
80
|
-
</Text>
|
|
81
|
-
</View>
|
|
82
|
-
</View>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<Text variant={getVariant()} style={paragraphStyle} {...rest}>
|
|
88
|
-
{children}
|
|
89
|
-
</Text>
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export default Paragraph;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { TouchableOpacity, TextStyle, View } from "react-native";
|
|
3
|
-
import * as tokens from "../../styles/tokens/tokens";
|
|
4
|
-
import { Typography } from "../Typography";
|
|
5
|
-
import { useTheme } from "../../theme/ThemeProvider";
|
|
6
|
-
import { TextProps } from "../../types/Text";
|
|
7
|
-
|
|
8
|
-
export const Text: React.FC<TextProps> = ({
|
|
9
|
-
children,
|
|
10
|
-
variant = "bodyMd",
|
|
11
|
-
align,
|
|
12
|
-
weight,
|
|
13
|
-
color,
|
|
14
|
-
underline = false,
|
|
15
|
-
strikethrough = false,
|
|
16
|
-
italic = false,
|
|
17
|
-
link = false,
|
|
18
|
-
onLinkPress,
|
|
19
|
-
style,
|
|
20
|
-
...rest
|
|
21
|
-
}) => {
|
|
22
|
-
const { theme } = useTheme();
|
|
23
|
-
|
|
24
|
-
const getTextDecorations = React.useMemo((): TextStyle => {
|
|
25
|
-
const decorations: TextStyle = {};
|
|
26
|
-
|
|
27
|
-
if (underline) {
|
|
28
|
-
decorations.textDecorationLine = "underline";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (strikethrough) {
|
|
32
|
-
decorations.textDecorationLine = decorations.textDecorationLine
|
|
33
|
-
? "underline line-through"
|
|
34
|
-
: "line-through";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (italic) {
|
|
38
|
-
decorations.fontStyle = "italic";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (link) {
|
|
42
|
-
const linkColor = color || theme.colors?.primary || tokens.TEXT_BLUE;
|
|
43
|
-
decorations.color = linkColor;
|
|
44
|
-
|
|
45
|
-
decorations.textDecorationLine = underline
|
|
46
|
-
? "underline"
|
|
47
|
-
: decorations.textDecorationLine || tokens.TEXT_DECORATION_NONE;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return decorations;
|
|
51
|
-
}, [underline, strikethrough, italic, link, color, theme]);
|
|
52
|
-
|
|
53
|
-
const combinedStyle = React.useMemo(
|
|
54
|
-
() => ({
|
|
55
|
-
...getTextDecorations,
|
|
56
|
-
...style,
|
|
57
|
-
}),
|
|
58
|
-
[getTextDecorations, style]
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
if (link && onLinkPress) {
|
|
62
|
-
return (
|
|
63
|
-
<TouchableOpacity
|
|
64
|
-
onPress={onLinkPress}
|
|
65
|
-
accessibilityRole="link"
|
|
66
|
-
activeOpacity={0.7}
|
|
67
|
-
>
|
|
68
|
-
<Typography
|
|
69
|
-
variant={variant}
|
|
70
|
-
align={align}
|
|
71
|
-
weight={weight}
|
|
72
|
-
color={color || theme.colors?.primary || tokens.TEXT_BLUE}
|
|
73
|
-
style={combinedStyle}
|
|
74
|
-
{...rest}
|
|
75
|
-
>
|
|
76
|
-
{children}
|
|
77
|
-
</Typography>
|
|
78
|
-
</TouchableOpacity>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<Typography
|
|
84
|
-
variant={variant}
|
|
85
|
-
align={align}
|
|
86
|
-
weight={weight}
|
|
87
|
-
color={color}
|
|
88
|
-
style={combinedStyle}
|
|
89
|
-
{...rest}
|
|
90
|
-
>
|
|
91
|
-
{children}
|
|
92
|
-
</Typography>
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export default Text;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Text, TextStyle } from "react-native";
|
|
3
|
-
import { typographyTokens } from "../../styles/tokens";
|
|
4
|
-
import * as tokens from "../../styles/tokens/tokens";
|
|
5
|
-
import { useTheme } from "../../theme/ThemeProvider";
|
|
6
|
-
import { letterSpacingToPixels } from "../../styles/tokens/utils/fontUtils";
|
|
7
|
-
import { TypographyProps } from "../../types/Typography";
|
|
8
|
-
|
|
9
|
-
export const Typography: React.FC<TypographyProps> = ({
|
|
10
|
-
children,
|
|
11
|
-
variant = "bodyMd",
|
|
12
|
-
align = "left",
|
|
13
|
-
weight,
|
|
14
|
-
color,
|
|
15
|
-
truncate = false,
|
|
16
|
-
numberOfLines,
|
|
17
|
-
style,
|
|
18
|
-
accessibilityLabel,
|
|
19
|
-
testID,
|
|
20
|
-
...rest
|
|
21
|
-
}) => {
|
|
22
|
-
const { theme } = useTheme();
|
|
23
|
-
|
|
24
|
-
const getTypographyStyles = React.useMemo((): TextStyle => {
|
|
25
|
-
try {
|
|
26
|
-
const variantStyle = typographyTokens[variant];
|
|
27
|
-
|
|
28
|
-
const textAlign = align;
|
|
29
|
-
|
|
30
|
-
const fontWeight = weight
|
|
31
|
-
? typographyTokens.weights[weight]
|
|
32
|
-
: variantStyle.fontWeight;
|
|
33
|
-
|
|
34
|
-
let defaultColor = variantStyle.color;
|
|
35
|
-
if (theme?.colors?.text && typeof theme.colors.text === "object") {
|
|
36
|
-
const themeTextColor = (theme.colors.text as Record<string, string>)[
|
|
37
|
-
variant
|
|
38
|
-
];
|
|
39
|
-
if (themeTextColor) {
|
|
40
|
-
defaultColor = themeTextColor;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const textColor = color || defaultColor;
|
|
44
|
-
|
|
45
|
-
// Create style object
|
|
46
|
-
const styles: TextStyle = {
|
|
47
|
-
fontFamily: variantStyle.fontFamily,
|
|
48
|
-
fontSize: variantStyle.fontSize,
|
|
49
|
-
fontWeight: fontWeight as any,
|
|
50
|
-
lineHeight: variantStyle.lineHeight,
|
|
51
|
-
color: textColor,
|
|
52
|
-
textAlign,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
if (variantStyle.letterSpacing) {
|
|
56
|
-
styles.letterSpacing = letterSpacingToPixels(
|
|
57
|
-
variantStyle.letterSpacing.toString(),
|
|
58
|
-
variantStyle.fontSize
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
variantStyle.textDecoration &&
|
|
64
|
-
variantStyle.textDecoration !== "none"
|
|
65
|
-
) {
|
|
66
|
-
styles.textDecorationLine = variantStyle.textDecoration as any;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (variantStyle.textCase && variantStyle.textCase !== "none") {
|
|
70
|
-
if (variantStyle.textCase === "uppercase") {
|
|
71
|
-
styles.textTransform = "uppercase";
|
|
72
|
-
} else if (variantStyle.textCase === "lowercase") {
|
|
73
|
-
styles.textTransform = "lowercase";
|
|
74
|
-
} else if (variantStyle.textCase === "capitalize") {
|
|
75
|
-
styles.textTransform = "capitalize";
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return styles;
|
|
80
|
-
} catch (error) {
|
|
81
|
-
return {
|
|
82
|
-
fontSize: 16,
|
|
83
|
-
fontWeight: "400",
|
|
84
|
-
lineHeight: 24,
|
|
85
|
-
color: tokens.TEXT_BODY || "#000000",
|
|
86
|
-
textAlign: align,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}, [variant, align, weight, color, theme]);
|
|
90
|
-
|
|
91
|
-
const textStyles = React.useMemo((): TextStyle => {
|
|
92
|
-
const combinedStyles: TextStyle = { ...getTypographyStyles };
|
|
93
|
-
|
|
94
|
-
if (truncate) {
|
|
95
|
-
const webStyles: any = {
|
|
96
|
-
overflow: "hidden",
|
|
97
|
-
textOverflow: "ellipsis",
|
|
98
|
-
whiteSpace: "nowrap",
|
|
99
|
-
};
|
|
100
|
-
Object.assign(combinedStyles, webStyles);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (style) {
|
|
104
|
-
Object.assign(combinedStyles, style);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return combinedStyles;
|
|
108
|
-
}, [getTypographyStyles, truncate, style]);
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<Text
|
|
112
|
-
style={textStyles}
|
|
113
|
-
numberOfLines={numberOfLines || (truncate ? 1 : undefined)}
|
|
114
|
-
accessibilityLabel={accessibilityLabel}
|
|
115
|
-
testID={testID}
|
|
116
|
-
{...rest}
|
|
117
|
-
>
|
|
118
|
-
{children}
|
|
119
|
-
</Text>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export default Typography;
|
package/src/types/Heading.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { TypographyProps } from "./Typography";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Heading levels corresponding to HTML heading elements
|
|
5
|
-
*/
|
|
6
|
-
export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Heading component props
|
|
10
|
-
*/
|
|
11
|
-
export interface HeadingProps extends Omit<TypographyProps, "variant"> {
|
|
12
|
-
/**
|
|
13
|
-
* The heading level
|
|
14
|
-
* @default 'h2'
|
|
15
|
-
*/
|
|
16
|
-
level?: HeadingLevel;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Optional subtitle to display below the heading
|
|
20
|
-
*/
|
|
21
|
-
subtitle?: React.ReactNode;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Props to pass to the subtitle Typography component
|
|
25
|
-
*/
|
|
26
|
-
subtitleProps?: Omit<TypographyProps, "children">;
|
|
27
|
-
}
|
package/src/types/Paragraph.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { TextProps } from "./Text";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Paragraph size options
|
|
5
|
-
*/
|
|
6
|
-
export type ParagraphSize = "xs" | "sm" | "md" | "lg";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Paragraph spacing options
|
|
10
|
-
*/
|
|
11
|
-
export type ParagraphSpacing = "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Paragraph component props
|
|
15
|
-
*/
|
|
16
|
-
export interface ParagraphProps extends TextProps {
|
|
17
|
-
/**
|
|
18
|
-
* Size of the paragraph text
|
|
19
|
-
* @default 'md'
|
|
20
|
-
*/
|
|
21
|
-
size?: ParagraphSize;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Spacing below the paragraph
|
|
25
|
-
* @default 'md'
|
|
26
|
-
*/
|
|
27
|
-
spacing?: ParagraphSpacing;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Whether to indent the first line of the paragraph
|
|
31
|
-
* @default false
|
|
32
|
-
*/
|
|
33
|
-
firstLineIndent?: boolean;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Whether to apply a drop cap style to the first letter
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
dropCap?: boolean;
|
|
40
|
-
}
|
package/src/types/Text.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { TypographyProps } from "./Typography";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Text component props extending Typography props with additional features
|
|
5
|
-
*/
|
|
6
|
-
export interface TextProps extends TypographyProps {
|
|
7
|
-
/**
|
|
8
|
-
* Whether the text should be underlined
|
|
9
|
-
* @default false
|
|
10
|
-
*/
|
|
11
|
-
underline?: boolean;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Whether the text should have a strikethrough line
|
|
15
|
-
* @default false
|
|
16
|
-
*/
|
|
17
|
-
strikethrough?: boolean;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Whether the text should be italic
|
|
21
|
-
* @default false
|
|
22
|
-
*/
|
|
23
|
-
italic?: boolean;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Whether the text should be styled as a link
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
link?: boolean;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Callback function when the link is pressed
|
|
33
|
-
* Only used when link prop is true
|
|
34
|
-
*/
|
|
35
|
-
onLinkPress?: () => void;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Additional props from Typography component are inherited
|
|
39
|
-
*/
|
|
40
|
-
}
|