@hero-design/rn 7.0.1 → 7.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/assets/fonts/hero-icons.ttf +0 -0
- package/es/index.js +10043 -148
- package/jest.config.js +1 -0
- package/lib/index.js +10046 -147
- package/package.json +14 -3
- package/playground/components/Badge.tsx +50 -0
- package/playground/components/Icon.tsx +140 -0
- package/playground/components/Typography.tsx +21 -0
- package/playground/index.tsx +42 -11
- package/react-native.config.js +5 -0
- package/src/components/Badge/StyledBadge.tsx +34 -0
- package/src/components/Badge/__tests__/Badge.spec.tsx +50 -0
- package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +161 -0
- package/src/components/Badge/index.tsx +35 -0
- package/src/components/Icon/HeroIcon/index.tsx +30 -0
- package/src/components/Icon/HeroIcon/selection.json +1 -0
- package/src/components/Icon/IconList.ts +298 -0
- package/src/components/Icon/__tests__/Icon.spec.tsx +36 -0
- package/src/components/Icon/__tests__/__snapshots__/Icon.spec.tsx.snap +43 -0
- package/src/components/Icon/index.tsx +47 -0
- package/src/components/Typography/Text/StyledText.tsx +69 -0
- package/src/components/Typography/Text/__test__/StyledText.spec.tsx +62 -0
- package/src/components/Typography/Text/__test__/__snapshots__/StyledText.spec.tsx.snap +172 -0
- package/src/components/Typography/Text/__test__/index.spec.tsx +11 -0
- package/src/components/Typography/Text/index.tsx +41 -0
- package/src/components/Typography/index.tsx +11 -0
- package/src/index.ts +15 -2
- package/src/testHelpers/renderWithTheme.tsx +8 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +71 -0
- package/src/theme/components/badge.ts +38 -0
- package/src/theme/components/icon.ts +24 -0
- package/src/theme/components/typography.ts +32 -0
- package/src/theme/global/typography.ts +4 -0
- package/src/theme/index.ts +12 -3
- package/testUtils/setup.ts +3 -0
- package/tsconfig.json +2 -6
- package/types/index.d.ts +3 -4
- package/types/playground/components/Badge.d.ts +2 -0
- package/types/playground/components/Card.d.ts +2 -0
- package/types/playground/components/Divider.d.ts +2 -0
- package/types/playground/components/Icon.d.ts +2 -0
- package/types/playground/components/Typography.d.ts +2 -0
- package/types/playground/index.d.ts +2 -0
- package/types/src/components/Badge/StyledBadge.d.ts +9 -0
- package/types/{components/Card/__tests__/Card.spec.d.ts → src/components/Badge/__tests__/Badge.spec.d.ts} +0 -0
- package/types/src/components/Badge/index.d.ts +22 -0
- package/types/{components → src/components}/Card/StyledCard.d.ts +0 -0
- package/types/{components/Card/__tests__/StyledCard.spec.d.ts → src/components/Card/__tests__/Card.spec.d.ts} +0 -0
- package/types/{components/Divider/__tests__/StyledDivider.spec.d.ts → src/components/Card/__tests__/StyledCard.spec.d.ts} +0 -0
- package/types/{components → src/components}/Card/index.d.ts +0 -0
- package/types/{components → src/components}/Divider/StyledDivider.d.ts +0 -0
- package/types/{theme/__tests__/index.spec.d.ts → src/components/Divider/__tests__/StyledDivider.spec.d.ts} +0 -0
- package/types/{components → src/components}/Divider/index.d.ts +0 -0
- package/types/src/components/Icon/HeroIcon/index.d.ts +7 -0
- package/types/src/components/Icon/IconList.d.ts +2 -0
- package/types/src/components/Icon/__tests__/Icon.spec.d.ts +1 -0
- package/types/src/components/Icon/index.d.ts +27 -0
- package/types/src/components/Typography/Text/StyledText.d.ts +7 -0
- package/types/src/components/Typography/Text/__test__/StyledText.spec.d.ts +1 -0
- package/types/src/components/Typography/Text/__test__/index.spec.d.ts +1 -0
- package/types/src/components/Typography/Text/index.d.ts +22 -0
- package/types/src/components/Typography/index.d.ts +6 -0
- package/types/src/index.d.ts +8 -0
- package/types/src/styled-components.d.ts +6 -0
- package/types/src/testHelpers/renderWithTheme.d.ts +3 -0
- package/types/src/theme/__tests__/index.spec.d.ts +1 -0
- package/types/src/theme/components/badge.d.ts +29 -0
- package/types/{theme → src/theme}/components/card.d.ts +0 -0
- package/types/{theme → src/theme}/components/divider.d.ts +0 -0
- package/types/src/theme/components/icon.d.ts +19 -0
- package/types/src/theme/components/typography.d.ts +25 -0
- package/types/{theme → src/theme}/global/borders.d.ts +0 -0
- package/types/src/theme/global/colors.d.ts +26 -0
- package/types/src/theme/global/index.d.ts +67 -0
- package/types/src/theme/global/space.d.ts +12 -0
- package/types/src/theme/global/typography.d.ts +25 -0
- package/types/src/theme/index.d.ts +19 -0
- package/types/theme/colors.d.ts +24 -0
- package/types/theme/components/demoStyle.d.ts +11 -0
- package/types/theme/global/colors.d.ts +0 -2
- package/types/theme/global/index.d.ts +0 -5
- package/types/theme/index.d.ts +2 -4
- package/types/theme/space.d.ts +12 -0
- package/types/theme/typography.d.ts +21 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`StyledText has body intent style 1`] = `
|
|
4
|
+
<Text
|
|
5
|
+
style={
|
|
6
|
+
Object {
|
|
7
|
+
"color": "#292a2b",
|
|
8
|
+
"fontSize": 14,
|
|
9
|
+
"fontWeight": "400",
|
|
10
|
+
"letterSpacing": 0.42,
|
|
11
|
+
"lineHeight": 22,
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
themeFontSize="medium"
|
|
15
|
+
themeFontWeight="regular"
|
|
16
|
+
themeIntent="body"
|
|
17
|
+
>
|
|
18
|
+
This is a test
|
|
19
|
+
</Text>
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
exports[`StyledText has large fontSize style 1`] = `
|
|
23
|
+
<Text
|
|
24
|
+
style={
|
|
25
|
+
Object {
|
|
26
|
+
"color": "#292a2b",
|
|
27
|
+
"fontSize": 16,
|
|
28
|
+
"fontWeight": "400",
|
|
29
|
+
"letterSpacing": 0.48,
|
|
30
|
+
"lineHeight": 24,
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
themeFontSize="large"
|
|
34
|
+
themeFontWeight="regular"
|
|
35
|
+
themeIntent="body"
|
|
36
|
+
>
|
|
37
|
+
This is a test
|
|
38
|
+
</Text>
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
exports[`StyledText has light fontWeight style 1`] = `
|
|
42
|
+
<Text
|
|
43
|
+
style={
|
|
44
|
+
Object {
|
|
45
|
+
"color": "#292a2b",
|
|
46
|
+
"fontSize": 14,
|
|
47
|
+
"fontWeight": "200",
|
|
48
|
+
"letterSpacing": 0.42,
|
|
49
|
+
"lineHeight": 22,
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
themeFontSize="medium"
|
|
53
|
+
themeFontWeight="light"
|
|
54
|
+
themeIntent="body"
|
|
55
|
+
>
|
|
56
|
+
This is a test
|
|
57
|
+
</Text>
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
exports[`StyledText has medium fontSize style 1`] = `
|
|
61
|
+
<Text
|
|
62
|
+
style={
|
|
63
|
+
Object {
|
|
64
|
+
"color": "#292a2b",
|
|
65
|
+
"fontSize": 14,
|
|
66
|
+
"fontWeight": "400",
|
|
67
|
+
"letterSpacing": 0.42,
|
|
68
|
+
"lineHeight": 22,
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
themeFontSize="medium"
|
|
72
|
+
themeFontWeight="regular"
|
|
73
|
+
themeIntent="body"
|
|
74
|
+
>
|
|
75
|
+
This is a test
|
|
76
|
+
</Text>
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
exports[`StyledText has regular fontWeight style 1`] = `
|
|
80
|
+
<Text
|
|
81
|
+
style={
|
|
82
|
+
Object {
|
|
83
|
+
"color": "#292a2b",
|
|
84
|
+
"fontSize": 14,
|
|
85
|
+
"fontWeight": "400",
|
|
86
|
+
"letterSpacing": 0.42,
|
|
87
|
+
"lineHeight": 22,
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
themeFontSize="medium"
|
|
91
|
+
themeFontWeight="regular"
|
|
92
|
+
themeIntent="body"
|
|
93
|
+
>
|
|
94
|
+
This is a test
|
|
95
|
+
</Text>
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
exports[`StyledText has semi-bold fontWeight style 1`] = `
|
|
99
|
+
<Text
|
|
100
|
+
style={
|
|
101
|
+
Object {
|
|
102
|
+
"color": "#292a2b",
|
|
103
|
+
"fontSize": 14,
|
|
104
|
+
"fontWeight": "600",
|
|
105
|
+
"letterSpacing": 0.42,
|
|
106
|
+
"lineHeight": 22,
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
themeFontSize="medium"
|
|
110
|
+
themeFontWeight="semi-bold"
|
|
111
|
+
themeIntent="body"
|
|
112
|
+
>
|
|
113
|
+
This is a test
|
|
114
|
+
</Text>
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
exports[`StyledText has small fontSize style 1`] = `
|
|
118
|
+
<Text
|
|
119
|
+
style={
|
|
120
|
+
Object {
|
|
121
|
+
"color": "#292a2b",
|
|
122
|
+
"fontSize": 12,
|
|
123
|
+
"fontWeight": "400",
|
|
124
|
+
"letterSpacing": 0.36,
|
|
125
|
+
"lineHeight": 20,
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
themeFontSize="small"
|
|
129
|
+
themeFontWeight="regular"
|
|
130
|
+
themeIntent="body"
|
|
131
|
+
>
|
|
132
|
+
This is a test
|
|
133
|
+
</Text>
|
|
134
|
+
`;
|
|
135
|
+
|
|
136
|
+
exports[`StyledText has subdued intent style 1`] = `
|
|
137
|
+
<Text
|
|
138
|
+
style={
|
|
139
|
+
Object {
|
|
140
|
+
"color": "#8b8d92",
|
|
141
|
+
"fontSize": 14,
|
|
142
|
+
"fontWeight": "400",
|
|
143
|
+
"letterSpacing": 0.42,
|
|
144
|
+
"lineHeight": 22,
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
themeFontSize="medium"
|
|
148
|
+
themeFontWeight="regular"
|
|
149
|
+
themeIntent="subdued"
|
|
150
|
+
>
|
|
151
|
+
This is a test
|
|
152
|
+
</Text>
|
|
153
|
+
`;
|
|
154
|
+
|
|
155
|
+
exports[`StyledText has xlarge fontSize style 1`] = `
|
|
156
|
+
<Text
|
|
157
|
+
style={
|
|
158
|
+
Object {
|
|
159
|
+
"color": "#292a2b",
|
|
160
|
+
"fontSize": 18,
|
|
161
|
+
"fontWeight": "400",
|
|
162
|
+
"letterSpacing": 0.54,
|
|
163
|
+
"lineHeight": 26,
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
themeFontSize="xlarge"
|
|
167
|
+
themeFontWeight="regular"
|
|
168
|
+
themeIntent="body"
|
|
169
|
+
>
|
|
170
|
+
This is a test
|
|
171
|
+
</Text>
|
|
172
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderWithTheme from '../../../../testHelpers/renderWithTheme';
|
|
3
|
+
import Text from '..';
|
|
4
|
+
|
|
5
|
+
describe('Text', () => {
|
|
6
|
+
it('renders correctly', () => {
|
|
7
|
+
const { queryAllByText } = renderWithTheme(<Text>This is a test</Text>);
|
|
8
|
+
|
|
9
|
+
expect(queryAllByText('This is a test')).toHaveLength(1);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { TextProps as NativeTextProps } from 'react-native';
|
|
3
|
+
import { StyledText } from './StyledText';
|
|
4
|
+
|
|
5
|
+
interface TextProps extends NativeTextProps {
|
|
6
|
+
/**
|
|
7
|
+
* Text content.
|
|
8
|
+
*/
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Size of the text.
|
|
12
|
+
*/
|
|
13
|
+
fontSize?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
14
|
+
/**
|
|
15
|
+
* Font weight of the text.
|
|
16
|
+
*/
|
|
17
|
+
fontWeight?: 'light' | 'regular' | 'semi-bold';
|
|
18
|
+
/**
|
|
19
|
+
* Visual intent color to apply to the text.
|
|
20
|
+
*/
|
|
21
|
+
intent?: 'body' | 'subdued';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const Text = ({
|
|
25
|
+
children,
|
|
26
|
+
fontSize = 'medium',
|
|
27
|
+
fontWeight = 'regular',
|
|
28
|
+
intent = 'body',
|
|
29
|
+
...nativeProps
|
|
30
|
+
}: TextProps) => (
|
|
31
|
+
<StyledText
|
|
32
|
+
themeFontSize={fontSize}
|
|
33
|
+
themeFontWeight={fontWeight}
|
|
34
|
+
themeIntent={intent}
|
|
35
|
+
{...nativeProps}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</StyledText>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export default Text;
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { ThemeProvider, useTheme } from 'styled-components-native';
|
|
2
2
|
import theme, { getTheme } from './theme';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import Badge from './components/Badge';
|
|
5
5
|
import Card from './components/Card';
|
|
6
|
+
import Divider from './components/Divider';
|
|
7
|
+
import Icon from './components/Icon';
|
|
8
|
+
import Typography from './components/Typography';
|
|
6
9
|
|
|
7
|
-
export {
|
|
10
|
+
export {
|
|
11
|
+
theme,
|
|
12
|
+
getTheme,
|
|
13
|
+
useTheme,
|
|
14
|
+
ThemeProvider,
|
|
15
|
+
Badge,
|
|
16
|
+
Card,
|
|
17
|
+
Divider,
|
|
18
|
+
Icon,
|
|
19
|
+
Typography,
|
|
20
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, RenderOptions } from '@testing-library/react-native'; // eslint-disable-line import/no-extraneous-dependencies
|
|
3
|
+
import { ThemeProvider, theme } from '../index';
|
|
4
|
+
|
|
5
|
+
const renderWithTheme = (ui: JSX.Element, options?: RenderOptions) =>
|
|
6
|
+
render(<ThemeProvider theme={theme}>{ui}</ThemeProvider>, options);
|
|
7
|
+
|
|
8
|
+
export default renderWithTheme;
|
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
exports[`theme returns correct theme object 1`] = `
|
|
4
4
|
Object {
|
|
5
5
|
"__hd__": Object {
|
|
6
|
+
"badge": Object {
|
|
7
|
+
"borderWidths": Object {
|
|
8
|
+
"default": "1px",
|
|
9
|
+
},
|
|
10
|
+
"colors": Object {
|
|
11
|
+
"danger": "#de350b",
|
|
12
|
+
"dangerBackground": "#fcebe7",
|
|
13
|
+
"info": "#4568fb",
|
|
14
|
+
"infoBackground": "#ecf0ff",
|
|
15
|
+
"success": "#017d6d",
|
|
16
|
+
"successBackground": "#f0fef4",
|
|
17
|
+
"warning": "#d98a2c",
|
|
18
|
+
"warningBackground": "#fff6eb",
|
|
19
|
+
},
|
|
20
|
+
"fontSizes": Object {
|
|
21
|
+
"default": "12px",
|
|
22
|
+
},
|
|
23
|
+
"fontWeights": Object {
|
|
24
|
+
"default": 600,
|
|
25
|
+
},
|
|
26
|
+
"padding": Object {
|
|
27
|
+
"default": "4px 8px",
|
|
28
|
+
},
|
|
29
|
+
"radii": Object {
|
|
30
|
+
"default": "4px",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
6
33
|
"card": Object {
|
|
7
34
|
"padding": Object {
|
|
8
35
|
"default": "16px",
|
|
@@ -26,6 +53,46 @@ Object {
|
|
|
26
53
|
"xsmall": "4px",
|
|
27
54
|
},
|
|
28
55
|
},
|
|
56
|
+
"icon": Object {
|
|
57
|
+
"colors": Object {
|
|
58
|
+
"danger": "#de350b",
|
|
59
|
+
"info": "#4568fb",
|
|
60
|
+
"primary": "#7622d7",
|
|
61
|
+
"success": "#01b39c",
|
|
62
|
+
"text": "#292a2b",
|
|
63
|
+
"warning": "#ffa234",
|
|
64
|
+
},
|
|
65
|
+
"sizes": Object {
|
|
66
|
+
"large": 28,
|
|
67
|
+
"medium": 24,
|
|
68
|
+
"small": 20,
|
|
69
|
+
"xlarge": 32,
|
|
70
|
+
"xsmall": 16,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
"typography": Object {
|
|
74
|
+
"colors": Object {
|
|
75
|
+
"body": "#292a2b",
|
|
76
|
+
"subdued": "#8b8d92",
|
|
77
|
+
},
|
|
78
|
+
"fontSizes": Object {
|
|
79
|
+
"large": 16,
|
|
80
|
+
"medium": 14,
|
|
81
|
+
"small": 12,
|
|
82
|
+
"xlarge": 18,
|
|
83
|
+
},
|
|
84
|
+
"fontWeights": Object {
|
|
85
|
+
"light": 200,
|
|
86
|
+
"regular": 400,
|
|
87
|
+
"semiBold": 600,
|
|
88
|
+
},
|
|
89
|
+
"lineHeights": Object {
|
|
90
|
+
"large": "24px",
|
|
91
|
+
"medium": "22px",
|
|
92
|
+
"small": "20px",
|
|
93
|
+
"xlarge": "26px",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
29
96
|
},
|
|
30
97
|
"borderWidths": Object {
|
|
31
98
|
"base": 1,
|
|
@@ -60,6 +127,10 @@ Object {
|
|
|
60
127
|
"small": 12,
|
|
61
128
|
"xlarge": 18,
|
|
62
129
|
"xsmall": 10,
|
|
130
|
+
"xxlarge": 20,
|
|
131
|
+
"xxxlarge": 24,
|
|
132
|
+
"xxxxlarge": 28,
|
|
133
|
+
"xxxxxlarge": 32,
|
|
63
134
|
},
|
|
64
135
|
"fontWeights": Object {
|
|
65
136
|
"bold": 700,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { GlobalTheme } from '../global';
|
|
2
|
+
|
|
3
|
+
const getBadgeTheme = (theme: GlobalTheme) => {
|
|
4
|
+
const borderWidths = {
|
|
5
|
+
default: `${theme.borderWidths.base}px`,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const colors = {
|
|
9
|
+
danger: theme.colors.danger,
|
|
10
|
+
dangerBackground: theme.colors.dangerBackground,
|
|
11
|
+
info: theme.colors.info,
|
|
12
|
+
infoBackground: theme.colors.infoBackground,
|
|
13
|
+
success: theme.colors.successDark,
|
|
14
|
+
successBackground: theme.colors.successBackground,
|
|
15
|
+
warning: theme.colors.warningDark,
|
|
16
|
+
warningBackground: theme.colors.warningBackground,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const padding = {
|
|
20
|
+
default: `${theme.space.xsmall}px ${theme.space.small}px`,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const fontSizes = {
|
|
24
|
+
default: `${theme.fontSizes.small}px`,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const fontWeights = {
|
|
28
|
+
default: theme.fontWeights.semiBold,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const radii = {
|
|
32
|
+
default: `4px`,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return { borderWidths, colors, padding, fontSizes, fontWeights, radii };
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default getBadgeTheme;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GlobalTheme } from '../global';
|
|
2
|
+
|
|
3
|
+
const getIconTheme = (theme: GlobalTheme) => {
|
|
4
|
+
const colors = {
|
|
5
|
+
text: theme.colors.text,
|
|
6
|
+
primary: theme.colors.primary,
|
|
7
|
+
info: theme.colors.info,
|
|
8
|
+
danger: theme.colors.danger,
|
|
9
|
+
success: theme.colors.success,
|
|
10
|
+
warning: theme.colors.warning,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const sizes = {
|
|
14
|
+
xsmall: theme.fontSizes.large,
|
|
15
|
+
small: theme.fontSizes.xxlarge,
|
|
16
|
+
medium: theme.fontSizes.xxxlarge,
|
|
17
|
+
large: theme.fontSizes.xxxxlarge,
|
|
18
|
+
xlarge: theme.fontSizes.xxxxxlarge,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return { colors, sizes };
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default getIconTheme;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { GlobalTheme } from '../global';
|
|
2
|
+
|
|
3
|
+
const getTypographyTheme = (theme: GlobalTheme) => {
|
|
4
|
+
const colors = {
|
|
5
|
+
body: theme.colors.text,
|
|
6
|
+
subdued: theme.colors.disabledText,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const fontSizes = {
|
|
10
|
+
small: theme.fontSizes.small,
|
|
11
|
+
medium: theme.fontSizes.medium,
|
|
12
|
+
large: theme.fontSizes.large,
|
|
13
|
+
xlarge: theme.fontSizes.xlarge,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const fontWeights = {
|
|
17
|
+
light: theme.fontWeights.light,
|
|
18
|
+
regular: theme.fontWeights.regular,
|
|
19
|
+
semiBold: theme.fontWeights.semiBold,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const lineHeights = {
|
|
23
|
+
small: `${theme.lineHeights.small}px`,
|
|
24
|
+
medium: `${theme.lineHeights.medium}px`,
|
|
25
|
+
large: `${theme.lineHeights.large}px`,
|
|
26
|
+
xlarge: `${theme.lineHeights.xlarge}px`,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return { colors, fontSizes, fontWeights, lineHeights };
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default getTypographyTheme;
|
package/src/theme/index.ts
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import globalTheme, { GlobalTheme } from './global';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import getBadgeTheme from './components/badge';
|
|
4
4
|
import getCardTheme from './components/card';
|
|
5
|
+
import getDividerTheme from './components/divider';
|
|
6
|
+
import getIconTheme from './components/icon';
|
|
7
|
+
import getTypographyTheme from './components/typography';
|
|
5
8
|
|
|
6
9
|
type Theme = GlobalTheme & {
|
|
7
10
|
__hd__: {
|
|
8
|
-
|
|
11
|
+
badge: ReturnType<typeof getBadgeTheme>;
|
|
9
12
|
card: ReturnType<typeof getCardTheme>;
|
|
13
|
+
divider: ReturnType<typeof getDividerTheme>;
|
|
14
|
+
icon: ReturnType<typeof getIconTheme>;
|
|
15
|
+
typography: ReturnType<typeof getTypographyTheme>;
|
|
10
16
|
};
|
|
11
17
|
};
|
|
12
18
|
|
|
13
19
|
const getTheme = (theme: GlobalTheme = globalTheme): Theme => ({
|
|
14
20
|
...theme,
|
|
15
21
|
__hd__: {
|
|
16
|
-
|
|
22
|
+
badge: getBadgeTheme(theme),
|
|
17
23
|
card: getCardTheme(theme),
|
|
24
|
+
divider: getDividerTheme(theme),
|
|
25
|
+
icon: getIconTheme(theme),
|
|
26
|
+
typography: getTypographyTheme(theme),
|
|
18
27
|
},
|
|
19
28
|
});
|
|
20
29
|
|
package/tsconfig.json
CHANGED
|
@@ -18,11 +18,7 @@
|
|
|
18
18
|
"styled-components-native": ["./src/styled-components.ts"]
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
-
"include": [
|
|
22
|
-
|
|
23
|
-
],
|
|
24
|
-
"exclude": [
|
|
25
|
-
"node_modules"
|
|
26
|
-
],
|
|
21
|
+
"include": ["src", "playground"],
|
|
22
|
+
"exclude": ["node_modules"],
|
|
27
23
|
"extends": "expo/tsconfig.base"
|
|
28
24
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ThemeProvider, useTheme } from 'styled-components
|
|
1
|
+
import { ThemeProvider, useTheme } from './styled-components';
|
|
2
2
|
import theme, { getTheme } from './theme';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
export { theme, getTheme, useTheme, ThemeProvider, Divider, Card };
|
|
3
|
+
import ExampleComponent from './components/ExampleComponent';
|
|
4
|
+
export { theme, getTheme, useTheme, ThemeProvider, ExampleComponent };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Text, View } from 'react-native';
|
|
2
|
+
declare type ThemeIntent = 'success' | 'warning' | 'danger' | 'info';
|
|
3
|
+
declare const StyledView: import("styled-components").StyledComponent<typeof View, import("../../theme").Theme, {
|
|
4
|
+
themeIntent: ThemeIntent;
|
|
5
|
+
}, never>;
|
|
6
|
+
declare const StyledText: import("styled-components").StyledComponent<typeof Text, import("../../theme").Theme, {
|
|
7
|
+
themeIntent: ThemeIntent;
|
|
8
|
+
}, never>;
|
|
9
|
+
export { StyledView, StyledText };
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
interface BadgeProps {
|
|
4
|
+
/**
|
|
5
|
+
* Content of the `Badge`.
|
|
6
|
+
*/
|
|
7
|
+
content: string;
|
|
8
|
+
/**
|
|
9
|
+
* Visual intent color to apply to `Badge`.
|
|
10
|
+
*/
|
|
11
|
+
intent?: 'success' | 'warning' | 'danger' | 'info';
|
|
12
|
+
/**
|
|
13
|
+
* Addditional style to be applied for `Badge`.
|
|
14
|
+
*/
|
|
15
|
+
style?: StyleProp<ViewStyle>;
|
|
16
|
+
/**
|
|
17
|
+
* Testing id of the component.
|
|
18
|
+
*/
|
|
19
|
+
testID?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const Badge: ({ content, intent, style, testID, }: BadgeProps) => ReactElement;
|
|
22
|
+
export default Badge;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare type ThemeSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
2
|
+
declare type ThemeIntent = 'text' | 'primary' | 'info' | 'danger' | 'success' | 'warning';
|
|
3
|
+
declare const StyledHeroIcon: import("styled-components").StyledComponent<typeof import("react-native-vector-icons/Icon").Icon, import("../../../theme").Theme, {
|
|
4
|
+
themeSize: ThemeSize;
|
|
5
|
+
themeIntent: ThemeIntent;
|
|
6
|
+
}, never>;
|
|
7
|
+
export default StyledHeroIcon;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const IconList: readonly ["activate", "add-person", "adjustment", "alignment", "bank", "bell", "billing", "bookmark", "box-check", "box", "buildings", "cake", "calendar-clock", "calendar", "carat-down-small", "carat-down", "carat-left", "carat-right", "carat-up", "circle-add", "circle-cancel", "circle-check", "circle-down", "circle-info", "circle-left", "circle-ok", "circle-pencil", "circle-question", "circle-remove", "circle-right", "circle-up", "circle-warning", "clock", "cloud-download", "cloud-upload", "cog", "coin", "contacts", "credit-card", "diamond", "direction-arrows", "directory", "document", "dollar-coin-shine", "double-buildings", "edit-template", "envelope", "expense", "eye-circle", "eye-invisible", "eye", "face-meh", "face-sad", "face-smiley", "feed", "feedbacks", "file-certified", "file-clone", "file-copy", "file-csv", "file-dispose", "file-doc", "file-excel", "file-export", "file-lock", "file-pdf", "file-powerpoint", "file-search", "file-secured", "file-sheets", "file-slide", "file-verified", "file-word", "file", "folder-user", "folder", "funnel-filter", "global-dollar", "globe", "graduation-cap", "graph", "happy-sun", "health-bag", "heart", "home", "image", "import", "incident-siren", "instapay", "list", "loading", "loading-2", "location", "lock", "media-content", "menu", "moneybag", "moon", "multiple-stars", "multiple-users", "node", "open-folder", "paperclip", "payment-summary", "pencil", "phone", "piggy-bank", "plane", "play-circle", "print", "raising-hands", "reply", "reschedule", "rostering", "save", "schedule", "search-person", "send", "speaker", "star-medal", "star", "steps-circle", "stopwatch", "suitcase", "survey", "switch", "tag", "target", "teams", "timesheet", "touch-id", "trash-bin", "unlock", "user", "video-1", "video-2", "activate-outlined", "add-person-outlined", "add-section-outlined", "add-time-outlined", "add", "adjustment-outlined", "alignment-2-outlined", "alignment-outlined", "all-caps", "arrow-down", "arrow-left", "arrow-right", "arrow-up", "at-sign", "bell-outlined", "billing-outlined", "body-outlined", "bold", "bookmark-outlined", "box-check-outlined", "box-outlined", "bullet-points", "cake-outlined", "calendar-dates-outlined", "calendar-star-outlined", "camera-outlined", "cancel", "checkmark", "circle-add-outlined", "circle-cancel-outlined", "circle-down-outlined", "circle-info-outlined", "circle-left-outlined", "circle-ok-outlined", "circle-question-outlined", "circle-remove-outlined", "circle-right-outlined", "circle-up-outlined", "circle-warning-outlined", "clock-2-outlined", "clock-outlined", "cog-outlined", "coin-outlined", "comment-outlined", "contacts-outlined", "credit-card-outlined", "direction-arrows-outlined", "directory-outlined", "document-outlined", "dollar-coin-shine-outlined", "dollar-sign", "double-buildings-outlined", "double-left-arrows", "double-right-arrows", "download-outlined", "edit-template-outlined", "email-outlined", "enter-arrow", "envelope-outlined", "expense-outlined", "external-link", "eye-invisible-outlined", "eye-outlined", "face-id", "face-meh-outlined", "face-open-smiley-outlined", "face-sad-outlined", "face-smiley-outlined", "feed-outlined", "file-certified-outlined", "file-clone-outlined", "file-copy-outlined", "file-dispose-outlined", "file-download-outlined", "file-export-outlined", "file-lock-outlined", "file-outlined", "file-search-outlined", "file-secured-outlined", "file-verified-outlined", "folder-outlined", "folder-user-outlined", "funnel-filter-outline", "graph-outlined", "happy-sun-outlined", "health-bag-outlined", "heart-outlined", "home-outlined", "image-outlined", "import-outlined", "instapay-outlined", "italic", "link-1", "link-2", "list-outlined", "location-outlined", "lock-outlined", "locked-file-outlined", "log-out", "media-content-outlined", "menu-close", "menu-expand", "menu-fold-outlined", "menu-unfold-outlined", "moneybag-outlined", "moon-outlined", "more-horizontal", "more-vertical", "multiple-folders-outlined", "multiple-users-outlined", "node-outlined", "number-points", "number", "payment-summary-outlined", "payslip-outlined", "pencil-outlined", "percentage", "phone-outlined", "piggy-bank-outlined", "plane-outlined", "play-circle-outlined", "print-outlined", "qr-code-outlined", "re-assign", "refresh", "remove", "reply-outlined", "restart", "return-arrow", "rostering-outlined", "save-outlined", "schedule-outlined", "search-outlined", "send-outlined", "share-1", "share-2", "single-down-arrow", "single-left-arrow", "single-right-arrow", "single-up-arrow", "speaker-outlined", "star-outlined", "stopwatch-outlined", "strikethrough", "survey-outlined", "switch-outlined", "sync", "target-outlined", "timesheet-outlined", "transfer", "trash-bin-outlined", "unavailable", "underline", "unlock-outlined", "upload-outlined", "user-outlined", "video-1-outlined", "video-2-outlined"];
|
|
2
|
+
export default IconList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import IconList from './IconList';
|
|
3
|
+
declare type IconName = typeof IconList[number];
|
|
4
|
+
interface IconProps {
|
|
5
|
+
/**
|
|
6
|
+
* Name of the `Icon`.
|
|
7
|
+
*/
|
|
8
|
+
icon: IconName;
|
|
9
|
+
/**
|
|
10
|
+
* Addditional style to be applied for `Icon`.
|
|
11
|
+
*/
|
|
12
|
+
style?: StyleProp<ViewStyle>;
|
|
13
|
+
/**
|
|
14
|
+
* Size of the `Icon`.
|
|
15
|
+
*/
|
|
16
|
+
size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
17
|
+
/**
|
|
18
|
+
* Intent of the `Icon`.
|
|
19
|
+
*/
|
|
20
|
+
intent?: 'text' | 'primary' | 'info' | 'danger' | 'success' | 'warning';
|
|
21
|
+
/**
|
|
22
|
+
* Testing id of the component.
|
|
23
|
+
*/
|
|
24
|
+
testID?: string;
|
|
25
|
+
}
|
|
26
|
+
declare const Icon: ({ icon, style, size, intent, testID, }: IconProps) => JSX.Element;
|
|
27
|
+
export default Icon;
|