@hero-design/rn 8.30.4 → 8.31.0
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/.turbo/turbo-build.log +1 -1
- package/es/index.js +46 -7
- package/lib/index.js +46 -7
- package/package.json +5 -5
- package/src/components/Typography/Caption/StyledCaption.tsx +19 -0
- package/src/components/Typography/Caption/__tests__/StyledCaption.spec.tsx +39 -0
- package/src/components/Typography/Caption/__tests__/__snapshots__/StyledCaption.spec.tsx.snap +211 -0
- package/src/components/Typography/Caption/__tests__/__snapshots__/index.spec.tsx.snap +287 -0
- package/src/components/Typography/Caption/__tests__/index.spec.tsx +46 -0
- package/src/components/Typography/Caption/index.tsx +61 -0
- package/src/components/Typography/index.tsx +3 -0
- package/src/components/Typography/types.ts +18 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +2 -0
- package/src/theme/components/typography.ts +2 -0
- package/src/utils/helpers.ts +4 -1
- package/types/components/Accordion/AccordionItem.d.ts +1 -1
- package/types/components/Accordion/StyledAccordion.d.ts +1 -1
- package/types/components/Avatar/StyledAvatar.d.ts +2 -2
- package/types/components/Badge/StyledBadge.d.ts +2 -2
- package/types/components/BottomNavigation/index.d.ts +1 -1
- package/types/components/BottomSheet/BottomSheetContext.d.ts +1 -1
- package/types/components/Box/config.d.ts +2 -2
- package/types/components/Box/types.d.ts +3 -3
- package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +1 -1
- package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
- package/types/components/Button/StyledButton.d.ts +2 -2
- package/types/components/Carousel/CardCarousel.d.ts +1 -1
- package/types/components/Carousel/types.d.ts +2 -2
- package/types/components/Divider/StyledDivider.d.ts +1 -1
- package/types/components/Drawer/DragableDrawer/helpers.d.ts +1 -1
- package/types/components/Empty/StyledEmpty.d.ts +1 -1
- package/types/components/Error/StyledError.d.ts +1 -1
- package/types/components/FAB/AnimatedFABIcon.d.ts +1 -1
- package/types/components/Icon/AnimatedIcon.d.ts +1 -1
- package/types/components/Icon/HeroIcon/index.d.ts +2 -2
- package/types/components/Icon/index.d.ts +1 -1
- package/types/components/List/StyledListItem.d.ts +2 -2
- package/types/components/PinInput/StyledPinInput.d.ts +1 -1
- package/types/components/Progress/types.d.ts +1 -1
- package/types/components/Radio/types.d.ts +1 -1
- package/types/components/RefreshControl/index.d.ts +1 -1
- package/types/components/RichTextEditor/RichTextEditor.d.ts +1 -1
- package/types/components/RichTextEditor/types.d.ts +1 -1
- package/types/components/Select/BaseOptionList.d.ts +1 -1
- package/types/components/Select/MultiSelect/OptionList.d.ts +1 -1
- package/types/components/Select/SingleSelect/OptionList.d.ts +1 -1
- package/types/components/Select/helpers.d.ts +1 -1
- package/types/components/Select/types.d.ts +6 -6
- package/types/components/Skeleton/StyledSkeleton.d.ts +2 -2
- package/types/components/Success/StyledSuccess.d.ts +1 -1
- package/types/components/Swipeable/StyledSwipeable.d.ts +1 -1
- package/types/components/Swipeable/index.d.ts +2 -2
- package/types/components/Switch/SelectorSwitch/index.d.ts +3 -3
- package/types/components/Switch/StyledSwitch.d.ts +1 -1
- package/types/components/Tabs/TabWithBadge.d.ts +3 -3
- package/types/components/Tabs/index.d.ts +2 -2
- package/types/components/Tag/StyledTag.d.ts +2 -2
- package/types/components/TextInput/StyledTextInput.d.ts +2 -2
- package/types/components/TextInput/index.d.ts +1 -1
- package/types/components/Toast/ToastContext.d.ts +2 -2
- package/types/components/Toast/ToastProvider.d.ts +1 -1
- package/types/components/Toast/types.d.ts +2 -2
- package/types/components/Typography/Caption/StyledCaption.d.ts +13 -0
- package/types/components/Typography/Caption/index.d.ts +26 -0
- package/types/components/Typography/index.d.ts +2 -0
- package/types/components/Typography/types.d.ts +6 -0
- package/types/theme/ThemeSwitcher.d.ts +1 -1
- package/types/theme/components/typography.d.ts +2 -0
- package/types/theme/getTheme.d.ts +1 -1
- package/types/theme/global/colors/types.d.ts +3 -3
- package/types/theme/global/index.d.ts +1 -1
- package/types/theme/global/scale.d.ts +1 -1
- package/types/theme/global/typography.d.ts +1 -1
- package/types/utils/helpers.d.ts +1 -1
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Caption has archived intent style 1`] = `
|
|
4
|
+
<Text
|
|
5
|
+
allowFontScaling={false}
|
|
6
|
+
style={
|
|
7
|
+
Array [
|
|
8
|
+
Object {
|
|
9
|
+
"color": "#737479",
|
|
10
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
11
|
+
"fontSize": 12,
|
|
12
|
+
"letterSpacing": 0.48,
|
|
13
|
+
"lineHeight": 16,
|
|
14
|
+
},
|
|
15
|
+
undefined,
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
themeFontWeight="regular"
|
|
19
|
+
themeIntent="archived"
|
|
20
|
+
>
|
|
21
|
+
This is a test
|
|
22
|
+
</Text>
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports[`Caption has body intent style 1`] = `
|
|
26
|
+
<Text
|
|
27
|
+
allowFontScaling={false}
|
|
28
|
+
style={
|
|
29
|
+
Array [
|
|
30
|
+
Object {
|
|
31
|
+
"color": "#001f23",
|
|
32
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
33
|
+
"fontSize": 12,
|
|
34
|
+
"letterSpacing": 0.48,
|
|
35
|
+
"lineHeight": 16,
|
|
36
|
+
},
|
|
37
|
+
undefined,
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
themeFontWeight="regular"
|
|
41
|
+
themeIntent="body"
|
|
42
|
+
>
|
|
43
|
+
This is a test
|
|
44
|
+
</Text>
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
exports[`Caption has danger intent style 1`] = `
|
|
48
|
+
<Text
|
|
49
|
+
allowFontScaling={false}
|
|
50
|
+
style={
|
|
51
|
+
Array [
|
|
52
|
+
Object {
|
|
53
|
+
"color": "#f46363",
|
|
54
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
55
|
+
"fontSize": 12,
|
|
56
|
+
"letterSpacing": 0.48,
|
|
57
|
+
"lineHeight": 16,
|
|
58
|
+
},
|
|
59
|
+
undefined,
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
themeFontWeight="regular"
|
|
63
|
+
themeIntent="danger"
|
|
64
|
+
>
|
|
65
|
+
This is a test
|
|
66
|
+
</Text>
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
exports[`Caption has disabled intent style 1`] = `
|
|
70
|
+
<Text
|
|
71
|
+
allowFontScaling={false}
|
|
72
|
+
style={
|
|
73
|
+
Array [
|
|
74
|
+
Object {
|
|
75
|
+
"color": "#bfc1c5",
|
|
76
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
77
|
+
"fontSize": 12,
|
|
78
|
+
"letterSpacing": 0.48,
|
|
79
|
+
"lineHeight": 16,
|
|
80
|
+
},
|
|
81
|
+
undefined,
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
themeFontWeight="regular"
|
|
85
|
+
themeIntent="disabled"
|
|
86
|
+
>
|
|
87
|
+
This is a test
|
|
88
|
+
</Text>
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
exports[`Caption has info intent style 1`] = `
|
|
92
|
+
<Text
|
|
93
|
+
allowFontScaling={false}
|
|
94
|
+
style={
|
|
95
|
+
Array [
|
|
96
|
+
Object {
|
|
97
|
+
"color": "#4568fb",
|
|
98
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
99
|
+
"fontSize": 12,
|
|
100
|
+
"letterSpacing": 0.48,
|
|
101
|
+
"lineHeight": 16,
|
|
102
|
+
},
|
|
103
|
+
undefined,
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
themeFontWeight="regular"
|
|
107
|
+
themeIntent="info"
|
|
108
|
+
>
|
|
109
|
+
This is a test
|
|
110
|
+
</Text>
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
exports[`Caption has inverted intent style 1`] = `
|
|
114
|
+
<Text
|
|
115
|
+
allowFontScaling={false}
|
|
116
|
+
style={
|
|
117
|
+
Array [
|
|
118
|
+
Object {
|
|
119
|
+
"color": "#ffffff",
|
|
120
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
121
|
+
"fontSize": 12,
|
|
122
|
+
"letterSpacing": 0.48,
|
|
123
|
+
"lineHeight": 16,
|
|
124
|
+
},
|
|
125
|
+
undefined,
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
themeFontWeight="regular"
|
|
129
|
+
themeIntent="inverted"
|
|
130
|
+
>
|
|
131
|
+
This is a test
|
|
132
|
+
</Text>
|
|
133
|
+
`;
|
|
134
|
+
|
|
135
|
+
exports[`Caption has primary intent style 1`] = `
|
|
136
|
+
<Text
|
|
137
|
+
allowFontScaling={false}
|
|
138
|
+
style={
|
|
139
|
+
Array [
|
|
140
|
+
Object {
|
|
141
|
+
"color": "#401960",
|
|
142
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
143
|
+
"fontSize": 12,
|
|
144
|
+
"letterSpacing": 0.48,
|
|
145
|
+
"lineHeight": 16,
|
|
146
|
+
},
|
|
147
|
+
undefined,
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
themeFontWeight="regular"
|
|
151
|
+
themeIntent="primary"
|
|
152
|
+
>
|
|
153
|
+
This is a test
|
|
154
|
+
</Text>
|
|
155
|
+
`;
|
|
156
|
+
|
|
157
|
+
exports[`Caption has regular fontWeight style 1`] = `
|
|
158
|
+
<Text
|
|
159
|
+
allowFontScaling={false}
|
|
160
|
+
style={
|
|
161
|
+
Array [
|
|
162
|
+
Object {
|
|
163
|
+
"color": "#001f23",
|
|
164
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
165
|
+
"fontSize": 12,
|
|
166
|
+
"letterSpacing": 0.48,
|
|
167
|
+
"lineHeight": 16,
|
|
168
|
+
},
|
|
169
|
+
undefined,
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
themeFontWeight="regular"
|
|
173
|
+
themeIntent="body"
|
|
174
|
+
>
|
|
175
|
+
This is a test
|
|
176
|
+
</Text>
|
|
177
|
+
`;
|
|
178
|
+
|
|
179
|
+
exports[`Caption has secondary intent style 1`] = `
|
|
180
|
+
<Text
|
|
181
|
+
allowFontScaling={false}
|
|
182
|
+
style={
|
|
183
|
+
Array [
|
|
184
|
+
Object {
|
|
185
|
+
"color": "#795e90",
|
|
186
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
187
|
+
"fontSize": 12,
|
|
188
|
+
"letterSpacing": 0.48,
|
|
189
|
+
"lineHeight": 16,
|
|
190
|
+
},
|
|
191
|
+
undefined,
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
themeFontWeight="regular"
|
|
195
|
+
themeIntent="secondary"
|
|
196
|
+
>
|
|
197
|
+
This is a test
|
|
198
|
+
</Text>
|
|
199
|
+
`;
|
|
200
|
+
|
|
201
|
+
exports[`Caption has semi-bold fontWeight style 1`] = `
|
|
202
|
+
<Text
|
|
203
|
+
allowFontScaling={false}
|
|
204
|
+
style={
|
|
205
|
+
Array [
|
|
206
|
+
Object {
|
|
207
|
+
"color": "#001f23",
|
|
208
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
209
|
+
"fontSize": 12,
|
|
210
|
+
"letterSpacing": 0.24,
|
|
211
|
+
"lineHeight": 16,
|
|
212
|
+
},
|
|
213
|
+
undefined,
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
themeFontWeight="semi-bold"
|
|
217
|
+
themeIntent="body"
|
|
218
|
+
>
|
|
219
|
+
This is a test
|
|
220
|
+
</Text>
|
|
221
|
+
`;
|
|
222
|
+
|
|
223
|
+
exports[`Caption has subdued intent style 1`] = `
|
|
224
|
+
<Text
|
|
225
|
+
allowFontScaling={false}
|
|
226
|
+
style={
|
|
227
|
+
Array [
|
|
228
|
+
Object {
|
|
229
|
+
"color": "#4d6265",
|
|
230
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
231
|
+
"fontSize": 12,
|
|
232
|
+
"letterSpacing": 0.48,
|
|
233
|
+
"lineHeight": 16,
|
|
234
|
+
},
|
|
235
|
+
undefined,
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
themeFontWeight="regular"
|
|
239
|
+
themeIntent="subdued"
|
|
240
|
+
>
|
|
241
|
+
This is a test
|
|
242
|
+
</Text>
|
|
243
|
+
`;
|
|
244
|
+
|
|
245
|
+
exports[`Caption has success intent style 1`] = `
|
|
246
|
+
<Text
|
|
247
|
+
allowFontScaling={false}
|
|
248
|
+
style={
|
|
249
|
+
Array [
|
|
250
|
+
Object {
|
|
251
|
+
"color": "#5ace7d",
|
|
252
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
253
|
+
"fontSize": 12,
|
|
254
|
+
"letterSpacing": 0.48,
|
|
255
|
+
"lineHeight": 16,
|
|
256
|
+
},
|
|
257
|
+
undefined,
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
themeFontWeight="regular"
|
|
261
|
+
themeIntent="success"
|
|
262
|
+
>
|
|
263
|
+
This is a test
|
|
264
|
+
</Text>
|
|
265
|
+
`;
|
|
266
|
+
|
|
267
|
+
exports[`Caption has warning intent style 1`] = `
|
|
268
|
+
<Text
|
|
269
|
+
allowFontScaling={false}
|
|
270
|
+
style={
|
|
271
|
+
Array [
|
|
272
|
+
Object {
|
|
273
|
+
"color": "#ffbe71",
|
|
274
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
275
|
+
"fontSize": 12,
|
|
276
|
+
"letterSpacing": 0.48,
|
|
277
|
+
"lineHeight": 16,
|
|
278
|
+
},
|
|
279
|
+
undefined,
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
themeFontWeight="regular"
|
|
283
|
+
themeIntent="warning"
|
|
284
|
+
>
|
|
285
|
+
This is a test
|
|
286
|
+
</Text>
|
|
287
|
+
`;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderWithTheme from '../../../../testHelpers/renderWithTheme';
|
|
3
|
+
import Caption from '..';
|
|
4
|
+
|
|
5
|
+
describe('Caption', () => {
|
|
6
|
+
it('renders correctly', () => {
|
|
7
|
+
const { queryAllByText } = renderWithTheme(
|
|
8
|
+
<Caption>This is a test</Caption>
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
expect(queryAllByText('This is a test')).toHaveLength(1);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it.each`
|
|
15
|
+
fontWeight
|
|
16
|
+
${'regular'}
|
|
17
|
+
${'semi-bold'}
|
|
18
|
+
`('has $fontWeight fontWeight style', ({ fontWeight }) => {
|
|
19
|
+
const { toJSON } = renderWithTheme(
|
|
20
|
+
<Caption fontWeight={fontWeight}>This is a test</Caption>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
expect(toJSON()).toMatchSnapshot();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it.each`
|
|
27
|
+
intent
|
|
28
|
+
${'body'}
|
|
29
|
+
${'subdued'}
|
|
30
|
+
${'primary'}
|
|
31
|
+
${'secondary'}
|
|
32
|
+
${'success'}
|
|
33
|
+
${'info'}
|
|
34
|
+
${'warning'}
|
|
35
|
+
${'danger'}
|
|
36
|
+
${'inverted'}
|
|
37
|
+
${'archived'}
|
|
38
|
+
${'disabled'}
|
|
39
|
+
`('has $intent intent style', ({ intent }) => {
|
|
40
|
+
const { toJSON } = renderWithTheme(
|
|
41
|
+
<Caption intent={intent}>This is a test</Caption>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
expect(toJSON()).toMatchSnapshot();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type {
|
|
4
|
+
TextProps as NativeTextProps,
|
|
5
|
+
StyleProp,
|
|
6
|
+
TextStyle,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import { StyledCaption } from './StyledCaption';
|
|
9
|
+
|
|
10
|
+
export interface CaptionProps extends NativeTextProps {
|
|
11
|
+
/**
|
|
12
|
+
* Text content.
|
|
13
|
+
*/
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Font weight of the text.
|
|
17
|
+
*/
|
|
18
|
+
fontWeight?: 'regular' | 'semi-bold';
|
|
19
|
+
/**
|
|
20
|
+
* Visual intent color to apply to the text.
|
|
21
|
+
*/
|
|
22
|
+
intent?:
|
|
23
|
+
| 'body'
|
|
24
|
+
| 'subdued'
|
|
25
|
+
| 'primary'
|
|
26
|
+
| 'secondary'
|
|
27
|
+
| 'success'
|
|
28
|
+
| 'info'
|
|
29
|
+
| 'warning'
|
|
30
|
+
| 'danger'
|
|
31
|
+
| 'inverted'
|
|
32
|
+
| 'archived'
|
|
33
|
+
| 'disabled';
|
|
34
|
+
/**
|
|
35
|
+
* Additional style.
|
|
36
|
+
*/
|
|
37
|
+
style?: StyleProp<TextStyle>;
|
|
38
|
+
/**
|
|
39
|
+
* Testing id of the component.
|
|
40
|
+
*/
|
|
41
|
+
testID?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const Caption = ({
|
|
45
|
+
children,
|
|
46
|
+
fontWeight = 'regular',
|
|
47
|
+
intent = 'body',
|
|
48
|
+
allowFontScaling = false,
|
|
49
|
+
...nativeProps
|
|
50
|
+
}: CaptionProps) => (
|
|
51
|
+
<StyledCaption
|
|
52
|
+
{...nativeProps}
|
|
53
|
+
themeFontWeight={fontWeight}
|
|
54
|
+
themeIntent={intent}
|
|
55
|
+
allowFontScaling={allowFontScaling}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</StyledCaption>
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export default Caption;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const FONTWEIGHT_MAP = {
|
|
2
|
+
light: 'light',
|
|
3
|
+
regular: 'regular',
|
|
4
|
+
'semi-bold': 'semiBold',
|
|
5
|
+
} as const;
|
|
6
|
+
|
|
7
|
+
export type ThemeIntent =
|
|
8
|
+
| 'body'
|
|
9
|
+
| 'subdued'
|
|
10
|
+
| 'primary'
|
|
11
|
+
| 'secondary'
|
|
12
|
+
| 'success'
|
|
13
|
+
| 'info'
|
|
14
|
+
| 'warning'
|
|
15
|
+
| 'danger'
|
|
16
|
+
| 'inverted'
|
|
17
|
+
| 'archived'
|
|
18
|
+
| 'disabled';
|
|
@@ -1114,6 +1114,7 @@ Object {
|
|
|
1114
1114
|
"fontSizes": Object {
|
|
1115
1115
|
"6xlarge": 36,
|
|
1116
1116
|
"7xlarge": 42,
|
|
1117
|
+
"caption": 12,
|
|
1117
1118
|
"large": 16,
|
|
1118
1119
|
"medium": 14,
|
|
1119
1120
|
"small": 12,
|
|
@@ -1138,6 +1139,7 @@ Object {
|
|
|
1138
1139
|
"lineHeights": Object {
|
|
1139
1140
|
"6xlarge": 44,
|
|
1140
1141
|
"7xlarge": 50,
|
|
1142
|
+
"caption": 16,
|
|
1141
1143
|
"large": 24,
|
|
1142
1144
|
"medium": 22,
|
|
1143
1145
|
"small": 16,
|
|
@@ -26,6 +26,7 @@ const getTypographyTheme = (theme: GlobalTheme) => {
|
|
|
26
26
|
xxxxxlarge: theme.fontSizes.xxxxxlarge,
|
|
27
27
|
'6xlarge': theme.fontSizes['6xlarge'],
|
|
28
28
|
'7xlarge': theme.fontSizes['7xlarge'],
|
|
29
|
+
caption: theme.fontSizes.small,
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
const lineHeights = {
|
|
@@ -39,6 +40,7 @@ const getTypographyTheme = (theme: GlobalTheme) => {
|
|
|
39
40
|
xxxxxlarge: theme.lineHeights.xxxxxlarge,
|
|
40
41
|
'6xlarge': theme.lineHeights['6xlarge'],
|
|
41
42
|
'7xlarge': theme.lineHeights['7xlarge'],
|
|
43
|
+
caption: theme.lineHeights.small,
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
return { colors, fonts: theme.fonts, fontSizes, lineHeights };
|
package/src/utils/helpers.ts
CHANGED
|
@@ -3,7 +3,10 @@ import { Platform } from 'react-native';
|
|
|
3
3
|
export const isIOS = Platform.OS === 'ios';
|
|
4
4
|
export const isAndroid = Platform.OS === 'android';
|
|
5
5
|
|
|
6
|
-
export function pick<O, T extends keyof O>(
|
|
6
|
+
export function pick<O extends object, T extends keyof O>(
|
|
7
|
+
keys: T[],
|
|
8
|
+
obj: O
|
|
9
|
+
): Pick<O, T> {
|
|
7
10
|
return keys
|
|
8
11
|
.filter((key) => key in obj)
|
|
9
12
|
.reduce<Partial<O>>(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import type { Variant } from './StyledAccordion';
|
|
4
|
-
export
|
|
4
|
+
export type AccordionItemProps = {
|
|
5
5
|
header: string | ReactElement;
|
|
6
6
|
content: ReactElement;
|
|
7
7
|
open?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
-
export
|
|
3
|
+
export type Variant = 'default' | 'card';
|
|
4
4
|
export declare const StyledWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
5
5
|
theme?: import("@emotion/react").Theme | undefined;
|
|
6
6
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { View, Image, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { TextProps } from '../Typography/Text';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type ThemeSize = 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | 'xxxlarge' | 'xxxxlarge' | 'xxxxxlarge';
|
|
5
|
+
type ThemeIntent = 'primary' | 'info' | 'danger' | 'success' | 'warning';
|
|
6
6
|
declare const StyledWrapper: import("@emotion/native").StyledComponent<import("react-native").TouchableOpacityProps & {
|
|
7
7
|
theme?: import("@emotion/react").Theme | undefined;
|
|
8
8
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Animated } from 'react-native';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type ThemeIntent = 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'archived';
|
|
4
|
+
type ThemePadding = 'narrowContent' | 'wideContent';
|
|
5
5
|
declare const StyledView: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").ViewProps & import("react").RefAttributes<import("react-native").View>> & {
|
|
6
6
|
children?: import("react").ReactNode;
|
|
7
7
|
} & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
3
3
|
import type { IconName } from '../Icon';
|
|
4
|
-
export
|
|
4
|
+
export type BottomNavigationTabType = {
|
|
5
5
|
key: string;
|
|
6
6
|
title?: string;
|
|
7
7
|
icon: IconName;
|
|
@@ -165,6 +165,6 @@ declare const config: {
|
|
|
165
165
|
};
|
|
166
166
|
};
|
|
167
167
|
export declare const flexPropsKey: readonly ["alignContent", "alignItems", "alignSelf", "display", "flex", "flexBasis", "flexDirection", "flexGrow", "flexShrink", "flexWrap", "justifyContent"];
|
|
168
|
-
export
|
|
169
|
-
export
|
|
168
|
+
export type ConfigType = typeof config;
|
|
169
|
+
export type FlexPropsKeyType = typeof flexPropsKey[number];
|
|
170
170
|
export default config;
|
|
@@ -10,11 +10,11 @@ export interface ThemeScale {
|
|
|
10
10
|
radii: keyof Radii;
|
|
11
11
|
borderWidths: keyof BorderWidths;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
export
|
|
13
|
+
type ConfigKeyType = keyof ConfigType;
|
|
14
|
+
export type StyleProps = {
|
|
15
15
|
[key in ConfigKeyType]?: ThemeScale[ConfigType[key]['scale']];
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type FlexStyleProps = Pick<Omit<ViewStyle, keyof StyleProps>, FlexPropsKeyType>;
|
|
18
18
|
export interface BoxViewProps extends ViewProps {
|
|
19
19
|
/**
|
|
20
20
|
* Box's content.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import type { ViewProps } from 'react-native';
|
|
4
4
|
import type { Theme } from '@emotion/react';
|
|
5
|
-
|
|
5
|
+
type ThemeVariant = 'basic-transparent' | 'filled-primary' | 'filled-secondary' | 'filled-danger' | 'outlined-primary' | 'outlined-secondary' | 'outlined-danger' | 'text-primary' | 'text-secondary' | 'text-danger';
|
|
6
6
|
declare const StyledLoadingIndicatorWrapper: import("@emotion/native").StyledComponent<ViewProps & {
|
|
7
7
|
theme?: Theme | undefined;
|
|
8
8
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
2
|
-
|
|
2
|
+
type ThemeVariant = 'basic-transparent' | 'filled-primary' | 'filled-secondary' | 'filled-danger' | 'outlined-primary' | 'outlined-secondary' | 'outlined-danger' | 'text-primary' | 'text-secondary' | 'text-danger';
|
|
3
3
|
interface LoadingIndicatorProps extends ViewProps {
|
|
4
4
|
/**
|
|
5
5
|
* Size of the loading dot.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TouchableHighlight, View } from 'react-native';
|
|
3
3
|
import type { Theme } from '@emotion/react';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type Intent = 'primary' | 'secondary' | 'danger';
|
|
5
|
+
type ThemeVariant = 'filled-primary' | 'filled-secondary' | 'filled-danger' | 'outlined-primary' | 'outlined-secondary' | 'outlined-danger' | 'text-primary' | 'text-secondary' | 'text-danger';
|
|
6
6
|
declare const StyledButtonContainer: import("@emotion/native").StyledComponent<import("react-native").TouchableHighlightProps & {
|
|
7
7
|
theme?: Theme | undefined;
|
|
8
8
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
export
|
|
3
|
+
export type CardCarouselHandles = {
|
|
4
4
|
snapToIndex: (index: number) => void;
|
|
5
5
|
};
|
|
6
6
|
export interface CardCarouselProps {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ImageSourcePropType, ImageResizeMode } from 'react-native';
|
|
3
|
-
export
|
|
3
|
+
export type CarouselImageProps = ImageSourcePropType & {
|
|
4
4
|
height?: number;
|
|
5
5
|
width?: number;
|
|
6
6
|
resizeMode?: ImageResizeMode;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type CarouselData = {
|
|
9
9
|
image: CarouselImageProps | string;
|
|
10
10
|
content?: ReactNode;
|
|
11
11
|
heading: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
|
|
3
|
+
type MarginSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
4
4
|
declare const StyledDivider: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
5
5
|
theme?: import("@emotion/react").Theme | undefined;
|
|
6
6
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
|
|
3
|
+
type ThemeVariant = 'light' | 'dark';
|
|
4
4
|
declare const StyledWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
5
5
|
theme?: import("@emotion/react").Theme | undefined;
|
|
6
6
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Modal, View } from 'react-native';
|
|
3
|
-
|
|
3
|
+
type ErrorVariant = 'full-screen' | 'in-page';
|
|
4
4
|
declare const StyledErrorModal: import("@emotion/native").StyledComponent<import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps & {
|
|
5
5
|
theme?: import("@emotion/react").Theme | undefined;
|
|
6
6
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
2
|
import StyledHeroIcon from './HeroIcon';
|
|
3
|
-
|
|
3
|
+
type AnimatedIconProps = ComponentProps<typeof StyledHeroIcon>;
|
|
4
4
|
declare const AnimatedIcon: ({ style, ...otherProps }: AnimatedIconProps) => JSX.Element;
|
|
5
5
|
export default AnimatedIcon;
|